/*远东文化、服务、公益活动栏目切换JS开始*/
function GetObj(objName){
if(document.getElementById){
return eval('document.getElementById("' + objName + '")');
}else if(document.layers){
return eval("document.layers['" + objName +"']");
}else
{return eval('document.all.' + objName);}
}

function YdHuan(idx){
for(var i=1;i<4;i++){
if(GetObj("ydbt"+i)) GetObj("ydbt"+i).className = "whb";
if(GetObj("ydlist"+i)) GetObj("ydlist"+i).style.display = "none";
}
GetObj("ydbt"+idx).className = "wha";
GetObj("ydlist"+idx).style.display = "block";
if (idx==1){
	GetObj("ydinfoimg1").style.display="block";
	GetObj("ydinfoimg2").style.display="none";
	GetObj("ydinfoimg3").style.display="none";
}else if (idx==2){
	GetObj("ydinfoimg1").style.display="none";
	GetObj("ydinfoimg2").style.display="block";
	GetObj("ydinfoimg3").style.display="none";
}else{
	GetObj("ydinfoimg1").style.display="none";
	GetObj("ydinfoimg2").style.display="none";
	GetObj("ydinfoimg3").style.display="block";
}
}
/*远东文化、服务、公益活动栏目切换JS结束*/

/*远东环境滚动效果*/
function goup(){
	var ydhj=document.getElementById("ydhj");
	ydhj.scrollTop-=ydhj.offsetHeight+7;
}
function godown(){
	var ydhj=document.getElementById("ydhj");
	if ((ydhj.scrollHeight-ydhj.scrollTop)>ydhj.offsetHeight*2)
		ydhj.scrollTop+=ydhj.offsetHeight+7;
}

/*远东头部滚动文字*/
/*var srolltxtid=0;
var nowheight=0;
var lineheights=0;
var counts=1;
var txtid;
var jj=6;
function startsrolltxt(){
	txtid=GetObj("srolltxt");
	if (counts==1)
		lineheights=txtid.offsetHeight;
	counts++;
	jj=jj+2;
	nowheight+=lineheights;
	srolltxtid=setInterval(goscroll,50);
}
function goscroll(){
	if ((txtid.scrollHeight-txtid.scrollTop)>lineheights){
		if (txtid.scrollTop<nowheight+jj)
			txtid.scrollTop+=2;
		else{
			clearInterval(srolltxtid);
			setTimeout(startsrolltxt,5000);
		}
	}else
	{
		clearInterval(srolltxtid);
		jj=9;
		nowheight=0;
		txtid.scrollTop=0;
		setTimeout(startsrolltxt,5000);
	}
}*/

    function txtscroll(c, config,mb) {
	    this.config = config ? config : {start_delay:3000, speed: 10, delay:4000, scrollItemCount:1,movecount:6};
	    this.container = document.getElementById(c);
	    this.pause = false;
	    var _this = this;
    	
	    this.init = function() {
		    _this.scrollTimeId = null;
		    setTimeout(_this.start,_this.config.start_delay);
	    }
    	
	    this.start = function() {
		    var d = _this.container;
		    var line_height = d.getElementsByTagName(mb)[0].offsetHeight;
		    if(d.scrollHeight-d.offsetHeight>=line_height) _this.scrollTimeId = setInterval(_this.scroll,_this.config.speed)
	    };
    	
	    this.scroll = function() {
		    if(_this.pause)return;
		    var d = _this.container;d.scrollTop+=2;
		    var line_height = d.getElementsByTagName(mb)[0].offsetHeight;
		    if(d.scrollTop%(line_height*_this.config.scrollItemCount)<=1){
			    if(_this.config.movecount != undefined)
				    for(var i=0;i<_this.config.movecount;i++){d.appendChild(d.getElementsByTagName(mb)[0]);}
			    else for(var i=0;i<_this.config.scrollItemCount;i++){d.appendChild(d.getElementsByTagName(mb)[0]);}
			    d.scrollTop=0;
			    clearInterval(_this.scrollTimeId);
			    setTimeout(_this.start,_this.config.delay);
		    }
	    }    	
	    this.container.onmouseover=function(){_this.pause = true;}
	    this.container.onmouseout=function(){_this.pause = false;}
    }

    var scrolltxtdiv;
     function init_scrolltxt(){
         scrolltxtdiv = new txtscroll('srolltxt', {start_delay:3000, speed: 150, delay:0, scrollItemCount:1,movecount:1},"li");
			scrolltxtdiv.init();
     }
    
    if(window.attachEvent){
        window.attachEvent("onload", function(){
       init_scrolltxt();
        });
    }else if(window.addEventListener){
        window.addEventListener("load", function(){
        init_scrolltxt();        
        }, false);    
    }
    
