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

eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('m 9A={9B:\'1.11\'};k $4S(Q){h(Q!=6V)};k $B(Q){o(!$4S(Q))h 15;o(Q.3E)h\'T\';m B=4P Q;o(B==\'2G\'&&Q.9z){1Q(Q.5e){Y 1:h\'T\';Y 3:h(/\\S/).2q(Q.7q)?\'9y\':\'9v\'}}o(B==\'2G\'||B==\'k\'){1Q(Q.6S){Y 1L:h\'1f\';Y 5g:h\'5f\';Y 1l:h\'65\'}o(4P Q.U==\'4b\'){o(Q.2o)h\'9w\';o(Q.6Z)h\'17\'}}h B};k $3A(){m 3R={};H(m i=0;i<17.U;i++){H(m F 1a 17[i]){m ap=17[i][F];m 4N=3R[F];o(4N&&$B(ap)==\'2G\'&&$B(4N)==\'2G\')3R[F]=$3A(4N,ap);19 3R[F]=ap}}h 3R};m $P=k(){m 1b=17;o(!1b[1])1b=[c,1b[0]];H(m F 1a 1b[1])1b[0][F]=1b[1][F];h 1b[0]};m $3s=k(){H(m i=0,l=17.U;i<l;i++){17[i].P=k(1t){H(m 1y 1a 1t){o(!c.1q[1y])c.1q[1y]=1t[1y];o(!c[1y])c[1y]=$3s.4I(1y)}}}};$3s.4I=k(1y){h k(V){h c.1q[1y].3F(V,1L.1q.73.1M(17,1))}};$3s(6d,1L,4q,70);k $3x(Q){h!!(Q||Q===0)};k $3N(Q,6W){h $4S(Q)?Q:6W};k $6f(3l,2g){h 1h.9C(1h.6f()*(2g-3l+1)+3l)};k $2A(){h 14 9D().9J()};k $69(1H){9K(1H);9I(1H);h 1j};m 2Y=k(Q){Q=Q||{};Q.P=$P;h Q};m 9H=14 2Y(M);m 9E=14 2Y(R);R.6X=R.2h(\'6X\')[0];M.2M=!!(R.4A);o(M.85)M.1Z=M[M.5B?\'9F\':\'6U\']=1d;19 o(R.76&&!R.9G&&!9u.9t)M.3b=M[M.2M?\'9h\':\'4Q\']=1d;19 o(R.9i!=1j)M.5i=1d;M.9j=M.3b;9g.P=$P;o(4P 3Z==\'6V\'){m 3Z=k(){};o(M.3b)R.6R("9f");3Z.1q=(M.3b)?M["[[9c.1q]]"]:{}}3Z.1q.3E=k(){};o(M.6U)3V{R.9d("9e",15,1d)}3O(e){};m 1l=k(2m){m 41=k(){h(17[0]!==1j&&c.1z&&$B(c.1z)==\'k\')?c.1z.3F(c,17):c};$P(41,c);41.1q=2m;41.6S=1l;h 41};1l.1W=k(){};1l.1q={P:k(2m){m 56=14 c(1j);H(m F 1a 2m){m 6T=56[F];56[F]=1l.6Y(6T,2m[F])}h 14 1l(56)},6p:k(){H(m i=0,l=17.U;i<l;i++)$P(c.1q,17[i])}};1l.6Y=k(2P,1G){o(2P&&2P!=1G){m B=$B(1G);o(B!=$B(2P))h 1G;1Q(B){Y\'k\':m 5T=k(){c.1m=17.6Z.1m;h 1G.3F(c,17)};5T.1m=2P;h 5T;Y\'2G\':h $3A(2P,1G)}}h 1G};m 6i=14 1l({9q:k(K){c.3e=c.3e||[];c.3e.1e(K);h c},6e:k(){o(c.3e&&c.3e.U)c.3e.7d().1N(10,c)},9p:k(){c.3e=[]}});m 2e=14 1l({1V:k(B,K){o(K!=1l.1W){c.$W=c.$W||{};c.$W[B]=c.$W[B]||[];c.$W[B].6t(K)}h c},1O:k(B,1b,1N){o(c.$W&&c.$W[B]){c.$W[B].1x(k(K){K.2j({\'V\':c,\'1N\':1N,\'17\':1b})()},c)}h c},4e:k(B,K){o(c.$W&&c.$W[B])c.$W[B].3d(K);h c}});m 6j=14 1l({4x:k(){c.C=$3A.3F(1j,[c.C].P(17));o(c.1V){H(m 2E 1a c.C){o($B(c.C[2E]==\'k\')&&(/^6r[A-Z]/).2q(2E))c.1V(2E,c.C[2E])}}h c}});1L.P({4U:k(K,V){H(m i=0,j=c.U;i<j;i++)K.1M(V,c[i],i,c)},2r:k(K,V){m 3u=[];H(m i=0,j=c.U;i<j;i++){o(K.1M(V,c[i],i,c))3u.1e(c[i])}h 3u},28:k(K,V){m 3u=[];H(m i=0,j=c.U;i<j;i++)3u[i]=K.1M(V,c[i],i,c);h 3u},4X:k(K,V){H(m i=0,j=c.U;i<j;i++){o(!K.1M(V,c[i],i,c))h 15}h 1d},9n:k(K,V){H(m i=0,j=c.U;i<j;i++){o(K.1M(V,c[i],i,c))h 1d}h 15},3I:k(2o,L){m 3m=c.U;H(m i=(L<0)?1h.2g(0,3m+L):L||0;i<3m;i++){o(c[i]===2o)h i}h-1},74:k(1w,U){1w=1w||0;o(1w<0)1w=c.U+1w;U=U||(c.U-1w);m 66=[];H(m i=0;i<U;i++)66[i]=c[1w++];h 66},3d:k(2o){m i=0;m 3m=c.U;5v(i<3m){o(c[i]===2o){c.4l(i,1);3m--}19{i++}}h c},1c:k(2o,L){h c.3I(2o,L)!=-1},9L:k(1A){m Q={},U=1h.3l(c.U,1A.U);H(m i=0;i<U;i++)Q[1A[i]]=c[i];h Q},P:k(1f){H(m i=0,j=1f.U;i<j;i++)c.1e(1f[i]);h c},3A:k(1f){H(m i=0,l=1f.U;i<l;i++)c.6t(1f[i]);h c},6t:k(2o){o(!c.1c(2o))c.1e(2o);h c},9M:k(){h c[$6f(0,c.U-1)]||1j},75:k(){h c[c.U-1]||1j}});1L.1q.1x=1L.1q.4U;1L.1x=1L.4U;k $A(1f){h 1L.74(1f)};k $1x(2R,K,V){o(2R&&4P 2R.U==\'4b\'&&$B(2R)!=\'2G\'){1L.4U(2R,K,V)}19{H(m 1s 1a 2R)K.1M(V||2R,2R[1s],1s)}};1L.1q.2q=1L.1q.1c;4q.P({2q:k(52,25){h(($B(52)==\'1J\')?14 5g(52,25):52).2q(c)},2N:k(){h 3J(c,10)},71:k(){h 3T(c)},5u:k(){h c.2H(/-\\D/g,k(2l){h 2l.5J(1).5l()})},6K:k(){h c.2H(/\\w[A-Z]/g,k(2l){h(2l.5J(0)+\'-\'+2l.5J(1).3Q())})},7x:k(){h c.2H(/\\b[a-z]/g,k(2l){h 2l.5l()})},5x:k(){h c.2H(/^\\s+|\\s+$/g,\'\')},58:k(){h c.2H(/\\s{2,}/g,\' \').5x()},51:k(1f){m 29=c.2l(/\\d{1,3}/g);h(29)?29.51(1f):15},4C:k(1f){m 3j=c.2l(/^#?(\\w{1,2})(\\w{1,2})(\\w{1,2})$/);h(3j)?3j.73(1).4C(1f):15},1c:k(1J,s){h(s)?(s+c+s).3I(s+1J+s)>-1:c.3I(1J)>-1},a7:k(){h c.2H(/([.*+?^${}()|[\\]\\/\\\\])/g,\'\\\\$1\')}});1L.P({51:k(1f){o(c.U<3)h 15;o(c.U==4&&c[3]==0&&!1f)h\'ac\';m 3j=[];H(m i=0;i<3;i++){m 3H=(c[i]-0).3z(16);3j.1e((3H.U==1)?\'0\'+3H:3H)}h 1f?3j:\'#\'+3j.1I(\'\')},4C:k(1f){o(c.U!=3)h 15;m 29=[];H(m i=0;i<3;i++){29.1e(3J((c[i].U==1)?c[i]+c[i]:c[i],16))}h 1f?29:\'29(\'+29.1I(\',\')+\')\'}});6d.P({2j:k(C){m K=c;C=$3A({\'V\':K,\'G\':15,\'17\':1j,\'1N\':15,\'3c\':15,\'4g\':15},C);o($3x(C.17)&&$B(C.17)!=\'1f\')C.17=[C.17];h k(G){m 1b;o(C.G){G=G||M.G;1b=[(C.G===1d)?G:14 C.G(G)];o(C.17)1b.P(C.17)}19 1b=C.17||17;m 2v=k(){h K.3F($3N(C.V,K),1b)};o(C.1N)h ad(2v,C.1N);o(C.3c)h aj(2v,C.3c);o(C.4g)3V{h 2v()}3O(ak){h 15};h 2v()}},ai:k(1b,V){h c.2j({\'17\':1b,\'V\':V})},4g:k(1b,V){h c.2j({\'17\':1b,\'V\':V,\'4g\':1d})()},V:k(V,1b){h c.2j({\'V\':V,\'17\':1b})},ae:k(V,1b){h c.2j({\'V\':V,\'G\':1d,\'17\':1b})},1N:k(1N,V,1b){h c.2j({\'1N\':1N,\'V\':V,\'17\':1b})()},3c:k(72,V,1b){h c.2j({\'3c\':72,\'V\':V,\'17\':1b})()}});70.P({2N:k(){h 3J(c)},71:k(){h 3T(c)},8f:k(3l,2g){h 1h.3l(2g,1h.2g(3l,c))},3o:k(3M){3M=1h.3k(10,3M||0);h 1h.3o(c*3M)/3M},9S:k(K){H(m i=0;i<c;i++)K(i)}});m I=14 1l({1z:k(q,1t){o($B(q)==\'1J\'){o(M.1Z&&1t&&(1t.1s||1t.B)){m 1s=(1t.1s)?\' 1s="\'+1t.1s+\'"\':\'\';m B=(1t.B)?\' B="\'+1t.B+\'"\':\'\';5G 1t.1s;5G 1t.B;q=\'<\'+q+1s+B+\'>\'}q=R.6R(q)}q=$(q);h(!1t||!q)?q:q.2u(1t)}});m 1D=14 1l({1z:k(O){h(O)?$P(O,c):c}});1D.P=k(1t){H(m 1y 1a 1t){c.1q[1y]=1t[1y];c[1y]=$3s.4I(1y)}};k $(q){o(!q)h 1j;o(q.3E)h 1R.3r(q);o([M,R].1c(q))h q;m B=$B(q);o(B==\'1J\'){q=R.4m(q);B=(q)?\'T\':15}o(B!=\'T\')h 1j;o(q.3E)h 1R.3r(q);o([\'2G\',\'9T\'].1c(q.4Z.3Q()))h q;$P(q,I.1q);q.3E=k(){};h 1R.3r(q)};R.54=R.2h;k $$(){m O=[];H(m i=0,j=17.U;i<j;i++){m 1r=17[i];1Q($B(1r)){Y\'T\':O.1e(1r);Y\'9R\':1u;Y 15:1u;Y\'1J\':1r=R.54(1r,1d);6c:O.P(1r)}}h $$.4a(O)};$$.4a=k(1f){m O=[];H(m i=0,l=1f.U;i<l;i++){o(1f[i].$4k)77;m T=$(1f[i]);o(T&&!T.$4k){T.$4k=1d;O.1e(T)}}H(m n=0,d=O.U;n<d;n++)O[n].$4k=1j;h 14 1D(O)};1D.4F=k(F){h k(){m 1b=17;m 1g=[];m O=1d;H(m i=0,j=c.U,2v;i<j;i++){2v=c[i][F].3F(c[i],1b);o($B(2v)!=\'T\')O=15;1g.1e(2v)};h(O)?$$.4a(1g):1g}};I.P=k(2m){H(m F 1a 2m){3Z.1q[F]=2m[F];I.1q[F]=2m[F];I[F]=$3s.4I(F);m 6Q=(1L.1q[F])?F+\'1D\':F;1D.1q[6Q]=1D.4F(F)}};I.P({2u:k(1t){H(m 1y 1a 1t){m 3a=1t[1y];1Q(1y){Y\'8l\':c.6J(3a);1u;Y\'W\':o(c.5t)c.5t(3a);1u;Y\'2m\':c.7r(3a);1u;6c:c.4R(1y,3a)}}h c},3h:k(q,6G){q=$(q);1Q(6G){Y\'6H\':q.2s.64(c,q);1u;Y\'6F\':m 3X=q.6L();o(!3X)q.2s.5q(c);19 q.2s.64(c,3X);1u;Y\'2n\':m 5Y=q.60;o(5Y){q.64(c,5Y);1u}6c:q.5q(c)}h c},9V:k(q){h c.3h(q,\'6H\')},8e:k(q){h c.3h(q,\'6F\')},a2:k(q){h c.3h(q,\'5N\')},a0:k(q){h c.3h(q,\'2n\')},8b:k(){m O=[];$1x(17,k(6E){O=O.6o(6E)});$$(O).3h(c);h c},3d:k(){h c.2s.7p(c)},9Z:k(6C){m q=$(c.9W(6C!==15));o(!q.$W)h q;q.$W={};H(m B 1a c.$W)q.$W[B]={\'1A\':$A(c.$W[B].1A),\'1v\':$A(c.$W[B].1v)};h q.4f()},9X:k(q){q=$(q);c.2s.9Y(q,c);h q},7o:k(1T){c.5q(R.al(1T));h c},57:k(1o){h c.1o.1c(1o,\' \')},6I:k(1o){o(!c.57(1o))c.1o=(c.1o+\' \'+1o).58();h c},6D:k(1o){c.1o=c.1o.2H(14 5g(\'(^|\\\\s)\'+1o+\'(?:\\\\s|$)\'),\'$1\').58();h c},8K:k(1o){h c.57(1o)?c.6D(1o):c.6I(1o)},2U:k(F,J){1Q(F){Y\'1S\':h c.6O(3T(J));Y\'8y\':F=(M.1Z)?\'8C\':\'8D\'}F=F.5u();1Q($B(J)){Y\'4b\':o(![\'8H\',\'6N\'].1c(F))J+=\'3S\';1u;Y\'1f\':J=\'29(\'+J.1I(\',\')+\')\'}c.1n[F]=J;h c},6J:k(2S){1Q($B(2S)){Y\'2G\':I.4h(c,\'2U\',2S);1u;Y\'1J\':c.1n.61=2S}h c},6O:k(1S){o(1S==0){o(c.1n.4Y!="4T")c.1n.4Y="4T"}19{o(c.1n.4Y!="6P")c.1n.4Y="6P"}o(!c.4W||!c.4W.8I)c.1n.6N=1;o(M.1Z)c.1n.2r=(1S==1)?\'\':"8v(1S="+1S*9a+")";c.1n.1S=c.$2V.1S=1S;h c},24:k(F){F=F.5u();m 1p=c.1n[F];o(!$3x(1p)){o(F==\'1S\')h c.$2V.1S;1p=[];H(m 1n 1a I.2Q){o(F==1n){I.2Q[1n].1x(k(s){m 1n=c.24(s);1p.1e(3J(1n)?1n:\'7w\')},c);o(F==\'2L\'){m 4X=1p.4X(k(3H){h(3H==1p[0])});h(4X)?1p[0]:15}h 1p.1I(\' \')}}o(F.1c(\'2L\')){o(I.2Q.2L.1c(F)){h[\'6B\',\'62\',\'67\'].28(k(p){h c.24(F+p)},c).1I(\' \')}19 o(I.7c.1c(F)){h[\'7u\',\'7v\',\'7l\',\'7k\'].28(k(p){h c.24(\'2L\'+p+F.2H(\'2L\',\'\'))},c).1I(\' \')}}o(R.6M)1p=R.6M.94(c,1j).98(F.6K());19 o(c.4W)1p=c.4W[F]}o(M.1Z)1p=I.7y(F,1p,c);o(1p&&F.2q(/4G/i)&&1p.1c(\'29\')){h 1p.4n(\'29\').4l(1,4).28(k(4G){h 4G.51()}).1I(\' \')}h 1p},8o:k(){h I.6a(c,\'24\',17)},44:k(53,1w){53+=\'96\';m q=(1w)?c[1w]:c[53];5v(q&&$B(q)!=\'T\')q=q[53];h $(q)},8O:k(){h c.44(\'2P\')},6L:k(){h c.44(\'3X\')},8M:k(){h c.44(\'3X\',\'60\')},75:k(){h c.44(\'2P\',\'8T\')},8R:k(){h $(c.2s)},8S:k(){h $$(c.76)},63:k(q){h!!$A(c.2h(\'*\')).1c(q)},4M:k(F){m 2B=I.4H[F];o(2B)h c[2B];m 5P=I.7a[F]||0;o(!M.1Z||5P)h c.8U(F,5P);m 5X=c.8Q[F];h(5X)?5X.7q:1j},99:k(F){m 2B=I.4H[F];o(2B)c[2B]=\'\';19 c.8Z(F);h c},8Y:k(){h I.6a(c,\'4M\',17)},4R:k(F,J){m 2B=I.4H[F];o(2B)c[2B]=J;19 c.8t(F,J);h c},7r:k(2S){h I.4h(c,\'4R\',2S)},7t:k(){c.7n=$A(17).1I(\'\');h c},8s:k(1T){m 2p=c.3p();o([\'1n\',\'3G\'].1c(2p)){o(M.1Z){o(2p==\'1n\')c.7m.61=1T;19 o(2p==\'3G\')c.4R(\'1T\',1T);h c}19{c.7p(c.60);h c.7o(1T)}}c[$4S(c.68)?\'68\':\'7s\']=1T;h c},9U:k(){m 2p=c.3p();o([\'1n\',\'3G\'].1c(2p)){o(M.1Z){o(2p==\'1n\')h c.7m.61;19 o(2p==\'3G\')h c.4M(\'1T\')}19{h c.7n}}h($3N(c.68,c.7s))},3p:k(){h c.4Z.3Q()},1W:k(){1R.4r(c.2h(\'*\'));h c.7t(\'\')}});I.7y=k(F,1p,T){o($3x(3J(1p)))h 1p;o([\'4O\',\'3q\'].1c(F)){m 1v=(F==\'3q\')?[\'2z\',\'5M\']:[\'2n\',\'5N\'];m 3i=0;1v.1x(k(J){3i+=T.24(\'2L-\'+J+\'-3q\').2N()+T.24(\'5s-\'+J).2N()});h T[\'2D\'+F.7x()]-3i+\'3S\'}19 o(F.2q(/2L(.+)6B|2f|5s/)){h\'7w\'}h 1p};I.2Q={\'2L\':[],\'5s\':[],\'2f\':[]};[\'7u\',\'7v\',\'7l\',\'7k\'].1x(k(7b){H(m 1n 1a I.2Q)I.2Q[1n].1e(1n+7b)});I.7c=[\'bV\',\'bW\',\'c2\'];I.6a=k(q,2c,1A){m 1p={};$1x(1A,k(22){1p[22]=q[2c](22)});h 1p};I.4h=k(q,2c,6n){H(m 22 1a 6n)q[2c](22,6n[22]);h q};I.4H=14 2Y({\'65\':\'1o\',\'H\':\'c0\',\'bX\':\'bY\',\'bZ\':\'bM\',\'bL\':\'bz\',\'bA\':\'bB\',\'by\':\'bx\',\'bu\':\'bv\',\'bw\':\'bC\',\'J\':\'J\',\'5A\':\'5A\',\'5m\':\'5m\',\'5O\':\'5O\',\'6k\':\'6k\'});I.7a={\'bD\':2,\'4s\':2};I.2d={4z:{35:k(B,K){o(c.5F)c.5F(B,K,15);19 c.bJ(\'6r\'+B,K);h c},7z:k(B,K){o(c.79)c.79(B,K,15);19 c.bK(\'6r\'+B,K);h c}}};M.P(I.2d.4z);R.P(I.2d.4z);I.P(I.2d.4z);m 1R={O:[],3r:k(q){o(!q.$2V){1R.O.1e(q);q.$2V={\'1S\':1}}h q},4r:k(O){H(m i=0,j=O.U,q;i<j;i++){o(!(q=O[i])||!q.$2V)77;o(q.$W)q.1O(\'4r\').4f();H(m p 1a q.$2V)q.$2V[p]=1j;H(m d 1a I.1q)q[d]=1j;1R.O[1R.O.3I(q)]=1j;q.3E=q.$2V=q=1j}1R.O.3d(1j)},1W:k(){1R.3r(M);1R.3r(R);1R.4r(1R.O)}};M.35(\'6v\',k(){M.35(\'5r\',1R.1W);o(M.1Z)M.35(\'5r\',bI)});m 2b=14 1l({1z:k(G){o(G&&G.$78)h G;c.$78=1d;G=G||M.G;c.G=G;c.B=G.B;c.2y=G.2y||G.bH;o(c.2y.5e==3)c.2y=c.2y.2s;c.7d=G.bE;c.bF=G.bG;c.c4=G.ci;c.ce=G.cb;o([\'5j\',\'3t\'].1c(c.B)){c.ca=(G.7e)?G.7e/c6:-(G.c7||0)/3}19 o(c.B.1c(\'22\')){c.4y=G.7h||G.c8;H(m 1s 1a 2b.1A){o(2b.1A[1s]==c.4y){c.22=1s;1u}}o(c.B==\'6A\'){m 4u=c.4y-cg;o(4u>0&&4u<13)c.22=\'f\'+4u}c.22=c.22||4q.c9(c.4y).3Q()}19 o(c.B.2q(/(6w|cd|cf)/)){c.ch={\'x\':G.5p||G.7j+R.26.49,\'y\':G.5o||G.7i+R.26.3Y};c.bs={\'x\':G.5p?G.5p-M.7Z:G.7j,\'y\':G.5o?G.5o-M.84:G.7i};c.aI=(G.7h==3)||(G.aG==2);1Q(c.B){Y\'6g\':c.1E=G.1E||G.aH;1u;Y\'6m\':c.1E=G.1E||G.89}c.7f()}h c},2w:k(){h c.4v().4w()},4v:k(){o(c.G.4v)c.G.4v();19 c.G.aM=1d;h c},4w:k(){o(c.G.4w)c.G.4w();19 c.G.bt=15;h c}});2b.4E={1E:k(){o(c.1E&&c.1E.5e==3)c.1E=c.1E.2s},7g:k(){3V{2b.4E.1E.1M(c)}3O(e){c.1E=c.2y}}};2b.1q.7f=(M.5i)?2b.4E.7g:2b.4E.1E;2b.1A=14 2Y({\'aP\':13,\'aE\':38,\'aD\':40,\'2z\':37,\'5M\':39,\'at\':27,\'au\':32,\'as\':8,\'ar\':9,\'5G\':46});I.2d.2e={1V:k(B,K){c.$W=c.$W||{};c.$W[B]=c.$W[B]||{\'1A\':[],\'1v\':[]};o(c.$W[B].1A.1c(K))h c;c.$W[B].1A.1e(K);m 4d=B;m 1K=I.2e[B];o(1K){o(1K.5K)1K.5K.1M(c,K);o(1K.28)K=1K.28;o(1K.B)4d=1K.B}o(!c.5F)K=K.2j({\'V\':c,\'G\':1d});c.$W[B].1v.1e(K);h(I.5E.1c(4d))?c.35(4d,K):c},4e:k(B,K){o(!c.$W||!c.$W[B])h c;m 23=c.$W[B].1A.3I(K);o(23==-1)h c;m 22=c.$W[B].1A.4l(23,1)[0];m J=c.$W[B].1v.4l(23,1)[0];m 1K=I.2e[B];o(1K){o(1K.3d)1K.3d.1M(c,K);o(1K.B)B=1K.B}h(I.5E.1c(B))?c.7z(B,J):c},5t:k(2S){h I.4h(c,\'1V\',2S)},4f:k(B){o(!c.$W)h c;o(!B){H(m 4D 1a c.$W)c.4f(4D);c.$W=1j}19 o(c.$W[B]){c.$W[B].1A.1x(k(K){c.4e(B,K)},c);c.$W[B]=1j}h c},1O:k(B,1b,1N){o(c.$W&&c.$W[B]){c.$W[B].1A.1x(k(K){K.2j({\'V\':c,\'1N\':1N,\'17\':1b})()},c)}h c},6z:k(L,B){o(!L.$W)h c;o(!B){H(m 4D 1a L.$W)c.6z(L,4D)}19 o(L.$W[B]){L.$W[B].1A.1x(k(K){c.1V(B,K)},c)}h c}};M.P(I.2d.2e);R.P(I.2d.2e);I.P(I.2d.2e);I.2e=14 2Y({\'6x\':{B:\'6g\',28:k(G){G=14 2b(G);o(G.1E!=c&&!c.63(G.1E))c.1O(\'6x\',G)}},\'6y\':{B:\'6m\',28:k(G){G=14 2b(G);o(G.1E!=c&&!c.63(G.1E))c.1O(\'6y\',G)}},\'3t\':{B:(M.5i)?\'5j\':\'3t\'}});I.5E=[\'6w\',\'bg\',\'bd\',\'be\',\'3t\',\'5j\',\'6g\',\'6m\',\'bq\',\'6A\',\'bp\',\'bo\',\'7T\',\'5r\',\'6v\',\'bm\',\'bn\',\'bc\',\'bb\',\'7E\',\'b1\',\'b2\',\'2K\',\'b0\',\'8r\',\'aZ\',\'3w\'];6d.P({aW:k(V,1b){h c.2j({\'V\':V,\'17\':1b,\'G\':2b})}});1D.P({b4:k(2p){h 14 1D(c.2r(k(q){h(I.3p(q)==2p)}))},8d:k(1o,1P){m O=c.2r(k(q){h(q.1o&&q.1o.1c(1o,\' \'))});h(1P)?O:14 1D(O)},8q:k(36,1P){m O=c.2r(k(q){h(q.36==36)});h(1P)?O:14 1D(O)},8i:k(1s,5R,J,1P){m O=c.2r(k(q){m 1G=I.4M(q,1s);o(!1G)h 15;o(!5R)h 1d;1Q(5R){Y\'=\':h(1G==J);Y\'*=\':h(1G.1c(J));Y\'^=\':h(1G.6u(0,J.U)==J);Y\'$=\':h(1G.6u(1G.U-J.U)==J);Y\'!=\':h(1G!=J);Y\'~=\':h 1G.1c(J,\' \')}h 15});h(1P)?O:14 1D(O)}});k $E(1r,2r){h($(2r)||R).7M(1r)};k $b6(1r,2r){h($(2r)||R).54(1r)};$$.2F={\'5f\':/^(\\w*|\\*)(?:#([\\w-]+)|\\.([\\w-]+))?(?:\\[(\\w+)(?:([!*^$]?=)["\']?([^"\'\\]]*)["\']?)?])?$/,\'2M\':{5b:k(1g,2i,12,i){m 1Y=[2i.b5?\'5n:\':\'\',12[1]];o(12[2])1Y.1e(\'[@36="\',12[2],\'"]\');o(12[3])1Y.1e(\'[1c(6o(" ", @65, " "), " \',12[3],\' ")]\');o(12[4]){o(12[5]&&12[6]){1Q(12[5]){Y\'*=\':1Y.1e(\'[1c(@\',12[4],\', "\',12[6],\'")]\');1u;Y\'^=\':1Y.1e(\'[b7-b8(@\',12[4],\', "\',12[6],\'")]\');1u;Y\'$=\':1Y.1e(\'[ba(@\',12[4],\', 1J-U(@\',12[4],\') - \',12[6].U,\' + 1) = "\',12[6],\'"]\');1u;Y\'=\':1Y.1e(\'[@\',12[4],\'="\',12[6],\'"]\');1u;Y\'!=\':1Y.1e(\'[@\',12[4],\'!="\',12[6],\'"]\')}}19{1Y.1e(\'[@\',12[4],\']\')}}1g.1e(1Y.1I(\'\'));h 1g},5S:k(1g,2i,1P){m O=[];m 2M=R.4A(\'.//\'+1g.1I(\'//\'),2i,$$.2F.8h,b9.b3,1j);H(m i=0,j=2M.aY;i<j;i++)O.1e(2M.aX(i));h(1P)?O:14 1D(O.28($))}},\'7L\':{5b:k(1g,2i,12,i){o(i==0){o(12[2]){m q=2i.4m(12[2]);o(!q||((12[1]!=\'*\')&&(I.3p(q)!=12[1])))h 15;1g=[q]}19{1g=$A(2i.2h(12[1]))}}19{1g=$$.2F.2h(1g,12[1]);o(12[2])1g=1D.8q(1g,12[2],1d)}o(12[3])1g=1D.8d(1g,12[3],1d);o(12[4])1g=1D.8i(1g,12[4],12[5],12[6],1d);h 1g},5S:k(1g,2i,1P){h(1P)?1g:$$.4a(1g)}},8h:k(7A){h(7A==\'5n\')?\'br://7H.bl.bk/bf/5n\':15},2h:k(2i,4Z){m 6h=[];H(m i=0,j=2i.U;i<j;i++)6h.P(2i[i].2h(4Z));h 6h}};$$.2F.2c=(M.2M)?\'2M\':\'7L\';I.2d.6s={4i:k(1r,1P){m 1g=[];1r=1r.5x().4n(\' \');H(m i=0,j=1r.U;i<j;i++){m 7K=1r[i];m 12=7K.2l($$.2F.5f);o(!12)1u;12[1]=12[1]||\'*\';m 1Y=$$.2F[$$.2F.2c].5b(1g,c,12,i);o(!1Y)1u;1g=1Y}h $$.2F[$$.2F.2c].5S(1g,c,1P)},7M:k(1r){h $(c.4i(1r,1d)[0]||15)},54:k(1r,1P){m O=[];1r=1r.4n(\',\');H(m i=0,j=1r.U;i<j;i++)O=O.6o(c.4i(1r[i],1d));h(1P)?O:$$.4a(O)}};I.P({4m:k(36){m q=R.4m(36);o(!q)h 15;H(m 1m=q.2s;1m!=c;1m=1m.2s){o(!1m)h 15}h q},bj:k(1o){h c.4i(\'.\'+1o)}});R.P(I.2d.6s);I.P(I.2d.6s);I.P({2I:k(){1Q(c.3p()){Y\'2K\':m 1v=[];$1x(c.C,k(2E){o(2E.6k)1v.1e($3N(2E.J,2E.1T))});h(c.5O)?1v:1v[0];Y\'7I\':o(!(c.5m&&[\'bi\',\'aV\'].1c(c.B))&&![\'4T\',\'1T\',\'aU\'].1c(c.B))1u;Y\'7D\':h c.J}h 15},87:k(){h $$(c.2h(\'7I\'),c.2h(\'2K\'),c.2h(\'7D\'))},ay:k(){m 5y=[];c.87().1x(k(q){m 1s=q.1s;m J=q.2I();o(J===15||!1s||q.5A)h;m 5C=k(3a){5y.1e(1s+\'=\'+ax(3a))};o($B(J)==\'1f\')J.1x(5C);19 5C(J)});h 5y.1I(\'&\')}});I.P({2O:k(x,y){c.49=x;c.3Y=y},5z:k(){h{\'3w\':{\'x\':c.49,\'y\':c.3Y},\'3i\':{\'x\':c.43,\'y\':c.42},\'5I\':{\'x\':c.4t,\'y\':c.4o}}},3g:k(1X){1X=1X||[];m q=c,2z=0,2n=0;az{2z+=q.aA||0;2n+=q.aC||0;q=q.aB}5v(q);1X.1x(k(T){2z-=T.49||0;2n-=T.3Y||0});h{\'x\':2z,\'y\':2n}},aw:k(1X){h c.3g(1X).y},av:k(1X){h c.3g(1X).x},aq:k(1X){m 5L=c.3g(1X);m Q={\'3q\':c.43,\'4O\':c.42,\'2z\':5L.x,\'2n\':5L.y};Q.5M=Q.2z+Q.3q;Q.5N=Q.2n+Q.4O;h Q}});I.2e.5h={5K:k(K){o(M.4L){K.1M(c);h}m 48=k(){o(M.4L)h;M.4L=1d;M.1H=$69(M.1H);c.1O(\'5h\')}.V(c);o(R.3L&&M.3b){M.1H=k(){o([\'4L\',\'7Y\'].1c(R.3L))48()}.3c(50)}19 o(R.3L&&M.1Z){o(!$(\'5c\')){m 4s=(M.ao.an==\'aO:\')?\'://0\':\'aQ:aR(0)\';R.aT(\'<3G 36="5c" aS 4s="\'+4s+\'"><\\/3G>\');$(\'5c\').4B=k(){o(c.3L==\'7Y\')48()}}}19{M.35("7T",48);R.35("aF",48)}}};M.aJ=k(K){h c.1V(\'5h\',K)};M.P({83:k(){o(c.4Q)h c.aK;o(c.7W)h R.4p.7V;h R.26.7V},82:k(){o(c.4Q)h c.cc;o(c.7W)h R.4p.7X;h R.26.7X},81:k(){o(c.1Z)h 1h.2g(R.26.43,R.26.4t);o(c.3b)h R.4p.4t;h R.26.4t},7R:k(){o(c.1Z)h 1h.2g(R.26.42,R.26.4o);o(c.3b)h R.4p.4o;h R.26.4o},7Q:k(){h c.7Z||R.26.49},7G:k(){h c.84||R.26.3Y},5z:k(){h{\'3i\':{\'x\':c.83(),\'y\':c.82()},\'5I\':{\'x\':c.81(),\'y\':c.7R()},\'3w\':{\'x\':c.7Q(),\'y\':c.7G()}}},3g:k(){h{\'x\':0,\'y\':0}}});m 18={};18.3f=14 1l({C:{5D:1l.1W,2T:1l.1W,5W:1l.1W,1B:k(p){h-(1h.7S(1h.5V*p)-1)/2},6q:c5,21:\'3S\',3y:1d,8m:50},1z:k(C){c.T=c.T||1j;c.4x(C);o(c.C.1z)c.C.1z.1M(c)},86:k(){m 2A=$2A();o(2A<c.2A+c.C.6q){c.7F=c.C.1B((2A-c.2A)/c.C.6q);c.2Z();c.30()}19{c.2w(1d);c.2u(c.N);c.1O(\'2T\',c.T,10);c.6e()}},2u:k(N){c.1i=N;c.30();h c},2Z:k(){c.1i=c.2W(c.L,c.N)},2W:k(L,N){h(N-L)*c.7F+L},1w:k(L,N){o(!c.C.3y)c.2w();19 o(c.1H)h c;c.L=L;c.N=N;c.7E=c.N-c.L;c.2A=$2A();c.1H=c.86.3c(1h.3o(c1/c.C.8m),c);c.1O(\'5D\',c.T);h c},2w:k(4K){o(!c.1H)h c;c.1H=$69(c.1H);o(!4K)c.1O(\'5W\',c.T);h c},1K:k(L,N){h c.1w(L,N)},c3:k(4K){h c.2w(4K)}});18.3f.6p(14 6i,14 2e,14 6j);18.2t={2K:k(F,N){o(F.2q(/4G/i))h c.67;m B=$B(N);o((B==\'1f\')||(B==\'1J\'&&N.1c(\' \')))h c.4F;h c.8g},2a:k(q,F,3n){o(!3n.1e)3n=[3n];m L=3n[0],N=3n[1];o(!$3x(N)){N=L;L=q.24(F)}m 1k=c.2K(F,N);h{\'L\':1k.2a(L),\'N\':1k.2a(N),\'1k\':1k}}};18.2t.8g={2a:k(J){h 3T(J)},3B:k(L,N,3D){h 3D.2W(L,N)},2I:k(J,21,F){o(21==\'3S\'&&F!=\'1S\')J=1h.3o(J);h J+21}};18.2t.4F={2a:k(J){h J.1e?J:J.4n(\' \').28(k(v){h 3T(v)})},3B:k(L,N,3D){m 1i=[];H(m i=0;i<L.U;i++)1i[i]=3D.2W(L[i],N[i]);h 1i},2I:k(J,21,F){o(21==\'3S\'&&F!=\'1S\')J=J.28(1h.3o);h J.1I(21+\' \')+21}};18.2t.67={2a:k(J){h J.1e?J:J.4C(1d)},3B:k(L,N,3D){m 1i=[];H(m i=0;i<L.U;i++)1i[i]=1h.3o(3D.2W(L[i],N[i]));h 1i},2I:k(J){h\'29(\'+J.1I(\',\')+\')\'}};18.62=18.3f.P({1z:k(q,F,C){c.T=$(q);c.F=F;c.1m(C)},8a:k(){h c.2u(0)},2Z:k(){c.1i=c.1k.3B(c.L,c.N,c)},2u:k(N){c.1k=18.2t.2K(c.F,N);h c.1m(c.1k.2a(N))},1w:k(L,N){o(c.1H&&c.C.3y)h c;m 1C=18.2t.2a(c.T,c.F,[L,N]);c.1k=1C.1k;h c.1m(1C.L,1C.N)},30:k(){c.T.2U(c.F,c.1k.2I(c.1i,c.C.21,c.F))}});I.P({bO:k(F,C){h 14 18.62(c,F,C)}});18.2Q=18.3f.P({1z:k(q,C){c.T=$(q);c.1m(C)},2Z:k(){H(m p 1a c.L)c.1i[p]=c.1k[p].3B(c.L[p],c.N[p],c)},2u:k(N){m 1C={};c.1k={};H(m p 1a N){c.1k[p]=18.2t.2K(p,N[p]);1C[p]=c.1k[p].2a(N[p])}h c.1m(1C)},1w:k(Q){o(c.1H&&c.C.3y)h c;c.1i={};c.1k={};m L={},N={};H(m p 1a Q){m 1C=18.2t.2a(c.T,p,Q[p]);L[p]=1C.L;N[p]=1C.N;c.1k[p]=1C.1k}h c.1m(L,N)},30:k(){H(m p 1a c.1i)c.T.2U(p,c.1k[p].2I(c.1i[p],c.C.21,p))}});I.P({bN:k(C){h 14 18.2Q(c,C)}});18.1D=18.3f.P({1z:k(O,C){c.O=$$(O);c.1m(C)},2Z:k(){H(m i 1a c.L){m 3K=c.L[i],2J=c.N[i],2x=c.1k[i],47=c.1i[i]={};H(m p 1a 3K)47[p]=2x[p].3B(3K[p],2J[p],c)}},2u:k(N){m 1C={};c.1k={};H(m i 1a N){m 2J=N[i],2x=c.1k[i]={},8k=1C[i]={};H(m p 1a 2J){2x[p]=18.2t.2K(p,2J[p]);8k[p]=2x[p].2a(2J[p])}}h c.1m(1C)},1w:k(Q){o(c.1H&&c.C.3y)h c;c.1i={};c.1k={};m L={},N={};H(m i 1a Q){m 5U=Q[i],3K=L[i]={},2J=N[i]={},2x=c.1k[i]={};H(m p 1a 5U){m 1C=18.2t.2a(c.O[i],p,5U[p]);3K[p]=1C.L;2J[p]=1C.N;2x[p]=1C.1k}}h c.1m(L,N)},30:k(){H(m i 1a c.1i){m 47=c.1i[i],2x=c.1k[i];H(m p 1a 47)c.O[i].2U(p,2x[p].2I(47[p],c.C.21,p))}}});18.bQ=18.3f.P({C:{1X:[],2D:{\'x\':0,\'y\':0},88:1d},1z:k(T,C){c.1i=[];c.T=$(T);c.6b={\'2w\':c.2w.V(c,15)};c.1m(C);o(c.C.88){c.1V(\'5D\',k(){R.1V(\'3t\',c.6b.2w)}.V(c));c.1V(\'2T\',k(){R.4e(\'3t\',c.6b.2w)}.V(c))}},2Z:k(){H(m i=0;i<2;i++)c.1i[i]=c.2W(c.L[i],c.N[i])},2O:k(x,y){o(c.1H&&c.C.3y)h c;m q=c.T.5z();m 1v={\'x\':x,\'y\':y};H(m z 1a q.3i){m 2g=q.5I[z]-q.3i[z];o($3x(1v[z]))1v[z]=($B(1v[z])==\'4b\')?1v[z].8f(0,2g):2g;19 1v[z]=q.3w[z];1v[z]+=c.C.2D[z]}h c.1w([q.3w.x,q.3w.y],[1v.x,1v.y])},bR:k(){h c.2O(15,0)},bU:k(){h c.2O(15,\'8c\')},bT:k(){h c.2O(0,15)},bS:k(){h c.2O(\'8c\',15)},89:k(q){m 1m=c.T.3g(c.C.1X);m 2y=$(q).3g(c.C.1X);h c.2O(2y.x-1m.x,2y.y-1m.y)},30:k(){c.T.2O(c.1i[0],c.1i[1])}});18.am=18.3f.P({C:{1F:\'8n\'},1z:k(q,C){c.T=$(q);c.31=14 I(\'aN\',{\'8l\':$P(c.T.8o(\'2f\'),{\'8x\':\'4T\'})}).8e(c.T).8b(c.T);c.T.2U(\'2f\',0);c.4x(C);c.1i=[];c.1m(c.C);c.3C=1d;c.1V(\'2T\',k(){c.3C=(c.1i[0]===0)});o(M.4Q)c.1V(\'2T\',k(){o(c.3C)c.T.3d().3h(c.31)})},2Z:k(){H(m i=0;i<2;i++)c.1i[i]=c.2W(c.L[i],c.N[i])},8n:k(){c.2f=\'2f-2n\';c.3P=\'4O\';c.2D=c.T.42},8X:k(){c.2f=\'2f-2z\';c.3P=\'3q\';c.2D=c.T.43},7N:k(1F){c[1F||c.C.1F]();h c.1w([c.T.24(c.2f).2N(),c.31.24(c.3P).2N()],[0,c.2D])},7J:k(1F){c[1F||c.C.1F]();h c.1w([c.T.24(c.2f).2N(),c.31.24(c.3P).2N()],[-c.2D,0])},8a:k(1F){c[1F||c.C.1F]();c.3C=15;h c.2u([-c.2D,0])},8V:k(1F){c[1F||c.C.1F]();c.3C=1d;h c.2u([0,c.2D])},91:k(1F){o(c.31.42==0||c.31.43==0)h c.7N(1F);h c.7J(1F)},30:k(){c.T.2U(c.2f,c.1i[0]+c.C.21);c.31.2U(c.3P,c.1i[1]+c.C.21)}});18.5d=k(1B,25){25=25||[];o($B(25)!=\'1f\')25=[25];h $P(1B,{8L:k(23){h 1B(23,25)},8N:k(23){h 1-1B(1-23,25)},8W:k(23){h(23<=0.5)?1B(2*23,25)/2:(2-1B(2*(1-23),25))/2}})};18.2k=14 2Y({95:k(p){h p}});18.2k.P=k(5H){H(m 1B 1a 5H){18.2k[1B]=14 18.5d(5H[1B]);18.2k.59(1B)}};18.2k.59=k(1B){[\'97\',\'93\',\'90\'].1x(k(5w){18.2k[1B.3Q()+5w]=18.2k[1B][\'8J\'+5w]})};18.2k.P({92:k(p,x){h 1h.3k(p,x[0]||6)},8w:k(p){h 1h.3k(2,8*(p-1))},8E:k(p){h 1-1h.7U(1h.8F(p))},8G:k(p){h 1-1h.7U((1-p)*1h.5V/2)},8z:k(p,x){x=x[0]||1.8A;h 1h.3k(p,2)*((x+1)*p-x)},8B:k(p){m J;H(m a=0,b=1;1;a+=b,b/=2){o(p>=(7-4*a)/11){J=-1h.3k((11-6*a-11*p)/4,2)+b*b;1u}}h J},a1:k(p,x){h 1h.3k(2,10*--p)*1h.7S(20*p*1h.5V*(x[0]||1)/3)}});[\'9b\',\'9P\',\'9O\',\'9N\'].1x(k(1B,i){18.2k[1B]=14 18.5d(k(p){h 1h.3k(p,[i+2])});18.2k.59(1B)});m 6l=14 1l({C:{2c:\'5a\',7O:1d,8j:1l.1W,45:1l.1W,55:1l.1W,80:1d,3W:\'9Q-8\',7C:15,33:{}},5Q:k(){c.1U=(M.5B)?14 5B():(M.1Z?14 85(\'a3.a4\'):15);h c},1z:k(C){c.5Q().4x(C);c.C.4c=c.C.4c||c.4c;c.33={};o(c.C.80&&c.C.2c==\'5a\'){m 3W=(c.C.3W)?\'; ag=\'+c.C.3W:\'\';c.4j(\'af-B\',\'ah/x-7H-a6-a5\'+3W)}o(c.C.1z)c.C.1z.1M(c)},7P:k(){o(c.1U.3L!=4||!c.3v)h;c.3v=15;m 2X=0;3V{2X=c.1U.2X}3O(e){};o(c.C.4c.1M(c,2X))c.45();19 c.55();c.1U.4B=1l.1W},4c:k(2X){h((2X>=a8)&&(2X<a9))},45:k(){c.4J={\'1T\':c.1U.ab,\'7B\':c.1U.aa};c.1O(\'45\',[c.4J.1T,c.4J.7B]);c.6e()},55:k(){c.1O(\'55\',c.1U)},4j:k(1s,J){c.33[1s]=J;h c},5Z:k(2C,3U){o(c.C.7C)c.8p();19 o(c.3v)h c;c.3v=1d;o(3U&&c.C.2c==\'9m\'){2C=2C+(2C.1c(\'?\')?\'&\':\'?\')+3U;3U=1j}c.1U.3C(c.C.2c.5l(),2C,c.C.7O);c.1U.4B=c.7P.V(c);o((c.C.2c==\'5a\')&&c.1U.9s)c.4j(\'9r\',\'9l\');$P(c.33,c.C.33);H(m B 1a c.33)3V{c.1U.9k(B,c.33[B])}3O(e){};c.1O(\'8j\');c.1U.5Z($3N(3U,1j));h c},8p:k(){o(!c.3v)h c;c.3v=15;c.1U.8r();c.1U.4B=1l.1W;c.5Q();c.1O(\'5W\');h c}});6l.6p(14 6i,14 2e,14 6j);m 34={3z:k(Q){1Q($B(Q)){Y\'1J\':h\'"\'+Q.2H(/(["\\\\])/g,\'\\\\$1\')+\'"\';Y\'1f\':h\'[\'+Q.28(34.3z).1I(\',\')+\']\';Y\'2G\':m 1J=[];H(m F 1a Q)1J.1e(34.3z(F)+\':\'+34.3z(Q[F]));h\'{\'+1J.1I(\',\')+\'}\';Y\'4b\':o(9x(Q))1u;Y 15:h\'1j\'}h 4q(Q)},4A:k(4V,5k){h(($B(4V)!=\'1J\')||(5k&&!4V.2q(/^("(\\\\.|[^"\\\\\\n\\r])*?"|[,:{}\\[\\]0-9.\\-+9o-u \\n\\r\\t])+?$/)))?1j:8P(\'(\'+4V+\')\')}};34.8u=6l.P({1z:k(2C,C){c.2C=2C;c.1V(\'45\',c.2T);c.1m(C);c.4j(\'X-bP\',\'aL\')},5Z:k(Q){h c.1m(c.2C,\'bh=\'+34.3z(Q))},2T:k(){c.1O(\'2T\',[34.4A(c.4J.1T,c.C.5k)])}});',62,763,'||||||||||||this|||||return|||function||var||if||el|||||||||||type|options|||property|event|for|Element|value|fn|from|window|to|elements|extend|obj|document||element|length|bind|events||case||||param||new|false||arguments|Fx|else|in|args|contains|true|push|array|items|Math|now|null|css|Class|parent|style|className|result|prototype|selector|name|props|break|values|start|each|prop|initialize|keys|transition|parsed|Elements|relatedTarget|mode|current|timer|join|string|custom|Array|call|delay|fireEvent|nocash|switch|Garbage|opacity|text|transport|addEvent|empty|overflown|temp|ie||unit|key|pos|getStyle|params|documentElement||map|rgb|parse|Event|method|Methods|Events|margin|max|getElementsByTagName|context|create|Transitions|match|properties|top|item|tag|test|filter|parentNode|CSS|set|returns|stop|iCss|target|left|time|index|url|offset|option|shared|object|replace|getValue|iTo|select|border|xpath|toInt|scrollTo|previous|Styles|iterable|source|onComplete|setStyle|tmp|compute|status|Abstract|setNow|increase|wrapper||headers|Json|addListener|id||||val|webkit|periodical|remove|chains|Base|getPosition|inject|size|hex|pow|min|len|fromTo|round|getTag|width|collect|native|mousewheel|results|running|scroll|chk|wait|toString|merge|getNow|open|fx|htmlElement|apply|script|bit|indexOf|parseInt|iFrom|readyState|precision|pick|catch|layout|toLowerCase|mix|px|parseFloat|data|try|encoding|next|scrollTop|HTMLElement||klass|offsetHeight|offsetWidth|walk|onSuccess||iNow|domReady|scrollLeft|unique|number|isSuccess|realType|removeEvent|removeEvents|attempt|setMany|getElements|setHeader|included|splice|getElementById|split|scrollHeight|body|String|trash|src|scrollWidth|fKey|stopPropagation|preventDefault|setOptions|code|Listeners|evaluate|onreadystatechange|hexToRgb|evType|fix|Multi|color|Properties|generic|response|end|loaded|getProperty|mp|height|typeof|webkit419|setProperty|defined|hidden|forEach|str|currentStyle|every|visibility|tagName||rgbToHex|regex|brother|getElementsBySelector|onFailure|proto|hasClass|clean|compat|post|getParam|ie_ready|Transition|nodeType|regexp|RegExp|domready|gecko|DOMMouseScroll|secure|toUpperCase|checked|xhtml|pageY|pageX|appendChild|unload|padding|addEvents|camelCase|while|easeType|trim|queryString|getSize|disabled|XMLHttpRequest|qs|onStart|NativeEvents|addEventListener|delete|transitions|scrollSize|charAt|add|position|right|bottom|multiple|flag|setTransport|operator|getItems|merged|iProps|PI|onCancel|node|first|send|firstChild|cssText|Style|hasChild|insertBefore|class|newArray|Color|innerText|clear|getMany|bound|default|Function|callChain|random|mouseover|found|Chain|Options|selected|XHR|mouseout|pairs|concat|implement|duration|on|Dom|include|substr|beforeunload|click|mouseenter|mouseleave|cloneEvents|keydown|Width|contents|removeClass|argument|after|where|before|addClass|setStyles|hyphenate|getNext|defaultView|zoom|setOpacity|visible|elementsProperty|createElement|constructor|pp|ie6|undefined|picked|head|Merge|callee|Number|toFloat|interval|slice|copy|getLast|childNodes|continue|extended|removeEventListener|PropertiesIFlag|direction|borderShort|shift|wheelDelta|fixRelatedTarget|relatedTargetGecko|which|clientY|clientX|Left|Bottom|styleSheet|innerHTML|appendText|removeChild|nodeValue|setProperties|textContent|setHTML|Top|Right|0px|capitalize|fixStyle|removeListener|prefix|xml|autoCancel|textarea|change|delta|getScrollTop|www|input|slideOut|sel|normal|getElement|slideIn|async|onStateChange|getScrollLeft|getScrollHeight|cos|load|sin|clientWidth|opera|clientHeight|complete|pageXOffset|urlEncoded|getScrollWidth|getHeight|getWidth|pageYOffset|ActiveXObject|step|getFormElements|wheelStops|toElement|hide|adopt|full|filterByClass|injectAfter|limit|Single|resolver|filterByAttribute|onRequest|iParsed|styles|fps|vertical|getStyles|cancel|filterById|abort|setText|setAttribute|Remote|alpha|Expo|overflow|float|Back|618|Bounce|styleFloat|cssFloat|Circ|acos|Sine|zIndex|hasLayout|ease|toggleClass|easeIn|getFirst|easeOut|getPrevious|eval|attributes|getParent|getChildren|lastChild|getAttribute|show|easeInOut|horizontal|getProperties|removeAttribute|InOut|toggle|Pow|Out|getComputedStyle|linear|Sibling|In|getPropertyValue|removeProperty|100|Quad|DOMElement|execCommand|BackgroundImageCache|iframe|Object|webkit420|getBoxObjectFor|khtml|setRequestHeader|close|get|some|Eaeflnr|clearChain|chain|Connection|overrideMimeType|taintEnabled|navigator|whitespace|collection|isFinite|textnode|nodeName|MooTools|version|floor|Date|Document|ie7|all|Window|clearInterval|getTime|clearTimeout|associate|getRandom|Quint|Quart|Cubic|utf|boolean|times|embed|getText|injectBefore|cloneNode|replaceWith|replaceChild|clone|injectTop|Elastic|injectInside|Microsoft|XMLHTTP|urlencoded|form|escapeRegExp|200|300|responseXML|responseText|transparent|setTimeout|bindAsEventListener|Content|charset|application|pass|setInterval|err|createTextNode|Slide|protocol|location||getCoordinates|tab|backspace|esc|space|getLeft|getTop|encodeURIComponent|toQueryString|do|offsetLeft|offsetParent|offsetTop|down|up|DOMContentLoaded|button|fromElement|rightClick|onDomReady|innerWidth|JSON|cancelBubble|div|https|enter|javascript|void|defer|write|password|radio|bindWithEvent|snapshotItem|snapshotLength|contextmenu|error|submit|reset|UNORDERED_NODE_SNAPSHOT_TYPE|filterByTag|namespaceURI|ES|starts|with|XPathResult|substring|blur|focus|mouseup|mousedown|1999|dblclick|json|checkbox|getElementsByClassName|org|w3|resize|move|keyup|keypress|mousemove|http|client|returnValue|readonly|readOnly|frameborder|maxLength|maxlength|accessKey|tabindex|tabIndex|frameBorder|href|shiftKey|control|ctrlKey|srcElement|CollectGarbage|attachEvent|detachEvent|accesskey|rowSpan|effects|effect|Request|Scroll|toTop|toRight|toLeft|toBottom|borderWidth|borderStyle|colspan|colSpan|rowspan|htmlFor|1000|borderColor|clearTimer|alt|500|120|detail|keyCode|fromCharCode|wheel|metaKey|innerHeight|mouse|meta|menu|111|page|altKey'.split('|'),0,{}));


/*****************************************************************************
Copyright (C) 2006  Nick Baicoianu

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

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

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*****************************************************************************/
//constructor for the main Epoch class (ENGLISH VERSION)
function Epoch(name,mode,targetelement,multiselect)
{

	this.state = 0;
	this.name = name;
	this.curDate = new Date();
	this.mode = mode;
	this.selectMultiple = (multiselect == true); //'false' is not true or not set at all
	
	//the various calendar variables
	//this.selectedDate = this.curDate;
	this.selectedDates = new Array();
	this.calendar;
	this.calHeading;
	this.calCells;
	this.rows;
	this.cols;
	this.cells = new Array();
	
	//The controls
	this.monthSelect;
	this.yearSelect;
	
	//standard initializations
	this.mousein = false;
	this.calConfig();
	this.setDays();
	this.displayYear = this.displayYearInitial;
	this.displayMonth = this.displayMonthInitial;
	
	this.createCalendar(); //create the calendar DOM element and its children, and their related objects
		
	if(this.mode == 'popup' && targetelement && targetelement.type == 'text') //if the target element has been set to be an input text box
	{
		this.tgt = targetelement;
		this.calendar.style.position = 'absolute';
		this.topOffset = this.tgt.offsetHeight; // the vertical distance (in pixels) to display the calendar from the Top of its input element
		this.leftOffset = 0; 					// the horizontal distance (in pixels) to display the calendar from the Left of its input element
		try{
		this.calendar.style.top = this.getTop(targetelement) + this.topOffset + 'px';
		this.calendar.style.left = this.getLeft(targetelement) + this.leftOffset + 'px';
		}catch(Ex){ alert(targetelement); }
		document.body.appendChild(this.calendar);
		this.tgt.calendar = this;
		this.tgt.onfocus = function () {this.calendar.show();}; //the calendar will popup when the input element is focused
		this.tgt.onblur = function () {if(!this.calendar.mousein){this.calendar.hide();}}; //the calendar will popup when the input element is focused
	}
	else
	{
		this.container = targetelement;
		this.container.appendChild(this.calendar);
	}
	
	
	this.state = 2; //0: initializing, 1: redrawing, 2: finished!
	this.visible ? this.show() : this.hide();
}
//-----------------------------------------------------------------------------
Epoch.prototype.calConfig = function () //PRIVATE: initialize calendar variables
{
	//this.mode = 'flat'; //can be 'flat' or 'popup'
	this.displayYearInitial = this.curDate.getFullYear(); //the initial year to display on load
	this.displayMonthInitial = this.curDate.getMonth(); //the initial month to display on load (0-11)
	this.rangeYearLower = 2005;
	this.rangeYearUpper = 2037;
	this.minDate = new Date(2005,0,1);
	this.maxDate = new Date(2037,0,1);
	this.startDay = 0; // the day the week will 'start' on: 0(Sun) to 6(Sat)
	this.showWeeks = true; //whether the week numbers will be shown
	this.selCurMonthOnly = false; //allow user to only select dates in the currently displayed month
	this.clearSelectedOnChange = true; //whether to clear all selected dates when changing months
	
	//flat mode-only settings:
	//this.selectMultiple = true; //whether the user can select multiple dates (flat mode only)

	switch(this.mode) //set the variables based on the calendar mode
	{
		case 'popup': //popup options
			this.visible = false;
			break;
		case 'flat':
			this.visible = true;
			
			break;
	}
	this.setLang();
};
//-----------------------------------------------------------------------------
Epoch.prototype.setLang = function()  //all language settings for Epoch are made here.  Check Date.dateFormat() for the Date object's language settings
{
	this.daylist = new Array('Nie','Pon','Wto','Śro','Czw','Pią','Sob','Nie','Pon','Wto','Śro','Czw','Pią','Sob'); /*<lang:en>*/
	this.months_sh = new Array('Sty','Lut','Mar','Kwi','Maj','Cze','Lip','Sie','Wrz','Paź','Lis','Gru');
	this.monthup_title = 'Następny miesiąc';
	this.monthdn_title = 'Poprzedni miesiąc';
	this.clearbtn_caption = 'Wyczyść';
	this.clearbtn_title = 'Czyści datę wybraną w kalendarzu';
	this.maxrange_caption = 'To jest maksymalny zasięg';
};
//-----------------------------------------------------------------------------
Epoch.prototype.getTop = function (element) //PRIVATE: returns the absolute Top value of element, in pixels
{
    var oNode = element;
    var iTop = 0;
    
    while(oNode = oNode.offsetParent) {
        iTop += oNode.offsetTop;
    }
    
    return iTop;
};
//-----------------------------------------------------------------------------
Epoch.prototype.getLeft = function (element) //PRIVATE: returns the absolute Left value of element, in pixels
{
    var oNode = element;
    var iLeft = 0;
    
    while(oNode = oNode.offsetParent) {
        iLeft += oNode.offsetLeft;
    }
    
    return iLeft+90;
};
//-----------------------------------------------------------------------------
Epoch.prototype.show = function () //PUBLIC: displays the calendar
{
	this.calendar.style.display = 'block';
	this.visible = true;
};
//-----------------------------------------------------------------------------
Epoch.prototype.hide = function () //PUBLIC: Hides the calendar
{
	this.calendar.style.display = 'none';
	this.visible = false;
};
//-----------------------------------------------------------------------------
Epoch.prototype.toggle = function () //PUBLIC: Toggles (shows/hides) the calendar depending on its current state
{
	if(this.visible) {
		this.hide();
	}
	else {
		this.show();
	}
};
//-----------------------------------------------------------------------------
Epoch.prototype.setDays = function ()  //PRIVATE: initializes the standard Gregorian Calendar parameters
{
	this.daynames = new Array();
	var j=0;
	for(var i=this.startDay; i< this.startDay + 7;i++) {
		this.daynames[j++] = this.daylist[i];
	}
		
	this.monthDayCount = new Array(31,((this.curDate.getFullYear() - 2000) % 4 ? 28 : 29),31,30,31,30,31,31,30,31,30,31);
};
//-----------------------------------------------------------------------------
Epoch.prototype.setClass = function (element,className) //PRIVATE: sets the CSS class of the element, W3C & IE
{
	element.setAttribute('class',className);
	element.setAttribute('className',className); //<iehack>
};
//-----------------------------------------------------------------------------
Epoch.prototype.createCalendar = function ()  //PRIVATE: creates the full DOM implementation of the calendar
{
	var tbody, tr, td;
	this.calendar = document.createElement('table');
	this.calendar.setAttribute('id',this.name+'_calendar');
	this.setClass(this.calendar,'calendar');
	//to prevent IE from selecting text when clicking on the calendar
	this.calendar.onselectstart = function() {return false;};
	this.calendar.ondrag = function() {return false;};
	tbody = document.createElement('tbody');
	
	//create the Main Calendar Heading
	tr = document.createElement('tr');
	td = document.createElement('td');
	td.appendChild(this.createMainHeading());
	tr.appendChild(td);
	tbody.appendChild(tr);
	
	//create the calendar Day Heading
	tr = document.createElement('tr');
	td = document.createElement('td');
	td.appendChild(this.createDayHeading());
	tr.appendChild(td);
	tbody.appendChild(tr);

	//create the calendar Day Cells
	tr = document.createElement('tr');
	td = document.createElement('td');
	td.setAttribute('id',this.name+'_cell_td');
	this.calCellContainer = td;	//used as a handle for manipulating the calendar cells as a whole
	td.appendChild(this.createCalCells());
	tr.appendChild(td);
	tbody.appendChild(tr);
	
	//create the calendar footer
	tr = document.createElement('tr');
	td = document.createElement('td');
	td.appendChild(this.createFooter());
	tr.appendChild(td);
	tbody.appendChild(tr);
	
	//add the tbody element to the main calendar table
	this.calendar.appendChild(tbody);

	//and add the onmouseover events to the calendar table
	this.calendar.owner = this;
	this.calendar.onmouseover = function() {this.owner.mousein = true;};
	this.calendar.onmouseout = function() {this.owner.mousein = false;};
};
//-----------------------------------------------------------------------------
Epoch.prototype.createMainHeading = function () //PRIVATE: Creates the primary calendar heading, with months & years
{
	//create the containing <div> element
	var container = document.createElement('div');
	container.setAttribute('id',this.name+'_mainheading');
	this.setClass(container,'mainheading');
	//create the child elements and other variables
	this.monthSelect = document.createElement('select');
	this.yearSelect = document.createElement('select');
	var monthDn = document.createElement('input'), monthUp = document.createElement('input');
	var opt, i;
	//fill the month select box
	for(i=0;i<12;i++)
	{
		opt = document.createElement('option');
		opt.setAttribute('value',i);
		if(this.state == 0 && this.displayMonth == i) {
			opt.setAttribute('selected','selected');
		}
		opt.appendChild(document.createTextNode(this.months_sh[i]));
		this.monthSelect.appendChild(opt);
	}
	//and fill the year select box
	for(i=this.rangeYearLower;i<=this.rangeYearUpper;i++)
	{
		opt = document.createElement('option');
		opt.setAttribute('value',i);
		if(this.state == 0 && this.displayYear == i) {
			opt.setAttribute('selected','selected');
		}
		opt.appendChild(document.createTextNode(i));
		this.yearSelect.appendChild(opt);		
	}
	//add the appropriate children for the month buttons
	monthUp.setAttribute('type','button');
	monthUp.setAttribute('value','>');
	monthUp.setAttribute('title',this.monthup_title);
	monthDn.setAttribute('type','button');
	monthDn.setAttribute('value','<');
	monthDn.setAttribute('title',this.monthdn_title);
	this.monthSelect.owner = this.yearSelect.owner = monthUp.owner = monthDn.owner = this;  //hack to allow us to access this calendar in the events (<fix>??)
	
	//assign the event handlers for the controls
	monthUp.onmouseup = function () {this.owner.nextMonth();};
	monthDn.onmouseup = function () {this.owner.prevMonth();};
	this.monthSelect.onchange = function() {
		this.owner.displayMonth = this.value;
		this.owner.displayYear = this.owner.yearSelect.value; 
		this.owner.goToMonth(this.owner.displayYear,this.owner.displayMonth);
	};
	this.yearSelect.onchange = function() {
		this.owner.displayMonth = this.owner.monthSelect.value;
		this.owner.displayYear = this.value; 
		this.owner.goToMonth(this.owner.displayYear,this.owner.displayMonth);
	};
	
	//and finally add the elements to the containing div
	container.appendChild(monthDn);
	container.appendChild(this.monthSelect);
	container.appendChild(this.yearSelect);
	container.appendChild(monthUp);
	return container;
};
//-----------------------------------------------------------------------------
Epoch.prototype.createFooter = function () //PRIVATE: creates the footer of the calendar - goes under the calendar cells
{
	var container = document.createElement('div');
	var clearSelected = document.createElement('input');
	clearSelected.setAttribute('type','button');
	clearSelected.setAttribute('value',this.clearbtn_caption);
	clearSelected.setAttribute('title',this.clearbtn_title);
	clearSelected.owner = this;
	clearSelected.onclick = function() { this.owner.resetSelections(false);};
	container.appendChild(clearSelected);
	return container;
};
//-----------------------------------------------------------------------------
Epoch.prototype.resetSelections = function (returnToDefaultMonth)  //PRIVATE: reset the calendar's selection variables to defaults
{
	this.selectedDates = new Array();
	this.rows = new Array(false,false,false,false,false,false,false);
	this.cols = new Array(false,false,false,false,false,false,false);
	if(this.tgt)  //if there is a target element, clear it too
	{
		this.tgt.value = '';
		if(this.mode == 'popup') {//hide the calendar if in popup mode
			this.hide();
		}
	}
		
	if(returnToDefaultMonth == true) {
		this.goToMonth(this.displayYearInitial,this.displayMonthInitial);
	}
	else {
		this.reDraw();
	}
};
//-----------------------------------------------------------------------------
Epoch.prototype.createDayHeading = function ()  //PRIVATE: creates the heading containing the day names
{
	//create the table element
	this.calHeading = document.createElement('table');
	this.calHeading.setAttribute('id',this.name+'_caldayheading');
	this.setClass(this.calHeading,'caldayheading');
	var tbody,tr,td;
	tbody = document.createElement('tbody');
	tr = document.createElement('tr');
	this.cols = new Array(false,false,false,false,false,false,false);
	
	//if we're showing the week headings, create an empty <td> for filler
	if(this.showWeeks)
	{
		td = document.createElement('td');
		td.setAttribute('class','wkhead');
		td.setAttribute('className','wkhead'); //<iehack>
		tr.appendChild(td);
	}
	//populate the day titles
	for(var dow=0;dow<7;dow++)
	{
		td = document.createElement('td');
		td.appendChild(document.createTextNode(this.daynames[dow]));
		if(this.selectMultiple) { //if selectMultiple is true, assign the cell a CalHeading Object to handle all events
			td.headObj = new CalHeading(this,td,(dow + this.startDay < 7 ? dow + this.startDay : dow + this.startDay - 7));
		}
		tr.appendChild(td);
	}
	tbody.appendChild(tr);
	this.calHeading.appendChild(tbody);
	return this.calHeading;	
};
//-----------------------------------------------------------------------------
Epoch.prototype.createCalCells = function ()  //PRIVATE: creates the table containing the calendar day cells
{
	this.rows = new Array(false,false,false,false,false,false);
	this.cells = new Array();
	var row = -1, totalCells = (this.showWeeks ? 48 : 42);
	var beginDate = new Date(this.displayYear,this.displayMonth,1);
	var endDate = new Date(this.displayYear,this.displayMonth,this.monthDayCount[this.displayMonth]);
	var sdt = new Date(beginDate);
	sdt.setDate(sdt.getDate() + (this.startDay - beginDate.getDay()) - (this.startDay - beginDate.getDay() > 0 ? 7 : 0) );
	//create the table element
	this.calCells = document.createElement('table');
	this.calCells.setAttribute('id',this.name+'_calcells');
	this.setClass(this.calCells,'calcells');
	var tbody,tr,td;
	tbody = document.createElement('tbody');
	for(var i=0;i<totalCells;i++)
	{
		if(this.showWeeks) //if we are showing the week headings
		{
			if(i % 8 == 0)
			{
				row++;
				tr = document.createElement('tr');
				td = document.createElement('td');
				if(this.selectMultiple) { //if selectMultiple is enabled, create the associated weekObj objects
					td.weekObj = new WeekHeading(this,td,sdt.getWeek(),row)
				}
				else //otherwise just set the class of the td for consistent look
				{
					td.setAttribute('class','wkhead');
					td.setAttribute('className','wkhead'); //<iehack>
				}
				td.appendChild(document.createTextNode(sdt.getWeek()));			
				tr.appendChild(td);
				i++;
			}
		}
		else if(i % 7 == 0) //otherwise, new row every 7 cells
		{
			row++;
			tr = document.createElement('tr');
		}
		//create the day cells
		td = document.createElement('td');
		td.appendChild(document.createTextNode(sdt.getDate()));// +' ' +sdt.getUeDay()));
		var cell = new CalCell(this,td,sdt,row);
		this.cells.push(cell);
		td.cellObj = cell;
		sdt.setDate(sdt.getDate() + 1); //increment the date
		tr.appendChild(td);
		tbody.appendChild(tr);
	}
	this.calCells.appendChild(tbody);
	this.reDraw();
	return this.calCells;
};
//-----------------------------------------------------------------------------
Epoch.prototype.reDraw = function () //PRIVATE: reapplies all the CSS classes for the calendar cells, usually called after chaning their state
{
	this.state = 1;
	var i,j;
	for(i=0;i<this.cells.length;i++) {
		this.cells[i].selected = false;
	}
	for(i=0;i<this.cells.length;i++)
	{
		for(j=0;j<this.selectedDates.length;j++) { //if the cell's date is in the selectedDates array, set its selected property to true
			if(this.cells[i].date.getUeDay() == this.selectedDates[j].getUeDay() ) {
				this.cells[i].selected = true;
			}
		}

		this.cells[i].setClass();
	}
	//alert(this.selectedDates);
	this.state = 2;
};
//-----------------------------------------------------------------------------
Epoch.prototype.deleteCells = function () //PRIVATE: removes the calendar cells from the DOM (does not delete the cell objects associated with them
{
	this.calCellContainer.removeChild(this.calCellContainer.firstChild); //get a handle on the cell table (optional - for less indirection)
	this.cells = new Array(); //reset the cells array
};
//-----------------------------------------------------------------------------
Epoch.prototype.goToMonth = function (year,month) //PUBLIC: sets the calendar to display the requested month/year
{
	this.monthSelect.value = this.displayMonth = month;
	this.yearSelect.value = this.displayYear = year;
	this.deleteCells();
	this.calCellContainer.appendChild(this.createCalCells());
};
//-----------------------------------------------------------------------------
Epoch.prototype.nextMonth = function () //PUBLIC: go to the next month.  if the month is december, go to january of the next year
{
	
	//increment the month/year values, provided they're within the min/max ranges
	if(this.monthSelect.value < 11) {
		this.monthSelect.value++;
	}
	else
	{
		if(this.yearSelect.value < this.rangeYearUpper)
		{
			this.monthSelect.value = 0;
			this.yearSelect.value++;
		}
		else {
			alert(this.maxrange_caption);
		}
	}
	//assign the currently displaying month/year values
	this.displayMonth = this.monthSelect.value;
	this.displayYear = this.yearSelect.value;
	
	//and refresh the calendar for the new month/year
	this.deleteCells();
	this.calCellContainer.appendChild(this.createCalCells());
};
//-----------------------------------------------------------------------------
Epoch.prototype.prevMonth = function () //PUBLIC: go to the previous month.  if the month is january, go to december of the previous year
{
	//increment the month/year values, provided they're within the min/max ranges
	if(this.monthSelect.value > 0)
		this.monthSelect.value--;
	else
	{
		if(this.yearSelect.value > this.rangeYearLower)
		{
			this.monthSelect.value = 11;
			this.yearSelect.value--;
		}
		else {
			alert(this.maxrange_caption);
		}
	}
	
	//assign the currently displaying month/year values
	this.displayMonth = this.monthSelect.value;
	this.displayYear = this.yearSelect.value;
	
	//and refresh the calendar for the new month/year
	this.deleteCells();
	this.calCellContainer.appendChild(this.createCalCells());
};
//-----------------------------------------------------------------------------
Epoch.prototype.addZero = function (vNumber) //PRIVATE: pads a 2 digit number with a leading zero
{
	return ((vNumber < 10) ? '0' : '') + vNumber;
};
//-----------------------------------------------------------------------------
Epoch.prototype.addDates = function (dates,redraw)  //PUBLIC: adds the array "dates" to the calendars selectedDates array (no duplicate dates) and redraws the calendar
{
	var j,in_sd;
	for(var i=0;i<dates.length;i++)
	{	
		in_sd = false;
		for(j=0;j<this.selectedDates.length;j++)
		{
			if(dates[i].getUeDay() == this.selectedDates[j].getUeDay())
			{
				in_sd = true;
				break;
			}
		}
		if(!in_sd) { //if the date isn't already in the array, add it!
			this.selectedDates.push(dates[i]);
		}
	}
	if(redraw != false) {//redraw  the calendar if "redraw" is false or undefined
		this.reDraw();
	}
};
//-----------------------------------------------------------------------------
Epoch.prototype.removeDates = function (dates,redraw)  //PUBLIC: adds the dates to the calendars selectedDates array and redraws the calendar
{
	var j;
	for(var i=0;i<dates.length;i++)
	{
		for(j=0;j<this.selectedDates.length;j++)
		{
			if(dates[i].getUeDay() == this.selectedDates[j].getUeDay()) { //search for the dates in the selectedDates array, removing them if the dates match
				this.selectedDates.splice(j,1);
			}
		}
	}
	if(redraw != false) { //redraw  the calendar if "redraw" is false or undefined
		this.reDraw();
	}
};
//-----------------------------------------------------------------------------
Epoch.prototype.outputDate = function (vDate, vFormat) //PUBLIC: outputs a date in the appropriate format (DEPRECATED)
{
	var vDay			= this.addZero(vDate.getDate()); 
	var vMonth			= this.addZero(vDate.getMonth() + 1); 
	var vYearLong		= this.addZero(vDate.getFullYear()); 
	var vYearShort		= this.addZero(vDate.getFullYear().toString().substring(3,4)); 
	var vYear			= (vFormat.indexOf('yyyy') > -1 ? vYearLong : vYearShort);
	var vHour			= this.addZero(vDate.getHours()); 
	var vMinute			= this.addZero(vDate.getMinutes()); 
	var vSecond			= this.addZero(vDate.getSeconds()); 
	return vFormat.replace(/dd/g, vDay).replace(/mm/g, vMonth).replace(/y{1,4}/g, vYear).replace(/hh/g, vHour).replace(/nn/g, vMinute).replace(/ss/g, vSecond);
};
//-----------------------------------------------------------------------------
Epoch.prototype.updatePos = function (target) //PUBLIC: moves the calendar's position to target's location (popup mode only)
{
	this.calendar.style.top = this.getTop(target) + this.topOffset + 'px'
	this.calendar.style.left = this.getLeft(target) + this.leftOffset + 'px'
}
//-----------------------------------------------------------------------------

/*****************************************************************************/
function CalHeading(owner,tableCell,dow)
{
	this.owner = owner;
	this.tableCell = tableCell;
	this.dayOfWeek = dow;
	
	//the event handlers
	this.tableCell.onclick = this.onclick;
}
//-----------------------------------------------------------------------------
CalHeading.prototype.onclick = function ()
{
	//reduce indirection:
	var owner = this.headObj.owner;
	var sdates = owner.selectedDates;
	var cells = owner.cells;
	
	owner.cols[this.headObj.dayOfWeek] = !owner.cols[this.headObj.dayOfWeek];
	for(var i=0;i<cells.length;i++) //cycle through all the cells in the calendar, selecting all cells with the same dayOfWeek as this heading
	{
		if(cells[i].dayOfWeek == this.headObj.dayOfWeek && (!owner.selCurMonthOnly || cells[i].date.getMonth() == owner.displayMonth && cells[i].date.getFullYear() == owner.displayYear)) //if the cell's DoW matches, with other conditions
		{
			if(owner.cols[this.headObj.dayOfWeek]) 		//if selecting, add the cell's date to the selectedDates array
			{
				if(owner.selectedDates.arrayIndex(cells[i].date) == -1) { //if the date isn't already in the array
					sdates.push(cells[i].date);
				}
			}
			else										//otherwise, remove it
			{
				for(var j=0;j<sdates.length;j++) 
				{
					if(cells[i].dayOfWeek == sdates[j].getDay())
					{
						sdates.splice(j,1);	//remove dates that are within the displaying month/year that have the same day of week as the day cell
						break;
					}
				}
			}
			cells[i].selected = owner.cols[this.headObj.dayOfWeek];
		}
	}
	owner.reDraw();
};
/*****************************************************************************/
function WeekHeading(owner,tableCell,week,row)
{
	this.owner = owner;
	this.tableCell = tableCell;
	this.week = week;
	this.tableRow = row;
	this.tableCell.setAttribute('class','wkhead');
	this.tableCell.setAttribute('className','wkhead'); //<iehack>
	//the event handlers
	this.tableCell.onclick = this.onclick;
}
//-----------------------------------------------------------------------------
WeekHeading.prototype.onclick = function ()
{
	//reduce indirection:
	var owner = this.weekObj.owner;
	var cells = owner.cells;
	var sdates = owner.selectedDates;
	var i,j;
	owner.rows[this.weekObj.tableRow] = !owner.rows[this.weekObj.tableRow];
	for(i=0;i<cells.length;i++)
	{
		if(cells[i].tableRow == this.weekObj.tableRow)
		{
			if(owner.rows[this.weekObj.tableRow] && (!owner.selCurMonthOnly || cells[i].date.getMonth() == owner.displayMonth && cells[i].date.getFullYear() == owner.displayYear)) //match all cells in the current row, with option to restrict to current month only
			{
				if(owner.selectedDates.arrayIndex(cells[i].date) == -1) {//if the date isn't already in the array
					sdates.push(cells[i].date);
				}
			}
			else										//otherwise, remove it
			{
				for(j=0;j<sdates.length;j++)
				{
					if(sdates[j].getTime() == cells[i].date.getTime())  //this.weekObj.tableRow && sdates[j].getMonth() == owner.displayMonth && sdates[j].getFullYear() == owner.displayYear)
					{
						sdates.splice(j,1);	//remove dates that are within the displaying month/year that have the same day of week as the day cell
						break;
					}
				}
			}
		}
	}
	owner.reDraw();
};
/*****************************************************************************/
//-----------------------------------------------------------------------------
function CalCell(owner,tableCell,dateObj,row)
{
	this.owner = owner;		//used primarily for event handling
	this.tableCell = tableCell; 			//the link to this cell object's table cell in the DOM
	this.cellClass;			//the CSS class of the cell
	this.selected = false;	//whether the cell is selected (and is therefore stored in the owner's selectedDates array)
	this.date = new Date(dateObj);
	this.dayOfWeek = this.date.getDay();
	this.week = this.date.getWeek();
	this.tableRow = row;
	
	//assign the event handlers for the table cell element
	this.tableCell.onclick = this.onclick;
	this.tableCell.onmouseover = this.onmouseover;
	this.tableCell.onmouseout = this.onmouseout;
	
	//and set the CSS class of the table cell
	this.setClass();
}
//-----------------------------------------------------------------------------
CalCell.prototype.onmouseover = function () //replicate CSS :hover effect for non-supporting browsers <iehack>
{
	this.setAttribute('class',this.cellClass + ' hover');
	this.setAttribute('className',this.cellClass + ' hover');
};
//-----------------------------------------------------------------------------
CalCell.prototype.onmouseout = function () //replicate CSS :hover effect for non-supporting browsers <iehack>
{
	this.cellObj.setClass();
};
//-----------------------------------------------------------------------------
CalCell.prototype.onclick = function () 
{
	//reduce indirection:
	var cell = this.cellObj;
	var owner = cell.owner;
	if(!owner.selCurMonthOnly || cell.date.getMonth() == owner.displayMonth && cell.date.getFullYear() == owner.displayYear)
	{
		if(owner.selectMultiple == true)  //if we can select multiple cells simultaneously, add the currently selected cell's date to the selectedDates array
		{
			if(!cell.selected) //if this cell has been selected
			{
				if(owner.selectedDates.arrayIndex(cell.date) == -1) {
					owner.selectedDates.push(cell.date);
				}
			}
			else		
			{
				var tmp = owner.selectedDates; // to reduce indirection
				//if the cell has been deselected, remove it from the owner calendar's selectedDates array
				for(var i=0;i<tmp.length;i++)
				{
					if(tmp[i].getUeDay() == cell.date.getUeDay()) {
						tmp.splice(i,1);
					}
				}
			}
		}
		else //if we can only select one cell at a time
		{
			owner.selectedDates = new Array(cell.date);
			if(owner.tgt) //if there is a target element to place the value in, do so
			{
				owner.tgt.value = owner.selectedDates[0].dateFormat();
				if(owner.mode == 'popup') {
					owner.hide();
				}
			}
		}
		owner.reDraw(); //redraw the calendar cell styles to reflect the changes
	}
};
//-----------------------------------------------------------------------------
CalCell.prototype.setClass = function ()  //private: sets the CSS class of the cell based on the specified criteria
{
	if(this.selected) {
		this.cellClass = 'cell_selected';
	}
	else if(this.owner.displayMonth != this.date.getMonth() ) {
		this.cellClass = 'notmnth';	
	}
	else if(this.date.getDay() > 0 && this.date.getDay() < 6) {
		this.cellClass = 'wkday';
	}
	else {
		this.cellClass = 'wkend';
	}
	
	if(this.date.getFullYear() == this.owner.curDate.getFullYear() && this.date.getMonth() == this.owner.curDate.getMonth() && this.date.getDate() == this.owner.curDate.getDate()) {
		this.cellClass = this.cellClass + ' curdate';
	}

	this.tableCell.setAttribute('class',this.cellClass);
	this.tableCell.setAttribute('className',this.cellClass); //<iehack>
};
/*****************************************************************************/
Date.prototype.getDayOfYear = function () //returns the day of the year for this date
{
	return parseInt((this.getTime() - new Date(this.getFullYear(),0,1).getTime())/86400000 + 1);
};
//-----------------------------------------------------------------------------
Date.prototype.getWeek = function () //returns the day of the year for this date
{
	return parseInt((this.getTime() - new Date(this.getFullYear(),0,1).getTime())/604800000 + 1);
};
/*function getISOWeek()
{
	var newYear = new Date(this.getFullYear(),0,1);
	var modDay = newYear.getDay();
	if (modDay == 0) modDay=6; else modDay--;
	
	var daynum = ((Date.UTC(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0) - Date.UTC(this.getFullYear()),0,1,0,0,0)) /1000/60/60/24) + 1;
	
	if (modDay < 4 ) {
	    var weeknum = Math.floor((daynum+modDay-1)/7)+1;
	}
	else {
	    var weeknum = Math.floor((daynum+modDay-1)/7);
	    if (weeknum == 0) {
	        year--;
	        var prevNewYear = new Date(this.getFullYear(),0,1);
	        var prevmodDay = prevNewYear.getDay();
	        if (prevmodDay == 0) prevmodDay = 6; else prevmodDay--;
	        if (prevmodDay < 4) weeknum = 53; else weeknum = 52;
	    }
	}
	
	return + weeknum;
}*/
//-----------------------------------------------------------------------------
Date.prototype.getUeDay = function () //returns the number of DAYS since the UNIX Epoch - good for comparing the date portion
{
	return parseInt(Math.floor((this.getTime() - this.getTimezoneOffset() * 60000)/86400000)); //must take into account the local timezone
};
//-----------------------------------------------------------------------------
Date.prototype.dateFormat = function(format)
{
	if(!format) { // the default date format to use - can be customized to the current locale
		format = 'Y-m-d';
	}
	LZ = function(x) {return(x < 0 || x > 9 ? '' : '0') + x};
	var MONTH_NAMES = new Array('Styczeń','Luty','Marzec','Kwiecień','Maj','Czerwiec','Lipiec','Sierpień','Wrzesień','Październik','Listopad','Grudzień','Sty','Lut','Mar','Kwi','Maj','Cze','Lip','Sie','Wrz','Paź','Lis','Gru');
	var DAY_NAMES = new Array('Niedziela','Poniedziałek','Wtorek','Środa','Czwartek','Piątek','Sobota','Nie','Pon','Wto','śro','Czw','Pią','Sob');
	format = format + "";
	var result="";
	var i_format=0;
	var c="";
	var token="";
	var y=this.getFullYear().toString();
	var M=this.getMonth()+1;
	var d=this.getDate();
	var E=this.getDay();
	var H=this.getHours();
	var m=this.getMinutes();
	var s=this.getSeconds();
	var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;
	// Convert real this parts into formatted versions
	var value = new Object();
	//if (y.length < 4) {y=''+(y-0+1900);}
	value['Y'] = y.toString();
	value['y'] = y.substring(2);
	value['n'] = M;
	value['m'] = LZ(M);
	value['F'] = MONTH_NAMES[M-1];
	value['M'] = MONTH_NAMES[M+11];
	value['j'] = d;
	value['d'] = LZ(d);
	value['D'] = DAY_NAMES[E+7];
	value['l'] = DAY_NAMES[E];
	value['G'] = H;
	value['H'] = LZ(H);
	if (H==0) {value['g']=12;}
	else if (H>12){value['g']=H-12;}
	else {value['g']=H;}
	value['h']=LZ(value['g']);
	if (H > 11) {value['a']='pm'; value['A'] = 'PM';}
	else { value['a']='am'; value['A'] = 'AM';}
	value['i']=LZ(m);
	value['s']=LZ(s);
	//construct the result string
	while (i_format < format.length) {
		c=format.charAt(i_format);
		token="";
		while ((format.charAt(i_format)==c) && (i_format < format.length)) {
			token += format.charAt(i_format++);
			}
		if (value[token] != null) { result=result + value[token]; }
		else { result=result + token; }
		}
	return result;
};
/*****************************************************************************/
Array.prototype.arrayIndex = function(searchVal,startIndex) //similar to array.indexOf() - created to fix IE deficiencies
{
	startIndex = (startIndex != null ? startIndex : 0); //default startIndex to 0, if not set
	for(var i=startIndex;i<this.length;i++)
	{
		if(searchVal == this[i]) {
			return i;
		}
	}
	return -1;
};
/*****************************************************************************/

var kalendarz = [null,null];

window.onload = function(){
		kalendarz[0] = new Epoch('epoch_popup','popup',$$('#r_inp1 input')[0]);
		kalendarz[1] = new Epoch('epoch_popup','popup',$$('#r_inp2 input')[0]);
}
