function limitField(theField,size)
{
if (theField.value.length > size) {
	ch2 = theField.value.substring(0,size)
	alert ("we have truncated your answer to " + size + " characters")
	theField.focus()
	theField.select()
	theField.value = ch2
	}
return true
}

function isEmailAddress (string)
{
  var addressPattern = 
    /^.+\@.+\..+$/;
  return addressPattern.test(string);
}

function checkDot () {
this.on = new Image();
this.on.src = "/images/dot_red.gif"
this.off = new Image();
this.off.src = "/images/space.gif"
}

function check_on (imgName)
// Show Image
{
if (document.images)
	document[imgName].src = checkDot.on.src;
}

function check_off (imgName)
// Hide Image
{
if (document.images)
    document[imgName].src = checkDot.off.src;
}

if (document.images != null) {
checkDot = new checkDot();
}

function fnamecheck(imgName)
{
if ((document.contactusform.firstname_input.value=="")||(document.contactusform.firstname_input.value==" "))
	check_on(imgName)
else
	check_off(imgName);
}

function lnamecheck(imgName)
{
if ((document.contactusform.lastname_input.value=="")||(document.contactusform.lastname_input.value==" "))
	check_on(imgName)
else
	check_off(imgName);
}

function emailcheck(imgName)
{
if ((!isEmailAddress(document.contactusform.email_input.value)) || (document.contactusform.email_input.value=="")||(document.contactusform.email_input.value==" "))
	check_on(imgName)
else
	check_off(imgName);
}

function change_notice()
{
if ((document.contactusform.firstname_input.value == "") ||
(document.contactusform.firstname_input.value == " "))
{
alert("The 'First Name' field is required")
document.contactusform.firstname_input.focus();
}
else if ((document.contactusform.lastname_input.value == "") ||
(document.contactusform.lastname_input.value == " "))
{
alert("The 'Last Name' field is required")
document.contactusform.lastname_input.focus();
}
else if ((document.contactusform.email_input.value == "") ||
(document.contactusform.email_input.value == " "))
{
alert("The 'E-mail address' field is required")
document.contactusform.email_input.focus();
}
else if (!isEmailAddress(document.contactusform.email_input.value))
{
alert("An improper E-mail address was entered")
document.contactusform.email_input.focus();
}
else
{document.contactusform.submit();}
}

function totalclear()
{
check_on ("firstname");
check_on ("lastname");
check_on ("email");
}

