// JavaScript Document

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 CheckEmailId()
{
	
		document.getElementById('loginErr1').innerHTML="&nbsp;";
	xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null)
    {
        alert ("Browser does not support HTTP Request")
        return
    }
    var url="Ajax/AjaxForgetPassword.php";
    url=url+"?MailId="+document.getElementById('txtEmail').value;
	url=url+"&Operation=CHECKAVAIL";
	//alert(url);
    xmlHttp.onreadystatechange=CheckEmailIdChanged
    xmlHttp.open("GET",url,true)
    xmlHttp.send(null)
}



function CheckEmailIdChanged()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
		val=xmlHttp.responseText;
		//alert(val);
		if(val)
		{
			document.getElementById('Questable').style.display="block";
			document.getElementById('errEmail').style.display="none";
			arr=val.split(")");
			
			document.getElementById('questDiv').innerHTML=arr[4];
			document.getElementById('hdnAns').value=arr[5];
			document.getElementById('hdnPassDisp').value=arr[1]+")"+arr[2];
			
			
		}
		else
		{
			document.getElementById('Questable').style.display="none";
			document.getElementById('errEmail').style.display="block";
		}
		
		//
	}
}
