function windowCheck(){
	//var zoomWindow = '';
	if(newWindow.closed==false)newWindow.close();
	//window.alert("ウインドウがありません。")
}

function bbsWin(){
	//winfl=0;
	avWidth = screen.availWidth;
	avHeight = screen.availHeight;
	winWidth = 600;
	winHeight = 600;
	winLeft = (avWidth-winWidth)/2;
	winTop = (avHeight-winHeight)/2;
	
	if(navigator.appName.charAt(0)=="N"){
		//winfl=1;
		if(newWindow.closed==false){
			newWindow.focus();
		}
		else{
			newWindow =window.open("../cgi-local/jtsbbs/minibbs.cgi","BBS_Window","left=" + winLeft + ",top=0,width=" + winWidth + ",height=" + (avHeight-45) + ",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes");
			newWindow.focus();
		}
	}
	
	if(navigator.appName.indexOf("Microsoft")!=-1){
		//winfl=1;
		if(newWindow.closed==false){
			newWindow.focus();
		}
		else{
			newWindow =window.open("../cgi-local/jtsbbs/minibbs.cgi","BBS_Window","left=" + winLeft + ",top=0,width=" + winWidth + ",height=" + (avHeight-40) + ",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes");
			newWindow.focus();
		}
	}
 }

function bakedCookie() {
	times = getCookie("Times");
	if (times == "") {
		times = 0;
	}
	times++;
	date = getCookie("Date");
	if (date == "") {
		date = "????";
	}
	//document.write("これまでの訪問回数：" + times + "<br>");
	//document.write("前回の訪問日：" + date + "<br>");

	//times++;

	dd = new Date();
	ye = dd.getYear();      if (ye < 1900) ye += 1900;
	mo = dd.getMonth() + 1; if (mo < 10) mo = "0" + mo;
	da = dd.getDate();      if (da < 10) da = "0" + da;
	ho = dd.getHours();     if (ho < 10) ho = "0" + ho;
	mi = dd.getMinutes();   if (mi < 10) mi = "0" + mi;
	se = dd.getSeconds();   if (se < 10) se = "0" + se;
	date = ye + "/" + mo + "/" + da + " " + ho + ":" + mi + ":" + se;

	setCookie("Times", times);
	setCookie("Date", date);

	// clearCookie("Times");
	// clearCookie("Date");
}

function getCookie(key,  tmp1, tmp2, xx1, xx2, xx3) {
	tmp1 = " " + document.cookie + ";";
	xx1 = xx2 = 0;
	len = tmp1.length;
	while (xx1 < len) {
		xx2 = tmp1.indexOf(";", xx1);
		tmp2 = tmp1.substring(xx1 + 1, xx2);
		xx3 = tmp2.indexOf("=");
		if (tmp2.substring(0, xx3) == key) {
			return(unescape(tmp2.substring(xx3 + 1, xx2 - xx1 - 1)));
		}
		xx1 = xx2 + 1;
	}
	return("");
}

function setCookie(key, val, tmp) {
	tmp = key + "=" + escape(val) + "; ";
	// tmp += "path=" + location.pathname + "; ";
	//tmp += "expires=Tue, 31-Dec-2030 23:59:59; ";
	document.cookie = tmp;
}

function clearCookie(key) {
	document.cookie = key + "=" + "xx; expires=Tue, 1-Jan-1980 00:00:00;";
}

function flashCookie() {
	times = getCookie("Times");
	document.write("これまでの訪問回数：" + times + "<br>");
}

function randomNum() {
	var num;
	num = 7;
	image = Math.floor(Math.random() * num);
	if (times == "1") {
		document.write("<img src='img/home_photo_0.jpg' width='338' height='376' border='0' alt='JTs'>");
	}
	else {
		document.write("<img src='img/home_photo_"+image+".jpg' width='338' height='376' border='0' alt='JTs'>");
	}
}

function JTs() {
	movieName ="flash/main.swf";
	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH=760 HEIGHT=400>');
	document.write('<PARAM NAME=movie VALUE="' + movieName + '">');
	document.write('<PARAM NAME=menu VALUE=false>');
	document.write('<PARAM NAME=quality VALUE=autohigh>');
	document.write('<PARAM NAME=scale VALUE=exactfit>');
	document.write('<PARAM NAME=bgcolor VALUE=#FFFFFF>');
	document.write('<EMBED src="' + movieName + '" menu=false quality=autohigh scale=exactfit bgcolor=#FFFFFF  WIDTH=760 HEIGHT=400 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
	document.write('</EMBED>');
	document.write('</OBJECT>');
}



function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}