
/*
	[DUCEDIS] (C)2007-2008 Ducecms Inc.
    This is a freeware, use is subject to license terms
    Script filename㺤citbox.js

    Support: www.ducecms.com

*/

var ditimer = new Array();

function DitCha(){
	this.timer = null;
	this.start = false;
	this.done = 5000;
}

var DuceObC = new DitCha();

DitCha.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();
}

DitCha.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';
}

DitCha.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();
}

DitCha.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';
}

DitCha.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';
	ditimer['cha'] = setTimeout(DuceObC.auto, DuceObC.done);
}

DitCha.prototype.play = function(){
	if(ditimer['cha'] != null) clearTimeout(ditimer['cha']);
	if(DuceObC.done>0)	ditimer['cha'] = setTimeout(DuceObC.auto, DuceObC.done);
}

DitCha.prototype.stop = function(){
	if(ditimer['cha'] != null) clearTimeout(ditimer['cha']);
}

DitCha.prototype.loadcss = function(cssname, dstyleid){
	if(!cssloaded[cssname]) {
		dstyleid = isUndefined(dstyleid) ? STYLEID : dstyleid;
		css = document.createElement('link');
		css.type = 'text/css';
		css.rel = 'stylesheet';
		css.href = ducedisDir + '/cache/style_indextrans_' + cssname + '_' + dstyleid + '.css?' + DUCEHASH;
		var headNode = document.getElementsByTagName("head")[0];
		headNode.appendChild(css);
		cssloaded[cssname] = 1;
	}
}

function showrankstar(obj, id) {
	ditimer['star'] = 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(ditimer['star']);
		}
	}
}

/*DitCha.prototype.loadscript = function(src, charset, recall){
	var _script = document.createElement('script');
	_script.setAttribute('type', 'text/javascript');
	_script.setAttribute('src', src);
	_script.setAttribute('charset', charset ? charset : (is_moz ? document.characterSet : document.charset));
	document.getElementsByTagName('head')[0].appendChild(_script);
	if(recall){
		var devalscript = this.evalscript;
		if(is_ie){
			_script.onreadystatechange = function(){ 
				if(this.readyState=='loaded' || this.readyState=='complete') {devalscript(recall);}
			};
		}else if(is_moz){
			_script.onload = function(){ 
				devalscript(recall);
			};
		}else devalscript(recall);
	}
}

DitCha.prototype.evalscript = function(s){
	try{ if(typeof s == 'function') {s()} else {eval(s)}; }catch(e){}
}*/
