var ajax = new Array();
var ajaxCity = new Array();
var ajaxProv = new Array();
var ajaxFrequenze = new Array();


function getProvincieListF(sel)
{ 
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('provincia').options.length = 0;	// Empty city select box
	document.getElementById('citta').options.length = 0;	// Empty city select box
	document.getElementById('frequenze').options.length = 0;	// Empty city select box
	if(countryCode.length>0){
		var index = ajaxProv.length;
		ajaxProv[index] = new sack();
		ajaxProv[index].requestFile = '/opencms/system/modules/it.cnm.radiomodule.widget/elements/getFreq.php?regione='+countryCode;	// Specifying which file to get
		ajaxProv[index].onCompletion = function(){ createProvincieF(index) };	// Specify function that will be executed after file has been found
		ajaxProv[index].runAJAX();		// Execute AJAX function
	}
}

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


function getCittaListF(sel)
{ 
	var countryCode = sel.options[sel.selectedIndex].value;
	var local = (document.getElementById('local1').checked)?"&local=1":"";
	document.getElementById('citta').options.length = 0;	// Empty city select box
	document.getElementById('frequenze').options.length = 0;	// Empty city select box
	if(countryCode.length>0){
		var index = ajaxCity.length;
		ajaxCity[index] = new sack();
		ajaxCity[index].requestFile = '/opencms/system/modules/it.cnm.radiomodule.widget/elements/getFreq.php?provincia='+countryCode+local;	// Specifying which file to get
		ajaxCity[index].onCompletion = function(){ createCittaF(index) };	// Specify function that will be executed after file has been found
		ajaxCity[index].runAJAX();		// Execute AJAX function
	}
}

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


function getFreqList(sel)
{
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('frequenze').options.length = 0;	// Empty city select box
	if(countryCode.length>0){
		var index = ajaxFrequenze.length;
		ajaxFrequenze[index] = new sack();
		ajaxFrequenze[index].requestFile = '/opencms/system/modules/it.cnm.radiomodule.widget/elements/getFreq.php?citta='+countryCode;	// Specifying which file to get
		ajaxFrequenze[index].onCompletion = function(){ createFreq(index) };	// Specify function that will be executed after file has been found
		ajaxFrequenze[index].runAJAX();		// Execute ajaxCity function
	}
}

function createFreq(index)
{
	var obj = document.getElementById('frequenze');
	eval(ajaxFrequenze[index].response);	// Executing the response from ajaxCity as Javascript code	
}