var ops = navigator.userAgent;
var isIE  = (ops.indexOf("MSIE") != -1) ? true : false;
var isWin = (ops.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (ops.indexOf("Opera") != -1) ? true : false;
var isSafari = (ops.indexOf("AppleWebKit") != -1) ? true : false;
var dame = false;
if(!isWin){
	if(isIE){ dame = true; }
	if(isOpera && eval(ops.charAt(ops.indexOf("Opera") + 6)) < 9){ dame = true; }
}
var hitnb = alph = 0;
var mhit,animeID;
var shitnb = salph = 0;
var shit,sanimeID;

function bChg1(nb){
	if(dame){ return; }
	if(nb == hitnb){ init(); }
}
function bChg2(nb){
	if(dame){ return; }
	hitnb = nb; alph = 0;
	animeID = setInterval("moveDraw()",50);
}
function moveDraw(){
	if(hitnb == 0){ return; }
	if(alph < 100){
		mhit = document.getElementById("mhit");
		alph += 10;
		mhit.style.top = "79px";
		mhit.style.left = (hitnb - 1) * 156 + "px";
		if(isWin && isIE){ mhit.filters[0].opacity = alph; }
		else if(isOpera){ mhit.style.opacity = alph/100; }
		else if(isSafari){ mhit.style.KhtmlOpacity = alph/100; }
		else{ mhit.style.MozOpacity = alph/100; }
	}else{
		if(animeID){ clearInterval(animeID); }
	}
}
function init(){
	mhit = document.getElementById("mhit");
	mhit.style.top = mhit.style.left = "0px";
	if(isWin && isIE){ mhit.filters[0].opacity = 0; }
	else if(isOpera){ mhit.style.opacity = 0; }
	else if(isSafari){ mhit.style.KhtmlOpacity = 0; }
	else{ mhit.style.MozOpacity = 0; }
	hitnb = 0;
	if(animeID){ clearInterval(animeID); }
}

function sChg1(nb){
	if(!isWin && isIE){ return; }
	if(nb == shitnb){ init2(); }
}
function sChg2(nb){
	if(!isWin && isIE){ return; }
	shitnb = nb; salph = 0;
	sanimeID = setInterval("moveDraw2()",50);
}
function moveDraw2(){
	if(shitnb == 0){ return; }
	if(salph < 100){
		shit = document.getElementById("shit");
		salph += 10;
		if(shitnb != 12){ shit.style.left = ((shitnb - 1) * 75 + 103) + "px"; shit.style.width = "75px"; }
		else{ shit.style.left = "1px"; shit.style.width = "95px"; }
		if(isWin && isIE){ shit.filters[0].opacity = salph; }
		else if(isOpera){ shit.style.opacity = salph/100; }
		else if(isSafari){ shit.style.KhtmlOpacity = salph/100; }
		else{ shit.style.MozOpacity = salph/100; }
	}else{
		if(sanimeID){ clearInterval(sanimeID); }
	}
}
function init2(){
	shit = document.getElementById("shit");
	shit.style.left = "0px";
	if(isWin && isIE){ shit.filters[0].opacity = 0; }
	else if(isOpera){ shit.style.opacity = 0; }
	else if(isSafari){ shit.style.KhtmlOpacity = 0; }
	else{ shit.style.MozOpacity = 0; }
	shitnb = 0;
	if(sanimeID){ clearInterval(sanimeID); }
}

var tpht1 = new Array();
var tpht2 = new Array();
for(var i=1;i<=2;i++){
	tpht1[i] = new Image();
	tpht1[i].src = "./img/tb" + i + ".png";
	tpht2[i] = new Image();
	tpht2[i].src = "./img/tbb" + i + ".png";
}
function tChg1(nb){
	var mtd = "tb" + nb;
	document.getElementById(mtd).src = tpht1[nb].src;
}
function tChg2(nb){
	var mtd = "tb" + nb;
	document.getElementById(mtd).src = tpht2[nb].src;
}
if(!isWin){
	var txt = "body{ font-size:12px; }\n#header div.hdlink li{ font-size:10px; }\n";
	if(isSafari){
		txt += "h2{ letter-spacing:-0.1em; }\nh3{ letter-spacing:-0.1em; }\n";
	}
	if(dame){ txt += "#header #mhit{ visibility:hidden; }\n#submenu #shit{ visibility:hidden; }\n"; }
	document.write("<style type='text/css' media='screen'><!--\n" + txt + "-->\n</style>\n");
}
if(ops.indexOf("Windows NT") != -1){
	if(eval(ops.charAt(ops.indexOf("Windows NT") + 11)) > 5){
		document.write("<style type='text/css'><!--\nbody{ font-size:78%; }\n-->\n</style>\n");
	}
}