var CartUpdate = new Class({
	
	initialize : function() {
	
		var stickyWindows = $$('div.StickyWinInstance');
		if (stickyWindows.length > 0) {
			var stickyWindowToTest = stickyWindows[0].retrieve('StickyWin');
			stickyWindowToTest.destroy();
			$('itemCart').removeEvents();
		}
		
		var cartRequest = new Request({
			method : 'get',
			url : '/WebModules/CatCatalog/CartView.aspx',
			onComplete : function(response) {
				var stickyWindow = new StickyWin({ content : response, relativeTo: $('itemCart'), position:'upperRight' ,offset : { x: -197, y: 46} });
				stickyWindow.hide();
				$('itemCart').addEvent('click', function() {
					if ($chk(this)) {
						this.show();
					}
				}.bind(stickyWindow));
			},
			noCache : true
		});
		cartRequest.send();
		
		var itemRequest = new Request({
			method : 'get',
			url : '/WebModules/CatCatalog/CartView.aspx?ItemTotal=true',
			onComplete : function(response) {
				$('itemTotal').set('html', response);
			},
			noCache : true
		});
		itemRequest.send();
	}
	
});
