PageSourceSearch

https://www.beaudesertfamilypractice.com.au/wp-content/themes/medi…/js/jquery.iLightBox.min.js?ver=2.2.0

js beaudesertfamilypractice.com.au collected 2026-10-08 02:03:36 UTC 124,350 bytes, 3,223 lines download raw bytes

1/**
2 * @package 	WordPress
3 * @subpackage 	Medical Clinic
4 * @version		1.3.0
5 */
6
7/**
8 * jQuery iLightBox - Revolutionary Lightbox Plugin
9 * http://www.ilightbox.net/
10 *
11 * @version: 2.2.4 - October 14, 2017
12 *
13 * @author: iProDev (Hemn Chawroka)
14 *          http://www.iprodev.com/
15 *
16 */
17(function($, window, undefined) {
18
19	var extensions = {
20			flash: ['swf'],
21			image: ['bmp', 'gif', 'jpeg', 'jpg', 'png', 'tiff', 'tif', 'jfif', 'jpe', 'webp'],
22			iframe: ['asp', 'aspx', 'cgi', 'cfm', 'htm', 'html', 'jsp', 'php', 'pl', 'php3', 'php4', 'php5', 'phtml', 'rb', 'rhtml', 'shtml', 'txt'],
23			video: ['avi', 'mov', 'mpg', 'mpeg', 'movie', 'mp4', 'webm', 'ogv', 'ogg', '3gp', 'm4v']
24		},
25
26		// Global DOM elements
27		$win = $(window),
28		$doc = $(document),
29
30		// Support indicators
31		browser,
32		transform,
33		gpuAcceleration,
34		fullScreenApi = '',
35		userAgent = navigator.userAgent || navigator.vendor || window.opera,
36		supportTouch = !!('ontouchstart' in window) && (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent)),
37		isMobile = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(userAgent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(userAgent.substr(0, 4)),
38
39		// Events
40		clickEvent = supportTouch ? "itap.iLightBox" : "click.iLightBox",
41		touchStartEvent = supportTouch ? "touchstart.iLightBox" : "mousedown.iLightBox",
42		touchStopEvent = supportTouch ? "touchend.iLightBox" : "mouseup.iLightBox",
43		touchMoveEvent = supportTouch ? "touchmove.iLightBox" : "mousemove.iLightBox",
44
45		// Math shorthands
46		abs = Math.abs,
47		sqrt = Math.sqrt,
48		round = Math.round,
49		max = Math.max,
50		min = Math.min,
51		floor = Math.floor,
52		random = Math.random,
53
54		pluginspages = {
55			quicktime: 'http://www.apple.com/quicktime/download',
56			flash: 'http://www.adobe.com/go/getflash'
57		},
58
59		iLightBox = function(el, options, items, instant) {
60			var iL = this;
61
62			iL.options = options,
63				iL.selector = el.selector || el,
64				iL.context = el.context,
65				iL.instant = instant;
66
67			if (items.length < 1) iL.attachItems();
68			else iL.items = items;
69
70			iL.vars = {
71				total: iL.items.length,
72				start: 0,
73				current: null,
74				next: null,
75				prev: null,
76				BODY: $('body'),
77				loadRequests: 0,
78				overlay: $('<div class="ilightbox-overlay"></div>'),
79				loader: $('<div class="ilightbox-loader"><div></div></div>'),
80				toolbar: $('<div class="ilightbox-toolbar"></div>'),
81				innerToolbar: $('<div class="ilightbox-inner-toolbar"></div>'),
82				title: $('<div class="ilightbox-title"></div>'),
83				closeButton: $('<a class="ilightbox-close" title="' + iL.options.text.close + '"></a>'),
84				fullScreenButton: $('<a class="ilightbox-fullscreen" title="' + iL.options.text.enterFullscreen + '"></a>'),
85				innerPlayButton: $('<a class="ilightbox-play" title="' + iL.options.text.slideShow + '"></a>'),
86				innerNextButton: $('<a class="ilightbox-next-button" title="' + iL.options.text.next + '"></a>'),
87				innerPrevButton: $('<a class="ilightbox-prev-button" title="' + iL.options.text.previous + '"></a>'),
88				holder: $('<div class="ilightbox-holder' + (supportTouch ? ' supportTouch' : '') + '" ondragstart="return false;"><div class="ilightbox-container"></div></div>'),
89				nextPhoto: $('<div class="ilightbox-holder' + (supportTouch ? ' supportTouch' : '') + ' ilightbox-next" ondragstart="return false;"><div class="ilightbox-container"></div></div>'),
90				prevPhoto: $('<div class="ilightbox-holder' + (supportTouch ? ' supportTouch' : '') + ' ilightbox-prev" ondragstart="return false;"><div class="ilightbox-container"></div></div>'),
91				nextButton: $('<a class="ilightbox-button ilightbox-next-button" ondragstart="return false;" title="' + iL.options.text.next + '"><span></span></a>'),
92				prevButton: $('<a class="ilightbox-button ilightbox-prev-button" ondragstart="return false;" title="' + iL.options.text.previous + '"><span></span></a>'),
93				thumbnails: $('<div class="ilightbox-thumbnails" ondragstart="return false;"><div class="ilightbox-thumbnails-container"><a class="ilightbox-thumbnails-dragger"></a><div class="ilightbox-thumbnails-grid"></div></div></div>'),
94				thumbs: false,
95				nextLock: false,
96				prevLock: false,
97				hashLock: false,
98				isMobile: false,
99				mobileMaxWidth: 980,
100				isInFullScreen: false,
101				isSwipe: false,
102				mouseID: 0,
103				cycleID: 0,
104				isPaused: 0
105			};
106
107			// Hideable elements with mousemove event
108			iL.vars.hideableElements = iL.vars.nextButton.add(iL.vars.prevButton);
109
110			iL.normalizeItems();
111
112			//Check necessary plugins
113			iL.availPlugins();
114
115			//Set startFrom
116			iL.options.startFrom = (iL.options.startFrom > 0 && iL.options.startFrom >= iL.vars.total) ? iL.vars.total - 1 : iL.options.startFrom;
117
118			//If randomStart
119			iL.options.startFrom = (iL.options.randomStart) ? floor(random() * iL.vars.total) : iL.options.startFrom;
120			iL.vars.start = iL.options.startFrom;
121
122			if (instant) iL.instantCall();
123			else iL.patchItemsEvents();
124
125			if (iL.options.linkId) {
126				iL.hashChangeHandler();
127				$win.iLightBoxHashChange(function() {
128					iL.hashChangeHandler();
129				});
130			}
131
132			if (supportTouch) {
133				var RegExp = /(click|mouseenter|mouseleave|mouseover|mouseout)/ig,
134					replace = "itap";
135				iL.options.caption.show = iL.options.caption.show.replace(RegExp, replace),
136					iL.options.caption.hide = iL.options.caption.hide.replace(RegExp, replace),
137					iL.options.social.show = iL.options.social.show.replace(RegExp, replace),
138					iL.options.social.hide = iL.options.social.hide.replace(RegExp, replace);
139			}
140
141			if (iL.options.controls.arrows) {
142				$.extend(iL.options.styles, {
143					nextOffsetX: 0,
144					prevOffsetX: 0,
145					nextOpacity: 0,
146					prevOpacity: 0
147				});
148			}
149		};
150
151	//iLightBox helpers
152	iLightBox.prototype = {
153		showLoader: function() {
154			var iL = this;
155			iL.vars.loadRequests += 1;
156			if (iL.options.path.toLowerCase() == "horizontal") iL.vars.loader.addClass('ilightbox-show').stop().animate({
157				top: '-30px'
158			}, iL.options.show.speed, 'easeOutCirc');
159			else iL.vars.loader.addClass('ilightbox-show').stop().animate({
160				left: '-30px'
161			}, iL.options.show.speed, 'easeOutCirc');
162		},
163
164		hideLoader: function() {
165			var iL = this;
166			iL.vars.loadRequests -= 1;
167			iL.vars.loadRequests = (iL.vars.loadRequests < 0) ? 0 : iL.vars.loadRequests;
168			if (iL.options.path.toLowerCase() == "horizontal") {
169				if (iL.vars.loadRequests <= 0) iL.vars.loader.removeClass('ilightbox-show').stop().animate({
170					top: '-192px'
171				}, iL.options.show.speed, 'easeInCirc');
172			} else {
173				if (iL.vars.loadRequests <= 0) iL.vars.loader.removeClass('ilightbox-show').stop().animate({
174					left: '-192px'
175				}, iL.options.show.speed, 'easeInCirc');
176			}
177		},
178
179		createUI: function() {
180			var iL = this;
181
182			iL.ui = {
183				currentElement: iL.vars.holder,
184				nextElement: iL.vars.nextPhoto,
185				prevElement: iL.vars.prevPhoto,
186				currentItem: iL.vars.current,
187				nextItem: iL.vars.next,
188				prevItem: iL.vars.prev,
189				hide: function() {
190					iL.closeAction();
191				},
192				refresh: function() {
193					(arguments.length > 0) ? iL.repositionPhoto(true): iL.repositionPhoto();
194				},
195				fullscreen: function() {
196					iL.fullScreenAction();
197				}
198			};
199		},
200
201		attachItems: function() {
202			var iL = this,
203				itemsObject = new Array(),
204				items = new Array();
205
206			$(iL.selector, iL.context).each(function() {
207				var t = $(this),
208					URL = t.attr(iL.options.attr) || null,
209					options = t.data("options") && eval("({" + t.data("options") + "})") || {},
210					caption = t.data('caption'),
211					title = t.data('title'),
212					type = t.data('type') || getTypeByExtension(URL);
213
214				items.push({
215					URL: URL,
216					caption: caption,
217					title: title,
218					type: type,
219					options: options
220				});
221
222				if (!iL.instant) itemsObject.push(t);
223			});
224
225			iL.items = items,
226				iL.itemsObject = itemsObject;
227		},
228
229		normalizeItems: function() {
230			var iL = this,
231				newItems = new Array();
232
233			$.each(iL.items, function(key, val) {
234
235				if (typeof val == "string") val = {
236					url: val
237				};
238
239				var URL = val.url || val.URL || null,
240					options = val.options || {},
241					caption = val.caption || null,
242					title = val.title || null,
243					type = (val.type) ? val.type.toLowerCase() : getTypeByExtension(URL),
244					ext = (typeof URL != 'object') ? getExtension(URL) : '';
245
246				options.thumbnail = options.thumbnail || ((type == "image") ? URL : null),
247				options.videoType = options.videoType || null,
248				options.skin = options.skin || iL.options.skin,
249				options.width = options.width || null,
250				options.height = options.height || null,
251				options.mousewheel = (typeof options.mousewheel != 'undefined') ? options.mousewheel : true,
252				options.swipe = (typeof options.swipe != 'undefined') ? options.swipe : true,
253				options.social = (typeof options.social != 'undefined') ? options.social : iL.options.social.buttons && $.extend({}, {}, iL.options.social.buttons);
254
255				if (type == "video") {
256					options.html5video = (typeof options.html5video != 'undefined') ? options.html5video : {};
257
258					options.html5video.webm = options.html5video.webm || options.html5video.WEBM || null;
259					options.html5video.controls = (typeof options.html5video.controls != 'undefined') ? options.html5video.controls : "controls";
260					options.html5video.preload = options.html5video.preload || "metadata";
261					options.html5video.autoplay = (typeof options.html5video.autoplay != 'undefined') ? options.html5video.autoplay : false;
262				}
263
264				if (!options.width || !options.height) {
265					if (type == "video") options.width = 1280, options.height = 720;
266					else if (type == "iframe") options.width = '100%', options.height = '90%';
267					else if (type == "flash") options.width = 1280, options.height = 720;
268				}
269
270				delete val.url;
271				val.index = key;
272				val.URL = URL;
273				val.caption = caption;
274				val.title = title;
275				val.type = type;
276				val.options = options;
277				val.ext = ext;
278
279				newItems.push(val);
280			});
281
282			iL.items = newItems;
283		},
284
285		instantCall: function() {
286			var iL = this,
287				key = iL.vars.start;
288
289			iL.vars.current = key;
290			iL.vars.next = (iL.items[key + 1]) ? key + 1 : null;
291			iL.vars.prev = (iL.items[key - 1]) ? key - 1 : null;
292
293			iL.addContents();
294			iL.patchEvents();
295		},
296
297		addContents: function() {
298			var iL = this,
299				vars = iL.vars,
300				opts = iL.options,
301				viewport = getViewport(),
302				path = opts.path.toLowerCase(),
303				recognizingItems = vars.total > 0 && iL.items.filter(function(e, i, arr) {
304					return ['image', 'flash', 'video'].indexOf(e.type) === -1 && typeof e.recognized === 'undefined' && (opts.smartRecognition || e.options.smartRecognition);
305				}),
306				needRecognition = recognizingItems.length > 0;
307
308			if (opts.mobileOptimizer && !opts.innerToolbar)
309				vars.isMobile = viewport.width <= vars.mobileMaxWidth;
310
311			vars.overlay.addClass(opts.skin).hide().css('opacity', opts.overlay.opacity);
312
313			if (opts.linkId)
314				vars.overlay[0].setAttribute('linkid', opts.linkId);
315
316			//Add Toolbar Buttons
317			if (opts.controls.toolbar) {
318				vars.toolbar.addClass(opts.skin).append(vars.closeButton);
319				if (opts.controls.fullscreen)
320					vars.toolbar.append(vars.fullScreenButton);
321				if (opts.controls.slideshow)
322					vars.toolbar.append(vars.innerPlayButton);
323				if (vars.total > 1)
324					vars.toolbar.append(vars.innerPrevButton).append(vars.innerNextButton);
325			}
326
327			//Append elements to body
328			vars.BODY.addClass('ilightbox-noscroll').append(vars.overlay).append(vars.loader).append(vars.holder).append(vars.nextPhoto).append(vars.prevPhoto);
329
330			if (!opts.innerToolbar)
331				vars.BODY.append(vars.toolbar);
332			if (opts.controls.arrows)
333				vars.BODY.append(vars.nextButton).append(vars.prevButton);
334
335			if (opts.controls.thumbnail && vars.total > 1) {
336				vars.BODY.append(vars.thumbnails);
337				vars.thumbnails.addClass(opts.skin).addClass('ilightbox-' + path);
338				$('div.ilightbox-thumbnails-grid', vars.thumbnails).empty();
339				vars.thumbs = true;
340			}
341
342			//Configure loader and arrows
343			var loaderCss = (opts.path.toLowerCase() == "horizontal") ? {
344				left: parseInt((viewport.width / 2) - (vars.loader.outerWidth() / 2))
345			} : {
346				top: parseInt((viewport.height / 2) - (vars.loader.outerHeight() / 2))
347			};
348			vars.loader.addClass(opts.skin).css(loaderCss);
349			vars.nextButton.add(vars.prevButton).addClass(opts.skin);
350			if (path == "horizontal")
351				vars.loader.add(vars.nextButton).add(vars.prevButton).addClass('horizontal');
352
353			// Configure arrow buttons
354			vars.BODY[vars.isMobile ? 'addClass' : 'removeClass']('isMobile');
355
356			if (!opts.infinite) {
357				vars.prevButton.add(vars.prevButton).add(vars.innerPrevButton).add(vars.innerNextButton).removeClass('disabled');
358
359				if (vars.current == 0)
360					vars.prevButton.add(vars.innerPrevButton).addClass('disabled');
361				if (vars.current >= vars.total - 1)
362					vars.nextButton.add(vars.innerNextButton).addClass('disabled');
363			}
364
365			if (opts.show.effect) {
366				vars.overlay.stop().fadeIn(opts.show.speed);
367				vars.toolbar.stop().fadeIn(opts.show.speed);
368			} else {
369				vars.overlay.show();
370				vars.toolbar.show();
371			}
372
373			var length = recognizingItems.length;
374			if (needRecognition) {
375				iL.showLoader();
376
377				$.each(recognizingItems, function(key, val) {
378					var resultFnc = function(result) {
379						console.log(result);
380							var key = -1,
381								filter = iL.items.filter(function(e, i, arr) {
382									if (e.URL == result.url)
383										key = i;
384
385									return e.URL == result.url;
386								}),
387								self = iL.items[key];
388
389							if (result)
390								$.extend(true, self, {
391									URL: result.source,
392									type: result.type,
393									recognized: true,
394									options: {
395										html5video: result.html5video,
396										width: (result.type == "image") ? 0 : (result.width || self.width),
397										height: (result.type == "image") ? 0 : (result.height || self.height),
398										thumbnail: self.options.thumbnail || result.thumbnail
399									}
400								});
401
402							length--;
403
404							if (length == 0) {
405								iL.hideLoader();
406
407								vars.dontGenerateThumbs = false;
408								iL.generateThumbnails();
409
410								if (opts.show.effect)
411									setTimeout(function() {
412										iL.generateBoxes();
413									}, opts.show.speed);
414								else
415									iL.generateBoxes();
416							}
417						};
418
419					iL.ogpRecognition(this, resultFnc);
420				});
421			}
422			else {
423				if (opts.show.effect)
424					setTimeout(function() {
425						iL.generateBoxes();
426					}, opts.show.speed);
427				else
428					iL.generateBoxes();
429			}
430
431			iL.createUI();
432
433			window.iLightBox = {
434				close: function() {
435					iL.closeAction();
436				},
437				fullscreen: function() {
438					iL.fullScreenAction();
439				},
440				moveNext: function() {
441					iL.moveTo('next');
442				},
443				movePrev: function() {
444					iL.moveTo('prev');
445				},
446				goTo: function(index) {
447					iL.goTo(index);
448				},
449				refresh: function() {
450					iL.refresh();
451				},
452				reposition: function() {
453					(arguments.length > 0) ? iL.repositionPhoto(true): iL.repositionPhoto();
454				},
455				setOption: function(options) {
456					iL.setOption(options);
457				},
458				destroy: function() {
459					iL.closeAction();
460					iL.dispatchItemsEvents();
461				}
462			};
463
464			if (opts.linkId) {
465				vars.hashLock = true;
466				window.location.hash = opts.linkId + '/' + vars.current;
467				setTimeout(function() {
468					vars.hashLock = false;
469				}, 55);
470			}
471
472			if (!opts.slideshow.startPaused) {
473				iL.resume();
474				vars.innerPlayButton.removeClass('ilightbox-play').addClass('ilightbox-pause');
475			}
476
477			//Trigger the onOpen callback
478			if (typeof iL.options.callback.onOpen == 'function') iL.options.callback.onOpen.call(iL);
479		},
480
481		loadContent: function(obj, opt, speed) {
482			var iL = this,
483				holder, item;
484
485			iL.createUI();
486
487			obj.speed = speed || iL.options.effects.loadedFadeSpeed;
488
489			if (opt == 'current') {
490				if (!obj.options.mousewheel) iL.vars.lockWheel = true;
491				else iL.vars.lockWheel = false;
492
493				if (!obj.options.swipe) iL.vars.lockSwipe = true;
494				else iL.vars.lockSwipe = false;
495			}
496
497			switch (opt) {
498				case 'current':
499					holder = iL.vars.holder, item = iL.vars.current;
500					break;
501				case 'next':
502					holder = iL.vars.nextPhoto, item = iL.vars.next;
503					break;
504				case 'prev':
505					holder = iL.vars.prevPhoto, item = iL.vars.prev;
506					break;
507			}
508
509			holder.removeAttr('style class').addClass('ilightbox-holder' + (supportTouch ? ' supportTouch' : '')).addClass(obj.options.skin);
510			$('div.ilightbox-inner-toolbar', holder).remove();
511
512			if (obj.title || iL.options.innerToolbar) {
513				var innerToolbar = iL.vars.innerToolbar.clone();
514				if (obj.title && iL.options.show.title) {
515					var title = iL.vars.title.clone();
516					title.empty().html(obj.title);
517					innerToolbar.append(title);
518				}
519				if (iL.options.innerToolbar) {
520					innerToolbar.append((iL.vars.total > 1) ? iL.vars.toolbar.clone() : iL.vars.toolbar);
521				}
522				holder.prepend(innerToolbar);
523			}
524
525			console.warn('loadContent', arguments);
526
527			iL.loadSwitcher(obj, holder, item, opt);
528		},
529
530		loadSwitcher: function(obj, holder, item, opt) {
531			var iL = this,
532				opts = iL.options,
533				api = {
534					element: holder,
535					position: item
536				};
537
538			switch (obj.type) {
539				case 'image':
540					//Trigger the onBeforeLoad callback
541					if (typeof opts.callback.onBeforeLoad == 'function') opts.callback.onBeforeLoad.call(iL, iL.ui, item);
542					if (typeof obj.options.onBeforeLoad == 'function') obj.options.onBeforeLoad.call(iL, api);
543
544					iL.loadImage(obj.URL, function(img) {
545						//Trigger the onAfterLoad callback
546						if (typeof opts.callback.onAfterLoad == 'function') opts.callback.onAfterLoad.call(iL, iL.ui, item);
547						if (typeof obj.options.onAfterLoad == 'function') obj.options.onAfterLoad.call(iL, api);
548
549						var width = (img) ? img.width : 400,
550							height = (img) ? img.height : 200;
551
552						holder.data({
553							naturalWidth: width,
554							naturalHeight: height
555						});
556						$('div.ilightbox-container', holder).empty().append((img) ? '<img src="' + obj.URL + '" class="ilightbox-image" />' : '<span class="ilightbox-alert">
556' + opts.errors.loadImage + '</span>');
557
558						//Trigger the onRender callback
559						if (typeof opts.callback.onRender == 'function') opts.callback.onRender.call(iL, iL.ui, item);
560						if (typeof obj.options.onRender == 'function') obj.options.onRender.call(iL, api);
561
562						iL.configureHolder(obj, opt, holder);
563					});
564
565					break;
566
567				case 'video':
568					holder.data({
569						naturalWidth: obj.options.width,
570						naturalHeight: obj.options.height
571					});
572
573					if (opt === 'current') {
574						iL.addContent(holder, obj);
575
576						//Trigger the onRender callback
577						if (typeof opts.callback.onRender == 'function') opts.callback.onRender.call(iL, iL.ui, item);
578						if (typeof obj.options.onRender == 'function') obj.options.onRender.call(iL, api);
579					} else {
580						$('div.ilightbox-container', holder).empty();
581					}
582
583					iL.configureHolder(obj, opt, holder);
584
585					break;
586
587				case 'iframe':
588					//iL.showLoader();
589					holder.data({
590						naturalWidth: obj.options.width,
591						naturalHeight: obj.options.height
592					});
593
594					iL.configureHolder(obj, opt, holder);
595
596					if (opt === 'current') {
597						var el = iL.addContent(holder, obj);
598
599						//Trigger the onRender callback
600						if (typeof opts.callback.onRender == 'function') opts.callback.onRender.call(iL, iL.ui, item);
601						if (typeof obj.options.onRender == 'function') obj.options.onRender.call(iL, api);
602
603						//Trigger the onBeforeLoad callback
604						if (typeof opts.callback.onBeforeLoad == 'function') opts.callback.onBeforeLoad.call(iL, iL.ui, item);
605						if (typeof obj.options.onBeforeLoad == 'function') obj.options.onBeforeLoad.call(iL, api);
606
607						el.bind('load', function() {
608							//Trigger the onAfterLoad callback
609							if (typeof opts.callback.onAfterLoad == 'function') opts.callback.onAfterLoad.call(iL, iL.ui, item);
610							if (typeof obj.options.onAfterLoad == 'function') obj.options.onAfterLoad.call(iL, api);
611
612							//iL.hideLoader();
613							el.unbind('load');
614						});
615					} else {
616						$('div.ilightbox-container', holder).empty();
617					}
618
619					break;
620
621				case 'inline':
622					var el = $(obj.URL),
623						content = iL.addContent(holder, obj),
624						images = findImageInElement(holder);
625
626					holder.data({
627						naturalWidth: (iL.items[item].options.width || el.outerWidth()),
628						naturalHeight: (iL.items[item].options.height || el.outerHeight())
629					});
630					content.children().eq(0).show();
631
632					//Trigger the onRender callback
633					if (typeof opts.callback.onRender == 'function') opts.callback.onRender.call(iL, iL.ui, item);
634					if (typeof obj.options.onRender == 'function') obj.options.onRender.call(iL, api);
635
636					//Trigger the onBeforeLoad callback
637					if (typeof opts.callback.onBeforeLoad == 'function') opts.callback.onBeforeLoad.call(iL, iL.ui, item);
638					if (typeof obj.options.onBeforeLoad == 'function') obj.options.onBeforeLoad.call(iL, api);
639
640					iL.loadImage(images, function() {
641						//Trigger the onAfterLoad callback
642						if (typeof opts.callback.onAfterLoad == 'function') opts.callback.onAfterLoad.call(iL, iL.ui, item);
643						if (typeof obj.options.onAfterLoad == 'function') obj.options.onAfterLoad.call(iL, api);
644
645						iL.configureHolder(obj, opt, holder);
646					});
647
648					break;
649
650				case 'flash':
651					var el = iL.addContent(holder, obj);
652
653					holder.data({
654						naturalWidth: (iL.items[item].options.width || el.outerWidth()),
655						naturalHeight: (iL.items[item].options.height || el.outerHeight())
656					});
657
658					//Trigger the onRender callback
659					if (typeof opts.callback.onRender == 'function') opts.callback.onRender.call(iL, iL.ui, item);
660					if (typeof obj.options.onRender == 'function') obj.options.onRender.call(iL, api);
661
662					iL.configureHolder(obj, opt, holder);
663
664					break;
665
666				case 'ajax':
667					var ajax = obj.options.ajax || {};
668					//Trigger the onBeforeLoad callback
669					if (typeof opts.callback.onBeforeLoad == 'function') opts.callback.onBeforeLoad.call(iL, iL.ui, item);
670					if (typeof obj.options.onBeforeLoad == 'function') obj.options.onBeforeLoad.call(iL, api);
671
672					iL.showLoader();
673					$.ajax({
674						url: obj.URL || opts.ajaxSetup.url,
675						data: ajax.data || null,
676						dataType: ajax.dataType || "html",
677						type: ajax.type || opts.ajaxSetup.type,
678						cache: ajax.cache || opts.ajaxSetup.cache,
679						crossDomain: ajax.crossDomain || opts.ajaxSetup.crossDomain,
680						global: ajax.global || opts.ajaxSetup.global,
681						ifModified: ajax.ifModified || opts.ajaxSetup.ifModified,
682						username: ajax.username || opts.ajaxSetup.username,
683						password: ajax.password || opts.ajaxSetup.password,
684						beforeSend: ajax.beforeSend || opts.ajaxSetup.beforeSend,
685						complete: ajax.complete || opts.ajaxSetup.complete,
686						success: function(data, textStatus, jqXHR) {
687							iL.hideLoader();
688
689							var el = $(data),
690								container = $('div.ilightbox-container', holder),
691								elWidth = iL.items[item].options.width || parseInt(el[0].getAttribute('width')),
692								elHeight = iL.items[item].options.height || parseInt(el[0].getAttribute('height')),
693								css = (el[0].getAttribute('width') && el[0].getAttribute('height')) ? {
694									'overflow': 'hidden'
695								} : {};
696
697							container.empty().append($('<div class="ilightbox-wrapper"></div>').css(css).html(el));
698							holder.show().data({
699								naturalWidth: (elWidth || container.outerWidth()),
700								naturalHeight: (elHeight || container.outerHeight())
701							}).hide();
702
703							//Trigger the onRender callback
704							if (typeof opts.callback.onRender == 'function') opts.callback.onRender.call(iL, iL.ui, item);
705							if (typeof obj.options.onRender == 'function') obj.options.onRender.call(iL, api);
706
707							var images = findImageInElement(holder);
708							iL.loadImage(images, function() {
709								//Trigger the onAfterLoad callback
710								if (typeof opts.callback.onAfterLoad == 'function') opts.callback.onAfterLoad.call(iL, iL.ui, item);
711								if (typeof obj.options.onAfterLoad == 'function') obj.options.onAfterLoad.call(iL, api);
712
713								iL.configureHolder(obj, opt, holder);
714							});
715
716							opts.ajaxSetup.success(data, textStatus, jqXHR);
717							if (typeof ajax.success == 'function') ajax.success(data, textStatus, jqXHR);
718						},
719						error: function(jqXHR, textStatus, errorThrown) {
720							//Trigger the onAfterLoad callback
721							if (typeof opts.callback.onAfterLoad == 'function') opts.callback.onAfterLoad.call(iL, iL.ui, item);
722							if (typeof obj.options.onAfterLoad == 'function') obj.options.onAfterLoad.call(iL, api);
723
724							iL.hideLoader();
725							$('div.ilightbox-container', holder).empty().append('<span class="ilightbox-alert">' + opts.errors.loadContents + '</span>');
726							iL.configureHolder(obj, opt, holder);
727
728							opts.ajaxSetup.error(jqXHR, textStatus, errorThrown);
729							if (typeof ajax.error == 'function') ajax.error(jqXHR, textStatus, errorThrown);
730						}
731					});
732
733					break;
734
735				case 'html':
736					var object = obj.URL,
737						el
738					container = $('div.ilightbox-container', holder);
739
740					if (object[0].nodeName) el = object.clone();
741					else {
742						var dom = $(object);
743						if (dom.selector) el = $('<div>' + dom + '</div>');
744						else el = dom;
745					}
746
747					var elWidth = iL.items[item].options.width || parseInt(el.attr('width')),
748						elHeight = iL.items[item].options.height || parseInt(el.attr('height'));
749
750					iL.addContent(holder, obj);
751
752					el.appendTo(document.documentElement).hide();
753
754					//Trigger the onRender callback
755					if (typeof opts.callback.onRender == 'function') opts.callback.onRender.call(iL, iL.ui, item);
756					if (typeof obj.options.onRender == 'function') obj.options.onRender.call(iL, api);
757
758					var images = findImageInElement(holder);
759
760					//Trigger the onBeforeLoad callback
761					if (typeof opts.callback.onBeforeLoad == 'function') opts.callback.onBeforeLoad.call(iL, iL.ui, item);
762					if (typeof obj.options.onBeforeLoad == 'function') obj.options.onBeforeLoad.call(iL, api);
763
764					iL.loadImage(images, function() {
765						//Trigger the onAfterLoad callback
766						if (typeof opts.callback.onAfterLoad == 'function') opts.callback.onAfterLoad.call(iL, iL.ui, item);
767						if (typeof obj.options.onAfterLoad == 'function') obj.options.onAfterLoad.call(iL, api);
768
769						holder.show().data({
770							naturalWidth: (elWidth || container.outerWidth()),
771							naturalHeight: (elHeight || container.outerHeight())
772						}).hide();
773						el.remove();
774
775						iL.configureHolder(obj, opt, holder);
776					});
777
778					break;
779			}
780		},
781
782		configureHolder: function(obj, opt, holder) {
783			var iL = this,
784				vars = iL.vars,
785				opts = iL.options;
786
787			if (opt != "current")(opt == "next") ? holder.addClass('ilightbox-next') : holder.addClass('ilightbox-prev');
788
789			if (opt == "current")
790				var item = vars.current;
791			else if (opt == "next")
792				var opacity = opts.styles.nextOpacity,
793					item = vars.next;
794			else
795				var opacity = opts.styles.prevOpacity,
796					item = vars.prev;
797
798			var api = {
799				element: holder,
800				position: item
801			};
802
803			iL.items[item].options.width = iL.items[item].options.width || 0,
804			iL.items[item].options.height = iL.items[item].options.height || 0;
805
806			if (opt == "current") {
807				if (opts.show.effect) holder.css(transform, gpuAcceleration).fadeIn(obj.speed, function() {
808					holder.css(transform, '');
809					if (obj.caption) {
810						iL.setCaption(obj, holder);
811						var caption = $('div.ilightbox-caption', holder),
812							percent = parseInt((caption.outerHeight() / holder.outerHeight()) * 100);
813						if (opts.caption.start & percent <= 50) caption.fadeIn(opts.effects.fadeSpeed);
814					}
815
816					var social = obj.options.social;
817					if (social) {
818						iL.setSocial(social, obj.URL, holder);
819						if (opts.social.start) $('div.ilightbox-social', holder).fadeIn(opts.effects.fadeSpeed);
820					}
821
822					//Generate thumbnails
823					iL.generateThumbnails();
824
825					//Trigger the onShow callback
826					if (typeof opts.callback.onShow == 'function') opts.callback.onShow.call(iL, iL.ui, item);
827					if (typeof obj.options.onShow == 'function') obj.options.onShow.call(iL, api);
828				});
829				else {
830					holder.show();
831
832					//Generate thumbnails
833					iL.generateThumbnails();
834
835					//Trigger the onShow callback
836					if (typeof opts.callback.onShow == 'function') opts.callback.onShow.call(iL, iL.ui, item);
837					if (typeof obj.options.onShow == 'function') obj.options.onShow.call(iL, api);
838				}
839			} else {
840				if (opts.show.effect) holder.fadeTo(obj.speed, opacity, function() {
841					if (opt == "next") vars.nextLock = false;
842					else vars.prevLock = false;
843
844					//Generate thumbnails
845					iL.generateThumbnails();
846
847					//Trigger the onShow callback
848					if (typeof opts.callback.onShow == 'function') opts.callback.onShow.call(iL, iL.ui, item);
849					if (typeof obj.options.onShow == 'function') obj.options.onShow.call(iL, api);
850				});
851				else {
852					holder.css({
853						opacity: opacity
854					}).show();
855					if (opt == "next") vars.nextLock = false;
856					else vars.prevLock = false;
857
858					//Generate thumbnails
859					iL.generateThumbnails();
860
861					//Trigger the onShow callback
862					if (typeof opts.callback.onShow == 'function') opts.callback.onShow.call(iL, iL.ui, item);
863					if (typeof obj.options.onShow == 'function') obj.options.onShow.call(iL, api);
864				}
865			}
866
867			setTimeout(function() {
868				iL.repositionPhoto();
869			}, 0);
870		},
871
872		generateBoxes: function() {
873			var iL = this,
874				vars = iL.vars,
875				opts = iL.options;
876
877			if (opts.infinite && vars.total >= 3) {
878				if (vars.current == vars.total - 1) vars.next = 0;
879				if (vars.current == 0) vars.prev = vars.total - 1;
880			} else opts.infinite = false;
881
882			iL.loadContent(iL.items[vars.current], 'current', opts.show.speed);
883
884			if (iL.items[vars.next]) iL.loadContent(iL.items[vars.next], 'next', opts.show.speed);
885			if (iL.items[vars.prev]) iL.loadContent(iL.items[vars.prev], 'prev', opts.show.speed);
886		},
887
888		generateThumbnails: function() {
889			var iL = this,
890				vars = iL.vars,
891				opts = iL.options,
892				timeOut = null;
893
894			if (vars.thumbs && !iL.vars.dontGenerateThumbs) {
895				var thumbnails = vars.thumbnails,
896					container = $('div.ilightbox-thumbnails-container', thumbnails),
897					grid = $('div.ilightbox-thumbnails-grid', container),
898					i = 0;
899
900				grid.removeAttr('style').empty();
901
902				$.each(iL.items, function(key, val) {
903					var isActive = (vars.current == key) ? 'ilightbox-active' : '',
904						opacity = (vars.current == key) ? opts.thumbnails.activeOpacity : opts.thumbnails.normalOpacity,
905						thumb = val.options.thumbnail,
906						thumbnail = $('<div class="ilightbox-thumbnail"></div>'),
907						icon = $('<div class="ilightbox-thumbnail-icon"></div>');
908
909					thumbnail.css({
910						opacity: 0
911					}).addClass(isActive);
912
913					if ((val.type == "video" || val.type == "flash") && typeof val.options.icon == 'undefined') {
914						icon.addClass('ilightbox-thumbnail-video');
915						thumbnail.append(icon);
916					} else if (val.options.icon) {
917						icon.addClass('ilightbox-thumbnail-' + val.options.icon);
918						thumbnail.append(icon);
919					}
920
921					if (thumb) iL.loadImage(thumb, function(img) {
922						i++;
923						if (img) thumbnail.data({
924							naturalWidth: img.width,
925							naturalHeight: img.height
926						}).append('<img src="' + thumb + '" border="0" />');
927						else thumbnail.data({
928							naturalWidth: opts.thumbnails.maxWidth,
929							naturalHeight: opts.thumbnails.maxHeight
930						});
931
932						clearTimeout(timeOut);
933						timeOut = setTimeout(function() {
934							iL.positionThumbnails(thumbnails, container, grid);
935						}, 20);
936						setTimeout(function() {
937							thumbnail.fadeTo(opts.effects.loadedFadeSpeed, opacity);
938						}, i * 20);
939					});
940
941					grid.append(thumbnail);
942				});
943				iL.vars.dontGenerateThumbs = true;
944			}
945		},
946
947		positionThumbnails: function(thumbnails, container, grid) {
948			var iL = this,
949				vars = iL.vars,
950				opts = iL.options,
951				viewport = getViewport(),
952				path = opts.path.toLowerCase();
953
954			if (!thumbnails) thumbnails = vars.thumbnails;
955			if (!container) container = $('div.ilightbox-thumbnails-container', thumbnails);
956			if (!grid) grid = $('div.ilightbox-thumbnails-grid', container);
957
958			var thumbs = $('.ilightbox-thumbnail', grid),
959				widthAvail = (path == 'horizontal') ? viewport.width - opts.styles.pageOffsetX : thumbs.eq(0).outerWidth() - opts.styles.pageOffsetX,
960				heightAvail = (path == 'horizontal') ? thumbs.eq(0).outerHeight() - opts.styles.pageOffsetY : viewport.height - opts.styles.pageOffsetY,
961				gridWidth = (path == 'horizontal') ? 0 : widthAvail,
962				gridHeight = (path == 'horizontal') ? heightAvail : 0,
963				active = $('.ilightbox-active', grid),
964				gridCss = {},
965				css = {};
966
967			if (arguments.length < 3) {
968				thumbs.css({
969					opacity: opts.thumbnails.normalOpacity
970				});
971				active.css({
972					opacity: opts.thumbnails.activeOpacity
973				});
974			}
975
976			thumbs.each(function(i) {
977				var t = $(this),
978					data = t.data(),
979					width = (path == 'horizontal') ? 0 : opts.thumbnails.maxWidth;
980				height = (path == 'horizontal') ? opts.thumbnails.maxHeight : 0;
981				dims = iL.getNewDimenstions(width, height, data.naturalWidth, data.naturalHeight, true);
982
983				t.css({
984					width: dims.width,
985					height: dims.height
986				});
987				if (path == 'horizontal') t.css({
988					'float': 'left'
989				});
990
991				(path == 'horizontal') ? (
992					gridWidth += t.outerWidth()
993				) : (
994					gridHeight += t.outerHeight()
995				);
996			});
997
998			gridCss = {
999				width: gridWidth,
1000				height: gridHeight
1001			};
1002
1003			grid.css(gridCss);
1004
1005			gridCss = {};
1006
1007			var gridOffset = grid.offset(),
1008				activeOffset = (active.length) ? active.offset() : {
1009					top: parseInt(heightAvail / 2),
1010					left: parseInt(widthAvail / 2)
1011				};
1012
1013			gridOffset.top = (gridOffset.top - $doc.scrollTop()),
1014				gridOffset.left = (gridOffset.left - $doc.scrollLeft()),
1015				activeOffset.top = (activeOffset.top - gridOffset.top - $doc.scrollTop()),
1016				activeOffset.left = (activeOffset.left - gridOffset.left - $doc.scrollLeft());
1017
1018			(path == 'horizontal') ? (
1019				gridCss.top = 0,
1020				gridCss.left = parseInt((widthAvail / 2) - activeOffset.left - (active.outerWidth() / 2))
1021			) : (
1022				gridCss.top = parseInt(((heightAvail / 2) - activeOffset.top - (active.outerHeight() / 2))),
1023				gridCss.left = 0
1024			);
1025
1026			if (arguments.length < 3) grid.stop().animate(gridCss, opts.effects.repositionSpeed, 'easeOutCirc');
1027			else grid.css(gridCss);
1028		},
1029
1030		loadImage: function(image, callback) {
1031			if (!$.isArray(image)) image = [image];
1032
1033			var iL = this,
1034				length = image.length;
1035
1036			if (length > 0) {
1037				iL.showLoader();
1038				$.each(image, function(index, value) {
1039					var img = new Image();
1040					img.onload = function() {
1041						length -= 1;
1042						if (length == 0) {
1043							iL.hideLoader();
1044							callback(img);
1045						}
1046					};
1047					img.onerror = img.onabort = function() {
1048						length -= 1;
1049						if (length == 0) {
1050							iL.hideLoader();
1051							callback(false);
1052						}
1053					};
1054					img.src = image[index];
1055				});
1056			} else callback(false);
1057		},
1058
1059		patchItemsEvents: function() {
1060			var iL = this,
1061				vars = iL.vars,
1062				clickEvent = supportTouch ? "itap.iL" : "click.iL",
1063				vEvent = supportTouch ? "click.iL" : "itap.iL";
1064
1065			if (iL.context && iL.selector) {
1066				var $items = $(iL.selector, iL.context);
1067
1068				$(iL.context).on(clickEvent, iL.selector, function() {
1069					var $this = $(this),
1070						key = $items.index($this);
1071
1072					vars.current = key;
1073					vars.next = iL.items[key + 1] ? key + 1 : null;
1074					vars.prev = iL.items[key - 1] ? key - 1 : null;
1075
1076					iL.addContents();
1077					iL.patchEvents();
1078
1079					return false;
1080				}).on(vEvent, iL.selector, function() {
1081					return false;
1082				});
1083			} else
1084				$.each(iL.itemsObject, function(key, val) {
1085					val.on(clickEvent, function() {
1086						vars.current = key;
1087						vars.next = iL.items[key + 1] ? key + 1 : null;
1088						vars.prev = iL.items[key - 1] ? key - 1 : null;
1089
1090						iL.addContents();
1091						iL.patchEvents();
1092
1093						return false;
1094					}).on(vEvent, function() {
1095						return false;
1096					});
1097				});
1098		},
1099
1100		dispatchItemsEvents: function() {
1101			var iL = this,
1102				vars = iL.vars,
1103				opts = iL.options;
1104
1105			if (iL.context && iL.selector)
1106				$(iL.context).off('.iL', iL.selector);
1107			else
1108				$.each(iL.itemsObject, function(key, val) {
1109					val.off('.iL');
1110				});
1111		},
1112
1113		refresh: function() {
1114			var iL = this;
1115
1116			iL.dispatchItemsEvents();
1117			iL.attachItems();
1118			iL.normalizeItems();
1119			iL.patchItemsEvents();
1120		},
1121
1122		patchEvents: function() {
1123			var iL = this,
1124				vars = iL.vars,
1125				opts = iL.options,
1126				path = opts.path.toLowerCase(),
1127				holders = $('.ilightbox-holder'),
1128				fullscreenEvent = fullScreenApi.fullScreenEventName + '.iLightBox',
1129				durationThreshold = 1000,
1130				horizontalDistanceThreshold =
1131				verticalDistanceThreshold = 100,
1132				buttonsArray = [vars.nextButton[0], vars.prevButton[0], vars.nextButton[0].firstChild, vars.prevButton[0].firstChild];
1133
1134			$win.bind('resize.iLightBox', function() {
1135				var viewport = getViewport();
1136
1137				if (opts.mobileOptimizer && !opts.innerToolbar) vars.isMobile = viewport.width <= vars.mobileMaxWidth;
1138				vars.BODY[vars.isMobile ? 'addClass' : 'removeClass']('isMobile');
1139
1140				iL.repositionPhoto(null);
1141				if (supportTouch) {
1142					clearTimeout(vars.setTime);
1143					vars.setTime = setTimeout(function() {
1144						var scrollTop = getScrollXY().y;
1145						window.scrollTo(0, scrollTop - 30);
1146						window.scrollTo(0, scrollTop + 30);
1147						window.scrollTo(0, scrollTop);
1148					}, 2000);
1149				}
1150				if (vars.thumbs) iL.positionThumbnails();
1151			}).bind('keydown.iLightBox', function(event) {
1152				if (opts.controls.keyboard) {
1153					switch (event.keyCode) {
1154						case 13:
1155							if (event.shiftKey && opts.keyboard.shift_enter) iL.fullScreenAction();
1156							break;
1157						case 27:
1158							if (opts.keyboard.esc) iL.closeAction();
1159							break;
1160						case 37:
1161							if (opts.keyboard.left && !vars.lockKey) iL.moveTo('prev');
1162							break;
1163						case 38:
1164							if (opts.keyboard.up && !vars.lockKey) iL.moveTo('prev');
1165							break;
1166						case 39:
1167							if (opts.keyboard.right && !vars.lockKey) iL.moveTo('next');
1168							break;
1169						case 40:
1170							if (opts.keyboard.down && !vars.lockKey) iL.moveTo('next');
1171							break;
1172					}
1173				}
1174			});
1175
1176			if (fullScreenApi.supportsFullScreen) $win.bind(fullscreenEvent, function() {
1177				iL.doFullscreen();
1178			});
1179
1180			var holderEventsArr = [opts.caption.show + '.iLightBox', opts.caption.hide + '.iLightBox', opts.social.show + '.iLightBox', opts.social.hide + '.iLightBox'].filter(function(e, i, arr) {
1181					return arr.lastIndexOf(e) === i;
1182				}),
1183				holderEvents = "";
1184
1185			$.each(holderEventsArr, function(key, val) {
1186				if (key != 0) holderEvents += ' ';
1187				holderEvents += val;
1188			});
1189
1190			$doc.on(clickEvent, '.ilightbox-overlay', function() {
1191				if (opts.overlay.blur) iL.closeAction();
1192			}).on(clickEvent, '.ilightbox-next, .ilightbox-next-button', function() {
1193				iL.moveTo('next');
1194			}).on(clickEvent, '.ilightbox-prev, .ilightbox-prev-button', function() {
1195				iL.moveTo('prev');
1196			}).on(clickEvent, '.ilightbox-thumbnail', function() {
1197				var t = $(this),
1198					thumbs = $('.ilightbox-thumbnail', vars.thumbnails),
1199					index = thumbs.index(t);
1200
1201				if (index != vars.current) iL.goTo(index);
1202			}).on(holderEvents, '.ilightbox-holder:not(.ilightbox-next, .ilightbox-prev)', function(e) {
1203				var caption = $('div.ilightbox-caption', vars.holder),
1204					social = $('div.ilightbox-social', vars.holder),
1205					fadeSpeed = opts.effects.fadeSpeed;
1206
1207				if (vars.nextLock || vars.prevLock) {
1208					if (e.type == opts.caption.show && !caption.is(':visible')) caption.fadeIn(fadeSpeed);
1209					else if (e.type == opts.caption.hide && caption.is(':visible')) caption.fadeOut(fadeSpeed);
1210
1211					if (e.type == opts.social.show && !social.is(':visible')) social.fadeIn(fadeSpeed);
1212					else if (e.type == opts.social.hide && social.is(':visible')) social.fadeOut(fadeSpeed);
1213				} else {
1214					if (e.type == opts.caption.show && !caption.is(':visible')) caption.stop().fadeIn(fadeSpeed);
1215					else if (e.type == opts.caption.hide && caption.is(':visible')) caption.stop().fadeOut(fadeSpeed);
1216
1217					if (e.type == opts.social.show && !social.is(':visible')) social.stop().fadeIn(fadeSpeed);
1218					else if (e.type == opts.social.hide && social.is(':visible')) social.stop().fadeOut(fadeSpeed);
1219				}
1220			}).on('mouseenter.iLightBox mouseleave.iLightBox', '.ilightbox-wrapper', function(e) {
1221				if (e.type == 'mouseenter') vars.lockWheel = true;
1222				else vars.lockWheel = false;
1223			}).on(clickEvent, '.ilightbox-toolbar a.ilightbox-close, .ilightbox-toolbar a.ilightbox-fullscreen, .ilightbox-toolbar a.ilightbox-play, .ilightbox-toolbar a.ilightbox-pause', function() {
1224				var t = $(this);
1225
1226				if (t.hasClass('ilightbox-fullscreen')) iL.fullScreenAction();
1227				else if (t.hasClass('ilightbox-play')) {
1228					iL.resume();
1229					t.addClass('ilightbox-pause').removeClass('ilightbox-play');
1230				} else if (t.hasClass('ilightbox-pause')) {
1231					iL.pause();
1232					t.addClass('ilightbox-play').removeClass('ilightbox-pause');
1233				} else iL.closeAction();
1234			}).on(touchMoveEvent, '.ilightbox-overlay, .ilightbox-thumbnails-container', function(e) {
1235				// prevent scrolling
1236				e.preventDefault();
1237			});
1238
1239			function mouseMoveHandler(e) {
1240				if (!vars.isMobile) {
1241					if (!vars.mouseID) {
1242						vars.hideableElements.show();
1243					}
1244
1245					vars.mouseID = clearTimeout(vars.mouseID);
1246
1247					if (buttonsArray.indexOf(e.target) === -1)
1248						vars.mouseID = setTimeout(function() {
1249							vars.hideableElements.hide();
1250							vars.mouseID = clearTimeout(vars.mouseID);
1251						}, 3000);
1252				}
1253			}
1254
1255			if (opts.controls.arrows && !supportTouch) $doc.on('mousemove.iLightBox', mouseMoveHandler);
1256
1257			if (opts.controls.slideshow && opts.slideshow.pauseOnHover) $doc.on('mouseenter.iLightBox mouseleave.iLightBox', '.ilightbox-holder:not(.ilightbox-next, .ilightbox-prev)', function(e) {
1258				if (e.type == 'mouseenter' && vars.cycleID) iL.pause();
1259				else if (e.type == 'mouseleave' && vars.isPaused) iL.resume();
1260			});
1261
1262			var switchers = $('.ilightbox-overlay, .ilightbox-holder, .ilightbox-thumbnails');
1263
1264			if (opts.controls.mousewheel) switchers.on('mousewheel.iLightBox', function(event, delta) {
1265				if (!vars.lockWheel) {
1266					event.preventDefault();
1267					if (delta < 0) iL.moveTo('next');
1268					else if (delta > 0) iL.moveTo('prev');
1269				}
1270			});
1271
1272			if (opts.controls.swipe) holders.on(touchStartEvent, function(event) {
1273				if (vars.nextLock || vars.prevLock || vars.total == 1 || vars.lockSwipe) return;
1274
1275				vars.BODY.addClass('ilightbox-closedhand');
1276
1277				var data = event.originalEvent.touches ? event.originalEvent.touches[0] : event,
1278					scrollTop = $doc.scrollTop(),
1279					scrollLeft = $doc.scrollLeft(),
1280					offsets = [
1281						holders.eq(0).offset(),
1282						holders.eq(1).offset(),
1283						holders.eq(2).offset()
1284					],
1285					offSet = [{
1286						top: offsets[0].top - scrollTop,
1287						left: offsets[0].left - scrollLeft
1288					}, {
1289						top: offsets[1].top - scrollTop,
1290						left: offsets[1].left - scrollLeft
1291					}, {
1292						top: offsets[2].top - scrollTop,
1293						left: offsets[2].left - scrollLeft
1294					}],
1295					start = {
1296						time: (new Date()).getTime(),
1297						coords: [data.pageX - scrollLeft, data.pageY - scrollTop]
1298					},
1299					stop;
1300
1301				function moveEachHandler(i) {
1302					var t = $(this),
1303						offset = offSet[i],
1304						scroll = [(start.coords[0] - stop.coords[0]), (start.coords[1] - stop.coords[1])];
1305
1306					t[0].style[path == "horizontal" ? 'left' : 'top'] = (path == "horizontal" ? offset.left - scroll[0] : offset.top - scroll[1]) + 'px';
1307				}
1308
1309				function moveHandler(event) {
1310
1311					if (!start) return;
1312
1313					var data = event.originalEvent.touches ? event.originalEvent.touches[0] : event;
1314
1315					stop = {
1316						time: (new Date()).getTime(),
1317						coords: [data.pageX - scrollLeft, data.pageY - scrollTop]
1318					};
1319
1320					holders.each(moveEachHandler);
1321
1322					// prevent scrolling
1323					event.preventDefault();
1324				}
1325
1326				function repositionHolders() {
1327					holders.each(function() {
1328						var t = $(this),
1329							offset = t.data('offset') || {
1330								top: t.offset().top - scrollTop,
1331								left: t.offset().left - scrollLeft
1332							},
1333							top = offset.top,
1334							left = offset.left;
1335
1336						t.css(transform, gpuAcceleration).stop().animate({
1337							top: top,
1338							left: left
1339						}, 500, 'easeOutCirc', function() {
1340							t.css(transform, '');
1341						});
1342					});
1343				}
1344
1345				holders.bind(touchMoveEvent, moveHandler);
1346				$doc.one(touchStopEvent, function(event) {
1347					holders.unbind(touchMoveEvent, moveHandler);
1348
1349					vars.BODY.removeClass('ilightbox-closedhand');
1350
1351					if (start && stop) {
1352						if (path == "horizontal" && stop.time - start.time < durationThreshold && abs(start.coords[0] - stop.coords[0]) > horizontalDistanceThreshold && abs(start.coords[1] - stop.coords[1]) < verticalDistanceThreshold) {
1353							if (start.coords[0] > stop.coords[0]) {
1354								if (vars.current == vars.total - 1 && !opts.infinite) repositionHolders();
1355								else {
1356									vars.isSwipe = true;
1357									iL.moveTo('next');
1358								}
1359							} else {
1360								if (vars.current == 0 && !opts.infinite) repositionHolders();
1361								else {
1362									vars.isSwipe = true;
1363									iL.moveTo('prev');
1364								}
1365							}
1366						} else if (path == "vertical" && stop.time - start.time < durationThreshold && abs(start.coords[1] - stop.coords[1]) > horizontalDistanceThreshold && abs(start.coords[0] - stop.coords[0]) < verticalDistanceThreshold) {
1367							if (start.coords[1] > stop.coords[1]) {
1368								if (vars.current == vars.total - 1 && !opts.infinite) repositionHolders();
1369								else {
1370									vars.isSwipe = true;
1371									iL.moveTo('next');
1372								}
1373							} else {
1374								if (vars.current == 0 && !opts.infinite) repositionHolders();
1375								else {
1376									vars.isSwipe = true;
1377									iL.moveTo('prev');
1378								}
1379							}
1380						} else repositionHolders();
1381					}
1382					start = stop = undefined;
1383				});
1384			});
1385
1386		},
1387
1388		goTo: function(index) {
1389			var iL = this,
1390				vars = iL.vars,
1391				opts = iL.options,
1392				diff = (index - vars.current);
1393
1394			if (opts.infinite) {
1395				if (index == vars.total - 1 && vars.current == 0) diff = -1;
1396				if (vars.current == vars.total - 1 && index == 0) diff = 1;
1397			}
1398
1399			if (diff == 1) iL.moveTo('next');
1400			else if (diff == -1) iL.moveTo('prev');
1401			else {
1402
1403				if (vars.nextLock || vars.prevLock) return false;
1404
1405				//Trigger the onBeforeChange callback
1406				if (typeof opts.callback.onBeforeChange == 'function') opts.callback.onBeforeChange.call(iL, iL.ui);
1407
1408				if (opts.linkId) {
1409					vars.hashLock = true;
1410					window.location.hash = opts.linkId + '/' + index;
1411				}
1412
1413				if (iL.items[index]) {
1414					if (!iL.items[index].options.mousewheel) vars.lockWheel = true;
1415					else iL.vars.lockWheel = false;
1416
1417					if (!iL.items[index].options.swipe) vars.lockSwipe = true;
1418					else vars.lockSwipe = false;
1419				}
1420
1421				$.each([vars.holder, vars.nextPhoto, vars.prevPhoto], function(key, val) {
1422					val.css(transform, gpuAcceleration).fadeOut(opts.effects.loadedFadeSpeed);
1423				});
1424
1425				vars.current = index;
1426				vars.next = index + 1;
1427				vars.prev = index - 1;
1428
1429				iL.createUI();
1430
1431				setTimeout(function() {
1432					iL.generateBoxes();
1433				}, opts.effects.loadedFadeSpeed + 50);
1434
1435				$('.ilightbox-thumbnail', vars.thumbnails).removeClass('ilightbox-active').eq(index).addClass('ilightbox-active');
1436				iL.positionThumbnails();
1437
1438				if (opts.linkId) setTimeout(function() {
1439					vars.hashLock = false;
1440				}, 55);
1441
1442				// Configure arrow buttons
1443				if (!opts.infinite) {
1444					vars.nextButton.add(vars.prevButton).add(vars.innerPrevButton).add(vars.innerNextButton).removeClass('disabled');
1445
1446					if (vars.current == 0) {
1447						vars.prevButton.add(vars.innerPrevButton).addClass('disabled');
1448					}
1449					if (vars.current >= vars.total - 1) {
1450						vars.nextButton.add(vars.innerNextButton).addClass('disabled');
1451					}
1452				}
1453
1454				// Reset next cycle timeout
1455				iL.resetCycle();
1456
1457				//Trigger the onAfterChange callback
1458				if (typeof opts.callback.onAfterChange == 'function') opts.callback.onAfterChange.call(iL, iL.ui);
1459			}
1460		},
1461
1462		moveTo: function(side) {
1463			var iL = this,
1464				vars = iL.vars,
1465				opts = iL.options,
1466				path = opts.path.toLowerCase(),
1467				viewport = getViewport(),
1468				switchSpeed = opts.effects.switchSpeed;
1469
1470			if (vars.nextLock || vars.prevLock) return false;
1471			else {
1472
1473				var item = (side == "next") ? vars.next : vars.prev;
1474
1475				if (opts.linkId) {
1476					vars.hashLock = true;
1477					window.location.hash = opts.linkId + '/' + item;
1478				}
1479
1480				if (side == "next") {
1481					if (!iL.items[item]) return false;
1482					var firstHolder = vars.nextPhoto,
1483						secondHolder = vars.holder,
1484						lastHolder = vars.prevPhoto,
1485						firstClass = 'ilightbox-prev',
1486						secondClass = 'ilightbox-next';
1487				} else if (side == "prev") {
1488					if (!iL.items[item]) return false;
1489					var firstHolder = vars.prevPhoto,
1490						secondHolder = vars.holder,
1491						lastHolder = vars.nextPhoto,
1492						firstClass = 'ilightbox-next',
1493						secondClass = 'ilightbox-prev';
1494				}
1495
1496				//Trigger the onBeforeChange callback
1497				if (typeof opts.callback.onBeforeChange == 'function')
1498					opts.callback.onBeforeChange.call(iL, iL.ui);
1499
1500				(side == "next") ? vars.nextLock = true: vars.prevLock = true;
1501
1502				var captionFirst = $('div.ilightbox-caption', secondHolder),
1503					socialFirst = $('div.ilightbox-social', secondHolder);
1504
1505				if (captionFirst.length)
1506					captionFirst.stop().fadeOut(switchSpeed, function() {
1507						$(this).remove();
1508					});
1509				if (socialFirst.length)
1510					socialFirst.stop().fadeOut(switchSpeed, function() {
1511						$(this).remove();
1512					});
1513
1514				if (iL.items[item].caption) {
1515					iL.setCaption(iL.items[item], firstHolder);
1516					var caption = $('div.ilightbox-caption', firstHolder),
1517						percent = parseInt((caption.outerHeight() / firstHolder.outerHeight()) * 100);
1518					if (opts.caption.start && percent <= 50) caption.fadeIn(switchSpeed);
1519				}
1520
1521				var social = iL.items[item].options.social;
1522				if (social) {
1523					iL.setSocial(social, iL.items[item].URL, firstHolder);
1524					if (opts.social.start) $('div.ilightbox-social', firstHolder).fadeIn(opts.effects.fadeSpeed);
1525				}
1526
1527				$.each([firstHolder, secondHolder, lastHolder], function(key, val) {
1528					val.removeClass('ilightbox-next ilightbox-prev');
1529				});
1530
1531				var firstOffset = firstHolder.data('offset'),
1532					winW = (viewport.width - (opts.styles.pageOffsetX)),
1533					winH = (viewport.height - (opts.styles.pageOffsetY)),
1534					width = firstOffset.newDims.width,
1535					height = firstOffset.newDims.height,
1536					thumbsOffset = firstOffset.thumbsOffset,
1537					diff = firstOffset.diff,
1538					top = parseInt((winH / 2) - (height / 2) - diff.H - (thumbsOffset.H / 2)),
1539					left = parseInt((winW / 2) - (width / 2) - diff.W - (thumbsOffset.W / 2));
1540
1541				firstHolder.css(transform, gpuAcceleration).animate({
1542					top: top,
1543					left: left,
1544					opacity: 1
1545				}, switchSpeed, (vars.isSwipe) ? 'easeOutCirc' : 'easeInOutCirc', function() {
1546					firstHolder.css(transform, '');
1547				});
1548
1549				$('div.ilightbox-container', firstHolder).animate({
1550					width: width,
1551					height: height
1552				}, switchSpeed, (vars.isSwipe) ? 'easeOutCirc' : 'easeInOutCirc');
1553
1554				var secondOffset = secondHolder.data('offset'),
1555					object = secondOffset.object;
1556
1557				diff = secondOffset.diff;
1558
1559				width = secondOffset.newDims.width,
1560					height = secondOffset.newDims.height;
1561
1562				width = parseInt(width * opts.styles[side == 'next' ? 'prevScale' : 'nextScale']),
1563					height = parseInt(height * opts.styles[side == 'next' ? 'prevScale' : 'nextScale']),
1564					top = (path == 'horizontal') ? parseInt((winH / 2) - object.offsetY - (height / 2) - diff.H - (thumbsOffset.H / 2)) : parseInt(winH - object.offsetX - diff.H - (thumbsOffset.H / 2));
1565
1566				if (side == 'prev')
1567					left = (path == 'horizontal') ? parseInt(winW - object.offsetX - diff.W - (thumbsOffset.W / 2)) : parseInt((winW / 2) - (width / 2) - diff.W - object.offsetY - (thumbsOffset.W / 2));
1568				else {
1569					top = (path == 'horizontal') ? top : parseInt(object.offsetX - diff.H - height - (thumbsOffset.H / 2)),
1570						left = (path == 'horizontal') ? parseInt(object.offsetX - diff.W - width - (thumbsOffset.W / 2)) : parseInt((winW / 2) - object.offsetY - (width / 2) - diff.W - (thumbsOffset.W / 2));
1571				}
1572
1573				$('div.ilightbox-container', secondHolder).animate({
1574					width: width,
1575					height: height
1576				}, switchSpeed, (vars.isSwipe) ? 'easeOutCirc' : 'easeInOutCirc');
1577
1578				secondHolder.addClass(firstClass).css(transform, gpuAcceleration).animate({
1579					top: top,
1580					left: left,
1581					opacity: opts.styles.prevOpacity
1582				}, switchSpeed, (vars.isSwipe) ? 'easeOutCirc' : 'easeInOutCirc', function() {
1583					secondHolder.css(transform, '');
1584
1585					$('.ilightbox-thumbnail', vars.thumbnails).removeClass('ilightbox-active').eq(item).addClass('ilightbox-active');
1586					iL.positionThumbnails();
1587
1588					if (iL.items[item]) {
1589						if (!iL.items[item].options.mousewheel) vars.lockWheel = true;
1590						else vars.lockWheel = false;
1591
1592						if (!iL.items[item].options.swipe) vars.lockSwipe = true;
1593						else vars.lockSwipe = false;
1594					}
1595
1596					vars.isSwipe = false;
1597
1598					// Remove iframe & video from previous slide
1599					if (['iframe', 'video'].indexOf(iL.items[vars.current].type) !== -1) {
1600						$('div.ilightbox-container', secondHolder).empty();
1601					}
1602
1603					if (side == "next") {
1604						vars.nextPhoto = lastHolder,
1605							vars.prevPhoto = secondHolder,
1606							vars.holder = firstHolder;
1607
1608						vars.nextPhoto.hide();
1609
1610						vars.next = vars.next + 1,
1611							vars.prev = vars.current,
1612							vars.current = vars.current + 1;
1613
1614						if (opts.infinite) {
1615							if (vars.current > vars.total - 1) vars.current = 0;
1616							if (vars.current == vars.total - 1) vars.next = 0;
1617							if (vars.current == 0) vars.prev = vars.total - 1;
1618						}
1619
1620						iL.createUI();
1621
1622						if (!iL.items[vars.next])
1623							vars.nextLock = false;
1624						else
1625							iL.loadContent(iL.items[vars.next], 'next');
1626					} else {
1627						vars.prevPhoto = lastHolder;
1628						vars.nextPhoto = secondHolder;
1629						vars.holder = firstHolder;
1630
1631						vars.prevPhoto.hide();
1632
1633						vars.next = vars.current;
1634						vars.current = vars.prev;
1635						vars.prev = vars.current - 1;
1636
1637						if (opts.infinite) {
1638							if (vars.current == vars.total - 1) vars.next = 0;
1639							if (vars.current == 0) vars.prev = vars.total - 1;
1640						}
1641
1642						iL.createUI();
1643
1644						if (!iL.items[vars.prev])
1645							vars.prevLock = false;
1646						else
1647							iL.loadContent(iL.items[vars.prev], 'prev');
1648					}
1649
1650					// Add iframe & video content for current slide
1651					if (['iframe', 'video'].indexOf(iL.items[vars.current].type) !== -1) {
1652						iL.loadContent(iL.items[vars.current], 'current');
1653					}
1654
1655					if (opts.linkId) setTimeout(function() {
1656						vars.hashLock = false;
1657					}, 55);
1658
1659					// Configure arrow buttons
1660					if (!opts.infinite) {
1661						vars.nextButton.add(vars.prevButton).add(vars.innerPrevButton).add(vars.innerNextButton).removeClass('disabled');
1662
1663						if (vars.current == 0)
1664							vars.prevButton.add(vars.innerPrevButton).addClass('disabled');
1665						if (vars.current >= vars.total - 1)
1666							vars.nextButton.add(vars.innerNextButton).addClass('disabled');
1667					}
1668
1669					iL.repositionPhoto();
1670
1671					// Reset next cycle timeout
1672					iL.resetCycle();
1673
1674					//Trigger the onAfterChange callback
1675					if (typeof opts.callback.onAfterChange == 'function')
1676						opts.callback.onAfterChange.call(iL, iL.ui);
1677				});
1678
1679				top = (path == 'horizontal') ? getPixel(lastHolder, 'top') : ((side == "next") ? parseInt(-(winH / 2) - lastHolder.outerHeight()) : parseInt(top * 2)),
1680					left = (path == 'horizontal') ? ((side == "next") ? parseInt(-(winW / 2) - lastHolder.outerWidth()) : parseInt(left * 2)) : getPixel(lastHolder, 'left');
1681
1682				lastHolder.css(transform, gpuAcceleration).animate({
1683					top: top,
1684					left: left,
1685					opacity: opts.styles.nextOpacity
1686				}, switchSpeed, (vars.isSwipe) ? 'easeOutCirc' : 'easeInOutCirc', function() {
1687					lastHolder.css(transform, '');
1688				}).addClass(secondClass);
1689			}
1690		},
1691
1692		setCaption: function(obj, target) {
1693			var iL = this,
1694				caption = $('<div class="ilightbox-caption"></div>');
1695
1696			if (obj.caption) {
1697				caption.html(obj.caption);
1698				$('div.ilightbox-container', target).append(caption);
1699			}
1700		},
1701
1702		normalizeSocial: function(obj, url) {
1703			var iL = this,
1704				vars = iL.vars,
1705				opts = iL.options,
1706				baseURL = window.location.href;
1707
1708			$.each(obj, function(key, value) {
1709				if (!value)
1710					return true;
1711
1712				var item = key.toLowerCase(),
1713					source, text;
1714
1715				switch (item) {
1716					case 'facebook':
1717						source = "http://www.facebook.com/share.php?v=4&src=bm&u={URL}",
1718							text = "Share on Facebook";
1719						break;
1720					case 'twitter':
1721						source = "http://twitter.com/home?status={URL}",
1722							text = "Share on Twitter";
1723						break;
1724					case 'googleplus':
1725						source = "https://plus.google.com/share?url={URL}",
1726							text = "Share on Google+";
1727						break;
1728					case 'delicious':
1729						source = "http://delicious.com/post?url={URL}",
1730							text = "Share on Delicious";
1731						break;
1732					case 'digg':
1733						source = "http://digg.com/submit?phase=2&url={URL}",
1734							text = "Share on Digg";
1735						break;
1736					case 'reddit':
1737						source = "http://reddit.com/submit?url={URL}",
1738							text = "Share on reddit";
1739						break;
1740				}
1741
1742				obj[key] = {
1743					URL: value.URL && absolutizeURI(baseURL, value.URL) || opts.linkId && window.location.href || typeof url !== 'string' && baseURL || url && absolutizeURI(baseURL, url) || baseURL,
1744					source: value.source || source || value.URL && absolutizeURI(baseURL, value.URL) || url && absolutizeURI(baseURL, url),
1745					text: value.text || text || "Share on " + key,
1746					width: (typeof(value.width) != 'undefined' && !isNaN(value.width)) ? parseInt(value.width) : 640,
1747					height: value.height || 360
1748				};
1749
1750			});
1751
1752			return obj;
1753		},
1754
1755		setSocial: function(obj, url, target) {
1756			var iL = this,
1757				socialBar = $('<div class="ilightbox-social"></div>'),
1758				buttons = '<ul>';
1759
1760			obj = iL.normalizeSocial(obj, url);
1761
1762			$.each(obj, function(key, value) {
1763				var item = key.toLowerCase(),
1764					source = value.source.replace(/\{URL\}/g, encodeURIComponent(value.URL).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+'));
1765				buttons += '<li class="' + key + '"><a href="' + source + '" onclick="javascript:window.open(this.href' + ((value.width <= 0 || value.height <= 0) ? '' : ', \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=' + value.height + ',width=' + value.width + ',left=40,top=40\'') + ');return false;" title="' + value.text + '" target="_blank"></a></li>';
1766			});
1767
1768			buttons += '</ul>';
1769
1770			socialBar.html(buttons);
1771			$('div.ilightbox-container', target).append(socialBar);
1772		},
1773
1774		fullScreenAction: function() {
1775			var iL = this,
1776				vars = iL.vars;
1777
1778			if (fullScreenApi.supportsFullScreen) {
1779				if (fullScreenApi.isFullScreen()) fullScreenApi.cancelFullScreen(document.documentElement);
1780				else fullScreenApi.requestFullScreen(document.documentElement);
1781			} else {
1782				iL.doFullscreen();
1783			}
1784		},
1785
1786		doFullscreen: function() {
1787			var iL = this,
1788				vars = iL.vars,
1789				viewport = getViewport(),
1790				opts = iL.options;
1791
1792			if (opts.fullAlone) {
1793				var currentHolder = vars.holder,
1794					current = iL.items[vars.current],
1795					windowWidth = viewport.width,
1796					windowHeight = viewport.height,
1797					elements = [currentHolder, vars.nextPhoto, vars.prevPhoto, vars.nextButton, vars.prevButton, vars.overlay, vars.toolbar, vars.thumbnails, vars.loader],
1798					hideElements = [vars.nextPhoto, vars.prevPhoto, vars.nextButton, vars.prevButton, vars.loader, vars.thumbnails];
1799
1800				if (!vars.isInFullScreen) {
1801					vars.isInFullScreen = vars.lockKey = vars.lockWheel = vars.lockSwipe = true;
1802					vars.overlay.css({
1803						opacity: 1
1804					});
1805
1806					$.each(hideElements, function(i, element) {
1807						element.hide();
1808					});
1809
1810					vars.fullScreenButton.attr('title', opts.text.exitFullscreen);
1811
1812					if (opts.fullStretchTypes.indexOf(current.type) != -1) currentHolder.data({
1813						naturalWidthOld: currentHolder.data('naturalWidth'),
1814						naturalHeightOld: currentHolder.data('naturalHeight'),
1815						naturalWidth: windowWidth,
1816						naturalHeight: windowHeight
1817					});
1818					else {
1819						var viewport = current.options.fullViewPort || opts.fullViewPort || '',
1820							newWidth = windowWidth,
1821							newHeight = windowHeight,
1822							width = currentHolder.data('naturalWidth'),
1823							height = currentHolder.data('naturalHeight');
1824
1825						if (viewport.toLowerCase() == 'fill') {
1826							newHeight = (newWidth / width) * height;
1827
1828							if (newHeight < windowHeight) {
1829								newWidth = (windowHeight / height) * width,
1830									newHeight = windowHeight;
1831							}
1832						} else if (viewport.toLowerCase() == 'fit') {
1833							var dims = iL.getNewDimenstions(newWidth, newHeight, width, height, true);
1834
1835							newWidth = dims.width,
1836								newHeight = dims.height;
1837						} else if (viewport.toLowerCase() == 'stretch') {
1838							newWidth = newWidth,
1839								newHeight = newHeight;
1840						} else {
1841							var scale = (width > newWidth || height > newHeight) ? true : false,
1842								dims = iL.getNewDimenstions(newWidth, newHeight, width, height, scale);
1843							newWidth = dims.width,
1844								newHeight = dims.height;
1845						}
1846
1847						currentHolder.data({
1848							naturalWidthOld: currentHolder.data('naturalWidth'),
1849							naturalHeightOld: currentHolder.data('naturalHeight'),
1850							naturalWidth: newWidth,
1851							naturalHeight: newHeight
1852						});
1853					}
1854
1855					$.each(elements, function(key, val) {
1856						val.addClass('ilightbox-fullscreen');
1857					});
1858
1859					//Trigger the onEnterFullScreen callback
1860					if (typeof opts.callback.onEnterFullScreen == 'function') opts.callback.onEnterFullScreen.call(iL, iL.ui);
1861				} else {
1862					vars.isInFullScreen = vars.lockKey = vars.lockWheel = vars.lockSwipe = false;
1863					vars.overlay.css({
1864						opacity: iL.options.overlay.opacity
1865					});
1866
1867					$.each(hideElements, function(i, element) {
1868						element.show();
1869					});
1870
1871					vars.fullScreenButton.attr('title', opts.text.enterFullscreen);
1872
1873					currentHolder.data({
1874						naturalWidth: currentHolder.data('naturalWidthOld'),
1875						naturalHeight: currentHolder.data('naturalHeightOld'),
1876						naturalWidthOld: null,
1877						naturalHeightOld: null
1878					});
1879
1880					$.each(elements, function(key, val) {
1881						val.removeClass('ilightbox-fullscreen');
1882					});
1883
1884					//Trigger the onExitFullScreen callback
1885					if (typeof opts.callback.onExitFullScreen == 'function') opts.callback.onExitFullScreen.call(iL, iL.ui);
1886				}
1887			} else {
1888				if (!vars.isInFullScreen) vars.isInFullScreen = true;
1889				else vars.isInFullScreen = false;
1890			}
1891			iL.repositionPhoto(true);
1892		},
1893
1894		closeAction: function() {
1895			var iL = this,
1896				vars = iL.vars,
1897				opts = iL.options;
1898
1899			$win.unbind('.iLightBox');
1900			$doc.off('.iLightBox');
1901
1902			if (vars.isInFullScreen) fullScreenApi.cancelFullScreen(document.documentElement);
1903
1904			$('.ilightbox-overlay, .ilightbox-holder, .ilightbox-thumbnails').off('.iLightBox');
1905
1906			if (opts.hide.effect) vars.overlay.stop().fadeOut(opts.hide.speed, function() {
1907				vars.overlay.remove();
1908				vars.BODY.removeClass('ilightbox-noscroll').off('.iLightBox');
1909			});
1910			else {
1911				vars.overlay.remove();
1912				vars.BODY.removeClass('ilightbox-noscroll').off('.iLightBox');
1913			}
1914
1915			var fadeOuts = [vars.toolbar, vars.holder, vars.nextPhoto, vars.prevPhoto, vars.nextButton, vars.prevButton, vars.loader, vars.thumbnails];
1916
1917			$.each(fadeOuts, function(i, element) {
1918				element.removeAttr('style').remove();
1919			});
1920
1921			vars.dontGenerateThumbs = vars.isInFullScreen = false;
1922
1923			window.iLightBox = null;
1924
1925			if (opts.linkId) {
1926				vars.hashLock = true;
1927				removeHash();
1928				setTimeout(function() {
1929					vars.hashLock = false;
1930				}, 55);
1931			}
1932
1933			//Trigger the onHide callback
1934			if (typeof opts.callback.onHide == 'function') opts.callback.onHide.call(iL, iL.ui);
1935		},
1936
1937		repositionPhoto: function() {
1938			var iL = this,
1939				vars = iL.vars,
1940				opts = iL.options,
1941				path = opts.path.toLowerCase(),
1942				viewport = getViewport(),
1943				winWidth = viewport.width,
1944				winHeight = viewport.height;
1945
1946			var thumbsOffsetW = (vars.isInFullScreen && opts.fullAlone || vars.isMobile) ? 0 : ((path == 'horizontal') ? 0 : vars.thumbnails.outerWidth()),
1947				thumbsOffsetH = vars.isMobile ? vars.toolbar.outerHeight() : ((vars.isInFullScreen && opts.fullAlone) ? 0 : ((path == 'horizontal') ? vars.thumbnails.outerHeight() : 0)),
1948				width = (vars.isInFullScreen && opts.fullAlone) ? winWidth : (winWidth - (opts.styles.pageOffsetX)),
1949				height = (vars.isInFullScreen && opts.fullAlone) ? winHeight : (winHeight - (opts.styles.pageOffsetY)),
1950				offsetW = (path == 'horizontal') ? parseInt((iL.items[vars.next] || iL.items[vars.prev]) ? ((opts.styles.nextOffsetX + opts.styles.prevOffsetX)) * 2 : (((width / 10) <= 30) ? 30 : (width / 10))) : parseInt(((width / 10) <= 30) ? 30 : (width / 10)) + thumbsOffsetW,
1951				offsetH = (path == 'horizontal') ? parseInt(((height / 10) <= 30) ? 30 : (height / 10)) + thumbsOffsetH : parseInt((iL.items[vars.next] || iL.items[vars.prev]) ? ((opts.styles.nextOffsetX + opts.styles.prevOffsetX)) * 2 : (((height / 10) <= 30) ? 30 : (height / 10)));
1952
1953			var elObject = {
1954				type: 'current',
1955				width: width,
1956				height: height,
1957				item: iL.items[vars.current],
1958				offsetW: offsetW,
1959				offsetH: offsetH,
1960				thumbsOffsetW: thumbsOffsetW,
1961				thumbsOffsetH: thumbsOffsetH,
1962				animate: arguments.length,
1963				holder: vars.holder
1964			};
1965
1966			iL.repositionEl(elObject);
1967
1968			if (iL.items[vars.next]) {
1969				elObject = $.extend(elObject, {
1970					type: 'next',
1971					item: iL.items[vars.next],
1972					offsetX: opts.styles.nextOffsetX,
1973					offsetY: opts.styles.nextOffsetY,
1974					holder: vars.nextPhoto
1975				});
1976
1977				iL.repositionEl(elObject);
1978			}
1979
1980			if (iL.items[vars.prev]) {
1981				elObject = $.extend(elObject, {
1982					type: 'prev',
1983					item: iL.items[vars.prev],
1984					offsetX: opts.styles.prevOffsetX,
1985					offsetY: opts.styles.prevOffsetY,
1986					holder: vars.prevPhoto
1987				});
1988
1989				iL.repositionEl(elObject);
1990			}
1991
1992			var loaderCss = (path == "horizontal") ? {
1993				left: parseInt((width / 2) - (vars.loader.outerWidth() / 2))
1994			} : {
1995				top: parseInt((height / 2) - (vars.loader.outerHeight() / 2))
1996			};
1997			vars.loader.css(loaderCss);
1998		},
1999
2000		repositionEl: function(obj) {
2001			var iL = this,
2002				vars = iL.vars,
2003				opts = iL.options,
2004				path = opts.path.toLowerCase(),
2005				widthAvail = (obj.type == 'current') ? ((vars.isInFullScreen && opts.fullAlone) ? obj.width : (obj.width - obj.offsetW)) : (obj.width - obj.offsetW),
2006				heightAvail = (obj.type == 'current') ? ((vars.isInFullScreen && opts.fullAlone) ? obj.height : (obj.height - obj.offsetH)) : (obj.height - obj.offsetH),
2007				itemParent = obj.item,
2008				item = obj.item.options,
2009				holder = obj.holder,
2010				offsetX = obj.offsetX || 0,
2011				offsetY = obj.offsetY || 0,
2012				thumbsOffsetW = obj.thumbsOffsetW,
2013				thumbsOffsetH = obj.thumbsOffsetH;
2014
2015			if (obj.type == 'current') {
2016				if (typeof item.width == 'number' && item.width) widthAvail = ((vars.isInFullScreen && opts.fullAlone) && (opts.fullStretchTypes.indexOf(itemParent.type) != -1 || item.fullViewPort || opts.fullViewPort)) ? widthAvail : ((item.width > widthAvail) ? widthAvail : item.width);
2017				if (typeof item.height == 'number' && item.height) heightAvail = ((vars.isInFullScreen && opts.fullAlone) && (opts.fullStretchTypes.indexOf(itemParent.type) != -1 || item.fullViewPort || opts.fullViewPort)) ? heightAvail : ((item.height > heightAvail) ? heightAvail : item.height);
2018			} else {
2019				if (typeof item.width == 'number' && item.width) widthAvail = (item.width > widthAvail) ? widthAvail : item.width;
2020				if (typeof item.height == 'number' && item.height) heightAvail = (item.height > heightAvail) ? heightAvail : item.height;
2021			}
2022
2023			if (opts.innerToolbar)
2024				heightAvail = parseInt(heightAvail - $('.ilightbox-inner-toolbar', holder).outerHeight());
2025
2026			var width = (typeof item.width == 'string' && item.width.indexOf('%') != -1) ? percentToValue(parseInt(item.width.replace('%', '')), obj.width) : holder.data('naturalWi
2026dth'),
2027				height = (typeof item.height == 'string' && item.height.indexOf('%') != -1) ? percentToValue(parseInt(item.height.replace('%', '')), obj.height) : holder.data('naturalHeight');
2028
2029			var dims = ((typeof item.width == 'string' && item.width.indexOf('%') != -1 || typeof item.height == 'string' && item.height.indexOf('%') != -1) ? {
2030					width: width,
2031					height: height
2032				} : iL.getNewDimenstions(widthAvail, heightAvail, width, height)),
2033				newDims = $.extend({}, dims, {});
2034
2035			if (obj.type == 'prev' || obj.type == 'next')
2036				width = parseInt(dims.width * ((obj.type == 'next') ? opts.styles.nextScale : opts.styles.prevScale)),
2037				height = parseInt(dims.height * ((obj.type == 'next') ? opts.styles.nextScale : opts.styles.prevScale));
2038			else
2039				width = dims.width,
2040				height = dims.height;
2041
2042			var widthDiff = parseInt((getPixel(holder, 'padding-left') + getPixel(holder, 'padding-right') + getPixel(holder, 'border-left-width') + getPixel(holder, 'border-right-width')) / 2),
2043				heightDiff = parseInt((getPixel(holder, 'padding-top') + getPixel(holder, 'padding-bottom') + getPixel(holder, 'border-top-width') + getPixel(holder, 'border-bottom-width') + ($('.ilightbox-inner-toolbar', holder).outerHeight() || 0)) / 2);
2044
2045			switch (obj.type) {
2046				case 'current':
2047					var top = parseInt((obj.height / 2) - (height / 2) - heightDiff - (thumbsOffsetH / 2)),
2048						left = parseInt((obj.width / 2) - (width / 2) - widthDiff - (thumbsOffsetW / 2));
2049					break;
2050
2051				case 'next':
2052					var top = (path == 'horizontal') ? parseInt((obj.height / 2) - offsetY - (height / 2) - heightDiff - (thumbsOffsetH / 2)) : parseInt(obj.height - offsetX - heightDiff - (thumbsOffsetH / 2)),
2053						left = (path == 'horizontal') ? parseInt(obj.width - offsetX - widthDiff - (thumbsOffsetW / 2)) : parseInt((obj.width / 2) - (width / 2) - widthDiff - offsetY - (thumbsOffsetW / 2));
2054					break;
2055
2056				case 'prev':
2057					var top = (path == 'horizontal') ? parseInt((obj.height / 2) - offsetY - (height / 2) - heightDiff - (thumbsOffsetH / 2)) : parseInt(offsetX - heightDiff - height - (thumbsOffsetH / 2)),
2058						left = (path == 'horizontal') ? parseInt(offsetX - widthDiff - width - (thumbsOffsetW / 2)) : parseInt((obj.width / 2) - offsetY - (width / 2) - widthDiff - (thumbsOffsetW / 2));
2059					break;
2060			}
2061
2062			holder.data('offset', {
2063				top: top,
2064				left: left,
2065				newDims: newDims,
2066				diff: {
2067					W: widthDiff,
2068					H: heightDiff
2069				},
2070				thumbsOffset: {
2071					W: thumbsOffsetW,
2072					H: thumbsOffsetH
2073				},
2074				object: obj
2075			});
2076
2077			if (obj.animate > 0 && opts.effects.reposition) {
2078				holder.css(transform, gpuAcceleration).stop().animate({
2079					top: top,
2080					left: left
2081				}, opts.effects.repositionSpeed, 'easeOutCirc', function() {
2082					holder.css(transform, '');
2083				});
2084				$('div.ilightbox-container', holder).stop().animate({
2085					width: width,
2086					height: height
2087				}, opts.effects.repositionSpeed, 'easeOutCirc');
2088				$('div.ilightbox-inner-toolbar', holder).stop().animate({
2089					width: width
2090				}, opts.effects.repositionSpeed, 'easeOutCirc', function() {
2091					$(this).css('overflow', 'visible');
2092				});
2093			} else {
2094				holder.css({
2095					top: top,
2096					left: left
2097				});
2098				$('div.ilightbox-container', holder).css({
2099					width: width,
2100					height: height
2101				});
2102				$('div.ilightbox-inner-toolbar', holder).css({
2103					width: width
2104				});
2105			}
2106		},
2107
2108		resume: function(priority) {
2109			var iL = this,
2110				vars = iL.vars,
2111				opts = iL.options;
2112
2113			if (!opts.slideshow.pauseTime || opts.controls.slideshow && vars.total <= 1 || priority < vars.isPaused) {
2114				return;
2115			}
2116
2117			vars.isPaused = 0;
2118
2119			if (vars.cycleID) {
2120				vars.cycleID = clearTimeout(vars.cycleID);
2121			}
2122
2123			vars.cycleID = setTimeout(function() {
2124				if (vars.current == vars.total - 1) iL.goTo(0);
2125				else iL.moveTo('next');
2126			}, opts.slideshow.pauseTime);
2127		},
2128
2129		pause: function(priority) {
2130			var iL = this,
2131				vars = iL.vars,
2132				opts = iL.options;
2133
2134			if (priority < vars.isPaused) {
2135				return;
2136			}
2137
2138			vars.isPaused = priority || 100;
2139
2140			if (vars.cycleID) {
2141				vars.cycleID = clearTimeout(vars.cycleID);
2142			}
2143		},
2144
2145		resetCycle: function() {
2146			var iL = this,
2147				vars = iL.vars,
2148				opts = iL.options;
2149
2150			if (opts.controls.slideshow && vars.cycleID && !vars.isPaused) {
2151				iL.resume();
2152			}
2153		},
2154
2155		getNewDimenstions: function(width, height, width_old, height_old, thumb) {
2156			var iL = this;
2157
2158			if (!width) factor = height / height_old;
2159			else if (!height) factor = width / width_old;
2160			else factor = min(width / width_old, height / height_old);
2161
2162			if (!thumb) {
2163				if (factor > iL.options.maxScale) factor = iL.options.maxScale;
2164				else if (factor < iL.options.minScale) factor = iL.options.minScale;
2165			}
2166
2167			var final_width = (iL.options.keepAspectRatio) ? round(width_old * factor) : width,
2168				final_height = (iL.options.keepAspectRatio) ? round(height_old * factor) : height;
2169
2170			return {
2171				width: final_width,
2172				height: final_height,
2173				ratio: factor
2174			};
2175		},
2176
2177		setOption: function(options) {
2178			var iL = this;
2179
2180			iL.options = $.extend(true, iL.options, options || {});
2181			iL.refresh();
2182		},
2183
2184		availPlugins: function() {
2185			var iL = this,
2186				testEl = document.createElement("video");
2187
2188			iL.plugins = {
2189				flash: !isMobile,
2190				quicktime: (parseInt(PluginDetect.getVersion("QuickTime")) >= 0) ? true : false,
2191				html5H264: !!(testEl.canPlayType && testEl.canPlayType('video/mp4').replace(/no/, '')),
2192				html5WebM: !!(testEl.canPlayType && testEl.canPlayType('video/webm').replace(/no/, '')),
2193				html5Vorbis: !!(testEl.canPlayType && testEl.canPlayType('video/ogg').replace(/no/, '')),
2194				html5QuickTime: !!(testEl.canPlayType && testEl.canPlayType('video/quicktime').replace(/no/, ''))
2195			};
2196		},
2197
2198		addContent: function(element, obj) {
2199			var iL = this,
2200				el;
2201
2202			switch (obj.type) {
2203				case 'video':
2204					var HTML5 = false,
2205						videoType = obj.videoType,
2206						html5video = obj.options.html5video;
2207
2208					if (((videoType == 'video/mp4' || obj.ext == 'mp4' || obj.ext == 'm4v') || html5video.h264) && iL.plugins.html5H264)
2209						obj.ext = 'mp4',
2210						obj.URL = html5video.h264 || obj.URL;
2211					else if (html5video.webm && iL.plugins.html5WebM)
2212						obj.ext = 'webm',
2213						obj.URL = html5video.webm || obj.URL;
2214					else if (html5video.ogg && iL.plugins.html5Vorbis)
2215						obj.ext = 'ogv',
2216						obj.URL = html5video.ogg || obj.URL;
2217
2218					if (iL.plugins.html5H264 && (videoType == 'video/mp4' || obj.ext == 'mp4' || obj.ext == 'm4v')) HTML5 = true, videoType = "video/mp4";
2219					else if (iL.plugins.html5WebM && (videoType == 'video/webm' || obj.ext == 'webm')) HTML5 = true, videoType = "video/webm";
2220					else if (iL.plugins.html5Vorbis && (videoType == 'video/ogg' || obj.ext == 'ogv')) HTML5 = true, videoType = "video/ogg";
2221					else if (iL.plugins.html5QuickTime && (videoType == 'video/quicktime' || obj.ext == 'mov' || obj.ext == 'qt')) HTML5 = true, videoType = "video/quicktime";
2222
2223					if (HTML5) {
2224						el = $('<video />', {
2225							"width": "100%",
2226							"height": "100%",
2227							"preload": html5video.preload,
2228							"autoplay": html5video.autoplay,
2229							"poster": html5video.poster,
2230							"controls": html5video.controls
2231						}).append($('<source />', {
2232							"src": obj.URL,
2233							"type": videoType
2234						}));
2235					} else {
2236						if (!iL.plugins.quicktime) el = $('<span />', {
2237							"class": "ilightbox-alert",
2238							html: iL.options.errors.missingPlugin.replace('{pluginspage}', pluginspages.quicktime).replace('{type}', 'QuickTime')
2239						});
2240						else {
2241
2242							el = $('<object />', {
2243								"type": "video/quicktime",
2244								"pluginspage": pluginspages.quicktime
2245							}).attr({
2246								"data": obj.URL,
2247								"width": "100%",
2248								"height": "100%"
2249							}).append($('<param />', {
2250								"name": "src",
2251								"value": obj.URL
2252							})).append($('<param />', {
2253								"name": "autoplay",
2254								"value": "false"
2255							})).append($('<param />', {
2256								"name": "loop",
2257								"value": "false"
2258							})).append($('<param />', {
2259								"name": "scale",
2260								"value": "tofit"
2261							}));
2262
2263							if (browser.msie) el = QT_GenerateOBJECTText(obj.URL, '100%', '100%', '', 'SCALE', 'tofit', 'AUTOPLAY', 'false', 'LOOP', 'false');
2264						}
2265					}
2266
2267					break;
2268
2269				case 'flash':
2270					if (!iL.plugins.flash) el = $('<span />', {
2271						"class": "ilightbox-alert",
2272						html: iL.options.errors.missingPlugin.replace('{pluginspage}', pluginspages.flash).replace('{type}', 'Adobe Flash player')
2273					});
2274					else {
2275						var flashvars = "",
2276							i = 0;
2277
2278						if (obj.options.flashvars) $.each(obj.options.flashvars, function(k, v) {
2279							if (i != 0) flashvars += "&";
2280							flashvars += k + "=" + encodeURIComponent(v);
2281							i++;
2282						});
2283						else flashvars = null;
2284
2285						el = $('<embed />').attr({
2286							"type": "application/x-shockwave-flash",
2287							"src": obj.URL,
2288							"width": (typeof obj.options.width == 'number' && obj.options.width && iL.options.minScale == '1' && iL.options.maxScale == '1') ? obj.options.width : "100%",
2289							"height": (typeof obj.options.height == 'number' && obj.options.height && iL.options.minScale == '1' && iL.options.maxScale == '1') ? obj.options.height : "100%",
2290							"quality": "high",
2291							"bgcolor": "#000000",
2292							"play": "true",
2293							"loop": "true",
2294							"menu": "true",
2295							"wmode": "transparent",
2296							"scale": "showall",
2297							"allowScriptAccess": "always",
2298							"allowFullScreen": "true",
2299							"flashvars": flashvars,
2300							"fullscreen": "yes"
2301						});
2302					}
2303
2304					break;
2305
2306				case 'iframe':
2307					el = $('<iframe />').attr({
2308						"width": (typeof obj.options.width == 'number' && obj.options.width && iL.options.minScale == '1' && iL.options.maxScale == '1') ? obj.options.width : "100%",
2309						"height": (typeof obj.options.height == 'number' && obj.options.height && iL.options.minScale == '1' && iL.options.maxScale == '1') ? obj.options.height : "100%",
2310						src: obj.URL,
2311						frameborder: 0,
2312						'hspace': 0,
2313						'vspace': 0,
2314						'scrolling': supportTouch ? 'auto' : 'scroll',
2315						'webkitAllowFullScreen': '',
2316						'mozallowfullscreen': '',
2317						'allowFullScreen': ''
2318					});
2319
2320					break;
2321
2322				case 'inline':
2323					el = $('<div class="ilightbox-wrapper"></div>').html($(obj.URL).clone(true));
2324
2325					break;
2326
2327				case 'html':
2328					var object = obj.URL,
2329						el;
2330
2331					if (object[0].nodeName) {
2332						el = $('<div class="ilightbox-wrapper"></div>').html(object);
2333					} else {
2334						var dom = $(obj.URL),
2335							html = (dom.selector) ? $('<div>' + dom + '</div>') : dom;
2336						el = $('<div class="ilightbox-wrapper"></div>').html(html);
2337					}
2338
2339					break;
2340			}
2341
2342			$('div.ilightbox-container', element).empty().html(el);
2343
2344			// For fixing Chrome about just playing the video for first time
2345			if (el[0].tagName.toLowerCase() === 'video' && browser.webkit) setTimeout(function() {
2346				var src = el[0].currentSrc + '?' + floor(random() * 30000);
2347				el[0].currentSrc = src;
2348				el[0].src = src;
2349			});
2350
2351			return el;
2352		},
2353
2354		ogpRecognition: function(obj, callback) {
2355			var iL = this,
2356				url = obj.URL;
2357
2358			iL.showLoader();
2359			doAjax(url, function(data) {
2360				iL.hideLoader();
2361				if (data) {
2362					var object = new Object();
2363
2364					object.length = false,
2365					object.url = data.url;
2366
2367					if (data.status == 200) {
2368						var result = data.results,
2369							type = result.type,
2370							source = result.source;
2371
2372						object.source = source.src,
2373						object.width = source.width && parseInt(source.width) || 0,
2374						object.height = source.height && parseInt(source.height) || 0,
2375						object.type = type,
2376						object.thumbnail = source.thumbnail || result.images && result.images[0],
2377						object.html5video = result.html5video || {},
2378						object.length = true;
2379
2380						if (source.type == 'application/x-shockwave-flash') object.type = "flash";
2381						else if (source.type.indexOf("video/") != -1) object.type = "video";
2382						else if (source.type.indexOf("/html") != -1) object.type = "iframe";
2383						else if (source.type.indexOf("image/") != -1) object.type = "image";
2384
2385					} else if (typeof data.response != 'undefined')
2386						throw data.response;
2387
2388					callback.call(this, object.length ? object : false);
2389				}
2390			});
2391		},
2392
2393		hashChangeHandler: function(url) {
2394			var iL = this,
2395				vars = iL.vars,
2396				opts = iL.options,
2397				URL = url || window.location.href,
2398				hash = parseURI(URL).hash,
2399				split = hash.split('/'),
2400				index = split[1];
2401
2402			if (vars.hashLock || ('#' + opts.linkId != split[0] && hash.length > 1)) return;
2403
2404			if (index) {
2405				var target = split[1] || 0;
2406				if (iL.items[target]) {
2407					var overlay = $('.ilightbox-overlay');
2408					if (overlay.length && overlay.attr('linkid') == opts.linkId) {
2409						iL.goTo(target);
2410					} else {
2411						iL.itemsObject[target].trigger(supportTouch ? 'itap' : 'click');
2412					}
2413				} else {
2414					var overlay = $('.ilightbox-overlay');
2415					if (overlay.length) iL.closeAction();
2416				}
2417			} else {
2418				var overlay = $('.ilightbox-overlay');
2419				if (overlay.length) iL.closeAction();
2420			}
2421		}
2422	};
2423
2424	/**
2425	 * Parse style to pixels.
2426	 *
2427	 * @param {Object}   $element   jQuery object with element.
2428	 * @param {Property} property   CSS property to get the pixels from.
2429	 *
2430	 * @return {Int}
2431	 */
2432	function getPixel($element, property) {
2433		return parseInt($element.css(property), 10) || 0;
2434	}
2435
2436	/**
2437	 * Make sure that number is within the limits.
2438	 *
2439	 * @param {Number} number
2440	 * @param {Number} min
2441	 * @param {Number} max
2442	 *
2443	 * @return {Number}
2444	 */
2445	function within(number, min, max) {
2446		return number < min ? min : number > max ? max : number;
2447	}
2448
2449	/**
2450	 * Get viewport/window size (width and height).
2451	 *
2452	 * @return {Object}
2453	 */
2454	function getViewport() {
2455		var e = window,
2456			a = 'inner';
2457		if (!('innerWidth' in window)) {
2458			a = 'client';
2459			e = document.documentElement || document.body;
2460		}
2461		return {
2462			width: e[a + 'Width'],
2463			height: e[a + 'Height']
2464		}
2465	}
2466
2467	/**
2468	 * Remove hash tag from the URL
2469	 *
2470	 * @return {Void}
2471	 */
2472	function removeHash() {
2473		var scroll = getScrollXY();
2474
2475		window.location.hash = "";
2476
2477		// Restore the scroll offset, should be flicker free
2478		window.scrollTo(scroll.x, scroll.y);
2479	}
2480
2481	/**
2482	 * Do the ajax requests with callback.
2483	 *
2484	 * @param {String}   url
2485	 * @param {Function} callback
2486	 *
2487	 * @return {Void}
2488	 */
2489	function doAjax(url, callback) {
2490		var url = "//ilightbox.net/getSource/jsonp.php?url=" + encodeURIComponent(url).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A');
2491		$.ajax({
2492			url: url,
2493			dataType: 'jsonp'
2494		});
2495
2496		iLCallback = function(data) {
2497			callback.call(this, data);
2498		};
2499	}
2500
2501	/**
2502	 * Find image from DOM elements
2503	 *
2504	 * @param {Element} element
2505	 *
2506	 * @return {Void}
2507	 */
2508	function findImageInElement(element) {
2509		var elements = $('*', element),
2510			imagesArr = new Array();
2511
2512		elements.each(function() {
2513			var url = "",
2514				element = this;
2515
2516			if ($(element).css("background-image") != "none") {
2517				url = $(element).css("background-image");
2518			} else if (typeof($(element).attr("src")) != "undefined" && element.nodeName.toLowerCase() == "img") {
2519				url = $(element).attr("src");
2520			}
2521
2522			if (url.indexOf("gradient") == -1) {
2523				url = url.replace(/url\(\"/g, "");
2524				url = url.replace(/url\(/g, "");
2525				url = url.replace(/\"\)/g, "");
2526				url = url.replace(/\)/g, "");
2527
2528				var urls = url.split(",");
2529
2530				for (var i = 0; i < urls.length; i++) {
2531					if (urls[i].length > 0 && $.inArray(urls[i], imagesArr) == -1) {
2532						var extra = "";
2533						if (browser.msie && browser.version < 9) {
2534							extra = "?" + floor(random() * 3000);
2535						}
2536						imagesArr.push(urls[i] + extra);
2537					}
2538				}
2539			}
2540		});
2541
2542		return imagesArr;
2543	}
2544
2545	/**
2546	 * Get file extension.
2547	 *
2548	 * @param {String} URL
2549	 *
2550	 * @return {String}
2551	 */
2552	function getExtension(URL) {
2553		var ext = URL.split('.').pop().toLowerCase(),
2554			extra = ext.indexOf('?') !== -1 ? ext.split('?').pop() : '';
2555
2556		return ext.replace(extra, '');
2557	}
2558
2559	/**
2560	 * Get type via extension.
2561	 *
2562	 * @param {String} URL
2563	 *
2564	 * @return {String}
2565	 */
2566	function getTypeByExtension(URL) {
2567		var type,
2568			ext = getExtension(URL);
2569
2570		if (extensions.image.indexOf(ext) !== -1) type = 'image';
2571		else if (extensions.flash.indexOf(ext) !== -1) type = 'flash';
2572		else if (extensions.video.indexOf(ext) !== -1) type = 'video';
2573		else type = 'iframe';
2574
2575		return type;
2576	}
2577
2578	/**
2579	 * Return value from percent of a number.
2580	 *
2581	 * @param {Number} percent
2582	 * @param {Number} total
2583	 *
2584	 * @return {Number}
2585	 */
2586	function percentToValue(percent, total) {
2587		return parseInt((total / 100) * percent);
2588	}
2589
2590	/**
2591	 * A JavaScript equivalent of PHP’s parse_url.
2592	 *
2593	 * @param {String} url           The URL to parse.
2594	 *
2595	 * @return {Mixed}
2596	 */
2597	function parseURI(url) {
2598		var m = String(url).replace(/^\s+|\s+$/g, '').match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
2599		// authority = '//' + user + ':' + pass '@' + hostname + ':' port
2600		return (m ? {
2601			href: m[0] || '',
2602			protocol: m[1] || '',
2603			authority: m[2] || '',
2604			host: m[3] || '',
2605			hostname: m[4] || '',
2606			port: m[5] || '',
2607			pathname: m[6] || '',
2608			search: m[7] || '',
2609			hash: m[8] || ''
2610		} : null);
2611	}
2612
2613	/**
2614	 * Gets the absolute URI.
2615	 *
2616	 * @param {String} href     The relative URL.
2617	 * @param {String} base     The base URL.
2618	 *
2619	 * @return {String}         The absolute URL.
2620	 */
2621	function absolutizeURI(base, href) { // RFC 3986
2622		var iL = this;
2623
2624		function removeDotSegments(input) {
2625			var output = [];
2626			input.replace(/^(\.\.?(\/|$))+/, '')
2627				.replace(/\/(\.(\/|$))+/g, '/')
2628				.replace(/\/\.\.$/, '/../')
2629				.replace(/\/?[^\/]*/g, function(p) {
2630					if (p === '/..') {
2631						output.pop();
2632					} else {
2633						output.push(p);
2634					}
2635				});
2636			return output.join('').replace(/^\//, input.charAt(0) === '/' ? '/' : '');
2637		}
2638
2639		href = parseURI(href || '');
2640		base = parseURI(base || '');
2641
2642		return !href || !base ? null : (href.protocol || base.protocol) +
2643			(href.protocol || href.authority ? href.authority : base.authority) +
2644			removeDotSegments(href.protocol || href.authority || href.pathname.charAt(0) === '/' ? href.pathname : (href.pathname ? ((base.authority && !base.pathname ? '/' : '') + base.pathname.slice(0, base.pathname.lastIndexOf('/') + 1) + href.pathname) : base.pathname)) +
2645			(href.protocol || href.authority || href.pathname ? href.search : (href.search || base.search)) +
2646			href.hash;
2647	}
2648
2649	/**
2650	 * A JavaScript equivalent of PHP’s version_compare.
2651	 *
2652	 * @param {String} v1
2653	 * @param {String} v2
2654	 * @param {String} operator
2655	 *
2656	 * @return {Boolean}
2657	 */
2658	function version_compare(v1, v2, operator) {
2659		this.php_js = this.php_js || {};
2660		this.php_js.ENV = this.php_js.ENV || {};
2661		var i = 0,
2662			x = 0,
2663			compare = 0,
2664			vm = {
2665				'dev': -6,
2666				'alpha': -5,
2667				'a': -5,
2668				'beta': -4,
2669				'b': -4,
2670				'RC': -3,
2671				'rc': -3,
2672				'#': -2,
2673				'p': 1,
2674				'pl': 1
2675			},
2676			prepVersion = function(v) {
2677				v = ('' + v).replace(/[_\-+]/g, '.');
2678				v = v.replace(/([^.\d]+)/g, '.$1.').replace(/\.{2,}/g, '.');
2679				return (!v.length ? [-8] : v.split('.'));
2680			},
2681			numVersion = function(v) {
2682				return !v ? 0 : (isNaN(v) ? vm[v] || -7 : parseInt(v, 10));
2683			};
2684		v1 = prepVersion(v1);
2685		v2 = prepVersion(v2);
2686		x = max(v1.length, v2.length);
2687		for (i = 0; i < x; i++) {
2688			if (v1[i] == v2[i]) {
2689				continue;
2690			}
2691			v1[i] = numVersion(v1[i]);
2692			v2[i] = numVersion(v2[i]);
2693			if (v1[i] < v2[i]) {
2694				compare = -1;
2695				break;
2696			} else if (v1[i] > v2[i]) {
2697				compare = 1;
2698				break;
2699			}
2700		}
2701		if (!operator) {
2702			return compare;
2703		}
2704
2705		switch (operator) {
2706			case '>':
2707			case 'gt':
2708				return (compare > 0);
2709			case '>=':
2710			case 'ge':
2711				return (compare >= 0);
2712			case '<=':
2713			case 'le':
2714				return (compare <= 0);
2715			case '==':
2716			case '=':
2717			case 'eq':
2718				return (compare === 0);
2719			case '<>':
2720			case '!=':
2721			case 'ne':
2722				return (compare !== 0);
2723			case '':
2724			case '<':
2725			case 'lt':
2726				return (compare < 0);
2727			default:
2728				return null;
2729		}
2730	}
2731
2732
2733	// Begin the iLightBox plugin
2734	$.fn.iLightBox = function() {
2735
2736		var args = arguments,
2737			opt = ($.isPlainObject(args[0])) ? args[0] : args[1],
2738			items = ($.isArray(args[0]) || typeof args[0] == 'string') ? args[0] : args[1];
2739
2740		if (!opt) opt = {};
2741
2742		// Default options. Play carefully.
2743		var options = $.extend(true, {
2744			attr: 'href',
2745			path: 'vertical',
2746			skin: 'dark',
2747			linkId: false,
2748			infinite: false,
2749			startFrom: 0,
2750			randomStart: false,
2751			keepAspectRatio: true,
2752			maxScale: 1,
2753			minScale: .2,
2754			innerToolbar: false,
2755			smartRecognition: false,
2756			mobileOptimizer: true,
2757			fullAlone: true,
2758			fullViewPort: null,
2759			fullStretchTypes: 'flash, video',
2760			overlay: {
2761				blur: true,
2762				opacity: .85
2763			},
2764			controls: {
2765				arrows: false,
2766				slideshow: false,
2767				toolbar: true,
2768				fullscreen: true,
2769				thumbnail: true,
2770				keyboard: true,
2771				mousewheel: true,
2772				swipe: true
2773			},
2774			keyboard: {
2775				left: true, // previous
2776				right: true, // next
2777				up: true, // previous
2778				down: true, // next
2779				esc: true, // close
2780				shift_enter: true // fullscreen
2781			},
2782			show: {
2783				effect: true,
2784				speed: 300,
2785				title: true
2786			},
2787			hide: {
2788				effect: true,
2789				speed: 300
2790			},
2791			caption: {
2792				start: true,
2793				show: 'mouseenter',
2794				hide: 'mouseleave'
2795			},
2796			social: {
2797				start: true,
2798				show: 'mouseenter',
2799				hide: 'mouseleave',
2800				buttons: false
2801			},
2802			styles: {
2803				pageOffsetX: 0,
2804				pageOffsetY: 0,
2805				nextOffsetX: 45,
2806				nextOffsetY: 0,
2807				nextOpacity: 1,
2808				nextScale: 1,
2809				prevOffsetX: 45,
2810				prevOffsetY: 0,
2811				prevOpacity: 1,
2812				prevScale: 1
2813			},
2814			thumbnails: {
2815				maxWidth: 120,
2816				maxHeight: 80,
2817				normalOpacity: 1,
2818				activeOpacity: .6
2819			},
2820			effects: {
2821				reposition: true,
2822				repositionSpeed: 200,
2823				switchSpeed: 500,
2824				loadedFadeSpeed: 180,
2825				fadeSpeed: 200
2826			},
2827			slideshow: {
2828				pauseTime: 5000,
2829				pauseOnHover: false,
2830				startPaused: true
2831			},
2832			text: {
2833				close: "Press Esc to close",
2834				enterFullscreen: "Enter Fullscreen (Shift+Enter)",
2835				exitFullscreen: "Exit Fullscreen (Shift+Enter)",
2836				slideShow: "Slideshow",
2837				next: "Next",
2838				previous: "Previous"
2839			},
2840			errors: {
2841				loadImage: "An error occurred when trying to load photo.",
2842				loadContents: "An error occurred when trying to load contents.",
2843				missingPlugin: "The content your are attempting to view requires the <a href='{pluginspage}' target='_blank'>{type} plugin<\/a>."
2844			},
2845			ajaxSetup: {
2846				url: '',
2847				beforeSend: function(jqXHR, settings) {},
2848				cache: false,
2849				complete: function(jqXHR, textStatus) {},
2850				crossDomain: false,
2851				error: function(jqXHR, textStatus, errorThrown) {},
2852				success: function(data, textStatus, jqXHR) {},
2853				global: true,
2854				ifModified: false,
2855				username: null,
2856				password: null,
2857				type: 'GET'
2858			},
2859			callback: {}
2860		}, opt);
2861
2862		var instant = ($.isArray(items) || typeof items == 'string') ? true : false;
2863
2864		items = $.isArray(items) ? items : new Array();
2865
2866		if (typeof args[0] == 'string') items[0] = args[0];
2867
2868		if (version_compare($.fn.jquery, '1.8', '>=')) {
2869			var iLB = new iLightBox($(this), options, items, instant);
2870			return {
2871				close: function() {
2872					iLB.closeAction();
2873				},
2874				fullscreen: function() {
2875					iLB.fullScreenAction();
2876				},
2877				moveNext: function() {
2878					iLB.moveTo('next');
2879				},
2880				movePrev: function() {
2881					iLB.moveTo('prev');
2882				},
2883				goTo: function(index) {
2884					iLB.goTo(index);
2885				},
2886				refresh: function() {
2887					iLB.refresh();
2888				},
2889				reposition: function() {
2890					(arguments.length > 0) ? iLB.repositionPhoto(true): iLB.repositionPhoto();
2891				},
2892				setOption: function(options) {
2893					iLB.setOption(options);
2894				},
2895				destroy: function() {
2896					iLB.closeAction();
2897					iLB.dispatchItemsEvents();
2898				}
2899			};
2900		} else {
2901			throw "The jQuery version that was loaded is too old. iLightBox requires jQuery 1.8+";
2902		}
2903
2904	};
2905
2906
2907	$.iLightBox = function() {
2908		return $.fn.iLightBox(arguments[0], arguments[1]);
2909	};
2910
2911
2912	$.extend($.easing, {
2913		easeInCirc: function(x, t, b, c, d) {
2914			return -c * (sqrt(1 - (t /= d) * t) - 1) + b;
2915		},
2916		easeOutCirc: function(x, t, b, c, d) {
2917			return c * sqrt(1 - (t = t / d - 1) * t) + b;
2918		},
2919		easeInOutCirc: function(x, t, b, c, d) {
2920			if ((t /= d / 2) < 1) return -c / 2 * (sqrt(1 - t * t) - 1) + b;
2921			return c / 2 * (sqrt(1 - (t -= 2) * t) + 1) + b;
2922		}
2923	});
2924
2925	function getScrollXY() {
2926		var scrOfX = 0,
2927			scrOfY = 0;
2928		if (typeof(window.pageYOffset) == 'number') {
2929			//Netscape compliant
2930			scrOfY = window.pageYOffset;
2931			scrOfX = window.pageXOffset;
2932		} else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) {
2933			//DOM compliant
2934			scrOfY = document.body.scrollTop;
2935			scrOfX = document.body.scrollLeft;
2936		} else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
2937			//IE6 standards compliant mode
2938			scrOfY = document.documentElement.scrollTop;
2939			scrOfX = document.documentElement.scrollLeft;
2940		}
2941		return {
2942			x: scrOfX,
2943			y: scrOfY
2944		};
2945	}
2946
2947	(function() {
2948		// add new event shortcuts
2949		$.each(("touchstart touchmove touchend " +
2950			"tap taphold " +
2951			"swipe swipeleft swiperight " +
2952			"scrollstart scrollstop").split(" "), function(i, name) {
2953
2954			$.fn[name] = function(fn) {
2955				return fn ? this.bind(name, fn) : this.trigger(name);
2956			};
2957
2958			// jQuery < 1.8
2959			if ($.attrFn) {
2960				$.attrFn[name] = true;
2961			}
2962		});
2963
2964		var tapSettings = {
2965			startEvent: 'touchstart.iTap',
2966			endEvent: 'touchend.iTap'
2967		};
2968
2969		// tap Event:
2970		$.event.special.itap = {
2971			setup: function() {
2972
2973				var self = this,
2974					$self = $(this),
2975					start, stop;
2976
2977				$self.bind(tapSettings.startEvent, function(event) {
2978					start = getScrollXY();
2979
2980					$self.one(tapSettings.endEvent, function(event) {
2981						stop = getScrollXY();
2982
2983						var orgEvent = event || window.event;
2984						event = $.event.fix(orgEvent);
2985						event.type = "itap";
2986
2987						if ((start && stop) && (start.x == stop.x && start.y == stop.y))($.event.dispatch || $.event.handle).call(self, event);
2988
2989						start = stop = undefined;
2990					});
2991				});
2992			},
2993
2994			teardown: function() {
2995				$(this).unbind(tapSettings.startEvent);
2996			}
2997		};
2998	}());
2999
3000
3001	//Fullscreen API
3002	(function() {
3003		fullScreenApi = {
3004				supportsFullScreen: false,
3005				isFullScreen: function() {
3006					return false;
3007				},
3008				requestFullScreen: function() {},
3009				cancelFullScreen: function() {},
3010				fullScreenEventName: '',
3011				prefix: ''
3012			},
3013			browserPrefixes = 'webkit moz o ms khtml'.split(' ');
3014
3015		// check for native support
3016		if (typeof document.cancelFullScreen != 'undefined') {
3017			fullScreenApi.supportsFullScreen = true;
3018		} else {
3019			// check for fullscreen support by vendor prefix
3020			for (var i = 0, il = browserPrefixes.length; i < il; i++) {
3021				fullScreenApi.prefix = browserPrefixes[i];
3022
3023				if (typeof document[fullScreenApi.prefix + 'CancelFullScreen'] != 'undefined') {
3024					fullScreenApi.supportsFullScreen = true;
3025
3026					break;
3027				}
3028			}
3029		}
3030
3031		// update methods to do something useful
3032		if (fullScreenApi.supportsFullScreen) {
3033			fullScreenApi.fullScreenEventName = fullScreenApi.prefix + 'fullscreenchange';
3034
3035			fullScreenApi.isFullScreen = function() {
3036				switch (this.prefix) {
3037					case '':
3038						return document.fullScreen;
3039					case 'webkit':
3040						return document.webkitIsFullScreen;
3041					default:
3042						return document[this.prefix + 'FullScreen'];
3043				}
3044			}
3045			fullScreenApi.requestFullScreen = function(el) {
3046				return (this.prefix === '') ? el.requestFullScreen() : el[this.prefix + 'RequestFullScreen']();
3047			}
3048			fullScreenApi.cancelFullScreen = function(el) {
3049				return (this.prefix === '') ? document.cancelFullScreen() : document[this.prefix + 'CancelFullScreen']();
3050			}
3051		}
3052	}());
3053
3054	// Browser detect
3055	(function() {
3056		function uaMatch(ua) {
3057			ua = ua.toLowerCase();
3058
3059			var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
3060				/(webkit)[ \/]([\w.]+)/.exec(ua) ||
3061				/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
3062				/(msie) ([\w.]+)/.exec(ua) ||
3063				ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || [];
3064
3065			return {
3066				browser: match[1] || "",
3067				version: match[2] || "0"
3068			};
3069		}
3070
3071		var matched = uaMatch(navigator.userAgent);
3072		browser = {};
3073
3074		if (matched.browser) {
3075			browser[matched.browser] = true;
3076			browser.version = matched.version;
3077		}
3078
3079		// Chrome is Webkit, but Webkit is also Safari.
3080		if (browser.chrome) {
3081			browser.webkit = true;
3082		} else if (browser.webkit) {
3083			browser.safari = true;
3084		}
3085	}());
3086
3087	// Feature detects
3088	(function() {
3089		var prefixes = ['', 'webkit', 'moz', 'ms', 'o'];
3090		var el = document.createElement('div');
3091
3092		function testProp(prop) {
3093			for (var p = 0, pl = prefixes.length; p < pl; p++) {
3094				var prefixedProp = prefixes[p] ? prefixes[p] + prop.charAt(0).toUpperCase() + prop.slice(1) : prop;
3095				if (el.style[prefixedProp] !== undefined) {
3096					return prefixedProp;
3097				}
3098			}
3099		}
3100
3101		// Global support indicators
3102		transform = testProp('transform') || '';
3103		gpuAcceleration = testProp('perspective') ? 'translateZ(0) ' : '';
3104	}());
3105
3106
3107	/*
3108		PluginDetect v0.7.9
3109		www.pinlady.net/PluginDetect/license/
3110		[ getVersion onWindowLoaded BetterIE ]
3111		[ Flash QuickTime Shockwave ]
3112	*/
3113	var PluginDetect={version:"0.7.9",name:"PluginDetect",handler:function(c,b,a){return function(){c(b,a)}},openTag:"<",isDefined:function(b){return typeof b!="undefined"},isArray:function(b){return(/array/i).test(Object.prototype.toString.call(b))},isFunc:function(b){return typeof b=="function"},isString:function(b){return typeof b=="string"},isNum:function(b){return typeof b=="number"},isStrNum:function(b){return(typeof b=="string"&&(/\d/).test(b))},getNumRegx:/[\d][\d\.\_,-]*/,splitNumRegx:/[\.\_,-]/g,getNum:function(b,c){var d=this,a=d.isStrNum(b)?(d.isDefined(c)?new RegExp(c):d.getNumRegx).exec(b):null;return a?a[0]:null},compareNums:function(h,f,d){var e=this,c,b,a,g=parseInt;if(e.isStrNum(h)&&e.isStrNum(f)){if(e.isDefined(d)&&d.compareNums){return d.compareNums(h,f)}c=h.split(e.splitNumRegx);b=f.split(e.splitNumRegx);for(a=0;a<min(c.length,b.length);a++){if(g(c[a],10)>g(b[a],10)){return 1}if(g(c[a],10)<g(b[a],10)){return -1}}}return 0},formatNum:function(b,c){var d=this,a,e;if(!d.isStrNum(b)){return null}if(!d.isNum(c)){c=4}c--;e=b.replace(/\s/g,"").split(d.splitNumRegx).concat(["0","0","0","0"]);for(a=0;a<4;
3113a++){if(/^(0+)(.+)$/.test(e[a])){e[a]=RegExp.$2}if(a>c||!(/\d/).test(e[a])){e[a]="0"}}return e.slice(0,4).join(",")},$$hasMimeType:function(a){return function(c){if(!a.isIE&&c){var f,e,b,d=a.isArray(c)?c:(a.isString(c)?[c]:[]);for(b=0;b<d.length;b++){if(a.isString(d[b])&&/[^\s]/.test(d[b])){f=navigator.mimeTypes[d[b]];e=f?f.enabledPlugin:0;if(e&&(e.name||e.description)){return f}}}}return null}},findNavPlugin:function(l,e,c){var j=this,h=new RegExp(l,"i"),d=(!j.isDefined(e)||e)?/\d/:0,k=c?new RegExp(c,"i"):0,a=navigator.plugins,g="",f,b,m;for(f=0;f<a.length;f++){m=a[f].description||g;b=a[f].name||g;if((h.test(m)&&(!d||d.test(RegExp.leftContext+RegExp.rightContext)))||(h.test(b)&&(!d||d.test(RegExp.leftContext+RegExp.rightContext)))){if(!k||!(k.test(m)||k.test(b))){return a[f]}}}return null},getMimeEnabledPlugin:function(k,m,c){var e=this,f,b=new RegExp(m,"i"),h="",g=c?new RegExp(c,"i"):0,a,l,d,j=e.isString(k)?[k]:k;for(d=0;d<j.length;d++){if((f=e.hasMimeType(j[d]))&&(f=f.enabledPlugin)){l=f.description||h;a=f.name||h;if(b.test(l)||b.test(a)){if(!g||!(g.test(l)||g.test(a))){return f}}}}return 0},getPluginFileVersion:function(f,b){var h=this,e,d,g,a,c=-1;if(h.OS>2||!f||!f.version||!(e=h.getNum(f.version))){return b}if(!b){return e}e=h.formatNum(e);b=h.formatNum(b);d=b.split(h.splitNumRegx);g=e.split(h.splitNumRegx);for(a=0;a<d.length;a++){if(c>-1&&a>c&&d[a]!="0"){return b}if(g[a]!=d[a]){if(c==-1){c=a}if(d[a]!="0"){return b}}}return e},AXO:window.ActiveXObject,getAXO:function(a){var f=null,d,b=this,c={};try{f=new b.AXO(a)}catch(d){}return f},convertFuncs:function(f){var a,g,d,b=/^[\$][\$]/,c=this;for(a in f){if(b.test(a)){try{g=a.slice(2);if(g.length>0&&!f[g]){f[g]=f[a](f);delete f[a]}}catch(d){}}}},initObj:function(e,b,d){var a,c;if(e){if(e[b[0]]==1||d){for(a=0;a<b.length;a=a+2){e[b[a]]=b[a+1]}}for(a in e){c=e[a];if(c&&c[b[0]]==1){this.initObj(c,b)}}}},initScript:function(){var d=this,a=navigator,h,i=document,l=a.userAgent||"",j=a.vendor||"",b=a.platform||"",k=a.product||"";d.initObj(d,["$",d]);for(h in d.Plugins){if(d.Plugins[h]){d.initObj(d.Plugins[h],["$",d,"$$",d.Plugins[h]],1)}}d.convertFuncs(d);d.OS=100;if(b){var g=["Win",1,"Mac",2,"Linux",3,"FreeBSD",4,"iPhone",21.1,"iPod",21.2,"iPad",21.3,"Win.*CE",22.1,"Win.*Mobile",22.2,"Pocket\\s*PC",22.3,"",100];for(h=g.length-2;h>=0;h=h-2){if(g[h]&&new RegExp(g[h],"i").test(b)){d.OS=g[h+1];break}}};d.head=i.getElementsByTagName("head")[0]||i.getElementsByTagName("body")[0]||i.body||null;d.isIE=new Function("return/*@cc_on!@*/!1")();d.verIE=d.isIE&&(/MSIE\s*(\d+\.?\d*)/i).test(l)?parseFloat(RegExp.$1,10):null;d.verIEfull=null;d.docModeIE=null;if(d.isIE){var f,n,c=document.createElement("div");try{c.style.behavior="url(#default#clientcaps)";d.verIEfull=(c.getComponentVersion("{89820200-ECBD-11CF-8B85-00AA005B4383}","componentid")).replace(/,/g,".")}catch(f){}n=parseFloat(d.verIEfull||"0",10);d.docModeIE=i.documentMode||((/back/i).test(i.compatMode||"")?5:n)||d.verIE;d.verIE=n||d.docModeIE};d.ActiveXEnabled=false;if(d.isIE){var h,m=["Msxml2.XMLHTTP","Msxml2.DOMDocument","Microsoft.XMLDOM","ShockwaveFlash.ShockwaveFlash","TDCCtl.TDCCtl","Shell.UIHelper","Scripting.Dictionary","wmplayer.ocx"];for(h=0;h<m.length;h++){if(d.getAXO(m[h])){d.ActiveXEnabled=true;break}}};d.isGecko=(/Gecko/i).test(k)&&(/Gecko\s*\/\s*\d/i).test(l);
3113d.verGecko=d.isGecko?d.formatNum((/rv\s*\:\s*([\.\,\d]+)/i).test(l)?RegExp.$1:"0.9"):null;d.isChrome=(/Chrome\s*\/\s*(\d[\d\.]*)/i).test(l);d.verChrome=d.isChrome?d.formatNum(RegExp.$1):null;d.isSafari=((/Apple/i).test(j)||(!j&&!d.isChrome))&&(/Safari\s*\/\s*(\d[\d\.]*)/i).test(l);d.verSafari=d.isSafari&&(/Version\s*\/\s*(\d[\d\.]*)/i).test(l)?d.formatNum(RegExp.$1):null;d.isOpera=(/Opera\s*[\/]?\s*(\d+\.?\d*)/i).test(l);d.verOpera=d.isOpera&&((/Version\s*\/\s*(\d+\.?\d*)/i).test(l)||1)?parseFloat(RegExp.$1,10):null;d.addWinEvent("load",d.handler(d.runWLfuncs,d))},init:function(d){var c=this,b,d,a={status:-3,plugin:0};if(!c.isString(d)){return a}if(d.length==1){c.getVersionDelimiter=d;return a}d=d.toLowerCase().replace(/\s/g,"");b=c.Plugins[d];if(!b||!b.getVersion){return a}a.plugin=b;if(!c.isDefined(b.installed)){b.installed=null;b.version=null;b.version0=null;b.getVersionDone=null;b.pluginName=d}c.garbage=false;if(c.isIE&&!c.ActiveXEnabled&&d!=="java"){a.status=-2;return a}a.status=1;return a},fPush:function(b,a){var c=this;if(c.isArray(a)&&(c.isFunc(b)||(c.isArray(b)&&b.length>0&&c.isFunc(b[0])))){a.push(b)}},callArray:function(b){var c=this,a;if(c.isArray(b)){for(a=0;a<b.length;a++){if(b[a]===null){return}c.call(b[a]);b[a]=null}}},call:function(c){var b=this,a=b.isArray(c)?c.length:-1;if(a>0&&b.isFunc(c[0])){c[0](b,a>1?c[1]:0,a>2?c[2]:0,a>3?c[3]:0)}else{if(b.isFunc(c)){c(b)}}},getVersionDelimiter:",",$$getVersion:function(a){return function(g,d,c){var e=a.init(g),f,b,h={};if(e.status<0){return null};f=e.plugin;if(f.getVersionDone!=1){f.getVersion(null,d,c);if(f.getVersionDone===null){f.getVersionDone=1}}a.cleanup();b=(f.version||f.version0);b=b?b.replace(a.splitNumRegx,a.getVersionDelimiter):b;return b}},cleanup:function(){var a=this;if(a.garbage&&a.isDefined(window.CollectGarbage)){window.CollectGarbage()}},isActiveXObject:function(d,b){var f=this,a=false,g,c='<object width="1" height="1" style="display:none" '+d.getCodeBaseVersion(b)+">"+d.HTML+f.openTag+"/object>";if(!f.head){return a}f.head.insertBefore(document.createElement("object"),f.head.firstChild);f.head.firstChild.outerHTML=c;try{f.head.firstChild.classid=d.classID}catch(g){}try{if(f.head.firstChild.object){a=true}}catch(g){}try{if(a&&f.head.firstChild.readyState<4){f.garbage=true}}catch(g){}f.head.removeChild(f.head.firstChild);return a},codebaseSearch:function(f,b){var c=this;if(!c.ActiveXEnabled||!f){return null}if(f.BIfuncs&&f.BIfuncs.length&&f.BIfuncs[f.BIfuncs.length-1]!==null){c.callArray(f.BIfuncs)}var d,o=f.SEARCH,k={};if(c.isStrNum(b)){if(o.match&&o.min&&c.compareNums(b,o.min)<=0){return true}if(o.match&&o.max&&c.compareNums(b,o.max)>=0){return false}d=c.isActiveXObject(f,b);if(d&&(!o.min||c.compareNums(b,o.min)>0)){o.min=b}if(!d&&(!o.max||c.compareNums(b,o.max)<0)){o.max=b}return d};var e=[0,0,0,0],l=[].concat(o.digits),a=o.min?1:0,j,i,h,g,m,n=function(p,r){var q=[].concat(e);q[p]=r;return c.isActiveXObject(f,q.join(","))};if(o.max){g=o.max.split(c.splitNumRegx);for(j=0;j<g.length;j++){g[j]=parseInt(g[j],10)}if(g[0]<l[0]){l[0]=g[0]}}if(o.min){m=o.min.split(c.splitNumRegx);for(j=0;j<m.length;j++){m[j]=parseInt(m[j],10)}if(m[0]>e[0]){e[0]=m[0]}}if(m&&g){for(j=1;j<m.length;j++){if(m[j-1]!=g[j-1]){break}if(g[j]<l[j]){l[j]=g[j]}if(m[j]>e[j]){e[j]=m[j]}}}if(o.max){for(j=1;j<l.length;j++){if(g[j]>0&&l[j]==0&&l[j-1]<o.digits[j-1]){l[j-1]+=1;break}}};for(j=0;j<l.length;j++){h={};for(i=0;i<20;i++){if(l[j]-e[j]<1){break}d=round((l[j]+e[j])/2);if(h["a"+d]){break}h["a"+d]=1;if(n(j,d)){e[j]=d;a=1}else{l[j]=d}}l[j]=e[j];if(!a&&n(j,e[j])){a=1};if(!a){break}};return a?e.join(","):null},addWinEvent:function(d,c){var e=this,a=window,b;if(e.isFunc(c)){if(a.addEventListener){a.addEventListener(d,c,false)}else{if(a.attachEvent){a.attachEvent("on"+d,c)}else{b=a["on"+d];a["on"+d]=e.winHandler(c,b)}}}},winHandler:function(d,c){return function(){d();if(typeof c=="function"){c()}}},WLfuncs0:[],WLfuncs:[],runWLfuncs:function(a){var b={};a.winLoaded=true;a.callArray(a.WLfuncs0);a.callArray(a.WLfuncs);if(a.onDoneEmptyDiv){a.onDoneEmptyDiv()}},winLoaded:false,$$onWindowLoaded:function(a){return function(b){if(a.winLoaded){a.call(b)}else{a.fPush(b,a.WLfuncs)}}},div:null,divID:"plugindetect",divWidth:50,pluginSize:1,emptyDiv:function(){var d=this,b,h,c,a,f,g;if(d.div&&d.div.childNodes){for(b=d.div.childNodes.length-1;b>=0;b--){c=d.div.childNodes[b];if(c&&c.childNodes){for(h=c.childNodes.length-1;h>=0;h--){g=c.childNodes[h];try{c.removeChild(g)}catch(f){}}}if(c){try{d.div.removeChild(c)}catch(f){}}}}if(!d.div){a=document.getElementById(d.divID);if(a){d.div=a}}if(d.div&&d.div.parentNode){try{d.div.parentNode.removeChild(d.div)}catch(f){}d.div=null}},DONEfuncs:[],onDoneEmptyDiv:function(){var c=this,a,b;if(!c.winLoaded){return}if(c.WLfuncs&&c.WLfuncs.length&&c.WLfuncs[c.WLfuncs.length-1]!==null){return}for(a in c){b=c[a];if(b&&b.funcs){if(b.OTF==3){return}if(b.funcs.length&&b.funcs[b.funcs.length-1]!==null){return}}}for(a=0;a<c.DONEfuncs.length;a++){c.callArray(c.DONEfuncs)}
3113c.emptyDiv()},getWidth:function(c){if(c){var a=c.scrollWidth||c.offsetWidth,b=this;if(b.isNum(a)){return a}}return -1},getTagStatus:function(m,g,a,b){var c=this,f,k=m.span,l=c.getWidth(k),h=a.span,j=c.getWidth(h),d=g.span,i=c.getWidth(d);if(!k||!h||!d||!c.getDOMobj(m)){return -2}if(j<i||l<0||j<0||i<0||i<=c.pluginSize||c.pluginSize<1){return 0}if(l>=i){return -1}try{if(l==c.pluginSize&&(!c.isIE||c.getDOMobj(m).readyState==4)){if(!m.winLoaded&&c.winLoaded){return 1}if(m.winLoaded&&c.isNum(b)){if(!c.isNum(m.count)){m.count=b}if(b-m.count>=10){return 1}}}}catch(f){}return 0},getDOMobj:function(g,a){var f,d=this,c=g?g.span:0,b=c&&c.firstChild?1:0;try{if(b&&a){d.div.focus()}}catch(f){}return b?c.firstChild:null},setStyle:function(b,g){var f=b.style,a,d,c=this;if(f&&g){for(a=0;a<g.length;a=a+2){try{f[g[a]]=g[a+1]}catch(d){}}}},insertDivInBody:function(i,g){var f,c=this,h="pd33993399",b=null,d=g?window.top.document:window.document,a=d.getElementsByTagName("body")[0]||d.body;if(!a){try{d.write('<div id="'+h+'">.'+c.openTag+"/div>");b=d.getElementById(h)}catch(f){}}a=d.getElementsByTagName("body")[0]||d.body;if(a){a.insertBefore(i,a.firstChild);if(b){a.removeChild(b)}}},insertHTML:function(f,b,g,a,k){var l,m=document,j=this,p,o=m.createElement("span"),n,i;var c=["outlineStyle","none","borderStyle","none","padding","0px","margin","0px","visibility","visible"];var h="outline-style:none;border-style:none;padding:0px;margin:0px;visibility:visible;";if(!j.isDefined(a)){a=""}if(j.isString(f)&&(/[^\s]/).test(f)){f=f.toLowerCase().replace(/\s/g,"");p=j.openTag+f+' width="'+j.pluginSize+'" height="'+j.pluginSize+'" ';p+='style="'+h+'display:inline;" ';for(n=0;n<b.length;n=n+2){if(/[^\s]/.test(b[n+1])){p+=b[n]+'="'+b[n+1]+'" '}}p+=">";for(n=0;n<g.length;n=n+2){if(/[^\s]/.test(g[n+1])){p+=j.openTag+'param name="'+g[n]+'" value="'+g[n+1]+'" />'}}p+=a+j.openTag+"/"+f+">"}else{p=a}if(!j.div){i=m.getElementById(j.divID);if(i){j.div=i}else{j.div=m.createElement("div");j.div.id=j.divID}j.setStyle(j.div,c.concat(["width",j.divWidth+"px","height",(j.pluginSize+3)+"px","fontSize",(j.pluginSize+3)+"px","lineHeight",(j.pluginSize+3)+"px","verticalAlign","baseline","display","block"]));if(!i){j.setStyle(j.div,["position","absolute","right","0px","top","0px"]);j.insertDivInBody(j.div)}}if(j.div&&j.div.parentNode){j.setStyle(o,c.concat(["fontSize",(j.pluginSize+3)+"px","lineHeight",(j.pluginSize+3)+"px","verticalAlign","baseline","display","inline"]));try{o.innerHTML=p}catch(l){};try{j.div.appendChild(o)}catch(l){};return{span:o,winLoaded:j.winLoaded,tagName:f,outerHTML:p}}return{span:null,winLoaded:j.winLoaded,tagName:"",outerHTML:p}},Plugins:{quicktime:{mimeType:["video/quicktime","application/x-quicktimeplayer","image/x-macpaint","image/x-quicktime"],progID:"QuickTimeCheckObject.QuickTimeCheck.1",progID0:"QuickTime.QuickTime",classID:"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B",minIEver:7,HTML:'<param name="src" value="" /><param name="controller" value="false" />',getCodeBaseVersion:function(a){return'codebase="#version='+a+'"'},SEARCH:{min:0,max:0,match:0,digits:[16,128,128,0]},getVersion:function(c){var f=this,d=f.$,a=null,e=null,b;if(!d.isIE){if(d.hasMimeType(f.mimeType)){e=d.OS!=3?d.findNavPlugin("QuickTime.*Plug-?in",0):null;if(e&&e.name){a=d.getNum(e.name)}}}else{if(d.isStrNum(c)){b=c.split(d.splitNumRegx);if(b.length>3&&parseInt(b[3],10)>0){b[3]="9999"}c=b.join(",")}if(d.isStrNum(c)&&d.verIE>=f.minIEver&&f.canUseIsMin()>0){f.installed=f.isMin(c);f.getVersionDone=0;return}f.getVersionDone=1;if(!a&&d.verIE>=f.minIEver){a=f.CDBASE2VER(d.codebaseSearch(f))}if(!a){e=d.getAXO(f.progID);if(e&&e.QuickTimeVersion){a=e.QuickTimeVersion.toString(16);a=parseInt(a.charAt(0),16)+"."+parseInt(a.charAt(1),16)+"."+parseInt(a.charAt(2),16)}}}f.installed=a?1:(e?0:-1);f.version=d.formatNum(a,3)},cdbaseUpper:["7,60,0,0","0,0,0,0"],cdbaseLower:["7,50,0,0",null],cdbase2ver:[function(c,b){var a=b.split(c.$.splitNumRegx);return[a[0],a[1].charAt(0),a[1].charAt(1),a[2]].join(",")},null],CDBASE2VER:function(f){var e=this,c=e.$,b,a=e.cdbaseUpper,d=e.cdbaseLower;
3113if(f){f=c.formatNum(f);for(b=0;b<a.length;b++){if(a[b]&&c.compareNums(f,a[b])<0&&d[b]&&c.compareNums(f,d[b])>=0&&e.cdbase2ver[b]){return e.cdbase2ver[b](e,f)}}}return f},canUseIsMin:function(){var f=this,d=f.$,b,c=f.canUseIsMin,a=f.cdbaseUpper,e=f.cdbaseLower;if(!c.value){c.value=-1;for(b=0;b<a.length;b++){if(a[b]&&d.codebaseSearch(f,a[b])){c.value=1;break}if(e[b]&&d.codebaseSearch(f,e[b])){c.value=-1;break}}}f.SEARCH.match=c.value==1?1:0;return c.value},isMin:function(c){var b=this,a=b.$;return a.codebaseSearch(b,c)?0.7:-1}},flash:{mimeType:"application/x-shockwave-flash",progID:"ShockwaveFlash.ShockwaveFlash",classID:"clsid:D27CDB6E-AE6D-11CF-96B8-444553540000",getVersion:function(){var b=function(i){if(!i){return null}var e=/[\d][\d\,\.\s]*[rRdD]{0,1}[\d\,]*/.exec(i);return e?e[0].replace(/[rRdD\.]/g,",").replace(/\s/g,""):null};var j=this,g=j.$,k,h,l=null,c=null,a=null,f,m,d;if(!g.isIE){m=g.hasMimeType(j.mimeType);if(m){f=g.getDOMobj(g.insertHTML("object",["type",j.mimeType],[],"",j));try{l=g.getNum(f.GetVariable("$version"))}catch(k){}}if(!l){d=m?m.enabledPlugin:null;if(d&&d.description){l=b(d.description)}if(l){l=g.getPluginFileVersion(d,l)}}}else{for(h=15;h>2;h--){c=g.getAXO(j.progID+"."+h);if(c){a=h.toString();break}}if(!c){c=g.getAXO(j.progID)}if(a=="6"){try{c.AllowScriptAccess="always"}catch(k){return"6,0,21,0"}}try{l=b(c.GetVariable("$version"))}catch(k){}if(!l&&a){l=a}}j.installed=l?1:-1;j.version=g.formatNum(l);return true}},shockwave:{mimeType:"application/x-director",progID:"SWCtl.SWCtl",classID:"clsid:166B1BCA-3F9C-11CF-8075-444553540000",getVersion:function(){var a=null,b=null,g,f,d=this,c=d.$;if(!c.isIE){f=c.findNavPlugin("Shockwave\\s*for\\s*Director");if(f&&f.description&&c.hasMimeType(d.mimeType)){a=c.getNum(f.description)}if(a){a=c.getPluginFileVersion(f,a)}}else{try{b=c.getAXO(d.progID).ShockwaveVersion("")}catch(g){}if(c.isString(b)&&b.length>0){a=c.getNum(b)}else{if(c.getAXO(d.progID+".8")){a="8"}else{if(c.getAXO(d.progID+".7")){a="7"}else{if(c.getAXO(d.progID+".1")){a="6"}}}}}d.installed=a?1:-1;d.version=c.formatNum(a)}},zz:0}};PluginDetect.initScript();
3114
3115	var gArgCountErr='The "%%" function requires an even number of arguments.\nArguments should be in the form "atttributeName", "attributeValue", ...',gTagAttrs=null,gQTGeneratorVersion=1;function AC_QuickTimeVersion(){return gQTGeneratorVersion}function _QTComplain(a,b){b=b.replace("%%",a);alert(b)}function _QTAddAttribute(a,b,c){var d;d=gTagAttrs[a+b];null==d&&(d=gTagAttrs[b]);return null!=d?(0==b.indexOf(a)&&null==c&&(c=b.substring(a.length)),null==c&&(c=b),c+'="'+d+'" '):""}function _QTAddObjectAttr(a,b){if(0==a.indexOf("emb#"))return"";0==a.indexOf("obj#")&&null==b&&(b=a.substring(4));return _QTAddAttribute("obj#",a,b)}function _QTAddEmbedAttr(a,b){if(0==a.indexOf("obj#"))return"";0==a.indexOf("emb#")&&null==b&&(b=a.substring(4));return _QTAddAttribute("emb#",a,b)}function _QTAddObjectParam(a,b){var c,d="",e=b?" />":">";-1==a.indexOf("emb#")&&(c=gTagAttrs["obj#"+a],null==c&&(c=gTagAttrs[a]),0==a.indexOf("obj#")&&(a=a.substring(4)),null!=c&&(d='  <param name="'+a+'" value="'+c+'"'+e+"\n"));return d}function _QTDeleteTagAttrs(){for(var a=0;a<arguments.length;a++){var b=arguments[a];delete gTagAttrs[b];delete gTagAttrs["emb#"+b];delete gTagAttrs["obj#"+b]}}function _QTGenerate(a,b,c){if(4>c.length||0!=c.length%2)return _QTComplain(a,gArgCountErr),"";gTagAttrs=[];gTagAttrs.src=c[0];gTagAttrs.width=c[1];gTagAttrs.height=c[2];gTagAttrs.classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B";gTagAttrs.pluginspage="http://www.apple.com/quicktime/download/";a=c[3];if(null==a||""==a)a="6,0,2,0";gTagAttrs.codebase="http://www.apple.com/qtactivex/qtplugin.cab#version="+a;for(var d,e=4;e<c.length;e+=2)d=c[e].toLowerCase(),a=c[e+1],"name"==d||"id"==d?gTagAttrs.name=a:gTagAttrs[d]=a;c="<object "+_QTAddObjectAttr("classid")+_QTAddObjectAttr("width")+_QTAddObjectAttr("height")+_QTAddObjectAttr("codebase")+_QTAddObjectAttr("name","id")+_QTAddObjectAttr("tabindex")+_QTAddObjectAttr("hspace")+_QTAddObjectAttr("vspace")+_QTAddObjectAttr("border")+_QTAddObjectAttr("align")+_QTAddObjectAttr("class")+_QTAddObjectAttr("title")+_QTAddObjectAttr("accesskey")+_QTAddObjectAttr("noexternaldata")+">\n"+_QTAddObjectParam("src",b);e="  <embed "+_QTAddEmbedAttr("src")+_QTAddEmbedAttr("width")+_QTAddEmbedAttr("height")+_QTAddEmbedAttr("pluginspage")+_QTAddEmbedAttr("name")+_QTAddEmbedAttr("align")+_QTAddEmbedAttr("tabindex");_QTDeleteTagAttrs("src","width","height","pluginspage","classid","codebase","name","tabindex","hspace","vspace","border","align","noexternaldata","class","title","accesskey");for(d in gTagAttrs)a=gTagAttrs[d],null!=a&&(e+=_QTAddEmbedAttr(d),c+=_QTAddObjectParam(d,b));return c+e+"> </embed>\n</object>"}function QT_GenerateOBJECTText(){return _QTGenerate("QT_GenerateOBJECTText",!1,arguments)};
3116
3117
3118	/*
3119		jQuery hashchange event v1.3
3120		https://github.com/cowboy/jquery-hashchange
3121		Copyright (c) 2010 "Cowboy" Ben Alman
3122		Dual licensed under the MIT and GPL licenses.
3123	*/
3124	(function(){function e(a){a=a||location.href;return"#"+a.replace(/^[^#]*#?(.*)$/,"$1")}var k=document,b,f=$.event.special,p=k.documentMode,m="oniLightBoxHashChange"in window&&(void 0===p||7<p);$.fn.iLightBoxHashChange=function(a){return a?this.bind("iLightBoxHashChange",a):this.trigger("iLightBoxHashChange")};$.fn.iLightBoxHashChange.delay=50;f.iLightBoxHashChange=$.extend(f.iLightBoxHashChange,{setup:function(){if(m)return!1;$(b.start)},teardown:function(){if(m)return!1;$(b.stop)}});b=function(){function a(){var c=
3125	e(),d=f(l);c!==l?(n(l=c,d),$(window).trigger("iLightBoxHashChange")):d!==l&&(location.href=location.href.replace(/#.*/,"")+d);g=setTimeout(a,$.fn.iLightBoxHashChange.delay)}var h={},g,l=e(),b=function(c){return c},n=b,f=b;h.start=function(){g||a()};h.stop=function(){g&&clearTimeout(g);g=void 0};browser.msie&&!m&&function(){var c,d;h.start=function(){c||(d=(d=$.fn.iLightBoxHashChange.src)&&d+e(),c=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){d||n(e());a()}).attr("src",d||
3126	"javascript:0").insertAfter("body")[0].contentWindow,k.onpropertychange=function(){try{"title"===event.propertyName&&(c.document.title=k.title)}catch(a){}})};h.stop=b;f=function(){return e(c.location.href)};n=function(a,d){var b=c.document,e=$.fn.iLightBoxHashChange.domain;
3126a!==d&&(b.title=k.title,b.open(),e&&b.write('<script>document.domain="'+e+'"\x3c/script>'),b.close(),c.location.hash=a)}}();return h}()})();
3127
3128	if (!Array.prototype.filter) {
3129		Array.prototype.filter = function(fun /*, thisp */ ) {
3130			"use strict";
3131
3132			if (this == null)
3133				throw new TypeError();
3134
3135			var t = Object(this);
3136			var len = t.length >>> 0;
3137			if (typeof fun != "function")
3138				throw new TypeError();
3139
3140			var res = [];
3141			var thisp = arguments[1];
3142			for (var i = 0; i < len; i++) {
3143				if (i in t) {
3144					var val = t[i]; // in case fun mutates this
3145					if (fun.call(thisp, val, i, t))
3146						res.push(val);
3147				}
3148			}
3149
3150			return res;
3151		};
3152	}
3153
3154	if (!Array.prototype.indexOf) {
3155		Array.prototype.indexOf = function(searchElement, fromIndex) {
3156			var k;
3157
3158			if (this == null) {
3159				throw new TypeError('"this" is null or not defined');
3160			}
3161
3162			var O = Object(this);
3163
3164			var len = O.length >>> 0;
3165
3166			if (len === 0) {
3167				return -1;
3168			}
3169
3170			var n = +fromIndex || 0;
3171
3172			if (abs(n) === Infinity) {
3173				n = 0;
3174			}
3175
3176			if (n >= len) {
3177				return -1;
3178			}
3179
3180			k = max(n >= 0 ? n : len - abs(n), 0);
3181
3182			while (k < len) {
3183				var kValue;
3184				if (k in O && O[k] === searchElement) {
3185					return k;
3186				}
3187				k++;
3188			}
3189			return -1;
3190		};
3191	}
3192
3193	if (!Array.prototype.lastIndexOf) {
3194		Array.prototype.lastIndexOf = function(searchElement /*, fromIndex*/ ) {
3195			"use strict";
3196
3197			if (this == null)
3198				throw new TypeError();
3199
3200			var t = Object(this);
3201			var len = t.length >>> 0;
3202			if (len === 0)
3203				return -1;
3204
3205			var n = len;
3206			if (arguments.length > 1) {
3207				n = Number(arguments[1]);
3208				if (n != n)
3209					n = 0;
3210				else if (n != 0 && n != (1 / 0) && n != -(1 / 0))
3211					n = (n > 0 || -1) * floor(abs(n));
3212			}
3213
3214			var k = n >= 0 ? min(n, len - 1) : len - abs(n);
3215
3216			for (; k >= 0; k--) {
3217				if (k in t && t[k] === searchElement)
3218					return k;
3219			}
3220			return -1;
3221		};
3222	}
3223})(jQuery, this);

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.