
var isKonq = false;
var isNS4 = false;
var isIE4only = false;
var isIE4 = false;
var isMoz = false;
var isLinux = false;
var isOpera = false;
var isMac = false;
var isSafari = false;
var validDom = false;
var hidden = "hidden"
var visible = "visible"
var uniqueLayout = false;
 
if (document.getElementById) validDom = true;
if (navigator.appVersion.indexOf("Mac") > -1) isMac = true;
if (navigator.appVersion.indexOf("Safari") > -1) isSafari = true;
if (document.layers) isNS4 = true;
else if (document.all) {
 isIE4 = true
 if (navigator.appVersion.indexOf("MSIE 4") > -1) isIE4only = true;
} else if (document.getElementsByTagName("*")) isMoz = true;
 
if (navigator.userAgent.indexOf("Opera") > -1) isOpera = true;
if (navigator.appVersion.indexOf("Linux") > -1 || navigator.userAgent.indexOf("Linux") > -1) {
 isLinux = true;
}
if (navigator.appVersion.indexOf("Konqueror") > -1) isKonq = true;

//****************************************//

if (typeof whichSubSection == "undefined") {
	whichSubSection = "";
}

//****************************************//

function swapImage(which,how) {
	if (which == whichSection) return;	
	
	var blockStyle = document.getElementById(which+"Div").style.display;
	
	if (blockStyle != "block") {
  		eval("document.images['" + which + "Img'].src = " + which + "_" + how + ".src");
	}
}

//****************************************//

function toggleDiv(which) {	
	if (document.getElementById(which+"Div") == null) return;
	if (document.getElementById(which+"Div").style.display != "block") {
		var how = "on";
		var display = "block";
	} else {
		var how = "off";
		var display = "none";
	}
	
	document.getElementById(which+"Div").style.display = display;
}

//****************************************//

function openMedia(which) {
	if (isMac) {
		location = which;
		return;
	}
	window.open(which);
}

//****************************************//

function imgCache(which) {
	var whichSrc = which;
	eval(which+"_off = new Image()");
	eval(which+"_off.src = '/pix/" + whichSrc + "_off.gif'");
	eval(which+"_on = new Image()");
	eval(which+"_on.src = '/pix/" + whichSrc + "_on.gif'");
}

//****************************************//

function doNav() {		
	if (whichSection == "home") whichSection = "";
	if (typeof whichSection != "undefined" && whichSection != "") {	// highlighting the correct leftnav page
		var tempDiv = document.getElementById(whichSection+"Div").childNodes	
		for (var i=0; i<tempDiv.length; i++) {

			if (typeof tempDiv[i].innerHTML != "undefined" && whichSubSection != "" &&  tempDiv[i].innerHTML.indexOf(whichSubSection) > -1) {
				var re = /nav/gi
				tempDiv[i].innerHTML = tempDiv[i].innerHTML.replace(re,"navOn");
			}
		}
	
	eval("document.images['" + whichSection + "Img'].src = " + whichSection + "_on.src");
	toggleDiv(whichSection);
	}
	document.getElementById("navTable").style.visibility = "visible";
}

//****************************************//

function init() {
	var imgArray = new Array("business","resources","demographics","environment","incentives","sites","about","help");
	
	for (i=0; i<imgArray.length; i++) {
		imgCache(imgArray[i]);
	}
}

//****************************************//

function showProps(obj,objName) {
   var result = ""
   var count = 0
   for (var i in obj) {
      result += objName + "." + i + " = " + obj[i] + "\n"
      count++
      if (count == 25) {
         alert(result)
         result = ""
         count = 0
      }
   }
   if (count != 0) alert(result)
}

//****************************************//
					
init();

//****************************************//