/**
* --------------------------------------------------------------------
* jQuery-Plugin "Image Cross-Fader"
* http://code.google.com/p/jquery-imagecrossfader/
* Version: 1.2.0, 2009-08-27
* by Christophe DELIENS (G2F - GET2FUTURE)
* 
* http://twitter.com/cdeli
* chris[at]g2f[dot]be
*
* Copyright (c) 2009 Christophe DELIENS
* Licensed under the MIT Licence (http://www.opensource.org/licenses/mit-license.php)
*/
(function (v) { var x = null; var A = Array(); var u = 0; var y = 0; var C = 0; var s = false; var z = null; var t = null; var B = false; var w = null; v.fn.imageCrossFader = function (a) { z = v.extend(v.fn.imageCrossFader.defaults, a); return this.each(function () { t = v(this); var d = t.find("ul li"); var e = d.size(); A = Array(e); t.empty().show(); if (z.pauseOnHover) { t.parent().mouseenter(function () { if (!s) { t.parent().find(".slideShowCaptionWrapper").stop(1, 1); t.find(".slideShowCaptionWrapper").show("slide", { direction: z.captionInDirection }, 400) } s = true; q() }).mouseleave(function (f) { if (f.pageY >= 0) { s = false; p(); t.find(".slideShowCaptionWrapper").hide("slide", { direction: z.captionOutDirection }, 2000) } }) } if (z.index) { var b = v("<div></div>").attr("class", "index").appendTo(t) } for (i = 0; i < e; ++i) { var c = v(d[i]).html(); A[i] = c; if (z.index) { v("<p></p>").text(i + 1).attr("rel", i).click(function () { r(parseInt(v(this).attr("rel"))); return false }).appendTo(v(b)) } } r(0) }) }; v.fn.imageCrossFader.defaults = { fadeIn: 600, fadeOut: 200, delay: 3000, pauseOnHover: true, captionInDirection: "down", captionOutDirection: "down", index: false, showPrevNextButtons: x }; function r(d) { q(); if (z.index) { t.find("div.index p").removeClass("selected"); t.find("div.index p[rel=" + d + "]").addClass("selected") } t.find("div.item").fadeOut(z.fadeOut, function () { v(this).remove() }); v("<div></div>").attr("class", "item").append(A[d]).appendTo(t).fadeIn(z.fadeIn); if (z.title) { var b = null; var e = v(A[d]); if (!e.is("img")) { if (e.is("a")) { b = e.attr("href") } else { if (e.find("a")) { b = e.find("a").attr("href") } } e = e.find("img") } var c = e.attr("alt"); switch (typeof (z.title)) { case "function": z.title(c, b); break; case "object": z.title.text(c); break } } u = d + 1; y = d - 1; if (u >= A.length) { u = 0 } if (y < 0) { y = A.length - 1 } if (z.showPrevNextButtons) { if (t.find(".slideShowCaptionWrapper").length > 0) { t.find(".slideShowCaptionWrapper").remove() } var a = t.find(".slideShowCaption"); t.find(".slideShowCaption").remove(); var f = t.append('<div class="slideShowCaptionWrapper"><div class="navigation"><a onclick="return false;" class="previousItem"></a><a onclick="return false;" class="nextItem"></a></div><div class="slideShowCaption">' + a.html() + "</div></div>"); t.parent().find(".nextItem").click(function () { r(u) }); t.parent().find(".previousItem").click(function () { r(y) }) } if (!s) { p() } else { t.parent().find(".slideShowCaptionWrapper").show() } } function p() { x = window.setTimeout(function () { r(u) }, z.delay) } function q() { if (x != null) { window.clearTimeout(x) } } })(jQuery);
