//Creating XMLRequest
ajax = false;
// IE以外
if(window.XMLHttpRequest) {
　　　ajax = new XMLHttpRequest();
// IE用
} else if(window.ActiveXObject) {
　　　try {
　　　　　　ajax = new ActiveXObject("Msxml2.XMLHTTP");
　　　} catch(e) {
　　　　　　ajax = new ActiveXObject("Microsoft.XMLHTTP");
　　　}
}

// GET Response
function getData(serverURL, objID) {
　　　ajax.open("GET", serverURL);
　　　ajax.onreadystatechange = function() {
　　　　　　if (ajax.readyState == 4 && ajax.status == 200) {
　　　　　　　　　var obj = document.getElementById(objID);
　　　　　　　　　obj.innerHTML = ajax.responseText;
　　　　　　}
　　　}
　　　ajax.send(null);
}
// POST Response
function getData_p(serverURL, objID1) {
　　　ajax.open("POST", serverURL);
　　　ajax.onreadystatechange = function() {
　　　　　　if (ajax.readyState == 4 && ajax.status == 200) {
　　　　　　　　　var obj = document.getElementById(objID1);
　　　　　　　　　obj.innerHTML = ajax.responseText;
			//ADD
				//treeMenu2(objID1, objID2);
　　　　　　}
　　　}
　　　ajax.send(null);
}
// POST Response
function getData_p2(serverURL, objID1, objID2) {
　　　ajax.open("POST", serverURL);
　　　ajax.onreadystatechange = function() {
　　　　　　if (ajax.readyState == 4 && ajax.status == 200) {
　　　　　　　　　var obj = document.getElementById(objID1);
　　　　　　　　　obj.innerHTML = ajax.responseText;
			//ADD
				treeMenu2(objID1, objID2);
　　　　　　}
　　　}
　　　ajax.send(null);
}

// POST&TreeMenu Response
function getData2(serverURL, objID1, objID2, objID3) {
　　　//ajax.open("GET", serverURL);	//書込み内容が更新されずキャッシュが参照される
      ajax.open("POST", serverURL);	//書込み内容を更新するためPOSTを使用
　　　ajax.onreadystatechange = function() {
　　　　　　if (ajax.readyState == 4 && ajax.status == 200) {
　　　　　　　　　var obj = document.getElementById(objID1);
　　　　　　　　　obj.innerHTML = ajax.responseText;
		  //ADD
	          treeMenu3(objID1, objID2, objID3);
　　　　　　}
　　　}
　　　ajax.send(null);
}

// TreeMenu
function treeMenu(tName) {
  tMenu = document.all[tName].style;
  if(tMenu.display == 'none') tMenu.display = "block";
  else tMenu.display = "none";
}

function treeMenu2(tName1, tName2) {
  //初期化
  tMenu1 = document.all[tName1].style;
  tMenu1.display = "none";
  tMenu2 = document.all[tName2].style;
  tMenu2.display = "none";

  if(tMenu1.display == 'none') tMenu1.display = "block";
  else tMenu1.display = "none";
}

function treeMenu3(tName1, tName2, tName3) {
  //初期化
  tMenu1 = document.all[tName1].style;
  tMenu1.display = "none";
  tMenu2 = document.all[tName2].style;
  tMenu2.display = "none";
  tMenu3 = document.all[tName3].style;
  tMenu3.display = "none";

  if(tMenu1.display == 'none') tMenu1.display = "block";
  else tMenu1.display = "none";
}

var HELPWin=null;//サブウインドウ
var HELPHref1="";//読み込むページ
function HelpWinOpen(HELPHref1,WinNo,W,H){
HELPWin=window.open(HELPHref1,WinNo,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width='+W+',height='+H+'');

//N2.0バグ回避用リピート
if(navigator.appVersion.charAt(0)==2){
HELPWin=window.open(HELPHref1,WinNo,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width='+W+',height='+H+'');}

//サブウインドウが開いたとき前面へフォーカスする。NN3.0~
if(navigator.appVersion.charAt(0)>=3){HELPWin.focus()}
};

//ボタンから指定URLへ画面遷移する
function modSchool(linkLoc) {
 if(linkLoc !="") { window.location.href=linkLoc;}
 }

function setMouseover(oElm)	{
	if(oElm.className == "TRS"){
		oElm.className = "TRS2"
	}
	else if(oElm.className == "TRS2"){
	}
	else{
		oElm.className = "TRO"
	}
}
function setMouseout(oElm)	{
	if(oElm.className == "TRS"){
	}
	else if(oElm.className == "TRS2"){
		oElm.className = "TRS"
	}
	else{
		oElm.className = "TRI"
	}
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
// エレメントの名前を指定して値を取得
function GetElementValue(ElementName){
	var oElement;

	oElement = document.getElementsByName(ElementName);
	if(oElement != undefined){
		return oElement[0].value;
	}
	else{
		return "";
	}
}

// エレメントの名前を指定して値を設定
function SetElementValue(ElementName, InValue){
	var oElement;

	oElement = document.getElementsByName(ElementName);
	if(oElement != undefined){
		oElement[0].value = InValue;
	}
}
function openInfoFromUser(Tid) {
	theURL ='./ur/ur.php?id='+Tid;
	winOp = window.open(theURL,Tid,'width=403,height=450');
	winOp.focus();
}
// 環境チェック
var uAgent,uOs,uBr,uEv;
uAgent=navigator.userAgent.toUpperCase();
if(uAgent.indexOf("MAC",0)>=0) {
	uOs="M";
} else {
	uOs="W";
}
uBr="N";
if(uAgent.indexOf("MSIE",0)>=0) {
	uBr="E";
}
if(uAgent.indexOf("OPERA",0)>=0) {
	uBr="O";
}
uEv="S";
if((uOs=="M")&&(uBr=="E")) {
	uEv="D";
}
if((uOs=="M")&&(uBr=="O")) {
	uEv="W";
}
//画面のフォーカス設定
function sf(){document.f.textfield8.focus();}
//親画面のリロード
function parentReload(){
  window.opener.location.href = "http://www.shogis.com" 
}

function m_win(url,windowname,width,height) {
 var features="location=no, menubar=no, status=yes, scrollbars=yes, resizable=yes, toolbar=no";
 if (width) {
  if (window.screen.width > width)
   features+=", left="+(window.screen.width-width)/2;
  else width=window.screen.width;
  features+=", width="+width;
 }
 if (height) {
  if (window.screen.height > height)
   features+=", top="+(window.screen.height-height)/2;
  else height=window.screen.height;
  features+=", height="+height;
 }
 window.open(url,windowname,features);
}

