/**************
* RTR dhtml menus
***************
* last updated: 11/13/2002 by: Jeff Moskow
*
*/

/**************
* dhtml menus
***************
*
*/
var itsgood = document.images;
var menuoff = new Array();
var menuon = new Array();
var imagePath = pathMod + "images/";

// menu rollovers.
		
menuname = new Array();
menuname[0] = "about";
menuname[1] = "products";
menuname[2] = "media";
menuname[3] = "client";
menuname[4] = "careers";

for(var j=0;j<menuname.length;j++) {
    if (itsgood) { 
	menuoff[j] = new Image();
	menuoff[j].src = imagePath + menuname[j] + '.gif';
	menuon[j] = new Image();
	menuon[j].src = imagePath + menuname[j] + '_o.gif';
    }
}

if (itsgood) {
    menuon[6] = new Image();
    menuon[6].src = imagePath + 'about_o.gif';
    menuon[7] = new Image();
    menuon[7].src = imagePath + 'products_o.gif';
    menuon[8] = new Image();
    menuon[8].src = imagePath + 'media_o.gif';
    menuon[9] = new Image();
    menuon[9].src = imagePath + 'client_o.gif';
    menuon[10] = new Image();
    menuon[10].src = imagePath + 'careers_o.gif';
}

function clearMenu(name){
    for (var cnt=0;cnt<menuname.length;cnt++){
	if(menuname[cnt]!=name){
	    document.images[menuname[cnt]].src = menuoff[cnt].src;
	}else{
	    document.images[menuname[cnt]].src = menuon[cnt].src;
	}
    }
}	
//**************************************************************************************************
//setup variables
/*menu setup variables*/
//positioning
menuWidth = 220;		
initXOffset = 7;		//distance from the left of the parent element to the left of the first menu (was 10)
initYOffset = 292;		//distance from the top of the parent element to the top of the first menu
childOverlap = 2; 		//# pixels child menus horizontally overlap parent
childOffset = 0; 		//# pixels from top of parent to top of child menu
perCentOver = null; 	        //percentage value which overrides childOverlap

//behaviours
clickKill = false; 		//whether window must be clicked to close child menus
secondsVisible = 0.43; 	//number of seconds menu will persist after mouseout if clickKill = false

//font appearance
fntCol = "#FFFFFF"; 		//font color of menu items
fntSiz = "9"; 			//font size of menu items in points 
fntBold = true;			//well duh
fntItal = false;		//ditto
fntFam = "Verdana";	 	//font family of menu items
overFnt = "white";		//font color of menu item on mouseover note: in NN NSFontOver must = true for this to work

//borders & background appearance
backCol = "#425367"; 		//background color
overCol = "#748AAB";		//background color of menu item on mouseover
borWid = 2;			//border width in pixels
borCol = "white";		//border color#9CA1A6
borSty = "solid";		//border style note: explorer only
itemPad = 3;			//cell padding for menu items
imgSrc = "/images/tri.gif";	//child indicator graphic
imgSiz = 10;			//size of child indicator graphic
separator = 0;			//height of line that separates menu items
separatorCol = "white";		//color of line that separates menu items#9CA1A6
keepHilite = true; 		//whether parent menu item stays hilited while child is browsed

//************************************************************************************************************************
//Heeeeerre we go!!!!!!!!!!!!

loader = window;
loader.onload = startIt;

if(NS4){
    origWidth = loader.innerWidth;
    origHeight = loader.innerHeight;
    loader.onresize = reDo;
}

isLoaded = false;
NSresized = false;

if (!window.imgHspace) imgHspace=0;

isWin = (navigator.appVersion.indexOf("Win") != -1)
    if (!isWin && !isMac) showVisited = false;

mSecsVis = secondsVisible*1000;
isRight = (window.navFrLoc && navFrLoc == "right");

imgSuf = (isRight) ? ">"  : " ALIGN=RIGHT>";

imgStr = "<IMG SRC='" + imgSrc + "' WIDTH=" + imgSiz + " HEIGHT=" + imgSiz +" VSPACE=2 HSPACE="+ imgHspace +" BORDER=0"+ imgSuf;

fullImgSize = (imgSiz+(imgHspace*2));

if(IE4) imgStr = "<SPAN STYLE='height:100%;width:"+ (fullImgSize-(isRight?3:0)) +";float:"+ (isRight?"left":"right") +";overflow:hidden'>"+ imgStr +"</SPAN>";


areCreated = false;
menuLoc = null;

function initVars() {
    if(areCreated) {
	for(i=1; i<topCount; i++) {
	    cur = eval("elMenu"+i);
	    clearTimeout(cur.hideTimer);
	    cur.hideTimer=null;
	}
	clearTimeout(allTimer);
    }
    topCount = 1;
    areCreated = false;
    beingCreated = false;
    isOverMenu = false;
    currentMenu = null;
    allTimer = null;
}

initVars();

function keepTrack() {
    if (menuLoc.document.readyState == "complete") {
	initVars();
	startIt();
    }
    else {
	setTimeout("keepTrack()",50);
    }
}

function startIt() {
    isLoaded = true;
    menuLoc = window;
    menuLoc.nav = nav = window;
    if (clickKill) {
	if (NS4) menuLoc.document.captureEvents(Event.MOUSEDOWN);
	menuLoc.document.onmousedown = clicked;
    }
    makeTop();	
}

function makeTop(){
    beingCreated = true;
    if(IE4) {
	topZ = 0;
	for (z=0;z<menuLoc.document.all.length;z++){
	    oldEl = menuLoc.document.all(z);
	    topZ = Math.max(oldEl.style.zIndex,topZ)
		}
    }
    while(eval("window.arMenu" + topCount)) {
	(NS4) ? makeMenuNS(false,topCount) : makeMenuIE(false,topCount);
	topCount++
	    }

    status = "Popup Menus Loaded"
	areCreated = true;
    beingCreated = false;
}

function makeMenuNS(isChild,menuCount,parMenu,parItem) {
    tempArray = eval("arMenu" + menuCount);
	
    if (!isChild) {
	tempWidth = tempArray[0] ? tempArray[0] : menuWidth;
	menu = makeElement("elMenu" + menuCount,tempWidth,null,null);
    }
    else {
	menu = makeElement("elMenu" + menuCount,null,parMenu,null);
    }
    menu.array = tempArray;
    menu.setMenuTree = setMenuTree;
    menu.setMenuTree(isChild,parMenu);

    while (menu.itemCount < menu.maxItems) {
	menu.itemCount++;
	status = "Loading Popup Menus";
	prevItem = (menu.itemCount > 1) ? menu.item : null;
	itemName = "item" + menuCount + "_" + menu.itemCount;

	menu.item = makeElement(itemName,null,null,menu);

	menu.item.prevItem = prevItem;
	menu.item.setup = itemSetup;
	menu.item.setup(menu.itemCount,menu.array);
	if (menu.item.hasMore) {
	    makeMenuNS(true,menuCount + "_" + menu.itemCount,menu,menu.item);
	    menu = menu.parentMenu;
	}
    }

    menu.lastItem = menu.item;
    menu.setup(isChild,parMenu,parItem);
}

function findTree(men){
    foundTree = false;
    for(i=11;i<men.array.length;i+=3){
	if(men.array[i]) {
	    foundTree = true;
	    break;
	}
    }

    return foundTree;
}

function setMenuTree(isChild,parMenu) {
    if (!isChild) {
	this.menuWidth = this.array[0] ? this.array[0] : menuWidth;
	this.menuLeft = this.array[1];
	this.menuTop = this.array[2];
	this.menuFontColor = this.array[3] ? this.array[3] : fntCol;
	this.menuFontOver = this.array[4] ? this.array[4] : overFnt;
	this.menuBGColor = this.array[5] ? this.array[5] : backCol;
	this.menuBGOver = this.array[6] ? this.array[6] : overCol;
	this.menuBorCol = this.array[7] ? this.array[7] : borCol;
	this.menuSeparatorCol = this.array[8] ? this.array[8] : separatorCol;
	this.treeParent = this;
	this.startChild = this;

	this.isTree = findTree(this);
    }
    else {
	this.menuWidth = parMenu.menuWidth;
	this.menuLeft = parMenu.menuLeft;
	this.menuTop = parMenu.menuTop;
	this.menuFontColor = parMenu.menuFontColor;
	this.menuFontOver = parMenu.menuFontOver;
	this.menuBGColor = parMenu.menuBGColor;
	this.menuBGOver = parMenu.menuBGOver;
	this.menuBorCol = parMenu.menuBorCol;
	this.menuSeparatorCol = parMenu.menuSeparatorCol;
	this.treeParent = parMenu.treeParent;
	this.isTree = parMenu.isTree;
    }

    this.maxItems = (isChild) ? this.array.length/3 : (this.array.length-9)/3;
    this.hasParent = isChild;
    this.setup = menuSetup;
    this.itemCount = 0;
}

function makeMenuIE(isChild,menuCount,parMenu) {

    menu = makeElement("elMenu" + menuCount);
    menu.array = eval("arMenu" + menuCount);

    menu.setMenuTree = setMenuTree;
    menu.setMenuTree(isChild,parMenu);

    menu.itemStr = "";
	
    while (menu.itemCount < menu.maxItems) {
	menu.itemCount++;
	//status = "Creating Hierarchical Menus: " + menuCount + " / " + menu.itemCount;
	itemName = "item" + menuCount + "_" + menu.itemCount;

	arrayPointer = (isChild) ? (menu.itemCount-1)*3 :((menu.itemCount-1)*3)+9;
	dispText = menu.array[arrayPointer];
	hasMore = menu.array[arrayPointer + 2];
	htmStr = (hasMore) ? imgStr + dispText : dispText;

	menu.itemStr += "<SPAN ID=" + itemName + " STYLE=\"width:" + (menu.menuWidth-(borWid*2)) + "\">" + htmStr + "</SPAN><BR>";

	if (hasMore) {
	    makeMenuIE(true,menuCount + "_" + menu.itemCount,menu);
	    menu = menu.parentMenu;
	}	
    }

    menu.innerHTML = menu.itemStr;
    itemColl = menu.children.tags("SPAN");
    for (i=0; i<itemColl.length; i++) {
	it = itemColl(i);
	it.setup = itemSetup;
	it.setup(i+1,menu.array);
    }
    menu.lastItem = itemColl(itemColl.length-1);
    menu.setup(isChild,parMenu);
}

function makeElement(whichEl,whichWidth,whichParent,whichContainer) {
    if (NS4) {
	if (whichWidth) {
	    elWidth = whichWidth;
	}
	else {
	    elWidth = (whichContainer) ? whichContainer.menuWidth : whichParent.menuWidth;
	    if (whichContainer) elWidth = elWidth-(borWid*2)-(itemPad*2);
	}
	if (!whichContainer) whichContainer = menuLoc;
	eval(whichEl + "= new Layer(elWidth,whichContainer)");
    }
    else {
	elStr = "<DIV ID=" + whichEl + " STYLE='position:absolute'></DIV>";
	menuLoc.document.body.insertAdjacentHTML("BeforeEnd",elStr);
    }
    return eval(whichEl);
}

function itemSetup(whichItem,whichArray) {
    this.onmouseover = itemOver;
    this.onmouseout = itemOut;
    this.container = (NS4) ? this.parentLayer : this.offsetParent;

    arrayPointer = (this.container.hasParent) ? (whichItem-1)*3 : ((whichItem-1)*3)+9;

    this.dispText = whichArray[arrayPointer];
    this.linkText = whichArray[arrayPointer + 1];
    this.hasMore = whichArray[arrayPointer + 2];

    if (IE4 && this.hasMore) {
	this.child = eval("elMenu" + this.id.substr(4));
	this.child.parentMenu = this.container;
	this.child.parentItem = this;
    }

    if (this.linkText) {
	if (NS4) {
	    this.captureEvents(Event.MOUSEUP)
		this.onmouseup = linkIt;
	}
	else {
	    this.onclick = linkIt;
	    this.style.cursor = "hand";
	}
    }

    if (NS4) {
	htmStr = this.dispText;
	if (fntBold) htmStr = htmStr.bold();
	if (fntItal) htmStr = htmStr.italics();

	htmStr = "<FONT FACE='" + fntFam + "' POINT-SIZE=" + fntSiz + ">" + htmStr+ "</FONT>";

	this.htmStrOver = htmStr.fontcolor(this.container.menuFontOver);
	this.htmStr = htmStr.fontcolor(this.container.menuFontColor);

	if(this.hasMore) {
	    this.document.write(imgStr);
	    this.document.close();
	}

	this.visibility = "inherit";
	this.bgColor = this.container.menuBGColor;

	if (whichItem == 1) {
	    this.top = borWid + itemPad;
	}
	else {
	    this.top = this.prevItem.top + this.prevItem.clip.height + separator;
	}
	this.left = borWid + itemPad;
	this.clip.top = this.clip.left = -itemPad;
	this.clip.right = this.container.menuWidth-(borWid*2)-itemPad;

	maxTxtWidth = this.container.menuWidth-(borWid*2)-(itemPad*2);
	if (this.container.isTree) maxTxtWidth-=(fullImgSize); 

	this.txtLyr = new Layer(maxTxtWidth,this);

	if (isRight && this.container.isTree) this.txtLyr.left = fullImgSize;

	this.txtLyr.document.write(this.htmStr);
	this.txtLyr.document.close();
	this.txtLyr.visibility = "inherit";

	this.clip.bottom = this.txtLyr.document.height+itemPad;

	this.dummyLyr = new Layer(100,this);
	this.dummyLyr.left = this.dummyLyr.top = -itemPad;
	this.dummyLyr.clip.width = this.clip.width;
	this.dummyLyr.clip.height = this.clip.height;
	this.dummyLyr.visibility = "inherit";
    }
    else {
	with (this.style) {
	    padding = itemPad;

	    if (this.container.isTree && !this.hasMore) {
		if (isRight) paddingLeft = itemPad+fullImgSize;
		else paddingRight = itemPad+fullImgSize;
	    }
	    color = this.container.menuFontColor;
	    fontSize = fntSiz + "pt";
	    fontWeight = (fntBold) ? "bold" : "normal";
	    fontStyle =	(fntItal) ? "italic" : "normal";
	    fontFamily = fntFam;
		
	    borderBottomWidth = separator + "px";
	    borderBottomColor = this.container.menuSeparatorCol;
	    borderBottomStyle = "solid";
	    backgroundColor = this.container.menuBGColor;
	}
    }
}	

function menuSetup(hasParent,openCont,openItem) {
    this.onmouseover = menuOver;
    this.onmouseout = menuOut;
	
    this.showIt = showIt;
    this.keepInWindow = keepInWindow;
    this.hideTree = hideTree
	this.hideParents = hideParents;
    this.hideChildren = hideChildren;
    this.hideTop = hideTop;
    this.hasChildVisible = false;
    this.isOn = false;
    this.hideTimer = null;

    this.childOverlap = (perCentOver != null) ? ((perCentOver/100) * this.menuWidth) : childOverlap;
    this.currentItem = null;
    this.hideSelf = hideSelf;
		
    if (hasParent) {
	this.hasParent = true;
	this.parentMenu = openCont;
	if (NS4) {
	    this.parentItem = openItem;
	    this.parentItem.child = this;
	}
    }
    else {
	this.hasParent = false;
    }

    if (NS4) {
	this.bgColor = this.menuBorCol;
	this.fullHeight = this.lastItem.top + this.lastItem.clip.bottom + borWid;
	this.clip.right = this.menuWidth;
	this.clip.bottom = this.fullHeight;
    }
    else {
	with (this.style) {
	    width = this.menuWidth;
	    borderWidth = borWid;
	    borderColor = this.menuBorCol;
	    borderStyle = borSty;
	    zIndex = topZ;
	}

	this.lastItem.style.border="";
	this.fullHeight = this.scrollHeight;
	this.showIt(false);
	this.onselectstart = cancelSelect;
	this.moveTo = moveTo;
	this.moveTo(0,0);
    }
}

function getNumber(section){
    for (var cnt=0;cnt<menuname.length;cnt++){
	if (menuname[cnt] == section){
	    return cnt; 
	}
    }
    return -1;
}

function popUp(menuName, e, section){

    var number = getNumber(section);
    clearMenu(section);
    if (itsgood) {
	document.images[section].src = menuon[number].src;
	switch (section) {
	    case "about":
		document.images["about"].src = menuon[6].src; 
		break;
	    case "products":
		document.images["products"].src = menuon[7].src;
		break;
	    case "media":
		document.images["media"].src = menuon[8].src; 
		break;
	    case "client":
		document.images["client"].src = menuon[9].src;
		break;
	    case "careers": 
		document.images["careers"].src = menuon[10].src;
		break;
	}
    }
    onSection = section;
    if (NS4 && NSresized) startIt();
    if (!isLoaded) return;
    linkEl = (NS4) ? e.target : event.srcElement;

    parentEl = (NS4) ? eval("window.document." + section) : eval("document.all." + section);
    if (!beingCreated && !areCreated) startIt();
    linkEl.menuName = menuName;	
    popMenu(e, parentEl);
    return;
}

function popMenu(e, parentEl){
    if (!isLoaded || !areCreated) return true;

    eType = (NS4) ? e.type : event.type;
    hideAll();

    linkEl = (NS4) ? e.target : event.srcElement;
	
    currentMenu = eval(linkEl.menuName);
    currentMenu.hasParent = false;
    currentMenu.treeParent.startChild = currentMenu;
	
    if (IE4) menuLocBod = menuLoc.document.body;
	
    xPos = (currentMenu.menuLeft) ? currentMenu.menuLeft : (NS4) ? parentEl.x + initXOffset : (parentEl.offsetLeft + parentEl.offsetParent.offsetLeft + initXOffset + menuLocBod.scrollLeft);
    yPos = (currentMenu.menuTop) ? currentMenu.menuTop : (NS4) ? parentEl.y + initYOffset : (parentEl.offsetTop + parentEl.offsetParent.offsetTop + initYOffset + menuLocBod.scrollTop);

    currentMenu.moveTo(xPos,yPos);
    currentMenu.keepInWindow()
	currentMenu.isOn = true;
    currentMenu.daddy = parentEl.name;
    currentMenu.showIt(true);
    return false;
}

function menuOver(e) {
    this.isOn = true;
    isOverMenu = true;
    currentMenu = this;
    if (this.hideTimer) clearTimeout(this.hideTimer);
}

function menuOut() {
    if (IE4) {
	theEvent = menuLoc.event;
	if (theEvent.srcElement.contains(theEvent.toElement)) return;
    }
    this.isOn = false;
    isOverMenu = false;

    menuLoc.status = "";
    if (!clickKill) allTimer = setTimeout("currentMenu.hideTree()",10);  
}

function itemOver(){
    if (keepHilite) {
	if (this.container.currentItem && this.container.currentItem != this) {
	    if (NS4) {
		this.container.currentItem.bgColor = this.container.menuBGColor;
		with (this.container.currentItem.txtLyr.document) {
		    write(this.container.currentItem.htmStr)
			close();
		}
	    }
	    else {
		with (this.container.currentItem.style) {
		    backgroundColor = this.container.menuBGColor;
		    color = this.container.menuFontColor;
		}
	    }
	}
    }

    if (IE4) {
	theEvent = menuLoc.event;
	if (theEvent.srcElement.tagName == "IMG") return;
	this.style.backgroundColor = this.container.menuBGOver;
	this.style.color = this.container.menuFontOver;
    }
    else {
	this.bgColor = this.container.menuBGOver;
	this.txtLyr.document.write(this.htmStrOver);
	this.txtLyr.document.close();
    }

    menuLoc.status = this.linkText;

    this.container.currentItem = this;

    if (this.container.hasChildVisible) {
	this.container.hideChildren(this);
    }

    if (this.hasMore) {
	horOffset = (isRight) ? (this.container.childOverlap - this.container.menuWidth) : (this.container.menuWidth - this.container.childOverlap);

	if (NS4) {
	    this.childX = this.container.left + horOffset;
	    this.childY = (this.pageY+this.clip.top) + childOffset;
	}
	else {
	    this.childX = this.container.style.pixelLeft + horOffset;
	    this.childY = this.offsetTop + this.container.style.pixelTop + childOffset + borWid;
	}

	this.child.moveTo(this.childX,this.childY);
	this.child.keepInWindow();
	this.container.hasChildVisible = true;
	this.container.visibleChild = this.child;
	this.child.showIt(true);
    }
}

function itemOut() {
    if (IE4) {
	theEvent = menuLoc.event;
    	if (theEvent.srcElement.contains(theEvent.toElement)
	    || (theEvent.fromElement.tagName=="IMG" && theEvent.toElement.contains(theEvent.fromElement)))
	    return;
	if (!keepHilite) {
	    this.style.backgroundColor = this.container.menuBGColor;
	    this.style.color = this.container.menuFontColor;
	}
    }
    else {
	if (!keepHilite) {
	    this.bgColor = this.container.menuBGColor;
	    with (this.txtLyr.document) {
		write(this.htmStr);
		close();
	    }
	}
	if (!isOverMenu && !clickKill) {
	    allTimer = setTimeout("currentMenu.hideTree()",10); 
	}
    }
}

function moveTo(xPos,yPos) {
    this.style.pixelLeft = xPos;
    this.style.pixelTop = yPos;
}

function showIt(on) {
    if (NS4) {
	this.visibility = (on) ? "show" : "hide";
	if (keepHilite && this.currentItem) {
	    this.currentItem.bgColor = this.menuBGColor;
	    with (this.currentItem.txtLyr.document) {
		write(this.currentItem.htmStr);
		close();
	    }
	}
    }
    else {
	this.style.visibility = (on) ? "visible" : "hidden";
	if (keepHilite && this.currentItem) {
	    with (this.currentItem.style) {
		backgroundColor = this.menuBGColor;
		color = this.menuFontColor;
	    }
	}
    }
    this.currentItem = null;
}

function keepInWindow() {
    scrBars = 20;
    botScrBar = (borWid*2);
    rtScrBar = (borWid*2);
    if (NS4) {
	winRight = (menuLoc.pageXOffset + menuLoc.innerWidth) - rtScrBar;
	rightPos = this.left + this.menuWidth;
   
	if (rightPos > winRight) {
	    if (this.hasParent) {
		parentLeft = this.parentMenu.left;
		newLeft = ((parentLeft-this.menuWidth) + this.childOverlap);
		this.left = newLeft;
	    }
	    else {
		dif = rightPos - winRight;
		this.left -= dif;
	    }
	}

	winBot = (menuLoc.pageYOffset + menuLoc.innerHeight) - botScrBar ;
	botPos = this.top + this.fullHeight;

	if (botPos > winBot) {
	    dif = botPos - winBot;
	    this.top -= dif;
	}
		
	winLeft = menuLoc.pageXOffset;
	leftPos = this.left;

	if (leftPos < winLeft) {
	    if (this.hasParent) {
		parentLeft = this.parentMenu.left;
		newLeft = ((parentLeft+this.menuWidth) - this.childOverlap);
		this.left = newLeft;
	    }
	    else {
		this.left = 5;
	    }
	}
    }
    else {
    	winRight = (menuLoc.document.body.scrollLeft + menuLoc.document.body.clientWidth) - rtScrBar;
	rightPos = this.style.pixelLeft + this.menuWidth;
	
	if (rightPos > winRight) {
	    if (this.hasParent) {
		parentLeft = this.parentMenu.style.pixelLeft;
		newLeft = ((parentLeft - this.menuWidth) + this.childOverlap);
		this.style.pixelLeft = newLeft;
	    }
	    else {
		dif = rightPos - winRight;
		this.style.pixelLeft -= dif;
	    }
	}

	winBot = (menuLoc.document.body.scrollTop + menuLoc.document.body.clientHeight) - botScrBar;
	botPos = this.style.pixelTop + this.fullHeight;

	if (botPos > winBot) {
	    dif = botPos - winBot;
	    this.style.pixelTop -= dif;
	}
		
	winLeft = menuLoc.document.body.scrollLeft;
	leftPos = this.style.pixelLeft;

	if (leftPos < winLeft) {
	    if (this.hasParent) {
		parentLeft = this.parentMenu.style.pixelLeft;
		newLeft = ((parentLeft+this.menuWidth) - this.childOverlap);
		this.style.pixelLeft = newLeft;
	    }
	    else {
		this.style.pixelLeft = 5;
	    }
	}
    }
}

function linkIt() {
    if (this.linkText.indexOf("javascript:")!=-1) eval(this.linkText)
				                      else menuLoc.location.href = this.linkText;
}

function popDown(menuName, section){
    if (!isLoaded || !areCreated) return;
    whichEl = eval(menuName);
    whichEl.isOn = false;
    whichEl.hideTop(section);
    //alert(isOverMenu);
}

function hideAll() {
    for(i=1; i<topCount; i++) {
	temp = eval("elMenu" + i + ".startChild");
	temp.isOn = false;
	if (temp.hasChildVisible) temp.hideChildren();
	temp.showIt(false);
    }	
}

function hideTree() { 
    allTimer = null;
    if (isOverMenu) return;
    if (this.hasChildVisible) {
	this.hideChildren();
    }
    this.hideParents();
}

function hideTop(section) {
    whichTop = this;
    (clickKill) ? whichTop.hideSelf() : (this.hideTimer = setTimeout("if(whichTop.hideSelf)whichTop.hideSelf();doIt('"+this.daddy+"');",mSecsVis));
}

function doIt(section){
    var number = getNumber(section);
    if (!isOverMenu){
	//if the section currently switched on is not the one we're about to switch off proceed...
	if(!currentMenu.isOn){
	    //		if (itsgood){
	    //			document.images[section].src = off[number].src;
	    //		}
	    if (itsgood){
		document.images[section].src = menuoff[number].src;
		switch (section) {
		    case "about":
			document.images["products"].src = menuoff[1].src; // turn menuoff right image
			break;
		    case "products":
			document.images["media"].src = menuoff[2].src;
			break;
		    case "media":
			document.images["client"].src = menuoff[3].src; // turn menuoff right image
			break;
		    case "client":
			document.images["careers"].src = menuoff[4].src;
			break;
		}
	    }
	}
    }	
}

function hideSelf() {
    this.hideTimer = null;
    if (!this.isOn && !isOverMenu) { 
	this.showIt(false);
    }
}

function hideParents() {
    tempMenu = this;
    while (tempMenu.hasParent) {
	tempMenu.showIt(false);
	tempMenu.parentMenu.isOn = false;		
	tempMenu = tempMenu.parentMenu;
    }
    tempMenu.hideTop();
}

function hideChildren(item) {
    tempMenu = this.visibleChild;
    while (tempMenu.hasChildVisible) {
	tempMenu.visibleChild.showIt(false);
	tempMenu.hasChildVisible = false;
	tempMenu = tempMenu.visibleChild;
    }

    if (!this.isOn || !item.hasMore || this.visibleChild != this.child) {
	this.visibleChild.showIt(false);
	this.hasChildVisible = false;
    }
}

function cancelSelect(){return false}

function reDo(){
    if (loader.innerWidth==origWidth && loader.innerHeight==origHeight) return;
    initVars();
    NSresized=true;
    menuLoc.location.reload();
}

function clicked() {
    if (!isOverMenu && currentMenu!=null && !currentMenu.isOn) {
	whichEl = currentMenu;
	whichEl.hideTree();
    }
}

window.onerror = handleErr;

function handleErr(){
    arAccessErrors = ["permission","access"];
    mess = arguments[0].toLowerCase();
    found = false;
    for (i=0;i<arAccessErrors.length;i++) {
	errStr = arAccessErrors[i];
	if (mess.indexOf(errStr)!=-1) found = true;
    }
    return found;
}

//end1
