/*

	JavaScript/dHTML by Johnny Mellgren
	
	Questions/suggestions/bug report please contact:
		
		Johnny Mellgren
		e-mail: johnny@mellgren.com
		mobile: +46(0)709575888
		
*/

var gecko = (navigator.userAgent.indexOf("Gecko") != -1);

function init(){
	if (document.getElementById){
		theTBody = document.getElementById("leftMenu");
		for (var i = 0; i < theTBody.childNodes.length; i++){
			if (theTBody.childNodes[i].nodeType != 3){
				x = (gecko) ? 1 : 0;
				if (theTBody.childNodes[i].childNodes[x].bgColor != "#999999"){
					theTBody.childNodes[i].childNodes[x].onmouseover = tglMenuItem;
					theTBody.childNodes[i].childNodes[x].onmouseout = tglMenuItem;
					theTBody.childNodes[i].childNodes[x].onclick = simulateLinkClick;
				}
			}
		}
	}
	if ((document.getElementById || document.all) && document.forms.length > 0){
		for (var i = 0; i < document.forms.length; i++){
			for (var x = 0; x < document.forms[i].length; x++){
				if (document.forms[i][x].className == "input" && (document.forms[i][x].type == "text" || document.forms[i][x].type == "textarea" || document.forms[i][x].type == "password")){
					document.forms[i][x].onfocus = tglFormElement;
					document.forms[i][x].onblur = tglFormElement;
				}
			}
		}
	}
}

function tglFormElement(e){
	if (gecko) event = e;
	if (event.type == "focus"){
		this.style.backgroundColor = "#ffffff";
	} else {
		this.style.backgroundColor = "#eeeeee";
	}
}

function simulateLinkClick(e){
	if (gecko) event = e;
	self.location = this.childNodes[0].childNodes[0].href;
}

function tglMenuItem(e){
	if (gecko) 
	{event = e;
		if (event.type == "mouseover"){
			this.style.backgroundColor = "#cccccc";
			if (gecko){
				this.style.cursor = "pointer";
			} else {
				this.style.cursor = "hand";
			}
		} else {
			this.style.backgroundColor = "";
			this.style.cursor = "normal";
		}
	}
}

	function popupInformation()
	{
		popup("popup/popup.asp", 554, 301, false, "information");
	}
	
	function popup(toUrl, w, h, scroll, name) {
		oScroll = (scroll) ? 1 : 0;
		params = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars='+oScroll+',resizable=1,width='+w+',height='+h;
		if(toUrl.indexOf('?') == -1)
			toUrl += "?callingURL=" + window.location.href;
		else
			toUrl += "&callingURL=" + window.location.href;
		window.open(toUrl, name, params);
	}


self.onload = init;
