//bottom

var p1=new Image();
var p2=new Image();
var p3=new Image();
var p4=new Image();
p1.src="http://img.xplus.com/site/new/main_bg1_4.gif";
p2.src="http://img.xplus.com/site/new/main_bg1_5.gif";
p3.src="http://img.xplus.com/site/new/main_bg2_2.gif";
p4.src="http://img.xplus.com/site/new/over_1.gif";

function g(o){return document.getElementById(o);}
function HoverLi(n){

for(var i=1;i<=3;i++){g('tb_'+i).className='normaltab';g('tbc_0'+i).className='undis';}
g('tbc_0'+n).className='dis';g('tb_'+n).className='hovertab';
}
function HoverZTTP(n){
for(var i=1;i<=5;i++){
	if(g('tb_'+i)!=null){
		g('tb_'+i).className='zttag0';
	}
	if(g('tbc_0'+i)!=null){
		g('tbc_0'+i).className='undis';
	}
}
	if(g('tbc_0'+n)!=null){
		g('tbc_0'+n).className='dis';
	}
	if(g('tb_'+n)!=null){
		g('tb_'+n).className='zttag1 afw-14';
	}
}
//bottom2

function HoverLi2(n){
for(var i=1;i<=2;i++){g('btb_'+i).className='normaltab';g('btbc_0'+i).className='undis';}
g('btbc_0'+n).className='dis';g('btb_'+n).className='hovertab';
}

//main1
function diva(n){

for(var i=1;i<=5;i++){
if(g('d_'+i)!=null){
g('d_'+i).className='dark';
}
if(g('d_0'+i)!=null){
g('d_0'+i).className='pic undis';
}
}

if(g('d_0'+n)!=null){
		g('d_0'+n).className='pic dis';
	}
	if(g('d_'+n)!=null){
		g('d_'+n).className='light';
	}
}

//main2
function divb(n){

for(var i=1;i<=5;i++){
if(g('b_'+i)!=null){
g('b_'+i).className='dark';
}
if(g('b_0'+i)!=null){
	g('b_0'+i).className='pic undis';
}
}
	if(g('b_0'+n)!=null){
		g('b_0'+n).className='pic dis';
	}
	if(g('b_'+n)!=null){
		g('b_'+n).className='light';
	}
}

//rank
function divp(n){

for(var i=1;i<=2;i++){
g('p_'+i).className='right bg2';
g('p_0'+i).className='second_all undis';
}
g('p_0'+n).className='second_all dis';
g('p_'+n).className='left bg1';
}

//m
function divm(n){

for(var i=1;i<=2;i++){
g('m_'+i).className='frist3 bg2';
g('m_0'+i).className='undis';
}
g('m_0'+n).className='dis';
g('m_'+n).className='bg1';
}

//rank other
function divn(n){

for(var i=1;i<=2;i++){
if(g('n_'+i)!=null){
g('n_'+i).className='ph2 ph_1';}
if(g('n_0'+i)!=null){
g('n_0'+i).className='ph3 undis';}
}
if(g('n_0'+n)!=null){
g('n_0'+n).className='ph3 dis';}
if(g('n_'+n)!=null){
g('n_'+n).className='ph1 ph_1';}
}

//hot
function divh(n){

for(var i=1;i<=3;i++){
g('h_'+i).className='bg2';
g('h_0'+i).className='second_all undis';
}
g('h_0'+n).className='second_all dis';
g('h_'+n).className='bg1';
}


//scroll
    
var moveTag=function(obj){   
    var _this = this;   
    _this.speed = 2;   
    _this.space = 2 *100;   
    obj.scrollLeft=0;
    var divList = obj.getElementsByTagName("DIV");   
    var obj2 = new Object(); 
    for(var i=0;i<divList.length;i++){   
        if(divList[i].parentNode==obj){   
            obj2=divList[i];   
            break;   
        }   
    }   
    var cellCount = 0;   
    _this.cellList = new Array();   
    for(var i=0;i<divList.length;i++){   
        if(divList[i].parentNode==obj2){   
            cellCount++;   
            _this.cellList.push(divList[i]);
        }   
    }   
    _this.resetCellList=function(){   
        for(var i=0;i<_this.cellList.length-1;i++){   
            obj2.removeChild(_this.cellList[i]);   
            obj2.appendChild(_this.cellList[i]);   
        }   
        _this.cellList = new Array();   
        for(var i=0;i<divList.length;i++){   
            if(divList[i].parentNode==obj2) _this.cellList.push(divList[i]);   
        }   
    }   
    _this.resetForMoveRight=function(){    
        if(_this.cellList.length>0){   
            for(var i=_this.cellList.length-1;i>0;i--){   
                obj2.removeChild(_this.cellList[i]);   
                obj2.insertBefore(_this.cellList[i],obj2.childNodes[0]);   
            }   
        }   
        _this.cellList = new Array();   
        for(var i=0;i<divList.length;i++){   
            if(divList[i].parentNode==obj2) _this.cellList.push(divList[i]);   
        }   
    }   
    obj2.style.width = parseInt(obj.offsetWidth * cellCount) + "px";   
    var cellScroll = obj.offsetWidth;
    var endScroll = obj2.offsetWidth - cellScroll;  
    _this.moveLength = cellScroll; 
    _this.scrollEnd = false;   
    _this.scrollTimes = 0;   
    _this.sleep=function(){   
        _this.scrollTimes++;   
        if(_this.scrollTimes>=_this.space){   
            _this.scrollTimes=0;   
            _this.moveLength=0;   
        }   
    };   
    _this.moveStart = true;  
    _this.isMoveLeft = true;   
    _this.move=function(){   
        obj.onmouseover=function(){   
            _this.moveStart=false;   
        };   
        obj.onmouseout=function(){   
            _this.moveStart=true;   
        };      
        if(obj.scrollLeft>=endScroll && _this.isMoveLeft){  
            if(_this.moveLength > 0) _this.moveLength = cellScroll; 
            if(_this.cellList.length>0){   
                _this.resetCellList();
                obj.scrollLeft=0;   
            }else{   
                _this.scrollEnd = true;   
            }   
        }else if(obj.scrollLeft<=0 && !_this.isMoveLeft){ 
            if(_this.moveLength > 0) _this.moveLength = cellScroll;  
            if(_this.cellList.length>0){   
                _this.resetForMoveRight();  
                obj.scrollLeft=endScroll;   
            }else{   
                _this.scrollEnd = false;   
            }   
        }   
        //   
        if(_this.scrollEnd){   
            if(_this.moveLength<cellScroll && _this.moveStart){   
                obj.scrollLeft--;   
                _this.moveLength++;   
            }else if(_this.moveLength>=cellScroll){   
                _this.sleep();   
            }   
        }   
        else{
            if(_this.moveLength<cellScroll && _this.moveStart){   
                obj.scrollLeft++;   
                _this.moveLength++;   
            }else if(_this.moveLength>=cellScroll){   
                _this.sleep();   
            }   
        }   
    };    
    _this.start=function(){   
        setInterval(_this.move,_this.speed);   
    };   
}; 
//photo
window.onload = function() {
startmarquee(166,10,4000,0);
startmarquee(166,10,4000,1);
}
function startmarquee(gd,speed,delay,index)
{
var t;
var p=false;
var so=document.getElementById("marquee"+index);
if(so == null){
	return;
}
so.innerHTML+=so.innerHTML;
so.onmouseover=function(){p=true;}
so.onmouseout=function(){p=false;}
so.scrollTop = 0;
function start() {
t=setInterval(scrolling,speed);
if(!p) so.scrollTop += 2;
}
function scrolling()
{
if(so.scrollTop%gd!=0) {
so.scrollTop += 2;
if(so.scrollTop>=so.scrollHeight/2) so.scrollTop = 0;
} else {
clearInterval(t);
setTimeout(start,delay);
}
}
setTimeout(start,delay);
}

