function checkUserNameAvailability(){
	$('div_employeer_uname').hide();
	var uname = $('uname').value ; 
	if(uname==""){
		$('div_employeer_uname').show();
		 $('div_employeer_uname').update("User Name can not be empty.") ;
		 setTimeout("document.getElementById('div_employeer_uname').style.display='none'",1800);
		 return ;
	}
	if(uname.length<4){
		$('div_employeer_uname').show();
			 $('div_employeer_uname').update("User Name must cantain atleast 4 character.") ;
			 setTimeout("document.getElementById('div_employeer_uname').style.display='none'",1800);
			 return ;
	}
	if(uname!=""){
	 	if(!uname.isText()){
		$('div_employeer_uname').show();	 
		$('div_employeer_uname').update('Special character are not allowed in User Name.').setStyle({ color: '#FF0000' });	
				return;
		}
	 }	
	  $('div_employeer_uname').show();	
	  $('div_employeer_uname').update("Checking...") ;
		new Ajax.Request('internal_request.php?action=checkEmployeeruseremail&uname='+uname,
		{
			method:'get',
			 onSuccess: function(transport,json){
			  var response = transport.responseText;
			  $('div_employeer_uname').show();	
	 			 $('div_employeer_uname').update(response) ;
				 setTimeout("document.getElementById('div_employeer_uname').style.display='none'",2500);
			},
			onFailure: function(){ alert('Something went wrong...') }
		  });
	
}
//----------------------------------------------------------
function changeUpdateStatus(status_id,jobId,prof_Id,counter){  
 		new Ajax.Request('internal_request.php?action=changestatus&status_id='+status_id+'&prof_Id='+prof_Id+'&jobId='+jobId+'&counter='+counter,
		{
			method:'get',
			 onSuccess: function(transport,json){
			  var response = transport.responseText;
	 			 $('div_applied_job_status'+counter).update(response) ;
			},
			onFailure: function(){ alert('Something went wrong...') }
		  });
}//function
//----------------Delete Post Job--------------------
function deletePostedJob(job_id,counter){
	  $('div_job').show();	
	  $('div_job_delete_'+counter).update("<img src='images/loading.gif'>");
	  $('div_job').update("Please Wait...") ;
		new Ajax.Request('internal_request.php?action=deletejob&jobId='+job_id,
		{
			method:'get',
			 onSuccess: function(transport,json){
			  var response = transport.responseText;
			  $('div_job').update(response);
			 $('div_job_no_'+counter).hide();
			  setTimeout("document.getElementById('div_job').style.display='none'",1000);
			},
			onFailure: function(){ alert('Something went wrong...') }
		  });
}//deletePostedJob
//---------------Chnage Job Status-----------
function updateJobStatus(job_id,counter,status){
	if(status==1){
		var dostatus = 2;
		var img = 'icon_deactivate.gif';
		var title = 'Inactive job.Click to activate';
	}else if(status==2){
		var dostatus = 1;	
		var img = 'icon_activate.gif';
		var title = 'Active job.Click to deactivate';
	}
	 $('div_job').show();	
	 $('div_job_approval_'+counter).update("<img align=\"left\" src='images/loading.gif'>");
	 $('div_job').update("Please Wait...") ;
	 new Ajax.Request('internal_request.php?action=changejobstatus&jobId='+job_id+'&status='+dostatus,
		{
			method:'get',
			 onSuccess: function(transport,json){
			  var response = transport.responseText;
			  $('div_job').update(response);
$('div_job_approval_'+counter).update("<input align=\"left\" type=\"image\" src='images/"+img+"' onclick='updateJobStatus("+job_id+","+counter+","+dostatus+")' title='"+title+"' alt='"+title+"'> ");
setTimeout("document.getElementById('div_job').style.display='none'",1000);
 			},
			onFailure: function(){ alert('Something went wrong...') }
		  });
}//function updateJobStatus
//-----------------------------------
function ValidateEmployeerSignIn(){
	$('div_username','div_password').invoke('hide');
	var uname = $('uname').value;
	if(uname==""){
		$('div_username').show();	
		$('div_username').update('Please Enter User Name.');	
		 $('uname').focus();
		 return false;
	}
	var pwd = $('pwd').value;
	if(pwd==""){
		$('div_password').show();
		$('div_password').update('Please Enter Password.');	
		 $('pwd').focus();
		 return false;
	}
}//ValidateEmployeerSignIn()
//----------------------------------------------------
function ValidateForgotPwd(){
	var uname = $('uname').value ; 
	if(uname==""){
		$('div_username').show();	
		$('div_username').update('Please Enter User Name.');	
		 $('uname').focus();
		 return false;
	}
}//ValidateForgotPwd
//------------------------------------------------------
String.prototype.isText = function (){
			return /^[\w\s]*$/.test(this)
}
//-------------------------------------------------------
function validateEmployeerSignUp(){
$('div_username','div_password','div_pass_conf','div_company_name','div_address','div_country','div_city','div_description','div_check_email','div_phone_no_1','div_contact_person','div_term_condition').invoke('hide');
 var uname = $('uname').value ; 
	if(uname==""){
		$('div_username').show();	
		$('div_username').update('Please Enter User Name.').setStyle({ color: '#FF0000' });	
		 $('uname').focus();
		 return false;
	}
	if(uname.length<4){
			$('div_username').show();	
			 $('div_username').update("User Name must cantain atleast 4 character.") ;
 			 return false;
	}
	if(uname!=""){
	 	if(!uname.isText()){
		$('div_username').show();	;
		$('div_username').update('Special character are not allowed in User Name.').setStyle({ color: '#FF0000' });	
				return false;
		}
	 }
  	var pwd = $('pwd').value ; 
	if(pwd==""){
		$('div_password').show();	
		$('div_password').update('Please Enter Password.').setStyle({ color: '#FF0000' });	
		 $('pwd').focus();
		 return false;
	}
	if(pwd.length<6){
		$('div_password').show();
		$('div_password').update('Password must be 6 character.').setStyle({ color: '#FF0000' });	
		$('pwd').focus();
		 return false;
	}
 	var con_pwd = $('con_pwd').value ; 
	if(con_pwd==""){
		$('div_pass_conf').show();	
		$('div_pass_conf').update('Please Enter User Confirm Password.').setStyle({ color: '#FF0000' });	
		 $('con_pwd').focus();
		 return false;
	}
	if(con_pwd.length<6){
		$('div_pass_conf').show();
		$('div_pass_conf').update('Password must be 6 character.').setStyle({ color: '#FF0000' });	
		$('con_pwd').focus();
		 return false;
	}
	 if(pwd!=con_pwd){
			$('div_password').show();
			$('div_password').update('Your Pasword does not match.Please Enter valid password.').setStyle({ color: '#FF0000' });	
			 $('pwd').focus();
			 return false;
	 }
  	var company_name = $('company_name').value ; 
	if(company_name==""){
		$('div_company_name').show();	
		$('div_company_name').update('Please Enter Company Name.').setStyle({ color: '#FF0000' });	
		 $('company_name').focus();
		 return false;
	}
	var address = $('address').value ; 
	if(address==""){
		$('div_address').show();	
		$('div_address').update('Please Enter Address.').setStyle({ color: '#FF0000' });	
		$('address').focus();
		 return false;
	}
 	var country = $('country').value ; 
	if(country==""){
		$('div_country').show();	
		$('div_country').update('Please Select Country.').setStyle({ color: '#FF0000' });	
		$('country').focus();
		 return false;
	}
 	var city = $('city').value ; 
	if(city==""){
		$('div_city').show();	
		$('div_city').update('Please Select City.').setStyle({ color: '#FF0000' });	
		$('city').focus();
		 return false;
	}
	tinyMCE.triggerSave(true,true);
	var description = tinyMCE.getContent();
  	if(description==""){
		$('div_description').show();	
		$('div_description').update('Please Enter Description.').setStyle({ color: '#FF0000' });	
		focus();
		return false;
	}
 	var email = $('email').value ; 
	if(email==""){
		$('div_check_email').show();	
		$('div_check_email').update('Please Enter Email Address.').setStyle({ color: '#FF0000' });	
		$('email').focus();
		 return false;
	}
	if(email!=""){
			if(!email.isEmail()){
				$('div_check_email').show();	
			   $('div_check_email').update("Error ! Invalid Email Address.");
			    $('email').focus();
 				return false;; 
			}	
	}
	var phone_1 = $('phone_1').value ; 
	if(phone_1==""){
		$('div_phone_no_1').show();	
		$('div_phone_no_1').update('Please Enter Phone Number.').setStyle({ color: '#FF0000' });	
		$('phone_1').focus();
		 return false;
	}
 	var contact_person = $('contact_person').value ; 
	if(contact_person==""){
		$('div_contact_person').show();	
		$('div_contact_person').update('Please Enter Contact Person Name.').setStyle({ color: '#FF0000' });	
		$('contact_person').focus();
		 return false;
	}
 	var term_condition = $('term_condition').checked;
 	if(term_condition==false){
		$('div_term_condition').show();
		$('div_term_condition').update('Please read the term and condition.');	
		$('term_condition').focus();
		 return false;
	}
}//validateEmployeerSignUp()
//--------------------------------------
String.prototype.isEmail = function() {
    if (!this) {
        return false;
    }
    var iChars = "*|,\":<>[]{}`';()&$#% ";
    for (var i = 0; i<this.length; i++) {
        if (iChars.indexOf(this.charAt(i)) != -1) {
            return false;
        }
    }
    if (this.indexOf("@") == -1) {
        return false;
    }
    if (this.indexOf(".") == -1) {
        return false;
    }
    return true;
};
//-----------------------------------------------
function updateHotJobMessage(type,job_status){
	$('div_job').show();
	 if(job_status=='Expired'){
			$('div_job').update('You can\'t make it Hot Job because it is expired job.');
	}else if(type==0){
			$('div_job').update('You can\'t make it Hot Job because it is still pending by admin approval.');
	}else if(type==3){
			$('div_job').update('You can\'t make it Hot Job because of inapproval status from admin site.');
	}
	setTimeout("document.getElementById('div_job').style.display='none'",5000);
}// function
//--------------------------------
function updateHotJob(job_id,counter){
	 $('div_job').show();	
	 $('div_hotjob_approval_'+counter).update("<img align=\"left\" src='images/loading.gif'>");
	 $('div_job').update("Please Wait...") ;
	 new Ajax.Request('internal_request.php?action=changehotjobstatus&jobId='+job_id,
		{
			method:'get',
			 onSuccess: function(transport,json){
			  var response = transport.responseText;
			  $('div_job').update(response);
$('div_hotjob_approval_'+counter).update("<img align=\"left\" src=\"images/icon_denied.gif\" alt=\"Request admin for hot job\" title=\"Request admin for hot job\" border=\"0\"/> ");
setTimeout("document.getElementById('div_job').style.display='none'",2000);
 			},
			onFailure: function(){ alert('Something went wrong...') }
		  });
}//function updateHotJob
//---------------------------------
function validateCompanyProfile(){
$('div_company_name','div_company_address','div_company_country','div_company_city','div_company_description','div_check_email_address').invoke('hide');
 	var company_name = $('company_name').value ; 
	if(company_name==""){
		$('div_company_name').show();	
		$('div_company_name').update('Please Enter Company Name.').setStyle({ color: '#FF0000' });	
		 $('company_name').focus();
		 return false;
	}
 	var address = $('address').value ; 
	if(address==""){
		$('div_company_name').show();	
		$('div_company_name').update('Please Enter Company Address.').setStyle({ color: '#FF0000' });	
		 $('address').focus();
		 return false;
	}
 	var country = $('country').value ; 
	if(country==""){
		$('div_company_country').show();	
		$('div_company_country').update('Please Select Country.').setStyle({ color: '#FF0000' });	
		 $('country').focus();
		 return false;
	}
 	var city = $('city').value ; 
	if(city==""){
		$('div_company_city').show();	
		$('div_company_city').update('Please Select City.').setStyle({ color: '#FF0000' });	
		 $('city').focus();
		 return false;
	}
	tinyMCE.triggerSave(true,true);
	var description = tinyMCE.getContent();
 	if(description==""){
		$('div_company_description').show();	
		$('div_company_description').update('Please Enter Description.').setStyle({ color: '#FF0000' });	
		 focus();
		 return false;
	}
   	var email = $('email').value ; 
	if(email==""){
		$('div_check_email_address').show();	
		$('div_check_email_address').update('Please Enter E-mail Address.').setStyle({ color: '#FF0000' });	
		 $('email').focus();
		 return false;
	}
	if(email!=""){
			if(!email.isEmail()){ 
				$('div_check_email_address').show();	
			   $('div_check_email_address').update("Error ! Invalid Email Address.").setStyle({ color: '#FF0000' });	
			    $('email').focus();
 				return false;; 
			}	
	}
}//validateCompanyProfile()