var basket = {
	lastBasketInfoId : -1,
	timeout : null,
	storeId : -1,

	add : function(catEntryId, singleItem, caller) {
		var that = this;
		basketHelper.addToOrder(new Array(catEntryId), singleItem, {
			onComplete: function(response) {
				if (response.orderItemIds && response.orderItemIds.length > 0) {
					that._showPopup(caller);
					AjaxSCS.reRender('Static Layouts/Right Column/Basket', that.storeId, null);
				}
			}
		});
	},
	
	_showPopup : function(elm) {
		var id = 'addToBasketPopup';
		
		if ($('#' + id).length > 0) {
			// Remove current popup
			clearTimeout(this.timeout);
			$('#' + id).remove();
		}
		
		// Create new popup
		var popup = document.createElement('div');
		$(popup).attr('id', id);
		$(elm).after(popup);
		$(popup).css({
			'background' : 'transparent url(/pix/basket_add.png) 0 0 no-repeat',
			'width' : '200px',
			'height' : '56px',
			'position' : 'absolute',
			'top' : ($(elm).find('img:first').position().top - 56) + 'px',
			'left': ($(elm).find('img:first').position().left - 157) + 'px'
		});
		
		if ($.browser.msie && $.browser.version=="6.0") {
			// Special styling for IE6 to support transparent background
			$(popup).css({
				'background-image' : 'none',
				'filter' : 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=/pix/basket_add.png, sizingMethod="scale"'
			});
		}
		
		this.timeout = setTimeout(function() {
			$(popup).fadeOut(500, function() {
				$(this).remove();
			});
		}, 2000);
	}
};