
function fillCategory()
{ 
 // this function is used to fill the category list on load 
addOption(document.form1.Category, "Select Category,NA@seejobs.org", "Select Category", "");
addOption(document.form1.Category, "Admin/Secretarial,reshma@seejobs.org", "Admin/Secretarial", "");
addOption(document.form1.Category, "HR,reshma@seejobs.org", "HR", "");
addOption(document.form1.Category, "Engineering,reshma@seejobs.org", "Engineering", "");
addOption(document.form1.Category, "Finance,reshma@seejobs.org", "Finance", "");
addOption(document.form1.Category, "Marketing,reshma@seejobs.org", "Marketing", "");
addOption(document.form1.Category, "Sales,reshma@seejobs.org", "Sales", "");
addOption(document.form1.Category, "IT,reshma@seejobs.org", "IT", "");
addOption(document.form1.Category, "Accounts,reshma@seejobs.org", "Accounts", "");
addOption(document.form1.Category, "Internal,reshma@seejobs.org", "Internal", "");
addOption(document.form1.Category, "Others,reshma@seejobs.org", "Others", "");

SelectSubCat();
}

function SelectSubCat()
{
try
{
	// ON selection of category this function will work	
	document.getElementById('RecieverEmailID').value =	document.form1.Category.value.split(",")[1];
	
	document.getElementById('SelectedCategory').value = document.form1.Category.value;
		
	removeAllOptions(document.form1.Subcategory);
	
	addOption(document.form1.Subcategory, "", "Select SubCategory", "");	
	
	// Admin/Secretarial
	if(document.form1.Category.value.split(",")[0] == 'Admin/Secretarial')
	{
		addOption(document.form1.Subcategory,"Admin Asstt", "Admin Asstt");
		addOption(document.form1.Subcategory,"Admn. Executive", "Admn. Executive");
		addOption(document.form1.Subcategory,"Admn Officer", "Admn Officer");
		addOption(document.form1.Subcategory,"Receptionist", "Receptionist");
		addOption(document.form1.Subcategory,"Secretary", "Secretary");
		addOption(document.form1.Subcategory,"Executive Secretary", "Executive Secretary");
		addOption(document.form1.Subcategory,"Office Manager", "Office Manager");
	}
	
	//sales
	if(document.form1.Category.value.split(",")[0] == 'Sales')
	{
		addOption(document.form1.Subcategory,"Sales Executive", "Sales Executive");
		addOption(document.form1.Subcategory,"Sales Co-ordinator", "Sales Co-ordinator");
		addOption(document.form1.Subcategory,"Sales Officer", "Sales Officer");
		addOption(document.form1.Subcategory,"Sales Manager", "Sales Manager");
		addOption(document.form1.Subcategory,"Sr. Sales Manager", "Sr. Sales Manager");
		addOption(document.form1.Subcategory,"Head-Sales", "Head-Sales");
		}
		
		//Engineering
		if(document.form1.Category.value.split(",")[0] == 'Engineering')
	{
		addOption(document.form1.Subcategory,"Civil Engineer", "Civil Engineer");
		addOption(document.form1.Subcategory,"Electrical Engineer", "Electrical Engineer");
		addOption(document.form1.Subcategory,"Structural Engineer", "Structural Engineer");
		addOption(document.form1.Subcategory,"Mechanical Engineer", "Mechanical Engineer");
		addOption(document.form1.Subcategory,"Project Engineer", "Project Engineer");
		addOption(document.form1.Subcategory,"IT Engineer", "IT Engineer");
		addOption(document.form1.Subcategory,"Quantity Surveyor", "Quantity Surveyor");
		addOption(document.form1.Subcategory,"Production Engineer", "Production Engineer");
		addOption(document.form1.Subcategory,"Auto CAD operator", "Auto CAD operator");
		addOption(document.form1.Subcategory,"Draughtsman", "Draughtsman");
		addOption(document.form1.Subcategory,"Site Secretary", "Site Secretary");
		addOption(document.form1.Subcategory,"Document Controller", "Document Controller");
		addOption(document.form1.Subcategory,"Planning Engineer", "Planning Engineer");
		addOption(document.form1.Subcategory,"Land Surveyor", "Land Surveyor");
		addOption(document.form1.Subcategory,"MEP Co-ordinator", "MEP Co-ordinator");
		addOption(document.form1.Subcategory,"HSE Officer/Manager", "HSE Officer/Manager");
		}
		
	//HR 
	if(document.form1.Category.value.split(",")[0] == 'HR')
	{
		addOption(document.form1.Subcategory,"HR Executive", "HR Executive");
		addOption(document.form1.Subcategory,"HR Co-ordinator", "HR Co-ordinator");
		addOption(document.form1.Subcategory,"HR Officer", "HR Officer");
		addOption(document.form1.Subcategory,"HR Manager", "HR Manager");
		addOption(document.form1.Subcategory,"Head-HR", "Head-HR");
		addOption(document.form1.Subcategory,"Recruitment Officer", "Recruitment Officer");
		addOption(document.form1.Subcategory,"Recruitment Executive", "Recruitment Executive");
		addOption(document.form1.Subcategory,"Recruitment Manager", "Recruitment Manager");
	}
	//Finance 
	if(document.form1.Category.value.split(",")[0]  == 'Finance')
	{
		addOption(document.form1.Subcategory,"Finance Executive", "Finance Executive");
		addOption(document.form1.Subcategory,"Finance Officer/Manager", "Finance Officer/Manager");
		addOption(document.form1.Subcategory,"Financial Controller", "Financial Controller", "");
		addOption(document.form1.Subcategory,"VP-Finance", "VP-Finance", "");
		addOption(document.form1.Subcategory,"CFO", "CFO", "");
		addOption(document.form1.Subcategory,"Financial Analyst", "Financial Analyst", "");
		addOption(document.form1.Subcategory,"Investment Analyst/Manager", "Investment Analyst/Manager", "");
		addOption(document.form1.Subcategory,"Budgeting Officer/Manager", "Budgeting Officer/Manager", "");
	}
	
	//Marketing
	if(document.form1.Category.value.split(",")[0]  == 'Marketing')
	{
		addOption(document.form1.Subcategory,"Marketing Executive", "Marketing Executive");
		addOption(document.form1.Subcategory,"Marketing Co-ordinator", "Marketing Co-ordinator");
		addOption(document.form1.Subcategory,"Marketing Officer", "Marketing Officer");
		addOption(document.form1.Subcategory,"Marketing Manager", "Marketing Manager");
		addOption(document.form1.Subcategory,"Head-Marketing", "Head-Marketing");
	}
	
	//Accounts
	if(document.form1.Category.value.split(",")[0]  == 'Accounts')
	{
		addOption(document.form1.Subcategory,"Accounts Executive", "Accounts Executive");
		addOption(document.form1.Subcategory,"Junior/Senior Accountant", "Junior/Senior Accountant");
		addOption(document.form1.Subcategory,"Management Accountant", "Management Accountant");
		addOption(document.form1.Subcategory,"Auditor", "Auditor");
		addOption(document.form1.Subcategory,"Accounts Officer/Manager", "Accounts Officer/Manager");
		addOption(document.form1.Subcategory,"Commercial Manager", "Commercial Manager");
	}
	
	//IT 
	if(document.form1.Category.value.split(",")[0] == 'IT')
	{
		addOption(document.form1.Subcategory,"IT Admn support", "IT Admn support");
		addOption(document.form1.Subcategory,"IT sales", "IT sales");
		addOption(document.form1.Subcategory,"IT-Business Development", "IT-Business Development");
		addOption(document.form1.Subcategory,"IT-Programming", "IT-Programming");
		addOption(document.form1.Subcategory,"IT Officer", "IT Officer");
	}
	
	//internal
	if(document.form1.Category.value.split(",")[0] == 'Internal')
	{
		addOption(document.form1.Subcategory,"Please Specify down", "Please Specify down");
		
	}
	//Others 
	if(document.form1.Category.value.split(",")[0] == 'Others')
	{
		addOption(document.form1.Subcategory,"Others", "Others");
		
	}
	
	} catch(err){alert(err.description);}
}

////////////////// 
function SubCategoryChanged()
{
	document.getElementById('SelectedSubCategory').value = document.form1.Subcategory.value;
}

function removeAllOptions(selectbox)
{
	var i;
	for(i=selectbox.options.length-1;i>=0;i--)
	{
		//selectbox.options.remove(i);
		selectbox.remove(i);
	}
	//Aliter
	//selectbox.options.length = 0 
}


function addOption(selectbox, value, text )
{
	var optn = document.createElement("OPTION");
	optn.text = text;
	optn.value = value;
	selectbox.options.add(optn);
}
