(function (bluebSlide)
{
    function slideContents(effSty, C)
    {
        function btnSlideController()
        {
            bluebSlide('<div class="slideCont"></div>').appendTo(u).addClass("btnSlidePause").css("opacity", 
            0).mouseover(function ()
            {
                bluebSlide(this).stop().css("opacity", 1)
            }).click(function ()
            {
                if (bluebSlide(this).hasClass("btnSlidePause"))
                {
                    bluebSlide(this).removeClass("btnSlidePause").addClass("btnSlidePlay");
                    D = "pause";
                    y && clearTimeout(y)
                }
                else if (bluebSlide(this).hasClass("btnSlidePlay"))
                {
                    bluebSlide(this).removeClass("btnSlidePlay").addClass("btnSlidePause");
                    D = "play";
                    M()
                }
            })
        }
        function sidearrow()
        {
            var b = bluebSlide('<div class="btnArrwoNav"></div>').appendTo(u);
            bluebSlide('<a class="left-arrow"></a>').css("opacity", 0).mouseover(function ()
            {
                bluebSlide(this).stop().css("opacity", 1)
            }).click(function ()
            {
                K()
            }).appendTo(b);
            bluebSlide('<a class="right-arrow"></a>').css("opacity", 0).mouseover(function ()
            {
                bluebSlide(this).stop().css("opacity", 1)
            }).click(function ()
            {
                L()
            }).appendTo(b)
        }
        function btnNavigation()
        {
            for (var b = w.length, d = bluebSlide('<!--<div class="btnNav"></div>-->').appendTo(u), e = 0; e < b; e++)
            {
                bluebSlide('<a rel="' + e + '"></a>').appendTo(d).bind(
                {
                    mouseover : function ()
                    {
                        var f = bluebSlide(this).attr("rel");
                        bluebSlide(this).hasClass("select") || bluebSlide(this).addClass("over");
                        j.settings.visibleThum && Wthum(f)
                    },
                    mouseout : function ()
                    {
                        bluebSlide(this).hasClass("select") || bluebSlide(this).removeClass("over");
                        j.settings.visibleThum && Xthum()
                    },
                    click : function ()
                    {
                        z || btnSelect(parseInt(bluebSlide(this).attr("rel")))
                    }
                })
            }
            if (j.settings.bottomPagenationCenter) {
                b = (j.settings.width - d.outerWidth()) / 2;
                d.css("left", b)
            }
        }
        function Wthum(b)
        {
            if (w[b].thumbnail)
            {
                var d = u.find(".btnNav a").eq(b), e = w[b].thumbnail, f = bluebSlide('<div class="thumbnail"></div>').appendTo(u.find(".btnNav"));
                b = parseInt(d.position().left) - (parseInt(f.outerWidth(true)) - parseInt(d.css("width"))) / 2;
                d = parseInt(d.position().top) - parseInt(f.outerHeight(true));
                f.css({
                    left : b, top : d - j.settings.thumbnailSlide, opacity : 0
                });
                bluebSlide("<img/>").load(function ()
                {
                    f.css("background-image", "url(" + e + ")")
                }).attr("src", e);
                f.animate({
                    top : d, opacity : 1
                },
                j.settings.thumbnailDuration)
            }
        }
        function Xthum()
        {
            var b = u.find(".btnNav .thumbnail");
            b && b.animate({
                top : parseInt(b.css("top")) - j.settings.thumbnailSlide, opacity : 0
            },
            j.settings.thumbnailDuration, function ()
            {
                b.remove()
            })
        }
        function btnSelect(b)
        {
            if (!z)
            {
                j.settings.slideshow && y && clearTimeout(y);
                z = true;
                N = v;
                v = b;
                var d = w[v];
                O();
                bluebSlide("<img/>").load(function ()
                {
                    d.width = bluebSlide(this).attr("width");
                    d.height = bluebSlide(this).attr("height");
                    Preload();
                    Y()
                }).attr("src", d.path);
                if (j.settings.bottomPagenation)
                {
                    var e = u.find(".btnNav");
                    e.find(".select").attr("class", "out");
                    e.find("a").eq(b).attr("class", "select")
                }
                b = {
                    type : "slideOpen", index : v, data : w[v]
                };
                bluebSlide.isFunction(j.settings.slideOpen) && j.settings.slideOpen.call(this, b)
            }
        }
        function L()
        {
            z || btnSelect(v == w.length - 1 ? 0 : v + 1)
        }
        function K()
        {
            z || btnSelect(v == 0 ? w.length - 1 : v - 1)
        }
        function O()
        {
            var b = bluebSlide('<div class="preloader"></div>').hide().fadeIn(300).appendTo(u), d = (j.settings.width - parseInt(b.css("width"))) * 0.5, 
            e = (j.settings.height - parseInt(b.css("height"))) * 0.5;
            b.css({
                left : d, top : e
            })
        }
        function Preload()
        {
            u.find(".preloader").remove()
        }
        function Y()
        {
            var b = w[v];
            if (u.find(".slide").length)
            {
                var d = u.find(".slide").css("z-index");
                H = u.find(".slide").css("z-index", d - 1);
                d = w[N].width;
                var e = w[N].height, f = b.width, g = b.height;
                if (f < j.settings.width && f < d || g < j.settings.height && g < e) {
                    H.fadeOut(300)
                }
            }
            A = bluebSlide('<div class="slide"></div>').appendTo(u);
            A.bind(
            {
                mouseover : function ()
                {
                    u.find(".btnArrwoNav a").stop().animate({
                        opacity : 1
                    }, 500);
                    j.settings.slideshowControls && u.find(".slideCont").stop().animate({
                        opacity : 1
                    }, 500);
                    var F = {
                        type : "slideMouseOver", index : v, data : b
                    };
                    bluebSlide.isFunction(j.settings.slideMouseOver) && j.settings.slideMouseOver.call(this, 
                    F)
                },
                mouseout : function ()
                {
                    u.find(".btnArrwoNav a").stop().animate({
                        opacity : 0
                    }, 500);
                    j.settings.slideshowControls && u.find(".slideCont").stop().animate({
                        opacity : 0
                    }, 500);
                    var F = {
                        type : "slideMouseOut", index : v, data : b
                    };
                    bluebSlide.isFunction(j.settings.slideMouseOut) && j.settings.slideMouseOut.call(this, 
                    F)
                },
                click : function ()
                {
                    var F = {
                        type : "slideClick", index : v, data : b
                    };
                    bluebSlide.isFunction(j.settings.slideClick) && j.settings.slideClick.call(this, F)
                }
            });
            var c = b.properties, a = c.alignType, h = parseInt(c.HSlices), q = parseInt(c.VSlices), n = c.slicePattern;
            d = c.effectStyle;
            e = c.slicePoint;
            f = c.slideStartPosition;
            g = parseFloat(c.slideStartRatio);
            var o = parseInt(c.sliceDuration);
            c = parseInt(c.sliceDelay);
            var p = Math.floor(Math.min(b.width, j.settings.width) / h), k = Math.floor(Math.min(b.height, 
            j.settings.height) / q), m = b.width > j.settings.width ? Q(a, b.width, j.settings.width) : 0, 
            r = b.height > j.settings.height ? R(a, b.height, j.settings.height) : 0, s = b.width < j.settings.width ? Math.floor((j.settings.width - b.width) / 2) : 0, 
            t = b.height < j.settings.height ? Math.floor((j.settings.height - b.height) / 2) : 0, B = [];
            for (a = 0; a < h; a++)
            {
                for (var G = 0; G < q; G++)
                {
                    var Z = bluebSlide('<div class="slice"></div>').css(
                    {
                        "background-image" : "url(" + b.path + ")", "background-position" :- (a * p + m) + "px " +- (G * k + r) + "px", 
                        "background-repeat" : "no-repeat", left : a * p + s, top : G * k + t, width : p, 
                        height : k, opacity : 0
                    }).data({
                        hPos : a, vPos : G
                    }).appendTo(A);
                    B.push(Z)
                }
                if (d == "random") {
                    d = I(["scale", "width", "height", "slide", "fade"]);
                }
            }
            if (n == "random")
            {
                n = I(["randomPattern", "topToBottom", "bottomToTop", "leftToRight", "rightToLeft", "topLeftToBottomRight", 
                "topRightToBottomLeft", "bottomLeftToTopRight", "bottomRightToTopLeft", "horizontalMarginToCenter", 
                "horizontalCenterToMargin", "marginToCenter", "verticalCenterToMargin", "skipOneTopToBottom", 
                "skipOneBottomToTop", "skipOneLeftToRight", "skipOneRightToLeft", "skipOneHorizontal", 
                "skipOneVertical", "spiralMarginToCenterCW", "spiralMarginToCenterCCW", "spiralCenterToMarginCW", 
                "spiralCenterToMarginCCW"])
            }
            if (e == "random")
            {
                e = I(["leftTop", "leftCenter", "leftBottom", "centerTop", "centerCenter", "centerBottom", 
                "rightTop", "rightCenter", "rightBottom"])
            }
            if (f == "random")
            {
                f = I(["left", "right", "top", "bottom", "leftTop", "rightTop", "leftBottom", "horizontalAlternative", 
                "verticalAlternative"])
            }
            h = $(B, n, h, q);
            q = h.length;
            for (a = 0; a < q; a++) {
                aa(h[a], a, q, d, e, f, g, o, c)
            }
            ba();
            d = {
                type : "transitionStart", index : v, data : b
            };
            bluebSlide.isFunction(j.settings.transitionStart) && j.settings.transitionStart.call(this, 
            d)
        }
        function ca()
        {
            var b = w[v], d = b.properties.alignType, e = Q(d, b.width, j.settings.width);
            d = R(d, b.height, j.settings.height);
            z = false;
            A.find(".slice").remove();
            A.css(
            {
                "background-image" : "url(" + b.path + ")", "background-position" :- e + "px " +- d + "px", 
                "background-repeat" : "no-repeat"
            });
            if (b.link) {
                A.css("cursor", "pointer");
                A.click(function ()
                {
//                    window.open(b.link)
						// parent.location.href = b.link;
						location.href = b.link;
                })
            }
            H && H.remove();
            j.settings.slideshow && D != "pause" && M();
            b.caption && da(b.caption);
            e = {
                type : "transitionComplete", index : v, data : b
            };
            bluebSlide.isFunction(j.settings.transitionComplete) && j.settings.transitionComplete.call(this, 
            e)
        }
        function I(b)
        {
            return b[Math.floor(Math.random() * b.length)]
        }
        function da(b)
        {
            var d = w[v], e = d.properties, f = e.captionPosition, g = e.captionSize;
            e = e.captionSlideDuration;
            var c = Math.min(d.width, j.settings.width);
            d = Math.min(d.height, j.settings.height);
            var a = (j.settings.width - c) / 2, h = (j.settings.height - d) / 2, q = bluebSlide('<div class="caption-container"></div>').appendTo(u), 
            n = bluebSlide('<div class="caption"></div>').appendTo(q);
            bluebSlide("<p></p>").html(b).appendTo(n);
            b = {};
            switch (f)
            {
                case "left":
                    q.css({
                        width : g, height : d, left : a, top : h
                    });
                    n.css({
                        width : "100%", height : "100%", left :- g, top : 0
                    });
                    b.left = 0;
                    break;
                case "right":
                    q.css({
                        width : g, height : d, right : a, top : h
                    });
                    n.css({
                        width : "100%", height : "100%", right :- g, top : 0
                    });
                    if (bluebSlide.browser.opera) {
                        b.left = 0
                    }
                    else {
                        b.right = 0
                    }
                    break;
                case "top":
                    q.css({
                        width : c, height : g, left : a, top : h
                    });
                    n.css({
                        width : "100%", height : "100%", left : 0, top :- g
                    });
                    b.top = 0;
                    break;
                case "bottom":
                    q.css({
                        width : c, height : g, left : a, bottom : h
                    });
                    n.css({
                        width : "100%", height : "100%", left : 0, bottom :- g
                    });
                    if (bluebSlide.browser.opera) {
                        b.top = 0
                    }
                    else {
                        b.bottom = 0
                    }
                    break;
                default:
                    q.css({
                        width : g, height : d, left : a, top : h
                    });
                    n.css({
                        width : "100%", height : "100%", left :- g, top : 0
                    });
                    b.left = 0
            }
            n.animate(b, e)
        }
        function ba()
        {
            var b = u.find(".caption-container");
            b && b.find(".caption").animate({
                opacity : 0
            },
            300, function ()
            {
                b.remove()
            })
        }
        function M()
        {
            y = setTimeout(function ()
            {
                if (j.settings.slideshowDirection == "next") {
                    L()
                }
                else {
                    j.settings.slideshowDirection == "previous" && K()
                }
            },
            w[v].properties.slideshowDelay || j.settings.slideshowDelay)
        }
        function Q(b, d, e)
        {
            var f = 0;
            if (b == "centerTop" || b == "centerCenter" || b == "centerBottom") {
                f = Math.floor((d - e) / 2)
            }
            else if (b == "rightTop" || b == "rightCenter" || b == "rightBottom") {
                f = d - e
            }
            return f
        }
        function R(b, d, e)
        {
            var f = 0;
            if (b == "leftCenter" || b == "centerCenter" || b == "rightCenter") {
                f = Math.floor((d - e) / 2)
            }
            else if (b == "leftBottom" || b == "centerBottom" || b == "rightBottom") {
                f = d - e
            }
            return f
        }
        function aa(b, d, e, f, g, c, a, h, q)
        {
            var n = {}, o = {}, p = parseInt(b.css("width")), k = parseInt(b.css("height")), m = parseInt(b.css("left")), 
            r = parseInt(b.css("top")), s, t, B = j.settings.sliceFade == true ? 0 : 1;
            if (f == "scale" || f == "width" || f == "height")
            {
                switch (g)
                {
                    case "centerCenter":
                        t = r + k * 0.5;
                        s = m + p * 0.5;
                        break;
                    case "rightCenter":
                        t = r + k * 0.5;
                        s = m + p;
                        break;
                    case "leftCenter":
                        t = r + k * 0.5;
                        s = m;
                        break;
                    case "centerTop":
                        t = r;
                        s = m + p * 0.5;
                        break;
                    case "rightTop":
                        t = r;
                        s = m + p;
                        break;
                    case "leftTop":
                        t = r;
                        s = m;
                        break;
                    case "centerBottom":
                        t = r + k;
                        s = m + p * 0.5;
                        break;
                    case "rightBottom":
                        t = r + k;
                        s = m + p;
                        break;
                    case "leftBottom":
                        t = r + k;
                        s = m;
                        break;
                    default:
                        t = r + k * 0.5;
                        s = m + p * 0.5;
                }
            }
            else if (f == "slide")
            {
                switch (c)
                {
                    case "left":
                        t = r;
                        s = m - p * a;
                        break;
                    case "right":
                        t = r;
                        s = m + p * a;
                        break;
                    case "top":
                        t = r - k * a;
                        s = m;
                        break;
                    case "bottom":
                        t = r + k * a;
                        s = m;
                        break;
                    case "leftTop":
                        t = r - k * a;
                        s = m - p * a;
                        break;
                    case "rightTop":
                        t = r - k * a;
                        s = m + p * a;
                        break;
                    case "leftBottom":
                        t = r + k * a;
                        s = m - p * a;
                        break;
                    case "rightBottom":
                        t = r + k * a;
                        s = m + p * a;
                        break;
                    case "horizontalAlternative":
                        t = r;
                        s = m + p * a * (d % 2 == 0 ? 1 :- 1);
                        break;
                    case "verticalAlternative":
                        t = r + k * a * (d % 2 == 0 ? 1 :- 1);
                        s = m;
                        break;
                    default:
                        t = r;
                        s = m - p * a;
                }
            }
            switch (f)
            {
                case "fade":
                    o = {
                        opacity : 1
                    };
                    break;
                case "scale":
                    n = {
                        width : 0, height : 0, left : s, top : t, opacity : B
                    };
                    o = {
                        width : p, height : k, left : m, top : r, opacity : 1
                    };
                    break;
                case "width":
                    n = {
                        width : 0, left : s, opacity : B
                    };
                    o = {
                        width : p, left : m, opacity : 1
                    };
                    break;
                case "height":
                    n = {
                        height : 0, top : t, opacity : B
                    };
                    o = {
                        height : k, top : r, opacity : 1
                    };
                    break;
                case "slide":
                    n = {
                        left : s, top : t, opacity : B
                    };
                    o = {
                        left : m, top : r, opacity : 1
                    };
                    break;
                default:
                    o = {
                        opacity : 1
                    }
            }
            b.css(n);
            setTimeout(function ()
            {
                b.animate(o, h, function ()
                {
                    d == e - 1 && ca()
                })
            },
            d * q)
        }
        function $(b, d, e, f)
        {
            var g = [], c, a, h = 0;
            switch (d)
            {
                case "randomPattern":
                    for (e = []; b.length; ) {
                        h = Math.floor(Math.random() * b.length);
                        e.push(b[h]);
                        b.splice(h, 1)
                    }
                    var q = e.length;
                    for (d = 0; d < q; d++) {
                        g[d] = e[d]
                    }
                    break;
                case "topToBottom":
                    for (a = 0; a < f; a++) {
                        for (c = 0; c < e; c++) {
                            g.push(i(b, c, a))
                        }
                    }
                    break;
                case "bottomToTop":
                    for (a = f - 1; a >= 0; a--) {
                        for (c = e - 1; c >= 0; c--) {
                            g.push(i(b, c, a))
                        }
                    }
                    break;
                case "rightToLeft":
                    for (c = e - 1; c >= 0; c--) {
                        for (a = f - 1; a >= 0; a--) {
                            g.push(i(b, c, a))
                        }
                    }
                    break;
                case "leftToRight":
                    for (c = 0; c < e; c++) {
                        for (a = 0; a < f; a++) {
                            g.push(i(b, c, a))
                        }
                    }
                    break;
                case "topLeftToBottomRight":
                    for (d = 0; d < e + f - 1; d++) {
                        a = 0;
                        for (c = d; c >= 0; c--) {
                            i(b, c, a) != undefined && g.push(i(b, c, a));
                            a++
                        }
                    }
                    break;
                case "bottomLeftToTopRight":
                    h = e > f ? e : f;
                    for (d = e - 1; d >= 1 - h; d--) {
                        c = 0;
                        for (a = d; a <= e - 1; a++) {
                            i(b, c, a) != undefined && g.push(i(b, c, a));
                            c++
                        }
                    }
                    break;
                case "topRightToBottomLeft":
                    h = e > f ? e : f;
                    for (d = e - 1; d >= 1 - h; d--) {
                        c = d;
                        for (a = 0; a <= f - 1; a++) {
                            i(b, c, a) != undefined && g.push(i(b, c, a));
                            c++
                        }
                    }
                    break;
                case "bottomRightToTopLeft":
                    for (d = f + e - 2; d >= 0; d--) {
                        a = 0;
                        for (c = d; c >= 0; c--) {
                            i(b, c, a) != undefined && g.push(i(b, c, a));
                            a++
                        }
                    }
                    break;
                case "horizontalMarginToCenter":
                    if (e % 2)
                    {
                        for (c = 0; a < Math.floor(e / 2); c++)
                        {
                            for (a = 0; a < f; a++) {
                                g.push(i(b, c, a));
                                g.push(i(b, e - 1 - c, a))
                            }
                            for (d = 0; d < f; d++) {
                                g.push(i(b, Math.floor(e / 2), d))
                            }
                        }
                    }
                    else {
                        for (c = 0; c < e / 2; c++) {
                            for (a = 0; a < f; a++) {
                                g.push(i(b, c, a));
                                g.push(i(b, e - 1 - c, a))
                            }
                            break
                        }
                    }
                case "horizontalCenterToMargin":
                    if (e % 2) {
                        for (d = 0; d < f; d++) {
                            g.push(i(b, Math.floor(e / 2), d))
                        }
                    }
                    for (c = Math.floor(e / 2) - 1; c >= 0; c--) {
                        for (a = 0; a < f; a++) {
                            g.push(i(b, c, a));
                            g.push(i(b, e - 1 - c, a))
                        }
                        break
                    }
                case "verticalMarginToCenter":
                    if (f % 2)
                    {
                        for (a = 0; a < Math.floor(f / 2); a++)
                        {
                            for (c = 0; c < e; c++) {
                                g.push(i(b, c, a));
                                g.push(i(b, c, f - 1 - a))
                            }
                            for (d = 0; d < e; d++) {
                                g.push(i(b, d, Math.floor(f / 2)))
                            }
                        }
                    }
                    else
                    {
                        for (a = 0; a < Math.floor(f / 2); a++) {
                            for (c = 0; c < e; c++) {
                                g.push(i(b, c, a));
                                g.push(i(b, c, f - 1 - a))
                            }
                            break
                        }
                    }
                case "verticalCenterToMargin":
                    if (f % 2) {
                        for (d = 0; d < e; d++) {
                            g.push(i(b, d, Math.floor(f / 2)))
                        }
                    }
                    for (a = Math.floor(f / 2) - 1; a >= 0; a--) {
                        for (c = 0; c < e; c++) {
                            g.push(i(b, c, a));
                            g.push(i(b, c, f - 1 - a))
                        }
                        break
                    }
                case "skipOneTopToBottom":
                    for (a = 0; a < f; a++) {
                        for (c = h; c < e; c += 2) {
                            g.push(i(b, c, a))
                        }
                        h == 0 ? h = 1 : h = 0
                    }
                    h = 1;
                    for (a = 0; a < f; a++) {
                        for (c = h; c < e; c += 2) {
                            g.push(i(b, c, a))
                        }
                        h == 0 ? h = 1 : h = 0
                    }
                    break;
                case "skipOneBottomToTop":
                    for (a = f - 1; a >= 0; a--) {
                        for (c = h; c < e; c += 2) {
                            g.push(i(b, c, a))
                        }
                        h == 0 ? h = 1 : h = 0
                    }
                    h = 1;
                    for (a = f - 1; a >= 0; a--) {
                        for (c = h; c < e; c += 2) {
                            g.push(i(b, c, a))
                        }
                        h == 0 ? h = 1 : h = 0
                    }
                    break;
                case "skipOneLeftToRight":
                    for (c = 0; c < e; c++) {
                        for (a = h; a < f; a += 2) {
                            g.push(i(b, c, a))
                        }
                        h == 0 ? h = 1 : h = 0
                    }
                    h = 1;
                    for (c = 0; c < e; c++) {
                        for (a = h; a < f; a += 2) {
                            g.push(i(b, c, a))
                        }
                        h == 0 ? h = 1 : h = 0
                    }
                    break;
                case "skipOneRightToLeft":
                    for (c = e - 1; c >= 0; c--) {
                        for (a = h; a < f; a += 2) {
                            g.push(i(b, c, a))
                        }
                        h == 0 ? h = 1 : h = 0
                    }
                    h = 1;
                    for (c = e - 1; c >= 0; c--) {
                        for (a = h; a < f; a += 2) {
                            g.push(i(b, c, a))
                        }
                        h == 0 ? h = 1 : h = 0
                    }
                    break;
                case "skipOneVertical":
                    if (f % 2)
                    {
                        for (a = 0; a < f; a++)
                        {
                            for (c = h; c < e; c += 2)
                            {
                                if (a == Math.floor(f / 2))
                                {
                                    a++;
                                    for (d = 1 - e % 2; d < e; d += 2)
                                    {
                                        g.push(i(b, d, Math.floor(f / 2)));
                                        i(b, d - 1, Math.floor(f / 2)) != undefined && g.push(i(b, d - 1, 
                                        Math.floor(f / 2)))
                                    }
                                }
                                g.push(i(b, c, a));
                                g.push(i(b, c, f - a - 1))
                            }
                            h == 0 ? h = 1 : h = 0;
                        }
                    }
                    else
                    {
                        for (a = 0; a < f; a++) {
                            for (c = h; c < e; c += 2) {
                                g.push(i(b, c, a));
                                g.push(i(b, c, f - a - 1))
                            }
                            h == 0 ? h = 1 : h = 0
                        }
                        break
                    }
                case "skipOneHorizontal":
                    if (e % 2)
                    {
                        for (c = 0; c < e; c++)
                        {
                            for (a = h; a < f; a += 2)
                            {
                                if (c == Math.floor(e / 2))
                                {
                                    c++;
                                    for (d = 1 - f % 2; d < f; d += 2)
                                    {
                                        g.push(i(b, Math.floor(e / 2), d));
                                        i(b, Math.floor(e / 2), d - 1) != undefined && g.push(i(b, Math.floor(e / 2), 
                                        d - 1))
                                    }
                                }
                                g.push(i(b, c, a));
                                g.push(i(b, e - 1 - c, a))
                            }
                            h == 0 ? h = 1 : h = 0;
                        }
                    }
                    else
                    {
                        for (c = 0; c < e; c++) {
                            for (a = h; a < f; a += 2) {
                                g.push(i(b, c, a));
                                g.push(i(b, e - 1 - c, a))
                            }
                            h == 0 ? h = 1 : h = 0
                        }
                        break
                    }
                case "spiralMarginToCenterCW":
                    var n = e, o = f, p, k = 0, m = f < e ? f : e;
                    q = Math.floor(m / 2);
                    for (p = 0; p < q; p++)
                    {
                        for (c = k++; c < n; c++) {
                            g.push(i(b, c, k - 1))
                        }
                        n--;
                        for (a = k; a < o; a++) {
                            g.push(i(b, e - k, a))
                        }
                        o--;
                        for (d = n; d >= e - n; d--) {
                            g.push(i(b, d - 1, o))
                        }
                        for (h = o - 1; h >= f - o; h--) {
                            g.push(i(b, k - 1, h))
                        }
                    }
                    if (m % 2)
                    {
                        if (m == f) {
                            for (c = k++; c < n; c++) {
                                g.push(i(b, c, k - 1))
                            }
                        }
                        if (m == e) {
                            for (a = k++; a < o; a++) {
                                g.push(i(b, e - k, a))
                            }
                        }
                    }
                    break;
                case "spiralMarginToCenterCCW":
                    n = e;
                    o = f;
                    k = 0;
                    m = f < e ? f : e;
                    q = Math.floor(m / 2);
                    for (p = 0; p < q; p++)
                    {
                        for (a = k++; a < o; a++) {
                            g.push(i(b, k - 1, a))
                        }
                        o--;
                        for (c = k; c < n; c++) {
                            g.push(i(b, c, f - k))
                        }
                        n--;
                        for (d = o; d >= f - o; d--) {
                            g.push(i(b, n, d - 1))
                        }
                        for (h = n - 1; h >= e - n; h--) {
                            g.push(i(b, h, k - 1))
                        }
                    }
                    if (m % 2)
                    {
                        if (m == f) {
                            for (c = k++; c < n; c++) {
                                g.push(i(b, c, f - k))
                            }
                        }
                        if (m == e) {
                            for (a = k++; a < o; a++) {
                                g.push(i(b, k - 1, a))
                            }
                        }
                    }
                    break;
                case "spiralCenterToMarginCCW":
                    n = e;
                    o = f;
                    k = 0;
                    m = f < e ? f : e;
                    q = Math.floor(m / 2);
                    for (p = 0; p < q; p++)
                    {
                        for (c = k++; c < n; c++) {
                            g.push(i(b, c, k - 1))
                        }
                        n--;
                        for (a = k; a < o; a++) {
                            g.push(i(b, e - k, a))
                        }
                        o--;
                        for (d = n; d >= e - n; d--) {
                            g.push(i(b, d - 1, o))
                        }
                        for (h = o - 1; h >= f - o; h--) {
                            g.push(i(b, k - 1, h))
                        }
                    }
                    if (m % 2)
                    {
                        if (m == f) {
                            for (c = k++; c < n; c++) {
                                g.push(i(b, c, k - 1))
                            }
                        }
                        if (m == e) {
                            for (a = k++; a < o; a++) {
                                g.push(i(b, e - k, a))
                            }
                        }
                    }
                    g.reverse();
                    break;
                case "spiralCenterToMarginCW":
                    n = e;
                    o = f;
                    k = 0;
                    m = f < e ? f : e;
                    q = Math.floor(m / 2);
                    for (p = 0; p < q; p++)
                    {
                        for (a = k++; a < o; a++) {
                            g.push(i(b, k - 1, a))
                        }
                        o--;
                        for (c = k; c < n; c++) {
                            g.push(i(b, c, f - k))
                        }
                        n--;
                        for (d = o; d >= f - o; d--) {
                            g.push(i(b, n, d - 1))
                        }
                        for (h = n - 1; h >= e - n; h--) {
                            g.push(i(b, h, k - 1))
                        }
                    }
                    if (m % 2)
                    {
                        if (m == f) {
                            for (c = k++; c < n; c++) {
                                g.push(i(b, c, f - k))
                            }
                        }
                        if (m == e) {
                            for (a = k++; a < o; a++) {
                                g.push(i(b, k - 1, a))
                            }
                        }
                    }
                    g.reverse();
                    break;
                default:
                    for (e = []; b.length; ) {
                        h = Math.floor(Math.random() * b.length);
                        e.push(b[h]);
                        b.splice(h, 1)
                    }
                    q = e.length;
                    for (d = 0; d < q; d++) {
                        g[d] = e[d];
                    }
            }
            return g
        }
        function i(b, d, e)
        {
            return bluebSlide.grep(b, function (f)
            {
                return f.data("hPos") == d && f.data("vPos") == e;
            })[0]
        }
        var u = bluebSlide(effSty), j = this, v =- 1, N =- 1, w = [], A = null, H = null, z = false, y = 0, 
        D = "", S = ["alignType", "effectStyle", "sliceDelay", "sliceDuration", "HSlices", "VSlices", 
        "slicePattern", "slicePoint", "slideStartPosition", "slideStartRatio", "sliceFade", "captionSize", 
        "captionPosition", "captionSlideDuration", "slideshowDelay"];
        this.settings = bluebSlide.extend({}, bluebSlide.fn.advancedslidwrap.defaults, C);
        (function ()
        {
            u.empty().addClass("imgSlid").css({
                width : j.settings.width, height : j.settings.height
            });
            bluebSlide.ajax(
            {
                type : "GET", url : j.settings.xmlFile, dataType : bluebSlide.browser.msie ? "text" : "xml", 
                success : function (b)
                {
                    var d;
                    if (bluebSlide.browser.msie) {
                        d = new ActiveXObject("Microsoft.XMLDOM");
                        d.async = false;
                        d.loadXML(b)
                    }
                    else {
                        d = b
                    }
                    bluebSlide(d).find("slide").each(function ()
                    {
                        var g = {};
                        g.properties = {};
                        for (var c = 0; c < bluebSlide(this).children().length; c++)
                        {
                            var a = bluebSlide(this).children()[c];
                            g[a.nodeName] = bluebSlide(this).find(a.nodeName).text()
                        }
                        for (c in S) {
                            a = S[c];
                            var h = bluebSlide(this).attr(a);
                            g.properties[a] = h || j.settings[a]
                        }
                        w.push(g);
                    });
                    j.settings.shuffle && w.sort(function ()
                    {
                        return 0.5 - Math.random();
                    });
                    j.settings.BtnSideArrow && sidearrow();
                    j.settings.bottomPagenation && btnNavigation();
                    j.settings.slideshow && btnSlideController();
                    if (j.settings.slidesPreloaded)
                    {
                        O();
                        var e = 0, f = j.settings.slidesPreloaded ==- 1 ? w.length : j.settings.slidesPreloaded;
                        for (b = 0; b < f; b++)
                        {
                            bluebSlide("<img/>").load(function ()
                            {
                                e++;
                                if (e == f) {
                                    Preload();
                                    btnSelect(j.settings.slideStart)
                                }
                            }).attr("src", w[b].path)
                        }
                    }
                    else {
                        btnSelect(j.settings.slideStart)
                    }
                }
            })
        })();
        this.nextSlide = L;
        this.previousSlide = K;
        this.gotoSlide = btnSelect;
        this.startSlideshow = function ()
        {
            u.find(".slideCont").removeClass("btnSlidePlay").addClass("btnSlidePause");
            D = "play";
            M()
        };
        this.stopSlideshow = function ()
        {
            u.find(".slideCont").removeClass("btnSlidePause").addClass("btnSlidePlay");
            D = "pause";
            y && clearTimeout(y)
        };
        this.getSlideshowState = function ()
        {
            return D;
        };
        this.getCurrentIndex = function ()
        {
            return v;
        };
        this.getSlideAt = function (b)
        {
            return w[b];
        };
        this.isTransition = function ()
        {
            return z;
        }
    }
    bluebSlide.fn.advancedslidwrap = function (effSty)
    {
        for (var C = [], x = 0; x < this.length; x++)
        {
            if (!this [x].slidwrap) {
                this [x].slidwrap = new slideContents(this [x], effSty);
                C.push(this [x].slidwrap)
            }
            return C.length > 1 ? C : C[0];
        }
    };
    bluebSlide.fn.advancedslidwrap.defaults = 
    {
        xmlFile : "", width : 500, height : 300, alignType : "leftTop", slideshow : true, slideshowDelay : 5E3, 
        slideshowDirection : "next", slideshowControls : true, slideStart : 0, slidesPreloaded : 0, shuffle : false, 
        effectStyle : "fade", sliceDelay : 50, sliceDuration : 1E3, HSlices : 5, VSlices : 3, slicePattern : "random", 
        slicePoint : "centerCenter", slideStartPosition : "left", slideStartRatio : 1, sliceFade : true, 
        BtnSideArrow : true, bottomPagenation : true, bottomPagenationCenter : true, visibleThum : true, 
        thumbnailSlide : 10, thumbnailDuration : 300, captionSize : 70, captionPosition : "bottom", captionSlideDuration : 500, 
        slideOpen : null, slideClick : null, slideMouseOver : null, slideMouseOut : null, transitionStart : null, 
        transitionComplete : null
    }
})(jQuery);

