PageSourceSearch

https://www.geofun.info/js/public/highslide/highslide-full.js

js geofun.info collected 2026-09-24 10:55:49 UTC 96,774 bytes, 3,320 lines download raw bytes

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

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.