var home = "http://www.tombras.com/c/CROWN/corp/";
var thislocation = new String(window.location.href);
var thisPage = thislocation.replace (home,"");
var thisArr = thisPage.split("/");
var thisDir = thisArr[0];
var subOpen = "no";
var openSub = "";
var secs;
var timerID = null;
var timerRunning = false;
var delay = 1000;

function InitializeTimer(numSecs) {
    secs = numSecs
    StopTheClock()
    StartTheTimer()
}

function StopTheClock() {
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function StartTheTimer() {
    if (secs==0) {
        StopTheClock()
		hideSub (openSub);
	} else {
        // self.status = secs
        secs = secs - 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer()", delay)
    }
}

function makeNav () {
	element = document.getElementById("sub_" + thisDir);
	if (element) {
		element.style.fontWeight = "bold";
		element.style.fontColor = "#000000";
	}
}

function makeEmail (name, user, domain) {
	document.write("<a href=" + "mail" + "to:" + user + "@" + domain + ">" + name + "</a>");
}
	
function showSub (section) {
	var yOff = 0;
	if (openSub !== section) {
		if (subOpen == "yes") hideSub (openSub);
		parElement = document.getElementById(section);
		parentY = new String(parElement.style.top);
		var newY = parseInt(parentY.replace ("px","")) + yOff;
		thisID = "sub_" + section;
		if (thisElement = document.getElementById(thisID)) {
			thisElement.style.left = 145;
			thisElement.style.top = newY;
			thisElement.style.visibility = "visible";
			subOpen = "yes";
			openSub = section;
		}
	}
}

function hideSub (section) {
	thisID = "sub_" + section;
	thisElement = document.getElementById(thisID);
	thisElement.style.visibility = "hidden";
	subOpen = "no";
	openSub = "";
}
