//grab level and assign correct path to images, etc.
if (Level == 1)
	path = "../";
else if (Level == 2)
	path = "../../";
else if (Level == 3)
	path = "../../../";
else
	path = "";

//browser check
var bname = navigator.appName;
var bver  = parseFloat(navigator.appVersion);

var w3c = (document.getElementById && bname=="Netscape" && bver >= 5.00) ? 1:0
var ns4 = (document.layers && bver < 5) ? 1:0
var ie4 = (document.all) ? 1:0

//choose appropriate stylesheet
document.write ('<link href="' +path+ 'include/ie.css" rel="stylesheet" type="text/css">');
if(ie4||w3c) 
{
	document.write ('<link href="' +path+ 'include/ie.css" rel="stylesheet" type="text/css">');
}

//set variables
if (w3c) {
  doc = "document.getElementById";
  sty = ".style";
  htm = ".document"
  sho = "visible"
  hid = "hidden"
} else if (ns4) {
  doc = "document.layers";
  sty = "";
  htm = ".document"
  sho = "show"
  hid = "hide"
} else if (ie4) {
  doc = "document.all";
  sty = ".style";
  htm = ""
  sho = "visible"
  hid = "hidden"
}

//get layer object
function getObj(name) 
{
	if (w3c) { return eval(doc + '(name)' + sty) } 
	else     { return eval(doc + '[name]' + sty) }
}

//get layer object without style
function getObjOnly(name) 
{
	if (w3c) { return eval(doc + '(name)') } 
	else     { return eval(doc + '[name]') }
}

//popmenus
var curId = null;
var curMenu = null;
var whoId = null;
var whoMenu = null;
var whatId = null;
var whatMenu = null;

function show(mId, mName) {
	curId = getObj(mId);
	curMenu = getObj(mName);
	
	whoId = getObj('who');
	whoMenu = getObj('whoweareMenu');
	whatId = getObj('what');
	whatMenu = getObj('whatwedoMenu');

	whoId.ypos = parseInt(whoId.top);
	whatId.ypos = parseInt(whatId.top);
	
	topPos = 60;
	botPos = 160;

	if(curId != null && curMenu != null) {
		// If the current menu is "Who We Are"..
		if(curId == whoId) {
			// If "What We Do" button is not already expanded,
			// move it to the bottom position and show the
			// "Who We Are" menu. Also change the "Who We Are"
			// button to active orange state and the "What We Do"
			// button to it's normal state.
			if(whatId.ypos != botPos) {
				whatId.top = botPos;
				whoMenu.visibility = sho;
				whatMenu.visibility = hid;
				swapImg("whoweare", path+ "images/nav_whoweare_a.gif");
				swapImg("whatwedo", path+ "images/nav_whatwedo.gif");
			// If "What We Do" button IS already expanded,
			// move it to the top position and hide the
			// "Who We Are" menu. Also change the "Who We Are"
			// button to it's normal state.
			} else {
				whatId.top = topPos;
				whoMenu.visibility = hid;
				swapImg("whoweare", path+ "images/nav_whoweare.gif");
			}
		}
		// If the current menu is "What We Do"..
		if(curId == whatId) {
			// If "What We Do" button is not already at the top,
			// move it to the top position and show the
			// "What We Do" menu. Also change the "What We Do"
			// button to active orange state and the "Who We Are"
			// button to it's normal state.
			if(whatId.ypos != topPos) {
				whatId.top = topPos;
				whatMenu.visibility = sho;
				whoMenu.visibility = hid;
				swapImg("whatwedo", path+ "images/nav_whatwedo_a.gif");
				swapImg("whoweare", path+ "images/nav_whoweare.gif");
			// If "What We Do" button is already at the top,
			// and the "What We Do" menu is already being
			// shown, hide the "What We Do" menu. Also change 
			// the "What We Do" button to it's normal state.
			// If the "What We Do" menu is NOT already being shown,
			// show it and change the "What We Do" button to
			// active orange state and the "Who We Are"
			// button to it's normal state.
			} else {
				if(whatMenu.visibility == sho) {
					whatMenu.visibility = hid;
					swapImg("whatwedo", path+ "images/nav_whatwedo.gif");
				} else {
					whatMenu.visibility = sho
					swapImg("whatwedo", path+ "images/nav_whatwedo_a.gif");
					swapImg("whoweare", path+ "images/nav_whoweare.gif");
				}
			}
		}
	}
}

//toggle visibility
function toggle(id) {
	layerId = getObj(id);
	(layerId.visibility == hid) ? layerId.visibility = sho : layerId.visibility = hid;
}

//scroll
function setScroll(scroll) {
	scrolling = scroll;
}
function scrollDn() {
	layerId.ht = layerObj.offsetHeight;
	if (layerId.ht < 260)	// if text height is smaller than window,
		layerId.ht = 260;	// make it the size of the window
	//alert(layerId.ht);
	scrlId.ht = (260/layerId.ht);
	//alert(scrlId.ht);
	layerId.ht = layerObj.offsetHeight - 269;
	
	if (layerId.ypos > -layerId.ht) {
	
		if (w3c) { layerId.ypos -= 10 } 
		else { layerId.ypos -= 1 }
		
		layerId.top = layerId.ypos;
		
		if (w3c) { scrlId.ypos += scrlId.ht*10 } 
		else { scrlId.ypos += scrlId.ht }
		
		scrlId.top = scrlId.ypos;
		
		if (scrolling==1) {
      		setTimeout("scrollDn()",1);
    	}
	}
}
function scrollUp() {
	if (layerId.ypos < 10) {
	
		if (w3c) { layerId.ypos += 10 } 
		else { layerId.ypos += 1 }
		
		layerId.top = layerId.ypos;
		
		if (w3c) { scrlId.ypos -= scrlId.ht*10 } 
		else { scrlId.ypos -= scrlId.ht }
		
		scrlId.top = scrlId.ypos;
		
		if (scrolling==2) {
      		setTimeout("scrollUp()",1);
    	}
	}
}

//image rollover
function swapImg(sImg, sNewImg)
{ 
	document.images[sImg].src = sNewImg;
}

//error handling
//window.onerror = errorHandler;
function errorHandler() {
	return true;
}
