<!--
//var newInsuranceType = null;

allFormElementsArray = new Array();
allFormElementsArray.push(['New_VentureLI',['New_Venture','','R']]);
allFormElementsArray.push(['Current_Household_PolicyLI',['Current_Household_Policy','','R']]);
allFormElementsArray.push(['Current_Family_Fleet_PolicyLI',['Current_Family_Fleet_Policy','','R']]);
allFormElementsArray.push(['Contact_NameLI',['Contact_Name','','R']]);
allFormElementsArray.push(['Business_NameLI',['Business_Name','','R']]);
allFormElementsArray.push(['Type_of_BusinessLI',['Type_of_Business','','R']]);
allFormElementsArray.push(['Liability_RequiredLI',['Liability_Required','','R']]);
allFormElementsArray.push(['Type_Of_PropertyLI', ['Type_Of_Property','','R']]);
allFormElementsArray.push(['Number_of_PropertiesLI', ['Number_of_Properties','','R']]);
allFormElementsArray.push(['Address1LI', ['Address1','','R']]);
allFormElementsArray.push(['Address2LI']);
allFormElementsArray.push(['TownLI', ['Town','','R']]);
allFormElementsArray.push(['CountyLI']);
allFormElementsArray.push(['Post_CodeLI', ['Post_Code','','R']]);
allFormElementsArray.push(['TelephoneLI', ['Telephone','','R']]);
allFormElementsArray.push(['MobileLI']);
allFormElementsArray.push(['EmailLI',['Email','','RisEmail']]);
allFormElementsArray.push(['Current_PremiumLI']);
allFormElementsArray.push(['Number_of_VehiclesLI']);
allFormElementsArray.push(['Renewal_DateLI']);
allFormElementsArray.push(['Current_InsurerLI']);
allFormElementsArray.push(['Dates_of_TravelLI', ['Dates_of_Travel','','R']]);
allFormElementsArray.push(['Country_of_TravelLI', ['Country_of_Travel','','R']]);
allFormElementsArray.push(['Age_of_TravellerLI', ['Age_of_Traveller','','R']]);
allFormElementsArray.push(['Travel_Insurance_TypeLI', ['Travel_Insurance_Type','','R']]);
allFormElementsArray.push(['Additional_CommentsLI']);
allFormElementsArray.push(['Your_EnquiryLI']);

var defaultFormElementsArray = ['Contact_NameLI', 'TelephoneLI', 'EmailLI'];

var formStructureArray = new Array();
formStructureArray.push(['general', 'Your_EnquiryLI']);
formStructureArray.push(['Household', 'Current_Household_PolicyLI', 'Type_Of_PropertyLI', 'Address1LI', 'Address2LI', 'TownLI', 'CountyLI', 'Post_CodeLI', 'MobileLI', 'Current_PremiumLI',  'Renewal_DateLI', 'Current_InsurerLI', 'Additional_CommentsLI']);
formStructureArray.push(['Travel', 'Address1LI', 'Address2LI', 'TownLI', 'CountyLI', 'Post_CodeLI', 'MobileLI', 'Dates_of_TravelLI',  'Country_of_TravelLI', 'Age_of_TravellerLI', 'Travel_Insurance_TypeLI', 'Additional_CommentsLI']);
formStructureArray.push(['Family Fleet', 'Business_NameLI', 'Address1LI', 'Address2LI', 'TownLI', 'CountyLI', 'Post_CodeLI', 'MobileLI','Current_Family_Fleet_PolicyLI', 'Current_PremiumLI', 'Number_of_VehiclesLI', 'Renewal_DateLI', 'Current_InsurerLI', 'Additional_CommentsLI']);
formStructureArray.push(['Food & Take-Away', 'New_VentureLI', 'Business_NameLI', 'Type_of_BusinessLI', 'Address1LI', 'Address2LI', 'TownLI', 'CountyLI', 'Post_CodeLI', 'MobileLI', 'Current_PremiumLI', 'Renewal_DateLI', 'Current_InsurerLI', 'Additional_CommentsLI']);
formStructureArray.push(['Restaurant', 'New_VentureLI', 'Business_NameLI', 'Type_of_BusinessLI', 'Address1LI', 'Address2LI', 'TownLI', 'CountyLI', 'Post_CodeLI', 'MobileLI', 'Current_PremiumLI', 'Renewal_DateLI', 'Current_InsurerLI', 'Additional_CommentsLI']);
formStructureArray.push(['Shop', 'New_VentureLI', 'Business_NameLI', 'Type_of_BusinessLI', 'Address1LI', 'Address2LI', 'TownLI', 'CountyLI', 'Post_CodeLI', 'MobileLI', 'Current_PremiumLI', 'Renewal_DateLI', 'Current_InsurerLI', 'Additional_CommentsLI']);
formStructureArray.push(['Pub & Nightclub', 'New_VentureLI', 'Business_NameLI', 'Type_of_BusinessLI', 'Address1LI', 'Address2LI', 'TownLI', 'CountyLI', 'Post_CodeLI', 'MobileLI', 'Current_PremiumLI', 'Renewal_DateLI', 'Current_InsurerLI', 'Additional_CommentsLI']);
formStructureArray.push(['Landlords', 'Business_NameLI', 'Type_Of_PropertyLI', 'Number_of_PropertiesLI', 'Address1LI', 'Address2LI', 'TownLI', 'CountyLI', 'Post_CodeLI', 'MobileLI', 'Current_PremiumLI',  'Renewal_DateLI', 'Current_InsurerLI', 'Additional_CommentsLI']);
formStructureArray.push(['Taxi Minibus & Coach', 'New_VentureLI', 'Business_NameLI', 'Address1LI', 'Address2LI', 'TownLI', 'CountyLI', 'Post_CodeLI', 'MobileLI', 'Current_PremiumLI', 'Number_of_VehiclesLI', 'Renewal_DateLI', 'Current_InsurerLI', 'Additional_CommentsLI']);
formStructureArray.push(['Motor Trade', 'New_VentureLI', 'Business_NameLI', 'Type_of_BusinessLI', 'Address1LI', 'Address2LI', 'TownLI', 'CountyLI', 'Post_CodeLI', 'MobileLI', 'Current_PremiumLI', 'Renewal_DateLI', 'Current_InsurerLI', 'Additional_CommentsLI']);
formStructureArray.push(['Commercial Vehicle (Fleet)', 'New_VentureLI', 'Business_NameLI', 'Address1LI', 'Address2LI', 'TownLI', 'CountyLI', 'Post_CodeLI', 'MobileLI', 'Current_PremiumLI', 'Number_of_VehiclesLI', 'Renewal_DateLI', 'Current_InsurerLI', 'Additional_CommentsLI']);
formStructureArray.push(['Commercial Vehicle (Individual)', 'New_VentureLI', 'Business_NameLI', 'Address1LI', 'Address2LI', 'TownLI', 'CountyLI', 'Post_CodeLI', 'MobileLI', 'Current_PremiumLI', 'Number_of_VehiclesLI', 'Renewal_DateLI', 'Current_InsurerLI', 'Additional_CommentsLI']);
formStructureArray.push(['Commercial Combined', 'New_VentureLI', 'Business_NameLI', 'Type_of_BusinessLI', 'Address1LI', 'Address2LI', 'TownLI', 'CountyLI', 'Post_CodeLI', 'MobileLI', 'Current_PremiumLI', 'Renewal_DateLI', 'Current_InsurerLI', 'Additional_CommentsLI']);
formStructureArray.push(['Liability', 'Business_NameLI', 'Type_of_BusinessLI', 'Liability_RequiredLI', 'Address1LI', 'Address2LI', 'TownLI', 'CountyLI', 'Post_CodeLI', 'MobileLI', 'Current_PremiumLI', 'Renewal_DateLI', 'Current_InsurerLI', 'Additional_CommentsLI']);

var currentValidationArray

function getInsuranceType(){
	function getValue( name ){  
		name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");  
		var regexS = "[\\?&]"+name+"=([^#]*)";  
		var regex = new RegExp( regexS );  
		var results = regex.exec( window.location.href );  
		if( results == null )    return "";  else    return unescape(results[1]);
	}
	
	function setIt(val)
	{
		var InsuranceTypeList = document.getElementById("Insurance_Type");
		//alert(InsuranceTypeList[i].value);
		for( var i=0, limit=InsuranceTypeList.length; i < limit; ++i )
		{
			if( InsuranceTypeList[i].value==val ){
				
				InsuranceTypeList[i].selected=true;
			}
		}
	}

	var newInsuranceType = getValue('newInsuranceType');

	if (newInsuranceType == "") newInsuranceType = 'general';
    setIt(newInsuranceType);
	
	initForm(newInsuranceType);
}

function initForm(newInsuranceType){
	var currentFormElementsArray = defaultFormElementsArray;
	currentValidationArray = new Array;
	
	function show(elementID){
		document.getElementById(elementID).style.display = 'block';
		}
	function hide(elementID){document.getElementById(elementID).style.display = 'none';}
	
	for(var i = 0; i < formStructureArray.length; i ++) {
		if (formStructureArray[i][0] == newInsuranceType) {
			
			currentFormElementsArray = currentFormElementsArray.concat(formStructureArray[i].slice(1, formStructureArray[i].length));
			break;
		}
	}

	var isHidden;

	//alert(allFormElementsArray);
	for(var i = 0; i < allFormElementsArray.length; i++) {
		isHidden = true;
		for(var j = 0; j < currentFormElementsArray.length; j++) {
			if (allFormElementsArray[i][0] == currentFormElementsArray[j]) isHidden = false;
				
		}

		if (isHidden) hide(allFormElementsArray[i][0]);
		else {
			show(allFormElementsArray[i][0]);
			if (allFormElementsArray[i][1] != undefined) currentValidationArray = currentValidationArray.concat(allFormElementsArray[i][1]);
		}
	}
	
	
}

//-->
addLoadEvent(getInsuranceType); 