1//--------------------------------------------------------------------------------------------------------- 2// flexMenu V8 3// JavaScript DHTML Hierarchical Menu Class 4// Currently supported browsers: 5// IE5+, Mozilla/5 (e.g. Netscape 6+, FireBird, FireFox), Safari, Camino, Konqueror, Opera 6// 7// (C) FlexScape, LLC, Torsten Heinze 1999-2007, All rights reserved. 8// 9// Copying or using this code (or parts of it) without explicit permission by FlexScape, LLC is prohibited 10// and will result in proscecution and severe penalties. 11//--------------------------------------------------------------------------------------------------------- 12var timers=new Array(); 13var currentRID=null; //current selected root menu 14var currentMNU=null; //current selected root menu 15var usePopContainer=false; 16//parent window containing this script (e.g. for IFRAME) 17var pw=self; 18//var mnuSlideDelay=10; 19var ua=navigator.userAgent; 20 21var b_Pattern="android|ipad|iphone|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|IEMobile|msiemobile|MSIEMobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino" 22var v_Pattern="1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-" 23var b_Regexp=new RegExp(b_Pattern,"ig"); 24var v_Regexp=new RegExp(v_Pattern,"ig"); 25var isMobile= ((b_Regexp.test(ua))||(v_Regexp.test(ua.substr(ua.length-4)))); 26//console.log(ua+":"+isMobile); 27 28//IE only -------------------------------------------------------------------------- 29if(document.all){var checkedForControls=false;document.onreadystatechange=checkForControls;}else{var checkedForControls=true;} 30function checkForControls(){ 31 if(document.body&&(ua.indexOf("MSIE")>1)){ 32 if(document.body.readyState=="complete"){ 33 var rv = 0; 34 var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); 35 if (re.exec(ua) != null)rv = parseFloat( RegExp.$1 ); 36 37 if(rv>=8.0) return; 38 if(checkForControls&&usePopContainer) return; 39 40 usePopContainer=(document.body.getElementsByTagName("IFRAME").length+ 41 document.body.getElementsByTagName("SELECT").length+ 42 document.body.getElementsByTagName("OBJECT").length+ 43 (typeof(window.flexWriteActiveX)!="undefined"))>0; 44 45 //if(usePopContainer)console.log(" POP CONTAINER "); //DEBUG 46 checkedForControls=true; 47 } 48 } 49} 50//----------------------------------------------------------------------------------- 51 52function doFalse(){ 53 return false; 54} 55 56function doLink(el,sLink){ 57 if((!sLink)||(sLink=="")){return} 58 if(el.isdisabled) return; 59 if(sLink.indexOf("javascript:")>-1){ 60 eval(sLink); 61 }else{ 62 pw.location.href=sLink; 63 } 64} 65 66function doEnableLink(sID,bEnableLink){ 67 if(!sID)return; 68 var oTD=document.getElementById(sID); 69 if(!oTD)return; 70 if(oTD.tagName=="TR"){ 71 for (var c=0;c<oTD.childNodes.length;c++){ 72 if(oTD.childNodes[c].tagName=="TD"){oTD=oTD.childNodes[c];break;} 73 } 74 } 75 76 var oLink=oTD.childNodes[0]; 77 if(!oLink)return; 78 79 if(bEnableLink){ 80 oLink.onclick = null; 81 }else{ 82 oLink.onclick = DisableLink; 83 iTimeout=(isMobile)?500:0; 84 setTimeout("doEnableLink('"+sID+"',true)",iTimeout) 85 } 86} 87 88function doMouseOverItem(el,sOverClass,subid){ 89 if(!checkedForControls) checkForControls(); 90 doSelect(el,sOverClass,subid); 91 el.onselectstart=doFalse; 92} 93 94function doSelect(el,sOverClass,subid){ 95 if(!el){return} 96 var mid=el.getAttribute("mid"); 97 var mnu=document.getElementById(mid); 98 //window.status+=mnu; 99 if(!mnu) return; 100 var rid=mnu.getAttribute("rid"); 101 102 //if moved to another menu, then hide last menu 103 if(currentRID) if(currentRID!=rid) unSelect(document.getElementById(currentRID)); 104 currentRID=rid; 105 if(el!=mnu.current){ 106 unSelect(mnu); 107 el.classNameOrg=el.className; 108 el.className=sOverClass; 109 mnu.current=el; 110 }else{ 111 doClearHideTimer(mid); 112 return; 113 } 114
115 if(typeof(subid)!="undefined") doShowSubMenu(el,subid); 116} 117 118function unSelect(mnu){ 119 doHideSubMenuChildren(mnu); 120 resetClass(mnu); 121} 122 123function resetClass(mnu){ 124 if(mnu.current){ 125 mnu.current.className=mnu.current.classNameOrg; 126 mnu.current=null 127 } 128} 129 130function doShowMenu(id,x,y){ 131 var mnu=document.getElementById(id); //the menu 132 if(!mnu){return} 133 var mhv=mnu.getAttribute("hv"); 134 if(usePopContainer) mnu=doCreateContainer(id,id,mhv,mnu) 135 mnu.style.left=x+"px"; 136 mnu.style.top=y+"px"; 137 mnu.style.visibility="visible"; 138 currentMNU=id; 139} 140 141function doShowSubMenu(el,id){ 142 if(!id){return} 143 var mnu=document.getElementById(id); //the (sub) menu 144 if(!mnu){return} 145 146 var mid=el.getAttribute("mid"); 147 148 var parentMenu=document.getElementById(mid); // parent menu 149 var rid = mnu.getAttribute("rid"); // root menu id 150 151 var mhv=mnu.getAttribute("hv"); // direction of menu (horizontal or vertical) 152 var phv=parentMenu.getAttribute("hv"); // direction of parent menu (horizontal or vertical) 153 154 var w=mnu.offsetWidth; 155 var h=mnu.offsetHeight; 156 157 //determine positioning parent 158 if(mhv=="|"){ 159 var pel=el; 160 //make it look better if parent item width > submenu width 161 if((phv=="-")&&(pel.offsetWidth>(w))){mnu.style.width=pel.offsetWidth;w=pel.offsetWidth;} 162 }else{ 163 var pel=parentMenu; 164 //horizontal, so same width as parentMenu 165 mnu.style.width=parentMenu.offsetWidth; 166 } 167 168 bRelativeContainer=false; 169 170 //determine new position based on parent 171 if(phv=="|"){ 172 var x=mnuGetLeft(pel)+pel.offsetWidth; 173 var y=mnuGetTop(pel); 174 }else{ 175 var x=mnuGetLeft(pel); 176 var y=mnuGetTop(pel)+ pel.offsetHeight; 177 } 178 179 if((typeof(parentMenu)!="undefined")||(parentMenu.style.position=="absolute")){ 180 if(typeof(parentMenu.w)!="undefined"){ 181 var parw=parentMenu.w; 182 var parh=parentMenu.h; 183 }else{ 184 var parw=parentMenu.offsetWidth; 185 var parh=parentMenu.offsetHeight; 186 } 187 }else{ 188 var parw=0; 189 var parh=0; 190 } 191 192 var w=mnu.offsetWidth; 193 var h=mnu.offsetHeight; 194 195 //for vertical menus, adjust scrolling and body width, so it fits always in visible window 196 if(mhv=="|"){ 197 if((parentMenu.className.indexOf("_LEFT")>0)||((x+w)>=(document.body.clientWidth+document.body.scrollLeft))){ 198 if(phv!="-"){ 199 x-=w+parw-2; 200 }else{ 201 x=document.body.clientWidth+document.body.scrollLeft-w; 202 } 203 //window.status=phv+":"+w+":"+parw+":"+x+":"+document.body.clientWidth+":"+document.body.scrollLeft; 204 } 205 206 //if((parentMenu.className.indexOf("_TOP")>0)||((y+h)>=(document.body.clientHeight+document.body.scrollTop))){ 207 if(parentMenu.className.indexOf("_TOP")>0){ 208 if(phv!="|"){ 209 y-=h+parh-2; 210 }else{ 211 y=document.body.clientHeight+document.body.scrollTop-h-2; 212 } 213 //window.status=phv+":"+h+":"+parh+":"+y+":"+document.body.clientTop+":"+document.body.scrollTop; 214 } 215 216 } 217 218 if(usePopContainer){ 219 //1st level sub menu is an IFRAME so apply correct position to 2nd level one 220 //since el in sub menu 1 is now positioned relative to it's IFRAME document, 221 //must add parentMenu offset (only if vertical) 222 if((mhv=="|")&&(parentMenu.style.position=="absolute")){ 223 x+=parentMenu.offsetLeft; 224 y+=parentMenu.offsetTop; 225 } 226 227 mnu=doCreateContainer(id,rid,mhv,mnu) 228 } 229 230 //console.log(usePopContainer+":"+x+":"+y); 231 mnu.style.left=x+"px"; 232 mnu.style.top=y+"px"; 233 mnu.style.visibility="visible"; 234 parentMenu.childMenu=mnu; //link with parent 235 mnu.parentMenu=parentMenu; 236 237 if(typeof(mnuSlideDelay)!="undefined"){ 238 mnu.style.clip="rect(0px,"+w+"px,0px,0px)"; 239 mnu.style.opacity=0;mnu.style.KhtmlOpacity=0;mnu.style.MozOpacity=0; 240 mnu.style.filter = 'alpha(opacity=0)'; 241 mnu.maxwidth=w; 242 mnu.maxheight=h; 243 mnu.currentheight=0; 244 doMenuSlide(id,-1);
245 mnu.slideid=setInterval("doMenuSlide('"+id+"',1)",15); 246 } 247 248} 249 250function doMenuSlide(id,dir){ 251 var mnu=document.getElementById(id); 252 var w=mnu.maxwidth; 253 var h=mnu.maxheight; 254 var i=mnu.currentheight; 255 256 i=i+dir*(Math.round((h - i) / mnuSlideDelay)+10); 257 var ip=Math.round(i * 100 / h);if(ip>100)ip=100; 258 259 if(i>=h){ 260 clearInterval(mnu.slideid);i=h;ip=100; 261 }else if(i<=0){ 262 clearInterval(mnu.slideid);i=0;ip=0; 263 } 264 265 //window.status=i; 266 mnu.style.opacity=ip/100;mnu.style.KhtmlOpacity=ip/100;mnu.style.MozOpacity=ip/100; 267 mnu.style.filter = 'alpha(opacity=' + ip+ ')'; 268 mnu.style.clip="rect(0px,"+w+"px,"+i+"px,0px)"; 269 mnu.currentheight=i; 270} 271 272 273//IE4+ and ActiveX, Frames, Flash put everything in IFRAME now, so zIndex is correct 274//tricky: move existing mnu (outer TABLE) into a new created IFRAME 275function doCreateContainer(id,rid,mhv,mnu){ 276 //already created? 277 if(mnu.tagName=="IFRAME"){ 278 //in case size changed 279 var mnuDoc=document.frames[id]; 280 if(mnuDoc){ 281 mnuX=mnuDoc.document.getElementById(id); 282 mnu.style.width=mnuX.offsetWidth; 283 mnu.style.height=mnuX.offsetHeight; 284 } 285 return mnu; 286 } 287 288 //remember properties of mnu 289 var mnu_margin=mnu.currentStyle.margin; 290 mnu.style.margin="0px 0px 0px 0px"; 291 var sMenuHTML=mnu.outerHTML; 292 var w=mnu.offsetWidth; 293 var h=mnu.offsetHeight; 294 //destroy mnu original, because IFRAME will become new mnu 295 mnu.outerHTML=""; 296 297 // remove inline styles for A tags (added by IE, while fetching innerHTML) 298 var re = new RegExp("<A style=\"([^\"]*)\"([^>]*)","ig"); 299 sMenuHTML = sMenuHTML.replace(re, "<A $2"); 300 301 //IFRAME container 302 var sHTML='<IFRAME id="'+id+'" src="javascript:false" style="background:none;position:absolute;border:0px;padding:0px;margin:'+mnu_margin+';top:0px;left:0px;width:'+w+'px;height:'+h+'px;visibility:hidden;" frameborder=0 scrolling=no allowTransparency="true"></IFRAME>'; 303 document.body.insertAdjacentHTML("AfterBegin",sHTML); 304 var sty=""; 305 //insert styles into iframe as well 306 for (var i=0; i<document.styleSheets.length;i++){ 307 var styleSrc=document.styleSheets[i].href; 308 if((styleSrc)&&(styleSrc!="")) sty+='<link REL="stylesheet" TYPE="text/css" HREF="'+styleSrc+'">\n'; 309 } 310 sty+="<style type=\"text/css\">\n"; 311 sty+="#"+mnu.id+" A {display:block;cursor:pointer;border:0;padding:0;margin:0;text-decoration:expression(this.parentNode.currentStyle.textDecoration);text-decoration:inherit;color:expression(this.parentNode.currentStyle.color);color:inherit}\n"; 312 sty+="#"+mnu.id+" A:HOVER {display:block;cursor:pointer;border:0;padding:0;margin:0;text-decoration:expression(this.parentNode.currentStyle.textDecoration);text-decoration:inherit;color:expression(this.parentNode.currentStyle.color);color:inherit}\n"; 313 sty+="</style>\n"; 314 315 var scr='<script language="JavaScript">var pw=parent;onload=doShow;function doShow(){'+id+'.style.visibility="visible";'+id+'.onmousemove=null;'+id+'.onmouseout=null;};setTimeout("doShow()",10);</script>'; 316 var t=eval(id+".document"); 317 t.open(); 318 t.writeln(sty+scr+'\n<body style="background:none;" id=ifrmnu topmargin=0 leftmargin=0 rightmargin=0 marginheight=0 marginwidth=0 onmouseover="pw.doClearHideTimer(\''+id+'\')" onmousemove="pw.doClearHideTimer(\''+id+'\')" onmouseout="pw.doSetHideTimer(\''+id+'\')">'+sMenuHTML+'</body>'); 319 t.close(); 320 var cnt=document.getElementById(id); 321 322 cnt.rid=rid; 323 cnt.hv=mhv; 324 mnu=cnt; 325 return mnu; 326} 327 328function doClearHideTimer(id){ 329 var mnu=document.getElementById(id); 330 if(!mnu) return; 331 var rid=mnu.getAttribute("rid"); 332 //window.status=mnu.id+":"+rid+" hide timer cleared"; 333 if(timers[rid]){clearTimeout(timers[rid]);timers[rid]=null} 334} 335 336function doSetHideTimer(id){ 337 var mnu=document.getElementById(id); 338 if(!mnu) return; 339 var rid=mnu.getAttribute("rid"); 340 doClearHideTimer(id); 341 timers[rid]=setTimeout("doHideSubMenuRecurse('"+id+"')",450); 342} 343 344function doHideSubMenuChildren(mnu){ 345 if(!mnu) return; 346 //close all children 347 while(mnu.childMenu){ 348 resetClass(mnu.childMenu); 349 pot=document.getElementById(mnu.childMenu.id); 350 if(pot){ 351 if(typeof(pot.slideid)!="undefined"){ 352 clearInterval(pot.slideid);pot.slideid=setInterval("doMenuSlide('"+pot.id+"',-1)",15); 353 }else{ 354 pot.style.visibility="hidden"; 355 } 356 } 357 358 closedMenu=mnu; 359 mnu=mnu.childMenu; 360 closedMenu.childMenu=null; 361 } 362 363} 364 365function doHideSubMenuRecurse(id){ 366 var mnu=document.getElementById(id); 367 doHideSubMenuChildren(mnu); 368 if(mnu.childMenu){return} 369 //close menus all the way up to root-parent 370 while(mnu){ 371 resetClass(mnu); 372 mnu.childMenu=null; //unlink 373 pot=document.getElementById(mnu.id); 374 375 if(pot){ 376 if(pot.style.position=="absolute"){ 377 if(typeof(pot.slideid)!="undefined"){ 378 clearInterval(pot.slideid);pot.slideid=setInterval("doMenuSlide('"+pot.id+"',-1)",15); 379 }else{ 380 pot.style.visibility="hidden"; 381 } 382 } 383 } 384 385 mnu=mnu.parentMenu; 386 } 387} 388 389/* ------------- get Element Absolute Left ------------------------------------------------------ */ 390function mnuGetLeft(el) { 391 var x=0; 392 while (el!= null){ 393 if(el.tagName!="TR"){
394 var bWidth=0;if(el.currentStyle)if(el.className.indexOf("mnu")!=0)if(el.currentStyle.borderLeftWidth)bWidth=parseInt(el.currentStyle.borderLeftWidth); 395 if(isNaN(bWidth)) bWidth=0; 396 var sPosition=mnuGetStyle(el,"position"); 397 if(ua.indexOf("MSIE")<0)if(el.tagName=="TABLE")sPosition=""; 398 if(sPosition=="relative"){ 399 x += bWidth; 400 }else{ 401 x += el.offsetLeft+bWidth; 402 //console.log(sPosition+":"+el.tagName+":"+el.id+":"+el.className+":"+el.offsetLeft+":"+bWidth); 403 } 404 } 405 el = el.offsetParent; 406 } 407 return x; 408} 409 410/* ------------- get Element Absolute Top ------------------------------------------------------ */ 411function mnuGetTop(el) { 412 var y=0; 413 var pel=el.offsetParent; 414 if(pel.currentStyle)if(pel.currentStyle.borderTopWidth) y=parseInt(pel.currentStyle.borderTopWidth); 415 if(isNaN(y)) y=0; 416 y= -1 * y; 417 418 while (el!= null) { 419 if(el.tagName!="TR"){ 420 var bWidth=0;if(el.currentStyle)if(el.className.indexOf("mnu")!=0)if(el.currentStyle.borderTopWidth)bWidth=parseInt(el.currentStyle.borderTopWidth); 421 if(isNaN(bWidth)) bWidth=0; 422 var sPosition=mnuGetStyle(el,"position"); 423 if(ua.indexOf("MSIE")<0)if(el.tagName=="TABLE")sPosition=""; 424 //if(bWidth>0) console.log(el.tagName+":"+el.className+":"+bWidth); 425 if(sPosition=="relative"){ 426 y += bWidth; 427 }else{ 428 y += el.offsetTop+bWidth; 429 } 430 }; 431 el = el.offsetParent; 432 } 433 434 //console.log(y); 435 return y; 436} 437 438//only for MakeMenuVerticalList Navigation Module --------------------------------------------- 439var openListItems=new Array(); 440function toggleListMenu(id,depth,bShow){ 441 if(!document.getElementById) return; 442 443 if(document.getElementById(openListItems[depth])){ 444 if(openListItems[depth]!=id) document.getElementById(openListItems[depth]).style.display="none"; 445 } 446 447 if(document.getElementById(id)){ 448 if(bShow){ 449 document.getElementById(id).style.display=""; 450 openListItems[depth]=id; 451 }else{ 452 if(document.getElementById(id).style.display=="none"){ 453 document.getElementById(id).style.display=""; 454 openListItems[depth]=id; 455 }else{ 456 document.getElementById(id).style.display="none"; 457 } 458 } 459 } 460} 461 462function mnuGetStyle(el, prop) { 463 var y; 464 if (el.currentStyle) 465 y = el.currentStyle[prop]; 466 else if (window.getComputedStyle) 467 y = window.getComputedStyle( el, '').getPropertyValue(prop); 468 return y; 469}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.