var ajax = new Array();

function getCityList(sel)
{
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('dhtmlgoodies_city').options.length = 0;	// Empty city select box
	if(countryCode.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'http://etteilla.ru/getcities.php?countryCode='+countryCode;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createCities(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function createCities(index)
{
	var obj = document.getElementById('dhtmlgoodies_city');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}


function getSubCategoryList(sel)
{
	var category = sel.options[sel.selectedIndex].value;
	document.getElementById('dhtmlgoodies_subcategory').options.length = 0;	// Empty city select box
	if(category.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'http://etteilla.ru/getSubCategories.php?category='+category;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createSubCategories(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}
function createSubCategories(index)
{
	var obj = document.getElementById('dhtmlgoodies_subcategory');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}		


////////////////////////////////////////////////////////////////////////////////////////////////////


var ajax_tr = new Array();

function getCityList_tr(sel_tr)
{
	var countryCode_tr = sel_tr.options[sel_tr.selectedIndex].value;
	document.getElementById('dhtmlgoodies_city_tr').options.length = 0;	// Empty city select box
	if(countryCode_tr.length>0){
		var index_tr = ajax_tr.length;
		ajax_tr[index_tr] = new sack();
		
		ajax_tr[index_tr].requestFile = 'http://etteilla.ru/getcities.php?countryCode_tr='+countryCode_tr;	// Specifying which file to get
		ajax_tr[index_tr].onCompletion = function(){ createCities_tr(index_tr) };	// Specify function that will be executed after file has been found
		ajax_tr[index_tr].runAJAX();		// Execute AJAX function
	}
}

function createCities_tr(index_tr)
{
	var obj_tr = document.getElementById('dhtmlgoodies_city_tr');
	eval(ajax_tr[index_tr].response);	// Executing the response from Ajax as Javascript code	
}


function getSubCategoryList_tr(sel_tr)
{
	var category_tr = sel_tr.options[sel_tr.selectedIndex].value;
	document.getElementById('dhtmlgoodies_subcategory_tr').options.length = 0;	// Empty city select box
	if(category_tr.length>0){
		var index_tr = ajax_tr.length;
		ajax_tr[index_tr] = new sack();
		
		ajax_tr[index_tr].requestFile = 'http://etteilla.ru/getSubCategories.php?category_tr='+category_tr;	// Specifying which file to get
		ajax_tr[index_tr].onCompletion = function(){ createSubCategories_tr(index_tr) };	// Specify function that will be executed after file has been found
		ajax_tr[index_tr].runAJAX();		// Execute AJAX function
	}
}
function createSubCategories_tr(index_tr)
{
	var obj_tr = document.getElementById('dhtmlgoodies_subcategory_tr');
	eval(ajax_tr[index_tr].response);	// Executing the response from Ajax as Javascript code	
}		




