var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(C){var A="";var J,H,F,I,G,E,D;var B=0;C=Base64._utf8_encode(C);while(B<C.length){J=C.charCodeAt(B++);H=C.charCodeAt(B++);F=C.charCodeAt(B++);I=J>>2;G=((J&3)<<4)|(H>>4);E=((H&15)<<2)|(F>>6);D=F&63;if(isNaN(H)){E=D=64}else{if(isNaN(F)){D=64}}A=A+this._keyStr.charAt(I)+this._keyStr.charAt(G)+this._keyStr.charAt(E)+this._keyStr.charAt(D)}return A},decode:function(C){var A="";var J,H,F;var I,G,E,D;var B=0;C=C.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(B<C.length){I=this._keyStr.indexOf(C.charAt(B++));G=this._keyStr.indexOf(C.charAt(B++));E=this._keyStr.indexOf(C.charAt(B++));D=this._keyStr.indexOf(C.charAt(B++));J=(I<<2)|(G>>4);H=((G&15)<<4)|(E>>2);F=((E&3)<<6)|D;A=A+String.fromCharCode(J);if(E!=64){A=A+String.fromCharCode(H)}if(D!=64){A=A+String.fromCharCode(F)}}A=Base64._utf8_decode(A);return A},_utf8_encode:function(B){B=B.replace(/\r\n/g,"\n");var A="";for(var D=0;D<B.length;D++){var C=B.charCodeAt(D);if(C<128){A+=String.fromCharCode(C)}else{if((C>127)&&(C<2048)){A+=String.fromCharCode((C>>6)|192);A+=String.fromCharCode((C&63)|128)}else{A+=String.fromCharCode((C>>12)|224);A+=String.fromCharCode(((C>>6)&63)|128);A+=String.fromCharCode((C&63)|128)}}}return A},_utf8_decode:function(A){var B="";var C=0;var D=c1=c2=0;while(C<A.length){D=A.charCodeAt(C);if(D<128){B+=String.fromCharCode(D);C++}else{if((D>191)&&(D<224)){c2=A.charCodeAt(C+1);B+=String.fromCharCode(((D&31)<<6)|(c2&63));C+=2}else{c2=A.charCodeAt(C+1);c3=A.charCodeAt(C+2);B+=String.fromCharCode(((D&15)<<12)|((c2&63)<<6)|(c3&63));C+=3}}}return B}};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 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(doPresencePane){initPresencePane()}if(doAvatarList){getAvatarList()}}function initModerationPage(){initDefault()}function doOpenidLink(){var C=de("openid_url");var D=C.value;var B="/openid/redirect?";var A="openid="+encodeURIComponent(D)+"&next=/settings/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/user/').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/user/').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/user/').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/user/').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/user/').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/user/').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/user/').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/user/').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/user/').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/user/').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/user/').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(E,A,D,C){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=A;mOffset=D;var B="action=list";B+="&mode="+E;B+="&cid="+linkClientid;B+="&lim="+A;B+="&off="+D;smartCallXML("/maps",B,function(M){var L=new StringBuffer();var O=M.getElementsByTagName("count")[0].childNodes[0].nodeValue;if(O==0){L.append('<div class="sectionblk">');L.append('<div class="sectionbumper"></div>');L.append('<div class="darkgraytext" style="margin-left: 5px; text-align:center;">No maps.<br/><br/>');if(myProfile){L.append(' <a href="" onclick="createNewMap(); return false">Create New Map</a>')}L.append("</div>");L.append('<div class="sectionbumper" style="clear:left;"></div>');L.append("</div>")}var G=M.getElementsByTagName("item");for(var J=0;J<G.length;J++){var R=G[J];var Q=nvn(R,"viewid");var F=nvn(R,"url");var H=nvn(R,"editurl");var S=nvn(R,"title");var N=nvn(R,"desc");var K=nvn(R,"keywords");var I=nvn(R,"status");var U=nvn(R,"clicks");var T=nvn(R,"modified");var P=nvn(R,"ismobilemap");L.append('<div class="sectionblock" style="cursor:pointer;" onclick="$(\'map').append(Q).append('details\').toggle()" title="click for map details">');L.append('<div class="sectionbumper"></div>');L.append('<div style="margin: 0px 15px 0px 15px;">');L.append('<div style="font-size:13.0pt; margin-left:3px;"><a href="').append(F).append('" title=" ">').append(S).append("</a></div>");L.append('<div class="darkgraytext" style="font-size: 9.0pt; margin-left: 8px;">').append(N).append("</div>");L.append('<div class="lightgraytext" id="map').append(Q).append('details" style="display:none; font-size: 8.0pt; margin:3px 0px 0px 8px;">');L.append(" <div>Keywords: ").append(K).append("</div>");L.append(" <div>Status: ").append(I).append("</div>");L.append(" <div>Views: ").append(U).append("</div>");L.append(" <div>Updated: ").append(T).append("</div>");if(C&&myProfile){if(P=="false"){L.append('<div style="margin:3px 0px 0px 0px;">');L.append('<a href="').append(H).append('">Edit this map</a> | ');L.append('<a href="javascript:void(0)" style="font-size:8.0pt;" onclick="setMobileMap(\'');L.append(E);L.append("', '");L.append(Q);L.append("', true)\">Make this a mobile map</a>");L.append("</div>")}else{L.append('<div style="margin:3px 0px 0px 0px;">');L.append('<a href="').append(H).append('">Edit this map</a> | ');L.append('<a href="javascript:void(0)" style="font-size:8.0pt;" onclick="setMobileMap(\'');L.append(E);L.append("', '");L.append(Q);L.append("', false)\">Remove mobile map status</a>");L.append("</div>")}}L.append("</div>");L.append("</div>");L.append('<div class="sectionbumper" style="clear:left;"></div>');L.append("</div>")}setInnerHtml("mapspane",L.toString());if(C){updateMapPaging(E,O,A,D)}else{setMapsCount(O,A,D)}})}function updateMapPaging(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="loadMaps(\''+F+"', "+A+", "+parseInt(E-A)+', 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="loadMaps(\''+F+"', "+A+", "+parseInt(E+A)+', true)">Next</a>'}else{B+='<span class="lightgraytext">Next</span>'}setInnerHtml("pagingcontent",B)}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,D,B){var C="action=setmobile&mobile="+B+"&viewid="+D;smartCallXML("/maps",C,function(){loadMaps(A,mLimit,mOffset,true)})}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="/settings/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="/settings/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="/settings/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="/settings/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="/settings/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="/settings/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="/settings/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="/settings/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/user/').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/user/').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/user/').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/user/').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/user/').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/user/').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/user/').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/user/').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/user/').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/user/').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/user/').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/user/').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 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 lafSave(){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 }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;smartCallXML("/users",H,function(){flashNotice("Save successful.")})}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;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 response=ajax.responseXML.documentElement;var preJs=nvn(response,"preJs");var xml=tag(response,"data")[0];var postJs=nvn(response,"postJs");eval(preJs);responder(xml);eval(postJs)};url=addAjaxPrefixSuffix(url);(function(){new Ajax.Request(url,{method:"post",onSuccess: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...");smartCallXML("/facebook/connect/login","",function(D){var F=(D.getElementsByTagName("success").length>0);if(F){var G=location.href.match("register")!=null;if(G){window.location.href=callPrefix+"/"}else{window.location.reload(true)}}else{var E=nh(D,"register");if(E){var C=prependAjaxPrefix("/register?");var B=(nh(D,"fbuid")?nvn(D,"fbuid"):-1);var A="fbreg=true&regfbuid="+B;window.location.href=C+A}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)}var Prototype={Version:"1.6.1",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.*Safari/.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");var B=document.createElement("form");var 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(){function A(){}function B(){var G=null,F=$A(arguments);if(Object.isFunction(F[0])){G=F.shift()}function D(){this.initialize.apply(this,arguments)}Object.extend(D,Class.Methods);D.superclass=G;D.subclasses=[];if(G){A.prototype=G.prototype;D.prototype=new A;G.subclasses.push(D)}for(var E=0;E<F.length;E++){D.addMethods(F[E])}if(!D.prototype.initialize){D.prototype.initialize=Prototype.emptyFunction}D.prototype.constructor=D;return D}function C(J){var F=this.superclass&&this.superclass.prototype;var E=Object.keys(J);if(!Object.keys({toString:true}).length){if(J.toString!=Object.prototype.toString){E.push("toString")}if(J.valueOf!=Object.prototype.valueOf){E.push("valueOf")}}for(var D=0,G=E.length;D<G;D++){var I=E[D],H=J[I];if(F&&Object.isFunction(H)&&H.argumentNames().first()=="$super"){var K=H;H=(function(L){return function(){return F[L].apply(this,arguments)}})(I).wrap(K);H.valueOf=K.valueOf.bind(K);H.toString=K.toString.bind(K)}this.prototype[I]=H}return this}return{create:B,Methods:{addMethods:C}}})();(function(){var D=Object.prototype.toString;function I(Q,S){for(var R in S){Q[R]=S[R]}return Q}function L(Q){try{if(E(Q)){return"undefined"}if(Q===null){return"null"}return Q.inspect?Q.inspect():String(Q)}catch(R){if(R instanceof RangeError){return"..."}throw R}}function K(Q){var S=typeof Q;switch(S){case"undefined":case"function":case"unknown":return ;case"boolean":return Q.toString()}if(Q===null){return"null"}if(Q.toJSON){return Q.toJSON()}if(H(Q)){return }var R=[];for(var U in Q){var T=K(Q[U]);if(!E(T)){R.push(U.toJSON()+": "+T)}}return"{"+R.join(", ")+"}"}function C(Q){return $H(Q).toQueryString()}function F(Q){return Q&&Q.toHTML?Q.toHTML():String.interpret(Q)}function O(Q){var R=[];for(var S in Q){R.push(S)}return R}function M(Q){var R=[];for(var S in Q){R.push(Q[S])}return R}function J(Q){return I({},Q)}function H(Q){return !!(Q&&Q.nodeType==1)}function G(Q){return D.call(Q)=="[object Array]"}function P(Q){return Q instanceof Hash}function B(Q){return typeof Q==="function"}function A(Q){return D.call(Q)=="[object String]"}function N(Q){return D.call(Q)=="[object Number]"}function E(Q){return typeof Q==="undefined"}I(Object,{extend:I,inspect:L,toJSON:K,toQueryString:C,toHTML:F,keys:O,values:M,clone:J,isElement:H,isArray:G,isHash:P,isFunction:B,isString:A,isNumber:N,isUndefined:E})})();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}})());Date.prototype.toJSON=function(){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"'};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(){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");var 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());var 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(){var parts=this.split("-"),len=parts.length;if(len==1){return parts[0]}var camelized=this.charAt(0)=="-"?parts[0].charAt(0).toUpperCase()+parts[0].substring(1):parts[0];for(var i=1;i<len;i++){camelized+=parts[i].charAt(0).toUpperCase()+parts[i].substring(1)}return camelized}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 toJSON(){return this.inspect(true)}function unfilterJSON(filter){return this.replace(filter||Prototype.JSONFilter,"$1")}function isJSON(){var str=this;if(str.blank()){return false}str=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str)}function evalJSON(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())}function include(pattern){return this.indexOf(pattern)>-1}function startsWith(pattern){return this.indexOf(pattern)===0}function endsWith(pattern){var d=this.length-pattern.length;return d>=0&&this.lastIndexOf(pattern)===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?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,toJSON:toJSON,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON: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];var 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 S=Array.prototype,M=S.slice,O=S.forEach;function B(W){for(var V=0,X=this.length;V<X;V++){W(this[V])}}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(V){return V!=null})}function U(){return this.inject([],function(W,V){if(Object.isArray(V)){return W.concat(V.flatten())}W.push(V);return W})}function H(){var V=M.call(arguments,0);return this.select(function(W){return !V.include(W)})}function F(V){return(V!==false?this:this.toArray())._reverse()}function K(V){return this.inject([],function(Y,X,W){if(0==W||(V?Y.last()!=X:!Y.include(X))){Y.push(X)}return Y})}function P(V){return this.uniq().findAll(function(W){return V.detect(function(X){return W===X})})}function Q(){return M.call(this,0)}function J(){return this.length}function T(){return"["+this.map(Object.inspect).join(", ")+"]"}function R(){var V=[];this.each(function(W){var X=Object.toJSON(W);if(!Object.isUndefined(X)){V.push(X)}});return"["+V.join(", ")+"]"}function A(X,V){V||(V=0);var W=this.length;if(V<0){V=W+V}for(;V<W;V++){if(this[V]===X){return V}}return -1}function N(W,V){V=isNaN(V)?this.length:(V<0?this.length+V:V)+1;var X=this.slice(0,V).reverse().indexOf(W);return(X<0)?X:V-X-1}function C(){var b=M.call(this,0),Y;for(var W=0,X=arguments.length;W<X;W++){Y=arguments[W];if(Object.isArray(Y)&&!("callee" in Y)){for(var V=0,Z=Y.length;V<Z;V++){b.push(Y[V])}}else{b.push(Y)}}return b}Object.extend(S,Enumerable);if(!S._reverse){S._reverse=S.reverse}Object.extend(S,{_each:O,clear:L,first:D,last:G,compact:I,flatten:U,without:H,reverse:F,uniq:K,intersect:P,clone:Q,toArray:Q,size:J,inspect:T,toJSON:R});var E=(function(){return[].concat(arguments)[0][0]!==1})(1,2);if(E){S.concat=C}if(!S.indexOf){S.indexOf=A}if(!S.lastIndexOf){S.lastIndexOf=N}})();function $H(A){return new Hash(A)}var Hash=Class.create(Enumerable,(function(){function E(Q){this._object=Object.isHash(Q)?Q.toObject():Object.clone(Q)}function F(R){for(var Q in this._object){var S=this._object[Q],T=[Q,S];T.key=Q;T.value=S;R(T)}}function K(Q,R){return this._object[Q]=R}function C(Q){if(this._object[Q]!==Object.prototype[Q]){return this._object[Q]}}function N(Q){var R=this._object[Q];delete this._object[Q];return R}function P(){return Object.clone(this._object)}function O(){return this.pluck("key")}function M(){return this.pluck("value")}function G(R){var Q=this.detect(function(S){return S.value===R});return Q&&Q.key}function I(Q){return this.clone().update(Q)}function D(Q){return new Hash(Q).inject(this,function(R,S){R.set(S.key,S.value);return R})}function B(Q,R){if(Object.isUndefined(R)){return Q}return Q+"="+encodeURIComponent(String.interpret(R))}function A(){return this.inject([],function(S,T){var R=encodeURIComponent(T.key),Q=T.value;if(Q&&typeof Q=="object"){if(Object.isArray(Q)){return S.concat(Q.map(B.curry(R)))}}else{S.push(B(R,Q))}return S}).join("&")}function L(){return"#<Hash:{"+this.map(function(Q){return Q.map(Object.inspect).join(": ")}).join(", ")+"}>"}function J(){return Object.toJSON(this.toObject())}function H(){return new Hash(this)}return{initialize:E,_each:F,set:K,get:C,unset:N,toObject:P,toTemplateReplacements:P,keys:O,values:M,index:G,merge:I,update:D,toQueryString:A,inspect:L,toJSON:J,clone:H}})());Hash.from=$H;Object.extend(Number.prototype,(function(){function D(){return this.toPaddedString(2,16)}function E(){return this+1}function A(K,J){$R(0,this,true).each(K,J);return this}function B(L,K){var J=this.toString(K||10);return"0".times(L-J.length)+J}function F(){return isFinite(this)?this.toString():"null"}function I(){return Math.abs(this)}function H(){return Math.round(this)}function G(){return Math.ceil(this)}function C(){return Math.floor(this)}return{toColorPart:D,succ:E,times:A,toPaddedString:B,toJSON:F,abs:I,round:H,ceil:G,floor:C}})());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.isString(this.options.parameters)){this.options.parameters=this.options.parameters.toQueryParams()}else{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.clone(this.options.parameters);if(!["get","post"].include(this.method)){D["_method"]=this.method;this.method="post"}this.parameters=D;if(D=Object.toQueryString(D)){if(this.method=="get"){this.url+=(this.url.include("?")?"&":"?")+D}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){D+="&_="}}}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)},getStatus:function(){try{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(!window.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){var B=(function(){var F=document.createElement("form");var E=document.createElement("input");var D=document.documentElement;E.setAttribute("name","test");F.appendChild(E);D.appendChild(F);var G=F.elements?(typeof F.elements.test=="undefined"):null;D.removeChild(F);F=E=null;return G})();var A=C.Element;C.Element=function(F,E){E=E||{};F=F.toLowerCase();var D=Element.cache;if(B&&E.name){F="<"+F+' name="'+E.name+'">';delete E.name;return Element.writeAttribute(document.createElement(F),E)}if(!D[F]){D[F]=Element.extend(document.createElement(F))}return Element.writeAttribute(D[F].cloneNode(false),E)};Object.extend(C.Element,A||{});if(A){C.Element.prototype=A.prototype}})(this);Element.cache={};Element.idCounter=1;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 B=(function(){var E=document.createElement("select"),F=true;E.innerHTML='<option value="test">test</option>';if(E.options&&E.options[0]){F=E.options[0].nodeName.toUpperCase()!=="OPTION"}E=null;return F})();var A=(function(){try{var E=document.createElement("table");if(E&&E.tBodies){E.innerHTML="<tbody><tr><td>test</td></tr></tbody>";var G=typeof E.tBodies[0]=="undefined";E=null;return G}}catch(F){return true}})();var D=(function(){var E=document.createElement("script"),G=false;try{E.appendChild(document.createTextNode(""));G=!E.firstChild||E.firstChild&&E.firstChild.nodeType!==3}catch(F){G=true}E=null;return G})();function C(F,G){F=$(F);if(G&&G.toElement){G=G.toElement()}if(Object.isElement(G)){return F.update().insert(G)}G=Object.toHTML(G);var E=F.tagName.toUpperCase();if(E==="SCRIPT"&&D){F.text=G;return F}if(B||A){if(E in Element._insertionTranslations.tags){while(F.firstChild){F.removeChild(F.firstChild)}Element._getContentFromAnonymousElement(E,G.stripScripts()).each(function(H){F.appendChild(H)})}else{F.innerHTML=G.stripScripts()}}else{F.innerHTML=G.stripScripts()}G.evalScripts.bind(G).defer();return F}return C})(),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();var D=(B[E]||"").toString();if(D){A+=" "+C+"="+D.inspect(true)}});return A+">"},recursivelyCollect:function(A,C){A=$(A);var B=[];while(A=A[C]){if(A.nodeType==1){B.push(Element.extend(A))}}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(A){if(!(A=$(A).firstChild)){return[]}while(A&&A.nodeType!=1){A=A.nextSibling}if(A){return[A].concat($(A).nextSiblings())}return[]},previousSiblings:function(A){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){if(Object.isString(A)){A=new Selector(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]:Selector.findElement(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,D,A){B=$(B);if(arguments.length==1){return $(Selector.handlers.previousElementSibling(B))}var C=Element.previousSiblings(B);return Object.isNumber(D)?C[D]:Selector.findElement(C,D,A)},next:function(C,D,B){C=$(C);if(arguments.length==1){return $(Selector.handlers.nextElementSibling(C))}var A=Element.nextSiblings(C);return Object.isNumber(D)?A[D]:Selector.findElement(A,D,B)},select:function(B){var A=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(B,A)},adjacent:function(B){var A=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(B.parentNode,A).without(B)},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},getDimensions:function(C){C=$(C);var G=Element.getStyle(C,"display");if(G!="none"&&G!=null){return{width:C.offsetWidth,height:C.offsetHeight}}var B=C.style;var F=B.visibility;var D=B.position;var A=B.display;B.visibility="hidden";if(D!="fixed"){B.position="absolute"}B.display="block";var H=C.clientWidth;var E=C.clientHeight;B.display=A;B.position=D;B.visibility=F;return{width:H,height:E}},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},cumulativeOffset:function(B){var A=0,C=0;do{A+=B.offsetTop||0;C+=B.offsetLeft||0;B=B.offsetParent}while(B);return Element._returnOffset(C,A)},positionedOffset:function(B){var A=0,D=0;do{A+=B.offsetTop||0;D+=B.offsetLeft||0;B=B.offsetParent;if(B){if(B.tagName.toUpperCase()=="BODY"){break}var C=Element.getStyle(B,"position");if(C!=="static"){break}}}while(B);return Element._returnOffset(D,A)},absolutize:function(B){B=$(B);if(Element.getStyle(B,"position")=="absolute"){return B}var D=Element.positionedOffset(B);var F=D[1];var E=D[0];var C=B.clientWidth;var A=B.clientHeight;B._originalLeft=E-parseFloat(B.style.left||0);B._originalTop=F-parseFloat(B.style.top||0);B._originalWidth=B.style.width;B._originalHeight=B.style.height;B.style.position="absolute";B.style.top=F+"px";B.style.left=E+"px";B.style.width=C+"px";B.style.height=A+"px";return B},relativize:function(A){A=$(A);if(Element.getStyle(A,"position")=="relative"){return A}A.style.position="relative";var C=parseFloat(A.style.top||0)-(A._originalTop||0);var B=parseFloat(A.style.left||0)-(A._originalLeft||0);A.style.top=C+"px";A.style.left=B+"px";A.style.height=A._originalHeight;A.style.width=A._originalWidth;return A},cumulativeScrollOffset:function(B){var A=0,C=0;do{A+=B.scrollTop||0;C+=B.scrollLeft||0;B=B.parentNode}while(B);return Element._returnOffset(C,A)},getOffsetParent:function(A){if(A.offsetParent){return $(A.offsetParent)}if(A==document.body){return $(A)}while((A=A.parentNode)&&A!=document.body){if(Element.getStyle(A,"position")!="static"){return $(A)}}return $(document.body)},viewportOffset:function(D){var A=0,C=0;var B=D;do{A+=B.offsetTop||0;C+=B.offsetLeft||0;if(B.offsetParent==document.body&&Element.getStyle(B,"position")=="absolute"){break}}while(B=B.offsetParent);B=D;do{if(!Prototype.Browser.Opera||(B.tagName&&(B.tagName.toUpperCase()=="BODY"))){A-=B.scrollTop||0;C-=B.scrollLeft||0}}while(B=B.parentNode);return Element._returnOffset(C,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);B=$(B);var F=[0,0];var C=null;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"left":case"top":case"right":case"bottom":if(D(B,"position")==="static"){return null}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.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(C,B){B=$(B);try{B.offsetParent}catch(E){return $(document.body)}var A=B.getStyle("position");if(A!=="static"){return C(B)}B.setStyle({position:"relative"});var D=C(B);B.setStyle({position:A});return D});$w("positionedOffset viewportOffset").each(function(A){Element.Methods[A]=Element.Methods[A].wrap(function(E,C){C=$(C);try{C.offsetParent}catch(G){return Element._returnOffset(0,0)}var B=C.getStyle("position");if(B!=="static"){return E(C)}var D=C.getOffsetParent();if(D&&D.getStyle("position")==="fixed"){D.setStyle({zoom:1})}C.setStyle({position:"relative"});var F=E(C);C.setStyle({position:B});return F})});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(B,A){try{A.offsetParent}catch(C){return Element._returnOffset(0,0)}return B(A)});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";var A="for";var 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");D.onclick=Prototype.emptyFunction;var F=D.getAttribute("onclick");var E;if(String(F).indexOf("{")>-1){E=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(F===""){E=function(G,H){H=G.getAttribute(H);if(!H){return null}return H.strip()}}}D=null;return E})(),_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};Element.Methods.cumulativeOffset=function(B){var A=0,C=0;do{A+=B.offsetTop||0;C+=B.offsetLeft||0;if(B.offsetParent==document.body){if(Element.getStyle(B,"position")=="absolute"){break}}B=B.offsetParent}while(B);return Element._returnOffset(C,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();var 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(C,B){var D=new Element("div"),A=Element._insertionTranslations.tags[C];if(A){D.innerHTML=A[0]+B+A[1];A[2].times(function(){D=D.firstChild})}else{D.innerHTML=B}return $A(D.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);var 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})();Element.hasAttribute=function(A,B){if(A.hasAttribute){return A.hasAttribute(B)}return Element.Methods.Simulated.hasAttribute(A,B)};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)})}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);var 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[0]}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)}});var Selector=Class.create({initialize:function(A){this.expression=A.strip();if(this.shouldUseSelectorsAPI()){this.mode="selectorsAPI"}else{if(this.shouldUseXPath()){this.mode="xpath";this.compileXPathMatcher()}else{this.mode="normal";this.compileMatcher()}}},shouldUseXPath:(function(){var A=(function(){var E=false;if(document.evaluate&&window.XPathResult){var D=document.createElement("div");D.innerHTML="<ul><li></li></ul><div><ul><li></li></ul></div>";var C=".//*[local-name()='ul' or local-name()='UL']//*[local-name()='li' or local-name()='LI']";var B=document.evaluate(C,D,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);E=(B.snapshotLength!==2);D=null}return E})();return function(){if(!Prototype.BrowserFeatures.XPath){return false}var B=this.expression;if(Prototype.Browser.WebKit&&(B.include("-of-type")||B.include(":empty"))){return false}if((/(\[[\w-]*?:|:checked)/).test(B)){return false}if(A){return false}return true}})(),shouldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI){return false}if(Selector.CASE_INSENSITIVE_CLASS_NAMES){return false}if(!Selector._div){Selector._div=new Element("div")}try{Selector._div.querySelector(this.expression)}catch(A){return false}return true},compileMatcher:function(){var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m,len=ps.length,name;if(Selector._cache[e]){this.matcher=Selector._cache[e];return }this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i=0;i<len;i++){p=ps[i].re;name=ps[i].name;if(m=e.match(p)){this.matcher.push(Object.isFunction(c[name])?c[name](m):new Template(c[name]).evaluate(m));e=e.replace(m[0],"");break}}}this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join("\n"));Selector._cache[this.expression]=this.matcher},compileXPathMatcher:function(){var G=this.expression,H=Selector.patterns,C=Selector.xpath,F,B,A=H.length,D;if(Selector._cache[G]){this.xpath=Selector._cache[G];return }this.matcher=[".//*"];while(G&&F!=G&&(/\S/).test(G)){F=G;for(var E=0;E<A;E++){D=H[E].name;if(B=G.match(H[E].re)){this.matcher.push(Object.isFunction(C[D])?C[D](B):new Template(C[D]).evaluate(B));G=G.replace(B[0],"");break}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath},findElements:function(A){A=A||document;var C=this.expression,B;switch(this.mode){case"selectorsAPI":if(A!==document){var D=A.id,E=$(A).identify();E=E.replace(/([\.:])/g,"\\$1");C="#"+E+" "+C}B=$A(A.querySelectorAll(C)).map(Element.extend);A.id=D;return B;case"xpath":return document._getElementsByXPath(this.xpath,A);default:return this.matcher(A)}},match:function(I){this.tokens=[];var M=this.expression,A=Selector.patterns,E=Selector.assertions;var B,D,F,L=A.length,C;while(M&&B!==M&&(/\S/).test(M)){B=M;for(var H=0;H<L;H++){D=A[H].re;C=A[H].name;if(F=M.match(D)){if(E[C]){this.tokens.push([C,Object.clone(F)]);M=M.replace(F[0],"")}else{return this.findElements(document).include(I)}}}}var K=true,C,J;for(var H=0,G;G=this.tokens[H];H++){C=G[0],J=G[1];if(!Selector.assertions[C](I,J)){K=false;break}}return K},toString:function(){return this.expression},inspect:function(){return"#<Selector:"+this.expression.inspect()+">"}});if(Prototype.BrowserFeatures.SelectorsAPI&&document.compatMode==="BackCompat"){Selector.CASE_INSENSITIVE_CLASS_NAMES=(function(){var C=document.createElement("div"),A=document.createElement("span");C.id="prototype_test_id";A.className="Test";C.appendChild(A);var B=(C.querySelector("#prototype_test_id .test")!==null);C=A=null;return B})()}Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:"/following-sibling::*",tagName:function(A){if(A[1]=="*"){return""}return"[local-name()='"+A[1].toLowerCase()+"' or local-name()='"+A[1].toUpperCase()+"']"},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(A){A[1]=A[1].toLowerCase();return new Template("[@#{1}]").evaluate(A)},attr:function(A){A[1]=A[1].toLowerCase();A[3]=A[5]||A[6];return new Template(Selector.xpath.operators[A[2]]).evaluate(A)},pseudo:function(A){var B=Selector.xpath.pseudos[A[1]];if(!B){return""}if(Object.isFunction(B)){return B(A)}return new Template(Selector.xpath.pseudos[A[1]]).evaluate(A)},operators:{"=":"[@#{1}='#{3}']","!=":"[@#{1}!='#{3}']","^=":"[starts-with(@#{1}, '#{3}')]","$=":"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']","*=":"[contains(@#{1}, '#{3}')]","~=":"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]","|=":"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{"first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","only-child":"[not(preceding-sibling::* or following-sibling::*)]","empty":"[count(*) = 0 and (count(text()) = 0)]","checked":"[@checked]","disabled":"[(@disabled) and (@type!='hidden')]","enabled":"[not(@disabled) and (@type!='hidden')]","not":function(E){var H=E[6],C=Selector.patterns,I=Selector.xpath,A,J,G=C.length,B;var D=[];while(H&&A!=H&&(/\S/).test(H)){A=H;for(var F=0;F<G;F++){B=C[F].name;if(E=H.match(C[F].re)){J=Object.isFunction(I[B])?I[B](E):new Template(I[B]).evaluate(E);D.push("("+J.substring(1,J.length-1)+")");H=H.replace(E[0],"");break}}}return"[not("+D.join(" and ")+")]"},"nth-child":function(A){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",A)},"nth-last-child":function(A){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",A)},"nth-of-type":function(A){return Selector.xpath.pseudos.nth("position() ",A)},"nth-last-of-type":function(A){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",A)},"first-of-type":function(A){A[6]="1";return Selector.xpath.pseudos["nth-of-type"](A)},"last-of-type":function(A){A[6]="1";return Selector.xpath.pseudos["nth-last-of-type"](A)},"only-of-type":function(A){var B=Selector.xpath.pseudos;return B["first-of-type"](A)+B["last-of-type"](A)},nth:function(E,C){var F,G=C[6],B;if(G=="even"){G="2n+0"}if(G=="odd"){G="2n+1"}if(F=G.match(/^(\d+)$/)){return"["+E+"= "+F[1]+"]"}if(F=G.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(F[1]=="-"){F[1]=-1}var D=F[1]?Number(F[1]):1;var A=F[2]?Number(F[2]):0;B="[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(B).evaluate({fragment:E,a:D,b:A})}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);      c = false;',className:'n = h.className(n, r, "#{1}", c);    c = false;',id:'n = h.id(n, r, "#{1}", c);           c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c); c = false;',attr:function(A){A[3]=(A[5]||A[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(A)},pseudo:function(A){if(A[6]){A[6]=A[6].replace(/"/g,'\\"')}return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(A)},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:[{name:"laterSibling",re:/^\s*~\s*/},{name:"child",re:/^\s*>\s*/},{name:"adjacent",re:/^\s*\+\s*/},{name:"descendant",re:/^\s/},{name:"tagName",re:/^\s*(\*|[\w\-]+)(\b|$)?/},{name:"id",re:/^#([\w\-\*]+)(\b|$)/},{name:"className",re:/^\.([\w\-\*]+)(\b|$)/},{name:"pseudo",re:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/},{name:"attrPresence",re:/^\[((?:[\w-]+:)?[\w-]+)\]/},{name:"attr",re:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/}],assertions:{tagName:function(A,B){return B[1].toUpperCase()==A.tagName.toUpperCase()},className:function(A,B){return Element.hasClassName(A,B[1])},id:function(A,B){return A.id===B[1]},attrPresence:function(A,B){return Element.hasAttribute(A,B[1])},attr:function(B,C){var A=Element.readAttribute(B,C[1]);return A&&Selector.operators[C[2]](A,C[5]||C[6])}},handlers:{concat:function(B,A){for(var C=0,D;D=A[C];C++){B.push(D)}return B},mark:function(A){var D=Prototype.emptyFunction;for(var B=0,C;C=A[B];B++){C._countedByPrototype=D}return A},unmark:(function(){var A=(function(){var B=document.createElement("div"),E=false,D="_countedByPrototype",C="x";B[D]=C;E=(B.getAttribute(D)===C);B=null;return E})();return A?function(B){for(var C=0,D;D=B[C];C++){D.removeAttribute("_countedByPrototype")}return B}:function(B){for(var C=0,D;D=B[C];C++){D._countedByPrototype=void 0}return B}})(),index:function(A,D,G){A._countedByPrototype=Prototype.emptyFunction;if(D){for(var B=A.childNodes,E=B.length-1,C=1;E>=0;E--){var F=B[E];if(F.nodeType==1&&(!G||F._countedByPrototype)){F.nodeIndex=C++}}}else{for(var E=0,C=1,B=A.childNodes;F=B[E];E++){if(F.nodeType==1&&(!G||F._countedByPrototype)){F.nodeIndex=C++}}}},unique:function(B){if(B.length==0){return B}var D=[],E;for(var C=0,A=B.length;C<A;C++){if(typeof (E=B[C])._countedByPrototype=="undefined"){E._countedByPrototype=Prototype.emptyFunction;D.push(Element.extend(E))}}return Selector.handlers.unmark(D)},descendant:function(A){var D=Selector.handlers;for(var C=0,B=[],E;E=A[C];C++){D.concat(B,E.getElementsByTagName("*"))}return B},child:function(A){var E=Selector.handlers;for(var D=0,C=[],F;F=A[D];D++){for(var B=0,G;G=F.childNodes[B];B++){if(G.nodeType==1&&G.tagName!="!"){C.push(G)}}}return C},adjacent:function(A){for(var C=0,B=[],E;E=A[C];C++){var D=this.nextElementSibling(E);if(D){B.push(D)}}return B},laterSibling:function(A){var D=Selector.handlers;for(var C=0,B=[],E;E=A[C];C++){D.concat(B,Element.nextSiblings(E))}return B},nextElementSibling:function(A){while(A=A.nextSibling){if(A.nodeType==1){return A}}return null},previousElementSibling:function(A){while(A=A.previousSibling){if(A.nodeType==1){return A}}return null},tagName:function(A,H,C,B){var I=C.toUpperCase();var E=[],G=Selector.handlers;if(A){if(B){if(B=="descendant"){for(var F=0,D;D=A[F];F++){G.concat(E,D.getElementsByTagName(C))}return E}else{A=this[B](A)}if(C=="*"){return A}}for(var F=0,D;D=A[F];F++){if(D.tagName.toUpperCase()===I){E.push(D)}}return E}else{return H.getElementsByTagName(C)}},id:function(A,I,B,C){var H=$(B),G=Selector.handlers;if(I==document){if(!H){return[]}if(!A){return[H]}}else{if(!I.sourceIndex||I.sourceIndex<1){var A=I.getElementsByTagName("*");for(var E=0,D;D=A[E];E++){if(D.id===B){return[D]}}}}if(A){if(C){if(C=="child"){for(var F=0,D;D=A[F];F++){if(H.parentNode==D){return[H]}}}else{if(C=="descendant"){for(var F=0,D;D=A[F];F++){if(Element.descendantOf(H,D)){return[H]}}}else{if(C=="adjacent"){for(var F=0,D;D=A[F];F++){if(Selector.handlers.previousElementSibling(H)==D){return[H]}}}else{A=G[C](A)}}}}for(var F=0,D;D=A[F];F++){if(D==H){return[H]}}return[]}return(H&&Element.descendantOf(H,I))?[H]:[]},className:function(B,A,C,D){if(B&&D){B=this[D](B)}return Selector.handlers.byClassName(B,A,C)},byClassName:function(C,B,F){if(!C){C=Selector.handlers.descendant([B])}var H=" "+F+" ";for(var E=0,D=[],G,A;G=C[E];E++){A=G.className;if(A.length==0){continue}if(A==F||(" "+A+" ").include(H)){D.push(G)}}return D},attrPresence:function(C,B,A,G){if(!C){C=B.getElementsByTagName("*")}if(C&&G){C=this[G](C)}var E=[];for(var D=0,F;F=C[D];D++){if(Element.hasAttribute(F,A)){E.push(F)}}return E},attr:function(A,I,H,J,C,B){if(!A){A=I.getElementsByTagName("*")}if(A&&B){A=this[B](A)}var K=Selector.operators[C],F=[];for(var E=0,D;D=A[E];E++){var G=Element.readAttribute(D,H);if(G===null){continue}if(K(G,J)){F.push(D)}}return F},pseudo:function(B,C,E,A,D){if(B&&D){B=this[D](B)}if(!B){B=A.getElementsByTagName("*")}return Selector.pseudos[C](B,E,A)}},pseudos:{"first-child":function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(Selector.handlers.previousElementSibling(E)){continue}C.push(E)}return C},"last-child":function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(Selector.handlers.nextElementSibling(E)){continue}C.push(E)}return C},"only-child":function(B,G,A){var E=Selector.handlers;for(var D=0,C=[],F;F=B[D];D++){if(!E.previousElementSibling(F)&&!E.nextElementSibling(F)){C.push(F)}}return C},"nth-child":function(B,C,A){return Selector.pseudos.nth(B,C,A)},"nth-last-child":function(B,C,A){return Selector.pseudos.nth(B,C,A,true)},"nth-of-type":function(B,C,A){return Selector.pseudos.nth(B,C,A,false,true)},"nth-last-of-type":function(B,C,A){return Selector.pseudos.nth(B,C,A,true,true)},"first-of-type":function(B,C,A){return Selector.pseudos.nth(B,"1",A,false,true)},"last-of-type":function(B,C,A){return Selector.pseudos.nth(B,"1",A,true,true)},"only-of-type":function(B,D,A){var C=Selector.pseudos;return C["last-of-type"](C["first-of-type"](B,D,A),D,A)},getIndices:function(B,A,C){if(B==0){return A>0?[A]:[]}return $R(1,C).inject([],function(D,E){if(0==(E-A)%B&&(E-A)/B>=0){D.push(E)}return D})},nth:function(A,L,N,K,C){if(A.length==0){return[]}if(L=="even"){L="2n+0"}if(L=="odd"){L="2n+1"}var J=Selector.handlers,I=[],B=[],E;J.mark(A);for(var H=0,D;D=A[H];H++){if(!D.parentNode._countedByPrototype){J.index(D.parentNode,K,C);B.push(D.parentNode)}}if(L.match(/^\d+$/)){L=Number(L);for(var H=0,D;D=A[H];H++){if(D.nodeIndex==L){I.push(D)}}}else{if(E=L.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(E[1]=="-"){E[1]=-1}var O=E[1]?Number(E[1]):1;var M=E[2]?Number(E[2]):0;var P=Selector.pseudos.getIndices(O,M,A.length);for(var H=0,D,F=P.length;D=A[H];H++){for(var G=0;G<F;G++){if(D.nodeIndex==P[G]){I.push(D)}}}}}J.unmark(A);J.unmark(B);return I},"empty":function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(E.tagName=="!"||E.firstChild){continue}C.push(E)}return C},"not":function(A,D,I){var G=Selector.handlers,J,C;var H=new Selector(D).findElements(I);G.mark(H);for(var F=0,E=[],B;B=A[F];F++){if(!B._countedByPrototype){E.push(B)}}G.unmark(H);return E},"enabled":function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(!E.disabled&&(!E.type||E.type!=="hidden")){C.push(E)}}return C},"disabled":function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(E.disabled){C.push(E)}}return C},"checked":function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(E.checked){C.push(E)}}return C}},operators:{"=":function(B,A){return B==A},"!=":function(B,A){return B!=A},"^=":function(B,A){return B==A||B&&B.startsWith(A)},"$=":function(B,A){return B==A||B&&B.endsWith(A)},"*=":function(B,A){return B==A||B&&B.include(A)},"~=":function(B,A){return(" "+B+" ").include(" "+A+" ")},"|=":function(B,A){return("-"+(B||"").toUpperCase()+"-").include("-"+(A||"").toUpperCase()+"-")}},split:function(B){var A=[];B.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(C){A.push(C[1].strip())});return A},matchElements:function(F,G){var E=$$(G),D=Selector.handlers;D.mark(E);for(var C=0,B=[],A;A=F[C];C++){if(A._countedByPrototype){B.push(A)}}D.unmark(E);return B},findElement:function(B,C,A){if(Object.isNumber(C)){A=C;C=false}return Selector.matchElements(B,C||"*")[A||0]},findChildElements:function(E,G){G=Selector.split(G.join(","));var D=[],F=Selector.handlers;for(var C=0,B=G.length,A;C<B;C++){A=new Selector(G[C].strip());F.concat(D,A.findElements(E))}return(B>1)?F.unique(D):D}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(B,A){for(var C=0,D;D=A[C];C++){if(D.tagName!=="!"){B.push(D)}}return B}})}function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(A){A=$(A);A.reset();return A},serializeElements:function(G,B){if(typeof B!="object"){B={hash:!!B}}else{if(Object.isUndefined(B.hash)){B.hash=true}}var C,F,A=false,E=B.submit;var D=G.inject({},function(H,I){if(!I.disabled&&I.name){C=I.name;F=$(I).getValue();if(F!=null&&I.type!="file"&&(I.type!="submit"||(!A&&E!==false&&(!E||C==E)&&(A=true)))){if(C in H){if(!Object.isArray(H[C])){H[C]=[H[C]]}H[C].push(F)}else{H[C]=F}}}return H});return B.hash?D:Object.toQueryString(D)}};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(A){A=$(A);A.findFirstElement().activate();return A},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={input:function(A,B){switch(A.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(A,B);default:return Form.Element.Serializers.textarea(A,B)}},inputSelector:function(A,B){if(Object.isUndefined(B)){return A.checked?A.value:null}else{A.checked=!!B}},textarea:function(A,B){if(Object.isUndefined(B)){return A.value}else{A.value=B}},select:function(C,F){if(Object.isUndefined(F)){return this[C.type=="select-one"?"selectOne":"selectMany"](C)}else{var B,D,G=!Object.isArray(F);for(var A=0,E=C.length;A<E;A++){B=C.options[A];D=this.optionValue(B);if(G){if(D==F){B.selected=true;return }}else{B.selected=F.include(D)}}}},selectOne:function(B){var A=B.selectedIndex;return A>=0?this.optionValue(B.options[A]):null},selectMany:function(D){var A,E=D.length;if(!E){return null}for(var C=0,A=[];C<E;C++){var B=D.options[C];if(B.selected){A.push(this.optionValue(B))}}return A},optionValue:function(A){return Element.extend(A).hasAttribute("value")?A.value:A.text}};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 V={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 E=document.documentElement;var W="onmouseenter" in E&&"onmouseleave" in E;var O;if(Prototype.Browser.IE){var H={0:1,1:4,2:2};O=function(Y,X){return Y.button===H[X]}}else{if(Prototype.Browser.WebKit){O=function(Y,X){switch(X){case 0:return Y.which==1&&!Y.metaKey;case 1:return Y.which==1&&Y.metaKey;default:return false}}}else{O=function(Y,X){return Y.which?(Y.which===X+1):(Y.button===X)}}}function R(X){return O(X,0)}function Q(X){return O(X,1)}function K(X){return O(X,2)}function C(Z){Z=V.extend(Z);var Y=Z.target,X=Z.type,b=Z.currentTarget;if(b&&b.tagName){if(X==="load"||X==="error"||(X==="click"&&b.tagName.toLowerCase()==="input"&&b.type==="radio")){Y=b}}if(Y.nodeType==Node.TEXT_NODE){Y=Y.parentNode}return Element.extend(Y)}function M(Y,b){var X=V.element(Y);if(!b){return X}var Z=[X].concat(X.ancestors());return Selector.findElement(Z,b,0)}function P(X){return{x:B(X),y:A(X)}}function B(Z){var Y=document.documentElement,X=document.body||{scrollLeft:0};return Z.pageX||(Z.clientX+(Y.scrollLeft||X.scrollLeft)-(Y.clientLeft||0))}function A(Z){var Y=document.documentElement,X=document.body||{scrollTop:0};return Z.pageY||(Z.clientY+(Y.scrollTop||X.scrollTop)-(Y.clientTop||0))}function N(X){V.extend(X);X.preventDefault();X.stopPropagation();X.stopped=true}V.Methods={isLeftClick:R,isMiddleClick:Q,isRightClick:K,element:C,findElement:M,pointer:P,pointerX:B,pointerY:A,stop:N};var T=Object.keys(V.Methods).inject({},function(X,Y){X[Y]=V.Methods[Y].methodize();return X});if(Prototype.Browser.IE){function G(Y){var X;switch(Y.type){case"mouseover":X=Y.fromElement;break;case"mouseout":X=Y.toElement;break;default:return null}return Element.extend(X)}Object.extend(T,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});V.extend=function(Y,X){if(!Y){return false}if(Y._extendedByPrototype){return Y}Y._extendedByPrototype=Prototype.emptyFunction;var Z=V.pointer(Y);Object.extend(Y,{target:Y.srcElement||X,relatedTarget:G(Y),pageX:Z.x,pageY:Z.y});return Object.extend(Y,T)}}else{V.prototype=window.Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(V.prototype,T);V.extend=Prototype.K}function L(c,b,d){var Z=Element.retrieve(c,"prototype_event_registry");if(Object.isUndefined(Z)){D.push(c);Z=Element.retrieve(c,"prototype_event_registry",$H())}var X=Z.get(b);if(Object.isUndefined(X)){X=[];Z.set(b,X)}if(X.pluck("handler").include(d)){return false}var Y;if(b.include(":")){Y=function(e){if(Object.isUndefined(e.eventName)){return false}if(e.eventName!==b){return false}V.extend(e,c);d.call(c,e)}}else{if(!W&&(b==="mouseenter"||b==="mouseleave")){if(b==="mouseenter"||b==="mouseleave"){Y=function(g){V.extend(g,c);var f=g.relatedTarget;while(f&&f!==c){try{f=f.parentNode}catch(h){f=c}}if(f===c){return }d.call(c,g)}}}else{Y=function(e){V.extend(e,c);d.call(c,e)}}}Y.handler=d;X.push(Y);return Y}function F(){for(var X=0,Y=D.length;X<Y;X++){V.stopObserving(D[X]);D[X]=null}}var D=[];if(Prototype.Browser.IE){window.attachEvent("onunload",F)}if(Prototype.Browser.WebKit){window.addEventListener("unload",Prototype.emptyFunction,false)}var J=Prototype.K;if(!W){J=function(Y){var X={mouseenter:"mouseover",mouseleave:"mouseout"};return Y in X?X[Y]:Y}}function S(b,Z,c){b=$(b);var Y=L(b,Z,c);if(!Y){return b}if(Z.include(":")){if(b.addEventListener){b.addEventListener("dataavailable",Y,false)}else{b.attachEvent("ondataavailable",Y);b.attachEvent("onfilterchange",Y)}}else{var X=J(Z);if(b.addEventListener){b.addEventListener(X,Y,false)}else{b.attachEvent("on"+X,Y)}}return b}function I(d,b,e){d=$(d);var Z=Element.retrieve(d,"prototype_event_registry");if(Object.isUndefined(Z)){return d}if(b&&!e){var c=Z.get(b);if(Object.isUndefined(c)){return d}c.each(function(f){Element.stopObserving(d,b,f.handler)});return d}else{if(!b){Z.each(function(h){var f=h.key,g=h.value;g.each(function(j){Element.stopObserving(d,f,j.handler)})});return d}}var c=Z.get(b);if(!c){return }var Y=c.find(function(f){return f.handler===e});if(!Y){return d}var X=J(b);if(b.include(":")){if(d.removeEventListener){d.removeEventListener("dataavailable",Y,false)}else{d.detachEvent("ondataavailable",Y);d.detachEvent("onfilterchange",Y)}}else{if(d.removeEventListener){d.removeEventListener(X,Y,false)}else{d.detachEvent("on"+X,Y)}}Z.set(b,c.without(Y));return d}function U(b,Z,Y,X){b=$(b);if(Object.isUndefined(X)){X=true}if(b==document&&document.createEvent&&!b.dispatchEvent){b=document.documentElement}var c;if(document.createEvent){c=document.createEvent("HTMLEvents");c.initEvent("dataavailable",true,true)}else{c=document.createEventObject();c.eventType=X?"ondataavailable":"onfilterchange"}c.eventName=Z;c.memo=Y||{};if(document.createEvent){b.dispatchEvent(c)}else{b.fireEvent(c.eventType,c)}return V.extend(c)}Object.extend(V,V.Methods);Object.extend(V,{fire:U,observe:S,stopObserving:I});Element.addMethods({fire:U,observe:S,stopObserving:I});Object.extend(document,{fire:U.methodize(),observe:S.methodize(),stopObserving:I.methodize(),loaded:false});if(window.Event){Object.extend(window.Event,V)}else{window.Event=V}})();(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 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 clearInputText(A){if(A.value==A.alt){A.value=""}$(A).removeClassName("prompt")}function resetInputText(A){if(A.value.trim().length==0){A.value=A.alt;$(A).addClassName("prompt")}}function initInputText(A){clearInputText(A);resetInputText(A)}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 clearInputText(A){if(A.value==A.alt){A.value=""}$(A).removeClassName("prompt")}function resetInputText(A){if(A.value.trim().length==0){A.value=A.alt;$(A).addClassName("prompt")}}function initInputText(A){clearInputText(A);resetInputText(A)}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"}var GeoMetronome=function(D,C,B,A){if(typeof (_geoMetroRegister)=="undefined"){_geoMetroRegister=new Array()}if(_geoMetroRegister.length<1){setInterval(function(){for(var E=0;E<_geoMetroRegister.length;E++){_geoMetroRegister[E].searchCheck()}},333)}_geoMetroRegister.push(this);this.n=D;this.checkTime=-1;this.checkCount=3;this.checkWeight=100;this.checkLat=null;this.checkLon=null;this.checkZoom=false;this.checkLocked=false;this.checkRef=C;this.showRefresher=B;this.showSearching=A};GeoMetronome.prototype.searchCheck=function(){if(this.checkTime>=0){this.checkTime++;if(this.checkTime>=this.checkCount){this.checkTime=this.checkCount;this.checkRef();return }var D=this.checkCount-this.checkTime;this.showRefresher(true,D)}if(this.checkLat==null||this.checkLon==null){this.checkLat=200;this.checkLon=200;this.checkZoom=true}var A=0;if(!this.checkZoom){var F=makeLatLng(this.checkLat,this.checkLon);var C=map[this.n].fromLatLngToDivPixel(F);var E=makeLatLng(getCenterLat(this.n),getCenterLon(this.n));var B=map[this.n].fromLatLngToDivPixel(E);A=Math.max(Math.abs(B.x-C.x),Math.abs(B.y-C.y))}if(!this.checkLocked&&(this.checkZoom||A>this.checkWeight)){if(this.checkTime<0){this.checkTime=0;this.showRefresher(true,this.checkCount)}}else{if(this.checkTime>=0){this.checkTime=-1;this.showRefresher(false)}}};GeoMetronome.prototype.searchCheckZoom=function(){this.checkZoom=true};GeoMetronome.prototype.searchCheckLocked=function(A){this.checkLocked=A};GeoMetronome.prototype.searchCheckNow=function(){var B=getCenterLat(this.n);var C=getCenterLon(this.n);if(B==null||C==null){var A=this;setTimeout(function(){A.searchCheckNow()},100);return }this.showRefresher(false);this.checkTime=-1;this.checkLat=B;this.checkLon=C;this.checkZoom=false};var PATH_MAP=2;var PATH_ID="DRAWPATH";function setPathMap(A){PATH_MAP=A}var pathMode=false;var pathId=null;var pathPoly=null;function enterPathMode(B,A){if(pathMode){leavePathMode()}pathMode=true;if(B){mgr[PATH_MAP].maskOverlay(B,true);pathId=B}else{pathId=null}pathPoly=null;if(A){initPath(A)}else{initPath(new Array())}pathReady=true}function initPath(C){var A=null;var B=null;pathPoly=new GPolyline(C,"#0000ff",5,1);GEvent.addListener(pathPoly,"lineupdated",function(){loadPointList(null,pathPoly)});map[PATH_MAP].addOverlay(pathPoly);pathPoly.enableEditing()}function leavePathMode(A){pathReady=false;if(pathId){if(pathPoly!=null&&A){mgr[PATH_MAP].addOverlay(pathId,pathPoly)}mgr[PATH_MAP].maskOverlay(pathId,false);pathId=null}if(pathPoly){pathPoly.disableEditing();map[PATH_MAP].removeOverlay(pathPoly);pathPoly=null}pathMode=false}function hookPathTool(A){if(!A||!A.lat||!A.lng){return }pathPoly.insertVertex(pathPoly.getVertexCount(),A);loadPointList(null,pathPoly)}var showing=false;function displayActivePoint(L,H,J,F,E,B){var M=null;var A=getObjectOffset(map[PATH_MAP].getContainer());if(F==null){F=-75}if(E==null){E=10}if(B==null){B=180}if(L!=null){M=this.map[PATH_MAP].fromLatLngToContainerPixel(new GLatLng(L.lat(),L.lng()));H=L.lat();J=L.lng()}else{M=this.map[PATH_MAP].fromLatLngToContainerPixel(new GLatLng(H,J))}var D=H+", "+J;var K=A.x+M.x+F;var I=A.y+M.y+E;var C=pageDimensions().width-195;var G=null;if(K<356){K=356;G=4}if(K>C){K=C;G=2}if(I<224){I=224;if(!G){G=1}}if(I>mapSize.height+195){I=mapSize.height+195;if(!G){G=3}}if(G!=null){D=(G==2?D:"")+'   <img  style="padding:0; margin:0; width:1em; height:1em;"src="/r/images/point-arrow-'+G+'.png"/>   '+(G!=2?D:"")}showToolTipXY(K,I,D,B);showing=true}var toggleBox=new Array();function movePointToggle(A){if(toggleBox[A]==true){de("pointMoveSpan"+A).style.display="none";toggleBox[A]=false}else{de("pointMoveSpan"+A).style.display="block";de("pointMoveTextBox"+A).focus();toggleBox[A]=true}}function movePoint(B,C){var A=de("pointMoveTextBox"+B).value;if(geocoder){geocoder.getLatLng(A,function(D){if(!D){MonkeyDialog.show(A+" not found. Remove any unnecessary spaces if submitting a lat/long value.")}else{if(pathPoly.getVertexCount()==2){pathPoly.insertVertex(B,new GLatLng(D.lat(),D.lng()));pathPoly.deleteVertex(B+1)}else{pathPoly.deleteVertex(B);pathPoly.insertVertex(B,new GLatLng(D.lat(),D.lng()))}moveTo(PATH_MAP,D.lat(),D.lng(),map[PATH_MAP].getZoom());movePointToggle(B);if(C){loadPointList(null,pathPoly)}}})}}function undoPointDelete(B,C,A){if(pathPoly){pathPoly.insertVertex(B,new GLatLng(C,A));updatePointList(false,B)}}function deletePoint(B,A){if(pathPoly.getVertexCount()<3){alert("Ths path must contain at least two points. You may only move an existing point or add a new one.");return }if(A==true){pathPoly.deleteVertex(B);updatePointList(A,B)}hideInfo()}function hideInfo(){if(showing){hideToolTip();showing=false}}function updatePointList(A,B){de("pointMove"+B).style.display=(A?"none":"inline");de("pointDelete"+B).style.display=(A?"none":"inline");de("pointInfo"+B).style.color=(A?"#9c9c9c":"#000000")}function initDefault(){if(typeof flashTimeout=="undefined"){flashTimeout=3000}var C=de("ferror");var A=de("fnotice");if(C&&parseBoolean(C.value)){Effect.BlindDown("flasherror",{duration:0.75});setTimeout("Effect.BlindUp('flasherror', {duration: 0.75})",flashTimeout)}else{if(A&&parseBoolean(A.value)){Effect.BlindDown("flashnotice",{duration:0.75});setTimeout("Effect.BlindUp('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){var D=de("loginname");var G=de("loginpass");var E=de("loginrememberme");var A=D.value;var C=G.value;var F=(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 doOpenidLogin(){var F=de("openidurl").value;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;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 A="openid="+encodeURIComponent("https://www.google.com/accounts/o8/id")+"&next="+D;window.location.href=B+A}var networkTwitter=3;function doTwitterLogin(){setLoginMsg("Authenticating...");window.location.href=prependAjaxPrefix("/oauth/linker?networkid="+networkTwitter)}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("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}$("flashnoticemsg").innerHTML=A;Effect.BlindDown("flashnotice",{duration:0.75});setTimeout("Effect.BlindUp('flashnotice', {duration: 0.75})",flashTimeout)}function flashError(A){if(typeof flashTimeout=="undefined"){flashTimeout=3000}$("flasherrormsg").innerHTML=A;Effect.BlindDown("flasherror",{duration:0.75});setTimeout("Effect.BlindUp('flasherror', {duration: 0.75})",flashTimeout)}function createNewMap(){if(sessionClientid==null){setLoginMsg("Sorry, you must be logged in to create new maps.");showLoginPane();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="/settings/account">upgrade</a> to a Professional account.</div>')}function jumpToProfile(A){if(A!=null){location.href="/profile/user/"+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.loginoptionselected").each(function(B){B.removeClassName("loginoptionselected")});if($("loginfields")!=null){$("loginfields").hide()}$("openidfields").hide();$("facebookfields").hide();$("googlefields").hide();$("twitterfields").hide();if(A=="MapWith.Us"){$("mwuloginoption").addClassName("loginoptionselected");$("loginfields").show();$("loginname").focus()}else{if(A=="OpenID"){$("openidloginoption").addClassName("loginoptionselected");$("openidfields").show();$("openidurl").focus()}else{if(A=="Facebook"){$("fbloginoption").addClassName("loginoptionselected");$("facebookfields").show()}else{if(A=="Google"){$("googleloginoption").addClassName("loginoptionselected");$("googlefields").show()}else{if(A=="Twitter"){$("twitterloginoption").addClassName("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/user/" class="lb big">'+A+"</a>";C+='&nbsp;&nbsp;<fb:profile-pic uid="'+B+'" linked="true" facebook-logo="true"></fb:profile-pic>'}var geocoder=null;var clearMarkers=new Array();var mapClickDirections=true;var containsForestInfo=false;function initMap(F,B,E,D,C,A){map[F]=new GMap2(de(B));map[F].setCenter(new GLatLng(defLat[F],defLon[F]),defZoom[F]);if(typeof (C)=="undefined"||C=="full"){map[F].addControl(new GLargeMapControl())}else{if(C=="compact"){map[F].addControl(new GSmallMapControl())}}if(typeof (E)=="undefined"){E="menu"}if(E){if(E=="wide"){map[F].addControl(new GMapTypeControl())}else{map[F].addControl(new GMenuMapTypeControl())}}if(typeof (D)=="undefined"||D){map[F].addControl(new GOverviewMapControl())}map[F].enableDoubleClickZoom();map[F].enableScrollWheelZoom();map[F].enableContinuousZoom();GEvent.addDomListener(map[F].getContainer(),"DOMMouseScroll",wheelevent);map[F].getContainer().onmousewheel=wheelevent;map[F].addMapType(G_PHYSICAL_MAP);setMapType(F,"map");mgr[F]=new GeoOverlayManager(F);mdd[F]=new GDirections(map[F]);initMapListeners(F,A);if(geocoder==null){geocoder=new GClientGeocoder()}}function initMapListeners(B,A){GEvent.addListener(map[B],"click",function(D,C){if(window.pathMode&&window.hookPathTool){hookPathTool(C)}setSelected(B,C)});GEvent.addListener(map[B],"zoomend",function(){if(useSelection()){panToSelected(B)}});GEvent.addListener(map[B],"moveend",function(){});GEvent.addListener(map[B],"singlerightclick",function(D,C,H){var L=new GPoint(D.x+7,D.y+7);var I=map[B].fromContainerPixelToLatLng(D);var F=map[B].fromContainerPixelToLatLng(L);var J=Math.abs(F.lng()-I.lng());var E=Math.abs(F.lat()-I.lat());if(pathPoly){for(var G=0;G<pathPoly.getVertexCount();G++){var K=pathPoly.getVertex(G);if(Math.abs(I.lat()-K.lat())<E&&Math.abs(I.lng()-K.lng())<J){pathPoly.deleteVertex(G);return }}}if(!A){initItemDirections(B,I.lat(),I.lng())}});GEvent.addListener(map[B],"maptypechanged",function(){if(window.hookMapType[B]){hookMapType[B]()}});GEvent.addListener(mdd[B],"load",function(){directionsLoad(B)});GEvent.addListener(mdd[B],"error",function(){directionsError(B)});if(containsForestInfo==true){GEvent.addListener(map[B],"drag",killZoom);GEvent.addListener(map[B],"dragend",startZoom);GEvent.addListener(map[B],"moveend",function(){setTimeout(killRedraw,delay)})}}function addZoomListener(B,A){GEvent.addListener(map[B],"zoomend",A)}var hookMapType=new Array();function setMapType(B,A){if(A=="map"||A=="normal"){map[B].setMapType(G_NORMAL_MAP)}if(A=="sat"||A=="satellite"){map[B].setMapType(G_SATELLITE_MAP)}if(A=="hyb"||A=="hybrid"){map[B].setMapType(G_HYBRID_MAP)}if(A=="ter"||A=="terrain"){map[B].setMapType(G_PHYSICAL_MAP)}if(window.hookMapType[B]){hookMapType[B](A)}}function getMapType(B){var A=map[B].getCurrentMapType();if(A==G_NORMAL_MAP){return"normal"}if(A==G_SATELLITE_MAP){return"satellite"}if(A==G_HYBRID_MAP){return"hybrid"}if(A==G_PHYSICAL_MAP){return"terrain"}return"normal"}function GeoOverlayManager(A){this.n=A;this.overlayDrawn={};this.overlayCache={};this.overlayMask={};this.cached=0}GeoOverlayManager.prototype.addOverlay=function(C,B){var A=true;if(typeof (B)=="undefined"){B=null}if(typeof (this.overlayCache[C])!="undefined"){if(B==null){B=this.overlayCache[C];A=false}else{removeOverlays(this.n,this.overlayCache[C]);this.overlayCache[C]=B}}else{if(B==null){return }else{this.overlayCache[C]=B;this.cached++}}this.overlayDrawn[C]=true;if(!this.overlayMask[C]){if(A){addOverlays(this.n,B)}else{showOverlays(B)}}};GeoOverlayManager.prototype.maskOverlay=function(B,A){if(typeof (this.overlayCache[B])!="undefined"){if(A){this.overlayMask[B]=true;this.hideOverlay(B)}else{if(typeof (this.overlayMask[B])!="undefined"){delete this.overlayMask[B]}this.addOverlay(B)}}};GeoOverlayManager.prototype.hideOverlay=function(A){if(typeof (this.overlayDrawn[A])=="undefined"){return }delete this.overlayDrawn[A];hideOverlays(this.overlayCache[A])};GeoOverlayManager.prototype.hideOverlays=function(){for(var B in this.overlayDrawn){delete this.overlayDrawn[B];var A=this.overlayCache[B];hideOverlays(A)}};GeoOverlayManager.prototype.checkReset=function(){var A;if(this.cached>1000){for(A in this.overlayCache){removeOverlays(this.n,this.overlayCache[A]);if(typeof (this.overlayDrawn[A])!="undefined"){delete this.overlayDrawn[A]}delete this.overlayCache[A]}this.cached=0;return true}return false};function addOverlays(C,A){if(typeof (A.length)=="undefined"){map[C].addOverlay(A)}else{for(var B=0;B<A.length;B++){map[C].addOverlay(A[B])}}}function removeOverlays(C,A){if(typeof (A.length)=="undefined"){map[C].removeOverlay(A)}else{for(var B=0;B<A.length;B++){map[C].removeOverlay(A[B])}}}function showOverlays(A){if(typeof (A.length)=="undefined"){A.show()}else{for(var B=0;B<A.length;B++){A[B].show()}}}function hideOverlays(A){if(typeof (A.length)=="undefined"){A.hide()}else{for(var B=0;B<A.length;B++){A[B].hide()}}}var GeoFetchCache={_cache:[],store:function(I,C,D,G,E,A,B,F,H){this._cache[I]={articleTitle:C,articleDate:D,articleType:G,latitude:E,longitude:A,minZoom:B,maxZoom:F,options:H};return this._cache[I]},get:function(A){return(typeof (this._cache[A]!=="undefined"))?this._cache[A]:null},clear:function(){for(var A in this._cache){delete this._cache[A]}},addItem:function(B,K,I,C,G,F,A,H,D,J){var E=null;if(typeof (I)=="undefined"){E=this.get(K)}else{E=this.store(K,I,C,G,F,A,H,D,J)}if(E!=null){addMapItem(B,K,E.articleTitle,E.articleDate,E.articleType,E.latitude,E.longitude,E.minZoom,E.maxZoom,E.options)}}};function OldGeoOverlayManager(A){this.n=A;this.visible=new Array();this.pathVisible=new Array();this.pathDistance=new Array();this.geometricObjects=new Array();this.pathConcealed=null;this.add=function(D,B,C,E){var F=map[A].getZoom();this.visible[this.visible.length]=new GeoOverlay(D,B,C,E);map[A].addOverlay(D)};this.addPath=function(F,E,B,D,C,G){var H=map[A].getZoom();this.pathVisible[this.pathVisible.length]=new GeoPathOverlay(F,E,B,D,C,G);if(this.pathConcealed!=E){map[A].addOverlay(F)}};this.addPathDistance=function(E,C,B){var D=this.pathDistance.length;this.pathDistance[D]=new GeoDistanceSet(E,C,B);if(this.pathConcealed!=C){this.pathDistance[D].show(A)}};this.addGeometry=function(C,B,D){var E=map[A].getZoom();this.geometricObjects[this.geometricObjects.length]=new GeoOverlay(C,null,B,D);map[A].addOverlay(C)};this.concealPath=function(E){var C=false;var D=false;var B;for(B=0;B<this.pathVisible.length;B++){if(this.pathVisible[B].articleid==this.pathConcealed){map[A].addOverlay(this.pathVisible[B].overlay);D=true}if(this.pathVisible[B].articleid==E){map[A].removeOverlay(this.pathVisible[B].overlay);C=true}if(D&&C){break}}C=false;D=false;for(B=0;B<this.pathDistance.length;B++){if(this.pathDistance[B].articleid==this.pathConcealed){this.pathDistance[B].show(A);D=true}if(this.pathDistance[B].articleid==E){this.pathDistance[B].hide(A);C=true}if(D&&C){break}}this.pathConcealed=E;this.redraw()};this.remove=function(C){var B=false;var D;for(D=0;D<this.visible.length;D++){if(this.visible[D].overlay==C){map[A].removeOverlay(this.visible[D].overlay);this.visible.splice(D,1);B=true;break}}if(B){return }for(D=0;D<this.pathVisible.length;D++){if(this.pathVisible[D].overlay==C){map[A].removeOverlay(this.pathVisible[D].overlay);this.pathVisible.splice(D,1);break}}};this.redraw=function(){};this.clear=function(){var B;for(B=0;B<this.visible.length;B++){map[A].removeOverlay(this.visible[B].overlay)}this.visible.length=0;for(B=0;B<this.pathVisible.length;B++){map[A].removeOverlay(this.pathVisible[B].overlay)}this.pathVisible.length=0;for(B=0;B<this.pathDistance.length;B++){this.pathDistance[B].hide(A)}this.pathDistance.length=0;for(B=0;B<this.geometricObjects.length;B++){map[A].removeOverlay(this.geometricObjects[B].overlay)}this.geometricObjects.length=0}}function GeoOverlay(A,C,D,B){this.overlay=A;this.point=C;this.minzoom=D;this.maxzoom=B}function GeoPathOverlay(A,C,D,F,E,B){this.overlay=A;this.articleid=C;this.swpoint=D;this.nepoint=F;this.minzoom=E;this.maxzoom=B;this.bounds=new GLatLngBounds(this.swpoint,this.nepoint)}function GeoDistanceSet(D,A,E){this.path=D;this.articleid=A;this.units=E;this.overlays=new Array();var C=this.path.getVertexCount();for(var B=0;B<(C-1);B++){this.overlays[B]=new PathDistanceOverlay({start:this.path.getVertex(B),end:this.path.getVertex(B+1),units:this.units})}this.show=function(G){for(var F=0;F<this.overlays.length;F++){map[G].addOverlay(this.overlays[F])}};this.hide=function(G){for(var F=0;F<this.overlays.length;F++){map[G].removeOverlay(this.overlays[F])}}}function isDefaultView(A){if(Math.abs(getCenterLat(A)-defLat[A])>0.001){return false}if(Math.abs(getCenterLon(A)-defLon[A])>0.001){return false}if(map[A].getZoom()!=defZoom[A]){return false}return true}function makeLatLng(A,B){return new GLatLng(A,B)}var selectionIcon=new GIcon();selectionIcon.image="/r/images/map/marker.png";selectionIcon.shadow="/r/images/map/marker.png";selectionIcon.iconSize=new GSize(20,20);selectionIcon.shadowSize=new GSize(20,20);selectionIcon.iconAnchor=new GPoint(10,10);selectionIcon.infoWindowAnchor=new GPoint(10,10);var selectionMarker=new Array();var selectionLat=new Array();var selectionLon=new Array();function setSelected(B,A){if((typeof (newToolsActive)=="undefined"||!newToolsActive)||!A||!A.lat||!A.lng||!(A.lat()>=-90&&A.lat()<=90&&A.lng()>=-180&&A.lng()<=180)){return }if(!selectionMarker[B]){selectionMarker[B]=new GMarker(new GLatLng(A.lat(),A.lng()),selectionIcon,{clickable:false});map[B].addOverlay(selectionMarker[B])}else{selectionMarker[B].setPoint(new GLatLng(A.lat(),A.lng()))}selectionLat[B]=A.lat();selectionLon[B]=A.lng();setZoomCheck();setAlbumDistance()}function setSelectedLatLon(C,A,B){setSelected(C,new GLatLng(A,B))}function removeSelected(A){if(selectionMarker[A]==null){return }map[A].removeOverlay(selectionMarker[A]);selectionMarker[A]=null;selectionLat[A]=null;selectionLon[A]=null}function getSelectedLat(A){return selectionLat[A]}function getSelectedLon(A){return selectionLon[A]}function mapDimensions(A){return map[A].getSize()}function getCenterLat(B){var A=map[B].getCenter();if(A==null||!A.lat){return null}return map[B].getCenter().lat()}function getCenterLon(B){var A=map[B].getCenter();if(A==null||!A.lng){return null}return map[B].getCenter().lng()}function moveTo(E,C,D,B){var A=new GLatLng(C,D);map[E].setCenter(A,B)}function panTo(C,A,B){moveTo(C,A,B,map[C].getZoom())}function slideTo(D,B,C){var A=new GLatLng(B,C);map[D].panTo(A)}function zoomTo(B,A){map[B].setZoom(A)}function moveWithZoomConstraint(F,D,E,A,B){var C=getZoom(F);if(C<A){C=A}else{if(C>B){C=B}}moveTo(F,D,E,C)}function centerOn(C,A,B){panTo(C,A,B);setSelectedLatLon(C,A,B)}function moveToDefault(A){moveTo(A,defLat[A],defLon[A],defZoom[A])}function panToSelected(A){if(selectionLat[A]&&selectionLon[A]){panTo(A,getSelectedLat(A),getSelectedLon(A))}}function isDigit(B){var A=B.charCodeAt(0);return(A>=48&&A<=57)}function isSpace(A){return(A==" ")}function isDot(A){return(A==".")}function isDash(A){return(A=="-")}function isComma(A){return(A==",")}function isZip(C){var B=true;var A;for(A=0;A<C.length;A++){if(!isDigit(C.charAt(A))){B=false}}return B}function isGPS(C){var A=true;if(isZip(C)){return false}var B;for(B=0;B<C.length;B++){if(isComma(C.charAt(B))){continue}if(!isDigit(C.charAt(B))&&!isSpace(C.charAt(B))&&!isDot(C.charAt(B))&&!isDash(C.charAt(B))){A=false}}return A}function setGoToFocus(A){de("gototext"+A).style.display="none";de("gotoinput"+A).focus()}function checkGoTo(A){if(de("gotoinput"+A).value.length<=0){de("gototext"+A).style.display="inline"}else{de("gototext"+A).style.display="none"}}function goTo(B,A){if(isGPS(A)){panToGPS(B,A)}else{panToAddress(B,A)}}function geocode(A,B){geocoder.getLatLng(A,B)}function panToAddress(E,D,C){var A=D;var B=C;if(!A||A.length<1){return }if(!C||C.length<1){B=17}geocode(A,function(F){if(!F){MonkeyDialog.show(A+" not found")}else{moveTo(E,F.lat(),F.lng(),B);setSelected(E,F)}})}function panToGPS(D,C){var A=C;if(!A||A.length<1){return }var B=A.split(",",2);moveTo(D,B[0],B[1],15);setSelectedLatLon(D,B[0],B[1])}var markerOpacity=75;function changeMarkerOpacity(B,A){if(markerOpacity<=25&&B<0||markerOpacity>=100&&B>0){return }setMarkerOpacity(markerOpacity+B,A?A:false)}function setMarkerOpacity(A,B){markerOpacity=A;if(markerOpacity<=25){markerOpacity=25}if(markerOpacity>=100){markerOpacity=100}if(B){B()}de("mapopacitypct").innerHTML=markerOpacity}var hoveredOverlay=new Array();var hoveredOverlayIndex=new Array();function hoverOverlay(B,A){if(hoveredOverlay[B]){hoveredOverlay[B].style.zIndex=hoveredOverlayIndex[B]}hoveredOverlay[B]=A;hoveredOverlayIndex[B]=A.style.zIndex;A.style.zIndex=1000000}function unhoverOverlay(B,A){if(hoveredOverlay[B]==A){A.style.zIndex=hoveredOverlayIndex[B];hoveredOverlay[B]=null}}function ClusterOverlay(A){this.opts=A}ClusterOverlay.prototype=new GOverlay();ClusterOverlay.prototype.initialize=function(A){this.map=A;this.id=makeClusterDiv(this.opts,this.map);this.div=de(this.id)};ClusterOverlay.prototype.show=function(){this.div.style.display="block"};ClusterOverlay.prototype.hide=function(){this.div.style.display="none"};ClusterOverlay.prototype.remove=function(){this.div.parentNode.removeChild(this.div);purge(this.div);this.div=null;this.map=null};ClusterOverlay.prototype.copy=function(){var A=new ClusterOverlay(this.opts);return A};ClusterOverlay.prototype.redraw=function(A){if(!A){return }var B=this.map.fromLatLngToDivPixel(this.opts.point);this.div.style.left=B.x+"px";this.div.style.top=B.y+"px"};ClusterOverlay.prototype.install=function(A){this.div.onclick=A;this.div.onmousemove=updateToolTip};var clusterId=0;function makeClusterDiv(C,D){var A=(++clusterId);var E="CLUSTER"+A;var B=800000000+parseInt(C.point.lat()*10000);(function(I,H,G,F,K,J){var L=document.createElement("div");L.id=I;L.style.cursor="pointer";L.style.position="absolute";L.style.whiteSpace="nowrap";L.style.textAlign="center";L.style.fontSize=H>999?"8.0pt":H>99?"10.0pt":"12.0pt";L.style.fontWeight="bold";L.style.fontFamily="Helvetica, Arial, Verdana, sans-serif";L.style.color="white";L.style.marginLeft=(G==-1)?"-20px":(G==-2)?"-40px":("-"+G+"px");L.style.marginTop=(F==-1)?"-20px":(F==-2)?"-40px":("-"+F+"px");L.style.width="40px";L.style.height="40px";L.style.lineHeight="40px";L.style.overflow="hidden";L.style.backgroundImage="url(/r/images/map/cluster-simple-"+(K==2?"red":"blue")+".png)";L.innerHTML='<div style="width:39px">'+H+"</div>";D.getPane(G_MAP_MARKER_SHADOW_PANE).appendChild(L);L.style.zIndex=J})(E,C.crn,C.aleft,C.atop,C.color,B);return E}function SimpleIconOverlay(A){this.opts=A}SimpleIconOverlay.prototype=new GOverlay();SimpleIconOverlay.prototype.initialize=function(A){this.map=A;this.id=makeSimpleIconElement(this.opts,this.map);this.div=de(this.id)};SimpleIconOverlay.prototype.show=function(){this.div.style.display="block"};SimpleIconOverlay.prototype.hide=function(){this.div.style.display="none"};SimpleIconOverlay.prototype.remove=function(){this.div.parentNode.removeChild(this.div);purge(this.div);this.div=null;this.map=null};SimpleIconOverlay.prototype.copy=function(){var A=new ClusterOverlay(this.opts);return A};SimpleIconOverlay.prototype.redraw=function(A){if(!A){return }var B=this.map.fromLatLngToDivPixel(this.opts.point);this.div.style.left=B.x+"px";this.div.style.top=B.y+"px"};SimpleIconOverlay.prototype.install=function(A){this.div.onclick=A;this.div.onmousemove=updateToolTip};var simpleIconId=0;function makeSimpleIconElement(C,D){var A=(++simpleIconId);var E="SIMPLEICON"+A;var B=900000000+parseInt(C.point.lat()*10000);(function(Q,M,G,U,N,T,I,J,K,V,F,H,S,R){var P=V;var O=F;if(P==-1){P=Math.floor(J/2)}if(P==-2){P=J-1}if(O==-1){O=Math.floor(K/2)}if(O==-2){O=K-1}var L=document.createElement("img");L.id=Q;L.style.display="block";L.style.cursor="pointer";L.style.position="absolute";L.style.marginTop=(-O)+"px";L.style.marginLeft=(-P)+"px";L.style.width=J+"px";L.style.height=K+"px";L.src=H;D.getPane(G_MAP_MARKER_PANE).appendChild(L);L.style.zIndex=M;if(R){L.style.backgroundColor="white";L.style.padding="2px";L.style.border="1px solid silver"}L.onclick=function(){if(window.footerEmbed&&window.map2embedViewItem){setMap2embedViewItem(U,N);return false}if(S==true){}setSelectedLatLon(G,T,I);closeInfoWindow(G);fetchArticle(G,T,I,U,{upsold:S});return true};L.onmouseover=function(X){if(!X){X=window.event}var W='<div style="font-size:7.5pt; line-height:8.0pt">'+N+"</div>";showToolTip(X,W)};L.onmouseout=function(W){hideToolTip()}})(E,B,C.n,C.articleid,C.text,C.point.lat(),C.point.lng(),C.width,C.height,C.aleft,C.atop,C.url,C.upsold,C.border);return E}function SmartTextOverlay(A){this.opts=A}SmartTextOverlay.prototype=new GOverlay();var SMART_TEXT_NORMAL=0;var SMART_TEXT_WEB=1;var SMART_TEXT_RSS=2;var SMART_TEXT_VIDEO=3;var SMART_TEXT_VIEW=4;var SMART_TEXT_ZOOMTO=5;var SMART_TEXT_DOCUMENT=6;var SMART_TEXT_MEDIA=7;var SMART_TEXT_PHOTO=8;var SMART_TEXT_PHOTO_OLD=9;SmartTextOverlay.prototype.initialize=function(A){this.map=A;this.setup()};SmartTextOverlay.prototype.setup=function(){if(typeof (this.div)!="undefined"){purge(this.div)}this.id=makeSmarterTextDiv(this,this.opts,this.map);this.div=de(this.id);this.redraw(true)};SmartTextOverlay.prototype.remove=function(){this.div.parentNode.removeChild(this.div);purge(this.div);this.div=null;this.map=null};SmartTextOverlay.prototype.copy=function(){var A=new SmartTextOverlay(this.opts);return A};SmartTextOverlay.prototype.redraw=function(A){if(!A){return }var B=this.map.fromLatLngToDivPixel(this.opts.point);this.div.style.left=B.x+"px";this.div.style.top=B.y+"px"};SmartTextOverlay.prototype.show=function(){this.setup();this.div.style.display="block"};SmartTextOverlay.prototype.hide=function(){this.div.style.display="none"};var smartTextId=0;function makeSmarterTextDiv(W,L,b){var F=(++smartTextId);var N="SMARTTEXT"+F;var E=1000000000+parseInt(L.point.lng()*10000);var Z=function(c){return };var U=function(c){return };var G=function(){return };smarterOverlayMarkers[F]={n:L.n,overlay:W};var D=getSmarterOverlayOffset(L.n,L.point.lat(),L.point.lng());var I;var P;var O;if(D<0){if(D>-36){D=-34}I=true;O="up";P=-D}else{if(D<15){D=13}I=false;O="down";P=D}var H=D-1;var M=I?18:-5;var B=I?P-26:P-8;var C=I?23:-5-B;var X=I?23+B:-10-B;var A=entify(scriptify(L.text));var Q="if (window.pathMode) return false;";Q+="if (window.footerEmbed && window.map2embedViewItem) { setMap2embedViewItem('"+L.articleid+"', '"+A+"'); return false; } ";var R="dview";var V="&nbsp;";if(L.type==SMART_TEXT_VIEW){var T=L.description.replace(/\'/g,"\\'").replace(/\"/g,"&#34;");R="dview";V='&nbsp;<a href="'+L.url+'" style="color:white; font-size:7.5pt" onmouseover="showToolTip(event, \''+T+"'); window.map["+L.n+"].addOverlay(overlays["+L.n+"]["+L.num+"]); if (overlays["+L.n+"]["+L.num+"].setZIndex) overlays["+L.n+"]["+L.num+'].setZIndex(200000000)" onmousemove="updateToolTip(event)" onmouseout="hideToolTip(); window.map['+L.n+"].removeOverlay(overlays["+L.n+"]["+L.num+'])">'+L.text+"</a>&nbsp;"}else{if(L.type==SMART_TEXT_NORMAL){Q+="closeInfoWindow("+L.n+"); fetchArticle("+L.n+", "+L.point.lat()+", "+L.point.lng()+", '"+L.articleid+"'); return false";R=(L.color==1)?"dblue":"dview";V='&nbsp;<a href="#" onclick="'+Q+'" onmouseover="window.status=\'\'; return true" style="color:white; font-size:7.5pt">'+L.text+"</a>&nbsp;"}}var J=new StringBuffer();J.append('<table cellspacing="0" cellpadding="0" style="');if(mapPrintable[L.n]){J.append("background-color:white; border:1px solid black")}else{J.append("border:0")}J.append('"><tr>');J.append('<td id="SMARTTEXTSTART');J.append(""+F);J.append('" class="smarttextpart" style="background-position:top left; background-repeat:no-repeat; background-image:url(/r/images/map/');J.append(R);J.append("/mm-start-");J.append(""+O);J.append("-");J.append(""+markerOpacity);J.append('.png)"><img src="/r/images/px.gif" style="width:9px; height:18px" /></td>');J.append('<td id="SMARTTEXTTILE');J.append(""+F);J.append('" valign="top" class="smarttextpart" style="background-image:url(/r/images/map/');J.append(R);J.append("/mm-tile-");J.append(""+markerOpacity);J.append('.png); background-position:top left; background-repeat:repeat-x; white-space:nowrap; line-height:14px">');J.append(V);J.append("</td>");J.append('<td id="SMARTTEXTEND');J.append(""+F);J.append('" class="smarttextpart" style="background-position:top left; background-repeat:no-repeat; background-image:url(/r/images/map/');J.append(R);J.append("/mm-end-");J.append(""+markerOpacity);J.append('.png)"><img src="/r/images/px.gif" style="width:9px; height:18px" /></td>');J.append("</tr></table>");J.append('<div id="SMARTTEXTCURVE');J.append(""+F);J.append('" class="smarttextpart" style="position:absolute; left:0px; top:0px; margin-top:');J.append(""+M);J.append("px; width:7px; height:5px; background-image:url(/r/images/map/");J.append(R);J.append("/mm-curve-");J.append(""+O);J.append("-");J.append(""+markerOpacity);J.append(".png)");if(mapPrintable[L.n]){J.append("; background-color:white; border-left:1px solid black")}J.append('; overflow:hidden"></div>');J.append('<div id="SMARTTEXTLINE');J.append(""+F);J.append('" class="smarttextpart" style="position:absolute; left:0px; top:0px; margin-top:');J.append(""+C);J.append("px; width:3px; height:");J.append(""+B);J.append("px; background-image:url(/r/images/map/");J.append(R);J.append("/mm-line-");J.append(""+markerOpacity);J.append(".png)");if(mapPrintable[L.n]){J.append("; background-color:white; border:1px solid black; border-top:0; border-bottom:0")}J.append('; overflow:hidden"></div>');J.append('<div id="SMARTTEXTDOT');J.append(""+F);J.append('" class="smarttextpart" style="position:absolute; left:0px; top:0px; margin-left:-2px; margin-top:');J.append(""+X);J.append("px; width:7px; height:6px; background-image:url(/r/images/map/");J.append(R);J.append("/mm-dot-");J.append(""+O);J.append("-");J.append(""+markerOpacity);J.append(".png)");if(mapPrintable[L.n]){J.append("; background-color:white; border:1px solid black")}J.append('; overflow:hidden"></div>');var Y=function(){Z();this.style.zIndex=2000000001;setSmarterTextOpacity(F,R,O,100)};var S=function(c){U(c)};var K=function(){G();this.style.zIndex=E;setSmarterTextOpacity(F,R,O,markerOpacity)};(function(){var c=document.createElement("div");c.id=N;c.style.position="absolute";c.style.whiteSpace="nowrap";c.style.marginTop=""+H+"px";c.style.marginLeft="-2px";c.style.width="20px";c.style.height="20px";c.style.overflow="visible";c.onmouseover=Y;c.onmousemove=S;c.onmouseout=K;c.innerHTML=J.toString();b.getPane(G_MAP_MARKER_PANE).appendChild(c);c.style.zIndex=E})();return N}function setSmarterTextOpacity(D,A,C,B){de("SMARTTEXTSTART"+D).style.backgroundImage="url(/r/images/map/"+A+"/mm-start-"+C+"-"+B+".png)";de("SMARTTEXTTILE"+D).style.backgroundImage="url(/r/images/map/"+A+"/mm-tile-"+B+".png)";de("SMARTTEXTEND"+D).style.backgroundImage="url(/r/images/map/"+A+"/mm-end-"+B+".png)";de("SMARTTEXTCURVE"+D).style.backgroundImage="url(/r/images/map/"+A+"/mm-curve-"+C+"-"+B+".png)";de("SMARTTEXTLINE"+D).style.backgroundImage="url(/r/images/map/"+A+"/mm-line-"+B+".png)";de("SMARTTEXTDOT"+D).style.backgroundImage="url(/r/images/map/"+A+"/mm-dot-"+C+"-"+B+".png)"}var smarterOverlayMarkers=new Array();var overlayPoint=new Array();function getSmarterOverlayOffset(C,J,B){var F=-34;var M=13;var D=0;var N=map[C].fromLatLngToDivPixel(new GLatLng(J,B));while(true){var H={x:N.x,y:N.y+F};var G={x:N.x,y:N.y+M};var A=true;var I=true;for(var E=0;(A||I)&&E<overlayPoint.length;E++){if(A){if(Math.abs(H.x-overlayPoint[E].x)<100&&Math.abs(H.y-overlayPoint[E].y)<18){A=false}}if(I){if(Math.abs(G.x-overlayPoint[E].x)<100&&Math.abs(G.y-overlayPoint[E].y)<18){I=false}}}if(A){D=F;break}if(I){D=M;break}F-=1;M+=1}var L=N.x;var K=N.y+D;overlayPoint[overlayPoint.length]={lat:J,lon:B,x:L,y:K};return D}function resetSmarterOverlays(A){overlayPoint.length=0;smarterOverlayMarkers.length=0}function closeSmarterOverlay(B){if(!smarterOverlayMarkers[B]){return }var A=smarterOverlayMarkers[B];map[A.n].removeOverlay(A.overlay)}function PathDistanceOverlay(A){this.opts=A}PathDistanceOverlay.prototype=new GOverlay();PathDistanceOverlay.prototype.initialize=function(A){this.map=A;this.id=makePathDistanceDiv(this);this.div=de(this.id)};PathDistanceOverlay.prototype.show=function(){this.div.style.display="block"};PathDistanceOverlay.prototype.hide=function(){this.div.style.display="none"};PathDistanceOverlay.prototype.remove=function(){this.div.parentNode.removeChild(this.div);purge(this.div);this.div=null;this.map=null};PathDistanceOverlay.prototype.copy=function(){var A=new PathDistanceOverlay(this.opts);return A};PathDistanceOverlay.prototype.redraw=function(B){if(!B){return }var C=(this.opts.start.lat()+this.opts.end.lat())/2;var D=(this.opts.start.lng()+this.opts.end.lng())/2;var A=new GLatLng(C,D);var E=this.map.fromLatLngToDivPixel(A);this.div.style.left=E.x+"px";this.div.style.top=E.y+"px";this.div.style.zIndex=GOverlay.getZIndex(C)};var pathDistanceDivId=0;function makePathDistanceDiv(F){var A=F.opts;var C=F.map;var H=(++pathDistanceDivId);var D="PATHDISTANCE"+H;var J;var B;if(A.units==1){J="mi";B=A.start.distanceFrom(A.end)*0.000621371192}else{if(A.units==2){J="ft";B=A.start.distanceFrom(A.end)*3.2808399}else{if(A.units==3){J="yd";B=A.start.distanceFrom(A.end)*1.0936133}else{if(A.units==4){J="km";B=A.start.distanceFrom(A.end)*0.001}else{J="m";B=A.start.distanceFrom(A.end)}}}}var I=(B>=100)?0:(B>=10)?2:3;B=""+B;var E=B.indexOf(".")+I;if(E>B.length){E=B.length}B=B.substring(0,E)+"&nbsp;"+J;var G=new StringBuffer();G.append('<span style="background-color:#cc6600; color:white; font-size:7.0pt; font-weight:bold; white-space:nowrap; cursor:default">&nbsp;');G.append(B);G.append("&nbsp;</span>");(function(){var K=document.createElement("div");K.id=D;K.style.position="absolute";K.style.whiteSpace="nowrap";K.style.marginTop="0px";K.style.marginLeft="-20px";K.style.overflow="visible";K.style.filter="alpha(opacity=75)";K.style.opacity=0.75;K.innerHTML=G.toString();C.getPane(G_MAP_MARKER_PANE).appendChild(K)})();return D}function bubbleDimensions(D){var C=mapDimensions(D);var B=Math.min(Math.max(C.width-100,440),650);var A=Math.min(Math.max(C.height-200,150),400);return{width:B,height:A}}var doFetchEmbed=false;function fetchEmbed(A){doFetchEmbed=A}var doFetchEdit=false;function fetchEdit(A){doFetchEdit=A}function fetchArticle(E,G,C,J,A){if(map2id==null){return }if(!A){A={}}if(!A.noreturn){A.noreturn=false}if(!A.upsold){A.upsold=false}if(!A.rating){A.rating=0}var H=new GLatLng(G,C);map[E].openInfoWindowHtml(H,'<img src="/r/images/loading.gif" />');var F="viewid="+map2id+"&articleid="+J+"&n="+E;var B=bubbleDimensions(E);var D=B.width;var I=B.height;F+="&width="+D+"&height="+I;F+="&embed="+doFetchEmbed;F+="&edit="+doFetchEdit;F+="&rating="+A.rating;if(A.crid){F+="&crid="+A.crid;F+="&clat="+A.clat;F+="&clon="+A.clon}if(A.upsold){smartCallXML("/UpsellArticleView",F,function(K){var M=nodeValue(tag(K,"normal")[0]);var N=nodeValue(tag(K,"maximized")[0]);var L=nodeValue(tag(K,"maxtitle")[0]);monkeyInfoWindow(E,H,M,null,null,A.noreturn,N,L)})}else{smartCall("/ArticleView",F,function(K){monkeyInfoWindow(E,H,K,null,null,A.noreturn)})}}function fetchCluster(E,C,G,B){if(map2id==null){return }var H=new GLatLng(G,B);map[E].openInfoWindowHtml(H,'<img src="/r/images/loading.gif" />');var A=bubbleDimensions(E);var D=A.width;var I=A.height;var F="n="+E;F+="&viewid="+map2id;F+="&crid="+C;F+="&clat="+G;F+="&clon="+B;F+="&width="+D+"&height="+I;F+="&embed="+doFetchEmbed;F+="&edit="+doFetchEdit;smartCall("/ClusterView",F,function(J){monkeyInfoWindow(E,H,J,null,null,false)})}function smartItemComments(A){de("tabComments").innerHTML='Map item comments are coming soon!<br/><img src="/r/images/px.gif" width="300" height="1" />'}var directionsPoint=null;function initItemDirections(D,B,C){var A=new GLatLng(B,C);map[D].openInfoWindowHtml(A,de("tabDirections").innerHTML,{noCloseOnClick:true,onOpenFn:function(){smartItemDirections(B,C)}})}function smartItemDirections(A,B){directionsPoint=new GLatLng(A,B);de("tabdirstart2").checked=true;de("tabdirdest1").checked=true;de("tabdirstartinput").value="";de("tabdirdestinput").value="";de("tabdirstartinput").focus()}function setupDirections(A,C,B){if(A){directionsPoint=A}de("tabdirstartinput").value=C?de(C).value:"";de("tabdirdestinput").value=B?de(B).value:""}function getDirections(E){var C=de("tabdirstartinput").value;var A=de("tabdirdestinput").value;var D=de("tabdirstart1").checked&&directionsPoint?""+directionsPoint.lat()+","+directionsPoint.lng():C.length>0?C:false;var B=de("tabdirdest1").checked&&directionsPoint?""+directionsPoint.lat()+","+directionsPoint.lng():A.length>0?A:false;if(D&&B){mdd[E].load(D+" to "+B,{getSteps:true})}else{alert("Enter a start and destination to get directions.")}}var directionsSteps=new Array();function directionsLoad(H){if(!directionsSteps[H]){directionsSteps[H]=new Array()}clearDirectionsSteps(H);var F=de("tabdirstartinput").value;var A=de("tabdirdestinput").value;var G=de("tabdirstart1").checked&&directionsPoint?""+directionsPoint.lat()+","+directionsPoint.lng():F.length>0?encodeURIComponent(F):false;var C=de("tabdirdest1").checked&&directionsPoint?""+directionsPoint.lat()+","+directionsPoint.lng():A.length>0?encodeURIComponent(A):false;var E=0;for(var D=0;D<mdd[H].getNumRoutes();D++){for(var B=0;B<mdd[H].getRoute(D).getNumSteps();B++){directionsSteps[H][E]=createDirectionsStep(mdd[H].getRoute(D).getStep(B).getLatLng(),mdd[H].getRoute(D).getStep(B).getDescriptionHtml()+'<br/><br/><a href="http://maps.google.com/maps?q='+G+"+to+"+C+'&ie=UTF8&z=9&om=1&pw=2" target="_blank">Printable directions</a>');map[H].addOverlay(directionsSteps[H][E]);E++}}}function clearDirectionsSteps(B){if(directionsSteps[B]){for(var A=0;A<directionsSteps[B].length;A++){map[B].removeOverlay(directionsSteps[B][A])}directionsSteps[B].length=0}}function createDirectionsStep(A,C){var B=new GMarker(A);GEvent.addListener(B,"click",function(){B.openInfoWindowHtml(C)});return B}function directionsError(A){if(mdd[A].getStatus().code==G_GEO_UNKNOWN_ADDRESS){alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: "+mdd[A].getStatus().code)}else{if(mdd[A].getStatus().code==G_GEO_SERVER_ERROR){alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: "+mdd[A].getStatus().code)}else{if(mdd[A].getStatus().code==G_GEO_MISSING_QUERY){alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: "+mdd[A].getStatus().code)}else{if(mdd[A].getStatus().code==G_GEO_BAD_KEY){alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: "+mdd[A].getStatus().code)}else{if(mdd[A].getStatus().code==G_GEO_BAD_REQUEST){alert("A directions request could not be successfully parsed.\n Error code: "+mdd[A].getStatus().code)}else{alert("An unknown error occurred.")}}}}}}var preMonkeyInfoWindowCenter=null;function monkeyInfoWindow(H,A,F,D,G,B,C,E){preMonkeyInfoWindowCenter=map[H].getCenter();if(C!=null&&E!=null){F='<div id = "detailmap"></div>'+F;map[H].openInfoWindowHtml(A,F,{maxTitle:E,maxContent:C,noCloseOnClick:true,onOpenFn:function(){if(B){shareNow()}metronome[H].searchCheckLocked(true);if(D){D()}},onCloseFn:function(){metronome[H].searchCheckLocked(false);if(!B&&preMonkeyInfoWindowCenter!=null){map[H].panTo(preMonkeyInfoWindowCenter);preMonkeyInfoWindowCenter=null}if(G){G()}}})}else{map[H].openInfoWindowHtml(A,F,{noCloseOnClick:true,onOpenFn:function(){if(B){shareNow()}metronome[H].searchCheckLocked(true);if(D){D()}},onCloseFn:function(){metronome[H].searchCheckLocked(false);if(!B&&preMonkeyInfoWindowCenter!=null){map[H].panTo(preMonkeyInfoWindowCenter);preMonkeyInfoWindowCenter=null}if(G){G()}}})}}function closeInfoWindow(A){hideToolTip();map[A].closeInfoWindow()}function createTextMarker(D,B,C){var A=new GLatLng(C.lat,C.lon);return new SmartTextOverlay({n:D,articleid:B,point:A,text:C.text,type:SMART_TEXT_NORMAL,color:C.color})}var iconCache=new Array();function createIconMarker(B,I,A){var G=new GLatLng(A.lat,A.lon);return new SimpleIconOverlay({n:B,articleid:I,point:G,text:A.text,url:A.url,width:A.width,height:A.height,aleft:A.aleft,atop:A.atop,border:A.border,upsold:A.upsold});var F,E;G=new GLatLng(lat,lon);var H=url+"/"+aleft+"/"+atop;if(typeof (iconCache[H])=="undefined"){var C=new GIcon();C.image=url;C.shadow="/r/images/px.gif";C.iconSize=new GSize(width,height);C.shadowSize=new GSize(1,1);F=aleft;E=atop;if(F==-1){F=Math.floor(width/2)}if(F==-2){F=width-1}if(E==-1){E=Math.floor(height/2)}if(E==-2){E=height-1}C.iconAnchor=new GPoint(F,E);C.infoWindowAnchor=new GPoint(F,E);iconCache[H]=C}var D=new GMarker(G,iconCache[H]);GEvent.addListener(D,"click",function(){if(window.footerEmbed&&window.map2embedViewItem){setMap2embedViewItem(I,text);return false}if(upsold==true){}setSelectedLatLon(B,lat,lon);closeInfoWindow(B);fetchArticle(B,lat,lon,I,{upsold:upsold});return true});GEvent.addListener(D,"mouseover",function(M){var K=getObjectOffset(map[B].getContainer());var L=map[B].fromLatLngToContainerPixel(M);F=(aleft==0)?width:(aleft==-1)?(width/2):(aleft==-2)?0:(width-aleft);E=(atop==0)?height:(atop==-1)?(height/2):(atop==-2)?0:(height-atop);F+=K.x+L.x;E+=K.y+L.y;var J='<div style="font-size:7.5pt; line-height:8.0pt">'+text+"</div>";showToolTipXY(F,E,J)});GEvent.addListener(D,"mouseout",function(J){hideToolTip()});return D}var clusterIcon=new GIcon();clusterIcon.image="/r/images/map/cluster-off.png";clusterIcon.shadow="/r/images/px.gif";clusterIcon.iconSize=new GSize(54,54);clusterIcon.shadowSize=new GSize(1,1);clusterIcon.iconAnchor=new GPoint(27,27);clusterIcon.infoWindowAnchor=new GPoint(27,27);var declusterIcon=new GIcon();declusterIcon.image="/r/images/map/decluster-off.png";declusterIcon.shadow="/r/images/px.gif";declusterIcon.iconSize=new GSize(54,54);declusterIcon.shadowSize=new GSize(1,1);declusterIcon.iconAnchor=new GPoint(27,27);declusterIcon.infoWindowAnchor=new GPoint(27,27);var firstClusterTT=true;var firstDeclusterTT=true;function createClusterMarker(D,C,B,H,A,J,G,E){var I=new GLatLng(H,A);var F=new ClusterOverlay({n:D,crid:C,crn:B,point:I,aleft:J,atop:G,color:E});return F}function pathGetStatic(C,E,G,B){var F=new Array();for(var D=0;D<E.length;D++){F[F.length]=new GLatLng(E[D],G[D])}var A;if(B.fill){A=new GPolygon(F,B.stroke,B.width,B.strokeAlpha,B.fill,B.fillAlpha)}else{A=new GPolyline(F,B.stroke,B.width,B.strokeAlpha)}if(typeof (map2clientid)!="undefined"&&B.clientid&&B.clientid==map2clientid){GEvent.addListener(A,"mouseover",function(){});GEvent.addListener(A,"click",function(){selectMapItem("path",C,E,G)})}return A}function pathAddStatic(C,Q,P,F,D,J,H,N,B,L,O){var M=new GLatLng(D,J);var E=new GLatLng(H,N);var K=pathGetStatic(Q,P,F,O);if(O.distances==0){mgr[C].addOverlay(Q,K)}else{var A=[];A.push(K);var I=K.getVertexCount();for(var G=0;G<(I-1);G++){A.push(new PathDistanceOverlay({start:K.getVertex(G),end:K.getVertex(G+1),units:O.distances}))}mgr[C].addOverlay(Q,A)}return K}var viewboxAlphaFilterLight="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/r/images/map/viewbox-bg.png', sizingMethod = 'scale')";var viewboxAlphaFilterDark="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/r/images/map/viewbox-bg-dark.png', sizingMethod = 'scale')";function MonkeyViewOverlay(G,F,B,C,A,E,D){this.n_=G;this.viewnum_=F;this.point_=B;this.width_=C;this.height_=A;this.title_=E;this.viewid_=D}MonkeyViewOverlay.prototype=new GOverlay();MonkeyViewOverlay.prototype.initialize=function(A){var B=document.createElement("div");B.style.position="absolute";B.style.marginTop="-"+this.height_+"px";B.style.width=""+this.width_+"px";B.style.height=""+this.height_+"px";B.style.border="2px solid gray";B.style.overflow="hidden";if(is_ie){B.style.cursor="hand"}else{B.style.cursor="pointer"}if(is_ie&&!is_ie7){B.style.filter=viewboxAlphaFilterLight}else{B.style.background="url(/r/images/map/viewbox-bg.png)"}A.getPane(G_MAP_MARKER_PANE).appendChild(B);this.map_=A;this.div_=B};MonkeyViewOverlay.prototype.showBox=function(){this.div_.style.visibility="visible";this.div_.style.display="block"};MonkeyViewOverlay.prototype.hideBox=function(){this.div_.style.visibility="hidden";this.div_.style.display="none"};MonkeyViewOverlay.prototype.setZIndex=function(A){if(this.div_){this.div_.style.zIndex=A}};MonkeyViewOverlay.prototype.remove=function(){this.div_.parentNode.removeChild(this.div_)};MonkeyViewOverlay.prototype.copy=function(){var A=new MonkeyViewOverlay(this.n_,this.viewnum_,this.point_,this.width_,this.height_,this.title_,this.viewid_);if(typeof (overlays)!="undefined"&&typeof (overlays[this.n_])!="undefined"){overlays[this.n_][this.viewnum_]=A}return A};MonkeyViewOverlay.prototype.redraw=function(A){if(!A){return }var B=this.map_.fromLatLngToDivPixel(this.point_);this.div_.style.left=B.x+"px";this.div_.style.top=B.y+"px"};var dotIcon=new GIcon();dotIcon.image="/r/images/map/view-dot.gif";dotIcon.shadow="/r/images/map/view-dot.gif";dotIcon.iconSize=new GSize(10,10);dotIcon.shadowSize=new GSize(10,10);dotIcon.iconAnchor=new GPoint(5,5);dotIcon.infoWindowAnchor=new GPoint(5,5);var showViewid=new Array();function createViewMarker(M,H,C,E,Q,R,A,T,P){showViewid[M][H]=P;var D=new GLatLng(C,Q);var B=new GLatLng(E,R);var L=map[M].fromLatLngToDivPixel(D);var K=map[M].fromLatLngToDivPixel(B);var N=100;var I=100;if(L.x&&L.y&&K.x&&K.y){N=K.x-L.x;I=L.y-K.y}if((N*I)<100){var F=(C+E)/2;var S=(Q+R)/2;var G=A-2;if(G<1){G=1}if(G>19){G=19}var O=new GLatLng(F,S);var J=function(){setSelectedLatLon(F,S);moveTo(F,S,G)};return(function(){var U=new GMarker(O,dotIcon);GEvent.addListener(U,"click",J);return U})();return marker}return new MonkeyViewOverlay(M,H,D,N,I,T,P)}function createViewPopper(D,E,K,B,C,F,L,I,G,H,A){var J=new GLatLng(((K+B)/2),((C+F)/2));return new SmartTextOverlay({n:D,articleid:null,point:J,text:I,type:SMART_TEXT_VIEW,num:E,viewid:H,url:A,zoom:L,description:G})}function mapWipe(A){clearMarkers[A]();wipePathTracing(A);hideToolTip()}function drawTextMarker(D,B,C){var A=null;if(C.color==3){C.textcolor="black";A=createLandmarkTextMarker(D,B,C)}else{A=createTextMarker(D,B,C)}mgr[D].addOverlay(B,A);if(C.hide){A.hide()}}function drawIconMarker(D,B,C){var A=createIconMarker(D,B,C);mgr[D].addOverlay(B,A);if(C.hide){A.hide()}}function drawTextAndIconMarkers(D,A,B){var C=[];if(B.color==3){B.textcolor="black";C[0]=createLandmarkTextMarker(D,A,B)}else{C[0]=createTextMarker(D,A,B)}C[1]=createIconMarker(D,A,B);mgr[D].addOverlay(A,C);if(B.hide){C[0].hide();C[1].hide()}}function drawClusterMarker(D,C,B,H,A,I,G,E){var F=createClusterMarker(D,C,B,H,A,I,G,E);mgr[D].addOverlay("C"+C,F);var J=function(){fetchCluster(D,C,H,A)};F.install(J)}function drawCommentMarker(D,E,F,O,K,B,L,J,N,I,H,M,C,A,G){}var rssholder=new Array();function addRSSHolder(C,B,A){rssholder[C][B]=A}function rssHandler(D,B,A,C){if(window.rssExternal){rssExternal(D,B,A,C)}}function getActualLatMinMax(D){var B=map[D].getBounds();var A=B.getSouthWest().lat();var C=B.getNorthEast().lat();return{latmin:A,latmax:C}}function getActualLngMinMax(D){var B=map[D].getBounds();var C=B.getSouthWest().lng();var A=B.getNorthEast().lng();return{lngmin:C,lngmax:A}}function getLatMin(D){var B=map[D].getBounds();var A=B.getSouthWest().lat();var C=B.getNorthEast().lat();return(B.isFullLat()||(A>C&&(A+90)>=(90-C)))?-90:B.getSouthWest().lat()}function getLatMax(D){var B=map[D].getBounds();var A=B.getSouthWest().lat();var C=B.getNorthEast().lat();return(B.isFullLat()||(A>C&&(A+90)<(90-C)))?90:B.getNorthEast().lat()}function getLonMin(D){var B=map[D].getBounds();var A=B.getSouthWest().lng();var C=B.getNorthEast().lng();return(B.isFullLng()||(A>C&&(A+180)>=(180-C)))?-180:B.getSouthWest().lng()}function getLonMax(D){var B=map[D].getBounds();var A=B.getSouthWest().lng();var C=B.getNorthEast().lng();return(B.isFullLng()||(A>C&&(A+180)<(180-C)))?180:B.getNorthEast().lng()}function getZoom(A){if(!map[A]){return 20}return map[A].getZoom()}function getZoomExtent(B){var A=map[B].getCurrentMapType();if(A==G_NORMAL_MAP){return 17}if(A==G_SATELLITE_MAP){return 20}if(A==G_HYBRID_MAP){return 20}if(A==G_PHYSICAL_MAP){return 15}return 20}function searchGetBounds(E){var M=getZoom(E);var J=getLatMin(E);var D=getLonMin(E);var C=getLatMax(E);var H=getLonMax(E);var A=getCenterLat(E);var G=getCenterLon(E);var B=(C-J)*(H-D);var F=getActualLatMinMax(E);var L=getActualLngMinMax(E);var I=(C-J)*0.25;var K=(H-D)*0.25;sLatMin=Math.max(-91,J-I);sLatMax=Math.min(91,C+I);sLonMin=Math.max(-181,D-K);sLonMax=Math.min(181,H+K);sArea=B;return{latmin:sLatMin,latmax:sLatMax,lonmin:sLonMin,lonmax:sLonMax,area:sArea,latbounds:F,lngbounds:L}}function isVisible(B,A){if(!map[B]){return false}return map[B].getBounds().contains(A)}function isIntersection(B,A){if(!map[B]){return false}return map[B].getBounds().intersects(A)}function toggleItemBlock(B){var A=de(B);if(A.style.height==""){A.style.height="16px"}else{A.style.height=""}}function useSelection(){return false}zmMarkerSet=false;function setZoomCheck(){var A=de("zoomcheck2");if(A!=null&&!zmMarkerSet){A.innerHTML='<img class="checkon" src="/r/images/home/checkbox-on.gif" />';zmMarkerSet=true}}albumDistanceSet=false;function setAlbumDistance(){var A=de("albumcheck1");if(A!=null&&!albumDistanceSet){A.innerHTML='<img class="checkon" src="/r/images/home/checkbox-on.gif" />';albumDistanceSet=true}}function displayRSS(B,F,A,E,I,H,G){var C;if(H.length>33){C=H.substring(0,29)+"..."}else{C=H}var D="viewid="+encodeURIComponent(E);D+="&articleid="+encodeURIComponent(I);D+="&title="+encodeURIComponent(H);D+="&type="+encodeURIComponent(G);clearRssArray();map[B].openInfoWindowHtml(new GLatLng(F,A),'<div id="rsspane" style="width:320px; height:280px; text-align:left; overflow:auto"></div>',{noCloseOnClick:true,onOpenFn:function(){ajaxCall("/RSSQuery",D,function(J){setInnerHtml("rsspane",J)})}})}var rssDetShown=new Array();function clearRssArray(){rssDetShown=new Array()}function toggleRss(B){var E=de("rssresult"+B);var D=de("rssdetail"+B);var A=de("rssbordertop"+B);var F=de("rssresultclear"+B);var C=de("rssborderbot"+B);if(rssDetShown[B]=="undefined"){rssDetShown[B]=false}if(rssDetShown[B]){D.style.display="none";E.style.backgroundImage="url(/r/images/home/overlay-results-plus.png)";E.style.marginTop="4px";A.style.display="none";C.style.display="none";F.style.backgroundImage="none";rssDetShown[B]=false}else{D.style.display="block";E.style.backgroundImage="url(/r/images/home/overlay-results-minus.png)";E.style.marginTop="-11px";A.style.display="block";C.style.display="block";F.style.backgroundImage="url(/r/images/home/overlay-results-border-tile.png)";rssDetShown[B]=true}}function wipePathTracing(A){wipePointAnimation(A);wipeTrailDrawing(A)}var trailDrawing=new Array();function wipeTrailDrawing(B){if(!trailDrawing[B]){trailDrawing[B]=new Array()}for(var A=0;A<trailDrawing[B].length;A++){map[B].removeOverlay(trailDrawing[B][A])}if(trailDrawing[B].length>0){trailDrawing[B].length=0}}function setTrailDrawing(D,C){for(var B=0;B<C.length;B++){var A=new GPolyline(C[B]);trailDrawing[D].push(A);map[D].addOverlay(A)}}var pointAnimation=new Array();function wipePointAnimation(A){if(!pointAnimation[A]){pointAnimation[A]=new Array()}if(pointAnimation[A].length>0){pointAnimation[A].length=0}}function setPointAnimation(D,B){var C=new Array();for(var A=0;A<B.length;A++){C=C.concat(B[A])}pointAnimation[D]=C}var pointAnimator=null;var pointAnimationIndex=0;var pointAnimationOverlay;function beginPointAnimation(B,A){if(pointAnimator!=null){clearInterval(pointAnimator)}pointAnimationIndex=pointAnimation[B].length-1;if(pointAnimationIndex<1){return }pointAnimator=setInterval(function(){var C=pointAnimation[B].length;if(pointAnimationIndex<0||pointAnimationIndex>=pointAnimation[B].length){pointAnimationIndex=pointAnimation[B].length-1}if(C==0){return }setAnimationPoint(B,pointAnimation[B][pointAnimationIndex--])},A)}var animationMarker=new Array();function setAnimationPoint(B,A){if(!A||!A.lat||!A.lng||!(A.lat()>=-90&&A.lat()<=90&&A.lng()>=-180&&A.lng()<=180)){return }if(!animationMarker[B]){animationMarker[B]=new AnimationMarker({n:B,point:A});map[B].addOverlay(animationMarker[B])}else{animationMarker[B].setPoint(A)}}function AnimationMarker(A){this.opts=A}AnimationMarker.prototype=new GOverlay();AnimationMarker.prototype.initialize=function(A){this.map=A;this.id=makeAnimationMarkerDiv(this,this.opts,this.map);this.div=de(this.id)};AnimationMarker.prototype.setPoint=function(A){this.opts.point=A;this.reposition()};AnimationMarker.prototype.remove=function(){this.div.parentNode.removeChild(this.div);purge(this.div);this.div=null;this.map=null};AnimationMarker.prototype.copy=function(){var A=new AnimationMarker(this.opts);return A};AnimationMarker.prototype.redraw=function(A){if(!A){return }this.reposition()};AnimationMarker.prototype.reposition=function(){var A=this.map.fromLatLngToDivPixel(this.opts.point);this.div.style.left=A.x+"px";this.div.style.top=A.y+"px"};function makeAnimationMarkerDiv(A,D,E){var F="ANIMATIONMARKER"+D.n;var C=2147483647;var B=new StringBuffer();B.append('<img src="/r/images/map/view-dot.gif" />');(function(){var G=document.createElement("div");G.id=F;G.style.position="absolute";G.style.marginTop="-5px";G.style.marginLeft="-5px";G.style.width="10px";G.style.height="10px";G.style.overflow="visible";G.innerHTML=B.toString();E.getPane(G_MAP_MARKER_PANE).appendChild(G);G.style.zIndex=C})();return F}var mapPrintable=new Array();function setMapPrintable(B,A){mapPrintable[B]=A}function createLandmarkTextMarker(D,B,C){var A=new GLatLng(C.lat,C.lon);return new LandmarkTextOverlay({n:D,articleid:B,point:A,text:C.text,type:SMART_TEXT_NORMAL})}function LandmarkTextOverlay(A){this.opts=A}LandmarkTextOverlay.prototype=new GOverlay();LandmarkTextOverlay.prototype.initialize=function(A){this.map=A;this.id=makeSmarterLandmarkTextDiv(this,this.opts,this.map);this.div=de(this.id)};LandmarkTextOverlay.prototype.show=function(){this.div.style.display="block"};LandmarkTextOverlay.prototype.hide=function(){this.div.style.display="none"};LandmarkTextOverlay.prototype.remove=function(){this.div.parentNode.removeChild(this.div);purge(this.div);this.div=null;this.map=null};LandmarkTextOverlay.prototype.copy=function(){var A=new LandmarkTextOverlay(this.opts);return A};LandmarkTextOverlay.prototype.redraw=function(A){if(!A){return }var B=this.map.fromLatLngToDivPixel(this.opts.point);this.div.style.left=B.x+"px";this.div.style.top=B.y+"px"};function makeSmarterLandmarkTextDiv(V,L,Z){var F=(++smartTextId);var N="SMARTTEXT"+F;var E=100000000+parseInt(L.point.lng()*10000);var Y=function(b){return };var T=function(b){return };var G=function(){return };smarterOverlayMarkers[F]={n:L.n,overlay:V};var D=getSmarterOverlayOffset(L.n,L.point.lat(),L.point.lng());var I;var P;var O;if(D<0){if(D>-36){D=-34}I=true;O="up";P=-D}else{if(D<15){D=13}I=false;O="down";P=D}var H=D-1;var M=I?18:-5;var B=I?P-26:P-8;var C=I?23:-5-B;var W=I?23+B:-10-B;var A=L.text.replace(/\\/g,"\\\\").replace(/\'/g,"\\'").replace(/\"/g,"&#34;");var Q="if (window.pathMode) return false;";Q+="if (window.footerEmbed && window.map2embedViewItem) { setMap2embedViewItem('"+L.articleid+"', '"+A+"'); return false; } ";var U="&nbsp;";if(L.type==SMART_TEXT_VIEW){var S=L.description.replace(/\'/g,"\\'").replace(/\"/g,"&#34;");U='&nbsp;<a href="'+L.url+'" style="color:white; font-size:7.5pt" onmouseover="showToolTip(event, \''+S+"'); window.map["+L.n+"].addOverlay(overlays["+L.n+"]["+L.num+"]); if (overlays["+L.n+"]["+L.num+"].setZIndex) overlays["+L.n+"]["+L.num+'].setZIndex(200000000)" onmousemove="updateToolTip(event)" onmouseout="hideToolTip(); window.map['+L.n+"].removeOverlay(overlays["+L.n+"]["+L.num+'])">'+L.text+"</a>&nbsp;"}else{if(L.type==SMART_TEXT_NORMAL){Q+="fetchArticle("+L.n+", "+L.point.lat()+", "+L.point.lng()+", '"+L.articleid+"'); return false";U='&nbsp;<div style="position: absolute; z-index:1; margin:-1px 0 0 -1px;"><a href="#" onclick="'+Q+'" onmouseover="window.status=\'\'; return true" style="text-decoration: none; font-weight:bold; color:white; font-size:10pt; font-family:Arial;">'+L.text+"</a></div>&nbsp;";U+='<div style="position: absolute;"><a href="#" onclick="'+Q+'" onmouseover="window.status=\'\'; return true" style="text-decoration: none; color:black; font-weight:bold; letter-spacing: -0.0px; font-size:10pt; font-family:Arial; ">'+L.text+"</a></div>"}}var J=new StringBuffer();J.append(U);var X=function(){Y();this.style.zIndex=200000001;setSmarterTextOpacity(F,color,O,100)};var R=function(b){T(b)};var K=function(){G();this.style.zIndex=E;setSmarterTextOpacity(F,color,O,markerOpacity)};(function(){var b=document.createElement("div");b.id=N;b.style.position="absolute";b.style.whiteSpace="nowrap";b.style.marginTop=""+0+"px";b.style.marginLeft="-30px";b.style.width="20px";b.style.height="20px";b.style.overflow="visible";b.onmousemove=R;b.innerHTML=J.toString();Z.getPane(G_MAP_MARKER_PANE).appendChild(b);b.style.zIndex=E})();return N}function initDefault(){if(typeof flashTimeout=="undefined"){flashTimeout=3000}var C=de("ferror");var A=de("fnotice");if(C&&parseBoolean(C.value)){Effect.BlindDown("flasherror",{duration:0.75});setTimeout("Effect.BlindUp('flasherror', {duration: 0.75})",flashTimeout)}else{if(A&&parseBoolean(A.value)){Effect.BlindDown("flashnotice",{duration:0.75});setTimeout("Effect.BlindUp('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){var D=de("loginname");var G=de("loginpass");var E=de("loginrememberme");var A=D.value;var C=G.value;var F=(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 doOpenidLogin(){var F=de("openidurl").value;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;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 A="openid="+encodeURIComponent("https://www.google.com/accounts/o8/id")+"&next="+D;window.location.href=B+A}var networkTwitter=3;function doTwitterLogin(){setLoginMsg("Authenticating...");window.location.href=prependAjaxPrefix("/oauth/linker?networkid="+networkTwitter)}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("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}$("flashnoticemsg").innerHTML=A;Effect.BlindDown("flashnotice",{duration:0.75});setTimeout("Effect.BlindUp('flashnotice', {duration: 0.75})",flashTimeout)}function flashError(A){if(typeof flashTimeout=="undefined"){flashTimeout=3000}$("flasherrormsg").innerHTML=A;Effect.BlindDown("flasherror",{duration:0.75});setTimeout("Effect.BlindUp('flasherror', {duration: 0.75})",flashTimeout)}function createNewMap(){if(sessionClientid==null){setLoginMsg("Sorry, you must be logged in to create new maps.");showLoginPane();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="/settings/account">upgrade</a> to a Professional account.</div>')}function jumpToProfile(A){if(A!=null){location.href="/profile/user/"+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.loginoptionselected").each(function(B){B.removeClassName("loginoptionselected")});if($("loginfields")!=null){$("loginfields").hide()}$("openidfields").hide();$("facebookfields").hide();$("googlefields").hide();$("twitterfields").hide();if(A=="MapWith.Us"){$("mwuloginoption").addClassName("loginoptionselected");$("loginfields").show();$("loginname").focus()}else{if(A=="OpenID"){$("openidloginoption").addClassName("loginoptionselected");$("openidfields").show();$("openidurl").focus()}else{if(A=="Facebook"){$("fbloginoption").addClassName("loginoptionselected");$("facebookfields").show()}else{if(A=="Google"){$("googleloginoption").addClassName("loginoptionselected");$("googlefields").show()}else{if(A=="Twitter"){$("twitterloginoption").addClassName("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/user/" class="lb big">'+A+"</a>";C+='&nbsp;&nbsp;<fb:profile-pic uid="'+B+'" linked="true" facebook-logo="true"></fb:profile-pic>'}var geocoder=null;var clearMarkers=new Array();var mapClickDirections=true;var containsForestInfo=false;function initMap(F,B,E,D,C,A){map[F]=new GMap2(de(B));map[F].setCenter(new GLatLng(defLat[F],defLon[F]),defZoom[F]);if(typeof (C)=="undefined"||C=="full"){map[F].addControl(new GLargeMapControl())}else{if(C=="compact"){map[F].addControl(new GSmallMapControl())}}if(typeof (E)=="undefined"){E="menu"}if(E){if(E=="wide"){map[F].addControl(new GMapTypeControl())}else{map[F].addControl(new GMenuMapTypeControl())}}if(typeof (D)=="undefined"||D){map[F].addControl(new GOverviewMapControl())}map[F].enableDoubleClickZoom();map[F].enableScrollWheelZoom();map[F].enableContinuousZoom();GEvent.addDomListener(map[F].getContainer(),"DOMMouseScroll",wheelevent);map[F].getContainer().onmousewheel=wheelevent;map[F].addMapType(G_PHYSICAL_MAP);setMapType(F,"map");mgr[F]=new GeoOverlayManager(F);mdd[F]=new GDirections(map[F]);initMapListeners(F,A);if(geocoder==null){geocoder=new GClientGeocoder()}}function initMapListeners(B,A){GEvent.addListener(map[B],"click",function(D,C){if(window.pathMode&&window.hookPathTool){hookPathTool(C)}setSelected(B,C)});GEvent.addListener(map[B],"zoomend",function(){if(useSelection()){panToSelected(B)}});GEvent.addListener(map[B],"moveend",function(){});GEvent.addListener(map[B],"singlerightclick",function(D,C,H){var L=new GPoint(D.x+7,D.y+7);var I=map[B].fromContainerPixelToLatLng(D);var F=map[B].fromContainerPixelToLatLng(L);var J=Math.abs(F.lng()-I.lng());var E=Math.abs(F.lat()-I.lat());if(pathPoly){for(var G=0;G<pathPoly.getVertexCount();G++){var K=pathPoly.getVertex(G);if(Math.abs(I.lat()-K.lat())<E&&Math.abs(I.lng()-K.lng())<J){pathPoly.deleteVertex(G);return }}}if(!A){initItemDirections(B,I.lat(),I.lng())}});GEvent.addListener(map[B],"maptypechanged",function(){if(window.hookMapType[B]){hookMapType[B]()}});GEvent.addListener(mdd[B],"load",function(){directionsLoad(B)});GEvent.addListener(mdd[B],"error",function(){directionsError(B)});if(containsForestInfo==true){GEvent.addListener(map[B],"drag",killZoom);GEvent.addListener(map[B],"dragend",startZoom);GEvent.addListener(map[B],"moveend",function(){setTimeout(killRedraw,delay)})}}function addZoomListener(B,A){GEvent.addListener(map[B],"zoomend",A)}var hookMapType=new Array();function setMapType(B,A){if(A=="map"||A=="normal"){map[B].setMapType(G_NORMAL_MAP)}if(A=="sat"||A=="satellite"){map[B].setMapType(G_SATELLITE_MAP)}if(A=="hyb"||A=="hybrid"){map[B].setMapType(G_HYBRID_MAP)}if(A=="ter"||A=="terrain"){map[B].setMapType(G_PHYSICAL_MAP)}if(window.hookMapType[B]){hookMapType[B](A)}}function getMapType(B){var A=map[B].getCurrentMapType();if(A==G_NORMAL_MAP){return"normal"}if(A==G_SATELLITE_MAP){return"satellite"}if(A==G_HYBRID_MAP){return"hybrid"}if(A==G_PHYSICAL_MAP){return"terrain"}return"normal"}function GeoOverlayManager(A){this.n=A;this.overlayDrawn={};this.overlayCache={};this.overlayMask={};this.cached=0}GeoOverlayManager.prototype.addOverlay=function(C,B){var A=true;if(typeof (B)=="undefined"){B=null}if(typeof (this.overlayCache[C])!="undefined"){if(B==null){B=this.overlayCache[C];A=false}else{removeOverlays(this.n,this.overlayCache[C]);this.overlayCache[C]=B}}else{if(B==null){return }else{this.overlayCache[C]=B;this.cached++}}this.overlayDrawn[C]=true;if(!this.overlayMask[C]){if(A){addOverlays(this.n,B)}else{showOverlays(B)}}};GeoOverlayManager.prototype.maskOverlay=function(B,A){if(typeof (this.overlayCache[B])!="undefined"){if(A){this.overlayMask[B]=true;this.hideOverlay(B)}else{if(typeof (this.overlayMask[B])!="undefined"){delete this.overlayMask[B]}this.addOverlay(B)}}};GeoOverlayManager.prototype.hideOverlay=function(A){if(typeof (this.overlayDrawn[A])=="undefined"){return }delete this.overlayDrawn[A];hideOverlays(this.overlayCache[A])};GeoOverlayManager.prototype.hideOverlays=function(){for(var B in this.overlayDrawn){delete this.overlayDrawn[B];var A=this.overlayCache[B];hideOverlays(A)}};GeoOverlayManager.prototype.checkReset=function(){var A;if(this.cached>1000){for(A in this.overlayCache){removeOverlays(this.n,this.overlayCache[A]);if(typeof (this.overlayDrawn[A])!="undefined"){delete this.overlayDrawn[A]}delete this.overlayCache[A]}this.cached=0;return true}return false};function addOverlays(C,A){if(typeof (A.length)=="undefined"){map[C].addOverlay(A)}else{for(var B=0;B<A.length;B++){map[C].addOverlay(A[B])}}}function removeOverlays(C,A){if(typeof (A.length)=="undefined"){map[C].removeOverlay(A)}else{for(var B=0;B<A.length;B++){map[C].removeOverlay(A[B])}}}function showOverlays(A){if(typeof (A.length)=="undefined"){A.show()}else{for(var B=0;B<A.length;B++){A[B].show()}}}function hideOverlays(A){if(typeof (A.length)=="undefined"){A.hide()}else{for(var B=0;B<A.length;B++){A[B].hide()}}}var GeoFetchCache={_cache:[],store:function(I,C,D,G,E,A,B,F,H){this._cache[I]={articleTitle:C,articleDate:D,articleType:G,latitude:E,longitude:A,minZoom:B,maxZoom:F,options:H};return this._cache[I]},get:function(A){return(typeof (this._cache[A]!=="undefined"))?this._cache[A]:null},clear:function(){for(var A in this._cache){delete this._cache[A]}},addItem:function(B,K,I,C,G,F,A,H,D,J){var E=null;if(typeof (I)=="undefined"){E=this.get(K)}else{E=this.store(K,I,C,G,F,A,H,D,J)}if(E!=null){addMapItem(B,K,E.articleTitle,E.articleDate,E.articleType,E.latitude,E.longitude,E.minZoom,E.maxZoom,E.options)}}};function OldGeoOverlayManager(A){this.n=A;this.visible=new Array();this.pathVisible=new Array();this.pathDistance=new Array();this.geometricObjects=new Array();this.pathConcealed=null;this.add=function(D,B,C,E){var F=map[A].getZoom();this.visible[this.visible.length]=new GeoOverlay(D,B,C,E);map[A].addOverlay(D)};this.addPath=function(F,E,B,D,C,G){var H=map[A].getZoom();this.pathVisible[this.pathVisible.length]=new GeoPathOverlay(F,E,B,D,C,G);if(this.pathConcealed!=E){map[A].addOverlay(F)}};this.addPathDistance=function(E,C,B){var D=this.pathDistance.length;this.pathDistance[D]=new GeoDistanceSet(E,C,B);if(this.pathConcealed!=C){this.pathDistance[D].show(A)}};this.addGeometry=function(C,B,D){var E=map[A].getZoom();this.geometricObjects[this.geometricObjects.length]=new GeoOverlay(C,null,B,D);map[A].addOverlay(C)};this.concealPath=function(E){var C=false;var D=false;var B;for(B=0;B<this.pathVisible.length;B++){if(this.pathVisible[B].articleid==this.pathConcealed){map[A].addOverlay(this.pathVisible[B].overlay);D=true}if(this.pathVisible[B].articleid==E){map[A].removeOverlay(this.pathVisible[B].overlay);C=true}if(D&&C){break}}C=false;D=false;for(B=0;B<this.pathDistance.length;B++){if(this.pathDistance[B].articleid==this.pathConcealed){this.pathDistance[B].show(A);D=true}if(this.pathDistance[B].articleid==E){this.pathDistance[B].hide(A);C=true}if(D&&C){break}}this.pathConcealed=E;this.redraw()};this.remove=function(C){var B=false;var D;for(D=0;D<this.visible.length;D++){if(this.visible[D].overlay==C){map[A].removeOverlay(this.visible[D].overlay);this.visible.splice(D,1);B=true;break}}if(B){return }for(D=0;D<this.pathVisible.length;D++){if(this.pathVisible[D].overlay==C){map[A].removeOverlay(this.pathVisible[D].overlay);this.pathVisible.splice(D,1);break}}};this.redraw=function(){};this.clear=function(){var B;for(B=0;B<this.visible.length;B++){map[A].removeOverlay(this.visible[B].overlay)}this.visible.length=0;for(B=0;B<this.pathVisible.length;B++){map[A].removeOverlay(this.pathVisible[B].overlay)}this.pathVisible.length=0;for(B=0;B<this.pathDistance.length;B++){this.pathDistance[B].hide(A)}this.pathDistance.length=0;for(B=0;B<this.geometricObjects.length;B++){map[A].removeOverlay(this.geometricObjects[B].overlay)}this.geometricObjects.length=0}}function GeoOverlay(A,C,D,B){this.overlay=A;this.point=C;this.minzoom=D;this.maxzoom=B}function GeoPathOverlay(A,C,D,F,E,B){this.overlay=A;this.articleid=C;this.swpoint=D;this.nepoint=F;this.minzoom=E;this.maxzoom=B;this.bounds=new GLatLngBounds(this.swpoint,this.nepoint)}function GeoDistanceSet(D,A,E){this.path=D;this.articleid=A;this.units=E;this.overlays=new Array();var C=this.path.getVertexCount();for(var B=0;B<(C-1);B++){this.overlays[B]=new PathDistanceOverlay({start:this.path.getVertex(B),end:this.path.getVertex(B+1),units:this.units})}this.show=function(G){for(var F=0;F<this.overlays.length;F++){map[G].addOverlay(this.overlays[F])}};this.hide=function(G){for(var F=0;F<this.overlays.length;F++){map[G].removeOverlay(this.overlays[F])}}}function isDefaultView(A){if(Math.abs(getCenterLat(A)-defLat[A])>0.001){return false}if(Math.abs(getCenterLon(A)-defLon[A])>0.001){return false}if(map[A].getZoom()!=defZoom[A]){return false}return true}function makeLatLng(A,B){return new GLatLng(A,B)}var selectionIcon=new GIcon();selectionIcon.image="/r/images/map/marker.png";selectionIcon.shadow="/r/images/map/marker.png";selectionIcon.iconSize=new GSize(20,20);selectionIcon.shadowSize=new GSize(20,20);selectionIcon.iconAnchor=new GPoint(10,10);selectionIcon.infoWindowAnchor=new GPoint(10,10);var selectionMarker=new Array();var selectionLat=new Array();var selectionLon=new Array();function setSelected(B,A){if((typeof (newToolsActive)=="undefined"||!newToolsActive)||!A||!A.lat||!A.lng||!(A.lat()>=-90&&A.lat()<=90&&A.lng()>=-180&&A.lng()<=180)){return }if(!selectionMarker[B]){selectionMarker[B]=new GMarker(new GLatLng(A.lat(),A.lng()),selectionIcon,{clickable:false});map[B].addOverlay(selectionMarker[B])}else{selectionMarker[B].setPoint(new GLatLng(A.lat(),A.lng()))}selectionLat[B]=A.lat();selectionLon[B]=A.lng();setZoomCheck();setAlbumDistance()}function setSelectedLatLon(C,A,B){setSelected(C,new GLatLng(A,B))}function removeSelected(A){if(selectionMarker[A]==null){return }map[A].removeOverlay(selectionMarker[A]);selectionMarker[A]=null;selectionLat[A]=null;selectionLon[A]=null}function getSelectedLat(A){return selectionLat[A]}function getSelectedLon(A){return selectionLon[A]}function mapDimensions(A){return map[A].getSize()}function getCenterLat(B){var A=map[B].getCenter();if(A==null||!A.lat){return null}return map[B].getCenter().lat()}function getCenterLon(B){var A=map[B].getCenter();if(A==null||!A.lng){return null}return map[B].getCenter().lng()}function moveTo(E,C,D,B){var A=new GLatLng(C,D);map[E].setCenter(A,B)}function panTo(C,A,B){moveTo(C,A,B,map[C].getZoom())}function slideTo(D,B,C){var A=new GLatLng(B,C);map[D].panTo(A)}function zoomTo(B,A){map[B].setZoom(A)}function moveWithZoomConstraint(F,D,E,A,B){var C=getZoom(F);if(C<A){C=A}else{if(C>B){C=B}}moveTo(F,D,E,C)}function centerOn(C,A,B){panTo(C,A,B);setSelectedLatLon(C,A,B)}function moveToDefault(A){moveTo(A,defLat[A],defLon[A],defZoom[A])}function panToSelected(A){if(selectionLat[A]&&selectionLon[A]){panTo(A,getSelectedLat(A),getSelectedLon(A))}}function isDigit(B){var A=B.charCodeAt(0);return(A>=48&&A<=57)}function isSpace(A){return(A==" ")}function isDot(A){return(A==".")}function isDash(A){return(A=="-")}function isComma(A){return(A==",")}function isZip(C){var B=true;var A;for(A=0;A<C.length;A++){if(!isDigit(C.charAt(A))){B=false}}return B}function isGPS(C){var A=true;if(isZip(C)){return false}var B;for(B=0;B<C.length;B++){if(isComma(C.charAt(B))){continue}if(!isDigit(C.charAt(B))&&!isSpace(C.charAt(B))&&!isDot(C.charAt(B))&&!isDash(C.charAt(B))){A=false}}return A}function setGoToFocus(A){de("gototext"+A).style.display="none";de("gotoinput"+A).focus()}function checkGoTo(A){if(de("gotoinput"+A).value.length<=0){de("gototext"+A).style.display="inline"}else{de("gototext"+A).style.display="none"}}function goTo(B,A){if(isGPS(A)){panToGPS(B,A)}else{panToAddress(B,A)}}function geocode(A,B){geocoder.getLatLng(A,B)}function panToAddress(E,D,C){var A=D;var B=C;if(!A||A.length<1){return }if(!C||C.length<1){B=17}geocode(A,function(F){if(!F){MonkeyDialog.show(A+" not found")}else{moveTo(E,F.lat(),F.lng(),B);setSelected(E,F)}})}function panToGPS(D,C){var A=C;if(!A||A.length<1){return }var B=A.split(",",2);moveTo(D,B[0],B[1],15);setSelectedLatLon(D,B[0],B[1])}var markerOpacity=75;function changeMarkerOpacity(B,A){if(markerOpacity<=25&&B<0||markerOpacity>=100&&B>0){return }setMarkerOpacity(markerOpacity+B,A?A:false)}function setMarkerOpacity(A,B){markerOpacity=A;if(markerOpacity<=25){markerOpacity=25}if(markerOpacity>=100){markerOpacity=100}if(B){B()}de("mapopacitypct").innerHTML=markerOpacity}var hoveredOverlay=new Array();var hoveredOverlayIndex=new Array();function hoverOverlay(B,A){if(hoveredOverlay[B]){hoveredOverlay[B].style.zIndex=hoveredOverlayIndex[B]}hoveredOverlay[B]=A;hoveredOverlayIndex[B]=A.style.zIndex;A.style.zIndex=1000000}function unhoverOverlay(B,A){if(hoveredOverlay[B]==A){A.style.zIndex=hoveredOverlayIndex[B];hoveredOverlay[B]=null}}function ClusterOverlay(A){this.opts=A}ClusterOverlay.prototype=new GOverlay();ClusterOverlay.prototype.initialize=function(A){this.map=A;this.id=makeClusterDiv(this.opts,this.map);this.div=de(this.id)};ClusterOverlay.prototype.show=function(){this.div.style.display="block"};ClusterOverlay.prototype.hide=function(){this.div.style.display="none"};ClusterOverlay.prototype.remove=function(){this.div.parentNode.removeChild(this.div);purge(this.div);this.div=null;this.map=null};ClusterOverlay.prototype.copy=function(){var A=new ClusterOverlay(this.opts);return A};ClusterOverlay.prototype.redraw=function(A){if(!A){return }var B=this.map.fromLatLngToDivPixel(this.opts.point);this.div.style.left=B.x+"px";this.div.style.top=B.y+"px"};ClusterOverlay.prototype.install=function(A){this.div.onclick=A;this.div.onmousemove=updateToolTip};var clusterId=0;function makeClusterDiv(C,D){var A=(++clusterId);var E="CLUSTER"+A;var B=800000000+parseInt(C.point.lat()*10000);(function(I,H,G,F,K,J){var L=document.createElement("div");L.id=I;L.style.cursor="pointer";L.style.position="absolute";L.style.whiteSpace="nowrap";L.style.textAlign="center";L.style.fontSize=H>999?"8.0pt":H>99?"10.0pt":"12.0pt";L.style.fontWeight="bold";L.style.fontFamily="Helvetica, Arial, Verdana, sans-serif";L.style.color="white";L.style.marginLeft=(G==-1)?"-20px":(G==-2)?"-40px":("-"+G+"px");L.style.marginTop=(F==-1)?"-20px":(F==-2)?"-40px":("-"+F+"px");L.style.width="40px";L.style.height="40px";L.style.lineHeight="40px";L.style.overflow="hidden";L.style.backgroundImage="url(/r/images/map/cluster-simple-"+(K==2?"red":"blue")+".png)";L.innerHTML='<div style="width:39px">'+H+"</div>";D.getPane(G_MAP_MARKER_SHADOW_PANE).appendChild(L);L.style.zIndex=J})(E,C.crn,C.aleft,C.atop,C.color,B);return E}function SimpleIconOverlay(A){this.opts=A}SimpleIconOverlay.prototype=new GOverlay();SimpleIconOverlay.prototype.initialize=function(A){this.map=A;this.id=makeSimpleIconElement(this.opts,this.map);this.div=de(this.id)};SimpleIconOverlay.prototype.show=function(){this.div.style.display="block"};SimpleIconOverlay.prototype.hide=function(){this.div.style.display="none"};SimpleIconOverlay.prototype.remove=function(){this.div.parentNode.removeChild(this.div);purge(this.div);this.div=null;this.map=null};SimpleIconOverlay.prototype.copy=function(){var A=new ClusterOverlay(this.opts);return A};SimpleIconOverlay.prototype.redraw=function(A){if(!A){return }var B=this.map.fromLatLngToDivPixel(this.opts.point);this.div.style.left=B.x+"px";this.div.style.top=B.y+"px"};SimpleIconOverlay.prototype.install=function(A){this.div.onclick=A;this.div.onmousemove=updateToolTip};var simpleIconId=0;function makeSimpleIconElement(C,D){var A=(++simpleIconId);var E="SIMPLEICON"+A;var B=900000000+parseInt(C.point.lat()*10000);(function(Q,M,G,U,N,T,I,J,K,V,F,H,S,R){var P=V;var O=F;if(P==-1){P=Math.floor(J/2)}if(P==-2){P=J-1}if(O==-1){O=Math.floor(K/2)}if(O==-2){O=K-1}var L=document.createElement("img");L.id=Q;L.style.display="block";L.style.cursor="pointer";L.style.position="absolute";L.style.marginTop=(-O)+"px";L.style.marginLeft=(-P)+"px";L.style.width=J+"px";L.style.height=K+"px";L.src=H;D.getPane(G_MAP_MARKER_PANE).appendChild(L);L.style.zIndex=M;if(R){L.style.backgroundColor="white";L.style.padding="2px";L.style.border="1px solid silver"}L.onclick=function(){if(window.footerEmbed&&window.map2embedViewItem){setMap2embedViewItem(U,N);return false}if(S==true){}setSelectedLatLon(G,T,I);closeInfoWindow(G);fetchArticle(G,T,I,U,{upsold:S});return true};L.onmouseover=function(X){if(!X){X=window.event}var W='<div style="font-size:7.5pt; line-height:8.0pt">'+N+"</div>";showToolTip(X,W)};L.onmouseout=function(W){hideToolTip()}})(E,B,C.n,C.articleid,C.text,C.point.lat(),C.point.lng(),C.width,C.height,C.aleft,C.atop,C.url,C.upsold,C.border);return E}function SmartTextOverlay(A){this.opts=A}SmartTextOverlay.prototype=new GOverlay();var SMART_TEXT_NORMAL=0;var SMART_TEXT_WEB=1;var SMART_TEXT_RSS=2;var SMART_TEXT_VIDEO=3;var SMART_TEXT_VIEW=4;var SMART_TEXT_ZOOMTO=5;var SMART_TEXT_DOCUMENT=6;var SMART_TEXT_MEDIA=7;var SMART_TEXT_PHOTO=8;var SMART_TEXT_PHOTO_OLD=9;SmartTextOverlay.prototype.initialize=function(A){this.map=A;this.setup()};SmartTextOverlay.prototype.setup=function(){if(typeof (this.div)!="undefined"){purge(this.div)}this.id=makeSmarterTextDiv(this,this.opts,this.map);this.div=de(this.id);this.redraw(true)};SmartTextOverlay.prototype.remove=function(){this.div.parentNode.removeChild(this.div);purge(this.div);this.div=null;this.map=null};SmartTextOverlay.prototype.copy=function(){var A=new SmartTextOverlay(this.opts);return A};SmartTextOverlay.prototype.redraw=function(A){if(!A){return }var B=this.map.fromLatLngToDivPixel(this.opts.point);this.div.style.left=B.x+"px";this.div.style.top=B.y+"px"};SmartTextOverlay.prototype.show=function(){this.setup();this.div.style.display="block"};SmartTextOverlay.prototype.hide=function(){this.div.style.display="none"};var smartTextId=0;function makeSmarterTextDiv(W,L,b){var F=(++smartTextId);var N="SMARTTEXT"+F;var E=1000000000+parseInt(L.point.lng()*10000);var Z=function(c){return };var U=function(c){return };var G=function(){return };smarterOverlayMarkers[F]={n:L.n,overlay:W};var D=getSmarterOverlayOffset(L.n,L.point.lat(),L.point.lng());var I;var P;var O;if(D<0){if(D>-36){D=-34}I=true;O="up";P=-D}else{if(D<15){D=13}I=false;O="down";P=D}var H=D-1;var M=I?18:-5;var B=I?P-26:P-8;var C=I?23:-5-B;var X=I?23+B:-10-B;var A=entify(scriptify(L.text));var Q="if (window.pathMode) return false;";Q+="if (window.footerEmbed && window.map2embedViewItem) { setMap2embedViewItem('"+L.articleid+"', '"+A+"'); return false; } ";var R="dview";var V="&nbsp;";if(L.type==SMART_TEXT_VIEW){var T=L.description.replace(/\'/g,"\\'").replace(/\"/g,"&#34;");R="dview";V='&nbsp;<a href="'+L.url+'" style="color:white; font-size:7.5pt" onmouseover="showToolTip(event, \''+T+"'); window.map["+L.n+"].addOverlay(overlays["+L.n+"]["+L.num+"]); if (overlays["+L.n+"]["+L.num+"].setZIndex) overlays["+L.n+"]["+L.num+'].setZIndex(200000000)" onmousemove="updateToolTip(event)" onmouseout="hideToolTip(); window.map['+L.n+"].removeOverlay(overlays["+L.n+"]["+L.num+'])">'+L.text+"</a>&nbsp;"}else{if(L.type==SMART_TEXT_NORMAL){Q+="closeInfoWindow("+L.n+"); fetchArticle("+L.n+", "+L.point.lat()+", "+L.point.lng()+", '"+L.articleid+"'); return false";R=(L.color==1)?"dblue":"dview";V='&nbsp;<a href="#" onclick="'+Q+'" onmouseover="window.status=\'\'; return true" style="color:white; font-size:7.5pt">'+L.text+"</a>&nbsp;"}}var J=new StringBuffer();J.append('<table cellspacing="0" cellpadding="0" style="');if(mapPrintable[L.n]){J.append("background-color:white; border:1px solid black")}else{J.append("border:0")}J.append('"><tr>');J.append('<td id="SMARTTEXTSTART');J.append(""+F);J.append('" class="smarttextpart" style="background-position:top left; background-repeat:no-repeat; background-image:url(/r/images/map/');J.append(R);J.append("/mm-start-");J.append(""+O);J.append("-");J.append(""+markerOpacity);J.append('.png)"><img src="/r/images/px.gif" style="width:9px; height:18px" /></td>');J.append('<td id="SMARTTEXTTILE');J.append(""+F);J.append('" valign="top" class="smarttextpart" style="background-image:url(/r/images/map/');J.append(R);J.append("/mm-tile-");J.append(""+markerOpacity);J.append('.png); background-position:top left; background-repeat:repeat-x; white-space:nowrap; line-height:14px">');J.append(V);J.append("</td>");J.append('<td id="SMARTTEXTEND');J.append(""+F);J.append('" class="smarttextpart" style="background-position:top left; background-repeat:no-repeat; background-image:url(/r/images/map/');J.append(R);J.append("/mm-end-");J.append(""+markerOpacity);J.append('.png)"><img src="/r/images/px.gif" style="width:9px; height:18px" /></td>');J.append("</tr></table>");J.append('<div id="SMARTTEXTCURVE');J.append(""+F);J.append('" class="smarttextpart" style="position:absolute; left:0px; top:0px; margin-top:');J.append(""+M);J.append("px; width:7px; height:5px; background-image:url(/r/images/map/");J.append(R);J.append("/mm-curve-");J.append(""+O);J.append("-");J.append(""+markerOpacity);J.append(".png)");if(mapPrintable[L.n]){J.append("; background-color:white; border-left:1px solid black")}J.append('; overflow:hidden"></div>');J.append('<div id="SMARTTEXTLINE');J.append(""+F);J.append('" class="smarttextpart" style="position:absolute; left:0px; top:0px; margin-top:');J.append(""+C);J.append("px; width:3px; height:");J.append(""+B);J.append("px; background-image:url(/r/images/map/");J.append(R);J.append("/mm-line-");J.append(""+markerOpacity);J.append(".png)");if(mapPrintable[L.n]){J.append("; background-color:white; border:1px solid black; border-top:0; border-bottom:0")}J.append('; overflow:hidden"></div>');J.append('<div id="SMARTTEXTDOT');J.append(""+F);J.append('" class="smarttextpart" style="position:absolute; left:0px; top:0px; margin-left:-2px; margin-top:');J.append(""+X);J.append("px; width:7px; height:6px; background-image:url(/r/images/map/");J.append(R);J.append("/mm-dot-");J.append(""+O);J.append("-");J.append(""+markerOpacity);J.append(".png)");if(mapPrintable[L.n]){J.append("; background-color:white; border:1px solid black")}J.append('; overflow:hidden"></div>');var Y=function(){Z();this.style.zIndex=2000000001;setSmarterTextOpacity(F,R,O,100)};var S=function(c){U(c)};var K=function(){G();this.style.zIndex=E;setSmarterTextOpacity(F,R,O,markerOpacity)};(function(){var c=document.createElement("div");c.id=N;c.style.position="absolute";c.style.whiteSpace="nowrap";c.style.marginTop=""+H+"px";c.style.marginLeft="-2px";c.style.width="20px";c.style.height="20px";c.style.overflow="visible";c.onmouseover=Y;c.onmousemove=S;c.onmouseout=K;c.innerHTML=J.toString();b.getPane(G_MAP_MARKER_PANE).appendChild(c);c.style.zIndex=E})();return N}function setSmarterTextOpacity(D,A,C,B){de("SMARTTEXTSTART"+D).style.backgroundImage="url(/r/images/map/"+A+"/mm-start-"+C+"-"+B+".png)";de("SMARTTEXTTILE"+D).style.backgroundImage="url(/r/images/map/"+A+"/mm-tile-"+B+".png)";de("SMARTTEXTEND"+D).style.backgroundImage="url(/r/images/map/"+A+"/mm-end-"+B+".png)";de("SMARTTEXTCURVE"+D).style.backgroundImage="url(/r/images/map/"+A+"/mm-curve-"+C+"-"+B+".png)";de("SMARTTEXTLINE"+D).style.backgroundImage="url(/r/images/map/"+A+"/mm-line-"+B+".png)";de("SMARTTEXTDOT"+D).style.backgroundImage="url(/r/images/map/"+A+"/mm-dot-"+C+"-"+B+".png)"}var smarterOverlayMarkers=new Array();var overlayPoint=new Array();function getSmarterOverlayOffset(C,J,B){var F=-34;var M=13;var D=0;var N=map[C].fromLatLngToDivPixel(new GLatLng(J,B));while(true){var H={x:N.x,y:N.y+F};var G={x:N.x,y:N.y+M};var A=true;var I=true;for(var E=0;(A||I)&&E<overlayPoint.length;E++){if(A){if(Math.abs(H.x-overlayPoint[E].x)<100&&Math.abs(H.y-overlayPoint[E].y)<18){A=false}}if(I){if(Math.abs(G.x-overlayPoint[E].x)<100&&Math.abs(G.y-overlayPoint[E].y)<18){I=false}}}if(A){D=F;break}if(I){D=M;break}F-=1;M+=1}var L=N.x;var K=N.y+D;overlayPoint[overlayPoint.length]={lat:J,lon:B,x:L,y:K};return D}function resetSmarterOverlays(A){overlayPoint.length=0;smarterOverlayMarkers.length=0}function closeSmarterOverlay(B){if(!smarterOverlayMarkers[B]){return }var A=smarterOverlayMarkers[B];map[A.n].removeOverlay(A.overlay)}function PathDistanceOverlay(A){this.opts=A}PathDistanceOverlay.prototype=new GOverlay();PathDistanceOverlay.prototype.initialize=function(A){this.map=A;this.id=makePathDistanceDiv(this);this.div=de(this.id)};PathDistanceOverlay.prototype.show=function(){this.div.style.display="block"};PathDistanceOverlay.prototype.hide=function(){this.div.style.display="none"};PathDistanceOverlay.prototype.remove=function(){this.div.parentNode.removeChild(this.div);purge(this.div);this.div=null;this.map=null};PathDistanceOverlay.prototype.copy=function(){var A=new PathDistanceOverlay(this.opts);return A};PathDistanceOverlay.prototype.redraw=function(B){if(!B){return }var C=(this.opts.start.lat()+this.opts.end.lat())/2;var D=(this.opts.start.lng()+this.opts.end.lng())/2;var A=new GLatLng(C,D);var E=this.map.fromLatLngToDivPixel(A);this.div.style.left=E.x+"px";this.div.style.top=E.y+"px";this.div.style.zIndex=GOverlay.getZIndex(C)};var pathDistanceDivId=0;function makePathDistanceDiv(F){var A=F.opts;var C=F.map;var H=(++pathDistanceDivId);var D="PATHDISTANCE"+H;var J;var B;if(A.units==1){J="mi";B=A.start.distanceFrom(A.end)*0.000621371192}else{if(A.units==2){J="ft";B=A.start.distanceFrom(A.end)*3.2808399}else{if(A.units==3){J="yd";B=A.start.distanceFrom(A.end)*1.0936133}else{if(A.units==4){J="km";B=A.start.distanceFrom(A.end)*0.001}else{J="m";B=A.start.distanceFrom(A.end)}}}}var I=(B>=100)?0:(B>=10)?2:3;B=""+B;var E=B.indexOf(".")+I;if(E>B.length){E=B.length}B=B.substring(0,E)+"&nbsp;"+J;var G=new StringBuffer();G.append('<span style="background-color:#cc6600; color:white; font-size:7.0pt; font-weight:bold; white-space:nowrap; cursor:default">&nbsp;');G.append(B);G.append("&nbsp;</span>");(function(){var K=document.createElement("div");K.id=D;K.style.position="absolute";K.style.whiteSpace="nowrap";K.style.marginTop="0px";K.style.marginLeft="-20px";K.style.overflow="visible";K.style.filter="alpha(opacity=75)";K.style.opacity=0.75;K.innerHTML=G.toString();C.getPane(G_MAP_MARKER_PANE).appendChild(K)})();return D}function bubbleDimensions(D){var C=mapDimensions(D);var B=Math.min(Math.max(C.width-100,440),650);var A=Math.min(Math.max(C.height-200,150),400);return{width:B,height:A}}var doFetchEmbed=false;function fetchEmbed(A){doFetchEmbed=A}var doFetchEdit=false;function fetchEdit(A){doFetchEdit=A}function fetchArticle(E,G,C,J,A){if(map2id==null){return }if(!A){A={}}if(!A.noreturn){A.noreturn=false}if(!A.upsold){A.upsold=false}if(!A.rating){A.rating=0}var H=new GLatLng(G,C);map[E].openInfoWindowHtml(H,'<img src="/r/images/loading.gif" />');var F="viewid="+map2id+"&articleid="+J+"&n="+E;var B=bubbleDimensions(E);var D=B.width;var I=B.height;F+="&width="+D+"&height="+I;F+="&embed="+doFetchEmbed;F+="&edit="+doFetchEdit;F+="&rating="+A.rating;if(A.crid){F+="&crid="+A.crid;F+="&clat="+A.clat;F+="&clon="+A.clon}if(A.upsold){smartCallXML("/UpsellArticleView",F,function(K){var M=nodeValue(tag(K,"normal")[0]);var N=nodeValue(tag(K,"maximized")[0]);var L=nodeValue(tag(K,"maxtitle")[0]);monkeyInfoWindow(E,H,M,null,null,A.noreturn,N,L)})}else{smartCall("/ArticleView",F,function(K){monkeyInfoWindow(E,H,K,null,null,A.noreturn)})}}function fetchCluster(E,C,G,B){if(map2id==null){return }var H=new GLatLng(G,B);map[E].openInfoWindowHtml(H,'<img src="/r/images/loading.gif" />');var A=bubbleDimensions(E);var D=A.width;var I=A.height;var F="n="+E;F+="&viewid="+map2id;F+="&crid="+C;F+="&clat="+G;F+="&clon="+B;F+="&width="+D+"&height="+I;F+="&embed="+doFetchEmbed;F+="&edit="+doFetchEdit;smartCall("/ClusterView",F,function(J){monkeyInfoWindow(E,H,J,null,null,false)})}function smartItemComments(A){de("tabComments").innerHTML='Map item comments are coming soon!<br/><img src="/r/images/px.gif" width="300" height="1" />'}var directionsPoint=null;function initItemDirections(D,B,C){var A=new GLatLng(B,C);map[D].openInfoWindowHtml(A,de("tabDirections").innerHTML,{noCloseOnClick:true,onOpenFn:function(){smartItemDirections(B,C)}})}function smartItemDirections(A,B){directionsPoint=new GLatLng(A,B);de("tabdirstart2").checked=true;de("tabdirdest1").checked=true;de("tabdirstartinput").value="";de("tabdirdestinput").value="";de("tabdirstartinput").focus()}function setupDirections(A,C,B){if(A){directionsPoint=A}de("tabdirstartinput").value=C?de(C).value:"";de("tabdirdestinput").value=B?de(B).value:""}function getDirections(E){var C=de("tabdirstartinput").value;var A=de("tabdirdestinput").value;var D=de("tabdirstart1").checked&&directionsPoint?""+directionsPoint.lat()+","+directionsPoint.lng():C.length>0?C:false;var B=de("tabdirdest1").checked&&directionsPoint?""+directionsPoint.lat()+","+directionsPoint.lng():A.length>0?A:false;if(D&&B){mdd[E].load(D+" to "+B,{getSteps:true})}else{alert("Enter a start and destination to get directions.")}}var directionsSteps=new Array();function directionsLoad(H){if(!directionsSteps[H]){directionsSteps[H]=new Array()}clearDirectionsSteps(H);var F=de("tabdirstartinput").value;var A=de("tabdirdestinput").value;var G=de("tabdirstart1").checked&&directionsPoint?""+directionsPoint.lat()+","+directionsPoint.lng():F.length>0?encodeURIComponent(F):false;var C=de("tabdirdest1").checked&&directionsPoint?""+directionsPoint.lat()+","+directionsPoint.lng():A.length>0?encodeURIComponent(A):false;var E=0;for(var D=0;D<mdd[H].getNumRoutes();D++){for(var B=0;B<mdd[H].getRoute(D).getNumSteps();B++){directionsSteps[H][E]=createDirectionsStep(mdd[H].getRoute(D).getStep(B).getLatLng(),mdd[H].getRoute(D).getStep(B).getDescriptionHtml()+'<br/><br/><a href="http://maps.google.com/maps?q='+G+"+to+"+C+'&ie=UTF8&z=9&om=1&pw=2" target="_blank">Printable directions</a>');map[H].addOverlay(directionsSteps[H][E]);E++}}}function clearDirectionsSteps(B){if(directionsSteps[B]){for(var A=0;A<directionsSteps[B].length;A++){map[B].removeOverlay(directionsSteps[B][A])}directionsSteps[B].length=0}}function createDirectionsStep(A,C){var B=new GMarker(A);GEvent.addListener(B,"click",function(){B.openInfoWindowHtml(C)});return B}function directionsError(A){if(mdd[A].getStatus().code==G_GEO_UNKNOWN_ADDRESS){alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: "+mdd[A].getStatus().code)}else{if(mdd[A].getStatus().code==G_GEO_SERVER_ERROR){alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: "+mdd[A].getStatus().code)}else{if(mdd[A].getStatus().code==G_GEO_MISSING_QUERY){alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: "+mdd[A].getStatus().code)}else{if(mdd[A].getStatus().code==G_GEO_BAD_KEY){alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: "+mdd[A].getStatus().code)}else{if(mdd[A].getStatus().code==G_GEO_BAD_REQUEST){alert("A directions request could not be successfully parsed.\n Error code: "+mdd[A].getStatus().code)}else{alert("An unknown error occurred.")}}}}}}var preMonkeyInfoWindowCenter=null;function monkeyInfoWindow(H,A,F,D,G,B,C,E){preMonkeyInfoWindowCenter=map[H].getCenter();if(C!=null&&E!=null){F='<div id = "detailmap"></div>'+F;map[H].openInfoWindowHtml(A,F,{maxTitle:E,maxContent:C,noCloseOnClick:true,onOpenFn:function(){if(B){shareNow()}metronome[H].searchCheckLocked(true);if(D){D()}},onCloseFn:function(){metronome[H].searchCheckLocked(false);if(!B&&preMonkeyInfoWindowCenter!=null){map[H].panTo(preMonkeyInfoWindowCenter);preMonkeyInfoWindowCenter=null}if(G){G()}}})}else{map[H].openInfoWindowHtml(A,F,{noCloseOnClick:true,onOpenFn:function(){if(B){shareNow()}metronome[H].searchCheckLocked(true);if(D){D()}},onCloseFn:function(){metronome[H].searchCheckLocked(false);if(!B&&preMonkeyInfoWindowCenter!=null){map[H].panTo(preMonkeyInfoWindowCenter);preMonkeyInfoWindowCenter=null}if(G){G()}}})}}function closeInfoWindow(A){hideToolTip();map[A].closeInfoWindow()}function createTextMarker(D,B,C){var A=new GLatLng(C.lat,C.lon);return new SmartTextOverlay({n:D,articleid:B,point:A,text:C.text,type:SMART_TEXT_NORMAL,color:C.color})}var iconCache=new Array();function createIconMarker(B,I,A){var G=new GLatLng(A.lat,A.lon);return new SimpleIconOverlay({n:B,articleid:I,point:G,text:A.text,url:A.url,width:A.width,height:A.height,aleft:A.aleft,atop:A.atop,border:A.border,upsold:A.upsold});var F,E;G=new GLatLng(lat,lon);var H=url+"/"+aleft+"/"+atop;if(typeof (iconCache[H])=="undefined"){var C=new GIcon();C.image=url;C.shadow="/r/images/px.gif";C.iconSize=new GSize(width,height);C.shadowSize=new GSize(1,1);F=aleft;E=atop;if(F==-1){F=Math.floor(width/2)}if(F==-2){F=width-1}if(E==-1){E=Math.floor(height/2)}if(E==-2){E=height-1}C.iconAnchor=new GPoint(F,E);C.infoWindowAnchor=new GPoint(F,E);iconCache[H]=C}var D=new GMarker(G,iconCache[H]);GEvent.addListener(D,"click",function(){if(window.footerEmbed&&window.map2embedViewItem){setMap2embedViewItem(I,text);return false}if(upsold==true){}setSelectedLatLon(B,lat,lon);closeInfoWindow(B);fetchArticle(B,lat,lon,I,{upsold:upsold});return true});GEvent.addListener(D,"mouseover",function(M){var K=getObjectOffset(map[B].getContainer());var L=map[B].fromLatLngToContainerPixel(M);F=(aleft==0)?width:(aleft==-1)?(width/2):(aleft==-2)?0:(width-aleft);E=(atop==0)?height:(atop==-1)?(height/2):(atop==-2)?0:(height-atop);F+=K.x+L.x;E+=K.y+L.y;var J='<div style="font-size:7.5pt; line-height:8.0pt">'+text+"</div>";showToolTipXY(F,E,J)});GEvent.addListener(D,"mouseout",function(J){hideToolTip()});return D}var clusterIcon=new GIcon();clusterIcon.image="/r/images/map/cluster-off.png";clusterIcon.shadow="/r/images/px.gif";clusterIcon.iconSize=new GSize(54,54);clusterIcon.shadowSize=new GSize(1,1);clusterIcon.iconAnchor=new GPoint(27,27);clusterIcon.infoWindowAnchor=new GPoint(27,27);var declusterIcon=new GIcon();declusterIcon.image="/r/images/map/decluster-off.png";declusterIcon.shadow="/r/images/px.gif";declusterIcon.iconSize=new GSize(54,54);declusterIcon.shadowSize=new GSize(1,1);declusterIcon.iconAnchor=new GPoint(27,27);declusterIcon.infoWindowAnchor=new GPoint(27,27);var firstClusterTT=true;var firstDeclusterTT=true;function createClusterMarker(D,C,B,H,A,J,G,E){var I=new GLatLng(H,A);var F=new ClusterOverlay({n:D,crid:C,crn:B,point:I,aleft:J,atop:G,color:E});return F}function pathGetStatic(C,E,G,B){var F=new Array();for(var D=0;D<E.length;D++){F[F.length]=new GLatLng(E[D],G[D])}var A;if(B.fill){A=new GPolygon(F,B.stroke,B.width,B.strokeAlpha,B.fill,B.fillAlpha)}else{A=new GPolyline(F,B.stroke,B.width,B.strokeAlpha)}if(typeof (map2clientid)!="undefined"&&B.clientid&&B.clientid==map2clientid){GEvent.addListener(A,"mouseover",function(){});GEvent.addListener(A,"click",function(){selectMapItem("path",C,E,G)})}return A}function pathAddStatic(C,Q,P,F,D,J,H,N,B,L,O){var M=new GLatLng(D,J);var E=new GLatLng(H,N);var K=pathGetStatic(Q,P,F,O);if(O.distances==0){mgr[C].addOverlay(Q,K)}else{var A=[];A.push(K);var I=K.getVertexCount();for(var G=0;G<(I-1);G++){A.push(new PathDistanceOverlay({start:K.getVertex(G),end:K.getVertex(G+1),units:O.distances}))}mgr[C].addOverlay(Q,A)}return K}var viewboxAlphaFilterLight="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/r/images/map/viewbox-bg.png', sizingMethod = 'scale')";var viewboxAlphaFilterDark="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/r/images/map/viewbox-bg-dark.png', sizingMethod = 'scale')";function MonkeyViewOverlay(G,F,B,C,A,E,D){this.n_=G;this.viewnum_=F;this.point_=B;this.width_=C;this.height_=A;this.title_=E;this.viewid_=D}MonkeyViewOverlay.prototype=new GOverlay();MonkeyViewOverlay.prototype.initialize=function(A){var B=document.createElement("div");B.style.position="absolute";B.style.marginTop="-"+this.height_+"px";B.style.width=""+this.width_+"px";B.style.height=""+this.height_+"px";B.style.border="2px solid gray";B.style.overflow="hidden";if(is_ie){B.style.cursor="hand"}else{B.style.cursor="pointer"}if(is_ie&&!is_ie7){B.style.filter=viewboxAlphaFilterLight}else{B.style.background="url(/r/images/map/viewbox-bg.png)"}A.getPane(G_MAP_MARKER_PANE).appendChild(B);this.map_=A;this.div_=B};MonkeyViewOverlay.prototype.showBox=function(){this.div_.style.visibility="visible";this.div_.style.display="block"};MonkeyViewOverlay.prototype.hideBox=function(){this.div_.style.visibility="hidden";this.div_.style.display="none"};MonkeyViewOverlay.prototype.setZIndex=function(A){if(this.div_){this.div_.style.zIndex=A}};MonkeyViewOverlay.prototype.remove=function(){this.div_.parentNode.removeChild(this.div_)};MonkeyViewOverlay.prototype.copy=function(){var A=new MonkeyViewOverlay(this.n_,this.viewnum_,this.point_,this.width_,this.height_,this.title_,this.viewid_);if(typeof (overlays)!="undefined"&&typeof (overlays[this.n_])!="undefined"){overlays[this.n_][this.viewnum_]=A}return A};MonkeyViewOverlay.prototype.redraw=function(A){if(!A){return }var B=this.map_.fromLatLngToDivPixel(this.point_);this.div_.style.left=B.x+"px";this.div_.style.top=B.y+"px"};var dotIcon=new GIcon();dotIcon.image="/r/images/map/view-dot.gif";dotIcon.shadow="/r/images/map/view-dot.gif";dotIcon.iconSize=new GSize(10,10);dotIcon.shadowSize=new GSize(10,10);dotIcon.iconAnchor=new GPoint(5,5);dotIcon.infoWindowAnchor=new GPoint(5,5);var showViewid=new Array();function createViewMarker(M,H,C,E,Q,R,A,T,P){showViewid[M][H]=P;var D=new GLatLng(C,Q);var B=new GLatLng(E,R);var L=map[M].fromLatLngToDivPixel(D);var K=map[M].fromLatLngToDivPixel(B);var N=100;var I=100;if(L.x&&L.y&&K.x&&K.y){N=K.x-L.x;I=L.y-K.y}if((N*I)<100){var F=(C+E)/2;var S=(Q+R)/2;var G=A-2;if(G<1){G=1}if(G>19){G=19}var O=new GLatLng(F,S);var J=function(){setSelectedLatLon(F,S);moveTo(F,S,G)};return(function(){var U=new GMarker(O,dotIcon);GEvent.addListener(U,"click",J);return U})();return marker}return new MonkeyViewOverlay(M,H,D,N,I,T,P)}function createViewPopper(D,E,K,B,C,F,L,I,G,H,A){var J=new GLatLng(((K+B)/2),((C+F)/2));return new SmartTextOverlay({n:D,articleid:null,point:J,text:I,type:SMART_TEXT_VIEW,num:E,viewid:H,url:A,zoom:L,description:G})}function mapWipe(A){clearMarkers[A]();wipePathTracing(A);hideToolTip()}function drawTextMarker(D,B,C){var A=null;if(C.color==3){C.textcolor="black";A=createLandmarkTextMarker(D,B,C)}else{A=createTextMarker(D,B,C)}mgr[D].addOverlay(B,A);if(C.hide){A.hide()}}function drawIconMarker(D,B,C){var A=createIconMarker(D,B,C);mgr[D].addOverlay(B,A);if(C.hide){A.hide()}}function drawTextAndIconMarkers(D,A,B){var C=[];if(B.color==3){B.textcolor="black";C[0]=createLandmarkTextMarker(D,A,B)}else{C[0]=createTextMarker(D,A,B)}C[1]=createIconMarker(D,A,B);mgr[D].addOverlay(A,C);if(B.hide){C[0].hide();C[1].hide()}}function drawClusterMarker(D,C,B,H,A,I,G,E){var F=createClusterMarker(D,C,B,H,A,I,G,E);mgr[D].addOverlay("C"+C,F);var J=function(){fetchCluster(D,C,H,A)};F.install(J)}function drawCommentMarker(D,E,F,O,K,B,L,J,N,I,H,M,C,A,G){}var rssholder=new Array();function addRSSHolder(C,B,A){rssholder[C][B]=A}function rssHandler(D,B,A,C){if(window.rssExternal){rssExternal(D,B,A,C)}}function getActualLatMinMax(D){var B=map[D].getBounds();var A=B.getSouthWest().lat();var C=B.getNorthEast().lat();return{latmin:A,latmax:C}}function getActualLngMinMax(D){var B=map[D].getBounds();var C=B.getSouthWest().lng();var A=B.getNorthEast().lng();return{lngmin:C,lngmax:A}}function getLatMin(D){var B=map[D].getBounds();var A=B.getSouthWest().lat();var C=B.getNorthEast().lat();return(B.isFullLat()||(A>C&&(A+90)>=(90-C)))?-90:B.getSouthWest().lat()}function getLatMax(D){var B=map[D].getBounds();var A=B.getSouthWest().lat();var C=B.getNorthEast().lat();return(B.isFullLat()||(A>C&&(A+90)<(90-C)))?90:B.getNorthEast().lat()}function getLonMin(D){var B=map[D].getBounds();var A=B.getSouthWest().lng();var C=B.getNorthEast().lng();return(B.isFullLng()||(A>C&&(A+180)>=(180-C)))?-180:B.getSouthWest().lng()}function getLonMax(D){var B=map[D].getBounds();var A=B.getSouthWest().lng();var C=B.getNorthEast().lng();return(B.isFullLng()||(A>C&&(A+180)<(180-C)))?180:B.getNorthEast().lng()}function getZoom(A){if(!map[A]){return 20}return map[A].getZoom()}function getZoomExtent(B){var A=map[B].getCurrentMapType();if(A==G_NORMAL_MAP){return 17}if(A==G_SATELLITE_MAP){return 20}if(A==G_HYBRID_MAP){return 20}if(A==G_PHYSICAL_MAP){return 15}return 20}function searchGetBounds(E){var M=getZoom(E);var J=getLatMin(E);var D=getLonMin(E);var C=getLatMax(E);var H=getLonMax(E);var A=getCenterLat(E);var G=getCenterLon(E);var B=(C-J)*(H-D);var F=getActualLatMinMax(E);var L=getActualLngMinMax(E);var I=(C-J)*0.25;var K=(H-D)*0.25;sLatMin=Math.max(-91,J-I);sLatMax=Math.min(91,C+I);sLonMin=Math.max(-181,D-K);sLonMax=Math.min(181,H+K);sArea=B;return{latmin:sLatMin,latmax:sLatMax,lonmin:sLonMin,lonmax:sLonMax,area:sArea,latbounds:F,lngbounds:L}}function isVisible(B,A){if(!map[B]){return false}return map[B].getBounds().contains(A)}function isIntersection(B,A){if(!map[B]){return false}return map[B].getBounds().intersects(A)}function toggleItemBlock(B){var A=de(B);if(A.style.height==""){A.style.height="16px"}else{A.style.height=""}}function useSelection(){return false}zmMarkerSet=false;function setZoomCheck(){var A=de("zoomcheck2");if(A!=null&&!zmMarkerSet){A.innerHTML='<img class="checkon" src="/r/images/home/checkbox-on.gif" />';zmMarkerSet=true}}albumDistanceSet=false;function setAlbumDistance(){var A=de("albumcheck1");if(A!=null&&!albumDistanceSet){A.innerHTML='<img class="checkon" src="/r/images/home/checkbox-on.gif" />';albumDistanceSet=true}}function displayRSS(B,F,A,E,I,H,G){var C;if(H.length>33){C=H.substring(0,29)+"..."}else{C=H}var D="viewid="+encodeURIComponent(E);D+="&articleid="+encodeURIComponent(I);D+="&title="+encodeURIComponent(H);D+="&type="+encodeURIComponent(G);clearRssArray();map[B].openInfoWindowHtml(new GLatLng(F,A),'<div id="rsspane" style="width:320px; height:280px; text-align:left; overflow:auto"></div>',{noCloseOnClick:true,onOpenFn:function(){ajaxCall("/RSSQuery",D,function(J){setInnerHtml("rsspane",J)})}})}var rssDetShown=new Array();function clearRssArray(){rssDetShown=new Array()}function toggleRss(B){var E=de("rssresult"+B);var D=de("rssdetail"+B);var A=de("rssbordertop"+B);var F=de("rssresultclear"+B);var C=de("rssborderbot"+B);if(rssDetShown[B]=="undefined"){rssDetShown[B]=false}if(rssDetShown[B]){D.style.display="none";E.style.backgroundImage="url(/r/images/home/overlay-results-plus.png)";E.style.marginTop="4px";A.style.display="none";C.style.display="none";F.style.backgroundImage="none";rssDetShown[B]=false}else{D.style.display="block";E.style.backgroundImage="url(/r/images/home/overlay-results-minus.png)";E.style.marginTop="-11px";A.style.display="block";C.style.display="block";F.style.backgroundImage="url(/r/images/home/overlay-results-border-tile.png)";rssDetShown[B]=true}}function wipePathTracing(A){wipePointAnimation(A);wipeTrailDrawing(A)}var trailDrawing=new Array();function wipeTrailDrawing(B){if(!trailDrawing[B]){trailDrawing[B]=new Array()}for(var A=0;A<trailDrawing[B].length;A++){map[B].removeOverlay(trailDrawing[B][A])}if(trailDrawing[B].length>0){trailDrawing[B].length=0}}function setTrailDrawing(D,C){for(var B=0;B<C.length;B++){var A=new GPolyline(C[B]);trailDrawing[D].push(A);map[D].addOverlay(A)}}var pointAnimation=new Array();function wipePointAnimation(A){if(!pointAnimation[A]){pointAnimation[A]=new Array()}if(pointAnimation[A].length>0){pointAnimation[A].length=0}}function setPointAnimation(D,B){var C=new Array();for(var A=0;A<B.length;A++){C=C.concat(B[A])}pointAnimation[D]=C}var pointAnimator=null;var pointAnimationIndex=0;var pointAnimationOverlay;function beginPointAnimation(B,A){if(pointAnimator!=null){clearInterval(pointAnimator)}pointAnimationIndex=pointAnimation[B].length-1;if(pointAnimationIndex<1){return }pointAnimator=setInterval(function(){var C=pointAnimation[B].length;if(pointAnimationIndex<0||pointAnimationIndex>=pointAnimation[B].length){pointAnimationIndex=pointAnimation[B].length-1}if(C==0){return }setAnimationPoint(B,pointAnimation[B][pointAnimationIndex--])},A)}var animationMarker=new Array();function setAnimationPoint(B,A){if(!A||!A.lat||!A.lng||!(A.lat()>=-90&&A.lat()<=90&&A.lng()>=-180&&A.lng()<=180)){return }if(!animationMarker[B]){animationMarker[B]=new AnimationMarker({n:B,point:A});map[B].addOverlay(animationMarker[B])}else{animationMarker[B].setPoint(A)}}function AnimationMarker(A){this.opts=A}AnimationMarker.prototype=new GOverlay();AnimationMarker.prototype.initialize=function(A){this.map=A;this.id=makeAnimationMarkerDiv(this,this.opts,this.map);this.div=de(this.id)};AnimationMarker.prototype.setPoint=function(A){this.opts.point=A;this.reposition()};AnimationMarker.prototype.remove=function(){this.div.parentNode.removeChild(this.div);purge(this.div);this.div=null;this.map=null};AnimationMarker.prototype.copy=function(){var A=new AnimationMarker(this.opts);return A};AnimationMarker.prototype.redraw=function(A){if(!A){return }this.reposition()};AnimationMarker.prototype.reposition=function(){var A=this.map.fromLatLngToDivPixel(this.opts.point);this.div.style.left=A.x+"px";this.div.style.top=A.y+"px"};function makeAnimationMarkerDiv(A,D,E){var F="ANIMATIONMARKER"+D.n;var C=2147483647;var B=new StringBuffer();B.append('<img src="/r/images/map/view-dot.gif" />');(function(){var G=document.createElement("div");G.id=F;G.style.position="absolute";G.style.marginTop="-5px";G.style.marginLeft="-5px";G.style.width="10px";G.style.height="10px";G.style.overflow="visible";G.innerHTML=B.toString();E.getPane(G_MAP_MARKER_PANE).appendChild(G);G.style.zIndex=C})();return F}var mapPrintable=new Array();function setMapPrintable(B,A){mapPrintable[B]=A}function createLandmarkTextMarker(D,B,C){var A=new GLatLng(C.lat,C.lon);return new LandmarkTextOverlay({n:D,articleid:B,point:A,text:C.text,type:SMART_TEXT_NORMAL})}function LandmarkTextOverlay(A){this.opts=A}LandmarkTextOverlay.prototype=new GOverlay();LandmarkTextOverlay.prototype.initialize=function(A){this.map=A;this.id=makeSmarterLandmarkTextDiv(this,this.opts,this.map);this.div=de(this.id)};LandmarkTextOverlay.prototype.show=function(){this.div.style.display="block"};LandmarkTextOverlay.prototype.hide=function(){this.div.style.display="none"};LandmarkTextOverlay.prototype.remove=function(){this.div.parentNode.removeChild(this.div);purge(this.div);this.div=null;this.map=null};LandmarkTextOverlay.prototype.copy=function(){var A=new LandmarkTextOverlay(this.opts);return A};LandmarkTextOverlay.prototype.redraw=function(A){if(!A){return }var B=this.map.fromLatLngToDivPixel(this.opts.point);this.div.style.left=B.x+"px";this.div.style.top=B.y+"px"};function makeSmarterLandmarkTextDiv(V,L,Z){var F=(++smartTextId);var N="SMARTTEXT"+F;var E=100000000+parseInt(L.point.lng()*10000);var Y=function(b){return };var T=function(b){return };var G=function(){return };smarterOverlayMarkers[F]={n:L.n,overlay:V};var D=getSmarterOverlayOffset(L.n,L.point.lat(),L.point.lng());var I;var P;var O;if(D<0){if(D>-36){D=-34}I=true;O="up";P=-D}else{if(D<15){D=13}I=false;O="down";P=D}var H=D-1;var M=I?18:-5;var B=I?P-26:P-8;var C=I?23:-5-B;var W=I?23+B:-10-B;var A=L.text.replace(/\\/g,"\\\\").replace(/\'/g,"\\'").replace(/\"/g,"&#34;");var Q="if (window.pathMode) return false;";Q+="if (window.footerEmbed && window.map2embedViewItem) { setMap2embedViewItem('"+L.articleid+"', '"+A+"'); return false; } ";var U="&nbsp;";if(L.type==SMART_TEXT_VIEW){var S=L.description.replace(/\'/g,"\\'").replace(/\"/g,"&#34;");U='&nbsp;<a href="'+L.url+'" style="color:white; font-size:7.5pt" onmouseover="showToolTip(event, \''+S+"'); window.map["+L.n+"].addOverlay(overlays["+L.n+"]["+L.num+"]); if (overlays["+L.n+"]["+L.num+"].setZIndex) overlays["+L.n+"]["+L.num+'].setZIndex(200000000)" onmousemove="updateToolTip(event)" onmouseout="hideToolTip(); window.map['+L.n+"].removeOverlay(overlays["+L.n+"]["+L.num+'])">'+L.text+"</a>&nbsp;"}else{if(L.type==SMART_TEXT_NORMAL){Q+="fetchArticle("+L.n+", "+L.point.lat()+", "+L.point.lng()+", '"+L.articleid+"'); return false";U='&nbsp;<div style="position: absolute; z-index:1; margin:-1px 0 0 -1px;"><a href="#" onclick="'+Q+'" onmouseover="window.status=\'\'; return true" style="text-decoration: none; font-weight:bold; color:white; font-size:10pt; font-family:Arial;">'+L.text+"</a></div>&nbsp;";U+='<div style="position: absolute;"><a href="#" onclick="'+Q+'" onmouseover="window.status=\'\'; return true" style="text-decoration: none; color:black; font-weight:bold; letter-spacing: -0.0px; font-size:10pt; font-family:Arial; ">'+L.text+"</a></div>"}}var J=new StringBuffer();J.append(U);var X=function(){Y();this.style.zIndex=200000001;setSmarterTextOpacity(F,color,O,100)};var R=function(b){T(b)};var K=function(){G();this.style.zIndex=E;setSmarterTextOpacity(F,color,O,markerOpacity)};(function(){var b=document.createElement("div");b.id=N;b.style.position="absolute";b.style.whiteSpace="nowrap";b.style.marginTop=""+0+"px";b.style.marginLeft="-30px";b.style.width="20px";b.style.height="20px";b.style.overflow="visible";b.onmousemove=R;b.innerHTML=J.toString();Z.getPane(G_MAP_MARKER_PANE).appendChild(b);b.style.zIndex=E})();return N}var ignoreArticleOptions=["f","hide","dc","g","h","ty","b","c","d","e","ci","pi","re","p","j","k","l","x","y","o","ps","psa","pw","pf","pfa","pd"];function loadFromXML(Aa){var K=nh(Aa,"nofull");if(K){alert("This map does not allow full searches.");return }var t;var o=nivn(Aa,"n");var Z=nh(Aa,"m");var G=nh(Aa,"s");var AI=nh(Aa,"points");var Ab=nh(Aa,"trails");if(Z){mapWipe(o)}if(G){resetMapItems()}var AV=nivn(Aa,"rc");var AM=new Array();var v=0;AM[v]=new Array();var R;var U;if(Z){var AO=tag(Aa,"cr");for(t=0;t<AO.length;t++){var c=AO[t];var s=nivn(c,"crid");U=nh(c,"dc");if(U){var J="C"+s;mgr[o].addOverlay(J);continue}var AL=nivn(c,"crn");var AB=nfvn(c,"crlat");var d=nfvn(c,"crlon");var q=nivn(c,"crleft");var F=nivn(c,"crtop");R=nivn(c,"crc");drawClusterMarker(o,s,AL,AB,d,q,F,R)}}var AS=tag(Aa,"a");var Q=AS.length;if(G&&Q==0){emptyMapItems()}for(t=0;t<AS.length;t++){var w=AS[t];var AJ=nvn(w,"f");var AG=nh(w,"hide");U=nh(w,"dc");if(U){if(!AG){mgr[o].addOverlay(AJ)}if(G){GeoFetchCache.addItem(o,AJ)}continue}var M=entify(nvn(w,"g"));var O=nvn(w,"h");var z=nvn(w,"ty");var V=nfvn(w,"b");var B=nfvn(w,"c");var b=nivn(w,"d");var L=nivn(w,"e");var AD={};var AW=nivn(w,"ci");var A=nivn(w,"pi");AD.clientid=AW;AD.posterid=A;AD.reportstatus=nvn(w,"re");var P=w.childNodes;for(var u=0;u<P.length;u++){var AN=P[u];if(!ignoreArticleOptions.contains(AN.nodeName)){AD[AN.nodeName]=nodeValue(AN)}}var D=nivn(w,"i");var g=(D&1)>0;var f=(D&2)>0;var AE=(D&4)>0;var AZ=(D&8)>0;var S=f||AE||AZ;var W=null;var N=null;var Y=null;var l=null;var h=null;var AF=nh(w,"up");if(f||AE||AZ){W=nvn(w,"j");AD.url=W;N=nivn(w,"k");Y=nivn(w,"l");l=nivn(w,"x");h=nivn(w,"y")}R=nvn(w,"o");if(G){GeoFetchCache.addItem(o,AJ,M,O,z,V,B,b,L,AD)}var T=tag(w,"p");if(Z){if(T.length==0){if(g&&S){drawTextAndIconMarkers(o,AJ,{hide:AG,text:M,lat:V,lon:B,color:R,url:W,width:l,height:h,aleft:N,atop:Y,border:AZ,upsold:AF})}else{if(g){drawTextMarker(o,AJ,{hide:AG,text:M,lat:V,lon:B,color:R})}else{if(S){drawIconMarker(o,AJ,{hide:AG,text:M,lat:V,lon:B,url:W,width:l,height:h,aleft:N,atop:Y,border:AZ,upsold:AF})}}}if(AI||Ab){AM[v].push(new GLatLng(V,B))}}else{var AH=nvn(w,"ps");var k=nvn(w,"psa");var AK=nvn(w,"pw");var X=nvn(w,"pf");if(X.trim().length==0){X=null}var E=nvn(w,"pfa");var AR=nvn(w,"pd");var AY=new Array();var AQ=new Array();var e=91;var H=181;var I=-91;var AP=-181;var C=null;var AA=null;for(var r=0;r<T.length;r++){var m=T[r];var AU=nodeValue(m).trim().split(",");AY[r]=parseFloat(AU[0]);AQ[r]=parseFloat(AU[1]);if(r==0){C=new GLatLng(AY[r],AQ[r])}else{if(r==T.length-1){AA=new GLatLng(AY[r],AQ[r])}}}var AX={stroke:AH,strokeAlpha:k,width:AK,fill:X,fillAlpha:E,distances:AR,clientid:AW};pathAddStatic(o,AJ,AY,AQ,e,H,I,AP,b,L,AX);if(AI||Ab){AM[v].push(AA);AM[++v]=new Array();AM[v].push(C)}}}}if(G){setSearchPagingText(AV,Q)}if(Z){var AT=tag(Aa,"geoobjects");if(AT.length>0){loadForestXML(o,AT[0])}var AC=tag(Aa,"comments");if(AC.length>0){loadCommentsXML(o,AC[0])}setMapPagingText(AV);wipePathTracing(o);if(Ab){setTrailDrawing(o,AM)}if(AI){setPointAnimation(o,AM);beginPointAnimation(o,1000)}}}function boundingBox(A,E,D,B,F,C){this.latmin=A;this.latmax=E;this.lngmin=D;this.lngmax=B;this.center_x=A+(Math.abs(E-A))/2;this.center_y=D+(Math.abs(B-D))/2;this.pointid=F;this.count=C}function pointComments(B,A,C){this.lat=B;this.lng=A;this.pointid=C}function loadCommentsXML(V,I){if(nh(I,"error")){alert(nvn(I,"error"));return }var P=tag(I,"cs");var M=nivn(I,"col");var C=null;var E=null;var F=null;var K=null;var W=new Array();var J=null;var G=null;var A=null;var O=true;for(var X=0;X<P.length;X++){var Y=0;var Z=0;var T=P[X];var B=parseInt(nvn(T,"cuid"));var N=parseFloat(nvn(T,"ca"));var H=parseFloat(nvn(T,"cb"));var L=parseInt(nvn(T,"cd"));var R=parseInt(nvn(T,"ce"));var Q=parseInt(nvn(T,"cpid"));var D=parseInt(nvn(T,"cnum"));var U=this.map[2].fromLatLngToDivPixel(new GLatLng(N,H));if(O){A=new boundingBox(N,N,H,H,Q,D);J=U.x;G=U.y;O=false;if(P.length==1){W[W.length]=new boundingBox(A.latmin,A.latmax,A.lngmin,A.lngmax,A.pointid,A.count)}}else{if(Math.abs(J-U.x)<16&&Math.abs(G-U.y)<16){A.latmax=N;A.lngmax=(H>A.lngmax)?H:A.lngmax;A.lngmin=(H<A.lngmin)?H:A.lngmin;if(A.latmin==null){A.latmin=(N<A.latmin)?N:A.latmin}A.pointid=null;J=U.x;G=U.y;A.count+=D;if(X==P.length-1){W[W.length]=new boundingBox(A.latmin,A.latmax,A.lngmin,A.lngmax,A.pointid,A.count)}}else{W[W.length]=new boundingBox(A.latmin,A.latmax,A.lngmin,A.lngmax,A.pointid,A.count);J=U.x;G=U.y;A=new boundingBox(N,N,H,H,Q,D);if(X==P.length-1){W[W.length]=new boundingBox(A.latmin,A.latmax,A.lngmin,A.lngmax,A.pointid,A.count)}}}}for(X=0;X<W.length;X++){var S=(W[X].count==1)?" comment":" comments";drawCommentMarker(V,M,W[X].pointid,W[X].count+S,W[X].center_x,W[X].center_y,L,R,null,null,Y,Z,-1,B,W[X].latmin,W[X].latmax,W[X].lngmin,W[X].lngmax)}}var forestId=0;function loadForestXML(Q,E){var B=0.3;var D=getMapType(Q);if(D=="normal"){B=0.7}if(nh(E,"error")){alert(nvn(E,"error"));return }var L;var F=tag(E,"polygon");for(var U=0;U<F.length;U++){var O=F[U];var S=nvn(O,"color");var N=nvn(O,"name");var A=nvn(O,"label");var K=parseFloat(nvn(O,"opacity"));var W=parseFloat(nvn(O,"area"));var C=nvn(O,"coords").trim();var X=C.split(/\s+/);var Z=A.split(/,/);var P=parseFloat(Z[0]);var M=parseFloat(Z[1]);var Y=new GLatLng(P,M);var H=new Array();for(var T=0;T<X.length;T++){var G=X[T];var R=G.split(/,/);var I=parseFloat(R[0]);var b=parseFloat(R[1]);H.push(new GLatLng(I,b))}L=new GPolygon(H,"#99CC88",1,1,"#99CC88",B);mgr[Q].addOverlay("K"+(++forestId),L)}var J=tag(E,"polyline");for(U=0;U<J.length;U++){var V=J[U];S=nvn(V,"color");C=nvn(V,"coords").trim();X=C.split(/\s+/);H=new Array();for(T=0;T<X.length;T++){G=X[T];R=G.split(/,/);I=parseFloat(R[0]);b=parseFloat(R[1]);H.push(new GLatLng(I,b))}mgr[Q].addOverlay("K"+(++forestId),new GPolyline(H,"#"+S,3,0.7))}}function populateSearchCategories(N){setInnerHtml("itemsearchcategoriespane","");var K=de("itemsearchcategories");var D=de("itemsearchcategoriespane");if(N.length==0){K.style.display="none";return }else{K.style.display="block"}var P,E;var M=[];var I=0;var B=D;for(var H=0;H<N.length;H++){var A=N[H];var O=nvn(A,"path");var C=nvn(A,"ref");var L=O.split("/");if(L.length==0||L.length==1&&L[0].length==0){L.length=0}var G=0;for(var F=0;F<L.length&&F<M.length&&L[F].toLowerCase()==M[F].toLowerCase();F++){G=F+1}while(I>G){B=B.parentNode;I--}G=L.length;while(I<G){P=document.createElement("div");P.className="itemsearchcat-container";P.style.display=(I==0)?"block":"none";B.appendChild(P);B=P;P=document.createElement("div");P.className="itemsearchcat-arrow-closed";P.style.visibility="hidden";P.hide=true;P.onclick=toggleCategoryChildren.bind(P);B.appendChild(P);E=document.createElement("input");E.type="checkbox";E.value=(I==G-1)?C:"";E.onclick=handleCategoryCheck.bind(E);E.onkeyup=E.onclick.bind(E);E.className="itemsearchcat-checkbox";B.appendChild(E);P=document.createElement("div");P.className="itemsearchcat-text";P.innerHTML=L[I];B.appendChild(P);var J=B;while(J=J.parentNode){if(J.firstChild.style.visibility!="hidden"){break}J.firstChild.style.visibility="visible"}I++}M=L;I=L.length}}function toggleCategoryChildren(){this.hide=!this.hide;this.className="itemsearchcat-arrow-"+(this.hide?"closed":"open");var A=this.nextSibling.nextSibling;while(A=A.nextSibling){A.style.display=this.hide?"none":"block"}}function handleCategoryCheck(){matchAllCategoryChildren(this);if(!this.checked){matchAllCategoryAncestors(this)}searchEnqueue()}function getCategoryReferences(){var D=de("itemsearchcategoriespane");var C=D.getElementsByTagName("input");var B=new StringBuffer();var G=false;for(var F=0;F<C.length;F++){var A=C[F];var E=A.value.trim();if(E.length==0||!A.checked){continue}if(G){B.append(",")}else{G=true}B.append(parseInt(E).toString(16))}return B.toString()}function matchAllCategoryChildren(C){var B=C.nextSibling;var A;while(B=B.nextSibling){A=B.childNodes[1];A.checked=C.checked;matchAllCategoryChildren(A)}}function matchAllCategoryAncestors(B){var A=B.parentNode;var C;while(A=A.parentNode){C=A.childNodes.length>=2?A.childNodes[1]:null;if(!C||C.nodeName.toUpperCase()!="INPUT"||C.type!="checkbox"){break}C.checked=B.checked}}function initMapComments(B,A){if(commentsShown==false){initCommentPane();commentsShown=true;showcomments="published";showMapComments(B,A);togglePendingPointComments(0,true)}showSidebar("comments")}function initUserComments(A){if(commentsShown==false){initCommentPane();commentsShown=true}showUserComments(A)}var commentsShow=new Array();function showUserComments(A){if(A==null){return }de("userCommentsToggle").style.display="block";commentArray=[commentArray[0],-1,-1,-1,-1,-1];de("commentUserMapsHide").style.display="none";de("commentUserMapsShow").style.display="inline";de("commentUserThisMapHide").style.display="none";de("commentUserThisMapShow").style.display="inline";fetchComments(A,-1,-1,-1,-1,-1,false,"userComments",null,null,false)}function showMapComments(B,A){layerlistshown=false;if(B==null){return }if(A==null){A=commentArray[1]}de("userCommentsPane").style.display="block";de("userCommentsToggle").style.display="none";commentArray=[commentArray[0],commentArray[1],-1,-1,-1,-1];de("commentMapArticlesHide").style.display="none";de("commentMapArticlesShow").style.display="inline";de("commentMapPointsHide").style.display="none";de("commentMapPointsShow").style.display="inline";fetchComments(B,A,-1,-1,-1,-1,false,"mapComments",null,null,false)}function showOverlayComments(C,B,A){if(C==null){return }if(B==null){B=commentArray[1]}if(A==null){A=commentArray[2]}de("commentOverlayArticlesHide").style.display="none";de("commentOverlayArticlesShow").style.display="inline";de("commentOverlayPointsHide").style.display="none";de("commentOverlayPointsShow").style.display="inline";commentArray[3]=-1;commentArray[4]=-1;commentArray[5]=-1;fetchComments(C,B,A,-1,-1,-1,false,"overlayComments",null,null,false)}function showArticleComments(D,B,A,C){if(D==null){return }if(B==null){B=commentArray[1]}if(C==null){C=commentArray[3]}if(A==null){A=commentArray[2]}commentArray[4]=-1;commentArray[5]=-1;fetchComments(D,B,commentArray[2],C,-1,-1,false,"articleComments",null,null,false)}function showPointComments(D,B,A,C){if(D==null){return }if(B==null){B=commentArray[1]}if(C==null){C=commentArray[5]}if(A==null){A=commentArray[2]}commentArray[4]=-1;commentArray[3]=-1;fetchComments(D,B,A,-1,-1,C,false,"pointComments",null,null,false)}var commentsShown=false;var newToolsActive=null;function commentOnPoint(A){if(A==1){de("commentOnPoint").style.display="none";de("commentOnPointLink").style.display="inline";newToolsActive=null;removeSelected(2)}else{de("commentOnPoint").style.display="inline";de("commentOnPointLink").style.display="none";newToolsActive="comment"}}function showOverlayCommentOptions(){de("overlayCommentOptions").style.display="block"}function showMapCommentOptions(){de("mapCommentOptions").style.display="block"}function hideOverlayCommentOptions(){de("overlayCommentOptions").style.display="none"}function hideMapCommentOptions(){de("mapCommentOptions").style.display="none"}var overlaySelect=false;function commentSubmitted(B,A){if(de("addcommentbox")!=null&&A==true){de("addcommentbox").value="Add a comment . . .";if(typeof (newToolsActive)!="undefined"){if(newToolsActive=="comment"){removeSelected(2);newToolsActive=null}}}if(de("popupaddcommentbox")!=null&&A==true){de("popupaddcommentbox").value="Add a comment . . ."}MonkeyDialog.show('<div class="md_notice">'+B+"</div>");setTimeout(function(){MonkeyDialog.hide()},2000)}function mapCommentSelect(A){if(A==0){overlaySelect=false;de("commentOnMap").style.display="inline";de("commentOnMapLink").style.display="none";de("commentOnPoint").style.display="none";de("commentOnPointLink").style.display="inline";de("commentOnPointOption").style.display="none";newToolsActive=null;removeSelected(2);return }if(A==1){de("commentOnPoint").style.display="inline";de("commentOnPointOption").style.display="block";de("commentOnPointLink").style.display="none";if(overlaySelect==true){var B=de("commentLayerSelect").selectedIndex;if(B!=0){setInnerHtml("commentOnPoint","A point on overlay "+de("commentLayerSelect").options[B].text);setInnerHtml("commentOnPointLink",'<a href = "#" onclick = "mapCommentSelect(1); return false;">A point on overlay '+de("commentLayerSelect").options[B].text+"</a>")}else{setInnerHtml("commentOnPoint","A point on this map");setInnerHtml("commentOnPointLink",'<a href = "#" onclick = "mapCommentSelect(1); return false;">A point on this map</a>')}}else{setInnerHtml("commentOnPoint","A point on this map");setInnerHtml("commentOnPointLink",'<a href = "#" onclick = "mapCommentSelect(1); return false;">A point on this map</a>')}de("commentOnPoint").style.display="inline";de("commentOnPointLink").style.display="none";de("commentOnMap").style.display="none";de("commentOnMapLink").style.display="inline";newToolsActive="comment";return }if(A==2){overlaySelect=true;de("commentOnPoint").style.display="none";de("commentOnPointOption").style.display="none";de("commentOnPointLink").style.display="inline";de("commentOnMap").style.display="none";de("commentOnMapLink").style.display="inline";newToolsActive=null;removeSelected(2);return }}function overlayCommentSelect(A){if(A==5){de("commentOnOverlayLink").style.display="none";de("commentOnOverlay").style.display="block";de("commentOnOverlayPoint").style.display="none";de("commentOnOverlayPointLink").style.display="block";de("commentOnOverlayPointOption").style.display="none";newToolsActive=null;removeSelected(2);return }if(A==6){de("commentOnOverlayLink").style.display="block";de("commentOnOverlay").style.display="none";de("commentOnOverlayPoint").style.display="block";de("commentOnOverlayPointLink").style.display="none";de("commentOnOverlayPointOption").style.display="block";newToolsActive="comment";return }}function setCommentHeaderTitle(C,A){var B=decodeURIComponent(A);if(C!=null&&de(C)!=null){de(C).innerHTML=B}}function sharePendingOrPublishedComments(){shareCommentsNow(showPendingOrPublished,showMapsOrOverlays,commentArray[1],commentArray[2]);shareComments()}var layerlistshown=false;function showLayerList(){if(layerlistshown==false||layerlistshown==null){de("layerList").style.display="block";layerlistshown=true}else{de("layerList").style.display="none";layerlistshown=false}}function shareComments(){fetchComments(commentArray[0],commentArray[1],commentArray[2],commentArray[3],commentArray[4],commentArray[5])}var commentsLimit=5;var commentsOffset=0;var showcomments=null;var recentdiv=null;var recentparentdiv=null;function refreshComments(){shareComments();if(showMapsOrOverlays!=null){shareCommentsNow(showPendingOrPublished,showMapsOrOverlays,commentArray[1],commentArray[2])}}function fetchComments(G,K,E,O,C,F,M,B,N,J,L,A,H){if(B==null){B=recentdiv}else{commentReset();recentdiv=B}var D=false;if(M!=null){D=M}if(O!=null&&O!=-1){newToolsActive=null}commentArray=[G,K,E,O,C,F];var I="userid="+G+"&viewid="+K+"&layerid="+E+"&articleid="+O+"&setitemid="+C+"&pointid="+F+"&asc="+D;latitude=J;longitude=L;if(showPendingOrPublished!=null){I+="&showcomments="+showPendingOrPublished}else{I+="&showcomments=published"}if(A!=null){I+="&popup="+A}if(J!=null&&L!=null){I+="&lat="+J;I+="&lng="+L}if(N!=null&&de(N)!=null){de(N).style.display="none";de(N).innerHTML="";de(N+"Toggle").style.display="none"}I+="&off="+commentsOffset;I+="&limit="+commentsLimit;if(H){I+="&embed="+H}ajaxCall("/Comment",I,function(P){if(B!=null&&de(B)!=null){de(B+"Pane").style.display="block";de(B).style.display="block";if(de(B+"Toggle")!=null){de(B+"Toggle").style.display="block"}setInnerHtml(B,P)}})}var currentArticleView=[];function fetchArticleComments(A,E,H,K,J,G,I,C,B,D,F){closeInfoWindow(A);K=K.replace(/A/,"");fetchPointComments(A,E,G,I,null,null,null,null,null,0,K,C,B,D,F)}function pendingCommentsToggle(A){showcomments=A}var commentDivs=new Array();function childCommentDivs(A){this.children=A}function initCommentPane(){commentDivs["userCommentsPane"]=new childCommentDivs(["mapCommentsPane","pointCommentsPane","overlayCommentsPane","articleCommentsPane","setItemCommentsPane"]);commentDivs["mapCommentsPane"]=new childCommentDivs(["pointCommentsPane","overlayCommentsPane","articleCommentsPane","setItemCommentsPane"]);commentDivs["overlayCommentsPane"]=new childCommentDivs(["pointCommentsPane","articleCommentsPane","setItemCommentsPane"]);commentDivs["articleCommentsPane"]=new childCommentDivs(["setItemCommentsPane","pointCommentsPane"])}var commentSetting=new Array();var showPendingOrPublished="published";function hideChildPanes(B){for(var A=0;A<commentDivs[B+"Pane"].children.length;A++){de(commentDivs[B+"Pane"].children[A]).style.display="none"}}function togglePendingPointComments(A,B){if(A==0){showPendingOrPublished="published";de("showPublishedLink").style.display="none";de("showPublished").style.display="inline";de("showPendingLink").style.display="inline";de("showPending").style.display="none";de("showAllLink").style.display="inline";de("showAll").style.display="none"}else{if(A==1){showPendingOrPublished="pending";de("showPendingLink").style.display="none";de("showPending").style.display="inline";de("showPublishedLink").style.display="inline";de("showPublished").style.display="none";de("showAllLink").style.display="inline";de("showAll").style.display="none"}else{if(A==2){showPendingOrPublished="all";de("showPendingLink").style.display="inline";de("showPending").style.display="none";de("showPublishedLink").style.display="inline";de("showPublished").style.display="none";de("showAllLink").style.display="none";de("showAll").style.display="inline"}}}if(B==null){sharePendingOrPublishedComments()}return }var commentArray=new Array();function toggleArticleItemComments(C,B,A,D,E){commentReset();if(B==null){B=commentArray[1]}if(A==null){A=commentArray[2]}if(D==null){D=commentArray[3]}de("commentItemsHide").style.display=(E==-1)?"none":"inline";de("commentItemsShow").style.display=(E==-1)?"inline":"none";fetchComments(C,B,A,D,E,-1)}function toggleUserMapComments(A,B){commentReset();de("commentUserMapsHide").style.display=(B==-1)?"none":"inline";de("commentUserMapsShow").style.display=(B==-1)?"inline":"none";fetchComments(A,B,-1,-1,-1,-1)}function toggleUserThisMapComments(C,B,D,A){commentReset();de("commentUserThisMapHide").style.display=(D==-1)?"none":"inline";de("commentUserThisMapShow").style.display=(D==-1)?"inline":"none";setCommentHeaderTitle("mapCommentsHeader",A);fetchComments(C,B,-1,-1,-1,-1,false,"mapComments","userComments")}var showMapsOrOverlays=null;function toggleOverlayPointComments(C,B,A,D){commentReset();if(B==null){B=commentArray[1]}if(A==null){A=commentArray[2]}if("V"+B==map2id){if(D==0){showMapsOrOverlays="overlays";shareCommentsNow(showPendingOrPublished,showMapsOrOverlays,B,A)}else{shareCommentsNow(null,null,null,null);showMapsOrOverlays=null}}de("commentOverlayPointsHide").style.display=(D==-1)?"none":"inline";de("commentOverlayPointsShow").style.display=(D==-1)?"inline":"none";fetchComments(C,B,A,commentArray[3],-1,D)}function toggleOverlayArticleComments(C,B,A,D){commentReset();if(B==null){B=commentArray[1]}if(A==null){A=commentArray[2]}de("commentOverlayArticlesHide").style.display=(D==-1)?"none":"inline";de("commentOverlayArticlesShow").style.display=(D==-1)?"inline":"none";fetchComments(C,B,A,D,-1,commentArray[5])}function toggleMapPointComments(B,A,C){commentReset();if(A==null){A=commentArray[1]}de("commentMapPointsHide").style.display=(C==-1)?"none":"inline";de("commentMapPointsShow").style.display=(C==-1)?"inline":"none";if("V"+A==map2id){if(C==0){showMapsOrOverlays="map";shareCommentsNow(showPendingOrPublished,showMapsOrOverlays,A,null)}else{shareCommentsNow(null,null,null,null);showMapsOrOverlays=null}}fetchComments(B,A,commentArray[2],commentArray[3],-1,C)}function toggleMapArticleComments(B,A,C){commentReset();if(A==null){A=commentArray[1]}de("commentMapArticlesHide").style.display=(C==-1)?"none":"inline";de("commentMapArticlesShow").style.display=(C==-1)?"inline":"none";fetchComments(B,A,commentArray[2],C,-1,commentArray[5])}function toggleMapOverlayComments(B,A,C){commentReset();if(A==null){A=commentArray[1]}de("commentMapOverlaysHide").style.display=(C==-1)?"none":"inline";de("commentMapOverlaysShow").style.display=(C==-1)?"inline":"none";fetchComments(B,A,C,commentArray[3],-1,commentArray[5])}function clearPopupCommentSubmission(A){de("popupaddcommentbox").value=" ";de("popupaddcommentdiv").style.display="none";de("popupcommentThanks").style.display="inline";setInnerHtml("popupcommentthanks",A)}function showPopupCommentSubmission(){de("popupaddcommentbox").value="Add a comment . . .";de("popupaddcommentdiv").style.display="inline";de("popupcommentThanks").style.display="none"}function clearPaneCommentSubmission(A){de("addcommentbox").value=" ";de("addcommentdiv").style.display="none";de("commentThanks").style.display="inline";setInnerHtml("commentThanks",A)}function showPaneCommentSubmission(){de("addcommentbox").value="Add a comment . . .";de("addcommentdiv").style.display="block";de("commentThanks").style.display="none"}function addComment(A,B){ajaxCall("/CommentPost",A,function(C){})}function setCommentsHeader(B,A){if(A!=null){if(A==false){de("editnumcomments").innerHTML="Comments are disabled for this map.";return }}if(B!=null){de("commentheader").innerHTML="Comments ("+B+")<br/>";var C="No comments yet.";if(B>0){C='This map has <a href="#viewcomments" onmouseover="window.status=\'\'; return true">'+B+" comment"+(B!=1?"s":"")+"</a>."}de("editnumcomments").innerHTML=C}setCommentsAddLink()}function setCommentsAddLink(){var A='<br/><img src="/r/images/icons/famfamfam/comment.png" style="vertical-align:middle" /> ';if(sessionClientid>0){A+='You may <a href="#" onclick="de(\'addcommentbox\').focus(); return false" onmouseover="window.status=\'\'; return true">add a comment</a>'}else{A+='You must be <a href="#" onclick="showLoginPane(); return false" onmouseover="window.status=\'\'; return true">logged in</a> to add a comment'}de("editaddcomments").innerHTML=A}var commentPosted=false;function postedComment(A){commentPosted=A}var latitude;var longitude;function postComment(){var F;var D=latitude;var B=longitude;for(var C=0;C<commentArray.length;C++){if(commentArray[C]==0){commentArray[C]=-1}}if(typeof (newToolsActive)!="undefined"){if(newToolsActive=="comment"){D=getSelectedLat(2);B=getSelectedLon(2);if(D!=null&&B!=null){D=D.toFixed(5);B=B.toFixed(5)}else{alert("Your comment cannot be added at this time. Please try again later.");return }}}var E=de("addcommentbox").value;if(commentArray[2]==null||commentArray[2]==-1){if(de("commentLayerSelect")!=null){F=de("commentLayerSelect").value;F=F.substring(1)}else{F=-1}}else{F=commentArray[2]}if(commentPosted==true){if(E.length<2||E.length>65535){de("commentThanks").innerHTML="Your comment was either too long or too short. Please try again.";de("commentThanks").style.display="inline"}else{var A="userid="+commentArray[0]+"&viewid="+commentArray[1]+"&layerid="+F+"&articleid="+commentArray[3]+"&setitemid="+commentArray[4]+"&pointid="+commentArray[5]+"&comment="+encodeURIComponent(E);if(D!=null){A+="&lat="+D}if(B!=null){A+="&lng="+B}addComment(A)}}}function submitComment(D,I,B,N,F,C,J,K,A,M){if(typeof (newToolsActive)!="undefined"){if(newToolsActive=="comment"&&C==-1){if(J==null&&K==null){J=getSelectedLat(2);K=getSelectedLon(2);if(J!=null&&K!=null){J=J.toFixed(5);K=K.toFixed(5)}}}}if(A!=null){if(J==null&&K==null){var H=A.split("|",2);if(H!=null){C=H[0];var L=H[1].split(",",2);J=L[0];K=L[1]}}else{C=-1}}var E="";if(M==null){E=de("addcommentbox").value}else{if(de(M)!=null){E=de(M).value}else{alert("Your comment cannot be posted at this time. Please try again.");return }}if(B==null){if(de("commentLayerSelect")!=null){B=de("commentLayerSelect").value;B=B.substring(1)}else{B=-1}}if(commentPosted==true){if(E.length<2||E.length>65535){MonkeyDialog.show('<div class="md_alert">Your comment was either too long or too short. Please try again.</div>')}else{var G="userid="+D+"&viewid="+I+"&layerid="+B+"&articleid="+N+"&setitemid="+F+"&pointid="+C+"&comment="+encodeURIComponent(E);if(J!=null){G+="&lat="+J}if(K!=null){G+="&lng="+K}addComment(G)}if(typeof (newToolsActive)!="undefined"){if(newToolsActive=="comment"){removeSelected(2);newToolsActive=null}}}}function commentAddCall(A){ajaxCall("/CommentAdd","",function(B){setCommentsinline(B)})}function setCommentPagingText(G){var E=commentsOffset;var C=commentsLimit;var B=Math.max(parseInt((G+C-1)/C),1);var H=parseInt(E/C)+1;var I=new StringBuffer();if(H==1){I.append('<div class="ib-fix arrow gleft"></div> &nbsp; <span style="font-size:10.0pt">Page</span> &nbsp; ')}else{I.append('<div class="ib-fix arrow left" onclick="shareBack()"></div> &nbsp; <span style="font-size:10.0pt">Page</span> &nbsp; ')}var A=Math.max(H-3,1);var D=Math.min(A+6,B);A=Math.max(D-6,1);for(var F=A;F<=D;F++){I.append(" ");if(F==H){I.append('<span style="border-bottom:1px dotted #9ba4af">')}else{I.append('<a href="javascript:void(0)" onclick="commentJump(').append((F-1)*C).append(')">')}I.append(F);if(F==H){I.append("</span>")}else{I.append("</a>")}I.append(" &nbsp; ")}I.append(' <span style="font-size:10.0pt">of ').append(B).append("</span>");if(H==B){I.append(' &nbsp; <div class="ib-fix arrow gright"></div>')}else{I.append(' &nbsp; <div class="ib-fix arrow right" onclick="commentMore()"></div>')}setInnerHtml("commentpager",I.toString())}function commentJump(A){commentsOffset=A;if(commentsOffset<0){commentsOffset=0}shareComments()}function commentBack(){commentsOffset=commentsOffset-commentsLimit;if(commentsOffset<0){commentsOffset=0}shareComments()}function commentReset(){commentsOffset=0}function pointSelect(){newToolsActive="point"}function fetchPointComments(S,D,N,I,C,G,H,J,O,L,Q,E,V,K,B,A){if(map2id==null){return }var T=makeLatLng(N,I);monkeyInfoWindow(S,T,'<img src="/r/images/loading.gif" />');if(map2id!=null){var U=map2id.replace(/V/,"");var F="userid="+D;F+="&viewid="+U;F+="&popup="+true;if(O!=null){if(O>0){F+="&pointid="+O}}else{if(C!=null&&G!=null&&H!=null&&J!=null){F+="&latmin="+C+"&latmax="+G+"&lngmin="+H+"&lngmax="+J}else{if(Q!=null&&Q>0){F+="&articleid="+Q}}}F+="&embed="+doFetchEmbed;if(showPendingOrPublished!=null){F+="&showcomments="+showPendingOrPublished}else{F+="&showcomments=published"}var M=elementDimensions(map[S].getContainer());var R=Math.min(Math.max(M.width-100,440),440);var P=Math.min(Math.max(M.height-200,150),400);if(R<360){R=360}F+="&width="+R+"&height="+P;if(L!=null&&L>0){F+="&layerid="+L}if(V!=null){F+="&limit="+V}else{F+="&limit=10"}if(K!=null){F+="&offset="+K}if(B!=null){F+="&zoom="+B}else{F+="&zoom=20"}if(A){F+="&embed="+A}smartCall("/Comment",F,function(W){monkeyInfoWindow(S,T,W,null,null,E)})}}function hidePopupCommentSubmission(){de("popupCommentThanks").style.display="inline";de("popupAddcommentbox").style.display="none";de("popupAddcommentbox").value="Add a comment . . .";de("popupSubmitCommentArea").style.display="none"}function toggleApprove(A,B){if(de("approveComment"+A)!=null){de("approveComment"+A).style.display=(B==true)?"inline":"none";de("approveComment"+A+"Link").style.display=(B==true)?"none":"inline";de("unApproveComment"+A).style.display=(B==true)?"none":"inline";de("unApproveComment"+A+"Link").style.display=(B==true)?"inline":"none"}if(de("approveCommentPopup"+A)!=null){de("approveCommentPopup"+A).style.display=(B==true)?"inline":"none";de("approveCommentPopup"+A+"Link").style.display=(B==true)?"none":"inline";de("unApproveCommentPopup"+A).style.display=(B==true)?"none":"inline";de("unApproveCommentPopup"+A+"Link").style.display=(B==true)?"inline":"none"}}function approveComment(A,C){if(A!=null&&A>0){var B="approve="+C;B+="&commentid="+A;ajaxCall("/CommentPost",B,function(){})}}function loadComments(I,D,C,F,A,B){var H=false;var G="commentsadmin";if(F!=null){H=F}if(I==null){return }if(A!=null){G=A}if(commentload[B]==true){de(G).style.display="none";commentload[B]=false;return }commentload[B]=true;commentload[(B=="pending")?"all":"pending"]=false;var E="userid="+I;E+="&viewid=0&articleid=0&setitemid=0&layerid=0&pointid=0&showcomments="+B+"&asc="+H;ajaxCall("/Comment",E,function(J){de(G).style.display="block";setInnerHtml(G,J)})}var map=new Array();var mgr=new Array();var mdd=new Array();var defLat=new Array();var defLon=new Array();var defZoom=new Array();var mapIsReady=new Array();var metronome=new Array();var tt1s='<div style="font-size:8.0pt; line-height:8px">';var tte="</div>";var tooltip=new Array();tooltip["about"]=tt1s+"About this map"+tte;tooltip["overlays"]=tt1s+"Overlays on this map"+tte;tooltip["search"]=tt1s+"Find items on this map"+tte;tooltip["comments"]=tt1s+"Comments on this map"+tte;tooltip["timeline"]=tt1s+"Timeline for this map"+tte;tooltip["email"]=tt1s+"Email this map"+tte;tooltip["link"]=tt1s+"Link to this map"+tte;tooltip["rss"]=tt1s+"Subscribe to this map"+tte;tooltip["print"]=tt1s+"Print this page"+tte;tooltip["report"]=tt1s+"Report abuse"+tte;var controlItemsSlider;var controlItemsEnabled=true;var itemSliderConvert=new Array();itemSliderConvert[1]=10;itemSliderConvert[2]=20;itemSliderConvert[3]=50;itemSliderConvert[4]=100;itemSliderConvert[5]=1000;var controlAgeSlider;var controlAgeEnabled=true;var ageSliderConvert=new Array();ageSliderConvert[1]=86400;ageSliderConvert[2]=604800;ageSliderConvert[3]=2592000;ageSliderConvert[4]=31536000;ageSliderConvert[5]=0;function initPage(){updatePageSize();if(GBrowserIsCompatible()){initTab()}if(window.addEventListener){window.addEventListener("resize",updatePageSize,false)}else{if(window.attachEvent){window.attachEvent("onresize",updatePageSize)}else{if(document.getElementById){window.onresize=updatePageSize}}}controlItemsSlider=new Control.Slider("handlecontrolitems","trackcontrolitems",{axis:"horizontal",range:$R(1,5),values:[1,2,3,4,5],alignX:-3,onSlide:function(A){controlItemsSlideEvent(itemSliderConvert[A])},onChange:function(A){this.onSlide(A);if(controlItemsEnabled){selectControlItems(itemSliderConvert[A])}}});controlAgeSlider=new Control.Slider("handlecontrolage","trackcontrolage",{axis:"horizontal",range:$R(1,5),values:[1,2,3,4,5],alignX:-3,onSlide:function(A){controlAgeSlideEvent(ageSliderConvert[A])},onChange:function(A){this.onSlide(A);if(controlAgeEnabled){selectControlAge(ageSliderConvert[A])}}});initDefault()}defLat[2]=25;defLon[2]=-30;defZoom[2]=2;var pageSize={width:0,height:0};var mapSize={width:0,height:0};function updatePageSize(D){var C=pageDimensions();if(C==null){return }if(document.documentElement&&document.documentElement.clientHeight){if(!D&&pageSize.width==document.documentElement.clientWidth&&pageSize.height==document.documentElement.clientHeight){return }pageSize={width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}}var B=C.width;var A=C.height;mapSize.height=Math.max(A-200,400);de("mapcontainer2").style.height=mapSize.height+"px";de("aboutpane").style.maxHeight=(mapSize.height+4)+"px";de("overlayspane").style.maxHeight=(mapSize.height+4)+"px";de("searchpane").style.maxHeight=(mapSize.height-125)+"px";de("timelinepane").style.maxHeight=(mapSize.height+4)+"px";de("commentspane").style.maxHeight=(mapSize.height+4)+"px"}function initTab(){shareRegistration();initMap(2,"mapcontainer2",true,false,"full");initNext();addZoomListener(2,searchEnqueue)}var shareRegistered=false;function shareRegistration(){if(shareRegistered){return }shareRegistered=true;metronome[2]=new GeoMetronome(2,shareRefresh,showRefresher,showSearching)}function reloadMap2(B){if(!B){B=new Array()}if(!B.action){B.action="settings"}if(map2id==null){return }var A="viewid="+encodeURIComponent(map2id)+"&action="+B.action+"&center="+(B.center?"true":"false")+"&click="+(B.click?"true":"false");if(B.pass){A+="&pubpass="+pass}if(window.customView){A+="&centeron="+customView}smartCallXML("/LoadView",A,loadviewXml)}function loadviewXml(C){var F=nivn(C,"n");var B=nbvn(C,"own");if(nh(C,"wrongpass")){showShareWrongPassword()}if(nh(C,"lost")){checkLostMap();setMap2overlays(0);return }if(nh(C,"events")){de("eventfulbadge").style.display="block"}var E=tag(C,"settings");if(E.length>0){loadviewSettings(E[0],F,B)}var D=tag(C,"overlays");if(D.length>0){loadviewOverlays(D[0])}var A=tag(C,"categories");if(A.length>0){loadviewCategories(A[0])}initSimilarMaps();shareNow()}function loadviewSettings(C,N,L){var P;var F=nivn(C,"mda");selectControlAge(F,true);var A=nivn(C,"mdi");selectControlItems(A,true);if(nh(C,"vreset")){resetCustomViews()}var I=tag(C,"view");var E,M,H,S,O,K,D;for(P=0;P<I.length;P++){E=I[P];M=nvn(E,"pid");H=nvn(E,"vtt");S=nfvn(E,"vla");O=nfvn(E,"vlo");K=nivn(E,"vzm");D=nivn(E,"vty");addCustomView(M,H,S,O,K,D)}var T=nivn(C,"mratp");var G=nivn(C,"mratc");var Q=nivn(C,"mratu");setMap2rating(T,G,Q);var J=nfvn(C,"cla");var B=nfvn(C,"clo");var R=nivn(C,"czm");if(nh(C,"cunset")){unsetMap2center()}if(nh(C,"cset")){setMap2center(J,B,R)}if(nh(C,"ccenter")){moveTo(N,J,B,R)}if(nh(C,"cty")){setMapType(N,nvn(C,"cty"))}if(nh(C,"fetch")){fetchArticle(N,J,B,nvn(C,"fetch"),{noreturn:true})}}function resetCustomViews(){de("customviews").style.display="none";setInnerHtml("customviewspane","")}function addCustomView(A,G,E,F,D,C){de("customviews").style.display="block";var B=new StringBuffer();B.append('<a href="#" onclick="moveTo(2, '+E);B.append(","+F);B.append(","+D);B.append("); setMapType(2, '"+C);B.append("'); return false\">");B.append('<img src="/r/images/icons/famfamfam/bullet_go.png" border="0" style="vertical-align:bottom; margin:1px 5px 1px 0px" />');B.append(G);B.append("</a><br/>");appendInnerHtml("customviewspane",B.toString())}var map2id=null;function setMap2id(A){map2id=A}var map2center=null;var map2zoom=null;function setMap2center(B,C,A){map2center=makeLatLng(B,C);map2zoom=A}function unsetMap2center(){map2center=null;map2zoom=null}function setMap2overlays(A){return }function setMap2rating(A,D,C){var B=new StringBuffer();B.a("<div>");if(D>0){B.a("Rating: ").a(A).a(" of ").a(D).a(" people liked this map");if(C!=0){B.a(" - ");if(C>0){B.a("I liked it!")}else{B.a("I didn't like it.")}}}else{B.a("Not yet rated")}B.a("</div>");if(C==0){B.a("<div>");if(sessionClientid!=null){B.a('Rate this map: <a href="javascript:void(0)" onclick="rateMap(1)"><img src="/r/images/icons/famfamfam/arrow_up.png" class="vatb" style="border:0" />I like it</a> &nbsp; | <a href="javascript:void(0)" onclick="rateMap(-1)"><img src="/r/images/icons/famfamfam/arrow_down.png" class="vatb" style="border:0" />I don\'t like it</a>')}else{B.a("Sign in to rate this map")}B.a("</div>")}setInnerHtml("ratingpane",B.toString())}function rateMap(B){if(map2id==null){return }var A="viewid="+map2id;A+="&action=rate&rating="+B;smartCallXML("/maps",A,function(C){})}var sidebarShown="about";function showSidebar(A){de("side"+sidebarShown).style.display="none";de("sidebutton"+sidebarShown).src="/r/images/map/button-maps-"+sidebarShown+"-off.png";de("side"+A).style.display="block";de("sidebutton"+A).src="/r/images/map/button-maps-"+A+"-on.png";sidebarShown=A}function sendMapEmail(){var B=de("emailfrom").value;var G=de("emailto1").value;var F=de("emailto2").value;var E=de("emailto3").value;var D=de("emailto4").value;var C=de("linktotext").value;if(C==null||C==""){setInnerHtml("emailtitle",'<span style="color:#660000; font-weight:bold">You are not viewing a map.</span>');return }if(B==""){setInnerHtml("emailtitle",'<span style="color:#660000; font-weight:bold">You must enter your name or e-mail address.</span>');return }if(G==""&&F==""&&E==""&&D==""){setInnerHtml("emailtitle",'<span style="color:#660000; font-weight:bold">You must enter one or more e-mail addresses.</span>');return }var A="emailfrom="+encodeURIComponent(B)+"&email1="+encodeURIComponent(G)+"&email2="+encodeURIComponent(F)+"&email3="+encodeURIComponent(E)+"&email4="+encodeURIComponent(D)+"&emaillink="+encodeURIComponent(C);setInnerHtml("emailtitle",'<img src="/r/images/progressbar.gif" />');ajaxCall("/EmailTo",A,function(H){setInnerHtml("emailtitle","<b>"+H+"</b>");de("emailto1").value="";de("emailto2").value="";de("emailto3").value="";de("emailto4").value=""},0)}function resetMapEmail(){de("emailfrom").value="";de("emailto1").value="";de("emailto2").value="";de("emailto3").value="";de("emailto4").value=""}var footerEmail=false;var footerLink=false;var footerRSS=false;function hideFooterPanes(){if(footerEmail){toggleFooterEmail()}if(footerLink){toggleFooterLink()}if(footerRSS){toggleFooterRSS()}}function toggleFooterEmail(){if(footerLink){toggleFooterLink()}if(footerRSS){toggleFooterRSS()}if(footerEmail){de("mapfooteremail").style.display="none"}else{de("mapfooteremail").style.display="block"}footerEmail=!footerEmail}function toggleFooterLink(){if(footerEmail){toggleFooterEmail()}if(footerRSS){toggleFooterRSS()}if(footerLink){de("mapfooterlink").style.display="none"}else{de("mapfooterlink").style.display="block"}footerLink=!footerLink}function toggleFooterRSS(){if(footerEmail){toggleFooterEmail()}if(footerLink){toggleFooterLink()}if(footerRSS){de("mapfooterrss").style.display="none"}else{de("mapfooterrss").style.display="block"}footerRSS=!footerRSS}function printMap(){if(!map2id){alert("There is no map available.");return }window.print()}function reportMap(){if(!map2id){alert("There is no map available.");return }window.open("/report?reportmap="+map2id)}function setSearchPagingText(G){var E=searchOffset;var C=shareLimit;var B=Math.max(parseInt((G+C-1)/C),1);var H=parseInt(E/C)+1;var I=new StringBuffer();if(H==1){I.append('<div class="ib-fix arrow gleft"></div> &nbsp; <span style="font-size:10.0pt">Page</span> &nbsp; ')}else{I.append('<div class="ib-fix arrow left" onclick="searchBack()"></div> &nbsp; <span style="font-size:10.0pt">Page</span> &nbsp; ')}var A=Math.max(H-2,1);var D=Math.min(A+4,B);A=Math.max(D-4,1);for(var F=A;F<=D;F++){I.append(" ");if(F==H){I.append('<span style="border-bottom:1px dotted #9ba4af">')}else{I.append('<a href="javascript:void(0)" onclick="searchJump(').append((F-1)*C).append(')">')}I.append(F);if(F==H){I.append("</span>")}else{I.append("</a>")}I.append(" &nbsp; ")}I.append(' <span style="font-size:10.0pt">of ').append(B).append("</span>");if(H==B){I.append(' &nbsp; <div class="ib-fix arrow gright"></div>')}else{I.append(' &nbsp; <div class="ib-fix arrow right" onclick="searchMore()"></div>')}setInnerHtml("searchpager",I.toString())}function setMapPagingText(G){var E=searchVisible?searchOffset:shareOffset;var C=searchVisible?shareLimit:shareLimit;var B=Math.max(parseInt((G+C-1)/C),1);var H=parseInt(E/C)+1;var I=new StringBuffer();if(H==1){I.append('<div class="ib-fix arrow gleft"></div> &nbsp; <span style="font-size:10.0pt">Page</span> &nbsp; ')}else{I.append('<div class="ib-fix arrow left" onclick="shareBack()"></div> &nbsp; <span style="font-size:10.0pt">Page</span> &nbsp; ')}var A=Math.max(H-3,1);var D=Math.min(A+6,B);A=Math.max(D-6,1);for(var F=A;F<=D;F++){I.append(" ");if(F==H){I.append('<span style="border-bottom:1px dotted #9ba4af">')}else{I.append('<a href="javascript:void(0)" onclick="shareJump(').append((F-1)*C).append(')">')}I.append(F);if(F==H){I.append("</span>")}else{I.append("</a>")}I.append(" &nbsp; ")}I.append(' <span style="font-size:10.0pt">of ').append(B).append("</span>");if(H==B){I.append(' &nbsp; <div class="ib-fix arrow gright"></div>')}else{I.append(' &nbsp; <div class="ib-fix arrow right" onclick="shareMore()"></div>')}setInnerHtml("mappager",I.toString())}var searchVisible=true;var searchOrderBy="created";var searchAscending=false;var searchOffset=0;var searchTermsEmpty=true;function searchTermsCheck(){var C=de("itemsearch").value.trim();var B=(C.length>0);var A=de("itemsearchorder");A.options[0].disabled=!B;if(searchTermsEmpty&&B){A.selectedIndex=0;searchOrderChanged(true)}else{if(!B&&A.selectedIndex==0){A.selectedIndex=1;searchOrderChanged(true)}}searchTermsEmpty=!B}function searchOrderChanged(D){var A=de("itemsearchorder");var B=A.options[A.selectedIndex];var C=B.value.split(" ");searchOrderBy=C[0];searchAscending=(C[1]=="asc");if(!D){searchRefresh()}}function searchRefresh(A){searchOffset=0;if(searchVisible&&!A){shareRefresh(true)}searchNow()}function searchEnqueue(){metronome[2].searchCheckZoom()}function searchJump(A){searchOffset=A;if(searchOffset<0){searchOffset=0}searchNow()}function searchBack(){searchOffset=searchOffset-shareLimit;if(searchOffset<0){searchOffset=0}searchNow()}function searchMore(){searchOffset=searchOffset+shareLimit;searchNow()}function searchNow(){if(searchVisible){shareNow()}else{doShare("search")}}var searchCategoriesShown=true;function toggleSearchCategories(){searchCategoriesShown=!searchCategoriesShown;de("itemsearchcategoriespane").style.display=searchCategoriesShown?"block":"none";setInnerHtml("itemsearchcategorieslink",searchCategoriesShown?"hide":"show")}function toggleSearchVisible(){searchVisible=!searchVisible;de("itemsearchsearchvisible").style.display=searchVisible?"inline":"none";de("itemsearchsearchvisiblelink").style.display=searchVisible?"none":"inline";de("itemsearchsearchall").style.display=searchVisible?"none":"inline";de("itemsearchsearchalllink").style.display=searchVisible?"inline":"none";searchRefresh();if(!searchVisible){shareRefresh()}}var shareLimit=50;var shareOffset=0;var shareAge=0;function shareRefresh(A){shareOffset=0;metronome[2].showRefresher(false);if(!A){if(searchVisible){searchRefresh(true)}else{shareNow()}}}function shareJump(A){if(searchVisible){searchJump(A);return }shareOffset=A;if(shareOffset<0){shareOffset=0}shareNow()}function shareBack(){if(searchVisible){searchBack();return }shareOffset=shareOffset-shareLimit;if(shareOffset<0){shareOffset=0}shareNow()}function shareMore(){if(searchVisible){searchMore();return }shareOffset=shareOffset+shareLimit;shareNow()}function shareNow(){metronome[2].searchCheckNow();metronome[2].showSearching(true);doShare(searchVisible?"both":"map")}var showOverlayAndMapComments="map";var mapidcomments=null;var overlayidcomments=null;function shareCommentsNow(C,B,D,A){overlayidcomments=A;mapidcomments=D;showcomments=C;showOverlayAndMapComments=B;shareNow()}var shareInstance=RandomString.makeString(8);function doShare(E){if(map2id==null){metronome[2].showSearching(false);return }var G=searchGetBounds(2);var B="viewid="+encodeURIComponent(map2id);B+="&type="+E;B+="&dc="+shareInstance;B+="&dcr="+mgr[2].checkReset();if(E=="both"||E=="map"){var D=mapDimensions(2);B+="&latmin="+G.latmin;B+="&lonmin="+G.lonmin;B+="&latmax="+G.latmax;B+="&lonmax="+G.lonmax;B+="&alatmin="+G.latbounds.latmin;B+="&alatmax="+G.latbounds.latmax;B+="&alngmin="+G.lngbounds.lngmin;B+="&alngmax="+G.lngbounds.lngmax;B+="&width="+D.width;B+="&height="+D.height;B+="&zoom="+getZoom(2);B+="&age="+shareAge;if(showcomments!=null){B+="&showcomments="+showcomments;if(showOverlayAndMapComments!=null){B+="&overlayormaps="+showOverlayAndMapComments;if(overlayidcomments!=null&&activeMapOverlays.length==0){B+="&layercomments="+overlayidcomments}}}}if(E=="both"||E=="search"){B+="&off="+searchOffset}else{B+="&off="+shareOffset}B+="&lim="+shareLimit;if(E=="both"||E=="search"){var F=de("itemsearch").value.trim();if(F.length>0){B+="&terms="+encodeURIComponent(F)}B+="&orderby="+searchOrderBy;B+="&ascending="+searchAscending;var A=getCategoryReferences();if(A.length>0){B+="&refs="+encodeURIComponent(A)}}for(var C=0;C<activeMapOverlays.length;C++){B+="&layer"+(C+1)+"="+activeMapOverlays[C]}smartCallXML("/FetchViewItems",B,function(H){loadFromXML(H);metronome[2].showSearching(false)})}function showRefresher(B,A){de("mapcontrols").style.display="none";de("mapsearch").style.display="none";de("maprefresh").style.display=B?"inline":"none";if(B){de("maprefresh").innerHTML=A}else{de("mapcontrols").style.display="inline"}}function showSearching(A){de("mapcontrols").style.display="none";de("maprefresh").style.display="none";de("mapsearch").style.display=A?"inline":"none";if(!A){de("mapcontrols").style.display="inline"}}var mapHeaderDisplay=null;function showMapHeader(A){if(mapHeaderDisplay!=null){de("map"+mapHeaderDisplay).style.display="none"}if(A!=null){de("map"+A).style.display="block"}mapHeaderDisplay=A}function toggleControlZoomRecord(){if(mapHeaderDisplay=="zoomrecord"){showMapHeader(null)}else{showMapHeader("zoomrecord")}}function toggleControlAge(){if(mapHeaderDisplay=="agelimit"){showMapHeader(null)}else{showMapHeader("agelimit")}}function toggleControlItems(){if(mapHeaderDisplay=="itemlimit"){showMapHeader(null)}else{showMapHeader("itemlimit")}}function controlAgeSlideEvent(A){setInnerHtml("trackcontrolagetxt",(A==0?"&#8734;":A/86400))}function updateControlAgeSlider(B){for(var A in ageSliderConvert){if(ageSliderConvert[A]==B){controlAgeEnabled=false;controlAgeSlider.setValue(A);controlAgeEnabled=true;setInnerHtml("trackcontrolagetxt",(B==0?"&#8734;":B/86400));break}}}function selectControlAge(B,A){shareAge=B;setInnerHtml("mapcontrolage",(B==0?"&#8734;":B/86400));if(!A){toggleControlAge();shareNow();if(!searchVisible){searchNow()}}updateControlAgeSlider(B)}function controlItemsSlideEvent(A){setInnerHtml("trackcontrolitemstxt",A)}function updateControlItemsSlider(A){for(var B in itemSliderConvert){if(itemSliderConvert[B]==A){controlItemsEnabled=false;controlItemsSlider.setValue(B);controlItemsEnabled=true;setInnerHtml("trackcontrolitemstxt",A);break}}}function selectControlItems(B,A){shareLimit=B;shareOffset-=(shareOffset%shareLimit);searchOffset-=(searchOffset%shareLimit);if(B==0&&map2articleassignmentallowed){shareLimit=0;searchOffset=0;shareOffset=0;toggleSearchVisible(1)}setInnerHtml("mapcontrolitems",(B==0?"&#8734;":B));if(!A){toggleControlItems();shareNow();if(!searchVisible){searchNow()}}updateControlItemsSlider(B)}var searchItem=0;function resetMapItems(){searchItem=0;setInnerHtml("searchpane","")}function emptyMapItems(){setInnerHtml("searchpane","No items to display.")}function addMapItem(E,O,G,I,L,J,A,D,K,N){var M=new StringBuffer();var C=new StringBuffer();if(L!="path"){M.a("fetchArticle(").a(E).a(", ").a(J).a(", ").a(A).a(", '").a(O).a("', {noreturn:true});")}else{M.a("moveWithZoomConstraint(").a(E).a(", ").a(J).a(", ").a(A).a(", ").a(D).a(", ").a(K).a(");")}var F=N.reportstatus;if(F==1){C.a('<a href="#" style="color:#598c40" onclick="promptApproveArticle(\'').a(G).a("', '").a(O).a('\'); return false;">approve </a> <br/><a id="showreportspan').a(O).a('" style="color: #993333" href="#" onmouseover="window.status=\'\'; return true" onclick="reportFetch(\'').a(O).a('\'); return false">view reports<br/></a><a id="hidereportspan').a(O).a('" style="color: #993333; display:none" href="#" onmouseover="window.status=\'\'; return true" onclick="reportFetch(\'').a(O).a("'); return false\">hide reports</a>")}var H=new StringBuffer();H.a('<div class="searchitemline1"><span style="border:1px solid silver">&nbsp;').a(searchOffset+searchItem+1).a('&nbsp;</span>&nbsp; <a href="#" onmouseover="window.status=\'\'; return true" onclick="').a(M.toString()).a('return false">').a(G).a("</a></div>");H.a('<div class="searchitemline2">').a(L).a(" - ").a(I).a("</div>");if(F==1){H.a('<div id="reportPane').a(O).a('" style="display:none"></div>')}if(searchItem==0){setInnerHtml("searchpane",H.toString())}else{var B=document.createElement("div");B.innerHTML=H.toString();appendDOM("searchpane",B)}searchItem++}var categoryList=new Array();function loadviewCategories(B){var A=tag(B,"category");categoryList.length=0;for(var C=0;C<A.length;C++){var E=A[C];var F=nvn(E,"path");var D=nvn(E,"ref");categoryList.push({path:F,ref:D})}populateSearchCategories(A)}function doLayoutManager(){return true}clearMarkers[2]=function(){mgr[2].hideOverlays();resetSmarterOverlays(2)};var overlayList=new Array();function loadviewOverlays(E){overlayList=new Array();var H=new StringBuffer();var G=[];var M=[];var I=E.getElementsByTagName("num");var F=0;if(I.length>0){F=parseInt(nodeValue(I[0]))}setMap2overlays(F);H.append('<div style="margin:0px 5px 0px 5px; font-size:8.0pt">');if(F==0){H.append('<div style="margin-top:5px; text-align:center; font-style:italic; font-size:10.0pt; line-height:9.0pt">This map has no overlays.</div>')}var D;var L;var J;var B=0;var C=E.getElementsByTagName("owner");if(C.length>0){L=C[0].getElementsByTagName("category");if(L.length>0){H.append('<div style="margin-top:5px"></div>')}for(D=0;D<L.length;D++){++B;J=generateOverlaysCategory(B,L[D],H,G);if(J){M.push(B)}}H.append('<div style="clear:both; margin-top:8px"></div>')}var K=E.getElementsByTagName("other");if(K.length>0){L=K[0].getElementsByTagName("category");if(L.length>0){H.append('<div style="font-size:7.5pt; font-style:italic; font-weight:bold; margin:5px">From other users:</div>')}for(D=0;D<L.length;D++){++B;J=generateOverlaysCategory(B,L[D],H,G);if(J){M.push(B)}}H.append('<div style="clear:both; margin-top:8px"></div>')}var A=H.toString();setInnerHtml("overlayspane",A);for(D=0;D<G.length;D++){setMapOverlay(G[D],true,true)}for(D=0;D<M.length;D++){toggleOverlayCategory(M[D])}}function generateOverlaysCategory(C,L,I,H){var N=false;var D=L.getElementsByTagName("ctitle");var B="";if(D.length>0){B=nodeValue(D[0])}if(B.length>0){overlayList[C]=new Array();var O="toggleOverlayCategory("+C+")";I.append('<div style="clear:both; margin:5px 0px 5px 0px; font-weight:bold"><div id="olcategoryarrow');I.append(C);I.append('" class="olarrowright" style="float:left; margin:0px 0px 0px 3px; width:13px; height:13px; cursor:pointer" onclick="');I.append(O);I.append('"></div>&nbsp;');I.append('<input type="checkbox" id="olbox-');I.append(C);I.append('ex" onclick="expandCategory(');I.append(C);I.append(', this.checked)" style="padding:0px; ');if(is_ie){I.append("margin:-2px 1px 0px -3px")}else{I.append("margin:1px 1px 0px 1px")}I.append('" />');I.append('&nbsp;<a href="#" onclick="');I.append(O);I.append('; return false">');I.append(B);I.append("</a></div>")}else{N=true}I.append('<div id="olcategory');I.append(C);I.append('" style="display:none">');var K=L.getElementsByTagName("item");for(var F=0;F<K.length;F++){var E=K[F].getElementsByTagName("id");var A;if(E.length>0){A=nodeValue(E[0])}else{continue}if(B.length>0){overlayList[C].push(A)}var M=K[F].getElementsByTagName("ititle");var P;if(M.length>0){P=nodeValue(M[0])}else{continue}var J=K[F].getElementsByTagName("open");var G=false;if(J.length>0){G=true;N=true;H.push(A)}I.append('<div style="clear:both; float:left; margin-left:3px"><input type="checkbox" id="olbox');I.append(A);I.append('" ');if(G){I.append('checked="checked" ')}I.append("onclick=\"setMapOverlay('");I.append(A);I.append('\', this.checked)" style="padding:0px; ');if(is_ie){I.append("margin:-2px 1px 0px -3px")}else{I.append("margin:1px 1px 0px 1px")}I.append('" /></div>');I.append('<div style="margin:0px 0px 0px 25px; line-height:16px">');I.append(P);I.append("</div>");I.append('<div style="clear:both; margin-top:2px"></div>')}I.append("</div>");return N}function expandCategory(E,D){var B=D;de("olbox-"+E+"ex").checked=B;var C=overlayList[E];for(var A=0;A<C.length;A++){setMapOverlay(C[A],B,true)}shareNow()}var activeMapOverlays=new Array();function setMapOverlay(F,E,A){var D=de("olbox"+F);D.checked=E;var B=-1;for(var C=0;C<activeMapOverlays.length;C++){if(activeMapOverlays[C]==F){B=C;break}}if(B>=0&&!E){activeMapOverlays.splice(B,1)}else{if(B<0&&E){activeMapOverlays[activeMapOverlays.length]=F}}if(!A){shareNow()}}function toggleOverlayCategory(B){var A=de("olcategory"+B);var C=de("olcategoryarrow"+B);if(C){C.className=(A.style.display=="none")?"olarrowdown":"olarrowright"}if(A){A.style.display=(A.style.display=="none")?"block":"none"}}var avatarImg="/r/images/geomonkey-avatar.png";function initSimilarMaps(){if(map2id==null){setInnerHtml("similarmaps","<i>Similar maps are not available for this map.</i>");return }setInnerHtml("similarmaps",'<div style="height:22px"></div><div style="padding:10px"><img src="/r/images/loading.gif" /></div>');var A="action=similar&viewid="+map2id+"&limit=7&offset=0";smartCallXML("/maps",A,function(G){if(nh(G,"error")){setInnerHtml("similarmaps","<i>"+nvn(G,"error")+"</i>");return }var D=new StringBuffer();var H=nvn(G,"count");var C=tag(G,"item");for(var F=0;F<C.length;F++){var N=C[F];var E=nvn(N,"username");var B=nvn(N,"url");var P=nivn(N,"avatarid");var I=nvn(N,"avatarkey");var J=nivn(N,"mapavatarid");var L=nvn(N,"mapavatarkey");var O=nvn(N,"title");var K=(O.length>30)?O.substring(0,28)+"...":O;var M=avatarImg;if(J!=-1){M="/r/FileView/file/f/F"+J+"/t/true/k/"+L}else{if(P!=-1){M="/r/FileView/file/f/F"+P+"/t/true/k/"+I}}D.a('<div style="float:left; width:100px; margin:15px 12px">');D.a('<a href="').a(B).a('">');D.a('<img src="').a(M).a('" style="border:2px solid #a3b5d8" />');D.a("</a>");D.a('<div style="margin:0px; font-size:7.5pt; color:silver">');D.a('<a href="').a(B).a('">');D.a(entify(K));D.a('</a><br/>by <a href="/profile/user/').a(E).a('">').a(E).a("</a>");D.a("</div>");D.a("</div>")}setInnerHtml("similarmaps",D.toString())})}