function ajax_post(){
	var pars   ="action=login&username=" + $F('username') + "&password=" + $F('pword');
	var myajax = new Ajax.Request("login.php",{method:'post',parameters: pars,onLoading:show_loading,onComplete:show_result});
    return false;
}

function show_loading(){
     $('loadp').innerHTML = "<img src='images/ajax.gif' style='margin-top:0px;'>";
}

function show_result(response){
        var r_text = response.responseText;
        $('loginboxx').innerHTML  = r_text;
		var   sarray=new   Array();   
		sarray= r_text.split("||||");
        if(sarray[1]!='error'){
			window.location.href = sarray[1];
		}       

}

function ajax_logout(){
    var myajax = new Ajax.Request("login.php",{method:'post',parameters: "action=logout",onLoading:show_loading,onComplete:show_result});
	return false;
}

function view(id){
   document.getElementById(id).value = '';
}

function ajax_out(){
    var myajax = new Ajax.Request("login.php",{method:'post',parameters: "action=logout2",onLoading:show_loading,onComplete:show_result2});
	return false;
}
function show_result2(response){
     window.location.href="index.php";
}
function del(url){
    if(confirm("Sure you want to delete?")){
	   window.location.href = url;
	}
}
function turnto(url){
   window.location.href = url;
}

function CheckAll(va){
	var va;
	var a = document.getElementsByName(va);
    var n = a.length;
	for (var i=0;i<n;i++){
      a[i].checked = true;
	}
}

function CheckOutAll(va){
	var va;
	var a = document.getElementsByName(va);
    var n = a.length;
	for (var i=0;i<n;i++){
      a[i].checked = false;
	}
}

function cksubmit(appid){
	var appid;
    if(confirm("Sure you want to submit?")){
	   window.location.href = "applicantdetails.php?id="+appid+"&submit=1";
	}
}

function getHTML (id, url ,num,type) {
	var url;
	var pars = "type="+type+"&flag="+num;
	var myAjax = new Ajax.Updater(
	id,
	url,
	{
	  method:"POST",
	  parameters: pars,
	  evalScripts: true
	});
	return false;
}

function checkdelall(){
    var a = document.getElementsByName('del[]');
    var n = a.length;
	for (var i=0;i<n;i++){
      if(a[i].checked == true){
         var tr = 1;
	  }
	}
	if(tr == 1){
		if(confirm("Sure you want to delete?")){
			return true;
		}
	}else{
		alert('Please select a record to be deleted.');
		return false;
	}
	return false;
}

function connectR(id,url){
   if(confirm("To learn more about or interview this applicant please connect with the recruiter by clicking on the 'OK' button below.  Once you click on 'OK', our system will release to you the contact information of the recruiter representing this applicant.  You may then contact them directly via phone or email.  By clicking the 'OK' button below, you are not obligated to hire this candidate.  Feel free to contact your enetRecruiter account manager if you have any questions.  Thank you.")){
	   window.location.href = url;
	}else{
	   document.getElementById(id).checked = false;
	}
}

function enetconfirm(info,url){
	if(confirm(info)){
	   window.location.href=url;
	}
}

function reallyCenterWindow(url) {
	leftPos = 0
	topPos  = 0
	if (screen) {
	leftPos = (screen.width / 2) - 251
	topPos = (screen.height / 2) - 251
	}
	ElementWindow = window.open(url,'ElementWin','width=502,height=502,left='+leftPos+',top='+topPos);
} 

function cc(tt){   
	var   aa   =   document.getElementsByName("postid");   
	for   (var   i=0;   i<aa.length;   i++) {aa[i].checked   =   false;}  
}   


function suretocancel(url){
    if(confirm("Sure you want to cancel membership?")){
	   window.location.href = url;
	}
}


function buysubmit(u) {
	var u;
	if(u=='Buy Now'){
	document.getElementById('sam').value = 'Buy Now'; 
	}
	if(u=='Try Now'){
	document.getElementById('sam').value = 'Try Now'; 
	}
	document.getElementById('article').submit();
}