jQuery.noConflict();

var TopMenu = {
    isActive: false,
    
    init: function() {
        jQuery('#MenuBar > li').hover(
            function () {
                var oSubmenu = jQuery(this).children('ul');
                if(oSubmenu.length) {
                    oSubmenu.stop(true, true);
                    oSubmenu.slideDown('slow');
                    
                    TopMenu.isActive = jQuery(this).find('a').hasClass('active');
                    if (!TopMenu.isActive) {
                        jQuery(this).children('a').addClass("active");
                    }
                }
            },

            function () {
                var oSubmenu = jQuery(this).children('ul');
                if(oSubmenu.length) {
//                    oSubmenu.stop(true, true);
                    oSubmenu.slideUp('slow');

                    if (!TopMenu.isActive) {
                        jQuery(this).children('a').removeClass("active");
                    }
                }
            }
        );
        if (window.name == 'fullscreenwnd' /*&& !window.toolbar.visible*/) {
            
            jQuery('#full-screen').css('display','none');
            jQuery('#minimize-screen').css('display','block');
            
            jQuery('#minimize-screen').click(function(){
                window.close();
                window.opener.location.href = location.href;
            });
            
        } else {
            jQuery('#full-screen').css('display','block');
            jQuery('#minimize-screen').css('display','none');            
            
            jQuery('#full-screen').click(function(){
                open(location.href, 'fullscreenwnd','fullscreen=1,location=0,menubar=0,status=0,resizable=0,toolbar=0,top=0,left=0,width='+screen.availWidth+',height='+screen.availHeight);
            });            
        }
    }
};

jQuery(document).ready(function () {
    TopMenu.init();
});

