PageSourceSearch

https://www.yoshitakeshika.com/cmn/js/highslide/highslide-with-gallery.js

js yoshitakeshika.com collected 2026-10-05 11:12:45 UTC 65,939 bytes, 2,297 lines download raw bytes

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

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.