PageSourceSearch

https://www.liaentries.com/scripts/html5lightbox/html5lightbox.min.js

js liaentries.com collected 2026-09-24 18:37:31 UTC 160,597 bytes, 2,738 lines download raw bytes

1/** HTML5 LightBox - jQuery Image and Video LightBox Plugin
2 * Copyright 2014 Magic Hills Pty Ltd All Rights Reserved
3 * Website: http://html5box.com
4 * Version 7.5 
5 */
6(function() {
7    var scripts = document.getElementsByTagName("script");
8    var jsFolder = "/scripts/html5lightbox/";
9    for (var i = 0; i < scripts.length; i++)
10        if (scripts[i].src && scripts[i].src.match(/html5lightbox\.js/i)) jsFolder = scripts[i].src.substr(0, scripts[i].src.lastIndexOf("/") + 1);
11    var loadjQuery = false;
12    if (typeof jQuery == "undefined") loadjQuery = true;
13    else {
14        var jVersion = jQuery.fn.jquery.split(".");
15        if (jVersion[0] < 1 || jVersion[0] == 1 && jVersion[1] < 6) loadjQuery = true
16    }
17    if (loadjQuery) {
18        var head = document.getElementsByTagName("head")[0];
19        var script = document.createElement("script");
20        script.setAttribute("type", "text/javascript");
21        if (script.readyState) script.onreadystatechange = function() {
22            if (script.readyState == "loaded" || script.readyState == "complete") {
23                script.onreadystatechange = null;
24                loadHtml5LightBox(jsFolder)
25            }
26        };
27        else script.onload = function() {
28            loadHtml5LightBox(jsFolder)
29        };
30        script.setAttribute("src", jsFolder + "jquery.js");
31        head.appendChild(script)
32    } else loadHtml5LightBox(jsFolder)
33})();
34
35function loadHtml5LightBox(jsFolder) {
36    (function($) {
37        $.fn.html5lightbox = function(options) {
38            var inst = this;
39            inst.options = $.extend({
40                freelink: "http://html5box.com/",
41                defaultvideovolume: 1,
42                autoclose: false,
43                autoclosedelay: 0,
44                resizedelay: 100,
45                insideiframe: false,
46                autoresizecontent: true,
47                defaultwidth: 960,
48                defaultheight: 540,
49                autoplay: true,
50                loopvideo: false,
51                html5player: true,
52                responsive: true,
53                nativehtml5controls: false,
54                videohidecontrols: false,
55                nativecontrolsonfirefox: true,
56                nativecontrolsonie: true,
57                nativecontrolsonandroid: true,
58                imagekeepratio: true,
59                maxheight: false,
60                elemautoheight: false,
61                useflashonie9: true,
62                useflashonie10: true,
63                useflashonie11: false,
64                useflashformp4onfirefox: false,
65                transition: "none",
66                transitionduration: 400,
67                enablepdfjs: true,
68                pdfjsengine: "",
69                openpdfinnewtaboniphone: false,
70                openpdfinnewtabonipad: false,
71                googleanalyticsaccount: "",
72                arrowloop: true,
73                showall: false,
74                userelforgroup: true,
75                shownavigation: true,
76                thumbwidth: 96,
77                thumbheight: 72,
78                thumbgap: 4,
79                thumbtopmargin: 12,
80                thumbbottommargin: 12,
81                thumbborder: 1,
82                thumbbordercolor: "transparent",
83                thumbhighlightbordercolor: "#fff",
84                thumbopacity: 1,
85                navbuttonwidth: 32,
86                navbgcolor: "rgba(0,0,0,0.2)",
87                shownavcontrol: true,
88                navcontrolimage: "lightbox-navcontrol.png",
89                hidenavdefault: false,
90                overlaybgcolor: "#000",
91                overlayopacity: 0.9,
92                bgcolor: "#fff",
93                bordersize: 8,
94                borderradius: 0,
95                bordermargin: 16,
96                bordertopmargin: 48,
97                bordertopmarginsmall: 48,
98                barautoheight: true,
99                barheight: 64,
100                responsivebarheight: false,
101                smallscreenheight: 415,
102                barheightonsmallheight: 64,
103                notkeepratioonsmallheight: false,
104                loadingwidth: 64,
105                loadingheight: 64,
106                resizespeed: 400,
107                fadespeed: 400,
108                jsfolder: jsFolder,
109                skinsfoldername: "skins/default/",
110                loadingimage: "lightbox-loading.gif",
111                nextimage: "lightbox-next.png",
112                previmage: "lightbox-prev.png",
113                closeimage: "lightbox-close.png",
114                playvideoimage: "lightbox-playvideo.png",
115                titlebgimage: "lightbox-titlebg.png",
116                navarrowsprevimage: "lightbox-navprev.png",
117                navarrowsnextimage: "lightbox-navnext.png",
118                navarrowsalwaysshowontouch: true,
119                navarrowsbottomscreenwidth: 479,
120                closeonoverlay: true,
121                alwaysshownavarrows: false,
122                showplaybutton: true,
123                playimage: "lightbox-play.png",
124                pauseimage: "lightbox-pause.png",
125                fullscreenmode: false,
126                fullscreencloseimage: "lightbox-close-fullscreen.png",
127                fullscreennextimage: "lightbox-next-fullscreen.png",
128                fullscreenprevimage: "lightbox-prev-fullscreen.png",
129                fullscreennomargin: false,
130                fullscreenmodeonsmallscreen: false,
131                fullscreennomarginonsmallscreen: false,
132                fullscreensmallscreenwidth: 736,
133                fullscreenbgcolor: "rgba(0, 0, 0, 0.9)",
134                fullscreennomargintextinside: false,
135                videobgcolor: "#000",
136                html5videoposter: "",
137                showtitle: true,
138                titlestyle: "bottom",
139                titleinsidecss: "color:#fff; font-size:16px; font-family:Arial,Helvetica,sans-serif; overflow:hidden; text-align:left; margin:4px 8px;",
140                titlebottomcss: "color:#333; font-size:16px; font-family:Arial,Helvetica,sans-serif; overflow:hidden; text-align:left;",
141                showdescription: true,
142                descriptioninsidecss: "color:#fff; font-size:12px; font-family:Arial,Helvetica,sans-serif; overflow:hidden; text-align:left; margin:4px 0px 0px; padding: 0px;",
143                descriptionbottomcss: "color:#333; font-size:12px; font-family:Arial,Helvetica,sans-serif; overflow:hidden; text-align:left; margin:4px 0px 0px; padding: 0px;",
144                fullscreentitlebottomcss: "color:#fff; font-size:16px; font-family:Arial,Helvetica,sans-serif; overflow:hidden; text-align:left; margin:4px 8px 8px;",
145                fullscreendescriptionbottomcss: "color:#fff; font-size:12px; font-family:Arial,Helvetica,sans-serif; overflow:hidden; text-align:left; margin:4px 0px 0px; padding: 0px;",
146                showsocialmedia: true,
147                socialmediaposition: "position:absolute;top:8px;right:8px;",
148                showtitleprefix: true,
149                titleprefix: "%NUM / %TOTAL",
150                autoslide: false,
151                slideinterval: 5E3,
152                showtimer: true,
153                timerposition: "bottom",
154                timerheight: 2,
155                timercolor: "#dc572e",
156                timeropacity: 1,
157                initvimeo: true,
158                inityoutube: true,
159                swipepreventdefaultonandroid: false,
160                initsocial: true,
161                showsocial: false,
162                socialposition: "position:absolute;top:100%;right:0;",
163                socialpositionsmallscreen: "position:absolute;top:100%;right:0;left:0;",
164                socialdirection: "horizontal",
165                socialbuttonsize: 32,
166                socialbuttonfontsize: 18,
167                socialrotateeffect: true,
168                showfacebook: true,
169                showtwitter: true,
170                showpinterest: true,
171                showemail: false,
172                imagepercentage: 75,
173                sidetobottomscreenwidth: 479,
174                errorwidth: 280,
175                errorheight: 48,
176                errorcss: "text-align:center; color:#ff0000; font-size:14px; font-family:Arial, sans-serif;",
177                enabletouchswipe: true,
178                mobileresizeevent: false,
179                swipedistance: 0,
180                bodynoscroll: false,
181                useabsolutepos: false,
182                useabsoluteposonmobile: false,
183                supportesckey: true,
184                supportarrowkeys: true,
185                version: "3.3",
186                stamp: false,
187                freemark: "72,84,77,76,53,32,76,105,103,104,116,98,111,120,32,70,114,101,101,32,86,101,114,115,105,111,110",
188                watermark: "",
189                watermarklink: ""
190            }, options);
191            if (typeof html5lightbox_options != "undefined" && html5lightbox_options) $.extend(inst.options, html5lightbox_options);
192            if ($("div.html5lightbox_options").length) $.each($("div.html5lightbox_options").data(), function(key,
193                value) {
194                inst.options[key.toLowerCase()] = value
195            });
196            if ($("div#html5lightbox_options").length) $.each($("div#html5lightbox_options").data(), function(key, value) {
197                inst.options[key.toLowerCase()] = value
198            });
199            if ($("div#html5lightbox_general_options").length) $.each($("div#html5lightbox_general_options").data(), function(key, value) {
200                inst.options[key.toLowerCase()] = value
201            });
202            var DEFAULT_WIDTH = inst.options.defaultwidth;
203            var DEFAULT_HEIGHT = inst.options.defaultheight;
204            var ELEM_TYPE = 0,
205                ELEM_HREF = 1,
206                ELEM_TITLE = 2,
207                ELEM_GROUP = 3,
208                ELEM_WIDTH =
209                4,
210                ELEM_HEIGHT = 5,
211                ELEM_HREF_WEBM = 6,
212                ELEM_HREF_OGG = 7,
213                ELEM_THUMBNAIL = 8,
214                ELEM_DESCRIPTION = 9,
215                ELEM_DIV = 10,
216                ELEM_ORIGINALWIDTH = 11,
217                ELEM_ORIGINALHEIGHT = 12,
218                ELEM_SOCIALMEDIA = 13;
219            inst.options.types = ["IMAGE", "FLASH", "VIDEO", "YOUTUBE", "VIMEO", "PDF", "MP3", "WEB", "FLV", "DAILYMOTION", "DIV", "WISTIA", "IFRAMEVIDEO"];
220            inst.options.htmlfolder = window.location.href.substr(0, window.location.href.lastIndexOf("/") + 1);
221            inst.options.skinsfolder = inst.options.skinsfoldern
221ame;
222            if (inst.options.skinsfolder.length > 0 && inst.options.skinsfolder[inst.options.skinsfolder.length -
223                    1] != "/") inst.options.skinsfolder += "/";
224            if (inst.options.skinsfolder.charAt(0) != "/" && inst.options.skinsfolder.substring(0, 5) != "http:" && inst.options.skinsfolder.substring(0, 6) != "https:") inst.options.skinsfolder = inst.options.jsfolder + inst.options.skinsfolder;
225            var image_list = ["loadingimage", "nextimage", "previmage", "closeimage", "playvideoimage", "titlebgimage", "navarrowsprevimage", "navarrowsnextimage", "navcontrolimage", "playimage", "pauseimage", "fullscreencloseimage", "fullscreennextimage", "fullscreenprevimage"];
226            for (var i = 0; i < image_list.length; i++)
227                if (inst.options[image_list[i]])
228                    if (inst.options[image_list[i]].substring(0, 7).toLowerCase() != "http://" && inst.options[image_list[i]].substring(0, 8).toLowerCase() != "https://") inst.options[image_list[i]] = inst.options.skinsfolder + inst.options[image_list[i]];
229            var i;
230            var l;
231            var mark = "";
232            var bytes = inst.options.freemark.split(",");
233            for (i = 0; i < bytes.length; i++) mark += String.fromCharCode(bytes[i]);
234            inst.options.freemark = mark;
235            var d0 = "hmtamgli5cboxh.iclolms";
236            for (i = 1; i <= 5; i++) d0 = d0.slice(0,
237                i) + d0.slice(i + 1);
238            l = d0.length;
239            for (i = 0; i < 5; i++) d0 = d0.slice(0, l - 9 + i) + d0.slice(l - 8 + i);
240            if (inst.options.htmlfolder.indexOf(d0) != -1) inst.options.stamp = false;
241            inst.options.flashInstalled = false;
242            try {
243                if (new ActiveXObject("ShockwaveFlash.ShockwaveFlash")) inst.options.flashInstalled = true
244            } catch (e) {
245                if (navigator.mimeTypes["application/x-shockwave-flash"]) inst.options.flashInstalled = true
246            }
247            inst.options.html5VideoSupported = !!document.createElement("video").canPlayType;
248            inst.options.isChrome = navigator.userAgent.match(/Chrome/i) !=
249                null;
250            inst.options.isFirefox = navigator.userAgent.match(/Firefox/i) != null;
251            inst.options.isOpera = navigator.userAgent.match(/Opera/i) != null || navigator.userAgent.match(/OPR\//i) != null;
252            inst.options.isSafari = navigator.userAgent.match(/Safari/i) != null;
253            inst.options.isIE11 = navigator.userAgent.match(/Trident\/7/) != null && navigator.userAgent.match(/rv:11/) != null;
254            inst.options.isIE = navigator.userAgent.match(/MSIE/i) != null && !inst.options.isOpera;
255            inst.options.isIE10 = navigator.userAgent.match(/MSIE 10/i) != null && !this.options.isOpera;
256            inst.options.isIE9 = navigator.userAgent.match(/MSIE 9/i) != null && !inst.options.isOpera;
257            inst.options.isIE8 = navigator.userAgent.match(/MSIE 8/i) != null && !inst.options.isOpera;
258            inst.options.isIE7 = navigator.userAgent.match(/MSIE 7/i) != null && !inst.options.isOpera;
259            inst.options.isIE6 = navigator.userAgent.match(/MSIE 6/i) != null && !inst.options.isOpera;
260            inst.options.isIE678 = inst.options.isIE6 || inst.options.isIE7 || inst.options.isIE8;
261            inst.options.isIE6789 = inst.options.isIE6 || inst.options.isIE7 || inst.options.isIE8 ||
262                inst.options.isIE9;
263            inst.options.isAndroid = navigator.userAgent.match(/Android/i) != null;
264            inst.options.isIPad = navigator.userAgent.match(/iPad/i) != null;
265            inst.options.isIPhone = navigator.userAgent.match(/iPod/i) != null || navigator.userAgent.match(/iPhone/i) != null;
266            inst.options.isIOS = inst.options.isIPad || inst.options.isIPhone;
267            inst.options.isMobile = inst.options.isAndroid || inst.options.isIPad || inst.options.isIPhone;
268            inst.options.isIOSLess5 = inst.options.isIPad && inst.options.isIPhone && (navigator.userAgent.match(/OS 4/i) !=
269                null || navigator.userAgent.match(/OS 3/i) != null);
270            inst.options.supportCSSPositionFixed = !inst.options.isIE6 && !inst.options.isIOSLess5;
271            inst.options.iequirksmode = inst.options.isIE6789 && document.compatMode != "CSS1Compat";
272            inst.options.isTouch = "ontouchstart" in window;
273            if (inst.options.isAndroid) {
274                var match = navigator.userAgent.match(/Android\s([0-9\.]*)/i);
275                inst.options.androidVersion = match && match.length >= 2 ? parseInt(match[1], 10) : -1
276            }
277            var v = document.createElement("video");
278            inst.options.canplaymp4 = v && v.canPlayType &&
279                v.canPlayType("video/mp4").replace(/no/, "");
280            if (inst.options.isMobile) inst.options.autoplay = false;
281            if (inst.options.isFirefox && inst.options.nativecontrolsonfirefox || inst.options.isAndroid && inst.options.nativecontrolsonandroid) inst.options.nativehtml5controls = true;
282            if ((inst.options.isIE6789 || inst.options.isIE10 || inst.options.isIE11) && inst.options.nativecontrolsonie) inst.options.nativehtml5controls = true;
283            inst.options.navheight = 0;
284            inst.options.thumbgap += 2 * inst.options.thumbborder;
285            inst.options.resizeTimeout = -1;
286            inst.slideTimeout = null;
287            inst.autosliding = false;
288            inst.existingElem = -1;
289            inst.direction = -3;
290            inst.elemArray = new Array;
291            inst.options.curElem = -1;
292            inst.defaultoptions = $.extend({}, inst.options);
293            if (inst.options.googleanalyticsaccount && !window._gaq) {
294                window._gaq = window._gaq || [];
295                window._gaq.push(["_setAccount", inst.options.googleanalyticsaccount]);
296                window._gaq.push(["_trackPageview"]);
297                $.getScript("https://ssl.google-analytics.com/ga.js")
298            }
299            if (inst.options.initvimeo) {
300                var tag = document.createElement("script");
301                tag.src =
302                    inst.options.jsfolder + "froogaloop2.min.js";
303                var firstScriptTag = document.getElementsByTagName("script")[0];
304                firstScriptTag.parentNode.insertBefore(tag, firstScriptTag)
305            }
306            if (inst.options.inityoutube) {
307                var tag = document.createElement("script");
308                tag.src = "https://www.youtube.com/iframe_api";
309                var firstScriptTag = document.getElementsByTagName("script")[0];
310                firstScriptTag.parentNode.insertBefore(tag, firstScriptTag)
311            }
312            if (inst.options.initsocial) $("head").append('<link rel="stylesheet" href="' + inst.options.jsfolder + 'icons/css/fontello.css" type="text/css" />');
313            inst.showing = false;
314            inst.navvisible = false;
315            inst.disableEscKey = function(isFullscreen) {
316                if (isFullscreen) inst.disableesckeyinfullscreen = true;
317                else setTimeout(function() {
318                    inst.disableesckeyinfullscreen = false
319                }, 1E3)
320            };
321            inst.supportKeyboard = function() {
322                inst.disableesckeyinfullscreen = false;
323                $(document).keyup(function(e) {
324                    if (!inst.showing) return;
325                    if (!inst.disableesckeyinfullscreen && inst.options.supportesckey && e.keyCode == 27) inst.finish();
326                    else if (inst.options.supportarrowkeys)
327                        if (e.keyCode == 39) inst.gotoSlide(-1);
328                        else if (e.keyCode ==
329                        37) inst.gotoSlide(-2)
330                });
331                if (inst.options.supportesckey) {
332                    document.addEventListener("MSFullscreenChange", function() {
333                        inst.disableEscKey(document.msFullscreenElement != null)
334                    }, false);
335                    document.addEventListener("webkitfullscreenchange", function() {
336                        inst.disableEscKey(document.webkitIsFullScreen)
337                    }, false)
338                }
339            };
340            inst.supportKeyboard();
341            inst.init = function() {
342                inst.showing = false;
343                inst.readData();
344                inst.createMarkup();
345                inst.initSlide()
346            };
347            inst.readData = function() {
348                inst.each(function() {
349                    if (this.nodeName.toLowerCase() != "a" && this.nodeName.toLowerCase() !=
350                        "area") return;
351                    var $this = $(this);
352                    var fileType = "mediatype" in $this.data() ? $this.data("mediatype") : inst.checkType($this.attr("href"));
353                    if (fileType < 0) return;
354                    var title = $this.data("title") ? $this.data("title") : $this.attr("title");
355                    var group = $this.data("group") ? $this.data("group") : inst.options.userelforgroup ? $this.attr("rel") : null;
356                    for (var i = 0; i < inst.elemArray.length; i++)
357                        if ($this.attr("href") == inst.elemArray[i][ELEM_HREF]) {
358                            inst.elemArray[i][ELEM_TITLE] = title;
359                            inst.elemArray[i][ELEM_GROUP] = group;
360                            return
361                        }
362                    inst.elemArray.push(new Array(fileType,
363                        $this.attr("href"), title, group, $this.data("width"), $this.data("height"), $this.data("webm"), $this.data("ogg"), $this.data("thumbnail"), $this.data("description"), null, null, null, $this.data("socialmedia")))
364                })
365            };
366            inst.createMarkup = function() {
367                if ($(window).width() <= inst.options.fullscreensmallscreenwidth) {
368                    if (inst.options.fullscreenmodeonsmallscreen) {
369                        inst.options.fullscreenmode = true;
370                        if (inst.options.fullscreennomarginonsmallscreen) inst.options.fullscreennomargin = true
371                    }
372                    if (inst.options.fullscreenmode && inst.options.fullscreennomarginonsmallscreen) inst.options.fullscreennomargin =
373                        true
374                }
375                if (inst.options.fullscreenmode && inst.options.fullscreennomargin) {
376                    inst.options.bgcolor = inst.options.fullscreenbgcolor;
377                    inst.options.bordersize = 0;
378                    inst.options.bordermargin = 0;
379                    inst.options.bordertopmargin = 0;
380                    inst.options.bordertopmarginsmall = 0;
381                    if (inst.options.fullscreennomargintextinside) inst.options.titlestyle = "inside";
382                    else {
383                        inst.options.titlebottomcss = inst.options.fullscreentitlebottomcss;
384                        inst.options.descriptionbottomcss = inst.options.fullscreendescriptionbottomcss
385                    }
386                }
387                inst.options.barheightoriginal =
388                    inst.options.barheight;
389                if (inst.options.responsivebarheight) {
390                    var winH = $(window).height();
391                    if (winH <= inst.options.smallscreenheight) inst.options.barheight = inst.options.barheightonsmallheight
392                }
393                if (!inst.options.titlecss) inst.options.titlecss = inst.options.titlestyle == "inside" ? inst.options.titleinsidecss : inst.options.titlebottomcss;
394                if (!inst.options.descriptioncss) inst.options.descriptioncss = inst.options.titlestyle == "inside" ? inst.options.descriptioninsidecss : inst.options.descriptionbottomcss;
395                inst.options.titlecss =
396                    $.trim(inst.options.titlecss);
397                if (inst.options.titlecss.length > 1) {
398                    if (inst.options.titlecss.charAt(0) == "{") inst.options.titlecss = inst.options.titlecss.substring(1);
399                    if (inst.options.titlecss.charAt(inst.options.titlecss.length - 1) == "}") inst.options.titlecss = inst.options.titlecss.substring(0, inst.options.titlecss.length - 1)
400                }
401                inst.options.descriptioncss = $.trim(inst.options.descriptioncss);
402                if (inst.options.descriptioncss.length > 1) {
403                    if (inst.options.descriptioncss.charAt(0) == "{") inst.options.descriptioncss = inst.options.descriptioncss.substring(1);
404                    if (inst.options.descriptioncss.charAt(inst.options.descriptioncss.length - 1) == "}") inst.options.descriptioncss = inst.options.descriptioncss.substring(0, inst.options.descriptioncss.length - 1)
405                }
406                inst.options.errorcss = $.trim(inst.options.errorcss);
407                if (inst.options.errorcss.length > 1) {
408                    if (inst.options.errorcss.charAt(0) == "{") inst.options.errorcss = inst.options.errorcss.substring(1);
409                    if (inst.options.errorcss.charAt(inst.options.errorcss.length - 1) == "}") inst.options.errorcss = inst.options.errorcss.substring(0, inst.options.errorcss.length -
410                        1)
411                }
412                var styleCss = ".bodynoscroll {height:100%;overflow:hidden;}";
413                styleCss += ".html5-hide {display:none !important;} #html5box-html5-lightbox .html5-text {" + inst.options.titlecss + "}";
414                styleCss += "#html5box-html5-lightbox .html5-description {" + inst.options.descriptioncss + "}";
415                styleCss += "#html5box-html5-lightbox .html5-error {" + inst.options.errorcss + "}";
416                if (inst.options.navarrowsalwaysshowontouch || inst.options.alwaysshownavarrows) {
417                    styleCss += "#html5box-html5-lightbox .html5-prev-touch {left
417:0px;top:50%;margin-top:-16px;margin-left:-32px;} #html5box-html5-lightbox .html5-next-touch {right:0px;top:50%;margin-top:-16px;margin-right:-32px;}";
418                    styleCss += "@media (max-width: " + inst.options.navarrowsbottomscreenwidth + "px) { #html5box-html5-lightbox .html5-prev-touch {top:100%;left:0;margin:0;} #html5box-html5-lightbox .html5-next-touch {top:100%;right:0;margin:0;} }"
419                }
420                styleCss += "#html5box-html5-lightbox .html5-prev-fullscreen {display:block;} #html5box-html5-lightbox .html5-next-fullscreen {display:block;} #html5box-html5-lightbox .html5-prev-bottom-fullscreen {display:none;} #html5box-html5-lightbox .html5-next-bottom-fullscreen {display:none;}";
421                styleCss += "@media (max-width: " + inst.options.navarrowsbottomscreenwidth + "px) {#html5box-html5-lightbox .html5-prev-fullscreen {display:none;} #html5box-html5-lightbox .html5-next-fullscreen {display:none;} #html5box-html5-lightbox .html5-prev-bottom-fullscreen {display:block;} #html5box-html5-lightbox .html5-next-bottom-fullscreen {display:block;} }";
422                if (inst.options.titlestyle == "right") {
423                    styleCss += "#html5box-html5-lightbox .html5-elem-wrap {width:" + inst.options.imagepercentage + "%;height:100%;} #html5box-html5-lightbox .html5-elem-data-box {min-height:100%;}";
424                    styleCss += "@media (max-width: " + inst.options.sidetobottomscreenwidth + "px) {#html5box-html5-lightbox .html5-elem-wrap {width:100%;height:auto;} #html5box-html5-lightbox .html5-elem-data-box {width:100%;height:auto;min-height:0;}}"
425                } else if (inst.options.titlestyle == "left") {
426                    styleCss += "#html5box-html5-lightbox .html5-elem-wrap {height:100%;} #html5box-html5-lightbox .html5-elem-data-box {width:" + String(100 - inst.options.imagepercentage) + "%;min-height:100%;}";
427                    styleCss += "@media (max-width: " + inst.options.sidetobottomscreenwidth +
428                        "px) {#html5box-html5-lightbox .html5-elem-wrap {width:100%;height:auto;} #html5box-html5-lightbox .html5-elem-data-box {width:100%;height:auto;min-height:0;}}"
429                }
430                styleCss += ".html5-rotate { border-radius:50%; -webkit-transition:-webkit-transform .4s ease-in; transition: transform .4s ease-in; } .html5-rotate:hover { -webkit-transform: rotate(360deg); transform: rotate(360deg); }";
431                styleCss += "@media (max-width: " + inst.options.navarrowsbottomscreenwidth + "px) {#html5-social {" + inst.options.socialpositionsmallscreen +
432                    "}}";
433                $("head").append("<style type='text/css' data-creator='html5box-html5-lightbox'>" + styleCss + "</style>");
434                var elemheight = inst.options.elemautoheight ? "auto" : "100%";
435                inst.$lightbox = $("<div id='html5box-html5-lightbox' style='display:none;top:0px;left:0px;width:100%;height:100%;z-index:9999998;text-align:center;'>" + "<div id='html5-lightbox-overlay' style='display:block;position:absolute;top:0px;left:0px;width:100%;min-height:100%;background-color:" + inst.options.overlaybgcolor + ";opacity:" + inst.options.overlayopacity +
436                    ";filter:alpha(opacity=" + Math.round(inst.options.overlayopacity * 100) + ");'></div>" + "<div id='html5-lightbox-box' style='display:block;position:relative;margin:0px auto;'>" + "<div class='html5-elem-box' style='display:block;position:relative;width:100%;overflow-x:hidden;overflow-y:auto;height:" + elemheight + ";margin:0px auto;text-align:center;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;'>" + "<div class='html5-elem-wrap' style='display:block;position:relative;margin:0px auto;text-align:center;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;background-color:" +
437                    inst.options.bgcolor + ";'>" + "<div class='html5-loading' style='display:none;position:absolute;top:0px;left:0px;text-align:center;width:100%;height:100%;background:url(\"" + inst.options.loadingimage + "\") no-repeat center center;'></div>" + "<div class='html5-error-box html5-error' style='display:none;position:absolute;padding:" + inst.options.bordersize + "px;text-align:center;
437width:" + inst.options.errorwidth + "px;height:" + inst.options.errorheight + "px;'>" + "The requested content cannot be loaded.<br />Please try again later." +
438                    "</div>" + "<div class='html5-image' style='display:none;position:relative;top:0px;left:0px;width:100%;height:100%;" + (inst.options.iequirksmode ? "margin" : "padding") + ":" + inst.options.bordersize + "px;text-align:center;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;'></div>" + "</div>" + "</div>" + "<div id='html5-watermark' style='display:none;position:absolute;left:" + String(inst.options.bordersize + 2) + "px;top:" + String(inst.options.bordersize + 2) + "px;'></div>" + "</div>" + "</div>");
439                inst.options.positionFixed = inst.options.supportCSSPositionFixed && inst.options.responsive && !inst.options.iequirksmode;
440                if (inst.options.useabsolutepos || inst.options.useabsoluteposonmobile && inst.options.isMobile) inst.options.positionFixed = false;
441                if (!inst.options.positionFixed) inst.options.bodynoscroll = true;
442                inst.$lightbox.css({
443                    position: inst.options.positionFixed ? "fixed" : "absolute"
444                });
445                inst.$lightbox.appendTo("body");
446                inst.$lightboxBox = $("#html5-lightbox-box", inst.$lightbox);
447                inst.$elem = $(".html5-elem-box",
448                    inst.$lightbox);
449                inst.$elemWrap = $(".html5-elem-wrap", inst.$lightbox);
450                inst.$loading = $(".html5-loading", inst.$lightbox);
451                inst.$error = $(".html5-error-box", inst.$lightbox);
452                inst.$image = $(".html5-image", inst.$lightbox);
453                if (inst.options.fullscreenmode && inst.options.fullscreennomargin) inst.$elem.css({
454                    overflow: "hidden"
455                });
456                var elemText = "<div class='html5-elem-data-box' style='display:none;box-sizing:border-box;'><div class='html5-text' style='display:block;overflow:hidden;'></div></div>";
457                if (inst.options.titlestyle ==
458                    "left") inst.$elem.prepend(elemText);
459                else inst.$elem.append(elemText);
460                inst.$elemData = $(".html5-elem-data-box", inst.$lightbox);
461                inst.$text = $(".html5-text", inst.$lightbox);
462                if (inst.options.borderradius > 0) {
463                    inst.$elem.css({
464                        "border-radius": inst.options.borderradius + "px",
465                        "-moz-border-radius": inst.options.borderradius + "px",
466                        "-webkit-border-radius": inst.options.borderradius + "px"
467                    });
468                    if (inst.options.titlestyle == "inside") inst.$elemWrap.css({
469                        "border-radius": inst.options.borderradius + "px",
470                        "-moz-border-radius": inst.options.borderradius +
471                            "px",
472                        "-webkit-border-radius": inst.options.borderradius + "px"
473                    });
474                    else if (inst.options.titlestyle == "bottom") {
475                        inst.$elemWrap.css({
476                            "border-top-left-radius": inst.options.borderradius + "px",
477                            "-moz-top-left-border-radius": inst.options.borderradius + "px",
478                            "-webkit-top-left-border-radius": inst.options.borderradius + "px",
479                            "border-top-right-radius": inst.options.borderradius + "px",
480                            "-moz-top-right-border-radius": inst.options.borderradius + "px",
481                            "-webkit-top-right-border-radius": inst.options.borderradius + "px"
482                        });
483                        inst.$elemData.css({
484                            "border-bottom-left-radius": inst.options.borderradius +
485                                "px",
486                            "-moz-top-bottom-border-radius": inst.options.borderradius + "px",
487                            "-webkit-bottom-left-border-radius": inst.options.borderradiu
487s + "px",
488                            "border-bottom-right-radius": inst.options.borderradius + "px",
489                            "-moz-bottom-right-border-radius": inst.options.borderradius + "px",
490                            "-webkit-bottom-right-border-radius": inst.options.borderradius + "px"
491                        })
492                    }
493                }
494                if (inst.options.titlestyle == "right" || inst.options.titlestyle == "left") {
495                    inst.$lightboxBox.css({
496                        "background-color": inst.options.bgcolor
497                    });
498                    if (inst.options.titlestyle == "right") {
499                        inst.$elemWrap.css({
500                            position: "relative",
501                            "float": "left"
502                        });
503                        inst.$elemData.css({
504                            position: "relative",
505                            overflow: "hidden",
506                            padding: inst.options.bordersize + "px"
507                        })
508                    } else {
509                        inst.$elemWrap.css({
510                            position: "relative",
511                            overflow: "hidden"
512                        });
513                        inst.$elemData.css({
514                            position: "relative",
515                            "float": "left",
516                            padding: inst.options.bordersize + "px"
517                        })
518                    }
519                } else if (inst.options.titlestyle == "inside") {
520                    inst.$elemData.css({
521                        position: "absolute",
522                        margin: inst.options.bordersize + "px",
523                        bottom: 0,
524                        left: 0,
525                        "background-color": "#333",
526                        "background-color": "rgba(51, 51, 51, 0.6)"
527                    });
528                    inst.$text.css({
529                        padding: inst.options.bordersize +
530                            "px " + 2 * inst.options.bordersize + "px"
531                    })
532                } else {
533                    inst.$elemData.css({
534                        position: "relative",
535                        width: "100%",
536                        height: inst.options.barautoheight ? "auto" : inst.options.barheight + "px",
537                        "padding": "0 0 " + inst.options.bordersize + "px" + " 0",
538                        "background-color": inst.options.bgcolor,
539                        "text-align": "left"
540                    });
541                    if (!inst.options.fullscreenmode || !inst.options.fullscreennomargin) inst.$text.css({
542                        "margin": "0 " + inst.options.bordersize + "px"
543                    })
544                }
545                if (inst.options.showsocial) {
546                    var socialCode = '<div id="html5-social" style="display:none;' + inst.options.socialposition +
547                        '">';
548                    var socialBtnCSS = (inst.options.socialdirection == "horizontal" ? "display:inline-block;" : "display:block;") + "margin:4px;";
549                    var socialCSS = "display:table-cell;width:" + inst.options.socialbuttonsize + "px;height:" + inst.options.socialbuttonsize + "px;font-size:" + inst.options.socialbuttonfontsize + "px;border-radius:50%;color:#fff;vertical-align:middle;text-align:center;cursor:pointer;padding:0;";
550                    if (inst.options.showemail) socialCode += '<div class="html5-social-btn' + (inst.options.socialrotateeffect ? " html5-rotate" :
551                        "") + ' html5-social-email" style="' + socialBtnCSS + '"><div class="mh-icon-mail" style="' + socialCSS + 'background-color:#4d83ff;"></div></div>';
552                    if (inst.options.showfacebook) socialCode += '<div class="html5-social-btn' + (inst.options.socialrotateeffect ? " html5-rotate" : "") + ' html5-social-facebook" style="' + socialBtnCSS + '"><div class="mh-icon-facebook" style="' + socialCSS + 'background-color:#3b5998;"></div></div>';
553                    if (inst.options.showtwitter) socialCode += '<div class="html5-social-btn' + (inst.options.socialrotateeffect ?
554                        " html5-rotate" : "") + ' html5-social-twitter" style="' + socialBtnCSS + '"><div class="mh-icon-twitter" style="' + socialCSS + 'background-color:#03b3ee;"></div></div>';
555                    if (inst.options.showpinterest) socialCode += '<div class="html5-social-btn' + (inst.options.socialrotateeffect ? " html5-rotate" : "") + ' html5-social-pinterest" style="' + socialBtnCSS + '"><div class="mh-icon-pinterest" style="' + socialCSS + 'background-color:#c92228;"></div></div>';
556                    socialCode += '<div style="clear:both;"></div></div>';
557                    inst.$lightboxBox.append(socialCode);
558                    $(".html5-social-btn", inst.$lightbox).click(function() {
559                        var shareUrl = window.location.href + (window.location.href.indexOf("?") < 0 ? "?" : "&") + "html5lightboxshare=" + encodeURIComponent(inst.currentElem[ELEM_HREF]);
560                        var shareTitle = inst.currentElem[ELEM_TITLE];
561                        var shareMedia = inst.currentElem[ELEM_HREF];
562                        if (inst.currentElem[ELEM_TYPE] == 0) shareMedia = inst.absoluteUrl(inst.currentElem[ELEM_HREF]);
563                        else if (inst.currentElem[ELEM_TYPE] == 3) shareMedia = "https://img.youtube.com/vi/" + inst.getYoutubeId(inst.currentElem[ELEM_HREF]) +
564                            "/0.jpg";
565                        else {
566                            var lightboxLink = $('.html5lightbox[href="' + inst.currentElem[ELEM_HREF] + '"]');
567                            if (lightboxLink.length > 0)
568                                if (lightboxLink.data("shareimage") && lightboxLink.data("shareimage").length > 0) shareMedia = inst.absoluteUrl(lightboxLink.data("shareimage"));
569                                else if (lightboxLink.data("thumbnail") && lightboxLink.data("thumbnail").length > 0) shareMedia = inst.absoluteUrl(lightboxLink.data("thumbnail"));
570                            else {
571                                var lightboxImg = $("img", lightboxLink);
572                                if (lightboxImg.length > 0) shareMedia = inst.absoluteUrl(lightboxImg.attr("src"))
573                            }
574                        }
575                        var isVideo =
576                            inst.currentElem[ELEM_TYPE] == 2 || inst.currentElem[ELEM_TYPE] == 3 || inst.currentElem[ELEM_TYPE] == 4 || inst.currentElem[ELEM_TYPE] == 8 || inst.currentElem[ELEM_TYPE] == 9 || inst.currentElem[ELEM_TYPE] == 11 || inst.currentElem[ELEM_TYPE] == 12;
577                        if (!shareTitle) shareTitle = "";
578                        else shareTitle = inst.html2Text(shareTitle);
579                        if ($(this).hasClass("html5-social-facebook")) window.open("https://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent(shareUrl) + "&t=" + encodeURIComponent(shareTitle), "_blank");
580                        else if ($(this).hasClass("html5-social-twitter")) window.open("https://twitter.com/share?url=" +
581                            encodeURIComponent(shareUrl) + "&text=" + encodeURIComponent(shareTitle), "_blank");
582                        else if ($(this).hasClass("html5-social-pinterest")) window.open("https://pinterest.com/pin/create/bookmarklet/?media=" + encodeURIComponent(shareMedia) + "&url=" + encodeURIComponent(shareUrl) + "&description=" + encodeURIComponent(shareTitle) + "&is_video=" + (isVideo ? "true" : "false"), "_blank");
583                        else if ($(this).hasClass("html5-social-email")) window.open("mailto:?subject=" + encodeURIComponent(shareTitle) + "&body=Check out this: " + encodeURIComponent(shareUrl));
584                        return false
585                    })
586                }
587                if (inst.options.fullscreenmode) {
588                    inst.$lightbox.append("<div class='html5-next-fullscreen' style='cursor:pointer;position:absolute;right:" + inst.options.bordersize + "px;top:50%;margin-top:-16px;'><img alt='' src='" + inst.options.fullscreennextimage + "'></div>" + "<div class='html5-prev-fullscreen' style='cursor:pointer;position:absolute;
588left:" + inst.options.bordersize + "px;top:50%;margin-top:-16px;'><img alt='' src='" + inst.options.fullscreenprevimage + "'></div>");
589                    inst.$next = $(".html5-next-fullscreen",
590                        inst.$lightbox);
591                    inst.$prev = $(".html5-prev-fullscreen", inst.$lightbox);
592                    inst.$lightboxBox.append("<div class='html5-next-bottom-fullscreen' style='cursor:pointer;position:absolute;top:100%;right:0;margin-top:8px;'><img alt='' src='" + inst.options.fullscreennextimage + "'></div>" + "<div class='html5-prev-bottom-fullscreen' style='cursor:pointer;position:absolute;top:100%;left:0;margin-top:8px;'><img alt='' src='" + inst.options.fullscreenprevimage + "'></div>");
593                    inst.$nextbottom = $(".html5-next-bottom-fullscreen",
594                        inst.$lightbox);
595                    inst.$prevbottom = $(".html5-prev-bottom-fullscreen", inst.$lightbox);
596                    inst.$nextbottom.click(function() {
597                        inst.nextArrowClicked()
598                    });
599                    inst.$prevbottom.click(function() {
600                        inst.prevArrowClicked()
601                    });
602                    inst.$lightbox.append("<div id='html5-close-fullscreen' style='display:block;cursor:pointer;position:absolute;top:0;right:0;margin-top:0;margin-right:0;'><img alt='' src='" + inst.options.fullscreencloseimage + "'></div>");
603                    inst.$close = $("#html5-close-fullscreen", inst.$lightbox)
604                } else {
605                    inst.$lightboxBox.append("<div class='html5-next' style='display:none;cursor:pointer;position:absolute;right:" +
606                        inst.options.bordersize + "px;top:50%;margin-top:-32px;'><img alt='' src='" + inst.options.nextimage + "'></div>" + "<div class='html5-prev' style='display:none;cursor:pointer;position:absolute;left:" + inst.options.bordersize + "px;top:50%;margin-top:-32px;'><img alt='' src='" + inst.options.previmage + "'></div>");
607                    inst.$next = $(".html5-next", inst.$lightbox);
608                    inst.$prev = $(".html5-prev", inst.$lightbox);
609                    if (inst.options.isTouch && inst.options.navarrowsalwaysshowontouch || inst.options.alwaysshownavarrows) {
610                        inst.$lightboxBox.append("<div class='html5-next-touch' style='display:block;cursor:pointer;position:absolute;'><img alt='' src='" +
611                            inst.options.nextimage + "'></div>" + "<div class='html5-prev-touch' style='display:block;cursor:pointer;position:absolute;'><img alt='' src='" + inst.options.previmage + "'></div>");
612                        inst.$nexttouch = $(".html5-next-touch", inst.$lightbox);
613                        inst.$prevtouch = $(".html5-prev-touch", inst.$lightbox);
614                        inst.$nexttouch.click(function() {
615                            inst.nextArrowClicked()
616                        });
617                        inst.$prevtouch.click(function() {
618                            inst.prevArrowClicked()
619                        })
620                    }
621                    inst.$lightboxBox.append("<div id='html5-close' style='display:none;cursor:pointer;position:absolute;top:0;right:0;margin-top:-16px;margin-right:-16px;'><img alt='' src='" +
622                        inst.options.closeimage + "'></div>");
623                    inst.$close = $("#html5-close", inst.$lightbox)
624                }
625                inst.$watermark = $("#html5-watermark", inst.$lightbox);
626                if (inst.options.stamp) inst.$watermark.html("<a href='" + inst.options.freelink + "' style='text-decoration:none;' title='jQuery Lightbox'><div style='display:block;width:170px;height:20px;text-align:center;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;background-color:#fff;color:#333;
626font:12px Arial,sans-serif;'><div style='line-height:20px;'>" + inst.options.freemark +
627                    "</div></div></a>");
628                else if (inst.options.watermark) {
629                    var html = "<img alt='' src='" + inst.options.watermark + "' style='border:none;' />";
630                    if (inst.options.watermarklink) html = "<a href='" + inst.options.watermarklink + "' target='_blank'>" + html + "</a>";
631                    inst.$watermark.html(html)
632                }
633                if (inst.options.closeonoverlay) $("#html5-lightbox-overlay", inst.$lightbox).click(inst.finish);
634                inst.$close.click(inst.finish);
635                inst.$next.click(function() {
636                    inst.nextArrowClicked()
637                });
638                inst.$prev.click(function() {
639                    inst.prevArrowClicked()
640                });
641                $(window).resize(function() {
642                    if (inst.options.isIOS &&
643                        !inst.options.mobileresizeevent) return;
644                    clearTimeout(inst.options.resizeTimeout);
645                    inst.options.resizeTimeout = setTimeout(function() {
646                        inst.resizeWindow()
647                    }, inst.options.resizedelay)
648                });
649                $(window).scroll(function() {
650                    if (inst.options.isIOS && !inst.options.mobileresizeevent) return;
651                    inst.scrollBox()
652                });
653                $(window).on("orientationchange", function(e) {
654                    if (inst.options.isMobile) inst.resizeWindow()
655                });
656                if (inst.options.enabletouchswipe) inst.enableSwipe()
657            };
658            inst.html2Text = function(html) {
659                var tag = document.createElement("div");
660                tag.innerHTML =
661                    html;
662                return tag.innerText
663            };
664            inst.slideTimer = function(interval, callback, updatecallback) {
665                var timerInstance = this;
666                timerInstance.timeout = interval;
667                var updateinterval = 50;
668                var updateTimerId = null;
669                var runningTime = 0;
670                var paused = false;
671                var started = false;
672                var startedandpaused = false;
673                this.pause = function() {
674                    if (started) {
675                        paused = true;
676                        clearInterval(updateTimerId)
677                    }
678                };
679                this.resume = function(forceresume) {
680                    if (startedandpaused && !forceresume) return;
681                    startedandpaused = false;
682                    if (started && paused) {
683                        paused = false;
684                        updateTimerId = setInterval(function() {
685                            runningTime +=
686                                updateinterval;
687                            if (runningTime > timerInstance.timeout) {
688                                clearInterval(updateTimerId);
689                                if (callback) callback()
690                            }
691                            if (updatecallback) updatecallback(runningTime / timerInstance.timeout)
692                        }, updateinterval)
693                    }
694                };
695                this.stop = function() {
696                    clearInterval(updateTimerId);
697                    if (updatecallback) updatecallback(-1);
698                    runningTime = 0;
699                    paused = false;
700                    started = false
701                };
702                this.start = function() {
703                    runningTime = 0;
704                    paused = false;
705                    started = true;
706                    updateTimerId = setInterval(function() {
707                        runningTime += updateinterval;
708                        if (runningTime > timerInstance.timeout) {
709                            clearInterval(updateTimerId);
710                            if (callback) callback()
711                        }
712                        if (updatecallback) updatecallback(runningTime / timerInstance.timeout)
713                    }, updateinterval)
714                };
715                this.startandpause = function() {
716                    runningTime = 0;
717                    paused = true;
718                    started = true;
719                    startedandpaused = true
720                };
721                return this
722            };
723            inst.updateTimer = function(percent) {
724                var w = Math.round(percent * 100);
725                if (w > 100) w = 100;
726                if (w < 0) w = 0;
727                $(".html5-timer", inst.$lightbox).css({
728                    display: "block",
729                    width: w + "%"
730                })
731            };
732            inst.initSlide = function() {
733                inst.autosliding = false;
734                inst.slideTimeout = inst.slideTimer(inst.options.slideinterval, function() {
735                        inst.gotoSlide(-1)
736                    },
737                    inst.options.showtimer ? function(percent) {
738                        inst.updateTimer(percent)
739                    } : null);
740                if (inst.options.autoslide) {
741                    inst.slideTimeout.stop();
742                    inst.autosliding = true
743                }
744            };
745            inst.nextArrowClicked = function() {
746                if (inst.options.nextElem <= inst.options.curElem)
747                    if (inst.options.onlastarrowclicked && window[inst.options.onlastarrowclicked] && typeof window[inst.options.onlastarrowclicked] == "function") window[inst.options.onlastarrowclicked]();
748                inst.gotoSlide(-1)
749            };
750            inst.prevArrowClicked = function() {
751                if (inst.options.prevElem >= inst.options.curElem)
752                    if (inst.options.onfirstarrowclicked &&
753                        window[inst.options.onfirstarrowclicked] && typeof window[inst.options.onfirstarrowclicked] == "function") window[inst.options.onfirstarrowclicked]();
754                inst.gotoSlide(-2)
755            };
756            inst.calcNextPrevElem = function() {
757                inst.options.nextElem = -1;
758                inst.options.prevElem = -1;
759                inst.options.inGroup = false;
760                inst.options.groupIndex = 0;
761                inst.options.groupCount = 0;
762                var group = inst.elemArray[inst.options.curElem][ELEM_GROUP];
763                for (var i = 0; i < inst.elemArray.length; i++)
764                    if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP])) {
765                        if (i == inst.options.curElem) inst.options.groupIndex =
766                            inst.options.groupCount;
767                        inst.options.groupCount++
768                    }
769                var j, curGroup = inst.elemArray[inst.options.curElem][ELEM_GROUP];
770                if (curGroup != undefined && curGroup != null) {
771                    for (j = inst.options.curElem + 1; j < inst.elemArray.length; j++)
772                        if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
773                            inst.options.nextElem = j;
774                            break
775                        }
776                    if (inst.options.nextElem < 0)
777                        for (j = 0; j < inst.options.curElem; j++)
778                            if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
779                                inst.options.nextElem = j;
780                                break
781                            }
782                    if (inst.options.nextElem >= 0) {
783                        for (j = inst.options.curElem -
784                            1; j >= 0; j--)
785                            if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
786                                inst.options.prevElem = j;
787                                break
788                            }
789                        if (inst.options.prevElem < 0)
790                            for (j = inst.elemArray.length - 1; j > inst.options.curElem; j--)
791                                if (inst.matchGroup(curGroup, inst.elemArray[j][ELEM_GROUP])) {
792                                    inst.options.prevElem = j;
793                                    break
794                                }
795                    }
796                }
797                if (inst.options.nextElem >= 0 || inst.options.prevElem >= 0) inst.options.inGroup = true
798            };
799            inst.calcBoxPosition = function(initW, initH) {
800                var boxW = initW + 2 * inst.options.bordersize;
801                var boxH = initH + 2 * inst.options.bordersize;
802                var navH = inst.options.shownavigation &&
803                    inst.navvisible ? inst.options.navheight : 0;
804                var winH = $(window).height();
805                var boxT = Math.round((winH - navH) / 2 - boxH / 2);
806                if (inst.options.titlestyle == "bottom") boxT -= Math.round(inst.options.barheight / 2);
807                var topmargin = $(window).width() < inst.options.navarrowsbottomscreenwidth ? inst.options.bordertopmarginsmall : inst.options.bordertopmargin;
808                if (boxT < topmargin) boxT = topmargin;
809                if (inst.options.insideiframe && window.self != window.top)
810                    if (parent.window.jQuery && parent.window.jQuery("#" + inst.options.iframeid).length) {
811                        var iframetop =
812                            parent.window.jQuery("#" + inst.options.iframeid).offset().top;
813                        var parentscroll = parent.window.document.body.scrollTop;
814                        boxT = topmargin;
815                        boxT += parentscroll > iframetop ? parentscroll - iframetop : 0
816                    }
817                return [boxW, boxH, boxT]
818            };
819            inst.hideNavArrows = function() {
820                var showPrev = false;
821                var showNext = false;
822                if (inst.options.inGroup) {
823                    if (inst.options.arrowloop || !inst.options.arrowloop && inst.options.prevElem < inst.options.curElem) showPrev = true;
824                    if (inst.options.arrowloop || !inst.options.arrowloop && inst.options.nextElem > inst.options.curElem) showNext =
825                        true
826                }
827                if (showPrev) {
828                    inst.$prev.removeClass("html5-hide");
829                    if (inst.$prevbottom) inst.$prevbottom.removeClass("html5-hide");
830                    if (inst.$prevtouch) inst.$prevtouch.removeClass("html5-hide")
831                } else {
832                    inst.$prev.addClass("html5-hide");
833                    if (inst.$prevbottom) inst.$prevbottom.addClass("html5-hide");
834                    if (inst.$prevtouch) inst.$prevtouch.addClass("html5-hide")
835                }
836                if (showNext) {
837                    inst.$next.removeClass("html5-hide");
838                    if (inst.$nextbottom) inst.$nextbottom.removeClass("html5-hide");
839                    if (inst.$nexttouch) inst.$nexttouch.removeClass("html5-hide")
840                } else {
841                    inst.$next.addClass("html5-hide");
842                    if (inst.$nextbottom) inst.$nextbottom.addClass("html5-hide");
843                    if (inst.$nexttouch) inst.$nexttouch.addClass("html5-hide")
844                }
845            };
846            inst.clickHandler = function() {
847                var $this = $(this);
848                var dataoptions = {};
849                $.each($this.data(), function(key, value) {
850                    dataoptions[key.toLowerCase()] = value
851                });
852                inst.options = $.extend(inst.options, inst.defaultoptions, dataoptions);
853                $(window).trigger("html5lightbox.lightboxshow");
854                inst.init();
855                if (inst.elemArray.length <= 0) return true;
856                inst.hideObjects();
857                for (var i = 0; i < inst.elemArray.length; i++)
858                    if (inst.elemArray[i][ELEM_HREF] ==
859                        $this.attr("href")) break;
860                if (i == inst.elemArray.length) return true;
861                inst.options.curElem = i;
862                inst.calcNextPrevElem();
863                inst.reset();
864                inst.$lightbox.show();
865                var boxPos = inst.calcBoxPosition(inst.options.loadingwidth, inst.options.loadingheight);
866                var boxW = boxPos[0];
867                var boxH = boxPos[1];
868                var boxT = boxPos[2];
869                if (inst.options.iequirksmode) inst.$lightboxBox.css({
870                    "top": boxT
871                });
872                else inst.$lightboxBox.css({
873                    "margin-top": boxT
874                });
875                if (inst.options.titlestyle == "left" || inst.options.titlestyle == "right") inst.$lightboxBox.css({
876                    "width": boxW,
877                    "height": boxH
878                });
879                else {
880                    inst.$lightboxBox.css({
881                        "width": boxW,
882                        "height": "auto"
883                    });
884                    inst.$elemWrap.css({
885                        "width": boxW,
886                        "height": boxH
887                    })
888                }
889                inst.loadCurElem();
890                return false
891            };
892            inst.loadThumbnail = function(src, index, title) {
893                var imgLoader = new Image;
894                $(imgLoader).on("load", function() {
895                  
896                   var style;
897                    if (this.width / this.height <= inst.options.thumbwidth / inst.options.thumbheight) style = "width:100%;";
898                    else style = "height:100%;";
899                    $(".html5-nav-thumb").eq(index).html("<img alt='" + inst.html2Text(title) + "' style='" + style + "' src='" + src + "' />")
900                });
901                imgLoader.src = src
902            };
903            inst.matchGroup = function(curGroup, elemGroup) {
904                if (inst.options.showall) return true;
905                if (!curGroup || !elemGroup) return false;
906                var curs = curGroup.split(":");
907                var elems = elemGroup.split(":");
908                var result = false;
909                for (var i in curs)
910                    if ($.inArray(curs[i], elems) > -1) {
911                        result = true;
912                        break
913                    }
914                return result
915            };
916            inst.showNavigation = function() {
917                if (!inst.options.shownavigation) return;
918                if (!inst.currentElem || !inst.currentElem[ELEM_GROUP]) return;
919                var i;
920                var showNav = false;
921                var group = inst.currentElem[ELEM_GROUP];
922                for (i = 0; i < inst.elemArray.length; i++)
923                    if (inst.matchGroup(group,
924                            inst.elemArray[i][ELEM_GROUP]))
925                        if (inst.elemArray[i][ELEM_THUMBNAIL] && inst.elemArray[i][ELEM_THUMBNAIL].length > 0) {
926                            showNav = true;
927                            break
928                        }
929                if (!showNav) return;
930                inst.options.navheight = inst.options.thumbheight + inst.options.thumbtopmargin + inst.options.thumbbottommargin;
931                if ($(".html5-nav").length > 0) return;
932                var posCss = inst.options.hidenavdefault ? "top:100%;bottom:auto;left:0;right:0;" : "top:auto;bottom:0;left:0;right:0;";
933                var posType = inst.options.positionFixed ? "fixed" : "absolute";
934                $("body").append("<div class='html5-nav' style='display:block;position:" +
935                    posType + ";" + posCss + "width:100%;height:" + inst.options.navheight + "px;z-index:9999999;" + (inst.options.navbgcolor ? "background-color:" + inst.options.navbgcolor + ";" : "") + "'>" + "<div class='html5-nav-container' style='position:relative;margin:" + inst.options.thumbtopmargin + "px auto " + inst.options.thumbbottommargin + "px;'>" + "<div class='html5-nav-prev' style='display:block;position:absolute;cursor:pointer;
935width:" + inst.options.navbuttonwidth + 'px;height:100%;left:0;top:0;background:url("' + inst.options.navarrowsprevimage +
936                    "\") no-repeat left center;'></div>" + "<div class='html5-nav-mask' style='display:block;position:relative;margin:0 auto;overflow:hidden;'>" + "<div class='html5-nav-list'></div>" + "</div>" + "<div class='html5-nav-next' style='display:block;position:absolute;cursor:pointer;width:" + inst.options.navbuttonwidth + 'px;height:100%;right:0;top:0;background:url("' + inst.options.navarrowsnextimage + "\") no-repeat right center;'></div>" + "</div>" + "</div>");
937                inst.navvisible = inst.options.hidenavdefault ? false : true;
938                if (inst.options.shownavcontrol) {
939                    $(".html5-nav").append('<div class="html5-nav-showcontrol" style="position:absolute;display:block;cursor:pointer;bottom:100%;right:12px;margin:0;padding:0;"><img alt="" src="' +
940                        inst.options.navcontrolimage + '"></div>');
941                    $(".html5-nav-showcontrol").click(function() {
942                        var winH = $(window).height();
943                        var navH = $(".html5-nav").height();
944                        if (inst.navvisible) {
945                            inst.navvisible = false;
946                            $(".html5-nav").css({
947                                top: winH - navH + "px",
948                                bottom: "auto"
949                            }).animate({
950                                top: winH + "px"
951                            }, function() {
952                                $(this).css({
953                                    top: "100%",
954                                    bottom: "auto"
955                                })
956                            })
957                        } else {
958                            inst.navvisible = true;
959                            var navH = $(".html5-nav").height();
960                            $(".html5-nav").css({
961                                top: winH + "px",
962                                bottom: "auto"
963                            }).animate({
964                                top: winH - navH + "px"
965                            }, function() {
966                                $(this).css({
967                                    top: "auto",
968                                    bottom: 0
969                                })
970                            })
971                        }
972                        inst.resizeWindow()
973                    })
974                }
975                var index =
976                    0;
977                for (i = 0; i < inst.elemArray.length; i++)
978                    if (inst.matchGroup(group, inst.elemArray[i][ELEM_GROUP]))
979                        if (inst.elemArray[i][ELEM_THUMBNAIL] && inst.elemArray[i][ELEM_THUMBNAIL].length > 0) {
980                            $(".html5-nav-list").append("<div class='html5-nav-thumb' data-arrayindex='" + i + "' style='float:left;overflow:hidden;cursor:pointer;opacity:" + inst.options.thumbopacity + ";margin: 0 " + inst.options.thumbgap / 2 + "px;width:" + inst.options.thumbwidth + "px;height:" + inst.options.thumbheight + "px;border:" + inst.options.thumbborder + "px solid " +
981                                inst.options.thumbbordercolor + ";'></div>");
982                            this.loadThumbnail(inst.elemArray[i][ELEM_THUMBNAIL], index, inst.elemArray[i][ELEM_TITLE]);
983                            index++
984                        }
985                $(".html5-nav-thumb").hover(function() {
986                    $(this).css({
987                        opacity: 1
988                    });
989                    $(this).css({
990                        border: inst.options.thumbborder + "px solid " + inst.options.thumbhighlightbordercolor
991                    })
992                }, function() {
993                    $(this).css({
994                        opacity: inst.options.thumbopacity
995                    });
996                    $(this).css({
997                        border: inst.options.thumbborder + "px solid " + inst.options.thumbbordercolor
998                    })
999                });
1000                $(".html5-nav-thumb").click(function() {
1001                    var index =
1002                        $(this).data("arrayindex");
1003                    if (index >
1003= 0) inst.gotoSlide(index)
1004                });
1005                inst.options.totalwidth = index * (inst.options.thumbgap + inst.options.thumbwidth + 2 * inst.options.thumbborder);
1006                $(".html5-nav-list").css({
1007                    display: "block",
1008                    position: "relative",
1009                    "margin-left": 0,
1010                    width: inst.options.totalwidth + "px"
1011                }).append("<div style='clear:both;'></div>");
1012                var $navMask = $(".html5-nav-mask");
1013                var $navPrev = $(".html5-nav-prev");
1014                var $navNext = $(".html5-nav-next");
1015                $navPrev.click(function() {
1016                    var $navList = $(".html5-nav-list");
1017                    var $navNext = $(".html5-nav-next");
1018                    var winWidth = $(window).width();
1019                    var maskWidth = winWidth - 2 * inst.options.navbuttonwidth;
1020                    var marginLeft = parseInt($navList.css("margin-left")) + maskWidth;
1021                    if (marginLeft >= 0) {
1022                        marginLeft = 0;
1023                        $(this).css({
1024                            "background-position": "center left"
1025                        })
1026                    } else $(this).css({
1027                        "background-position": "center right"
1028                    });
1029                    if (marginLeft <= maskWidth - inst.options.totalwidth) $navNext.css({
1030                        "background-position": "center left"
1031                    });
1032                    else $navNext.css({
1033                        "background-position": "center right"
1034                    });
1035                    $navList.animate({
1036                        "margin-left": marginLeft
1037                    })
1038                });
1039                $navNext.click(function() {
1040                    var $navList =
1041                        $(".html5-nav-list");
1042                    var $navPrev = $(".html5-nav-prev");
1043                    var winWidth = $(window).width();
1044                    var maskWidth = winWidth - 2 * inst.options.navbuttonwidth;
1045                    var marginLeft = parseInt($navList.css("margin-left")) - maskWidth;
1046                    if (marginLeft <= maskWidth - inst.options.totalwidth) {
1047                        marginLeft = maskWidth - inst.options.totalwidth;
1048                        $(this).css({
1049                            "background-position": "center left"
1050                        })
1051                    } else $(this).css({
1052                        "background-position": "center right"
1053                    });
1054                    if (marginLeft >= 0) $navPrev.css({
1055                        "background-position": "center left"
1056                    });
1057                    else $navPrev.css({
1058                        "background-position": "center right"
1059                    });
1060                    $navList.animate({
1061                        "margin-left": marginLeft
1062                    })
1063                });
1064                var winWidth = $(window).width();
1065                if (inst.options.totalwidth <= winWidth) {
1066                    $navMask.css({
1067                        width: inst.options.totalwidth + "px"
1068                    });
1069                    $navPrev.hide();
1070                    $navNext.hide()
1071                } else {
1072                    $navMask.css({
1073                        width: winWidth - 2 * inst.options.navbuttonwidth + "px"
1074                    });
1075                    $navPrev.show();
1076                    $navNext.show()
1077                }
1078            };
1079            inst.loadElem = function(elem) {
1080                inst.currentElem = elem;
1081                inst.showing = true;
1082                if (inst.options.bodynoscroll) $("html,body").addClass("bodynoscroll");
1083                if (!(inst.options.showtitle && inst.currentElem[ELEM_TITLE] &&
1084                        inst.currentElem[ELEM_TITLE].length > 0 || inst.options.showdescription && inst.currentElem[ELEM_DESCRIPTION] && inst.currentElem[ELEM_DESCRIPTION].length > 0 || inst.options.inGroup && (inst.options.showplaybutton || inst.options.showtitleprefix))) inst.options.barheight = 0;
1085                inst.showNavigation();
1086                inst.$elem.off("mouseenter").off("mouseleave").off("mousemove");
1087                inst.$loading.show();
1088                if (inst.options.onshowitem && window[inst.options.onshowitem] && typeof window[inst.options.onshowitem] == "function") window[inst.options.onshowitem](elem);
1089                if (inst.options.transition != "none" && inst.existingElem >= 0) {
1090                    $(".html5-elem-box-previous").remove();
1091                    var newitem = inst.$elem.clone();
1092                    newitem.insertAfter(inst.$elem);
1093                    inst.$prevelem = inst.$elem;
1094                    inst.$elem = newitem;
1095                    inst.$prevelem.addClass("html5-elem-box-previous");
1096                    inst.$elem.addClass("html5-elem-box-current");
1097                    inst.$elemWrap = $(".html5-elem-wrap", inst.$elem);
1098                    inst.$loading = $(".html5-loading", inst.$elem);
1099                    inst.$error = $(".html5-error-box", inst.$elem);
1100                    inst.$image = $(".html5-image", inst.$elem);
1101                    inst.$elemData = $(".html5-elem-data-box",
1102                        inst.$elem);
1103                    inst.$text = $(".html5-text", inst.$elem);
1104                    if (inst.options.transition == "slide") {
1105                        inst.$elem.css({
1106                            position: "absolute",
1107                            top: 0,
1108                            left: inst.direction == -1 ? "100%" : "-100%",
1109                            opacity: 0,
1110                            height: "auto"
1111                        });
1112                        inst.$prevelem.css({
1113                            width: inst.$prevelem.width() + "px",
1114                            height: inst.$prevelem.height() + "px"
1115                        })
1116                    }
1117                }
1118                switch (elem[ELEM_TYPE]) {
1119                    case 0:
1120                        var imgLoader = new Image;
1121                        $(imgLoader).on("load", function() {
1122                            elem[ELEM_ORIGINALWIDTH] = imgLoader.width;
1123                            elem[ELEM_ORIGINALHEIGHT] = imgLoader.height;
1124                            inst.showImage(elem, imgLoader.width, imgLoader.height)
1125                        });
1126                        $(imgLoader).on("error", function() {
1127                            inst.showError()
1128                        });
1129                        imgLoader.src = elem[ELEM_HREF];
1130                        break;
1131                    case 1:
1132                        inst.showSWF(elem);
1133                        break;
1134                    case 2:
1135                    case 8:
1136                        inst.showVideo(elem);
1137                        break;
1138                    case 3:
1139                    case 4:
1140                    case 9:
1141                    case 11:
1142                    case 12:
1143                        inst.showYoutubeVimeo(elem);
1144                        break;
1145                    case 5:
1146                        inst.showPDF(elem);
1147                        break;
1148                    case 6:
1149                        inst.showMP3(elem);
1150                        break;
1151                    case 7:
1152                        inst.showWeb(elem);
1153                        break;
1154                    case 10:
1155                        inst.showDiv(elem);
1156                        break
1157                }
1158                if (inst.options.googleanalyticsaccount && window._gaq) window._gaq.pu
1158sh(["_trackEvent", "Lightbox", "Open", elem[ELEM_HREF]])
1159            };
1160            inst.loadCurElem =
1161                function() {
1162                    inst.loadElem(inst.elemArray[inst.options.curElem])
1163                };
1164            inst.showError = function() {
1165                inst.$loading.hide();
1166                inst.resizeLightbox(inst.options.errorwidth, inst.options.errorheight, true, function() {
1167                    inst.$loading.hide();
1168                    inst.$error.show();
1169                    inst.$elem.fadeIn(inst.options.fadespeed, function() {
1170                        inst.showData()
1171                    })
1172                })
1173            };
1174            inst.calcTextWidth = function(objW) {
1175                return objW - 36
1176            };
1177            inst.showTitle = function(w, t, description) {
1178                    if (inst.options.titlestyle == "inside") inst.$elemData.css({
1179                        width: w + "px"
1180                    });
1181                    var text = "";
1182                    if (inst.options.showtitle)
1183                        if (t &&
1184                            t.length > 0) text += t;
1185                    if (inst.options.inGroup) {
1186                        if (inst.options.showtitleprefix) text = "<span class='html5-title-prefix'>" + inst.options.titleprefix.replace("%NUM", inst.options.groupIndex + 1).replace("%TOTAL", inst.options.groupCount) + "</span> <span class='html5-title-caption'>
1186" + text + "</span>";
1187                        if (inst.options.showplaybutton) text = "<div class='html5-playpause' style='display:inline-block;cursor:pointer;vertical-align:middle;'><div class='html5-play' style='display:block;'><img alt='' src='" + inst.options.playimage +
1188                            "'></div><div class='html5-pause' style='display:none;'><img alt='' src='" + inst.options.pauseimage + "'></div></div> " + text
1189                    }
1190                    if (text.length > 0) text = '<div class="html5-title">' + text + "</div>";
1191                    if (inst.options.showdescription && description && description.length > 0) text += '<div class="html5-description">' + description + "</div>";
1192                    inst.$text.html(text);
1193                    if (inst.options.inGroup && inst.options.showplaybutton) {
1194                        if (inst.autosliding) {
1195                            $(".html5-play", inst.$lightbox).hide();
1196                            $(".html5-pause", inst.$lightbox).show()
1197                        } else {
1198                            $(".html5-play",
1199                                inst.$lightbox).show();
1200                            $(".html5-pause", inst.$lightbox).hide()
1201                        }
1202                        $(".html5-play", inst.$lightbox).click(function() {
1203                            $(".html5-play", inst.$lightbox).hide();
1204                            $(".html5-pause", inst.$lightbox).show();
1205                            if (inst.slideTimeout) {
1206                                inst.slideTimeout.stop();
1207                                inst.slideTimeout.start();
1208                                inst.autosliding = true
1209                            }
1210                        });
1211                        $(".html5-pause", inst.$lightbox).click(function() {
1212                            $(".html5-play", inst.$lightbox).show();
1213                            $(".html5-pause", inst.$lightbox).hide();
1214                            if (inst.slideTimeout) {
1215                                inst.slideTimeout.stop();
1216                                inst.autosliding = false
1217                            }
1218                        })
1219                    }
1220                    $("#html5-social",
1221                        inst.$lightbox).show();
1222                    if (inst.options.showsocialmedia)
1223                        if (inst.currentElem[ELEM_SOCIALMEDIA])
1224                            if ($("#html5-socialmedia", inst.$lightboxBox).length > 0) $("#html5-socialmedia", inst.$lightboxBox).html(inst.currentElem[ELEM_SOCIALMEDIA]);
1225                            else inst.$lightboxBox.append('<div id="html5-socialmedia" style="' + inst.options.socialmediaposition + '">' + inst.currentElem[ELEM_SOCIALMEDIA] + "</div>");
1226                    else if ($("#html5-socialmedia", inst.$lightboxBox).length > 0) $("#html5-socialmedia", inst.$lightboxBox).remove()
1227                }, inst.showImage =
1228                function(elem, imgW, imgH) {
1229                    var elemW, elemH;
1230                    if (elem[ELEM_WIDTH]) elemW = elem[ELEM_WIDTH];
1231                    else {
1232                        elemW = imgW;
1233                        elem[ELEM_WIDTH] = imgW
1234                    }
1235                    if (elem[ELEM_HEIGHT]) elemH = elem[ELEM_HEIGHT];
1236                    else {
1237                        elemH = imgH;
1238                        elem[ELEM_HEIGHT] = imgH
1239                    }
1240                    var sizeObj = inst.calcElemSize({
1241                        w: elemW,
1242                        h: elemH
1243                    }, inst.options.imagekeepratio);
1244                    inst.resizeLightbox(sizeObj.w, sizeObj.h, true, function() {
1245                        inst.$loading.hide();
1246                        inst.showTitle(sizeObj.w, elem[ELEM_TITLE], elem[ELEM_DESCRIPTION]);
1247                        var timercode = !inst.options.showtimer || !inst.options.inGroup ? "" : "<div class='html5-timer' style='display:none;position:absolute;" +
1248                            inst.options.timerposition + ":0;left:0;width:0;height:" + inst.options.timerheight + "px;background-color:" + inst.options.timercolor + ";opacity:" + inst.options.timeropacity + ";'></div>";
1249                        inst.$image.show();
1250                        inst.$image.html("<div class='html5-image-container' style='display:block;position:relative;width:100%;height:100%;" + (inst.options.imagekeepratio ? "overflow:hidden;" : "overflow:auto;") + "'><img alt='" + inst.html2Text(elem[ELEM_TITLE]) + "' src='" + elem[ELEM_HREF] + "' width='100%' height='" + (inst.options.imagekeepratio ?
1251                            "100%" : "auto") + "' />" + timercode + "</div>");
1252                        inst.$elem.fadeIn(inst.options.fadespeed, function() {
1253                            inst.showData()
1254                        });
1255                        if (inst.autosliding) {
1256                            inst.slideTimeout.stop();
1257                            inst.slideTimeout.start()
1258                        }
1259                    })
1260                };
1261            inst.showSWF = function(elem) {
1262                var dataW = elem[ELEM_WIDTH] ? elem[ELEM_WIDTH] : DEFAULT_WIDTH;
1263                var dataH = elem[ELEM_HEIGHT] ? elem[ELEM_HEIGHT] : DEFAULT_HEIGHT;
1264                var sizeObj = inst.calcElemSize({
1265                    w: dataW,
1266                    h: dataH
1267                }, true);
1268                dataW = sizeObj.w;
1269                dataH = sizeObj.h;
1270                inst.resizeLightbox(dataW, dataH, true, function() {
1271                    inst.$loading.hide();
1272                    inst.showTitle(sizeObj.w,
1273                        elem[ELEM_TITLE], elem[ELEM_DESCRIPTION]);
1274                    inst.$image.html("<div class='html5lightbox-swf' style='display:block;width:100%;height:100%;'></div>").show();
1275                    inst.embedFlash($(".html5lightbox-swf", inst.$image), elem[ELEM_HREF], "window", {
1276                        width: dataW,
1277                        height: dataH
1278                    });
1279                    inst.$elem.show();
1280                    inst.showData();
1281                    if (inst.autosliding) {
1282                        inst.slideTimeout.stop();
1283                        inst.slideTimeout.start()
1284                    }
1285                })
1286            };
1287            inst.showVideo = function(elem) {
1288                inst.slideTimeout.stop();
1289                var dataW = elem[ELEM_WIDTH] ? elem[ELEM_WIDTH] : DEFAULT_WIDTH;
1290                var dataH = elem[ELEM_HEIGHT] ?
1291                    elem[ELEM_HEIGHT] : DEFAULT_HEIGHT;
1292                var sizeObj = inst.calcElemSize({
1293                    w: dataW,
1294                    h: dataH
1295                }, true);
1296                dataW = sizeObj.w;
1297                dataH = sizeObj.h;
1298                inst.resizeLightbox(dataW, dataH, true, function() {
1299                    inst.$loading.hide();
1300                    inst.showTitle(sizeObj.w, elem[ELEM_TITLE], elem[ELEM_DESCRIPTION]);
1301                    inst.$image.html("<div class='html5lightbox-video' style='display:block;width:100%;height:100%;overflow:hidden;background-color:" + inst.options.videobgcolor + ";'></div>").show();
1302                    var isHTML5 = false;
1303                    if (inst.options.isIE678 || elem[ELEM_TYPE] == 8 || inst.options.isIE9 &&
1304                        inst.options.useflashonie9 || inst.options.isIE10 && inst.options.useflashonie10 || inst.options.isIE11 && inst.options.useflashonie11) isHTML5 = false;
1305                    else if (inst.options.isMobile) isHTML5 = true;
1306                    else if ((inst.options.html5player || !inst.options.flashInstalled) && inst.options.html5VideoSupported) {
1307                        isHTML5 = true;
1308                        if (inst.options.isFirefox || inst.options.isOpera)
1309                            if (!elem[ELEM_HREF_WEBM] && !elem[ELEM_HREF_OGG] && (!inst.options.canplaymp4 || inst.options.useflashformp4onfirefox)) isHTML5 = false
1310                    }
1311                    if (isHTML5) {
1312                        var videoSrc = elem[ELEM_HREF];
1313                        if (inst.options.isFirefox || inst.options.isOpera)
1314                            if (elem[ELEM_HREF_WEBM]) videoSrc = elem[ELEM_HREF_WEBM];
1315                            else if (elem[ELEM_HREF_OGG]) videoSrc = elem[ELEM_HREF_OGG];
1316                        inst.embedHTML5Video($(".html5lightbox-video", inst.$image), videoSrc, inst.options.autoplay, inst.options.loopvideo)
1317                    } else {
1318                        var videoFile = elem[ELEM_HREF];
1319                        if (videoFile.charAt(0) != "/" && videoFile.substring(0, 5) != "http:" && videoFile.substring(0, 6) != "https:") videoFile = inst.options.htmlfolder + videoFile;
1320                        inst.embedFlash($(".html5lightbox-video", inst.$image),
1321                            inst.options.jsfolder + "html5boxplayer.swf", "transparent", {
1322                                width: dataW,
1323                                height: dataH,
1324                                jsobjectname: "html5Lightbox",
1325                                hidecontrols: inst.options.videohidecontrols ? "1" : "0",
1326                                hideplaybutton: "0",
1327                                videofile: videoFile,
1328                                hdfile: "",
1329                                ishd: "0",
1330                                defaultvolume: inst.options.defaultvideovolume,
1331                                autoplay: inst.options.autoplay ? "1" : "0",
1332                                loop: inst.options.loopvideo ? "1" : "0",
1333                                errorcss: ".html5box-error" + inst.options.errorcss,
1334                                id: 0
1335                            })
1336                    }
1337                    inst.$elem.show();
1338                    inst.showData()
1339                })
1340            };
1341            inst.loadNext = function() {
1342                $(window).trigger("html5lightbox.videofinished");
1343                if (inst.autosliding) inst.gotoSlide(-1);
1344                else if (inst.options.autoclose) setTimeout(function() {
1345                    inst.finish()
1346                }, inst.options.autoclosedelay)
1347            };
1348            inst.getYoutubeParams = function(href) {
1349                var result = {};
1350                if (href.indexOf("?") < 0) return result;
1351                var params = href.substring(href.indexOf("?") + 1).split("&");
1352                for (var i = 0; i < params.length; i++) {
1353                    var value = params[i].split("=");
1354                    if (value && value.length == 2 && value[0].toLowerCase() != "v") result[value[0].toLowerCase()] = value[1]
1355                }
1356                return result
1357            };
1358            inst.getYoutubeId = function(href) {
1359                var youtubeId =
1360                    "";
1361                var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\??v?=?))([^#\&\?]*).*/;
1362                var match = href.match(regExp);
1363                if (match && match[7] && match[7].length == 11) youtubeId = match[7];
1364                return youtubeId
1365            };
1366            inst.prepareYoutubeHref = function(href) {
1367                var youtubeId = inst.getYoutubeId(href);
1368                var protocol = "https:";
1369                var result = protocol + "//www.youtube.com/embed/" + youtubeId;
1370                var params = this.getYoutubeParams(href);
1371                var first = true;
1372                for (var key in params) {
1373                    if (first) {
1374                        result += "?";
1375                        first = false
1376                    } else result += "&";
1377                    result += key + "=" + params[key]
1378                }
1379                return result
1380            };
1381            inst.prepareDailymotionHref = function(href) {
1382                if (href.match(/\:\/\/.*(dai\.ly)/i)) {
1383                    var protocol = "https:";
1384                    var id = href.match(/(dai\.ly\/)([a-zA-Z0-9\-\_]+)/)[2];
1385                    href = protocol + "//www.dailymotion.com/embed/video/" + id
1386                }
1387                return href
1388            };
1389            inst.showYoutubeVimeo = function(elem) {
1390                inst.slideTimeout.stop();
1391                var dataW = elem[ELEM_WIDTH] ? elem[ELEM_WIDTH] : DEFAULT_WIDTH;
1392                var dataH = elem[ELEM_HEIGHT] ? elem[ELEM_HEIGHT] : DEFAULT_HEIGHT;
1393                var sizeObj = inst.calcElemSize({
1394                    w: dataW,
1395                    h: dataH
1396                }, true);
1397                dataW = sizeObj.w;
1398                dataH = sizeObj.h;
1399                inst.resizeLightbox(dataW,
1400                    dataH, true,
1401                    function() {
1402                        inst.$loading.hide();
1403                        inst.showTitle(sizeObj.w, elem[ELEM_TITLE], elem[ELEM_DESCRIPTION]);
1404                        inst.$image.html("<div class='html5lightbox-video' style='display:block;width:100%;height:100%;overflow:hidden;'></div>").show();
1405                        var href = elem[ELEM_HREF];
1406                        var youtubeid = "";
1407                        if (elem[ELEM_TYPE] == 3) {
1408                            youtubeid = inst.getYoutubeId(href);
1409                            href = inst.prepareYoutubeHref(href)
1410                        }
1411                        if (elem[ELEM_TYPE] == 9) href = inst.prepareDailymotionHref(href);
1412                        if (inst.options.autoplay) {
1413                            href += href.indexOf("?") < 0 ? "?" : "&";
1414                            if (elem[ELEM_TYPE] ==
1415                                11) href += "autoPlay=true";
1416                            else href += "autoplay=1"
1417                        }
1418                        if (inst.options.loopvideo) {
1419                            href += href.indexOf("?") < 0 ? "?" : "&";
1420                            switch (elem[ELEM_TYPE]) {
1421                                case 3:
1422                                    href += "loop=1&playlist=" + youtubeid;
1423                                    break;
1424                                case 4:
1425                                case 9:
1426                                    href += "loop=1";
1427                                    break;
1428                                case 11:
1429                                    href += "endVideoBehavior=loop";
1430                                    break
1431                            }
1432                        }
1433                        if (elem[ELEM_TYPE] == 3) {
1434                            if (href.indexOf("?") < 0) href += "?wmode=transparent&rel=0";
1435                            else href += "&wmode=transparent&rel=0";
1436                            if (inst.options.videohidecontrols) href += "&controls=0&showinfo=0";
1437                            href += "&enablejsapi=1&origin=" + document.location.protocol +
1438                                "//" + document.location.hostname
1439                        } else if (elem[ELEM_TYPE] == 4) {
1440                            href += href.indexOf("?") < 0 ? "?" : "&";
1441                            href += "api=1&player_id=html5boxiframevideo" + inst.options.curElem
1442                        }
1443                        $(".html5lightbox-video", inst.$image).html("<iframe style='margin:0;padding:0;border:0;' class='html5boxiframevideo' id='html5boxiframevideo" + inst.options.curElem + "' width='100%' height='100%' src='" + href + "' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>");
1444                        inst.$elem.show();
1445                        inst.showData();
1446                        if (elem[ELEM_TYPE] ==
1447                            3 && typeof YT === "object" && typeof YT.Player === "function") inst.ytplayer = new YT.Player("html5boxiframevideo" + inst.options.curElem, {
1448                            events: {
1449                                "onStateChange": function(event) {
1450                                    if (event.data == YT.PlayerState.ENDED) {
1451                                        $(window).trigger("html5lightbox.videofinished");
1452                                        if (inst.autosliding) inst.gotoSlide(-1);
1453                                        else if (inst.options.autoclose) setTimeout(function() {
1454                                            inst.finish()
1455                                        }, inst.options.autoclosedelay)
1456                                    }
1457                                }
1458                            }
1459                        });
1460                        else if (elem[ELEM_TYPE] == 4 && typeof $f === "function") {
1461                            var vimeoIframe = $("#html5boxiframevideo" + inst.options.curElem)[0];
1462                            inst.vimeoPlayer = $f(vimeoIframe);
1463                            inst.vimeoPlayer.addEvent("ready", function() {
1464                                inst.vimeoPlayer.addEvent("finish", function(id) {
1465                                    $(window).trigger("html5lightbox.videofinished");
1466                                    if (inst.autosliding) inst.gotoSlide(-1);
1467                                    else if (inst.options.autoclose) setTimeout(function() {
1468                                        inst.finish()
1469                                    }, inst.options.autoclosedelay)
1470                                })
1471                            })
1472                        }
1473                    })
1474            };
1475            inst.showPDF = function(elem) {
1476                if (inst.options.enablepdfjs) {
1477                    if (inst.options.isIPhone && inst.options.openpdfinnewtaboniphone || inst.options.isIPad && inst.options.openpdfinnewtabonipad) {
1478                        var win =
1479                            window.open(elem[ELEM_HREF], "_blank");
1480                        win.focus();
1481                        inst.finish();
1482                        return
1483                    }
1484                    if (!inst.options.pdfjsengine) inst.options.pdfjsengine = inst.options.jsfolder + "pdfjs/web/viewer.html";
1485                    var href = elem[ELEM_HREF];
1486                    if (href.substring(0, 5) != "http:" && href.substring(0, 6) != "https:") href = inst.absoluteUrl(href);
1487                    var pdfelem = jQuery.extend(true, {}, elem);
1488                    pdfelem[ELEM_HREF] = inst.options.pdfjsengine + "?file=" + encodeURIComponent(href);
1489                    inst.showWeb(pdfelem)
1490                } else if (inst.options.isIPhone || inst.options.isIPad || inst.options.isAndroid ||
1491                    inst.options.isIE || inst.options.isIE11) {
1492                    var win = window.open(elem[ELEM_HREF], "_blank");
1493                    win.focus();
1494                    inst.finish();
1495                    return
1496                } else inst.showWeb(elem)
1497            };
1498            inst.showMP3 = function(elem) {};
1499            inst.showDiv = function(elem) {
1500                var winWidth = $(window).width();
1501                var winH = $(window).height();
1502                var navH = inst.options.shownavigation && inst.navvisible ? inst.options.navheight : 0;
1503                var dataW = elem[ELEM_WIDTH] ? elem[ELEM_WIDTH] : winWidth;
1504                var dataH = elem[ELEM_HEIGHT] ? elem[ELEM_HEIGHT] : winH - navH;
1505                var sizeObj = inst.calcElemSize({
1506                    w: dataW,
1507                    h: dataH
1508                }, false);
1509                dataW = sizeObj.w;
1510                dataH = sizeObj.h;
1511                inst.resizeLightbox(dataW, dataH, true, function() {
1512                    inst.$loading.hide();
1513                    inst.showTitle(sizeObj.w, elem[ELEM_TITLE], elem[ELEM_DESCRIPTION]);
1514                    inst.$image.html("<div class='html5lightbox-div' id='html5lightbox-div" + inst.options.curElem + "' style='display:block;width:100%;height:" + (inst.options.autoresizecontent ? "auto" : "100%") + ";" + (inst.options.isIOS ? "-webkit-overflow-scrolling:touch;overflow-y:scroll;" : "overflow:auto;") + "'></div>").show();
1515                    var divID = elem[ELEM_HREF];
1516                    if ($(divID).length >
1517                        0) $(divID).children().appendTo($("#html5lightbox-div" + inst.options.curElem, inst.$image));
1518                    else $("#html5lightbox-div" + inst.options.curElem, inst.$image).html("<div class='html5-error'>The specified div ID does not exist.</div>");
1519                    inst.$elem.show();
1520                    inst.showData();
1521                    if (inst.options.autoresizecontent) inst.resizeWindow();
1522                    if (inst.autosliding) {
1523                        inst.slideTimeout.stop();
1524                        inst.slideTimeout.start()
1525                    }
1526                })
1527            };
1528            inst.isSameDomain = function(href) {
1529                if (href.substring(0, 5) != "http:" && href.substring(0, 6) != "https:") return true;
1530                var link =
1531                    document.createElement("a");
1532                link.setAttribute("href", href);
1533                var result = link.protocol == document.location.protocol && link.host == document.location.host && link.port == document.location.port;
1534                link = null;
1535                return result
1536            };
1537            inst.showWeb = function(elem) {
1538                var winWidth = $(window).width();
1539                var winH = $(window).height();
1540                var navH = inst.options.shownavigation && inst.navvisible ? inst.options.navheight : 0;
1541                var dataW = elem[ELEM_WIDTH] ? elem[ELEM_WIDTH] : winWidth;
1542                var dataH = elem[ELEM_HEIGHT] ? elem[ELEM_HEIGHT] : winH - navH;
1543                var sizeObj = inst.calcElemSize({
1544                    w: dataW,
1545                    h: dataH
1546                }, false);
1547                dataW = sizeObj.w;
1548                dataH = sizeObj.h;
1549                inst.resizeLightbox(dataW, dataH, true, function() {
1550                    inst.$loading.hide();
1551                    inst.showTitle(sizeObj.w, elem[ELEM_TITLE], elem[ELEM_DESCRIPTION]);
1552                    inst.$image.html("<div class='html5lightbox-web' style='display:block;width:100%;height:100%;" + (inst.options.isIOS ? "-webkit-overflow-scrolling:touch;overflow-y:scroll;" : "") + "'></div>").show();
1553                    $(".html5lightbox-web", inst.$image).html("<iframe style='margin:0;padding:0;border:0;' class='html5lightbox-web-iframe' width='100%' height='100%' src='" +
1554                        elem[ELEM_HREF] + "' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>");
1555                    inst.$elem.show();
1556                    inst.showData();
1557                    if (inst.options.autoresizecontent && inst.isSameDomain(elem[ELEM_HREF])) {
1558                        $(".html5lightbox-web-iframe", inst.$image).data("sameorigin", true);
1559                        $(".html5lightbox-web-iframe", inst.$image).on("load", function() {
1560                            $(this).data("sameoriginloaded", true);
1561                            inst.resizeWindow()
1562                        })
1563                    }
1564                    if (inst.autosliding) {
1565                        inst.slideTimeout.stop();
1566                        inst.slideTimeout.start()
1567                    }
1568                })
1569            };
1570            inst.scrollBox = function() {};
1571            inst.resizeWindow = function() {
1572                if (!inst.currentElem) return;
1573                if (!inst.options.responsive) return;
1574                var winWidth = $(window).width();
1575                var winH = $(window).height();
1576                if (inst.options.responsivebarheight) {
1577                    if (winH <= inst.options.smallscreenheight) inst.options.barheight = inst.options.barheightonsmallheight;
1578                    else inst.options.barheight = inst.options.barheightoriginal;
1579                    if (inst.options.titlestyle == "bottom" && inst.options.barautoheight != "auto") inst.$elemData.css({
1580                        height: inst.options.barheight + "px",
1581                        "max-height": inst.options.barheight +
1582                            "px"
1583                    })
1584                }
1585                if (!(inst.options.showtitle && inst.currentElem[ELEM_TITLE] && inst.currentElem[ELEM_TITLE].length > 0 || inst.options.showdescription && inst.currentElem[ELEM_DESCRIPTION] && inst.currentElem[ELEM_DESCRIPTION].length > 0 || inst.options.inGroup && (inst.options.showplaybutton || inst.options.showtitleprefix))) inst.options.barheight = 0;
1586                var elemW, elemH, keepratio;
1587                if (inst.currentElem[ELEM_TYPE] == 5 || inst.currentElem[ELEM_TYPE] == 7 || inst.currentElem[ELEM_TYPE] == 10) {
1588                    var navH = inst.options.shownavigation && inst.navvisible ?
1589                        inst.options.navheight : 0;
1590                    elemW = inst.currentElem[ELEM_WIDTH] ? inst.currentElem[ELEM_WIDTH] : winWidth;
1591                    elemH = inst.currentElem[ELEM_HEIGHT] ? inst.currentElem[ELEM_HEIGHT] : winH - navH;
1592                    keepratio = false
1593                } else {
1594                    elemW = inst.currentElem[ELEM_WIDTH] ? inst.currentElem[ELEM_WIDTH] : DEFAULT_WIDTH;
1595                    elemH = inst.currentElem[ELEM_HEIGHT] ? inst.currentElem[ELEM_HEIGHT] : DEFAULT_HEIGHT;
1596                    if (inst.currentElem[ELEM_TYPE] == 0) keepratio = inst.options.imagekeepratio;
1597                    else keepratio = true
1598                }
1599                var sizeObj = inst.calcElemSize({
1600                    w: elemW,
1601                    h: elemH
1602                }, keepratio);
1603                var boxPos = inst.calcBoxPosition(sizeObj.w, sizeObj.h);
1604                var boxW = boxPos[0];
1605                var boxH = boxPos[1];
1606                var boxT = boxPos[2];
1607                inst.$lightboxBox.css({
1608                    "margin-top": boxT
1609                });
1610                if (inst.options.titlestyle == "left" || inst.options.titlestyle == "right") inst.$lightboxBox.css({
1611                    "width": boxW,
1612                    "height": boxH
1613                });
1614                else {
1615                    inst.$lightboxBox.css({
1616                        "width": boxW,
1617                        "height": "auto"
1618                    });
1619                    inst.$elemWrap.css({
1620                        "width": boxW,
1621                        "height": boxH
1622                    })
1623                }
1624                if (inst.options.titlestyle == "inside") inst.$elemData.css({
1625                    width: sizeObj.w + "px"
1626                });
1627                if (inst.options.autoresizecontent && (inst.currentElem[ELEM_TYPE] ==
1628                        5 || inst.currentElem[ELEM_TYPE] == 7 || inst.currentElem[ELEM_TYPE] == 10)) {
1629                    var resizeHeight = false;
1630                    if (inst.currentElem[ELEM_TYPE] == 7 && $(".html5lightbox-web-iframe", inst.$lightbox).length > 0 && $(".html5lightbox-web-iframe", inst.$lightbox).data("sameoriginloaded")) {
1631                        var iframe = $(".html5lightbox-web-iframe", inst.$lightbox)[0];
1632                        if (iframe && iframe.contentWindow && iframe.contentWindow.document && iframe.contentWindow.document.documentElement.offsetHeight)
1633                            if (elemH > iframe.contentWindow.document.documentElement.offsetHeight) {
1634                                elemH =
1635                                    iframe.contentWindow.document.documentElement.offsetHeight;
1636                                resizeHeight = true
1637                            }
1638                    } else if (inst.currentElem[ELEM_TYPE] == 10 && $(".html5lightbox-div", inst.$lightbox).length > 0) {
1639                        var divH = $(".html5lightbox-div", inst.$lightbox).height();
1640                        if (elemH > divH) {
1641                            elemH = divH;
1642                            resizeHeight = true
1643                        }
1644                    }
1645                    if (resizeHeight) {
1646                        sizeObj = inst.calcElemSize({
1647                            w: elemW,
1648                            h: elemH
1649                        }, keepratio);
1650                        boxPos = inst.calcBoxPosition(sizeObj.w, sizeObj.h);
1651                        boxW = boxPos[0];
1652                        boxH = boxPos[1];
1653                        boxT = boxPos[2];
1654                        inst.$lightboxBox.css({
1655                            "margin-top": boxT
1656                        });
1657                        if (inst.options.titlestyle ==
1658                            "left" || inst.options.titlestyle == "right") inst.$lightboxBox.css({
1659                            "height": boxH
1660                        });
1661                        else {
1662                            inst.$lightboxBox.css({
1663                                "height": "auto"
1664                            });
1665                            inst.$elemWrap.css({
1666                                "height": boxH
1667                            })
1668                        }
1669                    }
1670                }
1671                if ($(".html5-nav").length <= 0) return;
1672                $(".html5-nav-list").css({
1673                    "margin-left": 0
1674                });
1675                var $navMask = $(".html5-nav-mask");
1676                var $navPrev = $(".html5-nav-prev");
1677                var $navNext = $(".html5-nav-next");
1678                var winWidth = $(window).width();
1679                if (inst.options.totalwidth <= winWidth) {
1680                    $navMask.css({
1681                        width: inst.options.totalwidth + "px"
1682                    });
1683                    $navPrev.hide();
1684                    $navNext.hide()
1685                } else {
1686                    $navMask.css({
1687                        width: winWidth -
1688                            2 * inst.options.navbuttonwidth + "px"
1689                    });
1690                    $navPrev.show();
1691                    $navNext.show()
1692                }
1693            };
1694            inst.calcElemSize = function(sizeObj, keepratio) {
1695                if (!inst.options.responsive) return sizeObj;
1696                var winWidth = $(window).width();
1697                winWidth = winWidth ? winWidth : $(document).width();
1698                var winH = $(window).height();
1699                winH = winH ? winH : $(document).height();
1700                if ((inst.options.titlestyle == "left" || inst.options.titlestyle == "right") && winWidth > inst.options.sidetobottomscreenwidth) sizeObj.w = sizeObj.w * 100 / inst.options.imagepercentage;
1701                var navH = inst.options.shownavigation &&
1702                    inst.navvisible ? inst.options.navheight : 0;
1703                var topmargin = $(window).width() < inst.options.navarrowsbottomscreenwidth ? inst.options.bordertopmarginsmall : inst.options.bordertopmargin;
1704                var h0 = winH - navH - 2 * inst.options.bordersize - 2 * topmargin;
1705                if (inst.options.titlestyle == "bottom") h0 -= inst.options.barheight;
1706                var w0 = winWidth - 2 * inst.options.bordersize - 2 * inst.options.bordermargin;
1707                if (inst.options.fullscreenmode && winWidth > inst.options.navarrowsbottomscreenwidth || (inst.options.isTouch && inst.options.navarrowsalwaysshowontouch ||
1708                        inst.options.alwaysshownavarrows) && winWidth > inst.options.navarrowsbottomscreenwidth) w0 -= 64;
1709                if ((inst.options.titlestyle == "left" || inst.options.titlestyle == "right") && winWidth <= inst.options.sidetobottomscreenwidth || inst.options.notkeepratioonsmallheight && winH <= inst.options.smallscreenheight) keepratio = false;
1710                if (inst.currentElem[ELEM_TYPE] == 0 && keepratio) {
1711                    var ratio = inst.currentElem[ELEM_ORIGINALWIDTH] / inst.currentElem[ELEM_ORIGINALHEIGHT];
1712                    sizeObj.h = Math.round(sizeObj.w / ratio);
1713                    if (sizeObj.h > h0) {
1714                        sizeObj.w = Math.round(ratio *
1715                            h0);
1716                        sizeObj.h = h0
1717                    }
1718                    if (sizeObj.w > w0) {
1719                        sizeObj.h = Math.round(w0 / ratio);
1720                        sizeObj.w = w0
1721                    }
1722                } else {
1723                    if (sizeObj.h > h0) {
1724                        if (keepratio) sizeObj.w = Math.round(sizeObj.w * h0 / sizeObj.h);
1725                        sizeObj.h = h0
1726                    } else if (inst.options.maxheight) sizeObj.h = h0;
1727                    if (sizeObj.w > w0) {
1728                        if (keepratio) sizeObj.h = Math.round(sizeObj.h * w0 / sizeObj.w);
1729                        sizeObj.w = w0
1730                    }
1731                }
1732                return sizeObj
1733            };
1734            inst.showData = function() {
1735                if (inst.$text.text().length > 0) inst.$elemData.show();
1736                if (inst.options.titlestyle == "bottom" || inst.options.titlestyle == "inside") inst.$lightboxBox.css({
1737                    height: "auto"
1738                });
1739                if (inst.$text.text().length > 0 && inst.options.titlestyle == "bottom") inst.$elemData.css({
1740                    "max-height": inst.options.barheight + "px"
1741                });
1742                if (inst.options.positionFixed) $("#html5-lightbox-overlay", inst.$lightbox).css({
1743                    height: Math.max($(window).height(), $(document).height())
1744                });
1745                else $("#html5-lightbox-overlay", inst.$lightbox).css({
1746                    height: "100%"
1747                });
1748                $(window).trigger("html5lightbox.lightboxopened")
1749            };
1750            inst.resizeLightbox = function(elemW, elemH, bAnimate, onFinish) {
1751                inst.hideNavArrows();
1752                var boxPos = inst.calcBoxPosition(elemW,
1753                    elemH);
1754                var boxW = boxPos[0];
1755                var boxH = boxPos[1];
1756                var boxT = boxPos[2];
1757                inst.$loading.hide();
1758                inst.$watermark.hide();
1759                if (inst.options.nextElem <= inst.options.curElem)
1760                    if (inst.options.onlastitem && window[inst.options.onlastitem] && typeof window[inst.options.onlastitem] == "function") window[inst.options.onlastitem](inst.currentElem);
1761                if (inst.options.prevElem >= inst.options.curElem)
1762                    if (inst.options.onfirstitem && window[inst.options.onfirstitem] && typeof window[inst.options.onfirstitem] == "function") window[inst.options.onfirstitem](inst.currentElem);
1763                if (!inst.options.fullscreenmode && (!inst.options.isTouch || !inst.options.navarrowsalwaysshowontouch) && !inst.options.alwaysshownavarrows) {
1764                    inst.$lightboxBox.on("mouseenter mousemove", function() {
1765                        if (inst.options.arrowloop && inst.options.prevElem >= 0 || !inst.options.arrowloop && inst.options.prevElem >= 0 && inst.options.prevElem < inst.options.curElem) inst.$prev.fadeIn();
1766                        if (inst.options.arrowloop && inst.options.nextElem >= 0 || !inst.options.arrowloop && inst.options.nextElem >= 0 && inst.options.nextElem > inst.options.curElem) inst.$next.fadeIn()
1767                    });
1768                    inst.$lightboxBox.on("mouseleave", function() {
1769                        inst.$next.fadeOut();
1770                        inst.$prev.fadeOut()
1771                    })
1772                }
1773                var existingBoxT = parseInt(inst.$lightboxBox.css("margin-top"));
1774                inst.$lightboxBox.css({
1775                    "margin-top": boxT
1776                });
1777                var speed = bAnimate ? inst.options.resizespeed : 0;
1778                if (inst.options.transition == "slide" && inst.existingElem >= 0) speed = 0;
1779                if (inst.options.titlestyle == "left" || inst.options.titlestyle == "right") {
1780                    if (boxW == inst.$lightboxBox.width() && boxH == inst.$lightboxBox.height()) speed = 0;
1781                    inst.$lightboxBox.animate({
1782                        width: boxW
1783                    }, speed).animate({
1784                            height: boxH
1785                        },
1786                        speed,
1787                        function() {
1788                            inst.onAnimateFinish(onFinish)
1789                        })
1790                } else {
1791                    if (boxW == inst.$elemWrap.width() && boxH == inst.$elemWrap.height()) speed = 0;
1792                    inst.$lightboxBox.css({
1793                        "width": boxW,
1794                        "height": "auto"
1795                    });
1796                    if (inst.options.transition == "slide" && inst.existingElem >= 0)
1797                        if ($(".html5-elem-box-previous", inst.$lightbox).length > 0) $(".html5-elem-box-previous", inst.$lightbox).css({
1798                            "margin-left": String(boxW / 2 - $(".html5-elem-box-previous", inst.$lightbox).width() / 2) + "px",
1799                            top: String(existingBoxT - boxT) + "px"
1800                        });
1801                    inst.$elemWrap.animate({
1802                            width: boxW
1803                        },
1804                        speed).animate({
1805                        height: boxH
1806                    }, speed, function() {
1807                        inst.onAnimateFinish(onFinish)
1808                    })
1809                }
1810            };
1811            inst.onAnimateFinish = function(onFinish) {
1812                inst.$loading.show();
1813                inst.$watermark.show();
1814                inst.$close.show();
1815                inst.$elem.css({
1816                    "background-color": inst.options.bgcolor
1817                });
1818                onFinish();
1819                inst.finishCallback()
1820            };
1821            inst.finishCallback = function() {
1822                if (inst.options.transition == "slide" && inst.existingElem >= 0) {
1823                    inst.$prevelem.animate({
1824                        left: inst.direction == -1 ? "-100%" : "100%",
1825                        opacity: 0
1826                    }, {
1827                        duration: inst.options.transitionduration
1828                    });
1829                    inst.$elem.animate({
1830                        left: 0,
1831                        opacity: 1
1832                    }, {
1833                        duration: inst.options.transitionduration,
1834                        always: function() {
1835                            inst.$prevelem.remove();
1836                            inst.$elem.removeClass("html5-elem-box-current").css({
1837                                position: "relative",
1838                                height: "100%"
1839                            })
1840                        }
1841                    })
1842                }
1843            }, inst.resetDiv = function(elemID) {
1844                if (inst.elemArray.length > 0 && elemID >= 0)
1845                    if (inst.elemArray[elemID][ELEM_TYPE] == 10) {
1846                        var divID = inst.elemArray[elemID][ELEM_HREF];
1847                        if ($(divID).length > 0) $("#html5lightbox-div" + elemID).children().appendTo($(divID))
1848                    }
1849            };
1850            inst.reset = function() {
1851                if (inst.options.stamp) inst.$watermark.hide();
1852                inst.showing =
1853                    false;
1854                inst.$image.empty();
1855                inst.$text.empty();
1856                inst.$error.hide();
1857                inst.$loading.hide();
1858                inst.$image.hide();
1859                if (inst.options.titlestyle == "bottom" || inst.options.titlestyle == "inside") inst.$elemData.hide();
1860                if (!inst.options.fullscreenmode) inst.$close.hide();
1861                inst.$elem.css({
1862                    "background-color": ""
1863                })
1864            };
1865            inst.resetNavigation = function() {
1866                inst.options.navheight = 0;
1867                $(".html5-nav").remove();
1868                inst.navvisible = false
1869            };
1870            inst.finish = function() {
1871                inst.existingElem = -1;
1872                inst.resetDiv(inst.options.curElem);
1873                if ($(".html5-lightbox-video",
1874                        inst.$lightbox).length) $(".html5-lightbox-video", inst.$lightbox).attr("src", "");
1875                $("head").find("style").each(function() {
1876                    if ($(this).data("creator") == "html5box-html5-lightbox") $(this).remove()
1877                });
1878                if (inst.options.bodynoscroll) $("html,body").removeClass("bodynoscroll");
1879                inst.slideTimeout.stop();
1880                inst.reset();
1881                inst.resetNavigation();
1882                inst.$lightbox.remove();
1883                $("#html5box-html5-lightbox").remove();
1884                inst.showObjects();
1885                if (inst.options.oncloselightbox && window[inst.options.oncloselightbox] && typeof window[inst.options.oncloselightbox] ==
1886                    "function") window[inst.options.oncloselightbox](inst.currentElem);
1887                if (inst.onLightboxClosed && typeof inst.onLightboxClosed == "function") inst.onLightboxClosed(inst.currentElem);
1888                $(window).trigger("html5lightbox.lightboxclosed")
1889            };
1890            inst.pauseSlide = function() {};
1891            inst.playSlide = function() {};
1892            inst.gotoSlide = function(slide) {
1893                inst.existingElem = inst.options.curElem;
1894                inst.direction = slide;
1895                inst.resetDiv(inst.options.curElem);
1896                if (slide == -1) {
1897                    if (inst.options.nextElem < 0) return;
1898                    inst.options.curElem = inst.options.nextElem
1899                } else if (slide ==
1900                    -2) {
1901                    if (inst.options.prevElem < 0) return;
1902                    inst.options.curElem = inst.options.prevElem
1903                } else if (slide >= 0) {
1904                    inst.direction = slide > inst.options.curElem ? -1 : -2;
1905                    inst.options.curElem = slide
1906                }
1907                if (inst.autosliding) inst.slideTimeout.stop();
1908                inst.calcNextPrevElem();
1909                if (inst.options.transition == "none") inst.reset();
1910                inst.loadCurElem()
1911            };
1912            inst.enableSwipe = function() {
1913                var preventDefault = inst.options.isAndroid && (inst.options.swipepreventdefaultonandroid || inst.options.androidVersion >= 0 && inst.options.androidVersion <= 5) ? true : false;
1914                inst.$lightboxBox.html5lightboxTouchSwipe({
1915                    preventWebBrowser: preventDefault,
1916                    swipeDistance: inst.options.swipedistance,
1917                    swipeLeft: function() {
1918                        inst.gotoSlide(-1)
1919                    },
1920                    swipeRight: function() {
1921                        inst.gotoSlide(-2)
1922                    }
1923                })
1924            };
1925            inst.hideObjects = function() {
1926                $("select, embed, object").css({
1927                    "visibility": "hidden"
1928                })
1929            };
1930            inst.showObjects = function() {
1931                $("select, embed, object").css({
1932                    "visibility": "visible"
1933                })
1934            };
1935            inst.embedHTML5Video = function($container, src, autoplay, loopvideo) {
1936                $container.html("<div style='display:block;width:100%;height:100%;position:relative;'><video class='html5-lightbox-video' width='100%' height='100%'" +
1937                    (inst.options.html5videoposter && inst.options.html5videoposter.length > 0 ? "poster='" + inst.options.html5videoposter + "'" : "") + (autoplay ? " autoplay" : "") + (loopvideo ? " loop" : "") + (inst.options.nativehtml5controls && !inst.options.videohidecontrols ? " controls='controls'" : "") + " src='" + src + "'></div>");
1938                if (!inst.options.nativehtml5controls) {
1939                    $("video", $container).data("src", src);
1940                    $("video", $container).lightboxHTML5VideoControls(inst.options.skinsfolder, inst, inst.options.videohidecontrols, false, inst.options.defaultvideovolume)
1941                }
1942                $("video",
1943                    $container).off("ended").on("ended", function() {
1944                    $(window).trigger("html5lightbox.videofinished");
1945                    if (inst.autosliding) inst.gotoSlide(-1);
1946                    else if (inst.options.autoclose) setTimeout(function() {
1947                        inst.finish()
1948                    }, inst.options.autoclosedelay)
1949                })
1950            };
1951            inst.embedFlash = function($container, src, wmode, flashVars) {
1952                if (inst.options.flashInstalled) {
1953                    var htmlOptions = {
1954                        pluginspage: "http://www.adobe.com/go/getflashplayer",
1955                        quality: "high",
1956                        allowFullScreen: "true",
1957                        allowScriptAccess: "always",
1958                        type: "application/x-shockwave-flash"
1959                    };
1960                    htmlOptions.width =
1961                        "100%";
1962                    htmlOptions.height = "100%";
1963                    htmlOptions.src = src;
1964                    htmlOptions.flashVars = $.param(flashVars);
1965                    htmlOptions.wmode = wmode;
1966                    var htmlString = "";
1967                    for (var key in htmlOptions) htmlString += key + "=" + htmlOptions[key] + " ";
1968                    $container.html("<embed " + htmlString + "/>")
1969                } else $container.html("<div class='html5lightbox-flash-error' style='display:block; position:relative;text-align:center; width:100%; left:0px; top:40%;'><div class='html5-error'><div>The required Adobe Flash Player plugin is not installed</div><br /><div style='display:block;position:relative;text-align:center;width:112px;height:33px;margin:0px auto;'><a href='http://www.adobe.com/go/getflashplayer'><img src='http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' width='112' height='33'></img></a></div></div>")
1970            };
1971            inst.checkType = function(href) {
1972                if (!href) return -1;
1973                if (href.match(/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i)) return 0;
1974                if (href.match(/[^\.]\.(swf)\s*$/i)) return 1;
1975                if (href.match(/\.(mp4|m4v|ogv|ogg|webm)(.*)?$/i)) return 2;
1976                if (href.match(/\:\/\/.*(youtube\.com)/i) || href.match(/\:\/\/.*(youtu\.be)/i)) return 3;
1977                if (href.match(/\:\/\/.*(vimeo\.com)/i)) return 4;
1978                if (href.match(/\:\/\/.*(dailymotion\.com)/i) || href.match(/\:\/\/.*(dai\.ly)/i)) return 9;
1979                if (href.match(/[^\.]\.(pdf)\s*$/i)) return 5;
1980                if (href.match(/[^\.]\.(mp3)\s*$/i)) return 6;
1981                if (href.match(/[^\.]\.(flv)\s*$/i)) return 8;
1982                if (href.match(/\#\w+/i)) return 10;
1983                if (href.match(/\:\/\/.*(wistia)/i)) return 11;
1984                return 7
1985            };
1986            inst.getURLParams = function() {
1987                var result = {};
1988                var params = window.location.search.substring(1).split("&");
1989                for (var i = 0; i < params.length; i++) {
1990                    var value = params[i].split("=");
1991                    if (value && value.length == 2) result[value[0].toLowerCase()] = unescape(value[1])
1992                }
1993                return result
1994            };
1995            inst.absoluteUrl = function(href) {
1996                var link = document.createElement("a");
1997                link.href = href;
1998                return link.protocol + "//" + link.host +
1999                    link.pathname + link.search + link.hash
2000            };
2001            inst.showLightbox = function(type, href, title, width, height, webm, ogg, thumbnail, description) {
2002                inst.options = $.extend(inst.options, inst.defaultoptions);
2003                $(window).trigger("html5lightbox.lightboxshow");
2004                inst.init();
2005                inst.reset();
2006                inst.$lightbox.show();
2007                var boxPos = inst.calcBoxPosition(inst.options.loadingwidth, inst.options.loadingheight);
2008                var boxW = boxPos[0];
2009                var boxH = boxPos[1];
2010                var boxT = boxPos[2];
2011                inst.$lightboxBox.css({
2012                    "margin-top": boxT
2013                });
2014                if (inst.options.titlestyle == "left" || inst.options.titlestyle ==
2015                    "right") inst.$lightboxBox.css({
2016                    "width": boxW,
2017                    "height": boxH
2018                });
2019                else {
2020                    inst.$lightboxBox.css({
2021                        "width": boxW,
2022                        "height": "auto"
2023                    });
2024                    inst.$elemWrap.css({
2025                        "width": boxW,
2026                        "height": boxH
2027                    })
2028                }
2029                inst.loadElem(new Array(type, href, title, null, width, height, webm, ogg, thumbnail, description))
2030            };
2031            inst.addItem = function(href, title, group, width, height, webm, ogg, thumbnail, description, mediatype) {
2032                type = mediatype && mediatype >= 0 ? mediatype : inst.checkType(href);
2033                inst.elemArray.push(new Array(type, href, title, group, width, height, webm, ogg, thumbnail, description))
2034            };
2035            inst.showItem = function(href) {
2036                inst.options = $.extend(inst.options, inst.defaultoptions);
2037                $(window).trigger("html5lightbox.lightboxshow");
2038                inst.init();
2039                if (inst.elemArray.length <= 0) return true;
2040                inst.hideObjects();
2041                for (var i = 0; i < inst.elemArray.length; i++)
2042                    if (inst.elemArray[i][ELEM_HREF] == href) break;
2043                if (i == inst.elemArray.length) return true;
2044                inst.options.curElem = i;
2045                inst.calcNextPrevElem();
2046                inst.reset();
2047                inst.$lightbox.show();
2048                var boxPos = inst.calcBoxPosition(inst.options.loadingwidth, inst.options.loadingheight);
2049                var boxW =
2050                    boxPos[0];
2051                var boxH = boxPos[1];
2052                var boxT = boxPos[2];
2053                inst.$lightboxBox.css({
2054                    "margin-top": boxT
2055                });
2056                if (inst.options.titlestyle == "left" || inst.options.titlestyle == "right") inst.$lightboxBox.css({
2057                    "width": boxW,
2058                    "height": boxH
2059                });
2060                else {
2061                    inst.$lightboxBox.css({
2062                        "width": boxW,
2063                        "height": "auto"
2064                    });
2065                    inst.$elemWrap.css({
2066                        "width": boxW,
2067                        "height": boxH
2068                    })
2069                }
2070                inst.loadCurElem();
2071                return false
2072            };
2073            inst.off("click").click(inst.clickHandler);
2074            inst.each(function() {
2075                var self = $(this);
2076                var autoopen = false;
2077                var autoopendelay = 0;
2078                if (typeof html5lightbox_options !=
2079                    "undefined" && html5lightbox_options) {
2080                    if ("autoopen" in html5lightbox_options) autoopen = html5lightbox_options.autoopen;
2081                    if ("autoopendelay" in html5lightbox_options) autoopendelay = html5lightbox_options.autoopendelay
2082                }
2083                autoopen = self.data("autoopen") ? self.data("autoopen") : autoopen;
2084                autoopendelay = self.data("autoopendelay") ? self.data("autoopendelay") : autoopendelay;
2085                if (autoopen) {
2086                    setTimeout(function() {
2087                        self.click()
2088                    }, autoopendelay);
2089                    return false
2090                }
2091            });
2092            var urlParams = inst.getURLParams();
2093            if ("html5lightboxshare" in urlParams) {
2094                var shareUrl =
2095                    decodeURIComponent(urlParams["html5lightboxshare"]);
2096                var shareLink = $('.html5lightbox[href="' + shareUrl + '"]');
2097                if (shareLink.length > 0) shareLink.click()
2098            }
2099            return inst
2100        }
2101    })(jQuery);
2102    (function($) {
2103        $.fn.html5lightboxTouchSwipe = function(options) {
2104            var defaults = {
2105                preventWebBrowser: false,
2106                swipeDistance: 0,
2107                swipeLeft: null,
2108                swipeRight: null,
2109                swipeTop: null,
2110                swipeBottom: null
2111            };
2112            if (options) $.extend(defaults, options);
2113            return this.each(function() {
2114                var startX = -1,
2115                    startY = -1;
2116                var curX = -1,
2117                    curY = -1;
2118
2119                function touchStart(event) {
2120                    var e = event.originalEvent;
2121                    if (e.targetTouches.length >= 1) {
2122                        startX = e.targetTouches[0].pageX;
2123                        startY = e.targetTouches[0].pageY
2124                    } else touchCancel(event)
2125                }
2126
2127                function touchMove(event) {
2128                    if (defaults.preventWebBrowser) event.preventDefault();
2129                    var e = event.originalEvent;
2130                    if (e.targetTouches.length >= 1) {
2131                        curX = e.targetTouches[0].pageX;
2132                        curY = e.targetTouches[0].pageY
2133                    } else touchCancel(event)
2134                }
2135
2136                function touchEnd(event) {
2137                    if (curX > 0 || curY > 0) {
2138                        triggerHandler();
2139                        touchCancel(event)
2140                    } else touchCancel(event)
2141                }
2142
2143                function touchCancel(event) {
2144                    startX = -1;
2145                    startY = -1;
2146                    curX = -1;
2147                    curY = -1
2148                }
2149
2150                function triggerHandler() {
2151                    if (Math.abs(curX - startX) > Math.abs(curY - startY)) {
2152                        if (Math.abs(curX - startX) > defaults.swipeDistance)
2153                            if (curX > startX) {
2154                                if (defaults.swipeRight) defaults.swipeRight.call()
2155                            } else if (defaults.swipeLeft) defaults.swipeLeft.call()
2156                    } else if (Math.abs(curY - startY) > defaults.swipeDistance)
2157                        if (curY > startY) {
2158                            if (defaults.swipeBottom) defaults.swipeBottom.call()
2159                        } else if (defaults.swipeTop) defaults.swipeTop.call()
2160                }
2161                try {
2162                    $(this).on("touchstart", touchStart);
2163                    $(this).on("touchmove", touchMove);
2164                    $(this).on("touchend",
2165                        touchEnd);
2166                    $(this).on("touchcancel", touchCancel)
2167                } catch (e) {}
2168            })
2169        }
2170    })(jQuery);
2171    (function($) {
2172        $.fn.lightboxHTML5VideoControls = function(skinFolder, parentInst, hidecontrols, hideplaybutton, defaultvolume) {
2173            var isTouch = "ontouchstart" in window;
2174            var eStart = isTouch ? "touchstart" : "mousedown";
2175            var eMove = isTouch ? "touchmove" : "mousemove";
2176            var eCancel = isTouch ? "touchcancel" : "mouseup";
2177            var eClick = "click";
2178            var BUTTON_SIZE = 32;
2179            var BAR_HEIGHT = isTouch ? 48 : 36;
2180            var hideControlsTimerId = null;
2181            var hideVolumeBarTimeoutId = null;
2182            var sliderDragging =
2183                false;
2184            var isFullscreen = false;
2185            var userActive = true;
2186            var isIPhone = navigator.userAgent.match(/iPod/i) != null || navigator.userAgent.match(/iPhone/i) != null;
2187            var isHd = $(this).data("ishd");
2188            var hd = $(this).data("hd");
2189            var src = $(this).data("src");
2190            var $videoObj = $(this);
2191            $videoObj.get(0).removeAttribute("controls");
2192            if (isIPhone) {
2193                var h = $videoObj.height() - BAR_HEIGHT;
2194                $videoObj.css({
2195                    height: h
2196                })
2197            }
2198            var $videoPlay = $("<div class='html5boxVideoPlay'></div>");
2199            if (!isIPhone) {
2200                $videoObj.after($videoPlay);
2201                $videoPlay.css({
2202                    position: "absolute",
2203                    top: "50%",
2204                    left: "50%",
2205                    display: "block",
2206                    cursor: "pointer",
2207                    width: 64,
2208                    height: 64,
2209                    "margin-left": -32,
2210                    "margin-top": -32,
2211                    "background-image": "url('" + skinFolder + "html5boxplayer_playvideo.png" + "')",
2212                    "background-position": "center center",
2213                    "background-repeat": "no-repeat"
2214                }).on(eClick, function() {
2215                    $videoObj.get(0).play()
2216                })
2217            }
2218            var $videoFullscreenBg = $("<div class='html5boxVideoFullscreenBg'></div>");
2219            var $videoControls = $("<div class='html5boxVideoControls'>" + "<div class='html5boxVideoControlsBg'></div>" + "<div class='html5boxPlayPause'>" +
2220                "<div class='html5boxPlay'></div>" + "<div class='html5boxPause'></div>" + "</div>" + "<div class='html5boxTimeCurrent'>--:--</div>" + "<div class='html5boxFullscreen'></div>" + "<div class='html5boxHD'></div>" + "<div class='html5boxVolume'>" + "<div class='html5boxVolumeButton'></div>" + "<div class='html5boxVolumeBar'>" + "<div class='html5boxVolumeBarBg'>" + "<div class='html5boxVolumeBarActive'></div>" + "</div>" + "</div>" + "</div>" + "<div class='html5boxTimeTotal'>--:--</div>" + "<div class='html5boxSeeker'>" + "<div class='html5boxSeekerBuffer'></div>" +
2221                "<div class='html5boxSeekerPlay'></div>" + "<div class='html5boxSeekerHandler'></div>" + "</div>" + "<div style='clear:both;'></div>" + "</div>");
2222            $videoObj.after($videoControls);
2223            $videoObj.after($videoFullscreenBg);
2224            $videoFullscreenBg.css({
2225                display: "none",
2226                position: "fixed",
2227                left: 0,
2228                top: 0,
2229                bottom: 0,
2230                right: 0,
2231                "z-index": 2147483647
2232            });
2233            $videoControls.css({
2234                display: "block",
2235                position: "absolute",
2236                width: "100%",
2237                height: BAR_HEIGHT,
2238                left: 0,
2239                bottom: 0,
2240                right: 0,
2241                "max-width": "640px",
2242                margin: "0 auto"
2243            });
2244            var userActivate = function() {
2245                userActive =
2246                    true
2247            };
2248            $videoObj.on(eClick, function() {
2249                userActive = true
2250            }).hover(function() {
2251                userActive = true
2252            }, function() {
2253                userActive = false
2254            });
2255            if (!hidecontrols) setInterval(function() {
2256                if (userActive) {
2257                    $videoControls.show();
2258                    userActive = false;
2259                    clearTimeout(hideControlsTimerId);
2260                    hideControlsTimerId = setTimeout(function() {
2261                        if (!$videoObj.get(0).paused) $videoControls.fadeOut()
2262                    }, 5E3)
2263                }
2264            }, 250);
2265            $(".html5boxVideoControlsBg", $videoControls).css({
2266                display: "block",
2267                position: "absolute",
2268                width: "100%",
2269                height: "100%",
2270                left: 0,
2271                top: 0,
2272                "background-color": "#000000",
2273                opacity: 0.7,
2274                filter: "alpha(opacity=70)"
2275            });
2276            $(".html5boxPlayPause", $videoControls).css({
2277                display: "block",
2278                position: "relative",
2279                width: BUTTON_SIZE + "px",
2280                height: BUTTON_SIZE + "px",
2281                margin: Math.floor((BAR_HEIGHT - BUTTON_SIZE) / 2),
2282                "float": "left"
2283            });
2284            var $videoBtnPlay = $(".html5boxPlay", $videoControls);
2285            var $videoBtnPause = $(".html5boxPause", $videoControls);
2286            $videoBtnPlay.css({
2287                display: "block",
2288                position: "absolute",
2289                top: 0,
2290                left: 0,
2291                width: BUTTON_SIZE + "px",
2292                height: BUTTON_SIZE + "px",
2293                cursor: "pointer",
2294                "background-image": "url('" + skinFolder +
2295                    "html5boxplayer_playpause.png" + "')",
2296                "background-position": "top left"
2297            }).hover(function() {
2298                $(this).css({
2299                    "background-position": "bottom left"
2300                })
2301            }, function() {
2302                $(this).css({
2303                    "background-position": "top left"
2304                })
2305            }).on(eClick, function() {
2306                $videoObj.get(0).play()
2307            });
2308            $videoBtnPause.css({
2309                display: "none",
2310                position: "absolute",
2311                top: 0,
2312                left: 0,
2313                width: BUTTON_SIZE + "px",
2314                height: BUTTON_SIZE + "px",
2315                cursor: "pointer",
2316                "background-image": "url('" + skinFolder + "html5boxplayer_playpause.png" + "')",
2317                "background-position": "top right"
2318            }).hover(function() {
2319                    $(this).css({
2320                        "background-position": "bottom right"
2321                    })
2322                },
2323                function() {
2324                    $(this).css({
2325                        "background-position": "top right"
2326                    })
2327                }).on(eClick, function() {
2328                $videoObj.get(0).pause()
2329            });
2330            var $videoTimeCurrent = $(".html5boxTimeCurrent", $videoControls);
2331            var $videoTimeTotal = $(".html5boxTimeTotal", $videoControls);
2332            var $videoSeeker = $(".html5boxSeeker", $videoControls);
2333            var $videoSeekerPlay = $(".html5boxSeekerPlay", $videoControls);
2334            var $videoSeekerBuffer = $(".html5boxSeekerBuffer", $videoControls);
2335            var $videoSeekerHandler = $(".html5boxSeekerHandler", $videoControls);
2336            $videoTimeCurrent.css({
2337                display: "block",
2338                position: "relative",
2339                "float": "left",
2340                "line-height": BAR_HEIGHT + "px",
2341                "font-weight": "normal",
2342                "font-size": "12px",
2343                margin: "0 8px",
2344                "font-family": "Arial, Helvetica, sans-serif",
2345                color: "#fff"
2346            });
2347            $videoTimeTotal.css({
2348                display: "block",
2349                position: "relative",
2350                "float": "right",
2351                "line-height": BAR_HEIGHT + "px",
2352                "font-weight": "normal",
2353                "font-size": "12px",
2354                margin: "0 8px",
2355                "font-family": "Arial, Helvetica, sans-serif",
2356                color: "#fff"
2357            });
2358            $videoSeeker.css({
2359                display: "block",
2360                cursor: "pointer",
2361                overflow: "hidden",
2362                position: "relative",
2363                height: "10px",
2364                "background-color": "#222",
2365                margin: Math.floor((BAR_HEIGHT - 10) / 2) + "px 4px"
2366            }).on(eStart, function(e) {
2367                var e0 = isTouch ? e.originalEvent.touches[0] : e;
2368                var pos = e0.pageX - $videoSeeker.offset().left;
2369                $videoSeekerPlay.css({
2370                    width: pos
2371                });
2372                $videoObj.get(0).currentTime = pos * $videoObj.get(0).duration / $videoSeeker.width();
2373                $videoSeeker.on(eMove, function(e) {
2374                    var e0 = isTouch ? e.originalEvent.touches[0] : e;
2375                    var pos = e0.pageX - $videoSeeker.offset().left;
2376                    $videoSeekerPlay.css({
2377                        width: pos
2378                    });
2379                    $videoObj.get(0).currentTime = pos * $videoObj.get(0).duration /
2380                        $videoSeeker.width()
2381                })
2382            }).on(eCancel, function() {
2383                $videoSeeker.off(eMove)
2384            });
2385            $videoSeekerBuffer.css({
2386                display: "block",
2387                position: "absolute",
2388                left: 0,
2389                top: 0,
2390                height: "100%",
2391                "background-color": "#444"
2392            });
2393            $videoSeekerPlay.css({
2394                display: "block",
2395                position: "absolute",
2396                left: 0,
2397                top: 0,
2398                height: "100%",
2399                "background-color": "#fcc500"
2400            });
2401            if (!isIPhone && ($videoObj.get(0).requestFullscreen || $videoObj.get(0).webkitRequestFullScreen || $videoObj.get(0).mozRequestFullScreen || $videoObj.get(0).webkitEnterFullScreen || $videoObj.get(0).msRequestFullscreen)) {
2402                var switchScreen =
2403                    function(fullscreen) {
2404                        if (fullscreen) {
2405                            var isIE11 = navigator.userAgent.match(/Trident\/7/) != null && navigator.userAgent.match(/rv:11/) != null;
2406                            var isIE = navigator.userAgent.match(/MSIE/i) != null && !this.options.isOpera;
2407                            if (isIE11 || isIE) $videoObj.get(0).setAttribute("controls", "controls");
2408                            if ($videoObj.get(0).requestFullscreen) $videoObj.get(0).requestFullscreen();
2409                            else if ($videoObj.get(0).webkitRequestFullScreen) $videoObj.get(0).webkitRequestFullScreen();
2410                            else if ($videoObj.get(0).mozRequestFullScreen) $videoObj.get(0).mozRequestFullScreen();
2411                            else if ($videoObj.get(0).webkitEnterFullScreen) $videoObj.get(0).webkitEnterFullScreen();
2412                            if ($videoObj.get(0).msRequestFullscreen) $videoObj.get(0).msRequestFullscreen()
2413                        } else if (document.cancelFullScreen) document.cancelFullScreen();
2414                        else if (document.mozCancelFullScreen) document.mozCancelFullScreen();
2415                        else if (document.webkitCancelFullScreen) document.webkitCancelFullScreen();
2416                        else if (document.webkitExitFullscreen) document.webkitExitFullscreen();
2417                        else if (document.msExitFullscreen) document.msExitFullscreen()
2418                    };
2419                var switchScreenCSS = function(fullscreen) {
2420                    $videoControls.css({
2421                        position: fullscreen ? "fixed" : "absolute"
2422                    });
2423                    var backgroundPosY = $videoFullscreen.css("background-position") ? $videoFullscreen.css("background-position").split(" ")[1] : $videoFullscreen.css("background-position-y");
2424                    $videoFullscreen.css({
2425                        "background-position": (fullscreen ? "right" : "left") + " " + backgroundPosY
2426                    });
2427                    $videoFullscreenBg.css({
2428                        display: fullscreen ? "block" : "none"
2429                    });
2430                    if (fullscreen) {
2431                        $(document).on("mousemove", userActivate);
2432                        $videoControls.css({
2433                            "z-index": 2147483647
2434                        })
2435                    } else {
2436                        $(document).off("mousemove",
2437                            userActivate);
2438                        $videoControls.css({
2439                            "z-index": ""
2440                        })
2441                    }
2442                };
2443                document.addEventListener("MSFullscreenChange", function() {
2444                    isFullscreen = document.msFullscreenElement != null;
2445                    var isIE11 = navigator.userAgent.match(/Trident\/7/) != null && navigator.userAgent.match(/rv:11/) != null;
2446                    var isIE = navigator.userAgent.match(/MSIE/i) != null && !this.options.isOpera;
2447                    if (isIE11 || isIE)
2448                        if (!isFullscreen) $videoObj.get(0).removeAttribute("controls");
2449                    switchScreenCSS(isFullscreen)
2450                }, false);
2451                document.addEventListener("fullscreenchange", function() {
2452                    isFullscreen =
2453                        document.fullscreen;
2454                    switchScreenCSS(document.fullscreen)
2455                }, false);
2456                document.addEventListener("mozfullscreenchange", function() {
2457                    isFullscreen = document.mozFullScreen;
2458                    if (navigator.userAgent.match(/Firefox/i) != null)
2459                        if (isFullscreen) $videoObj.get(0).setAttribute("controls", "controls");
2460                        else $videoObj.get(0).removeAttribute("controls");
2461                    switchScreenCSS(document.mozFullScreen)
2462                }, false);
2463                document.addEventListener("webkitfullscreenchange", function() {
2464                    isFullscreen = document.webkitIsFullScreen;
2465                    if (navigator.userAgent.match(/Android/i) !=
2466                        null)
2467                        if (isFullscreen) $videoObj.get(0).setAttribute("controls", "controls");
2468                        else {
2469                            $videoObj.get(0).removeAttribute("controls");
2470                            switchScreenCSS(document.webkitIsFullScreen)
2471                        } else switchScreenCSS(document.webkitIsFullScreen)
2472                }, false);
2473                $videoObj.get(0).addEventListener("webkitbeginfullscreen", function() {
2474                    isFullscreen = true
2475                }, false);
2476                $videoObj.get(0).addEventListener("webkitendfullscreen", function() {
2477                    isFullscreen = false
2478                }, false);
2479                if (navigator.userAgent.match(/Android/i) == null) $("head").append("<style type='text/css'>video::-webkit-media-controls { display:none !important; }</style>");
2480                var $videoFullscreen = $(".html5boxFullscreen", $videoControls);
2481                $videoFullscreen.css({
2482                    display: "block",
2483                    position: "relative",
2484                    "float": "right",
2485                    width: BUTTON_SIZE + "px",
2486                    height: BUTTON_SIZE + "px",
2487                    margin: Math.floor((BAR_HEIGHT - BUTTON_SIZE) / 2),
2488                    cursor: "pointer",
2489                    "background-image": "url('" + skinFolder + "html5boxplayer_fullscreen.png" + "')",
2490                    "background-position": "left top"
2491                }).hover(function() {
2492                    var backgroundPosX = $(this).css("background-position") ? $(this).css("background-position").split(" ")[0] : $(this).css("background-position-x");
2493                    $(this).css({
2494                        "background-position": backgroundPosX + " bottom"
2495                    })
2496                }, function() {
2497                    var backgroundPosX = $(this).css("background-position") ? $(this).css("background-position").split(" ")[0] : $(this).css("background-position-x");
2498                    $(this).css({
2499                        "background-position": backgroundPosX + " top"
2500                    })
2501                }).on(eClick, function() {
2502                    isFullscreen = !isFullscreen;
2503                    switchScreen(isFullscreen)
2504                })
2505            }
2506            if (hd) {
2507                var $videoHD = $(".html5boxHD", $videoControls);
2508                $videoHD.css({
2509                    display: "block",
2510                    position: "relative",
2511                    "float": "right",
2512                    width: BUTTON_SIZE + "px",
2513                    height: BUTTON_SIZE +
2514                        "px",
2515                    margin: Math.floor((BAR_HEIGHT - BUTTON_SIZE) / 2),
2516                    cursor: "pointer",
2517                    "background-image": "url('" + skinFolder + "html5boxplayer_hd.png" + "')",
2518                    "background-position": (isHd ? "right" : "left") + " center"
2519                }).on(eClick, function() {
2520                    isHd = !isHd;
2521                    $(this).css({
2522                        "background-position": (isHd ? "right" : "left") + " center"
2523                    });
2524                    parentInst.isHd = isHd;
2525                    var isPaused = $videoObj.get(0).isPaused;
2526                    $videoObj.get(0).setAttribute("src", (isHd ? hd : src) + "#t=" + $videoObj.get(0).currentTime);
2527                    if (!isPaused) $videoObj.get(0).play();
2528                    else if (!isIPhone) $videoObj.get(0).pause()
2529                })
2530            }
2531            $videoObj.get(0).volume =
2532                defaultvolume;
2533            var volumeSaved = defaultvolume == 0 ? 1 : defaultvolume;
2534            var volume = $videoObj.get(0).volume;
2535            $videoObj.get(0).volume = volume / 2 + 0.1;
2536            if ($videoObj.get(0).volume === volume / 2 + 0.1) {
2537                $videoObj.get(0).volume = volume;
2538                var $videoVolume = $(".html5boxVolume", $videoControls);
2539                var $videoVolumeButton = $(".html5boxVolumeButton", $videoControls);
2540                var $videoVolumeBar = $(".html5boxVolumeBar", $videoControls);
2541                var $videoVolumeBarBg = $(".html5boxVolumeBarBg", $videoControls);
2542                var $videoVolumeBarActive = $(".html5boxVolumeBarActive",
2543                    $videoControls);
2544                $videoVolume.css({
2545                    display: "block",
2546                    position: "relative",
2547                    "float": "right",
2548                    width: BUTTON_SIZE + "px",
2549                    height: BUTTON_SIZE + "px",
2550                    margin: Math.floor((BAR_HEIGHT - BUTTON_SIZE) / 2)
2551                }).hover(function() {
2552                    clearTimeout(hideVolumeBarTimeoutId);
2553                    var volume = $videoObj.get(0).volume;
2554                    $videoVolumeBarActive.css({
2555                        height: Math.round(volume * 100) + "%"
2556                    });
2557                    $videoVolumeBar.show()
2558                }, function() {
2559                    clearTimeout(hideVolumeBarTimeoutId);
2560                    hideVolumeBarTimeoutId = setTimeout(function() {
2561                        $videoVolumeBar.hide()
2562                    }, 1E3)
2563                });
2564                $videoVolumeButton.css({
2565                    display: "block",
2566                    position: "absolute",
2567                    top: 0,
2568                    left: 0,
2569                    width: BUTTON_SIZE + "px",
2570                    height: BUTTON_SIZE + "px",
2571                    cursor: "pointer",
2572                    "background-image": "url('" + skinFolder + "html5boxplayer_volume.png" + "')",
2573                    "background-position": "top " + (volume > 0 ? "left" : "right")
2574                }).hover(function() {
2575                    var backgroundPosX = $(this).css("background-position") ? $(this).css("background-position").split(" ")[0] : $(this).css("background-position-x");
2576                    $(this).css({
2577                        "background-position": backgroundPosX + " bottom"
2578                    })
2579                }, function() {
2580                    var backgroundPosX = $(this).css("background-position") ?
2581                        $(this).css("background-position").split(" ")[0] : $(this).css("background-position-x");
2582                    $(this).css({
2583                        "background-position": backgroundPosX + " top"
2584                    })
2585                }).on(eClick, function() {
2586                    var volume = $videoObj.get(0).volume;
2587                    if (volume > 0) {
2588                        volumeSaved = volume;
2589                        volume = 0
2590                    } else volume = volumeSaved;
2591                    var backgroundPosY = $(this).css("background-position") ? $(this).css("background-position").split(" ")[1] : $(this).css("background-position-y");
2592                    $videoVolumeButton.css({
2593                        "background-position": (volume > 0 ? "left" : "right") + " " + backgroundPosY
2594                    });
2595                    $videoObj.get(0).volume = volume;
2596                    $videoVolumeBarActive.css({
2597                        height: Math.round(volume * 100) + "%"
2598                    })
2599                });
2600                $videoVolumeBar.css({
2601                    display: "none",
2602                    position: "absolute",
2603                    left: 4,
2604                    bottom: "100%",
2605                    width: 24,
2606                    height: 80,
2607                    "margin-bottom": Math.floor((BAR_HEIGHT - BUTTON_SIZE) / 2),
2608                    "background-color": "#000000",
2609                    opacity: 0.7,
2610                    filter: "alpha(opacity=70)"
2611                });
2612                $videoVolumeBarBg.css({
2613                    display: "block",
2614                    position: "relative",
2615                    width: 10,
2616                    height: 68,
2617                    margin: 7,
2618                    cursor: "pointer",
2619                    "background-color": "#222"
2620                });
2621                $videoVolumeBarActive.css({
2622                    display: "block",
2623                    position: "absolute",
2624                    bottom: 0,
2625                    left: 0,
2626                    width: "100%",
2627                    height: "100%",
2628                    "background-color": "#fcc500"
2629                });
2630                $videoVolumeBarBg.on(eStart, function(e) {
2631                    var e0 = isTouch ? e.originalEvent.touches[0] : e;
2632                    var vol = 1 - (e0.pageY - $videoVolumeBarBg.offset().top) / $videoVolumeBarBg.height();
2633                    vol = vol > 1 ? 1 : vol < 0 ? 0 : vol;
2634                    $videoVolumeBarActive.css({
2635                        height: Math.round(vol * 100) + "%"
2636                    });
2637                    $videoVolumeButton.css({
2638                        "background-position": "left " + (vol > 0 ? "top" : "bottom")
2639                    });
2640                    $videoObj.get(0).volume = vol;
2641                    $videoVolumeBarBg.on(eMove, function(e) {
2642                        var e0 = isTouch ? e.originalEvent.touches[0] :
2643                            e;
2644                        var vol = 1 - (e0.pageY - $videoVolumeBarBg.offset().top) / $videoVolumeBarBg.height();
2645                        vol = vol > 1 ? 1 : vol < 0 ? 0 : vol;
2646                        $videoVolumeBarActive.css({
2647                            height: Math.round(vol * 100) + "%"
2648                        });
2649                        $videoVolumeButton.css({
2650                            "background-position": "left " + (vol > 0 ? "top" : "bottom")
2651                        });
2652                        $videoObj.get(0).volume = vol
2653                    })
2654                }).on(eCancel, function() {
2655                    $videoVolumeBarBg.off(eMove)
2656                })
2657            }
2658            var calcTimeFormat = function(seconds) {
2659                var h0 = Math.floor(seconds / 3600);
2660                var h = h0 < 10 ? "0" + h0 : h0;
2661                var m0 = Math.floor((seconds - h0 * 3600) / 60);
2662                var m = m0 < 10 ? "0" + m0 : m0;
2663                var s0 = Math.floor(seconds -
2664                    (h0 * 3600 + m0 * 60));
2665                var s = s0 < 10 ? "0" + s0 : s0;
2666                var r = m + ":" + s;
2667                if (h0 > 0) r = h + ":" + r;
2668                return r
2669            };
2670            if (hideplaybutton) $videoPlay.hide();
2671            if (hidecontrols) $videoControls.hide();
2672            var onVideoPlay = function() {
2673                if (!hideplaybutton) $videoPlay.hide();
2674                if (!hidecontrols) {
2675                    $videoBtnPlay.hide();
2676                    $videoBtnPause.show()
2677                }
2678            };
2679            var onVideoPause = function() {
2680                if (!hideplaybutton) $videoPlay.show();
2681                if (!hidecontrols) {
2682                    $videoControls.show();
2683                    clearTimeout(hideControlsTimerId);
2684                    $videoBtnPlay.show();
2685                    $videoBtnPause.hide()
2686                }
2687            };
2688            var onVideoEnded = function() {
2689                $(window).trigger("html5lightbox.videoended");
2690                if (!hideplaybutton) $videoPlay.show();
2691                if (!hidecontrols) {
2692                    $videoControls.show();
2693                    clearTimeout(hideControlsTimerId);
2694                    $videoBtnPlay.show();
2695                    $videoBtnPause.hide()
2696                }
2697            };
2698            var onVideoUpdate = function() {
2699                var curTime = $videoObj.get(0).currentTime;
2700                if (curTime) {
2701                    $videoTimeCurrent.text(calcTimeFormat(curTime));
2702                    var duration = $videoObj.get(0).duration;
2703                    if (duration) {
2704                        $videoTimeTotal.text(calcTimeFormat(duration));
2705                        if (!sliderDragging) {
2706                            var sliderW = $videoSeeker.width();
2707                            var pos = Math.round(sliderW * curTime / duration);
2708                            $videoSeekerPlay.css({
2709                                width: pos
2710                            });
2711                            $videoSeekerHandler.css({
2712                                left: pos
2713                            })
2714                        }
2715                    }
2716                }
2717            };
2718            var onVideoProgress = function() {
2719                if ($videoObj.get(0).buffered && $videoObj.get(0).buffered.length > 0 && !isNaN($videoObj.get(0).buffered.end(0)) && !isNaN($videoObj.get(0).duration)) {
2720                    var sliderW = $videoSeeker.width();
2721                    $videoSeekerBuffer.css({
2722                        width: Math.round(sliderW * $videoObj.get(0).buffered.end(0) / $videoObj.get(0).duration)
2723                    })
2724                }
2725            };
2726            try {
2727                $videoObj.on("play", onVideoPlay);
2728                $videoObj.on("pause", onVideoPause);
2729                $videoObj.on("ended", onVideoEnded);
2730                $videoObj.on("timeupdate", onVideoUpdate);
2731                $videoObj.on("progress", onVideoProgress)
2732            } catch (e) {}
2733        }
2734    })(jQuery);
2735    jQuery(document).ready(function() {
2736        if (typeof html5Lightbox === "undefined") html5Lightbox = jQuery(".html5lightbox").html5lightbox()
2737    })
2738};

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.