$(document).ready(function(){

    //TOP_MENU_EFFECTS

    $('#top_menu > ul > li').hover(
        function() {
            $(this).addClass("active");
            var ul_width = $(this).find('ul').width();
            var ul_height = $(this).find('ul').innerHeight();
            $(this).find('.ul').css({height:0,width:0,visibility:"visible"}).show().stop(true, true).animate({width:ul_width,height:ul_height,opacity:1},220);
            $(this).find('.description').stop(true, true).animate({opacity:0},"fast");
            $(this).find('.title').css({position:"absolute", top:0, right:5}).stop(true, true).animate({top:35},"fast");
        },

        function() {
            $(this).removeClass("active");
            $(this).find('.ul').stop(true, true).animate({width:0,opacity:0,height:0},"fast");
            $(this).find('.description').stop(true, true).animate({opacity:1},"15000");
            $(this).find('.title').stop(true, true).animate({top:0},"fast");
        }
    );

    $("#top_menu li:last-child a").addClass("last");


    //IMAGE SAVE PROTECTION
    $("img").bind("contextmenu", function(e){
        return false;
    });

    // LEFT_MENU EFFECTS

    $("#left-menu > li").hover(function(){
        $(this).addClass("hover");
        $(this).find('.ul_ul').css({left:400,opacity:0}).stop(true, true).animate({opacity:1,left:280}, 180);
    },
    function(){
        $(this).removeClass("hover");
        $(this).find('.ul_ul').stop(true, true).animate({opacity:0,left:400},"slow");

    });

    // LAZY_LOAD
    $(function() {
        $("img").lazyload({
            effect  : "fadeIn"
        });
    });

    // CATALOG IMAGES
    $('.catalog-section .section .block').hover(function() {
            //$(this).css({cursor:'pointer'})
            $(this).find('.roll').addClass("active");
            //console.log(this);
            $(this).find('.roll').css({left:260}).stop(true, true).animate({left:270},"fast");
        },
        function() {
            $(this).find('.roll').removeClass("active");
            $(this).find('.roll').stop(true, true).animate({left:260},"fast");

        }
    );

    // new_products hover
        $('#new_products td').hover(function(){
            var Class = $(this).attr("class");
            var Class = ('.'+Class);
            $(Class).find('.catalog-item-card').addClass('hover');
        },
        function() {
            var Class = $(this).attr("class");
            var Class = ('.'+Class);
            $(Class).find('.catalog-item-card').removeClass('hover');
        }
    );

    // new_products hover
        $('#new_products .catalog-item-card').hover(function(){
            $(this).addClass('active');
            $('.active .right').addClass('hover');
/*            var a_height = $(this).find('.right').height();
            //console.log(a_height);
            $(this).find('.right').css({height:a_height});*/
        },
        function() {
            $('.active .right').removeClass('hover');
            $(this).removeClass('active');
        }
    );

});

