function SelectSubCat(){
// ON selection of category this function will work

removeAllOptions(document.form1.bfrom);
removeAllOptions(document.form1.bto);
addOption(document.form1.bfrom, "", "Any", "");
addOption(document.form1.bto, "", "Any", "");

if(document.form1.usertype.value == 'Buyer' && document.form1.propertytype.value == 'Apartment')
{
	addOption(document.form1.bfrom,"100,000", "100,000");
	addOption(document.form1.bfrom,"200,000", "200,000");
	addOption(document.form1.bfrom,"400,000", "400,000");
	addOption(document.form1.bfrom,"600,000", "600,000");
	addOption(document.form1.bfrom,"800,000", "800,000");
	addOption(document.form1.bfrom,"1,000,000", "1,000,000");

	addOption(document.form1.bto,"200,000", "200,000");
	addOption(document.form1.bto,"400,000", "400,000");
	addOption(document.form1.bto,"600,000", "600,000");
	addOption(document.form1.bto,"800,000", "800,000");
	addOption(document.form1.bto,"1,000,000", "1,000,000");
	addOption(document.form1.bto,"1,200,000+", "1,200,000+");
}
else if(document.form1.usertype.value == 'Buyer' && document.form1.propertytype.value != 'Apartment')
{
	addOption(document.form1.bfrom,"1,000,000", "1,000,000");
	addOption(document.form1.bfrom,"1,200,000", "1,200,000");
	addOption(document.form1.bfrom,"1,400,000", "1,400,000");
	addOption(document.form1.bfrom,"1,600,000", "1,600,000");
	addOption(document.form1.bfrom,"1,800,000", "1,800,000");
	addOption(document.form1.bfrom,"2,000,000+", "2,000,000+");
	
	addOption(document.form1.bto,"1,200,000", "1,200,000");
	addOption(document.form1.bto,"1,400,000", "1,400,000");
	addOption(document.form1.bto,"1,600,000", "1,600,000");
	addOption(document.form1.bto,"1,800,000", "1,800,000");
	addOption(document.form1.bto,"2,000,000", "2,000,000");
	addOption(document.form1.bto,"2,200,000+", "2,200,000+");
}

if(document.form1.usertype.value == 'Renter')
{

addOption(document.form1.bfrom,"40,000", "40,000");
addOption(document.form1.bfrom,"60,000", "60,000");
addOption(document.form1.bfrom,"80,000", "80,000");
addOption(document.form1.bfrom,"100,000", "100,000");
addOption(document.form1.bfrom,"120,000", "120,000");
addOption(document.form1.bfrom,"140,000", "140,000");
addOption(document.form1.bfrom,"160,000", "160,000");
addOption(document.form1.bfrom,"800,000", "800,000");
addOption(document.form1.bfrom,"180,000", "180,000");
addOption(document.form1.bfrom,"200,000+", "200,000+");



addOption(document.form1.bto,"60,000", "60,000");
addOption(document.form1.bto,"80,000", "80,000");
addOption(document.form1.bto,"100,000", "100,000");
addOption(document.form1.bto,"120,000", "120,000");
addOption(document.form1.bto,"140,000", "140,000");
addOption(document.form1.bto,"160,000", "160,000");
addOption(document.form1.bto,"800,000", "800,000");
addOption(document.form1.bto,"180,000", "180,000");
addOption(document.form1.bto,"200,000", "200,000");
addOption(document.form1.bto,"220,000+", "220,000+");
}
}
////////////////// 

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);
}
