var elapse = 3000; // this is interval - 3000 millisecond
var timer = null;

var debugWin=null;

function showMe(whatItem)
{
	document.getElementById(whatItem).style.visibility = "visible";
	document.getElementById(whatItem).style.zindex = "5";
}

function hideMe(whatItem)
{
	document.getElementById(whatItem).style.visibility = "hidden";
	document.getElementById(whatItem).style.zindex = "-1";	
}

function hideshow(whatHide, whatShow)
{
	hideMe(whatHide);
	showMe(whatShow);
}

function borderShow(whatItem,onoff)
{
	if (onoff=="on") {
		document.getElementById(whatItem).style.border = "solid 1px #EBCC66";
	}
	else {
		document.getElementById(whatItem).style.border = "solid 1px #000000";
	}
}

function changeclass(whatItem, classname)
{
	document.getElementById(whatItem).className = classname;
}

function startTimer()
{
	timer = window.setTimeout("onTimer()",elapse);
}

function stopTimer()
{
	clearTimeout(timer);
}

function onTimer()
{
	showMe("secretlink");
	stopTimer();
}

function openDebug()
{
	debugWin = window.open("","debugWin","height=200,width=300,resize=yes");
}

function writeDebug(textout)
{
	debugWin.document.writeln(textout);
	debugWin.document.close();
}	

// gives up and down scroll buttons to images, spans, ... named up_name, down_name, respectively.
// will keep the default scroll_box's style overflow if it encounters errors (so make overflow: auto;)

// usage: put this after the scrollbox div:  var div_scroll1 = new TextScroll('div_scroll1', 'scroll_box');
function TextScroll(scrollname, div_name)
{
    this.div_name = div_name;
    this.name = scrollname;
    this.scrollCursor = 0;
    this.speed = 8;
    this.timeoutID = 0;
    this.div_obj = null;

    {
        if (document.getElementById) {
            div_obj = document.getElementById(this.div_name);
            if (div_obj) {
                this.div_obj = div_obj;
                this.div_obj.style.overflow = 'hidden';
            }
        }
    }

this.stopScroll = function() {
        clearTimeout(this.timeoutID);
    }

this.scrollUp = function() {
        if (this.div_obj) {
            this.scrollCursor -= this.speed;
            if (this.scrollCursor  < 0) {
             	this.scrollCursor = 0;
             	this.stopScroll();
            }
            this.div_obj.scrollTop = this.scrollCursor;
            this.timeoutID = setTimeout(this.name + ".scrollUp()", 60);
        }
    }

this.scrollDown = function() {
        if (this.div_obj) {
            this.scrollCursor += this.speed;
            if (this.scrollCursor > (this.div_obj.scrollHeight - this.div_obj.height)) {
            	this.scrollCursor = this.div_obj.scrollHeight - this.div_obj.height;
             	this.stopScroll();
            }
            this.div_obj.scrollTop = this.scrollCursor;
            this.timeoutID = setTimeout(this.name + ".scrollDown()", 60);
        }
    }

this.resetScroll = function() {
        if (this.div_obj) {
            this.div_obj.scrollTop = 0;
            this.scrollCursor = 0;
        }
    }
}



