	jQuery(function($){
		$('.showBox').each(function(){
			var $showBox = $(this),
			$itemList = $showBox.find('ul.itemList'),
			$items = $itemList.find('li'),
			$adContent = $items.find('.adContent'),
			_margin = (parseInt($adContent.css('margin-left')) || 0) + (parseInt($adContent.css('margin-right')) || 0),
			width = $showBox.width() + _margin,
			speed = 400;

			if($.browser.msie && !($.browser.msie && /msie 8\.0/i.test(window.navigator.userAgent.toLowerCase()))){
				width -= _margin;
			}
				
			var rollStr = '';
			$items.each(function(i, ele){
				rollStr += '<a href="#">'+i+'</a>';
			});

			$showBox.find('.roll').html(rollStr).find('a').click(function(){
				move($(this).index());
			}).eq(0).addClass('on');
				
			$showBox.find('.prev, .next').click(function(){
				var no = $showBox.find('.roll a.on').index();
				no = ($(this).attr('className').indexOf('prev')>-1 ? (no - 1 + $items.length) : (no + 1))  % $items.length;
				move(no);

				return false;
			});
				
			function move(no){
				$itemList.stop().animate({
					left: width * no * -1
				}, speed);
				$showBox.find('.roll a').eq(no).addClass('on').siblings().removeClass('on');
			}
		});
		
		$('.showBox a').focus(function(){
			this.blur();
		});
	});
