// JavaScript Document

function refer_check(form_ref) {
	//alert("running check...");
  var alert_txt = "";
  
  if (form_ref.name.value == "") {
	  alert_txt += "\n* Your name field must be filled in.";
	  form_ref.name.style.backgroundColor = "#FF9900";
  } 
  if (form_ref.referring.value == "") {
	  alert_txt += "\n* Please select if you are refering a job candidate."; 
	  form_ref.referring.style.backgroundColor = "#FF9900";
  }
  if (form_ref.can_name.value == "") {
	  alert_txt += "\n* Name of job candidate OR company must be filled in.";
	  form_ref.can_name.style.backgroundColor = "#FF9900";
  } 
  if (form_ref.ref_address.value == "") {
	  alert_txt += "\n* Address field must be filled in.";
	  form_ref.ref_address.style.backgroundColor = "#FF9900";
  }
  if (form_ref.ref_city.value == "") {
	  alert_txt += "\n* City field must be filled in.";
	  form_ref.ref_city.style.backgroundColor = "#FF9900";
  }
  if (form_ref.ref_state.value == "") {
	  alert_txt += "\n* State field must be filled in.";
	  form_ref.ref_state.style.backgroundColor = "#FF9900";
  }
  if (form_ref.ref_zip.value == "") {
	  alert_txt += "\n* Zip field must be filled in.";
	  form_ref.ref_zip.style.backgroundColor = "#FF9900";
  }
  if (form_ref.ref_workphone.value == "") {
	  alert_txt += "\n* Work Phone field must be filled in.";
	  form_ref.ref_workphone.style.backgroundColor = "#FF9900";
  }
  if (form_ref.ref_homephone.value == "") {
	  alert_txt += "\n* Home Phone field must be filled in.";
	  form_ref.ref_homephone.style.backgroundColor = "#FF9900";
  }
  if (form_ref.ref_email.value == "") {
	  alert_txt += "\n* Email field must be filled in.";
	  form_ref.ref_email.style.backgroundColor = "#FF9900";
  }
  if (form_ref.ref_expertise.value == "") {
	  alert_txt += "\n* Expertise field must be filled in.";
	  form_ref.ref_expertise.style.backgroundColor = "#FF9900";
  }
  if (form_ref.security_code.value == "") {
	  alert_txt += "\n* Confirmation Code is Invalid";
	  form_ref.security_code.style.backgroundColor = "#FF9900";
  }

  
  if (alert_txt) { // not all form fields filled in, show alert
  	  alert_txt = "There was a problem trying to process you form:\n"+alert_txt;
	  alert(alert_txt);
	  return false;
  } else {
	  return true;
  }
}

function inquiry_check(form_ref) {
	//alert("running check...");
  var alert_txt = "";
  
  if (form_ref.companyname.value == "") {
	  alert_txt += "\n* Company name field must be filled in.";
	  form_ref.companyname.style.backgroundColor = "#FF9900";
  } 
  if (form_ref.address.value == "") {
	  alert_txt += "\n* Company location field must be filled in.";
	  form_ref.address.style.backgroundColor = "#FF9900";
  } 
  if (form_ref.cwebsite.value == "") {
	  alert_txt += "\n* Company Website field must be filled in.";
	  form_ref.cwebsite.style.backgroundColor = "#FF9900";
  } 
  if (form_ref.contactname.value == "") {
	  alert_txt += "\n* Contact name field must be filled in.";
	  form_ref.contactname.style.backgroundColor = "#FF9900";
  }  
  if (form_ref.ctitle.value == "") {
	  alert_txt += "\n* Contact title field must be filled in.";
	  form_ref.ctitle.style.backgroundColor = "#FF9900";
  }    
  if (form_ref.phone.value == "") {
	  alert_txt += "\n* Phone field must be filled in.";
	  form_ref.phone.style.backgroundColor = "#FF9900";
  }    
  if (form_ref.email.value == "") {
	  alert_txt += "\n* Email field must be filled in.";
	  form_ref.email.style.backgroundColor = "#FF9900";
  }  
  //if (form_ref.pro_ptitle.value == "") {
	//  alert_txt += "\n* Position title field must be filled in.";
	  //form_ref.pro_ptitle.style.backgroundColor = "#FF9900";
  //}  
 
  if (!form_ref.interested_pro.checked && !form_ref.interested_hum.checked) {
      alert_txt += "\n* Need to fill out the Professional Recruiting or \n Human Resource Consulting part of the form.";
	  form_ref.interested_pro.style.backgroundColor = "#FF9900";
	  form_ref.interested_hum.style.backgroundColor = "#FF9900";
  }
  else if (form_ref.interested_pro.checked){
  	if (form_ref.pro_ptitle.value == "") {
		  alert_txt += "\n* Position Title field must be filled in.";
		  form_ref.pro_ptitle.style.backgroundColor = "#FF9900";
 	 }  
  	 if (form_ref.pro_pos_req.value == "") {
		  alert_txt += "\n* Position Requirements field must be filled in.";
		  form_ref.pro_pos_req.style.backgroundColor = "#FF9900";
  	}  
  	 if (form_ref.pro_spec_exp.value == "") {
		  alert_txt += "\n* Position Experience field must be filled in.";
		  form_ref.pro_spec_exp.style.backgroundColor = "#FF9900";
  	}  
  	 if (form_ref.pro_sal_ben.value == "") {
		  alert_txt += "\n* Salary & Benefits field must be filled in.";
		  form_ref.pro_sal_ben.style.backgroundColor = "#FF9900";
 	 }  
  	 if (form_ref.pro_start.value == "") {
		  alert_txt += "\n* Preferred Start Date field must be filled in.";
		  form_ref.pro_start.style.backgroundColor = "#FF9900";
 	 }  
   }
   else if (form_ref.interested_hum.checked) {
     if (!form_ref.hr_suc_hir_pra.checked && !form_ref.hr_per_man.checked && !form_ref.hr_per_rel_aud.checked && !form_ref.hr_per_fil_aud.checked && !form_ref.hr_emp_han_dev.checked && !form_ref.hr_wro_ter.checked && !form_ref.hr_job_des_dev.checked && !form_ref.hr_tra_the_tra.checked) {
          alert_txt += "\n* One or more H.R. Issues need to be checked.";
		  form_ref.pro_start.style.backgroundColor = "#FF9900";
		  form_ref.hr_suc_hir_pra.style.backgroundColor = "#FF9900";
		  form_ref.hr_per_man.style.backgroundColor = "#FF9900";
		  form_ref.hr_per_rel_aud.style.backgroundColor = "#FF9900";
		  form_ref.hr_per_fil_aud.style.backgroundColor = "#FF9900";
		  form_ref.hr_emp_han_dev.style.backgroundColor = "#FF9900";
		  form_ref.hr_wro_ter.style.backgroundColor = "#FF9900";
		  form_ref.hr_job_des_dev.style.backgroundColor = "#FF9900";
		  form_ref.hr_tra_the_tra.style.backgroundColor = "#FF9900";

     }
   }
   
  if (form_ref.hearfrom.value == "") {
		  alert_txt += "\n* Need to select where you heard about us.";
		  form_ref.hearfrom.style.backgroundColor = "#FF9900";
  } 
	 
  if (alert_txt) { // not all form fields filled in, show alert
  	  alert_txt = "There was a problem trying to process you form:\n"+alert_txt;
	  alert(alert_txt);
	  return false;
  } else {
	  return true;
  }
}
function displayHidePro(checkbox_item) {
	if (checkbox_item.checked) {
		//document.getElementById('div_pro').style.visibility = "visible";
		//document.getElementById('div_pro').style.position = "relative";
		document.getElementById('div_pro').style.display = "inline";
		//alert(document.getElementById('div_pro').style.display);
		checkbox_item.form.pro_ptitle.disabled = false;
		checkbox_item.form.pro_job_des.disabled = false;
		checkbox_item.form.pro_pos_req.disabled = false;
		checkbox_item.form.pro_why_pos.disabled = false;
		checkbox_item.form.pro_spec_exp.disabled = false;
		checkbox_item.form.pro_sal_ben.disabled = false;
		checkbox_item.form.pro_start.disabled = false;
		checkbox_item.form.pro_ft_pt.disabled = false;
	} else {
		//document.getElementById('div_pro').style.visibility = "hidden";
		//document.getElementById('div_pro').style.visibility = "collapse";
		//document.getElementById('div_pro').style.position = "absolute";
		document.getElementById('div_pro').style.display = "none";
		//alert(document.getElementById('div_pro').style.display);
		//alert("disable");
		checkbox_item.form.pro_ptitle.disabled = true;
		checkbox_item.form.pro_job_des.disabled = true;
		checkbox_item.form.pro_pos_req.disabled = true;
		checkbox_item.form.pro_why_pos.disabled = true;
		checkbox_item.form.pro_spec_exp.disabled = true;
		checkbox_item.form.pro_sal_ben.disabled = true;
		checkbox_item.form.pro_start.disabled = true;
		checkbox_item.form.pro_ft_pt.disabled = true;
	}
}

function displayHideHum(checkbox_item) {

	if (checkbox_item.checked) {
		document.getElementById('div_hum').style.display = "inline";
		//document.getElementById('div_hum').style.visibility = "visible";
		//document.getElementById('div_hum').style.position = "relative";
		checkbox_item.form.hr_suc_hir_pra.disabled = false;
		checkbox_item.form.hr_per_man.disabled = false;
		checkbox_item.form.hr_per_rel_aud.disabled = false;
		checkbox_item.form.hr_per_fil_aud.disabled = false;
		checkbox_item.form.hr_emp_han_dev.disabled = false;
		checkbox_item.form.hr_wro_ter.disabled = false;
		checkbox_item.form.hr_job_des_dev.disabled = false;
		checkbox_item.form.hr_tra_the_tra.disabled = false;
	} else {
		document.getElementById('div_hum').style.display = "none";
		//document.getElementById('div_hum').style.visibility = "hidden";
		//document.getElementById('div_hum').style.visibility = "collapse";
		//document.getElementById('div_hum').style.position = "absolute";
		checkbox_item.form.hr_suc_hir_pra.disabled = true;
		checkbox_item.form.hr_per_man.disabled = true;
		checkbox_item.form.hr_per_rel_aud.disabled = true;
		checkbox_item.form.hr_per_fil_aud.disabled = true;
		checkbox_item.form.hr_emp_han_dev.disabled = true;
		checkbox_item.form.hr_wro_ter.disabled = true;
		checkbox_item.form.hr_job_des_dev.disabled = true;
		checkbox_item.form.hr_tra_the_tra.disabled = true;
	}
}
