1 2 3var usrAgent = navigator.userAgent.toUpperCase( ) ; 4 5var WIN = ( usrAgent.indexOf("WIN") != -1 ) ? true : false ; 6var MAC = ( usrAgent.indexOf("MAC") != -1 ) ? true : false ; 7 8var NN4 = ( document.layers ? true : false ) ; 9var NN6 = ( document.getElementById && !document.all ? true : false ) ; 10var IE4 = ( document.all && !document.getElementById ? true : false ) ; 11var IE5 = ( document.all && document.getElementById ? true : false ) ; 12 13var myCreateLayer = 0 ; 14 15 16 17// JS 18function setJsLink( which, URL ) 19{ 20 eval( which ).location = URL ; 21} 22 23// HTML 24function setHyperLink( linkName, which, URL ) 25{ 26 document.links[ linkName ].target = which ; 27 document.links[ linkName ].href = URL ; 28} 29 30 31 32function getDivImage( layerObj,imgName ) 33{ 34 if ( NN4 ) 35 { 36 return layerObj.document.images[ imgName ] ; 37 } 38 else 39 { 40 return document.images[ imgName ] ; 41 } 42} 43 44 45 46function refLayer( layerName, d ) 47{ 48 var i,x; 49 50 if( !d ) 51 { 52 d = document ; 53 } 54 55 if ( IE5 || NN6 ) 56 { 57 x = d.getElementById( layerName ) ; 58 } 59 else if ( IE4 ) 60 { 61 x = d.all[ layerName ] ; 62 } 63 else if ( NN4 ) 64 { 65 x = d[ layerName ] ; 66 67 for( i=0; !x && i<d.layers.length; i++ ) 68 { 69 x = refLayer( layerName, d.layers[i].document ) ; 70 } 71 } 72 73 return x; 74} 75 76 77 78function createLayer( left, top, width, height, parentDiv ) 79{ 80 var s = '' ; 81 if ( arguments.length>5 ) 82 { 83 for ( var i=5; i<arguments.length; i++ ) 84 { 85 s += arguments[ i ] ; 86 } 87 } 88 if ( NN6 ) 89 { 90 var divName = '_js_layer_'+myCreateLayer ; 91 myCreateLayer++ ; 92 93 var pDiv = parentDiv?parentDiv:document.body ; 94 var div = document.createElement( 'DIV' ) ; 95 div.id = divName ; 96 div.setAttribute( 'style', 'position:absolute;left:'+left+';top:'+top+(width >0?(';width:' +width ):'')+(height>0?(';height:'+height):'')+';visibility:hidden') ; 97 98 var range = document.createRange( ) ; 99 range.selectNodeContents( div ) ; 100 range.collapse( true ) ; 101 var cf = range.createContextualFragment( s ) ; 102 div.appendChild( cf ) ; 103 pDiv.appendChild( div ) ; 104 return div ; 105 } 106 if ( IE4 || IE5 ) 107 { 108 var adj = ( _mac && !IE5 ) ? ' ' : '' ; 109 var divName = '_js_layer_'+myCreateLayer ; 110 myCreateLayer++ ; 111 112 var ha = ( height > 0 ) ? (';height:'+height) : '' ; 113 var pDiv = parentDiv ? parentDiv : document.body ; 114 pDiv.insertAdjacentHTML( 'BeforeEnd' , 115 '<div id="'+divName+'" style="position:absolute;left:'+left+';top:'+top 116 +(width >0?(';width:' +width ):';width:1')+(height>0?(';height:'+height):'') 117 +';visibility:hidden;">'+s+'<\/div>'+adj); 118 return document.all( divName ) ; 119 } 120 if( NN4 ) 121 { 122 var div = parentDiv ? (new Layer(width,parentDiv)) : (new Layer(width)) ; 123 if ( height > 0 ) 124 { 125 div.resizeTo( width, height ) ; 126 } 127 div.moveTo( left, top ) ; 128 129 if( s != '' ) 130 { 131 div.document.open( 'text/html', 'replace' ) ; 132 div.document.write( s ) ; 133 div.document.close( ) ; 134 } 135 return div ; 136 } 137 138 return null; 139} 140 141function createIFrame( url, left, top, width, height, parentDiv ) 142{ 143 if ( NN6 ) 144 { 145 var divName = '_js_layer_'+myCreateLayer ; 146 myCreateLayer++ ; 147 var pDiv = parentDiv?parentDiv:document.body ; 148 var div = document.createElement('IFRAME') ; 149 div.id = divName ; 150 div.name = divName ; 151 div.setAttribute('style', 152 'position:absolute;left:'+left+';top:'+top 153 +';width:'+width+(height>0?(';height:'+height):'') 154 +';visibility:hidden') ; 155 div.setAttribute('src',url) ; 156 div.setAttribute('frameborder',0) ; 157 div.setAttribute('scrolling','auto') ; 158 pDiv.appendChild( div ) ; 159 160 return div ; 161 } 162 if ( IE4 || IE5 ) 163 { 164 var adj=( MAC && IE5 )?' ':''; 165 var bd, divName='_js_layer_'+myCreateLayer ; 166 myCreateLayer++ ; 167 var ha=(height>0)?(';height:'+height+ 'px'):';' ; 168 if (arguments.length>5 && parentDiv) 169 { 170 bd=parentDiv ; 171 } 172 else 173 { 174 bd=document.body ; 175 } 176 bd.insertAdjacentHTML('BeforeEnd', 177 '<div id="'+divName 178 +'" style="position:absolute;left:'+left+'px;top:'+top 179 +'px;width:'+width+'px'+ha+';visibility:visible;">' 180 +'<iframe src="'+url+'" id="'+divName+'_if" ' 181 +'width='+width+' height='+height 182 +' marginwidth=0 marginheight=0 ' 183 +'scrolling="no" frameborder="no">' 184 +'<\/iframe>' 185 +'<\/div>'+adj) ; 186 return document.all(divName) ; 187 } 188 if ( NN4 ) 189 { 190 var div=parentDiv ? (new Layer(width,parentDiv)) : (new Layer(width)) ; 191 if(height>0) div.resizeTo(width,height) ; 192 div.moveTo(left,top) ;
193 div.load(url,width) ; 194 return div ; 195 } 196 return null ; 197} 198 199 200 201function initLayer( layerObj ) 202{ 203 if ( NN6 ) 204 { 205 layerObj.style.width = layerObj.offsetWidth ; 206 layerObj.style.height = layerObj.offsetHeight ; 207 } 208 else if( IE4 || IE5 ) 209 { 210 layerObj.style.pixelLeft = layerObj.offsetLeft ; 211 layerObj.style.pixelTop = layerObj.offsetTop ; 212 layerObj.style.pixelWidth = layerObj.offsetWidth ; 213 layerObj.style.pixelHeight = layerObj.offsetHeight ; 214 } 215} 216 217 218 219function setZindex( layerObj, zOrder ) 220{ 221 if ( NN4 ) 222 { 223 layerObj.zIndex = zOrder ; 224 } 225 else 226 { 227 layerObj.style.zIndex = zOrder ; 228 } 229} 230 231 232 233function getZindex( layerObj ) 234{ 235 if ( NN4 ) 236 { 237 return layerObj.zIndex; 238 } 239 else 240 { 241 return layerObj.style.zIndex ; 242 } 243} 244 245 246 247function getLayerVisibility( layerObj ) 248{ 249 if ( NN4 ) 250 { 251 return ( layerObj.visibility == "show" ) ; 252 } 253 else 254 { 255 return ( layerObj.style.visibility == "visible" ) ; 256 } 257} 258 259function hideLayer( layerObj ) 260{ 261 if (layerObj) { 262 if ( NN4 ) 263 { 264 layerObj.visibility = "hide" ; 265 } 266 else 267 { 268 layerObj.style.visibility = "hidden" ; 269 } 270 } 271} 272 273function showLayer( layerObj ) 274{ 275 if (layerObj) { 276 if ( NN4 ) 277 { 278 layerObj.visibility = "show" ; 279 } 280 else 281 { 282 layerObj.style.visibility = "visible" ; 283 } 284 } 285} 286 287 288 289function shiftLayerTo( layerObj, x, y ) 290{ 291 if (layerObj) { 292 if ( NN4 ) 293 { 294 layerObj.moveTo( x, y ) ; 295 } 296 else if ( NN6 ) 297 { 298 layerObj.style.left = x + 'px' ; 299 layerObj.style.top = y + 'px' ; 300 } 301 else 302 { 303 layerObj.style.pixelLeft = x ; 304 layerObj.style.pixelTop = y ; 305 } 306 } 307} 308 309function shiftLayerBy( layerObj, x, y ) 310{ 311 if ( NN4 ) 312 { 313 layerObj.moveBy( x, y ) ; 314 } 315 else if ( NN6 ) 316 { 317 layerObj.style.left = ( getLayerPosition( layerObj, 'left' ) + x ) + 'px' ; 318 layerObj.style.top = ( getLayerPosition( layerObj, 'top' ) + y ) + 'px' ; 319 } 320 else if ( IE4 || (MAC && IE5) ) 321 { 322 layerObj.style.pixelLeft += x ; 323 layerObj.style.pixelTop += y ; 324 } 325 else 326 { 327 layerObj.style.pixelLeft = layerObj.offsetLeft + x ; 328 layerObj.style.pixelTop = layerObj.offsetTop + y ; 329 } 330} 331 332 333 334function resizeLayerTo( layerObj, width, height ) 335{ 336 if ( NN4 ) 337 { 338 layerObj.resizeTo( width, height ) ; 339 } 340 else if ( NN6 ) 341 { 342 layerObj.style.width = width ; 343 layerObj.style.height = height ; 344 } 345 else 346 { 347 layerObj.style.pixelWidth = width ; 348 layerObj.style.pixelHeight = height ; 349 } 350} 351 352 353 354function getLayerSize( layerObj, value ) 355{ 356 if( value == "width" ) 357 { 358 if ( NN4 ) 359 { 360 return layerObj.document.width ; 361 } 362 else if ( NN6 ) 363 { 364 return parseInt( layerObj.style.width ) ; 365 } 366 else if ( IE4 ) 367 { 368 return layerObj.style.pixelWidth ; 369 } 370 else 371 { 372 return layerObj.offsetWidth ; 373 } 374 } 375 if( value == "height" ) 376 { 377 if ( NN4 ) 378 { 379 return layerObj.document.height ; 380 } 381 else if ( NN6 ) 382 { 383 return parseInt( layerObj.style.height ) ; 384 } 385 else if ( IE4 ) 386 { 387 return layerObj.style.pixelHeight ; 388 } 389 else 390 { 391 return layerObj.offsetHeight ; 392 } 393 } 394} 395 396 397 398function getLayerPosition( layerObj, value ) 399{ 400 if( value == "top" ) 401 { 402 if ( NN4 ) 403 { 404 return layerObj.top ; 405 } 406 else if ( NN6 ) 407 { 408 return parseInt( layerObj.style.top ) ; 409 } 410 else if ( IE4 ) 411 { 412 return layerObj.style.pixelTop ; 413 } 414 else 415 { 416 return layerObj.offsetTop ; 417 } 418 } 419 if( value == "right" ) 420 { 421 if ( NN4 ) 422 { 423 return layerObj.left + getLayerSize( layerObj, "width" ) ; 424 } 425 else if ( NN6 ) 426 { 427 return parseInt( layerObj.style.left + getLayerSize( layerObj, "width" ) ) ; 428 } 429 else if ( IE4 ) 430 { 431 return layerObj.style.pixelLeft + getLayerSize( layerObj, "width" ) ; 432 } 433 else 434 { 435 return layerObj.offsetLeft + getLayerSize( layerObj, "width" ) ; 436 } 437 } 438 if( value == "bottom" ) 439 { 440 if ( NN4 ) 441 { 442 return layerObj.top + getLayerSize( layerObj, "height" ) ; 443 } 444 else if ( NN6 ) 445 { 446 return parseInt( layerObj.style.top + getLayerSize( layerObj, "height" ) ) ; 447 } 448 else if ( IE4 ) 449 { 450 return layerObj.style.pixelTop + getLayerSize( layerObj, "height" ) ; 451 } 452 else 453 { 454 return layerObj.offsetTop + getLayerSize( layerObj, "height" ) ; 455 } 456 } 457 if( value == "left" ) 458 { 459 if ( NN4 ) 460 { 461 return layerObj.left ; 462 } 463 else if ( NN6 ) 464 { 465 return parseInt( layerObj.style.left ) ; 466 } 467 else if ( IE4 ) 468 { 469 return layerObj.style.pixelLeft ; 470 } 471 else 472 { 473 return layerObj.offsetLeft ; 474 } 475 } 476} 477 478 479 480function getEventX( evt ) 481{ 482 if ( NN4 ) 483 { 484 return evt.pageX ; 485 } 486 else if ( NN6 ) 487 { 488 return ( window.scrollX + evt.clientX ) ; 489 } 490 else if ( IE4 || IE5 ) 491 { 492 return ( document.body.scrollLeft + event.clientX ) ; 493 } 494} 495 496function getEventY( evt ) 497{ 498 if ( NN4 || NN6 ) 499 { 500 return evt.pageY ; 501 } 502 else if ( IE4 || IE5 ) 503 { 504 return ( document.body.scrollTop + event.clientY ) ; 505 } 506} 507 508 509 510function getCenterSize( layerObj, which ) 511{ 512 return ( getWinSize( which ) - getLayerSize( layerObj, which ) ) / 2 ; 513} 514 515 516 517function replaceContent( layerObj, txt ) 518{ 519 if ( NN4 ) 520 { 521 layerObj.document.open( "text/html" ) ; 522 layerObj.document.write( txt ) ; 523 layerObj.document.close( ) ; 524 } 525 else 526 { 527 layerObj.innerHTML = txt ; 528 } 529} 530 531 532 533function getPageOffset( which ) 534{ 535 if ( which == "left" ) 536 { 537 if ( NN4 ) 538 { 539 return self.pageXOffset ; 540 } 541 else if ( NN6 ) 542 { 543 return window.scrollX ; 544 } 545 else 546 { 547 return document.body.scrollLeft ; 548 } 549 } 550 if ( which == "top" ) 551 { 552 if ( NN4 ) 553 { 554 return self.pageYOffset ; 555 } 556 else if ( NN6 ) 557 { 558 return window.scrollY ; 559 } 560 else 561 { 562 return document.body.scrollTop ; 563 } 564 } 565} 566 567 568 569function getClipValue( layerObj, value ) 570{ 571 if( IE4 || IE5 || NN6 ) 572 { 573 var cp = layerObj.style.clip.split(" ") ; 574 cp[0] = cp[0].slice(5) ; 575 576 switch ( value ) 577 { 578 case "top" : 579 return parseInt( cp[0] ) ; 580 case "right" : 581 return parseInt( cp[1] ) ; 582 case "bottom" : 583 return parseInt( cp[2] ) ; 584 case "left" : 585 return parseInt( cp[3] ) ; 586 } 587 } 588 else 589 { 590 switch ( value ) 591 { 592 case "top" : 593 return ( layerObj.clip.top ) ; 594 case "right" : 595 return ( layerObj.clip.right ) ; 596 case "bottom" : 597 return ( layerObj.clip.bottom ) ; 598 case "left" : 599 return ( layerObj.clip.left ) ; 600 } 601 } 602} 603 604function clipLayerTo( layerObj, t, r, b, l ) 605{ 606 if ( NN4 ) 607 { 608 layerObj.clip.top = t ; 609 layerObj.clip.right = r ; 610 layerObj.clip.bottom = b ; 611 layerObj.clip.left = l ; 612 } 613 else 614 { 615 layerObj.style.clip = "rect("+t+" "+r+" "+b+" "+l+")" ; 616 } 617} 618 619function clipLayerBy( layerObj, t, r, b, l ) 620{ 621 var nextClipValue_top = getClipValue( layerObj,'top' ) + t ; 622 var nextClipValue_right = getClipValue( layerObj,'right' ) + r ; 623 var nextClipValue_bottom = getClipValue( layerObj,'bottom') + b ; 624 var nextClipValue_left = getClipValue( layerObj,'left' ) + l ; 625 626 if ( NN4 ) 627 { 628 layerObj.clip.top = nextClipValue_top ; 629 layerObj.clip.right = nextClipValue_right ; 630 layerObj.clip.bottom = nextClipValue_bottom ; 631 layerObj.clip.left = nextClipValue_left ; 632 } 633 else 634 { 635 layerObj.style.clip = "rect("+ nextClipValue_top + "px " 636 + nextClipValue_right + "px " 637 + nextClipValue_bottom + "px " 638 + nextClipValue_left + "px)" ; 639 } 640} 641 642 643 644function getWinSize( which ) 645{ 646 if ( which == "width" ) 647 { 648 if ( NN4 || NN6 ) 649 { 650 return window.innerWidth ; 651 } 652 else 653 { 654 return document.body.clientWidth ; 655 } 656 } 657 if ( which == "height" ) 658 { 659 if ( NN4 || NN6 ) 660 { 661 return window.innerHeight ; 662 } 663 else 664 { 665 return document.body.clientHeight ; 666 } 667 } 668} 669 670 671 672function openWin( url, w, h, winName ) 673{
674 var startWinX = ( screen.availWidth - w ) / 2 ; 675 var startWinY = ( screen.availHeight - h ) / 2 ; 676 677 if ( arguments[4] == "no" ) 678 winOption = "directories=no,status=no,scrollbars=no,toolbar=no,location=no,menubar=no,resizable=yes,width=" + w + ",height=" + h + ",left=" + startWinX + ",top=" + startWinY ; 679 680 if ( arguments[4] == "yes" ) 681 winOption = "directories=yes,status=yes,scrollbars=yes,toolbar=yes,location=yes,menubar=yes,resizable=yes,width=" + w + ",height=" + h + ",left=" + startWinX + ",top=" + startWinY ; 682 683 winName = window.open( url, winName, winOption ) ; 684 winName.focus( ) ; 685} 686 687 688 689function delayWin( url, winOption ) 690{ 691 var submenu = window.open ( url, "subwin", winOption ) ; 692 693 if ( closetime ) 694 setTimeout("submenu.close( );", closetime * 1000 ) ; 695} 696 697function openSubWin( url,w,h,st,sc,t,l,m,r,x,y,ct,delay ) 698{ 699 closetime = ct ; 700 701 var winOption = "status=" + st + ",toolbar=" + t + ",location=" + l + ",menubar=" + m + ",scrollbars=" + sc + ",resizable=" + r + ",left=" + x + ",top=" + y + ",width=" + w + ",height=" + h ; 702 703 setTimeout("delayWin( '" +url+ "','" +winOption+ "' )", delay * 1000 ); 704} 705 706 707 708 709 710function intToHex( Integer ) 711{ 712 var hexValue = Integer.toString( 16 ) ; 713 714 if ( hexValue.length == 1 ) hexValue = "0"+hexValue ; 715 716 return hexValue ; 717} 718 719function hexToInt( hex ) 720{ 721 return parseInt( hex, 16 ) ; 722} 723 724 725 726 727 728function viewSource( fileName ) 729{ 730 var file = ( fileName ) ? fileName : location.href ; 731 var filePath = 'view-source:' + file ; 732 733 location.href = filePath ; 734} 735 736 737 738 739
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.