PageSourceSearch

https://www.omda.bg/gallery/functions/highslide-with-html.js

js omda.bg collected 2026-10-02 10:03:51 UTC 70,542 bytes, 4,843 lines download raw bytes

1var hs = {
2
3// Language strings
4
5lang : {
6
7	cssDirection: 'ltr',
8
9	loadingText : 'Loading...',
10
11	loadingTitle : 'Click to cancel',
12
13	focusTitle : 'Click to bring to front',
14
15	fullExpandTitle : 'Expand to actual size (f)',
16
17	creditsText : 'Omda',
18
19	creditsTitle : 'Go to the Omda\'s homepage',
20
21	previousText : 'Previous',
22
23	nextText : 'Next', 
24
25	moveText : 'Move',
26
27	closeText : 'Close', 
28
29	closeTitle : 'Close (esc)', 
30
31	resizeTitle : 'Resize',
32
33	playText : 'Play',
34
35	playTitle : 'Play slideshow (spacebar)',
36
37	pauseText : 'Pause',
38
39	pauseTitle : 'Pause slideshow (spacebar)',
40
41	previousTitle : 'Previous (arrow left)',
42
43	nextTitle : 'Next (arrow right)',
44
45	moveTitle : 'Move',
46
47	fullExpandText : '1:1',
48
49	restoreTitle : 'Click to close image, click and drag to move. Use arrow keys for next and previous.'
50
51},
52
53// See http://highslide.com/ref for examples of settings  
54
55graphicsDir : 'graphics',
56
57expandCursor : 'zoomin.cur', // null disables
58
59restoreCursor : 'zoomout.cur', // null disables
60
61expandDuration : 250, // milliseconds
62
63restoreDuration : 250,
64
65marginLeft : 15,
66
67marginRight : 15,
68
69marginTop : 15,
70
71marginBottom : 15,
72
73zIndexCounter : 1001, // adjust to other absolutely positioned elements
74
75loadingOpacity : 0.75,
76
77allowMultipleInstances: true,
78
79numberOfImagesToPreload : 5,
80
81outlineWhileAnimating : 2, // 0 = never, 1 = always, 2 = HTML only 
82
83outlineStartOffset : 3, // ends at 10
84
85padToMinWidth : false, // pad the popup width to make room for wide caption
86
87fullExpandPosition : 'bottom right',
88
89fullExpandOpacity : 1,
90
91showCredits : true, // you can set this to false if you want
92
93creditsHref : 'http://Omda.bg/',
94
95creditsTarget : '_self',
96
97enableKeyListener : true,
98
99openerTagNames : ['a'], // Add more to allow slideshow indexing
100
101
102
103allowWidthReduction : false,
104
105allowHeightReduction : true,
106
107preserveContent : true, // Preserve changes made to the content and position of HTML popups.
108
109objectLoadTime : 'before', // Load iframes 'before' or 'after' expansion.
110
111cacheAjax : true, // Cache ajax popups for instant display. Can be overridden for each popup.
112
113dragByHeading: true,
114
115minWidth: 200,
116
117minHeight: 200,
118
119allowSizeReduction: true, // allow the image to reduce to fit client size. If false, this overrides minWidth and minHeight
120
121outlineType : 'drop-shadow', // set null to disable outlines
122
123skin : {
124
125	contentWrapper:
126
127		'<div class="highslide-header"><ul>'+
128
129			'<li class="highslide-previous">'+
130
131				'<a href="#" title="{hs.lang.previousTitle}" onclick="return hs.previous(this)">'+
132
133				'<span>{hs.lang.previousText}</span></a>'+
134
135			'</li>'+
136
137			'<li class="highslide-next">'+
138
139				'<a href="#" title="{hs.lang.nextTitle}" onclick="return hs.next(this)">'+
140
141				'<span>{hs.lang.nextText}</span></a>'+
142
143			'</li>'+
144
145			'<li class="highslide-move">'+
146
147				'<a href="#" title="{hs.lang.moveTitle}" onclick="return false">'+
148
149				'<span>{hs.lang.moveText}</span></a>'+
150
151			'</li>'+
152
153			'<li class="highslide-close">'+
154
155				'<a href="#" title="{hs.lang.closeTitle}" onclick="return hs.close(this)">'+
156
157				'<span>{hs.lang.closeText}</span></a>'+
158
159			'</li>'+
160
161		'</ul></div>'+
162
163		'<div class="highslide-body"></div>'+
164
165		'<div class="highslide-footer"><div>'+
166
167			'<span class="highslide-resize" title="{hs.lang.resizeTitle}"><span></span></span>'+
168
169		'</div></div>'
170
171},
172
173// END OF YOUR SETTINGS
174
175
176
177
178
179// declare internal properties
180
181preloadTheseImages : [],
182
183continuePreloading: true,
184
185expanders : [],
186
187overrides : [
188
189	'allowSizeReduction',
190
191	'useBox',
192
193	'outlineType',
194
195	'outlineWhileAnimating',
196
197	'captionId',
198
199	'captionText',
200
201	'captionEval',
202
203	'captionOverlay',
204
205	'headingId',
206
207	'headingText',
208
209	'headingEval',
210
211	'headingOverlay',
212
213	'creditsPosition',
214
215	'dragByHeading',
216
217	
218
219	'width',
220
221	'height',
222
223	
224
225	'contentId',
226
227	'allowWidthReduction',
228
229	'allowHeightReduction',
230
231	'preserveContent',
232
233	'maincontentId',
234
235	'maincontentText',
236
237	'maincontentEval',
238
239	'objectType',	
240
241	'cacheAjax',	
242
243	'objectWidth',
244
245	'objectHeight',
246
247	'objectLoadTime',	
248
249	'swfOptions',
250
251	'wrapperClassName',
252
253	'minWidth',
254
255	'minHeight',
256
257	'maxWidth',
258
259	'maxHeight',
260
261	'slideshowGroup',
262
263	'easing',
264
265	'easingClose',
266
267	'fadeInOut',
268
269	'src'
270
271],
272
273overlays : [],
274
275idCounter : 0,
276
277oPos : {
278
279	x: ['leftpanel', 'left', 'center', 'right', 'rightpanel'],
280
281	y: ['above', 'top', 'middle', 'bottom', 'below']
282
283},
284
285mouse: {},
286
287headingOverlay: {},
288
289captionOverlay: {},
290
291swfOptions: { flashvars: {}, params: {}, attributes: {} },
292
293timers : [],
294
295
296
297pendingOutlines : {},
298
299sleeping : [],
300
301preloadTheseAjax : [],
302
303cacheBindings : [],
304
305cachedGets : {},
306
307clones : {},
308
309onReady: [],
310
311uaVersion: parseFloat((navigator.userAgent.toLowerCase().match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1]),
312
313ie : (document.all && !window.opera),
314
315safari : /Safari/.test(navigator.userAgent),
316
317geckoMac : /Macintosh.+rv:1\.[0-8].+Gecko/.test(navigator.userAgent),
318
319
320
321$ : function (id) {
322
323	if (id) return document.getElementById(id);
324
325},
326
327
328
329push : function (arr, val) {
330
331	arr[arr.length] = val;
332
333},
334
335
336
337createElement : function (tag, attribs, styles, parent, nopad) {
338
339	var el = document.createElement(tag);
340
341	if (attribs) hs.extend(el, attribs);
342
343	if (nopad) hs.setStyles(el, {padding: 0, border: 'none', margin: 0});
344
345	if (styles) hs.setStyles(el, styles);
346
347	if (parent) parent.appendChild(el);	
348
349	return el;
350
351},
352
353
354
355extend : function (el, attribs) {
356
357	for (var x in attribs) el[x] = attribs[x];
358
359	return el;
360
361},
362
363
364
365setStyles : function (el, styles) {
366
367	for (var x in styles) {
368
369		if (hs.ie && x == 'opacity') {
370
371			if (styles[x] > 0.99) el.style.removeAttribute('filter');
372
373			else el.style.filter = 'alpha(opacity='+ (styles[x] * 100) +')';
374
375		}
376
377		else el.style[x] = styles[x];
378
379	}
380
381},
382
383animate: function(el, prop, opt) {
384
385	var start,
386
387		end,
388
389		unit;
390
391	if (typeof opt != 'object' || opt === null) {
392
393		var args = arguments;
394
395		opt = {
396
397			duration: args[2],
398
399			easing: args[3],
400
401			complete: args[4]
402
403		};
404
405	}
406
407	if (typeof opt.duration != 'number') opt.duration = 250;
408
409	opt.easing = Math[opt.easing] || Math.easeInQuad;
410
411	opt.curAnim = hs.extend({}
411, prop);
412
413	for (var name in prop) {
414
415		var e = new hs.fx(el, opt , name );
416
417		
418
419		start = parseFloat(hs.css(el, name)) || 0;
420
421		end = parseFloat(prop[name]);
422
423		unit = name != 'opacity' ? 'px' : '';
424
425		
426
427		e.custom( start, end, unit );
428
429	}	
430
431},
432
433css: function(el, prop) {
434
435	if (document.defaultView) {
436
437		return document.defaultView.getComputedStyle(el, null).getPropertyValue(prop);
438
439
440
441	} else {
442
443		if (prop == 'opacity') prop = 'filter';
444
445		var val = el.currentStyle[prop.replace(/\-(\w)/g, function (a, b){ return b.toUpperCase(); })];
446
447		if (prop == 'filter') 
448
449			val = val.replace(/alpha\(opacity=([0-9]+)\)/, 
450
451				function (a, b) { return b / 100 });
452
453		return val === '' ? 1 : val;
454
455	} 
456
457},
458
459
460
461getPageSize : function () {
462
463	var d = document, w = window, iebody = d.compatMode && d.compatMode != 'BackCompat' 
464
465		? d.documentElement : d.body;
466
467	
468
469	var width = hs.ie ? iebody.clientWidth : 
470
471			(d.documentElement.clientWidth || self.innerWidth),
472
473		height = hs.ie ? iebody.clientHeight : self.innerHeight;
474
475	
476
477	hs.page = {
478
479		width: width,
480
481		height: height,		
482
483		scrollLeft: hs.ie ? iebody.scrollLeft : pageXOffset,
484
485		scrollTop: hs.ie ? iebody.scrollTop : pageYOffset
486
487	}
488
489},
490
491
492
493getPosition : function(el)	{
494
495	var p = { x: el.offsetLeft, y: el.offsetTop };
496
497	while (el.offsetParent)	{
498
499		el = el.offsetParent;
500
501		p.x += el.offsetLeft;
502
503		p.y += el.offsetTop;
504
505		if (el != document.body && el != document.documentElement) {
506
507			p.x -= el.scrollLeft;
508
509			p.y -= el.scrollTop;
510
511		}
512
513	}
514
515	return p;
516
517},
518
519
520
521expand : function(a, params, custom, type) {
522
523	if (!a) a = hs.createElement('a', null, { display: 'none' }, hs.container);
524
525	if (typeof a.getParams == 'function') return params;
526
527	if (type == 'html') {
528
529		for (var i = 0; i < hs.sleeping.length; i++) {
530
531			if (hs.sleeping[i] && hs.sleeping[i].a == a) {
532
533				hs.sleeping[i].awake();
534
535				hs.sleeping[i] = null;
536
537				return false;
538
539			}
540
541		}
542
543		hs.hasHtmlExpanders = true;
544
545	}	
546
547	try {	
548
549		new hs.Expander(a, params, custom, type);
550
551		return false;
552
553	} catch (e) { return true; }
554
555},
556
557
558
559htmlExpand : function(a, params, custom) {
560
561	return hs.expand(a, params, custom, 'html');
562
563},
564
565
566
567getSelfRendered : function() {
568
569	return hs.createElement('div', { 
570
571		className: 'highslide-html-content', 
572
573		innerHTML: hs.replaceLang(hs.skin.contentWrapper) 
574
575	});
576
577},
578
579getElementByClass : function (el, tagName, className) {
580
581	var els = el.getElementsByTagName(tagName);
582
583	for (var i = 0; i < els.length; i++) {
584
585    	if ((new RegExp(className)).test(els[i].className)) {
586
587			return els[i];
588
589		}
590
591	}
592
593	return null;
594
595},
596
597replaceLang : function(s) {
598
599	s = s.replace(/\s/g, ' ');
600
601	var re = /{hs\.lang\.([^}]+)\}/g,
602
603		matches = s.match(re),
604
605		lang;
606
607	if (matches) for (var i = 0; i < matches.length; i++) {
608
609		lang = matches[i].replace(re, "$1");
610
611		if (typeof hs.lang[lang] != 'undefined') s = s.replace(matches[i], hs.lang[lang]);
612
613	}
614
615	return s;
616
617},
618
619
620
621
622
623getCacheBinding : function (a) {
624
625	for (var i = 0; i < hs.cacheBindings.length; i++) {
626
627		if (hs.cacheBindings[i][0] == a) {
628
629			var c = hs.cacheBindings[i][1];
630
631			hs.cacheBindings[i][1] = c.cloneNode(1);
632
633			return c;
634
635		}
636
637	}
638
639	return null;
640
641},
642
643
644
645preloadAjax : function (e) {
646
647	var arr = hs.getAnchors();
648
649	for (var i = 0; i < arr.htmls.length; i++) {
650
651		var a = arr.htmls[i];
652
653		if (hs.getParam(a, 'objectType') == 'ajax' && hs.getParam(a, 'cacheAjax'))
654
655			hs.push(hs.preloadTheseAjax, a);
656
657	}
658
659	
660
661	hs.preloadAjaxElement(0);
662
663},
664
665
666
667preloadAjaxElement : function (i) {
668
669	if (!hs.preloadTheseAjax[i]) return;
670
671	var a = hs.preloadTheseAjax[i];
672
673	var cache = hs.getNode(hs.getParam(a, 'contentId'));
674
675	if (!cache) cache = hs.getSelfRendered();
676
677	var ajax = new hs.Ajax(a, cache, 1);	
678
679   	ajax.onError = function () { };
680
681   	ajax.onLoad = function () {
682
683   		hs.push(hs.cacheBindings, [a, cache]);
684
685   		hs.preloadAjaxElement(i + 1);
686
687   	};
688
689   	ajax.run();
690
691},
692
693
694
695focusTopmost : function() {
696
697	var topZ = 0, 
698
699		topmostKey = -1,
700
701		expanders = hs.expanders,
702
703		exp,
704
705		zIndex;
706
707	for (var i = 0; i < expanders.length; i++) {
708
709		exp = expanders[i];
710
711		if (exp) {
712
713			zIndex = exp.wrapper.style.zIndex;
714
715			if (zIndex && zIndex > topZ) {
716
717				topZ = zIndex;				
718
719				topmostKey = i;
720
721			}
722
723		}
724
725	}
726
727	if (topmostKey == -1) hs.focusKey = -1;
728
729	else expanders[topmostKey].focus();
730
731},
732
733
734
735getParam : function (a, param) {
736
737	a.getParams = a.onclick;
738
739	var p = a.getParams ? a.getParams() : null;
740
741	a.getParams = null;
742
743	
744
745	return (p && typeof p[param] != 'undefined') ? p[param] : 
746
747		(typeof hs[param] != 'undefined' ? hs[param] : null);
748
749},
750
751
752
753getSrc : function (a) {
754
755	var src = hs.getParam(a, 'src');
756
757	if (src) return src;
758
759	return a.href;
760
761},
762
763
764
765getNode : function (id) {
766
767	var node = hs.$(id), clone = hs.clones[id], a = {};
768
769	if (!node && !clone) return null;
770
771	if (!clone) {
772
773		clone = node.cloneNode(true);
774
775		clone.id = '';
776
777		hs.clones[id] = clone;
778
779		return node;
780
781	} else {
782
783		return clone.cloneNode(true);
784
785	}
786
787},
788
789
790
791discardElement : function(d) {
792
793	if (d) hs.garbageBin.appendChild(d);
794
795	hs.garbageBin.innerHTML = '';
796
797},
798
799transit : function (adj, exp) {
800
801	var last = exp = exp || hs.getExpander();
802
803	if (hs.upcoming) return false;
804
805	else hs.last = last;
806
807	try {
808
809		hs.upcoming = adj;
810
811		adj.onclick(); 		
812
813	} catch (e){
814
815		hs.last = hs.upcoming = null;
816
817	}
818
819	try {
820
821		exp.close();
822
823	} catch (e) {}
824
825	return false;
826
827},
828
829
830
831previousOrNext : function (el, op) {
832
833	var exp = hs.getExpander(el);
834
835	if (exp) {
836
837		adj = exp.getAdjacentAnchor(op);
838
839		return hs.transit(adj, exp);
840
841	} else return false;
842
843},
844
845
846
847previous : function (el) {
848
849	return hs.previousOrNext(el, -1);
850
851},
852
853
854
855next : function (el) {
856
857	return hs.previousOrNext(el, 1);	
858
859},
860
861
862
863keyHandler : function(e) {
864
865	if (!e) e = window.event;
866
867	if (!e.target) e.target = e.srcElement; // ie
868
869	if (typeof e.target.form != 'undefined') return true; // form element has focus
870
871	var exp = hs.getExpander();
872
873	
874
875	var op = null;
876
877	switch (e.keyCode) {
878
879		case 70: // f
880
881			if (exp) exp.doFullExpand();
882
883			return true;
884
885		case 32: // Space
886
887		case 34: // Page Down
888
889		case 39: // Arrow right
890
891		case 40: // Arrow down
892
893			op = 1;
894
895			break;
896
897		case 8:  // Backspace
898
899		case 33: // Page Up
900
901		case 37: // Arrow left
902
903		case 38: // Arrow up
904
905			op = -1;
906
907			break;
908
909		case 27: // Escape
910
911		case 13: // Enter
912
913			op = 0;
914
915	}
916
917	if (op !== null) {hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);
918
919		if (!hs.enableKeyListener) return true;
920
921		
922
923		if (e.preventDefault) e.preventDefault();
924
925    	else e.returnValue = false;
926
927    	if (exp) {
928
929			if (op == 0) {
930
931				exp.close();
932
933			} else {
934
935				hs.previousOrNext(exp.key, op);
936
937			}
938
939			return false;
940
941		}
942
943	}
944
945	return true;
946
947},
948
949
950
951
952
953registerOverlay : function (overlay) {
954
955	hs.push(hs.overlays, hs.extend(overlay, { hsId: 'hsId'+ hs.idCounter++ } ));
956
957},
958
959
960
961
962
963getWrapperKey : function (element, expOnly) {
964
965	var el, re = /^highslide-wrapper-([0-9]+)$/;
966
967	// 1. look in open expanders
968
969	el = element;
970
971	while (el.parentNode)	{
972
973		if (el.id && re.test(el.id)) return el.id.replace(re, "$1");
974
975		el = el.parentNode;
976
977	}
978
979	// 2. look in thumbnail
980
981	if (!expOnly) {
982
983		el = element;
984
985		while (el.parentNode)	{
986
987			if (el.tagName && hs.isHsAnchor(el)) {
988
989				for (var key = 0; key < hs.expanders.length; key++) {
990
991					var exp = hs.expanders[key];
992
993					if (exp && exp.a == el) return key;
994
995				}
996
997			}
998
999			el = el.parentNode;
1000
1001		}
1002
1003	}
1004
1005	return null; 
1006
1007},
1008
1009
1010
1011getExpander : function (el, expOnly) {
1012
1013	if (typeof el == 'undefined') return hs.expanders[hs.focusKey] || null;
1014
1015	if (typeof el == 'number') return hs.expanders[el] || null;
1016
1017	if (typeof el == 'string') el = hs.$(el);
1018
1019	return hs.expanders[hs.getWrapperKey(el, expOnly)] || null;
1020
1021},
1022
1023
1024
1025isHsAnchor : function (a) {
1026
1027	return (a.onclick && a.onclick.toString().replace(/\s/g, ' ').match(/hs.(htmlE|e)xpand/));
1028
1029},
1030
1031
1032
1033reOrder : function () {
1034
1035	for (var i = 0; i < hs.expanders.length; i++)
1036
1037		if (hs.expanders[i] && hs.expanders[i].isExpanded) hs.focusTopmost();
1038
1039},
1040
1041
1042
1043mouseClickHandler : function(e) 
1044
1045{	
1046
1047	if (!e) e = window.event;
1048
1049	if (e.button > 1) return true;
1050
1051	if (!e.target) e.target = e.srcElement;
1052
1053	
1054
1055	var el = e.target;
1056
1057	while (el.parentNode
1058
1059		&& !(/highslide-(image|move|html|resize)/.test(el.className)))
1060
1061	{
1062
1063		el = el.parentNode;
1064
1065	}
1066
1067	var exp = hs.getExpander(el);
1068
1069	if (exp && (exp.isClosing || !exp.isExpanded)) return true;
1070
1071		
1072
1073	if (exp && e.type == 'mousedown') {
1074
1075		if (e.target.form) return true;
1076
1077		var match = el.className.match(/highslide-(image|move|resize)/);
1078
1079		if (match) {
1080
1081			hs.dragArgs = { exp: exp , type: match[1], left: exp.x.pos, width: exp.x.size, top: exp.y.pos, 
1082
1083				height: exp.y.size, clickX: e.clientX, clickY: e.clientY };
1084
1085			
1086
1087			
1088
1089			hs.addEventListener(document, 'mousemove', hs.dragHandler);
1090
1091			if (e.preventDefault) e.preventDefault(); // FF
1092
1093			
1094
1095			if (/highslide-(image|html)-blur/.test(exp.content.className)) {
1096
1097				exp.focus();
1098
1099				hs.hasFocused = true;
1100
1101			}
1102
1103			return false;
1104
1105		}
1106
1107		else if (/highslide-html/.test(el.className) && hs.focusKey != exp.key) {
1108
1109			exp.focus();
1110
1111			exp.doShowHide('hidden');
1112
1113		}
1114
1115	} else if (e.type == 'mouseup') {
1116
1117		
1118
1119		hs.removeEventListener(document, 'mousemove', hs.dragHandler);
1120
1121		
1122
1123		if (hs.dragArgs) {
1124
1125			if (hs.styleRestoreCursor && hs.dragArgs.type == 'image') 
1126
1127				hs.dragArgs.exp.content.style.cursor = hs.styleRestoreCursor;
1128
1129			var hasDragged = hs.dragArgs.hasDragged;
1130
1131			
1132
1133			if (!hasDragged &&!hs.hasFocused && !/(move|resize)/.test(hs.dragArgs.type)) {
1134
1135				exp.close();
1136
1137			} 
1138
1139			else if (hasDragged || (!hasDragged && hs.hasHtmlExpanders)) {
1140
1141				hs.dragArgs.exp.doShowHide('hidden');
1142
1143			}
1144
1145			
1146
1147			if (hs.dragArgs.exp.releaseMask) 
1148
1149				hs.dragArgs.exp.releaseMask.style.display = 'none';
1150
1151			
1152
1153			hs.hasFocused = false;
1154
1155			hs.dragArgs = null;
1156
1157		
1158
1159		} else if (/highslide-image-blur/.test(el.className)) {
1160
1161			el.style.cursor = hs.styleRestoreCursor;		
1162
1163		}
1164
1165	}
1166
1167	return false;
1168
1169},
1170
1171
1172
1173dragHandler : function(e)
1174
1175{
1176
1177	if (!hs.dragArgs) return true;
1178
1179	if (!e) e = window.event;
1180
1181	var a = hs.dragArgs, exp = a.exp;
1182
1183	if (exp.iframe) {		
1184
1185		if (!exp.releaseMask) exp.releaseMask = hs.createElement('div', null, 
1186
1187			{ position: 'absolute', width: exp.x.size+'px', height: exp.y.size+'px', 
1188
1189				left: exp.x.cb+'px', top: exp.y.cb+'px', zIndex: 4,	background: (hs.ie ? 'white' : 'none'), 
1190
1191				opacity: .01 }, 
1192
1193			exp.wrapper, true);
1194
1195		if (exp.releaseMask.style.display == 'none')
1196
1197			exp.releaseMask.style.display = '';
1198
1199	}
1200
1201	
1202
1203	a.dX = e.clientX - a.clickX;
1204
1205	a.dY = e.clientY - a.clickY;	
1206
1207	
1208
1209	var distance = Math.sqrt(Math.pow(a.dX, 2) + Math.pow(a.dY, 2));
1210
1211	if (!a.hasDragged) a.hasDragged = (a.type != 'image' && distance > 0)
1212
1213		|| (distance > (hs.dragSensitivity || 5));
1214
1215	
1216
1217	if (a.hasDragged && e.clientX > 5 && e.clientY > 5) {
1218
1219		
1220
1221		if (a.type == 'resize') exp.resize(a);
1222
1223		else {
1224
1225			exp.moveTo(a.left + a.dX, a.top + a.dY);
1226
1227			if (a.type == 'image') exp.content.style.cursor = 'move';
1228
1229		}
1230
1231	}
1232
1233	return false;
1234
1235},
1236
1237
1238
1239wrapperMouseHandler : function (e) {
1240
1241	try {
1242
1243		if (!e) e = window.event;
1244
1245		var over = /mouseover/i.test(e.type); 
1246
1247		if (!e.target) e.target = e.srcElement; // ie
1248
1249		if (hs.ie) e.relatedTarget = 
1250
1251			over ? e.fromElement : e.toElement; // ie
1252
1253		var exp = hs.getExpander(e.target);
1254
1255		if (!exp.isExpanded) return;
1256
1257		if (!exp || !e.relatedTarget || hs.getExpander(e.relatedTarget, true) == exp 
1258
1259			|| hs.dragArgs) return;
1260
1261		for (var i = 0; i < exp.overlays.length; i++) (function() {
1262
1263			var o = hs.$('hsId'+ exp.overlays[i]);
1264
1265			if (o && o.hideOnMouseOut) {
1266
1267				if (over) hs.setStyles(o, { visibility: 'visible', display: '' });
1268
1269				hs.animate(o, { opacity: over ? o.opacity : 0 }, o.dur);
1270
1271			}
1272
1273		})();	
1274
1275	} catch (e) {}
1276
1277},
1278
1279addEventListener : function (el, event, func) {
1280
1281	if (el == document && event == 'ready') hs.push(hs.onReady, func);
1282
1283	try {
1284
1285		el.addEventListener(event, func, false);
1286
1287	} catch (e) {
1288
1289		try {
1290
1291			el.detachEvent('on'+ event, func);
1292
1293			el.attachEvent('on'+ event, func);
1294
1295		} catch (e) {
1296
1297			el['on'+ event] = func;
1298
1299		}
1300
1301	} 
1302
1303},
1304
1305
1306
1307removeEventListener : function (el, event, func) {
1308
1309	try {
1310
1311		el.removeEventListener(event, func, false);
1312
1313	} catch (e) {
1314
1315		try {
1316
1317			el.detachEvent('on'+ event, func);
1318
1319		} catch (e) {
1320
1321			el['on'+ event] = null;
1322
1323		}
1324
1325	}
1326
1327},
1328
1329
1330
1331preloadFullImage : function (i) {
1332
1333	if (hs.continuePreloading && hs.preloadTheseImages[i] && hs.preloadTheseImages[i] != 'undefined') {
1334
1335		var img = document.createElement('img');
1336
1337		img.onload = function() { 
1338
1339			img = null;
1340
1341			hs.preloadFullImage(i + 1);
1342
1343		};
1344
1345		img.src = hs.preloadTheseImages[i];
1346
1347	}
1348
1349},
1350
1351preloadImages : function (number) {
1352
1353	if (number && typeof number != 'object') hs.numberOfImagesToPreload = number;
1354
1355	
1356
1357	var arr = hs.getAnchors();
1358
1359	for (var i = 0; i < arr.images.length && i < hs.numberOfImagesToPreload; i++) {
1360
1361		hs.push(hs.preloadTheseImages, hs.getSrc(arr.images[i]));
1362
1363	}
1364
1365	
1366
1367	// preload outlines
1368
1369	if (hs.outlineType)	new hs.Outline(hs.outlineType, function () { hs.preloadFullImage(0)} );
1370
1371	else
1372
1373	
1374
1375	hs.preloadFullImage(0);
1376
1377	
1378
1379	// preload cursor
1380
1381	if (hs.restoreCursor) var cur = hs.createElement('img', { src: hs.graphicsDir + hs.restoreCursor });
1382
1383},
1384
1385
1386
1387
1388
1389init : function () {
1390
1391	if (!hs.container) {
1392
1393	
1394
1395		hs.getPageSize();
1396
1397		hs.ieLt7 = hs.ie && hs.uaVersion < 7;
1398
1399		hs.ie6SSL = hs.ieLt7 && location.protocol == 'https:';
1400
1401		for (var x in hs.langDefaults) {
1402
1403			if (typeof hs[x] != 'undefined') hs.lang[x] = hs[x];
1404
1405			else if (typeof hs.lang[x] == 'undefined' && typeof hs.langDefaults[x] != 'undefined') 
1406
1407				hs.lang[x] = hs.langDefaults[x];
1408
1409		}
1410
1411		
1412
1413		hs.container = hs.createElement('div', {
1414
1415				className: 'highslide-container'
1416
1417			}, {
1418
1419				position: 'absolute', 
1420
1421				left: 0, 
1422
1423				top: 0, 
1424
1425				width: '100%', 
1426
1427				zIndex: hs.zIndexCounter,
1428
1429				direction: 'ltr'
1430
1431			}, 
1432
1433			document.body,
1434
1435			true
1436
1437		);
1438
1439		hs.loading = hs.createElement('a', {
1440
1441				className: 'highslide-loading',
1442
1443				title: hs.lang.loadingTitle,
1444
1445				innerHTML: hs.lang.loadingText,
1446
1447				href: 'javascript:;'
1448
1449			}, {
1450
1451				position: 'absolute',
1452
1453				top: '-9999px',
1454
1455				opacity: hs.loadingOpacity,
1456
1457				zIndex: 1
1458
1459			}, hs.container
1460
1461		);
1462
1463		hs.garbageBin = hs.createElement('div', null, { display: 'none' }, hs.container);
1464
1465		hs.clearing = hs.createElement('div', null, 
1466
1467			{ clear: 'both', paddingTop: '1px' }, null, true);
1468
1469		
1470
1471		// http://www.robertpenner.com/easing/ 
1472
1473		Math.linearTween = function (t, b, c, d) {
1474
1475			return c*t/d + b;
1476
1477		};
1478
1479		Math.easeInQuad = function (t, b, c, d) {
1480
1481			return c*(t/=d)*t + b;
1482
1483		};
1484
1485		
1486
1487		hs.hideSelects = hs.ieLt7;
1488
1489		hs.hideIframes = ((window.opera && hs.uaVersion < 9) || navigator.vendor == 'KDE' 
1490
1491			|| (hs.ie && hs.uaVersion < 5.5));
1492
1493	}
1494
1495},
1496
1497ready : function() {
1498
1499	if (hs.isReady) return;
1500
1501	hs.isReady = true;
1502
1503	
1504
1505	for (var i = 0; i < hs.onReady.length; i++) hs.onReady[i]();
1506
1507},
1508
1509
1510
1511updateAnchors : function() {
1512
1513	var el, els, all = [], images = [], htmls = [],groups = {}, re;
1514
1515		
1516
1517	for (var i = 0; i < hs.openerTagNames.length; i++) {
1518
1519		els = document.getElementsByTagName(hs.openerTagNames[i]);
1520
1521		for (var j = 0; j < els.length; j++) {
1522
1523			el = els[j];
1524
1525			re = hs.isHsAnchor(el);
1526
1527			if (re) {
1528
1529				hs.push(all, el);
1530
1531				if (re[0] == 'hs.expand') hs.push(images, el);
1532
1533				else if (re[0] == 'hs.htmlExpand') hs.push(htmls, el);
1534
1535				var g = hs.getParam(el, 'slideshowGroup') || 'none';
1536
1537				if (!groups[g]) groups[g] = [];
1538
1539				hs.push(groups[g], el);
1540
1541			}
1542
1543		}
1544
1545	}
1546
1547	hs.anchors = { all: all, groups: groups, images: images, htmls: htmls };
1548
1549	return hs.anchors;
1550
1551	
1552
1553},
1554
1555
1556
1557getAnchors : function() {
1558
1559	return hs.anchors || hs.updateAnchors();
1560
1561},
1562
1563
1564
1565
1566
1567close : function(el) {
1568
1569	var exp = hs.getExpander(el);
1570
1571	if (exp) exp.close();
1572
1573	return false;
1574
1575}
1576
1577}; // end hs object
1578
1579hs.fx = function( elem, options, prop ){
1580
1581	this.options = options;
1582
1583	this.elem = elem;
1584
1585	this.prop = prop;
1586
1587
1588
1589	if (!options.orig) options.orig = {};
1590
1591};
1592
1593hs.fx.prototype = {
1594
1595	update: function(){
1596
1597		(hs.fx.step[this.prop] || hs.fx.step._default)(this);
1598
1599		
1600
1601		if (this.options.step)
1602
1603			this.options.step.call(this.elem, this.now, this);
1604
1605
1606
1607	},
1608
1609	custom: function(from, to, unit){
1610
1611		this.startTime = (new Date()).getTime();
1612
1613		this.start = from;
1614
1615		this.end = to;
1616
1617		this.unit = unit;// || this.unit || "px";
1618
1619		this.now = this.start;
1620
1621		this.pos = this.state = 0;
1622
1623
1624
1625		var self = this;
1626
1627		function t(gotoEnd){
1628
1629			return self.step(gotoEnd);
1630
1631		}
1632
1633
1634
1635		t.elem = this.elem;
1636
1637
1638
1639		if ( t() && hs.timers.push(t) == 1 ) {
1640
1641			hs.timerId = setInterval(function(){
1642
1643				var timers = hs.timers;
1644
1645
1646
1647				for ( var i = 0; i < timers.length; i++ )
1648
1649					if ( !timers[i]() )
1650
1651						timers.splice(i--, 1);
1652
1653
1654
1655				if ( !timers.length ) {
1656
1657					clearInterval(hs.timerId);
1658
1659				}
1660
1661			}, 13);
1662
1663		}
1664
1665	},
1666
1667	step: function(gotoEnd){
1668
1669		var t = (new Date()).getTime();
1670
1671		if ( gotoEnd || t >= this.options.duration + this.startTime ) {
1672
1673			this.now = this.end;
1674
1675			this.pos = this.state = 1;
1676
1677			this.update();
1678
1679
1680
1681			this.options.curAnim[ this.prop ] = true;
1682
1683
1684
1685			var done = true;
1686
1687			for ( var i in this.options.curAnim )
1688
1689				if ( this.options.curAnim[i] !== true )
1690
1691					done = false;
1692
1693
1694
1695			if ( done ) {
1696
1697				if (this.options.complete) this.options.complete.call(this.elem);
1698
1699			}
1700
1701			return false;
1702
1703		} else {
1704
1705			var n = t - this.startTime;
1706
1707			this.state = n / this.options.duration;
1708
1709			this.pos = this.options.easing(n, 0, 1, this.options.duration);
1710
1711			this.now = this.start + ((this.end - this.start) * this.pos);
1712
1713			this.update();
1714
1715		}
1716
1717		return true;
1718
1719	}
1720
1721
1722
1723};
1724
1725
1726
1727hs.extend( hs.fx, {
1728
1729	step: {
1730
1731
1732
1733		opacity: function(fx){
1734
1735			hs.setStyles(fx.elem, { opacity: fx.now });
1736
1737		},
1738
1739
1740
1741		_default: function(fx){
1742
1743			if ( fx.elem.style && fx.elem.style[ fx.prop ] != null )
1744
1745				fx.elem.style[ fx.prop ] = fx.now + fx.unit;
1746
1747			else
1748
1749				fx.elem[ fx.prop ] = fx.now;
1750
1751		}
1752
1753	}
1754
1755});
1756
1757
1758
1759hs.Outline =  function (outlineType, onLoad) {
1760
1761	this.onLoad = onLoad;
1762
1763	this.outlineType = outlineType;
1764
1765	var v = hs.uaVersion, tr;
1766
1767	
1768
1769	this.hasAlphaImageLoader = hs.ie && v >= 5.5 && v < 7;
1770
1771	if (!outlineType) {
1772
1773		if (onLoad) onLoad();
1774
1775		return;
1776
1777	}
1778
1779	
1780
1781	hs.init();
1782
1783	this.table = hs.createElement(
1784
1785		'table', { 
1786
1787			cellSpacing: 0 
1788
1789		}, {
1790
1791			visibility: 'hidden',
1792
1793			position: 'absolute',
1794
1795			borderCollapse: 'collapse',
1796
1797			width: 0
1798
1799		},
1800
1801		hs.container,
1802
1803		true
1804
1805	);
1806
1807	var tbody = hs.createElement('tbody', null, null, this.table, 1);
1808
1809	
1810
1811	this.td = [];
1812
1813	for (var i = 0; i <= 8; i++) {
1814
1815		if (i % 3 == 0) tr = hs.createElement('tr', null, { height: 'auto' }, tbody, true);
1816
1817		this.td[i] = hs.createElement('td', null, null, tr, true);
1818
1819		var style = i != 4 ? { lineHeight: 0, fontSize: 0} : { position : 'relative' };
1820
1821		hs.setStyles(this.td[i], style);
1822
1823	}
1824
1825	this.td[4].className = outlineType +' highslide-outline';
1826
1827	
1828
1829	this.preloadGraphic(); 
1830
1831};
1832
1833
1834
1835hs.Outline.prototype = {
1836
1837preloadGraphic : function () {
1838
1839	var src = hs.graphicsDir + (hs.outlinesDir || "outlines/")+ this.outlineType +".png";
1840
1841				
1842
1843	var appendTo = hs.safari ? hs.container : null;
1844
1845	this.graphic = hs.createElement('img', null, { position: 'absolute', 
1846
1847		top: '-9999px' }, appendTo, true); // for onload trigger
1848
1849	
1850
1851	var pThis = this;
1852
1853	this.graphic.onload = function() { pThis.onGraphicLoad(); };
1854
1855	
1856
1857	this.graphic.src = src;
1858
1859},
1860
1861
1862
1863onGraphicLoad : function () {
1864
1865	var o = this.offset = this.graphic.width / 4,
1866
1867		pos = [[0,0],[0,-4],[-2,0],[0,-8],0,[-2,-8],[0,-2],[0,-6],[-2,-2]],
1868
1869		dim = { height: (2*o) +'px', width: (2*o) +'px' };
1870
1871	for (var i = 0; i <= 8; i++) {
1872
1873		if (pos[i]) {
1874
1875			if (this.hasAlphaImageLoader) {
1876
1877				var w = (i == 1 || i == 7) ? '100%' : this.graphic.width +'px';
1878
1879				var div = hs.createElement('div', null, { width: '100%', height: '100%', position: 'relative', overflow: 'hidden'}, this.td[i], true);
1880
1881				hs.createElement ('div', null, { 
1882
1883						filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale, src='"+ this.graphic.src + "')", 
1884
1885						position: 'absolute',
1886
1887						width: w, 
1888
1889						height: this.graphic.height +'px',
1890
1891						left: (pos[i][0]*o)+'px',
1892
1893						top: (pos[i][1]*o)+'px'
1894
1895					}, 
1896
1897				div,
1898
1899				true);
1900
1901			} else {
1902
1903				hs.setStyles(this.td[i], { background: 'url('+ this.graphic.src +') '+ (pos[i][0]*o)+'px '+(pos[i][1]*o)+'px'});
1904
1905			}
1906
1907			
1908
1909			if (window.opera && (i == 3 || i ==5)) 
1910
1911				hs.createElement('div', null, dim, this.td[i], true);
1912
1913			
1914
1915			hs.setStyles (this.td[i], dim);
1916
1917		}
1918
1919	}
1920
1921	this.graphic = null;
1922
1923	if (hs.pendingOutlines[this.outlineType]) hs.pendingOutlines[this.outlineType].destroy();
1924
1925	hs.pendingOutlines[this.outlineType] = this;
1926
1927	if (this.onLoad) this.onLoad();
1928
1929},
1930
1931	
1932
1933setPosition : function (pos, offset, vis, dur, easing) {
1934
1935	var exp = this.exp,
1936
1937		stl = exp.wrapper.style,
1938
1939		offset = offset || 0,
1940
1941		pos = pos || {
1942
1943			x: exp.x.pos + offset,
1944
1945			y: exp.y.pos + offset,
1946
1947			w: exp.x.get('wsize') - 2 * offset,
1948
1949			h: exp.y.get('wsize') - 2 * offset
1950
1951		};
1952
1953	if (vis) this.table.style.visibility = (pos.h >= 4 * this.offset) 
1954
1955		? 'visible' : 'hidden';
1956
1957	hs.setStyles(this.table, {
1958
1959		left: (pos.x - this.offset) +'px',
1960
1961		top: (pos.y - this.offset) +'px',
1962
1963		width: (pos.w + 2 * this.offset) +'px'
1964
1965	});
1966
1967	
1968
1969	pos.w -= 2 * this.offset;
1970
1971	pos.h -= 2 * this.offset;
1972
1973	hs.setStyles (this.td[4], {
1974
1975		width: pos.w >= 0 ? pos.w +'px' : 0,
1976
1977		height: pos.h >= 0 ? pos.h +'px' : 0
1978
1979	});
1980
1981	if (this.hasAlphaImageLoader) this.td[3].style.height 
1982
1983		= this.td[5].style.height = this.td[4].style.height;	
1984
1985	
1986
1987},
1988
1989	
1990
1991destroy : function(hide) {
1992
1993	if (hide) this.table.style.visibility = 'hidden';
1994
1995	else hs.discardElement(this.table);
1996
1997}
1998
1999};
2000
2001
2002
2003hs.Dimension = function(exp, dim) {
2004
2005	this.exp = exp;
2006
2007	this.dim = dim;
2008
2009	this.ucwh = dim == 'x' ? 'Width' : 'Height';
2010
2011	this.wh = this.ucwh.toLowerCase();
2012
2013	this.uclt = dim == 'x' ? 'Left' : 'Top';
2014
2015	this.lt = this.uclt.toLowerCase();
2016
2017	this.ucrb = dim == 'x' ? 'Right' : 'Bottom';
2018
2019	this.rb = this.ucrb.toLowerCase();
2020
2021	this.p1 = this.p2 = 0;
2022
2023};
2024
2025hs.Dimension.prototype = {
2026
2027get : function(key) {
2028
2029	switch (key) {
2030
2031		case 'loadingPos':
2032
2033			return this.tpos + this.tb + (this.t - hs.loading['offset'+ this.ucwh]) / 2;
2034
2035		case 'wsize':
2036
2037			return this.size + 2 * this.cb + this.p1 + this.p2;
2038
2039		case 'fitsize':
2040
2041			return this.clientSize - this.marginMin - this.marginMax;
2042
2043		case 'maxsize':
2044
2045			return this.get('fitsize') - 2 * this.cb - this.p1 - this.p2 ;
2046
2047		case 'opos':
2048
2049			return this.pos - (this.exp.outline ? this.exp.outline.offset : 0);
2050
2051		case 'osize':
2052
2053			return this.get('wsize') + (this.exp.outline ? 2*this.exp.outline.offset : 0);
2054
2055		case 'imgPad':
2056
2057			return this.imgSize ? Math.round((this.size - this.imgSize) / 2) : 0;
2058
2059		
2060
2061	}
2062
2063},
2064
2065calcBorders: function() {
2066
2067	// correct for borders
2068
2069	this.cb = (this.exp.content['offset'+ this.ucwh] - this.t) / 2;
2070
2071	this.marginMax = hs['margin'+ this.ucrb];
2072
2073},
2074
2075calcThumb: function() {
2076
2077	this.t = this.exp.el[this.wh] ? parseInt(this.exp.el[this.wh]) : 
2078
2079		this.exp.el['offset'+ this.ucwh];
2080
2081	this.tpos = this.exp.tpos[this.dim];
2082
2083	this.tb = (this.exp.el['offset'+ this.ucwh] - this.t) / 2;
2084
2085	if (this.tpos < 1) {
2086
2087		this.tpos = (hs.page[this.wh] / 2) + hs.page['scroll'+ this.uclt];		
2088
2089	};
2090
2091},
2092
2093calcExpanded: function() {
2094
2095	var exp = this.exp;
2096
2097	this.justify = 'auto';
2098
2099	
2100
2101	
2102
2103	// size and position
2104
2105	this.pos = this.tpos - this.cb + this.tb;
2106
2107	this.size = Math.min(this.full, exp['max'+ this.ucwh] || this.full);
2108
2109	this.minSize = exp.allowSizeReduction ? 
2110
2111		Math.min(exp['min'+ this.ucwh], this.full) :this.full;
2112
2113	if (exp.isImage && exp.useBox)	{
2114
2115		this.size = exp[this.wh];
2116
2117		this.imgSize = this.full;
2118
2119	}
2120
2121	if (this.dim == 'x' && hs.padToMinWidth) this.minSize = exp.minWidth;
2122
2123	this.marginMin = hs['margin'+ this.uclt];
2124
2125	this.scroll = hs.page['scroll'+ this.uclt];
2126
2127	this.clientSize = hs.page[this.wh];
2128
2129},
2130
2131setSize: function(i) {
2132
2133	var exp = this.exp;
2134
2135	if (exp.isImage && (exp.useBox || hs.padToMinWidth)) {
2136
2137		this.imgSize = i;
2138
2139		this.size = Math.max(this.size, this.imgSize);
2140
2141		exp.content.style[this.lt] = this.get('imgPad')+'px';
2142
2143	} else
2144
2145	this.size = i;
2146
2147
2148
2149	exp.content.style[this.wh] = i +'px';
2150
2151	exp.wrapper.style[this.wh] = this.get('wsize') +'px';
2152
2153	if (exp.outline) exp.outline.setPosition();
2154
2155	if (exp.releaseMask) exp.releaseMask.style[this.wh] = i +'px';
2156
2157	if (exp.isHtml) {
2158
2159		var d = exp.scrollerDiv;
2160
2161		if (this.sizeDiff === undefined)
2162
2163			this.sizeDiff = exp.innerContent['offset'+ this.ucwh] - d['offset'+ this.ucwh];
2164
2165		d.style[this.wh] = (this.size - this.sizeDiff) +'px';
2166
2167			
2168
2169		if (this.dim == 'x') exp.mediumContent.style.width = 'auto';
2170
2171		if (exp.body) exp.body.style[this.wh] = 'auto';
2172
2173	}
2174
2175	if (this.dim == 'x' && exp.overlayBox) exp.sizeOverlayBox(true);
2176
2177},
2178
2179setPos: function(i) {
2180
2181	this.pos = i;
2182
2183	this.exp.wrapper.style[this.lt] = i +'px';	
2184
2185	
2186
2187	if (this.exp.outline) this.exp.outline.setPosition();
2188
2189	
2190
2191}
2192
2193};
2194
2195
2196
2197hs.Expander = function(a, params, custom, contentType) {
2198
2199	if (document.readyState && hs.ie && !hs.isReady) {
2200
2201		hs.addEventListener(document, 'ready', function() {
2202
2203			new hs.Expander(a, params, custom, contentType);
2204
2205		});
2206
2207		return;
2208
2209	} 
2210
2211	this.a = a;
2212
2213	this.custom = custom;
2214
2215	this.contentType = contentType || 'image';
2216
2217	this.isHtml = (contentType == 'html');
2218
2219	this.isImage = !this.isHtml;
2220
2221	
2222
2223	hs.continuePreloading = false;
2224
2225	this.overlays = [];
2226
2227	hs.init();
2228
2229	var key = this.key = hs.expanders.length;
2230
2231	// override inline parameters
2232
2233	for (var i = 0; i < hs.overrides.length; i++) {
2234
2235		var name = hs.overrides[i];
2236
2237		this[name] = params && typeof params[name] != 'undefined' ?
2238
2239			params[name] : hs[name];
2240
2241	}
2242
2243	if (!this.src) this.src = a.href;
2244
2245	
2246
2247	// get thumb
2248
2249	var el = (params && params.thumbnailId) ? hs.$(params.thumbnailId) : a;
2250
2251	el = this.thumb = el.getElementsByTagName('img')[0] || el;
2252
2253	this.thumbsUserSetId = el.id || a.id;
2254
2255	
2256
2257	// check if already open
2258
2259	for (var i = 0; i < hs.expanders.length; i++) {
2260
2261		if (hs.expanders[i] && hs.expanders[i].a == a) {
2262
2263			hs.expanders[i].focus();
2264
2265			return false;
2266
2267		}
2268
2269	}	
2270
2271
2272
2273	// cancel other
2274
2275	if (!hs.allowSimultaneousLoading) for (var i = 0; i < hs.expanders.length; i++) {
2276
2277		if (hs.expanders[i] && hs.expanders[i].thumb != el && !hs.expanders[i].onLoadStarted) {
2278
2279			hs.expanders[i].cancelLoading();
2280
2281		}
2282
2283	}
2284
2285	hs.expanders[key] = this;
2286
2287	if (!hs.allowMultipleInstances && !hs.upcoming) {
2288
2289		if (hs.expanders[key-1]) hs.expanders[key-1].close();
2290
2291		if (typeof hs.focusKey != 'undefined' && hs.expanders[hs.focusKey])
2292
2293			hs.expanders[hs.focusKey].close();
2294
2295	}
2296
2297	
2298
2299	// initiate metrics
2300
2301	this.el = el;
2302
2303	this.tpos = hs.getPosition(el);
2304
2305	hs.getPageSize();
2306
2307	var x = this.x = new hs.Dimension(this, 'x');
2308
2309	x.calcThumb();
2310
2311	var y = this.y = new hs.Dimension(this, 'y');
2312
2313	y.calcThumb();
2314
2315	this.wrapper = hs.createElement(
2316
2317		'div', {
2318
2319			id: 'highslide-wrapper-'+ this.key,
2320
2321			className: 'highslide-wrapper '+ this.wrapperClassName
2322
2323		}, {
2324
2325			visibility: 'hidden',
2326
2327			position: 'absolute',
2328
2329			zIndex: hs.zIndexCounter += 2
2330
2331		}, null, true );
2332
2333	
2334
2335	this.wrapper.onmouseover = this.wrapper.onmouseout = hs.wrapperMouseHandler;
2336
2337	if (this.contentType == 'image' && this.outlineWhileAnimating == 2)
2338
2339		this.outlineWhileAnimating = 0;
2340
2341	
2342
2343	// get the outline
2344
2345	if (!this.outlineType) {
2346
2347		this[this.contentType +'Create']();
2348
2349	
2350
2351	} else if (hs.pendingOutlines[this.outlineType]) {
2352
2353		this.connectOutline();
2354
2355		this[this.contentType +'Create']();
2356
2357	
2358
2359	} else {
2360
2361		this.showLoading();
2362
2363		var exp = this;
2364
2365		new hs.Outline(this.outlineType, 
2366
2367			function () {
2368
2369				exp.connectOutline();
2370
2371				exp[exp.contentType +'Create']();
2372
2373			} 
2374
2375		);
2376
2377	}
2378
2379	return true;
2380
2381};
2382
2383
2384
2385hs.Expander.prototype = {
2386
2387error : function(e) {
2388
2389	//alert ('Line '+ e.lineNumber +': '+ e.message);
2390
2391	window.location.href = this.src;
2392
2393},
2394
2395
2396
2397connectOutline : function() {
2398
2399	var outline = this.outline = hs.pendingOutlines[this.outlineType];
2400
2401	outline.exp = this;
2402
2403	outline.table.style.zIndex = this.wrapper.style.zIndex - 1;
2404
2405	hs.pendingOutlines[this.outlineType] = null;
2406
2407},
2408
2409
2410
2411showLoading : function() {
2412
2413	if (this.onLoadStarted || this.loading) return;
2414
2415	
2416
2417	this.loading = hs.loading;
2418
2419	var exp = this;
2420
2421	this.loading.onclick = function() {
2422
2423		exp.cancelLoading();
2424
2425	};
2426
2427	var exp = this, 
2428
2429		l = this.x.get('loadingPos') +'px',
2430
2431		t = this.y.get('loadingPos') +'px';
2432
2433	setTimeout(function () { 
2434
2435		if (exp.loading) hs.setStyles(exp.loading, { left: l, top: t, zIndex: hs.zIndexCounter++ })}
2436
2437	, 100);
2438
2439},
2440
2441
2442
2443imageCreate : function() {
2444
2445	var exp = this;
2446
2447	
2448
2449	var img = document.createElement('img');
2450
2451    this.content = img;
2452
2453    img.onload = function () {
2454
2455    	if (hs.expanders[exp.key]) exp.contentLoaded(); 
2456
2457	};
2458
2459    if (hs.blockRightClick) img.oncontextmenu = function() { return false; };
2460
2461    img.className = 'highslide-image';
2462
2463    hs.setStyles(img, {
2464
2465    	visibility: 'hidden',
2466
2467    	display: 'block',
2468
2469    	position: 'absolute',
2470
2471		maxWidth: '9999px',
2472
2473		zIndex: 3
2474
2475	});
2476
2477    img.title = hs.lang.restoreTitle;
2478
2479    if (hs.safari) hs.container.appendChild(img);
2480
2481    if (hs.ie && hs.flushImgSize) img.src = null;
2482
2483	img.src = this.src;
2484
2485	
2486
2487	this.showLoading();
2488
2489},
2490
2491
2492
2493htmlCreate : function () {
2494
2495	
2496
2497	this.content = hs.getCacheBinding(this.a);
2498
2499	if (!this.content) 
2500
2501		this.content = hs.getNode(this.contentId);
2502
2503	if (!this.content) 
2504
2505		this.content = hs.getSelfRendered();
2506
2507	this.getInline(['maincontent']);
2508
2509	if (this.maincontent) {
2510
2511		var body = hs.getElementByClass(this.content, 'div', 'highslide-body');
2512
2513		if (body) body.appendChild(this.maincontent);
2514
2515		this.maincontent.style.display = 'block';
2516
2517	}
2518
2519	
2520
2521	var innerContent = this.innerContent = this.content;
2522
2523	
2524
2525	if (/(swf|iframe)/.test(this.objectType)) this.setObjContainerSize(innerContent);
2526
2527	
2528
2529	// the content tree
2530
2531	hs.container.appendChild(this.wrapper);
2532
2533	hs.setStyles( this.wrapper, { 
2534
2535		position: 'static',
2536
2537		padding: '0 '+ hs.marginRight +'px 0 '+ hs.marginLeft +'px'
2538
2539	});
2540
2541	this.content = hs.createElement(
2542
2543    	'div', {
2544
2545    		className: 'highslide-html' 
2546
2547    	}, {
2548
2549			position: 'relative',
2550
2551			zIndex: 3,
2552
2553			overflow: 'hidden'
2554
2555		},
2556
2557		this.wrapper
2558
2559	);
2560
2561	this.mediumContent = hs.createElement('div', null, null, this.content, 1);
2562
2563	this.mediumContent.appendChild(innerContent);
2564
2565	
2566
2567	hs.setStyles (innerContent, { 
2568
2569		position: 'relative',
2570
2571		display: 'block',
2572
2573		direction: hs.lang.cssDirection || ''
2574
2575	});
2576
2577	if (this.width) innerContent.style.width = this.width +'px';
2578
2579	if (this.height) hs.setStyles(innerContent, {
2580
2581		height: this.height +'px',
2582
2583		overflow: 'hidden'
2584
2585	});
2586
2587	if (innerContent.offsetWidth < this.minWidth)
2588
2589		innerContent.style.width = this.minWidth +'px';
2590
2591		
2592
2593	
2594
2595    
2596
2597	if (this.objectType == 'ajax' && !hs.getCacheBinding(this.a)) {
2598
2599		this.showLoading();
2600
2601    	var ajax = new hs.Ajax(this.a, innerContent);
2602
2603    	var exp = this;
2604
2605    	ajax.onLoad = function () {	if (hs.expanders[exp.key]) exp.contentLoaded(); };
2606
2607    	ajax.onError = function () { location.href = exp.src; };
2608
2609    	ajax.run();
2610
2611	}
2612
2613    else
2614
2615    
2616
2617    if (this.objectType == 'iframe' && this.objectLoadTime == 'before') {
2618
2619		this.writeExtendedContent();
2620
2621	}
2622
2623    else
2624
2625    	this.contentLoaded();
2626
2627},
2628
2629
2630
2631contentLoaded : function() {
2632
2633	try {	
2634
2635		if (!this.content) return;
2636
2637		this.content.onload = null;
2638
2639		if (this.onLoadStarted) return;
2640
2641		else this.onLoadStarted = true;
2642
2643		
2644
2645		var x = this.x, y = this.y;
2646
2647		
2648
2649		if (this.loading) {
2650
2651			hs.setStyles(this.loading, { top: '-9999px' });
2652
2653			this.loading = null;
2654
2655		}
2656
2657		if (this.isImage) {	
2658
2659			x.full = this.content.width;
2660
2661			y.full = this.content.height;
2662
2663			
2664
2665			hs.setStyles(this.content, {
2666
2667				width: x.t +'px',
2668
2669				height: y.t +'px'
2670
2671			});
2672
2673			this.wrapper.appendChild(this.content);
2674
2675			hs.container.appendChild(this.wrapper);
2676
2677		} else if (this.htmlGetSize) this.htmlGetSize();
2678
2679		
2680
2681		x.calcBorders();
2682
2683		y.calcBorders();
2684
2685		
2686
2687		hs.setStyles (this.wrapper, {
2688
2689			left: (x.tpos + x.tb - x.cb) +'px',
2690
2691			top: (y.tpos + x.tb - y.cb) +'px'
2692
2693		});
2694
2695		this.getOverlays();
2696
2697		
2698
2699		var ratio = x.full / y.full;
2700
2701		
2702
2703		x.calcExpanded();
2704
2705		this.justify(x);
2706
2707		
2708
2709		y.calcExpanded();
2710
2711		this.justify(y);
2712
2713		if (this.isHtml) this.htmlSizeOperations();
2714
2715		if (this.overlayBox) this.sizeOverlayBox(0, 1);
2716
2717		
2718
2719		if (this.allowSizeReduction) {
2720
2721			if (this.isImage)
2722
2723				this.correctRatio(ratio);
2724
2725			else this.fitOverlayBox();
2726
2727			if (this.isImage && this.x.full > (this.x.imgSize || this.x.size)) {
2728
2729				this.createFullExpand();
2730
2731				if (this.overlays.length == 1) this.sizeOverlayBox();
2732
2733			}
2734
2735		}
2736
2737		this.show();
2738
2739		
2740
2741	} catch (e) {
2742
2743		this.error(e);
2744
2745	}
2746
2747},
2748
2749
2750
2751
2752
2753setObjContainerSize : function(parent, auto) {
2754
2755	var c = hs.getElementByClass(parent, 'DIV', 'highslide-body');
2756
2757	if (/(iframe|swf)/.test(this.objectType)) {
2758
2759		if (this.objectWidth) c.style.width = this.objectWidth +'px';
2760
2761		if (this.objectHeight) c.style.height = this.objectHeight +'px';
2762
2763	}
2764
2765},
2766
2767
2768
2769writeExtendedContent : function () {
2770
2771	if (this.hasExtendedContent) return;
2772
2773	var exp = this;
2774
2775	this.body = hs.getElementByClass(this.innerContent, 'DIV', 'highslide-body');
2776
2777	if (this.objectType == 'iframe') {
2778
2779		this.showLoading();
2780
2781		var ruler = hs.clearing.cloneNode(1);
2782
2783		this.body.appendChild(ruler);
2784
2785		this.newWidth = this.innerContent.offsetWidth;
2786
2787		if (!this.objectWidth) this.objectWidth = ruler.offsetWidth;
2788
2789		var hDiff = this.innerContent.offsetHeight - this.body.offsetHeight,
2790
2791			h = this.objectHeight || hs.page.height - hDiff - hs.marginTop - hs.marginBottom,
2792
2793			onload = this.objectLoadTime == 'before' ? 
2794
2795				' onload="if (hs.expanders['+ this.key +']) hs.expanders['+ this.key +'].contentLoaded()" ' : '';
2796
2797		
2798
2799		this.body.innerHTML += '<iframe name="hs'+ (new Date()).getTime() +'" frameborder="0" key="'+ this.key +'" '
2800
2801			+' allowtransparency="true" style="width:'+ this.objectWidth +'px; height:'+ h +'px" '
2802
2803			+ onload +' src="'+ this.src +'"></iframe>';
2804
2805		this.ruler = this.body.getElementsByTagName('div')[0];
2806
2807		this.iframe = this.body.getElementsByTagName('iframe')[0];
2808
2809		
2810
2811		if (this.objectLoadTime == 'after') this.correctIframeSize();
2812
2813		
2814
2815	}
2816
2817	if (this.objectType == 'swf') {
2818
2819		this.body.id = this.body.id || 'hs-flash-id-' + this.key;
2820
2821		var a = this.swfOptions;
2822
2823		if (!a.params) a.params = {};
2824
2825		if (typeof a.params.wmode == 'undefined') a.params.wmode = 'transparent';
2826
2827		if (swfobject) swfobject.embedSWF(this.src, this.body.id, this.objectWidth, this.objectHeight, 
2828
2829			a.version || '7', a.expressInstallSwfurl, a.flashvars, a.params, a.attributes);
2830
2831	}
2832
2833	this.hasExtendedContent = true;
2834
2835},
2836
2837htmlGetSize : function() {
2838
2839	if (this.iframe && !this.objectHeight) { // loadtime before		
2840
2841		this.iframe.style.height = this.body.style.height = this.getIframePageHeight() +'px';
2842
2843	}
2844
2845	this.innerContent.appendChild(hs.clearing);
2846
2847	if (!this.x.full) this.x.full = this.innerContent.offsetWidth;
2848
2849    this.y.full = this.innerContent.offsetHeight;
2850
2851    this.innerContent.removeChild(hs.clearing);
2852
2853    if (hs.ie && this.newHeight > parseInt(this.innerContent.currentStyle.height)) { // ie css bug
2854
2855		this.newHeight = parseInt(this.innerContent.currentStyle.height);
2856
2857	}
2858
2859	hs.setStyles( this.wrapper, { position: 'absolute',	padding: '0'});
2860
2861	hs.setStyles( this.content, { width: this.x.t +'px', height: this.y.t +'px'});
2862
2863},
2864
2865
2866
2867getIframePageHeight : function() {
2868
2869	var h;
2870
2871	try {
2872
2873		var doc = this.iframe.contentDocument || this.iframe.contentWindow.document;
2874
2875		var clearing = doc.createElement('div');
2876
2877		clearing.style.clear = 'both';
2878
2879		doc.body.appendChild(clearing);
2880
2881		h = clearing.offsetTop;
2882
2883		if (hs.ie) h += parseInt(doc.body.currentStyle.marginTop) 
2884
2885			+ parseInt(doc.body.currentStyle.marginBottom) - 1;
2886
2887	} catch (e) { // other domain
2888
2889		h = 300;
2890
2891	}
2892
2893	return h;
2894
2895},
2896
2897correctIframeSize : function () {
2898
2899	var wDiff = this.innerContent.offsetWidth - this.ruler.offsetWidth;
2900
2901	hs.discardElement(this.ruler);
2902
2903	if (wDiff < 0) wDiff = 0;
2904
2905	
2906
2907	var hDiff = this.innerContent.offsetHeight - this.iframe.offsetHeight;
2908
2909	hs.setStyles(this.iframe, { 
2910
2911		width: Math.abs(this.x.size - wDiff) +'px', 
2912
2913		height: Math.abs(this.y.size - hDiff) +'px'
2914
2915	});
2916
2917    hs.setStyles(this.body, { 
2918
2919		width: this.iframe.style.width, 
2920
2921    	height: this.iframe.style.height
2922
2923	});
2924
2925    	
2926
2927    this.scrollingContent = this.iframe;
2928
2929    this.scrollerDiv = this.scrollingContent;
2930
2931},
2932
2933htmlSizeOperations : function () {
2934
2935	
2936
2937	this.setObjContainerSize(this.innerContent);
2938
2939	
2940
2941	
2942
2943	if (this.objectType == 'swf' && this.objectLoadTime == 'before') this.writeExtendedContent();	
2944
2945	
2946
2947    // handle minimum size
2948
2949    if (this.x.size < this.x.full && !this.allowWidthReduction) this.x.size = this.x.full;
2950
2951    if (this.y.size < this.y.full && !this.allowHeightReduction) this.y.size = this.y.full;
2952
2953	this.scrollerDiv = this.innerContent;
2954
2955    hs.setStyles(this.mediumContent, { 
2956
2957		position: 'relative',
2958
2959		width: this.x.size +'px'
2960
2961	});
2962
2963    hs.setStyles(this.innerContent, { 
2964
2965    	border: 'none',
2966
2967    	width: 'auto',
2968
2969    	height: 'auto'
2970
2971    });
2972
2973	var node = hs.getElementByClass(this.innerContent, 'DIV', 'highslide-body');
2974
2975    if (node && !/(iframe|swf)/.test(this.objectType)) {
2976
2977    	var cNode = node; // wrap to get true size
2978
2979    	node = hs.createElement(cNode.nodeName, null, {overflow: 'hidden'}, null, true);
2980
2981    	cNode.parentNode.insertBefore(node, cNode);
2982
2983    	node.appendChild(hs.clearing); // IE6
2984
2985    	node.appendChild(cNode);
2986
2987    	
2988
2989    	var wDiff = this.innerContent.offsetWidth - node.offsetWidth;
2990
2991    	var hDiff = this.innerContent.offsetHeight - node.offsetHeight;
2992
2993		node.removeChild(hs.clearing);
2994
2995    	
2996
2997    	var kdeBugCorr = hs.safari || navigator.vendor == 'KDE' ? 1 : 0; // KDE repainting bug
2998
2999    	hs.setStyles(node, { 
3000
3001    			width: (this.x.size - wDiff - kdeBugCorr) +'px', 
3002
3003    			height: (this.y.size - hDiff) +'px',
3004
3005    			overflow: 'auto', 
3006
3007    			position: 'relative' 
3008
3009    		} 
3010
3011    	);
3012
3013		if (kdeBugCorr && cNode.offsetHeight > node.offsetHeight)	{
3014
3015    		node.style.width = (parseInt(node.style.width) + kdeBugCorr) + 'px';
3016
3017		}
3018
3019    	this.scrollingContent = node;
3020
3021    	this.scrollerDiv = this.scrollingContent;
3022
3023	}
3024
3025    if (this.iframe && this.objectLoadTime == 'before') this.correctIframeSize();
3026
3027    if (!this.scrollingContent && this.y.size < this.mediumContent.offsetHeight) this.scrollerDiv = this.content;
3028
3029	
3030
3031	if (this.scrollerDiv == this.content && !this.allowWidthReduction && !/(iframe|swf)/.test(this.objectType)) {
3032
3033		this.x.size += 17; // room for scrollbars
3034
3035	}
3036
3037	if (this.scrollerDiv && this.scrollerDiv.offsetHeight > this.scrollerDiv.parentNode.offsetHeight) {
3038
3039		setTimeout("try { hs.expanders["+ this.key +"].scrollerDiv.style.overflow = 'auto'; } catch(e) {}",
3040
3041			 hs.expandDuration);
3042
3043	}
3044
3045},
3046
3047
3048
3049justify : function (p, moveOnly) {
3050
3051	var tgtArr, tgt = p.target, dim = p == this.x ? 'x' : 'y';
3052
3053	
3054
3055		var hasMovedMin = false;
3056
3057		
3058
3059		var allowReduce = p.exp.allowSizeReduction;
3060
3061			p.pos = Math.round(p.pos - ((p.get('wsize') - p.t) / 2));
3062
3063		if (p.pos < p.scroll + p.marginMin) {
3064
3065			p.pos = p.scroll + p.marginMin;
3066
3067			hasMovedMin = true;		
3068
3069		}
3070
3071		if (!moveOnly && p.size < p.minSize) {
3072
3073			p.size = p.minSize;
3074
3075			allowReduce = false;
3076
3077		}
3078
3079		if (p.pos + p.get('wsize') > p.scroll + p.clientSize - p.marginMax) {
3080
3081			if (!moveOnly && hasMovedMin && allowReduce) {
3082
3083				p.size = p.get(dim == 'y' ? 'fitsize' : 'maxsize');
3084
3085			} else if (p.get('wsize') < p.get('fitsize')) {
3086
3087				p.pos = p.scroll + p.clientSize - p.marginMax - p.get('wsize');
3088
3089			} else { // image larger than viewport
3090
3091				p.pos = p.scroll + p.marginMin;
3092
3093				if (!moveOnly && allowReduce) p.size = p.get(dim == 'y' ? 'fitsize' : 'maxsize');
3094
3095			}			
3096
3097		}
3098
3099		
3100
3101		if (!moveOnly && p.size < p.minSize) {
3102
3103			p.size = p.minSize;
3104
3105			allowReduce = false;
3106
3107		}
3108
3109		
3110
3111	
3112
3113		
3114
3115	if (p.pos < p.marginMin) {
3116
3117		var tmpMin = p.pos;
3118
3119		p.pos = p.marginMin; 
3120
3121		
3122
3123		if (allowReduce && !moveOnly) p.size = p.size - (p.pos - tmpMin);
3124
3125		
3126
3127	}
3128
3129},
3130
3131
3132
3133correctRatio : function(ratio) {
3134
3135	var x = this.x, 
3136
3137		y = this.y,
3138
3139		changed = false,
3140
3141		xSize = Math.min(x.full, x.size),
3142
3143		ySize = Math.min(y.full, y.size),
3144
3145		useBox = (this.useBox || hs.padToMinWidth);
3146
3147	
3148
3149	if (xSize / ySize > ratio) { // width greater
3150
3151		xSize = ySize * ratio;
3152
3153		if (xSize < x.minSize) { // below minWidth
3154
3155			xSize = x.minSize;
3156
3157			ySize = xSize / ratio;
3158
3159		}
3160
3161		changed = true;
3162
3163	
3164
3165	} else if (xSize / ySize < ratio) { // height greater
3166
3167		ySize = xSize / ratio;
3168
3169		changed = true;
3170
3171	}
3172
3173	
3174
3175	if (hs.padToMinWidth && x.full < x.minSize) {
3176
3177		x.imgSize = x.full;
3178
3179		y.size = y.imgSize = y.full;
3180
3181	} else if (this.useBox) {
3182
3183		x.imgSize = xSize;
3184
3185		y.imgSize = ySize;
3186
3187	} else {
3188
3189		x.size = xSize;
3190
3191		y.size = ySize;
3192
3193	}
3194
3195	this.fitOverlayBox(useBox ? null : ratio);
3196
3197	if (useBox && y.size < y.imgSize) {
3198
3199		y.imgSize = y.size;
3200
3201		x.imgSize = y.size * ratio;
3202
3203	}
3204
3205	if (changed || useBox) {
3206
3207		x.pos = x.tpos - x.cb + x.tb;
3208
3209		x.minSize = x.size;
3210
3211		this.justify(x, true);
3212
3213	
3214
3215		y.pos = y.tpos - y.cb + y.tb;
3216
3217		y.minSize = y.size;
3218
3219		this.justify(y, true);
3220
3221		if (this.overlayBox) this.sizeOverlayBox();
3222
3223	}
3224
3225},
3226
3227fitOverlayBox : function(ratio) {
3228
3229	var x = this.x, y = this.y;
3230
3231	if (this.overlayBox) {
3232
3233		while (y.size > this.minHeight && x.size > this.minWidth 
3234
3235				&&  y.get('wsize') > y.get('fitsize')) {
3236
3237			y.size -= 10;
3238
3239			if (ratio) x.size = y.size * ratio;
3240
3241			this.sizeOverlayBox(0, 1);
3242
3243		}
3244
3245	}
3246
3247},
3248
3249
3250
3251show : function () {
3252
3253	var x = this.x, y = this.y;
3254
3255	this.doShowHide('hidden');
3256
3257	
3258
3259	// Apply size change
3260
3261	this.changeSize(
3262
3263		1, {
3264
3265			wrapper: {
3266
3267				width : x.get('wsize'),
3268
3269				height : y.get('wsize'),
3270
3271				left: x.pos,
3272
3273				top: y.pos
3274
3275			},
3276
3277			content: {
3278
3279				left: x.p1 + x.get('imgPad'),
3280
3281				top: y.p1 + y.get('imgPad'),
3282
3283				width:x.imgSize ||x.size,
3284
3285				height:y.imgSize ||y.size
3286
3287			}
3288
3289		},
3290
3291		hs.expandDuration
3292
3293	);
3294
3295},
3296
3297
3298
3299changeSize : function(up, to, dur) {
3300
3301	
3302
3303	if (this.outline && !this.outlineWhileAnimating) {
3304
3305		if (up) this.outline.setPosition();
3306
3307		else this.outline.destroy(
3308
3309				(this.isHtml && this.preserveContent));
3310
3311	}
3312
3313	
3314
3315	
3316
3317	if (!up) this.destroyOverlays();
3318
3319	
3320
3321	var exp = this,
3322
3323		x = exp.x,
3324
3325		y = exp.y,
3326
3327		easing = this.easing;
3328
3329	if (!up) easing = this.easingClose || easing;
3330
3331	var after = up ?
3332
3333		function() {
3334
3335				
3336
3337			if (exp.outline) exp.outline.table.style.visibility = "visible";
3338
3339			setTimeout(function() {
3340
3341				exp.afterExpand();
3342
3343			}, 50);
3344
3345		} :
3346
3347		function() {
3348
3349			exp.afterClose();
3350
3351		};
3352
3353	if (up) hs.setStyles( this.wrapper, {
3354
3355		width: x.t +'px',
3356
3357		height: y.t +'px'
3358
3359	});
3360
3361	if (up && this.isHtml) {
3362
3363		hs.setStyles(this.wrapper, {
3364
3365			left: (x.tpos - x.cb + x.tb) +'px',
3366
3367			top: (y.tpos - y.cb + y.tb) +'px'
3368
3369		});
3370
3371	}
3372
3373	if (this.fadeInOut) {
3374
3375		hs.setStyles(this.wrapper, { opacity: up ? 0 : 1 });
3376
3377		hs.extend(to.wrapper, { opacity: up });
3378
3379	}
3380
3381	hs.animate( this.wrapper, to.wrapper, {
3382
3383		duration: dur,
3384
3385		easing: easing,
3386
3387		step: function(val, args) {
3388
3389			if (exp.outline && exp.outlineWhileAnimating && args.prop == 'top') {
3390
3391				var fac = up ? args.pos : 1 - args.pos;
3392
3393				var pos = {
3394
3395					w: x.t + (x.get('wsize') - x.t) * fac,
3396
3397					h: y.t + (y.get('wsize') - y.t) * fac,
3398
3399					x: x.tpos + (x.pos - x.tpos) * fac,
3400
3401					y: y.tpos + (y.pos - y.tpos) * fac
3402
3403				};
3404
3405				exp.outline.setPosition(pos, 0, 1);				
3406
3407			}
3408
3409			if (exp.isHtml) {	
3410
3411				if (args.prop == 'left') 
3412
3413					exp.mediumContent.style.left = (x.pos - val) +'px';
3414
3415				if (args.prop == 'top') 
3416
3417					exp.mediumContent.style.top = (y.pos - val) +'px';
3418
3419			}
3420
3421		}
3422
3423	});
3424
3425	hs.animate( this.content, to.content, dur, easing, after);
3426
3427	if (up) {
3428
3429		this.wrapper.style.visibility = 'visible';
3430
3431		this.content.style.visibility = 'visible';
3432
3433		if (this.isHtml) this.innerContent.style.visibility = 'visible';
3434
3435		this.a.className += ' highslide-active-anchor';
3436
3437	}
3438
3439},
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449afterExpand : function() {
3450
3451	this.isExpanded = true;	
3452
3453	this.focus();
3454
3455	
3456
3457	if (this.isHtml && this.objectLoadTime == 'after') this.writeExtendedContent();
3458
3459	if (this.iframe) {
3460
3461		try {
3462
3463			var exp = this,
3464
3465				doc = this.iframe.contentDocument || this.iframe.contentWindow.document;
3466
3467			hs.addEventListener(doc, 'mousedown', function () {
3468
3469				if (hs.focusKey != exp.key) exp.focus();
3470
3471			});
3472
3473		} catch(e) {}
3474
3475		if (hs.ie && typeof this.isClosing != 'boolean') // first open 
3476
3477			this.iframe.style.width = (this.objectWidth - 1) +'px'; // hasLayout
3478
3479	}
3480
3481	if (hs.upcoming && hs.upcoming == this.a) hs.upcoming = null;
3482
3483	this.prepareNextOutline();
3484
3485	var p = hs.page, mX = hs.mouse.x + p.scrollLeft, mY = hs.mouse.y + p.scrollTop;
3486
3487	this.mouseIsOver = this.x.pos < mX && mX < this.x.pos + this.x.get('wsize')
3488
3489		&& this.y.pos < mY && mY < this.y.pos + this.y.get('wsize');	
3490
3491	if (this.overlayBox) this.showOverlays();
3492
3493	
3494
3495},
3496
3497
3498
3499
3500
3501prepareNextOutline : function() {
3502
3503	var key = this.key;
3504
3505	var outlineType = this.outlineType;
3506
3507	new hs.Outline(outlineType, 
3508
3509		function () { try { hs.expanders[key].preloadNext(); } catch (e) {} });
3510
3511},
3512
3513
3514
3515
3516
3517preloadNext : function() {
3518
3519	var next = this.getAdjacentAnchor(1);
3520
3521	if (next && next.onclick.toString().match(/hs\.expand/)) 
3522
3523		var img = hs.createElement('img', { src: hs.getSrc(next) });
3524
3525},
3526
3527
3528
3529
3530
3531getAdjacentAnchor : function(op) {
3532
3533	var current = this.getAnchorIndex(), as = hs.anchors.groups[this.slideshowGroup || 'none'];
3534
3535	
3536
3537	/*< ? if ($cfg->slideshow) : ?>s*/
3538
3539	if (!as[current + op] && this.slideshow && this.slideshow.repeat) {
3540
3541		if (op == 1) return as[0];
3542
3543		else if (op == -1) return as[as.length-1];
3544
3545	}
3546
3547	/*< ? endif ?>s*/
3548
3549	return as[current + op] || null;
3550
3551},
3552
3553
3554
3555getAnchorIndex : function() {
3556
3557	var arr = hs.getAnchors().groups[this.slideshowGroup || 'none'];
3558
3559	if (arr) for (var i = 0; i < arr.length; i++) {
3560
3561		if (arr[i] == this.a) return i; 
3562
3563	}
3564
3565	return null;
3566
3567},
3568
3569
3570
3571
3572
3573cancelLoading : function() {
3574
3575	hs.discardElement (this.wrapper);
3576
3577	hs.expanders[this.key] = null;
3578
3579	if (this.loading) hs.loading.style.left = '-9999px';
3580
3581},
3582
3583
3584
3585writeCredits : function () {
3586
3587	this.credits = hs.createElement('a', {
3588
3589		href: hs.creditsHref,
3590
3591		target: hs.creditsTarget,
3592
3593		className: 'highslide-credits',
3594
3595		innerHTML: hs.lang.creditsText,
3596
3597		title: hs.lang.creditsTitle
3598
3599	});
3600
3601	this.createOverlay({ 
3602
3603		overlayId: this.credits, 
3604
3605		position: this.creditsPosition || 'top left' 
3606
3607	});
3608
3609},
3610
3611
3612
3613getInline : function(types, addOverlay) {
3614
3615	for (var i = 0; i < types.length; i++) {
3616
3617		var type = types[i], s = null;
3618
3619		if (!this[type +'Id'] && this.thumbsUserSetId)  
3620
3621			this[type +'Id'] = type +'-for-'+ this.thumbsUserSetId;
3622
3623		if (this[type +'Id']) this[type] = hs.getNode(this[type +'Id']);
3624
3625		if (!this[type] && !this[type +'Text'] && this[type +'Eval']) try {
3626
3627			s = eval(this[type +'Eval']);
3628
3629		} catch (e) {}
3630
3631		if (!this[type] && this[type +'Text']) {
3632
3633			s = this[type +'Text'];
3634
3635		}
3636
3637		if (!this[type] && !s) {
3638
3639			var next = this.a.nextSibling;
3640
3641			while (next && !hs.isHsAnchor(next)) {
3642
3643				if ((new RegExp('highslide-'+ type)).test(next.className || null)) {
3644
3645					this[type] = next.cloneNode(1);
3646
3647					break;
3648
3649				}
3650
3651				next = next.nextSibling;
3652
3653			}
3654
3655		}
3656
3657		
3658
3659		if (!this[type] && s) this[type] = hs.createElement('div', 
3660
3661				{ className: 'highslide-'+ type, innerHTML: s } );
3662
3663		
3664
3665		if (addOverlay && this[type]) {
3666
3667			var o = { position: (type == 'heading') ? 'above' : 'below' };
3668
3669			for (var x in this[type+'Overlay']) o[x] = this[type+'Overlay'][x];
3670
3671			o.overlayId = this[type];
3672
3673			this.createOverlay(o);
3674
3675		}
3676
3677	}
3678
3679},
3680
3681
3682
3683
3684
3685// on end move and resize
3686
3687doShowHide : function(visibility) {
3688
3689	if (hs.hideSelects) this.showHideElements('SELECT', visibility);
3690
3691	if (hs.hideIframes) this.showHideElements('IFRAME', visibility);
3692
3693	if (hs.geckoMac) this.showHideElements('*', visibility);
3694
3695},
3696
3697showHideElements : function (tagName, visibility) {
3698
3699	var els = document.getElementsByTagName(tagName);
3700
3701	var prop = tagName == '*' ? 'overflow' : 'visibility';
3702
3703	for (var i = 0; i < els.length; i++) {
3704
3705		if (prop == 'visibility' || (document.defaultView.getComputedStyle(
3706
3707				els[i], "").getPropertyValue('overflow') == 'auto'
3708
3709				|| els[i].getAttribute('hidden-by') != null)) {
3710
3711			var hiddenBy = els[i].getAttribute('hidden-by');
3712
3713			if (visibility == 'visible' && hiddenBy) {
3714
3715				hiddenBy = hiddenBy.replace('['+ this.key +']', '');
3716
3717				els[i].setAttribute('hidden-by', hiddenBy);
3718
3719				if (!hiddenBy) els[i].style[prop] = els[i].origProp;
3720
3721			} else if (visibility == 'hidden') { // hide if behind
3722
3723				var elPos = hs.getPosition(els[i]);
3724
3725				elPos.w = els[i].offsetWidth;
3726
3727				elPos.h = els[i].offsetHeight;
3728
3729			
3730
3731				
3732
3733					var clearsX = (elPos.x + elPos.w < this.x.get('opos') 
3734
3735						|| elPos.x > this.x.get('opos') + this.x.get('osize'));
3736
3737					var clearsY = (elPos.y + elPos.h < this.y.get('opos') 
3738
3739						|| elPos.y > this.y.get('opos') + this.y.get('osize'));
3740
3741				var wrapperKey = hs.getWrapperKey(els[i]);
3742
3743				if (!clearsX && !clearsY && wrapperKey != this.key) { // element falls behind image
3744
3745					if (!hiddenBy) {
3746
3747						els[i].setAttribute('hidden-by', '['+ this.key +']');
3748
3749						els[i].origProp = els[i].style[prop];
3750
3751						els[i].style[prop] = 'hidden';
3752
3753						
3754
3755					} else if (hiddenBy.indexOf('['+ this.key +']') == -1) {
3756
3757						els[i].setAttribute('hidden-by', hiddenBy + '['+ this.key +']');
3758
3759					}
3760
3761				} else if ((hiddenBy == '['+ this.key +']' || hs.focusKey == wrapperKey)
3762
3763						&& wrapperKey != this.key) { // on move
3764
3765					els[i].setAttribute('hidden-by', '');
3766
3767					els[i].style[prop] = els[i].origProp || '';
3768
3769				} else if (hiddenBy && hiddenBy.indexOf('['+ this.key +']') > -1) {
3770
3771					els[i].setAttribute('hidden-by', hiddenBy.replace('['+ this.key +']', ''));
3772
3773				}
3774
3775						
3776
3777			}
3778
3779		}
3780
3781	}
3782
3783},
3784
3785
3786
3787focus : function() {
3788
3789	this.wrapper.style.zIndex = hs.zIndexCounter += 2;
3790
3791	// blur others
3792
3793	for (var i = 0; i < hs.expanders.length; i++) {
3794
3795		if (hs.expanders[i] && i == hs.focusKey) {
3796
3797			var blurExp = hs.expanders[i];
3798
3799			blurExp.content.className += ' highslide-'+ blurExp.contentType +'-blur';
3800
3801			if (blurExp.isImage) {
3802
3803				blurExp.content.style.cursor = hs.ie ? 'hand' : 'pointer';
3804
3805				blurExp.content.title = hs.lang.focusTitle;	
3806
3807			}
3808
3809		}
3810
3811	}
3812
3813	
3814
3815	// focus this
3816
3817	if (this.outline) this.outline.table.style.zIndex 
3818
3819		= this.wrapper.style.zIndex - 1;
3820
3821	this.content.className = 'highslide-'+ this.contentType;
3822
3823	if (this.isImage) {
3824
3825		this.content.title = hs.lang.restoreTitle;
3826
3827		
3828
3829		if (hs.restoreCursor) {
3830
3831			hs.styleRestoreCursor = window.opera ? 'pointer' : 'url('+ hs.graphicsDir + hs.restoreCursor +'), pointer';
3832
3833			if (hs.ie && hs.uaVersion < 6) hs.styleRestoreCursor = 'hand';
3834
3835			this.content.style.cursor = hs.styleRestoreCursor;
3836
3837		}
3838
3839	}
3840
3841	hs.focusKey = this.key;	
3842
3843	hs.addEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);	
3844
3845},
3846
3847moveTo: function(x, y) {
3848
3849	this.x.setPos(x);
3850
3851	this.y.setPos(y);
3852
3853},
3854
3855resize : function (e) {
3856
3857	var w, h, r = e.width / e.height;
3858
3859	w = Math.max(e.width + e.dX, Math.min(this.minWidth, this.x.full));
3860
3861	if (this.isImage && Math.abs(w - this.x.full) < 12) w = this.x.full;
3862
3863	h = this.isHtml ? e.height + e.dY : w / r;
3864
3865	if (h < Math.min(this.minHeight, this.y.full)) {
3866
3867		h = Math.min(this.minHeight, this.y.full);
3868
3869		if (this.isImage) w = h * r;
3870
3871	}
3872
3873	this.resizeTo(w, h);
3874
3875},
3876
3877resizeTo: function(w, h) {
3878
3879	this.y.setSize(h);
3880
3881	this.x.setSize(w);
3882
3883},
3884
3885
3886
3887close : function() {
3888
3889	if (this.isClosing || !this.isExpanded) return;
3890
3891	this.isClosing = true;
3892
3893	
3894
3895	hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);
3896
3897	
3898
3899	try {
3900
3901		if (this.isHtml) this.htmlPrepareClose();
3902
3903		this.content.style.cursor = 'default';
3904
3905		this.changeSize(
3906
3907			0, {
3908
3909				wrapper: {
3910
3911					width : this.x.t,
3912
3913					height : this.y.t,
3914
3915					left: this.x.tpos - this.x.cb + this.x.tb,
3916
3917					top: this.y.tpos - this.y.cb + this.y.tb
3918
3919				},
3920
3921				content: {
3922
3923					left: 0,
3924
3925					top: 0,
3926
3927					width: this.x.t,
3928
3929					height: this.y.t
3930
3931				}
3932
3933			}, hs.restoreDuration
3934
3935		);
3936
3937	} catch (e) { this.afterClose(); }
3938
3939},
3940
3941
3942
3943htmlPrepareClose : function() {
3944
3945	if (hs.geckoMac) { // bad redraws
3946
3947		if (!hs.mask) hs.mask = hs.createElement('div', null, 
3948
3949			{ position: 'absolute' }, hs.container);
3950
3951		hs.setStyles(hs.mask, { width: this.x.size +'px', height: this.y.size +'px', 
3952
3953			left: this.x.pos +'px', top: this.y.pos +'px', display: 'block' });			
3954
3955	}
3956
3957	if (this.objectType == 'swf') try { hs.$(this.body.id).StopPlay(); } catch (e) {}
3958
3959	
3960
3961	if (this.objectLoadTime == 'after' && !this.preserveContent) this.destroyObject();		
3962
3963	if (this.scrollerDiv && this.scrollerDiv != this.scrollingContent) 
3964
3965		this.scrollerDiv.style.overflow = 'hidden';
3966
3967},
3968
3969
3970
3971destroyObject : function () {
3972
3973	if (hs.ie && this.iframe)
3974
3975		try { this.iframe.contentWindow.document.body.innerHTML = ''; } catch (e) {}
3976
3977	if (this.objectType == 'swf') swfobject.removeSWF(this.body.id);
3978
3979	this.body.innerHTML = '';
3980
3981},
3982
3983
3984
3985sleep : function() {
3986
3987	if (this.outline) this.outline.table.style.display = 'none';
3988
3989	this.releaseMask = null;
3990
3991	this.wrapper.style.display = 'none';
3992
3993	hs.push(hs.sleeping, this);
3994
3995},
3996
3997
3998
3999awake : function() {try {
4000
4001	
4002
4003	hs.expanders[this.key] = this;
4004
4005	
4006
4007	if (!hs.allowMultipleInstances &&hs.focusKey != this.key) {	
4008
4009		try { hs.expanders[hs.focusKey].close(); } catch (e){}
4010
4011	}
4012
4013	
4014
4015	var z = hs.zIndexCounter++, stl = { display: '', zIndex: z };
4016
4017	hs.setStyles (this.wrapper, stl);
4018
4019	this.isClosing = false;
4020
4021	
4022
4023	var o = this.outline || 0;
4024
4025	if (o) {
4026
4027		if (!this.outlineWhileAnimating) stl.visibility = 'hidden';
4028
4029		hs.setStyles (o.table, stl);		
4030
4031	}
4032
4033		
4034
4035	this.show();
4036
4037} catch (e) {}
4038
4039
4040
4041
4042
4043},
4044
4045
4046
4047createOverlay : function (o) {
4048
4049	var el = o.overlayId;
4050
4051	if (typeof el == 'string') el = hs.getNode(el);
4052
4053	if (o.html) el = hs.createElement('div', { innerHTML: o.html });
4054
4055	if (!el || typeof el == 'string') return;
4056
4057	el.style.display = 'block';
4058
4059	this.genOverlayBox();
4060
4061	var width = o.width && /^[0-9]+(px|%)$/.test(o.width) ? o.width : 'auto';
4062
4063	if (/^(left|right)panel$/.test(o.position) && !/^[0-9]+px$/.test(o.width)) width = '200px';
4064
4065	var overlay = hs.createElement(
4066
4067		'div', {
4068
4069			id: 'hsId'+ hs.idCounter++,
4070
4071			hsId: o.hsId
4072
4073		}, {
4074
4075			position: 'absolute',
4076
4077			visibility: 'hidden',
4078
4079			width: width,
4080
4081			direction: hs.lang.cssDirection || '',
4082
4083			opacity: 0
4084
4085		},this.overlayBox,
4086
4087		true
4088
4089	);
4090
4091	
4092
4093	overlay.appendChild(el);
4094
4095	hs.extend(overlay, {
4096
4097		opacity: 1,
4098
4099		offsetX: 0,
4100
4101		offsetY: 0,
4102
4103		dur: (o.fade === 0 || o.fade === false || (o.fade == 2 && hs.ie)) ? 0 : 250
4104
4105	});
4106
4107	hs.extend(overlay, o);
4108
4109		
4110
4111	if (this.gotOverlays) {
4112
4113		this.positionOverlay(overlay);
4114
4115		if (!overlay.hideOnMouseOut || this.mouseIsOver) 
4116
4117			hs.animate(overlay, { opacity: overlay.opacity }, overlay.dur);
4118
4119	}
4120
4121	hs.push(this.overlays, hs.idCounter - 1);
4122
4123},
4124
4125positionOverlay : function(overlay) {
4126
4127	var p = overlay.position || 'middle center',
4128
4129		offX = overlay.offsetX,
4130
4131		offY = overlay.offsetY;
4132
4133	if (overlay.parentNode != this.overlayBox) this.overlayBox.appendChild(overlay);
4134
4135	if (/left$/.test(p)) overlay.style.left = offX +'px'; 
4136
4137	
4138
4139	if (/center$/.test(p))	hs.setStyles (overlay, { 
4140
4141		left: '50%',
4142
4143		marginLeft: (offX - Math.round(overlay.offsetWidth / 2)) +'px'
4144
4145	});	
4146
4147	
4148
4149	if (/right$/.test(p)) overlay.style.right = - offX +'px';
4150
4151		
4152
4153	if (/^leftpanel$/.test(p)) { 
4154
4155		hs.setStyles(overlay, {
4156
4157			right: '100%',
4158
4159			marginRight: this.x.cb +'px',
4160
4161			top: - this.y.cb +'px',
4162
4163			bottom: - this.y.cb +'px',
4164
4165			overflow: 'auto'
4166
4167		});		 
4168
4169		this.x.p1 = overlay.offsetWidth;
4170
4171	
4172
4173	} else if (/^rightpanel$/.test(p)) {
4174
4175		hs.setStyles(overlay, {
4176
4177			left: '100%',
4178
4179			marginLeft: this.x.cb +'px',
4180
4181			top: - this.y.cb +'px',
4182
4183			bottom: - this.y.cb +'px',
4184
4185			overflow: 'auto'
4186
4187		});
4188
4189		this.x.p2 = overlay.offsetWidth;
4190
4191	}
4192
4193
4194
4195	if (/^top/.test(p)) overlay.style.top = offY +'px'; 
4196
4197	if (/^middle/.test(p))	hs.setStyles (overlay, { 
4198
4199		top: '50%', 
4200
4201		marginTop: (offY - Math.round(overlay.offsetHeight / 2)) +'px'
4202
4203	});	
4204
4205	if (/^bottom/.test(p)) overlay.style.bottom = - offY +'px';
4206
4207	if (/^above$/.test(p)) {
4208
4209		hs.setStyles(overlay, {
4210
4211			left: (- this.x.p1 - this.x.cb) +'px',
4212
4213			right: (- this.x.p2 - this.x.cb) +'px',
4214
4215			bottom: '100%',
4216
4217			marginBottom: this.y.cb +'px',
4218
4219			width: 'auto'
4220
4221		});
4222
4223		this.y.p1 = overlay.offsetHeight;
4224
4225	
4226
4227	} else if (/^below$/.test(p)) {
4228
4229		hs.setStyles(overlay, {
4230
4231			position: 'relative',
4232
4233			left: (- this.x.p1 - this.x.cb) +'px',
4234
4235			right: (- this.x.p2 - this.x.cb) +'px',
4236
4237			top: '100%',
4238
4239			marginTop: this.y.cb +'px',
4240
4241			width: 'auto'
4242
4243		});
4244
4245		this.y.p2 = overlay.offsetHeight;
4246
4247		overlay.style.position = 'absolute';
4248
4249	}
4250
4251},
4252
4253
4254
4255getOverlays : function() {	
4256
4257	this.getInline(['heading', 'caption'], true);
4258
4259	if (this.heading && this.dragByHeading) this.heading.className += ' highslide-move';
4260
4261	if (hs.showCredits) this.writeCredits();
4262
4263	for (var i = 0; i < hs.overlays.length; i++) {
4264
4265		var o = hs.overlays[i], tId = o.thumbnailId, sg = o.slideshowGroup;
4266
4267		if ((!tId && !sg) || (tId && tId == this.thumbsUserSetId)
4268
4269				|| (sg && sg === this.slideshowGroup)) {
4270
4271			if (this.isImage || (this.isHtml && o.useOnHtml))
4272
4273			this.createOverlay(o);
4274
4275		}
4276
4277	}
4278
4279	var os = [];
4280
4281	for (var i = 0; i < this.overlays.length; i++) {
4282
4283		var o = hs.$('hsId'+ this.overlays[i]);
4284
4285		if (/panel$/.test(o.position)) this.positionOverlay(o);
4286
4287		else hs.push(os, o);
4288
4289	}
4290
4291	for (var i = 0; i < os.length; i++) this.positionOverlay(os[i]);
4292
4293	this.gotOverlays = true;
4294
4295},
4296
4297genOverlayBox : function() {
4298
4299	if (!this.overlayBox) this.overlayBox = hs.createElement (
4300
4301		'div', {
4302
4303			className: this.wrapperClassName
4304
4305		}, {
4306
4307			position : 'absolute',
4308
4309			width: (this.x.size || (this.useBox ? this.width : null) 
4310
4311				|| this.x.full) +'px',
4312
4313			height: (this.y.size || this.y.full) +'px',
4314
4315			visibility : 'hidden',
4316
4317			overflow : 'hidden',
4318
4319			zIndex : hs.ie ? 4 : null
4320
4321		},
4322
4323		hs.container,
4324
4325		true
4326
4327	);
4328
4329},
4330
4331sizeOverlayBox : function(doWrapper, doPanels) {
4332
4333	var overlayBox = this.overlayBox, 
4334
4335		x = this.x,
4336
4337		y = this.y;
4338
4339	hs.setStyles( overlayBox, {
4340
4341		width: x.size +'px', 
4342
4343		height: y.size +'px'
4344
4345	});
4346
4347	if (doWrapper || doPanels) {
4348
4349		for (var i = 0; i < this.overlays.length; i++) {
4350
4351			var o = hs.$('hsId'+ this.overlays[i]);
4352
4353			var ie6 = (hs.ieLt7 || document.compatMode == 'BackCompat');
4354
4355			if (o && /^(above|below)$/.test(o.position)) {
4356
4357				if (ie6) {
4358
4359					o.style.width = (overlayBox.offsetWidth + 2 * x.cb
4360
4361						+ x.p1 + x.p2) +'px';
4362
4363				}
4364
4365				y[o.position == 'above' ? 'p1' : 'p2'] = o.offsetHeight;
4366
4367			}
4368
4369			if (o && ie6 && /^(left|right)panel$/.test(o.position)) {
4370
4371				o.style.height = (overlayBox.offsetHeight + 2* y.cb) +'px';
4372
4373			}
4374
4375		}
4376
4377	}
4378
4379	if (doWrapper) {
4380
4381		hs.setStyles(this.content, {
4382
4383			top: y.p1 +'px'
4384
4385		});
4386
4387		hs.setStyles(overlayBox, {
4388
4389			top: (y.p1 + y.cb) +'px'
4390
4391		});
4392
4393	}
4394
4395},
4396
4397
4398
4399showOverlays : function() {
4400
4401	var b = this.overlayBox;
4402
4403	b.className = '';
4404
4405	hs.setStyles(b, {
4406
4407		top: (this.y.p1 + this.y.cb) +'px',
4408
4409		left: (this.x.p1 + this.x.cb) +'px',
4410
4411		overflow : 'visible'
4412
4413	});
4414
4415	if (hs.safari) b.style.visibility = 'visible';
4416
4417	this.wrapper.appendChild (b);
4418
4419	for (var i = 0; i < this.overlays.length; i++) {
4420
4421		var o = hs.$('hsId'+ this.overlays[i]);
4422
4423		o.style.zIndex = 4;
4424
4425		if (!o.hideOnMouseOut || this.mouseIsOver) {
4426
4427			o.style.visibility = 'visible';
4428
4429			hs.setStyles(o, { visibility: 'visible', display: '' });
4430
4431			hs.animate(o, { opacity: o.opacity }, o.dur);
4432
4433		}
4434
4435	}
4436
4437},
4438
4439
4440
4441destroyOverlays : function() {
4442
4443	if (!this.overlays.length) return;
4444
4445	if (this.isHtml && this.preserveContent) {
4446
4447		this.overlayBox.style.top = '-9999px';
4448
4449		hs.container.appendChild(this.overlayBox);
4450
4451	} else
4452
4453	hs.discardElement(this.overlayBox);
4454
4455},
4456
4457
4458
4459
4460
4461
4462
4463createFullExpand : function () {
4464
4465	this.fullExpandLabel = hs.createElement(
4466
4467		'a', {
4468
4469			href: 'javascript:hs.expanders['+ this.key +'].doFullExpand();',
4470
4471			title: hs.lang.fullExpandTitle,
4472
4473			className: 'highslide-full-expand'
4474
4475		}
4476
4477	);
4478
4479	
4480
4481	this.createOverlay({ 
4482
4483		overlayId: this.fullExpandLabel, 
4484
4485		position: hs.fullExpandPosition, 
4486
4487		hideOnMouseOut: true, 
4488
4489		opacity: hs.fullExpandOpacity
4490
4491	});
4492
4493},
4494
4495
4496
4497doFullExpand : function () {
4498
4499	try {
4500
4501		if (this.fullExpandLabel) hs.discardElement(this.fullExpandLabel);
4502
4503		
4504
4505		this.focus();
4506
4507		var xSize = this.x.size;
4508
4509		this.resizeTo(this.x.full, this.y.full);
4510
4511		
4512
4513		var xpos = this.x.pos - (this.x.size - xSize) / 2;
4514
4515		if (xpos < hs.marginLeft) xpos = hs.marginLeft;
4516
4517		
4518
4519		this.moveTo(xpos, this.y.pos);
4520
4521		this.doShowHide('hidden');
4522
4523	
4524
4525	} catch (e) {
4526
4527		this.error(e);
4528
4529	}
4530
4531},
4532
4533
4534
4535
4536
4537afterClose : function () {
4538
4539	this.a.className = this.a.className.replace('highslide-active-anchor', '');
4540
4541	
4542
4543	this.doShowHide('visible');	
4544
4545	
4546
4547	if (this.isHtml && this.preserveContent) {
4548
4549		this.sleep();
4550
4551	} else {
4552
4553		if (this.outline && this.outlineWhileAnimating) this.outline.destroy();
4554
4555	
4556
4557		hs.discardElement(this.wrapper);
4558
4559	}
4560
4561	if (hs.mask) hs.mask.style.display = 'none';
4562
4563	
4564
4565	hs.expanders[this.key] = null;		
4566
4567	hs.reOrder();
4568
4569}
4570
4571
4572
4573};
4574
4575
4576
4577
4578
4579// hs.Ajax object prototype
4580
4581hs.Ajax = function (a, content, pre) {
4582
4583	this.a = a;
4584
4585	this.content = content;
4586
4587	this.pre = pre;
4588
4589};
4590
4591
4592
4593hs.Ajax.prototype = {
4594
4595run : function () {
4596
4597	if (!this.src) this.src = hs.getSrc(this.a);
4598
4599	if (this.src.match('#')) {
4600
4601		var arr = this.src.split('#');
4602
4603		this.src = arr[0];
4604
4605		this.id = arr[1];
4606
4607	}
4608
4609	if (hs.cachedGets[this.src]) {
4610
4611		this.cachedGet = hs.cachedGets[this.src];
4612
4613		if (this.id) this.getElementContent();
4614
4615		else this.loadHTML();
4616
4617		return;
4618
4619	}
4620
4621	try { this.xmlHttp = new XMLHttpRequest(); }
4622
4623	catch (e) {
4624
4625		try { this.xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); }
4626
4627		catch (e) {
4628
4629			try { this.xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); }
4630
4631			catch (e) { this.onError(); }
4632
4633		}
4634
4635	}
4636
4637	var pThis = this; 
4638
4639	this.xmlHttp.onreadystatechange = function() {
4640
4641		if(pThis.xmlHttp.readyState == 4) {
4642
4643			if (pThis.id) pThis.getElementContent();
4644
4645			else pThis.loadHTML();
4646
4647		}
4648
4649	};
4650
4651	var src = this.src;
4652
4653	if (hs.forceAjaxReload) 
4654
4655		src = src.replace(/$/, (/\?/.test(src) ? '&' : '?') +'dummy='+ (new Date()).getTime());
4656
4657	this.xmlHttp.open('GET', src, true);
4658
4659	this.xmlHttp.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
4660
4661	this.xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
4662
4663	this.xmlHttp.send(null);
4664
4665},
4666
4667
4668
4669getElementContent : function() {
4670
4671	hs.init();
4672
4673	var attribs = window.opera || hs.ie6SSL ? { src: 'about:blank' } : null;
4674
4675	
4676
4677	this.iframe = hs.createElement('iframe', attribs, 
4678
4679		{ position: 'absolute', top: '-9999px' }, hs.container);
4680
4681		
4682
4683	this.loadHTML();
4684
4685},
4686
4687
4688
4689loadHTML : function() {
4690
4691	var s = this.cachedGet || this.xmlHttp.responseText;
4692
4693	if (this.pre) hs.cachedGets[this.src] = s;
4694
4695	if (!hs.ie || hs.uaVersion >= 5.5) {
4696
4697		s = s.replace(/\s/g, ' ').replace(
4698
4699			new RegExp('<link[^>]*>', 'gi'), '').replace(
4700
4701			new RegExp('<script[^>]*>.*?</script>', 'gi'), '');
4702
4703
4704
4705		if (this.iframe) {
4706
4707			var doc = this.iframe.contentDocument;
4708
4709			if (!doc && this.iframe.contentWindow) doc = this.iframe.contentWindow.document;
4710
4711			if (!doc) { // Opera
4712
4713				var pThis = this;
4714
4715				setTimeout(function() {	pThis.loadHTML(); }, 25);
4716
4717				return;
4718
4719			}
4720
4721			doc.open();
4722
4723			doc.write(s);
4724
4725			doc.close();
4726
4727			try { s = doc.getElementById(this.id).innerHTML; } catch (e) {
4728
4729				try { s = this.iframe.document.getElementById(this.id).innerHTML; } catch (e) {} // opera
4730
4731			}
4732
4733			hs.discardElement(this.iframe);
4734
4735		} else {
4736
4737			s = s.replace(new RegExp('^.*?<body[^>]*>(.*?)</body>.*?$', 'i'), '$1');
4738
4739		}
4740
4741	}
4742
4743	hs.getElementByClass(this.content, 'DIV', 'highslide-body').innerHTML = s;
4744
4745	this.onLoad();
4746
4747	for (var x in this) this[x] = null;
4748
4749}
4750
4751};
4752
4753if (hs.ie) {
4754
4755	(function () {
4756
4757		try {
4758
4759			document.documentElement.doScroll('left');
4760
4761		} catch (e) {
4762
4763			setTimeout(arguments.callee, 50);
4764
4765			return;
4766
4767		}
4768
4769		hs.ready();
4770
4771	})();
4772
4773}
4774
4775hs.addEventListener(document, 'DOMContentLoaded', hs.ready);
4776
4777hs.addEventListener(window, 'load', hs.ready);
4778
4779hs.langDefaults = hs.lang;
4780
4781// history
4782
4783var HsExpander = hs.Expander;
4784
4785
4786
4787// set handlers
4788
4789hs.addEventListener(window, 'load', function() {
4790
4791	if (hs.expandCursor) {
4792
4793		var sel = '.highslide img', 
4794
4795			dec = 'cursor: url('+ hs.graphicsDir + hs.expandCursor +'), pointer !important;';
4796
4797			
4798
4799		var style = hs.createElement('style', { type: 'text/css' }, null, 
4800
4801			document.getElementsByTagName('HEAD')[0]);
4802
4803	
4804
4805		if (!hs.ie) {
4806
4807			style.appendChild(document.createTextNode(sel + " {" + dec + "}"));
4808
4809		} else {
4810
4811			var last = document.styleSheets[document.styleSheets.length - 1];
4812
4813			if (typeof(last.addRule) == "object") last.addRule(sel, dec);
4814
4815		}
4816
4817	}
4818
4819});
4820
4821hs.addEventListener(window, 'resize', function() {
4822
4823	hs.getPageSize();
4824
4825});
4826
4827hs.addEventListener(document, 'mousemove', function(e) {
4828
4829	hs.mouse = { x: e.clientX, y: e.clientY	};
4830
4831});
4832
4833hs.addEventListener(document, 'mousedown', hs.mouseClickHandler);
4834
4835hs.addEventListener(document, 'mouseup', hs.mouseClickHandler);
4836
4837
4838
4839hs.addEventListener(document, 'ready', hs.getAnchors);
4840
4841hs.addEventListener(window, 'load', hs.preloadImages);
4842
4843hs.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.