var isIE = 0;
if(document.all){
  isIE = 1;
}
function openNewWindow(URLtoOpen, windowName, windowFeatures) {
  var newWindow = window.open(URLtoOpen, windowName, windowFeatures);
}
/* FORM Validation */
var bad_words = new Array();
//trim
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

Array.prototype.contains = function (element) {
    for (var i = 0; i < this.length; i++) {
        if (this[i].toLowerCase() == element.toLowerCase()) {
            return true;
        }
    }
    return false;
};
var isEmail = /[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]{2,6}$/;
var isNumber = /[0-9]/;
var isCAPostalCode = /^\D{1}\d{1}\D{1}\-?\d{1}\D{1}\d{1}$/;
var isUSPostalCode = /(^\d{5}$)|(^\d{5}-\d{4}$)/;
var isDate = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/; //mm/dd/yyyy
var isTime = /^([1-9]|1[0-2]):[0-5]\d(:[0-5]\d(\.\d{1,3})?)?$/; //HH:MM, HH:MM:SS, HH:MM:SS.mm
var isIP = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
var isMoney = /^((\$\d*)|(\$\d*\.\d{2})|(\d*)|(\d*\.\d{2}))$/;
var isSSN = /^\d{3}\-?\d{2}\-?\d{4}$/;
var isCASIN = /^\d{9}$/;//canadian ssn
function validate(myform) {
  var errorList = '';  
  for(var w=0; w < myform.length; w++){
    if(myform[w].id.substring(0,4) == 'req_') {
      if(myform[w].name == 'email_address') {
        if(!isEmail.test(Trim(myform[w].value))) {
          errorList += myform[w].name + ' must be a valid email.'+"\n";
        }else if(Trim(myform[w].value) != Trim(myform.confirm_email_address.value)){
          errorList += 'Confirm Email does not match Email Address.'+"\n";
        }
      }else if(myform[w].name == 'password'){
        if(Trim(myform[w].value).length < 3){
          errorList += myform[w].name + ' must be at least 3 characters long.'+"\n";
        }else if(Trim(myform[w].value) != Trim(myform.confirm_password.value)){
          errorList += 'Confirm Password does not match Password.'+"\n";
        }
      }else if(myform[w].name == 'zip'){
        if(!isUSPostalCode.test(Trim(myform[w].value)) && !isCAPostalCode.test(Trim(myform[w].value))){
          errorList += myform[w].name+' must be a valid postal code.'+"\n";
        }
      }else if(myform[w].name == 'billing_zip'){
        if(!isUSPostalCode.test(Trim(myform[w].value)) && !isCAPostalCode.test(Trim(myform[w].value))){
          errorList += myform[w].name+' must be a valid postal code.'+"\n";
        }
      }else{
        if(Trim(myform[w].value) == '' || (myform[w].type == 'checkbox' && !myform[w].checked)) {
          errorList += myform[w].name + ' is a required field.'+"\n";
        }else{
        }
      }
    }else{
    }
  }
  if(errorList.length>0){
    alert(errorList);
    return(false);
  }else{
    return(true);
  }
}
/* Correct PNGs in IE */
function correctPNG(){
  for(var i=0; i<document.images.length; i++){
    var img = document.images[i];
    var imgName = img.src.toUpperCase();
    if(imgName.substring(imgName.length-3, imgName.length) == 'PNG'){
      var imgID = (img.id) ? "id='" + img.id + "' " : "";
      var imgClass = (img.className) ? "class='" + img.className + "' " : "";
      var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
      var imgStyle = "display:inline-block;" + img.style.cssText;
      if (img.align == "left") imgStyle = "float:left;" + imgStyle;
      if (img.align == "right") imgStyle = "float:right;" + imgStyle;
      if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
      var strNewHTML = "<span " + imgID + imgClass + imgTitle
      + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
      + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
      + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
      img.outerHTML = strNewHTML
      i = i-1;
    }
  }
}
//use if trying to use transparent pngs in IE
//window.attachEvent("onload", correctPNG);


function loadJobFields(){
  var xmlhttp=false;
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {

    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
  if (!xmlhttp && window.createRequest) {
    try {
      xmlhttp = window.createRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }

 xmlhttp.open("GET", '/includes/Functions/job_fields_ajax.php?field_id='+document.getElementById('required[select][employer_type]')
                                                      .value, true);
 xmlhttp.onreadystatechange=handleResponse;
 xmlhttp.send(null);
//  var response = xmlhttp.responseText;
function handleResponse(){
  var response = xmlhttp.responseText;
  if(xmlhttp.readyState == 4){
    document.getElementById('field_types').innerHTML = response;
  }
  //else{document.getElementById('field_types').innerHTML = 'FAILED';
  //}
}
}

function loadOtherSchool(){
  var xmlhttp=false;
  try {
           xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                xmlhttp = false;
            }
        }
  
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {

    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
  if (!xmlhttp && window.createRequest) {
    try {
      xmlhttp = window.createRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
 xmlhttp.open("GET", '/includes/Functions/other_school_ajax.php?school_id='+document.getElementById('required[select][law_school]')
                                                      .value, true);
 xmlhttp.onreadystatechange=handleResponse;
 xmlhttp.send(null);
//  var response = xmlhttp.responseText;
function handleResponse(){
  var response = xmlhttp.responseText;
  if(xmlhttp.readyState == 4){
    document.getElementById('school_list').innerHTML = response;
  }
  //else{document.getElementById('school_list').innerHTML = 'FAILED';
  //}
}
}




function showApplicants(jobID){
  var xmlhttp=false;
  try {
           xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                xmlhttp = false;
            }
        }
  
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {

    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
  if (!xmlhttp && window.createRequest) {
    try {
      xmlhttp = window.createRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
 xmlhttp.open("GET", '/employers/manage_jobs/includes/build_applicants_table.php?id='+jobID, true);
 xmlhttp.onreadystatechange=handleResponse;
 xmlhttp.send(null);
//  var response = xmlhttp.responseText;
function handleResponse(){
  var response = xmlhttp.responseText;
  if(xmlhttp.readyState == 4){
    document.getElementById('applicants_list_'+jobID).innerHTML = response;
    document.getElementById('position_'+jobID).innerHTML = '<a href="javascript:hideApplicants('+jobID+')"><img src="/images/arrow_down.gif" alt="Hide Details">Hide Details</a>';
  }
  //else{document.getElementById('school_list').innerHTML = 'FAILED';
  //}
}
}





function hideApplicants(jobID){
  var xmlhttp=false;
  try {
           xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                xmlhttp = false;
            }
        }
  
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {

    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
  if (!xmlhttp && window.createRequest) {
    try {
      xmlhttp = window.createRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
 xmlhttp.open("GET", '/employers/manage_jobs/includes/hide_applicants_table.php?id='+jobID, true);
 xmlhttp.onreadystatechange=handleResponse;
 xmlhttp.send(null);
//  var response = xmlhttp.responseText;
function handleResponse(){
  var response = xmlhttp.responseText;
  if(xmlhttp.readyState == 4){
    document.getElementById('position_'+jobID).innerHTML = response;
    document.getElementById('applicants_list_'+jobID).innerHTML = '';    
  }
  //else{document.getElementById('school_list').innerHTML = 'FAILED';
  //}
}
}




function showNewApplicants(jobID){
  var xmlhttp=false;
  try {
           xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                xmlhttp = false;
            }
        }
  
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {

    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
  if (!xmlhttp && window.createRequest) {
    try {
      xmlhttp = window.createRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
 xmlhttp.open("GET", '/admin/includes/build_new_applicants_table.php?id='+jobID, true);
 xmlhttp.onreadystatechange=handleResponse;
 xmlhttp.send(null);
//  var response = xmlhttp.responseText;
function handleResponse(){
  var response = xmlhttp.responseText;
  if(xmlhttp.readyState == 4){
    document.getElementById('applicants_list_'+jobID).innerHTML = response;
    document.getElementById('position_'+jobID).innerHTML = '<a href="javascript:hideNewApplicants('+jobID+')"><img src="/images/arrow_down.gif" alt="Hide Details">Hide Details</a>';
  }
  //else{document.getElementById('school_list').innerHTML = 'FAILED';
  //}
}
}





function hideNewApplicants(jobID){
  var xmlhttp=false;
  try {
           xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                xmlhttp = false;
            }
        }
  
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {

    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
  if (!xmlhttp && window.createRequest) {
    try {
      xmlhttp = window.createRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
 xmlhttp.open("GET", '/admin/includes/hide_new_applicants_table.php?id='+jobID, true);
 xmlhttp.onreadystatechange=handleResponse;
 xmlhttp.send(null);
//  var response = xmlhttp.responseText;
function handleResponse(){
  var response = xmlhttp.responseText;
  if(xmlhttp.readyState == 4){
    document.getElementById('position_'+jobID).innerHTML = response;
    document.getElementById('applicants_list_'+jobID).innerHTML = '';    
  }
  //else{document.getElementById('school_list').innerHTML = 'FAILED';
  //}
}
}



function showPendingApplicants(jobID){
  var xmlhttp=false;
  try {
           xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                xmlhttp = false;
            }
        }
  
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {

    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
  if (!xmlhttp && window.createRequest) {
    try {
      xmlhttp = window.createRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
 xmlhttp.open("GET", '/admin/includes/build_pending_applicants_table.php?id='+jobID, true);
 xmlhttp.onreadystatechange=handleResponse;
 xmlhttp.send(null);
//  var response = xmlhttp.responseText;
function handleResponse(){
  var response = xmlhttp.responseText;
  if(xmlhttp.readyState == 4){
    document.getElementById('applicants_list_'+jobID).innerHTML = response;
    document.getElementById('position_'+jobID).innerHTML = '<a href="javascript:hidePendingApplicants('+jobID+')"><img src="/images/arrow_down.gif" alt="Hide Details">Hide Details</a>';
  }
  //else{document.getElementById('school_list').innerHTML = 'FAILED';
  //}
}
}





function hidePendingApplicants(jobID){
  var xmlhttp=false;
  try {
           xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                xmlhttp = false;
            }
        }
  
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {

    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
  if (!xmlhttp && window.createRequest) {
    try {
      xmlhttp = window.createRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
 xmlhttp.open("GET", '/admin/includes/hide_pending_applicants_table.php?id='+jobID, true);
 xmlhttp.onreadystatechange=handleResponse;
 xmlhttp.send(null);
//  var response = xmlhttp.responseText;
function handleResponse(){
  var response = xmlhttp.responseText;
  if(xmlhttp.readyState == 4){
    document.getElementById('position_'+jobID).innerHTML = response;
    document.getElementById('applicants_list_'+jobID).innerHTML = '';    
  }
  //else{document.getElementById('school_list').innerHTML = 'FAILED';
  //}
}
}



function showPendingEmployer(jobID){
  var xmlhttp=false;
  try {
           xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                xmlhttp = false;
            }
        }
  
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {

    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
  if (!xmlhttp && window.createRequest) {
    try {
      xmlhttp = window.createRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
 xmlhttp.open("GET", '/admin/includes/build_pending_employer_table.php?id='+jobID, true);
 xmlhttp.onreadystatechange=handleResponse;
 xmlhttp.send(null);
//  var response = xmlhttp.responseText;
function handleResponse(){
  var response = xmlhttp.responseText;
  if(xmlhttp.readyState == 4){
    document.getElementById('applicants_list_'+jobID).innerHTML = response;
    document.getElementById('position_'+jobID).innerHTML = '<a href="javascript:hidePendingEmployer('+jobID+')"><img src="/images/arrow_down.gif" alt="Hide Details">Hide Details</a>';
  }
  //else{document.getElementById('school_list').innerHTML = 'FAILED';
  //}
}
}





function hidePendingEmployer(jobID){
  var xmlhttp=false;
  try {
           xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                xmlhttp = false;
            }
        }
  
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {

    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
  if (!xmlhttp && window.createRequest) {
    try {
      xmlhttp = window.createRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
 xmlhttp.open("GET", '/admin/includes/hide_pending_employer_table.php?id='+jobID, true);
 xmlhttp.onreadystatechange=handleResponse;
 xmlhttp.send(null);
//  var response = xmlhttp.responseText;
function handleResponse(){
  var response = xmlhttp.responseText;
  if(xmlhttp.readyState == 4){
    document.getElementById('position_'+jobID).innerHTML = response;
    document.getElementById('applicants_list_'+jobID).innerHTML = '';    
  }
  //else{document.getElementById('school_list').innerHTML = 'FAILED';
  //}
}
}



function showFinalizeTable(jobID){
  var xmlhttp=false;
  try {
           xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                xmlhttp = false;
            }
        }
  
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {

    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
  if (!xmlhttp && window.createRequest) {
    try {
      xmlhttp = window.createRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
 xmlhttp.open("GET", '/admin/includes/build_finalize_employer_table.php?id='+jobID, true);
 xmlhttp.onreadystatechange=handleResponse;
 xmlhttp.send(null);
//  var response = xmlhttp.responseText;
function handleResponse(){
  var response = xmlhttp.responseText;
  if(xmlhttp.readyState == 4){
    document.getElementById('applicants_list_'+jobID).innerHTML = response;
    document.getElementById('position_'+jobID).innerHTML = '<a href="javascript:hideFinalizeTable('+jobID+')"><img src="/images/arrow_down.gif" alt="Hide Details">Hide Details</a>';
  }
  //else{document.getElementById('school_list').innerHTML = 'FAILED';
  //}
}
}





function hideFinalizeTable(jobID){
  var xmlhttp=false;
  try {
           xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                xmlhttp = false;
            }
        }
  
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {

    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
  if (!xmlhttp && window.createRequest) {
    try {
      xmlhttp = window.createRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
 xmlhttp.open("GET", '/admin/includes/hide_finalize_employer_table.php?id='+jobID, true);
 xmlhttp.onreadystatechange=handleResponse;
 xmlhttp.send(null);
//  var response = xmlhttp.responseText;
function handleResponse(){
  var response = xmlhttp.responseText;
  if(xmlhttp.readyState == 4){
    document.getElementById('position_'+jobID).innerHTML = response;
    document.getElementById('applicants_list_'+jobID).innerHTML = '';    
  }
  //else{document.getElementById('school_list').innerHTML = 'FAILED';
  //}
}
}



function reveal(type, corID){
  var xmlhttp=false;
  try {
           xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                xmlhttp = false;
            }
        }
  
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {

    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
  if (!xmlhttp && window.createRequest) {
    try {
      xmlhttp = window.createRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
 xmlhttp.open("GET", '/includes/Functions/reveal_ajax.php?action='+type+'&corID='+corID, true);
 xmlhttp.onreadystatechange=handleResponse;
 xmlhttp.send(null);
//  var response = xmlhttp.responseText;
function handleResponse(){
  var response = xmlhttp.responseText;
  if(xmlhttp.readyState == 4){
    document.getElementById(type+corID).innerHTML = response;
  }
  //else{document.getElementById('school_list').innerHTML = 'FAILED';
  //}
}
}

function hide(type, corID){
  var xmlhttp=false;
  try {
           xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                xmlhttp = false;
            }
        }
  
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {

    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
  if (!xmlhttp && window.createRequest) {
    try {
      xmlhttp = window.createRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
 xmlhttp.open("GET", '/includes/Functions/hide_ajax.php?action='+type+'&corID='+corID, true);
 xmlhttp.onreadystatechange=handleResponse;
 xmlhttp.send(null);
//  var response = xmlhttp.responseText;
function handleResponse(){
  var response = xmlhttp.responseText;
  if(xmlhttp.readyState == 4){
    document.getElementById(type+corID).innerHTML = response;
  }
  //else{document.getElementById('school_list').innerHTML = 'FAILED';
  //}
}
}


function isMatch(corID, isMatch){
  var xmlhttp=false;
  try {
           xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                xmlhttp = false;
            }
        }
  
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {

    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
  if (!xmlhttp && window.createRequest) {
    try {
      xmlhttp = window.createRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
 xmlhttp.open("GET", '/includes/Functions/match_no_match_ajax.php?match='+isMatch+'&corID='+corID, true);
 xmlhttp.onreadystatechange=handleResponse;
 xmlhttp.send(null);
//  var response = xmlhttp.responseText;
function handleResponse(){
  var response = xmlhttp.responseText;
  if(xmlhttp.readyState == 4){
    document.getElementById('isMatch'+corID).innerHTML = response;
  }
  //else{document.getElementById('school_list').innerHTML = 'FAILED';
  //}
}
}



function employerIsMatch(corID, isMatch){
  var xmlhttp=false;
  try {
           xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                xmlhttp = false;
            }
        }
  
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {

    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
  if (!xmlhttp && window.createRequest) {
    try {
      xmlhttp = window.createRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
 xmlhttp.open("GET", '/includes/Functions/employer_match_no_match_ajax.php?match='+isMatch+'&corID='+corID, true);
 xmlhttp.onreadystatechange=handleResponse;
 xmlhttp.send(null);
//  var response = xmlhttp.responseText;
function handleResponse(){
  var response = xmlhttp.responseText;
  if(xmlhttp.readyState == 4){
    document.getElementById('isMatch'+corID).innerHTML = response;
  }
  //else{document.getElementById('school_list').innerHTML = 'FAILED';
  //}
}
}


function selectAll(id,excluded){
  var mySelect = document.getElementById(id);
  for(var i=0;i<mySelect.length;i++){
    if(mySelect.options[i].value != excluded){
      mySelect.options[i].selected = true;
    }else{
      mySelect.options[i].selected = false;
    }
  }
}

function deselectAll(id,excluded){
  var mySelect = document.getElementById(id);
  for(var i=0;i<mySelect.length;i++){
    if(mySelect.options[i].value != excluded){
      mySelect.options[i].selected = false;
    }else{
      mySelect.options[i].selected = true;
    }
  }
}


function getChecked(myPrefix){
  var myArr = eval(myPrefix+'Values');
  var checked = new Array();
  for(var i=0; i<myArr.length; i++){
    var myField = document.getElementById(myArr[i]);
    if(!myField.checked)continue;
    checked.push(myField.value);
  }
  return checked.join(',');
}

startNavMenuList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}

function init1(){
  startNavMenuList();
  xinha_init();
}

function showMore(element) {
  sibling = element.nextSibling;
  while (sibling && !sibling.tagName) sibling = sibling.nextSibling;
  if (sibling) {
    $(element).hide();
    $(sibling).show();
  }
}

// global onload

Event.observe(document, 'dom:loaded', globalLLinit); 

// buble popups

var __ll_buble_popup_close_timeout = null;
var __ll_buble_popup_open_timeout = null;
var __ll_buble_popup_owner = null;


function globalLLinit(){
	bindPopupEvents();
	Ajax.Responders.register({
		onComplete: rebindPopupEvents
	});
}

function rebindPopupEvents() {
	removePopupEvents();
	bindPopupEvents();
}

function bindPopupEvents() {
	$$('.has_hint').each(function(item) {
        item.observe("mouseover", triggerShowingHint); 
        item.observe("mousemove", moveHint); 
        item.observe("mouseout", triggerRemovingHint); 
    });
	$$('select.hintableSelect').each(function(item) {
        item.observe("mouseover", showHintableSelectHint); 
        item.observe("mousemove", moveHint); 
        item.observe("mouseout", triggerRemovingHint); 
    });
}

function removePopupEvents(){
	$$('.has_hint').each(function(item){
		item.stopObserving("mouseover", triggerShowingHint);
		item.stopObserving("mousemove", moveHint);
		item.stopObserving("mouseout", triggerRemovingHint);
	});
	$$('select.hintableSelect').each(function(item){
		item.stopObserving("mouseover", showHintableSelectHint);
		item.stopObserving("mousemove", moveHint);
		item.stopObserving("mouseout", triggerRemovingHint);
	});
}

function setupHint(elt){
	var hints = $(elt.select('.hint'));
	if (hints.length > 0) {
		showHintDiv(hints[0].innerHTML);
	}
}

function showHint(){
	cancelRemovingHint();
	$('hint').show();
}

function triggerShowingHint(){
	var parentElt = this;
	var hint = $('hint');
	var hintIsDisplayed = hint && hint.visible();
	if (parentElt != __ll_buble_popup_owner)
	{
		__ll_buble_popup_owner = parentElt;
		setupHint(parentElt);
	}
	if (hintIsDisplayed)
		showHint();
	else {
		__ll_buble_popup_open_timeout = setTimeout(function(){
			showHint();
		}, 800);
	}
}

function moveHint(moveEvent){
	var hint = $('hint');
	hint.setStyle({
		left: (moveEvent.pointerX() + 25)+'px',
		top: (moveEvent.pointerY() - hint.getHeight() - 10)+'px'
	});
}

function triggerRemovingHint(){
	if (__ll_buble_popup_open_timeout) clearTimeout(__ll_buble_popup_open_timeout);
	var hint = $('hint');
	if (hint && hint.visible()) {
		hint.observe("mouseout", startRemovingHint);
		hint.observe("mouseover", cancelRemovingHint);
		startRemovingHint();
	}
}

function startRemovingHint(){
	__ll_buble_popup_close_timeout = setTimeout(function(){
		removeHint();
	}, 1300);
}

function cancelRemovingHint() {
	if (__ll_buble_popup_close_timeout) clearTimeout(__ll_buble_popup_close_timeout);
}

function removeHint() {
	$('hint').hide();
}

function replaceHintContent(content) {
	var hint = $('hint');
	if (hint) hint.innerHTML = content;
}

function showHintDiv(content){
	cancelRemovingHint();
	var previousDiv = null;
	$$('div#hint').each(function(item){
		if (previousDiv) 
			previousDiv.remove();
		previousDiv = item;
	});
	if (!previousDiv) 
		$(document.body).insert('<div id="hint">' + content + '</div>');
	else 
		replaceHintContent(content);
}

function showHintableSelectHint(event){
	var select = event.element();
	if (select && select.options.length > 0) {
		showHintDiv(readHintableSelectHintContent(select));
	}
}

function readHintableSelectHintContent(elt) {
	var cnt = $(elt.options[elt.selectedIndex]).readAttribute('__ll_select_popup_cnt');
	return cnt ? cnt : '';
}

function trimValue(contol, maxLength) {
	if (contol.value.length > maxLength)
		contol.value = contol.value.substring(0, maxLength)
}