function GetFlightDeals(strFile) 
{
    Ajax_WriteToPageWithCallback(strFile, DisplayFlightDeals);
}

function DisplayFlightDeals(strResponse) 
{
    if (strResponse == '') 
    {
        document.getElementById('flightdealbox').style.background = "none";
        document.getElementById('flightdealbox').style.display = "none";
        return;
    }

    //Spit each list of flight deals into its constituent elements
    var arrFlightDeals = strResponse.split('|');
    var strFlightDealList = arrFlightDeals[0];
    var strShowSearch = arrFlightDeals[1];
    var strAirportList = arrFlightDeals[2];
    var strShowAdvertising = arrFlightDeals[3];
    var strAdvertLink = arrFlightDeals[4];
    var strAdvertImagePath = arrFlightDeals[5];
    var strPageName = arrFlightDeals[6];
    var strBaseUrl = arrFlightDeals[7];


    //Build the top of the flight deal box
    var strInnerHtml = '<div class="right-box" id="box-flights">';
    strInnerHtml += '<div class="box-content">';
    strInnerHtml += '<h2><span>This Week\'s Hot Flight Deals </span></h2>';
    strInnerHtml += '<ul>';

    //Fill the flight deal box with deals
    strInnerHtml += strFlightDealList
    
    strInnerHtml += '</ul>';
    
    //Build the find flights search box   
    if(strShowSearch == 'True' && strAirportList != '')
    {
        strInnerHtml += '<div">';
        strInnerHtml += '<div id="Airfares-Search" class="content-left-box">';
        strInnerHtml += '<h3 style="padding:8px 0 0 10px;">Find Flights</h3>';

        strInnerHtml += '<form action="" id="frmHotFlightSearch" name="frmHotFlightSearch" method="post">';

		strInnerHtml += '<table border="0" width="281px" style="background-color:#EDF1F2;">';
		strInnerHtml += '<tr style="height:25px;">';
		strInnerHtml += '<td style="width:40px;">From:</td>';
		strInnerHtml += '<td>';
		strInnerHtml += '<div style="float:left;">';
		strInnerHtml += '<select id="FlightsFrom" name="FlightsFrom" onchange="javascript: Ajax_MatchSearch(document.getElementById(\'FlightsTo\'), \'/airfares/airfares-match.asp?ComboBox=FlightsTo&IataFrom=\' + escape(this.options[this.selectedIndex].value))" style="width:190px;">';				
		strInnerHtml += '<option value="">Origin</span>';
		strInnerHtml += strAirportList;
		strInnerHtml += '</select>';
		strInnerHtml += '</div>';
		strInnerHtml += '<div id="loader" name="loader" style="padding:0 0 0 0;margin:0 0 0 0;text-align:center;"></div>';
		strInnerHtml += '</td>';
		strInnerHtml += '</tr>';							
	    strInnerHtml += '<tr>';
		strInnerHtml += '<td style="width:40px;">To: <br /></td>';
		strInnerHtml += '<td>';
		strInnerHtml += '<select id="FlightsTo" name="FlightsTo" style="width:190px;">';
		strInnerHtml += '<option value="">Destination</option>';
		strInnerHtml += '</select>';
		strInnerHtml += '&nbsp;<input class="Button" id="findflights" name="findflights" onclick="javascript: fnPost(\'True\');" type="button" value="GO" style="width:30px;" />';
		strInnerHtml += '</td>';
		strInnerHtml += '</tr>';
		strInnerHtml += '</table>';
		
		strInnerHtml += '<input type="hidden" id="txtFlightsIata" name="txtFlightsIata" value="" />';
		strInnerHtml += '<input type="hidden" id="IataFrom" name="IataFrom" value="" />';
		strInnerHtml += '<input type="hidden" id="From" name="From" value="" />';
		strInnerHtml += '<input type="hidden" id="IataTo" name="IataTo" value="" />';
		strInnerHtml += '<input type="hidden" id="To" name="To" value="" />';
		strInnerHtml += '<input type="hidden" id="CountryTo" name="CountryTo" value="" />';
		strInnerHtml += '<input type="hidden" id="PageName" name="PageName" value="' + strPageName + '" />';

		strInnerHtml += '</form>';

		strInnerHtml += '</div>';
		strInnerHtml += '</div>';
	}

    //Build the advertising
    if(strShowAdvertising == 'True')
    {
	    strInnerHtml += '<br />';
		strInnerHtml += '<table class="sponsored">';
		strInnerHtml += '<tr>';
		strInnerHtml += ' <td>';
		strInnerHtml += ' <a href="' + strAdvertLink + '" target="_blank">';
		strInnerHtml += ' <img alt="Click here for more details" src="' + strAdvertImagePath + '" /></a>';
		strInnerHtml += ' </td>';
		strInnerHtml += '</tr>';
		strInnerHtml += '<tr>';
		strInnerHtml += ' <td>';
		strInnerHtml += ' <span>Sponsored Advertisement</span>';
		strInnerHtml += ' </td>';
		strInnerHtml += '</tr>';
		strInnerHtml += '</table>';    
    }

    //Add the form for the 'flights to' links
    strInnerHtml += '<form id="frmAirfaresTo" name="frmAirfaresTo" method="post" target="_top">';
    strInnerHtml += ' <input type="hidden" id="IataTo" name="IataTo" value="" />';
    strInnerHtml += ' <input type="hidden" id="To" name="To" value="" />';
    strInnerHtml += ' <input type="hidden" id="CountryTo" name="CountryTo" value="" />';
    strInnerHtml += ' <input type="hidden" id="AreaId" name="AreaId" value="" />';
    strInnerHtml += '</form>';       
        
    strInnerHtml += '</div>';
    strInnerHtml += '</div>';

    //push it all to the screen
    document.getElementById('flightdealbox').innerHTML = strInnerHtml;
}




