//This function is used to add the departing airport options to the dropdown list
$(function() {
	$.get("Anitepage.aspx?p=STO-AIR&x=RELATEDRESORTID " + myResort, function(data) {

		if ($('#AJAX_response_container').length == 0) $('<div id="AJAX_response_container" style="display:none"></div>').appendTo('body');

		$('#AJAX_response_container').empty();
		$('#AJAX_response_container').html(data);

		if ($('#AJAX_routes_depart_list').length) {
			$('#depAirport').empty();
			$('#depAirport').html($('#AJAX_routes_depart_list').html());
		}

		if ($('#AJAX_routes_table').length) {
			$('#airlinesDiplay').empty();
			$('#airlinesDiplay').append("<table style=\"display: none\"></table>");
			$('#airlinesDiplay table')
				.html($('#AJAX_routes_table').html())
				.hide();
		}

		$('#AJAX_response_container').remove();
	});

	$('#routeResortFilter').click(function() {
		if ($('#depAirport').val() == "") {
			$('#airlinesDiplay table tbody tr, #airlinesDiplay table').hide();
		} else {
		var departChoice = $('#depAirport').val();
			$('#airlinesDiplay table').show();
			$('#airlinesDiplay table tbody tr').hide();
			$('#airlinesDiplay table tbody tr.dep_' + departChoice).show();
		}
		return false;
	});
});