jQuery(document).ready(function(){
	
	jQuery.fn.plug= function(options){
		var defaults={
		auto: 0,
		speed:3000
		}
		

		var obj=jQuery(this);
		var options = jQuery.extend(defaults, options); 
		var tt_scroll=0;
		
		var ul_long=jQuery("ul",obj).height();
		
		var li_first=jQuery("ul li:first",obj).height();
		var li_last=jQuery("ul li:last",obj).height();
		
		jQuery(".c_html li h3").click(function(){
											   
					tt_scroll=0;	
					jQuery("ul",obj).css("margin-top","0px");
					jQuery("ul li.active",obj).removeClass("active");
					jQuery("ul li:first",obj).addClass("active");
											   })
		
		jQuery(".bt a.next",obj).click(function(){
			
				if(ul_long-li_last<=tt_scroll)
				{
					
					tt_scroll=0;
					jQuery("ul",obj).animate({marginTop:0},1000);
					jQuery("ul li.active",obj).removeClass("active");
					jQuery("ul li:first",obj).addClass("active");
				}
				else{
					
					var scroll_w=jQuery("ul li.active",obj).height();
					tt_scroll+=scroll_w;
					jQuery("ul",obj).animate({marginTop:-tt_scroll},1000);
					jQuery("ul li.active",obj).removeClass("active").next().addClass("active");
				}	
				return false;
		})
		
		jQuery(".bt a.prev",obj).click(function(){
		if(tt_scroll<=0)
		{
				jQuery("ul",obj).stop(true,false ).animate({marginTop:0},1000);
				jQuery("ul li.active",obj).removeClass("active");
				jQuery("ul li:first",obj).addClass("active");
		}
		else
		{
			var scroll_w=jQuery("ul li.active",obj).prev().height();
			tt_scroll-=scroll_w;
			
			jQuery("ul",obj).stop(true,false ).animate({marginTop:-tt_scroll},1000);
			jQuery("ul li.active",obj).removeClass("active").prev().addClass("active");
		}	return false;
		})
		var settime;
		if(options.auto==0)
		{
			settime=setInterval(function(){
					
				jQuery(".bt a.next",obj).click();
				},options.speed)
			
				jQuery(".sroll_2").hover(function(){
					clearInterval(settime);
				},function(){
					settime=setInterval(function(){
					
					jQuery(".bt a.next",obj).click();
				},options.speed)
				})
		}

		
	}
	
	
})
