PageSourceSearch

https://viknaodessa.od.ua/highslide/highslide.js

js viknaodessa.od.ua collected 2026-10-02 22:04:20 UTC 50,396 bytes, 1,882 lines download raw bytes

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

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.