//dw  ->  幅の差
//dh  ->  高さの差
//rdw ->  リサイズありの場合の幅の差
function getBrowserVersion() {
	var bwr_ns = (navigator.appName.indexOf("Netscape")  >= 0);
	var bwr_ie = (navigator.appName.indexOf("Microsoft") >= 0);
	var csstag ='<LINK REL="Stylesheet" TYPE="text/css" HREF="'+directory+'../common/';
	var cssfile = 'other.css';
// Macintosh////////////////////////////////////////////////////////////
	if (navigator.userAgent.indexOf('Mac') >= 0) {
		if (bwr_ns) {
			var appVer  = navigator.appVersion;
			var s = appVer.indexOf(" ",0);
			var version = eval(appVer.substring(0,s));
			if (version >= 5) {
				cssfile = 'mac_nn.css';
				dw=dh=0;
				rdw=15;
				rw=788;
				rh=587;
			}else{
				cssfile = 'mac_nn.css'
				dw=dh=0;
				rdw=0;
				rw=773;
				rh=556;
			}
		}
		if (bwr_ie) {
			cssfile = 'mac_ie.css';
			dw=dh=-16;
			rdw=-1;
			rw=788;
			rh=584;
		}
	}
// Windows////////////////////////////////////////////////////////////
	else if (navigator.userAgent.indexOf('Win') >= 0) {
		if (bwr_ns) {
			cssfile = 'win_nn.css'
			dw=dh=0;
			rdw=15;
			rw=800;
			rh=600;
		}
		if (bwr_ie) {
			cssfile = 'win_ie.css'
			dw=dh=0;
			rdw=17;
			rw=800;
			rh=600;
		}
	}else{
		cssfile = 'win_ie.css'
		dw=dh=0;
		rdw=0;
		rw=800;
		rh=600;
	}
	csstag += cssfile;
	csstag += '" TITLE="CSS for TOTO">';
	document.write(csstag);
	document.close();
}

function openBrWindow(theURL,winName,w,h,l,t,features) {
	if(features==""){
		features="width="+(w+dw)+",height="+(h+dh)+",left="+l+",top="+t+","+features;
	}else{
		features="width="+(w+rdw)+",height="+h+",left="+l+",top="+t+","+features;
	}
	sub_win=window.open(theURL,winName,features);
	if(sub_win.opener==null){
		sub_win.opener=window;
	}
	sub_win.focus();
}

function game() {
	openBrWindow("game/index.htm","game",700,500,100,100,"");
}

function openGame() {
	openBrWindow(directory+"hajimete_toilet/index.htm","hajimete",700,520,100,100,"");
}

function openFactory() {
	openBrWindow(directory+"factory/index.htm","factory",700,500,100,100,"");
}


function openSong() {
	openBrWindow(directory+"song/index.htm","song",700,500,100,100,"");
}

function openEco() {
	openBrWindow(directory+"environment/index.htm","environment",700,487,100,100,"toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
}
function openMuseum() {
	openBrWindow(directory+"museum/index.htm","Museum",700,507,100,100,"");
}

function closeWindow() {
	setTimeout("window.close()",1);
}