window.addEvent('domready', function(){
	prods=$$('div.product');
	setTimeout('removeOffers()', 3000);
});

function removeOffers(){
	if(ls=$('latest-stock')){
		ls.setStyle('overflow', 'hidden');
		new Fx.Tween(ls, {onComplete:function(){
			ls.destroy();
			if(prods.length>5){
				setTimeout('initScroller()', 2000);
			}
		}}).start('width', 0);
	}
}
function initScroller(){
	container=$('products-container-inner');
	container.setStyle('margin-left', -192);
	window.squeezer=new Element('DIV');
	window.squeezer.setStyles({
		width:192,
		float:'left',
		height:250,
		backgroundColor:'#FFF'
	});
	window.squeezer.inject(container, 'top');
	window.squeezer.squeeze=new Fx.Tween(window.squeezer, {onComplete:function(){
			shiftProduct();
	}});
	doScroll();
}

function doScroll(){
	window.squeezer.squeeze.start('width' ,0);
}

function shiftProduct(){
	$$('div.product')[0].dispose().inject(container, 'bottom');
	window.squeezer.setStyle('width', 192);
	setTimeout('doScroll()', 2000);
}
