﻿// When page has loaded...
$(function() { 
 $("#lnkFooterUs").toggle(
      function () {
         $(".FooterNotes").slideDown("slow");
      }, 
      function () {
        $(".FooterNotes").slideUp("slow");
      }
    );



    jQuery.tablesorter.addParser({
    id: "GBPNumber",
    is: function(s) {   
        return false;  
    },  
    format: function(s) {
        var regLinkStart = /^[<a].*[>]/;
        var regLinkEnd = /<\/a>.*/;  
        return s.trim().replace(/\n/,'').replace(regLinkStart,'').replace(regLinkEnd,'').replace(/GBP/,'').replace(/USD/,'').replace(/EUR/,'').replace('*','');
    },  
    type: "numeric"
    });
   
    $(".flf_grd").tablesorter({
        headers: { 1:{ sorter:'GBPNumber'}},
        sortList: [[1,0]]
    });
    
    $(".ajax__tab_outer").hover(
        function(){
            $(this).addClass("blackHover");
            $(this).find("span").addClass("blackHover");
        },
        function()
        {            
            $(this).removeClass("blackHover");
            $(this).find("span").removeClass("blackHover");
        }
    );
    
    // Allow click of whole tab not just text
    $(".ajax__tab_outer").click(function()
    {  
        window.location.href = $(this).find("a").attr("href");
    });
    
    $("img.informationIcon").mouseover(function()
    {  
        openBreakdowns(this);
    });
    
});
       
function openBreakdowns(obj) 
{  
    closeBreakdowns();
    //$(obj).next("div").animate({opacity: "show", top: "0", left: "-250px"}, "fast");  
    $(obj).next("div").show()
}

function closeBreakdowns()
{
    //$("div.fareBreakdown").animate({opacity: "hide", top: "0", left: "-250px"}, "fast");
    $("div.fareBreakdown").hide();
}
 
document.writeln('<style type="text/css">');
document.writeln('div.fareBreakdown {        width: 250px;        position: absolute;        top: 0px;        left: -220px; _left: -260px;     display: none;        border: 1px solid #9A9A9A;        background: #FFFFFF; ;}')
document.writeln('div.FooterNotes { display:none;}');
document.writeln('</style>');
