
function fillCategory(){ 
 // this function is used to fill the category list on load
addOption(document.form1.Category, "Freehold", "Freehold", "");
addOption(document.form1.Category, "Leasehold", "Leasehold", "");
addOption(document.form1.Category, "Shared Ownership", "Shared Ownership", "");
}

function SelectSubCat(){
// ON selection of category this function will work

removeAllOptions(document.form1.SubCat);
addOption(document.form1.SubCat, "", "SubCat", "");

if(document.form1.Category.value == 'Freehold'){
addOption(document.form1.SubCat,"Credit/Debit Card 351.33", "Credit/Debit Card");
addOption(document.form1.SubCat,"Deferred Payment 393.49", "Deferred Payment");
}
if(document.form1.Category.value == 'Leasehold'){
addOption(document.form1.SubCat,"Credit/Debit Card 410.08", "Credit/Debit Card");
addOption(document.form1.SubCat,"Deferred Payment 459.29", "Deferred Payment");
}
if(document.form1.Category.value == 'Shared Ownership'){
addOption(document.form1.SubCat,"Credit/Debit Card 410.08", "Credit/Debit Card");
addOption(document.form1.SubCat,"Deferred Payment 459.29", "Deferred Payment");
}

}
////////////////// 

function removeAllOptions(selectbox)
{
	var i;
	for(i=selectbox.options.length-1;i>=0;i--)
	{
		//selectbox.options.remove(i);
		selectbox.remove(i);
	}
}


function addOption(selectbox, value, text )
{
	var optn = document.createElement("OPTION");
	optn.text = text;
	optn.value = value;

	selectbox.options.add(optn);
}
