﻿$(document).ready(function() {

    $(".search").focus(function() {
        if (this.value == 'SEARCH') {
            this.value = '';
        };
    }).blur(function() {
        if (this.value == '') {
            this.value = 'SEARCH';
        };
    });

    $('#omnibar').hover(function() {
        $(this).stopTime().stop(true, false).animate({
            top: "0px"
        });
    }, function() {
        $(this).oneTime(1300, function() {
            var pos = (Math.min($(window).scrollTop(), 24) - 24) * -1
            $(this).stop(true, false).animate({
                top: pos - 24 + "px"
            });
        });
    });

    $(window).scroll(function() {
        var pos = (Math.min($(window).scrollTop(), 24) - 24) * -1;
        $('#omnibar').stop(true, true).css("top", pos - 24 + "px");
    });

    $('.tab-panel .buttons a').click(function() {
        $('.tab-panel .selected').removeClass('selected');
        $(this).addClass('selected');
        $('.tab-panel .content').contents().css('display', 'none');
        $('.tab-panel .content .' + $(this).attr('rel')).css('display', 'table-cell');
        return false;
    });
});
