PageSourceSearch

https://xn--24-6kcca2hd6be1b.xn--p1ai/highslide/highslide-with-html.js

js xn--24-6kcca2hd6be1b.xn--p1ai collected 2026-10-03 20:02:31 UTC 69,273 bytes, 2,475 lines download raw bytes

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

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.