// JavaScript Document

function isValidEmail(str)
    {
        return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);    
    }

function validateForm()
    {
        var msg="";
        var mail=document.getElementById("email").value;
        if(document.getElementById("fname").value =="")
        {
            msg+="First Name\n";
        }
        if(document.getElementById("lname").value =="")
        {
            msg+="Last Name\n";
        }
        if(mail=="")
        {
            msg+="Email\n";
        }
        if(msg=="")
        {
            if(isValidEmail(mail))
            {
                document.getElementById('ContactUs').submit();
                return true;
            }
            else
            {
                alert("Please enter a valid e-mail address.");
                return false;
                
            }
        }
        else
        {
            alert("The following form field(s) were incomplete or incorrect:\n\n" + msg + "\nPlease complete or correct the form and try again.");
            return false;
        }
}

function goHome()    {
        window.location.href="index.html" 
}
