function formval(myForm)
{
    var result = true;
    var reason = "";

    // email address should match and at least look right
    if (!myForm.email1.value.match(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)) {
        reason += "Please enter a valid E-Mail address.\n";
        result = false;
    }
                        
    if (myForm.email1.value != myForm.email2.value) {
        reason += "The E-Mail address entered do not match.\n";
        result = false;
    }
                        
    // names should contain no special characters
    if (!myForm.first.value.match(/^[A-Za-z\s.\-]+$/)) {
        reason += "Please enter a valid name.\n";
        result = false;
    }
                        
    if (!myForm.last.value.match(/^[A-Za-z\s.\-]+$/)) {
        reason += "Please enter a valid name.\n";
        result = false;
    }
                        
    if (!myForm.company.value.match(/^[\w\s._,\-\&]+$/)) {
        reason += "Please enter a valid company name.\n";
        result = false;
    }
                        
    // phone numbers should look familiar
    if (!myForm.phone.value.match(/^((\([0-9]{3}\)\s?)|([0-9]{3}[\s.\-]?))[0-9]{3}[\s.\-]?[0-9]{4}$/)) {
        reason += "Please enter a valid 10-digit phone number.\n";
        result = false;
    }
                        
    // extensions should be a maximum of 4 digits
    if (myForm.ext.value != "" &&
        !myForm.ext.value.match(/^[0-9]{1,4}$/)) {
        reason += "Please enter a valid (1-4 digit) telephone extension.\n";
        result = false;
    }
                        
    // user must accept terms
    if (myForm.terms.checked == false) {
        reason += "You must agree to the terms and conditions of this offer.\n";
        result = false;
    }
                        
    if (result != true) { alert (reason); }

    return result;
}


