// JavaScript Document

function ValidateContactForm()
{
    var first_name = document.ContactForm.first_name;
	var last_name = document.ContactForm.last_name;
    var email = document.ContactForm.email;
	var company = document.ContactForm.company;
    var phone = document.ContactForm.phone;
 
	// This is a check on the first Name 
    if (first_name.value == "")
    {
        window.alert("Please enter your First Name.");
        first_name.focus();
        return false;
    }
	// This is a check on the last name 
	if (last_name.value == "")
    {
      window.alert("Please enter your Last Name.");
       last_name.focus();
        return false;
    } 
    // Check on the first email address 
	// Checks if Null
    if (email.value == "")
    {
        window.alert("Please enter a valid e-mail address.");
        email.focus();
        return false;
    }
	//Checks if @ in email address
    if (email.value.indexOf("@", 0) < 0)
    {
        window.alert("Please enter a valid e-mail address.");
        email.focus();
        return false;
    }
	//Checks if it has a . in it need to think about this one 
    if (email.value.indexOf(".", 0) < 0)
    {
        window.alert("Please enter a valid e-mail address.");
        email.focus();
        return false;
    }
	//Checks the second email address 
    if (company.value == "")
    {
        window.alert("Please re enter your e-mail address in the confirm email address Field.");
        company.focus();
        return false;
    }
    if (company.value.indexOf("@", 0) < 0)
    {
        window.alert("An e-mail address  must have a @ in it . ");
        company.focus();
        return false;
    }
    if (company.value.indexOf(".", 0) < 0)
    {
        window.alert("Email address must have a .com .com.au .net .");
        company.focus();
        return false;
    }
	if (company.value != email.value)
	{
	   window.alert(" The confirm email address ( " + company.value + " )i s NOT the same as the original email address (" + email.value + " )");
	  company.focus();
	 return false;
	    } 
		
    if (phone.value == "")
    {
        window.alert("Please enter your telephone number.");
        phone.focus();
        return false;
    }

	if(isNaN(phone.value))
	{
		window.alert(" Phone number Must be Numeric");
		phone.focus();
		return false;
		} 
 
}


