﻿(function (d) { var a = "Lite-1.0"; d.fn.cycle = function (f) { return this.each(function () { f = f || {}; if (this.cycleTimeout) { clearTimeout(this.cycleTimeout) } this.cycleTimeout = 0; this.cyclePause = 0; var j = d(this); var k = f.slideExpr ? d(f.slideExpr, this) : j.children(); var h = k.get(); if (h.length < 2) { if (window.console && window.console.log) { window.console.log("terminating; too few slides: " + h.length) } return } var i = d.extend({}, d.fn.cycle.defaults, f || {}, d.metadata ? j.metadata() : d.meta ? j.data() : {}); i.before = i.before ? [i.before] : []; i.after = i.after ? [i.after] : []; i.after.unshift(function () { i.busy = 0 }); var g = this.className; i.width = parseInt((g.match(/w:(\d+)/) || [])[1]) || i.width; i.height = parseInt((g.match(/h:(\d+)/) || [])[1]) || i.height; i.timeout = parseInt((g.match(/t:(\d+)/) || [])[1]) || i.timeout; if (j.css("position") == "static") { j.css("position", "relative") } if (i.width) { j.width(i.width) } if (i.height && i.height != "auto") { j.height(i.height) } var l = 0; k.css({ position: "absolute", top: 0, left: 0 }).hide().each(function (n) { d(this).css("z-index", h.length - n) }); d(h[l]).css("opacity", 1).show(); if (d.browser.msie) { h[l].style.removeAttribute("filter") } if (i.fit && i.width) { k.width(i.width) } if (i.fit && i.height && i.height != "auto") { k.height(i.height) } if (i.pause) { j.hover(function () { this.cyclePause = 1 }, function () { this.cyclePause = 0 }) } d.fn.cycle.transitions.fade(j, k, i); k.each(function () { var n = d(this); this.cycleH = (i.fit && i.height) ? i.height : n.height(); this.cycleW = (i.fit && i.width) ? i.width : n.width() }); k.not(":eq(" + l + ")").css({ opacity: 0 }); if (i.cssFirst) { d(k[l]).css(i.cssFirst) } if (i.timeout) { if (i.speed.constructor == String) { i.speed = { slow: 600, fast: 200}[i.speed] || 400 } if (!i.sync) { i.speed = i.speed / 2 } while ((i.timeout - i.speed) < 250) { i.timeout += i.speed } } i.speedIn = i.speed; i.speedOut = i.speed; i.slideCount = h.length; i.currSlide = l; i.nextSlide = 1; var m = k[l]; if (i.before.length) { i.before[0].apply(m, [m, m, i, true]) } if (i.after.length > 1) { i.after[1].apply(m, [m, m, i, true]) } if (i.click && !i.next) { i.next = i.click } if (i.next) { d(i.next).bind("click", function () { return c(h, i, i.rev ? -1 : 1) }) } if (i.prev) { d(i.prev).bind("click", function () { return c(h, i, i.rev ? 1 : -1) }) } if (i.pager) { e(h, i) } if (i.timeout) { this.cycleTimeout = setTimeout(function () { b(h, i, 0, !i.rev) }, i.timeout + (i.delay || 0)) } }) }; function b(k, f, j, l) { if (f.busy) { return } var i = k[0].parentNode, n = k[f.currSlide], m = k[f.nextSlide]; if (i.cycleTimeout === 0 && !j) { return } if (j || !i.cyclePause) { if (f.before.length) { d.each(f.before, function (p, q) { q.apply(m, [n, m, f, l]) }) } var g = function () { if (d.browser.msie) { this.style.removeAttribute("filter") } d.each(f.after, function (p, q) { q.apply(m, [n, m, f, l]) }) }; if (f.nextSlide != f.currSlide) { f.busy = 1; d.fn.cycle.custom(n, m, f, g, j && f.fastOnEvent) } var h = (f.nextSlide + 1) == k.length; f.nextSlide = h ? 0 : f.nextSlide + 1; f.currSlide = h ? k.length - 1 : f.nextSlide - 1; if (f.pager) { d.fn.cycle.updateActivePagerLink(f.pager, f.currSlide) } } if (f.timeout) { i.cycleTimeout = setTimeout(function () { b(k, f, 0, !f.rev) }, f.timeout) } } d.fn.cycle.updateActivePagerLink = function (f, g) { d(f).find("a").removeClass("activeSlide").filter("a:eq(" + g + ")").addClass("activeSlide") }; function c(f, g, j) { var i = f[0].parentNode, h = i.cycleTimeout; if (h) { clearTimeout(h); i.cycleTimeout = 0 } g.nextSlide = g.currSlide + j; if (g.nextSlide < 0) { g.nextSlide = f.length - 1 } else { if (g.nextSlide >= f.length) { g.nextSlide = 0 } } b(f, g, 1, j >= 0); return false } function e(g, h) { var f = d(h.pager); d.each(g, function (j, k) { d.fn.cycle.createPagerAnchor(j, k, f, g, h) }); d.fn.cycle.updateActivePagerLink(h.pager, h.startingSlide) } d.fn.cycle.createPagerAnchor = function (k, l, h, j, m) { var g = (d.isFunction(m.pagerAnchorBuilder)) ? m.pagerAnchorBuilder(k, l) : '<a href="#">' + (k + 1) + "</a>"; if (!g) { return } var n = d(g); if (n.parents("body").length == 0) { var f = []; if (h.length > 1) { h.each(function () { var i = n.clone(true); d(this).append(i); f.push(i) }); n = d(f) } else { n.appendTo(h) } } n.bind(m.pagerEvent, function () { m.nextSlide = k; var o = j[0].parentNode, i = o.cycleTimeout; if (i) { clearTimeout(i); o.cycleTimeout = 0 } if (d.isFunction(m.pagerClick)) { m.pagerClick(m.nextSlide, j[m.nextSlide]) } b(j, m, 1, m.currSlide < k); return false }); if (m.pauseOnPagerHover) { n.hover(function () { j[0].parentNode.cyclePause++ }, function () { j[0].parentNode.cyclePause-- }) } }; d.fn.cycle.custom = function (m, i, k, f, j) { var l = d(m), h = d(i); h.css({ opacity: 0 }); var g = function () { h.animate({ opacity: 1 }, k.speedIn, k.easeIn, f) }; l.animate({ opacity: 0 }, k.speedOut, k.easeOut, function () { l.css({ display: "none" }); if (!k.sync) { g() } }); if (k.sync) { g() } }; d.fn.cycle.transitions = { fade: function (g, h, f) { h.not(":eq(0)").css("opacity", 0); f.before.push(function () { d(this).show() }) } }; d.fn.cycle.ver = function () { return a }; d.fn.cycle.defaults = { timeout: 4000, speed: 1000, next: null, prev: null, pager: null, pagerClick: null, pagerEvent: "click", pagerAnchorBuilder: null, before: null, after: null, height: "auto", startingSlide: 0, sync: 1, fit: 0, pause: 0, delay: 0, slideExpr: null, fastOnEvent: 0} })(jQuery);

