PageSourceSearch

https://dancsalo.github.io/js/highslide.js

js dancsalo.github.io collected 2026-10-03 08:51:58 UTC 52,591 bytes, 1,889 lines download raw bytes

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

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.