
var Amp={cssIsOn:true,dimensions:{isSet:false},modal:{isAlreadyBuilt:false,isOpen:false},slideshow:{pause:false,pausedExternally:false}};var Helper={pageDimensions:function(){Amp.dimensions.documentWidth=docWidth=$(document).width();Amp.dimensions.documentHeight=docHeight=$(document).height();Amp.dimensions.windowWidth=winWidth=$(window).width();Amp.dimensions.windowHeight=winHeight=$(window).height();Amp.dimensions.bodyWidth=bodyWidth=$("body").width();Amp.dimensions.bodyHeight=bodyHeight=$("body").height();Amp.dimensions.overlayWidth=($.browser.msie&&parseInt($.browser.version)<7)?bodyWidth:docWidth;Amp.dimensions.overlayHeight=(docHeight<winHeight)?winHeight:docHeight;},modalOpen:function(modalData,modalWidth){this.modalData=modalData;this.modalWidth=modalWidth;if(Amp.slideshow.pause==false){Amp.slideshow.pause=true;Amp.slideshow.pausedExternally=true;}
if(!Amp.dimensions.isSet){Helper.pageDimensions();Amp.dimensions.isSet=true;}
var dimensions=Amp.dimensions;if(Amp.modal.isAlreadyBuilt){var modalOverlay=$('#modalOverlay').css({display:'block',top:'0',width:dimensions.overlayWidth,height:dimensions.overlayHeight});var modalWindow=$('#modalWindow').css({display:'block'});if(modalWidth!=='none'){$('#modalWindow').removeAttr('class').addClass(modalWidth);}else if(Amp.modal.isOpen&&(modalWidth=='none')){}else{$('#modalWindow').removeAttr('class');}
$('.modalBody').html(modalData);}else{var modalOverlay=$("<div id=\"modalOverlay\"></div>").css({width:dimensions.overlayWidth,height:dimensions.overlayHeight}).bgiframe().appendTo("body");var modalWindow=$('<div id=\"modalWindow\"></div>').appendTo("body");modalWindow.html('<div class=\"modalHeader\"><div class=\"wrapper\"></div></div> <div class=\"modalBody\">'+modalData+'</div> <div class=\"modalFooter\"><div class=\"wrapper\"></div></div>')
if(modalWidth!=='none'){$('#modalWindow').addClass(modalWidth);}
var modalCloseButton=$('<a id=\"modalClose\">Close</a>').appendTo('#modalWindow .modalHeader .wrapper');modalCloseButton.bind('click',function(){Helper.modalClose();return false;});Amp.modal.isAlreadyBuilt=true;}
Amp.dimensions.scrollLeft=$(document).scrollLeft();Amp.dimensions.scrollTop=$(document).scrollTop();var moveModalLeft=Math.round(dimensions.overlayWidth/2)-Math.round(modalWindow.width()/2)+Amp.dimensions.scrollLeft;if(modalWindow.height()>dimensions.windowHeight){var moveModalTop=0+Amp.dimensions.scrollTop;}else{var moveModalTop=Math.round(dimensions.windowHeight/2)-Math.round(modalWindow.height()/2)+Amp.dimensions.scrollTop;}
modalWindow.css({left:moveModalLeft,top:moveModalTop});if($('#modalWindow a.modalAjax').length>0){$('#modalWindow a.modalAjax').bind('click',function(){$(this).modalAjax();return false;});}
Helper.rebindModalEvents();Amp.modal.isOpen=true;if($('#modalWindow').hasClass('w550')||$('#modalWindow').hasClass('w450')){$('#modalPrint').hide();}},modalClose:function(){$('#modalPrint').show();$('#modalOverlay, #modalWindow').css({display:'none',top:'-10000px'});$("style[media='print']").remove();Amp.modal.isOpen=false;Amp.modal.isAlreadyBuilt=true;if(Amp.slideshow.pausedExternally==true){Amp.slideshow.pause=false;Amp.slideshow.pausedExternally=false;}
if($('#modalWindow .fHolder').length>0){$('#modalWindow .fHolder').remove();}},rebindModalEvents:function(){if($('#modalWindow form.modalForm').length>0){$('#modalWindow form.modalForm').each(function(){var target=$(this);target.submit(function(){target.modalForm();return false;});});}
if($('#modalWindow .closeModal').length>0){$('#modalWindow .closeModal').bind('click',function(){Helper.modalClose();return false;});}
if($('#modalWindow a.modalAjax').length>0){$('#modalWindow a.modalAjax').live('click',function(){$(this).modalAjax();return false;});}
if($('#modalWindow .tabContent').length>0){$('#modalWindow .tabContent').each(function(){$(this).tabContent();})}
if($('#modalWindow .accordionContent').length>0){$('#modalWindow .accordionContent').each(function(){$(this).accordion({header:'h6',autoHeight:false});})}
if($('#modalWindow a.popUpWindow').length>0){$('a.popUpWindow').each(function(){$(this).popUpWindow();})}
if($('.rating_form').length>0){$('.rating_form #yes').bind('click',function(){var contactInfo=$(this).parent('.approval_checkbox').siblings('.contact_information');if(contactInfo.hasClass('visible')){contactInfo.removeClass('visible');}else{contactInfo.addClass('visible');}});}
/*if($('#modalWindow .mapsModalSubNav').length>0){$('#modalWindow .mapsModalSubNav').unbind().mapsModalSubNav();}*/}};jQuery.fn.extend({ tabContent: function() {
    var target = $(this); var navList = ''; var preActive = false; target.children('h3').each(function(i) {
        var h3 = $(this); var h3Class = $(this).attr('class'); var textContent = h3.text(); var classAssign = 'slide' + i; if (h3.hasClass('active')) { navList += '<li class="' + classAssign + ' active"><a class="' + h3Class + '" href="javascript\:void(0)"><span>' + textContent + '<\/span><\/a><\/li>'; h3.next().addClass('tabSlides ' + classAssign + ' active'); preActive = true; } else { navList += '<li class="' + classAssign + '"><a class="' + h3Class + '" href="javascript\:void(0)"><span>' + textContent + '<\/span><\/a><\/li>'; h3.next().addClass('tabSlides ' + classAssign); }
        h3.remove();
    })
    target.html('<div class="tabContentBody">' + target.html() + '<\/div>'); target.prepend('<ul class="tabContentNav">' + navList + '<\/ul>'); if (!preActive) { target.find('.tabContentNav li:first').addClass('active'); target.find('.tabContentBody div:first').addClass('active'); }
    target.find('.tabContentNav li a').live('click', function() {
        var anchor = $(this); if (anchor.parent('li').hasClass('active') == false) { var targetID = anchor.parent('li').attr('class'); anchor.parent('li').addClass('active').siblings('li').removeClass('active').parent('.tabContentNav').siblings('.tabContentBody').children('div.' + targetID).addClass('active').siblings('div').removeClass('active'); }
        return false;
    })
},
    modalAjax: function() {
        var target = $(this);
        var ajaxLink = $(this).attr('href');
        if (target.attr('rel').length > 0) {
            var modalWidth = target.attr('rel');
            $('<style media="print"> #container{display:none;}</style>').appendTo('head');
        } else {
            var modalWidth = 'none';
        }
        $.ajax(
{ type: "GET",
    url: ajaxLink,
    success: function(msg) { Helper.modalOpen(msg, modalWidth); },
    error: function(XMLHttpRequest, textStatus, errorThrown) {
        alert('The AJAX data requested from the server failed and gave the following messages. \n\nStatus:\n '
+ textStatus + '\n\nError Message:\n' + errorThrown)
    }
})
    }, modalInline: function() {
        var target = $(this); $('<style media="print"> #container{display:none;}</style>').appendTo('head'); var inlineData = $(this).siblings('.modalInlineData').html(); if (target.attr('rel').length > 0) { var modalWidth = target.attr('rel'); } else { var modalWidth = 'none'; }
        Helper.modalOpen(inlineData, modalWidth);
    }, modalForm: function() {
        var targetForm = $(this); var ajaxLink = targetForm.attr('action'); var formData = targetForm.serialize(); $.ajax({ type: "GET", url: ajaxLink, data: formData, success: function(msg) { Helper.modalOpen(msg); }, error: function(XMLHttpRequest, textStatus, errorThrown) {
            alert('The AJAX data requested from the server failed and gave the following messages. \n\nStatus:\n '
+ textStatus + '\n\nError Message:\n' + errorThrown)
        }
        })
    }, slideshow: function() {
        var target = $(this); var navControlOn = false; if (target.hasClass('navControlOn')) { var navControlOn = true; }
        function rotateSlide() {
            if (!Amp.slideshow.pause) {
                target.children('.wrapper').fadeOut(500, function() {
                    if (navControlOn) { if (target.find('.controls .current').next().hasClass('pauseButton')) { target.find('.controls a.current').removeClass('current').siblings(':first').addClass('current'); } else { target.find('.controls a.current').removeClass('current').next().addClass('current'); } }
                    if (target.find('.slideshowScreen .current').next().length < 1) { target.find('.slideshowScreen .slide:last').removeClass('current').siblings(':first').addClass('current'); } else { target.find('.slideshowScreen .current').removeClass('current').next().addClass('current'); }
                }).fadeIn(1000);
            }
        }
        var slideshowrotate = setInterval(rotateSlide, 7000); if (navControlOn) {
            var jumpAnchors = target.find('.controls a'); function jumpto(object) { var anchortarget = $(object); var slideTo = anchortarget.attr('name'); anchortarget.closest('.wrapper').fadeOut(500, function() { anchortarget.addClass('current').siblings().removeClass('current').parent().siblings('.slideshowScreen').children('.' + slideTo).addClass('current').siblings().removeClass('current'); }).fadeIn(500); }
            jumpAnchors.live('click', function() {
                var anchortarget = $(this); var resumeRotation = false; if (anchortarget.hasClass('pauseButton')) {
                    if (anchortarget.hasClass('pausedTrue')) { Amp.slideshow.pause = false; slideshowrotate = setInterval(rotateSlide, 7000); } else { Amp.slideshow.pause = true; clearInterval(slideshowrotate); slideshowrotate = ""; }
                    anchortarget.toggleClass('pausedTrue');
                } else {
                    if (!Amp.slideshow.pause) { resumeRotation = true; clearInterval(slideshowrotate); slideshowrotate = ""; }
                    jumpto($(this)); if (resumeRotation) { slideshowrotate = setInterval(rotateSlide, 7000); }
                }
                return false;
            })
        }
    }, mapImgGallery: function() {
        var target = $(this); target.find('.concourseMapNav a').live('click', function() {
            var anchor = $(this); if (!anchor.parent('li').hasClass('active')) { var anchorID = '.' + (anchor.attr('class')); anchor.parent('li').addClass('active').siblings().removeClass('active').parent('.concourseMapNav').siblings('.concourseMapImage').children(anchorID).addClass('active').siblings().removeClass('active'); var clickedImgSrc = anchor.closest('.concourseMapNav').siblings('.concourseMapImage').children(anchorID).children('img').attr('src'); var clickedImgExtensionLoc = clickedImgSrc.indexOf('.'); var clickedImgExtension = clickedImgSrc.substr(clickedImgExtensionLoc); var newImgSrc = (clickedImgSrc.substr(0, clickedImgExtensionLoc)) + '_large' + clickedImgExtension; var clickedImgH3 = anchor.closest('.concourseMapNav').siblings('.concourseMapImage').children(anchorID).children('h3').html(); anchor.closest('.concourseMapNav').siblings('.concourseMapTitle').find('.concourseMapImageLarge img').attr('src', newImgSrc); anchor.closest('.concourseMapNav').siblings('.concourseMapTitle').find('.concourseModalData h3').html(clickedImgH3); }
            return false;
        })
    }, /*mapsModalSubNav: function() {
        var target = $(this); $(this).bind('mouseout', function() { $('.subTitle').css('color', '#000') }); $(this).bind('mouseover', function() { $('.subTitle').css('color', '#fff') }); var h3Title = target.siblings('.mapsModalTitle').children('.subTitle').text(); target.find('li a').live('mouseover', function() { var anchor = $(this); $('.subTitle').css('color', '#000'); var anchorTitle = anchor.text(); anchor.closest('.mapsModalSubNav').siblings('.mapsModalTitle').children('.subTitle').text(anchorTitle); })
        target.find('li a').live('mouseout', function() { var anchor = $(this); $('.subTitle').css('color', '#000'); anchor.closest('.mapsModalSubNav').siblings('.mapsModalTitle').children('.subTitle').text(h3Title); })
    },*/
    popUpWindow: function() {
        var target = $(this); $(this).unbind('click'); $(this).bind("click", function() {
            var anchor = $(this); var anchorTarget = anchor.attr('href'); var width; var height; if (anchor.attr('rel').split('|')[1] != null && anchor.attr('rel').length > 0) { height = (anchor.attr('rel').split('|')[1].match(/[\d\.]+/g)); width = (anchor.attr('rel').split('|')[0].match(/[\d\.]+/g)); var popUpWidth = "width=" + width + ",height=" + height + ",resizable=no,scrollbars=no,status=no,toolbar=no,menubar=no,location=no"; }
            else {
                height = "600"; if (anchor.attr('rel').length > 0) { width = (anchor.attr('rel').match(/[\d\.]+/g)); } else { width = "980"; }
                var popUpWidth = "width=" + width + ",height=" + height + ",resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no";
            }
            window.open(anchorTarget, null, popUpWidth); return false;
        });
    }
});
$(document).ready(function() {

    if ($('.descriptionFAQ').length) {
        $('#travelInfoList ul.travelInfo').css({ "margin-bottom": "0px", "padding-top": "0px" });

    }
    if (!$('.wideSkyScraper').length && !$('.flightBodyWapper').length) { //if wideSkyScraper does not exist and not airline page
        $('#adLayout').width('743px');
        if (!$.trim($('.sideColMod').text()).length && !$('#adLayout').length) {
            $('.sideColMod').hide();
            $('.bodyMod').width('743px');
        }
    }
    if ($('.leftDiv').length) {
        $('.chevronResultsTable .featured').each(function() {
            var tdHeight = 0;
            tdHeight = $(this).height() - 10;
            $(this).find('.leftDiv').height(tdHeight);
            $(this).find('td:last .rightDiv').height(tdHeight);
        })
    }
    $('#modalPrint').bind('click', function() {
        window.print();
        return false;
    })
    var target = $('.mapsModalSubNav');
    $('.mapsModalSubNav').bind('mouseout', function() { $('.subTitle').css('color', '#000') });
    $('.mapsModalSubNav').bind('mouseover', function() { $('.subTitle').css('color', '#fff') });
    var h3Title = target.siblings('.mapsModalTitle').children('.subTitle').text();
    target.find('li a').live('mouseover', function() {
        var anchor = $(this);
        $('.subTitle').css('color', '#000');
        var anchorTitle = anchor.text();
        anchor.closest('.mapsModalSubNav').siblings('.mapsModalTitle').children('.subTitle').text(anchorTitle);
    })
    target.find('li a').live('mouseout', function() {
        var anchor = $(this);
        $('.subTitle').css('color', '#000');
        anchor.closest('.mapsModalSubNav').siblings('.mapsModalTitle').children('.subTitle').text(h3Title);

    })
    if ($('.accessibilityJumpLinks').css('position') != 'absolute') { Amp.cssIsOn = false; }; if (Amp.cssIsOn) {
        if ($('a.modalAjax').length > 0) { $('a.modalAjax').live('click', function(e) { if (e.which !== undefined && e.which !== 1) return true; $(this).modalAjax(); return false; }); }
        if ($('a.modalInline').length > 0) { $('a.modalInline').live('click', function(e) { if (e.which !== undefined && e.which !== 1) return true; $(this).modalInline(); return false; }); }
        if ($('form.modalForm').length > 0) { $('form.modalForm').each(function() { var target = $(this); target.submit(function() { target.modalForm(); return false; }); }); }
        if ($('.tabContent').length > 0) { $('.tabContent').each(function() { $(this).tabContent(); }) }
        $('.searchBarInput').bind('focus', function() { var target = $(this); if (target.attr('value') == 'Search') { target.attr('value', ''); target.css('color', 'black'); } }); $('.searchBarInput').bind('blur', function() { var target = $(this); if (target.attr('value') == '') { target.attr('value', 'Search'); target.css('color', 'rgb(211,211,211)'); } }); if ($('.accordionContent').length > 0) { $('.accordionContent').each(function() { $(this).accordion({ header: 'h6', autoHeight: false }); }) }
        if ($('#slideshow').length > 0) { $('#slideshow').slideshow(); }
        if ($('.concourseMap').length > 0) { }
        if ($('a.popUpWindow').length > 0) { $('a.popUpWindow').each(function() { $(this).popUpWindow(); }) }
        $(window).resize(function() { Amp.dimensions.isSet = false; }); if ($('#container #mainContent #contentBody #chevron #flightDetailsContainer #flightDetailsMod div.wrapper').length > 0) { $('#container #mainContent #contentBody #chevron #flightDetailsContainer #flightDetailsMod div.wrapper').removeClass("wrapper").addClass("wrapperWithoutBackground"); }
        if ($('#container #mainContent #contentBody #flightDetailsContainer #chevron #flightDetailsMod div.wrapper').length > 0) { $('#container #mainContent #contentBody #flightDetailsContainer #chevron #flightDetailsMod div.wrapper').removeClass("wrapper").addClass("wrapperWithoutBackground"); }
        if ($('#container #mainContent #contentBody #flightDetailsContainer #flightDetailsMod div.wrapper').length > 0) { $('#container #mainContent #contentBody #flightDetailsContainer #flightDetailsMod div.wrapper').removeClass("wrapper").addClass("wrapperWithoutBackground"); }

        if ($('#container #mainContent #contentBody #chevron #flightDetailsContainer #flightDetailsModConnecting div.wrapper').length > 0) { $('#container #mainContent #contentBody #chevron #flightDetailsContainer #flightDetailsModConnecting div.wrapper').removeClass("wrapper").addClass("wrapperWithoutBackground"); $(".firstDivide, .secondDivide").css("top", "-5px"); }
        if ($('#container #mainContent #contentBody #flightDetailsContainer #chevron #flightDetailsModConnecting div.wrapper').length > 0) { $('#container #mainContent #contentBody #flightDetailsContainer #chevron #flightDetailsModConnecting div.wrapper').removeClass("wrapper").addClass("wrapperWithoutBackground"); $(".firstDivide, .secondDivide").css("top", "-5px"); }
        if ($('#container #mainContent #contentBody #flightDetailsContainer #flightDetailsModConnecting div.wrapper').length > 0) { $('#container #mainContent #contentBody #flightDetailsContainer #flightDetailsModConnecting div.wrapper').removeClass("wrapper").addClass("wrapperWithoutBackground"); $(".firstDivide, .secondDivide").css("top", "-5px"); }

        if ($('li.showExtraFilters a').length > 0) { $('li.showExtraFilters a').click(function() { var target = $(this); if (target.hasClass('less')) { target.removeClass('less').text('More ...').parent('li').siblings('.extraFilters').removeClass('show'); } else { target.addClass('less').text('Less ...').parent('li').siblings('.extraFilters').addClass('show'); } }) }
    }
    $(".airLineAnchor").each(function() {
        $(this).bind("click", function(e) {
            e.preventDefault(); $(".parentAirLineDetailToolTip").addClass("hide");
            $(".uplineDownlineAirLineDetailToolTip").addClass("hide");
            if ($(".airLineDetailToolTip").hasClass != true) { $(".airLineDetailToolTip").addClass("hide"); }
            $(this).next().children(".airLineDetailToolTip").removeClass("hide");
        })
    })

    //remove border from last td for code share flights
    $('.codeShareChild').each(function() {
        $(this).find('tr:last').addClass('noBorder');
    })

    $(".closeAirDetail").bind("click", function(e) { e.preventDefault(); $(".airLineDetailToolTip").addClass("hide"); })
    $(".errorMsg").attr("style", ""); if ($(".chevronNav ul").hasClass("item4active") && $(".chevronNav ul li").hasClass("item1Blue")) { $(".chevronNav ul li.item1Blue").addClass("item1"); $(".chevronNav ul li.item1Blue").removeClass("item1Blue"); }
    if ($('#searchFilterTabs').length > 0) {
        var arriveFlight = $('#panelHolder .ArrivingFlightSearch');
        var departFlight = $('#panelHolder .DepartingFlightSearch');
        var connectFlight = $('#panelHolder .connectingFlightSearch');
        var lblOrigin = $('label[for=origin]');
        var lblDestination = $('label[for=destination]');
        if ($('.currentSelectionStatus').val() == "0") {
            $('#searchFilterTabs .arrive').addClass('active');
            arriveFlight.removeClass('hide');
            departFlight.addClass('hide');
            connectFlight.addClass('hide');

        };
        if ($('.currentSelectionStatus').val() == "1") {
            $('#searchFilterTabs .depart').addClass('active');
            arriveFlight.addClass('hide');
            departFlight.removeClass('hide');
            connectFlight.addClass('hide');

        };
        if ($('.currentSelectionStatus').val() == "2") {
            $('#searchFilterTabs .connect').addClass('active');
            arriveFlight.addClass('hide');
            departFlight.addClass('hide');
            connectFlight.removeClass('hide');
            if ($.browser.msie) {
                $('#' + btnSumbmitConnectionClientID).css('top', '165px');
            }
            else {
                $('#' + btnSumbmitConnectionClientID).css('top', '147px');
            }
        };
    }


    $('.flightSearchStatus111').each(function(i) {
        var idx = i;
        $(this).bind('click', function() {

            if (idx == 0) {
                $('.currentSelectionStatus').val("0");
            }
            if (idx == 1) {
                $('.currentSelectionStatus').val("1");
            }
            if (idx == 2) {
                $('.currentSelectionStatus').val("2");
                if ($.browser.msie) {
                    $('#' + btnSumbmitConnectionClientID).css('top', '165px');
                }
                else {
                    $('#' + btnSumbmitConnectionClientID).css('top', '147px');
                }

            }
        });

    });
    if ($.browser.msie && $.browser.version == "6.0") { var mHeight = $('#flightDetailsModConnecting').height(); $('.firstDivide').height(mHeight); $('.secondDivide').height(mHeight); }
    var normDPI = 96; var browser = navigator.appName; if ((screen.deviceXDPI == screen.logicalXDPI) && (screen.deviceXDPI > normDPI) && browser == "Microsoft Internet Explorer") { $('body').css('font-size', '.5em'); $('select').css('font-size', '1.3em'); }
});                                function loadpage(){}
function unloadpage(){if(document.getElementById){document.getElementById('divLoading').style.visibility='visible';}
else{if(document.layers){document.divLoading.visibility='visible';}
    else { document.all.divLoading.style.visibility = 'visible'; } 
}

}

function Redirect(url) {
    var currUrl = url;
    window.location = "http://" + location.host + "/" + url;    
}

function IamArriving() {

    $("#" + arrivingSpanClientID).addClass('active');
    $("#" + departingSpanClientID).removeClass('active');
    $("#" + connectingSpanClientID).removeClass('active');

    $('#' + departingPanelClientID).hide();
    $('#' + connectingPanelClientID).hide();
    $('#tblArriving').removeClass('hide');
    $('#' + arrivingPanelClientID).show();

    $('.aflight').val("");
    $('.dflight').val("");
    
    $('#' + txtArrivingFlightNumberClientID).val("");
    $('#' + vgFlightFinderClientID).text("");
    $('#' + txtDepartingFlightNumberClientID).val("");
    $("#" + hdnSearchSelectionStatusClientID).val("0");
    $('#' + btnSumbmitConnectionClientID).css('top', '62px');
}
function IamDeparting() {

    $("#" + arrivingSpanClientID).removeClass('active');
    $("#" + departingSpanClientID).addClass('active');
    $("#" + connectingSpanClientID).removeClass('active');

    $('#' + arrivingPanelClientID).hide();
    $('#' + connectingPanelClientID).hide();
    $('#tblDeparting').removeClass('hide');
    $('#' + departingPanelClientID).show();

    $('.aflight').val("");
    $('.dflight').val("");
    
    $('#' + txtArrivingFlightNumberClientID).val("");
    $('#' + vgFlightFinderClientID).text("");
    $('#' + txtDepartingFlightNumberClientID).val("");

    $("#" + hdnSearchSelectionStatusClientID).val("1");
    $('#' + btnSumbmitConnectionClientID).css('top', '62px');
}
function IamConnecting() {

    $("#"+arrivingSpanClientID).removeClass('active');
    $("#" + departingSpanClientID).removeClass('active');
    $("#" + connectingSpanClientID).addClass('active');
    
    $('#' + arrivingPanelClientID).hide();
    $('#' + departingPanelClientID).hide();
    $('#tblConnecting').removeClass('hide');
    $('#' + connectingPanelClientID).show();

    $('.aflight').val("");
    $('.dflight').val("");
    
    $('#' + txtArrivingFlightNumberClientID).val("");
    $('#' + vgFlightFinderClientID).text("");
    $('#' + txtDepartingFlightNumberClientID).val("");

if ($.browser.msie) {
    $('#' + btnSumbmitConnectionClientID).css('top', '165px');
    }
    else{
    $('#' + btnSumbmitConnectionClientID).css('top', '147px');
    }
    $("#" + hdnSearchSelectionStatusClientID).val("2");
}
function displayUplineDownline(divId)
{
    $(".airLineDetailToolTip").addClass("hide");
    $(".parentAirLineDetailToolTip").addClass("hide");
    $(".uplineDownlineAirLineDetailToolTip").addClass("hide");
    $("div#"+divId).show();
    $("div#"+divId).removeClass("hide");    
}
function closeUplineDownline(divId)
{
    $("div#"+divId).hide();
}
function displayParentInfo(ItemNo, flightid) {
    $(".airLineDetailToolTip").addClass("hide");
    $(".parentAirLineDetailToolTip").addClass("hide");
    $(".uplineDownlineAirLineDetailToolTip").addClass("hide");
    $("div#divParent" + ItemNo).show();
    $("div#divParent" + ItemNo).removeClass("hide");
    GetFlightInformation_AJAX(ItemNo, flightid);
}
function closeParentInfo(ItemNo) {
    $("div#divParent" + ItemNo).hide();
}

function GetFlightInformation_AJAX(ItemNo, flightid) {
    $.ajax({
        dataType: 'json',
        url: '/fillFlightinformation?flightid=' + flightid,
        success: function(data) {
        $("div#divParent" + ItemNo).html(MakeHtml(data.Airline.AirlineName, data.Airline.AirlineLogo, ItemNo, data.FlightNumber));
        },
        failure: function(data) {
            $("div#divParent" + ItemNo).html(MakeHtmlError(ItemNo, "Not able to process request as of now."));
        },
        error: function(data) {
            $("div#divParent" + ItemNo).html(MakeHtmlError(ItemNo, "Not able to process request as of now."));
        }
    });
}
function MakeHtml(AirlineName, Logo, ItemNo, FlightNo) {
    var html = "";
    var baseAddress = document.getElementById(hdnBaseAdd).value;
    var url = baseAddress + Logo;

    html += "<div class='detailWrapper'><div class='operatedBy'><span>Operated by: </span></div>";
    html += "<img src='" + url + "' />";
    html += "<div class='details'><h4>" + AirlineName + "</h4><span class='flightNumber'>Flight: " + FlightNo + "</span></div></div>";

    return html;
}
function MakeHtmlError(ItemNo, Message) {
    var html = "";
    html += "<div class='detailWrapper'><div class='operatedBy'><span>Operated by:</span></div>";
    html += "<div class='details'><h6>" + Message + "</h6></div></div>";

    return html;
}

function MakeMapLinks(myLinks) {
    
	   $("#map area").each(function(i) {
            var currentIndexId = $(this).attr("id");
            var currentIndexVal = myLinks[parseInt(currentIndexId.indexOf('_')==-1 ? currentIndexId :     currentIndexId.substr(0,currentIndexId.indexOf('_')))]; /*Getting value from Array for each <area href="">*/
       
       $(this).attr("href", currentIndexVal); /*setting value from Array for each <area href="">*/
        });
    //}
	   

}
 

