/*!
* FANCYBOX - jQuery Plugin
* version: 2.1.5 (Fri, 14 Jun 2013)
* @requires jQuery v1.6 or later
*
* Examples at http://fancyapps.com/fancybox/
* License: www.fancyapps.com/fancybox/#license
*
* Copyright 2012 Janis Skarnelis - janis@fancyapps.com
*
*/
(function(e, t, n, r) {
"use strict";
var i = n("html"),
s = n(e),
o = n(t),
u = n.esgbox = function() {
u.open.apply(this, arguments)
},
a = navigator.userAgent.match(/msie/i),
f = null,
l = t.createTouch !== r,
c = function(e) {
return e && e.hasOwnProperty && e instanceof n
},
h = function(e) {
return e && n.type(e) === "string"
},
p = function(e) {
return h(e) && e.indexOf("%") > 0
},
d = function(e) {
return e && !(e.style.overflow && e.style.overflow === "hidden") && (e.clientWidth && e.scrollWidth > e.clientWidth || e.clientHeight && e.scrollHeight > e.clientHeight)
},
v = function(e, t) {
var n = parseInt(e, 10) || 0;
if (t && p(e)) {
n = u.getViewport()[t] / 100 * n
}
return Math.ceil(n)
},
m = function(e, t) {
return v(e, t) + "px"
};
n.extend(u, {
version: "2.1.5",
defaults: {
padding: 15,
margin: 20,
width: 800,
height: 600,
minWidth: 100,
minHeight: 100,
maxWidth: 9999,
maxHeight: 9999,
pixelRatio: 1,
autoSize: true,
autoHeight: false,
autoWidth: false,
autoResize: true,
autoCenter: !l,
fitToView: true,
aspectRatio: false,
topRatio: .5,
leftRatio: .5,
scrolling: "auto",
wrapCSS: "",
arrows: true,
closeBtn: true,
closeClick: false,
nextClick: false,
mouseWheel: true,
autoPlay: false,
playSpeed: 3e3,
preload: 3,
modal: false,
loop: true,
ajax: {
dataType: "html",
headers: {
"X-esgbox": true
}
},
iframe: {
scrolling: "auto",
preload: true
},
swf: {
wmode: "transparent",
allowfullscreen: "true",
allowscriptaccess: "always"
},
keys: {
next: {
13: "left",
34: "up",
39: "left",
40: "up"
},
prev: {
8: "right",
33: "down",
37: "right",
38: "down"
},
close: [27],
play: [32],
toggle: [70]
},
direction: {
next: "left",
prev: "right"
},
scrollOutside: true,
index: 0,
type: null,
href: null,
content: null,
title: null,
tpl: {
wrap: '
The requested content cannot be loaded.
Please try again later.
',
closeBtn: '").html(s).find(i.selector)
} else if (c(s)) {
if (!s.data(r)) {
s.data(r, n('
').insertAfter(s).hide())
}
s = s.show().detach();
i.wrap.bind("onReset", function() {
if (n(this).find(s).length) {
s.hide().replaceAll(s.data(r)).data(r, false)
}
})
}
break;
case "image":
s = i.tpl.image.replace("{href}", f);
break;
case "swf":
s = '
";
break
}
if (!(c(s) && s.parent().is(i.inner))) {
i.inner.append(s)
}
u.trigger("beforeShow");
i.inner.css("overflow", a === "yes" ? "scroll" : a === "no" ? "hidden" : a);
u._setDimension();
u.reposition();
u.isOpen = false;
u.coming = null;
u.bindEvents();
if (!u.isOpened) {
n(".esgbox-wrap").not(i.wrap).stop(true).trigger("onReset").remove()
} else if (t.prevMethod) {
u.transitions[t.prevMethod]()
}
u.transitions[u.isOpened ? i.nextMethod : i.openMethod]();
u._preloadImages()
},
_setDimension: function() {
var e = u.getViewport(),
t = 0,
r = false,
i = false,
s = u.wrap,
o = u.skin,
a = u.inner,
f = u.current,
l = f.width,
c = f.height,
h = f.minWidth,
d = f.minHeight,
g = f.maxWidth,
y = f.maxHeight,
b = f.scrolling,
w = f.scrollOutside ? f.scrollbarWidth : 0,
E = f.margin,
S = v(E[1] + E[3]),
x = v(E[0] + E[2]),
T, N, C, k, L, A, O, M, _, D, P, H, B, j, I;
s.add(o).add(a).width("auto").height("auto").removeClass("esgbox-tmp");
T = v(o.outerWidth(true) - o.width());
N = v(o.outerHeight(true) - o.height());
C = S + T;
k = x + N;
L = p(l) ? (e.w - C) * v(l) / 100 : l;
A = p(c) ? (e.h - k) * v(c) / 100 : c;
if (f.type === "iframe") {
j = f.content;
if (f.autoHeight && j.data("ready") === 1) {
try {
if (j[0].contentWindow.document.location) {
a.width(L).height(9999);
I = j.contents().find("body");
if (w) {
I.css("overflow-x", "hidden")
}
A = I.outerHeight(true)
}
} catch (q) {}
}
} else
if (f.type === "html5") {
L = l;
A = c;
jQuery('.esgbox-inner').addClass("html5video");
} else
if (f.autoWidth || f.autoHeight) {
a.addClass("esgbox-tmp");
if (!f.autoWidth) {
a.width(L)
}
if (!f.autoHeight) {
a.height(A)
}
if (f.autoWidth) {
L = a.width()
}
if (f.autoHeight) {
A = a.height()
}
a.removeClass("esgbox-tmp")
}
l = v(L);
c = v(A);
_ = L / A;
h = v(p(h) ? v(h, "w") - C : h);
g = v(p(g) ? v(g, "w") - C : g);
d = v(p(d) ? v(d, "h") - k : d);
y = v(p(y) ? v(y, "h") - k : y);
O = g;
M = y;
if (f.fitToView) {
g = Math.min(e.w - C, g);
y = Math.min(e.h - k, y)
}
H = e.w - S;
B = e.h - x;
if (f.aspectRatio) {
if (l > g) {
l = g;
c = v(l / _)
}
if (c > y) {
c = y;
l = v(c * _)
}
if (l < h) {
l = h;
c = v(l / _)
}
if (c < d) {
c = d;
l = v(c * _)
}
} else {
l = Math.max(h, Math.min(l, g));
if (f.autoHeight && f.type !== "iframe") {
a.width(l);
c = a.height()
}
c = Math.max(d, Math.min(c, y))
}
if (f.fitToView) {
a.width(l).height(c);
s.width(l + T);
D = s.width();
P = s.height();
if (f.aspectRatio) {
while ((D > H || P > B) && l > h && c > d) {
if (t++ > 19) {
break
}
c = Math.max(d, Math.min(y, c - 10));
l = v(c * _);
if (l < h) {
l = h;
c = v(l / _)
}
if (l > g) {
l = g;
c = v(l / _)
}
a.width(l).height(c);
s.width(l + T);
D = s.width();
P = s.height()
}
} else {
l = Math.max(h, Math.min(l, l - (D - H)));
c = Math.max(d, Math.min(c, c - (P - B)))
}
}
if (w && b === "auto" && c < A && l + T + w < H) {
l += w
}
a.width(l).height(c);
s.width(l + T);
D = s.width();
P = s.height();
r = (D > H || P > B) && l > h && c > d;
i = f.aspectRatio ? l < O && c < M && l < L && c < A : (l < O || c < M) && (l < L || c < A);
n.extend(f, {
dim: {
width: m(D),
height: m(P)
},
origWidth: L,
origHeight: A,
canShrink: r,
canExpand: i,
wPadding: T,
hPadding: N,
wrapSpace: P - o.outerHeight(true),
skinSpace: o.height() - c
});
if (!j && f.autoHeight && c > d && c < y && !i) {
a.height("auto")
}
},
_getPosition: function(e) {
var t = u.current,
n = u.getViewport(),
r = t.margin,
i = u.wrap.width() + r[1] + r[3],
s = u.wrap.height() + r[0] + r[2],
o = {
position: "absolute",
top: r[0],
left: r[3]
};
if (t.autoCenter && t.fixed && !e && s <= n.h && i <= n.w) {
o.position = "fixed"
} else if (!t.locked) {
o.top += n.y;
o.left += n.x
}
o.top = m(Math.max(o.top, o.top + (n.h - s) * t.topRatio));
o.left = m(Math.max(o.left, o.left + (n.w - i) * t.leftRatio));
return o
},
_afterZoomIn: function() {
var e = u.current;
if (!e) {
return
}
u.isOpen = u.isOpened = true;
u.wrap.css("overflow", "visible").addClass("esgbox-opened");
u.update();
if (e.closeClick || e.nextClick && u.group.length > 1) {
u.inner.css("cursor", "pointer").bind("click.fb", function(t) {
if (!n(t.target).is("a") && !n(t.target).parent().is("a")) {
t.preventDefault();
u[e.closeClick ? "close" : "next"]()
}
})
}
if (e.closeBtn) {
n(e.tpl.closeBtn).appendTo(u.skin).bind("click.fb", function(e) {
e.preventDefault();
u.close()
})
}
if (e.arrows && u.group.length > 1) {
if (e.loop || e.index > 0) {
n(e.tpl.prev).appendTo(u.outer).bind("click.fb", u.prev)
}
if (e.loop || e.index < u.group.length - 1) {
n(e.tpl.next).appendTo(u.outer).bind("click.fb", u.next)
}
}
u.trigger("afterShow");
if (!e.loop && e.index === e.group.length - 1) {
u.play(false)
} else if (u.opts.autoPlay && !u.player.isActive) {
u.opts.autoPlay = false;
u.play()
}
},
_afterZoomOut: function(e) {
e = e || u.current;
n(".esgbox-wrap").trigger("onReset").remove();
n.extend(u, {
group: {},
opts: {},
router: false,
current: null,
isActive: false,
isOpened: false,
isOpen: false,
isClosing: false,
wrap: null,
skin: null,
outer: null,
inner: null
});
u.trigger("afterClose", e)
}
});
u.transitions = {
getOrigPosition: function() {
var e = u.current,
t = e.element,
n = e.orig,
r = {},
i = 50,
s = 50,
o = e.hPadding,
a = e.wPadding,
f = u.getViewport();
if (!n && e.isDom && t.is(":visible")) {
n = t.find("img:first");
if (!n.length) {
n = t
}
}
if (c(n)) {
r = n.offset();
if (n.is("img")) {
i = n.outerWidth();
s = n.outerHeight()
}
} else {
r.top = f.y + (f.h - s) * e.topRatio;
r.left = f.x + (f.w - i) * e.leftRatio
}
if (u.wrap.css("position") === "fixed" || e.locked) {
r.top -= f.y;
r.left -= f.x
}
r = {
top: m(r.top - o * e.topRatio),
left: m(r.left - a * e.leftRatio),
width: m(i + a),
height: m(s + o)
};
return r
},
step: function(e, t) {
var n, r, i, s = t.prop,
o = u.current,
a = o.wrapSpace,
f = o.skinSpace;
if (s === "width" || s === "height") {
n = t.end === t.start ? 1 : (e - t.start) / (t.end - t.start);
if (u.isClosing) {
n = 1 - n
}
r = s === "width" ? o.wPadding : o.hPadding;
i = e - r;
u.skin[s](v(s === "width" ? i : i - a * n));
u.inner[s](v(s === "width" ? i : i - a * n - f * n))
}
},
zoomIn: function() {
var e = u.current,
t = e.pos,
r = e.openEffect,
i = r === "elastic",
s = n.extend({
opacity: 1
}, t);
delete s.position;
if (i) {
t = this.getOrigPosition();
if (e.openOpacity) {
t.opacity = .1
}
} else if (r === "fade") {
t.opacity = .1
}
u.wrap.css(t).animate(s, {
duration: r === "none" ? 0 : e.openSpeed,
easing: e.openEasing,
step: i ? this.step : null,
complete: u._afterZoomIn
})
},
zoomOut: function() {
var e = u.current,
t = e.closeEffect,
n = t === "elastic",
r = {
opacity: .1
};
if (n) {
r = this.getOrigPosition();
if (e.closeOpacity) {
r.opacity = .1
}
}
u.wrap.animate(r, {
duration: t === "none" ? 0 : e.closeSpeed,
easing: e.closeEasing,
step: n ? this.step : null,
complete: u._afterZoomOut
})
},
changeIn: function() {
var e = u.current,
t = e.nextEffect,
n = e.pos,
r = {
opacity: 1
},
i = u.direction,
s = 200,
o;
n.opacity = .1;
if (t === "elastic") {
o = i === "down" || i === "up" ? "top" : "left";
if (i === "down" || i === "right") {
n[o] = m(v(n[o]) - s);
r[o] = "+=" + s + "px"
} else {
n[o] = m(v(n[o]) + s);
r[o] = "-=" + s + "px"
}
}
if (t === "none") {
u._afterZoomIn()
} else {
u.wrap.css(n).animate(r, {
duration: e.nextSpeed,
easing: e.nextEasing,
complete: u._afterZoomIn
})
}
},
changeOut: function() {
var e = u.previous,
t = e.prevEffect,
r = {
opacity: .1
},
i = u.direction,
s = 200;
if (t === "elastic") {
r[i === "down" || i === "up" ? "top" : "left"] = (i === "up" || i === "left" ? "-" : "+") + "=" + s + "px"
}
e.wrap.animate(r, {
duration: t === "none" ? 0 : e.prevSpeed,
easing: e.prevEasing,
complete: function() {
n(this).trigger("onReset").remove()
}
})
}
};
u.helpers.overlay = {
defaults: {
closeClick: true,
speedOut: 200,
showEarly: true,
css: {},
locked: !l,
fixed: true
},
overlay: null,
fixed: false,
el: n("html"),
create: function(e) {
e = n.extend({}, this.defaults, e);
if (this.overlay) {
this.close()
}
this.overlay = n('
').appendTo(u.coming ? u.coming.parent : e.parent);
this.fixed = false;
if (e.fixed && u.defaults.fixed) {
this.overlay.addClass("esgbox-overlay-fixed");
this.fixed = true
}
},
open: function(e) {
var t = this;
e = n.extend({}, this.defaults, e);
if (this.overlay) {
this.overlay.unbind(".overlay").width("auto").height("auto")
} else {
this.create(e)
}
if (!this.fixed) {
s.bind("resize.overlay", n.proxy(this.update, this));
this.update()
}
if (e.closeClick) {
this.overlay.bind("click.overlay", function(e) {
if (n(e.target).hasClass("esgbox-overlay")) {
if (u.isActive) {
u.close()
} else {
t.close()
}
return false
}
})
}
this.overlay.css(e.css).show()
},
close: function() {
var e, t;
s.unbind("resize.overlay");
if (this.el.hasClass("esgbox-lock")) {
n(".esgbox-margin").removeClass("esgbox-margin");
e = s.scrollTop();
t = s.scrollLeft();
this.el.removeClass("esgbox-lock");
s.scrollTop(e).scrollLeft(t)
}
n(".esgbox-overlay").remove().hide();
n.extend(this, {
overlay: null,
fixed: false
})
},
update: function() {
var e = "100%",
n;
this.overlay.width(e).height("100%");
if (a) {
n = Math.max(t.documentElement.offsetWidth, t.body.offsetWidth);
if (o.width() > n) {
e = o.width()
}
} else if (o.width() > s.width()) {
e = o.width()
}
this.overlay.width(e).height(o.height())
},
onReady: function(e, t) {
var r = this.overlay;
n(".esgbox-overlay").stop(true, true);
if (!r) {
this.create(e)
}
if (e.locked && this.fixed && t.fixed) {
if (!r) {
this.margin = o.height() > s.height() ? n("html").css("margin-right").replace("px", "") : false
}
t.locked = this.overlay.append(t.wrap);
t.fixed = false
}
if (e.showEarly === true) {
this.beforeShow.apply(this, arguments)
}
},
beforeShow: function(e, t) {
var r, i;
if (t.locked) {
if (this.margin !== false) {
n("*").filter(function() {
return n(this).css("position") === "fixed" && !n(this).hasClass("esgbox-overlay") && !n(this).hasClass("esgbox-wrap")
}).addClass("esgbox-margin");
this.el.addClass("esgbox-margin")
}
r = s.scrollTop();
i = s.scrollLeft();
this.el.addClass("esgbox-lock");
s.scrollTop(r).scrollLeft(i)
}
this.open(e)
},
onUpdate: function() {
if (!this.fixed) {
this.update()
}
},
afterClose: function(e) {
if (this.overlay && !u.coming) {
this.overlay.fadeOut(e.speedOut, n.proxy(this.close, this))
}
}
};
u.helpers.title = {
defaults: {
type: "float",
position: "bottom"
},
beforeShow: function(e) {
var t = u.current,
r = t.title,
i = e.type,
s, o;
if (n.isFunction(r)) {
r = r.call(t.element, t)
}
if (!h(r) || n.trim(r) === "") {
return
}
s = n('
' + r + "
");
switch (i) {
case "inside":
o = u.skin;
break;
case "outside":
o = u.wrap;
break;
case "over":
o = u.inner;
break;
default:
o = u.skin;
s.appendTo("body");
if (a) {
s.width(s.width())
}
s.wrapInner('
');
u.current.margin[2] += Math.abs(v(s.css("margin-bottom")));
break
}
s[e.position === "top" ? "prependTo" : "appendTo"](o)
}
};
n.fn.esgbox = function(e) {
var t, r = n(this),
i = this.selector || "",
s = function(s) {
var o = n(this).blur(),
a = t,
f, l;
if (!(s.ctrlKey || s.altKey || s.shiftKey || s.metaKey) && !o.is(".esgbox-wrap")) {
f = e.groupAttr || "data-esgbox-group";
l = o.attr(f);
if (!l) {
f = "rel";
l = o.get(0)[f]
}
if (l && l !== "" && l !== "nofollow") {
o = i.length ? n(i) : r;
o = o.filter("[" + f + '="' + l + '"]');
a = o.index(this)
}
e.index = a;
if (u.open(o, e) !== false) {
s.preventDefault()
}
}
};
e = e || {};
t = e.index || 0;
if (!i || e.live === false) {
r.unbind("click.fb-start").bind("click.fb-start", s)
} else {
o.undelegate(i, "click.fb-start").delegate(i + ":not('.esgbox-item, .esgbox-nav')", "click.fb-start", s)
}
this.filter("[data-esgbox-start=1]").trigger("click");
return this
};
o.ready(function() {
var t, s;
if (n.scrollbarWidth === r) {
n.scrollbarWidth = function() {
var e = n('
').appendTo("body"),
t = e.children(),
r = t.innerWidth() - t.height(99).innerWidth();
e.remove();
return r
}
}
if (n.support.fixedPosition === r) {
n.support.fixedPosition = function() {
var e = n('
').appendTo("body"),
t = e[0].offsetTop === 20 || e[0].offsetTop === 15;
e.remove();
return t
}()
}
n.extend(u.defaults, {
scrollbarWidth: n.scrollbarWidth(),
fixed: n.support.fixedPosition,
parent: n("body")
});
t = n(e).width();
i.addClass("esgbox-lock-test");
s = n(e).width();
i.removeClass("esgbox-lock-test");
n("").appendTo("head")
})
})(window, document, jQuery);
(function(e) {
var t = e.esgbox;
t.helpers.buttons = {
defaults: {
skipSingle: false,
position: "top",
tpl: '
'
},
list: null,
buttons: null,
beforeLoad: function(e, t) {
if (e.skipSingle && t.group.length < 2) {
t.helpers.buttons = false;
t.closeBtn = true;
return
}
t.margin[e.position === "bottom" ? 2 : 0] += 30
},
onPlayStart: function() {
if (this.buttons) {
this.buttons.play.attr("title", "Pause slideshow").addClass("btnPlayOn")
}
},
onPlayEnd: function() {
if (this.buttons) {
this.buttons.play.attr("title", "Start slideshow").removeClass("btnPlayOn")
}
},
afterShow: function(n, r) {
var i = this.buttons;
if (!i) {
this.list = e(n.tpl).addClass(n.position).appendTo("body");
i = {
prev: this.list.find(".btnPrev").click(t.prev),
next: this.list.find(".btnNext").click(t.next),
play: this.list.find(".btnPlay").click(t.play),
toggle: this.list.find(".btnToggle").click(t.toggle),
close: this.list.find(".btnClose").click(t.close)
}
}
if (r.index > 0 || r.loop) {
i.prev.removeClass("btnDisabled")
} else {
i.prev.addClass("btnDisabled")
}
if (r.loop || r.index < r.group.length - 1) {
i.next.removeClass("btnDisabled");
i.play.removeClass("btnDisabled")
} else {
i.next.addClass("btnDisabled");
i.play.addClass("btnDisabled")
}
this.buttons = i;
this.onUpdate(n, r)
},
onUpdate: function(e, t) {
var n;
if (!this.buttons) {
return
}
n = this.buttons.toggle.removeClass("btnDisabled btnToggleOn");
if (t.canShrink) {
n.addClass("btnToggleOn")
} else if (!t.canExpand) {
n.addClass("btnDisabled")
}
},
beforeClose: function() {
if (this.list) {
this.list.remove()
}
this.list = null;
this.buttons = null
}
}
})(jQuery);
(function(e) {
"use strict";
var t = e.esgbox,
n = function(t, n, r) {
r = r || "";
if (e.type(r) === "object") {
r = e.param(r, true)
}
e.each(n, function(e, n) {
t = t.replace("$" + e, n || "")
});
if (r.length) {
t += (t.indexOf("?") > 0 ? "&" : "?") + r
}
return t
};
t.helpers.media = {
defaults: {
youtube: {
matcher: /(youtube\.com|youtu\.be|youtube-nocookie\.com)\/(watch\?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*)).*/i,
params: {
autoplay: 1,
autohide: 1,
fs: 1,
rel: 0,
hd: 1,
wmode: "opaque",
enablejsapi: 1
},
type: "iframe",
url: "//www.youtube.com/embed/$3"
},
vimeo: {
matcher: /(?:vimeo(?:pro)?.com)\/(?:[^\d]+)?(\d+)(?:.*)/,
params: {
autoplay: 1,
hd: 1,
show_title: 1,
show_byline: 1,
show_portrait: 0,
fullscreen: 1
},
type: "iframe",
url: "//player.vimeo.com/video/$1"
},
metacafe: {
matcher: /metacafe.com\/(?:watch|fplayer)\/([\w\-]{1,10})/,
params: {
autoPlay: "yes"
},
type: "swf",
url: function(t, n, r) {
r.swf.flashVars = "playerVars=" + e.param(n, true);
return "//www.metacafe.com/fplayer/" + t[1] + "/.swf"
}
},
dailymotion: {
matcher: /dailymotion.com\/video\/(.*)\/?(.*)/,
params: {
additionalInfos: 0,
autoStart: 1
},
type: "swf",
url: "//www.dailymotion.com/swf/video/$1"
},
twitvid: {
matcher: /twitvid\.com\/([a-zA-Z0-9_\-\?\=]+)/i,
params: {
autoplay: 0
},
type: "iframe",
url: "//www.twitvid.com/embed.php?guid=$1"
},
twitpic: {
matcher: /twitpic\.com\/(?!(?:place|photos|events)\/)([a-zA-Z0-9\?\=\-]+)/i,
type: "image",
url: "//twitpic.com/show/full/$1/"
},
instagram: {
matcher: /(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i,
type: "image",
url: "//$1/p/$2/media/?size=l"
},
google_maps: {
matcher: /maps\.google\.([a-z]{2,3}(\.[a-z]{2})?)\/(\?ll=|maps\?)(.*)/i,
type: "iframe",
url: function(e) {
return "//maps.google." + e[1] + "/" + e[3] + "" + e[4] + "&output=" + (e[4].indexOf("layer=c") > 0 ? "svembed" : "embed")
}
}
},
beforeLoad: function(t, r) {
var i = r.href || "",
s = false,
o, u, a, f;
for (o in t) {
if (t.hasOwnProperty(o)) {
u = t[o];
a = i.match(u.matcher);
if (a) {
s = u.type;
f = e.extend(true, {}, u.params, r[o] || (e.isPlainObject(t[o]) ? t[o].params : null));
i = e.type(u.url) === "function" ? u.url.call(this, a, f, r) : n(u.url, a, f);
break
}
}
}
if (s) {
r.href = i;
r.type = s;
r.autoHeight = false
}
}
}
})(jQuery);
(function(e) {
var t = e.esgbox;
t.helpers.thumbs = {
defaults: {
width: 50,
height: 50,
position: "bottom",
source: function(t) {
var n;
if (t.element) {
n = e(t.element).find("img").attr("src")
}
if (!n && t.type === "image" && t.href) {
n = t.href
}
return n
}
},
wrap: null,
list: null,
width: 0,
init: function(t, n) {
var r = this,
i, s = t.width,
o = t.height,
u = t.source;
i = "";
for (var a = 0; a < n.group.length; a++) {
i += '
'
}
this.wrap = e('
').addClass(t.position).appendTo("body");
this.list = e("
").appendTo(this.wrap);
e.each(n.group, function(t) {
var i = u(n.group[t]);
if (!i) {
return
}
e("
![]()
").load(function() {
var n = this.width,
i = this.height,
u, a, f;
if (!r.list || !n || !i) {
return
}
u = n / s;
a = i / o;
f = r.list.children().eq(t).find("a");
if (u >= 1 && a >= 1) {
if (u > a) {
n = Math.floor(n / a);
i = o
} else {
n = s;
i = Math.floor(i / u)
}
}
e(this).css({
width: n,
height: i,
top: Math.floor(o / 2 - i / 2),
left: Math.floor(s / 2 - n / 2)
});
f.width(s).height(o);
e(this).hide().appendTo(f).fadeIn(300)
}).attr("src", i)
});
this.width = this.list.children().eq(0).outerWidth(true);
this.list.width(this.width * (n.group.length + 1)).css("left", Math.floor(e(window).width() * .5 - (n.index * this.width + this.width * .5)))
},
beforeLoad: function(e, t) {
if (t.group.length < 2) {
t.helpers.thumbs = false;
return
}
t.margin[e.position === "top" ? 0 : 2] += e.height + 15
},
afterShow: function(e, t) {
if (this.list) {
this.onUpdate(e, t)
} else {
this.init(e, t)
}
this.list.children().removeClass("active").eq(t.index).addClass("active")
},
onUpdate: function(t, n) {
if (this.list) {
this.width = this.list.children().eq(0).outerWidth(true);
punchgs.TweenLite.set(this.list,{width:(this.width * (n.group.length + 1))})
punchgs.TweenLite.to(this.list,0.5,{ease:punchgs.Power3.easeInOut,left:Math.floor(e(window).width() * .5 - (n.index * this.width + this.width * .5))});
}
},
beforeClose: function() {
if (this.wrap) {
this.wrap.remove()
}
this.wrap = null;
this.list = null;
this.width = 0
}
}
})(jQuery)
jQuery('body').on('click', '.esgbox', function() {
var $this = jQuery(this);
if($this.attr('href').search('wistia') !== -1 && !$this.hasClass('esgbox.iframe')) {
$this.addClass('esgbox.iframe').attr('href', $this.attr('href') + '?autoPlay=true').click();
return false;
}
});