PageSourceSearch

https://jugamostodos.org/templates/newsplace/js/multibox/multibox.js

js jugamostodos.org collected 2026-09-24 09:17:49 UTC 42,403 bytes, 1,264 lines download raw bytes

1if(!Array.prototype.from ) Array.prototype.from = function(item){
2	if (item == null) return [];
3	return (typeof(item) == 'array') ? item :   [item];
4};
5
6	Function.prototype.passx=function(args, bind){
7		var self = this;
8		if (args != null) args = Array.prototype.from(args);
9		return function(){
10			return self.apply(bind, args || arguments);
11		};
12	};
13
14if ( !Array.prototype.forEach ) {
15  Array.prototype.forEach = function(fn, scope) {
16    for(var i = 0, len = this.length; i < len; ++i) {
17      fn.call(scope || this, this[i], i, this);
18    }
19  }
20}
21
22if(undefined == Function.prototype.bind){
23	Function.prototype.bind=function(that){
24		var self = this,
25			args = arguments.length > 1 ? Array.slice(arguments, 1) : null,
26			F = function(){};
27
28		var bound = function(){
29			var context = that, length = arguments.length;
30			if (this instanceof bound){
31				F.prototype = self.prototype;
32				context = new F;
33			}
34			var result = (!args && !length)
35				? self.call(context)
36				: self.apply(context, args && length ? args.concat(Array.slice(arguments)) : args || arguments);
37			return context == that ? result : context;
38		};
39		return bound;
40	}
41}
42
43if(!String.prototype.contains) String.prototype.contains=function(n){return this.indexOf(n)>-1;};
44if(!Array.prototype.contains) Array.prototype.contains=function(n){return this.indexOf(n)>-1;};
45
46var Eventx = {
47	
48
49    addEvent:function(elem, type, func){
50        if (document.addEventListener) {
51            elem.addEventListener(type, func, false);
52        }
53        else {
54            elem.attachEvent('on' + type, func);
55        }
56    },
57	
58
59	onResizend:function(onResizend){
60		
61
62		var actionState = 'normal',
63			taskPtr = null,
64			timeOutTask = function(){
65				taskPtr && clearTimeout(taskPtr);
66				taskPtr = setTimeout(function(){
67					onResizend && onResizend();
68					actionState = 'normal';
69				},500)
70			};	
71							
72		this.addEvent(
73			window, 
74			'resize', 
75			function(){
76				actionState = 'resizing';			
77				timeOutTask();
78			}
79		);
80	},
81	
82
83	onResizestart :function(onResizestart){
84		var isExecuted = false;	
85		this.onResizend(function(){isExecuted = false;});				
86		this.addEvent(
87			window, 
88			'resize', 
89			function(){				
90				if(!isExecuted){
91					onResizestart && onResizestart();
92					isExecuted = true;
93				}
94			}
95		);
96	}	
97};
98// For IE8 and earlier version.
99if (!Date.now) {
100  Date.now = function() {
101    return new Date().valueOf();
102  }
103}
104if(!Array.prototype.indexOf){	
105	Array.prototype.indexOf = function(obj, start) {
106     for (var i = (start || 0), j = this.length; i < j; i++) {
107         if (this[i] === obj) { return i; }
108     }
109     return -1;
110}
111}
112var UID = Date.now();
113String.prototype.test=function(n){
114	return this.match(n)==null?false:true;
115}
116String.prototype.uniqueID= function(){
117	return (UID++).toString(36);
118};
119Array.prototype.includex=function(n){
120	if(this.indexOf(n)==-1)this.push(n);
121}
122Object.toInt=function(){return parseInt(this);}
123/*Object.append=function (z){for(var y=1,w=arguments.length;
124y<w;y++){var v=arguments[y]||{};for(var x in v){z[x]=v[x];}}return z;};*/
125/*Object.prototype.each=function(fn, bind){
126		Array.prototype.forEach(this, fn, bind);
127		return this;
128	};*/
129Object.toQueryString=function (b,c){
130	var d=[];
131	for(g in b){
132		h=b[g];
133	//Object.each(b,function(h,g){
134		if(c){
135			g=c+"["+g+"]";
136		}
137		var f;
138		switch(typeof(h)){
139			case "object":f=Object.toQueryString(h,g);break;
140			case "array":var e={};h.forEach(function(k,j){e[j]=k;});f=Object.toQueryString(e,g);break;
141			default:f=g+"="+encodeURIComponent(h);}if(h!=null){d.push(f);}
142	//});
143	}
144	return d.join("&");
145};
146
147/**************************************************************
148
149	Script		: multiBox
150	Version		: 2.0.6
151	Authors		: Samuel Birch
152	Desc		: Supports jpg, gif, png, flash, flv, mov, wmv, mp3, html, iframe
153	Licence		: Open Source MIT Licence
154	Modified	: Liam Smart ([email protected]) - MooTools 1.2 upgrade
155	Usage		: window.bind('domready', function(){
156					  //call multiBox
157					  var initMultiBox = new multiBox({
158						  mbClass: '.mb',//class you need to add links that you want to trigger multiBox with (remember and update CSS files)
159						  container: $(document.body),//where to appendTo multiBox
160						  descClassName: 'multiBoxDesc',//the class name of the description divs
161						  path: './Files/',//path to mp3 and flv players
162						  useOverlay: true,//use a semi-transparent background. default: false;
163						  maxSize: {w:600, h:400},//max dimensions (width,height) - set to null to disable resizing
164						  addDownload: true,//do you want the files to be downloadable?
165						  pathToDownloadScript: './Scripts/forceDownload.asp',//if above is true, specify path to download script (classicASP and ASP.NET versions included)
166						  addRollover: true,//add rollover fade to each multibox link
167						  addOverlayIcon: true,//adds overlay icons to images within multibox links
168						  addChain: true,//cycle through all images fading them out then in
169						  recalcTop: true,//subtract the height of controls panel from top position
170						  addTips: true,//adds MooTools built in 'Tips' class to each element (see: http://mootools.net/docs/Plugins/Tips)
171						  autoOpen: 0//to auto open a multiBox element on page load change to (1, 2, or 3 etc)
172					  });
173				  });
174
175**************************************************************/
176(function($){
177
178	$.fn.getLast=function(n){
179		return $(this).children().last();
180	};
181	$.fn.getElements=$.fn.children;
182	$.fn.getElement=function(elm){
183		return $(elm,$(this));
184	};
185	$.fn.getPrevious=$.fn.prev;
186	$.fn.getFirst=function(n){
187		return $(this).children().first();
188	};
189	$.fn.getNext=$.fn.next;
190
191var $chk=function (i){return !!(i||i===0);};
192
193function Tips(elm, options){
194	//window.complete=true;
195	this.options={
196		onShow:function(){},
197		onHide:function(){},
198		offsets:{'x':0,'y':0},
199		className:'mbTips'
200	};
201	this.options=$.extend(this.options,options);
202	$(elm).bind('mouseenter',function(e){
203		if($(elm).data('tips')==undefined) {
204			var titleAttr=$(elm).attr('title')?$(elm).attr('title'):$(elm).attr('oldtitle');
205				var content=$('<div class="tip"></div>').append($('<div class="tip-title"></div>').html(titleAttr)).append($('<div class="tip-text"></div>').html($(elm).attr('rel')));
206				var tips=$('<div class="mbTips"></div>').css({'position':'absolute'})
207				.append($('<div class="tip-top"></div>'))
208				.append(content).append($('<div class="tip-bottom"></div>')).appendTo($('body'))
209				;
210				$(elm).data('tips',tips);
211				
212				$(elm).attr('oldtitle',$(elm).attr('title'));
213				$(elm).removeAttr('title');
214				
215		}
216		 $(elm).data('tips').css({'left':$(window).scrollLeft()+e.clientX+options.offsets.x,'top':$(window).scrollTop()+e.clientY+options.offsets.y}).fadeIn('slow');
217		
218	}).bind('mouseleave',function(){
219			if($(elm).data('tips'))$(elm).data('tips').fadeOut();
220	}).bind('mousemove',function(e){ 
221			if($(elm).data('tips'))$(elm).data('tips').css({'left':$(window).scrollLeft()+e.clientX+options.offsets.x,'top':$(window).scrollTop()+e.clientY+options.offsets.y});
222	}).bind('click',function(e){
223			$(elm).data('tips').remove();
224			$(elm).removeData('tips');
225	});
226	
227}
228
229function Swiff(path,options){
230
231
232	this.options={
233		id: null,
234		height: 1,
235		width: 1,
236		container: null,
237		properties: {},
238		params: {
239			quality: 'high',
240			allowScriptAccess: 'always',
241			wMode: 'window',
242			swLiveConnect: true
243		},
244		callBacks: {},
245		vars: {}
246	};
247	this.instance = 'Swiff_' + String.prototype.uniqueID();
248
249		this.options=$.extend(this.options,options);
250		options = this.options;
251		var id = this.id = options.id || this.instance;
252		var container = this.options.container;
253
254		Swiff.CallBacks[this.instance] = {};
255
256		var params = options.params, vars = options.vars, callBacks = options.callBacks;
257		var properties = $.extend(options.properties,{height: options.height, width: options.width});
258
259		var self = this;
260
261		for (var callBack in callBacks){
262			Swiff.CallBacks[this.instance][callBack] = (function(option){
263				return function(){
264					return option.apply(self.object, arguments);
265				};
266			})(callBacks[callBack]);
267			vars[callBack] = 'Swiff.CallBacks.' + this.instance + '.' + callBack;
268		}
269
270		params.flashVars = Object.toQueryString(vars);
271		if (jQuery.browser.msie){
272			properties.classid = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
273			params.movie = path;
274		} else {
275			properties.type = 'application/x-shockwave-flash';
276		}
277		properties.data = path;
278
279		var build = '<object id="' + id + '"';
280		for (var property in properties) build += ' ' + property + '="' + properties[property] + '"';
281		build += '>';
282		for (var param in params){
283			if (params[param]) build += '<param name="' + param + '" value="' + params[param] + '" />';
284		}
285		build += '</object>';
286		this.object = ((container.length<=0) ? container.empty() : jQuery('<div></div>').html( build).appendTo(container));
287		
288}
289
290	Swiff.prototype.toElement=function(){
291		return this.object;
292	},
293
294
295	Swiff.prototype.replaces= function(element){
296		element = document.getElementById(element);
297		element.parentNode.replaceChild(this.toElement(), element);
298		return this;
299	},
300
301	Swiff.prototype.inject= function(element){
302		document.getElementById(element).appendChild(this.toElement());	
303		return this;
304	},
305
306	Swiff.prototype.remote= function(){
307		return Swiff.remote.apply(Swiff, [this.toElement()].append(arguments));
308	}
309
310
311
312Swiff.CallBacks = {};
313
314Swiff.remote = function(obj, fn){
315	var rs = obj.CallFunction('<invoke name="' + fn + '" returntype="javascript">' + __flash__argumentsToXML(arguments, 2) + '</invoke>');
316	return eval(rs);
317};
318
319
320function Chain(){
321
322	this.$chain= [];
323}
324Chain.prototype.chain=function(){
325	this.$chain.append(Array.flatten(arguments));
326	return this;
327};
328
329Chain.prototype.callChain=function(){
330	return (this.$chain.length) ? this.$chain.shift().apply(this, arguments) : false;
331};
332
333Chain.prototype.clearChain=function(){
334		this.$chain.empty();
335		return this;
336};
337
338//start multiBox class
339	window.multiBox = function(options){
340
341	
342	//options
343	this.options={
344		initialSize: {w:250, h:250},//initial width/height the box will open at before resizing
345		useOverlay: false,//do you want to use a semi-transparent background?
346		contentColor: '#fff',//background colour of the content holder within the pop-up
347		showNumbers: true,//show numbers such as "4 of 12"
348		showControls: true,//show the previous/next, title, download etc
349		descClassName: false,//class of description box
350		movieSize: {w:400, h:300},//default width/height of movie
351		offset: {x:0, y:0},//offset multiBox position
352		fixedTop: false,//force multiBox to open at top of page
353		path: './Files/',//path to mp3player and flvplayer etc
354		openFromLink: true,//pop-up will slide in from the position of the element clicked
355		useKeyboard: true//allow keyboard shortcuts (esc: close, spacebar & right arrow: next, left arrow: previous)
356	};
357		this.openClosePos = {};
358		this.contentToLoad = {};
359		this.contentObj = {};
360		this.containerDefaults = {};
361		this.multiBox = [];
362		this.families = [];
363		this.content = [];
364		this.timer = 0;
365		this.index = 0;
366		this.opened = false;
367		this.currentGallery = null;
368			//initialization
369				//set options
370		this.options=$.extend(this.options,options);
371		//set variables
372
373		//start multiBox
374		if($(this.options.mbClass).length > 0){this.start();};
375		
376	}
377
378
379	
380	//start multiBox
381	multiBox.prototype.start= function(){
382		//there will be no next/previous buttons unless you specify them to a group
383		$(this.options.mbClass).each($.proxy(function(index,el){
384			//we must store original rel & title values to use later
385			if($chk($(el).attr('rel'))){
386				$(el).data('origRel',$(el).attr('rel'));
387			};
388			if($chk($(el).attr('title'))){
389				$(el).data('origTitle',$(el).attr('title'));
390			};
391			//check if it has a rel="[group]"
392			if($(el).attr('rel').toString().test(/\[*?]/i)){
393				//if there are more than 1 rel value, we need to split them to find our group
394				if($(el).attr('rel').indexOf(',')>-1){
395					//split then loop through each array instance of the split rel's
396					var tempArr = $(el).attr('rel').split(',');
397					tempArr.forEach($.proxy(function(temp,i){
398						if(temp.contains('[')){//only take out the rel relating to a [group]
399							//change this links relation to the temp variable
400							$(el).attr('rel',temp);
401						};
402					},this));
403				};
404				//if rel isnt already in fanilies then create a new instance for it
405				this.families.includex($(el).attr('rel'));
406			};
407			//finally now we have put them into families, push each link with 'mbClass' into multiBox array
408			this.multiBox.push(el);
409		},this));
410		//loop through each mb link seperating content into groups of families
411		this.multiBox.forEach((function(el){
412			//check rel contains a group
413			if($(el).attr('rel').toString().test(/\[*?]/i)){
414				//we know the link has a group so loop through each family to find where it belongs
415				this.families.forEach((function(fam,i){
416					//if the rel belongs to a family we make sure its pushed into correct family array within content array
417					if($(el).attr('rel') == fam){
418						//if there isnt a family array within content array to hold this family create one
419						if(!this.content[i]){
420							//create new gallery
421							this.content[i] = [];
422						};
423						//finally push link into appropriate family within content array
424						this.content[i].push(el);
425					};
426				}).bind(this));
427			}
428		}).bind(this));
429		//loop through each mb link seperating content into groups of families
430		this.multiBox.forEach((function(el){
431			//check rel DOESNT contain a group
432			if($(el).attr('rel').toString().test(/\[*?]/i) == false){
433				//add link into content array as a single array as it doesnt belong to a family
434				this.content.push([el]);
435			};
436		}).bind(this));
437		
438		this.container = $('<div class="MultiBoxContainer"></div>').appendTo(this.options.container);
439		
440		this.iframe = $('<iframe id="multiBoxIframe" name="mulitBoxIframe" src="javascript:void(0);" frameborder=0 scrolling="no"></iframe>').css(
441		{		'position': 'absolute',
442				'top': 0,
443				'left': 0,
444				'width': '100%',
445				'height': '100%',
446				'filter': 'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)',
447				'opacity': 0
448		}).appendTo(this.container);
449		this.box = $('<div></div>').addClass('MultiBoxContent').appendTo(this.container);
450		this.closeButton = $('<div></div>').addClass('MultiBoxClose').appendTo(this.container).bind('click', this.close.bind(this));
451		this.controlsContainer = $('<div></div>').addClass('MultiBoxControlsContainer').appendTo(this.container);
452		this.controls = $('<div></div>').addClass('MultiBoxControls').appendTo(this.controlsContainer);
453		this.previousButton = $('<div></div>').addClass('MultiBoxPrevious').appendTo(this.controls).bind('click', this.previous.bind(this));
454		this.nextButton = $('<div></div>').addClass('MultiBoxNext').appendTo(this.controls).bind('click', this.next.bind(this));
455		this.title = $('<div></div>').addClass('MultiBoxTitle').appendTo(this.controls);
456		this.number = $('<div></div>').addClass('MultiBoxNumber').appendTo(this.controls);
457		this.description = $('<div></div>').addClass('MultiBoxDescription').appendTo(this.controls);
458		
459		//check user options and call functions accordingly
460		if(this.options.useKeyboard){
461			$(window.document).bind('keydown',(function(e){
462				if(e.key == 'right' || e.key == 'space'){
463					this.next();
464				}else if(e.key == 'left'){
465					this.previous();
466				}else if(e.key == 'esc'){
467					this.close();
468				};
469			}).bind(this));
470		};
471		if(this.options.useOverlay){
472			this.overlay = new Overlay({
473				container:this.options.container,
474				onClick:this.close.bind(this)
475			});
476			//console.log(this.overlay);
477			//this.overlay.style.width='%100';
478			//this.overlay.style.height='%100';
479		};
480		if(this.options.addOverlayIcon == true){
481			this.addOverlayIcon(this.multiBox);
482		};
483		if(this.options.addRollover == true){
484			this.addRollover(this.multiBox);
485		};
486		if(this.options.addChain == true){
487			this.addChain(this.multiBox);
488		};
489		if(this.options.descClassName){
490			this.descriptions = $('.'+this.options.descClassName);
491		};
492		if(this.options.addDownload == true){
493			this.addDownload(this.multiBox);
494		};
495		if(this.options.addTips == true){
496			this.addTips(this.multiBox);
497		};
498
499		//if there is only one multiBox link don't show unneccesary buttons
500		if(this.multiBox.length == 1){
501			this.title.css('marginLeft',0);
502			this.description.css('marginLeft',0);
503			this.previousButton.css('display','none');
504			this.nextButton.css('display','none');
505			this.number.css('display','none');
506		};
507		
508		$('<div></div>').css('clear','both').appendTo(this.controls);
509		
510		//start breaking into content array to add event listeners to each link within each group
511		this.content.forEach((function(el,i){
512			//now we are left with each group as arrays
513			$(el).each((function(i,group){
514				//add event listener
515				$(group).bind('click', (function(e){
516					var myTarget = ($(e.target).attr('href')) ? $(e.target) : $(e.target).parent('a');
517				//	console.log(myTarget);
518					e.preventDefault();
519					this.open($(el).index(myTarget),el);
520				}).bind(this));
521				//check to see if link is an HTML element
522				if(group.href.indexOf('#') > -1){
523					//grab it as an object
524					group.content = $(group.href.substr(group.href.indexOf('#')+1));
525					//hide the object
526					if(group.content){
527						group.content.css('display','none');
528					};
529				};
530			}).bind(this));
531		}).bind(this));
532		
533		//this.containerEffects = new Fx.Morph(this.container,{duration:400});
534		//this.controlEffects = new Fx.Morph(this.controlsContainer,{duration:300});
535		this.reset();
536		
537		//auto open a multiBox element
538		if(this.options.autoOpen > 0){
539			this.autoOpen(this.multiBox);
540		};
541	};
542	
543	multiBox.prototype.setContentType= function(element){
544		var str = element.href.substr(element.href.lastIndexOf('.')+1).toLowerCase();
545		var myRel = $(element).data('origRel');
546		var contentOptions = {};
547		//retrieve original rel values and make sure there was one
548		if($chk(myRel)){
549			//split the options just incase there are more than 1
550			var optArr = myRel.split(',');
551			
552			optArr.forEach(function(el,i){
553				//make sure the group is ignored
554				if(el.test(/\[*?]/i) != true){
555					var ta = el.split(':');
556					contentOptions[ta[0]] = ta[1];
557				};
558			});
559		};
560		
561		if(contentOptions.type != undefined){
562			str = contentOptions.type;
563		};
564		
565		this.contentObj.url = element.href;
566		this.contentObj.xH = 0;
567		
568		if(contentOptions.width){
569			this.contentObj.width = contentOptions.width;
570		}else{
571			this.contentObj.width = this.options.movieSize.w;
572		};
573		if(contentOptions.height){
574			this.contentObj.height = contentOptions.height;
575		}else{
576			this.contentObj.height = this.options.movieSize.h;
577		};
578		if(contentOptions.panel){
579			this.panelPosition = contentOptions.panel;
580		}else{
581			this.panelPosition = this.options.panel;
582		};
583		switch(str){
584			case 'jpg':
585			case 'gif':
586			case 'png':
587				this.type = 'image';
588				break;
589			case 'swf':
590				this.type = 'flash';
591				break;
592			case 'flv':
593				this.type = 'flashVideo';
594				this.contentObj.xH = 70;
595				break;
596			case 'mov':
597				this.type = 'quicktime';
598				break;
599			case 'wmv':
600				this.type = 'windowsMedia';
601				break;
602			case 'rv':
603			case 'rm':
604			case 'rmvb':
605				this.type = 'real';
606				break;
607			case 'mp3':
608				this.type = 'flashMp3';
609				this.contentObj.width = 320;
610				this.contentObj.height = 70;
611				break;
612			case 'element':
613				this.type = 'htmlelement';
614				this.elementContent = $(element.content);
615				this.elementContent.css({
616					'display': 'block',
617					'opacity': 0,
618					'width': 'auto'//added this to get htmlElement to behave
619				});
620				
621				//check and see if styles are being applied to HTML content section
622				if(this.elementContent.css('width') != 'auto'){
623					this.contentObj.width = this.elementContent.getWidth();
624				};
625				
626				this.contentObj.height = this.elementContent.getHeight();
627				this.elementContent.css({
628					'display': 'none',
629					'opacity': 1
630				});
631				break;
632			default:
633				this.type = 'iframe';
634				if(contentOptions.req){
635					this.type = 'req';
636				};
637				break;
638		}
639	};
640	
641	multiBox.prototype.reset= function(){
642		this.container.css({
643			'opacity': 0,
644			'display': 'none'
645		});
646		this.controlsContainer.css('height',0);
647		this.removeContent();
648		this.previousButton.removeClass('MultiBoxButtonDisabled');
649		this.nextButton.removeClass('MultiBoxButtonDisabled');
650		this.opened = false;
651	},
652	
653	multiBox.prototype.getOpenClosePos= function(element){
654		var border=this.container.css('border')?this.container.css('border'):0;
655		element=$(element);
656		if(this.options.openFromLink){
657			if(element.getFirst().length>0){
658				var w = element.getFirst().width() - (parseInt(border) * 2);
659				if(w < 0){
660					w = 0;
661				};
662				var h = element.getFirst().height() - (parseInt(border) * 2);
663				if(h < 0){
664					h = 0;
665				};
666				if(element.find('img').length>0) var l=element.children(0).offset().left;
667				else var l=element.offset().left;
668				this.openClosePos = {
669					width: w,
670					height: h,
671					top: element.offset().top,
672					left: l
673				};
674			}else{
675				
676				var w = element.width() - (parseInt(border) * 2);
677				if(w < 0){
678					w = 0;
679				};
680				var h = element.height() - (parseInt(border) * 2);
681				if(h < 0){
682					h = 0;
683				};
684				if(element.find('img').length>0) var l=element.children(0).offset().left;
685				else var l=element.offset().left;
686				this.openClosePos = {
687					width: w,
688					height: h,
689					top: element.offset().top,
690					left: l
691				};
692			};
693		}else{
694			if(this.options.fixedTop){
695				var top = this.options.fixedTop;
696			}else{
697				var top = $(window).scrollTop()+ (($(window).height()/2)-(this.options.initialSize.h/2)-parseInt(border))+this.options.offset.y;
698			};
699
700			this.openClosePos = {
701				width: this.options.initialSize.w,
702				height: this.options.initialSize.h,
703				top: top,
704				left: (($(window).width()/2)-(this.options.initialSize.w/2)-parseInt(border))+this.options.offset.x
705			};
706		};
707		return this.openClosePos;
708	},
709	
710	multiBox.prototype.open= function(index,currGal){
711		this.overlay.container.css({'zIndex':100,'visible':'visible'});
712		//need to store current gallery and index of the object in gallery
713		this.currentGallery = currGal;
714		this.index = index;
715		//grab id so description can be matched
716		this.openId = $(this.currentGallery[this.index]).attr('id');
717		//check to see if mb is already open
718		if(!this.opened){
719			this.opened = true;
720			//console.log(this.overlay);
721			if(this.options.useOverlay){
722				this.overlay.show();
723			};
724			
725			this.container.css(this.getOpenClosePos(this.currentGallery[this.index]));
726			this.container.css({
727				'opacity': 0,
728				'display': 'block'
729				});
730			
731			if(this.options.fixedTop){
732				var top = parseInt(this.options.fixedTop);
733			}else{
734				var top = parseInt($(window).scrollTop())+parseInt(($(window).height()/2)-parseInt(this.options.initialSize.h/2)-
734parseInt(this.container.css('border')?this.container.css('border'):0))+parseInt(this.options.offset.y);
735			};
736			var left=(($(window).width()/2)-(this.options.initialSize.w/2)-parseInt(this.container.css('border')?this.container.css('border'):0))+this.options.offset.x;
737			
738			//console.log($(window).width()/2,this.options.initialSize.w/2,parseInt(this.container.css('border')),this.options.offset.x);
739			this.container.animate({
740				'width': this.options.initialSize.w,
741				'height': this.options.initialSize.h,
742				'top': top,
743				'left': left,
744				'opacity': 1
745			},{duration:400,easing:'easeOutExpo',complete:(function(){}).bind(this)});
746			
747			this.load(this.currentGallery[this.index]);
748		}else{
749			if(this.options.showControls){
750				this.hideControls();
751			};
752			this.getOpenClosePos(this.currentGallery[this.index]);
753			this.timer = setTimeout(this.hideContent.bind(this),500);
754			this.timer = setTimeout(function(){this.load.passx(this.currentGallery[this.index],this);},1100);
755		}
756		if(window.myGallery){
757			window.myGallery.clearTimer();
758			jQuery('#myGallery').unbind('mouseout');
759		}
760	},
761	
762	multiBox.prototype.getContent= function(element){
763		this.setContentType(element);
764		var desc = {};
765		if(this.options.descClassName){
766			this.descriptions.each((function(i,el){
767				if($(el).hasClass(this.openId)){
768					desc = $(el).clone();
769				};
770			}).bind(this));
771		};
772		this.contentToLoad = {
773			title: $(element).data('origTitle') || '&nbsp;',
774			desc: desc,
775			number: this.index+1
776		};
777	},
778	
779	multiBox.prototype.close= function(){
780		if(this.options.useOverlay){
781			this.overlay.hide();
782		};
783		if(this.options.showControls){
784			this.hideControls();
785		};
786		this.hideContent();
787		this.container.stop();
788		setTimeout(this.zoomOut.bind(this),500);
789		if(window.myGallery){
790			window.myGallery.prepareTimer();
791			jQuery('#myGallery').bind('mouseout',function(){window.myGallery.prepareTimer();});
792		}
793	},
794	
795	multiBox.prototype.zoomOut= function(){
796		this.container.animate({
797			'width': this.openClosePos.width,
798			'height': this.openClosePos.height,
799			'top': this.openClosePos.top,
800			'left': this.openClosePos.left,
801			'opacity': 0
802		});
803		setTimeout(this.reset.bind(this),500);
804	},
805	
806	multiBox.prototype.load= function(element){
807		//console.log(this.box[0]);
808		this.box.addClass('MultiBoxLoading');
809		this.getContent(element);
810		//this.type='image';
811		//console.log(this.type);
812		if(this.type == 'image'){
813			var xH = this.contentObj.xH;
814			
815			if($.browser.msie) this.contentObj = $('<img/>').attr('src',element.href).load(setTimeout(this.resize.bind(this),100));
816			else this.contentObj = $('<img/>').attr('src',element.href).load(/*setTimeout(*/this.resize.bind(this)/*,100)*/);
817			//new Asset.image(element.href,{onload:this.resize.bind(this)});
818			this.contentObj.xH = xH;
819		}else{
820			this.resize();
821			
822		};
823		if (document.getElementById("OverlayContainer")) {
824			document.getElementById("OverlayContainer").style.height = document.body.offsetHeight + "px";
825			document.getElementById("OverlayContainer").style.width = document.body.offsetWidth + "px";
826			}
827	},
828	
829	multiBox.prototype.resize= function(){
830	var s5_mult_tooltips = document.getElementById("s5_body").getElementsByTagName("DIV");
831	for (var s5_mult_tooltips_y=0; s5_mult_tooltips_y<s5_mult_tooltips.length; s5_mult_tooltips_y++) {
832		if (s5_mult_tooltips[s5_mult_tooltips_y].className == "mbTips") {
833			s5_mult_tooltips[s5_mult_tooltips_y].style.left = "0px";
834		}
835	}
836
837	if (document.getElementById("OverlayContainer")) {
838		//only resize if values have been set to resize to
839		var ii = new Image();
840		if(this.type=='image' || this.type=='flash' || this.type=='flashVideo' || this.type=='flashMp3' || this.type=='iframe'){
841			var maxW = parseInt(this.options.maxSize.w);//declare max width at top of script
842			var maxH = parseInt(this.options.maxSize.h);//declare max height at top of script
843			var w = dW = 0;//set initial final width to 0
844			var h = dH = 0;//set initial final height to 0
845			if(this.type=='image'){
846				 ii = document.createElement('img');
847				//var h = dH =  Number(ii.height);//this.contentObj.height;//retrieve image height
848				//var w = dW = Number(ii.width);//this.contentObj.width;//retrieve image width
849
850			}
850else if(this.type=='flash' || this.type=='flashVideo' || this.type=='iframe' || this.type=='real' || this.type=='windowsMedia' ){
851				var m2=$(this.currentGallery[this.index]).attr('rel').match(/width:(\d+),height:(\d+)/);
852				if(m2!=null){
853					var w = dW =  Number(m2[1]);
854					var h = dH =  Number(m2[2]);
855				}else{
856					var w = dW =  this.options.movieSize.w;
857					var h = dH = this.options.movieSize.h;
858				}
859				//console.log(w);
860				//console.log(h);
861			}else if(this.type=='flashMp3'){
862				var w = dW =  320;
863				var h = dH = 70;
864			}
865			if(this.type == 'image'){
866				var that = this;
867				ii.onload=function(){
868					//console.log(this.height,this.width);
869						h = dH = this.height;
870						w = dW = this.width;
871						if((Number(w) +40) > $(window).width()){
872							dW = that.contentObj.width=$(window).width()-60-30;
873							dH=parseInt((h * dW) / w);
874							if(dH>h) dH=h;
875						}
876						that.contentObj.height = dH;//resize image height
877						that.contentObj.width = dW;//resize image width
878						that.resize2();
879						//console.log(that.contentObj.width, that.contentObj.height);
880				}
881				ii.src = that.contentObj.attr('src');
882				ii = null;
883			}else{
884				this.contentObj.height = dH;
885				this.contentObj.width = dW;
886				this.resize2();
887			}
888		}
889	  }
890	}
891	multiBox.prototype.resize2 = function(){
892		//console.log(this.contentObj.height,this.contentObj.width);
893		if(this.options.fixedTop){
894				var top = this.options.fixedTop;
895		}else{
896			var top = (($(window).height() / 2) - ((Number(this.contentObj.height) + this.contentObj.xH) / 2) - parseInt(this.container.css('borderBottomWidth')) + $(window).scrollTop()) + this.options.offset.y;
897			
898		};
899		var left = (($(window).width() / 2) - (this.contentObj.width / 2) - parseInt(this.container.css('borderBottomWidth'))) + this.options.offset.x;
900
901		if(top < 0){
902			top = 0;
903		};
904		if(left < 0){
905			left = 0;
906		};
907		//console.log(top,left);
908		this.container.stop();
909		this.container.animate({
910			'width': Number(this.contentObj.width),
911			'height':Number(this.contentObj.height),
912			'top': top,'left': left,
913			'opacity': 1
914		},400,'linear',(function(){this.container.css('overflow','visible');}).bind(this));
915		this.timer = setTimeout(this.showContent.bind(this),0);
916	}
917	multiBox.prototype.showContent= function(){//alert('show');
918		this.box.removeClass('MultiBoxLoading');
919		this.removeContent();
920		this.contentContainer = $('<div id="MultiBoxContentContainer"></div>').css({
921				'opacity': 0,
922				'width': this.contentObj.width,
923				'height': (Number(this.contentObj.height)+this.contentObj.xH)
924			}).appendTo(this.box);
925
926		if(this.type == 'image'){
927			//console.log(this.contentObj,this.contentContainer);
928			this.contentObj.clone().appendTo(this.contentContainer);
929		}else if(this.type == 'iframe'){
930			$('<iframe frameborder=0 scrolling="auto" id="iFrame'+new Date().getTime()+'"></iframe>').width(this.contentObj.width).height(this.contentObj.height).attr('src',this.contentObj.url).appendTo(this.contentContainer);
931		}else if(this.type == 'htmlelement'){
932			this.elementContent.clone().css('display','block').appendTo(this.contentContainer);
933		}/*else if(this.type == 'req'){
934			var req = new Request.HTML({
935				url: this.contentObj.url,
936				method: 'get',
937				evalScripts: true,
938				onSuccess= function(responseTree,responseElements,responseHTML,responseJavaScript){
939					$('MultiBoxContentContainer').adopt(responseElements);
940				},
941				onFailure= function() {
942					$('MultiBoxContentContainer').attr('text','The request failed.');
943				}
944			}).send();
945		}*/else{
946			
947			this.obj = $('<div id="MultiBoxMediaObject"></div>').appendTo(this.contentContainer);
948			this.createEmbedObject();
949			//if its a movie appendTo the object string into obj
950			if(this.str){
951			//	this.obj.attr('html',this.str);
952			this.obj.html(this.str);
953				this.str = null;//clear the value after using it
954			};
955		};
956		
957
958		this.contentContainer.animate({opacity:1},500,'easeOutExpo');
959		
960		this.title.html(this.contentToLoad.title);
961		if (this.currentGallery) {
962		this.number.html(this.contentToLoad.number+' of '+this.currentGallery.length);
963		if(this.options.descClassName){
964			//check to see if there is a desc override
965			
966			if($(this.currentGallery[this.index]).data('origRel')){
967				//declare variables
968				var ignoreDesc = false;
969				var myRel = $(this.currentGallery[this.index]).data('origRel');
970				var optArr = myRel.split(',');
971				//loop through each split looking for 'noDesc'
972				optArr.forEach(function(el){
973					if(el.test('noDesc') == true){
974						ignoreDesc = true;
975					};
976				});
977			};
978			//check and see if user wants to override default description setting for this element
979			if(ignoreDesc != true){
980				if(this.description.getFirst()){
981					//this.description.getFirst().destroy();
982					this.description.getFirst().remove();
983				};
984				if (this.contentToLoad.desc.appendTo) {
985				this.contentToLoad.desc.appendTo(this.description).css('display','block');
986				}
987			};
988		}
989		}
990		;
991
992		if(this.options.showControls){
993			this.timer = setTimeout($.proxy(this.showControls,this),600);
994		};
995		
996		if(this.options.addDownload){
997			var filePath = this.currentGallery[this.index].href;
998			var fileName = this.currentGallery[this.index].href.substring(this.currentGallery[this.index].href.lastIndexOf('/')+1);
999			this.download.html('<a href="'+this.options.pathToDownloadScript+'?FilePath='+filePath+'" title="Download File '+fileName+'">Download File</a>');
1000			//empty download if its not an image
1001			if(this.type != 'image'){
1002				this.download.empty();
1003			};
1004		};
1005	},
1006	
1007	multiBox.prototype.hideContent= function(){
1008		this.box.addClass('MultiBoxLoading');
1009		this.contentContainer.animate({
1010			opacity: 0
1011		},500,'easeOutExpo');
1012		setTimeout($.proxy(this.removeContent,this),500);
1013	},
1014	
1015	multiBox.prototype.removeContent= function(){ 
1016		if($('#MultiBoxMediaObject')){
1017			$('#MultiBoxMediaObject').empty();//so sound doesnt keep playing in IE
1018			$('#MultiBoxMediaObject').remove();//dispose() instead of destroy() as IE 6&7 crashes
1019		};
1020		if($('#MultiBoxContentContainer')){
1021			$('#MultiBoxContentContainer').remove();//dispose() instead of destroy() as IE 6&7 crashes
1022		};
1023		//if(this.type=='image') this.contentObj.removeAttr('src');
1024		if(this.description){
1025			this.description.empty();//empty description incase next element doesnt want to have one
1026		};
1027	},
1028	
1029	multiBox.prototype.showControls= function(){
1030		if(this.container.css('height') != 'auto'){
1031			this.containerDefaults.height = this.container.css('height');
1032			this.containerDefaults.backgroundColor = this.options.contentColor;
1033			//controls box isnt taken into consideration when positioning the container from the top so correct this
1034			if(this.options.recalcTop == true){
1035				if(parseInt(this.container.css('top')) > parseInt(this.controls.css('height'))/2){
1036					this.container.animate({'top':parseInt(this.container.css('top'))-parseInt(this.controls.css('height'))/2},400,'easeOutExpo'/*,(function(){this.container.css('overflow','visible');}).bind(this)*/);
1037				};
1038			};
1039		};
1040		
1041		this.container.css('height','auto');
1042
1043		if(this.contentToLoad.number == 1){
1044			this.previousButton.addClass('MultiBoxPreviousDisabled');
1045		}else{
1046			this.previousButton.removeClass('MultiBoxPreviousDisabled');
1047		};
1048		if (this.currentGallery) {
1049		if(this.contentToLoad.number == this.currentGallery.length){
1050			this.nextButton.addClass('MultiBoxNextDisabled');
1051		}else{
1052			this.nextButton.removeClass('MultiBoxNextDisabled');
1053		}
1054		}
1055		;
1056		
1057		this.controlsContainer.animate({
1058			'height': this.controls.css('height')
1059		},300,'easeOutExpo');
1060		//this.resize.bind(this).delay(500);
1061	};
1062	
1063	multiBox.prototype.hideControls= function(num){
1064		this.controlsContainer.animate({'height': 0},300,(function(){
1065			this.container.css(this.containerDefaults);
1066		}).bind(this));
1067	};
1068	
1069	multiBox.prototype.next= function(){
1070		if(this.index < this.currentGallery.length-1){
1071			this.index++;
1072			this.openId = $(this.currentGallery[this.index]).attr('id');
1073			if(this.options.showControls){
1074				this.hideControls();
1075			};
1076			this.getOpenClosePos(this.currentGallery[this.index]);
1077			this.timer = setTimeout(this.hideContent.bind(this),500);
1078			this.timer = setTimeout(this.load.passx(this.currentGallery[this.index],this),1100);
1079		};
1080	},
1081	
1082	multiBox.prototype.previous= function(){
1083		if(this.index > 0){
1084			this.index--;
1085			this.openId = $(this.currentGallery[this.index]).attr('id');
1086			if(this.options.showControls){
1087				this.hideControls();
1088			};
1089			this.getOpenClosePos(this.currentGallery[this.index]);
1090			this.timer = setTimeout(this.hideContent.bind(this),500);
1091			this.timer = setTimeout(this.load.passx(this.currentGallery[this.index],this),1000);
1092		};
1093	},
1094	
1095	multiBox.prototype.createEmbedObject= function(){
1096		if(this.type == 'flash'){
1097			var url = this.contentObj.url;
1098			var swfHolder = $('<div></div>').attr({id: 'swfHolder'}).appendTo(this.obj);
1099			var flashObj = new Swiff(url, {
1100				id: url,
1101				container: swfHolder,
1102				width: this.contentObj.width,
1103				height: this.contentObj.height
1104			});
1105		}else if(this.type == 'flashVideo'){
1106			var url = this.contentObj.url;
1107			var swfHolder = $('<div></div>').attr({id: 'swfHolder'}).appendTo(this.obj);
1108			var flashObj = new Swiff(this.options.path+'flvplayer.swf', {
1109				id: url,
1110				container: swfHolder,
1111				width: this.contentObj.width,
1112				height: (Number(this.contentObj.height)+this.contentObj.xH),
1113				vars: {
1114					path: url
1115				}
1116			});
1117		}else if(this.type == 'flashMp3'){
1118			var url = this.contentObj.url;
1119			var swfHolder = $('<div id="swfHolder"></div>').appendTo(this.obj);
1120			var flashObj = new Swiff(this.options.path+'mp3player.swf', {
1121				id: url,
1122				container: swfHolder,
1123				width: this.contentObj.width,
1124				height: (Number(this.contentObj.height)+this.contentObj.xH),
1125				vars: {
1126					path: url
1127				}
1128			});
1129		}else if(this.type == 'quicktime'){
1130			var url = this.contentObj.url;
1131			this.str = '<object  type="video/quicktime" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab"';
1132			this.str += ' width="'+this.contentObj.width+'" height="'+this.contentObj.height+'">';
1133			this.str += '<param name="src" value="'+url+'" />';
1134			this.str += '<param name="autoplay" value="true" />';
1135			this.str += '<param name="controller" value="true" />';
1136			this.str += '<param name="enablejavascript" value="true" />';
1137			this.str += '<embed src="'+url+'" autoplay="true" pluginspage="http://www.apple.com/quicktime/download/" width="'+this.contentObj.width+'" height="'+this.contentObj.height+'"></embed>';
1138			this.str += '</object>';
1139		}else if(this.type == 'windowsMedia'){
1140			var url = this.contentObj.url;
1141			this.str = '<object  type="application/x-oleobject" classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/control
1141s/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112"';
1142			this.str += ' width="'+this.contentObj.width+'" height="'+this.contentObj.height+'">';
1143			this.str += '<param name="filename" value="'+url+'" />';
1144			this.str += '<param name="Showcontrols" value="true" />';
1145			this.str += '<param name="autoStart" value="true" />';
1146			this.str += '<embed type="application/x-mplayer2" src="'+url+'" Showcontrols="true" autoStart="true" width="'+this.contentObj.width+'" height="'+this.contentObj.height+'"></embed>';
1147			this.str += '</object>';
1148		}else if(this.type == 'real'){
1149			var url = this.contentObj.url;
1150			this.str = '<object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA"';
1151			this.str += ' width="'+this.contentObj.width+'" height="'+this.contentObj.height+'">';
1152			this.str += '<param name="src" value="'+url+'" />';
1153			this.str += '<param name="controls" value="ImageWindow" />';
1154			this.str += '<param name="autostart" value="true" />';
1155			this.str += '<embed src="'+url+'" controls="ImageWindow" autostart="true" width="'+this.contentObj.width+'" height="'+this.contentObj.height+'"></embed>';
1156			this.str += '</object>';
1157		};
1158	};
1159
1160	multiBox.prototype.addOverlayIcon=function(element){
1161		//loop through each instance
1162		$(element).each(function(i,el){
1163			//if link contains an image ad overlay
1164			if($(el).getElement('img')){
1165				//add position:relative to them so that icon is contained
1166				$(el).css('position','relative');
1167				//appendTo a new div that is the overlay icon
1168				var overlayIcon = $('<div></div>').appendTo(el);
1169				overlayIcon.addClass('OverlayIcon');
1170				//IE6 causes too many issues due to lack of PNG support
1171				if(!Browser.Engine.trident4 && 0){
1172					overlayIcon.css('opacity',0);
1173					overlayIcon.attr('tween',{duration:3000,transition:Fx.Transitions.Expo.easeIn}).tween('opacity',1);
1174				};
1175			};
1176		});
1177	},
1178	
1179	multiBox.prototype.addRollover=function(element){
1180		$(element).each(function(i,el){
1181			//if link contains an image ad overlay
1182			
1183			var tmp=$('img',el).eq(0);
1184			if(tmp.length>0){
1185				//add event listeners
1186				$(el).bind(
1187					'mouseenter', function(){
1188						tmp.data('tween',{'duration':200,'easing':'linear'}).animate({'opacity':0.5,'duration':0,'easing':'linear','queue':false});
1189						//tmp.animate({'width':0},0,'linear');
1190					});
1191				$(el).bind(
1192					'mouseleave', function(){
1193						tmp.data('tween',{'duration':400,'easing':'linear'}).animate({'opacity':1,'duration':0,'easing':'linear','queue':false});
1194						//tmp.animate({'width':0},0,'linear');
1195					});
1196			};
1197		});
1198		//console.log(2);
1199	},
1200	
1201	multiBox.prototype.addChain=function(element){
1202		//create new array to hold all links with images to chain through
1203		var chainArray = [];
1204		//push link into chainArray if it contains an image
1205		$(element).each(function(i,el){
1206			//detect whether link contains image
1207			if($(el).getElement('img')){
1208				chainArray.push(el);
1209			};
1210		});
1211		//now chain through each item in the new array
1212		chainArray.forEach(function(el,i){
1213			//detect whether link contains image
1214			if($(el).getElement('img')){
1215				//chain through each multibox link that contains an image
1216				var HoverMe = new Chain();
1217				var hoverOn = function(){
1218					$(el).getElement('img').data('tween',{duration:200,'easing':'linear'}).animate({'opacity':0.5},0);
1219				};
1220				var hoverOff = function(){
1221					$(el).getElement('img').data('tween',{duration:400,'easing':'linear'}).animate({'opacity':1},0);
1222				};
1223				HoverMe.chain(hoverOn);
1224				HoverMe.chain(hoverOff);
1225				HoverMe.callChain.delay(2000+(i+1)*1000,HoverMe);
1226				HoverMe.callChain.delay((i+2)*1000,HoverMe);
1227			};
1228		});
1229	},
1230	
1231	multiBox.prototype.addDownload=function(element){
1232		this.download = $('<div></div>').addClass('MultiBoxDownload').appendTo(this.controls).css('marginLeft',0);
1233	},
1234	
1235	multiBox.prototype.addTips=function(element){
1236		$(element).each(function(i,el){
1237			//add MooTools tips
1238			if($(el).attr('title')){
1239				var toolTips = new Tips($(el), {
1240					offsets: {'x':16,'y':5},
1241					className: 'mbTips'
1242				});
1243			};
1244			//remove title so dont get duplication of title and MooTools tips
1245			if($(el).getElement('img')){
1246				if($(el).getElement('img').attr('title')){
1247					$(el).getElement('img').removeAttr('title');
1248				};
1249				if($(el).getElement('img').attr('alt')){
1250					$(el).getElement('img').removeAttr('alt');
1251				};
1252			};
1253		});
1254	},
1255	
1256	multiBox.prototype.autoOpen=function(element){
1257		//make sure element number is valid
1258		if(this.options.autoOpen > $(this.options.mbClass).length){
1259			this.options.autoOpen = $(this.options.mbClass).length;
1260		};
1261		//auto open multiBox on page
1262		this.open(this.options.autoOpen-1,element);
1263	}
1264})(jQuery);

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.