| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 /** 2 * Name: Highslide JS 3 * Version: 4.1.12 (2011-03-28) 4 * Config: default +inline +ajax +iframe +flash 5 * Author: Torstein Hønsi 6 * Support: www.highslide.com/support 7 * License: www.highslide.com/#license 8 */ 9 if (!hs) { var hs = { 10 // Language strings 11 lang : { 12 cssDirection: 'ltr', 13 loadingText : 'Loading...', 14 loadingTitle : 'Click to cancel', 15 focusTitle : 'Click to bring to front', 16 fullExpandTitle : 'Expand to actual size (f)', 17 creditsText : 'Powered by <i>Highslide JS</i>', 18 creditsTitle : 'Go to the Highslide JS homepage', 19 previousText : 'Previous', 20 nextText : 'Next', 21 moveText : 'Move', 22 closeText : 'Close', 23 closeTitle : 'Close (esc)', 24 resizeTitle : 'Resize', 25 playText : 'Play', 26 playTitle : 'Play slideshow (spacebar)', 27 pauseText : 'Pause', 28 pauseTitle : 'Pause slideshow (spacebar)', 29 previousTitle : 'Previous (arrow left)', 30 nextTitle : 'Next (arrow right)', 31 moveTitle : 'Move', 32 fullExpandText : '1:1', 33 restoreTitle : 'Click to close image, click and drag to move. Use arrow keys for next and previous.' 34 }, 35 // See http://highslide.com/ref for examples of settings 36 graphicsDir : 'highslide/graphics/', 37 expandCursor : 'zoomin.cur', // null disables 38 restoreCursor : 'zoomout.cur', // null disables 39 expandDuration : 250, // milliseconds 40 restoreDuration : 250, 41 marginLeft : 15, 42 marginRight : 15, 43 marginTop : 15, 44 marginBottom : 15, 45 zIndexCounter : 1001, // adjust to other absolutely positioned elements 46 loadingOpacity : 0.75, 47 allowMultipleInstances: true, 48 numberOfImagesToPreload : 5, 49 outlineWhileAnimating : 2, // 0 = never, 1 = always, 2 = HTML only 50 outlineStartOffset : 3, // ends at 10 51 padToMinWidth : false, // pad the popup width to make room for wide caption 52 fullExpandPosition : 'bottom right', 53 fullExpandOpacity : 1, 54 showCredits : true, // you can set this to false if you want 55 creditsHref : 'http://highslide.com/', 56 creditsTarget : '_self', 57 enableKeyListener : true, 58 openerTagNames : ['a'], // Add more to allow slideshow indexing 59 60 allowWidthReduction : false, 61 allowHeightReduction : true, 62 preserveContent : true, // Preserve changes made to the content and position of HTML popups. 63 objectLoadTime : 'before', // Load iframes 'before' or 'after' expansion. 64 cacheAjax : true, // Cache ajax popups for instant display. Can be overridden for each popup. 65 dragByHeading: true, 66 minWidth: 200, 67 minHeight: 200, 68 allowSizeReduction: true, // allow the image to reduce to fit client size. If false, this overrides minWidth and minHeight 69 outlineType : 'drop-shadow', // set null to disable outlines 70 skin : { 71 contentWrapper: 72 '<div class="highslide-header"><ul>'+ 73 '<li class="highslide-previous">'+ 74 '<a href="#" title="{hs.lang.previousTitle}" onclick="return hs.previous(this)">'+ 75 '<span>{hs.lang.previousText}</span></a>'+ 76 '</li>'+ 77 '<li class="highslide-next">'+ 78 '<a href="#" title="{hs.lang.nextTitle}" onclick="return hs.next(this)">'+ 79 '<span>{hs.lang.nextText}</span></a>'+ 80 '</li>'+ 81 '<li class="highslide-move">'+ 82 '<a href="#" title="{hs.lang.moveTitle}" onclick="return false">'+ 83 '<span>{hs.lang.moveText}</span></a>'+ 84 '</li>'+ 85 '<li class="highslide-close">'+ 86 '<a href="#" title="{hs.lang.closeTitle}" onclick="return hs.close(this)">'+ 87 '<span>{hs.lang.closeText}</span></a>'+ 88 '</li>'+ 89 '</ul></div>'+ 90 '<div class="highslide-body"></div>'+ 91 '<div class="highslide-footer"><div>'+ 92 '<span class="highslide-resize" title="{hs.lang.resizeTitle}"><span></span></span>'+ 93 '</div></div>' 94 }, 95 // END OF YOUR SETTINGS 96 97 98 // declare internal properties 99 preloadTheseImages : [], 100 continuePreloading: true, 101 expanders : [], 102 overrides : [ 103 'allowSizeReduction', 104 'useBox', 105 'outlineType', 106 'outlineWhileAnimating', 107 'captionId', 108 'captionText', 109 'captionEval', 110 'captionOverlay', 111 'headingId', 112 'headingText', 113 'headingEval', 114 'headingOverlay', 115 'creditsPosition', 116 'dragByHeading', 117 118 'width', 119 'height', 120 121 'contentId', 122 'allowWidthReduction', 123 'allowHeightReduction', 124 'preserveContent', 125 'maincontentId', 126 'maincontentText', 127 'maincontentEval', 128 'objectType', 129 'cacheAjax', 130 'objectWidth', 131 'objectHeight', 132 'objectLoadTime', 133 'swfOptions', 134 'wrapperClassName', 135 'minWidth', 136 'minHeight', 137 'maxWidth', 138 'maxHeight', 139 'pageOrigin', 140 'slideshowGroup', 141 'easing', 142 'easingClose', 143 'fadeInOut', 144 'src' 145 ], 146 overlays : [], 147 idCounter : 0, 148 oPos : { 149 x: ['leftpanel', 'left', 'center', 'right', 'rightpanel'], 150 y: ['above', 'top', 'middle', 'bottom', 'below'] 151 }, 152 mouse: {}, 153 headingOverlay: {}, 154 captionOverlay: {}, 155 swfOptions: { flashvars: {}, params: {}, attributes: {} }, 156 timers : [], 157 158 pendingOutlines : {}, 159 sleeping : [], 160 preloadTheseAjax : [], 161 cacheBindings : [], 162 cachedGets : {}, 163 clones : {}, 164 onReady: [], 165 uaVersion: /Trident\/4\.0/.test(navigator.userAgent) ? 8 : 166 parseFloat((navigator.userAgent.toLowerCase().match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1]), 167 ie : (document.all && !window.opera), 168 //ie : navigator && /MSIE [678]/.test(navigator.userAgent), // ie9 compliant? 169 safari : /Safari/.test(navigator.userAgent), 170 geckoMac : /Macintosh.+rv:1\.[0-8].+Gecko/.test(navigator.userAgent), 171 172 $ : function (id) { 173 if (id) return document.getElementById(id); 174 }, 175 176 push : function (arr, val) { 177 arr[arr.length] = val; 178 }, 179 180 createElement : function (tag, attribs, styles, parent, nopad) { 181 var el = document.createElement(tag); 182 if (attribs) hs.extend(el, attribs); 183 if (nopad) hs.setStyles(el, {padding: 0, border: 'none', margin: 0}); 184 if (styles) hs.setStyles(el, styles); 185 if (parent) parent.appendChild(el); 186 return el; 187 }, 188 189 extend : function (el, attribs) { 190 for (var x in attribs) el[x] = attribs[x]; 191 return el; 192 }, 193 194 setStyles : function (el, styles) { 195 for (var x in styles) { 196 if (hs.ieLt9 && x == 'opacity') { 197 if (styles[x] > 0.99) el.style.removeAttribute('filter'); 198 else el.style.filter = 'alpha(opacity='+ (styles[x] * 100) +')'; 199 } 200 else el.style[x] = styles[x]; 201 } 202 }, 203 animate: function(el, prop, opt) { 204 var start, 205 end, 206 unit; 207 if (typeof opt != 'object' || opt === null) { 208 var args = arguments; 209 opt = { 210 duration: args[2], 211 easing: args[3], 212 complete: args[4] 213 }; 214 } 215 if (typeof opt.duration != 'number') opt.duration = 250; 216 opt.easing = Math[opt.easing] || Math.easeInQuad; 217 opt.curAnim = hs.extend({}, prop); 218 for (var name in prop) { 219 var e = new hs.fx(el, opt , name ); 220 221 start = parseFloat(hs.css(el, name)) || 0; 222 end = parseFloat(prop[name]); 223 unit = name != 'opacity' ? 'px' : ''; 224 225 e.custom( start, end, unit ); 226 } 227 }, 228 css: function(el, prop) { 229 if (el.style[prop]) { 230 return el.style[prop]; 231 } else if (document.defaultView) { 232 return document.defaultView.getComputedStyle(el, null).getPropertyValue(prop); 233 234 } else { 235 if (prop == 'opacity') prop = 'filter'; 236 var val = el.currentStyle[prop.replace(/\-(\w)/g, function (a, b){ return b.toUpperCase(); })]; 237 if (prop == 'filter') 238 val = val.replace(/alpha\(opacity=([0-9]+)\)/, 239 function (a, b) { return b / 100 }); 240 return val === '' ? 1 : val; 241 } 242 }, 243 244 getPageSize : function () { 245 var d = document, w = window, iebody = d.compatMode && d.compatMode != 'BackCompat' 246 ? d.documentElement : d.body; 247 248 var width = hs.ieLt9 ? iebody.clientWidth : 249 (d.documentElement.clientWidth || self.innerWidth), 250 height = hs.ieLt9 ? iebody.clientHeight : self.innerHeight; 251 252 hs.page = { 253 width: width, 254 height: height, 255 scrollLeft: hs.ieLt9 ? iebody.scrollLeft : pageXOffset, 256 scrollTop: hs.ieLt9 ? iebody.scrollTop : pageYOffset 257 }; 258 return hs.page; 259 }, 260 261 getPosition : function(el) { 262 var p = { x: el.offsetLeft, y: el.offsetTop }; 263 while (el.offsetParent) { 264 el = el.offsetParent; 265 p.x += el.offsetLeft; 266 p.y += el.offsetTop; 267 if (el != document.body && el != document.documentElement) { 268 p.x -= el.scrollLeft; 269 p.y -= el.scrollTop; 270 } 271 } 272 return p; 273 }, 274 275 expand : function(a, params, custom, type) { 276 if (!a) a = hs.createElement('a', null, { display: 'none' }, hs.container); 277 if (typeof a.getParams == 'function') return params; 278 if (type == 'html') { 279 for (var i = 0; i < hs.sleeping.length; i++) { 280 if (hs.sleeping[i] && hs.sleeping[i].a == a) { 281 hs.sleeping[i].awake(); 282 hs.sleeping[i] = null; 283 return false; 284 } 285 } 286 hs.hasHtmlExpanders = true; 287 } 288 try { 289 new hs.Expander(a, params, custom, type); 290 return false; 291 } catch (e) { return true; } 292 }, 293 294 htmlExpand : function(a, params, custom) { 295 return hs.expand(a, params, custom, 'html'); 296 }, 297 298 getSelfRendered : function() { 299 return hs.createElement('div', { 300 className: 'highslide-html-content', 301 innerHTML: hs.replaceLang(hs.skin.contentWrapper) 302 }); 303 }, 304 getElementByClass : function (el, tagName, className) { 305 var els = el.getElementsByTagName(tagName); 306 for (var i = 0; i < els.length; i++) { 307 if ((new RegExp(className)).test(els[i].className)) { 308 return els[i]; 309 } 310 } 311 return null; 312 }, 313 replaceLang : function(s) { 314 s = s.replace(/\s/g, ' '); 315 var re = /{hs\.lang\.([^}]+)\}/g, 316 matches = s.match(re), 317 lang; 318 if (matches) for (var i = 0; i < matches.length; i++) { 319 lang = matches[i].replace(re, "$1"); 320 if (typeof hs.lang[lang] != 'undefined') s = s.replace(matches[i], hs.lang[lang]); 321 } 322 return s; 323 }, 324 325 326 getCacheBinding : function (a) { 327 for (var i = 0; i < hs.cacheBindings.length; i++) { 328 if (hs.cacheBindings[i][0] == a) { 329 var c = hs.cacheBindings[i][1]; 330 hs.cacheBindings[i][1] = c.cloneNode(1); 331 return c; 332 } 333 } 334 return null; 335 }, 336 337 preloadAjax : function (e) { 338 var arr = hs.getAnchors(); 339 for (var i = 0; i < arr.htmls.length; i++) { 340 var a = arr.htmls[i]; 341 if (hs.getParam(a, 'objectType') == 'ajax' && hs.getParam(a, 'cacheAjax')) 342 hs.push(hs.preloadTheseAjax, a); 343 } 344 345 hs.preloadAjaxElement(0); 346 }, 347 348 preloadAjaxElement : function (i) { 349 if (!hs.preloadTheseAjax[i]) return; 350 var a = hs.preloadTheseAjax[i]; 351 var cache = hs.getNode(hs.getParam(a, 'contentId')); 352 if (!cache) cache = hs.getSelfRendered(); 353 var ajax = new hs.Ajax(a, cache, 1); 354 ajax.onError = function () { }; 355 ajax.onLoad = function () { 356 hs.push(hs.cacheBindings, [a, cache]); 357 hs.preloadAjaxElement(i + 1); 358 }; 359 ajax.run(); 360 }, 361 362 focusTopmost : function() { 363 var topZ = 0, 364 topmostKey = -1, 365 expanders = hs.expanders, 366 exp, 367 zIndex; 368 for (var i = 0; i < expanders.length; i++) { 369 exp = expanders[i]; 370 if (exp) { 371 zIndex = exp.wrapper.style.zIndex; 372 if (zIndex && zIndex > topZ) { 373 topZ = zIndex; 374 topmostKey = i; 375 } 376 } 377 } 378 if (topmostKey == -1) hs.focusKey = -1; 379 else expanders[topmostKey].focus(); 380 }, 381 382 getParam : function (a, param) { 383 a.getParams = a.onclick; 384 var p = a.getParams ? a.getParams() : null; 385 a.getParams = null; 386 387 return (p && typeof p[param] != 'undefined') ? p[param] : 388 (typeof hs[param] != 'undefined' ? hs[param] : null); 389 }, 390 391 getSrc : function (a) { 392 var src = hs.getParam(a, 'src'); 393 if (src) return src; 394 return a.href; 395 }, 396 397 getNode : function (id) { 398 var node = hs.$(id), clone = hs.clones[id], a = {}; 399 if (!node && !clone) return null; 400 if (!clone) { 401 clone = node.cloneNode(true); 402 clone.id = ''; 403 hs.clones[id] = clone; 404 return node; 405 } else { 406 return clone.cloneNode(true); 407 } 408 }, 409 410 discardElement : function(d) { 411 if (d) hs.garbageBin.appendChild(d); 412 hs.garbageBin.innerHTML = ''; 413 }, 414 transit : function (adj, exp) { 415 var last = exp || hs.getExpander(); 416 exp = last; 417 if (hs.upcoming) return false; 418 else hs.last = last; 419 hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler); 420 try { 421 hs.upcoming = adj; 422 adj.onclick(); 423 } catch (e){ 424 hs.last = hs.upcoming = null; 425 } 426 try { 427 exp.close(); 428 } catch (e) {} 429 return false; 430 }, 431 432 previousOrNext : function (el, op) { 433 var exp = hs.getExpander(el); 434 if (exp) return hs.transit(exp.getAdjacentAnchor(op), exp); 435 else return false; 436 }, 437 438 previous : function (el) { 439 return hs.previousOrNext(el, -1); 440 }, 441 442 next : function (el) { 443 return hs.previousOrNext(el, 1); 444 }, 445 446 keyHandler : function(e) { 447 if (!e) e = window.event; 448 if (!e.target) e.target = e.srcElement; // ie 449 if (typeof e.target.form != 'undefined') return true; // form element has focus 450 var exp = hs.getExpander(); 451 452 var op = null; 453 switch (e.keyCode) { 454 case 70: // f 455 if (exp) exp.doFullExpand(); 456 return true; 457 case 32: // Space 458 case 34: // Page Down 459 case 39: // Arrow right 460 case 40: // Arrow down 461 op = 1; 462 break; 463 case 8: // Backspace 464 case 33: // Page Up 465 case 37: // Arrow left 466 case 38: // Arrow up 467 op = -1; 468 break; 469 case 27: // Escape 470 case 13: // Enter 471 op = 0; 472 } 473 if (op !== null) { 474 hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler); 475 if (!hs.enableKeyListener) return true; 476 477 if (e.preventDefault) e.preventDefault(); 478 else e.returnValue = false; 479 if (exp) { 480 if (op == 0) { 481 exp.close(); 482 } else { 483 hs.previousOrNext(exp.key, op); 484 } 485 return false; 486 } 487 } 488 return true; 489 }, 490 491 492 registerOverlay : function (overlay) { 493 hs.push(hs.overlays, hs.extend(overlay, { hsId: 'hsId'+ hs.idCounter++ } )); 494 }, 495 496 497 getWrapperKey : function (element, expOnly) { 498 var el, re = /^highslide-wrapper-([0-9]+)$/; 499 // 1. look in open expanders 500 el = element; 501 while (el.parentNode) { 502 if (el.id && re.test(el.id)) return el.id.replace(re, "$1"); 503 el = el.parentNode; 504 } 505 // 2. look in thumbnail 506 if (!expOnly) { 507 el = element; 508 while (el.parentNode) { 509 if (el.tagName && hs.isHsAnchor(el)) { 510 for (var key = 0; key < hs.expanders.length; key++) { 511 var exp = hs.expanders[key]; 512 if (exp && exp.a == el) return key; 513 } 514 } 515 el = el.parentNode; 516 } 517 } 518 return null; 519 }, 520 521 getExpander : function (el, expOnly) { 522 if (typeof el == 'undefined') return hs.expanders[hs.focusKey] || null; 523 if (typeof el == 'number') return hs.expanders[el] || null; 524 if (typeof el == 'string') el = hs.$(el); 525 return hs.expanders[hs.getWrapperKey(el, expOnly)] || null; 526 }, 527 528 isHsAnchor : function (a) { 529 return (a.onclick && a.onclick.toString().replace(/\s/g, ' ').match(/hs.(htmlE|e)xpand/)); 530 }, 531 532 reOrder : function () { 533 for (var i = 0; i < hs.expanders.length; i++) 534 if (hs.expanders[i] && hs.expanders[i].isExpanded) hs.focusTopmost(); 535 }, 536 537 mouseClickHandler : function(e) 538 { 539 if (!e) e = window.event; 540 if (e.button > 1) return true; 541 if (!e.target) e.target = e.srcElement; 542 543 var el = e.target; 544 while (el.parentNode 545 && !(/highslide-(image|move|html|resize)/.test(el.className))) 546 { 547 el = el.parentNode; 548 } 549 var exp = hs.getExpander(el); 550 if (exp && (exp.isClosing || !exp.isExpanded)) return true; 551 552 if (exp && e.type == 'mousedown') { 553 if (e.target.form) return true; 554 var match = el.className.match(/highslide-(image|move|resize)/); 555 if (match) { 556 hs.dragArgs = { 557 exp: exp , 558 type: match[1], 559 left: exp.x.pos, 560 width: exp.x.size, 561 top: exp.y.pos, 562 height: exp.y.size, 563 clickX: e.clientX, 564 clickY: e.clientY 565 }; 566 567 568 hs.addEventListener(document, 'mousemove', hs.dragHandler); 569 if (e.preventDefault) e.preventDefault(); // FF 570 571 if (/highslide-(image|html)-blur/.test(exp.content.className)) { 572 exp.focus(); 573 hs.hasFocused = true; 574 } 575 return false; 576 } 577 else if (/highslide-html/.test(el.className) && hs.focusKey != exp.key) { 578 exp.focus(); 579 exp.doShowHide('hidden'); 580 } 581 } else if (e.type == 'mouseup') { 582 583 hs.removeEventListener(document, 'mousemove', hs.dragHandler); 584 585 if (hs.dragArgs) { 586 if (hs.styleRestoreCursor && hs.dragArgs.type == 'image') 587 hs.dragArgs.exp.content.style.cursor = hs.styleRestoreCursor; 588 var hasDragged = hs.dragArgs.hasDragged; 589 590 if (!hasDragged &&!hs.hasFocused && !/(move|resize)/.test(hs.dragArgs.type)) { 591 exp.close(); 592 } 593 else if (hasDragged || (!hasDragged && hs.hasHtmlExpanders)) { 594 hs.dragArgs.exp.doShowHide('hidden'); 595 } 596 597 if (hs.dragArgs.exp.releaseMask) 598 hs.dragArgs.exp.releaseMask.style.display = 'none'; 599 hs.hasFocused = false; 600 hs.dragArgs = null; 601 602 } else if (/highslide-image-blur/.test(el.className)) { 603 el.style.cursor = hs.styleRestoreCursor; 604 } 605 } 606 return false; 607 }, 608 609 dragHandler : function(e) 610 { 611 if (!hs.dragArgs) return true; 612 if (!e) e = window.event; 613 var a = hs.dragArgs, exp = a.exp; 614 if (exp.iframe) { 615 if (!exp.releaseMask) exp.releaseMask = hs.createElement('div', null, 616 { position: 'absolute', width: exp.x.size+'px', height: exp.y.size+'px', 617 left: exp.x.cb+'px', top: exp.y.cb+'px', zIndex: 4, background: (hs.ieLt9 ? 'white' : 'none'), 618 opacity: 0.01 }, 619 exp.wrapper, true); 620 if (exp.releaseMask.style.display == 'none') 621 exp.releaseMask.style.display = ''; 622 } 623 624 a.dX = e.clientX - a.clickX; 625 a.dY = e.clientY - a.clickY; 626 627 var distance = Math.sqrt(Math.pow(a.dX, 2) + Math.pow(a.dY, 2)); 628 if (!a.hasDragged) a.hasDragged = (a.type != 'image' && distance > 0) 629 || (distance > (hs.dragSensitivity || 5)); 630 631 if (a.hasDragged && e.clientX > 5 && e.clientY > 5) { 632 633 if (a.type == 'resize') exp.resize(a); 634 else { 635 exp.moveTo(a.left + a.dX, a.top + a.dY); 636 if (a.type == 'image') exp.content.style.cursor = 'move'; 637 } 638 } 639 return false; 640 }, 641 642 wrapperMouseHandler : function (e) { 643 try { 644 if (!e) e = window.event; 645 var over = /mouseover/i.test(e.type); 646 if (!e.target) e.target = e.srcElement; // ie 647 if (!e.relatedTarget) e.relatedTarget = 648 over ? e.fromElement : e.toElement; // ie 649 var exp = hs.getExpander(e.target); 650 if (!exp.isExpanded) return; 651 if (!exp || !e.relatedTarget || hs.getExpander(e.relatedTarget, true) == exp 652 || hs.dragArgs) return; 653 for (var i = 0; i < exp.overlays.length; i++) (function() { 654 var o = hs.$('hsId'+ exp.overlays[i]); 655 if (o && o.hideOnMouseOut) { 656 if (over) hs.setStyles(o, { visibility: 'visible', display: '' }); 657 hs.animate(o, { opacity: over ? o.opacity : 0 }, o.dur); 658 } 659 })(); 660 } catch (e) {} 661 }, 662 addEventListener : function (el, event, func) { 663 if (el == document && event == 'ready') { 664 hs.push(hs.onReady, func); 665 } 666 try { 667 el.addEventListener(event, func, false); 668 } catch (e) { 669 try { 670 el.detachEvent('on'+ event, func); 671 el.attachEvent('on'+ event, func); 672 } catch (e) { 673 el['on'+ event] = func; 674 } 675 } 676 }, 677 678 removeEventListener : function (el, event, func) { 679 try { 680 el.removeEventListener(event, func, false); 681 } catch (e) { 682 try { 683 el.detachEvent('on'+ event, func); 684 } catch (e) { 685 el['on'+ event] = null; 686 } 687 } 688 }, 689 690 preloadFullImage : function (i) { 691 if (hs.continuePreloading && hs.preloadTheseImages[i] && hs.preloadTheseImages[i] != 'undefined') { 692 var img = document.createElement('img'); 693 img.onload = function() { 694 img = null; 695 hs.preloadFullImage(i + 1); 696 }; 697 img.src = hs.preloadTheseImages[i]; 698 } 699 }, 700 preloadImages : function (number) { 701 if (number && typeof number != 'object') hs.numberOfImagesToPreload = number; 702 703 var arr = hs.getAnchors(); 704 for (var i = 0; i < arr.images.length && i < hs.numberOfImagesToPreload; i++) { 705 hs.push(hs.preloadTheseImages, hs.getSrc(arr.images[i])); 706 } 707 708 // preload outlines 709 if (hs.outlineType) new hs.Outline(hs.outlineType, function () { hs.preloadFullImage(0)} ); 710 else 711 712 hs.preloadFullImage(0); 713 714 // preload cursor 715 if (hs.restoreCursor) var cur = hs.createElement('img', { src: hs.graphicsDir + hs.restoreCursor }); 716 }, 717 718 719 init : function () { 720 if (!hs.container) { 721 722 hs.ieLt7 = hs.ie && hs.uaVersion < 7; 723 hs.ieLt9 = hs.ie && hs.uaVersion < 9; 724 725 hs.getPageSize(); 726 hs.ie6SSL = hs.ieLt7 && location.protocol == 'https:'; 727 for (var x in hs.langDefaults) { 728 if (typeof hs[x] != 'undefined') hs.lang[x] = hs[x]; 729 else if (typeof hs.lang[x] == 'undefined' && typeof hs.langDefaults[x] != 'undefined') 730 hs.lang[x] = hs.langDefaults[x]; 731 } 732 733 hs.container = hs.createElement('div', { 734 className: 'highslide-container' 735 }, { 736 position: 'absolute', 737 left: 0, 738 top: 0, 739 width: '100%', 740 zIndex: hs.zIndexCounter, 741 direction: 'ltr' 742 }, 743 document.body, 744 true 745 ); 746 hs.loading = hs.createElement('a', { 747 className: 'highslide-loading', 748 title: hs.lang.loadingTitle, 749 innerHTML: hs.lang.loadingText, 750 href: 'javascript:;' 751 }, { 752 position: 'absolute', 753 top: '-9999px', 754 opacity: hs.loadingOpacity, 755 zIndex: 1 756 }, hs.container 757 ); 758 hs.garbageBin = hs.createElement('div', null, { display: 'none' }, hs.container); 759 hs.clearing = hs.createElement('div', null, 760 { clear: 'both', paddingTop: '1px' }, null, true); 761 762 // http://www.robertpenner.com/easing/ 763 Math.linearTween = function (t, b, c, d) { 764 return c*t/d + b; 765 }; 766 Math.easeInQuad = function (t, b, c, d) { 767 return c*(t/=d)*t + b; 768 }; 769 770 hs.hideSelects = hs.ieLt7; 771 hs.hideIframes = ((window.opera && hs.uaVersion < 9) || navigator.vendor == 'KDE' 772 || (hs.ieLt7 && hs.uaVersion < 5.5)); 773 } 774 }, 775 ready : function() { 776 if (hs.isReady) return; 777 hs.isReady = true; 778 for (var i = 0; i < hs.onReady.length; i++) hs.onReady[i](); 779 }, 780 781 updateAnchors : function() { 782 var el, els, all = [], images = [], htmls = [],groups = {}, re; 783 784 for (var i = 0; i < hs.openerTagNames.length; i++) { 785 els = document.getElementsByTagName(hs.openerTagNames[i]); 786 for (var j = 0; j < els.length; j++) { 787 el = els[j]; 788 re = hs.isHsAnchor(el); 789 if (re) { 790 hs.push(all, el); 791 if (re[0] == 'hs.expand') hs.push(images, el); 792 else if (re[0] == 'hs.htmlExpand') hs.push(htmls, el); 793 var g = hs.getParam(el, 'slideshowGroup') || 'none'; 794 if (!groups[g]) groups[g] = []; 795 hs.push(groups[g], el); 796 } 797 } 798 } 799 hs.anchors = { all: all, groups: groups, images: images, htmls: htmls }; 800 return hs.anchors; 801 802 }, 803 804 getAnchors : function() { 805 return hs.anchors || hs.updateAnchors(); 806 }, 807 808 809 close : function(el) { 810 var exp = hs.getExpander(el); 811 if (exp) exp.close(); 812 return false; 813 } 814 }; // end hs object 815 hs.fx = function( elem, options, prop ){ 816 this.options = options; 817 this.elem = elem; 818 this.prop = prop; 819 820 if (!options.orig) options.orig = {}; 821 }; 822 hs.fx.prototype = { 823 update: function(){ 824 (hs.fx.step[this.prop] || hs.fx.step._default)(this); 825 826 if (this.options.step) 827 this.options.step.call(this.elem, this.now, this); 828 829 }, 830 custom: function(from, to, unit){ 831 this.startTime = (new Date()).getTime(); 832 this.start = from; 833 this.end = to; 834 this.unit = unit;// || this.unit || "px"; 835 this.now = this.start; 836 this.pos = this.state = 0; 837 838 var self = this; 839 function t(gotoEnd){ 840 return self.step(gotoEnd); 841 } 842 843 t.elem = this.elem; 844 845 if ( t() && hs.timers.push(t) == 1 ) { 846 hs.timerId = setInterval(function(){ 847 var timers = hs.timers; 848 849 for ( var i = 0; i < timers.length; i++ ) 850 if ( !timers[i]() ) 851 timers.splice(i--, 1); 852 853 if ( !timers.length ) { 854 clearInterval(hs.timerId); 855 } 856 }, 13); 857 } 858 }, 859 step: function(gotoEnd){ 860 var t = (new Date()).getTime(); 861 if ( gotoEnd || t >= this.options.duration + this.startTime ) { 862 this.now = this.end; 863 this.pos = this.state = 1; 864 this.update(); 865 866 this.options.curAnim[ this.prop ] = true; 867 868 var done = true; 869 for ( var i in this.options.curAnim ) 870 if ( this.options.curAnim[i] !== true ) 871 done = false; 872 873 if ( done ) { 874 if (this.options.complete) this.options.complete.call(this.elem); 875 } 876 return false; 877 } else { 878 var n = t - this.startTime; 879 this.state = n / this.options.duration; 880 this.pos = this.options.easing(n, 0, 1, this.options.duration); 881 this.now = this.start + ((this.end - this.start) * this.pos); 882 this.update(); 883 } 884 return true; 885 } 886 887 }; 888 889 hs.extend( hs.fx, { 890 step: { 891 892 opacity: function(fx){ 893 hs.setStyles(fx.elem, { opacity: fx.now }); 894 }, 895 896 _default: function(fx){ 897 try { 898 if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) 899 fx.elem.style[ fx.prop ] = fx.now + fx.unit; 900 else 901 fx.elem[ fx.prop ] = fx.now; 902 } catch (e) {} 903 } 904 } 905 }); 906 907 hs.Outline = function (outlineType, onLoad) { 908 this.onLoad = onLoad; 909 this.outlineType = outlineType; 910 var v = hs.uaVersion, tr; 911 912 this.hasAlphaImageLoader = hs.ie && hs.uaVersion < 7; 913 if (!outlineType) { 914 if (onLoad) onLoad(); 915 return; 916 } 917 918 hs.init(); 919 this.table = hs.createElement( 920 'table', { 921 cellSpacing: 0 922 }, { 923 visibility: 'hidden', 924 position: 'absolute', 925 borderCollapse: 'collapse', 926 width: 0 927 }, 928 hs.container, 929 true 930 ); 931 var tbody = hs.createElement('tbody', null, null, this.table, 1); 932 933 this.td = []; 934 for (var i = 0; i <= 8; i++) { 935 if (i % 3 == 0) tr = hs.createElement('tr', null, { height: 'auto' }, tbody, true); 936 this.td[i] = hs.createElement('td', null, null, tr, true); 937 var style = i != 4 ? { lineHeight: 0, fontSize: 0} : { position : 'relative' }; 938 hs.setStyles(this.td[i], style); 939 } 940 this.td[4].className = outlineType +' highslide-outline'; 941 942 this.preloadGraphic(); 943 }; 944 945 hs.Outline.prototype = { 946 preloadGraphic : function () { 947 var src = hs.graphicsDir + (hs.outlinesDir || "outlines/")+ this.outlineType +".png"; 948 949 var appendTo = hs.safari && hs.uaVersion < 525 ? hs.container : null; 950 this.graphic = hs.createElement('img', null, { position: 'absolute', 951 top: '-9999px' }, appendTo, true); // for onload trigger 952 953 var pThis = this; 954 this.graphic.onload = function() { pThis.onGraphicLoad(); }; 955 956 this.graphic.src = src; 957 }, 958 959 onGraphicLoad : function () { 960 var o = this.offset = this.graphic.width / 4, 961 pos = [[0,0],[0,-4],[-2,0],[0,-8],0,[-2,-8],[0,-2],[0,-6],[-2,-2]], 962 dim = { height: (2*o) +'px', width: (2*o) +'px' }; 963 for (var i = 0; i <= 8; i++) { 964 if (pos[i]) { 965 if (this.hasAlphaImageLoader) { 966 var w = (i == 1 || i == 7) ? '100%' : this.graphic.width +'px'; 967 var div = hs.createElement('div', null, { width: '100%', height: '100%', position: 'relative', overflow: 'hidden'}, this.td[i], true); 968 hs.createElement ('div', null, { 969 filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale, src='"+ this.graphic.src + "')", 970 position: 'absolute', 971 width: w, 972 height: this.graphic.height +'px', 973 left: (pos[i][0]*o)+'px', 974 top: (pos[i][1]*o)+'px' 975 }, 976 div, 977 true); 978 } else { 979 hs.setStyles(this.td[i], { background: 'url('+ this.graphic.src +') '+ (pos[i][0]*o)+'px '+(pos[i][1]*o)+'px'}); 980 } 981 982 if (window.opera && (i == 3 || i ==5)) 983 hs.createElement('div', null, dim, this.td[i], true); 984 985 hs.setStyles (this.td[i], dim); 986 } 987 } 988 this.graphic = null; 989 if (hs.pendingOutlines[this.outlineType]) hs.pendingOutlines[this.outlineType].destroy(); 990 hs.pendingOutlines[this.outlineType] = this; 991 if (this.onLoad) this.onLoad(); 992 }, 993 994 setPosition : function (pos, offset, vis, dur, easing) { 995 var exp = this.exp, 996 stl = exp.wrapper.style, 997 offset = offset || 0, 998 pos = pos || { 999 x: exp.x.pos + offset, 1000 y: exp.y.pos + offset, 1001 w: exp.x.get('wsize') - 2 * offset, 1002 h: exp.y.get('wsize') - 2 * offset 1003 }; 1004 if (vis) this.table.style.visibility = (pos.h >= 4 * this.offset) 1005 ? 'visible' : 'hidden'; 1006 hs.setStyles(this.table, { 1007 left: (pos.x - this.offset) +'px', 1008 top: (pos.y - this.offset) +'px', 1009 width: (pos.w + 2 * this.offset) +'px' 1010 }); 1011 1012 pos.w -= 2 * this.offset; 1013 pos.h -= 2 * this.offset; 1014 hs.setStyles (this.td[4], { 1015 width: pos.w >= 0 ? pos.w +'px' : 0, 1016 height: pos.h >= 0 ? pos.h +'px' : 0 1017 }); 1018 if (this.hasAlphaImageLoader) this.td[3].style.height 1019 = this.td[5].style.height = this.td[4].style.height; 1020 1021 }, 1022 1023 destroy : function(hide) { 1024 if (hide) this.table.style.visibility = 'hidden'; 1025 else hs.discardElement(this.table); 1026 } 1027 }; 1028 1029 hs.Dimension = function(exp, dim) { 1030 this.exp = exp; 1031 this.dim = dim; 1032 this.ucwh = dim == 'x' ? 'Width' : 'Height'; 1033 this.wh = this.ucwh.toLowerCase(); 1034 this.uclt = dim == 'x' ? 'Left' : 'Top'; 1035 this.lt = this.uclt.toLowerCase(); 1036 this.ucrb = dim == 'x' ? 'Right' : 'Bottom'; 1037 this.rb = this.ucrb.toLowerCase(); 1038 this.p1 = this.p2 = 0; 1039 }; 1040 hs.Dimension.prototype = { 1041 get : function(key) { 1042 switch (key) { 1043 case 'loadingPos': 1044 return this.tpos + this.tb + (this.t - hs.loading['offset'+ this.ucwh]) / 2; 1045 case 'wsize': 1046 return this.size + 2 * this.cb + this.p1 + this.p2; 1047 case 'fitsize': 1048 return this.clientSize - this.marginMin - this.marginMax; 1049 case 'maxsize': 1050 return this.get('fitsize') - 2 * this.cb - this.p1 - this.p2 ; 1051 case 'opos': 1052 return this.pos - (this.exp.outline ? this.exp.outline.offset : 0); 1053 case 'osize': 1054 return this.get('wsize') + (this.exp.outline ? 2*this.exp.outline.offset : 0); 1055 case 'imgPad': 1056 return this.imgSize ? Math.round((this.size - this.imgSize) / 2) : 0; 1057 1058 } 1059 }, 1060 calcBorders: function() { 1061 // correct for borders 1062 this.cb = (this.exp.content['offset'+ this.ucwh] - this.t) / 2; 1063 1064 this.marginMax = hs['margin'+ this.ucrb]; 1065 }, 1066 calcThumb: function() { 1067 this.t = this.exp.el[this.wh] ? parseInt(this.exp.el[this.wh]) : 1068 this.exp.el['offset'+ this.ucwh]; 1069 this.tpos = this.exp.tpos[this.dim]; 1070 this.tb = (this.exp.el['offset'+ this.ucwh] - this.t) / 2; 1071 if (this.tpos == 0 || this.tpos == -1) { 1072 this.tpos = (hs.page[this.wh] / 2) + hs.page['scroll'+ this.uclt]; 1073 }; 1074 }, 1075 calcExpanded: function() { 1076 var exp = this.exp; 1077 this.justify = 'auto'; 1078 1079 1080 // size and position 1081 this.pos = this.tpos - this.cb + this.tb; 1082 1083 if (this.maxHeight && this.dim == 'x') 1084 exp.maxWidth = Math.min(exp.maxWidth || this.full, exp.maxHeight * this.full / exp.y.full); 1085 1086 this.size = Math.min(this.full, exp['max'+ this.ucwh] || this.full); 1087 this.minSize = exp.allowSizeReduction ? 1088 Math.min(exp['min'+ this.ucwh], this.full) :this.full; 1089 if (exp.isImage && exp.useBox) { 1090 this.size = exp[this.wh]; 1091 this.imgSize = this.full; 1092 } 1093 if (this.dim == 'x' && hs.padToMinWidth) this.minSize = exp.minWidth; 1094 this.marginMin = hs['margin'+ this.uclt]; 1095 this.scroll = hs.page['scroll'+ this.uclt]; 1096 this.clientSize = hs.page[this.wh]; 1097 }, 1098 setSize: function(i) { 1099 var exp = this.exp; 1100 if (exp.isImage && (exp.useBox || hs.padToMinWidth)) { 1101 this.imgSize = i; 1102 this.size = Math.max(this.size, this.imgSize); 1103 exp.content.style[this.lt] = this.get('imgPad')+'px'; 1104 } else 1105 this.size = i; 1106 1107 exp.content.style[this.wh] = i +'px'; 1108 exp.wrapper.style[this.wh] = this.get('wsize') +'px'; 1109 if (exp.outline) exp.outline.setPosition(); 1110 if (exp.releaseMask) exp.releaseMask.style[this.wh] = i +'px'; 1111 if (this.dim == 'y' && exp.iDoc && exp.body.style.height != 'auto') try { 1112 exp.iDoc.body.style.overflow = 'auto'; 1113 } catch (e) {} 1114 if (exp.isHtml) { 1115 var d = exp.scrollerDiv; 1116 if (this.sizeDiff === undefined) 1117 this.sizeDiff = exp.innerContent['offset'+ this.ucwh] - d['offset'+ this.ucwh]; 1118 d.style[this.wh] = (this.size - this.sizeDiff) +'px'; 1119 1120 if (this.dim == 'x') exp.mediumContent.style.width = 'auto'; 1121 if (exp.body) exp.body.style[this.wh] = 'auto'; 1122 } 1123 if (this.dim == 'x' && exp.overlayBox) exp.sizeOverlayBox(true); 1124 }, 1125 setPos: function(i) { 1126 this.pos = i; 1127 this.exp.wrapper.style[this.lt] = i +'px'; 1128 1129 if (this.exp.outline) this.exp.outline.setPosition(); 1130 1131 } 1132 }; 1133 1134 hs.Expander = function(a, params, custom, contentType) { 1135 if (document.readyState && hs.ie && !hs.isReady) { 1136 hs.addEventListener(document, 'ready', function() { 1137 new hs.Expander(a, params, custom, contentType); 1138 }); 1139 return; 1140 } 1141 this.a = a; 1142 this.custom = custom; 1143 this.contentType = contentType || 'image'; 1144 this.isHtml = (contentType == 'html'); 1145 this.isImage = !this.isHtml; 1146 1147 hs.continuePreloading = false; 1148 this.overlays = []; 1149 hs.init(); 1150 var key = this.key = hs.expanders.length; 1151 // override inline parameters 1152 for (var i = 0; i < hs.overrides.length; i++) { 1153 var name = hs.overrides[i]; 1154 this[name] = params && typeof params[name] != 'undefined' ? 1155 params[name] : hs[name]; 1156 } 1157 if (!this.src) this.src = a.href; 1158 1159 // get thumb 1160 var el = (params && params.thumbnailId) ? hs.$(params.thumbnailId) : a; 1161 el = this.thumb = el.getElementsByTagName('img')[0] || el; 1162 this.thumbsUserSetId = el.id || a.id; 1163 1164 // check if already open 1165 for (var i = 0; i < hs.expanders.length; i++) { 1166 if (hs.expanders[i] && hs.expanders[i].a == a) { 1167 hs.expanders[i].focus(); 1168 return false; 1169 } 1170 } 1171 1172 // cancel other 1173 if (!hs.allowSimultaneousLoading) for (var i = 0; i < hs.expanders.length; i++) { 1174 if (hs.expanders[i] && hs.expanders[i].thumb != el && !hs.expanders[i].onLoadStarted) { 1175 hs.expanders[i].cancelLoading(); 1176 } 1177 } 1178 hs.expanders[key] = this; 1179 if (!hs.allowMultipleInstances && !hs.upcoming) { 1180 if (hs.expanders[key-1]) hs.expanders[key-1].close(); 1181 if (typeof hs.focusKey != 'undefined' && hs.expanders[hs.focusKey]) 1182 hs.expanders[hs.focusKey].close(); 1183 } 1184 1185 // initiate metrics 1186 this.el = el; 1187 this.tpos = this.pageOrigin || hs.getPosition(el); 1188 hs.getPageSize(); 1189 var x = this.x = new hs.Dimension(this, 'x'); 1190 x.calcThumb(); 1191 var y = this.y = new hs.Dimension(this, 'y'); 1192 y.calcThumb(); 1193 this.wrapper = hs.createElement( 1194 'div', { 1195 id: 'highslide-wrapper-'+ this.key, 1196 className: 'highslide-wrapper '+ this.wrapperClassName 1197 }, { 1198 visibility: 'hidden', 1199 position: 'absolute', 1200 zIndex: hs.zIndexCounter += 2 1201 }, null, true ); 1202 1203 this.wrapper.onmouseover = this.wrapper.onmouseout = hs.wrapperMouseHandler; 1204 if (this.contentType == 'image' && this.outlineWhileAnimating == 2) 1205 this.outlineWhileAnimating = 0; 1206 1207 // get the outline 1208 if (!this.outlineType) { 1209 this[this.contentType +'Create'](); 1210 1211 } else if (hs.pendingOutlines[this.outlineType]) { 1212 this.connectOutline(); 1213 this[this.contentType +'Create'](); 1214 1215 } else { 1216 this.showLoading(); 1217 var exp = this; 1218 new hs.Outline(this.outlineType, 1219 function () { 1220 exp.connectOutline(); 1221 exp[exp.contentType +'Create'](); 1222 } 1223 ); 1224 } 1225 return true; 1226 }; 1227 1228 hs.Expander.prototype = { 1229 error : function(e) { 1230 if (hs.debug) alert ('Line '+ e.lineNumber +': '+ e.message); 1231 else window.location.href = this.src; 1232 }, 1233 1234 connectOutline : function() { 1235 var outline = this.outline = hs.pendingOutlines[this.outlineType]; 1236 outline.exp = this; 1237 outline.table.style.zIndex = this.wrapper.style.zIndex - 1; 1238 hs.pendingOutlines[this.outlineType] = null; 1239 }, 1240 1241 showLoading : function() { 1242 if (this.onLoadStarted || this.loading) return; 1243 1244 this.loading = hs.loading; 1245 var exp = this; 1246 this.loading.onclick = function() { 1247 exp.cancelLoading(); 1248 }; 1249 var exp = this, 1250 l = this.x.get('loadingPos') +'px', 1251 t = this.y.get('loadingPos') +'px'; 1252 setTimeout(function () { 1253 if (exp.loading) hs.setStyles(exp.loading, { left: l, top: t, zIndex: hs.zIndexCounter++ })} 1254 , 100); 1255 }, 1256 1257 imageCreate : function() { 1258 var exp = this; 1259 1260 var img = document.createElement('img'); 1261 this.content = img; 1262 img.onload = function () { 1263 if (hs.expanders[exp.key]) exp.contentLoaded(); 1264 }; 1265 if (hs.blockRightClick) img.oncontextmenu = function() { return false; }; 1266 img.className = 'highslide-image'; 1267 hs.setStyles(img, { 1268 visibility: 'hidden', 1269 display: 'block', 1270 position: 'absolute', 1271 maxWidth: '9999px', 1272 zIndex: 3 1273 }); 1274 img.title = hs.lang.restoreTitle; 1275 if (hs.safari && hs.uaVersion < 525) hs.container.appendChild(img); 1276 if (hs.ie && hs.flushImgSize) img.src = null; 1277 img.src = this.src; 1278 1279 this.showLoading(); 1280 }, 1281 1282 htmlCreate : function () { 1283 1284 this.content = hs.getCacheBinding(this.a); 1285 if (!this.content) 1286 this.content = hs.getNode(this.contentId); 1287 if (!this.content) 1288 this.content = hs.getSelfRendered(); 1289 this.getInline(['maincontent']); 1290 if (this.maincontent) { 1291 var body = hs.getElementByClass(this.content, 'div', 'highslide-body'); 1292 if (body) body.appendChild(this.maincontent); 1293 this.maincontent.style.display = 'block'; 1294 } 1295 1296 var innerContent = this.innerContent = this.content; 1297 1298 if (/(swf|iframe)/.test(this.objectType)) this.setObjContainerSize(innerContent); 1299 1300 // the content tree 1301 hs.container.appendChild(this.wrapper); 1302 hs.setStyles( this.wrapper, { 1303 position: 'static', 1304 padding: '0 '+ hs.marginRight +'px 0 '+ hs.marginLeft +'px' 1305 }); 1306 this.content = hs.createElement( 1307 'div', { 1308 className: 'highslide-html' 1309 }, { 1310 position: 'relative', 1311 zIndex: 3, 1312 height: 0, 1313 overflow: 'hidden' 1314 }, 1315 this.wrapper 1316 ); 1317 this.mediumContent = hs.createElement('div', null, null, this.content, 1); 1318 this.mediumContent.appendChild(innerContent); 1319 1320 hs.setStyles (innerContent, { 1321 position: 'relative', 1322 display: 'block', 1323 direction: hs.lang.cssDirection || '' 1324 }); 1325 if (this.width) innerContent.style.width = this.width +'px'; 1326 if (this.height) hs.setStyles(innerContent, { 1327 height: this.height +'px', 1328 overflow: 'hidden' 1329 }); 1330 if (innerContent.offsetWidth < this.minWidth) 1331 innerContent.style.width = this.minWidth +'px'; 1332 1333 1334 1335 if (this.objectType == 'ajax' && !hs.getCacheBinding(this.a)) { 1336 this.showLoading(); 1337 var exp = this; 1338 var ajax = new hs.Ajax(this.a, innerContent); 1339 ajax.src = this.src; 1340 ajax.onLoad = function () { if (hs.expanders[exp.key]) exp.contentLoaded(); }; 1341 ajax.onError = function () { location.href = exp.src; }; 1342 ajax.run(); 1343 } 1344 else 1345 1346 if (this.objectType == 'iframe' && this.objectLoadTime == 'before') { 1347 this.writeExtendedContent(); 1348 } 1349 else 1350 this.contentLoaded(); 1351 }, 1352 1353 contentLoaded : function() { 1354 try { 1355 if (!this.content) return; 1356 this.content.onload = null; 1357 if (this.onLoadStarted) return; 1358 else this.onLoadStarted = true; 1359 1360 var x = this.x, y = this.y; 1361 1362 if (this.loading) { 1363 hs.setStyles(this.loading, { top: '-9999px' }); 1364 this.loading = null; 1365 } 1366 if (this.isImage) { 1367 x.full = this.content.width; 1368 y.full = this.content.height; 1369 1370 hs.setStyles(this.content, { 1371 width: x.t +'px', 1372 height: y.t +'px' 1373 }); 1374 this.wrapper.appendChild(this.content); 1375 hs.container.appendChild(this.wrapper); 1376 } else if (this.htmlGetSize) this.htmlGetSize(); 1377 1378 x.calcBorders(); 1379 y.calcBorders(); 1380 1381 hs.setStyles (this.wrapper, { 1382 left: (x.tpos + x.tb - x.cb) +'px', 1383 top: (y.tpos + x.tb - y.cb) +'px' 1384 }); 1385 this.getOverlays(); 1386 1387 var ratio = x.full / y.full; 1388 x.calcExpanded(); 1389 this.justify(x); 1390 1391 y.calcExpanded(); 1392 this.justify(y); 1393 if (this.isHtml) this.htmlSizeOperations(); 1394 if (this.overlayBox) this.sizeOverlayBox(0, 1); 1395 1396 1397 if (this.allowSizeReduction) { 1398 if (this.isImage) 1399 this.correctRatio(ratio); 1400 else this.fitOverlayBox(); 1401 if (this.isImage && this.x.full > (this.x.imgSize || this.x.size)) { 1402 this.createFullExpand(); 1403 if (this.overlays.length == 1) this.sizeOverlayBox(); 1404 } 1405 } 1406 this.show(); 1407 1408 } catch (e) { 1409 this.error(e); 1410 } 1411 }, 1412 1413 1414 setObjContainerSize : function(parent, auto) { 1415 var c = hs.getElementByClass(parent, 'DIV', 'highslide-body'); 1416 if (/(iframe|swf)/.test(this.objectType)) { 1417 if (this.objectWidth) c.style.width = this.objectWidth +'px'; 1418 if (this.objectHeight) c.style.height = this.objectHeight +'px'; 1419 } 1420 }, 1421 1422 writeExtendedContent : function () { 1423 if (this.hasExtendedContent) return; 1424 var exp = this; 1425 this.body = hs.getElementByClass(this.innerContent, 'DIV', 'highslide-body'); 1426 if (this.objectType == 'iframe') { 1427 this.showLoading(); 1428 var ruler = hs.clearing.cloneNode(1); 1429 this.body.appendChild(ruler); 1430 this.newWidth = this.innerContent.offsetWidth; 1431 if (!this.objectWidth) this.objectWidth = ruler.offsetWidth; 1432 var hDiff = this.innerContent.offsetHeight - this.body.offsetHeight, 1433 h = this.objectHeight || hs.page.height - hDiff - hs.marginTop - hs.marginBottom, 1434 onload = this.objectLoadTime == 'before' ? 1435 ' onload="if (hs.expanders['+ this.key +']) hs.expanders['+ this.key +'].contentLoaded()" ' : ''; 1436 this.body.innerHTML += '<iframe name="hs'+ (new Date()).getTime() +'" frameborder="0" key="'+ this.key +'" ' 1437 +' style="width:'+ this.objectWidth +'px; height:'+ h +'px" ' 1438 + onload +' src="'+ this.src +'" ></iframe>'; 1439 this.ruler = this.body.getElementsByTagName('div')[0]; 1440 this.iframe = this.body.getElementsByTagName('iframe')[0]; 1441 1442 if (this.objectLoadTime == 'after') this.correctIframeSize(); 1443 1444 } 1445 if (this.objectType == 'swf') { 1446 this.body.id = this.body.id || 'hs-flash-id-' + this.key; 1447 var a = this.swfOptions; 1448 if (!a.params) a.params = {}; 1449 if (typeof a.params.wmode == 'undefined') a.params.wmode = 'transparent'; 1450 if (swfobject) swfobject.embedSWF(this.src, this.body.id, this.objectWidth, this.objectHeight, 1451 a.version || '7', a.expressInstallSwfurl, a.flashvars, a.params, a.attributes); 1452 } 1453 this.hasExtendedContent = true; 1454 }, 1455 htmlGetSize : function() { 1456 if (this.iframe && !this.objectHeight) { // loadtime before 1457 this.iframe.style.height = this.body.style.height = this.getIframePageHeight() +'px'; 1458 } 1459 this.innerContent.appendChild(hs.clearing); 1460 if (!this.x.full) this.x.full = this.innerContent.offsetWidth; 1461 this.y.full = this.innerContent.offsetHeight; 1462 this.innerContent.removeChild(hs.clearing); 1463 if (hs.ie && this.newHeight > parseInt(this.innerContent.currentStyle.height)) { // ie css bug 1464 this.newHeight = parseInt(this.innerContent.currentStyle.height); 1465 } 1466 hs.setStyles( this.wrapper, { position: 'absolute', padding: '0'}); 1467 hs.setStyles( this.content, { width: this.x.t +'px', height: this.y.t +'px'}); 1468 1469 }, 1470 1471 getIframePageHeight : function() { 1472 var h; 1473 try { 1474 var doc = this.iDoc = this.iframe.contentDocument || this.iframe.contentWindow.document; 1475 var clearing = doc.createElement('div'); 1476 clearing.style.clear = 'both'; 1477 doc.body.appendChild(clearing); 1478 h = clearing.offsetTop; 1479 if (hs.ie) h += parseInt(doc.body.currentStyle.marginTop) 1480 + parseInt(doc.body.currentStyle.marginBottom) - 1; 1481 } catch (e) { // other domain 1482 h = 300; 1483 } 1484 return h; 1485 }, 1486 correctIframeSize : function () { 1487 var wDiff = this.innerContent.offsetWidth - this.ruler.offsetWidth; 1488 hs.discardElement(this.ruler); 1489 if (wDiff < 0) wDiff = 0; 1490 1491 var hDiff = this.innerContent.offsetHeight - this.iframe.offsetHeight; 1492 if (this.iDoc && !this.objectHeight && !this.height && this.y.size == this.y.full) try { 1493 this.iDoc.body.style.overflow = 'hidden'; 1494 } catch (e) {} 1495 hs.setStyles(this.iframe, { 1496 width: Math.abs(this.x.size - wDiff) +'px', 1497 height: Math.abs(this.y.size - hDiff) +'px' 1498 }); 1499 hs.setStyles(this.body, { 1500 width: this.iframe.style.width, 1501 height: this.iframe.style.height 1502 }); 1503 1504 this.scrollingContent = this.iframe; 1505 this.scrollerDiv = this.scrollingContent; 1506 1507 }, 1508 htmlSizeOperations : function () { 1509 1510 this.setObjContainerSize(this.innerContent); 1511 1512 1513 if (this.objectType == 'swf' && this.objectLoadTime == 'before') this.writeExtendedContent(); 1514 1515 // handle minimum size 1516 if (this.x.size < this.x.full && !this.allowWidthReduction) this.x.size = this.x.full; 1517 if (this.y.size < this.y.full && !this.allowHeightReduction) this.y.size = this.y.full; 1518 this.scrollerDiv = this.innerContent; 1519 hs.setStyles(this.mediumContent, { 1520 position: 'relative', 1521 width: this.x.size +'px' 1522 }); 1523 hs.setStyles(this.innerContent, { 1524 border: 'none', 1525 width: 'auto', 1526 height: 'auto' 1527 }); 1528 var node = hs.getElementByClass(this.innerContent, 'DIV', 'highslide-body'); 1529 if (node && !/(iframe|swf)/.test(this.objectType)) { 1530 var cNode = node; // wrap to get true size 1531 node = hs.createElement(cNode.nodeName, null, {overflow: 'hidden'}, null, true); 1532 cNode.parentNode.insertBefore(node, cNode); 1533 node.appendChild(hs.clearing); // IE6 1534 node.appendChild(cNode); 1535 1536 var wDiff = this.innerContent.offsetWidth - node.offsetWidth; 1537 var hDiff = this.innerContent.offsetHeight - node.offsetHeight; 1538 node.removeChild(hs.clearing); 1539 1540 var kdeBugCorr = hs.safari || navigator.vendor == 'KDE' ? 1 : 0; // KDE repainting bug 1541 hs.setStyles(node, { 1542 width: (this.x.size - wDiff - kdeBugCorr) +'px', 1543 height: (this.y.size - hDiff) +'px', 1544 overflow: 'auto', 1545 position: 'relative' 1546 } 1547 ); 1548 if (kdeBugCorr && cNode.offsetHeight > node.offsetHeight) { 1549 node.style.width = (parseInt(node.style.width) + kdeBugCorr) + 'px'; 1550 } 1551 this.scrollingContent = node; 1552 this.scrollerDiv = this.scrollingContent; 1553 } 1554 if (this.iframe && this.objectLoadTime == 'before') this.correctIframeSize(); 1555 if (!this.scrollingContent && this.y.size < this.mediumContent.offsetHeight) this.scrollerDiv = this.content; 1556 1557 if (this.scrollerDiv == this.content && !this.allowWidthReduction && !/(iframe|swf)/.test(this.objectType)) { 1558 this.x.size += 17; // room for scrollbars 1559 } 1560 if (this.scrollerDiv && this.scrollerDiv.offsetHeight > this.scrollerDiv.parentNode.offsetHeight) { 1561 setTimeout("try { hs.expanders["+ this.key +"].scrollerDiv.style.overflow = 'auto'; } catch(e) {}", 1562 hs.expandDuration); 1563 } 1564 }, 1565 1566 justify : function (p, moveOnly) { 1567 var tgtArr, tgt = p.target, dim = p == this.x ? 'x' : 'y'; 1568 1569 var hasMovedMin = false; 1570 1571 var allowReduce = p.exp.allowSizeReduction; 1572 p.pos = Math.round(p.pos - ((p.get('wsize') - p.t) / 2)); 1573 if (p.pos < p.scroll + p.marginMin) { 1574 p.pos = p.scroll + p.marginMin; 1575 hasMovedMin = true; 1576 } 1577 if (!moveOnly && p.size < p.minSize) { 1578 p.size = p.minSize; 1579 allowReduce = false; 1580 } 1581 if (p.pos + p.get('wsize') > p.scroll + p.clientSize - p.marginMax) { 1582 if (!moveOnly && hasMovedMin && allowReduce) { 1583 p.size = Math.min(p.size, p.get(dim == 'y' ? 'fitsize' : 'maxsize')); 1584 } else if (p.get('wsize') < p.get('fitsize')) { 1585 p.pos = p.scroll + p.clientSize - p.marginMax - p.get('wsize'); 1586 } else { // image larger than viewport 1587 p.pos = p.scroll + p.marginMin; 1588 if (!moveOnly && allowReduce) p.size = p.get(dim == 'y' ? 'fitsize' : 'maxsize'); 1589 } 1590 } 1591 1592 if (!moveOnly && p.size < p.minSize) { 1593 p.size = p.minSize; 1594 allowReduce = false; 1595 } 1596 1597 1598 1599 if (p.pos < p.marginMin) { 1600 var tmpMin = p.pos; 1601 p.pos = p.marginMin; 1602 1603 if (allowReduce && !moveOnly) p.size = p.size - (p.pos - tmpMin); 1604 1605 } 1606 }, 1607 1608 correctRatio : function(ratio) { 1609 var x = this.x, 1610 y = this.y, 1611 changed = false, 1612 xSize = Math.min(x.full, x.size), 1613 ySize = Math.min(y.full, y.size), 1614 useBox = (this.useBox || hs.padToMinWidth); 1615 1616 if (xSize / ySize > ratio) { // width greater 1617 xSize = ySize * ratio; 1618 if (xSize < x.minSize) { // below minWidth 1619 xSize = x.minSize; 1620 ySize = xSize / ratio; 1621 } 1622 changed = true; 1623 1624 } else if (xSize / ySize < ratio) { // height greater 1625 ySize = xSize / ratio; 1626 changed = true; 1627 } 1628 1629 if (hs.padToMinWidth && x.full < x.minSize) { 1630 x.imgSize = x.full; 1631 y.size = y.imgSize = y.full; 1632 } else if (this.useBox) { 1633 x.imgSize = xSize; 1634 y.imgSize = ySize; 1635 } else { 1636 x.size = xSize; 1637 y.size = ySize; 1638 } 1639 changed = this.fitOverlayBox(this.useBox ? null : ratio, changed); 1640 if (useBox && y.size < y.imgSize) { 1641 y.imgSize = y.size; 1642 x.imgSize = y.size * ratio; 1643 } 1644 if (changed || useBox) { 1645 x.pos = x.tpos - x.cb + x.tb; 1646 x.minSize = x.size; 1647 this.justify(x, true); 1648 1649 y.pos = y.tpos - y.cb + y.tb; 1650 y.minSize = y.size; 1651 this.justify(y, true); 1652 if (this.overlayBox) this.sizeOverlayBox(); 1653 } 1654 1655 1656 }, 1657 fitOverlayBox : function(ratio, changed) { 1658 var x = this.x, y = this.y; 1659 if (this.overlayBox && (this.isImage || this.allowHeightReduction)) { 1660 while (y.size > this.minHeight && x.size > this.minWidth 1661 && y.get('wsize') > y.get('fitsize')) { 1662 y.size -= 10; 1663 if (ratio) x.size = y.size * ratio; 1664 this.sizeOverlayBox(0, 1); 1665 changed = true; 1666 } 1667 } 1668 return changed; 1669 }, 1670 1671 show : function () { 1672 var x = this.x, y = this.y; 1673 this.doShowHide('hidden'); 1674 1675 // Apply size change 1676 this.changeSize( 1677 1, { 1678 wrapper: { 1679 width : x.get('wsize'), 1680 height : y.get('wsize'), 1681 left: x.pos, 1682 top: y.pos 1683 }, 1684 content: { 1685 left: x.p1 + x.get('imgPad'), 1686 top: y.p1 + y.get('imgPad'), 1687 width:x.imgSize ||x.size, 1688 height:y.imgSize ||y.size 1689 } 1690 }, 1691 hs.expandDuration 1692 ); 1693 }, 1694 1695 changeSize : function(up, to, dur) { 1696 1697 if (this.outline && !this.outlineWhileAnimating) { 1698 if (up) this.outline.setPosition(); 1699 else this.outline.destroy( 1700 (this.isHtml && this.preserveContent)); 1701 } 1702 1703 1704 if (!up) this.destroyOverlays(); 1705 1706 var exp = this, 1707 x = exp.x, 1708 y = exp.y, 1709 easing = this.easing; 1710 if (!up) easing = this.easingClose || easing; 1711 var after = up ? 1712 function() { 1713 1714 if (exp.outline) exp.outline.table.style.visibility = "visible"; 1715 setTimeout(function() { 1716 exp.afterExpand(); 1717 }, 50); 1718 } : 1719 function() { 1720 exp.afterClose(); 1721 }; 1722 if (up) hs.setStyles( this.wrapper, { 1723 width: x.t +'px', 1724 height: y.t +'px' 1725 }); 1726 if (up && this.isHtml) { 1727 hs.setStyles(this.wrapper, { 1728 left: (x.tpos - x.cb + x.tb) +'px', 1729 top: (y.tpos - y.cb + y.tb) +'px' 1730 }); 1731 } 1732 if (this.fadeInOut) { 1733 hs.setStyles(this.wrapper, { opacity: up ? 0 : 1 }); 1734 hs.extend(to.wrapper, { opacity: up }); 1735 } 1736 hs.animate( this.wrapper, to.wrapper, { 1737 duration: dur, 1738 easing: easing, 1739 step: function(val, args) { 1740 if (exp.outline && exp.outlineWhileAnimating && args.prop == 'top') { 1741 var fac = up ? args.pos : 1 - args.pos; 1742 var pos = { 1743 w: x.t + (x.get('wsize') - x.t) * fac, 1744 h: y.t + (y.get('wsize') - y.t) * fac, 1745 x: x.tpos + (x.pos - x.tpos) * fac, 1746 y: y.tpos + (y.pos - y.tpos) * fac 1747 }; 1748 exp.outline.setPosition(pos, 0, 1); 1749 } 1750 if (exp.isHtml) { 1751 if (args.prop == 'left') 1752 exp.mediumContent.style.left = (x.pos - val) +'px'; 1753 if (args.prop == 'top') 1754 exp.mediumContent.style.top = (y.pos - val) +'px'; 1755 } 1756 } 1757 }); 1758 hs.animate( this.content, to.content, dur, easing, after); 1759 if (up) { 1760 this.wrapper.style.visibility = 'visible'; 1761 this.content.style.visibility = 'visible'; 1762 if (this.isHtml) this.innerContent.style.visibility = 'visible'; 1763 this.a.className += ' highslide-active-anchor'; 1764 } 1765 }, 1766 1767 1768 1769 1770 afterExpand : function() { 1771 this.isExpanded = true; 1772 this.focus(); 1773 1774 if (this.isHtml && this.objectLoadTime == 'after') this.writeExtendedContent(); 1775 if (this.iframe) { 1776 try { 1777 var exp = this, 1778 doc = this.iframe.contentDocument || this.iframe.contentWindow.document; 1779 hs.addEventListener(doc, 'mousedown', function () { 1780 if (hs.focusKey != exp.key) exp.focus(); 1781 }); 1782 } catch(e) {} 1783 if (hs.ie && typeof this.isClosing != 'boolean') // first open 1784 this.iframe.style.width = (this.objectWidth - 1) +'px'; // hasLayout 1785 } 1786 if (hs.upcoming && hs.upcoming == this.a) hs.upcoming = null; 1787 this.prepareNextOutline(); 1788 var p = hs.page, mX = hs.mouse.x + p.scrollLeft, mY = hs.mouse.y + p.scrollTop; 1789 this.mouseIsOver = this.x.pos < mX && mX < this.x.pos + this.x.get('wsize') 1790 && this.y.pos < mY && mY < this.y.pos + this.y.get('wsize'); 1791 if (this.overlayBox) this.showOverlays(); 1792 1793 }, 1794 1795 1796 prepareNextOutline : function() { 1797 var key = this.key; 1798 var outlineType = this.outlineType; 1799 new hs.Outline(outlineType, 1800 function () { try { hs.expanders[key].preloadNext(); } catch (e) {} }); 1801 }, 1802 1803 1804 preloadNext : function() { 1805 var next = this.getAdjacentAnchor(1); 1806 if (next && next.onclick.toString().match(/hs\.expand/)) 1807 var img = hs.createElement('img', { src: hs.getSrc(next) }); 1808 }, 1809 1810 1811 getAdjacentAnchor : function(op) { 1812 var current = this.getAnchorIndex(), as = hs.anchors.groups[this.slideshowGroup || 'none']; 1813 return (as && as[current + op]) || null; 1814 }, 1815 1816 getAnchorIndex : function() { 1817 var arr = hs.getAnchors().groups[this.slideshowGroup || 'none']; 1818 if (arr) for (var i = 0; i < arr.length; i++) { 1819 if (arr[i] == this.a) return i; 1820 } 1821 return null; 1822 }, 1823 1824 1825 cancelLoading : function() { 1826 hs.discardElement (this.wrapper); 1827 hs.expanders[this.key] = null; 1828 if (this.loading) hs.loading.style.left = '-9999px'; 1829 }, 1830 1831 writeCredits : function () { 1832 this.credits = hs.createElement('a', { 1833 href: hs.creditsHref, 1834 target: hs.creditsTarget, 1835 className: 'highslide-credits', 1836 innerHTML: hs.lang.creditsText, 1837 title: hs.lang.creditsTitle 1838 }); 1839 this.createOverlay({ 1840 overlayId: this.credits, 1841 position: this.creditsPosition || 'top left' 1842 }); 1843 }, 1844 1845 getInline : function(types, addOverlay) { 1846 for (var i = 0; i < types.length; i++) { 1847 var type = types[i], s = null; 1848 if (!this[type +'Id'] && this.thumbsUserSetId) 1849 this[type +'Id'] = type +'-for-'+ this.thumbsUserSetId; 1850 if (this[type +'Id']) this[type] = hs.getNode(this[type +'Id']); 1851 if (!this[type] && !this[type +'Text'] && this[type +'Eval']) try { 1852 s = eval(this[type +'Eval']); 1853 } catch (e) {} 1854 if (!this[type] && this[type +'Text']) { 1855 s = this[type +'Text']; 1856 } 1857 if (!this[type] && !s) { 1858 this[type] = hs.getNode(this.a['_'+ type + 'Id']); 1859 if (!this[type]) { 1860 var next = this.a.nextSibling; 1861 while (next && !hs.isHsAnchor(next)) { 1862 if ((new RegExp('highslide-'+ type)).test(next.className || null)) { 1863 if (!next.id) this.a['_'+ type + 'Id'] = next.id = 'hsId'+ hs.idCounter++; 1864 this[type] = hs.getNode(next.id); 1865 break; 1866 } 1867 next = next.nextSibling; 1868 } 1869 } 1870 } 1871 1872 if (!this[type] && s) this[type] = hs.createElement('div', 1873 { className: 'highslide-'+ type, innerHTML: s } ); 1874 1875 if (addOverlay && this[type]) { 1876 var o = { position: (type == 'heading') ? 'above' : 'below' }; 1877 for (var x in this[type+'Overlay']) o[x] = this[type+'Overlay'][x]; 1878 o.overlayId = this[type]; 1879 this.createOverlay(o); 1880 } 1881 } 1882 }, 1883 1884 1885 // on end move and resize 1886 doShowHide : function(visibility) { 1887 if (hs.hideSelects) this.showHideElements('SELECT', visibility); 1888 if (hs.hideIframes) this.showHideElements('IFRAME', visibility); 1889 if (hs.geckoMac) this.showHideElements('*', visibility); 1890 }, 1891 showHideElements : function (tagName, visibility) { 1892 var els = document.getElementsByTagName(tagName); 1893 var prop = tagName == '*' ? 'overflow' : 'visibility'; 1894 for (var i = 0; i < els.length; i++) { 1895 if (prop == 'visibility' || (document.defaultView.getComputedStyle( 1896 els[i], "").getPropertyValue('overflow') == 'auto' 1897 || els[i].getAttribute('hidden-by') != null)) { 1898 var hiddenBy = els[i].getAttribute('hidden-by'); 1899 if (visibility == 'visible' && hiddenBy) { 1900 hiddenBy = hiddenBy.replace('['+ this.key +']', ''); 1901 els[i].setAttribute('hidden-by', hiddenBy); 1902 if (!hiddenBy) els[i].style[prop] = els[i].origProp; 1903 } else if (visibility == 'hidden') { // hide if behind 1904 var elPos = hs.getPosition(els[i]); 1905 elPos.w = els[i].offsetWidth; 1906 elPos.h = els[i].offsetHeight; 1907 1908 1909 var clearsX = (elPos.x + elPos.w < this.x.get('opos') 1910 || elPos.x > this.x.get('opos') + this.x.get('osize')); 1911 var clearsY = (elPos.y + elPos.h < this.y.get('opos') 1912 || elPos.y > this.y.get('opos') + this.y.get('osize')); 1913 var wrapperKey = hs.getWrapperKey(els[i]); 1914 if (!clearsX && !clearsY && wrapperKey != this.key) { // element falls behind image 1915 if (!hiddenBy) { 1916 els[i].setAttribute('hidden-by', '['+ this.key +']'); 1917 els[i].origProp = els[i].style[prop]; 1918 els[i].style[prop] = 'hidden'; 1919 1920 } else if (hiddenBy.indexOf('['+ this.key +']') == -1) { 1921 els[i].setAttribute('hidden-by', hiddenBy + '['+ this.key +']'); 1922 } 1923 } else if ((hiddenBy == '['+ this.key +']' || hs.focusKey == wrapperKey) 1924 && wrapperKey != this.key) { // on move 1925 els[i].setAttribute('hidden-by', ''); 1926 els[i].style[prop] = els[i].origProp || ''; 1927 } else if (hiddenBy && hiddenBy.indexOf('['+ this.key +']') > -1) { 1928 els[i].setAttribute('hidden-by', hiddenBy.replace('['+ this.key +']', '')); 1929 } 1930 1931 } 1932 } 1933 } 1934 }, 1935 1936 focus : function() { 1937 this.wrapper.style.zIndex = hs.zIndexCounter += 2; 1938 // blur others 1939 for (var i = 0; i < hs.expanders.length; i++) { 1940 if (hs.expanders[i] && i == hs.focusKey) { 1941 var blurExp = hs.expanders[i]; 1942 blurExp.content.className += ' highslide-'+ blurExp.contentType +'-blur'; 1943 if (blurExp.isImage) { 1944 blurExp.content.style.cursor = hs.ieLt7 ? 'hand' : 'pointer'; 1945 blurExp.content.title = hs.lang.focusTitle; 1946 } 1947 } 1948 } 1949 1950 // focus this 1951 if (this.outline) this.outline.table.style.zIndex 1952 = this.wrapper.style.zIndex - 1; 1953 this.content.className = 'highslide-'+ this.contentType; 1954 if (this.isImage) { 1955 this.content.title = hs.lang.restoreTitle; 1956 1957 if (hs.restoreCursor) { 1958 hs.styleRestoreCursor = window.opera ? 'pointer' : 'url('+ hs.graphicsDir + hs.restoreCursor +'), pointer'; 1959 if (hs.ieLt7 && hs.uaVersion < 6) hs.styleRestoreCursor = 'hand'; 1960 this.content.style.cursor = hs.styleRestoreCursor; 1961 } 1962 } 1963 hs.focusKey = this.key; 1964 hs.addEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler); 1965 }, 1966 moveTo: function(x, y) { 1967 this.x.setPos(x); 1968 this.y.setPos(y); 1969 }, 1970 resize : function (e) { 1971 var w, h, r = e.width / e.height; 1972 w = Math.max(e.width + e.dX, Math.min(this.minWidth, this.x.full)); 1973 if (this.isImage && Math.abs(w - this.x.full) < 12) w = this.x.full; 1974 h = this.isHtml ? e.height + e.dY : w / r; 1975 if (h < Math.min(this.minHeight, this.y.full)) { 1976 h = Math.min(this.minHeight, this.y.full); 1977 if (this.isImage) w = h * r; 1978 } 1979 this.resizeTo(w, h); 1980 }, 1981 resizeTo: function(w, h) { 1982 this.y.setSize(h); 1983 this.x.setSize(w); 1984 this.wrapper.style.height = this.y.get('wsize') +'px'; 1985 }, 1986 1987 close : function() { 1988 if (this.isClosing || !this.isExpanded) return; 1989 this.isClosing = true; 1990 1991 hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler); 1992 1993 try { 1994 if (this.isHtml) this.htmlPrepareClose(); 1995 this.content.style.cursor = 'default'; 1996 this.changeSize( 1997 0, { 1998 wrapper: { 1999 width : this.x.t, 2000 height : this.y.t, 2001 left: this.x.tpos - this.x.cb + this.x.tb, 2002 top: this.y.tpos - this.y.cb + this.y.tb 2003 }, 2004 content: { 2005 left: 0, 2006 top: 0, 2007 width: this.x.t, 2008 height: this.y.t 2009 } 2010 }, hs.restoreDuration 2011 ); 2012 } catch (e) { this.afterClose(); } 2013 }, 2014 2015 htmlPrepareClose : function() { 2016 if (hs.geckoMac) { // bad redraws 2017 if (!hs.mask) hs.mask = hs.createElement('div', null, 2018 { position: 'absolute' }, hs.container); 2019 hs.setStyles(hs.mask, { width: this.x.size +'px', height: this.y.size +'px', 2020 left: this.x.pos +'px', top: this.y.pos +'px', display: 'block' }); 2021 } 2022 if (this.objectType == 'swf') try { hs.$(this.body.id).StopPlay(); } catch (e) {} 2023 2024 if (this.objectLoadTime == 'after' && !this.preserveContent) this.destroyObject(); 2025 if (this.scrollerDiv && this.scrollerDiv != this.scrollingContent) 2026 this.scrollerDiv.style.overflow = 'hidden'; 2027 }, 2028 2029 destroyObject : function () { 2030 if (hs.ie && this.iframe) 2031 try { this.iframe.contentWindow.document.body.innerHTML = ''; } catch (e) {} 2032 if (this.objectType == 'swf') swfobject.removeSWF(this.body.id); 2033 this.body.innerHTML = ''; 2034 }, 2035 2036 sleep : function() { 2037 if (this.outline) this.outline.table.style.display = 'none'; 2038 this.releaseMask = null; 2039 this.wrapper.style.display = 'none'; 2040 this.isExpanded = false; 2041 hs.push(hs.sleeping, this); 2042 }, 2043 2044 awake : function() {try { 2045 2046 hs.expanders[this.key] = this; 2047 2048 if (!hs.allowMultipleInstances &&hs.focusKey != this.key) { 2049 try { hs.expanders[hs.focusKey].close(); } catch (e){} 2050 } 2051 2052 var z = hs.zIndexCounter++, stl = { display: '', zIndex: z }; 2053 hs.setStyles (this.wrapper, stl); 2054 this.isClosing = false; 2055 2056 var o = this.outline || 0; 2057 if (o) { 2058 if (!this.outlineWhileAnimating) stl.visibility = 'hidden'; 2059 hs.setStyles (o.table, stl); 2060 } 2061 2062 this.show(); 2063 } catch (e) {} 2064 2065 2066 }, 2067 2068 createOverlay : function (o) { 2069 var el = o.overlayId; 2070 if (typeof el == 'string') el = hs.getNode(el); 2071 if (o.html) el = hs.createElement('div', { innerHTML: o.html }); 2072 if (!el || typeof el == 'string') return; 2073 el.style.display = 'block'; 2074 this.genOverlayBox(); 2075 var width = o.width && /^[0-9]+(px|%)$/.test(o.width) ? o.width : 'auto'; 2076 if (/^(left|right)panel$/.test(o.position) && !/^[0-9]+px$/.test(o.width)) width = '200px'; 2077 var overlay = hs.createElement( 2078 'div', { 2079 id: 'hsId'+ hs.idCounter++, 2080 hsId: o.hsId 2081 }, { 2082 position: 'absolute', 2083 visibility: 'hidden', 2084 width: width, 2085 direction: hs.lang.cssDirection || '', 2086 opacity: 0 2087 },this.overlayBox, 2088 true 2089 ); 2090 2091 overlay.appendChild(el); 2092 hs.extend(overlay, { 2093 opacity: 1, 2094 offsetX: 0, 2095 offsetY: 0, 2096 dur: (o.fade === 0 || o.fade === false || (o.fade == 2 && hs.ie)) ? 0 : 250 2097 }); 2098 hs.extend(overlay, o); 2099 2100 2101 if (this.gotOverlays) { 2102 this.positionOverlay(overlay); 2103 if (!overlay.hideOnMouseOut || this.mouseIsOver) 2104 hs.animate(overlay, { opacity: overlay.opacity }, overlay.dur); 2105 } 2106 hs.push(this.overlays, hs.idCounter - 1); 2107 }, 2108 positionOverlay : function(overlay) { 2109 var p = overlay.position || 'middle center', 2110 offX = overlay.offsetX, 2111 offY = overlay.offsetY; 2112 if (overlay.parentNode != this.overlayBox) this.overlayBox.appendChild(overlay); 2113 if (/left$/.test(p)) overlay.style.left = offX +'px'; 2114 2115 if (/center$/.test(p)) hs.setStyles (overlay, { 2116 left: '50%', 2117 marginLeft: (offX - Math.round(overlay.offsetWidth / 2)) +'px' 2118 }); 2119 2120 if (/right$/.test(p)) overlay.style.right = - offX +'px'; 2121 2122 if (/^leftpanel$/.test(p)) { 2123 hs.setStyles(overlay, { 2124 right: '100%', 2125 marginRight: this.x.cb +'px', 2126 top: - this.y.cb +'px', 2127 bottom: - this.y.cb +'px', 2128 overflow: 'auto' 2129 }); 2130 this.x.p1 = overlay.offsetWidth; 2131 2132 } else if (/^rightpanel$/.test(p)) { 2133 hs.setStyles(overlay, { 2134 left: '100%', 2135 marginLeft: this.x.cb +'px', 2136 top: - this.y.cb +'px', 2137 bottom: - this.y.cb +'px', 2138 overflow: 'auto' 2139 }); 2140 this.x.p2 = overlay.offsetWidth; 2141 } 2142 2143 if (/^top/.test(p)) overlay.style.top = offY +'px'; 2144 if (/^middle/.test(p)) hs.setStyles (overlay, { 2145 top: '50%', 2146 marginTop: (offY - Math.round(overlay.offsetHeight / 2)) +'px' 2147 }); 2148 if (/^bottom/.test(p)) overlay.style.bottom = - offY +'px'; 2149 if (/^above$/.test(p)) { 2150 hs.setStyles(overlay, { 2151 left: (- this.x.p1 - this.x.cb) +'px', 2152 right: (- this.x.p2 - this.x.cb) +'px', 2153 bottom: '100%', 2154 marginBottom: this.y.cb +'px', 2155 width: 'auto' 2156 }); 2157 this.y.p1 = overlay.offsetHeight; 2158 2159 } else if (/^below$/.test(p)) { 2160 hs.setStyles(overlay, { 2161 position: 'relative', 2162 left: (- this.x.p1 - this.x.cb) +'px', 2163 right: (- this.x.p2 - this.x.cb) +'px', 2164 top: '100%', 2165 marginTop: this.y.cb +'px', 2166 width: 'auto' 2167 }); 2168 this.y.p2 = overlay.offsetHeight; 2169 overlay.style.position = 'absolute'; 2170 } 2171 }, 2172 2173 getOverlays : function() { 2174 this.getInline(['heading', 'caption'], true); 2175 if (this.heading && this.dragByHeading) this.heading.className += ' highslide-move'; 2176 if (hs.showCredits) this.writeCredits(); 2177 for (var i = 0; i < hs.overlays.length; i++) { 2178 var o = hs.overlays[i], tId = o.thumbnailId, sg = o.slideshowGroup; 2179 if ((!tId && !sg) || (tId && tId == this.thumbsUserSetId) 2180 || (sg && sg === this.slideshowGroup)) { 2181 if (this.isImage || (this.isHtml && o.useOnHtml)) 2182 this.createOverlay(o); 2183 } 2184 } 2185 var os = []; 2186 for (var i = 0; i < this.overlays.length; i++) { 2187 var o = hs.$('hsId'+ this.overlays[i]); 2188 if (/panel$/.test(o.position)) this.positionOverlay(o); 2189 else hs.push(os, o); 2190 } 2191 for (var i = 0; i < os.length; i++) this.positionOverlay(os[i]); 2192 this.gotOverlays = true; 2193 }, 2194 genOverlayBox : function() { 2195 if (!this.overlayBox) this.overlayBox = hs.createElement ( 2196 'div', { 2197 className: this.wrapperClassName 2198 }, { 2199 position : 'absolute', 2200 width: (this.x.size || (this.useBox ? this.width : null) 2201 || this.x.full) +'px', 2202 height: (this.y.size || this.y.full) +'px', 2203 visibility : 'hidden', 2204 overflow : 'hidden', 2205 zIndex : hs.ie ? 4 : 'auto' 2206 }, 2207 hs.container, 2208 true 2209 ); 2210 }, 2211 sizeOverlayBox : function(doWrapper, doPanels) { 2212 var overlayBox = this.overlayBox, 2213 x = this.x, 2214 y = this.y; 2215 hs.setStyles( overlayBox, { 2216 width: x.size +'px', 2217 height: y.size +'px' 2218 }); 2219 if (doWrapper || doPanels) { 2220 for (var i = 0; i < this.overlays.length; i++) { 2221 var o = hs.$('hsId'+ this.overlays[i]); 2222 var ie6 = (hs.ieLt7 || document.compatMode == 'BackCompat'); 2223 if (o && /^(above|below)$/.test(o.position)) { 2224 if (ie6) { 2225 o.style.width = (overlayBox.offsetWidth + 2 * x.cb 2226 + x.p1 + x.p2) +'px'; 2227 } 2228 y[o.position == 'above' ? 'p1' : 'p2'] = o.offsetHeight; 2229 } 2230 if (o && ie6 && /^(left|right)panel$/.test(o.position)) { 2231 o.style.height = (overlayBox.offsetHeight + 2* y.cb) +'px'; 2232 } 2233 } 2234 } 2235 if (doWrapper) { 2236 hs.setStyles(this.content, { 2237 top: y.p1 +'px' 2238 }); 2239 hs.setStyles(overlayBox, { 2240 top: (y.p1 + y.cb) +'px' 2241 }); 2242 } 2243 }, 2244 2245 showOverlays : function() { 2246 var b = this.overlayBox; 2247 b.className = ''; 2248 hs.setStyles(b, { 2249 top: (this.y.p1 + this.y.cb) +'px', 2250 left: (this.x.p1 + this.x.cb) +'px', 2251 overflow : 'visible' 2252 }); 2253 if (hs.safari) b.style.visibility = 'visible'; 2254 this.wrapper.appendChild (b); 2255 for (var i = 0; i < this.overlays.length; i++) { 2256 var o = hs.$('hsId'+ this.overlays[i]); 2257 o.style.zIndex = o.zIndex || 4; 2258 if (!o.hideOnMouseOut || this.mouseIsOver) { 2259 o.style.visibility = 'visible'; 2260 hs.setStyles(o, { visibility: 'visible', display: '' }); 2261 hs.animate(o, { opacity: o.opacity }, o.dur); 2262 } 2263 } 2264 }, 2265 2266 destroyOverlays : function() { 2267 if (!this.overlays.length) return; 2268 if (this.isHtml && this.preserveContent) { 2269 this.overlayBox.style.top = '-9999px'; 2270 hs.container.appendChild(this.overlayBox); 2271 } else 2272 hs.discardElement(this.overlayBox); 2273 }, 2274 2275 2276 2277 createFullExpand : function () { 2278 this.fullExpandLabel = hs.createElement( 2279 'a', { 2280 href: 'javascript:hs.expanders['+ this.key +'].doFullExpand();', 2281 title: hs.lang.fullExpandTitle, 2282 className: 'highslide-full-expand' 2283 } 2284 ); 2285 2286 this.createOverlay({ 2287 overlayId: this.fullExpandLabel, 2288 position: hs.fullExpandPosition, 2289 hideOnMouseOut: true, 2290 opacity: hs.fullExpandOpacity 2291 }); 2292 }, 2293 2294 doFullExpand : function () { 2295 try { 2296 if (this.fullExpandLabel) hs.discardElement(this.fullExpandLabel); 2297 2298 this.focus(); 2299 var xSize = this.x.size; 2300 this.resizeTo(this.x.full, this.y.full); 2301 2302 var xpos = this.x.pos - (this.x.size - xSize) / 2; 2303 if (xpos < hs.marginLeft) xpos = hs.marginLeft; 2304 2305 this.moveTo(xpos, this.y.pos); 2306 this.doShowHide('hidden'); 2307 2308 } catch (e) { 2309 this.error(e); 2310 } 2311 }, 2312 2313 2314 afterClose : function () { 2315 this.a.className = this.a.className.replace('highslide-active-anchor', ''); 2316 2317 this.doShowHide('visible'); 2318 2319 if (this.isHtml && this.preserveContent) { 2320 this.sleep(); 2321 } else { 2322 if (this.outline && this.outlineWhileAnimating) this.outline.destroy(); 2323 2324 hs.discardElement(this.wrapper); 2325 } 2326 if (hs.mask) hs.mask.style.display = 'none'; 2327 2328 hs.expanders[this.key] = null; 2329 hs.reOrder(); 2330 } 2331 2332 }; 2333 2334 2335 // hs.Ajax object prototype 2336 hs.Ajax = function (a, content, pre) { 2337 this.a = a; 2338 this.content = content; 2339 this.pre = pre; 2340 }; 2341 2342 hs.Ajax.prototype = { 2343 run : function () { 2344 var xhr; 2345 if (!this.src) this.src = hs.getSrc(this.a); 2346 if (this.src.match('#')) { 2347 var arr = this.src.split('#'); 2348 this.src = arr[0]; 2349 this.id = arr[1]; 2350 } 2351 if (hs.cachedGets[this.src]) { 2352 this.cachedGet = hs.cachedGets[this.src]; 2353 if (this.id) this.getElementContent(); 2354 else this.loadHTML(); 2355 return; 2356 } 2357 try { xhr = new XMLHttpRequest(); } 2358 catch (e) { 2359 try { xhr = new ActiveXObject("Msxml2.XMLHTTP"); } 2360 catch (e) { 2361 try { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } 2362 catch (e) { this.onError(); } 2363 } 2364 } 2365 var pThis = this; 2366 xhr.onreadystatechange = function() { 2367 if(pThis.xhr.readyState == 4) { 2368 if (pThis.id) pThis.getElementContent(); 2369 else pThis.loadHTML(); 2370 } 2371 }; 2372 var src = this.src; 2373 this.xhr = xhr; 2374 if (hs.forceAjaxReload) 2375 src = src.replace(/$/, (/\?/.test(src) ? '&' : '?') +'dummy='+ (new Date()).getTime()); 2376 xhr.open('GET', src, true); 2377 xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); 2378 xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 2379 xhr.send(null); 2380 }, 2381 2382 getElementContent : function() { 2383 hs.init(); 2384 var attribs = window.opera || hs.ie6SSL ? { src: 'about:blank' } : null; 2385 2386 this.iframe = hs.createElement('iframe', attribs, 2387 { position: 'absolute', top: '-9999px' }, hs.container); 2388 2389 this.loadHTML(); 2390 }, 2391 2392 loadHTML : function() { 2393 var s = this.cachedGet || this.xhr.responseText, 2394 regBody; 2395 if (this.pre) hs.cachedGets[this.src] = s; 2396 if (!hs.ie || hs.uaVersion >= 5.5) { 2397 s = s.replace(new RegExp('<link[^>]*>', 'gi'), '') 2398 .replace(new RegExp('<script[^>]*>.*?</script>', 'gi'), ''); 2399 if (this.iframe) { 2400 var doc = this.iframe.contentDocument; 2401 if (!doc && this.iframe.contentWindow) doc = this.iframe.contentWindow.document; 2402 if (!doc) { // Opera 2403 var pThis = this; 2404 setTimeout(function() { pThis.loadHTML(); }, 25); 2405 return; 2406 } 2407 doc.open(); 2408 doc.write(s); 2409 doc.close(); 2410 try { s = doc.getElementById(this.id).innerHTML; } catch (e) { 2411 try { s = this.iframe.document.getElementById(this.id).innerHTML; } catch (e) {} // opera 2412 } 2413 hs.discardElement(this.iframe); 2414 } else { 2415 regBody = /(<body[^>]*>|<\/body>)/ig; 2416 if (regBody.test(s)) s = s.split(regBody)[hs.ieLt9 ? 1 : 2]; 2417 2418 } 2419 } 2420 hs.getElementByClass(this.content, 'DIV', 'highslide-body').innerHTML = s; 2421 this.onLoad(); 2422 for (var x in this) this[x] = null; 2423 } 2424 }; 2425 hs.langDefaults = hs.lang; 2426 // history 2427 var HsExpander = hs.Expander; 2428 if (hs.ie && window == window.top) { 2429 (function () { 2430 try { 2431 document.documentElement.doScroll('left'); 2432 } catch (e) { 2433 setTimeout(arguments.callee, 50); 2434 return; 2435 } 2436 hs.ready(); 2437 })(); 2438 } 2439 hs.addEventListener(document, 'DOMContentLoaded', hs.ready); 2440 hs.addEventListener(window, 'load', hs.ready); 2441 2442 // set handlers 2443 hs.addEventListener(document, 'ready', function() { 2444 if (hs.expandCursor) { 2445 var style = hs.createElement('style', { type: 'text/css' }, null, 2446 document.getElementsByTagName('HEAD')[0]); 2447 2448 function addRule(sel, dec) { 2449 if (hs.ie && hs.uaVersion < 9) { 2450 var last = document.styleSheets[document.styleSheets.length - 1]; 2451 if (typeof(last.addRule) == "object") last.addRule(sel, dec); 2452 } else { 2453 style.appendChild(document.createTextNode(sel + " {" + dec + "}")); 2454 } 2455 } 2456 function fix(prop) { 2457 return 'expression( ( ( ignoreMe = document.documentElement.'+ prop + 2458 ' ? document.documentElement.'+ prop +' : document.body.'+ prop +' ) ) + \'px\' );'; 2459 } 2460 if (hs.expandCursor) addRule ('.highslide img', 2461 'cursor: url('+ hs.graphicsDir + hs.expandCursor +'), pointer !important;'); 2462 } 2463 }); 2464 hs.addEventListener(window, 'resize', function() { 2465 hs.getPageSize(); 2466 }); 2467 hs.addEventListener(document, 'mousemove', function(e) { 2468 hs.mouse = { x: e.clientX, y: e.clientY }; 2469 }); 2470 hs.addEventListener(document, 'mousedown', hs.mouseClickHandler); 2471 hs.addEventListener(document, 'mouseup', hs.mouseClickHandler); 2472 2473 hs.addEventListener(document, 'ready', hs.getAnchors); 2474 hs.addEventListener(window, 'load', hs.preloadImages); 2475 hs.addEventListener(window, 'load', hs.preloadAjax); 2476 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |