//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}('7 12=6(1i){7 2y=6(){8(4.1k&&$f(4.1k)==\'6\')5 4.1k.2o(4,B);R 5 4};$J(2y,4);2y.L=1i;5 2y};12.1T=6(){};12.L={J:6(1i){7 2N=$1Y(4.L);F(7 h Y 1i){7 3Q=2N[h];2N[h]=$4C(3Q,1i[h])}5 W 12(2N)},2E:6(1i){$J(4.L,1i)}};6 $f(H){8(H===1e||H===4c)5 K;7 f=3c H;8(f==\'1I\'){8(H.2h)5\'T\';8(H.11)5\'1c\';8(H.5m){1r(H.5l){N 1:5\'T\';N 3:5 H.59.Q(/\\S/)?\'5x\':\'3Z\'}}}5 f};6 $1Y(){7 2t={};F(7 i=0;i<B.C;i++){F(7 h Y B[i]){7 34=B[i][h];7 2V=2t[h];8(2V&&$f(34)==\'1I\'&&$f(2V)==\'1I\')2t[h]=$1Y(2V,34);R 2t[h]=34}}5 2t};6 $4C(1x,1B){8(1x&&1x!=1B){7 35=$f(1x);7 3k=$f(1B);8(35==\'6\'&&3k==\'6\'){7 3e=6(){4.1w=B.53.1w;5 1B.2o(4,B)};3e.1w=1x;5 3e}R 8(35==\'1I\'&&3k==\'1I\'){5 $1Y(1x,1B)}}5 1B};7 $J=4z.J=6(){7 E=B;8(!E[1])E=[4,E[0]];F(7 h Y E[1])E[0][h]=E[1][h];5 E[0]};7 $2v=4z.55=6(){F(7 i=0;i<B.C;i++)B[i].J=$2v.J};$2v.J=6(1o){F(7 1b Y 1o){8(!4.L[1b])4.L[1b]=1o[1b]}};$2v(3I,1L,4S,4K,12);I.J=M.J=$J;7 56=I;6 $2u(H){5!!(H||H===0)};6 $51(H,4u){5($f(H))?H:4u};6 $4r(2O,39){5 1F.4Z(1F.4r()*(39-2O+1)+2O)};6 $1v(){5 W 4Y().5D()};6 $3t(19){5u(19);5s(19);5 1e};8(I.5p)I.2b=I[I.5q?\'5B\':\'3o\']=U;R 8(M.3A&&!M.58&&!5C.5A)I.2S=U;R 8(M.5y!=1e)I.3n=U;8(3c 2r==\'4c\'){7 2r=12.1T;8(I.2S)M.3U("5o");2r.L=(I.2S)?I["[[5n.L]]"]:{}}2r.L.2h=U;8(I.3o)42{M.5d("5e",K,U)}40(e){};1L.J({3f:6(n,u){F(7 i=0,j=4.C;i<j;i++)n.1d(u,4[i],i,4)},3L:6(n,u){7 1R=[];F(7 i=0,j=4.C;i<j;i++){8(n.1d(u,4[i],i,4))1R.11(4[i])}5 1R},4w:6(n,u){7 1R=[];F(7 i=0,j=4.C;i<j;i++)1R[i]=n.1d(u,4[i],i,4);5 1R},1J:6(n,u){F(7 i=0,j=4.C;i<j;i++){8(!n.1d(u,4[i],i,4))5 K}5 U},5b:6(n,u){F(7 i=0,j=4.C;i<j;i++){8(n.1d(u,4[i],i,4))5 U}5 K},3r:6(1s,o){o=o||0;7 2i=4.C;8(o<0)o=1F.39(0,2i+o);2K(o<2i){8(4[o]===1s)5 o;o++}5-1},4Q:6(13,C){13=13||0;8(13<0)13=4.C+13;C=C||(4.C-13);7 22=[];F(7 i=0;i<C;i++)22[i]=4[13++];5 22},3p:6(1s){7 i=0;7 2i=4.C;2K(i<2i){8(4[i]===1s)4.3y(i,1);R i++}5 4},Q:6(1s,o){5 4.3r(1s,o)!=-1},J:6(22){7 1U=4.C;F(7 i=0,j=22.C;i<j;i++)4[1U++]=22[i];5 4},5a:6(1m){7 H={},C=1F.2O(4.C,1m.C);F(7 i=0;i<C;i++)H[1m[i]]=4[i];5 H},2D:6(1s){8(!4.Q(1s))4.11(1s);5 4}});1L.L.15=1L.L.3f;6 $A(1c,13,C){5 1L.L.4Q.1d(1c,13,C)};6 $15(2n,n,u){8($2u(2n.C))1L.L.3f.1d(2n,n,u);R F(7 2k Y 2n)n.1d(u,2n[2k],2k)};4S.J({Q:6(2I,4W){5((3c 2I==\'2s\')?W 4a(2I,4W):2I).Q(4)},4J:6(){5 3h(4)},4v:6(){5 2f(4)},3w:6(){5 4.24(/-\\D/g,6(1t){5 1t.3d(1).4V()})},3T:6(){5 4.24(/\\w[A-Z]/g,6(1t){5(1t.3d(0)+\'-\'+1t.3d(1).2A())})},3V:6(){5 4.2A().24(/\\b[a-z]/g,6(1t){5 1t.4V()})},4N:6(){5 4.24(/^\\s+|\\s+$/g,\'\')},38:6(){5 4.24(/\\s{2,}/g,\' \').4N()},2X:6(1c){7 1g=4.1t(/\\d{1,3}/g);5(1g)?1g.2X(1c):K},32:6(1c){7 1N=4.1t(/^#?(\\w{1,2})(\\w{1,2})(\\w{1,2})$/);5(1N)?1N.5j(1).32(1c):K}});1L.J({2X:6(1c){8(4.C<3)5 K;8(4[3]&&(4[3]==0)&&!1c)5\'5h\';7 1N=[];F(7 i=0;i<3;i++){7 2B=(4[i]-0).5i(16);1N.11((2B.C==1)?\'0\'+2B:2B)}5 1c?1N:\'#\'+1N.23(\'\')},32:6(1c){8(4.C!=3)5 K;7 1g=[];F(7 i=0;i<3;i++){1g.11(3h((4[i].C==1)?4[i]+4[i]:4[i],16))}5 1c?1g:\'1g(\'+1g.23(\',\')+\')\'}});4K.J({4J:6(){5 3h(4)},4v:6(){5 2f(4)}});3I.J({1C:6(m){7 n=4;m=$1Y({\'u\':n,\'1a\':K,\'B\':1e,\'1u\':K,\'1O\':K,\'33\':K},m);8($2u(m.B)&&$f(m.B)!=\'1c\')m.B=[m.B];5 6(1a){7 E;8(m.1a){1a=1a||I.1a;E=[(m.1a===U)?1a:W m.1a(1a)];8(m.B)E=E.5k(m.B)}R E=m.B||B;7 1A=6(){5 n.2o(m.u,E)};8(m.1u)5 5g(1A,m.1u);8(m.1O)5 5f(1A,m.1O);8(m.33){42{5 1A()}40(43){5 43}}5 1A()}},5c:6(E,u){5 4.1C({\'B\':E,\'u\':u})},33:6(E,u){5 4.1C({\'B\':E,\'u\':u,\'33\':U})()},u:6(u,E){5 4.1C({\'u\':u,\'B\':E})},5z:6(u,E){5 4.1C({\'u\':u,\'1a\':U,\'B\':E})},1u:6(2W,u,E){5 4.1C({\'1u\':2W,\'u\':u,\'B\':E})()},1O:6(2W,u,E){5 4.1C({\'1O\':2W,\'u\':u,\'B\':E})()}});7 17=W 12({1k:6(9,1o){8($f(9)==\'2s\')9=M.3U(9);9=$(9);8(!1o||!9)5 9;F(7 1b Y 1o){1r(1b){N\'5w\':9.3v(1o[1b]);1l;N\'r\':9.3K(1o[1b]);1l;N\'5v\':9.4I(1o[1b]);1l;3s:9.2Z(1b,1o[1b])}}5 9}});6 $(9){8(!9)5 K;8(9.2h)5 1y.2m(9);8([I,M].Q(9))5 9;7 f=$f(9);8(f==\'2s\'){9=M.5r(9);f=(9)?\'T\':K}8(f!=\'T\')5 K;8([\'1I\',\'5t\'].Q(9.4H.2A()))5 9;$J(9,17.L);9.2h=U;5 1y.2m(9)};7 25=W 12({});$2v(25);M.3O=M.4X;6 $$(){8(!B)5 K;7 1n=[];F(7 i=0,j=B.C;i<j;i++){7 1z=B[i];1r($f(1z)){N\'T\':1n.2D($(1z));1l;N\'2s\':1z=M.3O(1z,U);3s:8(1z.C){F(7 k=0,l=1z.C;k<l;k++){7 9=$(1z[k]);8(9)1n.2D(9)}}}}5 $J(1n,W 25)};25.30=6(h){5 6(){7 E=B;7 2q=[];7 1n=U;$15(4,6(9){7 1A=9[h].2o(9,E);8($f(1A)!=\'T\')1n=K;2q.11(1A)});8(1n)2q=$$(2q);5 2q}};17.J=6(1i){F(7 h Y 1i){2r.L[h]=1i[h];17.L[h]=1i[h];25.L[h]=25.30(h)}};17.J({2C:6(9,3D){1r(3D){N"3E":9.1Q.3H(4,9);1l;N"3B":7 2g=17.L.41.1d(9);8(!2g)9.1Q.2G(4);R 9.1Q.3H(4,2g);1l;N"3G":9.2G(4)}5 4},57:6(9){5 4.2C(9,\'3E\')},52:6(9){5 4.2C(9,\'3B\')},54:6(9){5 4.2C(9,\'3G\')},5Z:6(){$$(B).15(6(9){4.2G(9)},4);5 4},3p:6(){4.1Q.6Q(4);5 4},6R:6(3F){5 $(4.6K(3F!==K))},3C:6(9){4.1Q.6J(9,4);5 $(9)},6o:6(1H){8(I.2b){1r(4.2Q()){N\'O\':4.6q.45=1H;5 4;N\'3b\':4.2Z(\'1H\',1H);5 4}}4.2G(M.6D(1H));5 4},3i:6(V){5 4.V.Q(\'(?:^|\\\\s)\'+V+\'(?:\\\\s|$)\')},48:6(V){8(!4.3i(V))4.V=(4.V+\' \'+V).38();5 4},49:6(V){4.V=4.V.24(W 4a(\'(^|\\\\s)\'+V+\'(?:\\\\s|$)\'),\'$1\').38();5 4},6C:6(V){5 4.3i(V)?4.49(V):4.48(V)},31:6(h,G){1r(h){N\'1f\':5 4.3X(2f(G));N\'6B\':h=(I.2b)?\'6A\':\'6z\'}4.O[h.3w()]=(G.11)?\'1g(\'+G.23(\',\')+\')\':G;5 4},3v:6(1j){1r($f(1j)){N\'1I\':F(7 h Y 1j)4.31(h,1j[h]);1l;N\'2s\':4.O.45=1j}5 4},3X:6(1f){8(1f==0){8(4.O.2z!="3a")4.O.2z="3a"}R{8(4.O.2z!="3W")4.O.2z="3W"}8(!4.2R||!4.2R.6E)4.O.6H=1;8(I.2b)4.O.3L="6G(1f="+1f*6F+")";4.O.1f=4.1f=1f;5 4},2T:6(h){h=h.3w();7 O=4.O[h];8(!$2u(O)){8(h==\'1f\')5 $2u(4.1f)?4.1f:1;8([\'6y\',\'6x\'].Q(h)){7 1q=[];[\'1G\',\'4T\',\'4U\',\'1M\'].15(6(1b){1q.11(4.2T(h+\'-\'+1b)||\'0\')},4);7 1J=1q.1J(6(3S){5 3S==1q[0]});5(1J)?1q[0]:1q}8(M.3R)O=M.3R.6p(4,1e).6s(h.3T());R 8(4.2R)O=4.2R[h]}8(O==\'6t\'&&[\'3z\',\'3u\'].Q(h))5 4[\'6w\'+h.3V()]+\'4f\';5(O&&h.Q(/4k/i)&&O.Q(/1g/))?O.2X():O},6v:6(){7 1q={};$15(B,6(3l){1q[3l]=4.2T(3l)},4);5 1q},14:6(f,n){4.r=4.r||{};4.r[f]=4.r[f]||{\'1m\':[],\'1P\':[]};8(!4.r[f].1m.Q(n)){4.r[f].1m.11(n);8(4.3P){4.3P((f==\'3N\'&&I.3n)?\'46\':f,n,K)}R{n=n.u(4);4.6u(\'3q\'+f,n);4.r[f].1P.11(n)}}5 4},3K:6(1j){F(7 f Y 1j)4.14(f,1j[f]);5 4},1V:6(f,n){8(4.r&&4.r[f]){7 1U=4.r[f].1m.3r(n);8(1U==-1)5 4;7 47=4.r[f].1m.3y(1U,1)[0];8(4.3M){4.3M((f==\'3N\'&&I.3n)?\'46\':f,47,K)}R{4.6I(\'3q\'+f,4.r[f].1P.3y(1U,1)[0])}}5 4},21:6(f){8(4.r){8(f){8(4.r[f]){4.r[f].1m.15(6(n){4.1V(f,n)},4);4.r[f]=1e}}R{F(7 3J Y 4.r)4.21(3J);4.r=1e}}5 4},1S:6(f,E){8(4.r&&4.r[f]){4.r[f].1m.15(6(n){n.u(4,E)()},4)}},28:6(44,13){7 9=(13)?4[13]:4;4b 9=9[44+\'6L\'];2K($f(9)==\'3Z\');5 $(9)},6V:6(){5 4.28(\'1x\')},41:6(){5 4.28(\'2g\')},6W:6(){5 4.28(\'2g\',\'6X\')},6Z:6(){5 4.28(\'1x\',\'6Y\')},6U:6(){5 $(4.1Q)},6S:6(){5 $$(4.3A)},2Z:6(h,G){1r(h){N\'4L\':4.V=G;1l;N\'O\':4.3v(G);1l;N\'2k\':8(I.3o){7 9=W 17(\'<\'+4.2Q()+\' 2k="\'+G+\'" />\');[\'G\',\'4y\',\'V\',\'O\'].15(6(36){9[36]=4[36]});8(4.1Q)4.3C(9);5 9}3s:4.6M(h,G)}5 4},4I:6(1j){F(7 h Y 1j)4.2Z(h,1j[h]);5 4},6T:6(){4.6N=$A(B).23(\'\');5 4},6O:6(h){5(h==\'4L\')?4.V:4.6P(h)},2Q:6(){5 4.4H.2A()},6r:6(x,y){4.3g=x;4.3j=y},27:6(){1r(4.2Q()){N\'2a\':7 1P=[];$15(4.m,6(2j){8(2j.5E)1P.11((2j.G!==1e)?2j.G:2j.1H)});5(4.6m)?1P:1P[0];N\'5U\':8(!(4.5T&&[\'5S\',\'5R\'].Q(4.f))&&![\'3a\',\'1H\',\'5V\'].Q(4.f))1l;N\'5W\':5 4.G}5 K},6n:6(){5{\'5Y\':{\'x\':4.3g,\'y\':4.3j},\'5X\':{\'x\':4.4P,\'y\':4.4O},\'5Q\':{\'x\':4.5P,\'y\':4.5I}}},2M:6(26){26=26||[];7 9=4,1M=0,1G=0;4b{1M+=9.5H||0;1G+=9.5G||0;9=9.5F}2K(9);26.15(6(T){1M-=T.3g||0;1G-=T.3j||0});5{\'x\':1M,\'y\':1G}},5J:6(){5 4.2M().y},5K:6(){5 4.2M().x},5O:6(26){7 37=4.2M(26);7 H={\'3u\':4.4P,\'3z\':4.4O,\'1M\':37.x,\'1G\':37.y};H.4T=H.1M+H.3u;H.4U=H.1G+H.3z;5 H}});I.14=M.14=17.L.14;I.1V=M.1V=17.L.1V;I.21=M.21=17.L.21;7 1y={1n:[],2m:6(9){8(!9.3x)1y.1n.11(9);9.3x=U;5 9},4B:6(){1y.2m(I);1y.2m(M);1y.1n.15(6(9){9.21();F(7 p Y 17.L)9[p]=1e;9.2h=1e;9.3x=1e})}};I.14(\'5N\',1y.4B);7 4E=W 12({5M:6(n){4.1K=4.1K||[];4.1K.11(n);5 4},4l:6(){8(4.1K&&4.1K.C)4.1K.5L().1u(10,4)},60:6(){4.1K=[]}});7 4h=W 12({14:6(f,n){8(n!=12.1T){4.r=4.r||{};4.r[f]=4.r[f]||[];4.r[f].2D(n)}5 4},1S:6(f,E,1u){8(4.r&&4.r[f]){4.r[f].15(6(n){n.1C({\'u\':4,\'1u\':1u,\'B\':E})()},4)}5 4},1V:6(f,n){8(4.r&&4.r[f])4.r[f].3p(n);5 4}});7 4x=W 12({4d:6(){7 E=(B.C==1)?[4.m,B[0]]:B;4.m=$1Y.2o(4,E);8(4.14){F(7 2p Y 4.m){8(($f(4.m[2p])==\'6\')&&2p.Q(/^3q[A-Z]/))4.14(2p,4.m[2p])}}5 4}});7 61=W 12({1k:6(){4.2c=$A(B);4.r={};4.1W={}},14:6(f,n){4.1W[f]=4.1W[f]||{};4.r[f]=4.r[f]||[];8(4.r[f].Q(n))5 K;R 4.r[f].11(n);4.2c.15(6(2e,i){2e.14(f,4.4e.u(4,[f,2e,i]))},4);5 4},4e:6(f,2e,i){4.1W[f][i]=U;7 1J=4.2c.1J(6(1B,j){5 4.1W[f][j]||K},4);8(!1J)5;4.2c.15(6(1B,j){4.1W[f][j]=K},4);4.r[f].15(6(1a){1a.1d(4,4.2c,2e)},4)}});I.J({14:6(f,n){8(f==\'2w\'){8(4.2U)n();R 8(!4.r||!4.r.2w){7 2x=6(){8(4.2U)5;4.2U=U;8(4.19)4.19=$3t(4.19);17.L.1S.1d(4,\'2w\');4.r.2w=1e}.u(4);8(M.2P&&4.2S){4.19=6(){8([\'2U\',\'4p\'].Q(M.2P))2x()}.1O(50)}R 8(M.2P&&4.2b){M.6g("<3b 4y=4q 6f 6e=6d:6h(0)><\\/3b>");$(\'4q\').6i=6(){8(4.2P==\'4p\')2x()}}R{4.14("6l",2x);M.14("6k",2x)}}}17.L.14.1d(4,f,n);5 4},6j:6(4t){5 4.14(\'2w\',4t)}});7 P={};P.4o={6c:6(t,b,c,d){5 c*t/d+b},4n:6(t,b,c,d){5-c/2*(1F.6b(1F.65*t/d)-1)+b}};P.1Z=W 12({m:{4F:12.1T,4m:12.1T,4D:12.1T,4j:P.4o.4n,3m:64,1E:\'4f\',2H:U,4M:50},1k:6(m){4.T=4.T||1e;4.4d(m);8(4.m.1k)4.m.1k.1d(4)},4R:6(){7 1v=$1v();8(1v<4.1v+4.m.3m){4.4A=1v-4.1v;4.2L();4.2d()}R{4.2F(U);4.18=4.q;4.2d();4.1S(\'4m\',4.T,10);4.4l()}},2Y:6(q){4.18=q;4.2d();5 4},2L:6(){4.18=4.2l(4.o,4.q)},2l:6(o,q){5 4.m.4j(4.4A,o,(q-o),4.m.3m)},13:6(o,q){8(!4.m.2H)4.2F();R 8(4.19)5 4;4.o=o;4.q=q;4.1v=$1v();4.19=4.4R.1O(1F.4i(63/4.m.4M),4);4.1S(\'4F\',4.T);5 4},2F:6(2J){8(!4.19)5 4;4.19=$3t(4.19);8(!2J)4.1S(\'4D\',4.T);5 4},62:6(o,q){5 4.13(o,q)},66:6(2J){5 4.2F(2J)}});P.1Z.2E(W 4E);P.1Z.2E(W 4h);P.1Z.2E(W 4x);P.1D={2a:6(h,q){8(h.Q(/4k/i))5 4.4g;8(q.Q&&q.Q(\' \'))5 4.30;5 4.4s},1p:6(9,h,1X){8(!1X.11)1X=[1X];7 o=1X[0],q=1X[1];8(!q&&q!=0){q=o;o=9.2T(h)}7 X=4.2a(h,q);5{o:X.1p(o),q:X.1p(q),X:X}}};P.1D.4s={1p:6(G){5 2f(G)},29:6(o,q,20){5 20.2l(o,q)},27:6(G,1E){5 G+1E}};P.1D.30={1p:6(G){5 G.11?G:G.67(\' \').4w(6(v){5 2f(v)})},29:6(o,q,20){7 18=[];F(7 i=0;i<o.C;i++)18[i]=20.2l(o[i],q[i]);5 18},27:6(G,1E){5 G.23(1E+\' \')+1E}};P.1D.4g={1p:6(G){5 G.11?G:G.32(U)},29:6(o,q,20){7 18=[];F(7 i=0;i<o.C;i++)18[i]=1F.4i(20.2l(o[i],q[i]));5 18},27:6(G){5\'1g(\'+G.23(\',\')+\')\'}};P.4G=P.1Z.J({1k:6(9,h,m){4.T=$(9);4.h=h;4.1w(m)},6a:6(){5 4.2Y(0)},2L:6(){4.18=4.X.29(4.o,4.q,4)},2Y:6(q){4.X=P.1D.2a(4.h,q);5 4.1w(4.X.1p(q))},13:6(o,q){8(4.19&&4.m.2H)5 4;7 1h=P.1D.1p(4.T,4.h,[o,q]);4.X=1h.X;5 4.1w(1h.o,1h.q)},2d:6(){4.T.31(4.h,4.X.27(4.18,4.m.1E))}});17.J({69:6(h,m){5 W P.4G(4,h,m)}});P.3Y=P.1Z.J({1k:6(9,m){4.T=$(9);4.1w(m)},2L:6(){F(7 p Y 4.o)4.18[p]=4.X[p].29(4.o[p],4.q[p],4)},2Y:6(q){7 1h={};4.X={};F(7 p Y q){4.X[p]=P.1D.2a(p,q[p]);1h[p]=4.X[p].1p(q[p])}5 4.1w(1h)},13:6(H){8(4.19&&4.m.2H)5 4;4.18={};4.X={};7 o={},q={};F(7 p Y H){7 1h=P.1D.1p(4.T,p,H[p]);o[p]=1h.o;q[p]=1h.q;4.X[p]=1h.X}5 4.1w(o,q)},2d:6(){F(7 p Y 4.18)4.T.31(p,4.X[p].27(4.18[p],4.m.1E))}});17.J({68:6(m){5 W P.3Y(4,m)}});',62,434,'||||this|return|function|var|if|el||||||type||property|||||options|fn|from||to|events|||bind|||||||arguments|length||args|for|value|obj|window|extend|false|prototype|document|case|style|Fx|test|else||element|true|className|new|css|in|||push|Class|start|addEvent|each||Element|now|timer|event|prop|array|call|null|opacity|rgb|parsed|properties|source|initialize|break|keys|elements|props|parse|result|switch|item|match|delay|time|parent|previous|Garbage|selector|returns|current|create|CSS|unit|Math|top|text|object|every|chains|Array|left|hex|periodical|values|parentNode|results|fireEvent|empty|pos|removeEvent|checker|fromTo|merge|Base|fx|removeEvents|newArray|join|replace|Elements|overflown|getValue|walk|getNow|select|ie|instances|increase|instance|parseFloat|next|htmlElement|len|opt|name|compute|collect|iterable|apply|option|items|HTMLElement|string|mix|chk|native|domready|domReady|klass|visibility|toLowerCase|bit|inject|include|implement|stop|appendChild|wait|regex|end|while|setNow|getPosition|proto|min|readyState|getTag|currentStyle|khtml|getStyle|loaded|mp|ms|rgbToHex|set|setProperty|Multi|setStyle|hexToRgb|attempt|ap|ptype|attribute|position|clean|max|hidden|script|typeof|charAt|merged|forEach|scrollLeft|parseInt|hasClass|scrollTop|ctype|argument|duration|gecko|ie6|remove|on|indexOf|default|clear|width|setStyles|camelCase|collected|splice|height|childNodes|after|replaceWith|where|before|contents|inside|insertBefore|Function|evType|addEvents|filter|removeEventListener|mousewheel|getElementsBySelector|addEventListener|pp|defaultView|val|hyphenate|createElement|capitalize|visible|setOpacity|Styles|whitespace|catch|getNext|try|err|direction|cssText|DOMMouseScroll|key|addClass|removeClass|RegExp|do|undefined|setOptions|check|px|Color|Events|round|transition|color|callChain|onComplete|sineInOut|Transitions|complete|ie_ready|random|Single|init|picked|toFloat|map|Options|id|Object|cTime|trash|mergeClass|onCancel|Chain|onStart|Style|tagName|setProperties|toInt|Number|class|fps|trim|offsetHeight|offsetWidth|copy|step|String|right|bottom|toUpperCase|params|getElementsByTagName|Date|floor||pick|injectAfter|callee|injectInside|Native|Window|injectBefore|all|nodeValue|associate|some|pass|execCommand|BackgroundImageCache|setInterval|setTimeout|transparent|toString|slice|concat|nodeType|nodeName|DOMElement|iframe|ActiveXObject|XMLHttpRequest|getElementById|clearInterval|embed|clearTimeout|attributes|styles|textnode|getBoxObjectFor|bindAsEventListener|taintEnabled|ie7|navigator|getTime|selected|offsetParent|offsetTop|offsetLeft|scrollHeight|getTop|getLeft|shift|chain|unload|getCoordinates|scrollWidth|scrollSize|radio|checkbox|checked|input|password|textarea|size|scroll|adopt|clearChain|Group|custom|1000|500|PI|clearTimer|split|effects|effect|hide|cos|linear|javascript|src|defer|write|void|onreadystatechange|onDomReady|DOMContentLoaded|load|multiple|getSize|appendText|getComputedStyle|styleSheet|scrollTo|getPropertyValue|auto|attachEvent|getStyles|offset|padding|margin|cssFloat|styleFloat|float|toggleClass|createTextNode|hasLayout|100|alpha|zoom|detachEvent|replaceChild|cloneNode|Sibling|setAttribute|innerHTML|getProperty|getAttribute|removeChild|clone|getChildren|setHTML|getParent|getPrevious|getFirst|firstChild|lastChild|getLast'.split('|'),0,{}))

var Gallery = new Class({
	
	currentImage : 0,
	paddingBottom : 32,

	initialize: function(e_id, data){
		this.element = e_id;
		this.data = data;
		this.image = $('gallery_img');
		this.caption = $('caption');
		this.container = $('gallery');
		this.link = $('gallery_link');
		var nextEffect = this.nextEffect.bind(this);
		this.imageFade = this.image.effect('opacity', {duration: 400, onComplete: nextEffect});
		
	},
	
	swapImg: function(n) {
		
		this.prevImage = this.currentImage;
		this.currentImage = n;
		this.step = 1;
		this.caption.innerHTML = '';
		this.image.setOpacity(0);
		this.image.src = '';
		this.preload = new Image();
		this.preload.onload = this.nextEffect.bind(this);
		this.preload.src = this.data[n][0];

		},
	nextEffect: function(n){
		switch(this.step++) {
			case 1: 
				var nextEffect = this.nextEffect.bind(this);
				var oldHeight = this.data[this.prevImage][1]+this.paddingBottom;
				var newHeight = this.data[this.currentImage][1]+this.paddingBottom;
				//$('status').innerHTML = 'gammel høyde: ' + oldHeight + ' ny høyde: ' + newHeight;
				this.container.effect('height',  {duration: 750, onComplete: nextEffect}).start(oldHeight, newHeight);
				break;
			case 2: 
				this.image.src = this.data[this.currentImage][0];
				if ($('container_border_l') == '100%') {
					$('container_border_l').style.height = '101%';
					$('container_border_r').style.height = '101%';				
				}
				else {
					$('container_border_l').style.height = '100%';
					$('container_border_r').style.height = '100%';				
				}
				this.imageFade.start(0, 1);
				break;
			case 3: 
				this.caption.innerHTML = this.data[this.currentImage][3];
				this.link.href = this.data[this.currentImage][4];
				break;				
		}
	}
});

var gallery = null;
window.addEvent('load', function() { $('container_border_r').style.height = '101%'; $('container_border_l').style.height = '101%'; });


