var xmlHttp


function loginValidate(regfrm){
	
//	alert("OK");
//	return;
	
	xmlHttp=GetXmlHttpObject();
	document.getElementById("ajax-loading").style.visibility="visible";
	refForm=regfrm;
	if (xmlHttp==null){
	
	  alert("Browser does not support HTTP Request")
	  return;
	}
	 
	refForm.errmsg.value="";
	var url="index.php";
	url=url+"?action=loginvalidate";
	url=url+"&login_id="+refForm.login_id.value;
	url=url+"&passw="+refForm.passw.value;
	url=url+"&validationid="+Math.random();
	
	xmlHttp.onreadystatechange=stateValidate;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}



function stateValidate(){ 

	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
	
		refForm.errmsg.value=xmlHttp.responseText;
		document.getElementById("ajax-loading").style.visibility="hidden";
		
		if(refForm.errmsg.value=="")
			refForm.submit();
		else
			alert(refForm.errmsg.value);
			
		
	}
}





function changepassValidate(regfrm){
	
	
	xmlHttp=GetXmlHttpObject();
	document.getElementById("ajax-loading").style.visibility="visible";
	refForm=regfrm;
	if (xmlHttp==null){
	
	  alert("Browser does not support HTTP Request")
	  return;
	}



	refForm.errmsg.value="";
	var url="index.php";
	url=url+"?action=changepwdvalidate";
	url=url+"&old_password="+refForm.old_password.value;
	url=url+"&passwrd="+refForm.passwrd.value;
	url=url+"&confirm_password="+refForm.confirm_password.value;
	url=url+"&validationid="+Math.random();

	xmlHttp.onreadystatechange=statePassValidate;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}



function statePassValidate(){ 

	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
	
		refForm.errmsg.value=xmlHttp.responseText;
		document.getElementById("ajax-loading").style.visibility="hidden";
		
		if(refForm.errmsg.value=="")
			refForm.submit();
		else
			alert(refForm.errmsg.value);
			
		
	}
}





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 stateValidate(){ 

	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
	
		refForm.errmsg.value=xmlHttp.responseText;
		document.getElementById("ajax-loading").style.visibility="hidden";

		if(refForm.errmsg.value=="")
			refForm.submit();
		else
			alert(refForm.errmsg.value);
			
	}
}
*/








