;
(function(d) {
d.flexslider = function(i, k) {
var a = d(i),
c = d.extend({}, d.flexslider.defaults, k),
e = c.namespace,
p = "ontouchstart" in window || window.documenttouch && document instanceof documenttouch,
t = p ? "touchend" : "click",
l = "vertical" === c.direction,
m = c.reverse,
h = 0 < c.itemwidth,
r = "fade" === c.animation,
s = "" !== c.asnavfor,
f = {};
d.data(i, "flexslider", a);
f = {
init: function() {
a.animating = !1;
a.currentslide = c.startat;
a.animatingto = a.currentslide;
a.atend = 0 === a.currentslide || a.currentslide === a.last;
a.containerselector = c.selector.substr(0,
c.selector.search(" "));
a.slides = d(c.selector, a);
a.container = d(a.containerselector, a);
a.count = a.slides.length;
a.syncexists = 0 < d(c.sync).length;
"slide" === c.animation && (c.animation = "swing");
a.prop = l ? "top" : "marginleft";
a.args = {};
a.manualpause = !1;
var b = a,
g;
if (g = !c.video)
if (g = !r)
if (g = c.usecss) a: {
g = document.createelement("div");
var n = ["perspectiveproperty", "webkitperspective", "mozperspective", "operspective", "msperspective"],
e;
for (e in n)
if (void 0 !== g.style[n[e]]) {
a.pfx = n[e].replace("perspective", "").tolowercase();
a.prop = "-" + a.pfx + "-transform";
g = !0;
break a
}
g = !1
}
b.transitions = g;
"" !== c.controlscontainer && (a.controlscontainer = 0 < d(c.controlscontainer).length && d(c.controlscontainer));
"" !== c.manualcontrols && (a.manualcontrols = 0 < d(c.manualcontrols).length && d(c.manualcontrols));
c.randomize && (a.slides.sort(function() {
return math.round(math.random()) - 0.5
}), a.container.empty().append(a.slides));
a.domath();
s && f.asnav.setup();
a.setup("init");
c.controlnav && f.controlnav.setup();
c.directionnav && f.directionnav.setup();
c.keyboard &&
(1 === d(a.containerselector).length || c.multiplekeyboard) && d(document).bind("keyup", function(b) {
b = b.keycode;
if (!a.animating && (39 === b || 37 === b)) b = 39 === b ? a.gettarget("next") : 37 === b ? a.gettarget("prev") : !1, a.flexanimate(b, c.pauseonaction)
});
c.mousewheel && a.bind("mousewheel", function(b, g) {
b.preventdefault();
var d = 0 > g ? a.gettarget("next") : a.gettarget("prev");
a.flexanimate(d, c.pauseonaction)
});
c.pauseplay && f.pauseplay.setup();
c.slideshow && (c.pauseonhover && a.hover(function() {
!a.manualplay && !a.manualpause && a.pause()
},
function() {
!a.manualpause && !a.manualplay && a.play()
}), 0 < c.initdelay ? settimeout(a.play, c.initdelay) : a.play());
p && c.touch && f.touch();
(!r || r && c.smoothheight) && d(window).bind("resize focus", f.resize);
settimeout(function() {
c.start(a)
}, 200)
},
asnav: {
setup: function() {
a.asnav = !0;
a.animatingto = math.floor(a.currentslide / a.move);
a.currentitem = a.currentslide;
a.slides.removeclass(e + "active-slide").eq(a.currentitem).addclass(e + "active-slide");
a.slides.click(function(b) {
b.preventdefault();
var b = d(this),
g = b.index();
!d(c.asnavfor).data("flexslider").animating && !b.hasclass("active") && (a.direction = a.currentitem < g ? "next" : "prev", a.flexanimate(g, c.pauseonaction, !1, !0, !0))
})
}
},
controlnav: {
setup: function() {
a.manualcontrols ? f.controlnav.setupmanual() : f.controlnav.setuppaging()
},
setuppaging: function() {
var b = 1,
g;
a.controlnavscaffold = d('
');
if (1 < a.pagingcount)
for (var n = 0; n < a.pagingcount; n++) g = "thumbnails" === c.controlnav ?
'' : "" + b + "", a.controlnavscaffold.append("" + g + ""), b++;
a.controlscontainer ? d(a.controlscontainer).append(a.controlnavscaffold) : a.append(a.controlnavscaffold);
f.controlnav.set();
f.controlnav.active();
a.controlnavscaffold.delegate("a, img", t, function(b) {
b.preventdefault();
var b = d(this),
g = a.controlnav.index(b);
b.hasclass(e + "active") || (a.direction = g > a.currentslide ? "next" : "prev", a.flexanimate(g, c.pauseonaction))
});
p && a.controlnavscaffold.delegate("a",
"click touchstart", function(a) {
a.preventdefault()
})
},
setupmanual: function() {
a.controlnav = a.manualcontrols;
f.controlnav.active();
a.controlnav.live(t, function(b) {
b.preventdefault();
var b = d(this),
g = a.controlnav.index(b);
b.hasclass(e + "active") || (g > a.currentslide ? a.direction = "next" : a.direction = "prev", a.flexanimate(g, c.pauseonaction))
});
p && a.controlnav.live("click touchstart", function(a) {
a.preventdefault()
})
},
set: function() {
a.controlnav = d("." + e + "control-nav li " + ("thumbnails" === c.controlnav ? "img" : "a"),
a.controlscontainer ? a.controlscontainer : a)
},
active: function() {
a.controlnav.removeclass(e + "active").eq(a.animatingto).addclass(e + "active")
},
update: function(b, c) {
1 < a.pagingcount && "add" === b ? a.controlnavscaffold.append(d("" + a.count + "")) : 1 === a.pagingcount ? a.controlnavscaffold.find("li").remove() : a.controlnav.eq(c).closest("li").remove();
f.controlnav.set();
1 < a.pagingcount && a.pagingcount !== a.controlnav.length ? a.update(c, b) : f.controlnav.active()
}
},
directionnav: {
setup: function() {
var b = d('");
a.controlscontainer ? (d(a.controlscontainer).append(b), a.directionnav = d("." + e + "direction-nav li a", a.controlscontainer)) : (a.append(b), a.directionnav = d("." + e + "direction-nav li a", a));
f.directionnav.update();
a.directionnav.bind(t, function(b) {
b.preventdefault();
b = d(this).hasclass(e + "next") ? a.gettarget("next") : a.gettarget("prev");
a.flexanimate(b, c.pauseonaction)
});
p && a.directionnav.bind("click touchstart", function(a) {
a.preventdefault()
})
},
update: function() {
var b = e + "disabled";
1 === a.pagingcount ? a.directionnav.addclass(b) : c.animationloop ? a.directionnav.removeclass(b) : 0 === a.animatingto ? a.directionnav.removeclass(b).filter("." + e + "prev").addclass(b) : a.animatingto === a.last ? a.directionnav.removeclass(b).filter("." + e + "next").addclass(b) : a.directionnav.removeclass(b)
}
},
pauseplay: {
setup: function() {
var b = d('');
a.controlscontainer ?
(a.controlscontainer.append(b), a.pauseplay = d("." + e + "pauseplay a", a.controlscontainer)) : (a.append(b), a.pauseplay = d("." + e + "pauseplay a", a));
f.pauseplay.update(c.slideshow ? e + "pause" : e + "play");
a.pauseplay.bind(t, function(b) {
b.preventdefault();
d(this).hasclass(e + "pause") ? (a.manualpause = !0, a.manualplay = !1, a.pause()) : (a.manualpause = !1, a.manualplay = !0, a.play())
});
p && a.pauseplay.bind("click touchstart", function(a) {
a.preventdefault()
})
},
update: function(b) {
"play" === b ? a.pauseplay.removeclass(e + "pause").addclass(e +
"play").text(c.playtext) : a.pauseplay.removeclass(e + "play").addclass(e + "pause").text(c.pausetext)
}
},
touch: function() {
function b(b) {
j = l ? d - b.touches[0].pagey : d - b.touches[0].pagex;
p = l ? math.abs(j) < math.abs(b.touches[0].pagex - e) : math.abs(j) < math.abs(b.touches[0].pagey - e);
if (!p || 500 < number(new date) - k) b.preventdefault(), !r && a.transitions && (c.animationloop || (j /= 0 === a.currentslide && 0 > j || a.currentslide === a.last && 0 < j ? math.abs(j) / q + 2 : 1), a.setprops(f + j, "settouch"))
}
function g() {
i.removeeventlistener("touchmove",
b, !1);
if (a.animatingto === a.currentslide && !p && null !== j) {
var h = m ? -j : j,
l = 0 < h ? a.gettarget("next") : a.gettarget("prev");
a.canadvance(l) && (550 > number(new date) - k && 50 < math.abs(h) || math.abs(h) > q / 2) ? a.flexanimate(l, c.pauseonaction) : r || a.flexanimate(a.currentslide, c.pauseonaction, !0)
}
i.removeeventlistener("touchend", g, !1);
f = j = e = d = null
}
var d, e, f, q, j, k, p = !1;
i.addeventlistener("touchstart", function(j) {
a.animating ? j.preventdefault() : 1 === j.touches.length && (a.pause(), q = l ? a.h : a.w, k = number(new date), f = h && m && a.animatingto ===
a.last ? 0 : h && m ? a.limit - (a.itemw + c.itemmargin) * a.move * a.animatingto : h && a.currentslide === a.last ? a.limit : h ? (a.itemw + c.itemmargin) * a.move * a.currentslide : m ? (a.last - a.currentslide + a.cloneoffset) * q : (a.currentslide + a.cloneoffset) * q, d = l ? j.touches[0].pagey : j.touches[0].pagex, e = l ? j.touches[0].pagex : j.touches[0].pagey, i.addeventlistener("touchmove", b, !1), i.addeventlistener("touchend", g, !1))
}, !1)
},
resize: function() {
!a.animating && a.is(":visible") && (h || a.domath(), r ? f.smoothheight() : h ? (a.slides.width(a.computedw),
a.update(a.pagingcount), a.setprops()) : l ? (a.viewport.height(a.h), a.setprops(a.h, "settotal")) : (c.smoothheight && f.smoothheight(), a.newslides.width(a.computedw), a.setprops(a.computedw, "settotal")))
},
smoothheight: function(b) {
if (!l || r) {
var c = r ? a : a.viewport;
b ? c.animate({
height: a.slides.eq(a.animatingto).height()
}, b) : c.height(a.slides.eq(a.animatingto).height())
}
},
sync: function(b) {
var g = d(c.sync).data("flexslider"),
e = a.animatingto;
switch (b) {
case "animate":
g.flexanimate(e, c.pauseonaction, !1, !0);
break;
case "play":
!g.playing && !g.asnav && g.play();
break;
case "pause":
g.pause()
}
}
};
a.flexanimate = function(b, g, n, i, k) {
s && 1 === a.pagingcount && (a.direction = a.currentitem < b ? "next" : "prev");
if (!a.animating && (a.canadvance(b, k) || n) && a.is(":visible")) {
if (s && i)
if (n = d(c.asnavfor).data("flexslider"), a.atend = 0 === b || b === a.count - 1, n.flexanimate(b, !0, !1, !0, k), a.direction = a.currentitem < b ? "next" : "prev", n.direction = a.direction, math.ceil((b + 1) / a.visible) - 1 !== a.currentslide && 0 !== b) a.currentitem = b, a.slides.removeclass(e + "active-slide").eq(b).addclass(e +
"active-slide"), b = math.floor(b / a.visible);
else return a.currentitem = b, a.slides.removeclass(e + "active-slide").eq(b).addclass(e + "active-slide"), !1;
a.animating = !0;
a.animatingto = b;
c.before(a);
g && a.pause();
a.syncexists && !k && f.sync("animate");
c.controlnav && f.controlnav.active();
h || a.slides.removeclass(e + "active-slide").eq(b).addclass(e + "active-slide");
a.atend = 0 === b || b === a.last;
c.directionnav && f.directionnav.update();
b === a.last && (c.end(a), c.animationloop || a.pause());
if (r) p ? (a.slides.eq(a.currentslide).css({
opacity: 0,
zindex: 1
}), a.slides.eq(b).css({
opacity: 1,
zindex: 2
}), a.slides.unbind("webkittransitionend transitionend"), a.slides.eq(a.currentslide).bind("webkittransitionend transitionend", function() {
c.after(a)
}), a.animating = !1, a.currentslide = a.animatingto) : (a.slides.eq(a.currentslide).fadeout(c.animationspeed, c.easing), a.slides.eq(b).fadein(c.animationspeed, c.easing, a.wrapup));
else {
var q = l ? a.slides.filter(":first").height() : a.computedw;
h ? (b = c.itemwidth > a.w ? 2 * c.itemmargin : c.itemmargin, b = (a.itemw + b) * a.move * a.animatingto,
b = b > a.limit && 1 !== a.visible ? a.limit : b) : b = 0 === a.currentslide && b === a.count - 1 && c.animationloop && "next" !== a.direction ? m ? (a.count + a.cloneoffset) * q : 0 : a.currentslide === a.last && 0 === b && c.animationloop && "prev" !== a.direction ? m ? 0 : (a.count + 1) * q : m ? (a.count - 1 - b + a.cloneoffset) * q : (b + a.cloneoffset) * q;
a.setprops(b, "", c.animationspeed);
if (a.transitions) {
if (!c.animationloop || !a.atend) a.animating = !1, a.currentslide = a.animatingto;
a.container.unbind("webkittransitionend transitionend");
a.container.bind("webkittransitionend transitionend",
function() {
a.wrapup(q)
})
} else a.container.animate(a.args, c.animationspeed, c.easing, function() {
a.wrapup(q)
})
}
c.smoothheight && f.smoothheight(c.animationspeed)
}
};
a.wrapup = function(b) {
!r && !h && (0 === a.currentslide && a.animatingto === a.last && c.animationloop ? a.setprops(b, "jumpend") : a.currentslide === a.last && (0 === a.animatingto && c.animationloop) && a.setprops(b, "jumpstart"));
a.animating = !1;
a.currentslide = a.animatingto;
c.after(a)
};
a.animateslides = function() {
a.animating || a.flexanimate(a.gettarget("next"))
};
a.pause =
function() {
clearinterval(a.animatedslides);
a.playing = !1;
c.pauseplay && f.pauseplay.update("play");
a.syncexists && f.sync("pause")
};
a.play = function() {
a.animatedslides = setinterval(a.animateslides, c.slideshowspeed);
a.playing = !0;
c.pauseplay && f.pauseplay.update("pause");
a.syncexists && f.sync("play")
};
a.canadvance = function(b, g) {
var d = s ? a.pagingcount - 1 : a.last;
return g ? !0 : s && a.currentitem === a.count - 1 && 0 === b && "prev" === a.direction ? !0 : s && 0 === a.currentitem && b === a.pagingcount - 1 && "next" !== a.direction ? !1 : b === a.currentslide && !s ? !1 : c.animationloop ? !0 : a.atend && 0 === a.currentslide && b === d && "next" !== a.direction ? !1 : a.atend && a.currentslide === d && 0 === b && "next" === a.direction ? !1 : !0
};
a.gettarget = function(b) {
a.direction = b;
return "next" === b ? a.currentslide === a.last ? 0 : a.currentslide + 1 : 0 === a.currentslide ? a.last : a.currentslide - 1
};
a.setprops = function(b, g, d) {
var e, f = b ? b : (a.itemw + c.itemmargin) * a.move * a.animatingto;
e = -1 * function() {
if (h) return "settouch" === g ? b : m && a.animatingto === a.last ? 0 : m ? a.limit - (a.itemw + c.itemmargin) * a.move * a.animatingto : a.animatingto ===
a.last ? a.limit : f;
switch (g) {
case "settotal":
return m ? (a.count - 1 - a.currentslide + a.cloneoffset) * b : (a.currentslide + a.cloneoffset) * b;
case "settouch":
return b;
case "jumpend":
return m ? b : a.count * b;
case "jumpstart":
return m ? a.count * b : b;
default:
return b
}
}() + "px";
a.transitions && (e = l ? "translate3d(0," + e + ",0)" : "translate3d(" + e + ",0,0)", d = void 0 !== d ? d / 1e3 + "s" : "0s", a.container.css("-" + a.pfx + "-transition-duration", d));
a.args[a.prop] = e;
(a.transitions || void 0 === d) && a.container.css(a.args)
};
a.setup = function(b) {
if (r) a.slides.css({
width: "880px",
"float": "left",
marginright: "-880px",
position: "relative"
}), "init" === b && (p ? a.slides.css({
opacity: 0,
display: "block",
webkittransition: "opacity " + c.animationspeed / 1e3 + "s ease",
zindex: 1
}).eq(a.currentslide).css({
opacity: 1,
zindex: 2
}) : a.slides.eq(a.currentslide).fadein(c.animationspeed, c.easing)), c.smoothheight && f.smoothheight();
else {
var g, n;
"init" === b && (a.viewport = d('').css({
overflow: "hidden",
position: "relative"
}).appendto(a).append(a.container), a.clonecount = 0, a.cloneoffset =
0, m && (n = d.makearray(a.slides).reverse(), a.slides = d(n), a.container.empty().append(a.slides)));
c.animationloop && !h && (a.clonecount = 2, a.cloneoffset = 1, "init" !== b && a.container.find(".clone").remove(), a.container.append(a.slides.first().clone().addclass("clone")).prepend(a.slides.last().clone().addclass("clone")));
a.newslides = d(c.selector, a);
g = m ? a.count - 1 - a.currentslide + a.cloneoffset : a.currentslide + a.cloneoffset;
l && !h ? (a.container.height(200 * (a.count + a.clonecount) + "%").css("position", "absolute").width("880px"),
settimeout(function() {
a.newslides.css({
display: "block"
});
a.domath();
a.viewport.height(a.h);
a.setprops(g * a.h, "init")
}, "init" === b ? 100 : 0)) : (a.container.width(200 * (a.count + a.clonecount) + "%"), a.setprops(g * a.computedw, "init"), settimeout(function() {
a.domath();
a.newslides.css({
width: a.computedw,
"float": "left",
display: "block"
});
c.smoothheight && f.smoothheight()
}, "init" === b ? 100 : 0))
}
h || a.slides.removeclass(e + "active-slide").eq(a.currentslide).addclass(e + "active-slide")
};
a.domath = function() {
var b = a.slides.first(),
d = c.itemmargin,
e = c.minitems,
f = c.maxitems;
a.w = a.width();
a.h = b.height();
a.boxpadding = b.outerwidth() - b.width();
h ? (a.itemt = c.itemwidth + d, a.minw = e ? e * a.itemt : a.w, a.maxw = f ? f * a.itemt : a.w, a.itemw = a.minw > a.w ? (a.w - d * e) / e : a.maxw < a.w ? (a.w - d * f) / f : c.itemwidth > a.w ? a.w : c.itemwidth, a.visible = math.floor(a.w / (a.itemw + d)), a.move = 0 < c.move && c.move < a.visible ? c.move : a.visible, a.pagingcount = math.ceil((a.count - a.visible) / a.move + 1), a.last = a.pagingcount - 1, a.limit = 1 === a.pagingcount ? 0 : c.itemwidth > a.w ? (a.itemw + 2 * d) * a.count - a.w -
d : (a.itemw + d) * a.count - a.w - d) : (a.itemw = a.w, a.pagingcount = a.count, a.last = a.count - 1);
a.computedw = a.itemw - a.boxpadding
};
a.update = function(b, d) {
a.domath();
h || (b < a.currentslide ? a.currentslide += 1 : b <= a.currentslide && 0 !== b && (a.currentslide -= 1), a.animatingto = a.currentslide);
if (c.controlnav && !a.manualcontrols)
if ("add" === d && !h || a.pagingcount > a.controlnav.length) f.controlnav.update("add");
else
if ("remove" === d && !h || a.pagingcount < a.controlnav.length) h && a.currentslide > a.last && (a.currentslide -= 1, a.animatingto -= 1),
f.controlnav.update("remove", a.last);
c.directionnav && f.directionnav.update()
};
a.addslide = function(b, e) {
var f = d(b);
a.count += 1;
a.last = a.count - 1;
l && m ? void 0 !== e ? a.slides.eq(a.count - e).after(f) : a.container.prepend(f) : void 0 !== e ? a.slides.eq(e).before(f) : a.container.append(f);
a.update(e, "add");
a.slides = d(c.selector + ":not(.clone)", a);
a.setup();
c.added(a)
};
a.removeslide = function(b) {
var e = isnan(b) ? a.slides.index(d(b)) : b;
a.count -= 1;
a.last = a.count - 1;
isnan(b) ? d(b, a.slides).remove() : l && m ? a.slides.eq(a.last).remove() :
a.slides.eq(b).remove();
a.domath();
a.update(e, "remove");
a.slides = d(c.selector + ":not(.clone)", a);
a.setup();
c.removed(a)
};
f.init()
};
d.flexslider.defaults = {
namespace: "flex-",
selector: ".slides > li",
animation: "fade",
easing: "swing",
direction: "horizontal",
reverse: !1,
animationloop: !0,
smoothheight: !1,
startat: 0,
slideshow: !0,
slideshowspeed: 3000,
animationspeed: 400,
initdelay: 0,
randomize: !1,
pauseonaction: !0,
pauseonhover: !0,
usecss: !0,
touch: !0,
video: !1,
controlnav: !0,
directionnav: !0,
prevtext: "previous",
nexttext: "next",
keyboard: !0,
multiplekeyboard: !1,
mousewheel: !1,
pauseplay: !1,
pausetext: "pause",
playtext: "play",
controlscontainer: "",
manualcontrols: "",
sync: "",
asnavfor: "",
itemwidth: 0,
itemmargin: 0,
minitems: 0,
maxitems: 0,
move: 0,
start: function() {},
before: function() {},
after: function() {},
end: function() {},
added: function() {},
removed: function() {}
};
d.fn.flexslider = function(i) {
void 0 === i && (i = {});
if ("object" === typeof i) return this.each(function() {
var a = d(this),
c = a.find(i.selector ? i.selector : ".slides > li");
1 === c.length ? (c.fadein(400),
i.start && i.start(a)) : void 0 == a.data("flexslider") && new d.flexslider(this, i)
});
var k = d(this).data("flexslider");
switch (i) {
case "play":
k.play();
break;
case "pause":
k.pause();
break;
case "next":
k.flexanimate(k.gettarget("next"), !0);
break;
case "prev":
case "previous":
k.flexanimate(k.gettarget("prev"), !0);
break;
default:
"number" === typeof i && k.flexanimate(i, !0)
}
}
})(jquery);