// Newsletter validation

var errorText = "";

// function is calledon submit
function validate()
{
errorText = "Please fill in: \n\n";

// shortcut the document.input_form with x
x=document.subscription_form

// recieve all the data from the form
firstname=x.firstname.value;
lastname=x.lastname.value;
at=x.email.value.indexOf("@")

// default the submit action to true
submitOK="True"

  // firstname validation field.
if ((firstname.length<1) || (firstname=='Your Firstname'))
 {
  errorText = errorText + "Your Firstname" + "\n"
  x.firstname.focus()
  submitOK="False"
 }

 // lastname validation field.
if ((lastname.length<1) || (lastname=='Your Lastname'))
 {
  errorText = errorText + "Your Lastname" + "\n"
  x.lastname.focus()
  submitOK="False"
 }
 
   // email validation field.
 if (at==-1) 
 {
 errorText = errorText + "A valid E-Mail Address" + "\n"
 submitOK="False"
 x.email.focus()
 }
 // if any of the above validation sections have failed show the alert box with the errorText
if (submitOK=="False")
 {
 alert(errorText)
 // return false to stop the form submission
 return false
 }
}

