/*
* Slides, A Slideshow Plugin for jQuery
* Intructions: http://slidesjs.com
* By: Nathan Searles, http://nathansearles.com
* Version: 1.1.8
* Updated: June 1st, 2011
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
Modifed on 010911
1. Changed required images to 1
2. Removed the cachebuster from preload images
*/

(function(a) { a.fn.slides = function(b) { b = a.extend({}, a.fn.slides.option, b); return this.each(function() { function y() { if (b.pause) { clearTimeout(c.data("pause")); clearInterval(c.data("interval")); u = setTimeout(function() { clearTimeout(c.data("pause")); v = setInterval(function() { w("next", i) }, b.play); c.data("interval", v) }, b.pause); c.data("pause", u) } else { x() } } function x() { clearInterval(c.data("interval")) } function w(g, h, i) { if (!p && o) { p = true; b.animationStart(n + 1); switch (g) { case "next": l = n; k = n + 1; k = e === k ? 0 : k; r = f * 2; g = -f * 2; n = k; break; case "prev": l = n; k = n - 1; k = k === -1 ? e - 1 : k; r = 0; g = 0; n = k; break; case "pagination": k = parseInt(i, 10); l = a("." + b.paginationClass + " li." + b.currentClass + " a", c).attr("href").match("[^#/]+$"); if (k > l) { r = f * 2; g = -f * 2 } else { r = 0; g = 0 } n = k; break } if (h === "fade") { if (b.crossfade) { d.children(":eq(" + k + ")", c).css({ zIndex: 10 }).fadeIn(b.fadeSpeed, b.fadeEasing, function() { if (b.autoHeight) { d.animate({ height: d.children(":eq(" + k + ")", c).outerHeight() }, b.autoHeightSpeed, function() { d.children(":eq(" + l + ")", c).css({ display: "none", zIndex: 0 }); d.children(":eq(" + k + ")", c).css({ zIndex: 0 }); b.animationComplete(k + 1); p = false }) } else { d.children(":eq(" + l + ")", c).css({ display: "none", zIndex: 0 }); d.children(":eq(" + k + ")", c).css({ zIndex: 0 }); b.animationComplete(k + 1); p = false } }) } else { d.children(":eq(" + l + ")", c).fadeOut(b.fadeSpeed, b.fadeEasing, function() { if (b.autoHeight) { d.animate({ height: d.children(":eq(" + k + ")", c).outerHeight() }, b.autoHeightSpeed, function() { d.children(":eq(" + k + ")", c).fadeIn(b.fadeSpeed, b.fadeEasing) }) } else { d.children(":eq(" + k + ")", c).fadeIn(b.fadeSpeed, b.fadeEasing, function() { if (a.browser.msie) { a(this).get(0).style.removeAttribute("filter") } }) } b.animationComplete(k + 1); p = false }) } } else { d.children(":eq(" + k + ")").css({ left: r, display: "block" }); if (b.autoHeight) { d.animate({ left: g, height: d.children(":eq(" + k + ")").outerHeight() }, b.slideSpeed, b.slideEasing, function() { d.css({ left: -f }); d.children(":eq(" + k + ")").css({ left: f, zIndex: 5 }); d.children(":eq(" + l + ")").css({ left: f, display: "none", zIndex: 0 }); b.animationComplete(k + 1); p = false }) } else { d.animate({ left: g }, b.slideSpeed, b.slideEasing, function() { d.css({ left: -f }); d.children(":eq(" + k + ")").css({ left: f, zIndex: 5 }); d.children(":eq(" + l + ")").css({ left: f, display: "none", zIndex: 0 }); b.animationComplete(k + 1); p = false }) } } if (b.pagination) { a("." + b.paginationClass + " li." + b.currentClass, c).removeClass(b.currentClass); a("." + b.paginationClass + " li:eq(" + k + ")", c).addClass(b.currentClass) } } } a("." + b.container, a(this)).children().wrapAll('<div class="slides_control"/>'); var c = a(this), d = a(".slides_control", c), e = d.children().size(), f = d.children().outerWidth(), g = d.children().outerHeight(), h = b.start - 1, i = b.effect.indexOf(",") < 0 ? b.effect : b.effect.replace(" ", "").split(",")[0], j = b.effect.indexOf(",") < 0 ? i : b.effect.replace(" ", "").split(",")[1], k = 0, l = 0, m = 0, n = 0, o, p, q, r, s, t, u, v; if (e < 1) { return } if (h < 0) { h = 0 } if (h > e) { h = e - 1 } if (b.start) { n = h } if (b.randomize) { d.randomize() } a("." + b.container, c).css({ overflow: "hidden", position: "relative" }); d.children().css({ position: "absolute", top: 0, left: d.children().outerWidth(), zIndex: 0, display: "none" }); d.css({ position: "relative", width: f * 3, height: g, left: -f }); a("." + b.container, c).css({ display: "block" }); if (b.autoHeight) { d.children().css({ height: "auto" }); d.animate({ height: d.children(":eq(" + h + ")").outerHeight() }, b.autoHeightSpeed) } if (b.preload && d.find("img:eq(" + h + ")").length) { a("." + b.container, c).css({ background: "url(" + b.preloadImage + ") no-repeat 50% 50%" }); var z = d.find("img:eq(" + h + ")").attr("src"); if (a("img", c).parent().attr("class") != "slides_control") { t = d.children(":eq(0)")[0].tagName.toLowerCase() } else { t = d.find("img:eq(" + h + ")") } d.find("img:eq(" + h + ")").attr("src", z).load(function() { d.find(t + ":eq(" + h + ")").fadeIn(b.fadeSpeed, b.fadeEasing, function() { a(this).css({ zIndex: 5 }); a("." + b.container, c).css({ background: "" }); o = true; b.slidesLoaded() }) }) } else { d.children(":eq(" + h + ")").fadeIn(b.fadeSpeed, b.fadeEasing, function() { o = true; b.slidesLoaded() }) } if (b.bigTarget) { d.children().css({ cursor: "pointer" }); d.children().click(function() { w("next", i); return false }) } if (b.hoverPause && b.play) { d.bind("mouseover", function() { x() }); d.bind("mouseleave", function() { y() }) } if (b.generateNextPrev) { a("." + b.container, c).after('<a href="#" class="' + b.prev + '">Prev</a>'); a("." + b.prev, c).after('<a href="#" class="' + b.next + '">Next</a>') } a("." + b.next, c).click(function(a) { a.preventDefault(); if (b.play) { y() } w("next", i) }); a("." + b.prev, c).click(function(a) { a.preventDefault(); if (b.play) { y() } w("prev", i) }); if (b.generatePagination) { if (b.prependPagination) { c.prepend("<ul class=" + b.paginationClass + "></ul>") } else { c.append("<ul class=" + b.paginationClass + "></ul>") } d.children().each(function() { a("." + b.paginationClass, c).append('<li><a href="#' + m + '">' + (m + 1) + "</a></li>"); m++ }) } else { a("." + b.paginationClass + " li a", c).each(function() { a(this).attr("href", "#" + m); m++ }) } a("." + b.paginationClass + " li:eq(" + h + ")", c).addClass(b.currentClass); a("." + b.paginationClass + " li a", c).click(function() { if (b.play) { y() } q = a(this).attr("href").match("[^#/]+$"); if (n != q) { w("pagination", j, q) } return false }); a("a.link", c).click(function() { if (b.play) { y() } q = a(this).attr("href").match("[^#/]+$") - 1; if (n != q) { w("pagination", j, q) } return false }); if (b.play) { v = setInterval(function() { w("next", i) }, b.play); c.data("interval", v) } }) }; a.fn.slides.option = { preload: false, preloadImage: "/img/loading.gif", container: "slides_container", generateNextPrev: false, next: "next", prev: "prev", pagination: true, generatePagination: true, prependPagination: false, paginationClass: "pagination", currentClass: "current", fadeSpeed: 350, fadeEasing: "", slideSpeed: 350, slideEasing: "", start: 1, effect: "slide", crossfade: false, randomize: false, play: 0, pause: 0, hoverPause: false, autoHeight: false, autoHeightSpeed: 350, bigTarget: false, animationStart: function() { }, animationComplete: function() { }, slidesLoaded: function() { } }; a.fn.randomize = function(b) { function c() { return Math.round(Math.random()) - .5 } return a(this).each(function() { var d = a(this); var e = d.children(); var f = e.length; if (f > 1) { e.hide(); var g = []; for (i = 0; i < f; i++) { g[g.length] = i } g = g.sort(c); a.each(g, function(a, c) { var f = e.eq(c); var g = f.clone(true); g.show().appendTo(d); if (b !== undefined) { b(f, g) } f.remove() }) } }) } })(jQuery)

jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend(jQuery.easing,
{
    def: 'easeOutQuad',
    swing: function(x, t, b, c, d) {
        //alert(jQuery.easing.default);
        return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
    },
    easeInQuad: function(x, t, b, c, d) {
        return c * (t /= d) * t + b;
    },
    easeOutQuad: function(x, t, b, c, d) {
        return -c * (t /= d) * (t - 2) + b;
    },
    easeInOutQuad: function(x, t, b, c, d) {
        if ((t /= d / 2) < 1) return c / 2 * t * t + b;
        return -c / 2 * ((--t) * (t - 2) - 1) + b;
    },
    easeInCubic: function(x, t, b, c, d) {
        return c * (t /= d) * t * t + b;
    },
    easeOutCubic: function(x, t, b, c, d) {
        return c * ((t = t / d - 1) * t * t + 1) + b;
    },
    easeInOutCubic: function(x, t, b, c, d) {
        if ((t /= d / 2) < 1) return c / 2 * t * t * t + b;
        return c / 2 * ((t -= 2) * t * t + 2) + b;
    },
    easeInQuart: function(x, t, b, c, d) {
        return c * (t /= d) * t * t * t + b;
    },
    easeOutQuart: function(x, t, b, c, d) {
        return -c * ((t = t / d - 1) * t * t * t - 1) + b;
    },
    easeInOutQuart: function(x, t, b, c, d) {
        if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b;
        return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
    },
    easeInQuint: function(x, t, b, c, d) {
        return c * (t /= d) * t * t * t * t + b;
    },
    easeOutQuint: function(x, t, b, c, d) {
        return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
    },
    easeInOutQuint: function(x, t, b, c, d) {
        if ((t /= d / 2) < 1) return c / 2 * t * t * t * t * t + b;
        return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;
    },
    easeInSine: function(x, t, b, c, d) {
        return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;
    },
    easeOutSine: function(x, t, b, c, d) {
        return c * Math.sin(t / d * (Math.PI / 2)) + b;
    },
    easeInOutSine: function(x, t, b, c, d) {
        return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;
    },
    easeInExpo: function(x, t, b, c, d) {
        return (t == 0) ? b : c * Math.pow(2, 10 * (t / d - 1)) + b;
    },
    easeOutExpo: function(x, t, b, c, d) {
        return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
    },
    easeInOutExpo: function(x, t, b, c, d) {
        if (t == 0) return b;
        if (t == d) return b + c;
        if ((t /= d / 2) < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
        return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;
    },
    easeInCirc: function(x, t, b, c, d) {
        return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;
    },
    easeOutCirc: function(x, t, b, c, d) {
        return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;
    },
    easeInOutCirc: function(x, t, b, c, d) {
        if ((t /= d / 2) < 1) return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;
        return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;
    },
    easeInElastic: function(x, t, b, c, d) {
        var s = 1.70158; var p = 0; var a = c;
        if (t == 0) return b; if ((t /= d) == 1) return b + c; if (!p) p = d * .3;
        if (a < Math.abs(c)) { a = c; var s = p / 4; }
        else var s = p / (2 * Math.PI) * Math.asin(c / a);
        return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
    },
    easeOutElastic: function(x, t, b, c, d) {
        var s = 1.70158; var p = 0; var a = c;
        if (t == 0) return b; if ((t /= d) == 1) return b + c; if (!p) p = d * .3;
        if (a < Math.abs(c)) { a = c; var s = p / 4; }
        else var s = p / (2 * Math.PI) * Math.asin(c / a);
        return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;
    },
    easeInOutElastic: function(x, t, b, c, d) {
        var s = 1.70158; var p = 0; var a = c;
        if (t == 0) return b; if ((t /= d / 2) == 2) return b + c; if (!p) p = d * (.3 * 1.5);
        if (a < Math.abs(c)) { a = c; var s = p / 4; }
        else var s = p / (2 * Math.PI) * Math.asin(c / a);
        if (t < 1) return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
        return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b;
    },
    easeInBack: function(x, t, b, c, d, s) {
        if (s == undefined) s = 1.70158;
        return c * (t /= d) * t * ((s + 1) * t - s) + b;
    },
    easeOutBack: function(x, t, b, c, d, s) {
        if (s == undefined) s = 1.70158;
        return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
    },
    easeInOutBack: function(x, t, b, c, d, s) {
        if (s == undefined) s = 1.70158;
        if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b;
        return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;
    },
    easeInBounce: function(x, t, b, c, d) {
        return c - jQuery.easing.easeOutBounce(x, d - t, 0, c, d) + b;
    },
    easeOutBounce: function(x, t, b, c, d) {
        if ((t /= d) < (1 / 2.75)) {
            return c * (7.5625 * t * t) + b;
        } else if (t < (2 / 2.75)) {
            return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b;
        } else if (t < (2.5 / 2.75)) {
            return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b;
        } else {
            return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b;
        }
    },
    easeInOutBounce: function(x, t, b, c, d) {
        if (t < d / 2) return jQuery.easing.easeInBounce(x, t * 2, 0, c, d) * .5 + b;
        return jQuery.easing.easeOutBounce(x, t * 2 - d, 0, c, d) * .5 + c * .5 + b;
    }
});
