
function Val() {

    if(document.mainForm.name.value.length < 3) {
        alert("Please enter valid name");
        document.mainForm.name.focus();
        document.mainForm.name.value="";
        return false;
    }



  
    if(document.mainForm.phone.value.length < 10) {
        alert("Enter valid phone number");
        document.mainForm.phone.focus();
        document.mainForm.phone.value="";
        return false;
    }
    if(document.mainForm.phone.value.indexOf("-") == "-1") {
        alert("please use this format: 123-123-1234");
        document.mainForm.phone.focus();
        document.mainForm.phone.value="";
        return false;
    }



  

    if(document.mainForm.email_1.value.indexOf("@") == "-1" || document.mainForm.email_1.value.indexOf(".") == "-1") {
        alert("Please enter valid email");
        document.mainForm.email_1.focus();
        document.mainForm.email_1.value="";
        return false;
    }
    if(document.mainForm.email_2.value == "") {
        alert("Please verify email");
        document.mainForm.email_2.focus();
        document.mainForm.email_2.value="";
        return false;
    }
    if(document.mainForm.email_1.value != document.mainForm.email_2.value) {
        alert("Email addresses do not match");
        document.mainForm.email_2.focus();
        document.mainForm.email_2.value="";
        return false;
    }



    if(document.mainForm.comments.value.indexOf("fuck") != "-1" ||
        document.mainForm.comments.value.indexOf("shit") != "-1" ||
        document.mainForm.comments.value.indexOf("hot") != "-1"  ||
        document.mainForm.comments.value.indexOf("<") != "-1"    ||
        document.mainForm.comments.value.indexOf("http") != "-1" ||
        document.mainForm.comments.value.indexOf("www") != "-1") {
        alert("Invalid user input.");
        document.mainForm.name.value="";
        document.mainForm.phone.value="";
        document.mainForm.email_1.value="";
        document.mainForm.email_2.value="";
        document.mainForm.comments.value="";
        return false;
    }

    return true

}





 