// Javascript required for every page

$(function(){

    // Insert menu span tags as Inflight can't do them
    $('#mainMenu a').wrapInner('<span></span>');

    // Return to top
    $('#return').click(function(){
         $('html, body').animate({scrollTop: '0px'}, 300);
         return false;
    });

	// Insert span tags into footer menu 
    $('#footer li a')
        .not(':last')
        .after('<span>|</span>');
        
    // Header hover stuff
    $('#headerLinks .rollover').hide();
    $('#headerLinks a.roloLink')
        .click(function(){
            return false;
        })
        .mouseover(function(){
           $(this).next().fadeIn(100);
        });

    // $('#headerLinks .rollover')
    //     .mouseout(function(){
    //         $(this).hide();
    //     });
        
        // .hover(function(){
        //    $(this).next().fadeIn(100);
        // }, function(){
        //    // $(this).next().hide();
        // });
        
    // Search box focus
    $('#searchForm .text')
        .focus(function(){
            if($(this).attr("value") == 'Search') $(this).attr("value", "");
        })
        .blur(function(){
            if($(this).attr("value") == "") $(this).attr("value", 'Search');
        });

    $('#searchResultsForm .text')
        .focus(function(){
            if($(this).attr("value") == 'Search Again') $(this).attr("value", "");
        })
        .blur(function(){
            if($(this).attr("value") == "") $(this).attr("value", 'Search Again');
        });
});