// JavaScript Document
// Written by Mark W Woods
	
menuDely = 20;
msgShow = false;
msgHide = false;
firstLoad = true;
pageHeaderHeight = "135";
msgTabWidth = "200";
msgBoxWidth = "400";
msgBoxHeight = "200";
msgBoxHidenLocation = -msgBoxHeight -20;
msgBoxLocation = msgBoxHidenLocation;

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
function refreshPage(page) {
	mainFrame.location.href=page;
}
function PrintPage() {
	//* alert(parent.frames.length); *//
	parent.frames["mainFrame"].focus();
	parent.frames["mainFrame"].print();
}
function pageArea() {
	var pageArea = document.getElementById("page");
	var titleArea = document.getElementById("htmlTitle");
	var headerArea = document.getElementById("htmlHeader");
	var msgTab = document.getElementById("messageTab");
	var bckTab = document.getElementById("messageTabImage");	
	var msgWindow = document.getElementById("messageWindow");
	var winHeight = document.all ? document.body.clientHeight : window.innerHeight;
	var winWidth = document.all ? document.body.clientWidth : window.innerWidth;
	var pageHeight = winHeight - pageHeaderHeight;
	var pageWidth = winWidth;
	if (pageWidth > 750) {pageWidth = 750;};
	var pageLeft = (winWidth/2) - (pageWidth/2);
	pageArea.style.top = pageHeaderHeight;
	pageArea.style.height = pageHeight;
	pageArea.style.left = pageLeft;
	titleArea.style.left = pageLeft;
	headerArea.style.left = pageLeft;
	pageArea.style.width = pageWidth;
	msgTab.style.width = msgTabWidth;
	bckTab.style.left = (winWidth/2)-(400/2);
	msgTab.style.left = (winWidth/2)-(msgTabWidth/2);
	msgWindow.style.width = msgBoxWidth;
	msgWindow.style.height = msgBoxHeight;
	msgWindow.style.left =(winWidth/2)-(msgBoxWidth/2);
	hideMsgBox ();
}
function hideMsgBox() {
	var msgWindow = document.getElementById("messageWindow");
	// msgWindow.style.visibility = "hidden";
	msgWindow.style.bottom = msgBoxHidenLocation;
	msgBoxLocation = msgBoxHidenLocation;
}
function revealMsgBox (messageID) {
	var msgWindow = document.getElementById("messageWindow");
	closeMsgBox();
	writeMsg (messageID);
	msgWindow.style.visibility = "visible";
	msgShow = true;
	moveMsgBox();
	
}
function closeMsgBox() {
	var msgWindow = document.getElementById("messageWindow");
	msgHide = true;
	moveMsgBox();
}
function writeMsg (messageID) {
	var msgWindow = document.getElementById("messageWindow");
	msgBoxHeight = message[messageID].height;
	msgWindow.style.height = msgBoxHeight;	
	HTMLcontent = "";
	HTMLcontent += "<table width='100%' border='0' cellspacing='0' cellpadding='0'>";
    HTMLcontent += "<tr><td class='messageWindowTitle'>Message Window</td>";
	HTMLcontent += "<td class='messageWindowTitle' width='60' align='right'>";
	HTMLcontent += "<a href='javascript:void(0)' onClick='closeMsgBox ()'>Close X</td></tr></table>";
    HTMLcontent += "<h1>";
	HTMLcontent += message[messageID].heading;
	HTMLcontent += "</h1>";
	HTMLcontent += message[messageID].content;
	msgWindow.innerHTML = HTMLcontent;
}
function moveMsgBox () {
	var msgWindow = document.getElementById("messageWindow");	
	if (msgHide) {
		msgBoxLocation -= 10;
		msgWindow.style.bottom = msgBoxLocation;
		if (msgBoxLocation <= msgBoxHidenLocation) {
			msgHide = false;
		} else {
			setTimeout("moveMsgBox()", menuDely);
		}
	} else {
	if (msgShow) {
		msgBoxLocation += 10;
		msgWindow.style.bottom = msgBoxLocation;
		if (msgBoxLocation >= 0) {
			msgShow = false;
		} else {
			setTimeout("moveMsgBox()", menuDely);
		}
	}
	}
}



MM_reloadPage(true);
