/******** bbo *********/
function KT_subwin(theURL){
  window.open(theURL,'subwindow');
}
function KT_mainwin(theURL){
  window.open(theURL,'idsite');
	window.blur();
}
function KT_mainwin_and_close(theURL){
  window.open(theURL,'idsite');
  window.close();
}
function KT_detailwin(theURL,theSize){
  window.open(theURL,'detailwin','menubar=yes,scrollbars=yes,resizable=yes,status=yes,width=880,height=600');
}
function KT_miniwin2(theURL,theSize){
  window.open(theURL,'miniwinB','menubar=no,scrollbars=yes,resizable=yes,'+theSize);
}
function KT_miniwinTo(theURL,winName,theSize){
  window.open(theURL,winName,'menubar=no,scrollbars=yes,toolbar=no,location=yes,resizable=yes,status=yes,'+theSize);
}
//--------------------------------------
function historyback() {
	history.back();
}
//--------------------------------------ログアウトしたら閉じる
var objWnd;
function KT_postFormWin(formName,theSize){
    objWnd = window.open('', 'sslWin','menubar=no,scrollbars=yes,toolbar=no,location=yes,resizable=yes,status=yes,'+theSize);
    document.getElementById(formName).target = "sslWin";
}
function ClosesslWin() {
	if (objWnd) objWnd.close();
}
//--------------------------------------
function focusColor(i){
	i.style.borderColor='#737377';
	i.style.backgroundColor='#FFFFFF';
}
function blurColor(i){
	i.style.borderColor='#AAAAAF';
	i.style.backgroundColor='#F7F7FF';
}
//--------------------------------------
window.focus();
//--------------------------------------
function KT_disp() { //v2.0
 maptest.style.display="block";
}
//=======================================
function showpara(num) {
   if(document.all) {
      document.all("answer" + num).style.display = "block";
      document.all("sw" + num + "a").style.display = "none";
      document.all("sw" + num + "b").style.display = "inline";
   } else if(document.getElementById) {
      document.getElementById("answer" + num).style.display = "block";
      document.getElementById("sw" + num + "a").style.display = "none";
      document.getElementById("sw" + num + "b").style.display = "inline";
   }
   
}
function hidepara(num) {
   if(document.all) {
      document.all("answer" + num).style.display = "none";
      document.all("sw" + num + "a").style.display = "inline";
      document.all("sw" + num + "b").style.display = "none";
   } else if(document.getElementById) {
      document.getElementById("answer" + num).style.display = "none";
      document.getElementById("sw" + num + "a").style.display = "inline";
      document.getElementById("sw" + num + "b").style.display = "none";
   }
}
//=======================================
function showAcc(num,suu) {
   if(document.all) {
      document.all("nyoro" + num).style.display = "block";
      document.all("change" + num + "a").style.display = "none";
      document.all("change" + num + "b").style.display = "block";
   } else if(document.getElementById) {
      document.getElementById("nyoro" + num).style.display = "block";
      document.getElementById("change" + num + "a").style.display = "none";
      document.getElementById("change" + num + "b").style.display = "block";
   }
	 for (i=1; i<=suu; i++){
		 if(num != i){hideAcc(i);}
	 }
}

function hideAcc(num) {
   if(document.all) {
      document.all("nyoro" + num).style.display = "none";
      document.all("change" + num + "a").style.display = "block";
      document.all("change" + num + "b").style.display = "none";
   } else if(document.getElementById) {
      document.getElementById("nyoro" + num).style.display = "none";
      document.getElementById("change" + num + "a").style.display = "block";
      document.getElementById("change" + num + "b").style.display = "none";
   }
}
//=======================================
function showblock(num) {
	for (var j=1; j <= 5; j++) {
		if(j != num){
			 if(document.all) {
			 	document.all("block" + j).style.display = "none";
			 } else if(document.getElementById) {
				document.getElementById("block" + j).style.display = "none";
			}
		}
	}
	if(document.all) {
		document.all("block" + num).style.display = "block";
	} else if(document.getElementById) {
		document.getElementById("block" + num).style.display = "block";
	}
}
//======================================= enter key block
 function BlockEnter(evt){
	evt = (evt) ? evt : event; 
	var charCode=(evt.charCode) ? evt.charCode : 
		((evt.which) ? evt.which : evt.keyCode);
	if ( Number(charCode) == 13 || Number(charCode) == 3) {
		return false;
	} else {
		return true;
	}
}
//--------------------------------------
  function attachBlockEnter(formid) {
	var elements = document.forms[formid].elements;
	for (var j=0; j < elements.length; j++) {
		var e = elements[j];	
		if (e.type == "text"){
			e.onkeypress=BlockEnter;
		}
	}
}
//=======================================
function panel02() {
	document.getElementById("panel01").style.display = "none";
	document.getElementById("panel02").style.display = "block";
}
function panel01() {
	document.getElementById("panel02").style.display = "none";
	document.getElementById("panel01").style.display = "block";
}
//=======================================
function KT_fullsctgt(theURL){
	ww=screen.availWidth;
	hh=screen.availHeight;
  window.open('testroom.php','fullwin',"menubar=no,status=no,scrollbars=no,resizable=no,width="+ww+",height="+hh+",top=0,left=0");
}
//--------------------------------------
function KT_fullscreen(theURL){
	ww=screen.availWidth;
	hh=screen.availHeight;
  window.open(theURL,'fullwin',"menubar=no,status=no,scrollbars=no,resizable=yes,width="+ww+",height="+hh+",top=0,left=0");
}
//=======================================googleMap
//<![CDATA[
var map = null;
var geocoder = null;
function loadMap() {
	if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById("Gmap"));
		map.addControl(new GLargeMapControl());
		map.addControl(new GOverviewMapControl());
		map.addControl(new GMapTypeControl());
		map.setCenter(new GLatLng(39.31, 137.31), 5);
		geocoder = new GClientGeocoder();
	}
}
function showAddress(address,spname) {
	if (geocoder) {
		geocoder.getLatLng(
			address,
			function(point) {
				if (!point) {
					alert(address +" \u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002");
				} else {
					map.clearOverlays();
					map.setCenter(point, 15);
					var marker = new GMarker(point);
					map.addOverlay(marker);
					marker.openInfoWindowHtml(spname);
				}
			}
		);
	}
}
//]]>
//=======================================googleMapここまで
//--------------------------------------スクロールしてページtopへ
function goTopKT() {
	var d=document;
	var scroll_left=d.body.scrollLeft || d.documentElement.scrollLeft || d.scrollX || 0;
	var scroll_top=d.body.scrollTop || d.documentElement.scrollTop || d.scrollY || 0;
	scrollTo(scroll_left/1.1, scroll_top/1.1);
	if(scroll_left>0 || scroll_top>0){
		var f=setTimeout("goTopKT()", 5);
	}else{
		clearTimeout(f);
	}
}
//======================================= PopMenu KT/
var DDSPEED = 1;
var DDTIMER = 1;

function ddMenu(id,dir) {
  var head = document.getElementById(id + '-ddheader');
  var cont = document.getElementById(id + '-ddcontent');
  clearInterval(cont.timer);
  if(dir == 1) {
    clearTimeout(head.timer);
    if(cont.maxh && cont.maxh <= cont.offsetHeight) {
      return;
    } else if(!cont.maxh) {
      cont.style.display = 'block';
      cont.style.height = 'auto';
      cont.maxh = cont.offsetHeight;
      cont.style.height = '0px';
    }
    cont.timer = setInterval("ddSlide('" + id + "-ddcontent', 1)", DDTIMER);
  } else {
    head.timer = setTimeout('ddCollapse(\'' + id + '-ddcontent\')', 50);
  }
}

function ddCollapse(id) {
  var cont = document.getElementById(id);
  cont.timer = setInterval("ddSlide('" + id + "', -1)", DDTIMER);
}

function cancelHide(id) {
  var head = document.getElementById(id + '-ddheader');
  var cont = document.getElementById(id + '-ddcontent');
  clearTimeout(head.timer);
  clearInterval(cont.timer);
  if(cont.offsetHeight < cont.maxh) {
    cont.timer = setInterval("ddSlide('" + id + "-ddcontent', 1)", DDTIMER);
  }
}

function ddSlide(id,dir) {
  var cont = document.getElementById(id);
  var currheight = cont.offsetHeight;
  var dist;
  if(dir == 1) {
    dist = (Math.round((cont.maxh - currheight) / DDSPEED));
  } else {
    dist = (Math.round(currheight / DDSPEED));
  }
  if(dist <= 1 && dir == 1) {
    dist = 1;
  }
  cont.style.height = currheight + (dist * dir) + 'px';
  cont.style.opacity = currheight / cont.maxh;
  cont.style.filter = 'alpha(opacity=' + (currheight * 100 / cont.maxh) + ')';
  if((currheight < 2 && dir != 1) || (currheight > (cont.maxh - 2) && dir == 1)) {
    clearInterval(cont.timer);
  }
}


