<!--
var theForm;

function validate() {
  theForm = document.emailform;


  if (trim(theForm.FirstName.value) == "") {
    alert ("First name is blank");
    theForm.FirstName.focus();
    return false;
  }
  else if (trim(theForm.LastName.value) == "") {
    alert ("Last name is blank");
    theForm.LastName.focus();
    return false;
  }

  else if (trim(theForm.Company.value) == "") {
    alert ("Company is blank");
    theForm.Company.focus();
    return false;
  }

  else if (trim(theForm.email.value) == "") {
    alert ("E-Mail is blank");
    theForm.email.focus();
    return false;
  }

  else if (theForm.email.value.indexOf("@") == -1 || theForm.email.value.indexOf(".") == -1) {
    alert ("Incorrect E-Mail format");
    theForm.email.select();
    theForm.email.focus();
    return false;
  }

  else if (theForm.Areacode.value.length != 3) {
    alert ("Area code must be three digits");
    theForm.Areacode.select();
    theForm.Areacode.focus();
    return false;
  }

  else if (!IsNumeric(theForm.Areacode.value)) {
    alert ("Area code is not a number");
    theForm.Areacode.select();
    theForm.Areacode.focus();
    return false;
  }

  else if (theForm.Phone.value.length < 7) {
    alert ("Phone Number must be seven digits");
    theForm.Phone.select();
    theForm.Phone.focus();
    return false;
  }

  else if (!IsNumeric(theForm.Phone.value)) {
    alert ("Phone Number is not a number");
    theForm.Phone.select();
    theForm.Phone.focus();
    return false;
  }


  else if (!IsNumeric(theForm.TelExt.value)) {
    alert ("Phone extention is not a number");
    theForm.TelExt.select();
    theForm.TelExt.focus();
    return false;
  }

/*
  else if (theForm.Typefunction1.checked == false &&
           theForm.Typefunction2.checked == false &&
           theForm.Typefunction3.checked == false &&
           theForm.Typefunction4.checked == false &&
           theForm.Typefunction5.checked == false) {

    alert ("Al least one of the \ntype of Function must be select");
    return false;
  }
  */ 
}



function IsNumeric(str) {
  var numeric = "0123456789-";
 
    for (i = 0; i < str.length; i++)
      if (numeric.indexOf(str.charAt(i)) == -1) return false;
  return true;
}



function trim (str) {
  while (str.substring (0, 1) == ' ' && str.length > 0) {
    str = str.substring (1, s.length);
  }

  while (str.substring (str.length-1, str.length) == ' '  && str.length > 0) {
    str = s.substring(0, s.length-1);
  }
  return str;
}
//-->
