$(document).ready(function(){    var in_content=$("#cartcontent").html();    $(".itemColors .itemColor img").click(function () {        $(".itemColors .itemColor img").removeClass("active");        $(this).addClass("active");                var ID_img=$(this).attr('id');        var ID_type=(ID_img.substring(0,3));            ID_img=(ID_img.substring(4));                        var img_height=$(".l_photo img").attr('height');        var img_width=$(".l_photo img").attr('width');                if (ID_type=='img') {            $("#goods_additionally").val(ID_img);            $("#cartcontent").html(in_content);        }                $.getJSON("/body/includes/library/catalog-img.php?type="+ID_type+"&id="+ID_img, function(data){            $.each(data.items, function(i,item){                $(".l_photo").html(item.content_img);                if (ID_type=='img') {                    $("#title_goods").text('Описание '+item.content_h2);                    $("#description_goods").html(item.content_description);                     $("#goods_status").html(item.content_status);                                     }            });        });                         //$(".l_photo").css('height',img_height);        //$(".l_photo").html('<div style="padding-top:'+Math.round(img_height/2)+'px; padding-left:'+Math.round(img_width/2)+'px"><img src="/images/loader.gif" border="0" width="32" height="32"></div>');    });        $("td h2 .countUp, td h2 .countDown").click(function() {        var Typeaction=$(this).attr('class');        var IDaction=$(this).parents('tr').attr('id');            IDaction=(IDaction.substring(10));                $.getJSON("/body/includes/library/catalog-cart-action.php?id="+IDaction+"&action="+Typeaction, function(data){            $.each(data.items, function(i,item){                if (item.content_count_all==0) {                    $(".contentcart").html('<div class="title" style="padding-top:250px;">В моей корзине ничего нет</div><br/><br/><h2><a href="/">— Это легко исправить</a></h2>');                }                else {                    if (item.content_count==0) $("#goodscart_"+IDaction).hide();                    else {                        $("#goodscart_"+IDaction+" .actioncart h2 b").html(item.content_count);                                                $("div.cart_title b:first").html(item.content_count_top);                        $("div.cart_title b:last").html(item.content_price_top);                    }                }            });        });            });        $(".removecart").click(function() {        var listclear='';                $(":input[name=cart_remove]:checked").each(function (i) {            var IDrem=$(this).attr('id');                IDrem=(IDrem.substring(7));                        $("#goodscart_"+IDrem).hide();                        listclear+=IDrem;            if (i+1!=$(":input[name=cart_remove]:checked").length) listclear+=',';                    });                if (listclear!='') {            $.getJSON("/body/includes/library/catalog-cart-action.php?remove="+listclear, function(data){                $.each(data.items, function(i,item){                    if (item.content_count==0) {                        $(".contentcart").html('<div class="title" style="padding-top:250px;">В моей корзине ничего нет</div><br/><br/><h2><a href="/">— Это легко исправить</a></h2>');                    }                    else {                        $("div.cart_title b:first").html(item.content_count);                        $("div.cart_title b:last").html(item.content_price);                    }                });            });        } else alert('Вы не выбрали позиции для удаления');        return false;            });        $(".buy_sign, .buy_clearance").click(function() {                if ($(this).find("img").attr('id')=='s_1') {            $("#s_1").attr('src','/images/checked.png');            $("#s_2").attr('src','/images/check.png');            $(".type_1").show();            $(".type_2").hide();        }        else if ($(this).find("img").attr('id')=='s_2') {            $("#s_1").attr('src','/images/check.png');            $("#s_2").attr('src','/images/checked.png');            $(".type_1").hide();            $(".type_2").show();        }       });        $(".back_catalog").click(function() {        window.location='/';    });        $(".order_more").click(function() {        var IDmore=$(this).attr('href');            IDmore=(IDmore.substring(1));                $("div#info-"+IDmore).slideToggle("slow");        $(this).toggleClass("order_moreactive");         return false;            });        //Комментарии    $(".slideCommentary").click(function(){        $("#myComment").slideToggle("slow");        return false;    });    $(".slideCommentaryList").click(function(){        $(".listcomment").slideToggle("slow");        return false;    });                $('#carousel').jcarousel({        auto: 8,        scroll: 1,        wrap: "both",        buttonNextHTML: "<div></div>",        buttonPrevHTML: "<div></div>"    });            //$('#carousel_goods').jcarousel({//        vertical: true,//        scroll: 2,//        auto: 5,//        wrap: "both"//    });        //Каталог    $("div.item").hover(function() {        $(this).css({'border':'1px solid #E4E4E4'});        $(this).find("a").css({'text-decoration':'underline'});        $(this).find(".more a").css({'display':'block'});    }, function() {        $(this).css({'border':'1px solid #FFF'});        $(this).find("a").css({'text-decoration':'none'});        $(this).find(".more a").css({'display':'none'});    });        $("a.show_m").click(function(){        $(".m_hidden").slideToggle("slow");                return false;    });});function preload(images) {     if (typeof document.body == "undefined") return;     try {         var div = document.createElement("div");         var s = div.style;         s.position = "absolute";         s.top = s.left = 0;         s.visibility = "hidden";         document.body.appendChild(div);         div.innerHTML = "<img src=\"" + images.join("\" /><img src=\"") + "\" />";     } catch(e) {         // Error. Do nothing.     } } function AddCart(goods,additionally) {    if (additionally!='') {        if ($("#goods_additionally").val()==0) alert(additionally);        else {            $.getJSON("/body/includes/library/catalog-cart.php?type=additionally&id="+$("#goods_additionally").val(), function(data){                $.each(data.items, function(i,item){                    $("#cartcontent").html(item.content_msg);                    $("#cartcontenttop").html(item.content_cart);                });            });        }    }    else {        $.getJSON("/body/includes/library/catalog-cart.php?type=major&id="+goods, function(data){            $.each(data.items, function(i,item){                $("#cartcontent").html(item.content_msg);                $("#cartcontenttop").html(item.content_cart);            });        });    }        return false;}function RemoveComment (comment_id) {    $.get("/body/includes/library/remove-commentary.php?id="+comment_id, function(data){        if (data=='remove') {            $("#comment_"+comment_id+" .textComment").html('<font color=\"#ff0000\">отзыв удален</font>');                               }         });    return false;         }
