highslide-with-gallery.js 73 KB

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