(function(a){
    var b;
    a.fn.setTransition=function(c){
        b.setTransition(c)
        };

    a.fn.setTextEffect=function(c){
        b.setTextEffect(c)
        };

    a.fn.setTooltipType=function(c){
        b.setTooltipType(c)
        };

    a.fn.setCpanelAlign=function(c){
        b.setCpanelAlign(c)
        };

    a.fn.setCpanelPos=function(c){
        b.setCpanelPos(c)
        };

    a.fn.setThumbs=function(c){
        b.setThumbs(c)
        };

    a.fn.setDButtons=function(c){
        b.setDButtons(c)
        };

    a.fn.setPlayButton=function(c){
        b.setPlayButton(c)
        };

    a.fn.setTooltip=function(c){
        b.setTooltip(c)
        };

    a.fn.setTimerBar=function(c){
        b.setTimerBar(c)
        };

    a.fn.setMouseoverPause=function(c){
        b.setMouseoverPause(c)
        };

    a.fn.setMouseoverCPanel=function(c){
        b.setMouseoverCPanel(c)
        };

    a.fn.setMouseoverText=function(c){
        b.setMouseoverText(c)
        };

    a.fn.wtRotator=function(B){
        var y="TL";
        var e="TR";
        var w="TC";
        var u="BL";
        var f="BR";
        var n="BC";
        var k="inside";
        var q="outside";
        var h=new Array(42);
        h.fade=0;
        h["block.top"]=1;
        h["block.right"]=2;
        h["block.bottom"]=3;
        h["block.left"]=4;
        h["block.drop"]=5;
        h["diag.fade"]=6;
        h["diag.exp"]=7;
        h["rev.diag.fade"]=8;
        h["rev.diag.exp"]=9;
        h["block.fade"]=10;
        h["block.exp"]=11;
        h["block.top.zz"]=12;
        h["block.bottom.zz"]=13;
        h["block.left.zz"]=14;
        h["block.right.zz"]=15;
        h["spiral.in"]=16;
        h["spiral.out"]=17;
        h["vert.tl"]=18;
        h["vert.tr"]=19;
        h["vert.bl"]=20;
        h["vert.br"]=21;
        h["fade.left"]=22;
        h["fade.right"]=23;
        h["alt.left"]=24;
        h["alt.right"]=25;
        h["blinds.left"]=26;
        h["blinds.right"]=27;
        h["vert.random.fade"]=28;
        h["horz.tl"]=29;
        h["horz.tr"]=30;
        h["horz.bl"]=31;
        h["horz.br"]=32;
        h["fade.top"]=33;
        h["fade.bottom"]=34;
        h["alt.top"]=35;
        h["alt.bottom"]=36;
        h["blinds.top"]=37;
        h["blinds.bottom"]=38;
        h["horz.random.fade"]=39;
        h.none=40;
        h.random=41;
        var z=new Array(4);
        z.fade=0;
        z.down=1;
        z.right=2;
        z.none=3;
        var p=5000;
        var x=800;
        var v=600;
        var m=600;
        var g="updatetext";
        function c(G,P,N,R,M,H,I){
            var J;
            var E;
            var L;
            var Q=null;
            var S=function(){
                L=Math.ceil(P/R);
                var U="";
                for(var T=0;T<L;T++){
                    U+="<div class='vpiece' id='"+T+"'></div>"
                    }
                    G.addToScreen(U);
                J=a("div.vpiece",G.$el);
                E=new Array(L);
                J.each(function(V){
                    a(this).css({
                        left:(V*R),
                        height:N
                    });
                    E[V]=a(this)
                    })
                };

            this.clear=function(){
                clearInterval(Q);
                J.stop(true).css({
                    "z-index":2,
                    opacity:0
                })
                };

            this.displayContent=function(T,U){
                D(T,U);
                if(U==h["vert.random.fade"]){
                    O(T)
                    }else{
                    F(T,U)
                    }
                };

        var D=function(T,U){
            switch(U){
                case h["vert.tl"]:case h["vert.tr"]:
                    K(T,-N,1,R,false);
                    break;
                case h["vert.bl"]:case h["vert.br"]:
                    K(T,N,1,R,false);
                    break;
                case h["alt.left"]:case h["alt.right"]:
                    K(T,0,1,R,true);
                    break;
                case h["blinds.left"]:case h["blinds.right"]:
                    K(T,0,1,0,false);
                    break;
                default:
                    K(T,0,0,R,false)
                    }
                };

    var K=function(W,T,U,Y,aa){
        var X=W.attr("src");
        var Z=0;
        var V=0;
        if(G.centerImg()){
            Z=(N-W.height())/2;
            V=(P-W.width())/2
            }
            J.each(function(ac){
            var ab=((-ac*R)+V);
            if(aa){
                T=(ac%2)==0?-N:N
                }
                a(this).css({
                background:M+" url('"+X+"') no-repeat",
                backgroundPosition:ab+"px "+Z+"px",
                opacity:U,
                top:T,
                width:Y,
                "z-index":3
            })
            })
        };

    var F=function(V,W){
        var Y,U,X,T;
        switch(W){
            case h["vert.tl"]:case h["vert.bl"]:case h["fade.left"]:case h["blinds.left"]:case h["alt.left"]:
                Y=0;
                U=L-1;
                X=1;
                break;
            default:
                Y=L-1;
                U=0;
                X=-1
                }
                Q=setInterval(function(){
            a(J.get(Y)).animate({
                top:0,
                opacity:1,
                width:R
            },H,"",function(){
                if(a(this).attr("id")==U){
                    G.setComplete(V)
                    }
                });
        if(Y==U){
            clearInterval(Q)
            }
            Y+=X
        },I)
    };

var O=function(U){
    s(E);
    var T=0;
    var V=0;
    Q=setInterval(function(){
        E[T++].animate({
            opacity:1
        },H,"",function(){
            if(++V==L){
                G.setComplete(U)
                }
            });
    if(T==L){
        clearInterval(Q)
        }
    },I)
};

S()
}
function t(G,P,N,R,M,H,I){
    var J;
    var E;
    var L;
    var Q=null;
    var S=function(){
        L=Math.ceil(N/R);
        var U="";
        for(var T=0;T<L;T++){
            U+="<div class='hpiece' id='"+T+"'><!-- --></div>"
            }
            G.addToScreen(U);
        J=a("div.hpiece",G.$el);
        E=new Array(L);
        J.each(function(V){
            a(this).css({
                top:(V*R),
                width:P
            });
            E[V]=a(this)
            })
        };

    this.clear=function(){
        clearInterval(Q);
        J.stop(true).css({
            "z-index":2,
            opacity:0
        })
        };

    this.displayContent=function(T,U){
        D(T,U);
        if(U==h["horz.random.fade"]){
            O(T)
            }else{
            F(T,U)
            }
        };

var D=function(T,U){
    switch(U){
        case h["horz.tr"]:case h["horz.br"]:
            K(T,P,1,R,false);
            break;
        case h["horz.tl"]:case h["horz.bl"]:
            K(T,-P,1,R,false);
            break;
        case h["alt.top"]:case h["alt.bottom"]:
            K(T,0,1,R,true);
            break;
        case h["blinds.top"]:case h["blinds.bottom"]:
            K(T,0,1,0,false);
            break;
        default:
            K(T,0,0,R,false)
            }
        };

var K=function(X,W,U,T,aa){
    var Y=X.attr("src");
    var Z=0;
    var V=0;
    if(G.centerImg()){
        Z=(N-X.height())/2;
        V=(P-X.width())/2
        }
        J.each(function(ac){
        var ab=((-ac*R)+Z);
        if(aa){
            W=(ac%2)==0?-P:P
            }
            a(this).css({
            background:M+" url('"+Y+"') no-repeat",
            backgroundPosition:V+"px "+ab+"px",
            opacity:U,
            left:W,
            height:T,
            "z-index":3
        })
        })
    };

var F=function(U,V){
    var X,T,W;
    switch(V){
        case h["horz.tl"]:case h["horz.tr"]:case h["fade.top"]:case h["blinds.top"]:case h["alt.top"]:
            X=0;
            T=L-1;
            W=1;
            break;
        default:
            X=L-1;
            T=0;
            W=-1
            }
            Q=setInterval(function(){
        a(J.get(X)).animate({
            left:0,
            opacity:1,
            height:R
        },H,"",function(){
            if(a(this).attr("id")==T){
                G.setComplete(U)
                }
            });
    if(X==T){
        clearInterval(Q)
        }
        X+=W
    },I)
};

var O=function(U){
    s(E);
    var T=0;
    var V=0;
    Q=setInterval(function(){
        E[T++].animate({
            opacity:1
        },H,"",function(){
            if(++V==L){
                G.setComplete(U)
                }
            });
    if(T==L){
        clearInterval(Q)
        }
    },I)
};

S()
}
function l(N,O,J,P,M,D,W){
    var L;
    var E;
    var Q;
    var I;
    var K;
    var Y;
    var X;
    var V=function(){
        I=Math.ceil(J/P);
        K=Math.ceil(O/P);
        Y=I*K;
        var ac="";
        for(var ab=0;ab<I;ab++){
            for(var aa=0;aa<K;aa++){
                ac+="<div class='block' id='"+ab+"-"+aa+"'></div>"
                }
            }
            N.addToScreen(ac);
    E=a("div.block",N.$el);
    E.data({
        tlId:"0-0",
        trId:"0-"+(K-1),
        blId:(I-1)+"-0",
        brId:(I-1)+"-"+(K-1)
        });
    var Z=0;
    Q=new Array(Y);
    L=new Array(I);
    for(var ab=0;ab<I;ab++){
        L[ab]=new Array(K);
        for(var aa=0;aa<K;aa++){
            L[ab][aa]=Q[Z++]=E.filter("#"+(ab+"-"+aa)).data("top",ab*P)
            }
        }
    };

this.clear=function(){
    clearInterval(X);
    E.stop(true).css({
        "z-index":2,
        opacity:0
    })
    };

this.displayContent=function(Z,aa){
    switch(aa){
        case h["diag.fade"]:
            S(Z,0,P,0);
            T(Z,{
            opacity:1
        },false);
        break;
        case h["diag.exp"]:
            S(Z,0,0,0);
            T(Z,{
            opacity:1,
            width:P,
            height:P
        },false);
        break;
        case h["rev.diag.fade"]:
            S(Z,0,P,0);
            T(Z,{
            opacity:1
        },true);
        break;
        case h["rev.diag.exp"]:
            S(Z,0,0,0);
            T(Z,{
            opacity:1,
            width:P,
            height:P
        },true);
        break;
        case h["block.fade"]:
            S(Z,0,P,0);
            F(Z);
            break;
        case h["block.exp"]:
            S(Z,1,0,0);
            F(Z);
            break;
        case h["block.drop"]:
            S(Z,1,P,-(I*P));
            F(Z);
            break;
        case h["block.top.zz"]:case h["block.bottom.zz"]:
            S(Z,0,P,0);
            H(Z,aa);
            break;
        case h["block.left.zz"]:case h["block.right.zz"]:
            S(Z,0,P,0);
            R(Z,aa);
            break;
        case h["spiral.in"]:
            S(Z,0,P,0);
            U(Z,false);
            break;
        case h["spiral.out"]:
            S(Z,0,P,0);
            U(Z,true);
            break;
        default:
            S(Z,1,0,0);
            G(Z,aa)
            }
        };

var S=function(Z,af,aj,ae){
    var ag=0;
    var ab=0;
    if(N.centerImg()){
        ag=(J-Z.height())/2;
        ab=(O-Z.width())/2
        }
        var ah=Z.attr("src");
    for(var ad=0;ad<I;ad++){
        for(var ac=0;ac<K;ac++){
            var ai=((-ad*P)+ag);
            var aa=((-ac*P)+ab);
            L[ad][ac].css({
                background:M+" url('"+ah+"') no-repeat",
                backgroundPosition:aa+"px "+ai+"px",
                opacity:af,
                top:(ad*P)+ae,
                left:(ac*P),
                width:aj,
                height:aj,
                "z-index":3
            })
            }
        }
    };

var T=function(Z,ah,ae){
    var ag=new Array(Y);
    var aa,ad,ab,ac;
    var ai=(I-1)+(K-1);
    if(ae){
        aa=ai;
        ad=-1;
        ab=-1;
        ac=E.data("tlId")
        }else{
        aa=0;
        ad=ai+1;
        ab=1;
        ac=E.data("brId")
        }
        var af=0;
    while(aa!=ad){
        i=Math.min(I-1,aa);
        while(i>=0){
            j=Math.abs(i-aa);
            if(j>=K){
                break
            }
            ag[af++]=L[i][j];
            i--
        }
        aa+=ab
        }
        af=0;
    X=setInterval(function(){
        ag[af++].animate(ah,D,"",function(){
            if(a(this).attr("id")==ac){
                N.setComplete(Z)
                }
            });
    if(af==Y){
        clearInterval(X)
        }
    },W)
};

var R=function(ac,ad){
    var ab=true;
    var aa=0,Z,af,ae;
    if(ad==h["block.left.zz"]){
        ae=(K%2==0)?E.data("trId"):E.data("brId");
        Z=0;
        af=1
        }else{
        ae=(K%2==0)?E.data("tlId"):E.data("blId");
        Z=K-1;
        af=-1
        }
        X=setInterval(function(){
        L[aa][Z].animate({
            opacity:1
        },D,"",function(){
            if(a(this).attr("id")==ae){
                N.setComplete(ac)
                }
            });
    if(L[aa][Z].attr("id")==ae){
        clearInterval(X)
        }(ab?aa++:aa--);
        if(aa==I||aa<0){
        ab=!ab;
        aa=(ab?0:I-1);
        Z+=af
        }
    },W)
};

var H=function(ac,ad){
    var ab=true;
    var aa,Z=0,af,ae;
    if(ad==h["block.top.zz"]){
        ae=(I%2==0)?E.data("blId"):E.data("brId");
        aa=0;
        af=1
        }else{
        ae=(I%2==0)?E.data("tlId"):E.data("trId");
        aa=I-1;
        af=-1
        }
        X=setInterval(function(){
        L[aa][Z].animate({
            opacity:1
        },D,"",function(){
            if(a(this).attr("id")==ae){
                N.setComplete(ac)
                }
            });
    if(L[aa][Z].attr("id")==ae){
        clearInterval(X)
        }(ab?Z++:Z--);
        if(Z==K||Z<0){
        ab=!ab;
        Z=(ab?0:K-1);
        aa+=af
        }
    },W)
};

var G=function(ab,ac){
    var ae=new Array(Y);
    var af;
    var ad=0;
    switch(ac){
        case h["block.left"]:
            af=E.data("brId");
            for(var Z=0;Z<K;Z++){
            for(var aa=0;aa<I;aa++){
                ae[ad++]=L[aa][Z]
                }
            }
            break;
    case h["block.right"]:
        af=E.data("blId");
        for(var Z=K-1;Z>=0;Z--){
        for(var aa=0;aa<I;aa++){
            ae[ad++]=L[aa][Z]
            }
        }
        break;
case h["block.top"]:
    af=E.data("brId");
    for(var aa=0;aa<I;aa++){
    for(var Z=0;Z<K;Z++){
        ae[ad++]=L[aa][Z]
        }
    }
    break;
default:
    af=E.data("trId");
    for(var aa=I-1;aa>=0;aa--){
    for(var Z=0;Z<K;Z++){
        ae[ad++]=L[aa][Z]
        }
    }
}
ad=0;
X=setInterval(function(){
    ae[ad++].animate({
        width:P,
        height:P
    },D,"",function(){
        if(a(this).attr("id")==af){
            N.setComplete(ab)
            }
        });
if(ad==Y){
    clearInterval(X)
    }
},W)
};

var F=function(aa){
    s(Q);
    var Z=0;
    count=0;
    X=setInterval(function(){
        Q[Z].animate({
            top:Q[Z].data("top"),
            width:P,
            height:P,
            opacity:1
        },D,"",function(){
            if(++count==Y){
                N.setComplete(aa)
                }
            });
    Z++;
    if(Z==Y){
        clearInterval(X)
        }
    },W)
};

var U=function(Z,ah){
    var ag=0,af=0;
    var ak=I-1;
    var al=K-1;
    var ab=0;
    var ae=al;
    var aj=new Array();
    while(ak>=0&&al>=0){
        var ai=0;
        while(true){
            aj[aj.length]=L[ag][af];
            if((++ai)>ae){
                break
            }
            switch(ab){
                case 0:
                    af++;
                    break;
                case 1:
                    ag++;
                    break;
                case 2:
                    af--;
                    break;
                case 3:
                    ag--
            }
        }
        switch(ab){
        case 0:
            ab=1;
            ae=(--ak);
            ag++;
            break;
        case 1:
            ab=2;
            ae=(--al);
            af--;
            break;
        case 2:
            ab=3;
            ae=(--ak);
            ag--;
            break;
        case 3:
            ab=0;
            ae=(--al);
            af++
    }
}
if(aj.length>0){
    if(ah){
        aj.reverse()
        }
        var ad=aj.length-1;
    var aa=aj[ad].attr("id");
    var ac=0;
    X=setInterval(function(){
        aj[ac].animate({
            opacity:1
        },D,"",function(){
            if(a(this).attr("id")==aa){
                N.setComplete(Z)
                }
            });
    if(ac==ad){
        clearInterval(X)
        }
        ac++
    },W)
}
};

V()
}
function A(bn,bj){
    var ao=d(bj.width,825);
    var be=d(bj.height,300);
    var a9=C(bj.button_margin,4);
    var al=bj.transition.toLowerCase();
    var at=d(bj.transition_speed,x);
    var W=d(bj.delay,p);
    var aJ=bj.auto_start;
    var U=bj.cpanel_position.toLowerCase();
    var a1=bj.cpanel_align.toUpperCase();
    var ag=d(bj.button_width,24);
    var aV=d(bj.button_height,24);
    var F=bj.display_thumbs;
    var aH=bj.display_dbuttons;
    var aF=bj.display_playbutton;
    var aA=bj.cpanel_mouseover;
    var aw=bj.text_mouseover;
    var aa=bj.mouseover_pause;
    var ab=bj.tooltip_type.toLowerCase();
    var av=bj.text_effect.toLowerCase();
    var bk=bj.text_sync;
    var au=bj.play_once;
    var X=bj.auto_center;
    var ai;
    var aq;
    var J;
    var H;
    var Q;
    var aK;
    var aX;
    var a5=null;
    var ah=a(".wt-rotator",bn);
    var aR=ah.find("div.screen");
    var ar;
    var aO;
    var E;
    var I=ah.find("div.c-panel");
    var aY=I.find("div.thumbnails");
    var ac=aY.find(">ul:first>li");
    var K=I.find("div.buttons");
    var R=K.find("div.play-btn");
    var P=K.find("div.prev-btn");
    var a6=K.find("div.next-btn");
    var S;
    var M=a("<div id='rotator-tooltip'></div>");
    var aC;
    var Z;
    this.$el=bn;
    this.init=function(){
        aq=0;
        J=-1;
        ai=ac.size();
        aC=new Array(ai);
        aG();
        aZ();
        aS();
        bi();
        ax();
        ah.css({
            width:ao,
            height:be+(U==q?I.outerHeight():0)
            });
        if(aw){
            ah.hover(ae,ak)
            }else{
            ah.bind(g,a0)
            }
            var bo=aR.css("background-color");
        Q=new c(this,ao,be,d(bj.vert_size,50),bo,at,d(bj.vstripe_delay,75));
        aK=new t(this,ao,be,d(bj.horz_size,50),bo,at,d(bj.hstripe_delay,75));
        aX=new l(this,ao,be,d(bj.block_size,75),bo,at,d(bj.block_delay,25));
        a3(0);
        aE(aq)
        };

    this.setComplete=function(bo){
        D(bo)
        };

    this.addToScreen=function(bo){
        ar.append(bo)
        };

    this.centerImg=function(){
        return X
        };

    var aG=function(){
        var bo="<a href='#'></a>								<div class='desc'></div>								<div class='preloader'></div>								<div id='timer'></div>";
        aR.empty().append(bo);
        ar=aR.find(">a:first");
        aO=aR.find("div.desc");
        E=aR.find("div.preloader");
        aR.css({
            width:ao,
            height:be
        });
        aO.append("<div class='inner-bg'></div><div class='inner-text'></div>");
        Z=aO.find("div.inner-text")
        };

    var bi=function(){
        if(F||aH||aF){
            aY.css("height",ac.outerHeight());
            var bq=ao-(K.width()+a9);
            if(aY.width()>bq){
                aY.width(bq)
                }
                if(U==k){
                I.css({
                    "margin-top":a9,
                    "margin-right":0,
                    "margin-bottom":a9,
                    "margin-left":a9
                });
                var bp=I.outerWidth(true);
                var bo=I.outerHeight(true);
                switch(a1){
                    case y:
                        a2(0,0,-bo,"left");
                        break;
                    case w:
                        a2(0,Math.round((ao-bp)/2),-bo,"right");
                        break;
                    case e:
                        a2(0,(ao-bp),-bo,"right");
                        break;
                    case u:
                        a2((be-bo),0,be,"left");
                        break;
                    case n:
                        a2((be-bo),Math.round((ao-bp)/2),be,"right");
                        break;
                    default:
                        a2((be-bo),(ao-bp),be,"right")
                        }
                        if(aA){
                    ah.hover(bl,aB)
                    }
                }else{
            if(ah.outerWidth()-ah.width()>0){
                I.css({
                    "border-left":"none",
                    "border-right":"none"
                })
                }
                I.css({
                "padding-top":a9,
                "padding-bottom":a9
            }).addClass("cp-bg");
            var bp=I.outerWidth();
            switch(a1){
                case y:
                    aM(I.outerHeight(),0,a9,"left");
                    break;
                case w:
                    aM(I.outerHeight(),0,Math.round((ao-bp)/2),"right");
                    break;
                case e:
                    aM(I.outerHeight(),0,ao-bp,"right");
                    break;
                case u:
                    aM(0,be,a9,"left");
                    break;
                case n:
                    aM(0,be,Math.round((ao-bp)/2),"right");
                    break;
                default:
                    aM(0,be,ao-bp,"right")
                    }
                }
        I.css("visibility","visible")
    }
};

var a2=function(bo,bq,bp,br){
    I.data({
        offset:bp,
        pos:bo
    }).css({
        top:(aA?bp:bo),
        left:bq
    });
    aY.css("float",br);
    K.css("float",br)
    };

var aM=function(bp,bq,bo,br){
    aR.css("top",bp);
    I.css(bp==0?"border-bottom":"border-top","none");
    I.css({
        top:bq,
        "padding-left":bo,
        "padding-right":ao-(bo+I.outerWidth())
        });
    aY.css("float",br);
    K.css("float",br)
    };

var aS=function(){
    var bo={
        "margin-right":a9,
        width:ag,
        height:aV
    };

    if(aH){
        P.css(bo).click(ap).mouseover(G).mouseout(aW).mousedown(aj);
        a6.css(bo).click(L).mouseover(G).mouseout(aW).mousedown(aj)
        }else{
        P.hide();
        a6.hide()
        }
        if(aF){
        if(aJ){
            R.addClass("pause")
            }
            R.css(bo).click(ad).mouseover(G).mouseout(aW).mousedown(aj)
        }else{
        R.hide()
        }
        if(aa){
        ah.hover(aN,Y)
        }
    };

var ax=function(){
    S=aR.find("#timer").data("pct",1);
    if(bj.display_timer){
        var bo=bj.timer_align.toLowerCase();
        S.css("visibility","visible");
        S.css(bo=="bottom"?"bottom":"top",0)
        }else{
        S.hide()
        }
    };

var aZ=function(){
    var bo=Z.outerHeight()-Z.height();
    ac.each(function(bq){
        var bp=a(this).find(">a:first");
        a(this).data({
            imgurl:bp.attr("href"),
            caption:bp.attr("title"),
            tturl:bp.find(">img:first").attr("src"),
            effect:h[a(this).attr("effect")]!=undefined?h[a(this).attr("effect")]:h[al],
            delay:d(a(this).attr("delay"),W)
            });
        bb(a(this),bo);
        aC[bq]=a(this);
        if(bj.display_numbers){
            a(this).append(bq+1)
            }
        });
Z.css({
    width:"auto",
    height:"auto"
}).html("");
aO.css("visibility","visible");
if(bj.shuffle){
    O()
    }
    if(F){
    aY.click(ay);
    ac.css({
        width:ag,
        height:aV,
        "line-height":aV+"px",
        "margin-right":a9
    }).mouseover(bd).mouseout(V).mousedown(aj);
    if(ab=="text"||ab=="image"){
        bc()
        }
    }else{
    ac.hide()
    }
};

var bb=function(bo,bq){
    var bp=bo.find(">div:hidden");
    var bs=d(parseInt(bp.css("width"))-bq,300);
    var br=d(parseInt(bp.css("height"))-bq,0);
    Z.width(bs).html(bp.html());
    if(br<Z.height()){
        br=Z.height()
        }
        bo.data("textbox",{
        x:bp.css("left"),
        y:bp.css("top"),
        w:bs+bq,
        h:br+bq,
        color:bp.css("color"),
        bgcolor:bp.css("background-color")
        })
    };

var bc=function(){
    a("body").append(M);
    var bp,bo,bq;
    if(ab=="text"){
        bp="<div class='tt-txt'></div>";
        bo="txt-up";
        bq="txt-down";
        ac.mouseover(bg).mouseout(aL).bind("mousemove",T)
        }else{
        if(ab=="image"){
            bp="<img class='tt-img'/>";
            bo="img-up";
            bq="img-down";
            ac.mouseover(ba).mouseout(aL).bind("mousemove",az)
            }
        }
    M.append(bp);
switch(a1){
    case y:case w:case e:
        M.data("bottom",true).addClass(bq);
        break;
    default:
        M.data("bottom",false).addClass(bo)
        }
        if(jQuery.browser.msie&&parseInt(jQuery.browser.version)<=6){
    M.css("background-image","none").find(":only-child").css("margin",0)
    }
};

var ba=function(bp){
    var br=aC[a(this).index()].data("tturl");
    if(br!=undefined){
        var bo=M.find(">img.tt-img");
        bo.attr("src",br);
        if(bo[0].complete||bo[0].readyState=="complete"){
            var bq=M.data("bottom")?0:-M.outerHeight(true);
            M.css({
                top:bp.pageY+bq,
                left:bp.pageX-M.outerWidth()/2
                }).stop(true,true).delay(m).fadeIn(300)
            }
        }
};

var az=function(bo){
    var bp=M.data("bottom")?0:-M.outerHeight(true);
    M.css({
        top:bo.pageY+bp,
        left:bo.pageX-M.outerWidth()/2
        })
    };

var bg=function(bp){
    var bo=aC[a(this).index()].data("caption");
    if(bo!=""){
        M.find(">div.tt-txt").html(bo);
        var bq=M.data("bottom")?0:-M.outerHeight(true);
        M.css({
            top:bp.pageY+bq,
            left:bp.pageX
            }).stop(true,true).delay(m).fadeIn(300)
        }
    };

var T=function(bo){
    var bp=M.data("bottom")?0:-M.outerHeight(true);
    M.css({
        top:bo.pageY+bp,
        left:bo.pageX
        })
    };

var aL=function(){
    M.stop(true,true).fadeOut(0)
    };

var bl=function(){
    I.stop(true).animate({
        top:I.data("pos"),
        opacity:1
    },v)
    };

var aB=function(){
    I.stop(true).animate({
        top:I.data("offset"),
        opacity:0
    },v)
    };

var ay=function(bp){
    if(bp.target.nodeName=="LI"){
        var bo=a(bp.target).index();
        if(bo>=0&&bo!=aq){
            a7();
            J=aq;
            aq=bo;
            aE(aq);
            aL()
            }
        }
    return false
};

var bd=function(){
    a(this).addClass("thumb-over")
    };

var V=function(){
    a(this).removeClass("thumb-over")
    };

var ap=function(){
    a7();
    J=aq;
    aq=(aq>0)?(aq-1):(ai-1);
    aE(aq);
    return false
    };

var L=function(){
    a7();
    J=aq;
    aq=(aq<ai-1)?(aq+1):0;
    aE(aq);
    return false
    };

var ad=function(){
    aJ=!aJ;
    a(this).toggleClass("pause",aJ);
    aJ?aQ():N();
    return false
    };

var Y=function(){
    aJ=true;
    R.toggleClass("pause",aJ);
    aQ()
    };

var aN=function(){
    aJ=false;
    R.toggleClass("pause",aJ);
    N()
    };

var aD=function(bo){
    if(bo==ai-1){
        aJ=false;
        R.toggleClass("pause",aJ)
        }
    };

var G=function(){
    a(this).addClass("button-over")
    };

var aW=function(){
    a(this).removeClass("button-over")
    };

var a0=function(bp){
    if(!aO.data("visible")){
        aO.data("visible",true);
        var bq=aC[aq].find(">div:first").html();
        if(bq&&bq.length>0){
            var bo=aC[aq].data("textbox");
            Z.css("color",bo.color);
            aO.find(".inner-bg").css("background-color",bo.bgcolor);
            switch(z[av]){
                case z.fade:
                    aU(bq,bo);
                    break;
                case z.down:
                    a8(bq,{
                    display:"block",
                    top:bo.y,
                    left:bo.x,
                    width:bo.w,
                    height:0
                },{
                    height:bo.h
                    });
                break;
                case z.right:
                    a8(bq,{
                    display:"block",
                    top:bo.y,
                    left:bo.x,
                    width:0,
                    height:bo.h
                    },{
                    width:bo.w
                    });
                break;
                default:
                    bm(bq,bo)
                    }
                }
    }
};

var a8=function(bq,bp,bo){
    Z.html("");
    aO.stop(true).css(bp).animate(bo,v,function(){
        Z.html(bq)
        })
    };

var aU=function(bp,bo){
    Z.css("opacity",1).html(bp);
    aO.css({
        top:bo.y,
        left:bo.x,
        width:bo.w,
        height:bo.h
        }).stop(true,true).fadeIn(v,function(){
        if(jQuery.browser.msie){
            Z[0].style.removeAttribute("filter")
            }
        })
};

var bm=function(bp,bo){
    aO.stop(true).css({
        display:"block",
        top:bo.y,
        left:bo.x,
        width:bo.w,
        height:bo.h
        });
    Z.html(bp)
    };

var ae=function(){
    ah.unbind(g).bind(g,a0).trigger(g)
    };

var ak=function(){
    ah.unbind(g);
    bf()
    };

var aE=function(bq){
    if(au){
        aD(bq)
        }
        ac.filter(".curr-thumb").removeClass("curr-thumb");
    a(ac.get(bq)).addClass("curr-thumb");
    H=aC[bq].data("delay");
    bf();
    if(!bk){
        ah.trigger(g)
        }
        var br=aC[bq].find(">a:nth-child(2)");
    var bo=br.attr("href");
    if(bo){
        ar.unbind("click").css("cursor","pointer").attr({
            href:bo,
            target:br.attr("target")
            })
        }else{
        ar.click(aj).css("cursor","default")
        }
        if(aC[bq].data("img")){
        E.hide();
        aI(aC[bq].data("img"))
        }else{
        var bp=a("<img class='main-img'/>");
        bp.attr("src",aC[bq].data("imgurl"));
        if(bp[0].complete||bp[0].readyState=="complete"){
            E.hide();
            bh(aC[bq],bp);
            aI(bp)
            }else{
            E.show();
            bp.load(function(){
                E.hide();
                bh(aC[bq],a(this));
                aI(a(this))
                }).error(function(){
                alert("Error loading image")
                })
            }
        }
};

var aI=function(bo){
    Q.clear();
    aK.clear();
    aX.clear();
    am();
    var bp=aC[aq].data("effect");
    if(bp==h.none){
        D(bo);
        return
    }
    if(bp==h.random){
        bp=Math.floor(Math.random()*(h.length-2))
        }
        if(bp==h.fade){
        a4(bo)
        }else{
        if(bp<h["vert.tl"]){
            aX.displayContent(bo,bp)
            }else{
            if(bp<h["horz.tl"]){
                Q.displayContent(bo,bp)
                }else{
                aK.displayContent(bo,bp)
                }
            }
    }
};

var am=function(){
    if(J>=0){
        var bp=a("img#curr-img").attr("src");
        var bq=aC[J].data("imgurl");
        if(bp!=bq){
            a("img.main-img",ar).removeAttr("id").hide();
            var bo=a("img.main-img",ar).filter(function(){
                return a(this).attr("src")==bq
                });
            a(bo.get(0)).show()
            }
        }
};

var D=function(bo){
    if(bk){
        ah.trigger(g)
        }
        a("img.main-img",ar).removeAttr("id").hide();
    bo.attr("id","curr-img").show();
    aQ()
    };

var a4=function(bo){
    a("img#curr-img",ar).stop(true,true);
    a("img.main-img",ar).removeAttr("id").css("z-index",0);
    bo.attr("id","curr-img").css("z-index",1).stop(true,true).fadeIn(at,function(){
        a("img.main-img:not('#curr-img')",ar).hide();
        if(bk){
            ah.trigger(g)
            }
            aQ()
        })
    };

var a3=function(bp){
    var bo=aC[bp];
    var bq=a("<img class='main-img'/>");
    bq.attr("src",bo.data("imgurl"));
    bq.load(function(){
        if(!bo.data("img")){
            bh(bo,a(this))
            }
            bp++;
        if(bp<ai){
            a3(bp)
            }
        }).error(function(){
    bp++;
    if(bp<ai){
        a3(bp)
        }
    })
};

var bh=function(bq,bs){
    ar.append(bs);
    if(X){
        var bv=(be-bs.height())/2;
        var br=(ao-bs.width())/2;
        var bu=0,bt=0,bp=0,bo=0;
        if(bv>0){
            bp=bv
            }else{
            if(bv<0){
                bu=bv
                }
            }
        if(br>0){
        bo=br
        }else{
        if(br<0){
            bt=br
            }
        }
    bs.css({
    top:bu,
    left:bt,
    "padding-top":bp,
    "padding-bottom":bp,
    "padding-left":bo,
    "padding-right":bo
})
}
bq.data("img",bs)
};

var aQ=function(){
    if(aJ&&a5==null){
        var bo=Math.round(S.data("pct")*H);
        S.animate({
            width:(ao+1)
            },bo);
        a5=setTimeout(L,bo)
        }
    };

var a7=function(){
    clearTimeout(a5);
    a5=null;
    S.stop(true).width(0).data("pct",1)
    };

var N=function(){
    clearTimeout(a5);
    a5=null;
    var bo=1-(S.width()/(ao+1));
    S.stop(true).data("pct",bo)
    };

var O=function(){
    for(var bq=0;bq<aC.length;bq++){
        var bo=Math.floor(Math.random()*aC.length);
        var bp=aC[bq];
        aC[bq]=aC[bo];
        aC[bo]=bp
        }
    };

var aj=function(){
    return false
    };

this.setMouseoverPause=function(bo){
    aa=bo;
    if(aa){
        ah.bind("mouseenter",aN).bind("mouseleave",Y)
        }else{
        ah.unbind("mouseenter",aN).unbind("mouseleave",Y)
        }
    };

this.setMouseoverText=function(bo){
    aw=bo;
    if(aw){
        ak();
        ah.bind("mouseenter",ae).bind("mouseleave",ak)
        }else{
        ae();
        ah.unbind("mouseenter",ae).unbind("mouseleave",ak)
        }
    };

this.setMouseoverCPanel=function(bo){
    aA=bo;
    if(aA&&U==k){
        aB();
        ah.bind("mouseenter",bl).bind("mouseleave",aB)
        }else{
        bl();
        ah.unbind("mouseenter",bl).unbind("mouseleave",aB)
        }
    };

this.setTransition=function(bo){
    al=bo;
    ac.data("effect",h[al])
    };

this.setTextEffect=function(bo){
    av=bo
    };

var aP;
this.setThumbs=function(bo){
    if(aP==undefined){
        aP=aY.width()
        }
        F=bo;
    if(F){
        aY.width(aP).show()
        }else{
        aY.hide().width(0)
        }
        an()
    };

var af=31;
this.setDButtons=function(bo){
    aH=bo;
    if(aH){
        P.show();
        a6.show();
        if(aF){
            K.width(3*af)
            }else{
            K.width(2*af)
            }
        }else{
    P.hide();
    a6.hide();
    if(aF){
        K.width(af)
        }else{
        K.width(0)
        }
    }
an()
};

this.setPlayButton=function(bo){
    aF=bo;
    if(aF){
        R.show();
        if(aH){
            K.width(3*af)
            }else{
            K.width(af)
            }
        }else{
    R.hide();
    if(aH){
        K.width(2*af)
        }else{
        K.width(0)
        }
    }
an()
};

this.setTimerBar=function(bo){
    displayTimer=bo;
    if(displayTimer){
        S.css({
            visibility:"visible"
        })
        }else{
        S.css({
            visibility:"hidden"
        })
        }
    };

this.setCpanelAlign=function(bo){
    a1=bo;
    an();
    aT()
    };

this.setCpanelPos=function(bo){
    U=bo;
    an()
    };

var an=function(){
    aR.css("top",0);
    I.css({
        margin:0,
        padding:0,
        top:0,
        left:0,
        border:"none"
    }).removeClass("cp-bg");
    ah.unbind("mouseenter",bl).unbind("mouseleave",aB);
    if(!F&&!aH&&!aF){
        I.hide();
        ah.css({
            width:ao,
            height:be
        });
        return
    }
    if(U==k){
        I.css({
            "margin-top":a9,
            "margin-right":0,
            "margin-bottom":a9,
            "margin-left":a9
        });
        var bp=I.outerWidth(true);
        var bo=I.outerHeight(true);
        switch(a1){
            case y:
                a2(0,0,-bo,"left");
                break;
            case w:
                a2(0,Math.round((ao-bp)/2),-bo,"right");
                break;
            case e:
                a2(0,(ao-bp),-bo,"right");
                break;
            case u:
                a2((be-bo),0,be,"left");
                break;
            case n:
                a2((be-bo),Math.round((ao-bp)/2),be,"right");
                break;
            default:
                a2((be-bo),(ao-bp),be,"right")
                }
                if(aA){
            ah.hover(bl,aB)
            }
            ah.css({
            width:ao,
            height:be
        })
        }else{
        I.stop(true).css({
            opacity:1,
            "padding-top":a9,
            "padding-bottom":a9
        }).addClass("cp-bg");
        var bp=I.outerWidth();
        switch(a1){
            case y:
                aM(I.outerHeight(),0,a9,"left");
                break;
            case w:
                aM(I.outerHeight(),0,Math.round((ao-bp)/2),"right");
                break;
            case e:
                aM(I.outerHeight(),0,ao-bp,"right");
                break;
            case u:
                aM(0,be,a9,"left");
                break;
            case n:
                aM(0,be,Math.round((ao-bp)/2),"right");
                break;
            default:
                aM(0,be,ao-bp,"right")
                }
                ah.css({
            width:ao,
            height:be+I.outerHeight()
            })
        }
        I.show()
    };

this.setTooltipType=function(bo){
    ab=bo;
    aT()
    };

var aT=function(){
    M.remove();
    ac.unbind("mouseover",ba).unbind("mousemove",az).unbind("mouseover",bg).unbind("mousemove",T).unbind("mouseout",aL);
    M=a("<div id='rotator-tooltip'></div>");
    if(ab=="text"){
        M.append("<div class='tt-txt'></div>");
        a("body").append(M);
        switch(a1){
            case y:case w:case e:
                M.data("bottom",true).addClass("txt-down");
                break;
            default:
                M.data("bottom",false).addClass("txt-up")
                }
                for(var bp=0;bp<aC.length;bp++){
            var bo=aC[bp].data("caption");
            if(bo!=""){
                aC[bp].mouseover(bg).mouseout(aL).bind("mousemove",T)
                }
            }
        }else{
    if(ab=="image"){
        M.append("<img class='tt-img'/>");
        a("body").append(M);
        switch(a1){
            case y:case w:case e:
                M.data("bottom",true).addClass("img-down");
                break;
            default:
                M.data("bottom",false).addClass("img-up")
                }
                for(var bp=0;bp<aC.length;bp++){
            var bq=aC[bp].data("tturl");
            if(bq!=undefined){
                aC[bp].mouseover(ba).mouseout(aL).bind("mousemove",az)
                }
            }
        }
}
};

var bf=function(){
    aO.data("visible",false).stop(true,true);
    switch(z[av]){
        case z.down:
            Z.html("");
            aO.animate({
            height:0
        },v);
        break;
        case z.right:
            Z.html("");
            aO.animate({
            width:0
        },v);
        break;
        default:
            aO.css("display","none")
            }
        }
}
var d=function(D,E){
    if(!isNaN(D)&&D>0){
        return D
        }
        return E
    };

var C=function(D,E){
    if(!isNaN(D)&&D>=0){
        return D
        }
        return E
    };

var s=function(D){
    var H=D.length;
    for(var G=0;G<H;G++){
        var E=Math.floor(Math.random()*H);
        var F=D[G];
        D[G]=D[E];
        D[E]=F
        }
    };

var o={
    width:825,
    height:300,
    button_width:24,
    button_height:24,
    button_margin:4,
    auto_start:true,
    delay:p,
    transition:"fade",
    transition_speed:x,
    cpanel_position:k,
    cpanel_align:f,
    timer_align:"top",
    display_thumbs:true,
    display_dbuttons:true,
    display_playbutton:true,
    display_imgtooltip:true,
    display_numbers:true,
    display_timer:true,
    mouseover_pause:false,
    cpanel_mouseover:false,
    text_mouseover:false,
    text_effect:"fade",
    text_sync:true,
    tooltip_type:"text",
    shuffle:false,
    play_once:false,
    auto_center:false,
    block_size:75,
    vert_size:50,
    horz_size:50,
    block_delay:25,
    vstripe_delay:75,
    hstripe_delay:75
};

var r=a.extend({},o,B);
return this.each(function(){
    b=new A(a(this),r);
    b.init()
    })
}
})(jQuery);
