// JavaScript Document

// CODE PROTECTED BY COPYRIGHT
// AUTHOR: Mike Laye - http://www.image-access.net - mail@image-access.net
// CODE PROTECTED BY COPYRIGHT

// FUNCTION THAT CHECKS THE DOM 
function getObj(name){
if (document.getElementById)
{this.obj = document.getElementById(name);}
else if (document.all)
{this.obj = document.all[name];}
else if (document.layers)
{this.obj = document.layers[name];}
}

// CENTER WINDOW //
function getWindowHeight() {
var windowHeight=0;
if (typeof(window.innerHeight) == 'number') {
windowHeight = window.innerHeight;
}
else {
if (document.documentElement && document.documentElement.clientHeight) {
windowHeight = document.documentElement.clientHeight;
}
else {
if (document.body&&document.body.clientHeight) {
windowHeight = document.body.clientHeight;
}
}
}
return windowHeight;
}

function setSpacing() {
if (document.getElementById) {
var windowHeight = getWindowHeight();
if (windowHeight > 0) {
var contentElement = new getObj('holder');
var contentHeight = contentElement.obj.offsetHeight;
if (windowHeight - contentHeight > 0) {	
contentElement.obj.style.position = 'relative';
contentElement.obj.style.top = ((windowHeight / 2) - (contentHeight / 2)) + 'px';
}
else {
contentElement.obj.style.position = 'relative';
contentElement.obj.style.top = "0px";
}
}
}
}

// GENERIC //

function doHide(theObject,theAction) {
	var thisHiding = new getObj(theObject);
	if (theAction == "hidden") {
	thisHiding.obj.className = "make_hidden";	
	}
	else {
	thisHiding.obj.className = "make_none";	
	}
}

function doShow(theObject, theAction) {
	var thisShowing = new getObj(theObject);
	if (theAction == "block") {
	thisShowing.obj.className = "make_block";	
	}
	else {
	thisShowing.obj.className = "make_visible";	
	}
}

function doAddClass(theObject, theAction) {
	var thisDiv = new getObj(theObject);
	thisDiv.obj.className = theAction;
}

function getRandomNum(thenum) {
	var rndm = Math.floor(Math.random()*thenum);
	return rndm;
}


// PENSION SECTION FUNCTIONS 

function goSection(thisChoice,thisDiv,thisName) {
	//doHighlight(thisChoice,thisDiv,thisName);
	var z = new getObj(thisDiv);
if (!z) return;
var x = z.obj.getElementsByTagName('a');
var y = (x.length);
for (var i=1;i<=y;i++) {
//hideDiv = new getObj(thisName + i);
doHide(thisName + i,'none');
navLink = new getObj(thisName + i + "_hi");
navLink.obj.className="";
}

if (thisChoice != 0) {
navLink = new getObj(thisName + thisChoice + "_hi");
navLink.obj.className = thisDiv + "_hilite";
doShow(thisName + thisChoice,'block');
//return true;
}
}

// START SITE //

window.onload = function() {
  setSpacing();
}

window.onresize = function() {
  setSpacing();
}

