PageSourceSearch

https://networkreeds.org/Library/iLightBox/src/js/ilightbox.js?v=1

js networkreeds.org collected 2026-10-04 01:34:49 UTC 124,796 bytes, 3,224 lines download raw bytes

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

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.