/* -------------- /javascripts/shadedborder.js ------------- */ 
/**
 * RUZEE.ShadedBorder 0.2
 * (c) 2006 Steffen Rusitschka
 *
 * RUZEE.ShadedBorder is freely distributable under the terms of an MIT-style license.
 * For details, see http://www.ruzee.com/
 */

var RUZEE = window.RUZEE || {};

RUZEE.ShadedBorder = {

create: function(opts) {
  var isie = /msie/i.test(navigator.userAgent) && !window.opera;
  function sty(el, h) {
    for(k in h) {
      if (/ie_/.test(k)) {
        if (isie) el.style[k.substr(3)]=h[k];
      } else el.style[k]=h[k];
    }
  }
  function crdiv(h) {
    var el=document.createElement("div");
    el.className = "sb-gen";
    sty(el, h);
    return el;
  }
  function op(v) {
    v = v<0 ? 0 : v;
    v = v>0.99999 ? 0.99999 : v;
    if (isie) {
      return " filter:alpha(opacity=" + (v*100) + ");";
    } else {
      return " opacity:" + v + ';';
    }
  }

  var sr = opts.shadow || 0;
  var r = opts.corner || 0;
  var bor = 0;
  var bow = opts.border || 0;
  var shadow = sr != 0;
  var lw = r > sr ? r : sr;
  var rw = lw;
  var th = lw;
  var bh = lw;
  if (bow > 0) {
    bor = r;
    r = r - bow;
  }
  var cx = r != 0 && shadow ? Math.round(lw/3) : 0;
  var cy = cx;
  var cs = Math.round(cx/2);
  var iclass = r > 0 ? "sb-inner" : "sb-shadow";
  var sclass = "sb-shadow";
  var bclass = "sb-border";
  var edges = opts.edges || "trlb";
  if (!/t/i.test(edges)) th=0;
  if (!/b/i.test(edges)) bh=0;
  if (!/l/i.test(edges)) lw=0;
  if (!/r/i.test(edges)) rw=0;

  var p = { position:"absolute", left:"0", top:"0", width:lw + "px", height:th + "px", 
            ie_fontSize:"1px", overflow:"hidden" }; var tl = crdiv(p);
  delete p.left; p.right="0"; p.width=rw + "px"; var tr = crdiv(p);
  delete p.top; p.bottom="0"; p.height=bh + "px"; var br = crdiv(p);
  delete p.right; p.left="0"; p.width=lw + "px"; var bl = crdiv(p);

  var tw = crdiv({ position:"absolute", width:"100%", height:th + "px", ie_fontSize:"1px",
                   top:"0", left:"0", overflow:"hidden" });
  var t = crdiv({ position:"relative", height:th + "px", ie_fontSize:"1px", marginLeft:lw + "px",
                  marginRight:rw + "px", overflow:"hidden" });
  tw.appendChild(t);

  var bw = crdiv({ position:"absolute", left:"0", bottom:"0", width:"100%", height:bh + "px", 
                   ie_fontSize:"1px", overflow:"hidden" });
                   
  var b = crdiv({ position:"relative", height:bh + "px", ie_fontSize:"1px", marginLeft:lw + "px",
                  marginRight:rw + "px", overflow:"hidden" });
                  
  bw.appendChild(b);

  var mw = crdiv({ position:"absolute", top:(-bh)+"px", left:"0", width:"100%", height:"100%",
                   overflow:"hidden", ie_fontSize:"1px" });

  function corner(el,t,l) {
    var w = l ? lw : rw;
    var h = t ? th : bh;
    var s = t ? cs : -cs;
    var dsb = []; var dsi = []; var dss = [];
    
    var xp=0; var xd=1; if (l) { xp=w-1; xd=-1; }
    for (var x=0; x<w; ++x) {
      var yp=0; var yd=1; if (t) { yp=h-1; yd=-1; }
      for (var y=0; y<h; ++y) {
        var div = '<div style="position:absolute; top:' + yp + 'px; left:' + xp + 'px; ' +
                  'width:1px; height:1px; overflow:hidden;';

        var xc = x - cx; var yc = y - cy - s;
        var d = Math.sqrt(xc*xc+yc*yc);
        var doShadow = false;

        if (r > 0) {
          // draw border
          if (xc < 0 && yc < bor && yc >= r || yc < 0 && xc < bor && xc >= r) {
            dsb.push(div + '" class="' + bclass + '"></div>');
          } else
          if (d<bor && d>=r-1 && xc>=0 && yc>=0) {
            var dd = div;
            if (d>=bor-1) {
              dd += op(bor-d);
              doShadow = true;
            }
            dsb.push(dd + '" class="' + bclass + '"></div>');
          }
          
          // draw inner
          var dd = div + ' z-index:2;';
          if (xc < 0 && yc < r || yc < 0 && xc < r) {
            dsi.push(dd + '" class="' + iclass + '"></div>');
          } else
          if (d<r && xc>=0 && yc>=0) {
            if (d>=r-1) {
              dd += op(r-d);
              doShadow = true;
            }
            dsi.push(dd + '" class="' + iclass + '"></div>');
          } else doShadow = true;
        } else doShadow = true;
        
        // draw shadow
        if (sr > 0 && doShadow) {
          d = Math.sqrt(x*x+y*y);
          if (d<sr) {
            dss.push(div + ' z-index:0; ' + op(1-(d/sr)) + '" class="' + sclass + '"></div>');
          }
        }
        yp += yd;
      }
      xp += xd;
    }
    el.innerHTML = dss.concat(dsb.concat(dsi)).join('');
  }
  
  function mid(mw) {
    var ds = [];

    ds.push('<div style="position:relative; top:' + (th+bh) + 'px;' +
            ' height:10000px; margin-left:' + (lw-r-cx) + 'px;' +
            ' margin-right:' + (rw-r-cx) + 'px; overflow:hidden;"' +
            ' class="' + iclass + '"></div>');

    var dd = '<div style="position:absolute; width:1px;' +
        ' top:' + (th+bh) + 'px; height:10000px;';
    for (var x=0; x<lw-r-cx; ++x) {
      ds.push(dd + ' left:' + x + 'px;' + op((x+1.0)/lw) + 
          '" class="' + sclass + '"></div>');
    }

    for (var x=0; x<rw-r-cx; ++x) {
      ds.push(dd + ' right:' + x + 'px;' + op((x+1.0)/rw) + 
          '" class="' + sclass + '"></div>');
    }

    if (bow > 0) {
      var su = ' width:' + bow + 'px;' + '" class="' + bclass + '"></div>';
      ds.push(dd + ' left:' + (lw-bor-cx) + 'px;' + su);
      ds.push(dd + ' right:' + (rw-bor-cx) + 'px;' + su);
    }

    mw.innerHTML = ds.join('');
  }

  function tb(el, t) {
    var ds = [];
    var h = t ? th : bh;
    var dd = '<div style="height:1px; overflow:hidden; position:absolute;' +
        ' width:100%; left:0px; ';
    var s = t ? cs : -cs;
    for (var y=0; y<h-s-cy-r; ++y) {
      ds.push(dd + (t ? 'top:' : 'bottom:') + y + 'px;' + op((y+1)*1.0/h) + 
          '" class="' + sclass + '"></div>');
    }
    if (y >= bow) {
      ds.push(dd + (t ? 'top:' : 'bottom:') + (y - bow) + 'px;' +
          ' height:' + bow + 'px;" class="' + bclass + '"></div>');
    }

    ds.push(dd + (t ? 'top:' : 'bottom:') + y + 'px;' +
        ' height:' + (r+cy+s) + 'px;" class="' + iclass + '"></div>');

    el.innerHTML = ds.join('');
  }

  corner(tl, true, true); corner(tr, true, false);
  corner(bl, false, true); corner(br, false, false);
  mid(mw); tb(t, true); tb(b, false);

  return {
    render: function(el) {
      if (typeof el == 'string') el = document.getElementById(el);
      if (el.length != undefined) {
        for (var i=0; i<el.length; ++i) this.render(el[i]);
        return;
      }
      // remove generated children
      var node = el.firstChild;
      while (node) {
        var nextNode = node.nextSibling;
        if (node.nodeType == 1 && node.className == 'sb-gen')
          el.removeChild(node);
        node = nextNode;
      }

      var iel = el.firstChild;

      var twc = tw.cloneNode(true);
      var mwc = mw.cloneNode(true);
      var bwc = bw.cloneNode(true);
      
      el.insertBefore(tl.cloneNode(true), iel); el.insertBefore(tr.cloneNode(true), iel);
      el.insertBefore(bl.cloneNode(true), iel); el.insertBefore(br.cloneNode(true), iel);
      el.insertBefore(twc, iel); el.insertBefore(mwc, iel);
      el.insertBefore(bwc, iel);

      if (isie) {
        function resize() {
          twc.style.width = bwc.style.width = mwc.style.width = el.offsetWidth + "px";
          mwc.firstChild.style.height = el.offsetHeight + "px";
        }
        el.onresize=resize;
        resize();
      }
    }
  };
}
}

// add our styles to the document
document.write(
  '<style type="text/css">' +
  '.sb, .sbi, .sb *, .sbi * { position:relative; z-index:1; }' +
  '* html .sb, * html .sbi { height:1%; }' +
  '.sbi { display:inline-block; }' +
  '.sb-inner { background:#ddd; }' +
  '.sb-shadow { background:#000; }' +
  '.sb-border { background:#bbb; }' +
  '</style>'
);

/* -------------- /javascripts/mootools.js ------------- */ 
//MooTools, My Object Oriented Javascript Tools. Copyright (c) 2006 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}('k 11=f(1S){k 4s=f(){j(9.1e&&Y[0]!=\'7h\')h 9.1e.2m(9,Y);Q h 9};I(k n W 9)4s[n]=9[n];4s.U=1S;h 4s};11.1G=f(){};11.U={N:f(1S){k 4r=M 9(\'7h\');k 7g=f(2s,2f){j(!2s.2m||!2f.2m)h T;h f(){9.1t=2s;h 2f.2m(9,Y)}};I(k n W 1S){k 2s=4r[n];k 2f=1S[n];j(2s&&2s!=2f)2f=7g(2s,2f)||2f;4r[n]=2f}h M 11(4r)},1T:f(1S){I(k n W 1S)9.U[n]=1S[n]}};1H.N=f(){k R=Y;R=(R[1])?[R[0],R[1]]:[9,R[0]];I(k n W R[1])R[0][n]=R[1][n];h R[0]};1H.5p=f(){I(k i=0;i<Y.14;i++)Y[i].N=11.U.1T};M 1H.5p(59,1r,5e,76,11);j(5r 2I==\'3z\'){k 2I=11.1G;2I.U={}}f $q(u){j(u===1K||u===3z)h T;k q=5r u;j(q==\'5o\'){j(u 4m 2I)h\'r\';j(u 4m 1r)h\'1R\';j(u.9Y){2c(u.6x){1c 1:h\'r\';1c 3:h u.9X.15(\'\\\\S\')?\'9W\':\'4f\'}}}h q};f $2B(u){h!!(u||u===0)};f $9V(u,7f){h($q(u))?u:7f};f $7e(3o,1B){h G.9U(G.7e()*(1B-3o+1)+3o)};f $3Q(1f){9T(1f);9S(1f);h 1K};j(12.9R)12.3w=12[12.9Q?\'9P\':\'53\']=1g;Q j(L.6J&&!L.9O&&!9N.9M)12.3W=1g;Q j(L.9L!=1K)12.5m=1g;1r.U.4q=1r.U.4q||f(O,J){I(k i=0;i<9.14;i++)O.1i(J,9[i],i,9)};1r.U.4X=1r.U.4X||f(O,J){k 5u=[];I(k i=0;i<9.14;i++)5u[i]=O.1i(J,9[i],i,9);h 5u};1r.U.7d=1r.U.7d||f(O,J){I(k i=0;i<9.14;i++){j(!O.1i(J,9[i],i,9))h T}h 1g};1r.U.7c=1r.U.7c||f(O,J){I(k i=0;i<9.14;i++){j(O.1i(J,9[i],i,9))h 1g}h T};1r.U.4g=1r.U.4g||f(3a,F){F=F||0;j(F<0)F=G.1B(0,9.14+F);34(F<9.14){j(9[F]===3a)h F;F++}h-1};1r.N({1o:1r.U.4q,54:f(){k 36=[];I(k i=0;i<9.14;i++)36[i]=9[i];h 36},3Z:f(3a){k i=0;34(i<9.14){j(9[i]==3a)9.47(i,1);Q i++}h 9},15:f(3a,F){h 9.4g(3a,F)!=-1},N:f(36){I(k i=0;i<36.14;i++)9.18(36[i]);h 9},9K:f(1u){k u={},14=G.3o(9.14,1u.14);I(k i=0;i<14;i++)u[1u[i]]=9[i];h u}});f $A(1R){h 1r.U.54.1i(1R)};f $1o(7b,O,J){h 1r.U.4q.1i(7b,O,J)};5e.N({15:f(7a,79){h M 9J(7a,79).15(9)},2C:f(){h 5s(9)},74:f(){h 3t(9)},5n:f(){h 9.35(/-\\D/g,f(28){h 28.5t(1).78()})},6O:f(){h 9.35(/\\w[A-Z]/g,f(28){h(28.5t(0)+\'-\'+28.5t(1).3G())})},9I:f(){h 9.3G().35(/\\b[a-z]/g,f(28){h 28.78()})},77:f(){h 9.35(/^\\s+|\\s+$/g,\'\')},45:f(){h 9.35(/\\s{2,}/g,\' \').77()},3I:f(1R){k 1l=9.28(/\\d{1,3}/g);h(1l)?1l.3I(1R):T},3s:f(1R){k 2J=9.28(\'^#?(\\\\w{1,2})(\\\\w{1,2})(\\\\w{1,2})$\');h(2J)?2J.3s(1R):T}});1r.N({3I:f(1R){j(9.14<3)h T;j(9[3]&&9[3]==0)h\'9H\';k 2J=[];I(k i=0;i<3;i++){k 4p=(9[i]-0).9G(16);2J.18(4p.14==1?\'0\'+4p:4p)}h 1R?2J:\'#\'+2J.3r(\'\')},3s:f(1R){j(9.14!=4)h T;k 1l=[];I(k i=1;i<4;i++){j(9[i].14==1)9[i]+=9[i];1l.18(5s(9[i],16))}h 1R?1l:\'1l(\'+1l.3r(\',\')+\')\'}});76.N({2C:f(){h 5s(9)},74:f(){h 3t(9)}});59.N({2e:f(m){k O=9;m=1H.N({\'J\':O,\'o\':T,\'Y\':1K,\'2d\':T,\'2k\':T,\'4o\':T},m||{});j(m.Y!=1K&&5r m.Y!=\'3z\'&&!(m.Y 4m 1r))m.Y=[m.Y];h f(o){k R=m.Y||Y;j(m.o){o=(m.o===1g)?o||12.o:M m.o(o);R=[o].9F(R)}k 2t=f(){h O.2m(m.J,R)};j(m.2d)h 9E(2t,m.2d);j(m.2k)h 9D(2t,m.2k);j(m.4o){6g{k 5q=2t()}6f(73){5q=73}9C{h 5q}}Q h 2t()}},9B:f(R,J){h 9.2e({\'Y\':R,\'J\':J})},4o:f(R,J){h 9.2e({\'Y\':R,\'J\':J,\'4o\':1g})()},J:f(J,R){h 9.2e({\'J\':J,\'Y\':R})},9A:f(J,R){h 9.2e({\'J\':J,\'o\':1g,\'Y\':R})},2d:f(4n,J,R){h 9.2e({\'2d\':4n,\'J\':J,\'Y\':R})()},2k:f(4n,J,R){h 9.2e({\'2k\':4n,\'J\':J,\'Y\':R})()}});k 1b=M 11({1e:f(l){j($q(l)==\'4j\')l=L.6H(l);h $(l)}});f $(l){j(!l)h T;j(l.72||[12,L].15(l))h l;j($q(l)==\'4j\')l=L.44(l);j($q(l)!=\'r\')h T;j([\'5o\',\'9z\'].15(l.41.3G())||l.N)h l;l.72=1g;31.6z(l);l.N=1H.N;j(!(l 4m 2I))l.N(1b.U);h l};k 1N=M 11({});M 1H.5p(1N);L.2G=L.56;f $$(){j(!Y)h T;j(Y.14==1){j(!Y[0])h T;j(Y[0].71)h Y[0]}k 1w=[];$1o(Y,f(1v){2c($q(1v)){1c\'r\':1w.18($(1v));1P;1c\'4j\':1v=L.2G(1v);6F:j(1v.14){$1o(1v,f(l){j($(l))1w.18(l)})}}});1w.71=1g;h 1H.N(1w,M 1N)};1N.3T=f(n){h f(){k R=Y;k 3J=[];k 1w=1g;$1o(9,f(l){k 2t=l[n].2m(l,R);j($q(2t)!=\'r\')1w=T;3J.18(2t)});j(1w)3J=$$(3J);h 3J}};1b.N=f(1S){I(k n W 1S){2I.U[n]=1S[n];1b.U[n]=1S[n];1N.U[n]=1N.3T(n)}};1b.N({4l:f(l,70){l=$(l)||M 1b(l);2c(70){1c"6Y":$(l.26).6Z(9,l);1P;1c"6X":j(!l.5k())$(l.26).4k(9);Q $(l.26).6Z(9,l.5k());1P;1c"6W":l.4k(9)}h 9},9y:f(l){h 9.4l(l,\'6Y\')},5K:f(l){h 9.4l(l,\'6X\')},9x:f(l){h 9.4l(l,\'6W\')},5J:f(l){9.4k($(l)||M 1b(l));h 9},3Z:f(){9.26.9w(9);h 9},9v:f(6V){k l=9.9u(6V!==T);h $(l)},6G:f(l){l=$(l)||M 1b(l);9.26.9t(l,9);h l},9s:f(33){j(12.3w){2c(9.3C()){1c\'1h\':9.9r.6S=33;h 9;1c\'52\':9.4d(\'33\',33);h 9}}9.4k(L.9q(33));h 9},3A:f(1d){h 9.1d.15(\'(?:^|\\\\s+)\'+1d+\'(?:\\\\s+|$)\')},6T:f(1d){j(!9.3A(1d))9.1d=(9.1d+\' \'+1d).45();h 9},6U:f(1d){j(9.3A(1d))9.1d=9.1d.35(1d,\'\').45();h 9},9p:f(1d){h 9.3A(1d)?9.6U(1d):9.6T(1d)},1F:f(n,K){j(n==\'1Y\')9.6R(3t(K));Q 9.1h[n.5n()]=(K.18)?K.3I():K;h 9},6I:f(1L){2c($q(1L)){1c\'5o\':I(k n W 1L)9.1F(n,1L[n]);1P;1c\'4j\':j(12.3w)9.6S=1L;Q 9.6E(\'1h\',1L)}h 9},6R:f(1Y){j(1Y==0){j(9.1h.4i!="3S")9.1h.4i="3S"}Q{j(9.1h.4i!="6Q")9.1h.4i="6Q"}j(!9.4h||!9.4h.9o)9.1h.9n=1;j(12.3w)9.1h.3D="3x(1Y="+1Y*3g+")";9.1h.1Y=9.1Y=1Y;h 9},1W:f(n){n=n.5n();k 1h=9.1h[n]||T;j(!$2B(1h)){j(n==\'1Y\')h $2B(9.1Y)?9.1Y:1;j([\'2n\',\'9m\'].15(n)){h[9.1W(n+\'-2w\')||0,9.1W(n+\'-5a\')||0,9.1W(n+\'-6B\')||0,9.1W(n+\'-2i\')||0].3r(\' \')}j(L.6P)1h=L.6P.9l(9,1K).9k(n.6O());Q j(9.4h)1h=9.4h[n]}h(1h&&n.15(\'1A\',\'i\')&&1h.15(\'1l\'))?1h.3I():1h},1a:f(q,O){9.V=9.V||{};9.V[q]=9.V[q]||{\'1u\':[],\'1z\':[]};j(!9.V[q].1u.15(O)){9.V[q].1u.18(O);j(9.6N){9.6N((q==\'2M\'&&12.5m)?\'5f\':q,O,T)}Q{O=O.J(9);9.9j(\'58\'+q,O);9.V[q].1z.18(O)}}h 9},9i:f(1L){j(1L){I(k q W 1L)9.1a(q,1L[q])}h 9},1E:f(q,O){j(9.V&&9.V[q]){k 1D=9.V[q].1u.4g(O);j(1D==-1)h 9;k 1O=9.V[q].1u.47(1D,1)[0];j(9.6M){9.6M((q==\'2M\'&&12.5m)?\'5f\':q,1O,T)}Q{9.9h(\'58\'+q,9.V[q].1z.47(1D,1)[0])}}h 9},5h:f(q){j(9.V){j(q){j(9.V[q]){9.V[q].1u.1o(f(O){9.1E(q,O)},9);9.V[q]=1K}}Q{I(k 6L W 9.V)9.5h(6L);9.V=1K}}h 9},1x:f(q,R){j(9.V&&9.V[q]){R=R||[];j($q(R)!=\'1R\')R=[R];9.V[q].1u.1o(f(O){O.2m(9,R)},9)}},5j:f(5l){k l=9[5l+\'6K\'];34($q(l)==\'4f\')l=l[5l+\'6K\'];h $(l)},9g:f(){h 9.5j(\'2s\')},5k:f(){h 9.5j(\'9f\')},9e:f(){k l=9.9d;34($q(l)==\'4f\')l=l.9c;h $(l)},9b:f(){k l=9.9a;34($q(l)==\'4f\')l=l.99;h $(l)},98:f(){h $(9.26)},97:f(){h $$(9.6J)},4d:f(n,K){2c(n){1c\'6C\':9.1d=K;1P;1c\'1h\':9.6I(K);1P;1c\'24\':j(12.53){k l=$(L.6H(\'<\'+9.3C()+\' 24="\'+K+\'" />\'));$1o(9.96,f(4e){j(4e.24!=\'24\')l.4d(4e.24,4e.K)});j(9.26)9.6G(l);h l}6F:9.6E(n,K)}h 9},95:f(1L){I(k n W 1L)9.4d(n,1L[n]);h 9},94:f(6D){9.93=6D;h 9},92:f(n){h(n==\'6C\')?9.1d:9.6k(n)},3C:f(){h 9.41.3G()},2O:f(){k l=9,4c=0,4b=0;91{4c+=l.4c||0;4b+=l.4b||0;l=l.90}34(l);h{\'x\':4c,\'y\':4b}},2a:f(x,y){9.3U=x;9.3V=y},3P:f(){h{\'1V\':{\'x\':9.3U,\'y\':9.3V},\'2A\':{\'x\':9.2x,\'y\':9.2v},\'3O\':{\'x\':9.68,\'y\':9.69}}},4D:f(){h 9.2O().y},4F:f(){h 9.2O().x},8Z:f(){k 5i=9.2O();k u={\'3j\':9.2x,\'3i\':9.2v,\'2i\':5i.x,\'2w\':5i.y};u.5a=u.2i+u.3j;u.6B=u.2w+u.3i;h u},2F:f(){2c(9.3C()){1c\'2U\':j(9.6A!=-1)h 9.m[9.6A].K;1P;1c\'8Y\':j(!(9.8X&&[\'8W\',\'8V\'].15(9.q))&&![\'3S\',\'33\',\'8U\'].15(9.q))1P;1c\'8T\':h 9.K}h T}});k 8S=12;12.1a=L.1a=1b.U.1a;12.1E=L.1E=1b.U.1E;k 31={1w:[],6z:f(r){31.1w.18(r)},5g:f(){12.1E(\'6y\',31.5g);31.1w.1o(f(l){l.5h();I(k p W 1b.U)2I[p]=12[p]=L[p]=l[p]=1K;l.N=1K})}};12.1a(\'6y\',31.5g);k 3F=M 11({1e:f(o){9.o=o||12.o;9.q=9.o.q;9.3H=9.o.3H||9.o.8R;j(9.3H.6x==3)9.3H=9.3H.26;9.8Q=9.o.8P;9.8O=9.o.8N;9.8M=9.o.8L;9.8K=9.o.8J;j([\'5f\',\'2M\'].15(9.q)){9.3f=9.o.6w?(9.o.6w/ (12.51 ? -6v : 6v)) : -(9.o.8I || 0) /3}Q j(9.q.15(\'1O\')){9.5d=9.o.6r||9.o.8H;I(k 24 W 3F.1u){j(3F.1u[24]==9.5d)k 6u=24}9.1O=6u||5e.8G(9.5d).3G()}Q j(9.q.15(\'2l\')||9.q==\'8F\'){9.1y={\'x\':9.o.5c||9.o.6t+L.2r.3U,\'y\':9.o.5b||9.o.6s+L.2r.3V};9.5y={\'x\':9.o.5c?9.o.5c-12.66:9.o.6t,\'y\':9.o.5b?9.o.5b-12.67:9.o.6s};9.8E=(9.o.6r==3)||(9.o.8D==2);2c(9.q){1c\'8C\':9.4a=9.o.4a||9.o.8B;1P;1c\'8A\':9.4a=9.o.4a||9.o.5L}}},1s:f(){9.49();9.48();h 9},49:f(){j(9.o.49)9.o.49();Q 9.o.8z=1g;h 9},48:f(){j(9.o.48)9.o.48();Q 9.o.8y=T;h 9}});3F.1u={\'8x\':13,\'8w\':38,\'8v\':40,\'2i\':37,\'5a\':39,\'8u\':27,\'8t\':32,\'8s\':8,\'8r\':46};59.N({2y:f(J,R){h 9.2e({\'J\':J,\'Y\':R,\'o\':3F})}});k 5S=M 11({8q:f(O){9.2H=9.2H||[];9.2H.18(O);h 9},5Z:f(){j(9.2H&&9.2H.14)9.2H.47(0,1)[0].2d(10,9)},8p:f(){9.2H=[]}});k 3c=M 11({1a:f(q,O){j(O!=11.1G){9.V=9.V||{};9.V[q]=9.V[q]||[];j(!9.V[q].15(O))9.V[q].18(O)}h 9},1x:f(q,R,2d){j(9.V&&9.V[q]){9.V[q].1o(f(O){O.2e({\'J\':9,\'2d\':2d,\'Y\':R})()},9)}h 9},1E:f(q,O){j(9.V&&9.V[q])9.V[q].3Z(O);h 9}});k 3b=M 11({2N:f(6q,m){9.m=1H.N(6q,m);j(9.1a){I(k 3E W 9.m){j(($q(9.m[3E])==\'f\')&&3E.15(\'^58[A-Z]\'))9.1a(3E,9.m[3E])}}h 9}});f $E(1v,3D){h($(3D)||L).42(1v)};f $8o(1v,3D){h($(3D)||L).2G(1v)};1b.N({3B:f(1v){k 1Q=[];1v.45().4Y(\' \').1o(f(43,i){k 1q=43.28(\'^(\\\\w*|\\\\*)(?:#([\\\\6p-]+)|\\\\.([\\\\6p-]+))?(?:\\\\[["\\\']?(\\\\w+)["\\\']?(?:([\\\\*\\\\^\\\\$]?=)["\\\']?(\\\\w*)["\\\']?)?\\\\])?$\');j(!1q)h;1q[1]=1q[1]||\'*\';j(i==0){j(1q[2]){k l=9.44(1q[2]);j(!l||((1q[1]!=\'*\')&&(1b.U.3C.1i(l)!=1q[1])))h;1Q=[l]}Q{1Q=$A(9.56(1q[1]))}}Q{1Q=1N.U.6m.1i(1Q,1q[1]);j(1q[2])1Q=1N.U.6o.1i(1Q,1q[2])}j(1q[3])1Q=1N.U.6n.1i(1Q,1q[3]);j(1q[4])1Q=1N.U.6l.1i(1Q,1q[4],1q[6],1q[5])},9);h $$(1Q)},44:f(2Z){k l=L.44(2Z);j(!l)h T;I(k 1t=l.26;1t!=9;1t=1t.26){j(!1t)h T}h l},42:f(1v){h 9.2G(1v)[0]},2G:f(1v){k 57=[];1v.4Y(\',\').1o(f(43){57.N(9.3B(43))},9);h $$(57)}});L.N=1H.N;L.N({8n:f(1d){h L.3B(\'.\'+1d)},42:1b.U.42,3B:1b.U.3B,2G:1b.U.2G});1N.N({6o:f(2Z,8m){k 1p=[];9.1o(f(l){j(l.2Z==2Z)1p.18(l)});h 1p},6n:f(1d){k 1p=[];9.1o(f(l){j(1b.U.3A.1i(l,1d))1p.18(l)});h 1p},6m:f(41){k 1p=[];9.1o(f(l){1p.N(l.56(41))});h 1p},6l:f(24,K,55){k 1p=[];9.1o(f(l){k 30=l.6k(24);j(!30)h 1p;j(!55)h 1p.18(l);2c(55){1c\'*=\':j(30.15(K))1p.18(l);1P;1c\'=\':j(30==K)1p.18(l);1P;1c\'^=\':j(30.15(\'^\'+K))1p.18(l);1P;1c\'$=\':j(30.15(K+\'$\'))1p.18(l)}h 1p});h 1p}});k 6j=M 11({14:0,1e:f(u){9.u={};I(k n W u){9.u[n]=u[n];9.14++}},8l:f(1O){h 9.u[1O]},1U:f(1O,K){j(K==1K)h T;j(9.u[1O]==3z)9.14++;9.u[1O]=K;h 9},3Z:f(1O){j(9.u[1O]==3z)h T;k u={};9.14--;I(k n W 9.u){j(n!=1O)u[n]=9.u[n]}9.u=u;h 9},1o:f(O,J){I(k n W 9.u)O.1i(J||9,n,9.u[n])},N:f(u){9.1e(1H.N(9.u,u));h 9},1G:f(){h(9.14==0)},1u:f(){k 1u=[];I(k n W 9.u)1u.18(n);h 1u},1z:f(){k 1z=[];I(k n W 9.u)1z.18(9.u[n]);h 1z}});f $H(u){h M 6j(u)};k 2q=M 11({1e:f(1A){j(1A.6i&&1A.6h)h 1A;k 1l=(1A.18)?1A:1A.3s(1g);h 1H.N(1l,2q.U)},6i:f(){k 3y=$A(Y);k 3x=50;j($q(3y[3y.14-1])==\'5N\')3x=3y.8k();k 1l=9.54();3y.1o(f(1A){1A=M 2q(1A);I(k i=0;i<3;i++)1l[i]=G.3e((1l[i]/ 3g * (3g - 3x)) + (1A[i] /3g*3x))});h M 2q(1l)},6h:f(){k 1l=[];I(k i=0;i<3;i++)1l.18(8j-9[i]);h M 2q(1l)}});f $C(1A){h M 2q(1A)};12.N=1H.N;12.N({8i:f(){j(9.53)6g{L.8h("8g",T,1g)}6f(e){}},1a:f(q,O){j(q==\'3u\'){j(9.3Y)O();Q j(!9.V||!9.V.3u){k 3v=f(){j(9.3Y)h;9.3Y=1g;j(9.1f)9.1f=$3Q(9.1f);1b.U.1x.1i(9,\'3u\');9.V.3u=1K}.J(9);j(L.3X&&9.3W){9.1f=f(){j([\'3Y\',\'6d\'].15(L.3X))3v()}.2k(50)}Q j(L.3X&&9.3w){L.8f("<52 2Z=6e 8e 8d=8c:8b(0)><\\/52>");$(\'6e\').8a=f(){j(9.3X==\'6d\')3v()}}Q{9.1a("89",3v);L.1a("88",3v)}}}1b.U.1a.1i(9,q,O);h 9},87:f(6c){h 9.1a(\'3u\',6c)}});12.N({63:f(){j(9.3W||9.51)h 9.86;Q h L.2r.6b||L.4N.6b},62:f(){j(9.3W||9.51)h 9.85;h L.2r.6a||L.4N.6a},60:f(){h L.2r.69},61:f(){h L.2r.68},64:f(){h 9.67||L.2r.3V},65:f(){h 9.66||L.2r.3U},3P:f(){h{\'1V\':{\'x\':9.65(),\'y\':9.64()},\'2A\':{\'x\':9.63(),\'y\':9.62()},\'3O\':{\'x\':9.61(),\'y\':9.60()}}},2O:f(){h{\'x\':0,\'y\':0}}});k X={};X.1C=M 11({2j:f(){h{2K:11.1G,2g:11.1G,5T:11.1G,5Y:X.2Q.4U,4Z:84,1J:\'4I\',2T:1g,5U:50}},1e:f(m){9.r=9.r||1K;9.2N(9.2j(),m);j(9.m.1e)9.m.1e.1i(9)},19:f(){k 2Y=M 5W().5V();j(2Y<9.2Y+9.m.4Z){9.5X=2Y-9.2Y;9.2E();9.2o()}Q{9.1s(1g);9.P=9.B;9.2o();9.1x(\'2g\',9.r,10);9.5Z()}},1U:f(B){9.P=B;9.2o();h 9},2E:f(){9.P=9.2D(9.F,9.B)},2D:f(F,B){h 9.m.5Y(9.5X,F,(B-F),9.m.4Z)},1m:f(F,B){j(!9.m.2T)9.1s();Q j(9.1f)h 9;9.F=F;9.B=B;9.2Y=M 5W().5V();9.1f=9.19.2k(G.3e(83/9.m.5U),9);9.1x(\'2K\',9.r);h 9},1s:f(2h){j(!9.1f)h 9;9.1f=$3Q(9.1f);j(!2h)9.1x(\'5T\',9.r);h 9},82:f(F,B){h 9.1m(F,B)},81:f(2h){h 9.1s(2h)}});X.1C.1T(M 5S);X.1C.1T(M 3c);X.1C.1T(M 3b);X.2Q={5F:f(t,b,c,d){h c*t/d+b},4U:f(t,b,c,d){h-c/2*(G.4T(G.1X*t/d)-1)+b}};X.23={2U:f(n,B){j(n.15(\'1A\',\'i\'))h 9.2q;j(B.15&&B.15(\' \'))h 9.3T;h 9.5R},1M:f(l,n,2X){j(!2X.18)2X=[2X];k F=2X[0],B=2X[1];j(!B&&B!=0){B=F;F=l.1W(n)}k 17=9.2U(n,B);h{F:17.1M(F),B:17.1M(B),17:17}}};X.23.5R={1M:f(K){h 3t(K)},2V:f(F,B,2W){h 2W.2D(F,B)},2F:f(K,1J){h K+1J}};X.23.3T={1M:f(K){h K.18?K:K.4Y(\' \').4X(f(v){h 3t(v)})},2V:f(F,B,2W){k P=[];I(k i=0;i<F.14;i++)P[i]=2W.2D(F[i],B[i]);h P},2F:f(K,1J){h K.3r(1J+\' \')+1J}};X.23.2q={1M:f(K){h K.18?K:K.3s(1g)},2V:f(F,B,2W){k P=[];I(k i=0;i<F.14;i++)P[i]=G.3e(2W.2D(F[i],B[i]));h P},2F:f(K){h\'1l(\'+K.3r(\',\')+\')\'}};X.5Q=X.1C.N({1e:f(l,n,m){9.r=$(l);9.n=n;9.1t(m)},5I:f(){h 9.1U(0)},2E:f(){9.P=9.17.2V(9.F,9.B,9)},1U:f(B){9.17=X.23.2U(9.n,B);h 9.1t(9.17.1M(B))},1m:f(F,B){j(9.1f&&9.m.2T)h 9;k 1n=X.23.1M(9.r,9.n,[F,B]);9.17=1n.17;h 9.1t(1n.F,1n.B)},2o:f(){9.r.1F(9.n,9.17.2F(9.P,9.m.1J))}});1b.N({80:f(n,m){h M X.5Q(9,n,m)}});X.5P=X.1C.N({1e:f(l,m){9.r=$(l);9.1t(m)},2E:f(){I(k p W 9.F)9.P[p]=9.17[p].2V(9.F[p],9.B[p],9)},1U:f(B){k 1n={};9.17={};I(k p W B){9.17[p]=X.23.2U(p,B[p]);1n[p]=9.17[p].1M(B[p])}h 9.1t(1n)},1m:f(u){j(9.1f&&9.m.2T)h 9;9.P={};9.17={};k F={},B={};I(k p W u){k 1n=X.23.1M(9.r,p,u[p]);F[p]=1n.F;B[p]=1n.B;9.17[p]=1n.17}h 9.1t(F,B)},2o:f(){I(k p W 9.P)9.r.1F(p,9.17[p].2F(9.P[p],9.m.1J))}});1b.N({7Z:f(m){h M X.5P(9,m)}});X.1N=X.1C.N({1e:f(1w,m){9.1w=$$(1w);9.1t(m)},2E:f(){I(k i W 9.F){k 3q=9.F[i],2p=9.B[i],2b=9.17[i],3p=9.P[i]={};I(k p W 3q)3p[p]=2b[p].2V(3q[p],2p[p],9)}},1U:f(B){k 1n={};9.17={};I(k i W B){k 2p=B[i],2b=9.17[i]={},5O=1n[i]={};I(k p W 2p){2b[p]=X.23.2U(p,2p[p]);5O[p]=2b[p].1M(2p[p])}}h 9.1t(1n)},1m:f(u){j(9.1f&&9.m.2T)h 9;9.P={};9.17={};k F={},B={};I(k i W u){k 4W=u[i],3q=F[i]={},2p=B[i]={},2b=9.17[i]={};I(k p W 4W){k 1n=X.23.1M(9.1w[i],p,4W[p]);3q[p]=1n.F;2p[p]=1n.B;2b[p]=1n.17}}h 9.1t(F,B)},2o:f(){I(k i W 9.P){k 3p=9.P[i],2b=9.17[i];I(k p W 3p)9.1w[i].1F(p,2b[p].2F(3p[p],9.m.1J))}}});X.7Y=X.1C.N({1e:f(r,m){9.P=[];9.r=$(r);9.1a(\'2K\',f(){9.r.1a(\'2M\',9.1s.J(9,T))}.J(9));9.1E(\'2g\',f(){9.r.1E(\'2M\',9.1s.J(9,T))}.J(9));9.1t(m)},2E:f(){I(k i=0;i<2;i++)9.P[i]=9.2D(9.F[i],9.B[i])},2a:f(x,y){j(9.1f&&9.m.2T)h 9;k l=9.r.3P();k 1z={\'x\':x,\'y\':y};I(k z W l.2A){k 1B=l.3O[z]-l.2A[z];j($2B(1z[z]))1z[z]=($q(1z[z])==\'5N\')?G.1B(G.3o(1z[z],1B),0):1B;Q 1z[z]=l.1V[z]}h 9.1m([l.1V.x,l.1V.y],[1z.x,1z.y])},7X:f(){h 9.2a(T,0)},7W:f(){h 9.2a(T,\'5M\')},7V:f(){h 9.2a(0,T)},7U:f(){h 9.2a(\'5M\',T)},5L:f(l){h 9.2a($(l).4F(),$(l).4D())},2o:f(){9.r.2a(9.P[0],9.P[1])}});X.7T=X.1C.N({1e:f(l,m){9.r=$(l).1F(\'2n\',0);9.2R=M 1b(\'7S\').5K(9.r).1F(\'7R\',\'3S\').5J(9.r);9.2N({\'1k\':\'4E\'},m);9.P=[];9.1t(9.m)},2E:f(){I(k i=0;i<2;i++)9.P[i]=9.2D(9.F[i],9.B[i])},4E:f(){9.2n=\'2w\';9.4V=\'3i\';9.2S=9.r.2v;h[9.r.1W(\'2n-2w\').2C(),9.2R.1W(\'3i\').2C()]},4G:f(){9.2n=\'2i\';9.4V=\'3j\';9.2S=9.r.2x;h[9.r.1W(\'2n-2i\').2C(),9.2R.1W(\'3j\').2C()]},5H:f(1k){h 9.1m(9[1k||9.m.1k](),[0,9.2S])},5G:f(1k){h 9.1m(9[1k||9.m.1k](),[-9.2S,0])},5I:f(1k){9[1k||9.m.1k]();h 9.1U([-9.2S,0])},7Q:f(1k){9[1k||9.m.1k]();h 9.1U([0,9.2S])},7P:f(1k){j(9.2R.2v==0||9.2R.2x==0)h 9.5H(1k);Q h 9.5G(1k)},2o:f(){9.r.1F(\'2n-\'+9.2n,9.P[0]+9.m.1J);9.2R.1F(9.4V,9.P[1]+9.m.1J)}});X.2Q={5F:f(t,b,c,d){h c*t/d+b},7O:f(t,b,c,d){h c*(t/=d)*t+b},7N:f(t,b,c,d){h-c*(t/=d)*(t-2)+b},7M:f(t,b,c,d){j((t/=d/2)<1)h c/2*t*t+b;h-c/2*((--t)*(t-2)-1)+b},7L:f(t,b,c,d){h c*(t/=d)*t*t+b},7K:f(t,b,c,d){h c*((t=t/d-1)*t*t+1)+b},7J:f(t,b,c,d){j((t/=d/2)<1)h c/2*t*t*t+b;h c/2*((t-=2)*t*t+2)+b},7I:f(t,b,c,d){h c*(t/=d)*t*t*t+b},7H:f(t,b,c,d){h-c*((t=t/d-1)*t*t*t-1)+b},7G:f(t,b,c,d){j((t/=d/2)<1)h c/2*t*t*t*t+b;h-c/2*((t-=2)*t*t*t-2)+b},7F:f(t,b,c,d){h c*(t/=d)*t*t*t*t+b},7E:f(t,b,c,d){h c*((t=t/d-1)*t*t*t*t+1)+b},7D:f(t,b,c,d){j((t/=d/2)<1)h c/2*t*t*t*t*t+b;h c/2*((t-=2)*t*t*t*t+2)+b},7C:f(t,b,c,d){h-c*G.4T(t/d*(G.1X/2))+c+b},7B:f(t,b,c,d){h c*G.3n(t/d*(G.1X/2))+b},4U:f(t,b,c,d){h-c/2*(G.4T(G.1X*t/d)-1)+b},7A:f(t,b,c,d){h(t==0)?b:c*G.22(2,10*(t/d-1))+b},7z:f(t,b,c,d){h(t==d)?b+c:c*(-G.22(2,-10*t/d)+1)+b},7y:f(t,b,c,d){j(t==0)h b;j(t==d)h b+c;j((t/=d/2)<1)h c/2*G.22(2,10*(t-1))+b;h c/2*(-G.22(2,-10*--t)+2)+b},7x:f(t,b,c,d){h-c*(G.3m(1-(t/=d)*t)-1)+b},7w:f(t,b,c,d){h c*G.3m(1-(t=t/d-1)*t)+b},7v:f(t,b,c,d){j((t/=d/2)<1)h-c/2*(G.3m(1-t*t)-1)+b;h c/2*(G.3m(1-(t-=2)*t)+1)+b},7u:f(t,b,c,d,a,p){j(t==0)h b;j((t/=d)==1)h b+c;j(!p)p=d*.3;j(!a)a=1;j(a<G.4S(c)){a=c;k s=p/4}Q k s=p/(2*G.1X)*G.4R(c/a);h-(a*G.22(2,10*(t-=1))*G.3n((t*d-s)*(2*G.1X)/p))+b},7t:f(t,b,c,d,a,p){j(t==0)h b;j((t/=d)==1)h b+c;j(!p)p=d*.3;j(!a)a=1;j(a<G.4S(c)){a=c;k s=p/4}Q k s=p/(2*G.1X)*G.4R(c/a);h a*G.22(2,-10*t)*G.3n((t*d-s)*(2*G.1X)/p)+c+b},7s:f(t,b,c,d,a,p){j(t==0)h b;j((t/=d/2)==2)h b+c;j(!p)p=d*(.3*1.5);j(!a)a=1;j(a<G.4S(c)){a=c;k s=p/4}Q k s=p/(2*G.1X)*G.4R(c/a);j(t<1)h-.5*(a*G.22(2,10*(t-=1))*G.3n((t*d-s)*(2*G.1X)/p))+b;h a*G.22(2,-10*(t-=1))*G.3n((t*d-s)*(2*G.1X)/p)*.5+c+b},7r:f(t,b,c,d,s){j(!s)s=1.4Q;h c*(t/=d)*t*((s+1)*t-s)+b},7q:f(t,b,c,d,s){j(!s)s=1.4Q;h c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},7p:f(t,b,c,d,s){j(!s)s=1.4Q;j((t/=d/2)<1)h c/2*(t*t*(((s*=(1.5E))+1)*t-s))+b;h c/2*((t-=2)*t*(((s*=(1.5E))+1)*t+s)+2)+b},5D:f(t,b,c,d){h c-X.2Q.4P(d-t,0,c,d)+b},4P:f(t,b,c,d){j((t/=d)<(1/2.75)){h c*(7.3R*t*t)+b}Q j(t<(2/2.75)){h c*(7.3R*(t-=(1.5/2.75))*t+.75)+b}Q j(t<(2.5/2.75)){h c*(7.3R*(t-=(2.25/2.75))*t+.7o)+b}Q{h c*(7.3R*(t-=(2.7n/2.75))*t+.7m)+b}},7l:f(t,b,c,d){j(t<d/2)h X.2Q.5D(t*2,0,c,d)*.5+b;h X.2Q.4P(t*2-d,0,c,d)*.5+c*.5+b}};k 2L={};2L.1C=M 11({2j:f(){h{3k:T,1J:\'4I\',2K:11.1G,2g:11.1G,5B:11.1G,4A:11.1G,1j:T,2u:{x:\'2i\',y:\'2w\'},3N:6}},1e:f(l,m){9.2N(9.2j(),m);9.r=$(l);9.3k=$(9.m.3k)||9.r;9.2l={\'P\':{},\'1D\':{}};9.K={\'1m\':{},\'P\':{}};9.1I={\'1m\':9.1m.2y(9)};9.3k.1a(\'4H\',9.1I.1m);j(9.m.1e)9.m.1e.1i(9)},1m:f(o){9.2l.1m=o.1y;k 1j=9.m.1j;9.1j={\'x\':[],\'y\':[]};I(k z W 9.m.2u){9.K.P[z]=9.r.1W(9.m.2u[z]).2C();9.2l.1D[z]=o.1y[z]-9.K.P[z];j(1j&&1j[z]){I(k i=0;i<2;i++){j($2B(1j[z][i]))9.1j[z][i]=1j[z][i].2m?1j[z][i].1i(9):1j[z][i]}}}9.1I.29=9.29.2y(9);9.1I.3l=9.3l.2y(9);9.1I.1s=9.1s.J(9);L.1a(\'2P\',9.m.3N?9.1I.3l:9.1I.29);L.1a(\'5A\',9.1I.1s);9.1x(\'2K\',9.r);o.1s()},3l:f(o){k 5C=G.3e(G.3m(G.22(o.1y.x-9.2l.1m.x,2)+G.22(o.1y.y-9.2l.1m.y,2)));j(5C>9.m.3N){L.1E(\'2P\',9.1I.3l);L.1a(\'2P\',9.1I.29);9.29(o);9.1x(\'5B\',9.r)}o.1s()},29:f(o){9.4O=T;9.2l.P=o.1y;I(k z W 9.m.2u){9.K.P[z]=o.1y[z]-9.2l.1D[z];j(9.1j[z]){j($2B(9.1j[z][1])&&(9.K.P[z]>9.1j[z][1])){9.K.P[z]=9.1j[z][1];9.4O=1g}Q j($2B(9.1j[z][0])&&(9.K.P[z]<9.1j[z][0])){9.K.P[z]=9.1j[z][0];9.4O=1g}}9.r.1F(9.m.2u[z],9.K.P[z]+9.m.1J)}9.1x(\'4A\',9.r);o.1s()},7k:f(){9.3k.1E(\'4H\',9.1I.1m)},1s:f(){L.1E(\'2P\',9.1I.29);L.1E(\'5A\',9.1I.1s);9.1x(\'2g\',9.r)}});2L.1C.1T(M 3c);2L.1C.1T(M 3b);1b.N({7j:f(m){h M 2L.1C(9,1H.N(m||{},{2u:{x:\'3j\',y:\'3i\'}}))}});k 4J=M 11({2j:f(){h{3h:20,4K:1,3K:f(x,y){9.r.2a(x,y)}}},1e:f(r,m){9.2N(9.2j(),m);9.r=$(r);9.4M=([12,L].15(r))?$(L.4N):9.r},1m:f(){9.4L=9.5z.2y(9);9.4M.1a(\'2P\',9.4L)},1s:f(){9.4M.1E(\'2P\',9.4L);9.1f=$3Q(9.1f)},5z:f(o){9.1y=(9.r==12)?o.5y:o.1y;j(!9.1f)9.1f=9.1V.2k(50,9)},1V:f(){k l=9.r.3P();k 1D=9.r.2O();k 2z={\'x\':0,\'y\':0};I(k z W 9.1y){j(9.1y[z]<(9.m.3h+1D[z])&&l.1V[z]!=0)2z[z]=(9.1y[z]-9.m.3h-1D[z])*9.m.4K;Q j(9.1y[z]+9.m.3h>(l.2A[z]+1D[z])&&l.1V[z]+l.2A[z]!=l.3O[z])2z[z]=(9.1y[z]-l.2A[z]+9.m.3h-1D[z])*9.m.4K}j(2z.y||2z.x)9.1x(\'3K\',[l.1V.x+2z.x,l.1V.y+2z.y])}});4J.1T(M 3c);4J.1T(M 3b);k 4t=M 11({2j:f(){h{3K:11.1G,2g:11.1G,4x:f(1D){9.21.1F(9.p,1D+\'4I\')},3d:3g,1k:\'4G\',3f:T}},1e:f(l,21,m){9.r=$(l);9.21=$(21);9.2N(9.2j(),m);9.4w=-1;9.4v=-1;9.19=-1;9.r.1a(\'4H\',9.5w.2y(9));j(9.m.3f)9.r.1a(\'2M\',9.5x.2y(9));j(9.m.1k==\'4G\'){9.z=\'x\';9.p=\'2i\';9.1B=9.r.2x-9.21.2x;9.4y=9.21.2x/2;9.4z=9.r.4F.J(9.r)}Q j(9.m.1k==\'4E\'){9.z=\'y\';9.p=\'2w\';9.1B=9.r.2v-9.21.2v;9.4y=9.21.2v/2;9.4z=9.r.4D.J(9.r)}9.21.1F(\'1Z\',\'7i\').1F(9.p,0);k 4B={},4C={};4C[9.z]=[0,9.1B];4B[9.z]=9.p;9.29=M 2L.1C(9.21,{1j:4C,3N:0,2u:4B,2K:f(){9.3M()}.J(9),4A:f(){9.3M()}.J(9),2g:f(){9.3M();9.2h()}.J(9)});j(9.m.1e)9.m.1e.1i(9)},1U:f(19){j(19>9.m.3d)19=9.m.3d;Q j(19<0)19=0;9.19=19;9.3L();9.2h();9.1x(\'4x\',9.5v(9.19)+\'\');h 9},5x:f(o){j(o.3f<0)9.1U(9.19+1);Q j(o.3f>0)9.1U(9.19-1);o.1s()},5w:f(o){k 1Z=o.1y[9.z]-9.4z()-9.4y;j(1Z>9.1B)1Z=9.1B;Q j(1Z<0)1Z=0;9.19=9.4u(1Z);9.3L();9.2h();9.1x(\'4x\',1Z+\'\')},3M:f(){9.19=9.4u(9.29.K.P[9.z]);9.3L()},3L:f(){j(9.4w!=9.19){9.4w=9.19;9.1x(\'3K\',9.19)}},2h:f(){j(9.4v!==9.19){9.4v=9.19;9.1x(\'2g\',9.19+\'\')}},4u:f(1Z){h G.3e(1Z/9.1B*9.m.3d)},5v:f(19){h(9.1B)*19/9.m.3d}});4t.1T(M 3c);4t.1T(M 3b);',62,619,'|||||||||this||||||function||return||if|var|el|options|property|event||type|element|||obj|||||||to||||from|Math||for|bind|value|document|new|extend|fn|now|else|args||false|prototype|events|in|Fx|arguments|||Class|window||length|test||css|push|step|addEvent|Element|case|className|initialize|timer|true|style|call|limit|mode|rgb|start|parsed|each|found|param|Array|stop|parent|keys|selector|elements|fireEvent|page|values|color|max|Base|pos|removeEvent|setStyle|empty|Object|bound|unit|null|source|parse|Elements|key|break|filters|array|properties|implement|set|scroll|getStyle|PI|opacity|position||knob|pow|CSS|name||parentNode||match|drag|scrollTo|iCss|switch|delay|create|current|onComplete|end|left|getOptions|periodical|mouse|apply|margin|increase|iTo|Color|documentElement|previous|returns|modifiers|offsetHeight|top|offsetWidth|bindWithEvent|change|size|chk|toInt|compute|setNow|getValue|getElementsBySelector|chains|HTMLElement|hex|onStart|Drag|mousewheel|setOptions|getOffsets|mousemove|Transitions|wrapper|offset|wait|select|getNow|fx|fromTo|time|id|att|Garbage||text|while|replace|newArray||||item|Options|Events|steps|round|wheel|100|area|height|width|handle|checkAndDrag|sqrt|sin|min|iNow|iFrom|join|hexToRgb|parseFloat|domready|domReady|ie|alpha|colors|undefined|hasClass|getElements|getTag|filter|option|Event|toLowerCase|target|rgbToHex|items|onChange|checkStep|draggedKnob|snap|scrollSize|getSize|clear|5625|hidden|Multi|scrollLeft|scrollTop|khtml|readyState|loaded|remove||tagName|getElement|sel|getElementById|clean||splice|preventDefault|stopPropagation|relatedTarget|offsetTop|offsetLeft|setProperty|attribute|whitespace|indexOf|currentStyle|visibility|string|appendChild|inject|instanceof|ms|attempt|bit|forEach|pr0t0typ3|klass|Slider|toStep|previousEnd|previousChange|onTick|half|getPos|onDrag|modSlide|limSlide|getTop|vertical|getLeft|horizontal|mousedown|px|Scroller|velocity|coord|mousemover|body|out|bounceOut|70158|asin|abs|cos|sineInOut|layout|iProps|map|split|duration||opera|script|ie6|copy|operator|getElementsByTagName|els|on|Function|right|pageY|pageX|code|String|DOMMouseScroll|trash|removeEvents|offs|getBrother|getNext|what|gecko|camelCase|object|Native|result|typeof|parseInt|charAt|results|toPosition|clickedElement|scrolledElement|client|getCoords|mouseup|onSnap|distance|bounceIn|525|linear|slideOut|slideIn|hide|adopt|injectAfter|toElement|full|number|iParsed|Styles|Style|Single|Chain|onCancel|fps|getTime|Date|cTime|transition|callChain|getScrollHeight|getScrollWidth|getHeight|getWidth|getScrollTop|getScrollLeft|pageXOffset|pageYOffset|scrollWidth|scrollHeight|clientHeight|clientWidth|init|complete|ie_ready|catch|try|invert|mix|Hash|getAttribute|filterByAttribute|filterByTagName|filterByClassName|filterById|w_|defaults|which|clientY|clientX|special|120|wheelDelta|nodeType|unload|collect|selectedIndex|bottom|class|html|setAttribute|default|replaceWith|createElement|setStyles|childNodes|Sibling|evType|removeEventListener|addEventListener|hyphenate|defaultView|visible|setOpacity|cssText|addClass|removeClass|contents|inside|after|before|insertBefore|where|_elements_extended_|_element_extended_|err|toFloat||Number|trim|toUpperCase|params|regex|iterable|some|every|random|picked|parentize|noinit|relative|makeResizable|detach|bounceInOut|984375|625|9375|backInOut|backOut|backIn|elasticInOut|elasticOut|elasticIn|circInOut|circOut|circIn|expoInOut|expoOut|expoIn|sineOut|sineIn|quintInOut|quintOut|quintIn|quartInOut|quartOut|quartIn|cubicInOut|cubicOut|cubicIn|quadInOut|quadOut|quadIn|toggle|show|overflow|div|Slide|toRight|toLeft|toBottom|toTop|Scroll|effects|effect|clearTimer|custom|1000|500|innerHeight|innerWidth|onDomReady|DOMContentLoaded|load|onreadystatechange|void|javascript|src|defer|write|BackgroundImageCache|execCommand|disableImageCache|255|pop|get|tag|getElementsByClassName|ES|clearChain|chain|delete|backspace|space|esc|down|up|enter|returnValue|cancelBubble|mouseout|fromElement|mouseover|button|rightClick|click|fromCharCode|keyCode|detail|metaKey|meta|altKey|alt|ctrlKey|control|shiftKey|shift|srcElement|Window|textarea|password|radio|checkbox|checked|input|getPosition|offsetParent|do|getProperty|innerHTML|setHTML|setProperties|attributes|getChildren|getParent|previousSibling|lastChild|getLast|nextSibling|firstChild|getFirst|next|getPrevious|detachEvent|addEvents|attachEvent|getPropertyValue|getComputedStyle|padding|zoom|hasLayout|toggleClass|createTextNode|styleSheet|appendText|replaceChild|cloneNode|clone|removeChild|injectInside|injectBefore|embed|bindAsEventListener|pass|finally|setInterval|setTimeout|concat|toString|transparent|capitalize|RegExp|associate|getBoxObjectFor|taintEnabled|navigator|all|ie7|XMLHttpRequest|ActiveXObject|clearInterval|clearTimeout|floor|pick|textnode|nodeValue|nodeName'.split('|'),0,{}))

/* -------------- /javascripts/jd.gallery.js ------------- */ 
/*
    This file is part of JonDesign's SmoothGallery v1.0.1.

    JonDesign's SmoothGallery is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    JonDesign's SmoothGallery is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with JonDesign's SmoothGallery; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

    Main Developer: Jonathan Schemoul (JonDesign: http://www.jondesign.net/)
    Contributed code by:
    - Christian Ehret (bugfix)
	- Nitrix (bugfix)
	- Valerio from Mad4Milk for his great help with the carousel scrolling and many other things.
	- Archie Cowan for helping me find a bugfix on carousel inner width problem.
	Many thanks to:
	- The mootools team for the great mootools lib, and it's help and support throughout the project.
*/


var $removeEvents = function (object, type)
{
	if (!object.events) return object;
	if (type){
		if (!object.events[type]) return object;
		for (var fn in object.events[type]) object.removeEvent(type, fn);
		object.events[type] = null;
	} else {
		for (var evType in object.events) object.removeEvents(evType);
		object.events = null;
	}
	return object;
};
		
		
// declaring the class
var gallery = new Class({
	initialize: function(element, options) {
		this.setOptions({
			showArrows: true,
			showCarousel: true,
			showInfopane: true,
			thumbHeight: 75,
			thumbWidth: 100,
			thumbSpacing: 10,
			embedLinks: true,
			fadeDuration: 500,
			timed: false,
			delay: 9000,
			preloader: true,
			manualData: [],
			populateData: true,
			elementSelector: "div.imageElement",
			titleSelector: "h3",
			subtitleSelector: "p",
			linkSelector: "a.open",
			imageSelector: "img.full",
			thumbnailSelector: "img.thumbnail",
			slideInfoZoneOpacity: 0.7,
			carouselMinimizedOpacity: 0.4,
			carouselMinimizedHeight: 20,
			carouselMaximizedOpacity: 0.7, 
			destroyAfterPopulate: true,
			baseClass: 'jdGallery',
			withArrowsClass: 'withArrows',
			textShowCarousel: 'Pictures',
			useThumbGenerator: false,
			thumbGenerator: 'resizer.php'
		}, options);
		this.fireEvent('onInit');
		this.currentIter = 0;
		this.lastIter = 0;
		this.maxIter = 0;
		this.galleryElement = element;
		this.galleryData = this.options.manualData;
		this.galleryInit = 1;
		this.galleryElements = Array();
		this.thumbnailElements = Array();
		this.galleryElement.addClass(this.options.baseClass);
		if (this.options.populateData)
			this.populateData();
		element.style.display="block";
		
		if (this.options.embedLinks)
		{
			this.currentLink = new Element('a').addClass('open').setProperties({
				href: '#',
				title: ''
			}).injectInside(element);
			if ((!this.options.showArrows) && (!this.options.showCarousel))
				this.galleryElement = element = this.currentLink;
			else
				this.currentLink.setStyle('display', 'none');
		}
		
		this.constructElements();
		if ((data.length>1)&&(this.options.showArrows))
		{
			var leftArrow = new Element('a').addClass('left').addEvent(
				'click',
				this.prevItem.bind(this)
			).injectInside(element);
			var rightArrow = new Element('a').addClass('right').addEvent(
				'click',
				this.nextItem.bind(this)
			).injectInside(element);
			this.galleryElement.addClass(this.options.withArrowsClass);
		}
		this.loadingElement = new Element('div').addClass('loadingElement').injectInside(element);
		if (this.options.showInfopane) this.initInfoSlideshow();
		if (this.options.showCarousel) this.initCarousel();
		this.doSlideShow(1);
	},
	populateData: function() {
		currentArrayPlace = this.galleryData.length;
		options = this.options;
		data = this.galleryData;
		this.galleryElement.getElements(options.elementSelector).each(function(el) {
			elementDict = {
				image: el.getElement(options.imageSelector).getProperty('src'),
				number: currentArrayPlace
			};
			if ((options.showInfopane) | (options.showCarousel))
				Object.extend(elementDict, {
					title: el.getElement(options.titleSelector).innerHTML,
					description: el.getElement(options.subtitleSelector).innerHTML
				});
			if (options.embedLinks)
				Object.extend(elementDict, {
					link: el.getElement(options.linkSelector).href||false,
					linkTitle: el.getElement(options.linkSelector).title||false
				});
			if ((!options.useThumbGenerator) && (options.showCarousel))
				Object.extend(elementDict, {
					thumbnail: el.getElement(options.thumbnailSelector).src
				});
			else if (options.useThumbGenerator)
				Object.extend(elementDict, {
					thumbnail: 'resizer.php?imgfile=' + elementDict.image + '&max_width=' + options.thumbWidth + '&max_height=' + options.thumbHeight
				});
			
			data[currentArrayPlace] = elementDict;
			currentArrayPlace++;
			if (this.options.destroyAfterPopulate)
				el.remove();
		});
		this.galleryData = data;
		this.fireEvent('onPopulated');
	},
	constructElements: function() {
		el = this.galleryElement;
		this.maxIter = this.galleryData.length;
		var currentImg;
		for(i=0;i<this.galleryData.length;i++)
		{
			var currentImg = new Fx.Style(
				new Element('div').addClass('slideElement').setStyles({
					'position':'absolute',
					'left':'0px',
					'right':'0px',
					'margin':'0px',
					'padding':'0px',
					'backgroundImage':"url('" + this.galleryData[i].image + "')",
					'backgroundPosition':"center center",
					'opacity':'0'
				}).injectInside(el),
				'opacity',
				{duration: this.options.fadeDuration}
			);
			this.galleryElements[parseInt(i)] = currentImg;
		}
	},
	destroySlideShow: function(element) {
		var myClassName = element.className;
		var newElement = new Element('div').addClass('myClassName');
		element.parentNode.replaceChild(newElement, element);
	},
	startSlideShow: function() {
		this.fireEvent('onStart');
		this.loadingElement.style.display = "none";
		this.lastIter = this.maxIter - 1;
		this.currentIter = 0;
		this.galleryInit = 0;
		this.galleryElements[parseInt(this.currentIter)].set(1);
		if (this.options.showInfopane)
			this.showInfoSlideShow.delay(1000, this);
		this.prepareTimer();
		if (this.options.embedLinks)
			this.makeLink(this.currentIter);
	},
	nextItem: function() {
		this.fireEvent('onNextCalled');
		this.nextIter = this.currentIter+1;
		if (this.nextIter >= this.maxIter)
			this.nextIter = 0;
		this.galleryInit = 0;
		this.goTo(this.nextIter);
	},
	prevItem: function() {
		this.fireEvent('onPreviousCalled');
		this.nextIter = this.currentIter-1;
		if (this.nextIter <= -1)
			this.nextIter = this.maxIter - 1;
		this.galleryInit = 0;
		this.goTo(this.nextIter);
	},
	goTo: function(num) {
		this.clearTimer();
		if (this.options.embedLinks)
			this.clearLink();
		if (this.options.showInfopane)
		{
			this.slideInfoZone.clearChain();
			this.hideInfoSlideShow().chain(this.changeItem.pass(num, this));
		} else
			this.changeItem.delay(500, this, num);
		if (this.options.embedLinks)
			this.makeLink(num);
		this.prepareTimer();
		/*if (this.options.showCarousel)
			this.clearThumbnailsHighlights();*/
	},
	changeItem: function(num) {
		this.fireEvent('onStartChanging');
		this.galleryInit = 0;
		if (this.currentIter != num)
		{
			for(i=0;i<this.maxIter;i++)
			{
				if ((i != this.currentIter)) this.galleryElements[i].set(0);
			}
			if (num > this.currentIter) this.galleryElements[num].custom(1);
			else
			{
				this.galleryElements[num].set(1);
				this.galleryElements[this.currentIter].custom(0);
			}
			this.currentIter = num;
		}
		this.doSlideShow.bind(this)();
		this.fireEvent('onChanged');
	},
	clearTimer: function() {
		if (this.options.timed)
			$clear(this.timer);
	},
	prepareTimer: function() {
		if (this.options.timed)
			this.timer = this.nextItem.delay(this.options.delay, this);
	},
	doSlideShow: function(position) {
		if (this.galleryInit == 1)
		{
			imgPreloader = new Image();
			imgPreloader.onload=function(){
				this.startSlideShow.delay(10, this);
			}.bind(this);
			imgPreloader.src = this.galleryData[0].image;
		} else {
			if (this.options.showInfopane)
			{
				if (this.options.showInfopane)
				{
					this.showInfoSlideShow.delay((500 + this.options.fadeDuration), this);
				} else
					if (this.options.showCarousel)
						this.centerCarouselOn(position);
			}
		}
	},
	initCarousel: function () {
		var carouselContainerElement = new Element('div').addClass('carouselContainer').injectInside(this.galleryElement);
		this.carouselContainer = new Fx.Styles(carouselContainerElement, {transition: Fx.Transitions.expoOut});
		this.carouselContainer.normalHeight = carouselContainerElement.offsetHeight;
		this.carouselContainer.set({'opacity': this.options.carouselMinimizedOpacity, 'top': (this.options.carouselMinimizedHeight - this.carouselContainer.normalHeight)});
		
		this.carouselBtn = new Element('a').addClass('carouselBtn').setProperties({
			title: this.options.textShowCarousel
		}).setHTML(this.options.textShowCarousel).injectInside(carouselContainerElement);
		
		this.carouselBtn.addEvent(
			'click',
			function () {
				this.carouselContainer.clearTimer();
				this.toggleCarousel();
			}.bind(this)
		);
		this.carouselActive = false;

		var carouselElement = new Element('div').addClass('carousel').injectInside(carouselContainerElement);
		this.carousel = new Fx.Styles(carouselElement);
		
		this.carouselLabel = new Element('p').addClass('label').injectInside(this.carousel.element);
		this.carouselWrapper = new Element('div').addClass('carouselWrapper').injectInside(this.carousel.element);
		this.carouselInner = new Element('div').addClass('carouselInner').injectInside(this.carouselWrapper);

		this.carouselWrapper.scroller = new Scroller(this.carouselWrapper, {
			area: 100,
			velocity: 0.2
		})
		
		this.carouselWrapper.elementScroller = new Fx.Scroll(this.carouselWrapper, {
			duration: 400,
			onStart: this.carouselWrapper.scroller.stop.bind(this.carouselWrapper.scroller),
			onComplete: this.carouselWrapper.scroller.start.bind(this.carouselWrapper.scroller)
		});

		this.constructThumbnails();

		this.carouselInner.style.width = ((this.maxIter * (this.options.thumbWidth + this.options.thumbSpacing)) - this.options.thumbSpacing + this.options.thumbWidth) + "px";
	},
	toggleCarousel: function() {
		if (this.carouselActive)
			this.hideCarousel();
		else
			this.showCarousel();
	},
	showCarousel: function () {
		this.fireEvent('onShowCarousel');
		this.carouselContainer.custom({
			'opacity': this.options.carouselMaximizedOpacity,
			'top': 0
		}).addEvent('onComplete', function() { this.carouselActive = true; this.carouselWrapper.scroller.start(); }.bind(this));
	},
	hideCarousel: function () {
		this.fireEvent('onHideCarousel');
		this.carouselContainer.custom({
			'opacity': this.options.carouselMinimizedOpacity,
			'top': (this.options.carouselMinimizedHeight - this.carouselContainer.normalHeight)
		}).addEvent('onComplete', function() { this.carouselActive = false; this.carouselWrapper.scroller.stop(); }.bind(this));
	},
	constructThumbnails: function () {
		element = this.carouselInner;
		for(i=0;i<this.galleryData.length;i++)
		{
			var currentImg = new Fx.Style(new Element ('div').addClass("thumbnail").setStyles({
					backgroundImage: "url('" + this.galleryData[i].thumbnail + "')",
					backgroundPosition: "center center",
					backgroundRepeat: 'no-repeat',
					marginLeft: this.options.thumbSpacing + "px",
					width: this.options.thumbWidth + "px",
					height: this.options.thumbHeight + "px"
				}).injectInside(element), "opacity", {duration: 200}).set(0.2);
			currentImg.element.addEvents({
				'mouseover': function (myself) {
					myself.clearTimer();
					myself.custom(0.99);
					$(this.carouselLabel).setHTML('<span class="number">' + (myself.relatedImage.number + 1) + "/" + this.maxIter + ":</span> " + myself.relatedImage.title);
				}.pass(currentImg, this),
				'mouseout': function (myself) {
					myself.clearTimer();
					myself.custom(0.2);
				}.pass(currentImg, this),
				'click': function (myself) {
					this.goTo(myself.relatedImage.number);
				}.pass(currentImg, this)
			});
			
			currentImg.relatedImage = this.galleryData[i];
			this.thumbnailElements[parseInt(i)] = currentImg;
		}
	},
	clearThumbnailsHighlights: function()
	{
		for(i=0;i<this.galleryData.length;i++)
		{
			this.thumbnailElements[i].clearTimer();
			this.thumbnailElements[i].custom(0.2);
		}
	},
	centerCarouselOn: function(num) {
		var carouselElement = this.thumbnailElements[num];
		var position = carouselElement.element.offsetLeft + (carouselElement.element.offsetWidth / 2);
		var carouselWidth = this.carouselWrapper.offsetWidth;
		var carouselInnerWidth = this.carouselInner.offsetWidth;
		var diffWidth = carouselWidth / 2;
		var scrollPos = position-diffWidth;
		this.carouselWrapper.elementScroller.scrollTo(scrollPos,0);
	},
	initInfoSlideshow: function() {
		/*if (this.slideInfoZone.element)
			this.slideInfoZone.element.remove();*/
		this.slideInfoZone = new Fx.Styles(new Element('div').addClass('slideInfoZone').injectInside($(this.galleryElement))).set({'opacity':0});
		var slideInfoZoneTitle = new Element('h2').injectInside(this.slideInfoZone.element);
		var slideInfoZoneDescription = new Element('p').injectInside(this.slideInfoZone.element);
		this.slideInfoZone.normalHeight = this.slideInfoZone.element.offsetHeight;
		this.slideInfoZone.element.setStyle('opacity',0);
	},
	changeInfoSlideShow: function()
	{
		this.hideInfoSlideShow.delay(10, this);
		this.showInfoSlideShow.delay(500, this);
	},
	showInfoSlideShow: function() {
		this.fireEvent('onShowInfopane');
		this.slideInfoZone.clearTimer();
		element = this.slideInfoZone.element;
		element.getElement('h2').setHTML(this.galleryData[this.currentIter].title);
		element.getElement('p').setHTML(this.galleryData[this.currentIter].description);
		this.slideInfoZone.custom({'opacity': [0, this.options.slideInfoZoneOpacity], 'height': [0, this.slideInfoZone.normalHeight]});
		if (this.options.showCarousel)
			this.slideInfoZone.chain(this.centerCarouselOn.pass(this.currentIter, this));
		return this.slideInfoZone;
	},
	hideInfoSlideShow: function() {
		this.fireEvent('onHideInfopane');
		this.slideInfoZone.clearTimer();
		this.slideInfoZone.custom({'opacity': 0, 'height': 0});
		return this.slideInfoZone;
	},
	makeLink: function(num) {
		this.currentLink.setProperties({
			href: this.galleryData[num].link,
			title: this.galleryData[num].linkTitle
		})
		if (!((this.options.embedLinks) && (!this.options.showArrows) && (!this.options.showCarousel)))
			this.currentLink.setStyle('display', 'block');
	},
	clearLink: function() {
		this.currentLink.setProperties({href: '', title: ''});
		if (!((this.options.embedLinks) && (!this.options.showArrows) && (!this.options.showCarousel)))
			this.currentLink.setStyle('display', 'none');
	}
});
gallery.implement(new Events);
gallery.implement(new Options);

/* All code copyright 2006 Jonathan Schemoul */
/* -------------- /javascripts/slightbox.js ------------- */ 
/* All code copyright 2007 Taras Mankovski *//* email: tarasm@gmail.com *//* website: http://www.oscandy.com/author/taras */// This class adds lightbox functionality to smoothgallerygallery = gallery.extend({	initialize: function(element, options) {		this.parent(element, options);		this.addEvent('onPopulated', this.makeLink.bind(this));		if (options.lightbox) this.lightbox = new lightboxforsmoothgallery(this.galleryData, {});	},	populateData: function() {		currentArrayPlace = this.galleryData.length;		options = this.options;		data = this.galleryData;		this.galleryElement.getElements(options.elementSelector).each(function(el) {			elementDict = {				imagepath: el.getElement(options.linkSelector).getProperty('href'),				image: el.getElement(options.imageSelector).getProperty('src'),				number: currentArrayPlace			};			if ((options.showInfopane) | (options.showCarousel))				Object.extend(elementDict, {					title: el.getElement(options.titleSelector).innerHTML,					description: el.getElement(options.subtitleSelector).innerHTML				});			if (options.embedLinks)				Object.extend(elementDict, {					link: el.getElement(options.linkSelector).href||false,					linkTitle: el.getElement(options.linkSelector).title||false				});			if ((!options.useThumbGenerator) && (options.showCarousel))				Object.extend(elementDict, {					thumbnail: el.getElement(options.thumbnailSelector).src				});			else if (options.useThumbGenerator)				Object.extend(elementDict, {					thumbnail: 'resizer.php?imgfile=' + elementDict.image + '&max_width=' + options.thumbWidth + '&max_height=' + options.thumbHeight				});						data[currentArrayPlace] = elementDict;			currentArrayPlace++;			if (this.options.destroyAfterPopulate)				el.remove();		});		this.galleryData = data;		this.fireEvent('onPopulated');	},	makeLink: function (num) {		this.currentLink.setProperties({			href: this.galleryData[num].link,			title: this.galleryData[num].linkTitle		})		if (options.lightbox) this.currentLink.onclick = this.lightbox.open.pass(num, this.lightbox);		if (!((this.options.embedLinks) && (!this.options.showArrows) && (!this.options.showCarousel)))			this.currentLink.setStyle('display', 'block');		}});

/*
	Slimbox v1.22 - 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 = new Class({
	
	initialize: function(options) {
		this.options = Object.extend({
			resizeDuration: 400,		// Duration of height and width resizing (ms)
			initialWidth: 250,		// Initial width of the box (px)
			initialHeight: 250,		// Initial height of the box (px)
			animateCaption: true		// Enable/Disable caption animation
		}, options || {});
		this.anchors = [];
		$A(document.getElementsByTagName('a')).each(function(el){
			if(el.rel && el.href && 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);
		this.buildbox();
		var nextEffect = this.nextEffect.bind(this);
		this.fx = {
			overlay: this.overlay.effect('opacity', { duration: 500 }).hide(),
			resize: this.center.effects({ duration: this.options.resizeDuration, onComplete: nextEffect }),
			image: this.image.effect('opacity', { duration: 500, onComplete: nextEffect }),
			bottom: this.bottom.effects({ duration: 400, onComplete: nextEffect })
		};
		
		this.preloadPrev = new Image();
		this.preloadNext = new Image();
	},
	buildbox : function () {		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.image = new Element('div').setProperty('id', 'lbImage').injectInside(this.center);		this.prevLink = new Element('a').setProperties({id: 'lbPrevLink', href: '#'}).setStyle('display', 'none').injectInside(this.image);		this.nextLink = this.prevLink.clone().setProperty('id', 'lbNextLink').injectInside(this.image);		this.prevLink.onclick = this.previous.bind(this);		this.nextLink.onclick = this.next.bind(this);			this.bottom = new Element('div').setProperty('id', 'lbBottom').setStyle('display', 'none').injectInside(document.body);		new Element('a').setProperties({id: 'lbCloseLink', href: '#'}).injectInside(this.bottom).onclick = this.overlay.onclick = this.close.bind(this);		this.number = new Element('div').setProperty('id', 'lbNumber').injectInside(this.bottom);		this.caption = new Element('div').setProperty('id', 'lbCaption').injectInside(this.bottom);		new Element('div').setStyle('clear', 'both').injectInside(this.bottom);
	},
	click: function(link) {
		if(link.rel.length == 8) {
			return this.show(link.href, link.title);
		}
		var j, imageNum, images = [];
		this.anchors.each(function(el){
			if(el.rel == link.rel) {
				for(j = 0; j < images.length; j++)
					if(images[j][0] == el.href) break;
				if(j == images.length) {			
					images.push([el.href, el.title]);
					if(el.href == link.href) imageNum = j;
				}
			}
		}, this);
		return this.open(images, imageNum);
	},

	show: function(url, title) {
		return this.open([[url, title]], 0);
	},

	open: function(images, imageNum) {
		this.images = images;
		this.position();
		this.setup(true);
		this.top = Window.getScrollTop() + (Window.getHeight() / 15);
		this.center.setStyles({top: this.top+'px', display: ''});
		this.fx.overlay.custom(0.8);
		return this.changeImage(imageNum);
	},

	position: function() {
		this.overlay.setStyles({top: Window.getScrollTop()+'px', height: Window.getHeight()+'px'});
	},

	setup: function(open) {
		var elements = $A(document.getElementsByTagName('object'));
		elements.extend(document.getElementsByTagName(window.ActiveXObject ? 'select' : 'embed'));
		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.changeImage(this.activeImage-1);
	},

	next: function() {
		return this.changeImage(this.activeImage+1);
	},

	changeImage: function(imageNum) {		
		if(this.step || (imageNum < 0) || (imageNum >= this.images.length)) return false;
		this.step = 1;
		this.activeImage = imageNum;
		
		this.prevLink.style.display = this.nextLink.style.display = 'none';
		this.bottom.setStyles({opacity: '0', height: '0px', display: 'none'});
		this.fx.image.hide();
		this.center.className = 'lbLoading';
		
		this.preload = new Image();
		this.preload.onload = this.nextEffect.bind(this);
		this.preload.src = this.images[imageNum][0];
		return false;
	},

	nextEffect: function() {
		switch(this.step++) {
		case 1:
			this.center.className = '';
			this.image.setStyles({backgroundImage: 'url('+this.images[this.activeImage][0]+')', width: this.preload.width+'px'});
			this.image.style.height = this.prevLink.style.height = this.nextLink.style.height = this.preload.height+'px';
			
			this.caption.setHTML(this.images[this.activeImage][1] || '');
			this.number.setHTML((this.images.length == 1) ? '' : 'Image '+(this.activeImage+1)+' of '+this.images.length);
			
			if(this.activeImage != 0) this.preloadPrev.src = this.images[this.activeImage - 1][0];
			if(this.activeImage != (this.images.length - 1)) this.preloadNext.src = this.images[this.activeImage + 1][0];
			if(this.center.clientHeight != this.image.offsetHeight+20) {
				this.fx.resize.custom({height: [this.center.clientHeight, this.image.offsetHeight]});
				break;
			}
			this.step++;
		case 2:
			if(this.center.clientWidth != this.image.offsetWidth+20) {
				this.fx.resize.custom({width: [this.center.clientWidth, this.image.offsetWidth], marginLeft: [-this.center.clientWidth/2, -this.image.offsetWidth/2]});
				break;
			}
			this.step++;
		case 3:
			this.bottom.setStyles({top: (this.top + this.center.clientHeight)+'px', width: this.image.style.width, marginLeft: this.center.style.marginLeft, display: ''});
			this.fx.image.custom(0, 1);
			break;
		case 4:
			if(this.options.animateCaption) {
				this.fx.bottom.custom({opacity: [0, 1], height: [0, this.bottom.scrollHeight]});
				break;
			}
			this.bottom.setStyles({opacity: '1', height: this.bottom.scrollHeight+'px'});
		case 5:
			if(this.activeImage != 0) this.prevLink.style.display = '';
			if(this.activeImage != (this.images.length - 1)) this.nextLink.style.display = '';
			this.step = 0;
		}
	},

	close: function() {
		if(this.step < 0) return;
		this.step = -1;
		if(this.preload) {
			this.preload.onload = Class.empty;
			this.preload = null;
		}
		for(var f in this.fx) this.fx[f].clearTimer();
		this.center.style.display = this.bottom.style.display = 'none';
		this.fx.overlay.chain(this.setup.pass(false, this)).custom(0);
		return false;
	}
});

/* All code copyright 2007 Taras Mankovski *//* email: tarasm@gmail.com *//* website: http://www.oscandy.com/author/taras */// This class extends lightbox class and makes the lightbox compatible with smoothgalleryvar lightboxforsmoothgallery = Lightbox.extend({	initialize: function(galleryData, options) {		this.options = Object.extend({			resizeDuration: 400,	// Duration of height and width resizing (ms)			initialWidth: 250,		// Initial width of the box (px)			initialHeight: 250,		// Initial height of the box (px)			animateCaption: true	// Enable/Disable caption animation		}, options || {});				this.images = galleryData;				this.eventKeyDown = this.keyboardListener.bindAsEventListener(this);		this.eventPosition = this.position.bind(this);				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.image = new Element('div').setProperty('id', 'lbImage').injectInside(this.center);		this.prevLink = new Element('a').setProperties({id: 'lbPrevLink', href: '#'}).setStyle('display', 'none').injectInside(this.image);		this.nextLink = this.prevLink.clone().setProperty('id', 'lbNextLink').injectInside(this.image);		this.prevLink.onclick = this.previous.bind(this);		this.nextLink.onclick = this.next.bind(this);				this.bottom = new Element('div').setProperty('id', 'lbBottom').setStyle('display', 'none').injectInside(document.body);		this.close = new Element('a').setProperties({id: 'lbCloseLink', href: '#'}).injectInside(this.bottom).onclick = this.overlay.onclick = this.close.bind(this);		this.number = new Element('div').setProperty('id', 'lbNumber').addClass('gallery').injectInside(this.bottom);		this.description = new Element('div').setProperty('id', 'lbDescription').injectInside(this.bottom);		this.title = new Element('div').setProperty('id', 'lbTitle').injectInside(this.description);		new Element('div').setStyle('clear', 'both').injectInside(this.description);		this.caption = new Element('div').setProperty('id', 'lbCaption').injectInside(this.description);		new Element('div').setStyle('clear', 'both').injectInside(this.bottom);				var nextEffect = this.nextEffect.bind(this);		this.fx = {			overlay: this.overlay.effect('opacity', { duration: 500 }).hide(),			resize: this.center.effects({ duration: this.options.resizeDuration, onComplete: nextEffect }),			image: this.image.effect('opacity', { duration: 500, onComplete: nextEffect }),			bottom: this.bottom.effects({ duration: 400, onComplete: nextEffect })		};				this.preloadPrev = new Image();		this.preloadNext = new Image();				this.open.bind(this);		this.changeImage.bind(this);			},	buildbox : function () {		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.image = new Element('div').setProperty('id', 'lbImage').injectInside(this.center);		this.prevLink = new Element('a').setProperties({id: 'lbPrevLink', href: '#'}).setStyle('display', 'none').injectInside(this.image);		this.nextLink = this.prevLink.clone().setProperty('id', 'lbNextLink').injectInside(this.image);		this.prevLink.onclick = this.previous.bind(this);		this.nextLink.onclick = this.next.bind(this);			this.bottom = new Element('div').setProperty('id', 'lbBottom').setStyle('display', 'none').injectInside(document.body);		new Element('a').setProperties({id: 'lbCloseLink', href: '#'}).injectInside(this.bottom).onclick = this.overlay.onclick = this.close.bind(this);		new Element('div').setProperty('id', 'lbDescription').injectInside(this.bottom);		this.number = new Element('div').setProperty('id', 'lbNumber').injectInside(this.bottom);		this.title = new Element('div').setProperty('id', 'lbTitle').injectInside(this.description);		this.caption = new Element('div').setProperty('id', 'lbCaption').injectInside(this.description);		new Element('div').setStyle('clear', 'both').injectInside(this.bottom);	},	open: function(num) {		this.position();		this.setup(true);		this.top = Window.getScrollTop() + (Window.getHeight() / 15);		this.center.setStyles({top: this.top+'px', display: ''});		this.fx.overlay.custom(0.8);		return this.changeImage(num);	},	changeImage: function(num) {				if(this.step || (num < 0) || (num >= this.images.length)) return false;		this.step = 1;		this.activeImage = num;				this.prevLink.style.display = this.nextLink.style.display = 'none';		this.bottom.setStyles({opacity: '0', height: '0px', display: 'none'});		this.fx.image.hide();		this.center.className = 'lbLoading';				this.preload = new Image();		this.preload.onload = this.nextEffect.bind(this);		this.preload.src = this.images[num].imagepath;		return false;	},	nextEffect: function() {		switch(this.step++) {		case 1:			this.center.className = '';			this.image.setStyles({backgroundImage: 'url('+this.images[this.activeImage].imagepath+')', width: this.preload.width+'px'});			this.image.style.height = this.prevLink.style.height = this.nextLink.style.height = this.preload.height+'px';						this.title.setHTML(this.images[this.activeImage].title || '');			this.caption.setHTML(this.images[this.activeImage].description || '');			this.number.setHTML((this.images.length == 1) ? '' : 'Image '+(this.activeImage+1)+' of '+this.images.length);				if(this.activeImage != 0) this.preloadPrev.src = this.images[this.activeImage - 1].imagepath;			if(this.activeImage != (this.images.length - 1)) this.preloadNext.src = this.images[this.activeImage + 1].imagepath;			if(this.center.clientHeight != this.image.offsetHeight+20) {				this.fx.resize.custom({height: [this.center.clientHeight, this.image.offsetHeight]});				break;			}			this.step++;		case 2:			if(this.center.clientWidth != this.image.offsetWidth+20) {				this.fx.resize.custom({width: [this.center.clientWidth, this.image.offsetWidth], marginLeft: [-this.center.clientWidth/2, -this.image.offsetWidth/2]});				break;			}			this.step++;		case 3:			this.bottom.setStyles({top: (this.top + this.center.clientHeight)+'px', width: this.image.style.width, marginLeft: this.center.style.marginLeft, display: ''});			this.fx.image.custom(0, 1);			break;		case 4:			if(this.options.animateCaption) {				this.fx.bottom.custom({opacity: [0, 1], height: [0, this.bottom.scrollHeight]});				break;			}			this.bottom.setStyles({opacity: '1', height: this.bottom.scrollHeight+'px'});		case 5:			if(this.activeImage != 0) this.prevLink.style.display = '';			if(this.activeImage != (this.images.length - 1)) this.nextLink.style.display = '';			this.step = 0;		}	}});
