var ob;
var over = false;
var popid;
var popY;

N = (document.all) ? 0 : 1;

function
info_click(item, event)
{
    var iframe = document.getElementById("hidden");
    iframe.src="fileinfo.rpy?dir="+item.id;
    document.getElementById("program-waiting").style.display = "";
    document.getElementById("program-info").style.visibility = "hidden";
    var popup = document.getElementById("popup");
    popup.style.display = "";

    w = N ? window.innerWidth : document.body.clientWidth;
    h = N ? window.innerHeight : document.body.clientHeight;

    //alert(event.clientX + "  "  + popup.clientWidth + "  " + w + "  " + h);
    if (event.clientX + popup.clientWidth > w)
        x = (w - popup.clientWidth) - 30;
    else
        x = event.clientX;
    popup.style.left = x + "px";

    page_top = N ? window.pageYOffset : document.body.scrollTop;

    // We can't use popup.clientHeight because it's not valud until
    // after proginfo.rpy gets executed, so we guess that it'll be
    // about 175.  Someone else can fix this. :)
    if (event.clientY + 175 > h)
        y = page_top + (h - 175) - 20;
    else
        y = page_top + event.clientY;
    popup.style.top = y + "px";
}

function
program_popup_close()
{
    var popup = document.getElementById("popup");
    popup.style.display = "none";
}

function mouseDown(e) {
  if(over) {
    if(N) {
      ob = document.getElementById(popid);
      X = e.layerX;
      Y = e.layerY;
      return false;
    }
    else {
      ob = document.getElementById(popid);
      ob = ob.style;
      X = event.offsetX;
      Y = event.offsetY;
    }
  }
}

function mouseMove(e) {
  if(ob) {
    if(N) {
      ob.style.top = e.pageY-Y;
      ob.style.left = e.pageX-X;
    }
    else {
      ob.pixelLeft = event.clientX-X + document.body.scrollLeft;
      ob.pixelTop = event.clientY-Y + document.body.scrollTop;
      return false;
    }
  }
}

function mouseUp() {
  ob = null;
}

if(N) {
  document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
}

document.onmousedown = mouseDown;
document.onmousemove = mouseMove;
document.onmouseup = mouseUp;





//MooTools, My Object Oriented Javascript Tools. Copyright (c) 2006-2007 Valerio Proietti, <http://mad4milk.net>, MIT Style License.

eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('o 7F={7G:\'1.11\'};k $3p(R){h(R!=5e)};k $q(R){m(!$3p(R))h 1b;m(R.2A)h\'Y\';o q=36 R;m(q==\'2h\'&&R.7E){1L(R.49){14 1:h\'Y\';14 3:h(/\\S/).1Z(R.4Y)?\'7D\':\'7B\'}}m(q==\'2h\'||q==\'k\'){1L(R.5l){14 1s:h\'12\';14 4z:h\'7C\';14 1g:h\'4X\'}m(36 R.O==\'4x\'){m(R.1O)h\'7H\';m(R.5n)h\'M\'}}h q};k $2C(){o 2Z={};F(o i=0;i<M.O;i++){F(o t 18 M[i]){o 3l=M[i][t];o 3o=2Z[t];m(3o&&$q(3l)==\'2h\'&&$q(3o)==\'2h\')2Z[t]=$2C(3o,3l);V 2Z[t]=3l}}h 2Z};o $P=k(){o Q=M;m(!Q[1])Q=[c,Q[0]];F(o t 18 Q[1])Q[0][t]=Q[1][t];h Q[0]};o $2w=k(){F(o i=0,l=M.O;i<l;i++){M[i].P=k(1d){F(o 1i 18 1d){m(!c.1a[1i])c.1a[1i]=1d[1i];m(!c[1i])c[1i]=$2w.3g(1i)}}}};$2w.3g=k(1i){h k(K){h c.1a[1i].2v(K,1s.1a.56.1E(M,1))}};$2w(4P,1s,4o,57);k $35(R){h!!(R||R===0)};k $47(R,5h){h $3p(R)?R:5h};k $4L(2p,2g){h W.7N(W.4L()*(2g-2p+1)+2p)};k $1W(){h U 7O().7M()};k $4s(1w){7L(1w);7J(1w);h 1c};o 2s=k(R){R=R||{};R.P=$P;h R};o 7K=U 2s(E);o 7A=U 2s(L);L.5g=L.3K(\'5g\')[0];E.5d=!!(L.7p);m(E.7q)E.1A=E[E.7o?\'7n\':\'5k\']=1f;V m(L.54&&!L.7k&&!7l.7m)E.2m=E[E.5d?\'7s\':\'4W\']=1f;V m(L.7x!=1c)E.4l=1f;E.7y=E.2m;7w.P=$P;m(36 33==\'5e\'){o 33=k(){};m(E.2m)L.64("7t");33.1a=(E.2m)?E["[[7u.1a]]"]:{}}33.1a.2A=k(){};m(E.5k)4i{L.7P("7Q",1b,1f)}3W(e){};o 1g=k(1P){o 2T=k(){h(M[0]!==1c&&c.1G&&$q(c.1G)==\'k\')?c.1G.2v(c,M):c};$P(2T,c);2T.1a=1P;2T.5l=1g;h 2T};1g.22=k(){};1g.1a={P:k(1P){o 3x=U c(1c);F(o t 18 1P){o 5r=3x[t];3x[t]=1g.5p(5r,1P[t])}h U 1g(3x)},6r:k(){F(o i=0,l=M.O;i<l;i++)$P(c.1a,M[i])}};1g.5p=k(2b,2k){m(2b&&2b!=2k){o q=$q(2k);m(q!=$q(2b))h 2k;1L(q){14\'k\':o 4C=k(){c.21=M.5n.21;h 2k.2v(c,M)};4C.21=2b;h 4C;14\'2h\':h $2C(2b,2k)}}h 2k};o 68=U 1g({8c:k(B){c.2l=c.2l||[];c.2l.1l(B);h c},6i:k(){m(c.2l&&c.2l.O)c.2l.5E().1r(10,c)},8a:k(){c.2l=[]}});o 1R=U 1g({2o:k(q,B){m(B!=1g.22){c.$I=c.$I||{};c.$I[q]=c.$I[q]||[];c.$I[q].4H(B)}h c},1U:k(q,Q,1r){m(c.$I&&c.$I[q]){c.$I[q].1q(k(B){B.1H({\'K\':c,\'1r\':1r,\'M\':Q})()},c)}h c},4d:k(q,B){m(c.$I&&c.$I[q])c.$I[q].2H(B);h c}});o 67=U 1g({6a:k(){c.G=$2C.2v(1c,[c.G].P(M));m(c.2o){F(o 2W 18 c.G){m($q(c.G[2W]==\'k\')&&(/^3V[A-Z]/).1Z(2W))c.2o(2W,c.G[2W])}}h c}});1s.P({3c:k(B,K){F(o i=0,j=c.O;i<j;i++)B.1E(K,c[i],i,c)},5D:k(B,K){o 2y=[];F(o i=0,j=c.O;i<j;i++){m(B.1E(K,c[i],i,c))2y.1l(c[i])}h 2y},1N:k(B,K){o 2y=[];F(o i=0,j=c.O;i<j;i++)2y[i]=B.1E(K,c[i],i,c);h 2y},3a:k(B,K){F(o i=0,j=c.O;i<j;i++){m(!B.1E(K,c[i],i,c))h 1b}h 1f},89:k(B,K){F(o i=0,j=c.O;i<j;i++){m(B.1E(K,c[i],i,c))h 1f}h 1b},2K:k(1O,H){o 2L=c.O;F(o i=(H<0)?W.2g(0,2L+H):H||0;i<2L;i++){m(c[i]===1O)h i}h-1},53:k(1o,O){1o=1o||0;m(1o<0)1o=c.O+1o;O=O||(c.O-1o);o 4G=[];F(o i=0;i<O;i++)4G[i]=c[1o++];h 4G},2H:k(1O){o i=0;o 2L=c.O;5O(i<2L){m(c[i]===1O){c.3L(i,1);2L--}V{i++}}h c},15:k(1O,H){h c.2K(1O,H)!=-1},87:k(1j){o R={},O=W.2p(c.O,1j.O);F(o i=0;i<O;i++)R[1j[i]]=c[i];h R},P:k(12){F(o i=0,j=12.O;i<j;i++)c.1l(12[i]);h c},2C:k(12){F(o i=0,l=12.O;i<l;i++)c.4H(12[i]);h c},4H:k(1O){m(!c.15(1O))c.1l(1O);h c},8e:k(){h c[$4L(0,c.O-1)]||1c},5T:k(){h c[c.O-1]||1c}});1s.1a.1q=1s.1a.3c;1s.1q=1s.3c;k $A(12){h 1s.53(12)};k $1q(28,B,K){m(28&&36 28.O==\'4x\'&&$q(28)!=\'2h\'){1s.3c(28,B,K)}V{F(o 1x 18 28)B.1E(K||28,28[1x],1x)}};1s.1a.1Z=1s.1a.15;4o.P({1Z:k(3i,1D){h(($q(3i)==\'1S\')?U 4z(3i,1D):3i).1Z(c)},3M:k(){h 2N(c,10)},51:k(){h 2R(c)},4O:k(){h c.2a(/-\\D/g,k(1T){h 1T.4K(1).59()})},5V:k(){h c.2a(/\\w[A-Z]/g,k(1T){h(1T.4K(0)+\'-\'+1T.4K(1).30())})},5N:k(){h c.2a(/\\b[a-z]/g,k(1T){h 1T.59()})},55:k(){h c.2a(/^\\s+|\\s+$/g,\'\')},4y:k(){h c.2a(/\\s{2,}/g,\' \').55()},3k:k(12){o 1z=c.1T(/\\d{1,3}/g);h(1z)?1z.3k(12):1b},3I:k(12){o 2u=c.1T(/^#?(\\w{1,2})(\\w{1,2})(\\w{1,2})$/);h(2u)?2u.56(1).3I(12):1b},15:k(1S,s){h(s)?(s+c+s).2K(s+1S+s)>-1:c.2K(1S)>-1},7W:k(){h c.2a(/([.*+?^${}()|[\\]\\/\\\\])/g,\'\\\\$1\')}});1s.P({3k:k(12){m(c.O<3)h 1b;m(c.O==4&&c[3]==0&&!12)h\'7U\';o 2u=[];F(o i=0;i<3;i++){o 2B=(c[i]-0).7T(16);2u.1l((2B.O==1)?\'0\'+2B:2B)}h 12?2u:\'#\'+2u.1J(\'\')},3I:k(12){m(c.O!=3)h 1b;o 1z=[];F(o i=0;i<3;i++){1z.1l(2N((c[i].O==1)?c[i]+c[i]:c[i],16))}h 12?1z:\'1z(\'+1z.1J(\',\')+\')\'}});4P.P({1H:k(G){o B=c;G=$2C({\'K\':B,\'u\':1b,\'M\':1c,\'1r\':1b,\'2r\':1b,\'3e\':1b},G);m($35(G.M)&&$q(G.M)!=\'12\')G.M=[G.M];h k(u){o Q;m(G.u){u=u||E.u;Q=[(G.u===1f)?u:U G.u(u)];m(G.M)Q.P(G.M)}V Q=G.M||M;o 1X=k(){h B.2v($47(G.K,B),Q)};m(G.1r)h 7X(1X,G.1r);m(G.2r)h 7Y(1X,G.2r);m(G.3e)4i{h 1X()}3W(83){h 1b};h 1X()}},84:k(Q,K){h c.1H({\'M\':Q,\'K\':K})},3e:k(Q,K){h c.1H({\'M\':Q,\'K\':K,\'3e\':1f})()},K:k(K,Q){h c.1H({\'K\':K,\'M\':Q})},7j:k(K,Q){h c.1H({\'K\':K,\'u\':1f,\'M\':Q})},1r:k(1r,K,Q){h c.1H({\'1r\':1r,\'K\':K,\'M\':Q})()},2r:k(5b,K,Q){h c.1H({\'2r\':5b,\'K\':K,\'M\':Q})()}});57.P({3M:k(){h 2N(c)},51:k(){h 2R(c)},80:k(2p,2g){h W.2p(2g,W.2g(2p,c))},2E:k(2Y){2Y=W.2i(10,2Y||0);h W.2E(c*2Y)/2Y},6U:k(B){F(o i=0;i<c;i++)B(i)}});o C=U 1g({1G:k(r,1d){m($q(r)==\'1S\'){m(E.1A&&1d&&(1d.1x||1d.q)){o 1x=(1d.1x)?\' 1x="\'+1d.1x+\'"\':\'\';o q=(1d.q)?\' q="\'+1d.q+\'"\':\'\';4n 1d.1x;4n 1d.q;r=\'<\'+r+1x+q+\'>\'}r=L.64(r)}r=$(r);h(!1d||!r)?r:r.2t(1d)}});o 2q=U 1g({1G:k(X){h(X)?$P(X,c):c}});2q.P=k(1d){F(o 1i 18 1d){c.1a[1i]=1d[1i];c[1i]=$2w.3g(1i)}};k $(r){m(!r)h 1c;m(r.2A)h 1t.2x(r);m([E,L].15(r))h r;o q=$q(r);m(q==\'1S\'){r=L.6V(r);q=(r)?\'Y\':1b}m(q!=\'Y\')h 1c;m(r.2A)h 1t.2x(r);m([\'2h\',\'6R\'].15(r.5x.30()))h r;$P(r,C.1a);r.2A=k(){};h 1t.2x(r)};L.5u=L.3K;k $$(){o X=[];F(o i=0,j=M.O;i<j;i++){o 2G=M[i];1L($q(2G)){14\'Y\':X.1l(2G);14\'6Q\':1v;14 1b:1v;14\'1S\':2G=L.5u(2G,1f);4u:X.P(2G)}}h $$.4t(X)};$$.4t=k(12){o X=[];F(o i=0,l=12.O;i<l;i++){m(12[i].$3F)5f;o Y=$(12[i]);m(Y&&!Y.$3F){Y.$3F=1f;X.1l(Y)}}F(o n=0,d=X.O;n<d;n++)X[n].$3F=1c;h U 2q(X)};2q.3J=k(t){h k(){o Q=M;o 3Q=[];o X=1f;F(o i=0,j=c.O,1X;i<j;i++){1X=c[i][t].2v(c[i],Q);m($q(1X)!=\'Y\')X=1b;3Q.1l(1X)};h(X)?$$.4t(3Q):3Q}};C.P=k(1P){F(o t 18 1P){33.1a[t]=1P[t];C.1a[t]=1P[t];C[t]=$2w.3g(t);o 5P=(1s.1a[t])?t+\'2q\':t;2q.1a[5P]=2q.3J(t)}};C.P({2t:k(1d){F(o 1i 18 1d){o 2M=1d[1i];1L(1i){14\'7b\':c.5I(2M);1v;14\'I\':m(c.4c)c.4c(2M);1v;14\'1P\':c.4Z(2M);1v;4u:c.3q(1i,2M)}}h c},2D:k(r,60){r=$(r);1L(60){14\'5B\':r.25.4N(c,r);1v;14\'5C\':o 2P=r.5R();m(!2P)r.25.4v(c);V r.25.4N(c,2P);1v;14\'4j\':o 4q=r.4V;m(4q){r.4N(c,4q);1v}4u:r.4v(c)}h c},79:k(r){h c.2D(r,\'5B\')},7d:k(r){h c.2D(r,\'5C\')},7e:k(r){h c.2D(r,\'5A\')},7h:k(r){h c.2D(r,\'4j\')},7g:k(){o X=[];$1q(M,k(5v){X=X.7f(5v)});$$(X).2D(c);h c},2H:k(){h c.25.5q(c)},78:k(5w){o r=$(c.77(5w!==1b));m(!r.$I)h r;r.$I={};F(o q 18 c.$I)r.$I[q]={\'1j\':$A(c.$I[q].1j),\'2j\':$A(c.$I[q].2j)};h r.3H()},70:k(r){r=$(r);c.25.6Z(r,c);h r},5X:k(1V){c.4v(L.6X(1V));h c},4p:k(1k){h c.1k.15(1k,\' \')},5L:k(1k){m(!c.4p(1k))c.1k=(c.1k+\' \'+1k).4y();h c},5K:k(1k){c.1k=c.1k.2a(U 4z(\'(^|\\\\s)\'+1k+\'(?:\\\\s|$)\'),\'$1\').4y();h c},71:k(1k){h c.4p(1k)?c.5K(1k):c.5L(1k)},3O:k(t,N){1L(t){14\'1u\':h c.5G(2R(N));14\'76\':t=(E.1A)?\'8m\':\'74\'}t=t.4O();1L($q(N)){14\'4x\':m(![\'73\',\'5J\'].15(t))N+=\'2S\';1v;14\'12\':N=\'1z(\'+N.1J(\',\')+\')\'}c.17[t]=N;h c},5I:k(2d){1L($q(2d)){14\'2h\':C.3P(c,\'3O\',2d);1v;14\'1S\':c.17.41=2d}h c},5G:k(1u){m(1u==0){m(c.17.3t!="5H")c.17.3t="5H"}V{m(c.17.3t!="5U")c.17.3t="5U"}m(!c.3u||!c.3u.9x)c.17.5J=1;m(E.1A)c.17.5D=(1u==1)?\'\':"9u(1u="+1u*9v+")";c.17.1u=c.$2c.1u=1u;h c},23:k(t){t=t.4O();o 19=c.17[t];m(!$35(19)){m(t==\'1u\')h c.$2c.1u;19=[];F(o 17 18 C.26){m(t==17){C.26[17].1q(k(s){o 17=c.23(s);19.1l(2N(17)?17:\'5Y\')},c);m(t==\'24\'){o 3a=19.3a(k(2B){h(2B==19[0])});h(3a)?19[0]:1b}h 19.1J(\' \')}}m(t.15(\'24\')){m(C.26.24.15(t)){h[\'5Z\',\'4B\',\'4A\'].1N(k(p){h c.23(t+p)},c).1J(\' \')}V m(C.5a.15(t)){h[\'63\',\'62\',\'5W\',\'5Q\'].1N(k(p){h c.23(\'24\'+p+t.2a(\'24\',\'\'))},c).1J(\' \')}}m(L.5M)19=L.5M.9E(c,1c).9C(t.5V());V m(c.3u)19=c.3u[t]}m(E.1A)19=C.5z(t,19,c);m(19&&t.1Z(/3R/i)&&19.15(\'1z\')){h 19.6e(\'1z\').3L(1,4).1N(k(3R){h 3R.3k()}).1J(\' \')}h 19},9j:k(){h C.4e(c,\'23\',M)},2Q:k(3v,1o){3v+=\'9k\';o r=(1o)?c[1o]:c[3v];5O(r&&$q(r)!=\'Y\')r=r[3v];h $(r)},9f:k(){h c.2Q(\'2b\')},5R:k(){h c.2Q(\'2P\')},9l:k(){h c.2Q(\'2P\',\'4V\')},5T:k(){h c.2Q(\'2b\',\'9n\')},9o:k(){h $(c.25)},9I:k(){h $$(c.54)},4f:k(r){h!!$A(c.3K(\'*\')).15(r)},45:k(t){o 1Y=C.3b[t];m(1Y)h c[1Y];o 4Q=C.5m[t]||0;m(!E.1A||4Q)h c.9W(t,4Q);o 4R=c.a0[t];h(4R)?4R.4Y:1c},a2:k(t){o 1Y=C.3b[t];m(1Y)c[1Y]=\'\';V c.a1(t);h c},9T:k(){h C.4e(c,\'45\',M)},3q:k(t,N){o 1Y=C.3b[t];m(1Y)c[1Y]=N;V c.9L(t,N);h c},4Z:k(2d){h C.3P(c,\'3q\',2d)},5y:k(){c.5o=$A(M).1J(\'\');h c},9J:k(1V){o 2e=c.48();m([\'17\',\'2I\'].15(2e)){m(E.1A){m(2e==\'17\')c.5j.41=1V;V m(2e==\'2I\')c.3q(\'1V\',1V);h c}V{c.5q(c.4V);h c.5X(1V)}}c[$3p(c.4a)?\'4a\':\'5F\']=1V;h c},9d:k(){o 2e=c.48();m([\'17\',\'2I\'].15(2e)){m(E.1A){m(2e==\'17\')h c.5j.41;V m(2e==\'2I\')h c.45(\'1V\')}V{h c.5o}}h($47(c.4a,c.5F))},48:k(){h c.5x.30()},22:k(){1t.3m(c.3K(\'*\'));h c.5y(\'\')}});C.5z=k(t,19,Y){m($35(2N(19)))h 19;m([\'8H\',\'43\'].15(t)){o 2j=(t==\'43\')?[\'6d\',\'6J\']:[\'4j\',\'5A\'];o 3C=0;2j.1q(k(N){3C+=Y.23(\'24-\'+N+\'-43\').3M()+Y.23(\'3Y-\'+N).3M()});h Y[\'8A\'+t.5N()]-3C+\'2S\'}V m(t.1Z(/24(.+)5Z|61|3Y/)){h\'5Y\'}h 19};C.26={\'24\':[],\'3Y\':[],\'61\':[]};[\'63\',\'62\',\'5W\',\'5Q\'].1q(k(5S){F(o 17 18 C.26)C.26[17].1l(17+5S)});C.5a=[\'8M\',\'8N\',\'96\'];C.4e=k(r,3h,1j){o 19={};$1q(1j,k(1y){19[1y]=r[3h](1y)});h 19};C.3P=k(r,3h,4b){F(o 1y 18 4b)r[3h](1y,4b[1y]);h r};C.3b=U 2s({\'4X\':\'1k\',\'F\':\'98\',\'9a\':\'8S\',\'8R\':\'8O\',\'8T\':\'8V\',\'8W\':\'8X\',\'8Y\':\'8Z\',\'8U\':\'8P\',\'8Q\':\'90\',\'N\':\'N\',\'52\':\'52\',\'58\':\'58\',\'5t\':\'5t\',\'5c\':\'5c\'});C.5m={\'8u\':2,\'3z\':2};C.29={3r:{2n:k(q,B){m(c.4m)c.4m(q,B,1b);V c.8w(\'3V\'+q,B);h c},69:k(q,B){m(c.5s)c.5s(q,B,1b);V c.8y(\'3V\'+q,B);h c}}};E.P(C.29.3r);L.P(C.29.3r);C.P(C.29.3r);o 1t={X:[],2x:k(r){m(!r.$2c){1t.X.1l(r);r.$2c={\'1u\':1}}h r},3m:k(X){F(o i=0,j=X.O,r;i<j;i++){m(!(r=X[i])||!r.$2c)5f;m(r.$I)r.1U(\'3m\').3H();F(o p 18 r.$2c)r.$2c[p]=1c;F(o d 18 C.1a)r[d]=1c;1t.X[1t.X.2K(r)]=1c;r.2A=r.$2c=r=1c}1t.X.2H(1c)},22:k(){1t.2x(E);1t.2x(L);1t.3m(1t.X)}};E.2n(\'6f\',k(){E.2n(\'3X\',1t.22);m(E.1A)E.2n(\'3X\',9R)});o 1C=U 1g({1G:k(u){m(u&&u.$5i)h u;c.$5i=1f;u=u||E.u;c.u=u;c.q=u.q;c.2z=u.2z||u.9Y;m(c.2z.49==3)c.2z=c.2z.25;c.5E=u.9B;c.75=u.9H;c.9S=u.9P;c.8B=u.8K;m([\'44\',\'3n\'].15(c.q)){c.8I=(u.6z)?u.6z/8z:-(u.8r||0)/3}V m(c.q.15(\'1y\')){c.3y=u.6s||u.8o;F(o 1x 18 1C.1j){m(1C.1j[1x]==c.3y){c.1y=1x;1v}}m(c.q==\'6L\'){o 3s=c.3y-8s;m(3s>0&&3s<13)c.1y=\'f\'+3s}c.1y=c.1y||4o.8v(c.3y).30()}V m(c.q.1Z(/(6w|9c|9b)/)){c.99={\'x\':u.4k||u.65+L.1B.6E,\'y\':u.4g||u.6q+L.1B.6A};c.91={\'x\':u.4k?u.4k-E.6H:u.65,\'y\':u.4g?u.4g-E.6y:u.6q};c.97=(u.6s==3)||(u.93==2);1L(c.q){14\'3Z\':c.1m=u.1m||u.92;1v;14\'42\':c.1m=u.1m||u.94}c.6K()}h c},31:k(){h c.3j().3d()},3j:k(){m(c.u.3j)c.u.3j();V c.u.95=1f;h c},3d:k(){m(c.u.3d)c.u.3d();V c.u.8x=1b;h c}});1C.3B={1m:k(){m(c.1m&&c.1m.49==3)c.1m=c.1m.25},6j:k(){4i{1C.3B.1m.1E(c)}3W(e){c.1m=c.2z}}};1C.1a.6K=(E.4l)?1C.3B.6j:1C.3B.1m;1C.1j=U 2s({\'8t\':13,\'8n\':38,\'8q\':40,\'6d\':37,\'6J\':39,\'8J\':27,\'8L\':32,\'8G\':8,\'8C\':9,\'4n\':46});C.29.1R={2o:k(q,B){c.$I=c.$I||{};c.$I[q]=c.$I[q]||{\'1j\':[],\'2j\':[]};m(c.$I[q].1j.15(B))h c;c.$I[q].1j.1l(B);o 3G=q;o 1n=C.1R[q];m(1n){m(1n.4T)1n.4T.1E(c,B);m(1n.1N)B=1n.1N;m(1n.q)3G=1n.q}m(!c.4m)B=B.1H({\'K\':c,\'u\':1f});c.$I[q].2j.1l(B);h(C.4h.15(3G))?c.2n(3G,B):c},4d:k(q,B){m(!c.$I||!c.$I[q])h c;o 1F=c.$I[q].1j.2K(B);m(1F==-1)h c;o 1y=c.$I[q].1j.3L(1F,1)[0];o N=c.$I[q].2j.3L(1F,1)[0];o 1n=C.1R[q];m(1n){m(1n.2H)1n.2H.1E(c,B);m(1n.q)q=1n.q}h(C.4h.15(q))?c.69(q,N):c},4c:k(2d){h C.3P(c,\'2o\',2d)},3H:k(q){m(!c.$I)h c;m(!q){F(o 3A 18 c.$I)c.3H(3A);c.$I=1c}V m(c.$I[q]){c.$I[q].1j.1q(k(B){c.4d(q,B)},c);c.$I[q]=1c}h c},1U:k(q,Q,1r){m(c.$I&&c.$I[q]){c.$I[q].1j.1q(k(B){B.1H({\'K\':c,\'1r\':1r,\'M\':Q})()},c)}h c},6D:k(H,q){m(!H.$I)h c;m(!q){F(o 3A 18 H.$I)c.6D(H,3A)}V m(H.$I[q]){H.$I[q].1j.1q(k(B){c.2o(q,B)},c)}h c}};E.P(C.29.1R);L.P(C.29.1R);C.P(C.29.1R);C.1R=U 2s({\'6C\':{q:\'3Z\',1N:k(u){u=U 1C(u);m(u.1m!=c&&!c.4f(u.1m))c.1U(\'6C\',u)}},\'6B\':{q:\'42\',1N:k(u){u=U 1C(u);m(u.1m!=c&&!c.4f(u.1m))c.1U(\'6B\',u)}},\'3n\':{q:(E.4l)?\'44\':\'3n\'}});C.4h=[\'6w\',\'8D\',\'9e\',\'8E\',\'3n\',\'44\',\'3Z\',\'42\',\'8F\',\'6L\',\'9M\',\'9Q\',\'6P\',\'3X\',\'6f\',\'9O\',\'9N\',\'9K\',\'9U\',\'6p\',\'a3\',\'9Z\',\'2U\',\'9V\',\'9X\',\'9p\',\'6u\'];4P.P({9q:k(K,Q){h c.1H({\'K\':K,\'M\':Q,\'u\':1C})}});C.1R.4U={4T:k(B){m(E.3w){B.1E(c);h}o 2O=k(){m(E.3w)h;E.3w=1f;E.1w=$4s(E.1w);c.1U(\'4U\')}.K(c);m(L.3f&&E.2m){E.1w=k(){m([\'3w\',\'6O\'].15(L.3f))2O()}.2r(50)}V m(L.3f&&E.1A){m(!$(\'4S\')){o 3z=(E.9r.9m==\'9g:\')?\'://0\':\'9h:9i(0)\';L.9s(\'<2I 9t="4S" 9D 3z="\'+3z+\'"><\\/2I>\');$(\'4S\').9F=k(){m(c.3f==\'6O\')2O()}}}V{E.2n("6P",2O);L.2n("9G",2O)}}};E.9A=k(B){h c.2o(\'4U\',B)};E.P({6I:k(){m(c.4W)h c.9w;m(c.6G)h L.3U.6x;h L.1B.6x},6N:k(){m(c.4W)h c.9z;m(c.6G)h L.3U.6F;h L.1B.6F},6M:k(){m(c.1A)h W.2g(L.1B.9y,L.1B.4M);m(c.2m)h L.3U.4M;h L.1B.4M},6v:k(){m(c.1A)h W.2g(L.1B.8p,L.1B.4w);m(c.2m)h L.3U.4w;h L.1B.4w},6g:k(){h c.6H||L.1B.6E},6b:k(){h c.6y||L.1B.6A},72:k(){h{\'3C\':{\'x\':c.6I(),\'y\':c.6N()},\'6Y\':{\'x\':c.6M(),\'y\':c.6v()},\'6u\':{\'x\':c.6g(),\'y\':c.6b()}}},7a:k(){h{\'x\':0,\'y\':0}}});o T={};T.3D=U 1g({G:{6m:1g.22,6h:1g.22,6n:1g.22,1h:k(p){h-(W.66(W.4D*p)-1)/2},4r:6W,1Q:\'2S\',3S:1f,6l:50},1G:k(G){c.Y=c.Y||1c;c.6a(G);m(c.G.1G)c.G.1G.1E(c)},6o:k(){o 1W=$1W();m(1W<c.1W+c.G.4r){c.6t=c.G.1h((1W-c.1W)/c.G.4r);c.3E();c.3N()}V{c.31(1f);c.2t(c.J);c.1U(\'6h\',c.Y,10);c.6i()}},2t:k(J){c.1p=J;c.3N();h c},3E:k(){c.1p=c.2X(c.H,c.J)},2X:k(H,J){h(J-H)*c.6t+H},1o:k(H,J){m(!c.G.3S)c.31();V m(c.1w)h c;c.H=H;c.J=J;c.6p=c.J-c.H;c.1W=$1W();c.1w=c.6o.2r(W.2E(7c/c.G.6l),c);c.1U(\'6m\',c.Y);h c},31:k(3T){m(!c.1w)h c;c.1w=$4s(c.1w);m(!3T)c.1U(\'6n\',c.Y);h c},1n:k(H,J){h c.1o(H,J)},7i:k(3T){h c.31(3T)}});T.3D.6r(U 68,U 1R,U 67);T.2f={2U:k(t,J){m(t.1Z(/3R/i))h c.4A;o q=$q(J);m((q==\'12\')||(q==\'1S\'&&J.15(\' \')))h c.3J;h c.6c},1K:k(r,t,2J){m(!2J.1l)2J=[2J];o H=2J[0],J=2J[1];m(!$35(J)){J=H;H=r.23(t)}o 1e=c.2U(t,J);h{\'H\':1e.1K(H),\'J\':1e.1K(J),\'1e\':1e}}};T.2f.6c={1K:k(N){h 2R(N)},2V:k(H,J,2F){h 2F.2X(H,J)},34:k(N,1Q,t){m(1Q==\'2S\'&&t!=\'1u\')N=W.2E(N);h N+1Q}};T.2f.3J={1K:k(N){h N.1l?N:N.6e(\' \').1N(k(v){h 2R(v)})},2V:k(H,J,2F){o 1p=[];F(o i=0;i<H.O;i++)1p[i]=2F.2X(H[i],J[i]);h 1p},34:k(N,1Q,t){m(1Q==\'2S\'&&t!=\'1u\')N=N.1N(W.2E);h N.1J(1Q+\' \')+1Q}};T.2f.4A={1K:k(N){h N.1l?N:N.3I(1f)},2V:k(H,J,2F){o 1p=[];F(o i=0;i<H.O;i++)1p[i]=W.2E(2F.2X(H[i],J[i]));h 1p},34:k(N){h\'1z(\'+N.1J(\',\')+\')\'}};T.4B=T.3D.P({1G:k(r,t,G){c.Y=$(r);c.t=t;c.21(G)},6S:k(){h c.2t(0)},3E:k(){c.1p=c.1e.2V(c.H,c.J,c)},2t:k(J){c.1e=T.2f.2U(c.t,J);h c.21(c.1e.1K(J))},1o:k(H,J){m(c.1w&&c.G.3S)h c;o 1I=T.2f.1K(c.Y,c.t,[H,J]);c.1e=1I.1e;h c.21(1I.H,1I.J)},3N:k(){c.Y.3O(c.t,c.1e.34(c.1p,c.G.1Q,c.t))}});C.P({6T:k(t,G){h U T.4B(c,t,G)}});T.26=T.3D.P({1G:k(r,G){c.Y=$(r);c.21(G)},3E:k(){F(o p 18 c.H)c.1p[p]=c.1e[p].2V(c.H[p],c.J[p],c)},2t:k(J){o 1I={};c.1e={};F(o p 18 J){c.1e[p]=T.2f.2U(p,J[p]);1I[p]=c.1e[p].1K(J[p])}h c.21(1I)},1o:k(R){m(c.1w&&c.G.3S)h c;c.1p={};c.1e={};o H={},J={};F(o p 18 R){o 1I=T.2f.1K(c.Y,p,R[p]);H[p]=1I.H;J[p]=1I.J;c.1e[p]=1I.1e}h c.21(H,J)},3N:k(){F(o p 18 c.1p)c.Y.3O(p,c.1e[p].34(c.1p[p],c.G.1Q,p))}});C.P({8l:k(G){h U T.26(c,G)}});T.4E=k(1h,1D){1D=1D||[];m($q(1D)!=\'12\')1D=[1D];h $P(1h,{7Z:k(1F){h 1h(1F,1D)},81:k(1F){h 1-1h(1-1F,1D)},82:k(1F){h(1F<=0.5)?1h(2*1F,1D)/2:(2-1h(2*(1-1F),1D))/2}})};T.1M=U 2s({7S:k(p){h p}});T.1M.P=k(4I){F(o 1h 18 4I){T.1M[1h]=U T.4E(4I[1h]);T.1M.4F(1h)}};T.1M.4F=k(1h){[\'7R\',\'7V\',\'85\'].1q(k(4J){T.1M[1h.30()+4J]=T.1M[1h][\'86\'+4J]})};T.1M.P({8g:k(p,x){h W.2i(p,x[0]||6)},8f:k(p){h W.2i(2,8*(p-1))},8h:k(p){h 1-W.6k(W.8i(p))},8k:k(p){h 1-W.6k((1-p)*W.4D/2)},8j:k(p,x){x=x[0]||1.8d;h W.2i(p,2)*((x+1)*p-x)},88:k(p){o N;F(o a=0,b=1;1;a+=b,b/=2){m(p>=(7-4*a)/11){N=-W.2i((11-6*a-11*p)/4,2)+b*b;1v}}h N},8b:k(p,x){h W.2i(2,10*--p)*W.66(20*p*W.4D*(x[0]||1)/3)}});[\'7v\',\'7r\',\'7z\',\'7I\'].1q(k(1h,i){T.1M[1h]=U T.4E(k(p){h W.2i(p,[i+2])});T.1M.4F(1h)});',62,624,'||||||||||||this|||||return|||function||if||var||type|el||property|event|||||||fn|Element||window|for|options|from|events|to|bind|document|arguments|value|length|extend|args|obj||Fx|new|else|Math|elements|element||||array||case|contains||style|in|result|prototype|false|null|props|css|true|Class|transition|prop|keys|className|push|relatedTarget|custom|start|now|each|delay|Array|Garbage|opacity|break|timer|name|key|rgb|ie|documentElement|Event|params|call|pos|initialize|create|parsed|join|parse|switch|Transitions|map|item|properties|unit|Events|string|match|fireEvent|text|time|returns|index|test||parent|empty|getStyle|border|parentNode|Styles||iterable|Methods|replace|previous|tmp|source|tag|CSS|max|object|pow|values|current|chains|webkit|addListener|addEvent|min|Elements|periodical|Abstract|set|hex|apply|native|collect|results|target|htmlElement|bit|merge|inject|round|fx|selector|remove|script|fromTo|indexOf|len|val|parseInt|domReady|next|walk|parseFloat|px|klass|select|getNow|option|compute|precision|mix|toLowerCase|stop||HTMLElement|getValue|chk|typeof||||every|Properties|forEach|preventDefault|attempt|readyState|generic|method|regex|stopPropagation|rgbToHex|ap|trash|mousewheel|mp|defined|setProperty|Listeners|fKey|visibility|currentStyle|brother|loaded|proto|code|src|evType|fix|size|Base|setNow|included|realType|removeEvents|hexToRgb|Multi|getElementsByTagName|splice|toInt|increase|setStyle|setMany|items|color|wait|end|body|on|catch|unload|padding|mouseover||cssText|mouseout|width|DOMMouseScroll|getProperty||pick|getTag|nodeType|innerText|pairs|addEvents|removeEvent|getMany|hasChild|pageY|NativeEvents|try|top|pageX|gecko|addEventListener|delete|String|hasClass|first|duration|clear|unique|default|appendChild|scrollHeight|number|clean|RegExp|Color|Style|merged|PI|Transition|compat|newArray|include|transitions|easeType|charAt|random|scrollWidth|insertBefore|camelCase|Function|flag|node|ie_ready|add|domready|firstChild|webkit419|class|nodeValue|setProperties||toFloat|disabled|copy|childNodes|trim|slice|Number|checked|toUpperCase|borderShort|interval|selected|xpath|undefined|continue|head|picked|extended|styleSheet|ie6|constructor|PropertiesIFlag|callee|innerHTML|Merge|removeChild|pp|removeEventListener|multiple|getElementsBySelector|argument|contents|tagName|setHTML|fixStyle|bottom|before|after|filter|shift|textContent|setOpacity|hidden|setStyles|zoom|removeClass|addClass|defaultView|capitalize|while|elementsProperty|Left|getNext|direction|getLast|visible|hyphenate|Bottom|appendText|0px|Width|where|margin|Right|Top|createElement|clientX|cos|Options|Chain|removeListener|setOptions|getScrollTop|Single|left|split|beforeunload|getScrollLeft|onComplete|callChain|relatedTargetGecko|sin|fps|onStart|onCancel|step|change|clientY|implement|which|delta|scroll|getScrollHeight|click|clientWidth|pageYOffset|wheelDelta|scrollTop|mouseleave|mouseenter|cloneEvents|scrollLeft|clientHeight|opera|pageXOffset|getWidth|right|fixRelatedTarget|keydown|getScrollWidth|getHeight|complete|load|boolean|embed|hide|effect|times|getElementById|500|createTextNode|scrollSize|replaceChild|replaceWith|toggleClass|getSize|zIndex|cssFloat|control|float|cloneNode|clone|injectBefore|getPosition|styles|1000|injectAfter|injectInside|concat|adopt|injectTop|clearTimer|bindAsEventListener|all|navigator|taintEnabled|ie7|XMLHttpRequest|evaluate|ActiveXObject|Cubic|webkit420|iframe|DOMElement|Quad|Object|getBoxObjectFor|khtml|Quart|Document|whitespace|regexp|textnode|nodeName|MooTools|version|collection|Quint|clearInterval|Window|clearTimeout|getTime|floor|Date|execCommand|BackgroundImageCache|In|linear|toString|transparent|Out|escapeRegExp|setTimeout|setInterval|easeIn|limit|easeOut|easeInOut|err|pass|InOut|ease|associate|Bounce|some|clearChain|Elastic|chain|618|getRandom|Expo|Pow|Circ|acos|Back|Sine|effects|styleFloat|up|keyCode|offsetHeight|down|detail|111|enter|href|fromCharCode|attachEvent|returnValue|detachEvent|120|offset|meta|tab|dblclick|mousedown|mousemove|backspace|height|wheel|esc|metaKey|space|borderWidth|borderStyle|rowSpan|readOnly|frameborder|rowspan|colSpan|accesskey|readonly|accessKey|tabindex|tabIndex|maxlength|maxLength|frameBorder|client|fromElement|button|toElement|cancelBubble|borderColor|rightClick|htmlFor|page|colspan|menu|mouse|getText|mouseup|getPrevious|https|javascript|void|getStyles|Sibling|getFirst|protocol|lastChild|getParent|contextmenu|bindWithEvent|location|write|id|alpha|100|innerWidth|hasLayout|offsetWidth|innerHeight|onDomReady|shiftKey|getPropertyValue|defer|getComputedStyle|onreadystatechange|DOMContentLoaded|ctrlKey|getChildren|setText|focus|setAttribute|keypress|move|resize|altKey|keyup|CollectGarbage|alt|getProperties|blur|error|getAttribute|abort|srcElement|reset|attributes|removeAttribute|removeProperty|submit'.split('|'),0,{}))
/*
	Slimbox (Extended Version 1.3.1, 2007-02-21)
	by Yukio Arita (http://homepage.mac.com/yukikun/software/slimbox_ex/)
	- 	Support to show external content using iframe.
	- 	Support to set content size. You can add width/height parameters 
		in rev attribute of the anchor url.
		ex1) <a href="image.jpg" rev="width=50%, height=50%" rel="lightbox">
				<img src="image_thumb.jpg" alt="image"></a>
		ex2) <a href="text.html" rev="width=500, height=300" rel="lightbox">
				some text here</a>
	- 	Some rendering problem with IE6 is fixed. Now you can use Slimbox in 
		valid XHTML document with XML prolog.
	- Of course, license is same as original.

	Based on:
	Slimbox v1.3 - The ultimate lightweight Lightbox clone
	by Christophe Beyls (http://www.digitalia.be) - MIT-style license.
	Inspired by the original Lightbox v2 by Lokesh Dhakar.
*/

var Lightbox = {
	init: function(options){
		this.options = Object.extend({
			resizeDuration: 400,
			resizeTransition: Fx.Transitions.sineInOut,
			initialWidth: 250,
			initialHeight: 250,
			animateCaption: true,
			defaultIframeWidth : 500, 
			defaultIframeHeight: 300
		}, options || {});

		// IE 6 - XML prolog problem
		if(window.ie6 && document.compatMode=="BackCompat"){
			this.options.animateCaption = false;
		}

		this.anchors = [];
		$each(document.links, function(el){
			if (el.rel && el.rel.test(/^lightbox/i)){
				el.onclick = this.click.pass(el, this);
				this.anchors.push(el);
			}
		}, this);
		this.eventKeyDown = this.keyboardListener.bindAsEventListener(this);
		this.eventPosition = this.position.bind(this);

		/*	Build float panel
			<div id="lbOverlay"></div>
			<div id="lbCenter">
				<div id="lbCanvas">
					<a id="lbPrevLink"></a>
					<a id="lbNextLink"></a>
					<!-- img or iframe element is inserted here -->
				</div>
			</div>
			<div id="lbBottomContainer">
				<div id="lbBottom">
					<a id="lbCloseLink"></a>
					<div id="lbCaption"></div>
					<div id="lbNumber"></div>
					<div style="clear:both;"></div>
				</div>
			</div>
		*/

		this.overlay = new Element('div').setProperty('id', 'lbOverlay').injectInside(document.body);

		this.center = new Element('div').setProperty('id', 'lbCenter').setStyles({width: this.options.initialWidth+'px', height: this.options.initialHeight+'px', marginLeft: '-'+(this.options.initialWidth/2)+'px', display: 'none'}).injectInside(document.body);
		this.canvas = new Element('div').setProperty('id', 'lbCanvas').injectInside(this.center);
		this.prevLink = new Element('a').setProperties({id: 'lbPrevLink', href: '#'}).setStyle('display', 'none').injectInside(this.canvas);
		this.nextLink = this.prevLink.clone().setProperty('id', 'lbNextLink').injectInside(this.canvas);
		this.prevLink.onclick = this.previous.bind(this);
		this.nextLink.onclick = this.next.bind(this);

		this.bottomContainer = new Element('div').setProperty('id', 'lbBottomContainer').setStyle('display', 'none').injectInside(document.body);
		this.bottom = new Element('div').setProperty('id', 'lbBottom').injectInside(this.bottomContainer);
		new Element('a').setProperties({id: 'lbCloseLink', href: '#'}).injectInside(this.bottom).onclick = this.overlay.onclick = this.close.bind(this);
		this.caption = new Element('div').setProperty('id', 'lbCaption').injectInside(this.bottom);
		this.number = new Element('div').setProperty('id', 'lbNumber').injectInside(this.bottom);
		new Element('div').setStyle('clear', 'both').injectInside(this.bottom);

		/* Build effects */
		var nextEffect = this.nextEffect.bind(this);
		this.fx = {
			overlay: this.overlay.effect('opacity', {duration: 500}).hide(),
			resizeCenter: this.center.effects({duration: this.options.resizeDuration, transition: this.options.resizeTransition, onComplete: nextEffect}),
			image: this.canvas.effect('opacity', {duration: 500, onComplete: nextEffect}),
			bottom: this.bottomContainer.effect('height', {duration: 400, onComplete: nextEffect})
		};

		this.preloadPrev = new Image();
		this.preloadNext = new Image();
	},

	click: function(link){
		if (link.rel.length == 8) return this.show(link.href, link.title, link.rev);

		var j, itemNumber, items = [];
		this.anchors.each(function(el){
			if (el.rel == link.rel){
				for (j = 0; j < items.length; j++) if(items[j][0] == el.href && items[j][2] == el.rev) break;
				if (j == items.length){
					items.push([el.href, el.title, el.rev]);
					if (el.href == link.href && el.rev == link.rev) itemNumber = j;
				}
			}
		}, this);
		return this.open(items, itemNumber);
	},

	show: function(url, title, rev){
		return this.open([[url, title, rev]], 0);
	},

	open: function(items, itemNumber){
		this.items = items;
		this.position();
		this.setup(true);
		var wh = (window.getHeight() == 0) ? window.getScrollHeight() : window.getHeight();
		var st = document.body.scrollTop  || document.documentElement.scrollTop;
		this.top = st + (wh / 15);
		this.center.setStyles({top: this.top+'px', display: ''});
		this.fx.overlay.start(0.8);
		return this.changeItem(itemNumber);
	},

	position: function(){
		//IE6 - XML prolog problem.
		var ww = (window.getWidth() == 0) ? window.getScrollWidth()-22 : window.getWidth();
		var wh = (window.getHeight() == 0) ? window.getScrollHeight() : window.getHeight();
		var st = document.body.scrollTop  || document.documentElement.scrollTop;
		this.overlay.setStyles({top: st+'px', height: wh+'px', width:ww+'px'});
	},

	setup: function(open){
		var elements = $A(document.getElementsByTagName('object'));
		if (window.ie) elements.extend(document.getElementsByTagName('select'));
		elements.each(function(el){ el.style.visibility = open ? 'hidden' : ''; });
		var fn = open ? 'addEvent' : 'removeEvent';
		window[fn]('scroll', this.eventPosition)[fn]('resize', this.eventPosition);
		document[fn]('keydown', this.eventKeyDown);
		this.step = 0;
	},

	keyboardListener: function(event){
		switch (event.keyCode){
			case 27: case 88: case 67: this.close(); break;
			case 37: case 80: this.previous(); break;	
			case 39: case 78: this.next();
		}
	},

	previous: function(){
		return this.changeItem(this.activeItem-1);
	},

	next: function(){
		return this.changeItem(this.activeItem+1);
	},

	changeItem: function(itemNumber){
		if (this.step || (itemNumber < 0) || (itemNumber >= this.items.length)) return false;
		this.step = 1;
		this.activeItem = itemNumber;

		this.bottomContainer.style.display = this.prevLink.style.display = this.nextLink.style.display = 'none';
		this.fx.image.hide();
		this.center.className = 'lbLoading';

		// discard previous content by clicking
		this.removeCurrentItem();
		
		// check item type
		var url = this.items[this.activeItem][0];
		var rev = this.items[this.activeItem][2];
		
		var re_imageURL = /\.(jpe?g|png|gif|bmp)/i;
		if( url.match(re_imageURL) ) {
			this.preload = new Image();	// JavaScript native Object
			this.preload.datatype = 'image';
			this.preload.w = this.matchOrDefault(rev, new RegExp("width=(\\d+%?)", "i"), -1); //-1 if use original size.
			this.preload.h = this.matchOrDefault(rev, new RegExp("height=(\\d+%?)", "i"), -1);
			this.preload.onload = this.nextEffect.bind(this);
			this.preload.src = url;
		}else{
			this.preload = new Object ();	// JavaScript native Object
			this.preload.datatype = 'iframe';
			this.preload.w =  this.matchOrDefault(rev, new RegExp("width=(\\d+)", "i"), this.options.defaultIframeWidth);
			this.preload.h = this.matchOrDefault(rev, new RegExp("height=(\\d+)", "i"), this.options.defaultIframeHeight);
			this.preload.src = url;
			this.nextEffect(); //asynchronous loading
		}

		return false;
	},

	nextEffect: function(){
		switch (this.step++){
		case 1:
			this.center.className = '';

			// create HTML element
			if( this.preload.datatype == 'image' ) {
				var ws = (this.preload.w == -1) ? this.preload.width.toString() : this.preload.w.toString();
				var hs = (this.preload.h == -1) ? this.preload.height.toString() : this.preload.h.toString();
				this.p_width = ( q = ws.match(/(\d+)%/) ) ? q[1] * this.preload.width * 0.01 : ws;
				this.p_height = ( q = hs.match(/(\d+)%/) ) ? q[1] * this.preload.height * 0.01 : hs;
				new Element('img').setProperties({id: 'lbImage', src:this.preload.src, width:this.p_width, height:this.p_height}).injectInside(this.canvas);
				this.nextLink.style.right = '';
			}else{
				this.p_width = this.preload.w;
				this.p_height = this.preload.h;
				// Safari would not update iframe content that has static id.
				this.iframeId = "lbFrame_"+new Date().getTime();
				new Element('iframe').setProperties({id: this.iframeId, width: this.p_width, height: this.p_height, frameBorder:0, scrolling:'yes', src:this.preload.src}).injectInside(this.canvas);
				this.nextLink.style.right = '25px';
			}
			this.canvas.style.width = this.bottom.style.width = this.p_width+'px';
			this.canvas.style.height = this.prevLink.style.height = this.nextLink.style.height = this.p_height+'px';

			this.caption.setHTML(this.items[this.activeItem][1] || '');
			this.number.setHTML( (this.items.length == 1) ? '' : 'Page ' + (this.activeItem+1) + ' of ' + this.items.length );

			if (this.activeItem) this.preloadPrev.src = this.items[this.activeItem-1][0];
			if (this.activeItem != (this.items.length - 1)) this.preloadNext.src = this.items[this.activeItem+1][0];
			if (this.center.clientHeight != this.canvas.offsetHeight){
				var oh = (this.p_height == this.canvas.clientHeight) ? this.canvas.offsetHeight : eval(this.p_height)+18; // fix for ie
				this.fx.resizeCenter.start({height: oh});
				break;
			}

			this.step++;
		case 2:
			if (this.center.clientWidth != this.canvas.offsetWidth){
				var ow = (this.p_width == this.canvas.clientWidth) ? this.canvas.offsetWidth : eval(this.p_width)+18; // fix for ie
				this.fx.resizeCenter.start({width: ow, marginLeft: -ow/2});
				break;
			}
			this.step++;
		case 3:
			this.bottomContainer.setStyles({top: (this.top + this.center.clientHeight)+'px', height:'0px', marginLeft: this.center.style.marginLeft, width:this.center.style.width, display: ''});
			this.fx.image.start(1);
			break;
		case 4:
			if (this.options.animateCaption){
				// This is not smooth animation in IE 6 with XML prolog.
				// If your site is XHTML strict with XML prolog, disable this option.
				this.fx.bottom.start(0,this.bottom.offsetHeight+10);
				break;
			}
			this.bottomContainer.style.height = (this.bottom.offsetHeight+10)+'px';
		case 5:
			if (this.activeItem){
				this.prevLink.style.display = '';
			}
			if (this.activeItem != (this.items.length - 1)){
				this.nextLink.style.display = '';
			}
			this.step = 0;
		}
	},

	close: function(){
		if (this.step < 0) return;
		this.step = -1;
		this.removeCurrentItem();	// discard content
		for (var f in this.fx) this.fx[f].stop();
		this.center.style.display = this.bottomContainer.style.display = 'none';
		this.fx.overlay.chain(this.setup.pass(false, this)).start(0);
		return false;
	},

	removeCurrentItem: function(){
		if (this.preload){
			if( this.preload.datatype == 'image' ) {
				$('lbImage').remove();
				this.preload.onload = Class.empty;
			}else{
				$(this.iframeId).remove();
			}
			this.preload = null;
		}		
	},

	matchOrDefault: function(str, re, val){
		var hasQuery = str.match(re);
		return hasQuery ? hasQuery[1] : val;
	}

};

window.addEvent('domready', Lightbox.init.bind(Lightbox));
