var browser = navigator.appName;
var platform = navigator.appVersion;

isDOM = (document.getElementById) ? true : false;
isNS4 = (document.layers) ? true : false;
isIE = (document.all) ? true : false;
isIE4 = isIE && !isDOM;
isMac = (platform.indexOf("Mac") != -1);
isWin = (platform.indexOf("Win") != -1);
isNS4M = isNS4 && isMac;
isIE4M = isIE4 && isMac;

/* load this browser's stylesheet */
upStr = '';
if (isNS4) {
	if (isNS4M) 
	 document.write('<link rel="STYLESHEET" type="text/css" href="' + upStr + 'css/macns.css">'); 
	else 
	 document.write('<link rel="STYLESHEET" type="text/css" href="' + upStr + 'css/ns.css\">'); 
}
else 
	 document.write('<link rel="STYLESHEET" type="text/css" href="' + upStr + 'css/ie.css">');

/* set a boolean to make determining size for text boxes easier */
bigTextboxes = (platform.indexOf("Win") != -1 && browser == "Netscape");

HM_PG_MenuWidth = 140;
HM_PG_FontFamily = "Arial,Helvetica,sans-serif";
HM_PG_FontSize = (isNS4M) ? 11 : (isNS4) ? 9 : 8;
HM_PG_FontBold = false;
HM_PG_FontItalic = 0;
HM_PG_FontColor = (isNS4 && isWin) ? "#2c2c2c" : "#2c2c2c";
HM_PG_FontColorOver = "#ffffff";
HM_PG_BGColor = "#ffffff";
HM_PG_BGColorOver = "C40404";	//D22E33
HM_PG_ItemPadding = 1;

HM_PG_BorderWidth = 1;
HM_PG_BorderColor = "#D22E33";	//#2c2c2c
HM_PG_BorderStyle = "solid";
HM_PG_SeparatorSize = 1;
HM_PG_SeparatorColor = "#D22E33";	//#2c2c2c
HM_PG_ImageSrc = "images/tri.gif";
HM_PG_ImageSrcLeft = "images/tril.gif";

HM_PG_ImageSize = 5;
HM_PG_ImageHorizSpace = 0;
HM_PG_ImageVertSpace = 2;

HM_PG_KeepHilite = true; 
HM_PG_ClickStart = 0;
HM_PG_ClickKill = false;
HM_PG_ChildOverlap = 20;
HM_PG_ChildOffset = 10;
HM_PG_ChildPerCentOver = null;
HM_PG_TopSecondsVisible = .5;
HM_PG_StatusDisplayBuild =0;
HM_PG_StatusDisplayLink = 1;
HM_PG_UponDisplay = null;
HM_PG_UponHide = null;
HM_PG_RightToLeft = false;

HM_PG_CreateTopOnly = (isNS4M) ? true : false;
HM_PG_ShowLinkCursor = 1;
HM_PG_NSFontOver = true;

myXpos = 0;

function findObj(n, d) { //v3.0
  var p,i,x;
  if (!d) d = document;
  if ((p=n.indexOf("?")) > 0 && parent.frames.length) {
    d = parent.frames[n.substring(p+1)].document;
	n=n.substring(0,p);
  }
  if (!(x=d[n]) && d.all) x=d.all[n];
  for (i=0; !x && i<d.forms.length; i++) x=d.forms[i][n];
  for (i=0; !x && d.layers && i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  return x;
}

function show(n,d) {
	//alert(n + ': ' + d);
    if (!d) d = document;
    if (document.layers) {
		theLayer = findObj(n,d)
        if (theLayer) theLayer.visibility = 'visible';
    } else if (document.all) {
        if (d.all[n]) d.all[n].style.visibility = 'visible';
    }
    else if (document.getElementById) {
		if (d.getElementById(n) != null) {
            d.getElementById(n).style.visibility='visible';
            d.getElementById(n).style.display='block';
		}
    }
}

function hide(n,d) {
    if (!d) d = document;
    if (document.layers) {
		theLayer = findObj(n,d)
        if (theLayer) theLayer.visibility = 'hidden';
    } else if (document.all) {
        if (d.all[n]) d.all[n].style.visibility = 'hidden';
    }
    else if (document.getElementById) {
		if (d.getElementById(n) != null) {
            d.getElementById(n).style.visibility='hidden';
            d.getElementById(n).style.display='none';
		}
    }
}

function roll(id, newSrc) {
    var theImage = findImage(document, id, 0);
    if (theImage) theImage.src = newSrc;
}

function findImage(doc, name, j) {
    var theImage = false;
    if (doc.images) theImage = doc.images[name];
    if (theImage) return theImage;
    if (doc.layers)
        for (j = 0; j < doc.layers.length; j++) {
            theImage = findImage(doc.layers[j].document, name, 0);
            if (theImage) return (theImage);
        }
    return (false);
}

function reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.pgW=innerWidth; document.pgH=innerHeight; onresize=reloadPage; }}
  else if (innerWidth!=document.pgW || innerHeight!=document.pgH) {location.reload();}
}

function init(DivId) {
	show(DivId);
}

function setClass(elementName,newclass)
{
    var E = eval(elementName);
    if (E) E.className = newclass;
}

function insertHTML(obj, html)
{
	if (obj)
	{	
		var tmpHTML = obj.innerHTML;
		obj.innerHTML = html;
		html = obj.innerHTML;
		obj.innerHTML = tmpHTML;

		var p = obj.innerHTML.indexOf(html);
		if (obj.innerHTML.indexOf(html) == -1)
			obj.innerHTML = obj.innerHTML + html;
	}
}

function removeHTML(obj, html)
{
	if (obj)
	{	
		var tmpHTML = obj.innerHTML;
		obj.innerHTML = html;
		html = obj.innerHTML;

		var p = tmpHTML.indexOf(html);
		if (p > 0)
			tmpHTML = tmpHTML.substring(0,p) + tmpHTML.substring(p+html.length);

		obj.innerHTML = tmpHTML;
	}
}

function setValue(objName,value)
{
	var obj = document.all(objName);
	if ( obj )
		obj.value = value;
}

function setBackgroundColor(objName, color)
{
	var obj = document.all(objName);
	if ( obj )
		if (obj.style)
		{
				obj.style.backgroundColor = color;
		}
}

function calculateSumOffset(idItem, offsetName)
{
	var totalOffset = 0;
	var item = eval('idItem');
	do
	{
		totalOffset += eval('item.'+offsetName);
		item = eval('item.offsetParent');
	} while (item != null);
	return totalOffset;
}
//reloadPage(true);
