$(document).ready(function(){$("div.downloadPrice span").mouseover(function(){$(this).addClass("hover");$(".dropDown").show("medium")});$("#drop1 li a").click(function(){$(".dropDown").hide("medium");$(".downloadPrice span").removeClass("hover")});$("div.dropDown").hover(function(){$(this).css("display","block")},function(){$(this).hide("medium");$(".downloadPrice span").removeClass("hover")});
        $(".in_cart").submit(function(){

            var number = $(this).find(".form-number").val();
            var id = $(this).find(".form-product-id").val();
            var button = $(this).find("button");
            var width = parseInt(button.css("width"));
            button.html('<div id="indicator_'+id+'" style="width:' + (width) + 'px;"><img style="padding-left:' + (width/2-10) + 'px" src="/images/indicator.gif"/></div>');

            $.ajax({
                async:false,
                type: "POST",
                url: $(this).attr("action"),
                data: {'number' : number, 'product_id' : id, 'skip_layout' : 1},
                dataType: "json",
                success: function(response){
                    $("#number-product-in-cart").html(response.number);
                    $("#amount-product-in-cart").html(response.amount);
                    
                    $.jGrowl("Товар добавлен в корзину", {
                        life: 2000
                    });
                    $("#indicator_" + id).parent().html($(".in_cart").find("button").val());
                }
            });

            return false;
        });

        $(".cart_delete_product").click(function(){
            $(this).parent().parent().parent().remove();
        });

        
         $("a[rel^='prettyPhoto']").prettyPhoto({theme:'dark_rounded'});
        
});
