jQuery(document).ready(function() {
		if(($sp =jQuery('div.product_box,div.related_box'))[0]) {
			var scroll_number = jQuery("#scroll_number").text()?jQuery("#scroll_number").text():5;
			jQuery("#prev_scroll").hide();
			jQuery("#next_scroll").hide();
			jQuery("#spnext").show();
			jQuery("#spprev").show();
			var page = 1;
			var liCount = jQuery('#splist>div').length;
			var pageTotal = Math.ceil(liCount / 5);
			if (pageTotal > 1) {
				var unitWidth = (jQuery('#splist>div:first').width()) * scroll_number+100;
				//var unitHeight = $sp.find('div.productlist').height();
				//var $pageList = $sp.find('.pagelist');
				//$pageList.html('Page 1  of '+pageTotal);
				jQuery('#spprev').click(function(){
					if(!jQuery('#splist').is(":animated")){
					   if(page == 1){
							//here fix a IE6 bug about change img src 
							jQuery('#noprevimg').show().siblings().hide();
						}else{
							//$('#splist').animate({ 'marginTop' : '+='+unitHeight}, 400); 
							jQuery('#splist').animate({ 'marginLeft' : '+='+unitWidth}, 500); 
							//$pageList.html('Page '+(--page)+'  of '+pageTotal);
							--page;
							jQuery('#noprevimg')[page == 1 ? 'show' : 'hide']().siblings()[page > 1 ? 'show' : 'hide']();
							jQuery('#nonextimg')[page == pageTotal ? 'show' : 'hide']().siblings()[page < pageTotal ? 'show' : 'hide']();
						}
					}
				}).css('outline','none');
				jQuery('#spnext').click(function(){
					if(!jQuery('#splist').is(":animated")){
						 if(page == pageTotal){
							jQuery('#nonextimg').show().siblings().hide();
						}else{
							//$('#splist').animate({ 'marginTop' : '-='+unitHeight}, 400); 
							jQuery('#splist').animate({ 'marginLeft' : '-='+unitWidth}, 500); 
							//$pageList.html('Page '+(++page)+'  of '+pageTotal);
							++page;
							jQuery('#noprevimg')[page == 1 ? 'show' : 'hide']().siblings()[page > 1 ? 'show' : 'hide']();
							jQuery('#nonextimg')[page == pageTotal ? 'show' : 'hide']().siblings()[page < pageTotal ? 'show' : 'hide']();
						}
					}
				}).css('outline','none');
			}//end of if pageTotal > 1
	  }
	})