<!--
function onSalaryTypeChange(obj)
{		
	
	var salary_type = obj.options[obj.selectedIndex].value;	
	if (salary_type != "annual" && salary_type != "hourly") return;
	
	var objMin = document.getElementById('cmbMinSalary');
	var objMax = document.getElementById('cmbMaxSalary');	
	
	var length = 0;
	if (objMin) length = objMin.options.length;
	if (objMax) length = objMax.options.length;
	
	removeAllNodes(objMin);
	removeAllNodes(objMax);

	if (objMin) populate_salary(salary_type, objMin, null, "Please Select");	// 0 -> minimum text
	if (objMax) populate_salary(salary_type, objMax, null, "Please Select");	// 1 -> maximum text		
}


	
function populate_salary(salary_type, objSelect, selected_salary, defaul_selected_text)
{		
	
	var min_salary = null;
	var max_salary = null;
	var salary_steps_rate = null;
	var step_rate = 1;
	var col_salaries = new Array();
	var disabled_cents = false;
	
	if (!salary_type) salary_type = "annual";
	if (salary_type.trim().length == 0) salary_type = "annual";
	 
	if (salary_type == "annual")
	{
		min_salary = 8000;
		max_salary = 150000;
		col_salaries[0] = new Array(500, 50000);	// steps to increament , do steps until, 
		col_salaries[1] = new Array(1000, max_salary)
		disabled_cents = false;
	}
	
	else if (salary_type == "hourly")
	{
		min_salary = 5;
		max_salary = 95;
		col_salaries[0] = new Array(1, 20);	// steps to increament , do steps until, 
		col_salaries[1] = new Array(2, 60);
		col_salaries[2] = new Array(5, max_salary);		
		disabled_cents = true;
	}
	
	if (defaul_selected_text)
	{
		objSelect.options[objSelect.options.length] = new Option(defaul_selected_text,"NA");
	}	

	objSelect.options[objSelect.options.length] = 
		(selected_salary == 0) ? new Option("Negotiable",0, false, true) : new Option("Negotiable",0)

	var index = 0;
	var selected = false;
	for (salary = min_salary; salary <= max_salary; salary += step_rate)
	{										
		var selected = (salary == selected_salary) ? true : false;
		salary_text = "" + salary;		
		salary_text = salary_text.formatCurrency(disabled_cents);	
		objSelect.options[objSelect.options.length] = 
			(selected == true) ? new Option(salary_text, salary, false, true) : new Option(salary_text, salary);
		if (col_salaries[index])
		{
			step_rate = col_salaries[index][0];		
			max_rate = col_salaries[index][1];
			if (max_rate <= salary)
			{				
				index++;
				if (col_salaries[index])
				{
					step_rate = col_salaries[index][0];
					max_rate = col_salaries[index][1];				
				}
			}
		}		
	}	
	
}


function populate_experience(selectedItemValue)
{
	var experience = new Array()	
	experience[0] = new KeyValue("No experience necessary", "0");
	experience[1] = new KeyValue("1 year or less", "1");
	experience[2] = new KeyValue("2 years or less", "2");
	experience[3] = new KeyValue("2-5 years", "3");
	experience[4] = new KeyValue("5+ years", "4");
	for (i = 0; i < experience.length; i++)
	{
		if (experience[i].Value == selectedItemValue)
		{
			document.write ("<option selected='selected' value='"+ experience[i].Value +"'>"+ experience[i].Name +"</option>");
		}
		else
		{
			document.write ("<option value='"+ experience[i].Value +"'>"+ experience[i].Name +"</option>");
		}
	}	
}

function populate_counting(min_value, max_value, steps, selected_item_value)
{
	if (!steps) steps = 1;
	if (!selected_item_value) selected_item_value = -1;
	for (i=min_value; i<=max_value; i+=steps)
	{
		if (i == selected_item_value)
		{
			document.write ("<option selected='selected' value='"+ i +"'>"+ i +"</option>");
		}
		else
		{
			document.write ("<option value='"+ i +"'>"+ i +"</option>");
		}
	}	
}

function get_contract_types(selectedType)
{
	var contracts = new Array(6);
	contracts[0] = "Permanent";
	contracts[1] = "Contract";
	contracts[2] = "Temporary";
	contracts[3] = "Part-Time";
	contracts[4] = "Locum";
	contracts[5] = "Voluntary";	
	for (var index=0; index < contracts.length; index++)
	{
		if (selectedType == contracts[index])
		{
			document.write ("<option selected=\"selected\" value=\""+ contracts[index] +"\">"+ contracts[index] +"</option>");
		}
		else
		{
			document.write ("<option value=\""+ contracts[index] +"\">"+ contracts[index] +"</option>");
		}
	}
}


/*

*/
var objRequest = getXMLHTTPRequest();
function getServerData(objJobSector, objSpeciality, objGrade, path, idSpecialityText, idGradeText)
{	
	var time = new Date().getTime();
	var id = objJobSector.options[objJobSector.selectedIndex].value;			// id for loading values
	var url = path + "process/ajax_process.php?id=" + id + "&t=" + time;
	objRequest.open ("GET", url, true);
	objRequest.onreadystatechange = function() 
	{
		handleResponse(objSpeciality, objGrade, idSpecialityText, idGradeText);
	};
	objRequest.send(null);
}


function handleResponse(objSpeciality, objGrade, idSpecialityText, idGradeText, show_load_img)
{	
	if (objRequest.readyState == 4)		
	{
		if (objRequest.status == 200)	// when processing is done and no error
		{			
			// pre conditions
			// enable form controls
			if (objSpeciality) objSpeciality.disabled = false;
			if (objGrade) objGrade.disabled = false;
			if (document.getElementById("cmdSubmit")) document.getElementById("cmdSubmit").disabled = false;
			
			// clearing all previous options form select
			removeAllNodes(objSpeciality);
			removeAllNodes(objGrade);
			
			var speciality_disabled = false;
			var grade_disabled = false;
			var xmlDoc = objRequest.responseXML.documentElement;
			
			// reading response xml file and load into list for speciality
			//------------------------------------------------------------
			var specialityNodes = xmlDoc.getElementsByTagName("speciality");
			for (var i=0; i < specialityNodes.length; i++)
			{
				var spText = specialityNodes[i].childNodes[0].nodeValue;
				var spValue = specialityNodes[i].getAttribute("value");								
				
				if (spValue == "-1")
				{				
					speciality_disabled = true;
					objSpeciality.options[objSpeciality.options.length] = new Option(spText, spValue);
				}
				else
				{
					objSpeciality.options[objSpeciality.options.length] = 
						(spValue == idSpecialityText) ? new Option(spText, spValue, true, true) : new Option(spText, spValue);
				}
				
			}
			
			// reading response xml file and load into list for grade
			//------------------------------------------------------------
			var gradeNodes = xmlDoc.getElementsByTagName("grade");
			for (var i=0; i < gradeNodes.length; i++)
			{
				var spText = gradeNodes[i].childNodes[0].nodeValue;
				var spValue = gradeNodes[i].getAttribute("value");			
				if (spValue == "-1")
				{
					grade_disabled = true;
					objGrade.options[objGrade.options.length] = new Option(spText, spValue);
				}
				else
				{	
					objGrade.options[objGrade.options.length] = 
						(spValue == idGradeText) ? new Option(spText, spValue, true, true) : new Option(spText, spValue);
				}
			}				
			
			if (document.getElementById("divAnimation")) document.getElementById("divAnimation").style.display = "none";
			objSpeciality.disabled = speciality_disabled;
			objGrade.disabled = grade_disabled;
		}
		else
		{
			// error
		}
	}
	else
	{
		if (document.getElementById("cmdSubmit")) document.getElementById("cmdSubmit").disabled = true;
		if (document.getElementById("divAnimation")) document.getElementById("divAnimation").style.display = "block";
		if (objSpeciality) objSpeciality.disabled = true;
		if (objGrade) objGrade.disabled = true;		
	}	
}


//-->