// JavaScript Document
function ValidateSubmit() {

    var valid = true;
    if (document.forms[0].Name.value == "") 
    {
        valid = false;
        alert("Please fill in the name field.");
    }
    else if (document.forms[0].Address.value == "") 
    {
        valid = false;
        alert("Please fill in the Address field.");
    }
    else if (document.forms[0].City.value == "") 
    {
        valid = false;
        alert("Please fill in the City field.");
    }
    else if (document.forms[0].State.value == "") 
    {
        valid = false;
        alert("Please fill in the State field.");
    }	
    else if (document.forms[0].Zip.value == "") 
    {
        valid = false;
        alert("Please fill in the Postal Code/Zip field.");
    }		
    else if (document.forms[0].Country.value == "") 
    {
        valid = false;
        alert("Please fill in the Country field.");
    }		
    else if (document.forms[0].Phone.value == "") 
    {
        valid = false;
        alert("Please fill in the phone field.");
    }
	else if (document.forms[0].Fax.value == "") 
    {
        valid = false;
        alert("Please fill in the Fax field.");
    }
    else if (document.forms[0].Email.value == "") 
    {
        valid = false;
        alert("Please fill in the email field.");
    }	
    else if (document.forms[0].NetWorth.value == "") 
    {
        valid = false;
        alert("Please fill in the Approximate Net Worth field.");
    }
    else if (document.forms[0].Hearaboutus.value == "Enter Text") 
    {
        valid = false;
        alert("Please fill in the How did you hear about us field.");
    }
    else if (document.forms[0].OwnBusiness.value == "Enter Text") 
    {
        valid = false;
        alert("Please fill in the Have you owned a business field.");
    }		
    else if (document.forms[0].EduBg.value == "Enter Text") 
    {
        valid = false;
        alert("Please fill in the Education Background field.");
    }		
    else if (document.forms[0].EmpHistory.value == "Enter Text") 
    {
        valid = false;
        alert("Please fill in the Employment History field.");
    }
    else if (document.forms[0].Contact.value == "") 
    {
        valid = false;
        alert("Please fill in the How you would like to be contacted field.");
    }
	
	else {
    new Ajax.Request( 'proContact5.php?call=ValidateCaptcha',
                        {parameters     : 'security_code=' + document.forms['orderForm'].elements['security_code'].value,
                         onComplete     : ValidateSubmit_Callback});
	}
}

function ValidateSubmit_Callback(responseObj) {
	var returnVal = responseObj.responseText;
    if (returnVal==1){
        $('invalidCaptchaMsg').innerHTML = '';
        document.forms['orderForm'].submit();                 
    }else{
		$('invalidCaptchaMsg').innerHTML = '<font color=red>Please enter the correct code.</font>';
    }	
}
