PageSourceSearch

https://www.archeophone.com/assets/themes/cardinal/js/combine/ilightbox.min.js?ver=1.0.1

js archeophone.com collected 2026-10-02 09:56:31 UTC 121,230 bytes, 3,224 lines download raw bytes

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