// javascript document
! function (a) {
a.fn.extend({
smoothproducts: function () {
function b() {
a(".sp-selected").removeclass("sp-selected"), a(".sp-lightbox").fadeout(function () {
a(this).remove()
})
}
function c(a) {
return a.match(/url\([\"\']{0,1}(.+)[\"\']{0,1}\)+/i)[1]
}
a(".sp-loading").hide(), a(".pro_wrap").each(function () {
a(this).addclass("sp-touch");
var b = a("a", this).length;
if (b > 1) {
var c, d, e = a("a.sp-default", this)[0] ? !0 : !1;
a(this).append('
'), a("a", this).each(function (b) {
var f = a("img", this).attr("src"),
g = a(this).attr("href"),
h = "";
(0 === b && !e || a(this).hasclass("sp-default")) && (h = ' class="sp-current"', c = g, d = a("img", this)[0].src), a(this).parents(".pro_wrap").find(".sp-thumbs").append('"), a(this).remove()
}), a(".sp-large", this).append('
'), a(".pro_wrap").css("display", "inline-block")
} else a(this).append(''), a("a", this).appendto(a(".sp-large", this)).addclass(".sp-current-big"), a(".pro_wrap").css("display", "inline-block")
}), a(document.body).on("click", ".sp-thumbs", function (a) {
a.preventdefault()
}), a(document.body).on("mouseover", function (b) {
a(".pro_wrap").removeclass("sp-touch").addclass("sp-non-touch"), b.preventdefault()
}), a(document.body).on("touchstart", function () {
a(".pro_wrap").removeclass("sp-non-touch").addclass("sp-touch")
}), a(document.body).on("click", ".sp-tb-active a", function (b) {
b.preventdefault(), a(this).parent().find(".sp-current").removeclass(), a(this).addclass("sp-current"), a(this).parents(".pro_wrap").find(".sp-thumbs").removeclass("sp-tb-active"), a(this).parents(".pro_wrap").find(".sp-zoom").remove();
var d = a(this).parents(".pro_wrap").find(".sp-large").height(),
e = a(this).parents(".pro_wrap").find(".sp-large").width();
a(this).parents(".pro_wrap").find(".sp-large").css({
overflow: "hidden",
height: d + "px",
width: e + "px"
}), a(this).addclass("sp-current").parents(".pro_wrap").find(".sp-large a").remove();
var f = a(this).parent().find(".sp-current").attr("href"),
g = c(a(this).parent().find(".sp-current").css("backgroundimage"));
a(this).parents(".pro_wrap").find(".sp-large").html('
'), a(this).parents(".pro_wrap").find(".sp-large").hide().fadein(250, function () {
var b = a(this).parents(".pro_wrap").find(".sp-large img").height();
a(this).parents(".pro_wrap").find(".sp-large").animate({
height: b
}, "fast", function () {
a(".sp-large").css({
height: "auto",
width: "auto"
})
}), a(this).parents(".pro_wrap").find(".sp-thumbs").addclass("sp-tb-active")
})
}), a(document.body).on("mouseenter", ".sp-non-touch .sp-large", function (b) {
var c = a("a", this).attr("href");
a(this).append(''), a(this).find(".sp-zoom").fadein(250), b.preventdefault()
}), a(document.body).on("mouseleave", ".sp-non-touch .sp-large", function (b) {
a(this).find(".sp-zoom").fadeout(250, function () {
a(this).remove()
}), b.preventdefault()
}), a(document.body).on("click", ".sp-non-touch .sp-zoom", function (b) {
var c = a(this).html(),
d = a(this).parents(".pro_wrap").find(".sp-thumbs a").length,
e = a(this).parents(".pro_wrap").find(".sp-thumbs .sp-current").index() + 1;
a(this).parents(".pro_wrap").addclass("sp-selected"), a("body").append("" + c + "
"), d > 1 && (a(".sp-lightbox").append(""), 1 == e ? a("#sp-prev").css("opacity", ".1") : e == d && a("#sp-next").css("opacity", ".1")), a(".sp-lightbox").fadein(), b.preventdefault()
}), a(document.body).on("click", ".sp-large a", function (b) {
var c = a(this).attr("href"),
d = a(this).parents(".pro_wrap").find(".sp-thumbs a").length,
e = a(this).parents(".pro_wrap").find(".sp-thumbs .sp-current").index() + 1;
a(this).parents(".pro_wrap").addclass("sp-selected"), a("body").append(''), d > 1 && (a(".sp-lightbox").append(""), 1 == e ? a("#sp-prev").css("opacity", ".1") : e == d && a("#sp-next").css("opacity", ".1")), a(".sp-lightbox").fadein(), b.preventdefault()
}), a(document.body).on("click", "#sp-next", function (b) {
b.stoppropagation();
var d = a(".sp-lightbox").data("currenteq"),
e = a(".sp-selected .sp-thumbs a").length;
if (d >= e);
else {
var f = d + 1,
g = a(".sp-selected .sp-thumbs").find("a:eq(" + d + ")").attr("href"),
h = c(a(".sp-selected .sp-thumbs").find("a:eq(" + d + ")").css("backgroundimage"));
d == e - 1 && a("#sp-next").css("opacity", ".1"), a("#sp-prev").css("opacity", "1"), a(".sp-selected .sp-current").removeclass(), a(".sp-selected .sp-thumbs a:eq(" + d + ")").addclass("sp-current"), a(".sp-selected .sp-large").empty().append("'), a(".sp-lightbox img").fadeout(250, function () {
a(this).remove(), a(".sp-lightbox").data("currenteq", f).append('
'), a(".sp-lightbox img").hide().fadein(250)
})
}
b.preventdefault()
}), a(document.body).on("click", "#sp-prev", function (b) {
b.stoppropagation();
var d = a(".sp-lightbox").data("currenteq"),
d = d - 1;
if (0 >= d);
else {
1 == d && a("#sp-prev").css("opacity", ".1");
var e = d - 1,
f = a(".sp-selected .sp-thumbs").find("a:eq(" + e + ")").attr("href"),
g = c(a(".sp-selected .sp-thumbs").find("a:eq(" + e + ")").css("backgroundimage"));
a("#sp-next").css("opacity", "1"), a(".sp-selected .sp-current").removeclass(), a(".sp-selected .sp-thumbs a:eq(" + e + ")").addclass("sp-current"), a(".sp-selected .sp-large").empty().append("'), a(".sp-lightbox img").fadeout(250, function () {
a(this).remove(), a(".sp-lightbox").data("currenteq", d).append('
'), a(".sp-lightbox img").hide().fadein(250)
})
}
b.preventdefault()
}), a(document.body).on("click", ".sp-lightbox", function () {
b()
}), a(document).keydown(function (a) {
return 27 == a.keycode ? (b(), !1) : void 0
}), a(".sp-large").mousemove(function (b) {
var c = a(this).width(),
d = a(this).height(),
e = a(this).find(".sp-zoom").width(),
f = a(this).find(".sp-zoom").height(),
g = a(this).parent().offset(),
h = b.pagex - g.left,
i = b.pagey - g.top,
j = math.floor(h * (c - e) / c),
k = math.floor(i * (d - f) / d);
a(this).find(".sp-zoom").css({
left: j,
top: k
})
})
}
})
}(jquery);