//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 ci={cj:\'1.11\'};k $77(N){m(N!=9N)};k $F(N){B(!$77(N))m O;B(N.5i)m\'G\';o F=7c N;B(F==\'2I\'&&N.ch){22(N.84){Y 1:m\'G\';Y 3:m(/\\S/).2v(N.ax)?\'cg\':\'cd\'}}B(F==\'2I\'||F==\'k\'){22(N.9C){Y 2t:m\'1z\';Y 7y:m\'5C\';Y 18:m\'4R\'}B(7c N.V==\'4M\'){B(N.3r)m\'ce\';B(N.8t)m\'1b\'}}m F};k $2a(){o 54={};M(o i=0;i<1b.V;i++){M(o K 1a 1b[i]){o ap=1b[i][K];o 6d=54[K];B(6d&&$F(ap)==\'2I\'&&$F(6d)==\'2I\')54[K]=$2a(6d,ap);14 54[K]=ap}}m 54};o $R=k(){o 1p=1b;B(!1p[1])1p=[c,1p[0]];M(o K 1a 1p[1])1p[0][K]=1p[1][K];m 1p[0]};o $5e=k(){M(o i=0,l=1b.V;i<l;i++){1b[i].R=k(1U){M(o 1V 1a 1U){B(!c.1L[1V])c.1L[1V]=1U[1V];B(!c[1V])c[1V]=$5e.6x(1V)}}}};$5e.6x=k(1V){m k(W){m c.1L[1V].4j(W,2t.1L.bh.1X(1b,1))}};$5e(7Z,2t,6i,aN);k $2A(N){m!!(N||N===0)};k $4T(N,aY){m $77(N)?N:aY};k $8c(3s,1D){m 1c.9q(1c.8c()*(1D-3s+1)+3s)};k $3A(){m L 96().9w()};k $55(1H){cf(1H);ck(1H);m 1n};o 3M=k(N){N=N||{};N.R=$R;m N};o cl=L 3M(U);o cr=L 3M(Q);Q.6e=Q.33(\'6e\')[0];U.4a=!!(Q.5r);B(U.9o)U.2P=U[U.6C?\'cs\':\'ag\']=1e;14 B(Q.aC&&!Q.cq&&!cp.cm)U.4x=U[U.4a?\'cn\':\'5x\']=1e;14 B(Q.co!=1n)U.8r=1e;U.cc=U.4x;8X.R=$R;B(7c 5B==\'9N\'){o 5B=k(){};B(U.4x)Q.aJ("cb");5B.1L=(U.4x)?U["[[bZ.1L]]"]:{}}5B.1L.5i=k(){};B(U.ag)5j{Q.c0("c1",O,1e)}5c(e){};o 18=k(1J){o 5Z=k(){m(1b[0]!==1n&&c.1i&&$F(c.1i)==\'k\')?c.1i.4j(c,1b):c};$R(5Z,c);5Z.1L=1J;5Z.9C=18;m 5Z};18.1l=k(){};18.1L={R:k(1J){o 7m=L c(1n);M(o K 1a 1J){o 9m=7m[K];7m[K]=18.9l(9m,1J[K])}m L 18(7m)},3i:k(){M(o i=0,l=1b.V;i<l;i++)$R(c.1L,1b[i])}};18.9l=k(2l,2i){B(2l&&2l!=2i){o F=$F(2i);B(F!=$F(2l))m 2i;22(F){Y\'k\':o 8i=k(){c.1r=1b.8t.1r;m 2i.4j(c,1b)};8i.1r=2l;m 8i;Y\'2I\':m $2a(2l,2i)}}m 2i};o 7u=L 18({bY:k(fn){c.4v=c.4v||[];c.4v.1k(fn);m c},7z:k(){B(c.4v&&c.4v.V)c.4v.aK().2g(10,c)},bX:k(){c.4v=[]}});o 2p=L 18({1B:k(F,fn){B(fn!=18.1l){c.$19=c.$19||{};c.$19[F]=c.$19[F]||[];c.$19[F].5S(fn)}m c},1h:k(F,1p,2g){B(c.$19&&c.$19[F]){c.$19[F].1q(k(fn){fn.3a({\'W\':c,\'2g\':2g,\'1b\':1p})()},c)}m c},4C:k(F,fn){B(c.$19&&c.$19[F])c.$19[F].2K(fn);m c}});o 43=L 18({2Y:k(){c.C=$2a.4j(1n,[c.C].R(1b));B(c.1B){M(o 3z 1a c.C){B($F(c.C[3z]==\'k\')&&(/^67[A-Z]/).2v(3z))c.1B(3z,c.C[3z])}}m c}});2t.R({7b:k(fn,W){M(o i=0,j=c.V;i<j;i++)fn.1X(W,c[i],i,c)},36:k(fn,W){o 4Y=[];M(o i=0,j=c.V;i<j;i++){B(fn.1X(W,c[i],i,c))4Y.1k(c[i])}m 4Y},2D:k(fn,W){o 4Y=[];M(o i=0,j=c.V;i<j;i++)4Y[i]=fn.1X(W,c[i],i,c);m 4Y},4F:k(fn,W){M(o i=0,j=c.V;i<j;i++){B(!fn.1X(W,c[i],i,c))m O}m 1e},bU:k(fn,W){M(o i=0,j=c.V;i<j;i++){B(fn.1X(W,c[i],i,c))m 1e}m O},3k:k(3r,15){o 3S=c.V;M(o i=(15<0)?1c.1D(0,3S+15):15||0;i<3S;i++){B(c[i]===3r)m i}m-1},8e:k(1g,V){1g=1g||0;B(1g<0)1g=c.V+1g;V=V||(c.V-1g);o 8g=[];M(o i=0;i<V;i++)8g[i]=c[1g++];m 8g},2K:k(3r){o i=0;o 3S=c.V;6Z(i<3S){B(c[i]===3r){c.74(i,1);3S--}14{i++}}m c},1j:k(3r,15){m c.3k(3r,15)!=-1},bV:k(1O){o N={},V=1c.3s(c.V,1O.V);M(o i=0;i<V;i++)N[1O[i]]=c[i];m N},R:k(1z){M(o i=0,j=1z.V;i<j;i++)c.1k(1z[i]);m c},2a:k(1z){M(o i=0,l=1z.V;i<l;i++)c.5S(1z[i]);m c},5S:k(3r){B(!c.1j(3r))c.1k(3r);m c},bW:k(){m c[$8c(0,c.V-1)]||1n},80:k(){m c[c.V-1]||1n}});2t.1L.1q=2t.1L.7b;2t.1q=2t.7b;k $A(1z){m 2t.8e(1z)};k $1q(41,fn,W){B(41&&7c 41.V==\'4M\'&&$F(41)!=\'2I\'){2t.7b(41,fn,W)}14{M(o 1w 1a 41)fn.1X(W||41,41[1w],1w)}};2t.1L.2v=2t.1L.1j;6i.R({2v:k(79,2U){m(($F(79)==\'2z\')?L 7y(79,2U):79).2v(c)},3d:k(){m 5O(c,10)},aH:k(){m 66(c)},8a:k(){m c.3g(/-\\D/g,k(31){m 31.8d(1).7A()})},aL:k(){m c.3g(/\\w[A-Z]/g,k(31){m(31.8d(0)+\'-\'+31.8d(1).5L())})},8R:k(){m c.3g(/\\b[a-z]/g,k(31){m 31.7A()})},5T:k(){m c.3g(/^\\s+|\\s+$/g,\'\')},7r:k(){m c.3g(/\\s{2,}/g,\' \').5T()},5E:k(1z){o 1s=c.31(/\\d{1,3}/g);m(1s)?1s.5E(1z):O},5G:k(1z){o 3C=c.31(/^#?(\\w{1,2})(\\w{1,2})(\\w{1,2})$/);m(3C)?3C.bh(1).5G(1z):O},1j:k(2z,s){m(s)?(s+c+s).3k(s+2z+s)>-1:c.3k(2z)>-1},b5:k(){m c.3g(/([.*+?^${}()|[\\]\\/\\\\])/g,\'\\\\$1\')}});2t.R({5E:k(1z){B(c.V<3)m O;B(c.V==4&&c[3]==0&&!1z)m\'c2\';o 3C=[];M(o i=0;i<3;i++){o 5d=(c[i]-0).4l(16);3C.1k((5d.V==1)?\'0\'+5d:5d)}m 1z?3C:\'#\'+3C.2c(\'\')},5G:k(1z){B(c.V!=3)m O;o 1s=[];M(o i=0;i<3;i++){1s.1k(5O((c[i].V==1)?c[i]+c[i]:c[i],16))}m 1z?1s:\'1s(\'+1s.2c(\',\')+\')\'}});7Z.R({3a:k(C){o fn=c;C=$2a({\'W\':fn,\'I\':O,\'1b\':1n,\'2g\':O,\'4f\':O,\'6f\':O},C);B($2A(C.1b)&&$F(C.1b)!=\'1z\')C.1b=[C.1b];m k(I){o 1p;B(C.I){I=I||U.I;1p=[(C.I===1e)?I:L C.I(I)];B(C.1b)1p.R(C.1b)}14 1p=C.1b||1b;o 3N=k(){m fn.4j($4T(C.W,fn),1p)};B(C.2g)m 9M(3N,C.2g);B(C.4f)m c3(3N,C.4f);B(C.6f)5j{m 3N()}5c(c9){m O};m 3N()}},bT:k(1p,W){m c.3a({\'1b\':1p,\'W\':W})},6f:k(1p,W){m c.3a({\'1b\':1p,\'W\':W,\'6f\':1e})()},W:k(W,1p){m c.3a({\'W\':W,\'1b\':1p})},c8:k(W,1p){m c.3a({\'W\':W,\'I\':1e,\'1b\':1p})},2g:k(2g,W,1p){m c.3a({\'2g\':2g,\'W\':W,\'1b\':1p})()},4f:k(aV,W,1p){m c.3a({\'4f\':aV,\'W\':W,\'1b\':1p})()}});aN.R({3d:k(){m 5O(c)},aH:k(){m 66(c)},1F:k(3s,1D){m 1c.3s(1D,1c.1D(3s,c))},2q:k(5Y){5Y=1c.3w(10,5Y||0);m 1c.2q(c*5Y)/5Y},c7:k(fn){M(o i=0;i<c;i++)fn(i)}});o P=L 18({1i:k(el,1U){B($F(el)==\'2z\'){B(U.2P&&1U&&(1U.1w||1U.F)){o 1w=(1U.1w)?\' 1w="\'+1U.1w+\'"\':\'\';o F=(1U.F)?\' F="\'+1U.F+\'"\':\'\';57 1U.1w;57 1U.F;el=\'<\'+el+1w+F+\'>\'}el=Q.aJ(el)}el=$(el);m(!1U||!el)?el:el.2j(1U)}});o 26=L 18({1i:k(T){m(T)?$R(T,c):c}});26.R=k(1U){M(o 1V 1a 1U){c.1L[1V]=1U[1V];c[1V]=$5e.6x(1V)}};k $(el){B(!el)m 1n;B(el.5i)m 2F.52(el);B([U,Q].1j(el))m el;o F=$F(el);B(F==\'2z\'){el=Q.6W(el);F=(el)?\'G\':O}B(F!=\'G\')m 1n;B(el.5i)m 2F.52(el);B([\'2I\',\'c4\'].1j(el.6S.5L()))m el;$R(el,P.1L);el.5i=k(){};m 2F.52(el)};Q.6Y=Q.33;k $$(){o T=[];M(o i=0,j=1b.V;i<j;i++){o 1S=1b[i];22($F(1S)){Y\'G\':T.1k(1S);Y\'c5\':1C;Y O:1C;Y\'2z\':1S=Q.6Y(1S,1e);62:T.R(1S)}}m $$.5M(T)};$$.5M=k(1z){o T=[];M(o i=0,l=1z.V;i<l;i++){B(1z[i].$6r)6l;o G=$(1z[i]);B(G&&!G.$6r){G.$6r=1e;T.1k(G)}}M(o n=0,d=T.V;n<d;n++)T[n].$6r=1n;m L 26(T)};26.73=k(K){m k(){o 1p=1b;o 1x=[];o T=1e;M(o i=0,j=c.V,3N;i<j;i++){3N=c[i][K].4j(c[i],1p);B($F(3N)!=\'G\')T=O;1x.1k(3N)};m(T)?$$.5M(1x):1x}};P.R=k(1J){M(o K 1a 1J){5B.1L[K]=1J[K];P.1L[K]=1J[K];P[K]=$5e.6x(K);o aB=(2t.1L[K])?K+\'26\':K;26.1L[aB]=26.73(K)}};P.R({2j:k(1U){M(o 1V 1a 1U){o 4m=1U[1V];22(1V){Y\'8J\':c.4A(4m);1C;Y\'19\':B(c.6j)c.6j(4m);1C;Y\'1J\':c.6o(4m);1C;62:c.7l(1V,4m)}}m c},28:k(el,ay){el=$(el);22(ay){Y\'9k\':el.3n.91(c,el);1C;Y\'94\':o 3x=el.8I();B(!3x)el.3n.86(c);14 el.3n.91(c,3x);1C;Y\'1o\':o 8Z=el.88;B(8Z){el.91(c,8Z);1C}62:el.86(c)}m c},7Y:k(el){m c.28(el,\'9k\')},6v:k(el){m c.28(el,\'94\')},c6:k(el){m c.28(el,\'3P\')},ct:k(el){m c.28(el,\'1o\')},b2:k(){o T=[];$1q(1b,k(4t){T=T.7P(4t)});$$(T).28(c);m c},2K:k(){m c.3n.bl(c)},9G:k(9V){o el=$(c.cu(9V!==O));B(!el.$19)m el;el.$19={};M(o F 1a c.$19)el.$19[F]={\'1O\':$A(c.$19[F].1O),\'1I\':$A(c.$19[F].1I)};m el.78()},cT:k(el){el=$(el);c.3n.cU(el,c);m el},bn:k(1K){c.86(Q.cS(1K));m c},7s:k(1A){m c.1A.1j(1A,\' \')},9z:k(1A){B(!c.7s(1A))c.1A=(c.1A+\' \'+1A).7r();m c},9E:k(1A){c.1A=c.1A.3g(L 7y(\'(^|\\\\s)\'+1A+\'(?:\\\\s|$)\'),\'$1\').7r();m c},cR:k(1A){m c.7s(1A)?c.9E(1A):c.9z(1A)},1P:k(K,J){22(K){Y\'21\':m c.bk(66(J));Y\'cO\':K=(U.2P)?\'cP\':\'cQ\'}K=K.8a();22($F(J)){Y\'4M\':B(![\'cV\',\'ak\'].1j(K))J+=\'4W\';1C;Y\'1z\':J=\'1s(\'+J.2c(\',\')+\')\'}c.1N[K]=J;m c},4A:k(1Z){22($F(1Z)){Y\'2I\':P.72(c,\'1P\',1Z);1C;Y\'2z\':c.1N.87=1Z}m c},bk:k(21){B(21==0){B(c.1N.4z!="4O")c.1N.4z="4O"}14{B(c.1N.4z!="8G")c.1N.4z="8G"}B(!c.6p||!c.6p.cW)c.1N.ak=1;B(U.2P)c.1N.36=(21==1)?\'\':"7d(21="+21*35+")";c.1N.21=c.$1W.21=21;m c},2h:k(K){K=K.8a();o 1M=c.1N[K];B(!$2A(1M)){B(K==\'21\')m c.$1W.21;1M=[];M(o 1N 1a P.4c){B(K==1N){P.4c[1N].1q(k(s){o 1N=c.2h(s);1M.1k(5O(1N)?1N:\'bo\')},c);B(K==\'2R\'){o 4F=1M.4F(k(5d){m(5d==1M[0])});m(4F)?1M[0]:O}m 1M.2c(\' \')}}B(K.1j(\'2R\')){B(P.4c.2R.1j(K)){m[\'bf\',\'7T\',\'2Q\'].2D(k(p){m c.2h(K+p)},c).2c(\' \')}14 B(P.97.1j(K)){m[\'bi\',\'bs\',\'az\',\'a6\'].2D(k(p){m c.2h(\'2R\'+p+K.3g(\'2R\',\'\'))},c).2c(\' \')}}B(Q.aF)1M=Q.aF.d2(c,1n).d3(K.aL());14 B(c.6p)1M=c.6p[K]}B(U.2P)1M=P.b6(K,1M,c);B(1M&&K.2v(/2E/i)&&1M.1j(\'1s\')){m 1M.68(\'1s\').74(1,4).2D(k(2E){m 2E.5E()}).2c(\' \')}m 1M},bg:k(){m P.7H(c,\'2h\',1b)},61:k(6u,1g){6u+=\'d1\';o el=(1g)?c[1g]:c[6u];6Z(el&&$F(el)!=\'G\')el=el[6u];m $(el)},9W:k(){m c.61(\'2l\')},8I:k(){m c.61(\'3x\')},d0:k(){m c.61(\'3x\',\'88\')},80:k(){m c.61(\'2l\',\'cX\')},cY:k(){m $(c.3n)},8H:k(){m $$(c.aC)},8o:k(el){m!!$A(c.33(\'*\')).1j(el)},5R:k(K){o 25=P.6A[K];B(25)m c[25];o 7V=P.a3[K]||0;B(!U.2P||7V)m c.cZ(K,7V);o 81=c.cN[K];m(81)?81.ax:1n},cM:k(K){o 25=P.6A[K];B(25)c[25]=\'\';14 c.a7(K);m c},cA:k(){m P.7H(c,\'5R\',1b)},7l:k(K,J){o 25=P.6A[K];B(25)c[25]=J;14 c.cB(K,J);m c},6o:k(1Z){m P.72(c,\'7l\',1Z)},5s:k(){c.b3=$A(1b).2c(\'\');m c},cC:k(1K){o 3q=c.4D();B([\'1N\',\'2s\'].1j(3q)){B(U.2P){B(3q==\'1N\')c.b4.87=1K;14 B(3q==\'2s\')c.7l(\'1K\',1K);m c}14{c.bl(c.88);m c.bn(1K)}}c[$77(c.83)?\'83\':\'b1\']=1K;m c},cz:k(){o 3q=c.4D();B([\'1N\',\'2s\'].1j(3q)){B(U.2P){B(3q==\'1N\')m c.b4.87;14 B(3q==\'2s\')m c.5R(\'1K\')}14{m c.b3}}m($4T(c.83,c.b1))},4D:k(){m c.6S.5L()},1l:k(){2F.3V(c.33(\'*\'));m c.5s(\'\')}});P.b6=k(K,1M,G){B($2A(5O(1M)))m 1M;B([\'2N\',\'2y\'].1j(K)){o 1I=(K==\'2y\')?[\'1u\',\'4n\']:[\'1o\',\'3P\'];o 3l=0;1I.1q(k(J){3l+=G.2h(\'2R-\'+J+\'-2y\').3d()+G.2h(\'4w-\'+J).3d()});m G[\'1E\'+K.8R()]-3l+\'4W\'}14 B(K.2v(/2R(.+)bf|34|4w/)){m\'bo\'}m 1M};P.4c={\'2R\':[],\'4w\':[],\'34\':[]};[\'bi\',\'bs\',\'az\',\'a6\'].1q(k(9v){M(o 1N 1a P.4c)P.4c[1N].1k(1N+9v)});P.97=[\'cy\',\'cv\',\'cw\'];P.7H=k(el,23,1O){o 1M={};$1q(1O,k(1t){1M[1t]=el[23](1t)});m 1M};P.72=k(el,23,7G){M(o 1t 1a 7G)el[23](1t,7G[1t]);m el};P.6A=L 3M({\'4R\':\'1A\',\'M\':\'cx\',\'cD\':\'cE\',\'cK\':\'cL\',\'cJ\':\'cI\',\'cF\':\'cG\',\'cH\':\'d4\',\'bI\':\'bN\',\'bB\':\'bJ\',\'J\':\'J\',\'7D\':\'7D\',\'7E\':\'7E\',\'7J\':\'7J\',\'7Q\':\'7Q\'});P.a3={\'4N\':2,\'4s\':2};P.2H={6J:{2C:k(F,fn){B(c.8j)c.8j(F,fn,O);14 c.bD(\'67\'+F,fn);m c},3h:k(F,fn){B(c.a4)c.a4(F,fn,O);14 c.bP(\'67\'+F,fn);m c}}};U.R(P.2H.6J);Q.R(P.2H.6J);P.R(P.2H.6J);o 2F={T:[],52:k(el){B(!el.$1W){2F.T.1k(el);el.$1W={\'21\':1}}m el},3V:k(T){M(o i=0,j=T.V,el;i<j;i++){B(!(el=T[i])||!el.$1W)6l;B(el.$19)el.1h(\'3V\').78();M(o p 1a el.$1W)el.$1W[p]=1n;M(o d 1a P.1L)el[d]=1n;2F.T[2F.T.3k(el)]=1n;el.5i=el.$1W=el=1n}2F.T.2K(1n)},1l:k(){2F.52(U);2F.52(Q);2F.3V(2F.T)}};U.2C(\'9t\',k(){U.2C(\'7v\',2F.1l);B(U.2P)U.2C(\'7v\',bH)});o 2X=L 18({1i:k(I){B(I&&I.$bq)m I;c.$bq=1e;I=I||U.I;c.I=I;c.F=I.F;c.3v=I.3v||I.bF;B(c.3v.84==3)c.3v=c.3v.3n;c.aK=I.bx;c.bG=I.bC;c.bK=I.bz;c.bO=I.by;B([\'8b\',\'5a\'].1j(c.F)){c.bS=(I.9p)?I.9p/bQ:-(I.bE||0)/3}14 B(c.F.1j(\'1t\')){c.6O=I.9K||I.bL;M(o 1w 1a 2X.1O){B(2X.1O[1w]==c.6O){c.1t=1w;1C}}B(c.F==\'9X\'){o 6Q=c.6O-bM;B(6Q>0&&6Q<13)c.1t=\'f\'+6Q}c.1t=c.1t||6i.bA(c.6O).5L()}14 B(c.F.2v(/(6h|3m|bw)/)){c.1Y={\'x\':I.8E||I.9f+Q.2Z.5V,\'y\':I.8w||I.at+Q.2Z.63};c.9B={\'x\':I.8E?I.8E-U.99:I.9f,\'y\':I.8w?I.8w-U.9i:I.at};c.bR=(I.9K==3)||(I.bv==2);22(c.F){Y\'90\':c.2o=I.2o||I.ca;1C;Y\'8Y\':c.2o=I.2o||I.8A}c.aU()}m c},1R:k(){m c.6U().6X()},6U:k(){B(c.I.6U)c.I.6U();14 c.I.db=1e;m c},6X:k(){B(c.I.6X)c.I.6X();14 c.I.eK=O;m c}});2X.6m={2o:k(){B(c.2o&&c.2o.84==3)c.2o=c.2o.3n},aD:k(){5j{2X.6m.2o.1X(c)}5c(e){c.2o=c.3v}}};2X.1L.aU=(U.8r)?2X.6m.aD:2X.6m.2o;2X.1O=L 3M({\'eL\':13,\'6P\':38,\'eJ\':40,\'1u\':37,\'4n\':39,\'eI\':27,\'eF\':32,\'eG\':8,\'eH\':9,\'57\':46});P.2H.2p={1B:k(F,fn){c.$19=c.$19||{};c.$19[F]=c.$19[F]||{\'1O\':[],\'1I\':[]};B(c.$19[F].1O.1j(fn))m c;c.$19[F].1O.1k(fn);o 76=F;o 2w=P.2p[F];B(2w){B(2w.7F)2w.7F.1X(c,fn);B(2w.2D)fn=2w.2D;B(2w.F)76=2w.F}B(!c.8j)fn=fn.3a({\'W\':c,\'I\':1e});c.$19[F].1I.1k(fn);m(P.8V.1j(76))?c.2C(76,fn):c},4C:k(F,fn){B(!c.$19||!c.$19[F])m c;o 1m=c.$19[F].1O.3k(fn);B(1m==-1)m c;o 1t=c.$19[F].1O.74(1m,1)[0];o J=c.$19[F].1I.74(1m,1)[0];o 2w=P.2p[F];B(2w){B(2w.2K)2w.2K.1X(c,fn);B(2w.F)F=2w.F}m(P.8V.1j(F))?c.3h(F,J):c},6j:k(1Z){m P.72(c,\'1B\',1Z)},78:k(F){B(!c.$19)m c;B(!F){M(o 6g 1a c.$19)c.78(6g);c.$19=1n}14 B(c.$19[F]){c.$19[F].1O.1q(k(fn){c.4C(F,fn)},c);c.$19[F]=1n}m c},1h:k(F,1p,2g){B(c.$19&&c.$19[F]){c.$19[F].1O.1q(k(fn){fn.3a({\'W\':c,\'2g\':2g,\'1b\':1p})()},c)}m c},au:k(15,F){B(!15.$19)m c;B(!F){M(o 6g 1a 15.$19)c.au(15,6g)}14 B(15.$19[F]){15.$19[F].1O.1q(k(fn){c.1B(F,fn)},c)}m c}};U.R(P.2H.2p);Q.R(P.2H.2p);P.R(P.2H.2p);P.2p=L 3M({\'8N\':{F:\'90\',2D:k(I){I=L 2X(I);B(I.2o!=c&&!c.8o(I.2o))c.1h(\'8N\',I)}},\'8P\':{F:\'8Y\',2D:k(I){I=L 2X(I);B(I.2o!=c&&!c.8o(I.2o))c.1h(\'8P\',I)}},\'5a\':{F:(U.8r)?\'8b\':\'5a\'}});P.8V=[\'6h\',\'eM\',\'5z\',\'5n\',\'5a\',\'8b\',\'90\',\'8Y\',\'2M\',\'9X\',\'eN\',\'eS\',\'4e\',\'7v\',\'9t\',\'eT\',\'5o\',\'eR\',\'eQ\',\'3F\',\'eO\',\'eP\',\'48\',\'aE\',\'8s\',\'eE\',\'2G\'];7Z.R({3e:k(W,1p){m c.3a({\'W\':W,\'1b\':1p,\'I\':2X})}});26.R({eV:k(3q){m L 26(c.36(k(el){m(P.4D(el)==3q)}))},a8:k(1A,2J){o T=c.36(k(el){m(el.1A&&el.1A.1j(1A,\' \'))});m(2J)?T:L 26(T)},a2:k(4u,2J){o T=c.36(k(el){m(el.4u==4u)});m(2J)?T:L 26(T)},a9:k(1w,82,J,2J){o T=c.36(k(el){o 2i=P.5R(el,1w);B(!2i)m O;B(!82)m 1e;22(82){Y\'=\':m(2i==J);Y\'*=\':m(2i.1j(J));Y\'^=\':m(2i.6K(0,J.V)==J);Y\'$=\':m(2i.6K(2i.V-J.V)==J);Y\'!=\':m(2i!=J);Y\'~=\':m 2i.1j(J,\' \')}m O});m(2J)?T:L 26(T)}});k $E(1S,36){m($(36)||Q).9P(1S)};k $et(1S,36){m($(36)||Q).6Y(1S)};$$.3B={\'5C\':/^(\\w*|\\*)(?:#([\\w-]+)|\\.([\\w-]+))?(?:\\[(\\w+)(?:([!*^$]?=)["\']?([^"\'\\]]*)["\']?)?])?$/,\'4a\':{7L:k(1x,3b,1d,i){o 2r=[3b.eu?\'7N:\':\'\',1d[1]];B(1d[2])2r.1k(\'[@4u="\',1d[2],\'"]\');B(1d[3])2r.1k(\'[1j(7P(" ", @4R, " "), " \',1d[3],\' ")]\');B(1d[4]){B(1d[5]&&1d[6]){22(1d[5]){Y\'*=\':2r.1k(\'[1j(@\',1d[4],\', "\',1d[6],\'")]\');1C;Y\'^=\':2r.1k(\'[es-er(@\',1d[4],\', "\',1d[6],\'")]\');1C;Y\'$=\':2r.1k(\'[eo(@\',1d[4],\', 2z-V(@\',1d[4],\') - \',1d[6].V,\' + 1) = "\',1d[6],\'"]\');1C;Y\'=\':2r.1k(\'[@\',1d[4],\'="\',1d[6],\'"]\');1C;Y\'!=\':2r.1k(\'[@\',1d[4],\'!="\',1d[6],\'"]\')}}14{2r.1k(\'[@\',1d[4],\']\')}}1x.1k(2r.2c(\'\'));m 1x},7O:k(1x,3b,2J){o T=[];o 4a=Q.5r(\'.//\'+1x.2c(\'//\'),3b,$$.3B.ac,ep.eq,1n);M(o i=0,j=4a.ev;i<j;i++)T.1k(4a.ew(i));m(2J)?T:L 26(T.2D($))}},\'9T\':{7L:k(1x,3b,1d,i){B(i==0){B(1d[2]){o el=3b.6W(1d[2]);B(!el||((1d[1]!=\'*\')&&(P.4D(el)!=1d[1])))m O;1x=[el]}14{1x=$A(3b.33(1d[1]))}}14{1x=$$.3B.33(1x,1d[1]);B(1d[2])1x=26.a2(1x,1d[2],1e)}B(1d[3])1x=26.a8(1x,1d[3],1e);B(1d[4])1x=26.a9(1x,1d[4],1d[5],1d[6],1e);m 1x},7O:k(1x,3b,2J){m(2J)?1x:$$.5M(1x)}},ac:k(9Z){m(9Z==\'7N\')?\'9Y://aS.eB.eC/eA/7N\':O},33:k(3b,6S){o 7M=[];M(o i=0,j=3b.V;i<j;i++)7M.R(3b[i].33(6S));m 7M}};$$.3B.23=(U.4a)?\'4a\':\'9T\';P.2H.7R={6N:k(1S,2J){o 1x=[];1S=1S.5T().68(\' \');M(o i=0,j=1S.V;i<j;i++){o 9U=1S[i];o 1d=9U.31($$.3B.5C);B(!1d)1C;1d[1]=1d[1]||\'*\';o 2r=$$.3B[$$.3B.23].7L(1x,c,1d,i);B(!2r)1C;1x=2r}m $$.3B[$$.3B.23].7O(1x,c,2J)},9P:k(1S){m $(c.6N(1S,1e)[0]||O)},6Y:k(1S,2J){o T=[];1S=1S.68(\',\');M(o i=0,j=1S.V;i<j;i++)T=T.7P(c.6N(1S[i],1e));m(2J)?T:$$.5M(T)}};P.R({6W:k(4u){o el=Q.6W(4u);B(!el)m O;M(o 1r=el.3n;1r!=c;1r=1r.3n){B(!1r)m O}m el},ez:k(1A){m c.6N(\'.\'+1A)}});Q.R(P.2H.7R);P.R(P.2H.7R);P.R({44:k(){22(c.4D()){Y\'48\':o 1I=[];$1q(c.C,k(3z){B(3z.7Q)1I.1k($4T(3z.J,3z.1K))});m(c.7J)?1I:1I[0];Y\'ab\':B(!(c.7E&&[\'ex\',\'ey\'].1j(c.F))&&![\'4O\',\'1K\',\'eU\'].1j(c.F))1C;Y\'ad\':m c.J}m O},ae:k(){m $$(c.33(\'ab\'),c.33(\'48\'),c.33(\'ad\'))},5A:k(){o 5f=[];c.ae().1q(k(el){o 1w=el.1w;o J=el.44();B(J===O||!1w||el.7D)m;o 7C=k(4m){5f.1k(1w+\'=\'+7e(4m))};B($F(J)==\'1z\')J.1q(7C);14 7C(J)});m 5f.2c(\'&\')}});P.R({3G:k(x,y){c.5V=x;c.63=y},7g:k(){m{\'2G\':{\'x\':c.5V,\'y\':c.63},\'3l\':{\'x\':c.4b,\'y\':c.3R},\'7h\':{\'x\':c.71,\'y\':c.5P}}},3p:k(2k){2k=2k||[];o el=c,1u=0,1o=0;do{1u+=el.fp||0;1o+=el.fh||0;el=el.fj}6Z(el);2k.1q(k(G){1u-=G.5V||0;1o-=G.63||0});m{\'x\':1u,\'y\':1o}},aQ:k(2k){m c.3p(2k).y},aP:k(2k){m c.3p(2k).x},4E:k(2k){o 1v=c.3p(2k);o N={\'2y\':c.4b,\'2N\':c.3R,\'1u\':1v.x,\'1o\':1v.y};N.4n=N.1u+N.2y;N.3P=N.1o+N.2N;m N}});P.2p.7S={7F:k(fn){B(U.6B){fn.1X(c);m}o 5X=k(){B(U.6B)m;U.6B=1e;U.1H=$55(U.1H);c.1h(\'7S\')}.W(c);B(Q.5m&&U.4x){U.1H=k(){B([\'6B\',\'8p\'].1j(Q.5m))5X()}.4f(50)}14 B(Q.5m&&U.2P){B(!$(\'7I\')){o 4s=(U.5k.ff==\'fi:\')?\'://0\':\'8q:fk(0)\';Q.fg(\'<2s 4u="7I" fd 4s="\'+4s+\'"><\\/2s>\');$(\'7I\').7i=k(){B(c.5m==\'8p\')5X()}}}14{U.2C("4e",5X);Q.2C("fe",5X)}}};U.fm=k(fn){m c.1B(\'7S\',fn)};U.R({8m:k(){B(c.5x)m c.fl;B(c.9a)m Q.4B.9c;m Q.2Z.9c},8n:k(){B(c.5x)m c.fo;B(c.9a)m Q.4B.9d;m Q.2Z.9d},93:k(){B(c.2P)m 1c.1D(Q.2Z.4b,Q.2Z.71);B(c.4x)m Q.4B.71;m Q.2Z.71},92:k(){B(c.2P)m 1c.1D(Q.2Z.3R,Q.2Z.5P);B(c.4x)m Q.4B.5P;m Q.2Z.5P},8u:k(){m c.99||Q.2Z.5V},8v:k(){m c.9i||Q.2Z.63},7g:k(){m{\'3l\':{\'x\':c.8m(),\'y\':c.8n()},\'7h\':{\'x\':c.93(),\'y\':c.92()},\'2G\':{\'x\':c.8u(),\'y\':c.8v()}}},3p:k(){m{\'x\':0,\'y\':0}}});o 1f={};1f.2T=L 18({C:{3X:18.1l,1Q:18.1l,7w:18.1l,2f:k(p){m-(1c.av(1c.7W*p)-1)/2},49:fb,2x:\'4W\',3T:1e,98:50},1i:k(C){c.G=c.G||1n;c.2Y(C);B(c.C.1i)c.C.1i.1X(c)},2n:k(){o 3A=$3A();B(3A<c.3A+c.C.49){c.4p=c.C.2f((3A-c.3A)/c.C.49);c.4q();c.4k()}14{c.1R(1e);c.2j(c.17);c.1h(\'1Q\',c.G,10);c.7z()}},2j:k(17){c.12=17;c.4k();m c},4q:k(){c.12=c.4o(c.15,c.17)},4o:k(15,17){m(17-15)*c.4p+15},1g:k(15,17){B(!c.C.3T)c.1R();14 B(c.1H)m c;c.15=15;c.17=17;c.3F=c.17-c.15;c.3A=$3A();c.1H=c.2n.4f(1c.2q(bd/c.C.98),c);c.1h(\'3X\',c.G);m c},1R:k(29){B(!c.1H)m c;c.1H=$55(c.1H);B(!29)c.1h(\'7w\',c.G);m c},2w:k(15,17){m c.1g(15,17)},f1:k(29){m c.1R(29)}});1f.2T.3i(L 7u,L 2p,L 43);1f.3t={48:k(K,17){B(K.2v(/2E/i))m c.2Q;o F=$F(17);B((F==\'1z\')||(F==\'2z\'&&17.1j(\' \')))m c.73;m c.9j},2V:k(el,K,5b){B(!5b.1k)5b=[5b];o 15=5b[0],17=5b[1];B(!$2A(17)){17=15;15=el.2h(K)}o 1y=c.48(K,17);m{\'15\':1y.2V(15),\'17\':1y.2V(17),\'1y\':1y}}};1f.3t.9j={2V:k(J){m 66(J)},56:k(15,17,2O){m 2O.4o(15,17)},44:k(J,2x,K){B(2x==\'4W\'&&K!=\'21\')J=1c.2q(J);m J+2x}};1f.3t.73={2V:k(J){m J.1k?J:J.68(\' \').2D(k(v){m 66(v)})},56:k(15,17,2O){o 12=[];M(o i=0;i<15.V;i++)12[i]=2O.4o(15[i],17[i]);m 12},44:k(J,2x,K){B(2x==\'4W\'&&K!=\'21\')J=J.2D(1c.2q);m J.2c(2x+\' \')+2x}};1f.3t.2Q={2V:k(J){m J.1k?J:J.5G(1e)},56:k(15,17,2O){o 12=[];M(o i=0;i<15.V;i++)12[i]=1c.2q(2O.4o(15[i],17[i]));m 12},44:k(J){m\'1s(\'+J.2c(\',\')+\')\'}};1f.7T=1f.2T.R({1i:k(el,K,C){c.G=$(el);c.K=K;c.1r(C)},3Z:k(){m c.2j(0)},4q:k(){c.12=c.1y.56(c.15,c.17,c)},2j:k(17){c.1y=1f.3t.48(c.K,17);m c.1r(c.1y.2V(17))},1g:k(15,17){B(c.1H&&c.C.3T)m c;o 2e=1f.3t.2V(c.G,c.K,[15,17]);c.1y=2e.1y;m c.1r(2e.15,2e.17)},4k:k(){c.G.1P(c.K,c.1y.44(c.12,c.C.2x,c.K))}});P.R({f2:k(K,C){m L 1f.7T(c,K,C)}});1f.4c=1f.2T.R({1i:k(el,C){c.G=$(el);c.1r(C)},4q:k(){M(o p 1a c.15)c.12[p]=c.1y[p].56(c.15[p],c.17[p],c)},2j:k(17){o 2e={};c.1y={};M(o p 1a 17){c.1y[p]=1f.3t.48(p,17[p]);2e[p]=c.1y[p].2V(17[p])}m c.1r(2e)},1g:k(N){B(c.1H&&c.C.3T)m c;c.12={};c.1y={};o 15={},17={};M(o p 1a N){o 2e=1f.3t.2V(c.G,p,N[p]);15[p]=2e.15;17[p]=2e.17;c.1y[p]=2e.1y}m c.1r(15,17)},4k:k(){M(o p 1a c.12)c.G.1P(p,c.1y[p].44(c.12[p],c.C.2x,p))}});P.R({3U:k(C){m L 1f.4c(c,C)}});1f.26=1f.2T.R({1i:k(T,C){c.T=$$(T);c.1r(C)},4q:k(){M(o i 1a c.15){o 5Q=c.15[i],47=c.17[i],3u=c.1y[i],5U=c.12[i]={};M(o p 1a 5Q)5U[p]=3u[p].56(5Q[p],47[p],c)}},2j:k(17){o 2e={};c.1y={};M(o i 1a 17){o 47=17[i],3u=c.1y[i]={},9u=2e[i]={};M(o p 1a 47){3u[p]=1f.3t.48(p,47[p]);9u[p]=3u[p].2V(47[p])}}m c.1r(2e)},1g:k(N){B(c.1H&&c.C.3T)m c;c.12={};c.1y={};o 15={},17={};M(o i 1a N){o 85=N[i],5Q=15[i]={},47=17[i]={},3u=c.1y[i]={};M(o p 1a 85){o 2e=1f.3t.2V(c.T[i],p,85[p]);5Q[p]=2e.15;47[p]=2e.17;3u[p]=2e.1y}}m c.1r(15,17)},4k:k(){M(o i 1a c.12){o 5U=c.12[i],3u=c.1y[i];M(o p 1a 5U)c.T[i].1P(p,3u[p].44(5U[p],c.C.2x,p))}}});1f.ah=1f.2T.R({C:{2k:[],1E:{\'x\':0,\'y\':0},9r:1e},1i:k(G,C){c.12=[];c.G=$(G);c.1G={\'1R\':c.1R.W(c,O)};c.1r(C);B(c.C.9r){c.1B(\'3X\',k(){Q.1B(\'5a\',c.1G.1R)}.W(c));c.1B(\'1Q\',k(){Q.4C(\'5a\',c.1G.1R)}.W(c))}},4q:k(){M(o i=0;i<2;i++)c.12[i]=c.4o(c.15[i],c.17[i])},3G:k(x,y){B(c.1H&&c.C.3T)m c;o el=c.G.7g();o 1I={\'x\':x,\'y\':y};M(o z 1a el.3l){o 1D=el.7h[z]-el.3l[z];B($2A(1I[z]))1I[z]=($F(1I[z])==\'4M\')?1I[z].1F(0,1D):1D;14 1I[z]=el.2G[z];1I[z]+=c.C.1E[z]}m c.1g([el.2G.x,el.2G.y],[1I.x,1I.y])},f0:k(){m c.3G(O,0)},eZ:k(){m c.3G(O,\'bu\')},eW:k(){m c.3G(0,O)},eX:k(){m c.3G(\'bu\',O)},8A:k(el){o 1r=c.G.3p(c.C.2k);o 3v=$(el).3p(c.C.2k);m c.3G(3v.x-1r.x,3v.y-1r.y)},4k:k(){c.G.3G(c.12[0],c.12[1])}});1f.eY=1f.2T.R({C:{2b:\'8Q\'},1i:k(el,C){c.G=$(el);c.3c=L P(\'4Z\',{\'8J\':$R(c.G.bg(\'34\'),{\'9y\':\'4O\'})}).6v(c.G).b2(c.G);c.G.1P(\'34\',0);c.2Y(C);c.12=[];c.1r(c.C);c.4X=1e;c.1B(\'1Q\',k(){c.4X=(c.12[0]===0)});B(U.5x)c.1B(\'1Q\',k(){B(c.4X)c.G.2K().28(c.3c)})},4q:k(){M(o i=0;i<2;i++)c.12[i]=c.4o(c.15[i],c.17[i])},8Q:k(){c.34=\'34-1o\';c.64=\'2N\';c.1E=c.G.3R},8M:k(){c.34=\'34-1u\';c.64=\'2y\';c.1E=c.G.4b},ba:k(2b){c[2b||c.C.2b]();m c.1g([c.G.2h(c.34).3d(),c.3c.2h(c.64).3d()],[0,c.1E])},bb:k(2b){c[2b||c.C.2b]();m c.1g([c.G.2h(c.34).3d(),c.3c.2h(c.64).3d()],[-c.1E,0])},3Z:k(2b){c[2b||c.C.2b]();c.4X=O;m c.2j([-c.1E,0])},4d:k(2b){c[2b||c.C.2b]();c.4X=1e;m c.2j([0,c.1E])},f3:k(2b){B(c.3c.3R==0||c.3c.4b==0)m c.ba(2b);m c.bb(2b)},4k:k(){c.G.1P(c.34,c.12[0]+c.C.2x);c.3c.1P(c.64,c.12[1]+c.C.2x)}});1f.7U=k(2f,2U){2U=2U||[];B($F(2U)!=\'1z\')2U=[2U];m $R(2f,{f4:k(1m){m 2f(1m,2U)},f9:k(1m){m 1-2f(1-1m,2U)},fa:k(1m){m(1m<=0.5)?2f(2*1m,2U)/2:(2-2f(2*(1-1m),2U))/2}})};1f.3o=L 3M({fc:k(p){m p}});1f.3o.R=k(7B){M(o 2f 1a 7B){1f.3o[2f]=L 1f.7U(7B[2f]);1f.3o.7X(2f)}};1f.3o.7X=k(2f){[\'f8\',\'f7\',\'f5\'].1q(k(89){1f.3o[2f.5L()+89]=1f.3o[2f][\'f6\'+89]})};1f.3o.R({eD:k(p,x){m 1c.3w(p,x[0]||6)},em:k(p){m 1c.3w(2,8*(p-1))},dw:k(p){m 1-1c.bj(1c.dx(p))},dy:k(p){m 1-1c.bj((1-p)*1c.7W/2)},dv:k(p,x){x=x[0]||1.du;m 1c.3w(p,2)*((x+1)*p-x)},dr:k(p){o J;M(o a=0,b=1;1;a+=b,b/=2){B(p>=(7-4*a)/11){J=-1c.3w((11-6*a-11*p)/4,2)+b*b;1C}}m J},ds:k(p,x){m 1c.3w(2,10*--p)*1c.av(20*p*1c.7W*(x[0]||1)/3)}});[\'dt\',\'dz\',\'dA\',\'dG\'].1q(k(2f,i){1f.3o[2f]=L 1f.7U(k(p){m 1c.3w(p,[i+2])});1f.3o.7X(2f)});o 4g={};4g.2T=L 18({C:{3J:O,2x:\'4W\',3X:18.1l,al:18.1l,1Q:18.1l,as:18.1l,8S:18.1l,1F:O,3E:{x:\'1u\',y:\'1o\'},4P:O,6M:6},1i:k(el,C){c.2Y(C);c.G=$(el);c.3J=$(c.C.3J)||c.G;c.3m={\'12\':{},\'1m\':{}};c.J={\'1g\':{},\'12\':{}};c.1G={\'1g\':c.1g.3e(c),\'4i\':c.4i.3e(c),\'3D\':c.3D.3e(c),\'1R\':c.1R.W(c)};c.6V();B(c.C.1i)c.C.1i.1X(c)},6V:k(){c.3J.1B(\'5n\',c.1G.1g);m c},9F:k(){c.3J.4C(\'5n\',c.1G.1g);m c},1g:k(I){c.1h(\'al\',c.G);c.3m.1g=I.1Y;o 1F=c.C.1F;c.1F={\'x\':[],\'y\':[]};M(o z 1a c.C.3E){B(!c.C.3E[z])6l;c.J.12[z]=c.G.2h(c.C.3E[z]).3d();c.3m.1m[z]=I.1Y[z]-c.J.12[z];B(1F&&1F[z]){M(o i=0;i<2;i++){B($2A(1F[z][i]))c.1F[z][i]=($F(1F[z][i])==\'k\')?1F[z][i]():1F[z][i]}}}B($F(c.C.4P)==\'4M\')c.C.4P={\'x\':c.C.4P,\'y\':c.C.4P};Q.2C(\'2M\',c.1G.4i);Q.2C(\'5z\',c.1G.1R);c.1h(\'3X\',c.G);I.1R()},4i:k(I){o ao=1c.2q(1c.dH(1c.3w(I.1Y.x-c.3m.1g.x,2)+1c.3w(I.1Y.y-c.3m.1g.y,2)));B(ao>c.C.6M){Q.3h(\'2M\',c.1G.4i);Q.2C(\'2M\',c.1G.3D);c.3D(I);c.1h(\'as\',c.G)}I.1R()},3D:k(I){c.69=O;c.3m.12=I.1Y;M(o z 1a c.C.3E){B(!c.C.3E[z])6l;c.J.12[z]=c.3m.12[z]-c.3m.1m[z];B(c.1F[z]){B($2A(c.1F[z][1])&&(c.J.12[z]>c.1F[z][1])){c.J.12[z]=c.1F[z][1];c.69=1e}14 B($2A(c.1F[z][0])&&(c.J.12[z]<c.1F[z][0])){c.J.12[z]=c.1F[z][0];c.69=1e}}B(c.C.4P[z])c.J.12[z]-=(c.J.12[z]%c.C.4P[z]);c.G.1P(c.C.3E[z],c.J.12[z]+c.C.2x)}c.1h(\'8S\',c.G);I.1R()},1R:k(){Q.3h(\'2M\',c.1G.4i);Q.3h(\'2M\',c.1G.3D);Q.3h(\'5z\',c.1G.1R);c.1h(\'1Q\',c.G)}});4g.2T.3i(L 2p,L 43);P.R({dF:k(C){m L 4g.2T(c,$2a({3E:{x:\'2y\',y:\'2N\'}},C))}});4g.aM=4g.2T.R({C:{6c:[],2d:O,2k:[]},1i:k(el,C){c.2Y(C);c.G=$(el);c.6c=$$(c.C.6c);c.2d=$(c.C.2d);c.1v={\'G\':c.G.2h(\'1v\'),\'2d\':O};B(c.2d)c.1v.2d=c.2d.2h(\'1v\');B(![\'70\',\'3Y\',\'4V\'].1j(c.1v.G))c.1v.G=\'3Y\';o 1o=c.G.2h(\'1o\').3d();o 1u=c.G.2h(\'1u\').3d();B(c.1v.G==\'3Y\'&&![\'70\',\'3Y\',\'4V\'].1j(c.1v.2d)){1o=$2A(1o)?1o:c.G.aQ(c.C.2k);1u=$2A(1u)?1u:c.G.aP(c.C.2k)}14{1o=$2A(1o)?1o:0;1u=$2A(1u)?1u:0}c.G.4A({\'1o\':1o,\'1u\':1u,\'1v\':c.1v.G});c.1r(c.G)},1g:k(I){c.3f=1n;B(c.2d){o 4r=c.2d.4E();o el=c.G.4E();B(c.1v.G==\'3Y\'&&![\'70\',\'3Y\',\'4V\'].1j(c.1v.2d)){c.C.1F={\'x\':[4r.1u,4r.4n-el.2y],\'y\':[4r.1o,4r.3P-el.2N]}}14{c.C.1F={\'y\':[0,4r.2N-el.2N],\'x\':[0,4r.2y-el.2y]}}}c.1r(I)},3D:k(I){c.1r(I);o 3f=c.69?O:c.6c.36(c.aO,c).80();B(c.3f!=3f){B(c.3f)c.3f.1h(\'dE\',[c.G,c]);c.3f=3f?3f.1h(\'dB\',[c.G,c]):1n}m c},aO:k(el){el=el.4E(c.C.2k);o 12=c.3m.12;m(12.x>el.1u&&12.x<el.4n&&12.y<el.3P&&12.y>el.1o)},1R:k(){B(c.3f&&!c.69)c.3f.1h(\'dC\',[c.G,c]);14 c.G.1h(\'dD\',c);c.1r();m c}});P.R({dq:k(C){m L 4g.aM(c,C)}});o 6n=L 18({C:{23:\'59\',be:1e,9g:18.1l,5h:18.1l,6w:18.1l,aG:1e,5J:\'dp-8\',aZ:O,4J:{}},7q:k(){c.2u=(U.6C)?L 6C():(U.2P?L 9o(\'en.dc\'):O);m c},1i:k(C){c.7q().2Y(C);c.C.5D=c.C.5D||c.5D;c.4J={};B(c.C.aG&&c.C.23==\'59\'){o 5J=(c.C.5J)?\'; dd=\'+c.C.5J:\'\';c.5l(\'9R-F\',\'9J/x-aS-da-d9\'+5J)}B(c.C.1i)c.C.1i.1X(c)},9s:k(){B(c.2u.5m!=4||!c.4Q)m;c.4Q=O;o 4I=0;5j{4I=c.2u.4I}5c(e){};B(c.C.5D.1X(c,4I))c.5h();14 c.6w();c.2u.7i=18.1l},5D:k(4I){m((4I>=d6)&&(4I<d7))},5h:k(){c.3L={\'1K\':c.2u.d8,\'5t\':c.2u.de};c.1h(\'5h\',[c.3L.1K,c.3L.5t]);c.7z()},6w:k(){c.1h(\'6w\',c.2u)},5l:k(1w,J){c.4J[1w]=J;m c},6a:k(2L,1T){B(c.C.aZ)c.95();14 B(c.4Q)m c;c.4Q=1e;B(1T&&c.C.23==\'5q\'){2L=2L+(2L.1j(\'?\')?\'&\':\'?\')+1T;1T=1n}c.2u.4X(c.C.23.7A(),2L,c.C.be);c.2u.7i=c.9s.W(c);B((c.C.23==\'59\')&&c.2u.d5)c.5l(\'df\',\'dl\');$R(c.4J,c.C.4J);M(o F 1a c.4J)5j{c.2u.dm(F,c.4J[F])}5c(e){};c.1h(\'9g\');c.2u.6a($4T(1T,1n));m c},95:k(){B(!c.4Q)m c;c.4Q=O;c.2u.8s();c.2u.7i=18.1l;c.7q();c.1h(\'7w\');m c}});6n.3i(L 7u,L 2p,L 43);o 9b=6n.R({C:{1T:1n,7x:1n,1Q:18.1l,6R:O,7p:O},1i:k(2L,C){c.1B(\'5h\',c.1Q);c.2Y(C);c.C.1T=c.C.1T||c.C.dn;B(![\'59\',\'5q\'].1j(c.C.23)){c.5H=\'5H=\'+c.C.23;c.C.23=\'59\'}c.1r();c.5l(\'X-dk-dj\',\'6C\');c.5l(\'dg\',\'1K/8q, 1K/dh, 9J/5t, 1K/5t, */*\');c.2L=2L},1Q:k(){B(c.C.7x)$(c.C.7x).1l().5s(c.3L.1K);B(c.C.6R||c.C.7p)c.6R();c.1h(\'1Q\',[c.3L.1K,c.3L.5t],20)},9h:k(1T){1T=1T||c.C.1T;22($F(1T)){Y\'G\':1T=$(1T).5A();1C;Y\'2I\':1T=8X.5A(1T)}B(c.5H)1T=(1T)?[c.5H,1T].2c(\'&\'):c.5H;m c.6a(c.2L,1T)},6R:k(){o 2s,3y;B(c.C.7p||(/(di|dI)2s/).2v(c.af(\'9R-F\')))3y=c.3L.1K;14{3y=[];o 5C=/<2s[^>]*>([\\s\\S]*?)<\\/2s>/dJ;6Z((2s=5C.e9(c.3L.1K)))3y.1k(2s[1]);3y=3y.2c(\'\\n\')}B(3y)(U.9O)?U.9O(3y):U.9M(3y,0)},af:k(1w){5j{m c.2u.ea(1w)}5c(e){};m 1n}});8X.5A=k(1Z){o 5f=[];M(o K 1a 1Z)5f.1k(7e(K)+\'=\'+7e(1Z[K]));m 5f.2c(\'&\')};P.R({6a:k(C){m L 9b(c.5R(\'eb\'),$2a({1T:c.5A()},C,{23:\'59\'})).9h()}});o 3H=L 3M({C:{7o:O,7k:O,49:O,5g:O},2j:k(1t,J,C){C=$2a(c.C,C);J=7e(J);B(C.7o)J+=\'; 7o=\'+C.7o;B(C.7k)J+=\'; 7k=\'+C.7k;B(C.49){o 6k=L 96();6k.e8(6k.9w()+C.49*24*60*60*bd);J+=\'; e7=\'+6k.e4()}B(C.5g)J+=\'; 5g\';Q.4K=1t+\'=\'+J;m $R(C,{\'1t\':1t,\'J\':J})},5q:k(1t){o J=Q.4K.31(\'(?:^|;)\\\\s*\'+1t.b5()+\'=([^;]*)\');m J?e5(J[1]):O},2K:k(4K,C){B($F(4K)==\'2I\')c.2j(4K.1t,\'\',$2a(4K,{49:-1}));14 c.2j(4K,\'\',$2a(C,{49:-1}))}});o 3I={4l:k(N){22($F(N)){Y\'2z\':m\'"\'+N.3g(/(["\\\\])/g,\'\\\\$1\')+\'"\';Y\'1z\':m\'[\'+N.2D(3I.4l).2c(\',\')+\']\';Y\'2I\':o 2z=[];M(o K 1a N)2z.1k(3I.4l(K)+\':\'+3I.4l(N[K]));m\'{\'+2z.2c(\',\')+\'}\';Y\'4M\':B(e6(N))1C;Y O:m\'1n\'}m 6i(N)},5r:k(4H,5g){m(($F(4H)!=\'2z\')||(5g&&!4H.2v(/^("(\\\\.|[^"\\\\\\n\\r])*?"|[,:{}\\[\\]0-9.\\-+ec-u \\n\\r\\t])+?$/)))?1n:ed(\'(\'+4H+\')\')}};3I.ej=6n.R({1i:k(2L,C){c.2L=2L;c.1B(\'5h\',c.1Q);c.1r(C);c.5l(\'X-ek\',\'ei\')},6a:k(N){m c.1r(c.2L,\'eh=\'+3I.4l(N))},1Q:k(){c.1h(\'1Q\',[3I.5r(c.3L.1K,c.C.5g)])}});o ar=L 3M({8q:k(1Z,1J){1J=$2a({\'5N\':18.1l},1J);o 2s=L P(\'2s\',{\'4s\':1Z}).6j({\'4e\':1J.5N,\'ee\':k(){B(c.5m==\'8p\')c.1h(\'4e\')}});57 1J.5N;m 2s.6o(1J).28(Q.6e)},1y:k(1Z,1J){m L P(\'4y\',$2a({\'a1\':\'ef\',\'eg\':\'e3\',\'F\':\'1K/1y\',\'4N\':1Z},1J)).28(Q.6e)},4S:k(1Z,1J){1J=$2a({\'5N\':18.1l,\'e2\':18.1l,\'dP\':18.1l},1J);o 4S=L dQ();4S.4s=1Z;o G=L P(\'8x\',{\'4s\':1Z});[\'4e\',\'8s\',\'aE\'].1q(k(F){o I=1J[\'67\'+F];57 1J[\'67\'+F];G.1B(F,k(){c.4C(F,1b.8t);I.1X(c)})});B(4S.2y&&4S.2N)G.1h(\'4e\',G,1);m G.6o(1J)},6s:k(58,C){C=$2a({1Q:18.1l,an:18.1l},C);B(!58.1k)58=[58];o 6s=[];o 6q=0;58.1q(k(1Z){o 8x=L ar.4S(1Z,{\'5N\':k(){C.an.1X(c,6q);6q++;B(6q==58.V)C.1Q()}});6s.1k(8x)});m L 26(6s)}});o 3O=L 18({V:0,1i:k(2I){c.N=2I||{};c.5K()},5q:k(1t){m(c.6t(1t))?c.N[1t]:1n},6t:k(1t){m(1t 1a c.N)},2j:k(1t,J){B(!c.6t(1t))c.V++;c.N[1t]=J;m c},5K:k(){c.V=0;M(o p 1a c.N)c.V++;m c},2K:k(1t){B(c.6t(1t)){57 c.N[1t];c.V--}m c},1q:k(fn,W){$1q(c.N,fn,W)},R:k(N){$R(c.N,N);m c.5K()},2a:k(){c.N=$2a.4j(1n,[c.N].R(1b));m c.5K()},1l:k(){c.N={};c.V=0;m c},1O:k(){o 1O=[];M(o K 1a c.N)1O.1k(K);m 1O},1I:k(){o 1I=[];M(o K 1a c.N)1I.1k(c.N[K]);m 1I}});k $H(N){m L 3O(N)};3O.3H=3O.R({1i:k(1w,C){c.1w=1w;c.C=$R({\'aw\':1e},C||{});c.4e()},aX:k(){B(c.V==0){3H.2K(c.1w,c.C);m 1e}o 4H=3I.4l(c.N);B(4H.V>dR)m O;3H.2j(c.1w,4H,c.C);m 1e},4e:k(){c.N=3I.5r(3H.5q(c.1w),1e)||{};c.5K()}});3O.3H.2H={};[\'R\',\'2j\',\'2a\',\'1l\',\'2K\'].1q(k(23){3O.3H.2H[23]=k(){3O.1L[23].4j(c,1b);B(c.C.aw)c.aX();m c}});3O.3H.3i(3O.3H.2H);o 2Q=L 18({1i:k(2E,F){F=F||(2E.1k?\'1s\':\'3C\');o 1s,2m;22(F){Y\'1s\':1s=2E;2m=1s.8h();1C;Y\'2m\':1s=2E.b9();2m=2E;1C;62:1s=2E.5G(1e);2m=1s.8h()}1s.2m=2m;1s.3C=1s.5E();m $R(1s,2Q.1L)},54:k(){o 5I=$A(1b);o 7d=($F(5I[5I.V-1])==\'4M\')?5I.dO():50;o 1s=c.8e();5I.1q(k(2E){2E=L 2Q(2E);M(o i=0;i<3;i++)1s[i]=1c.2q((1s[i]/ 35 * (35 - 7d)) + (2E[i] /35*7d))});m L 2Q(1s,\'1s\')},dN:k(){m L 2Q(c.2D(k(J){m 51-J}))},dK:k(J){m L 2Q([J,c.2m[1],c.2m[2]],\'2m\')},dL:k(7a){m L 2Q([c.2m[0],7a,c.2m[2]],\'2m\')},dM:k(7a){m L 2Q([c.2m[0],c.2m[1],7a],\'2m\')}});k $dS(r,g,b){m L 2Q([r,g,b],\'1s\')};k $dT(h,s,b){m L 2Q([h,s,b],\'2m\')};2t.R({8h:k(){o 5W=c[0],65=c[1],75=c[2];o 2W,6y,8k;o 1D=1c.1D(5W,65,75),3s=1c.3s(5W,65,75);o 4p=1D-3s;8k=1D/51;6y=(1D!=0)?4p/1D:0;B(6y==0){2W=0}14{o 8l=(1D-5W)/4p;o 8W=(1D-65)/4p;o br=(1D-75)/4p;B(5W==1D)2W=br-8W;14 B(65==1D)2W=2+8l-br;14 2W=4+8W-8l;2W/=6;B(2W<0)2W++}m[1c.2q(2W*bc),1c.2q(6y*35),1c.2q(8k*35)]},b9:k(){o br=1c.2q(c[2]/35*51);B(c[1]==0){m[br,br,br]}14{o 2W=c[0]%bc;o f=2W%60;o p=1c.2q((c[2]*(35-c[1]))/dZ*51);o q=1c.2q((c[2]*(b7-c[1]*f))/bm*51);o t=1c.2q((c[2]*(b7-c[1]*(60-f)))/bm*51);22(1c.9q(2W/60)){Y 0:m[br,t,p];Y 1:m[q,br,p];Y 2:m[p,br,t];Y 3:m[p,q,br];Y 4:m[t,p,br];Y 5:m[br,p,q]}}m O}});o 9x=L 18({C:{6b:20,8O:1,6F:k(x,y){c.G.3G(x,y)}},1i:k(G,C){c.2Y(C);c.G=$(G);c.8y=([U,Q].1j(G))?$(Q.4B):c.G},1g:k(){c.8z=c.9A.3e(c);c.8y.2C(\'2M\',c.8z)},1R:k(){c.8y.3h(\'2M\',c.8z);c.1H=$55(c.1H)},9A:k(I){c.1Y=(c.G==U)?I.9B:I.1Y;B(!c.1H)c.1H=c.2G.4f(50,c)},2G:k(){o el=c.G.7g();o 1m=c.G.3p();o 3F={\'x\':0,\'y\':0};M(o z 1a c.1Y){B(c.1Y[z]<(c.C.6b+1m[z])&&el.2G[z]!=0)3F[z]=(c.1Y[z]-c.C.6b-1m[z])*c.C.8O;14 B(c.1Y[z]+c.C.6b>(el.3l[z]+1m[z])&&el.2G[z]+el.3l[z]!=el.7h[z])3F[z]=(c.1Y[z]-el.3l[z]+c.C.6b-1m[z])*c.C.8O}B(3F.y||3F.x)c.1h(\'6F\',[el.2G.x+3F.x,el.2G.y+3F.y])}});9x.3i(L 2p,L 43);o 8B=L 18({C:{6F:18.1l,1Q:18.1l,8L:k(1m){c.4h.1P(c.p,1m)},2b:\'8M\',6E:35,1E:0},1i:k(el,4h,C){c.G=$(el);c.4h=$(4h);c.2Y(C);c.8K=-1;c.8D=-1;c.2n=-1;c.G.1B(\'5n\',c.9D.3e(c));o 6H,1E;22(c.C.2b){Y\'8M\':c.z=\'x\';c.p=\'1u\';6H={\'x\':\'1u\',\'y\':O};1E=\'4b\';1C;Y\'8Q\':c.z=\'y\';c.p=\'1o\';6H={\'x\':O,\'y\':\'1o\'};1E=\'3R\'}c.1D=c.G[1E]-c.4h[1E]+(c.C.1E*2);c.a5=c.4h[1E]/2;c.ai=c.G[\'5q\'+c.p.8R()].W(c.G);c.4h.1P(\'1v\',\'70\').1P(c.p,-c.C.1E);o 8U={};8U[c.z]=[-c.C.1E,c.1D-c.C.1E];c.3D=L 4g.2T(c.4h,{1F:8U,3E:6H,6M:0,3X:k(){c.6L()}.W(c),8S:k(){c.6L()}.W(c),1Q:k(){c.6L();c.29()}.W(c)});B(c.C.1i)c.C.1i.1X(c)},2j:k(2n){c.2n=2n.1F(0,c.C.6E);c.6G();c.29();c.1h(\'8L\',c.a0(c.2n));m c},9D:k(I){o 1v=I.1Y[c.z]-c.ai()-c.a5;1v=1v.1F(-c.C.1E,c.1D-c.C.1E);c.2n=c.8C(1v);c.6G();c.29();c.1h(\'8L\',1v)},6L:k(){c.2n=c.8C(c.3D.J.12[c.z]);c.6G()},6G:k(){B(c.8K!=c.2n){c.8K=c.2n;c.1h(\'6F\',c.2n)}},29:k(){B(c.8D!==c.2n){c.8D=c.2n;c.1h(\'1Q\',c.2n+\'\')}},8C:k(1v){m 1c.2q((1v+c.C.1E)/c.1D*c.C.6E)},a0:k(2n){m c.1D*2n/c.C.6E}});8B.3i(L 2p);8B.3i(L 43);o e0=1f.ah.R({1i:k(C){c.1r(U,C);c.5w=(c.C.5w)?$$(c.C.5w):$$(Q.5w);o 5k=U.5k.4N.31(/^[^#]*/)[0]+\'#\';c.5w.1q(k(4y){B(4y.4N.3k(5k)!=0)m;o 3K=4y.4N.6K(5k.V);B(3K&&$(3K))c.9L(4y,3K)},c);B(!U.5x)c.1B(\'1Q\',k(){U.5k.e1=c.3K})},9L:k(4y,3K){4y.1B(\'6h\',k(I){c.3K=3K;c.8A(3K);I.1R()}.3e(c))}});o 9S=L 18({C:{4L:O,3X:18.1l,1Q:18.1l,2S:1e,6M:3,9H:k(G,2S){2S.1P(\'21\',0.7);G.1P(\'21\',0.7)},9e:k(G,2S){G.1P(\'21\',1);2S.2K();c.3V.2K()}},1i:k(5p,C){c.2Y(C);c.5p=$(5p);c.T=c.5p.8H();c.4L=(c.C.4L)?$$(c.C.4L):c.T;c.1G={\'1g\':[],\'5y\':c.5y.3e(c)};M(o i=0,l=c.4L.V;i<l;i++){c.1G.1g[i]=c.1g.3e(c,c.T[i])}c.6V();B(c.C.1i)c.C.1i.1X(c);c.1G.5o=c.5o.3e(c);c.1G.29=c.29.W(c)},6V:k(){c.4L.1q(k(3J,i){3J.1B(\'5n\',c.1G.1g[i])},c)},9F:k(){c.4L.1q(k(3J,i){3J.4C(\'5n\',c.1G.1g[i])},c)},1g:k(I,el){c.4G=el;c.8F=c.5p.4E();B(c.C.2S){o 1v=el.3p();c.1E=I.1Y.y-1v.y;c.3V=L P(\'4Z\').28(Q.4B);c.2S=el.9G().28(c.3V).4A({\'1v\':\'3Y\',\'1u\':1v.x,\'1o\':I.1Y.y-c.1E});Q.2C(\'2M\',c.1G.5y);c.1h(\'9H\',[el,c.2S])}Q.2C(\'2M\',c.1G.5o);Q.2C(\'5z\',c.1G.29);c.1h(\'3X\',el);I.1R()},5y:k(I){o J=I.1Y.y-c.1E;J=J.1F(c.8F.1o,c.8F.3P-c.2S.3R);c.2S.1P(\'1o\',J);I.1R()},5o:k(I){o 12=I.1Y.y;c.2l=c.2l||12;o 6P=((c.2l-12)>0);o 6T=c.4G.9W();o 3x=c.4G.8I();B(6T&&6P&&12<6T.4E().3P)c.4G.7Y(6T);B(3x&&!6P&&12>3x.4E().1o)c.4G.6v(3x);c.2l=12},dY:k(9Q){m c.5p.8H().2D(9Q||k(el){m c.T.3k(el)},c)},29:k(){c.2l=1n;Q.3h(\'2M\',c.1G.5o);Q.3h(\'5z\',c.1G.29);B(c.C.2S){Q.3h(\'2M\',c.1G.5y);c.1h(\'9e\',[c.4G,c.2S])}c.1h(\'1Q\',c.4G)}});9S.3i(L 2p,L 43);o aI=L 18({C:{aT:k(3W){3W.1P(\'4z\',\'8G\')},aW:k(3W){3W.1P(\'4z\',\'4O\')},8T:30,bp:35,bt:35,1A:\'dX\',5F:{\'x\':16,\'y\':16},4V:O},1i:k(T,C){c.2Y(C);c.45=L P(\'4Z\',{\'4R\':c.C.1A+\'-3W\',\'8J\':{\'1v\':\'3Y\',\'1o\':\'0\',\'1u\':\'0\',\'4z\':\'4O\'}}).28(Q.4B);c.3c=L P(\'4Z\').28(c.45);$$(T).1q(c.9I,c);B(c.C.1i)c.C.1i.1X(c)},9I:k(el){el.$1W.42=(el.4N&&el.4D()==\'a\')?el.4N.3g(\'9Y://\',\'\'):(el.a1||O);B(el.53){o 6z=el.53.68(\'::\');B(6z.V>1){el.$1W.42=6z[0].5T();el.$1W.5u=6z[1].5T()}14{el.$1W.5u=el.53}el.a7(\'53\')}14{el.$1W.5u=O}B(el.$1W.42&&el.$1W.42.V>c.C.8T)el.$1W.42=el.$1W.42.6K(0,c.C.8T-1)+"&dU;";el.1B(\'8N\',k(I){c.1g(el);B(!c.C.4V)c.8f(I);14 c.1v(el)}.W(c));B(!c.C.4V)el.1B(\'2M\',c.8f.3e(c));o 29=c.29.W(c);el.1B(\'8P\',29);el.1B(\'3V\',29)},1g:k(el){c.3c.1l();B(el.$1W.42){c.53=L P(\'b0\').28(L P(\'4Z\',{\'4R\':c.C.1A+\'-53\'}).28(c.3c)).5s(el.$1W.42)}B(el.$1W.5u){c.1K=L P(\'b0\').28(L P(\'4Z\',{\'4R\':c.C.1A+\'-1K\'}).28(c.3c)).5s(el.$1W.5u)}$55(c.1H);c.1H=c.4d.2g(c.C.bp,c)},29:k(I){$55(c.1H);c.1H=c.3Z.2g(c.C.bt,c)},1v:k(G){o 1m=G.3p();c.45.4A({\'1u\':1m.x+c.C.5F.x,\'1o\':1m.y+c.C.5F.y})},8f:k(I){o am={\'x\':U.8m(),\'y\':U.8n()};o 2G={\'x\':U.8u(),\'y\':U.8v()};o 3W={\'x\':c.45.4b,\'y\':c.45.3R};o 1V={\'x\':\'1u\',\'y\':\'1o\'};M(o z 1a 1V){o 1m=I.1Y[z]+c.C.5F[z];B((1m+3W[z]-2G[z])>am[z])1m=I.1Y[z]-c.C.5F[z]-3W[z];c.45.1P(1V[z],1m)}},4d:k(){B(c.C.aq)c.1H=c.3Z.2g(c.C.aq,c);c.1h(\'aT\',[c.45])},3Z:k(){c.1h(\'aW\',[c.45])}});aI.3i(L 2p,L 43);o dV=L 18({1i:k(){c.6D=$A(1b);c.19={};c.4U={}},1B:k(F,fn){c.4U[F]=c.4U[F]||{};c.19[F]=c.19[F]||[];B(c.19[F].1j(fn))m O;14 c.19[F].1k(fn);c.6D.1q(k(5v,i){5v.1B(F,c.4i.W(c,[F,5v,i]))},c);m c},4i:k(F,5v,i){c.4U[F][i]=1e;o 4F=c.6D.4F(k(2i,j){m c.4U[F][j]||O},c);B(!4F)m;c.4U[F]={};c.19[F].1q(k(I){I.1X(c,c.6D,5v)},c)}});o 7t=1f.26.R({C:{7K:18.1l,aa:18.1l,3Q:0,4d:O,2N:1e,2y:O,21:1e,7f:O,7n:O,3T:O,6I:O},1i:k(){o C,2B,T,2d;$1q(1b,k(4t,i){22($F(4t)){Y\'2I\':C=4t;1C;Y\'G\':2d=$(4t);1C;62:o 2r=$$(4t);B(!2B)2B=2r;14 T=2r}});c.2B=2B||[];c.T=T||[];c.2d=$(2d);c.2Y(C);c.2l=-1;B(c.C.6I)c.C.3T=1e;B($2A(c.C.4d)){c.C.3Q=O;c.2l=c.C.4d}B(c.C.1g){c.C.3Q=O;c.C.4d=O}c.3U={};B(c.C.21)c.3U.21=\'b8\';B(c.C.2y)c.3U.2y=c.C.7n?\'aj\':\'4b\';B(c.C.2N)c.3U.2N=c.C.7f?\'9n\':\'5P\';M(o i=0,l=c.2B.V;i<l;i++)c.aR(c.2B[i],c.T[i]);c.T.1q(k(el,i){B(c.C.4d===i){c.1h(\'7K\',[c.2B[i],el])}14{M(o 2O 1a c.3U)el.1P(2O,0)}},c);c.1r(c.T);B($2A(c.C.3Q))c.3Q(c.C.3Q)},aR:k(3j,G,1m){3j=$(3j);G=$(G);o 2v=c.2B.1j(3j);o 3S=c.2B.V;c.2B.5S(3j);c.T.5S(G);B(3S&&(!2v||1m)){1m=$4T(1m,3S-1);3j.7Y(c.2B[1m]);G.6v(3j)}14 B(c.2d&&!2v){3j.28(c.2d);G.28(c.2d)}o aA=c.2B.3k(3j);3j.1B(\'6h\',c.3Q.W(c,aA));B(c.C.2N)G.4A({\'4w-1o\':0,\'2R-1o\':\'7j\',\'4w-3P\':0,\'2R-3P\':\'7j\'});B(c.C.2y)G.4A({\'4w-1u\':0,\'2R-1u\':\'7j\',\'4w-4n\':0,\'2R-4n\':\'7j\'});G.b8=1;B(c.C.7n)G.aj=c.C.7n;B(c.C.7f)G.9n=c.C.7f;G.1P(\'9y\',\'4O\');B(!2v){M(o 2O 1a c.3U)G.1P(2O,0)}m c},3Q:k(25){25=($F(25)==\'G\')?c.T.3k(25):25;B((c.1H&&c.C.3T)||(25===c.2l&&!c.C.6I))m c;c.2l=25;o N={};c.T.1q(k(el,i){N[i]={};o 3Z=(i!=25)||(c.C.6I&&(el.3R>0));c.1h(3Z?\'aa\':\'7K\',[c.2B[i],el]);M(o 2O 1a c.3U)N[i][2O]=3Z?0:el[c.3U[2O]]},c);m c.1g(N)},dW:k(25){m c.3Q(25)}});1f.7t=7t;',62,956,'||||||||||||this||||||||function||return||var|||||||||||||if|options|||type|element||event|value|property|new|for|obj|false|Element|document|extend||elements|window|length|bind||case||||now||else|from||to|Class|events|in|arguments|Math|param|true|Fx|start|fireEvent|initialize|contains|push|empty|pos|null|top|args|each|parent|rgb|key|left|position|name|items|css|array|className|addEvent|break|max|offset|limit|bound|timer|values|properties|text|prototype|result|style|keys|setStyle|onComplete|stop|selector|data|props|prop|tmp|call|page|source||opacity|switch|method||index|Elements||inject|end|merge|mode|join|container|parsed|transition|delay|getStyle|current|set|overflown|previous|hsb|step|relatedTarget|Events|round|temp|script|Array|transport|test|custom|unit|width|string|chk|togglers|addListener|map|color|Garbage|scroll|Methods|object|nocash|remove|url|mousemove|height|fx|ie|Color|border|ghost|Base|params|parse|hue|Event|setOptions|documentElement||match||getElementsByTagName|margin|100|filter||||create|context|wrapper|toInt|bindWithEvent|overed|replace|removeListener|implement|toggler|indexOf|size|mouse|parentNode|Transitions|getPosition|tag|item|min|CSS|iCss|target|pow|next|scripts|option|time|shared|hex|drag|modifiers|change|scrollTo|Cookie|Json|handle|anchor|response|Abstract|returns|Hash|bottom|display|offsetHeight|len|wait|effects|trash|tip|onStart|absolute|hide||iterable|myTitle|Options|getValue|toolTip||iTo|select|duration|xpath|offsetWidth|Styles|show|load|periodical|Drag|knob|check|apply|increase|toString|val|right|compute|delta|setNow|cont|src|argument|id|chains|padding|webkit|link|visibility|setStyles|body|removeEvent|getTag|getCoordinates|every|active|str|status|headers|cookie|handles|number|href|hidden|grid|running|class|image|pick|checker|fixed|px|open|results|div||255|collect|title|mix|clear|getNow|delete|sources|post|mousewheel|fromTo|catch|bit|native|queryString|secure|onSuccess|htmlElement|try|location|setHeader|readyState|mousedown|move|list|get|evaluate|setHTML|xml|myText|instance|links|webkit419|moveGhost|mouseup|toQueryString|HTMLElement|regexp|isSuccess|rgbToHex|offsets|hexToRgb|_method|colors|encoding|setLength|toLowerCase|unique|onload|parseInt|scrollHeight|iFrom|getProperty|include|trim|iNow|scrollLeft|red|domReady|precision|klass||walk|default|scrollTop|layout|green|parseFloat|on|split|out|send|area|droppables|mp|head|attempt|evType|click|String|addEvents|date|continue|fix|XHR|setProperties|currentStyle|counter|included|images|hasKey|brother|injectAfter|onFailure|generic|saturation|dual|Properties|loaded|XMLHttpRequest|instances|steps|onChange|checkStep|mod|alwaysHide|Listeners|substr|draggedKnob|snap|getElements|code|up|fKey|evalScripts|tagName|prev|stopPropagation|attach|getElementById|preventDefault|getElementsBySelector|while|relative|scrollWidth|setMany|Multi|splice|blue|realType|defined|removeEvents|regex|percent|forEach|typeof|alpha|encodeURIComponent|fixedHeight|getSize|scrollSize|onreadystatechange|none|path|setProperty|proto|fixedWidth|domain|evalResponse|setTransport|clean|hasClass|Accordion|Chain|unload|onCancel|update|RegExp|callChain|toUpperCase|transitions|qs|disabled|checked|add|pairs|getMany|ie_ready|multiple|onActive|getParam|found|xhtml|getItems|concat|selected|Dom|domready|Style|Transition|flag|PI|compat|injectBefore|Function|getLast|node|operator|innerText|nodeType|iProps|appendChild|cssText|firstChild|easeType|camelCase|DOMMouseScroll|random|charAt|copy|locate|newArray|rgbToHsb|merged|addEventListener|brightness|rr|getWidth|getHeight|hasChild|complete|javascript|gecko|abort|callee|getScrollLeft|getScrollTop|pageY|img|mousemover|coord|toElement|Slider|toStep|previousEnd|pageX|coordinates|visible|getChildren|getNext|styles|previousChange|onTick|horizontal|mouseenter|velocity|mouseleave|vertical|capitalize|onDrag|maxTitleChars|lim|NativeEvents|gr|Object|mouseout|first|mouseover|insertBefore|getScrollHeight|getScrollWidth|after|cancel|Date|borderShort|fps|pageXOffset|opera|Ajax|clientWidth|clientHeight|onDragComplete|clientX|onRequest|request|pageYOffset|Single|before|Merge|pp|fullHeight|ActiveXObject|wheelDelta|floor|wheelStops|onStateChange|beforeunload|iParsed|direction|getTime|Scroller|overflow|addClass|getCoords|client|constructor|clickedElement|removeClass|detach|clone|onDragStart|build|application|which|useLink|setTimeout|undefined|execScript|getElement|converter|Content|Sortables|normal|sel|contents|getPrevious|keydown|http|prefix|toPosition|rel|filterById|PropertiesIFlag|removeEventListener|half|Left|removeAttribute|filterByClass|filterByAttribute|onBackground|input|resolver|textarea|getFormElements|getHeader|ie6|Scroll|getPos|fullWidth|zoom|onBeforeStart|win|onProgress|distance||timeout|Asset|onSnap|clientY|cloneEvents|cos|autoSave|nodeValue|where|Bottom|idx|elementsProperty|childNodes|relatedTargetGecko|error|defaultView|urlEncoded|toFloat|Tips|createElement|shift|hyphenate|Move|Number|checkAgainst|getLeft|getTop|addSection|www|onShow|fixRelatedTarget|interval|onHide|save|picked|autoCancel|span|textContent|adopt|innerHTML|styleSheet|escapeRegExp|fixStyle|6000|fullOpacity|hsbToRgb|slideIn|slideOut|360|1000|async|Width|getStyles|slice|Top|sin|setOpacity|removeChild|600000|appendText|0px|showDelay|extended||Right|hideDelay|full|button|menu|shiftKey|metaKey|altKey|fromCharCode|frameborder|ctrlKey|attachEvent|detail|srcElement|control|CollectGarbage|readonly|frameBorder|alt|keyCode|111|readOnly|meta|detachEvent|120|rightClick|wheel|pass|some|associate|getRandom|clearChain|chain|DOMElement|execCommand|BackgroundImageCache|transparent|setInterval|embed|boolean|injectInside|times|bindAsEventListener|err|fromElement|iframe|khtml|whitespace|collection|clearTimeout|textnode|nodeName|MooTools|version|clearInterval|Window|taintEnabled|webkit420|getBoxObjectFor|navigator|all|Document|ie7|injectTop|cloneNode|borderStyle|borderColor|htmlFor|borderWidth|getText|getProperties|setAttribute|setText|colspan|colSpan|tabindex|tabIndex|maxlength|accessKey|accesskey|rowspan|rowSpan|removeProperty|attributes|float|styleFloat|cssFloat|toggleClass|createTextNode|replaceWith|replaceChild|zIndex|hasLayout|lastChild|getParent|getAttribute|getFirst|Sibling|getComputedStyle|getPropertyValue|maxLength|overrideMimeType|200|300|responseText|urlencoded|form|cancelBubble|XMLHTTP|charset|responseXML|Connection|Accept|html|ecma|With|Requested|close|setRequestHeader|postBody||utf|makeDraggable|Bounce|Elastic|Quad|618|Back|Circ|acos|Sine|Cubic|Quart|over|drop|emptydrop|leave|makeResizable|Quint|sqrt|java|gi|setHue|setSaturation|setBrightness|invert|pop|onerror|Image|4096|RGB|HSB|hellip|Group|showThisHideOpen|tool|serialize|10000|SmoothScroll|hash|onabort|screen|toGMTString|decodeURIComponent|isFinite|expires|setTime|exec|getResponseHeader|action|Eaeflnr|eval|readystatechange|stylesheet|media|json|JSON|Remote|Request||Expo|Microsoft|substring|XPathResult|UNORDERED_NODE_SNAPSHOT_TYPE|with|starts|ES|namespaceURI|snapshotLength|snapshotItem|checkbox|radio|getElementsByClassName|1999|w3|org|Pow|contextmenu|space|backspace|tab|esc|down|returnValue|enter|dblclick|keypress|submit|reset|blur|focus|keyup|resize|password|filterByTag|toLeft|toRight|Slide|toBottom|toTop|clearTimer|effect|toggle|easeIn|InOut|ease|Out|In|easeOut|easeInOut|500|linear|defer|DOMContentLoaded|protocol|write|offsetTop|https|offsetParent|void|innerWidth|onDomReady||innerHeight|offsetLeft'.split('|'),0,{}))/*
	background.js for mootools v1.1
	by Floor SA (http://www.floor.ch) - MIT-style license
*/

var Background = new Class({
	initialize: function(options){
		this.options = Object.extend({
			headerHeight: 195,
			checkIfLoaded: 1,
			bgContainer: $('bgimage'),
			btnToggle: $('imgbtn'),
			fallObj: $('roundbg'),
			pathToImg: '/data/category/background/',
			//pathToImg: 'index_files/',
			nAction: 'click'
		}, options || {});
		// Test if there is an image to preload then execute the script
		if(this.options.bgContainer.getAttribute('title')) this.doCheck();
	},
	
	doCheck: function(){
		var title = this.options.bgContainer.getAttribute('title');
		if(this.options.checkIfLoaded == 1){
			if(Cookie.get(title) == false){
				this.doPreload(title, true);
			}
			else{
				this.doPreload(title, false);
			}
		}
		else{
			this.doPreload(title, true);
		}
	},
	
	doPreload: function(title, fade){
		if(this.options.checkIfLoaded ==1){
			Cookie.set(title, "true", {duration: false});
		}
		// Preload the image		
		this.preload = new Image();
		this.preload.onload=function(){
			(function(){this.setBackground(fade)}.bind(this)).delay(10)
		}.bind(this);
		this.preload.src = this.options.pathToImg + title;
		return false;
	},
	setBackground: function(fade){
		// Get the background height and substract the header height;
		window.imgH = this.preload.height;
		window.imgH -= this.options.headerHeight;
		// Set opacity and background for bgContainer
		this.options.bgContainer.setStyles({'background' :'url(' + this.options.pathToImg + this.options.bgContainer.getAttribute('title') + ') no-repeat', 'opacity' : 0, 'height': '1000px', 'width':'910px', 'position': 'absolute', 'margin': '0px auto auto -455px', 'left':'50%'});
		// Fade-in
		if(fade==true){
			var x = this.fadeInBg.bind(this.options.bgContainer);
			x();
		} else{
			this.options.bgContainer.setStyle('opacity', 1);
		}
		// Create the link to show background
		this.createBtShowBg();
	},
	
	createBtShowBg: function (){
		var refObj = this.options.fallObj;
		// Test if an image has been loaded
		if(window.imgH >= 1){
			// Define the effect to apply
			fallFx = new Fx.Style(refObj, 'margin-top', {
				duration: 700, 
				transition: Fx.Transitions.quintOut
			});
			// btnToggle show or hide image
			this.options.btnToggle.addEvent(this.options.nAction, function(e){
				var o_height = refObj.getStyle('margin-top').toInt();
				if(o_height == 0 || isNaN(o_height)){
					fallFx.start('0px' ,window.imgH + "px");
				} else{
					fallFx.start(window.imgH + "px",'0px');
				}
			});
		}
	},
	
	// Fade function
	fadeInBg: function() {
		this.effect('opacity',{
			duration: 1000, 
			transition: Fx.Transitions.quartInOut
		}).start(0,1);
	}
});


// Execute the site.start
window.addEvent('domready', function() {
	var background = new Background();
	//$('category20').addClass('s');
	
	}
	
);
/*
	Class: FormCheck
		Performs different tests on forms and indicates errors.
		
	Usage:
		Works with these types of fields :
		- input (text, radio, checkbox)
		- textarea
		- select
		
		You just need to add a specific class to each fields you want to check. 
		For example, if you add the class
			(code)
			validate['required','length[4, -1]','differs[email]','digit']
			(end code)
		the value's field must be set (required) with a minimum length of four chars (4, -1), 
		must differs of the input named email (differs[email]), and must be digit. 
		You can perform check during the datas entry or on the submit action, shows errors as tips or as div after the field, 
		show errors one by one or all together, show a list of all errors at the top of the form, localize error messages, add new regex check, ...
		The layout is design only with css. It can also works with multiple forms on a single html page.
		The class supports now internationalization. To use it, simply specify a new <script> element in your html page, like this : <script type="text/javascript" src="formcheck/lang/fr.js"></script>. N.B. : you must load this script before the formcheck and this method overpass the old way. You can create new languages following existing ones. You can otherwise still specifiy the alerts' strings when you initialize the Class, with options.
	
	Test type:
		You can perform various test on fields by addind them to the validate class. Be careful to *not use space chars*. Here is the list of them.
			
		required - The field becomes required. This is a regex, you can change it with class options.
		alpha - The value is restricted to alphabetic chars. This is a regex, you can change it with class options.
		alphanum - The value is restricted to alphanumeric characters only. This is a regex, you can change it with class options.
		nodigit - The field doesn't accept digit chars. This is a regex, you can change it with class options.
		digit - The value is restricted to digit (no floating point number) chars, you can pass two arguments (f.e. digit[21,65]) to limit the number between them. Use -1 as second argument to not set a maximum.
		number - The value is restricted to number, including floating point number. This is a regex, you can change it with class options.
		email - The value is restricted to valid email. This is a regex, you can change it with class options.
		phone - The value is restricted to phone chars. This is a regex, you can change it with class options.
		url: - The value is restricted to url. This is a regex, you can change it with class options.
		confirm - The value has to be the same as the one passed in argument. f.e. confirm[password].
		differs - The value has to be diferent as the one passed in argument. f.e. differs[user].
		length - The value length is restricted by argument (f.e. length[6,10]). Use -1 as second argument to not set a maximum.
		
	Parameters:
		When you initialize the class with addEvent, you can set some options. If you want to modify regex, you must do it in a hash, like for display or alert. You can also add new regex check method by adding the regex and an alert with the same name.
		
		form_id - The id of the formular. This is required.
		
		tips_class - The class to apply to tipboxes' errors. By default it is 'tipsbox'.
		error_class - The class to apply to fields with error. By default it is 'error_f'.
		display - This is a hash of display settings. in here you can modify :
		showErrors - 0 : onSubmit, 1 : onSubmit & onBlur, by default it is 1.
		errorsLocation - 1 : tips, 2 : before, 3 : after, by default it is 1.
		indicateErrors - 0 : none, 1 : one by one, 2 : all, by default it is 1.
		tipsOffsetX - Horizontal position of the tips box (margin-left), , by default it is 100 (px).
		tipsOffsetY - Vertical position of the tips box (margin-bottom), , by default it is -10 (px).
		listErrorsAtTop - List all errors at the top of the form, , by default it is false.
		scrollToFirst - Smooth scroll the page to first error and focus on it, by default it is true.
		fadeDuration - Transition duration (in ms), by default it is 300.
		
		alerts  - This is a hash of alerts settings. in here you can modify strings to localize or wathever else. %0 and %1 represent the argument.
		
			required: "This field is required.",
			alpha: "This field accepts alphabetic characters only.",
			alphanum: "This field accepts alphanumeric characters only.",
			nodigit: "No digits are accepted.",
			digit: "Please enter a valid integer.",
			digitmin: "The number must be at least %0",
			digitltd: "The value must be between %0 and %1",
			number: "Please enter a valid number.",
			email: "Please enter a valid email.",
			phone: "Please enter a valid phone.",
			url: "Please enter a valid url.",
			confirm: "This field is different from %0",
			differs: "This value must be different of %0",
			length_str: "The length is incorrect, it must be between %0 and %1",
			lengthmax: "The length is incorrect, it must be at max %0",
			lengthmin: "The length is incorrect, it must be at least %0",
			checkbox: "Please check the box",
			radios: "Please select a radio",
			select: "Please choose a value"
		
	Example:
		You can initialize a formcheck (no scroll, custom classes and alert) by adding for example this in your html head this code :
		
		(code)
		<script type="text/javascript">
			window.addEvent('domready', function() {
				var myCheck = new FormCheck('form_id', {
					tips_class : 'tips_box',
					error_class : 'error_field',
					display : {
						scrollToFirst : false
					},
					alerts : {
						required : 'This field is ablolutely required! Please enter a value'
					}
				})
			});
		</script>
		(end code)
	
	About:
		formcheck2.js v.1.2 for mootools v1.1 - 09 / 2007
		
		by Floor SA (http://www.floor.ch) MIT-style license
		
		Created by Luca Pillonel and David Mignot, last modified by Luca Pillonel 09.19.07
	
*/

var FormCheck = new Class({
	options : {
		
		tips_class: 'tipsbox',			//tips error class
		error_class: 'error_f',			//div error class
		
		display : {
			showErrors : 1,				//0 : onSubmit, 1 : onSubmit & onBlur
			errorsLocation : 1,			//1 : tips, 2 : before, 3 : after
			indicateErrors : 1,			//0 :  none, 1 : one, 2 : all
			tipsOffsetX : -37,			//Left position of the tips box (margin-left)
			tipsOffsetY : 0,			//Top position of the tips box (margin-bottom)
			tipsPosition : 'relative',	//If you want to set the tips position with relative or absolute value (page not centered)
			tipsContainer : 'undef',	//Container of fields, to get right positions.
			listErrorsAtTop : false,	//list all errors at the top of the form
			scrollToFirst : true,		//Smooth scroll the page to first error
			fadeDuration : 300			//Transition duration
		},
		
		alerts : {
			required: "This field is required.",
			alpha: "This field accepts alphabetic characters only.",
			alphanum: "This field accepts alphanumeric characters only.",
			nodigit: "No digits are accepted.",
			digit: "Please enter a valid integer.",
			digitmin: "The number must be at least %0",
			digitltd: "The value must be between %0 and %1",
			number: "Please enter a valid number.",
			email: "Please enter a valid email.",
			phone: "Please enter a valid phone.",
			url: "Please enter a valid url.",
			
			confirm: "This field is different from %0",
			differs: "This value must be different of %0",
			length_str: "The length is incorrect, it must be between %0 and %1",
			lengthmax: "The length is incorrect, it must be at max %0",
			lengthmin: "The length is incorrect, it must be at least %0",
			checkbox: "Please check the box",
			radios: "Please select a radio",
			select: "Please choose a value"
		},
		
		regexp : {
			required : /[^.*]/,
			alpha : /^[a-z ._-]+$/i,
			alphanum : /^[a-z0-9 ._-]+$/i,
			digit : /^[-+]?[0-9]+$/,
			nodigit : /^[^0-9]+$/,
			number : /^[-+]?\d*\.?\d+$/,
			email : /^[a-z0-9._%-]+@[a-z0-9.-]+\.[a-z]{2,4}$/i,
			phone : /^[\d\s ().-]+$/
		}
	},
	
	/*,url : /^(http|https|ftp)\:\/\/[a-z0-9\-\.]+\.[a-z]{2,3}(:[a-z0-9]*)?\/?([a-z0-9\-\._\?\,\'\/\\\+&amp;%\$#\=~])*$/i*/
	
	/*
	Constructor: initialize
		Constructor
	
		Add event on formular and perform some stuff, you now, like settings, ...
	*/
	
	initialize : function(form, options) {
		if (this.form = $(form)) {
			this.form.isValid = true;
			this.regex = ['length'];
			this.groups = {};
			this.setOptions(options);
			
			//internalization
			if (typeof(formcheckLanguage) != 'undefined') this.options.alerts = formcheckLanguage;
			
			this.validations = [];
			this.alreadyIndicated = false;
			this.firstError = false;
			
			var regex = new Hash(this.options.regexp);
			regex.each(function(el, key) {
				this.regex.push(key);
			}, this)
	
			this.form.getElements("*[class*=validate]").each(function(el) {
				el.validation = [];
				var classes = el.getProperty("class").split(' ');
				classes.each(function(classX) {
					if(classX.match(/^validate(\[.+\])$/)) {
						var validators = eval(classX.match(/^validate(\[.+\])$/)[1]);
						for(var i = 0; i < validators.length; i++) {
							el.validation.push(validators[i]);
						}
						this._register(el);
					}
				}, this);
			}, this);
			
			this.form.addEvents({
				"submit": this._onSubmit.bind(this)
			});
		}
	},
	
	/*
	Function: _register
		Private method
		
		Add listener on fields
	*/
	_register : function(el) {
		this.validations.push(el);
		el.errors = [];
		if (this._isChildType(el) == false && this.options.display.showErrors == 1) el.addEvent('blur', function() {
			this._manageError(el, 'blur');
		}.bind(this));
	},
	
	/*
	Function: _validate
		Private method
		
		Dispatch check to other methods
	*/
	_validate : function(el) {
			
		el.errors = [];
		el.isOk = true;
		
		//On valide l'element qui n'est pas un radio ni checkbox
		el.validation.each(function(rule) {
			if(this._isChildType(el)) {
				if (this._validateGroup(el) == false) {
					el.isOk = false;
				}
			} else {
				var ruleArgs = [];
				if(rule.match(/^.+\[/)) {
					var ruleMethod = rule.split('[')[0];
					var ruleArgs = eval(rule.match(/^.+(\[.+\])$/)[1].replace(/([A-Z_]+)/i, "'$1'"));
				} else var ruleMethod = rule;
				
				if (this.regex.contains(ruleMethod)) {
					if (this._validateRegex(el, ruleMethod, ruleArgs) == false) {
						el.isOk = false;
					}
				}
				if (ruleMethod == 'confirm') {
					if (this._validateConfirm(el, ruleArgs) == false) {
						el.isOk = false;
					}
				}
				if (ruleMethod == 'differs') {
					if (this._validateDiffers(el, ruleArgs) == false) {
						el.isOk = false;
					}
				}
				if (el.getTag() == "select" || el.type == "checkbox") {
					if (this._simpleValidate(el) == false) {
						el.isOk = false;
					}
				}
			}				
		}, this);
		
		if (el.isOk) return true;
		else return false;
	},
	
	/*
	Function: _simpleValidate
		Private method
		
		Perform simple check for select fields and checkboxes
	*/
	_simpleValidate : function(el) {
		if (el.getTag() == 'select' && (el.value == el.options[0].value)) {
			el.errors.push(this.options.alerts.select);
			return false;
		} else if (el.type == "checkbox" && el.checked == false) {
			el.errors.push(this.options.alerts.checkbox);
			return false;
		}
		return true;
	},
	
	/*
	Function: _validateRegex
		Private method
		
		Perform regex validations
	*/
	_validateRegex : function(el, ruleMethod, ruleArgs) {
		var msg = "";
		if (ruleArgs[1] && ruleMethod == 'length') {
			if (ruleArgs[1] == -1) {
				this.options.regexp.length = new RegExp("^.{"+ ruleArgs[0] +",}$");
				msg = this.options.alerts.lengthmin.replace("%0",ruleArgs[0]);
			} else {
				this.options.regexp.length = new RegExp("^.{"+ ruleArgs[0] +","+ ruleArgs[1] +"}$");
				msg = this.options.alerts.length_str.replace("%0",ruleArgs[0]).replace("%1",ruleArgs[1]);
			}
		} else if (ruleArgs[0]) {
			this.options.regexp.length = new RegExp("^.{0,"+ ruleArgs[0] +"}$");
			msg = this.options.alerts.lengthmax.replace("%0",ruleArgs[0]);
		} else {
			msg = this.options.alerts[ruleMethod];
		}
		if (ruleArgs[1] && ruleMethod == 'digit') {
			var regres = true;
			if (!this.options.regexp.digit.test(el.value)) {
				el.errors.push(this.options.alerts[ruleMethod]);
				regres = false;
			}
			if (ruleArgs[1] == -1) {
				if (el.value >= ruleArgs[0]) var valueres = true; else var valueres = false;
				msg = this.options.alerts.digitmin.replace("%0",ruleArgs[0]);
			} else {
				if (el.value >= ruleArgs[0] && el.value <= ruleArgs[1]) var valueres = true; else var valueres = false;
				msg = this.options.alerts.digitltd.replace("%0",ruleArgs[0]).replace("%1",ruleArgs[1]);
			}
			if (regres == false || valueres == false) {
				el.errors.push(msg);
				return false;
			}
		} else if (this.options.regexp[ruleMethod].test(el.value) == false)  { 
			el.errors.push(msg);
			return false;
		}
		return true;
	},
	
	/*
	Function: _validateConfirm
		Private method
		
		Perform confirm validations
	*/
	_validateConfirm: function(el,ruleArgs) {
		if (el.validation.contains('required') == false) {
			//el.validation.push('required');
		}
		var confirm = ruleArgs[0];
		if(el.value != this.form[confirm].value){
			msg = this.options.alerts.confirm.replace("%0",ruleArgs[0]);
			el.errors.push(msg);
			return false;
		}
		return true;
	},
	
	/*
	Function: _validateDiffers
		Private method
		
		Perform differs validations
	*/
	_validateDiffers: function(el,ruleArgs) {
		var confirm = ruleArgs[0];
		if(el.value == this.form[confirm].value){
			msg = this.options.alerts.differs.replace("%0",ruleArgs[0]);
			el.errors.push(msg);
			return false;
		}
		return true;
	},
	
	/*
	Function: _isChildType
		Private method
		
		Determine if the field is a group of radio or not.
	*/
	_isChildType: function(el) {
		var validators = el.validation;
		var validator;
		if($defined(el.type) && el.type == 'radio') {
			return true;
		} else if(validator = validators.join().match(/group(\[.*\])/)) {
			var group = eval(validator[1]);
			this.groups[group[0]] = this.groups[group[0]] || [];
			this.groups[group[0]][0] = this.groups[group[0]][0] || [];
			this.groups[group[0]][1] = group[1] || this.groups[group[0]][1] || 1;
			this.groups[group[0]][0].push(el);
			el.groupID = group[0];
			return true;
		}
		return false;
	},
	
	/*
	Function: _validateGroup
		Private method
		
		Perform radios validations
	*/
	_validateGroup : function(el) {
		el.errors = [];
		if (el.type == 'radio') {
			var cbCheckeds = false;
			var nlButtonGroup = this.form[el.getProperty("name")];
			if (!nlButtonGroup.length) {
				if (el.checked) {
					cbCheckeds = true;
				}
			}
			else {
				el.group = nlButtonGroup;
				for (var i = 0; i < nlButtonGroup.length; i++) {
					if (nlButtonGroup[i].checked) {
						cbCheckeds = true;
					}
				}
			}
			
			if(cbCheckeds == false) {
				el.errors.push(this.options.alerts.radios);
				return false;
			} else {
				return true;	
			}
		} else if(el.type == 'checkbox') {
			//we get length of checked elements
			var checked = 0;
			this.groups[el.groupID][0].each(function(groupEl){
				if(groupEl.checked) checked++;
			});
			if(checked >= this.groups[el.groupID][1]) {
				return true;
			} else {
				( this.groups[el.groupID][0].length > 1 ) ?
					el.errors.push(this.options.alerts.checkboxes_group.replace('%0', this.groups[el.groupID][1])) :
					el.errors.push(this.options.alerts.checkbox);
				return false;
			}
		// we have unmanaged type
		} else {
			return false;
		}
	},
	
	/*
	Function: _listErrorsAtTop
		Private method
		
		Display errors
	*/
	_listErrorsAtTop : function(obj) {
		if(!this.form.element) {
			 this.form.element = new Element('div', {'id' : 'errorlist', 'class' : this.options.error_class}).injectTop(this.form);
		}
		if ($type(obj) == 'collection') {
			new Element('p').setHTML("<span>" + obj[0].name + " : </span>" + obj[0].errors[0]).injectInside(this.form.element);
		} else {
			if ((obj.validation.contains('required') && obj.errors.length > 0) || (obj.errors.length > 0 && obj.value && obj.validation.contains('required') == false)) {
				obj.errors.each(function(error) {
					new Element('p').setHTML("<span>" + obj.name + " : </span>" + error).injectInside(this.form.element);
				}, this);
			}
		}
	},
	
	/*
	Function: _manageError
		Private method
		
		Manage display of errors boxes
	*/
	_manageError : function(el, method) {
		var isValid = this._validate(el);
		if (((!isValid && el.validation.contains('required')) || (!el.validation.contains('required') && el.value && !isValid))) {
			if(this.options.display.listErrorsAtTop == true && method == 'submit')
				this._listErrorsAtTop(el, method);
			if (this.options.display.indicateErrors == 2 ||this.alreadyIndicated == false || el.name == this.alreadyIndicated.name)
				{
					this._addError(el);
					return false;
				}
		} else if ((isValid || (!el.validation.contains('required') && !el.value)) && el.element) {
			this._removeError(el);
			return true;
		}
		return true;
	},
	
	/*
	Function: _addError
		Private method
		
		Add error message
	*/
	_addError : function(obj) {
		this.alreadyIndicated = obj;
		if(!this.firstError) this.firstError = obj;
		if(!obj.element) {
			if (this.options.display.errorsLocation == 1) {
				if (this.options.display.tipsPosition == 'relative') {
					var marginLeft = this.options.display.tipsOffsetX;
					if (this.options.display.tipsContainer = 'undef')
						var displacement = this.form.getCoordinates().left;
					else
						var displacement = $(this.options.display.tipsContainer).getCoordinates().left;
					var options = {
						'opacity' : 0,
						'position' : 'absolute',
						'margin-left' : obj.getCoordinates().right - displacement + this.options.display.tipsOffsetX
					}
				} else if (this.options.display.tipsPosition == 'absolute') {
					var options = {
						'opacity' : 0,
						'position' : 'absolute',
						'margin-left' : this.options.display.tipsOffsetX,
						'left' : obj.getCoordinates().right,
						'bottom' : obj.getCoordinates().top
					}
				}
					obj.element = new Element('div', {'id' : 'diverror' + obj.name, 'class' : this.options.tips_class, 'styles' : options});
					obj.element.injectInside(this.form);
				
			} else if (this.options.display.errorsLocation == 2){
				obj.element = new Element('div', {'id' : 'diverror' + obj.name, 'class' : this.options.error_class, 'styles' : {'opacity' : 0}});
				obj.element.injectBefore(obj);
			} else if (this.options.display.errorsLocation == 3){
				obj.element = new Element('div', {'id' : 'diverror' + obj.name, 'class' : this.options.error_class, 'styles' : {'opacity' : 0}});
				
				if ($type(obj.group) == 'object' || $type(obj.group) == 'collection')
					obj.element.injectAfter(obj.group[obj.group.length-1]);
				else
					obj.element.injectAfter(obj);
			}
		}						
		if (obj.element) {
			obj.element.empty();
			if (this.options.display.errorsLocation == 1) {
				var errors = [];
				obj.errors.each(function(error) {
					errors.push(new Element('span').setHTML(error));
				});
				var tips = this._makeTips(errors).injectInside(obj.element);
				obj.element.setStyle('top', obj.getCoordinates().top - tips.getCoordinates().height - this.options.display.tipsOffsetY);
			} else {
				obj.errors.each(function(error) {
					new Element('span').setHTML(error).injectInside(obj.element);
				});
			}
			
			if (!window.ie7 && obj.element.getStyle('opacity') == 0)
				new Fx.Styles(obj.element, {'duration' : this.options.display.fadeDuration}).start({'opacity':[1]});
			else
				obj.element.setStyle('opacity', 1);
		}
	},
	
	/*
	Function: _removeError
		Private method
		
		Remove the error display
	*/
	_removeError : function(obj) {
		this.firstError = false;
		this.alreadyIndicated = false;
		obj.errors = [];
		obj.isOK = true;
		if (this.options.display.errorsLocation == 2)
			new Fx.Styles(obj.element, {'duration' : this.options.display.fadeDuration}).start({ 'height':[0] });
		if (!window.ie7) {
			new Fx.Styles(obj.element, {
				'duration' : this.options.display.fadeDuration,
				'onComplete' : function() {
					if (obj.element) {
						obj.element.remove();
						obj.element = false;
					}
				}.bind(this)
			}).start({ 'opacity':[1,0] });
		} else {
			obj.element.remove();
			obj.element = false;
		}
	},
	
	/*
	Function: _focusOnError
		Private method
		
		Create set the focus to the first field with an error if needed
	*/
	_focusOnError : function (obj) {
		if (this.options.display.scrollToFirst && !this.alreadyFocused && this.alreadyIndicated.element && !this.isScrolling) {
			if (this.options.display.errorsLocation == 1) new Fx.Scroll(window, {onComplete : function() {this.isScrolling = false;}.bind(this)}).scrollTo(0,obj.element.getCoordinates().top);
			else if (this.options.display.errorsLocation == 2) new Fx.Scroll(window, {onComplete : function() {this.isScrolling = false;}.bind(this)}).scrollTo(0,obj.getCoordinates().top-30);
			this.isScrolling = true;
			obj.focus();
			this.alreadyFocused = true;
		} else if (this.options.display.scrollToFirst && !this.isScrolling) {
			new Fx.Scroll(window, {onComplete : function() {this.isScrolling = false;}.bind(this)}).scrollTo(0,obj.getCoordinates().top-30);
			this.isScrolling = true;
			obj.focus();
			this.alreadyFocused = true;
		}
	},
	
	/*
	Function: _makeTips
		Private method
		
		Create tips boxes
	*/
	_makeTips : function(txt) {
		var table = new Element('table', {'class' : 'tipsbox'});
			table.cellPadding ='0';
			table.cellSpacing ='0';
			table.border ='0';
			
			var tbody = new Element('tbody').injectInside(table);
				var tr1 = new Element('tr').injectInside(tbody);
					new Element('td', {'class' : 'tipsbox_top_left'}).injectInside(tr1);
					new Element('td', {'class' : 'tipsbox_top'}).injectInside(tr1);
					new Element('td', {'class' : 'tipsbox_top_right'}).injectInside(tr1);
				var tr2 = new Element('tr').injectInside(tbody);
					new Element('td', {'class' : 'tipsbox_left'}).injectInside(tr2);
					var errors = new Element('td', {'class' : 'tipsbox_inner'}).injectInside(tr2);
					txt.each(function(error) {
						error.injectInside(errors);
					});
					new Element('td', {'class' : 'tipsbox_right'}).injectInside(tr2);
				var tr3 = new Element('tr').injectInside(tbody);
					new Element('td', {'class' : 'tipsbox_bottom_left'}).injectInside(tr3);
					new Element('td', {'class' : 'tipsbox_mark'}).injectInside(tr3);
					new Element('td', {'class' : 'tipsbox_bottom_right'}).injectInside(tr3);		
		return table;
	},
	
	/*
	Function: _reinitialize
		Private method		
		
		Reinitialize form before submit check
	*/
	_reinitialize: function() {
		this.validations.each(function(el) {
			if (el.element) {
				el.errors = [];
				el.isOK = true;
				el.element.remove();
				el.element = false;
			}
		});
		if (this.form.element) this.form.element.empty();
		this.alreadyFocused = false;
		this.firstError = false;
		this.alreadyIndicated = false;
		this.form.isValid = true;
	},
	
	/*
	Function: _onSubmit
		Private method		
		
		Perform check on submit action
	*/
	_onSubmit: function(event) {
		this._reinitialize();

		this.validations.each(function(el) {
		
			if(!this._manageError(el,'submit')) this.form.isValid = false;
		}, this);
		if(!this.form.isValid) { 
			new Event(event).stop();
			if (this.firstError) this._focusOnError(this.firstError);
		}
	},
	
	/*
	Function: dispose
		Allows you to remove a declared field from formCheck
	*/
	dispose : function(element) {
		this.validations.remove(element);
	},
	
	
	/* En plus maybe inutile */
	register : function(el, position) {
		el.validation = [];
		el.getProperty("class").split(' ').each(function(classX) {
			if(classX.match(/^validate(\[.+\])$/)) {
				var valid = true;
				//we check if group is already registered
				if (el.type == "radio") {
					this.validations.each(function(valider){
						if (valider.name == el.name) valid = false;
					}, this)
				}
				var validators = eval(classX.match(/^validate(\[.+\])$/)[1]);
				for(var i = 0; i < validators.length; i++) {
					el.validation.push(validators[i]);
					if (validators[i].match(/^confirm\[/)) {
						var field = eval(validators[i].match(/^.+(\[.+\])$/)[1].replace(/([A-Z0-9\._-]+)/i, "'$1'"));
						if (this.form[field].validation.contains('required')){
							el.validation.push('required');
						}							
					}
					if(validators[i].match(/^target:.+/)) {
						el.target = validators[i].match(/^target:(.+)/)[1];
					}
				}
				//new push way
				if (position && position <= this.validations.length) {
					var newValidations = [];
					this.validations.each(function(valider, i){
						if (position == i+1 && valid) {
							newValidations.push(el);
							this.addListener(el);
						}
						newValidations.push(valider);
					}, this);
					this.validations = newValidations;
				} else {
					if (valid) {
						this.validations.push(el);
						this.addListener(el);
					}
				}
			}
		}, this);
	},
	
	addListener : function(el) {
		el.errors = [];
		
		if (this.options.display.indicateErrorsInit) {
			this.validations.each(function(el) {
				if(!this._manageError(el,'submit')) this.form.isValid = false;
			}, this);
			return true;
		} 
	
		if (el.validation[0] == 'submit') {
			el.addEvent('click', function(e){
				if (this.onSubmit(e)) this.form.submit();
			}.bind(this));
			return true;
		}

		if (this._isChildType(el) == false) el.addEvent('blur', function() {
			(function(){
				if(!this.fxRunning && (el.element || this.options.display.showErrors == 1) && (this.options.display.checkValueIfEmpty || el.value))
				this._manageError(el, 'blur')
			}.bind(this)).delay(100);
		}.bind(this))
		//We manage errors on radio
		else if (this._isChildType(el) == true) {
			//We get all radio from the same group and add a blur option
			var nlButtonGroup = this.form.getElements('input[name="'+ el.getProperty("name") +'"]');
			nlButtonGroup.each(function(radio){
				radio.addEvent('blur', function(){
					(function(){
						if((el.element || this.options.display.showErrors == 1) && (this.options.display.checkValueIfEmpty || el.value)) this._manageError(el, 'click');
					}.bind(this)).delay(100);
				}.bind(this))
			},this);
		}
	}
});
FormCheck.implement(new Options());/*
	Class: loader for Floor CS2
		
	Usage:
		
		
	Parameters:
		- 
		
	Exemple:
	
	About:
		Loader.js v.1.0 for mootools v1.1 05 / 2008
		
		by Floor SA (http://www.floor.ch) MIT-style license

*/
var Loader = new Class({
	
	options : {
		'Tag' : 'div',
		'Class' : 'loader',
		'Style' : {
			'position': 'absolute',
			'top': 0,
			'left': 0,
			'display': 'none',
			'z-index': 10000
		}
 	},
    /*
	Constructor: initialize
		Constructor	
	*/
	initialize: function(options)	{

		this.setOptions(options);

		this.loaders = {
			'active': {},
			'el': {}
		};
	},
	/*
	load: 
		put or remove a loader on an element	
	*/
	load: function(el,where)	{
		var elid = $(el).id;
		if (this.loaders.el[elid])
			this._hide(elid);
		else
			this._show(elid, where);
	},
	/*
	_getLoader:
		returns id of a free loader
	 */
	_getLoader: function()	{
		var id = '';
		for (var key in this.loaders.active)	{
			if (this.loaders.active[key] == false) {
				id = key;
				break;
			}
		}
		if (id != '' && id != undefined)
			return id;
		else
			return this._create();
	},
	/*
	_create: 
		creates a loader and registers it	
	*/
	_create: function()	{
		var id = Math.random().toString().substr(2,8);
		while ($(id))	{
			id = Math.random().toString().substr(2,8);
		}
		var newload = new Element(this.options.Tag,{
			'id': id,
			'class': this.options.Class,
			'styles': this.options.Style
		});
		var body = $$('body')[0];
		newload.inject(body);
		return id;
	},
	/*
	_show: 
		shows a loader on top of an element
	*/
	_show: function(elid,where)	{
		var loaderid = this._getLoader();
		var loader = $(loaderid);
		var pos = $(elid).getCoordinates();
		var parent_width = $(elid).getStyle('width').toInt();
		var loader_width = $(loaderid).getStyle('width').toInt();
		
		if (where == 'left') {
			loader.setStyles({
				'top': pos.top,
				'left': pos.left-20,
				'display': 'block'
			});
		} else if ('center'){			
			loader.setStyles({
				'top': pos.top  + pos.height/2,
				'left': pos.left + (parent_width/2) - (loader_width/2),
				'display': 'block'
			});
		}
		else {
			loader.setStyles({
				'top': pos.top,
				'left': pos.left+20,
				'display': 'block'
			});
		}
		
		this.loaders.el[elid] = loaderid;
		this.loaders.active[loaderid] = true;
	},
	
	/*
	_hide:
		hides the loader
	*/
	_hide: function(elid)	{
		$(this.loaders.el[elid]).setStyle('display','none');
		this.loaders.active[this.loaders.el[elid]] = false;
		this.loaders.el[elid] = '';
	}
});

Loader.implement(new Options());
var AutoShow = new Class({

	options : {
		autohide : false
	},

	initialize : function(options){
		this.setOptions(options);
		this.load();
	},

	load : function(){
		//parse show elements
		$$("*[class*=show]").each(function(el) {
			this.register(el, true);
			this.autohide(el);
			this.setBehavior(el, true);
		}, this);
		
		//parse hide elements
		$$("*[class*=hide]").each(function(el) {
			this.register(el, false);
			this.setBehavior(el, false);
		}, this);
	},

	register : function(el, enabler){
		if (enabler) {
			var parsedShow = [];
			//get target elements defined in class name
			el.getProperty("class").split(' ').each(function(classX) {
				if(classX.match(/^show(\[.+\])$/)) {
					var elements = eval(classX.match(/^show(\[.+\])$/)[1]);
					for(var i = 0; i < elements.length; i++) {					
						parsedShow.merge($$('.'+elements[i]));
					}
				}
			}, this);
			el.showElements = parsedShow;
			
			//save display method
			parsedShow.each(function(element){
				if (element.getStyle('display') == 'none') {
					//get style depending element type
					if (['span', 'p'].contains(element.getTag())) {
						var display = 'inline';
					} else if (['div', 'ul', 'fieldset'].contains(element.getTag())) {
						var display = 'block';
					} else if (element.getTag() == 'tr') {
						var display = Browser.Engine.trident ? 'block' : 'table-row';
					}
				} else {
					var display = element.getStyle('display');
				}

				element.displayElements = display;
			});
		} else {
			var parsedHide = [];
			//get target elements defined in class name
			el.getProperty("class").split(' ').each(function(classX) {
				if(classX.match(/^hide(\[.+\])$/)) {
					var elements = eval(classX.match(/^hide(\[.+\])$/)[1]);
					for(var i = 0; i < elements.length; i++) {
						parsedHide.merge($$('.'+elements[i]));
					}
				}
			}, this);
			el.hideElements = parsedHide;
		}
	},

	autohide : function(el){
		if (this.options.autohide) {
			el.showElements.each(function(element){
				
				if (el.type == 'checkbox' && el.checked) return;
				if (el.type == 'radio' && el.checked) return;
				
				element.setStyle('display', 'none');				
			},this);
		}
	},

	setBehavior : function(el, enabler){
		var elements = enabler ? 'showElements' : 'hideElements';
		
		if (enabler) {
			//determine element type to set right event
			if (el.type == 'checkbox' || el.type == 'radio') {
				el.addEvents({
					'click' : function(){
						el.blur();
					},
					'change' : function(){
						if (!el.checked) {
							el[elements].each(function(element){
								element.setStyle('display', 'none');
							}.bind(this));
						} else {
							el[elements].each(function(element){
								this.setRequired(element, 'register');
								element.setStyle('display', element.displayElements);
							}.bind(this));
						}
					}.bind(this)
				});
			}
		} else {
			el.addEvents({
				'click' : function(){
					el.blur();
				},
				'change' : function(){
					el[elements].each(function(element){
							this.setRequired(element, 'dispose');
							element.setStyle('display', 'none');
						}.bind(this));
				}.bind(this)
			});
		}
	},
	
	setRequired : function(el, act) {
		el.getElements("*[class*=validate]").each(function(elo) {
			if (act == 'register') { 
				//fschoolcheck._register(elo);
				fschoolcheck.register(elo, elo.getProperty('rel'));
			} 
				else { fschoolcheck.dispose(elo); }
		}, this);
	}
});

AutoShow.implement(new Options());

window.addEvent('domready', function(){
	new AutoShow();
})/******** resize popup ********/
function resizeOuterTo(w,h) {
 if (parseInt(navigator.appVersion)>3) {
   if (navigator.appName=="Netscape") {
    top.outerWidth=w;
    top.outerHeight=h;
   }
   else top.resizeTo(w,h);
 }
}

/********* favoris *************/
function favoris(url,text) {
	if (window.sidebar) { window.sidebar.addPanel(text, url,""); }
	else if( document.all ) { window.external.AddFavorite(url,text); } 
}

//verifie si la chaine envoyee est de type numerique
function IsNumeric(sText)
{
	var ValidChars = "0123456789.";
	var IsNumber=true;
	var Char;
	
	if (sText!="") {
		for (i = 0; i < sText.length && IsNumber == true; i++)
		{
			Char = sText.charAt(i);
			if (ValidChars.indexOf(Char) == -1){ IsNumber = false; }
		}
	} else { IsNumber = false;}

	return IsNumber;
}

// fonction next/prev step pour formulaires


function nextpage(idpage) {
	if (idpage=="page1") { 
		document.getElementById('page1').style.display = 'none'; 
		document.getElementById('page2').style.display = 'block'; 
		document.getElementById('step2').src = '/images/buttonnumber/bt2h.png';
		document.getElementById('step1').src = '/images/buttonnumber/bt1.png';
		
	}
	else { 
		document.getElementById('page2').style.display = 'none'; 
		document.getElementById('page3').style.display = 'block'; 
		document.getElementById('step3').src = '/images/buttonnumber/bt3h.png';
		document.getElementById('step2').src = '/images/buttonnumber/bt2.png';
	}
}

function backpage(idpage) {
	if (idpage=="page2") { 
	document.getElementById('page2').style.display = 'none'; 
	document.getElementById('page1').style.display = 'block';
	document.getElementById('step2').src = '/images/buttonnumber/bt2.png';
	document.getElementById('step1').src = '/images/buttonnumber/bt1h.png';

	}
	else { 
	document.getElementById('page3').style.display = 'none'; 
	document.getElementById('page2').style.display = 'block'; 
	document.getElementById('step3').src = '/images/buttonnumber/bt3.png';
	document.getElementById('step2').src = '/images/buttonnumber/bt2h.png';
	}
}


/***** display div *****/

function showdiv(idlayer) {
	
	var idblock;
	var idImg;
	var pathImg='/data/content/';
	var itemClass= getElementsByClassName(document, "*", "layer");
	var heightdiv

	for ( var i=0; i<itemClass.length; i++ )
  {
			idblock = document.getElementById(itemClass[i].id);
			idImg = itemClass[i].id.substring(6);
			
			if ( itemClass[i].id == 'layer_'+idlayer && idblock.style.display == 'block') // close div
      {
				document.getElementById(itemClass[i].id).style.display = 'none';
				document.getElementById('imgreasons_' + idImg).src = pathImg + 'image/' + idImg + '.png';
				document.getElementById('reasons').style.height = '' + 100 +'px';
			}
			else if ( itemClass[i].id != 'layer_'+idlayer) {                             //close all div
				document.getElementById(itemClass[i].id).style.display = 'none';
				document.getElementById('imgreasons_' + idImg).src = pathImg + 'image/' + idImg + '.png';
			}
			else if ( itemClass[i].id == 'layer_'+idlayer) {                            //open div
				document.getElementById('layer_'+idlayer).style.display = 'block';
				document.getElementById('imgreasons_'+idlayer).src = pathImg + 'image_s/' + idlayer + '.png';
				heightdiv=100 + document.getElementById('layer_'+idlayer).clientHeight;
				document.getElementById('reasons').style.height = heightdiv + 'px';
			}
	 }
}

/*
	Written by Jonathan Snook, http://www.snook.ca/jonathan
	Add-ons by Robert Nyman, http://www.robertnyman.com
*/

function getElementsByClassName(oElm, strTagName, strClassName){
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	strClassName = strClassName.replace(/-/g, "\-");
	var oRegExp = new RegExp("(^|\s)" + strClassName + "(\s|$)");
	var oElement;
	for(var i=0; i<arrElements.length; i++){
		oElement = arrElements[i];
		if(oRegExp.test(oElement.className)){
			arrReturnElements.push(oElement);
		}
	}
	return (arrReturnElements)
}


function transparencyPng(){
	if(navigator.userAgent.toLowerCase().indexOf('msie')>0){ // detect for IE (could be more specific to PC and version, but this works for the test)
		is = document.getElementsByTagName('IMG'); // get all images
		for(x=0; x<is.length; x++){ // cycle through those images
			if(is[x].src.indexOf('.png') >= 0){ // only do this to png files
				w = is[x].offsetWidth;
				h = is[x].offsetHeight

				is[x].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+is[x].src+"')"; // apply the filter stuff that makes IE do it's magic
								is[x].width = w;
				is[x].height = h;
				is[x].src = "/images/z.gif";
			}
		}
	}
}

//
function alignImg(){
	wrapper_left = $('innerwrapper').getCoordinates().left;
	$('imgbtn').setStyle('left',$('mainmenuInfos').getFirst().getLast().getCoordinates().left-wrapper_left+3);
}


function topOfPage(el){
	el.addEvent('click', function(e) {
		var e = new Event(e);
		e.stop();
		
		new Fx.Scroll(window).scrollTo(0,0);
	});
}

// 
window.addEvent('domready', function() {
	if ($('go_to_top')) topOfPage($('go_to_top'));
	alignImg();
});
/*
	Class: 
		
		
	Usage:
		
		
	Parameters:
		
		
	Exemple:
	
	About:
		Profil.js v.1.0 for mootools v1.1 05 / 2007
		
		by Floor SA (http://www.floor.ch) MIT-style license
		
		last modified by Denis Schneiter 
*/
var Reasons = new Class({
	options : {
		'img_class' : 'img_reasons',
		'path_img' : '/data/content/'
	},
	
    /*
	Constructor: initialize
		Constructor
	
		-
	*/
	initialize : function(options) {
		this.setOptions(options)
		this._initReasons();
	},
	/*
	Function: _
		Internal method
		
		Parameters:
			
	*/
	_initReasons : function() {
		
		this.div_reasons = $('reasons');
			
		$ES('.' + this.options.img_class, this.div_reasons).each(function(el){

			el.setStyle('cursor', 'pointer');
			
			var current_reason = el.getProperty('title');
			
			if (!this.default_reason) { this.default_reason = current_reason ; }	
			
			el.getParent().addEvent('click', function(){
				if (this.opened_reason) { this._closeReasons(this.opened_reason, current_reason);  }
			
				if (!this.opened_reason) { this.opened_reason = '1'; }
				
				if (this.opened_reason != '0') {
					this._openReasons(current_reason);
				}

			}.bind(this));	
		}, this);
		
		this._openReasons(this.default_reason);	
				
	},
	/*
	Function: _
		Internal method
		
		Parameters:
			
	*/
	_openReasons : function(idlayer) {
		if (idlayer == this.opened_reason) { return; }
		
		$('layer_'+idlayer).setStyle('visibility','hidden');
		
		$('layer_'+idlayer).setStyle('display','block');
	
		$('imgreasons_'+idlayer).setProperty('src',  this.options.path_img + 'image_s/' + idlayer + '.png');
		var heightdiv=100 + $('layer_'+idlayer).clientHeight;
		$('reasons').setStyle('height',heightdiv + 'px');
		$('layer_'+idlayer).setStyle('visibility','visible');
		
		this.opened_reason = idlayer;
				
	},
	/*
	Function: _
		Internal method
		
		Parameters:
			
	*/
	_closeReasons : function(idlayer, current_layer) {
		
		if (idlayer == '0') { 
			this.opened_reason = '1';
			return ;
		}
		
		$('layer_'+idlayer).setStyle('display','none');
		$('imgreasons_' + idlayer).setProperty('src', this.options.path_img + 'image/' + idlayer + '.png');
		
		if (idlayer == current_layer) {
			$('reasons').setStyle('height','100px');
			this.opened_reason = '0';
		}
	}
});

Reasons.implement(new Options, new Events);

// Initialize classes
window.addEvent('domready', function() {
	if ($('reasons')) new Reasons();
});var ToogleList = new Class({
    /*
	Constructor: initialize
		Constructor
	
		-
	*/
	initialize: function(target) {
		
		if ($$('.MGroupContent').length != 0) {		
			this._initToogle();				
		}
	},
	/*
	Function: _
		Internal method
		
		Parameters:
			
	*/
	_initToogle : function(idlayer, current_layer) {
		
		$$('.MGroupContent').setStyle('display', 'block');
		
		var selected = $('MSelected');
		
		var current = (selected) ? selected.getParent() : false;
	
		$$('div.MGroup').each(function(div){
			var link = div.getElement('a');
			var block = link.getNext();
			
			var fx = new Fx.Slide(block);
			
			if (block != current) fx.hide();
	
			link.addEvent('click', function(){
				fx.toggle();
			});
			
		});
	}
}); 

window.addEvent('domready',function() {
	var tooglelist = new ToogleList();
});/*
Script: qq.js
		Quickquote v2 managed by this script.

License:
        MIT-style license.

About:
		qq.js for mootools framework <http://www.mootools.net/> (c) 2007 Valerio Proietti, MIT-style license.
		Class created by sb, <http://www.floor.ch/>.
		Last modification, 07 january 2008.
		
Version: 1.0

Note:
		XHTML doctype is required.
		
*/

var QuickQuote = new Class({
	
	options: {
		'ID' : '',
		'CID' : '',
		'lang' : 'fr',
		'year' : '2009',
		'sectionId' : '1',
		'level' : '',
		'course' : '',
		'course2' : '',
		'length' : 0,
		'length2' : 0,
		'date' : '',
		'accom' : '',
		'accomlength' : 0,
		'currency' : '',
		'close_box' : 0,					// Choose the close method 0 for a Slydeout effect / 1 for a simple display:none 
		'ident_contact' : 'qqcontact',
		'ident_print'	: 'qqprint',
		'formID'		: 'qqformular',		
		'hits' : {
			'path' 		: '/cgi/hits_implement.cgi',
			'type'		: 'school'
		},
		'dico' : {
			'combine' 	: 'The length of your first course has been changed to combine with your second course',
			'startdate'	: 'There\'s a problem with the startdate of your second course. Please contact ESL for further information',
			'noresult'	: 'no result'
		}
	},
		
	// called upon creating a class-instance 
	initialize: function(options)	{
	this.setOptions(options);
		
		if (!this.options.sectionId) this.options.sectionId = 1;
		
		//Init qqDictionary
		if (typeof(qqLanguage) != 'undefined') this.options.dico = $merge(this.options.dico, qqLanguage);
		
		this.initBtn();
		this.initAddCourse();
		this.loader = new Loader();
		this.initYear();
		this.initSchool();
		this.initLevels();
		this.initSupplements('supplements','supplements');
		this.initSupplements('supplnoorder','auxsupplements');
  //Disabled for esl-schools
		//this.initIncluded('included','included');		

	},
	
	// initialize the button to display course 2
	initAddCourse: function(){
		$('addcourse').addEvent('click', function(){
			if($('coursesupp').getStyle('display') != 'block') $('coursesupp').setStyle('display','block');
			else $('coursesupp').setStyle('display','none');
		});
	},
	
	// gets some info about the school
	initSchool: function()	{
		var pars = 'action=getSchoolOfferInfo&item_ID='+this.options.ID+'&CID_school='+this.options.CID;
		
		var success = function(request)	{
			if (!request) 
			return;
			
			var info = request.split('\n');
			$('schoolname').innerHTML = info[0];
			$('schoolNameForm').setProperty('value',info[0]);
			
			$('cityname').innerHTML = info[1];
			$('cityNameForm').setProperty('value',info[1]);
			
			$('countryname').innerHTML = info[2];
			$('countryNameForm').setProperty('value',info[2]);
		}
		
		this._request(pars,success,'','eslagency');
	},

	// init the year box if is a published page
	initYear: function()	{
		this._hideCombos(0);
		var pars = 'action=getSchoolOfferYears&item_ID='+this.options.ID;
				
		var success = function(request)	{			
			this._updateCombo(request,'year',0);
			this.loader.load($('year'));
		}.bind(this);
				
		this.loader.load($('year'),'left');
		this._request(pars,success);
	},
	
	// changes the actual year
	changeYear: function(newyear)	{
		this.options.year = newyear;
		this.initLevels();
		this.initSupplements('supplements','supplements');
		this.initSupplements('supplnoorder','auxsupplements');
		this.initIncluded('included','included');
	},
	
	// gets the available levels and fills up the combo 
	initLevels: function()	{
		this._hideCombos(1);
		var pars = 'action=getSchoolOfferLevels&item_ID='+this.options.ID+'&list=level';
		
		var success = function(request)	{
			this._updateCombo(request,'level',1);
			this.loader.load($('level'));
		}.bind(this);
		
		this.loader.load($('level'),'left');
		this._request(pars,success);
	},
	
	// gets the available related-elements according to vars and fills up the combo
	initElements: function(group,combo)	{
		var pars = 'action=getSchoolOfferElements';
		
		if (group == 'courses')	{
			this._hideCombos(2);
			pars += '&item_ID='+this.options.ID+'&ID_level='+this.options.level;
		}
		else if (group == 'courses2')	{
			this._hideCombos(2);
			pars += '&item_ID='+this.options.ID;
			group = 'courses';
		}
		else	{
			this._hideCombos(5);
			pars += '&item_ID='+this.options.course+'&ElementOption=attach';
		}
		
		pars += '&list=elements&ElementGroup='+group+'&length='+(this.options.length+this.options.length2);
		
		var success = function(request)	{
			this._updateCombo(request,combo,1);
			if(combo == 'course2'){
				if($('coursesupp').getStyle('display')=='block') this.loader.load($(combo),'left');
			}else this.loader.load($(combo),'left');
		}.bind(this);
		
		if(combo == 'course2'){
			if($('coursesupp').getStyle('display')=='block') this.loader.load($(combo),'left');
		}else this.loader.load($(combo),'left');
		
		this._request(pars,success);
	},
	
	// gets the supplements for the given element (school)
	initSupplements: function(list,el)	{
		var pars = 'action=getSchoolOfferElements&item_ID='+this.options.ID+'&list='+list+'&ElementGroup=supplements';
		this._request(pars,'',$(el));
	},
	
	// gets the included for the given element (school)
	initIncluded: function(list,el)	{
		var pars = 'action=getSchoolOfferElements&item_ID='+this.options.ID+'&list='+list+'&ElementGroup=included';
		this._request(pars,'',$(el));
	},
	
	// gets the lengths possible for this course
	initLengths: function(combo,option)	{
		var pars = 'action=getSchoolOfferLengths&list=length';
		
		this.loader.load($(combo),'left');
		
		if (option == 'second')	{
			$(combo).disabled = true;
			$(combo).length = 1;
			this.options[combo] = ''
			pars += '&item_ID='+this.options.course2;
		}
		else	{
			this._hideCombos(3);
			pars += '&item_ID='+this.options.course;
		}
		
		var success = function(request)	{
			this._updateCombo(request,combo,1);
			this.loader.load($(combo),'left');
		}.bind(this);
		
		this._request(pars,success);
	},
	
	// gets the lengths possible for this accommodation
	initAccomLengths: function(lbl)	{
		$('accomlength').disabled = true;
		var courselength = parseInt(this.options.length);
		if (parseInt(this.options.length2))
			courselength += parseInt(this.options.length2);
		if (!courselength)
			courselength = 1;
		
		if ($('length').options[$('length').selectedIndex].text.match(/\+.*?/))	{
			var extralength = parseInt($('length').options[$('length').selectedIndex].text.replace(/.*?\+/,''));
			if (extralength)
				courselength += extralength;
		}
		if ($('length2') && $('length2').options[$('length2').selectedIndex].text.match(/\+.*?/))	{
			var extralength = parseInt($('length2').options[$('length2').selectedIndex].text.replace(/.*?\+/,''));
			if (extralength)
				courselength += extralength;
		}
		
		var accomlengths = '';
		var initc = 2;
		if (courselength == 1)	initc = 1;
		for (var c=initc; c<=courselength; c++)	{
			accomlengths += c+'::'+c+' '+lbl+'\n';
		}
		this._updateCombo(accomlengths,'accomlength',1);
	},
	
	// gets the available startdates
	initDates: function()	{
		this._hideCombos(4);
		var pars = 'action=getSchoolOfferDates&item_ID='+this.options.ID+'&ID_course='+this.options.course+'&ID_level='+this.options.level+'&length='+this.options.length+'&list=date';
		
		var success = function(request)	{
			this._updateDates(request,'startdate');
			this.loader.load($('startdate'),'left');
		}.bind(this);
		
		this.loader.load($('startdate'),'left');
		this._request(pars,success);
	},
	
	// controls the startdate for the second course
	checkStartdateForCourse2: function()	{
		if (!this.options.length || !this.options.length2 || !this.options.date)
			return;
		
		var pars = 'action=checkSchoolOfferStartdate&item_ID='+this.options.ID+'&ID_course='+this.options.course2+'&length='+this.options.length+'&length2='+this.options.length2+'&startdate='+this.options.date+'&list=date';
		
		var success = function(request)	{
			if (!request) 
                                return;
			var result = request.split('/');
			var newselect = false;
			if (result[0] != '1' && result[1] != '0')	{
				for (var c=0; c<$('length').length; c++)	{
					if ($('length').options[c].value == result[1])	{
						$('length').options[c].selected = true;
						this.options.length = result[1];
						newselect = true;
						this._showMessage(this.options.dico.combine);
						break;
					}
				}
			}
			if (newselect == false && result[0] != '1')	{
				this._showMessage(this.options.dico.startdate);
			}
		}.bind(this);
		
		this._request(pars,success);
	},	
	
	// calculates the price for the given choice
	calculate: function()	{
		
		this.incrHits({ 'label': 'QQSchoolshits', 'sendform': '0' });
		$('qqresult').setStyle('display', 'block');
		$('price').setStyle('display','block');
		
		//$('qqresult').highlight('#e5e5e5');
		var myFx = new Fx.Scroll(window).toElement($('qqresult'));
		
		var suppls = this._getCBValues('supplements');
		var pars = 'action=getSchoolOfferPrice&item_ID='+this.options.ID+'&ID_course='+this.options.course+'&ID_course2='+this.options.course2+'&ID_accom='+this.options.accom+'&list=result&length='+this.options.length+'&length2='+this.options.length2+'&accomlength='+this.options.accomlength+'&startdate='+this.options.date+'&currency='+this.options.currency+'&IDs_suppl='+suppls;
		$('blockbtn').setStyle('display','block');
		$('blockbtn').getElements('input').each(function(el){
			el.setStyle('visibility','visible').addEvent('click', 
				function(e) {
					new Event(e).stop();	
				}); 		
		});

		this._request(pars,'',$('offerprice'));
	},
	
	// ------------------------------------------------------------------
	// Private functions
	
	// does all ajax-requests 
	_request: function(pars,success,update,srv)	{
		if(!srv){
   var server = 'eslschools';
   var lang = this.options.lang;
  }else{
   var server = srv;
   var lang = this.options.dico.language;
  }
		pars = 'server='+server+'&lang='+lang+'&'+pars+'&UsedYear='+this.options.year+'&datatype=school&ID_section='+this.options.sectionId+'&ajaxrequest=1&randomnumber='+Math.random();
		var url = window.location.protocol + "//" + window.location.hostname + window.location.pathname;
		var options = {
			method: 'post',
			data: pars, 
			// Handle other errors
			onFailure: function(request) {
				alert('Error -- ' + request);
			}
		}
		
		if (success != '') {
			options['onSuccess'] = function(request) { success(request); };
		} else if (update)	{
			$(update).innerHTML = '';
			this.loader.load($(update));
			//options['update'] = update;
			options['onSuccess'] = function(request) { 
				// Check if the request is empty and hide the box
				if (!request) {
					$(update).innerHTML = "<span class='qqlabel'>"+this.options.dico.empty+"</span>";
				} else {
					$(update).innerHTML = request;
				}
				
				this.loader.load($(update)); 
			}.bind(this)
		}
		
		var myAjax = new Ajax(url, options).request();
	},
	
	// updates a combo with the given values
	_updateCombo: function(request,combo,combo_length)	{
		if (!$(combo))
			return;
		
		$(combo).length = combo_length;

		if (!request) {
			if ($(combo).getParent().getElements('em').length <= 0) {
				new Element('em').set('text', this.options.dico.noresult).injectAfter($(combo));
			}
			return;
		}
		var res = request.split('\n');
		var c;
		for (c=0; c<res.length; c++)	{
			if (res[c] == '') continue;
			var pair = res[c].split('::');
			$(combo).options[$(combo).length] = new Option(pair[1], pair[0], false, false);

			if (combo == 'year' && pair[0] == this.options.year) {				
				$(combo).options[$(combo).length -1].selected = 'selected'; // for IE
				//$(combo).options[$(combo).length -1].setProperty('selected','selected');
			}
		}
		
		if ($('coursesinfo').getElements('em').length > 0 && combo !='length2') {
			$('coursesinfo').getElements('em').each(function(msg){
				msg.destroy();
			});
		}
		
		$(combo).disabled = false;
	},
	
	// hides the combos according to the step
	_hideCombos: function(step)	{
		var combos = new Array('year','level','course,course2','length','startdate','accom','accomlength');
		
		for (var c=step; c<combos.length; c++)	{
			var coms = combos[c].split(',');
			for (var i=0; i<coms.length; i++)	{
				$(coms[i]).disabled = true;
				$(coms[i]).length = 1;
				if (step != 0)
					this.options[coms[i]] = '';
			}
		}
		
		if (step == 0 || step == 1 || step == 2)	{
			$('length2').disabled = true;
			$('length2').length = 1;
			this.options.length2 = '';
		}
		if (step <= 4)
			$('docalc').disabled = true;
	},
	
	// splits up the datestring according to levels and lengths and feeds then updateCombo with 
	// the correct values
	_updateDates: function(request,combo)	{
		var result = this._getWorkingDatestr(request,this.options.level,this.options.length);
		this._updateCombo(result,combo,1);
	},
	
	// splits up the datestring into an array
	_getWorkingDatestr: function(datestr,level,length)	{
		var result = new Array(new Array, new Array);
		if (!datestr)
			return '';
		var res = datestr.split('\n');
		for (var c=0; c<res.length; c++)	{
			if (res[c] == '') continue;
			var vals = res[c].split('::');
			if (vals[0] == '') vals[0] = 0;
			if (vals[1] == '') vals[1] = 0;
			if (!result[vals[0]]) result[vals[0]] = new Array;
			if (!result[vals[0]][vals[1]]) result[vals[0]][vals[1]] = '';
			result[vals[0]][vals[1]] += vals[2]+'::'+vals[3]+'\n';
		}
		if (result[level] && result[level][length])
			return result[level][length];
		else if (result[level] && result[level][0])
			return result[level][0];
		else if (result[0][length])
			return result[0][length];
		else
			return result[0][0];
	},
	
	// gets the values of the checked checkboxes inside the given element
	_getCBValues: function(el)	{
		var idstr = '';
		var suppls = $(el).getElementsByTagName('input');
		
		for(var c=0; c<suppls.length; c++)	{
			if (suppls[c].type == 'checkbox' && suppls[c].checked == true)	{
				if (idstr)	idstr += ',';
				idstr += suppls[c].value;
			}
		}
		return idstr;
	},
	
	_showMessage: function(msg)	{
		$('infomsg').innerHTML = msg;
	},
	
	initBtn : function() {
		$('btncontact').addEvent('click', function() { 
			this.pushQQResult();						
			$('category_ident').setProperty('value', this.options.ident_contact);
			$(this.options.formID).setProperty('target','');
			this.incrHits({ 'label': 'QQSchoolscontacthits', 'sendform': '1' });
		}.bind(this));
		
		$('btncontactme').addEvent('click', function() { 
			this.pushQQResult();						
			$('category_ident').setProperty('value', this.options.ident_contact);
			$(this.options.formID).setProperty('target','');
			this.incrHits({ 'label': 'QQSchoolscontacthits', 'sendform': '1' });
		}.bind(this)); 
		
		$('btnprint').addEvent('click', function() { 
			this.pushQQResult();
			$('category_ident').setProperty('value', this.options.ident_print);
			this.incrHits({ 'label': 'QQSchoolsprinthits', 'sendform': '0' });
			$(this.options.formID).setProperty('target','_blank').submit();	
		}.bind(this)); 
	},
	
	incrHits : function(data) {		
		if (this.options.IID == '') { return ''; }
		var name = $('schoolname').innerHTML +' - '+ $('cityname').innerHTML;
		var param = 'lang='+this.options.lang+"&iID="+this.options.ID+"&schoolyear="+this.options.year+"&name="+name+"&type="+this.options.hits.type+'&label='+data.label;
		var myRequest = new Ajax(this.options.hits.path, {
			method: 'post',
			data : param, 
			onComplete: function() {
				if (data.sendform == '1') {
					$(this.options.formID).submit();	
				}
			}.bind(this)
		}).request();
	},
	
	pushQQResult : function() {
		// put qq value into hidden field (use for qqcontact & qqprint)
		$('levelName').setProperty('value',$('level').options[$('level').selectedIndex].innerHTML);
		$('divprice').setProperty('value',$('offerprice').innerHTML.replace(/"/g,"'"));
		$('divincluded').setProperty('value',$('included').innerHTML.replace(/"/g,"'"));
		$('divsuppl').setProperty('value',$('auxsupplements').innerHTML.replace(/"/g,"'"));
	}
		
});

// --------------------------------------------------------------
// object for calculations on dates
if (!FloorDateCalc)	{
	var FloorDateCalc = {
		// Non-Leap year Month days..
		DaysInMonth : new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31),
		// Leap year Month days..
		LDaysInMonth : new Array(31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31),
		// --------------------------------------------------------------
		// compares 2 dates: returns -1 if date2 is before, 0 if they're
		// equal, 1 if date2 is after, nothing if one date is invalid format
		compare : function(date1,date2)	{
			if (!date1.match(/\d+?-\d+?-\d+/) || !date2.match(/\d+?-\d+?-\d+/))	{
				return;
			}

			var d1 = this.splitDate(date1);
			var d2 = this.splitDate(date2);
			
			// first check year
			if (d1[0] > d2[0])	{
				return -1;
			}
			else if (d1[0] < d2[0])	{
				return 1;
			}
			// we're in the same year so check month next
			else if (d1[1] > d2[1])	{
				return -1;
			}
			else if (d1[1] < d2[1])	{
				return 1;
			}
			// same month and year, so compare days
			else if (d1[2] > d2[2])	{
				return -1;
			}
			else if (d1[2] < d2[2])	{
				return 1;
			}
			// if we arrive here, the 2 dates are identical
			else	{
				return 0;
			}
		},
		
		// --------------------------------------------------------------
		// adds the given amount of days to a date
		// returns the new date
		addRemoveDays : function(date,days)	{
			var wdate = this.splitDate(date);
			
			var daysadded = 0;
			
			while (daysadded < days)	{
				var dim = this.getDaysInMonth(wdate);
				var add = dim - wdate[2];
				if (add > days - daysadded)
					add = days - daysadded;
				
				wdate[2] += add;
				daysadded += add;
				
				if (wdate[2] == dim && days != daysadded)	{
					if (wdate[1] == 12)	{
						wdate[0]++;
						wdate[1] = 1;
					}
					else
						wdate[1]++;
					wdate[2] = 1;
					daysadded++;
				}
			}
			
			return wdate[0]+'-'+wdate[1]+'-'+wdate[2];
		},
		
		// --------------------------------------------------------------
		// gets the difference in days between 2 dates
		// returns the difference
		getDiffDays : function(date1,date2)	{
			var wdate1 = new Array();
			var wdate2 = new Array();
			var compare = this.compare(date1,date2);
			
			if (compare == -1)	{
				wdate1 = this.splitDate(date2);
				wdate2 = this.splitDate(date1);
			}
			else if (compare == 1)	{
				wdate1 = this.splitDate(date1);
				wdate2 = this.splitDate(date2);
			}
			else	{
				return 0;
			}
			
			var daysadded = 0;
			
			while (this.compare(wdate1[0]+'-'+wdate1[1]+'-'+wdate1[2],wdate2[0]+'-'+wdate2[1]+'-'+wdate2[2]) == 1)	{
				var dim = this.getDaysInMonth(wdate1);
				var add = dim - wdate1[2];
				if (wdate1[0] == wdate2[0] && wdate1[1] == wdate2[1])
					add = wdate2[2] - wdate1[2]; 
				
				wdate1[2] += add;
				daysadded += add;
				
				if (wdate1[2] == dim && this.compare(wdate1[0]+'-'+wdate1[1]+'-'+wdate1[2],wdate2[0]+'-'+wdate2[1]+'-'+wdate2[2]) == 1)	{
					if (wdate1[1] == 12)	{
						wdate1[0]++;
						wdate1[1] = 1;
					}
					else
						wdate1[1]++;
					wdate1[2] = 1;
					daysadded++;
				}
			}
			return daysadded;
		},
		
		// --------------------------------------------------------------
		// checks if it's a valid date
		// returns 0 for invalid, 1 for valid
		check : function(date)	{
			if (!date)	{
				return 0;
			}
			if (!date.match(/\d+?-\d+?-\d+/))	{
				return 0;
			}
			var d = this.splitDate(date);
			// check month 
			if (d[1] > 12 || d[1] < 1)	{
				return 0;
			}
			// check day
			if (d[2] < 1 || d[2] > this.getDaysInMonth(d))	{
				return 0;
			}
			return 1;
		},
		
		// --------------------------------------------------------------
		// splits a date into year, month and day and convert to integer
		// returns an array
		splitDate : function(datestr)	{
			var date = datestr.split('-');
			date = this.convert(date);
			return date;
		},
		
		// --------------------------------------------------------------
		// converts a datearray to integer or string (default is integer) 
		// returns an array
		convert : function(date,mode)	{
			var c;
			for (c=0; c<date.length; c++)	{
				switch (mode)	{
					case "string":
						date[c] = date[c].toString();
					break;
					case "fullstring":
						date[c] = (date[c].length == 1) ? date[c] = '0'+date[c].toString() : date[c] = date[c].toString();
					break;
					default:
						date[c] = (date[c].length == 2 && date[c].substr(0,1) == '0') ? parseInt(date[c].substr(1,1)) : parseInt(date[c]);
					break;
				}
			}
			return date;
		},
		
		// --------------------------------------------------------------
		// gets the amount of days in a month according to leapyear-rules 
		// returns the amount of days
		getDaysInMonth : function(Date)	{
			if ((Date[0] % 4) == 0) {
				if ((Date[0] % 100) == 0 && (Date[0] % 400) != 0)	{
					return this.DaysInMonth[Date[1]-1];
				}
				else	{
					return this.LDaysInMonth[Date[1]-1];
				}
			}
			else	{
				return this.DaysInMonth[Date[1]-1];
			}
		}
	}
}

QuickQuote.implement(new Options());

window.addEvent('domready', function(){
	//initialize quickquote
	if ($('quickquote'))
		qq = new QuickQuote({
			ID:$('schoolID').value,
			CID:$('schoolCID').value,
			year:$('usedyear').value,
			lang:siteLang,
			sectionId:$('ID_section').value
		});
});
var Lang = new Class({
	
	initialize : function(){
		
		$('bklang').setStyle('height','auto');
		
		this.mySlider = new Fx.Slide('bklang', {duration: 500}).hide();
		
		$('headerlang').addEvent('click',function(){
			this.mySlider.toggle();							  
		}.bind(this));
	}
	
});

window.addEvent('domready',function(){
	var mylang = new Lang();								
});/*
	Class: Formular
	
		
	Parameters:
			
	Exemple:
	
	About:
	
*/
var Formular = new Class({
	/*
		Initialize
	*/
	
	
	initialize : function() {
		this.designInput();
		
		this.designLabel();
	},
	
	designInput : function() {
		if ($('form')) var inputs = $('form').getElements('input');
		if ($('qqformular')) var inputs = $('qqformular').getElements('input');
		else var inputs = [];
		
		inputs.each(function(input,i){
				//inpput image for button
				if (input.getProperty('type')=='image'){
					var lang = siteLang;
					var btn;
					var btn_over;
					
					switch (input.value){
						case 'calculate':
							btn = 'btn_calculate.gif';
							btn_over = 'btn_calculate_over.gif';
							break;
						
						case 'contact':
							btn = 'btn_offer.png';
							btn_over = 'btn_offer_over.png';
							break;
							
						case 'contactme':
							btn = 'btn_contact.gif';
							btn_over = 'btn_contact_over.gif';
							break;	
							
						case 'inscription':
							btn = 'btn_inscription.gif';
							btn_over = 'btn_inscription_over.gif';
							break;
							
						case 'print':
							btn = 'btn_print.gif';
							btn_over = 'btn_print_over.gif';
							break;
							
						case 'newoffer':
							btn = 'btn_newoffer.gif';
							btn_over = 'btn_newoffer_over.gif';
							break;
							
						case 'next':
							btn = 'btn_next.gif';
							btn_over = 'btn_next_over.gif';
							break;
							
						case 'previous':
							btn = 'btn_previous.gif';
							btn_over = 'btn_previous_over.gif';
							break;
							
						default:
							btn = 'btn_send.gif';
							btn_over = 'btn_send_over.gif';
							break;
					}
					input.addEvent('mouseenter', function(){
						input.src='/img/form/'+lang+'/'+btn_over;
					});
					input.addEvent('mouseleave', function(){
						input.src='/img/form/'+lang+'/'+btn;
					});					
				}
		})
	},
	
	designLabel : function(){
		//get all strong elements used as "label"
		$$('form#form div.sep > strong').each(function(strong){
			if (strong.get('text').trim().match(/^\*.+/)) {
				strong.addClass('required');
				strong.set('html', strong.get('html').replace('*', '<span>*</span>'));
			}
		});
		
		//remove empty legend
		$$('form#form fieldset > legend').each(function(legend){
			if (legend.get('text') == "") {
				legend.setStyle('display', 'none');
			}
		});
	}
	
});

Window.addEvent('domready', function(){
	if ($('qqformular')) new Formular();
});/*
Script: gallery.js
		
License:
        MIT-style license.
		
Note:
		Don't forget to insert "<script language="Javascript" type="text/javascript" src="js/mootools.js"></script>" into the head page before this js file.

*/


var Gallery = new Class({
	
	options: {
		selector : '.gbox',
		gallerySelector : '.gcontainer',
		opener : '.gboxarrow',
		opacity : 0.6,
		playerSpeed : 3500,
		slideLength : 6,
		preloader : false,
		upscaling : false,
		imageSize : {
			width : 640,
			height : 480
		},
		thumbWidth : 106,
		useSections : false,
		fileManager : false
	},
	
	initialize : function(options) {
		this.setOptions(options);
		
		this.initialized = false;
		
		//set behavior
		this.setBehavior();
		this.setMiniGallery();
	},
	
	build : function(pictID, sectionID){
		//add an overlay
		this.setOverlay();
		
		//open gallery
		this.openGallery(pictID, sectionID);
		
		//set events
		//recenter on resize
		window.addEvent('resize', function(e){
			this.setWrapperPosition();
		}.bind(this));
		
		if (window.ie6) {
			window.onscroll = function(){
				//set gallery position
				this.setWrapperPosition();
			}.bind(this);
		}
	},
	
	setOverlay : function(){
		//build the overlay
		this.overlay = new Element('div', {
			id : 'gallery-overlay'
		}).inject(document.body);
		
		this.overlay.setStyle('height', window.getSize().scrollSize.y);
		
		//make an fx
		var fx = new Fx.Style(this.overlay, 'opacity', {
			onComplete : function(){
				if (!this.overlay.getStyle('opacity')) {
					this.overlay.remove();
				}
			}.bind(this)
		}).start(0, this.options.opacity);
		
		//add click event to remove
		this.overlay.addEvent('click', function(){
			this.closeGallery(fx);
		}.bind(this));
	},
	
	openGallery : function(pictID, sectionID){
	
		//gallery alerady exist?
		if (this.initialized) {
			//set gallery position
			this.setWrapperPosition();
			
			//Load first gallery
			this.loadGallery(sectionID, $('gallery-sections').getChildren()[sectionID], pictID);
			
			//display gallery
			this.wrapper.setStyle('display', 'block');
			this.wrapperFx.start(1);
			pictID = (pictID == false) ? 0 : pictID; 
			$('gallery-thumbs').getElements('img')[pictID].fireEvent('click', '', 500);
		} else {
			//build it
			this.buildGallery(pictID, sectionID);
			this.initialized = true;
		}
		
		//check if we need to slide slider (uh)
		if (pictID) {
			var number = Math.ceil((pictID+1) / 4)-1;
			this.sliderFx.start(-number * 106 * 4);
			this.counterControls = number;
		}
	},
	
	buildGallery : function(pictID, sectionID){
		//make a container
		
		this.wrapper = new Element('div', { id : 'gallery-wrapper'}).inject(document.body);
		this.wrapperFx = new Fx.Style(this.wrapper, 'opacity', {
			onComplete : function(){
				if (this.wrapper.getStyle('opacity') == 0) {
					this.wrapper.setStyle('display', 'none');
				} 
			}.bind(this)
		});
		
		//Determine wrapper size
		if (!this.buildSections()) {
			
			this.wrapper.addClass('small');
			this.options.slideLength -= 2;
		}
		
		
		//define static size
		this.size = {
			gallery : this.wrapper.getSize(),
			window : window.getSize()
		};			
		
		this.setWrapperPosition();
		
		//Create elements
		new Element('div', { id : 'gallery-picture' }).inject(this.wrapper, 'top');
		if (this.options.preloader) new Element('div', { id : 'gallery-preloader' }).injectTop(this.wrapper);
		new Element('img', {
			id : 'gallery-close',
			src : '/img/gallery/closebox.png',
			'class' : 'png',
			events : {
				click : function(){
					this.overlay.fireEvent('click');
				}.bind(this)
			}
		}).inject(this.wrapper);
		var bottom = new Element('div', { id : 'gallery-bottom' }).inject(this.wrapper);
		var slider = new Element('div', { id : 'gallery-slider' }).inject(bottom);
		new Element('ul', { id : 'gallery-thumbs' }).inject(slider);
		this.buildControls();
		
		//Load first gallery
		this.loadGallery(sectionID, $('gallery-sections').getChildren()[sectionID], pictID);
		
	},
	
	setWrapperPosition : function(){
		this.size.window = window.getSize();
		var ieCorrection = (window.ie6) ? window.getSize().scroll.y : 0;
		this.wrapper.setStyles({
			top : (this.size.window.size.y - this.size.gallery.size.y) / 2 + ieCorrection,
			left : (this.size.window.size.x - this.size.gallery.size.x) / 2
		});
	},
	
	buildSections : function(){
		var ul = new Element('ul', { id : 'gallery-sections' }).inject(this.wrapper);
		
		this.sections.each(function(section, i){
			if(!this.options.fileManager && (!section[0].getParent().getPrevious().getChildren().length || section[0].getParent().getPrevious().getElement('a') === null)) {
				var text = '';
			}
			else if (this.options.fileManager)
			{
				var text = section[0].getPrevious().getText();
			}
			else
			{
				var text = section[0].getParent().getPrevious().getElement('a').getText();
			}
			
			var li = new Element('li').setText(text).inject(ul);
			
			//add event to load related gallery
			li.addEvent('click', function(){
				// load gallery
				this.loadGallery(i, li);
			}.bind(this));
		}, this);
		if (this.sections.length > 1 && this.options.useSections) {
			return true;
		} else {
			ul.setStyle('display', 'none');
			return false;
		}
	},
	
	buildControls : function(){
		new Element('div', { id : 'gallery-controls-bg', 'class' : 'png' }).inject(this.wrapper);
		var wrapper = new Element('div', { id : 'gallery-controls' }).inject(this.wrapper);
		
		//add fx on thumbs list
		var fx = new Fx.Style('gallery-slider', 'left');
		this.sliderFx = fx;
		
		//buttons
		new Element('a', { id : 'gallery-controls-previous', 'class' : 'png' }).inject(wrapper);
		new Element('a', { id : 'gallery-controls-play' }).inject(wrapper);
		new Element('a', { id : 'gallery-controls-next', 'class' : 'png' }).inject(wrapper);		
		
		this.counterControls = 0;
		this.autoPlay = false;
		
		$('gallery-controls-next').addEvent('click', function(){
			var max = ($$('#gallery-thumbs li').length / this.options.slideLength);
			if (this.counterControls < max - 1){
				fx.start($('gallery-slider').getStyle('left').toInt() - this.options.thumbWidth * this.options.slideLength);
				this.counterControls++;
			}
		}.bind(this));
		
		$('gallery-controls-previous').addEvent('click', function(){
			if (this.counterControls > 0){
				fx.start($('gallery-slider').getStyle('left').toInt() + this.options.thumbWidth * this.options.slideLength);
				this.counterControls--;
			}
		}.bind(this));
		
		$('gallery-controls-play').addEvent('click', function(){
			if (!this.autoPlay) {
				//start a periodical if not exist
				this.autoPlay = this.autoPlayer.periodical(this.options.playerSpeed, this, fx);
				//change image
				$('gallery-controls-play').addClass('p');
			} else {
				$('gallery-controls-play').removeClass('p');
				$clear(this.autoPlay);
				this.autoPlay = false;
			}
		
		}.bind(this));
	},
	
	autoPlayer : function(fx){
		this.activeThumb++
		
		if ($('gallery-thumb-' + this.activeThumb)) {
			$('gallery-thumb-' + this.activeThumb).fireEvent('click');
			//slide tous les 4
			if (this.activeThumb % this.options.slideLength == 0) $('gallery-controls-next').fireEvent('click');
		} else {
			this.activeThumb = 0;
			this.counterControls = 0;
			$('gallery-thumb-' + this.activeThumb).fireEvent('click');
			//slide au dï¿½but
			fx.start(0);
		}
	},
	
	killAutoPlayer : function(){
		//kill autoplay if needed
		if (this.autoPlay) {
			$('gallery-controls-play').removeClass('p');
			$clear(this.autoPlay);
			this.autoPlay = false;
		}
	},
	
	loadGallery : function(id, li, pictID){
		//Clean previous if exist
		$('gallery-thumbs').empty();
		
		//return to left
		this.activeThumb = 0;
		this.counterControls = 0;
		$('gallery-slider').setStyle('left', 0);
		
		//fill with new elements
		var size = this.options.imageSize;
		
		this.sections[id][0].getChildren().each(function(img, i){
			var infos = this.options.fileManager ? img.getFirst().getFirst() : img.getFirst();
			var li = new Element('li').inject('gallery-thumbs');
			var thumb = new Element('img', {
				id: 'gallery-thumb-' + i,
				rel: i,
				styles : {
					opacity : 0
				},
				events : {
					load : function(){
						//setsize
						var ratio = this.height / this.width;
						if (ratio <= size.height / size.width) {
							//image is larger
							this.width = 96;
							this.height = 96 * ratio;
						} else {
							//image is heigher
							this.height = 72;
							this.width = 72 / ratio;
						}
						
						this.setStyle('marginTop', (72 - this.height) / 2);
						
						new Fx.Style(this, 'opacity').start(0, 1);
					}
				},
				src: infos.getProperty('src')
			}).inject(li);
			
			//add click event
			thumb.addEvent('click', function(){
				var pict = this.options.fileManager ? img.getFirst().getProperty('href') : img.getProperty('href');
				this.loadPicture(pict);
				this.setBorder(thumb);
				this.activeThumb = thumb.getProperty('rel');
			}.bind(this));
		}, this);
		
		
		//open first image
		if (!pictID) {
			$('gallery-thumbs').getElement('img').fireEvent('click', '', 500);
		} else {
			$('gallery-thumbs').getElements('img')[pictID].fireEvent('click', '', 500);
		}
			
		
		//set gallery active
		if (this.activeGallery) this.activeGallery.removeClass('s');
		this.activeGallery = li.addClass('s');
		this.activeThumb = 0;
	},
	
	loadPicture : function(url) {
		$('gallery-picture').empty();
		var size = this.options.imageSize;
		var viewSize = {
			width : $('gallery-picture').getStyle('width').toInt(),
			height : $('gallery-picture').getStyle('height').toInt()
		}
		var upscaling = this.options.upscaling;
		new Element('img', {
			styles : { opacity : 0 },
			events : {
				load : function(){
					//determine width & height if not standard
					if ((upscaling && (this.width < size.width || this.height < size.height)) || this.width >= size.width || this.height >= size.height) {
						var ratio = this.height / this.width;
						if (ratio <= size.height / size.width) {
							//image is larger
							this.width = size.width;
							this.height = size.width * ratio;
						} else {
							//image is heigher
							this.height = size.height;
							this.width = size.height / ratio;
						}
					}
					
					this.setStyles({
						'marginTop' : (viewSize.height - this.height) / 2,
						'marginLeft': (viewSize.width - this.width) / 2
					});
					
					//add the new image with a fade
					new Fx.Style(this, 'opacity').start(1);
				}
			},
			src : url
		}).inject('gallery-picture');
	},
	
	setBorder : function(target){
		if (!this.follower) {
			this.follower = new Element('div', {
				id : 'gallery-follower'
			}).inject('gallery-slider');
			
			this.follower.fx = new Fx.Style(this.follower, 'left');
		}
		var coord = target.getParent().getPosition().x - $('gallery-thumbs').getPosition().x;
		this.follower.fx.start(coord);
	},
	
	closeGallery : function(fx){
		//remove overlay
		fx.start(0);
		
		//hide gallery
		this.wrapperFx.start(0);
		
		this.killAutoPlayer();
	},
	
	setBehavior : function(){
		//get some elements
		this.root = $$(this.options.selector);
		this.opener = this.root.getElements(this.options.opener);
		this.sections = [];
		
		this.root.each(function(sel){
			this.sections.push(sel.getElements(this.options.gallerySelector));
		}, this);
		
		//add event on h4
		this.opener.each(function(el, i){
			if(!el.length) return
			el[0].addEvent('click', function(e){
				new Event(e).stop();
				this.build(false, i);
			}.bind(this));
		}, this)
	},
	
	setMiniGallery : function(){
		$$('.gcontainer').each(function(gcontainer){
			gcontainer.nb_steps = gcontainer.getElements('a').length-2;
			gcontainer.crt=0;
			gcontainer.step_width=71;
			gcontainer.slider = new Fx.Styles(gcontainer, {
				duration: 500, 
				wait:false, 
				transition: Fx.Transitions.Expo.easeIn
			});	
		});
		
		$$('.gboxbtright').each(function(btn){
			btn.addEvents({
				'mouseover': function(){
					this.addClass('overnext');
				},
				
				'mouseout': function(){
					this.removeClass('overnext');	
				},
				
				'mousedown': function(event){
					this.press=true;
					this.pressNext(false, btn.getPrevious().getFirst());
				}.bind(this),
				
				'mouseup': function(event){
					this.press=false;
				}.bind(this)
			});
		}, this);
		
		$$('.gboxbtleft').each(function(btn){
			btn.addEvents({
				'mouseover': function(){
					this.addClass('overprev');
				},
				
				'mouseout': function(){
					this.removeClass('overprev');	
				},
				
				'mousedown': function(event){
					this.press=true;
					this.pressPrev(false, btn.getNext().getFirst());
				}.bind(this),
				
				'mouseup': function(event){
					this.press=false;
				}.bind(this)
			});
		}, this);
		
		//$('previous').setStyle('opacity',0.4);
		
		this.bindThumbsWithGallery();
	},
	
	pressNext : function(wait, controller){
		if(controller.crt<controller.nb_steps){
			if (!this.press && wait) return;
			if (this.press && wait) this.timer = this.pressNext.delay(100, this, [false, controller]);
			else this.slideNext(controller);
		}
	},
	
	pressPrev : function(wait, controller){
		if(controller.crt > 0){
			if (!this.press && wait) return;
			if (this.press && wait) this.timer = this.pressPrev.delay(100,this);
			else this.slidePrev(controller);
		}
	},
		
	slidePrev : function(controller){
		$clear(this.timer);
		controller.crt--;
		controller.slider.start({
			'margin-left': -controller.crt*controller.step_width
		});
		if(controller.crt==0){
			$('previous').setStyle('opacity',0.4);
		}else if($('next').getStyle('opacity')==0.4) $('next').setStyle('opacity',1);
		
		if(this.press){
			this.pressPrev.delay(600,this, [true, controller]);
		}
	},
	
	slideNext : function(controller){
		$clear(this.timer);
		controller.crt++;
		controller.slider.start({
			'margin-left': -controller.crt*controller.step_width
		});
		if(controller.crt==controller.nb_steps){
			$('next').setStyle('opacity',0.4);
		}else if($('previous').getStyle('opacity')==0.4) $('previous').setStyle('opacity',1);
				
		if(this.press){
			this.pressNext.delay(600,this, [true, controller]);
		}
	},
	
	bindThumbsWithGallery : function(){
		this.sections.each(function(section, s){
			var target = this.options.fileManager ? section[0].getElements('li a.opener') : section[0].getChildren();
			target.each(function(thumb, i){
				thumb.addEvent('click', function(e){
					new Event(e).stop();
					//open gallery with pict ID and section ID
					this.build(i, s);
				}.bind(this));
			}, this);
		}, this);
	}
});

Gallery.implement(new Options());

Window.addEvent('domready', function(){
	if ($$('.gcontainer').length > 0) new Gallery();
	if ($$('.gallery_images').length)
		gal = new Gallery({
			selector : '.gallery_preview',
			gallerySelector : '.gallery_images',
			useSections: true
		});
	if ($$('.filemanager_picture').length)
		gal = new Gallery({
			selector : '.image_manager',
			gallerySelector : '.filemanager_picture',
			useSections: false,
			fileManager : true
		});
});window.addEvent('domready', function(){
	$$('.gallery_preview').each(function(bloc){
		var fx = new Fx.Slide(bloc.getElement('.gallery_images')).hide();

		var fermer = true;
		bloc.getElement('li a').addEvent('click', function(e){
			new Event(e).stop();
			fx.toggle();
			if (fermer) {
				bloc.getElement('li').setStyle('list-style-image','url(/images/gallery/fleche_bas.png)');
				fermer = false;
			} else {
				bloc.getElement('li').setStyle('list-style-image','url(/images/gallery/fleche.png)');
				fermer = true;
			}
		});	
	});
	
});

/**************************************************************

	Script		: Background Slider
	Version		: 1.1
	Authors		: Samuel Birch
	Desc		: Slides a layer to a given elements position and dimensions.
	Licence		: Open Source MIT Licence

**************************************************************/

var BackgroundSlider = new Class({

	getOptions: function(){
		return {
			duration: 300,
			wait: 500,
			transition: Fx.Transitions.sineInOut,
			className: false,
			fixHeight: false,
			fixWidth: false,
			id: false,
			padding: {top:0,right:0,bottom:0,left:0},
			onClick: this.setStart,
			mouseOver: true,
			container: document.body
		};
	},

	initialize: function(elements, options){
		this.setOptions(this.getOptions(), options);
		this.elements = $$(elements);
		this.timer = 0;
		
		if(this.options.id){
			this.bg = $(this.options.id);
		}else{
			this.bg = new Element('div').setProperty('id','BgSlider_'+new Date().getTime()).injectInside(this.options.container);
			if(this.options.className){
				this.bg.addClass(this.options.className);	
			}
		}
		
		this.effects = new Fx.Styles(this.bg, {duration: this.options.duration, transition: this.options.transition});
		
		this.elements.each(function(el,i){
			if(this.options.mouseOver){
				el.addEvent('mouseover', this.move.bind(this,el));
				el.addEvent('mouseout', this.reset.bind(this));
			}
			el.addEvent('click', this.options.onClick.bind(this, el))
			if(el.hasClass('bgStart')){
				this.set(el);
			}
		},this);
		
		window.addEvent('resize',function(){
			this.move(this.startElement);
		}.bind(this));
		
	},
	
	setStart: function(el){
		this.startElement = el;
	},
	
	set: function(el,slideshow){
		this.setStart(el);
		if(slideshow){
			var pos = {
				'top':this.startElement.getCoordinates().top-this.options.container.getCoordinates().top,
				'left':this.startElement.getCoordinates().left-this.options.container.getCoordinates().left,
				'height':this.startElement.getCoordinates().height,
				'width':this.startElement.getCoordinates().width
			}
		}else var pos = el.getCoordinates();
		
		if(this.options.id){
			this.options.padding.top = this.bg.getStyle('paddingTop').toInt();
			this.options.padding.right = this.bg.getStyle('paddingRight').toInt();
			this.options.padding.bottom = this.bg.getStyle('paddingBottom').toInt();
			this.options.padding.left = this.bg.getStyle('paddingLeft').toInt();
			this.bg.setStyle('padding','0px');
		}
		
		var obj = {};
		obj.top = (pos.top-this.options.padding.top)+'px';
		obj.left = (pos.left-this.options.padding.left)+'px';
		if(!this.options.fixHeight){obj.height = (pos.height+this.options.padding.top+this.options.padding.bottom)+'px'};
		if(!this.options.fixWidth){obj.width = (pos.width+this.options.padding.left+this.options.padding.right)+'px'};
		
		this.bg.setStyles(obj);
	},
	
	reset: function(){
		if(this.options.wait){
			this.timer = this.move.delay(this.options.wait, this, this.startElement);
		}
	},
	
	move: function(el, slideshow){
		$clear(this.timer);
		if(slideshow){
			var pos = {
				'top':this.startElement.getCoordinates().top-this.options.container.getCoordinates().top,
				'left':this.startElement.getCoordinates().left-this.options.container.getCoordinates().left,
				'height':this.startElement.getCoordinates().height,
				'width':this.startElement.getCoordinates().width
			}
		}else var pos = el.getCoordinates();
		
		this.effects.stop();
		
		var obj = {};
		obj.top = pos.top-this.options.padding.top;
		obj.left = pos.left-this.options.padding.left;
		if(!this.options.fixHeight){obj.height = pos.height+this.options.padding.top+this.options.padding.bottom};
		if(!this.options.fixWidth){obj.width = pos.width+this.options.padding.left+this.options.padding.right};
		
		this.effects.start(obj);
		
	}

});
BackgroundSlider.implement(new Options);
BackgroundSlider.implement(new Events);

/*************************************************************/
/*
 * Smoothbox v20070814 by Boris Popoff (http://gueschla.com)
 * To be used with mootools 1.1x
 * 
 * Based on Cody Lindley's Thickbox, MIT License
 *
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 */

// on page load call TB_init
window.addEvent('domready', TB_init);

// prevent javascript error before the content has loaded
TB_WIDTH = 0;
TB_HEIGHT = 0;
var TB_doneOnce = 0 ;

// add smoothbox to href elements that have a class of .smoothbox
function TB_init(){
	$$("a.smoothbox").each(function(el){el.onclick=TB_bind});
}

function TB_bind(event) {
	var event = new Event(event);
	// stop default behaviour
	event.preventDefault();
	// remove click border
	this.blur();
	// get caption: either title or name attribute
	var caption = this.title || this.name || "";
	// get rel attribute for image groups
	var group = this.rel || false;
	// display the box for the elements href
	TB_show(caption, this.href, group);
	this.onclick=TB_bind;
	return false;
}


// called when the user clicks on a smoothbox link
function TB_show(caption, url, rel) {

	// create iframe, overlay and box if non-existent

	if ( !$("TB_overlay") )
	{
		new Element('iframe').setProperty('id', 'TB_HideSelect').injectInside(document.body);
		$('TB_HideSelect').setOpacity(0);
		new Element('div').setProperty('id', 'TB_overlay').injectInside(document.body);
		$('TB_overlay').setOpacity(0);
		TB_overlaySize();
		new Element('div').setProperty('id', 'TB_load').injectInside(document.body);
		$('TB_load').innerHTML = "<img src='img/smoothbox/loading.gif' />";
		TB_load_position();
		new Fx.Style('TB_overlay', 'opacity',{duration: 400, transition: Fx.Transitions.sineInOut}).start(0,0.6);
	}
	
	if ( !$("TB_load") )
	{		
		new Element('div').setProperty('id', 'TB_load').injectInside(document.body);
		$('TB_load').innerHTML = "<img src='img/smoothbox/loading.gif' />";
		TB_load_position();
	}
	
	if ( !$("TB_window") )
	{
		new Element('div').setProperty('id', 'TB_window').injectInside(document.body);
		$('TB_window').setOpacity(0);
	}
	
	$("TB_overlay").onclick=TB_remove;
	window.onscroll=TB_positionEffect;

	// check if a query string is involved
	var baseURL = url.match(/(.+)?/)[1] || url;

	// regex to check if a href refers to an image
	var imageURL = /\.(jpe?g|png|gif|bmp)/gi;

	// check for images
	if ( baseURL.match(imageURL) ) {
		var dummy = { caption: "", url: "", html: "" };
		
		var prev = dummy,
			next = dummy,
			imageCount = "";
			
		// if an image group is given
		if ( rel ) {
			function getInfo(image, id, label) {
				return {
					caption: image.title,
					url: image.href,
					html: "<span id='TB_" + id + "'>&nbsp;&nbsp;<a href='#'>" + label + "</a></span>"
				}
			}
		
			// find the anchors that point to the group
			var imageGroup = [] ;
			$$("a.smoothbox").each(function(el){
				if (el.rel==rel) {imageGroup[imageGroup.length] = el ;}
			})

			var foundSelf = false;
			
			// loop through the anchors, looking for ourself, saving information about previous and next image
			for (var i = 0; i < imageGroup.length; i++) {
				var image = imageGroup[i];
				var urlTypeTemp = image.href.match(imageURL);
				
				// look for ourself
				if ( image.href == url ) {
					foundSelf = true;
					imageCount = "Image " + (i + 1) + " of "+ (imageGroup.length);
				} else {
					// when we found ourself, the current is the next image
					if ( foundSelf ) {
						next = getInfo(image, "next", "Next &gt;");
						// stop searching
						break;
					} else {
						// didn't find ourself yet, so this may be the one before ourself
						prev = getInfo(image, "prev", "&lt; Prev");
					}
				}
			}
		}
		
		imgPreloader = new Image();
		imgPreloader.onload = function() {
			imgPreloader.onload = null;

			// Resizing large images
			var x = window.getWidth() - 150;
			var y = window.getHeight() - 150;
			var imageWidth = imgPreloader.width;
			var imageHeight = imgPreloader.height;
			if (imageWidth > x) {
				imageHeight = imageHeight * (x / imageWidth); 
				imageWidth = x; 
				if (imageHeight > y) { 
					imageWidth = imageWidth * (y / imageHeight); 
					imageHeight = y; 
				}
			} else if (imageHeight > y) { 
				imageWidth = imageWidth * (y / imageHeight); 
				imageHeight = y; 
				if (imageWidth > x) { 
					imageHeight = imageHeight * (x / imageWidth); 
					imageWidth = x;
				}
			}
			// End Resizing
			
			// TODO don't use globals
			TB_WIDTH = imageWidth + 30;
			TB_HEIGHT = imageHeight + 60;
			
			// TODO empty window content instead
			$("TB_window").innerHTML += "<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + imageCount + prev.html + next.html + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a></div>";
			
			$("TB_closeWindowButton").onclick = TB_remove;
			
			function buildClickHandler(image) {
				return function() {
					$("TB_window").remove();
					new Element('div').setProperty('id', 'TB_window').injectInside(document.body);
					
					TB_show(image.caption, image.url, rel);
					return false;
				};
			}
			var goPrev = buildClickHandler(prev);
			var goNext = buildClickHandler(next);
			if ( $('TB_prev') ) {
				$("TB_prev").onclick = goPrev;
			}
			
			if ( $('TB_next') ) {		
				$("TB_next").onclick = goNext;
			}
			
			document.onkeydown = function(event) {
				var event = new Event(event);
				switch(event.code) {
				case 27:
					TB_remove();
					break;
				case 190:
					if( $('TB_next') ) {
						document.onkeydown = null;
						goNext();
					}
					break;
				case 188:
					if( $('TB_prev') ) {
						document.onkeydown = null;
						goPrev();
					}
					break;
				}
			}
			
			// TODO don't remove loader etc., just hide and show later
			$("TB_ImageOff").onclick = TB_remove;
			TB_position();
			TB_showWindow();
		}
		imgPreloader.src = url;
		
	} else { //code to show html pages
		
		var queryString = url.match(/\?(.+)/)[1];
		var params = TB_parseQuery( queryString );
		
		TB_WIDTH = (params['width']*1) + 30;
		TB_HEIGHT = (params['height']*1) + 40;

		var ajaxContentW = TB_WIDTH - 30,
			ajaxContentH = TB_HEIGHT - 45;
		
		if(url.indexOf('TB_iframe') != -1){				
			urlNoQuery = url.split('TB_');		
			$("TB_window").innerHTML += "<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' onload='TB_showWindow()'> </iframe>";
		} else {
			$("TB_window").innerHTML += "<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>close</a></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>";
		}
				
		$("TB_closeWindowButton").onclick = TB_remove;
		
			if(url.indexOf('TB_inline') != -1){	
				$("TB_ajaxContent").innerHTML = ($(params['inlineId']).innerHTML);
				TB_position();
				TB_showWindow();
			}else if(url.indexOf('TB_iframe') != -1){
				TB_position();
				if(frames['TB_iframeContent'] == undefined){//be nice to safari
					$(document).keyup( function(e){ var key = e.keyCode; if(key == 27){TB_remove()} });
					TB_showWindow();
				}
			}else{
				var handlerFunc = function(){
					TB_position();
					TB_showWindow();
				};
				var myRequest = new Ajax(url, {method: 'get',update: $("TB_ajaxContent"),onComplete: handlerFunc}).request();
			}
	}

	window.onresize=function(){ TB_position(); TB_load_position(); TB_overlaySize();}  
	
	document.onkeyup = function(event){ 	
		var event = new Event(event);
		if(event.code == 27){ // close
			TB_remove();
		}	
	}
		
}

//helper functions below

function TB_showWindow(){
	//$("TB_load").remove();
	//$("TB_window").setStyles({display:"block",opacity:'0'});
	
	if (TB_doneOnce==0) {
		TB_doneOnce = 1;
		var myFX = new Fx.Style('TB_window', 'opacity',{duration: 250, transition: Fx.Transitions.sineInOut, onComplete:function(){if ($('TB_load')) { $('TB_load').remove();}} }).start(0,1);
	} else {
		$('TB_window').setStyle('opacity',1);
		if ($('TB_load')) { $('TB_load').remove();}
	}
}

function TB_remove() {
 	$("TB_overlay").onclick=null;
	document.onkeyup=null;
	document.onkeydown=null;
	
	if ($('TB_imageOff')) $("TB_imageOff").onclick=null;
	if ($('TB_closeWindowButton')) $("TB_closeWindowButton").onclick=null;
	if ( $('TB_prev') ) { $("TB_prev").onclick = null; }
	if ( $('TB_next') ) { $("TB_next").onclick = null; }

	new Fx.Style('TB_window', 'opacity',{duration: 250, transition: Fx.Transitions.sineInOut, onComplete:function(){$('TB_window').remove();} }).start(1,0);
	new Fx.Style('TB_overlay', 'opacity',{duration: 400, transition: Fx.Transitions.sineInOut, onComplete:function(){$('TB_overlay').remove();} }).start(0.6,0);

	window.onscroll=null;
	window.onresize=null;	
	
	$('TB_HideSelect').remove();
	TB_init();
	TB_doneOnce = 0;
	return false;
}

function TB_position() {
	$("TB_window").setStyles({width: TB_WIDTH+'px', 
				 left: (window.getScrollLeft() + (window.getWidth() - TB_WIDTH)/2)+'px',
				 top: (window.getScrollTop() + (window.getHeight() - TB_HEIGHT)/2)+'px'});
}

function TB_positionEffect() {
	new Fx.Styles('TB_window', {duration: 75, transition: Fx.Transitions.sineInOut}).start({
		'left':(window.getScrollLeft() + (window.getWidth() - TB_WIDTH)/2)+'px',
		'top':(window.getScrollTop() + (window.getHeight() - TB_HEIGHT)/2)+'px'});
}

function TB_overlaySize(){
	// we have to set this to 0px before so we can reduce the size / width of the overflow onresize 
	$("TB_overlay").setStyles({"height": '0px', "width": '0px'});
	$("TB_HideSelect").setStyles({"height": '0px', "width": '0px'});
	$("TB_overlay").setStyles({"height": window.getScrollHeight()+'px', "width": window.getScrollWidth()+'px'});
	$("TB_HideSelect").setStyles({"height": window.getScrollHeight()+'px',"width": window.getScrollWidth()+'px'});
}

function TB_load_position() {
	if ($("TB_load")) { $("TB_load").setStyles({left: (window.getScrollLeft() + (window.getWidth() - 56)/2)+'px', top: (window.getScrollTop() + ((window.getHeight()-20)/2))+'px',display:"block"}); }
}

function TB_parseQuery ( query ) {
	// return empty object
	if( !query )
		return {};
	var params = {};
	
	// parse query
	var pairs = query.split(/[;&]/);
	for ( var i = 0; i < pairs.length; i++ ) {
		var pair = pairs[i].split('=');
		if ( !pair || pair.length != 2 )
			continue;
		// unescape both key and value, replace "+" with spaces in value
		params[unescape(pair[0])] = unescape(pair[1]).replace(/\+/g, ' ');
   }
   return params;
}
/*
Script: search.js
		All Javascript files are managed by this script. 
		Based on site.js file from <http://www.mootools.net/>.

License:
        MIT-style license.

About:
		search.js for mootools framework <http://www.mootools.net/> (c) 2007 Valerio Proietti, MIT-style license.
		Class created by Sylvain Barraud, Yvan Cottet and Gregory Paccaud, <http://www.esl.ch/>.
		Last modification, 14 december 2007.

Version: 1.0

Note:
		XHTML doctype is required.
		
*/

/*
Class: Search
		Designed Search
			
Events:

		focus, blur

Example:
		(start code)
		var searchform = new Search($('search'));
		(end)
		
Note:
		Don't forget to insert "<script language="Javascript" type="text/javascript" src="js/mootools.js"></script>" into the head page before this js file.
*/

var Search = new Class({
	initialize: function() {
		this.input = $('searchinput');
		if(!this.input) return;
		this.input.addEvent('focus',function(){
			this.input.value = '';
		}.bind(this));
	}
}); 

window.addEvent('domready',function() {
	new Search();
});

var Prices = new Class({
	
	options: {
		firstyear : 2010,
		secondyear : 2011
	},

	initialize: function(){
		if ($$('.prices').length) {
			this.fixPrices();
			this.managePrices();
			this.manageToggleYears();
		}
	},
	
	fixPrices : function(){
		//fix color for first prices-table
		$$('.prices').each(function(el){
			var first = el.getElement('div.table_element');
			if (first == undefined) return;
			first.getElements('th').setStyle('backgroundImage', 'url(/img/prices/head-blue.png)');
			
			//fix color for second prices-table
			first.getNext().getElements('th').setStyle('backgroundImage', 'url(/img/prices/head-red.png)');
			
			//set zebra on all tables except prices and remove empty tables
			$$('div.table_element').each(function(table){
				if(table.getElement('div') != undefined){
					var qties = table.getElement('div').innerHTML;
					var reg=new RegExp("[/]+", "g");
					var qty=qties.split(reg);
					table.getElements('tr').each(function(tr, i){
						qty.each(function(q){
							if(q==tr.getFirst().innerHTML) var test=1;
							if (test==1) tr.setStyle('display','table-row');
						});
					});	
				}
				if (
					table.getElement('table') != undefined && (
						(table.getElement('table').getFirst() == undefined) ||
						(table.getElement('table').getFirst().getFirst() == undefined)		
					))
				{
					table.remove();
					return;
				}
				table.getElements('tr').each(function(tr, i){
					//if (i%2 == 0) tr.setStyle('background', '#E8E8E8');
				});			
			});
		});
	},
	
	managePrices : function(){
		//show all price 
		$$('.showprices').each(function(el){
			el.addEvent('click', function(e){
				new Event(e).stop();
				this.togglePrices(el);
			}.bind(this));
		}, this);
		
		this.hiddenPrices = [];
		$$('.prices').each(function(price){
			price.getElements('tr').each(function(tr){
				if (tr.getStyle('display') == 'none') this.hiddenPrices.push(tr);
			}, this);
		}, this);
				
		this.visible = false;
	},
	
	togglePrices : function(el){
		if (!this.visible) {
			this.hiddenPrices.each(function(tr){
				tr.setStyle('display', 'table-row');
				new Fx.Style(tr, 'opacity').start(0, 1);	
			});
			this.visible = true;
		} else {
			this.hiddenPrices.each(function(tr){
				new Fx.Style(tr, 'opacity', {
					onComplete : function(){
						tr.setStyle('display', 'none');
					}
				}).start(1, 0);	
			});
			this.visible = false;
		}
	},
	
	manageToggleYears : function(){
		//this.initStyle();
		if ($('firstyear')) {
			this.initPriceTabs()
		}else{
			$$('.price'+this.options.secondyear).each(function(lol){
				lol.addClass('hide');
			})
		}
	},
	
	initPriceTabs : function() {
		$$('.price'+this.options.secondyear).each(function(lol){	
			lol.addClass('hide');
		})
		
		$('firstyear').addClass('year_s').addEvent('click',function(){
			this.showYears(this.options.firstyear, this.options.secondyear);
		}.bind(this));
		$('secondyear').addEvent('click',function(){
			this.showYears(this.options.secondyear, this.options.firstyear);
		}.bind(this));
	},
	
	showYears : function(show,hide){
		//if this is not the same year then switch year
		$$('.price'+show).each(function(lol){
			
			if(lol.hasClass('hide')){
				$('firstyear').toggleClass('year_s');
				$('secondyear').toggleClass('year_s');
				$$('.price'+show).each(function(lol){
					lol.toggleClass('hide');
				})
				
				$$('.price'+hide).each(function(lol){
					lol.toggleClass('hide');
				})
				
				$$('.periodcut').each(function(period){
					var date = period.getText();
					if (date.match(show)) {
						period.removeClass('hide');
					}else {
						period.addClass('hide');	
					}					   
				});
				
				lol.removeClass('hide');
			}
		})	
	}
});

Prices.implement(new Options());

window.addEvent('domready', function(){
	new Prices();
});MenuAccordionESL = new Class({
	initialize : function(){
		if ($$('.path ul').length < 1) return;
		
		//we get the seceond segment of path
		var path = $$('.path ul')[0].getChildren();
		if (path.length < 2) return;
		//we check if it exist in destmenu
		$$('.learninmenu')[0].getFirst().getChildren().each(function(li){
			if (li.getFirst().getText().clean().toLowerCase() == path[1].getText().match(/^> (.*)$/)[1].clean().toLowerCase()) {
				li.getElement('ul').setStyle('display', 'block');
				this.currentLi = li;
			}
		}, this);
		
		//we check if we need to add a selected class to submenu element
		if (path.length < 3 || !this.currentLi) return;
		this.currentLi.getElement('ul').getChildren().each(function(li){
			if (li.getFirst().getText().clean().toLowerCase() == path[2].getText().match(/^> (.*)$/)[1].clean().toLowerCase())
			 li.addClass('s');
		});	
	}
});

var event = window.ie ? 'load' : 'domready';
window.addEvent(event, function(){
	new MenuAccordionESL();
});
var Site = {
	/*
	Method: start
		-First method called on domready. This method instanciates necessary classes.
	*/
	start : function() {
		
		//Hits implements
		if($$('.hits').length >0){
			new hitsImplement({
				'type': 'content'
			});
		}
		//URL de succès de la Newsletter
		if($('awRetourOk')){
			var old = $('awRetourOk').value.replace(/\.\.\//g, "");
			$('awRetourOk').value = 'http://www.esl-schools.org/' + DefaultLang + '/' + old;
		}
		
		if($('awRetourErr')){
			var old = $('awRetourErr').value.replace(/\.\.\//g, "");
			$('awRetourErr').value = 'http://www.esl-schools.org/' + DefaultLang + '/' + old;
		}
	}
};


var hitsImplement = new Class({
							  
	options: {
		'applclass' : '.hits',
		'path' 		: '/cgi/hits_implement.cgi',
		'type'		: 'element',
		'lang'		: ''
		
	},	  
	
	initialize : function(options) {
		this.setOptions(options);
		this.addEventOnClasshits(options);
	},
	
	getParentDiv : function(el){
		var id;
		var idi;
		if (el.parentNode.getProperty('id')) {
			id = el.parentNode.getProperty('id').replace(/[^\d]/g,'');
			idi = id.toInt();
			return idi;
		}
		else {
			return	this.getParentDiv(el.parentNode);
		}
	},

	// -----------------------------------------------------------------
	addEventOnClasshits : function() {
		$$(this.options.applclass).each(function(element,e) {
			element.addEvent('click', function() { 
				var ID = this.getParentDiv(element);
				var label = element.getProperty('class').split(' ')[1];
				var name = element.getProperty('href').split('/').getLast();
				this.options.lang=$('site_language').value;
				this.incrHits({ 'label': label, 'name': name, 'type': this.options.type, 'iID': ID, 'lang': this.options.lang });
			}.bind(this));
		}.bind(this)) 
	},
	
	incrHits : function(data) {
		var param = 'lang='+this.options.lang+"&iID="+data.iID+"&name="+data.name+"&type="+this.options.type+'&label='+data.label;
		new Ajax(this.options.path, {
			method: 'post',
			data : param
		}).request();
	}
});

hitsImplement.implement(new Options());

window.addEvent('domready',function() {
	Site.start();
});/*
	keyfacts.js for mootools v1.1
	by ESL.ch - MIT-style license
*/

var KeyFacts = new Class({
	initialize: function(options){
		if($('keyfacts').getChildren().length == 0) {
			$('keyfacts').getPrevious().remove();
			$('keyfacts').getNext().remove();
			$('keyfacts').remove();
		}
		
	}
	
});


// Execute the site.start
window.addEvent('domready', function() {
	if($('keyfacts')) new KeyFacts();
});
/*
	Class: News
		
	Parameters:
			
	Exemple:
	
	About:
	
*/
var News = new Class({
	/*
		Initialize
	*/
	
	
	initialize : function() {
		var itemID = $get('#', document.URL );
	 $$('.newsbox').setStyle('display', 'block');
	 
	 var selected = ($(itemID)) ? $(itemID) : false;
  
	 $$('.topnewsbox').each(function(el){
	 	var open;
		var block = el.getNext();
		var fx = new Fx.Slide(block, {
			onStart : function(){
				if(!el.hasClass('s')){
					el.addClass('s');
					open = true;
				}else open = false;
			},
			onComplete: function(){
				if(!open) el.removeClass('s');
			}
		});
		
 		if (el.getParent() != selected) fx.hide();
		else el.addClass('s');
		el.addEvent('click', function(){
 		fx.toggle();
		
	 	});
	 });
	}
});
window.addEvent('domready', function(){
	new News();
	
});

function $get(key,url){  
if(arguments.length < 2) url =location.href;  
if(arguments.length > 0 && key != ""){  
    if(key == "#"){  
        var regex = new RegExp("[#]([^$]*)");  
    } else if(key == "?"){  
        var regex = new RegExp("[?]([^#$]*)");  
    } else {  
        var regex = new RegExp("[?&]"+key+"=([^&#]*)");
    }  
    var results = regex.exec(url);  
    return (results == null )? "" : results[1];  
} else {  
    url = url.split("?");  
    var results = {};  
        if(url.length > 1){  
            url = url[1].split("#");  
            if(url.length > 1) results["hash"] = url[1];  
            url[0].split("&").each(function(item,index){  
                item = item.split("=");  
                results[item[0]] = item[1];  
            });  
        }  
    return results;  
}  
}
var newsBox = new Class({
	/*
		Initialize
	*/
	
	
	initialize : function(el) {
		if ($$('.txtnews .item_content').length>0 && MstkHelpers.qsVar('init') !== 'false')
			MstkInit.go($$('.txtnews .item_content'), true);
	}

});


window.addEvent('domready', function(){
	new newsBox();
});

/*
Script: moostick dot js
    A Mootools-powered, unobtrusive, Javascript news ticker library. /mouthful

About:
    <Moostick> will take in any type of li-containing element and turn it into
    an animated news ticker, fading between each headline at a set interval.

Version:
    - Version: 1.0

Homepage:
    - Moostick @ tekArtist <http://tekartist.org/labs/mootools/moostick/>

Requirements:
    - Cascading Style Sheets (CSS): <http://www.w3.org/Style/CSS/>
    - Javascript: <http://en.wikipedia.org/wiki/JavaScript>
    - MooTools: <http://mootools.net/>
    
Copyright:
    copyright (c) 2007 Stephane Daury: <http://stephane.daury.org/>

License: 
    MIT License <http://www.opensource.org/licenses/mit-license.php>
    
    Copyright (c) 2007 Stephane Daury <http://stephane.daury.org/>
    
    Permission is hereby granted, free of charge, to any person obtaining a
    copy of this software and associated documentation files (the "Software"),
    to deal in the Software without restriction, including without limitation
    the rights to use, copy, modify, merge, publish, distribute, sublicense,
    and/or sell copies of the Software, and to permit persons to whom the
    Software is furnished to do so, subject to the following conditions:
    
    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.
    
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    DEALINGS IN THE SOFTWARE.

Notes: Procedural code
    Safety check    - Moostick checks that MooTools is present to avoid
                      errors and prompts to either cancel or be redirected
                      to the MooTools site for more info.
    Auto start mode - Moostick auto-starts by default, unless passed init=0
                      in the script's query string for more selective
                      interaction. <MstkHelpers> must be implemented before
                      this step.
*/

if(typeof(window['MooTools']) == 'undefined'){

    // See: <Procedural code>
    
    var mstkRedirect = 'http:/www.mootools.net/';

    if(confirm('Moostick requires the MooTools JavaScript framework.\n'
               + 'Be sure to include it before Moostick.\n\n'
               + 'Click OK for more info, or Cancel to load the page without it.')){
        top.location.href = redirect;
    }
}
else{

    /*
    Class: MstkHelpers 
        (singleton) Utility class containing helper methods that will be helpful in other
        classes.
       
    Notes:
       - Can be used before "ondomready" or "onload" are achieved, and is
         currently required by the auto-start procedure.
       - Can be used directly or have its methods implemented other Classes.
    
    Example:
        (start code)
            alert(MstkHelpers.qsVar('myKey'));
        (end)
    */
    var MstkHelpers = {
        
        // Group: Public Methods
        
        /*
        Method: qsVar
            Query string helper for the Moostick script (NOT the document
            that included it). Takes a query string key, and returns the
            value, or false if not found.    
        
        Arguments:
            key - the key (key=val) to search for, as string.
        
        Returns:
            val - the key's value as string or false if not found.
        */
        qsVar: function(key){
            var val = false;
            if(key.length > 0){
                $ES('script').each(function(s){
                    if(s.src.match('moostick.js?')){
                        var uriParts = s.src.split('?');
                        if(uriParts[1]){
                            uriParts[1].split('&').each(function(keyPair){
                                var tmp = keyPair.split('=');
                                if(tmp[1] && tmp[0] == key)
                                    val = tmp[1];
                            });
                        }
                    }
                });
            }
            return val;
        },
        
        /*
        Method: checkArray
            Checks if the sent value is an array or convert it. Very useful
            when you do not know if you are dealing with an single element
            through $()/$E()/etc or multiple elements through $$()/$E()/etc.
        
        Arguments:
            val - the value to check
        
        Returns:
            val - the sent value if already an array, or a single-item array.
        */
        checkArray: function(val){
            if(!val[0])
                return [val];
            else
                return val;
        }
    
    } // end MstkHelpers


    // See: <Procedural code>
    
    /*if(MstkHelpers.qsVar('init') !== 'false'){
        window.addEvent('domready', function() {
            MstkInit.go(false, true);
        });
    }*/


    /*
    Class: MstkInit
        (singleton) A multi-list utility wrapper for the Moostick class and processes.
       
    Notes:
       - Used in auto-start mode to scan the DOM for targeted elements.
       - Also supports concept of safe v. fast mode, like <MooStick>.
       - When opting to turn off auto-start, it is advised to instantiate
         the <Moostick> class directly with a single known list. On the other
         hand, MstkInit will let you pass multiple ones, such as when dealing
         with css classes instead of ids, etc.    
    
    Example:
        (start code)
            // Enable Moostick on any element with "my-custom-class" css class.
            MstkInit.go($$('.my-custom-class'), true);
        (end)
    */
    var MstkInit = {
        
        // Group: Public Properties
        
        /*
        Property: lists
        	One or more list (ul, ol...) from $(), $$(), etc.
        	If passed as false, MstkInit will try to search the
			DOM for list with an id of moostick, or lists with
			a class of moostick.
        */
        lists        : false,
        
        /*
        Property: autoStart
        	Boolean. Should the constructor launch the DOM
        	modification process, or just set the properties.
        */
        autoStart    : false,
        
        /*
        Property: interval
        	Passthru variable. See: <Moostick.interval>.
        */
        interval     : 3500,
        
        /*
        Property: fxOptions
        	Passthru variable. See: <Moostick.fxOptions>.
        */
        fxOptions    : {},
        
        /*
        Property: trust4Speed
        	Set to true to bypass element validation, for increased
        	rendering speed, but only if you're absolutely sure
			about the <MstkInit.lists> you passed in.
        */
        trust4Speed  : false,
        
        /*
        Property: trustOpacity
        	Passthru variable. See: <Moostick.trustOpacity>.
        */
        trustOpacity : false,
        
        // Group: Public Methods
        
        /*
        Method: go
            Sets the default properties and launches the Moostick modification
            process if in auto-start mode.
        
        Arguments:
         	lists        - See: <MstkInit.lists>
        	autoStart    - See: <MstkInit.autoStart>
        	interval     - See: <MstkInit.interval>
        	fxOptions    - See: <MstkInit.fxOptions>
        	trust4Speed  - See: <MstkInit.trust4Speed>
        	trustOpacity - See: <MstkInit.trustOpacity>
        */
        go: function(lists, autoStart, interval, fxOptions, trust4Speed, trustOpacity) {
            this.lists        = (!lists)
                              ? this.lists
                              : lists;
    
            this.autoStart    = (autoStart === true)
                              ? autoStart
                              : this.autoStart;
            
            this.interval     = (!interval) || (interval.toInt() < 500)
                              ? this.interval
                              : interval.toInt();
            
            this.fxOptions    = ((!fxOptions) || (typeof(fxOptions) != 'object'))
                              ? this.fxOptions
                              : fxOptions;
            
            this.trust4Speed  = (trust4Speed === true)
                              ? trust4Speed
                              : this.trust4Speed;
            
            this.trustOpacity = (trustOpacity === true)
                              ? trustOpacity
                              : this.trustOpacity;
    
            if(this.autoStart === true){
                if(this.trust4Speed === true){
                    // Kamikaze mode!
                    this._fastMode();
                }
                else{
                    // Cautious mode
                    this._safeMode();
                }
            }
        },
        
        // Group: Private Methods
        
        /*
        Method: _fastMode
            AKA the Kamikaze mode. Instantiate a <Moostick> object for each
			<MstkInit.lists>, without any validation, besides making sure
			we have an array to loop on.
        */
        _fastMode: function(){
            this.lists = MstkHelpers.checkArray(this.lists);
            this.lists.each(function(list){
                new Moostick(
                    list,
                    this.autoStart,
                    this.interval,
                    this.fxOptions,
                    this.trust4Speed,
                    this.trustOpacity
                )
            }, this);
        },
        
        /*
        Method: _safeMode
            AKA the cautious mode. First validates the passed <MstkInit.lists>
            or tries to auto-discover targeted DOM elements with "moostick"
			as an id or class, then calls <Moostick> for each list.
        */
        _safeMode: function(){
            
            if(this.lists === false){
                var defaultLists = false;
                
                // Scan for a list with the recommended default id
                if($('moostick'))
                    defaultLists = [$('moostick')];
    
                // Or can for (a) list(s) with the recommended default class
                else if($$('.moostick'))
                    defaultLists = $$('.moostick');
                
                this.lists = (!defaultLists) ? false : defaultLists;
            }
     
            if(this.lists){
                this.lists = MstkHelpers.checkArray(this.lists);
                this.lists.each(function(list){
                    new Moostick(
                        list,
                        this.autoStart,
                        this.interval,
                        this.fxOptions,
                        this.trust4Speed,
                        this.trustOpacity
                    )
                }, this);
            }
        }
    
    } // end MstkInit


    /*
    Class: Moostick
        Modifies the presentation and behaviour of li-containing elements to
        act as pseudo news tickers, and extends their DOM with itself
		(eg: myUL.moostick) for easy manipulation.
    
    Example: Programming
        (start code)
            // Auto-discovery mode, looking for li-containing elements with
			// an id (single) or class of "moostick", then auto-starts.
            new Moostick();
            $('moostick').moostick.stopTick();

            // Instantiate Moostick for the "my-custom-id" element. Do
			// not auto-start. Fade every 5 seconds, for 1/2 second.
			// Trust the list I sent, but handle the opacity assignment.
            var myList = new Moostick(
            	$('my-custom-id'),
				false,
				5000,
				{duration: 500},
				true,
				false
            );
            myList.startTick();
        (end)
    */
    var Moostick = Class({
        
        // Group: Public Properties
        
        /*
        Property: version
        	Moostick release version
        */
        version         : '1.0',
        
        /*
        Property: list
        	A single list (ul, ol...) from $(), $E(), etc.
        	This is the element to which Mostick will attach
        	itself. EG: myUL.moostick.stopTick();
        */
        list         : {},
        
        /*
        Property: autoStart
        	Boolean. Should the constructor launch the DOM
        	modification process, or just set the properties.
        */
        
        autoStart    : false,
        /*
        Property: interval
        	Defines duration for which each headline is
        	displayed including transition time, which
        	can be adjusted through <Moostick.fxOptions>.
        */
        
        interval     : 3500,
        
        /*
        Property: fxOptions
        	MooTools effect options for the opacity change used
        	in the transition. See the MooTools docs for details.
        	<http://docs.mootools.net/Effects/Fx-Base.js#Fx.Base>
        */
        fxOptions    : {},
        
        /*
        Property: trust4Speed
        	Set to true to bypass element validation, for
            increased rendering speed, but only if you're
            absolutely sure about the <Moostick.list> you
            passed in. See also: <Moostick.trustOpacity>.
        */
        trust4Speed  : false,
        
        /*
        Property: trustOpacity
        	Set to true to bypass element styles validation,
            for increased rendering speed, but only if you're
            absolutely sure about the <Moostick.list> you sent.
            When ON, we do not loop through each li to set
            the opacity to 0, therefore assuming you dealt
            with it in your stylesheets.
        */
        trustOpacity : false,
        
        // Group: Private Properties
        
        /*
        Property: _firstRun
        	True if the first time we run.
        */
        _firstRun    : true,
        
        /*
        Property: _elSched
        	Element schedule object.
        */
        _elSched     : null,
        
        /*
        Property: _fx
        	Opacity change effect.
        */
        _fx: false,
        
        // Group: Public Methods

        /*
        Method: initialize
            MooTools pseudo constructor. Sets the default properties and
            launches the Moostick modification process if in auto-start mode.
        
        Arguments:
         	list         - See: <Moostick.list>
        	autoStart    - See: <Moostick.autoStart>
        	interval     - See: <Moostick.interval>
        	fxOptions    - See: <Moostick.fxOptions>
        	trust4Speed  - See: <Moostick.trust4Speed>
        	trustOpacity - See: <Moostick.trustOpacity>
        */
        initialize: function(list, autoStart, interval, fxOptions, trust4Speed, trustOpacity) {
            this.list         = ((!list) || (typeof(list) != 'object'))
                              ? this.list
                              : list;
    
            this.autoStart    = (autoStart === true)
                              ? autoStart
                              : this.autoStart;
            
            this.interval     = (!interval) || (interval.toInt() < 500)
                              ? this.interval
                              : interval.toInt();
            
            this.fxOptions    = ((!fxOptions) || (typeof(fxOptions) != 'object'))
                              ? this.fxOptions
                              : fxOptions;
            
            this.trust4Speed  = (trust4Speed === true)
                              ? trust4Speed
                              : this.trust4Speed;
            
            this.trustOpacity = (trustOpacity === true)
                              ? trustOpacity
                              : this.trustOpacity;
            
            this.list.moostick = this;
            
            if(this.autoStart === true){
                if(this.trust4Speed === true){
                    // Kamikaze mode!
                    this._fastMode();
                }
                else{
                    // Cautious mode
                    this._safeMode();
                }
            }
        },
        
        /*
        Method: startTick
            Calls <Moostick.initialize> on-demand, always in auto-start mode.
        
        Arguments:
         	lists        - See: <Moostick.list>
        	interval     - See: <Moostick.interval>
        	fxOptions    - See: <Moostick.fxOptions>
        	trust4Speed  - See: <Moostick.trust4Speed>
        	trustOpacity - See: <Moostick.trustOpacity>
        
        See also:
        	<Moostick.stopTick>, <Moostick.pauseTick>
        	and <Moostick.resumeTick>.
        */
        startTick: function(list, interval, fxOptions, trust4Speed, trustOpacity){
            this.initialize(list, true, interval, fxOptions, trust4Speed, trustOpacity);
        },
        
        /*
        Method: stopTick
            Stops the ticker completely, including the attached mouse events.
        
        See also:
        	<Moostick.startTick>.
        */
        stopTick: function(){
            // TODO: figure out why removeEvent isn't working here
            this.list.$events.mouseenter = false;
            this.list.$events.mouseleave = false;
            this.pauseTick();
        },
        
        /*
        Method: pauseTick
            Pauses the ticker.
        
        See also:
        	<Moostick.resumeTick> and <Moostick.stopTick>.
        */
        pauseTick: function(){
            this._elSched = $clear(this._elSched);
        },    
        
        /*
        Method: resumeTick
            Un-pauses the ticker.
        
        See also:
        	<Moostick.pauseTick> and <Moostick.stopTick>.
        */
        resumeTick: function(){
            this._schedule();
        },
        
        // Group: Private Methods
        
        /*
        Method: _fastMode
            AKA the Kamikaze mode. Bypasses all element validation.
        */
        _fastMode: function(){
            this._liHandler();
            this._schedule();
        },
        
        /*
        Method: _safeMode
            AKA the cautious mode. Validates the passed <Moostick.list> and
            tries to apply arbitray default styles before lauching the ticker.
        */
        _safeMode: function(){
     
            if(this.list){
     
                if($ES('li', this.list)){
                    var items = $ES('li', this.list);
                    // Assign proprietary CSS class if not already assigned
                    if(!this.list.hasClass('moostick')) this.list.addClass('moostick');
                   
                    // Test for an indication of existing style assignements,
                    var noStyle = false;
                    if( this.list.getStyle('overflow') != 'hidden'
                        || items[0].getStyle('display') != 'block'
                        || items[0].getStyle('list-style-type') != 'none'){
                        // we'll assume (!) no compatible style has been applied
                        noStyle = true;
                    }
                        
                    if(noStyle){                
                        this.list.setStyles({
                            'display' : 'block',
                            /*'height'  : '1.1em',*/
                            'margin'  : 0,
                            'padding' : '2px 0 2px 0',
                            'overflow': 'hidden'
                        });
                        
                        this._liHandler({
                            'display'        : 'block',
                            'list-style-type': 'none',
                            'margin'         : '0 auto 0 auto',
                            'padding'        : 0
                        });
                    }
                    else{
                        this._liHandler();
                    }
                    
                    // We should now have a *more* trustworthy environment
                    this._schedule();
                }
            }
        },
        
        /*
        Method: _setMouseEvents
            Sets the mouse events to pause the ticker when the mourse
            cursor enters the display area. Greatly helps with usability,
            while still remaining unobstrusive. Uses MooTools' mouseenter
            and mouseenter.
        */
        _setMouseEvents: function(){  
            this.list.addEvents({
                'mouseenter': function(){
                    this.moostick.pauseTick();
                },
                'mouseleave': function(){
                    this.moostick.resumeTick();
                }
            });
        },
        
        /*
        Method: _liHandler
        	Loops through the list's li elements to set the styles and opacity. 
        
        Arguments:
        	styles - See <http://docs.mootools.net/Native/Element.js#Element.setStyles>
        */
        _liHandler: function(styles){
            // Verify styles value and format
            if((!styles) || (typeof(styles) != 'object')) styles = false;
            
            // no need to even loop if no styles were sent and trusting opacity
            if((this.trustOpacity !== true) || (styles !== false)){
                
                $ES('li', this.list).each(function(li){
                    // Apply styles before forcing opacity
                    if(styles !== false) li.setStyles(styles);
                    
                    // Turn off all li but first
                    if(this.trustOpacity !== true)
                        li.setOpacity(0);
                });
            }
        },
        
        /*
        Method: _schedule
        	Prepares for and schedules <Moostick._run>.
        	Also sets up <Moostick._setMouseEvents>. 
        */
        _schedule: function(){
            if(!this._elSched){
                // Define if we should fade the first item in or not.
                var firstItem = $E('li', this.list);
                if(firstItem.getStyle('opacity') != 1)
                    this._fadeIn(firstItem);
                else if(this._firstRun === true)
                    this._fadeIn(firstItem);
                
                // Schedule <Moostick._run>
                this._elSched = this._run.periodical(
                    this.interval,
                    this,
                    this.list
                );
                
                // Set <Moostick._setMouseEvents>
                listEvents = this.list.$events;
                if(!listEvents)
                    this._setMouseEvents();
                else if((!listEvents.mouseenter) && (!listEvents.mouseleave))
                    this._setMouseEvents();
            }
        },
        
        /*
        Method: _run
        	Moostick transition: move first to last, fade new first in
        	then set opacity on new last to 0.
        */
        _run: function(){
            var items = $ES('li', this.list);
            
            // If we have at least 2
            if(items[1]){
                // Move first to last
                items[0].injectAfter(items.getLast());
                
                // Fade new first in
                this._fadeIn(items[1]);
                
                // Set new last off, for future fade in
                $ES('li', this.list).getLast().setOpacity(0);
            }
        },
        
        /*
        Method: _fadeIn
        	Handles the MooTools opacity effect, from 0 to 1
        
        Arguments:
        	item - li element to apply the effect to. 
        */
        _fadeIn: function(item){
            this._fx = item.effect('opacity', this.fxOptions).start(0,1);
            this._firstRun = false;
        }
    
    }); // end Moostick
    
}
/*
	pricetab.js for mootools v1.1
	by ESL.ch - MIT-style license
*/

var PriceTab = new Class({
	initialize: function(options){
		
		var tabs = $('schooltabs').getFirst().getNext().getChildren();
		var link2009 = tabs[tabs.length-2].getElement('a');
		
		/* consider/or not the border */
		var margin = (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) ? 0 : 1;
		/* fix bug with Firefox for mac */
		margin = ((/Firefox/).test(navigator.userAgent) && (/Mac/).test(navigator.platform)) ? 2 : margin;
		
		/* create link for price 2009 */
		new Element('a', {'href': link2009.getProperty('href'), 'class': link2009.getParent().getProperty('class')}).setText('2009').injectTop($('pricesyear'));
		
		/* effect open/close */
		var height = $('pricesyear').setStyle('display','block').getCoordinates().height;
		var fx = new Fx.Style('pricesyear','height').set(0);
		
		/* set the position and width for sub-tabs container */
		$('pricesyear').setStyles({
			'left': link2009.getCoordinates().left.toInt()-$('schooltabs').getCoordinates().left.toInt()-margin,
			'width': link2009.getCoordinates().width
		});
		
		/* stop the propagation and open/close the submenu */
		link2009.addEvent('click', function(e){
			new Event(e).stop();
			if(!$('pricesyear').hasClass('s'))
				($('pricesyear').getStyle('height') == '0px') ? fx.start(height) : fx.start(0);
		});
		
		/* change submenu styles by adding a class */
		if (link2009.getParent().hasClass('s') || $('pricesyear').getLast().hasClass('s')) {
			$('pricesyear').addClass('s');
			link2009.getParent().addClass('s');
		}
		
	}
	
});


/*window.addEvent('domready', function() {
	if($('pricesyear')) new PriceTab();
});*/var sliderManager = new Class({
	
	initialize : function(){
		var current = 0;
		var fx = new Array();
		this.clearEmptyBox();
		
		$$('.tabs').each(function(tab, i){
			if(i != current) $$('.pictures')[i].setStyles({'display':'none', 'opacity': 0});
			fx[i] = new Fx.Style($$('.pictures')[i], 'opacity');
			tab.addEvent('click', function(e){
				new Event(e).stop();
				if (i != current){
					fx[current].start(1, 0);
					$$('.pictures')[current].setStyle('display','none');
					$$('.tabs')[current].removeClass('s');
					$$('.pictures')[i].setStyle('display','block');
					fx[i].start(0, 1);
					this.addClass('s');
					current = i;
				}
			})
		});
		
	},
	clearEmptyBox:function(){
		$$('.pictures').each(function(picture){
			if(picture.getChildren().length == 0){
				picture.remove();
			}
		});
	}

});


window.addEvent('domready', function() {
	if($$('.filemanager').length > 0) new sliderManager();
});/**
 * @author esl-yannick
 */
window.addEvent('domready', function(){
	if ($('page9')) {
		$$('.adult_brochure')[0].setStyles({display : 'block', margin: 0});
		$$('.juniors_brochure')[0].setStyles({display : 'block', margin: 0});
		var togglera = new Fx.Slide($$('.adult_brochure')[0], {
			wait: false
		}).hide();
		var togglerj = new Fx.Slide($$('.juniors_brochure')[0], {
			wait: false
		}).hide();
		$$('.juniors_brochure')[0].getParent().setStyle('position', 'relative');
		$$('.adult_brochure')[0].getParent().setStyle('position', 'relative');
		$('ADU').addEvent('click', function(e){
			this.checked ? togglera.slideIn() : togglera.slideOut();
			$$('.adult_brochure')[0].getParent().setStyle('padding', '5px 0 0 0');
			this.checked ? $$('.adult_brochure')[0].getParent().setStyles({padding : '5px 0',margin : '0 0 10px 0'}) : $$('.adult_brochure')[0].getParent().setStyles({padding : 0,margin : 0});
		});
		$('JUN').addEvent('click', function(e){
			this.checked ? togglerj.slideIn() : togglerj.slideOut();
			this.checked ? $$('.juniors_brochure')[0].getParent().setStyles({padding : '5px 0',margin : '0 0 10px 0'}) : $$('.juniors_brochure')[0].getParent().setStyles({padding : 0,margin : 0});
		})
	}
});window.addEvent('domready', function(){
	$$('.packages .header').each(function(el){
		el.getNext().setStyle('display','block');
		var fx= new Fx.Slide(el.getNext()).hide();
		el.addEvent('click',function(e){
			if (fx.open==false) {
				fx.slideIn();
			}else{
				fx.slideOut();
			}
			
		});
	});

});