jQuery(document).ready(function () {

    //sub navigation slidedow
    jQuery("ul#navigation > li").hover(function () {

        jQuery(this).find('ul').slideDown();

    }, function () {

        jQuery(this).find('ul').stop(true, true).slideUp();

    })

    //remove bottom border from the last sub nav items
    jQuery("ul#navigation > li > ul").each(function () {

        jQuery(this).find('li:last').css({ 'border': '0px' });

    });

    //newsletter slidedown
    jQuery("#newsletter_top a").toggle(function () {

        jQuery(this).css({ 'background': 'transparent url(/images/newsletter_show_hide.gif) 222px bottom no-repeat' });
        jQuery(this).parent().next().slideDown(function () {

            jQuery(this).find('input.submit').fadeIn();

        });

    }, function () {

        jQuery(this).parent().next().find('input.submit').hide();

        jQuery(this).css({ 'background': 'transparent url(/images/newsletter_show_hide.gif) 222px -2px no-repeat' });
        jQuery(this).parent().next().slideUp();

    })

    //correct borders of event li's
    jQuery("div#sidebar #events #events_top ul li:first").css({ 'border-top': '0px' })
    jQuery("div#sidebar #events #events_top ul li:last").css({ 'border-bottom': '0px', 'padding-bottom': '10px' });

    //scroll to top
    jQuery('a[href=#top]').click(function () {

        jQuery('html, body').animate({ scrollTop: 0 }, '2500');

        return false;

    });

})
