dc4cd443959e3c8c9ea18e914d9a81e9ab94a787.svn-base 69 KB

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