function ValidateForm()
{
    var errors = '';
    var stmp = '';
    
    // first name
    if (trim(document.getElementById("firstname").value) == "")
    {
        errors = 'First Name is required';
        stmp = ",\n";
    }
    
    // last name
    if (trim(document.getElementById("lastname").value) == "")
    {
        errors = errors + stmp + 'Last Name is required';
        stmp = ",\n";
    }
    
    // address
    if (trim(document.getElementById("address").value) == "")
    {
        errors = errors + stmp + 'Address is required';
        stmp = ",\n";
    }
    
    // city
    if (trim(document.getElementById("city").value) == "")
    {
        errors = errors + stmp + 'City is required';
        stmp = ",\n";
    }   
    
    // state
    if (document.getElementById("state").options[document.getElementById("state").selectedIndex].value == "1")
    {
        errors = errors + stmp + 'State is required';
        stmp = ",\n";
    }    
     
    // zipcode
    if (trim(document.getElementById("zipcode").value) == "")
    {
        errors = errors + stmp + 'Zip Code is required';
        stmp = ",\n";
    }  
    else if (trim(document.getElementById("zipcode").value).length != 5)
    {
        errors = errors + stmp + 'Zip Code should be 5 digits';
        stmp = ",\n";
    }      
    else if (isNumeric(trim(document.getElementById("zipcode").value)) == false)
    {
        errors = errors + stmp + 'Zip Code should be all numeric';
        stmp = ",\n";
    }         
    
    // only one of the phone numbers is required
    var blnDay = false;
    var blnEve = false;
    var blnCell = false;
    
    if (trim(document.getElementById("phoneday").value) != "")
    {
        blnDay = true;
    }
    if (trim(document.getElementById("phoneeve").value) != "")
    {
        blnEve = true;
    }
    if (trim(document.getElementById("phonecell").value) != "")
    {
        blnCell = true;
    }
    
    if ((blnDay == false) && (blnEve == false) && (blnCell == false))
    {
        errors = errors + stmp + 'Day, Evening or Cell Phone # is required';
        stmp = ",\n";
    }
     
     // email
     if (trim(document.getElementById("email").value) == "")
     {
        errors = errors + stmp + 'Email is required';
        stmp = ",\n";
     }
     else if (echeck(trim(document.getElementById("email").value)) == false)
     {
        errors = errors + stmp + 'Email is invalid';
        stmp = ",\n";
     }
     
     // email1
     if (trim(document.getElementById("email1").value) != "")
     {
         if (echeck(trim(document.getElementById("email1").value)) == false)
         {
            errors = errors + stmp + 'Optional Email is invalid';
            stmp = ",\n";
         }
     }
     
     // gender
     if(document.getElementById("app_gender").options[document.getElementById("app_gender").selectedIndex].value == "1")
     {
        errors = errors + stmp + 'Gender is required';
        stmp = ",\n";
     }
     
     // marital status
     if(document.getElementById("app_marital").options[document.getElementById("app_marital").selectedIndex].value == "1")
     {
        errors = errors + stmp + 'Marital Status is required';
        stmp = ",\n";
     }
     
     // DOB Month
     if (trim(document.getElementById("dobMM").value) == "")
     {
        errors = errors + stmp + 'Date of Birth: Month is required';
        stmp = ",\n";
     }
     else if ((parseInt(document.getElementById("dobMM").value) < 1) || (parseInt(document.getElementById("dobMM").value) > 12))
     {
        errors = errors + stmp + 'Date of Birth: Month must be between 1 and 12';
        stmp = ",\n";
     }
     
     // DOB Day
     if (trim(document.getElementById("dobDD").value) == "")
     {
        errors = errors + stmp + 'Date of Birth: Day is required';
        stmp = ",\n";
     }
     else if (parseInt(document.getElementById("dobDD").value) < 1 || parseInt(document.getElementById("dobDD").value) > 31)
     {
        errors = errors + stmp + 'Date of Birth: Day must be between 1 and 31';
        stmp = ",\n";
     }
 
     // DOB Year
     if (trim(document.getElementById("dobYYYY").value) == "")
     {
        errors = errors + stmp + 'Date of Birth: Year is required';
        stmp = ",\n";
     }
     else if (isNumeric(trim(document.getElementById("dobYYYY").value)) == false)
     {
        errors = errors + stmp + 'Date of Birth: Year must be 4 digits';
        stmp = ",\n";
     }
     else if (document.getElementById("dobYYYY").value.length != 4)
     {
        errors = errors + stmp + 'Date of Birth: Year must be 4 digits';
        stmp = ",\n";
     }

     // objective
     if(document.getElementById("app_objective").options[document.getElementById("app_objective").selectedIndex].value == "1")
     {
        errors = errors + stmp + 'Objective is required';
        stmp = ",\n";
     }

     // annuity type
     if(document.getElementById("app_annuity").options[document.getElementById("app_annuity").selectedIndex].value == "1")
     {
        errors = errors + stmp + 'Annuity Type is required';
        stmp = ",\n";
     }
     
     // investment amount
     if(document.getElementById("app_invest").options[document.getElementById("app_invest").selectedIndex].value == "1")
     {
        errors = errors + stmp + 'Investment Amount is required';
        stmp = ",\n";
     }

     if (errors != "")
     {
        alert("Please correct the following errors on your application: \n\n" + errors);
        return false;
     }
     else
     {
         return true;
     }

}
