function reDo() { 
 window.location.reload(); 
 } 

window.onresize = reDo;

//Define global variables
var timerID = null;
var timeron = false;
var timecount = 1000;
// Change this to the time delay that you desire
var what = null;
var newbrowser = true;
var check = false;

function init() { 
	showMenuOption();
 if (document.layers) { 
 layerRef="document.layers"; 
 styleSwitch=""; 
 visibleVar="show"; 
 what ="ns4"; 
 } 
 else if(document.all) { 
 layerRef="document.all"; 
 styleSwitch=".style"; 
 visibleVar="visible"; 
 what ="ie4"; 
 } 
 else if(document.getElementById) { 
 layerRef="document.getElementByID"; 
 styleSwitch=".style"; 
 visibleVar="visible"; 
 what="dom1"; 
 } 
 else { 
 what="none"; 
 newbrowser = false; 
 } 
check = true; 
}

function initMagic() { 
	showMagicOption();
 if (document.layers) { 
 layerRef="document.layers"; 
 styleSwitch=""; 
 visibleVar="show"; 
 what ="ns4"; 
 } 
 else if(document.all) { 
 layerRef="document.all"; 
 styleSwitch=".style"; 
 visibleVar="visible"; 
 what ="ie4"; 
 } 
 else if(document.getElementById) { 
 layerRef="document.getElementByID"; 
 styleSwitch=".style"; 
 visibleVar="visible"; 
 what="dom1"; 
 } 
 else { 
 what="none"; 
 newbrowser = false; 
 } 
check = true; 
}
 
function findPosition( oLink ) {
  if( oLink.offsetParent ) {
    for( var posX = 0, posY = 0; oLink.offsetParent; oLink = oLink.offsetParent ) {
      posX += oLink.offsetLeft;
      posY += oLink.offsetTop;
    }
    return [ posX, posY ];
  } else {
    return [ oLink.x, oLink.y ];
  }
}

// Toggles the layer visibility on 
function showLayer(layerName) {
	
 if(check) { 
 if (what =="none") { 
 return; 
 } 
 else if (what == "dom1") {
 document.getElementById(layerName).style.visibility="visible"; 
 } 
 else { 
 eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"'); 
 } 
 } 
 else { 
 return; 
 } 
 } 
// Toggles the layer visibility off 
function hideLayer(layerName) { 
 if(check) { 
 if (what =="none") { 
 return; 
 } 
 else if (what == "dom1") {
 document.getElementById(layerName).style.visibility="hidden"; 
 } 
 else { 
 eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"'); 
 } 
 } 
 else { 
 return; 
 } 
 } 

//function hideAll() { 
// hideLayer('mymenu'); 
 //Put all layers used in the nav here. 
 //Copy the hideLayer() function above. 
 //} 

function startTime() { 
 if (timeron == false) { 
 timerID=setTimeout( "hideAll(0)" , timecount); 
 timeron = true; 
 } 
 } 
 
 function startTimeMagic() { 
	 if (timeron == false) { 
	 timerID=setTimeout( "hideAllMagic()" , timecount); 
	 timeron = true; 
	 } 
 } 

function stopTime() { 
 if (timeron) { 
 clearTimeout(timerID); 
 timerID = null; 
 timeron = false; 
 } 
 } 

function onLoad() { 
 init(); 
 } 
 
 function modalDialog(html, divid, classname, top, left, width) { 
	promptbox = document.createElement('div'); 
	promptbox.setAttribute ('id' , divid) ;
	document.getElementsByTagName('body')[0].appendChild(promptbox);
	document.getElementById(divid).className= classname;
	var dump;
	dump = "document.getElementById(\""+divid+"\").style";
	//document.write(dump);
	css = eval(dump);
	promptbox = css;
	promptbox.position = 'absolute'; 
	promptbox.top = top;
	promptbox.visibility = 'hidden';
	promptbox.left = left;
	promptbox.width = width;
	promptbox.height = 50;
	document.getElementById(divid).innerHTML = html;
	return promptbox;
}

function getWidth() {
	var x,y;
	var test1 = document.body.scrollHeight;
	var test2 = document.body.offsetHeight
	if (test1 > test2) // all but Explorer Mac
	{
		x = document.body.scrollWidth;
		y = document.body.scrollHeight;
	}
	else // Explorer Mac;
	     //would also work in Explorer 6 Strict, Mozilla and Safari
	{
		x = document.body.offsetWidth;
		y = document.body.offsetHeight;
	}
	return x;
}

function getHeight() {
	
	var x,y;
	var test1 = document.body.scrollHeight;
	var test2 = document.body.offsetHeight
	if (test1 > test2) // all but Explorer Mac
	{
		x = document.body.scrollWidth;
		y = document.body.scrollHeight;
	}
	else // Explorer Mac;
	     //would also work in Explorer 6 Strict, Mozilla and Safari
	{
		x = document.body.offsetWidth;
		y = document.body.offsetHeight;
	}
	return y;
}

function createLayer(html, divid, classname, top, left, width, height) {
	promptbox = document.createElement('div'); 
	promptbox.setAttribute ('id' , divid) ;
	document.getElementsByTagName('body')[0].appendChild(promptbox);
	document.getElementById(divid).className= classname;
	var dump;
	dump = "document.getElementById(\""+divid+"\").style";
	//document.write(dump);
	css = eval(dump);
	promptbox = css;
	promptbox.position = 'absolute'; 
	promptbox.top = top;
	promptbox.visibility = 'hidden';
	promptbox.left = left;
	promptbox.width = width;
	promptbox.height = height;
	document.getElementById(divid).innerHTML = html;
}


function showTransparentLayer() 
{
	createLayer('<table width="100%" height="100%" onclick="hideAllMagic()"><tr><td>&nbsp;</td></tr></table>','transbox','transbox',0,0,getWidth(),getHeight());
}

function showTransparent()
{
	showLayer('transbox');	
}

