function reloadNews(url) {
    jQuery("#hotel-container").height(415);
    jQuery("#hotel-container").width(700);

    jQuery('#hotel-container').html("<div id='ajax-loader'><img src = 'theme/default/images/loading-circle.gif' alt='loading...'/></div>");
	jQuery('#hotel-container').load(url, function() {
	       jQuery("#hotel-container").height('auto').width('auto');
	   }
	);
}

function autocompleteDestinations (urlFrom, urlTo){
    jQuery('#External_FlightFareSearch_DepartureDate').datepicker({
    dateFormat:"dd/mm/yy",
    showOn: 'button',
    buttonImage: 'theme/default/images/icons/calendar.png',
    buttonImageOnly: true,
    minDate: 1
    });

    jQuery('#External_FlightFareSearch_ReturnDate').datepicker({
    dateFormat:"dd/mm/yy",
    showOn: 'button',
    buttonImage: 'theme/default/images/icons/calendar.png',
    buttonImageOnly: true,
    minDate: 1
    });

   /* jQuery("#External_FlightFareSearch_FromTxt").autocomplete(urlFrom, {
		minChars: 3,
		max:50,
		cacheLength:20
	});

	jQuery("#External_FlightFareSearch_ToTxt").autocomplete(urlTo, {
		minChars: 3,
		max:50,
		cacheLength:20
	});*/

	jQuery('#External_FlightFareSearch_FromTxt, #External_FlightFareSearch_ToTxt').autocomplete(urlFrom, {
		minChars: 2,
		max:50,
		cacheLength: 1000,
		matchSubset: false,
        dataType:'json',
		parse: function(data) {

			var array = new Array();

			jQuery.each(data, function(k, airport){
                array[array.length] = { data: airport.airport, value: airport.airport_code, result: airport.airport}
			})

			return array;

		},
		formatItem: function(v) {
			return v;
		}
	}).result(function(event, data, formatted){
	    if ($(this).attr('id') == 'External_FlightFareSearch_FromTxt'){
            jQuery("#External_FlightFareSearch_From").val(formatted);
            if ('&nbsp;&nbsp;&nbsp;&nbsp;' == data.substr(0, 24)){
                jQuery("#External_FlightFareSearch_FromTxt").val(data.substr(24));
            }
	    } else {
            jQuery("#External_FlightFareSearch_To").val(formatted);
            if ('&nbsp;&nbsp;&nbsp;&nbsp;' == data.substr(0, 24)){
                jQuery("#External_FlightFareSearch_ToTxt").val(data.substr(24));
            }
	    }
	});


	$("#External_FlightFareSearch_SearchType-OneWay").click(function () {
	    $("#return_date").css("display", "none");
    });

    $("#External_FlightFareSearch_SearchType-RoundTrip").click(function () {
	    $("#return_date").css("display", "block");
    });

    if ($("#External_FlightFareSearch_SearchType-OneWay").attr('checked')==true){
		$("#return_date").css("display", "none");
    }
}


function clearForm() {
    jQuery("#plainTicketsForm input, select").each(function(){
        jQuery(this).val('');
    });
}

function showDetailNews (url, image, breadcrumbUrl)
{
	disableSelects();

	loadBreadcrumb(breadcrumbUrl);

	if (image!=''){
    	$("#dialog div.dialogBadge").html('<img src="theme/default/images/icons/' + image + '" alt=""/>');
	}

    $("#pane1").attr('style', 'width:670px; height:452px')
    .html("<div id='ajax-loader'><img src = 'theme/default/images/loading-circle.gif' alt='loading...'/></div>")
    .load(url);
    $("#dialog").dialog({ height: 500, width: 690, modal: true, close: function() {
	    																	enableSelects();
	    																	$("#breadcrumb1").html('&nbsp;');
	    																	jQuery('#dialog').dialog('destroy');
	    																	$("#dialog div.dialogBadge").html('')
    																	}
    					});
    $('#dialog').dialog().dialog('open');
}
