// JavaScript Document

var pathName;
var baseURL;
var isIndex;
var isGamania;

pathName = location.pathname.split("/");

if( pathName[1].match(/(gamania)|(biglobe)|(dion)|(nifty)|(ocn)|(so-net)/) ) {
	baseURL   = "/" + pathName[1];
	baseIndex = 2;
	IsGamania = true;
} else {
	baseURL   = ""
	baseIndex = 1;
	IsGamania = false;
}

isIndex = (pathName[baseIndex]=="index.aspx" || pathName[baseIndex]=="index_gamania.aspx" || pathName[baseIndex]=="");

function AlterLink(){
	var m;
	var path;

	for(i=0; i<document.links.length; i++){
		if( document.links[i].target=="alterlink" || document.links[i].target=="alterblank" ) {

			if( document.links[i].target=="alterblank" ) {
				document.links[i].target = "_blank";
			} else {
				document.links[i].target = "";
			}

			m = document.links[i].pathname.indexOf("?");

			if( m>0 ) {
				path = document.links[i].pathname.substring(0,m) + document.links[i].search;
			} else {
				path = document.links[i].pathname + document.links[i].search;
			}

			if( document.links[i].pathname[0]=="/" ) {
				document.links[i].href = baseURL + path;
			} else {
				document.links[i].href = baseURL + "/" + path;
			}
		}
	}
}

/*****************************************************************
/*
/* Flash表示の為のスクリプト
/* Quality, FlashVars, wModeには無ければデフォルト値を挿入
/*
/*****************************************************************/
function ShowFlash(Width, Height, Src, Quality, FlashVars, wMode) {

  var flashClassID = "D27CDB6E-AE6D-11cf-96B8-444553540000";
  var iePlugIn     = "//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0";
  var ffPlugIn     = "//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0";
  var niePlugIn    = "//www.macromedia.com/go/getflashplayer";

	var now    = new Date();
	var year   = now.getFullYear();
	var month  = now.getMonth();
	var day    = now.getDay();
	var hour   = now.getHours();
	var min    = now.getMinutes();
	var sec    = now.getSeconds();
	var Target = Src;// + '?' + year + month + day + hour + day + min + sec;


	if( typeof(Quality) == "undefined" ) {
		Quality = "high";
	}

	if( typeof(FlashVars) == "undefined" ) {
		FlashVars = "";
	}

	if( typeof(wMode) == "undefined" ) {
		wMode = "opaque";
	}

	document.write(
			"<object classid='clsid:"+flashClassID+"' width='" + Width + "' height='" + Height + "' codebase='"+iePlugIn+"'>"
		+  "<param name='movie' value='" + Target + "'>"
		+  "<param name='quality' value='" + Quality + "'>"
		+  "<param name='menu' value='false'>"
		+  "<param name='wmode' value='" + wMode + "'>"
	);

	if( FlashVars != "" ) {
		document.write(
			"<param name='FlashVars' value='" + FlashVars + "'>"
		);
	}

	document.write(
		"<embed src='" + Target + "' quality='" + Height + "' width='" + Width + "' height='" + Height + "' menu='false' wmode='" + wMode + "' FlashVars='" + FlashVars + "' pluginspage='"+niePlugIn+"' type='application/x-shockwave-flash'></embed></object>"
	);

}


/*****************************************************************
/*
/* JavaScriptメニュー表示
/* 指定されたIDのBOXを表示したりしなかったり
/* 表示しない:hidden
/* 表示する:visible
/*
/*****************************************************************/
function NewBanner(RegDate, Term, Tag){

	if( typeof(Term) == "undefined" ) {
		Term = 2;
	}

	if( typeof(Tag) == "undefined" ) {
		Tag = "<img align='absmiddle' src='/images/new_icon.gif'>";
	}

	if( ((new Date()-new Date(RegDate)) / (24*60*60*1000)) <= Term) {
		document.write(Tag);
	}
}

/*****************************************************************
/*
/* ポップアップ表示用
/*
/*****************************************************************/
function popup(path, name, width, height, position, scrollbars, resizable) {

	if( typeof(position) == "undefined" ) {
		position = "center";
	}

	if( typeof(scrollbars) == "undefined" ) {
		scrollbars = "no";
	}

	if( typeof(resizable) == "undefined" ) {
		resizable = "yes";
	}

	if(position == "center") {
		lf= (window.screen.availWidth - width) / 2;
		tp = (window.screen.availHeight - height) / 2;
	} else if(position == "right") {
		lf = window.screen.availWidth - width - 10;
		tp= 0;
	} else {
		lf= 0;
		tp = 0;
	}

	window.open("/popup.html?src="+path, name, "top="+tp+",left="+lf+",width="+width+",height="+height+",resizable="+resizable+",scrollbars="+scrollbars+",status=no,toolbar=no,directories=no,menubar=no");
}



