jQuery.extend(jQuery.easing, {
    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
    }
});
(function ($) {
    $.fn.extend({
        panelGallery: function (G) {
            var H = {
                viewDuration: 4000,
                transitionDuration: 1000,
                boxSize: 35,
                boxFadeDuration: 1000,
                boxTransitionDuration: 100,
                panelWidth: 40,
                panelTransitionDuration: 100,
                pauseOnHover: true,
                FX: new Array()
            };
            var G = $.extend(H, G);
            return this.each(function () {
                var t = Math.round(Math.random() * 100000000);
                var o = G;
                var u = $(this);
                var w = $('img', u).length;
                var z = {
                    width: $('img:first', u).width(),
                    height: $('img:first', u).height()
                };
                var A = 0;
                var B = new Array();
                var C = new Array();
                var D;
                var E = true;
                var F = false;
                $(u).width(z.width).height(z.height).css({
                    'position': 'relative',
                    'overflow': 'hidden'
                });
                $('img', u).each(function () {
                    B.push($(this).attr('src'));
                    C.push($(this).attr('name'));
                    $(this).remove()
                });
                if (o.pauseOnHover) {
                    $(u).mouseenter(function () {
                        F = true;
                        clearTimeout(D);
                        $(this).css({
                            'cursor': 'wait'
                        })
                    }).mouseleave(function () {
                        F = false;
                        D = setTimeout(function () {
                            if (!E) {
                                B.push(B.shift());
                                C.push(C.shift())
                            }
                            $('img', u).remove();
                            pickFX()
                        }, o.viewDuration)
                    })
                }
                $(u).css({
                    
                }).append('<img src="' + B[0] + '">');
                D = setTimeout(function () {
                    pickFX()
                }, o.viewDuration);

                function galleryFX(b, d) {
                    if (b == 'fade') {
                        $('img', u).remove();
                        $(u).append('<img src="' + B[0] + '"><img src="' + B[1] + '">');
                        $('img:eq(1)', u).css({
                            'position': 'absolute',
                            'top': '0',
                            'left': '0'
                        }).hide().fadeIn(o.transitionDuration);
                        cleanupAndProceed()
                    }
                    if (b == 'boxSouthWest' || b == 'boxSouthEast' || b == 'boxNorthWest' || b == 'boxNorthEast' || b == 'boxRandom') {
                        var e = Math.floor(z.height / o.boxSize);
                        var f = Math.floor(z.width / o.boxSize);
                        var g = new Array();
                        for (r = 0; r <= e; r++) {
                            for (c = 0; c <= f; c++) {
                                boxLeft = c * o.boxSize;
                                boxTop = r * o.boxSize;
                                $(u).append('<div id="r' + r + 'c' + c + '_' + t + '" class="box" style="top:' + boxTop + 'px;left:' + boxLeft + 'px;background-position:-' + boxLeft + 'px -' + boxTop + 'px"></div>');
                                g.push('r' + r + 'c' + c + '_' + t)
                            }
                        }
                        $('.box', u).css({
                            'position': 'absolute',
                            'background-image': 'url(' + B[A + 1] + ')'
                        }).width(o.boxSize).height(o.boxSize).hide();
                        $(u).append('<img src="' + B[A] + '">');
                        if (b == 'boxRandom') {
                            g.shuffle();

                            function boxRandom() {
                                if (g.length > 0) {
                                    box = g.shift();
                                    $('#' + box).fadeIn(o.boxFadeDuration);
                                    setTimeout(boxRandom, o.boxTransitionDuration / 10);
                                    return
                                }
                                cleanupAndProceed(o.boxFadeDuration)
                            }
                            boxRandom()
                        }
                        if (b == 'boxSouthEast') {
                            var k = 0;

                            function boxSouthEast() {
                                for (var x = 0; x <= k; x++) {
                                    for (var y = 0; y <= k; y++) {
                                        if (x + y == k) $('#r' + x + 'c' + y + '_' + t).fadeIn(o.boxFadeDuration)
                                    }
                                }
                                k++;
                                if (k <= e + f) {
                                    setTimeout(boxSouthEast, o.boxTransitionDuration)
                                } else {
                                    cleanupAndProceed()
                                }
                            }
                            boxSouthEast()
                        }
                        if (b == 'boxNorthWest') {
                            var k = e + f;

                            function boxNorthWest() {
                                for (var x = k; x >= 0; x--) {
                                    for (var y = k; y >= 0; y--) {
                                        if (x + y == k) $('#r' + x + 'c' + y + '_' + t).fadeIn(o.boxFadeDuration)
                                    }
                                }
                                k--;
                                if (k >= 0) {
                                    setTimeout(boxNorthWest, o.boxTransitionDuration)
                                } else {
                                    cleanupAndProceed()
                                }
                            }
                            boxNorthWest()
                        }
                        if (b == 'boxNorthEast') {
                            var i = e;

                            function boxNorthEast() {
                                var a = 0;
                                for (var j = i; j <= e; j++) {
                                    $('#r' + j + 'c' + a + '_' + t).fadeIn(o.boxFadeDuration);
                                    a++
                                }
                                i--;
                                if (i >= -f) {
                                    setTimeout(boxNorthEast, o.boxTransitionDuration)
                                } else {
                                    cleanupAndProceed()
                                }
                            }
                            boxNorthEast()
                        }
                        if (b == 'boxSouthWest') {
                            var i = f;

                            function boxSouthWest() {
                                var a = 0;
                                for (var j = i; j <= f; j++) {
                                    $('#r' + a + 'c' + j + '_' + t).fadeIn(o.boxFadeDuration);
                                    a++
                                }
                                i--;
                                if (i >= -f) {
                                    setTimeout(boxSouthWest, o.boxTransitionDuration)
                                } else {
                                    cleanupAndProceed()
                                }
                            }
                            boxSouthWest()
                        }
                    }
                    if (b == 'panelEastTopDown' || b == 'panelEastBottomUp' || b == 'panelWestTopDown' || b == 'panelWestBottomUp' || b == 'panelNorthLeftRight' || b == 'panelNorthRightLeft' || b == 'panelSouthLeftRight' || b == 'panelSouthRightLeft' || b == 'panelZipperDown' || b == 'panelZipperUp' || b == 'panelZipperLeft' || b == 'panelZipperRight' || b == 'panelEastTopDown' || b == 'panelEastBottomUp' || b == 'panelWestTopDown' || b == 'panelWestBottomUp' || b == 'panelNorthLeftRight' || b == 'panelNorthRightLeft' || b == 'panelSouthLeftRight' || b == 'panelSouthRightLeft' || b == 'panelZipperDown' || b == 'panelZipperUp' || b == 'panelZipperLeft' || b == 'panelZipperRight' || b == 'panelEastTopDownReveal' || b == 'panelEastBottomUpReveal' || b == 'panelWestTopDownReveal' || b == 'panelWestBottomUpReveal' || b == 'panelNorthLeftRightReveal' || b == 'panelNorthRightLeftReveal' || b == 'panelSouthLeftRightReveal' || b == 'panelSouthRightLeftReveal' || b == 'panelTeethDown' || b == 'panelTeethUp' || b == 'panelTeethDown' || b == 'panelTeethUp' || b == 'panelTeethLeft' || b == 'panelTeethRight' || b == 'panelTeethLeft' || b == 'panelTeethRight' || b == 'panelTeethDownReveal' || b == 'panelTeethUpReveal' || b == 'panelTeethLeftReveal' || b == 'panelTeethRightReveal') {
                        var l = Math.floor(z.height / o.panelWidth);
                        var m = Math.floor(z.width / o.panelWidth);
                        for (var h = 0; h <= m; h++) {
                            s = h * o.panelWidth;
                            $(u).append('<div id="top_' + h + '_' + t + '" class="horizPanel" style="top:-' + z.height + 'px;left:' + s + 'px;background-position:-' + s + 'px -' + 0 + 'px"></div>');
                            $(u).append('<div id="bottom_' + h + '_' + t + '" class="horizPanel" style="top:' + z.height + 'px;left:' + s + 'px;background-position:-' + s + 'px -' + 0 + 'px"></div>')
                        }
                        for (var v = 0; v <= l; v++) {
                            panelTop = v * o.panelWidth;
                            $(u).append('<div id="left_' + v + '_' + t + '" class="vertPanel" style="top:' + panelTop + 'px;left:-' + z.width + 'px;background-position:-' + 0 + 'px -' + panelTop + 'px"></div>');
                            $(u).append('<div id="right_' + v + '_' + t + '" class="vertPanel" style="top:' + panelTop + 'px;left:' + z.width + 'px;background-position:-' + 0 + 'px -' + panelTop + 'px"></div>')
                        }
                        $('.horizPanel', u).css({
                            'position': 'absolute',
                            'background-image': 'url(' + B[A + 1] + ')'
                        }).width(o.panelWidth).height(z.height);
                        $('.vertPanel', u).css({
                            'position': 'absolute',
                            'background-image': 'url(' + B[A + 1] + ')'
                        }).width(z.width).height(o.panelWidth);
                        if (d) {
                            $('.horizPanel', u).css('opacity', '0');
                            $('.vertPanel', u).css('opacity', '0')
                        }
                        $(u).append('<img src="' + B[A] + '">');
                        if (b == 'panelEastTopDown' || b == 'panelEastBottomUp' || b == 'panelWestTopDown' || b == 'panelWestBottomUp' || b === undefined) {
                            var i = (b == 'panelEastTopDown' || b == 'panelWestTopDown' || b === undefined) ? 0 : l;

                            function slideLeft() {
                                if (b == 'panelEastTopDown' || b == 'panelEastBottomUp') {
                                    $('#right_' + i + '_' + t).animate({
                                        left: '0',
                                        opacity: '1'
                                    })
                                } else {
                                    $('#left_' + i + '_' + t).animate({
                                        left: '0',
                                        opacity: '1'
                                    })
                                }
                                i = (b == 'panelEastTopDown' || b == 'panelWestTopDown' || b === undefined) ? i + 1 : i - 1;
                                if ((b == 'panelEastTopDown' || b == 'panelWestTopDown' || b === undefined) && i <= l) {
                                    setTimeout(slideLeft, o.panelTransitionDuration)
                                } else if ((b == 'panelEastBottomUp' || b == 'panelWestBottomUp') && i >= 0) {
                                    setTimeout(slideLeft, o.panelTransitionDuration)
                                } else {
                                    cleanupAndProceed()
                                }
                            }
                            slideLeft()
                        }
                        if (b == 'panelNorthLeftRight' || b == 'panelNorthRightLeft' || b == 'panelSouthLeftRight' || b == 'panelSouthRightLeft') {
                            var i = (b == 'panelNorthLeftRight' || b == 'panelSouthLeftRight') ? 0 : m;

                            function slideDown() {
                                if (b == 'panelNorthLeftRight' || b == 'panelNorthRightLeft') {
                                    $('#top_' + i + '_' + t).animate({
                                        top: '0',
                                        opacity: '1'
                                    })
                                } else {
                                    $('#bottom_' + i + '_' + t).animate({
                                        top: '0',
                                        opacity: '1'
                                    })
                                }
                                i = (b == 'panelNorthLeftRight' || b == 'panelSouthLeftRight') ? i + 1 : i - 1;
                                if ((b == 'panelNorthLeftRight' || b == 'panelSouthLeftRight') && i <= m) {
                                    setTimeout(slideDown, o.panelTransitionDuration)
                                } else if ((b == 'panelNorthRightLeft' || b == 'panelSouthRightLeft') && i >= 0) {
                                    setTimeout(slideDown, o.panelTransitionDuration)
                                } else {
                                    cleanupAndProceed()
                                }
                            }
                            slideDown()
                        }
                        if (b == 'panelZipperDown' || b == 'panelZipperUp') {
                            var n = 'left';
                            var i = (b == 'panelZipperDown') ? 0 : l;

                            function zipper1() {
                                if (n == 'left') $('#left_' + i + '_' + t).animate({
                                    left: '0',
                                    opacity: '1'
                                });
                                if (n == 'right') $('#right_' + i + '_' + t).animate({
                                    left: '0',
                                    opacity: '1'
                                });
                                i = (b == 'panelZipperDown') ? i + 1 : i - 1;
                                n = (n == 'left') ? 'right' : 'left';
                                if ((b == 'panelZipperDown') && i <= l) {
                                    setTimeout(zipper1, o.panelTransitionDuration)
                                } else if (b == 'panelZipperUp' && i >= 0) {
                                    setTimeout(zipper1, o.panelTransitionDuration)
                                } else {
                                    cleanupAndProceed()
                                }
                            }
                            zipper1()
                        }
                        if (b == 'panelZipperLeft' || b == 'panelZipperRight') {
                            var n = 'top';
                            var i = (b == 'panelZipperLeft') ? 0 : m;

                            function zipper2() {
                                if (n == 'top') $('#top_' + i + '_' + t).animate({
                                    top: '0',
                                    opacity: '1'
                                });
                                if (n == 'bottom') $('#bottom_' + i + '_' + t).animate({
                                    top: '0',
                                    opacity: '1'
                                });
                                i = (b == 'panelZipperLeft') ? i + 1 : i - 1;
                                n = (n == 'top') ? 'bottom' : 'top';
                                if ((b == 'panelZipperLeft') && i <= m) {
                                    setTimeout(zipper2, o.panelTransitionDuration)
                                } else if (b == 'panelZipperRight' && i >= 0) {
                                    setTimeout(zipper2, o.panelTransitionDuration)
                                } else {
                                    cleanupAndProceed()
                                }
                            }
                            zipper2()
                        }
                        if (b == 'panelEastTopDownReveal' || b == 'panelEastBottomUpReveal' || b == 'panelWestTopDownReveal' || b == 'panelWestBottomUpReveal') {
                            $('.horizPanel', u).remove();
                            $('.vertPanel', u).css({
                                'left': '0',
                                'opacity': '1',
                                'background-image': 'url(' + B[A] + ')'
                            });
                            $('img', u).attr('src', B[A + 1]);
                            var i = (b == 'panelEastTopDownReveal' || b == 'panelWestTopDownReveal') ? 0 : l;

                            function slideLeftReveal() {
                                $('#left_' + i + '_' + t).remove();
                                if (b == 'panelEastTopDownReveal' || b == 'panelEastBottomUpReveal') {
                                    $('#right_' + i + '_' + t).animate({
                                        left: z.width + 'px'
                                    })
                                } else {
                                    $('#right_' + i + '_' + t).animate({
                                        left: '-' + z.width + 'px'
                                    })
                                }
                                i = (b == 'panelEastTopDownReveal' || b == 'panelWestTopDownReveal') ? i + 1 : i - 1;
                                if ((b == 'panelEastTopDownReveal' || b == 'panelWestTopDownReveal') && i <= l) {
                                    setTimeout(slideLeftReveal, o.panelTransitionDuration)
                                } else if ((b == 'panelEastBottomUpReveal' || b == 'panelWestBottomUpReveal') && i >= 0) {
                                    setTimeout(slideLeftReveal, o.panelTransitionDuration)
                                } else {
                                    cleanupAndProceed()
                                }
                            }
                            slideLeftReveal()
                        }
                        if (b == 'panelNorthLeftRightReveal' || b == 'panelNorthRightLeftReveal' || b == 'panelSouthLeftRightReveal' || b == 'panelSouthRightLeftReveal') {
                            $('.vertPanel', u).remove();
                            $('.horizPanel', u).css({
                                'top': '0',
                                'opacity': '1',
                                'background-image': 'url(' + B[A] + ')'
                            });
                            $('img', u).attr('src', B[A + 1]);
                            var i = (b == 'panelNorthLeftRightReveal' || b == 'panelSouthLeftRightReveal') ? 0 : m;

                            function slideUpReveal() {
                                $('#bottom_' + i + '_' + t).remove();
                                if (b == 'panelSouthLeftRightReveal' || b == 'panelSouthRightLeftReveal') {
                                    $('#top_' + i + '_' + t).animate({
                                        top: z.height + 'px'
                                    })
                                } else {
                                    $('#top_' + i + '_' + t).animate({
                                        top: '-' + z.height + 'px'
                                    })
                                }
                                i = (b == 'panelNorthLeftRightReveal' || b == 'panelSouthLeftRightReveal') ? i + 1 : i - 1;
                                if ((b == 'panelNorthLeftRightReveal' || b == 'panelSouthLeftRightReveal') && i <= m) {
                                    setTimeout(slideUpReveal, o.panelTransitionDuration)
                                } else if ((b == 'panelNorthRightLeftReveal' || b == 'panelSouthRightLeftReveal') && i >= 0) {
                                    setTimeout(slideUpReveal, o.panelTransitionDuration)
                                } else {
                                    cleanupAndProceed()
                                }
                            }
                            slideUpReveal()
                        }
                        if (b == 'panelTeethDown' || b == 'panelTeethUp') {
                            $('.horizPanel', u).remove();
                            var i = (b == 'panelTeethDown') ? 0 : l;

                            function teeth1() {
                                var v = i * o.panelWidth;
                                $('#left_' + i + '_' + t).css('background-position', z.width / 2 + 'px -' + v + 'px').animate({
                                    left: '-' + z.width / 2 + 'px',
                                    opacity: '1'
                                });
                                $('#right_' + i + '_' + t).css('background-position', '-' + z.width / 2 + 'px -' + v + 'px').animate({
                                    left: z.width / 2 + 'px',
                                    opacity: '1'
                                });
                                i = (b == 'panelTeethDown') ? i + 1 : i - 1;
                                if ((b == 'panelTeethDown') && i <= l) {
                                    setTimeout(teeth1, o.panelTransitionDuration)
                                } else if (b == 'panelTeethUp' && i >= 0) {
                                    setTimeout(teeth1, o.panelTransitionDuration)
                                } else {
                                    cleanupAndProceed()
                                }
                            }
                            teeth1();
                            return
                        }
                        if (b == 'panelTeethLeft' || b == 'panelTeethRight') {
                            $('.vertPanel', u).remove();
                            var i = (b == 'panelTeethLeft') ? 0 : m;

                            function teeth2() {
                                var h = i * o.panelWidth;
                                $('#top_' + i + '_' + t).css('background-position', '-' + h + 'px ' + z.height / 2 + 'px').animate({
                                    top: '-' + z.height / 2 + 'px',
                                    opacity: '1'
                                });
                                $('#bottom_' + i + '_' + t).css('background-position', '-' + h + 'px ' + '-' + z.height / 2 + 'px').animate({
                                    top: z.height / 2 + 'px',
                                    opacity: '1'
                                });
                                i = (b == 'panelTeethLeft') ? i + 1 : i - 1;
                                if ((b == 'panelTeethLeft') && i <= m) {
                                    setTimeout(teeth2, o.panelTransitionDuration)
                                } else if (b == 'panelTeethRight' && i >= 0) {
                                    setTimeout(teeth2, o.panelTransitionDuration)
                                } else {
                                    cleanupAndProceed()
                                }
                            }
                            teeth2();
                            return
                        }
                        if (b == 'panelTeethDownReveal' || b == 'panelTeethUpReveal') {
                            $('.horizPanel', u).remove();
                            var i = (b == 'panelTeethDownReveal') ? 0 : l;
                            $('.vertPanel', u).css({
                                'background-image': 'url(' + B[A] + ')',
                                'opacity': '1'
                            });
                            $('img', u).attr('src', B[A + 1]);
                            for (var j = 0; j <= l; j++) {
                                $('#left_' + j + '_' + t).css({
                                    'left': '-' + z.width / 2 + 'px',
                                    'background-position': z.width / 2 + 'px -' + j * o.panelWidth + 'px'
                                });
                                $('#right_' + j + '_' + t).css({
                                    'left': z.width / 2 + 'px',
                                    'background-position': z.width / 2 + 'px -' + j * o.panelWidth + 'px'
                                })
                            }
                            function teeth3() {
                                $('#left_' + i + '_' + t).animate({
                                    left: '-' + z.width + 'px',
                                    opacity: '1'
                                });
                                $('#right_' + i + '_' + t).animate({
                                    left: z.width + 'px',
                                    opacity: '1'
                                });
                                i = (b == 'panelTeethDownReveal') ? i + 1 : i - 1;
                                if ((b == 'panelTeethDownReveal') && i <= l) {
                                    setTimeout(teeth3, o.panelTransitionDuration)
                                } else if (b == 'panelTeethUpReveal' && i >= 0) {
                                    setTimeout(teeth3, o.panelTransitionDuration)
                                } else {
                                    cleanupAndProceed()
                                }
                            }
                            teeth3()
                        }
                        if (b == 'panelTeethLeftReveal' || b == 'panelTeethRightReveal') {
                            $('.vertPanel', u).remove();
                            var i = (b == 'panelTeethLeftReveal') ? 0 : m;
                            $('.horizPanel', u).css({
                                'background-image': 'url(' + B[A] + ')',
                                'opacity': '1'
                            });
                            $('img', u).attr('src', B[A + 1]);
                            for (var j = 0; j <= m; j++) {
                                $('#top_' + j + '_' + t).css({
                                    'top': '-' + z.height / 2 + 'px',
                                    'background-position': '-' + j * o.panelWidth + 'px ' + z.height / 2 + 'px'
                                });
                                $('#bottom_' + j + '_' + t).css({
                                    'top': z.height / 2 + 'px',
                                    'background-position': '-' + j * o.panelWidth + 'px ' + z.height / 2 + 'px'
                                })
                            }
                            function teeth4() {
                                $('#top_' + i + '_' + t).animate({
                                    top: '-' + z.height + 'px',
                                    opacity: '1'
                                });
                                $('#bottom_' + i + '_' + t).animate({
                                    top: z.height + 'px',
                                    opacity: '1'
                                });
                                i = (b == 'panelTeethLeftReveal') ? i + 1 : i - 1;
                                if ((b == 'panelTeethLeftReveal') && i <= m) {
                                    setTimeout(teeth4, o.panelTransitionDuration)
                                } else if (b == 'panelTeethRightReveal' && i >= 0) {
                                    setTimeout(teeth4, o.panelTransitionDuration)
                                } else {
                                    cleanupAndProceed()
                                }
                            }
                            teeth4()
                        }
                    }
                    if (b == 'overlayTopDown' || b == 'overlayBottomUp' || b == 'overlayLeftRight' || b == 'overlayRightLeft') {
                        var l = Math.floor(z.height / o.panelWidth);
                        var m = Math.floor(z.width / o.panelWidth);
                        var p = d;
                        for (var h = 0; h <= m; h++) {
                            s = h * o.panelWidth;
                            $(u).append('<div id="top_' + h + '_' + t + '" class="horizPanel" style="top:0px;left:' + s + 'px;background-position:-' + s + 'px -' + 0 + 'px"></div>')
                        }
                        for (v = 0; v <= l; v++) {
                            panelTop = v * o.panelWidth;
                            $(u).append('<div id="left_' + v + '_' + t + '" class="vertPanel" style="top:' + panelTop + 'px;left:0px;background-position:-' + 0 + 'px -' + panelTop + 'px"></div>')
                        }
                        $('.horizPanel', u).css({
                            'opacity': '0',
                            'position': 'absolute',
                            'background-image': 'url(' + B[A + 1] + ')'
                        }).width(o.panelWidth).height(z.height);
                        $('.vertPanel', u).css({
                            'opacity': '0',
                            'position': 'absolute',
                            'background-image': 'url(' + B[A + 1] + ')'
                        }).width(z.width).height(o.panelWidth);
                        $(u).append('<img src="' + B[A] + '">');
                        if (b == 'overlayTopDown' || b == 'overlayBottomUp') {
                            var i = (b == 'overlayTopDown') ? 0 : l;

                            function overlayDown() {
                                if (p) $('#left_' + i + '_' + t).height(0);
                                $('#left_' + i + '_' + t).animate({
                                    opacity: '1',
                                    height: o.panelWidth + 'px'
                                }, o.transitionDuration);
                                i = (b == 'overlayTopDown') ? i + 1 : i - 1;
                                if ((b == 'overlayTopDown') && i <= l) {
                                    setTimeout(overlayDown, o.panelTransitionDuration)
                                } else if (b == 'overlayBottomUp' && i >= 0) {
                                    setTimeout(overlayDown, o.panelTransitionDuration)
                                } else {
                                    cleanupAndProceed()
                                }
                            }
                            overlayDown()
                        }
                        if (b == 'overlayLeftRight' || b == 'overlayRightLeft') {
                            var i = (b == 'overlayLeftRight') ? 0 : m;

                            function overlay2() {
                                if (p) $('#top_' + i + '_' + t).width(0);
                                $('#top_' + i + '_' + t).animate({
                                    opacity: '1',
                                    width: o.panelWidth + 'px'
                                }, o.transitionDuration);
                                i = (b == 'overlayLeftRight') ? i + 1 : i - 1;
                                if ((b == 'overlayLeftRight') && i <= m) {
                                    setTimeout(overlay2, o.panelTransitionDuration)
                                } else if (b == 'overlayRightLeft' && i >= 0) {
                                    setTimeout(overlay2, o.panelTransitionDuration)
                                } else {
                                    cleanupAndProceed()
                                }
                            }
                            overlay2()
                        }
                    }
                    if (b == 'jackpot') {
                        for (var h = 0; h <= 2; h++) {
                            var q = B.slice(0);
                            q.push(q.shift());
                            var s = h * (z.width / 3);
                            $(u).append('<div id="top_' + h + '_' + t + '" class="horizPanel" style="overflow:hidden;top:-' + z.height * 10 + 'px;left:' + s + 'px;background-position:-' + s + 'px -' + 0 + 'px"></div>');
                            for (var i = 0; i <= 9; i++) {
                                $('#top_' + h + '_' + t).append('<img style="position:relative;left:-' + s + 'px" src="' + q[0] + '"><br />');
                                q.push(q.shift())
                            }
                            $('#top_' + h + '_' + t).append('<img style="position:relative;left:-' + s + 'px" src="' + B[0] + '"><br />')
                        }
                        $('.horizPanel', u).css({
                            'position': 'absolute',
                            'background-image': 'url(' + B[A + 1] + ')'
                        }).width(z.width / 3).height(z.height * 11);
                        $(u).append('<img src="' + B[A] + '">');
                        var i = 0;

                        function jackpot() {
                            $('#top_' + i + '_' + t).animate({
                                top: '0px'
                            }, {
                                duration: o.transitionDuration * 3,
                                easing: 'easeInOutExpo'
                            });
                            i++;
                            if (i <= 2) {
                                setTimeout(jackpot, 500)
                            } else {
                                cleanupAndProceed(o.transitionDuration + (3 * 500))
                            }
                        }
                        jackpot()
                    }
                }
                function cleanupAndProceed(a) {
                    a = (!a) ? o.transitionDuration : a;
                    setTimeout(function () {
                        if (!F) {
                            E = false;
                            $(u).append('<img style="position:absolute;top:0;left:0" src="' + B[A + 1] + '">');
                            $('.box', u).remove();
                            $('.horizPanel', u).remove();
                            $('.vertPanel', u).remove();
                            D = setTimeout(function () {
                                B.push(B.shift());
                                C.push(C.shift());
                                $('img', u).remove();
                                pickFX()
                            }, o.viewDuration)
                        }
                    }, a)
                }
                function pickFX() {
                    randomFXarray = new Array("fade", "boxSouthWest", "boxSouthEast", "boxNorthWest", "boxNorthEast", "boxRandom", "panelEastTopDown,true", "panelEastBottomUp,true", "panelWestTopDown,true", "panelWestBottomUp,true", "panelNorthLeftRight,true", "panelNorthRightLeft,true", "panelSouthLeftRight,true", "panelSouthRightLeft,true", "panelZipperDown,true", "panelZipperUp,true", "panelZipperLeft,true", "panelZipperRight,true", "panelEastTopDown,false", "panelEastBottomUp,false", "panelWestTopDown,false", "panelWestBottomUp,false", "panelNorthLeftRight,false", "panelNorthRightLeft,false", "panelSouthLeftRight,false", "panelSouthRightLeft,false", "panelZipperDown,false", "panelZipperUp,false", "panelZipperLeft,false", "panelZipperRight,false", "panelEastTopDownReveal", "panelEastBottomUpReveal", "panelWestTopDownReveal", "panelWestBottomUpReveal", "panelNorthLeftRightReveal", "panelNorthRightLeftReveal", "panelSouthLeftRightReveal", "panelSouthRightLeftReveal", "panelTeethDown,true", "panelTeethUp,true", "panelTeethDown,false", "panelTeethUp,false", "panelTeethLeft,true", "panelTeethRight,true", "panelTeethLeft,false", "panelTeethRight,false", "panelTeethDownReveal", "panelTeethUpReveal", "panelTeethLeftReveal", "panelTeethRightReveal", "overlayTopDown,true", "overlayBottomUp,true", "overlayLeftRight,true", "overlayRightLeft,true", "overlayTopDown,false", "overlayBottomUp,false", "overlayLeftRight,false", "overlayRightLeft,false", "jackpot");
                    var a = Math.floor(Math.random() * randomFXarray.length);
                    if (C[0]) opt = C[0];
                    else if (o.FX.length > 0) {
                        opt = o.FX[0];
                        o.FX.push(o.FX.shift())
                    } else opt = randomFXarray[a];
                    opt1 = opt.split(',');
                    bool = (opt1[1] == 'true') ? true : false;
                    str = {
                        name: opt1[0],
                        opt1: bool
                    };
                    galleryFX(str.name, str.opt1)
                }
            })
        }
    })
})(jQuery);
Array.prototype.shuffle = function () {
    var s = [];
    while (this.length) s.push(this.splice(Math.random() * this.length, 1));
    while (s.length) this.push(s.pop());
    return this
}
