
function fillCategory(){ 
 // this function is used to fill the category list on load
addOption(document.drop_list.Category, "1", "India", "");
addOption(document.drop_list.Category, "2", "USA", "");
addOption(document.drop_list.Category, "3", "UK", "");
}

function SelectSubCat(){
// ON selection of category this function will work

removeAllOptions(document.drop_list.SubCat);

if(document.drop_list.Category.value == '1'){
addOption(document.drop_list.SubCat,"1", "Chennai");
addOption(document.drop_list.SubCat,"2", "Mumbai");
addOption(document.drop_list.SubCat,"3", "Delhi");
addOption(document.drop_list.SubCat,"4", "Kolkata");
}
if(document.drop_list.Category.value == '2'){
addOption(document.drop_list.SubCat,"5", "New York");
addOption(document.drop_list.SubCat,"6", "Texas");
addOption(document.drop_list.SubCat,"7", "Mexico", "");
}
if(document.drop_list.Category.value == '3'){
addOption(document.drop_list.SubCat,"8", "London");
addOption(document.drop_list.SubCat,"9", "Liverpool");
addOption(document.drop_list.SubCat,"10", "Manchester");
}

if(document.drop_list.Category.value === '') {
 addOption(document.drop_list.SubCat, "", "Select Your City", "");
}



}
////////////////// 

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);
}

