/* ------------------------------------------------------------------------
首页新闻焦点
------------------------------------------------------------------------- */

var n=0;
var showNum = document.getElementById("num");
function Mea(value){
	n=value;
	setBg(value);
	plays(value);
	}
function setBg(value){
	for(var i=0;i<7;i++){
	   if(value==i){
	     document.getElementById("a"+value).className='act';      
			}	else{	
			 document.getElementById("a"+i).className='nor';
			}  
	} 
}
function plays(value){ 
		 for(i=0;i<7;i++){
			  if(i==value){			  
			  	document.getElementById("pc_"+value).style.display="block";
			  	//alert(document.getElementById("pc_"+value).style.display)
			  }else{
			    document.getElementById("pc_"+i).style.display="none";			    
			  }			
		}	
}

function clearAuto(){clearInterval(autoStart)}
function setAuto(){autoStart=setInterval("auto(n)", 5000)}
function auto(){
	n++;
	if(n>6)n=0;
	Mea(n);
} 
function sub(){
	n--;
	if(n<0)n=6;
	Mea(n);
} 
setAuto(); 




/* ------------------------------------------------------------------------
首页滚动公告
------------------------------------------------------------------------- */

onload=function(){abc(Main1);}
function abc(str1){
this.Main1=str1;
    if(typeof(A)!="undefined"){clearInterval(A);}
    A=setInterval("DownLoop(Main1,A)",50);
}

function DownLoop(str,M){
	this.bb=str.scrollTop++;
	if(str.scrollTop==this.bb){str.innerHTML=str.innerHTML+str.innerHTML;}
	str.onmousemove=function(){clearInterval(M);}
	str.onmouseout=function(){abc(Main1);}
}




/* ------------------------------------------------------------------------
首页专家
------------------------------------------------------------------------- */

function slideLine(ul, delay, speed, lh) {
	var slideBox = (typeof ul == 'string')?document.getElementById(ul):ul;
	//add by alineo
	var slideBox2 = (typeof ul == 'string')?document.getElementById(ul):ul;
	for(var i=0;i<slideBox2.childNodes.length;i++){
		if(slideBox2.childNodes[i].nodeType==1){
			if(slideBox2.childNodes[i].tagName == "UL")
				slideBox2 = slideBox2.childNodes[i];
				break;
		}
	}
	var delay = delay||2000, speed=speed||20, lh = lh||20;
	var tid = null, pause = false;
	var start = function() {
		tid=setInterval(slide, speed);
	}
	var slide = function() {
		if (pause) return;
		slideBox.scrollTop += 2;
		if (slideBox.scrollTop % lh == 0) {
			clearInterval(tid);
			slideBox2.appendChild(slideBox2.getElementsByTagName('li')[0]);
			slideBox.scrollTop = 0;
			setTimeout(start, delay);
		}
	}
	slideBox.onmouseover=function(){pause=true;}
	slideBox.onmouseout=function(){pause=false;}
	setTimeout(start, delay);
}

