// JavaScript Document

function getHTTPObject() { 
  var xmlhttp; 

  if(window.XMLHttpRequest){ 
    xmlhttp = new XMLHttpRequest(); 
  } 
  else if (window.ActiveXObject){ 
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
    if (!xmlhttp){ 
        xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
    } 
  } 
 return xmlhttp; 
} 
var http = getHTTPObject();

function handleHttpResponse() {    
	if (http.readyState == 4) { 
	  if(http.status==200) { 
		  var results=http.responseText; 
		  document.getElementById('trForget').innerHTML = results; 
	  } 
   } 
} 

function showEmailExists() {    
	if (http.readyState == 4) { 
	  if(http.status==200) { 
		  var results=http.responseText; 
		  document.getElementById('EmailExists').innerHTML = results; 
		 // if (results == "") {
		//	  	document.frm.txtEmail.focus();
		 // }
	  } 
   } 
} 

function getMemberEmail() {      
	var sId = document.getElementById("txtForgetEmail").value; 
	if (sId.indexOf("@")<1) {
		alert("Invalid Email Address");
	}
	else if (sId.indexOf(".")<1) {
		alert("Invalid Email Address");
	}
	else {
		document.getElementById('trForget').innerHTML = "Please wait..."; 
		var url = "get_mem_email.php?email="; 
		http.open("GET", url + escape(sId), true); 
		http.onreadystatechange = handleHttpResponse; 
		http.send(null); 
	}	
} 

function checkEmail(strVal) {      
	var sId = strVal; 
	if (sId.indexOf("@")<1) {
		alert("Invalid Email Address");
	}
	else if (sId.indexOf(".")<1) {
		alert("Invalid Email Address");
	}
	else {
		document.getElementById('EmailExists').innerHTML = "Please wait..."; 
		var url = "check_mem_email.php?email="; 
		http.open("GET", url + escape(sId), true); 
		http.onreadystatechange = showEmailExists; 
		http.send(null); 
	}	
}
