function EnabledInsured(bDisabled)
{

	// Name of the Carrier
	document.getElementById("proinfoN_carrier").disabled = bDisabled;

	// Expiration Month
	document.getElementById("proinfoN_expdateMM").disabled = bDisabled;
	 
	// Expiration Day
	document.getElementById("proinfoN_expdateDD").disabled = bDisabled;

	// Expiration Year
	document.getElementById("proinfoN_expdateYYYY").disabled = bDisabled;

	// Deductible
	document.getElementById("proinfoN_deductible").disabled = bDisabled;            
	
}

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";
         }
     }
     
     // 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";
     }

     // credit history
     if(document.getElementById("app_credhistory").options[document.getElementById("app_credhistory").selectedIndex].value == "-1")
     {
        errors = errors + stmp + 'Credit History is required';
        stmp = ",\n";
     }

     // Residence Ownership
     if(document.getElementById("app_residence").options[document.getElementById("app_residence").selectedIndex].value == "-1")
     {
        errors = errors + stmp + 'Residence Ownership is required';
        stmp = ",\n";
     }

     // Years In Current Residence
     if(document.getElementById("app_residenceyr").options[document.getElementById("app_residenceyr").selectedIndex].value == "-1")
     {
        errors = errors + stmp + 'Years In Current Residence is required';
        stmp = ",\n";
     }

     // Type of Property to be Insured
     if(document.getElementById("proN_instype").options[document.getElementById("proN_instype").selectedIndex].value == "-1")
     {
        errors = errors + stmp + 'Type of Property is required';
        stmp = ",\n";
     }

     // Number of Stories
     if(document.getElementById("proN_stories").options[document.getElementById("proN_stories").selectedIndex].value == "-1")
     {
        errors = errors + stmp + 'Number of Stories is required';
        stmp = ",\n";
     }
     
     // Foundation Type
     if(document.getElementById("proN_foundation").options[document.getElementById("proN_foundation").selectedIndex].value == "-1")
     {
        errors = errors + stmp + 'Foundation Type is required';
        stmp = ",\n";
     }
     
     // Roof Type
     if(document.getElementById("proN_roof").options[document.getElementById("proN_roof").selectedIndex].value == "-1")
     {
        errors = errors + stmp + 'Roof Type is required';
        stmp = ",\n";
     }
      
     // Exterior Components
     if(document.getElementById("proN_exterior").options[document.getElementById("proN_exterior").selectedIndex].value == "-1")
     {
        errors = errors + stmp + 'Exterior Components are required';
        stmp = ",\n";
     }

     // Security Device
     if(document.getElementById("proN_security").options[document.getElementById("proN_security").selectedIndex].value == "-1")
     {
        errors = errors + stmp + 'Security Device are required';
        stmp = ",\n";
     }
          
     // Currently Insured?:
     if (document.getElementById("proN_curinsuredY").checked == true)
     {
     
         // Name of the Carrier
         if (trim(document.getElementById("proinfoN_carrier").value) == "")
         {
            errors = errors + stmp + 'Name of the Carrier is required';
            stmp = ",\n";
         }

         // Expiration Month
         if (trim(document.getElementById("proinfoN_expdateMM").value) == "")
         {
            errors = errors + stmp + 'Expiration Date: Month is required';
            stmp = ",\n";
         }
         else if ((parseInt(document.getElementById("proinfoN_expdateMM").value) < 1) || (parseInt(document.getElementById("proinfoN_expdateMM").value) > 12))
         {
            errors = errors + stmp + 'Expiration Date: Month must be between 1 and 12';
            stmp = ",\n";
         }
         
         // Expiration Day
         if (trim(document.getElementById("proinfoN_expdateDD").value) == "")
         {
            errors = errors + stmp + 'Expiration Date: Day is required';
            stmp = ",\n";
         }
         else if (parseInt(document.getElementById("proinfoN_expdateDD").value) < 1 || parseInt(document.getElementById("proinfoN_expdateDD").value) > 31)
         {
            errors = errors + stmp + 'Expiration Date: Day must be between 1 and 31';
            stmp = ",\n";
         }
     
         // Expiration Year
         if (trim(document.getElementById("proinfoN_expdateYYYY").value) == "")
         {
            errors = errors + stmp + 'Expiration Date: Year is required';
            stmp = ",\n";
         }
         else if (isNumeric(trim(document.getElementById("proinfoN_expdateYYYY").value)) == false)
         {
            errors = errors + stmp + 'Expiration Date: Year must be 4 digits';
            stmp = ",\n";
         }
         else if (document.getElementById("proinfoN_expdateYYYY").value.length != 4)
         {
            errors = errors + stmp + 'Expiration Date: Year must be 4 digits';
            stmp = ",\n";
         }
                       
     }
     
     // Deductible
     if(document.getElementById("proinfoN_deductible").options[document.getElementById("proinfoN_deductible").selectedIndex].value == "-1")
     {
        errors = errors + stmp + 'Deductible are required';
        stmp = ",\n";
     }
         
     // Number of Bedrooms
     if(document.getElementById("proacN_bed").options[document.getElementById("proacN_bed").selectedIndex].value == "0")
     {
        errors = errors + stmp + 'Number of Bedrooms are required';
        stmp = ",\n";
     }

     // Number of Bathrooms
     if(document.getElementById("proacN_bath").options[document.getElementById("proacN_bath").selectedIndex].value == "0")
     {
        errors = errors + stmp + 'Number of Bathrooms are required';
        stmp = ",\n";
     }
     
    // Year Built
    if (trim(document.getElementById("proacN_yearbuilt").value) == "")
    {
        errors = errors + stmp + 'Year Built is required';
        stmp = ",\n";
    } 
     
    // Size of Property in Square Foot 
    if (trim(document.getElementById("proacN_foot").value) == "")
    {
        errors = errors + stmp + 'Size of Property is required';
        stmp = ",\n";
    }  
    
    // Value of Personal Belongings 
    if ((trim(document.getElementById("proacN_propvalue").value) == "") || (trim(document.getElementById("proacN_propvalue").value) == "$0"))
    {
        errors = errors + stmp + 'Value of Personal Belongings is required';
        stmp = ",\n";
    }  
 
    // Dwelling Value 
    if ((trim(document.getElementById("proacN_dwelvalue").value) == "") || (trim(document.getElementById("proacN_dwelvalue").value) == "$0"))
    {
        errors = errors + stmp + 'Dwelling Value is required';
        stmp = ",\n";
    }     
          
     if (errors != "")
     {
        alert("Please correct the following errors on your application: \n\n" + errors);
        return false;
     }
     else
     {
         return true;
     }

}

function ini_year()
{
	var today = new Date();
	var curyear = today.getFullYear();
	var box = document.getElementById('claimN_yr');
	var i,listyear;
	var j = 0;
	for(i=1901;i < (curyear+2); i++){
		listyear = i;
		box.options[j] = new Option(listyear,listyear);
		j++;
	}
}