$().ready(function()
{
	$('.addcart').click(function()
	{
		var product_id = $(this).attr('id');
		$.ajax({  
			type: "GET",
			url: "/buy_ajax.php",
			data: "buy="+product_id+"",
			cache: false,
			beforeSend: function(){
				/*$(".loadingWindow").css("display","inline").html(loadingWindow(''));*/
				$("#addcart"+product_id).html("<img src='/i/loading.gif' align='absmiddle' />");
			},
			success: function(data){  
				if (data=="true") $("#addcart"+product_id).html("<img border='0' src='/i/fav.png' align='absmiddle'>  Товар находится в Вашей корзине."); else $("#addcart"+product_id).html(data);
				

				fdgb();
				cart_block();
				/*if (data=='success') $(".loadingWindow").text("Фильм добавлен в Вашу корзину");
				setTimeout("$('.loadingWindow').fadeOut(300)", 1500);*/
				/*$("#content_photos").html(html);  */
			}  
		});  
	});
});

function fdgb()
{
        $.blockUI({ 
            message: "<img src='/i/success.png' align='absmiddle' /> <b>Фильм добавлен в Вашу корзину</b>", 
            fadeIn: 700, 
            fadeOut: 700, 
            timeout: 3000, 
            showOverlay: false, 
            centerY: true, 
            css: { 
                width: '350px', 

                border: 'none', 
                padding: '15px', 
                backgroundColor: '#b10260', 
                '-webkit-border-radius': '10px', 
                '-moz-border-radius': '10px', 
                opacity: .8, 
                color: '#fff' 
            } 
        }); 
}

function jalert(text)
{
        $.blockUI({ 
            message: "<b>"+text+"</b>", 
            fadeIn: 700, 
            fadeOut: 700, 
            timeout: 2000, 
            showOverlay: false, 
            centerY: true, 
            css: { 
                width: '350px', 

                border: 'none', 
                padding: '15px', 
                backgroundColor: '#b10260', 
                '-webkit-border-radius': '10px', 
                '-moz-border-radius': '10px', 
                opacity: .8, 
                color: '#fff' 
            } 
        }); 
}

function cart_block()
{
		$.ajax({  
			type: "GET",
			url: "/cart_ajax.php",
			data: "",
			cache: false,
			beforeSend: function(){

			},
			success: function(data){  
				$("#content_cart_block").html(data);
			}  
		});  

}