<\/div><\/div>').click(u.cancel).appendTo("body");
o.bind("keydown.loading", function (n) {
(n.which || n.keyCode) === 27 && (n.preventDefault(), u.cancel());
});
u.defaults.fixed || (n = u.getViewport(), t.css({
position: "absolute",
top: n.h * .5 + n.y,
left: n.w * .5 + n.x
}));
},
getViewport: function getViewport() {
var i = u.current && u.current.locked || !1,
t = {
x: e.scrollLeft(),
y: e.scrollTop()
};
return i ? (t.w = i[0].clientWidth, t.h = i[0].clientHeight) : (t.w = s && n.innerWidth ? n.innerWidth : e.width(), t.h = s && n.innerHeight ? n.innerHeight : e.height()), t;
},
unbindEvents: function unbindEvents() {
u.wrap && a(u.wrap) && u.wrap.unbind(".fb");
o.unbind(".fb");
e.unbind(".fb");
},
bindEvents: function bindEvents() {
var n = u.current,
t;
n && (e.bind("orientationchange.fb" + (s ? "" : " resize.fb") + (n.autoCenter && !n.locked ? " scroll.fb" : ""), u.update), t = n.keys, t && o.bind("keydown.fb", function (f) {
var e = f.which || f.keyCode,
o = f.target || f.srcElement;
if (e === 27 && u.coming) return !1;
f.ctrlKey || f.altKey || f.shiftKey || f.metaKey || o && (o.type || i(o).is("[contenteditable]")) || i.each(t, function (t, o) {
return n.group.length > 1 && o[e] !== r ? (u[t](o[e]), f.preventDefault(), !1) : i.inArray(e, o) > -1 ? (u[t](), f.preventDefault(), !1) : void 0;
});
}), i.fn.mousewheel && n.mouseWheel && u.wrap.bind("mousewheel.fb", function (t, r, f, e) {
for (var h = t.target || null, o = i(h), s = !1; o.length;) {
if (s || o.is(".fancybox-skin") || o.is(".fancybox-wrap")) break;
s = w(o[0]);
o = i(o).parent();
}
r === 0 || s || u.group.length > 1 && !n.canShrink && (e > 0 || f > 0 ? u.prev(e > 0 ? "down" : "left") : (e < 0 || f < 0) && u.next(e < 0 ? "up" : "right"), t.preventDefault());
}));
},
trigger: function trigger(n, t) {
var f,
r = t || u.coming || u.current;
if (r) {
if (i.isFunction(r[n]) && (f = r[n].apply(r, Array.prototype.slice.call(arguments, 1))), f === !1) return !1;
r.helpers && i.each(r.helpers, function (t, f) {
f && u.helpers[t] && i.isFunction(u.helpers[t][n]) && u.helpers[t][n](i.extend(!0, {}, u.helpers[t].defaults, f), r);
});
o.trigger(n);
}
},
isImage: function isImage(n) {
return c(n) && n.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i);
},
isSWF: function isSWF(n) {
return c(n) && n.match(/\.(swf)((\?|#).*)?$/i);
},
_start: function _start(n) {
var t = {},
c,
l,
r,
e,
o;
if (n = f(n), c = u.group[n] || null, !c) return !1;
if (t = i.extend(!0, {}, u.opts, c), e = t.margin, o = t.padding, i.type(e) === "number" && (t.margin = [e, e, e, e]), i.type(o) === "number" && (t.padding = [o, o, o, o]), t.modal && i.extend(!0, t, {
closeBtn: !1,
closeClick: !1,
nextClick: !1,
arrows: !1,
mouseWheel: !1,
keys: null,
helpers: {
overlay: {
closeClick: !1
}
}
}), t.autoSize && (t.autoWidth = t.autoHeight = !0), t.width === "auto" && (t.autoWidth = !0), t.height === "auto" && (t.autoHeight = !0), t.group = u.group, t.index = n, u.coming = t, !1 === u.trigger("beforeLoad")) {
u.coming = null;
return;
}
if (r = t.type, l = t.href, !r) return (u.coming = null, u.current && u.router && u.router !== "jumpto") ? (u.current.index = n, u[u.router](u.direction)) : !1;
if (u.isActive = !0, (r === "image" || r === "swf") && (t.autoHeight = t.autoWidth = !1, t.scrolling = "visible"), r === "image" && (t.aspectRatio = !0), r === "iframe" && s && (t.scrolling = "scroll"), t.wrap = i(t.tpl.wrap).addClass("fancybox-" + (s ? "mobile" : "desktop") + " fancybox-type-" + r + " fancybox-tmp " + t.wrapCSS).appendTo(t.parent || "body"), i.extend(t, {
skin: i(".fancybox-skin", t.wrap),
outer: i(".fancybox-outer", t.wrap),
inner: i(".fancybox-inner", t.wrap)
}), i.each(["Top", "Right", "Bottom", "Left"], function (n, i) {
t.skin.css("padding" + i, h(t.padding[n]));
}), u.trigger("onReady"), r === "inline" || r === "html") {
if (!t.content || !t.content.length) return u._error("content");
} else if (!l) return u._error("href");
r === "image" ? u._loadImage() : r === "ajax" ? u._loadAjax() : r === "iframe" ? u._loadIframe() : u._afterLoad();
},
_error: function _error(n) {
i.extend(u.coming, {
type: "html",
autoWidth: !0,
autoHeight: !0,
minWidth: 0,
minHeight: 0,
scrolling: "no",
hasError: n,
content: u.coming.tpl.error
});
u._afterLoad();
},
_loadImage: function _loadImage() {
var n = u.imgPreload = new Image();
n.onload = function () {
this.onload = this.onerror = null;
u.coming.width = this.width / u.opts.pixelRatio;
u.coming.height = this.height / u.opts.pixelRatio;
u._afterLoad();
};
n.onerror = function () {
this.onload = this.onerror = null;
u._error("image");
};
n.src = u.coming.href;
n.complete !== !0 && u.showLoading();
},
_loadAjax: function _loadAjax() {
var n = u.coming;
u.showLoading();
u.ajaxLoad = i.ajax(i.extend({}, n.ajax, {
url: n.href,
error: function error(n, t) {
u.coming && t !== "abort" ? u._error("ajax", n) : u.hideLoading();
},
success: function success(t, i) {
i === "success" && (n.content = t, u._afterLoad());
}
}));
},
_loadIframe: function _loadIframe() {
var n = u.coming,
t = i(n.tpl.iframe.replace(/\{rnd\}/g, new Date().getTime())).attr("scrolling", s ? "auto" : n.iframe.scrolling).attr("src", n.href);
if (i(n.wrap).bind("onReset", function () {
try {
i(this).find("iframe").hide().attr("src", "//about:blank").end().empty();
} catch (n) {}
}), n.iframe.preload) {
u.showLoading();
t.one("load", function () {
i(this).data("ready", 1);
s || i(this).bind("load.fb", u.update);
i(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();
u._afterLoad();
});
}
n.content = t.appendTo(n.inner);
n.iframe.preload || u._afterLoad();
},
_preloadImages: function _preloadImages() {
for (var r = u.group, i = u.current, f = r.length, e = i.preload ? Math.min(i.preload, f - 1) : 0, n, t = 1; t <= e; t += 1) {
n = r[(i.index + t) % f], n.type === "image" && n.href && (new Image().src = n.href);
}
},
_afterLoad: function _afterLoad() {
var r = u.coming,
f = u.current,
e = "fancybox-placeholder",
t,
n,
c,
o,
s,
h;
if (u.hideLoading(), r && u.isActive !== !1) {
if (!1 === u.trigger("afterLoad", r, f)) {
r.wrap.stop(!0).trigger("onReset").remove();
u.coming = null;
return;
}
f && (u.trigger("beforeChange", f), f.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove());
u.unbindEvents();
t = r;
n = r.content;
c = r.type;
o = r.scrolling;
i.extend(u, {
wrap: t.wrap,
skin: t.skin,
outer: t.outer,
inner: t.inner,
current: t,
previous: f
});
s = t.href;
switch (c) {
case "inline":
case "ajax":
case "html":
t.selector ? n = i("
").html(n).find(t.selector) : a(n) && (n.data(e) || n.data(e, i('
<\/div>').insertAfter(n).hide()), n = n.show().detach(), t.wrap.bind("onReset", function () {
i(this).find(n).length && n.hide().replaceAll(n.data(e)).data(e, !1);
}));
break;
case "image":
n = t.tpl.image.replace("{href}", s);
break;
case "swf":
n = '