﻿/* jquery.fufade.js 1.1
// chrismckee.co.uk // http://bit.ly/chrisisagit */
(function (a) {
    var c, d, f, h, l, m, o, p, n, j; a.fn.fuFade = function (b) { return this.each(function () { a.fuFade(this, b) }) }; a.fuFade = function (b, g) {
        c = { speed: "normal", type: "sequence", timeout: 2E3, containerheight: "auto", runningclass: "fufade", children: null }; g && a.extend(c, g); d = c.children === null ? a(b).children() : d = a(b).children(c.children); if (d.length > 1) {
            n = a(".nextbtn"); j = a(".backbtn"); a(b).css({ position: "relative", height: c.containerheight }).addClass(c.runningclass); for (f = 0; f < d.length; f++) a(d[f]).css({ "z-index": String(d.length -
f), position: "absolute"
            }).hide(); n.bind("click", function () { p = setTimeout(function () { a.fuFade.next(d, c, 1, 0, p) }, 0) }); j.fadeTo("fast", 0.5); if (c.type === "sequence") { setTimeout(function () { a.fuFade.next(d, c, 1, 0) }, c.timeout); a(d[0]).show() } else if (c.type === "random") { l = Math.floor(Math.random() * d.length); setTimeout(function () { do h = Math.floor(Math.random() * d.length); while (l === h); a.fuFade.next(d, c, h, l) }, c.timeout); a(d[l]).show() } else if (c.type === "random_start") {
                c.type = "sequence"; h = Math.floor(Math.random() * d.length);
                setTimeout(function () { a.fuFade.next(d, c, (h + 1) % d.length, h) }, c.timeout); a(d[h]).show()
            } else try { console.log("fuFade-Type must either be 'sequence' or 'random'") } catch (e) { } 
        } 
    }; a.fuFade.next = function (b, g, e, k, i) {
        clearTimeout(i); o = e === b.length - 1 ? 0 : e + 1; m = e === 0 ? b.length - 1 : m = e - 1; for (f = 0; f < b.length; f++) f !== k && f !== e && a(b[f]).css({ left: 0, top: 0, "z-index": "1" }).fadeOut(g.speed); a(b[k]).css("z-index", "190"); a(b[e]).css("z-index", "195"); n.unbind("click"); n.bind("click", function () {
            clearTimeout(i); a.fuFade.next(b, g,
o, e, i); return false
        }); j.unbind("click"); j.bind("click", function () { clearTimeout(i); a.fuFade.next(b, g, m, e, i); return false }); a(b[k]).fadeOut(g.speed); a(b[e]).fadeIn(g.speed, function () { a.fuFade.removeFilter(a(this)[0]) }); j.fadeTo("fast", 1); if (g.type === "sequence") if (e + 1 < b.length) { e += 1; k = e - 1 } else { e = 0; k = b.length - 1 } i = setTimeout(function () { a.fuFade.next(b, g, o, m, i) }, g.timeout)
    }; a.fuFade.removeFilter = function (b) { b.style.removeAttribute && b.style.removeAttribute("filter") } 
})(jQuery);
