PageSourceSearch

https://tk-unpretei.com/js/highslide/highslide-with-html.js

js tk-unpretei.com collected 2026-10-07 06:07:09 UTC 64,397 bytes, 2,272 lines download raw bytes

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

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.