
	
	
	

	
	
//jquery.js
eval(function(p,a,c,k,e,r){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--)r[e(c)]=k[c]||e(c);k=[function(e){return r[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}('(I(){K y=6,17,7A=y.H,4n$=y.$,H=y.H=y.$=I(a,b){J 2Q H.1c.64(a,b)},7B=/^[^<]*(<(.|\\s)+>)[^>]*$|^#([\\w-]+)$/,7C=/^.[^:#\\[\\.,]*$/;H.1c=H.27={64:I(a,b){a=a||M;7(a.11){6[0]=a;6.L=1;6.39=a;J 6}7(19 a==="1C"){K c=7B.2G(a);7(c&&(c[1]||!b)){7(c[1])a=H.53([c[1]],b);N{K d=M.3N(c[3]);7(d&&d.2d!=c[3])J H().1v(a);K e=H(d||[]);e.39=M;e.1Q=a;J e}}N J H(b).1v(a)}N 7(H.1R(a))J H(M).2H(a);7(a.1Q&&a.39){6.1Q=a.1Q;6.39=a.39}J 6.7D(H.3a(a)?a:H.2v(a))},1Q:"",65:"1.3.2",9x:I(){J 6.L},3b:I(a){J a===17?2w.27.1S.1j(6):6[a]},2x:I(a,b,c){K d=H(a);d.66=6;d.39=6.39;7(b==="1v")d.1Q=6.1Q+(6.1Q?" ":"")+c;N 7(b)d.1Q=6.1Q+"."+b+"("+c+")";J d},7D:I(a){6.L=0;2w.27.1k.1w(6,a);J 6},12:I(a,b){J H.12(6,a,b)},54:I(a){J H.2R(a&&a.65?a[0]:a,6)},2e:I(a,b,c){K d=a;7(19 a==="1C")7(b===17)J 6[0]&&H[c||"2e"](6[0],a);N{d={};d[a]=b}J 6.12(I(i){Q(a 1q d)H.2e(c?6.V:6,a,H.1g(6,d[a],c,i,a))})},28:I(a,b){7((a==\'2f\'||a==\'2y\')&&2S(b)<0)b=17;J 6.2e(a,b,"2p")},1D:I(a){7(19 a!=="1W"&&a!=R)J 6.55().3O((6[0]&&6[0].1z||M).56(a));K b="";H.12(a||6,I(){H.12(6.3c,I(){7(6.11!=8)b+=6.11!=1?6.57:H.1c.1D([6])})});J b},67:I(b){7(6[0]){K c=H(b,6[0].1z).68();7(6[0].1h)c.2z(6[0]);c.2q(I(){K a=6;1t(a.1n)a=a.1n;J a}).3O(6)}J 6},9y:I(a){J 6.12(I(){H(6).7E().67(a)})},9z:I(a){J 6.12(I(){H(6).67(a)})},3O:I(){J 6.4o(1o,P,I(a){7(6.11==1)6.2I(a)})},7F:I(){J 6.4o(1o,P,I(a){7(6.11==1)6.2z(a,6.1n)})},7G:I(){J 6.4o(1o,T,I(a){6.1h.2z(a,6)})},69:I(){J 6.4o(1o,T,I(a){6.1h.2z(a,6.3d)})},58:I(){J 6.66||H([])},1k:[].1k,3e:[].3e,3f:[].3f,1v:I(b){7(6.L===1){K c=6.2x([],"1v",b);c.L=0;H.1v(b,6[0],c);J c}N{J 6.2x(H.59(H.2q(6,I(a){J H.1v(b,a)})),"1v",b)}},68:I(d){K e=6.2q(I(){7(!H.1M.6a&&!H.5a(6)){K a=6.9A;7(!a){K b=6.1z.1T("15");b.2I(6.5b(P));a=b.2A}J H.53([a.1p(/ H\\d+="(?:\\d+|R)"/g,"").1p(/^\\s*/,"")])[0]}N J 6.5b(P)});7(d===P){K f=6.1v("*").6b(),i=0;e.1v("*").6b().12(I(){7(6.1i!==f[i].1i)J;K a=H.O(f[i],"2B");Q(K b 1q a){Q(K c 1q a[b]){H.18.1H(6,b,a[b][c],a[b][c].O)}}i++})}J e},1e:I(b){J 6.2x(H.1R(b)&&H.4p(6,I(a,i){J b.1j(a,i)})||H.3P(b,H.4p(6,I(a){J a.11===1})),"1e",b)},4q:I(b){K c=H.3g.Y.3Q.1a(b)?H(b):R,6c=0;J 6.2q(I(){K a=6;1t(a&&a.1z){7(c?c.54(a)>-1:H(a).4r(b)){H.O(a,"4q",6c);J a}a=a.1h;6c++}})},4s:I(a){7(19 a==="1C")7(7C.1a(a))J 6.2x(H.3P(a,6,P),"4s",a);N a=H.3P(a,6);K b=a.L&&a[a.L-1]!==17&&!a.11;J 6.1e(I(){J b?H.2R(6,a)<0:6!=a})},1H:I(a){J 6.2x(H.59(H.6d(6.3b(),19 a==="1C"?H(a):H.2v(a))))},4r:I(a){J!!a&&H.3P(a,6).L>0},9B:I(a){J!!a&&6.4r("."+a)},6e:I(b){7(b===17){K c=6[0];7(c){7(H.1i(c,\'5c\'))J(c.9C.1x||{}).7H?c.1x:c.1D;7(H.1i(c,"2r")){K d=c.5d,6f=[],1f=c.1f,3h=c.14=="2r-3h";7(d<0)J R;Q(K i=3h?d:0,3R=3h?d+1:1f.L;i<3R;i++){K e=1f[i];7(e.4t){b=H(e).6e();7(3h)J b;6f.1k(b)}}J 6f}J(c.1x||"").1p(/\\r/g,"")}J 17}7(19 b==="4u")b+=\'\';J 6.12(I(){7(6.11!=1)J;7(H.3a(b)&&/6g|6h/.1a(6.14))6.5e=(H.2R(6.1x,b)>=0||H.2R(6.2g,b)>=0);N 7(H.1i(6,"2r")){K a=H.2v(b);H("5c",6).12(I(){6.4t=(H.2R(6.1x,a)>=0||H.2R(6.1D,a)>=0)});7(!a.L)6.5d=-1}N 6.1x=b})},2J:I(a){J a===17?(6[0]?6[0].2A.1p(/ H\\d+="(?:\\d+|R)"/g,""):R):6.55().3O(a)},7I:I(a){J 6.69(a).1X()},6i:I(i){J 6.1S(i,+i+1)},1S:I(){J 6.2x(2w.27.1S.1w(6,1o),"1S",2w.27.1S.1j(1o).3i(","))},2q:I(b){J 6.2x(H.2q(6,I(a,i){J b.1j(a,i,a)}))},6b:I(){J 6.1H(6.66)},4o:I(c,d,e){7(6[0]){K f=(6[0].1z||6[0]).9D(),3S=H.53(c,(6[0].1z||6[0]),f),2T=f.1n;7(2T)Q(K i=0,l=6.L;i<l;i++)e.1j(4v(6[i],2T),6.L>1||i>0?f.5b(P):f);7(3S)H.12(3S,7J)}J 6;I 4v(a,b){J d&&H.1i(a,"1N")&&H.1i(b,"3T")?(a.1Y("1A")[0]||a.2I(a.1z.1T("1A"))):a}}};H.1c.64.27=H.1c;I 7J(i,a){7(a.5f)H.4w({1r:a.5f,3j:T,1Z:"1l"});N H.6j(a.1D||a.7K||a.2A||"");7(a.1h)a.1h.2h(a)}I 21(){J+2Q 6k}H.1B=H.1c.1B=I(){K a=1o[0]||{},i=1,L=1o.L,5g=T,1f;7(19 a==="6l"){5g=a;a=1o[1]||{};i=2}7(19 a!=="1W"&&!H.1R(a))a={};7(L==i){a=6;--i}Q(;i<L;i++)7((1f=1o[i])!=R)Q(K b 1q 1f){K c=a[b],2K=1f[b];7(a===2K)7L;7(5g&&2K&&19 2K==="1W"&&!2K.11)a[b]=H.1B(5g,c||(2K.L!=R?[]:{}),2K);N 7(2K!==17)a[b]=2K}J a};K z=/z-?54|9E-?9F|1E|7M|9G-?2y/i,2U=M.2U||{},2C=7N.27.2C;H.1B({9H:I(a){y.$=4n$;7(a)y.H=7A;J H},1R:I(a){J 2C.1j(a)==="[1W 9I]"},3a:I(a){J 2C.1j(a)==="[1W 2w]"},5a:I(a){J a.11===9&&a.1y.1i!=="7O"||!!a.1z&&H.5a(a.1z)},6j:I(a){7(a&&/\\S/.1a(a)){K b=M.1Y("7P")[0]||M.1y,1l=M.1T("1l");1l.14="1D/3U";7(H.1M.6m)1l.2I(M.56(a));N 1l.1D=a;b.2z(1l,b.1n);b.2h(1l)}},1i:I(a,b){J a.1i&&a.1i.2s()==b.2s()},12:I(a,b,c){K d,i=0,L=a.L;7(c){7(L===17){Q(d 1q a)7(b.1w(a[d],c)===T)1I}N Q(;i<L;)7(b.1w(a[i++],c)===T)1I}N{7(L===17){Q(d 1q a)7(b.1j(a[d],d,a[d])===T)1I}N Q(K e=a[0];i<L&&b.1j(e,i,e)!==T;e=a[++i]){}}J a},1g:I(a,b,c,i,d){7(H.1R(b))b=b.1j(a,i);J 19 b==="4u"&&c=="2p"&&!z.1a(d)?b+"3k":b},1F:{1H:I(b,c){H.12((c||"").2i(/\\s+/),I(i,a){7(b.11==1&&!H.1F.4x(b.1F,a))b.1F+=(b.1F?" ":"")+a})},1X:I(b,c){7(b.11==1)b.1F=c!==17?H.4p(b.1F.2i(/\\s+/),I(a){J!H.1F.4x(c,a)}).3i(" "):""},4x:I(a,b){J a&&H.2R(b,(a.1F||a).2C().2i(/\\s+/))>-1}},7Q:I(a,b,c){K d={};Q(K e 1q b){d[e]=a.V[e];a.V[e]=b[e]}c.1j(a);Q(K e 1q b)a.V[e]=d[e]},28:I(a,b,c,d){7(b=="2f"||b=="2y"){K e,3l={2D:"5h",7R:"29",1s:"5i"},3m=b=="2f"?["6n","7S"]:["6o","7T"];I 6p(){e=b=="2f"?a.4y:a.6q;7(d==="3V")J;H.12(3m,I(){7(!d)e-=2S(H.2p(a,"5j"+6,P))||0;7(d==="3W")e+=2S(H.2p(a,"3W"+6,P))||0;N e-=2S(H.2p(a,"3V"+6+"7U",P))||0})}7(a.4y!==0)6p();N H.7Q(a,3l,6p);J 3n.3R(0,3n.9J(e))}J H.2p(a,b,c)},2p:I(c,d,e){K f,V=c.V;7(d=="1E"&&!H.1M.1E){f=H.2e(V,"1E");J f==""?"1":f}7(d.Y(/4z/i))d=E;7(!e&&V&&V[d])f=V[d];N 7(2U.5k){7(d.Y(/4z/i))d="4z";d=d.1p(/([A-Z])/g,"-$1").3X();K g=2U.5k(c,R);7(g)f=g.9K(d);7(d=="1E"&&f=="")f="1"}N 7(c.5l){K h=d.1p(/\\-(\\w)/g,I(a,b){J b.2s()});f=c.5l[d]||c.5l[h];7(!/^\\d+(3k)?$/i.1a(f)&&/^\\d/.1a(f)){K i=V.1b,7V=c.6r.1b;c.6r.1b=c.5l.1b;V.1b=f||0;f=V.9L+"3k";V.1b=i;c.6r.1b=7V}}J f},53:I(h,k,l){k=k||M;7(19 k.1T==="17")k=k.1z||k[0]&&k[0].1z||M;7(!l&&h.L===1&&19 h[0]==="1C"){K m=/^<(\\w+)\\s*\\/?>$/.2G(h[0]);7(m)J[k.1T(m[1])]}K n=[],3S=[],15=k.1T("15");H.12(h,I(i,d){7(19 d==="4u")d+=\'\';7(!d)J;7(19 d==="1C"){d=d.1p(/(<(\\w+)[^>]*?)\\/>/g,I(a,b,c){J c.Y(/^(9M|br|7W|9N|3Y|6s|9O|3Z|9P|7X|9Q)$/i)?a:b+"></"+c+">"});K e=d.1p(/^\\s+/,"").9R(0,10).3X();K f=!e.1J("<9S")&&[1,"<2r 7Y=\'7Y\'>","</2r>"]||!e.1J("<9T")&&[1,"<7Z>","</7Z>"]||e.Y(/^<(9U|1A|9V|9W|9X)/)&&[1,"<1N>","</1N>"]||!e.1J("<3T")&&[2,"<1N><1A>","</1A></1N>"]||(!e.1J("<40")||!e.1J("<9Y"))&&[3,"<1N><1A><3T>","</3T></1A></1N>"]||!e.1J("<7W")&&[2,"<1N><1A></1A><80>","</80></1N>"]||!H.1M.81&&[1,"15<15>","</15>"]||[0,"",""];15.2A=f[1]+d+f[2];1t(f[0]--)15=15.82;7(!H.1M.1A){K g=/<1A/i.1a(d),1A=!e.1J("<1N")&&!g?15.1n&&15.1n.3c:f[1]=="<1N>"&&!g?15.3c:[];Q(K j=1A.L-1;j>=0;--j)7(H.1i(1A[j],"1A")&&!1A[j].3c.L)1A[j].1h.2h(1A[j])}7(!H.1M.83&&/^\\s/.1a(d))15.2z(k.56(d.Y(/^\\s*/)[0]),15.1n);d=H.2v(15.3c)}7(d.11)n.1k(d);N n=H.6d(n,d)});7(l){Q(K i=0;n[i];i++){7(H.1i(n[i],"1l")&&(!n[i].14||n[i].14.3X()==="1D/3U")){3S.1k(n[i].1h?n[i].1h.2h(n[i]):n[i])}N{7(n[i].11===1)n.3f.1w(n,[i+1,0].5m(H.2v(n[i].1Y("1l"))));l.2I(n[i])}}J 3S}J n},2e:I(c,d,e){7(!c||c.11==3||c.11==8)J 17;K f=!H.5a(c),1G=e!==17;d=f&&H.3l[d]||d;7(c.41){K g=/2t|5f|V/.1a(d);7(d=="4t"&&c.1h)c.1h.5d;7(d 1q c&&f&&!g){7(1G){7(d=="14"&&H.1i(c,"3Y")&&c.1h)5n"14 9Z a0\'t be a1";c[d]=e}7(H.1i(c,"6t")&&c.3o(d))J c.3o(d).57;7(d=="6u"){K h=c.3o("6u");J h&&h.7H?h.1x:c.1i.Y(/(2L|3Y|1W|2r|6v)/i)?0:c.1i.Y(/^(a|7X)$/i)&&c.2t?0:17}J c[d]}7(!H.1M.V&&f&&d=="V")J H.2e(c.V,"a2",e);7(1G)c.a3(d,""+e);K i=!H.1M.84&&f&&g?c.2j(d,2):c.2j(d);J i===R?17:i}7(!H.1M.1E&&d=="1E"){7(1G){c.7M=1;c.1e=(c.1e||"").1p(/85\\([^)]*\\)/,"")+(2V(e)+\'\'=="a4"?"":"85(1E="+e*86+")")}J c.1e&&c.1e.1J("1E=")>=0?(2S(c.1e.Y(/1E=([^)]*)/)[1])/86)+\'\':""}d=d.1p(/-([a-z])/a5,I(a,b){J b.2s()});7(1G)c[d]=e;J c[d]},a6:I(a){J(a||"").1p(/^\\s+|\\s+$/g,"")},2v:I(a){K b=[];7(a!=R){K i=a.L;7(i==R||19 a==="1C"||H.1R(a)||a.5o)b[0]=a;N 1t(i)b[--i]=a[i]}J b},2R:I(a,b){Q(K i=0,L=b.L;i<L;i++)7(b[i]===a)J i;J-1},6d:I(a,b){K i=0,U,3p=a.L;7(!H.1M.a7){1t((U=b[i++])!=R)7(U.11!=8)a[3p++]=U}N 1t((U=b[i++])!=R)a[3p++]=U;J a},59:I(a){K b=[],3q={};1U{Q(K i=0,L=a.L;i<L;i++){K c=H.O(a[i]);7(!3q[c]){3q[c]=P;b.1k(a[i])}}}1V(e){b=a}J b},4p:I(a,b,c){K d=[];Q(K i=0,L=a.L;i<L;i++)7(!c!=!b(a[i],i))d.1k(a[i]);J d},2q:I(a,b){K c=[];Q(K i=0,L=a.L;i<L;i++){K d=b(a[i],i);7(d!=R)c[c.L]=d}J c.5m.1w([],c)}});K A=a8.a9.3X();H.aa={ab:(A.Y(/.+(?:ac|ad|ae|af)[\\/: ]([\\d.]+)/)||[0,\'0\'])[1],ag:/87/.1a(A),6w:/6w/.1a(A),88:/88/.1a(A)&&!/6w/.1a(A),89:/89/.1a(A)&&!/(ah|87)/.1a(A)};H.12({3r:I(a){J a.1h},ai:I(a){J H.5p(a,"1h")},aj:I(a){J H.2W(a,2,"3d")},ak:I(a){J H.2W(a,2,"3s")},al:I(a){J H.5p(a,"3d")},am:I(a){J H.5p(a,"3s")},an:I(a){J H.6x(a.1h.1n,a)},8a:I(a){J H.6x(a.1n)},7E:I(a){J H.1i(a,"ao")?a.ap||a.aq.M:H.2v(a.3c)}},I(c,d){H.1c[c]=I(a){K b=H.2q(6,d);7(a&&19 a=="1C")b=H.3P(a,b);J 6.2x(H.59(b),c,a)}});H.12({8b:"3O",ar:"7F",2z:"7G",as:"69",at:"7I"},I(d,e){H.1c[d]=I(a){K b=[],6y=H(a);Q(K i=0,l=6y.L;i<l;i++){K c=(i>0?6.68(P):6).3b();H.1c[e].1w(H(6y[i]),c);b=b.5m(c)}J 6.2x(b,d,a)}});H.12({au:I(a){H.2e(6,a,"");7(6.11==1)6.6z(a)},av:I(a){H.1F.1H(6,a)},aw:I(a){H.1F.1X(6,a)},ax:I(a,b){7(19 b!=="6l")b=!H.1F.4x(6,a);H.1F[b?"1H":"1X"](6,a)},1X:I(a){7(!a||H.1e(a,[6]).L){H("*",6).1H([6]).12(I(){H.18.1X(6);H.3t(6)});7(6.1h)6.1h.2h(6)}},55:I(){H(6).8a().1X();1t(6.1n)6.2h(6.1n)}},I(a,b){H.1c[a]=I(){J 6.12(b,1o)}});I 4A(a,b){J a[0]&&2V(H.2p(a[0],b,P),10)||0}K B="H"+21(),8c=0,6A={};H.1B({1O:{},O:I(a,b,c){a=a==y?6A:a;K d=a[B];7(!d)d=a[B]=++8c;7(b&&!H.1O[d])H.1O[d]={};7(c!==17)H.1O[d][b]=c;J b?H.1O[d][b]:d},3t:I(a,b){a=a==y?6A:a;K c=a[B];7(b){7(H.1O[c]){2X H.1O[c][b];b="";Q(b 1q H.1O[c])1I;7(!b)H.3t(a)}}N{1U{2X a[B]}1V(e){7(a.6z)a.6z(B)}2X H.1O[c]}},2E:I(a,b,c){7(a){b=(b||"2a")+"2E";K q=H.O(a,b);7(!q||H.3a(c))q=H.O(a,b,H.2v(c));N 7(c)q.1k(c)}J q},4B:I(a,b){K c=H.2E(a,b),1c=c.3u();7(!b||b==="2a")1c=c[0];7(1c!==17)1c.1j(a)}});H.1c.1B({O:I(a,b){K c=a.2i(".");c[1]=c[1]?"."+c[1]:"";7(b===17){K d=6.6B("ay"+c[1]+"!",[c[0]]);7(d===17&&6.L)d=H.O(6[0],a);J d===17&&c[1]?6.O(c[0]):d}N J 6.1P("az"+c[1]+"!",[c[0],b]).12(I(){H.O(6,a,b)})},3t:I(a){J 6.12(I(){H.3t(6,a)})},2E:I(b,c){7(19 b!=="1C"){c=b;b="2a"}7(c===17)J H.2E(6[0],b);J 6.12(I(){K a=H.2E(6,b,c);7(b=="2a"&&a.L==1)a[0].1j(6)})},4B:I(a){J 6.12(I(){H.4B(6,a)})}});(I(){K k=/((?:\\((?:\\([^()]+\\)|[^()]+)+\\)|\\[(?:\\[[^[\\]]*\\]|[\'"][^\'"]*[\'"]|[^[\\]\'"]+)+\\]|\\\\.|[^ >+~,(\\[\\\\]+)+|[>+~])(\\s*,\\s*)?/g,3q=0,2C=7N.27.2C;K o=I(a,b,c,d){c=c||[];b=b||M;7(b.11!==1&&b.11!==9)J[];7(!a||19 a!=="1C"){J c}K e=[],m,1G,1K,2b,aA,5q,6C=P;k.aB=0;1t((m=k.2G(a))!==R){e.1k(m[1]);7(m[2]){5q=3v.aC;1I}}7(e.L>1&&q.2G(a)){7(e.L===2&&p.2M[e[0]]){1G=x(e[0]+e[1],b)}N{1G=p.2M[e[0]]?[b]:o(e.3u(),b);1t(e.L){a=e.3u();7(p.2M[a])a+=e.3u();1G=x(a,1G)}}}N{K f=d?{3g:e.2N(),1G:t(d)}:o.1v(e.2N(),e.L===1&&b.1h?b.1h:b,w(b));1G=o.1e(f.3g,f.1G);7(e.L>0){1K=t(1G)}N{6C=T}1t(e.L){K g=e.2N(),2N=g;7(!p.2M[g]){g=""}N{2N=e.2N()}7(2N==R){2N=b}p.2M[g](1K,2N,w(b))}}7(!1K){1K=1G}7(!1K){5n"8d 3w, 8e 8f: "+(g||a);}7(2C.1j(1K)==="[1W 2w]"){7(!6C){c.1k.1w(c,1K)}N 7(b.11===1){Q(K i=0;1K[i]!=R;i++){7(1K[i]&&(1K[i]===P||1K[i].11===1&&v(b,1K[i]))){c.1k(1G[i])}}}N{Q(K i=0;1K[i]!=R;i++){7(1K[i]&&1K[i].11===1){c.1k(1G[i])}}}}N{t(1K,c)}7(5q){o(5q,b,c,d);7(u){4C=T;c.3e(u);7(4C){Q(K i=1;i<c.L;i++){7(c[i]===c[i-1]){c.3f(i--,1)}}}}}J c};o.5r=I(a,b){J o(a,R,R,b)};o.1v=I(a,b,c){K d,Y;7(!a){J[]}Q(K i=0,l=p.5s.L;i<l;i++){K e=p.5s[i],Y;7((Y=p.Y[e].2G(a))){K f=3v.aD;7(f.6D(f.L-1)!=="\\\\"){Y[1]=(Y[1]||"").1p(/\\\\/g,"");d=p.1v[e](Y,b,c);7(d!=R){a=a.1p(p.Y[e],"");1I}}}}7(!d){d=b.1Y("*")}J{1G:d,3g:a}};o.1e=I(a,b,c,d){K e=a,22=[],2Y=b,Y,3x,8g=b&&b[0]&&w(b[0]);1t(a&&b.L){Q(K f 1q p.1e){7((Y=p.Y[f].2G(a))!=R){K g=p.1e[f],42,4D;3x=T;7(2Y==22){22=[]}7(p.6E[f]){Y=p.6E[f](Y,2Y,c,22,d,8g);7(!Y){3x=42=P}N 7(Y===P){7L}}7(Y){Q(K i=0;(4D=2Y[i])!=R;i++){7(4D){42=g(4D,Y,i,2Y);K h=d^!!42;7(c&&42!=R){7(h){3x=P}N{2Y[i]=T}}N 7(h){22.1k(4D);3x=P}}}}7(42!==17){7(!c){2Y=22}a=a.1p(p.Y[f],"");7(!3x){J[]}1I}}}7(a==e){7(3x==R){5n"8d 3w, 8e 8f: "+a;}N{1I}}e=a}J 2Y};K p=o.3y={5s:["3z","6F","43"],Y:{3z:/#((?:[\\w\\44-\\4E-]|\\\\.)+)/,4F:/\\.((?:[\\w\\44-\\4E-]|\\\\.)+)/,6F:/\\[2g=[\'"]*((?:[\\w\\44-\\4E-]|\\\\.)+)[\'"]*\\]/,6G:/\\[\\s*((?:[\\w\\44-\\4E-]|\\\\.)+)\\s*(?:(\\S?=)\\s*([\'"]*)(.*?)\\3|)\\s*\\]/,43:/^((?:[\\w\\44-\\aE\\*4n-]|\\\\.)+)/,5t:/:(8h|2W|3A|2T)-aF(?:\\((5u|5v|[\\aG+-]*)\\))?/,3Q:/:(2W|6i|8i|8j|2T|3A|5u|5v)(?:\\((\\d*)\\))?(?=[^-]|$)/,4G:/:((?:[\\w\\44-\\4E-]|\\\\.)+)(?:\\(([\'"]*)((?:\\([^\\)]+\\)|[^\\2\\(\\)]*)+)\\2\\))?/},6H:{"45":"1F","Q":"8k"},5w:{2t:I(a){J a.2j("2t")}},2M:{"+":I(a,b,c){K d=19 b==="1C",6I=d&&!/\\W/.1a(b),6J=d&&!6I;7(6I&&!c){b=b.2s()}Q(K i=0,l=a.L,U;i<l;i++){7((U=a[i])){1t((U=U.3s)&&U.11!==1){}a[i]=6J||U&&U.1i===b?U||T:U===b}}7(6J){o.1e(b,a,P)}},">":I(a,b,c){K d=19 b==="1C";7(d&&!/\\W/.1a(b)){b=c?b:b.2s();Q(K i=0,l=a.L;i<l;i++){K e=a[i];7(e){K f=e.1h;a[i]=f.1i===b?f:T}}}N{Q(K i=0,l=a.L;i<l;i++){K e=a[i];7(e){a[i]=d?e.1h:e.1h===b}}7(d){o.1e(b,a,P)}}},"":I(a,b,c){K d=3q++,46=6K;7(!b.Y(/\\W/)){K e=b=c?b:b.2s();46=6L}46("1h",b,d,a,e,c)},"~":I(a,b,c){K d=3q++,46=6K;7(19 b==="1C"&&!b.Y(/\\W/)){K e=b=c?b:b.2s();46=6L}46("3s",b,d,a,e,c)}},1v:{3z:I(a,b,c){7(19 b.3N!=="17"&&!c){K m=b.3N(a[1]);J m?[m]:[]}},6F:I(a,b,c){7(19 b.8l!=="17"){K d=[],3B=b.8l(a[1]);Q(K i=0,l=3B.L;i<l;i++){7(3B[i].2j("2g")===a[1]){d.1k(3B[i])}}J d.L===0?R:d}},43:I(a,b){J b.1Y(a[1])}},6E:{4F:I(a,b,c,d,e,f){a=" "+a[1].1p(/\\\\/g,"")+" ";7(f){J a}Q(K i=0,U;(U=b[i])!=R;i++){7(U){7(e^(U.1F&&(" "+U.1F+" ").1J(a)>=0)){7(!c)d.1k(U)}N 7(c){b[i]=T}}}J T},3z:I(a){J a[1].1p(/\\\\/g,"")},43:I(a,b){Q(K i=0;b[i]===T;i++){}J b[i]&&w(b[i])?a[1]:a[1].2s()},5t:I(a){7(a[1]=="2W"){K b=/(-?)(\\d*)n((?:\\+|-)?\\d*)/.2G(a[2]=="5u"&&"2n"||a[2]=="5v"&&"2n+1"||!/\\D/.1a(a[2])&&"aH+"+a[2]||a[2]);a[2]=(b[1]+(b[2]||1))-0;a[3]=b[3]-0}a[0]=3q++;J a},6G:I(a,b,c,d,e,f){K g=a[1].1p(/\\\\/g,"");7(!f&&p.6H[g]){a[1]=p.6H[g]}7(a[2]==="~="){a[4]=" "+a[4]+" "}J a},4G:I(a,b,c,d,e){7(a[1]==="4s"){7(a[3].Y(k).L>1||/^\\w/.1a(a[3])){a[3]=o(a[3],R,R,b)}N{K f=o.1e(a[3],b,c,P^e);7(!c){d.1k.1w(d,f)}J T}}N 7(p.Y.3Q.1a(a[0])||p.Y.5t.1a(a[0])){J P}J a},3Q:I(a){a.8m(P);J a}},47:{aI:I(a){J a.5x===T&&a.14!=="29"},5x:I(a){J a.5x===P},5e:I(a){J a.5e===P},4t:I(a){a.1h.5d;J a.4t===P},3r:I(a){J!!a.1n},55:I(a){J!a.1n},4x:I(a,i,b){J!!o(b[3],a).L},aJ:I(a){J/h\\d/i.1a(a.1i)},1D:I(a){J"1D"===a.14},6g:I(a){J"6g"===a.14},6h:I(a){J"6h"===a.14},6M:I(a){J"6M"===a.14},5y:I(a){J"5y"===a.14},6N:I(a){J"6N"===a.14},8n:I(a){J"8n"===a.14},8o:I(a){J"8o"===a.14},2L:I(a){J"2L"===a.14||a.1i.2s()==="aK"},3Y:I(a){J/3Y|2r|6v|2L/i.1a(a.1i)}},8p:{2T:I(a,i){J i===0},3A:I(a,i,b,c){J i===c.L-1},5u:I(a,i){J i%2===0},5v:I(a,i){J i%2===1},8j:I(a,i,b){J i<b[3]-0},8i:I(a,i,b){J i>b[3]-0},2W:I(a,i,b){J b[3]-0==i},6i:I(a,i,b){J b[3]-0==i}},1e:{4G:I(a,b,i,c){K d=b[1],1e=p.47[d];7(1e){J 1e(a,i,b,c)}N 7(d==="6O"){J(a.7K||a.aL||"").1J(b[3])>=0}N 7(d==="4s"){K e=b[3];Q(K i=0,l=e.L;i<l;i++){7(e[i]===a){J T}}J P}},5t:I(a,b){K c=b[1],23=a;aM(c){5z\'8h\':5z\'2T\':1t(23=23.3s){7(23.11===1)J T}7(c==\'2T\')J P;23=a;5z\'3A\':1t(23=23.3d){7(23.11===1)J T}J P;5z\'2W\':K d=b[2],3A=b[3];7(d==1&&3A==0){J P}K e=b[0],3r=a.1h;7(3r&&(3r.2Z!==e||!a.6P)){K f=0;Q(23=3r.1n;23;23=23.3d){7(23.11===1){23.6P=++f}}3r.2Z=e}K g=a.6P-3A;7(d==0){J g==0}N{J(g%d==0&&g/d>=0)}}},3z:I(a,b){J a.11===1&&a.2j("2d")===b},43:I(a,b){J(b==="*"&&a.11===1)||a.1i===b},4F:I(a,b){J(" "+(a.1F||a.2j("45"))+" ").1J(b)>-1},6G:I(a,b){K c=b[1],22=p.5w[c]?p.5w[c](a):a[c]!=R?a[c]:a.2j(c),1x=22+"",s=b[2],2b=b[4];J 22==R?s==="!=":s==="="?1x===2b:s==="*="?1x.1J(2b)>=0:s==="~="?(" "+1x+" ").1J(2b)>=0:!2b?1x&&22!==T:s==="!="?1x!=2b:s==="^="?1x.1J(2b)===0:s==="$="?1x.6D(1x.L-2b.L)===2b:s==="|="?1x===2b||1x.6D(0,2b.L+1)===2b+"-":T},3Q:I(a,b,i,c){K d=b[2],1e=p.8p[d];7(1e){J 1e(a,i,b,c)}}}};K q=p.Y.3Q;Q(K s 1q p.Y){p.Y[s]=3v(p.Y[s].8q+/(?![^\\[]*\\])(?![^\\(]*\\))/.8q)}K t=I(a,b){a=2w.27.1S.1j(a);7(b){b.1k.1w(b,a);J b}J a};1U{2w.27.1S.1j(M.1y.3c)}1V(e){t=I(a,b){K c=b||[];7(2C.1j(a)==="[1W 2w]"){2w.27.1k.1w(c,a)}N{7(19 a.L==="4u"){Q(K i=0,l=a.L;i<l;i++){c.1k(a[i])}}N{Q(K i=0;a[i];i++){c.1k(a[i])}}}J c}}K u;7(M.1y.5A){u=I(a,b){K c=a.5A(b)&4?-1:a===b?0:1;7(c===0){4C=P}J c}}N 7("6Q"1q M.1y){u=I(a,b){K c=a.6Q-b.6Q;7(c===0){4C=P}J c}}N 7(M.6R){u=I(a,b){K c=a.1z.6R(),5B=b.1z.6R();c.8r(a);c.8s(P);5B.8r(b);5B.8s(P);K d=c.aN(aO.aP,5B);7(d===0){4C=P}J d}}(I(){K d=M.1T("6t"),2d="1l"+(2Q 6k).8t();d.2A="<3Y 2g=\'"+2d+"\'/>";K e=M.1y;e.2z(d,e.1n);7(!!M.3N(2d)){p.1v.3z=I(a,b,c){7(19 b.3N!=="17"&&!c){K m=b.3N(a[1]);J m?m.2d===a[1]||19 m.3o!=="17"&&m.3o("2d").57===a[1]?[m]:17:[]}};p.1e.3z=I(a,b){K c=19 a.3o!=="17"&&a.3o("2d");J a.11===1&&c&&c.57===b}}e.2h(d)})();(I(){K e=M.1T("15");e.2I(M.aQ(""));7(e.1Y("*").L>0){p.1v.43=I(a,b){K c=b.1Y(a[1]);7(a[1]==="*"){K d=[];Q(K i=0;c[i];i++){7(c[i].11===1){d.1k(c[i])}}c=d}J c}}e.2A="<a 2t=\'#\'></a>";7(e.1n&&19 e.1n.2j!=="17"&&e.1n.2j("2t")!=="#"){p.5w.2t=I(a){J a.2j("2t",2)}}})();7(M.5C)(I(){K f=o,15=M.1T("15");15.2A="<p 45=\'8u\'></p>";7(15.5C&&15.5C(".8u").L===0){J}o=I(a,b,c,d){b=b||M;7(!d&&b.11===9&&!w(b)){1U{J t(b.5C(a),c)}1V(e){}}J f(a,b,c,d)};o.1v=f.1v;o.1e=f.1e;o.3y=f.3y;o.5r=f.5r})();7(M.48&&M.1y.48)(I(){K d=M.1T("15");d.2A="<15 45=\'1a e\'></15><15 45=\'1a\'></15>";7(d.48("e").L===0)J;d.82.1F="e";7(d.48("e").L===1)J;p.5s.3f(1,0,"4F");p.1v.4F=I(a,b,c){7(19 b.48!=="17"&&!c){J b.48(a[1])}}})();I 6L(a,b,c,d,e,f){K g=a=="3s"&&!f;Q(K i=0,l=d.L;i<l;i++){K h=d[i];7(h){7(g&&h.11===1){h.2Z=c;h.49=i}h=h[a];K j=T;1t(h){7(h.2Z===c){j=d[h.49];1I}7(h.11===1&&!f){h.2Z=c;h.49=i}7(h.1i===b){j=h;1I}h=h[a]}d[i]=j}}}I 6K(a,b,c,d,e,f){K g=a=="3s"&&!f;Q(K i=0,l=d.L;i<l;i++){K h=d[i];7(h){7(g&&h.11===1){h.2Z=c;h.49=i}h=h[a];K j=T;1t(h){7(h.2Z===c){j=d[h.49];1I}7(h.11===1){7(!f){h.2Z=c;h.49=i}7(19 b!=="1C"){7(h===b){j=P;1I}}N 7(o.1e(b,[h]).L>0){j=h;1I}}h=h[a]}d[i]=j}}}K v=M.5A?I(a,b){J a.5A(b)&16}:I(a,b){J a!==b&&(a.6O?a.6O(b):P)};K w=I(a){J a.11===9&&a.1y.1i!=="7O"||!!a.1z&&w(a.1z)};K x=I(a,b){K c=[],6S="",Y,4v=b.11?[b]:b;1t((Y=p.Y.4G.2G(a))){6S+=Y[0];a=a.1p(p.Y.4G,"")}a=p.2M[a]?a+"*":a;Q(K i=0,l=4v.L;i<l;i++){o(a,4v[i],c)}J o.1e(6S,c)};H.1v=o;H.1e=o.1e;H.3g=o.3y;H.3g[":"]=H.3g.47;o.3y.47.29=I(a){J a.4y===0||a.6q===0};o.3y.47.8v=I(a){J a.4y>0||a.6q>0};o.3y.47.aR=I(b){J H.4p(H.4H,I(a){J b===a.U}).L};H.3P=I(a,b,c){7(c){a=":4s("+a+")"}J o.5r(a,b)};H.5p=I(a,b){K c=[],2k=a[b];1t(2k&&2k!=M){7(2k.11==1)c.1k(2k);2k=2k[b]}J c};H.2W=I(a,b,c,d){b=b||1;K e=0;Q(;a;a=a[c])7(a.11==1&&++e==b)1I;J a};H.6x=I(n,a){K r=[];Q(;n;n=n.3d){7(n.11==1&&n!=a)r.1k(n)}J r};J;y.aS=o})();H.18={1H:I(e,f,g,h){7(e.11==3||e.11==8)J;7(e.5o&&e!=y)e=y;7(!g.24)g.24=6.24++;7(h!==17){K i=g;g=6.4a(i);g.O=h}K j=H.O(e,"2B")||H.O(e,"2B",{}),1L=H.O(e,"1L")||H.O(e,"1L",I(){J 19 H!=="17"&&!H.18.6T?H.18.1L.1w(1o.4I.U,1o):17});1L.U=e;H.12(f.2i(/\\s+/),I(a,b){K c=b.2i(".");b=c.3u();g.14=c.1S().3e().3i(".");K d=j[b];7(H.18.4J[b])H.18.4J[b].4K.1j(e,h,c);7(!d){d=j[b]={};7(!H.18.4b[b]||H.18.4b[b].4K.1j(e,h,c)===T){7(e.5D)e.5D(b,1L,T);N 7(e.4c)e.4c("5E"+b,1L)}}d[g.24]=g;H.18.2l[b]=P});e=R},24:1,2l:{},1X:I(f,g,h){7(f.11==3||f.11==8)J;K i=H.O(f,"2B"),4d,54;7(i){7(g===17||(19 g==="1C"&&g.aT(0)=="."))Q(K j 1q i)6.1X(f,j+(g||""));N{7(g.14){h=g.6U;g=g.14}H.12(g.2i(/\\s+/),I(a,b){K c=b.2i(".");b=c.3u();K d=3v("(^|\\\\.)"+c.1S().3e().3i(".*\\\\.")+"(\\\\.|$)");7(i[b]){7(h)2X i[b][h.24];N Q(K e 1q i[b])7(d.1a(i[b][e].14))2X i[b][e];7(H.18.4J[b])H.18.4J[b].4L.1j(f,c);Q(4d 1q i[b])1I;7(!4d){7(!H.18.4b[b]||H.18.4b[b].4L.1j(f,c)===T){7(f.6V)f.6V(b,H.O(f,"1L"),T);N 7(f.5F)f.5F("5E"+b,H.O(f,"1L"))}4d=R;2X i[b]}}})}Q(4d 1q i)1I;7(!4d){K k=H.O(f,"1L");7(k)k.U=R;H.3t(f,"2B");H.3t(f,"1L")}}},1P:I(a,b,c,d){K f=a.14||a;7(!d){a=19 a==="1W"?a[B]?a:H.1B(H.3C(f),a):H.3C(f);7(f.1J("!")>=0){a.14=f=f.1S(0,-1);a.8w=P}7(!c){a.3D();7(6.2l[f])H.12(H.1O,I(){7(6.2B&&6.2B[f])H.18.1P(a,b,6.1L.U)})}7(!c||c.11==3||c.11==8)J 17;a.22=17;a.2O=c;b=H.2v(b);b.8m(a)}a.6W=c;K g=H.O(c,"1L");7(g)g.1w(c,b);7((!c[f]||(H.1i(c,\'a\')&&f=="5G"))&&c["5E"+f]&&c["5E"+f].1w(c,b)===T)a.22=T;7(!d&&c[f]&&!a.6X()&&!(H.1i(c,\'a\')&&f=="5G")){6.6T=P;1U{c[f]()}1V(e){}}6.6T=T;7(!a.6Y()){K h=c.1h||c.1z;7(h)H.18.1P(a,b,h,P)}},1L:I(a){K b,5H;a=1o[0]=H.18.8x(a||y.18);a.6W=6;K c=a.14.2i(".");a.14=c.3u();b=!c.L&&!a.8w;K d=3v("(^|\\\\.)"+c.1S().3e().3i(".*\\\\.")+"(\\\\.|$)");5H=(H.O(6,"2B")||{})[a.14];Q(K j 1q 5H){K e=5H[j];7(b||d.1a(e.14)){a.6U=e;a.O=e.O;K f=e.1w(6,1o);7(f!==17){a.22=f;7(f===T){a.3E();a.3D()}}7(a.6Z())1I}}},3l:"aU aV aW aX 2L aY 4M 70 8y 71 6W O aZ b0 5I 6U 72 73 b1 b2 74 8z b3 b4 5J b5 b6 b7 8A 2O 8B b8 b9 3m".2i(" "),8x:I(a){7(a[B])J a;K b=a;a=H.3C(b);Q(K i=6.3l.L,1g;i;){1g=6.3l[--i];a[1g]=b[1g]}7(!a.2O)a.2O=a.8A||M;7(a.2O.11==3)a.2O=a.2O.1h;7(!a.5J&&a.5I)a.5J=a.5I==a.2O?a.8B:a.5I;7(a.74==R&&a.70!=R){K c=M.1y,1d=M.1d;a.74=a.70+(c&&c.30||1d&&1d.30||0)-(c.4N||0);a.8z=a.8y+(c&&c.31||1d&&1d.31||0)-(c.4O||0)}7(!a.3m&&((a.4M||a.4M===0)?a.4M:a.72))a.3m=a.4M||a.72;7(!a.73&&a.71)a.73=a.71;7(!a.3m&&a.2L)a.3m=(a.2L&1?1:(a.2L&2?3:(a.2L&4?2:0)));J a},4a:I(a,b){b=b||I(){J a.1w(6,1o)};b.24=a.24=a.24||b.24||6.24++;J b},4b:{2H:{4K:75,4L:I(){}}},4J:{4P:{4K:I(a,b){H.18.1H(6,b[0],76)},4L:I(a){7(a.L){K b=0,2g=3v("(^|\\\\.)"+a[0]+"(\\\\.|$)");H.12((H.O(6,"2B").4P||{}),I(){7(2g.1a(6.14))b++});7(b<1)H.18.1X(6,a[0],76)}}}}};H.3C=I(a){7(!6.3E)J 2Q H.3C(a);7(a&&a.14){6.77=a;6.14=a.14}N 6.14=a;6.ba=21();6[B]=P};I 5K(){J T}I 5L(){J P}H.3C.27={3E:I(){6.6X=5L;K e=6.77;7(!e)J;7(e.3E)e.3E();e.bb=T},3D:I(){6.6Y=5L;K e=6.77;7(!e)J;7(e.3D)e.3D();e.bc=P},bd:I(){6.6Z=5L;6.3D()},6X:5K,6Y:5K,6Z:5K};K C=I(a){K b=a.5J;1t(b&&b!=6)1U{b=b.1h}1V(e){b=6}7(b!=6){a.14=a.O;H.18.1L.1w(6,1o)}};H.12({8C:\'78\',8D:\'79\'},I(a,b){H.18.4b[b]={4K:I(){H.18.1H(6,a,C,b)},4L:I(){H.18.1X(6,a,C)}}});H.1c.1B({4Q:I(a,b,c){J a=="7a"?6.3h(a,b,c):6.12(I(){H.18.1H(6,a,c||b,c&&b)})},3h:I(b,c,d){K e=H.18.4a(d||c,I(a){H(6).7b(a,e);J(d||c).1w(6,1o)});J 6.12(I(){H.18.1H(6,b,e,d&&c)})},7b:I(a,b){J 6.12(I(){H.18.1X(6,a,b)})},1P:I(a,b){J 6.12(I(){H.18.1P(a,b,6)})},6B:I(a,b){7(6[0]){K c=H.3C(a);c.3E();c.3D();H.18.1P(c,b,6[0]);J c.22}},3F:I(b){K c=1o,i=1;1t(i<c.L)H.18.4a(b,c[i++]);J 6.5G(H.18.4a(b,I(a){6.7c=(6.7c||0)%i;a.3E();J c[6.7c++].1w(6,1o)||T}))},bf:I(a,b){J 6.78(a).79(b)},2H:I(a){75();7(H.4R)a.1j(M,H);N H.4S.1k(a);J 6},4P:I(a,b){K c=H.18.4a(b);c.24+=6.1Q+a;H(M).4Q(7d(a,6.1Q),6.1Q,c);J 6},bg:I(a,b){H(M).7b(7d(a,6.1Q),b?{24:b.24+6.1Q+a}:R);J 6}});I 76(c){K d=3v("(^|\\\\.)"+c.14+"(\\\\.|$)"),5M=P,5N=[];H.12(H.O(6,"2B").4P||[],I(i,a){7(d.1a(a.14)){K b=H(c.2O).4q(a.O)[0];7(b)5N.1k({U:b,1c:a})}});5N.3e(I(a,b){J H.O(a.U,"4q")-H.O(b.U,"4q")});H.12(5N,I(){7(6.1c.1j(6.U,c,6.1c.O)===T)J(5M=T)});J 5M}I 7d(a,b){J["4P",a,b.1p(/\\./g,"`").1p(/ /g,"|")].3i(".")}H.1B({4R:T,4S:[],2H:I(){7(!H.4R){H.4R=P;7(H.4S){H.12(H.4S,I(){6.1j(M,H)});H.4S=R}H(M).6B("2H")}}});K D=T;I 75(){7(D)J;D=P;7(M.5D){M.5D("8E",I(){M.6V("8E",1o.4I,T);H.2H()},T)}N 7(M.4c){M.4c("5O",I(){7(M.4e==="25"){M.5F("5O",1o.4I);H.2H()}});7(M.1y.8F&&y==y.1m)(I(){7(H.4R)J;1U{M.1y.8F("1b")}1V(3w){8G(1o.4I,0);J}H.2H()})()}H.18.1H(y,"5P",H.2H)}H.12(("bh,bi,5P,bj,5Q,7a,5G,bk,"+"bl,bm,bn,8C,8D,78,79,"+"bo,2r,6N,bp,bq,bs,3w").2i(","),I(i,b){H.1c[b]=I(a){J a?6.4Q(b,a):6.1P(b)}});H(y).4Q(\'7a\',I(){Q(K a 1q H.1O)7(a!=1&&H.1O[a].1L)H.18.1X(H.1O[a].1L.U)});(I(){H.1M={};K b=M.1y,1l=M.1T("1l"),15=M.1T("15"),2d="1l"+(2Q 6k).8t();15.V.1s="3G";15.2A=\'   <6s/><1N></1N><a 2t="/a" V="bt:8H;4z:1b;1E:.5;">a</a><2r><5c>1D</5c></2r><1W><3Z/></1W>\';K c=15.1Y("*"),a=15.1Y("a")[0];7(!c||!c.L||!a){J}H.1M={83:15.1n.11==3,1A:!15.1Y("1A").L,bu:!!15.1Y("1W")[0].1Y("*").L,81:!!15.1Y("6s").L,V:/8H/.1a(a.2j("V")),84:a.2j("2t")==="/a",1E:a.V.1E==="0.5",4T:!!a.V.4T,6m:T,6a:P,4f:R};1l.14="1D/3U";1U{1l.2I(M.56("bv."+2d+"=1;"))}1V(e){}b.2z(1l,b.1n);7(y[2d]){H.1M.6m=P;2X y[2d]}b.2h(1l);7(15.4c&&15.8I){15.4c("7e",I(){H.1M.6a=T;15.5F("7e",1o.4I)});15.5b(P).8I("7e")}H(I(){K a=M.1T("15");a.V.2f=a.V.8J="32";M.1d.2I(a);H.4f=H.1M.4f=a.4y===2;M.1d.2h(a).V.1s=\'3G\'})})();K E=H.1M.4T?"4T":"8K";H.3l={"Q":"8k","45":"1F","4z":E,4T:E,8K:E,bw:"bx",by:"bz",8L:"bA",bB:"bC",bD:"6u"};H.1c.1B({8M:H.1c.5P,5P:I(c,d,e){7(19 c!=="1C")J 6.8M(c);K f=c.1J(" ");7(f>=0){K g=c.1S(f,c.L);c=c.1S(0,f)}K h="3H";7(d)7(H.1R(d)){e=d;d=R}N 7(19 d==="1W"){d=H.3Z(d);h="8N"}K i=6;H.4w({1r:c,14:h,1Z:"2J",O:d,25:I(a,b){7(b=="2m"||b=="8O")i.2J(g?H("<15/>").3O(a.5R.1p(/<1l(.|\\s)*?\\/1l>/g,"")).1v(g):a.5R);7(e)i.12(e,[a.5R,b,a])}});J 6},bE:I(){J H.3Z(6.8P())},8P:I(){J 6.2q(I(){J 6.8Q?H.2v(6.8Q):6}).1e(I(){J 6.2g&&!6.5x&&(6.5e||/2r|6v/i.1a(6.1i)||/1D|29|5y|bF/i.1a(6.14))}).2q(I(i,b){K c=H(6).6e();J c==R?R:H.3a(c)?H.2q(c,I(a,i){J{2g:b.2g,1x:a}}):{2g:b.2g,1x:c}}).3b()}});H.12("8R,5S,8S,8T,8U,8V".2i(","),I(i,o){H.1c[o]=I(f){J 6.4Q(o,f)}});K F=21();H.1B({3b:I(a,b,c,d){7(H.1R(b)){c=b;b=R}J H.4w({14:"3H",1r:a,O:b,2m:c,1Z:d})},bG:I(a,b){J H.3b(a,R,b,"1l")},bH:I(a,b,c){J H.3b(a,b,c,"4g")},bI:I(a,b,c,d){7(H.1R(b)){c=b;b={}}J H.4w({14:"8N",1r:a,O:b,2m:c,1Z:d})},bJ:I(a){H.1B(H.7f,a)},7f:{1r:5T.2t,2l:P,14:"3H",8W:"5U/x-bK-6t-bL",8X:P,3j:P,8Y:I(){J y.8Z?2Q 8Z("bM.bN"):2Q 90()},5V:{33:"5U/33, 1D/33",2J:"1D/2J",1l:"1D/3U, 5U/3U",4g:"5U/4g, 1D/3U",1D:"1D/bO",4h:"*/*"}},5W:{},4w:I(s){s=H.1B(P,s,H.1B(P,{},H.7f,s));K c,3I=/=\\?(&|$)/g,26,O,14=s.14.2s();7(s.O&&s.8X&&19 s.O!=="1C")s.O=H.3Z(s.O);7(s.1Z=="5X"){7(14=="3H"){7(!s.1r.Y(3I))s.1r+=(s.1r.Y(/\\?/)?"&":"?")+(s.5X||"91")+"=?"}N 7(!s.O||!s.O.Y(3I))s.O=(s.O?s.O+"&":"")+(s.5X||"91")+"=?";s.1Z="4g"}7(s.1Z=="4g"&&(s.O&&s.O.Y(3I)||s.1r.Y(3I))){c="5X"+F++;7(s.O)s.O=(s.O+"").1p(3I,"="+c+"$1");s.1r=s.1r.1p(3I,"="+c+"$1");s.1Z="1l";y[c]=I(a){O=a;2m();25();y[c]=17;1U{2X y[c]}1V(e){}7(h)h.2h(i)}}7(s.1Z=="1l"&&s.1O==R)s.1O=T;7(s.1O===T&&14=="3H"){K d=21();K f=s.1r.1p(/(\\?|&)4n=.*?(&|$)/,"$bP="+d+"$2");s.1r=f+((f==s.1r)?(s.1r.Y(/\\?/)?"&":"?")+"4n="+d:"")}7(s.O&&14=="3H"){s.1r+=(s.1r.Y(/\\?/)?"&":"?")+s.O;s.O=R}7(s.2l&&!H.4U++)H.18.1P("8R");K g=/^(\\w+:)?\\/\\/([^\\/?#]+)/.2G(s.1r);7(s.1Z=="1l"&&14=="3H"&&g&&(g[1]&&g[1]!=5T.92||g[2]!=5T.bQ)){K h=M.1Y("7P")[0];K i=M.1T("1l");i.5f=s.1r;7(s.93)i.bR=s.93;7(!c){K j=T;i.94=i.5O=I(){7(!j&&(!6.4e||6.4e=="bS"||6.4e=="25")){j=P;2m();25();i.94=i.5O=R;h.2h(i)}}}h.2I(i);J 17}K k=T;K l=s.8Y();7(s.95)l.96(14,s.1r,s.3j,s.95,s.5y);N l.96(14,s.1r,s.3j);1U{7(s.O)l.5Y("bT-bU",s.8W);7(s.7g)l.5Y("bV-7h-bW",H.5W[s.1r]||"bX, bY bZ c0 7i:7i:7i c1");l.5Y("X-c2-c3","90");l.5Y("c4",s.1Z&&s.5V[s.1Z]?s.5V[s.1Z]+", */*":s.5V.4h)}1V(e){}7(s.97&&s.97(l,s)===T){7(s.2l&&!--H.4U)H.18.1P("5S");l.98();J T}7(s.2l)H.18.1P("8V",[l,s]);K m=I(a){7(l.4e==0){7(n){7j(n);n=R;7(s.2l&&!--H.4U)H.18.1P("5S")}}N 7(!k&&l&&(l.4e==4||a=="4i")){k=P;7(n){7j(n);n=R}26=a=="4i"?"4i":!H.99(l)?"3w":s.7g&&H.9a(l,s.1r)?"8O":"2m";7(26=="2m"){1U{O=H.9b(l,s.1Z,s)}1V(e){26="7k"}}7(26=="2m"){K b;1U{b=l.7l("9c-7h")}1V(e){}7(s.7g&&b)H.5W[s.1r]=b;7(!c)2m()}N H.7m(s,l,26);25();7(a)l.98();7(s.3j)l=R}};7(s.3j){K n=5o(m,13);7(s.4i>0)8G(I(){7(l&&!k)m("4i")},s.4i)}1U{l.c5(s.O)}1V(e){H.7m(s,l,R,e)}7(!s.3j)m();I 2m(){7(s.2m)s.2m(O,26);7(s.2l)H.18.1P("8U",[l,s])}I 25(){7(s.25)s.25(l,26);7(s.2l)H.18.1P("8S",[l,s]);7(s.2l&&!--H.4U)H.18.1P("5S")}J l},7m:I(s,a,b,e){7(s.3w)s.3w(a,b,e);7(s.2l)H.18.1P("8T",[a,s,e])},4U:0,99:I(a){1U{J!a.26&&5T.92=="6M:"||(a.26>=9d&&a.26<c6)||a.26==9e||a.26==c7}1V(e){}J T},9a:I(a,b){1U{K c=a.7l("9c-7h");J a.26==9e||c==H.5W[b]}1V(e){}J T},9b:I(a,b,s){K c=a.7l("c8-14"),33=b=="33"||!b&&c&&c.1J("33")>=0,O=33?a.c9:a.5R;7(33&&O.1y.41=="7k")5n"7k";7(s&&s.9f)O=s.9f(O,b);7(19 O==="1C"){7(b=="1l")H.6j(O);7(b=="4g")O=y["ca"]("("+O+")")}J O},3Z:I(a){K s=[];I 1H(a,b){s[s.L]=9g(a)+\'=\'+9g(b)};7(H.3a(a)||a.65)H.12(a,I(){1H(6.2g,6.1x)});N Q(K j 1q a)7(H.3a(a[j]))H.12(a[j],I(){1H(j,6)});N 1H(j,H.1R(a[j])?a[j]():a[j]);J s.3i("&").1p(/%20/g,"+")}});K G={},4V,7n=[["2y","4j","cb","cc","cd"],["2f","7o","ce","8J","cf"],["1E"]];I 3J(a,b){K c={};H.12(7n.5m.1w([],7n.1S(0,b)),I(){c[6]=a});J c}H.1c.1B({2o:I(a,b){7(a){J 6.4k(3J("2o",3),a,b)}N{Q(K i=0,l=6.L;i<l;i++){K c=H.O(6[i],"4W");6[i].V.1s=c||"";7(H.28(6[i],"1s")==="3G"){K d=6[i].41,1s;7(G[d]){1s=G[d]}N{K e=H("<"+d+" />").8b("1d");1s=e.28("1s");7(1s==="3G")1s="5i";e.1X();G[d]=1s}H.O(6[i],"4W",1s)}}Q(K i=0,l=6.L;i<l;i++){6[i].V.1s=H.O(6[i],"4W")||""}J 6}},2c:I(a,b){7(a){J 6.4k(3J("2c",3),a,b)}N{Q(K i=0,l=6.L;i<l;i++){K c=H.O(6[i],"4W");7(!c&&c!=="3G")H.O(6[i],"4W",H.28(6[i],"1s"))}Q(K i=0,l=6.L;i<l;i++){6[i].V.1s="3G"}J 6}},9h:H.1c.3F,3F:I(b,c){K d=19 b==="6l";J H.1R(b)&&H.1R(c)?6.9h.1w(6,1o):b==R||d?6.12(I(){K a=d?b:H(6).4r(":29");H(6)[a?"2o":"2c"]()}):6.4k(3J("3F",3),b,c)},cg:I(a,b,c){J 6.4k({1E:b},a,c)},4k:I(g,h,i,j){K k=H.9i(h,i,j);J 6[k.2E===T?"12":"2E"](I(){K f=H.1B({},k),p,29=6.11==1&&H(6).4r(":29"),3K=6;Q(p 1q g){7(g[p]=="2c"&&29||g[p]=="2o"&&!29)J f.25.1j(6);7((p=="2y"||p=="2f")&&6.V){f.1s=H.28(6,"1s");f.34=6.V.34}}7(f.34!=R)6.V.34="29";f.4X=H.1B({},g);H.12(g,I(a,b){K e=2Q H.2a(3K,f,a);7(/3F|2o|2c/.1a(b))e[b=="3F"?29?"2o":"2c":b](g);N{K c=b.2C().Y(/^([+-]=)?([\\d+-.]+)(.*)$/),2u=e.2k(P)||0;7(c){K d=2S(c[2]),35=c[3]||"3k";7(35!="3k"){3K.V[a]=(d||1)+35;2u=((d||1)/e.2k(P))*2u;3K.V[a]=2u+35}7(c[1])d=((c[1]=="-="?-1:1)*d)+2u;e.4Y(2u,d,35)}N e.4Y(2u,b,"")}});J P})},5M:I(a,b){K c=H.4H;7(a)6.2E([]);6.12(I(){Q(K i=c.L-1;i>=0;i--)7(c[i].U==6){7(b)c[i](P);c.3f(i,1)}});7(!b)6.4B();J 6}});H.12({ch:3J("2o",1),ci:3J("2c",1),cj:3J("3F",1),ck:{1E:"2o"},cl:{1E:"2c"}},I(c,d){H.1c[c]=I(a,b){J 6.4k(d,a,b)}});H.1B({9i:I(a,b,c){K d=19 a==="1W"?a:{25:c||!c&&b||H.1R(a)&&a,36:a,4Z:c&&b||b&&!H.1R(b)&&b};d.36=H.2a.cm?0:19 d.36==="4u"?d.36:H.2a.7p[d.36]||H.2a.7p.4h;d.7q=d.25;d.25=I(){7(d.2E!==T)H(6).4B();7(H.1R(d.7q))d.7q.1j(6)};J d},4Z:{9j:I(p,n,a,b){J a+b*p},7r:I(p,n,a,b){J((-3n.cn(p*3n.co)/2)+0.5)*b+a}},4H:[],2a:I(a,b,c){6.1f=b;6.U=a;6.1g=c;7(!b.50)b.50={}}});H.2a.27={7s:I(){7(6.1f.3L)6.1f.3L.1j(6.U,6.21,6);(H.2a.3L[6.1g]||H.2a.3L.4h)(6);7((6.1g=="2y"||6.1g=="2f")&&6.U.V)6.U.V.1s="5i"},2k:I(a){7(6.U[6.1g]!=R&&(!6.U.V||6.U.V[6.1g]==R))J 6.U[6.1g];K r=2S(H.28(6.U,6.1g,a));J r&&r>-cp?r:2S(H.2p(6.U,6.1g))||0},4Y:I(b,c,d){6.7t=21();6.2u=b;6.58=c;6.35=d||6.35||"3k";6.21=6.2u;6.3p=6.5Z=0;K e=6;I t(a){J e.3L(a)}t.U=6.U;7(t()&&H.4H.1k(t)&&!4V){4V=5o(I(){K a=H.4H;Q(K i=0;i<a.L;i++)7(!a[i]())a.3f(i--,1);7(!a.L){7j(4V);4V=17}},13)}},2o:I(){6.1f.50[6.1g]=H.2e(6.U.V,6.1g);6.1f.2o=P;6.4Y(6.1g=="2f"||6.1g=="2y"?1:0,6.2k());H(6.U).2o()},2c:I(){6.1f.50[6.1g]=H.2e(6.U.V,6.1g);6.1f.2c=P;6.4Y(6.2k(),0)},3L:I(a){K t=21();7(a||t>=6.1f.36+6.7t){6.21=6.58;6.3p=6.5Z=1;6.7s();6.1f.4X[6.1g]=P;K b=P;Q(K i 1q 6.1f.4X)7(6.1f.4X[i]!==P)b=T;7(b){7(6.1f.1s!=R){6.U.V.34=6.1f.34;6.U.V.1s=6.1f.1s;7(H.28(6.U,"1s")=="3G")6.U.V.1s="5i"}7(6.1f.2c)H(6.U).2c();7(6.1f.2c||6.1f.2o)Q(K p 1q 6.1f.4X)H.2e(6.U.V,p,6.1f.50[p]);6.1f.25.1j(6.U)}J T}N{K n=t-6.7t;6.5Z=n/6.1f.36;6.3p=H.4Z[6.1f.4Z||(H.4Z.7r?"7r":"9j")](6.5Z,n,0,1,6.1f.36);6.21=6.2u+((6.58-6.2u)*6.3p);6.7s()}J P}};H.1B(H.2a,{7p:{cq:cr,cs:9d,4h:ct},3L:{1E:I(a){H.2e(a.U.V,"1E",a.21)},4h:I(a){7(a.U.V&&a.U.V[a.1g]!=R)a.U.V[a.1g]=a.21+a.35;N a.U[a.1g]=a.21}}});7(M.1y["9k"])H.1c.1u=I(){7(!6[0])J{1m:0,1b:0};7(6[0]===6[0].1z.1d)J H.1u.7u(6[0]);K a=6[0].9k(),3M=6[0].1z,1d=3M.1d,2P=3M.1y,4O=2P.4O||1d.4O||0,4N=2P.4N||1d.4N||0,1m=a.1m+(3K.9l||H.4f&&2P.31||1d.31)-4O,1b=a.1b+(3K.9m||H.4f&&2P.30||1d.30)-4N;J{1m:1m,1b:1b}};N H.1c.1u=I(){7(!6[0])J{1m:0,1b:0};7(6[0]===6[0].1z.1d)J H.1u.7u(6[0]);H.1u.60||H.1u.7v();K a=6[0],2F=a.2F,9n=a,3M=a.1z,37,2P=3M.1y,1d=3M.1d,2U=3M.2U,51=2U.5k(a,R),1m=a.38,1b=a.61;1t((a=a.1h)&&a!==1d&&a!==2P){37=2U.5k(a,R);1m-=a.31,1b-=a.30;7(a===2F){1m+=a.38,1b+=a.61;7(H.1u.9o&&!(H.1u.9p&&/^t(cu|d|h)$/i.1a(a.41)))1m+=2V(37.7w,10)||0,1b+=2V(37.7x,10)||0;9n=2F,2F=a.2F}7(H.1u.9q&&37.34!=="8v")1m+=2V(37.7w,10)||0,1b+=2V(37.7x,10)||0;51=37}7(51.2D==="2M"||51.2D==="9r")1m+=1d.38,1b+=1d.61;7(51.2D==="cv")1m+=3n.3R(2P.31,1d.31),1b+=3n.3R(2P.30,1d.30);J{1m:1m,1b:1b}};H.1u={7v:I(){7(6.60)J;K a=M.1d,4l=M.1T(\'15\'),4m,62,1N,40,63,1g,9s=a.V.4j,2J=\'<15 V="2D:5h;1m:0;1b:0;3W:0;3V:9t 9u #9v;5j:0;2f:32;2y:32;"><15></15></15><1N V="2D:5h;1m:0;1b:0;3W:0;3V:9t 9u #9v;5j:0;2f:32;2y:32;" cw="0" 8L="0"><3T><40></40></3T></1N>\';63={2D:\'5h\',1m:0,1b:0,3W:0,3V:0,2f:\'32\',2y:\'32\',7R:\'29\'};Q(1g 1q 63)4l.V[1g]=63[1g];4l.2A=2J;a.2z(4l,a.1n);4m=4l.1n,62=4m.1n,40=4m.3d.1n.1n;6.9o=(62.38!==5);6.9p=(40.38===5);4m.V.34=\'29\',4m.V.2D=\'2M\';6.9q=(62.38===-5);a.V.4j=\'32\';6.9w=(a.38===0);a.V.4j=9s;a.2h(4l);6.60=P},7u:I(a){H.1u.60||H.1u.7v();K b=a.38,1b=a.61;7(H.1u.9w)b+=2V(H.2p(a,\'4j\',P),10)||0,1b+=2V(H.2p(a,\'7o\',P),10)||0;J{1m:b,1b:1b}}};H.1c.1B({2D:I(){K a=0,1m=0,3B;7(6[0]){K b=6.2F(),1u=6.1u(),52=/^1d|2J$/i.1a(b[0].41)?{1m:0,1b:0}:b.1u();1u.1m-=4A(6,\'4j\');1u.1b-=4A(6,\'7o\');52.1m+=4A(b,\'7w\');52.1b+=4A(b,\'7x\');3B={1m:1u.1m-52.1m,1b:1u.1b-52.1b}}J 3B},2F:I(){K a=6[0].2F||M.1d;1t(a&&(!/^1d|2J$/i.1a(a.41)&&H.28(a,\'2D\')==\'9r\'))a=a.2F;J H(a)}});H.12([\'6n\',\'6o\'],I(i,b){K c=\'5Q\'+b;H.1c[c]=I(a){7(!6[0])J R;J a!==17?6.12(I(){6==y||6==M?y.cx(!i?a:H(y).30(),i?a:H(y).31()):6[c]=a}):6[0]==y||6[0]==M?3K[i?\'9l\':\'9m\']||H.4f&&M.1y[c]||M.1d[c]:6[0][c]}});H.12(["cy","7U"],I(i,b){K c=i?"6n":"6o",br=i?"7S":"7T",7y=b.3X();H.1c["cz"+b]=I(){J 6[0]?H.28(6[0],7y,T,"5j"):R};H.1c["cA"+b]=I(a){J 6[0]?H.28(6[0],7y,T,a?"3W":"3V"):R};K d=b.3X();H.1c[d]=I(a){J 6[0]==y?M.cB=="cC"&&M.1y["7z"+b]||M.1d["7z"+b]:6[0]==M?3n.3R(M.1y["7z"+b],M.1d["5Q"+b],M.1y["5Q"+b],M.1d["1u"+b],M.1y["1u"+b]):a===17?(6.L?H.28(6[0],d):R):6.28(d,19 a==="1C"?a:a+"3k")}})})();',62,783,'||||||this|if||||||||||||||||||||||||||||||||||||jQuery|function|return|var|length|document|else|data|true|for|null||false|elem|style|||match|||nodeType|each||type|div||undefined|event|typeof|test|left|fn|body|filter|options|prop|parentNode|nodeName|call|push|script|top|firstChild|arguments|replace|in|url|display|while|offset|find|apply|value|documentElement|ownerDocument|tbody|extend|string|text|opacity|className|set|add|break|indexOf|checkSet|handle|support|table|cache|trigger|selector|isFunction|slice|createElement|try|catch|object|remove|getElementsByTagName|dataType||now|result|node|guid|complete|status|prototype|css|hidden|fx|check|hide|id|attr|width|name|removeChild|split|getAttribute|cur|global|success||show|curCSS|map|select|toUpperCase|href|start|makeArray|Array|pushStack|height|insertBefore|innerHTML|events|toString|position|queue|offsetParent|exec|ready|appendChild|html|copy|button|relative|pop|target|docElem|new|inArray|parseFloat|first|defaultView|parseInt|nth|delete|curLoop|sizcache|scrollLeft|scrollTop|1px|xml|overflow|unit|duration|computedStyle|offsetTop|context|isArray|get|childNodes|nextSibling|sort|splice|expr|one|join|async|px|props|which|Math|getAttributeNode|pos|done|parent|previousSibling|removeData|shift|RegExp|error|anyFound|selectors|ID|last|results|Event|stopPropagation|preventDefault|toggle|none|GET|jsre|genFx|self|step|doc|getElementById|append|multiFilter|POS|max|scripts|tr|javascript|border|margin|toLowerCase|input|param|td|tagName|found|TAG|u00c0|class|checkFn|filters|getElementsByClassName|sizset|proxy|special|attachEvent|ret|readyState|boxModel|json|_default|timeout|marginTop|animate|container|innerDiv|_|domManip|grep|closest|is|not|selected|number|root|ajax|has|offsetWidth|float|num|dequeue|hasDuplicate|item|uFFFF_|CLASS|PSEUDO|timers|callee|specialAll|setup|teardown|charCode|clientLeft|clientTop|live|bind|isReady|readyList|cssFloat|active|timerId|olddisplay|curAnim|custom|easing|orig|prevComputedStyle|parentOffset|clean|index|empty|createTextNode|nodeValue|end|unique|isXMLDoc|cloneNode|option|selectedIndex|checked|src|deep|absolute|block|padding|getComputedStyle|currentStyle|concat|throw|setInterval|dir|extra|matches|order|CHILD|even|odd|attrHandle|disabled|password|case|compareDocumentPosition|bRange|querySelectorAll|addEventListener|on|detachEvent|click|handlers|fromElement|relatedTarget|returnFalse|returnTrue|stop|elems|onreadystatechange|load|scroll|responseText|ajaxStop|location|application|accepts|lastModified|jsonp|setRequestHeader|state|initialized|offsetLeft|checkDiv|rules|init|jquery|prevObject|wrapAll|clone|after|noCloneEvent|andSelf|closer|merge|val|values|radio|checkbox|eq|globalEval|Date|boolean|scriptEval|Left|Top|getWH|offsetHeight|runtimeStyle|link|form|tabIndex|textarea|opera|sibling|insert|removeAttribute|windowData|triggerHandler|prune|substr|preFilter|NAME|ATTR|attrMap|isTag|isPartStrNotTag|dirCheck|dirNodeCheck|file|submit|contains|nodeIndex|sourceIndex|createRange|later|triggered|handler|removeEventListener|currentTarget|isDefaultPrevented|isPropagationStopped|isImmediatePropagationStopped|clientX|ctrlKey|keyCode|metaKey|pageX|bindReady|liveHandler|originalEvent|mouseenter|mouseleave|unload|unbind|lastToggle|liveConvert|onclick|ajaxSettings|ifModified|Modified|00|clearInterval|parsererror|getResponseHeader|handleError|fxAttrs|marginLeft|speeds|old|swing|update|startTime|bodyOffset|initialize|borderTopWidth|borderLeftWidth|lower|client|_jQuery|quickExpr|isSimple|setArray|contents|prepend|before|specified|replaceWith|evalScript|textContent|continue|zoom|Object|HTML|head|swap|visibility|Right|Bottom|Width|rsLeft|col|area|multiple|fieldset|colgroup|htmlSerialize|lastChild|leadingWhitespace|hrefNormalized|alpha|100|webkit|msie|mozilla|children|appendTo|uuid|Syntax|unrecognized|expression|isXMLFilter|only|gt|lt|htmlFor|getElementsByName|unshift|image|reset|setFilters|source|selectNode|collapse|getTime|TEST|visible|exclusive|fix|clientY|pageY|srcElement|toElement|mouseover|mouseout|DOMContentLoaded|doScroll|setTimeout|red|fireEvent|paddingLeft|styleFloat|cellspacing|_load|POST|notmodified|serializeArray|elements|ajaxStart|ajaxComplete|ajaxError|ajaxSuccess|ajaxSend|contentType|processData|xhr|ActiveXObject|XMLHttpRequest|callback|protocol|scriptCharset|onload|username|open|beforeSend|abort|httpSuccess|httpNotModified|httpData|Last|200|304|dataFilter|encodeURIComponent|_toggle|speed|linear|getBoundingClientRect|pageYOffset|pageXOffset|prevOffsetParent|doesNotAddBorder|doesAddBorderForTableAndCells|subtractsBorderForOverflowNotVisible|static|bodyMarginTop|5px|solid|000|doesNotIncludeMarginInBodyOffset|size|wrapInner|wrap|outerHTML|hasClass|attributes|createDocumentFragment|font|weight|line|noConflict|Function|round|getPropertyValue|pixelLeft|abbr|img|meta|hr|embed|substring|opt|leg|thead|tfoot|colg|cap|th|property|can|changed|cssText|setAttribute|NaN|ig|trim|getAll|navigator|userAgent|browser|version|rv|it|ra|ie|safari|compatible|parents|next|prev|nextAll|prevAll|siblings|iframe|contentDocument|contentWindow|prependTo|insertAfter|replaceAll|removeAttr|addClass|removeClass|toggleClass|getData|setData|mode|lastIndex|rightContext|leftContext|uFFFF|child|dn|0n|enabled|header|BUTTON|innerText|switch|compareBoundaryPoints|Range|START_TO_END|createComment|animated|Sizzle|charAt|altKey|attrChange|attrName|bubbles|cancelable|detail|eventPhase|newValue|originalTarget|prevValue|relatedNode|screenX|screenY|shiftKey|view|wheelDelta|timeStamp|returnValue|cancelBubble|stopImmediatePropagation||hover|die|blur|focus|resize|dblclick|mousedown|mouseup|mousemove|change|keydown|keypress||keyup|color|objectAll|window|readonly|readOnly|maxlength|maxLength|cellSpacing|rowspan|rowSpan|tabindex|serialize|search|getScript|getJSON|post|ajaxSetup|www|urlencoded|Microsoft|XMLHTTP|plain|1_|host|charset|loaded|Content|Type|If|Since|Thu|01|Jan|1970|GMT|Requested|With|Accept|send|300|1223|content|responseXML|eval|marginBottom|paddingTop|paddingBottom|marginRight|paddingRight|fadeTo|slideDown|slideUp|slideToggle|fadeIn|fadeOut|off|cos|PI|10000|slow|600|fast|400|able|fixed|cellpadding|scrollTo|Height|inner|outer|compatMode|CSS1Compat'.split('|'),0,{}));
	
	
	
	
	








//jquery.bgiframe.min.js
/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2007-06-19 20:25:28 -0500 (Tue, 19 Jun 2007) $
 * $Rev: 2111 $
 *
 * Version 2.1
 */
(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&parseInt($.browser.version)<=6){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild);});}return this;};if(!$.browser.version)$.browser.version=navigator.userAgent.toLowerCase().match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)[1];})(jQuery);














//jquery.dimensions.js
/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2007-06-22 04:38:37 +0200 (Fr, 22 Jun 2007) $
 * $Rev: 2141 $
 *
 * Version: 1.0b2
 */

(function($){

// store a copy of the core height and width methods
var height = $.fn.height,
    width  = $.fn.width;

$.fn.extend({
	/**
	 * If used on document, returns the document's height (innerHeight)
	 * If used on window, returns the viewport's (window) height
	 * See core docs on height() to see what happens when used on an element.
	 *
	 * @example $("#testdiv").height()
	 * @result 200
	 *
	 * @example $(document).height()
	 * @result 800
	 *
	 * @example $(window).height()
	 * @result 400
	 *
	 * @name height
	 * @type Object
	 * @cat Plugins/Dimensions
	 */
	height: function() {
		if ( this[0] == window )
			return self.innerHeight ||
				$.boxModel && document.documentElement.clientHeight || 
				document.body.clientHeight;
		
		if ( this[0] == document )
			return Math.max( document.body.scrollHeight, document.body.offsetHeight );
		
		return height.apply(this, arguments);
	},
	
	/**
	 * If used on document, returns the document's width (innerWidth)
	 * If used on window, returns the viewport's (window) width
	 * See core docs on height() to see what happens when used on an element.
	 *
	 * @example $("#testdiv").width()
	 * @result 200
	 *
	 * @example $(document).width()
	 * @result 800
	 *
	 * @example $(window).width()
	 * @result 400
	 *
	 * @name width
	 * @type Object
	 * @cat Plugins/Dimensions
	 */
	width: function() {
		if ( this[0] == window )
			return self.innerWidth ||
				$.boxModel && document.documentElement.clientWidth ||
				document.body.clientWidth;

		if ( this[0] == document )
			return Math.max( document.body.scrollWidth, document.body.offsetWidth );

		return width.apply(this, arguments);
	},
	
	/**
	 * Returns the inner height value (without border) for the first matched element.
	 * If used on document, returns the document's height (innerHeight)
	 * If used on window, returns the viewport's (window) height
	 *
	 * @example $("#testdiv").innerHeight()
	 * @result 800
	 *
	 * @name innerHeight
	 * @type Number
	 * @cat Plugins/Dimensions
	 */
	innerHeight: function() {
		return this[0] == window || this[0] == document ?
			this.height() :
			this.is(':visible') ?
				this[0].offsetHeight - num(this, 'borderTopWidth') - num(this, 'borderBottomWidth') :
				this.height() + num(this, 'paddingTop') + num(this, 'paddingBottom');
	},
	
	/**
	 * Returns the inner width value (without border) for the first matched element.
	 * If used on document, returns the document's Width (innerWidth)
	 * If used on window, returns the viewport's (window) width
	 *
	 * @example $("#testdiv").innerWidth()
	 * @result 1000
	 *
	 * @name innerWidth
	 * @type Number
	 * @cat Plugins/Dimensions
	 */
	innerWidth: function() {
		return this[0] == window || this[0] == document ?
			this.width() :
			this.is(':visible') ?
				this[0].offsetWidth - num(this, 'borderLeftWidth') - num(this, 'borderRightWidth') :
				this.width() + num(this, 'paddingLeft') + num(this, 'paddingRight');
	},
	
	/**
	 * Returns the outer height value (including border) for the first matched element.
	 * Cannot be used on document or window.
	 *
	 * @example $("#testdiv").outerHeight()
	 * @result 1000
	 *
	 * @name outerHeight
	 * @type Number
	 * @cat Plugins/Dimensions
	 */
	outerHeight: function() {
		return this[0] == window || this[0] == document ?
			this.height() :
			this.is(':visible') ?
				this[0].offsetHeight :
				this.height() + num(this,'borderTopWidth') + num(this, 'borderBottomWidth') + num(this, 'paddingTop') + num(this, 'paddingBottom');
	},
	
	/**
	 * Returns the outer width value (including border) for the first matched element.
	 * Cannot be used on document or window.
	 *
	 * @example $("#testdiv").outerHeight()
	 * @result 1000
	 *
	 * @name outerHeight
	 * @type Number
	 * @cat Plugins/Dimensions
	 */
	outerWidth: function() {
		return this[0] == window || this[0] == document ?
			this.width() :
			this.is(':visible') ?
				this[0].offsetWidth :
				this.width() + num(this, 'borderLeftWidth') + num(this, 'borderRightWidth') + num(this, 'paddingLeft') + num(this, 'paddingRight');
	},
	
	/**
	 * Returns how many pixels the user has scrolled to the right (scrollLeft).
	 * Works on containers with overflow: auto and window/document.
	 *
	 * @example $("#testdiv").scrollLeft()
	 * @result 100
	 *
	 * @name scrollLeft
	 * @type Number
	 * @cat Plugins/Dimensions
	 */
	/**
	 * Sets the scrollLeft property and continues the chain.
	 * Works on containers with overflow: auto and window/document.
	 *
	 * @example $("#testdiv").scrollLeft(10).scrollLeft()
	 * @result 10
	 *
	 * @name scrollLeft
	 * @param Number value A positive number representing the desired scrollLeft.
	 * @type jQuery
	 * @cat Plugins/Dimensions
	 */
	scrollLeft: function(val) {
		if ( val != undefined )
			// set the scroll left
			return this.each(function() {
				if (this == window || this == document)
					window.scrollTo( val, $(window).scrollTop() );
				else
					this.scrollLeft = val;
			});
		
		// return the scroll left offest in pixels
		if ( this[0] == window || this[0] == document )
			return self.pageXOffset ||
				$.boxModel && document.documentElement.scrollLeft ||
				document.body.scrollLeft;
				
		return this[0].scrollLeft;
	},
	
	/**
	 * Returns how many pixels the user has scrolled to the bottom (scrollTop).
	 * Works on containers with overflow: auto and window/document.
	 *
	 * @example $("#testdiv").scrollTop()
	 * @result 100
	 *
	 * @name scrollTop
	 * @type Number
	 * @cat Plugins/Dimensions
	 */
	/**
	 * Sets the scrollTop property and continues the chain.
	 * Works on containers with overflow: auto and window/document.
	 *
	 * @example $("#testdiv").scrollTop(10).scrollTop()
	 * @result 10
	 *
	 * @name scrollTop
	 * @param Number value A positive number representing the desired scrollTop.
	 * @type jQuery
	 * @cat Plugins/Dimensions
	 */
	scrollTop: function(val) {
		if ( val != undefined )
			// set the scroll top
			return this.each(function() {
				if (this == window || this == document)
					window.scrollTo( $(window).scrollLeft(), val );
				else
					this.scrollTop = val;
			});
		
		// return the scroll top offset in pixels
		if ( this[0] == window || this[0] == document )
			return self.pageYOffset ||
				$.boxModel && document.documentElement.scrollTop ||
				document.body.scrollTop;

		return this[0].scrollTop;
	},
	
	/** 
	 * Returns the top and left positioned offset in pixels.
	 * The positioned offset is the offset between a positioned
	 * parent and the element itself.
	 *
	 * @example $("#testdiv").position()
	 * @result { top: 100, left: 100 }
	 * 
	 * @name position
	 * @param Map options Optional settings to configure the way the offset is calculated.
	 * @option Boolean margin Should the margin of the element be included in the calculations? False by default.
	 * @option Boolean border Should the border of the element be included in the calculations? False by default.
	 * @option Boolean padding Should the padding of the element be included in the calculations? False by default.
	 * @param Object returnObject An object to store the return value in, so as not to break the chain. If passed in the
	 *                            chain will not be broken and the result will be assigned to this object.
	 * @type Object
	 * @cat Plugins/Dimensions
	 */
	position: function(options, returnObject) {
		var elem = this[0], parent = elem.parentNode, op = elem.offsetParent,
		    options = $.extend({ margin: false, border: false, padding: false, scroll: false }, options || {}),
			x = elem.offsetLeft,
			y = elem.offsetTop, 
			sl = elem.scrollLeft, 
			st = elem.scrollTop;
			
		// Mozilla and IE do not add the border
		if ($.browser.mozilla || $.browser.msie) {
			// add borders to offset
			x += num(elem, 'borderLeftWidth');
			y += num(elem, 'borderTopWidth');
		}

		if ($.browser.mozilla) {
			do {
				// Mozilla does not add the border for a parent that has overflow set to anything but visible
				if ($.browser.mozilla && parent != elem && $.css(parent, 'overflow') != 'visible') {
					x += num(parent, 'borderLeftWidth');
					y += num(parent, 'borderTopWidth');
				}

				if (parent == op) break; // break if we are already at the offestParent
			} while ((parent = parent.parentNode) && (parent.tagName.toLowerCase() != 'body' || parent.tagName.toLowerCase() != 'html'));
		}
		
		var returnValue = handleOffsetReturn(elem, options, x, y, sl, st);
		
		if (returnObject) { $.extend(returnObject, returnValue); return this; }
		else              { return returnValue; }
	},
	
	/**
	 * Returns the location of the element in pixels from the top left corner of the viewport.
	 *
	 * For accurate readings make sure to use pixel values for margins, borders and padding.
	 * 
	 * Known issues:
	 *  - Issue: A div positioned relative or static without any content before it and its parent will report an offsetTop of 0 in Safari
	 *    Workaround: Place content before the relative div ... and set height and width to 0 and overflow to hidden
	 *
	 * @example $("#testdiv").offset()
	 * @result { top: 100, left: 100, scrollTop: 10, scrollLeft: 10 }
	 *
	 * @example $("#testdiv").offset({ scroll: false })
	 * @result { top: 90, left: 90 }
	 *
	 * @example var offset = {}
	 * $("#testdiv").offset({ scroll: false }, offset)
	 * @result offset = { top: 90, left: 90 }
	 *
	 * @name offset
	 * @param Map options Optional settings to configure the way the offset is calculated.
	 * @option Boolean margin Should the margin of the element be included in the calculations? True by default.
	 * @option Boolean border Should the border of the element be included in the calculations? False by default.
	 * @option Boolean padding Should the padding of the element be included in the calculations? False by default.
	 * @option Boolean scroll Should the scroll offsets of the parent elements be included in the calculations? True by default.
	 *                        When true it adds the totla scroll offets of all parents to the total offset and also adds two properties
	 *                        to the returned object, scrollTop and scrollLeft. 
	 * @options Boolean lite Will use offsetLite instead of offset when set to true. False by default.
	 * @param Object returnObject An object to store the return value in, so as not to break the chain. If passed in the
	 *                            chain will not be broken and the result will be assigned to this object.
	 * @type Object
	 * @cat Plugins/Dimensions
	 */
	offset: function(options, returnObject) {
		var x = 0, y = 0, sl = 0, st = 0,
		    elem = this[0], parent = this[0], op, parPos, elemPos = $.css(elem, 'position'),
		    mo = $.browser.mozilla, ie = $.browser.msie, sf = $.browser.safari, oa = $.browser.opera,
		    absparent = false, relparent = false, 
		    options = $.extend({ margin: true, border: false, padding: false, scroll: true, lite: false }, options || {});
		
		// Use offsetLite if lite option is true
		if (options.lite) return this.offsetLite(options, returnObject);
		
		if (elem.tagName.toLowerCase() == 'body') {
			// Safari is the only one to get offsetLeft and offsetTop properties of the body "correct"
			// Except they all mess up when the body is positioned absolute or relative
			x = elem.offsetLeft;
			y = elem.offsetTop;
			// Mozilla ignores margin and subtracts border from body element
			if (mo) {
				x += num(elem, 'marginLeft') + (num(elem, 'borderLeftWidth')*2);
				y += num(elem, 'marginTop')  + (num(elem, 'borderTopWidth') *2);
			} else
			// Opera ignores margin
			if (oa) {
				x += num(elem, 'marginLeft');
				y += num(elem, 'marginTop');
			} else
			// IE does not add the border in Standards Mode
			if (ie && jQuery.boxModel) {
				x += num(elem, 'borderLeftWidth');
				y += num(elem, 'borderTopWidth');
			}
		} else {
			do {
				parPos = $.css(parent, 'position');
			
				x += parent.offsetLeft;
				y += parent.offsetTop;

				// Mozilla and IE do not add the border
				if (mo || ie) {
					// add borders to offset
					x += num(parent, 'borderLeftWidth');
					y += num(parent, 'borderTopWidth');

					// Mozilla does not include the border on body if an element isn't positioned absolute and is without an absolute parent
					if (mo && parPos == 'absolute') absparent = true;
					// IE does not include the border on the body if an element is position static and without an absolute or relative parent
					if (ie && parPos == 'relative') relparent = true;
				}

				op = parent.offsetParent;
				if (options.scroll || mo) {
					do {
						if (options.scroll) {
							// get scroll offsets
							sl += parent.scrollLeft;
							st += parent.scrollTop;
						}
				
						// Mozilla does not add the border for a parent that has overflow set to anything but visible
						if (mo && parent != elem && $.css(parent, 'overflow') != 'visible') {
							x += num(parent, 'borderLeftWidth');
							y += num(parent, 'borderTopWidth');
						}
				
						parent = parent.parentNode;
					} while (parent != op);
				}
				parent = op;

				if (parent.tagName.toLowerCase() == 'body' || parent.tagName.toLowerCase() == 'html') {
					// Safari and IE Standards Mode doesn't add the body margin for elments positioned with static or relative
					if ((sf || (ie && $.boxModel)) && elemPos != 'absolute' && elemPos != 'fixed') {
						x += num(parent, 'marginLeft');
						y += num(parent, 'marginTop');
					}
					// Mozilla does not include the border on body if an element isn't positioned absolute and is without an absolute parent
					// IE does not include the border on the body if an element is positioned static and without an absolute or relative parent
					if ( (mo && !absparent && elemPos != 'fixed') || 
					     (ie && elemPos == 'static' && !relparent) ) {
						x += num(parent, 'borderLeftWidth');
						y += num(parent, 'borderTopWidth');
					}
					break; // Exit the loop
				}
			} while (parent);
		}

		var returnValue = handleOffsetReturn(elem, options, x, y, sl, st);

		if (returnObject) { $.extend(returnObject, returnValue); return this; }
		else              { return returnValue; }
	},
	
	/**
	 * Returns the location of the element in pixels from the top left corner of the viewport.
	 * This method is much faster than offset but not as accurate. This method can be invoked
	 * by setting the lite option to true in the offset method.
	 *
	 * @name offsetLite
	 * @param Map options Optional settings to configure the way the offset is calculated.
	 * @option Boolean margin Should the margin of the element be included in the calculations? True by default.
	 * @option Boolean border Should the border of the element be included in the calculations? False by default.
	 * @option Boolean padding Should the padding of the element be included in the calculations? False by default.
	 * @option Boolean scroll Should the scroll offsets of the parent elements be included in the calculations? True by default.
	 *                        When true it adds the totla scroll offets of all parents to the total offset and also adds two properties
	 *                        to the returned object, scrollTop and scrollLeft. 
	 * @param Object returnObject An object to store the return value in, so as not to break the chain. If passed in the
	 *                            chain will not be broken and the result will be assigned to this object.
	 * @type Object
	 * @cat Plugins/Dimensions
	 */
	offsetLite: function(options, returnObject) {
		var x = 0, y = 0, sl = 0, st = 0, parent = this[0], op, 
		    options = $.extend({ margin: true, border: false, padding: false, scroll: true }, options || {});
				
		do {
			x += parent.offsetLeft;
			y += parent.offsetTop;

			op = parent.offsetParent;
			if (options.scroll) {
				// get scroll offsets
				do {
					sl += parent.scrollLeft;
					st += parent.scrollTop;
					parent = parent.parentNode;
				} while(parent != op);
			}
			parent = op;
		} while (parent && parent.tagName.toLowerCase() != 'body' && parent.tagName.toLowerCase() != 'html');

		var returnValue = handleOffsetReturn(this[0], options, x, y, sl, st);

		if (returnObject) { $.extend(returnObject, returnValue); return this; }
		else              { return returnValue; }
	}
});

/**
 * Handles converting a CSS Style into an Integer.
 * @private
 */
var num = function(el, prop) {
	return parseInt($.css(el.jquery?el[0]:el,prop))||0;
};

/**
 * Handles the return value of the offset and offsetLite methods.
 * @private
 */
var handleOffsetReturn = function(elem, options, x, y, sl, st) {
	if ( !options.margin ) {
		x -= num(elem, 'marginLeft');
		y -= num(elem, 'marginTop');
	}

	// Safari and Opera do not add the border for the element
	if ( options.border && ($.browser.safari || $.browser.opera) ) {
		x += num(elem, 'borderLeftWidth');
		y += num(elem, 'borderTopWidth');
	} else if ( !options.border && !($.browser.safari || $.browser.opera) ) {
		x -= num(elem, 'borderLeftWidth');
		y -= num(elem, 'borderTopWidth');
	}

	if ( options.padding ) {
		x += num(elem, 'paddingLeft');
		y += num(elem, 'paddingTop');
	}
	
	// do not include scroll offset on the element
	if ( options.scroll ) {
		sl -= elem.scrollLeft;
		st -= elem.scrollTop;
	}

	return options.scroll ? { top: y - st, left: x - sl, scrollTop:  st, scrollLeft: sl }
	                      : { top: y, left: x };
};

})(jQuery);
























//hoverIntent.js
(function($){
	/* hoverIntent by Brian Cherne */
	$.fn.hoverIntent = function(f,g) {
		// default configuration options
		var cfg = {
			sensitivity: 7,
			interval: 100,
			timeout: 0
		};
		// override configuration options with user supplied object
		cfg = $.extend(cfg, g ? { over: f, out: g } : f );

		// instantiate variables
		// cX, cY = current X and Y position of mouse, updated by mousemove event
		// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
		var cX, cY, pX, pY;

		// A private function for getting mouse position
		var track = function(ev) {
			cX = ev.pageX;
			cY = ev.pageY;
		};

		// A private function for comparing current and previous mouse position
		var compare = function(ev,ob) {
			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
			// compare mouse positions to see if they've crossed the threshold
			if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
				$(ob).unbind("mousemove",track);
				// set hoverIntent state to true (so mouseOut can be called)
				ob.hoverIntent_s = 1;
				return cfg.over.apply(ob,[ev]);
			} else {
				// set previous coordinates for next time
				pX = cX; pY = cY;
				// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
				ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
			}
		};

		// A private function for delaying the mouseOut function
		var delay = function(ev,ob) {
			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
			ob.hoverIntent_s = 0;
			return cfg.out.apply(ob,[ev]);
		};

		// A private function for handling mouse 'hovering'
		var handleHover = function(e) {
			// next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
			var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
			while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
			if ( p == this ) { return false; }

			// copy objects to be passed into t (required for event object to be passed in IE)
			var ev = jQuery.extend({},e);
			var ob = this;

			// cancel hoverIntent timer if it exists
			if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }

			// else e.type == "onmouseover"
			if (e.type == "mouseover") {
				// set "previous" X and Y position based on initial entry point
				pX = ev.pageX; pY = ev.pageY;
				// update "current" X and Y position based on mousemove
				$(ob).bind("mousemove",track);
				// start polling interval (self-calling timeout) to compare mouse coordinates over time
				if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}

			// else e.type == "onmouseout"
			} else {
				// unbind expensive mousemove event
				$(ob).unbind("mousemove",track);
				// if hoverIntent state is true, then call the mouseOut function after the specified delay
				if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
			}
		};

		// bind the function to the two event listeners
		return this.mouseover(handleHover).mouseout(handleHover);
	};
	
})(jQuery);






























//jquery.scrollTo-min.js
/**
 * jQuery.ScrollTo - Easy element scrolling using jQuery.
 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 5/25/2009
 * @author Ariel Flesler
 * @version 1.4.2
 *
 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 */
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
















//superfish.js

/*
 * Superfish v1.4.8 - jQuery menu widget
 * Copyright (c) 2008 Joel Birch
 *
 * Dual licensed under the MIT and GPL licenses:
 * 	http://www.opensource.org/licenses/mit-license.php
 * 	http://www.gnu.org/licenses/gpl.html
 *
 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
 */

;(function($){
	$.fn.superfish = function(op){

		var sf = $.fn.superfish,
			c = sf.c,
			$arrow = $(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),
			over = function(){
				var $$ = $(this), menu = getMenu($$);
				clearTimeout(menu.sfTimer);
				$$.showSuperfishUl().siblings().hideSuperfishUl();
			},
			out = function(){
				var $$ = $(this), menu = getMenu($$), o = sf.op;
				clearTimeout(menu.sfTimer);
				menu.sfTimer=setTimeout(function(){
					o.retainPath=($.inArray($$[0],o.$path)>-1);
					$$.hideSuperfishUl();
					if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
				},o.delay);	
			},
			getMenu = function($menu){
				var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
				sf.op = sf.o[menu.serial];
				return menu;
			},
			addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };
			
		return this.each(function() {
			var s = this.serial = sf.o.length;
			var o = $.extend({},sf.defaults,op);
			o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
				$(this).addClass([o.hoverClass,c.bcClass].join(' '))
					.filter('li:has(ul)').removeClass(o.pathClass);
			});
			sf.o[s] = sf.op = o;
			
			$('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
				if (o.autoArrows) addArrow( $('>a:first-child',this) );
			})
			.not('.'+c.bcClass)
				.hideSuperfishUl();
			
			var $a = $('a',this);
			$a.each(function(i){
				var $li = $a.eq(i).parents('li');
				$a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
			});
			o.onInit.call(this);
			
		}).each(function() {
			var menuClasses = [c.menuClass];
			if (sf.op.dropShadows  && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
			$(this).addClass(menuClasses.join(' '));
		});
	};

	var sf = $.fn.superfish;
	sf.o = [];
	sf.op = {};
	sf.IE7fix = function(){
		var o = sf.op;
		if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined)
			this.toggleClass(sf.c.shadowClass+'-off');
		};
	sf.c = {
		bcClass     : 'sf-breadcrumb',
		menuClass   : 'sf-js-enabled',
		anchorClass : 'sf-with-ul',
		arrowClass  : 'sf-sub-indicator',
		shadowClass : 'sf-shadow'
	};
	sf.defaults = {
		hoverClass	: 'sfHover',
		pathClass	: 'overideThisToUse',
		pathLevels	: 1,
		delay		: 800,
		animation	: {opacity:'show'},
		speed		: 'normal',
		autoArrows	: true,
		dropShadows : true,
		disableHI	: false,		// true disables hoverIntent detection
		onInit		: function(){}, // callback functions
		onBeforeShow: function(){},
		onShow		: function(){},
		onHide		: function(){}
	};
	$.fn.extend({
		hideSuperfishUl : function(){
			var o = sf.op,
				not = (o.retainPath===true) ? o.$path : '';
			o.retainPath = false;
			var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
					.find('>ul').hide().css('visibility','hidden');
			o.onHide.call($ul);
			return this;
		},
		showSuperfishUl : function(){
			var o = sf.op,
				sh = sf.c.shadowClass+'-off',
				$ul = this.addClass(o.hoverClass)
					.find('>ul:hidden').css('visibility','visible');
			sf.IE7fix.call($ul);
			o.onBeforeShow.call($ul);
			$ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
			return this;
		}
	});

})(jQuery);









































//jQuery_marquee.php
/**
* author Remy Sharp
* url http://remysharp.com/tag/marquee
*/

(function ($) {
    $.fn.marquee = function (klass) {
        var newMarquee = [],
            last = this.length;

        // works out the left or right hand reset position, based on scroll
        // behavior, current direction and new direction
        function getReset(newDir, marqueeRedux, marqueeState) {
            var behavior = marqueeState.behavior, width = marqueeState.width, dir = marqueeState.dir;
            var r = 0;
            if (behavior == 'alternate') {
                r = newDir == 1 ? marqueeRedux[marqueeState.widthAxis] - (width*2) : width;
            } else if (behavior == 'slide') {
                if (newDir == -1) {
                    r = dir == -1 ? marqueeRedux[marqueeState.widthAxis] : width;
                } else {
                    r = dir == -1 ? marqueeRedux[marqueeState.widthAxis] - (width*2) : 0;
                }
            } else {
                r = newDir == -1 ? marqueeRedux[marqueeState.widthAxis] : 0;
            }
            return r;
        }

        // single "thread" animation
        function animateMarquee() {
            var i = newMarquee.length,
                marqueeRedux = null,
                $marqueeRedux = null,
                marqueeState = {},
                newMarqueeList = [],
                hitedge = false;
                
            while (i--) {
                marqueeRedux = newMarquee[i];
                $marqueeRedux = $(marqueeRedux);
                marqueeState = $marqueeRedux.data('marqueeState');
                
                if ($marqueeRedux.data('paused') !== true) {
                    // TODO read scrollamount, dir, behavior, loops and last from data
                    marqueeRedux[marqueeState.axis] += (marqueeState.scrollamount * marqueeState.dir);

                    // only true if it's hit the end
                    hitedge = marqueeState.dir == -1 ? marqueeRedux[marqueeState.axis] <= getReset(marqueeState.dir * -1, marqueeRedux, marqueeState) : marqueeRedux[marqueeState.axis] >= getReset(marqueeState.dir * -1, marqueeRedux, marqueeState);
                    
                    if ((marqueeState.behavior == 'scroll' && marqueeState.last == marqueeRedux[marqueeState.axis]) || (marqueeState.behavior == 'alternate' && hitedge && marqueeState.last != -1) || (marqueeState.behavior == 'slide' && hitedge && marqueeState.last != -1)) {                        
                        if (marqueeState.behavior == 'alternate') {
                            marqueeState.dir *= -1; // flip
                        }
                        marqueeState.last = -1;

                        $marqueeRedux.trigger('stop');

                        marqueeState.loops--;
                        if (marqueeState.loops === 0) {
                            if (marqueeState.behavior != 'slide') {
                                marqueeRedux[marqueeState.axis] = getReset(marqueeState.dir, marqueeRedux, marqueeState);
                            } else {
                                // corrects the position
                                marqueeRedux[marqueeState.axis] = getReset(marqueeState.dir * -1, marqueeRedux, marqueeState);
                            }

                            $marqueeRedux.trigger('end');
                        } else {
                            // keep this marquee going
                            newMarqueeList.push(marqueeRedux);
                            $marqueeRedux.trigger('start');
                            marqueeRedux[marqueeState.axis] = getReset(marqueeState.dir, marqueeRedux, marqueeState);
                        }
                    } else {
                        newMarqueeList.push(marqueeRedux);
                    }
                    marqueeState.last = marqueeRedux[marqueeState.axis];

                    // store updated state only if we ran an animation
                    $marqueeRedux.data('marqueeState', marqueeState);
                } else {
                    // even though it's paused, keep it in the list
                    newMarqueeList.push(marqueeRedux);                    
                }
            }

            newMarquee = newMarqueeList;
            
            if (newMarquee.length) {
                setTimeout(animateMarquee, 25);
            }            
        }
        
        // TODO consider whether using .html() in the wrapping process could lead to loosing predefined events...
        this.each(function (i) {
            var $marquee = $(this),
                width = $marquee.attr('width') || $marquee.width(),
                height = $marquee.attr('height') || $marquee.height(),
                $marqueeRedux = $marquee.after('<div ' + (klass ? 'class="' + klass + '" ' : '') + 'style="display: block-inline; width: ' + width + 'px; height: ' + height + 'px; overflow: hidden;"><div style="float: left; white-space: nowrap;">' + $marquee.html() + '</div></div>').next(),
                marqueeRedux = $marqueeRedux.get(0),
                hitedge = 0,
                direction = ($marquee.attr('direction') || 'left').toLowerCase(),
                marqueeState = {
                    dir : /down|right/.test(direction) ? -1 : 1,
                    axis : /left|right/.test(direction) ? 'scrollLeft' : 'scrollTop',
                    widthAxis : /left|right/.test(direction) ? 'scrollWidth' : 'scrollHeight',
                    last : -1,
                    loops : $marquee.attr('loop') || -1,
                    scrollamount : $marquee.attr('scrollamount') || this.scrollAmount || 2,
                    behavior : ($marquee.attr('behavior') || 'scroll').toLowerCase(),
                    width : /left|right/.test(direction) ? width : height
                };
            
            // corrects a bug in Firefox - the default loops for slide is -1
            if ($marquee.attr('loop') == -1 && marqueeState.behavior == 'slide') {
                marqueeState.loops = 1;
            }

            $marquee.remove();
            
            // add padding
            if (/left|right/.test(direction)) {
                $marqueeRedux.find('> div').css('padding', '0 ' + width + 'px');
            } else {
                $marqueeRedux.find('> div').css('padding', height + 'px 0');
            }
            
            // events
            $marqueeRedux.bind('stop', function () {
                $marqueeRedux.data('paused', true);
            }).bind('pause', function () {
                $marqueeRedux.data('paused', true);
            }).bind('start', function () {
                $marqueeRedux.data('paused', false);
            }).bind('unpause', function () {
                $marqueeRedux.data('paused', false);
            }).data('marqueeState', marqueeState); // finally: store the state
            
            // todo - rerender event allowing us to do an ajax hit and redraw the marquee

            newMarquee.push(marqueeRedux);

            marqueeRedux[marqueeState.axis] = getReset(marqueeState.dir, marqueeRedux, marqueeState);
            $marqueeRedux.trigger('start');
            
            // on the very last marquee, trigger the animation
            if (i+1 == last) {
                animateMarquee();
            }
        });            

        return $(newMarquee);
    };
}(jQuery));
























jQuery(function(){jQuery('ul.sf-menu').superfish();});
jQuery.noConflict();












//scripts.js
function czysc_pole(id,name,type){
	if(document.getElementById(id).value==name){document.getElementById(id).value='';}
	if(type=='password'){document.getElementById(id).setAttribute("type","password");}
}
function uzupelnij_pole(id,name,type){
	if(document.getElementById(id).value==''){
		document.getElementById(id).value=name;
		if(type=='password'){document.getElementById(id).setAttribute("type","text");}
	}
}

function setCheckboxes(the_form, do_check)
{

    var elts      = document.forms[the_form].elements;
    var elts_cnt  = elts.length;

	for (var i = 0; i < elts_cnt; i++) {
		if (elts[i].type=="checkbox") elts[i].checked = do_check;
    } // end for

    return true;
}

function ustawWartosc(nazwaPola, wartosc){
	document.getElementById(nazwaPola).value = wartosc;
}

function ustaw_checkboxy(formularz, opcja){
	d = eval("document." + formularz + "");
	if(opcja == "select"){
		for (i = 0; i<d.elements.length; i++){
			if(d.elements[i].type == "checkbox"){
				d.elements[i].checked = true;
			}
		}
	}else if(opcja == "deselect"){
		for (i = 0; i<d.elements.length; i++){
			if(d.elements[i].type == "checkbox"){
				d.elements[i].checked = false;
			}
		}
	}else if(opcja == "invert"){
		for (i = 0; i<d.elements.length; i++){
			if(d.elements[i].type == "checkbox"){
				if(d.elements[i].checked == true){
					d.elements[i].checked = false;
				}else{
					d.elements[i].checked = true;
				}
			}
		}
	}
}

function formatuj_liczbe(n, dokladnosc){
	/*
	n = Math.round(n * 100) / 100;
	//n = (n + 0.001) + '';
	n = (n + 0.001) + '';
	n = (n - 0.001) + '';
	//alert("n: " + n);
	return n.substring(0, n.indexOf('.') + 3);
	*/
	//num = 930.9805;
	//result = n.toFixed(2);
	return n.toFixed(dokladnosc);
}

function limit_dla_pola(limit, pole, span_pole){
	if (document.getElementById(pole).value.length > limit){
		document.getElementById(pole).value = document.getElementById(pole).value.substring(0, limit);
	}
	if(span_pole.length > 0){
		txt = "";
		ile_pozostalo = limit - document.getElementById(pole).value.length;
		txt = "<br>Pozostało " + ile_pozostalo + " z " + limit + " znaków.";
		document.getElementById(span_pole).innerHTML = txt;
	}
}

function migajacy_text(id, k1, t1, k2, t2){
  if (document.getElementById){
    document.getElementById(id).style.color = k1;
	setTimeout('migajacy_text("' +  id + '","' + k2 + '",' + t2 + ',"' + k1 + '",' + t1 + ')', t1);
  }else if (document.all){
    document.all[id].style.color = k1;
	setTimeout('migajacy_text("' +  id + '","' + k2 + '",' + t2 + ',"' + k1 + '",' + t1 + ')', t1);
  }
}

function popraw_telefon(nazwa_pola, max_znakow) {
    document.getElementById(nazwa_pola).value = document.getElementById(nazwa_pola).value.replace(/[^0-9\(\)\ ]/g,"");
	if(max_znakow.length > 0){
		document.getElementById(nazwa_pola).value = przytnij_text(document.getElementById(nazwa_pola).value, max_znakow);
	}
}

function sprawdz_mail(email_pole) {
	if (document.getElementById(email_pole).value.length>0){
		Wzor = /^[0-9a-zA-Z.-_\-]+\@[0-9a-zA-Z.-_\-]+\.[0-9a-zA-Z.]{2,4}$/;
	   	if (Wzor.test(document.getElementById(email_pole).value) == false){
    		alert("Niewłasciwy format adresu e-mail!");
	    	return false;
	    }  
   		return true; 
    }
  	return true;
}

function MM_jumpMenu(targ,value,restore){ //v3.0
	eval(targ+".location='"+value+"'");
	if (restore) selObj.selectedIndex=0;
}

function MM_swapImgRestore(){ //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages(){ //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d){ //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage(){ //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function pop_new_window(nazwa_pliku, zmienna, id, qs){
	var plik = nazwa_pliku + "?" + zmienna + "=" + id + qs;
	var Win = window.open(plik, "okno","menubar=0,location=0,status=0,toolbar=0,directories=0,alwaysRaised=1,scrollbars=1,titlebar=1,resizable=1");
}

function pop_zdjecie(nazwa_zdjecia_big, nazwa_podkatalogu){
	var plik = "pop_zdjecie.php?foto=" + nazwa_zdjecia_big + "&podkatalog=" + nazwa_podkatalogu;
	var Win = window.open(plik, "big_foto","menubar=0,location=0,status=0,toolbar=0,directories=0,alwaysRaised=1,scrollbars=1,titlebar=1,resizable=1");
}

function pop_zdjecie2(host ,nazwa_zdjecia_big, nazwa_podkatalogu){
	var plik = host + "pop_zdjecie.php?foto=" + nazwa_zdjecia_big + "&podkatalog=" + nazwa_podkatalogu;
	var Win = window.open(plik, "big_foto","menubar=0,location=0,status=0,toolbar=0,directories=0,alwaysRaised=1,scrollbars=1,titlebar=1,resizable=1");
}

function przytnij_text(text, max_znakow){
	if (text.length > max_znakow){
		text = text.substring(0, max_znakow);
	}
	return text;
}

function tylko_cyfry(nazwa_pola, max_znakow) {
    document.getElementById(nazwa_pola).value = document.getElementById(nazwa_pola).value.replace(/[^0-9]/g,"");
	if(max_znakow.length > 0){
		document.getElementById(nazwa_pola).value = przytnij_text(document.getElementById(nazwa_pola).value, max_znakow);
	}
}

function tylko_litery(nazwa_pola, max_znakow) {
    document.getElementById(nazwa_pola).value = document.getElementById(nazwa_pola).value.replace(/[^a-z]/g,"");
	if(max_znakow.length > 0){
		document.getElementById(nazwa_pola).value = przytnij_text(document.getElementById(nazwa_pola).value, max_znakow);
	}
}

function usun_biale_znaki(ciag){
	ciag = ciag.replace(/\r/g, " ");
  	ciag = ciag.replace(/[^ A-Za-z0-9`~!@#\$%\^&\*\(\)-_=\+\\\|\]\[\}\{'";:\?\/\.>,<]/g, "");
	ciag = ciag.replace(/'/g, "");
	ciag = ciag.replace(/ +/g, " ");  
	ciag = ciag.replace(/^\s/g, "");
	ciag = ciag.replace(/\s$/g, "");	
	return ciag;
}

function uwzglednij_rabat(pole_brutto, pole_oryg_netto,  pole_netto, pole_rabat, pole_vat){
		document.getElementById(pole_netto).value = formatuj_liczbe((document.getElementById(pole_oryg_netto).value * (1 - usun_biale_znaki(document.getElementById(pole_rabat).value) / 100)), 3);		
		wylicz_wartosc(pole_netto, pole_brutto, '0', pole_vat, 'brutto');
}

function wylicz_wartosc(pole_baza, pole_zmiana, rabat, pole_vat, opcja){
	if(opcja == 'brutto'){
		document.getElementById(pole_zmiana).value = formatuj_liczbe(document.getElementById(pole_baza).value * (1 + usun_biale_znaki(document.getElementById(pole_vat).value) / 100), 3);
	}else if(opcja == 'netto'){
		document.getElementById(pole_zmiana).value = formatuj_liczbe(document.getElementById(pole_baza).value / (1 + usun_biale_znaki(document.getElementById(pole_vat).value) / 100), 3);
	}
}

function podmien_zdjecie(nazwa_zdjecia, div_name, name, host, zdjecie_big){
	document.getElementById(div_name).innerHTML="<img src=\""+nazwa_zdjecia+"\" border=\"0\" width=\"160\" height=\"160\" alt=\""+name+"\" title=\""+name+"\" onmouseover=\"this.style.cursor='pointer';\" onclick=\"pop_zdjecie2('"+host+"','"+zdjecie_big+"','foto');\">";
}

function zmien_serie(host,seria){
	if(seria!='-'){
		document.location=''+host+'serie/'+seria+'/';
	}
}

function oceny(ile, host, id){
	tresc='';
	for(i=0; i<ile; i++){
		j=i+1;
		tresc=tresc+' <img src="'+host+'img/oceny_t.gif" title="oceny" alt="oceny" />';
		//tresc=tresc+' <img src="'+host+'img/oceny_t.gif" title="oceny" alt="oceny" onmouseover="oceny('+j+', \''+host+'\', \''+id+'\');" />';
	}
	j=ile+1;
	for(i=j; i<6; i++){
		tresc=tresc+' <img src="'+host+'img/oceny_n.gif" title="oceny" alt="oceny" />';
		//tresc=tresc+' <img src="'+host+'img/oceny_n.gif" title="oceny" alt="oceny" onmouseover="oceny('+i+', \''+host+'\', \''+id+'\');" />';
	}
	document.getElementById(id).innerHTML=tresc;
}

function textarea_znaki(pole_id,id,limit){
	if (document.getElementById(pole_id).value.length>=limit){
		document.getElementById(pole_id).value=document.getElementById(pole_id).value.substr(0,limit);
		document.getElementById(id).innerHTML="Użyto znaków: <b><span style=\"color: red;\">"+document.getElementById(pole_id).value.length+"</span></b> &nbsp;&nbsp; Pozostało: <b>"+parseInt(limit-document.getElementById(pole_id).value.length)+"</b>";
	}else{
		document.getElementById(id).innerHTML="Użyto znaków: <b>"+document.getElementById(pole_id).value.length+"</b> &nbsp;&nbsp; Pozostało: <b>"+parseInt(limit-document.getElementById(pole_id).value.length)+"</b>";
	}
}


























































































//AC_Flash.js
// Implements AC_GenerateObj() function. This is a generic function used to generate
// object/embed/param tags. It is used by higher level api functions.

/************** LOCALIZABLE GLOBAL VARIABLES ****************/

var MSG_EvenArgs = 'The %s function requires an even number of arguments.'
                 + '\nArguments should be in the form "atttributeName","attributeValue",...';
var MSG_SrcRequired = "The %s function requires that a movie src be passed in as one of the arguments.";

/******************** END LOCALIZABLE **********************/

// Finds a parameter with the name paramName, and checks to see if it has the 
// passed extension. If it doesn't have it, this function adds the extension.
function AC_AddExtension(args, paramName, extension)
{
  var currArg, paramVal, queryStr, endStr;
  for (var i=0; i < args.length; i=i+2){
    currArg = args[i].toLowerCase();    
    if (currArg == paramName.toLowerCase() && args.length > i+1) {
      paramVal = args[i+1];
      queryStr = "";

      // Pull off the query string if it exists.
      var indQueryStr = args[i+1].indexOf('?');
      if (indQueryStr != -1){
        paramVal = args[i+1].substring(0, indQueryStr);
        queryStr = args[i+1].substr(indQueryStr);
      }

      endStr = "";
      if (paramVal.length > extension.length)
        endStr = paramVal.substr(paramVal.length - extension.length);
      if (endStr.toLowerCase() != extension.toLowerCase()) {
        // Extension doesn't exist, add it
        args[i+1] = paramVal + extension + queryStr;
      }
    }
  }
}

// Builds the codebase value to use. If the 'codebase' parameter is found in the args,
// uses its value as the version for the baseURL. If 'codebase' is not found in the args,
// uses the defaultVersion.
function AC_GetCodebase(baseURL, defaultVersion, args)
{
  var codebase = baseURL + defaultVersion;
  for (var i=0; i < args.length; i=i+2) {
    currArg = args[i].toLowerCase();    
    if (currArg == "codebase" && args.length > i+1) {
      if (args[i+1].indexOf("http://") == 0) {
        // User passed in a full codebase, so use it.
        codebase = args[i+1];
      }
      else {
        codebase = baseURL + args[i+1];
      }
    }
  }
	
  return codebase;	
}

// Substitutes values for %s in a string.
// Usage: AC_sprintf("The %s function requires %s arguments.","foo()","4");
function AC_sprintf(str){
  for (var i=1; i < arguments.length; i++){
    str = str.replace(/%s/,arguments[i]);
  }
  return str;
}
		
// Checks that args, the argument list to check, has an even number of 
// arguments. Alerts the user if an odd number of arguments is found.
function AC_checkArgs(args,callingFn){
  var retVal = true;
  // If number of arguments isn't even, show a warning and return false.
  if (parseFloat(args.length/2) != parseInt(args.length/2)){
    alert(sprintf(MSG_EvenArgs,callingFn));
    retVal = false;
  }
  return retVal;
}
	
function AC_GenerateObj(callingFn, useXHTML, classid, codebase, pluginsPage, mimeType, args){

  if (!AC_checkArgs(args,callingFn)){
    return;
  }

  // Initialize variables
  var tagStr = '';
  var currArg = '';
  var closer = (useXHTML) ? '/>' : '>';
  var srcFound = false;
  var embedStr = '<embed';
  var paramStr = '';
  var embedNameAttr = '';
  var objStr = '<object classid="' + classid + '" codebase="' + codebase + '"';

  // Spin through all the argument pairs, assigning attributes and values to the object,
  // param, and embed tags as appropriate.
  for (var i=0; i < args.length; i=i+2){
    currArg = args[i].toLowerCase();    

    if (currArg == "src"){
      if (callingFn.indexOf("RunSW") != -1){
        paramStr += '<param name="' + args[i] + '" value="' + args[i+1] + '"' + closer + '\n';
        embedStr += ' ' + args[i] + '="' + args[i+1] + '"';
        srcFound = true;
      }
      else if (!srcFound){
        paramStr += '<param name="movie" value="' + args[i+1] + '"' + closer + '\n'; 
        embedStr += ' ' + args[i] + '="' + args[i+1] + '"';
        srcFound = true;
      }
    }
    else if (currArg == "movie"){
      if (!srcFound){
        paramStr += '<param name="' + args[i] + '" value="' + args[i+1] + '"' + closer + '\n'; 
        embedStr += ' src="' + args[i+1] + '"';
        srcFound = true;
      }
    }
    else if (   currArg == "width" 
              || currArg == "height" 
              || currArg == "align" 
              || currArg == "vspace" 
              || currArg == "hspace" 
              || currArg == "class" 
              || currArg == "title" 
              || currArg == "accesskey" 
              || currArg == "tabindex"){
      objStr += ' ' + args[i] + '="' + args[i+1] + '"';
      embedStr += ' ' + args[i] + '="' + args[i+1] + '"';
    }
    else if (currArg == "id"){
      objStr += ' ' + args[i] + '="' + args[i+1] + '"';
      // Only add the name attribute to the embed tag if a name attribute 
      // isn't already there. This is what Dreamweaver does if the user
      // enters a name for a movie in the PI: it adds id to the object
      // tag, and name to the embed tag.
      if (embedNameAttr == "")
        embedNameAttr = ' name="' + args[i+1] + '"';
    }
    else if (currArg == "name"){
      objStr += ' ' + args[i] + '="' + args[i+1] + '"';
      // Replace the current embed tag name attribute with the one passed in.
      embedNameAttr = ' ' + args[i] + '="' + args[i+1] + '"';
    }    
    else if (currArg == "codebase"){
      // The codebase parameter has already been handled, so ignore it. 
    }    
    // This is an attribute we don't know about. Assume that we should add it to the 
    // param and embed strings.
    else{
      paramStr += '<param name="' + args[i] + '" value="' + args[i+1] + '"' + closer + '\n'; 
      embedStr += ' ' + args[i] + '="' + args[i+1] + '"';
    }
  }

  // Tell the user that a movie/src is required, if one was not passed in.
  if (!srcFound){
    alert(AC_sprintf(MSG_SrcRequired,callingFn));
    return;
  }

  if (embedNameAttr)
    embedStr += embedNameAttr;	
  if (pluginsPage)
    embedStr += ' pluginspage="' + pluginsPage + '"';
  if (mimeType)
    embedStr += ' type="' + mimeType + '"';
    
  // Close off the object and embed strings
  objStr += '>\n';
  embedStr += '></embed>\n'; 

  // Assemble the three tag strings into a single string.
  tagStr = objStr + paramStr + embedStr + "</object>\n"; 

  document.write(tagStr);
}







// The code below contains functions that run active content. The functions
// assemble an OBJECT/EMBED tag string, and then perform a document.write of 
// this string in the calling html document.
//   AC_RunFlContent() - build tags to display Flash content.
//   AC_RunFlContentX() - build XHTML formatted tags to display Flash content.
//   AC_RunSWContent() - build tags to display Shockwave content.
//   AC_RunSWContentX()  - build XHTML formatted tags to display Shockwave content.
//
// To call one of these functions, pass all the attributes and values that you would 
// otherwise specify for the object, param, and embed tags in the following form:
//   AC_RunFlContent(
//     "attrName1", "attrValue1"
//     "attrName2", "attrValue2"
//     ...
//     "attrNamen", "attrValuen"
//   )
//
// When passing in the src or movie attributes, do not include the file extension.
// Note, these functions use default values for several standard tag attributes, 
// including classid, codebase, pluginsPage, and mimeType, depending on the function
// you call. So, you should not pass in values for these attributes. If you require
// an alternate values for these attributes, you'll need to modify the default values 
// used in the 'Run' function implementations below. However, you may pass in an
// alternate version for the codebase value, as in AC_RunFlContent("codebase","6,0,0,0",...).
// Note that you should only pass in the version string rather than the full
// codebase URL.
//
// You must include AC_RunActiveContent.js for these functions to work.

function AC_RunFlContent()
{
  // First, look for a "movie" and "src" params, and if either exists, add a ".swf" to the end
  // if it doesn't already have one (this function will only run swf files)
  AC_AddExtension(arguments, "movie", ".swf");
  AC_AddExtension(arguments, "src", ".swf");

  // Build the codebase value. If user passed in a version for the codebase, add the version
  // to the base codebase url. Otherwise, use the default version.
  var codebase = AC_GetCodebase
                 (  "https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="
                  , "7,0,0,0", arguments 
                 );
	
  AC_GenerateObj
  (  "AC_RunFlContent()", false, "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
   , codebase
   , "https://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
   , "application/x-shockwave-flash", arguments
  );
}

function AC_RunFlContentX()
{
  // First, look for a "movie" and "src" params, and if either exists, add a ".swf" to the end
  // if it doesn't already have one (this function will only run swf files)
  AC_AddExtension(arguments, "movie", ".swf");
  AC_AddExtension(arguments, "src", ".swf");

  // Build the codebase value. If user passed in a version for the codebase, add the version
  // to the base codebase url. Otherwise, use the default version.
  var codebase = AC_GetCodebase
                 (  "https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="
                  , "7,0,0,0", arguments 
                 );
	
  AC_GenerateObj
  (  "AC_RunFlContentX()", true, "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
   , codebase
   , "https://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
   , "application/x-shockwave-flash", arguments
  );	
}

function AC_RunSWContent()
{
  // First, look for a "src" param, and if it exists, add a ".dcr" to the end
  // if it doesn't already have one (this function will only run dcr files)
  AC_AddExtension(arguments, "src", ".dcr");

  // Build the codebase value. If user passed in a version for the codebase, add the version
  // to the base codebase url. Otherwise, use the default version.
  var codebase = AC_GetCodebase
                 (  "https://fpdownload.macromedia.com/pub/shockwave/cabs/director/sw.cab#version="
                  , "8,5,0,0", arguments 
                 );
	
  AC_GenerateObj
  (  "AC_RunSWContent()", false, "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
   , codebase
   , "https://www.macromedia.com/shockwave/download/", null, arguments
  );
}
	
function AC_RunSWContentX()
{
  // First, look for a "src" param, and if it exists, add a ".dcr" to the end
  // if it doesn't already have one (this function will only run dcr files)
  AC_AddExtension(arguments, "src", ".dcr");

  // Build the codebase value. If user passed in a version for the codebase, add the version
  // to the base codebase url. Otherwise, use the default version.
  var codebase = AC_GetCodebase
                 (  "https://fpdownload.macromedia.com/pub/shockwave/cabs/director/sw.cab#version="
                  , "8,5,0,0", arguments 
                 );
	
  AC_GenerateObj
  (  "AC_RunSWContentX()", true, "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
   , codebase
   , "https://www.macromedia.com/shockwave/download/", null, arguments
  );
}
	

































































//lightbox

//prototype.js
/*  Prototype JavaScript framework, version 1.5.1
 *  (c) 2005-2007 Sam Stephenson
 *
 *  Prototype is freely distributable under the terms of an MIT-style license.
 *  For details, see the Prototype web site: http://www.prototypejs.org/
 *
/*--------------------------------------------------------------------------*/

var Prototype = {
  Version: '1.5.1',

  Browser: {
    IE:     !!(window.attachEvent && !window.opera),
    Opera:  !!window.opera,
    WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
    Gecko:  navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1
  },

  BrowserFeatures: {
    XPath: !!document.evaluate,
    ElementExtensions: !!window.HTMLElement,
    SpecificElementExtensions:
      (document.createElement('div').__proto__ !==
       document.createElement('form').__proto__)
  },

  ScriptFragment: '<script[^>]*>([\u0001-\uFFFF]*?)</script>',
  JSONFilter: /^\/\*-secure-\s*(.*)\s*\*\/\s*$/,

  emptyFunction: function() { },
  K: function(x) { return x }
}

var Class = {
  create: function() {
    return function() {
      this.initialize.apply(this, arguments);
    }
  }
}

var Abstract = new Object();

Object.extend = function(destination, source) {
  for (var property in source) {
    destination[property] = source[property];
  }
  return destination;
}

Object.extend(Object, {
  inspect: function(object) {
    try {
      if (object === undefined) return 'undefined';
      if (object === null) return 'null';
      return object.inspect ? object.inspect() : object.toString();
    } catch (e) {
      if (e instanceof RangeError) return '...';
      throw e;
    }
  },

  toJSON: function(object) {
    var type = typeof object;
    switch(type) {
      case 'undefined':
      case 'function':
      case 'unknown': return;
      case 'boolean': return object.toString();
    }
    if (object === null) return 'null';
    if (object.toJSON) return object.toJSON();
    if (object.ownerDocument === document) return;
    var results = [];
    for (var property in object) {
      var value = Object.toJSON(object[property]);
      if (value !== undefined)
        results.push(property.toJSON() + ': ' + value);
    }
    return '{' + results.join(', ') + '}';
  },

  keys: function(object) {
    var keys = [];
    for (var property in object)
      keys.push(property);
    return keys;
  },

  values: function(object) {
    var values = [];
    for (var property in object)
      values.push(object[property]);
    return values;
  },

  clone: function(object) {
    return Object.extend({}, object);
  }
});

Function.prototype.bind = function() {
  var __method = this, args = $A(arguments), object = args.shift();
  return function() {
    return __method.apply(object, args.concat($A(arguments)));
  }
}

Function.prototype.bindAsEventListener = function(object) {
  var __method = this, args = $A(arguments), object = args.shift();
  return function(event) {
    return __method.apply(object, [event || window.event].concat(args));
  }
}

Object.extend(Number.prototype, {
  toColorPart: function() {
    return this.toPaddedString(2, 16);
  },

  succ: function() {
    return this + 1;
  },

  times: function(iterator) {
    $R(0, this, true).each(iterator);
    return this;
  },

  toPaddedString: function(length, radix) {
    var string = this.toString(radix || 10);
    return '0'.times(length - string.length) + string;
  },

  toJSON: function() {
    return isFinite(this) ? this.toString() : 'null';
  }
});

Date.prototype.toJSON = function() {
  return '"' + this.getFullYear() + '-' +
    (this.getMonth() + 1).toPaddedString(2) + '-' +
    this.getDate().toPaddedString(2) + 'T' +
    this.getHours().toPaddedString(2) + ':' +
    this.getMinutes().toPaddedString(2) + ':' +
    this.getSeconds().toPaddedString(2) + '"';
};

var Try = {
  these: function() {
    var returnValue;

    for (var i = 0, length = arguments.length; i < length; i++) {
      var lambda = arguments[i];
      try {
        returnValue = lambda();
        break;
      } catch (e) {}
    }

    return returnValue;
  }
}

/*--------------------------------------------------------------------------*/

var PeriodicalExecuter = Class.create();
PeriodicalExecuter.prototype = {
  initialize: function(callback, frequency) {
    this.callback = callback;
    this.frequency = frequency;
    this.currentlyExecuting = false;

    this.registerCallback();
  },

  registerCallback: function() {
    this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
  },

  stop: function() {
    if (!this.timer) return;
    clearInterval(this.timer);
    this.timer = null;
  },

  onTimerEvent: function() {
    if (!this.currentlyExecuting) {
      try {
        this.currentlyExecuting = true;
        this.callback(this);
      } finally {
        this.currentlyExecuting = false;
      }
    }
  }
}
Object.extend(String, {
  interpret: function(value) {
    return value == null ? '' : String(value);
  },
  specialChar: {
    '\b': '\\b',
    '\t': '\\t',
    '\n': '\\n',
    '\f': '\\f',
    '\r': '\\r',
    '\\': '\\\\'
  }
});

Object.extend(String.prototype, {
  gsub: function(pattern, replacement) {
    var result = '', source = this, match;
    replacement = arguments.callee.prepareReplacement(replacement);

    while (source.length > 0) {
      if (match = source.match(pattern)) {
        result += source.slice(0, match.index);
        result += String.interpret(replacement(match));
        source  = source.slice(match.index + match[0].length);
      } else {
        result += source, source = '';
      }
    }
    return result;
  },

  sub: function(pattern, replacement, count) {
    replacement = this.gsub.prepareReplacement(replacement);
    count = count === undefined ? 1 : count;

    return this.gsub(pattern, function(match) {
      if (--count < 0) return match[0];
      return replacement(match);
    });
  },

  scan: function(pattern, iterator) {
    this.gsub(pattern, iterator);
    return this;
  },

  truncate: function(length, truncation) {
    length = length || 30;
    truncation = truncation === undefined ? '...' : truncation;
    return this.length > length ?
      this.slice(0, length - truncation.length) + truncation : this;
  },

  strip: function() {
    return this.replace(/^\s+/, '').replace(/\s+$/, '');
  },

  stripTags: function() {
    return this.replace(/<\/?[^>]+>/gi, '');
  },

  stripScripts: function() {
    return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
  },

  extractScripts: function() {
    var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
    var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
    return (this.match(matchAll) || []).map(function(scriptTag) {
      return (scriptTag.match(matchOne) || ['', ''])[1];
    });
  },

  evalScripts: function() {
    return this.extractScripts().map(function(script) { return eval(script) });
  },

  escapeHTML: function() {
    var self = arguments.callee;
    self.text.data = this;
    return self.div.innerHTML;
  },

  unescapeHTML: function() {
    var div = document.createElement('div');
    div.innerHTML = this.stripTags();
    return div.childNodes[0] ? (div.childNodes.length > 1 ?
      $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) :
      div.childNodes[0].nodeValue) : '';
  },

  toQueryParams: function(separator) {
    var match = this.strip().match(/([^?#]*)(#.*)?$/);
    if (!match) return {};

    return match[1].split(separator || '&').inject({}, function(hash, pair) {
      if ((pair = pair.split('='))[0]) {
        var key = decodeURIComponent(pair.shift());
        var value = pair.length > 1 ? pair.join('=') : pair[0];
        if (value != undefined) value = decodeURIComponent(value);

        if (key in hash) {
          if (hash[key].constructor != Array) hash[key] = [hash[key]];
          hash[key].push(value);
        }
        else hash[key] = value;
      }
      return hash;
    });
  },

  toArray: function() {
    return this.split('');
  },

  succ: function() {
    return this.slice(0, this.length - 1) +
      String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
  },

  times: function(count) {
    var result = '';
    for (var i = 0; i < count; i++) result += this;
    return result;
  },

  camelize: function() {
    var parts = this.split('-'), len = parts.length;
    if (len == 1) return parts[0];

    var camelized = this.charAt(0) == '-'
      ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
      : parts[0];

    for (var i = 1; i < len; i++)
      camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);

    return camelized;
  },

  capitalize: function() {
    return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
  },

  underscore: function() {
    return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
  },

  dasherize: function() {
    return this.gsub(/_/,'-');
  },

  inspect: function(useDoubleQuotes) {
    var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) {
      var character = String.specialChar[match[0]];
      return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16);
    });
    if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"';
    return "'" + escapedString.replace(/'/g, '\\\'') + "'";
  },

  toJSON: function() {
    return this.inspect(true);
  },

  unfilterJSON: function(filter) {
    return this.sub(filter || Prototype.JSONFilter, '#{1}');
  },

  evalJSON: function(sanitize) {
    var json = this.unfilterJSON();
    try {
      if (!sanitize || (/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(json)))
        return eval('(' + json + ')');
    } catch (e) { }
    throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
  },

  include: function(pattern) {
    return this.indexOf(pattern) > -1;
  },

  startsWith: function(pattern) {
    return this.indexOf(pattern) === 0;
  },

  endsWith: function(pattern) {
    var d = this.length - pattern.length;
    return d >= 0 && this.lastIndexOf(pattern) === d;
  },

  empty: function() {
    return this == '';
  },

  blank: function() {
    return /^\s*$/.test(this);
  }
});

if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, {
  escapeHTML: function() {
    return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
  },
  unescapeHTML: function() {
    return this.replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');
  }
});

String.prototype.gsub.prepareReplacement = function(replacement) {
  if (typeof replacement == 'function') return replacement;
  var template = new Template(replacement);
  return function(match) { return template.evaluate(match) };
}

String.prototype.parseQuery = String.prototype.toQueryParams;

Object.extend(String.prototype.escapeHTML, {
  div:  document.createElement('div'),
  text: document.createTextNode('')
});

with (String.prototype.escapeHTML) div.appendChild(text);

var Template = Class.create();
Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
Template.prototype = {
  initialize: function(template, pattern) {
    this.template = template.toString();
    this.pattern  = pattern || Template.Pattern;
  },

  evaluate: function(object) {
    return this.template.gsub(this.pattern, function(match) {
      var before = match[1];
      if (before == '\\') return match[2];
      return before + String.interpret(object[match[3]]);
    });
  }
}

var $break = {}, $continue = new Error('"throw $continue" is deprecated, use "return" instead');

var Enumerable = {
  each: function(iterator) {
    var index = 0;
    try {
      this._each(function(value) {
        iterator(value, index++);
      });
    } catch (e) {
      if (e != $break) throw e;
    }
    return this;
  },

  eachSlice: function(number, iterator) {
    var index = -number, slices = [], array = this.toArray();
    while ((index += number) < array.length)
      slices.push(array.slice(index, index+number));
    return slices.map(iterator);
  },

  all: function(iterator) {
    var result = true;
    this.each(function(value, index) {
      result = result && !!(iterator || Prototype.K)(value, index);
      if (!result) throw $break;
    });
    return result;
  },

  any: function(iterator) {
    var result = false;
    this.each(function(value, index) {
      if (result = !!(iterator || Prototype.K)(value, index))
        throw $break;
    });
    return result;
  },

  collect: function(iterator) {
    var results = [];
    this.each(function(value, index) {
      results.push((iterator || Prototype.K)(value, index));
    });
    return results;
  },

  detect: function(iterator) {
    var result;
    this.each(function(value, index) {
      if (iterator(value, index)) {
        result = value;
        throw $break;
      }
    });
    return result;
  },

  findAll: function(iterator) {
    var results = [];
    this.each(function(value, index) {
      if (iterator(value, index))
        results.push(value);
    });
    return results;
  },

  grep: function(pattern, iterator) {
    var results = [];
    this.each(function(value, index) {
      var stringValue = value.toString();
      if (stringValue.match(pattern))
        results.push((iterator || Prototype.K)(value, index));
    })
    return results;
  },

  include: function(object) {
    var found = false;
    this.each(function(value) {
      if (value == object) {
        found = true;
        throw $break;
      }
    });
    return found;
  },

  inGroupsOf: function(number, fillWith) {
    fillWith = fillWith === undefined ? null : fillWith;
    return this.eachSlice(number, function(slice) {
      while(slice.length < number) slice.push(fillWith);
      return slice;
    });
  },

  inject: function(memo, iterator) {
    this.each(function(value, index) {
      memo = iterator(memo, value, index);
    });
    return memo;
  },

  invoke: function(method) {
    var args = $A(arguments).slice(1);
    return this.map(function(value) {
      return value[method].apply(value, args);
    });
  },

  max: function(iterator) {
    var result;
    this.each(function(value, index) {
      value = (iterator || Prototype.K)(value, index);
      if (result == undefined || value >= result)
        result = value;
    });
    return result;
  },

  min: function(iterator) {
    var result;
    this.each(function(value, index) {
      value = (iterator || Prototype.K)(value, index);
      if (result == undefined || value < result)
        result = value;
    });
    return result;
  },

  partition: function(iterator) {
    var trues = [], falses = [];
    this.each(function(value, index) {
      ((iterator || Prototype.K)(value, index) ?
        trues : falses).push(value);
    });
    return [trues, falses];
  },

  pluck: function(property) {
    var results = [];
    this.each(function(value, index) {
      results.push(value[property]);
    });
    return results;
  },

  reject: function(iterator) {
    var results = [];
    this.each(function(value, index) {
      if (!iterator(value, index))
        results.push(value);
    });
    return results;
  },

  sortBy: function(iterator) {
    return this.map(function(value, index) {
      return {value: value, criteria: iterator(value, index)};
    }).sort(function(left, right) {
      var a = left.criteria, b = right.criteria;
      return a < b ? -1 : a > b ? 1 : 0;
    }).pluck('value');
  },

  toArray: function() {
    return this.map();
  },

  zip: function() {
    var iterator = Prototype.K, args = $A(arguments);
    if (typeof args.last() == 'function')
      iterator = args.pop();

    var collections = [this].concat(args).map($A);
    return this.map(function(value, index) {
      return iterator(collections.pluck(index));
    });
  },

  size: function() {
    return this.toArray().length;
  },

  inspect: function() {
    return '#<Enumerable:' + this.toArray().inspect() + '>';
  }
}

Object.extend(Enumerable, {
  map:     Enumerable.collect,
  find:    Enumerable.detect,
  select:  Enumerable.findAll,
  member:  Enumerable.include,
  entries: Enumerable.toArray
});
var $A = Array.from = function(iterable) {
  if (!iterable) return [];
  if (iterable.toArray) {
    return iterable.toArray();
  } else {
    var results = [];
    for (var i = 0, length = iterable.length; i < length; i++)
      results.push(iterable[i]);
    return results;
  }
}

if (Prototype.Browser.WebKit) {
  $A = Array.from = function(iterable) {
    if (!iterable) return [];
    if (!(typeof iterable == 'function' && iterable == '[object NodeList]') &&
      iterable.toArray) {
      return iterable.toArray();
    } else {
      var results = [];
      for (var i = 0, length = iterable.length; i < length; i++)
        results.push(iterable[i]);
      return results;
    }
  }
}

Object.extend(Array.prototype, Enumerable);

if (!Array.prototype._reverse)
  Array.prototype._reverse = Array.prototype.reverse;

Object.extend(Array.prototype, {
  _each: function(iterator) {
    for (var i = 0, length = this.length; i < length; i++)
      iterator(this[i]);
  },

  clear: function() {
    this.length = 0;
    return this;
  },

  first: function() {
    return this[0];
  },

  last: function() {
    return this[this.length - 1];
  },

  compact: function() {
    return this.select(function(value) {
      return value != null;
    });
  },

  flatten: function() {
    return this.inject([], function(array, value) {
      return array.concat(value && value.constructor == Array ?
        value.flatten() : [value]);
    });
  },

  without: function() {
    var values = $A(arguments);
    return this.select(function(value) {
      return !values.include(value);
    });
  },

  indexOf: function(object) {
    for (var i = 0, length = this.length; i < length; i++)
      if (this[i] == object) return i;
    return -1;
  },

  reverse: function(inline) {
    return (inline !== false ? this : this.toArray())._reverse();
  },

  reduce: function() {
    return this.length > 1 ? this : this[0];
  },

  uniq: function(sorted) {
    return this.inject([], function(array, value, index) {
      if (0 == index || (sorted ? array.last() != value : !array.include(value)))
        array.push(value);
      return array;
    });
  },

  clone: function() {
    return [].concat(this);
  },

  size: function() {
    return this.length;
  },

  inspect: function() {
    return '[' + this.map(Object.inspect).join(', ') + ']';
  },

  toJSON: function() {
    var results = [];
    this.each(function(object) {
      var value = Object.toJSON(object);
      if (value !== undefined) results.push(value);
    });
    return '[' + results.join(', ') + ']';
  }
});

Array.prototype.toArray = Array.prototype.clone;

function $w(string) {
  string = string.strip();
  return string ? string.split(/\s+/) : [];
}

if (Prototype.Browser.Opera){
  Array.prototype.concat = function() {
    var array = [];
    for (var i = 0, length = this.length; i < length; i++) array.push(this[i]);
    for (var i = 0, length = arguments.length; i < length; i++) {
      if (arguments[i].constructor == Array) {
        for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++)
          array.push(arguments[i][j]);
      } else {
        array.push(arguments[i]);
      }
    }
    return array;
  }
}
var Hash = function(object) {
  if (object instanceof Hash) this.merge(object);
  else Object.extend(this, object || {});
};

Object.extend(Hash, {
  toQueryString: function(obj) {
    var parts = [];
    parts.add = arguments.callee.addPair;

    this.prototype._each.call(obj, function(pair) {
      if (!pair.key) return;
      var value = pair.value;

      if (value && typeof value == 'object') {
        if (value.constructor == Array) value.each(function(value) {
          parts.add(pair.key, value);
        });
        return;
      }
      parts.add(pair.key, value);
    });

    return parts.join('&');
  },

  toJSON: function(object) {
    var results = [];
    this.prototype._each.call(object, function(pair) {
      var value = Object.toJSON(pair.value);
      if (value !== undefined) results.push(pair.key.toJSON() + ': ' + value);
    });
    return '{' + results.join(', ') + '}';
  }
});

Hash.toQueryString.addPair = function(key, value, prefix) {
  key = encodeURIComponent(key);
  if (value === undefined) this.push(key);
  else this.push(key + '=' + (value == null ? '' : encodeURIComponent(value)));
}

Object.extend(Hash.prototype, Enumerable);
Object.extend(Hash.prototype, {
  _each: function(iterator) {
    for (var key in this) {
      var value = this[key];
      if (value && value == Hash.prototype[key]) continue;

      var pair = [key, value];
      pair.key = key;
      pair.value = value;
      iterator(pair);
    }
  },

  keys: function() {
    return this.pluck('key');
  },

  values: function() {
    return this.pluck('value');
  },

  merge: function(hash) {
    return $H(hash).inject(this, function(mergedHash, pair) {
      mergedHash[pair.key] = pair.value;
      return mergedHash;
    });
  },

  remove: function() {
    var result;
    for(var i = 0, length = arguments.length; i < length; i++) {
      var value = this[arguments[i]];
      if (value !== undefined){
        if (result === undefined) result = value;
        else {
          if (result.constructor != Array) result = [result];
          result.push(value)
        }
      }
      delete this[arguments[i]];
    }
    return result;
  },

  toQueryString: function() {
    return Hash.toQueryString(this);
  },

  inspect: function() {
    return '#<Hash:{' + this.map(function(pair) {
      return pair.map(Object.inspect).join(': ');
    }).join(', ') + '}>';
  },

  toJSON: function() {
    return Hash.toJSON(this);
  }
});

function $H(object) {
  if (object instanceof Hash) return object;
  return new Hash(object);
};

// Safari iterates over shadowed properties
if (function() {
  var i = 0, Test = function(value) { this.key = value };
  Test.prototype.key = 'foo';
  for (var property in new Test('bar')) i++;
  return i > 1;
}()) Hash.prototype._each = function(iterator) {
  var cache = [];
  for (var key in this) {
    var value = this[key];
    if ((value && value == Hash.prototype[key]) || cache.include(key)) continue;
    cache.push(key);
    var pair = [key, value];
    pair.key = key;
    pair.value = value;
    iterator(pair);
  }
};
ObjectRange = Class.create();
Object.extend(ObjectRange.prototype, Enumerable);
Object.extend(ObjectRange.prototype, {
  initialize: function(start, end, exclusive) {
    this.start = start;
    this.end = end;
    this.exclusive = exclusive;
  },

  _each: function(iterator) {
    var value = this.start;
    while (this.include(value)) {
      iterator(value);
      value = value.succ();
    }
  },

  include: function(value) {
    if (value < this.start)
      return false;
    if (this.exclusive)
      return value < this.end;
    return value <= this.end;
  }
});

var $R = function(start, end, exclusive) {
  return new ObjectRange(start, end, exclusive);
}

var Ajax = {
  getTransport: function() {
    return Try.these(
      function() {return new XMLHttpRequest()},
      function() {return new ActiveXObject('Msxml2.XMLHTTP')},
      function() {return new ActiveXObject('Microsoft.XMLHTTP')}
    ) || false;
  },

  activeRequestCount: 0
}

Ajax.Responders = {
  responders: [],

  _each: function(iterator) {
    this.responders._each(iterator);
  },

  register: function(responder) {
    if (!this.include(responder))
      this.responders.push(responder);
  },

  unregister: function(responder) {
    this.responders = this.responders.without(responder);
  },

  dispatch: function(callback, request, transport, json) {
    this.each(function(responder) {
      if (typeof responder[callback] == 'function') {
        try {
          responder[callback].apply(responder, [request, transport, json]);
        } catch (e) {}
      }
    });
  }
};

Object.extend(Ajax.Responders, Enumerable);

Ajax.Responders.register({
  onCreate: function() {
    Ajax.activeRequestCount++;
  },
  onComplete: function() {
    Ajax.activeRequestCount--;
  }
});

Ajax.Base = function() {};
Ajax.Base.prototype = {
  setOptions: function(options) {
    this.options = {
      method:       'post',
      asynchronous: true,
      contentType:  'application/x-www-form-urlencoded',
      encoding:     'UTF-8',
      parameters:   ''
    }
    Object.extend(this.options, options || {});

    this.options.method = this.options.method.toLowerCase();
    if (typeof this.options.parameters == 'string')
      this.options.parameters = this.options.parameters.toQueryParams();
  }
}

Ajax.Request = Class.create();
Ajax.Request.Events =
  ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];

Ajax.Request.prototype = Object.extend(new Ajax.Base(), {
  _complete: false,

  initialize: function(url, options) {
    this.transport = Ajax.getTransport();
    this.setOptions(options);
    this.request(url);
  },

  request: function(url) {
    this.url = url;
    this.method = this.options.method;
    var params = Object.clone(this.options.parameters);

    if (!['get', 'post'].include(this.method)) {
      // simulate other verbs over post
      params['_method'] = this.method;
      this.method = 'post';
    }

    this.parameters = params;

    if (params = Hash.toQueryString(params)) {
      // when GET, append parameters to URL
      if (this.method == 'get')
        this.url += (this.url.include('?') ? '&' : '?') + params;
      else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent))
        params += '&_=';
    }

    try {
      if (this.options.onCreate) this.options.onCreate(this.transport);
      Ajax.Responders.dispatch('onCreate', this, this.transport);

      this.transport.open(this.method.toUpperCase(), this.url,
        this.options.asynchronous);

      if (this.options.asynchronous)
        setTimeout(function() { this.respondToReadyState(1) }.bind(this), 10);

      this.transport.onreadystatechange = this.onStateChange.bind(this);
      this.setRequestHeaders();

      this.body = this.method == 'post' ? (this.options.postBody || params) : null;
      this.transport.send(this.body);

      /* Force Firefox to handle ready state 4 for synchronous requests */
      if (!this.options.asynchronous && this.transport.overrideMimeType)
        this.onStateChange();

    }
    catch (e) {
      this.dispatchException(e);
    }
  },

  onStateChange: function() {
    var readyState = this.transport.readyState;
    if (readyState > 1 && !((readyState == 4) && this._complete))
      this.respondToReadyState(this.transport.readyState);
  },

  setRequestHeaders: function() {
    var headers = {
      'X-Requested-With': 'XMLHttpRequest',
      'X-Prototype-Version': Prototype.Version,
      'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
    };

    if (this.method == 'post') {
      headers['Content-type'] = this.options.contentType +
        (this.options.encoding ? '; charset=' + this.options.encoding : '');

      /* Force "Connection: close" for older Mozilla browsers to work
       * around a bug where XMLHttpRequest sends an incorrect
       * Content-length header. See Mozilla Bugzilla #246651.
       */
      if (this.transport.overrideMimeType &&
          (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
            headers['Connection'] = 'close';
    }

    // user-defined headers
    if (typeof this.options.requestHeaders == 'object') {
      var extras = this.options.requestHeaders;

      if (typeof extras.push == 'function')
        for (var i = 0, length = extras.length; i < length; i += 2)
          headers[extras[i]] = extras[i+1];
      else
        $H(extras).each(function(pair) { headers[pair.key] = pair.value });
    }

    for (var name in headers)
      this.transport.setRequestHeader(name, headers[name]);
  },

  success: function() {
    return !this.transport.status
        || (this.transport.status >= 200 && this.transport.status < 300);
  },

  respondToReadyState: function(readyState) {
    var state = Ajax.Request.Events[readyState];
    var transport = this.transport, json = this.evalJSON();

    if (state == 'Complete') {
      try {
        this._complete = true;
        (this.options['on' + this.transport.status]
         || this.options['on' + (this.success() ? 'Success' : 'Failure')]
         || Prototype.emptyFunction)(transport, json);
      } catch (e) {
        this.dispatchException(e);
      }

      var contentType = this.getHeader('Content-type');
      if (contentType && contentType.strip().
        match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i))
          this.evalResponse();
    }

    try {
      (this.options['on' + state] || Prototype.emptyFunction)(transport, json);
      Ajax.Responders.dispatch('on' + state, this, transport, json);
    } catch (e) {
      this.dispatchException(e);
    }

    if (state == 'Complete') {
      // avoid memory leak in MSIE: clean up
      this.transport.onreadystatechange = Prototype.emptyFunction;
    }
  },

  getHeader: function(name) {
    try {
      return this.transport.getResponseHeader(name);
    } catch (e) { return null }
  },

  evalJSON: function() {
    try {
      var json = this.getHeader('X-JSON');
      return json ? json.evalJSON() : null;
    } catch (e) { return null }
  },

  evalResponse: function() {
    try {
      return eval((this.transport.responseText || '').unfilterJSON());
    } catch (e) {
      this.dispatchException(e);
    }
  },

  dispatchException: function(exception) {
    (this.options.onException || Prototype.emptyFunction)(this, exception);
    Ajax.Responders.dispatch('onException', this, exception);
  }
});

Ajax.Updater = Class.create();

Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), {
  initialize: function(container, url, options) {
    this.container = {
      success: (container.success || container),
      failure: (container.failure || (container.success ? null : container))
    }

    this.transport = Ajax.getTransport();
    this.setOptions(options);

    var onComplete = this.options.onComplete || Prototype.emptyFunction;
    this.options.onComplete = (function(transport, param) {
      this.updateContent();
      onComplete(transport, param);
    }).bind(this);

    this.request(url);
  },

  updateContent: function() {
    var receiver = this.container[this.success() ? 'success' : 'failure'];
    var response = this.transport.responseText;

    if (!this.options.evalScripts) response = response.stripScripts();

    if (receiver = $(receiver)) {
      if (this.options.insertion)
        new this.options.insertion(receiver, response);
      else
        receiver.update(response);
    }

    if (this.success()) {
      if (this.onComplete)
        setTimeout(this.onComplete.bind(this), 10);
    }
  }
});

Ajax.PeriodicalUpdater = Class.create();
Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), {
  initialize: function(container, url, options) {
    this.setOptions(options);
    this.onComplete = this.options.onComplete;

    this.frequency = (this.options.frequency || 2);
    this.decay = (this.options.decay || 1);

    this.updater = {};
    this.container = container;
    this.url = url;

    this.start();
  },

  start: function() {
    this.options.onComplete = this.updateComplete.bind(this);
    this.onTimerEvent();
  },

  stop: function() {
    this.updater.options.onComplete = undefined;
    clearTimeout(this.timer);
    (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
  },

  updateComplete: function(request) {
    if (this.options.decay) {
      this.decay = (request.responseText == this.lastText ?
        this.decay * this.options.decay : 1);

      this.lastText = request.responseText;
    }
    this.timer = setTimeout(this.onTimerEvent.bind(this),
      this.decay * this.frequency * 1000);
  },

  onTimerEvent: function() {
    this.updater = new Ajax.Updater(this.container, this.url, this.options);
  }
});
function $(element) {
  if (arguments.length > 1) {
    for (var i = 0, elements = [], length = arguments.length; i < length; i++)
      elements.push($(arguments[i]));
    return elements;
  }
  if (typeof element == 'string')
    element = document.getElementById(element);
  return Element.extend(element);
}

if (Prototype.BrowserFeatures.XPath) {
  document._getElementsByXPath = function(expression, parentElement) {
    var results = [];
    var query = document.evaluate(expression, $(parentElement) || document,
      null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
    for (var i = 0, length = query.snapshotLength; i < length; i++)
      results.push(query.snapshotItem(i));
    return results;
  };

  document.getElementsByClassName = function(className, parentElement) {
    var q = ".//*[contains(concat(' ', @class, ' '), ' " + className + " ')]";
    return document._getElementsByXPath(q, parentElement);
  }

} else document.getElementsByClassName = function(className, parentElement) {
  var children = ($(parentElement) || document.body).getElementsByTagName('*');
  var elements = [], child;
  for (var i = 0, length = children.length; i < length; i++) {
    child = children[i];
    if (Element.hasClassName(child, className))
      elements.push(Element.extend(child));
  }
  return elements;
};

/*--------------------------------------------------------------------------*/

if (!window.Element) var Element = {};

Element.extend = function(element) {
  var F = Prototype.BrowserFeatures;
  if (!element || !element.tagName || element.nodeType == 3 ||
   element._extended || F.SpecificElementExtensions || element == window)
    return element;

  var methods = {}, tagName = element.tagName, cache = Element.extend.cache,
   T = Element.Methods.ByTag;

  // extend methods for all tags (Safari doesn't need this)
  if (!F.ElementExtensions) {
    Object.extend(methods, Element.Methods),
    Object.extend(methods, Element.Methods.Simulated);
  }

  // extend methods for specific tags
  if (T[tagName]) Object.extend(methods, T[tagName]);

  for (var property in methods) {
    var value = methods[property];
    if (typeof value == 'function' && !(property in element))
      element[property] = cache.findOrStore(value);
  }

  element._extended = Prototype.emptyFunction;
  return element;
};

Element.extend.cache = {
  findOrStore: function(value) {
    return this[value] = this[value] || function() {
      return value.apply(null, [this].concat($A(arguments)));
    }
  }
};

Element.Methods = {
  visible: function(element) {
    return $(element).style.display != 'none';
  },

  toggle: function(element) {
    element = $(element);
    Element[Element.visible(element) ? 'hide' : 'show'](element);
    return element;
  },

  hide: function(element) {
    $(element).style.display = 'none';
    return element;
  },

  show: function(element) {
    $(element).style.display = '';
    return element;
  },

  remove: function(element) {
    element = $(element);
    element.parentNode.removeChild(element);
    return element;
  },

  update: function(element, html) {
    html = typeof html == 'undefined' ? '' : html.toString();
    $(element).innerHTML = html.stripScripts();
    setTimeout(function() {html.evalScripts()}, 10);
    return element;
  },

  replace: function(element, html) {
    element = $(element);
    html = typeof html == 'undefined' ? '' : html.toString();
    if (element.outerHTML) {
      element.outerHTML = html.stripScripts();
    } else {
      var range = element.ownerDocument.createRange();
      range.selectNodeContents(element);
      element.parentNode.replaceChild(
        range.createContextualFragment(html.stripScripts()), element);
    }
    setTimeout(function() {html.evalScripts()}, 10);
    return element;
  },

  inspect: function(element) {
    element = $(element);
    var result = '<' + element.tagName.toLowerCase();
    $H({'id': 'id', 'className': 'class'}).each(function(pair) {
      var property = pair.first(), attribute = pair.last();
      var value = (element[property] || '').toString();
      if (value) result += ' ' + attribute + '=' + value.inspect(true);
    });
    return result + '>';
  },

  recursivelyCollect: function(element, property) {
    element = $(element);
    var elements = [];
    while (element = element[property])
      if (element.nodeType == 1)
        elements.push(Element.extend(element));
    return elements;
  },

  ancestors: function(element) {
    return $(element).recursivelyCollect('parentNode');
  },

  descendants: function(element) {
    return $A($(element).getElementsByTagName('*')).each(Element.extend);
  },

  firstDescendant: function(element) {
    element = $(element).firstChild;
    while (element && element.nodeType != 1) element = element.nextSibling;
    return $(element);
  },

  immediateDescendants: function(element) {
    if (!(element = $(element).firstChild)) return [];
    while (element && element.nodeType != 1) element = element.nextSibling;
    if (element) return [element].concat($(element).nextSiblings());
    return [];
  },

  previousSiblings: function(element) {
    return $(element).recursivelyCollect('previousSibling');
  },

  nextSiblings: function(element) {
    return $(element).recursivelyCollect('nextSibling');
  },

  siblings: function(element) {
    element = $(element);
    return element.previousSiblings().reverse().concat(element.nextSiblings());
  },

  match: function(element, selector) {
    if (typeof selector == 'string')
      selector = new Selector(selector);
    return selector.match($(element));
  },

  up: function(element, expression, index) {
    element = $(element);
    if (arguments.length == 1) return $(element.parentNode);
    var ancestors = element.ancestors();
    return expression ? Selector.findElement(ancestors, expression, index) :
      ancestors[index || 0];
  },

  down: function(element, expression, index) {
    element = $(element);
    if (arguments.length == 1) return element.firstDescendant();
    var descendants = element.descendants();
    return expression ? Selector.findElement(descendants, expression, index) :
      descendants[index || 0];
  },

  previous: function(element, expression, index) {
    element = $(element);
    if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element));
    var previousSiblings = element.previousSiblings();
    return expression ? Selector.findElement(previousSiblings, expression, index) :
      previousSiblings[index || 0];
  },

  next: function(element, expression, index) {
    element = $(element);
    if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element));
    var nextSiblings = element.nextSiblings();
    return expression ? Selector.findElement(nextSiblings, expression, index) :
      nextSiblings[index || 0];
  },

  getElementsBySelector: function() {
    var args = $A(arguments), element = $(args.shift());
    return Selector.findChildElements(element, args);
  },

  getElementsByClassName: function(element, className) {
    return document.getElementsByClassName(className, element);
  },

  readAttribute: function(element, name) {
    element = $(element);
    if (Prototype.Browser.IE) {
      if (!element.attributes) return null;
      var t = Element._attributeTranslations;
      if (t.values[name]) return t.values[name](element, name);
      if (t.names[name])  name = t.names[name];
      var attribute = element.attributes[name];
      return attribute ? attribute.nodeValue : null;
    }
    return element.getAttribute(name);
  },

  getHeight: function(element) {
    return $(element).getDimensions().height;
  },

  getWidth: function(element) {
    return $(element).getDimensions().width;
  },

  classNames: function(element) {
    return new Element.ClassNames(element);
  },

  hasClassName: function(element, className) {
    if (!(element = $(element))) return;
    var elementClassName = element.className;
    if (elementClassName.length == 0) return false;
    if (elementClassName == className ||
        elementClassName.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))
      return true;
    return false;
  },

  addClassName: function(element, className) {
    if (!(element = $(element))) return;
    Element.classNames(element).add(className);
    return element;
  },

  removeClassName: function(element, className) {
    if (!(element = $(element))) return;
    Element.classNames(element).remove(className);
    return element;
  },

  toggleClassName: function(element, className) {
    if (!(element = $(element))) return;
    Element.classNames(element)[element.hasClassName(className) ? 'remove' : 'add'](className);
    return element;
  },

  observe: function() {
    Event.observe.apply(Event, arguments);
    return $A(arguments).first();
  },

  stopObserving: function() {
    Event.stopObserving.apply(Event, arguments);
    return $A(arguments).first();
  },

  // removes whitespace-only text node children
  cleanWhitespace: function(element) {
    element = $(element);
    var node = element.firstChild;
    while (node) {
      var nextNode = node.nextSibling;
      if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
        element.removeChild(node);
      node = nextNode;
    }
    return element;
  },

  empty: function(element) {
    return $(element).innerHTML.blank();
  },

  descendantOf: function(element, ancestor) {
    element = $(element), ancestor = $(ancestor);
    while (element = element.parentNode)
      if (element == ancestor) return true;
    return false;
  },

  scrollTo: function(element) {
    element = $(element);
    var pos = Position.cumulativeOffset(element);
    window.scrollTo(pos[0], pos[1]);
    return element;
  },

  getStyle: function(element, style) {
    element = $(element);
    style = style == 'float' ? 'cssFloat' : style.camelize();
    var value = element.style[style];
    if (!value) {
      var css = document.defaultView.getComputedStyle(element, null);
      value = css ? css[style] : null;
    }
    if (style == 'opacity') return value ? parseFloat(value) : 1.0;
    return value == 'auto' ? null : value;
  },

  getOpacity: function(element) {
    return $(element).getStyle('opacity');
  },

  setStyle: function(element, styles, camelized) {
    element = $(element);
    var elementStyle = element.style;

    for (var property in styles)
      if (property == 'opacity') element.setOpacity(styles[property])
      else
        elementStyle[(property == 'float' || property == 'cssFloat') ?
          (elementStyle.styleFloat === undefined ? 'cssFloat' : 'styleFloat') :
          (camelized ? property : property.camelize())] = styles[property];

    return element;
  },

  setOpacity: function(element, value) {
    element = $(element);
    element.style.opacity = (value == 1 || value === '') ? '' :
      (value < 0.00001) ? 0 : value;
    return element;
  },

  getDimensions: function(element) {
    element = $(element);
    var display = $(element).getStyle('display');
    if (display != 'none' && display != null) // Safari bug
      return {width: element.offsetWidth, height: element.offsetHeight};

    // All *Width and *Height properties give 0 on elements with display none,
    // so enable the element temporarily
    var els = element.style;
    var originalVisibility = els.visibility;
    var originalPosition = els.position;
    var originalDisplay = els.display;
    els.visibility = 'hidden';
    els.position = 'absolute';
    els.display = 'block';
    var originalWidth = element.clientWidth;
    var originalHeight = element.clientHeight;
    els.display = originalDisplay;
    els.position = originalPosition;
    els.visibility = originalVisibility;
    return {width: originalWidth, height: originalHeight};
  },

  makePositioned: function(element) {
    element = $(element);
    var pos = Element.getStyle(element, 'position');
    if (pos == 'static' || !pos) {
      element._madePositioned = true;
      element.style.position = 'relative';
      // Opera returns the offset relative to the positioning context, when an
      // element is position relative but top and left have not been defined
      if (window.opera) {
        element.style.top = 0;
        element.style.left = 0;
      }
    }
    return element;
  },

  undoPositioned: function(element) {
    element = $(element);
    if (element._madePositioned) {
      element._madePositioned = undefined;
      element.style.position =
        element.style.top =
        element.style.left =
        element.style.bottom =
        element.style.right = '';
    }
    return element;
  },

  makeClipping: function(element) {
    element = $(element);
    if (element._overflow) return element;
    element._overflow = element.style.overflow || 'auto';
    if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden')
      element.style.overflow = 'hidden';
    return element;
  },

  undoClipping: function(element) {
    element = $(element);
    if (!element._overflow) return element;
    element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
    element._overflow = null;
    return element;
  }
};

Object.extend(Element.Methods, {
  childOf: Element.Methods.descendantOf,
  childElements: Element.Methods.immediateDescendants
});

if (Prototype.Browser.Opera) {
  Element.Methods._getStyle = Element.Methods.getStyle;
  Element.Methods.getStyle = function(element, style) {
    switch(style) {
      case 'left':
      case 'top':
      case 'right':
      case 'bottom':
        if (Element._getStyle(element, 'position') == 'static') return null;
      default: return Element._getStyle(element, style);
    }
  };
}
else if (Prototype.Browser.IE) {
  Element.Methods.getStyle = function(element, style) {
    element = $(element);
    style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
    var value = element.style[style];
    if (!value && element.currentStyle) value = element.currentStyle[style];

    if (style == 'opacity') {
      if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
        if (value[1]) return parseFloat(value[1]) / 100;
      return 1.0;
    }

    if (value == 'auto') {
      if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none'))
        return element['offset'+style.capitalize()] + 'px';
      return null;
    }
    return value;
  };

  Element.Methods.setOpacity = function(element, value) {
    element = $(element);
    var filter = element.getStyle('filter'), style = element.style;
    if (value == 1 || value === '') {
      style.filter = filter.replace(/alpha\([^\)]*\)/gi,'');
      return element;
    } else if (value < 0.00001) value = 0;
    style.filter = filter.replace(/alpha\([^\)]*\)/gi, '') +
      'alpha(opacity=' + (value * 100) + ')';
    return element;
  };

  // IE is missing .innerHTML support for TABLE-related elements
  Element.Methods.update = function(element, html) {
    element = $(element);
    html = typeof html == 'undefined' ? '' : html.toString();
    var tagName = element.tagName.toUpperCase();
    if (['THEAD','TBODY','TR','TD'].include(tagName)) {
      var div = document.createElement('div');
      switch (tagName) {
        case 'THEAD':
        case 'TBODY':
          div.innerHTML = '<table><tbody>' +  html.stripScripts() + '</tbody></table>';
          depth = 2;
          break;
        case 'TR':
          div.innerHTML = '<table><tbody><tr>' +  html.stripScripts() + '</tr></tbody></table>';
          depth = 3;
          break;
        case 'TD':
          div.innerHTML = '<table><tbody><tr><td>' +  html.stripScripts() + '</td></tr></tbody></table>';
          depth = 4;
      }
      $A(element.childNodes).each(function(node) { element.removeChild(node) });
      depth.times(function() { div = div.firstChild });
      $A(div.childNodes).each(function(node) { element.appendChild(node) });
    } else {
      element.innerHTML = html.stripScripts();
    }
    setTimeout(function() { html.evalScripts() }, 10);
    return element;
  }
}
else if (Prototype.Browser.Gecko) {
  Element.Methods.setOpacity = function(element, value) {
    element = $(element);
    element.style.opacity = (value == 1) ? 0.999999 :
      (value === '') ? '' : (value < 0.00001) ? 0 : value;
    return element;
  };
}

Element._attributeTranslations = {
  names: {
    colspan:   "colSpan",
    rowspan:   "rowSpan",
    valign:    "vAlign",
    datetime:  "dateTime",
    accesskey: "accessKey",
    tabindex:  "tabIndex",
    enctype:   "encType",
    maxlength: "maxLength",
    readonly:  "readOnly",
    longdesc:  "longDesc"
  },
  values: {
    _getAttr: function(element, attribute) {
      return element.getAttribute(attribute, 2);
    },
    _flag: function(element, attribute) {
      return $(element).hasAttribute(attribute) ? attribute : null;
    },
    style: function(element) {
      return element.style.cssText.toLowerCase();
    },
    title: function(element) {
      var node = element.getAttributeNode('title');
      return node.specified ? node.nodeValue : null;
    }
  }
};

(function() {
  Object.extend(this, {
    href: this._getAttr,
    src:  this._getAttr,
    type: this._getAttr,
    disabled: this._flag,
    checked:  this._flag,
    readonly: this._flag,
    multiple: this._flag
  });
}).call(Element._attributeTranslations.values);

Element.Methods.Simulated = {
  hasAttribute: function(element, attribute) {
    var t = Element._attributeTranslations, node;
    attribute = t.names[attribute] || attribute;
    node = $(element).getAttributeNode(attribute);
    return node && node.specified;
  }
};

Element.Methods.ByTag = {};

Object.extend(Element, Element.Methods);

if (!Prototype.BrowserFeatures.ElementExtensions &&
 document.createElement('div').__proto__) {
  window.HTMLElement = {};
  window.HTMLElement.prototype = document.createElement('div').__proto__;
  Prototype.BrowserFeatures.ElementExtensions = true;
}

Element.hasAttribute = function(element, attribute) {
  if (element.hasAttribute) return element.hasAttribute(attribute);
  return Element.Methods.Simulated.hasAttribute(element, attribute);
};

Element.addMethods = function(methods) {
  var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;

  if (!methods) {
    Object.extend(Form, Form.Methods);
    Object.extend(Form.Element, Form.Element.Methods);
    Object.extend(Element.Methods.ByTag, {
      "FORM":     Object.clone(Form.Methods),
      "INPUT":    Object.clone(Form.Element.Methods),
      "SELECT":   Object.clone(Form.Element.Methods),
      "TEXTAREA": Object.clone(Form.Element.Methods)
    });
  }

  if (arguments.length == 2) {
    var tagName = methods;
    methods = arguments[1];
  }

  if (!tagName) Object.extend(Element.Methods, methods || {});
  else {
    if (tagName.constructor == Array) tagName.each(extend);
    else extend(tagName);
  }

  function extend(tagName) {
    tagName = tagName.toUpperCase();
    if (!Element.Methods.ByTag[tagName])
      Element.Methods.ByTag[tagName] = {};
    Object.extend(Element.Methods.ByTag[tagName], methods);
  }

  function copy(methods, destination, onlyIfAbsent) {
    onlyIfAbsent = onlyIfAbsent || false;
    var cache = Element.extend.cache;
    for (var property in methods) {
      var value = methods[property];
      if (!onlyIfAbsent || !(property in destination))
        destination[property] = cache.findOrStore(value);
    }
  }

  function findDOMClass(tagName) {
    var klass;
    var trans = {
      "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph",
      "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList",
      "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading",
      "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote",
      "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION":
      "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD":
      "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR":
      "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET":
      "FrameSet", "IFRAME": "IFrame"
    };
    if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element';
    if (window[klass]) return window[klass];
    klass = 'HTML' + tagName + 'Element';
    if (window[klass]) return window[klass];
    klass = 'HTML' + tagName.capitalize() + 'Element';
    if (window[klass]) return window[klass];

    window[klass] = {};
    window[klass].prototype = document.createElement(tagName).__proto__;
    return window[klass];
  }

  if (F.ElementExtensions) {
    copy(Element.Methods, HTMLElement.prototype);
    copy(Element.Methods.Simulated, HTMLElement.prototype, true);
  }

  if (F.SpecificElementExtensions) {
    for (var tag in Element.Methods.ByTag) {
      var klass = findDOMClass(tag);
      if (typeof klass == "undefined") continue;
      copy(T[tag], klass.prototype);
    }
  }

  Object.extend(Element, Element.Methods);
  delete Element.ByTag;
};

var Toggle = { display: Element.toggle };

/*--------------------------------------------------------------------------*/

Abstract.Insertion = function(adjacency) {
  this.adjacency = adjacency;
}

Abstract.Insertion.prototype = {
  initialize: function(element, content) {
    this.element = $(element);
    this.content = content.stripScripts();

    if (this.adjacency && this.element.insertAdjacentHTML) {
      try {
        this.element.insertAdjacentHTML(this.adjacency, this.content);
      } catch (e) {
        var tagName = this.element.tagName.toUpperCase();
        if (['TBODY', 'TR'].include(tagName)) {
          this.insertContent(this.contentFromAnonymousTable());
        } else {
          throw e;
        }
      }
    } else {
      this.range = this.element.ownerDocument.createRange();
      if (this.initializeRange) this.initializeRange();
      this.insertContent([this.range.createContextualFragment(this.content)]);
    }

    setTimeout(function() {content.evalScripts()}, 10);
  },

  contentFromAnonymousTable: function() {
    var div = document.createElement('div');
    div.innerHTML = '<table><tbody>' + this.content + '</tbody></table>';
    return $A(div.childNodes[0].childNodes[0].childNodes);
  }
}

var Insertion = new Object();

Insertion.Before = Class.create();
Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), {
  initializeRange: function() {
    this.range.setStartBefore(this.element);
  },

  insertContent: function(fragments) {
    fragments.each((function(fragment) {
      this.element.parentNode.insertBefore(fragment, this.element);
    }).bind(this));
  }
});

Insertion.Top = Class.create();
Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), {
  initializeRange: function() {
    this.range.selectNodeContents(this.element);
    this.range.collapse(true);
  },

  insertContent: function(fragments) {
    fragments.reverse(false).each((function(fragment) {
      this.element.insertBefore(fragment, this.element.firstChild);
    }).bind(this));
  }
});

Insertion.Bottom = Class.create();
Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), {
  initializeRange: function() {
    this.range.selectNodeContents(this.element);
    this.range.collapse(this.element);
  },

  insertContent: function(fragments) {
    fragments.each((function(fragment) {
      this.element.appendChild(fragment);
    }).bind(this));
  }
});

Insertion.After = Class.create();
Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), {
  initializeRange: function() {
    this.range.setStartAfter(this.element);
  },

  insertContent: function(fragments) {
    fragments.each((function(fragment) {
      this.element.parentNode.insertBefore(fragment,
        this.element.nextSibling);
    }).bind(this));
  }
});

/*--------------------------------------------------------------------------*/

Element.ClassNames = Class.create();
Element.ClassNames.prototype = {
  initialize: function(element) {
    this.element = $(element);
  },

  _each: function(iterator) {
    this.element.className.split(/\s+/).select(function(name) {
      return name.length > 0;
    })._each(iterator);
  },

  set: function(className) {
    this.element.className = className;
  },

  add: function(classNameToAdd) {
    if (this.include(classNameToAdd)) return;
    this.set($A(this).concat(classNameToAdd).join(' '));
  },

  remove: function(classNameToRemove) {
    if (!this.include(classNameToRemove)) return;
    this.set($A(this).without(classNameToRemove).join(' '));
  },

  toString: function() {
    return $A(this).join(' ');
  }
};

Object.extend(Element.ClassNames.prototype, Enumerable);
/* Portions of the Selector class are derived from Jack Slocumâ€™s DomQuery,
 * part of YUI-Ext version 0.40, distributed under the terms of an MIT-style
 * license.  Please see http://www.yui-ext.com/ for more information. */

var Selector = Class.create();

Selector.prototype = {
  initialize: function(expression) {
    this.expression = expression.strip();
    this.compileMatcher();
  },

  compileMatcher: function() {
    // Selectors with namespaced attributes can't use the XPath version
    if (Prototype.BrowserFeatures.XPath && !(/\[[\w-]*?:/).test(this.expression))
      return this.compileXPathMatcher();

    var e = this.expression, ps = Selector.patterns, h = Selector.handlers,
        c = Selector.criteria, le, p, m;

    if (Selector._cache[e]) {
      this.matcher = Selector._cache[e]; return;
    }
    this.matcher = ["this.matcher = function(root) {",
                    "var r = root, h = Selector.handlers, c = false, n;"];

    while (e && le != e && (/\S/).test(e)) {
      le = e;
      for (var i in ps) {
        p = ps[i];
        if (m = e.match(p)) {
          this.matcher.push(typeof c[i] == 'function' ? c[i](m) :
    	      new Template(c[i]).evaluate(m));
          e = e.replace(m[0], '');
          break;
        }
      }
    }

    this.matcher.push("return h.unique(n);\n}");
    eval(this.matcher.join('\n'));
    Selector._cache[this.expression] = this.matcher;
  },

  compileXPathMatcher: function() {
    var e = this.expression, ps = Selector.patterns,
        x = Selector.xpath, le,  m;

    if (Selector._cache[e]) {
      this.xpath = Selector._cache[e]; return;
    }

    this.matcher = ['.//*'];
    while (e && le != e && (/\S/).test(e)) {
      le = e;
      for (var i in ps) {
        if (m = e.match(ps[i])) {
          this.matcher.push(typeof x[i] == 'function' ? x[i](m) :
            new Template(x[i]).evaluate(m));
          e = e.replace(m[0], '');
          break;
        }
      }
    }

    this.xpath = this.matcher.join('');
    Selector._cache[this.expression] = this.xpath;
  },

  findElements: function(root) {
    root = root || document;
    if (this.xpath) return document._getElementsByXPath(this.xpath, root);
    return this.matcher(root);
  },

  match: function(element) {
    return this.findElements(document).include(element);
  },

  toString: function() {
    return this.expression;
  },

  inspect: function() {
    return "#<Selector:" + this.expression.inspect() + ">";
  }
};

Object.extend(Selector, {
  _cache: {},

  xpath: {
    descendant:   "//*",
    child:        "/*",
    adjacent:     "/following-sibling::*[1]",
    laterSibling: '/following-sibling::*',
    tagName:      function(m) {
      if (m[1] == '*') return '';
      return "[local-name()='" + m[1].toLowerCase() +
             "' or local-name()='" + m[1].toUpperCase() + "']";
    },
    className:    "[contains(concat(' ', @class, ' '), ' #{1} ')]",
    id:           "[@id='#{1}']",
    attrPresence: "[@#{1}]",
    attr: function(m) {
      m[3] = m[5] || m[6];
      return new Template(Selector.xpath.operators[m[2]]).evaluate(m);
    },
    pseudo: function(m) {
      var h = Selector.xpath.pseudos[m[1]];
      if (!h) return '';
      if (typeof h === 'function') return h(m);
      return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m);
    },
    operators: {
      '=':  "[@#{1}='#{3}']",
      '!=': "[@#{1}!='#{3}']",
      '^=': "[starts-with(@#{1}, '#{3}')]",
      '$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']",
      '*=': "[contains(@#{1}, '#{3}')]",
      '~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",
      '|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]"
    },
    pseudos: {
      'first-child': '[not(preceding-sibling::*)]',
      'last-child':  '[not(following-sibling::*)]',
      'only-child':  '[not(preceding-sibling::* or following-sibling::*)]',
      'empty':       "[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]",
      'checked':     "[@checked]",
      'disabled':    "[@disabled]",
      'enabled':     "[not(@disabled)]",
      'not': function(m) {
        var e = m[6], p = Selector.patterns,
            x = Selector.xpath, le, m, v;

        var exclusion = [];
        while (e && le != e && (/\S/).test(e)) {
          le = e;
          for (var i in p) {
            if (m = e.match(p[i])) {
              v = typeof x[i] == 'function' ? x[i](m) : new Template(x[i]).evaluate(m);
              exclusion.push("(" + v.substring(1, v.length - 1) + ")");
              e = e.replace(m[0], '');
              break;
            }
          }
        }
        return "[not(" + exclusion.join(" and ") + ")]";
      },
      'nth-child':      function(m) {
        return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m);
      },
      'nth-last-child': function(m) {
        return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m);
      },
      'nth-of-type':    function(m) {
        return Selector.xpath.pseudos.nth("position() ", m);
      },
      'nth-last-of-type': function(m) {
        return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m);
      },
      'first-of-type':  function(m) {
        m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m);
      },
      'last-of-type':   function(m) {
        m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m);
      },
      'only-of-type':   function(m) {
        var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m);
      },
      nth: function(fragment, m) {
        var mm, formula = m[6], predicate;
        if (formula == 'even') formula = '2n+0';
        if (formula == 'odd')  formula = '2n+1';
        if (mm = formula.match(/^(\d+)$/)) // digit only
          return '[' + fragment + "= " + mm[1] + ']';
        if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
          if (mm[1] == "-") mm[1] = -1;
          var a = mm[1] ? Number(mm[1]) : 1;
          var b = mm[2] ? Number(mm[2]) : 0;
          predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " +
          "((#{fragment} - #{b}) div #{a} >= 0)]";
          return new Template(predicate).evaluate({
            fragment: fragment, a: a, b: b });
        }
      }
    }
  },

  criteria: {
    tagName:      'n = h.tagName(n, r, "#{1}", c);   c = false;',
    className:    'n = h.className(n, r, "#{1}", c); c = false;',
    id:           'n = h.id(n, r, "#{1}", c);        c = false;',
    attrPresence: 'n = h.attrPresence(n, r, "#{1}"); c = false;',
    attr: function(m) {
      m[3] = (m[5] || m[6]);
      return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}"); c = false;').evaluate(m);
    },
    pseudo:       function(m) {
      if (m[6]) m[6] = m[6].replace(/"/g, '\\"');
      return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);
    },
    descendant:   'c = "descendant";',
    child:        'c = "child";',
    adjacent:     'c = "adjacent";',
    laterSibling: 'c = "laterSibling";'
  },

  patterns: {
    // combinators must be listed first
    // (and descendant needs to be last combinator)
    laterSibling: /^\s*~\s*/,
    child:        /^\s*>\s*/,
    adjacent:     /^\s*\+\s*/,
    descendant:   /^\s/,

    // selectors follow
    tagName:      /^\s*(\*|[\w\-]+)(\b|$)?/,
    id:           /^#([\w\-\*]+)(\b|$)/,
    className:    /^\.([\w\-\*]+)(\b|$)/,
    pseudo:       /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|\s|(?=:))/,
    attrPresence: /^\[([\w]+)\]/,
    attr:         /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\]]*?)\4|([^'"][^\]]*?)))?\]/
  },

  handlers: {
    // UTILITY FUNCTIONS
    // joins two collections
    concat: function(a, b) {
      for (var i = 0, node; node = b[i]; i++)
        a.push(node);
      return a;
    },

    // marks an array of nodes for counting
    mark: function(nodes) {
      for (var i = 0, node; node = nodes[i]; i++)
        node._counted = true;
      return nodes;
    },

    unmark: function(nodes) {
      for (var i = 0, node; node = nodes[i]; i++)
        node._counted = undefined;
      return nodes;
    },

    // mark each child node with its position (for nth calls)
    // "ofType" flag indicates whether we're indexing for nth-of-type
    // rather than nth-child
    index: function(parentNode, reverse, ofType) {
      parentNode._counted = true;
      if (reverse) {
        for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) {
          node = nodes[i];
          if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++;
        }
      } else {
        for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++)
          if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++;
      }
    },

    // filters out duplicates and extends all nodes
    unique: function(nodes) {
      if (nodes.length == 0) return nodes;
      var results = [], n;
      for (var i = 0, l = nodes.length; i < l; i++)
        if (!(n = nodes[i])._counted) {
          n._counted = true;
          results.push(Element.extend(n));
        }
      return Selector.handlers.unmark(results);
    },

    // COMBINATOR FUNCTIONS
    descendant: function(nodes) {
      var h = Selector.handlers;
      for (var i = 0, results = [], node; node = nodes[i]; i++)
        h.concat(results, node.getElementsByTagName('*'));
      return results;
    },

    child: function(nodes) {
      var h = Selector.handlers;
      for (var i = 0, results = [], node; node = nodes[i]; i++) {
        for (var j = 0, children = [], child; child = node.childNodes[j]; j++)
          if (child.nodeType == 1 && child.tagName != '!') results.push(child);
      }
      return results;
    },

    adjacent: function(nodes) {
      for (var i = 0, results = [], node; node = nodes[i]; i++) {
        var next = this.nextElementSibling(node);
        if (next) results.push(next);
      }
      return results;
    },

    laterSibling: function(nodes) {
      var h = Selector.handlers;
      for (var i = 0, results = [], node; node = nodes[i]; i++)
        h.concat(results, Element.nextSiblings(node));
      return results;
    },

    nextElementSibling: function(node) {
      while (node = node.nextSibling)
	      if (node.nodeType == 1) return node;
      return null;
    },

    previousElementSibling: function(node) {
      while (node = node.previousSibling)
        if (node.nodeType == 1) return node;
      return null;
    },

    // TOKEN FUNCTIONS
    tagName: function(nodes, root, tagName, combinator) {
      tagName = tagName.toUpperCase();
      var results = [], h = Selector.handlers;
      if (nodes) {
        if (combinator) {
          // fastlane for ordinary descendant combinators
          if (combinator == "descendant") {
            for (var i = 0, node; node = nodes[i]; i++)
              h.concat(results, node.getElementsByTagName(tagName));
            return results;
          } else nodes = this[combinator](nodes);
          if (tagName == "*") return nodes;
        }
        for (var i = 0, node; node = nodes[i]; i++)
          if (node.tagName.toUpperCase() == tagName) results.push(node);
        return results;
      } else return root.getElementsByTagName(tagName);
    },

    id: function(nodes, root, id, combinator) {
      var targetNode = $(id), h = Selector.handlers;
      if (!nodes && root == document) return targetNode ? [targetNode] : [];
      if (nodes) {
        if (combinator) {
          if (combinator == 'child') {
            for (var i = 0, node; node = nodes[i]; i++)
              if (targetNode.parentNode == node) return [targetNode];
          } else if (combinator == 'descendant') {
            for (var i = 0, node; node = nodes[i]; i++)
              if (Element.descendantOf(targetNode, node)) return [targetNode];
          } else if (combinator == 'adjacent') {
            for (var i = 0, node; node = nodes[i]; i++)
              if (Selector.handlers.previousElementSibling(targetNode) == node)
                return [targetNode];
          } else nodes = h[combinator](nodes);
        }
        for (var i = 0, node; node = nodes[i]; i++)
          if (node == targetNode) return [targetNode];
        return [];
      }
      return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : [];
    },

    className: function(nodes, root, className, combinator) {
      if (nodes && combinator) nodes = this[combinator](nodes);
      return Selector.handlers.byClassName(nodes, root, className);
    },

    byClassName: function(nodes, root, className) {
      if (!nodes) nodes = Selector.handlers.descendant([root]);
      var needle = ' ' + className + ' ';
      for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) {
        nodeClassName = node.className;
        if (nodeClassName.length == 0) continue;
        if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle))
          results.push(node);
      }
      return results;
    },

    attrPresence: function(nodes, root, attr) {
      var results = [];
      for (var i = 0, node; node = nodes[i]; i++)
        if (Element.hasAttribute(node, attr)) results.push(node);
      return results;
    },

    attr: function(nodes, root, attr, value, operator) {
      if (!nodes) nodes = root.getElementsByTagName("*");
      var handler = Selector.operators[operator], results = [];
      for (var i = 0, node; node = nodes[i]; i++) {
        var nodeValue = Element.readAttribute(node, attr);
        if (nodeValue === null) continue;
        if (handler(nodeValue, value)) results.push(node);
      }
      return results;
    },

    pseudo: function(nodes, name, value, root, combinator) {
      if (nodes && combinator) nodes = this[combinator](nodes);
      if (!nodes) nodes = root.getElementsByTagName("*");
      return Selector.pseudos[name](nodes, value, root);
    }
  },

  pseudos: {
    'first-child': function(nodes, value, root) {
      for (var i = 0, results = [], node; node = nodes[i]; i++) {
        if (Selector.handlers.previousElementSibling(node)) continue;
          results.push(node);
      }
      return results;
    },
    'last-child': function(nodes, value, root) {
      for (var i = 0, results = [], node; node = nodes[i]; i++) {
        if (Selector.handlers.nextElementSibling(node)) continue;
          results.push(node);
      }
      return results;
    },
    'only-child': function(nodes, value, root) {
      var h = Selector.handlers;
      for (var i = 0, results = [], node; node = nodes[i]; i++)
        if (!h.previousElementSibling(node) && !h.nextElementSibling(node))
          results.push(node);
      return results;
    },
    'nth-child':        function(nodes, formula, root) {
      return Selector.pseudos.nth(nodes, formula, root);
    },
    'nth-last-child':   function(nodes, formula, root) {
      return Selector.pseudos.nth(nodes, formula, root, true);
    },
    'nth-of-type':      function(nodes, formula, root) {
      return Selector.pseudos.nth(nodes, formula, root, false, true);
    },
    'nth-last-of-type': function(nodes, formula, root) {
      return Selector.pseudos.nth(nodes, formula, root, true, true);
    },
    'first-of-type':    function(nodes, formula, root) {
      return Selector.pseudos.nth(nodes, "1", root, false, true);
    },
    'last-of-type':     function(nodes, formula, root) {
      return Selector.pseudos.nth(nodes, "1", root, true, true);
    },
    'only-of-type':     function(nodes, formula, root) {
      var p = Selector.pseudos;
      return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root);
    },

    // handles the an+b logic
    getIndices: function(a, b, total) {
      if (a == 0) return b > 0 ? [b] : [];
      return $R(1, total).inject([], function(memo, i) {
        if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i);
        return memo;
      });
    },

    // handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type
    nth: function(nodes, formula, root, reverse, ofType) {
      if (nodes.length == 0) return [];
      if (formula == 'even') formula = '2n+0';
      if (formula == 'odd')  formula = '2n+1';
      var h = Selector.handlers, results = [], indexed = [], m;
      h.mark(nodes);
      for (var i = 0, node; node = nodes[i]; i++) {
        if (!node.parentNode._counted) {
          h.index(node.parentNode, reverse, ofType);
          indexed.push(node.parentNode);
        }
      }
      if (formula.match(/^\d+$/)) { // just a number
        formula = Number(formula);
        for (var i = 0, node; node = nodes[i]; i++)
          if (node.nodeIndex == formula) results.push(node);
      } else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
        if (m[1] == "-") m[1] = -1;
        var a = m[1] ? Number(m[1]) : 1;
        var b = m[2] ? Number(m[2]) : 0;
        var indices = Selector.pseudos.getIndices(a, b, nodes.length);
        for (var i = 0, node, l = indices.length; node = nodes[i]; i++) {
          for (var j = 0; j < l; j++)
            if (node.nodeIndex == indices[j]) results.push(node);
        }
      }
      h.unmark(nodes);
      h.unmark(indexed);
      return results;
    },

    'empty': function(nodes, value, root) {
      for (var i = 0, results = [], node; node = nodes[i]; i++) {
        // IE treats comments as element nodes
        if (node.tagName == '!' || (node.firstChild && !node.innerHTML.match(/^\s*$/))) continue;
        results.push(node);
      }
      return results;
    },

    'not': function(nodes, selector, root) {
      var h = Selector.handlers, selectorType, m;
      var exclusions = new Selector(selector).findElements(root);
      h.mark(exclusions);
      for (var i = 0, results = [], node; node = nodes[i]; i++)
        if (!node._counted) results.push(node);
      h.unmark(exclusions);
      return results;
    },

    'enabled': function(nodes, value, root) {
      for (var i = 0, results = [], node; node = nodes[i]; i++)
        if (!node.disabled) results.push(node);
      return results;
    },

    'disabled': function(nodes, value, root) {
      for (var i = 0, results = [], node; node = nodes[i]; i++)
        if (node.disabled) results.push(node);
      return results;
    },

    'checked': function(nodes, value, root) {
      for (var i = 0, results = [], node; node = nodes[i]; i++)
        if (node.checked) results.push(node);
      return results;
    }
  },

  operators: {
    '=':  function(nv, v) { return nv == v; },
    '!=': function(nv, v) { return nv != v; },
    '^=': function(nv, v) { return nv.startsWith(v); },
    '$=': function(nv, v) { return nv.endsWith(v); },
    '*=': function(nv, v) { return nv.include(v); },
    '~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); },
    '|=': function(nv, v) { return ('-' + nv.toUpperCase() + '-').include('-' + v.toUpperCase() + '-'); }
  },

  matchElements: function(elements, expression) {
    var matches = new Selector(expression).findElements(), h = Selector.handlers;
    h.mark(matches);
    for (var i = 0, results = [], element; element = elements[i]; i++)
      if (element._counted) results.push(element);
    h.unmark(matches);
    return results;
  },

  findElement: function(elements, expression, index) {
    if (typeof expression == 'number') {
      index = expression; expression = false;
    }
    return Selector.matchElements(elements, expression || '*')[index || 0];
  },

  findChildElements: function(element, expressions) {
    var exprs = expressions.join(','), expressions = [];
    exprs.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
      expressions.push(m[1].strip());
    });
    var results = [], h = Selector.handlers;
    for (var i = 0, l = expressions.length, selector; i < l; i++) {
      selector = new Selector(expressions[i].strip());
      h.concat(results, selector.findElements(element));
    }
    return (l > 1) ? h.unique(results) : results;
  }
});

function $$() {
  return Selector.findChildElements(document, $A(arguments));
}
var Form = {
  reset: function(form) {
    $(form).reset();
    return form;
  },

  serializeElements: function(elements, getHash) {
    var data = elements.inject({}, function(result, element) {
      if (!element.disabled && element.name) {
        var key = element.name, value = $(element).getValue();
        if (value != null) {
         	if (key in result) {
            if (result[key].constructor != Array) result[key] = [result[key]];
            result[key].push(value);
          }
          else result[key] = value;
        }
      }
      return result;
    });

    return getHash ? data : Hash.toQueryString(data);
  }
};

Form.Methods = {
  serialize: function(form, getHash) {
    return Form.serializeElements(Form.getElements(form), getHash);
  },

  getElements: function(form) {
    return $A($(form).getElementsByTagName('*')).inject([],
      function(elements, child) {
        if (Form.Element.Serializers[child.tagName.toLowerCase()])
          elements.push(Element.extend(child));
        return elements;
      }
    );
  },

  getInputs: function(form, typeName, name) {
    form = $(form);
    var inputs = form.getElementsByTagName('input');

    if (!typeName && !name) return $A(inputs).map(Element.extend);

    for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
      var input = inputs[i];
      if ((typeName && input.type != typeName) || (name && input.name != name))
        continue;
      matchingInputs.push(Element.extend(input));
    }

    return matchingInputs;
  },

  disable: function(form) {
    form = $(form);
    Form.getElements(form).invoke('disable');
    return form;
  },

  enable: function(form) {
    form = $(form);
    Form.getElements(form).invoke('enable');
    return form;
  },

  findFirstElement: function(form) {
    return $(form).getElements().find(function(element) {
      return element.type != 'hidden' && !element.disabled &&
        ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
    });
  },

  focusFirstElement: function(form) {
    form = $(form);
    form.findFirstElement().activate();
    return form;
  },

  request: function(form, options) {
    form = $(form), options = Object.clone(options || {});

    var params = options.parameters;
    options.parameters = form.serialize(true);

    if (params) {
      if (typeof params == 'string') params = params.toQueryParams();
      Object.extend(options.parameters, params);
    }

    if (form.hasAttribute('method') && !options.method)
      options.method = form.method;

    return new Ajax.Request(form.readAttribute('action'), options);
  }
}

/*--------------------------------------------------------------------------*/

Form.Element = {
  focus: function(element) {
    $(element).focus();
    return element;
  },

  select: function(element) {
    $(element).select();
    return element;
  }
}

Form.Element.Methods = {
  serialize: function(element) {
    element = $(element);
    if (!element.disabled && element.name) {
      var value = element.getValue();
      if (value != undefined) {
        var pair = {};
        pair[element.name] = value;
        return Hash.toQueryString(pair);
      }
    }
    return '';
  },

  getValue: function(element) {
    element = $(element);
    var method = element.tagName.toLowerCase();
    return Form.Element.Serializers[method](element);
  },

  clear: function(element) {
    $(element).value = '';
    return element;
  },

  present: function(element) {
    return $(element).value != '';
  },

  activate: function(element) {
    element = $(element);
    try {
      element.focus();
      if (element.select && (element.tagName.toLowerCase() != 'input' ||
        !['button', 'reset', 'submit'].include(element.type)))
        element.select();
    } catch (e) {}
    return element;
  },

  disable: function(element) {
    element = $(element);
    element.blur();
    element.disabled = true;
    return element;
  },

  enable: function(element) {
    element = $(element);
    element.disabled = false;
    return element;
  }
}

/*--------------------------------------------------------------------------*/

var Field = Form.Element;
var $F = Form.Element.Methods.getValue;

/*--------------------------------------------------------------------------*/

Form.Element.Serializers = {
  input: function(element) {
    switch (element.type.toLowerCase()) {
      case 'checkbox':
      case 'radio':
        return Form.Element.Serializers.inputSelector(element);
      default:
        return Form.Element.Serializers.textarea(element);
    }
  },

  inputSelector: function(element) {
    return element.checked ? element.value : null;
  },

  textarea: function(element) {
    return element.value;
  },

  select: function(element) {
    return this[element.type == 'select-one' ?
      'selectOne' : 'selectMany'](element);
  },

  selectOne: function(element) {
    var index = element.selectedIndex;
    return index >= 0 ? this.optionValue(element.options[index]) : null;
  },

  selectMany: function(element) {
    var values, length = element.length;
    if (!length) return null;

    for (var i = 0, values = []; i < length; i++) {
      var opt = element.options[i];
      if (opt.selected) values.push(this.optionValue(opt));
    }
    return values;
  },

  optionValue: function(opt) {
    // extend element because hasAttribute may not be native
    return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
  }
}

/*--------------------------------------------------------------------------*/

Abstract.TimedObserver = function() {}
Abstract.TimedObserver.prototype = {
  initialize: function(element, frequency, callback) {
    this.frequency = frequency;
    this.element   = $(element);
    this.callback  = callback;

    this.lastValue = this.getValue();
    this.registerCallback();
  },

  registerCallback: function() {
    setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
  },

  onTimerEvent: function() {
    var value = this.getValue();
    var changed = ('string' == typeof this.lastValue && 'string' == typeof value
      ? this.lastValue != value : String(this.lastValue) != String(value));
    if (changed) {
      this.callback(this.element, value);
      this.lastValue = value;
    }
  }
}

Form.Element.Observer = Class.create();
Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
  getValue: function() {
    return Form.Element.getValue(this.element);
  }
});

Form.Observer = Class.create();
Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
  getValue: function() {
    return Form.serialize(this.element);
  }
});

/*--------------------------------------------------------------------------*/

Abstract.EventObserver = function() {}
Abstract.EventObserver.prototype = {
  initialize: function(element, callback) {
    this.element  = $(element);
    this.callback = callback;

    this.lastValue = this.getValue();
    if (this.element.tagName.toLowerCase() == 'form')
      this.registerFormCallbacks();
    else
      this.registerCallback(this.element);
  },

  onElementEvent: function() {
    var value = this.getValue();
    if (this.lastValue != value) {
      this.callback(this.element, value);
      this.lastValue = value;
    }
  },

  registerFormCallbacks: function() {
    Form.getElements(this.element).each(this.registerCallback.bind(this));
  },

  registerCallback: function(element) {
    if (element.type) {
      switch (element.type.toLowerCase()) {
        case 'checkbox':
        case 'radio':
          Event.observe(element, 'click', this.onElementEvent.bind(this));
          break;
        default:
          Event.observe(element, 'change', this.onElementEvent.bind(this));
          break;
      }
    }
  }
}

Form.Element.EventObserver = Class.create();
Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
  getValue: function() {
    return Form.Element.getValue(this.element);
  }
});

Form.EventObserver = Class.create();
Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
  getValue: function() {
    return Form.serialize(this.element);
  }
});
if (!window.Event) {
  var Event = new Object();
}

Object.extend(Event, {
  KEY_BACKSPACE: 8,
  KEY_TAB:       9,
  KEY_RETURN:   13,
  KEY_ESC:      27,
  KEY_LEFT:     37,
  KEY_UP:       38,
  KEY_RIGHT:    39,
  KEY_DOWN:     40,
  KEY_DELETE:   46,
  KEY_HOME:     36,
  KEY_END:      35,
  KEY_PAGEUP:   33,
  KEY_PAGEDOWN: 34,

  element: function(event) {
    return $(event.target || event.srcElement);
  },

  isLeftClick: function(event) {
    return (((event.which) && (event.which == 1)) ||
            ((event.button) && (event.button == 1)));
  },

  pointerX: function(event) {
    return event.pageX || (event.clientX +
      (document.documentElement.scrollLeft || document.body.scrollLeft));
  },

  pointerY: function(event) {
    return event.pageY || (event.clientY +
      (document.documentElement.scrollTop || document.body.scrollTop));
  },

  stop: function(event) {
    if (event.preventDefault) {
      event.preventDefault();
      event.stopPropagation();
    } else {
      event.returnValue = false;
      event.cancelBubble = true;
    }
  },

  // find the first node with the given tagName, starting from the
  // node the event was triggered on; traverses the DOM upwards
  findElement: function(event, tagName) {
    var element = Event.element(event);
    while (element.parentNode && (!element.tagName ||
        (element.tagName.toUpperCase() != tagName.toUpperCase())))
      element = element.parentNode;
    return element;
  },

  observers: false,

  _observeAndCache: function(element, name, observer, useCapture) {
    if (!this.observers) this.observers = [];
    if (element.addEventListener) {
      this.observers.push([element, name, observer, useCapture]);
      element.addEventListener(name, observer, useCapture);
    } else if (element.attachEvent) {
      this.observers.push([element, name, observer, useCapture]);
      element.attachEvent('on' + name, observer);
    }
  },

  unloadCache: function() {
    if (!Event.observers) return;
    for (var i = 0, length = Event.observers.length; i < length; i++) {
      Event.stopObserving.apply(this, Event.observers[i]);
      Event.observers[i][0] = null;
    }
    Event.observers = false;
  },

  observe: function(element, name, observer, useCapture) {
    element = $(element);
    useCapture = useCapture || false;

    if (name == 'keypress' &&
      (Prototype.Browser.WebKit || element.attachEvent))
      name = 'keydown';

    Event._observeAndCache(element, name, observer, useCapture);
  },

  stopObserving: function(element, name, observer, useCapture) {
    element = $(element);
    useCapture = useCapture || false;

    if (name == 'keypress' &&
        (Prototype.Browser.WebKit || element.attachEvent))
      name = 'keydown';

    if (element.removeEventListener) {
      element.removeEventListener(name, observer, useCapture);
    } else if (element.detachEvent) {
      try {
        element.detachEvent('on' + name, observer);
      } catch (e) {}
    }
  }
});

/* prevent memory leaks in IE */
if (Prototype.Browser.IE)
  Event.observe(window, 'unload', Event.unloadCache, false);
var Position = {
  // set to true if needed, warning: firefox performance problems
  // NOT neeeded for page scrolling, only if draggable contained in
  // scrollable elements
  includeScrollOffsets: false,

  // must be called before calling withinIncludingScrolloffset, every time the
  // page is scrolled
  prepare: function() {
    this.deltaX =  window.pageXOffset
                || document.documentElement.scrollLeft
                || document.body.scrollLeft
                || 0;
    this.deltaY =  window.pageYOffset
                || document.documentElement.scrollTop
                || document.body.scrollTop
                || 0;
  },

  realOffset: function(element) {
    var valueT = 0, valueL = 0;
    do {
      valueT += element.scrollTop  || 0;
      valueL += element.scrollLeft || 0;
      element = element.parentNode;
    } while (element);
    return [valueL, valueT];
  },

  cumulativeOffset: function(element) {
    var valueT = 0, valueL = 0;
    do {
      valueT += element.offsetTop  || 0;
      valueL += element.offsetLeft || 0;
      element = element.offsetParent;
    } while (element);
    return [valueL, valueT];
  },

  positionedOffset: function(element) {
    var valueT = 0, valueL = 0;
    do {
      valueT += element.offsetTop  || 0;
      valueL += element.offsetLeft || 0;
      element = element.offsetParent;
      if (element) {
        if(element.tagName=='BODY') break;
        var p = Element.getStyle(element, 'position');
        if (p == 'relative' || p == 'absolute') break;
      }
    } while (element);
    return [valueL, valueT];
  },

  offsetParent: function(element) {
    if (element.offsetParent) return element.offsetParent;
    if (element == document.body) return element;

    while ((element = element.parentNode) && element != document.body)
      if (Element.getStyle(element, 'position') != 'static')
        return element;

    return document.body;
  },

  // caches x/y coordinate pair to use with overlap
  within: function(element, x, y) {
    if (this.includeScrollOffsets)
      return this.withinIncludingScrolloffsets(element, x, y);
    this.xcomp = x;
    this.ycomp = y;
    this.offset = this.cumulativeOffset(element);

    return (y >= this.offset[1] &&
            y <  this.offset[1] + element.offsetHeight &&
            x >= this.offset[0] &&
            x <  this.offset[0] + element.offsetWidth);
  },

  withinIncludingScrolloffsets: function(element, x, y) {
    var offsetcache = this.realOffset(element);

    this.xcomp = x + offsetcache[0] - this.deltaX;
    this.ycomp = y + offsetcache[1] - this.deltaY;
    this.offset = this.cumulativeOffset(element);

    return (this.ycomp >= this.offset[1] &&
            this.ycomp <  this.offset[1] + element.offsetHeight &&
            this.xcomp >= this.offset[0] &&
            this.xcomp <  this.offset[0] + element.offsetWidth);
  },

  // within must be called directly before
  overlap: function(mode, element) {
    if (!mode) return 0;
    if (mode == 'vertical')
      return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
        element.offsetHeight;
    if (mode == 'horizontal')
      return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
        element.offsetWidth;
  },

  page: function(forElement) {
    var valueT = 0, valueL = 0;

    var element = forElement;
    do {
      valueT += element.offsetTop  || 0;
      valueL += element.offsetLeft || 0;

      // Safari fix
      if (element.offsetParent == document.body)
        if (Element.getStyle(element,'position')=='absolute') break;

    } while (element = element.offsetParent);

    element = forElement;
    do {
      if (!window.opera || element.tagName=='BODY') {
        valueT -= element.scrollTop  || 0;
        valueL -= element.scrollLeft || 0;
      }
    } while (element = element.parentNode);

    return [valueL, valueT];
  },

  clone: function(source, target) {
    var options = Object.extend({
      setLeft:    true,
      setTop:     true,
      setWidth:   true,
      setHeight:  true,
      offsetTop:  0,
      offsetLeft: 0
    }, arguments[2] || {})

    // find page position of source
    source = $(source);
    var p = Position.page(source);

    // find coordinate system to use
    target = $(target);
    var delta = [0, 0];
    var parent = null;
    // delta [0,0] will do fine with position: fixed elements,
    // position:absolute needs offsetParent deltas
    if (Element.getStyle(target,'position') == 'absolute') {
      parent = Position.offsetParent(target);
      delta = Position.page(parent);
    }

    // correct by body offsets (fixes Safari)
    if (parent == document.body) {
      delta[0] -= document.body.offsetLeft;
      delta[1] -= document.body.offsetTop;
    }

    // set position
    if(options.setLeft)   target.style.left  = (p[0] - delta[0] + options.offsetLeft) + 'px';
    if(options.setTop)    target.style.top   = (p[1] - delta[1] + options.offsetTop) + 'px';
    if(options.setWidth)  target.style.width = source.offsetWidth + 'px';
    if(options.setHeight) target.style.height = source.offsetHeight + 'px';
  },

  absolutize: function(element) {
    element = $(element);
    if (element.style.position == 'absolute') return;
    Position.prepare();

    var offsets = Position.positionedOffset(element);
    var top     = offsets[1];
    var left    = offsets[0];
    var width   = element.clientWidth;
    var height  = element.clientHeight;

    element._originalLeft   = left - parseFloat(element.style.left  || 0);
    element._originalTop    = top  - parseFloat(element.style.top || 0);
    element._originalWidth  = element.style.width;
    element._originalHeight = element.style.height;

    element.style.position = 'absolute';
    element.style.top    = top + 'px';
    element.style.left   = left + 'px';
    element.style.width  = width + 'px';
    element.style.height = height + 'px';
  },

  relativize: function(element) {
    element = $(element);
    if (element.style.position == 'relative') return;
    Position.prepare();

    element.style.position = 'relative';
    var top  = parseFloat(element.style.top  || 0) - (element._originalTop || 0);
    var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);

    element.style.top    = top + 'px';
    element.style.left   = left + 'px';
    element.style.height = element._originalHeight;
    element.style.width  = element._originalWidth;
  }
}

// Safari returns margins on body which is incorrect if the child is absolutely
// positioned.  For performance reasons, redefine Position.cumulativeOffset for
// KHTML/WebKit only.
if (Prototype.Browser.WebKit) {
  Position.cumulativeOffset = function(element) {
    var valueT = 0, valueL = 0;
    do {
      valueT += element.offsetTop  || 0;
      valueL += element.offsetLeft || 0;
      if (element.offsetParent == document.body)
        if (Element.getStyle(element, 'position') == 'absolute') break;

      element = element.offsetParent;
    } while (element);

    return [valueL, valueT];
  }
}

Element.addMethods();

























































































//builder.js
// script.aculo.us builder.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008

// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
//
// script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/

var Builder = {
  NODEMAP: {
    AREA: 'map',
    CAPTION: 'table',
    COL: 'table',
    COLGROUP: 'table',
    LEGEND: 'fieldset',
    OPTGROUP: 'select',
    OPTION: 'select',
    PARAM: 'object',
    TBODY: 'table',
    TD: 'table',
    TFOOT: 'table',
    TH: 'table',
    THEAD: 'table',
    TR: 'table'
  },
  // note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken,
  //       due to a Firefox bug
  node: function(elementName) {
    elementName = elementName.toUpperCase();
    
    // try innerHTML approach
    var parentTag = this.NODEMAP[elementName] || 'div';
    var parentElement = document.createElement(parentTag);
    try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
      parentElement.innerHTML = "<" + elementName + "></" + elementName + ">";
    } catch(e) {}
    var element = parentElement.firstChild || null;
      
    // see if browser added wrapping tags
    if(element && (element.tagName.toUpperCase() != elementName))
      element = element.getElementsByTagName(elementName)[0];
    
    // fallback to createElement approach
    if(!element) element = document.createElement(elementName);
    
    // abort if nothing could be created
    if(!element) return;

    // attributes (or text)
    if(arguments[1])
      if(this._isStringOrNumber(arguments[1]) ||
        (arguments[1] instanceof Array) ||
        arguments[1].tagName) {
          this._children(element, arguments[1]);
        } else {
          var attrs = this._attributes(arguments[1]);
          if(attrs.length) {
            try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
              parentElement.innerHTML = "<" +elementName + " " +
                attrs + "></" + elementName + ">";
            } catch(e) {}
            element = parentElement.firstChild || null;
            // workaround firefox 1.0.X bug
            if(!element) {
              element = document.createElement(elementName);
              for(attr in arguments[1]) 
                element[attr == 'class' ? 'className' : attr] = arguments[1][attr];
            }
            if(element.tagName.toUpperCase() != elementName)
              element = parentElement.getElementsByTagName(elementName)[0];
          }
        } 

    // text, or array of children
    if(arguments[2])
      this._children(element, arguments[2]);

     return element;
  },
  _text: function(text) {
     return document.createTextNode(text);
  },

  ATTR_MAP: {
    'className': 'class',
    'htmlFor': 'for'
  },

  _attributes: function(attributes) {
    var attrs = [];
    for(attribute in attributes)
      attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) +
          '="' + attributes[attribute].toString().escapeHTML().gsub(/"/,'&quot;') + '"');
    return attrs.join(" ");
  },
  _children: function(element, children) {
    if(children.tagName) {
      element.appendChild(children);
      return;
    }
    if(typeof children=='object') { // array can hold nodes and text
      children.flatten().each( function(e) {
        if(typeof e=='object')
          element.appendChild(e)
        else
          if(Builder._isStringOrNumber(e))
            element.appendChild(Builder._text(e));
      });
    } else
      if(Builder._isStringOrNumber(children))
        element.appendChild(Builder._text(children));
  },
  _isStringOrNumber: function(param) {
    return(typeof param=='string' || typeof param=='number');
  },
  build: function(html) {
    var element = this.node('div');
    $(element).update(html.strip());
    return element.down();
  },
  dump: function(scope) { 
    if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope 
  
    var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " +
      "BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " +
      "FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+
      "KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+
      "PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+
      "TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);
  
    tags.each( function(tag){ 
      scope[tag] = function() { 
        return Builder.node.apply(Builder, [tag].concat($A(arguments)));  
      } 
    });
  }
}

































//effects.js

// script.aculo.us effects.js v1.7.1_beta3, Fri May 25 17:19:41 +0200 2007

// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// Contributors:
//  Justin Palmer (http://encytemedia.com/)
//  Mark Pilgrim (http://diveintomark.org/)
//  Martin Bialasinki
// 
// script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/ 

// converts rgb() and #xxx to #xxxxxx format,  
// returns self (or first argument) if not convertable  
String.prototype.parseColor = function() {  
  var color = '#';
  if(this.slice(0,4) == 'rgb(') {  
    var cols = this.slice(4,this.length-1).split(',');  
    var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);  
  } else {  
    if(this.slice(0,1) == '#') {  
      if(this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();  
      if(this.length==7) color = this.toLowerCase();  
    }  
  }  
  return(color.length==7 ? color : (arguments[0] || this));  
}

/*--------------------------------------------------------------------------*/

Element.collectTextNodes = function(element) {  
  return $A($(element).childNodes).collect( function(node) {
    return (node.nodeType==3 ? node.nodeValue : 
      (node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
  }).flatten().join('');
}

Element.collectTextNodesIgnoreClass = function(element, className) {  
  return $A($(element).childNodes).collect( function(node) {
    return (node.nodeType==3 ? node.nodeValue : 
      ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? 
        Element.collectTextNodesIgnoreClass(node, className) : ''));
  }).flatten().join('');
}

Element.setContentZoom = function(element, percent) {
  element = $(element);  
  element.setStyle({fontSize: (percent/100) + 'em'});   
  if(Prototype.Browser.WebKit) window.scrollBy(0,0);
  return element;
}

Element.getInlineOpacity = function(element){
  return $(element).style.opacity || '';
}

Element.forceRerendering = function(element) {
  try {
    element = $(element);
    var n = document.createTextNode(' ');
    element.appendChild(n);
    element.removeChild(n);
  } catch(e) { }
};

/*--------------------------------------------------------------------------*/

Array.prototype.call = function() {
  var args = arguments;
  this.each(function(f){ f.apply(this, args) });
}

/*--------------------------------------------------------------------------*/

var Effect = {
  _elementDoesNotExistError: {
    name: 'ElementDoesNotExistError',
    message: 'The specified DOM element does not exist, but is required for this effect to operate'
  },
  tagifyText: function(element) {
    if(typeof Builder == 'undefined')
      throw("Effect.tagifyText requires including script.aculo.us' builder.js library");
      
    var tagifyStyle = 'position:relative';
    if(Prototype.Browser.IE) tagifyStyle += ';zoom:1';
    
    element = $(element);
    $A(element.childNodes).each( function(child) {
      if(child.nodeType==3) {
        child.nodeValue.toArray().each( function(character) {
          element.insertBefore(
            Builder.node('span',{style: tagifyStyle},
              character == ' ' ? String.fromCharCode(160) : character), 
              child);
        });
        Element.remove(child);
      }
    });
  },
  multiple: function(element, effect) {
    var elements;
    if(((typeof element == 'object') || 
        (typeof element == 'function')) && 
       (element.length))
      elements = element;
    else
      elements = $(element).childNodes;
      
    var options = Object.extend({
      speed: 0.1,
      delay: 0.0
    }, arguments[2] || {});
    var masterDelay = options.delay;

    $A(elements).each( function(element, index) {
      new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
    });
  },
  PAIRS: {
    'slide':  ['SlideDown','SlideUp'],
    'blind':  ['BlindDown','BlindUp'],
    'appear': ['Appear','Fade']
  },
  toggle: function(element, effect) {
    element = $(element);
    effect = (effect || 'appear').toLowerCase();
    var options = Object.extend({
      queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
    }, arguments[2] || {});
    Effect[element.visible() ? 
      Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
  }
};

var Effect2 = Effect; // deprecated

/* ------------- transitions ------------- */

Effect.Transitions = {
  linear: Prototype.K,
  sinoidal: function(pos) {
    return (-Math.cos(pos*Math.PI)/2) + 0.5;
  },
  reverse: function(pos) {
    return 1-pos;
  },
  flicker: function(pos) {
    var pos = ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
    return (pos > 1 ? 1 : pos);
  },
  wobble: function(pos) {
    return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
  },
  pulse: function(pos, pulses) { 
    pulses = pulses || 5; 
    return (
      Math.round((pos % (1/pulses)) * pulses) == 0 ? 
            ((pos * pulses * 2) - Math.floor(pos * pulses * 2)) : 
        1 - ((pos * pulses * 2) - Math.floor(pos * pulses * 2))
      );
  },
  none: function(pos) {
    return 0;
  },
  full: function(pos) {
    return 1;
  }
};

/* ------------- core effects ------------- */

Effect.ScopedQueue = Class.create();
Object.extend(Object.extend(Effect.ScopedQueue.prototype, Enumerable), {
  initialize: function() {
    this.effects  = [];
    this.interval = null;    
  },
  _each: function(iterator) {
    this.effects._each(iterator);
  },
  add: function(effect) {
    var timestamp = new Date().getTime();
    
    var position = (typeof effect.options.queue == 'string') ? 
      effect.options.queue : effect.options.queue.position;
    
    switch(position) {
      case 'front':
        // move unstarted effects after this effect  
        this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
            e.startOn  += effect.finishOn;
            e.finishOn += effect.finishOn;
          });
        break;
      case 'with-last':
        timestamp = this.effects.pluck('startOn').max() || timestamp;
        break;
      case 'end':
        // start effect after last queued effect has finished
        timestamp = this.effects.pluck('finishOn').max() || timestamp;
        break;
    }
    
    effect.startOn  += timestamp;
    effect.finishOn += timestamp;

    if(!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
      this.effects.push(effect);
    
    if(!this.interval)
      this.interval = setInterval(this.loop.bind(this), 15);
  },
  remove: function(effect) {
    this.effects = this.effects.reject(function(e) { return e==effect });
    if(this.effects.length == 0) {
      clearInterval(this.interval);
      this.interval = null;
    }
  },
  loop: function() {
    var timePos = new Date().getTime();
    for(var i=0, len=this.effects.length;i<len;i++) 
      this.effects[i] && this.effects[i].loop(timePos);
  }
});

Effect.Queues = {
  instances: $H(),
  get: function(queueName) {
    if(typeof queueName != 'string') return queueName;
    
    if(!this.instances[queueName])
      this.instances[queueName] = new Effect.ScopedQueue();
      
    return this.instances[queueName];
  }
}
Effect.Queue = Effect.Queues.get('global');

Effect.DefaultOptions = {
  transition: Effect.Transitions.sinoidal,
  duration:   1.0,   // seconds
  fps:        100,   // 100= assume 66fps max.
  sync:       false, // true for combining
  from:       0.0,
  to:         1.0,
  delay:      0.0,
  queue:      'parallel'
}

Effect.Base = function() {};
Effect.Base.prototype = {
  position: null,
  start: function(options) {
    function codeForEvent(options,eventName){
      return (
        (options[eventName+'Internal'] ? 'this.options.'+eventName+'Internal(this);' : '') +
        (options[eventName] ? 'this.options.'+eventName+'(this);' : '')
      );
    }
    if(options.transition === false) options.transition = Effect.Transitions.linear;
    this.options      = Object.extend(Object.extend({},Effect.DefaultOptions), options || {});
    this.currentFrame = 0;
    this.state        = 'idle';
    this.startOn      = this.options.delay*1000;
    this.finishOn     = this.startOn+(this.options.duration*1000);
    this.fromToDelta  = this.options.to-this.options.from;
    this.totalTime    = this.finishOn-this.startOn;
    this.totalFrames  = this.options.fps*this.options.duration;
    
    eval('this.render = function(pos){ '+
      'if(this.state=="idle"){this.state="running";'+
      codeForEvent(options,'beforeSetup')+
      (this.setup ? 'this.setup();':'')+ 
      codeForEvent(options,'afterSetup')+
      '};if(this.state=="running"){'+
      'pos=this.options.transition(pos)*'+this.fromToDelta+'+'+this.options.from+';'+
      'this.position=pos;'+
      codeForEvent(options,'beforeUpdate')+
      (this.update ? 'this.update(pos);':'')+
      codeForEvent(options,'afterUpdate')+
      '}}');
    
    this.event('beforeStart');
    if(!this.options.sync)
      Effect.Queues.get(typeof this.options.queue == 'string' ? 
        'global' : this.options.queue.scope).add(this);
  },
  loop: function(timePos) {
    if(timePos >= this.startOn) {
      if(timePos >= this.finishOn) {
        this.render(1.0);
        this.cancel();
        this.event('beforeFinish');
        if(this.finish) this.finish(); 
        this.event('afterFinish');
        return;  
      }
      var pos   = (timePos - this.startOn) / this.totalTime,
          frame = Math.round(pos * this.totalFrames);
      if(frame > this.currentFrame) {
        this.render(pos);
        this.currentFrame = frame;
      }
    }
  },
  cancel: function() {
    if(!this.options.sync)
      Effect.Queues.get(typeof this.options.queue == 'string' ? 
        'global' : this.options.queue.scope).remove(this);
    this.state = 'finished';
  },
  event: function(eventName) {
    if(this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
    if(this.options[eventName]) this.options[eventName](this);
  },
  inspect: function() {
    var data = $H();
    for(property in this)
      if(typeof this[property] != 'function') data[property] = this[property];
    return '#<Effect:' + data.inspect() + ',options:' + $H(this.options).inspect() + '>';
  }
}

Effect.Parallel = Class.create();
Object.extend(Object.extend(Effect.Parallel.prototype, Effect.Base.prototype), {
  initialize: function(effects) {
    this.effects = effects || [];
    this.start(arguments[1]);
  },
  update: function(position) {
    this.effects.invoke('render', position);
  },
  finish: function(position) {
    this.effects.each( function(effect) {
      effect.render(1.0);
      effect.cancel();
      effect.event('beforeFinish');
      if(effect.finish) effect.finish(position);
      effect.event('afterFinish');
    });
  }
});

Effect.Event = Class.create();
Object.extend(Object.extend(Effect.Event.prototype, Effect.Base.prototype), {
  initialize: function() {
    var options = Object.extend({
      duration: 0
    }, arguments[0] || {});
    this.start(options);
  },
  update: Prototype.emptyFunction
});

Effect.Opacity = Class.create();
Object.extend(Object.extend(Effect.Opacity.prototype, Effect.Base.prototype), {
  initialize: function(element) {
    this.element = $(element);
    if(!this.element) throw(Effect._elementDoesNotExistError);
    // make this work on IE on elements without 'layout'
    if(Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
      this.element.setStyle({zoom: 1});
    var options = Object.extend({
      from: this.element.getOpacity() || 0.0,
      to:   1.0
    }, arguments[1] || {});
    this.start(options);
  },
  update: function(position) {
    this.element.setOpacity(position);
  }
});

Effect.Move = Class.create();
Object.extend(Object.extend(Effect.Move.prototype, Effect.Base.prototype), {
  initialize: function(element) {
    this.element = $(element);
    if(!this.element) throw(Effect._elementDoesNotExistError);
    var options = Object.extend({
      x:    0,
      y:    0,
      mode: 'relative'
    }, arguments[1] || {});
    this.start(options);
  },
  setup: function() {
    // Bug in Opera: Opera returns the "real" position of a static element or
    // relative element that does not have top/left explicitly set.
    // ==> Always set top and left for position relative elements in your stylesheets 
    // (to 0 if you do not need them) 
    this.element.makePositioned();
    this.originalLeft = parseFloat(this.element.getStyle('left') || '0');
    this.originalTop  = parseFloat(this.element.getStyle('top')  || '0');
    if(this.options.mode == 'absolute') {
      // absolute movement, so we need to calc deltaX and deltaY
      this.options.x = this.options.x - this.originalLeft;
      this.options.y = this.options.y - this.originalTop;
    }
  },
  update: function(position) {
    this.element.setStyle({
      left: Math.round(this.options.x  * position + this.originalLeft) + 'px',
      top:  Math.round(this.options.y  * position + this.originalTop)  + 'px'
    });
  }
});

// for backwards compatibility
Effect.MoveBy = function(element, toTop, toLeft) {
  return new Effect.Move(element, 
    Object.extend({ x: toLeft, y: toTop }, arguments[3] || {}));
};

Effect.Scale = Class.create();
Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), {
  initialize: function(element, percent) {
    this.element = $(element);
    if(!this.element) throw(Effect._elementDoesNotExistError);
    var options = Object.extend({
      scaleX: true,
      scaleY: true,
      scaleContent: true,
      scaleFromCenter: false,
      scaleMode: 'box',        // 'box' or 'contents' or {} with provided values
      scaleFrom: 100.0,
      scaleTo:   percent
    }, arguments[2] || {});
    this.start(options);
  },
  setup: function() {
    this.restoreAfterFinish = this.options.restoreAfterFinish || false;
    this.elementPositioning = this.element.getStyle('position');
    
    this.originalStyle = {};
    ['top','left','width','height','fontSize'].each( function(k) {
      this.originalStyle[k] = this.element.style[k];
    }.bind(this));
      
    this.originalTop  = this.element.offsetTop;
    this.originalLeft = this.element.offsetLeft;
    
    var fontSize = this.element.getStyle('font-size') || '100%';
    ['em','px','%','pt'].each( function(fontSizeType) {
      if(fontSize.indexOf(fontSizeType)>0) {
        this.fontSize     = parseFloat(fontSize);
        this.fontSizeType = fontSizeType;
      }
    }.bind(this));
    
    this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
    
    this.dims = null;
    if(this.options.scaleMode=='box')
      this.dims = [this.element.offsetHeight, this.element.offsetWidth];
    if(/^content/.test(this.options.scaleMode))
      this.dims = [this.element.scrollHeight, this.element.scrollWidth];
    if(!this.dims)
      this.dims = [this.options.scaleMode.originalHeight,
                   this.options.scaleMode.originalWidth];
  },
  update: function(position) {
    var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
    if(this.options.scaleContent && this.fontSize)
      this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType });
    this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale);
  },
  finish: function(position) {
    if(this.restoreAfterFinish) this.element.setStyle(this.originalStyle);
  },
  setDimensions: function(height, width) {
    var d = {};
    if(this.options.scaleX) d.width = Math.round(width) + 'px';
    if(this.options.scaleY) d.height = Math.round(height) + 'px';
    if(this.options.scaleFromCenter) {
      var topd  = (height - this.dims[0])/2;
      var leftd = (width  - this.dims[1])/2;
      if(this.elementPositioning == 'absolute') {
        if(this.options.scaleY) d.top = this.originalTop-topd + 'px';
        if(this.options.scaleX) d.left = this.originalLeft-leftd + 'px';
      } else {
        if(this.options.scaleY) d.top = -topd + 'px';
        if(this.options.scaleX) d.left = -leftd + 'px';
      }
    }
    this.element.setStyle(d);
  }
});

Effect.Highlight = Class.create();
Object.extend(Object.extend(Effect.Highlight.prototype, Effect.Base.prototype), {
  initialize: function(element) {
    this.element = $(element);
    if(!this.element) throw(Effect._elementDoesNotExistError);
    var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || {});
    this.start(options);
  },
  setup: function() {
    // Prevent executing on elements not in the layout flow
    if(this.element.getStyle('display')=='none') { this.cancel(); return; }
    // Disable background image during the effect
    this.oldStyle = {};
    if (!this.options.keepBackgroundImage) {
      this.oldStyle.backgroundImage = this.element.getStyle('background-image');
      this.element.setStyle({backgroundImage: 'none'});
    }
    if(!this.options.endcolor)
      this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff');
    if(!this.options.restorecolor)
      this.options.restorecolor = this.element.getStyle('background-color');
    // init color calculations
    this._base  = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this));
    this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this));
  },
  update: function(position) {
    this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){
      return m+(Math.round(this._base[i]+(this._delta[i]*position)).toColorPart()); }.bind(this)) });
  },
  finish: function() {
    this.element.setStyle(Object.extend(this.oldStyle, {
      backgroundColor: this.options.restorecolor
    }));
  }
});

Effect.ScrollTo = Class.create();
Object.extend(Object.extend(Effect.ScrollTo.prototype, Effect.Base.prototype), {
  initialize: function(element) {
    this.element = $(element);
    this.start(arguments[1] || {});
  },
  setup: function() {
    Position.prepare();
    var offsets = Position.cumulativeOffset(this.element);
    if(this.options.offset) offsets[1] += this.options.offset;
    var max = window.innerHeight ? 
      window.height - window.innerHeight :
      document.body.scrollHeight - 
        (document.documentElement.clientHeight ? 
          document.documentElement.clientHeight : document.body.clientHeight);
    this.scrollStart = Position.deltaY;
    this.delta = (offsets[1] > max ? max : offsets[1]) - this.scrollStart;
  },
  update: function(position) {
    Position.prepare();
    window.scrollTo(Position.deltaX, 
      this.scrollStart + (position*this.delta));
  }
});

/* ------------- combination effects ------------- */

Effect.Fade = function(element) {
  element = $(element);
  var oldOpacity = element.getInlineOpacity();
  var options = Object.extend({
  from: element.getOpacity() || 1.0,
  to:   0.0,
  afterFinishInternal: function(effect) { 
    if(effect.options.to!=0) return;
    effect.element.hide().setStyle({opacity: oldOpacity}); 
  }}, arguments[1] || {});
  return new Effect.Opacity(element,options);
}

Effect.Appear = function(element) {
  element = $(element);
  var options = Object.extend({
  from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0),
  to:   1.0,
  // force Safari to render floated elements properly
  afterFinishInternal: function(effect) {
    effect.element.forceRerendering();
  },
  beforeSetup: function(effect) {
    effect.element.setOpacity(effect.options.from).show(); 
  }}, arguments[1] || {});
  return new Effect.Opacity(element,options);
}

Effect.Puff = function(element) {
  element = $(element);
  var oldStyle = { 
    opacity: element.getInlineOpacity(), 
    position: element.getStyle('position'),
    top:  element.style.top,
    left: element.style.left,
    width: element.style.width,
    height: element.style.height
  };
  return new Effect.Parallel(
   [ new Effect.Scale(element, 200, 
      { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), 
     new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], 
     Object.extend({ duration: 1.0, 
      beforeSetupInternal: function(effect) {
        Position.absolutize(effect.effects[0].element)
      },
      afterFinishInternal: function(effect) {
         effect.effects[0].element.hide().setStyle(oldStyle); }
     }, arguments[1] || {})
   );
}

Effect.BlindUp = function(element) {
  element = $(element);
  element.makeClipping();
  return new Effect.Scale(element, 0,
    Object.extend({ scaleContent: false, 
      scaleX: false, 
      restoreAfterFinish: true,
      afterFinishInternal: function(effect) {
        effect.element.hide().undoClipping();
      } 
    }, arguments[1] || {})
  );
}

Effect.BlindDown = function(element) {
  element = $(element);
  var elementDimensions = element.getDimensions();
  return new Effect.Scale(element, 100, Object.extend({ 
    scaleContent: false, 
    scaleX: false,
    scaleFrom: 0,
    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
    restoreAfterFinish: true,
    afterSetup: function(effect) {
      effect.element.makeClipping().setStyle({height: '0px'}).show(); 
    },  
    afterFinishInternal: function(effect) {
      effect.element.undoClipping();
    }
  }, arguments[1] || {}));
}

Effect.SwitchOff = function(element) {
  element = $(element);
  var oldOpacity = element.getInlineOpacity();
  return new Effect.Appear(element, Object.extend({
    duration: 0.4,
    from: 0,
    transition: Effect.Transitions.flicker,
    afterFinishInternal: function(effect) {
      new Effect.Scale(effect.element, 1, { 
        duration: 0.3, scaleFromCenter: true,
        scaleX: false, scaleContent: false, restoreAfterFinish: true,
        beforeSetup: function(effect) { 
          effect.element.makePositioned().makeClipping();
        },
        afterFinishInternal: function(effect) {
          effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity});
        }
      })
    }
  }, arguments[1] || {}));
}

Effect.DropOut = function(element) {
  element = $(element);
  var oldStyle = {
    top: element.getStyle('top'),
    left: element.getStyle('left'),
    opacity: element.getInlineOpacity() };
  return new Effect.Parallel(
    [ new Effect.Move(element, {x: 0, y: 100, sync: true }), 
      new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
    Object.extend(
      { duration: 0.5,
        beforeSetup: function(effect) {
          effect.effects[0].element.makePositioned(); 
        },
        afterFinishInternal: function(effect) {
          effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);
        } 
      }, arguments[1] || {}));
}

Effect.Shake = function(element) {
  element = $(element);
  var oldStyle = {
    top: element.getStyle('top'),
    left: element.getStyle('left') };
    return new Effect.Move(element, 
      { x:  20, y: 0, duration: 0.05, afterFinishInternal: function(effect) {
    new Effect.Move(effect.element,
      { x: -40, y: 0, duration: 0.1,  afterFinishInternal: function(effect) {
    new Effect.Move(effect.element,
      { x:  40, y: 0, duration: 0.1,  afterFinishInternal: function(effect) {
    new Effect.Move(effect.element,
      { x: -40, y: 0, duration: 0.1,  afterFinishInternal: function(effect) {
    new Effect.Move(effect.element,
      { x:  40, y: 0, duration: 0.1,  afterFinishInternal: function(effect) {
    new Effect.Move(effect.element,
      { x: -20, y: 0, duration: 0.05, afterFinishInternal: function(effect) {
        effect.element.undoPositioned().setStyle(oldStyle);
  }}) }}) }}) }}) }}) }});
}

Effect.SlideDown = function(element) {
  element = $(element).cleanWhitespace();
  // SlideDown need to have the content of the element wrapped in a container element with fixed height!
  var oldInnerBottom = element.down().getStyle('bottom');
  var elementDimensions = element.getDimensions();
  return new Effect.Scale(element, 100, Object.extend({ 
    scaleContent: false, 
    scaleX: false, 
    scaleFrom: window.opera ? 0 : 1,
    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
    restoreAfterFinish: true,
    afterSetup: function(effect) {
      effect.element.makePositioned();
      effect.element.down().makePositioned();
      if(window.opera) effect.element.setStyle({top: ''});
      effect.element.makeClipping().setStyle({height: '0px'}).show(); 
    },
    afterUpdateInternal: function(effect) {
      effect.element.down().setStyle({bottom:
        (effect.dims[0] - effect.element.clientHeight) + 'px' }); 
    },
    afterFinishInternal: function(effect) {
      effect.element.undoClipping().undoPositioned();
      effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); }
    }, arguments[1] || {})
  );
}

Effect.SlideUp = function(element) {
  element = $(element).cleanWhitespace();
  var oldInnerBottom = element.down().getStyle('bottom');
  return new Effect.Scale(element, window.opera ? 0 : 1,
   Object.extend({ scaleContent: false, 
    scaleX: false, 
    scaleMode: 'box',
    scaleFrom: 100,
    restoreAfterFinish: true,
    beforeStartInternal: function(effect) {
      effect.element.makePositioned();
      effect.element.down().makePositioned();
      if(window.opera) effect.element.setStyle({top: ''});
      effect.element.makeClipping().show();
    },  
    afterUpdateInternal: function(effect) {
      effect.element.down().setStyle({bottom:
        (effect.dims[0] - effect.element.clientHeight) + 'px' });
    },
    afterFinishInternal: function(effect) {
      effect.element.hide().undoClipping().undoPositioned().setStyle({bottom: oldInnerBottom});
      effect.element.down().undoPositioned();
    }
   }, arguments[1] || {})
  );
}

// Bug in opera makes the TD containing this element expand for a instance after finish 
Effect.Squish = function(element) {
  return new Effect.Scale(element, window.opera ? 1 : 0, { 
    restoreAfterFinish: true,
    beforeSetup: function(effect) {
      effect.element.makeClipping(); 
    },  
    afterFinishInternal: function(effect) {
      effect.element.hide().undoClipping(); 
    }
  });
}

Effect.Grow = function(element) {
  element = $(element);
  var options = Object.extend({
    direction: 'center',
    moveTransition: Effect.Transitions.sinoidal,
    scaleTransition: Effect.Transitions.sinoidal,
    opacityTransition: Effect.Transitions.full
  }, arguments[1] || {});
  var oldStyle = {
    top: element.style.top,
    left: element.style.left,
    height: element.style.height,
    width: element.style.width,
    opacity: element.getInlineOpacity() };

  var dims = element.getDimensions();    
  var initialMoveX, initialMoveY;
  var moveX, moveY;
  
  switch (options.direction) {
    case 'top-left':
      initialMoveX = initialMoveY = moveX = moveY = 0; 
      break;
    case 'top-right':
      initialMoveX = dims.width;
      initialMoveY = moveY = 0;
      moveX = -dims.width;
      break;
    case 'bottom-left':
      initialMoveX = moveX = 0;
      initialMoveY = dims.height;
      moveY = -dims.height;
      break;
    case 'bottom-right':
      initialMoveX = dims.width;
      initialMoveY = dims.height;
      moveX = -dims.width;
      moveY = -dims.height;
      break;
    case 'center':
      initialMoveX = dims.width / 2;
      initialMoveY = dims.height / 2;
      moveX = -dims.width / 2;
      moveY = -dims.height / 2;
      break;
  }
  
  return new Effect.Move(element, {
    x: initialMoveX,
    y: initialMoveY,
    duration: 0.01, 
    beforeSetup: function(effect) {
      effect.element.hide().makeClipping().makePositioned();
    },
    afterFinishInternal: function(effect) {
      new Effect.Parallel(
        [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
          new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
          new Effect.Scale(effect.element, 100, {
            scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, 
            sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
        ], Object.extend({
             beforeSetup: function(effect) {
               effect.effects[0].element.setStyle({height: '0px'}).show(); 
             },
             afterFinishInternal: function(effect) {
               effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle); 
             }
           }, options)
      )
    }
  });
}

Effect.Shrink = function(element) {
  element = $(element);
  var options = Object.extend({
    direction: 'center',
    moveTransition: Effect.Transitions.sinoidal,
    scaleTransition: Effect.Transitions.sinoidal,
    opacityTransition: Effect.Transitions.none
  }, arguments[1] || {});
  var oldStyle = {
    top: element.style.top,
    left: element.style.left,
    height: element.style.height,
    width: element.style.width,
    opacity: element.getInlineOpacity() };

  var dims = element.getDimensions();
  var moveX, moveY;
  
  switch (options.direction) {
    case 'top-left':
      moveX = moveY = 0;
      break;
    case 'top-right':
      moveX = dims.width;
      moveY = 0;
      break;
    case 'bottom-left':
      moveX = 0;
      moveY = dims.height;
      break;
    case 'bottom-right':
      moveX = dims.width;
      moveY = dims.height;
      break;
    case 'center':  
      moveX = dims.width / 2;
      moveY = dims.height / 2;
      break;
  }
  
  return new Effect.Parallel(
    [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
      new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
      new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition })
    ], Object.extend({            
         beforeStartInternal: function(effect) {
           effect.effects[0].element.makePositioned().makeClipping(); 
         },
         afterFinishInternal: function(effect) {
           effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); }
       }, options)
  );
}

Effect.Pulsate = function(element) {
  element = $(element);
  var options    = arguments[1] || {};
  var oldOpacity = element.getInlineOpacity();
  var transition = options.transition || Effect.Transitions.sinoidal;
  var reverser   = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) };
  reverser.bind(transition);
  return new Effect.Opacity(element, 
    Object.extend(Object.extend({  duration: 2.0, from: 0,
      afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
    }, options), {transition: reverser}));
}

Effect.Fold = function(element) {
  element = $(element);
  var oldStyle = {
    top: element.style.top,
    left: element.style.left,
    width: element.style.width,
    height: element.style.height };
  element.makeClipping();
  return new Effect.Scale(element, 5, Object.extend({   
    scaleContent: false,
    scaleX: false,
    afterFinishInternal: function(effect) {
    new Effect.Scale(element, 1, { 
      scaleContent: false, 
      scaleY: false,
      afterFinishInternal: function(effect) {
        effect.element.hide().undoClipping().setStyle(oldStyle);
      } });
  }}, arguments[1] || {}));
};

Effect.Morph = Class.create();
Object.extend(Object.extend(Effect.Morph.prototype, Effect.Base.prototype), {
  initialize: function(element) {
    this.element = $(element);
    if(!this.element) throw(Effect._elementDoesNotExistError);
    var options = Object.extend({
      style: {}
    }, arguments[1] || {});
    if (typeof options.style == 'string') {
      if(options.style.indexOf(':') == -1) {
        var cssText = '', selector = '.' + options.style;
        $A(document.styleSheets).reverse().each(function(styleSheet) {
          if (styleSheet.cssRules) cssRules = styleSheet.cssRules;
          else if (styleSheet.rules) cssRules = styleSheet.rules;
          $A(cssRules).reverse().each(function(rule) {
            if (selector == rule.selectorText) {
              cssText = rule.style.cssText;
              throw $break;
            }
          });
          if (cssText) throw $break;
        });
        this.style = cssText.parseStyle();
        options.afterFinishInternal = function(effect){
          effect.element.addClassName(effect.options.style);
          effect.transforms.each(function(transform) {
            if(transform.style != 'opacity')
              effect.element.style[transform.style] = '';
          });
        }
      } else this.style = options.style.parseStyle();
    } else this.style = $H(options.style)
    this.start(options);
  },
  setup: function(){
    function parseColor(color){
      if(!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
      color = color.parseColor();
      return $R(0,2).map(function(i){
        return parseInt( color.slice(i*2+1,i*2+3), 16 ) 
      });
    }
    this.transforms = this.style.map(function(pair){
      var property = pair[0], value = pair[1], unit = null;

      if(value.parseColor('#zzzzzz') != '#zzzzzz') {
        value = value.parseColor();
        unit  = 'color';
      } else if(property == 'opacity') {
        value = parseFloat(value);
        if(Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
          this.element.setStyle({zoom: 1});
      } else if(Element.CSS_LENGTH.test(value)) {
          var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/);
          value = parseFloat(components[1]);
          unit = (components.length == 3) ? components[2] : null;
      }

      var originalValue = this.element.getStyle(property);
      return { 
        style: property.camelize(), 
        originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0), 
        targetValue: unit=='color' ? parseColor(value) : value,
        unit: unit
      };
    }.bind(this)).reject(function(transform){
      return (
        (transform.originalValue == transform.targetValue) ||
        (
          transform.unit != 'color' &&
          (isNaN(transform.originalValue) || isNaN(transform.targetValue))
        )
      )
    });
  },
  update: function(position) {
    var style = {}, transform, i = this.transforms.length;
    while(i--)
      style[(transform = this.transforms[i]).style] = 
        transform.unit=='color' ? '#'+
          (Math.round(transform.originalValue[0]+
            (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() +
          (Math.round(transform.originalValue[1]+
            (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart() +
          (Math.round(transform.originalValue[2]+
            (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() :
        transform.originalValue + Math.round(
          ((transform.targetValue - transform.originalValue) * position) * 1000)/1000 + transform.unit;
    this.element.setStyle(style, true);
  }
});

Effect.Transform = Class.create();
Object.extend(Effect.Transform.prototype, {
  initialize: function(tracks){
    this.tracks  = [];
    this.options = arguments[1] || {};
    this.addTracks(tracks);
  },
  addTracks: function(tracks){
    tracks.each(function(track){
      var data = $H(track).values().first();
      this.tracks.push($H({
        ids:     $H(track).keys().first(),
        effect:  Effect.Morph,
        options: { style: data }
      }));
    }.bind(this));
    return this;
  },
  play: function(){
    return new Effect.Parallel(
      this.tracks.map(function(track){
        var elements = [$(track.ids) || $$(track.ids)].flatten();
        return elements.map(function(e){ return new track.effect(e, Object.extend({ sync:true }, track.options)) });
      }).flatten(),
      this.options
    );
  }
});

Element.CSS_PROPERTIES = $w(
  'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' + 
  'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' +
  'borderRightColor borderRightStyle borderRightWidth borderSpacing ' +
  'borderTopColor borderTopStyle borderTopWidth bottom clip color ' +
  'fontSize fontWeight height left letterSpacing lineHeight ' +
  'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+
  'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' +
  'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' +
  'right textIndent top width wordSpacing zIndex');
  
Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;

String.prototype.parseStyle = function(){
  var element = document.createElement('div');
  element.innerHTML = '<div style="' + this + '"></div>';
  var style = element.childNodes[0].style, styleRules = $H();
  
  Element.CSS_PROPERTIES.each(function(property){
    if(style[property]) styleRules[property] = style[property]; 
  });
  if(Prototype.Browser.IE && this.indexOf('opacity') > -1) {
    styleRules.opacity = this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1];
  }
  return styleRules;
};

Element.morph = function(element, style) {
  new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || {}));
  return element;
};

['getInlineOpacity','forceRerendering','setContentZoom',
 'collectTextNodes','collectTextNodesIgnoreClass','morph'].each( 
  function(f) { Element.Methods[f] = Element[f]; }
);

Element.Methods.visualEffect = function(element, effect, options) {
  s = effect.dasherize().camelize();
  effect_class = s.charAt(0).toUpperCase() + s.substring(1);
  new Effect[effect_class](element, options);
  return $(element);
};

Element.addMethods();























































//scriptaculous.js
// script.aculo.us scriptaculous.js v1.7.1_beta3, Fri May 25 17:19:41 +0200 2007

// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// 
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
// 
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// For details, see the script.aculo.us web site: http://script.aculo.us/

var Scriptaculous = {
  Version: '1.7.1_beta3',
  require: function(libraryName) {
    // inserting via DOM fails in Safari 2.0, so brute force approach
    document.write('<script type="text/javascript" src="'+libraryName+'"></script>');
  },
  REQUIRED_PROTOTYPE: '1.5.1',
  load: function() {
    function convertVersionString(versionString){
      var r = versionString.split('.');
      return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]);
    }
 
    if((typeof Prototype=='undefined') || 
       (typeof Element == 'undefined') || 
       (typeof Element.Methods=='undefined') ||
       (convertVersionString(Prototype.Version) < 
        convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
       throw("script.aculo.us requires the Prototype JavaScript framework >= " +
        Scriptaculous.REQUIRED_PROTOTYPE);
    
    $A(document.getElementsByTagName("script")).findAll( function(s) {
      return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
    }).each( function(s) {
      var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
      var includes = s.src.match(/\?.*load=([a-z,]*)/);
      (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider,sound').split(',').each(
       function(include) { Scriptaculous.require(path+include+'.js') });
    });
  }
}

Scriptaculous.load();






































//lightbox.js
// -----------------------------------------------------------------------------------
//
//	Lightbox Slideshow v1.1
//	by Justin Barkhuff - http://www.justinbarkhuff.com/lab/lightbox_slideshow/
//  Updated: 2009-04-08
//  Modification by VisualLightBox.com at 30/04/2009
//	* create table structure
//
//  Modification by VisualLightBox.com
//   + Add round corner for image container
//   + Integration of automatic resize from Michael R. Bagnall - elusivemind.net & Sebastien Grosjean - ZenCocoon.com
//   + synchronous changes in the size of Lightbox
// 
//	Largely based on Lightbox v2.02
//	by Lokesh Dhakar - http://huddletogether.com/projects/lightbox2/
//	3/31/06
//
//	Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
//
//	The code inserts html at the bottom of the page that looks similar to this:
//
//	<div id="overlay"></div>
//	<div id="lightbox">
//		<table id="outerImageContainer">
//			<tr><td class="tl"></td><td class="tc"></td><td class="tr"></td></tr>
//			<tr><td class="ml"></td>
//			<td id="lightboxFrameBody">
//				<div id="imageContainer">
//					<img id="lightboxImage" />
//					<div id="hoverNav">
//						<a href="javascript:void(0);" id="prevLinkImg">&laquo; prev</a>
//						<a href="javascript:void(0);" id="nextLinkImg">next &raquo;</a>
//					</div>
//					<div id="loading">
//						<a href="javascript:void(0);" id="loadingLink">loading</a>
//					</div>
//				</div>
//			
//				<div id="imageDataContainer">
//					<div id="imageData">
//						<div id="imageDetails">
//							<span id="caption"></span>
//							<span id="numberDisplay"></span>
//							<span id="detailsNav">
//								<a id="prevLinkDetails" href="javascript:void(0);"></a>
//								<a id="slideShowControl" href="javascript:void(0);"></a>
//								<a id="nextLinkDetails" href="javascript:void(0);"></a>
//							</span>
//						</div>
//						<div id="close">
//							<a id="closeLink" href="javascript:void(0);">close</a>
//						</div>
//					</div>
//				</div>
//			</td>
//			<td class="mr"></td></tr>
//			<tr><td class="bl"></td><td class="bc"></td><td class="br"></td></tr>
//		</table>
//	</div>
//
// -----------------------------------------------------------------------------------

//
//	Lightbox Object
//

var Lightbox = {	
	activeImage : null,
	badObjects : ['select','object','embed'],
	container : null,
	enableSlideshow : null,
	groupName : null,
	imageArray : [],
	options : null,
	overlayDuration : null,
	overlayOpacity : null,
	playSlides : null,
	refTags : ['a','area'],
	relAttribute : null,
	resizeDuration : null,
	slideShowTimer : null,
	startImage : null,
	
	//
	// initialize()
	// Constructor sets class properties and configuration options and
	// inserts html at the bottom of the page which is used to display the shadow 
	// overlay and the image container.
	//
	initialize: function(options) {
		if (!document.getElementsByTagName){ return; }
		
		this.options = $H({
			animate : true, // resizing animations
			autoPlay : true, // should slideshow start automatically
			borderSize : 21, // if you adjust the padding in the CSS, you will need to update this variable
			containerID : document, // lightbox container object
			enableSlideshow : true, // enable slideshow feature
			googleAnalytics : false, // track individual image views using Google Analytics
			imageDataLocation : 'south', // location of image caption information
			initImage : '', // ID of image link to automatically launch when upon script initialization
			loop : true, // whether to continuously loop slideshow images
			overlayDuration : .2, // time to fade in shadow overlay
			overlayOpacity : .4, // transparency of shadow overlay
			prefix : '', // ID prefix for all dynamically created html elements
			relAttribute : 'lightbox', // specifies the rel attribute value that triggers lightbox
			resizeSpeed : 7, // controls the speed of the image resizing (1=slowest and 10=fastest)
			showGroupName : false, // show group name of images in image details
			slideTime : 4, // time to display images during slideshow
			strings : { // allows for localization
				closeLink : '',
				loadingMsg : 'loading',
				nextLink : '',
				prevLink : '',
				startSlideshow : '',
				stopSlideshow : '',
				numDisplayPrefix : '',
				numDisplaySeparator : '/'
			},
		    featBrowser: true,     // set it to true or false to choose to auto-adjust the maximum size to the browser
			breathingSize: 50     // control the minimum space around the image box
        }).merge(options);
		
		if(this.options.animate){
			this.overlayDuration = Math.max(this.options.overlayDuration,0);
			this.options.resizeSpeed = Math.max(Math.min(this.options.resizeSpeed,10),1);
			this.resizeDuration = (11 - this.options.resizeSpeed) * 0.15;
		}else{
			this.overlayDuration = 0;
			this.resizeDuration = 0;
		}
		
		this.enableSlideshow = this.options.enableSlideshow;
		this.overlayOpacity = Math.max(Math.min(this.options.overlayOpacity,1),0);
		this.playSlides = this.options.autoPlay;
		this.container = $(this.options.containerID);
		this.relAttribute = this.options.relAttribute;
		this.updateImageList();
		
		var objBody = this.container != document ? this.container : document.getElementsByTagName('body').item(0);
		
		var objOverlay = document.createElement('div');
		objOverlay.setAttribute('id',this.getID('overlay'));
		objOverlay.style.display = 'none';
		objBody.appendChild(objOverlay);
		Event.observe(objOverlay,'click',this.end.bindAsEventListener(this));
		
		var objLightbox = document.createElement('div');
		objLightbox.setAttribute('id',this.getID('lightbox'));
		objLightbox.style.display = 'none';
		objBody.appendChild(objLightbox);
		
		var objImageDataContainer = document.createElement('div');
		objImageDataContainer.setAttribute('id',this.getID('imageDataContainer'));
		objImageDataContainer.className = this.getID('clearfix');

		var objImageData = document.createElement('div');
		objImageData.setAttribute('id',this.getID('imageData'));
		objImageDataContainer.appendChild(objImageData);
	
		var objImageDetails = document.createElement('div');
		objImageDetails.setAttribute('id',this.getID('imageDetails'));
		objImageData.appendChild(objImageDetails);
	
		var objCaption = document.createElement('span');
		objCaption.setAttribute('id',this.getID('caption'));
		objImageDetails.appendChild(objCaption);
	
		var objNumberDisplay = document.createElement('span');
		objNumberDisplay.setAttribute('id',this.getID('numberDisplay'));
		objImageDetails.appendChild(objNumberDisplay);

		var objDetailsNav = document.createElement('span');
		objDetailsNav.setAttribute('id',this.getID('detailsNav'));
		objImageDetails.appendChild(objDetailsNav);

		var objPrevLink = document.createElement('a');
		objPrevLink.setAttribute('id',this.getID('prevLinkDetails'));
		objPrevLink.setAttribute('href','javascript:void(0);');
		objPrevLink.innerHTML = this.options.strings.prevLink;
		objDetailsNav.appendChild(objPrevLink);
		Event.observe(objPrevLink,'click',this.showPrev.bindAsEventListener(this));
		

		var objSlideShowControl = document.createElement('a');
		objSlideShowControl.setAttribute('id',this.getID('slideShowControl'));
		objSlideShowControl.setAttribute('href','javascript:void(0);');
		objDetailsNav.appendChild(objSlideShowControl);
		Event.observe(objSlideShowControl,'click',this.toggleSlideShow.bindAsEventListener(this));
		
		
		var objNextLink = document.createElement('a');
		objNextLink.setAttribute('id',this.getID('nextLinkDetails'));
		objNextLink.setAttribute('href','javascript:void(0);');
		objNextLink.innerHTML = this.options.strings.nextLink;
		objDetailsNav.appendChild(objNextLink);
		Event.observe(objNextLink,'click',this.showNext.bindAsEventListener(this));

		var objClose = document.createElement('div');
		objClose.setAttribute('id',this.getID('close'));
		objImageData.appendChild(objClose);
	
		var objCloseLink = document.createElement('a');
		objCloseLink.setAttribute('id',this.getID('closeLink'));
		objCloseLink.setAttribute('href','javascript:void(0);');
		objCloseLink.innerHTML = this.options.strings.closeLink;
		objClose.appendChild(objCloseLink);	
		Event.observe(objCloseLink,'click',this.end.bindAsEventListener(this));
	
		var objOuterImageContainer = document.createElement('table');
		objOuterImageContainer.setAttribute('id',this.getID('outerImageContainer'));
		objOuterImageContainer.cellSpacing = 0;
		objLightbox.appendChild(objOuterImageContainer);
		
		// create content cells
		var objOICTop = objOuterImageContainer.insertRow(-1);
		var objOICTL =  objOICTop.insertCell(-1);
		objOICTL.className = 'tl';
		var objOICTC =  objOICTop.insertCell(-1);
		objOICTC.className = 'tc';
		var objOICTR =  objOICTop.insertCell(-1);
		objOICTR.className = 'tr';
		var objOICMiddle = objOuterImageContainer.insertRow(-1);
		var objOICML =  objOICMiddle.insertCell(-1);
		objOICML.className = 'ml';
		
		// middle center 
		var objLightboxFrameBody =  objOICMiddle.insertCell(-1);
		objLightboxFrameBody.setAttribute('id',this.getID('lightboxFrameBody'));
		objLightboxFrameBody.innerHTML='&nbsp;';
		
		var objOICMR =  objOICMiddle.insertCell(-1);
		objOICMR.className = 'mr';
		var objOICBottom = objOuterImageContainer.insertRow(-1);
		var objOICBL =  objOICBottom.insertCell(-1);
		objOICBL.className = 'bl';
		var objOICBC =  objOICBottom.insertCell(-1);
		objOICBC.className = 'bc';
		var objOICBR =  objOICBottom.insertCell(-1);
		objOICBR.className = 'br';
		

		if(this.options.imageDataLocation == 'north'){
			objLightboxFrameBody.appendChild(objImageDataContainer);
		}

		var objImageContainer = document.createElement('div');
		objImageContainer.setAttribute('id',this.getID('imageContainer'));
		objLightboxFrameBody.appendChild(objImageContainer);
	
		var objLightboxImage = document.createElement('img');
		objLightboxImage.setAttribute('id',this.getID('lightboxImage'));
		objImageContainer.appendChild(objLightboxImage);
	
		var objHoverNav = document.createElement('div');
		objHoverNav.setAttribute('id',this.getID('hoverNav'));
		objImageContainer.appendChild(objHoverNav);
	
		var objPrevLinkImg = document.createElement('a');
		objPrevLinkImg.setAttribute('id',this.getID('prevLinkImg'));
		objPrevLinkImg.setAttribute('href','javascript:void(0);');
		objHoverNav.appendChild(objPrevLinkImg);
		Event.observe(objPrevLinkImg,'click',this.showPrev.bindAsEventListener(this));
		
		var objNextLinkImg = document.createElement('a');
		objNextLinkImg.setAttribute('id',this.getID('nextLinkImg'));
		objNextLinkImg.setAttribute('href','javascript:void(0);');
		objHoverNav.appendChild(objNextLinkImg);
		Event.observe(objNextLinkImg,'click',this.showNext.bindAsEventListener(this));
	
		var objLoading = document.createElement('div');
		objLoading.setAttribute('id',this.getID('loading'));
		objImageContainer.appendChild(objLoading);
	
		var objLoadingLink = document.createElement('a');
		objLoadingLink.setAttribute('id',this.getID('loadingLink'));
		objLoadingLink.setAttribute('href','javascript:void(0);');
		objLoadingLink.innerHTML = this.options.strings.loadingMsg;
		objLoading.appendChild(objLoadingLink);
		Event.observe(objLoadingLink,'click',this.end.bindAsEventListener(this));
		
		if(this.options.imageDataLocation != 'north'){
			objLightboxFrameBody.appendChild(objImageDataContainer);
		}
		


		if(this.options.initImage != ''){
			this.start($(this.options.initImage));
		}
	},
	
	//
	//	updateImageList()
	//	Loops through specific tags within 'container' looking for 
	// 'lightbox' references and applies onclick events to them.
	//
	updateImageList: function(){
		var el, els, rel;
		for(var i=0; i < this.refTags.length; i++){
			els = this.container.getElementsByTagName(this.refTags[i]);
			for(var j=0; j < els.length; j++){
				el = els[j];
				rel = String(el.getAttribute('rel'));
				if (el.getAttribute('href') && (rel.toLowerCase().match(this.relAttribute))){
					el.onclick = function(){Lightbox.start(this); return false;}
				}
			}
		}
	},
		
	//
	//	start()
	//	Display overlay and lightbox. If image is part of a set, add siblings to imageArray.
	//
	start: function(imageLink) {	

		this.hideBadObjects();

		// stretch overlay to fill page and fade in
		var pageSize = this.getPageSize();
		$(this.getID('overlay')).setStyle({height:pageSize.pageHeight+'px'});
		new Effect.Appear(this.getID('overlay'), { duration: this.overlayDuration, from: 0, to: this.overlayOpacity });

		this.imageArray = [];
		this.groupName = null;
		
		var rel = imageLink.getAttribute('rel');
		var imageTitle = '';
		
		// if image is NOT part of a group..
		if(rel == this.relAttribute){
			// add single image to imageArray
			imageTitle = imageLink.getAttribute('title') ? imageLink.getAttribute('title') : '';
			this.imageArray.push({'link':imageLink.getAttribute('href'), 'title':imageTitle});			
			this.startImage = 0;
		} else {
			// if image is part of a group..
			var els = this.container.getElementsByTagName(imageLink.tagName);
			// loop through anchors, find other images in group, and add them to imageArray
			for (var i=0; i<els.length; i++){
				var el = els[i];
				if (el.getAttribute('href') && (el.getAttribute('rel') == rel)){
					imageTitle = el.getAttribute('title') ? el.getAttribute('title') : '';
					this.imageArray.push({'link':el.getAttribute('href'),'title':imageTitle});
					if(el == imageLink){
						this.startImage = this.imageArray.length-1;
					}
				}
			}
			// get group name
			this.groupName = rel.substring(this.relAttribute.length+1,rel.length-1);
		}

		// calculate top offset for the lightbox and display 
		var pageScroll = this.getPageScroll();
		var lightboxTop = pageScroll.y + (pageSize.winHeight / 15);

		$(this.getID('lightbox')).setStyle({top:lightboxTop+'px'}).show();
        if (Lightbox.options.featBrowser) 
			Event.observe(window, 'resize', (function(e) {this.adjustImageSize(true); }).bind(this));
		this.changeImage(this.startImage);
	},

	//
	//	changeImage()
	//	Hide most elements and preload image in preparation for resizing image container.
	//
	changeImage: function(imageNum){	
		this.activeImage = imageNum;

		this.disableKeyboardNav();
		this.pauseSlideShow();

		// hide elements during transition
		$(this.getID('loading')).show();
		$(this.getID('lightboxImage')).hide();
		$(this.getID('hoverNav')).hide();
		$(this.getID('imageDataContainer')).hide();
		$(this.getID('numberDisplay')).hide();
		$(this.getID('detailsNav')).hide();
		
		var imgPreloader = new Image();
		
		// once image is preloaded, resize image container
		imgPreloader.onload=function(){
			$(Lightbox.getID('lightboxImage')).src = imgPreloader.src;
			
            Lightbox.imageArray[Lightbox.activeImage].width = imgPreloader.width;
            Lightbox.imageArray[Lightbox.activeImage].height = imgPreloader.height;
            Lightbox.adjustImageSize(false);
		}
		imgPreloader.src = this.imageArray[this.activeImage].link;
		
		if(this.options.googleAnalytics){
			urchinTracker(this.imageArray[this.activeImage].link);
		}
	},

	//
    //  adjustImageSize()
    //  adjust image size if option featBrowser is set to true
    //
    adjustImageSize: function( recall ) {
        // get image size
        imgWidth = this.imageArray[this.activeImage].width;
        imgHeight = this.imageArray[this.activeImage].height;
        var arrayPageSize = this.getPageSize(); // {pageWidth:pageX,pageHeight:pageY,winWidth:windowX,winHeight:windowY};
        // adjust image size if featBrowser option is set to true
        if (Lightbox.options.featBrowser == true) {
          // calculate proportions 
          var imageProportion = imgWidth / imgHeight;
          var winProportion = arrayPageSize.winWidth / arrayPageSize.winHeight;

          if (imageProportion > winProportion) {
            // calculate max width base on page width
            var maxWidth = arrayPageSize.winWidth - (Lightbox.options.borderSize * 2) - (Lightbox.options.breathingSize * 2);
            var maxHeight = Math.round(maxWidth / imageProportion);
          } else {
            // calculate maw height base on page height
            var maxHeight = arrayPageSize.winHeight - (Lightbox.options.borderSize * 2) - (arrayPageSize.winHeight / 15) - Lightbox.options.breathingSize;
            var maxWidth = Math.round(maxHeight * imageProportion);
          }
          if (imgWidth > maxWidth || imgHeight > maxHeight) {
            imgWidth = maxWidth;
            imgHeight = maxHeight;
          }
        }
		
		$(this.getID('overlay')).setStyle({height: arrayPageSize.pageHeight + 'px' });
        $(this.getID('lightboxImage')).setStyle({ height: imgHeight + 'px', width: imgWidth + 'px'});

        if (recall == true) {
          $(this.getID('outerImageContainer')).setStyle({height: (imgHeight + (Lightbox.options.borderSize * 2)) + 'px', width: (imgWidth + (Lightbox.options.borderSize * 2)) + 'px'});
//          $(this.getID('imageDataContainer')).setStyle({ width: (imgWidth + (Lightbox.options.borderSize * 2)) + 'px' });
        } else {
          this.resizeImageContainer(imgWidth, imgHeight);
        }
    },

    //
	//	resizeImageContainer()
	//
	resizeImageContainer: function(imgWidth,imgHeight) {
		// get current height and width
		var cDims = $(this.getID('outerImageContainer')).getDimensions();

		// scalars based on change from old to new
		var xScale = ((imgWidth  + (this.options.borderSize * 2)) / cDims.width) * 100;
		var yScale = ((imgHeight  + (this.options.borderSize * 2)) / cDims.height) * 100;

		// calculate size difference between new and old image, and resize if necessary
		var wDiff = (cDims.width - this.options.borderSize * 2) - imgWidth;
		var hDiff = (cDims.height - this.options.borderSize * 2) - imgHeight;

	
		var effectScale = [];
		if (!( hDiff == 0)) effectScale[effectScale.length] = new Effect.Scale(this.getID('outerImageContainer'), yScale, {scaleX: false, sync: true });
		if (!( wDiff == 0)) effectScale[effectScale.length] = new Effect.Scale(this.getID('outerImageContainer'), xScale, {scaleY: false, sync: true });
		if (effectScale.length)	new Effect.Parallel(effectScale,{delay: this.resizeDuration, duration: this.resizeDuration});
		

		// if new and old image are same size and no scaling transition is necessary, 
		// do a quick pause to prevent image flicker.
		if((hDiff == 0) && (wDiff == 0)){
			if(navigator.appVersion.indexOf('MSIE')!=-1){ this.pause(250); } else { this.pause(100);} 
		}

		$(this.getID('prevLinkImg')).setStyle({height:imgHeight+'px'});
		$(this.getID('nextLinkImg')).setStyle({height:imgHeight+'px'});
		$(this.getID('imageDataContainer')).setStyle({width:(imgWidth/*+(this.options.borderSize * 2)*/)+'px'});

		this.showImage();
	},
	
	//
	//	showImage()
	//	Display image and begin preloading neighbors.
	//
	showImage: function(){
		$(this.getID('loading')).hide();
		new Effect.Appear(this.getID('lightboxImage'), { duration: 0.5, queue: 'end', afterFinish: function(){	Lightbox.updateDetails(); } });
		this.preloadNeighborImages();
	},

	//
	//	updateDetails()
	//	Display caption, image number, and bottom nav.
	//
	updateDetails: function() {
		$(this.getID('caption')).show();
		$(this.getID('caption')).update(this.imageArray[this.activeImage].title);
		
		// if image is part of set display 'Image x of y' 
		if(this.imageArray.length > 1){
			var num_display = this.options.strings.numDisplayPrefix + ' ' + eval(this.activeImage + 1) + ' ' + this.options.strings.numDisplaySeparator + ' ' + this.imageArray.length;
			if(this.options.showGroupName && this.groupName != ''){
				num_display += ' '+this.options.strings.numDisplaySeparator+' '+this.groupName;
			}
			$(this.getID('numberDisplay')).update(num_display).show();
			if(!this.enableSlideshow){
				$(this.getID('slideShowControl')).hide();
			}
			$(this.getID('detailsNav')).show();
		}
		
		new Effect.Parallel(
			[ new Effect.SlideDown( this.getID('imageDataContainer'), { sync: true }), 
			  new Effect.Appear(this.getID('imageDataContainer'), { sync: true }) ], 
			{ duration:.65, afterFinish: function() { Lightbox.updateNav();} }
		);
	},
	
	//
	//	updateNav()
	//	Display appropriate previous and next hover navigation.
	//
	updateNav: function() {
		// restore imageDataContainer size for avtomaticaly change with its contaner
		$(this.getID('imageDataContainer')).setStyle({width:'100%'});
		
		if(this.imageArray.length > 1){
			$(this.getID('hoverNav')).show();
			if(this.enableSlideshow){
				if(this.playSlides){
					this.startSlideShow();
				} else {
					this.stopSlideShow();
				}
			}
		}
		this.enableKeyboardNav();
	},
	//
	//	startSlideShow()
	//	Starts the slide show
	//
	startSlideShow: function(){
		this.playSlides = true;
		this.slideShowTimer = new PeriodicalExecuter(function(pe){ Lightbox.showNext(); pe.stop(); },this.options.slideTime);
		$(this.getID('slideShowControl')).update(this.options.strings.stopSlideshow);
		$(this.getID('slideShowControl')).addClassName('started');
	},
	
	//
	//	stopSlideShow()
	//	Stops the slide show
	//
	stopSlideShow: function(){
		this.playSlides = false;
		if(this.slideShowTimer){
			this.slideShowTimer.stop();
		}
		$(this.getID('slideShowControl')).update(this.options.strings.startSlideshow);
		$(this.getID('slideShowControl')).removeClassName('started');
	},

	//
	//	stopSlideShow()
	//	Stops the slide show
	//
	toggleSlideShow: function(){
		if(this.playSlides){
			this.stopSlideShow();
		}else{
			this.startSlideShow();
		}
	},

	//
	//	pauseSlideShow()
	//	Pauses the slide show (doesn't change the value of this.playSlides)
	//
	pauseSlideShow: function(){
		if(this.slideShowTimer){
			this.slideShowTimer.stop();
		}
	},
	
	//
	//	showNext()
	//	Display the next image in a group
	//
	showNext : function(){
		if(this.imageArray.length > 1){
			if(!this.options.loop && ((this.activeImage == this.imageArray.length - 1 && this.startImage == 0) || (this.activeImage+1 == this.startImage))){
				return this.end();
			}
			if(this.activeImage == this.imageArray.length - 1){
				this.changeImage(0);
			}else{
				this.changeImage(this.activeImage+1);
			}
		}
	},

	//
	//	showPrev()
	//	Display the next image in a group
	//
	showPrev : function(){
		if(this.imageArray.length > 1){
			if(this.activeImage == 0){
				this.changeImage(this.imageArray.length - 1);
			}else{
				this.changeImage(this.activeImage-1);
			}
		}
	},
	
	//
	//	showFirst()
	//	Display the first image in a group
	//
	showFirst : function(){
		if(this.imageArray.length > 1){
			this.changeImage(0);
		}
	},

	//
	//	showFirst()
	//	Display the first image in a group
	//
	showLast : function(){
		if(this.imageArray.length > 1){
			this.changeImage(this.imageArray.length - 1);
		}
	},

	//
	//	enableKeyboardNav()
	//
	enableKeyboardNav: function() {
		document.onkeydown = this.keyboardAction; 
	},

	//
	//	disableKeyboardNav()
	//
	disableKeyboardNav: function() {
		document.onkeydown = '';
	},

	//
	//	keyboardAction()
	//
	keyboardAction: function(e) {
		if (e == null) { // ie
			keycode = event.keyCode;
		} else { // mozilla
			keycode = e.which;
		}

		key = String.fromCharCode(keycode).toLowerCase();
		
		if(key == 'x' || key == 'o' || key == 'c'){ // close lightbox
			Lightbox.end();
		} else if(key == 'p' || key == '%'){ // display previous image
			Lightbox.showPrev();
		} else if(key == 'n' || key =='\''){ // display next image
			Lightbox.showNext();
		} else if(key == 'f'){ // display first image
			Lightbox.showFirst();
		} else if(key == 'l'){ // display last image
			Lightbox.showLast();
		} else if(key == 's'){ // toggle slideshow
			if(Lightbox.imageArray.length > 0 && Lightbox.options.enableSlideshow){
				Lightbox.toggleSlideShow();
			}
		}
	},

	//
	//	preloadNeighborImages()
	//	Preload previous and next images.
	//
	preloadNeighborImages: function(){
		var nextImageID = this.imageArray.length - 1 == this.activeImage ? 0 : this.activeImage + 1;
		nextImage = new Image();
		nextImage.src = this.imageArray[nextImageID].link

		var prevImageID = this.activeImage == 0 ? this.imageArray.length - 1 : this.activeImage - 1;
		prevImage = new Image();
		prevImage.src = this.imageArray[prevImageID].link;
	},

	//
	//	end()
	//
	end: function() {
		this.disableKeyboardNav();
		this.pauseSlideShow();
		$(this.getID('lightbox')).hide();
		new Effect.Fade(this.getID('overlay'), { duration:this.overlayDuration });
		this.showBadObjects();
	},
	
	//
	//	showBadObjects()
	//
	showBadObjects: function (){
		var els;
		var tags = Lightbox.badObjects;
		for(var i=0; i<tags.length; i++){
			els = document.getElementsByTagName(tags[i]);
			for(var j=0; j<els.length; j++){
				$(els[j]).setStyle({visibility:'visible'});
			}
		}
	},
	
	//
	//	hideBadObjects()
	//
	hideBadObjects: function (){
		var els;
		var tags = Lightbox.badObjects;
		for(var i=0; i<tags.length; i++){
			els = document.getElementsByTagName(tags[i]);
			for(var j=0; j<els.length; j++){
				$(els[j]).setStyle({visibility:'hidden'});
			}
		}
	},
		
	//
	// pause(numberMillis)
	// Pauses code execution for specified time. Uses busy code, not good.
	// Code from http://www.faqts.com/knowledge_base/view.phtml/aid/1602
	//
	pause: function(numberMillis) {
		var now = new Date();
		var exitTime = now.getTime() + numberMillis;
		while(true){
			now = new Date();
			if (now.getTime() > exitTime)
				return;
		}
	},

	//
	// getPageScroll()
	// Returns array with x,y page scroll values.
	// Core code from - quirksmode.org
	//
	getPageScroll: function(){
		var x,y;
		if (self.pageYOffset) {
			x = self.pageXOffset;
			y = self.pageYOffset;
		} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
			x = document.documentElement.scrollLeft;
			y = document.documentElement.scrollTop;
		} else if (document.body) {// all other Explorers
			x = document.body.scrollLeft;
			y = document.body.scrollTop;
		}
		return {x:x,y:y};
	},

	//
	// getPageSize()
	// Returns array with page width, height and window width, height
	// Core code from - quirksmode.org
	// Edit for Firefox by pHaez
	//
	getPageSize: function(){
		var scrollX,scrollY,windowX,windowY,pageX,pageY;
		if (window.innerHeight && window.scrollMaxY) {	
			scrollX = document.body.scrollWidth;
			scrollY = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			scrollX = document.body.scrollWidth;
			scrollY = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			scrollX = document.body.offsetWidth;
			scrollY = document.body.offsetHeight;
		}
		
		if (self.innerHeight) {	// all except Explorer
			windowX = self.innerWidth;
			windowY = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowX = document.documentElement.clientWidth;
			windowY = document.documentElement.clientHeight;
		} else if (document.body) { // other Explorers
			windowX = document.body.clientWidth;
			windowY = document.body.clientHeight;
		}	
		
		pageY = (scrollY < windowY) ? windowY : scrollY; // for small pages with total height less then height of the viewport
		pageX = (scrollX < windowX) ? windowX : scrollX; // for small pages with total width less then width of the viewport
	
		return {pageWidth:pageX,pageHeight:pageY,winWidth:windowX,winHeight:windowY};
	},

	//
	// getID()
	// Returns formatted Lightbox element ID
	//
	getID: function(id){
		return this.options.prefix+id;
	}
}

// -----------------------------------------------------------------------------------

//Event.observe(window,'load',function(){ Lightbox.initialize(window['LightBoxOpt']); });

function initLightbox() {
Lightbox.initialize(window['LightBoxOpt']);
}













































//wyskakujace okienko
function hidestartuplayer(){
 Effect.Fade('startuplayer', { duration: 0.4, from: 1, to: 0 });
}
function showstartuplayer(){
document.getElementById('startuplayer').style.opacity=0;
document.getElementById('startuplayer').style.filter = "alpha(opacity=0)";
document.getElementById('startuplayer').style.display='block';
Effect.Fade('startuplayer', { duration: 1.0, from: 0, to: 1 });
if(navigator.appName == "Microsoft Internet Explorer"){
  p_y = document.documentElement.scrollTop;
 }else{
  p_y = window.pageYOffset;
 }
  pos_top=parseInt((document.body.clientHeight-1024)/2)+p_y-50;
  pos_center=parseInt((document.body.clientWidth-document.getElementById('startuplayer').offsetWidth)/2);
  document.getElementById('startuplayer').style.top='20px';
  document.getElementById('startuplayer').style.left=pos_center+'px';
  document.getElementById('startuplayerbut').style.width=document.getElementById('startuplayer').offsetWidth;
	document.getElementById('startuplayer').style.zIndex=200;
	
	

}















//funkcje.js
/*function klik() { 
  if (event.button==2) { 
    alert('Prawy przycisk jest zablokowany!');
  } 
} 
document.onmousedown=klik;
*/


/*function dodaj_do_ulubionych()
{
        var title = document.title;
        var url = document.location;
        if (window.sidebar)  // Mozilla Firefox Bookmark
        {
               window.sidebar.addPanel('www.budomex.eu', 'http://www.budomex.eu/', "");
        }
        else if(window.external)  // IE Favorite
        {
               window.external.AddFavorite('http://www.budomex.eu/', 'www.budomex.eu');
        }
}*/





function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_openBrWindow2(theURL,winName,w,h) { 
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;

 var settings ='';
settings +='width='+w+',';
settings +='height='+h+',';
settings +='top='+wint+',';
settings +='left='+winl+',';
settings +='scrollbars=yes,';
settings +='resizable=no';

win=window.open(theURL,winName,settings);
if(parseInt(navigator.appVersion) >= 4){win.window.focus();};
}



function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function setPointer(theRow, thePointerColor, theNormalBgColor)
{
    var theCells = null;

    if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {
        return false;
    }
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    var rowCellsCnt  = theCells.length;
    var currentColor = null;
    var newColor     = null;
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined' && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        newColor     = (currentColor.toLowerCase() == thePointerColor.toLowerCase())
                     ? theNormalBgColor
                     : thePointerColor;
        for (var c = 0; c < rowCellsCnt; c++) {
            theCells[c].setAttribute('bgcolor', newColor, 0);
        } // end for
    }
    else {
        currentColor = theCells[0].style.backgroundColor;
        newColor     = (currentColor.toLowerCase() == thePointerColor.toLowerCase())
                     ? theNormalBgColor
                     : thePointerColor;
        for (var c = 0; c < rowCellsCnt; c++) {
            theCells[c].style.backgroundColor = newColor;
        }
    }

    return true;
} 



function numberOnly(value){return !isNaN(value) && value ;} 
function noSpaces(value){return value.indexOf(" ") == -1 ;} 
function sevenDigits(value){return  /\b\d{7}\b/.test(value) ;} 


function sprawdz(form) {

with(form){

msg=""

//sprawdzenie maila
if (email.value.length==0){ 
		msg+= "Wypełnij pole e-mail!\n"
		} else {
			 Wzor = /^[0-9a-zA-Z.-_]+\@[0-9a-zA-Z-.-_]+\.[0-9a-zA-Z.]{2,4}$/;
	 if (Wzor.test(email.value)==false) { 
	 msg+= "Niewłaściwy format adresu e-mail!\n"
		} 
	}

if(msg){ 
 alert(msg); 
 return false;
}

return true;
}
}



function usun_biale_znaki(ciag){
	ciag = ciag.replace(/\r/g, " ");
  	ciag = ciag.replace(/[^ A-Za-z0-9`~!@#\$%\^&\*\(\)-_=\+\\\|\]\[\}\{'";:\?\/\.>,<]/g, "");
	ciag = ciag.replace(/'/g, "");
	ciag = ciag.replace(/ +/g, " ");  
	ciag = ciag.replace(/^\s/g, "");
	ciag = ciag.replace(/\s$/g, "");	
	return ciag;
}

function formatuj_liczbe(n, dokladnosc){
	return n.toFixed(dokladnosc);
}


function wylicz_wartosc(pole_baza, pole_zmiana, rabat, pole_vat, opcja){
	if(opcja == 'brutto'){
		document.getElementById(pole_zmiana).value = formatuj_liczbe(document.getElementById(pole_baza).value * (1 + usun_biale_znaki(document.getElementById(pole_vat).value) / 100), 2);
	}else if(opcja == 'netto'){
		document.getElementById(pole_zmiana).value = formatuj_liczbe(document.getElementById(pole_baza).value / (1 + usun_biale_znaki(document.getElementById(pole_vat).value) / 100), 2);
	}
}


function makearray(n){ this.length = n; for(var i = 1; i <= n; i++) this[i] = 0; return this; }
var hexa = new makearray(16); for(var i = 0; i < 10; i++) hexa[i] = i; hexa[10]="a"; hexa[11]="b"; hexa[12]="c"; hexa[13]="d"; hexa[14]="e"; hexa[15]="f";
function hex(i){ if (i < 0) return "00"; else if (i >255) return "ff"; else return "" + hexa[Math.floor(i/16)] + hexa[i%16]; }
function setbgColor(r, g, b, obj){ var hr = hex(r); var hg = hex(g); var hb = hex(b); document.getElementById(obj).style.background = "#"+hr+hg+hb; }
function fade(od_r, od_g, od_b, do_r, do_g, do_b, step, i, obj){ var r,g,b,i; r=Math.floor(od_r * ((step-i)/step) + do_r * (i/step)); g=Math.floor(od_g * ((step-i)/step) + do_g * (i/step)); b=Math.floor(od_b * ((step-i)/step) + do_b * (i/step)); if (i <= step) { setbgColor(r,g,b,obj); i++; setTimeout("fade("+od_r+","+od_g+","+od_b+","+do_r+","+do_g+","+do_b+","+step+","+i+",'"+obj+"')",10); } }
function fadein(od_r, od_g, od_b, do_r, do_g, do_b, step, obj) { fade(od_r, od_g, od_b, do_r, do_g, do_b, step, 0, obj); }
function fadeout(od_r, od_g, od_b, do_r, do_g, do_b, step, obj) { fade(od_r, od_g, od_b, do_r, do_g, do_b, step, 0, obj); }	




































/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;




















  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-2818575-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();



