function aggiornaVolo(flyType, idVolo) {
	document.getElementById('dateVoloChanged').value = "0";
	document.getElementById('idVoloChanged').value = "0";			
	document.getElementById('dateVoloChanged').value = dijit.byId(flyType+'_id_datatoChange_' + idVolo).getValue();
	document.getElementById('idVoloChanged').value = idVolo;		
	functionName = 'submitAjaxFormVoli_' + flyType;		
	submitAjaxForm('getVoli_'+flyType, eval(functionName), 'Voli_'+flyType, loadingMessageVoli);
	document.getElementById('dateVoloChanged').value = "0";
	document.getElementById('idVoloChanged').value = "0";				
}
function getVoliClasses(selectID, numVoli){
	var returnValue = '';		
	for (var i=0; i < numVoli; i++){				
		var objSelect = document.getElementById(selectID +'_' +  parseInt(i+1));
		if(objSelect.selectedIndex == 0) {
			alert('Occorre selezionare la classe per ogni tratta del volo scelto.');	
			return false;
		}	
		if(i==0)
			returnValue = objSelect.options[objSelect.selectedIndex].value;
		else	
			returnValue = returnValue + ',' + objSelect.options[objSelect.selectedIndex].value;
	}
	return returnValue;		
} 	
function addVoli(tratta) {	
	objTratta = getElementsByAttribute('opt:tratta', tratta, 'input');
	objDatiVoliSelected = document.getElementById('DatiVoli');
	objDatiVoliSelected.value="";
	for (var i=0; i < objTratta.length; i++){
		if(objTratta[i].checked){
			if(objDatiVoliSelected.value != '')
				objDatiVoliSelected.value = objDatiVoliSelected.value + '@' + objTratta[i].getAttribute('opt:datiTratta');
			else
				objDatiVoliSelected.value = objTratta[i].getAttribute('opt:datiTratta');	
		}
			
	}
	submitAjaxForm('formVoliSelected', submitAjaxForm_Voli, 'cartContent', loadingMessage);
}
function allowCheckVoli() {
	//Azzero il campo di controllo perche' sono stati modificati i giorni
	if(bDateChanged) {
		listFlyType = opt.form.getCheckboxValues('FlyType');
		arrayFlyType = listFlyType.split(',');
		for (var i=0; i < arrayFlyType.length; i++){		
			objReqInProgress = document.getElementById('ReqInProgress_' + arrayFlyType[i]);
			objReqInProgress.value="";
			objRecalculate = document.getElementById('Recalculate_' + arrayFlyType[i]);
			objRecalculate.value="1";
		}					
	}			
}
function submitAjaxFormVoli_LI(response) {		
		var PaneLI = dijit.byId("Voli_LI");								
		PaneLI.setContent(response);				
		document.body.style.cursor = 'default';				
	}
		
	
function submitAjaxFormVoli_LC(response) {	
	var PaneLC = dijit.byId("Voli_LC");				
	PaneLC.setContent(response);
	document.body.style.cursor = 'default';				
}
function aggiornaVoli(cityAirport) {
	if(cityAirport != undefined){
		objcityAirportSelected = document.getElementById('cityAirportSelected');
		objcityAirportSelected.value = cityAirport;
	}
	listFlyType = opt.form.getCheckboxValues('FlyType');
	if(listFlyType != '') {				
		arrayFlyType = listFlyType.split(',');
		for (var i=0; i < arrayFlyType.length; i++){
			functionName = 'submitAjaxFormVoli_' + arrayFlyType[i];
			objReqInProgress = document.getElementById('ReqInProgress_' + arrayFlyType[i]);
			if(objReqInProgress.value == '' || cityAirport != undefined){
				submitAjaxForm('getVoli_' + arrayFlyType[i], eval(functionName), 'Voli_'+ arrayFlyType[i], loadingMessageVoli);	
				objReqInProgress.value = 1;
			}
		}
	}	
}

function selectDeptPlace(nomeCombo, valoreDept){		
	objCombo = document.getElementById(nomeCombo);
	for (var i=0; i < objCombo.options.length; i++){
		if (objCombo.options[i].getAttribute("opt:codselected")==valoreDept){
			objCombo.options[i].selected=true;
			setQpaOptions(objCombo);			
			break;
		}				
	}
	
}
	
function selectDispFly(valoreCampo){		
	arrayTrasnsp = getElementsByAttribute("name", valoreCampo, 'input');		
	for (var i=0; i < arrayTrasnsp.length; i++){			
		if (arrayTrasnsp[i].getAttribute("opt:avail") >0){
			arrayTrasnsp[i].click();
			break;
		}				
	}
}	

function submitAjaxForm_Voli(response)
	{
				var myPane = dijit.byId('carttitle');
				var MainPane = dijit.byId('cartContent');
				MainPane.setContent(response);
				document.body.style.cursor = 'default';					
				//showCartLabels();

	}				