function Validate() { //v4.0
  var errors=''
  var format=''
  var f = document.form2;
  
  if (f.FirstName.value==""){
    errors+= '- First Name is required.\n';
  }
  if (f.LastName.value==""){
    errors+= '- Last Name is required.\n';
  }
	
  if (f.Phone.value!="" && !isValid(f.Phone.value,"phone")) {
	format+= '- Invalid Phone Number\n';
  }
	
  if (f.Fax.value!="" && !isValid(f.Fax.value,"phone")) {
	format+= '- Invalid Fax Number\n';
  }

  if  (f.Email.value == "") {
	errors+= '- Email is required\n';
  } else if (! isValid(f.Email.value,"email") ) {
	format+= '- The Email you entered is not a valid Email format\n';
  }

  var alertString = ''
  if (errors) { alertString = 'The following fields are required:\n'+errors; }
  if (format) { alertString = alertString + '\nInvalid Entries:\n'+format; }
  if (alertString) alert(alertString);
  document.ReVal = (alertString == '');
}

function isValid(n,pattern) {
  if (pattern == "phone" ) {
    re = /(([01][\.\- +]\(\d{3}\)[\.\- +]?)|([01][\.\- +]\d{3}[\.\- +])|(\(\d{3}\) ?)|(\d{3}[- \.]))?\d{3}[- \.]\d{4}/
  } else if (pattern == "email" ) {
    re = /^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/
  } else if (pattern == "date" ) {
    re = /^(?:(?:(?:0?[13578]|1[02])(\/|-|\.)31)\1|(?:(?:0?[1,3-9]|1[0-2])(\/|-|\.)(?:29|30)\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:0?2(\/|-|\.)29\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|\.)(?:0?[1-9]|1\d|2[0-8])\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$/
  } else if (pattern == "zip" ) {
    re = /^(\d{5}-\d{4}|\d{5})$|^([a-zA-Z]\d[a-zA-Z] \d[a-zA-Z]\d)$/
  } else if (pattern == "card" ) {
    re = /^((4\d{3})|(5[1-5]\d{2})|(6011))-?\d{4}-?\d{4}-?\d{4}|3[4,7]\d{13}$/
  } else if (pattern == "domain") {
    re = /^([a-zA-Z0-9][-a-zA-Z0-9]*[a-zA-Z0-9]\.)+([a-zA-Z0-9]{2,5})$/
  } else if (pattern == "url") {
    re = /^(http|https|ftp)\:\/\/((([a-z_0-9\-]+)+(([\:]?)+([a-z_0-9\-]+))?)(\@+)?)?(((((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5]))))|((([a-z0-9\-])+\.)+([a-z]{2}\.[a-z]{2}|[a-z]{2,4})))(([\:])(([1-9]{1}[0-9]{1,3})|([1-5]{1}[0-9]{2,4})|(6[0-5]{2}[0-3][0-6])))?\/?$/
  }

  if (!re.test(n)) {
	return false;
  } else {
	return true;
  }
}
