(function($){
	$.fn.ADRoll=function(settings){
		settings = jQuery.extend({
        	speed : "normal",
			timer : 1000,
			imgHeight:"289"
    	}, settings);
		return this.each(function() {
			$.fn.ADRoll.scllor( $(this), settings );
    	});
	};
	$.fn.ADRoll.scllor=function(_this,settings){
	
		var index=0;
		var li=_this.children("ul").children("li");
		var num = li.size();
		var showBox=_this.children("ol");
		
		li.hover(function(){
			if(intervalTime){
				clearInterval(intervalTime);
			}
			index=li.index(this);
		
			intervalTime = setTimeout(function(){
				ShowAD(index);
			},100);
		},function(){
			clearInterval(intervalTime);
			intervalTime = setInterval(function(){
				ShowAD(index);
				index++;
				if(index==num){
					index=0;
				}
			},settings.timer)
		});
		showBox.hover(function(){
			if(intervalTime){
				clearInterval(intervalTime);
			}
		},function(){
			clearInterval(intervalTime);
			intervalTime=setInterval(function(){
				ShowAD(index);
				index++;
				if (index == num) {
					index = 0;
				}
			}, settings.timer);
		});
		var intervalTime= setInterval(function(){
			
			ShowAD(index);
			index++;
			if(index==num){
				index=0;
			}
		},settings.timer);
		var ShowAD=function(i){
			showBox.animate({"top":-i*settings.imgHeight},settings.speed);
			li.eq(i).addClass("h_pon").siblings().removeClass("h_pon");
		};
	};
})(jQuery);

