/*NAME: NCRETAC_TEMPLATE.js
	UPDATED: 5/15/2008*/

var dA = {};
	dA.getX = function(e){var x = 0;
							while(e){x += e.offsetLeft; e = e.offsetParent;}
							return x;}
	dA.getY = function(e){var y = 0;
							while(e){y += e.offsetTop; e = e.offsetParent;}
							return y;}
	dA.browser = {};	
	if(window.innerWidth)
		{
			dA.browser.width = function() {return window.innerWidth;};
			dA.browser.height = function() {return window.innerHeight;};
			dA.browser.x = function() {return window.pageXOffset;};
			dA.browser.y = function() {return window.pageYOffset;};
		}
	else if(document.documentElement && document.documentElement.clientWidth) //IE
		{
			dA.browser.width = function() {return document.documentElement.clientWidth;};
			dA.browser.height = function() {return document.documentElement.clientHeight;};
			dA.browser.x = function() {return document.documentElement.scrollLeft;};
			dA.browser.y = function() {return document.documentElement.scrollTop;};
		}

var menuFunctions = {};
	menuFunctions.vars = {}
	menuFunctions.vars.current = null;
	menuFunctions.vars.timerID = null;
	menuFunctions.vars.holdTime = 350;
	menuFunctions.openMenu = function() {for(var i=0; i<this.childNodes.length; i++)
										{var nRef = this.childNodes[i];
											if(nRef.nodeType==1 && nRef.nodeName=="DIV")
											{menuFunctions.killCurrent();
												menuFunctions.vars.current = nRef;
												nRef.style.left = new String(dA.getX(this)) + "px";
												nRef.style.top = new String(dA.getY(this) + this.offsetHeight) + "px";
												nRef.style.visibility = "visible";}}}
	menuFunctions.closeMenu = function() {menuFunctions.vars.timerID = window.setTimeout(menuFunctions.killCurrent, menuFunctions.vars.holdTime);}
	menuFunctions.killCurrent = function(){if(menuFunctions.vars.timerID){window.clearTimeout(menuFunctions.vars.timerID); menuFunctions.vars.timerID=null;}
												if(menuFunctions.vars.current){menuFunctions.vars.current.style.visibility = "hidden"; menuFunctions.vars.current=null;}}
	menuFunctions.buildMenu = function() {var nB = document.getElementById("navBar");
											var nbA = nB.getElementsByTagName("IMG");
											if(nbA.length)
												{for(var i=0; i<nbA.length; i++)
														{var cDiv = document.createElement("DIV");
															var rImg = nbA[i].parentNode.replaceChild(cDiv, nbA[i]);
															cDiv.appendChild(rImg);
															var tN = document.getElementById(new String(nbA[i].id + "SUB"));
															if(tN){tN.className = "dropDown";
																	var rN = tN.parentNode.removeChild(tN);
																	var rpN = cDiv.appendChild(rN);
																	cDiv.onmouseover = menuFunctions.openMenu;
																	cDiv.onmouseout = menuFunctions.closeMenu;}}}}