
/*
	[DUCEDIS] (C)2007-2008 Ducecms Inc.
    This is a freeware, use is subject to license terms
    Script filename£ºchange.js

    Support: www.ducecms.com

*/

var indextrans_timer = null; 

function DuceChange(){
	this.timer = null;
	this.start = false;
	this.done = typeof threadchange_done == 'undefined' ? 5000 : threadchange_done;
}

var DuceObC = new DuceChange();

DuceChange.prototype.Init = function(){
	if (window.addEventListener) {
		$("indextrans_head_2").addEventListener('mouseover', this.stop, true);
		$("indextrans_head_2").addEventListener('mouseout', this.play, true);
		$("indextrans_body_2").addEventListener('mouseover', this.stop, true);
		$("indextrans_body_2").addEventListener('mouseout', this.play, true);
	} else if(window.attachEvent) {
		$("indextrans_head_2").onmouseover = this.stop;
		$("indextrans_head_2").onmouseout = this.play;
		$("indextrans_body_2").onmouseover = this.stop;
		$("indextrans_body_2").onmouseout = this.play;
	}
	this.start = true;
	this.done>0 && this.play();
}

DuceChange.prototype.imageModule = function(n){
	var childs = $("indextrans_head_1").childNodes;
	for (var i = 0; i < childs.length; i++)	{
		if (childs[i].className == "current") {
			if($("image" + i)) $("image" + i).style.display = 'none';
			childs[i].className = "";
			break;
		}
	}
	childs[n].className = "current";
	if($("image" + n)) $("image" + n).style.display = 'block';
}

DuceChange.prototype.threadModule = function(n){
	var childs = $("indextrans_head_2").childNodes;
	for (var i = 0; i < childs.length; i++)	{
		if (childs[i].className == "current") {
			if($("thread" + i)) $("thread" + i).style.display = 'none';
			childs[i].className = "";
			break;
		}
	}
	childs[n].className = "current";
	if($("thread" + n)) $("thread" + n).style.display = 'block';
	if (!this.start && this.done>0) this.Init();
}

DuceChange.prototype.rankModule = function(n){
	var childs = $("indextrans_head_3").childNodes;
	for (var i = 0; i < childs.length; i++)	{
		if (childs[i].className == "current") {
			if($("rank" + i)) $("rank" + i).style.display = 'none';
			childs[i].className = "";
			break;
		}
	}
	childs[n].className = "current";
	if($("rank" + n)) $("rank" + n).style.display = 'block';
}

DuceChange.prototype.auto = function(){
	var current = 1;
	var childs = $("indextrans_head_2").childNodes;
	var lis = childs.length;
	for (var i = 0; i < lis; i++){
		if (childs[i].className == "current"){
		    if($("thread" + i)) $("thread" + i).style.display = 'none';
			childs[i].className = "";
			current = i;
			break;
		}
	}
	current++;
	if(current >= lis) current=0;
	childs[current].className = "current";
	if($("thread" + current)) $("thread" + current).style.display = 'block';
	indextrans_timer = setTimeout(DuceObC.auto, DuceObC.done);
}

DuceChange.prototype.play = function(){
	if(indextrans_timer != null) clearTimeout(indextrans_timer);
	if(DuceObC.done>0)	indextrans_timer = setTimeout(DuceObC.auto, DuceObC.done);
}

DuceChange.prototype.stop = function(){
	if(indextrans_timer != null) clearTimeout(indextrans_timer);
}

var indextrans_authort;
function showrankstar(obj, id) {
	indextrans_authort = setTimeout("$('" + id + "').style.display = 'block';", 500);
	if(!$(id).onmouseover) {
		$(id + '_ma').innerHTML = $(id + '_a').innerHTML;
		$(id).onmouseover = function() {
			$(id).style.display = 'block';
		}
		$(id).onmouseout = function() {
			$(id).style.display = 'none';
		}
	}
	if(!obj.onmouseout) {
		obj.onmouseout = function() {
			clearTimeout(indextrans_authort);
		}
	}
}

