// JavaScript Document
var xmlhttp = null;

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_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 popJump(selOBJ)
{
        n = selOBJ.selectedIndex;
		if(selOBJ != ""){
        location.href = selOBJ.options[n].value;
		}
}

function MO(v){
	id="sub"+v; id2="menu"+v;
	if(document.all){
		obj=document.all[id].style;
		obj2=document.all[id2].style;
	}else if(document.layers){
		obj=document.layers[id];
		obj2=document.layers[id2];
	}else if(document.getElementById){
		obj=document.getElementById(id).style;
		obj2=document.getElementById(id2).style;
	}
	
	obj3=document.getElementById('result').style;
	
	obj3.height="300px";
	obj.visibility="visible";
	obj.height="320px";
	zindex = "z-index";
	obj.zindex="150";

}


function MT(v){
	id="sub"+v;
	id2="menu"+v;
	if(document.all){
		obj=document.all[id].style;
		obj2=document.all[id2].style;
	}else if(document.layers){
		obj=document.layers[id];
		obj2=document.layers[id2];
	}else if(document.getElementById){
		obj=document.getElementById(id).style;
		obj2=document.getElementById(id2).style;
	}

	obj3=document.getElementById('result').style;
	
	obj3.height="1px";

	obj.visibility="hidden";
	obj.height="1px";
	zindex = "z-index";
	obj.zindex="0";

}

function changeIFrame(jumpURL)
{
	myFrame.location.href = jumpURL;
}

function loadHTMLFile(fName)
{
new Ajax.Request(fName, { method: "get", onComplete: displayData });
MO(7);
}
function displayData(httpObj)
{
$("result").innerHTML = httpObj.responseText;
}

function createXmlHttpRequest() {

  if (window.XMLHttpRequest) {                       // Firefox,Opera,Safari,IE7
    return new XMLHttpRequest();
  } else if (window.ActiveXObject) {                 // IE5,IE6
    try {
      return new ActiveXObject("Msxml2.XMLHTTP");    // MSXML3
    } catch(e) {
      return new ActiveXObject("Microsoft.XMLHTTP"); // MSXML2
    }
  } else {
    return null;
  }
}

function openBox1(){
  var windsA = document.getElementById("window1").style;
  var windsB = document.getElementById("window2").style;
  windsA.display = "block";
  windsB.display = "none";
  document.button01.src = "images/koji_i12.jpg";
  document.button02.src = "images/koji_i2.jpg";
}

function openBox2(){
  var windsA = document.getElementById("window1").style;
  var windsB = document.getElementById("window2").style;
  windsA.display = "none";
  windsB.display = "block";
  document.button01.src = "images/koji_i1.jpg";
  document.button02.src = "images/koji_i22.jpg";

      if (!xmlhttp) xmlhttp = createXmlHttpRequest();
      if (!xmlhttp || xmlhttp.readyState == 1 || xmlhttp.readyState == 2 || xmlhttp.readyState == 3) {
        return; 
      }

  var boxID = "#dekiagaru";
  var query = "page=on";
  var pageaddr = "gyosya.php";
  xmlhttp.open("POST", pageaddr, true);
  xmlhttp.setRequestHeader("Content-Type" , "application/x-www-form-urlencoded;charset=UTF-8");
  xmlhttp.send(query);
  xmlhttp.onreadystatechange = function() {
    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
      $(boxID).html(xmlhttp.responseText);
      $(boxID).fadeIn(1);
    }
  }
}
