function toggle_div(id) {
    var diq = document.getElementById(id).style;
    diq.display=(diq.display=="none") ? "" : "none";

} 


var xmlHttp

function check_email()
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var email = document.getElementById('email').value;

var url="/includes/check_email.php?email="+email;
if (email.indexOf("@")==-1)
{
	document.getElementById('eresult').innerHTML="Email invalid";
	document.getElementById("email").style.backgroundColor="#ff0000";
	return false;
}
if (email.indexOf("@")!==-1)
{
//url=url+"&number="+EmailNumber;
xmlHttp.onreadystatechange=function(){CheckEmailstateChanged();};
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
}
function CheckEmailstateChanged() { 
        //document.getElementById("result" + TheNumber).innerHTML="checking, please wait";
		
        if (xmlHttp.readyState==4){
                 //alert(xmlHttp.responseText);
				 if(xmlHttp.responseText == "Sorry, that email is in use") {
				 document.getElementById("eresult").innerHTML=xmlHttp.responseText;
				 document.getElementById("email").style.backgroundColor="#ff0000";
				 document.getElementById("email").style.color="#ffffff";
				 }
				 
				 if(xmlHttp.responseText == "Email Ok") {
				 document.getElementById("eresult").innerHTML=xmlHttp.responseText;
				 document.getElementById("email").style.backgroundColor="#006600";
				 document.getElementById("email").style.color="#ffffff";
				 }
        }
}

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;
}
// JavaScript Document
