/*
 * jQuery - Current
 *   http://jquery.com/
 *
 * To use, download this file to your server, save as jquery.js,
 * and add this HTML into the <head>...</head> of your web page:
 *   <script type="text/javascript" src="jquery.js"></script>
 *
 * Copyright (c) 2006 John Resig
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 */
/* Built Fri May 12 13:01:23 2006 */
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('7 $(a,c){8 $a=a||$.14||R;8 $c=c&&c.$4k&&c.1l(0)||c;l(1O 4g!="2r"){l($a.N==1g){8 S=I 1i("[^a-41-6z-6y-]");l(!S.3Z($a)){$c=$c&&$c.2L||R;l($c.2t($a).q==0){8 1m=$c.25($a);l(1m!=C)k 1m}}}H l($a.N==36){k $.1w($a,7(b){l(b.N==1g)k R.25(b);k b})}}8 T={B:$.2d($a,$c),$4k:"$6x: 29 $",1E:7(){k 6.1l().q},1l:7(i){k i==C?6.B:6.B[i]},E:7(f){D(8 i=0;i<6.1E();i++)$.1f(6.1l(i),f,[i]);k 6},3e:7(a,b){k 6.E(7(){l(b==C)D(8 j 1d a)$.W(6,j,a[j]);H $.W(6,a,b)})},3f:7(h){k h==C&&6.1E()?6.1l(0).1Z:6.3e("1Z",h)},2J:7(h){k h==C&&6.1E()?6.1l(0).2R:6.3e("2R",h)},1n:7(a,b){k a.N!=1g||b?6.E(7(){l(!b)D(8 j 1d a)$.W(6.L,j,a[j]);H $.W(6.L,a,b)}):$.1n(6.1l(0),a)},2s:7(){k 6.E(7(){8 d=$.19(6,"V");l(d=="1z"||d==\'\')$(6).1v();H $(6).1u()})},1v:7(a){k 6.E(7(){6.L.V=6.$$2k?6.$$2k:\'\';l($.19(6,"V")=="1z")6.L.V=\'33\'})},1u:7(a){k 6.E(7(){6.$$2k=$.19(6,"V");l(6.$$2k=="1z")6.$$2k=\'33\';6.L.V=\'1z\'})},6w:7(c){k 6.E(7(){l($.2b(6,c))k;6.1j+=(6.1j.q>0?" ":"")+c})},6v:7(c){k 6.E(7(){6.1j=c==C?\'\':6.1j.1x(I 1i(\'(^|\\\\s*\\\\b[^-])\'+c+\'($|\\\\b(?=[^-]))\',\'g\'),\'\')})},6u:7(c){k 6.E(7(){l($.2b(6,c))6.1j=6.1j.1x(I 1i(\'(\\\\s*\\\\b[^-])\'+c+\'($|\\\\b(?=[^-]))\',\'g\'),\'\');H 6.1j+=(6.1j.q>0?" ":"")+c})},6t:7(){6.E(7(){6.U.4h(6)});6.B=[];k 6},6s:7(){8 a=$.1X(1M);k 6.E(7(){8 b=a[0].2j(Q);6.U.2M(b,6);1G(b.1W)b=b.1W;b.4j(6)})},4i:7(){8 1D=6.1E()>1;8 a=$.1X(1M);k 6.E(7(){D(8 i=0;i<a.q;i++)6.4j(1D?a[i].2j(Q):a[i])})},6r:7(){8 a=1M;k 6.E(7(){D(8 i=0;i<a.q;i++)$(a[i]).4i(6)})},6q:7(){8 1D=6.1E()>1;8 a=$.1X(1M);k 6.E(7(){D(8 i=a.q-1;i>=0;i--)6.2M(1D?a[i].2j(Q):a[i],6.1W)})},6p:7(){8 1D=6.1E()>1;8 a=$.1X(1M);k 6.E(7(){D(8 i=0;i<a.q;i++)6.U.2M(1D?a[i].2j(Q):a[i],6)})},6o:7(){8 1D=6.1E()>1;8 a=$.1X(1M);k 6.E(7(){D(8 i=a.q-1;i>=0;i--)6.U.2M(1D?a[i].2j(Q):a[i],6.6n)})},45:7(){k 6.E(7(){1G(6.1W)6.4h(6.1W)})},21:7(t,f){k 6.E(7(){1F(6,t,f)})},3B:7(t,f){k 6.E(7(){35(6,t,f)})},3A:7(t){k 6.E(7(){2U(6,t)})},2Q:7(t){8 1Y=[],F=[];6.E(7(){1Y[1Y.q]=6;F=$.Y(F,$.2d(t,6))});6.1Y=1Y;6.B=F;k 6},6m:7(){6.B=6.1Y;k 6},46:7(a){6.B=$.1w(6.B,7(d){k d.U});l(a)6.B=$.15(a,6.B).r;k 6},38:7(a){6.B=$.1w(6.B,$.38);l(a)6.B=$.15(a,6.B).r;k 6},6l:7(a){6.B=$.1w(6.B,$.12);l(a)6.B=$.15(a,6.B).r;k 6},15:7(t){6.B=$.15(t,6.B).r;k 6},2G:7(t){6.B=t.N==1g?$.15(t,6.B,16).r:$.1S(6.B,7(a){k a!=t});k 6},6k:7(t){6.B=$.Y(6.B,t.N==1g?$.2d(t):t.N==36?t:[t]);k 6},6j:7(t){k $.15(t,6.B).r.q>0},6i:7(t){k!6.s(t)}};D(8 i 1d $.G){l(T[i]!=C)T["1I"+i]=T[i];T[i]=$.G[i]}l(1O 4g!="2r"&&$a.N!=1g){l($c)$a=T.1l();D(8 i 1d T){(7(j){2P{l($a[j]==C){$a[j]=7(){k $.1f(T,T[j],1M)}}}2N(e){}})(i)}k $a}k T}$.1f=7(o,f,a){a=a||[];l(f.1f)k f.1f(o,a);H{8 p=[];D(8 i=0;i<a.q;i++)p[i]=\'a[\'+i+\']\';o.$$1C=6;8 r=2O(\'o.$$1C(\'+p.3i(\',\')+\')\');o.$$1C=C;k r}};$.19=7(e,p){l(p==\'18\'||p==\'1y\'){l($.19(e,"V")!=\'1z\')k p==\'18\'?e.3U||1J(e.L.18):e.3V||1J(e.L.1y);8 1p=e.L;8 4e=1p.2e;8 1A=1p.1P;8 4f=1p.V;1p.2e=\'1q\';1p.1P=\'3S\';1p.V=\'\';8 4d=e.6h||1J(e.L.18);8 4c=e.6g||1J(e.L.1y);1p.V=4f;1p.1P=1A;1p.2e=4e;k p==\'18\'?4d:4c}l(e.L[p])k e.L[p];H l(e.4b)k e.4b[p];H l(R.3d&&R.3d.4a){p=p.1x(/([A-Z])/g,"-$1");p=p.2W();8 s=R.3d.4a(e,"");8 r=s?s.6f(p):p;k r}H k C};$.1n=$.19;$.1X=7(a){8 r=[];D(8 i=0;i<a.q;i++)l(a[i].N==1g){8 2i=R.6e("2i");2i.1Z=a[i];D(8 j=0;j<2i.1a.q;j++)r[r.q]=2i.1a[j]}H l(a[i].q)D(8 j=0;j<a[i].q;j++)r[r.q]=a[i][j];H l(a[i]!=C)r[r.q]=a[i].2C?a[i]:R.6d(a[i].6c());k r};$.g={\'\':"m[2] == \'*\' || a.2B.39() == m[2].39()",\'#\':"a.2S == m[2]",\':\':{6b:"i < m[3]-0",6a:"i > m[3]-0",2h:"m[3] - 0 == i",69:"m[3] - 0 == i",3c:"i == 0",1e:"i == r.q - 1",49:"i % 2 == 0",48:"i % 2 == 1","3c-2f":"$.12(a,0).B","2h-2f":"(m[3] == \'49\'?$.12(a,m[3]).n % 2 == 0 :(m[3] == \'48\'?$.12(a,m[3]).n % 2 == 1:$.12(a,m[3]).B))","1e-2f":"$.12(a,0,Q).B","2h-1e-2f":"$.12(a,m[3],Q).B","3c-2g-u":"$.1T(a,0)","2h-2g-u":"$.1T(a,m[3])","1e-2g-u":"$.1T(a,0,Q)","2h-1e-2g-u":"$.1T(a,m[3],Q)","47-2g-u":"$.1T(a) == 1","47-2f":"$.12(a).q == 1",46:"a.1a.q > 0",45:"a.1a.q == 0",68:"a == ( a.44 ? a.44 : R ).2L",67:"(a.66 || a.1Z).O(m[3]) != -1",65:"(!a.u || a.u != \'1q\') && ($.19(a,\'V\') != \'1z\' && $.19(a,\'2e\') != \'1q\')",1q:"(a.u && a.u == \'1q\') || $.19(a,\'V\') == \'1z\' || $.19(a,\'2e\') == \'1q\'",3k:"a.3b == 16",3b:"a.3b",2T:"a.2T"},".":"$.2b(a,m[2])","@":{"=":"$.W(a,m[3]) == m[4]","!=":"$.W(a,m[3]) != m[4]","~=":"$.2b($.W(a,m[3]),m[4])","|=":"$.W(a,m[3]).O(m[4]) == 0","^=":"$.W(a,m[3]).O(m[4]) == 0","$=":"$.W(a,m[3]).1o( $.W(a,m[3]).q - m[4].q, m[4].q ) == m[4]","*=":"$.W(a,m[3]).O(m[4]) >= 0","":"m[3] == \'*\' ? a.64.q > 0 : $.W(a,m[3])"},"[":"$.2d(m[2],a).q > 0"};$.G={};$.2d=7(t,14){14=14||$.14||R;l(t.N!=1g)k[t];l(t.O("//")==0){14=14.2L;t=t.1o(2,t.q)}H l(t.O("/")==0){14=14.2L;t=t.1o(1,t.q);l(t.O(\'/\'))t=t.1o(t.O(\'/\'),t.q)}8 F=[14];8 1V=[];8 1e=C;1G(t.q>0&&1e!=t){8 r=[];1e=t;t=$.1L(t);8 S=I 1i("^//","i");t=t.1x(S,"");l(t.O(\'..\')==0||t.O(\'/..\')==0){l(t.O(\'/\')==0)t=t.1o(1,t.q);r=$.1w(F,7(a){k a.U});t=t.1o(2,t.q);t=$.1L(t)}H l(t.O(\'>\')==0||t.O(\'/\')==0){r=$.1w(F,7(a){k(a.1a.q>0?$.12(a.1W):C)});t=t.1o(1,t.q);t=$.1L(t)}H l(t.O(\'+\')==0){r=$.1w(F,7(a){k $.12(a).40});t=t.1o(1,t.q);t=$.1L(t)}H l(t.O(\'~\')==0){r=$.1w(F,7(a){8 r=[];8 s=$.12(a);l(s.n>0)D(8 i=s.n;i<s.q;i++)r[r.q]=s[i];k r});t=t.1o(1,t.q);t=$.1L(t)}H l(t.O(\',\')==0||t.O(\'|\')==0){l(F[0]==14)F.43();1V=$.Y(1V,F);r=F=[14];t=" "+t.1o(1,t.q)}H{8 S=I 1i("^([#.]?)([a-2H-9\\\\*1I-]*)","i");8 m=S.1C(t);l(m[1]=="#"){8 3a=R.25(m[2]);r=3a?[3a]:[];t=t.1x(S,"")}H{l(m[2]==""||m[1]==".")m[2]="*";D(8 i=0;i<F.q;i++){8 o=F[i];l(o){63(m[2]){1c\'*\':r=$.Y($.37(o),r);2K;1c\'1N\':1c\'62\':1c\'61\':1c\'1q\':1c\'60\':1c\'3C\':1c\'5Z\':1c\'5Y\':1c\'3E\':1c\'5X\':r=$.Y($.1S($.1U(o,"2p"),7(a){k a.u==m[2]}),r);2K;1c\'2p\':r=$.Y($.1U(o,"2p"),r);r=$.Y($.1U(o,"3D"),r);r=$.Y($.1U(o,"3l"),r);2K;5W:r=$.Y(r,$.1U(o,m[2]));2K}}}}}8 2J=$.15(t,r);F=r=2J.r;t=$.1L(2J.t)}l(F&&F[0]==14)F.43();1V=$.Y(1V,F);k 1V};$.1U=7(a,b){k a&&1O a.2t!="2r"?a.2t(b):[]};$.W=7(o,a,v){l(a&&a.N==1g){8 2I={\'D\':\'5V\',\'1N\':\'5U\',\'5T\':\'1j\',\'5S\':\'5R\'};a=(2I[a]&&2I[a].1x&&2I[a])||a;8 r=I 1i("-([a-z])","5Q");a=a.1x(r,7(z,b){k b.39()});l(v!=C){o[a]=v;l(o.42)o.42(a,v)}k o[a]||o.5P(a)||\'\'}H k\'\'};$.15=7(t,r,2G){8 g=$.1S;l(2G==16)8 g=7(a,f){k $.1S(a,f,Q)};1G(t.q>0&&t.5O(/^[:\\\\.#\\\\[a-41-Z\\\\*]/)){8 S=I 1i("^\\\\[ *@([a-2H-9\\\\(\\\\)1I-]+) *([~!\\\\|\\\\*$^=]*) *\'?\\"?([^\'\\"]*)\'?\\"? *\\\\]","i");8 m=S.1C(t);l(m!=C){m=[\'\',\'@\',m[2],m[1],m[3]]}H{8 S=I 1i("^(\\\\[) *([^\\\\]]*) *\\\\]","i");8 m=S.1C(t);l(m==C){8 S=I 1i("^(:)([a-2H-9\\\\*1I-]*)\\\\( *[\\"\']?([^ \\\\)\'\\"]*)[\'\\"]? *\\\\)","i");8 m=S.1C(t);l(m==C){8 S=I 1i("^([:\\\\.#]*)([a-2H-9\\\\*1I-]*)","i");8 m=S.1C(t)}}}t=t.1x(S,"");l(m[1]==":"&&m[2]=="2G")r=$.15(m[3],r,16).r;H{l($.g[m[1]].N==1g)8 f=$.g[m[1]];H l($.g[m[1]][m[2]])8 f=$.g[m[1]][m[2]];l(f!=C){2O("f = 7(a,i){k "+f+"}");r=g(r,f)}}}k{r:r,t:t}};$.38=7(a){8 b=[];8 c=a.U;1G(c!=C&&c!=R){b[b.q]=c;c=c.U}k b};$.1L=7(t){k t.1x(/^\\s+|\\s+$/g,\'\')};$.1T=7(a,n,e){8 t=$.1S($.12(a),7(b){k b.2B==a.2B});l(e)n=t.q-n-1;k n!=C?t[n]==a:t.q};$.12=7(a,n,e){8 u=[];8 2c=a.U.1a;D(8 i=0;i<2c.q;i++){l(2c[i].2C==1)u[u.q]=2c[i];l(2c[i]==a)u.n=u.q-1}l(e)n=u.q-n-1;u.B=(u[n]==a);u.5N=(u.n>0?u[u.n-1]:C);u.40=(u.n<u.q-1?u[u.n+1]:C);k u};$.2b=7(e,a){l(e==C)k 16;l(e.1j!=C)e=e.1j;k I 1i("(^|\\\\s)"+a+"(\\\\s|$)").3Z(e)};$.37=7(o,r){r=r||[];8 s=o.1a;D(8 i=0;i<s.q;i++){l(s[i].2C==1){r[r.q]=s[i];$.37(s[i],r)}}k r};$.Y=7(a,b){8 d=[];D(8 j=0;j<b.q;j++)d[j]=b[j];D(8 i=0;i<a.q;i++){8 c=Q;D(8 j=0;j<b.q;j++)l(a[i]==b[j])c=16;l(c)d[d.q]=a[i]}k d};$.1S=7(a,f,s){8 r=[];l(a!=C)D(8 i=0;i<a.q;i++)l((!s&&f(a[i],i))||(s&&!f(a[i],i)))r[r.q]=a[i];k r};$.1w=7(a,f){8 r=[];D(8 i=0;i<a.q;i++){8 t=f(a[i],i);l(t!=C){l(t.N!=36)t=[t];r=$.Y(t,r)}}k r};7 1F(K,u,1B){l(K.5M)K=23;l(!1B.$$1R)1B.$$1R=1F.1R++;l(!K.1b)K.1b={};8 1h=K.1b[u];l(!1h){1h=K.1b[u]={};l(K["2a"+u])1h[0]=K["2a"+u]}1h[1B.$$1R]=1B;K["2a"+u]=2F};1F.1R=1;7 35(K,u,1B){l(K.1b){l(u&&K.1b[u]){l(1B){3Y K.1b[u][1B.$$1R]}H{D(8 i 1d K.1b[u])3Y K.1b[u][i]}}H{D(8 i 1d K.1b)35(K,i)}}};7 2U(K,u,X){X=X||[{u:u}];l(K&&K["2a"+u])$.1f(K,K["2a"+u],X)}7 2F(11){8 2E=Q;11=11||1Q(23.11);8 1h=[];D(8 i 1d 6.1b[11.u])1h[1h.q]=6.1b[11.u][i];D(8 i=0;i<1h.q;i++){2P{l(1h[i].N==20){6.$$2F=1h[i];l(6.$$2F(11)===16){11.24();11.2D();2E=16}}}2N(e){}}k 2E};7 1Q(11){11.24=1Q.24;11.2D=1Q.2D;k 11};1Q.24=7(){6.2E=16};1Q.2D=7(){6.5L=Q};$.G.1N=7(e){e=e||6.B;8 t="";D(8 j=0;j<e.q;j++){D(8 i=0;i<e[j].1a.q;i++)t+=e[j].1a[i].2C!=1?e[j].1a[i].5K:$.G.1N(e[j].1a[i].1a)}k t};$.1K=7(s,o){l(o&&o.N==20)o={1H:o};o=o||{};8 27={"5J":5I,"5H":5G,"5F":5E,"5D":2A,"5C":5B,"5A":5z,"5y":2A};o.28=1O s=="5x"?s:27[s]||2A;k o};$.G.1u=7(a,o){o=$.1K(a,o);k a?6.E(7(){I J.2Y(6,o).1u()}):6.3X()};$.G.1v=7(a,o){o=$.1K(a,o);k a?6.E(7(){I J.2Y(6,o).1v()}):6.3W()};$.G.5w=7(a,o){o=$.1K(a,o);k 6.E(7(){I J.2v(6,o).1v("18")})};$.G.5v=7(a,o){o=$.1K(a,o);k 6.E(7(){I J.2v(6,o).1u("18")})};$.G.5u=7(a,o){o=$.1K(a,o);k a?6.E(7(){I J.2u(6,o).1u()}):6.3X()};$.G.5t=7(a,o){o=$.1K(a,o);k a?6.E(7(){I J.2u(6,o).1v()}):6.3W()};$.G.3T=7(f){k 6.E(7(){l(!f&&6.2B==\'5s\'&&!6.3V&&!6.3U){8 T=6;3O(7(){$(T).3T(Q)},13)}H{8 s=6.L;8 p=6.U;l($.1n(p,"1P")==\'5r\')p.L.1P=\'5q\';s.1P=\'3S\';s.5p=1J(($.1n(p,"1y")-$.1n(6,"1y"))/2)+"32";s.5o=1J(($.1n(p,"18")-$.1n(6,"18"))/2)+"32"}})};$.30=7(e,p){8 a=e.L[p];8 o=$.1n(e,p);e.L[p]=\'31\';8 n=$.1n(e,p);l(o!=n)e.L[p]=a};7 J(M,1A,1t,34){8 z=6;z.a=7(){z.M.L[1t]=z.1s+z.o.3Q};z.3R=7(){k z.M["2x"+1t]||z.M["5n"+34]||z.M["3F"+34]||z.B()};z.B=7(){k 1J($.19(z.M,1t))};z.1v=7(){z.27("33");z.o.31=Q;z.2y(0,z.3R())};z.1u=7(){z.M.$o=$.19(z.M,"2z");z.M["2x"+1t]=6.B();z.2y(z.B(),0)};z.27=7(a){l(y.V!=a)y.V=a};z.2s=7(){l(z.B()>0)z.1u();H z.1v()};z.2w=7(a){z.2y(z.B(),z.B()+a)};z.3P=7(){3t(z.1r);z.1r=C};z.M=M.N==1g?R.25(M):M;8 y=z.M.L;z.3N=y.2z;y.2z="1q";z.o={3Q:"32",28:(1A&&1A.28)||2A,1H:(1A&&1A.1H)||1A};z.3I=7(f,2Z){8 t=(I 3K).3J();8 p=(t-z.s)/z.o.28;l(t>=z.o.28+z.s){z.1s=2Z;z.3P();3O(7(){y.2z=z.3N;l(y.18=="3M"||y.1y=="3M")z.27("1z");l(1t!="26"&&z.o.31){$.30(z.M,"18");$.30(z.M,"1y")}l(z.o.1H.N==20){z.M.$1I=z.o.1H;z.M.$1I()}},13)}H z.1s=((-3L.5m(p*3L.5l)/2)+0.5)*(2Z-f)+f;z.a()};z.2y=7(f,t){l(z.1r)k;6.1s=f;z.a();z.2x=z.B();z.s=(I 3K).3J();z.1r=3r(7(){z.3I(f,t)},13)}}J.G=["1v","1u","2s"];J.1t=["3H","3G","5k","5j"];D(8 i 1d J.1t){(7(){8 c=J.1t[i];J[c]=7(a,b){k I J(a,b,c.2W(),c)}})()}J.2u=7(a,b){8 o=I J(a,b,"26");o.B=7(){k 5i(o.M.L.26)};o.a=7(){8 e=o.M.L;l(o.1s==1)o.1s=0.5h;l(23.2X)e.15="5g(26="+o.1s*5f+")";e.26=o.1s};o.2x=o.1s=1;o.a();k o};J.2v=7(e,o){8 z=6;8 h=I J.3H(e,o);l(o)o.1H=C;8 w=I J.3G(e,o);7 c(a,b,c){k(!a||a==c||b==c)}D(8 i 1d J.G){(7(){8 j=J.G[i];z[j]=7(a,b){l(c(a,b,"18"))h[j]();l(c(a,b,"1y"))w[j]()}})()}z.2w=7(c,d){h.2w(c);w.2w(d)}};J.2Y=7(e,o){8 z=6;8 r=I J.2v(e,o);l(o)o.1H=C;8 p=I J.2u(e,o);D(8 i 1d J.G){(7(){8 j=J.G[i];z[j]=7(a,b){p[j]();r[j](a,b)}})()}};8 e=["5e","5d","5c","2n","5b","3F","5a","3q","59","58","57","56","55","54","3z","3x","53","3E","3D","3C","52","51","50","4Z","4Y","17"];D(8 i=0;i<e.q;i++){(7(){8 o=e[i];$.G[o]=7(f){k 6.21(o,f)};$.G["4X"+o]=7(f){k 6.3B(o,f)};$.G["4W"+o]=7(){k 6.3A(o)};$.G["4V"+o]=7(f){k 6.21(o,7(e){l(6[o+f]!=C)k Q;6[o+f]++;k $.1f(6,f,[e])})};})()}$.G.3u=7(f,g){k 6.E(7(){8 1m=6;1F(6,"3z",7(e){8 p=(e.3y!=C?e.3y:e.3v);1G(p&&p!=1m)p=p.U;l(p==1m)k 16;k $.1f(1m,f,[e])});1F(6,"3x",7(e){8 p=(e.3w!=C?e.3w:e.3v);1G(p&&p!=1m)p=p.U;l(p==1m)k 16;k $.1f(1m,g,[e])})})};$.G.4U=$.G.3u;$.17=7(){l($.$$1r){3t($.$$1r);$.$$1r=C;D(8 i=0;i<$.$$17.q;i++)$.1f(R,$.$$17[i]);$.$$17=C}};l(R.3s)R.3s("4T",$.17,C);1F(23,"2n",$.17);$.G.17=7(f){k 6.E(7(){l($.$$1r){$.$$17.4S(f)}H{8 o=6;$.$$17=[f];$.$$1r=3r(7(){l(o&&o.2t&&o.25&&o.4R)$.17()},10)}})};$.G.4Q=$.G.17;$.G.2s=7(a,b){k a&&b?6.3q(7(e){6.$$1e=6.$$1e==a?b:a;e.24();k $.1f(6,6.$$1e,[e])||16}):6.4P()};l(1O 2V==\'2r\'&&1O 23.2X==\'7\'){8 2V=7(){k I 2X((4O.4N.2W().O(\'4M 5\')>=0)?"4L.3p":"4K.3p")}}$.P=7(u,1k,X,F){8 P=I 2V();l(P){P.4J(u||"2m",1k,Q);l(X)P.4I(\'4H-4G\',\'4F/x-4E-4D-4C\');P.4B=7(){l(P.4A==4){l(F)F(P);$.3n($.2q(P))}};P.4z(X)}};$.2q=7(r,u){k r.4y("4x-u").O("P")>0||u=="P"?r.4w:r.3g};$.1l=7(1k,F,u){$.P("2m",1k,C,7(r){l(F)F($.2q(r,u))})};$.4v=7(1k,F){$.1l(1k,F,"P")};$.3o=7(1k,X,F,u){$.P("3h",1k,$.2l(X),7(r){l(F)F($.2q(r,u))})};$.4u=7(1k,X,F){$.3o(1k,X,F,"P")};$.G.4t=7(2o){$.22=$.Y($.22,6.B);k 6.21(\'3m\',2o)};$.22=[];$.3n=7(X){D(8 i=0;i<$.22.q;i++)2U($.22[i],\'3m\',[X])};$.G.4s=7(2o){k 6.E(7(){8 a={};$(6).2Q("2p:2T,1q,1N,4r[@4q],3l").15(":3k").E(7(){a[6.3j||6.2S||6.U.3j||6.U.2S]=6.2R});$.P(6.4p||"2m",6.4o||"",$.2l(a),2o)})};$.2l=7(a){8 s=[];D(8 i 1d a)s[s.q]=i+"="+4n(a[i]);k s.3i("&")};$.G.2n=7(a,o,f){l(a&&a.N==20)k 6.21("2n",a);8 t="2m";l(o&&o.N==20){f=o;o=C}l(o!=C){o=$.2l(o);t="3h"}8 T=6;$.P(t,a,o,7(h){8 h=h.3g;T.3f(h).2Q("4m").E(7(){2P{2O(6.1N||6.4l||6.1Z)}2N(e){}});l(f)f(h)});k 6};',62,408,'||||||this|function|var||||||||||||return|if|||||length||||type|||||||cur|null|for|each|ret|fn|else|new|fx|element|style|el|constructor|indexOf|xml|true|document|re|self|parentNode|display|attr|data|merge|||event|sibling||context|filter|false|ready|height|getCSS|childNodes|events|case|in|last|apply|String|handlers|RegExp|className|url|get|obj|css|substr|els|hidden|timer|now|ty|hide|show|map|replace|width|none|op|handler|exec|clone|size|addEvent|while|onComplete|_|parseInt|speed|cleanSpaces|arguments|text|typeof|position|fixEvent|guid|grep|ofType|tag|done|firstChild|clean|old|innerHTML|Function|bind|ajaxHandles|window|preventDefault|getElementById|opacity|ss|duration||on|hasWord|tmp|Select|visibility|child|of|nth|div|cloneNode|oldblock|param|GET|load|callback|input|httpData|undefined|toggle|getElementsByTagName|Opacity|Resize|modify|io|custom|overflow|400|nodeName|nodeType|stopPropagation|returnValue|handleEvent|not|z0|fix|val|break|documentElement|insertBefore|catch|eval|try|find|value|id|checked|triggerEvent|XMLHttpRequest|toLowerCase|ActiveXObject|FadeSize|tt|setAuto|auto|px|block|tz|removeEvent|Array|getAll|parents|toUpperCase|oid|disabled|first|defaultView|set|html|responseText|POST|join|name|enabled|textarea|ajax|triggerAJAX|post|XMLHTTP|click|setInterval|addEventListener|clearInterval|hover|relatedTarget|toElement|mouseout|fromElement|mouseover|trigger|unbind|submit|select|reset|scroll|Width|Height|step|getTime|Date|Math|0px|oo|setTimeout|clear|unit|max|absolute|center|offsetHeight|offsetWidth|_show|_hide|delete|test|next|zA|setAttribute|shift|ownerDocument|empty|parent|only|odd|even|getComputedStyle|currentStyle|oWidth|oHeight|ov|od|Prototype|removeChild|append|appendChild|jquery|textContent|script|encodeURIComponent|action|method|selected|option|serialize|handleAJAX|postXML|getXML|responseXML|content|getResponseHeader|send|readyState|onreadystatechange|urlencoded|form|www|application|Type|Content|setRequestHeader|open|Msxml2|Microsoft|msie|userAgent|navigator|_toggle|onready|body|push|DOMContentLoaded|onhover|one|do|un|error|abort|keyup|keypress|keydown|change|mousemove|mouseleave|mouseenter|mouseup|mousedown|dblclick|unload|resize|contextmenu|focus|blur|100|alpha|9999|parseFloat|Top|Left|PI|cos|natural|top|left|relative|static|IMG|fadeIn|fadeOut|slideUp|slideDown|number|normal|75|xfast|200|fast|medium|600|slow|850|xslow|1200|crawl|nodeValue|cancelBubble|location|prev|match|getAttribute|ig|cssFloat|float|class|cssText|htmlFor|default|file|password|image|button|checkbox|radio|switch|attributes|visible|innerText|contains|root|eq|gt|lt|toString|createTextNode|createElement|getPropertyValue|clientWidth|clientHeight|isNot|is|add|siblings|end|nextSibling|after|before|prepend|appendTo|wrap|remove|toggleClass|removeClass|addClass|Rev|9_|Z0'.split('|'),0,{}))


$(document).ready(function(){
	
	$(".checkbox").click(function(){
		
		if ($(this).parent(0).is('.checked')) {
			$(this).parent(0).get(0).className='';
		} else {
			$(this).parent(0).addClass('checked');
		}
	});

	$("label").hoverClass('hover');
	$("tr.calc_summary").hoverClass('hover');
	
	$("#hide_menu").click(function() {
		
		var state = $(this).get(0).value;
		
		if (state == 'Hide Left Menu') {
			$("body").addClass("full");
			$(this).set({value:'Show Left Menu'});
		} else {
			$("body").removeClass("full");
			$(this).set({value:'Hide Left Menu'});
		}
	});
	
	$("input.num").click(function() {
		//this.focus();
		this.select();
	});
	
	$(".num").change(function() {
		
		var id = $(this).get(0).id;
		//strip off dog/cat to get id of total input
		var target_id = id.substr(4) // dog_ or cat_
				
		var dog_count = parseFloat(document.getElementById('dog_'+target_id).value);
		var cat_count = parseFloat(document.getElementById('cat_'+target_id).value);
				
		var total = eval(dog_count + cat_count);
		if (total != "NaN") {
			$('#'+target_id).set({value:total});
			doBGFade(target_id,[255,255,100],[245,245,245],'transparent',25,10,4);
		}
	
	});
	
	// do the special calculations
		
	$("tr.calc_summary").click(function(){
		
		$(this).find("input").each(function() {
				var set_value = do_calculation($(this).get(0).id);	
				$(this).set({value:set_value});
				doBGFade($(this).get(0).id,[255,255,100],[245,245,245],'transparent',25,10,4);
		});
	
	});
	
	$("#aast_calc").click(function() {
		$("tr.calc_summary").each(function(){
				$(this).find("input").each(function() {
					var set_value = do_calculation($(this).get(0).id);	
					$(this).set({value:set_value});
					doBGFade($(this).get(0).id,[255,255,100],[245,245,245],'transparent',25,10,4);
					
				});
		});
	
		do_rate_calc();

	});
	
	$("#rate").click(function() {
 		do_rate_calc();
	});
	
	$("#aast_print").click(function() {
		do_rate_calc();
		window.print();
		return false;
	});
	
	$(".num").numeric(); // force num fields
	$(".date").change(function(){
		if (validateUSDate($(this).get(0).value, $(this).get(0).id)) {
			$(this).removeClass('error');
		} else {
			$(this).addClass('error');
			alert("Please enter a valid date (MM/DD/YYYY");
		}
		
	
	});
	

});	


function do_rate_calc() {
			var adopt = parseFloat($("#adopt").get(0).value);
			var out_within = parseFloat($("#out_within").get(0).value);
			var out_without = parseFloat($("#out_without").get(0).value);
			var out_return = parseFloat($("#out_return").get(0).value);
			
			var sum_out = eval(adopt + out_within + out_without + out_return);
			var sub_out = parseFloat($("#sub_out").get(0).value);
			
			
			var rate = eval(sum_out / sub_out);
			var rate_p = eval(rate * 100);
						
			$("#release_rate").set({value:rate_p.toFixed(2)+'%'});
			doBGFade('release_rate',[255,255,100],[245,245,245],'transparent',25,10,4);
}

function do_calculation(id) {
		
	// ROW F
		if (id == 'dog_total_intake') {
			// DOG B+C+D+E
			var dog_intake_public = parseFloat($("#dog_intake_public").get(0).value);
			var dog_intake_within = parseFloat($("#dog_intake_within").get(0).value);
			var dog_intake_without = parseFloat($("#dog_intake_without").get(0).value);
			var dog_intake_owners = parseFloat($("#dog_intake_owners").get(0).value);
			
			return eval(dog_intake_public + dog_intake_within + dog_intake_without + dog_intake_owners);
			

			
		} else if (id == 'cat_total_intake') {
			// CAT B+C+D+E
		
			var cat_intake_public = parseFloat($("#cat_intake_public").get(0).value);
			var cat_intake_within = parseFloat($("#cat_intake_within").get(0).value);
			var cat_intake_without = parseFloat($("#cat_intake_without").get(0).value);
			var cat_intake_owners = parseFloat($("#cat_intake_owners").get(0).value);
			
			return eval(cat_intake_public + cat_intake_within + cat_intake_without + cat_intake_owners);
			
		} else if (id == 'total_intake') {
			var dog_intake_public = parseFloat($("#dog_intake_public").get(0).value);
			var dog_intake_within = parseFloat($("#dog_intake_within").get(0).value);
			var dog_intake_without = parseFloat($("#dog_intake_without").get(0).value);
			var dog_intake_owners = parseFloat($("#dog_intake_owners").get(0).value);
			
			var total_dog = eval(dog_intake_public + dog_intake_within + dog_intake_without + dog_intake_owners);
			
			var cat_intake_public = parseFloat($("#cat_intake_public").get(0).value);
			var cat_intake_within = parseFloat($("#cat_intake_within").get(0).value);
			var cat_intake_without = parseFloat($("#cat_intake_without").get(0).value);
			var cat_intake_owners = parseFloat($("#cat_intake_owners").get(0).value);
			
			var total_cat = eval(cat_intake_public + cat_intake_within + cat_intake_without + cat_intake_owners);
			var total = eval(total_dog+total_cat);
			
			return total;
	
	// ROW H
		} else if (id == 'd_ati') {
			var dog_e_owners = parseFloat($("#dog_e_owners").get(0).value);
			var dog_intake = parseFloat($("#dog_total_intake").get(0).value);
			
			return eval(dog_intake-dog_e_owners);
			
		} else if (id == 'c_ati') {
			var cat_e_owners = parseFloat($("#cat_e_owners").get(0).value);
			var cat_intake = parseFloat($("#cat_total_intake").get(0).value);
			
			return eval(cat_intake-cat_e_owners);
			
		} else if (id == 'ati') {
			var dog_ati = parseFloat($("#d_ati").get(0).value);
			var cat_ati = parseFloat($("#c_ati").get(0).value);
			
			return eval(dog_ati + cat_ati);
		
	// ROW Q
	
		} else if (id == 'dog_total_e') {
			var dog_e_healthy = parseFloat($("#dog_e_healthy").get(0).value);
			var dog_tr_healthy = parseFloat($("#dog_tr_healthy").get(0).value);
			var dog_tm_healthy = parseFloat($("#dog_tm_healthy").get(0).value);
			var dog_u_healthy = parseFloat($("#dog_u_healthy").get(0).value);
			
			return eval(dog_e_healthy + dog_tr_healthy + dog_tm_healthy + dog_u_healthy);
	
		} else if (id == 'cat_total_e') {
			var cat_e_healthy = parseFloat($("#cat_e_healthy").get(0).value);
			var cat_tr_healthy = parseFloat($("#cat_tr_healthy").get(0).value);
			var cat_tm_healthy = parseFloat($("#cat_tm_healthy").get(0).value);
			var cat_u_healthy = parseFloat($("#cat_u_healthy").get(0).value);
			
			return eval(cat_e_healthy + cat_tr_healthy + cat_tm_healthy + cat_u_healthy);
		
		} else if (id == 'total_e') {
			var dog_ati = parseFloat($("#dog_total_e").get(0).value);
			var cat_ati = parseFloat($("#cat_total_e").get(0).value);
			
			return eval(dog_ati + cat_ati);

	// ROW S
		
		} else if (id == 'dog_final_total_e') {
			var dog_e_total = parseFloat($("#dog_total_e").get(0).value);
			var dog_e_request = parseFloat($("#dog_e_request").get(0).value);

			return eval(dog_e_total-dog_e_request);

		} else if (id == 'cat_final_total_e') {
			var cat_e_total = parseFloat($("#cat_total_e").get(0).value);
			var cat_e_request = parseFloat($("#cat_e_request").get(0).value);
			
			return eval(cat_e_total-cat_e_request);

		} else if (id == 'final_total_e') {
			var dog_ati = parseFloat($("#dog_final_total_e").get(0).value);
			var cat_ati = parseFloat($("#cat_final_total_e").get(0).value);
			
			return eval(dog_ati + cat_ati);

// ROW T
		} else if (id == 'dog_sub_out') {
			var dog_adopt = parseFloat($("#dog_adopt").get(0).value);
			var dog_out_within = parseFloat($("#dog_out_within").get(0).value);
			var dog_out_without = parseFloat($("#dog_out_without").get(0).value);
			var dog_out_return = parseFloat($("#dog_out_return").get(0).value);
			var dog_final_total_e = parseFloat($("#dog_final_total_e").get(0).value);
			
			return eval(dog_adopt + dog_out_within + dog_out_without + dog_out_return + dog_final_total_e);

		} else if (id == 'cat_sub_out') {
			var cat_adopt = parseFloat($("#cat_adopt").get(0).value);
			var cat_out_within = parseFloat($("#cat_out_within").get(0).value);
			var cat_out_without = parseFloat($("#cat_out_without").get(0).value);
			var cat_out_return = parseFloat($("#cat_out_return").get(0).value);
			var cat_final_total_e = parseFloat($("#cat_final_total_e").get(0).value);
			
			return eval(cat_adopt + cat_out_within + cat_out_without + cat_out_return + cat_final_total_e);

		} else if (id == 'sub_out') {
			var dog_ati = parseFloat($("#dog_sub_out").get(0).value);
			var cat_ati = parseFloat($("#cat_sub_out").get(0).value);
			
			return eval(dog_ati + cat_ati);
				
// ROW V
		} else if (id == 'dog_total_outcomes') {
			var dog_ati = parseFloat($("#dog_lost_s").get(0).value);
			var cat_ati = parseFloat($("#dog_sub_out").get(0).value);
			
			return eval(dog_ati + cat_ati);
			
		} else if (id == 'cat_total_outcomes') {
			var dog_ati = parseFloat($("#cat_lost_s").get(0).value);
			var cat_ati = parseFloat($("#cat_sub_out").get(0).value);
			
			return eval(dog_ati + cat_ati);

		} else if (id == 'total_outcomes') {
			var dog_ati = parseFloat($("#dog_total_outcomes").get(0).value);
			var cat_ati = parseFloat($("#cat_total_outcomes").get(0).value);
			
			return eval(dog_ati + cat_ati);

		
	
		
// ROW W
		} else if (id == 'dog_final_shelter_count') {
			
			// start 
			var dog_count_start = parseFloat($("#dog_count_start").get(0).value);
						
			// intake
			var d_ati = parseFloat($("#d_ati").get(0).value);
			
			// outcomes
			var dog_total_outcomes = parseFloat($("#dog_total_outcomes").get(0).value);
			
			var a_total = eval(dog_count_start + d_ati);
			return eval(a_total - dog_total_outcomes);
			
		} else if (id == 'cat_final_shelter_count') {
			// start 
			var cat_count_start = parseFloat($("#cat_count_start").get(0).value);
						
			// intake
			var c_ati = parseFloat($("#c_ati").get(0).value);
			
			// outcomes
			var cat_total_outcomes = parseFloat($("#cat_total_outcomes").get(0).value);
			
			var a_total = eval(cat_count_start + c_ati);
			return eval(a_total - cat_total_outcomes);
			
		} else if (id == 'final_shelter_count') {
			var dog_ati = parseFloat($("#dog_final_shelter_count").get(0).value);
			var cat_ati = parseFloat($("#cat_final_shelter_count").get(0).value);
			
			return eval(dog_ati + cat_ati);

		}
		
		
}




// HIGHLIGHT/FADE


function easeInOut(minValue,maxValue,totalSteps,actualStep,powr) {
	var delta = maxValue - minValue;
	var stepp = minValue+(Math.pow(((1 / totalSteps)*actualStep),powr)*delta);
	return Math.ceil(stepp)
}


	
function doBGFade(elem,startRGB,endRGB,finalColor,steps,intervals,powr) {
	elem = document.getElementById(elem);
	
	if (elem.bgFadeInt) window.clearInterval(elem.bgFadeInt);
	var actStep = 0;
	elem.bgFadeInt = window.setInterval(
		function() {
			elem.style.backgroundColor = "rgb("+
				easeInOut(startRGB[0],endRGB[0],steps,actStep,powr)+","+
				easeInOut(startRGB[1],endRGB[1],steps,actStep,powr)+","+
				easeInOut(startRGB[2],endRGB[2],steps,actStep,powr)+")";
			actStep++;
			if (actStep > steps) {
			elem.style.backgroundColor = finalColor;
			window.clearInterval(elem.bgFadeInt);
			}
		}
		,intervals)
}


// VALIDATE DATES

	function validateUSDate(strValue) {
	
	  var objRegExp = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/
	 
	  //check to see if in correct format
	  if(!objRegExp.test(strValue))
	  	
	  	
	    return false;
	    
	    
	    
	  else{
	    var strSeparator = strValue.substring(2,3) //find date separator
	    var arrayDate = strValue.split(strSeparator); //split date into month, day, year
	    //create a lookup for months not equal to Feb.
	    var arrayLookup = { '01' : 31,'03' : 31, '04' : 30,'05' : 31,'06' : 30,'07' : 31,
	                        '08' : 31,'09' : 30,'10' : 31,'11' : 30,'12' : 31}
	    var intDay = parseInt(arrayDate[1],10); 
	
	    //check if month value and day value agree
	    if(arrayLookup[arrayDate[0]] != null) {
	      if(intDay <= arrayLookup[arrayDate[0]] && intDay != 0)
	        return true; //found in lookup table, good date
	    }
	    
	    //check for February (bugfix 20050322)
	    //bugfix  for parseInt kevin
	    //bugfix  biss year  O.Jp Voutat
	    var intMonth = parseInt(arrayDate[0],10);
	    if (intMonth == 2) { 
	       var intYear = parseInt(arrayDate[2]);
	       if (intDay > 0 && intDay < 29) {
	           return true;
	       }
	       else if (intDay == 29) {
	         if ((intYear % 4 == 0) && (intYear % 100 != 0) || 
	             (intYear % 400 == 0)) {
	              // year div by 4 and ((not div by 100) or div by 400) ->ok
	             return true;
	         }   
	       }
	    }
	  }  
	  return false;
	}


// NUMERIC FIELDS

	$.fn.numeric = function(decimal, allowPaste)
	{
		this.keypress(
			function(e)
			{
				decimal = decimal || ".";
				allowPaste = allowPaste || true;
				var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
				var allow = false;
				// allow Ctrl+A
				if((e.ctrlKey && key == 97 /* firefox */) || key == 65 /* opera */) allow = true;
				// allow Ctrl+X (cut)
				if((e.ctrlKey && key == 120 /* firefox */) || key == 88 /* opera */) allow = true;
				// allow Ctrl+C (copy)
				if((e.ctrlKey && key == 99 /* firefox */) || key == 67 /* opera */) allow = true;
				// allow Ctrl+Z (undo)
				if((e.ctrlKey && key == 122 /* firefox */) || key == 90 /* opera */) allow = true;
				// allow or deny Ctrl+V (paste)
				if((e.ctrlKey && key == 118 /* firefox */) || key == 86 /* opera */)
				{
					allow = allowPaste;
				}
				// if a number was not pressed
				if(key < 48 || key > 57)
				{
					/* '-' only allowed at start */
					if(key == 45 && this.value.length == 0) return true;
					/* only one decimal separator allowed */
					if(key == decimal.charCodeAt(0) && this.value.indexOf(decimal) != -1)
					{
						allow = false;
					}
					// check for other keys that have special purposes
					if(
						key != 8 /* backspace */ &&
						key != 9 /* tab */ &&
						key != 13 /* enter */ &&
						key != 35 /* end */ &&
						key != 36 /* home */ &&
						key != 37 /* left */ &&
						key != 39 /* right */ &&
						key != 46 /* del */
					)
					{
						
						allow = false;
					}
					else
					{
						// for detecting special keys (listed above)
						// IE does not support 'charCode' and ignores them in keypress anyway
						if(typeof e.charCode != "undefined")
						{
							// special keys have 'keyCode' and 'which' the same (e.g. backspace)
							if(e.keyCode == e.which && e.which != 0)
							{
								allow = true;
							}
							// or keyCode != 0 and 'charCode'/'which' = 0
							else if(e.keyCode != 0 && e.charCode == 0 && e.which == 0)
							{
								allow = true;
							}
						}
					}
					// if key pressed is the decimal and it is not already in the field
					if(key == decimal.charCodeAt(0) && this.value.indexOf(decimal) == -1)
					{
						allow = true;
					}
				}
				else
				{
					allow = true;
				}
				return allow;
			}
		);
		return this;
	}



// FORMS

	$.fn.hoverClass = function(c) {
	    return this.each(function(){
	        $(this).hover( 
	            function() { $(this).addClass(c);  },
	            function() { $(this).removeClass(c); }
	        );
	    });
	};
	
	/**
 * SWFObject is (c) 2006 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(swf, id, w, h, ver, c, useExpressInstall, quality, xiRedirectUrl, redirectUrl, detectKey){
	if (!document.createElement || !document.getElementById) { return; }
	this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
	this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
	this.params = new Object();
	this.variables = new Object();
	this.attributes = new Array();
	if(swf) { this.setAttribute('swf', swf); }
	if(id) { this.setAttribute('id', id); }
	if(w) { this.setAttribute('width', w); }
	if(h) { this.setAttribute('height', h); }
	if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
	this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion(this.getAttribute('version'), useExpressInstall);
	if(c) { this.addParam('bgcolor', c); }
	var q = quality ? quality : 'high';
	this.addParam('quality', q);
	this.setAttribute('useExpressInstall', useExpressInstall);
	this.setAttribute('doExpressInstall', false);
	var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
	this.setAttribute('xiRedirectUrl', xir);
	this.setAttribute('redirectUrl', '');
	if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
}
deconcept.SWFObject.prototype = {
	setAttribute: function(name, value){
		this.attributes[name] = value;
	},
	getAttribute: function(name){
		return this.attributes[name];
	},
	addParam: function(name, value){
		this.params[name] = value;
	},
	getParams: function(){
		return this.params;
	},
	addVariable: function(name, value){
		this.variables[name] = value;
	},
	getVariable: function(name){
		return this.variables[name];
	},
	getVariables: function(){
		return this.variables;
	},
	getVariablePairs: function(){
		var variablePairs = new Array();
		var key;
		var variables = this.getVariables();
		for(key in variables){
			variablePairs.push(key +"="+ variables[key]);
		}
		return variablePairs;
	},
	getSWFHTML: function() {
		var swfNode = "";
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
			if (this.getAttribute("doExpressInstall")) this.addVariable("MMplayerType", "PlugIn");
			swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'"';
			swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
			var params = this.getParams();
			 for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
			var pairs = this.getVariablePairs().join("&");
			 if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
			swfNode += '/>';
		} else { // PC IE
			if (this.getAttribute("doExpressInstall")) this.addVariable("MMplayerType", "ActiveX");
			swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';
			swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
			var params = this.getParams();
			for(var key in params) {
			 swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
			}
			var pairs = this.getVariablePairs().join("&");
			if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
			swfNode += "</object>";
		}
		return swfNode;
	},
	write: function(elementId){
		if(this.getAttribute('useExpressInstall')) {
			// check to see if we need to do an express install
			var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
			if (this.installedVer.versionIsValid(expressInstallReqVer) && !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 elementId == 'string') ? document.getElementById(elementId) : elementId;
			n.innerHTML = this.getSWFHTML();
			return true;
		}else{
			if(this.getAttribute('redirectUrl') != "") {
				document.location.replace(this.getAttribute('redirectUrl'));
			}
		}
		return false;
	}
}

/* ---- detection functions ---- */
deconcept.SWFObjectUtil.getPlayerVersion = function(reqVer, xiInstall){
	var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
		}
	}else{
		try{
			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			for (var i=3; axo!=null; i++) {
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
				PlayerVersion = new deconcept.PlayerVersion([i,0,0]);
			}
		}catch(e){}
		if (reqVer && PlayerVersion.major > reqVer.major) return PlayerVersion; // version is ok, skip minor detection
		// this only does the minor rev lookup if the user's major version 
		// is not 6 or we are checking for a specific minor or revision number
		// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
		if (!reqVer || ((reqVer.minor != 0 || reqVer.rev != 0) && PlayerVersion.major == reqVer.major) || PlayerVersion.major != 6 || xiInstall) {
			try{
				PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
			}catch(e){}
		}
	}
	return PlayerVersion;
}
deconcept.PlayerVersion = function(arrVersion){
	this.major = parseInt(arrVersion[0]) != null ? parseInt(arrVersion[0]) : 0;
	this.minor = parseInt(arrVersion[1]) || 0;
	this.rev = parseInt(arrVersion[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;
}
/* ---- get value of query string param ---- */
deconcept.util = {
	getRequestParameter: function(param){
		var q = document.location.search || document.location.hash;
		if(q){
			var startIndex = q.indexOf(param +"=");
			var endIndex = (q.indexOf("&", startIndex) > -1) ? q.indexOf("&", startIndex) : q.length;
			if (q.length > 1 && startIndex > -1) {
				return q.substring(q.indexOf("=", startIndex)+1, endIndex);
			}
		}
		return "";
	}
}

/* add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}

/* add some aliases for ease of use/backwards compatibility */
var getQueryParamValue = deconcept.util.getRequestParameter;
var FlashObject = deconcept.SWFObject; // for legacy support
var SWFObject = deconcept.SWFObject;

