
function menuToggle() {

	var node = this.nextSibling;
						
	while (1) {
		if (node != null) {
			if (node.tagName == "UL") {
				//alert (node.className);
				node.className = (node.className == "submenublock") ? "submenublockopen" : "submenublock";
				
				//node.style.display = (node.style.display == "none") ? "block" : "none";
				this.style.backgroundImage = (node.className == "submenublock") ?
					"url(/_structure/images/system/closedmenu.gif)" : "url(/_structure/images/system/openmenu.gif)";
				//alert (node.id);
				var nodeId = node.id.substring(node.id.indexOf("_") + 1);
				//alert (nodeId);
				setCookie ("mnuSubSectLst_" + nodeId, (node.className == "submenublock") ? "closed" : "open", true);
				return false;
			}
			node = node.nextSibling;
		} else {
			return false;
		}
	}
	
	return false;	
}

function initMenus() {
	if (!document.getElementsByTagName) return;
	var aMenus = document.getElementsByTagName("li");
	for (var i = 0; i < aMenus.length; i++) {
		var mclass = aMenus[i].className;
		if (mclass.indexOf("submenu") > -1) {
			var submenu = aMenus[i].childNodes;
			for (var j = 0; j < submenu.length; j++) {
				var sclass = submenu[j].className;
				if (submenu[j].tagName == "A") {
					submenu[j].onclick = menuToggle;
				}
				
				if (submenu[j].tagName == "UL") {
					var nodeId = submenu[j].id.substring(submenu[j].id.indexOf("_") + 1);
					//alert (nodeId);
					if (sclass.indexOf("open") > -1) document.getElementById("mnuSubSectTtl_" + nodeId).style.backgroundImage = "url(/_structure/images/system/openmenu.gif)";
					//alert (sclass);
				}
				
				//alert ("sclass=" + sclass + ", node=" + aMenus[i].id + ", subnode=" + submenu[j].id);
				//if (submenu[j].tagName == "UL")
				//	submenu[j].style.display = (mclass.indexOf("open") > -1) ? "block" : "none";
			}
		}
	}
}

function setCookie(name, value, bolSession) {
//alert (name + ", " + value);
	var expdate = new Date();
	expdate.setTime(expdate.getTime() +  (24 * 60 * 60 * 1000 * 365)); 
	
	var strCookie = name + "=" + value + "; "
	if (bolSession == false)
		strCookie += "expires=" + expdate.toGMTString();
	document.cookie = strCookie;
}

function getCookie(name) {
	var strCookies = String(document.cookie);	
	var intCookieStart = strCookies.indexOf(name);
	if(intCookieStart != -1) {
		intCookieStart = intCookieStart + name.length + 1;
		var intCookieEnd = strCookies.indexOf(";", intCookieStart);
		if(intCookieEnd = -1) intCookieEnd = strCookies.length
			return strCookies.substring(intCookieStart, intCookieEnd);
	} else {
		return false;
	}
}

function printarticle(lngId)
{
	strWin = window.open ("/printarticle.php?id=" + lngId , "_blank", "toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,width=800,height=500");
}

sfHover = function() {
	var navEl = document.getElementById("nav");
	if (navEl != null)
	{
		var sfEls = navEl.getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


function SwitchImg(imgName, over)
{
	fld = document.getElementById (imgName + "img");
	eval ("fld.src = img" + imgName + (over ? "over" : "off") +".src;");
	//fld.src = "/_structure/images/system/" + imgName + (over ? "over" : "off") + ".jpg";
}


function FindHeight(obj)
{
    return (obj.offsetHeight);
}



function FindWidth(obj)
{
    return (obj.offsetWidth);
}
