function verify_empty (txt_field, lyr_name, str) {
  var tempLyr = document.getElementById(lyr_name);
  if (trim(txt_field.value) == "") {
    tempLyr.innerHTML = str;
    tempLyr.style.visibility = "visible";
    return false;
  }
  tempLyr.innerHTML = "&nbsp;";
  tempLyr.style.visibility = "hidden";
  return true;
}
function verify_radio(field, lyr_name, str) {
  var tempLyr = document.getElementById(lyr_name);
  for (i = 0; i < field.length; i++) {
    if (field[i].checked) {
      tempLyr.innerHTML = "&nbsp;";
      tempLyr.style.visibility = "hidden";
      return true;      
    }
  }
  tempLyr.innerHTML = str;
  tempLyr.style.visibility = "visible";
  return false;
}
function verify_phone(txt_field, lyr_name, str) {
  var tempLyr = document.getElementById(lyr_name);
  var temp_str = txt_field.value;
  if (temp_str.length == 0) return true;
  temp_str = temp_str.replace(/\(/g, "");
  temp_str = temp_str.replace(/\./g, "");
  temp_str = temp_str.replace(/-/g, "");
  temp_str = temp_str.replace(/\)/g, "");
  temp_str = temp_str.replace(/ /g, "");
  for (i = 0; i < temp_str.length; i++) {
    if (!(temp_str.charAt(i) >= "0" && temp_str.charAt(i) <= "9")) {
      tempLyr.innerHTML = str;
      tempLyr.style.visibility = "visible";    
      return false;
    }
    if (temp_str.length != 10) {
      tempLyr.innerHTML = str;
      tempLyr.style.visibility = "visible";    
      return false;
    }
  }
  tempLyr.innerHTML = "&nbsp;";
  tempLyr.style.visibility = "hidden";
  txt_field.value = temp_str;
  return true;
}
function verify_combo (field, lyr_name, str) {
  var tempLyr = document.getElementById(lyr_name);
  var temp_index = field.selectedIndex;
  if (temp_index == 0) {
    tempLyr.innerHTML = str;
    tempLyr.style.visibility = "visible";    
    return false;
  }
  tempLyr.innerHTML = "&nbsp;";
  tempLyr.style.visibility = "hidden";
  return true;
}
function verify_email(txt_field, lyr_name, str) {
  var tempLyr = document.getElementById(lyr_name);
  var temp_str = txt_field.value;
  if (temp_str.length == 0) {
    tempLyr.innerHTML = "&nbsp;";
    tempLyr.style.visibility = "hidden";
    return true;
  }
  if (temp_str.indexOf("@") == -1 || temp_str.indexOf(".") == -1 || temp_str.indexOf("@") > temp_str.lastIndexOf(".")) {
    tempLyr.innerHTML = str;
    tempLyr.style.visibility = "visible";
    return false;
  }
  tempLyr.innerHTML = "&nbsp;";
  tempLyr.style.visibility = "hidden";
  return true;
}
function verify_number(txt_field, lyr_name, str) {
  var tempLyr = document.getElementById(lyr_name);
  var temp_str = txt_field.value;

  for (i = 0; i < temp_str.length; i++) {
    if (!(temp_str.charAt(i) >= "0" && temp_str.charAt(i) <= "9") && temp_str.charAt(i) != "-") {
      tempLyr.innerHTML = str;
      tempLyr.style.visibility = "visible";    
      return false;
    }
  }
  tempLyr.innerHTML = "&nbsp;";
  tempLyr.style.visibility = "hidden";
  txt_field.value = temp_str;
  return true;
}
function verify_min(txt_field, lyr_name, min, str) {
  var tempLyr = document.getElementById(lyr_name);
  var temp_str = txt_field.value;
  if (parseInt(temp_str) < min) {
    tempLyr.innerHTML = str;
    tempLyr.style.visibility = "visible";    
    return false;
  }
  tempLyr.innerHTML = "&nbsp;";
  tempLyr.style.visibility = "hidden";
  txt_field.value = temp_str;
  return true;
}
function verify_pc(txt_field, lyr_name, str) {
  var tempLyr = document.getElementById(lyr_name);
  var temp_str = txt_field.value;
  if (temp_str.length == 0) return true;
  temp_str = temp_str.replace(/-/g, "");

    if (temp_str.length != 6) {
      tempLyr.innerHTML = str;
      tempLyr.style.visibility = "visible";    
      return false;
    } else {
      if (!(isChar(temp_str.charAt(0)) && isNum(temp_str.charAt(1)) && isChar(temp_str.charAt(2)) && isNum(temp_str.charAt(3)) && isChar(temp_str.charAt(4)) && isNum(temp_str.charAt(5)) )) {
        tempLyr.innerHTML = str;
        tempLyr.style.visibility = "visible";    
        return false;
      }
    }
  tempLyr.innerHTML = "&nbsp;";
  tempLyr.style.visibility = "hidden";
  return true;
}
function isNum(char) {
  if (char >= "0" && char <= "9")
    return true;
  return false;
}
function isChar(char) {
  if (char.toUpperCase() >= "A" && char.toUpperCase() <= "Z")
    return true;
  return false;
}
function verify_hours (field1, field2, field3, lyr_name, str) {
  var tempLyr = document.getElementById(lyr_name);
  var temp_index1 = field1.selectedIndex;
  var temp_index2 = field2.selectedIndex;
  if (!field3.checked) {
    if (temp_index1 == 0 || temp_index2 == 0) {
      tempLyr.innerHTML = str;
      tempLyr.style.visibility = "visible";    
      return false;
    }
  }
  tempLyr.innerHTML = "&nbsp;";
  tempLyr.style.visibility = "hidden";
  return true;
}






function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
