// JavaScript Document

function ValidateUser(user,pwd)
{

		
		if(user=='0' && pwd=='0')
		{
		var user=document.getElementById("username").value;
	
		/*if(!Number(user))
		{
				jAlert("Invalid UserID should be a number");
				
				return false;
		}*/
		var pwd=document.getElementById("passwd").value;
		
		if(user=='Email' || pwd=='password')
		{
				jAlert("Please Enter Email  and Password");
								return false;
		}
		
		if(user=="" ||  pwd=="")
		{
				jAlert("Please Enter User Name and Password");
				return false;
		}
		}
	

				document.getElementById("loginMessage").innerHTML="Please wait while we fetch your records...";
				xmlHttp=GetXmlHttpObject()
				var url='includes/ajax.php'
				url=url+"?page=index.php&action=Login"+"&uid="+user+"&pwd="+pwd
               
		  		xmlHttp.onreadystatechange=pageno
				xmlHttp.open("GET",url,true)
				xmlHttp.send(null)
		
}

function pageno() 
		{ 
		   	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			   	{ 
                    
						document.getElementById("loginMessage").innerHTML=xmlHttp.responseText
						if(xmlHttp.responseText=="success")
						{
								window.open("MyDetails.php?menu=My Details&tag=1&index=2","_self")
						}
							
							

				} 
			} 
	


	function GetXmlHttpObject()
	
		{
			var objXMLHttp=null; 
			if (window.XMLHttpRequest)
			{
				objXMLHttp=new XMLHttpRequest();
			}
		else if (window.ActiveXObject){	objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
		return objXMLHttp;
		} 


