var xmlHttp;
var xmlHttp1;
var path="http://localhost/andrew/";


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 get_page_content(page_name)
{
  xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null)
    {
    alert ("Your browser does not support AJAX!");
    return;
    } 
  var url="ajax_get_content.php";
  //var str=document.getElementById("listing_country_id").value;
  //alert(str);
  url=url+"?page_name="+page_name;
  url=url+"&sid="+Math.random();
  //alert("here");
  xmlHttp.onreadystatechange=contentResponse;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}


function contentResponse()
{ 
if (xmlHttp.readyState==4)
{ 
//alert(xmlHttp.responseText);
  var mymsg;
var myres=xmlHttp.responseText;


document.getElementById("div_this_page_content").innerHTML=myres;
}
}

function check_email_address(email)
{
  xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null)
    {
    alert ("Your browser does not support AJAX!");
    return;
    } 
  var url="ajax_check_email.php";
  //var str=document.getElementById("listing_country_id").value;
  //alert(str);
  url=url+"?email="+email;
  url=url+"&sid="+Math.random();
  //alert("here");
  xmlHttp.onreadystatechange=emailResponse;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}

function emailResponse()
{ 
if (xmlHttp.readyState==4)
{ 
//alert(xmlHttp.responseText);
  var mymsg;
var myres=xmlHttp.responseText;
   if (myres=='1')
   mymsg='Invalid Email Address.';
   if (myres=='2')
   mymsg='Email Address already exist.';
   if (myres=='3')
   mymsg='OK!';

   if (myres!='3')
   document.getElementById("email").value='';

document.getElementById("div_email").innerHTML='<span class=\'err_msg\'>'+mymsg+'</span>';
}
}