var store = new Array();

store[0] = new Array(
        'Please Select Your Needs',''
        );

store[1] = new Array(
        'Please Select','',
    'Factoring','/factoring/index.html',
	'Invoice Discounting','/factoring/index.html',
	'Commercial mortgages','/dorfq/lfm_commercialmortgages/1.htm',
	'Buy to Let Mortgages','/dorfq/lfm_buytoletmortgages/1.htm',
	'Asset Finance','/assetfinance/index.htm',
	'Trade Finance','/tradefinance/index.htm',
	'Credit Cards','//content/business_credit_cards/index.htm'
);

store[2] = new Array(
        'Please Select', '',
    'Business Insurance','/insurance/',
	'Landlords','/dorfq/imp_landlords/1.htm',
	'Professional Indemnity','/dorfq/imp_tradesmen/1.htm',
	'Van','/dorfq/imp_commercial_vehicle/1.htm',
	'Personal Insurance','/landing/personal-insurance/'
);



function populate(){
	var box = document.productSelector.yourNeeds;
	var number = box.selectedIndex;
	var list = store[number];
	var box2 = document.productSelector.chooseProduct;
	box2.options.length = 0;
	for(var i=0;i<list.length;i+=2){
		box2.options[i/2] = new Option(list[i],list[i+1]);
	}
}
function init(){
    populate();
}

function onChangeRedirect(){
	var formName = document.productSelector
	go();
	formName.submit();
}

function go(){
	var box = document.productSelector.chooseProduct;
	var address = box.options[box.selectedIndex].value;
    if (address != '') {
        document.productSelector.action = address;
        return true;
	}
    else{
        return false;
    }
}
