if (!document.loadHandlers) { document.loadHandlers=new Array(); document.loadHandlers[0]='initializeMenu'; document.lastLoadHandler=0; } else { document.lastLoadHandler++; document.loadHandlers[document.lastLoadHandler]='initializeMenu'; } window.onload=initializeAll; var activePopup=null; var activePopupTimeout; var maxZ=1000; var popupFrame; var targetFrame; var docLoaded=false; var bIncBorder=false; var scrollTimeout=null; var scrollTimeoutStr; var scrollDelay=50; var scrollStep=10; var curPopupWidth=popupWidth; var showDelayedTimeout=null; var fadingSteps=8; var menuCounter = false; if(bBitmapPopups) bord=0; function makeTransparent(op,opObj,vis,ns,ie,frc) { if(op||frc) { if(ns)opObj.style.MozOpacity = vis?op+'%':''; if(ie)opObj.style.filter=vis?"alpha(opacity="+op+")":""; } } function showDelayed(objId,step) { var obj=popupFrame.document.getElementById(objId); var objBg=popupFrame.document.getElementById(objId+'bgWnd'); if(showDelayedTimeout){showDelayedTimeout=null;clearTimeout(showDelayedTimeout);} var max=popupOpacity?popupOpacity:100; if(obj)makeTransparent((fadingSteps-step)*max/fadingSteps,obj,1,1,1,1); if(objBg)makeTransparent(100,objBg,0,0,bBitmapPopups,1); if(step<=0)return; setTimeout("showDelayed('"+objId+"',"+(step-1)+")", bShowDel/fadingSteps); } function createMenuItem(popup,id,itemLink,itemText,popupArray,bLast,popupHeight,parent,sImage,sMoImage,bgColor) { var itemType=0; if(itemText&&itemText.indexOf("(^1)")!=-1)itemType=1; if(itemText&&itemText.indexOf("(^2)")!=-1)itemType=2; var itemWnd=popupFrame.document.createElement("DIV"); popup.appendChild(itemWnd); if(mac) { var brWnd=popupFrame.document.createElement("BR"); popup.appendChild(brWnd) } addEvent(itemWnd,"mouseover",onItemOver,false); addEvent(itemWnd,"mouseout",onItemOut,false); addEvent(itemWnd,"mousedown",onItemClick,false); addEvent(itemWnd,"dblclick",onItemClick,false); itemWnd.owner=popup; itemWnd.id=id; with (itemWnd.style) { position="absolute"; if(itemType==2)top=popupHeight-scrollHeight; else top=popupHeight; if(itemLink){cursor=(!IE4||version>=6)?"pointer":"hand";} else{cursor="default";} if (!bBitmapPopups) { if (!bLast) { borderBottomColor=borderCol; borderBottomWidth=sep; borderBottomStyle="solid"; } } else left=popupLeftPad+vertSpace; if (!itemType)padding=vertSpace; backgroundColor=(bgColor)?bgColor:''; paddingLeft=popupLeftPad+vertSpace; paddingRight=(popupRightPad < iconSize?iconSize:popupRightPad)+vertSpace; textAlign='left'; setRealWidth(itemWnd,bBitmapPopups?curPopupWidth-popupLeftPad-popupRightPad-2*vertSpace:curPopupWidth,2*bord); //setStyle(itemWnd,submnuStlId) itemWnd.className = 'Meny' } if (popupArray)itemWnd.popupArray=popupArray; if(itemType>0) { var arrow=popupFrame.document.createElement("IMG"); itemWnd.appendChild(arrow); if (imgFolder&&imgFolder.indexOf('/')!=0)arrow.src=unescape(absPath)+imgFolder; else arrow.src=imgFolder; arrow.src+="/scroll"+((itemType==1)?"up":"down")+".gif"; itemWnd.style.textAlign="center"; itemWnd.style.display="none"; } else if(sImage) { //var oImg=popupFrame.document.createElement("IMG"); //var oImg=itemWnd.document.createElement("IMG"); //var oImg=document.createElement("IMG"); var oImg=(popupFrame.document.createElement)?popupFrame.document.createElement("IMG"):itemWnd.document.createElement("IMG"); oImg.src=imgFolder+'/images/user/'+sImage; if (sMoImage) { oImg.oSrc=oImg.src; oImg.moSrc=imgFolder+'/images/user/'+sMoImage; } oImg.title=itemText.substring(0,itemText.indexOf("',startPos); var trgFrame = item.dispText.substring (startPos+4,endPos); if (trgFrame=="_blank") window.open (item.url); else eval("parent.frames."+trgFrame).location.href=item.url; } else { var find=item.url.indexOf("javascript:"); if (find!=-1) { eval(item.url.substring(find)); if(item.url.indexOf("scroll")!=-1) close=false; } else { var mt=item.url.indexOf("mailto:"); if(mt!=-1)window.top.location=item.url.substring(mt); else targetFrame.location=item.url; } } if(activePopup&&close)closePopup(activePopup.id); } } function onNextScroll() { if(scrollTimeoutStr) { eval(scrollTimeoutStr); if(scrollTimeout)clearTimeout(scrollTimeout); scrollTimeout=setTimeout("onNextScroll()",scrollDelay); } } function onItemOver() { var item=this; var bOp=0; if (item.id&&item.id.indexOf("scroll")!=-1) { scrollTimeoutStr=item.url; onNextScroll(); return; } if (item.owner.expandedWnd) { if(item.popupArray&&item.popupArray+'popup'==item.owner.expandedWnd.id)bOp=1; if(!bOp)closePopup(item.owner.expandedWnd.id); } if (item.url&&item.url.indexOf("javascript:")==-1) window.status=item.url; else window.status=""; makeTransparent(popupOpacity,item,1,0,bBitmapPopups,0); //setStyle(item,submnuMoStlId) if (item.daImage){ if(item.daImage.moSrc) item.daImage.src=item.daImage.moSrc; } if (item.style.backgroundColor=='')item.className = 'BASEPROSUBMENUHOVER' if (item.popupArray&&!bOp) { var rect=getClientRect(item); var x=rect.right-levelOffset; var y=rect.top; var popup=createPopupFromCode(item.popupArray,item.owner.level+1,item.owner); item.owner.expandedWnd=popup; openPopup(popup,x,y+2,false,item.owner); } } function onItemOut() { var item=this; //setStyle(item,submnuStlId) if (item.daImage) if(item.daImage.moSrc)item.daImage.src=item.daImage.oSrc; if (item.style.backgroundColor=='')item.className = 'Meny' if(scrollTimeout){scrollTimeoutStr=null;clearTimeout(scrollTimeout);} makeTransparent(popupOpacity,item,0,0,bBitmapPopups,0); if (item.id&&item.id.indexOf("scroll")!=-1) return; } function expandMenu(popupId,refWnd,dum) { if(!docLoaded)return; if(activePopupTimeout)clearTimeout(activePopupTimeout); if (activePopup&&activePopup.id!=popupId+"popup") closePopup(activePopup.id); if(popupId=='none')return; var posRef=document.getElementById(refWnd); var rect=calcClientRect(posRef); if(bVarWidth&&!bBitmapPopups)curPopupWidth=rect.right-rect.left+(IE4?bord*2:0); var x; var y; if(menuHorizontal) { x=rect.left-bord+popupOffset; y=rect.bottom+popupOffsetY; } else { //x=rect.right+popupOffset; x=rect.right+popupOffset; y=rect.top-bord+popupOffsetY; } //alert(x + ',' + y) if(sepFrame&&!openSameFrame) { var brRect=getBrowserRect(popupFrame); var wRect=getBrowserRect(window); switch (menuPos) { case 0: x=brRect.left; y+=brRect.top-wRect.top; break; case 1: x=brRect.right; y+=brRect.top-wRect.top; break; case 2: x+=brRect.left-wRect.left; y=brRect.top; break; case 3: x+=brRect.left-wRect.left; y=brRect.bottom; break; } } //alert(x & ' ' & y) var popup=createPopupFromCode(popupId,0,null); openPopup(popup,x,y,true,posRef); activePopup=popup; } function collapseMenu(popupId) { if(!docLoaded)return; var popup=popupFrame.document.getElementById(popupId+"popup"); if(popup)onPopupOutImpl(popup); } function expandMenuNS(popupId,e,dItem) { } function collapseMenuNS(popupId) { } function onDocClick() { if(activePopup)closePopup(activePopup.id); } function findFrame(name) { if(parent.frames[name])return parent.frames[name]; var i; for(i=0;i < parent.frames.length;i++){if(parent.frames[i].frames[name])return parent.frames[i].frames[name];} } function initializeMenu() { popupFrame=(sepFrame&&!openSameFrame)?findFrame(contentFrame):window; targetFrame=(sepFrame)?findFrame(cntFrame):window; if(!mout)addEvent(popupFrame.document,"mousedown",onDocClick,false); docLoaded=true; } function addEvent(obj,event,fun,bubble) { if (obj.addEventListener) obj.addEventListener(event,fun,bubble); else eval("obj.on"+event+"="+fun); } function chgBg(item,color,imageIndex, sImage) { if ((!IE4&&!DOM)||bBitmapScheme)return; // var itm=document.getElementById('tlm'+item); var itm=document.getElementById(item); var onOff = (color!=0)?true:false; if(sImage || !onOff){ var oImg = document.getElementById('mimg' + imageIndex); if(oImg){ if(onOff){ oImg.oSrc=oImg.src; //oImg.src=imgFolder+'/images/user/'+sImage; oImg.src=imgFolder+'/./images/user/risbergsbyggvaror/'+sImage; }else if (oImg.oSrc){ oImg.src=oImg.oSrc; } } } itm.className = (onOff)?'BASEPROMENUHOVER':''; } function initializeAll() { var i; for(i=0;i<=document.lastLoadHandler;i++) { eval(document.loadHandlers[i]+'();'); } }