//IMM menu, Jan Larsen, January 2001
wwwroot="http://www2.imm.dtu.dk/"
space=wwwroot+"images/space.gif"
IE4=(document.all)
NS4=(document.layers)
NS6=(document.getElementById)
NS6spec=NS6&&(navigator.appName=="Netscape")
Mac=(navigator.appVersion.indexOf("Mac")!=-1)
m_ok=t_frys=false
t_luktimer=null
t_aaben=1
topZ=0
t_antal=12
t_contentW=638
t_offsetW=0

function nothing(){
return;
}


function contact(){
  if (!(window.contactname)|(window.contactname=="contact.htm")){
    return wwwroot+"contact.htm"
  }else{
    return window.contactname
  }
}
function authorn(){
  if (!(window.authorn)){
    return "Svend Hjort"
  }else{
    return window.author
  }
}
function authore(){
  if (!(window.authore)){
    return "svh@imm.dtu.dk"
  }else{
    return window.authoremail
  }
}
function t_startIt(){
	if(IE4&&!Mac){
		for(z=0;z<document.all.length;z++){
			oldEl=document.all(z)
			topZ=Math.max(oldEl.style.zIndex,topZ)
		}
		topZ++
	}
	t_redo()
}
function t_redo(){
	t_offsetW=t_offset()
	t_position()
}
function t_position(){
	if(NS4)
		for(i=1;i<=t_antal;i++)
			eval("document.m"+i).moveTo(m_xPos[i-1]+t_offsetW,m_yPos)
	else if(!NS6)
		for(i=1;i<=t_antal;i++){
			t_menu=eval("m"+i)
			t_menu.style.pixelLeft=m_xPos[i-1]+t_offsetW
			t_menu.style.pixelTop=m_yPos
			t_menu.style.zIndex=topZ
		}
}
function t_offset(){
	t_winW=NS4?window.innerWidth-20:IE4?document.body.offsetWidth-24:document.body.offsetWidth
	return(t_winW<t_contentW)?0:Math.floor(eval((t_winW-t_contentW)/2))
}
function t_popop(id){
	if(m_ok){
		clearTimeout(t_luktimer)
		for(i=1;i<=t_antal;i++)
			t_flickmenu(i,false)
		t_flickmenu(id,true)
		t_aaben=id
		t_frys=false
	}
}
function t_over(){clearTimeout(t_luktimer)}
function t_ud(){
	if(m_ok&&!t_frys)
		t_luktimer=setTimeout("t_luk("+t_aaben+")",200)
}
function t_luk(id){
	clearTimeout(t_luktimer)
	t_flickmenu(id,false)
}
function t_flickmenu(id,vis){
	if(NS4)
		eval("document.m"+id).visibility=(vis)?"show":"hide"
	else if(NS6){
		m = document.getElementById("m"+id)
		m.style.left=m_xPos[id-1]+t_offsetW
		m.style.top=m_yPos
		m.onmouseover=t_over
		m.onmouseout=t_ud
		m.style.visibility=(vis)?"visible":"hidden"
	}
	else{
		eval("m"+id).style.visibility=(vis)?"visible":"hidden"
		eval("m"+id).style.zIndex=10000
	}
}

window.onload=t_startIt
window.onresize=t_redo
