$(function(){
	
	var i=setInterval(function(){
		if($('.spec_offer_scroller_prod_wrap:eq(0) img:eq(0)').height() > 0){
			var scrollDelay = 4000;
			var scrollTime = 4000;
			
			$('#spec_offer_scroller_inner').css('margin-top','0px');
			
			var thisH = 0;
			var biggestH = 0;
			$('.spec_offer_scroller_prod_wrap').each(function(){
				//thisH = $(this).height();
				thisPH = $('a:eq(1)',this).height();
				thisIH = $('a:eq(0) img',this).height();
				
				if(thisPH > thisIH){
					thisH = thisPH;
				}else{
					thisH = thisIH;
				}
				
				thisH += 5;
				
				//alert(thisH+' '+thisPH+' '+thisIH);
				if(thisH > biggestH){
					biggestH = thisH;
				}
			});
			
			biggestH *= 2;
			
			if($.browser.msie){
				$('#spec_offer_scroller_wrap').css('height',biggestH+'px')
			}else{
				$('#spec_offer_scroller_wrap').height(biggestH);
			}
			
			$('#spec_offer_scroller_inner').css('position','absolute');
			
			var scrollHeight = $('.spec_offer_scroller_prod:eq(0)').height();
			$('#spec_offer_scroller').height(scrollHeight);
			
			var i2 = setInterval(function(){
				
				var prodCount = $('.spec_offer_scroller_prod:eq(1) div.spec_offer_scroller_prod_wrap').length;
				
				if(prodCount==1){
					$('.spec_offer_scroller_prod:eq(2) div.spec_offer_scroller_prod_wrap:eq(0)').remove().appendTo($('.spec_offer_scroller_prod:eq(1)'));
				}
				
				var currentMargin = $('#spec_offer_scroller_inner').css('margin-top').replace('px','');
				var newHeight = ($('.spec_offer_scroller_prod:eq(1)').height());
				var newMargin = $('.spec_offer_scroller_prod:eq(0)').height() * -1;
				
				$('#spec_offer_scroller').animate({height:(newHeight)+'px'},scrollTime);
				$('#spec_offer_scroller_inner').animate({marginTop:newMargin+'px'},scrollTime,function(){
					$('.spec_offer_scroller_prod:first',$(this)).remove().appendTo($(this));
					$(this).css('margin-top','0px');
				});
			},(scrollDelay + scrollTime));
			clearInterval(i);
		}
	},100);
	
	
});