﻿Sys.Application.add_init(function() {
    $(document).ready(function() {
        //$.splash();
        var n = $("img").size();
        //alert("# of images = " + n);
        $(function() {
            if ($.browser.safari) {
                if ($("img").size() == n) {
                    //alert("# of images = " + n);
                    $("img").load(function() {
                        $.equalize($(".column_wrap"));
                        $.equalize($(".left_sub_col"));
                        $.stretch($(".left_btm_box"));
                        $.stretch($(".left_sub_col"));
                        $.stretch($(".stretch"));
                        $.stretchSub($("#content_sub"), $(".right_btm_box"));
                    });
                }
            }
            else {
                
                $.equalize($(".column_wrap"));
                $.equalize($(".left_sub_col"));                
                $.stretch($(".left_btm_box"));
                $.stretch($(".left_sub_col"));                
                $.stretch($(".stretch"));                
                $.stretchSub($("#content_sub"), $(".right_btm_box"));

            }
        });
        $("ul.sf-menu").superfish();
        $(".hover").hover(function() {
            $(this).attr("src", $(this).attr("src").split(".").join("_hvr."));
        }, function() {
            $(this).attr("src", $(this).attr("src").split("_hvr.").join("."));
        });
        $('#focus').cycle({
            fx: 'fade',
            speed: 1100,
            timeout: 7000,
            cleartype: 0, // enable cleartype corrections
            next: '#focus_next',
            prev: '#focus_back',
            pager: '#focus_nav',
            pause: 1
        });

        $('.home_feature:last').css('background-image', 'none');

        $('#btnSplash').click(function() {
            $.splash("replay");
        });

        $('#splash_skip_link').click(function() {
            $.resetSplash();
            $.unblockUI({ fadeOut: 2000 });
            setTimeout(function() { $('html,body').animate({ scrollTop: 0 }, 1000); }, 2000);
        });
    });
});