$(document).ready(function () {
	$(".proditem").each(function (j) {
		$(this).find("a.prodbutton").eq(0).click(function () {
			var pr = $(this).parent("div.proditem").find("img").eq(0);
			$.post('/index.php?route=module/cart/callback',{product_id:$(this).next("input").eq(0).val(),quantity:'1',justone:'true'},function (html) {

				var image = $(pr).offset();
				var cart  = $('span.cartnumm').offset();
				var l = image.left;
				$("div.outer").before('<img src="' + $(pr).attr('src') + '" id="temp" style="position: absolute; top: ' + image.top + 'px; left: ' + image.left + 'px;z-index:2000" />');
				var params = {top : cart.top + 'px',left : cart.left + 'px',opacity: 0.0,width : $('span.cartnumm').width(),height : $('span.cartnumm').height()};
				$('#temp').animate(params, 'slow',false,function () {$("#temp").remove();});

        			    var str = html.split("<>");
		        	    var s = $('span.cartnumm').html()*1 + 1;
				$('span.cartnumm').html(s).next("span").html("items &#163;" + trim(str[1]));
				var w = 120 - $('span.cartnumm').width()*1;
				w = (w <= 90)?w:90;
				$('span.cartnumm').next('span').css("width",w+"px");
			});
		});
	});
});
$(".centralright").ready(function () {
	$(this).find("a.add").each(function (k) {
		$(this).click(function () {
			var pr = $(this).parent("p").find("img").eq(0);
			$.post('/index.php?route=module/cart/callback',{product_id:$(this).next("input").eq(0).val(),quantity:'1',justone:'true'},function (html) {

				var image = $(pr).offset();
				var cart  = $('span.cartnumm').offset();
				var l = image.left;
				$("div.outer").before('<img src="' + $(pr).attr('src') + '" id="temp" style="position: absolute; top: ' + image.top + 'px; left: ' + image.left + 'px;z-index:2000" />');
				var params = {top : cart.top + 'px',left : cart.left + 'px',opacity: 0.0,width : $('span.cartnumm').width(),height : $('span.cartnumm').height()};
				$('#temp').animate(params, 'slow',false,function () {$("#temp").remove();});

        		    var str = html.split("<>");
		            var s = $('span.cartnumm').html()*1 + 1;
				$('span.cartnumm').html(s).next("span").html("items &#163;" + trim(str[1]));
				var w = 120 - $('span.cartnumm').width()*1;
				w = (w <= 90)?w:90;
				$('span.cartnumm').next('span').css("width",w+"px");
			});
		return false;
		});
	});
});
