1/** 2 * mm_menu 20MAR2002 Version 6.0 3 * Andy Finnell, March 2002 4 * Copyright (c) 2000-2002 Macromedia, Inc. 5 * 6 * based on menu.js 7 * by gary smith, July 1997 8 * Copyright (c) 1997-1999 Netscape Communications Corp. 9 * 10 * Netscape grants you a royalty free license to use or modify this 11 * software provided that this copyright notice appears on all copies. 12 * This software is provided "AS IS," without a warranty of any kind. 13 */ 14function Menu(label, mw, mh, fnt, fs, fclr, fhclr, bg, bgh, halgn, valgn, pad, space, to, sx, sy, srel, opq, vert, idt, aw, ah) 15{ 16 this.version = "020320 [Menu; mm_menu.js]"; 17 this.type = "Menu"; 18 this.menuWidth = mw; 19 this.menuItemHeight = mh; 20 this.fontSize = fs; 21 this.fontWeight = "plain"; 22 this.fontFamily = fnt; 23 this.fontColor = fclr; 24 this.fontColorHilite = fhclr; 25 this.bgColor = "#555555"; 26 this.menuBorder = 1; 27 this.menuBgOpaque=opq; 28 this.menuItemBorder = 1; 29 this.menuItemIndent = idt; 30 this.menuItemBgColor = bg; 31 this.menuItemVAlign = valgn; 32 this.menuItemHAlign = halgn; 33 this.menuItemPadding = pad; 34 this.menuItemSpacing = space; 35 this.menuLiteBgColor = "#ffffff"; 36 this.menuBorderBgColor = "#777777"; 37 this.menuHiliteBgColor = bgh; 38 this.menuContainerBgColor = "#cccccc"; 39 this.childMenuIcon = "arrows.gif"; 40 this.submenuXOffset = sx; 41 this.submenuYOffset = sy; 42 this.submenuRelativeToItem = srel; 43 this.vertical = vert; 44 this.items = new Array(); 45 this.actions = new Array(); 46 this.childMenus = new Array(); 47 this.hideOnMouseOut = true; 48 this.hideTimeout = to; 49 this.addMenuItem = addMenuItem; 50 this.writeMenus = writeMenus; 51 this.MM_showMenu = MM_showMenu; 52 this.onMenuItemOver = onMenuItemOver; 53 this.onMenuItemAction = onMenuItemAction; 54 this.hideMenu = hideMenu; 55 this.hideChildMenu = hideChildMenu; 56 if (!window.menus) window.menus = new Array(); 57 this.label = " " + label; 58 window.menus[this.label] = this; 59 window.menus[window.menus.length] = this; 60 if (!window.activeMenus) window.activeMenus = new Array(); 61} 62 63function addMenuItem(label, action) { 64 this.items[this.items.length] = label; 65 this.actions[this.actions.length] = action; 66} 67 68function FIND(item) { 69 if( window.mmIsOpera ) return(document.getElementById(item)); 70 if (document.all) return(document.all[item]); 71 if (document.getElementById) return(document.getElementById(item)); 72 return(false); 73} 74 75function writeMenus(container) { 76 if (window.triedToWriteMenus) return; 77 var agt = navigator.userAgent.toLowerCase(); 78 window.mmIsOpera = agt.indexOf("opera") != -1; 79 if (!container && document.layers) { 80 window.delayWriteMenus = this.writeMenus; 81 var timer = setTimeout('delayWriteMenus()', 500); 82 container = new Layer(100); 83 clearTimeout(timer); 84 } else if (document.all || document.hasChildNodes || window.mmIsOpera) { 85 document.writeln('<span id="menuContainer"></span>'); 86 container = FIND("menuContainer"); 87 } 88 89 window.mmHideMenuTimer = null; 90 if (!container) return; 91 window.triedToWriteMenus = true; 92 container.isContainer = true; 93 container.menus = new Array(); 94 for (var i=0; i<window.menus.length; i++) 95 container.menus[i] = window.menus[i]; 96 window.menus.length = 0; 97 var countMenus = 0; 98 var countItems = 0; 99 var top = 0; 100 var content = ''; 101 var lrs = false; 102 var theStat = ""; 103 var tsc = 0; 104 if (document.layers) lrs = true; 105 for (var i=0; i<container.menus.length; i++, countMenus++) { 106 var menu = container.menus[i]; 107 if (menu.bgImageUp || !menu.menuBgOpaque) { 108 menu.menuBorder = 0; 109 menu.menuItemBorder = 0; 110 } 111 if (lrs) { 112 var menuLayer = new Layer(100, container); 113 var lite = new Layer(100, menuLayer); 114 lite.top = menu.menuBorder; 115 lite.left = menu.menuBorder; 116 var body = new Layer(100, lite); 117 body.top = menu.menuBorder; 118 body.left = menu.menuBorder; 119 } else { 120 content += ''+ 121 '<div id="menuLayer'+ countMenus +'" style="position:absolute;z-index:1;left:10px;top:'+ (i * 100) +'px;visibility:hidden;color:' + menu.menuBorderBgColor + ';">\n'+ 122 ' <div id="menuLite'+ countMenus +'" style="position:absolute;z-index:1;left:'+ menu.menuBorder +'px;top:'+ menu.menuBorder +'px;visibility:hide;" onmouseout="mouseoutMenu();">\n'+ 123 ' <div id="menuFg'+ countMenus +'" style="position:absolute;
123left:'+ menu.menuBorder +'px;top:'+ menu.menuBorder +'px;visibility:hide;">\n'+ 124 ''; 125 } 126 var x=i; 127 for (var i=0; i<menu.items.length; i++) { 128 var item = menu.items[i]; 129 var childMenu = false; 130 var defaultHeight = menu.fontSize+2*menu.menuItemPadding; 131 if (item.label) { 132 item = item.label; 133 childMenu = true; 134 } 135 menu.menuItemHeight = menu.menuItemHeight || defaultHeight; 136 var itemProps = ''; 137 if( menu.fontFamily != '' ) itemProps += 'font-family:' + menu.fontFamily +';'; 138 itemProps += 'font-weight:' + menu.fontWeight + ';fontSize:' + menu.fontSize + 'px;'; 139 if (menu.fontStyle) itemProps += 'font-style:' + menu.fontStyle + ';'; 140 if (document.all || window.mmIsOpera) 141 itemProps += 'font-size:' + menu.fontSize + 'px;" onmouseover="onMenuItemOver(null,this);" onclick="onMenuItemAction(null,this);'; 142 else if (!document.layers) { 143 itemProps += 'font-size:' + menu.fontSize + 'px;'; 144 } 145 var l; 146 if (lrs) { 147 var lw = menu.menuWidth; 148 if( menu.menuItemHAlign == 'right' ) lw -= menu.menuItemPadding; 149 l = new Layer(lw,body); 150 } 151 var itemLeft = 0; 152 var itemTop = i*menu.menuItemHeight; 153 if( !menu.vertical ) { 154 itemLeft = i*menu.menuWidth; 155 itemTop = 0; 156 } 157 var dTag = '<div id="menuItem'+ countItems +'" style="position:absolute;left:' + itemLeft + 'px;top:'+ itemTop +'px;'+ itemProps +'">'; 158 var dClose = '</div>' 159 if (menu.bgImageUp) dTag = '<div id="menuItem'+ countItems +'" style="background:url('+menu.bgImageUp+');position:absolute;left:' + itemLeft + 'px;top:'+ itemTop +'px;'+ itemProps +'">'; 160 161 var left = 0, top = 0, right = 0, bottom = 0; 162 left = 1 + menu.menuItemPadding + menu.menuItemIndent; 163 right = left + menu.menuWidth - 2*menu.menuItemPadding - menu.menuItemIndent; 164 if( menu.menuItemVAlign == 'top' ) top = menu.menuItemPadding; 165 if( menu.menuItemVAlign == 'bottom' ) top = menu.menuItemHeight-menu.fontSize-1-menu.menuItemPadding; 166 if( menu.menuItemVAlign == 'middle' ) top = ((menu.menuItemHeight/2)-(menu.fontSize/2)-1); 167 bottom = menu.menuItemHeight - 2*menu.menuItemPadding; 168 var textProps = 'position:absolute;left:' + left + 'px;top:' + top + 'px;'; 169 if (lrs) { 170 textProps +=itemProps + 'right:' + right + ';bottom:' + bottom + ';'; 171 dTag = ""; 172 dClose = ""; 173 } 174 175 if(document.all && !window.mmIsOpera) { 176 item = '<div align="' + menu.menuItemHAlign + '">' + item + '</div>'; 177 } else if (lrs) { 178 item = '<div style="text-align:' + menu.menuItemHAlign + ';">' + item + '</div>'; 179 } else { 180 var hitem = null; 181 if( menu.menuItemHAlign != 'left' ) { 182 if(window.mmIsOpera) { 183 var operaWidth = menu.menuItemHAlign == 'center' ? -(menu.menuWidth-2*menu.menuItemPadding) : (menu.menuWidth-6*menu.menuItemPadding); 184 hitem = '<div id="menuItemHilite' + countItems + 'Shim" style="position:absolute;top:1px;left:' + menu.menuItemPadding + 'px;width:' + operaWidth + 'px;text-align:' 185 + menu.menuItemHAlign + ';visibility:visible;">' + item + '</div>'; 186 item = '<div id="menuItemText' + countItems + 'Shim" style="position:absolute;top:1px;left:' + menu.menuItemPadding + 'px;width:' + operaWidth + 'px;text-align:' 187 + menu.menuItemHAlign + ';visibility:visible;">' + item + '</div>'; 188 } else { 189 hitem = '<div id="menuItemHilite' + countItems + 'Shim" style="position:absolute;top:1px;left:1px;right:-' + (left+menu.menuWidth-3*menu.menuItemPadding) + 'px;text-align:' 190 + menu.menuItemHAlign + ';visibility:visible;">' + item + '</div>'; 191 item = '<div id="menuItemText' + countItems + 'Shim" style="position:absolute;top:1px;left:1px;right:-' + (left+menu.menuWidth-3*menu.menuItemPadding) + 'px;text-align:' 192 + menu.menuItemHAlign + ';visibility:visible;">' + item + '</div>'; 193 } 194 } else hitem = null; 195 } 196 if(document.all && !window.mmIsOpera) item = '<div id="menuItemShim' + countItems + '" style="position:absolute;left:0px;top:0px;">' + item + '</div>'; 197 var dText = '<div id="menuItemText'+ countItems +'" style="' + textProps + 'color:'+ menu.fontColor +';">'+ item +' </div>\n' 198 + '<div id="menuItemHilite'+ countItems +'" style="' + textProps + 'color:'+ menu.fontColorHilite +';visibility:hidden;">' 199 + (hitem||item) +' </div>'; 200 if (childMenu) content += ( dTag + dText + '<div id="childMenu'+ countItems +'" style="position:absolute;
200left:0px;top:3px;"><img src="'+ menu.childMenuIcon +'"></div>\n' + dClose); 201 else content += ( dTag + dText + dClose); 202 if (lrs) { 203 l.document.open("text/html"); 204 l.document.writeln(content); 205 l.document.close(); 206 content = ''; 207 theStat += "-"; 208 tsc++; 209 if (tsc > 50) { 210 tsc = 0; 211 theStat = ""; 212 } 213 status = theStat; 214 } 215 countItems++; 216 } 217 if (lrs) { 218 var focusItem = new Layer(100, body); 219 focusItem.visiblity="hidden"; 220 focusItem.document.open("text/html"); 221 focusItem.document.writeln(" "); 222 focusItem.document.close(); 223 } else { 224 content += ' <div id="focusItem'+ countMenus +'" style="position:absolute;left:0px;top:0px;visibility:hide;" onclick="onMenuItemAction(null,this);"> </div>\n'; 225 content += ' </div>\n </div>\n</div>\n'; 226 } 227 i=x; 228 } 229 if (document.layers) { 230 container.clip.width = window.innerWidth; 231 container.clip.height = window.innerHeight; 232 container.onmouseout = mouseoutMenu; 233 container.menuContainerBgColor = this.menuContainerBgColor; 234 for (var i=0; i<container.document.layers.length; i++) { 235 proto = container.menus[i]; 236 var menu = container.document.layers[i]; 237 container.menus[i].menuLayer = menu; 238 container.menus[i].menuLayer.Menu = container.menus[i]; 239 container.menus[i].menuLayer.Menu.container = container; 240 var body = menu.document.layers[0].document.layers[0]; 241 body.clip.width = proto.menuWidth || body.clip.width; 242 body.clip.height = proto.menuHeight || body.clip.height; 243 for (var n=0; n<body.document.layers.length-1; n++) { 244 var l = body.document.layers[n]; 245 l.Menu = container.menus[i]; 246 l.menuHiliteBgColor = proto.menuHiliteBgColor; 247 l.document.bgColor = proto.menuItemBgColor; 248 l.saveColor = proto.menuItemBgColor; 249 l.onmouseover = proto.onMenuItemOver; 250 l.onclick = proto.onMenuItemAction; 251 l.mmaction = container.menus[i].actions[n]; 252 l.focusItem = body.document.layers[body.document.layers.length-1]; 253 l.clip.width = proto.menuWidth || body.clip.width; 254 l.clip.height = proto.menuItemHeight || l.clip.height; 255 if (n>0) { 256 if( l.Menu.vertical ) l.top = body.document.layers[n-1].top + body.document.layers[n-1].clip.height + proto.menuItemBorder + proto.menuItemSpacing; 257 else l.left = body.document.layers[n-1].left + body.document.layers[n-1].clip.width + proto.menuItemBorder + proto.menuItemSpacing; 258 } 259 l.hilite = l.document.layers[1]; 260 if (proto.bgImageUp) l.background.src = proto.bgImageUp; 261 l.document.layers[1].isHilite = true; 262 if (l.document.layers.length > 2) { 263 l.childMenu = container.menus[i].items[n].menuLayer; 264 l.document.layers[2].left = l.clip.width -13; 265 l.document.layers[2].top = (l.clip.height / 2) -4; 266 l.document.layers[2].clip.left += 3; 267 l.Menu.childMenus[l.Menu.childMenus.length] = l.childMenu; 268 } 269 } 270 if( proto.menuBgOpaque ) body.document.bgColor = proto.bgColor; 271 if( proto.vertical ) { 272 body.clip.width = l.clip.width +proto.menuBorder; 273 body.clip.height = l.top + l.clip.height +proto.menuBorder; 274 } else { 275 body.clip.height = l.clip.height +proto.menuBorder; 276 body.clip.width = l.left + l.clip.width +proto.menuBorder; 277 if( body.clip.width > window.innerWidth ) body.clip.width = window.innerWidth; 278 } 279 var focusItem = body.document.layers[n]; 280 focusItem.clip.width = body.clip.width; 281 focusItem.Menu = l.Menu; 282 focusItem.top = -30; 283 focusItem.captureEvents(Event.MOUSEDOWN); 284 focusItem.onmousedown = onMenuItemDown; 285 if( proto.menuBgOpaque ) menu.document.bgColor = proto.menuBorderBgColor; 286 var lite = menu.document.layers[0]; 287 if( proto.menuBgOpaque ) lite.document.bgColor = proto.menuLiteBgColor; 288 lite.clip.width = body.clip.width +1; 289 lite.clip.height = body.clip.height +1; 290 menu.clip.width = body.clip.width + (proto.menuBorder * 3) ; 291 menu.clip.height = body.clip.height + (proto.menuBorder * 3); 292 } 293 } else { 294 if ((!document.all) && (container.hasChildNodes) && !window.mmIsOpera) { 295 container.innerHTML=content; 296 } else { 297 container.document.open("text/html");
298 container.document.writeln(content); 299 container.document.close(); 300 } 301 if (!FIND("menuLayer0")) return; 302 var menuCount = 0; 303 for (var x=0; x<container.menus.length; x++) { 304 var menuLayer = FIND("menuLayer" + x); 305 container.menus[x].menuLayer = "menuLayer" + x; 306 menuLayer.Menu = container.menus[x]; 307 menuLayer.Menu.container = "menuLayer" + x; 308 menuLayer.style.zindex = 1; 309 var s = menuLayer.style; 310 s.pixeltop = -300; 311 s.pixelleft = -300; 312 s.top = '-300px'; 313 s.left = '-300px'; 314 315 var menu = container.menus[x]; 316 menu.menuItemWidth = menu.menuWidth || menu.menuIEWidth || 140; 317 if( menu.menuBgOpaque ) menuLayer.style.backgroundColor = menu.menuBorderBgColor; 318 var top = 0; 319 var left = 0; 320 menu.menuItemLayers = new Array(); 321 for (var i=0; i<container.menus[x].items.length; i++) { 322 var l = FIND("menuItem" + menuCount); 323 l.Menu = container.menus[x]; 324 l.Menu.menuItemLayers[l.Menu.menuItemLayers.length] = l; 325 if (l.addEventListener || window.mmIsOpera) { 326 l.style.width = menu.menuItemWidth + 'px'; 327 l.style.height = menu.menuItemHeight + 'px'; 328 l.style.pixelWidth = menu.menuItemWidth; 329 l.style.pixelHeight = menu.menuItemHeight; 330 l.style.top = top + 'px'; 331 l.style.left = left + 'px'; 332 if(l.addEventListener) { 333 l.addEventListener("mouseover", onMenuItemOver, false); 334 l.addEventListener("click", onMenuItemAction, false); 335 l.addEventListener("mouseout", mouseoutMenu, false); 336 } 337 if( menu.menuItemHAlign != 'left' ) { 338 l.hiliteShim = FIND("menuItemHilite" + menuCount + "Shim"); 339 l.hiliteShim.style.visibility = "inherit"; 340 l.textShim = FIND("menuItemText" + menuCount + "Shim"); 341 l.hiliteShim.style.pixelWidth = menu.menuItemWidth - 2*menu.menuItemPadding - menu.menuItemIndent; 342 l.hiliteShim.style.width = l.hiliteShim.style.pixelWidth; 343 l.textShim.style.pixelWidth = menu.menuItemWidth - 2*menu.menuItemPadding - menu.menuItemIndent; 344 l.textShim.style.width = l.textShim.style.pixelWidth; 345 } 346 } else { 347 l.style.pixelWidth = menu.menuItemWidth; 348 l.style.pixelHeight = menu.menuItemHeight; 349 l.style.pixelTop = top; 350 l.style.pixelLeft = left; 351 if( menu.menuItemHAlign != 'left' ) { 352 var shim = FIND("menuItemShim" + menuCount); 353 shim[0].style.pixelWidth = menu.menuItemWidth - 2*menu.menuItemPadding - menu.menuItemIndent; 354 shim[1].style.pixelWidth = menu.menuItemWidth - 2*menu.menuItemPadding - menu.menuItemIndent; 355 shim[0].style.width = shim[0].style.pixelWidth + 'px'; 356 shim[1].style.width = shim[1].style.pixelWidth + 'px'; 357 } 358 } 359 if( menu.vertical ) top = top + menu.menuItemHeight+menu.menuItemBorder+menu.menuItemSpacing; 360 else left = left + menu.menuItemWidth+menu.menuItemBorder+menu.menuItemSpacing; 361 l.style.fontSize = menu.fontSize + 'px'; 362 l.style.backgroundColor = menu.menuItemBgColor; 363 l.style.visibility = "inherit"; 364 l.saveColor = menu.menuItemBgColor; 365 l.menuHiliteBgColor = menu.menuHiliteBgColor; 366 l.mmaction = container.menus[x].actions[i]; 367 l.hilite = FIND("menuItemHilite" + menuCount); 368 l.focusItem = FIND("focusItem" + x); 369 l.focusItem.style.pixelTop = -30; 370 l.focusItem.style.top = '-30px'; 371 var childItem = FIND("childMenu" + menuCount); 372 if (childItem) { 373 l.childMenu = container.menus[x].items[i].menuLayer; 374 childItem.style.pixelLeft = menu.menuItemWidth -11; 375 childItem.style.left = childItem.style.pixelLeft + 'px'; 376 childItem.style.pixelTop = (menu.menuItemHeight /2) -4; 377 childItem.style.top = childItem.style.pixelTop + 'px'; 378 l.Menu.childMenus[l.Menu.childMenus.length] = l.childMenu; 379 } 380 l.style.cursor = "hand"; 381 menuCount++; 382 } 383 if( menu.vertical ) { 384 menu.menuHeight = top-1-menu.menuItemSpacing; 385 menu.menuWidth = menu.menuItemWidth; 386 } else { 387 menu.menuHeight = menu.menuItemHeight; 388 menu.menuWidth = left-1-menu.menuItemSpacing; 389 } 390 391 var lite = FIND("menuLite" + x); 392 var s = lite.style; 393 s.pixelHeight = menu.menuHeight +(menu.menuBorder * 2); 394 s.height = s.pixelHeight + 'px'; 395 s.pixelWidth = menu.menuWidth + (menu.menuBorder * 2); 396 s.width = s.pixelWidth + 'px'; 397 if( menu.menuBgOpaque ) s.backgroundColor = menu.menuLiteBgColor; 398 399 var body = FIND("menuFg" + x); 400 s = body.style; 401 s.pixelHeight = menu.menuHeight + menu.menuBorder; 402 s.height = s.pixelHeight + 'px'; 403 s.pixelWidth = menu.menuWidth + menu.menuBorder; 404 s.width = s.pixelWidth + 'px'; 405 if( menu.menuBgOpaque ) s.backgroundColor = menu.bgColor; 406 407 s = menuLayer.style; 408 s.pixelWidth = menu.menuWidth + (menu.menuBorder * 4); 409 s.width = s.pixelWidth + 'px'; 410 s.pixelHeight = menu.menuHeight+(menu.menuBorder*4); 411 s.height = s.pixelHeight + 'px'; 412 } 413 } 414 if (document.captureEvents) document.captureEvents(Event.MOUSEUP); 415 if (document.addEventListener) document.addEventListener("mouseup", onMenuItemOver, false); 416 if (document.layers && window.innerWidth) { 417 window.onresize = NS4resize; 418 window.NS4sIW = window.innerWidth; 419 window.NS4sIH = window.innerHeight; 420 setTimeout("NS4resize()",500); 421 } 422 document.onmouseup = mouseupMenu; 423 window.mmWroteMenu = true; 424 status = ""; 425} 426 427function NS4resize() { 428 if (NS4sIW != window.innerWidth || NS4sIH != window.innerHeight) window.location.reload(); 429} 430 431function onMenuItemOver(e, l) { 432 MM_clearTimeout(); 433 l = l || this; 434 var a = window.ActiveMenuItem; 435 if (document.layers) { 436 if (a) { 437 a.document.bgColor = a.saveColor; 438 if (a.hilite) a.hilite.visibility = "hidden"; 439 if (a.Menu.bgImageOver) a.background.src = a.Menu.bgImageUp; 440 a.focusItem.top = -100; 441 a.clicked = false; 442 } 443 if (l.hilite) { 444 l.document.bgColor = l.menuHiliteBgColor; 445 l.zIndex = 1; 446 l.hilite.visibility = "inherit"; 447 l.hilite.zIndex = 2;
448 l.document.layers[1].zIndex = 1; 449 l.focusItem.zIndex = this.zIndex +2; 450 } 451 if (l.Menu.bgImageOver) l.background.src = l.Menu.bgImageOver; 452 l.focusItem.top = this.top; 453 l.focusItem.left = this.left; 454 l.focusItem.clip.width = l.clip.width; 455 l.focusItem.clip.height = l.clip.height; 456 l.Menu.hideChildMenu(l); 457 } else if (l.style && l.Menu) { 458 if (a) { 459 a.style.backgroundColor = a.saveColor; 460 if (a.hilite) a.hilite.style.visibility = "hidden"; 461 if (a.hiliteShim) a.hiliteShim.style.visibility = "inherit"; 462 if (a.Menu.bgImageUp) a.style.background = "url(" + a.Menu.bgImageUp +")";; 463 } 464 l.style.backgroundColor = l.menuHiliteBgColor; 465 l.zIndex = 1; 466 if (l.Menu.bgImageOver) l.style.background = "url(" + l.Menu.bgImageOver +")"; 467 if (l.hilite) { 468 l.hilite.style.visibility = "inherit"; 469 if( l.hiliteShim ) l.hiliteShim.style.visibility = "visible"; 470 } 471 l.focusItem.style.pixelTop = l.style.pixelTop; 472 l.focusItem.style.top = l.focusItem.style.pixelTop + 'px'; 473 l.focusItem.style.pixelLeft = l.style.pixelLeft; 474 l.focusItem.style.left = l.focusItem.style.pixelLeft + 'px'; 475 l.focusItem.style.zIndex = l.zIndex +1; 476 l.Menu.hideChildMenu(l); 477 } else return; 478 window.ActiveMenuItem = l; 479} 480 481function onMenuItemAction(e, l) { 482 l = window.ActiveMenuItem; 483 if (!l) return; 484 hideActiveMenus(); 485 if (l.mmaction) eval("" + l.mmaction); 486 window.ActiveMenuItem = 0; 487} 488 489function MM_clearTimeout() { 490 if (mmHideMenuTimer) clearTimeout(mmHideMenuTimer); 491 mmHideMenuTimer = null; 492 mmDHFlag = false; 493} 494 495function MM_startTimeout() { 496 if( window.ActiveMenu ) { 497 mmStart = new Date(); 498 mmDHFlag = true; 499 mmHideMenuTimer = setTimeout("mmDoHide()", window.ActiveMenu.Menu.hideTimeout); 500 } 501} 502 503function mmDoHide() { 504 if (!mmDHFlag || !window.ActiveMenu) return; 505 var elapsed = new Date() - mmStart; 506 var timeout = window.ActiveMenu.Menu.hideTimeout; 507 if (elapsed < timeout) { 508 mmHideMenuTimer = setTimeout("mmDoHide()", timeout+100-elapsed); 509 return; 510 } 511 mmDHFlag = false; 512 hideActiveMenus(); 513 window.ActiveMenuItem = 0; 514} 515 516function MM_showMenu(menu, x, y, child, imgname) { 517 if (!window.mmWroteMenu) return; 518 MM_clearTimeout(); 519 if (menu) { 520 var obj = FIND(imgname) || document.images[imgname] || document.links[imgname] || document.anchors[imgname]; 521 x = moveXbySlicePos (x, obj); 522 y = moveYbySlicePos (y, obj); 523 } 524 if (document.layers) { 525 if (menu) { 526 var l = menu.menuLayer || menu; 527 l.top = l.left = 1; 528 hideActiveMenus(); 529 if (this.visibility) l = this; 530 window.ActiveMenu = l; 531 } else { 532 var l = child; 533 } 534 if (!l) return; 535 for (var i=0; i<l.layers.length; i++) { 536 if (!l.layers[i].isHilite) l.layers[i].visibility = "inherit"; 537 if (l.layers[i].document.layers.length > 0) MM_showMenu(null, "relative", "relative", l.layers[i]); 538 } 539 if (l.parentLayer) { 540 if (x != "relative") l.parentLayer.left = x || window.pageX || 0; 541 if (l.parentLayer.left + l.clip.width > window.innerWidth) l.parentLayer.left -= (l.parentLayer.left + l.clip.width - window.innerWidth); 542 if (y != "relative") l.parentLayer.top = y || window.pageY || 0; 543 if (l.parentLayer.isContainer) { 544 l.Menu.xOffset = window.pageXOffset; 545 l.Menu.yOffset = window.pageYOffset; 546 l.parentLayer.clip.width = window.ActiveMenu.clip.width +2; 547 l.parentLayer.clip.height = window.ActiveMenu.clip.height +2; 548 if (l.parentLayer.menuContainerBgColor && l.Menu.menuBgOpaque ) l.parentLayer.document.bgColor = l.parentLayer.menuContainerBgColor; 549 } 550 } 551 l.visibility = "inherit"; 552 if (l.Menu) l.Menu.container.visibility = "inherit"; 553 } else if (FIND("menuItem0")) { 554 var l = menu.menuLayer || menu; 555 hideActiveMenus(); 556 if (typeof(l) == "string") l = FIND(l); 557 window.ActiveMenu = l; 558 var s = l.style; 559 s.visibility = "inherit"; 560 if (x != "relative") { 561 s.pixelLeft = x || (window.pageX + document.body.scrollLeft) || 0; 562 s.left = s.pixelLeft + 'px'; 563 } 564 if (y != "relative") { 565 s.pixelTop = y || (window.pageY + document.body.scrollTop) || 0; 566 s.top = s.pixelTop + 'px'; 567 } 568 l.Menu.xOffset = document.body.scrollLeft; 569 l.Menu.yOffset = document.body.scrollTop; 570 } 571 if (menu) window.activeMenus[window.activeMenus.length] = l; 572 MM_clearTimeout(); 573} 574 575function onMenuItemDown(e, l) { 576 var a = window.ActiveMenuItem; 577 if (document.layers && a) { 578 a.eX = e.pageX; 579 a.eY = e.pageY; 580 a.clicked = true; 581 } 582} 583 584function mouseupMenu(e) { 585 hideMenu(true, e); 586 hideActiveMenus(); 587 return true; 588} 589 590function getExplorerVersion() { 591 var ieVers = parseFloat(navigator.appVersion); 592 if( navigator.appName != 'Microsoft Internet Explorer' ) return ieVers; 593 var tempVers = navigator.appVersion; 594 var i = tempVers.indexOf( 'MSIE ' ); 595 if( i >= 0 ) { 596 tempVers = tempVers.substring( i+5 ); 597 ieVers = parseFloat( tempVers ); 598 } 599 return ieVers; 600} 601 602function mouseoutMenu() { 603 if ((navigator.appName == "Microsoft Internet Explorer") && (getExplorerVersion() < 4.5)) 604 return true; 605 hideMenu(false, false); 606 return true; 607} 608 609function hideMenu(mouseup, e) { 610 var a = window.ActiveMenuItem; 611 if (a && document.layers) { 612 a.document.bgColor = a.saveColor; 613 a.focusItem.top = -30; 614 if (a.hilite) a.hilite.visibility = "hidden"; 615 if (mouseup && a.mmaction && a.clicked && window.ActiveMenu) { 616 if (a.eX <= e.pageX+15 && a.eX >= e.pageX-15 && a.eY <= e.pageY+10 && a.eY >= e.pageY-10) { 617 setTimeout('window.ActiveMenu.Menu.onMenuItemAction();', 500); 618 } 619 } 620 a.clicked = false; 621 if (a.Menu.bgImageOver) a.background.src = a.Menu.bgImageUp; 622 } else if (window.ActiveMenu && FIND("menuItem0")) { 623 if (a) { 624 a.style.backgroundColor = a.saveColor; 625 if (a.hilite) a.hilite.style.visibility = "hidden"; 626 if (a.hiliteShim) a.hiliteShim.style.visibility = "inherit"; 627 if (a.Menu.bgImageUp) a.style.background = "url(" + a.Menu.bgImageUp +")"; 628 } 629 } 630 if (!mouseup && window.ActiveMenu) { 631 if (window.ActiveMenu.Menu) { 632 if (window.ActiveMenu.Menu.hideOnMouseOut) MM_startTimeout(); 633 return(true); 634 } 635 } 636 return(true); 637} 638 639function hideChildMenu(hcmLayer) { 640 MM_clearTimeout(); 641 var l = hcmLayer; 642 for (var i=0; i < l.Menu.childMenus.length; i++) { 643 var theLayer = l.Menu.childMenus[i];
644 if (document.layers) theLayer.visibility = "hidden"; 645 else { 646 theLayer = FIND(theLayer); 647 theLayer.style.visibility = "hidden"; 648 if( theLayer.Menu.menuItemHAlign != 'left' ) { 649 for(var j = 0; j < theLayer.Menu.menuItemLayers.length; j++) { 650 var itemLayer = theLayer.Menu.menuItemLayers[j]; 651 if(itemLayer.textShim) itemLayer.textShim.style.visibility = "inherit"; 652 } 653 } 654 } 655 theLayer.Menu.hideChildMenu(theLayer); 656 } 657 if (l.childMenu) { 658 var childMenu = l.childMenu; 659 if (document.layers) { 660 l.Menu.MM_showMenu(null,null,null,childMenu.layers[0]); 661 childMenu.zIndex = l.parentLayer.zIndex +1; 662 childMenu.top = l.Menu.menuLayer.top + l.Menu.submenuYOffset; 663 if( l.Menu.vertical ) { 664 if( l.Menu.submenuRelativeToItem ) childMenu.top += l.top + l.parentLayer.top; 665 childMenu.left = l.parentLayer.left + l.parentLayer.clip.width - (2*l.Menu.menuBorder) + l.Menu.menuLayer.left + l.Menu.submenuXOffset; 666 } else { 667 childMenu.top += l.top + l.parentLayer.top; 668 if( l.Menu.submenuRelativeToItem ) childMenu.left = l.Menu.menuLayer.left + l.left + l.clip.width + (2*l.Menu.menuBorder) + l.Menu.submenuXOffset; 669 else childMenu.left = l.parentLayer.left + l.parentLayer.clip.width - (2*l.Menu.menuBorder) + l.Menu.menuLayer.left + l.Menu.submenuXOffset; 670 } 671 if( childMenu.left < l.Menu.container.clip.left ) l.Menu.container.clip.left = childMenu.left; 672 var w = childMenu.clip.width+childMenu.left-l.Menu.container.clip.left; 673 if (w > l.Menu.container.clip.width) l.Menu.container.clip.width = w; 674 var h = childMenu.clip.height+childMenu.top-l.Menu.container.clip.top; 675 if (h > l.Menu.container.clip.height) l.Menu.container.clip.height = h; 676 l.document.layers[1].zIndex = 0; 677 childMenu.visibility = "inherit"; 678 } else if (FIND("menuItem0")) { 679 childMenu = FIND(l.childMenu); 680 var menuLayer = FIND(l.Menu.menuLayer); 681 var s = childMenu.style; 682 s.zIndex = menuLayer.style.zIndex+1; 683 if (document.all || window.mmIsOpera) { 684 s.pixelTop = menuLayer.style.pixelTop + l.Menu.submenuYOffset; 685 if( l.Menu.vertical ) { 686 if( l.Menu.submenuRelativeToItem ) s.pixelTop += l.style.pixelTop; 687 s.pixelLeft = l.style.pixelWidth + menuLayer.style.pixelLeft + l.Menu.submenuXOffset; 688 s.left = s.pixelLeft + 'px'; 689 } else { 690 s.pixelTop += l.style.pixelTop; 691 if( l.Menu.submenuRelativeToItem ) s.pixelLeft = menuLayer.style.pixelLeft + l.style.pixelLeft + l.style.pixelWidth + (2*l.Menu.menuBorder) + l.Menu.submenuXOffset; 692 else s.pixelLeft = (menuLayer.style.pixelWidth-4*l.Menu.menuBorder) + menuLayer.style.pixelLeft + l.Menu.submenuXOffset; 693 s.left = s.pixelLeft + 'px'; 694 } 695 } else { 696 var top = parseInt(menuLayer.style.top) + l.Menu.submenuYOffset; 697 var left = 0; 698 if( l.Menu.vertical ) { 699 if( l.Menu.submenuRelativeToItem ) top += parseInt(l.style.top); 700 left = (parseInt(menuLayer.style.width)-4*l.Menu.menuBorder) + parseInt(menuLayer.style.left) + l.Menu.submenuXOffset; 701 } else { 702 top += parseInt(l.style.top); 703 if( l.Menu.submenuRelativeToItem ) left = parseInt(menuLayer.style.left) + parseInt(l.style.left) + parseInt(l.style.width) + (2*l.Menu.menuBorder) + l.Menu.submenuXOffset; 704 else left = (parseInt(menuLayer.style.width)-4*l.Menu.menuBorder) + parseInt(menuLayer.style.left) + l.Menu.submenuXOffset; 705 } 706 s.top = top + 'px'; 707 s.left = left + 'px'; 708 } 709 childMenu.style.visibility = "inherit"; 710 } else return; 711 window.activeMenus[window.activeMenus.length] = childMenu; 712 } 713} 714 715function hideActiveMenus() { 716 if (!window.activeMenus) return; 717 for (var i=0; i < window.activeMenus.length; i++) { 718 if (!activeMenus[i]) continue; 719 if (activeMenus[i].visibility && activeMenus[i].Menu && !window.mmIsOpera) { 720 activeMenus[i].visibility = "hidden"; 721 activeMenus[i].Menu.container.visibility = "hidden"; 722 activeMenus[i].Menu.container.clip.left = 0; 723 } else if (activeMenus[i].style) { 724 var s = activeMenus[i].style; 725 s.visibility = "hidden"; 726 s.left = '-200px'; 727 s.top = '-200px'; 728 } 729 } 730 if (window.ActiveMenuItem) hideMenu(false, false); 731 window.activeMenus.length = 0; 732} 733 734function moveXbySlicePos (x, img) { 735 if (!document.layers) { 736 var onWindows = navigator.platform ? navigator.platform == "Win32" : false; 737 var macIE45 = document.all && !onWindows && getExplorerVersion() == 4.5; 738 var par = img; 739 var lastOffset = 0; 740 while(par){ 741 if( par.leftMargin && ! onWindows ) x += parseInt(par.leftMargin);
742 if( (par.offsetLeft != lastOffset) && par.offsetLeft ) x += parseInt(par.offsetLeft); 743 if( par.offsetLeft != 0 ) lastOffset = par.offsetLeft; 744 par = macIE45 ? par.parentElement : par.offsetParent; 745 } 746 } else if (img.x) x += img.x; 747 return x; 748} 749 750function moveYbySlicePos (y, img) { 751 if(!document.layers) { 752 var onWindows = navigator.platform ? navigator.platform == "Win32" : false; 753 var macIE45 = document.all && !onWindows && getExplorerVersion() == 4.5; 754 var par = img; 755 var lastOffset = 0; 756 while(par){ 757 if( par.topMargin && !onWindows ) y += parseInt(par.topMargin); 758 if( (par.offsetTop != lastOffset) && par.offsetTop ) y += parseInt(par.offsetTop); 759 if( par.offsetTop != 0 ) lastOffset = par.offsetTop; 760 par = macIE45 ? par.parentElement : par.offsetParent; 761 } 762 } else if (img.y >= 0) y += img.y; 763 return y; 764} 765
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.