function Marquee(divId,speed) {
    var txtDiv=document.getElementById(divId);
    var moveDiv=txtDiv.cloneNode(true);
    txtDiv.innerHTML="";
    txtDiv.appendChild(moveDiv);
    moveDiv.style.position = "relative";
    moveDiv.style.width="auto";
    ScrollLeft(moveDiv,speed);
    
	function ScrollLeft(obj,speed){
	    var step=2;
	    if (obj.offsetLeft!=-obj.offsetWidth) {
	        obj.style.marginLeft=(obj.offsetLeft-step)+"px";
	    }else {
	        obj.style.marginLeft=obj.parentNode.offsetWidth+"px";
	    }
	    window.setTimeout(function(){ScrollLeft(obj,speed);},speed);
	}
}
	/**startmarquee(div,子标签,一次滚动条数,速度,停留时间);**/
	function marquee2(mqdivid,tagName,n,speed,delay){
	    var $obj=$('#'+mqdivid); 
	    $obj.scrollTop(0); 
	    var mr=window.setInterval(function(){scrolling();},speed);
	    //$obj.hover(function(){clearInterval(mr)},function(){mr=setInterval(function(){scrolling();},speed)});
	    function scrolling(){ 
	        if($obj.scrollTop()<$obj.children(tagName).first().outerHeight()*n){ 
	            $obj.scrollTop($obj.scrollTop()+2); 
	        }else{ 
	        	window.clearInterval(mr); 
	            $obj.children(tagName).first().appendTo($obj);
	            $obj.scrollTop(0);
	            window.setTimeout(function(){mr=setInterval(function(){scrolling();},speed)},delay); 
	        } 
	    } 
	} 

$(document).ready(function(){
	$("a[rel='external']").attr("target","_blank");
	$(".tab dt").children("a").bind("mousemove",function(){switchTab($(this))});
    
	function switchTab($obj){
	    var $dd=$obj.parent().siblings("dd").eq($obj.prevAll("a").length);
		$obj.addClass("curr").siblings("a.curr").removeClass("curr");
		$dd.show().siblings("dd").hide();
	};
	function scrollTab($tab,speed){
        $tab.each(function(){
            var $obj=$(this);
            var mr=window.setInterval(function(){scrolling($obj);},speed);
            $obj.hover(function(){clearInterval(mr)},function(){mr=setInterval(function(){scrolling($obj);},speed)});
            //window.setTimeout(function(){scrolling($obj);},speed);
        });
	    function scrolling($obj){
	        var $a=$obj.find("dl dt a.curr");
	        switchTab($a.next("a").length>0?$a.next("a"):$a.prevAll("a:last"));
	    };
	};
	
});

