// JavaScript Document

var xmlHttp

	function showCustomer(str)
	{ 
		xmlHttp=GetXmlHttpObject();
		
		if (xmlHttp==null)
		  {
			alert ("Your browser does not support AJAX!");
			return;
		  } onblur='return showCustomer(this.value)'
		  
		  
		var url="includes/getEmail.asp";
		url=url+"?eml="+str;
		url=url+"&sid="+Math.random();
		//xmlHttp.onreadystatechange=stateChanged;
		xmlHttp.open("GET",url,false);
		xmlHttp.send(null);
		if(xmlHttp.responseText==1){
			return true;
		}else{
			return false;
		}
		//return xmlHttp.responseText;
	}

	function stateChanged() 
	{ 
		if (xmlHttp.readyState==4)
	{ 
	

	if(xmlHttp.responseText==1){
		
		//alert("SORRY EMAIL IS TAKEN");
		document.getElementById("msgbox").innerHTML = "<span class='error_rpc'>Email is already registered. Please choose another</span>";
		document.getElementById("Email").focus();
		document.getElementById("msgbox").style.display='block';
		document.getElementById("Email").style.color='#FF0000';
		document.getElementById("ConfirmEmail").value='';
		//return true;
	}else{
		//alert("EMAIL AVAILABLE");
		document.getElementById("msgbox").innerHTML = "";
		document.getElementById("msgbox").style.display='none';
		document.getElementById("Email").style.color='#000000';
		//return false;
	}

}
}

	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 updatePage(opBool){
	
	if(opBool){	
		//alert("SORRY EMAIL IS TAKEN");
		document.getElementById("msgbox").innerHTML = "<span class='error_rpc'>Email is already registered. Please choose another</span>";
		document.getElementById("Email").focus();
		document.getElementById("msgbox").style.display='block';
		document.getElementById("Email").style.color='#FF0000';
		document.getElementById("ConfirmEmail").value='';
		//return true;
	}else{
		//alert("EMAIL AVAILABLE");
		document.getElementById("msgbox").innerHTML = "";
		document.getElementById("msgbox").style.display='none';
		document.getElementById("Email").style.color='#000000';
		//return false;
	}
}
