PageSourceSearch

http://wretc.in/js/lightbox.js

js wretc.in collected 2026-10-08 02:44:23 UTC 24,166 bytes, 786 lines download raw bytes

1// -----------------------------------------------------------------------------------
2//
3//	Lightbox v2.03
4//	by Lokesh Dhakar - http://www.huddletogether.com
5//	4/9/06
6//
7//	For more information on this script, visit:
8//	http://huddletogether.com/projects/lightbox2/
9//
10//	Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
11//	
12//	Credit also due to those who have helped, inspired, and made their code available to the public.
13//	Including: Scott Upton(uptonic.com), Peter-Paul Koch(quirksmode.org), Thomas Fuchs(mir.aculo.us), and others.
14//
15//	Lightbox v2.03a
16//	by Dynamicdrive.com- http://www.dynamicdrive.com
17//	Nov 29th, 2007
18//	Added ability for the caption ("title" attr of link) to be optionally hyperlinked, by throwing in a "rev" attr containing the desired link
19// -----------------------------------------------------------------------------------
20/*
21
22	Table of Contents
23	-----------------
24	Configuration
25	Global Variables
26
27	Extending Built-in Objects	
28	- Object.extend(Element)
29	- Array.prototype.removeDuplicates()
30	- Array.prototype.empty()
31
32	Lightbox Class Declaration
33	- initialize()
34	- start()
35	- changeImage()
36	- resizeImageContainer()
37	- showImage()
38	- updateDetails()
39	- updateNav()
40	- enableKeyboardNav()
41	- disableKeyboardNav()
42	- keyboardAction()
43	- preloadNeighborImages()
44	- end()
45	
46	Miscellaneous Functions
47	- getPageScroll()
48	- getPageSize()
49	- getKey()
50	- listenKey()
51	- showSelectBoxes()
52	- hideSelectBoxes()
53	- showFlash()
54	- hideFlash()
55	- pause()
56	- initLightbox()
57	
58	Function Calls
59	- addLoadEvent(initLightbox)
60	
61*/
62// -----------------------------------------------------------------------------------
63
64//
65//	Configuration
66//
67var fileLoadingImage = "images/loading.gif";		
68var fileBottomNavCloseImage = "images/closelabel.gif";
69
70var animate = true;	// toggles resizing animations
71var resizeSpeed = 7;	// controls the speed of the image resizing animations (1=slowest and 10=fastest)
72
73var borderSize = 10;	//if you adjust the padding in the CSS, you will need to update this variable
74
75// -----------------------------------------------------------------------------------
76
77//
78//	Global Variables
79//
80var imageArray = new Array;
81var activeImage;
82
83if(animate == true){
84	overlayDuration = 0.2;	// shadow fade in/out duration
85	if(resizeSpeed > 10){ resizeSpeed = 10;}
86	if(resizeSpeed < 1){ resizeSpeed = 1;}
87	resizeDuration = (11 - resizeSpeed) * 0.15;
88} else { 
89	overlayDuration = 0;
90	resizeDuration = 0;
91}
92
93// -----------------------------------------------------------------------------------
94
95//
96//	Additional methods for Element added by SU, Couloir
97//	- further additions by Lokesh Dhakar (huddletogether.com)
98//
99Object.extend(Element, {
100	getWidth: function(element) {
101	   	element = $(element);
102	   	return element.offsetWidth; 
103	},
104	setWidth: function(element,w) {
105	   	element = $(element);
106    	element.style.width = w +"px";
107	},
108	setHeight: function(element,h) {
109   		element = $(element);
110    	element.style.height = h +"px";
111	},
112	setTop: function(element,t) {
113	   	element = $(element);
114    	element.style.top = t +"px";
115	},
116	setSrc: function(element,src) {
117    	element = $(element);
118    	element.src = src; 
119	},
120	setHref: function(element,href) {
121    	element = $(element);
122    	element.href = href; 
123	},
124	setInnerHTML: function(element,content) {
125		element = $(element);
126		element.innerHTML = content;
127	}
128});
129
130// -----------------------------------------------------------------------------------
131
132//
133//	Extending built-in Array object
134//	- array.removeDuplicates()
135//	- array.empty()
136//
137Array.prototype.removeDuplicates = function () {
138    for(i = 0; i < this.length; i++){
139        for(j = this.length-1; j>i; j--){        
140            if(this[i][0] == this[j][0]){
141                this.splice(j,1);
142            }
143        }
144    }
145}
146
147// -----------------------------------------------------------------------------------
148
149Array.prototype.empty = function () {
150	for(i = 0; i <= this.length; i++){
151		this.shift();
152	}
153}
154
155// -----------------------------------------------------------------------------------
156
157//
158//	Lightbox Class Declaration
159//	- initialize()
160//	- start()
161//	- changeImage()
162//	- resizeImageContainer()
163//	- showImage()
164//	- updateDetails()
165//	- updateNav()
166//	- enableKeyboardNav()
167//	- disableKeyboardNav()
168//	- keyboardNavAction()
169//	- preloadNeighborImages()
170//	- end()
171//
172//	Structuring of code inspired by Scott Upton (http://www.uptonic.com/)
173//
174var Lightbox = Class.create();
175
176Lightbox.prototype = {
177	
178	// initialize()
179	// Constructor runs on completion of the DOM loading. Loops through anchor tags looking for 
180	// 'lightbox' references and applies onclick events to appropriate links. The 2nd section of
181	// the function inserts html at the bottom of the page which is used to display the shadow 
182	// overlay and the image container.
183	//
184	initialize: function() {	
185		if (!document.getElementsByTagName){ return; }
186		var anchors = document.getElementsByTagName('a');
187		var areas = document.getElementsByTagName('area');
188
189		// loop through all anchor tags
190		for (var i=0; i<anchors.length; i++){
191			var anchor = anchors[i];
192			
193			var relAttribute = String(anchor.getAttribute('rel'));
194			
195			// use the string.match() method to catch 'lightbox' references in the rel attribute
196			if (anchor.getAttribute('href') && (relAttribute.toLowerCase().match('lightbox'))){
197				anchor.onclick = function () {myLightbox.start(this); return false;}
198			}
199		}
200
201		// loop through all area tags
202		// todo: combine anchor & area tag loops
203		for (var i=0; i< areas.length; i++){
204			var area = areas[i];
205			
206			var relAttribute = String(area.getAttribute('rel'));
207			
208			// use the string.match() method to catch 'lightbox' references in the rel attribute
209			if (area.getAttribute('href') && (relAttribute.toLowerCase().match('lightbox'))){
210				area.onclick = function () {myLightbox.start(this); return false;}
211			}
212		}
213
214		// The rest of this code inserts html at the bottom of the page that looks similar to this:
215		//
216		//	<div id="overlay"></div>
217		//	<div id="lightbox">
218		//		<div id="outerImageContainer">
219		//			<div id="imageContainer">
220		//				<img id="lightboxImage">
221		//				<div style="" id="hoverNav">
222		//					<a href="#" id="prevLink"></a>
223		//					<a href="#" id="nextLink"></a>
224		//				</div>
225		//				<div id="loading">
226		//					<a href="#" id="loadingLink">
227		//						<img src="images/loading.gif">
228		//					</a>
229		//				</div>
230		//			</div>
231		//		</div>
232		//		<div id="imageDataContainer">
233		//			<div id="imageData">
234		//				<div id="imageDetails">
235		//					<span id="caption"></span>
236		//					<span id="numberDisplay"></span>
237		//				</div>
238		//				<div id="bottomNav">
239		//					<a href="#" id="bottomNavClose">
240		//						<img src="images/close.gif">
241		//					</a>
242		//				</div>
243		//			</div>
244		//		</div>
245		//	</div>
246
247
248		var objBody = document.getElementsByTagName("body").item(0);
249		
250		var objOverlay = document.createElement("div");
251		objOverlay.setAttribute('id','overlay');
252		objOverlay.style.display = 'none';
253		objOverlay.onclick = function() { myLightbox.end(); }
254		objBody.appendChild(objOverlay);
255		
256		var objLightbox = document.createElement("div");
257		objLightbox.setAttribute('id','lightbox');
258		objLightbox.style.display = 'none';
259		objLightbox.onclick = function(e) {	// close Lightbox is user clicks shadow overlay
260			if (!e) var e = window.event;
261			var clickObj = Event.element(e).id;
262			if ( clickObj == 'lightbox') {
263				myLightbox.end();
264			}
265		};
266		objBody.appendChild(objLightbox);
267			
268		var objOuterImageContainer = document.createElement("div");
269		objOuterImageContainer.setAttribute('id','outerImageContainer');
270		objLightbox.appendChild(objOuterImageContainer);
271
272		// When Lightbox starts it will resize itself from 250 by 250 to the current image dimension.
273		// If animations are turned off, it will be hidden as to prevent a flicker of a
274		// white 250 by 250 box.
275		if(animate){
276			Element.setWidth('outerImageContainer', 250);
277			Element.setHeight('outerImageContainer', 250);			
278		} else {
279			Element.setWidth('outerImageContainer', 1);
280			Element.setHeight('outerImageContainer', 1);			
281		}
282
283		var objImageContainer = document.createElement("div");
284		objImageContainer.setAttribute('id','imageContainer');
285		objOuterImageContainer.appendChild(objImageContainer);
286	
287		var objLightboxImage = document.createElement("img");
288		objLightboxImage.setAttribute('id','lightboxImage');
289		objImageContainer.appendChild(objLightboxImage);
290	
291		var objHoverNav = document.createElement("div");
292		objHoverNav.setAttribute('id','hoverNav');
293		objImageContainer.appendChild(objHoverNav);
294	
295		var objPrevLink = document.createElement("a");
296		objPrevLink.setAttribute('id','prevLink');
297		objPrevLink.setAttribute('href','#');
298		objHoverNav.appendChild(objPrevLink);
299		
300		var objNextLink = document.createElement("a");
301		objNextLink.setAttribute('id','nextLink');
302		objNextLink.setAttribute('href','#');
303		objHoverNav.appendChild(objNextLink);
304	
305		var objLoading = document.createElement("div");
306		objLoading.setAttribute('id','loading');
307		objImageContainer.appendChild(objLoading);
308	
309		var objLoadingLink = document.createElement("a");
310		objLoadingLink.setAttribute('id','loadingLink');
311		objLoadingLink.setAttribute('href','#');
312		objLoadingLink.onclick = function() { myLightbox.end(); return false; }
313		objLoading.appendChild(objLoadingLink);
314	
315		var objLoadingImage = document.createElement("img");
316		objLoadingImage.setAttribute('src', fileLoadingImage);
317		objLoadingLink.appendChild(objLoadingImage);
318
319		var objImageDataContainer = document.createElement("div");
320		objImageDataContainer.setAttribute('id','imageDataContainer');
321		objImageDataContainer.className = 'clearfix';
322		objLightbox.appendChild(objImageDataContainer);
323
324		var objImageData = document.createElement("div");
325		objImageData.setAttribute('id','imageData');
326		objImageDataContainer.appendChild(objImageData);
327	
328		var objImageDetails = document.createElement("div");
329		objImageDetails.setAttribute('id','imageDetails');
330		objImageData.appendChild(objImageDetails);
331	
332		var objCaption = document.createElement("span");
333		objCaption.setAttribute('id','caption');
334		objImageDetails.appendChild(objCaption);
335	
336		var objNumberDisplay = document.createElement("span");
337		objNumberDisplay.setAttribute('id','numberDisplay');
338		objImageDetails.appendChild(objNumberDisplay);
339		
340		var objBottomNav = document.createElement("div");
341		objBottomNav.setAttribute('id','bottomNav');
342		objImageData.appendChild(objBottomNav);
343	
344		var objBottomNavCloseLink = document.createElement("a");
345		objBottomNavCloseLink.setAttribute('id','bottomNavClose');
346		objBottomNavCloseLink.setAttribute('href','#');
347		objBottomNavCloseLink.onclick = function() { myLightbox.end(); return false; }
348		objBottomNav.appendChild(objBottomNavCloseLink);
349	
350		var objBottomNavCloseImage = document.createElement("img");
351		objBottomNavCloseImage.setAttribute('src', fileBottomNavCloseImage);
352		objBottomNavCloseLink.appendChild(objBottomNavCloseImage);
353	},
354	
355	//
356	//	start()
357	//	Display overlay and lightbox. If image is part of a set, add siblings to imageArray.
358	//
359	start: function(imageLink) {	
360
361		function getImageTitle(anchor){ //DynamicDrive.com added function that allows the caption("title") to be linked ("rev").
362			var ddimageTitle=anchor.getAttribute('title')
363			var ddimageTitleURL=(ddimageTitle!=null && ddimageTitle!="")? anchor.getAttribute('rev') : null
364			return ddimageTitleFinal=(ddimageTitleURL!=null && ddimageTitleURL!="")? '<a href="'+ddimageTitleURL+'" class="ddcaptionurl">'+ddimageTitle+'</a>' : ddimageTitle
365		};
366
367		hideSelectBoxes();
368		hideFlash();
369
370		// stretch overlay to fill page and fade in
371		var arrayPageSize = getPageSize();
372		Element.setHeight('overlay', arrayPageSize[1]);
373
374		new Effect.Appear('overlay', { duration: overlayDuration, from: 0.0, to: 0.8 });
375
376		imageArray = [];
377		imageNum = 0;		
378
379		if (!document.getElementsByTagName){ return; }
380		var anchors = document.getElementsByTagName('a');
381
382		// if image is NOT part of a set..
383		if((imageLink.getAttribute('rel') == 'lightbox')){
384			// add single image to imageArray
385			imageArray.push(new Array(imageLink.getAttribute('href'), getImageTitle(imageLink)));			
386		} else {
387		// if image is part of a set..
388
389			// loop through anchors, find other images in set, and add them to imageArray
390			for (var i=0; i<anchors.length; i++){
391				var anchor = anchors[i];
392				if (anchor.getAttribute('href') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))){
393					imageArray.push(new Array(anchor.getAttribute('href'), getImageTitle(anchor)));
394				}
395			}
396			imageArray.removeDuplicates();
397			while(imageArray[imageNum][0] != imageLink.getAttribute('href')) { imageNum++;}
398		}
399
400		// calculate top offset for the lightbox and display 
401		var arrayPageScroll = getPageScroll();
402		var lightboxTop = arrayPageScroll[1] + (arrayPageSize[3] / 10);
403
404		Element.setTop('lightbox', lightboxTop);
405		Element.show('lightbox');
406		
407		this.changeImage(imageNum);
408	},
409
410	//
411	//	changeImage()
412	//	Hide most elements and preload image in preparation for resizing image container.
413	//
414	changeImage: function(imageNum) {	
415		
416		activeImage = imageNum;	// update global var
417
418		// hide elements during transition
419		if(animate){ Element.show('loading');}
420		Element.hide('lightboxImage');
421		Element.hide('hoverNav');
422		Element.hide('prevLink');
423		Element.hide('nextLink');
424		Element.hide('imageDataContainer');
425		Element.hide('numberDisplay');		
426		
427		imgPreloader = new Image();
428		
429		// once image is preloaded, resize image container
430		imgPreloader.onload=function(){
431			Element.setSrc('lightboxImage', imageArray[activeImage][0]);
432			myLightbox.resizeImageContainer(imgPreloader.width, imgPreloader.height);
433		}
434		imgPreloader.src = imageArray[activeImage][0];
435	},
436
437	//
438	//	resizeImageContainer()
439	//
440	resizeImageContainer: function( imgWidth, imgHeight) {
441
442		// get curren width and height
443		this.widthCurrent = Element.getWidth('outerImageContainer');
444		this.heightCurrent = Element.getHeight('outerImageContainer');
445
446		// get new width and height
447		var widthNew = (imgWidth  + (borderSize * 2));
448		var heightNew = (imgHeight  + (borderSize * 2));
449
450		// scalars based on change from old to new
451		this.xScale = ( widthNew / this.widthCurrent) * 100;
452		this.yScale = ( heightNew / this.heightCurrent) * 100;
453
454		// calculate size difference between new and old image, and resize if necessary
455		wDiff = this.widthCurrent - widthNew;
456		hDiff = this.heightCurrent - heightNew;
457
458		if(!( hDiff == 0)){ new Effect.Scale('outerImageContainer', this.yScale, {scaleX: false, duration: resizeDuration, queue: 'front'}); }
459		if(!( wDiff == 0)){ new Effect.Scale('outerImageContainer', this.xScale, {scaleY: false, delay: resizeDuration, duration: resizeDuration}); }
460
461		// if new and old image are same size and no scaling transition is necessary, 
462		// do a quick pause to prevent image flicker.
463		if((hDiff == 0) && (wDiff == 0)){
464			if (navigator.appVersion.indexOf("MSIE")!=-1){ pause(250); } else { pause(100);} 
465		}
466
467		Element.setHeight('prevLink', imgHeight);
468		Element.setHeight('nextLink', imgHeight);
469		Element.setWidth( 'imageDataContainer', widthNew);
470
471		this.showImage();
472	},
473	
474	//
475	//	showImage()
476	//	Display image and begin preloading neighbors.
477	//
478	showImage: function(){
479		Element.hide('loading');
480		new Effect.Appear('lightboxImage', { duration: resizeDuration, queue: 'end', afterFinish: function(){	myLightbox.updateDetails(); } });
481		this.preloadNeighborImages();
482	},
483
484	//
485	//	updateDetails()
486	//	Display caption, image number, and bottom nav.
487	//
488	updateDetails: function() {
489	
490		Element.show('caption');
491		Element.setInnerHTML( 'caption', imageArray[activeImage][1]);
492		
493		// if image is part of set display 'Image x of x' 
494		if(imageArray.length > 1){
495			Element.show('numberDisplay');
496			Element.setInnerHTML( 'numberDisplay', "Image " + eval(activeImage + 1) + " of " + imageArray.length);
497		}
498
499		new Effect.Parallel(
500			[ new Effect.SlideDown( 'imageDataContainer', { sync: true, duration: resizeDuration, from: 0.0, to: 1.0 }), 
501			  new Effect.Appear('imageDataContainer', { sync: true, duration: resizeDuration }) ], 
502			{ duration: resizeDuration, afterFinish: function() {
503				// update overlay size and update nav
504				var arrayPageSize = getPageSize();
505				Element.setHeight('overlay', arrayPageSize[1]);
506				myLightbox.updateNav();
507				}
508			} 
509		);
510	},
511
512	//
513	//	updateNav()
514	//	Display appropriate previous and next hover navigation.
515	//
516	updateNav: function() {
517
518		Element.show('hoverNav');				
519
520		// if not first image in set, display prev image button
521		if(activeImage != 0){
522			Element.show('prevLink');
523			document.getElementById('prevLink').onclick = function() {
524				myLightbox.changeImage(activeImage - 1); return false;
525			}
526		}
527
528		// if not last image in set, display next image button
529		if(activeImage != (imageArray.length - 1)){
530			Element.show('nextLink');
531			document.getElementById('nextLink').onclick = function() {
532				myLightbox.changeImage(activeImage + 1); return false;
533			}
534		}
535		
536		this.enableKeyboardNav();
537	},
538
539	//
540	//	enableKeyboardNav()
541	//
542	enableKeyboardNav: function() {
543		document.onkeydown = this.keyboardAction; 
544	},
545
546	//
547	//	disableKeyboardNav()
548	//
549	disableKeyboardNav: function() {
550		document.onkeydown = '';
551	},
552
553	//
554	//	keyboardAction()
555	//
556	keyboardAction: function(e) {
557		if (e == null) { // ie
558			keycode = event.keyCode;
559			escapeKey = 27;
560		} else { // mozilla
561			keycode = e.keyCode;
562			escapeKey = e.DOM_VK_ESCAPE;
563		}
564
565		key = String.fromCharCode(keycode).toLowerCase();
566		
567		if((key == 'x') || (key == 'o') || (key == 'c') || (keycode == escapeKey)){	// close lightbox
568			myLightbox.end();
569		} else if((key == 'p') || (keycode == 37)){	// display previous image
570			if(activeImage != 0){
571				myLightbox.disableKeyboardNav();
572				myLightbox.changeImage(activeImage - 1);
573			}
574		} else if((key == 'n') || (keycode == 39)){	// display next image
575			if(activeImage != (imageArray.length - 1)){
576				myLightbox.disableKeyboardNav();
577				myLightbox.changeImage(activeImage + 1);
578			}
579		}
580
581	},
582
583	//
584	//	preloadNeighborImages()
585	//	Preload previous and next images.
586	//
587	preloadNeighborImages: function(){
588
589		if((imageArray.length - 1) > activeImage){
590			preloadNextImage = new Image();
591			preloadNextImage.src = imageArray[activeImage + 1][0];
592		}
593		if(activeImage > 0){
594			preloadPrevImage = new Image();
595			preloadPrevImage.src = imageArray[activeImage - 1][0];
596		}
597	
598	},
599
600	//
601	//	end()
602	//
603	end: function() {
604		this.disableKeyboardNav();
605		Element.hide('lightbox');
606		new Effect.Fade('overlay', { duration: overlayDuration});
607		showSelectBoxes();
608		showFlash();
609	}
610}
611
612// -----------------------------------------------------------------------------------
613
614//
615// getPageScroll()
616// Returns array with x,y page scroll values.
617// Core code from - quirksmode.org
618//
619function getPageScroll(){
620
621	var yScroll;
622
623	if (self.pageYOffset) {
624		yScroll = self.pageYOffset;
625	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
626		yScroll = document.documentElement.scrollTop;
627	} else if (document.body) {// all other Explorers
628		yScroll = document.body.scrollTop;
629	}
630
631	arrayPageScroll = new Array('',yScroll) 
632	return arrayPageScroll;
633}
634
635// -----------------------------------------------------------------------------------
636
637//
638// getPageSize()
639// Returns array with page width, height and window width, height
640// Core code from - quirksmode.org
641// Edit for Firefox by pHaez
642//
643function getPageSize(){
644	
645	var xScroll, yScroll;
646	
647	if (window.innerHeight && window.scrollMaxY) {	
648		xScroll = document.body.scrollWidth;
649		yScroll = window.innerHeight + window.scrollMaxY;
650	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
651		xScroll = document.body.scrollWidth;
652		yScroll = document.body.scrollHeight;
653	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
654		xScroll = document.body.offsetWidth;
655		yScroll = document.body.offsetHeight;
656	}
657	
658	var windowWidth, windowHeight;
659	if (self.innerHeight) {	// all except Explorer
660		windowWidth = self.innerWidth;
661		windowHeight = self.innerHeight;
662	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
663		windowWidth = document.documentElement.clientWidth;
664		windowHeight = document.documentElement.clientHeight;
665	} else if (document.body) { // other Explorers
666		windowWidth = document.body.clientWidth;
667		windowHeight = document.body.clientHeight;
668	}	
669	
670	// for small pages with total height less then height of the viewport
671	if(yScroll < windowHeight){
672		pageHeight = windowHeight;
673	} else { 
674		pageHeight = yScroll;
675	}
676
677	// for small pages with total width less then width of the viewport
678	if(xScroll < windowWidth){	
679		pageWidth = windowWidth;
680	} else {
681		pageWidth = xScroll;
682	}
683
684	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
685	return arrayPageSize;
686}
687
688// -----------------------------------------------------------------------------------
689
690//
691// getKey(key)
692// Gets keycode. If 'x' is pressed then it hides the lightbox.
693//
694function getKey(e){
695	if (e == null) { // ie
696		keycode = event.keyCode;
697	} else { // mozilla
698		keycode = e.which;
699	}
700	key = String.fromCharCode(keycode).toLowerCase();
701	
702	if(key == 'x'){
703	}
704}
705
706// -----------------------------------------------------------------------------------
707
708//
709// listenKey()
710//
711function listenKey () {	document.onkeypress = getKey; }
712	
713// ---------------------------------------------------
714
715function showSelectBoxes(){
716	var selects = document.getElementsByTagName("select");
717	for (i = 0; i != selects.length; i++) {
718		selects[i].style.visibility = "visible";
719	}
720}
721
722// ---------------------------------------------------
723
724function hideSelectBoxes(){
725	var selects = document.getElementsByTagName("select");
726	for (i = 0; i != selects.length; i++) {
727		selects[i].style.visibility = "hidden";
728	}
729}
730
731// ---------------------------------------------------
732
733function showFlash(){
734	var flashObjects = document.getElementsByTagName("object");
735	for (i = 0; i != flashObjects.length; i++) {
736		flashObjects[i].style.visibility = "visible";
737	}
738
739	var flashEmbeds = document.getElementsByTagName("embeds");
740	for (i = 0; i != flashEmbeds.length; i++) {
741		flashEmbeds[i].style.visibility = "visible";
742	}
743}
744
745// ---------------------------------------------------
746
747function hideFlash(){
748	var flashObjects = document.getElementsByTagName("object");
749	for (i = 0; i != flashObjects.length; i++) {
750		flashObjects[i].style.visibility = "hidden";
751	}
752
753	var flashEmbeds = document.getElementsByTagName("embeds");
754	for (i = 0; i != flashEmbeds.length; i++) {
755		flashEmbeds[i].style.visibility = "hidden";
756	}
757
758}
759
760
761// ---------------------------------------------------
762
763//
764// pause(numberMillis)
765// Pauses code execution for specified time. Uses busy code, not good.
766// Help from Ran Bar-On [[email protected]]
767//
768
769function pause(ms){
770	var date = new Date();
771	curDate = null;
772	do{var curDate = new Date();}
773	while( curDate - date < ms);
774}
775/*
776function pause(numberMillis) {
777	var curently = new Date().getTime() + sender;
778	while (new Date().getTime();	
779}
780*/
781// ---------------------------------------------------
782
783
784
785function initLightbox() { myLightbox = new Lightbox(); }
786Event.observe(window, 'load', initLightbox, false);

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.