function getXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function getData()
{
	if (xmlHttp.readyState==4 && xmlHttp.status == 200)
	{ 
		var strData = xmlHttp.responseText;
		//alert(xmlHttp.responseText);
		if(strData=="false" || strData==""){
			//ログイン入力を表示
			document.getElementById('log1').style.display = 'block';
			document.getElementById('log2').style.display = 'none';
			var url=document.URL;
			if(url.indexOf("staff")>0 || url.indexOf("special")>0){
				self.location="http://foh.jp/";
			}
		}else{
			//登録ユーザー名を表示
			document.getElementById('log1').style.display = 'none';
			document.getElementById('log2').style.display = 'block';
			document.getElementById('login_name').innerHTML = strData;
		}
	}
}

function reset()
{
	if (xmlHttp.readyState==4 && xmlHttp.status == 200)
	{ 
		//history.back();
	}
}

function dataRead () {
   xmlHttp=getXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("no ajax");
	  return;
	  } 
	var url="http://foh.jp/member.php";
	url=url+"?sid="+Math.random();
	
	xmlHttp.onreadystatechange=getData;

	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function logout() {
   xmlHttp=getXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("no ajax");
	  return;
	  } 
	var url="http://foh.jp/reset.php";
	url=url+"?sid="+Math.random();
	
	xmlHttp.onreadystatechange=reset;

	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

