function GetXmlHttpObject() {
	var xmlHttp=null;
	try { xmlHttp=new XMLHttpRequest(); }
	catch (e) {
	try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); }
	catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } }
	return xmlHttp; }

function showemail(str) {
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) { return; } 
	document.getElementById('txtfemail').value=str;
	var msg=window.location;
	var d = msg.toString();
	var value=d.substring(0,100);
	var pathArray = value.split("/");
	
if((pathArray[2]=='www.quick2get.com')||(pathArray[2]=='quick2get.com'))
	{
		var urlValue=pathArray[0]+"//"+pathArray[2]+"/";
	}
	else
	{
		var urlValue=pathArray[0]+"//"+pathArray[2]+"/"+pathArray[3]+"/";
	}	
	var url=urlValue+"forgetPassword.php";
	url=url+"?emailverificationid="+str+"&action=checkavail";
	url=url+"&eid="+Math.random();

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

function emailChanged()  { 
	if (xmlHttp.readyState==4) {
	var msg=xmlHttp.responseText; 
	if(msg=="*Available") {
	//	alert(document.getElementById('txtfemail').value);
	//	exit();
		sentmail(document.getElementById('txtfemail').value);
		
		document.getElementById('content').innerHTML="<div class='post_full' ><div class='post_head' style='color:black; cursor:pointer;'>Forgot password </div><div class='post_border'><div class='post_login'><span style=' height:45px; color:red; margin-top:25px; padding:10px;'> <b> Mail has been successfuly sent to your E-Mail Id</b>  </span></div></div></div> ";
		
	 }
	else {
		document.getElementById('emailErr').innerHTML=xmlHttp.responseText;
		document.getElementById('emailidtextfield').value=xmlHttp.responseText; } } }


function sentmail(str) {
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return;   } 
	var msg=window.location;
	var d = msg.toString();
	var value=d.substring(0,100);
	var pathArray = value.split("/");

if((pathArray[2]=='www.quick2get.com')||(pathArray[2]=='quick2get.com'))
	{
		var urlValue=pathArray[0]+"//"+pathArray[2]+"/";
	}
	else
	{
		var urlValue=pathArray[0]+"//"+pathArray[2]+"/"+pathArray[3]+"/";
	}	

	var url=urlValue+"forgetPassword.php";
	//alert(str);
	url=url+"?mail="+str+"&action=update";
	url=url+"&eid="+Math.random();
	//alert(url);
	xmlHttp.onreadystatechange=emailChanged1;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);  }

function emailChanged1() {
	if (xmlHttp.readyState==4) { var msg=xmlHttp.responseText; } }

function val_email(txt,spanid) {

	var email = document.getElementById(txt).value;

	
    if(!valemail(email)) { document.getElementById(spanid).innerHTML="Invalid Email..";  return false;    }
		
	/*if(email!="") { var str=document.getElementById(spanid).innerHTML; return true; }*/
	  
	if(valemail(email))  { document.getElementById(spanid).innerHTML=""; }
	
  	return true; }

function valemail(email) {
    var RegExp = /^([a-zA-Z0-9_\-\.])+@(([0-2]?[0-5]?[0-5]\.[0-2]?[0-5]?[0-5]\.[0-2]?[0-5]?[0-5]\.[0-2]?[0-5]?[0-5])|((([a-zA-Z0-9\-])+\.)+([a-zA-Z\-])+))$/
    if(RegExp.test(email)) { showemail(email); return true; }
	else { return false; } }

function validation() {
	if(document.getElementById('txtfemail').value=='') 	{
	  document.getElementById('emailErr').innerHTML="Please enter the emailId";
	  document.getElementById('txtfemail').focus();
	  return false; 	}
		
	strvalue=document.getElementById('emailErr').innerHTML;
	if(strvalue!='*Available') 	{
		document.getElementById('txtfemail').focus();
		return false;  }
	return true; }