$(window).load(function () {
	
	flobu = new flower_bubble ({
		base_obj: $( '#cart_list' ),
		base_dir: document.location.pathname,
		background: { css: 'white', opacity: 0.78 },
		//bubble: { image: '../img/bubble.png', width: 130, height: 98 },
		flower: { image: '../img/flower.gif', width: 32, height: 32 },
		block_mode: 'base_obj'
	}) ;

	 
	var timer;
	
	 function postData (obj) {
		 
		var pattern=new RegExp("(Issue|Subscription|Book):([0-9:]+)");
		var str = obj.attr('name').match(pattern);
		flobu.disable();
		
		jQuery.post('koszyk.html?submit[updateQuantity]', {
			item: str[0],
			quantity: obj.val()
		}, function(data) {		
			window.location.reload();	
			flobu.disable();
			//$('.summary.quantity').text(data.summary.quantity);
		}, "text");
		
	}
	 
	 
	
	$('input.quantity').each(function () {
		$(this).keyup( function() {
			
			var _obj = $(this);
			timer = setTimeout( function () { postData(_obj); } , 1500);
			timer2 = setTimeout( function () { flobu.enable(); } , 500);
		});		
	})
	
	
	
	
});
