highslide.js 94 KB

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