highslide-full.js 95 KB

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