
function fillCategory(){ 
 /* this function is used to fill the category list on load
addOption(document.drop_list.Category, "Fruits", "Fruits", "");
addOption(document.drop_list.Category, "Games", "Games", "");
addOption(document.drop_list.Category, "Scripts", "Scripts", "");*/
}

function SelectSubCat(){
// ON selection of category this function will work

	removeAllOptions(document.drop_list.SubCat);
	addOption(document.drop_list.SubCat, "", "Please select your occupation", "");
	
	if (document.drop_list.Category.value == 'Healthcare Professional') {
		addOption(document.drop_list.SubCat,'Consultant', 'Consultant');
		addOption(document.drop_list.SubCat,'Doctor', 'Doctor');
		addOption(document.drop_list.SubCat,'Dietitian', 'Dietitian');
		addOption(document.drop_list.SubCat,'Nurse', 'Nurse');
		addOption(document.drop_list.SubCat,'Pharmacist', 'Pharmacist');
		addOption(document.drop_list.SubCat,'Speech and Language Therapist', 'Speech and Language Therapist');
		addOption(document.drop_list.SubCat,'Other', 'Other');
	}
	if (document.drop_list.Category.value == 'Academic') {
		addOption(document.drop_list.SubCat,'University', 'University');
		addOption(document.drop_list.SubCat,'Other', 'Other');
	}
	if (document.drop_list.Category.value == 'Student') {
		addOption(document.drop_list.SubCat,'Medical', 'Medical');
		addOption(document.drop_list.SubCat,'Nutrition', 'Nutrition');
		addOption(document.drop_list.SubCat,'Nursing', 'Nursing');
		addOption(document.drop_list.SubCat,'Dietitian', 'Dietitian');
	}

}
////////////////// 

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);
}
