/*
###############################################
## file...	functions.js
## desc...	misc javascript functions
##
## date...	7/15/2008
## rev....	
###############################################
*/

function show_search_link(){
	document.getElementById('adv_search_link').style.visibility = 'visible';
	return true;
}
function popup(elem){
	document.getElementById(elem).style.zIndex = 1;
	document.getElementById(elem).style.visibility = 'visible';
}
function hide_popup(elem){
	document.getElementById(elem).style.visibility = 'hidden';
	document.getElementById(elem).style.zIndex = -1;
}
function clear_elem(elem){
	document.getElementById(elem).innerHTML = "";
}
function validate_form(){
	var valid = true;
  var error_txt = "";
  if ( document.contact.name.value == "" )
  {
    error_txt = "Name is required.\n";
    valid = false;
  }
  if ( document.contact.email.value == "" )
  {
    error_txt += "Email is required.\n";
    valid = false;
  }
  if(document.contact.zip_search.value == ""){
    error_txt += "Zip code is required.\n";
    valid = false;
  }
  if(document.contact.zip_search.value.length < 5 || document.contact.zip_search.value.length > 5){
    error_txt += "Zip code must be 5 digits.\n";
    valid = false;
  }
  var ph = document.contact.phone.value;
  document.contact.phone.value = ph.replace('-','');
  document.contact.phone.value = ph.replace('(','');
  document.contact.phone.value = ph.replace(')','');
  
  if ( document.contact.aop.value == "" )
  {
  	error_txt += "Area of Practice (AOP) is required.";
    valid = false;
  }
  if(valid == false){
    alert(error_txt);
  }
  return valid;
}

function remove_zip_text(){
	document.zSearch.zip.value = "";
	document.zSearch.zip.style.color = "#000";
	document.zSearch.zip.style.fontStyle = "normal";
	return;
}
