
var ajax = new Array();

function getCityList(sel)
{
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('kecid').options.length = 0;	// Empty city select box
	if(countryCode.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'includes/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('kecid');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}


function getDesa(sel)
{
	var kecid = sel.options[sel.selectedIndex].value;
	document.getElementById('desaid').options.length = 0;	// Empty city select box
	if(kecid.length>0){
		var index = ajax.length;
		ajax[index] = new sack();	
		ajax[index].requestFile = 'includes/getDesa.php?kecid='+kecid;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createDesa(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}
function createDesa(index)
{
	var obj = document.getElementById('desaid');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}

//iklan
function getCityIklan(sel)
{
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('kabid').options.length = 0;	// Empty city select box
	if(countryCode.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'includes/getCitiesIklan.php?countryCode='+countryCode;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createCitiesIklan(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function createCitiesIklan(index)
{
	var obj = document.getElementById('kabid');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}		