function initPage()
{
	if (document.all && !window.opera)
	{
		var nav = document.getElementById("main-nav");
		if (nav)
		{
			var nodes = nav.getElementsByTagName("li");
			for (var i = 0; i < nodes.length; i++)
			{
				if (nodes[i].parentNode.id == "main-nav")
				{
					nodes[i].onmouseover = function () 
					{
						this.className += " hover";
					}
					nodes[i].onmouseout = function ()
					{
						this.className = this.className.replace(" hover", "");
					}
				}
			}
		}
	}
	
	
	//init left nav
	var ln = document.getElementById("leftnav");
	if (ln)
	{
		var lis = ln.getElementsByTagName("li");
		for (var i = 0; i < lis.length; i++)
		{
			if (lis[i].parentNode.id == "leftnav")
			{
				lis[i].onclick = function (event)
				{
					if (!event) event = window.event;
					var src = (event.target || event.srcElement);
					//if (this == src.parentNode)
					//{
//						this.className = (this.className == "active") ? "" : "active";
						this.className = "active";

						//event.cancelBubble = true;
					//	return false;
					//}
				}
			}
		}
	}
	
	var bs = document.getElementById("more-s");
	if (bs)
	{
		var lis = bs.getElementsByTagName("li");		
		for (var i = 0; i < lis.length; i++)
		{
			if (lis[i].parentNode.id == "more-s")
			{
				lis[i].onclick = function (event)
				{
					if (!event) event = window.event;
					var src = (event.target || event.srcElement);
					if (this == src.parentNode)					
					{
//						init_list();
						this.className = (this.className == "active") ? "" : "active";
						event.cancelBubble = true;
						return false;
					}
				}
			}
		}
	}

	//top global nav
	
	if (document.all && !window.opera)
	{
	var gnav = document.getElementById("mini-nav");
	if (gnav)
	{
		var nodes = gnav.getElementsByTagName("li");
		for (var i = 0; i < nodes.length; i++)
		{
			if (nodes[i].parentNode.id == "mini-nav")
			{
				nodes[i].onmouseover = function () 
				{
					this.className += " hover";
				}
				nodes[i].onmouseout = function ()
				{
					this.className = this.className.replace(" hover", "");
				}
			}
		}
	}
	}		

}

if (window.addEventListener)
	window.addEventListener("load", initPage, false);
if (window.attachEvent)
	window.attachEvent("onload", initPage);


function init_list()
{
	var bs = document.getElementById("menu");
	if (bs)
	{
		var lis = bs.getElementsByTagName("li");		
		for (var i = 0; i < lis.length; i++)
		{
			if (lis[i].parentNode.id == "menu")
			{
			 lis[i].className = "";
			}
		}
	}
}

function PopWindow(URL, target, popflag) {
	var param = target.split("x");
	if (popflag != 1)
	{
                  window.open(URL, "", 'width='+param[0]+',height='+ param[1]+',toolbar = 0, titlebar = 0');
	} else
	{
	  window.open(URL, "", 'width=' + param[0]+',height='+param[1]+',toolbar=1, titlebar=1, scrollbars=1, menubar=1,location=1, resizable=1');
	}
}

/*
function activateTab(tabGroup,index){ clearTimeout(activeTabTimers[tabGroup]); currentTabGroup = tabGroup; currentTabIndex = index; if(activeTabIndeces.length <= tabGroup){ activeTabIndeces[tabGroup] = 0; } var activeTabIndex = activeTabIndeces[tabGroup]; if(index != activeTabIndex) { activeTabTimers[tabGroup] = setTimeout("activateTabTimer()",250); } }

function mouseOutTab(tabGroup,index)
{ clearTimeout(activeTabTimers[tabGroup]); }

function activateTabTimer() { var activeTabIndex = activeTabIndeces[currentTabGroup]; if(currentTabIndex != activeTabIndex) { var h = 'tbh' + currentTabGroup + '_'; var c = 'tbc' + currentTabGroup + '_'; var activeTab = getObject(h + activeTabIndex); var activeTabPanel = getObject(c + activeTabIndex); var newTab = getObject(h + currentTabIndex); var newTabPanel = getObject(c + currentTabIndex); activeTab.className = 'tab'; activeTabPanel.className = 'tabPanel tabHiddenPanel'; newTab.className = 'tab tabActive'; newTabPanel.className = 'tabPanel tabActivePanel'; activeTabIndeces[currentTabGroup] = currentTabIndex; clearTimeout(impT); impT = setTimeout("swtI("+currentTabIndex+")", 1000); } } 
function swtI(n) { if(impT!=null && n>0 && tlids[n]!=false) { try{ dcsMultiTrack("DCS.dcsuri","/tabs/"+(n+1),"WT.ad","","WT.mc_id","","DCSext.wt_linkid",tlids[n],"WT.dl","5","WT.ti","Tab "+(n+1)); tlids[n]=false; impT=null; }catch(e){;} } }
*/
var activeindex = -1;
function showtab(i)
{
/*	if (activeindex != i)
	{
	 	activeindex = i;
	}
	setTimeout("activedtab("+i+")", 1000);
}

function activedtab(i)
{
*/	
    init_list();
//	alert("a");

	var nav = document.getElementById("menu");
	if (nav)
	{
		var nodes = nav.getElementsByTagName("li");
/*		for (var i = 0; i < nodes.length; i++)
		{			
			if (nodes[i].parentNode.id == "menu")
			{
//				alert(nodes[i].parentNode.id);
				nodes[i].onmouseover = function () 
				{
					nodes[i].className = "active";
					return false;
				}
			}
		}		
*/
//		alert(nodes[i].parentNode.id);
		nodes[i].className = "active";


	}
}

function PageQuery(q) {
	if(q.length > 1) this.q = q.substring(1, q.length);
	else this.q = null;
	this.keyValuePairs = new Array();
	if(q) {
		for(var i=0; i < this.q.split("&").length; i++) {
			this.keyValuePairs[i] = this.q.split("&")[i];
		}
	}

	this.getKeyValuePairs = function() { return this.keyValuePairs; }

	this.getValue = function(s) {
		for(var j=0; j < this.keyValuePairs.length; j++) {
			if(this.keyValuePairs[j].split("=")[0] == s)
				return this.keyValuePairs[j].split("=")[1];
			}
			return false;
			}
		this.getParameters = function() {
		var a = new Array(this.getLength());
		for(var j=0; j < this.keyValuePairs.length; j++) {
			a[j] = this.keyValuePairs[j].split("=")[0];
		}
		return a;
	}
	this.getLength = function() { return this.keyValuePairs.length; } 
}


function queryString(key){
	var page = new PageQuery(window.location.search); 
	return unescape(page.getValue(key)); 
}

function displayItem(key){
	if(queryString(key)=='false') 
	{
		return false;
	}else{
		var myhbxref = queryString(key);
		return myhbxref;
	}
}

function popUpNF(URL,w,h) {
	// pop up window with no features
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width='+w+',height='+h+',left = 250,top = 275');");
}

function topMove(url)
{
	if(window.opener == null || window.opener.document == null)
	{
		document.location.href= url;
		return true;
	}
	else
	{
		window.opener.location.href = url;
		window.opener.focus();
		window.opener = null;
		window.close();
		return false;
	}
}
