// JavaScript Document

function validateform2() {
  var missing = '';
  var invalid = '';

  
  if (document.form2.Name.value == '' || document.form2.Name.value == document.form2.Name.defaultValue) {
    missing += (missing != '') ? ', "Name"' : '"Name"';
  }
  
  if (document.form2.email.value == '' || document.form2.email.value == document.form2.email.defaultValue) {
    missing += (missing != '') ? ', "E-mail"' : '"E-mail"';
  }
  if (document.form2.Phone.value == '' || document.form2.Phone.value == document.form2.Phone.defaultValue) {
    missing += (missing != '') ? ', "Phone"' : '"Phone"';
  }
          var emailFilter=/^.+@.+\..+$/;
  var illegalChars= /[\(\)\<\>\,\;\:\\\/\[\]]/;
  var addr = document.form2.email.value;
  if (!(emailFilter.test(addr)) || addr.match(illegalChars)) {
       invalid += "Please enter a valid email address.\n\n";
  }
          var digits = document.form2.Phone.value.replace(/[\(\)\.\-\ ]/g, '');
  if (isNaN(parseInt(digits))) {
    invalid += "The phone number contains illegal characters.\n\n";
  }
  if (digits.length < 10) {
	invalid += "The phone number must contain at least ten digits. Make sure you include an area code.\n\n";
  }
  if (missing != '') {
    alert("Required fields missing: " + missing);
    return false;
  } else if (invalid != '') {
    alert("Error: \n" + invalid);
    return false;
  } else {
    /*document.form2.action;*/
	return true;
  }
  return false;
}

function validateform1() {
  var missing = '';
  var invalid = '';

  if (document.form1.Message.value == '' || document.form1.Message.value == document.form1.Message.defaultValue) {
    missing += (missing != '') ? ', "How can we help you?"' : '"How can we help you?"';
  }
  
  if (document.form1.Name.value == '' || document.form1.Name.value == document.form1.Name.defaultValue) {
    missing += (missing != '') ? ', "Name"' : '"Name"';
  }
  
  if (document.form1.email.value == '' || document.form1.email.value == document.form1.email.defaultValue) {
    missing += (missing != '') ? ', "E-mail"' : '"E-mail"';
  }
          var emailFilter=/^.+@.+\..+$/;
  var illegalChars= /[\(\)\<\>\,\;\:\\\/\[\]]/;
  var addr = document.form1.email.value;
  if (!(emailFilter.test(addr)) || addr.match(illegalChars)) {
       invalid += "Please enter a valid email address.\n\n";
  }
if (document.form1.Phone.value != 'Phone') {
          var digits = document.form1.Phone.value.replace(/[\(\)\.\-\ ]/g, '');
  if (isNaN(parseInt(digits))) {
    invalid += "The phone number contains illegal characters.\n\n";
  }
  if (digits.length < 10) {
	invalid += "The phone number must contain at least ten digits. Make sure you include an area code.\n\n";
  }
}
  if (missing != '') {
    alert("Required fields missing: " + missing);
    return false;
  } else if (invalid != '') {
    alert("Error: \n" + invalid);
    return false;
  } else {
    /*document.form1.action;*/
	return true;
  }
  return false;
}