var store = new Array();

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

store[1] = new Array(
        'Please Select','',
        'Tradesmen / Construction','/dorfq/imp_tradesmen/1.htm',
        'Home Based Professional','/dorfq/imp_tradesmen/1.htm',
        'Office &amp; Surgery','/dorfq/imp_tradesmen/1.htm',
	'Shop &amp; Retail','/dorfq/imp_shop/1.htm',
	'Hair &amp; Beauty','/dorfq/imp_tradesmen/1.htm',
	'Pubs and Restaurant','/dorfq/imp_shop/1.htm',
	'Motor Traders','/dorfq/imp_tradesmen/1.htm',
	'Manufacturers &amp; Printers','/dorfq/imp_tradesmen/1.htm',
        'Charity &amp; Voluntary', '/dorfq/imp_tradesmen/1.htm'
);
store[2] = new Array(
        'Landlords','/dorfq/imp_landlords/1.htm'
        );
store[3] = new Array(
        'Professional Indemnity','/dorfq/imp_tradesmen/1.htm'
        )
store[4] = new Array(
        'Van','/dorfq/imp_commercial_vehicle/1.htm'
        )



function populate(formId){

    var formName = document.getElementById(formId);
    var box = formName.yourNeeds;
	var number = box.selectedIndex;
    if (number > 1){
        formName.chooseProduct.disabled = true;

    }
    else{
        formName.chooseProduct.disabled = false;
    }
    var list = store[number];
        var box2 = formName.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(){
    for (var i = 0; i < document.forms.length; i++){
        populate(document.forms[i].id);
    }
}

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

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