/////////////////////////////// // Kontroller Browser Type // /////////////////////////////// IE4 = !!document.all; W3C = !!document.getElementById; /////////////////////////////// // Cookie Control // /////////////////////////////// doccookies = document.cookie; function getCookie(name) { var index = doccookies.indexOf(name + "="); if (index == -1) return null; index = doccookies.indexOf("=", index) + 1; var endstr = doccookies.indexOf(";", index); if (endstr == -1) endstr = doccookies.length; return unescape(doccookies.substring(index, endstr)); } function setCookie(name, value) { if (value != null && value != "") { expiretime = new Date; expiretime.setYear(expiretime.getYear()+1); document.cookie = ( name+"="+escape(value)+";expires="+expiretime.toGMTString() ); } doccookies = document.cookie; } /////////////////////////////// // Variable // /////////////////////////////// rollOffMenuDelayTimer = null; rollOffSubMenuDelayTimer = null; columnWidth = 140; contentwidth = 960; contentheight = 640; timeoutdelay = 500; subMenuParentX = new Array( 0, 2, 2 ); subMenuParentY = new Array( 0, 1, 2 ); /////////////////////////////// // Funktioner // /////////////////////////////// function getElement( ID ) { return W3C ? document.getElementById( ID ) : IE4 ? document.all[ID] : false; } /////////////////////////////// // Togglefunktioner // /////////////////////////////// function rollOnMenu( menuID ) { clearTimeout( rollOffMenuDelayTimer ); for( i = 1; i <= menuColumnCount; i++ ) toggleMenu( i, i == menuID, false ); //luk submenu closeSubMenu( openSubMenu ); openMenu = menuID; } function rollOnSubMenu( subMenuID ) { clearTimeout( rollOffSubMenuDelayTimer ); for( i = 1; i <= subMenuColumnCount; i++ ) toggleMenu( i, i == subMenuID, true ); openSubMenu = subMenuID; } function hoverOnMenu() { clearTimeout( rollOffMenuDelayTimer ); } function hoverOnSubMenu() { clearTimeout( rollOffMenuDelayTimer ); clearTimeout( rollOffSubMenuDelayTimer ); } function rollOffMenu() { rollOffMenuDelayTimer = setTimeout( "closeMenu(" + openMenu + ")", timeoutdelay ); } function rollOffSubMenu() { rollOffMenuDelayTimer = setTimeout( "closeMenu(" + openMenu + ")", timeoutdelay ); rollOffSubMenuDelayTimer = setTimeout( "closeSubMenu(" + openSubMenu + ");", timeoutdelay ); } function rollOffSubMenuHead() { rollOffSubMenuDelayTimer = setTimeout( "closeSubMenu(" + openSubMenu + ");", timeoutdelay ); } function closeMenu( menuID ) { clearTimeout( rollOffMenuDelayTimer ); toggleMenu( menuID, false ); } function closeSubMenu( menuID ) { clearTimeout( rollOffSubMenuDelayTimer ); toggleMenu( menuID, false, true ); } ////////////////////////////////////////////////// function toggleMenu( menuID, status, submenu ) { var menu = getElement( (submenu?"submenu":"menu") + menuID ); var menufrm = getElement( (submenu?"submenu":"menu") + menuID + "frm" ); if ( menu != null && menufrm != null ) { menufrm.style.width = menu.offsetWidth; menufrm.style.height = menu.offsetHeight; if ( submenu ) { menu.style.left = calcXCoordinate(subMenuParentX[menuID]-1)+672; menu.style.top = calcYCoordinate(subMenuParentX[menuID]-1)+((subMenuParentY[menuID]-1)*20)+5; } else { menu.style.left = calcXCoordinate(menuID-1); menu.style.top = calcYCoordinate(menuID-1); } menufrm.style.left = menu.offsetLeft; menufrm.style.top = menu.offsetTop; menufrm.style.visibility = ( status ? "visible" : "hidden" ); menu.style.visibility = ( status ? "visible" : "hidden" ); } } /////////////////////////////// // Placeringsfunktioner // /////////////////////////////// function getXExcessSpace() { windowXsize = 960; if ( window.innerWidth ) windowXsize = window.innerWidth; else if( document.body && document.body.clientWidth ) windowXsize = document.body.clientWidth; return (windowXsize-contentwidth<40)?40:(windowXsize-contentwidth); } function getYExcessSpace() { windowYsize = 550; if ( window.innerHeight ) windowYsize = window.innerHeight; else if( document.body && document.body.clientHeight ) windowYsize = document.body.clientHeight; return (windowYsize-contentheight<40)?40:(windowYsize-contentheight); } function calcXCoordinate( menuID ) { menuindent = 0 for(s=1;s<=menuID;s++) { menuindent += tdwidth[s]; } alignsub = (columnWidth - tdwidth[s])/2 return Math.floor(getXExcessSpace()/2)+(960-tdtotalwidth)/2+menuindent+5//-alignsub } function calcYCoordinate( menuID ) { return Math.floor((getYExcessSpace())/2)+125/*+(hasVerticalScrollbar()?16/2:0)*/; } function hoverOnItem( item, hovering, statustext ) { item.className = ( hovering ? innermenulinkhover : innermenulink ); if ( statustext != null ) window.status = statustext else window.status = "Vagn Henriksen A/S | Trygt kvalitetsbyggeri - til tiden"; return true; } function noop() { //javascript nothing routine der eksekveres når man trykker på et link i NS4 der ikke //skal gøre andet end at holde onmouseover eller onmouseout events, da den ikke kan //fatte mouseevents på