var isNS4 = false;
var isIE4only = false;
var isIE45only = false;
var isIE4 = false;
var isNS6 = false;
var isNS6only = false;
var isMac = false;
var isSafari = false;
var isOpera = false;
var hidden = "hidden"
var visible = "visible"
var dhtml = true;
var linux = false;
var noScroll = false;	// for those which don't support scrollbars on divs

if (navigator.appVersion.indexOf("Mac") > -1) isMac = true;
if (navigator.appVersion.indexOf("Safari") > -1) isSafari = true;
if (navigator.userAgent.indexOf("Konqueror") > -1) {
	linux = true;
	dhtml = false;
}
if (navigator.userAgent.indexOf("Linux") > -1) {
	linux = true;
}
if (navigator.userAgent.indexOf("Opera") > -1) {
	isOpera = true; 
	noScroll = true;
}

if (navigator.appVersion.charAt(0) < 4) dhtml = false;
else if (document.layers) {
	isNS4 = true;
	noScroll = true;
} else if (document.all) {
	isIE4 = true
	if (navigator.appVersion.indexOf("MSIE 4") > -1) isIE4only = true
	if (navigator.appVersion.indexOf("MSIE 4.5") > -1) {
		isIE45only = true
		noScroll = true
	}
} else if (document.getElementsByTagName("*")) {
	isNS6 = true
	if (navigator.userAgent.indexOf("Netscape6/6") > -1) {
		isNS6only = true
	}
} else dhtml = false;

//********************************************************//

if (typeof whichSection == "undefined") whichSection = "";

//********************************************************//

function HBgetLayer(which) {
	if (isNS4) {
		hidden = "hide"
		visible = "show"
		document.layers[which].style = document.layers[which]
		document.layers[which].divWidth = document.layers[which].document.width
		document.layers[which].pageWidth = window.innerWidth
		return document.layers[which]
	} else if (isIE4) {
		document.all[which].divWidth = document.all[which].clientWidth;
		document.all[which].pageWidth = document.body.clientWidth;
		return document.all[which];
	} else if (isMoz) {
		document.getElementById(which).divWidth = document.getElementById(which).offsetWidth
		document.getElementById(which).pageWidth = window.innerWidth
		return document.getElementById(which)
	} else return;
}

//********************************************************//

var currentLayer = null;
function showDiv(obj,which) {
	obj.className = "navOn";
	if (currentLayer != null) currentLayer.style.visibility = hidden;
	var layer = HBgetLayer(which);
	layer.style.visibility = visible;
	currentLayer = layer;
}
//********************************************************//

function multipleSelectText() {
	var msg = ""
	if (isMac) {
		msg = "Hold down the &quot;Command&quot; key to make multiple selections.<br>"
	} else {
		msg = "Hold down the &quot;Control&quot; key to make multiple selections.<br>"
	}
	
	document.write(msg)
}

//********************************************************//
function linktocome()
{
   alert("link to come")
   return false
}
//********************************************************//
function hideDiv(obj,which) {
	obj.className = "nav";
	var layer = HBgetLayer(which);
	layer.style.visibility = hidden;
	currentLayer = layer;
}

//********************************************************//

var tags = new Array('td'); // only need to change TD size in various sections

function fontSizer(how) 
{
	//showProps(document.getElementById("bodyx").style,"bodyx.style")
	//alert(document.getElementsById("bodyx").style.fontSize);
	//return;
	//document.getElementById("mainContent").style.fontSize = ".85em";
	//document.getElementById("mainContent.td").style.fontSize = ".85em";
	//document.body.style.fontSize = "21px";
	//showProps(document.getElementsByTagName("td")[0].style,"td");
	//return;
	//alert("orig: " +initSize)
	if (!document.getElementById) return;
	if (how == "+") {
		//alert("plus")
		initSize = roundNumber(1*initSize + 1*.1);
	} else {
		//alert("minus")
		initSize = roundNumber(1*initSize - 1*.1);
	}
	//alert("now: " + initSize)
	var divArray = new Array("mainContent","footer","subMenuContent","statistics","welcome","thirdLevelNav");
	
	for (var i=1; i<HBlayernames.length; i++) {
		divArray[divArray.length] = HBlayernames[i]+"Flyout";
	}

	for (var i=0; i<divArray.length; i++) {
		if (document.getElementById(divArray[i]) != null) {
			getBody = document.getElementById(divArray[i]);
			
			document.getElementById(divArray[i]).style.fontSize = initSize + "em";
	
			for (j = 0 ; j < tags.length ; j++ ) 
			{
				getallTags = getBody.getElementsByTagName(tags[j]);
				for (k = 0 ; k < getallTags.length ; k++) {
					getallTags[k].style.fontSize = initSize + "em";
				//getallTags[k].style.fontSize = (unit=='px') ? pixelArray[size]+unit : emArray[size]+unit;
				}
			}
		}
	}
	
	var today = new Date();
	var expiry = new Date(today.getTime() + 365 * 2 * 24 * 60 * 60 * 1000);
	setCookie("initSize",initSize,expiry);
} 

//****************************************//

function roundNumber(num) {
	var rlength = 2; // The number of decimal places to round to
	return Math.round(num*Math.pow(10,rlength))/Math.pow(10,rlength);
}

/*********************************************************************************
  dw_cookies.js - cookie functions for www.dyn-web.com
  Recycled from various sources 
**********************************************************************************/

// Modified from Bill Dortch's Cookie Functions (hidaho.com) 
// (found in JavaScript Bible)
function setCookie(name,value,days,path,domain,secure) {
  var expires, date;
  if (typeof days == "number") {
    date = new Date();
    date.setTime( date.getTime() + (days*24*60*60*1000) );
		expires = date.toGMTString();
  }
  document.cookie = name + "=" + escape(value) +
    ((expires) ? "; expires=" + expires : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

//****************************************//

// Modified from Jesse Chisholm or Scott Andrew Lepera ?
// (found at both www.dansteinman.com/dynapi/ and www.scottandrew.com/junkyard/js/)
function getCookie(name) {
  var nameq = name + "=";
  var c_ar = document.cookie.split(';');
  for (var i=0; i<c_ar.length; i++) {
    var c = c_ar[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameq) == 0) return unescape( c.substring(nameq.length, c.length) );
  }
  return null;
}

//****************************************//

// from Bill Dortch's Cookie Functions (hidaho.com) 
function deleteCookie(name,path,domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

//****************************************//

function clearInput(obj) {
	if (obj.value == "for members only") {
		obj.value = "";
	}
}

//****************************************//

var popWin;
function openPopWin(which) {
	if (!popWin || popWin.closed) {
		xStr = "left=" + eval(screen.width - 796) + ",top=0,width=771,height=433,scrollbars=1,status=1,resizable=1"
		popWin = window.open(which,"popWin",xStr);
	} else {
		popWin.location = which
	}
	popWin.focus();
	return false;
}

//****************************************//

function showProps(obj,objName) {
   var result = ""
   var count = 0
   for (var i in obj) {
      result += objName + "." + i + " = " + obj[i] + "\n"
      count++
      if (count == 7) {
         alert(result)
         result = ""
         count = 0
      }
   }
   if (count != 0) alert(result)
}
//===========================
function confirmdelete()
{
   return confirm("Are you sure you want to delete?")
}

function confirmlink()
{
   return confirm("If you leave this page without clicking \"Submit\", any edits you have made will be ignored. Are you sure you want to leave this page?")
}
//===========================

