var ajax = new sack();

function getRegionList(sel)
{
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('dhtmlgoodies_region').options.length = 0;	// Empty city select box
//	document.getElementById('dhtmlgoodies_city').options.length = 0;	// Empty city select box
	if(countryCode.length>0)
	{
		ajax.requestFile = '/getCities.php?id_country='+countryCode;	// Specifying which file to get
		ajax.onCompletion = createRegion;	// Specify function that will be executed after file has been found
		ajax.runAJAX();		// Execute AJAX function
	}
}

function createRegion()
{
	var obj = document.getElementById('dhtmlgoodies_region');
	eval(ajax.response);	// Executing the response from Ajax as Javascript code	
}	

function getCityList(sel)
{
	var regionCode = sel.options[sel.selectedIndex].value;
	document.getElementById('dhtmlgoodies_city').options.length = 0;	// Empty city select box
	if(regionCode.length>0)
	{
		ajax.requestFile = '/getCities.php?id_region='+regionCode;	// Specifying which file to get
		ajax.onCompletion = createCity;	// Specify function that will be executed after file has been found
		ajax.runAJAX();		// Execute AJAX function
	}
}

function createCity()
{
	var obj = document.getElementById('dhtmlgoodies_city');
	eval(ajax.response);	// Executing the response from Ajax as Javascript code	
}	
	
function getProfList(sel)
{
	var category = sel.options[sel.selectedIndex].value;
	document.getElementById('job_prof').options.length = 0;	// Empty city select box
	if(category.length>0)
	{
		ajax.requestFile = '/getprof.php?id_category='+category;	// Specifying which file to get
		ajax.onCompletion = createProf;	// Specify function that will be executed after file has been found
		ajax.runAJAX();		// Execute AJAX function
	}
}

function createProf()
{
	var obj = document.getElementById('job_prof');
	eval(ajax.response);	// Executing the response from Ajax as Javascript code	
}	

