jQuery(document).ready(function($) {
    $('a.js_switcher_menu').live('click', function(event){
        event.preventDefault();


        $(this).fadeTo('fast', 0.001, function(){
            if($.browser.msie){
                $(this).get(0).style.removeAttribute('filter');
            }

            var that = this;

            $('#focus').fadeIn('fast', function(){
                if($.browser.msie){
                    $(this).get(0).style.removeAttribute('filter');
                }

                //make sure the focus element fits the page correctly
                if($(this).height() < window.innerHeight){
                    $(this).height(window.innerHeight + 'px');
                }
                if($(this).height() < ( $('#switcher_menu').height() + 280 )){
                    $(this).height( $('#switcher_menu').height() + 280 );
                }

                $('#focus').live('click', function(){
                    $(this).fadeOut('fast');
                    $(that).fadeTo('fast', 1, function(){
                        if($.browser.msie){
                            $(this).get(0).style.removeAttribute('filter');
                        }
                    });
                }).children('#switcher_menu_wrapper').children().click(function(e){e.stopPropagation();});
            });
        });

    });

    $(window.innerHeight);
});