/* CSS差分ファイル読み込み */

function ReDir(num){
	if(num==0){
		dir ="";
	}else if(num==1){
		dir ="../";
	}else if(num==2){
		dir ="../../";
	}else if(num==3){
		dir ="../../../";
	}else if(num==4){
		dir ="../../../../";
	}else if(num==5){
		dir ="../../../../../";
	}else if(num==6){
		dir = "../../../../../../";
	}
	return dir;
}

function ReadCss(num){
	var fName="";
	var dir="";
	var ua = navigator.userAgent.toUpperCase();
	var plt = (navigator.platform) ? navigator.platform : 'Other';

	if(ua.indexOf('MAC OS X') > -1){
		if(navigator.userAgent.indexOf('Safari') > -1){
			fName = "df_safari.css";
		}else if(navigator.userAgent.indexOf('Gecko') > -1){
			fName = "df_macgecko.css";
		}
	}else if(plt.indexOf('Mac') > -1){
		//For Mac OS9
	}else if(navigator.appName.indexOf('Microsoft') > -1){
		//var ua = navigator.userAgent.toUpperCase();
		//if(ua.indexOf("NT 6.0") != -1 || ua.indexOf("WS V") != -1){
			//if(navigator.appVersion.indexOf('MSIE 7') > -1){
				//fName = "df_ie7v.css";
			//}
		//}else

		if(navigator.appVersion.indexOf('MSIE 6') > -1){
			fName = "df_ie6.css";
		}else if(navigator.appVersion.indexOf('MSIE 7') > -1){
			fName = "df_ie7.css";
		}
	}

	if(fName!=""){		
		//相対パス用
		dir = ReDir(num);
		document.write('<link rel="stylesheet" href="' + dir + 'css/df_file/' + fName + '" type="text/css">');
	}
}

/* --- entertainment用CSS ------------------------------ */

function ReadCss2(num){
	
	ReadCss(num);
	
	// 旧ファイル読み込み
	var dir="";
	dir = ReDir(num);
	var bName = navigator.appName.charAt(0);

	if(navigator.appVersion.indexOf('Mac') > -1){
		if(navigator.appName.indexOf('Microsoft') > -1){
			fName = "mac_IE.css";
		}else if(navigator.userAgent.indexOf('Safari') > -1){
			fName = "mac_NN.css";
		}else if(navigator.appVersion.indexOf('4') > -1){
			fName = "mac_NN4.css";
		}else{
			fName = "mac_NN.css";
		}
	}else{
		if(navigator.appName.indexOf('Microsoft') > -1){
			fName = "win_IE.css";
		}else{
			if(navigator.appVersion.indexOf('4') > -1){
				fName = "win_NN4.css";
			}else{
				fName = "win_NN.css";
			}
		}
	}
	document.write('<link rel="stylesheet" href="' + dir + 'css/entertainment/' + fName + '" type="text/css">');

}

/* --- entertainment用 JS ---- */
function WinOp(url){
	window.open(url,'hinshitu','width=450,height=510,scrollbars=1,resizable=1');
}

/* --- RSS配信ページ用 --- */
function RssOp(){
	window.open('/utility/rss.html','rss','width=')
}


/* --- /utility/faq.html （よくある質問ページ用） --- */

function showhide(id){

  if(document.getElementById){

    if(document.getElementById(id).style.display == "none")

      document.getElementById(id).style.display = "block";

    else

      document.getElementById(id).style.display = "none";

  }

}



function bgColorChanger(id, sid, hex){

	document.getElementById(id).style.backgroundColor = hex;

	document.getElementById(sid).style.backgroundColor = hex;

}

function bgColorChanger_s(o,clr){

	o.style.backgroundColor = clr;

}



function seltab(bpref, hpref, id_max, selected) {

  if (! document.getElementById) return;

  for (i = 0; i <= id_max; i++) {

    if (! document.getElementById(bpref + i)) continue;

    if (i == selected) {

      document.getElementById(bpref + i).style.display = "block";

      document.getElementById(bpref + i).style.position = "";

      document.getElementById(hpref + i).className = "open";

    } else {

      document.getElementById(bpref + i).style.display = "none";

      document.getElementById(bpref + i).style.position = "absolute";

      document.getElementById(hpref + i).className = "close";

    }

  }

}

function layer_open(id) {

	var target1;

	target1 = document.getElementById('layer_v' + id);

	target1.style.visibility='visible';

	target1.style.display='block';

	target1.style.zIndex=3;

}



function layer_clause(id) {

	var target1;

	target1 = document.getElementById('layer_v' + id);

	target1.style.visibility='hidden';

	target1.style.zIndex=1;

}



/* --- popup --- */

function openNewWin(url, name, w, h) {

	var newWin;

	var options = "toolbar=no,menubar=yes,status=yes,scrollbars=yes,resizable=yes";

	newWin = window.open(url, name,"width=" + w + ",height=" + h + options);

	newWin.focus();

}





/* --- 草野さんコーディング用CSS（made by 日清食品）後で削除 ------------------------------ */

function ReadCssKusano(num){
	
	var fName="";
	var dir="";
	var ua = navigator.userAgent.toUpperCase();
	var plt = (navigator.platform) ? navigator.platform : 'Other';

	if(ua.indexOf('MAC OS X') > -1){
		if(navigator.userAgent.indexOf('Safari') > -1){
			fName = "df_safari_kusano.css";
		}else if(navigator.userAgent.indexOf('Gecko') > -1){
			fName = "df_macgecko_kusano.css";
		}
	}else if(plt.indexOf('Mac') > -1){
		//For Mac OS9
	}else if(navigator.appName.indexOf('Microsoft') > -1){
		//var ua = navigator.userAgent.toUpperCase();
		//if(ua.indexOf("NT 6.0") != -1 || ua.indexOf("WS V") != -1){
			//if(navigator.appVersion.indexOf('MSIE 7') > -1){
				//fName = "df_ie7v.css";
			//}
		//}else

		if(navigator.appVersion.indexOf('MSIE 6') > -1){
			fName = "df_ie6_kusano.css";
		}else if(navigator.appVersion.indexOf('MSIE 7') > -1){
			fName = "df_ie7_kusano.css";
		}
	}

	if(fName!=""){		
		//相対パス用
		dir = ReDir(num);
		document.write('<link rel="stylesheet" href="' + dir + 'css/df_file/kusano/' + fName + '" type="text/css">');
	}

}
