function testBox1(form) {
Ctrl = form.email;
if (isEmail(form.email.value)==(true)) {
	return (true);
} else
	validatePrompt (Ctrl, "Enter a valid email address")
	return (false);
}

function testBox2(form) {
Ctrl = form.contact;
if (Ctrl.value == "") {
	validatePrompt (Ctrl, "Please enter a value in the Name field.")
	return (false);
} else
	return (true);
}

function testBox3(form) {
Ctrl = form.company;
if (Ctrl.value == "") {
	validatePrompt (Ctrl, "Please enter a value in the Company field.")
	return (false);
} else
	return (true);
}

function testBox4(form) {
Ctrl = form.address;
if (Ctrl.value == "") {
	validatePrompt (Ctrl, "Please enter a value in the Address field.")
	return (false);
} else
	return (true);
}

function testBox5(form) {
Ctrl = form.city;
if (Ctrl.value == "") {
	validatePrompt (Ctrl, "Please enter a value in the City field.")
	return (false);
} else
	return (true);
}

function testBox6(form) {
Ctrl = form.country;
if (Ctrl.value == "") {
	validatePrompt (Ctrl, "Please enter a value in the Country field.")
	return (false);
} else
	return (true);
}

function testBox7(form) {
Ctrl = form.phone;
if (Ctrl.value == "") {
	validatePrompt (Ctrl, "Please enter a value in the Phone field.")
	return (false);
} else
	return (true);
}

function runSubmit (form)  {
if (!testBox2(form)) return false;
if (!testBox3(form)) return false;
if (!testBox1(form)) return false;
if (!testBox4(form)) return false;
if (!testBox5(form)) return false;
if (!testBox6(form)) return false;
if (!testBox7(form)) return false;
return;
}

function validatePrompt (Ctrl, PromptStr) {
alert (PromptStr)
Ctrl.focus();
return;
}

function isEmail(str) {
  // are regular expressions supported?
  var supported = 0;
  if (window.RegExp) {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported) 
    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  return (!r1.test(str) && r2.test(str));
}
