$(function(){
		$('.zs').each(function(){
			var $zs = $(this),
			$itemList = $zs.find('ul.itemList'),
			$items = $itemList.find('li'),
			$adContent = $items.find('.nr'),
			_margin = (parseInt($adContent.css('margin-left')) || 0) + (parseInt($adContent.css('margin-right')) || 0),
			width = $zs.width() + _margin,
			speed = 400, no= no2 =ro= rollStr='', tt, ckt = ckno = false, dl = 3000,
			_title = $zs.find('.title');
			if($.browser.msie && !($.browser.msie && /msie 8\.0/i.test(window.navigator.userAgent.toLowerCase()))){
				width -= _margin;
			}
			$items.each(function(i, ele){
				rollStr += '<a href="#">'+i+'</a>\r\n';
			});

			$zs.find('.roll').html(rollStr).find('a').click(function(){
				clearTimeout(tt);
				ckt = true;
				ckno = true;
				ro = $(this).index();
				movet();
				return false;
			}).eq(0).addClass('on');

			$zs.find('.prev, .next').click(function(){
				clearTimeout(tt);
				ckt = true;
				no = ($(this).attr('className').indexOf('prev') > -1 ? 1 : 0);
				movet();
				return false;
			});

			function movet(){
				if (ckno) {
					no2 = ro;
				} else {
					if (no == 0) {
						no2 = ($zs.find('.roll a.on').index()+1) % $items.length;
					} else if (no == 1) {
						no2 = ($zs.find('.roll a.on').index()- 1 + $items.length) % $items.length;
					} else {
						no2 = ($zs.find('.roll a.on').index() + 1) % $items.length;
					}
				}
				$itemList.stop().animate({
					left: width * no2 * -1
				}, speed);

				$zs.find('.roll a').eq(no2).addClass('on').siblings().removeClass('on');
				if (!ckt) tt = setTimeout(movet, dl);
			}
			movet();

			$zs.mouseenter(function(){
				clearTimeout(tt);
			}).mouseleave(function(){
				ckt = false;
				ckno = false;
				tt = setTimeout(movet, dl);
			});

		});
		
		$('a').focus(function(){
			this.blur();
		});
	});
