
/*****************************************************************
/*
/* ガマニアを含めコピーサイト連携用
/*
/*****************************************************************/
var pathName;
var baseURL;
var baseIndex;
var isIndex;
var isGamania;

pathName = location.pathname.split("/");

if( pathName[1].match(/(non_flash)/) ) {
	baseURL   = "/" + pathName[1];
	baseIndex = 2;
	isGamania = false;
} else 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, Refresh) {

	// テストサイトでは ON
	Refresh = "true";

	var Target = Src;

	if( typeof(Refresh) == "undefined" || Refresh != "true" ) {
		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();
		Target += '?' + 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:D27CDB6E-AE6D-11cf-96B8-444553540000' width='" + Width + "' height='" + Height + "' codebase='//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0'>"
		+  "<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='//www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash'></embed></object>"
	);

}


/*****************************************************************
/*
/* JavaScriptメニュー表示
/* 指定されたIDのBOXを表示したりしなかったり
/* 表示しない:hidden
/* 表示する:visible
/*
/*****************************************************************/
function ShowMenu(TagID, Visibility) {
  
  switch(Visibility) {

    case "block":
    case "none":
    case "inline":
    case "list-item":
    	document.getElementById(TagID).style.display = Visibility;
    	break;

    case "hidden":
    case "visible":
    default:
    	document.getElementById(TagID).style.visibility = Visibility;
    	break;
	}
	
}


/*****************************************************************
/*
/* 事前に用意された２つの画像
/* **_f1.*** と **_f2.*** をスワップ（入替）
/*
/*****************************************************************/
function SwapImg(arg1, arg2) {
	if( arg2 == "over" ) {
		arg1.src = arg1.src.replace("_f1.", "_f2.");
	} else {
		arg1.src = arg1.src.replace("_f2.", "_f1.");
	}

}

/*****************************************************************
/*
/* 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/index/tag_new.png'>";
	}

	var Term = 2;  //期限

	if( ((new Date()-new Date(RegDate)) / (24*60*60*1000)) <= Term)
		document.write(Tag);
}

/*****************************************************************
/*
/* ポップアップ表示用
/*
/*****************************************************************/
function popup(path, name, width, height, position) {
	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=yes,scrollbars=no,status=no,toolbar=no,directories=no,menubar=no");
}

function popup2(path, name, width, height, position) {
	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=yes,scrollbars=yes,status=no,toolbar=no,directories=no,menubar=no");
}

function popupAny(path, name, width, height, position) {
	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(path, name, "top="+tp+",left="+lf+",width="+width+",height="+height+",resizable=yes,scrollbars=yes,status=no,toolbar=no,directories=no,menubar=no");
}

function popupAny2(path, name, width, height, position) {
	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(path, name, "top="+tp+",left="+lf+",width="+width+",height="+height+",resizable=yes,scrollbars=yes,status=no,toolbar=no,directories=no,menubar=no");
}


function ShowGBanner() {
	var GBannerURL;

	if( pathName[1].match(/(gamania)/) )
	{
		GBannerURL = "http://service.gamania.co.jp/cabal/cp060821";
	}
	else if( pathName[1].match(/(so-net)/) )
	{
		GBannerURL = "http://service.gamania.co.jp/isp/sonet/cabal/cp060821";
	}
	else if( pathName[1].match(/(biglobe)/) )
	{
		GBannerURL = "http://service.gamania.co.jp/isp/biglobe/cabal/cp060821";
	}
	else if( pathName[1].match(/(dion)/) )
	{
		GBannerURL = "http://service.gamania.co.jp/isp/dion/cabal/cp060821";
	}
	else if( pathName[1].match(/(nifty)/) )
	{
		GBannerURL = "http://service.gamania.co.jp/isp/nifty/cabal/cp060821";
	}
	else if( pathName[1].match(/(ocn)/) )
	{
		GBannerURL = "http://service.gamania.co.jp/isp/ocn/cabal/cp060821";
	}

	if(GBannerURL != "")
	{
		document.write("<a href='");
		document.write(GBannerURL);
		document.write("' target='_blank'><img src='/images/gamania_beta_banner.jpg'></a>");
	}
}

function showcategory( num )
{
	try{
		if( document.all.item("tree"+num).style.display == "none" ) {
			document.all.item("tree"+num).style.display = "";
		} else {
			document.all.item("tree"+num).style.display = "none";
		}
	} catch(e) {
		if( document.getElementById("tree"+num).style.display == "none" ) {
			document.getElementById("tree"+num).style.display = "";
		} else {
			document.getElementById("tree"+num).style.display = "none";
		}
	}
}

