
function check(field) {
field[1].checked = true;
}

function check2(field) {
field[2	].checked = true;
}

function check5(field) {
field[5].checked = true;
}

function emailcheck (emailStr) {
var emailPat=/^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
var validChars="\[^\\s" + specialChars + "\]"
var quotedUser="(\"[^\"]*\")"
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
var atom=validChars + '+'
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
var matchArray=emailStr.match(emailPat)

if (matchArray==null) {
	alert("Please enter a valid Email address.")
	document.emailform.email.focus()
	document.emailform.email.select()
	return false
}

var user=matchArray[1]
var domain=matchArray[2]

if (user.match(userPat)==null) {
    alert("The email username doesn't seem to be valid.")
	document.emailform.email.focus()
	document.emailform.email.select()
    return false
}

var IPArray=domain.match(ipDomainPat)

if (IPArray!=null) {
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert("Email destination IP address is invalid!")
			document.emailform.email.focus()
			document.emailform.email.select()
		return false
	    }
    }
    return true
}

var domainArray=domain.match(domainPat)
if (domainArray==null) {
	alert("The email domain name doesn't seem to be valid.")
	document.emailform.email.focus()
	document.emailform.email.select()
    return false
}

var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>20) {
   alert("The email address must end in a domain name between two and twenty letters.")
	document.emailform.email.focus()
	document.emailform.email.select()
   return false
}

if (len<2) {
   var errStr="Email address is missing a hostname."
   alert(errStr)
	document.emailform.email.focus()
	document.emailform.email.select()
   return false
}

return true;
}


function trim(str) {
  while (str.charAt(str.length - 1)==" ")
    str = str.substring(0, str.length - 1);
  while (str.charAt(0)==" ")
    str = str.substring(1, str.length);
  return str;
}


function verify() {
var themessage = "You are required to provide the following information:\n";

if (trim(document.emailform.FirstName.value)=="") {
themessage = themessage + "\t -  First Name\n";
}
if (trim(document.emailform.LastName.value)=="") {
themessage = themessage + "\t -  Last Name\n";
}
if (trim(document.emailform.StreetAddress1.value)=="") {
themessage = themessage + "\t -  Street Address\n";
}
if (trim(document.emailform.City.value)=="") {
themessage = themessage + "\t -  City\n";
}

cselchoice = document.emailform.Country.selectedIndex;
if (document.emailform.Country.options[cselchoice].value=="840") {
	if (trim(document.emailform.State.value)==""){
		themessage = themessage + "\t -  State\n";
	}
}

if (trim(document.emailform.PostalCode.value)=="") {
themessage = themessage + "\t -  Postal Code\n";
}
if (document.emailform.Feedback.value.length > 3000) {
themessage = themessage + "\t -  A message less than 3000 characters\n";
}
if (themessage == "You are required to provide the following information:\n") {
return true;
}
else {
alert(themessage);
	if (document.emailform.Feedback.value.length > 3000) {
	document.emailform.Feedback.focus();
	}
	if (document.emailform.PostalCode.value=="") {
	document.emailform.PostalCode.focus();
	}
	if (document.emailform.Country.value == "840") {
		if (document.emailform.State.value==""){
		document.emailform.State.focus();
		}
	}
	if (document.emailform.City.value=="") {
	document.emailform.City.focus();
	}
	if (document.emailform.StreetAddress1.value=="") {
	document.emailform.StreetAddress1.focus();
	}
	if (document.emailform.LastName.value=="") {
	document.emailform.LastName.focus();
	}
	if (document.emailform.FirstName.value=="") {
	document.emailform.FirstName.focus();
	}
return false;
   }
}


