  //***************************************************************************************
//This function takes an expression and evaluates it. If the phone number field contains
//these characters, then the function returns true, otherwise, the function will return
//false and disable the submit button. The submit button is run on an "onChange" event in
//the phone number field.
//***************************************************************************************
function isNumber(str) {
  var criteria=/\(?\d{3}\)?[-\/\.]\d{3}[-\/\.]\d{4}/;
  var ok=criteria.exec(str);
  if(!ok){
    alert(str + " " + "is not a valid number");

  }
 }

function isValidPhone(str) {
  var criteria=/\(?\d{3}\)?[-\/\.]\d{3}[-\/\.]\d{4}/;
  var ok=criteria.exec(str);
  if(!ok){
    alert(str + " " + "is not a valid phone number. (ex: 123-456-7890)");
    return false;
  }
  return true;
 }

//***************************************************************************************
// Evaluate a string looking for a '@' and period '.' signifying the user has made an
// attempt to enter a valid email address
//***************************************************************************************
function isValidEmail(str) {
   var isValidEmail = ((str.indexOf("@") != -1) && (str.indexOf(".") != -1));
   if (!isValidEmail) {
     alert(str + " " + "is not a valid email address. (ex: name@company.com)");
     return false;
   }
   return true;
}


//***************************************************************************************
//This function gets the element by Id and then sets the disable property to true to
//disable the submit button.
//***************************************************************************************
function disableButton(){
  obj=document.getElementById('Submit');
   obj.disabled=true;
}


//***************************************************************************************
//This function enables the submit button in the same way as the disable button disables
//the submit button.
//***************************************************************************************
function enableButton(){
  obj=document.getElementById('Submit');
   obj.disabled=false;
}


//***************************************************************************************
//This function takes the values from the validatefields() function and uses it to test
//if any of the text boxes are empty. If they are, then a message displays the field name
//where the missing information is. It also disables the submit button.
//***************************************************************************************
function validateFieldArray(flds){
  for(var i=0; i<flds.length; i++){
    if(flds[i][0].value=="" ){
      alert("Please enter" + " "+flds[i][1]);
      flds[i][0].focus();
      //disableButton();
      return false;
    }
     //return true;
   }
}

//***************************************************************************************
//This function takes the values from the validatefields() function and uses it to test
//if any of the text boxes are empty. If they are, then a message displays the field name
//where the missing information is. It also disables the submit button.
// Modified by RRG on 20031204
//***************************************************************************************
function validateAccessRequestForm(flds){

  // parse through all the fields
  for(var i=0; i<flds.length; i++){

    // if the field is required, check to make sure it has a value
    if(flds[i][1]=="Y") {
      if(flds[i][0].value=="" ){
        alert("Please enter" + " "+flds[i][3]);
        flds[i][0].focus();
        return false;
      }
    }

    // if you made it past the first check, then the field has a value.  If it has a value
    // and is a phone number or email address, validate to make sure it is a valid phone
    // number or email address
    if(flds[i][0].value.length > 0) {

      // valide if email address
      if(flds[i][2]=="E") {
        if(!isValidEmail(flds[i][0].value)) {
          flds[i][0].focus();
          return false;
        }
      }

      // valide if phone number
      if(flds[i][2]=="P") {
        if(!isValidPhone(flds[i][0].value)) {
          flds[i][0].focus();
          return false;
        }
      }

    } // if

  } // for

} // function validateFields

//***************************************************************************************
//This function looks at each element in the document and holds an array of form objects.
//The array corresponds to the particular form object name. Then these values are passed
//up to the validateArray() function.
//***************************************************************************************
/*
function validateFields(){
  var frm=document.forms.frmValidation;
  var flds=new Array();
  flds[flds.length]=[frm.tFName, "a First Name."];
  flds[flds.length]=[frm.tLName, "a Last Name."];
  flds[flds.length]=[frm.company, "a Company Name."];
  flds[flds.length]=[frm.address, "an Address."];
   flds[flds.length]=[frm.city, "a City."];
   flds[flds.length]=[frm.state, "a State."];
  flds[flds.length]=[frm.zip, "a Zip Code."];
  flds[flds.length]=[frm.phone, "a Phone Number."];
  flds[flds.length]=[frm.fax, "a valid fax number"];
  flds[flds.length]=[frm.email, "an Email Address."];
  flds[flds.length]=[frm.tbondarea, "a comment for the type of bonds you are requesting."];
  return validateFieldArray(flds);
}
*/