var JS = Boolean(1 + 0);
var NS4 = Boolean(document.layers);
var IE4 = Boolean(document.all);
var IE5 = Boolean(navigator.appVersion.indexOf('MSIE 5') > 0)


//var for sticky icons
var SelectedIcon = null;

//Load Img and Content Data
var aImg = new Array();
   aImg[0] = document.Icon0;
   aImg[1] = document.Icon1;
   aImg[2] = document.Icon2;   
   aImg[3] = document.Icon3;
   aImg[4] = document.Icon4;
   aImg[5] = document.Icon5;
   aImg[6] = document.Icon6;
   aImg[7] = document.Icon7;

var aImgSrcOn = new Array();
   aImgSrcOn[0] = '../images/abouticons/BoardOfADvisersOn.gif';
   aImgSrcOn[1] = '../images/abouticons/BoardofDirectorsOn.gif';
   aImgSrcOn[2] = '../images/abouticons/MeyersOn.gif';
   aImgSrcOn[3] = '../images/abouticons/StaffOn.gif';   
   aImgSrcOn[4] = '../images/abouticons/ClientTestimonialsOn.gif';
   aImgSrcOn[5] = '../images/abouticons/MAHIStoryOn.gif';
   aImgSrcOn[6] = '../images/abouticons/WUMMSIMOn.gif';
   aImgSrcOn[7] = '../images/abouticons/EconomicSurveysOn.gif';
            
var aImgSrcOff = new Array();
   aImgSrcOff[0] = '../images/abouticons/BoardOfADvisersOff.gif';
   aImgSrcOff[1] = '../images/abouticons/BoardofDirectorsOff.gif';
   aImgSrcOff[2] = '../images/abouticons/MeyersOff.gif';   
   aImgSrcOff[3] = '../images/abouticons/StaffOff.gif';   
   aImgSrcOff[4] = '../images/abouticons/ClientTestimonialsOff.gif';
   aImgSrcOff[5] = '../images/abouticons/MAHIStoryOff.gif';
   aImgSrcOff[6] = '../images/abouticons/WUMMSIMOff.gif';
   aImgSrcOff[7] = '../images/abouticons/EconomicSurveysOff.gif';



var safeResizeNS4_widthCheck
var safeResizeNS4_heightCheck
var writeToLayer_layers = new Array
var hexValue_hexChar="0123456789ABCDEF";

// functions
var aIcons = new Array();
   aIcons[0] = new makeIcon(0);
   aIcons[1] = new makeIcon(1);
   aIcons[2] = new makeIcon(2);
   aIcons[3] = new makeIcon(3);
   aIcons[4] = new makeIcon(4);
   aIcons[5] = new makeIcon(5);
   aIcons[6] = new makeIcon(6);
   aIcons[7] = new makeIcon(7);
   
function safeResizeNS4(state) {
	if (NS4 && state) {
		safeResizeNS4_widthCheck = window.innerWidth;
		safeResizeNS4_heightCheck = window.innerHeight;
		window.onResize = resizeFixNS4;
	}
}

function resizeFixNS4() {
	// reload a page (NS not happy with relative layer writes/refreshes)
	
	if (safeResizeNS4_widthCheck != window.innerWidth || safeResizeNS4_heightCheck != window.innerHeight) {
		document.location.href = document.location.href;
		document.location.reload(true);
	}	
}

function writeToLayer(layid, text, topOffset, leftOffset) {		
	// for relative layers, mostly to accomodate NS issues - cache to avoid flicker
	
	if (writeToLayer_layers[layid] == text) {
		return false
	} else {
		writeToLayer_layers[layid] = text
	}

	if (IE4) {eval('document.all.' + layid + '.innerHTML = text');}

	if (NS4) {
		// need to accomodate ILayer Netscape bug that prevents writes into relative layers
		var l = document[layid];
		if (!l.overLayer)
		l.overLayer = new Layer (l.clip.width);
		l.overLayer.clip.width = l.clip.width; 
		l.overLayer.clip.height = l.clip.height; 
		l.overLayer.bgColor = l.bgColor;
		l.overLayer.left = l.pageX;
		l.overLayer.top = l.pageY;
		l.overLayer.document.open ();
		l.overLayer.document.write(text);
		l.overLayer.document.close();
		l.visibility = 'hide';
		l.overLayer.visibility = 'show';
	}
}

function IEOrNSTag(IE4Tag, NS4Tag, parms, innerHTML) {
	// produces a tagset as desired for either IE or NS
	var sTag = '';
	var sout = '';
	
	if (IE4) {sTag = IE4Tag} else {if (NS4) {sTag = NS4Tag}}

	sout = '<' + sTag
	if (parms) {
		sout += ' ' + parms
	}
	sout += '>'
	if (innerHTML) {
		sout += innerHTML	
	}
	sout += '</' + sTag + '>'
	return sout;
}

function makeIcon(i)
{
   this.img = aImg[i];
   this.srcOn = aImgSrcOn[i];
   this.srcOff = aImgSrcOff[i];
}
 
  
function LoadContent(i){
   if (SelectedIcon != null){
      SelectedIcon.img.src = SelectedIcon.srcOff;
   }
   
   SelectedIcon = aIcons[i];
}

function IconOver(i){
   aIcons[i].img.src = aIcons[i].srcOn;
}

function IconOut(i){
   if (SelectedIcon != aIcons[i])
      aIcons[i].img.src = aIcons[i].srcOff;
}

