var errfound = false;

function ValidLength(item, len) {
   return (item.length >= len);
}

function ValidEmail(item) {
   if (!ValidLength(item, 9)) return false;
   if (item.indexOf ('\@', 0) == -1) return false;
   return true;
}

function error(elem, text) {
   if (errfound) return;
   window.alert(text);
   elem.select();
   elem.focus();
   errfound = true;
}

function Validate() {
   errfound = false;
if (!ValidLength(document.email.name.value,3))
      error(document.email.name,"You must enter your name.");

if (!ValidLength(document.email.phone.value,12))
      error(document.email.phone,"You must enter your phone number. EXAMPLE: 714-389-6810");

if (!ValidEmail(document.email.email.value))
      error(document.email.email, "You must enter your E-Mail address. If you have done so did you enter it correctly? EXAMPLE:   neo\@neptune.net");
   return !errfound; /* true if there are no errors */

}

if (document.images) {
    image1on = new Image(); image1on.src = "/images/backb.gif" ;
    image2on = new Image(); image2on.src = "/images/closeb.gif" ;

    image1off = new Image(); image1off.src = "/images/backa.gif" ;
    image2off = new Image(); image2off.src = "/images/closea.gif" ;
}

function turnOn(imageName) {
    if (document.images) {
        document[imageName].src = eval(imageName + "on.src");
    }
}

function turnOff(imageName) {
if (document.images) {
        document[imageName].src = eval(imageName + "off.src");
    }
}
