/********************************************************************** * iNavigate.js iNavigate 4.0 Dec 01 2002 * * Dynamic Tree Menu for MS IE 4.0+ Netscape 6.0+ and Opera 7.0+. * * FREE EDITION * You may use this code on public or private web sites only if this * copyright statement appears intact and you publicly display a link * to http://www.cirkadia.com. * * This code is provided "as is" without warranty of any kind. * Cirkadia further disclaims all implied warranties including fitness * for any particular purpose. The entire risk arising out of the use * or performace of this code remains with you. * * Contact productinfo@cirkadia.com for any other usage. * * SERVER, ENTERPRISE & PRODUCT EDITION * Your rights to use and deploy iNavigate are in accordance with the type * of license that you purchased and are subject to the complete license statement * which may be found in the accompanying license.txt file, please read this carefully. * * Copyright © 1998-2002 Cirkadia Ltd. All rights reserved. * * http://www.cirkadia.com * **********************************************************************/ function Browser(){ this.IE4plus=false; this.IE51beta=false; this.Gecko=false; this.Gecko09plus=false; this.Gecko09minus=false; this.Opera=false; this.Mac=false; this.Version=0; var sVersion=''; nStart=navigator.userAgent.indexOf('Opera') if(nStart!=-1){ this.Opera=true; sVersion=navigator.userAgent.substring(nStart+6); if(parseInt(sVersion)>=7){ this.Opera=false; this.Gecko=true; this.Gecko09plus=false; this.Gecko09minus=false;}}else{ nStart=navigator.userAgent.indexOf('Gecko'); if(nStart!=-1){ this.Gecko=true; var nGeckoDate=parseInt(navigator.userAgent.substring(nStart+6,nStart+14)); this.Gecko09plus=(nGeckoDate>=20010505); this.Gecko09minus=!this.Gecko09plus; sVersion=navigator.appVersion;} else if(document.all){ this.IE4plus=true; sVersion=navigator.userAgent.substring(navigator.userAgent.indexOf('MSIE ')+5); sVersion=sVersion.substring(0,4); if(sVersion=='5.1b') this.IE51beta=true; sVersion=sVersion.substring(0,3);}} this.Version=Math.floor(parseFloat(sVersion) * 10) / 10; this.Mac=navigator.appVersion.indexOf('Macintosh')!=-1 ? true : false; if(this.IE4plus){ this.DisplayShow=''; this.DisplayHide='none';}else{ this.DisplayShow='block'; this.DisplayHide='none';}} var oBrowser=new Browser(); function iNavigate(){ this.Frames=false; this.GroupName=''; this.GroupTitle=''; this.HomePage='index.htm'; this.InitiallyOpen=false; this.PreserveState=true; this.RightToLeft=false; this.ConvertLink=true; this.AutoClose=false; this.AutoCloseCurrent=false; this.ConvertParent=false; this.MatchQueryString=false; this.PageSearch=new PageSearch(); this.GeckoPassive=false; this.NodeBlankName=/Blank/i; this.NodeMinusName='Minus'; this.NodePlusName='Plus'; this.NodePlusTitle='Open Menu'; this.NodeMinusTitle='Close Menu'; this.OpenOnClick=false; this.PointerName='pointer'; this.PointerBlankName='blank'; this.PathAsText=false; this.PathSeparator=''; this.Path=''; this._oCurrentMenuItem; this._nCurrentMenuNo; this._FrameWindow;} iNavigate.prototype.BeforeLoad=iNavigate_BeforeLoad; iNavigate.prototype.AfterLoad=iNavigate_AfterLoad; iNavigate.prototype.CloseAll=iNavigate_CloseAll; iNavigate.prototype.OpenAll=iNavigate_OpenAll; iNavigate.prototype.Locate=iNavigate_Locate; iNavigate.prototype.LocateFrame=iNavigate_LocateFrame; iNavigate.prototype.MoveNext=iNavigate_MoveNext; iNavigate.prototype.MovePrevious=iNavigate_MovePrevious; iNavigate.prototype.PrepareFrame=iNavigate_PrepareFrame; iNavigate.prototype.menuAll='iNavigateAll'; iNavigate.prototype.menuId='iNavigateMenu'; iNavigate.prototype.menuBodyId='iNavigateMenuBody'; iNavigate.prototype.menuItemId='iNavigateItem'; iNavigate.prototype.menuBoxId='iNavigateMenuBox'; iNavigate.prototype.menuNodeId='iNavigateMenuNode'; iNavigate.prototype.pointerId='iNavigatePointer'; iNavigate.prototype.pathId='iNavigatePath'; iNavigate.prototype.cookiePrefix='iNavigate_'; iNavigate.prototype.menuNoAttr='menuNo'; iNavigate.prototype.menuNodePathAttr='nodePath'; iNavigate.prototype.menuNodeQueryAttr='nodeQuery'; iNavigate.prototype.currentMenuAttr='menuCurrent'; iNavigate.prototype.openMenuAttr='menuOpen'; var iNavigate=new iNavigate(); var xMenu; var xMenuBody; var xMenuBox; var xMenuBoxPlusImage; var xMenuBoxMinusImage; var xHref; var bReady=false; function iNavigate_BeforeLoad(){ if(oBrowser.Gecko&&iNavigate.GeckoPassive==true) oBrowser.Gecko=false; if(!oBrowser.IE4plus&&!oBrowser.Gecko&&!oBrowser.Opera) return; var i; if(iNavigate.AutoClose==true) iNavigate.PreserveState=false; if(iNavigate.GroupTitle.length==0) iNavigate.GroupTitle=iNavigate.GroupName; var oAll=GetFirstElement(document,iNavigate.menuAll,'span'); if(!oBrowser.Gecko09minus) oAll.style.display=oBrowser.DisplayHide; var bFirstTime=GetGroupLoaded(); var bLoadOpen=bFirstTime ? iNavigate.InitiallyOpen : false; if(bFirstTime) SetGroupLoaded(); if(!iNavigate.Frames) iNavigate.PageSearch.Initialize(window); xMenu=GetElements(document,iNavigate.menuId,'span'); xMenuBody=new Array(xMenu.length); for(i=0;i';} else if(oBrowser.Gecko||oBrowser.Opera){ oElement=document.createElement('EM'); oElement.setAttribute('class','iNavigateCurrentPage'); var oNode=iNavigate._oCurrentMenuItem.firstChild; while (oNode){ oElement.appendChild(oNode.cloneNode(true)); oNode=oNode.nextSibling;} iNavigate._oCurrentMenuItem.parentNode.replaceChild(oElement,iNavigate._oCurrentMenuItem);}}} _ShowNavigationAid(window,'iNavigateOpenAll'); _ShowNavigationAid(window,'iNavigateCloseAll'); _ShowNavigationAid(window,'iNavigateLocate'); _ShowNavigationAid(window,'iNavigateMoveNext'); _ShowNavigationAid(window,'iNavigateMovePrevious');} function _ShowNavigationAid(oWindow,id){ var o=GetFirstElement(oWindow.document,id,'span'); if(o){ var s=UnComment(o.innerHTML) if(s.length>0){ o.innerHTML=s;}}} function UnComment(string){ var s=string; var lStart=s.indexOf(''); if(lStart>-1&&lEnd>-1){ s=s.substring(lStart+4,lEnd); return s;}else{ return '';}} function _SetPath(oWindow,bConvert){ if(oBrowser.Opera) return; var oItem=iNavigate._oCurrentMenuItem; var oNode; var sPath; var bSkip=false; if(iNavigate.PathSeparator.length==0){ iNavigate.PathSeparator=(iNavigate.RightToLeft) ? ' < ' : ' > ';} if(oItem){ if(oItem.id==iNavigate.menuItemId){ if(bConvert||iNavigate.PathAsText==true){ if(oBrowser.IE4plus) sPath=oItem.innerText; if(oBrowser.Gecko) sPath=oItem.innerHTML;}else{ if(oBrowser.IE4plus) sPath=oItem.outerHTML; if(oBrowser.Gecko) sPath=oItem.parentNode.innerHTML;}}} if(oItem){ if(oBrowser.Gecko) oItem=oItem.parentNode; if(oBrowser.IE4plus) oItem=oItem.parentElement;} while (oItem){ if(oItem.tagName=='SPAN'&&oItem.id=='iNavigateMenuNode') bSkip=true; if(oItem.id==iNavigate.menuId){ oNode=GetFirstElement(oItem,iNavigate.menuNodeId); if(oNode){ if(bSkip){ bSkip=false;}else{ sPath=_AddPathElement(sPath,_GetPathElement(oNode))}}} if(oBrowser.Gecko) oItem=oItem.parentNode; if(oBrowser.IE4plus) oItem=oItem.parentElement;} if(iNavigate.GroupName.length>0){ sPath=_AddPathElement(sPath,iNavigate.GroupTitle);} iNavigate.Path=sPath; var oPath=GetFirstElement(oWindow.document,iNavigate.pathId,'span'); if(oPath){ oPath.innerHTML=sPath;}} function _GetPathElement(oNode){ var sElement; if(iNavigate.PathAsText==true){ if(oBrowser.IE4plus){ sElement=oNode.innerText;} else if(oBrowser.Gecko){ if(oNode.firstChild.tagName=='A'){ sElement=oNode.firstChild.innerHTML;}else{ sElement=oNode.innerHTML;}}}else{ sElement=oNode.innerHTML;} return sElement;} function _AddPathElement(sPath,sElement){ if(iNavigate.RightToLeft){ return sPath+iNavigate.PathSeparator+sElement;}else{ return sElement+iNavigate.PathSeparator+sPath;}} function iNavigate_OpenAll(){ if(oBrowser.Opera) return; if(oBrowser.Gecko09plus){ var oAll=GetFirstElement(document,iNavigate.menuAll,'span'); oAll.style.display=oBrowser.DisplayHide;} for(i=0;i=xHref.length) nItem=0; if(iNavigate.Frames){ iNavigate._FrameWindow.document.location=xHref[nItem];}else{ document.location=xHref[nItem];}} function iNavigate_MovePrevious(){ var nItem=iNavigate._nCurrentMenuNo; nItem--; if(nItem<0) nItem=xHref.length - 1; if(iNavigate.Frames){ iNavigate._FrameWindow.document.location=xHref[nItem];}else{ document.location=xHref[nItem];}} function PageSearch(){ this._bMatchLocation=false; this.page=arguments[0]; this.querystring=arguments[1];} PageSearch.prototype.MatchesLink=PageSearch_MatchesLink; PageSearch.prototype.MatchesURL=PageSearch_MatchesURL; PageSearch.prototype.Initialize=PageSearch_Initialize; function PageSearch_Initialize(oWindow){ if(!this.page){ this._bMatchLocation=true; this.page=NormalizePathName(oWindow.location.pathname,iNavigate.HomePage); if(iNavigate.MatchQueryString==true){ this.querystring=NormalizeQueryString(oWindow.location.search);}}} function PageSearch_MatchesLink(oLink){ if(IsJavaScriptURL(oLink.href)){ var sPathName=oLink.href.toLowerCase();}else{ if(!oLink.pathname) return false; var sPathName=NormalizePathName(oLink.pathname);} if(this._bMatchLocation){ if(this.page!=sPathName) return false; if(this.querystring){ if(oBrowser.Opera){ if(this.querystring!=NormalizeQueryString(oLink.pathname)) return false;}else{ if(this.querystring!=NormalizeQueryString(oLink.search)) return false;}}}else{ if(typeof this.page=='string'){ if(StringEnds(sPathName,this.page.toLowerCase())==false) return false;}else{ if(!this.page.test(sPathName)) return false;} if(this.querystring){ if(oBrowser.Opera){ var sQueryString=NormalizeQueryString(oLink.pathname);}else{ var sQueryString=NormalizeQueryString(oLink.search);} if(typeof this.querystring=='string'){ if(this.querystring.toLowerCase()!=sQueryString) return false;}else{ if(!this.querystring.test(sQueryString)) return false;}}} return true;} function PageSearch_MatchesURL(sPathName,sQueryString){ if(!this.page) return false; if(typeof this.page=='string'){ if(this.page.toLowerCase()!=sPathName) return false;}else{ if(!this.page.test(sPathName)) return false;} if(this.querystring){ if(typeof this.querystring=='string'){ if(this.querystring.toLowerCase()!=sQueryString) return false;}else{ if(!this.querystring.test(sQueryString)) return false;}} return true;} function iNavigate_MenuBoxClick(evt){ var oSource; if(oBrowser.IE4plus) oSource=window.event.srcElement; if(oBrowser.Gecko) oSource=evt.currentTarget; nMenu=oSource.getAttribute(iNavigate.menuNoAttr); _MenuToggle(nMenu,false,false);} function iNavigate_MenuNodeClick(evt){ var oSource; var sNodePath; var sNodeQuery; var bOpenOnClick; var bThisPage; if(oBrowser.IE4plus) oSource=window.event.srcElement; if(oBrowser.Gecko) oSource=evt.currentTarget; while (oSource.id!=iNavigate.menuId){ if(oBrowser.Gecko) oSource=oSource.parentNode; if(oBrowser.IE4plus) oSource=oSource.parentElement;} if(oSource){ sNodePath=oSource.getAttribute(iNavigate.menuNodePathAttr); sNodeQuery=oSource.getAttribute(iNavigate.menuNodeQueryAttr); nMenu=oSource.getAttribute(iNavigate.menuNoAttr); var bOpenOnClick=(iNavigate.OpenOnClick&&xMenuBody[nMenu].style.display==oBrowser.DisplayHide); if(sNodePath){ bThisPage=iNavigate.PageSearch.MatchesURL(sNodePath,sNodeQuery); if(!bOpenOnClick&&!bThisPage){ return;}} _MenuToggle(nMenu,bOpenOnClick,bThisPage);}} function _MenuToggle(nMenu,bPreserveOpenOnClick,bThisPage){ var i; var oMenu=xMenu[nMenu]; var oMenuBox=xMenuBox[nMenu]; var oMenuBody=xMenuBody[nMenu]; if(oMenuBody){ if(oBrowser.Gecko09plus){ var oAll=GetFirstElement(document,iNavigate.menuAll,'span'); oAll.style.display=oBrowser.DisplayHide;} if(oMenuBody.style.display==oBrowser.DisplayHide){ SetMenuCookie(oMenu,true); oMenuBody.style.display=oBrowser.DisplayShow; oMenuBox.src=xMenuBoxMinusImage[nMenu].src; oMenuBox.title=iNavigate.NodeMinusTitle; if(iNavigate.AutoClose==true){ SetMenuCookie(oMenu,(bPreserveOpenOnClick&&!bThisPage),true); for(i=0;inMenu){ if(sCookie.charAt(nMenu)=='1') bValue=true;} if(!bValue){ if(oMenu.getAttribute('menuOpen')=='1') bValue=true;} return bValue;} function SetGroupLoaded(){ var sName=iNavigate.cookiePrefix+iNavigate.GroupName; var sCookie=GetCookie(sName); sCookie='1'+sCookie.substring(1); document.cookie=sName+'='+sCookie+';path=/';} function GetGroupLoaded(){ var bValue=false; var sName=iNavigate.cookiePrefix+iNavigate.GroupName; bValue=document.cookie.indexOf(sName+'=1')==-1; return bValue;} function GetCookie(sName){ var sCookie=document.cookie; var sSignature=sName+'='; var nStart=sCookie.indexOf(sSignature); if(nStart==-1){ sCookie='';}else{ sCookie=sCookie.substring(nStart+sSignature.length); nStart=sCookie.indexOf(';'); if(nStart>-1){ sCookie=sCookie.substring(0,nStart)}} return sCookie;} function NormalizePathName(sPathName,sDefault){ var sBuffer; var nPos; nPos=sPathName.indexOf('/'); if(nPos==0){ sBuffer=sPathName;}else{ sBuffer='/'+sPathName;} if(oBrowser.Opera){ nPos=sPathName.lastIndexOf('?'); if(nPos>-1){ sBuffer=sBuffer.substring(0,nPos);}} if(sBuffer.length==1){ if(sDefault){ sBuffer=sBuffer+sDefault;}} return unescape(sBuffer.replace(/\\/g,'/').toLowerCase());} function NormalizeQueryString(sQueryString){ var sBuffer=sQueryString; if(sBuffer.length>0){ var nPos=sBuffer.indexOf('?'); if(nPos>-1){ sBuffer=sBuffer.substr(nPos+1);}} return sBuffer.toLowerCase();} function IsJavaScriptURL(sString){ return StringStarts(sString.toLowerCase(),'javascript:')} function GetElements(element,id,tagName){ var i; var elements=new Array(); if(oBrowser.IE4plus){ if(element.all[id]){ elements=element.all[id]; if(!elements.length) elements=[element.all[id]];}} else if(oBrowser.Opera){ var temp=new Array(); temp=element.getElementsByTagName(tagName); for(i=0;i0) break;}}} function StringStarts(sString,sEnd){ return (sString.indexOf(sEnd)==0);} function StringEnds(sString,sEnd){ if(sString.length