$(document).ready(function () {
    // Search box
    $('#search-box').focus(function () {
        if ($(this).val() == 'SEARCH (type here and hit enter)') {
            $(this).toggleClass('active').val('')
        };
    }).blur(function () {
        if ($(this).val() == '') {
            $(this).toggleClass('active').val('SEARCH (type here and hit enter)');
        };
    }).parents('div')
    .siblings('input:submit').css('display','none');

    
    // Flash (glow) effect
    $('#secondary-content a img').hover(
        function () {
            $(this).fadeTo(100, 0.5);
            $(this).fadeTo(500, 1);
        },
        function (){}
    );

    // Forms submission / errors
    $('.success').css('display', 'none');
    $('.success').fadeIn(5000);
    $('.errors').css('display', 'none');
    $('.errors').fadeIn(3000);

    // jQuery Date Picker
    if ( $('.jquery-datepicker').length )
        $('.jquery-datepicker').datepicker({
            dateFormat: 'yy-mm-dd'
        });

    // Scroll smoothly to anchors
    // http://flesler.blogspot.com/2007/10/jqueryscrollto.html
    // http://flesler.blogspot.com/2007/10/jquerylocalscroll-10.html
    $.localScroll.hash();
        
    $.localScroll({
        hash: true,
        easing:'easeInQuart'
    });

});
