$(document).ready(function(){
    if ($.browser.msie && (parseInt($.browser.version) <= 6)) {
        $("body").empty();
        $.cookie("old", true);
        if ($.cookie("old")){
            alert("Вы используете очень старую версию браузера! Пожалуйста, обновите ваш браузер!");
        }
    }

    $("#catalog_index > ul > li").click(function(){
        var $current = $(this);
        var noopen = false;
        if ($current.hasClass("opened")) noopen = true;
        var $opened = $(".opened").find("ul");
        if ($opened.length > 0){
            $opened.slideUp(100, function(){
                if (!noopen) $current.addClass("opened").find("ul").slideDown();
            }).parent().removeClass("opened");
        } else {
            $current.addClass("opened").find("ul").slideDown();
        }
    });

    $("a.current_opened")
            .parent()
            .show()
            .addClass("opened")
            .parent()
            .find(".sidebar_menu_header > a")
            .addClass("selected");
    $(".current").show().addClass("opened");

/*    $(".sidebar_menu_header").click(function(){
        if (   $(this).parent().children(".hidding_submenu").hasClass("opened")   ){
            $(".opened").slideUp().removeClass("opened");
        } else {
            $(".opened").slideUp().removeClass("opened");
            $(this).parent().children(".hidding_submenu").slideDown().addClass("opened");
        }
    })*/
    $(".show_form").fancybox({
        'titlePosition'		: 'inside',
        'transitionIn'		: 'none',
        'transitionOut'		: 'none',
        'scrolling'       : 'none'
    });
    $(".link-container").hover(
        function(){
            $(this).find("div.showflag").show();
        },
        function(){
            $(this).find("div.showflag").hide();
        }
    );
});

/*********************************************************/

$(document).ready(function(){
    $(".fancyshow").fancybox({
        'opacity'		: true,
        'overlayShow'	: false,
        'transitionIn'	: 'elastic',
        'transitionOut'	: 'none'
    });
});

$(document).ready(function(){
    if ($.browser.msie && (parseInt($.browser.version) <= 6)) {
        $("body").empty();
        $.cookie("old", true);
        if ($.cookie("old")){
            alert("Вы используете очень старую версию браузера! Пожалуйста, обновите ваш браузер!");
        }
    }

    $("a.current_opened")
            .parent()
            .show()
            .addClass("opened")
            .parent()
            .find(".sidebar_menu_header > a")
            .addClass("selected");
    $(".current").show().addClass("opened");
/*    $(".sidebar_menu_header").click(function(){
        if (   $(this).parent().children(".hidding_submenu").hasClass("opened")   ){
            $(".opened").slideUp().removeClass("opened");
        } else {
            $(".opened").slideUp().removeClass("opened");
            $(this).parent().children(".hidding_submenu").slideDown().addClass("opened");
        }
    })*/
    $(".show_form").fancybox({
        'titlePosition'		: 'inside',
        'transitionIn'		: 'none',
        'transitionOut'		: 'none',
        'scrolling'       : 'none',
        onComplete: function(){
            var $close_btn = $(".inline").find("#close_btn");
            if ($close_btn.length>0){
                $("#fancybox-close").css("display", "none");
            }
        }
        /*,
        onStart : function(){
            $('#submit').addClass("rc10");
            rocon.update($('#submit').target);
        }*/
    });
    $("#close_btn").click(function(){
        $("#fancybox-close").click();
    });
    $(".link-container").hover(
        function(){
            $(this).find("div.showflag").show();
        },
        function(){
            $(this).find("div.showflag").hide();
        }
    );

});
