(function(b) { var d = object.prototype.tostring, f = array.prototype.slice, a = true; try { if (typeof document !== "undefined") { f.call(document.getelementsbytagname("body")) } } catch(c) { a = false } b.isarray = ("isarray" in array) ? array.isarray: function(e) { return d.call(e) === "[object array]" }; b.toarray = function(h, k, e) { if (!h || !h.length) { return [] } if (typeof h === "string") { h = h.split("") } if (a) { return f.call(h, k || 0, e || h.length) } var j = [], g; k = k || 0; e = e ? ((e < 0) ? h.length + e: e) : h.length; for (g = k; g < e; g++) { j.push(h[g]) } return j }; b.later = function(o, n, j, g, i) { n = n || 0; var h = o, l = b.toarray(i), k, e; if (typeof o == "object") { h = g[o] } if (!h) { return } k = function() { h.apply(g, l) }; e = (j) ? setinterval(k, n) : settimeout(k, n); return { id: e, interval: j, cancel: function() { if (this.interval) { clearinterval(e) } else { cleartimeout(e) } } } }; b.buffer = function(h, e, g) { e = e || 150; if (e === -1) { return (function() { h.apply(g || this, arguments) }) } var j = null; function i() { i.stop(); j = b.later(h, e, false, g || this, arguments) } i.stop = function() { if (j) { j.cancel(); j = 0 } }; return i } })(this); (function(h) { h.ui = h.ui || {}; var j = ".", g = "switchable-", f = g + "trigger-internal", d = g + "panel-internal", c = "forward", e = "backward", b = [], a = -1, i = function(l) { var m = document.body.scrolltop, o = document.documentelement.offsetheight, n = l.offset(), k = l.height(); return n.top > m && n.top + k < m + o }; h.fn.extend({ slide: function(n) { var k = (typeof n == "string"), l = array.prototype.slice.call(arguments, 1), m = this; if (k) { this.each(function() { var o = b[h.data(this, "slide-instance-id")], p = (o && h.isfunction(o[n])) ? o[n].apply(o, l) : o; if (typeof p !== "undefined" && p !== true && p !== false) { m = p; return false } }) } else { this.each(function() { var o = h.data(this, "slide-instance-id"); if (typeof o !== "undefined" && b[o]) { b[o].destroy() } o = parseint(b.push({}), 10) - 1; h.data(this, "slide-instance-id", o); b[o] = new h.ui.slide(o, this, n); b[o].init() }) } return m } }); h.ui.slide = function(l, n, m) { this.get_index = function() { return l }; this.settings = h.extend({}, h.ui.slide.defaults, m); this.el = h(n); var k = this.settings; this.paused = false; this.activeindex = k.index > -1 ? k.index: 0; this.locked = false; this.view = null; g = k.prefix || g }; h.ui.slide.prototype = { init: function() { var k = this.settings; this.effect = k.effect; this.direction = k.direction.tolowercase(); this._parsemarkup(); this._refresh(); this._bind(); if (k.pauseonscroll) { this.__scrolldetect = buffer(h.proxy(function() { this[i(this.el) ? "_start": "_stop"]() }, this), 200); h(window).scroll(this.__scrolldetect) } !! k.auto && this._start() }, geteffect: function() { var l = this.effect, m = ["x", "y"], k; if (~l.indexof(",")) { k = l.split(",") } if (l == "random") { k = ["fold", "slice", "slide", "shutter", "grow"] } if (k && k.length) { l = k[math.floor(math.random() * (k.length))]; this.direction = m[math.floor(math.random() * (m.length))] } return (l || "scroll").tolowercase() }, _refresh: function() { var k = this.panels, m = this.geteffect(); if (m == "normal") { k.hide().eq(this.activeindex).show() } else { var l = h.noop; switch (m) { case "slice": case "slide": case "fold": case "shutter": case "grow": l = this.render; break; default: if (h.isfunction(this["_init_" + m])) { l = this["_init_" + m] } } k.show(); l && l.call(this) } }, reset: function(l, k, o, m) { var p = this.settings, s = p.steps, r = this.panels, q = this.length, u = l * s, t = (l + 1) * s; var n = r.slice(u, t); n.css("position", ""); n.css(k, ""); if (m) { this.content.css(k, l ? -o * (q - 1) : "") } }, adjust: function(l, k, n) { var o = this.settings, r = o.steps, q = this.panels, p = this.length, t = l * r, s = (l + 1) * r; var m = q.slice(t, s); m.css("position", "relative"); m.css(k, (l ? -1 : 1) * n * p); return l ? n: -n * p }, toggletrigger: function(m, k) { var l = this.settings.cur; if (m.length) { m.removeclass(l) } k.addclass(l) }, _getfromtopanels: function() { var m = this.fromindex, p, o, k = this.settings.steps, l = this.panels, n = this.activeindex; if (m > -1) { p = l.slice(m * k, (m + 1) * k) } o = l.slice(n * k, (n + 1) * k); return { frompanels: p, topanels: o } }, getactiveitem: function(m) { var m = m === null || this.activeindex, k = this.panels.eq(m), l = k.is("img") ? k: k.find("img:first"); return { src: l.attr("src"), title: l.attr("alt") || l.attr("title") || "" } }, setactiveitem: function() { this.panels.hide(); var l = this.activeindex, k = this.panels.eq(l), n = k.is("a"), m = k.find("a img").length; if (n) { k.css({ position: "absolute", "z-index": this.length + 1, width: "100%", height: "100%", "background-color": "#ffffff", opacity: 0 }).show().find("img").css("visibility", "hidden") } else { if (m) { k.css({ position: "absolute", "z-index": this.length + 1 }).show().find("img").css("visibility", "hidden"); k.find("a").css({ position: "absolute", width: "100%", height: "100%", "background-color": "#ffffff", opacity: 0 }) } } }, create_slices: function(r) { var q = this.getactiveitem(), l = this.settings, r = r == null ? l.slices: r, p = this.activeimg, n = p.width(), k = p.height(), o = math.round(n / r); for (var m = 0; m < r; m++) { h('
').css({ position: "absolute", top: 0, left: o * m, "z-index": this.length, width: m === r - 1 ? (n - (o * m)) : o, height: k, opacity: 0, overflow: "hidden", visibility: "hidden" }).insertbefore(this.content) } }, create_shutters: function() { var m = this.getactiveitem(), o = this.settings, n = this.activeimg, k = n.width(), r = n.height(), q = math.round(k / o.shutters.cols), p = math.round(r / o.shutters.rows); for (var s = 0; s < o.shutters.rows; s++) { for (var l = 0; l < o.shutters.cols; l++) { h('
').css({ position: "absolute", top: p * s, left: q * l, "z-index": this.length, width: l === o.shutters.cols - 1 ? (k - q * l) : q, height: r, opacity: 0, overflow: "hidden", visibility: "hidden" }).insertbefore(this.content) } } }, render: function() { var m = this.getactiveitem(), l = h('
' + m.title + '
').css("position", "absolute"); l.insertafter(this.content); this.panel = l; this.activeimg = l.find("img"); var k = this.content.parent(); if (k.css("position") == "static") { k.css("position", "relative") } this.setactiveitem() }, slice: function() { var m = j + g; this.setactiveitem(); this.el.find(m + "slice, " + m + "shutter").remove(); this.create_slices(); var l = this, k = this.settings, n = this.direction, o = this.el.find(m + "slice"), p = 0; if (n === "y") { o._reverse() } o.css("visibility", "visible").each(function(q) { var s = h(this), r = q === k.slices - 1 ? function() { var t = l.getactiveitem(); l.activeimg.attr("src", t.src); l.locked = false }: h.noop; later(function() { s.animate({ opacity: 1 }, k.speed, k.easing, r) }, 100 + p); p += 50 }) }, fold: function() { var m = j + g; this.setactiveitem(); this.el.find(m + "slice, " + m + "shutter").remove(); this.create_slices(); var l = this, k = this.settings, n = this.direction, o = this.el.find(m + "slice"), p = 0; if (n === "y") { o._reverse() } o.css("visibility", "visible").each(function(q) { var t = h(this), s = t.width(), r = q === k.slices - 1 ? function() { var u = l.getactiveitem(); l.activeimg.attr("src", u.src); l.locked = false }: h.noop; t.css("width", 0); later(function() { t.animate({ width: s, opacity: 1 }, k.speed, k.easing, r) }, 100 + p); p += 50 }) }, slide: function() { var n = j + g; this.setactiveitem(); this.el.find(n + "slice, " + n + "shutter").remove(); this.create_slices(1); var m = this, k = this.settings, o = this.el.find(n + "slice").eq(0), l = this.content.width(); o.css("visibility", "visible").css({ width: 0, opacity: 1, left: "", right: 0 }).animate({ width: l }, k.speed, k.easing, function() { o.css({ left: 0, right: "" }); var p = m.getactiveitem(); m.activeimg.attr("src", p.src); m.locked = false }) }, shutter: function() { var p = j + g; this.setactiveitem(); this.el.find(p + "slice, " + p + "shutter").remove(); this.create_shutters(); var o = this, k = this.settings, l = this.el.find(p + "shutter"), n = k.shutters.cols * k.shutters.rows, q = 0, m = function(s) { for (var t, r, u = s.length; u; t = parseint(math.random() * u, 10), r = s[--u], s[u] = s[t], s[t] = r) {} return s }; l = m(l); l.css("visibility", "visible").each(function(s) { var r = h(this), t = s === n - 1 ? function() { var u = o.getactiveitem(); o.activeimg.attr("src", u.src); o.locked = false }: h.noop; later(function() { r.animate({ opacity: 1 }, k.speed, k.easing, t) }, 100 + q); q += 20 }) }, grow: function() { var o = j + g; this.setactiveitem(); this.el.find(o + "slice, " + o + "shutter").remove(); this.create_shutters(); var w = this, q = this.settings, u = this.direction, p = this.el.find(o + "shutter"), t = q.shutters.cols * q.shutters.rows, n = 0, l = 0, k = 0, r = 0, v = []; v[r] = []; if (u === "y") { p._reverse() } p.each(function() { v[r][k] = h(this); k++; if (k == q.shutters.cols) { r++; k = 0; v[r] = [] } }); for (var s = 0; s < (q.shutters.cols * 2); s++) { var m = s; for (var x = 0; x < q.shutters.rows; x++) { if (m >= 0 && m < q.shutters.cols) { (function(y, i, a, c, f) { var h = v[i][y], g = h.width(), d = h.height(), b = { slow: 600, fast: 200, _default: 400 }, z = typeof q.speed == "number" ? q.speed: b[q.speed] || b[_default], e = c === f - 1 ? function() { var j = w.getactiveitem(); w.activeimg.attr("src", j.src); w.locked = false }: h.noop; h.width(0).height(0); later(function() { h.css("visibility", "visible").animate({ opacity: 1, width: g, height: d }, z / 1.3, q.easing, e) }, 100 + a) })(m, x, l, n, t); n++ } m-- } l += 100 } }, _init_scroll: function() { var k = this.settings, n = this.content, m = this.panels, l = k.steps, p = this.direction; n.css("position", "absolute"); var o = n.parent(); if (o.css("position") == "static") { o.css("position", "relative") } if (p == "x") { m.css("float", "left"); n.width("9999px") } this.view = { width: k.view.width ? k.view.width: m.eq(0).width() * l, height: k.view.height ? k.view.height: m.eq(0).height() * l } }, scroll: function(x, u) { var y = this, o = this.settings, v = this.fromindex, n = this.activeindex, p = this.length, r = {}, a = this.direction === "x", k = a ? "left": "top", z = a ? "width": "height", m = this.view[z], w = -m * n, q = this.panels, t = o.steps, l, s = u === e; this.locked = false; l = (s && v === 0 && n === p - 1) || (!s && v === p - 1 && n === 0); if (this.anim) { this.anim.stop(); if (q.eq(v * t).css("position") == "relative") { this.reset(v, k, m, 1) } } if (l) { w = this.adjust(n, k, m) } r[k] = w; if (v > -1) { this.anim = this.content.animate(r, o.speed, o.easing, h.proxy(function() { if (l) { this.reset(n, k, m, 1) } y.anim = undefined; x && x() }, this)) } else { this.content.css(r); x && x() } }, _init_fade: function() { var q = this, l = this.settings, n = this.panels, m = l.steps, o = this.activeindex * m, k = o + m - 1, p; n.each(function(r) { p = r >= o && r <= k; h(this).css({ position: "absolute", opacity: p ? 1 : 0, zindex: p ? q.length: 1 }) }) }, fade: function(r) { var l = this._getfromtopanels(), p = l.frompanels, o = l.topanels; this.locked = false; if (p && p.length !== 1) { return } var m = this, k = this.settings, q = p && p.length ? p.get(0) : null, n = o.get(0); if (this.anim) { this.anim.stop(); this.anim.frompanels.css({ zindex: 1, opacity: 0 }); this.anim.topanels.css("z-index", this.length) } o.css("opacity", 1); if (q) { this.anim = p.fadeto(k.speed, 0, function() { o.css("z-index", m.length); p.css("z-index", 1); r && r() }); this.anim.topanels = o; this.anim.frompanels = p } else { o.css("z-index", this.length); r && r() } }, normal: function(n) { var k = this._getfromtopanels(), m = k.frompanels, l = k.topanels; if (m && m.length) { m.hide() } l.show(); this.locked = false; n && n() }, updatebtnstatus: function() { var l = this.settings.disablebtncls, n = this.prevbtn, m = this.nextbtn, k = this.activeindex; n.removeclass(l); m.removeclass(l); if (k == 0) { n.addclass(l) } if (k == this.length - 1) { m.addclass(l) } }, _complete: function() { var k = this.settings; if (!k.circular) { this.updatebtnstatus() } }, _switchview: function(n, o) { var k = this.settings, m = this.geteffect(), l = h.noop; if (h.isfunction(this[m])) { l = this[m] } l && l.call(this, h.proxy(function() { this._complete(); o && o.call(this) }, this), n) }, switchto: function(l, o, p) { var k = this.settings, n = this.activeindex, m = this.triggers; if (this.locked) { return } if (this._triggerisvalid(l)) { return } this.fromindex = n; this.locked = true; if (k.hastriggers) { this.toggletrigger(m.eq(this.activeindex), m.eq(l)) } if (o === undefined) { o = l > n ? c: e } this.activeindex = l; if (this.settings.caption) { this.setcaption() } this._switchview(o, h.proxy(function() { p && p.call(this) }, this)) }, _start: function() { if (this.timer) { this.timer.cancel(); this.timer = undefined } this.paused = false; this.timer = later(h.proxy(function() { if (this.paused) { return } this.next() }, this), this.settings.interval, true) }, prev: function() { this.switchto((this.activeindex - 1 + this.length) % this.length, e) }, next: function() { this.switchto((this.activeindex + 1) % this.length, c) }, _stop: function() { if (this.timer) { this.timer.cancel(); this.timer = undefined } this.paused = true }, _bind: function() { var l = this, k = this.settings; if (this.settings.hastriggers) { this.triggers.addclass(f); this.nav.delegate(j + f, "click", function(o) { var n = h(this); var m = n.index(); l._onfocustrigger(m) }); if (k.evtype == "mouse") { this.nav.delegate(j + f, "mouseenter", function(o) { var n = h(this); var m = n.index(); l._onmouseentertrigger(m) }).delegate(j + f, "mouseleave", function(m) { l._onmouseleavetrigger() }) } } if (k.pauseonhover) { this.el.hover(h.proxy(this._stop, this), h.proxy(function() { !! k.auto && this._start() }, this)) } h.each(["prev", "next"], function() { var n = this, m = l[n + "btn"] = l.el.find(j + k[n + "btncls"]); m && m.length && m.mousedown(function(p) { p.preventdefault(); var o = l.activeindex; if (n == "prev" && (o != 0 || k.circular)) { l[n]() } if (n == "next" && (o != l.length - 1 || k.circular)) { l[n]() } }) }) }, _triggerisvalid: function(k) { return this.activeindex === k }, _onfocustrigger: function(k) { if (this._triggerisvalid(k)) { return } this._cancelswitchtimer(); this.switchto(k) }, _onmouseentertrigger: function(k) { if (this._triggerisvalid(k)) { return } this.switchtimer = later(h.proxy(function() { this.switchto(k) }, this), this.settings.delay * 1000) }, _onmouseleavetrigger: function(k) { this._cancelswitchtimer() }, _cancelswitchtimer: function() { if (this.switchtimer) { this.switchtimer.cancel(); this.switchtimer = undefined } }, _parsemarkup: function() { var k = this.settings, q, p, o, l, r; switch (k.markuptype) { case 0: q = this.el.find(j + k.navcls); if (q.length) { o = q.children() } p = this.el.find(j + k.contentcls); l = p.children(); break; case 1: o = this.el.find(j + k.triggercls); l = this.el.find(j + k.panelcls); break; case 2: o = k.triggers; l = k.panels; break } r = l.length; this.length = math.ceil(r / k.steps); this.nav = q && q.length ? q: (k.hastriggers && o && o.length ? o.parent() : null); this.panels = l; this.content = p && p.length ? p: l.parent(); if (k.hastriggers && (!this.nav || !o || o.length == 0)) { o = this._generatetriggersmarkup(this.length) } this.triggers = o; if (k.caption) { var m = h('
').css("z-index", this.length + 1).hide(); m.insertafter(this.content); this.caption = m; this.setcaption() } }, setcaption: function() { var k = this.settings, o = this.getactiveitem(), p = o.title, m = this.caption, l = { slow: 600, fast: 200, _default: 400 }, n = typeof k.speed == "number" ? k.speed: l[k.speed] || l[_default]; if (p) { if (p.substr(0, 1) == "#") { p = h(p).html() } if (m.is(":visible")) { later(function() { m.html(p) }, n) } else { m.html(p).stop().fadein(n) } } else { m.stop().fadeout(n) } }, _generatetriggersmarkup: function(k) { var l = this.settings, o = this.nav && this.nav.length ? this.nav: h('
'), n = [], m; for (m = 0; m < k; m++) { var p = this.getactiveitem(m); n.push("" + (l.controlthumbs ? '' + p.title + '': (m + 1)) + "") } o.html('
    ' + n.join("") + "
"); this.el.append(o); this.nav = o.find("ol"); return o.find("li") }, set_focus: function() { var k = h.ui.slide._focused(); if (k !== this) { a = this.get_index() } }, is_focused: function() { return a == this.get_index() }, destroy: function() { var k, m = this.get_index(), l = this; if (this.is_focused()) { for (k in b) { if (b.hasownproperty(k) && k != m) { b[k].set_focus(); break } } } if (m === a) { a = -1 } b[m] = null; delete b[m] } }; h.extend(h.ui.slide, { defaults: { auto: true, prefix: "switchable-", markuptype: 0, navcls: g + "nav", contentcls: g + "content", triggercls: "", panelcls: "", triggers: "", panels: "", hastriggers: true, controlthumbs: false, caption: false, steps: 1, interval: 3000, cur: "active", index: -1, evtype: "click", delay: 0.1, view: { width: 0, height: 0 }, prevbtncls: g + "prev-btn", nextbtncls: g + "next-btn", disablebtncls: g + "disable-btn", effect: "normal", direction: "x", speed: 1000, easing: "swing", circular: true, slices: 15, shutters: { cols: 8, rows: 4 }, pauseonhover: true, pauseonscroll: false, callback: {} }, _focused: function() { return b[a] || null } }); h.fn._reverse = [].reverse })(jquery);