(function($) {

    window.site = {

        init: function() {
            if (h.element_exists('#top_nav .topnav')) {
                $('#top_nav .topnav > li > a').each(function() {
                  var $this = $(this)
                  $this.parent().attr('id', $this.html().toLowerCase());
                });
            }
            if (h.element_exists('#exhibitions')) {
                var $exhibitions = $('#exhibitions');
                $exhibitions.mouseover(function(){
                    $exhibitions.find('.topnav_nested_ul, .list_wrapper').show();
                }).mouseout(function(){
                    $exhibitions.find('.topnav_nested_ul, .list_wrapper').hide();
                });
            }
            if (h.element_exists('#sub_nav')) {
                var $i = $('#sub_nav ul li:last a');
                $i.width($i.width() - 40);
            }
            if (h.element_exists('.section-news .subsection-news-record .date')) {
                var $d = $('.section-news .subsection-news-record .date');
                $('#main_content #content_module').remove($d).prepend($d);

            }
            if (h.element_exists('#sidebar .sidebar_inner')) {
                $('#sidebar').height($('#sidebar .sidebar_inner').height());
            }
            if (h.element_exists('.page-exhibitions') && h.element_exists('.back_to_exhibitions_link')) {
                var $link = $('.back_to_exhibitions_link');
                $link.remove();

                $('#content_module').append('<div class="divider inner"></div>');
                $('#content_module').append($link);
            }
        }

        // add site specific functions here

    };

    $(document).ready(function() {

        window.site.init();
    });


})(jQuery);


