PageSourceSearch

http://www.danceuniverse.ru/js/highslide.js

js danceuniverse.ru collected 2026-10-05 00:15:52 UTC 98,992 bytes, 3,293 lines download raw bytes

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

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.