/* Merged Plone Javascript file
 * This file is dynamically assembled from separate parts.
 * Some of these parts have 3rd party licenses or copyright information attached
 * Such information is valid for that section,
 * not for the entire composite file
 * originating files are separated by ----- filename.js -----
 */

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


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

var Lightbox = {

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

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

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

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

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

		var nextEffect = this.nextEffect.bind(this);
		this.fx = {
			overlay: this.overlay.effect('opacity', {duration: 500}).hide(),
			resize: this.center.effects({duration: this.options.resizeDuration, transition: this.options.resizeTransition, onComplete: nextEffect}),
			image: this.image.effect('opacity', {duration: 500, onComplete: nextEffect}),
			bottom: this.bottom.effect('margin-top', {duration: 400, onComplete: nextEffect})
		};

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

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

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

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

	open: function(images, imageNum){
		this.images = images;
		this.position();
		this.setup(true);
		this.top = window.getScrollTop() + (window.getHeight() / 15);
		this.center.setStyles({top: this.top+'px', display: ''});
		this.fx.overlay.start(0.8);
		return this.changeImage(imageNum);
	},

	position: function(){
		this.overlay.setStyles({top: window.getScrollTop()+'px', height: window.getHeight()+'px'});
	},

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

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

	previous: function(){
		return this.changeImage(this.activeImage-1);
	},

	next: function(){
		return this.changeImage(this.activeImage+1);
	},

	changeImage: function(imageNum){
		if (this.step || (imageNum < 0) || (imageNum >= this.images.length)) return false;
		this.step = 1;
		this.activeImage = imageNum;

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

		this.preload = new Image();
		this.preload.onload = this.nextEffect.bind(this);
		this.preload.src = this.images[imageNum][0];
		return false;
	},

	nextEffect: function(){
		switch (this.step++){
		case 1:
			this.center.className = '';
			this.image.style.backgroundImage = 'url('+this.images[this.activeImage][0]+')';
			this.image.style.width = this.bottom.style.width = this.preload.width+'px';
			this.image.style.height = this.prevLink.style.height = this.nextLink.style.height = this.preload.height+'px';

			this.caption.setHTML(this.images[this.activeImage][1] || '');
			this.number.setHTML((this.images.length == 1) ? '' : 'Image '+(this.activeImage+1)+' of '+this.images.length);

			if (this.activeImage) this.preloadPrev.src = this.images[this.activeImage-1][0];
			if (this.activeImage != (this.images.length - 1)) this.preloadNext.src = this.images[this.activeImage+1][0];
			if (this.center.clientHeight != this.image.offsetHeight){
				this.fx.resize.start({height: this.image.offsetHeight});
				break;
			}
			this.step++;
		case 2:
			if (this.center.clientWidth != this.image.offsetWidth){
				this.fx.resize.start({width: this.image.offsetWidth, marginLeft: -this.image.offsetWidth/2});
				break;
			}
			this.step++;
		case 3:
			this.bottomContainer.setStyles({top: (this.top + this.center.clientHeight)+'px', height: '0px', marginLeft: this.center.style.marginLeft, display: ''});
			this.fx.image.start(1);
			break;
		case 4:
			if (this.options.animateCaption){
				this.fx.bottom.set(-this.bottom.offsetHeight);
				this.bottomContainer.style.height = '';
				this.fx.bottom.start(0);
				break;
			}
			this.bottomContainer.style.height = '';
		case 5:
			if (this.activeImage) this.prevLink.style.display = '';
			if (this.activeImage != (this.images.length - 1)) this.nextLink.style.display = '';
			this.step = 0;
		}
	},

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

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


/* ----- walseralps.js ----- */
/*
************************************************************
    walser dictionary.
    dropdown selects the dialect and reloads the page. 
    @author <harald.friessnegger@lovelysystems.com>
*/
function updateDialects(){
	var baseUrl = document.getElementById('dialectForm').url.value;
	var letter = document.getElementById('dialectForm').letter.value;
	var d1 = document.getElementById('dialectForm').dialect1.value;
	var d2 = document.getElementById('dialectForm').dialect2.value;	
	var d3 = document.getElementById('dialectForm').dialect3.value;	
	var url = baseUrl + "/base_view/letter/" + letter + "/regions/" + d1 + "," + d2 + "," + d3;
	document.location.href = url;
}

/*
************************************************************
    displays the details of a timeline event inside the 
    division with the unique id "timelineEventDetails"
    this method makes use of sarissa library to postload the
    content.
    @author <manfred.schwendinger@lovelysystems.com>
*/
function showTimelineEventDetails(url){
    
    var xmlhttp = new XMLHttpRequest();
    xmlhttp.open("GET", url, false);
    xmlhttp.send(null);
    
    var target_dom = document.getElementById("timelineEventDetails");
    if (!target_dom){
        alert("ERROR: target dom for detail information of timeline event not found");
        return false;
    }
    
    target_dom.innerHTML = xmlhttp.responseText;
    
}

/*
************************************************************
    displays the details for the dictionary - vocabulary
    inside the div with the id "vocable-info"
    @author <manfred.schwendinger@lovelysystems.com>
    
*/
function showVocabularyDetails(url){
    
    var xmlhttp = new XMLHttpRequest();
    xmlhttp.open("GET", url, false);
    xmlhttp.send(null);
    
    var target_dom = document.getElementById("vocable-info");
    if (!target_dom){
        alert("ERROR: target dom for detail information of dictionary vocabulary not found");
        return false;
    }
    
    target_dom.innerHTML = xmlhttp.responseText;

}



/**
************************************************************
    function who changes the target of all links inside the html-page.
    internal links: _self
    external links and pdfs: _blank
    @author <manfred.schwendinger@lovelysystems.com>
    
*/
var parseInternalExternalLinks = function(){
    
    // define the identifier inside the href, which tells the
    // script that the link is internal. 
    var internal_array = new Array();
    
    var internal_str = "walser";
    var debug = false;
    
    var anchor_arr = document.getElementsByTagName("a");
    
    var debug_msg = "";
    for (var i=0; i<anchor_arr.length; i++){
        var href = anchor_arr[i].getAttribute("href");
        var target=null;
        
        if (href == null) continue;
        
        href = href.toLowerCase();
        if (href.indexOf("javascript") != -1) continue;
        
        if (href.indexOf(".pdf") == href.length-4){
            // it is a pdf. open it in a new window
            target = "_blank";
        }
        else if (href.indexOf(internal_str)!= -1){
            // it is an internal link. 
            target = "_self";
        }
        else{
            // seems to be an external link. 
            target = "_blank";
        }
        
        debug_msg +="\n"+href+" target: "+target;
        
        anchor_arr[i].setAttribute("target", target);
        
    }
    
    
    if (debug == true) alert(debug_msg);

}

registerPloneFunction(parseInternalExternalLinks);


/**
************************************************************
    manages the next / previouse buttons from the 
    article-portlet (portlet_articles.pt)
    @author <manfred.schwendinger@lovelysystems.com>   
*/

apIndex = 0;
apArticlesPerPage = 5;
apArticles = new Array();

var apShow = function(index){
    
    
    
    //alert("show: "+index+" len: "+apArticles.length);
    // set display:None for all articles
    for (i=0; i<apArticles.length; i++){   
        apDisplay(apArticles[i], "none");
    }
        
    // activate the new index
    for (var i=index; i<(index+apArticlesPerPage); i++){
        if (i>=apArticles.length) break;
        apDisplay(apArticles[i], "block");
    }
    
    // remember the index.
    apIndex = index;

    var next_btn = document.getElementById("portlet_articles-next");
    var prev_btn = document.getElementById("portlet_articles-prev");
    
    if (index == 0){
        // hide the prev button
        apDisplay(prev_btn, "none");
    }
    else{
        apDisplay(prev_btn, "block");
    }
    
    if (index>=apArticles.length - apArticlesPerPage){
        // hide the next button
        apDisplay(next_btn, "none");
    }
    else{
        apDisplay(next_btn, "block");
    }
}

var apPrevPage = function(){
    apShow(apIndex - apArticlesPerPage);
}
var apNextPage = function(){
    apShow(apIndex + apArticlesPerPage);
}

var apDisplay = function(element, mode){
    if (element.style){
        element.style.display = mode;
    }
    else{
        element.setAttribute("style", "display:"+mode);
    }
}

/**
    initializes the js functionality for the articlePortlet.
*/

var apInit = function(){
    
    // get pointers to the next and previous buttons
    var next_btn = document.getElementById("portlet_articles-next");
    var prev_btn = document.getElementById("portlet_articles-prev");
    
    if (next_btn && prev_btn){
        // the article portlet exists. add js functionality...
    
        var i=1;
        // add all pointers to the dom nodes of the articles to the array    
        while(document.getElementById("articlepreview-"+i)){
            apArticles.push(document.getElementById("articlepreview-"+i));
            i++;
        }
                        
        this.apShow(apIndex);    
    }
}


registerPloneFunction(apInit);

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

/*
    alters all images tags inside the content area, which have an
    "alt" or "title" attribute set.
    "title" attribute is stronger than "alt" attribute
    
    
    But NOT ALL images who have an alt tag display him as a image-title. Only Images which
    are not used as previews. The preview images have a specified width of < 100px.
    If the width attribute is available and if it is smaller than 100px, the image will not
    be touched. 
    
    e.g.
    
    <img class="image-left" alt="hello world" src="trachten_files/flag-it.gif" title="This is my lovely image">
    gets:
    <div class="image-left">
        <div><img alt="hello world" src="trachten_files/flag-it.gif" title="This is my lovely image"></div>
        <div class="imagetitle">hello world</div>
    </div>
*/

function scanforimages() {
    // terminate if we hit a non-compliant DOM implementation
    if (!W3CDOM) { return false; }

    contentarea = getContentArea();
    if (!contentarea) { return false; }

    images = contentarea.getElementsByTagName('img');
    for (i=0; i < images.length; i++) {
        if (images[i].getAttribute('alt')){
            
            var make_subtitle = true;
            
            var image_title = images[i].getAttribute('alt');
            if (image_title == '') make_subtitle = false;
            
            if (images[i].getAttribute("width")){
                // if the width < 100px we do not care about that image.
                var width = parseInt(images[i].getAttribute("width"));
                if (width < 100){
                    make_subtitle = false;
                }
            }
                    
            if (make_subtitle == true){

                var outerdiv = document.createElement('div')
                outerdiv.className = images[i].className;

                images[i].className = "";

                    var imagediv = document.createElement('div')
                    outerdiv.appendChild(imagediv);
                    
                    var titlediv = document.createElement('div')
                    titlediv.setAttribute("class", "imagetitle");
                    outerdiv.appendChild(titlediv);
                    
                        var titlenode = document.createTextNode(image_title);
                        titlediv.appendChild(titlenode);
                        
                var innerNode = images[i].parentNode.replaceChild(outerdiv, images[i]);         
                imagediv.appendChild(innerNode);
            }
        }
    }
};



registerPloneFunction(scanforimages);
