(function($) {

    $(document).ready(function() {

        $(window).load(function() {
            $('.splash-overlay').show();
            $('.splash').show();
            if ($.browser.msie && ($.browser.version == '6.0')) {
                var yScroll;
                if (self.pageYOffset) {
                    yScroll = self.pageYOffset;
                } else if (document.documentElement && document.documentElement.scrollTop) {
                    yScroll = document.documentElement.scrollTop;
                } else if (document.body) {
                    yScroll = document.body.scrollTop;
                }

                $('.splash').css('top', (yScroll + ($(window).height() - $('.splash').height()) / 2));
            }
        });

        $('.splash-links a').click(function() {
            $('.splash').hide();
            $('.splash-overlay').hide();
            //return false;
        });

        if ($.browser.msie && ($.browser.version == '6.0')) {
            $('.splash-overlay').each(function() {
                $(window).load(updateSplashOverlay);
                $(window).resize(updateSplashOverlay);
            });

            $(window).scroll(function(e) {
                var yScroll;
                if (self.pageYOffset) {
                    yScroll = self.pageYOffset;
                } else if (document.documentElement && document.documentElement.scrollTop) {
                    yScroll = document.documentElement.scrollTop;
                } else if (document.body) {
                    yScroll = document.body.scrollTop;
                }

                $('.splash').css('top', (yScroll + ($(window).height() - $('.splash').height()) / 2));
            });

            $(window).resize(function() {
                var yScroll;
                if (self.pageYOffset) {
                    yScroll = self.pageYOffset;
                } else if (document.documentElement && document.documentElement.scrollTop) {
                    yScroll = document.documentElement.scrollTop;
                } else if (document.body) {
                    yScroll = document.body.scrollTop;
                }

                $('.splash').css('top', (yScroll + ($(window).height() - $('.splash').height()) / 2));
            });
        }

    });

    function updateSplashOverlay() {
        var body = $(document.body);
        $('.splash-overlay').css({width:body.width(), height:body.height()});
        delete body;
    }

})(jQuery);
