if (typeof addLoadEvent == "undefined") {
	function addLoadEvent(func) {
		var oldOnLoad = window.onload
		if (typeof window.onload != 'function') {
			window.onload = func
		} else {
			window.onload = function() {
				oldOnLoad()
				func()
			}
		}
	}
}

function whenLoaded () {
	function getElementsByClass (searchClass, domNode, tagName) {
		if (domNode == null) domNode = document
		if (tagName == null) tagName = '*'
		var el = new Array()
		var tags = domNode.getElementsByTagName(tagName)
		var tcl = " "+searchClass+" "
		for(i=0,j=0; i<tags.length; i++) {
			var test = " " + tags[i].className + " "
			if (test.indexOf(tcl) != -1)
				el[j++] = tags[i]
		}
		return el
	}
	function setBgColor (el,color,bgcolor) {
			if (bgcolor) {
				el.firstChild.style.backgroundColor = bgcolor;
				var nod = el.parentNode.parentNode;
				if (nod.nodeName == 'LI') nod.firstChild.style.backgroundColor = bgcolor
			}
			if (color) el.firstChild.style.color = color;
//			appendCons(nod.nodeName)
	}
	
	var el;
	var els = document.getElementById('menu').getElementsByTagName('li');
	for (i=0; i<els.length; i++) if (els[i].firstChild && els[i].firstChild.href == window.location.href) var el = els[i];
	if (el) {
		setBgColor (el,'white','#CD2626');
		document.getElementById("pageName").innerHTML = el.firstChild.innerHTML
	}
	
	var el;
	var lMenu = document.getElementById('localmenu');
	if (lMenu) {
		var els = lMenu.getElementsByTagName('li');
		for (i=0; i<els.length; i++) if (els[i].firstChild && els[i].firstChild.href == window.location.href) var el = els[i];
		if (el) setBgColor (el,'white','#CD2626')
	}

}
addLoadEvent(whenLoaded)

