	function SelectElement(select,which) {
		for (var i = 0; i < select.options.length; i++) {          
			if ( select.options[i].value == which )                    
				select.options[i].selected=true;
		}
	}

	function RadioElement(radio,which) {
		for (var i = 0; i < radio.length; i++) {          
			if ( radio[i].value == which )                    
				radio[i].checked=true;
		}
	}
	function GetRadioElement(radio) {
		for (var i = 0; i < radio.length; i++) {          
			if ( radio[i].checked == true)                    
				return radio[i].value;
		}

		return false;
	}


	function GetSelectValue(select) {
		for (var i = 0; i < select.options.length; i++) {          
			if ( select.options[i].selected == true )                    
				return select.options[i].value;
		}

		return false;
	}

	function EnableDrivers( radio ) {
		var option = GetRadioElement(document.forms["quotes"].Insurance_Type_Requested);

		switch (option){
			case "ITR_Auto":
			case "ITR_Auto_AND_Home":
			case "ITR_Auto_AND_Home_AND_Life":
				//enable disable the cars and drivers numbers.
				document.getElementById("Auto_box").style.display = "inline";
			break;

			case "ITR_Home":
			case "ITR_Life":
				//disable the cars / drivers numbers
				document.getElementById("Auto_box").style.display = "none";
			break;
		
		}		

//		HomeContinue();
	}

	function HomeContinue() { 
		var fields = Array( "Email" , "Home_Phone" , "ZIP"  , "State" , "City" , "Address1" , "Primary_First_Name" , "Primary_Last_Name");
		
		var max_fields = fields.length;
		var error = false;

		for (i = 0 ; i < max_fields ; i++ ){
			if (eval("document.forms['quotes']." + fields[i] + ".value.length") < 2){
				error = true;
			}
		}

		if ((error == false) && !GetRadioElement(document.forms["quotes"].Insurance_Type_Requested))
			error = true;
		

		if ((document.getElementById("Auto_box").style.display == "inline")) {
			if (document.forms["quotes"].Insurance_drivers.value == "")
				error = true;


			if (document.forms["quotes"].Insurance_cars.value == "")
				error = true;
		}

		if (error == false){
				document.getElementById("button_continue_disabled").style.display = "none";
				document.getElementById("button_continue_enabled").style.display = "inline";
		} else {
				document.getElementById("button_continue_disabled").style.display = "inline";
				document.getElementById("button_continue_enabled").style.display = "none";
		}


		setTimeout("HomeContinue()", 100);

	}


	function CorrectName() {
		var check = GetRadioElement(document.forms['quotes'].Confirm_Primary_Homeowner);

		switch (check){
			case "No":
				document.getElementById("NameCorrectText").style.display = "none";
				document.getElementById("NameCorrectInput").style.display = "inline";
			break;

			case "Yes":
				document.getElementById("NameCorrectText").style.display = "inline";
				document.getElementById("NameCorrectInput").style.display = "none";
			break;
		
		}
	}


	function CorrectAddress() {
		var check = GetRadioElement(document.forms['quotes'].Confirm_Property_Address);

		switch (check){
			case "No":
//				document.getElementById("AddressCorrectText").style.display = "none";
				document.getElementById("AddressCorrectInput").style.display = "inline";
			break;

			case "Yes":
//				document.getElementById("AddressCorrectText").style.display = "inline";
				document.getElementById("AddressCorrectInput").style.display = "none";
			break;
		
		}
	}

	function CorrectMailing() {
		var check = GetRadioElement(document.forms['quotes'].Confirm_Mailing_Address);

		switch (check){
			case "No":
				document.getElementById("MailCorrectInput").style.display = "inline";
			break;

			case "Yes":
				document.getElementById("MailCorrectInput").style.display = "none";
			break;
		
		}
	}