var httpChkLogin = getHTTPObject();

function getHTTPObject()

{

  var xmlhttp;



  if (!xmlhttp )

  {

    if(window.XMLHttpRequest) 

    {

    	try {

			      xmlhttp = new XMLHttpRequest();

          } 

          catch(e) {

			               xmlhttp = false;

                   }

     }

     else if(window.ActiveXObject)

     {

       	try {

        	    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");

      	    }

            catch(E) {

        	             try {

          		               xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

        	                 } catch(e) {

          		                          xmlhttp = false;

        	                            }

				             }

     }
 

  }


  return xmlhttp;

}



//============= Start Jobseeker Login ============

function jobseekerLogin()
{

	var textToWrite="";
	var primary_email = document.getElementById('loginid').value;
	var password  = document.getElementById('password').value;
	var direction  = document.getElementById('dir').value;
	

	if(primary_email!="" && password!="")
	{
		var str = primary_email+'COLSEP'+password;	 
	  	httpCheckUser.open("GET", 'index.php?app=jobseeker_login&cmd=jobseekerlogin&strdata='+str+'&dir='+direction, true);
		httpCheckUser.onreadystatechange = handleUserResponse;  	
  	  	httpCheckUser.send(null);  	
		return true;

	}
	else
	{

		 if(primary_email=="" && password=="")

		 {

			 textToWrite = "Please Enter Your MyJobsbd Login ID and Password !!!";

		 }

		 else if(primary_email=="")

		 {

			 textToWrite = "Please Enter Your MyJobsbd Login ID !!!";

		 }

		 else if(password=="")

		 {

			 	textToWrite = "Please Enter Your MyJobsbd Password !!!";

		 }

		 document.getElementById('status_msg').style.display = "block";

         document.getElementById('status_msg').innerHTML = textToWrite;

		 return false;

	}

}

function handleUserResponse()

{

    var textToWrite = "";

    if(httpCheckUser.readyState == 4)

    {    	    	

      if(trim(httpCheckUser.responseText) == "Success")
      {       	 
		  window.location = "index.php?app=create_resume&cmd=jobseeker_home";		 
      }
	  else if(trim(httpCheckUser.responseText) == "new")
      {        	 
         window.location = "index.php?app=create_resume&cmd=change_passoword"; 
      }
	  else if(trim(httpCheckUser.responseText) == "edit matching")
      {        	 
         window.location = "index.php?app=jobseeker_signup&cmd=edit_matching_profile";		 
      }	  
	  else if(trim(httpCheckUser.responseText) == "create resume")
      {        	 
         window.location = "index.php?app=create_resume&cmd=personal_info";		 
      }	  
	  else if(trim(httpCheckUser.responseText) == "Unsubscription")
      {        	 
         window.location = "index.php?app=create_resume&cmd=ps_account_info_subscription";		 
      }
      else if(trim(httpCheckUser.responseText)=="Not varify")
      {          	  	 
         textToWrite = "Your email is not validate. Please varify your email !!!";	    
      }
      else if(trim(httpCheckUser.responseText)=="Invalid")
      {       	  	 
        textToWrite = "Invalid User ID and Password. Please try again !!!";
        document.getElementById('loginid').value="";
	    document.getElementById('password').value="";
      }
	  
	  if(textToWrite!="")
	  {
		  document.getElementById('status_msg').style.display = "block";
		  document.getElementById('status_msg').innerHTML = textToWrite;
	  }

    }

    else 

    {

    	document.getElementById('status_msg').innerHTML = "Checking Existence. Please Wait...";

    }

    

}

//=====End Jobseeker Login ======





 

function saveEnquiry()

{	

	

	var desig 				= document.getElementById('desig').value;

	var org_phone 		= document.getElementById('org_phone').value;

 	

   var dataStr = masterStr+'_BLK_'+courseStr+'_DBLKSEP_'+shiftStr;

   

 	 httpSaveEnquiry.open("GET", 'index.php?app=enquiry&cmd=saveEnquiry&dataStr='+dataStr, true);

   httpSaveEnquiry.onreadystatechange = handleEnquiryResponse;

   httpSaveEnquiry.send(null);

  

}//=========End of saveEnquiry()==========================





function handleEnquiryResponse()

{

		httpSaveEnquiry.readyState;

		

    if(httpSaveEnquiry.readyState == 4)

    {

    	alert(httpSaveEnquiry.responseText);

    }

    

}

function chkValidation()

{

	var login  = document.getElementById('loginid').value;

	alert(login);

	var pass   = document.getElementById('password').value;

	alert(pass);

	var strData = login+'_SAP_'+pass;

	httpChkLogin.open("GET", 'index.php?app=login&cmd=chkValidation&strData='+strData, true);

  httpChkLogin.onreadystatechange = handleChkLoginResponse;

  httpChkLogin.send(null);

}

function handleChkLoginResponse()

{
	  httpChkLogin.readyState;		

    if(httpChkLogin.readyState == 4)

    {

    	alert(httpChkLogin.responseText);

    }	

}


function Trim(TRIM_VALUE){

if(TRIM_VALUE.length < 1){

return"";

}

TRIM_VALUE = RTrim(TRIM_VALUE);

TRIM_VALUE = LTrim(TRIM_VALUE);

if(TRIM_VALUE==""){



return "";

}



else{

return TRIM_VALUE;

}

} //End Function



function RTrim(VALUE){

var w_space = String.fromCharCode(32);

var v_length = VALUE.length;

var strTemp = "";

if(v_length < 0){

return"";

}

var iTemp = v_length -1;



while(iTemp > -1){

if(VALUE.charAt(iTemp) == w_space){

}

else{

strTemp = VALUE.substring(0,iTemp +1);

break;

}

iTemp = iTemp-1;



} //End While

return strTemp;



} //End Function



function LTrim(VALUE){

var w_space = String.fromCharCode(32);

if(v_length < 1){

return"";

}

var v_length = VALUE.length;

var strTemp = "";



var iTemp = 0;



while(iTemp < v_length){

if(VALUE.charAt(iTemp) == w_space){

}

else{

strTemp = VALUE.substring(iTemp,v_length);

break;

}

iTemp = iTemp + 1;

} //End While

return strTemp;

} //End Function



