function ShowHide(e)
{
oj = document.getElementById(e);
if(oj.style.display == 'none'){	oj.style.display = "block";oj.parentNode.firstChild.src = "/grfx/searchbox1.gif";}
else {oj.style.display = "none";oj.parentNode.firstChild.src = "/grfx/searchbox.gif";}
}
function show_div(did, tid)
{
changeMenuStyle('clientpages');
hide_alldiv("textcontainer");
if(document.layers){document.layers[did].display = "show"; document.layers[tid].className = "clientpageson";}
else if(document.getElementById){document.getElementById(did).style.display = "block";document.getElementById(tid).className = "listinghover";}
else if(document.all) {document.all[did].style.display = "show";document.all[tid].className = "clientpageson";}
}

function hide_alldiv(did)
{
ox = document.getElementById(did);
for (x=0; x<ox.childNodes.length; x++){
node = ox.childNodes[x];
if (node.nodeName=="DIV") {node.style.display = "none";}
}
}
function changeMenuStyle(e)
{
ox = document.getElementById(e);
for (x=0; x<ox.childNodes.length; x++){
node = ox.childNodes[x];
if (node.nodeName=="LI") {node.className = "clientpagesoff";}
}
}

function addLoadListener(fn)
{
if (typeof window.addEventListener != 'undefined'){window.addEventListener('load', fn, false);}
if (typeof document.addEventListener != 'undefined'){document.addEventListener('load', fn, false);}
if (typeof window.attachEvent != 'undefined'){window.attachEvent('onload', fn);}
else{var oldfn = window.onload;
if (typeof window.onload != 'function')
{
window.onload = fn;
}
else
{
window.onload = function()
{
oldfn();
fn();
}	
}
}
}
function showAdd(did, tid)
{
changeTableStyle('company_bra');
hide_alldiv("addouter");
if(document.layers){document.layers[did].display = "show"; document.layers[tid].className = "bgclick";}
else if(document.getElementById){document.getElementById(did).style.display = "block";document.getElementById(tid).className = "bgon";}
else if(document.all) {document.all[did].style.display = "show";document.all[tid].className = "bgon";}
}
function changeTableStyle(t)
{
ox = document.getElementById(t);
for (x=0; x<ox.childNodes.length; x++){node = ox.childNodes[x];
if(node.nodeName=="TR"){	
for(j=0; j<node.childNodes.length; j++){
mytd = node.childNodes[j];if(mytd.nodeName == "TD" && mytd.className == "bgon"){mytd.className = "bgoff";}}
}}}

//menu bar js
var mmArray = new Array();
	var smArray = new Array();
	var whichMenu;
	var timeout;
	
	function $(id)
	{
		if(document.getElementById(id))
			return document.getElementById(id);
		else
			return false;
	}
	
	function extractNodes(pnode, nodeName)
	{
		var elArr = new Array();
		for(var i=0, j=0; i<pnode.childNodes.length; i++)
		{
			if(pnode.childNodes[i].nodeName == nodeName)
				elArr[j++] = pnode.childNodes[i];
		}
		return(elArr);
	}
	
	function getXYOffset(what) {
		var totalOffset = new Object();
		totalOffset.left = what.offsetLeft;
		totalOffset.top = what.offsetTop;
		var parentEl = what.offsetParent;
		while (parentEl!=null){
			totalOffset.left = totalOffset.left+parentEl.offsetLeft;
			totalOffset.top = totalOffset.top+parentEl.offsetTop;
			parentEl = parentEl.offsetParent;
		}
		return totalOffset;
	}
	
	function showSubMenu()
	{
		if(whichMenu)
		{
			clearTimeout(timeout);
			hidesubMenu();
		}
		var count = parseInt(this.id.substr(2, this.id.length));
		whichMenu = smArray[count];
		whichMenu.style.visibility = "visible";
		if($("iframeshim"))
		{
			offSetX = whichMenu.style.left;
			offSetY = whichMenu.style.top;
			shimobject = $("iframeshim");
			shimobject.style.left = offSetX;
			shimobject.style.top = offSetY;
			shimobject.style.width = whichMenu.offsetWidth+"px";
			shimobject.style.height = whichMenu.offsetHeight+"px";
			shimobject.style.display = "block";
		}
	}
	
	function clearSubMenu() 
	{
		timeout = setTimeout("hidesubMenu()", 500);
	}
	
	function cancelClearMenu()
	{
		clearTimeout(timeout);
	}
	
	function hidesubMenu()
	{
		if(whichMenu)
			whichMenu.style.visibility = "hidden";
		if($("iframeshim"))
		{
			shimobject = $("iframeshim");
			shimobject.style.display = "none";
		}
	}
	
function init()
{
	//init drop down menu
	var browser = navigator.appName;
		var el = $("mainmenu");
		for(var i=0; i<el.childNodes.length; i++)
		{
			if(el.childNodes[i].nodeName == "UL")
			{
				el = el.childNodes[i];
				break;
			}
		}
		mmArray = extractNodes(el, "LI");
		smArray = extractNodes($("submenu"), "DIV");
		for(var i=0; i<mmArray.length; i++)
		{
			mmArray[i].id = "mm"+i;
			var offset = getXYOffset(mmArray[i]);
			smArray[i].style.left = offset.left+"px";
			smArray[i].style.top = offset.top+mmArray[i].offsetHeight+"px";
			mmArray[i].onmouseover = showSubMenu;
			mmArray[i].onmouseout = clearSubMenu;
			smArray[i].onmouseover = cancelClearMenu;
			smArray[i].onmouseout = clearSubMenu;
		}
		document.onclick = function() {
			clearTimeout(timeout);
			hidesubMenu();
		}
		if(browser == "Microsoft Internet Explorer")
		{
			document.write('<IFRAME id="iframeshim" src="about:blank" frameBorder="0" scrolling="no" style="position:absolute; display:none;z-index:999; background: transparent;"></IFRAME>');
		}
}