/*
Filnamn:				javascript.js
Författare och datum :  Novitell AB 
						Anders Jonasson 2007-09-14
Syfte:					Används för att skriva ut dropdownmenyn anropas via topmenu.tpl.			
Variabler:				Se nedan. 
*/

//DROPDOWN MENU
function show_dropdown(node){
	
	if(document.getElementById("idDropdownMenu_"+node)){
	
		//Visar dropdown-lager
		document.getElementById("idDropdownMenu_"+node).style.display = "block";
		
		//Hämtar absolut vänster-position för aktuellt lager
		xPos = document.getElementById('idTopMenu_'+node).offsetLeft;
		tempEl = document.getElementById('idTopMenu_'+node).offsetParent;
		while (tempEl != null) {
			xPos += tempEl.offsetLeft;
			tempEl = tempEl.offsetParent;
		}
		
		//Hämtar absolut topp-position för aktuellt lager
		yPos = document.getElementById('idTopMenu_'+node).offsetTop;
		tempEl = document.getElementById('idTopMenu_'+node).offsetParent;
		while (tempEl != null) {
			yPos += tempEl.offsetTop;
			tempEl = tempEl.offsetParent;
		}
		
		//Justerar dropdown-lagrets position (i förhållande till länken)
		yPos = yPos+20+"px";
		xPos = xPos+15+"px";
		
		//Bestämmer dropdown-lagrets position
		document.getElementById("idDropdownMenu_"+node).style.left = xPos;
		document.getElementById("idDropdownMenu_"+node).style.top = yPos;

	}
	
}
function hide_dropdown(node){
	
		if(document.getElementById("idDropdownMenu_"+node)){
			//Gömmer dropdown-lager
			document.getElementById("idDropdownMenu_"+node).style.display = "none";
		}
	
}


//kod för att ändra alpha -- HOVER EFFEKT PÅ LAGER
function hover(id){
	document.getElementById(id).style.opacity = 0.85;//FF
	document.getElementById(id).style.filter='alpha(opacity=85)';//IE
}

function hoverOut(id){
	document.getElementById(id).style.opacity = 1.0;//FF
	document.getElementById(id).style.filter='alpha(opacity=100)';//IE
}
