var xmlHttp;
var empty_string="<div class='error_message'>Can Not be Empty</div>";
var mismatch="<div class='error_message'> Passwords dont match</div>";


/////////////////////////////////////////Display State//////////////////////////////////////////////
function display_state(str)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  } 
var url="put_state.php";
url=url+"?cid="+str;
xmlHttp.onreadystatechange=stateChanged_state;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 


function stateChanged_state() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("state_id").innerHTML=xmlHttp.responseText;
//alert(xmlHttp.responseText);
 } 
}

/////////////////////////////////////////Display City//////////////////////////////////////////////
function display_city(str)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  } 
var url="put_city.php";
url=url+"?rid="+str;
xmlHttp.onreadystatechange=stateChanged_city;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 


function stateChanged_city() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("city_id").innerHTML=xmlHttp.responseText;
 } 
}

/////////////////////////////////////////Display Specialization//////////////////////////////////////////////
function display_spl(str)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  } 
var url="put_spcl.php";
url=url+"?cid="+str;
xmlHttp.onreadystatechange=stateChanged_display_spl;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 


function stateChanged_display_spl() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("spcl_id").innerHTML=xmlHttp.responseText;
 } 
}

//////////////////////Update User Resume////////////////////////////////////////////////

function checkEmpNwPw(str)
{
if (str.length==0)
  { 
  document.getElementById("cknwpw").innerHTML=empty_string;
  return;
  }
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//////////////////////Find Matching jobs///////////////////////////////////////////////

function confirmEmpPW(str)
{
if (str.length==0)
  { 
  document.getElementById("cnfmpw").innerHTML=empty_string;
  return;
  }else {
	var pass1=  document.getElementById("newpass").value;
	var pass2=  document.getElementById("conpass").value;
		if(pass1!=pass2){
			document.getElementById("cnfmpw").innerHTML=mismatch;
 			 //alert("both password doesn't match");
			document.getElementById("newpass").value="";
			document.getElementById("conpass").value="";
			}
	  }
} 

//////////////////////get Job code///////////////////////////////////////////////
function getJobCode(str)
{
if (str.length==0)
  { 
  document.getElementById("job").innerHTML=empty_string;
  return;
  }
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  } 
var url="validate/jobcode.php";
url=url+"?j="+str;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("job").innerHTML=xmlHttp.responseText;
 }
 else{
	 document.getElementById("job").innerHTML="<img src='ajax_img/loading.gif' />";}
}

//////////////////////////////////////////////////////////////////////////////////////////////
function validateEmail(str)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  } 
var url="validate/validateEmailForgotPassword.php";
url=url+"?q="+str;
xmlHttp.onreadystatechange=stateChanged_validateEmail;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function stateChanged_validateEmail() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("emailmsg").innerHTML=xmlHttp.responseText;
 }
 else{
	 document.getElementById("emailmsg").innerHTML="<img src='ajax_img/loading.gif' />";}
}

//////////////////////////////////////////////////////////////////////////////////////////////
function validateEmailRecruiter(str)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  } 
var url="validate/validateEmailRecruiter.php";
url=url+"?q="+str;
xmlHttp.onreadystatechange=stateChanged_validateEmailRecruiter;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function stateChanged_validateEmailRecruiter() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("emailmsg").innerHTML=xmlHttp.responseText;
 }
 else{
	 document.getElementById("emailmsg").innerHTML="<img src='ajax_img/loading.gif' />";}
}

//////////////////////////////////Profile Post Job/////////////////////////////////////////////


function getProfile(str)
{
if (str.length==0)
  { 
  document.getElementById("pro").innerHTML=empty_string;
  return;
  }

} 

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

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;
}