PageSourceSearch

https://www.visitleclaire.com/wp-content/themes/joyn/js/ilightbox.min.js

js visitleclaire.com collected 2026-10-02 19:46:38 UTC 121,306 bytes, 3,226 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                if (value && value.source) {
1765				var item = key.toLowerCase(),
1766					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, '+'));
1767				    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>';
1768                }
1769            });
1770
1771			buttons += '</ul>';
1772
1773			socialBar.html(buttons);
1774			$('div.ilightbox-container', target).append(socialBar);
1775		},
1776
1777		fullScreenAction: function() {
1778			var iL = this,
1779				vars = iL.vars;
1780
1781			if (fullScreenApi.supportsFullScreen) {
1782				if (fullScreenApi.isFullScreen()) fullScreenApi.cancelFullScreen(document.documentElement);
1783				else fullScreenApi.requestFullScreen(document.documentElement);
1784			} else {
1785				iL.doFullscreen();
1786			}
1787		},
1788
1789		doFullscreen: function() {
1790			var iL = this,
1791				vars = iL.vars,
1792				viewport = getViewport(),
1793				opts = iL.options;
1794
1795			if (opts.fullAlone) {
1796				var currentHolder = vars.holder,
1797					current = iL.items[vars.current],
1798					windowWidth = viewport.width,
1799					windowHeight = viewport.height,
1800					elements = [currentHolder, vars.nextPhoto, vars.prevPhoto, vars.nextButton, vars.prevButton, vars.overlay, vars.toolbar, vars.thumbnails, vars.loader],
1801					hideElements = [vars.nextPhoto, vars.prevPhoto, vars.nextButton, vars.prevButton, vars.loader, vars.thumbnails];
1802
1803				if (!vars.isInFullScreen) {
1804					vars.isInFullScreen = vars.lockKey = vars.lockWheel = vars.lockSwipe = true;
1805					vars.overlay.css({
1806						opacity: 1
1807					});
1808
1809					$.each(hideElements, function(i, element) {
1810						element.hide();
1811					});
1812
1813					vars.fullScreenButton.attr('title', opts.text.exitFullscreen);
1814
1815					if (opts.fullStretchTypes.indexOf(current.type) != -1) currentHolder.data({
1816						naturalWidthOld: currentHolder.data('naturalWidth'),
1817						naturalHeightOld: currentHolder.data('naturalHeight'),
1818						naturalWidth: windowWidth,
1819						naturalHeight: windowHeight
1820					});
1821					else {
1822						var viewport = current.options.fullViewPort || opts.fullViewPort || '',
1823							newWidth = windowWidth,
1824							newHeight = windowHeight,
1825							width = currentHolder.data('naturalWidth'),
1826							height = currentHolder.data('naturalHeight');
1827
1828						if (viewport.toLowerCase() == 'fill') {
1829							newHeight = (newWidth / width) * height;
1830
1831							if (newHeight < windowHeight) {
1832								newWidth = (windowHeight / height) * width,
1833									newHeight = windowHeight;
1834							}
1835						} else if (viewport.toLowerCase() == 'fit') {
1836							var dims = iL.getNewDimenstions(newWidth, newHeight, width, height, true);
1837
1838							newWidth = dims.width,
1839								newHeight = dims.height;
1840						} else if (viewport.toLowerCase() == 'stretch') {
1841							newWidth = newWidth,
1842								newHeight = newHeight;
1843						} else {
1844							var scale = (width > newWidth || height > newHeight) ? true : false,
1845								dims = iL.getNewDimenstions(newWidth, newHeight, width, height, scale);
1846							newWidth = dims.width,
1847								newHeight = dims.height;
1848						}
1849
1850						currentHolder.data({
1851							naturalWidthOld: currentHolder.data('naturalWidth'),
1852							naturalHeightOld: currentHolder.data('naturalHeight'),
1853							naturalWidth: newWidth,
1854							naturalHeight: newHeight
1855						});
1856					}
1857
1858					$.each(elements, function(key, val) {
1859						val.addClass('ilightbox-fullscreen');
1860					});
1861
1862					//Trigger the onEnterFullScreen callback
1863					if (typeof opts.callback.onEnterFullScreen == 'function') opts.callback.onEnterFullScreen.call(iL, iL.ui);
1864				} else {
1865					vars.isInFullScreen = vars.lockKey = vars.lockWheel = vars.lockSwipe = false;
1866					vars.overlay.css({
1867						opacity: iL.options.overlay.opacity
1868					});
1869
1870					$.each(hideElements, function(i, element) {
1871						element.show();
1872					});
1873
1874					vars.fullScreenButton.attr('title', opts.text.enterFullscreen);
1875
1876					currentHolder.data({
1877						naturalWidth: currentHolder.data('naturalWidthOld'),
1878						naturalHeight: currentHolder.data('naturalHeightOld'),
1879						naturalWidthOld: null,
1880						naturalHeightOld: null
1881					});
1882
1883					$.each(elements, function(key, val) {
1884						val.removeClass('ilightbox-fullscreen');
1885					});
1886
1887					//Trigger the onExitFullScreen callback
1888					if (typeof opts.callback.onExitFullScreen == 'function') opts.callback.onExitFullScreen.call(iL, iL.ui);
1889				}
1890			} else {
1891				if (!vars.isInFullScreen) vars.isInFullScreen = true;
1892				else vars.isInFullScreen = false;
1893			}
1894			iL.repositionPhoto(true);
1895		},
1896
1897		closeAction: function() {
1898			var iL = this,
1899				vars = iL.vars,
1900				opts = iL.options;
1901
1902			$win.unbind('.iLightBox');
1903			$doc.off('.iLightBox');
1904
1905			if (vars.isInFullScreen) fullScreenApi.cancelFullScreen(document.documentElement);
1906
1907			$('.ilightbox-overlay, .ilightbox-holder, .ilightbox-thumbnails').off('.iLightBox');
1908
1909			if (opts.hide.effect) vars.overlay.stop().fadeOut(opts.hide.speed, function() {
1910				vars.overlay.remove();
1911				vars.BODY.removeClass('ilightbox-noscroll').off('.iLightBox');
1912			});
1913			else {
1914				vars.overlay.remove();
1915				vars.BODY.removeClass('ilightbox-noscroll').off('.iLightBox');
1916			}
1917
1918			var fadeOuts = [vars.toolbar, vars.holder, vars.nextPhoto, vars.prevPhoto, vars.nextButton, vars.prevButton, vars.loader, vars.thumbnails];
1919
1920			$.each(fadeOuts, function(i, element) {
1921				element.removeAttr('style').remove();
1922			});
1923
1924			vars.dontGenerateThumbs = vars.isInFullScreen = false;
1925
1926			window.iLightBox = null;
1927
1928			if (opts.linkId) {
1929				vars.hashLock = true;
1930				removeHash();
1931				setTimeout(function() {
1932					vars.hashLock = false;
1933				}, 55);
1934			}
1935
1936			//Trigger the onHide callback
1937			if (typeof opts.callback.onHide == 'function') opts.callback.onHide.call(iL, iL.ui);
1938		},
1939
1940		repositionPhoto: function() {
1941			var iL = this,
1942				vars = iL.vars,
1943				opts = iL.options,
1944				path = opts.path.toLowerCase(),
1945				viewport = getViewport(),
1946				winWidth = viewport.width,
1947				winHeight = viewport.height;
1948
1949			var thumbsOffsetW = (vars.isInFullScreen && opts.fullAlone || vars.isMobile) ? 0 : ((path == 'horizontal') ? 0 : vars.thumbnails.outerWidth()),
1950				thumbsOffsetH = vars.isMobile ? vars.toolbar.outerHeight() : ((vars.isInFullScreen && opts.fullAlone) ? 0 : ((path == 'horizontal') ? vars.thumbnails.outerHeight() : 0)),
1951				width = (vars.isInFullScreen && opts.fullAlone) ? winWidth : (winWidth - (opts.styles.pageOffsetX)),
1952				height = (vars.isInFullScreen && opts.fullAlone) ? winHeight : (winHeight - (opts.styles.pageOffsetY)),
1953				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,
1954				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)));
1955
1956			var elObject = {
1957				type: 'current',
1958				width: width,
1959				height: height,
1960				item: iL.items[vars.current],
1961				offsetW: offsetW,
1962				offsetH: offsetH,
1963				thumbsOffsetW: thumbsOffsetW,
1964				thumbsOffsetH: thumbsOffsetH,
1965				animate: arguments.length,
1966				holder: vars.holder
1967			};
1968
1969			iL.repositionEl(elObject);
1970
1971			if (iL.items[vars.next]) {
1972				elObject = $.extend(elObject, {
1973					type: 'next',
1974					item: iL.items[vars.next],
1975					offsetX: opts.styles.nextOffsetX,
1976					offsetY: opts.styles.nextOffsetY,
1977					holder: vars.nextPhoto
1978				});
1979
1980				iL.repositionEl(elObject);
1981			}
1982
1983			if (iL.items[vars.prev]) {
1984				elObject = $.extend(elObject, {
1985					type: 'prev',
1986					item: iL.items[vars.prev],
1987					offsetX: opts.styles.prevOffsetX,
1988					offsetY: opts.styles.prevOffsetY,
1989					holder: vars.prevPhoto
1990				});
1991
1992				iL.repositionEl(elObject);
1993			}
1994
1995			var loaderCss = (path == "horizontal") ? {
1996				left: parseInt((width / 2) - (vars.loader.outerWidth() / 2))
1997			} : {
1998				top: parseInt((height / 2) - (vars.loader.outerHeight() / 2))
1999			};
2000			vars.loader.css(loaderCss);
2001		},
2002
2003		repositionEl: function(obj) {
2004			var iL = this,
2005				vars = iL.vars,
2006				opts = iL.options,
2007				path = opts.path.toLowerCase(),
2008				widthAvail = (obj.type == 'current') ? ((vars.isInFullScreen && opts.fullAlone) ? obj.width : (obj.width - obj.offsetW)) : (obj.width - obj.offsetW),
2009				heightAvail = (obj.type == 'current') ? ((vars.isInFullScreen && opts.fullAlone) ? obj.height : (obj.height - obj.offsetH)) : (obj.height - obj.offsetH),
2010				itemParent = obj.item,
2011				item = obj.item.options,
2012				holder = obj.holder,
2013				offsetX = obj.offsetX || 0,
2014				offsetY = obj.offsetY || 0,
2015				thumbsOffsetW = obj.thumbsOffsetW,
2016				thumbsOffsetH = obj.thumbsOffsetH;
2017
2018			if (obj.type == 'current') {
2019				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);
2020				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);
2021			} else {
2022				if (typeof item.width == 'number' && item.width) widthAvail = (item.width > widthAvail) ? widthAvail : item.width;
2023				if (typeof item.height == 'number' && item.height) heightAvail = (item.height > heightAvail) ? heightAvail : item.height;
2024			}
2025
2026			if (opts.innerToolbar)
2027				heightAvail = parseInt(heightAvail - $('.ilightbox-inner-toolbar', holder).outerHeight());
2028
2029			var width = (typeof item.width == 'string' && item.width.indexOf('%') != -1) ? percentToValue(parseInt(item.width.replace('%', '')), obj.width) : holder.data('naturalWidth'),
2030				height = (typeof item.height == 'string' && item.height.indexOf('%') != -1) ? percentToValue(parseInt(item.height.replace('%', '')), obj.height) : holder.data('naturalHeight');
2031
2032			var dims = ((typeof item.width == 'string' && item.width.indexOf('%') != -1 || typeof item.height == 'string' && item.height.indexOf('%') != -1) ? {
2033					width: width,
2034					height: height
2035				} : iL.getNewDimenstions(widthAvail, heightAvail, width, height)),
2036				newDims = $.extend({}, dims, {});
2037
2038			if (obj.type == 'prev' || obj.type == 'next')
2039				width = parseInt(dims.width * ((obj.type == 'next') ? opts.styles.nextScale : opts.styles.prevScale)),
2040				height = parseInt(dims.height * ((obj.type == 'next') ? opts.styles.nextScale : opts.styles.prevScale));
2041			else
2042				width = dims.width,
2043				height = dims.height;
2044
2045			var widthDiff = parseInt((getPixel(holder, 'padding-left') + getPixel(holder, 'padding-right') + getPixel(holder, 'border-left-width') + getPixel(holder, 'border-right-width')) / 2),
2046				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);
2047
2048			switch (obj.type) {
2049				case 'current':
2050					var top = parseInt((obj.height / 2) - (height / 2) - heightDiff - (thumbsOffsetH / 2)),
2051						left = parseInt((obj.width / 2) - (width / 2) - widthDiff - (thumbsOffsetW / 2));
2052					break;
2053
2054				case 'next':
2055					var top = (path == 'horizontal') ? parseInt((obj.height / 2) - offsetY - (height / 2) - heightDiff - (thumbsOffsetH / 2)) : parseInt(obj.height - offsetX - heightDiff - (thumbsOffsetH / 2)),
2056						left = (path == 'horizontal') ? parseInt(obj.width - offsetX - widthDiff - (thumbsOffsetW / 2)) : parseInt((obj.width / 2) - (width / 2) - widthDiff - offsetY - (thumbsOffsetW / 2));
2057					break;
2058
2059				case 'prev':
2060					var top = (path == 'horizontal') ? parseInt((obj.height / 2) - offsetY - (height / 2) - heightDiff - (thumbsOffsetH / 2)) : parseInt(offsetX - heightDiff - height - (thumbsOffsetH / 2)),
2061						left = (path == 'horizontal') ? parseInt(offsetX - widthDiff - width - (thumbsOffsetW / 2)) : parseInt((obj.width / 2) - offsetY - (width / 2) - widthDiff - (thumbsOffsetW / 2));
2062					break;
2063			}
2064
2065			holder.data('offset', {
2066				top: top,
2067				left: left,
2068				newDims: newDims,
2069				diff: {
2070					W: widthDiff,
2071					H: heightDiff
2072				},
2073				thumbsOffset: {
2074					W: thumbsOffsetW,
2075					H: thumbsOffsetH
2076				},
2077				object: obj
2078			});
2079
2080			if (obj.animate > 0 && opts.effects.reposition) {
2081				holder.css(transform, gpuAcceleration).stop().animate({
2082					top: top,
2083					left: left
2084				}, opts.effects.repositionSpeed, 'easeOutCirc', function() {
2085					holder.css(transform, '');
2086				});
2087				$('div.ilightbox-container', holder).stop().animate({
2088					width: width,
2089					height: height
2090				}, opts.effects.repositionSpeed, 'easeOutCirc');
2091				$('div.ilightbox-inner-toolbar', holder).stop().animate({
2092					width: width
2093				}, opts.effects.repositionSpeed, 'easeOutCirc', function() {
2094					$(this).css('overflow', 'visible');
2095				});
2096			} else {
2097				holder.css({
2098					top: top,
2099					left: left
2100				});
2101				$('div.ilightbox-container', holder).css({
2102					width: width,
2103					height: height
2104				});
2105				$('div.ilightbox-inner-toolbar', holder).css({
2106					width: width
2107				});
2108			}
2109		},
2110
2111		resume: function(priority) {
2112			var iL = this,
2113				vars = iL.vars,
2114				opts = iL.options;
2115
2116			if (!opts.slideshow.pauseTime || opts.controls.slideshow && vars.total <= 1 || priority < vars.isPaused) {
2117				return;
2118			}
2119
2120			vars.isPaused = 0;
2121
2122			if (vars.cycleID) {
2123				vars.cycleID = clearTimeout(vars.cycleID);
2124			}
2125
2126			vars.cycleID = setTimeout(function() {
2127				if (vars.current == vars.total - 1) iL.goTo(0);
2128				else iL.moveTo('next');
2129			}, opts.slideshow.pauseTime);
2130		},
2131
2132		pause: function(priority) {
2133			var iL = this,
2134				vars = iL.vars,
2135				opts = iL.options;
2136
2137			if (priority < vars.isPaused) {
2138				return;
2139			}
2140
2141			vars.isPaused = priority || 100;
2142
2143			if (vars.cycleID) {
2144				vars.cycleID = clearTimeout(vars.cycleID);
2145			}
2146		},
2147
2148		resetCycle: function() {
2149			var iL = this,
2150				vars = iL.vars,
2151				opts = iL.options;
2152
2153			if (opts.controls.slideshow && vars.cycleID && !vars.isPaused) {
2154				iL.resume();
2155			}
2156		},
2157
2158		getNewDimenstions: function(width, height, width_old, height_old, thumb) {
2159			var iL = this;
2160
2161			if (!width) factor = height / height_old;
2162			else if (!height) factor = width / width_old;
2163			else factor = min(width / width_old, height / height_old);
2164
2165			if (!thumb) {
2166				if (factor > iL.options.maxScale) factor = iL.options.maxScale;
2167				else if (factor < iL.options.minScale) factor = iL.options.minScale;
2168			}
2169
2170			var final_width = (iL.options.keepAspectRatio) ? round(width_old * factor) : width,
2171				final_height = (iL.options.keepAspectRatio) ? round(height_old * factor) : height;
2172
2173			return {
2174				width: final_width,
2175				height: final_height,
2176				ratio: factor
2177			};
2178		},
2179
2180		setOption: function(options) {
2181			var iL = this;
2182
2183			iL.options = $.extend(true, iL.options, options || {});
2184			iL.refresh();
2185		},
2186
2187		availPlugins: function() {
2188			var iL = this,
2189				testEl = document.createElement("video");
2190
2191			iL.plugins = {
2192				flash: !isMobile,
2193				quicktime: (parseInt(PluginDetect.getVersion("QuickTime")) >= 0) ? true : false,
2194				html5H264: !!(testEl.canPlayType && testEl.canPlayType('video/mp4').replace(/no/, '')),
2195				html5WebM: !!(testEl.canPlayType && testEl.canPlayType('video/webm').replace(/no/, '')),
2196				html5Vorbis: !!(testEl.canPlayType && testEl.canPlayType('video/ogg').replace(/no/, '')),
2197				html5QuickTime: !!(testEl.canPlayType && testEl.canPlayType('video/quicktime').replace(/no/, ''))
2198			};
2199		},
2200
2201		addContent: function(element, obj) {
2202			var iL = this,
2203				el;
2204
2205			switch (obj.type) {
2206				case 'video':
2207					var HTML5 = false,
2208						videoType = obj.videoType,
2209						html5video = obj.options.html5video;
2210
2211					if (((videoType == 'video/mp4' || obj.ext == 'mp4' || obj.ext == 'm4v') || html5video.h264) && iL.plugins.html5H264)
2212						obj.ext = 'mp4',
2213						obj.URL = html5video.h264 || obj.URL;
2214					else if (html5video.webm && iL.plugins.html5WebM)
2215						obj.ext = 'webm',
2216						obj.URL = html5video.webm || obj.URL;
2217					else if (html5video.ogg && iL.plugins.html5Vorbis)
2218						obj.ext = 'ogv',
2219						obj.URL = html5video.ogg || obj.URL;
2220
2221					if (iL.plugins.html5H264 && (videoType == 'video/mp4' || obj.ext == 'mp4' || obj.ext == 'm4v')) HTML5 = true, videoType = "video/mp4";
2222					else if (iL.plugins.html5WebM && (videoType == 'video/webm' || obj.ext == 'webm')) HTML5 = true, videoType = "video/webm";
2223					else if (iL.plugins.html5Vorbis && (videoType == 'video/ogg' || obj.ext == 'ogv')) HTML5 = true, videoType = "video/ogg";
2224					else if (iL.plugins.html5QuickTime && (videoType == 'video/quicktime' || obj.ext == 'mov' || obj.ext == 'qt')) HTML5 = true, videoType = "video/quicktime";
2225
2226					if (HTML5) {
2227						el = $('<video />
2227', {
2228							"width": "100%",
2229							"height": "100%",
2230							"preload": html5video.preload,
2231							"autoplay": html5video.autoplay,
2232							"poster": html5video.poster,
2233							"controls": html5video.controls
2234						}).append($('<source />', {
2235							"src": obj.URL,
2236							"type": videoType
2237						}));
2238					} else {
2239						if (!iL.plugins.quicktime) el = $('<span />', {
2240							"class": "ilightbox-alert",
2241							html: iL.options.errors.missingPlugin.replace('{pluginspage}', pluginspages.quicktime).replace('{type}', 'QuickTime')
2242						});
2243						else {
2244
2245							el = $('<object />', {
2246								"type": "video/quicktime",
2247								"pluginspage": pluginspages.quicktime
2248							}).attr({
2249								"data": obj.URL,
2250								"width": "100%",
2251								"height": "100%"
2252							}).append($('<param />', {
2253								"name": "src",
2254								"value": obj.URL
2255							})).append($('<param />', {
2256								"name": "autoplay",
2257								"value": "false"
2258							})).append($('<param />', {
2259								"name": "loop",
2260								"value": "false"
2261							})).append($('<param />', {
2262								"name": "scale",
2263								"value": "tofit"
2264							}));
2265
2266							if (browser.msie) el = QT_GenerateOBJECTText(obj.URL, '100%', '100%', '', 'SCALE', 'tofit', 'AUTOPLAY', 'false', 'LOOP', 'false');
2267						}
2268					}
2269
2270					break;
2271
2272				case 'flash':
2273					if (!iL.plugins.flash) el = $('<span />', {
2274						"class": "ilightbox-alert",
2275						html: iL.options.errors.missingPlugin.replace('{pluginspage}', pluginspages.flash).replace('{type}', 'Adobe Flash player')
2276					});
2277					else {
2278						var flashvars = "",
2279							i = 0;
2280
2281						if (obj.options.flashvars) $.each(obj.options.flashvars, function(k, v) {
2282							if (i != 0) flashvars += "&";
2283							flashvars += k + "=" + encodeURIComponent(v);
2284							i++;
2285						});
2286						else flashvars = null;
2287
2288						el = $('<embed />').attr({
2289							"type": "application/x-shockwave-flash",
2290							"src": obj.URL,
2291							"width": (typeof obj.options.width == 'number' && obj.options.width && iL.options.minScale == '1' && iL.options.maxScale == '1') ? obj.options.width : "100%",
2292							"height": (typeof obj.options.height == 'number' && obj.options.height && iL.options.minScale == '1' && iL.options.maxScale == '1') ? obj.options.height : "100%",
2293							"quality": "high",
2294							"bgcolor": "#000000",
2295							"play": "true",
2296							"loop": "true",
2297							"menu": "true",
2298							"wmode": "transparent",
2299							"scale": "showall",
2300							"allowScriptAccess": "always",
2301							"allowFullScreen": "true",
2302							"flashvars": flashvars,
2303							"fullscreen": "yes"
2304						});
2305					}
2306
2307					break;
2308
2309				case 'iframe':
2310					el = $('<iframe />').attr({
2311						"width": (typeof obj.options.width == 'number' && obj.options.width && iL.options.minScale == '1' && iL.options.maxScale == '1') ? obj.options.width : "100%",
2312						"height": (typeof obj.options.height == 'number' && obj.options.height && iL.options.minScale == '1' && iL.options.maxScale == '1') ? obj.options.height : "100%",
2313						src: obj.URL,
2314						frameborder: 0,
2315						'hspace': 0,
2316						'vspace': 0,
2317						'scrolling': supportTouch ? 'auto' : 'scroll',
2318						'webkitAllowFullScreen': '',
2319						'mozallowfullscreen': '',
2320						'allowFullScreen': ''
2321					});
2322
2323					break;
2324
2325				case 'inline':
2326					el = $('<div class="ilightbox-wrapper"></div>').html($(obj.URL).clone(true));
2327
2328					break;
2329
2330				case 'html':
2331					var object = obj.URL,
2332						el;
2333
2334					if (object[0].nodeName) {
2335						el = $('<div class="ilightbox-wrapper"></div>').html(object);
2336					} else {
2337						var dom = $(obj.URL),
2338							html = (dom.selector) ? $('<div>' + dom + '</div>') : dom;
2339						el = $('<div class="ilightbox-wrapper"></div>').html(html);
2340					}
2341
2342					break;
2343			}
2344
2345			$('div.ilightbox-container', element).empty().html(el);
2346
2347			// For fixing Chrome about just playing the video for first time
2348			if (el[0].tagName.toLowerCase() === 'video' && browser.webkit) setTimeout(function() {
2349				var src = el[0].currentSrc + '?' + floor(random() * 30000);
2350				el[0].currentSrc = src;
2351				el[0].src = src;
2352			});
2353
2354			return el;
2355		},
2356
2357		ogpRecognition: function(obj, callback) {
2358			var iL = this,
2359				url = obj.URL;
2360
2361			iL.showLoader();
2362			doAjax(url, function(data) {
2363				iL.hideLoader();
2364				if (data) {
2365					var object = new Object();
2366
2367					object.length = false,
2368					object.url = data.url;
2369
2370					if (data.status == 200) {
2371						var result = data.results,
2372							type = result.type,
2373							source = result.source;
2374
2375						object.source = source.src,
2376						object.width = source.width && parseInt(source.width) || 0,
2377						object.height = source.height && parseInt(source.height) || 0,
2378						object.type = type,
2379						object.thumbnail = source.thumbnail || result.images && result.images[0],
2380						object.html5video = result.html5video || {},
2381						object.length = true;
2382
2383						if (source.type == 'application/x-shockwave-flash') object.type = "flash";
2384						else if (source.type.indexOf("video/") != -1) object.type = "video";
2385						else if (source.type.indexOf("/html") != -1) object.type = "iframe";
2386						else if (source.type.indexOf("image/") != -1) object.type = "image";
2387
2388					} else if (typeof data.response != 'undefined')
2389						throw data.response;
2390
2391					callback.call(this, object.length ? object : false);
2392				}
2393			});
2394		},
2395
2396		hashChangeHandler: function(url) {
2397			var iL = this,
2398				vars = iL.vars,
2399				opts = iL.options,
2400				URL = url || window.location.href,
2401				hash = parseURI(URL).hash,
2402				split = hash.split('/'),
2403				index = split[1];
2404
2405			if (vars.hashLock || ('#' + opts.linkId != split[0] && hash.length > 1)) return;
2406
2407			if (index) {
2408				var target = split[1] || 0;
2409				if (iL.items[target]) {
2410					var overlay = $('.ilightbox-overlay');
2411					if (overlay.length && overlay.attr('linkid') == opts.linkId) {
2412						iL.goTo(target);
2413					} else {
2414						iL.itemsObject[target].trigger(supportTouch ? 'itap' : 'click');
2415					}
2416				} else {
2417					var overlay = $('.ilightbox-overlay');
2418					if (overlay.length) iL.closeAction();
2419				}
2420			} else {
2421				var overlay = $('.ilightbox-overlay');
2422				if (overlay.length) iL.closeAction();
2423			}
2424		}
2425	};
2426
2427	/**
2428	 * Parse style to pixels.
2429	 *
2430	 * @param {Object}   $element   jQuery object with element.
2431	 * @param {Property} property   CSS property to get the pixels from.
2432	 *
2433	 * @return {Int}
2434	 */
2435	function getPixel($element, property) {
2436		return parseInt($element.css(property), 10) || 0;
2437	}
2438
2439	/**
2440	 * Make sure that number is within the limits.
2441	 *
2442	 * @param {Number} number
2443	 * @param {Number} min
2444	 * @param {Number} max
2445	 *
2446	 * @return {Number}
2447	 */
2448	function within(number, min, max) {
2449		return number < min ? min : number > max ? max : number;
2450	}
2451
2452	/**
2453	 * Get viewport/window size (width and height).
2454	 *
2455	 * @return {Object}
2456	 */
2457	function getViewport() {
2458		var e = window,
2459			a = 'inner';
2460		if (!('innerWidth' in window)) {
2461			a = 'client';
2462			e = document.documentElement || document.body;
2463		}
2464		return {
2465			width: e[a + 'Width'],
2466			height: e[a + 'Height']
2467		}
2468	}
2469
2470	/**
2471	 * Remove hash tag from the URL
2472	 *
2473	 * @return {Void}
2474	 */
2475	function removeHash() {
2476		var scroll = getScrollXY();
2477
2478		window.location.hash = "";
2479
2480		// Restore the scroll offset, should be flicker free
2481		window.scrollTo(scroll.x, scroll.y);
2482	}
2483
2484	/**
2485	 * Do the ajax requests with callback.
2486	 *
2487	 * @param {String}   url
2488	 * @param {Function} callback
2489	 *
2490	 * @return {Void}
2491	 */
2492	function doAjax(url, callback) {
2493		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');
2494		$.ajax({
2495			url: url,
2496			dataType: 'jsonp'
2497		});
2498
2499		iLCallback = function(data) {
2500			callback.call(this, data);
2501		};
2502	}
2503
2504	/**
2505	 * Find image from DOM elements
2506	 *
2507	 * @param {Element} element
2508	 *
2509	 * @return {Void}
2510	 */
2511	function findImageInElement(element) {
2512		var elements = $('*', element),
2513			imagesArr = new Array();
2514
2515		elements.each(function() {
2516			var url = "",
2517				element = this;
2518
2519			if ($(element).css("background-image") != "none") {
2520				url = $(element).css("background-image");
2521			} else if (typeof($(element).attr("src")) != "undefined" && element.nodeName.toLowerCase() == "img") {
2522				url = $(element).attr("src");
2523			}
2524
2525			if (url.indexOf("gradient") == -1) {
2526				url = url.replace(/url\(\"/g, "");
2527				url = url.replace(/url\(/g, "");
2528				url = url.replace(/\"\)/g, "");
2529				url = url.replace(/\)/g, "");
2530
2531				var urls = url.split(",");
2532
2533				for (var i = 0; i < urls.length; i++) {
2534					if (urls[i].length > 0 && $.inArray(urls[i], imagesArr) == -1) {
2535						var extra = "";
2536						if (browser.msie && browser.version < 9) {
2537							extra = "?" + floor(random() * 3000);
2538						}
2539						imagesArr.push(urls[i] + extra);
2540					}
2541				}
2542			}
2543		});
2544
2545		return imagesArr;
2546	}
2547
2548	/**
2549	 * Get file extension.
2550	 *
2551	 * @param {String} URL
2552	 *
2553	 * @return {String}
2554	 */
2555	function getExtension(URL) {
2556		var ext = URL.split('.').pop().toLowerCase(),
2557			extra = ext.indexOf('?') !== -1 ? ext.split('?').pop() : '';
2558
2559		return ext.replace(extra, '');
2560	}
2561
2562	/**
2563	 * Get type via extension.
2564	 *
2565	 * @param {String} URL
2566	 *
2567	 * @return {String}
2568	 */
2569	function getTypeByExtension(URL) {
2570		var type,
2571			ext = getExtension(URL);
2572
2573		if (extensions.image.indexOf(ext) !== -1) type = 'image';
2574		else if (extensions.flash.indexOf(ext) !== -1) type = 'flash';
2575		else if (extensions.video.indexOf(ext) !== -1) type = 'video';
2576		else type = 'iframe';
2577
2578		return type;
2579	}
2580
2581	/**
2582	 * Return value from percent of a number.
2583	 *
2584	 * @param {Number} percent
2585	 * @param {Number} total
2586	 *
2587	 * @return {Number}
2588	 */
2589	function percentToValue(percent, total) {
2590		return parseInt((total / 100) * percent);
2591	}
2592
2593	/**
2594	 * A JavaScript equivalent of PHP’s parse_url.
2595	 *
2596	 * @param {String} url           The URL to parse.
2597	 *
2598	 * @return {Mixed}
2599	 */
2600	function parseURI(url) {
2601		var m = String(url).replace(/^\s+|\s+$/g, '').match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
2602		// authority = '//' + user + ':' + pass '@' + hostname + ':' port
2603		return (m ? {
2604			href: m[0] || '',
2605			protocol: m[1] || '',
2606			authority: m[2] || '',
2607			host: m[3] || '',
2608			hostname: m[4] || '',
2609			port: m[5] || '',
2610			pathname: m[6] || '',
2611			search: m[7] || '',
2612			hash: m[8] || ''
2613		} : null);
2614	}
2615
2616	/**
2617	 * Gets the absolute URI.
2618	 *
2619	 * @param {String} href     The relative URL.
2620	 * @param {String} base     The base URL.
2621	 *
2622	 * @return {String}         The absolute URL.
2623	 */
2624	function absolutizeURI(base, href) { // RFC 3986
2625		var iL = this;
2626
2627		function removeDotSegments(input) {
2628			var output = [];
2629			input.replace(/^(\.\.?(\/|$))+/, '')
2630				.replace(/\/(\.(\/|$))+/g, '/')
2631				.replace(/\/\.\.$/, '/../')
2632				.replace(/\/?[^\/]*/g, function(p) {
2633					if (p === '/..') {
2634						output.pop();
2635					} else {
2636						output.push(p);
2637					}
2638				});
2639			return output.join('').replace(/^\//, input.charAt(0) === '/' ? '/' : '');
2640		}
2641
2642		href = parseURI(href || '');
2643		base = parseURI(base || '');
2644
2645		return !href || !base ? null : (href.protocol || base.protocol) +
2646			(href.protocol || href.authority ? href.authority : base.authority) +
2647			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)) +
2648			(href.protocol || href.authority || href.pathname ? href.search : (href.search || base.search)) +
2649			href.hash;
2650	}
2651
2652	/**
2653	 * A JavaScript equivalent of PHP’s version_compare.
2654	 *
2655	 * @param {String} v1
2656	 * @param {String} v2
2657	 * @param {String} operator
2658	 *
2659	 * @return {Boolean}
2660	 */
2661	function version_compare(v1, v2, operator) {
2662		this.php_js = this.php_js || {};
2663		this.php_js.ENV = this.php_js.ENV || {};
2664		var i = 0,
2665			x = 0,
2666			compare = 0,
2667			vm = {
2668				'dev': -6,
2669				'alpha': -5,
2670				'a': -5,
2671				'beta': -4,
2672				'b': -4,
2673				'RC': -3,
2674				'rc': -3,
2675				'#': -2,
2676				'p': 1,
2677				'pl': 1
2678			},
2679			prepVersion = function(v) {
2680				v = ('' + v).replace(/[_\-+]/g, '.');
2681				v = v.replace(/([^.\d]+)/g, '.$1.').replace(/\.{2,}/g, '.');
2682				return (!v.length ? [-8] : v.split('.'));
2683			},
2684			numVersion = function(v) {
2685				return !v ? 0 : (isNaN(v) ? vm[v] || -7 : parseInt(v, 10));
2686			};
2687		v1 = prepVersion(v1);
2688		v2 = prepVersion(v2);
2689		x = max(v1.length, v2.length);
2690		for (i = 0; i < x; i++) {
2691			if (v1[i] == v2[i]) {
2692				continue;
2693			}
2694			v1[i] = numVersion(v1[i]);
2695			v2[i] = numVersion(v2[i]);
2696			if (v1[i] < v2[i]) {
2697				compare = -1;
2698				break;
2699			} else if (v1[i] > v2[i]) {
2700				compare = 1;
2701				break;
2702			}
2703		}
2704		if (!operator) {
2705			return compare;
2706		}
2707
2708		switch (operator) {
2709			case '>':
2710			case 'gt':
2711				return (compare > 0);
2712			case '>=':
2713			case 'ge':
2714				return (compare >= 0);
2715			case '<=':
2716			case 'le':
2717				return (compare <= 0);
2718			case '==':
2719			case '=':
2720			case 'eq':
2721				return (compare === 0);
2722			case '<>':
2723			case '!=':
2724			case 'ne':
2725				return (compare !== 0);
2726			case '':
2727			case '<':
2728			case 'lt':
2729				return (compare < 0);
2730			default:
2731				return null;
2732		}
2733	}
2734
2735
2736	// Begin the iLightBox plugin
2737	$.fn.iLightBox = function() {
2738
2739		var args = arguments,
2740			opt = ($.isPlainObject(args[0])) ? args[0] : args[1],
2741			items = ($.isArray(args[0]) || typeof args[0] == 'string') ? args[0] : args[1];
2742
2743		if (!opt) opt = {};
2744
2745		// Default options. Play carefully.
2746		var options = $.extend(true, {
2747			attr: 'href',
2748			path: 'vertical',
2749			skin: 'dark',
2750			linkId: false,
2751			infinite: false,
2752			startFrom: 0,
2753			randomStart: false,
2754			keepAspectRatio: true,
2755			maxScale: 1,
2756			minScale: .2,
2757			innerToolbar: false,
2758			smartRecognition: false,
2759			mobileOptimizer: true,
2760			fullAlone: true,
2761			fullViewPort: null,
2762			fullStretchTypes: 'flash, video',
2763			overlay: {
2764				blur: true,
2765				opacity: .85
2766			},
2767			controls: {
2768				arrows: false,
2769				slideshow: false,
2770				toolbar: true,
2771				fullscreen: true,
2772				thumbnail: true,
2773				keyboard: true,
2774				mousewheel: true,
2775				swipe: true
2776			},
2777			keyboard: {
2778				left: true, // previous
2779				right: true, // next
2780				up: true, // previous
2781				down: true, // next
2782				esc: true, // close
2783				shift_enter: true // fullscreen
2784			},
2785			show: {
2786				effect: true,
2787				speed: 300,
2788				title: true
2789			},
2790			hide: {
2791				effect: true,
2792				speed: 300
2793			},
2794			caption: {
2795				start: true,
2796				show: 'mouseenter',
2797				hide: 'mouseleave'
2798			},
2799			social: {
2800				start: true,
2801				show: 'mouseenter',
2802				hide: 'mouseleave',
2803				buttons: false
2804			},
2805			styles: {
2806				pageOffsetX: 0,
2807				pageOffsetY: 0,
2808				nextOffsetX: 45,
2809				nextOffsetY: 0,
2810				nextOpacity: 1,
2811				nextScale: 1,
2812				prevOffsetX: 45,
2813				prevOffsetY: 0,
2814				prevOpacity: 1,
2815				prevScale: 1
2816			},
2817			thumbnails: {
2818				maxWidth: 120,
2819				maxHeight: 80,
2820				normalOpacity: 1,
2821				activeOpacity: .6
2822			},
2823			effects: {
2824				reposition: true,
2825				repositionSpeed: 200,
2826				switchSpeed: 500,
2827				loadedFadeSpeed: 180,
2828				fadeSpeed: 200
2829			},
2830			slideshow: {
2831				pauseTime: 5000,
2832				pauseOnHover: false,
2833				startPaused: true
2834			},
2835			text: {
2836				close: "Press Esc to close",
2837				enterFullscreen: "Enter Fullscreen (Shift+Enter)",
2838				exitFullscreen: "Exit Fullscreen (Shift+Enter)",
2839				slideShow: "Slideshow",
2840				next: "Next",
2841				previous: "Previous"
2842			},
2843			errors: {
2844				loadImage: "An error occurred when trying to load photo.",
2845				loadContents: "An error occurred when trying to load contents.",
2846				missingPlugin: "The content your are attempting to view requires the <a href='{pluginspage}' target='_blank'>{type} plugin<\/a>."
2847			},
2848			ajaxSetup: {
2849				url: '',
2850				beforeSend: function(jqXHR, settings) {},
2851				cache: false,
2852				complete: function(jqXHR, textStatus) {},
2853				crossDomain: false,
2854				error: function(jqXHR, textStatus, errorThrown) {},
2855				success: function(data, textStatus, jqXHR) {},
2856				global: true,
2857				ifModified: false,
2858				username: null,
2859				password: null,
2860				type: 'GET'
2861			},
2862			callback: {}
2863		}, opt);
2864
2865		var instant = ($.isArray(items) || typeof items == 'string') ? true : false;
2866
2867		items = $.isArray(items) ? items : new Array();
2868
2869		if (typeof args[0] == 'string') items[0] = args[0];
2870
2871		if (version_compare($.fn.jquery, '1.8', '>=')) {
2872			var iLB = new iLightBox($(this), options, items, instant);
2873			return {
2874				close: function() {
2875					iLB.closeAction();
2876				},
2877				fullscreen: function() {
2878					iLB.fullScreenAction();
2879				},
2880				moveNext: function() {
2881					iLB.moveTo('next');
2882				},
2883				movePrev: function() {
2884					iLB.moveTo('prev');
2885				},
2886				goTo: function(index) {
2887					iLB.goTo(index);
2888				},
2889				refresh: function() {
2890					iLB.refresh();
2891				},
2892				reposition: function() {
2893					(arguments.length > 0) ? iLB.repositionPhoto(true): iLB.repositionPhoto();
2894				},
2895				setOption: function(options) {
2896					iLB.setOption(options);
2897				},
2898				destroy: function() {
2899					iLB.closeAction();
2900					iLB.dispatchItemsEvents();
2901				}
2902			};
2903		} else {
2904			throw "The jQuery version that was loaded is too old. iLightBox requires jQuery 1.8+";
2905		}
2906
2907	};
2908
2909
2910	$.iLightBox = function() {
2911		return $.fn.iLightBox(arguments[0], arguments[1]);
2912	};
2913
2914
2915	$.extend($.easing, {
2916		easeInCirc: function(x, t, b, c, d) {
2917			return -c * (sqrt(1 - (t /= d) * t) - 1) + b;
2918		},
2919		easeOutCirc: function(x, t, b, c, d) {
2920			return c * sqrt(1 - (t = t / d - 1) * t) + b;
2921		},
2922		easeInOutCirc: function(x, t, b, c, d) {
2923			if ((t /= d / 2) < 1) return -c / 2 * (sqrt(1 - t * t) - 1) + b;
2924			return c / 2 * (sqrt(1 - (t -= 2) * t) + 1) + b;
2925		}
2926	});
2927
2928	function getScrollXY() {
2929		var scrOfX = 0,
2930			scrOfY = 0;
2931		if (typeof(window.pageYOffset) == 'number') {
2932			//Netscape compliant
2933			scrOfY = window.pageYOffset;
2934			scrOfX = window.pageXOffset;
2935		} else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) {
2936			//DOM compliant
2937			scrOfY = document.body.scrollTop;
2938			scrOfX = document.body.scrollLeft;
2939		} else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
2940			//IE6 standards compliant mode
2941			scrOfY = document.documentElement.scrollTop;
2942			scrOfX = document.documentElement.scrollLeft;
2943		}
2944		return {
2945			x: scrOfX,
2946			y: scrOfY
2947		};
2948	}
2949
2950	(function() {
2951		// add new event shortcuts
2952		$.each(("touchstart touchmove touchend " +
2953			"tap taphold " +
2954			"swipe swipeleft swiperight " +
2955			"scrollstart scrollstop").split(" "), function(i, name) {
2956
2957			$.fn[name] = function(fn) {
2958				return fn ? this.bind(name, fn) : this.trigger(name);
2959			};
2960
2961			// jQuery < 1.8
2962			if ($.attrFn) {
2963				$.attrFn[name] = true;
2964			}
2965		});
2966
2967		var tapSettings = {
2968			startEvent: 'touchstart.iTap',
2969			endEvent: 'touchend.iTap'
2970		};
2971
2972		// tap Event:
2973		$.event.special.itap = {
2974			setup: function() {
2975
2976				var self = this,
2977					$self = $(this),
2978					start, stop;
2979
2980				$self.bind(tapSettings.startEvent, function(event) {
2981					start = getScrollXY();
2982
2983					$self.one(tapSettings.endEvent, function(event) {
2984						stop = getScrollXY();
2985
2986						var orgEvent = event || window.event;
2987						event = $.event.fix(orgEvent);
2988						event.type = "itap";
2989
2990						if ((start && stop) && (start.x == stop.x && start.y == stop.y))($.event.dispatch || $.event.handle).call(self, event);
2991
2992						start = stop = undefined;
2993					});
2994				});
2995			},
2996
2997			teardown: function() {
2998				$(this).unbind(tapSettings.startEvent);
2999			}
3000		};
3001	}());
3002
3003
3004	//Fullscreen API
3005	(function() {
3006		fullScreenApi = {
3007				supportsFullScreen: false,
3008				isFullScreen: function() {
3009					return false;
3010				},
3011				requestFullScreen: function() {},
3012				cancelFullScreen: function() {},
3013				fullScreenEventName: '',
3014				prefix: ''
3015			},
3016			browserPrefixes = 'webkit moz o ms khtml'.split(' ');
3017
3018		// check for native support
3019		if (typeof document.cancelFullScreen != 'undefined') {
3020			fullScreenApi.supportsFullScreen = true;
3021		} else {
3022			// check for fullscreen support by vendor prefix
3023			for (var i = 0, il = browserPrefixes.length; i < il; i++) {
3024				fullScreenApi.prefix = browserPrefixes[i];
3025
3026				if (typeof document[fullScreenApi.prefix + 'CancelFullScreen'] != 'undefined') {
3027					fullScreenApi.supportsFullScreen = true;
3028
3029					break;
3030				}
3031			}
3032		}
3033
3034		// update methods to do something useful
3035		if (fullScreenApi.supportsFullScreen) {
3036			fullScreenApi.fullScreenEventName = fullScreenApi.prefix + 'fullscreenchange';
3037
3038			fullScreenApi.isFullScreen = function() {
3039				switch (this.prefix) {
3040					case '':
3041						return document.fullScreen;
3042					case 'webkit':
3043						return document.webkitIsFullScreen;
3044					default:
3045						return document[this.prefix + 'FullScreen'];
3046				}
3047			}
3048			fullScreenApi.requestFullScreen = function(el) {
3049				return (this.prefix === '') ? el.requestFullScreen() : el[this.prefix + 'RequestFullScreen']();
3050			}
3051			fullScreenApi.cancelFullScreen = function(el) {
3052				return (this.prefix === '') ? document.cancelFullScreen() : document[this.prefix + 'CancelFullScreen']();
3053			}
3054		}
3055	}());
3056
3057	// Browser detect
3058	(function() {
3059		function uaMatch(ua) {
3060			ua = ua.toLowerCase();
3061
3062			var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
3063				/(webkit)[ \/]([\w.]+)/.exec(ua) ||
3064				/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
3065				/(msie) ([\w.]+)/.exec(ua) ||
3066				ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || [];
3067
3068			return {
3069				browser: match[1] || "",
3070				version: match[2] || "0"
3071			};
3072		}
3073
3074		var matched = uaMatch(navigator.userAgent);
3075		browser = {};
3076
3077		if (matched.browser) {
3078			browser[matched.browser] = true;
3079			browser.version = matched.version;
3080		}
3081
3082		// Chrome is Webkit, but Webkit is also Safari.
3083		if (browser.chrome) {
3084			browser.webkit = true;
3085		} else if (browser.webkit) {
3086			browser.safari = true;
3087		}
3088	}());
3089
3090	// Feature detects
3091	(function() {
3092		var prefixes = ['', 'webkit', 'moz', 'ms', 'o'];
3093		var el = document.createElement('div');
3094
3095		function testProp(prop) {
3096			for (var p = 0, pl = prefixes.length; p < pl; p++) {
3097				var prefixedProp = prefixes[p] ? prefixes[p] + prop.charAt(0).toUpperCase() + prop.slice(1) : prop;
3098				if (el.style[prefixedProp] !== undefined) {
3099					return prefixedProp;
3100				}
3101			}
3102		}
3103
3104		// Global support indicators
3105		transform = testProp('transform') || '';
3106		gpuAcceleration = testProp('perspective') ? 'translateZ(0) ' : '';
3107	}());
3108
3109
3110	/*
3111		PluginDetect v0.7.9
3112		www.pinlady.net/PluginDetect/license/
3113		[ getVersion onWindowLoaded BetterIE ]
3114		[ Flash QuickTime Shockwave ]
3115	*/
3116	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;
3116d++){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);
3116d.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)}
3116c.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;
3116if(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();
3117
3118	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)};
3119
3120
3121	/*
3122		jQuery hashchange event v1.3
3123		https://github.com/cowboy/jquery-hashchange
3124		Copyright (c) 2010 "Cowboy" Ben Alman
3125		Dual licensed under the MIT and GPL licenses.
3126	*/
3127	(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=
3128	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||
3129	"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;
3129a!==d&&(b.title=k.title,b.open(),e&&b.write('<script>document.domain="'+e+'"\x3c/script>'),b.close(),c.location.hash=a)}}();return h}()})();
3130
3131	if (!Array.prototype.filter) {
3132		Array.prototype.filter = function(fun /*, thisp */ ) {
3133			"use strict";
3134
3135			if (this == null)
3136				throw new TypeError();
3137
3138			var t = Object(this);
3139			var len = t.length >>> 0;
3140			if (typeof fun != "function")
3141				throw new TypeError();
3142
3143			var res = [];
3144			var thisp = arguments[1];
3145			for (var i = 0; i < len; i++) {
3146				if (i in t) {
3147					var val = t[i]; // in case fun mutates this
3148					if (fun.call(thisp, val, i, t))
3149						res.push(val);
3150				}
3151			}
3152
3153			return res;
3154		};
3155	}
3156
3157	if (!Array.prototype.indexOf) {
3158		Array.prototype.indexOf = function(searchElement, fromIndex) {
3159			var k;
3160
3161			if (this == null) {
3162				throw new TypeError('"this" is null or not defined');
3163			}
3164
3165			var O = Object(this);
3166
3167			var len = O.length >>> 0;
3168
3169			if (len === 0) {
3170				return -1;
3171			}
3172
3173			var n = +fromIndex || 0;
3174
3175			if (abs(n) === Infinity) {
3176				n = 0;
3177			}
3178
3179			if (n >= len) {
3180				return -1;
3181			}
3182
3183			k = max(n >= 0 ? n : len - abs(n), 0);
3184
3185			while (k < len) {
3186				var kValue;
3187				if (k in O && O[k] === searchElement) {
3188					return k;
3189				}
3190				k++;
3191			}
3192			return -1;
3193		};
3194	}
3195
3196	if (!Array.prototype.lastIndexOf) {
3197		Array.prototype.lastIndexOf = function(searchElement /*, fromIndex*/ ) {
3198			"use strict";
3199
3200			if (this == null)
3201				throw new TypeError();
3202
3203			var t = Object(this);
3204			var len = t.length >>> 0;
3205			if (len === 0)
3206				return -1;
3207
3208			var n = len;
3209			if (arguments.length > 1) {
3210				n = Number(arguments[1]);
3211				if (n != n)
3212					n = 0;
3213				else if (n != 0 && n != (1 / 0) && n != -(1 / 0))
3214					n = (n > 0 || -1) * floor(abs(n));
3215			}
3216
3217			var k = n >= 0 ? min(n, len - 1) : len - abs(n);
3218
3219			for (; k >= 0; k--) {
3220				if (k in t && t[k] === searchElement)
3221					return k;
3222			}
3223			return -1;
3224		};
3225	}
3226})(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.