4c28e7d599279954d2f7ea203c6e5e69f08edc31.svn-base 94 KB

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