highslide-with-html.js 68 KB

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