/*! fancyBox v2.1.2 fancyapps.com | fancyapps.com/fancybox/#license */
(function (B, y, f, q) {
var p = f(B),
m = f(y),
b = f.fancybox = function () {
b.open.apply(this, arguments)
}, v = null,
r = y.createTouch !== q,
s = function (a) {
return a && a.hasOwnProperty && a instanceof f
}, n = function (a) {
return a && "string" === f.type(a)
}, E = function (a) {
return n(a) && 0 < a.indexOf("%")
}, k = function (a, d) {
var e = parseInt(a, 10) || 0;
d && E(a) && (e *= b.getViewport()[d] / 100);
return Math.ceil(e)
}, w = function (a, b) {
return k(a, b) + "px"
};
f.extend(b, {
version: "2.1.2",
defaults: {
padding: 15,
margin: 20,
width: 800,
height: 600,
minWidth: 100,
minHeight: 100,
maxWidth: 9999,
maxHeight: 9999,
autoSize: !0,
autoHeight: !1,
autoWidth: !1,
autoResize: !0,
autoCenter: !r,
fitToView: !0,
aspectRatio: !1,
topRatio: 0.5,
leftRatio: 0.5,
scrolling: "auto",
wrapCSS: "",
arrows: !0,
closeBtn: !0,
closeClick: !1,
nextClick: !1,
mouseWheel: !0,
autoPlay: !1,
playSpeed: 3E3,
preload: 3,
modal: !1,
loop: !0,
ajax: {
dataType: "html",
headers: {
"X-fancyBox": !0
}
},
iframe: {
scrolling: "auto",
preload: !0
},
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: !0,
index: 0,
type: null,
href: null,
content: null,
title: null,
tpl: {
wrap: '
The requested content cannot be loaded.
Please try again later.
',
closeBtn: '").html(e).find(a.selector) : s(e) && (e.data("fancybox-placeholder") || e.data("fancybox-placeholder", f('
').insertAfter(e).hide()), e = e.show().detach(), a.wrap.bind("onReset", function () {
f(this).find(e).length && e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder", !1)
}));
break;
case "image":
e = a.tpl.image.replace("{href}", g);
break;
case "swf":
e = '
"
}(!s(e) || !e.parent().is(a.inner)) && a.inner.append(e);
b.trigger("beforeShow");
a.inner.css("overflow", "yes" === j ? "scroll" : "no" === j ? "hidden" : j);
b._setDimension();
b.reposition();
b.isOpen = !1;
b.coming = null;
b.bindEvents();
if (b.isOpened) {
if (d.prevMethod) b.transitions[d.prevMethod]()
} else f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();
b.transitions[b.isOpened ? a.nextMethod : a.openMethod]();
b._preloadImages()
}
},
_setDimension: function () {
var a = b.getViewport(),
d = 0,
e = !1,
c = !1,
e = b.wrap,
j = b.skin,
g = b.inner,
h = b.current,
c = h.width,
i = h.height,
l = h.minWidth,
t = h.minHeight,
m = h.maxWidth,
u = h.maxHeight,
r = h.scrolling,
p = h.scrollOutside ? h.scrollbarWidth : 0,
x = h.margin,
n = k(x[1] + x[3]),
q = k(x[0] + x[2]),
y, z, s, C, A, F, B, D, v;
e.add(j).add(g).width("auto").height("auto");
x = k(j.outerWidth(!0) - j.width());
y = k(j.outerHeight(!0) - j.height());
z = n + x;
s = q + y;
C = E(c) ? (a.w - z) * k(c) / 100 : c;
A = E(i) ? (a.h - s) * k(i) / 100 : i;
if ("iframe" === h.type) {
if (v = h.content, h.autoHeight && 1 === v.data("ready")) try {
v[0].contentWindow.document.location && (g.width(C).height(9999), F = v.contents().find("body"), p && F.css("overflow-x", "hidden"), A = F.height())
} catch (G) {}
} else if (h.autoWidth ||
h.autoHeight) g.addClass("fancybox-tmp"), h.autoWidth || g.width(C), h.autoHeight || g.height(A), h.autoWidth && (C = g.width()), h.autoHeight && (A = g.height()), g.removeClass("fancybox-tmp");
c = k(C);
i = k(A);
D = C / A;
l = k(E(l) ? k(l, "w") - z : l);
m = k(E(m) ? k(m, "w") - z : m);
t = k(E(t) ? k(t, "h") - s : t);
u = k(E(u) ? k(u, "h") - s : u);
F = m;
B = u;
h.fitToView && (m = Math.min(a.w - z, m), u = Math.min(a.h - s, u));
z = a.w - n;
q = a.h - q;
h.aspectRatio ? (c > m && (c = m, i = k(c / D)), i > u && (i = u, c = k(i * D)), c < l && (c = l, i = k(c / D)), i < t && (i = t, c = k(i * D))) : (c = Math.max(l, Math.min(c, m)), h.autoHeight &&
"iframe" !== h.type && (g.width(c), i = g.height()), i = Math.max(t, Math.min(i, u)));
if (h.fitToView)
if (g.width(c).height(i), e.width(c + x), a = e.width(), n = e.height(), h.aspectRatio)
for (;
(a > z || n > q) && (c > l && i > t) && !(19 < d++);) i = Math.max(t, Math.min(u, i - 10)), c = k(i * D), c < l && (c = l, i = k(c / D)), c > m && (c = m, i = k(c / D)), g.width(c).height(i), e.width(c + x), a = e.width(), n = e.height();
else c = Math.max(l, Math.min(c, c - (a - z))), i = Math.max(t, Math.min(i, i - (n - q)));
p && ("auto" === r && i < A && c + x + p < z) && (c += p);
g.width(c).height(i);
e.width(c + x);
a = e.width();
n = e.height();
e = (a > z || n > q) && c > l && i > t;
c = h.aspectRatio ? c < F && i < B && c < C && i < A : (c < F || i < B) && (c < C || i < A);
f.extend(h, {
dim: {
width: w(a),
height: w(n)
},
origWidth: C,
origHeight: A,
canShrink: e,
canExpand: c,
wPadding: x,
hPadding: y,
wrapSpace: n - j.outerHeight(!0),
skinSpace: j.height() - i
});
!v && (h.autoHeight && i > t && i < u && !c) && g.height("auto")
},
_getPosition: function (a) {
var d = b.current,
e = b.getViewport(),
c = d.margin,
f = b.wrap.width() + c[1] + c[3],
g = b.wrap.height() + c[0] + c[2],
c = {
position: "absolute",
top: c[0],
left: c[3]
};
d.autoCenter && d.fixed && !a && g <= e.h && f <= e.w ? c.position = "fixed" : d.locked || (c.top += e.y, c.left += e.x);
c.top = w(Math.max(c.top, c.top + (e.h - g) * d.topRatio));
c.left = w(Math.max(c.left, c.left + (e.w - f) * d.leftRatio));
return c
},
_afterZoomIn: function () {
var a = b.current;
a && (b.isOpen = b.isOpened = !0, b.wrap.css("overflow", "visible").addClass("fancybox-opened"), b.reposition(), (a.closeClick || a.nextClick && 1 < b.group.length) && b.inner.css("cursor", "pointer").bind("click.fb", function (d) {
if (!f(d.target).is("a") && !f(d.target).parent().is("a")) b[a.closeClick ?
"close" : "next"]()
}), a.closeBtn && f(a.tpl.closeBtn).appendTo(b.skin).bind("click.fb", b.close), a.arrows && 1 < b.group.length && ((a.loop || 0 < a.index) && f(a.tpl.prev).appendTo(b.outer).bind("click.fb", b.prev), (a.loop || a.index < b.group.length - 1) && f(a.tpl.next).appendTo(b.outer).bind("click.fb", b.next)), b.trigger("afterShow"), !a.loop && a.index === a.group.length - 1 ? b.play(!1) : b.opts.autoPlay && !b.player.isActive && (b.opts.autoPlay = !1, b.play()))
},
_afterZoomOut: function () {
var a = b.current;
f(".fancybox-wrap").stop(!0).trigger("onReset").remove();
f.extend(b, {
group: {},
opts: {},
router: !1,
current: null,
isActive: !1,
isOpened: !1,
isOpen: !1,
isClosing: !1,
wrap: null,
skin: null,
outer: null,
inner: null
});
b.trigger("afterClose", a)
}
});
b.transitions = {
getOrigPosition: function () {
var a = b.current,
d = a.element,
e = a.orig,
c = {}, f = 50,
g = 50,
h = a.hPadding,
i = a.wPadding,
l = b.getViewport();
!e && (a.isDom && d.is(":visible")) && (e = d.find("img:first"), e.length || (e = d));
s(e) ? (c = e.offset(), e.is("img") && (f = e.outerWidth(), g = e.outerHeight())) : (c.top = l.y + (l.h - g) * a.topRatio, c.left = l.x + (l.w - f) *
a.leftRatio);
if ("fixed" === b.wrap.css("position") || a.locked) c.top -= l.y, c.left -= l.x;
return c = {
top: w(c.top - h * a.topRatio),
left: w(c.left - i * a.leftRatio),
width: w(f + i),
height: w(g + h)
}
},
step: function (a, d) {
var e, c, f = d.prop;
c = b.current;
var g = c.wrapSpace,
h = c.skinSpace;
if ("width" === f || "height" === f) e = d.end === d.start ? 1 : (a - d.start) / (d.end - d.start), b.isClosing && (e = 1 - e), c = "width" === f ? c.wPadding : c.hPadding, c = a - c, b.skin[f](k("width" === f ? c : c - g * e)), b.inner[f](k("width" === f ? c : c - g * e - h * e))
},
zoomIn: function () {
var a = b.current,
d = a.pos,
e = a.openEffect,
c = "elastic" === e,
j = f.extend({
opacity: 1
}, d);
delete j.position;
c ? (d = this.getOrigPosition(), a.openOpacity && (d.opacity = 0.1)) : "fade" === e && (d.opacity = 0.1);
b.wrap.css(d).animate(j, {
duration: "none" === e ? 0 : a.openSpeed,
easing: a.openEasing,
step: c ? this.step : null,
complete: b._afterZoomIn
})
},
zoomOut: function () {
var a = b.current,
d = a.closeEffect,
e = "elastic" === d,
c = {
opacity: 0.1
};
e && (c = this.getOrigPosition(), a.closeOpacity && (c.opacity = 0.1));
b.wrap.animate(c, {
duration: "none" === d ? 0 : a.closeSpeed,
easing: a.closeEasing,
step: e ? this.step : null,
complete: b._afterZoomOut
})
},
changeIn: function () {
var a = b.current,
d = a.nextEffect,
e = a.pos,
c = {
opacity: 1
}, f = b.direction,
g;
e.opacity = 0.1;
"elastic" === d && (g = "down" === f || "up" === f ? "top" : "left", "down" === f || "right" === f ? (e[g] = w(k(e[g]) - 200), c[g] = "+=200px") : (e[g] = w(k(e[g]) + 200), c[g] = "-=200px"));
"none" === d ? b._afterZoomIn() : b.wrap.css(e).animate(c, {
duration: a.nextSpeed,
easing: a.nextEasing,
complete: function () {
setTimeout(b._afterZoomIn, 20)
}
})
},
changeOut: function () {
var a = b.previous,
d = a.prevEffect,
e = {
opacity: 0.1
}, c = b.direction;
"elastic" === d && (e["down" === c || "up" === c ? "top" : "left"] = ("up" === c || "left" === c ? "-" : "+") + "=200px");
a.wrap.animate(e, {
duration: "none" === d ? 0 : a.prevSpeed,
easing: a.prevEasing,
complete: function () {
f(this).trigger("onReset").remove()
}
})
}
};
b.helpers.overlay = {
defaults: {
closeClick: !0,
speedOut: 200,
showEarly: !0,
css: {},
locked: !0
},
overlay: null,
fixed: !1,
create: function () {
this.overlay && this.close();
this.overlay = f('
').appendTo(this.el || "body");
this.fixed = !1;
b.defaults.fixed && !r && (this.overlay.addClass("fancybox-overlay-fixed"), this.fixed = !0)
},
open: function (a) {
var d = this,
a = f.extend({}, this.defaults, a);
this.overlay ? this.overlay.unbind(".overlay").width("auto").height("auto") : this.create();
this.fixed || (p.bind("resize.overlay", f.proxy(this.update, this)), this.update());
a.closeClick && this.overlay.bind("click.overlay", function (a) {
f(a.target).hasClass("fancybox-overlay") && (b.isActive ? b.close() : d.close())
});
this.overlay.css(a.css).show()
},
close: function () {
f(".fancybox-overlay").remove();
p.unbind("resize.overlay");
this.overlay = null
},
update: function () {
var a = "100%",
b;
this.overlay.width(a).height("100%");
f.browser.msie ? (b = Math.max(y.documentElement.offsetWidth, y.body.offsetWidth), m.width() > b && (a = m.width())) : m.width() > p.width() && (a = m.width());
this.overlay.width(a).height(m.height())
},
onReady: function (a, b) {
f(".fancybox-overlay").stop(!0, !0);
this.overlay || (this.margin = m.height() > p.height() || "scroll" === f("body").css("overflow-y") ? f("body").css("margin-right") : !1, this.el = y.all && !y.querySelector ?
f("html") : f("body"), this.create());
a.locked && this.fixed && (b.locked = this.overlay.append(b.wrap), b.fixed = !1);
!0 === a.showEarly && this.beforeShow.apply(this, arguments)
},
beforeShow: function (a, b) {
b.locked && (this.el.addClass("fancybox-lock"), !1 !== this.margin && f("body").css("margin-right", k(this.margin) + b.scrollbarWidth));
this.open(a)
},
onUpdate: function () {
this.fixed || this.update()
},
afterClose: function (a) {
var d = this,
a = a.speedOut;
d.overlay && !b.isActive && d.overlay.fadeOut(a || 0, function () {
!1 !== d.margin && f("body").css("margin-right",
d.margin);
d.el.removeClass("fancybox-lock");
d.close()
})
}
};
b.helpers.title = {
defaults: {
type: "float",
position: "bottom"
},
beforeShow: function (a) {
var d = b.current,
e = d.title,
c = a.type;
f.isFunction(e) && (e = e.call(d.element, d));
if (n(e) && "" !== f.trim(e)) {
d = f('
' + e + "
");
switch (c) {
case "inside":
c = b.skin;
break;
case "outside":
c = b.wrap;
break;
case "over":
c = b.inner;
break;
default:
c = b.skin, d.appendTo("body"), f.browser.msie && d.width(d.width()), d.wrapInner('
'),
b.current.margin[2] += Math.abs(k(d.css("margin-bottom")))
}
d["top" === a.position ? "prependTo" : "appendTo"](c)
}
}
};
f.fn.fancybox = function (a) {
var d, e = f(this),
c = this.selector || "",
j = function (g) {
var h = f(this).blur(),
i = d,
j, k;
!g.ctrlKey && (!g.altKey && !g.shiftKey && !g.metaKey) && !h.is(".fancybox-wrap") && (j = a.groupAttr || "data-fancybox-group", k = h.attr(j), k || (j = "rel", k = h.get(0)[j]), k && ("" !== k && "nofollow" !== k) && (h = c.length ? f(c) : e, h = h.filter("[" + j + '="' + k + '"]'), i = h.index(this)), a.index = i, !1 !== b.open(h, a) && g.preventDefault())
},
a = a || {};
d = a.index || 0;
!c || !1 === a.live ? e.unbind("click.fb-start").bind("click.fb-start", j) : m.undelegate(c, "click.fb-start").delegate(c + ":not('.fancybox-item, .fancybox-nav')", "click.fb-start", j);
return this
};
m.ready(function () {
f.scrollbarWidth === q && (f.scrollbarWidth = function () {
var a = f('
').appendTo("body"),
b = a.children(),
b = b.innerWidth() - b.height(99).innerWidth();
a.remove();
return b
});
if (f.support.fixedPosition === q) {
var a = f.support,
d = f('
').appendTo("body"),
e = 20 === d[0].offsetTop || 15 === d[0].offsetTop;
d.remove();
a.fixedPosition = e
}
f.extend(b.defaults, {
scrollbarWidth: f.scrollbarWidth(),
fixed: f.support.fixedPosition,
parent: f("body")
})
})
})(window, document, jQuery);