
(function($){	
		//
		$.fn.textScroll=function(settings){
			st=$.extend({
				line: 5,
				speed: 400,
				interval: 1000,
				hoverStop:true
			},settings);
			var dl=$(this).find("dl").eq(0);
			var lineHeight=dl.find("dd").eq(0).height();
			var marginUp=-lineHeight*st.line+"px";
			var line = st.line;
			function scrollUp(){
				dl.animate({marginTop:marginUp},st.speed,function(){															
					for(var j=0;j<line;j++){
						dl.find("dd").eq(0).appendTo(dl);						
					}
					dl.css({marginTop:"0px"});
				});	
			}
			var timer=setInterval(function(){scrollUp();},st.interval);
			if(st.hoverStop){
				dl.hover(function(){
					clearInterval(timer);				  
				},function(){
					timer=setInterval(function(){scrollUp();},st.interval);	
				});	
			}
		}
		
		//Banner切换
		$.fn.bannerSlide=function(settings){
			st=$.extend({
				width: 950,
				height: 230,
				numStyle: "numStyle",
				numCurr: "numCurr",
				effect: "slide",
				interval: 4000,
				speed: 800
			},settings);
			st.currIndex=0;		
			st.thisObj=$(this);
			st.actionTime=null;
			$(this).css({	position:"relative", width:st.width+"px", height:st.height+"px", overflow:"hidden", zoom:1 });
			$(this).find("ol,ul,li").css({listStyle:"none", padding:"0px", margin:"0px"});
			$(this).find("li").css({width:st.width+"px", height:st.height+"px", overflow:"hidden"});
			$(this).find("img").css({border:"none"});
			$("."+st.numStyle).children().each( function(n){$(this).attr("index",n)} );
			if(st.effect=="slide"){
				$(this).children("ul").css({ position:"absolute", top:"0px", left:"0px"});
				$("."+st.numStyle).children().click(function(){
					clearTimeout(st.actionTime);
					thisIndex=parseInt($(this).attr("index"));
					slideImage(thisIndex);
				});
				slideImage(0);
			}
			if(st.effect=="fade"){
				$(this).children("ul").css({position:"relative", height:st.height+"px"})
				.children("li").css({position:"absolute", width:st.width+"px", left:"0px", top:"0px" })
				.eq(0).css({zIndex:1});	
				$("."+st.numStyle).children().click(function(){
					clearTimeout(st.actionTime);
					thisIndex=parseInt($(this).attr("index"));
					fadeImage(thisIndex);
				});
				fadeImage(0);
			}
			function slideImage(index){
				if(index==st.thisObj.find("ul > li").length) st.currIndex=0;
				else st.currIndex=index;
				ulPos=-st.currIndex*st.height+"px";
				st.thisObj.children("ul").stop().animate({top:ulPos},st.speed);
				$("."+st.numStyle).children().eq(st.currIndex).addClass(st.numCurr).siblings().removeClass(st.numCurr);
				st.currIndex++;
				st.actionTime=setTimeout(function(){slideImage(st.currIndex)},st.interval);
			}
			function fadeImage(index){
				if(index==st.thisObj.find("ul > li").length) st.currIndex=0;
				else st.currIndex=index;
				st.thisObj.find("ul > li").eq(st.currIndex).fadeIn(st.speed).siblings().fadeOut(st.speed);
				$("."+st.numStyle).children().eq(st.currIndex).addClass(st.numCurr).siblings().removeClass(st.numCurr);
				st.currIndex++;
				st.actionTime=setTimeout(function(){ fadeImage(st.currIndex) },st.interval);
			}
		}

})(jQuery);