1<!-- 2 3//Doka addon here for height set because this splitter bar overrides onresize event needed for proper heigh adjustment. 4 5function findPos(obj) 6{ 7 var curleft = curtop = 0; 8 if (obj.offsetParent) 9 { 10 do 11 { 12 curleft += obj.offsetLeft; 13 curtop += obj.offsetTop; 14 } while (obj = obj.offsetParent); 15 } 16 return [curleft,curtop]; 17} 18 19 20function SetMS() 21{ 22 var gfooterDiv = document.getElementById('footerDiv'); 23 var gdataDiv = document.getElementById('dataDiv'); 24 var gmenDiv = document.getElementById('menDiv'); 25 26 var gmenDivTop = findPos(gdataDiv)[1]; 27 28 var th = window.innerHeight; 29 30 var dSize = (th - (gmenDivTop + gfooterDiv.offsetHeight + 0)); 31 if (dSize < 20) 32 dSize = 20; 33 34 gdataDiv.style.height = dSize + 'px'; 35 36 if (gmenDiv != null && gmenDiv != 'undefined') 37 gmenDiv.style.height = dSize + 'px'; 38} 39 40/////save and read cookies 41//function writeCookie(name,value,days) 42//{ 43// if (days) 44// { 45// var date = new Date(); 46// date.setTime(date.getTime()+(days*24*60*60*1000)); 47// var expires = "; expires="+date.toGMTString(); 48// } 49// else var expires = ""; 50// document.cookie = name+"="+value+expires+"; path=/"; 51//} 52 53//function readCookie(name) 54//{ 55// var nameEQ = name + "="; 56// var ca = document.cookie.split(';'); 57// for(var i=0;i < ca.length;i++) 58// { 59// var c = ca[i]; 60// while (c.charAt(0)==' ') 61// c = c.substring(1,c.length); 62// if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); 63// } 64// return null; 65//} 66 67//------------------------------------------------------------------------------ 68// <copyright author="Jeffrey Bazinet" company="VWD-CMS"> 69// Copyright (c) VWD-CMS (http://www.vwd-cms.com/). 70// All rights reserved. 71// </copyright> 72//------------------------------------------------------------------------------ 73 74// define the array of VwdCmsSplitterBars on the page 75var _vwdCmsSplitterBars = new Array(); 76var _activeSplitterBar = null; 77var _isIE = (document.all) ? true : false; 78 79var prevOnResize = null; 80 81// define the VwdCmsSplitterBar "class" 82function VwdCmsSplitterBar(splitter) 83{ 84 this.id = splitter.id; 85 this.orientation = "vertical"; 86 this.debugElementId = ""; 87 this.debug = null; 88 this.primaryResizeTarget = null; 89 this.liveResize = false; 90 this.splitterBar = splitter; 91 92 this.leftResizeTargetIds = ""; // semi-colon delimited list of ids 93 this.rightResizeTargetIds = ""; // semi-colon delimited list of ids 94 this.leftResizeTargets = null; // array of target elements 95 this.rightResizeTargets = null; // array of target elements 96 this.offsetLeft = new Number(0); 97 this.maxWidth = new Number(0); 98 this.minWidth = new Number(0); 99 this.totalWidth = new Number(0); 100 this.saveWidthToElement = null; 101 this.splitterWidth = new Number(6); 102 this.hdnWidth = document.getElementById(splitter.id + "_hdnWidth"); 103 this.hdnMinWidth = document.getElementById(splitter.id + "_hdnMinWidth"); 104 this.hdnMaxWidth = document.getElementById(splitter.id + "_hdnMaxWidth"); 105 106 this.topResizeTargetIds = ""; // semi-colon delimited list of ids 107 this.bottomResizeTargetIds = ""; // semi-colon delimited list of ids 108 this.topResizeTargets = null; // array of target elements 109 this.bottomResizeTargets = null; // array of target elements 110 this.offsetTop = new Number(0); 111 this.maxHeight = new Number(0); 112 this.minHeight = new Number(0); 113 this.totalHeight = new Number(0); 114 this.saveHeightToElement = null; 115 this.splitterHeight = new Number(6); 116 this.hdnHeight = document.getElementById(splitter.id + "_hdnHeight"); 117 this.hdnMinHeight = document.getElementById(splitter.id + "_hdnMinHeight"); 118 this.hdnMaxHeight = document.getElementById(splitter.id + "_hdnMaxHeight"); 119 120 this.isResizing = false; 121 this.backgroundColor = "lightsteelblue"; 122 this.backgroundColorHilite = "lightsteelblue"; 123 this.backgroundColorResizing = "lightsteelblue"; 124 this.backgroundColorLimit = "firebrick"; 125 126 this.onResizeStart = null; // ( onmousedown, resizing starting ) 127 //this.onResize = null; // ( dynamic resizing, resizing complete) 128 this.onResizeComplete = null; // ( onmouseup, resizing complete) 129 130 this.onDoubleClick = null; 131 this.iframeHiding = "UseVisibility"; 132 this.iframes = null; 133 this.iframeStates = null; 134 this.namingContainerId = ""; 135
136 ///next added for persistent width support 137 this.persistCookieKey = null; 138 this.initialized = false; 139 if (typeof(CookieToSaveWidth)!="undefined" && CookieToSaveWidth != null) 140 { 141 this.persistCookieKey = CookieToSaveWidth; 142 } 143 144 145} 146 147// define the "instance" methods 148VwdCmsSplitterBar.prototype.SetBackgroundColor = VwdCmsSplitterBar_SetBackgroundColor; 149VwdCmsSplitterBar.prototype.configure = VwdCmsSplitterBar_configure; 150VwdCmsSplitterBar.prototype.show = VwdCmsSplitterBar_show; 151VwdCmsSplitterBar.prototype.hide = VwdCmsSplitterBar_hide; 152VwdCmsSplitterBar.prototype.setTargetWidth = VwdCmsSplitterBar_setTargetWidth; 153VwdCmsSplitterBar.prototype.setTargetHeight = VwdCmsSplitterBar_setTargetHeight; 154VwdCmsSplitterBar.prototype.drag = VwdCmsSplitterBar_drag; 155VwdCmsSplitterBar.prototype.onmousedown = VwdCmsSplitterBar_onmousedown; 156VwdCmsSplitterBar.prototype.onmouseup = VwdCmsSplitterBar_onmouseup; 157VwdCmsSplitterBar.prototype.ondblclick = VwdCmsSplitterBar_ondblclick; 158VwdCmsSplitterBar.prototype.showIFrames = VwdCmsSplitterBar_showIFrames; 159VwdCmsSplitterBar.prototype.hideIFrames = VwdCmsSplitterBar_hideIFrames; 160 161// define the "static" methods 162VwdCmsSplitterBar.createNew = VwdCmsSplitterBar_createNew; 163VwdCmsSplitterBar.getById = VwdCmsSplitterBar_getById; 164VwdCmsSplitterBar.getCurrent = VwdCmsSplitterBar_getCurrent; 165VwdCmsSplitterBar.reconfigure = VwdCmsSplitterBar_reconfigure; 166VwdCmsSplitterBar.setLiveResize = VwdCmsSplitterBar_setLiveResize; 167VwdCmsSplitterBar.setDebug = VwdCmsSplitterBar_setDebug; 168 169// create the property set for backgroundColor 170function VwdCmsSplitterBar_SetBackgroundColor(value) 171{ 172 this.backgroundColor = value; 173 this.splitterBar.style.backgroundColor = value; 174} 175 176// create the createNew static method 177function VwdCmsSplitterBar_createNew(splitterId) 178{ 179 var splitter = document.getElementById(splitterId); 180 var sbar = new VwdCmsSplitterBar(splitter); 181 _vwdCmsSplitterBars[_vwdCmsSplitterBars.length] = sbar; 182 return sbar; 183} 184 185// create the getById static method 186function VwdCmsSplitterBar_getById(id) 187{ 188 var sbar = null; 189 var sbarId = id; 190 for ( var i = 0; i < _vwdCmsSplitterBars.length; i++ ) 191 { 192 sbar = _vwdCmsSplitterBars[i]; 193 if ( sbar.id == sbarId ) 194 { 195 break; 196 } 197 } 198 return sbar; 199} 200 201// create the getCurrent static method 202function VwdCmsSplitterBar_getCurrent() 203{ 204 return _activeSplitterBar; 205} 206 207// create the reinitialize static method 208function VwdCmsSplitterBar_reconfigure() 209{ 210 211 for ( var i = 0; i < _vwdCmsSplitterBars.length; i++ ) 212 { 213 _vwdCmsSplitterBars[i].configure(); 214 } 215 //SetMS(); 216 217 ///call old onResize 218} 219 220// create the setLiveResize static method 221function VwdCmsSplitterBar_setLiveResize(setting) 222{ 223 for ( var i = 0; i < _vwdCmsSplitterBars.length; i++ ) 224 { 225 _vwdCmsSplitterBars[i].liveResize = setting; 226 } 227} 228 229// create the setDebug static method 230function VwdCmsSplitterBar_setDebug(debugId, namingContainerId) 231{ 232 var txt = null; 233 if ( debugId ) 234 { 235 txt = document.getElementById(namingContainerId + debugId); 236 if ( txt == null ) 237 { 238 txt = document.getElementById(debugId); 239 } 240 } 241 for ( var i = 0; i < _vwdCmsSplitterBars.length; i++ ) 242 { 243 _vwdCmsSplitterBars[i].debug = txt; 244 } 245} 246
247// create the initialize method 248function VwdCmsSplitterBar_configure() 249{ 250 // the purpose of the configure method is to setup initial 251 // properties on the splitterbar as well as calculate some 252 // important values rather than calculating them over and 253 // over again in methods like 'drag', 'onmousedown', 254 // 'onmouseup', and 'setTargetWidth' - the less work 255 // we have to do inside these methods, the better the UI 256 // performance will be for the user. 257 var sbar = null; 258 if ( this.splitterBar ) 259 { 260 sbar = this; 261 } 262 else 263 { 264 sbar = VwdCmsSplitterBar.getById(this.id); 265 } 266 267 if ( sbar ) 268 { 269 // setup the debug element, expecting an ID for a textarea element 270 if ( sbar.debugElementId ) 271 { 272 var dbg = document.getElementById(sbar.namingContainerId + sbar.debugElementId); 273 if ( dbg == null ) 274 { 275 dbg = document.getElementById(sbar.debugElementId); 276 } 277 sbar.debug = dbg; 278 } 279 if ( sbar.debug ) 280 { 281 sbar.debug.value = "configuring '" + sbar.id + "'\r\n" + sbar.debug.value; 282 } 283 284 // setup the splitterBar control 285 var splitter = sbar.splitterBar; 286 287 var target = null; 288 if(sbar.orientation == "vertical") 289 { 290 // get the left resize target elements from the Ids 291 sbar.leftResizeTargets = getTargets(sbar.leftResizeTargetIds, sbar.namingContainerId); 292 293 // get the right resize target elements from the Ids 294 sbar.rightResizeTargets = getTargets(sbar.rightResizeTargetIds, sbar.namingContainerId); 295 296 // get the primary resize target element (first one in leftResizeTargets) 297 if ( sbar.leftResizeTargets && sbar.leftResizeTargets.length > 0 ) 298 { 299 target = sbar.leftResizeTargets[0]; 300 sbar.primaryResizeTarget = target; 301 } 302 } 303 else // horizontal 304 { 305 // get the top resize target elements from the Ids 306 sbar.topResizeTargets = getTargets(sbar.topResizeTargetIds, sbar.namingContainerId); 307 308 // get the bottom resize target elements from the Ids 309 sbar.bottomResizeTargets = getTargets(sbar.bottomResizeTargetIds, sbar.namingContainerId); 310 311 // get the primary resize target element (first one in topResizeTargets) 312 if ( sbar.topResizeTargets && sbar.topResizeTargets.length > 0 ) 313 { 314 target = sbar.topResizeTargets[0]; 315 sbar.primaryResizeTarget = target; 316 } 317 } 318 319 if ( splitter && target ) 320 { 321 splitter.style.margin = "0px"; 322 splitter.style.padding = "0px"; 323 324 splitter.onmousedown = sbar.onmousedown; 325 splitter.onmouseup = sbar.onmouseup; 326 splitter.onmouseover = sbar.show; 327 splitter.onmouseout = sbar.hide; 328 329 if ( sbar.onDoubleClick != null ) 330 { 331 splitter.ondblclick = sbar.onDoubleClick; 332 } 333 else 334 { 335 splitter.ondblclick = sbar.ondblclick; 336 } 337 338 splitter.style.backgroundColor = sbar.backgroundColor; 339 splitter.style.position = "absolute"; 340 splitter.style.zIndex = 0; 341 if(sbar.orientation == "vertical") 342 { 343 //splitter.style.cursor = "e-resize"; 344 splitter.style.cursor = "col-resize"; 345 splitter.style.width = sbar.splitterWidth + "px"; 346 347 // determine the min and max widths 348 var op = target.offsetParent; 349 if ( sbar.maxWidth == 0 ) 350 { 351 sbar.maxWidth = getInt(op.offsetWidth); 352 sbar.maxWidth -= sbar.splitterWidth; 353 sbar.maxWidth -= getInt(op.style.borderLeftWidth); 354 sbar.maxWidth -= getInt(op.style.borderRightWidth); 355 sbar.maxWidth -= getInt(splitter.style.borderLeftWidth); 356 sbar.maxWidth -= getInt(splitter.style.borderRightWidth); 357 } 358 359 ////// get width from cookie 360 if(!sbar.initialized && sbar.persistCookieKey) 361 { 362 var width = getInt(readCookie(sbar.persistCookieKey)); 363 if(width > 0) 364 { 365 width = getInt(width); 366 sbar.hdnWidth.value = width; 367 sbar.primaryResizeTarget.style.width = width + "px"; 368 } 369 sbar.initialized = true; 370 } 371 372 // set the top location of the SplitterBar 373 var top = getOffsetTop(target); 374 splitter.style.top = top + "px"; 375 376 // set the left location of the SplitterBar 377 var offsetLeft = getOffsetLeft(target); 378 sbar.offsetLeft = offsetLeft; 379 380 var left = offsetLeft; 381 left += getInt(target.offsetWidth);
382 splitter.style.left = left + "px"; 383 384 // set the height of the SplitterBar 385 var height = getInt(target.clientHeight); 386 height += getInt(target.style.borderTopWidth); 387 height += getInt(target.style.borderBottomWidth); 388 splitter.style.height = height + "px"; 389 } 390 else // horizontal 391 { 392 splitter.style.cursor = "n-resize"; 393 splitter.style.height = sbar.splitterHeight + "px"; 394 395 // determine the min and max heights 396 var op = target.offsetParent; 397 if ( sbar.maxHeight == 0 ) 398 { 399 sbar.maxHeight = getInt(op.offsetHeight); 400 sbar.maxHeight -= sbar.splitterHeight; 401 sbar.maxHeight -= getInt(op.style.borderTopWidth); 402 sbar.maxHeight -= getInt(op.style.borderBottomWidth); 403 sbar.maxHeight -= getInt(splitter.style.borderTopWidth); 404 sbar.maxHeight -= getInt(splitter.style.borderBottomWidth); 405 } 406 407 // set the left location of the SplitterBar 408 var left = getOffsetLeft(target); 409 splitter.style.left = left + "px"; 410 411 // set the top location of the SplitterBar 412 var offsetTop = getOffsetTop(target); 413 sbar.offsetTop = offsetTop; 414 415 var top = offsetTop; 416 top += getInt(target.offsetHeight); 417 splitter.style.top = top + "px"; 418 419 // set the width of the SplitterBar 420 var width = getInt(target.clientWidth); 421 width += getInt(target.style.borderLeftWidth); 422 width += getInt(target.style.borderRightWidth); 423 splitter.style.width = width + "px"; 424 } 425 426 // output to the debug window 427 if ( sbar.debug ) 428 { 429 sbar.debug.value = sbar.id + ".splitterBar.style.top='" 430 + splitter.style.top + "'\r\n" + sbar.debug.value; 431 sbar.debug.value = sbar.id + ".offsetLeft='" 432 + sbar.offsetLeft + "'\r\n" + sbar.debug.value; 433 sbar.debug.value = sbar.id + ".splitterBar.style.left='" 434 + splitter.style.left + "'\r\n" + sbar.debug.value; 435 sbar.debug.value = sbar.id + ".splitterBar.style.height='" 436 + splitter.style.height + "'\r\n" + sbar.debug.value; 437 } 438 439 // handle window resizing 440 // this is problematic in Firefox because the event 441 // does not fire until the resizing is complete, so 442 // if the SplitterBar's backcolor is not set to Transparent, 443 // it will display in the wrong location while the resizing 444 // is happening. 445 //prevOnResize = window.onresize; 446 //prevOnResize(); 447 window.onresize = VwdCmsSplitterBar.reconfigure; 448 } 449 450 } 451} 452 453// create the show method 454function VwdCmsSplitterBar_show() 455{ 456 var sbar = VwdCmsSplitterBar.getById(this.id); 457 if (sbar && !sbar.isResizing) 458 { 459 sbar.splitterBar.style.backgroundColor=sbar.backgroundColorHilite; 460 } 461} 462 463// create the hide method 464function VwdCmsSplitterBar_hide() 465{ 466 var sbar = VwdCmsSplitterBar.getById(this.id); 467 if (sbar && !sbar.isResizing) 468 { 469 sbar.splitterBar.style.backgroundColor=sbar.backgroundColor; 470 } 471} 472 473// create the setTargetWidth method 474function VwdCmsSplitterBar_setTargetWidth(sbar) 475{ 476 if ( sbar == null ) 477 { 478 sbar = VwdCmsSplitterBar.getCurrent(); 479 } 480 if ( sbar ) 481 { 482 var width = 0; 483 // get the primary target ( the first one in LeftResizeTargets) 484 var target = sbar.primaryResizeTarget; // sbar.leftResizeTargets[0]; 485 if ( target ) 486 { 487 // calculate the width based on the splitterbar's location 488 width = getInt(sbar.splitterBar.style.left); 489 width -= getInt(sbar.offsetLeft); 490 width -= getInt(target.style.borderLeftWidth); 491 width -= getInt(target.style.borderRightWidth); 492 // do not set the width to 0, 1 is the minimum 493 if ( width < 1 ) { width = 1; } 494 495 // set the width of the target element 496 target.style.width = width + "px"; 497 498 // set the width value to the hidden field hdnWidth 499 if ( sbar.hdnWidth ) 500 { 501 sbar.hdnWidth.value = width + "px"; 502 } 503 504 // set the width value to the saveWidthToElement 505 if ( sbar.saveWidthToElement ) 506 { 507 var elmWidth = document.getElementById(sbar.namingContainerId + sbar.saveWidthToElement); 508 if ( elmWidth == null ) 509 { 510 elmWidth = document.getElementById(sbar.saveWidthToElement); 511 } 512 if ( elmWidth ) 513 { 514 elmWidth.value = width + "px"; 515 } 516 } 517 518 // output some debugging info 519 if ( sbar.debug ) 520 { 521 sbar.debug.value = sbar.id + ".leftResizeTargets[0].style.width='"
522 + target.style.width + "'\r\n" + sbar.debug.value; 523 } 524 525 // resize any other LeftResizeTarget elements 526 if ( sbar.leftResizeTargets && sbar.leftResizeTargets.length > 1 ) 527 { 528 for (var i = 1; i < sbar.leftResizeTargets.length; i++) 529 { 530 target = sbar.leftResizeTargets[i]; 531 target.style.width = width + "px"; 532 } 533 } 534 535 // resize the RightResizeTarget elements 536 // Note: this calculation requires that the TotalWidth property is 537 // set so we can determine the width of the RightResizeTarget elements 538 if ( sbar.totalWidth > 0 && sbar.rightResizeTargets 539 && sbar.rightResizeTargets.length > 0 ) 540 { 541 width = sbar.totalWidth - width - sbar.splitterWidth; 542 for (var i = 0; i < sbar.rightResizeTargets.length; i++) 543 { 544 target = sbar.rightResizeTargets[i]; 545 target.style.width = width + "px"; 546 } 547 } 548 549 // always reconfigure when not in IE because 550 // we don't get enough resize events 551 if ( !_isIE ) 552 { 553 VwdCmsSplitterBar.reconfigure(); 554 } 555 556 // save width to cookie if needed 557 if(sbar.persistCookieKey) 558 { 559 writeCookie(sbar.persistCookieKey, width, 365); 560 } 561 562 // fire the onResize event 563 if ( sbar.onResize ) 564 { 565 sbar.onResize(sbar, width); 566 } 567 } 568 } 569} 570 571// create the setTargetHeight method 572function VwdCmsSplitterBar_setTargetHeight(sbar) 573{ 574 if ( sbar == null ) 575 { 576 sbar = VwdCmsSplitterBar.getCurrent(); 577 } 578 if ( sbar ) 579 { 580 var height = 0; 581 // get the primary target 582 var target = sbar.primaryResizeTarget; 583 if ( target ) 584 { 585 // calculate the height based on the splitterbar's location 586 height = getInt(sbar.splitterBar.style.top); 587 height -= getInt(sbar.offsetTop); 588 height -= getInt(target.style.borderTopWidth); 589 height -= getInt(target.style.borderBottomWidth); 590 591 // do not set the height to 0, 1 is the minimum 592 if ( height < 1 ) { height = 1; } 593 594 // set the height of the target element 595 target.style.height = height + "px"; 596 597 // set the height value to the hidden field hdnHeight 598 if ( sbar.hdnHeight ) 599 { 600 sbar.hdnHeight.value = height + "px"; 601 } 602 603 // set the height value to the saveHeightToElement 604 if ( sbar.saveHeightToElement ) 605 { 606 var elmHeight = document.getElementById(sbar.namingContainerId + sbar.saveHeightToElement); 607 if ( elmHeight == null ) 608 { 609 elmHeight = document.getElementById(sbar.saveHeightToElement); 610 } 611 if ( elmHeight ) 612 { 613 elmHeight.value = height + "px"; 614 } 615 } 616 617 // output some debugging info 618 if ( sbar.debug ) 619 { 620 sbar.debug.value = sbar.id + ".topResizeTargets[0].style.height='"
621 + target.style.height + "'\r\n" + sbar.debug.value; 622 } 623 624 // resize any other TopResizeTarget elements 625 if ( sbar.topResizeTargets && sbar.topResizeTargets.length > 1 ) 626 { 627 for (var i = 1; i < sbar.topResizeTargets.length; i++) 628 { 629 target = sbar.topResizeTargets[i]; 630 target.style.height = height + "px"; 631 } 632 } 633 634 // resize the BottomResizeTarget elements 635 // Note: this calculation requires that the TotalHeight property is 636 // set so we can determine the height of the BottomResizeTarget elements 637 if ( sbar.totalHeight > 0 && sbar.bottomResizeTargets 638 && sbar.bottomResizeTargets.length > 0 ) 639 { 640 height = sbar.totalHeight - height - sbar.splitterHeight; 641 for (var i = 0; i < sbar.bottomResizeTargets.length; i++) 642 { 643 target = sbar.bottomResizeTargets[i]; 644 target.style.height = height + "px"; 645 } 646 } 647 648 // always reconfigure when not in IE because 649 // we don't get enough resize events 650 if ( !_isIE ) 651 { 652 VwdCmsSplitterBar.reconfigure(); 653 } 654 655 // fire the onResize event 656 if ( sbar.onResize ) 657 { 658 sbar.onResize(sbar, height); 659 } 660 } 661 } 662} 663 664// create the drag method 665function VwdCmsSplitterBar_drag(evnt) 666{ 667 evnt = evnt ? evnt : event; 668 if ( evnt ) 669 { 670 var sbar = VwdCmsSplitterBar.getCurrent(); 671 if ( sbar && sbar.isResizing ) 672 { 673 evnt.cancelBubble = true; 674 evnt.returnValue = false; 675 676 if(sbar.orientation == "vertical") 677 { 678 // get the new location to move the SplitterBar to 679 // from the event object 680 var x = getInt(evnt.pageX ? evnt.pageX : evnt.clientX); 681 682 // adjust for the scrollLeft of the page 683 var scrollLeft = getInt(document.body.scrollLeft); 684 x = x + scrollLeft; 685 if ( sbar.debug ) 686 { 687 sbar.debug.value = sbar.id + " document.body.scrollLeft='" + scrollLeft + "'\r\n" + sbar.debug.value; 688 } 689 690 // adjust for the width of the SplitterBar and 691 // keep the SplitterBar centered on the cursor 692 pixX = sbar.splitterWidth/2; 693 x = x - pixX; 694 695 // determine the min and max allowable locations 696 var minX = getInt(sbar.offsetLeft); 697 minX += getInt(sbar.minWidth); 698 699 var maxX = getInt(sbar.offsetLeft); 700 maxX += getInt(sbar.maxWidth); 701 702 // output some debug info 703 if ( sbar.debug ) 704 { 705 sbar.debug.value = sbar.id + " resizing: minX='" + minX + "'\r\n" + sbar.debug.value; 706 sbar.debug.value = sbar.id + " resizing: maxX='" + maxX + "'\r\n" + sbar.debug.value; 707 sbar.debug.value = sbar.id + " resizing: x='" + x + "'\r\n" + sbar.debug.value; 708 } 709 710 // check to see if this location is allowed, 711 // otherwise, set the Limit color to indicate that the 712 // min or max width has been reached 713 if ( ( minX == 0 || x >= minX ) && ( maxX == 0 || x <= maxX) ) 714 { 715 sbar.splitterBar.style.backgroundColor = sbar.backgroundColorResizing; 716 sbar.splitterBar.style.left = x + "px"; 717 718 if ( sbar.liveResize ) 719 { 720 sbar.setTargetWidth(); 721 } 722 } 723 else 724 { 725 sbar.splitterBar.style.backgroundColor = sbar.backgroundColorLimit; 726 } 727 } 728 else // horizontal 729 { 730 // get the new location to move the SplitterBar to 731 // from the event object 732 var y = getInt(evnt.pageY ? evnt.pageY : evnt.clientY); 733 734 // adjust for the scrollTop of the page 735 var scrollTop = getInt(document.body.scrollTop); 736 y = y + scrollTop; 737 if ( sbar.debug ) 738 { 739 sbar.debug.value = sbar.id + " document.body.scrollTop='" + scrollTop + "'\r\n" + sbar.debug.value; 740 } 741 742 // adjust for the height of the SplitterBar and 743 // keep the SplitterBar centered on the cursor 744 pixY = sbar.splitterHeight/2; 745 y = y - pixY - 2; 746 747 // determine the min and max allowable locations 748 var minY = getInt(sbar.offsetTop); 749 minY += getInt(sbar.minHeight); 750 751 var maxY = getInt(sbar.offsetTop); 752 maxY += getInt(sbar.maxHeight); 753 754 // output some debug info 755 if ( sbar.debug ) 756 { 757 sbar.debug.value = sbar.id + " resizing: minY='" + minY + "'\r\n" + sbar.debug.value; 758 sbar.debug.value = sbar.id + " resizing: maxY='" + maxY + "'\r\n" + sbar.debug.value; 759 sbar.debug.value = sbar.id + " resizing: y='" + y + "'\r\n" + sbar.debug.value; 760 } 761 762 // check to see if this location is allowed, 763 // otherwise, set the Limit color to indicate that the 764 // min or max height has been reached 765 if ( ( minY == 0 || y >= minY ) && ( maxY == 0 || y <= maxY) ) 766 { 767 sbar.splitterBar.style.backgroundColor = sbar.backgroundColorResizing; 768 sbar.splitterBar.style.top = y + "px"; 769 770 if ( sbar.liveResize ) 771 { 772 sbar.setTargetHeight(); 773 } 774 } 775 else 776 { 777 sbar.splitterBar.style.backgroundColor = sbar.backgroundColorLimit; 778 } 779 } 780 781 } 782 } 783} 784 785// create the onmousedown method 786function VwdCmsSplitterBar_onmousedown(evnt) 787{ 788 var sbar = VwdCmsSplitterBar.getById(this.id); 789 if ( sbar ) 790 { 791 // ensure that the splitterbar is at the top of the z-index 792 sbar.splitterBar.style.zIndex = 5000; 793 794 // start resizing 795 _activeSplitterBar = sbar; // set the current/active splitter bar 796 sbar.isResizing = true; 797 sbar.splitterBar.style.backgroundColor = sbar.backgroundColorResizing; 798 799 // hookup the mouse events on the document 800 document.onmousemove = sbar.drag; 801 document.onmouseup = sbar.onmouseup; 802 803 // deal with IFrames 804 sbar.hideIFrames(); 805 806 // fire the onResizeStart event 807 if ( sbar.onResizeStart ) 808 { 809 sbar.onResizeStart(sbar); 810 } 811 812 } 813} 814 815// create the onmouseup method 816function VwdCmsSplitterBar_onmouseup(evnt) 817{ 818 var sbar = VwdCmsSplitterBar.getCurrent(); 819 820 if ( sbar ) 821 { 822 // stop resizing 823 // unhook the mouse events on the document 824 document.onmousemove = null; 825 document.onmouseup = null; 826 827 // set the final width of the target element 828 if(sbar.orientation == "vertical") 829 { 830 sbar.setTargetWidth(); 831 } 832 else // horizontal 833 { 834 sbar.setTargetHeight(); 835 } 836 837 // return the splitterbar to an inactive state 838 sbar.isResizing = false; 839 sbar.splitterBar.style.backgroundColor = sbar.backgroundColor; 840 _activeSplitterBar = null; 841 842 // deal with IFrames 843 sbar.showIFrames(); 844 845 // fire the onResizeComplete event 846 if ( sbar.onResizeComplete ) 847 { 848 if(sbar.orientation == "vertical") 849 { 850 sbar.onResizeComplete(sbar, sbar.primaryResizeTarget.style.width); 851 } 852 else // horizontal 853 { 854 sbar.onResizeComplete(sbar, sbar.primaryResizeTarget.style.height); 855 } 856 } 857 858 } 859} 860 861// create the ondblclick method 862function VwdCmsSplitterBar_ondblclick(evnt) 863{ 864 var splitter = this; //VwdCmsSplitterBar.getCurrent(); 865 var sbar = VwdCmsSplitterBar.getById(splitter.id); 866 867 if ( sbar ) 868 { 869 // fire the onResizeStart event 870 if ( sbar.onResizeStart ) 871 { 872 sbar.onResizeStart(sbar); 873 } 874 875 if(sbar.orientation == "vertical") 876 { 877 // if the SplitterBar is at the MinWidth then 878 // set it to the MaxWidth, otherwise set it 879 // to the MinWidth 880 881 // get the min and max allowable locations 882 var minX = getInt(sbar.offsetLeft); 883 if ( getInt(sbar.maxWidth) == 0 ) 884 { 885 minX += 1; 886 } 887 else 888 { 889 minX += getInt(sbar.minWidth); 890 } 891 892 var maxX = getInt(sbar.offsetLeft); 893 if ( getInt(sbar.maxWidth) == 0 ) 894 { 895 maxX += getInt(sbar.clientWidth);
896 } 897 else 898 { 899 maxX += getInt(sbar.maxWidth); 900 } 901 902 if (sbar.splitterBar.style.left == minX + "px") 903 { 904 sbar.splitterBar.style.left = maxX + "px"; 905 } 906 else 907 { 908 sbar.splitterBar.style.left = minX + "px"; 909 } 910 sbar.setTargetWidth(sbar); 911 912 // fire the onResizeComplete event 913 if ( sbar.onResizeComplete ) 914 { 915 sbar.onResizeComplete(sbar, sbar.primaryResizeTarget.style.width); 916 } 917 } 918 else // horizontal 919 { 920 // if the SplitterBar is at the MinHeight then 921 // set it to the MaxHeight, otherwise set it 922 // to the MinHeight 923 924 // get the min and max allowable locations 925 var minY = getInt(sbar.offsetTop); 926 if ( getInt(sbar.maxHeight) == 0 ) 927 { 928 minY += 1; 929 } 930 else 931 { 932 minY += getInt(sbar.minHeight); 933 } 934 935 var maxY = getInt(sbar.offsetTop); 936 if ( getInt(sbar.maxHeight) == 0 ) 937 { 938 maxY += getInt(sbar.clientHeight); 939 } 940 else 941 { 942 maxY += getInt(sbar.maxHeight); 943 } 944 945 if (sbar.splitterBar.style.top == minY + "px") 946 { 947 sbar.splitterBar.style.top = maxY + "px"; 948 } 949 else 950 { 951 sbar.splitterBar.style.top = minY + "px"; 952 } 953 sbar.setTargetHeight(sbar); 954 955 // fire the onResizeComplete event 956 if ( sbar.onResizeComplete ) 957 { 958 sbar.onResizeComplete(sbar, sbar.primaryResizeTarget.style.height); 959 } 960 } 961 962 } 963} 964function VwdCmsSplitterBar_hideIFrames() 965{ 966 var sbar = this; 967 968 if (sbar.iframeHiding != "DoNotHide") 969 { 970 // make sure we don't get into a weird state 971 // ** if the user rapidly clicks/dbl-clicks on the SplitterBar 972 // or if the onmouseup event does not get fired for some reason 973 // this method might get called twice before the showIFrames 974 // method is called - what happens is the IFrame ends up being 975 // permanently hidden. To avoid this problem call showIFrames 976 // from within this method before doing the hidding. 977 sbar.showIFrames(); 978 979 // IFrames: hide IFrames so 980 // that the splitterbar can work properly 981 // because IFrames capture/steal the mouse events 982 var op = sbar.primaryResizeTarget.offsetParent; 983 sbar.iframeStates = new Array(); 984 sbar.iframes = op.getElementsByTagName("iframe"); 985 if (sbar.iframes && sbar.iframes.length > 0 ) 986 { 987 var iframe = null; 988 for (var i=0; i < sbar.iframes.length; i++) 989 { 990 iframe = sbar.iframes[i]; 991 if ( iframe ) 992 { 993 switch ( sbar.iframeHiding ) 994 { 995 case "UseVisibility": 996 sbar.iframeStates[i] = iframe.style.visibility; 997 //if ( iframe.style.visibility != "hidden" ) 998 //{ 999 iframe.style.visibility = "hidden"; 1000 //} 1001 break; 1002 1003 case "UseDisplay": 1004 sbar.iframeStates[i] = iframe.style.display; 1005 //if ( iframe.style.display != "none" ) 1006 //{ 1007 iframe.style.display = "none"; 1008 //} 1009 break; 1010 } 1011 } 1012 } 1013 } 1014 } 1015} 1016function VwdCmsSplitterBar_showIFrames() 1017{ 1018 var sbar = this; 1019 if (sbar.iframeHiding != "DoNotHide") 1020 { 1021 // re-enable/re-display the elements in sbar.elementsToDisable 1022 // these elements are known to interfere with the 1023 // splitterBar, but must be returned to their 1024 // normal state before resizing started 1025 var iframe = null; 1026 if (sbar.iframes && sbar.iframes.length > 0 ) 1027 { 1028 for (var i=0; i < sbar.iframes.length; i++) 1029 { 1030 iframe = sbar.iframes[i]; 1031 switch ( sbar.iframeHiding ) 1032 { 1033 case "UseVisibility": 1034 iframe.style.visibility = sbar.iframeStates[i]; 1035 break; 1036 1037 case "UseDisplay": 1038 iframe.style.display = sbar.iframeStates[i]; 1039 break; 1040 } 1041 } 1042 } 1043 sbar.iframes = null; 1044 sbar.iframeStates = null; 1045 } 1046} 1047 1048// utility functions 1049function getTargets(targetIds, namingContainerId) 1050{ 1051 // parse a string of element id's 1052 // and get a reference to the element 1053 // from the document 1054 var target = null; 1055 var targetIdArray = targetIds.split(';'); 1056 var targets = new Array(); 1057 var t = 0; 1058 var id = null; 1059 1060 for ( var i = 0; i < targetIdArray.length; i++ ) 1061 { 1062 id = targetIdArray[i]; 1063 if ( id && id.length > 0 ) 1064 { 1065 target = document.getElementById(namingContainerId + id); 1066 if ( target == null ) 1067 { 1068 // elements that don't have runat="server" will not 1069 // have the naming container prefix 1070 target = document.getElementById(id); 1071 } 1072 1073 if ( target ) 1074 { 1075 targets[t] = target; 1076 t++; 1077 } 1078 } 1079 } 1080 return targets; 1081} 1082 1083function getOffsetTop(element) 1084{ 1085 // walk up the stack of elements collecting 1086 // the offset top values 1087 var offsetTop = new Number(0); 1088 try 1089 { 1090 offsetTop = getInt(element.offsetTop); 1091 var op = element.offsetParent; 1092 while ( op ) 1093 { 1094 offsetTop += getInt(op.offsetTop); 1095 op = op.offsetParent; 1096 } 1097 } 1098 catch (ex) {} 1099 return offsetTop; 1100} 1101 1102function getOffsetLeft(element) 1103{ 1104 // walk up the stack of elements collecting 1105 // the offset left values 1106 var offsetLeft = new Number(0); 1107 try 1108 { 1109 offsetLeft = getInt(element.offsetLeft); 1110 var op = element.offsetParent; 1111 while ( op ) 1112 { 1113 offsetLeft += getInt(op.offsetLeft); 1114 op = op.offsetParent; 1115 } 1116 } 1117 catch (ex) {} 1118 return offsetLeft; 1119} 1120 1121function getInt(value) 1122{ 1123 var num; 1124 if ( value ) 1125 { 1126 num = parseInt(value); 1127 if (isNaN(num)) 1128 {
1129 num = new Number(0); 1130 } 1131 } 1132 else 1133 { 1134 num = new Number(0); 1135 } 1136 return num; 1137} 1138 1139 1140 1141// -->
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.