// JavaScript Document

function showLogin(){
	var logbox=document.getElementById('lobox');	
	logbox.style.display="";
}
function hid(){
		document.systemlogin.reset();
		var logbox=document.getElementById('lobox');	
		logbox.style.display="none";
}
function logincheck(){
	logname =document.systemlogin.loginname.value;
	logpwd =document.systemlogin.loginpwd.value;
	if(logname=="")
	{
		alert("IDを入力してください。");
		return false;
	}else if(logpwd==""){
		alert("PASSWORDを入力してください。");
		return false;
	}
	arg  ="?name="+logname+"&pwd="+logpwd;
	url="program/check.php"+arg;
	if (window.ActiveXObject)
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP")
	else if(window.XMLHttpRequest)
		xmlHttp=new XMLHttpRequest();		
	xmlHttp.onreadystatechange=processRequest;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	function processRequest()
	{
		if(xmlHttp.readyState==4)
		{
			if(xmlHttp.status==200)
			{	
				if(xmlHttp.responseText=="ok"){
				
					window.open("program/main.php",'','');
					hid();
				}else{
					alert('入力内容に誤りがあります。');
				}
			}
			else
				alert('Ajax Error');			
		}
	}
}
