function callback_getDestination(res)
{
	if(res != null && res.value != null && res.value.Tables != 0 && res.value.Tables.length == 1)
	{
		var html = [];
		html[html.length]="<table align=\"left\" cellspacing=\"2\" cellpadding=\"0\" width=\"100%\" border=\"0\" class=\"vbmenu_option\">"
		html[html.length]="<tr valign=\"top\" ><td nowrap>";
		for(var i=0; i<res.value.Tables[0].Rows.length; i++){
		if (i % 15 == 0 && i>0){
			html[html.length]="</td><td nowrap>";
		}
			html[html.length] = "<li><a href=\"javascript:setDestination('" + res.value.Tables[0].Rows[i].Country + "')\">" + res.value.Tables[0].Rows[i].Country + "</a></li>";
		}
		html[html.length]="</td></tr></table>";
		document.getElementById("display1").innerHTML = html.join("");
	}
}

function getDestination(pDestinationType)
{
	AjaxMethods.getDestination(pDestinationType,callback_getDestination);
}

function getDestinationTOP(pDestinationType)
{
	AjaxMethods.getDestination(pDestinationType,callback_getDestinationTOP);
}

function callback_getDestinationTOP(res)
{
	if(res != null && res.value != null && res.value.Tables != 0 && res.value.Tables.length == 1)
	{
		var html = [];
		html[html.length]="<table align=\"left\" cellspacing=\"2\" cellpadding=\"0\" width=\"100%\" border=\"0\" class=\"vbmenu_option_best\">"
		html[html.length]="<tr valign=\"top\" ><td nowrap class=\"vbmenu_option_best\">";
		for(var i=0; i<res.value.Tables[0].Rows.length; i++){
		if (i % 15 == 0 && i>0){
			html[html.length]="</td><td nowrap class=\"vbmenu_option_best\">";
		}
			html[html.length] = "<li><a href=\"javascript:setDestination('" + res.value.Tables[0].Rows[i].Country + "')\">" + res.value.Tables[0].Rows[i].Country + "</a></li>";
		}
			
		html[html.length]="</td></tr></table>";
		
		document.getElementById("displayTOP").innerHTML = html.join("");
	}
}

function getDestinationFlight(pDestinationType)
{
	AjaxMethods.getDestination(pDestinationType,callback_getDestinationFlight);
}

function callback_getDestinationFlight(res)
{
	if(res != null && res.value != null && res.value.Tables != 0 && res.value.Tables.length == 1)
	{
		var html = [];
		html[html.length]="<table align=\"left\" cellspacing=\"2\" cellpadding=\"0\" width=\"100%\" border=\"0\" class=\"vbmenu_option\">"
		html[html.length]="<tr valign=\"top\" ><td nowrap>";
		for(var i=0; i<res.value.Tables[0].Rows.length; i++){
		if (i % 15 == 0 && i>0){
			html[html.length]="</td><td nowrap>";
		}
			html[html.length] = "<li><a href=\"javascript:setDestinationFlight('" + res.value.Tables[0].Rows[i].Country + "')\">" + res.value.Tables[0].Rows[i].Country + "</a></li>";
		}
		html[html.length]="</td></tr></table>";
		document.getElementById("display1").innerHTML = html.join("");
	}
}

function getPrices(pAirportName,pAirportCode,pDateFrom,pDateTo,pDestinationName, pCity, pAccomodation, pNights, pReferer, pAirportNumber, pPromoMsg, pPlan, pSection)
{
	AjaxMethods.getPrices(pAirportName,pAirportCode,pDateFrom,pDateTo,pDestinationName, pCity, pAccomodation, pNights, pReferer, pAirportNumber, pPromoMsg, pPlan, pSection, callback_getPrices);
}

function rollOn(layName, tot, section){

for (var i=1; i<=parseInt(tot);i++){
	document.getElementById('lay_AirportName'+i).className=section+'_link_off';
}
document.getElementById(layName).className=section+'_link_on';

}

function callback_getPrices(res)
{
	if(res != null && res.value != null)
	{	
		document.getElementById("cont_risultati").innerHTML = res.value;//html.join("");
	}
}



function getAirportArrive(tabbedName, productType)
{
	document.getElementById("fromCityLS").value=tabbedName;//set quick search

	AjaxMethods.getAirportArrive(tabbedName, 'ITALY_LOCATION', productType, callback_getAirportArriveItaly);


	AjaxMethods.getAirportArrive(tabbedName, 'EUROPE_LOCATION', productType, callback_getAirportArriveEurope);


	AjaxMethods.getAirportArrive(tabbedName, 'WORLD_LOCATION', productType, callback_getAirportArriveWorld);

}

function getAirportArriveNoDeparture(productType)
{

	AjaxMethods.getAirportArriveNoDeparture('ITALY_LOCATION', productType, callback_getAirportArriveItaly);


	AjaxMethods.getAirportArriveNoDeparture('EUROPE_LOCATION', productType, callback_getAirportArriveEurope);


	AjaxMethods.getAirportArriveNoDeparture('WORLD_LOCATION', productType, callback_getAirportArriveWorld);

}

function callback_getAirportArriveItaly(res)
{

	if(res != null && res.value != null)
	{	
		document.getElementById("ITALY_LOCATION").innerHTML = res.value;//html.join("");
	}
}
function callback_getAirportArriveEurope(res)
{
	if(res != null && res.value != null)
	{	
		document.getElementById("EUROPE_LOCATION").innerHTML = res.value;//html.join("");
	}
}
function callback_getAirportArriveWorld(res)
{
	if(res != null && res.value != null)
	{	
		document.getElementById("WORLD_LOCATION").innerHTML = res.value;//html.join("");
	}
}

function rollOnAirportTabbed(homeId,indexSel){

for (var i=0; i<=5;i++){
var cssName;
if (homeId=='Flight'){
cssName='tab_volo'
}else{
cssName='tab_volohotel'
}
	document.getElementById('AirportTabbed'+i).className=cssName+'_off';
	document.getElementById('CentralPane'+homeId+'Destination1__ctl'+i+'_HLAirport').className=cssName+'_off';	
	//alert('CentralPaneFlightDestination1__ctl'+String(parseInt(indexSel)-1)+'_HLAirport')
}
document.getElementById('AirportTabbed'+indexSel).className=cssName+'_on';
document.getElementById('CentralPane'+homeId+'Destination1__ctl'+indexSel+'_HLAirport').className=cssName+'_on';

}

function getDepartureDates(pDateFrom,pDateTo,pDestinationName, pCity, pAccomodation, pNights, pReferer, pAirportNumber, pPromoMsg, pPlan, pSection)
{	
	var index = document.getElementById('_ctl1_ddlDepartureAirport').selectedIndex
	pAirportCode=document.getElementById('_ctl1_ddlDepartureAirport').value
	pAirportName = document.getElementById('_ctl1_ddlDepartureAirport').options[index].text
	
	AjaxMethods.getDepartureDates(pAirportName,pAirportCode,pDateFrom,pDateTo,pDestinationName, pCity, pAccomodation, pNights, pReferer, pAirportNumber, pPromoMsg, pPlan, pSection, callback_getDepartureDates);
}

function callback_getDepartureDates(res)
{
	
	return document.getElementById("ddlDepartureDate").innerHTML = res.value
}

