var CartnumOrTotals = true;
/* set to true if using totals on the top */
$(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',quantityonly:CartnumOrTotals},function (html) {

				var image = $(pr).offset();
				var cart  = $('span#cartnum').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#cartnum').width(),height : $('span#cartnum').height()};
				$('#temp').animate(params, 'slow',false,function () {$("#temp").remove();});
				if (CartnumOrTotals === true) {
          var str = html.split("<>");
		      var s = $('span#cartnum').html()*1 + 1;
					$('span#cartnum').html(s).next("span").next("span").children(".cartnumm").html("&#163;" + trim(str[str.length-1]));
				} else {
					$('span#cartnum').html(html);
				}
			});
		});
	});
	$('.newarrivals .special').each(function() {
		$(this).find('a.prodbutton').eq(0).click(function() {
			var pr = $(this).parent('.special').find('img').eq(0);
			$.post('/index.php?route=module/cart/callback',{product_id:$(this).next("input").eq(0).val(),quantity:'1',justone:'true',quantityonly:CartnumOrTotals},function (html) {
				var image = $(pr).offset();
				var cart = $('span#cartnum').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#cartnum').width(),height : $('span#cartnum').height()};
				$('#temp').animate(params, 'slow',false,function () {$("#temp").remove();});
				if (CartnumOrTotals === true) {
           var str = html.split("<>");
					var s = $('span#cartnum').html()*1 + 1;
					$('span#cartnum').html(s).next("span").next("span").children(".cartnumm").html("&#163;" + trim(str[str.length-1]));
				} else {
					$('span#cartnum').html(html);
				}
			});
		});
	});
});
$(".centralright").ready(function () {
	$(this).find("a.add").each(function (k) {
		$(this).click(function () {
			var pr = $(this).parent("div").parent("td").parent("tr").parent("tbody").find("img").eq(0);
			$.post('/index.php?route=module/cart/callback',{product_id:$(this).next("input").eq(0).val(),quantity:'1',justone:'true',quantityonly:CartnumOrTotals},function (html) {

				var image = $(pr).offset();
				var cart  = $('span#cartnum').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#cartnum').width(),height : $('span#cartnum').height()};
				$('#temp').animate(params, 'slow',false,function () {$("#temp").remove();});
				if (CartnumOrTotals === true) {
					var str = html.split("<>");
					var s = $('span#cartnum').html()*1 + 1;
					$('span#cartnum').html(s).next("span").next("span").children(".cartnumm").html("&#163;" + trim(str[str.length-1]));
				} else {
					$('span#cartnum').html(html);
				}
			});
		return false;
		});
	});
});
