var dbits;var canary=244837814094590;var j_lm=((canary&16777215)==15715070);function BigInteger(B,A,C){if(B!=null){if("number"==typeof B){this.fromNumber(B,A,C)}else{if(A==null&&"string"!=typeof B){this.fromString(B,256)}else{this.fromString(B,A)}}}}function nbi(){return new BigInteger(null)}function am1(E,A,B,D,G,F){while(--F>=0){var C=A*this[E++]+B[D]+G;G=Math.floor(C/67108864);B[D++]=C&67108863}return G}function am2(E,J,K,D,H,A){var G=J&32767,I=J>>15;while(--A>=0){var C=this[E]&32767;var F=this[E++]>>15;var B=I*C+F*G;C=G*C+((B&32767)<<15)+K[D]+(H&1073741823);H=(C>>>30)+(B>>>15)+I*F+(H>>>30);K[D++]=C&1073741823}return H}function am3(E,J,K,D,H,A){var G=J&16383,I=J>>14;while(--A>=0){var C=this[E]&16383;var F=this[E++]>>14;var B=I*C+F*G;C=G*C+((B&16383)<<14)+K[D]+H;H=(C>>28)+(B>>14)+I*F;K[D++]=C&268435455}return H}if(j_lm&&(navigator.appName=="Microsoft Internet Explorer")){BigInteger.prototype.am=am2;dbits=30}else{if(j_lm&&(navigator.appName!="Netscape")){BigInteger.prototype.am=am1;dbits=26}else{BigInteger.prototype.am=am3;dbits=28}}BigInteger.prototype.DB=dbits;BigInteger.prototype.DM=((1<<dbits)-1);BigInteger.prototype.DV=(1<<dbits);var BI_FP=52;BigInteger.prototype.FV=Math.pow(2,BI_FP);BigInteger.prototype.F1=BI_FP-dbits;BigInteger.prototype.F2=2*dbits-BI_FP;var BI_RM="0123456789abcdefghijklmnopqrstuvwxyz";var BI_RC=new Array();var rr,vv;rr="0".charCodeAt(0);for(vv=0;vv<=9;++vv){BI_RC[rr++]=vv}rr="a".charCodeAt(0);for(vv=10;vv<36;++vv){BI_RC[rr++]=vv}rr="A".charCodeAt(0);for(vv=10;vv<36;++vv){BI_RC[rr++]=vv}function int2char(A){return BI_RM.charAt(A)}function intAt(B,A){var C=BI_RC[B.charCodeAt(A)];return(C==null)?-1:C}function bnpCopyTo(B){for(var A=this.t-1;A>=0;--A){B[A]=this[A]}B.t=this.t;B.s=this.s}function bnpFromInt(A){this.t=1;this.s=(A<0)?-1:0;if(A>0){this[0]=A}else{if(A<-1){this[0]=A+DV}else{this.t=0}}}function nbv(A){var B=nbi();B.fromInt(A);return B}function bnpFromString(G,B){var D;if(B==16){D=4}else{if(B==8){D=3}else{if(B==256){D=8}else{if(B==2){D=1}else{if(B==32){D=5}else{if(B==4){D=2}else{this.fromRadix(G,B);return }}}}}}this.t=0;this.s=0;var F=G.length,C=false,E=0;while(--F>=0){var A=(D==8)?G[F]&255:intAt(G,F);if(A<0){if(G.charAt(F)=="-"){C=true}continue}C=false;if(E==0){this[this.t++]=A}else{if(E+D>this.DB){this[this.t-1]|=(A&((1<<(this.DB-E))-1))<<E;this[this.t++]=(A>>(this.DB-E))}else{this[this.t-1]|=A<<E}}E+=D;if(E>=this.DB){E-=this.DB}}if(D==8&&(G[0]&128)!=0){this.s=-1;if(E>0){this[this.t-1]|=((1<<(this.DB-E))-1)<<E}}this.clamp();if(C){BigInteger.ZERO.subTo(this,this)}}function bnpClamp(){var A=this.s&this.DM;while(this.t>0&&this[this.t-1]==A){--this.t}}function bnToString(B){if(this.s<0){return"-"+this.negate().toString(B)}var C;if(B==16){C=4}else{if(B==8){C=3}else{if(B==2){C=1}else{if(B==32){C=5}else{if(B==4){C=2}else{return this.toRadix(B)}}}}}var E=(1<<C)-1,H,A=false,F="",D=this.t;var G=this.DB-(D*this.DB)%C;if(D-->0){if(G<this.DB&&(H=this[D]>>G)>0){A=true;F=int2char(H)}while(D>=0){if(G<C){H=(this[D]&((1<<G)-1))<<(C-G);H|=this[--D]>>(G+=this.DB-C)}else{H=(this[D]>>(G-=C))&E;if(G<=0){G+=this.DB;--D}}if(H>0){A=true}if(A){F+=int2char(H)}}}return A?F:"0"}function bnNegate(){var A=nbi();BigInteger.ZERO.subTo(this,A);return A}function bnAbs(){return(this.s<0)?this.negate():this}function bnCompareTo(A){var C=this.s-A.s;if(C!=0){return C}var B=this.t;C=B-A.t;if(C!=0){return C}while(--B>=0){if((C=this[B]-A[B])!=0){return C}}return 0}function nbits(A){var C=1,B;if((B=A>>>16)!=0){A=B;C+=16}if((B=A>>8)!=0){A=B;C+=8}if((B=A>>4)!=0){A=B;C+=4}if((B=A>>2)!=0){A=B;C+=2}if((B=A>>1)!=0){A=B;C+=1}return C}function bnBitLength(){if(this.t<=0){return 0}return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM))}function bnpDLShiftTo(C,B){var A;for(A=this.t-1;A>=0;--A){B[A+C]=this[A]}for(A=C-1;A>=0;--A){B[A]=0}B.t=this.t+C;B.s=this.s}function bnpDRShiftTo(C,B){for(var A=C;A<this.t;++A){B[A-C]=this[A]}B.t=Math.max(this.t-C,0);B.s=this.s}function bnpLShiftTo(H,D){var B=H%this.DB;var A=this.DB-B;var F=(1<<A)-1;var E=Math.floor(H/this.DB),G=(this.s<<B)&this.DM,C;for(C=this.t-1;C>=0;--C){D[C+E+1]=(this[C]>>A)|G;G=(this[C]&F)<<B}for(C=E-1;C>=0;--C){D[C]=0}D[E]=G;D.t=this.t+E+1;D.s=this.s;D.clamp()}function bnpRShiftTo(G,D){D.s=this.s;var E=Math.floor(G/this.DB);if(E>=this.t){D.t=0;return }var B=G%this.DB;var A=this.DB-B;var F=(1<<B)-1;D[0]=this[E]>>B;for(var C=E+1;C<this.t;++C){D[C-E-1]|=(this[C]&F)<<A;D[C-E]=this[C]>>B}if(B>0){D[this.t-E-1]|=(this.s&F)<<A}D.t=this.t-E;D.clamp()}function bnpSubTo(B,D){var C=0,E=0,A=Math.min(B.t,this.t);while(C<A){E+=this[C]-B[C];D[C++]=E&this.DM;E>>=this.DB}if(B.t<this.t){E-=B.s;while(C<this.t){E+=this[C];D[C++]=E&this.DM;E>>=this.DB}E+=this.s}else{E+=this.s;while(C<B.t){E-=B[C];D[C++]=E&this.DM;E>>=this.DB}E-=B.s}D.s=(E<0)?-1:0;if(E<-1){D[C++]=this.DV+E}else{if(E>0){D[C++]=E}}D.t=C;D.clamp()}function bnpMultiplyTo(B,D){var A=this.abs(),E=B.abs();var C=A.t;D.t=C+E.t;while(--C>=0){D[C]=0}for(C=0;C<E.t;++C){D[C+A.t]=A.am(0,E[C],D,C,0,A.t)}D.s=0;D.clamp();if(this.s!=B.s){BigInteger.ZERO.subTo(D,D)}}function bnpSquareTo(C){var A=this.abs();var B=C.t=2*A.t;while(--B>=0){C[B]=0}for(B=0;B<A.t-1;++B){var D=A.am(B,A[B],C,2*B,0,1);if((C[B+A.t]+=A.am(B+1,2*A[B],C,2*B+1,D,A.t-B-1))>=A.DV){C[B+A.t]-=A.DV;C[B+A.t+1]=1}}if(C.t>0){C[C.t-1]+=A.am(B,A[B],C,2*B,0,1)}C.s=0;C.clamp()}function bnpDivRemTo(J,G,F){var P=J.abs();if(P.t<=0){return }var H=this.abs();if(H.t<P.t){if(G!=null){G.fromInt(0)}if(F!=null){this.copyTo(F)}return }if(F==null){F=nbi()}var D=nbi(),A=this.s,I=J.s;var O=this.DB-nbits(P[P.t-1]);if(O>0){P.lShiftTo(O,D);H.lShiftTo(O,F)}else{P.copyTo(D);H.copyTo(F)}var L=D.t;var B=D[L-1];if(B==0){return }var K=B*(1<<this.F1)+((L>1)?D[L-2]>>this.F2:0);var S=this.FV/K,R=(1<<this.F1)/K,Q=1<<this.F2;var N=F.t,M=N-L,E=(G==null)?nbi():G;D.dlShiftTo(M,E);if(F.compareTo(E)>=0){F[F.t++]=1;F.subTo(E,F)}BigInteger.ONE.dlShiftTo(L,E);E.subTo(D,D);while(D.t<L){D[D.t++]=0}while(--M>=0){var C=(F[--N]==B)?this.DM:Math.floor(F[N]*S+(F[N-1]+Q)*R);if((F[N]+=D.am(0,C,F,M,0,L))<C){D.dlShiftTo(M,E);F.subTo(E,F);while(F[N]<--C){F.subTo(E,F)}}}if(G!=null){F.drShiftTo(L,G);if(A!=I){BigInteger.ZERO.subTo(G,G)}}F.t=L;F.clamp();if(O>0){F.rShiftTo(O,F)}if(A<0){BigInteger.ZERO.subTo(F,F)}}function bnMod(A){var B=nbi();this.abs().divRemTo(A,null,B);if(this.s<0&&B.compareTo(BigInteger.ZERO)>0){A.subTo(B,B)}return B}function Classic(A){this.m=A}function cConvert(A){if(A.s<0||A.compareTo(this.m)>=0){return A.mod(this.m)}else{return A}}function cRevert(A){return A}function cReduce(A){A.divRemTo(this.m,null,A)}function cMulTo(A,C,B){A.multiplyTo(C,B);this.reduce(B)}function cSqrTo(A,B){A.squareTo(B);this.reduce(B)}Classic.prototype.convert=cConvert;Classic.prototype.revert=cRevert;Classic.prototype.reduce=cReduce;Classic.prototype.mulTo=cMulTo;Classic.prototype.sqrTo=cSqrTo;function bnpInvDigit(){if(this.t<1){return 0}var A=this[0];if((A&1)==0){return 0}var B=A&3;B=(B*(2-(A&15)*B))&15;B=(B*(2-(A&255)*B))&255;B=(B*(2-(((A&65535)*B)&65535)))&65535;B=(B*(2-A*B%this.DV))%this.DV;return(B>0)?this.DV-B:-B}function Montgomery(A){this.m=A;this.mp=A.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<(A.DB-15))-1;this.mt2=2*A.t}function montConvert(A){var B=nbi();A.abs().dlShiftTo(this.m.t,B);B.divRemTo(this.m,null,B);if(A.s<0&&B.compareTo(BigInteger.ZERO)>0){this.m.subTo(B,B)}return B}function montRevert(A){var B=nbi();A.copyTo(B);this.reduce(B);return B}function montReduce(A){while(A.t<=this.mt2){A[A.t++]=0}for(var C=0;C<this.m.t;++C){var B=A[C]&32767;var D=(B*this.mpl+(((B*this.mph+(A[C]>>15)*this.mpl)&this.um)<<15))&A.DM;B=C+this.m.t;A[B]+=this.m.am(0,D,A,C,0,this.m.t);while(A[B]>=A.DV){A[B]-=A.DV;A[++B]++}}A.clamp();A.drShiftTo(this.m.t,A);if(A.compareTo(this.m)>=0){A.subTo(this.m,A)}}function montSqrTo(A,B){A.squareTo(B);this.reduce(B)}function montMulTo(A,C,B){A.multiplyTo(C,B);this.reduce(B)}Montgomery.prototype.convert=montConvert;Montgomery.prototype.revert=montRevert;Montgomery.prototype.reduce=montReduce;Montgomery.prototype.mulTo=montMulTo;Montgomery.prototype.sqrTo=montSqrTo;function bnpIsEven(){return((this.t>0)?(this[0]&1):this.s)==0}function bnpExp(F,G){if(F>4294967295||F<1){return BigInteger.ONE}var E=nbi(),A=nbi(),D=G.convert(this),C=nbits(F)-1;D.copyTo(E);while(--C>=0){G.sqrTo(E,A);if((F&(1<<C))>0){G.mulTo(A,D,E)}else{var B=E;E=A;A=B}}return G.revert(E)}function bnModPowInt(B,A){var C;if(B<256||A.isEven()){C=new Classic(A)}else{C=new Montgomery(A)}return this.exp(B,C)}BigInteger.prototype.copyTo=bnpCopyTo;BigInteger.prototype.fromInt=bnpFromInt;BigInteger.prototype.fromString=bnpFromString;BigInteger.prototype.clamp=bnpClamp;BigInteger.prototype.dlShiftTo=bnpDLShiftTo;BigInteger.prototype.drShiftTo=bnpDRShiftTo;BigInteger.prototype.lShiftTo=bnpLShiftTo;BigInteger.prototype.rShiftTo=bnpRShiftTo;BigInteger.prototype.subTo=bnpSubTo;BigInteger.prototype.multiplyTo=bnpMultiplyTo;BigInteger.prototype.squareTo=bnpSquareTo;BigInteger.prototype.divRemTo=bnpDivRemTo;BigInteger.prototype.invDigit=bnpInvDigit;BigInteger.prototype.isEven=bnpIsEven;BigInteger.prototype.exp=bnpExp;BigInteger.prototype.toString=bnToString;BigInteger.prototype.negate=bnNegate;BigInteger.prototype.abs=bnAbs;BigInteger.prototype.compareTo=bnCompareTo;BigInteger.prototype.bitLength=bnBitLength;BigInteger.prototype.mod=bnMod;BigInteger.prototype.modPowInt=bnModPowInt;BigInteger.ZERO=nbv(0);BigInteger.ONE=nbv(1);function bnClone(){var A=nbi();this.copyTo(A);return A}function bnIntValue(){if(this.s<0){if(this.t==1){return this[0]-this.DV}else{if(this.t==0){return -1}}}else{if(this.t==1){return this[0]}else{if(this.t==0){return 0}}}return((this[1]&((1<<(32-this.DB))-1))<<this.DB)|this[0]}function bnByteValue(){return(this.t==0)?this.s:(this[0]<<24)>>24}function bnShortValue(){return(this.t==0)?this.s:(this[0]<<16)>>16}function bnpChunkSize(A){return Math.floor(Math.LN2*this.DB/Math.log(A))}function bnSigNum(){if(this.s<0){return -1}else{if(this.t<=0||(this.t==1&&this[0]<=0)){return 0}else{return 1}}}function bnpToRadix(A){if(A==null){A=10}if(this.signum()==0||A<2||A>36){return"0"}var C=this.chunkSize(A);var B=Math.pow(A,C);var F=nbv(B),G=nbi(),E=nbi(),D="";this.divRemTo(F,G,E);while(G.signum()>0){D=(B+E.intValue()).toString(A).substr(1)+D;G.divRemTo(F,G,E)}return E.intValue().toString(A)+D}function bnpFromRadix(I,F){this.fromInt(0);if(F==null){F=10}var D=this.chunkSize(F);var E=Math.pow(F,D),C=false,A=0,H=0;for(var B=0;B<I.length;++B){var G=intAt(I,B);if(G<0){if(I.charAt(B)=="-"&&this.signum()==0){C=true}continue}H=F*H+G;if(++A>=D){this.dMultiply(E);this.dAddOffset(H,0);A=0;H=0}}if(A>0){this.dMultiply(Math.pow(F,A));this.dAddOffset(H,0)}if(C){BigInteger.ZERO.subTo(this,this)}}function bnpFromNumber(C,B,E){if("number"==typeof B){if(C<2){this.fromInt(1)}else{this.fromNumber(C,E);if(!this.testBit(C-1)){this.bitwiseTo(BigInteger.ONE.shiftLeft(C-1),op_or,this)}if(this.isEven()){this.dAddOffset(1,0)}while(!this.isProbablePrime(B)){this.dAddOffset(2,0);if(this.bitLength()>C){this.subTo(BigInteger.ONE.shiftLeft(C-1),this)}}}}else{var A=new Array(),D=C&7;A.length=(C>>3)+1;B.nextBytes(A);if(D>0){A[0]&=((1<<D)-1)}else{A[0]=0}this.fromString(A,256)}}function bnToByteArray(){var B=this.t,C=new Array();C[0]=this.s;var D=this.DB-(B*this.DB)%8,E,A=0;if(B-->0){if(D<this.DB&&(E=this[B]>>D)!=(this.s&this.DM)>>D){C[A++]=E|(this.s<<(this.DB-D))}while(B>=0){if(D<8){E=(this[B]&((1<<D)-1))<<(8-D);E|=this[--B]>>(D+=this.DB-8)}else{E=(this[B]>>(D-=8))&255;if(D<=0){D+=this.DB;--B}}if((E&128)!=0){E|=-256}if(A==0&&(this.s&128)!=(E&128)){++A}if(A>0||E!=this.s){C[A++]=E}}}return C}function bnEquals(A){return(this.compareTo(A)==0)}function bnMin(A){return(this.compareTo(A)<0)?this:A}function bnMax(A){return(this.compareTo(A)>0)?this:A}function bnpBitwiseTo(B,F,D){var C,E,A=Math.min(B.t,this.t);for(C=0;C<A;++C){D[C]=F(this[C],B[C])}if(B.t<this.t){E=B.s&this.DM;for(C=A;C<this.t;++C){D[C]=F(this[C],E)}D.t=this.t}else{E=this.s&this.DM;for(C=A;C<B.t;++C){D[C]=F(E,B[C])}D.t=B.t}D.s=F(this.s,B.s);D.clamp()}function op_and(A,B){return A&B}function bnAnd(A){var B=nbi();this.bitwiseTo(A,op_and,B);return B}function op_or(A,B){return A|B}function bnOr(A){var B=nbi();this.bitwiseTo(A,op_or,B);return B}function op_xor(A,B){return A^B}function bnXor(A){var B=nbi();this.bitwiseTo(A,op_xor,B);return B}function op_andnot(A,B){return A&~B}function bnAndNot(A){var B=nbi();this.bitwiseTo(A,op_andnot,B);return B}function bnNot(){var B=nbi();for(var A=0;A<this.t;++A){B[A]=this.DM&~this[A]}B.t=this.t;B.s=~this.s;return B}function bnShiftLeft(B){var A=nbi();if(B<0){this.rShiftTo(-B,A)}else{this.lShiftTo(B,A)}return A}function bnShiftRight(B){var A=nbi();if(B<0){this.lShiftTo(-B,A)}else{this.rShiftTo(B,A)}return A}function lbit(A){if(A==0){return -1}var B=0;if((A&65535)==0){A>>=16;B+=16}if((A&255)==0){A>>=8;B+=8}if((A&15)==0){A>>=4;B+=4}if((A&3)==0){A>>=2;B+=2}if((A&1)==0){++B}return B}function bnGetLowestSetBit(){for(var A=0;A<this.t;++A){if(this[A]!=0){return A*this.DB+lbit(this[A])}}if(this.s<0){return this.t*this.DB}return -1}function cbit(A){var B=0;while(A!=0){A&=A-1;++B}return B}function bnBitCount(){var C=0,A=this.s&this.DM;for(var B=0;B<this.t;++B){C+=cbit(this[B]^A)}return C}function bnTestBit(B){var A=Math.floor(B/this.DB);if(A>=this.t){return(this.s!=0)}return((this[A]&(1<<(B%this.DB)))!=0)}function bnpChangeBit(C,B){var A=BigInteger.ONE.shiftLeft(C);this.bitwiseTo(A,B,A);return A}function bnSetBit(A){return this.changeBit(A,op_or)}function bnClearBit(A){return this.changeBit(A,op_andnot)}function bnFlipBit(A){return this.changeBit(A,op_xor)}function bnpAddTo(B,D){var C=0,E=0,A=Math.min(B.t,this.t);while(C<A){E+=this[C]+B[C];D[C++]=E&this.DM;E>>=this.DB}if(B.t<this.t){E+=B.s;while(C<this.t){E+=this[C];D[C++]=E&this.DM;E>>=this.DB}E+=this.s}else{E+=this.s;while(C<B.t){E+=B[C];D[C++]=E&this.DM;E>>=this.DB}E+=B.s}D.s=(E<0)?-1:0;if(E>0){D[C++]=E}else{if(E<-1){D[C++]=this.DV+E}}D.t=C;D.clamp()}function bnAdd(A){var B=nbi();this.addTo(A,B);return B}function bnSubtract(A){var B=nbi();this.subTo(A,B);return B}function bnMultiply(A){var B=nbi();this.multiplyTo(A,B);return B}function bnDivide(A){var B=nbi();this.divRemTo(A,B,null);return B}function bnRemainder(A){var B=nbi();this.divRemTo(A,null,B);return B}function bnDivideAndRemainder(A){var C=nbi(),B=nbi();this.divRemTo(A,C,B);return new Array(C,B)}function bnpDMultiply(A){this[this.t]=this.am(0,A-1,this,0,0,this.t);++this.t;this.clamp()}function bnpDAddOffset(B,A){while(this.t<=A){this[this.t++]=0}this[A]+=B;while(this[A]>=this.DV){this[A]-=this.DV;if(++A>=this.t){this[this.t++]=0}++this[A]}}function NullExp(){}function nNop(A){return A}function nMulTo(A,C,B){A.multiplyTo(C,B)}function nSqrTo(A,B){A.squareTo(B)}NullExp.prototype.convert=nNop;NullExp.prototype.revert=nNop;NullExp.prototype.mulTo=nMulTo;NullExp.prototype.sqrTo=nSqrTo;function bnPow(A){return this.exp(A,new NullExp())}function bnpMultiplyLowerTo(A,E,D){var C=Math.min(this.t+A.t,E);D.s=0;D.t=C;while(C>0){D[--C]=0}var B;for(B=D.t-this.t;C<B;++C){D[C+this.t]=this.am(0,A[C],D,C,0,this.t)}for(B=Math.min(A.t,E);C<B;++C){this.am(0,A[C],D,C,0,E-C)}D.clamp()}function bnpMultiplyUpperTo(A,D,C){--D;var B=C.t=this.t+A.t-D;C.s=0;while(--B>=0){C[B]=0}for(B=Math.max(D-this.t,0);B<A.t;++B){C[this.t+B-D]=this.am(D-B,A[B],C,0,0,this.t+B-D)}C.clamp();C.drShiftTo(1,C)}function Barrett(A){this.r2=nbi();this.q3=nbi();BigInteger.ONE.dlShiftTo(2*A.t,this.r2);this.mu=this.r2.divide(A);this.m=A}function barrettConvert(A){if(A.s<0||A.t>2*this.m.t){return A.mod(this.m)}else{if(A.compareTo(this.m)<0){return A}else{var B=nbi();A.copyTo(B);this.reduce(B);return B}}}function barrettRevert(A){return A}function barrettReduce(A){A.drShiftTo(this.m.t-1,this.r2);if(A.t>this.m.t+1){A.t=this.m.t+1;A.clamp()}this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);while(A.compareTo(this.r2)<0){A.dAddOffset(1,this.m.t+1)}A.subTo(this.r2,A);while(A.compareTo(this.m)>=0){A.subTo(this.m,A)}}function barrettSqrTo(A,B){A.squareTo(B);this.reduce(B)}function barrettMulTo(A,C,B){A.multiplyTo(C,B);this.reduce(B)}Barrett.prototype.convert=barrettConvert;Barrett.prototype.revert=barrettRevert;Barrett.prototype.reduce=barrettReduce;Barrett.prototype.mulTo=barrettMulTo;Barrett.prototype.sqrTo=barrettSqrTo;function bnModPow(J,E){var H=J.bitLength(),F,B=nbv(1),M;if(H<=0){return B}else{if(H<18){F=1}else{if(H<48){F=3}else{if(H<144){F=4}else{if(H<768){F=5}else{F=6}}}}}if(H<8){M=new Classic(E)}else{if(E.isEven()){M=new Barrett(E)}else{M=new Montgomery(E)}}var I=new Array(),D=3,K=F-1,A=(1<<F)-1;I[1]=M.convert(this);if(F>1){var P=nbi();M.sqrTo(I[1],P);while(D<=A){I[D]=nbi();M.mulTo(P,I[D-2],I[D]);D+=2}}var G=J.t-1,N,L=true,C=nbi(),O;H=nbits(J[G])-1;while(G>=0){if(H>=K){N=(J[G]>>(H-K))&A}else{N=(J[G]&((1<<(H+1))-1))<<(K-H);if(G>0){N|=J[G-1]>>(this.DB+H-K)}}D=F;while((N&1)==0){N>>=1;--D}if((H-=D)<0){H+=this.DB;--G}if(L){I[N].copyTo(B);L=false}else{while(D>1){M.sqrTo(B,C);M.sqrTo(C,B);D-=2}if(D>0){M.sqrTo(B,C)}else{O=B;B=C;C=O}M.mulTo(C,I[N],B)}while(G>=0&&(J[G]&(1<<H))==0){M.sqrTo(B,C);O=B;B=C;C=O;if(--H<0){H=this.DB-1;--G}}}return M.revert(B)}function bnGCD(B){var A=(this.s<0)?this.negate():this.clone();var F=(B.s<0)?B.negate():B.clone();if(A.compareTo(F)<0){var D=A;A=F;F=D}var C=A.getLowestSetBit(),E=F.getLowestSetBit();if(E<0){return A}if(C<E){E=C}if(E>0){A.rShiftTo(E,A);F.rShiftTo(E,F)}while(A.signum()>0){if((C=A.getLowestSetBit())>0){A.rShiftTo(C,A)}if((C=F.getLowestSetBit())>0){F.rShiftTo(C,F)}if(A.compareTo(F)>=0){A.subTo(F,A);A.rShiftTo(1,A)}else{F.subTo(A,F);F.rShiftTo(1,F)}}if(E>0){F.lShiftTo(E,F)}return F}function bnpModInt(D){if(D<=0){return 0}var C=this.DV%D,B=(this.s<0)?D-1:0;if(this.t>0){if(C==0){B=this[0]%D}else{for(var A=this.t-1;A>=0;--A){B=(C*B+this[A])%D}}}return B}function bnModInverse(B){var F=B.isEven();if((this.isEven()&&F)||B.signum()==0){return BigInteger.ZERO}var E=B.clone(),D=this.clone();var C=nbv(1),A=nbv(0),H=nbv(0),G=nbv(1);while(E.signum()!=0){while(E.isEven()){E.rShiftTo(1,E);if(F){if(!C.isEven()||!A.isEven()){C.addTo(this,C);A.subTo(B,A)}C.rShiftTo(1,C)}else{if(!A.isEven()){A.subTo(B,A)}}A.rShiftTo(1,A)}while(D.isEven()){D.rShiftTo(1,D);if(F){if(!H.isEven()||!G.isEven()){H.addTo(this,H);G.subTo(B,G)}H.rShiftTo(1,H)}else{if(!G.isEven()){G.subTo(B,G)}}G.rShiftTo(1,G)}if(E.compareTo(D)>=0){E.subTo(D,E);if(F){C.subTo(H,C)}A.subTo(G,A)}else{D.subTo(E,D);if(F){H.subTo(C,H)}G.subTo(A,G)}}if(D.compareTo(BigInteger.ONE)!=0){return BigInteger.ZERO}if(G.compareTo(B)>=0){return G.subtract(B)}if(G.signum()<0){G.addTo(B,G)}else{return G}if(G.signum()<0){return G.add(B)}else{return G}}var lowprimes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509];var lplim=(1<<26)/lowprimes[lowprimes.length-1];function bnIsProbablePrime(E){var D,B=this.abs();if(B.t==1&&B[0]<=lowprimes[lowprimes.length-1]){for(D=0;D<lowprimes.length;++D){if(B[0]==lowprimes[D]){return true}}return false}if(B.isEven()){return false}D=1;while(D<lowprimes.length){var A=lowprimes[D],C=D+1;while(C<lowprimes.length&&A<lplim){A*=lowprimes[C++]}A=B.modInt(A);while(D<C){if(A%lowprimes[D++]==0){return false}}}return B.millerRabin(E)}function bnpMillerRabin(E){var F=this.subtract(BigInteger.ONE);var B=F.getLowestSetBit();if(B<=0){return false}var G=F.shiftRight(B);E=(E+1)>>1;if(E>lowprimes.length){E=lowprimes.length}var A=nbi();for(var D=0;D<E;++D){A.fromInt(lowprimes[D]);var H=A.modPow(G,this);if(H.compareTo(BigInteger.ONE)!=0&&H.compareTo(F)!=0){var C=1;while(C++<B&&H.compareTo(F)!=0){H=H.modPowInt(2,this);if(H.compareTo(BigInteger.ONE)==0){return false}}if(H.compareTo(F)!=0){return false}}}return true}BigInteger.prototype.chunkSize=bnpChunkSize;BigInteger.prototype.toRadix=bnpToRadix;BigInteger.prototype.fromRadix=bnpFromRadix;BigInteger.prototype.fromNumber=bnpFromNumber;BigInteger.prototype.bitwiseTo=bnpBitwiseTo;BigInteger.prototype.changeBit=bnpChangeBit;BigInteger.prototype.addTo=bnpAddTo;BigInteger.prototype.dMultiply=bnpDMultiply;BigInteger.prototype.dAddOffset=bnpDAddOffset;BigInteger.prototype.multiplyLowerTo=bnpMultiplyLowerTo;BigInteger.prototype.multiplyUpperTo=bnpMultiplyUpperTo;BigInteger.prototype.modInt=bnpModInt;BigInteger.prototype.millerRabin=bnpMillerRabin;BigInteger.prototype.clone=bnClone;BigInteger.prototype.intValue=bnIntValue;BigInteger.prototype.byteValue=bnByteValue;BigInteger.prototype.shortValue=bnShortValue;BigInteger.prototype.signum=bnSigNum;BigInteger.prototype.toByteArray=bnToByteArray;BigInteger.prototype.equals=bnEquals;BigInteger.prototype.min=bnMin;BigInteger.prototype.max=bnMax;BigInteger.prototype.and=bnAnd;BigInteger.prototype.or=bnOr;BigInteger.prototype.xor=bnXor;BigInteger.prototype.andNot=bnAndNot;BigInteger.prototype.not=bnNot;BigInteger.prototype.shiftLeft=bnShiftLeft;BigInteger.prototype.shiftRight=bnShiftRight;BigInteger.prototype.getLowestSetBit=bnGetLowestSetBit;BigInteger.prototype.bitCount=bnBitCount;BigInteger.prototype.testBit=bnTestBit;BigInteger.prototype.setBit=bnSetBit;BigInteger.prototype.clearBit=bnClearBit;BigInteger.prototype.flipBit=bnFlipBit;BigInteger.prototype.add=bnAdd;BigInteger.prototype.subtract=bnSubtract;BigInteger.prototype.multiply=bnMultiply;BigInteger.prototype.divide=bnDivide;BigInteger.prototype.remainder=bnRemainder;BigInteger.prototype.divideAndRemainder=bnDivideAndRemainder;BigInteger.prototype.modPow=bnModPow;BigInteger.prototype.modInverse=bnModInverse;BigInteger.prototype.pow=bnPow;BigInteger.prototype.gcd=bnGCD;BigInteger.prototype.isProbablePrime=bnIsProbablePrime;var Prototype={Version:"1.7",Browser:(function(){var B=navigator.userAgent;var A=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!A,Opera:A,WebKit:B.indexOf("AppleWebKit/")>-1,Gecko:B.indexOf("Gecko")>-1&&B.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile/.test(B)}})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var A=window.Element||window.HTMLElement;return !!(A&&A.prototype)})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true}var C=document.createElement("div"),B=document.createElement("form"),A=false;if(C["__proto__"]&&(C["__proto__"]!==B["__proto__"])){A=true}C=B=null;return A})()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(A){return A}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Abstract={};var Try={these:function(){var C;for(var B=0,D=arguments.length;B<D;B++){var A=arguments[B];try{C=A();break}catch(E){}}return C}};var Class=(function(){var D=(function(){for(var E in {toString:1}){if(E==="toString"){return false}}return true})();function A(){}function B(){var H=null,G=$A(arguments);if(Object.isFunction(G[0])){H=G.shift()}function E(){this.initialize.apply(this,arguments)}Object.extend(E,Class.Methods);E.superclass=H;E.subclasses=[];if(H){A.prototype=H.prototype;E.prototype=new A;H.subclasses.push(E)}for(var F=0,I=G.length;F<I;F++){E.addMethods(G[F])}if(!E.prototype.initialize){E.prototype.initialize=Prototype.emptyFunction}E.prototype.constructor=E;return E}function C(K){var G=this.superclass&&this.superclass.prototype,F=Object.keys(K);if(D){if(K.toString!=Object.prototype.toString){F.push("toString")}if(K.valueOf!=Object.prototype.valueOf){F.push("valueOf")}}for(var E=0,H=F.length;E<H;E++){var J=F[E],I=K[J];if(G&&Object.isFunction(I)&&I.argumentNames()[0]=="$super"){var L=I;I=(function(M){return function(){return G[M].apply(this,arguments)}})(J).wrap(L);I.valueOf=L.valueOf.bind(L);I.toString=L.toString.bind(L)}this.prototype[J]=I}return this}return{create:B,Methods:{addMethods:C}}})();(function(){var d=Object.prototype.toString,c="Null",O="Undefined",V="Boolean",F="Number",S="String",j="Object",T="[object Function]",Y="[object Boolean]",G="[object Number]",L="[object String]",H="[object Array]",X="[object Date]",I=window.JSON&&typeof JSON.stringify==="function"&&JSON.stringify(0)==="0"&&typeof JSON.stringify(Prototype.K)==="undefined";function K(l){switch(l){case null:return c;case (void 0):return O}var k=typeof l;switch(k){case"boolean":return V;case"number":return F;case"string":return S}return j}function Z(k,m){for(var l in m){k[l]=m[l]}return k}function h(k){try{if(C(k)){return"undefined"}if(k===null){return"null"}return k.inspect?k.inspect():String(k)}catch(l){if(l instanceof RangeError){return"..."}throw l}}function e(k){return g("",{"":k},[])}function g(t,q,r){var s=q[t],p=typeof s;if(K(s)===j&&typeof s.toJSON==="function"){s=s.toJSON(t)}var m=d.call(s);switch(m){case G:case Y:case L:s=s.valueOf()}switch(s){case null:return"null";case true:return"true";case false:return"false"}p=typeof s;switch(p){case"string":return s.inspect(true);case"number":return isFinite(s)?String(s):"null";case"object":for(var l=0,k=r.length;l<k;l++){if(r[l]===s){throw new TypeError()}}r.push(s);var o=[];if(m===H){for(var l=0,k=s.length;l<k;l++){var n=g(l,s,r);o.push(typeof n==="undefined"?"null":n)}o="["+o.join(",")+"]"}else{var u=Object.keys(s);for(var l=0,k=u.length;l<k;l++){var t=u[l],n=g(t,s,r);if(typeof n!=="undefined"){o.push(t.inspect(true)+":"+n)}}o="{"+o.join(",")+"}"}r.pop();return o}}function W(k){return JSON.stringify(k)}function J(k){return $H(k).toQueryString()}function P(k){return k&&k.toHTML?k.toHTML():String.interpret(k)}function R(k){if(K(k)!==j){throw new TypeError()}var l=[];for(var m in k){if(k.hasOwnProperty(m)){l.push(m)}}return l}function D(k){var l=[];for(var m in k){l.push(k[m])}return l}function b(k){return Z({},k)}function U(k){return !!(k&&k.nodeType==1)}function M(k){return d.call(k)===H}var B=(typeof Array.isArray=="function")&&Array.isArray([])&&!Array.isArray({});if(B){M=Array.isArray}function E(k){return k instanceof Hash}function A(k){return d.call(k)===T}function N(k){return d.call(k)===L}function Q(k){return d.call(k)===G}function f(k){return d.call(k)===X}function C(k){return typeof k==="undefined"}Z(Object,{extend:Z,inspect:h,toJSON:I?W:e,toQueryString:J,toHTML:P,keys:Object.keys||R,values:D,clone:b,isElement:U,isArray:M,isHash:E,isFunction:A,isString:N,isNumber:Q,isDate:f,isUndefined:C})})();Object.extend(Function.prototype,(function(){var K=Array.prototype.slice;function D(O,L){var N=O.length,M=L.length;while(M--){O[N+M]=L[M]}return O}function I(M,L){M=K.call(M,0);return D(M,L)}function G(){var L=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g,"").replace(/\s+/g,"").split(",");return L.length==1&&!L[0]?[]:L}function H(N){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this}var L=this,M=K.call(arguments,1);return function(){var O=I(M,arguments);return L.apply(N,O)}}function F(N){var L=this,M=K.call(arguments,1);return function(P){var O=D([P||window.event],M);return L.apply(N,O)}}function J(){if(!arguments.length){return this}var L=this,M=K.call(arguments,0);return function(){var N=I(M,arguments);return L.apply(this,N)}}function E(N){var L=this,M=K.call(arguments,1);N=N*1000;return window.setTimeout(function(){return L.apply(L,M)},N)}function A(){var L=D([0.01],arguments);return this.delay.apply(this,L)}function C(M){var L=this;return function(){var N=D([L.bind(this)],arguments);return M.apply(this,N)}}function B(){if(this._methodized){return this._methodized}var L=this;return this._methodized=function(){var M=D([this],arguments);return L.apply(null,M)}}return{argumentNames:G,bind:H,bindAsEventListener:F,curry:J,delay:E,defer:A,wrap:C,methodize:B}})());(function(C){function B(){return this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+"Z"}function A(){return this.toISOString()}if(!C.toISOString){C.toISOString=B}if(!C.toJSON){C.toJSON=A}})(Date.prototype);RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(A){return String(A).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};var PeriodicalExecuter=Class.create({initialize:function(B,A){this.callback=B;this.frequency=A;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},execute:function(){this.callback(this)},stop:function(){if(!this.timer){return }clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute();this.currentlyExecuting=false}catch(A){this.currentlyExecuting=false;throw A}}}});Object.extend(String,{interpret:function(A){return A==null?"":String(A)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,(function(){var NATIVE_JSON_PARSE_SUPPORT=window.JSON&&typeof JSON.parse==="function"&&JSON.parse('{"test": true}').test;function prepareReplacement(replacement){if(Object.isFunction(replacement)){return replacement}var template=new Template(replacement);return function(match){return template.evaluate(match)}}function gsub(pattern,replacement){var result="",source=this,match;replacement=prepareReplacement(replacement);if(Object.isString(pattern)){pattern=RegExp.escape(pattern)}if(!(pattern.length||pattern.source)){replacement=replacement("");return replacement+source.split("").join(replacement)+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}function sub(pattern,replacement,count){replacement=prepareReplacement(replacement);count=Object.isUndefined(count)?1:count;return this.gsub(pattern,function(match){if(--count<0){return match[0]}return replacement(match)})}function scan(pattern,iterator){this.gsub(pattern,iterator);return String(this)}function truncate(length,truncation){length=length||30;truncation=Object.isUndefined(truncation)?"...":truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this)}function strip(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}function stripTags(){return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,"")}function stripScripts(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")}function extractScripts(){var matchAll=new RegExp(Prototype.ScriptFragment,"img"),matchOne=new RegExp(Prototype.ScriptFragment,"im");return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||["",""])[1]})}function evalScripts(){return this.extractScripts().map(function(script){return eval(script)})}function escapeHTML(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function unescapeHTML(){return this.stripTags().replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}function toQueryParams(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()),value=pair.length>1?pair.join("="):pair[0];if(value!=undefined){value=decodeURIComponent(value)}if(key in hash){if(!Object.isArray(hash[key])){hash[key]=[hash[key]]}hash[key].push(value)}else{hash[key]=value}}return hash})}function toArray(){return this.split("")}function succ(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)}function times(count){return count<1?"":new Array(count+1).join(this)}function camelize(){return this.replace(/-+(.)?/g,function(match,chr){return chr?chr.toUpperCase():""})}function capitalize(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()}function underscore(){return this.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/-/g,"_").toLowerCase()}function dasherize(){return this.replace(/_/g,"-")}function inspect(useDoubleQuotes){var escapedString=this.replace(/[\x00-\x1f\\]/g,function(character){if(character in String.specialChar){return String.specialChar[character]}return"\\u00"+character.charCodeAt().toPaddedString(2,16)});if(useDoubleQuotes){return'"'+escapedString.replace(/"/g,'\\"')+'"'}return"'"+escapedString.replace(/'/g,"\\'")+"'"}function unfilterJSON(filter){return this.replace(filter||Prototype.JSONFilter,"$1")}function isJSON(){var str=this;if(str.blank()){return false}str=str.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@");str=str.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]");str=str.replace(/(?:^|:|,)(?:\s*\[)+/g,"");return(/^[\],:{}\s]*$/).test(str)}function evalJSON(sanitize){var json=this.unfilterJSON(),cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;if(cx.test(json)){json=json.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())}function parseJSON(){var json=this.unfilterJSON();return JSON.parse(json)}function include(pattern){return this.indexOf(pattern)>-1}function startsWith(pattern){return this.lastIndexOf(pattern,0)===0}function endsWith(pattern){var d=this.length-pattern.length;return d>=0&&this.indexOf(pattern,d)===d}function empty(){return this==""}function blank(){return/^\s*$/.test(this)}function interpolate(object,pattern){return new Template(this,pattern).evaluate(object)}return{gsub:gsub,sub:sub,scan:scan,truncate:truncate,strip:String.prototype.trim||strip,stripTags:stripTags,stripScripts:stripScripts,extractScripts:extractScripts,evalScripts:evalScripts,escapeHTML:escapeHTML,unescapeHTML:unescapeHTML,toQueryParams:toQueryParams,parseQuery:toQueryParams,toArray:toArray,succ:succ,times:times,camelize:camelize,capitalize:capitalize,underscore:underscore,dasherize:dasherize,inspect:inspect,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON:NATIVE_JSON_PARSE_SUPPORT?parseJSON:evalJSON,include:include,startsWith:startsWith,endsWith:endsWith,empty:empty,blank:blank,interpolate:interpolate}})());var Template=Class.create({initialize:function(A,B){this.template=A.toString();this.pattern=B||Template.Pattern},evaluate:function(A){if(A&&Object.isFunction(A.toTemplateReplacements)){A=A.toTemplateReplacements()}return this.template.gsub(this.pattern,function(D){if(A==null){return(D[1]+"")}var F=D[1]||"";if(F=="\\"){return D[2]}var B=A,G=D[3],E=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;D=E.exec(G);if(D==null){return F}while(D!=null){var C=D[1].startsWith("[")?D[2].replace(/\\\\]/g,"]"):D[1];B=B[C];if(null==B||""==D[3]){break}G=G.substring("["==D[3]?D[1].length:D[0].length);D=E.exec(G)}return F+String.interpret(B)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable=(function(){function C(Y,X){var W=0;try{this._each(function(b){Y.call(X,b,W++)})}catch(Z){if(Z!=$break){throw Z}}return this}function R(Z,Y,X){var W=-Z,b=[],c=this.toArray();if(Z<1){return c}while((W+=Z)<c.length){b.push(c.slice(W,W+Z))}return b.collect(Y,X)}function B(Y,X){Y=Y||Prototype.K;var W=true;this.each(function(b,Z){W=W&&!!Y.call(X,b,Z);if(!W){throw $break}});return W}function I(Y,X){Y=Y||Prototype.K;var W=false;this.each(function(b,Z){if(W=!!Y.call(X,b,Z)){throw $break}});return W}function J(Y,X){Y=Y||Prototype.K;var W=[];this.each(function(b,Z){W.push(Y.call(X,b,Z))});return W}function T(Y,X){var W;this.each(function(b,Z){if(Y.call(X,b,Z)){W=b;throw $break}});return W}function H(Y,X){var W=[];this.each(function(b,Z){if(Y.call(X,b,Z)){W.push(b)}});return W}function G(Z,Y,X){Y=Y||Prototype.K;var W=[];if(Object.isString(Z)){Z=new RegExp(RegExp.escape(Z))}this.each(function(c,b){if(Z.match(c)){W.push(Y.call(X,c,b))}});return W}function A(W){if(Object.isFunction(this.indexOf)){if(this.indexOf(W)!=-1){return true}}var X=false;this.each(function(Y){if(Y==W){X=true;throw $break}});return X}function Q(X,W){W=Object.isUndefined(W)?null:W;return this.eachSlice(X,function(Y){while(Y.length<X){Y.push(W)}return Y})}function L(W,Y,X){this.each(function(b,Z){W=Y.call(X,W,b,Z)});return W}function V(X){var W=$A(arguments).slice(1);return this.map(function(Y){return Y[X].apply(Y,W)})}function P(Y,X){Y=Y||Prototype.K;var W;this.each(function(b,Z){b=Y.call(X,b,Z);if(W==null||b>=W){W=b}});return W}function N(Y,X){Y=Y||Prototype.K;var W;this.each(function(b,Z){b=Y.call(X,b,Z);if(W==null||b<W){W=b}});return W}function E(Z,X){Z=Z||Prototype.K;var Y=[],W=[];this.each(function(c,b){(Z.call(X,c,b)?Y:W).push(c)});return[Y,W]}function F(X){var W=[];this.each(function(Y){W.push(Y[X])});return W}function D(Y,X){var W=[];this.each(function(b,Z){if(!Y.call(X,b,Z)){W.push(b)}});return W}function M(X,W){return this.map(function(Z,Y){return{value:Z,criteria:X.call(W,Z,Y)}}).sort(function(d,c){var Z=d.criteria,Y=c.criteria;return Z<Y?-1:Z>Y?1:0}).pluck("value")}function O(){return this.map()}function S(){var X=Prototype.K,W=$A(arguments);if(Object.isFunction(W.last())){X=W.pop()}var Y=[this].concat(W).map($A);return this.map(function(b,Z){return X(Y.pluck(Z))})}function K(){return this.toArray().length}function U(){return"#<Enumerable:"+this.toArray().inspect()+">"}return{each:C,eachSlice:R,all:B,every:B,any:I,some:I,collect:J,map:J,detect:T,findAll:H,select:H,filter:H,grep:G,include:A,member:A,inGroupsOf:Q,inject:L,invoke:V,max:P,min:N,partition:E,pluck:F,reject:D,sortBy:M,toArray:O,entries:O,zip:S,size:K,inspect:U,find:T}})();function $A(C){if(!C){return[]}if("toArray" in Object(C)){return C.toArray()}var B=C.length||0,A=new Array(B);while(B--){A[B]=C[B]}return A}function $w(A){if(!Object.isString(A)){return[]}A=A.strip();return A?A.split(/\s+/):[]}Array.from=$A;(function(){var R=Array.prototype,M=R.slice,O=R.forEach;function B(W,V){for(var U=0,X=this.length>>>0;U<X;U++){if(U in this){W.call(V,this[U],U,this)}}}if(!O){O=B}function L(){this.length=0;return this}function D(){return this[0]}function G(){return this[this.length-1]}function I(){return this.select(function(U){return U!=null})}function T(){return this.inject([],function(V,U){if(Object.isArray(U)){return V.concat(U.flatten())}V.push(U);return V})}function H(){var U=M.call(arguments,0);return this.select(function(V){return !U.include(V)})}function F(U){return(U===false?this.toArray():this)._reverse()}function K(U){return this.inject([],function(X,W,V){if(0==V||(U?X.last()!=W:!X.include(W))){X.push(W)}return X})}function P(U){return this.uniq().findAll(function(V){return U.detect(function(W){return V===W})})}function Q(){return M.call(this,0)}function J(){return this.length}function S(){return"["+this.map(Object.inspect).join(", ")+"]"}function A(W,U){U||(U=0);var V=this.length;if(U<0){U=V+U}for(;U<V;U++){if(this[U]===W){return U}}return -1}function N(V,U){U=isNaN(U)?this.length:(U<0?this.length+U:U)+1;var W=this.slice(0,U).reverse().indexOf(V);return(W<0)?W:U-W-1}function C(){var Z=M.call(this,0),X;for(var V=0,W=arguments.length;V<W;V++){X=arguments[V];if(Object.isArray(X)&&!("callee" in X)){for(var U=0,Y=X.length;U<Y;U++){Z.push(X[U])}}else{Z.push(X)}}return Z}Object.extend(R,Enumerable);if(!R._reverse){R._reverse=R.reverse}Object.extend(R,{_each:O,clear:L,first:D,last:G,compact:I,flatten:T,without:H,reverse:F,uniq:K,intersect:P,clone:Q,toArray:Q,size:J,inspect:S});var E=(function(){return[].concat(arguments)[0][0]!==1})(1,2);if(E){R.concat=C}if(!R.indexOf){R.indexOf=A}if(!R.lastIndexOf){R.lastIndexOf=N}})();function $H(A){return new Hash(A)}var Hash=Class.create(Enumerable,(function(){function E(P){this._object=Object.isHash(P)?P.toObject():Object.clone(P)}function F(Q){for(var P in this._object){var R=this._object[P],S=[P,R];S.key=P;S.value=R;Q(S)}}function J(P,Q){return this._object[P]=Q}function C(P){if(this._object[P]!==Object.prototype[P]){return this._object[P]}}function M(P){var Q=this._object[P];delete this._object[P];return Q}function O(){return Object.clone(this._object)}function N(){return this.pluck("key")}function L(){return this.pluck("value")}function G(Q){var P=this.detect(function(R){return R.value===Q});return P&&P.key}function I(P){return this.clone().update(P)}function D(P){return new Hash(P).inject(this,function(Q,R){Q.set(R.key,R.value);return Q})}function B(P,Q){if(Object.isUndefined(Q)){return P}return P+"="+encodeURIComponent(String.interpret(Q))}function A(){return this.inject([],function(T,W){var S=encodeURIComponent(W.key),Q=W.value;if(Q&&typeof Q=="object"){if(Object.isArray(Q)){var V=[];for(var R=0,P=Q.length,U;R<P;R++){U=Q[R];V.push(B(S,U))}return T.concat(V)}}else{T.push(B(S,Q))}return T}).join("&")}function K(){return"#<Hash:{"+this.map(function(P){return P.map(Object.inspect).join(": ")}).join(", ")+"}>"}function H(){return new Hash(this)}return{initialize:E,_each:F,set:J,get:C,unset:M,toObject:O,toTemplateReplacements:O,keys:N,values:L,index:G,merge:I,update:D,toQueryString:A,inspect:K,toJSON:O,clone:H}})());Hash.from=$H;Object.extend(Number.prototype,(function(){function D(){return this.toPaddedString(2,16)}function B(){return this+1}function H(J,I){$R(0,this,true).each(J,I);return this}function G(K,J){var I=this.toString(J||10);return"0".times(K-I.length)+I}function A(){return Math.abs(this)}function C(){return Math.round(this)}function E(){return Math.ceil(this)}function F(){return Math.floor(this)}return{toColorPart:D,succ:B,times:H,toPaddedString:G,abs:A,round:C,ceil:E,floor:F}})());function $R(C,A,B){return new ObjectRange(C,A,B)}var ObjectRange=Class.create(Enumerable,(function(){function B(F,D,E){this.start=F;this.end=D;this.exclusive=E}function C(D){var E=this.start;while(this.include(E)){D(E);E=E.succ()}}function A(D){if(D<this.start){return false}if(this.exclusive){return D<this.end}return D<=this.end}return{initialize:B,_each:C,include:A}})());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(A){this.responders._each(A)},register:function(A){if(!this.include(A)){this.responders.push(A)}},unregister:function(A){this.responders=this.responders.without(A)},dispatch:function(D,B,C,A){this.each(function(E){if(Object.isFunction(E[D])){try{E[D].apply(E,[B,C,A])}catch(F){}}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(A){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:true,evalJS:true};Object.extend(this.options,A||{});this.options.method=this.options.method.toLowerCase();if(Object.isHash(this.options.parameters)){this.options.parameters=this.options.parameters.toObject()}}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,B,A){$super(A);this.transport=Ajax.getTransport();this.request(B)},request:function(B){this.url=B;this.method=this.options.method;var D=Object.isString(this.options.parameters)?this.options.parameters:Object.toQueryString(this.options.parameters);if(!["get","post"].include(this.method)){D+=(D?"&":"")+"_method="+this.method;this.method="post"}if(D&&this.method==="get"){this.url+=(this.url.include("?")?"&":"?")+D}this.parameters=D.toQueryParams();try{var A=new Ajax.Response(this);if(this.options.onCreate){this.options.onCreate(A)}Ajax.Responders.dispatch("onCreate",this,A);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){this.respondToReadyState.bind(this).defer(1)}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=="post"?(this.options.postBody||D):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(C){this.dispatchException(C)}},onStateChange:function(){var A=this.transport.readyState;if(A>1&&!((A==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var E={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,"Accept":"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){E["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){E["Connection"]="close"}}if(typeof this.options.requestHeaders=="object"){var C=this.options.requestHeaders;if(Object.isFunction(C.push)){for(var B=0,D=C.length;B<D;B+=2){E[C[B]]=C[B+1]}}else{$H(C).each(function(F){E[F.key]=F.value})}}for(var A in E){this.transport.setRequestHeader(A,E[A])}},success:function(){var A=this.getStatus();return !A||(A>=200&&A<300)||A==304},getStatus:function(){try{if(this.transport.status===1223){return 204}return this.transport.status||0}catch(A){return 0}},respondToReadyState:function(A){var C=Ajax.Request.Events[A],B=new Ajax.Response(this);if(C=="Complete"){try{this._complete=true;(this.options["on"+B.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(B,B.headerJSON)}catch(D){this.dispatchException(D)}var E=B.getHeader("Content-type");if(this.options.evalJS=="force"||(this.options.evalJS&&this.isSameOrigin()&&E&&E.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))){this.evalResponse()}}try{(this.options["on"+C]||Prototype.emptyFunction)(B,B.headerJSON);Ajax.Responders.dispatch("on"+C,this,B,B.headerJSON)}catch(D){this.dispatchException(D)}if(C=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}},isSameOrigin:function(){var A=this.url.match(/^\s*https?:\/\/[^\/]*/);return !A||(A[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""}))},getHeader:function(A){try{return this.transport.getResponseHeader(A)||null}catch(B){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(A){(this.options.onException||Prototype.emptyFunction)(this,A);Ajax.Responders.dispatch("onException",this,A)}});Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Response=Class.create({initialize:function(C){this.request=C;var D=this.transport=C.transport,A=this.readyState=D.readyState;if((A>2&&!Prototype.Browser.IE)||A==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(D.responseText);this.headerJSON=this._getHeaderJSON()}if(A==4){var B=D.responseXML;this.responseXML=Object.isUndefined(B)?null:B;this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""}catch(A){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(A){return null}},getResponseHeader:function(A){return this.transport.getResponseHeader(A)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var A=this.getHeader("X-JSON");if(!A){return null}A=decodeURIComponent(escape(A));try{return A.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())}catch(B){this.request.dispatchException(B)}},_getResponseJSON:function(){var A=this.request.options;if(!A.evalJSON||(A.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json"))||this.responseText.blank()){return null}try{return this.responseText.evalJSON(A.sanitizeJSON||!this.request.isSameOrigin())}catch(B){this.request.dispatchException(B)}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,A,C,B){this.container={success:(A.success||A),failure:(A.failure||(A.success?null:A))};B=Object.clone(B);var D=B.onComplete;B.onComplete=(function(E,F){this.updateContent(E.responseText);if(Object.isFunction(D)){D(E,F)}}).bind(this);$super(C,B)},updateContent:function(D){var C=this.container[this.success()?"success":"failure"],A=this.options;if(!A.evalScripts){D=D.stripScripts()}if(C=$(C)){if(A.insertion){if(Object.isString(A.insertion)){var B={};B[A.insertion]=D;C.insert(B)}else{A.insertion(C,D)}}else{C.update(D)}}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,A,C,B){$super(B);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=A;this.url=C;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(A){if(this.options.decay){this.decay=(A.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=A.responseText}this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});function $(B){if(arguments.length>1){for(var A=0,D=[],C=arguments.length;A<C;A++){D.push($(arguments[A]))}return D}if(Object.isString(B)){B=document.getElementById(B)}return Element.extend(B)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(F,A){var C=[];var E=document.evaluate(F,$(A)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var B=0,D=E.snapshotLength;B<D;B++){C.push(Element.extend(E.snapshotItem(B)))}return C}}if(!Node){var Node={}}if(!Node.ELEMENT_NODE){Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12})}(function(C){function D(F,E){if(F==="select"){return false}if("type" in E){return false}return true}var B=(function(){try{var E=document.createElement('<input name="x">');return E.tagName.toLowerCase()==="input"&&E.name==="x"}catch(F){return false}})();var A=C.Element;C.Element=function(G,F){F=F||{};G=G.toLowerCase();var E=Element.cache;if(B&&F.name){G="<"+G+' name="'+F.name+'">';delete F.name;return Element.writeAttribute(document.createElement(G),F)}if(!E[G]){E[G]=Element.extend(document.createElement(G))}var H=D(G,F)?E[G].cloneNode(false):document.createElement(G);return Element.writeAttribute(H,F)};Object.extend(C.Element,A||{});if(A){C.Element.prototype=A.prototype}})(this);Element.idCounter=1;Element.cache={};Element._purgeElement=function(B){var A=B._prototypeUID;if(A){Element.stopObserving(B);B._prototypeUID=void 0;delete Element.Storage[A]}};Element.Methods={visible:function(A){return $(A).style.display!="none"},toggle:function(A){A=$(A);Element[Element.visible(A)?"hide":"show"](A);return A},hide:function(A){A=$(A);A.style.display="none";return A},show:function(A){A=$(A);A.style.display="";return A},remove:function(A){A=$(A);A.parentNode.removeChild(A);return A},update:(function(){var D=(function(){var G=document.createElement("select"),H=true;G.innerHTML='<option value="test">test</option>';if(G.options&&G.options[0]){H=G.options[0].nodeName.toUpperCase()!=="OPTION"}G=null;return H})();var B=(function(){try{var G=document.createElement("table");if(G&&G.tBodies){G.innerHTML="<tbody><tr><td>test</td></tr></tbody>";var I=typeof G.tBodies[0]=="undefined";G=null;return I}}catch(H){return true}})();var A=(function(){try{var G=document.createElement("div");G.innerHTML="<link>";var I=(G.childNodes.length===0);G=null;return I}catch(H){return true}})();var C=D||B||A;var F=(function(){var G=document.createElement("script"),I=false;try{G.appendChild(document.createTextNode(""));I=!G.firstChild||G.firstChild&&G.firstChild.nodeType!==3}catch(H){I=true}G=null;return I})();function E(K,L){K=$(K);var G=Element._purgeElement;var M=K.getElementsByTagName("*"),J=M.length;while(J--){G(M[J])}if(L&&L.toElement){L=L.toElement()}if(Object.isElement(L)){return K.update().insert(L)}L=Object.toHTML(L);var I=K.tagName.toUpperCase();if(I==="SCRIPT"&&F){K.text=L;return K}if(C){if(I in Element._insertionTranslations.tags){while(K.firstChild){K.removeChild(K.firstChild)}Element._getContentFromAnonymousElement(I,L.stripScripts()).each(function(N){K.appendChild(N)})}else{if(A&&Object.isString(L)&&L.indexOf("<link")>-1){while(K.firstChild){K.removeChild(K.firstChild)}var H=Element._getContentFromAnonymousElement(I,L.stripScripts(),true);H.each(function(N){K.appendChild(N)})}else{K.innerHTML=L.stripScripts()}}}else{K.innerHTML=L.stripScripts()}L.evalScripts.bind(L).defer();return K}return E})(),replace:function(B,C){B=$(B);if(C&&C.toElement){C=C.toElement()}else{if(!Object.isElement(C)){C=Object.toHTML(C);var A=B.ownerDocument.createRange();A.selectNode(B);C.evalScripts.bind(C).defer();C=A.createContextualFragment(C.stripScripts())}}B.parentNode.replaceChild(C,B);return B},insert:function(C,E){C=$(C);if(Object.isString(E)||Object.isNumber(E)||Object.isElement(E)||(E&&(E.toElement||E.toHTML))){E={bottom:E}}var D,F,B,G;for(var A in E){D=E[A];A=A.toLowerCase();F=Element._insertionTranslations[A];if(D&&D.toElement){D=D.toElement()}if(Object.isElement(D)){F(C,D);continue}D=Object.toHTML(D);B=((A=="before"||A=="after")?C.parentNode:C).tagName.toUpperCase();G=Element._getContentFromAnonymousElement(B,D.stripScripts());if(A=="top"||A=="after"){G.reverse()}G.each(F.curry(C));D.evalScripts.bind(D).defer()}return C},wrap:function(B,C,A){B=$(B);if(Object.isElement(C)){$(C).writeAttribute(A||{})}else{if(Object.isString(C)){C=new Element(C,A)}else{C=new Element("div",C)}}if(B.parentNode){B.parentNode.replaceChild(C,B)}C.appendChild(B);return C},inspect:function(B){B=$(B);var A="<"+B.tagName.toLowerCase();$H({"id":"id","className":"class"}).each(function(F){var E=F.first(),C=F.last(),D=(B[E]||"").toString();if(D){A+=" "+C+"="+D.inspect(true)}});return A+">"},recursivelyCollect:function(A,C,D){A=$(A);D=D||-1;var B=[];while(A=A[C]){if(A.nodeType==1){B.push(Element.extend(A))}if(B.length==D){break}}return B},ancestors:function(A){return Element.recursivelyCollect(A,"parentNode")},descendants:function(A){return Element.select(A,"*")},firstDescendant:function(A){A=$(A).firstChild;while(A&&A.nodeType!=1){A=A.nextSibling}return $(A)},immediateDescendants:function(B){var A=[],C=$(B).firstChild;while(C){if(C.nodeType===1){A.push(Element.extend(C))}C=C.nextSibling}return A},previousSiblings:function(A,B){return Element.recursivelyCollect(A,"previousSibling")},nextSiblings:function(A){return Element.recursivelyCollect(A,"nextSibling")},siblings:function(A){A=$(A);return Element.previousSiblings(A).reverse().concat(Element.nextSiblings(A))},match:function(B,A){B=$(B);if(Object.isString(A)){return Prototype.Selector.match(B,A)}return A.match(B)},up:function(B,D,A){B=$(B);if(arguments.length==1){return $(B.parentNode)}var C=Element.ancestors(B);return Object.isNumber(D)?C[D]:Prototype.Selector.find(C,D,A)},down:function(B,C,A){B=$(B);if(arguments.length==1){return Element.firstDescendant(B)}return Object.isNumber(C)?Element.descendants(B)[C]:Element.select(B,C)[A||0]},previous:function(B,C,A){B=$(B);if(Object.isNumber(C)){A=C,C=false}if(!Object.isNumber(A)){A=0}if(C){return Prototype.Selector.find(B.previousSiblings(),C,A)}else{return B.recursivelyCollect("previousSibling",A+1)[A]}},next:function(B,D,A){B=$(B);if(Object.isNumber(D)){A=D,D=false}if(!Object.isNumber(A)){A=0}if(D){return Prototype.Selector.find(B.nextSiblings(),D,A)}else{var C=Object.isNumber(A)?A+1:1;return B.recursivelyCollect("nextSibling",A+1)[A]}},select:function(A){A=$(A);var B=Array.prototype.slice.call(arguments,1).join(", ");return Prototype.Selector.select(B,A)},adjacent:function(A){A=$(A);var B=Array.prototype.slice.call(arguments,1).join(", ");return Prototype.Selector.select(B,A.parentNode).without(A)},identify:function(A){A=$(A);var B=Element.readAttribute(A,"id");if(B){return B}do{B="anonymous_element_"+Element.idCounter++}while($(B));Element.writeAttribute(A,"id",B);return B},readAttribute:function(C,A){C=$(C);if(Prototype.Browser.IE){var B=Element._attributeTranslations.read;if(B.values[A]){return B.values[A](C,A)}if(B.names[A]){A=B.names[A]}if(A.include(":")){return(!C.attributes||!C.attributes[A])?null:C.attributes[A].value}}return C.getAttribute(A)},writeAttribute:function(E,C,F){E=$(E);var B={},D=Element._attributeTranslations.write;if(typeof C=="object"){B=C}else{B[C]=Object.isUndefined(F)?true:F}for(var A in B){C=D.names[A]||A;F=B[A];if(D.values[A]){C=D.values[A](E,F)}if(F===false||F===null){E.removeAttribute(C)}else{if(F===true){E.setAttribute(C,C)}else{E.setAttribute(C,F)}}}return E},getHeight:function(A){return Element.getDimensions(A).height},getWidth:function(A){return Element.getDimensions(A).width},classNames:function(A){return new Element.ClassNames(A)},hasClassName:function(A,B){if(!(A=$(A))){return }var C=A.className;return(C.length>0&&(C==B||new RegExp("(^|\\s)"+B+"(\\s|$)").test(C)))},addClassName:function(A,B){if(!(A=$(A))){return }if(!Element.hasClassName(A,B)){A.className+=(A.className?" ":"")+B}return A},removeClassName:function(A,B){if(!(A=$(A))){return }A.className=A.className.replace(new RegExp("(^|\\s+)"+B+"(\\s+|$)")," ").strip();return A},toggleClassName:function(A,B){if(!(A=$(A))){return }return Element[Element.hasClassName(A,B)?"removeClassName":"addClassName"](A,B)},cleanWhitespace:function(B){B=$(B);var C=B.firstChild;while(C){var A=C.nextSibling;if(C.nodeType==3&&!/\S/.test(C.nodeValue)){B.removeChild(C)}C=A}return B},empty:function(A){return $(A).innerHTML.blank()},descendantOf:function(B,A){B=$(B),A=$(A);if(B.compareDocumentPosition){return(B.compareDocumentPosition(A)&8)===8}if(A.contains){return A.contains(B)&&A!==B}while(B=B.parentNode){if(B==A){return true}}return false},scrollTo:function(A){A=$(A);var B=Element.cumulativeOffset(A);window.scrollTo(B[0],B[1]);return A},getStyle:function(B,C){B=$(B);C=C=="float"?"cssFloat":C.camelize();var D=B.style[C];if(!D||D=="auto"){var A=document.defaultView.getComputedStyle(B,null);D=A?A[C]:null}if(C=="opacity"){return D?parseFloat(D):1}return D=="auto"?null:D},getOpacity:function(A){return $(A).getStyle("opacity")},setStyle:function(B,C){B=$(B);var E=B.style,A;if(Object.isString(C)){B.style.cssText+=";"+C;return C.include("opacity")?B.setOpacity(C.match(/opacity:\s*(\d?\.?\d*)/)[1]):B}for(var D in C){if(D=="opacity"){B.setOpacity(C[D])}else{E[(D=="float"||D=="cssFloat")?(Object.isUndefined(E.styleFloat)?"cssFloat":"styleFloat"):D]=C[D]}}return B},setOpacity:function(A,B){A=$(A);A.style.opacity=(B==1||B==="")?"":(B<0.00001)?0:B;return A},makePositioned:function(A){A=$(A);var B=Element.getStyle(A,"position");if(B=="static"||!B){A._madePositioned=true;A.style.position="relative";if(Prototype.Browser.Opera){A.style.top=0;A.style.left=0}}return A},undoPositioned:function(A){A=$(A);if(A._madePositioned){A._madePositioned=undefined;A.style.position=A.style.top=A.style.left=A.style.bottom=A.style.right=""}return A},makeClipping:function(A){A=$(A);if(A._overflow){return A}A._overflow=Element.getStyle(A,"overflow")||"auto";if(A._overflow!=="hidden"){A.style.overflow="hidden"}return A},undoClipping:function(A){A=$(A);if(!A._overflow){return A}A.style.overflow=A._overflow=="auto"?"":A._overflow;A._overflow=null;return A},clonePosition:function(B,D){var A=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});D=$(D);var E=Element.viewportOffset(D),F=[0,0],C=null;B=$(B);if(Element.getStyle(B,"position")=="absolute"){C=Element.getOffsetParent(B);F=Element.viewportOffset(C)}if(C==document.body){F[0]-=document.body.offsetLeft;F[1]-=document.body.offsetTop}if(A.setLeft){B.style.left=(E[0]-F[0]+A.offsetLeft)+"px"}if(A.setTop){B.style.top=(E[1]-F[1]+A.offsetTop)+"px"}if(A.setWidth){B.style.width=D.offsetWidth+"px"}if(A.setHeight){B.style.height=D.offsetHeight+"px"}return B}};Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(D,B,C){switch(C){case"height":case"width":if(!Element.visible(B)){return null}var E=parseInt(D(B,C),10);if(E!==B["offset"+C.capitalize()]){return E+"px"}var A;if(C==="height"){A=["border-top-width","padding-top","padding-bottom","border-bottom-width"]}else{A=["border-left-width","padding-left","padding-right","border-right-width"]}return A.inject(E,function(F,G){var H=D(B,G);return H===null?F:F-parseInt(H,10)})+"px";default:return D(B,C)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(C,A,B){if(B==="title"){return A.title}return C(A,B)})}else{if(Prototype.Browser.IE){Element.Methods.getStyle=function(A,B){A=$(A);B=(B=="float"||B=="cssFloat")?"styleFloat":B.camelize();var C=A.style[B];if(!C&&A.currentStyle){C=A.currentStyle[B]}if(B=="opacity"){if(C=(A.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(C[1]){return parseFloat(C[1])/100}}return 1}if(C=="auto"){if((B=="width"||B=="height")&&(A.getStyle("display")!="none")){return A["offset"+B.capitalize()]+"px"}return null}return C};Element.Methods.setOpacity=function(B,E){function F(G){return G.replace(/alpha\([^\)]*\)/gi,"")}B=$(B);var A=B.currentStyle;if((A&&!A.hasLayout)||(!A&&B.style.zoom=="normal")){B.style.zoom=1}var D=B.getStyle("filter"),C=B.style;if(E==1||E===""){(D=F(D))?C.filter=D:C.removeAttribute("filter");return B}else{if(E<0.00001){E=0}}C.filter=F(D)+"alpha(opacity="+(E*100)+")";return B};Element._attributeTranslations=(function(){var B="className",A="for",C=document.createElement("div");C.setAttribute(B,"x");if(C.className!=="x"){C.setAttribute("class","x");if(C.className==="x"){B="class"}}C=null;C=document.createElement("label");C.setAttribute(A,"x");if(C.htmlFor!=="x"){C.setAttribute("htmlFor","x");if(C.htmlFor==="x"){A="htmlFor"}}C=null;return{read:{names:{"class":B,"className":B,"for":A,"htmlFor":A},values:{_getAttr:function(D,E){return D.getAttribute(E)},_getAttr2:function(D,E){return D.getAttribute(E,2)},_getAttrNode:function(D,F){var E=D.getAttributeNode(F);return E?E.value:""},_getEv:(function(){var D=document.createElement("div"),F;D.onclick=Prototype.emptyFunction;var E=D.getAttribute("onclick");if(String(E).indexOf("{")>-1){F=function(G,H){H=G.getAttribute(H);if(!H){return null}H=H.toString();H=H.split("{")[1];H=H.split("}")[0];return H.strip()}}else{if(E===""){F=function(G,H){H=G.getAttribute(H);if(!H){return null}return H.strip()}}}D=null;return F})(),_flag:function(D,E){return $(D).hasAttribute(E)?E:null},style:function(D){return D.style.cssText.toLowerCase()},title:function(D){return D.title}}}}})();Element._attributeTranslations.write={names:Object.extend({cellpadding:"cellPadding",cellspacing:"cellSpacing"},Element._attributeTranslations.read.names),values:{checked:function(A,B){A.checked=!!B},style:function(A,B){A.style.cssText=B?B:""}}};Element._attributeTranslations.has={};$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder").each(function(A){Element._attributeTranslations.write.names[A.toLowerCase()]=A;Element._attributeTranslations.has[A.toLowerCase()]=A});(function(A){Object.extend(A,{href:A._getAttr2,src:A._getAttr2,type:A._getAttr,action:A._getAttrNode,disabled:A._flag,checked:A._flag,readonly:A._flag,multiple:A._flag,onload:A._getEv,onunload:A._getEv,onclick:A._getEv,ondblclick:A._getEv,onmousedown:A._getEv,onmouseup:A._getEv,onmouseover:A._getEv,onmousemove:A._getEv,onmouseout:A._getEv,onfocus:A._getEv,onblur:A._getEv,onkeypress:A._getEv,onkeydown:A._getEv,onkeyup:A._getEv,onsubmit:A._getEv,onreset:A._getEv,onselect:A._getEv,onchange:A._getEv})})(Element._attributeTranslations.read.values);if(Prototype.BrowserFeatures.ElementExtensions){(function(){function A(E){var B=E.getElementsByTagName("*"),D=[];for(var C=0,F;F=B[C];C++){if(F.tagName!=="!"){D.push(F)}}return D}Element.Methods.down=function(C,D,B){C=$(C);if(arguments.length==1){return C.firstDescendant()}return Object.isNumber(D)?A(C)[D]:Element.select(C,D)[B||0]}})()}}else{if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(A,B){A=$(A);A.style.opacity=(B==1)?0.999999:(B==="")?"":(B<0.00001)?0:B;return A}}else{if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(A,B){A=$(A);A.style.opacity=(B==1||B==="")?"":(B<0.00001)?0:B;if(B==1){if(A.tagName.toUpperCase()=="IMG"&&A.width){A.width++;A.width--}else{try{var D=document.createTextNode(" ");A.appendChild(D);A.removeChild(D)}catch(C){}}}return A}}}}}if("outerHTML" in document.documentElement){Element.Methods.replace=function(C,E){C=$(C);if(E&&E.toElement){E=E.toElement()}if(Object.isElement(E)){C.parentNode.replaceChild(E,C);return C}E=Object.toHTML(E);var D=C.parentNode,B=D.tagName.toUpperCase();if(Element._insertionTranslations.tags[B]){var F=C.next(),A=Element._getContentFromAnonymousElement(B,E.stripScripts());D.removeChild(C);if(F){A.each(function(G){D.insertBefore(G,F)})}else{A.each(function(G){D.appendChild(G)})}}else{C.outerHTML=E.stripScripts()}E.evalScripts.bind(E).defer();return C}}Element._returnOffset=function(B,C){var A=[B,C];A.left=B;A.top=C;return A};Element._getContentFromAnonymousElement=function(E,D,F){var G=new Element("div"),C=Element._insertionTranslations.tags[E];var A=false;if(C){A=true}else{if(F){A=true;C=["","",0]}}if(A){G.innerHTML="&nbsp;"+C[0]+D+C[1];G.removeChild(G.firstChild);for(var B=C[2];B--;){G=G.firstChild}}else{G.innerHTML=D}return $A(G.childNodes)};Element._insertionTranslations={before:function(A,B){A.parentNode.insertBefore(B,A)},top:function(A,B){A.insertBefore(B,A.firstChild)},bottom:function(A,B){A.appendChild(B)},after:function(A,B){A.parentNode.insertBefore(B,A.nextSibling)},tags:{TABLE:["<table>","</table>",1],TBODY:["<table><tbody>","</tbody></table>",2],TR:["<table><tbody><tr>","</tr></tbody></table>",3],TD:["<table><tbody><tr><td>","</td></tr></tbody></table>",4],SELECT:["<select>","</select>",1]}};(function(){var A=Element._insertionTranslations.tags;Object.extend(A,{THEAD:A.TBODY,TFOOT:A.TBODY,TH:A.TD})})();Element.Methods.Simulated={hasAttribute:function(A,C){C=Element._attributeTranslations.has[C]||C;var B=$(A).getAttributeNode(C);return !!(B&&B.specified)}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);(function(A){if(!Prototype.BrowserFeatures.ElementExtensions&&A["__proto__"]){window.HTMLElement={};window.HTMLElement.prototype=A["__proto__"];Prototype.BrowserFeatures.ElementExtensions=true}A=null})(document.createElement("div"));Element.extend=(function(){function C(G){if(typeof window.Element!="undefined"){var I=window.Element.prototype;if(I){var K="_"+(Math.random()+"").slice(2),H=document.createElement(G);I[K]="x";var J=(H[K]!=="x");delete I[K];H=null;return J}}return false}function B(H,G){for(var J in G){var I=G[J];if(Object.isFunction(I)&&!(J in H)){H[J]=I.methodize()}}}var D=C("object");if(Prototype.BrowserFeatures.SpecificElementExtensions){if(D){return function(H){if(H&&typeof H._extendedByPrototype=="undefined"){var G=H.tagName;if(G&&(/^(?:object|applet|embed)$/i.test(G))){B(H,Element.Methods);B(H,Element.Methods.Simulated);B(H,Element.Methods.ByTag[G.toUpperCase()])}}return H}}return Prototype.K}var A={},E=Element.Methods.ByTag;var F=Object.extend(function(I){if(!I||typeof I._extendedByPrototype!="undefined"||I.nodeType!=1||I==window){return I}var G=Object.clone(A),H=I.tagName.toUpperCase();if(E[H]){Object.extend(G,E[H])}B(I,G);I._extendedByPrototype=Prototype.emptyFunction;return I},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(A,Element.Methods);Object.extend(A,Element.Methods.Simulated)}}});F.refresh();return F})();if(document.documentElement.hasAttribute){Element.hasAttribute=function(A,B){return A.hasAttribute(B)}}else{Element.hasAttribute=Element.Methods.Simulated.hasAttribute}Element.addMethods=function(C){var J=Prototype.BrowserFeatures,D=Element.Methods.ByTag;if(!C){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),"BUTTON":Object.clone(Form.Element.Methods)})}if(arguments.length==2){var B=C;C=arguments[1]}if(!B){Object.extend(Element.Methods,C||{})}else{if(Object.isArray(B)){B.each(H)}else{H(B)}}function H(F){F=F.toUpperCase();if(!Element.Methods.ByTag[F]){Element.Methods.ByTag[F]={}}Object.extend(Element.Methods.ByTag[F],C)}function A(M,L,F){F=F||false;for(var O in M){var N=M[O];if(!Object.isFunction(N)){continue}if(!F||!(O in L)){L[O]=N.methodize()}}}function E(N){var F;var M={"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(M[N]){F="HTML"+M[N]+"Element"}if(window[F]){return window[F]}F="HTML"+N+"Element";if(window[F]){return window[F]}F="HTML"+N.capitalize()+"Element";if(window[F]){return window[F]}var L=document.createElement(N),O=L["__proto__"]||L.constructor.prototype;L=null;return O}var I=window.HTMLElement?HTMLElement.prototype:Element.prototype;if(J.ElementExtensions){A(Element.Methods,I);A(Element.Methods.Simulated,I,true)}if(J.SpecificElementExtensions){for(var K in Element.Methods.ByTag){var G=E(K);if(Object.isUndefined(G)){continue}A(D[K],G.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh){Element.extend.refresh()}Element.cache={}};document.viewport={getDimensions:function(){return{width:this.getWidth(),height:this.getHeight()}},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)}};(function(C){var H=Prototype.Browser,F=document,D,E={};function A(){if(H.WebKit&&!F.evaluate){return document}if(H.Opera&&window.parseFloat(window.opera.version())<9.5){return document.body}return document.documentElement}function G(B){if(!D){D=A()}E[B]="client"+B;C["get"+B]=function(){return D[E[B]]};return C["get"+B]()}C.getWidth=G.curry("Width");C.getHeight=G.curry("Height")})(document.viewport);Element.Storage={UID:1};Element.addMethods({getStorage:function(B){if(!(B=$(B))){return }var A;if(B===window){A=0}else{if(typeof B._prototypeUID==="undefined"){B._prototypeUID=Element.Storage.UID++}A=B._prototypeUID}if(!Element.Storage[A]){Element.Storage[A]=$H()}return Element.Storage[A]},store:function(B,A,C){if(!(B=$(B))){return }if(arguments.length===2){Element.getStorage(B).update(A)}else{Element.getStorage(B).set(A,C)}return B},retrieve:function(C,B,A){if(!(C=$(C))){return }var E=Element.getStorage(C),D=E.get(B);if(Object.isUndefined(D)){E.set(B,A);D=A}return D},clone:function(C,A){if(!(C=$(C))){return }var E=C.cloneNode(A);E._prototypeUID=void 0;if(A){var D=Element.select(E,"*"),B=D.length;while(B--){D[B]._prototypeUID=void 0}}return Element.extend(E)},purge:function(C){if(!(C=$(C))){return }var A=Element._purgeElement;A(C);var D=C.getElementsByTagName("*"),B=D.length;while(B--){A(D[B])}return null}});(function(){function H(V){var U=V.match(/^(\d+)%?$/i);if(!U){return null}return(Number(U[1])/100)}function O(g,h,V){var Y=null;if(Object.isElement(g)){Y=g;g=Y.getStyle(h)}if(g===null){return null}if((/^(?:-)?\d+(\.\d+)?(px)?$/i).test(g)){return window.parseFloat(g)}var b=g.include("%"),W=(V===document.viewport);if(/\d/.test(g)&&Y&&Y.runtimeStyle&&!(b&&W)){var U=Y.style.left,f=Y.runtimeStyle.left;Y.runtimeStyle.left=Y.currentStyle.left;Y.style.left=g||0;g=Y.style.pixelLeft;Y.style.left=U;Y.runtimeStyle.left=f;return g}if(Y&&b){V=V||Y.parentNode;var X=H(g);var c=null;var Z=Y.getStyle("position");var e=h.include("left")||h.include("right")||h.include("width");var d=h.include("top")||h.include("bottom")||h.include("height");if(V===document.viewport){if(e){c=document.viewport.getWidth()}else{if(d){c=document.viewport.getHeight()}}}else{if(e){c=$(V).measure("width")}else{if(d){c=$(V).measure("height")}}}return(c===null)?0:c*X}return 0}function G(U){if(Object.isString(U)&&U.endsWith("px")){return U}return U+"px"}function J(V){var U=V;while(V&&V.parentNode){var W=V.getStyle("display");if(W==="none"){return false}V=$(V.parentNode)}return true}var D=Prototype.K;if("currentStyle" in document.documentElement){D=function(U){if(!U.currentStyle.hasLayout){U.style.zoom=1}return U}}function F(U){if(U.include("border")){U=U+"-width"}return U.camelize()}Element.Layout=Class.create(Hash,{initialize:function($super,V,U){$super();this.element=$(V);Element.Layout.PROPERTIES.each(function(W){this._set(W,null)},this);if(U){this._preComputing=true;this._begin();Element.Layout.PROPERTIES.each(this._compute,this);this._end();this._preComputing=false}},_set:function(V,U){return Hash.prototype.set.call(this,V,U)},set:function(V,U){throw"Properties of Element.Layout are read-only."},get:function($super,V){var U=$super(V);return U===null?this._compute(V):U},_begin:function(){if(this._prepared){return }var Y=this.element;if(J(Y)){this._prepared=true;return }var b={position:Y.style.position||"",width:Y.style.width||"",visibility:Y.style.visibility||"",display:Y.style.display||""};Y.store("prototype_original_styles",b);var c=Y.getStyle("position"),U=Y.getStyle("width");if(U==="0px"||U===null){Y.style.display="block";U=Y.getStyle("width")}var V=(c==="fixed")?document.viewport:Y.parentNode;Y.setStyle({position:"absolute",visibility:"hidden",display:"block"});var W=Y.getStyle("width");var X;if(U&&(W===U)){X=O(Y,"width",V)}else{if(c==="absolute"||c==="fixed"){X=O(Y,"width",V)}else{var d=Y.parentNode,Z=$(d).getLayout();X=Z.get("width")-this.get("margin-left")-this.get("border-left")-this.get("padding-left")-this.get("padding-right")-this.get("border-right")-this.get("margin-right")}}Y.setStyle({width:X+"px"});this._prepared=true},_end:function(){var V=this.element;var U=V.retrieve("prototype_original_styles");V.store("prototype_original_styles",null);V.setStyle(U);this._prepared=false},_compute:function(V){var U=Element.Layout.COMPUTATIONS;if(!(V in U)){throw"Property not found."}return this._set(V,U[V].call(this,this.element))},toObject:function(){var U=$A(arguments);var V=(U.length===0)?Element.Layout.PROPERTIES:U.join(" ").split(" ");var W={};V.each(function(X){if(!Element.Layout.PROPERTIES.include(X)){return }var Y=this.get(X);if(Y!=null){W[X]=Y}},this);return W},toHash:function(){var U=this.toObject.apply(this,arguments);return new Hash(U)},toCSS:function(){var U=$A(arguments);var W=(U.length===0)?Element.Layout.PROPERTIES:U.join(" ").split(" ");var V={};W.each(function(X){if(!Element.Layout.PROPERTIES.include(X)){return }if(Element.Layout.COMPOSITE_PROPERTIES.include(X)){return }var Y=this.get(X);if(Y!=null){V[F(X)]=Y+"px"}},this);return V},inspect:function(){return"#<Element.Layout>"}});Object.extend(Element.Layout,{PROPERTIES:$w("height width top left right bottom border-left border-right border-top border-bottom padding-left padding-right padding-top padding-bottom margin-top margin-bottom margin-left margin-right padding-box-width padding-box-height border-box-width border-box-height margin-box-width margin-box-height"),COMPOSITE_PROPERTIES:$w("padding-box-width padding-box-height margin-box-width margin-box-height border-box-width border-box-height"),COMPUTATIONS:{"height":function(W){if(!this._preComputing){this._begin()}var U=this.get("border-box-height");if(U<=0){if(!this._preComputing){this._end()}return 0}var X=this.get("border-top"),V=this.get("border-bottom");var Z=this.get("padding-top"),Y=this.get("padding-bottom");if(!this._preComputing){this._end()}return U-X-V-Z-Y},"width":function(W){if(!this._preComputing){this._begin()}var V=this.get("border-box-width");if(V<=0){if(!this._preComputing){this._end()}return 0}var Z=this.get("border-left"),U=this.get("border-right");var X=this.get("padding-left"),Y=this.get("padding-right");if(!this._preComputing){this._end()}return V-Z-U-X-Y},"padding-box-height":function(V){var U=this.get("height"),X=this.get("padding-top"),W=this.get("padding-bottom");return U+X+W},"padding-box-width":function(U){var V=this.get("width"),W=this.get("padding-left"),X=this.get("padding-right");return V+W+X},"border-box-height":function(V){if(!this._preComputing){this._begin()}var U=V.offsetHeight;if(!this._preComputing){this._end()}return U},"border-box-width":function(U){if(!this._preComputing){this._begin()}var V=U.offsetWidth;if(!this._preComputing){this._end()}return V},"margin-box-height":function(V){var U=this.get("border-box-height"),W=this.get("margin-top"),X=this.get("margin-bottom");if(U<=0){return 0}return U+W+X},"margin-box-width":function(W){var V=this.get("border-box-width"),X=this.get("margin-left"),U=this.get("margin-right");if(V<=0){return 0}return V+X+U},"top":function(U){var V=U.positionedOffset();return V.top},"bottom":function(U){var X=U.positionedOffset(),V=U.getOffsetParent(),W=V.measure("height");var Y=this.get("border-box-height");return W-Y-X.top},"left":function(U){var V=U.positionedOffset();return V.left},"right":function(W){var Y=W.positionedOffset(),X=W.getOffsetParent(),U=X.measure("width");var V=this.get("border-box-width");return U-V-Y.left},"padding-top":function(U){return O(U,"paddingTop")},"padding-bottom":function(U){return O(U,"paddingBottom")},"padding-left":function(U){return O(U,"paddingLeft")},"padding-right":function(U){return O(U,"paddingRight")},"border-top":function(U){return O(U,"borderTopWidth")},"border-bottom":function(U){return O(U,"borderBottomWidth")},"border-left":function(U){return O(U,"borderLeftWidth")},"border-right":function(U){return O(U,"borderRightWidth")},"margin-top":function(U){return O(U,"marginTop")},"margin-bottom":function(U){return O(U,"marginBottom")},"margin-left":function(U){return O(U,"marginLeft")},"margin-right":function(U){return O(U,"marginRight")}}});if("getBoundingClientRect" in document.documentElement){Object.extend(Element.Layout.COMPUTATIONS,{"right":function(V){var W=D(V.getOffsetParent());var X=V.getBoundingClientRect(),U=W.getBoundingClientRect();return(U.right-X.right).round()},"bottom":function(V){var W=D(V.getOffsetParent());var X=V.getBoundingClientRect(),U=W.getBoundingClientRect();return(U.bottom-X.bottom).round()}})}Element.Offset=Class.create({initialize:function(V,U){this.left=V.round();this.top=U.round();this[0]=this.left;this[1]=this.top},relativeTo:function(U){return new Element.Offset(this.left-U.left,this.top-U.top)},inspect:function(){return"#<Element.Offset left: #{left} top: #{top}>".interpolate(this)},toString:function(){return"[#{left}, #{top}]".interpolate(this)},toArray:function(){return[this.left,this.top]}});function R(V,U){return new Element.Layout(V,U)}function B(U,V){return $(U).getLayout().get(V)}function N(V){V=$(V);var Z=Element.getStyle(V,"display");if(Z&&Z!=="none"){return{width:V.offsetWidth,height:V.offsetHeight}}var W=V.style;var U={visibility:W.visibility,position:W.position,display:W.display};var Y={visibility:"hidden",display:"block"};if(U.position!=="fixed"){Y.position="absolute"}Element.setStyle(V,Y);var X={width:V.offsetWidth,height:V.offsetHeight};Element.setStyle(V,U);return X}function L(U){U=$(U);if(E(U)||C(U)||M(U)||K(U)){return $(document.body)}var V=(Element.getStyle(U,"display")==="inline");if(!V&&U.offsetParent){return $(U.offsetParent)}while((U=U.parentNode)&&U!==document.body){if(Element.getStyle(U,"position")!=="static"){return K(U)?$(document.body):$(U)}}return $(document.body)}function T(V){V=$(V);var U=0,W=0;if(V.parentNode){do{U+=V.offsetTop||0;W+=V.offsetLeft||0;V=V.offsetParent}while(V)}return new Element.Offset(W,U)}function P(V){V=$(V);var W=V.getLayout();var U=0,Y=0;do{U+=V.offsetTop||0;Y+=V.offsetLeft||0;V=V.offsetParent;if(V){if(M(V)){break}var X=Element.getStyle(V,"position");if(X!=="static"){break}}}while(V);Y-=W.get("margin-top");U-=W.get("margin-left");return new Element.Offset(Y,U)}function A(V){var U=0,W=0;do{U+=V.scrollTop||0;W+=V.scrollLeft||0;V=V.parentNode}while(V);return new Element.Offset(W,U)}function S(Y){V=$(V);var U=0,X=0,W=document.body;var V=Y;do{U+=V.offsetTop||0;X+=V.offsetLeft||0;if(V.offsetParent==W&&Element.getStyle(V,"position")=="absolute"){break}}while(V=V.offsetParent);V=Y;do{if(V!=W){U-=V.scrollTop||0;X-=V.scrollLeft||0}}while(V=V.parentNode);return new Element.Offset(X,U)}function Q(U){U=$(U);if(Element.getStyle(U,"position")==="absolute"){return U}var Y=L(U);var X=U.viewportOffset(),V=Y.viewportOffset();var Z=X.relativeTo(V);var W=U.getLayout();U.store("prototype_absolutize_original_styles",{left:U.getStyle("left"),top:U.getStyle("top"),width:U.getStyle("width"),height:U.getStyle("height")});U.setStyle({position:"absolute",top:Z.top+"px",left:Z.left+"px",width:W.get("width")+"px",height:W.get("height")+"px"});return U}function I(V){V=$(V);if(Element.getStyle(V,"position")==="relative"){return V}var U=V.retrieve("prototype_absolutize_original_styles");if(U){V.setStyle(U)}return V}if(Prototype.Browser.IE){L=L.wrap(function(W,V){V=$(V);if(E(V)||C(V)||M(V)||K(V)){return $(document.body)}var U=V.getStyle("position");if(U!=="static"){return W(V)}V.setStyle({position:"relative"});var X=W(V);V.setStyle({position:U});return X});P=P.wrap(function(X,V){V=$(V);if(!V.parentNode){return new Element.Offset(0,0)}var U=V.getStyle("position");if(U!=="static"){return X(V)}var W=V.getOffsetParent();if(W&&W.getStyle("position")==="fixed"){D(W)}V.setStyle({position:"relative"});var Y=X(V);V.setStyle({position:U});return Y})}else{if(Prototype.Browser.Webkit){T=function(V){V=$(V);var U=0,W=0;do{U+=V.offsetTop||0;W+=V.offsetLeft||0;if(V.offsetParent==document.body){if(Element.getStyle(V,"position")=="absolute"){break}}V=V.offsetParent}while(V);return new Element.Offset(W,U)}}}Element.addMethods({getLayout:R,measure:B,getDimensions:N,getOffsetParent:L,cumulativeOffset:T,positionedOffset:P,cumulativeScrollOffset:A,viewportOffset:S,absolutize:Q,relativize:I});function M(U){return U.nodeName.toUpperCase()==="BODY"}function K(U){return U.nodeName.toUpperCase()==="HTML"}function E(U){return U.nodeType===Node.DOCUMENT_NODE}function C(U){return U!==document.body&&!Element.descendantOf(U,document.body)}if("getBoundingClientRect" in document.documentElement){Element.addMethods({viewportOffset:function(U){U=$(U);if(C(U)){return new Element.Offset(0,0)}var V=U.getBoundingClientRect(),W=document.documentElement;return new Element.Offset(V.left-W.clientLeft,V.top-W.clientTop)}})}})();window.$$=function(){var A=$A(arguments).join(", ");return Prototype.Selector.select(A,document)};Prototype.Selector=(function(){function A(){throw new Error('Method "Prototype.Selector.select" must be defined.')}function C(){throw new Error('Method "Prototype.Selector.match" must be defined.')}function D(K,L,H){H=H||0;var G=Prototype.Selector.match,J=K.length,F=0,I;for(I=0;I<J;I++){if(G(K[I],L)&&H==F++){return Element.extend(K[I])}}}function E(H){for(var F=0,G=H.length;F<G;F++){Element.extend(H[F])}return H}var B=Prototype.K;return{select:A,match:C,find:D,extendElements:(Element.extend===B)?B:E,extendElement:Element.extend}})();Prototype._original_property=window.Sizzle;(function(){var P=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,I=0,D=Object.prototype.toString,N=false,H=true;[0,0].sort(function(){H=false;return 0});var B=function(f,U,c,W){c=c||[];var R=U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!f||typeof f!=="string"){return c}var d=[],e,Z,k,j,b,T,S=true,X=O(U),h=f;while((P.exec(""),e=P.exec(h))!==null){h=e[3];d.push(e[1]);if(e[2]){T=e[3];break}}if(d.length>1&&J.exec(f)){if(d.length===2&&E.relative[d[0]]){Z=F(d[0]+d[1],U)}else{Z=E.relative[d[0]]?[U]:B(d.shift(),U);while(d.length){f=d.shift();if(E.relative[f]){f+=d.shift()}Z=F(f,Z)}}}else{if(!W&&d.length>1&&U.nodeType===9&&!X&&E.match.ID.test(d[0])&&!E.match.ID.test(d[d.length-1])){var l=B.find(d.shift(),U,X);U=l.expr?B.filter(l.expr,l.set)[0]:l.set[0]}if(U){var l=W?{expr:d.pop(),set:A(W)}:B.find(d.pop(),d.length===1&&(d[0]==="~"||d[0]==="+")&&U.parentNode?U.parentNode:U,X);Z=l.expr?B.filter(l.expr,l.set):l.set;if(d.length>0){k=A(Z)}else{S=false}while(d.length){var V=d.pop(),Y=V;if(!E.relative[V]){V=""}else{Y=d.pop()}if(Y==null){Y=U}E.relative[V](k,Y,X)}}else{k=d=[]}}if(!k){k=Z}if(!k){throw"Syntax error, unrecognized expression: "+(V||f)}if(D.call(k)==="[object Array]"){if(!S){c.push.apply(c,k)}else{if(U&&U.nodeType===1){for(var g=0;k[g]!=null;g++){if(k[g]&&(k[g]===true||k[g].nodeType===1&&G(U,k[g]))){c.push(Z[g])}}}else{for(var g=0;k[g]!=null;g++){if(k[g]&&k[g].nodeType===1){c.push(Z[g])}}}}}else{A(k,c)}if(T){B(T,R,c,W);B.uniqueSort(c)}return c};B.uniqueSort=function(S){if(C){N=H;S.sort(C);if(N){for(var R=1;R<S.length;R++){if(S[R]===S[R-1]){S.splice(R--,1)}}}}return S};B.matches=function(R,S){return B(R,null,null,S)};B.find=function(Y,R,Z){var X,V;if(!Y){return[]}for(var U=0,T=E.order.length;U<T;U++){var W=E.order[U],V;if((V=E.leftMatch[W].exec(Y))){var S=V[1];V.splice(1,1);if(S.substr(S.length-1)!=="\\"){V[1]=(V[1]||"").replace(/\\/g,"");X=E.find[W](V,R,Z);if(X!=null){Y=Y.replace(E.match[W],"");break}}}}if(!X){X=R.getElementsByTagName("*")}return{set:X,expr:Y}};B.filter=function(c,b,f,U){var T=c,h=[],Y=b,W,R,X=b&&b[0]&&O(b[0]);while(c&&b.length){for(var Z in E.filter){if((W=E.match[Z].exec(c))!=null){var S=E.filter[Z],g,e;R=false;if(Y==h){h=[]}if(E.preFilter[Z]){W=E.preFilter[Z](W,Y,f,h,U,X);if(!W){R=g=true}else{if(W===true){continue}}}if(W){for(var V=0;(e=Y[V])!=null;V++){if(e){g=S(e,W,V,Y);var d=U^!!g;if(f&&g!=null){if(d){R=true}else{Y[V]=false}}else{if(d){h.push(e);R=true}}}}}if(g!==undefined){if(!f){Y=h}c=c.replace(E.match[Z],"");if(!R){return[]}break}}}if(c==T){if(R==null){throw"Syntax error, unrecognized expression: "+c}else{break}}T=c}return Y};var E=B.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(R){return R.getAttribute("href")}},relative:{"+":function(Y,R,X){var V=typeof R==="string",Z=V&&!/\W/.test(R),W=V&&!Z;if(Z&&!X){R=R.toUpperCase()}for(var U=0,T=Y.length,S;U<T;U++){if((S=Y[U])){while((S=S.previousSibling)&&S.nodeType!==1){}Y[U]=W||S&&S.nodeName===R?S||false:S===R}}if(W){B.filter(R,Y,true)}},">":function(X,S,Y){var V=typeof S==="string";if(V&&!/\W/.test(S)){S=Y?S:S.toUpperCase();for(var T=0,R=X.length;T<R;T++){var W=X[T];if(W){var U=W.parentNode;X[T]=U.nodeName===S?U:false}}}else{for(var T=0,R=X.length;T<R;T++){var W=X[T];if(W){X[T]=V?W.parentNode:W.parentNode===S}}if(V){B.filter(S,X,true)}}},"":function(U,S,W){var T=I++,R=Q;if(!/\W/.test(S)){var V=S=W?S:S.toUpperCase();R=M}R("parentNode",S,T,U,V,W)},"~":function(U,S,W){var T=I++,R=Q;if(typeof S==="string"&&!/\W/.test(S)){var V=S=W?S:S.toUpperCase();R=M}R("previousSibling",S,T,U,V,W)}},find:{ID:function(S,T,U){if(typeof T.getElementById!=="undefined"&&!U){var R=T.getElementById(S[1]);return R?[R]:[]}},NAME:function(T,W,X){if(typeof W.getElementsByName!=="undefined"){var S=[],V=W.getElementsByName(T[1]);for(var U=0,R=V.length;U<R;U++){if(V[U].getAttribute("name")===T[1]){S.push(V[U])}}return S.length===0?null:S}},TAG:function(R,S){return S.getElementsByTagName(R[1])}},preFilter:{CLASS:function(U,S,T,R,X,Y){U=" "+U[1].replace(/\\/g,"")+" ";if(Y){return U}for(var V=0,W;(W=S[V])!=null;V++){if(W){if(X^(W.className&&(" "+W.className+" ").indexOf(U)>=0)){if(!T){R.push(W)}}else{if(T){S[V]=false}}}}return false},ID:function(R){return R[1].replace(/\\/g,"")},TAG:function(S,R){for(var T=0;R[T]===false;T++){}return R[T]&&O(R[T])?S[1]:S[1].toUpperCase()},CHILD:function(R){if(R[1]=="nth"){var S=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(R[2]=="even"&&"2n"||R[2]=="odd"&&"2n+1"||!/\D/.test(R[2])&&"0n+"+R[2]||R[2]);R[2]=(S[1]+(S[2]||1))-0;R[3]=S[3]-0}R[0]=I++;return R},ATTR:function(V,S,T,R,W,X){var U=V[1].replace(/\\/g,"");if(!X&&E.attrMap[U]){V[1]=E.attrMap[U]}if(V[2]==="~="){V[4]=" "+V[4]+" "}return V},PSEUDO:function(V,S,T,R,W){if(V[1]==="not"){if((P.exec(V[3])||"").length>1||/^\w/.test(V[3])){V[3]=B(V[3],null,null,S)}else{var U=B.filter(V[3],S,T,true^W);if(!T){R.push.apply(R,U)}return false}}else{if(E.match.POS.test(V[0])||E.match.CHILD.test(V[0])){return true}}return V},POS:function(R){R.unshift(true);return R}},filters:{enabled:function(R){return R.disabled===false&&R.type!=="hidden"},disabled:function(R){return R.disabled===true},checked:function(R){return R.checked===true},selected:function(R){R.parentNode.selectedIndex;return R.selected===true},parent:function(R){return !!R.firstChild},empty:function(R){return !R.firstChild},has:function(T,S,R){return !!B(R[3],T).length},header:function(R){return/h\d/i.test(R.nodeName)},text:function(R){return"text"===R.type},radio:function(R){return"radio"===R.type},checkbox:function(R){return"checkbox"===R.type},file:function(R){return"file"===R.type},password:function(R){return"password"===R.type},submit:function(R){return"submit"===R.type},image:function(R){return"image"===R.type},reset:function(R){return"reset"===R.type},button:function(R){return"button"===R.type||R.nodeName.toUpperCase()==="BUTTON"},input:function(R){return/input|select|textarea|button/i.test(R.nodeName)}},setFilters:{first:function(S,R){return R===0},last:function(T,S,R,U){return S===U.length-1},even:function(S,R){return R%2===0},odd:function(S,R){return R%2===1},lt:function(T,S,R){return S<R[3]-0},gt:function(T,S,R){return S>R[3]-0},nth:function(T,S,R){return R[3]-0==S},eq:function(T,S,R){return R[3]-0==S}},filter:{PSEUDO:function(X,T,U,Y){var S=T[1],V=E.filters[S];if(V){return V(X,U,T,Y)}else{if(S==="contains"){return(X.textContent||X.innerText||"").indexOf(T[3])>=0}else{if(S==="not"){var W=T[3];for(var U=0,R=W.length;U<R;U++){if(W[U]===X){return false}}return true}}}},CHILD:function(R,U){var X=U[1],S=R;switch(X){case"only":case"first":while((S=S.previousSibling)){if(S.nodeType===1){return false}}if(X=="first"){return true}S=R;case"last":while((S=S.nextSibling)){if(S.nodeType===1){return false}}return true;case"nth":var T=U[2],b=U[3];if(T==1&&b==0){return true}var W=U[0],Z=R.parentNode;if(Z&&(Z.sizcache!==W||!R.nodeIndex)){var V=0;for(S=Z.firstChild;S;S=S.nextSibling){if(S.nodeType===1){S.nodeIndex=++V}}Z.sizcache=W}var Y=R.nodeIndex-b;if(T==0){return Y==0}else{return(Y%T==0&&Y/T>=0)}}},ID:function(S,R){return S.nodeType===1&&S.getAttribute("id")===R},TAG:function(S,R){return(R==="*"&&S.nodeType===1)||S.nodeName===R},CLASS:function(S,R){return(" "+(S.className||S.getAttribute("class"))+" ").indexOf(R)>-1},ATTR:function(W,U){var T=U[1],R=E.attrHandle[T]?E.attrHandle[T](W):W[T]!=null?W[T]:W.getAttribute(T),X=R+"",V=U[2],S=U[4];return R==null?V==="!=":V==="="?X===S:V==="*="?X.indexOf(S)>=0:V==="~="?(" "+X+" ").indexOf(S)>=0:!S?X&&R!==false:V==="!="?X!=S:V==="^="?X.indexOf(S)===0:V==="$="?X.substr(X.length-S.length)===S:V==="|="?X===S||X.substr(0,S.length+1)===S+"-":false},POS:function(V,S,T,W){var R=S[2],U=E.setFilters[R];if(U){return U(V,T,S,W)}}}};var J=E.match.POS;for(var L in E.match){E.match[L]=new RegExp(E.match[L].source+/(?![^\[]*\])(?![^\(]*\))/.source);E.leftMatch[L]=new RegExp(/(^(?:.|\r|\n)*?)/.source+E.match[L].source)}var A=function(S,R){S=Array.prototype.slice.call(S,0);if(R){R.push.apply(R,S);return R}return S};try{Array.prototype.slice.call(document.documentElement.childNodes,0)}catch(K){A=function(V,U){var S=U||[];if(D.call(V)==="[object Array]"){Array.prototype.push.apply(S,V)}else{if(typeof V.length==="number"){for(var T=0,R=V.length;T<R;T++){S.push(V[T])}}else{for(var T=0;V[T];T++){S.push(V[T])}}}return S}}var C;if(document.documentElement.compareDocumentPosition){C=function(S,R){if(!S.compareDocumentPosition||!R.compareDocumentPosition){if(S==R){N=true}return 0}var T=S.compareDocumentPosition(R)&4?-1:S===R?0:1;if(T===0){N=true}return T}}else{if("sourceIndex" in document.documentElement){C=function(S,R){if(!S.sourceIndex||!R.sourceIndex){if(S==R){N=true}return 0}var T=S.sourceIndex-R.sourceIndex;if(T===0){N=true}return T}}else{if(document.createRange){C=function(U,S){if(!U.ownerDocument||!S.ownerDocument){if(U==S){N=true}return 0}var T=U.ownerDocument.createRange(),R=S.ownerDocument.createRange();T.setStart(U,0);T.setEnd(U,0);R.setStart(S,0);R.setEnd(S,0);var V=T.compareBoundaryPoints(Range.START_TO_END,R);if(V===0){N=true}return V}}}}(function(){var S=document.createElement("div"),T="script"+(new Date).getTime();S.innerHTML="<a name='"+T+"'/>";var R=document.documentElement;R.insertBefore(S,R.firstChild);if(!!document.getElementById(T)){E.find.ID=function(V,W,X){if(typeof W.getElementById!=="undefined"&&!X){var U=W.getElementById(V[1]);return U?U.id===V[1]||typeof U.getAttributeNode!=="undefined"&&U.getAttributeNode("id").nodeValue===V[1]?[U]:undefined:[]}};E.filter.ID=function(W,U){var V=typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id");return W.nodeType===1&&V&&V.nodeValue===U}}R.removeChild(S);R=S=null})();(function(){var R=document.createElement("div");R.appendChild(document.createComment(""));if(R.getElementsByTagName("*").length>0){E.find.TAG=function(S,W){var V=W.getElementsByTagName(S[1]);if(S[1]==="*"){var U=[];for(var T=0;V[T];T++){if(V[T].nodeType===1){U.push(V[T])}}V=U}return V}}R.innerHTML="<a href='#'></a>";if(R.firstChild&&typeof R.firstChild.getAttribute!=="undefined"&&R.firstChild.getAttribute("href")!=="#"){E.attrHandle.href=function(S){return S.getAttribute("href",2)}}R=null})();if(document.querySelectorAll){(function(){var R=B,T=document.createElement("div");T.innerHTML="<p class='TEST'></p>";if(T.querySelectorAll&&T.querySelectorAll(".TEST").length===0){return }B=function(X,W,U,V){W=W||document;if(!V&&W.nodeType===9&&!O(W)){try{return A(W.querySelectorAll(X),U)}catch(Y){}}return R(X,W,U,V)};for(var S in R){B[S]=R[S]}T=null})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var R=document.createElement("div");R.innerHTML="<div class='test e'></div><div class='test'></div>";if(R.getElementsByClassName("e").length===0){return }R.lastChild.className="e";if(R.getElementsByClassName("e").length===1){return }E.order.splice(1,0,"CLASS");E.find.CLASS=function(S,T,U){if(typeof T.getElementsByClassName!=="undefined"&&!U){return T.getElementsByClassName(S[1])}};R=null})()}function M(S,X,W,c,Y,b){var Z=S=="previousSibling"&&!b;for(var U=0,T=c.length;U<T;U++){var R=c[U];if(R){if(Z&&R.nodeType===1){R.sizcache=W;R.sizset=U}R=R[S];var V=false;while(R){if(R.sizcache===W){V=c[R.sizset];break}if(R.nodeType===1&&!b){R.sizcache=W;R.sizset=U}if(R.nodeName===X){V=R;break}R=R[S]}c[U]=V}}}function Q(S,X,W,c,Y,b){var Z=S=="previousSibling"&&!b;for(var U=0,T=c.length;U<T;U++){var R=c[U];if(R){if(Z&&R.nodeType===1){R.sizcache=W;R.sizset=U}R=R[S];var V=false;while(R){if(R.sizcache===W){V=c[R.sizset];break}if(R.nodeType===1){if(!b){R.sizcache=W;R.sizset=U}if(typeof X!=="string"){if(R===X){V=true;break}}else{if(B.filter(X,[R]).length>0){V=R;break}}}R=R[S]}c[U]=V}}}var G=document.compareDocumentPosition?function(S,R){return S.compareDocumentPosition(R)&16}:function(S,R){return S!==R&&(S.contains?S.contains(R):true)};var O=function(R){return R.nodeType===9&&R.documentElement.nodeName!=="HTML"||!!R.ownerDocument&&R.ownerDocument.documentElement.nodeName!=="HTML"};var F=function(R,Y){var U=[],V="",W,T=Y.nodeType?[Y]:Y;while((W=E.match.PSEUDO.exec(R))){V+=W[0];R=R.replace(E.match.PSEUDO,"")}R=E.relative[R]?R+"*":R;for(var X=0,S=T.length;X<S;X++){B(R,T[X],U)}return B.filter(V,U)};window.Sizzle=B})();(function(C){var D=Prototype.Selector.extendElements;function A(E,F){return D(C(E,F||document))}function B(F,E){return C.matches(E,[F]).length==1}Prototype.Selector.engine=C;Prototype.Selector.select=A;Prototype.Selector.match=B})(Sizzle);window.Sizzle=Prototype._original_property;delete Prototype._original_property;var Form={reset:function(A){A=$(A);A.reset();return A},serializeElements:function(H,D){if(typeof D!="object"){D={hash:!!D}}else{if(Object.isUndefined(D.hash)){D.hash=true}}var E,G,A=false,F=D.submit,B,C;if(D.hash){C={};B=function(I,J,K){if(J in I){if(!Object.isArray(I[J])){I[J]=[I[J]]}I[J].push(K)}else{I[J]=K}return I}}else{C="";B=function(I,J,K){return I+(I?"&":"")+encodeURIComponent(J)+"="+encodeURIComponent(K)}}return H.inject(C,function(I,J){if(!J.disabled&&J.name){E=J.name;G=$(J).getValue();if(G!=null&&J.type!="file"&&(J.type!="submit"||(!A&&F!==false&&(!F||E==F)&&(A=true)))){I=B(I,E,G)}}return I})}};Form.Methods={serialize:function(B,A){return Form.serializeElements(Form.getElements(B),A)},getElements:function(E){var F=$(E).getElementsByTagName("*"),D,A=[],C=Form.Element.Serializers;for(var B=0;D=F[B];B++){A.push(D)}return A.inject([],function(G,H){if(C[H.tagName.toLowerCase()]){G.push(Element.extend(H))}return G})},getInputs:function(G,C,D){G=$(G);var A=G.getElementsByTagName("input");if(!C&&!D){return $A(A).map(Element.extend)}for(var E=0,H=[],F=A.length;E<F;E++){var B=A[E];if((C&&B.type!=C)||(D&&B.name!=D)){continue}H.push(Element.extend(B))}return H},disable:function(A){A=$(A);Form.getElements(A).invoke("disable");return A},enable:function(A){A=$(A);Form.getElements(A).invoke("enable");return A},findFirstElement:function(B){var C=$(B).getElements().findAll(function(D){return"hidden"!=D.type&&!D.disabled});var A=C.findAll(function(D){return D.hasAttribute("tabIndex")&&D.tabIndex>=0}).sortBy(function(D){return D.tabIndex}).first();return A?A:C.find(function(D){return/^(?:input|select|textarea)$/i.test(D.tagName)})},focusFirstElement:function(B){B=$(B);var A=B.findFirstElement();if(A){A.activate()}return B},request:function(B,A){B=$(B),A=Object.clone(A||{});var D=A.parameters,C=B.readAttribute("action")||"";if(C.blank()){C=window.location.href}A.parameters=B.serialize(true);if(D){if(Object.isString(D)){D=D.toQueryParams()}Object.extend(A.parameters,D)}if(B.hasAttribute("method")&&!A.method){A.method=B.method}return new Ajax.Request(C,A)}};Form.Element={focus:function(A){$(A).focus();return A},select:function(A){$(A).select();return A}};Form.Element.Methods={serialize:function(A){A=$(A);if(!A.disabled&&A.name){var B=A.getValue();if(B!=undefined){var C={};C[A.name]=B;return Object.toQueryString(C)}}return""},getValue:function(A){A=$(A);var B=A.tagName.toLowerCase();return Form.Element.Serializers[B](A)},setValue:function(A,B){A=$(A);var C=A.tagName.toLowerCase();Form.Element.Serializers[C](A,B);return A},clear:function(A){$(A).value="";return A},present:function(A){return $(A).value!=""},activate:function(A){A=$(A);try{A.focus();if(A.select&&(A.tagName.toLowerCase()!="input"||!(/^(?:button|reset|submit)$/i.test(A.type)))){A.select()}}catch(B){}return A},disable:function(A){A=$(A);A.disabled=true;return A},enable:function(A){A=$(A);A.disabled=false;return A}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers=(function(){function B(H,I){switch(H.type.toLowerCase()){case"checkbox":case"radio":return F(H,I);default:return E(H,I)}}function F(H,I){if(Object.isUndefined(I)){return H.checked?H.value:null}else{H.checked=!!I}}function E(H,I){if(Object.isUndefined(I)){return H.value}else{H.value=I}}function A(J,M){if(Object.isUndefined(M)){return(J.type==="select-one"?C:D)(J)}var I,K,N=!Object.isArray(M);for(var H=0,L=J.length;H<L;H++){I=J.options[H];K=this.optionValue(I);if(N){if(K==M){I.selected=true;return }}else{I.selected=M.include(K)}}}function C(I){var H=I.selectedIndex;return H>=0?G(I.options[H]):null}function D(K){var H,L=K.length;if(!L){return null}for(var J=0,H=[];J<L;J++){var I=K.options[J];if(I.selected){H.push(G(I))}}return H}function G(H){return Element.hasAttribute(H,"value")?H.value:H.text}return{input:B,inputSelector:F,textarea:E,select:A,selectOne:C,selectMany:D,optionValue:G,button:E}})();Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,A,B,C){$super(C,B);this.element=$(A);this.lastValue=this.getValue()},execute:function(){var A=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(A)?this.lastValue!=A:String(this.lastValue)!=String(A)){this.callback(this.element,A);this.lastValue=A}}});Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element)}});Abstract.EventObserver=Class.create({initialize:function(A,B){this.element=$(A);this.callback=B;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()}else{this.registerCallback(this.element)}},onElementEvent:function(){var A=this.getValue();if(this.lastValue!=A){this.callback(this.element,A);this.lastValue=A}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)},registerCallback:function(A){if(A.type){switch(A.type.toLowerCase()){case"checkbox":case"radio":Event.observe(A,"click",this.onElementEvent.bind(this));break;default:Event.observe(A,"change",this.onElementEvent.bind(this));break}}}});Form.Element.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element)}});(function(){var d={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,KEY_INSERT:45,cache:{}};var F=document.documentElement;var e="onmouseenter" in F&&"onmouseleave" in F;var A=function(f){return false};if(window.attachEvent){if(window.addEventListener){A=function(f){return !(f instanceof window.Event)}}else{A=function(f){return true}}}var R;function b(g,f){return g.which?(g.which===f+1):(g.button===f)}var O={0:1,1:4,2:2};function Y(g,f){return g.button===O[f]}function c(g,f){switch(f){case 0:return g.which==1&&!g.metaKey;case 1:return g.which==2||(g.which==1&&g.metaKey);case 2:return g.which==3;default:return false}}if(window.attachEvent){if(!window.addEventListener){R=Y}else{R=function(g,f){return A(g)?Y(g,f):b(g,f)}}}else{if(Prototype.Browser.WebKit){R=c}else{R=b}}function V(f){return R(f,0)}function T(f){return R(f,1)}function N(f){return R(f,2)}function D(h){h=d.extend(h);var g=h.target,f=h.type,j=h.currentTarget;if(j&&j.tagName){if(f==="load"||f==="error"||(f==="click"&&j.tagName.toLowerCase()==="input"&&j.type==="radio")){g=j}}if(g.nodeType==Node.TEXT_NODE){g=g.parentNode}return Element.extend(g)}function P(g,h){var f=d.element(g);if(!h){return f}while(f){if(Object.isElement(f)&&Prototype.Selector.match(f,h)){return Element.extend(f)}f=f.parentNode}}function S(f){return{x:C(f),y:B(f)}}function C(h){var g=document.documentElement,f=document.body||{scrollLeft:0};return h.pageX||(h.clientX+(g.scrollLeft||f.scrollLeft)-(g.clientLeft||0))}function B(h){var g=document.documentElement,f=document.body||{scrollTop:0};return h.pageY||(h.clientY+(g.scrollTop||f.scrollTop)-(g.clientTop||0))}function Q(f){d.extend(f);f.preventDefault();f.stopPropagation();f.stopped=true}d.Methods={isLeftClick:V,isMiddleClick:T,isRightClick:N,element:D,findElement:P,pointer:S,pointerX:C,pointerY:B,stop:Q};var X=Object.keys(d.Methods).inject({},function(f,g){f[g]=d.Methods[g].methodize();return f});if(window.attachEvent){function I(g){var f;switch(g.type){case"mouseover":case"mouseenter":f=g.fromElement;break;case"mouseout":case"mouseleave":f=g.toElement;break;default:return null}return Element.extend(f)}var U={stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}};d.extend=function(g,f){if(!g){return false}if(!A(g)){return g}if(g._extendedByPrototype){return g}g._extendedByPrototype=Prototype.emptyFunction;var h=d.pointer(g);Object.extend(g,{target:g.srcElement||f,relatedTarget:I(g),pageX:h.x,pageY:h.y});Object.extend(g,X);Object.extend(g,U);return g}}else{d.extend=Prototype.K}if(window.addEventListener){d.prototype=window.Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(d.prototype,X)}function M(k,j,l){var h=Element.retrieve(k,"prototype_event_registry");if(Object.isUndefined(h)){E.push(k);h=Element.retrieve(k,"prototype_event_registry",$H())}var f=h.get(j);if(Object.isUndefined(f)){f=[];h.set(j,f)}if(f.pluck("handler").include(l)){return false}var g;if(j.include(":")){g=function(m){if(Object.isUndefined(m.eventName)){return false}if(m.eventName!==j){return false}d.extend(m,k);l.call(k,m)}}else{if(!e&&(j==="mouseenter"||j==="mouseleave")){if(j==="mouseenter"||j==="mouseleave"){g=function(n){d.extend(n,k);var m=n.relatedTarget;while(m&&m!==k){try{m=m.parentNode}catch(o){m=k}}if(m===k){return }l.call(k,n)}}}else{g=function(m){d.extend(m,k);l.call(k,m)}}}g.handler=l;f.push(g);return g}function H(){for(var f=0,g=E.length;f<g;f++){d.stopObserving(E[f]);E[f]=null}}var E=[];if(Prototype.Browser.IE){window.attachEvent("onunload",H)}if(Prototype.Browser.WebKit){window.addEventListener("unload",Prototype.emptyFunction,false)}var L=Prototype.K,G={mouseenter:"mouseover",mouseleave:"mouseout"};if(!e){L=function(f){return(G[f]||f)}}function W(j,h,k){j=$(j);var g=M(j,h,k);if(!g){return j}if(h.include(":")){if(j.addEventListener){j.addEventListener("dataavailable",g,false)}else{j.attachEvent("ondataavailable",g);j.attachEvent("onlosecapture",g)}}else{var f=L(h);if(j.addEventListener){j.addEventListener(f,g,false)}else{j.attachEvent("on"+f,g)}}return j}function K(m,j,n){m=$(m);var h=Element.retrieve(m,"prototype_event_registry");if(!h){return m}if(!j){h.each(function(p){var o=p.key;K(m,o)});return m}var k=h.get(j);if(!k){return m}if(!n){k.each(function(o){K(m,j,o.handler)});return m}var l=k.length,g;while(l--){if(k[l].handler===n){g=k[l];break}}if(!g){return m}if(j.include(":")){if(m.removeEventListener){m.removeEventListener("dataavailable",g,false)}else{m.detachEvent("ondataavailable",g);m.detachEvent("onlosecapture",g)}}else{var f=L(j);if(m.removeEventListener){m.removeEventListener(f,g,false)}else{m.detachEvent("on"+f,g)}}h.set(j,k.without(g));return m}function Z(j,h,g,f){j=$(j);if(Object.isUndefined(f)){f=true}if(j==document&&document.createEvent&&!j.dispatchEvent){j=document.documentElement}var k;if(document.createEvent){k=document.createEvent("HTMLEvents");k.initEvent("dataavailable",f,true)}else{k=document.createEventObject();k.eventType=f?"ondataavailable":"onlosecapture"}k.eventName=h;k.memo=g||{};if(document.createEvent){j.dispatchEvent(k)}else{j.fireEvent(k.eventType,k)}return d.extend(k)}d.Handler=Class.create({initialize:function(h,g,f,j){this.element=$(h);this.eventName=g;this.selector=f;this.callback=j;this.handler=this.handleEvent.bind(this)},start:function(){d.observe(this.element,this.eventName,this.handler);return this},stop:function(){d.stopObserving(this.element,this.eventName,this.handler);return this},handleEvent:function(g){var f=d.findElement(g,this.selector);if(f){this.callback.call(this.element,g,f)}}});function J(h,g,f,j){h=$(h);if(Object.isFunction(f)&&Object.isUndefined(j)){j=f,f=null}return new d.Handler(h,g,f,j).start()}Object.extend(d,d.Methods);Object.extend(d,{fire:Z,observe:W,stopObserving:K,on:J});Element.addMethods({fire:Z,observe:W,stopObserving:K,on:J});Object.extend(document,{fire:Z.methodize(),observe:W.methodize(),stopObserving:K.methodize(),on:J.methodize(),loaded:false});if(window.Event){Object.extend(window.Event,d)}else{window.Event=d}})();(function(){var D;function A(){if(document.loaded){return }if(D){window.clearTimeout(D)}document.loaded=true;document.fire("dom:loaded")}function C(){if(document.readyState==="complete"){document.stopObserving("readystatechange",C);A()}}function B(){try{document.documentElement.doScroll("left")}catch(E){D=B.defer();return }A()}if(document.addEventListener){document.addEventListener("DOMContentLoaded",A,false)}else{document.observe("readystatechange",C);if(window==top){D=B.defer()}}Event.observe(window,"load",A)})();Element.addMethods();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(A,B){return Element.insert(A,{before:B})},Top:function(A,B){return Element.insert(A,{top:B})},Bottom:function(A,B){return Element.insert(A,{bottom:B})},After:function(A,B){return Element.insert(A,{after:B})}};var $continue=new Error('"throw $continue" is deprecated, use "return" instead');var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},within:function(B,A,C){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(B,A,C)}this.xcomp=A;this.ycomp=C;this.offset=Element.cumulativeOffset(B);return(C>=this.offset[1]&&C<this.offset[1]+B.offsetHeight&&A>=this.offset[0]&&A<this.offset[0]+B.offsetWidth)},withinIncludingScrolloffsets:function(B,A,D){var C=Element.cumulativeScrollOffset(B);this.xcomp=A+C[0]-this.deltaX;this.ycomp=D+C[1]-this.deltaY;this.offset=Element.cumulativeOffset(B);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+B.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+B.offsetWidth)},overlap:function(B,A){if(!B){return 0}if(B=="vertical"){return((this.offset[1]+A.offsetHeight)-this.ycomp)/A.offsetHeight}if(B=="horizontal"){return((this.offset[0]+A.offsetWidth)-this.xcomp)/A.offsetWidth}},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(A){Position.prepare();return Element.absolutize(A)},relativize:function(A){Position.prepare();return Element.relativize(A)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(B,C,A){A=A||{};return Element.clonePosition(C,B,A)}};if(!document.getElementsByClassName){document.getElementsByClassName=function(B){function A(C){return C.blank()?null:"[contains(concat(' ', @class, ' '), ' "+C+" ')]"}B.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(C,E){E=E.toString().strip();var D=/\s/.test(E)?$w(E).map(A).join(""):A(E);return D?document._getElementsByXPath(".//*"+D,C):[]}:function(E,F){F=F.toString().strip();var G=[],H=(/\s/.test(F)?$w(F):null);if(!H&&!F){return G}var C=$(E).getElementsByTagName("*");F=" "+F+" ";for(var D=0,J,I;J=C[D];D++){if(J.className&&(I=" "+J.className+" ")&&(I.include(F)||(H&&H.all(function(K){return !K.toString().blank()&&I.include(" "+K+" ")})))){G.push(Element.extend(J))}}return G};return function(D,C){return $(C||document.body).getElementsByClassName(D)}}(Element.Methods)}Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(A){this.element=$(A)},_each:function(A){this.element.className.split(/\s+/).select(function(B){return B.length>0})._each(A)},set:function(A){this.element.className=A},add:function(A){if(this.include(A)){return }this.set($A(this).concat(A).join(" "))},remove:function(A){if(!this.include(A)){return }this.set($A(this).without(A).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);(function(){window.Selector=Class.create({initialize:function(A){this.expression=A.strip()},findElements:function(A){return Prototype.Selector.select(this.expression,A)},match:function(A){return Prototype.Selector.match(A,this.expression)},toString:function(){return this.expression},inspect:function(){return"#<Selector: "+this.expression+">"}});Object.extend(Selector,{matchElements:function(F,G){var A=Prototype.Selector.match,D=[];for(var C=0,E=F.length;C<E;C++){var B=F[C];if(A(B,G)){D.push(Element.extend(B))}}return D},findElement:function(F,G,B){B=B||0;var A=0,D;for(var C=0,E=F.length;C<E;C++){D=F[C];if(Prototype.Selector.match(D,G)&&B===A++){return Element.extend(D)}}},findChildElements:function(B,C){var A=C.toArray().join(", ");return Prototype.Selector.select(A,B||document)}})})();function nobubble(A){if(!A){A=window.event}A.cancelBubble=true;if(A.stopPropagation){A.stopPropagation()}}function de(A){return document.getElementById(A)}function initFirst(B,C,A){if(typeof (B[C])=="undefined"){B[C]=A}}function tag(B,A){return B.getElementsByTagName(A)}function nodeValue(D){var A=D.childNodes;var B=new StringBuffer();B.append("");for(var C=0;C<A.length;C++){B.append(A[C].nodeValue)}return B.toString()}function nvn(B,A){return nodeValue(tag(B,A)[0])}function nivn(B,A){return parseInt(nvn(B,A))}function nfvn(B,A){return parseFloat(nvn(B,A))}function nbvn(B,A){return nvn(B,A).trim()=="true"}function nh(B,A){return(tag(B,A).length>0)}function parseBoolean(A){return A.trim()=="true"}function selval(B){var A=de(B);if(!A||A.selectedIndex<0){return null}return A.options[A.selectedIndex].value}function doDebug(){if(typeof (debug)!="undefined"&&debug){return true}return false}function viewport(){this.windowX=(document.documentElement&&document.documentElement.clientWidth)||window.innerWidth||self.innerWidth||document.body.clientWidth;this.windowY=(document.documentElement&&document.documentElement.clientHeight)||window.innerHeight||self.innerHeight||document.body.clientHeight;this.scrollX=(document.documentElement&&document.documentElement.scrollLeft)||window.pageXOffset||self.pageXOffset||document.body.scrollLeft;this.scrollY=(document.documentElement&&document.documentElement.scrollTop)||window.pageYOffset||self.pageYOffset||document.body.scrollTop;this.pageX=(document.documentElement&&document.documentElement.scrollWidth)?document.documentElement.scrollWidth:(document.body.scrollWidth>document.body.offsetWidth)?document.body.scrollWidth:document.body.offsetWidth;this.pageY=(document.documentElement&&document.documentElement.scrollHeight)?document.documentElement.scrollHeight:(document.body.scrollHeight>document.body.offsetHeight)?document.body.scrollHeight:document.body.offsetHeight}function pageDimensions(){var B=-1;var A=-1;if(window.innerWidth&&window.innerHeight){B=window.innerWidth;A=window.innerHeight}else{if(document.documentElement.clientHeight&&document.documentElement.clientWidth){B=document.documentElement.clientWidth;A=document.documentElement.clientHeight}else{if(document.body.clientWidth&&document.body.clientHeight){B=document.body.clientWidth;A=document.body.clientHeight}}}if(B<0||A<0){return null}return{width:B,height:A}}function documentDimensions(){var B=(document.documentElement&&document.documentElement.scrollWidth)?document.documentElement.scrollWidth:(document.body.scrollWidth>document.body.offsetWidth)?document.body.scrollWidth:document.body.offsetWidth;var A=(document.documentElement&&document.documentElement.scrollHeight)?document.documentElement.scrollHeight:(document.body.scrollHeight>document.body.offsetHeight)?document.body.scrollHeight:document.body.offsetHeight;return{width:B,height:A}}function elementDimensions(A){return{width:A.offsetWidth,height:A.offsetHeight}}function pageScroll(){var C=(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body;var A=document.all?C.scrollLeft:pageXOffset;var B=document.all?C.scrollTop:pageYOffset;return{left:A,top:B}}function scrollTo(A,B){var C=getObjectOffset(A);window.scroll(0,C.y+(B||0))}function scrollOffset(A){window.scroll(0,pageScroll().top+A)}function mouseCoords(C){if(window.event){C=window.event}var A=0;var D=0;if(document.all){var B=(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body;A=C.clientX+B.scrollLeft-B.clientLeft;D=C.clientY+B.scrollTop-B.clientTop}else{A=C.pageX;D=C.pageY}if(A<0){A=0}if(D<0){D=0}return{x:A,y:D}}function getObjectOffset(B){var C=0;var A=0;if(B.offsetParent){C=B.offsetLeft;A=B.offsetTop;while(B=B.offsetParent){C+=B.offsetLeft;A+=B.offsetTop}}return{x:C,y:A}}var cleanItems=new Array();function addCleanItem(A){cleanItems[cleanItems.length]=A}function cleanUp(){for(var A=0;A<cleanItems.length;A++){var B=de(cleanItems[A]);if(B){purge(B)}}}function setInnerHtml(C,A){var B=de(C);if(!B){return }addCleanItem(C);purge(B);B.innerHTML=A}function appendInnerHtml(C,A){var B=de(C);if(!B){return }addCleanItem(C);B.innerHTML+=A}function appendDOM(C,A){var B=de(C);if(!B){return }B.appendChild(A)}function clearDOMChildren(B){var A=de(B);if(!A||!A.hasChildNodes()){return }while(A.childNodes.length>0){A.removeChild(A.firstChild)}}function swapbg(D,B,C){var A="";if(C){A=(is_ie&&!is_ie7)?".gif":".png"}de(D).style.backgroundImage="url("+B+A+")"}function swapimg(B,A){de(B).src=A}function setvisibility(B,A){de(B).style.visibility=A}function scriptify(C){var A=new StringBuffer();for(var B=0;B<C.length;B++){var D=C.charAt(B);if(D=="'"){A.a("&#39;")}else{if(D=='"'){A.a("&quot;")}else{if(D=="\\"){A.a("\\\\")}else{A.a(D)}}}}return A.toString()}function entify(C){var A=new StringBuffer();for(var B=0;B<C.length;B++){var E=C.charCodeAt(B);var D=String.fromCharCode(E);if(D=="<"){A.a("&lt;")}else{if(D==">"){A.a("&gt;")}else{if(D=="&"){A.a("&amp;")}else{if(E>127){A.a("&#"+E+";")}else{A.a(D)}}}}}return A.toString()}function pagify(B){var A=B;A=A.replace(/\r/g,"");A=A.replace(/\n/g,"<br/>");return A}function getCheckedValue(B){if(!B){return null}var C=B.length;if(C==undefined){if(B.checked){return B.value}else{return null}}for(var A=0;A<C;A++){if(B[A].checked){return B[A].value}}return null}function truncateDecimals(D,B){var A=10;for(var C=1;C<B;C++){A*=10}return parseInt(D*A)/A}function purge(D){if(typeof (is_ie6)!="undefined"&&!is_ie6){return }var B=D.attributes,C,A,E;if(B){A=B.length;for(C=0;C<A;++C){E=B[C].name;if(typeof (D[E])=="function"){D[E]=null}}}}function StringBuffer(){this.buffer=[]}StringBuffer.prototype.append=function append(A){this.buffer.push(A);return this};StringBuffer.prototype.a=function a(A){return this.append(A)};StringBuffer.prototype.toString=function toString(){return this.buffer.join("")};String.prototype.trim=function(){return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/,"$1")};Array.prototype.contains=function(B){for(var A=0;A<this.length;A++){if(this[A]==B){return true}}return false};function makeValidHex(D){var A=new StringBuffer();for(var B=0;B<D.length;B++){var C=D.charAt(B);if(C>="0"&&C<="9"||C>="A"&&C<="F"||C>="a"&&C<="f"){A.a(C)}else{A.a("0")}}D=A.toString();while(D.length<3){D+="0"}while(D.length>3&&D.length<6){D+="0"}if(D.length>6){D=D.substring(0,6)}return D}function sameDomain(D){try{var A=location.href.indexOf("/",location.href.indexOf("/")+2);var B=D.location.href.indexOf("/",D.location.href.indexOf("/")+2);return(location.href.substring(0,A)==D.location.href.substring(0,B))}catch(C){return false}}function enterPressed(A){var B;if(window.event){B=window.event.keyCode}else{if(A.which){B=A.which}}if(B==13){return true}else{return false}}function escPressed(C){var A=(window.event)?event.keyCode:C.keyCode;var B=(window.event)?27:C.DOM_VK_ESCAPE;if(A==B){return true}else{return false}}function embedJump(A){location.href=location.href.replace(/\/embed\/.+?\/m\//,"/embed/"+A+"/m/")}function isLetterOrDigit(A){return isLetter(A)|isDigit(A)}function isLetter(A){if(A!=null&&(A.charCodeAt(0)>=65&&A.charCodeAt(0)<=90)||(A.charCodeAt(0)>=97&&A.charCodeAt(0)<=122)){return true}return false}function isDigit(A){if(A!=null&&A.charCodeAt(0)>=48&&A.charCodeAt(0)<=57){return true}return false}var RandomString={_chars:"01234567890abcdefghijklmnopqrstuvwxyzABCDEFGHJIKLMNOPQRSTUVWXYZ",makeString:function(A){var C=new StringBuffer();for(var D=0;D<A;D++){var B=Math.floor(Math.random()*this._chars.length);C.append(this._chars.charAt(B))}return C.toString()}};function agesAgo(A){if(A<0){return"not long"}if(A<60){return A+" seconds"}if(A<3600){return parseInt(A/60)+" minutes"}if(A<86400){return parseInt(A/3600)+" hours"}if(A<604800){return parseInt(A/86400)+" days"}if(A<2635200){return parseInt(A/604800)+" weeks"}return parseInt(A/2635200)+" months"}function setupInputText(A,B){A.alt=B;A.onfocus=clearInputText(null,A);A.onblur=resetInputText(null,A);initInputText(A)}function initInputText(A){clearInputText(A);resetInputText(A)}function clearInputText(A){if(A.value==A.alt){A.value=""}$(A).removeClassName("mwu-prompt")}function resetInputText(A){if(A.value.trim().length==0){A.value=A.alt;$(A).addClassName("mwu-prompt")}}function clearTextArea(B,A){if(B.value==A){B.value=""}B.removeClassName("mwu-prompt")}function resetTextArea(B,A){if(B.value.trim().length==0){B.value=A;B.addClassName("mwu-prompt")}}function positionMWUDialogs(){$$(".mwu-dialog").each(function(A){var B=elementDimensions(A);A.setStyle({"marginLeft":"-"+(B.width/2)+"px"})})}function initProfileSettingsAccount(){initDefault();setLinkedAccountHtml()}function initMobilePage(){initProfileSettings();initLafFields()}function initLafFields(){var A=showIconDefault||showIconUser||(showThumbnail&&defDisplayId>=0);de("defartdisplaytitle").checked=showTitle;de("defartdisplaycolor").selectedIndex=(defColor-1);de("defartdisplaythumb").checked=showThumbnail&&defDisplayId<0;de("defartdisplaythumbcluster").checked=de("defartdisplaythumb").checked&&showCluster;de("defartdisplayicon").checked=A;de("defartdisplayiconcluster").checked=de("defartdisplayicon").checked&&showCluster;selectIcon(showIconDefault?2:showIconUser||showThumbnail?4:0,defDisplayId,defIconName,showThumbnail);de("defartdisplayicontop").selectedIndex=Math.abs(defAnchorTop);de("defartdisplayiconleft").selectedIndex=Math.abs(defAnchorLeft);lafCheck(null)}function lafCheck(D){var C=de("defartdisplaytitle").checked;var A=de("defartdisplaythumb").checked;var B=de("defartdisplayicon").checked;if(!C&&!A&&!B){de("defartdisplaythumb").checked=true;A=true}else{if(A&&B){if(D=="icon"){de("defartdisplaythumb").checked=false;de("defartdisplayicon").checked=true;A=false}else{de("defartdisplaythumb").checked=true;de("defartdisplayicon").checked=false;B=false}}}de("defartdisplaycolor").disabled=!C;de("defartdisplaythumbcluster").disabled=!A;de("defartdisplaythumbclustertxt").style.color=A?"black":"silver";de("defartdisplayiconcluster").disabled=!B;de("defartdisplayiconclustertxt").style.color=B?"black":"silver";de("selectdefarticon").style.display=B?"block":"none"}function lafBuildArgs(){var E=de("defartdisplaytitle").checked;var J=de("defartdisplaythumb").checked;var B=de("defartdisplayicon").checked;var K=J?de("defartdisplaythumbcluster").checked:B?de("defartdisplayiconcluster").checked:false;var L=J?-1:parseInt(de("defartdisplayiconid").value);if(isNaN(L)){L=-1}var M=J?4:parseInt(de("defartdisplayiconsrc").value);if(isNaN(M)){M=0}if(B&&(M<1||L<1)){alert("You must select an image.");return null}var C=de("defartdisplaycolor");var A=C.options[C.selectedIndex].value;var G=de("defartdisplayiconleft");var F=G.options[G.selectedIndex].value;var D=de("defartdisplayicontop");var I=D.options[D.selectedIndex].value;var H="action=setdefart";H+="&dtitle="+E;H+="&dicon="+(B||J);H+="&dcluster="+K;H+="&dcolor="+A;H+="&did="+L;H+="&dsrc="+M;H+="&dleft="+F;H+="&dtop="+I;return H}function lafSave(){var A=lafBuildArgs();if(A!=null){smartCallXML("/users",A,function(){flashNotice("Save successful.")})}}function lafGroupSave(){var A=lafBuildArgs();if(A!=null){smartCallXML("/api/group/admin",A,function(B){if(nh(B,"success")){flashNotice("Save successful.")}else{flashError(nvn(B,"error"))}})}}function setChooseIcon(B){de("iconselectnew").style.display=B?"none":"block";de("iconselectpane").style.display=B?"block":"none";if(B){setInnerHtml("iconselectlist",'<img src="/r/images/loading.gif" />');var A="";if(typeof (autoadd)!="undefined"){A="autoadd="+autoadd}ajaxCall("/IconList",A,function(C){setInnerHtml("iconselectlist",C);de("iconphotolistupload").src="/IconListUpload"})}}function showIconCategory(D,C,A){de("iconCatShow"+D).style.display=C?"none":"inline";de("iconCatHide"+D).style.display=C?"inline":"none";de("iconCat"+D).style.display=C?"block":"none";if(C&&!A){var B=de("iconselectlist");B.scrollTop+=40}}function selectIcon(C,D,B,A){de("defartdisplayiconsrc").value=""+C;de("defartdisplayiconid").value=""+(D?D:"");if(C==2||(C==4&&D>=0)){setInnerHtml("articleicon",'<img src="'+(C==2?"/r/images/icons/default/"+B:"/r/FileView/file/f/F"+D+(A?"/t/true/":"/")+B)+'" style="vertical-align:text-bottom" />')}else{setInnerHtml("articleicon","<i>(No icon selected)</i>")}setChooseIcon(false)}function resetMobileAppkey(){var A="action=resetmobile";smartCallXML("/users",A,function(){location.reload(true)})}function showAddLinkedAcct(){de("addLinkedAcct").style.display="block";de("addLinkedAcctButton").style.display="none"}function displayLinkFields(){de("linkButton").style.display="none";de("facebook").style.display="none";de("openid").style.display="none";de("google").style.display="none";de("twitter").style.display="none";var A=de("account_type").value;if(A=="Facebook"){de("facebook").style.display="block"}else{if(A=="OpenID"){de("openid").style.display="block";de("linkButton").style.display="block"}else{if(A=="Google"){de("google").style.display="block"}else{if(A=="Twitter"){de("twitter").style.display="block"}}}}}function setLinkedAccountHtml(){setInnerHtml("facebookacct","");setInnerHtml("openids","");setInnerHtml("twitteracct","");var A="";smartCallXML("/linked_accts",A,function(I){var H=new StringBuffer();var P=false;setInnerHtml("progress","");var N=nh(I,"password");var F=nh(I,"facebook");var B=nh(I,"twitter");var M=nh(I,"openid")?tag(I,"openid")[0]:null;var O=(M!=null);var C=nh(I,"googleid")?tag(I,"googleid")[0]:null;var E=(C!=null);if(F){P=true;H.a('<div class="aboutitem">');H.a('    <div class="aboutkey"><img src="/r/images/facebook/facebook20.png"/>');H.a('        &nbsp;<span style="vertical-align:top;">Facebook</span>');H.a("    </div>");H.a('    <div class="aboutvalue2 darkgraytext" style="margin-top:15px;">');H.a('        Your Facebook account is connected. <span style="font-size:75%;vertical-align:middle;">(<a href="javascript:void(0)" onclick="doFacebookUnlink()">Unlink</a>)</span>');H.a("    </div>");H.a("</div>");setInnerHtml("facebookacct",H.toString())}var D,K,L;var J;if(O){P=true;H=new StringBuffer();H.a('<div class="aboutitem">');H.a('    <div class="aboutkey">');H.a('        <img src="/r/images/openid-icon-small.png" style="vertical-align:middle;margin-left:1px;" />');H.a('        &nbsp;<span style="vertical-align:top;">OpenID</span>');H.a("    </div>");H.a('    <div class="aboutvalue2 darkgraytext">');H.a('        <div style="height:6px;"></div>');D=tag(M,"account");if(D.length>0){P=true}for(var G=0;G<D.length;G++){K=nodeValue(D[G]);L=K;J=L.length-1;if(J>48){L=L.substr(0,45)+"..."}H.a('        <div id="'+K+'" style="margin-bottom:10px;">');if(N||D.length>1||F||B||E){H.a(""+L+' <span style="font-size:75%;vertical-align:middle;">(<a href="javascript:void(0)" onclick="unlinkOpenid(\''+K+'\');" style="text-align:right">Unlink</a>)</span>')}else{H.a(""+L+' (<a href="javascript:void(0)" onclick="flashError(\'You need to set a password for your account<br/>before you can unlink your last OpenID.\');" style="text-align:right">Unlink</a>)')}H.a("        </div>")}H.a("    </div>");H.a("</div>");H.a('<div style="clear:both"></div>');setInnerHtml("openids",H.toString())}if(E){P=true;H=new StringBuffer();H.a('<div class="aboutitem">');H.a('    <div class="aboutkey">');H.a('        <img src="/r/images/google-icon.png" style="vertical-align:middle;margin-left:1px;" />');H.a('        &nbsp;<span style="vertical-align:top;">Google</span>');H.a("    </div>");H.a('    <div class="aboutvalue2 darkgraytext">');H.a('        <div style="height:6px;"></div>');D=tag(C,"account");if(D.length>0){P=true}for(var G=0;G<D.length;G++){K=nodeValue(D[G]);L=K;J=L.length-1;if(J>48){L=L.substr(0,45)+"..."}H.a('        <div id="'+K+'" style="margin-bottom:10px;">');if(N||D.length>1||F||B||O){H.a(""+L+' <span style="font-size:75%;vertical-align:middle;">(<a href="javascript:void(0)" onclick="unlinkOpenid(\''+K+'\');" style="text-align:right">Unlink</a>)</span>')}else{H.a(""+L+' (<a href="javascript:void(0)" onclick="flashError(\'You need to set a password for your account<br/>before you can unlink your last OpenID.\');" style="text-align:right">Unlink</a>)')}H.a("        </div>")}H.a("    </div>");H.a("</div>");H.a('<div style="clear:both"></div>');setInnerHtml("googleids",H.toString())}if(B){P=true;H=new StringBuffer();H.a('<div class="aboutitem">');H.a('    <div class="aboutkey">');H.a('        <img src="/r/images/twitter_icon.png" style="vertical-align:-3px;" />&nbsp;Twitter');H.a("    </div>");H.a('    <div class="aboutvalue2 darkgraytext" style="margin-top:15px;">');H.a("        Your Twitter account is currently linked.");if(N||F||O){H.a('<span style="font-size:75%;vertical-align:middle;">(<a href="javascript:void(0)" onclick="doTwitterUnlink()">Unlink</a>)</span>')}else{H.a('<span style="font-size:75%;vertical-align:middle;">(<a href="javascript:void(0)" onclick="flashError(\'You need to set a password for your account<br/>before you can unlink Twitter.\');">Unlink</a>)</span>')}H.a("    </div>");H.a("</div>");setInnerHtml("twitteracct",H.toString())}if(!P){H=new StringBuffer();H.a('<div class="aboutitem">');H.a('  <div class="aboutkey"></div>');H.a('  <div class="aboutvalue2 darkgraytext">');H.a("      You don't currently have any linked accounts.");H.a("  </div>");H.a("</div>");setInnerHtml("openids",H.toString())}})}function doTwitterUnlink(){var A="networkid=3";smartCallXML("/oauth/unlinker",A,function(B){if(nh(B,"success")){flashNotice("Successfully unlinked account!");setLinkedAccountHtml()}else{if(nh(B,"error")){flashError("Unable to unlink account. Please try again or contact us if you continue to have problems.")}}})}function unlinkOpenid(B){var A="action=unlink&openid="+encodeURIComponent(B);smartCallXML("/openid",A,function(C){if(nh(C,"success")){flashNotice("Successfully unlinked account!");setLinkedAccountHtml()}else{if(nh(C,"error")){flashError("Unable to unlink account. Please try again or contact us if you continue to have problems.")}}})}function linkOpenid(){var E=location.href.substr(10);var C=E.indexOf("/");var D=E.substr(C);var B=callPrefix+"/openid/redirect?action=link&next="+D;var F;var G=de("account_type").value;if(G=="OpenID"){F=de("openid_url").value}else{if(G=="Google"){F="https://www.google.com/accounts/o8/id"}}var A="&openid="+encodeURIComponent(F);window.location.href=B+A}function setReferrerBlocked(C,E,D,B){var A="action=refblock";A+="&viewid="+E;A+="&uri="+encodeURIComponent(D);A+="&blocked="+B;smartCallXML("/maps",A,function(F){var G=nbvn(F,"success");if(G){B=nbvn(F,"blocked");de("er"+C+"uri").style.textDecoration=B?"line-through":"none";de("er"+C+"block").style.display=B?"none":"inline";de("er"+C+"unblock").style.display=B?"inline":"none"}else{if(nh(F,"error")){MonkeyDialog.show("<h3>"+nvn(F,"error")+"</h3>")}}})}var MEMBER_INVITED=1;var MEMBER_ACTIVE=2;var MEMBER_SUSPENDED=4;function initSubscriptionPage(){initProfileSettings();refreshServices();initEventHandlers()}function initEventHandlers(){var B=de("addtitle");B.onkeypress=function(E){if(enterPressed(E)){de("addbutton").disabled=true;addService()}};var D=de("submgraddlevel");D.onkeypress=function(E){if(enterPressed(E)){addLevel()}};var C=de("submgraddplan");C.onkeypress=function(E){if(enterPressed(E)){addPlan()}};var A=de("submgrinviteuser");A.onkeypress=function(E){if(enterPressed(E)){inviteMember()}}}function refreshServices(){setInnerHtml("servicestatus","Please wait while your services load");setInnerHtml("servicepane",'<img src="/r/images/loading.gif" /><br/><b>Loading service list...</b>');var A="action=services";smartCallXML("/subscription",A,function(G){var I=parseInt(nvn(G,"count"));setInnerHtml("servicestatus","You have "+I+" active service(s)");setInnerHtml("servicepane","");var J=G.getElementsByTagName("service");for(var E=0;E<J.length;E++){var K=J[E];var N=nvn(K,"subid");var M=nvn(K,"title");var H=nvn(K,"desc").trim();if(H.length==0){H='<span style="font-size:7.5pt">NO DESCRIPTION</span>'}var D=(nvn(K,"locked")=="true");var C=nvn(K,"created");if(E>0){var L=document.createElement("div");L.style.clear="left";L.style.height="10px";de("servicepane").appendChild(L)}var F=new StringBuffer();F.a('<div style="float:left; margin:6px 10px 0px 2px; font-size:7.5pt; text-align:center; cursor:pointer" onclick="startEditService(');F.a(N);F.a(',{position:\'top\'})"><img src="/r/images/icons/famfamfam/page_edit.png" /><br/><a href="#" onclick="return false">Edit</a></div>');F.a('<div style="float:left; max-width:400px"><a href="#" onclick="startEditService(');F.a(N);F.a(",{position:'top'}); return false\">");F.a(M);F.a("</a><br/>");F.a('<span style="font-size:7.5pt; font-style:italic">Since ');F.a(C);F.a("</span></a><br/>");F.a(H);F.a("</div>");F.a('<div style="clear:left; height:0px; margin:auto"></div>');var B=document.createElement("div");B.id="service"+N;B.style.textAlign="left";B.style.lineHeight="10.0pt";B.innerHTML=F.toString();de("servicepane").appendChild(B)}})}function addService(){var B=de("addtitle").value.trim();if(B.length==0){flashError("Please enter a title to add a service.");de("addbutton").disabled=false;return }de("addtitle").value="";var A="action=addservice&title="+encodeURIComponent(B);smartCallXML("/subscription",A,function(C){var D=C.getElementsByTagName("success");if(D.length>0){flashNotice("Your new service has been created.")}else{flashError("Failed to create your new service.")}refreshServices();de("addbutton").disabled=false})}var levelPermissions=[{text:"Map item permissions",value:null},{text:"Add new items",value:(1<<0)},{text:"Delete their items",value:(1<<1)},{text:"Change the icon/text display settings for their items",value:(1<<2)},{text:"Change the title of their items",value:(1<<3)},{text:"Change the location of their items",value:(1<<4)},{text:"Change the zoom levels for their items",value:(1<<5)},{text:"Item component permissions",value:null},{text:"Add components to their items",value:(1<<12)},{text:"Delete components from their items",value:(1<<13)},{text:"Change the content of their items' components",value:(1<<14)},{text:"Add, delete, or change the by-line/rating component(s) for their items (also requires Add, Delete, Change permission for components)",value:(1<<15)},{text:"Change the order of components in their items",value:(1<<16)},{text:"Moderator permissions",value:null},{text:"Moderate (modify, delete) all users' items",value:(1<<24)},{text:"Moderate (add, modify, delete) components in all users' items",value:(1<<25)}];var useSubid=-1;var viewKey=new Array();var viewStore=new Array();var levelKey=new Array();var levelStore=new Array();var planKey=new Array();var planStore=new Array();function startEditService(B,E){if(!E){E={}}if(!E.position){E.position="restore"}if(!E.map){E.map=0}if(!E.level){E.level=0}if(!E.plan){E.plan=0}var A=pageScroll();cancelEditService();useSubid=B;viewKey=new Array();viewStore=new Array();levelKey=new Array();levelStore=new Array();levelKey=new Array();levelStore=new Array();de("subloading").style.display="block";de("subbutton").disabled=false;var D=de("submanager");D.style.display="block";var C="action=loadservice&subid="+useSubid;smartCallXML("/subscription",C,function(d){var AP=nvn(d,"subid");var y=nvn(d,"title");var AH=nvn(d,"desc");var x=(nvn(d,"locked")=="true");de("subtitle").value=y;de("subdesc").value=AH;de("sublocked").checked=x;var AO;var AN;setInnerHtml("submgrmaps","");var I=d.getElementsByTagName("view");if(I.length==0){setInnerHtml("submgrmaps","There are no maps associated with this service.")}var W=de("submgraddlevelview");clearDOMChildren("submgraddlevelview");for(AO=0;AO<I.length;AO++){var AJ=I[AO];var AT=nvn(AJ,"subviewid");var q=nvn(AJ,"viewid");var M=nvn(AJ,"url");var AI=nvn(AJ,"title");var AL=nvn(AJ,"desc");var AR=document.createElement("div");var s=new StringBuffer();s.a('<a href="#" onclick="serviceMapToggle(');s.a(AT);s.a('); return false">');s.a(AI);s.a("</a> (V");s.a(q);s.a(") [M:");s.a(AT);s.a(']<div id="editmap');s.a(AT);s.a('" style="display:none; margin:3px 0px 15px 0px; padding:2px 8px 8px 8px; border-bottom:1px solid silver; background-color:white">');s.a('<span style="font-size:7.5pt; color:gray; font-style:italic">BROWSE:</span><br/>&nbsp;<a href="');s.a(M);s.a('" target="_blank">View this map</a><br/>');s.a('<span style="font-size:7.5pt; color:gray; font-style:italic">DESCRIPTION:</span><br/>');s.a('&nbsp;<textarea id="mapdesc');s.a(AT);s.a('" rows="4" cols="34">');s.a(scriptify(AL));s.a('</textarea><div style="margin-left:5px; font-size:7.5pt">Note: Describe the purpose of this map with respect to this service. This is not the same description that is found on the map editor/viewer.</div>&nbsp;<input type="button" value="Change description" cols="20" onclick="setMapDescription(');s.a(AP);s.a(",");s.a(AT);s.a(",");s.a(q);s.a(')" /><div style="font-size:7.5pt"><span style="color:gray; font-style:italic">REMOVE THIS MAP:</span><div style="margin:2px 0px 2px 6px"><a href="#" onclick="removeMap(');s.a(AP);s.a(",");s.a(AT);s.a(",");s.a(q);s.a('); return false" style="color:#990000">Disassociate now</a></div>In order to remove a map from a subscription service, first remove all levels that use it.</div>');s.a("</div>");AR.innerHTML=s.toString();de("submgrmaps").appendChild(AR);var l=AI+" [M:"+AT+"]";var AD=document.createElement("option");AD.value=q;AD.text=l;AD.innerHTML=l;W.appendChild(AD);viewKey[AO]=parseInt(AT);viewStore[viewKey[AO]]=AI}var b=d.getElementsByTagName("addview");var U=de("submgraddmap");clearDOMChildren("submgraddmap");for(AO=0;AO<b.length;AO++){var AM=b[AO];var q=nvn(AM,"viewid");var J=nvn(AM,"title");var l=J+" (V"+q+")";var AD=document.createElement("option");AD.value=q;AD.text=l;AD.innerHTML=l;U.appendChild(AD)}setInnerHtml("submgrlevels","");var v=d.getElementsByTagName("level");if(v.length==0){setInnerHtml("submgrlevels","There are no user levels defined for this service.")}for(AO=0;AO<v.length;AO++){var g=v[AO];var AF=nvn(g,"levelid");var AT=nvn(g,"subviewid");var q=nvn(g,"viewid");var O=nvn(g,"layerid");var n=g.getElementsByTagName("category");var T=null;if(n.length>0){T=nodeValue(n[0]).trim();if(T.length==0){T=null}}var Z=nvn(g,"title");var S=parseInt(nvn(g,"access"));var AQ=g.getElementsByTagName("overlay");var AR=document.createElement("div");var s=new StringBuffer();s.a('<a href="#" onclick="serviceLevelToggle(');s.a(AF);s.a('); return false">');s.a(Z);s.a("</a> [L:");s.a(AF);s.a(']<div id="editlevel');s.a(AF);s.a('" style="display:none; margin:3px 0px 10px 0px; padding:2px 8px 8px 8px; border-bottom:1px solid silver; background-color:white">');s.a('<span style="font-size:7.5pt; color:gray; font-style:italic">TITLE:</span><br/>');s.a('&nbsp;<input id="leveltitle');s.a(AF);s.a('" type="text" value="');s.a(entify(scriptify(Z)));s.a('" /> <input type="button" value="Change title" cols="20" onclick="setLevelTitle(');s.a(AP);s.a(",");s.a(AF);s.a(')" /><br/><span style="font-size:7.5pt; color:gray; font-style:italic">MAP:</span><br/>&nbsp;');if(viewStore[parseInt(AT)]){s.a('<span style="font-size:8.0pt"><b>');s.a(scriptify(viewStore[parseInt(AT)]));s.a("</b> [M:");s.a(AT);s.a("]</span>")}else{s.a('<span style="font-style:italic; font-size:7.5pt">(WARNING: No map is associated with this level)</span>')}s.a('<br/><span style="font-size:7.5pt; color:gray; font-style:italic">OVERLAY:</span>');s.a('<div style="margin-left:5px; font-size:7.5pt">Changes in this section are not saved until you click the <b>Update settings</b> button below.</div>');s.a('<input id="levelover');s.a(AF);s.a('no" type="radio" name="levelover');s.a(AF);s.a('"');if(parseInt(O)==-1){s.a(' checked="checked"')}s.a(' /> No overlay<br/><input id="levelover');s.a(AF);s.a('un" type="radio" name="levelover');s.a(AF);s.a('"');if(parseInt(O)==0){s.a(' checked="checked"')}s.a(' /> Unique overlay<div style="margin-left:26px">Category: <input id="levelovercat');s.a(AF);s.a('" type="text" style="font-size:8.0pt" value="');if(T!=null){s.a(entify(scriptify(T)))}s.a('" size="15" /> (optional)</div><input id="levelover');s.a(AF);s.a('on" type="radio" name="levelover');s.a(AF);s.a('"');if(parseInt(O)>0){s.a(' checked="checked"')}s.a(" /> One overlay: ");s.a('<select id="submgrselectoverlay').a(AF).a('" style="width:170px">');var AK;for(AK=0;AK<AQ.length;AK++){var k=AQ[AK];var L=nvn(k,"layerid");var AB=nvn(k,"overlaytitle");var N=AB+" (Y"+L+")";s.a('<option value="');s.a(L);s.a('" text="');s.a(N);s.a('"');if(O==L){s.a(" selected=true ")}s.a(">");s.a(N);s.a("</option>")}s.a("</select>");s.a('<div style="height:2px"></div>&nbsp;<input type="button" value="Update settings" onclick="setLevelView(');s.a(AP);s.a(",");s.a(AF);s.a(",");s.a(q);s.a(')" /><input id="levelpurge');s.a(AF);s.a('" type="checkbox" style="margin-left:5px" /> Purge old layers<br/><span style="font-size:7.5pt; color:gray; font-style:italic">ACCESS TO MAP/OVERLAY:</span><br/>');s.a('<table border="0">');for(AN=0;AN<levelPermissions.length;AN++){var u=levelPermissions[AN];if(u.value==null){s.a('<tr><td colspan="2" style="font-weight:bold">').a(u.text).a("</td></tr>")}else{s.a('<tr><td><input type="checkbox" id="levelaccess').a(AF).a("_").a(u.value).a('" value"').a(u.value).a('"').a(S&u.value?' checked="checked"':"").a(" /></td>");s.a("<td>").a(u.text).a("</td></tr>")}}s.a("</table>");s.a('<input type="button" onclick="setLevelAccess(');s.a(AP);s.a(",");s.a(AF);s.a(')" value="Update permissions" /><div id="levelaccessprogress');s.a(AF);s.a('" style="display:none"><img src="/r/images/progressbar.gif" /></div><div style="font-size:7.5pt"><span style="color:gray; font-style:italic">REMOVE THIS LEVEL:</span><div style="margin:2px 0px 2px 6px"><a href="#" onclick="removeLevel(');s.a(AP);s.a(",");s.a(AF);s.a('); return false" style="color:#990000">Delete now</a></div>In order to delete a level, first remove it from every access plan that uses it.</div>');s.a("</div>");AR.innerHTML=s.toString();de("submgrlevels").appendChild(AR);levelKey[AO]=parseInt(AF);levelStore[levelKey[AO]]=Z}var R=document.createElement("div");R.style.height="5px";de("submgrlevels").appendChild(R);setInnerHtml("submgrplans","");clearDOMChildren("submgrinviteplan");var H=d.getElementsByTagName("plan");if(H.length==0){setInnerHtml("submgrplans","There are no subscription plans for this service.")}for(AO=0;AO<H.length;AO++){var AE=H[AO];var G=nvn(AE,"planid");var AG=nvn(AE,"title");var m=(nvn(AE,"open")=="true");var p=AE.getElementsByTagName("access");var AR=document.createElement("div");var s=new StringBuffer();s.a('<a href="#" onclick="servicePlanToggle(');s.a(G);s.a('); return false">');s.a(AG);s.a("</a> [P:");s.a(G);s.a(']<div id="editplan');s.a(G);s.a('" style="display:none; margin:3px 0px 10px 0px; padding:2px 8px 8px 8px; border-bottom:1px solid silver; background-color:white">');s.a('<span style="font-size:7.5pt; color:gray; font-style:italic">TITLE:</span><br/>');s.a('&nbsp;<input id="plantitle');s.a(G);s.a('" type="text" value="');s.a(entify(scriptify(AG)));s.a('" /> <input type="button" value="Change title" cols="20" onclick="setPlanTitle(');s.a(AP);s.a(",");s.a(G);s.a(')" /><br/>');s.a('<span style="font-size:7.5pt; color:gray; font-style:italic">ACCESS:</span><br/>');s.a('<input id="planopen');s.a(G);s.a('on" type="radio" name="planaccess');s.a(G);s.a('"');if(m){s.a(' checked="checked"')}s.a(' onclick="setPlanOpen(');s.a(AP);s.a(",");s.a(G);s.a(', true); return false" /> Open to all<br/><input id="planopen');s.a(G);s.a('off" type="radio" name="planaccess');s.a(G);s.a('"');if(!m){s.a(' checked="checked"')}s.a(' onclick="setPlanOpen(');s.a(AP);s.a(",");s.a(G);s.a(', false); return false" /> Invitation only');s.a('</span><br/><div id="planopenprogress');s.a(G);s.a('" style="display:none"><img src="/r/images/progressbar.gif" /></div>');s.a('<span style="font-size:7.5pt; color:gray; font-style:italic">');if(p.length==0){s.a("NO LEVELS GRANTED")}else{s.a("LEVELS GRANTED:")}s.a("</span><br/>");s.a('&nbsp;<select id="planlevelselect');s.a(G);s.a('" style="width:200px">');var f=new Array();for(AN=0;AN<p.length;AN++){var Y=p[AN];var AF=nvn(Y,"levelid");var Z=levelStore[parseInt(AF)];f[AN]=parseInt(AF);s.a('<option value="');s.a(AF);s.a('">');s.a(scriptify(Z));s.a(" [L:");s.a(AF);s.a("]</option>")}s.a('</select> <input type="button" value="Remove" onclick="removePlanLevel(');s.a(AP);s.a(",");s.a(G);s.a(')" /><br/><span style="font-size:7.5pt; color:gray; font-style:italic">ADD LEVEL:</span><br/>');s.a('&nbsp;<select id="planaddlevel');s.a(G);s.a('" style="width:200px">');for(AN=0;AN<levelKey.length;AN++){if(f.contains(levelKey[AN])){continue}s.a('<option value="');s.a(levelKey[AN]);s.a('">');s.a(scriptify(levelStore[levelKey[AN]]));s.a(" [L:");s.a(levelKey[AN]);s.a("]</option>")}s.a("</select> ");s.a('<input type="button" value="Add to plan" onClick="addPlanLevel(');s.a(AP);s.a(",");s.a(G);s.a(')" /><div style="font-size:7.5pt"><span style="color:gray; font-style:italic">REMOVE THIS PLAN:</span><div style="margin:2px 0px 2px 6px"><a href="#" onclick="removePlan(');s.a(AP);s.a(",");s.a(G);s.a('); return false" style="color:#990000">Delete now</a></div>In order to delete a plan, you must first set its accessibility to invitation only.</div>');s.a("</div>");AR.innerHTML=s.toString();de("submgrplans").appendChild(AR);var AD=document.createElement("option");AD.value=G;AD.text=AG+" [P:"+G+"]";AD.innerHTML=AG+" [P:"+G+"]";de("submgrinviteplan").appendChild(AD);planKey[AO]=parseInt(G);planStore[planKey[AO]]=AG}R=document.createElement("div");R.style.height="5px";de("submgrplans").appendChild(R);setInnerHtml("submgrmembers","");var t=false;var e;var AR;AR=document.createElement("div");AR.innerHTML='<span style="color:gray; font-size:7.5pt">NEW MEMBERS:</span>';de("submgrmembers").appendChild(AR);var Q=d.getElementsByTagName("new");if(Q.length==0){AR=document.createElement("div");AR.style.marginLeft="10px";AR.style.fontSize="7.5pt";AR.innerHTML="There are no new members within the past 3 days for this service.";de("submgrmembers").appendChild(AR)}e=document.createElement("ul");e.style.fontSize="7.5pt";e.style.margin="0px 0px 5px 0px";e.style.paddingLeft="20px";for(AO=0;AO<Q.length;AO++){var K=Q[AO];var AU=nvn(K,"clientid");var r=nvn(K,"user");var G=nvn(K,"planid");var AC=nvn(K,"joined");var F=document.createElement("li");var s=new StringBuffer();s.a("<b>");s.a(r);s.a("</b> joined <b>");s.a(scriptify(planStore[parseInt(G)]));s.a("</b> on ");s.a(AC);F.innerHTML=s.toString();e.appendChild(F)}de("submgrmembers").appendChild(e);AR=document.createElement("div");AR.innerHTML='<span style="color:gray; font-size:7.5pt">INVITATIONS:</span>';de("submgrmembers").appendChild(AR);var X=d.getElementsByTagName("inv");if(X.length==0){AR=document.createElement("div");AR.style.marginLeft="10px";AR.style.fontSize="7.5pt";AR.innerHTML="There are no outstanding invitations for this service.";de("submgrmembers").appendChild(AR)}else{t=true;e=document.createElement("ul");e.id="invitationlist";e.style.fontSize="7.5pt";e.style.margin="0px 0px 5px 0px";e.style.padding="0px";e.style.listStyleType="none";for(AO=0;AO<X.length;AO++){var z=X[AO];var P=nvn(z,"memberid");var AU=nvn(z,"clientid");var r=nvn(z,"user");var G=nvn(z,"planid");var AC=nvn(z,"joined");var F=document.createElement("li");var s=new StringBuffer();s.a('<input id="MEM'+P+'" type="checkbox"/ style="vertical-align:-3px;">');s.a("<b>");s.a(r);s.a("</b> was invited to <b>");s.a(scriptify(planStore[parseInt(G)]));s.a("</b> on ");s.a(AC);F.innerHTML=s.toString();e.appendChild(F)}de("submgrmembers").appendChild(e);AR=document.createElement("div");var V=new StringBuffer();V.a('<input type="button" value="Revoke selected" onclick="revokeSelectedInvitations(');V.a(AP);V.a(');" /> &nbsp;');V.a('<input type="button" value="Revoke all" onclick="revokeAllInvitations(');V.a(AP);V.a(');" />');AR.innerHTML=V.toString();de("submgrmembers").appendChild(AR)}AR=document.createElement("div");AR.innerHTML='<span style="color:gray; font-size:7.5pt">CURRENT MEMBERS:</span>';de("submgrmembers").appendChild(AR);var w=d.getElementsByTagName("current");if(w.length==0){AR=document.createElement("div");AR.style.marginLeft="10px";AR.style.fontSize="7.5pt";AR.innerHTML="There are no current members for this service.";de("submgrmembers").appendChild(AR)}else{t=true;e=document.createElement("ul");e.id="currentlist";e.style.fontSize="7.5pt";e.style.margin="0px 0px 5px 0px";e.style.padding="0px";e.style.listStyleType="none";for(AO=0;AO<w.length;AO++){var c=w[AO];var P=nvn(c,"memberid");var AU=nvn(c,"clientid");var r=nvn(c,"user");var G=nvn(c,"planid");var AC=nvn(c,"joined");var F=document.createElement("li");var s=new StringBuffer();s.a('<input id="MEM'+P+'" type="checkbox"/ style="vertical-align:-3px;">');s.a("<b>");s.a(r);s.a("</b> joined <b>");s.a(scriptify(planStore[parseInt(G)]));s.a("</b> on ");s.a(AC);F.innerHTML=s.toString();e.appendChild(F)}de("submgrmembers").appendChild(e);AR=document.createElement("div");var h=new StringBuffer();h.a('<input type="button" value="Remove selected" onclick="removeSelectedMembers(');h.a(AP);h.a(');" /> &nbsp;');h.a('<input type="button" value="Remove all" onclick="removeAllCurrentMembers(');h.a(AP);h.a(');" /> &nbsp;');h.a('<input type="button" value="Suspend selected" onclick="updateMembersStatus(');h.a(AP);h.a(",");h.a(MEMBER_SUSPENDED);h.a(');" />');AR.innerHTML=h.toString();de("submgrmembers").appendChild(AR)}AR=document.createElement("div");AR.innerHTML='<span style="color:gray; font-size:7.5pt">SUSPENDED MEMBERS:</span>';de("submgrmembers").appendChild(AR);var w=d.getElementsByTagName("suspended");if(w.length==0){AR=document.createElement("div");AR.style.marginLeft="10px";AR.style.fontSize="7.5pt";AR.innerHTML="There are no suspended members for this service.";de("submgrmembers").appendChild(AR)}else{t=true;e=document.createElement("ul");e.id="suspendedlist";e.style.fontSize="7.5pt";e.style.margin="0px 0px 5px 0px";e.style.padding="0px";e.style.listStyleType="none";for(AO=0;AO<w.length;AO++){var c=w[AO];var P=nvn(c,"memberid");var AU=nvn(c,"clientid");var r=nvn(c,"user");var G=nvn(c,"planid");var AC=nvn(c,"joined");var F=document.createElement("li");var s=new StringBuffer();s.a('<input id="MEM'+P+'" type="checkbox"/ style="vertical-align:-3px;">');s.a("<b>");s.a(r);s.a("</b> joined <b>");s.a(scriptify(planStore[parseInt(G)]));s.a("</b> on ");s.a(AC);F.innerHTML=s.toString();e.appendChild(F)}de("submgrmembers").appendChild(e);AR=document.createElement("div");var AA=new StringBuffer();AA.a('<input type="button" value="Unsuspend selected" onclick="updateMembersStatus(');AA.a(AP);AA.a(",");AA.a(MEMBER_ACTIVE);AA.a(');" />');AR.innerHTML=AA.toString();de("submgrmembers").appendChild(AR)}if(t){AR=document.createElement("div");AR.style.marginTop="10px";AR.style.textAlign="center";var AS=new StringBuffer();AS.a('<input type="button" value="REMOVE ALL MEMBERS" onclick="removeAllMembers(');AS.a(AP);AS.a(');" />');AR.innerHTML=AS.toString();de("submgrmembers").appendChild(AR)}de("subloading").style.display="none";if(E.map&&E.map>0){serviceMapToggle(E.map)}if(E.level&&E.level>0){serviceLevelToggle(E.level)}if(E.plan&&E.plan>0){servicePlanToggle(E.plan)}if(E.position){if(E.position=="top"){scrollTo(D,-100)}else{if(E.position=="restore"){window.scroll(A.left,A.top)}}}})}function cancelEditService(){useSubid=-1;de("submanager").style.display="none";de("subtitle").value="";de("subdesc").value="";de("sublocked").checked=false}function saveEditService(){var A=useSubid;var D=de("subtitle").value.trim();if(D.length==0){alert("Your service must have a title.");return }var C=de("subdesc").value.trim();var B="action=updateservice";B+="&subid="+A;B+="&title="+encodeURIComponent(D);B+="&desc="+encodeURIComponent(C);B+="&locked="+de("sublocked").checked;smartCallXML("/subscription",B,function(E){var F=E.getElementsByTagName("success");if(F.length>0){flashNotice(nvn(E,"success"))}else{flashError(nvn(E,"error"))}startEditService(A);refreshServices()})}function removeService(){if(!confirm("Are you sure you want to remove your subscription service?")){return }var A=useSubid;var B="action=removeservice";B+="&subid="+A;smartCallXML("/subscription",B,function(C){de("subdelete").disabled=false;var D=C.getElementsByTagName("success");if(D.length>0){cancelEditService();refreshServices();flashNotice("Subscription service removed successfully.")}else{flashError("An error occurred while completing your request. Please verify that this service is locked and does not have any members associated with it.");alert("An error occurred while completing your request. Please verify that this service is locked and does not have any members associated with it.")}})}function serviceMapToggle(B){var A=de("editmap"+B);if(!A){return }if(A.style.display!="block"){A.style.display="block"}else{A.style.display="none"}}function serviceLevelToggle(B){var A=de("editlevel"+B);if(!A){return }if(A.style.display!="block"){A.style.display="block"}else{A.style.display="none"}}function servicePlanToggle(B){var A=de("editplan"+B);if(!A){return }if(A.style.display!="block"){A.style.display="block"}else{A.style.display="none"}}function addMap(){var A=useSubid;var D=de("submgraddmap");var C=D.selectedIndex;if(C<0){alert("You must select a map to associate with your service.");return }var E=D.options[C].value;var B="action=addview";B+="&subid="+A;B+="&viewid="+E;smartCallXML("/subscription",B,function(F){var G=F.getElementsByTagName("success");if(G.length>0){var H=parseInt(nodeValue(G[0]));startEditService(A,{map:H})}else{alert("An error occurred while completing your request. Please try refreshing the page.")}})}function removeMap(A,D,C){if(!confirm("Are you sure you want to disassociate this map from your service?")){return }var B="action=removeview";B+="&subid="+A;B+="&viewid="+C;smartCallXML("/subscription",B,function(E){var F=(E.getElementsByTagName("success").length>0);if(F){startEditService(A)}else{alert("The map could not be removed. Ensure that no levels use this map. If the error persists, please try refreshing the page.");startEditService(A,{map:D})}})}function addLevel(){var A=useSubid;var F=de("submgraddlevel").value.trim();if(F.length==0){alert("Please enter a title for the new level.");return }var B=de("submgraddlevelview");var D=B.selectedIndex;if(D<0){alert("You must select a map to associate with your new level.");return }var E=B.options[D].value;de("submgraddlevel").value="";var C="action=addlevel";C+="&subid="+A;C+="&viewid="+E;C+="&title="+encodeURIComponent(F);smartCallXML("/subscription",C,function(H){var I=H.getElementsByTagName("success");if(I.length>0){var G=parseInt(nodeValue(I[0]));startEditService(A,{level:G})}else{alert("An error occurred while completing your request. Please try refreshing the page.")}})}function removeLevel(A,C){if(!confirm("Are you sure you want to remove this level?")){return }var B="action=removelevel";B+="&subid="+A;B+="&levelid="+C;smartCallXML("/subscription",B,function(D){var E=(D.getElementsByTagName("success").length>0);if(E){startEditService(A)}else{alert("The level could not be removed. Ensure that no plans make use of this level. If the error persists, please try refreshing the page.");startEditService(A,{level:C})}})}function addPlan(){var A=useSubid;var C=de("submgraddplan").value.trim();if(C.length==0){alert("Please enter a title for the new plan.");return }de("submgraddplan").value="";var B="action=addplan";B+="&subid="+A;B+="&title="+encodeURIComponent(C);smartCallXML("/subscription",B,function(D){var F=D.getElementsByTagName("success");if(F.length>0){var E=parseInt(nodeValue(F[0]));startEditService(A,{plan:E})}else{alert("An error occurred while completing your request. Please try refreshing the page.")}})}function removePlan(A,C){if(!confirm("Are you sure you want to remove this plan?")){return }var B="action=removeplan";B+="&subid="+A;B+="&planid="+C;smartCallXML("/subscription",B,function(D){var E=(D.getElementsByTagName("success").length>0);if(E){startEditService(A)}else{alert("The plan could not be removed. Ensure that the plan is set to invitation only before removing. If the error persists, please try refreshing the page.");startEditService(A,{plan:C})}})}function addPlanLevel(A,F){var E=de("planaddlevel"+F);var D=E.selectedIndex;if(D<0){return }var C=E.options[D].value;var B="action=addplanlevel";B+="&subid="+A;B+="&planid="+F;B+="&levelid="+C;smartCallXML("/subscription",B,function(G){var H=(G.getElementsByTagName("success").length>0);if(H){startEditService(A,{plan:F})}else{alert("An error occurred while completing your request. Please try refreshing the page.")}})}function removePlanLevel(A,E){var D=de("planlevelselect"+E).selectedIndex;if(D<0){alert("You must select a level to remove from this plan.");return }var C=de("planlevelselect"+E).options[D].value;var B="action=removeplanlevel";B+="&subid="+A;B+="&planid="+E;B+="&levelid="+C;smartCallXML("/subscription",B,function(F){var G=(F.getElementsByTagName("success").length>0);if(G){startEditService(A,{plan:E})}else{alert("An error occurred while completing your request. Please try refreshing the page.")}})}function setServiceTitle(C){if(useSubid<0){return }var A=useSubid;C=C.trim();if(C.length==0){flashError("Your service must have a title.");alert("Your service must have a title.");return }var B="action=updateservice";B+="&subid="+A;B+="&title="+encodeURIComponent(C);smartCallXML("/subscription",B,function(D){var E=D.getElementsByTagName("success");if(E.length>0){flashNotice(nvn(D,"success"))}else{flashError(nvn(D,"error"))}refreshServices()})}function setMapDescription(A,E,D){var C=de("mapdesc"+E).value.trim();var B="action=updateview";B+="&subid="+A;B+="&viewid="+D;B+="&desc="+encodeURIComponent(C);smartCallXML("/subscription",B,function(F){var G=(F.getElementsByTagName("success").length>0);if(!G){alert("An error occurred while completing your request. Map description may not have been updated. Please try refreshing the page.")}startEditService(A,{map:E})})}function setLevelTitle(A,C){var D=de("leveltitle"+C).value.trim();if(D.length==0){alert("Your level must have a title.");return }var B="action=updatelevel";B+="&subid="+A;B+="&levelid="+C;B+="&title="+encodeURIComponent(D);smartCallXML("/subscription",B,function(E){var F=(E.getElementsByTagName("success").length>0);if(!F){alert("An error occurred while completing your request. Level title may not have been updated. Please try refreshing the page.")}startEditService(A,{level:C})})}function setLevelView(B,E,G){var H=-2;var F=null;if(de("levelover"+E+"no").checked){H=-1}else{if(de("levelover"+E+"un").checked){H=0;F=de("levelovercat"+E).value.trim()}else{if(de("levelover"+E+"on").checked){var A=de("submgrselectoverlay"+E);H=parseInt(A.options[A.selectedIndex].value);if(H<=0){alert("Invalid overlay ID.");return }}}}var C=de("levelpurge"+E).checked;var D="action=updatelevel";D+="&subid="+B;D+="&levelid="+E;D+="&viewid="+G;D+="&layerid="+H;if(F!=null){D+="&category="+encodeURIComponent(F)}D+="&purge="+C;smartCallXML("/subscription",D,function(I){var J=(I.getElementsByTagName("success").length>0);if(!J){alert("An error occurred while completing your request. Level information may not have been updated. Ensure that your category or overlay inputs are correct. If the problem persists, please try refreshing the page.")}startEditService(B,{level:E})})}function setLevelAccess(B,D){de("levelaccessprogress"+D).style.display="block";var A=0;for(var F=0;F<levelPermissions.length;F++){var E=levelPermissions[F];if(E.value!=null&&de("levelaccess"+D+"_"+E.value).checked){A|=E.value}}var C="action=updatelevel";C+="&subid="+B;C+="&levelid="+D;C+="&access="+A;smartCallXML("/subscription",C,function(G){var H=(G.getElementsByTagName("success").length>0);de("levelaccessprogress"+D).style.display="none";if(!H){alert("An error occurred while completing your request. Level access may not have been updated. Please try refreshing the page.");startEditService(B,{level:D})}})}function setPlanTitle(A,C){var D=de("plantitle"+C).value.trim();if(D.length==0){alert("Your plan must have a title.");return }var B="action=updateplan";B+="&subid="+A;B+="&planid="+C;B+="&title="+encodeURIComponent(D);smartCallXML("/subscription",B,function(E){var F=(E.getElementsByTagName("success").length>0);if(!F){alert("An error occurred while completing your request. Plan title may not have been updated. Please try refreshing the page.")}startEditService(A,{plan:C})})}function setPlanOpen(A,D,C){de("planopenprogress"+D).style.display="block";var B="action=updateplan";B+="&subid="+A;B+="&planid="+D;B+="&open="+C;smartCallXML("/subscription",B,function(E){var F=(E.getElementsByTagName("success").length>0);de("planopenprogress"+D).style.display="none";if(F){de("planopen"+D+"on").checked=C;de("planopen"+D+"off").checked=!C}else{alert("An error occurred while completing your request. Plan lock may not have been updated. Please try refreshing the page.");startEditService(A,{plan:D})}})}function removeSelectedMembers(B){var A=new Array();var F=0;var E=0;var G=de("currentlist").getElementsByTagName("input");for(F=0;F<G.length;F++){if(G[F].checked){A[E++]=G[F].id.substring(3)}}var D="action=removemembers";D+="&subid="+B;var C;for(C=0;C<A.length;C++){D+="&memids="+A[C]}smartCallXML("/subscription",D,function(H){var I=(H.getElementsByTagName("success").length>0);if(I){startEditService(B)}else{alert("Selected members could not be removed from your service successfully. If the error persists, please try refreshing the page.");startEditService(B,{map:subviewid})}})}function removeAllCurrentMembers(A){if(!confirm("Are you sure you want to remove all current members from your service?")){return }var B="action=removeallcurrentmembers";B+="&subid="+A;smartCallXML("/subscription",B,function(C){var D=(C.getElementsByTagName("success").length>0);if(D){startEditService(A)}else{alert("All members could not be removed from your service successfully. If the error persists, please try refreshing the page.");startEditService(A,{map:subviewid})}})}function revokeSelectedInvitations(B){var A=new Array();var F=0;var E=0;var G=de("invitationlist").getElementsByTagName("input");for(F=0;F<G.length;F++){if(G[F].checked){A[E++]=G[F].id.substring(3)}}var D="action=revokeinvitations";D+="&subid="+B;var C;for(C=0;C<A.length;C++){D+="&memids="+A[C]}smartCallXML("/subscription",D,function(H){var I=(H.getElementsByTagName("success").length>0);if(I){startEditService(B)}else{alert("Selected invitations could not be revoked from your service successfully. If the error persists, please try refreshing the page.");startEditService(B,{map:subviewid})}})}function revokeAllInvitations(A){if(!confirm("Are you sure you want to revoke all invitations from your service?")){return }var B="action=revokeallinvitations";B+="&subid="+A;smartCallXML("/subscription",B,function(C){var D=(C.getElementsByTagName("success").length>0);if(D){startEditService(A)}else{alert("All invitations could not be revoked from your service successfully. If the error persists, please try refreshing the page.");startEditService(A,{map:subviewid})}})}function updateMembersStatus(B,A){var D=new Array();var G=0;var F=0;var H=(A==MEMBER_ACTIVE)?de("suspendedlist").getElementsByTagName("input"):de("currentlist").getElementsByTagName("input");for(G=0;G<H.length;G++){if(H[G].checked){D[F++]=H[G].id.substring(3)}}var E="action=updatemembersstatus";E+="&subid="+B;E+="&status="+A;var C;for(C=0;C<D.length;C++){E+="&memids="+D[C]}smartCallXML("/subscription",E,function(I){var J=(I.getElementsByTagName("success").length>0);if(J){startEditService(B)}else{alert("Selected members status could not be updated for your service successfully. If the error persists, please try refreshing the page.");startEditService(B,{map:subviewid})}})}function removeAllMembers(A){if(!confirm("Are you sure you want to remove all members (invited, active, suspended) from your service?")){return }var B="action=removeallmembers";B+="&subid="+A;smartCallXML("/subscription",B,function(C){var D=(C.getElementsByTagName("success").length>0);if(D){startEditService(A)}else{alert("All members could not be removed from your service successfully. If the error persists, please try refreshing the page.");startEditService(A,{map:subviewid})}})}function inviteMember(){var A=useSubid;var B=de("submgrinviteuser").value.trim();if(B.length==0){alert("Please enter a user to invite to this plan.");return }var D=de("submgrinviteplan").selectedIndex;if(D<0){alert("You must select a plan to send this user an invitation.");return }var E=de("submgrinviteplan").options[D].value;de("submgrinviteuser").value="";var C="action=invitemember";C+="&subid="+A;C+="&planid="+E;C+="&user="+B;smartCallXML("/subscription",C,function(F){var H=(F.getElementsByTagName("success").length>0);var G=(F.getElementsByTagName("invalid").length>0);if(H){startEditService(A,{member:E})}else{if(G){alert("Invalid user.")}else{alert("An error occurred while completing your request. Please try refreshing the page.");startEditService(A)}}})}var commentload=new Array();commentload["pending"]=false;commentload["all"]=false;var Prototype={Version:"1.7",Browser:(function(){var B=navigator.userAgent;var A=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!A,Opera:A,WebKit:B.indexOf("AppleWebKit/")>-1,Gecko:B.indexOf("Gecko")>-1&&B.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile/.test(B)}})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var A=window.Element||window.HTMLElement;return !!(A&&A.prototype)})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true}var C=document.createElement("div"),B=document.createElement("form"),A=false;if(C["__proto__"]&&(C["__proto__"]!==B["__proto__"])){A=true}C=B=null;return A})()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(A){return A}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Abstract={};var Try={these:function(){var C;for(var B=0,D=arguments.length;B<D;B++){var A=arguments[B];try{C=A();break}catch(E){}}return C}};var Class=(function(){var D=(function(){for(var E in {toString:1}){if(E==="toString"){return false}}return true})();function A(){}function B(){var H=null,G=$A(arguments);if(Object.isFunction(G[0])){H=G.shift()}function E(){this.initialize.apply(this,arguments)}Object.extend(E,Class.Methods);E.superclass=H;E.subclasses=[];if(H){A.prototype=H.prototype;E.prototype=new A;H.subclasses.push(E)}for(var F=0,I=G.length;F<I;F++){E.addMethods(G[F])}if(!E.prototype.initialize){E.prototype.initialize=Prototype.emptyFunction}E.prototype.constructor=E;return E}function C(K){var G=this.superclass&&this.superclass.prototype,F=Object.keys(K);if(D){if(K.toString!=Object.prototype.toString){F.push("toString")}if(K.valueOf!=Object.prototype.valueOf){F.push("valueOf")}}for(var E=0,H=F.length;E<H;E++){var J=F[E],I=K[J];if(G&&Object.isFunction(I)&&I.argumentNames()[0]=="$super"){var L=I;I=(function(M){return function(){return G[M].apply(this,arguments)}})(J).wrap(L);I.valueOf=L.valueOf.bind(L);I.toString=L.toString.bind(L)}this.prototype[J]=I}return this}return{create:B,Methods:{addMethods:C}}})();(function(){var d=Object.prototype.toString,c="Null",O="Undefined",V="Boolean",F="Number",S="String",j="Object",T="[object Function]",Y="[object Boolean]",G="[object Number]",L="[object String]",H="[object Array]",X="[object Date]",I=window.JSON&&typeof JSON.stringify==="function"&&JSON.stringify(0)==="0"&&typeof JSON.stringify(Prototype.K)==="undefined";function K(l){switch(l){case null:return c;case (void 0):return O}var k=typeof l;switch(k){case"boolean":return V;case"number":return F;case"string":return S}return j}function Z(k,m){for(var l in m){k[l]=m[l]}return k}function h(k){try{if(C(k)){return"undefined"}if(k===null){return"null"}return k.inspect?k.inspect():String(k)}catch(l){if(l instanceof RangeError){return"..."}throw l}}function e(k){return g("",{"":k},[])}function g(t,q,r){var s=q[t],p=typeof s;if(K(s)===j&&typeof s.toJSON==="function"){s=s.toJSON(t)}var m=d.call(s);switch(m){case G:case Y:case L:s=s.valueOf()}switch(s){case null:return"null";case true:return"true";case false:return"false"}p=typeof s;switch(p){case"string":return s.inspect(true);case"number":return isFinite(s)?String(s):"null";case"object":for(var l=0,k=r.length;l<k;l++){if(r[l]===s){throw new TypeError()}}r.push(s);var o=[];if(m===H){for(var l=0,k=s.length;l<k;l++){var n=g(l,s,r);o.push(typeof n==="undefined"?"null":n)}o="["+o.join(",")+"]"}else{var u=Object.keys(s);for(var l=0,k=u.length;l<k;l++){var t=u[l],n=g(t,s,r);if(typeof n!=="undefined"){o.push(t.inspect(true)+":"+n)}}o="{"+o.join(",")+"}"}r.pop();return o}}function W(k){return JSON.stringify(k)}function J(k){return $H(k).toQueryString()}function P(k){return k&&k.toHTML?k.toHTML():String.interpret(k)}function R(k){if(K(k)!==j){throw new TypeError()}var l=[];for(var m in k){if(k.hasOwnProperty(m)){l.push(m)}}return l}function D(k){var l=[];for(var m in k){l.push(k[m])}return l}function b(k){return Z({},k)}function U(k){return !!(k&&k.nodeType==1)}function M(k){return d.call(k)===H}var B=(typeof Array.isArray=="function")&&Array.isArray([])&&!Array.isArray({});if(B){M=Array.isArray}function E(k){return k instanceof Hash}function A(k){return d.call(k)===T}function N(k){return d.call(k)===L}function Q(k){return d.call(k)===G}function f(k){return d.call(k)===X}function C(k){return typeof k==="undefined"}Z(Object,{extend:Z,inspect:h,toJSON:I?W:e,toQueryString:J,toHTML:P,keys:Object.keys||R,values:D,clone:b,isElement:U,isArray:M,isHash:E,isFunction:A,isString:N,isNumber:Q,isDate:f,isUndefined:C})})();Object.extend(Function.prototype,(function(){var K=Array.prototype.slice;function D(O,L){var N=O.length,M=L.length;while(M--){O[N+M]=L[M]}return O}function I(M,L){M=K.call(M,0);return D(M,L)}function G(){var L=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g,"").replace(/\s+/g,"").split(",");return L.length==1&&!L[0]?[]:L}function H(N){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this}var L=this,M=K.call(arguments,1);return function(){var O=I(M,arguments);return L.apply(N,O)}}function F(N){var L=this,M=K.call(arguments,1);return function(P){var O=D([P||window.event],M);return L.apply(N,O)}}function J(){if(!arguments.length){return this}var L=this,M=K.call(arguments,0);return function(){var N=I(M,arguments);return L.apply(this,N)}}function E(N){var L=this,M=K.call(arguments,1);N=N*1000;return window.setTimeout(function(){return L.apply(L,M)},N)}function A(){var L=D([0.01],arguments);return this.delay.apply(this,L)}function C(M){var L=this;return function(){var N=D([L.bind(this)],arguments);return M.apply(this,N)}}function B(){if(this._methodized){return this._methodized}var L=this;return this._methodized=function(){var M=D([this],arguments);return L.apply(null,M)}}return{argumentNames:G,bind:H,bindAsEventListener:F,curry:J,delay:E,defer:A,wrap:C,methodize:B}})());(function(C){function B(){return this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+"Z"}function A(){return this.toISOString()}if(!C.toISOString){C.toISOString=B}if(!C.toJSON){C.toJSON=A}})(Date.prototype);RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(A){return String(A).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};var PeriodicalExecuter=Class.create({initialize:function(B,A){this.callback=B;this.frequency=A;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},execute:function(){this.callback(this)},stop:function(){if(!this.timer){return }clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute();this.currentlyExecuting=false}catch(A){this.currentlyExecuting=false;throw A}}}});Object.extend(String,{interpret:function(A){return A==null?"":String(A)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,(function(){var NATIVE_JSON_PARSE_SUPPORT=window.JSON&&typeof JSON.parse==="function"&&JSON.parse('{"test": true}').test;function prepareReplacement(replacement){if(Object.isFunction(replacement)){return replacement}var template=new Template(replacement);return function(match){return template.evaluate(match)}}function gsub(pattern,replacement){var result="",source=this,match;replacement=prepareReplacement(replacement);if(Object.isString(pattern)){pattern=RegExp.escape(pattern)}if(!(pattern.length||pattern.source)){replacement=replacement("");return replacement+source.split("").join(replacement)+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}function sub(pattern,replacement,count){replacement=prepareReplacement(replacement);count=Object.isUndefined(count)?1:count;return this.gsub(pattern,function(match){if(--count<0){return match[0]}return replacement(match)})}function scan(pattern,iterator){this.gsub(pattern,iterator);return String(this)}function truncate(length,truncation){length=length||30;truncation=Object.isUndefined(truncation)?"...":truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this)}function strip(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}function stripTags(){return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,"")}function stripScripts(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")}function extractScripts(){var matchAll=new RegExp(Prototype.ScriptFragment,"img"),matchOne=new RegExp(Prototype.ScriptFragment,"im");return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||["",""])[1]})}function evalScripts(){return this.extractScripts().map(function(script){return eval(script)})}function escapeHTML(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function unescapeHTML(){return this.stripTags().replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}function toQueryParams(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()),value=pair.length>1?pair.join("="):pair[0];if(value!=undefined){value=decodeURIComponent(value)}if(key in hash){if(!Object.isArray(hash[key])){hash[key]=[hash[key]]}hash[key].push(value)}else{hash[key]=value}}return hash})}function toArray(){return this.split("")}function succ(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)}function times(count){return count<1?"":new Array(count+1).join(this)}function camelize(){return this.replace(/-+(.)?/g,function(match,chr){return chr?chr.toUpperCase():""})}function capitalize(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()}function underscore(){return this.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/-/g,"_").toLowerCase()}function dasherize(){return this.replace(/_/g,"-")}function inspect(useDoubleQuotes){var escapedString=this.replace(/[\x00-\x1f\\]/g,function(character){if(character in String.specialChar){return String.specialChar[character]}return"\\u00"+character.charCodeAt().toPaddedString(2,16)});if(useDoubleQuotes){return'"'+escapedString.replace(/"/g,'\\"')+'"'}return"'"+escapedString.replace(/'/g,"\\'")+"'"}function unfilterJSON(filter){return this.replace(filter||Prototype.JSONFilter,"$1")}function isJSON(){var str=this;if(str.blank()){return false}str=str.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@");str=str.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]");str=str.replace(/(?:^|:|,)(?:\s*\[)+/g,"");return(/^[\],:{}\s]*$/).test(str)}function evalJSON(sanitize){var json=this.unfilterJSON(),cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;if(cx.test(json)){json=json.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())}function parseJSON(){var json=this.unfilterJSON();return JSON.parse(json)}function include(pattern){return this.indexOf(pattern)>-1}function startsWith(pattern){return this.lastIndexOf(pattern,0)===0}function endsWith(pattern){var d=this.length-pattern.length;return d>=0&&this.indexOf(pattern,d)===d}function empty(){return this==""}function blank(){return/^\s*$/.test(this)}function interpolate(object,pattern){return new Template(this,pattern).evaluate(object)}return{gsub:gsub,sub:sub,scan:scan,truncate:truncate,strip:String.prototype.trim||strip,stripTags:stripTags,stripScripts:stripScripts,extractScripts:extractScripts,evalScripts:evalScripts,escapeHTML:escapeHTML,unescapeHTML:unescapeHTML,toQueryParams:toQueryParams,parseQuery:toQueryParams,toArray:toArray,succ:succ,times:times,camelize:camelize,capitalize:capitalize,underscore:underscore,dasherize:dasherize,inspect:inspect,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON:NATIVE_JSON_PARSE_SUPPORT?parseJSON:evalJSON,include:include,startsWith:startsWith,endsWith:endsWith,empty:empty,blank:blank,interpolate:interpolate}})());var Template=Class.create({initialize:function(A,B){this.template=A.toString();this.pattern=B||Template.Pattern},evaluate:function(A){if(A&&Object.isFunction(A.toTemplateReplacements)){A=A.toTemplateReplacements()}return this.template.gsub(this.pattern,function(D){if(A==null){return(D[1]+"")}var F=D[1]||"";if(F=="\\"){return D[2]}var B=A,G=D[3],E=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;D=E.exec(G);if(D==null){return F}while(D!=null){var C=D[1].startsWith("[")?D[2].replace(/\\\\]/g,"]"):D[1];B=B[C];if(null==B||""==D[3]){break}G=G.substring("["==D[3]?D[1].length:D[0].length);D=E.exec(G)}return F+String.interpret(B)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable=(function(){function C(Y,X){var W=0;try{this._each(function(b){Y.call(X,b,W++)})}catch(Z){if(Z!=$break){throw Z}}return this}function R(Z,Y,X){var W=-Z,b=[],c=this.toArray();if(Z<1){return c}while((W+=Z)<c.length){b.push(c.slice(W,W+Z))}return b.collect(Y,X)}function B(Y,X){Y=Y||Prototype.K;var W=true;this.each(function(b,Z){W=W&&!!Y.call(X,b,Z);if(!W){throw $break}});return W}function I(Y,X){Y=Y||Prototype.K;var W=false;this.each(function(b,Z){if(W=!!Y.call(X,b,Z)){throw $break}});return W}function J(Y,X){Y=Y||Prototype.K;var W=[];this.each(function(b,Z){W.push(Y.call(X,b,Z))});return W}function T(Y,X){var W;this.each(function(b,Z){if(Y.call(X,b,Z)){W=b;throw $break}});return W}function H(Y,X){var W=[];this.each(function(b,Z){if(Y.call(X,b,Z)){W.push(b)}});return W}function G(Z,Y,X){Y=Y||Prototype.K;var W=[];if(Object.isString(Z)){Z=new RegExp(RegExp.escape(Z))}this.each(function(c,b){if(Z.match(c)){W.push(Y.call(X,c,b))}});return W}function A(W){if(Object.isFunction(this.indexOf)){if(this.indexOf(W)!=-1){return true}}var X=false;this.each(function(Y){if(Y==W){X=true;throw $break}});return X}function Q(X,W){W=Object.isUndefined(W)?null:W;return this.eachSlice(X,function(Y){while(Y.length<X){Y.push(W)}return Y})}function L(W,Y,X){this.each(function(b,Z){W=Y.call(X,W,b,Z)});return W}function V(X){var W=$A(arguments).slice(1);return this.map(function(Y){return Y[X].apply(Y,W)})}function P(Y,X){Y=Y||Prototype.K;var W;this.each(function(b,Z){b=Y.call(X,b,Z);if(W==null||b>=W){W=b}});return W}function N(Y,X){Y=Y||Prototype.K;var W;this.each(function(b,Z){b=Y.call(X,b,Z);if(W==null||b<W){W=b}});return W}function E(Z,X){Z=Z||Prototype.K;var Y=[],W=[];this.each(function(c,b){(Z.call(X,c,b)?Y:W).push(c)});return[Y,W]}function F(X){var W=[];this.each(function(Y){W.push(Y[X])});return W}function D(Y,X){var W=[];this.each(function(b,Z){if(!Y.call(X,b,Z)){W.push(b)}});return W}function M(X,W){return this.map(function(Z,Y){return{value:Z,criteria:X.call(W,Z,Y)}}).sort(function(d,c){var Z=d.criteria,Y=c.criteria;return Z<Y?-1:Z>Y?1:0}).pluck("value")}function O(){return this.map()}function S(){var X=Prototype.K,W=$A(arguments);if(Object.isFunction(W.last())){X=W.pop()}var Y=[this].concat(W).map($A);return this.map(function(b,Z){return X(Y.pluck(Z))})}function K(){return this.toArray().length}function U(){return"#<Enumerable:"+this.toArray().inspect()+">"}return{each:C,eachSlice:R,all:B,every:B,any:I,some:I,collect:J,map:J,detect:T,findAll:H,select:H,filter:H,grep:G,include:A,member:A,inGroupsOf:Q,inject:L,invoke:V,max:P,min:N,partition:E,pluck:F,reject:D,sortBy:M,toArray:O,entries:O,zip:S,size:K,inspect:U,find:T}})();function $A(C){if(!C){return[]}if("toArray" in Object(C)){return C.toArray()}var B=C.length||0,A=new Array(B);while(B--){A[B]=C[B]}return A}function $w(A){if(!Object.isString(A)){return[]}A=A.strip();return A?A.split(/\s+/):[]}Array.from=$A;(function(){var R=Array.prototype,M=R.slice,O=R.forEach;function B(W,V){for(var U=0,X=this.length>>>0;U<X;U++){if(U in this){W.call(V,this[U],U,this)}}}if(!O){O=B}function L(){this.length=0;return this}function D(){return this[0]}function G(){return this[this.length-1]}function I(){return this.select(function(U){return U!=null})}function T(){return this.inject([],function(V,U){if(Object.isArray(U)){return V.concat(U.flatten())}V.push(U);return V})}function H(){var U=M.call(arguments,0);return this.select(function(V){return !U.include(V)})}function F(U){return(U===false?this.toArray():this)._reverse()}function K(U){return this.inject([],function(X,W,V){if(0==V||(U?X.last()!=W:!X.include(W))){X.push(W)}return X})}function P(U){return this.uniq().findAll(function(V){return U.detect(function(W){return V===W})})}function Q(){return M.call(this,0)}function J(){return this.length}function S(){return"["+this.map(Object.inspect).join(", ")+"]"}function A(W,U){U||(U=0);var V=this.length;if(U<0){U=V+U}for(;U<V;U++){if(this[U]===W){return U}}return -1}function N(V,U){U=isNaN(U)?this.length:(U<0?this.length+U:U)+1;var W=this.slice(0,U).reverse().indexOf(V);return(W<0)?W:U-W-1}function C(){var Z=M.call(this,0),X;for(var V=0,W=arguments.length;V<W;V++){X=arguments[V];if(Object.isArray(X)&&!("callee" in X)){for(var U=0,Y=X.length;U<Y;U++){Z.push(X[U])}}else{Z.push(X)}}return Z}Object.extend(R,Enumerable);if(!R._reverse){R._reverse=R.reverse}Object.extend(R,{_each:O,clear:L,first:D,last:G,compact:I,flatten:T,without:H,reverse:F,uniq:K,intersect:P,clone:Q,toArray:Q,size:J,inspect:S});var E=(function(){return[].concat(arguments)[0][0]!==1})(1,2);if(E){R.concat=C}if(!R.indexOf){R.indexOf=A}if(!R.lastIndexOf){R.lastIndexOf=N}})();function $H(A){return new Hash(A)}var Hash=Class.create(Enumerable,(function(){function E(P){this._object=Object.isHash(P)?P.toObject():Object.clone(P)}function F(Q){for(var P in this._object){var R=this._object[P],S=[P,R];S.key=P;S.value=R;Q(S)}}function J(P,Q){return this._object[P]=Q}function C(P){if(this._object[P]!==Object.prototype[P]){return this._object[P]}}function M(P){var Q=this._object[P];delete this._object[P];return Q}function O(){return Object.clone(this._object)}function N(){return this.pluck("key")}function L(){return this.pluck("value")}function G(Q){var P=this.detect(function(R){return R.value===Q});return P&&P.key}function I(P){return this.clone().update(P)}function D(P){return new Hash(P).inject(this,function(Q,R){Q.set(R.key,R.value);return Q})}function B(P,Q){if(Object.isUndefined(Q)){return P}return P+"="+encodeURIComponent(String.interpret(Q))}function A(){return this.inject([],function(T,W){var S=encodeURIComponent(W.key),Q=W.value;if(Q&&typeof Q=="object"){if(Object.isArray(Q)){var V=[];for(var R=0,P=Q.length,U;R<P;R++){U=Q[R];V.push(B(S,U))}return T.concat(V)}}else{T.push(B(S,Q))}return T}).join("&")}function K(){return"#<Hash:{"+this.map(function(P){return P.map(Object.inspect).join(": ")}).join(", ")+"}>"}function H(){return new Hash(this)}return{initialize:E,_each:F,set:J,get:C,unset:M,toObject:O,toTemplateReplacements:O,keys:N,values:L,index:G,merge:I,update:D,toQueryString:A,inspect:K,toJSON:O,clone:H}})());Hash.from=$H;Object.extend(Number.prototype,(function(){function D(){return this.toPaddedString(2,16)}function B(){return this+1}function H(J,I){$R(0,this,true).each(J,I);return this}function G(K,J){var I=this.toString(J||10);return"0".times(K-I.length)+I}function A(){return Math.abs(this)}function C(){return Math.round(this)}function E(){return Math.ceil(this)}function F(){return Math.floor(this)}return{toColorPart:D,succ:B,times:H,toPaddedString:G,abs:A,round:C,ceil:E,floor:F}})());function $R(C,A,B){return new ObjectRange(C,A,B)}var ObjectRange=Class.create(Enumerable,(function(){function B(F,D,E){this.start=F;this.end=D;this.exclusive=E}function C(D){var E=this.start;while(this.include(E)){D(E);E=E.succ()}}function A(D){if(D<this.start){return false}if(this.exclusive){return D<this.end}return D<=this.end}return{initialize:B,_each:C,include:A}})());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(A){this.responders._each(A)},register:function(A){if(!this.include(A)){this.responders.push(A)}},unregister:function(A){this.responders=this.responders.without(A)},dispatch:function(D,B,C,A){this.each(function(E){if(Object.isFunction(E[D])){try{E[D].apply(E,[B,C,A])}catch(F){}}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(A){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:true,evalJS:true};Object.extend(this.options,A||{});this.options.method=this.options.method.toLowerCase();if(Object.isHash(this.options.parameters)){this.options.parameters=this.options.parameters.toObject()}}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,B,A){$super(A);this.transport=Ajax.getTransport();this.request(B)},request:function(B){this.url=B;this.method=this.options.method;var D=Object.isString(this.options.parameters)?this.options.parameters:Object.toQueryString(this.options.parameters);if(!["get","post"].include(this.method)){D+=(D?"&":"")+"_method="+this.method;this.method="post"}if(D&&this.method==="get"){this.url+=(this.url.include("?")?"&":"?")+D}this.parameters=D.toQueryParams();try{var A=new Ajax.Response(this);if(this.options.onCreate){this.options.onCreate(A)}Ajax.Responders.dispatch("onCreate",this,A);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){this.respondToReadyState.bind(this).defer(1)}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=="post"?(this.options.postBody||D):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(C){this.dispatchException(C)}},onStateChange:function(){var A=this.transport.readyState;if(A>1&&!((A==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var E={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,"Accept":"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){E["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){E["Connection"]="close"}}if(typeof this.options.requestHeaders=="object"){var C=this.options.requestHeaders;if(Object.isFunction(C.push)){for(var B=0,D=C.length;B<D;B+=2){E[C[B]]=C[B+1]}}else{$H(C).each(function(F){E[F.key]=F.value})}}for(var A in E){this.transport.setRequestHeader(A,E[A])}},success:function(){var A=this.getStatus();return !A||(A>=200&&A<300)||A==304},getStatus:function(){try{if(this.transport.status===1223){return 204}return this.transport.status||0}catch(A){return 0}},respondToReadyState:function(A){var C=Ajax.Request.Events[A],B=new Ajax.Response(this);if(C=="Complete"){try{this._complete=true;(this.options["on"+B.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(B,B.headerJSON)}catch(D){this.dispatchException(D)}var E=B.getHeader("Content-type");if(this.options.evalJS=="force"||(this.options.evalJS&&this.isSameOrigin()&&E&&E.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))){this.evalResponse()}}try{(this.options["on"+C]||Prototype.emptyFunction)(B,B.headerJSON);Ajax.Responders.dispatch("on"+C,this,B,B.headerJSON)}catch(D){this.dispatchException(D)}if(C=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}},isSameOrigin:function(){var A=this.url.match(/^\s*https?:\/\/[^\/]*/);return !A||(A[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""}))},getHeader:function(A){try{return this.transport.getResponseHeader(A)||null}catch(B){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(A){(this.options.onException||Prototype.emptyFunction)(this,A);Ajax.Responders.dispatch("onException",this,A)}});Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Response=Class.create({initialize:function(C){this.request=C;var D=this.transport=C.transport,A=this.readyState=D.readyState;if((A>2&&!Prototype.Browser.IE)||A==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(D.responseText);this.headerJSON=this._getHeaderJSON()}if(A==4){var B=D.responseXML;this.responseXML=Object.isUndefined(B)?null:B;this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""}catch(A){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(A){return null}},getResponseHeader:function(A){return this.transport.getResponseHeader(A)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var A=this.getHeader("X-JSON");if(!A){return null}A=decodeURIComponent(escape(A));try{return A.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())}catch(B){this.request.dispatchException(B)}},_getResponseJSON:function(){var A=this.request.options;if(!A.evalJSON||(A.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json"))||this.responseText.blank()){return null}try{return this.responseText.evalJSON(A.sanitizeJSON||!this.request.isSameOrigin())}catch(B){this.request.dispatchException(B)}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,A,C,B){this.container={success:(A.success||A),failure:(A.failure||(A.success?null:A))};B=Object.clone(B);var D=B.onComplete;B.onComplete=(function(E,F){this.updateContent(E.responseText);if(Object.isFunction(D)){D(E,F)}}).bind(this);$super(C,B)},updateContent:function(D){var C=this.container[this.success()?"success":"failure"],A=this.options;if(!A.evalScripts){D=D.stripScripts()}if(C=$(C)){if(A.insertion){if(Object.isString(A.insertion)){var B={};B[A.insertion]=D;C.insert(B)}else{A.insertion(C,D)}}else{C.update(D)}}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,A,C,B){$super(B);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=A;this.url=C;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(A){if(this.options.decay){this.decay=(A.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=A.responseText}this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});function $(B){if(arguments.length>1){for(var A=0,D=[],C=arguments.length;A<C;A++){D.push($(arguments[A]))}return D}if(Object.isString(B)){B=document.getElementById(B)}return Element.extend(B)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(F,A){var C=[];var E=document.evaluate(F,$(A)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var B=0,D=E.snapshotLength;B<D;B++){C.push(Element.extend(E.snapshotItem(B)))}return C}}if(!Node){var Node={}}if(!Node.ELEMENT_NODE){Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12})}(function(C){function D(F,E){if(F==="select"){return false}if("type" in E){return false}return true}var B=(function(){try{var E=document.createElement('<input name="x">');return E.tagName.toLowerCase()==="input"&&E.name==="x"}catch(F){return false}})();var A=C.Element;C.Element=function(G,F){F=F||{};G=G.toLowerCase();var E=Element.cache;if(B&&F.name){G="<"+G+' name="'+F.name+'">';delete F.name;return Element.writeAttribute(document.createElement(G),F)}if(!E[G]){E[G]=Element.extend(document.createElement(G))}var H=D(G,F)?E[G].cloneNode(false):document.createElement(G);return Element.writeAttribute(H,F)};Object.extend(C.Element,A||{});if(A){C.Element.prototype=A.prototype}})(this);Element.idCounter=1;Element.cache={};Element._purgeElement=function(B){var A=B._prototypeUID;if(A){Element.stopObserving(B);B._prototypeUID=void 0;delete Element.Storage[A]}};Element.Methods={visible:function(A){return $(A).style.display!="none"},toggle:function(A){A=$(A);Element[Element.visible(A)?"hide":"show"](A);return A},hide:function(A){A=$(A);A.style.display="none";return A},show:function(A){A=$(A);A.style.display="";return A},remove:function(A){A=$(A);A.parentNode.removeChild(A);return A},update:(function(){var D=(function(){var G=document.createElement("select"),H=true;G.innerHTML='<option value="test">test</option>';if(G.options&&G.options[0]){H=G.options[0].nodeName.toUpperCase()!=="OPTION"}G=null;return H})();var B=(function(){try{var G=document.createElement("table");if(G&&G.tBodies){G.innerHTML="<tbody><tr><td>test</td></tr></tbody>";var I=typeof G.tBodies[0]=="undefined";G=null;return I}}catch(H){return true}})();var A=(function(){try{var G=document.createElement("div");G.innerHTML="<link>";var I=(G.childNodes.length===0);G=null;return I}catch(H){return true}})();var C=D||B||A;var F=(function(){var G=document.createElement("script"),I=false;try{G.appendChild(document.createTextNode(""));I=!G.firstChild||G.firstChild&&G.firstChild.nodeType!==3}catch(H){I=true}G=null;return I})();function E(K,L){K=$(K);var G=Element._purgeElement;var M=K.getElementsByTagName("*"),J=M.length;while(J--){G(M[J])}if(L&&L.toElement){L=L.toElement()}if(Object.isElement(L)){return K.update().insert(L)}L=Object.toHTML(L);var I=K.tagName.toUpperCase();if(I==="SCRIPT"&&F){K.text=L;return K}if(C){if(I in Element._insertionTranslations.tags){while(K.firstChild){K.removeChild(K.firstChild)}Element._getContentFromAnonymousElement(I,L.stripScripts()).each(function(N){K.appendChild(N)})}else{if(A&&Object.isString(L)&&L.indexOf("<link")>-1){while(K.firstChild){K.removeChild(K.firstChild)}var H=Element._getContentFromAnonymousElement(I,L.stripScripts(),true);H.each(function(N){K.appendChild(N)})}else{K.innerHTML=L.stripScripts()}}}else{K.innerHTML=L.stripScripts()}L.evalScripts.bind(L).defer();return K}return E})(),replace:function(B,C){B=$(B);if(C&&C.toElement){C=C.toElement()}else{if(!Object.isElement(C)){C=Object.toHTML(C);var A=B.ownerDocument.createRange();A.selectNode(B);C.evalScripts.bind(C).defer();C=A.createContextualFragment(C.stripScripts())}}B.parentNode.replaceChild(C,B);return B},insert:function(C,E){C=$(C);if(Object.isString(E)||Object.isNumber(E)||Object.isElement(E)||(E&&(E.toElement||E.toHTML))){E={bottom:E}}var D,F,B,G;for(var A in E){D=E[A];A=A.toLowerCase();F=Element._insertionTranslations[A];if(D&&D.toElement){D=D.toElement()}if(Object.isElement(D)){F(C,D);continue}D=Object.toHTML(D);B=((A=="before"||A=="after")?C.parentNode:C).tagName.toUpperCase();G=Element._getContentFromAnonymousElement(B,D.stripScripts());if(A=="top"||A=="after"){G.reverse()}G.each(F.curry(C));D.evalScripts.bind(D).defer()}return C},wrap:function(B,C,A){B=$(B);if(Object.isElement(C)){$(C).writeAttribute(A||{})}else{if(Object.isString(C)){C=new Element(C,A)}else{C=new Element("div",C)}}if(B.parentNode){B.parentNode.replaceChild(C,B)}C.appendChild(B);return C},inspect:function(B){B=$(B);var A="<"+B.tagName.toLowerCase();$H({"id":"id","className":"class"}).each(function(F){var E=F.first(),C=F.last(),D=(B[E]||"").toString();if(D){A+=" "+C+"="+D.inspect(true)}});return A+">"},recursivelyCollect:function(A,C,D){A=$(A);D=D||-1;var B=[];while(A=A[C]){if(A.nodeType==1){B.push(Element.extend(A))}if(B.length==D){break}}return B},ancestors:function(A){return Element.recursivelyCollect(A,"parentNode")},descendants:function(A){return Element.select(A,"*")},firstDescendant:function(A){A=$(A).firstChild;while(A&&A.nodeType!=1){A=A.nextSibling}return $(A)},immediateDescendants:function(B){var A=[],C=$(B).firstChild;while(C){if(C.nodeType===1){A.push(Element.extend(C))}C=C.nextSibling}return A},previousSiblings:function(A,B){return Element.recursivelyCollect(A,"previousSibling")},nextSiblings:function(A){return Element.recursivelyCollect(A,"nextSibling")},siblings:function(A){A=$(A);return Element.previousSiblings(A).reverse().concat(Element.nextSiblings(A))},match:function(B,A){B=$(B);if(Object.isString(A)){return Prototype.Selector.match(B,A)}return A.match(B)},up:function(B,D,A){B=$(B);if(arguments.length==1){return $(B.parentNode)}var C=Element.ancestors(B);return Object.isNumber(D)?C[D]:Prototype.Selector.find(C,D,A)},down:function(B,C,A){B=$(B);if(arguments.length==1){return Element.firstDescendant(B)}return Object.isNumber(C)?Element.descendants(B)[C]:Element.select(B,C)[A||0]},previous:function(B,C,A){B=$(B);if(Object.isNumber(C)){A=C,C=false}if(!Object.isNumber(A)){A=0}if(C){return Prototype.Selector.find(B.previousSiblings(),C,A)}else{return B.recursivelyCollect("previousSibling",A+1)[A]}},next:function(B,D,A){B=$(B);if(Object.isNumber(D)){A=D,D=false}if(!Object.isNumber(A)){A=0}if(D){return Prototype.Selector.find(B.nextSiblings(),D,A)}else{var C=Object.isNumber(A)?A+1:1;return B.recursivelyCollect("nextSibling",A+1)[A]}},select:function(A){A=$(A);var B=Array.prototype.slice.call(arguments,1).join(", ");return Prototype.Selector.select(B,A)},adjacent:function(A){A=$(A);var B=Array.prototype.slice.call(arguments,1).join(", ");return Prototype.Selector.select(B,A.parentNode).without(A)},identify:function(A){A=$(A);var B=Element.readAttribute(A,"id");if(B){return B}do{B="anonymous_element_"+Element.idCounter++}while($(B));Element.writeAttribute(A,"id",B);return B},readAttribute:function(C,A){C=$(C);if(Prototype.Browser.IE){var B=Element._attributeTranslations.read;if(B.values[A]){return B.values[A](C,A)}if(B.names[A]){A=B.names[A]}if(A.include(":")){return(!C.attributes||!C.attributes[A])?null:C.attributes[A].value}}return C.getAttribute(A)},writeAttribute:function(E,C,F){E=$(E);var B={},D=Element._attributeTranslations.write;if(typeof C=="object"){B=C}else{B[C]=Object.isUndefined(F)?true:F}for(var A in B){C=D.names[A]||A;F=B[A];if(D.values[A]){C=D.values[A](E,F)}if(F===false||F===null){E.removeAttribute(C)}else{if(F===true){E.setAttribute(C,C)}else{E.setAttribute(C,F)}}}return E},getHeight:function(A){return Element.getDimensions(A).height},getWidth:function(A){return Element.getDimensions(A).width},classNames:function(A){return new Element.ClassNames(A)},hasClassName:function(A,B){if(!(A=$(A))){return }var C=A.className;return(C.length>0&&(C==B||new RegExp("(^|\\s)"+B+"(\\s|$)").test(C)))},addClassName:function(A,B){if(!(A=$(A))){return }if(!Element.hasClassName(A,B)){A.className+=(A.className?" ":"")+B}return A},removeClassName:function(A,B){if(!(A=$(A))){return }A.className=A.className.replace(new RegExp("(^|\\s+)"+B+"(\\s+|$)")," ").strip();return A},toggleClassName:function(A,B){if(!(A=$(A))){return }return Element[Element.hasClassName(A,B)?"removeClassName":"addClassName"](A,B)},cleanWhitespace:function(B){B=$(B);var C=B.firstChild;while(C){var A=C.nextSibling;if(C.nodeType==3&&!/\S/.test(C.nodeValue)){B.removeChild(C)}C=A}return B},empty:function(A){return $(A).innerHTML.blank()},descendantOf:function(B,A){B=$(B),A=$(A);if(B.compareDocumentPosition){return(B.compareDocumentPosition(A)&8)===8}if(A.contains){return A.contains(B)&&A!==B}while(B=B.parentNode){if(B==A){return true}}return false},scrollTo:function(A){A=$(A);var B=Element.cumulativeOffset(A);window.scrollTo(B[0],B[1]);return A},getStyle:function(B,C){B=$(B);C=C=="float"?"cssFloat":C.camelize();var D=B.style[C];if(!D||D=="auto"){var A=document.defaultView.getComputedStyle(B,null);D=A?A[C]:null}if(C=="opacity"){return D?parseFloat(D):1}return D=="auto"?null:D},getOpacity:function(A){return $(A).getStyle("opacity")},setStyle:function(B,C){B=$(B);var E=B.style,A;if(Object.isString(C)){B.style.cssText+=";"+C;return C.include("opacity")?B.setOpacity(C.match(/opacity:\s*(\d?\.?\d*)/)[1]):B}for(var D in C){if(D=="opacity"){B.setOpacity(C[D])}else{E[(D=="float"||D=="cssFloat")?(Object.isUndefined(E.styleFloat)?"cssFloat":"styleFloat"):D]=C[D]}}return B},setOpacity:function(A,B){A=$(A);A.style.opacity=(B==1||B==="")?"":(B<0.00001)?0:B;return A},makePositioned:function(A){A=$(A);var B=Element.getStyle(A,"position");if(B=="static"||!B){A._madePositioned=true;A.style.position="relative";if(Prototype.Browser.Opera){A.style.top=0;A.style.left=0}}return A},undoPositioned:function(A){A=$(A);if(A._madePositioned){A._madePositioned=undefined;A.style.position=A.style.top=A.style.left=A.style.bottom=A.style.right=""}return A},makeClipping:function(A){A=$(A);if(A._overflow){return A}A._overflow=Element.getStyle(A,"overflow")||"auto";if(A._overflow!=="hidden"){A.style.overflow="hidden"}return A},undoClipping:function(A){A=$(A);if(!A._overflow){return A}A.style.overflow=A._overflow=="auto"?"":A._overflow;A._overflow=null;return A},clonePosition:function(B,D){var A=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});D=$(D);var E=Element.viewportOffset(D),F=[0,0],C=null;B=$(B);if(Element.getStyle(B,"position")=="absolute"){C=Element.getOffsetParent(B);F=Element.viewportOffset(C)}if(C==document.body){F[0]-=document.body.offsetLeft;F[1]-=document.body.offsetTop}if(A.setLeft){B.style.left=(E[0]-F[0]+A.offsetLeft)+"px"}if(A.setTop){B.style.top=(E[1]-F[1]+A.offsetTop)+"px"}if(A.setWidth){B.style.width=D.offsetWidth+"px"}if(A.setHeight){B.style.height=D.offsetHeight+"px"}return B}};Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(D,B,C){switch(C){case"height":case"width":if(!Element.visible(B)){return null}var E=parseInt(D(B,C),10);if(E!==B["offset"+C.capitalize()]){return E+"px"}var A;if(C==="height"){A=["border-top-width","padding-top","padding-bottom","border-bottom-width"]}else{A=["border-left-width","padding-left","padding-right","border-right-width"]}return A.inject(E,function(F,G){var H=D(B,G);return H===null?F:F-parseInt(H,10)})+"px";default:return D(B,C)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(C,A,B){if(B==="title"){return A.title}return C(A,B)})}else{if(Prototype.Browser.IE){Element.Methods.getStyle=function(A,B){A=$(A);B=(B=="float"||B=="cssFloat")?"styleFloat":B.camelize();var C=A.style[B];if(!C&&A.currentStyle){C=A.currentStyle[B]}if(B=="opacity"){if(C=(A.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(C[1]){return parseFloat(C[1])/100}}return 1}if(C=="auto"){if((B=="width"||B=="height")&&(A.getStyle("display")!="none")){return A["offset"+B.capitalize()]+"px"}return null}return C};Element.Methods.setOpacity=function(B,E){function F(G){return G.replace(/alpha\([^\)]*\)/gi,"")}B=$(B);var A=B.currentStyle;if((A&&!A.hasLayout)||(!A&&B.style.zoom=="normal")){B.style.zoom=1}var D=B.getStyle("filter"),C=B.style;if(E==1||E===""){(D=F(D))?C.filter=D:C.removeAttribute("filter");return B}else{if(E<0.00001){E=0}}C.filter=F(D)+"alpha(opacity="+(E*100)+")";return B};Element._attributeTranslations=(function(){var B="className",A="for",C=document.createElement("div");C.setAttribute(B,"x");if(C.className!=="x"){C.setAttribute("class","x");if(C.className==="x"){B="class"}}C=null;C=document.createElement("label");C.setAttribute(A,"x");if(C.htmlFor!=="x"){C.setAttribute("htmlFor","x");if(C.htmlFor==="x"){A="htmlFor"}}C=null;return{read:{names:{"class":B,"className":B,"for":A,"htmlFor":A},values:{_getAttr:function(D,E){return D.getAttribute(E)},_getAttr2:function(D,E){return D.getAttribute(E,2)},_getAttrNode:function(D,F){var E=D.getAttributeNode(F);return E?E.value:""},_getEv:(function(){var D=document.createElement("div"),F;D.onclick=Prototype.emptyFunction;var E=D.getAttribute("onclick");if(String(E).indexOf("{")>-1){F=function(G,H){H=G.getAttribute(H);if(!H){return null}H=H.toString();H=H.split("{")[1];H=H.split("}")[0];return H.strip()}}else{if(E===""){F=function(G,H){H=G.getAttribute(H);if(!H){return null}return H.strip()}}}D=null;return F})(),_flag:function(D,E){return $(D).hasAttribute(E)?E:null},style:function(D){return D.style.cssText.toLowerCase()},title:function(D){return D.title}}}}})();Element._attributeTranslations.write={names:Object.extend({cellpadding:"cellPadding",cellspacing:"cellSpacing"},Element._attributeTranslations.read.names),values:{checked:function(A,B){A.checked=!!B},style:function(A,B){A.style.cssText=B?B:""}}};Element._attributeTranslations.has={};$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder").each(function(A){Element._attributeTranslations.write.names[A.toLowerCase()]=A;Element._attributeTranslations.has[A.toLowerCase()]=A});(function(A){Object.extend(A,{href:A._getAttr2,src:A._getAttr2,type:A._getAttr,action:A._getAttrNode,disabled:A._flag,checked:A._flag,readonly:A._flag,multiple:A._flag,onload:A._getEv,onunload:A._getEv,onclick:A._getEv,ondblclick:A._getEv,onmousedown:A._getEv,onmouseup:A._getEv,onmouseover:A._getEv,onmousemove:A._getEv,onmouseout:A._getEv,onfocus:A._getEv,onblur:A._getEv,onkeypress:A._getEv,onkeydown:A._getEv,onkeyup:A._getEv,onsubmit:A._getEv,onreset:A._getEv,onselect:A._getEv,onchange:A._getEv})})(Element._attributeTranslations.read.values);if(Prototype.BrowserFeatures.ElementExtensions){(function(){function A(E){var B=E.getElementsByTagName("*"),D=[];for(var C=0,F;F=B[C];C++){if(F.tagName!=="!"){D.push(F)}}return D}Element.Methods.down=function(C,D,B){C=$(C);if(arguments.length==1){return C.firstDescendant()}return Object.isNumber(D)?A(C)[D]:Element.select(C,D)[B||0]}})()}}else{if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(A,B){A=$(A);A.style.opacity=(B==1)?0.999999:(B==="")?"":(B<0.00001)?0:B;return A}}else{if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(A,B){A=$(A);A.style.opacity=(B==1||B==="")?"":(B<0.00001)?0:B;if(B==1){if(A.tagName.toUpperCase()=="IMG"&&A.width){A.width++;A.width--}else{try{var D=document.createTextNode(" ");A.appendChild(D);A.removeChild(D)}catch(C){}}}return A}}}}}if("outerHTML" in document.documentElement){Element.Methods.replace=function(C,E){C=$(C);if(E&&E.toElement){E=E.toElement()}if(Object.isElement(E)){C.parentNode.replaceChild(E,C);return C}E=Object.toHTML(E);var D=C.parentNode,B=D.tagName.toUpperCase();if(Element._insertionTranslations.tags[B]){var F=C.next(),A=Element._getContentFromAnonymousElement(B,E.stripScripts());D.removeChild(C);if(F){A.each(function(G){D.insertBefore(G,F)})}else{A.each(function(G){D.appendChild(G)})}}else{C.outerHTML=E.stripScripts()}E.evalScripts.bind(E).defer();return C}}Element._returnOffset=function(B,C){var A=[B,C];A.left=B;A.top=C;return A};Element._getContentFromAnonymousElement=function(E,D,F){var G=new Element("div"),C=Element._insertionTranslations.tags[E];var A=false;if(C){A=true}else{if(F){A=true;C=["","",0]}}if(A){G.innerHTML="&nbsp;"+C[0]+D+C[1];G.removeChild(G.firstChild);for(var B=C[2];B--;){G=G.firstChild}}else{G.innerHTML=D}return $A(G.childNodes)};Element._insertionTranslations={before:function(A,B){A.parentNode.insertBefore(B,A)},top:function(A,B){A.insertBefore(B,A.firstChild)},bottom:function(A,B){A.appendChild(B)},after:function(A,B){A.parentNode.insertBefore(B,A.nextSibling)},tags:{TABLE:["<table>","</table>",1],TBODY:["<table><tbody>","</tbody></table>",2],TR:["<table><tbody><tr>","</tr></tbody></table>",3],TD:["<table><tbody><tr><td>","</td></tr></tbody></table>",4],SELECT:["<select>","</select>",1]}};(function(){var A=Element._insertionTranslations.tags;Object.extend(A,{THEAD:A.TBODY,TFOOT:A.TBODY,TH:A.TD})})();Element.Methods.Simulated={hasAttribute:function(A,C){C=Element._attributeTranslations.has[C]||C;var B=$(A).getAttributeNode(C);return !!(B&&B.specified)}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);(function(A){if(!Prototype.BrowserFeatures.ElementExtensions&&A["__proto__"]){window.HTMLElement={};window.HTMLElement.prototype=A["__proto__"];Prototype.BrowserFeatures.ElementExtensions=true}A=null})(document.createElement("div"));Element.extend=(function(){function C(G){if(typeof window.Element!="undefined"){var I=window.Element.prototype;if(I){var K="_"+(Math.random()+"").slice(2),H=document.createElement(G);I[K]="x";var J=(H[K]!=="x");delete I[K];H=null;return J}}return false}function B(H,G){for(var J in G){var I=G[J];if(Object.isFunction(I)&&!(J in H)){H[J]=I.methodize()}}}var D=C("object");if(Prototype.BrowserFeatures.SpecificElementExtensions){if(D){return function(H){if(H&&typeof H._extendedByPrototype=="undefined"){var G=H.tagName;if(G&&(/^(?:object|applet|embed)$/i.test(G))){B(H,Element.Methods);B(H,Element.Methods.Simulated);B(H,Element.Methods.ByTag[G.toUpperCase()])}}return H}}return Prototype.K}var A={},E=Element.Methods.ByTag;var F=Object.extend(function(I){if(!I||typeof I._extendedByPrototype!="undefined"||I.nodeType!=1||I==window){return I}var G=Object.clone(A),H=I.tagName.toUpperCase();if(E[H]){Object.extend(G,E[H])}B(I,G);I._extendedByPrototype=Prototype.emptyFunction;return I},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(A,Element.Methods);Object.extend(A,Element.Methods.Simulated)}}});F.refresh();return F})();if(document.documentElement.hasAttribute){Element.hasAttribute=function(A,B){return A.hasAttribute(B)}}else{Element.hasAttribute=Element.Methods.Simulated.hasAttribute}Element.addMethods=function(C){var J=Prototype.BrowserFeatures,D=Element.Methods.ByTag;if(!C){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),"BUTTON":Object.clone(Form.Element.Methods)})}if(arguments.length==2){var B=C;C=arguments[1]}if(!B){Object.extend(Element.Methods,C||{})}else{if(Object.isArray(B)){B.each(H)}else{H(B)}}function H(F){F=F.toUpperCase();if(!Element.Methods.ByTag[F]){Element.Methods.ByTag[F]={}}Object.extend(Element.Methods.ByTag[F],C)}function A(M,L,F){F=F||false;for(var O in M){var N=M[O];if(!Object.isFunction(N)){continue}if(!F||!(O in L)){L[O]=N.methodize()}}}function E(N){var F;var M={"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(M[N]){F="HTML"+M[N]+"Element"}if(window[F]){return window[F]}F="HTML"+N+"Element";if(window[F]){return window[F]}F="HTML"+N.capitalize()+"Element";if(window[F]){return window[F]}var L=document.createElement(N),O=L["__proto__"]||L.constructor.prototype;L=null;return O}var I=window.HTMLElement?HTMLElement.prototype:Element.prototype;if(J.ElementExtensions){A(Element.Methods,I);A(Element.Methods.Simulated,I,true)}if(J.SpecificElementExtensions){for(var K in Element.Methods.ByTag){var G=E(K);if(Object.isUndefined(G)){continue}A(D[K],G.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh){Element.extend.refresh()}Element.cache={}};document.viewport={getDimensions:function(){return{width:this.getWidth(),height:this.getHeight()}},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)}};(function(C){var H=Prototype.Browser,F=document,D,E={};function A(){if(H.WebKit&&!F.evaluate){return document}if(H.Opera&&window.parseFloat(window.opera.version())<9.5){return document.body}return document.documentElement}function G(B){if(!D){D=A()}E[B]="client"+B;C["get"+B]=function(){return D[E[B]]};return C["get"+B]()}C.getWidth=G.curry("Width");C.getHeight=G.curry("Height")})(document.viewport);Element.Storage={UID:1};Element.addMethods({getStorage:function(B){if(!(B=$(B))){return }var A;if(B===window){A=0}else{if(typeof B._prototypeUID==="undefined"){B._prototypeUID=Element.Storage.UID++}A=B._prototypeUID}if(!Element.Storage[A]){Element.Storage[A]=$H()}return Element.Storage[A]},store:function(B,A,C){if(!(B=$(B))){return }if(arguments.length===2){Element.getStorage(B).update(A)}else{Element.getStorage(B).set(A,C)}return B},retrieve:function(C,B,A){if(!(C=$(C))){return }var E=Element.getStorage(C),D=E.get(B);if(Object.isUndefined(D)){E.set(B,A);D=A}return D},clone:function(C,A){if(!(C=$(C))){return }var E=C.cloneNode(A);E._prototypeUID=void 0;if(A){var D=Element.select(E,"*"),B=D.length;while(B--){D[B]._prototypeUID=void 0}}return Element.extend(E)},purge:function(C){if(!(C=$(C))){return }var A=Element._purgeElement;A(C);var D=C.getElementsByTagName("*"),B=D.length;while(B--){A(D[B])}return null}});(function(){function H(V){var U=V.match(/^(\d+)%?$/i);if(!U){return null}return(Number(U[1])/100)}function O(g,h,V){var Y=null;if(Object.isElement(g)){Y=g;g=Y.getStyle(h)}if(g===null){return null}if((/^(?:-)?\d+(\.\d+)?(px)?$/i).test(g)){return window.parseFloat(g)}var b=g.include("%"),W=(V===document.viewport);if(/\d/.test(g)&&Y&&Y.runtimeStyle&&!(b&&W)){var U=Y.style.left,f=Y.runtimeStyle.left;Y.runtimeStyle.left=Y.currentStyle.left;Y.style.left=g||0;g=Y.style.pixelLeft;Y.style.left=U;Y.runtimeStyle.left=f;return g}if(Y&&b){V=V||Y.parentNode;var X=H(g);var c=null;var Z=Y.getStyle("position");var e=h.include("left")||h.include("right")||h.include("width");var d=h.include("top")||h.include("bottom")||h.include("height");if(V===document.viewport){if(e){c=document.viewport.getWidth()}else{if(d){c=document.viewport.getHeight()}}}else{if(e){c=$(V).measure("width")}else{if(d){c=$(V).measure("height")}}}return(c===null)?0:c*X}return 0}function G(U){if(Object.isString(U)&&U.endsWith("px")){return U}return U+"px"}function J(V){var U=V;while(V&&V.parentNode){var W=V.getStyle("display");if(W==="none"){return false}V=$(V.parentNode)}return true}var D=Prototype.K;if("currentStyle" in document.documentElement){D=function(U){if(!U.currentStyle.hasLayout){U.style.zoom=1}return U}}function F(U){if(U.include("border")){U=U+"-width"}return U.camelize()}Element.Layout=Class.create(Hash,{initialize:function($super,V,U){$super();this.element=$(V);Element.Layout.PROPERTIES.each(function(W){this._set(W,null)},this);if(U){this._preComputing=true;this._begin();Element.Layout.PROPERTIES.each(this._compute,this);this._end();this._preComputing=false}},_set:function(V,U){return Hash.prototype.set.call(this,V,U)},set:function(V,U){throw"Properties of Element.Layout are read-only."},get:function($super,V){var U=$super(V);return U===null?this._compute(V):U},_begin:function(){if(this._prepared){return }var Y=this.element;if(J(Y)){this._prepared=true;return }var b={position:Y.style.position||"",width:Y.style.width||"",visibility:Y.style.visibility||"",display:Y.style.display||""};Y.store("prototype_original_styles",b);var c=Y.getStyle("position"),U=Y.getStyle("width");if(U==="0px"||U===null){Y.style.display="block";U=Y.getStyle("width")}var V=(c==="fixed")?document.viewport:Y.parentNode;Y.setStyle({position:"absolute",visibility:"hidden",display:"block"});var W=Y.getStyle("width");var X;if(U&&(W===U)){X=O(Y,"width",V)}else{if(c==="absolute"||c==="fixed"){X=O(Y,"width",V)}else{var d=Y.parentNode,Z=$(d).getLayout();X=Z.get("width")-this.get("margin-left")-this.get("border-left")-this.get("padding-left")-this.get("padding-right")-this.get("border-right")-this.get("margin-right")}}Y.setStyle({width:X+"px"});this._prepared=true},_end:function(){var V=this.element;var U=V.retrieve("prototype_original_styles");V.store("prototype_original_styles",null);V.setStyle(U);this._prepared=false},_compute:function(V){var U=Element.Layout.COMPUTATIONS;if(!(V in U)){throw"Property not found."}return this._set(V,U[V].call(this,this.element))},toObject:function(){var U=$A(arguments);var V=(U.length===0)?Element.Layout.PROPERTIES:U.join(" ").split(" ");var W={};V.each(function(X){if(!Element.Layout.PROPERTIES.include(X)){return }var Y=this.get(X);if(Y!=null){W[X]=Y}},this);return W},toHash:function(){var U=this.toObject.apply(this,arguments);return new Hash(U)},toCSS:function(){var U=$A(arguments);var W=(U.length===0)?Element.Layout.PROPERTIES:U.join(" ").split(" ");var V={};W.each(function(X){if(!Element.Layout.PROPERTIES.include(X)){return }if(Element.Layout.COMPOSITE_PROPERTIES.include(X)){return }var Y=this.get(X);if(Y!=null){V[F(X)]=Y+"px"}},this);return V},inspect:function(){return"#<Element.Layout>"}});Object.extend(Element.Layout,{PROPERTIES:$w("height width top left right bottom border-left border-right border-top border-bottom padding-left padding-right padding-top padding-bottom margin-top margin-bottom margin-left margin-right padding-box-width padding-box-height border-box-width border-box-height margin-box-width margin-box-height"),COMPOSITE_PROPERTIES:$w("padding-box-width padding-box-height margin-box-width margin-box-height border-box-width border-box-height"),COMPUTATIONS:{"height":function(W){if(!this._preComputing){this._begin()}var U=this.get("border-box-height");if(U<=0){if(!this._preComputing){this._end()}return 0}var X=this.get("border-top"),V=this.get("border-bottom");var Z=this.get("padding-top"),Y=this.get("padding-bottom");if(!this._preComputing){this._end()}return U-X-V-Z-Y},"width":function(W){if(!this._preComputing){this._begin()}var V=this.get("border-box-width");if(V<=0){if(!this._preComputing){this._end()}return 0}var Z=this.get("border-left"),U=this.get("border-right");var X=this.get("padding-left"),Y=this.get("padding-right");if(!this._preComputing){this._end()}return V-Z-U-X-Y},"padding-box-height":function(V){var U=this.get("height"),X=this.get("padding-top"),W=this.get("padding-bottom");return U+X+W},"padding-box-width":function(U){var V=this.get("width"),W=this.get("padding-left"),X=this.get("padding-right");return V+W+X},"border-box-height":function(V){if(!this._preComputing){this._begin()}var U=V.offsetHeight;if(!this._preComputing){this._end()}return U},"border-box-width":function(U){if(!this._preComputing){this._begin()}var V=U.offsetWidth;if(!this._preComputing){this._end()}return V},"margin-box-height":function(V){var U=this.get("border-box-height"),W=this.get("margin-top"),X=this.get("margin-bottom");if(U<=0){return 0}return U+W+X},"margin-box-width":function(W){var V=this.get("border-box-width"),X=this.get("margin-left"),U=this.get("margin-right");if(V<=0){return 0}return V+X+U},"top":function(U){var V=U.positionedOffset();return V.top},"bottom":function(U){var X=U.positionedOffset(),V=U.getOffsetParent(),W=V.measure("height");var Y=this.get("border-box-height");return W-Y-X.top},"left":function(U){var V=U.positionedOffset();return V.left},"right":function(W){var Y=W.positionedOffset(),X=W.getOffsetParent(),U=X.measure("width");var V=this.get("border-box-width");return U-V-Y.left},"padding-top":function(U){return O(U,"paddingTop")},"padding-bottom":function(U){return O(U,"paddingBottom")},"padding-left":function(U){return O(U,"paddingLeft")},"padding-right":function(U){return O(U,"paddingRight")},"border-top":function(U){return O(U,"borderTopWidth")},"border-bottom":function(U){return O(U,"borderBottomWidth")},"border-left":function(U){return O(U,"borderLeftWidth")},"border-right":function(U){return O(U,"borderRightWidth")},"margin-top":function(U){return O(U,"marginTop")},"margin-bottom":function(U){return O(U,"marginBottom")},"margin-left":function(U){return O(U,"marginLeft")},"margin-right":function(U){return O(U,"marginRight")}}});if("getBoundingClientRect" in document.documentElement){Object.extend(Element.Layout.COMPUTATIONS,{"right":function(V){var W=D(V.getOffsetParent());var X=V.getBoundingClientRect(),U=W.getBoundingClientRect();return(U.right-X.right).round()},"bottom":function(V){var W=D(V.getOffsetParent());var X=V.getBoundingClientRect(),U=W.getBoundingClientRect();return(U.bottom-X.bottom).round()}})}Element.Offset=Class.create({initialize:function(V,U){this.left=V.round();this.top=U.round();this[0]=this.left;this[1]=this.top},relativeTo:function(U){return new Element.Offset(this.left-U.left,this.top-U.top)},inspect:function(){return"#<Element.Offset left: #{left} top: #{top}>".interpolate(this)},toString:function(){return"[#{left}, #{top}]".interpolate(this)},toArray:function(){return[this.left,this.top]}});function R(V,U){return new Element.Layout(V,U)}function B(U,V){return $(U).getLayout().get(V)}function N(V){V=$(V);var Z=Element.getStyle(V,"display");if(Z&&Z!=="none"){return{width:V.offsetWidth,height:V.offsetHeight}}var W=V.style;var U={visibility:W.visibility,position:W.position,display:W.display};var Y={visibility:"hidden",display:"block"};if(U.position!=="fixed"){Y.position="absolute"}Element.setStyle(V,Y);var X={width:V.offsetWidth,height:V.offsetHeight};Element.setStyle(V,U);return X}function L(U){U=$(U);if(E(U)||C(U)||M(U)||K(U)){return $(document.body)}var V=(Element.getStyle(U,"display")==="inline");if(!V&&U.offsetParent){return $(U.offsetParent)}while((U=U.parentNode)&&U!==document.body){if(Element.getStyle(U,"position")!=="static"){return K(U)?$(document.body):$(U)}}return $(document.body)}function T(V){V=$(V);var U=0,W=0;if(V.parentNode){do{U+=V.offsetTop||0;W+=V.offsetLeft||0;V=V.offsetParent}while(V)}return new Element.Offset(W,U)}function P(V){V=$(V);var W=V.getLayout();var U=0,Y=0;do{U+=V.offsetTop||0;Y+=V.offsetLeft||0;V=V.offsetParent;if(V){if(M(V)){break}var X=Element.getStyle(V,"position");if(X!=="static"){break}}}while(V);Y-=W.get("margin-top");U-=W.get("margin-left");return new Element.Offset(Y,U)}function A(V){var U=0,W=0;do{U+=V.scrollTop||0;W+=V.scrollLeft||0;V=V.parentNode}while(V);return new Element.Offset(W,U)}function S(Y){V=$(V);var U=0,X=0,W=document.body;var V=Y;do{U+=V.offsetTop||0;X+=V.offsetLeft||0;if(V.offsetParent==W&&Element.getStyle(V,"position")=="absolute"){break}}while(V=V.offsetParent);V=Y;do{if(V!=W){U-=V.scrollTop||0;X-=V.scrollLeft||0}}while(V=V.parentNode);return new Element.Offset(X,U)}function Q(U){U=$(U);if(Element.getStyle(U,"position")==="absolute"){return U}var Y=L(U);var X=U.viewportOffset(),V=Y.viewportOffset();var Z=X.relativeTo(V);var W=U.getLayout();U.store("prototype_absolutize_original_styles",{left:U.getStyle("left"),top:U.getStyle("top"),width:U.getStyle("width"),height:U.getStyle("height")});U.setStyle({position:"absolute",top:Z.top+"px",left:Z.left+"px",width:W.get("width")+"px",height:W.get("height")+"px"});return U}function I(V){V=$(V);if(Element.getStyle(V,"position")==="relative"){return V}var U=V.retrieve("prototype_absolutize_original_styles");if(U){V.setStyle(U)}return V}if(Prototype.Browser.IE){L=L.wrap(function(W,V){V=$(V);if(E(V)||C(V)||M(V)||K(V)){return $(document.body)}var U=V.getStyle("position");if(U!=="static"){return W(V)}V.setStyle({position:"relative"});var X=W(V);V.setStyle({position:U});return X});P=P.wrap(function(X,V){V=$(V);if(!V.parentNode){return new Element.Offset(0,0)}var U=V.getStyle("position");if(U!=="static"){return X(V)}var W=V.getOffsetParent();if(W&&W.getStyle("position")==="fixed"){D(W)}V.setStyle({position:"relative"});var Y=X(V);V.setStyle({position:U});return Y})}else{if(Prototype.Browser.Webkit){T=function(V){V=$(V);var U=0,W=0;do{U+=V.offsetTop||0;W+=V.offsetLeft||0;if(V.offsetParent==document.body){if(Element.getStyle(V,"position")=="absolute"){break}}V=V.offsetParent}while(V);return new Element.Offset(W,U)}}}Element.addMethods({getLayout:R,measure:B,getDimensions:N,getOffsetParent:L,cumulativeOffset:T,positionedOffset:P,cumulativeScrollOffset:A,viewportOffset:S,absolutize:Q,relativize:I});function M(U){return U.nodeName.toUpperCase()==="BODY"}function K(U){return U.nodeName.toUpperCase()==="HTML"}function E(U){return U.nodeType===Node.DOCUMENT_NODE}function C(U){return U!==document.body&&!Element.descendantOf(U,document.body)}if("getBoundingClientRect" in document.documentElement){Element.addMethods({viewportOffset:function(U){U=$(U);if(C(U)){return new Element.Offset(0,0)}var V=U.getBoundingClientRect(),W=document.documentElement;return new Element.Offset(V.left-W.clientLeft,V.top-W.clientTop)}})}})();window.$$=function(){var A=$A(arguments).join(", ");return Prototype.Selector.select(A,document)};Prototype.Selector=(function(){function A(){throw new Error('Method "Prototype.Selector.select" must be defined.')}function C(){throw new Error('Method "Prototype.Selector.match" must be defined.')}function D(K,L,H){H=H||0;var G=Prototype.Selector.match,J=K.length,F=0,I;for(I=0;I<J;I++){if(G(K[I],L)&&H==F++){return Element.extend(K[I])}}}function E(H){for(var F=0,G=H.length;F<G;F++){Element.extend(H[F])}return H}var B=Prototype.K;return{select:A,match:C,find:D,extendElements:(Element.extend===B)?B:E,extendElement:Element.extend}})();Prototype._original_property=window.Sizzle;(function(){var P=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,I=0,D=Object.prototype.toString,N=false,H=true;[0,0].sort(function(){H=false;return 0});var B=function(f,U,c,W){c=c||[];var R=U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!f||typeof f!=="string"){return c}var d=[],e,Z,k,j,b,T,S=true,X=O(U),h=f;while((P.exec(""),e=P.exec(h))!==null){h=e[3];d.push(e[1]);if(e[2]){T=e[3];break}}if(d.length>1&&J.exec(f)){if(d.length===2&&E.relative[d[0]]){Z=F(d[0]+d[1],U)}else{Z=E.relative[d[0]]?[U]:B(d.shift(),U);while(d.length){f=d.shift();if(E.relative[f]){f+=d.shift()}Z=F(f,Z)}}}else{if(!W&&d.length>1&&U.nodeType===9&&!X&&E.match.ID.test(d[0])&&!E.match.ID.test(d[d.length-1])){var l=B.find(d.shift(),U,X);U=l.expr?B.filter(l.expr,l.set)[0]:l.set[0]}if(U){var l=W?{expr:d.pop(),set:A(W)}:B.find(d.pop(),d.length===1&&(d[0]==="~"||d[0]==="+")&&U.parentNode?U.parentNode:U,X);Z=l.expr?B.filter(l.expr,l.set):l.set;if(d.length>0){k=A(Z)}else{S=false}while(d.length){var V=d.pop(),Y=V;if(!E.relative[V]){V=""}else{Y=d.pop()}if(Y==null){Y=U}E.relative[V](k,Y,X)}}else{k=d=[]}}if(!k){k=Z}if(!k){throw"Syntax error, unrecognized expression: "+(V||f)}if(D.call(k)==="[object Array]"){if(!S){c.push.apply(c,k)}else{if(U&&U.nodeType===1){for(var g=0;k[g]!=null;g++){if(k[g]&&(k[g]===true||k[g].nodeType===1&&G(U,k[g]))){c.push(Z[g])}}}else{for(var g=0;k[g]!=null;g++){if(k[g]&&k[g].nodeType===1){c.push(Z[g])}}}}}else{A(k,c)}if(T){B(T,R,c,W);B.uniqueSort(c)}return c};B.uniqueSort=function(S){if(C){N=H;S.sort(C);if(N){for(var R=1;R<S.length;R++){if(S[R]===S[R-1]){S.splice(R--,1)}}}}return S};B.matches=function(R,S){return B(R,null,null,S)};B.find=function(Y,R,Z){var X,V;if(!Y){return[]}for(var U=0,T=E.order.length;U<T;U++){var W=E.order[U],V;if((V=E.leftMatch[W].exec(Y))){var S=V[1];V.splice(1,1);if(S.substr(S.length-1)!=="\\"){V[1]=(V[1]||"").replace(/\\/g,"");X=E.find[W](V,R,Z);if(X!=null){Y=Y.replace(E.match[W],"");break}}}}if(!X){X=R.getElementsByTagName("*")}return{set:X,expr:Y}};B.filter=function(c,b,f,U){var T=c,h=[],Y=b,W,R,X=b&&b[0]&&O(b[0]);while(c&&b.length){for(var Z in E.filter){if((W=E.match[Z].exec(c))!=null){var S=E.filter[Z],g,e;R=false;if(Y==h){h=[]}if(E.preFilter[Z]){W=E.preFilter[Z](W,Y,f,h,U,X);if(!W){R=g=true}else{if(W===true){continue}}}if(W){for(var V=0;(e=Y[V])!=null;V++){if(e){g=S(e,W,V,Y);var d=U^!!g;if(f&&g!=null){if(d){R=true}else{Y[V]=false}}else{if(d){h.push(e);R=true}}}}}if(g!==undefined){if(!f){Y=h}c=c.replace(E.match[Z],"");if(!R){return[]}break}}}if(c==T){if(R==null){throw"Syntax error, unrecognized expression: "+c}else{break}}T=c}return Y};var E=B.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(R){return R.getAttribute("href")}},relative:{"+":function(Y,R,X){var V=typeof R==="string",Z=V&&!/\W/.test(R),W=V&&!Z;if(Z&&!X){R=R.toUpperCase()}for(var U=0,T=Y.length,S;U<T;U++){if((S=Y[U])){while((S=S.previousSibling)&&S.nodeType!==1){}Y[U]=W||S&&S.nodeName===R?S||false:S===R}}if(W){B.filter(R,Y,true)}},">":function(X,S,Y){var V=typeof S==="string";if(V&&!/\W/.test(S)){S=Y?S:S.toUpperCase();for(var T=0,R=X.length;T<R;T++){var W=X[T];if(W){var U=W.parentNode;X[T]=U.nodeName===S?U:false}}}else{for(var T=0,R=X.length;T<R;T++){var W=X[T];if(W){X[T]=V?W.parentNode:W.parentNode===S}}if(V){B.filter(S,X,true)}}},"":function(U,S,W){var T=I++,R=Q;if(!/\W/.test(S)){var V=S=W?S:S.toUpperCase();R=M}R("parentNode",S,T,U,V,W)},"~":function(U,S,W){var T=I++,R=Q;if(typeof S==="string"&&!/\W/.test(S)){var V=S=W?S:S.toUpperCase();R=M}R("previousSibling",S,T,U,V,W)}},find:{ID:function(S,T,U){if(typeof T.getElementById!=="undefined"&&!U){var R=T.getElementById(S[1]);return R?[R]:[]}},NAME:function(T,W,X){if(typeof W.getElementsByName!=="undefined"){var S=[],V=W.getElementsByName(T[1]);for(var U=0,R=V.length;U<R;U++){if(V[U].getAttribute("name")===T[1]){S.push(V[U])}}return S.length===0?null:S}},TAG:function(R,S){return S.getElementsByTagName(R[1])}},preFilter:{CLASS:function(U,S,T,R,X,Y){U=" "+U[1].replace(/\\/g,"")+" ";if(Y){return U}for(var V=0,W;(W=S[V])!=null;V++){if(W){if(X^(W.className&&(" "+W.className+" ").indexOf(U)>=0)){if(!T){R.push(W)}}else{if(T){S[V]=false}}}}return false},ID:function(R){return R[1].replace(/\\/g,"")},TAG:function(S,R){for(var T=0;R[T]===false;T++){}return R[T]&&O(R[T])?S[1]:S[1].toUpperCase()},CHILD:function(R){if(R[1]=="nth"){var S=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(R[2]=="even"&&"2n"||R[2]=="odd"&&"2n+1"||!/\D/.test(R[2])&&"0n+"+R[2]||R[2]);R[2]=(S[1]+(S[2]||1))-0;R[3]=S[3]-0}R[0]=I++;return R},ATTR:function(V,S,T,R,W,X){var U=V[1].replace(/\\/g,"");if(!X&&E.attrMap[U]){V[1]=E.attrMap[U]}if(V[2]==="~="){V[4]=" "+V[4]+" "}return V},PSEUDO:function(V,S,T,R,W){if(V[1]==="not"){if((P.exec(V[3])||"").length>1||/^\w/.test(V[3])){V[3]=B(V[3],null,null,S)}else{var U=B.filter(V[3],S,T,true^W);if(!T){R.push.apply(R,U)}return false}}else{if(E.match.POS.test(V[0])||E.match.CHILD.test(V[0])){return true}}return V},POS:function(R){R.unshift(true);return R}},filters:{enabled:function(R){return R.disabled===false&&R.type!=="hidden"},disabled:function(R){return R.disabled===true},checked:function(R){return R.checked===true},selected:function(R){R.parentNode.selectedIndex;return R.selected===true},parent:function(R){return !!R.firstChild},empty:function(R){return !R.firstChild},has:function(T,S,R){return !!B(R[3],T).length},header:function(R){return/h\d/i.test(R.nodeName)},text:function(R){return"text"===R.type},radio:function(R){return"radio"===R.type},checkbox:function(R){return"checkbox"===R.type},file:function(R){return"file"===R.type},password:function(R){return"password"===R.type},submit:function(R){return"submit"===R.type},image:function(R){return"image"===R.type},reset:function(R){return"reset"===R.type},button:function(R){return"button"===R.type||R.nodeName.toUpperCase()==="BUTTON"},input:function(R){return/input|select|textarea|button/i.test(R.nodeName)}},setFilters:{first:function(S,R){return R===0},last:function(T,S,R,U){return S===U.length-1},even:function(S,R){return R%2===0},odd:function(S,R){return R%2===1},lt:function(T,S,R){return S<R[3]-0},gt:function(T,S,R){return S>R[3]-0},nth:function(T,S,R){return R[3]-0==S},eq:function(T,S,R){return R[3]-0==S}},filter:{PSEUDO:function(X,T,U,Y){var S=T[1],V=E.filters[S];if(V){return V(X,U,T,Y)}else{if(S==="contains"){return(X.textContent||X.innerText||"").indexOf(T[3])>=0}else{if(S==="not"){var W=T[3];for(var U=0,R=W.length;U<R;U++){if(W[U]===X){return false}}return true}}}},CHILD:function(R,U){var X=U[1],S=R;switch(X){case"only":case"first":while((S=S.previousSibling)){if(S.nodeType===1){return false}}if(X=="first"){return true}S=R;case"last":while((S=S.nextSibling)){if(S.nodeType===1){return false}}return true;case"nth":var T=U[2],b=U[3];if(T==1&&b==0){return true}var W=U[0],Z=R.parentNode;if(Z&&(Z.sizcache!==W||!R.nodeIndex)){var V=0;for(S=Z.firstChild;S;S=S.nextSibling){if(S.nodeType===1){S.nodeIndex=++V}}Z.sizcache=W}var Y=R.nodeIndex-b;if(T==0){return Y==0}else{return(Y%T==0&&Y/T>=0)}}},ID:function(S,R){return S.nodeType===1&&S.getAttribute("id")===R},TAG:function(S,R){return(R==="*"&&S.nodeType===1)||S.nodeName===R},CLASS:function(S,R){return(" "+(S.className||S.getAttribute("class"))+" ").indexOf(R)>-1},ATTR:function(W,U){var T=U[1],R=E.attrHandle[T]?E.attrHandle[T](W):W[T]!=null?W[T]:W.getAttribute(T),X=R+"",V=U[2],S=U[4];return R==null?V==="!=":V==="="?X===S:V==="*="?X.indexOf(S)>=0:V==="~="?(" "+X+" ").indexOf(S)>=0:!S?X&&R!==false:V==="!="?X!=S:V==="^="?X.indexOf(S)===0:V==="$="?X.substr(X.length-S.length)===S:V==="|="?X===S||X.substr(0,S.length+1)===S+"-":false},POS:function(V,S,T,W){var R=S[2],U=E.setFilters[R];if(U){return U(V,T,S,W)}}}};var J=E.match.POS;for(var L in E.match){E.match[L]=new RegExp(E.match[L].source+/(?![^\[]*\])(?![^\(]*\))/.source);E.leftMatch[L]=new RegExp(/(^(?:.|\r|\n)*?)/.source+E.match[L].source)}var A=function(S,R){S=Array.prototype.slice.call(S,0);if(R){R.push.apply(R,S);return R}return S};try{Array.prototype.slice.call(document.documentElement.childNodes,0)}catch(K){A=function(V,U){var S=U||[];if(D.call(V)==="[object Array]"){Array.prototype.push.apply(S,V)}else{if(typeof V.length==="number"){for(var T=0,R=V.length;T<R;T++){S.push(V[T])}}else{for(var T=0;V[T];T++){S.push(V[T])}}}return S}}var C;if(document.documentElement.compareDocumentPosition){C=function(S,R){if(!S.compareDocumentPosition||!R.compareDocumentPosition){if(S==R){N=true}return 0}var T=S.compareDocumentPosition(R)&4?-1:S===R?0:1;if(T===0){N=true}return T}}else{if("sourceIndex" in document.documentElement){C=function(S,R){if(!S.sourceIndex||!R.sourceIndex){if(S==R){N=true}return 0}var T=S.sourceIndex-R.sourceIndex;if(T===0){N=true}return T}}else{if(document.createRange){C=function(U,S){if(!U.ownerDocument||!S.ownerDocument){if(U==S){N=true}return 0}var T=U.ownerDocument.createRange(),R=S.ownerDocument.createRange();T.setStart(U,0);T.setEnd(U,0);R.setStart(S,0);R.setEnd(S,0);var V=T.compareBoundaryPoints(Range.START_TO_END,R);if(V===0){N=true}return V}}}}(function(){var S=document.createElement("div"),T="script"+(new Date).getTime();S.innerHTML="<a name='"+T+"'/>";var R=document.documentElement;R.insertBefore(S,R.firstChild);if(!!document.getElementById(T)){E.find.ID=function(V,W,X){if(typeof W.getElementById!=="undefined"&&!X){var U=W.getElementById(V[1]);return U?U.id===V[1]||typeof U.getAttributeNode!=="undefined"&&U.getAttributeNode("id").nodeValue===V[1]?[U]:undefined:[]}};E.filter.ID=function(W,U){var V=typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id");return W.nodeType===1&&V&&V.nodeValue===U}}R.removeChild(S);R=S=null})();(function(){var R=document.createElement("div");R.appendChild(document.createComment(""));if(R.getElementsByTagName("*").length>0){E.find.TAG=function(S,W){var V=W.getElementsByTagName(S[1]);if(S[1]==="*"){var U=[];for(var T=0;V[T];T++){if(V[T].nodeType===1){U.push(V[T])}}V=U}return V}}R.innerHTML="<a href='#'></a>";if(R.firstChild&&typeof R.firstChild.getAttribute!=="undefined"&&R.firstChild.getAttribute("href")!=="#"){E.attrHandle.href=function(S){return S.getAttribute("href",2)}}R=null})();if(document.querySelectorAll){(function(){var R=B,T=document.createElement("div");T.innerHTML="<p class='TEST'></p>";if(T.querySelectorAll&&T.querySelectorAll(".TEST").length===0){return }B=function(X,W,U,V){W=W||document;if(!V&&W.nodeType===9&&!O(W)){try{return A(W.querySelectorAll(X),U)}catch(Y){}}return R(X,W,U,V)};for(var S in R){B[S]=R[S]}T=null})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var R=document.createElement("div");R.innerHTML="<div class='test e'></div><div class='test'></div>";if(R.getElementsByClassName("e").length===0){return }R.lastChild.className="e";if(R.getElementsByClassName("e").length===1){return }E.order.splice(1,0,"CLASS");E.find.CLASS=function(S,T,U){if(typeof T.getElementsByClassName!=="undefined"&&!U){return T.getElementsByClassName(S[1])}};R=null})()}function M(S,X,W,c,Y,b){var Z=S=="previousSibling"&&!b;for(var U=0,T=c.length;U<T;U++){var R=c[U];if(R){if(Z&&R.nodeType===1){R.sizcache=W;R.sizset=U}R=R[S];var V=false;while(R){if(R.sizcache===W){V=c[R.sizset];break}if(R.nodeType===1&&!b){R.sizcache=W;R.sizset=U}if(R.nodeName===X){V=R;break}R=R[S]}c[U]=V}}}function Q(S,X,W,c,Y,b){var Z=S=="previousSibling"&&!b;for(var U=0,T=c.length;U<T;U++){var R=c[U];if(R){if(Z&&R.nodeType===1){R.sizcache=W;R.sizset=U}R=R[S];var V=false;while(R){if(R.sizcache===W){V=c[R.sizset];break}if(R.nodeType===1){if(!b){R.sizcache=W;R.sizset=U}if(typeof X!=="string"){if(R===X){V=true;break}}else{if(B.filter(X,[R]).length>0){V=R;break}}}R=R[S]}c[U]=V}}}var G=document.compareDocumentPosition?function(S,R){return S.compareDocumentPosition(R)&16}:function(S,R){return S!==R&&(S.contains?S.contains(R):true)};var O=function(R){return R.nodeType===9&&R.documentElement.nodeName!=="HTML"||!!R.ownerDocument&&R.ownerDocument.documentElement.nodeName!=="HTML"};var F=function(R,Y){var U=[],V="",W,T=Y.nodeType?[Y]:Y;while((W=E.match.PSEUDO.exec(R))){V+=W[0];R=R.replace(E.match.PSEUDO,"")}R=E.relative[R]?R+"*":R;for(var X=0,S=T.length;X<S;X++){B(R,T[X],U)}return B.filter(V,U)};window.Sizzle=B})();(function(C){var D=Prototype.Selector.extendElements;function A(E,F){return D(C(E,F||document))}function B(F,E){return C.matches(E,[F]).length==1}Prototype.Selector.engine=C;Prototype.Selector.select=A;Prototype.Selector.match=B})(Sizzle);window.Sizzle=Prototype._original_property;delete Prototype._original_property;var Form={reset:function(A){A=$(A);A.reset();return A},serializeElements:function(H,D){if(typeof D!="object"){D={hash:!!D}}else{if(Object.isUndefined(D.hash)){D.hash=true}}var E,G,A=false,F=D.submit,B,C;if(D.hash){C={};B=function(I,J,K){if(J in I){if(!Object.isArray(I[J])){I[J]=[I[J]]}I[J].push(K)}else{I[J]=K}return I}}else{C="";B=function(I,J,K){return I+(I?"&":"")+encodeURIComponent(J)+"="+encodeURIComponent(K)}}return H.inject(C,function(I,J){if(!J.disabled&&J.name){E=J.name;G=$(J).getValue();if(G!=null&&J.type!="file"&&(J.type!="submit"||(!A&&F!==false&&(!F||E==F)&&(A=true)))){I=B(I,E,G)}}return I})}};Form.Methods={serialize:function(B,A){return Form.serializeElements(Form.getElements(B),A)},getElements:function(E){var F=$(E).getElementsByTagName("*"),D,A=[],C=Form.Element.Serializers;for(var B=0;D=F[B];B++){A.push(D)}return A.inject([],function(G,H){if(C[H.tagName.toLowerCase()]){G.push(Element.extend(H))}return G})},getInputs:function(G,C,D){G=$(G);var A=G.getElementsByTagName("input");if(!C&&!D){return $A(A).map(Element.extend)}for(var E=0,H=[],F=A.length;E<F;E++){var B=A[E];if((C&&B.type!=C)||(D&&B.name!=D)){continue}H.push(Element.extend(B))}return H},disable:function(A){A=$(A);Form.getElements(A).invoke("disable");return A},enable:function(A){A=$(A);Form.getElements(A).invoke("enable");return A},findFirstElement:function(B){var C=$(B).getElements().findAll(function(D){return"hidden"!=D.type&&!D.disabled});var A=C.findAll(function(D){return D.hasAttribute("tabIndex")&&D.tabIndex>=0}).sortBy(function(D){return D.tabIndex}).first();return A?A:C.find(function(D){return/^(?:input|select|textarea)$/i.test(D.tagName)})},focusFirstElement:function(B){B=$(B);var A=B.findFirstElement();if(A){A.activate()}return B},request:function(B,A){B=$(B),A=Object.clone(A||{});var D=A.parameters,C=B.readAttribute("action")||"";if(C.blank()){C=window.location.href}A.parameters=B.serialize(true);if(D){if(Object.isString(D)){D=D.toQueryParams()}Object.extend(A.parameters,D)}if(B.hasAttribute("method")&&!A.method){A.method=B.method}return new Ajax.Request(C,A)}};Form.Element={focus:function(A){$(A).focus();return A},select:function(A){$(A).select();return A}};Form.Element.Methods={serialize:function(A){A=$(A);if(!A.disabled&&A.name){var B=A.getValue();if(B!=undefined){var C={};C[A.name]=B;return Object.toQueryString(C)}}return""},getValue:function(A){A=$(A);var B=A.tagName.toLowerCase();return Form.Element.Serializers[B](A)},setValue:function(A,B){A=$(A);var C=A.tagName.toLowerCase();Form.Element.Serializers[C](A,B);return A},clear:function(A){$(A).value="";return A},present:function(A){return $(A).value!=""},activate:function(A){A=$(A);try{A.focus();if(A.select&&(A.tagName.toLowerCase()!="input"||!(/^(?:button|reset|submit)$/i.test(A.type)))){A.select()}}catch(B){}return A},disable:function(A){A=$(A);A.disabled=true;return A},enable:function(A){A=$(A);A.disabled=false;return A}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers=(function(){function B(H,I){switch(H.type.toLowerCase()){case"checkbox":case"radio":return F(H,I);default:return E(H,I)}}function F(H,I){if(Object.isUndefined(I)){return H.checked?H.value:null}else{H.checked=!!I}}function E(H,I){if(Object.isUndefined(I)){return H.value}else{H.value=I}}function A(J,M){if(Object.isUndefined(M)){return(J.type==="select-one"?C:D)(J)}var I,K,N=!Object.isArray(M);for(var H=0,L=J.length;H<L;H++){I=J.options[H];K=this.optionValue(I);if(N){if(K==M){I.selected=true;return }}else{I.selected=M.include(K)}}}function C(I){var H=I.selectedIndex;return H>=0?G(I.options[H]):null}function D(K){var H,L=K.length;if(!L){return null}for(var J=0,H=[];J<L;J++){var I=K.options[J];if(I.selected){H.push(G(I))}}return H}function G(H){return Element.hasAttribute(H,"value")?H.value:H.text}return{input:B,inputSelector:F,textarea:E,select:A,selectOne:C,selectMany:D,optionValue:G,button:E}})();Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,A,B,C){$super(C,B);this.element=$(A);this.lastValue=this.getValue()},execute:function(){var A=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(A)?this.lastValue!=A:String(this.lastValue)!=String(A)){this.callback(this.element,A);this.lastValue=A}}});Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element)}});Abstract.EventObserver=Class.create({initialize:function(A,B){this.element=$(A);this.callback=B;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()}else{this.registerCallback(this.element)}},onElementEvent:function(){var A=this.getValue();if(this.lastValue!=A){this.callback(this.element,A);this.lastValue=A}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)},registerCallback:function(A){if(A.type){switch(A.type.toLowerCase()){case"checkbox":case"radio":Event.observe(A,"click",this.onElementEvent.bind(this));break;default:Event.observe(A,"change",this.onElementEvent.bind(this));break}}}});Form.Element.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element)}});(function(){var d={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,KEY_INSERT:45,cache:{}};var F=document.documentElement;var e="onmouseenter" in F&&"onmouseleave" in F;var A=function(f){return false};if(window.attachEvent){if(window.addEventListener){A=function(f){return !(f instanceof window.Event)}}else{A=function(f){return true}}}var R;function b(g,f){return g.which?(g.which===f+1):(g.button===f)}var O={0:1,1:4,2:2};function Y(g,f){return g.button===O[f]}function c(g,f){switch(f){case 0:return g.which==1&&!g.metaKey;case 1:return g.which==2||(g.which==1&&g.metaKey);case 2:return g.which==3;default:return false}}if(window.attachEvent){if(!window.addEventListener){R=Y}else{R=function(g,f){return A(g)?Y(g,f):b(g,f)}}}else{if(Prototype.Browser.WebKit){R=c}else{R=b}}function V(f){return R(f,0)}function T(f){return R(f,1)}function N(f){return R(f,2)}function D(h){h=d.extend(h);var g=h.target,f=h.type,j=h.currentTarget;if(j&&j.tagName){if(f==="load"||f==="error"||(f==="click"&&j.tagName.toLowerCase()==="input"&&j.type==="radio")){g=j}}if(g.nodeType==Node.TEXT_NODE){g=g.parentNode}return Element.extend(g)}function P(g,h){var f=d.element(g);if(!h){return f}while(f){if(Object.isElement(f)&&Prototype.Selector.match(f,h)){return Element.extend(f)}f=f.parentNode}}function S(f){return{x:C(f),y:B(f)}}function C(h){var g=document.documentElement,f=document.body||{scrollLeft:0};return h.pageX||(h.clientX+(g.scrollLeft||f.scrollLeft)-(g.clientLeft||0))}function B(h){var g=document.documentElement,f=document.body||{scrollTop:0};return h.pageY||(h.clientY+(g.scrollTop||f.scrollTop)-(g.clientTop||0))}function Q(f){d.extend(f);f.preventDefault();f.stopPropagation();f.stopped=true}d.Methods={isLeftClick:V,isMiddleClick:T,isRightClick:N,element:D,findElement:P,pointer:S,pointerX:C,pointerY:B,stop:Q};var X=Object.keys(d.Methods).inject({},function(f,g){f[g]=d.Methods[g].methodize();return f});if(window.attachEvent){function I(g){var f;switch(g.type){case"mouseover":case"mouseenter":f=g.fromElement;break;case"mouseout":case"mouseleave":f=g.toElement;break;default:return null}return Element.extend(f)}var U={stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}};d.extend=function(g,f){if(!g){return false}if(!A(g)){return g}if(g._extendedByPrototype){return g}g._extendedByPrototype=Prototype.emptyFunction;var h=d.pointer(g);Object.extend(g,{target:g.srcElement||f,relatedTarget:I(g),pageX:h.x,pageY:h.y});Object.extend(g,X);Object.extend(g,U);return g}}else{d.extend=Prototype.K}if(window.addEventListener){d.prototype=window.Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(d.prototype,X)}function M(k,j,l){var h=Element.retrieve(k,"prototype_event_registry");if(Object.isUndefined(h)){E.push(k);h=Element.retrieve(k,"prototype_event_registry",$H())}var f=h.get(j);if(Object.isUndefined(f)){f=[];h.set(j,f)}if(f.pluck("handler").include(l)){return false}var g;if(j.include(":")){g=function(m){if(Object.isUndefined(m.eventName)){return false}if(m.eventName!==j){return false}d.extend(m,k);l.call(k,m)}}else{if(!e&&(j==="mouseenter"||j==="mouseleave")){if(j==="mouseenter"||j==="mouseleave"){g=function(n){d.extend(n,k);var m=n.relatedTarget;while(m&&m!==k){try{m=m.parentNode}catch(o){m=k}}if(m===k){return }l.call(k,n)}}}else{g=function(m){d.extend(m,k);l.call(k,m)}}}g.handler=l;f.push(g);return g}function H(){for(var f=0,g=E.length;f<g;f++){d.stopObserving(E[f]);E[f]=null}}var E=[];if(Prototype.Browser.IE){window.attachEvent("onunload",H)}if(Prototype.Browser.WebKit){window.addEventListener("unload",Prototype.emptyFunction,false)}var L=Prototype.K,G={mouseenter:"mouseover",mouseleave:"mouseout"};if(!e){L=function(f){return(G[f]||f)}}function W(j,h,k){j=$(j);var g=M(j,h,k);if(!g){return j}if(h.include(":")){if(j.addEventListener){j.addEventListener("dataavailable",g,false)}else{j.attachEvent("ondataavailable",g);j.attachEvent("onlosecapture",g)}}else{var f=L(h);if(j.addEventListener){j.addEventListener(f,g,false)}else{j.attachEvent("on"+f,g)}}return j}function K(m,j,n){m=$(m);var h=Element.retrieve(m,"prototype_event_registry");if(!h){return m}if(!j){h.each(function(p){var o=p.key;K(m,o)});return m}var k=h.get(j);if(!k){return m}if(!n){k.each(function(o){K(m,j,o.handler)});return m}var l=k.length,g;while(l--){if(k[l].handler===n){g=k[l];break}}if(!g){return m}if(j.include(":")){if(m.removeEventListener){m.removeEventListener("dataavailable",g,false)}else{m.detachEvent("ondataavailable",g);m.detachEvent("onlosecapture",g)}}else{var f=L(j);if(m.removeEventListener){m.removeEventListener(f,g,false)}else{m.detachEvent("on"+f,g)}}h.set(j,k.without(g));return m}function Z(j,h,g,f){j=$(j);if(Object.isUndefined(f)){f=true}if(j==document&&document.createEvent&&!j.dispatchEvent){j=document.documentElement}var k;if(document.createEvent){k=document.createEvent("HTMLEvents");k.initEvent("dataavailable",f,true)}else{k=document.createEventObject();k.eventType=f?"ondataavailable":"onlosecapture"}k.eventName=h;k.memo=g||{};if(document.createEvent){j.dispatchEvent(k)}else{j.fireEvent(k.eventType,k)}return d.extend(k)}d.Handler=Class.create({initialize:function(h,g,f,j){this.element=$(h);this.eventName=g;this.selector=f;this.callback=j;this.handler=this.handleEvent.bind(this)},start:function(){d.observe(this.element,this.eventName,this.handler);return this},stop:function(){d.stopObserving(this.element,this.eventName,this.handler);return this},handleEvent:function(g){var f=d.findElement(g,this.selector);if(f){this.callback.call(this.element,g,f)}}});function J(h,g,f,j){h=$(h);if(Object.isFunction(f)&&Object.isUndefined(j)){j=f,f=null}return new d.Handler(h,g,f,j).start()}Object.extend(d,d.Methods);Object.extend(d,{fire:Z,observe:W,stopObserving:K,on:J});Element.addMethods({fire:Z,observe:W,stopObserving:K,on:J});Object.extend(document,{fire:Z.methodize(),observe:W.methodize(),stopObserving:K.methodize(),on:J.methodize(),loaded:false});if(window.Event){Object.extend(window.Event,d)}else{window.Event=d}})();(function(){var D;function A(){if(document.loaded){return }if(D){window.clearTimeout(D)}document.loaded=true;document.fire("dom:loaded")}function C(){if(document.readyState==="complete"){document.stopObserving("readystatechange",C);A()}}function B(){try{document.documentElement.doScroll("left")}catch(E){D=B.defer();return }A()}if(document.addEventListener){document.addEventListener("DOMContentLoaded",A,false)}else{document.observe("readystatechange",C);if(window==top){D=B.defer()}}Event.observe(window,"load",A)})();Element.addMethods();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(A,B){return Element.insert(A,{before:B})},Top:function(A,B){return Element.insert(A,{top:B})},Bottom:function(A,B){return Element.insert(A,{bottom:B})},After:function(A,B){return Element.insert(A,{after:B})}};var $continue=new Error('"throw $continue" is deprecated, use "return" instead');var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},within:function(B,A,C){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(B,A,C)}this.xcomp=A;this.ycomp=C;this.offset=Element.cumulativeOffset(B);return(C>=this.offset[1]&&C<this.offset[1]+B.offsetHeight&&A>=this.offset[0]&&A<this.offset[0]+B.offsetWidth)},withinIncludingScrolloffsets:function(B,A,D){var C=Element.cumulativeScrollOffset(B);this.xcomp=A+C[0]-this.deltaX;this.ycomp=D+C[1]-this.deltaY;this.offset=Element.cumulativeOffset(B);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+B.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+B.offsetWidth)},overlap:function(B,A){if(!B){return 0}if(B=="vertical"){return((this.offset[1]+A.offsetHeight)-this.ycomp)/A.offsetHeight}if(B=="horizontal"){return((this.offset[0]+A.offsetWidth)-this.xcomp)/A.offsetWidth}},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(A){Position.prepare();return Element.absolutize(A)},relativize:function(A){Position.prepare();return Element.relativize(A)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(B,C,A){A=A||{};return Element.clonePosition(C,B,A)}};if(!document.getElementsByClassName){document.getElementsByClassName=function(B){function A(C){return C.blank()?null:"[contains(concat(' ', @class, ' '), ' "+C+" ')]"}B.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(C,E){E=E.toString().strip();var D=/\s/.test(E)?$w(E).map(A).join(""):A(E);return D?document._getElementsByXPath(".//*"+D,C):[]}:function(E,F){F=F.toString().strip();var G=[],H=(/\s/.test(F)?$w(F):null);if(!H&&!F){return G}var C=$(E).getElementsByTagName("*");F=" "+F+" ";for(var D=0,J,I;J=C[D];D++){if(J.className&&(I=" "+J.className+" ")&&(I.include(F)||(H&&H.all(function(K){return !K.toString().blank()&&I.include(" "+K+" ")})))){G.push(Element.extend(J))}}return G};return function(D,C){return $(C||document.body).getElementsByClassName(D)}}(Element.Methods)}Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(A){this.element=$(A)},_each:function(A){this.element.className.split(/\s+/).select(function(B){return B.length>0})._each(A)},set:function(A){this.element.className=A},add:function(A){if(this.include(A)){return }this.set($A(this).concat(A).join(" "))},remove:function(A){if(!this.include(A)){return }this.set($A(this).without(A).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);(function(){window.Selector=Class.create({initialize:function(A){this.expression=A.strip()},findElements:function(A){return Prototype.Selector.select(this.expression,A)},match:function(A){return Prototype.Selector.match(A,this.expression)},toString:function(){return this.expression},inspect:function(){return"#<Selector: "+this.expression+">"}});Object.extend(Selector,{matchElements:function(F,G){var A=Prototype.Selector.match,D=[];for(var C=0,E=F.length;C<E;C++){var B=F[C];if(A(B,G)){D.push(Element.extend(B))}}return D},findElement:function(F,G,B){B=B||0;var A=0,D;for(var C=0,E=F.length;C<E;C++){D=F[C];if(Prototype.Selector.match(D,G)&&B===A++){return Element.extend(D)}}},findChildElements:function(B,C){var A=C.toArray().join(", ");return Prototype.Selector.select(A,B||document)}})})();var ttBox=null;function initToolTip(){if(ttBox){return }var A=document.createElement("div");A.id="ttBox";A.style.position="absolute";A.style.color="#eeeeee";A.style.backgroundColor="#333333";A.style.padding="5px";A.style.border="1px solid #999999";A.style.display="block";document.getElementsByTagName("body").item(0).appendChild(A);ttBox=document.getElementById("ttBox")}function renderToolTip(A,B){initToolTip();if(!isInFront(ttBox)){bringToFront(ttBox)}setInnerHtml("ttBox",A);if(is_ie6||typeof (B)=="undefined"){ttBox.style.width=(typeof (B)=="undefined")?"auto":B+"px"}else{ttBox.style.maxWidth=B+"px"}ttBox.style.display="block"}function showToolTip(C,A,B){if(window.event){C=window.event}renderToolTip(A,B);updateToolTip(C)}function showToolTipXY(A,D,B,C){renderToolTip(B,C);updateToolTipXY(A,D)}function updateToolTip(B){if(!ttBox){return }if(window.event){B=window.event}var A=pageScroll();updateToolTipXY((A.left+B.clientX+10),(A.top+B.clientY+10))}function updateToolTipXY(A,B){ttBox.style.left=A+"px";ttBox.style.top=B+"px"}function hideToolTip(){if(!ttBox){return }ttBox.style.display="none"}function cipherEncrypt(E,D,A){var B=cipherMakeBigInteger(A);var C=B.modPow(D,E);return C.toString(16)}function cipherMakeBigInteger(C){var B=BigInteger.ZERO;for(var A=0;A<C.length;A++){B=B.shiftLeft(16).add(new BigInteger(""+C.charCodeAt(A),10))}return B}var topz=1000;function bringToFront(A){if(typeof (A.style)=="undefined"){A=document.getElementById(A)}A.style.zIndex=++topz}function isInFront(A){if(typeof (A.style)=="undefined"){A=document.getElementById(A)}return(A.style.zIndex==topz)}var MonkeyDialog={init:false,mdBg:null,mdBox:null,mdPane:null,closer:'<div style="float:right; font-size:10.0pt; line-height:14px; border:1px solid silver; color:gray; padding:0px 5px 3px 5px; margin:0px 0px 5px 5px; cursor:pointer" onclick="MonkeyDialog.hide()">x</div>',buf:'<div style="height:1px"></div>',initialize:function(){var A=document.createElement("div");A.style.display="none";A.style.position="fixed";A.style.top="0px";A.style.left="0px";A.style.width="100%";A.style.height="100%";A.style.backgroundColor="#dee4ec";A.style.zIndex=1000;A.style.opacity=0.85;A.style.MozOpacity=0.85;A.style.KhtmlOpacity=0.85;A.style.filter="alpha(opacity=85)";var B=document.createElement("div");B.style.display="none";B.style.position="fixed";B.style.top="50%";B.style.left="50%";B.style.marginLeft="-200px";B.style.marginTop="-200px";B.style.width="400px";B.style.height="400px";B.style.zIndex=1001;document.body.appendChild(A);document.body.appendChild(B);B.innerHTML='<div class="pane" style="width:100%"><div class="top"><div class="left"><div class="right"></div></div></div><div class="middle"><div id="mdContent" class="content" style="padding:0px 16px"></div></div><div class="bottom"><div class="left"><div class="right"></div></div></div></div>';this.mdBg=A;this.mdBox=B;this.mdPane=de("mdContent");this.init=true},show:function(B,A){if(!this.init){this.initialize()}if(!A){A=[]}if(typeof (A.width)=="undefined"){A.width=400}if(typeof (A.close)=="undefined"){A.close=true}this.mdBox.style.width=A.width+"px";this.mdBox.style.marginLeft="-"+parseInt(A.width/2)+"px";this.mdPane.innerHTML=(A.close?this.closer:"")+this.buf+B+this.buf;this.mdBg.style.display="block";this.mdBox.style.display="block";var C=elementDimensions(this.mdPane);this.mdBox.style.marginTop="-"+(parseInt(C.height/2)+10)+"px"},hide:function(){if(!this.init){this.initialize()}this.mdBg.style.display="none";this.mdBox.style.display="none"}};var DEFAULT_TIMEOUT=0;var callPrefix="";var callSuffix="";function setCallPrefix(A){callPrefix=A}function setCallSuffix(A){callSuffix=A}function prependAjaxPrefix(A){if(A.substr(0,callPrefix.length)!=callPrefix){return((typeof (callPrefix)=="undefined")?"":callPrefix)+A}else{return A}}function appendAjaxSuffix(A){return A+((typeof (callSuffix)=="undefined")?"":callSuffix)}function addAjaxPrefixSuffix(A){return appendAjaxSuffix(prependAjaxPrefix(A))}function smartCallXML(url,args,responder,timeout){if(args==null){args=""}if(typeof (timeout)=="undefined"){timeout=DEFAULT_TIMEOUT}var readyfunc=function(ajax){var xml=ajax.responseXML;var response=xml.documentElement;var preJs,xml,postJs;if(!nh(response,"preJs")){if(nh(response,"data")){xml=tag(response,"data")[0]}responder(xml)}else{preJs=nvn(response,"preJs");xml=tag(response,"data")[0];postJs=nvn(response,"postJs");eval(preJs);responder(xml);eval(postJs)}};url=addAjaxPrefixSuffix(url);(function(){new Ajax.Request(url,{method:"post",onSuccess:readyfunc,onFailure:readyfunc,parameters:args,query:{type:"smart",url:url,args:args,responder:responder,timeout:timeout}})})()}function smartCall(C,B,A,D){smartCallXML(C,B,function(E){var F=nodeValue(E);A(F)},D)}function ajaxCall(url,args,responder,timeout){if(args==null){args=""}if(typeof (timeout)=="undefined"){timeout=DEFAULT_TIMEOUT}var readyfunc=function(ajax){var text=ajax.responseText;var tag=text.indexOf("~!~.$");while(tag>=0&&text.length>(tag+5)){var nexttag=text.substring(tag+1).indexOf("~!~.$");if(nexttag<0){break}tag+=nexttag+1}var html;var js;if(tag>=0){html=text.substring(0,tag)}else{html=text}if(tag>=0&&text.length>(tag+5)){js=text.substring(tag+5)}else{js=""}responder(html);eval(js)};url=addAjaxPrefixSuffix(url);(function(){new Ajax.Request(url,{method:"post",onSuccess:readyfunc,parameters:args,query:{type:"normal",url:url,args:args,responder:responder,timeout:timeout}})})()}function ajaxDebug(D,A){var C=de("debugpane");if(!C){return }var B=de("debugpane"+D);if(!B){B=document.createElement("div");B.id="debugpane"+D;C.appendChild(B);B.innerHTML="<b>"+D+"</b>"}B.innerHTML+=", "+A}function callIsStuck(A){switch(A.readyState){case 1:return true;default:return false}}function callInProgress(A){switch(A.readyState){case 1:case 2:case 3:return true;default:return false}}function showAbortMessage(A){ajaxDebug(A,"There was a momentary network failure. Please try again.")}function showTimeoutMessage(A){ajaxDebug(A,"The request has timed out. Please try again.")}function doFacebookLogin(){setLoginMsg("Authenticating...");var B=de("facebookrememberme");var C=(B.checked)?true:false;var A=(C?"rememberme=true":"");smartCallXML("/facebook/connect/login",A,function(G){var I=(G.getElementsByTagName("success").length>0);if(I){var J=location.href.match("register")!=null;if(J){window.location.href=callPrefix+"/"}else{window.location.reload(true)}}else{var H=nh(G,"register");if(H){var F=prependAjaxPrefix("/register?");var E=(nh(G,"fbuid")?nvn(G,"fbuid"):-1);var D="fbreg=true&regfbuid="+E;window.location.href=F+D}else{loginError()}}})}function doFacebookLink(){FB.Connect.showPermissionDialog("offline_access,publish_stream",function(E){var D=location.href.match("register")!=null;var A=location.href.match("login")!=null;if(!D&&!A){var C="";var B="/facebook/connect/login";smartCallXML(B,C,function(J){var M=(J.getElementsByTagName("success").length>0);if(M){setLinkedAccountHtml();flashNotice("Successfully linked your Facebook account.")}else{var L=nh(J,"register");var F=nh(J,"error");if(L){B=prependAjaxPrefix("/register?");var I="fbreg=true";window.location.href=B+I}else{if(F){var H=tag(J,"error");var G=new StringBuffer();for(var K=0;K<H.length;K++){G.a(nodeValue(tag(J,"error")[K])+"<br/>")}flashError("Unable to link your Facebook account. Please try again")}else{loginError()}}}})}})}function doFacebookLogout(){loginCall("action=logout",function(A){FB.Connect.logout(function(B){setTimeout("window.location.reload(true)",50)})})}function loginError(){flashError("Unable to Connect to your Facebook account. Please try again.")}function doFacebookUnlink(){FB.Connect.ifUserConnected(prependAjaxPrefix("/facebook/connect/unlink?back=")+window.location.href,function(){flashNotice("Your Facebook account cannot be disconnected unless you are currently logged into Facebook")});setLinkedAccountHtml()}function createCookie(C,D,E){if(E){var B=new Date();B.setTime(B.getTime()+(E*24*60*60*1000));var A="; expires="+B.toGMTString()}else{var A=""}document.cookie=C+"="+D+A+"; path=/"}function readCookie(B){var D=B+"=";var A=document.cookie.split(";");for(var C=0;C<A.length;C++){var E=A[C];while(E.charAt(0)==" "){E=E.substring(1,E.length)}if(E.indexOf(D)==0){return E.substring(D.length,E.length)}}return null}function eraseCookie(A){createCookie(A,"",-1)}function initDefault(){if(typeof flashTimeout=="undefined"){flashTimeout=3000}var C=de("ferror");var A=de("fnotice");if(C&&parseBoolean(C.value)){Effect.BlindDown("mwu-flasherror",{duration:0.75});setTimeout("Effect.BlindUp('mwu-flasherror', {duration: 0.75})",flashTimeout)}else{if(A&&parseBoolean(A.value)){Effect.BlindDown("mwu-flashnotice",{duration:0.75});setTimeout("Effect.BlindUp('mwu-flashnotice', {duration: 0.75})",flashTimeout)}}var B=readCookie("login-opt");if(B!=null){showLoginOption(B)}}function fadeElement(C,A){var B=de(C);if(B!=null&&B.style.display!="none"){setTimeout(function(){B.fade()},A)}}function switchHeaderLoginView(A){if(de("headerloginlinks")&&de("headerloginuser")){de("headerloginlinks").style.display="none";de("headerloginuser").style.display="none";if(A=="links"){de("headerloginlinks").style.display="block"}}}function loginCall(A,B){smartCallXML("/LoginQuery",A,function(D){var F=nvn(D,"cmod");var E=nvn(D,"ckey");setCipherKey(F,E);if(nh(D,"fblogout")){var C=nvn(D,"fblogout");if(C){FB.Connect.logout(function(G){})}}if(B){B(D)}})}function setUserPane(A){setInnerHtml("userpane",A)}function toggleRememberMe(){var A=de("loginrememberme");A.checked=(A.checked)?false:true}function doLogin(B){console.log("global: doLogin()");var D=de("loginname");var G=de("loginpass");var E=de("loginrememberme");var A=D.value;var C=G.value;var F=(E&&E.checked)?true:false;if(A.length<1||C.length<1){setLoginMsg("Hello.");return }(function(I,L,H,M){var N=function(Q){if(nh(Q,"msg")){setLoginMsg(nvn(Q,"msg"))}else{if(M){if(de("oauth_name")!=null&&de("oauth_name").value.length>0){var P=de("oauth_name").value;var R=de("oauth_token").value;var O=de("oauth_callback").value;M=M+"?oauth_name="+P+"&oauth_token="+R+"&oauth_callback="+O}parent.window.location.href=M}else{parent.window.location=parent.window.location;parent.window.location.reload(false)}}};setLoginMsg("Authenticating...");if(cipherModulus==null||cipherKey==null){var K="action=key";loginCall(K,function(P){var O="action=login&username="+encodeURIComponent(I)+"&password="+encodeURIComponent(cipherEncrypt(cipherModulus,cipherKey,L))+"&rememberme="+H;loginCall(O,N)})}else{var J="action=login&username="+encodeURIComponent(I)+"&password="+encodeURIComponent(cipherEncrypt(cipherModulus,cipherKey,L))+"&rememberme="+H;loginCall(J,N)}})(A,C,F,B?B:null)}function doLogout(){loginCall("action=logout",function(A){window.location.reload(false)})}function doStreetbrewLogin(){$("mwu-sbname").setStyle({"borderColor":""});$("mwu-sbpass").setStyle({"borderColor":""});session.loginPaneMapwithusName.value=$("mwu-sbname").value.trim();session.loginPaneMapwithusPass.value=$("mwu-sbpass").value.trim();if(session.loginPaneMapwithusName.value.length==0){$("mwu-sbname").setStyle({"borderColor":"red"}).focus();return }if(session.loginPaneMapwithusPass.value.length==0){$("mwu-sbpass").setStyle({"borderColor":"red"}).focus();return }session.doLogin()}function doOpenidLogin(){var F=de("mwu-openidurl").value;var G=de("openidrememberme");var H=(G&&G.checked)?true:false;if(F.length<1){setLoginMsg("Hello.");return }setLoginMsg("Authenticating...");var E=location.href.substr(10);var C=E.indexOf("/");var D=E.substr(C);var B=prependAjaxPrefix("/openid/redirect?");var A="openid="+encodeURIComponent(F)+"&next="+D+(H?"&rememberme=true":"");window.location.href=B+A}function doGoogleLogin(){setLoginMsg("Authenticating...");var E=location.href.substr(10);var C=E.indexOf("/");var D=E.substr(C);var B=prependAjaxPrefix("/openid/redirect?");var F=de("openidrememberme");var G=(F&&F.checked)?true:false;var A="openid="+encodeURIComponent("https://www.google.com/accounts/o8/id")+"&next="+D+(G?"&rememberme=true":"");window.location.href=B+A}var networkTwitter=3;function doTwitterLogin(){var A=false;setLoginMsg("Authenticating...");window.location.href=prependAjaxPrefix("/oauth/linker?networkid="+networkTwitter+(A?"&rememberme=true":""))}var cipherModulus=null;var cipherKey=null;function setCipherKey(A,B){cipherModulus=new BigInteger(A,16);cipherKey=new BigInteger(B,16)}function clearLoginForm(){de("loginname").value="";de("loginpass").value=""}var loginMsgTimeout=null;function setLoginMsg(A){setInnerHtml("mwu-loginmsgpane",A);if(loginMsgTimeout!=null){clearTimeout(loginMsgTimeout)}if(A.length>0){loginMsgTimeout=setTimeout(function(){loginMsgTimeout=null;setLoginMsg("")},5000)}}function commentLogin(){window.scroll(0,0);switchLoginView("fields")}function flashNotice(A){if(typeof flashTimeout=="undefined"){flashTimeout=3000}$("mwu-flashnoticemsg").innerHTML=A;Effect.BlindDown("mwu-flashnotice",{duration:0.75});setTimeout("Effect.BlindUp('mwu-flashnotice', {duration: 0.75})",flashTimeout)}function flashError(A){if(typeof flashTimeout=="undefined"){flashTimeout=3000}$("mwu-flasherrormsg").innerHTML=A;Effect.BlindDown("mwu-flasherror",{duration:0.75});setTimeout("Effect.BlindUp('mwu-flasherror', {duration: 0.75})",flashTimeout)}function createNewMap(B){if(sessionClientid==null){setLoginMsg("Sorry, you must be logged in to create new maps.");showLoginPane();return }if(B=="group"){alert("Not yet supported.");return }var A="action=create";smartCallXML("/maps",A,function(){})}function createNewMapPanel(B){if(sessionClientid==null){setLoginMsg("Sorry, you must be logged in to create new maps.");showLoginPane();return }MonkeyDialog.show('<div class="md_notice">Please wait while your map is being created...</div>');var A="action=create";A+="&title="+B;smartCallXML("/maps",A,function(){})}function alertOverLimit(){MonkeyDialog.show('<div class="md_notice" style="font-size:12.0pt">Sorry, you have exceeded your storage limit and will not be able to upload any more content to MapWith.Us. Please delete some of your stored content or <a href="/profile/account">upgrade</a> to a Professional account.</div>')}function jumpToProfile(A){if(A!=null){location.href="/profile/"+A}else{setLoginMsg("Login or create an account to view your profile.");showLoginPane()}}function jumpToMaps(){location.href="/"}function wheelevent(A){if(!A){A=window.event}if(A.preventDefault){A.preventDefault()}A.returnValue=false}var selectAMapValid=false;var selectAMapLastMC={x:0,y:0};function selectAMap(E,B){if(window.event){E=window.event}var C=de("selectamap");if(!C){C=document.createElement("div");C.id="selectamap";C.style.display="none";C.style.position="absolute";C.style.width="200px";C.style.textAlign="left";C.style.border="1px solid #7fb366";C.style.backgroundColor="#f7faf5";C.style.padding="5px";C.style.maxHeight="300px";C.style.overflowY="auto";C.style.zIndex=5;document.body.appendChild(C)}var D=mouseCoords(E);var A=(C.style.display=="block")?true:false;if(!A||(Math.abs(D.x-selectAMapLastMC.x)>50||Math.abs(D.y-selectAMapLastMC.y)>50)){C.style.left=((D.x-100)>0?(D.x-100):0)+"px";C.style.display="block";if(!selectAMapValid){setInnerHtml("selectamap",'<p class="sselectsection">Loading your maps...</p>');ajaxCall("/SelectAMap","",function(F){setInnerHtml("selectamap",F);selectAMapValid=true;var G=elementDimensions(C);C.style.top=B?(D.y-(G.height+10))+"px":(D.y+10)+"px"})}}else{C.style.display="none"}selectAMapLastMC=D}function mapdialogclose(){de("mapdialogprompt").style.height=0;de("mapdialogprompt").style.visibility="hidden";mapdialogvisible=false;return }var mapdialogvisible=false;function showMapCreationDialog(){if(!mapdialogvisible){de("mapdialogprompt").style.height="auto";de("mapdialogprompt").style.visibility="visible";mapdialogvisible=true}else{mapdialogclose()}}function selectAMapPanel(){ajaxCall("/SelectAMap","",function(A){setInnerHtml("editmapsbody",A);selectAMapValid=true;var B=elementDimensions(selectPane);selectPane.style.top=isTabOne?(mc.y-(B.height+10))+"px":(mc.y+10)+"px"})}function invalidateSelectAMap(){selectAMapValid=false;var A=de("selectamap");if(A){A.style.display="none";setInnerHtml("selectamap","")}}var withinBoxValid=false;var withinBoxLastMC={x:0,y:0};function toggleWithinBox(F,A){if(window.event){F=window.event}var C=de("within");if(!C){C=document.createElement("div");C.id="within";C.style.display="none";C.style.position="absolute";C.style.width="75px";C.style.textAlign="left";C.style.padding="5px";C.style.border="1px solid #7fb366";C.style.backgroundColor="#f7faf5";if(A){C.style.border="1px solid #8199c1";C.style.backgroundColor="#f5f7fb"}document.body.appendChild(C)}var E=mouseCoords(F);var D=(C.style.display=="block")?true:false;if(!D||(Math.abs(E.x-withinBoxLastMC.x)>50||Math.abs(E.y-withinBoxLastMC.y)>50)){C.style.top=(E.y+10)+"px";C.style.left=((E.x-36)>0?(E.x-36):0)+"px";C.style.display="block";if(!withinBoxValid){var B='<div style="margin-left: 5px; line-height: 20px;">';if(A){B+='<a href="#" onclick="setActiveAge(\'1 day\', true); return false" onmouseover="window.status=\'\'; return true">1 day</a><br/>';B+='<a href="#" onclick="setActiveAge(\'1 week\', true); return false" onmouseover="window.status=\'\'; return true">1 week</a><br/>';B+='<a href="#" onclick="setActiveAge(\'1 month\', true); return false" onmouseover="window.status=\'\'; return true">1 month</a><br/>';B+='<a href="#" onclick="setActiveAge(\'1 year\', true); return false" onmouseover="window.status=\'\'; return true">1 year</a><br/>';B+='<a href="#" onclick="setActiveAge(\'all maps\', true); return false" onmouseover="window.status=\'\'; return true">all maps</a>'}else{B+='<a href="#" onclick="setItemAge(86400, true); return false" onmouseover="window.status=\'\'; return true">1 day</a><br/>';B+='<a href="#" onclick="setItemAge(604800, true); return false" onmouseover="window.status=\'\'; return true">1 week</a><br/>';B+='<a href="#" onclick="setItemAge(2592000, true); return false" onmouseover="window.status=\'\'; return true">1 month</a><br/>';B+='<a href="#" onclick="setItemAge(31536000, true); return false" onmouseover="window.status=\'\'; return true">1 year</a><br/>';B+='<a href="#" onclick="setItemAge(0, true); return false" onmouseover="window.status=\'\'; return true">all items</a>'}B+="</div>";setInnerHtml("within",B);withinBoxValid=true}}else{C.style.display="none"}withinBoxLastMC=E}function invalidateWithinBox(){withinBoxValid=false;var A=de("within");if(A){A.style.display="none";setInnerHtml("within","")}}var showBoxValid=false;var showBoxLastMC={x:0,y:0};function toggleShowBox(F,A){if(window.event){F=window.event}var C=de("show");if(!C){C=document.createElement("div");C.id="show";C.style.display="none";C.style.position="absolute";C.style.width="85px";C.style.textAlign="left";C.style.padding="5px";C.style.border="1px solid #7fb366";C.style.backgroundColor="#f7faf5";if(A){C.style.border="1px solid #8199c1";C.style.backgroundColor="#f5f7fb"}document.body.appendChild(C)}var E=mouseCoords(F);var D=(C.style.display=="block")?true:false;if(!D||(Math.abs(E.x-showBoxLastMC.x)>50||Math.abs(E.y-showBoxLastMC.y)>50)){C.style.top=(E.y+10)+"px";C.style.left=((E.x-41)>0?(E.x-41):0)+"px";C.style.display="block";if(!showBoxValid){var B='<div style="margin-left: 5px; line-height: 20px;">';if(A){B+='<a href="#" onclick="setLimit(\'10 results\', 10, true); return false" onmouseover="window.status=\'\'; return true">10 results</a><br/>';B+='<a href="#" onclick="setLimit(\'25 results\', 25, true); return false" onmouseover="window.status=\'\'; return true">25 results</a><br/>';B+='<a href="#" onclick="setLimit(\'50 results\', 50, true); return false" onmouseover="window.status=\'\'; return true">50 results</a>'}else{B+='<a href="#" onclick="setLimit(10, true); return false" onmouseover="window.status=\'\'; return true">10 items</a><br/>';B+='<a href="#" onclick="setLimit(20, true); return false" onmouseover="window.status=\'\'; return true">20 items</a><br/>';B+='<a href="#" onclick="setLimit(50, true); return false" onmouseover="window.status=\'\'; return true">50 items</a><br/>';B+='<a href="#" onclick="setLimit(100, true); return false" onmouseover="window.status=\'\'; return true">100 items</a>'}B+="</div>";setInnerHtml("show",B);showBoxValid=true}}else{C.style.display="none"}showBoxLastMC=E}function invalidateShowBox(){showBoxValid=false;var A=de("show");if(A){A.style.display="none";setInnerHtml("show","")}}function showLoginPane(A){if(A){setLoginMsg(A)}$("logincontainer").show();$("loginname").focus()}function closeLoginPane(){switchHeaderLoginView("links");$("logincontainer").hide()}function showLoginOption(A){if($("loginfields")==null){return }$$("div.mwu-loginoptionselected").each(function(B){B.removeClassName("mwu-loginoptionselected")});if($("loginfields")!=null){$("loginfields").hide()}$("openidfields").hide();$("facebookfields").hide();$("googlefields").hide();$("twitterfields").hide();if(A=="MapWith.Us"){$("mwu-mwuloginoption").addClassName("mwu-loginoptionselected");$("loginfields").show();$("loginname").focus()}else{if(A=="Streetbrew"){$("mwu-sbloginoption").addClassName("mwu-loginoptionselected");$("loginfields").show();$("mwu-sbname").focus()}else{if(A=="OpenID"){$("mwu-openidloginoption").addClassName("mwu-loginoptionselected");$("openidfields").show();$("mwu-openidurl").focus()}else{if(A=="Facebook"){$("mwu-fbloginoption").addClassName("mwu-loginoptionselected");$("facebookfields").show()}else{if(A=="Google"){$("mwu-googleloginoption").addClassName("mwu-loginoptionselected");$("googlefields").show()}else{if(A=="Twitter"){$("mwu-twitterloginoption").addClassName("mwu-loginoptionselected");$("twitterfields").show()}}}}}}createCookie("login-opt",A,365)}function setFBLoginCell(){var B=FB.Connect.get_loggedInUser();var A='<fb:name uid="'+B+'"></fb:name>';var C='Signed in as <a href="/profile/" class="lb big">'+A+"</a>";C+='&nbsp;&nbsp;<fb:profile-pic uid="'+B+'" linked="true" facebook-logo="true"></fb:profile-pic>'}var WIDGET_ACTIVE_USERS=0;var WIDGET_FEATURED_MAPS=1;var WIDGET_UPDATED_MAPS=2;function initMyPage(){initDefault();Sortable.create("widgetsleft",{dropOnEmpty:true,containment:["widgetsleft","widgetsmiddle","widgetsright"],tag:"div",constraint:false,onUpdate:function(){if(sessionClientid==null){return }var A="a=order";A+="&col=0";A+="&"+Sortable.serialize("widgetsleft");smartCallXML("/widget",A,function(B){});updateWidgetMinHeight()}});Sortable.create("widgetsmiddle",{dropOnEmpty:true,containment:["widgetsleft","widgetsmiddle","widgetsright"],tag:"div",constraint:false,onUpdate:function(){if(sessionClientid==null){return }var A="a=order";A+="&col=1";A+="&"+Sortable.serialize("widgetsmiddle");smartCallXML("/widget",A,function(B){});updateWidgetMinHeight()}});Sortable.create("widgetsright",{dropOnEmpty:true,containment:["widgetsleft","widgetsmiddle","widgetsright"],tag:"div",constraint:false,onUpdate:function(){if(sessionClientid==null){return }var A="a=order";A+="&col=2";A+="&"+Sortable.serialize("widgetsright");smartCallXML("/widget",A,function(B){});updateWidgetMinHeight()}});updateWidgetMinHeight()}function resetWidgetMinHeight(){$("widgetsleft").setStyle({minHeight:"400px"});$("widgetsmiddle").setStyle({minHeight:"400px"});$("widgetsright").setStyle({minHeight:"400px"})}function updateWidgetMinHeight(){resetWidgetMinHeight();var A=400;if($("wleftblock").getHeight()>A){A=$("wleftblock").getHeight()}if($("wmiddleblock").getHeight()>A){A=$("wmiddleblock").getHeight()}if($("wrightblock").getHeight()>A){A=$("wrightblock").getHeight()}$("widgetsleft").setStyle({minHeight:A+"px"});$("widgetsmiddle").setStyle({minHeight:A+"px"});$("widgetsright").setStyle({minHeight:A+"px"})}function installWidget(B,C){$("installbutton"+B).disabled=true;var A="a=install";A+="&cid="+sessionClientid;A+="&wid="+B;A+="&col="+C;smartCallXML("/widget",A,function(D){var E=D.getElementsByTagName("success")[0].childNodes[0];if(E){$("widgetstatus"+B).style.display="block";$("installbutton"+B).style.display="none"}else{alert("INSTALL FAILED")}$("installbutton"+B).disabled=false})}function uninstallWidget(B){$("div_"+B).remove();var A="a=uninstall";A+="&cid="+sessionClientid;A+="&wid="+B;smartCallXML("/widget",A,function(C){var D=C.getElementsByTagName("success")[0].childNodes[0];if(D){updateWidgetMinHeight()}else{alert("UNINSTALL FAILED")}})}function toggleWidgetHelp(B){var A=$$(".sethelp"+B);A.each(function(C){if(C.style.display=="none"){C.appear()}else{C.fade()}})}function showProfessional(){$("#businesslink").css({"display":"block"});$("#personallink").css({"display":"none"});$("#business").css({"display":"none"});$("#professional").css({"display":"block"})}function showBusiness(){$("#personallink").css({"display":"block"});$("#businesslink").css({"display":"none"});$("#professional").css({"display":"none"});$("#business").css({"display":"block"})}function waitForPayPal(){var A=setInterval(function(){mapwithus.ajax.call("/cancelcheck","",function(C){var B=mapwithus.util.nvn(C,"accounttype");if(B!="Standard"){clearInterval(A);location.href="/profile/account?change=true"}},{returnRootNode:true})},5000)}function waitForAccountStandard(C,A){MonkeyDialog.show('<div class="md_notice">Waiting for account confirmation...</div><br/><div style="text-align:center"><img src="/r/images/loading.gif" /></div>',{close:false});var B=setInterval(function(){mapwithus.ajax.call("/cancelcheck","",function(E){var D=mapwithus.util.nvn(E,"accounttype");if(D=="Standard"){clearInterval(B);MonkeyDialog.hide();if(cancelwindow!=null){cancelwindow.close()}if(C){upgradeSubscription(A)}else{location.reload(true)}}},{returnRootNode:true})},5000)}function waitForAccountNotStandard(){MonkeyDialog.show('<div class="md_notice">Waiting for upgrade confirmation...</div><br/><div style="text-align:center;"><img src="/r/images/loading.gif" /></div>',{close:false});var A=setInterval(function(){mapwithus.ajax.call("/cancelcheck","",function(C){var B=mapwithus.util.nvn(C,"accounttype");if(B!="Standard"){clearInterval(A);MonkeyDialog.hide();location.reload(true)}},{returnRootNode:true})},5000)}function upgradeSubscription(){waitForAccountNotStandard();submitForm()}function changeSubscription(A){waitForAccountStandard(true,A);setTimeout(function(){cancelwindow=window.open("https://www.paypal.com/cgi-bin/webscr?cmd=_subscr-find&alias=geomonkeyllc%40gmail%2ecom")},1000)}var cancelwindow=null;function cancelSubscription(){waitForAccountStandard(false);setTimeout(function(){cancelwindow=window.open("https://www.paypal.com/cgi-bin/webscr?cmd=_subscr-find&alias=geomonkeyllc%40gmail%2ecom")},1000)}function submitProSilver(B){var A="Professional Silver";document.forms.pp_form.elements.item_name.value=A;document.forms.pp_form.elements.item_number.value="1";document.forms.pp_form.elements.a3.value="1.95";if(B=="upgrade"){upgradeSubscription()}else{if(B=="change"){changeSubscription(A)}else{if(B=="cancel"){cancelSubscription()}}}}function submitProGold(B){var A="Professional Gold";document.forms.pp_form.elements.item_name.value=A;document.forms.pp_form.elements.item_number.value="2";document.forms.pp_form.elements.a3.value="3.95";if(B=="upgrade"){upgradeSubscription()}else{if(B=="change"){changeSubscription(A)}else{if(B=="cancel"){cancelSubscription()}}}}function submitBusSilver(B){var A="Business Silver";document.forms.pp_form.elements.item_name.value=A;document.forms.pp_form.elements.item_number.value="3";document.forms.pp_form.elements.a3.value="14.95";if(B=="upgrade"){upgradeSubscription()}else{if(B=="change"){changeSubscription(A)}else{if(B=="cancel"){cancelSubscription()}}}}function submitBusGold(B){var A="Business Gold";document.forms.pp_form.elements.item_name.value=A;document.forms.pp_form.elements.item_number.value="4";document.forms.pp_form.elements.a3.value="29.95";if(B=="upgrade"){upgradeSubscription()}else{if(B=="change"){changeSubscription(A)}else{if(B=="cancel"){cancelSubscription()}}}}function submitForm(){document.forms["pp_form"].submit()}function initRegister(){console.log("initRegister is being called");initDefault();if($("#regusername").length>0){$("#regusername").focus()}}function showRegisterOption(A){$("div.mwu-loginoptionselected").each(function(B){B.removeClass("mwu-loginoptionselected")});if($("#regloginfields").length>0){$("#regloginfields").css({"display":"none"})}$("#openidfields").css({"display":"none"});$("#facebookfields").css({"display":"none"});$("#googlefields").css({"display":"none"});$("#twitterfields").css({"display":"none"});if(A=="MapWith.Us"){$("#mwu-mwuloginoption").addClass("mwu-loginoptionselected");$("#regloginfields").css({"display":"block"});$("#loginname").focus()}else{if(A=="OpenID"){$("#mwu-openidloginoption").addClass("mwu-loginoptionselected");$("#openidfields").css({"display":"block"});$("#mwu-openidurl").focus()}else{if(A=="Facebook"){$("#mwu-fbloginoption").addClass("mwu-loginoptionselected");$("#facebookfields").css({"display":"block"})}else{if(A=="Google"){$("#mwu-googleloginoption").addClass("mwu-loginoptionselected");$("#googlefields").css({"display":"block"})}else{if(A=="Twitter"){$("#mwu-twitterloginoption").addClass("mwu-loginoptionselected");$("#twitterfields").css({"display":"block"})}else{if(A=="Streetbrew"){$("#mwu-sbloginoption").addClass("mwu-loginoptionselected");$("#regloginfields").css({"display":"block"});$("#mwu-sbname").focus()}}}}}}}function initStreetbrewRegister(){initStreetbrew();if($("#regusername").length>0){$("#regusername").focus()}}function checkAvailable(){var B=$("#regusername").val();if(B==null||B==""||B.length<1){return }if(B.length<4){$("#crosswrap_short").css({"display":"inline-block"})}else{if(B.length>15){$("#crosswrap_long").css({"display":"inline-block"})}else{var A="name="+encodeURIComponent(B);mapwithus.ajax.call("/UsernameQuery",A,function(C){if(mapwithus.util.nbvn(C,"available")){$("#tickwrap").css({"display":"inline-block"})}else{$("#crosswrap").css({"display":"inline-block"})}},{returnRootNode:true})}}}function checkAvailableMob(){var B=$("#regusername").val();if(B==null||B==""||B.length<1){return }if(B.length<4||B.length>15){$("#cross-mob").css({"display":"block"})}else{var A="name="+encodeURIComponent(B);mapwithus.ajax.call("/UsernameQuery",A,function(C){if(mapwithus.util.nbvn(C,"available")){$("#tick-mob").css({"display":"block"})}else{$("#cross-mob").css({"display":"block"})}},{returnRootNode:true})}}function clearCheck(){$("#tickwrap").css({"display":"none"});$("#crosswrap").css({"display":"none"});$("#crosswrap_short").css({"display":"none"});$("#crosswrap_long").css({"display":"none"})}function clearCheckMob(){$("#tick-mob").css({"display":"none"});$("#cross-mob").css({"display":"none"})}function populateUsername(){if($("#regusername").val()==""){var A=FB.Connect.get_loggedInUser();if(A!=-1&&A!=null&&A!="null"&&A!=""){$("#regusername").val("FB"+A)}}}function populateEmail(A){if($("#regemail").val()==""){if(!A||A=="null"){A=""}$("#regemail").val(A)}}var mLimit=10;var mOffset=0;var fLimit=10;var fOffset=0;var avatarImg="/r/images/geomonkey-avatar.png";function initSubscriptionsPage(){initDefault();loadSubscriptions(10,0)}function initSubscribePage(){initDefault();if(subid>0){loadServiceDetails(subid,planid)}loadInvitations();loadServices(10,0)}var doPresencePane=false;var doAvatarList=false;function initProfileSettings(){initDefault();if(doAvatarList){getAvatarList()}}function initModerationPage(){initDefault()}function initProfileGroupRateable(){initDefault();getGroupRateables()}function initProfileGroupMembers(E,B,C,F,D,A){initDefault();getGroupMembers(E,B,C,F,D,A)}function initProfileGroupInvite(B,A){initDefault();getPendingInvitees(B,A)}function initProfileGroupSettings(){initDefault()}function doOpenidLink(){var C=de("openid_url");var D=C.value;var B="/openid/redirect?";var A="openid="+encodeURIComponent(D)+"&next=/profile/account";window.location.href=B+A}function m3a1l3a3m7te(){var B="je,witnxqpmaidkdjekgushjpqodltomcnye:kdnfconqi.dzp3msk2tact#9(jds73!@ki^vhd";var A=new StringBuffer();A.append(B.substr(10,3));A.append(B.substr(28,3));A.append(B.substr(36,1));A.append(B.substr(41,3));A.append(B.substr(55,4));A.append(B.substr(68,1));A.append(B.substr(10,2));A.append(B.substr(49,1));A.append(B.substr(3,3));A.append(B.substr(22,1));A.append(B.substr(46,1));A.append(B.substr(20,2));location.href=A}function getAvatarList(){smartCallXML("/AvatarList","",function(B){var D=new StringBuffer();if(nh(B,"avatars")){var E=tag(B,"avatar");for(var C=0;C<E.length;C++){var F=nvn(E[C],"fileid");var A=nvn(E[C],"thumburl");D.a('<div style="float:left; width:40px; height:40px; overflow:hidden; text-align:center; margin:5px 0px 0px 5px; cursor:pointer" onmouseover="showToolTip(event, \'<img src=&#34;').a(A).a('&#34;/>\')" onmousemove="updateToolTip(event)" onmouseout="hideToolTip()" onclick="setAvatar(').a(F).a(')">');D.a('  <table border="0" cellspacing="0" cellpadding="0" style="background-color:#bbccdd">');D.a("    <tr>");D.a('      <td width="40" height="40" align="center" valign="center">');D.a('        <img src="').a(A).a('" border="0" width="40" /><br/>');D.a("      </td>");D.a("    </tr>");D.a("  </table>");D.a("</div>")}}else{D.a("<b>You have not uploaded any pictures.</b>")}$("avatarselectorpane").update(D.toString())})}function uploadAvatar(){if(document.forms["addfile"].elements["file"].value.length<1){window.alert("You must select a file to upload.");return false}return true}function setAvatar(B){var A="avid="+B;smartCallXML("/AvatarList",A,function(C){window.location.href=window.location.href})}function pageBounds(C,A,E){var D=1;var B=1;D=Math.round((E+A)/A);if(C>A){B=Math.ceil(C/A)}else{B=D}return{pageStart:D,pageEnd:B}}function loadActivities(D,A,C){setInnerHtml("pagingcontent","");setInnerHtml("activitypane",'<div style="text-align:center;"><img src="/r/images/loading.gif" /><br/>Loading activity ...</div>');var B="action=list";B+="&mode="+D;B+="&cid="+linkClientid;B+="&lim="+A;B+="&off="+C;smartCallXML("/activity",B,function(I){var G="No recent activity.";var Q=new StringBuffer();var M=I.getElementsByTagName("count")[0].childNodes[0].nodeValue;if(M==0){Q.append('<div class="sectionblk">');Q.append('<div class="sectionbumper"></div>');Q.append('<div class="darkgraytext" style="margin-left: 5px; text-align:center;">').append(G).append("</div>");Q.append('<div class="sectionbumper" style="clear:left;"></div>');Q.append("</div>")}var d=I.getElementsByTagName("item");for(var W=0;W<d.length;W++){var E=d[W];var H=nvn(E,"type");var Y=nvn(E,"clientid");var J=nvn(E,"username");var b=J;var f="their";var N=nvn(E,"avatarid");var e=nvn(E,"avatarkey");var F=avatarImg;if(N!=-1){F="/r/FileView/file/f/F"+N+"/t/true/k/"+e}var L=null;if(nh(E,"linkicon")){L=nvn(E,"linkicon")}var X=nvn(E,"viewid");var K=nvn(E,"url");var g=nvn(E,"title");var Z=nvn(E,"commentid");var T=nvn(E,"fndclientid");var O=nvn(E,"fndusername");var U=nvn(E,"fndavatarid");var P=nvn(E,"fndavatarkey");var S=avatarImg;if(U!=-1){S="/r/FileView/file/f/F"+U+"/t/true/k/"+P}var R=null;if(nh(E,"fndlinkicon")){R=nvn(E,"fndlinkicon")}var c=nodeValue((d[W].getElementsByTagName("date"))[0]);var V=new StringBuffer();if(H=="Map Viewed"||H=="Map Published"||H=="Map Updated"||H=="Map Comment"){if(H=="Map Comment"){V.append('<div><a href="').append(K).append("/-/c/").append(Z).append('">').append(g).append("</a></div>")}else{V.append('<div><a href="').append(K).append('">').append(g).append("</a></div>")}V.append('<div class="lightgraytext" style="font-size:10.0pt; margin-left: 5px;">');V.append("<b>").append(H).append("</b> ").append(c);V.append(' by <a href="/profile/').append(J).append('">');V.append('<img src="').append(F).append('" style="border:1px solid gray; width: 20px; height: 20px; vertical-align: middle;" /></a> ');V.append('<a href="/profile/').append(J).append('">').append(b).append("</a>");V.append("</div>")}else{if(H=="Profile Updated"){V.append("<div>");V.append('<table border="0" cellspacing="1" cellpadding="0">');V.append("<tr>");V.append('<td valign="top">');V.append('<div style="width:30px; height:30px; border:1px solid gray; background-color:#8199c1; overflow:hidden">');V.append('  <a href="/profile/').append(J).append('">');V.append('    <img src="').append(F).append('" width="100%" border="0" />');V.append("  </a>");V.append('  <div class="linkiconbase linkicon30">');V.append('    <a href="/profile/').append(J).append('">');V.append('      <img src="').append(L).append('" border="0" />');V.append("    </a>");V.append("  </div>");V.append("</div>");V.append("</td>");V.append("<td>");V.append('<div class="lightgraytext" style="padding: 0px 4px 0px 4px;"><a href="/profile/').append(J).append('">').append(b).append("</a> updated ").append(f).append(" profile ").append(c).append("</div>");V.append("</td>");V.append("</tr>");V.append("</table>");V.append("</div>")}else{if(H=="Friend Added"){V.append("<div>");V.append('<table border="0" cellspacing="1" cellpadding="0">');V.append("<tr>");V.append('<td valign="top">');V.append('<div style="width:30px; height:30px; border:1px solid gray; background-color:#8199c1; overflow:hidden">');V.append('  <a href="/profile/').append(J).append('">');V.append('    <img src="').append(F).append('" width="100%" border="0" />');V.append("  </a>");V.append('  <div class="linkiconbase linkicon30">');V.append('    <a href="/profile/').append(J).append('">');V.append('      <img src="').append(L).append('" border="0" />');V.append("    </a>");V.append("  </div>");V.append("</div>");V.append("</td>");V.append("<td>");V.append('<div class="lightgraytext" style="padding: 0px 4px 0px 4px;"><a href="/profile/').append(J).append('">').append(b).append("</a>&nbsp;added</div>");V.append("</td>");V.append("<td>");V.append('<div style="width:30px; height:30px; border:1px solid gray; background-color:#8199c1; overflow:hidden">');V.append('  <a href="/profile/').append(O).append('">');V.append('    <img src="').append(S).append('" width="100%" border="0" />');V.append("  </a>");V.append('  <div class="linkiconbase linkicon30">');V.append('    <a href="/profile/').append(O).append('">');V.append('      <img src="').append(R).append('" border="0" />');V.append("    </a>");V.append("  </div>");V.append("</div>");V.append("</td>");V.append("<td>");V.append('<div class="lightgraytext" style="padding: 0px 4px 0px 4px;"><a href="/profile/').append(O).append('">').append(O).append("</a> as a friend ").append(c).append("</div>");V.append("</td>");V.append("</tr>");V.append("</table>");V.append("</div>")}}}Q.append('<div class="sectionblk">');Q.append('<div class="sectionbumper"></div>');Q.append('<div style="font-size:12.0pt; margin: 0px 0px 0px 15px;">').append(V).append("</div>");Q.append('<div class="sectionbumper" style="clear:left;"></div>');Q.append("</div>")}setInnerHtml("activitypane",Q.toString());updateActivityPaging(D,M,A,C)})}function updateActivityPaging(F,D,A,E){var C=pageBounds(D,A,E);if(C.pageStart==1&&C.pageEnd==1){return }var B="";if(C.pageStart>1){B+='<a href="javascript:void(0)" onclick="loadActivities(\''+F+"', "+A+", "+parseInt(E-A)+')" onmouseover="window.status=\'\'; return true">Previous</a>'}else{B+='<span class="lightgraytext">Previous</span>'}B+='<span class="darkgraytext" style="padding: 0px 20px 0px 20px;">Page '+C.pageStart+" of "+C.pageEnd+"</span>";if(C.pageEnd>C.pageStart){B+='<a href="javascript:void(0)" onclick="loadActivities(\''+F+"', "+A+", "+parseInt(E+A)+')" onmouseover="window.status=\'\'; return true">Next</a>'}else{B+='<span class="lightgraytext">Next</span>'}setInnerHtml("pagingcontent",B)}function loadMaps(G,B,F,E,C,A){setInnerHtml("pagingcontent","");setInnerHtml("mapspane",'<div class="sectionblk" style="padding:10px; text-align:center; font-weight:bold; font-size:8.0pt"><img src="/r/images/loading.gif" /><br/>Loading maps, please wait...</div>');mLimit=B;mOffset=F;var D="action=list";D+="&mode="+G;D+="&cid="+linkClientid;D+="&groupid="+C;D+="&groupcid="+A;D+="&lim="+B;D+="&off="+F;smartCallXML("/maps",D,function(O){var N=new StringBuffer();var Q=O.getElementsByTagName("count")[0].childNodes[0].nodeValue;if(Q==0){N.append('<div class="sectionblk">');N.append('<div class="sectionbumper"></div>');N.append('<div class="darkgraytext" style="margin-left: 5px; text-align:center;">No maps.<br/><br/>');if(myProfile){N.append(' <a href="" onclick="createNewMap(); return false">Create New Map</a>')}N.append("</div>");N.append('<div class="sectionbumper" style="clear:left;"></div>');N.append("</div>")}var I=O.getElementsByTagName("item");for(var L=0;L<I.length;L++){var T=I[L];var S=nvn(T,"viewid");var H=nvn(T,"url");var J=nvn(T,"editurl");var U=nvn(T,"title");var P=nvn(T,"desc");var M=nvn(T,"keywords");var K=nvn(T,"status");var W=nvn(T,"clicks");var V=nvn(T,"modified");var R=nvn(T,"ismobilemap");N.append('<div class="sectionblock" style="cursor:pointer;" onclick="$(\'map').append(S).append('details\').toggle()" title="click for map details">');N.append('<div class="sectionbumper"></div>');N.append('<div style="margin: 0px 15px 0px 15px;">');N.append('<div style="font-size:13.0pt; margin-left:3px;"><a href="').append(H).append('" title=" ">').append(U).append("</a></div>");N.append('<div class="darkgraytext" style="font-size: 9.0pt; margin-left: 8px;">').append(P).append("</div>");N.append('<div class="lightgraytext" id="map').append(S).append('details" style="display:none; font-size: 8.0pt; margin:3px 0px 0px 8px;">');N.append(" <div>Keywords: ").append(M).append("</div>");N.append(" <div>Status: ").append(K).append("</div>");N.append(" <div>Views: ").append(W).append("</div>");N.append(" <div>Updated: ").append(V).append("</div>");if(E&&myProfile){if(R=="false"){N.append('<div style="margin:3px 0px 0px 0px;">');N.append('<a href="').append(J).append('">Edit this map</a> | ');N.append('<a href="javascript:void(0)" style="font-size:8.0pt;" onclick="setMobileMap(\'');N.append(G);N.append("', '");N.append(S);N.append("', true, ");N.append(C).append(", ").append(A).append(")");N.append('">Make this a mobile map</a>');N.append("</div>")}else{N.append('<div style="margin:3px 0px 0px 0px;">');N.append('<a href="').append(J).append('">Edit this map</a> | ');N.append('<a href="javascript:void(0)" style="font-size:8.0pt;" onclick="setMobileMap(\'');N.append(G);N.append("', '");N.append(S);N.append("', false, ");N.append(C).append(", ").append(A).append(")");N.append('">Remove mobile map status</a>');N.append("</div>")}}N.append("</div>");N.append("</div>");N.append('<div class="sectionbumper" style="clear:left;"></div>');N.append("</div>")}setInnerHtml("mapspane",N.toString());if(E){updateMapPaging(G,Q,B,F,C,A)}else{setMapsCount(Q,B,F)}})}function updateMapPaging(H,F,B,G,C,A){var E=pageBounds(F,B,G);if(E.pageStart==1&&E.pageEnd==1){return }var D="";if(E.pageStart>1){D+='<a href="javascript:void(0)" onclick="loadMaps(\''+H+"', "+B+", "+parseInt(G-B)+", true, "+C+", "+A+')">Previous</a>'}else{D+='<span class="lightgraytext">Previous</span>'}D+='<span class="darkgraytext" style="padding: 0px 20px 0px 20px;">Page '+E.pageStart+" of "+E.pageEnd+"</span>";if(E.pageEnd>E.pageStart){D+='<a href="javascript:void(0)" onclick="loadMaps(\''+H+"', "+B+", "+parseInt(G+B)+", true, "+C+", "+A+')">Next</a>'}else{D+='<span class="lightgraytext">Next</span>'}setInnerHtml("pagingcontent",D)}function setMapsCount(B,A,C){setInnerHtml("mapcount",B);if(B>A){setInnerHtml("seeallmaps",'<a href="/publicmaps/user/'+linkUser+'" class="decnone" style="font-size: 8.0pt;">All '+B+" Maps</a>")}}function setMobileMap(A,F,C,D,B){var E="action=setmobile&mobile="+C+"&viewid="+F;smartCallXML("/maps",E,function(){loadMaps(A,mLimit,mOffset,true,D,B)})}function loadSubscriptions(A,C){setInnerHtml("pagingcontent","");setInnerHtml("subspane",'<div class="sectionblk" style="padding:10px; text-align:center; font-weight:bold; font-size:8.0pt"><img src="/r/images/loading.gif" /><br/>Loading subscriptions, please wait...</div>');var B="action=memberships";B+="&clientid="+linkClientid;B+="&limit="+A;B+="&offset="+C;smartCallXML("/subscription",B,function(H){setInnerHtml("subspane","");var J=parseInt(nodeValue(H.getElementsByTagName("count")[0]));var D;if(J==0){D=document.createElement("div");var G=new StringBuffer();G.append('<div class="sectionbumper"></div>');G.a('<div class="sectionblk darkgraytext" style="padding:10px; text-align:center">');if(myProfile){G.a("You have ")}else{G.a(linkUser+" has ")}G.a("no active subscriptions.");G.a("</div>");D.innerHTML=G.toString();de("subspane").appendChild(D)}var K=H.getElementsByTagName("member");for(i=0;i<K.length;i++){var F=K[i];var O=nodeValue(F.getElementsByTagName("subid")[0]);var M=nodeValue(F.getElementsByTagName("title")[0]);var I=nodeValue(F.getElementsByTagName("desc")[0]);if(I.trim().length==0){I="(No description.)"}var L=nodeValue(F.getElementsByTagName("planid")[0]);var E=nodeValue(F.getElementsByTagName("ptitle")[0]);var N=nodeValue(F.getElementsByTagName("joined")[0]);D=document.createElement("div");D.className="sectionblk";var G=new StringBuffer();G.a('<div class="sectionbumper"></div>');G.a('<div style="height:10px"></div>');G.a('<div style="margin:0px 15px 10px 15px"><a href="/profile/subscribe/s/');G.a(O);G.a("/user/");G.a(sessionUser);G.a('">');G.a(M);G.a('</a><div style="margin-left:20px; font-size:8.0pt; color:gray"><div style="margin:3px 0px; font-style:italic">');G.a(scriptify(I));G.a('</div>PLAN: <a href="/profile/subscribe/s/');G.a(O);G.a("/p/");G.a(L);G.a("/user/");G.a(sessionUser);G.a('" style="font-size:10.0pt">');G.a(E);G.a('</a><br/>JOINED: <span style="font-size:10.0pt">');G.a(N);G.a("</span></div></div>");D.innerHTML=G.toString();de("subspane").appendChild(D)}})}function loadServiceDetails(A,C){setInnerHtml("showpane",'<div class="sectionblk" style="padding:10px; text-align:center; font-weight:bold; font-size:8.0pt"><img src="/r/images/loading.gif" /><br/>Loading service details, please wait...</div>');var B="action=servicedetails";B+="&subid="+A;smartCallXML("/subscription",B,function(L){setInnerHtml("showpane","");var Q=nodeValue(L.getElementsByTagName("subid")[0]);var P=nodeValue(L.getElementsByTagName("title")[0]);var M=nodeValue(L.getElementsByTagName("desc")[0]);if(M.trim().length==0){M="(No description.)"}var H=nodeValue(L.getElementsByTagName("created")[0]);var D=document.createElement("div");D.className="sectionblk";D.style.backgroundColor="#ecf0f9";D.style.borderBottom="1px solid #ced7ea";var K=new StringBuffer();K.a('<div class="sectionbumper"></div>');K.a('<div style="height:10px"></div>');K.a('<div style="margin:0px 10px 10px 10px"><a href="/profile/subscribe">');K.a(P);K.a('</a><div style="margin-left:20px; font-size:8.0pt; color:#666688"><div style="margin:3px 0px; font-style:italic">');K.a(scriptify(M));K.a('</div>ACTIVE SINCE: <span style="font-size:10.0pt">');K.a(H);K.a('</span><div style="height:3px"></div>AVAILABLE PLANS:<div style="margin-left:20px">');var O=L.getElementsByTagName("plan");for(var I=0;I<O.length;I++){var F=O[I];var N=nodeValue(F.getElementsByTagName("planid")[0]);var E=nodeValue(F.getElementsByTagName("title")[0]);var J=(nodeValue(F.getElementsByTagName("open")[0])=="true");var G=parseInt(nodeValue(F.getElementsByTagName("active")[0]));var R=parseInt(nodeValue(F.getElementsByTagName("mcount")[0]));K.a('<div style="margin-top:2px"><a href="#" onclick="togglePlanDetails(');K.a(N);K.a('); return false" style="font-size:10.0pt">');K.a(E);K.a('</a></div><div id="plandetails');K.a(N);K.a('" style="display:none; margin:3px 0px 10px 20px">');K.a("This plan is ");if(!J){K.a("invitation only.")}else{K.a("open access.")}K.a("<br/>");if(R>=0){K.a("There ");if(R!=1){K.a("are")}else{K.a("is")}K.a(" currently ");K.a(R);K.a(" member");if(R!=1){K.a("s")}K.a(".<br/>")}K.a('<div style="margin:5px 0px">');if(G<2){K.a('<a href="#" onclick="subscribeMe(');K.a(Q);K.a(",");K.a(N);K.a('); return false" style="text-decoration:none; font-size:9.0pt"><img src="/r/images/icons/famfamfam/book_add.png" border="0" style="vertical-align:bottom"> Subscribe to this plan</a>');if(G==1){K.a(" | ");K.a('<a href="#" onclick="unsubscribeMe(');K.a(Q);K.a(",");K.a(N);K.a('); return false" style="text-decoration:none; font-size:9.0pt"><img src="/r/images/icons/famfamfam/book_delete.png" border="0" style="vertical-align:bottom"> Ignore invitation to plan</a>')}}else{if(G==2){K.a('<span style="font-size:8.0pt; font-weight:bold"><img src="/r/images/icons/famfamfam/book_open.png" style="vertical-align:bottom"> You\'re already a member of this plan&nbsp;(<a href="#" onclick="unsubscribeMe(');K.a(Q);K.a(",");K.a(N);K.a('); return false">unsubscribe</a>)</span>')}else{if(G==4){K.a('<span style="font-size:8.0pt; font-weight:bold"><img src="/r/images/icons/famfamfam/book_error.png" style="vertical-align:bottom"> You were suspended from this plan</span>')}}}K.a("</div>");K.a("</div>")}K.a("</div></div></div>");D.innerHTML=K.toString();de("showpane").appendChild(D);if(C&&C>0){togglePlanDetails(C)}})}function togglePlanDetails(A){var B=de("plandetails"+A);if(!B){return }B.style.display=(B.style.display=="block")?"none":"block"}function subscribeMe(A,C){var B="action=subscribe";B+="&subid="+A;B+="&planid="+C;smartCallXML("/subscription",B,function(D){var E=(D.getElementsByTagName("success").length>0);if(E){location.href="/subscriptions/user/"+linkUser}else{alert("An error occurred while completing your subscription. If the error persists, please try refreshing the page.")}})}function unsubscribeMe(A,C){var B="action=unsubscribe";B+="&subid="+A;B+="&planid="+C;smartCallXML("/subscription",B,function(D){var E=(D.getElementsByTagName("success").length>0);if(E){location.href="/subscriptions/user/"+linkUser}else{alert("An error occurred while completing your subscription. If the error persists, please try refreshing the page.")}})}function loadInvitations(){setInnerHtml("invpane",'<div class="sectionblk" style="padding:10px; text-align:center; font-weight:bold; font-size:8.0pt"><img src="/r/images/loading.gif" /><br/>Loading invitations, please wait...</div>');var A="action=invitations";smartCallXML("/subscription",A,function(H){setInnerHtml("invpane","");var J=parseInt(nodeValue(H.getElementsByTagName("count")[0]));var G;var B;if(J==0){B=document.createElement("div");G=new StringBuffer();G.a('<div class="sectionblk darkgraytext" style="padding:10px; text-align:center">');G.a("You have no new invitations.");G.a("</div>");B.innerHTML=G.toString();de("invpane").appendChild(B)}var F;var E=H.getElementsByTagName("invite");for(F=0;F<E.length;F++){var C=E[F];var N=nodeValue(C.getElementsByTagName("subid")[0]);var L=nodeValue(C.getElementsByTagName("title")[0]);var I=nodeValue(C.getElementsByTagName("desc")[0]);if(I.trim().length==0){I="(No description.)"}var K=nodeValue(C.getElementsByTagName("planid")[0]);var D=nodeValue(C.getElementsByTagName("ptitle")[0]);var M=nodeValue(C.getElementsByTagName("joined")[0]);B=document.createElement("div");B.className="sectionblk";G=new StringBuffer();G.a('<div class="sectionbumper"></div>');G.a('<div style="height:10px"></div>');G.a('<div style="margin:0px 10px 10px 10px"><a href="/profile/subscribe/s/');G.a(N);G.a("/user/");G.a(sessionUser);G.a('">');G.a(L);G.a('</a><div style="margin-left:20px; font-size:8.0pt; color:gray"><div style="margin:3px 0px; font-style:italic">');G.a(scriptify(I));G.a('</div>PLAN: <a href="/profile/subscribe/s/');G.a(N);G.a("/p/");G.a(K);G.a("/user/");G.a(sessionUser);G.a('" style="font-size:10.0pt">');G.a(D);G.a('</a><br/>INVITED ON: <span style="font-size:10.0pt">');G.a(M);G.a('</span><br/>JOIN NOW: <a href="/profile/subscribe/s/');G.a(N);G.a("/p/");G.a(K);G.a("/user/");G.a(sessionUser);G.a('" style="font-size:10.0pt">Subscribe to this service</a></div></div>');B.innerHTML=G.toString();de("invpane").appendChild(B)}})}function loadServices(A,C){setInnerHtml("pagingcontent","");setInnerHtml("servpane",'<div class="sectionblk" style="padding:10px; text-align:center; font-weight:bold; font-size:8.0pt"><img src="/r/images/loading.gif" /><br/>Loading subscription services, please wait...</div>');var B="action=findservices";B+="&limit="+A;B+="&offset="+C;smartCallXML("/subscription",B,function(I){setInnerHtml("servpane","");var K=parseInt(nodeValue(I.getElementsByTagName("count")[0]));var D;if(K==0){D=document.createElement("div");var H=new StringBuffer();H.a('<div class="sectionbumper"></div>');H.a('<div class="sectionblk darkgraytext" style="padding:10px; text-align:center">');H.a("There are no ");if(C>0){H.a("more ")}H.a("services to display.");H.a("</div>");D.innerHTML=H.toString();de("servpane").appendChild(D)}var L=I.getElementsByTagName("service");for(i=0;i<L.length;i++){var F=L[i];var N=nodeValue(F.getElementsByTagName("subid")[0]);var M=nodeValue(F.getElementsByTagName("title")[0]);var J=nodeValue(F.getElementsByTagName("desc")[0]);if(J.trim().length==0){J="(No description.)"}var G=(nodeValue(F.getElementsByTagName("locked")[0])=="true");var E=nodeValue(F.getElementsByTagName("created")[0]);D=document.createElement("div");D.className="sectionblk";var H=new StringBuffer();H.a('<div class="sectionbumper"></div>');H.a('<div style="height:10px"></div>');H.a('<div style="margin:0px 10px 10px 10px"><a href="/profile/subscribe/s/');H.a(N);H.a('">');H.a(M);H.a('</a><div style="margin-left:20px; font-size:8.0pt; color:gray"><div style="margin:3px 0px; font-style:italic">');H.a(scriptify(J));H.a('</div>ACTIVE SINCE: <span style="font-size:10.0pt">');H.a(E);H.a('</span><br/>PLANS: <a href="/profile/subscribe/s/');H.a(N);H.a("/user/");H.a(sessionUser);H.a('" style="font-size:10.0pt">See available plans</a></div></div>');D.innerHTML=H.toString();de("servpane").appendChild(D)}})}function clearSearch(){document.getElementById("recipient_list").value="";setInnerHtml("searchresults","");setInnerHtml("pagingcontent","")}function doSearch(A,D,C){var E=document.getElementById("recipient_list").value;if(E==""){return }setInnerHtml("pagingcontent","");setInnerHtml("searchresults",'<div style="text-align:center;"><img src="/r/images/loading.gif" /><br/>Loading list ...</div>');if(C){document.getElementById("searchbutton").disabled=true}var B="a=search";B+="&emails="+E;B+="&lim="+A;B+="&off="+D;smartCallXML("/friends",B,function(L){var K=new StringBuffer();var M=L.getElementsByTagName("count")[0].childNodes[0].nodeValue;if(M==0){K.append('<div class="sectionblk">');K.append('<div class="sectionbumper"></div>');K.append('<div class="darkgraytext" style="margin-left: 5px; text-align:center;">No users were found.</div>');K.append('<div class="sectionbumper" style="clear:left;"></div>');K.append("</div>")}var H=L.getElementsByTagName("item");for(var J=0;J<H.length;J++){var Q=(H[J].getElementsByTagName("clientid"))[0].childNodes[0].nodeValue;var I=(H[J].getElementsByTagName("username"))[0].childNodes[0].nodeValue;var G=(nh(H[J],"name"))?nodeValue((H[J].getElementsByTagName("name"))[0]):"";var P=(H[J].getElementsByTagName("avatarid"))[0].childNodes[0].nodeValue;var O=avatarImg;if(P!=-1){var N=(H[J].getElementsByTagName("avatarkey"))[0].childNodes[0].nodeValue;O="/r/FileView/file/f/F"+P+"/t/true/k/"+N}var F=null;if(nh(H[J],"linkicon")){F=nvn(H[J],"linkicon")}var R=(H[J].getElementsByTagName("isfriend"))[0].childNodes[0].nodeValue;K.append('<div class="sectionblock">');K.append('<div class="sectionbumper"></div>');K.append('<div style="margin: 0px 15px 0px 15px;">');K.append('<table border="0" cellspacing="1" cellpadding="0">');K.append("<tr>");K.append('<td valign="top">');K.append('<div style="width:50px; height:50px; border:1px solid gray; background-color:#8199c1; overflow:hidden" title=" ">');K.append('  <a href="/profile/').append(I).append('"><img src="').append(O).append('" width="100%" border="0" /></a>');if(F!=null){K.append('<div class="linkiconbase linkicon50">');K.append('  <a href="/profile/').append(I).append('"><img src="').append(F).append('" border="0" /></a>');K.append("</div>")}K.append("</div>");K.append("</td>");K.append('<td style="width:100%;">');if(G.length>0){K.append('&nbsp;<a href="/profile/').append(I).append('" style="vertical-align:-3px;">').append(I).append("</a>").append('&nbsp;<span class="darkgraytext">( ').append(G).append(" )</span>")}else{K.append('&nbsp;<a href="/profile/').append(I).append('" style="vertical-align:-3px;">').append(I).append("</a>")}K.append('<div style="float:left; margin:3px 0px 0px 20px;">');K.append('<a href="/profile/').append(I).append('" class="decnone"><img src="/r/images/icons/famfamfam/page_white_go.png" style="border-style:none; vertical-align:-1px; cursor:pointer;" /></a> <a href="/profile/').append(I).append('" style="font-size:8.0pt;">View Profile</a>');K.append("</div>");if(R=="true"){K.append('<div style="float:left; margin:3px 0px 0px 10px;">');K.append('<img src="/r/images/icons/famfamfam/delete12.png" style="vertical-align:-1px; cursor:pointer;" onclick="removeFriend(').append(Q).append(', \'search\');" /> <a href="javascript:void(0)" style="font-size:8.0pt;" onclick="removeFriend(').append(Q).append(", 'search')\">Remove Friend</a>");K.append("</div>")}else{K.append('<div style="float:left; margin:3px 0px 0px 10px;">');K.append('<img src="/r/images/icons/famfamfam/add12.png" style="vertical-align:-1px; cursor:pointer;" onclick="addFriend(').append(Q).append(', \'search\');" /> <a href="javascript:void(0)" style="font-size:8.0pt;" onclick="addFriend(').append(Q).append(", 'search')\">Add Friend</a>");K.append("</div>")}K.append("</td>");K.append("</tr>");K.append("</table>");K.append("</div>");K.append('<div class="sectionbumper" style="clear:left;"></div>');K.append("</div>")}setInnerHtml("searchresults",K.toString());if(C){document.getElementById("searchbutton").disabled=false}updateSearchPaging(M,A,D)})}function updateSearchPaging(D,A,E){var C=pageBounds(D,A,E);if(C.pageStart==1&&C.pageEnd==1){return }var B="";if(C.pageStart>1){B+='<a href="javascript:void(0)" onclick="doSearch('+A+", "+parseInt(E-A)+')">Previous</a>'}else{B+='<span class="lightgraytext">Previous</span>'}B+='<span class="darkgraytext" style="padding: 0px 20px 0px 20px;">Page '+C.pageStart+" of "+C.pageEnd+"</span>";if(C.pageEnd>C.pageStart){B+='<a href="javascript:void(0)" onclick="doSearch('+A+", "+parseInt(E+A)+')">Next</a>'}else{B+='<span class="lightgraytext">Next</span>'}setInnerHtml("pagingcontent",B)}function doFriends(A,E,B,D){setInnerHtml("pagingcontent","");setInnerHtml("friendspane",'<div style="text-align:center;"><img src="/r/images/loading.gif" /><br/>Loading friends ...</div>');fLimit=A;fOffset=E;var C="a=list";C+="&cid="+linkClientid;C+="&lim="+A;C+="&off="+E;smartCallXML("/friends",C,function(M){var L=new StringBuffer();var N=M.getElementsByTagName("count")[0].childNodes[0].nodeValue;if(N==0){L.append('<div class="sectionblk">');L.append('<div class="sectionbumper"></div>');L.append('<div class="darkgraytext" style="margin-left: 5px; text-align:center;">');L.append("No friends added yet.");if(myProfile){L.append("<br/>");L.append('<a href="/addfriends/user/').append(linkUser).append('">Add Friends</a> | ');L.append('<a href="/invitefriends/user/').append(linkUser).append('">Invite Friends</a>')}L.append("</div>");L.append('<div class="sectionbumper" style="clear:left;"></div>');L.append("</div>")}var G=M.getElementsByTagName("item");for(var K=0;K<G.length;K++){var U=(G[K].getElementsByTagName("clientid"))[0].childNodes[0].nodeValue;var J=(G[K].getElementsByTagName("username"))[0].childNodes[0].nodeValue;var R=(G[K].getElementsByTagName("avatarid"))[0].childNodes[0].nodeValue;var P=avatarImg;if(R!=-1){var O=(G[K].getElementsByTagName("avatarkey"))[0].childNodes[0].nodeValue;P="/r/FileView/file/f/F"+R+"/t/true/k/"+O}var F=null;if(nh(G[K],"linkicon")){F=nvn(G[K],"linkicon")}var S=nodeValue((G[K].getElementsByTagName("location"))[0]);var T=(nh(G[K],"age"))?nodeValue((G[K].getElementsByTagName("age"))[0]):"";var Q=(G[K].getElementsByTagName("gender"))[0].childNodes[0].nodeValue;var I=(G[K].getElementsByTagName("created"))[0].childNodes[0].nodeValue;var H="a "+T+" "+Q+" from "+S+" who joined on "+I;L.append('<div class="sectionblock" style="cursor:pointer;" onclick="$(\'friend').append(U).append('details\').toggle()" title="click for friend details">');L.append('<div class="sectionbumper"></div>');L.append('<div style="margin: 0px 15px 0px 15px;">');L.append('<table border="0" cellspacing="1" cellpadding="0">');L.append("<tr>");L.append('<td valign="top">');L.append('<div style="width:50px; height:50px; border:1px solid gray; background-color:#8199c1; overflow:hidden" title=" ">');L.append('  <a href="/profile/').append(J).append('"><img src="').append(P).append('" width="100%" border="0" /></a>');if(F!=null){L.append('<div class="linkiconbase linkicon50">');L.append('  <a href="/profile/').append(J).append('"><img src="').append(F).append('" border="0" /></a>');L.append("</div>")}L.append("</div>");L.append("</td>");L.append("<td>");L.append('<div style="font-size:14.0pt; margin-left: 10px;"><a href="/profile/').append(J).append('" title=" ">').append(J).append("</a></div>");L.append('<div id="friend').append(U).append('details" style="display:none;">');if(B){L.append('<div class="lightgraytext" style="font-size: 8.0pt; margin-left: 10px;">').append(H).append("</div>");L.append('<div style="float:left; margin:3px 0px 0px 20px;">');L.append('<a href="/profile/').append(J).append('" class="decnone"><img src="/r/images/icons/famfamfam/page_white_go.png" style="border-style:none; vertical-align:-1px; cursor:pointer;" /></a> <a href="/profile/').append(J).append('" style="font-size:8.0pt;">View Profile</a>');L.append("</div>");if(myProfile){L.append('<div style="float:left; margin:3px 0px 0px 10px;">');L.append('<img src="/r/images/icons/famfamfam/delete12.png" style="vertical-align:-1px; cursor:pointer;" onclick="removeFriend(').append(U).append(', \'profile\');" /> <a href="javascript:void(0)" style="font-size:8.0pt;" onclick="removeFriend(').append(U).append(", 'profile')\">Remove Friend</a>");L.append("</div>")}}L.append("</div>");L.append("</td>");L.append("</tr>");L.append("</table>");L.append("</div>");L.append('<div class="sectionbumper" style="clear:left;"></div>');L.append("</div>")}setInnerHtml("friendspane",L.toString());if(D){updateFriendsPaging(N,A,E)}else{setFriendsCount(N,A,E)}})}function doFriendsThumb(A,C){setInnerHtml("pagingcontent","");setInnerHtml("friendspane",'<div style="text-align:center;"><img src="/r/images/loading.gif" /><br/>Loading friends ...</div>');fLimit=A;fOffset=C;var B="a=list";B+="&cid="+linkClientid;B+="&lim="+A;B+="&off="+C;smartCallXML("/friends",B,function(H){var G=new StringBuffer();var I=H.getElementsByTagName("count")[0].childNodes[0].nodeValue;if(I==0){G.append('<div class="sectionblk">');G.append('<div class="sectionbumper"></div>');G.append('<div class="darkgraytext" style="margin-left: 5px; text-align:center;">');G.append("No friends added yet.");if(myProfile){G.append("<br/>");G.append('<a href="/addfriends/user/').append(linkUser).append('">Add Friends</a> | ');G.append('<a href="/invitefriends/user/').append(linkUser).append('">Invite Friends</a>')}G.append("</div>");G.append('<div class="sectionbumper" style="clear:left;"></div>');G.append("</div>")}else{G.append('<div style="margin-left:10px;">');var D=H.getElementsByTagName("item");for(var F=0;F<D.length;F++){var E=(D[F].getElementsByTagName("username"))[0].childNodes[0].nodeValue;var L=(D[F].getElementsByTagName("avatarid"))[0].childNodes[0].nodeValue;var J=(D[F].getElementsByTagName("avatarkey"))[0].childNodes[0].nodeValue;var K=avatarImg;if(L!=-1){K="/r/FileView/file/f/F"+L+"/t/true/k/"+J}G.append('<div style="float:left; width:20px; height:20px; margin:0px 0px 5px 5px; border:1px solid gray; background-color:#8199c1; overflow:hidden">');G.append('  <a href="/profile/').append(E).append('">');G.append('    <img src="').append(K).append('" title="').append(E).append('" width="100%" border="0" />');G.append("  </a>");G.append("</div>")}G.append("</div>")}setInnerHtml("friendspane",G.toString());setFriendsCount(I,A,C)})}function updateFriendsPaging(D,A,E){var C=pageBounds(D,A,E);if(C.pageStart==1&&C.pageEnd==1){return }var B="";if(C.pageStart>1){B+='<a href="javascript:void(0)" onclick="doFriends('+A+", "+parseInt(E-A)+', true, true)">Previous</a>'}else{B+='<span class="lightgraytext">Previous</span>'}B+='<span class="darkgraytext" style="padding: 0px 20px 0px 20px;">Page '+C.pageStart+" of "+C.pageEnd+"</span>";if(C.pageEnd>C.pageStart){B+='<a href="javascript:void(0)" onclick="doFriends('+A+", "+parseInt(E+A)+', true, true)">Next</a>'}else{B+='<span class="lightgraytext">Next</span>'}setInnerHtml("pagingcontent",B)}function addFriend(A,C){var B="a=add";B+="&tid="+A;ajaxCall("/friends",B,function(D){if(C=="search"){doSearch(fLimit,fOffset)}else{if(C=="other"){setFriendButton(A,"add")}}})}function removeFriend(A,C){var B="a=remove";B+="&tid="+A;ajaxCall("/friends",B,function(D){if(C=="profile"){doFriends(fLimit,fOffset,true,true)}else{if(C=="search"){doSearch(fLimit,fOffset)}else{if(C=="other"){setFriendButton(A,"remove")}}}})}function setFriendsCount(B,A,C){setInnerHtml("friendcount",B);if(B>A){setInnerHtml("seeallfriends",'<a href="/friends/user/'+linkUser+'" class="decnone" style="font-size: 8.0pt;">All '+B+" Friends</a>")}}function setFriendButton(B,C){var A="";if(C=="add"){A='<a href="javascript:void(0)" onmouseover="window.status=\'\'; return true" onclick="removeFriend('+B+", 'other')\">Remove Friend</a>"}else{if(C=="remove"){A='<a href="javascript:void(0)" onmouseover="window.status=\'\'; return true" onclick="addFriend('+B+", 'other')\">Add Friend</a>"}}setInnerHtml("friendbutton",A)}function sendInvitations(){var B=document.getElementById("recipient_list").value;if(B==""){return }document.getElementById("invitebutton").disabled=true;var A=document.getElementById("body").value;var C="emails="+B;C+="&invitefrom="+sessionUser;C+="&body="+A;smartCallXML("/invitation",C,function(D){if(nh(D,"success")){flashNotice("Invitations sent successfully!")}else{flashError("Sorry but we were unable to send your invitations.")}document.getElementById("invitebutton").disabled=false})}function toggleRename(C){var A=document.getElementById("renamelink"+C);var B=document.getElementById("renamediv"+C);(A.style.display=="none")?A.style.display="block":A.style.display="none";(B.style.display=="none")?B.style.display="block":B.style.display="none";if(B.style.display=="block"){document.getElementById("renamebox"+C).focus()}}function saveRename(C){var B=document.getElementById("renamebox"+C).value;if(B.length<1||B==""){alert("Invalid name");return }var A="sid="+C;A+="&a=rename";A+="&name="+B;ajaxCall("/favorites",A,function(D){updateRenameLink(C,B)})}function updateRenameLink(B,A){document.getElementById("renamehref"+B).innerHTML=A;toggleRename(B)}function deleteSearch(B){if(!confirm("Are you sure you want to delete this saved search?")){return }var A="sid="+B;A+="&a=delete";ajaxCall("/favorites",A,function(C){loadFavoriteSearches(10,0)})}function deletePlace(B){if(!confirm("Are you sure you want to delete this saved place?")){return }var A="sid="+B;A+="&a=delete";ajaxCall("/favorites",A,function(C){loadFavoritePlaces(10,0)})}function loadFavoriteSearches(A,C){setInnerHtml("pagingcontent","");setInnerHtml("favpane",'<div style="text-align:center;"><img src="/r/images/loading.gif" /><br/>Loading list ...</div>');var B="a=list";B+="&m=searches";B+="&cid="+linkClientid;B+="&lim="+A;B+="&off="+C;smartCallXML("/favorites",B,function(F){var H=new StringBuffer();var I=F.getElementsByTagName("count")[0].childNodes[0].nodeValue;if(I==0){H.append('<div class="sectionblk">');H.append('<div class="sectionbumper"></div>');H.append('<div class="darkgraytext" style="margin-left: 5px; text-align:center;">No saved searches.</div>');H.append('<div class="sectionbumper" style="clear:left;"></div>');H.append("</div>")}var D=F.getElementsByTagName("item");for(var G=0;G<D.length;G++){var K=(D[G].getElementsByTagName("id"))[0].childNodes[0].nodeValue;var J=(D[G].getElementsByTagName("title"))[0].childNodes[0].nodeValue;var E=(D[G].getElementsByTagName("url"))[0].childNodes[0].nodeValue;H.append('<div class="sectionblock" style="cursor:pointer;" onclick="$(\'fav').append(K).append('details\').toggle()" title="click for favorite details">');H.append('<div class="sectionbumper"></div>');H.append('<div style="margin: 0px 15px 0px 15px;">');H.append('<div id="renamelink').append(K).append('" style="clear:left; font-size:14.0pt; margin-left:5px;">');H.append('<a id="renamehref').append(K).append('" href="').append(E).append('" title=" ">').append(J).append("</a>");H.append("</div>");H.append('<div id="renamediv').append(K).append('" style="display:none; clear:left; margin-left:10px;">');H.append('<input id="renamebox').append(K).append('" type="textbox" size="28" value="').append(J).append('" onkeypress="if(enterPressed(event)) saveRename(').append(K).append("); if(escPressed(event)) toggleRename(").append(K).append(');" />');H.append("</div>");H.append('<div id="fav').append(K).append('details" style="display:none; margin:3px 0px 0px 8px;">');H.append('<a href="').append(E).append('" class="decnone"><img src="/r/images/icons/famfamfam/page_white_go.png" style="border-style:none; vertical-align:-1px; cursor:pointer;" /></a> <a href="').append(E).append('" style="font-size:8.0pt;">View</a>');if(myProfile){H.append('&nbsp; <img src="/r/images/icons/famfamfam/delete12.png" style="vertical-align:-1px; cursor:pointer;" onclick="deleteSearch(').append(K).append(');" /> <a href="javascript:void(0)" style="font-size:8.0pt;" onclick="deleteSearch(').append(K).append(')">Delete</a>');H.append('&nbsp; <img src="/r/images/icons/famfamfam/rename12.gif" style="vertical-align:-1px; cursor:pointer;" onclick="toggleRename(').append(K).append(');" /> <a href="javascript:void(0)" style="font-size:8.0pt;" onclick="toggleRename(').append(K).append(')">Rename</a>')}H.append("</div>");H.append("</div>");H.append('<div class="sectionbumper" style="clear:left;"></div>');H.append("</div>")}setInnerHtml("favpane",H.toString());if(I>0){updateSearchesPaging(I,A,C)}})}function updateSearchesPaging(D,A,E){var C=pageBounds(D,A,E);if(C.pageStart==1&&C.pageEnd==1){return }var B="";if(C.pageStart>1){B+='<a href="javascript:void(0)" onclick="loadFavoriteSearches('+A+", "+parseInt(E-A)+')">Previous</a>'}else{B+='<span class="lightgraytext">Previous</span>'}B+='<span class="darkgraytext" style="padding: 0px 20px 0px 20px;">Page '+C.pageStart+" of "+C.pageEnd+"</span>";if(C.pageEnd>C.pageStart){B+='<a href="javascript:void(0)" onclick="loadFavoriteSearches('+A+", "+parseInt(E+A)+')">Next</a>'}else{B+='<span class="lightgraytext">Next</span>'}setInnerHtml("pagingcontent",B)}function loadFavoritePlaces(A,C){setInnerHtml("pagingcontent","");setInnerHtml("favpane",'<div style="text-align:center;"><img src="/r/images/loading.gif" /><br/>Loading list ...</div>');var B="a=list";B+="&m=places";B+="&cid="+linkClientid;B+="&lim="+A;B+="&off="+C;smartCallXML("/favorites",B,function(F){var H=new StringBuffer();var I=F.getElementsByTagName("count")[0].childNodes[0].nodeValue;if(I==0){H.append('<div class="sectionblk">');H.append('<div class="sectionbumper"></div>');H.append('<div class="darkgraytext" style="margin-left: 5px; text-align:center;">No saved places.</div>');H.append('<div class="sectionbumper" style="clear:left;"></div>');H.append("</div>")}var D=F.getElementsByTagName("item");for(var G=0;G<D.length;G++){var K=(D[G].getElementsByTagName("id"))[0].childNodes[0].nodeValue;var J=(D[G].getElementsByTagName("title"))[0].childNodes[0].nodeValue;var E=(D[G].getElementsByTagName("url"))[0].childNodes[0].nodeValue;H.append('<div class="sectionblock" style="cursor:pointer;" onclick="$(\'fav').append(K).append('details\').toggle()" title="click for favorite details">');H.append('<div class="sectionbumper"></div>');H.append('<div style="margin: 0px 15px 0px 15px;">');H.append('<div id="renamelink').append(K).append('" style="clear:left; font-size:14.0pt; margin-left:5px;">');H.append('<a id="renamehref').append(K).append('" href="').append(E).append('">').append(J).append("</a>");H.append("</div>");H.append('<div id="renamediv').append(K).append('" style="display:none; clear:left; margin-left:10px;">');H.append('<input id="renamebox').append(K).append('" type="textbox" size="28" value="').append(J).append('" onkeypress="if(enterPressed(event)) saveRename(').append(K).append("); if(escPressed(event)) toggleRename(").append(K).append(');" />');H.append("</div>");H.append('<div id="fav').append(K).append('details" style="display:none; margin:3px 0px 0px 8px;">');H.append('<a href="').append(E).append('" class="decnone"><img src="/r/images/icons/famfamfam/page_white_go.png" style="border-style:none; vertical-align:-1px; cursor:pointer;" /></a> <a href="').append(E).append('" style="font-size:8.0pt;">View</a>');if(myProfile){H.append('&nbsp; <img src="/r/images/icons/famfamfam/delete12.png" style="vertical-align:-1px; cursor:pointer;" onclick="deletePlace(').append(K).append(');" /> <a href="javascript:void(0)" style="font-size:8.0pt;" onclick="deletePlace(').append(K).append(')">Delete</a>');H.append('&nbsp; <img src="/r/images/icons/famfamfam/rename12.gif" style="vertical-align:-1px; cursor:pointer;" onclick="toggleRename(').append(K).append(');" /> <a href="javascript:void(0)" style="font-size:8.0pt;" onclick="toggleRename(').append(K).append(')">Rename</a>')}H.append("</div>");H.append("</div>");H.append('<div class="sectionbumper" style="clear:left;"></div>');H.append("</div>")}setInnerHtml("favpane",H.toString());if(I>0){updatePlacesPaging(I,A,C)}})}function updatePlacesPaging(D,A,E){var C=pageBounds(D,A,E);if(C.pageStart==1&&C.pageEnd==1){return }var B="";if(C.pageStart>1){B+='<a href="javascript:void(0)" onclick="loadFavoritePlaces('+A+", "+parseInt(E-A)+')">Previous</a>'}else{B+='<span class="lightgraytext">Previous</span>'}B+='<span class="darkgraytext" style="padding: 0px 20px 0px 20px;">Page '+C.pageStart+" of "+C.pageEnd+"</span>";if(C.pageEnd>C.pageStart){B+='<a href="javascript:void(0)" onclick="loadFavoritePlaces('+A+", "+parseInt(E+A)+')">Next</a>'}else{B+='<span class="lightgraytext">Next</span>'}setInnerHtml("pagingcontent",B)}function setPresencePane(A){setInnerHtml("presencepane",A)}function initPresencePane(){setInnerHtml("presencepane",'<div style="text-align:center;"><img src="/r/images/loading.gif" /><br/>Loading list ...</div>');smartCall("/Presence","",function(A){setPresencePane(A)})}function addPresence(){var A="action=add";A+="&title="+encodeURIComponent(document.getElementById("linktitle").value);A+="&url="+encodeURIComponent(document.getElementById("linkurl").value);smartCall("/Presence",A,function(B){setPresencePane(B);document.getElementById("linktitle").value="Enter a title...";document.getElementById("linkurl").value="http://"})}function removePresence(B){if(!confirm("Are you sure you want to delete this web presence?")){return }var A="action=remove";A+="&pid="+B;smartCall("/Presence",A,function(C){setPresencePane(C)})}function getGroupMembers(F,B,D,G,E,A){var C="action=list&groupid="+B;smartCallXML("/api/group/admin",C,function(Q){var T=nh(Q,"error");if(!T){if(nh(Q,"members")){var L=tag(Q,"members")[0];if(L){L=tag(L,"member")}var K,V,U,I,O;K=V=U=O=I=null;var H=false;var S,R=-1;S=R=-1;var J=0;var P=new StringBuffer();for(var N=0;N<L.length;N++){K=L[N];V=U=O=I=null;S=R=-1;H=false;if(K){if(nh(K,"memberid")){S=nivn(K,"memberid")}if(nh(K,"clientid")){R=nivn(K,"clientid")}if(nh(K,"avatar")){U=nvn(K,"avatar")}if(nh(K,"is_owner")){H=nbvn(K,"is_owner")}if(nh(K,"joined")){V=nvn(K,"joined")}if(nh(K,"name")){I=nvn(K,"name")}if(nh(K,"username")){O=nvn(K,"username")}if(U==null){U="/r/images/geomonkey-avatar.png"}}if(S!=-1&&R!=-1&&V!=null&&O!=null&&U!=null){var M={};M.memberid=S;M.clientid=R;M.username=O;M.name=I;M.avatar=U;M.isOwner=H;M.joined=V;M.can_kick=D;M.can_mod_priv=G;if(M.clientid==F){M.isOwn=true}P.a(generateMemberHTML(M));J++}}if(J<1){P.a("<div style='font-size:16px;line-height:24px;margin-top:10px;'>");P.a("Your group doesn't have any other members yet.<br/>");if(E){P.a("Would you like to <a class='mwu-curpointer' onclick='beginInviteGroupMember(true,").a(A).a(")'>invite</a> someone?")}P.a("</div>")}}$("members").innerHTML=P.toString()}})}function generateMemberHTML(C){var A=generateMemberInnerHTML(C);if(A==null){return""}var B=new StringBuffer();B.a('<div id="').a("member-").a(C.clientid).a('" class="aboutitem member">');B.a(A);B.a("</div>");return B.toString()}function generateMemberInnerHTML(B){if(!B||B.isOwner){return null}var A=new StringBuffer();A.a("<div class='member-avatar'>");A.a("<img src='").a(B.avatar).a("'>");A.a("</div>");A.a("<div class='member-username'><span class='member-label'>Username:</span>");A.a("<a class='mwu-curpointer' href='/profile/").a(B.username).a("'>").a(B.username).a("</a></div>");A.a("<div class='member-joined'>");A.a("<span class='member-label' style='width:110px;'>Group Member Since: </span>").a(getDateString(B.joined));A.a("</div>");if(B.name!=null&&B.name.trim().length>0){A.a("<div class='member-name'><span class='member-label'>Name: </span>").a(B.name).a("</div>")}A.a("<div style='clear:both'></div>");A.a("<div class='member-links'>");if(B.can_mod_priv){A.a("<span id='member-modpriv-link'><a class='mwu-curpointer' onclick='beginSetMemberPrivs(").a(B.clientid).a(")''>Edit Privileges</a></span>")}if(B.can_mod_priv&&B.can_kick){A.a(" --- ")}if(B.isOwn){A.a("<span id='member-depart-link'><a class='mwu-curpointer' onclick='beginDepartMember(").a(B.clientid).a(")'>Leave Group</a></span>")}else{if(B.can_kick){A.a("<span id='member-kick-link'><a class='mwu-curpointer' onclick='beginKickMember(").a(B.clientid).a(")'>Remove From Group</a></span>")}}A.a("</div>");return A.toString()}function beginInviteGroupMember(B,A){showInviteDialog(B,A)}function finishInviteGroupMember(D,A){var E=$("mwu-invite-dialog-username").value;var C=$("mwu-invite-dialog-message").value;if(E==null||E.length==0){flashError("You must supply a username to invite");return }var B="action=invite&username="+encodeURIComponent(E);if(C!=null&&C.length>0){B+="&message="+encodeURIComponent(C)}smartCallXML("/api/group/admin",B,function(G){var J=nh(G,"success");var F=nh(G,"error");if(J){flashNotice("Successfully invited "+E+" to your group");closeInviteDialog();getPendingInvitees(D,A)}else{if(F){var H=tag(G,"error")[0];var I=null;if(nh(H,"message")){I=nvn(H,"message")}if(I){flashError("Unable to invite "+E+" - "+I.toLowerCase())}else{flashError("Unable to invite "+E+" to your group - Unknown error")}}}})}function generateInviteDialog(E,B){var A,D,C;var F=new Element("div",{"id":"mwu-invite-dialog"}).setStyle({"display":"none"}).insert(new Element("div",{"class":"mwu-dialogbackground"})).insert(new Element("div").addClassName("mwu-dialog").insert(new Element("div").addClassName("mwu-dialog-header").insert(new Element("span").addClassName("mwu-dialog-title").insert("Invite User To Group")).insert(A=new Element("div",{"id":"mwu-invite-dialog-x","class":"mwu-dialog-x"}).insert(new Element("a",{"href":"javascript:void(0);"}).insert("X")))).insert(new Element("div").addClassName("mwu-dialog-content").insert(new Element("div").addClassName("mwu-dialog-bumper")).insert(new Element("div").addClassName("mwu-dialog-content-field-top").insert(new Element("span").addClassName("mwu-dialog-input-label").setStyle({"width":"90px"}).insert("Username:")).insert(new Element("input",{"id":"mwu-invite-dialog-username","type":"text"}).addClassName("mwu-dialog-input"))).insert(new Element("div").addClassName("mwu-dialog-content-field").insert(new Element("span").addClassName("mwu-dialog-textarea-label").setStyle({"width":"90px","textAlign":"right"}).insert("Personalize<br/>Message:")).insert(new Element("textarea",{"id":"mwu-invite-dialog-message","type":"text","alt":"Not required"}).addClassName("mwu-dialog-textarea"))).insert(new Element("div").addClassName("mwu-dialog-buttons").insert(C=new Element("button",{"id":"mwu-invite-dialog-button-cancel","class":"mwu-dialog-button-left"}).insert("Cancel")).insert(D=new Element("button",{"id":"mwu-invite-dialog-button-submit"}).insert("Submit"))).insert(new Element("div").addClassName("mwu-dialog-bumper"))));A.onclick=closeInviteDialog.bind(this);D.onclick=finishInviteGroupMember.bind(this,E,B);C.onclick=closeInviteDialog.bind(this);$(document.body).insert(F)}function clearInviteDialog(){if($("mwu-invite-dialog")){$("mwu-invite-dialog-username").value="";$("mwu-invite-dialog-message").value=""}}function closeInviteDialog(){if($("mwu-invite-dialog")){$("mwu-invite-dialog").hide()}clearInviteDialog()}function showInviteDialog(B,A){if(!$("mwu-invite-dialog")){generateInviteDialog(B,A)}$("mwu-invite-dialog").show();positionMWUDialogs()}function getPendingInvitees(C,A){var B="action=invitees";smartCallXML("/api/group/admin",B,function(G){var M=nh(G,"error");if(!M){if(nh(G,"members")){var S=tag(G,"members")[0];if(S){S=tag(S,"member")}var L,E,J,R,U,H,I;L=E=J=R=H=I=U=null;var F=false;var T,P,Q;T=P=Q=-1;var N=0;var K=new StringBuffer();if(S&&S.length>0){for(var O=0;O<S.length;O++){L=S[O];E=J=R=H=U=null;T=Q=P=-1;F=false;if(L){if(nh(L,"memberid")){T=nivn(L,"memberid")}if(nh(L,"clientid")){P=nivn(L,"clientid")}if(nh(L,"avatar")){R=nvn(L,"avatar")}if(nh(L,"is_owner")){F=nbvn(L,"is_owner")}if(nh(L,"invited")){E=nvn(L,"invited")}if(nh(L,"inviter")){Q=nivn(L,"inviter")}if(nh(L,"inv_username")){I=nvn(L,"inv_username")}if(nh(L,"message")){J=nvn(L,"message")}if(nh(L,"name")){U=nvn(L,"name")}if(nh(L,"username")){H=nvn(L,"username")}if(R==null){R="/r/images/geomonkey-avatar.png"}}if(T!=-1&&P!=-1&&E!=null&&H!=null&&R!=null){var D={};D.memberid=T;D.clientid=P;D.username=H;D.name=U;D.avatar=R;D.isOwner=F;D.invited=E;D.inviter=Q;D.inv_username=I;D.message=J;K.a(generateMemberInviteHTML(D,C,A));N++}}}else{K.a("<div style='font-size:16px;line-height:24px;margin-top:10px;'>");K.a("Your group doesn't have any pending invitations.<br/>");if(C){K.a("Would you like to <a class='mwu-curpointer' onclick='beginInviteGroupMember(");K.a(C).a(", ").a(A).a(")'>invite</a> someone?")}K.a("</div>")}}$("invitees").innerHTML=K.toString()}})}function generateMemberInviteHTML(E,D,A){var B=generateMemberInviteInnerHTML(E,D,A);if(B==null){return""}var C=new StringBuffer();C.a('<div id="').a("member-invite-").a(E.clientid).a('" class="aboutitem member">');C.a(B);C.a("</div>");return C.toString()}function generateMemberInviteInnerHTML(D,C,A){if(!D||D.isOwner){return null}if(D.inv_username==null||D.inv_username.length==0){D.inv_username="Unknown"}var B=new StringBuffer();B.a("<div class='member-avatar'>");B.a("<img src='").a(D.avatar).a("'>");B.a("</div>");B.a("<div class='member-username'>");B.a("<span class='member-label'>Username:</span>");B.a("<a class='mwu-curpointer' href='/profile/").a(D.username).a("'>").a(D.username).a("</a>");if(D.name!=null){B.a("<br/><span class='member-label'>Name: </span>");B.a("<span class='mwu-member-name'>").a(D.name).a("</span>")}B.a("</div>");B.a("<div class='member-invite-details'>");B.a("<span class='member-invite-label'>Invited on: </span>").a(getDateString(D.invited)).a("<br/>");B.a("<span class='member-invite-label'>Invited by: </span>").a(D.inv_username).a("<br/>");B.a("</div>");B.a("<div style='clear:both;'></div>");B.a("<div style='float:right'>");if(A){B.a("<a class='mwu-curpointer' onclick='beginRevokeInvitation(").a(D.clientid).a(")'>Revoke Invitation</a>")}B.a("</div></div>");B.a("<div style='clear:both'></div>");return B.toString()}function beginSetMemberPrivs(B){var A="action=member&memberid="+B;smartCallXML("/api/group/admin",A,function(E){var D=nh(E,"error");if(!D){if(nh(E,"member")){var C={id:B};var F=tag(E,"member")[0];if(nh(F,"can_admin_group")){C.can_mod_settings=nbvn(F,"can_admin_group")}if(nh(F,"can_mod_priv")){C.can_mod_priv=nbvn(F,"can_mod_priv")}if(nh(F,"can_copy")){C.can_copy=nbvn(F,"can_copy")}if(nh(F,"can_delete")){C.can_delete=nbvn(F,"can_delete")}if(nh(F,"can_export")){C.can_export=nbvn(F,"can_export")}if(nh(F,"can_revoke")){C.can_revoke=nbvn(F,"can_revoke")}if(nh(F,"can_invite")){C.can_invite=nbvn(F,"can_invite")}if(nh(F,"can_kick")){C.can_kick=nbvn(F,"can_kick")}if(nh(F,"can_read")){C.can_read=nbvn(F,"can_read")}if(nh(F,"can_write")){C.can_write=nbvn(F,"can_write")}if(nh(F,"can_mod_settings")){C.can_publish=nbvn(F,"can_mod_settings")}populateModPrivDialog(C);showModPrivDialog()}}})}function finishSetMemberPrivs(){var A=new StringBuffer();A.a("action=setprivs");A.a("&memberid=").a($("mwu-priv-memberid").value);A.a("&can_kick=").a($("mwu-priv-kick").checked);A.a("&can_admin_group=").a($("mwu-priv-admin-group").checked);A.a("&can_mod_priv=").a($("mwu-priv-modpriv").checked);A.a("&can_read=").a($("mwu-priv-read").checked);A.a("&can_write=").a($("mwu-priv-write").checked);A.a("&can_delete=").a($("mwu-priv-delete").checked);A.a("&can_copy=").a($("mwu-priv-copy").checked);A.a("&can_export=").a($("mwu-priv-export").checked);A.a("&can_mod_settings=").a($("mwu-priv-mod-settings").checked);A.a("&can_invite=").a($("mwu-priv-invite").checked);A.a("&can_revoke=").a($("mwu-priv-revoke").checked);smartCallXML("/api/group/admin",A.toString(),function(C){if(nh(C,"success")){flashNotice("Successfully updated permissions");closeModPrivDialog()}else{var B=tag(C,B)[0];if(nh(B,"msg")){var D=nvn(B,"msg");flashError(D)}else{flashError("Unable to update ")}}})}function populateModPrivDialog(A){if(!$("mwu-modpriv-dialog")){generateModPrivDialog()}$("mwu-priv-memberid").value=A.id;if(A.can_kick){$("mwu-priv-kick").checked=true}if(A.can_mod_priv){$("mwu-priv-modpriv").checked=true}if(A.can_mod_settings){$("mwu-priv-admin-group").checked=true}if(A.can_delete){$("mwu-priv-delete").checked=true}if(A.can_copy){$("mwu-priv-copy").checked=true}if(A.can_export){$("mwu-priv-export").checked=true}if(A.can_revoke){$("mwu-priv-revoke").checked=true}if(A.can_invite){$("mwu-priv-invite").checked=true}if(A.can_write){$("mwu-priv-write").checked=true}if(A.can_read){$("mwu-priv-read").checked=true}if(A.can_publish){$("mwu-priv-mod-settings").checked=true}}function generateModPrivDialog(){var A,D,C;var B=new Element("div",{"id":"mwu-modpriv-dialog"}).setStyle({"display":"none"}).insert(new Element("div",{"class":"mwu-dialogbackground"})).insert(new Element("div").addClassName("mwu-dialog").insert(new Element("div").addClassName("mwu-dialog-header").insert(new Element("span").addClassName("mwu-dialog-title").insert("Edit Member Privileges")).insert(A=new Element("div",{"id":"mwu-modpriv-dialog-x","class":"mwu-dialog-x"}).insert(new Element("a",{"href":"javascript:void(0);"}).insert("X")))).insert(new Element("div").addClassName("mwu-dialog-content").insert(new Element("div").addClassName("mwu-dialog-bumper")).insert(new Element("div").addClassName("mwu-dialog-content-field-top").insert(new Element("span").addClassName("mwu-dialog-input-label").setStyle({"width":"315px"}).insert("Can remove other members from group:")).insert(new Element("input",{"id":"mwu-priv-kick","type":"checkbox"}).addClassName("mwu-dialog-checkbox"))).insert(new Element("div").addClassName("mwu-dialog-content-field").insert(new Element("span").addClassName("mwu-dialog-input-label").setStyle({"width":"315px"}).insert("Can change privileges of other members:")).insert(new Element("input",{"id":"mwu-priv-modpriv","type":"checkbox"}).addClassName("mwu-dialog-checkbox"))).insert(new Element("div").addClassName("mwu-dialog-content-field").insert(new Element("span").addClassName("mwu-dialog-input-label").setStyle({"width":"315px"}).insert("Can administer group settings and features:")).insert(new Element("input",{"id":"mwu-priv-admin-group","type":"checkbox"}).addClassName("mwu-dialog-checkbox"))).insert(new Element("div").addClassName("mwu-dialog-content-field").insert(new Element("span").addClassName("mwu-dialog-input-label").setStyle({"width":"315px"}).insert("Can publish maps and change map settings:")).insert(new Element("input",{"id":"mwu-priv-mod-settings","type":"checkbox"}).addClassName("mwu-dialog-checkbox"))).insert(new Element("div").addClassName("mwu-dialog-content-field").insert(new Element("span").addClassName("mwu-dialog-input-label").setStyle({"width":"315px"}).insert("Can copy group data to their own account:")).insert(new Element("input",{"id":"mwu-priv-copy","type":"checkbox"}).addClassName("mwu-dialog-checkbox"))).insert(new Element("div").addClassName("mwu-dialog-content-field").insert(new Element("span").addClassName("mwu-dialog-input-label").setStyle({"width":"315px"}).insert("Can export group data (e.g. to KML):")).insert(new Element("input",{"id":"mwu-priv-export","type":"checkbox"}).addClassName("mwu-dialog-checkbox"))).insert(new Element("div").addClassName("mwu-dialog-content-field").insert(new Element("span").addClassName("mwu-dialog-input-label").setStyle({"width":"315px"}).insert("Can permanently delete group data:")).insert(new Element("input",{"id":"mwu-priv-delete","type":"checkbox"}).addClassName("mwu-dialog-checkbox"))).insert(new Element("div").addClassName("mwu-dialog-content-field").insert(new Element("span").addClassName("mwu-dialog-input-label").setStyle({"width":"315px"}).insert("Can revoke pending invitations:")).insert(new Element("input",{"id":"mwu-priv-revoke","type":"checkbox"}).addClassName("mwu-dialog-checkbox"))).insert(new Element("div").addClassName("mwu-dialog-content-field").insert(new Element("span").addClassName("mwu-dialog-input-label").setStyle({"width":"315px"}).insert("Can invite other users to join group:")).insert(new Element("input",{"id":"mwu-priv-invite","type":"checkbox"}).addClassName("mwu-dialog-checkbox"))).insert(new Element("div").addClassName("mwu-dialog-content-field").insert(new Element("span").addClassName("mwu-dialog-input-label").setStyle({"width":"315px"}).insert("Can create group data:")).insert(new Element("input",{"id":"mwu-priv-write","type":"checkbox"}).addClassName("mwu-dialog-checkbox"))).insert(new Element("div").addClassName("mwu-dialog-content-field").insert(new Element("span").addClassName("mwu-dialog-input-label").setStyle({"width":"315px"}).insert("Can view group data:")).insert(new Element("input",{"id":"mwu-priv-read","type":"checkbox"}).addClassName("mwu-dialog-checkbox"))).insert(new Element("div").addClassName("mwu-dialog-buttons").insert(C=new Element("button",{"id":"mwu-modpriv-dialog-button-cancel","class":"mwu-dialog-button-left"}).insert("Cancel")).insert(D=new Element("button",{"id":"mwu-modpriv-dialog-button-submit"}).insert("Submit"))).insert(new Element("input",{"id":"mwu-priv-memberid","type":"hidden"})).insert(new Element("div").addClassName("mwu-dialog-bumper"))));A.onclick=closeModPrivDialog.bind(this);D.onclick=finishSetMemberPrivs.bind(this);C.onclick=closeModPrivDialog.bind(this);$(document.body).insert(B)}function clearModPrivDialog(){if($("mwu-modpriv-dialog")){$("mwu-priv-kick").checked=false;$("mwu-priv-modpriv").checked=false;$("mwu-priv-admin-group").checked=false;$("mwu-priv-delete").checked=false;$("mwu-priv-copy").checked=false;$("mwu-priv-export").checked=false;$("mwu-priv-revoke").checked=false;$("mwu-priv-invite").checked=false;$("mwu-priv-write").checked=false;$("mwu-priv-read").checked=false;$("mwu-priv-mod-settings").checked=false}}function closeModPrivDialog(){if($("mwu-modpriv-dialog")){$("mwu-modpriv-dialog").hide()}clearModPrivDialog()}function showModPrivDialog(){if(!$("mwu-modpriv-dialog")){generateModPrivDialog()}$("mwu-modpriv-dialog").show();positionMWUDialogs()}function beginKickMember(B){var A="You are about to remove this member from your group.<br/>To join, the user will have to be reinvited.<br/><br/>To continue, type <i>KICK</i> as a confirmation.<br>Otherwise, click <i>Cancel</i>";showKickDialog(B,"Remove Member From Group",A,finishKickMember)}function finishKickMember(){var B=$("mwu-kick-dialog-confirmation").value;var C=$("mwu-kick-dialog-reason").value;if(B!=null&&B.toUpperCase()=="KICK"){var D=$("mwu-kick-dialog-id").value;var A=new StringBuffer();A.a("action=kick&kick_clientid=").a(D);if(C!=null&&C.length>1){A.a("&reason=").a(encodeURIComponent(C))}smartCallXML("/api/group/admin",A.toString(),function(F){var H=nh(F,"success");if(H){closeKickDialog();$("member-"+D).style.display="none";flashNotice("Successfully kicked member from group")}else{if(nh(F,"error")){var E=tag(F,"error")[0];var G=null;if(nh(E,"message")){G=nvn(E,"message")}if(G&&G.length>0){flashError(G)}else{flashError("Unable to kick user")}}}})}else{if(B&&B.length>0){flashError("Invalid confirmation")}else{closeKickDialog()}}}function generateKickDialog(G,F,E){var A,C,B;var D=new Element("div",{"id":"mwu-kick-dialog"}).setStyle({"display":"none"}).insert(new Element("div",{"class":"mwu-dialogbackground"})).insert(new Element("div").addClassName("mwu-dialog").insert(new Element("div").addClassName("mwu-dialog-header").insert(new Element("span",{"id":"mwu-kick-dialog-title"}).addClassName("mwu-dialog-title").insert(F)).insert(A=new Element("div").addClassName("mwu-dialog-x").insert(new Element("a",{"id":"mwu-kick-button-x","href":"javascript:void(0);"}).insert("X")))).insert(new Element("div").addClassName("mwu-dialog-content").setStyle({"width":"425px"}).insert(new Element("div").addClassName("mwu-dialog-bumper")).insert(new Element("div",{"id":"mwu-kick-dialog-msg","class":"mwu-dialog-content-field-top"}).insert(new Element("span").setStyle({"lineHeight":"20px"}).insert(E)).insert(new Element("br")).insert(new Element("br")).insert("Confirmation:").insert(new Element("input",{"id":"mwu-kick-dialog-confirmation"}).addClassName("mwu-dialog-input").setStyle({"width":"380px"})).insert(new Element("div").addClassName("mwu-dialog-content-field").setStyle({"padding":"10px 0","margin":"0"}).insert("Reason <span style='font-size: 0.9em'>(optional)</span>:").insert(new Element("textarea",{"id":"mwu-kick-dialog-reason","type":"text","alt":"Not required"}).addClassName("mwu-dialog-textarea").setStyle({"width":"380px","height":"125px"}))).insert(new Element("input",{"id":"mwu-kick-dialog-id","type":"hidden","value":G}))).insert(new Element("div").addClassName("mwu-dialog-buttons").insert(B=new Element("button",{"id":"mwu-kick-dialog-cancel"}).addClassName("mwu-dialog-button-left").insert("Cancel")).insert(C=new Element("button",{"id":"mwu-kick-dialog-submit"}).insert("Submit"))).insert(new Element("div").addClassName("mwu-dialog-bumper"))));A.onclick=closeKickDialog.bind(this);B.onclick=closeKickDialog.bind(this);$(document.body).insert(D)}function showKickDialog(D,B,A,C){if(!$("mwu-kick-dialog")){generateKickDialog(D,B,A)}else{$("mwu-kick-dialog-title").value=B;$("mwu-kick-dialog-msg").value=A}$("mwu-kick-dialog-id").value=D;$("mwu-kick-dialog-submit").onclick=C;$("mwu-kick-dialog").show();positionMWUDialogs()}function clearKickDialog(){if($("mwu-kick-dialog")){$("mwu-kick-dialog-id").value="";$("mwu-kick-dialog-title").value="";$("mwu-kick-dialog-msg").value="";$("mwu-kick-dialog-confirmation").value=""}}function closeKickDialog(){if($("mwu-kick-dialog")){$("mwu-kick-dialog").hide()}clearKickDialog()}function beginDepartMember(B){var A="You are about to leave your group.<br/>To rejoin, you will have to be reinvited.<br/><br/>To continue, type <i>LEAVE</i> as a confirmation.<br>Otherwise, click <i>Cancel</i>";showDepartDialog(B,"Leave Group",A,finishDepartMember)}function finishDepartMember(){var B=$("mwu-depart-dialog-confirmation").value;var C=$("mwu-depart-dialog-reason").value;if(B!=null&&B.toUpperCase()=="LEAVE"){var D=$("mwu-depart-dialog-id").value;var A=new StringBuffer();A.a("action=depart&depart_clientid=").a(D);if(C!=null&&C.length>1){A.a("&reason=").a(encodeURIComponenr(C))}smartCallXML("/api/group/admin",A.toString(),function(F){var H=nh(F,"success");if(H){closeDepartDialog();$("member-"+D).style.display="none";flashNotice("Successfully departed member from group");setTimeout(function(){window.location.href=window.location.href},3500)}else{if(nh(F,"error")){var E=tag(F,"error")[0];var G=null;if(nh(E,"message")){G=nvn(E,"message")}if(G&&G.length>0){flashError(G)}else{flashError("Unable to depart user")}}}})}else{if(B&&B.length>0){flashError("Invalid confirmation")}else{closeDepartDialog()}}}function generateDepartDialog(G,F,E){var A,D,B;var C=new Element("div",{"id":"mwu-depart-dialog"}).setStyle({"display":"none"}).insert(new Element("div",{"class":"mwu-dialogbackground"})).insert(new Element("div").addClassName("mwu-dialog").insert(new Element("div").addClassName("mwu-dialog-header").insert(new Element("span",{"id":"mwu-depart-dialog-title"}).addClassName("mwu-dialog-title").insert(F)).insert(A=new Element("div").addClassName("mwu-dialog-x").insert(new Element("a",{"id":"mwu-depart-button-x","href":"javascript:void(0);"}).insert("X")))).insert(new Element("div").addClassName("mwu-dialog-content").setStyle({"width":"425px"}).insert(new Element("div").addClassName("mwu-dialog-bumper")).insert(new Element("div",{"id":"mwu-depart-dialog-msg","class":"mwu-dialog-content-field-top"}).insert(new Element("span").setStyle({"lineHeight":"20px"}).insert(E)).insert(new Element("br")).insert(new Element("br")).insert("Confirmation:").insert(new Element("input",{"id":"mwu-depart-dialog-confirmation"}).addClassName("mwu-dialog-input").setStyle({"width":"380px"})).insert(new Element("div").addClassName("mwu-dialog-content-field").setStyle({"padding":"10px 0","margin":"0"}).insert("Reason <span style='font-size: 0.9em'>(optional)</span>:").insert(new Element("textarea",{"id":"mwu-depart-dialog-reason","type":"text","alt":"Not required"}).addClassName("mwu-dialog-textarea").setStyle({"width":"380px","height":"125px"}))).insert(new Element("input",{"id":"mwu-depart-dialog-id","type":"hidden","value":G}))).insert(new Element("div").addClassName("mwu-dialog-buttons").insert(B=new Element("button",{"id":"mwu-depart-dialog-cancel"}).addClassName("mwu-dialog-button-left").insert("Cancel")).insert(D=new Element("button",{"id":"mwu-depart-dialog-submit"}).insert("Submit"))).insert(new Element("div").addClassName("mwu-dialog-bumper"))));A.onclick=closeDepartDialog.bind(this);B.onclick=closeDepartDialog.bind(this);$(document.body).insert(C)}function showDepartDialog(D,B,A,C){if(!$("mwu-depart-dialog")){generateDepartDialog(D,B,A)}else{$("mwu-depart-dialog-title").value=B;$("mwu-depart-dialog-msg").value=A}$("mwu-depart-dialog-id").value=D;$("mwu-depart-dialog-submit").onclick=C;$("mwu-depart-dialog").show();positionMWUDialogs()}function clearDepartDialog(){if($("mwu-depart-dialog")){$("mwu-depart-dialog-id").value="";$("mwu-depart-dialog-title").value="";$("mwu-depart-dialog-msg").value="";$("mwu-depart-dialog-confirmation").value=""}}function closeDepartDialog(){if($("mwu-depart-dialog")){$("mwu-depart-dialog").hide()}clearDepartDialog()}function beginRevokeInvitation(B){var A="You are about to revoke this user's invitation.<br/>To join, the user will have to be reinvited.<br/>If the user tries to redeem their invitation, they will<br/>be informed that their invitation is no longer valid<br/><br/>To continue, type <i>REVOKE</i> as a confirmation.<br/>Otherwise, click <i>Cancel</i>";showRevokeDialog(B,"Revoke Group Invitation",A,finishRevokeInvitation)}function finishRevokeInvitation(){var B=$("mwu-revoke-dialog-confirmation").value;var C=$("mwu-revoke-dialog-reason").value;if(B!=null&&B.toUpperCase()=="REVOKE"){var D=$("mwu-revoke-dialog-id").value;var A=new StringBuffer();A.a("action=revoke&revoke_clientid=").a(D);if(C!=null&&C.length>1){A.a("&reason=").a(encodeURIComponent(C))}smartCallXML("/api/group/admin",A.toString(),function(F){var I=nh(F,"success");if(I){var H=$("mwu-revoke-dialog-id").value;$("member-invite-"+H).style.display="none";closeRevokeDialog();flashNotice("Successfully revoked invitation")}else{if(nh(F,"error")){var E=tag(F,"error")[0];var G=null;if(nh(E,"message")){G=nvn(E,"message")}if(G&&G.length>0){flashError(G)}else{flashError("Unable to revoke invitation")}}}})}else{if(B&&B.length>0){flashError("Invalid confirmation")}else{closeRevokeDialog()}}}function generateRevokeDialog(G,F,E){var A,C,B;var D=new Element("div",{"id":"mwu-revoke-dialog"}).setStyle({"display":"none"}).insert(new Element("div",{"class":"mwu-dialogbackground"})).insert(new Element("div").addClassName("mwu-dialog").insert(new Element("div").addClassName("mwu-dialog-header").insert(new Element("span",{"id":"mwu-revoke-dialog-title"}).addClassName("mwu-dialog-title").insert(F)).insert(A=new Element("div").addClassName("mwu-dialog-x").insert(new Element("a",{"id":"mwu-revoke-button-x","href":"javascript:void(0);"}).insert("X")))).insert(new Element("div").addClassName("mwu-dialog-content").setStyle({"width":"390px"}).insert(new Element("div").addClassName("mwu-dialog-bumper")).insert(new Element("div",{"id":"mwu-revoke-dialog-msg","class":"mwu-dialog-content-field-top"}).insert(new Element("span").setStyle({"lineHeight":"20px"}).insert(E)).insert(new Element("br")).insert(new Element("br")).insert("Confirmation:").insert(new Element("input",{"id":"mwu-revoke-dialog-confirmation"}).addClassName("mwu-dialog-input").setStyle({"width":"345px"})).insert(new Element("div").addClassName("mwu-dialog-content-field").setStyle({"padding":"10px 0","margin":"0"}).insert("Reason <span style='font-size: 0.9em'>(optional)</span>:").insert(new Element("textarea",{"id":"mwu-revoke-dialog-reason","type":"text","alt":"Not required"}).addClassName("mwu-dialog-textarea").setStyle({"width":"345px","height":"125px"}))).insert(new Element("input",{"id":"mwu-revoke-dialog-id","type":"hidden","value":G}))).insert(new Element("div").addClassName("mwu-dialog-buttons").insert(B=new Element("button",{"id":"mwu-revoke-dialog-cancel"}).addClassName("mwu-dialog-button-left").insert("Cancel")).insert(C=new Element("button",{"id":"mwu-revoke-dialog-submit"}).insert("Submit"))).insert(new Element("div").addClassName("mwu-dialog-bumper"))));A.onclick=closeRevokeDialog.bind(this);B.onclick=closeRevokeDialog.bind(this);$(document.body).insert(D)}function showRevokeDialog(D,B,A,C){if(!$("mwu-revoke-dialog")){generateRevokeDialog(D,B,A)}else{$("mwu-revoke-dialog-title").value=B;$("mwu-revoke-dialog-msg").value=A}$("mwu-revoke-dialog-id").value=D;$("mwu-revoke-dialog-submit").onclick=C;$("mwu-revoke-dialog").show();positionMWUDialogs()}function clearRevokeDialog(){if($("mwu-revoke-dialog")){$("mwu-revoke-dialog-id").value="";$("mwu-revoke-dialog-title").value="";$("mwu-revoke-dialog-msg").value="";$("mwu-revoke-dialog-confirmation").value=""}}function closeRevokeDialog(){if($("mwu-revoke-dialog")){$("mwu-revoke-dialog").hide()}clearRevokeDialog()}function generateConfirmationDialog(G,F,E){var A,D,C;var B=new Element("div",{"id":"mwu-confirmation-dialog"}).setStyle({"display":"none"}).insert(new Element("div",{"class":"mwu-dialogbackground"})).insert(new Element("div").addClassName("mwu-dialog").insert(new Element("div").addClassName("mwu-dialog-header").insert(new Element("span",{"id":"mwu-confirmation-dialog-title"}).addClassName("mwu-dialog-title").insert(F)).insert(A=new Element("div").addClassName("mwu-dialog-x").insert(new Element("a",{"id":"mwu-confirmation-button-x","href":"javascript:void(0);"}).insert("X")))).insert(new Element("div").addClassName("mwu-dialog-content").setStyle({"width":"425px"}).insert(new Element("div").addClassName("mwu-dialog-bumper")).insert(new Element("div",{"id":"mwu-confirmation-dialog-msg","class":"mwu-dialog-content-field-top"}).insert(E).insert(new Element("br")).insert(new Element("br")).insert(new Element("input",{"id":"mwu-confirmation-dialog-confirmation"}).addClassName("mwu-dialog-input").setStyle({"width":"380px"})).insert(new Element("input",{"id":"mwu-confirmation-dialog-id","type":"hidden"}))).insert(new Element("div").addClassName("mwu-dialog-buttons").insert(C=new Element("button",{"id":"mwu-confirmation-dialog-cancel"}).addClassName("mwu-dialog-button-left").insert("Cancel")).insert(D=new Element("button",{"id":"mwu-confirmation-dialog-submit"}).insert("Submit"))).insert(new Element("div").addClassName("mwu-dialog-bumper"))));A.onclick=closeConfirmationDialog.bind(this);C.onclick=closeConfirmationDialog.bind(this);$(document.body).insert(B)}function showConfirmationDialog(D,B,A,C){if($("mwu-confirmation-dialog")){$("mwu-confirmation-dialog").remove()}generateConfirmationDialog(D,B,A);$("mwu-confirmation-dialog-id").value=D;$("mwu-confirmation-dialog-submit").onclick=C;$("mwu-confirmation-dialog").show();positionMWUDialogs()}function clearConfirmationDialog(){if($("mwu-confirmation-dialog")){$("mwu-confirmation-dialog-id").value="";$("mwu-confirmation-dialog-title").value="";$("mwu-confirmation-dialog-msg").value="";$("mwu-confirmation-dialog-confirmation").value=""}}function closeConfirmationDialog(){if($("mwu-confirmation-dialog")){$("mwu-confirmation-dialog").hide()}clearConfirmationDialog()}function getGroupRateables(){var A="action=list";smartCallXML("/api/rateable",A,function(K){var M=nh(K,"error");if(!M){if(nh(K,"rateables")){var E=tag(K,"rateables")[0];if(E){E=tag(E,"rateable")}var B,C,O,L,G,N,F,J;B=O=L=F=J=null;C=G=N=-1;var D=0;var I=new StringBuffer();for(var H=0;H<E.length;H++){B=E[H];if(B){if(nh(B,"id")){C=nivn(B,"id")}if(nh(B,"title")){O=nvn(B,"title")}if(nh(B,"description")){L=nvn(B,"description")}if(nh(B,"min")){G=nivn(B,"min")}if(nh(B,"max")){N=nivn(B,"max")}if(nh(B,"created")){F=nvn(B,"created")}if(nh(B,"modified")){J=nvn(B,"modified")}else{J=F}}if(C!=-1&&O!=null&&G!=-1&&N!=-1){I.a(generateRateableHTML(C,O,L,G,N,F,J));D++}}if(D==0){I.a("<h3>You haven't created any rateable items yet</h3>")}}$("rateables").innerHTML=I.toString()}else{var M=tag(K,"error")[0];var P=null;if(nh(M,"message")){P=nvn(M,"message")}if(P&&P.length>0){$("rateables").innerHTML="<div style='font-size:13pt;margin-top:10px;'>"+P+"</div>"}else{$("rateables").innerHTML="<div style='font-size:13pt;margin-top:10px;'>An error occurred loading Rateable items</div>"}}})}function generateRateableHTML(H,F,E,D,A,G,B){var C=new StringBuffer();C.a('<div id="').a("rate-").a(H).a('" class="aboutitem rateable">');C.a(generateRateableInnerHTML(H,F,E,D,A,G,B));C.a("</div>");return C.toString()}function generateRateableInnerHTML(H,F,E,D,A,G,B){var C=new StringBuffer();C.a('<div class="rate-title">');C.a("<span id='rate-").a(H).a("-title'>").a(F).a("</span>");C.a('<div class="rate-rates">');C.a('<span class="rate-label">Minimum rating:</span>').a("<span id='rate-").a(H).a("-min'>").a(D).a("</span>").a('&nbsp;&nbsp;&nbsp;&nbsp;<span class="rate-label">Maximum rating:</span>').a("<span id='rate-").a(H).a("-max'>").a(A).a("</span>");C.a("</div>");C.a("</div>");C.a('<div class="rate-dates">');C.a('<span class="rate-label" style="font-size:1em;">Created:</span>').a(getDateString(G)).a("<br/>");C.a('<span class="rate-label" style="font-size:1em;">Updated:</span>').a(getDateString(B));C.a("</div>");C.a('<div style="clear:both;"></div>');C.a('<span class="rate-label">Description:</span>').a("<span id='rate-").a(H).a("-desc'>").a(E).a("</span>").a("<br/>");C.a('<span style="font-size:0.8em;float:right">');C.a("<a class='mwu-curpointer' onclick='beginEditRateable("+H+");'>Edit</a> --- <a class='mwu-curpointer' onclick=\"beginDeleteRateable("+H+');">Delete</a>');C.a("</span>");C.a("<div style='clear:right'></div>");return C.toString()}function generateRateableDialog(){var B,D,C;var A=new Element("div",{"id":"mwu-rateable-dialog"}).setStyle({"display":"none"}).insert(new Element("div",{"class":"mwu-dialogbackground"})).insert(new Element("div").addClassName("mwu-dialog").insert(new Element("div").addClassName("mwu-dialog-header").insert(new Element("span").addClassName("mwu-dialog-title").insert("Create Rateable Item")).insert(B=new Element("div").addClassName("mwu-dialog-x").insert(new Element("a",{"id":"mwu-rateable-button-x","href":"javascript:void(0);"}).insert("X")))).insert(new Element("div").addClassName("mwu-dialog-content").insert(new Element("div").addClassName("mwu-dialog-bumper")).insert(new Element("div").addClassName("mwu-dialog-content-field-top").insert(new Element("span").addClassName("mwu-dialog-input-label").setStyle({"width":"125px"}).insert("Title:")).insert(new Element("input",{"id":"mwu-rateable-title"}).addClassName("mwu-dialog-input").setStyle({"width":"300px"}))).insert(new Element("div").addClassName("mwu-dialog-content-field").insert(new Element("span").addClassName("mwu-dialog-input-label mwu-dialog-textarea-label").setStyle({"width":"125px"}).insert("Description:")).insert(new Element("textarea",{"id":"mwu-rateable-desc"}).addClassName("mwu-dialog-textarea"))).insert(new Element("div").addClassName("mwu-dialog-content-field").insert(new Element("span").addClassName("mwu-dialog-input-label").setStyle({"width":"125px","float":"left","display":"block","marginTop":"3px"}).insert("Minimum Rating:").insert(new Element("br")).insert(new Element("span",{"class":"mwu-dialog-input-label"}).setStyle({"fontSize":"0.7em"}).insert("(1 - 10)"))).insert(new Element("input",{"id":"mwu-rateable-min"}).addClassName("mwu-dialog-input").setStyle({"width":"100px"})).insert(new Element("div").setStyle({"clear":"both"}))).insert(new Element("div").addClassName("mwu-dialog-content-field").insert(new Element("span").addClassName("mwu-dialog-input-label").setStyle({"width":"125px","float":"left","display":"block","marginTop":"3px"}).insert("Maximum Rating:").insert(new Element("br")).insert(new Element("span",{"class":"mwu-dialog-input-label"}).setStyle({"fontSize":"0.7em"}).insert("(1 - 10)"))).insert(new Element("input",{"id":"mwu-rateable-max"}).addClassName("mwu-dialog-input").setStyle({"width":"100px"})).insert(new Element("div").setStyle({"clear":"both"}))).insert(new Element("div").addClassName("mwu-dialog-buttons").insert(C=new Element("button",{"id":"mwu-rateable-cancel"}).addClassName("mwu-dialog-button-left").insert("Cancel")).insert(D=new Element("button",{"id":"mwu-rateable-submit"}).insert("Submit"))).insert(new Element("div").addClassName("mwu-dialog-bumper"))));B.onclick=closeRateableDialog.bind(this);C.onclick=closeRateableDialog.bind(this);$(document.body).insert(A)}function closeRateableDialog(){if($("mwu-rateable-dialog")){$("mwu-rateable-dialog").hide()}resetRateableInputs()}function resetRateableInputs(){if($("mwu-rateable-title")){$("mwu-rateable-title").value=""}if($("mwu-rateable-desc")){$("mwu-rateable-desc").value=""}if($("mwu-rateable-min")){$("mwu-rateable-min").value=""}if($("mwu-rateable-max")){$("mwu-rateable-max").value=""}}function beginCreateRateable(){if(!$("mwu-rateable-dialog")){generateRateableDialog()}$("mwu-rateable-submit").onclick=finishCreateRateable.bind(this);showRateableDialog()}function finishCreateRateable(){if(!$("mwu-rateable-dialog")){generateRateableDialog();return }var E=$("mwu-rateable-title").value;var D=$("mwu-rateable-desc").value;var C=parseInt($("mwu-rateable-min").value);var A=parseInt($("mwu-rateable-max").value);if(isNaN(C)||C<0){flashError("Unable to create rateable - invalid minimum value");return }if(isNaN(A)||A<0||A<C){flashError("Unable to create rateable - invalid maximum value");return }var B=new StringBuffer();B.a("action=create");B.a("&title=").a(encodeURIComponent(E)).a("&desc=").a(encodeURIComponent(D));B.a("&min=").a(C).a("&max=").a(A);smartCallXML("/api/rateable",B.toString(),function(G){if(nh(G,"error")){var F=nvn(G,"error");var H;if(nh(F,"message")){H=nvn(F,"message")}else{H="An unknown error occurred, please try again"}flashError(H)}else{if(nh(G,"success")){getGroupRateables();closeRateableDialog();flashNotice("Successfully created rateable item")}}})}function beginEditRateable(A){if(!$("mwu-rateable-dialog")){generateRateableDialog()}$("mwu-rateable-title").value=$("rate-"+A+"-title").innerHTML;$("mwu-rateable-desc").value=$("rate-"+A+"-desc").innerHTML;$("mwu-rateable-min").value=$("rate-"+A+"-min").innerHTML;$("mwu-rateable-max").value=$("rate-"+A+"-max").innerHTML;$("mwu-rateable-submit").onclick=finishEditRateable.bind(this,A);showRateableDialog()}function showRateableDialog(){$("mwu-rateable-dialog").show();positionMWUDialogs()}function finishEditRateable(F){var E=$("mwu-rateable-title").value;var D=$("mwu-rateable-desc").value;var C=parseInt($("mwu-rateable-min").value);var A=parseInt($("mwu-rateable-max").value);if(isNaN(C)||C<1||C>10){flashError("Unable to update rateable - invalid minimum value");return }if(isNaN(A)||A<1||A<C||A>10){flashError("Unable to update rateable - invalid maximum value");return }var B=new StringBuffer();B.a("action=update&rid=").a(F);B.a("&title=").a(encodeURIComponent(E)).a("&desc=").a(encodeURIComponent(D));B.a("&min=").a(C).a("&max=").a(A);smartCallXML("/api/rateable",B.toString(),function(H){if(nh(H,"error")){var G=nvn(H,"error");var I;if(nh(G,"message")){I=nvn(G,"message")}else{I="An unknown error occurred, please try again"}flashError(I)}else{if(nh(H,"success")){getGroupRateables();closeRateableDialog();flashNotice("Successfully updated rateable item")}}})}function beginDeleteRateable(D){var B="If you really want to delete this item, type 'DELETE'.<br/>Otherwise, click 'Cancel";var A="Delete Rateable Item";var C=finishDeleteRateable;showConfirmationDialog(D,A,B,C)}function finishDeleteRateable(){var C=$("mwu-confirmation-dialog-id").value;var B=$("mwu-confirmation-dialog-confirmation").value;if(B.toUpperCase()=="DELETE"){var A=new StringBuffer();A.a("action=delete&rid=").a(C);smartCallXML("/api/rateable",A.toString(),function(E){var G=nh(E,"success");if(G){$("rate-"+C).style.display="none";flashNotice("Successfully removed your rateable item");closeConfirmationDialog()}else{if(nh(E,"error")){var D=nvn(E,"error");var F;if(nh(D,"message")){F=nvn(D,"message")}else{F="An unknown error occurred, please try again"}flashError(F)}}})}else{flashError("Invalid confirmation")}}function getDateString(A){var G=parseFloat(A);if(isNaN(G)){return"Unknown"}var H=["Sun.","Mon.","Tues.","Weds.","Thurs.","Fri.","Sat."];var M=["Jan","Feb","March","April","May","June","July","Aug","Sept","Oct","Nov","Dec"];var J,I,C,K,E,D,L;var F=new Date(G);J=parseInt(F.getFullYear());I=parseInt(F.getMonth());C=parseInt(F.getDate());K=parseInt(F.getDay());E=parseInt(F.getHours());D=parseInt(F.getMinutes());if(K<0||K>6||I<0||I>11||C<1||C>31||E<0||E>23||D<0||D>59){return"invalid date"}if(E>11){L="PM";E=E-12}else{L="AM";if(E==0){E=12}}if(D<10){D="0"+D}var B=""+H[K]+" "+M[I]+" "+C+", "+J+" at "+E+":"+D+" "+L;return B}
