var countdown = "";
jQuery(document).ready(
		function(){
			jQuery('a.previous').each(
				function(){
					var li_count = jQuery(this).parents('div.widget-static-block').find('ul.products-grid li').length;
					var width = li_count * 182;
					jQuery(this).parents('div.widget-static-block').find('ul.products-grid').css('width',width);
				}
			);
			jQuery('ul.products-grid').each(
				function(){		
					var	hhalf = new String(jQuery(this).css('width'));
					var half = hhalf.replace('px','');	
					jQuery(this).css('left',-half/2 + 55);
				}
			);			
			
			jQuery('a.previous').mouseenter(
				function(){
					var id = new String(jQuery(this).parents("div.widget-static-block:first").attr('id'));					
					countdown = setInterval("moveLeft('#"+id+" ul.products-grid')",50);
					return false;
				}
			);		
			jQuery('a.previous').mouseleave(
				function(){
					clearInterval(countdown);
					return false;
				}
			);				
			jQuery('a.next').mouseenter(
				function(){
					var id = new String(jQuery(this).parents("div.widget-static-block:first").attr('id'));					
					countdown = setInterval("moveRight('#"+id+" ul.products-grid')",50);				
					return false;
				}
			);		
			jQuery('a.next').mouseleave(
				function(){
					clearInterval(countdown);
					return false;
				}
			);	
		}
);
	function moveLeft(elem){
		var eelem_left = new String(jQuery(elem).css('left'));
		var elem_left = eelem_left.replace('px','');
		
		var wwwidth = new String(jQuery(elem).css('width'));		
		var wwidth = wwwidth.replace('px','');	
		var width = -wwidth;
		
		if(elem_left > (width+450) ){
			jQuery(elem).animate({left: '-=10'},10);			
		}				
	}
	function moveRight(elem){		
		var eelem_left = new String(jQuery(elem).css('left'));
		var elem_left = eelem_left.replace('px','');
		
		if(elem_left < -10){
			jQuery(elem).animate({left: '+=10'},10);
		}		
	} 
