function swtichtab(){
	var n = parseInt(this.id.substring(3, this.id.indexOf("_")));
	var ind = parseInt(this.id.substring(this.id.indexOf("_")+1, this.id.length));
	for (var i=1; ;i++ ){
		var tab = document.getElementById("tab"+n+"_"+i);
		if(!tab) break;
		var tabbody = document.getElementById("tabbody"+n+"_"+i);
		if(i==ind){
			tab.className=tabbody.className="actived";
		}else{
			tab.className=tabbody.className="inactived";
		}
	}

}
function tabinit(n){
	for (var i=1; ;i++ ){
		var tab = document.getElementById("tab"+n+"_"+i);
		if(!tab) break;
		tab.onmouseover = swtichtab;
	}
}

function marqueeUpdate(marobj)
{
    marobj = typeof(marobj)=="string"?window.marquees[marobj]:obj;
    marobj.doScroll();
}

function _(name)
{
    eval(name);
}

function HorizontalMarquee(marout, marin, marname, mardir, mardelay)
{
    if(!window.marquees) window.marquees = {};
    window.marquees[marname] = this;
    this.marname = marname;
    this.direction = mardir;
    this.delay = mardelay;
    if(!this.delay) this.delay = 10;
    this.marqueeout = typeof(marout)=="string"?document.getElementById(marout):marout;
    this.marqueein = typeof(marin)=="string"?document.getElementById(marin):marin;
    var len = this.marqueein.childNodes.length;
    this.delta = 0;
    var max = Math.max(this.marqueein.scrollWidth, this.marqueeout.clientWidth);
    while(this.marqueein.scrollWidth<max*3)
    {
        for(var i=0; i<len; i++)
            this.marqueein.appendChild(this.marqueein.childNodes[i].cloneNode(true));
        if(this.delta==0 && this.marqueein.scrollWidth>this.marqueeout.clientWidth)
            this.delta = this.marqueein.scrollWidth - this.marqueeout.clientWidth;
    }
    
    this.doScroll = function ()
    {
        var l = this.direction=="right"?this.marqueeout.scrollLeft--:this.marqueeout.scrollLeft++;
        if(this.marqueeout.scrollLeft==l)
            this.marqueeout.scrollLeft = this.direction=="right"?
            (this.marqueeout.clientWidth + this.delta):
            (this.delta + this.marqueeout.scrollLeft+this.marqueeout.clientWidth - this.marqueein.scrollWidth);
    }
    
    this.start = function()
    {
        this.stop();
        this.htimer = setInterval("marqueeUpdate('"+this.marname+"')", this.delay);
    }
    
    this.stop = function()
    {
        try{clearInterval(this.htimer);}catch(ex){}
    }
    
    this.marqueeout.marquee = this;
    this.marqueeout.onmouseover = function(){this.marquee.stop();};
    this.marqueeout.onmouseout = function(){this.marquee.start();};
    this.start();
}

function VerticalMarquee(marout, marin, marname, mardir, mardelay)
{
    if(!window.marquees) window.marquees = {};
    window.marquees[marname] = this;
    this.marname = marname;
    this.direction = mardir;
    this.delay = mardelay;
    if(!this.delay) this.delay = 10;
    this.marqueeout = typeof(marout)=="string"?document.getElementById(marout):marout;
    this.marqueein = typeof(marin)=="string"?document.getElementById(marin):marin;
    var len = this.marqueein.childNodes.length;
    this.delta = 0;
    var max = Math.max(this.marqueein.scrollHeight, this.marqueeout.clientHeight);
    while(this.marqueein.scrollHeight<max*3)
    {
        for(var i=0; i<len; i++)
            this.marqueein.appendChild(this.marqueein.childNodes[i].cloneNode(true));
        if(this.delta==0 && this.marqueein.scrollHeight>this.marqueeout.clientHeight)
            this.delta = this.marqueein.scrollHeight - this.marqueeout.clientHeight;
    }
    
    this.doScroll = function ()
    {
        var t = this.direction=="down"?this.marqueeout.scrollTop--:this.marqueeout.scrollTop++;
        if(this.marqueeout.scrollTop==t)
            this.marqueeout.scrollTop = this.direction=="down"?
            (this.marqueeout.clientHeight + this.delta):
            (this.delta + this.marqueeout.scrollTop+this.marqueeout.clientHeight - this.marqueein.scrollHeight);
    }
    
    this.start = function()
    {
        this.stop();
        this.htimer = setInterval("marqueeUpdate('"+this.marname+"')", this.delay);
    }
    
    this.stop = function()
    {
        try{clearInterval(this.htimer);}catch(ex){}
    }
    
    this.marqueeout.marquee = this;
    this.marqueeout.onmouseover = function(){this.marquee.stop();};
    this.marqueeout.onmouseout = function(){this.marquee.start();};
    this.start();
}
