/*
 * jQuery 1.1.2 - New Wave Javascript
 *
 * Copyright (c) 2007 John Resig (jquery.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * $Date: 2008/08/01 18:24:52 $
 * $Rev: 1465 $
 */

eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('7(1C 1w.6=="T"){1w.T=1w.T;B 6=u(a,c){7(1w==q)v 1p 6(a,c);a=a||17;7(6.1t(a))v 1p 6(17)[6.E.27?"27":"2O"](a);7(1C a=="23"){B m=/^[^<]*(<(.|\\s)+>)[^>]*$/.2Q(a);7(m)a=6.3k([m[1]]);J v 1p 6(c).2o(a)}v q.6r(a.1l==2y&&a||(a.3Y||a.I&&a!=1w&&!a.24&&a[0]!=T&&a[0].24)&&6.3M(a)||[a])};7(1C $!="T")6.2S$=$;B $=6;6.E=6.8p={3Y:"1.1.2",8q:u(){v q.I},I:0,2b:u(1T){v 1T==T?6.3M(q):q[1T]},2r:u(a){B L=6(a);L.6p=q;v L},6r:u(a){q.I=0;[].1g.14(q,a);v q},K:u(E,1E){v 6.K(q,E,1E)},2h:u(1c){B 4c=-1;q.K(u(i){7(q==1c)4c=i});v 4c},1I:u(1Y,O,C){B 1c=1Y;7(1Y.1l==3t)7(O==T)v q.I&&6[C||"1I"](q[0],1Y)||T;J{1c={};1c[1Y]=O}v q.K(u(2h){P(B H 1x 1c)6.1I(C?q.1q:q,H,6.H(q,1c[H],C,2h,H))})},1m:u(1Y,O){v q.1I(1Y,O,"30")},2L:u(e){7(1C e=="23")v q.3u().3r(17.8t(e));B t="";6.K(e||q,u(){6.K(q.2I,u(){7(q.24!=8)t+=q.24!=1?q.60:6.E.2L([q])})});v t},2K:u(){B a=6.3k(1A);v q.K(u(){B b=a[0].3l(U);q.11.2X(b,q);22(b.1b)b=b.1b;b.4C(q)})},3r:u(){v q.3j(1A,U,1,u(a){q.4C(a)})},5i:u(){v q.3j(1A,U,-1,u(a){q.2X(a,q.1b)})},5j:u(){v q.3j(1A,12,1,u(a){q.11.2X(a,q)})},5t:u(){v q.3j(1A,12,-1,u(a){q.11.2X(a,q.2e)})},4g:u(){v q.6p||6([])},2o:u(t){v q.2r(6.31(q,u(a){v 6.2o(t,a)}),t)},4Y:u(4N){v q.2r(6.31(q,u(a){B a=a.3l(4N!=T?4N:U);a.$1H=16;v a}))},1D:u(t){v q.2r(6.1t(t)&&6.2q(q,u(2z,2h){v t.14(2z,[2h])})||6.3z(t,q))},2g:u(t){v q.2r(t.1l==3t&&6.3z(t,q,U)||6.2q(q,u(a){v(t.1l==2y||t.3Y)?6.3y(a,t)<0:a!=t}))},1M:u(t){v q.2r(6.2k(q.2b(),t.1l==3t?6(t).2b():t.I!=T&&(!t.1f||t.1f=="8v")?t:[t]))},4l:u(1s){v 1s?6.1D(1s,q).r.I>0:12},1a:u(1a){v 1a==T?(q.I?q[0].O:16):q.1I("O",1a)},4U:u(1a){v 1a==T?(q.I?q[0].2t:16):q.3u().3r(1a)},3j:u(1E,1P,3Z,E){B 4Y=q.I>1;B a=6.3k(1E);7(3Z<0)a.8w();v q.K(u(){B 1c=q;7(1P&&6.1f(q,"1P")&&6.1f(a[0],"3m"))1c=q.5J("20")[0]||q.4C(17.6n("20"));6.K(a,u(){E.14(1c,[4Y?q.3l(U):q])})})}};6.1z=6.E.1z=u(){B 1O=1A[0],a=1;7(1A.I==1){1O=q;a=0}B H;22(H=1A[a++])P(B i 1x H)1O[i]=H[i];v 1O};6.1z({8x:u(){7(6.2S$)$=6.2S$;v 6},1t:u(E){v!!E&&1C E!="23"&&!E.1f&&1C E[0]=="T"&&/u/i.1n(E+"")},4B:u(D){v D.66&&D.5I&&!D.5I.64},1f:u(D,Y){v D.1f&&D.1f.3K()==Y.3K()},K:u(1c,E,1E){7(1c.I==T)P(B i 1x 1c)E.14(1c[i],1E||[i,1c[i]]);J P(B i=0,6q=1c.I;i<6q;i++)7(E.14(1c[i],1E||[i,1c[i]])===12)3O;v 1c},H:u(D,O,C,2h,H){7(6.1t(O))O=O.3n(D,[2h]);B 6s=/z-?2h|7P-?8A|1d|58|8B-?28/i;v O&&O.1l==3Q&&C=="30"&&!6s.1n(H)?O+"4S":O},19:{1M:u(D,c){6.K(c.3o(/\\s+/),u(i,Q){7(!6.19.2V(D.19,Q))D.19+=(D.19?" ":"")+Q})},2f:u(D,c){D.19=c?6.2q(D.19.3o(/\\s+/),u(Q){v!6.19.2V(c,Q)}).6t(" "):""},2V:u(t,c){t=t.19||t;c=c.1R(/([\\.\\\\\\+\\*\\?\\[\\^\\]\\$\\(\\)\\{\\}\\=\\!\\<\\>\\|\\:])/g,"\\\\$1");v t&&1p 4v("(^|\\\\s)"+c+"(\\\\s|$)").1n(t)}},4d:u(e,o,f){P(B i 1x o){e.1q["1N"+i]=e.1q[i];e.1q[i]=o[i]}f.14(e,[]);P(B i 1x o)e.1q[i]=e.1q["1N"+i]},1m:u(e,p){7(p=="28"||p=="3V"){B 1N={},46,3P,d=["7d","8C","8D","8E"];6.K(d,u(){1N["8F"+q]=0;1N["8G"+q+"8H"]=0});6.4d(e,1N,u(){7(6.1m(e,"1h")!="1Z"){46=e.8I;3P=e.8J}J{e=6(e.3l(U)).2o(":4j").5l("2Z").4g().1m({4n:"1G",45:"8K",1h:"2D",7I:"0",8M:"0"}).5z(e.11)[0];B 3d=6.1m(e.11,"45");7(3d==""||3d=="4b")e.11.1q.45="6x";46=e.6y;3P=e.6z;7(3d==""||3d=="4b")e.11.1q.45="4b";e.11.33(e)}});v p=="28"?46:3P}v 6.30(e,p)},30:u(D,H,53){B L;7(H=="1d"&&6.W.1j)v 6.1I(D.1q,"1d");7(H=="4h"||H=="2v")H=6.W.1j?"3T":"2v";7(!53&&D.1q[H])L=D.1q[H];J 7(17.44&&17.44.4W){7(H=="2v"||H=="3T")H="4h";H=H.1R(/([A-Z])/g,"-$1").4m();B Q=17.44.4W(D,16);7(Q)L=Q.55(H);J 7(H=="1h")L="1Z";J 6.4d(D,{1h:"2D"},u(){B c=17.44.4W(q,"");L=c&&c.55(H)||""})}J 7(D.51){B 56=H.1R(/\\-(\\w)/g,u(m,c){v c.3K()});L=D.51[H]||D.51[56]}v L},3k:u(a){B r=[];6.K(a,u(i,1r){7(!1r)v;7(1r.1l==3Q)1r=1r.6C();7(1C 1r=="23"){B s=6.35(1r),1V=17.6n("1V"),2i=[];B 2K=!s.18("<1u")&&[1,"<42>","</42>"]||(!s.18("<6D")||!s.18("<20")||!s.18("<6E"))&&[1,"<1P>","</1P>"]||!s.18("<3m")&&[2,"<1P><20>","</20></1P>"]||(!s.18("<6F")||!s.18("<6G"))&&[3,"<1P><20><3m>","</3m></20></1P>"]||[0,"",""];1V.2t=2K[1]+s+2K[2];22(2K[0]--)1V=1V.1b;7(6.W.1j){7(!s.18("<1P")&&s.18("<20")<0)2i=1V.1b&&1V.1b.2I;J 7(2K[1]=="<1P>"&&s.18("<20")<0)2i=1V.2I;P(B n=2i.I-1;n>=0;--n)7(6.1f(2i[n],"20")&&!2i[n].2I.I)2i[n].11.33(2i[n])}1r=[];P(B i=0,l=1V.2I.I;i<l;i++)1r.1g(1V.2I[i])}7(1r.I===0&&!6.1f(1r,"3w"))v;7(1r[0]==T||6.1f(1r,"3w"))r.1g(1r);J r=6.2k(r,1r)});v r},1I:u(D,Y,O){B 2j=6.4B(D)?{}:{"P":"6J","6L":"19","4h":6.W.1j?"3T":"2v",2v:6.W.1j?"3T":"2v",2t:"2t",19:"19",O:"O",2W:"2W",2Z:"2Z",89:"6N",2Y:"2Y"};7(Y=="1d"&&6.W.1j&&O!=T){D.58=1;v D.1D=D.1D.1R(/4i\\([^\\)]*\\)/6O,"")+(O==1?"":"4i(1d="+O*6g+")")}J 7(Y=="1d"&&6.W.1j)v D.1D?4T(D.1D.6P(/4i\\(1d=(.*)\\)/)[1])/6g:1;7(Y=="1d"&&6.W.3h&&O==1)O=0.6R;7(2j[Y]){7(O!=T)D[2j[Y]]=O;v D[2j[Y]]}J 7(O==T&&6.W.1j&&6.1f(D,"3w")&&(Y=="81"||Y=="80"))v D.6T(Y).60;J 7(D.66){7(O!=T)D.6V(Y,O);7(6.W.1j&&/5E|3e/.1n(Y)&&!6.4B(D))v D.36(Y,2);v D.36(Y)}J{Y=Y.1R(/-([a-z])/6W,u(z,b){v b.3K()});7(O!=T)D[Y]=O;v D[Y]}},35:u(t){v t.1R(/^\\s+|\\s+$/g,"")},3M:u(a){B r=[];7(a.1l!=2y)P(B i=0,2R=a.I;i<2R;i++)r.1g(a[i]);J r=a.3N(0);v r},3y:u(b,a){P(B i=0,2R=a.I;i<2R;i++)7(a[i]==b)v i;v-1},2k:u(2u,3H){B r=[].3N.3n(2u,0);P(B i=0,5b=3H.I;i<5b;i++)7(6.3y(3H[i],r)==-1)2u.1g(3H[i]);v 2u},2q:u(1U,E,4k){7(1C E=="23")E=1p 4w("a","i","v "+E);B 1i=[];P(B i=0,2z=1U.I;i<2z;i++)7(!4k&&E(1U[i],i)||4k&&!E(1U[i],i))1i.1g(1U[i]);v 1i},31:u(1U,E){7(1C E=="23")E=1p 4w("a","v "+E);B 1i=[],r=[];P(B i=0,2z=1U.I;i<2z;i++){B 1a=E(1U[i],i);7(1a!==16&&1a!=T){7(1a.1l!=2y)1a=[1a];1i=1i.6Z(1a)}}B r=1i.I?[1i[0]]:[];5f:P(B i=1,5e=1i.I;i<5e;i++){P(B j=0;j<i;j++)7(1i[i]==r[j])5F 5f;r.1g(1i[i])}v r}});1p u(){B b=7L.71.4m();6.W={2N:/5D/.1n(b),3f:/3f/.1n(b),1j:/1j/.1n(b)&&!/3f/.1n(b),3h:/3h/.1n(b)&&!/(72|5D)/.1n(b)};6.7H=!6.W.1j||17.74=="75"};6.K({5u:"a.11",4z:"6.4z(a)",76:"6.2a(a,2,\'2e\')",7D:"6.2a(a,2,\'5s\')",78:"6.2B(a.11.1b,a)",79:"6.2B(a.1b)"},u(i,n){6.E[i]=u(a){B L=6.31(q,n);7(a&&1C a=="23")L=6.3z(a,L);v q.2r(L)}});6.K({5z:"3r",7b:"5i",2X:"5j",7e:"5t"},u(i,n){6.E[i]=u(){B a=1A;v q.K(u(){P(B j=0,2R=a.I;j<2R;j++)6(a[j])[n](q)})}});6.K({5l:u(1Y){6.1I(q,1Y,"");q.7g(1Y)},7h:u(c){6.19.1M(q,c)},7i:u(c){6.19.2f(q,c)},7k:u(c){6.19[6.19.2V(q,c)?"2f":"1M"](q,c)},2f:u(a){7(!a||6.1D(a,[q]).r.I)q.11.33(q)},3u:u(){22(q.1b)q.33(q.1b)}},u(i,n){6.E[i]=u(){v q.K(n,1A)}});6.K(["5q","5n","5p","5v"],u(i,n){6.E[n]=u(1T,E){v q.1D(":"+n+"("+1T+")",E)}});6.K(["28","3V"],u(i,n){6.E[n]=u(h){v h==T?(q.I?6.1m(q[0],n):16):q.1m(n,h.1l==3t?h:h+"4S")}});6.1z({1s:{"":"m[2]==\'*\'||6.1f(a,m[2])","#":"a.36(\'2J\')==m[2]",":":{5n:"i<m[3]-0",5p:"i>m[3]-0",2a:"m[3]-0==i",5q:"m[3]-0==i",2u:"i==0",2T:"i==r.I-1",5R:"i%2==0",5S:"i%2","2a-3s":"6.2a(a.11.1b,m[3],\'2e\',a)==a","2u-3s":"6.2a(a.11.1b,1,\'2e\')==a","2T-3s":"6.2a(a.11.7n,1,\'5s\')==a","7p-3s":"6.2B(a.11.1b).I==1",5u:"a.1b",3u:"!a.1b",5v:"6.E.2L.14([a]).18(m[3])>=0",3i:\'a.C!="1G"&&6.1m(a,"1h")!="1Z"&&6.1m(a,"4n")!="1G"\',1G:\'a.C=="1G"||6.1m(a,"1h")=="1Z"||6.1m(a,"4n")=="1G"\',7v:"!a.2W",2W:"a.2W",2Z:"a.2Z",2Y:"a.2Y||6.1I(a,\'2Y\')",2L:"a.C==\'2L\'",4j:"a.C==\'4j\'",5x:"a.C==\'5x\'",4G:"a.C==\'4G\'",5y:"a.C==\'5y\'",4R:"a.C==\'4R\'",5A:"a.C==\'5A\'",5B:"a.C==\'5B\'",3x:\'a.C=="3x"||6.1f(a,"3x")\',5C:"/5C|42|7A|3x/i.1n(a.1f)"},".":"6.19.2V(a,m[2])","@":{"=":"z==m[4]","!=":"z!=m[4]","^=":"z&&!z.18(m[4])","$=":"z&&z.2U(z.I - m[4].I,m[4].I)==m[4]","*=":"z&&z.18(m[4])>=0","":"z",4u:u(m){v["",m[1],m[3],m[2],m[5]]},5P:"z=a[m[3]];7(!z||/5E|3e/.1n(m[3]))z=6.1I(a,m[3]);"},"[":"6.2o(m[2],a).I"},5M:[/^\\[ *(@)([a-2m-3C-]*) *([!*$^=]*) *(\'?"?)(.*?)\\4 *\\]/i,/^(\\[)\\s*(.*?(\\[.*?\\])?[^[]*?)\\s*\\]/,/^(:)([a-2m-3C-]*)\\("?\'?(.*?(\\(.*?\\))?[^(]*?)"?\'?\\)/i,/^([:.#]*)([a-2m-3C*-]*)/i],1Q:[/^(\\/?\\.\\.)/,"a.11",/^(>|\\/)/,"6.2B(a.1b)",/^(\\+)/,"6.2a(a,2,\'2e\')",/^(~)/,u(a){B s=6.2B(a.11.1b);v s.3N(6.3y(a,s)+1)}],3z:u(1s,1U,2g){B 1N,Q=[];22(1s&&1s!=1N){1N=1s;B f=6.1D(1s,1U,2g);1s=f.t.1R(/^\\s*,\\s*/,"");Q=2g?1U=f.r:6.2k(Q,f.r)}v Q},2o:u(t,1B){7(1C t!="23")v[t];7(1B&&!1B.24)1B=16;1B=1B||17;7(!t.18("//")){1B=1B.4H;t=t.2U(2,t.I)}J 7(!t.18("/")){1B=1B.4H;t=t.2U(1,t.I);7(t.18("/")>=1)t=t.2U(t.18("/"),t.I)}B L=[1B],2c=[],2T=16;22(t&&2T!=t){B r=[];2T=t;t=6.35(t).1R(/^\\/\\//i,"");B 3B=12;B 1J=/^[\\/>]\\s*([a-2m-9*-]+)/i;B m=1J.2Q(t);7(m){6.K(L,u(){P(B c=q.1b;c;c=c.2e)7(c.24==1&&(6.1f(c,m[1])||m[1]=="*"))r.1g(c)});L=r;t=t.1R(1J,"");7(t.18(" ")==0)5F;3B=U}J{P(B i=0;i<6.1Q.I;i+=2){B 1J=6.1Q[i];B m=1J.2Q(t);7(m){r=L=6.31(L,6.1t(6.1Q[i+1])?6.1Q[i+1]:u(a){v 40(6.1Q[i+1])});t=6.35(t.1R(1J,""));3B=U;3O}}}7(t&&!3B){7(!t.18(",")){7(L[0]==1B)L.4L();6.2k(2c,L);r=L=[1B];t=" "+t.2U(1,t.I)}J{B 34=/^([a-2m-3C-]+)(#)([a-2m-9\\\\*2S-]*)/i;B m=34.2Q(t);7(m){m=[0,m[2],m[3],m[1]]}J{34=/^([#.]?)([a-2m-9\\\\*2S-]*)/i;m=34.2Q(t)}7(m[1]=="#"&&L[L.I-1].4X){B 2l=L[L.I-1].4X(m[2]);7(6.W.1j&&2l&&2l.2J!=m[2])2l=6(\'[@2J="\'+m[2]+\'"]\',L[L.I-1])[0];L=r=2l&&(!m[3]||6.1f(2l,m[3]))?[2l]:[]}J{7(m[1]==".")B 4r=1p 4v("(^|\\\\s)"+m[2]+"(\\\\s|$)");6.K(L,u(){B 3E=m[1]!=""||m[0]==""?"*":m[2];7(6.1f(q,"7J")&&3E=="*")3E="3g";6.2k(r,m[1]!=""&&L.I!=1?6.4x(q,[],m[1],m[2],4r):q.5J(3E))});7(m[1]=="."&&L.I==1)r=6.2q(r,u(e){v 4r.1n(e.19)});7(m[1]=="#"&&L.I==1){B 5K=r;r=[];6.K(5K,u(){7(q.36("2J")==m[2]){r=[q];v 12}})}L=r}t=t.1R(34,"")}}7(t){B 1a=6.1D(t,r);L=r=1a.r;t=6.35(1a.t)}}7(L&&L[0]==1B)L.4L();6.2k(2c,L);v 2c},1D:u(t,r,2g){22(t&&/^[a-z[({<*:.#]/i.1n(t)){B p=6.5M,m;6.K(p,u(i,1J){m=1J.2Q(t);7(m){t=t.7M(m[0].I);7(6.1s[m[1]].4u)m=6.1s[m[1]].4u(m);v 12}});7(m[1]==":"&&m[2]=="2g")r=6.1D(m[3],r,U).r;J 7(m[1]=="."){B 1J=1p 4v("(^|\\\\s)"+m[2]+"(\\\\s|$)");r=6.2q(r,u(e){v 1J.1n(e.19||"")},2g)}J{B f=6.1s[m[1]];7(1C f!="23")f=6.1s[m[1]][m[2]];40("f = u(a,i){"+(6.1s[m[1]].5P||"")+"v "+f+"}");r=6.2q(r,f,2g)}}v{r:r,t:t}},4x:u(o,r,1Q,Y,1J){P(B s=o.1b;s;s=s.2e)7(s.24==1){B 1M=U;7(1Q==".")1M=s.19&&1J.1n(s.19);J 7(1Q=="#")1M=s.36("2J")==Y;7(1M)r.1g(s);7(1Q=="#"&&r.I)3O;7(s.1b)6.4x(s,r,1Q,Y,1J)}v r},4z:u(D){B 4A=[];B Q=D.11;22(Q&&Q!=17){4A.1g(Q);Q=Q.11}v 4A},2a:u(Q,1i,3Z,D){1i=1i||1;B 1T=0;P(;Q;Q=Q[3Z]){7(Q.24==1)1T++;7(1T==1i||1i=="5R"&&1T%2==0&&1T>1&&Q==D||1i=="5S"&&1T%2==1&&Q==D)v Q}},2B:u(n,D){B r=[];P(;n;n=n.2e){7(n.24==1&&(!D||n!=D))r.1g(n)}v r}});6.G={1M:u(S,C,1o,F){7(6.W.1j&&S.3L!=T)S=1w;7(F)1o.F=F;7(!1o.2A)1o.2A=q.2A++;7(!S.$1H)S.$1H={};B 38=S.$1H[C];7(!38){38=S.$1H[C]={};7(S["39"+C])38[0]=S["39"+C]}38[1o.2A]=1o;S["39"+C]=q.5Y;7(!q.1k[C])q.1k[C]=[];q.1k[C].1g(S)},2A:1,1k:{},2f:u(S,C,1o){7(S.$1H){B i,j,k;7(C&&C.C){1o=C.1o;C=C.C}7(C&&S.$1H[C])7(1o)5U S.$1H[C][1o.2A];J P(i 1x S.$1H[C])5U S.$1H[C][i];J P(j 1x S.$1H)q.2f(S,j);P(k 1x S.$1H[C])7(k){k=U;3O}7(!k)S["39"+C]=16}},1S:u(C,F,S){F=6.3M(F||[]);7(!S)6.K(q.1k[C]||[],u(){6.G.1S(C,F,q)});J{B 1o=S["39"+C],1a,E=6.1t(S[C]);7(1o){F.61(q.2j({C:C,1O:S}));7((1a=1o.14(S,F))!==12)q.4F=U}7(E&&1a!==12)S[C]();q.4F=12}},5Y:u(G){7(1C 6=="T"||6.G.4F)v;G=6.G.2j(G||1w.G||{});B 3R;B c=q.$1H[G.C];B 1E=[].3N.3n(1A,1);1E.61(G);P(B j 1x c){1E[0].1o=c[j];1E[0].F=c[j].F;7(c[j].14(q,1E)===12){G.2n();G.2H();3R=12}}7(6.W.1j)G.1O=G.2n=G.2H=G.1o=G.F=16;v 3R},2j:u(G){7(!G.1O&&G.63)G.1O=G.63;7(G.65==T&&G.67!=T){B e=17.4H,b=17.64;G.65=G.67+(e.68||b.68);G.7Y=G.7Z+(e.6c||b.6c)}7(6.W.2N&&G.1O.24==3){B 3a=G;G=6.1z({},3a);G.1O=3a.1O.11;G.2n=u(){v 3a.2n()};G.2H=u(){v 3a.2H()}}7(!G.2n)G.2n=u(){q.3R=12};7(!G.2H)G.2H=u(){q.82=U};v G}};6.E.1z({3U:u(C,F,E){v q.K(u(){6.G.1M(q,C,E||F,F)})},6u:u(C,F,E){v q.K(u(){6.G.1M(q,C,u(G){6(q).6f(G);v(E||F).14(q,1A)},F)})},6f:u(C,E){v q.K(u(){6.G.2f(q,C,E)})},1S:u(C,F){v q.K(u(){6.G.1S(C,F,q)})},3X:u(){B a=1A;v q.6j(u(e){q.4M=q.4M==0?1:0;e.2n();v a[q.4M].14(q,[e])||12})},83:u(f,g){u 4O(e){B p=(e.C=="41"?e.84:e.85)||e.86;22(p&&p!=q)2G{p=p.11}2w(e){p=q};7(p==q)v 12;v(e.C=="41"?f:g).14(q,[e])}v q.41(4O).6k(4O)},27:u(f){7(6.3W)f.14(17,[6]);J{6.3c.1g(u(){v f.14(q,[6])})}v q}});6.1z({3W:12,3c:[],27:u(){7(!6.3W){6.3W=U;7(6.3c){6.K(6.3c,u(){q.14(17)});6.3c=16}7(6.W.3h||6.W.3f)17.87("6o",6.27,12)}}});1p u(){6.K(("88,8a,2O,8b,8d,52,6j,8e,"+"8f,8g,8h,41,6k,8j,42,"+"4R,8k,8l,8m,2C").3o(","),u(i,o){6.E[o]=u(f){v f?q.3U(o,f):q.1S(o)}});7(6.W.3h||6.W.3f)17.8n("6o",6.27,12);J 7(6.W.1j){17.8o("<8r"+"8s 2J=62 8u=U "+"3e=//:><\\/2d>");B 2d=17.4X("62");7(2d)2d.37=u(){7(q.3D!="1X")v;q.11.33(q);6.27()};2d=16}J 7(6.W.2N)6.50=3L(u(){7(17.3D=="8y"||17.3D=="1X"){4p(6.50);6.50=16;6.27()}},10);6.G.1M(1w,"2O",6.27)};7(6.W.1j)6(1w).6u("52",u(){B 1k=6.G.1k;P(B C 1x 1k){B 4Z=1k[C],i=4Z.I;7(i&&C!=\'52\')6w 6.G.2f(4Z[i-1],C);22(--i)}});6.E.1z({6A:u(V,21,M){q.2O(V,21,M,1)},2O:u(V,21,M,1W){7(6.1t(V))v q.3U("2O",V);M=M||u(){};B C="5d";7(21)7(6.1t(21)){M=21;21=16}J{21=6.3g(21);C="5V"}B 4e=q;6.3v({V:V,C:C,F:21,1W:1W,1X:u(2P,15){7(15=="2M"||!1W&&15=="5L")4e.1I("2t",2P.3G).4V().K(M,[2P.3G,15,2P]);J M.14(4e,[2P.3G,15,2P])}});v q},6B:u(){v 6.3g(q)},4V:u(){v q.2o("2d").K(u(){7(q.3e)6.59(q.3e);J 6.4a(q.2L||q.6H||q.2t||"")}).4g()}});7(!1w.3p)3p=u(){v 1p 6I("6K.6M")};6.K("5m,5Q,5O,5W,5N,5H".3o(","),u(i,o){6.E[o]=u(f){v q.3U(o,f)}});6.1z({2b:u(V,F,M,C,1W){7(6.1t(F)){M=F;F=16}v 6.3v({V:V,F:F,2M:M,4t:C,1W:1W})},6Q:u(V,F,M,C){v 6.2b(V,F,M,C,1)},59:u(V,M){v 6.2b(V,16,M,"2d")},6S:u(V,F,M){v 6.2b(V,F,M,"6m")},6U:u(V,F,M,C){7(6.1t(F)){M=F;F={}}v 6.3v({C:"5V",V:V,F:F,2M:M,4t:C})},6X:u(29){6.3q.29=29},6Y:u(5c){6.1z(6.3q,5c)},3q:{1k:U,C:"5d",29:0,5r:"70/x-73-3w-77",5h:U,48:U,F:16},3S:{},3v:u(s){s=6.1z({},6.3q,s);7(s.F){7(s.5h&&1C s.F!="23")s.F=6.3g(s.F);7(s.C.4m()=="2b"){s.V+=((s.V.18("?")>-1)?"&":"?")+s.F;s.F=16}}7(s.1k&&!6.4E++)6.G.1S("5m");B 4y=12;B N=1p 3p();N.7j(s.C,s.V,s.48);7(s.F)N.3A("7l-7m",s.5r);7(s.1W)N.3A("7o-4K-7q",6.3S[s.V]||"7s, 7t 7w 7x 4o:4o:4o 7z");N.3A("X-7B-7C","3p");7(N.7E)N.3A("7F","7G");7(s.5G)s.5G(N);7(s.1k)6.G.1S("5H",[N,s]);B 37=u(4s){7(N&&(N.3D==4||4s=="29")){4y=U;7(3I){4p(3I);3I=16}B 15;2G{15=6.5Z(N)&&4s!="29"?s.1W&&6.69(N,s.V)?"5L":"2M":"2C";7(15!="2C"){B 3F;2G{3F=N.4P("6b-4K")}2w(e){}7(s.1W&&3F)6.3S[s.V]=3F;B F=6.6i(N,s.4t);7(s.2M)s.2M(F,15);7(s.1k)6.G.1S("5N",[N,s])}J 6.3J(s,N,15)}2w(e){15="2C";6.3J(s,N,15,e)}7(s.1k)6.G.1S("5O",[N,s]);7(s.1k&&!--6.4E)6.G.1S("5Q");7(s.1X)s.1X(N,15);7(s.48)N=16}};B 3I=3L(37,13);7(s.29>0)57(u(){7(N){N.7N();7(!4y)37("29")}},s.29);2G{N.7Q(s.F)}2w(e){6.3J(s,N,16,e)}7(!s.48)37();v N},3J:u(s,N,15,e){7(s.2C)s.2C(N,15,e);7(s.1k)6.G.1S("5W",[N,s,e])},4E:0,5Z:u(r){2G{v!r.15&&7V.7W=="4G:"||(r.15>=5X&&r.15<7X)||r.15==6d||6.W.2N&&r.15==T}2w(e){}v 12},69:u(N,V){2G{B 6e=N.4P("6b-4K");v N.15==6d||6e==6.3S[V]||6.W.2N&&N.15==T}2w(e){}v 12},6i:u(r,C){B 4Q=r.4P("8c-C");B F=!C&&4Q&&4Q.18("N")>=0;F=C=="N"||F?r.8i:r.3G;7(C=="2d")6.4a(F);7(C=="6m")40("F = "+F);7(C=="4U")6("<1V>").4U(F).4V();v F},3g:u(a){B s=[];7(a.1l==2y||a.3Y)6.K(a,u(){s.1g(2x(q.Y)+"="+2x(q.O))});J P(B j 1x a)7(a[j]&&a[j].1l==2y)6.K(a[j],u(){s.1g(2x(j)+"="+2x(q))});J s.1g(2x(j)+"="+2x(a[j]));v s.6t("&")},4a:u(F){7(1w.54)1w.54(F);J 7(6.W.2N)1w.57(F,0);J 40.3n(1w,F)}});6.E.1z({1L:u(R,M){B 1G=q.1D(":1G");R?1G.26({28:"1L",3V:"1L",1d:"1L"},R,M):1G.K(u(){q.1q.1h=q.2E?q.2E:"";7(6.1m(q,"1h")=="1Z")q.1q.1h="2D"});v q},1K:u(R,M){B 3i=q.1D(":3i");R?3i.26({28:"1K",3V:"1K",1d:"1K"},R,M):3i.K(u(){q.2E=q.2E||6.1m(q,"1h");7(q.2E=="1Z")q.2E="2D";q.1q.1h="1Z"});v q},5g:6.E.3X,3X:u(E,4I){B 1E=1A;v 6.1t(E)&&6.1t(4I)?q.5g(E,4I):q.K(u(){6(q)[6(q).4l(":1G")?"1L":"1K"].14(6(q),1E)})},7a:u(R,M){v q.26({28:"1L"},R,M)},7c:u(R,M){v q.26({28:"1K"},R,M)},7f:u(R,M){v q.K(u(){B 5k=6(q).4l(":1G")?"1L":"1K";6(q).26({28:5k},R,M)})},7r:u(R,M){v q.26({1d:"1L"},R,M)},7u:u(R,M){v q.26({1d:"1K"},R,M)},7y:u(R,43,M){v q.26({1d:43},R,M)},26:u(H,R,1v,M){v q.1F(u(){q.2F=6.1z({},H);B 1u=6.R(R,1v,M);P(B p 1x H){B e=1p 6.3b(q,1u,p);7(H[p].1l==3Q)e.2s(e.Q(),H[p]);J e[H[p]](H)}})},1F:u(C,E){7(!E){E=C;C="3b"}v q.K(u(){7(!q.1F)q.1F={};7(!q.1F[C])q.1F[C]=[];q.1F[C].1g(E);7(q.1F[C].I==1)E.14(q)})}});6.1z({R:u(R,1v,E){B 1u=R&&R.1l==7K?R:{1X:E||!E&&1v||6.1t(R)&&R,25:R,1v:E&&1v||1v&&1v.1l!=4w&&1v};1u.25=(1u.25&&1u.25.1l==3Q?1u.25:{7R:7S,7T:5X}[1u.25])||7U;1u.1N=1u.1X;1u.1X=u(){6.6a(q,"3b");7(6.1t(1u.1N))1u.1N.14(q)};v 1u},1v:{},1F:{},6a:u(D,C){C=C||"3b";7(D.1F&&D.1F[C]){D.1F[C].4L();B f=D.1F[C][0];7(f)f.14(D)}},3b:u(D,1e,H){B z=q;B y=D.1q;B 4D=6.1m(D,"1h");y.5T="1G";z.a=u(){7(1e.49)1e.49.14(D,[z.2p]);7(H=="1d")6.1I(y,"1d",z.2p);J 7(6l(z.2p))y[H]=6l(z.2p)+"4S";y.1h="2D"};z.6v=u(){v 4T(6.1m(D,H))};z.Q=u(){B r=4T(6.30(D,H));v r&&r>-8z?r:z.6v()};z.2s=u(4f,43){z.4J=(1p 5o()).5w();z.2p=4f;z.a();z.4q=3L(u(){z.49(4f,43)},13)};z.1L=u(){7(!D.1y)D.1y={};D.1y[H]=q.Q();1e.1L=U;z.2s(0,D.1y[H]);7(H!="1d")y[H]="5a"};z.1K=u(){7(!D.1y)D.1y={};D.1y[H]=q.Q();1e.1K=U;z.2s(D.1y[H],0)};z.3X=u(){7(!D.1y)D.1y={};D.1y[H]=q.Q();7(4D=="1Z"){1e.1L=U;7(H!="1d")y[H]="5a";z.2s(0,D.1y[H])}J{1e.1K=U;z.2s(D.1y[H],0)}};z.49=u(32,47){B t=(1p 5o()).5w();7(t>1e.25+z.4J){4p(z.4q);z.4q=16;z.2p=47;z.a();7(D.2F)D.2F[H]=U;B 2c=U;P(B i 1x D.2F)7(D.2F[i]!==U)2c=12;7(2c){y.5T="";y.1h=4D;7(6.1m(D,"1h")=="1Z")y.1h="2D";7(1e.1K)y.1h="1Z";7(1e.1K||1e.1L)P(B p 1x D.2F)7(p=="1d")6.1I(y,p,D.1y[p]);J y[p]=""}7(2c&&6.1t(1e.1X))1e.1X.14(D)}J{B n=t-q.4J;B p=n/1e.25;z.2p=1e.1v&&6.1v[1e.1v]?6.1v[1e.1v](p,n,32,(47-32),1e.25):((-6h.7O(p*6h.8L)/2)+0.5)*(47-32)+32;z.a()}}}})}',62,545,'||||||jQuery|if|||||||||||||||||||this||||function|return||||||var|type|elem|fn|data|event|prop|length|else|each|ret|callback|xml|value|for|cur|speed|element|undefined|true|url|browser||name|||parentNode|false||apply|status|null|document|indexOf|className|val|firstChild|obj|opacity|options|nodeName|push|display|result|msie|global|constructor|css|test|handler|new|style|arg|expr|isFunction|opt|easing|window|in|orig|extend|arguments|context|typeof|filter|args|queue|hidden|events|attr|re|hide|show|add|old|target|table|token|replace|trigger|num|elems|div|ifModified|complete|key|none|tbody|params|while|string|nodeType|duration|animate|ready|height|timeout|nth|get|done|script|nextSibling|remove|not|index|tb|fix|merge|oid|z0|preventDefault|find|now|grep|pushStack|custom|innerHTML|first|cssFloat|catch|encodeURIComponent|Array|el|guid|sibling|error|block|oldblock|curAnim|try|stopPropagation|childNodes|id|wrap|text|success|safari|load|res|exec|al|_|last|substr|has|disabled|insertBefore|selected|checked|curCSS|map|firstNum|removeChild|re2|trim|getAttribute|onreadystatechange|handlers|on|originalEvent|fx|readyList|parPos|src|opera|param|mozilla|visible|domManip|clean|cloneNode|tr|call|split|XMLHttpRequest|ajaxSettings|append|child|String|empty|ajax|form|button|inArray|multiFilter|setRequestHeader|foundToken|9_|readyState|tag|modRes|responseText|second|ival|handleError|toUpperCase|setInterval|makeArray|slice|break|oWidth|Number|returnValue|lastModified|styleFloat|bind|width|isReady|toggle|jquery|dir|eval|mouseover|select|to|defaultView|position|oHeight|lastNum|async|step|globalEval|static|pos|swap|self|from|end|float|alpha|radio|inv|is|toLowerCase|visibility|00|clearInterval|timer|rec|isTimeout|dataType|_resort|RegExp|Function|getAll|requestDone|parents|matched|isXMLDoc|appendChild|oldDisplay|active|triggered|file|documentElement|fn2|startTime|Modified|shift|lastToggle|deep|handleHover|getResponseHeader|ct|submit|px|parseFloat|html|evalScripts|getComputedStyle|getElementById|clone|els|safariTimer|currentStyle|unload|force|execScript|getPropertyValue|newProp|setTimeout|zoom|getScript|1px|sl|settings|GET|rl|check|_toggle|processData|prepend|before|state|removeAttr|ajaxStart|lt|Date|gt|eq|contentType|previousSibling|after|parent|contains|getTime|checkbox|password|appendTo|image|reset|input|webkit|href|continue|beforeSend|ajaxSend|ownerDocument|getElementsByTagName|tmp|notmodified|parse|ajaxSuccess|ajaxComplete|_prefix|ajaxStop|even|odd|overflow|delete|POST|ajaxError|200|handle|httpSuccess|nodeValue|unshift|__ie_init|srcElement|body|pageX|tagName|clientX|scrollLeft|httpNotModified|dequeue|Last|scrollTop|304|xmlRes|unbind|100|Math|httpData|click|mouseout|parseInt|json|createElement|DOMContentLoaded|prevObject|ol|setArray|exclude|join|one|max|do|relative|clientHeight|clientWidth|loadIfModified|serialize|toString|thead|tfoot|td|th|textContent|ActiveXObject|htmlFor|Microsoft|class|XMLHTTP|readOnly|gi|match|getIfModified|9999|getJSON|getAttributeNode|post|setAttribute|ig|ajaxTimeout|ajaxSetup|concat|application|userAgent|compatible|www|compatMode|CSS1Compat|next|urlencoded|siblings|children|slideDown|prependTo|slideUp|Top|insertAfter|slideToggle|removeAttribute|addClass|removeClass|open|toggleClass|Content|Type|lastChild|If|only|Since|fadeIn|Thu|01|fadeOut|enabled|Jan|1970|fadeTo|GMT|textarea|Requested|With|prev|overrideMimeType|Connection|close|boxModel|right|object|Object|navigator|substring|abort|cos|font|send|slow|600|fast|400|location|protocol|300|pageY|clientY|method|action|cancelBubble|hover|fromElement|toElement|relatedTarget|removeEventListener|blur|readonly|focus|resize|content|scroll|dblclick|mousedown|mouseup|mousemove|responseXML|change|keydown|keypress|keyup|addEventListener|write|prototype|size|scr|ipt|createTextNode|defer|FORM|reverse|noConflict|loaded|10000|weight|line|Bottom|Right|Left|padding|border|Width|offsetHeight|offsetWidth|absolute|PI|left'.split('|'),0,{}))

/* MarcGrabanski.com v2.3 */
/* Pop-Up Calendar Built from Scratch by Marc Grabanski */
/* Enhanced by Keith Wood (kbwood@iprimus.com.au). */
/* Under the Creative Commons Licence http://creativecommons.org/licenses/by/3.0/
	Share or Remix it but please Attribute the authors. */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('w 8={u:j l().y(),p:j l().L(),h:j l().F(),1E:\'3k\',1z:\'2W\',2J:\'&43;3V\',2t:\'3N&3K;\',2i:\'3B\',2a:\'\',U:\'...\',1g:\'\',1B:S,1d:j 1Y(\'2R\',\'4c\',\'47\',\'42\',\'41\',\'3U\',\'3R\'),2y:j 1Y(\'3P\',\'3M\',\'3L\',\'3J\',\'3H\',\'3E\',\'3C\',\'3A\',\'3z\',\'3y\',\'3v\',\'3s\'),E:\'3j/\',25:\'-10:+10\',1f:0,1G:S,x:o,z:o,X:\'2Q\',18:\'1j\',1S:19,1Q:o,2G:g(){4.T=S;4.1t=o;$(\'3T\').2B(\'<C k="17"></C>\');$(2s).3O(8.2q);4.1s=g(a){m=(a.1m&&a.1m.1I()==\'m\'?a:4);f(m.1m.1I()!=\'m\'){m=$(\'../m\',m)[0]}f(8.1t==m){s}8.m=$(m);8.J();8.1t=m;8.2h();8.2f(m,$(\'#17\'));8.15()};4.2d=g(e){f(8.T){f(e.r==9){8.J()}n f(e.r==27){8.J(8.X)}n f(e.r==33){8.v(-1,(e.G?\'Y\':\'M\'))}n f(e.r==34){8.v(+1,(e.G?\'Y\':\'M\'))}n f(e.r==35&&e.G){$(\'#1e\').I()}n f(e.r==36&&e.G){$(\'#1F\').I()}n f(e.r==37&&e.G){8.v(-1,\'D\')}n f(e.r==38&&e.G){8.v(-7,\'D\')}n f(e.r==39&&e.G){8.v(+1,\'D\')}n f(e.r==40&&e.G){8.v(+7,\'D\')}n f(e.r==13){8.1R()}}n f(e.r==36&&e.G){8.1s(4);8.15()}};4.2m=g(e){1a=2V.2U(e.1X==2T?e.r:e.1X);f(1a>\' \'&&1a!=8.E.H(3)&&(1a<\'0\'||1a>\'9\')){s S}s 19}},1U:g(a){w b=$(a);b.2M(\'<1b R="49">\'+4.2a+\'</1b>\');f(4.18==\'1j\'||4.18==\'2H\'){b.1j(4.1s)}f(4.18==\'1v\'||4.18==\'2H\'){b.46(\'<1b R="45"></1b>\').2M(4.1B?\'<1P R="1h" 1O="\'+4.1g+\'" 2F="\'+4.U+\'" 2E="\'+4.U+\'"/>\':\'<1v R="1h">\'+(4.1g!=\'\'?\'<1P 1O="\'+4.1g+\'" 2F="\'+4.U+\'" 2E="\'+4.U+\'"/>\':4.U)+\'</1v>\');$((4.1B?\'1P\':\'1v\')+\'.1h\',b.3Y(\'1b\')).I(4.1s)}b.3X(4.2d).3W(4.2m)},15:g(){4.T=19;t=(4.1S?\'<C k="2C"><a k="1e">\'+4.1E+\'</a>\'+\'<a k="1M">\'+4.1z+\'</a></C>\':\'\')+\'<C k="3S"><a k="2A">\'+4.2J+\'</a>\'+\'<a k="1F">\'+4.2i+\'</a>\'+\'<a k="2z">\'+4.2t+\'</a></C>\'+\'<C k="3Q"><1r k="2x">\';2w=(4.x!=o&&4.x.F()==4.h);2v=(4.z!=o&&4.z.F()==4.h);Q(w a=0;a<12;a++){f(!((2w&&a<4.x.L())||(2v&&a>4.z.L()))){t+=\'<1o 1q="\'+a+\'"\'+(a==4.p?\' 1p="1p"\':\'\')+\'>\'+4.2p(a)+\'</1o>\'}}t+=\'</1r> <1r k="2o">\';K=4.25.2n(\':\');f(K.1J!=2){A=4.h-10;W=4.h+10}n f(K[0].H(0)==\'+\'||K[0].H(0)==\'-\'){A=4.h+P(K[0]);W=4.h+P(K[1])}n{A=P(K[0]);W=P(K[1])}f(4.x!=o){A=1u.3I(A,4.x.F())}f(4.z!=o){W=1u.2l(W,4.z.F())}Q(;A<=W;A++){t+=\'<1o 1q="\'+A+\'"\'+(A==4.h?\' 1p="1p"\':\'\')+\'>\'+A+\'</1o>\'}t+=\'</1r></C>\'+\'<2k k="1l" 3G="0" 3F="0"><2j>\'+\'<1k R="3D">\';Q(w b=0;b<4.1d.1J;b++){t+=\'<11>\'+4.1d[(b+4.1f)%7]+\'</11>\'}t+=\'</1k></2j><1V>\';1y=4.2e(4.h,4.p);4.u=1u.2l(4.u,1y);1x=(4.2c(4.h,4.p)-4.1f+7)%7;N=j l(4.1i,4.1c,4.14);2b=j l(4.h,4.p,4.u);q=j l(4.h,4.p,1-1x);22=1u.3x((1x+1y)/7);V=j l();V=j l(V.F(),V.L(),V.y());Q(w c=0;c<22;c++){t+=\'<1k R="3w">\';Q(w b=0;b<7;b++){1D=(4.1Q==o?[19,\'\']:4.1Q(q));16=(q.L()!=4.p);1C=16||!1D[0]||(4.x!=o&&q<4.x)||(4.z!=o&&q>4.z);t+=\'<11 R="3u\'+((b+4.1f+6)%7>=5?\' 3r\':\'\')+(16?\' 3q\':\'\')+(q.Z()==2b.Z()?\' 1A\':\'\')+(1C?\' 3m\':\'\')+(!16||4.1G?\' \'+1D[1]:\'\')+\'"\'+(q.Z()==N.Z()?\' k="3l"\':(q.Z()==V.Z()?\' k="3i"\':\'\'))+\'>\'+(16?(4.1G?q.y():\'&3n;\'):(1C?q.y():\'<a>\'+q.y()+\'</a>\'))+\'</11>\';q.3o(q.y()+1)}t+=\'</1k>\'}t+=\'</1V></2k><!--[f 3p 3h 6.5]><26 1O="3g:S;" k="3t"></26><![3f]-->\'+(4.1S?\'\':\'<C k="2C"><a k="1e">\'+4.1E+\'</a>\'+\'<a k="1M">\'+4.1z+\'</a></C>\');$(\'#17\').3e().2B(t).3d(4.X);4.m[0].1j();4.29();$(\'#1e\').I(g(){8.24()});$(\'#1M\').I(g(){8.J(8.X)});$(\'#2A\').I(g(){8.v(-1,\'M\')});$(\'#2z\').I(g(){8.v(+1,\'M\')});$(\'#1F\').I(g(){4.14=j l().y();8.u=j l().y();8.p=j l().L();8.h=j l().F();8.15()});$(\'#2x\').28(g(){8.p=4.23[4.2r].1q-0;8.v()});$(\'#2o\').28(g(){8.h=4.23[4.2r].1q-0;8.v()})},29:g(){$(\'#1l 11[a]\').3c(g(){$(4).3b(\'1A\')},g(){$(4).3a(\'1A\')});$(\'#1l a\').I(g(){8.u=$(4).t();8.1R()})},J:g(a){f(4.T){$(\'#17\').31(a);4.T=S;4.1t=o}},1R:g(){4.J(4.X);21=4.2g(4.u,4.p,4.h);4.m.1L(21)},24:g(){4.J(4.X);4.m.1L(\'\')},2q:g(a){f(8.T){O=a.30;20=$(\'#17\')[0];1H(O!=o&&O!=20&&O.2Z!=\'1h\'){O=O.2Y}f(O==o){8.J()}}},2X:g(a){1K=a.1Z();s[!(1K==0||1K==6),\'\']},2g:g(a,b,c){b++;f(b<10)b=\'0\'+b;f(a<10)a=\'0\'+a;w d=\'\';Q(w i=0;i<3;i++){d+=4.E.H(3)+(4.E.H(i)==\'D\'?a:(4.E.H(i)==\'M\'?b:(4.E.H(i)==\'Y\'?c:\'?\')))}s d.2u(1)},2h:g(){N=4.m.1L().2n(4.E.H(3));f(N.1J==3){4.14=P(4.1n(N[4.E.1N(\'D\')]));4.1c=P(4.1n(N[4.E.1N(\'M\')]))-1;4.1i=P(4.1n(N[4.E.1N(\'Y\')]))}n{4.14=j l().y();4.1c=j l().L();4.1i=j l().F()}4.u=4.14;4.p=4.1c;4.h=4.1i;4.v(0,\'D\',19)},1n:g(a){f(a==\'\')s\'\';1H(a.H(0)==\'0\'){a=a.2u(1)}s a},v:g(a,b,c){f(b==\'D\'){4.u=4.u+a}n f(b==\'M\'){4.p=4.p+a}n f(b==\'Y\'){4.h=4.h+a}B=j l(4.h,4.p,4.u);f(4.x!=o){B=(B>4.x?B:4.x)}f(4.z!=o){B=(B<4.z?B:4.z)}4.u=B.y();4.p=B.L();4.h=B.F();f(!c){4.15()}},2p:g(a){s 4.2y[a]},2S:g(a){s 4.1d[a]},2e:g(a,b){s 32-j l(a,b,32).y()},2c:g(a,b){s j l(a,b,1).1Z()},2f:g(a,b){w c=4.1W(a);b.1T(\'2P\',\'3Z\');b.1T(\'2O\',c[0]+\'2D\');b.1T(\'2N\',(c[1]+a.44)+\'2D\')},1W:g(a){w b=1w=0;f(a.2L){b=a.2K;1w=a.2I;1H(a=a.2L){w c=b;b+=a.2K;f(b<0){b=c}1w+=a.2I}}s[b,1w]}};$.4b.1l=g(a){f(a){Q(w b 4a a){8[b]=a[b]}}4.48(g(){f(4.1m.1I()==\'m\'){8.1U(4)}});s 4};$(2s).4d(g(){8.2G()});',62,262,'||||this||||popUpCal|||||||if|function|selectedYear||new|id|Date|input|else|null|selectedMonth|printDate|keyCode|return|html|selectedDay|adjustDate|var|minDate|getDate|maxDate|year|date|div||dateFormat|getFullYear|ctrlKey|charAt|click|hideCalendar|years|getMonth||currentDate|node|parseInt|for|class|false|popUpShowing|buttonText|today|endYear|speed||getTime||td|||currentDay|showCalendar|otherMonth|calendar_div|autoPopUp|true|chr|span|currentMonth|dayNames|calendar_clear|firstDay|buttonImage|calendar_trigger|currentYear|focus|tr|calendar|nodeName|trimNumber|option|selected|value|select|showFunction|lastInput|Math|button|curtop|noPrintDays|daysInMonth|closeText|calendar_daysCellOver|buttonImageOnly|unselectable|customSettings|clearText|calendar_current|showOtherMonths|while|toLowerCase|length|day|val|calendar_close|indexOf|src|img|customDate|selectDate|closeAtTop|css|connectCalendar|tbody|findPos|charCode|Array|getDay|cal|setVal|numRows|options|clearDate|yearRange|iframe||change|setupDayLinks|appendText|selectedDate|getFirstDayOfMonth|keyDownFunction|getDaysInMonth|setPos|formatDate|setDateFromField|currentText|thead|table|min|keyPressFunction|split|calendar_newYear|getMonthName|checkExternalClick|selectedIndex|document|nextText|substring|inMaxYear|inMinYear|calendar_newMonth|monthNames|calendar_next|calendar_prev|append|calendar_control|px|title|alt|init|both|offsetTop|prevText|offsetLeft|offsetParent|after|top|left|position|medium|Su|getDayName|undefined|fromCharCode|String|Close|noWeekends|parentNode|className|target|hide|||||||||removeClass|addClass|hover|show|empty|endif|javascript|IE|calendar_today|DMY|Clear|calendar_currentDay|calendar_unselectable|nbsp|setDate|lte|calendar_otherMonth|calendar_weekEndCell|December|calendar_cover|calendar_daysCell|November|calendar_daysRow|ceil|October|September|August|Today|July|calendar_titleRow|June|cellspacing|cellpadding|May|max|April|gt|March|February|Next|mousedown|January|calendar_header|Sa|calendar_links|body|Fr|Prev|keypress|keydown|parent|absolute||Th|We|lt|offsetHeight|calendar_wrap|wrap|Tu|each|calendar_append|in|fn|Mo|ready'.split('|'),0,{}))

jQuery.noConflict();

// JavaScript Document
var isIE=document.uniqueID;
String.prototype.trim = function() {
    //skip leading and trailing whitespace
    //and return everything in between
    var x=this;
    x=x.replace(/^\s*(.*)/, "$1");
    x=x.replace(/(.*?)\s*$/, "$1");
    return x;
};
function XhtmlToDOMParser(xml){
    var xmlTagName=xml.tagName.toLowerCase();
    var contextNode=document.getElementById(xml.getAttribute("contextNodeID"));
    this.startParsing = function(){
    switch (xmlTagName) {
        case "taconite-append-as-children":
            getReplaceChildren(contextNode,xml,false);
            break;
        case "taconite-delete":
            getDelete(contextNode,xml);
            break;
        case "taconite-append-as-first-child":
            getAppendAsFirstChild(contextNode,xml);
            break;
        case "taconite-insert-after":
            getInsertAfter(contextNode,xml);
            break;
        case "taconite-insert-before":
            getInsertBefore(contextNode,xml);
            break;
        case "taconite-replace-children":
            getReplaceChildren(contextNode,xml,true);
            break;
        case "taconite-replace":
            getReplace(contextNode,xml);
            break;
        case "taconite-set-attributes":
            xml.removeAttribute("contextNodeID");
            xml.removeAttribute("parseInBrowser");
            handleAttributes(contextNode,xml);
            break;
        }
};

    function isInlineMode(node) {
        var attrType;
        if(!node.tagName.toLowerCase() == "input") {
            return false;
        }
		attrType=node.getAttribute("type");

        if(attrType=="radio" || attrType=="checkbox") {
            return true;
        }
		return false;
    }
    this.getJavaScript= function() {
        return "var dummy_taconite_variable=0";
    };
        function handleNode(xmlNode){
                var nodeType = xmlNode.nodeType;
                switch(nodeType) {
                        case 1:  //ELEMENT_NODE
                           return handleElement(xmlNode);
                        case 3:  //TEXT_NODE
			case 4:  //CDATA_SECTION_NODE
                           return document.createTextNode(xmlNode.nodeValue);
                }
                return null;
        }
        function handleElement(xmlNode){
                var domElemNode=null;
				var xmlNodeTagName=xmlNode.tagName.toLowerCase();
                if(isIE){
				if(isInlineMode(xmlNode)) {
                                    return document.createElement("<INPUT " + handleAttributes(domElemNode,xmlNode,true) + ">");
                                }
					if(xmlNodeTagName == "style"){
						//In internet explorer, we have to use styleSheets array.
						var text,rulesArray,styleSheetPtr;
						var regExp = /\s+/g;
						text=xmlNode.text.replace(regExp, " ");
						rulesArray=text.split("}");

						domElemNode=document.createElement("style");
						styleSheetPtr=document.styleSheets[document.styleSheets.length-1];
						for(var i=0;i<rulesArray.length;i++){
							rulesArray[i]=rulesArray[i].trim();
							var rulePart=rulesArray[i].split("{");
							if(rulePart.length==2) {//Add only if the rule is valid
								styleSheetPtr.addRule(rulePart[0],rulePart[1],-1);//Append at the end of stylesheet.
                                                        }
						}
						return domElemNode;
					}

                }
                if(domElemNode == null){
                        domElemNode=document.createElement(xmlNodeTagName);
                        handleAttributes(domElemNode,xmlNode);
                        //Fix for IE Script tag: Unexpected call to method or property access error
                        //IE don't allow script tag to have child
                        if(isIE && !domElemNode.canHaveChildren){
                                if(xmlNode.childNodes.length > 0){
                                    domElemNode.text=xmlNode.text;
                                }

                        }
                        else{
                                for(var z = 0; z < xmlNode.childNodes.length; z++) {
                                   var domChildNode=handleNode(xmlNode.childNodes[z]);
                                   if(domChildNode!=null) {
                                                domElemNode.appendChild(domChildNode);
                                   }
                                }
                        }
                }

                return domElemNode;
        }
        function handleAttributes(domNode,xmlNode) {
                var attr = null;
                var attrString = "";
                var name = "";
                var value = "";
                var returnAsText=false;
                if(arguments.length==3) {
                    returnAsText = true;
                }

                for(var x = 0; x < xmlNode.attributes.length; x++) {
                        attr = xmlNode.attributes[x];
                        name = attr.name.trim();
                        value = attr.value.trim();
                        if(!returnAsText){
                                if(name == "style") {
                                        /* IE workaround */
                                        domNode.style.cssText=value;
                                        /* Standards compliant */
                                        domNode.setAttribute(name,value);
                                }
                                else if(name.trim().toLowerCase().substring(0, 2) == "on") {
                                        /* IE workaround for event handlers */
                                        //domNode.setAttribute(name,value);
                                        eval("domNode." + name.trim().toLowerCase() + "=function(){" + value + "}");
                                }
                                else {
                                        /* Standards compliant */
                                        domNode.setAttribute(name,value);

                                }
                                        /* class attribute workaround for IE */
                                if(name == "class") {
                                        domNode.setAttribute("className",value);
                                }
                        }else{
                                attrString = attrString + name + "=\"" + value + "\" " ;
                        }
                }
                return attrString;
        }
    function getAppendAsFirstChild(domNode,xml){
                var firstNode=null;
                if(domNode.childNodes.length > 0) {
                        firstNode=domNode.childNodes[0];
                }

                for(var i=0;i<xml.childNodes.length;i++){
                        domChildNode=handleNode(xml.childNodes[i]);
                        if(domChildNode!=null){
                                if(firstNode==null){
                                        domNode.appendChild(domChildNode);
                                        firstNode=domChildNode;
                                }
                                else {
                                        domNode.insertBefore(domChildNode,firstNode);
                                }

                        }
                }
        }

        function getInsertAfter(domNode,xml){
                var domChildNode=null;
                var nextSibling=domNode.nextSibling;
                for(var i=0;i<xml.childNodes.length;i++){
                        domChildNode=handleNode(xml.childNodes[i]);
						if(domChildNode!=null){
	                        if(nextSibling!=null) {
                                    domNode.parentNode.insertBefore(domChildNode,nextSibling);
                                }
        	                else {
                                    domNode.parentNode.appendChild(domChildNode);
                                }
                            }
                }
        }
        function getInsertBefore(domNode,xml){
                var domChildNode=null;
                for(var i=0;i<xml.childNodes.length;i++){
                        domChildNode=handleNode(xml.childNodes[i]);
                        if(domChildNode!=null) {
                                domNode.parentNode.insertBefore(domChildNode,domNode);
                        }
                }
        }
        function getReplace(domNode,xml){
                if (domNode != null){
                    getInsertAfter(domNode,xml);
                    domNode.parentNode.removeChild(domNode);
                }
        }
        function getDelete(domNode) {
                if (domNode != null) domNode.parentNode.removeChild(domNode);
        }
        function getReplaceChildren(domNode,xml,doRemoveChildren) {
                var domChildNode=null;
                if(doRemoveChildren){
                        while(contextNode.childNodes.length >0){
                                contextNode.removeChild(contextNode.childNodes[0]);
                        }
                }
                for(var i=0;i<xml.childNodes.length;i++){
                        domChildNode=handleNode(xml.childNodes[i]);
                        if(domChildNode!=null) {
                                domNode.appendChild(domChildNode);
                        }
                }
        }

}




/**
    @fileoverview
    This JavaScript file represents the core browser-side functionality
    supplied by Taconite. In general, the tools in this file wrap an instance
    of XMLHttpRequest object and provide utility methods for gather data from
    form elements to be sent to the server as par of an Ajax request.
*/

/**
    Constructor for the AjaxRequest class.

    <br><br>
    Example:

    <br><br>
    var ajaxRequest = new AjaxRequest("YOUR_URL");

    @class The AjaxRequest object wraps an instance of XMLHttpRequest and provides
    facilities for setting functions that are called before a request is made
    and after a request returns. By default, AjaxRequest handles the server
    response by simply calling eval(), passing to it the responseText from
    the XMLHttpRequestObject, of course assuming that the response was
    generated by Taconite on the server side and that running eval() will
    update the web page.<br><br>Example Usage:<br><br>var ajaxRequest = new AjaxRequest("YOUR_URL");
    <br>ajaxRequest.addFormElements("form_element_id_attribute_value");
    <br>ajaxRequest.sendRequest();

    @constructor
    @param {String} a String repesenting the URL to which the Ajax request
    will be sent.
*/
function AjaxRequest(url) {
    /** @private */
    var self = this;

    /** @private */
    var xmlHttp = createXMLHttpRequest();

    /** @private */
    var queryString = "";

    /** @private */
    var requestURL = url;

    /** @private */
    var method = "GET";

    /** @private */
    var preRequest = null;

    /** @private */
    var postRequest = null;

    /** @private */
    var debugResponse = false;

    /** @private */
    var async = true;

    /** @private errorHandler*/
    var errorHandler = null;


    /**
        Return the instance of the XMLHttpRequest object wrapped by this object.
        @return XMLHttpRequest
    */
    this.getXMLHttpRequestObject = function() {
        return xmlHttp;
    }

    /**
        Set the pre-request function. This function will be called prior to
        sending the Ajax request. The pre-request function is passed a reference
        to this object.
        @param {Function} The function to be called prior to sending the Ajax
        request. The function is passed a refernce of this object.
    */
    this.setPreRequest = function(func) {
        preRequest = func;
    }

    /**
        Set the post-request function. This function will be called after the
        response has been received and after eval() has been called using the
        XMLHttpRequest object's responseText. The post-request function is passed
        a reference to this object.
        @param {Function} The function to be called after receiving the Ajax
        response. The function is passed a refernce of this object.
    */
    this.setPostRequest = function(func) {
        postRequest = func;
    }

    /**
        Send the Ajax request using the POST method. Use with caution -- some
        browsers do not support the POST method with the XMLHttpRequest object.
    */
    this.setUsePOST = function() {
        method = "POST";
    }

    /**
        Send the Ajax request using the GET method, where parameters are sent
        as a query string appended to the URL. This is the default behavior.
    */
    this.setUseGET = function() {
        method = "GET";
    }

    /**
        Enable client-side debugging.  The server's response will be written
        to a text area appended to the bottom of the page.  If parsing is
        performed on the client side, then the results of the parsing operations
        are shown in their own text areas.
    */
    this.setEchoDebugInfo = function() {
        debugResponse = true;
    }

    /**
        Indicate if debugging is enabled.
        @return boolean
    */
    this.isEchoDebugInfo = function() {
        return debugResponse;
    }

    /**
        Set the query string that will be sent to the server. For GET
        requests, the query string is appended to the URL. For POST
        requests, the query string is sent in the request body. This
        method is useful, for example, if you want to send an XML string
        or JSON string to the server.
        @param {String} qa, the new query string value.
    */
    this.setQueryString = function(qs) {
        queryString = qs;
    }

    /**
        Return the query string.
        @return The query string.
    */
    this.getQueryString = function() {
        return queryString;
    }

    /**
        @param {Boolean} asyncBoolean, set to true if asynchronous request, false synchronous request.
    */
    this.setAsync = function(asyncBoolean){
            async = asyncBoolean;
    }

    /**
        @param {Function} Set the error handler function that is called if the
        server's HTTP response code is something other than 200.
    */
    this.setErrorHandler = function(func){
        errorHandler = func;
    }

    /**
        Add all of the form elements under the specified form to the query
        string to be sent to the server as part of the Ajax request. The values
        are automatically encoded.
        @param {String} formID, the value of the id attribute of the form from
        which you wish to accumulate the form values.
    */
    this.addFormElements = function(formID) {
        var formElements = document.getElementById(formID).elements;
        var values = toQueryString(formElements);
        accumulateQueryString(values);
    }

    /** @private */
    function accumulateQueryString(newValues) {
        if(queryString == "") {
            queryString = newValues;
        }
        else {
            queryString = queryString + "&" +  newValues;
        }
    }




   /**
        Same as addNamedFormElements, except it will filter form elements by form's id.
        For example, these are all valid uses:<br>
        <br>ajaxRequest.addNamedFormElements("form-id""element-name-1");
        <br>ajaxRequest.addNamedFormElements("form-id","element-name-1",
        "element-name-2", "element-name-3");
    */
    this.addNamedFormElementsByFormID = function() {
        var elementName = "";
        var namedElements = null;

        for(var i = 1; i < arguments.length; i++) {
            elementName = arguments[i];
            namedElements = document.getElementsByName(elementName);
            var arNamedElements = new Array();
            for(j = 0; j < namedElements.length; j++) {
                if(namedElements[j].form  && namedElements[j].form.getAttribute("id") == arguments[0]){
                    arNamedElements.push(namedElements[j]);
                }
            }
            if(arNamedElements.length > 0){
                elementValues = toQueryString(arNamedElements);
	        accumulateQueryString(elementValues);
            }
        }
    }








    /**
        Add the values of the named form elements to the query string to be
        sent to the server as part of the Ajax request. This method takes any
        number of Strings representing the form elements for wish you wish to
        accumulate the values. The Strings must be the value of the element's
        name attribute.<br><br>For example, these are all valid uses:<br>
        <br>ajaxRequest.addNamedFormElements("element-name-1");
        <br>ajaxRequest.addNamedFormElements("element-name-1", "element-name-2", "element-name-3");
    */
    this.addNamedFormElements = function() {
        var elementName = "";
        var namedElements = null;

        for(var i = 0; i < arguments.length; i++) {
            elementName = arguments[i];
            namedElements = document.getElementsByName(elementName);

            elementValues = toQueryString(namedElements);

            accumulateQueryString(elementValues);
        }

    }

    /**
        Add the values of the id'd form elements to the query string to be
        sent to the server as part of the Ajax request. This method takes any
        number of Strings representing the ids of the form elements for wish you wish to
        accumulate the values. The Strings must be the value of the element's
        name attribute.<br><br>For example, these are all valid uses:<br>
        <br>ajaxRequest.addFormElementsById("element-id-1");
        <br>ajaxRequest.addFormElementsById("element-id-1", "element-id-2", "element-id-3");
    */
    this.addFormElementsById = function() {
        var id = "";
        var element = null;
        var elements = new Array();

        for(var h = 0; h < arguments.length; h++) {
            element = document.getElementById(arguments[h]);
            if(element != null) {
                elements[h] = element;
            }
        }

        elementValues = toQueryString(elements);
        accumulateQueryString(elementValues);
    }

    /**
        Send the Ajax request.
    */
    this.sendRequest = function() {
        if(preRequest) {
            preRequest(self);
        }

        var obj = this;

        xmlHttp.onreadystatechange = function () { handleStateChange(self) };

        if(requestURL.indexOf("?") > 0) {
            requestURL = requestURL + "&ts=" + new Date().getTime();
        }
        else {
            requestURL = requestURL + "?ts=" + new Date().getTime();
        }


        if(method == "GET") {
            if(queryString.length > 0) {
                requestURL = requestURL + "&" + queryString;
            }
            xmlHttp.open(method, requestURL, true);
            xmlHttp.send(null);
        }
        else {
            //Fix a bug in Firefox when posting
            //if (xmlHttp.overrideMimeType) {
            //    xmlHttp.setRequestHeader("Connection", "close");
            //}
            xmlHttp.open(method, requestURL, true);
            xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            xmlHttp.send(queryString);
        }

        if(!async) {  //synchronous request, handle the state change
            handleStateChange(self);
        }

        if(self.isEchoDebugInfo()) {
            echoRequestParams();
        }
    }

    handleStateChange = function(ajaxRequest) {
        if(ajaxRequest.getXMLHttpRequestObject().readyState != 4) {
            return;
        }
        if(ajaxRequest.getXMLHttpRequestObject().status == 200) {

            var debug = ajaxRequest.isEchoDebugInfo();
            if(debug) {
                echoResponse(ajaxRequest);
            }

            var nodes = ajaxRequest.getXMLHttpRequestObject().responseXML.documentElement.childNodes;
            var parser = null;
            var parseInBrowser = "";
            for(var i = 0; i < nodes.length; i++) {
                if(nodes[i].nodeType != 1 || !isTaconiteTag(nodes[i])) {
                    continue;
                }

                parseInBrowser = nodes[i].getAttribute("parseInBrowser");
                if(parseInBrowser == "true") {
                    parser = new XhtmlToDOMParser(nodes[i]);
                    parser.startParsing();
                    var js = parser.getJavaScript();
                    if(debug) {
                        echoParsedJavaScript(js);
                    }
                    eval(parser.getJavaScript());
                }
                else {
                    eval(nodes[i].firstChild.nodeValue);
                }
            }

            if(postRequest) {
                postRequest(ajaxRequest);
            }
        }
        else {
            if(errorHandler) {
                errorHandler(self);
            }
        }
    }

    /** @private */
    function isTaconiteTag(node) {
        return node.tagName.substring(0, 9) == "taconite-";
    }

    /** @private */
    function toQueryString(elements) {
        var node = null;
        var qs = "";
        var name = "";

        var tempString = "";
        for(var i = 0; i < elements.length; i++) {
            tempString = "";
            node = elements[i];
            name = node.getAttribute("name");

            //use id if name is null
            if (!name) {
            	name = node.getAttribute("id");
            }

            if(node.tagName.toLowerCase() == "input") {
                if(node.type.toLowerCase() == "radio" || node.type.toLowerCase() == "checkbox") {
                    if(node.checked) {
                        tempString = name + "=" + node.value;
                    }
                }

                if(node.type.toLowerCase() == "text" || node.type.toLowerCase() == "hidden") {
                    tempString = name + "=" + encodeURIComponent(node.value);
                }
            }
            else if(node.tagName.toLowerCase() == "select") {
                tempString = getSelectedOptions(node);
            }

            else if(node.tagName.toLowerCase() == "textarea") {
                tempString = name + "=" + encodeURIComponent(node.value);
            }

            if(tempString != "") {
                if(qs == "") {
                    qs = tempString;
                }
                else {
                    qs = qs + "&" + tempString;
                }
            }

        }

        return qs;

    }

    /** @private */
    function getSelectedOptions(select) {
        var options = select.options;
        var option = null;
        var qs = "";
        var tempString = "";

        for(var x = 0; x < options.length; x++) {
            tempString = "";
            option = options[x];

            if(option.selected) {
                tempString = select.name + "=" + option.value;
            }

            if(tempString != "") {
                if(qs == "") {
                    qs = tempString;
                }
                else {
                    qs = qs + "&" + tempString;
                }
            }
        }

        return qs;
    }

    /** @private */
    function echoResponse(ajaxRequest) {
        var echoTextArea = document.getElementById("debugResponse");
        if(echoTextArea == null) {
            echoTextArea = createDebugTextArea("Server Response:", "debugResponse");
        }
        var debugText = ajaxRequest.getXMLHttpRequestObject().status
            + " " + ajaxRequest.getXMLHttpRequestObject().statusText + "\n\n\n";
        echoTextArea.value = debugText + ajaxRequest.getXMLHttpRequestObject().responseText;
    }

    /** @private */
    function echoParsedJavaScript(js) {
        var echoTextArea = document.getElementById("debugParsedJavaScript");
        if(echoTextArea == null) {
            var echoTextArea = createDebugTextArea("Parsed JavaScript (by JavaScript Parser):", "debugParsedJavaScript");
        }
        echoTextArea.value = js;
    }

    /** @private */
    function createDebugTextArea(label, id) {
        echoTextArea = document.createElement("textarea");
        echoTextArea.setAttribute("id", id);
        echoTextArea.setAttribute("rows", "15");
        echoTextArea.setAttribute("style", "width:100%");
        echoTextArea.style.cssText = "width:100%";

        document.getElementsByTagName("body")[0].appendChild(document.createTextNode(label));
        document.getElementsByTagName("body")[0].appendChild(echoTextArea);
        return echoTextArea;
    }


    /** @private */
    function echoRequestParams() {
        var qsTextBox = document.getElementById("qsTextBox");
        if(qsTextBox == null) {
            qsTextBox = createDebugTextBox("Query String:", "qsTextBox");
        }
        qsTextBox.value = queryString;

        var urlTextBox = document.getElementById("urlTextBox");
        if(urlTextBox == null) {
            urlTextBox = createDebugTextBox("URL (Includes query string if GET request):", "urlTextBox");
        }
        urlTextBox.value = requestURL;
    }

    /** @private */
    function createDebugTextBox(label, id) {
        textBox = document.createElement("input");
        textBox.setAttribute("type", "text");
        textBox.setAttribute("id", id);
        textBox.setAttribute("style", "width:100%");
        textBox.style.cssText = "width:100%";

        document.getElementsByTagName("body")[0].appendChild(document.createTextNode(label));
        document.getElementsByTagName("body")[0].appendChild(textBox);
        return textBox;
    }


}

/**
    Create an instance of the XMLHttpRequest object, using the appropriate
    method for the type of browser in which this script is running. For Internet
    Explorer, it's an ActiveX object, for all others it's a native JavaScript
    object.
    @return an instance of the XMLHttpRequest object.
*/
function createXMLHttpRequest() {
    var req = false;
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) {
       	try {
            req = new ActiveXObject("Msxml2.XMLHTTP");
      	}
        catch(e) {
            try {
                req = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch(e) {
                req = false;
            }
        }
    }
    return req;
}

isIE = navigator.appName.indexOf("Microsoft") != -1;
isIE5 = navigator.userAgent.indexOf('MSIE 5.0') > 0;
isIE55 = navigator.userAgent.indexOf('MSIE 5.5') > 0;
isIE70 = navigator.userAgent.indexOf('MSIE 7.0') > 0;


function ylib_Browser()
{
	d=document;
	this.agt=navigator.userAgent.toLowerCase();
	this.major = parseInt(navigator.appVersion);
	this.dom=(d.getElementById)?1:0;
	this.ns=(d.layers);
	this.ns4up=(this.ns && this.major >=4);
	this.ns6=(this.dom&&navigator.appName=="Netscape");
	this.op=(window.opera? 1:0);
	this.ie=(d.all);
	this.ie4=(d.all&&!this.dom)?1:0;
	this.ie4up=(this.ie && this.major >= 4);
	this.ie5=(d.all&&this.dom);
	this.win=((this.agt.indexOf("win")!=-1) || (this.agt.indexOf("16bit")!=-1));
	this.mac=(this.agt.indexOf("mac")!=-1);
};

var oBw = new ylib_Browser();

function ylib_getObj(id,d)
{
	var i,x;  if(!d) d=document;
	if(!(x=d[id])&&d.all) x=d.all[id];
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][id];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=ylib_getObj(id,d.layers[i].document);
	if(!x && document.getElementById) x=document.getElementById(id);
	return x;
};

function ylib_getH(o) { return (oBw.ns)?((o.height)?o.height:o.clip.height):((oBw.op&&typeof o.style.pixelHeight!='undefined')?o.style.pixelHeight:o.offsetHeight); };
function ylib_setH(o,h) { if(o.clip) o.clip.height=h; else if(oBw.op && typeof o.style.pixelHeight != 'undefined') o.style.pixelHeight=h; else o.style.height=h; };
function ylib_getW(o) { return (oBw.ns)?((o.width)?o.width:o.clip.width):((oBw.op&&typeof o.style.pixelWidth!='undefined')?w=o.style.pixelWidth:o.offsetWidth); };
function ylib_setW(o,w) { if(o.clip) o.clip.width=w; else if(oBw.op && typeof o.style.pixelWidth != 'undefined') o.style.pixelWidth=w; else o.style.width=w; };
function ylib_getX(o) { return (oBw.ns)?o.left:((o.style.pixelLeft)?o.style.pixelLeft:o.offsetLeft); };
function ylib_setX(o,x) { if(oBw.ns) o.left=x; else if(typeof o.style.pixelLeft != 'undefined') o.style.pixelLeft=x; else o.style.left=x; };
function ylib_getY(o) { return (oBw.ns)?o.top:((o.style.pixelTop)?o.style.pixelTop:o.offsetTop); };
function ylib_setY(o,y) { if(oBw.ns) o.top=y; else if(typeof o.style.pixelTop != 'undefined') o.style.pixelTop=y; else o.style.top=y; };
function ylib_getPageX(o) { var x=0; if(oBw.ns) x=o.pageX; else { while(eval(o)) { x+=o.offsetLeft; o=o.offsetParent; } } return x; };
function ylib_getPageY(o) { var y=0; if(oBw.ns) y=o.pageY; else { while(eval(o)) { y+=o.offsetTop; o=o.offsetParent; } } return y; };
function ylib_getZ(o) { return (oBw.ns)?o.zIndex:o.style.zIndex; };
function ylib_moveTo(o,x,y) { ylib_setX(o,x);ylib_setY(o,y); };
function ylib_moveBy(o,x,y) { ylib_setX(o,ylib_getPageX(o)+x);ylib_setY(o,ylib_getPageY(o)+y); };
function ylib_setZ(o,z) { if(oBw.ns)o.zIndex=z;else o.style.zIndex=z; };
function ylib_show(o,disp) { (oBw.ns)? '':(!disp)? o.style.display="inline":o.style.display=disp; (oBw.ns)? o.visibility='show':o.style.visibility='visible'; };
function ylib_hide(o,disp) { (oBw.ns)? '':(arguments.length!=2)? o.style.display="none":o.style.display=disp; (oBw.ns)? o.visibility='hide':o.style.visibility='hidden'; };
function ylib_setStyle(o,s,v) { if(oBw.ie5||oBw.dom) eval("o.style."+s+" = '" + v +"'"); };
function ylib_getStyle(o,s) { if(oBw.ie5||oBw.dom) return eval("o.style."+s); };
function ylib_addEvt(o,e,f,c){ if(o.addEventListener)o.addEventListener(e,f,c);else if(o.attachEvent)o.attachEvent("on"+e,f);else eval("o.on"+e+"="+f) };
function ylib_writeHTML(o,h) { if(oBw.ns){var doc=o.document;doc.write(h);doc.close();return false;} if(o.innerHTML)o.innerHTML=h; };

function showDateToEnterCalendar() {
    show_calendar('document.forms[0].elements[\'entity.dateToEnterAsString\']', document.forms[0].elements['entity.dateToEnterAsString'].value)
}

function cancel() {
    window.close();
}

function save() {
    if (validate()) {
        document.forms['websiteForm'].elements['action'].value = 'Save';
        document.forms['websiteForm'].submit();
        return true;
    } else {
        return false;
    }
}

function validate() {
    var missingFields = false;

    refreshFieldStyles();

    if( document.forms['websiteForm'].elements['entity.serviceRequestContactName'].value.trim() == '') {
        document.forms['websiteForm'].elements['entity.serviceRequestContactName'].style.border = '1px solid red';
        missingFields = true;
    }
    if( document.forms['websiteForm'].elements['entity.serviceRequestContactPhone'].value.trim() == '') {
        document.forms['websiteForm'].elements['entity.serviceRequestContactPhone'].style.border = '1px solid red';
        missingFields = true;
    }
    if( document.forms['websiteForm'].elements['entity.serviceRequestContactEmail'].value == '') {
        document.forms['websiteForm'].elements['entity.serviceRequestContactEmail'].style.border = '1px solid red';
        missingFields = true;
    }

    if( document.forms['websiteForm'].elements['entity.serviceRequestContactEmail'].value.indexOf('@') <= 0) {
        document.forms['websiteForm'].elements['entity.serviceRequestContactEmail'].style.border = '1px solid red';
        missingFields = true;
    }

    if( document.forms['websiteForm'].elements['entity.serviceRequestBuilding'].value.trim() == '') {
        document.forms['websiteForm'].elements['entity.serviceRequestBuilding'].style.border = '1px solid red';
        missingFields = true;
    }
     if( document.forms['websiteForm'].elements['entity.dateToEnterAsString'].value.trim() != '' && !checkdate(document.forms['websiteForm'].elements['entity.dateToEnterAsString'].value.trim()) ) {
        document.forms['websiteForm'].elements['entity.dateToEnterAsString'].style.border = '1px solid red';
        missingFields = true;
    }

    if (missingFields) {
        var errorsDiv = document.getElementById('errors');
        errorsDiv.innerHTML = '<span>Make sure you have entered valid information in the required fields(<font color="Red">*</font>).</span>';
        errorsDiv.style.display = 'block';
        return false;
    } else {
        return true;
    }

}

function checkdate(val){
    var validformat = /^\d{2}\/\d{2}\/\d{4}$/ //Basic check for format validity
    if (!validformat.test(val))
        return false;
    else{ //Detailed check for valid date ranges
        var monthfield = val.split("/")[0]
        var dayfield = val.split("/")[1]
        var yearfield = val.split("/")[2]
        var dayobj = new Date(yearfield, monthfield-1, dayfield)
        if ((dayobj.getMonth()+1!=monthfield)||(dayobj.getDate()!=dayfield)||(dayobj.getFullYear()!=yearfield))
            return false;
        else
            return true;
   }
}

function formatPhone(field) {
    //alert(field.value)
    field.value = field.value.replace(' ','');

    var ov = field.value;
    var v = "";
    var x = -1;
    // is this phone number 'escaped' by a leading plus?
    if (0 < ov.length && '+' != ov.charAt(0)) { // format it
        // count number of digits
        var n = 0;
        if ('1' == ov.charAt(0)) {  // skip it
            ov = ov.substring(1, ov.length);
        }
        for (i = 0; i < ov.length; i++) {
            var ch = ov.charAt(i);

            // build up formatted number
            if (ch >= '0' && ch <= '9') {
                if (n == 0) v += "(";
                else if (n == 3) v += ") ";
                else if (n == 6) v += "-";
                v += ch;
                n++;
            }
            // check for extension type section;
            // are spaces, dots, dashes and parentheses the only valid non-digits in a phone number?
            if (! (ch >= '0' && ch <= '9') && ch != ' ' && ch != '-' && ch != '.' && ch != '(' && ch != ')') {
                x = i;
                break;
            }
        }
        // add the extension
        if (x >= 0) v += " " + ov.substring(x, ov.length);
        // if we recognize the number, then format it
        if (n == 10 && v.length <= 40) {
            //alert(v);
            field.value = v
        };
    }
    return true;
}

function formatCurrency(item) {
    var num = item.value;
    num = num.toString().replace(/\$|\,|\./g,'');
    if(isNaN(num))
        num = "0";
    sign = (num == (num = Math.abs(num)));
    num = Math.floor(num*100+0.50000000001);
    cents = num%100;
    num = Math.floor(num/100).toString();
    if(cents<10)
        cents = "0" + cents;

    for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
        num = num.substring(0,num.length-(4*i+3))+','+
    num.substring(num.length-(4*i+3));
    item.value = (((sign)?'':'-') + '$' + num + '.' + cents);
}

function refreshFieldStyles() {
    document.forms['websiteForm'].elements['entity.serviceRequestContactName'].style.border = '';
    document.forms['websiteForm'].elements['entity.serviceRequestContactPhone'].style.border = '';
    document.forms['websiteForm'].elements['entity.serviceRequestContactEmail'].style.border = '';
    document.forms['websiteForm'].elements['entity.serviceRequestBuilding'].style.border = '';
    document.forms['websiteForm'].elements['entity.dateToEnterAsString'].style.border = '1px solid black';
}


//////////////////////////////////////////////////
//	<JavaScript RSS Reader>			//
// 	(c) 2003 Premshree Pillai		//
//	Written on: 07/06/03 (dd/mm/yy)		//
//	http://www.qiksearch.com/		//
//////////////////////////////////////////////////

function readRSS(URI) {
	if(window.ActiveXObject) {
		var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.async=false;
		while(xmlDoc.readyState!=4) document.write('Loading...');
	}
	else if(document.implementation&&document.implementation.createDocument)
		xmlDoc=document.implementation.createDocument("","",null);
	xmlDoc.load(URI);
	items=xmlDoc;

	function verify() {if(xmlDoc.readyState!=4) return false;}

	function formatRSS() {
		var items_count= items.getElementsByTagName('item').length;
		var pubDate=new Array(), date=new Array, link=new Array(), title=new Array(), description=new Array(), guid=new Array();


		if (items_count > 3) {
		    items_count = 3;
		}

		for(var i=0; i<items_count; i++) {
			if(items.getElementsByTagName('item')[i].getElementsByTagName('pubDate').length==1)
				pubDate[i]=items.getElementsByTagName('item')[i].getElementsByTagName('pubDate')[0];
			if(items.getElementsByTagName('item')[i].getElementsByTagName('dc:date').length==1)
				date[i]=items.getElementsByTagName('item')[i].getElementsByTagName('dc:date')[0];
			if(items.getElementsByTagName('item')[i].getElementsByTagName('link').length==1)
				link[i]=items.getElementsByTagName('item')[i].getElementsByTagName('link')[0];
			if(items.getElementsByTagName('item')[i].getElementsByTagName('guid').length==1)
				guid[i]=items.getElementsByTagName('item')[i].getElementsByTagName('guid')[0];
			if(items.getElementsByTagName('item')[i].getElementsByTagName('title').length==1)
				title[i]=items.getElementsByTagName('item')[i].getElementsByTagName('title')[0];
			if(items.getElementsByTagName('item')[i].getElementsByTagName('description').length==1)
				description[i]=items.getElementsByTagName('item')[i].getElementsByTagName('description')[0];
		}

		if((description.length==0)&&(title.length==0)) return false;

		//document.write('<html><head><title>'+xmlDoc.getElementsByTagName('title')[0].firstChild.nodeValue+'</title></head><body>');
		//document.write('<span style="font-family:verdana,arial,helvetica; font-size:8pt">');
		//document.write('<center><a href="rss-reader.htm"><h3>[Go Back]</h3></a></center>');
		//document.write('<center><a href="'+xmlDoc.getElementsByTagName('link')[0].firstChild.nodeValue+'"><h2>'+xmlDoc.getElementsByTagName('description')[0].firstChild.nodeValue+'</h2></a></center>');
		document.write('<ul>');
		var ws=/\S/;

		for(var i=0; i<items_count; i++) {
			var pubDate_w, title_w, link_w;
			pubDate_w=(pubDate.length>0)?pubDate[i].firstChild.nodeValue:"<i>Date NA</i>";
			if(document.all)
				title_w=(title.length>0)?title[i].text:"<i>Untitled</i>";
			else
				title_w=(title.length>0)?title[i].firstChild.nodeValue:"<i>Untitled</i>";

			link_w=(link.length>0)?link[i].firstChild.nodeValue:"";
			if(link.length==0) link_w=(guid.length>0)?guid[i].firstChild.nodeValue:"";
			if(title.length>0) title_w=(!ws.test(title_w))?"<i>Untitled</i>":title_w;
			if(pubDate.length==0) pubDate_w=(date.length>0)?date[i].firstChild.nodeValue:"<i>Date NA</i>";
			document.write('<li><a href="'+link_w+'"><b>'+title_w+'</b></a> </li>');
			//if(description.length>0)
				//document.write('<font size="-1">'+description[i].firstChild.nodeValue+'</font><hr noshade><br />');
		}
		document.write('</ul>');
		//document.write('</span></body></html>');
	}

	if(typeof(xmlDoc)!="undefined") {
		if(window.ActiveXObject) formatRSS();
		else xmlDoc.onload=formatRSS;
	}
}

function checkString() {
	var loc=document.location.href.split("?")
	if(loc.length>1) {
		URI=loc[1].split("=");
		if(URI.length>1) {
			var retURI="";
			for(var i=1; i<URI.length; i++) retURI+=URI[i];
			try {readRSS(unescape(retURI));}
			catch(e) {}
		}
	}
}

function hideAllSelectsFromIE() {
    if (isIE) {
        for(var i=0; i < document.forms.length; i++) {
            for(var k=0; k < document.forms[i].elements.length; k++) {
                if (document.forms[i].elements[k].type == 'select-one' ||
                    document.forms[i].elements[k].type == 'select-multiple') {
                    document.forms[i].elements[k].style.visibility = 'hidden';
                }
            }
        }
    }
}
/*
var myrules = {
    'table.list tr' : function(element) {
        var bgcolor = element.style.backgroundColor;
        element.onmouseover = function(){
            if (this.marked2Delete != true && this.marked2Add != true && this.isSelected != true) {
                this.style.backgroundColor = '#F8F8F7';
            }
        }
        element.onmouseout = function() {
            if (this.marked2Delete != true && this.marked2Add != true && this.isSelected != true) {
                this.style.backgroundColor = bgcolor;
            }
        }
    }

};
Behaviour.register(myrules);
*/

function AjaxAction(actionFormName, actionURL) {
    var formName = actionFormName;
    var url = actionURL;
    var debug = false;
    var usePost = false;
    var async = true;

    this.setAction = function( action ) {
        document.forms[formName].action.value = action;
        return this;
    }

    this.setUsePost = function() {
        this.usePost = true;
        return this;
    }

    this.setAsync = function (pAsync) {
        this.async = pAsync;
        return this;
    }

    this.send = function() {
        try {
            document.forms[formName].ajaxMode.value = true;
            var ajaxRequest = new AjaxRequest(url);
            if (this.debug) ajaxRequest.setEchoDebugInfo();
            ajaxRequest.addFormElementsById(formName +'.action');
            ajaxRequest.addFormElementsById(formName +'.ajaxMode');

            if (document.getElementById(formName +'.entityID') != null) {
                ajaxRequest.addFormElementsById(formName +'.entityID');
            }

            for ( i = 0; i < arguments.length; i++){
                ajaxRequest.addFormElementsById(arguments[i]);
            }
            ajaxRequest.setAsync(this.async);
            ajaxRequest.sendRequest();
        } catch (e)  {
            this.handleAjaxException(e);
        }
    }

    this.sendArray = function(arg) {
        try {
            document.forms[formName].ajaxMode.value = true;
            var ajaxRequest = new AjaxRequest(url);
            if (this.debug) ajaxRequest.setEchoDebugInfo();
            ajaxRequest.addFormElementsById(formName +'.action');
            ajaxRequest.addFormElementsById(formName +'.ajaxMode');
            for ( i = 0; i < arg.length; i++){
                var elemId = arg[i];
                ajaxRequest.addFormElementsById(elemId);
            }
            ajaxRequest.setAsync(this.async);
            ajaxRequest.sendRequest();
        } catch (e)  {
            this.handleAjaxException(e);
        }
    }

    this.sendAll = function() {
/*
        try {
*/
            document.forms[formName].ajaxMode.value = true;
            var ajaxRequest = new AjaxRequest(url);
            if (this.debug) ajaxRequest.setEchoDebugInfo();
            if (this.usePost) ajaxRequest.setUsePOST();
            ajaxRequest.addFormElements(formName);
            ajaxRequest.setAsync(this.async);
            ajaxRequest.sendRequest();
/*
        } catch (e)  {
            this.handleAjaxException(e);
        }
*/
    }

    this.handleAjaxException = function(e) {
        alert('Error:' + e);
    }
}

var guestAjaxAction = new AjaxAction('guestCardForm', '/pw/marketing/website.do');

function newGuest(sid, uid) {
    document.location.href = '/pw/marketing/website.do?action=ca&sid='+sid+'&uid='+uid;
}
function newApplication(sid, uid) {
    document.location.href = '/pw/marketing/website.do?action=ta&sid='+sid+'&uid='+uid;
}

function cancelGuest() {
    guestAjaxAction.setAction('cg').sendAll();
}

function saveGuest() {
    guestAjaxAction.setAction('sg').sendAll();
}

function showMask() {
    var oMask = document.getElementById('popupMask');
    if (oMask == null) {
        oMask = document.createElement("div");
        oMask.setAttribute("id", "popupMask");
        document.getElementById("theBody").appendChild(oMask);
    }

    var fullHeight = ylib_getH(document.getElementById('content')) + 1000;
    var fullWidth = ylib_getW(document.getElementById('content'));

    //alert(fullHeight+","+ fullWidth);

    var theBody = document.documentElement;

    var scTop = parseInt(theBody.scrollTop,10);
    var scLeft = parseInt(theBody.scrollLeft,10);

    oMask.style.height = fullHeight + "px";
    //oMask.style.width = fullWidth + "px";
    oMask.style.top = scTop + "px";
    oMask.style.left = scLeft + "px";
    if(oMask!=null) {
        oMask.style.display = "block";
    }
    hideAllSelectsFromIE();
    showWait();
    //playSound('open');
}

function hideMask() {
    var oMask = document.getElementById('popupMask');
    if(oMask!=null) {
        oMask.style.display = "none";
    }
    showAllSelectsFromIE();
    hideWait();
    //killAllCalendars();
    //playSound('close');
}

function showWait() {
    var oGlobalWaiting = document.getElementById('globalWaiting');
    if (oGlobalWaiting == null) {
        oGlobalWaiting = document.createElement("div");
        oGlobalWaiting.setAttribute("id", "globalWaiting");
        oGlobalWaiting.setAttribute("class", "pleaseWaitBubble");


        var oImg = document.createElement("img");
        oImg.setAttribute("alt", "Please wait...");
        oImg.setAttribute("align", "middle");
        oImg.setAttribute("src", "/pw/images/loadingAnimation2.gif");

        oGlobalWaiting.appendChild(oImg)

        document.getElementById("theBody").appendChild(oGlobalWaiting);
    }
    showElement('globalWaiting');
    windowCentered('globalWaiting', 0, 0, false);
}

function hideWait() {
    hideElement('globalWaiting');
}

function showElement(elementID) {
    if (document.getElementById(elementID))
        document.getElementById(elementID).style.display = 'block';
}
function hideElement(elementID) {
    if (document.getElementById(elementID))
        document.getElementById(elementID).style.display = 'none';
}

function showAllSelectsFromIE() {
    if (isIE) {
        for(var i=0; i < document.forms.length; i++) {
            for(var k=0; k < document.forms[i].elements.length; k++) {
                if (document.forms[i].elements[k].type == 'select-one' ||
                    document.forms[i].elements[k].type == 'select-multiple') {
                    document.forms[i].elements[k].style.visibility = 'visible';
                }
            }
        }
    }
}

function windowCentered() {

    var hide = arguments[3];
    if (hide == null){
        hide = true;
    }

    var htmlID = arguments[0];
    var xOffset = 0;
    var yOffset = 0;
    if (arguments.length > 1) {
        xOffset = arguments[1];
    }
    if (arguments.length > 2) {
        yOffset = arguments[2];
    }

    var theTop = 0;

    if (document.documentElement && document.documentElement.scrollTop)
        theTop = document.documentElement.scrollTop;
    else if (document.body)
        theTop = document.body.scrollTop;

    var obj =  document.getElementById(htmlID);
    if (obj != null) {
        obj.style.left = ((ylib_getW(document.body) - ylib_getW(obj)) / 2) + xOffset;
        var zTop = theTop + (getWindowHeight() - ylib_getH(obj)) / 2;
        if (zTop < 0) {
            zTop = 0;
        }
        if (zTop + yOffset < 0) {
            obj.style.top = 0;
        } else {
            obj.style.top = zTop + yOffset;
        }
//        alert(obj.style.top  );
    }

    if (hide){
        hideWait();
    }

}

function popUp(url, popupWidth, popupHeight) {
    var x, y;
    if(!document.all) {
        x = window.screenX + 400 - (popupWidth/2);
        y = window.screenY + 300 - (popupHeight/2);
    } else {
        x = window.screenLeft + 400 - (popupWidth/2);
        y = window.screenTop + 300 - (popupHeight/2);
        y = y - 65    //IE does not include the top bars of the window in the screenTop value.
    }
    y = y - 16;       //account for the top bar of the popup
    var win = window.open(url, '', 'menubar=yes,toolbar=yes,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width='+popupWidth+',height='+popupHeight+',screenX='+x+',screenY='+y+',top='+y+',left='+x);
    //win.focus();
}


function init() {
    jQuery('input.date').calendar({dateFormat : 'MDY/', yearRange: '1907:2017'});
}
jQuery(document).ready(function() {init();});

function showElement(elementID) {
    if (document.getElementById(elementID))
        document.getElementById(elementID).style.display = 'block';
}

function showTBodyElement(o) {
    if (o != null) {
        if (isIE) {
            o.style.display = 'block';
        } else {
            o.style.display = 'table-row-group';
        }
    }
}

function showTHeadElement(o) {
    if (o != null) {
        if (isIE) {
            o.style.display = 'block';
        } else {
            o.style.display = 'table-header-group';
        }
    }
}

function showTFootElement(o) {
    if (o != null) {
        if (isIE) {
            o.style.display = 'block';
        } else {
            o.style.display = 'table-footer-group';
        }
    }
}

function hideElement(elementID) {
    if (document.getElementById(elementID))
        document.getElementById(elementID).style.display = 'none';
}

function showTable(elementID) {
    if (document.getElementById(elementID))
        document.getElementById(elementID).style.display = '';
}

function hideTable(elementID) {
    if (document.getElementById(elementID))
        document.getElementById(elementID).style.display = 'none';
}

function isHidden(elementID) {
    //alert(document.getElementById(elementID).style.display);
    if (document.getElementById(elementID))
        return document.getElementById(elementID).style.display == 'none';
}

function toggleElement(elementID) {
    if (isHidden(elementID)) {
        showElement(elementID);
        return true;
    } else {
        hideElement(elementID);
        return false;
    }
}

function zoom( index, imageID ) {

	var oThumbTable =  document.getElementById('thumbnail_' + index);
	var oZoomDiv =  document.getElementById('imageZoom');

	var oldSrc = document.getElementById('thumbnailIMG_'+index).src;
	var newSrc = oldSrc.substring(0, oldSrc.indexOf("=") + 1) + imageID;

	document.getElementById('imageZoomIMG').src = newSrc;
	showElement('imageZoom');
    verticallyCentered('imageZoom');

}

function verticallyCentered(htmlID) {
    var theTop = 0;
    if (document.documentElement && document.documentElement.scrollTop)
        theTop = document.documentElement.scrollTop;
    else if (document.body)
        theTop = document.body.scrollTop;

    var obj =  document.getElementById(htmlID);
    obj.style.top = theTop + (getWindowHeight() - ylib_getH(obj)) / 2;

}

function getWindowHeight()  {
    return window.innerHeight? window.innerHeight:document.body.clientHeight;
}

function getURLParam( name ) {
    name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
    var regexS = "[\\?&]"+name+"=([^&#]*)";
    var regex = new RegExp( regexS );
    var results = regex.exec( window.location.href );
    if( results == null )
        return "";
    else
        return unescape(results[1].replace(/\+/g,  " "));
}

function createXMLHttpRequest() {
    var req = false;
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) {
        try {
            req = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch(e) {
            try {
                req = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch(e) {
                req = false;
            }
        }
    }
    return req;
}

var apiReq = createXMLHttpRequest();

function outputBuildings(buildings, serverUrl) {
    if (serverUrl == null) serverUrl = "";
    var oResultDiv = document.getElementById('result');
    if (oResultDiv != null) {
        var oTable = document.createElement("table");
        oTable.setAttribute("class", "list");
        oTable.setAttribute("width", "90%");
        oTable.setAttribute("border", "0");
        oTable.setAttribute("cellpadding", "2");
        oTable.setAttribute("cellspacing", "0");
        oResultDiv.appendChild(oTable);
        var oTBody = document.createElement("tbody");
        oTable.appendChild(oTBody);
        for (i =0; i < buildings.length; i ++) {
            var oRow = document.createElement("tr");
            oRow.setAttribute("class", "Row_"+(i%2));
            oRow.setAttribute("className", "Row_"+(i%2));
            oTBody.appendChild(oRow);
            var oCell = document.createElement("td");
            oRow.appendChild(oCell);

            // Div 1
            var oDiv1 = document.createElement("div");
            oDiv1.setAttribute("class", "column_1");
            oCell.appendChild(oDiv1);
            var oPropertyImageDiv = document.createElement("div");
            oPropertyImageDiv.setAttribute("class", "PropertyImage");
            oPropertyImageDiv.setAttribute("className", "PropertyImage");
            if (buildings[i].image != null) {
                oPropertyImageDiv.innerHTML = '<span><img id="featuredImage" name="featuredImage" border="0" src="'+serverUrl+'/pw/marketing/imageService.do?iid='+buildings[i].image+'"/></span>';
            } else {
                oPropertyImageDiv.innerHTML = '<span><img id="featuredImage" name="featuredImage" border="0" src="'+serverUrl+'/pw/images/no-photo-thumbnail.gif"/></span>';
            }
            oDiv1.appendChild(oPropertyImageDiv);
            oDiv1.appendChild(document.createElement('br'));


            // Div 2
            var oDiv2 = document.createElement("div");
            oDiv2.setAttribute("class", "column_2");
            oDiv2.setAttribute("className", "column_2");
            oCell.appendChild(oDiv2);
            var oPriceRangeDiv = document.createElement("div");
            oPriceRangeDiv.setAttribute("class", "PriceRange");
            oPriceRangeDiv.setAttribute("className", "PriceRange");
            oDiv2.appendChild(oPriceRangeDiv);
            oPriceRangeDiv.appendChild(document.createElement("br"));
            oPriceRangeDiv.appendChild(document.createTextNode("From " + buildings[i].startingRent));
            var oUnitTypes = document.createElement("div");
            oUnitTypes.setAttribute("class", "UnitTypes");
            oUnitTypes.setAttribute("className", "UnitTypes");
            oDiv2.appendChild(oUnitTypes);
            oUnitTypes.appendChild(document.createTextNode(buildings[i].unitTypes));

            // Div 3
            var oDiv3 = document.createElement("div");
            oDiv3.setAttribute("class", "column_3");
            oDiv3.setAttribute("className", "column_3");
            oCell.appendChild(oDiv3);
            var oBuildingAddressDiv = document.createElement("div");
            oBuildingAddressDiv.setAttribute("class", "BuildingAddress");
            oBuildingAddressDiv.setAttribute("className", "BuildingAddress");
            oDiv3.appendChild(oBuildingAddressDiv);
            oBuildingAddressDiv.innerHTML = '<strong class="BuildingName"><a class="link" href="building.html?bid='+buildings[i].id+'">'+buildings[i].marketingName+'</a></strong>';
            oBuildingAddressDiv.appendChild(document.createElement("br"));
            oBuildingAddressDiv.appendChild(document.createTextNode(buildings[i].address));
            oBuildingAddressDiv.appendChild(document.createElement("br"));
            oBuildingAddressDiv.appendChild(document.createTextNode(buildings[i].city + ", "));
            oBuildingAddressDiv.appendChild(document.createTextNode(buildings[i].state + " "));
            oBuildingAddressDiv.appendChild(document.createTextNode(buildings[i].zip));
            if (buildings[i].neighborhood != null && buildings[i].neighborhood != '') {
                var bold = document.createElement("b");
                bold.appendChild(document.createTextNode("Neighborhood: "));
                oDiv3.appendChild(bold);
                oDiv3.appendChild(document.createTextNode(buildings[i].neighborhood));
            }
            var oMapLink = document.createElement("div");;
            oMapLink.setAttribute("class", "MapLink");
            oMapLink.setAttribute("className", "MapLink");
            oDiv3.appendChild(oMapLink);
            oMapLink.innerHTML ='<a class="button mapButton" href="javascript:popUp(\'http://maps.google.com/maps?q='+buildings[i].address+'%20'+buildings[i].city+'%20'+buildings[i].state+'%20'+buildings[i].zip+'\', 800, 600)"><b><b><b>Map &amp; Directions</b></b></b></a>';


            // Div 4
            var oDiv4 = document.createElement("div");
            oDiv4.setAttribute("class", "column_4");
            oDiv4.setAttribute("className", "column_4");
            oCell.appendChild(oDiv4);
            oDiv4.innerHTML = '<a class="button moreInfoButton" href="building.html?bid='+buildings[i].id+'"><b><b><b>More Info</b></b></b></a>';

            // Div 5
            var oDiv5 = document.createElement("div");
            oDiv5.setAttribute("class", "column_5");
            oDiv5.setAttribute("className", "column_5");
            oCell.appendChild(oDiv5);
            oDiv5.innerHTML = '<p class="ListingDescription">'+buildings[i].comments+'</p>';

        }

    }
}
function outputErrors() {
    var myJSONtext = getURLParam("err");
    if (myJSONtext != null && myJSONtext != '') {
        var result = eval('(' + myJSONtext + ')');
        if (result != null & result != '' && result.errors != null) {
            var oErrorsDiv  = document.getElementById('errors');
            var oH2 = document.createElement("h2");
            oH2.appendChild(document.createTextNode("You must correct the following: "));
            oErrorsDiv.appendChild(oH2);
            var oUl = document.createElement("ul");
            for(i = 0; i < result.errors.length; i++) {
                oUl.innerHTML = oUl.innerHTML + result.errors[i];
            }
            oErrorsDiv.appendChild(oUl);
        }
    }
}



function validateTenantApplication() {
    var errors = "You must correct the following errors: \n\n";
    var isValid = true;
    if (document.forms["tenantApplicationForm"].elements["webform.prospect.contact.firstName"].value == "") {
        errors += "\n\t* First Name is required";
        document.forms["tenantApplicationForm"].elements["webform.prospect.contact.firstName"].style.border = "3px solid red"
        isValid = false;
    }
    if (document.forms["tenantApplicationForm"].elements["webform.prospect.contact.lastName"].value == "") {
        errors += "\n\t* Last Name is required";
        document.forms["tenantApplicationForm"].elements["webform.prospect.contact.lastName"].style.border = "3px solid red"
        isValid = false;
    }
    if (document.forms["tenantApplicationForm"].elements["webform.prospect.contact.email"].value == "") {
        errors += "\n\t* Email is required";
        document.forms["tenantApplicationForm"].elements["webform.prospect.contact.email"].style.border = "3px solid red"
        isValid = false;
    }
    if (document.forms["tenantApplicationForm"].elements["webform.prospect.contact.mobilePhone"].value == "") {
        errors += "\n\t* Mobile Phone is required";
        document.forms["tenantApplicationForm"].elements["webform.prospect.contact.mobilePhone"].style.border = "3px solid red"
        isValid = false;
    }
    if (document.forms["tenantApplicationForm"].elements["webform.prospect.contact.homePhone"].value == "") {
        errors += "\n\t* Home Phone is required";
        document.forms["tenantApplicationForm"].elements["webform.prospect.contact.homePhone"].style.border = "3px solid red"
        isValid = false;
    }
    if (document.forms["tenantApplicationForm"].elements["webform.prospect.application.birthDateAsString"].value == "") {
        errors += "\n\t* Birth Date is required";
        document.forms["tenantApplicationForm"].elements["webform.prospect.application.birthDateAsString"].style.border = "3px solid red"
        isValid = false;
    }
    if (document.forms["tenantApplicationForm"].elements["webform.prospect.application.rentalHistoryAddress"].value == "") {
        errors += "\n\t* Residence/Rental History Address is required";
        document.forms["tenantApplicationForm"].elements["webform.prospect.application.rentalHistoryAddress"].style.border = "3px solid red"
        isValid = false;
    }
    if (document.forms["tenantApplicationForm"].elements["webform.prospect.application.rentalHistoryCity"].value == "") {
        errors += "\n\t* Residence/Rental History City is required";
        document.forms["tenantApplicationForm"].elements["webform.prospect.application.rentalHistoryCity"].style.border = "3px solid red"
        isValid = false;
    }
    if (document.forms["tenantApplicationForm"].elements["webform.prospect.application.rentalHistoryZip"].value == "") {
        errors += "\n\t* Residence/Rental History Zip is required";
        document.forms["tenantApplicationForm"].elements["webform.prospect.application.rentalHistoryZip"].style.border = "3px solid red"
        isValid = false;
    }
    if (document.forms["tenantApplicationForm"].elements["webform.prospect.application.referencesName1"].value == "") {
        errors += "\n\t* Reference #1 Name is required";
        document.forms["tenantApplicationForm"].elements["webform.prospect.application.referencesName1"].style.border = "3px solid red"
        isValid = false;
    }
    if (document.forms["tenantApplicationForm"].elements["webform.prospect.application.referencesPhone1"].value == "") {
        errors += "\n\t* Reference #1 Phone is required";
        document.forms["tenantApplicationForm"].elements["webform.prospect.application.referencesPhone1"].style.border = "3px solid red"
        isValid = false;
    }
    if (!document.forms["tenantApplicationForm"].elements["webform.applicationAgreementAccepted"].checked) {
        errors += "\n\t* You must check I Agree";
        document.forms["tenantApplicationForm"].elements["webform.applicationAgreementAccepted"].style.backgroundColor = "red"
        isValid = false;
    }




    if (!isValid) {
        alert(errors);
    } else {
        if(getURLParam('uid') != null && document.forms["tenantApplicationForm"].uid != null) {
            document.forms["tenantApplicationForm"].uid.value = getURLParam('uid');
        }
        document.forms["tenantApplicationForm"].action = PW_WEBSITE_ACTION + "?action=SubmitForm";
        document.forms["tenantApplicationForm"].retUrl.value = PW_WEBSITE_ACTION_RETURN_URL;
        document.forms["tenantApplicationForm"].sid.value =  PW_SID;
    }


    return isValid;
}

function validateContactAgent() {
    var errors = "You must correct the following errors: \n\n";
    var isValid = true;
    if (document.forms["guestCardForm"].elements["webform.guest.contact.firstName"].value == "") {
        errors += "\n\t* First Name is required";
        document.forms["guestCardForm"].elements["webform.guest.contact.firstName"].style.border = "3px solid red"
        isValid = false;
    }
    if (document.forms["guestCardForm"].elements["webform.guest.contact.lastName"].value == "") {
        errors += "\n\t* Last Name is required";
        document.forms["guestCardForm"].elements["webform.guest.contact.lastName"].style.border = "3px solid red"
        isValid = false;
    }
    if (document.forms["guestCardForm"].elements["webform.guest.contact.email"].value == "") {
        errors += "\n\t* Email is required";
        document.forms["guestCardForm"].elements["webform.guest.contact.email"].style.border = "3px solid red"
        isValid = false;
    }
    if (document.forms["guestCardForm"].elements["webform.guest.contact.workPhone"].value == "") {
        errors += "\n\t* Day Phone is required";
        document.forms["guestCardForm"].elements["webform.guest.contact.workPhone"].style.border = "3px solid red"
        isValid = false;
    }
    if (document.forms["guestCardForm"].elements["webform.guest.contact.homePhone"].value == "") {
        errors += "\n\t* Eve. Phone is required";
        document.forms["guestCardForm"].elements["webform.guest.contact.homePhone"].style.border = "3px solid red"
        isValid = false;
    }
    if (document.forms["guestCardForm"].elements["webform.guest.cityDesired"].value == "") {
        errors += "\n\t* Which city are you most interested in? is required";
        document.forms["guestCardForm"].elements["webform.guest.cityDesired"].style.border = "3px solid red"
        isValid = false;
    }
    if (document.forms["guestCardForm"].elements["webform.guest.unitTypeDesired"].value == "") {
        errors += "\n\t* Which type of unit are you most interested in? is required";
        document.forms["guestCardForm"].elements["webform.guest.unitTypeDesired"].style.border = "3px solid red"
        isValid = false;
    }
    if (document.forms["guestCardForm"].elements["webform.guest.numberOfOccupants"].value == "" || isNaN(document.forms["guestCardForm"].elements["webform.guest.numberOfOccupants"].value)) {
        errors += "\n\t* How many residents will be occupying the unit? is required";
        document.forms["guestCardForm"].elements["webform.guest.numberOfOccupants"].style.border = "3px solid red"
        isValid = false;
    }
    if (document.forms["guestCardForm"].elements["webform.guest.moveInDateAsString"].value == "") {
        errors += "\n\t* Desired move in date? is required";
        document.forms["guestCardForm"].elements["webform.guest.moveInDateAsString"].style.border = "3px solid red"
        isValid = false;
    }
    if (document.forms["guestCardForm"].elements["webform.guest.externalSource"].value == "") {
        errors += "\n\t* How did you hear about us? is required";
        document.forms["guestCardForm"].elements["webform.guest.externalSource"].style.border = "3px solid red"
        isValid = false;
    }


    if (!isValid) {
        alert(errors);
    } else {
        if(getURLParam('uid') != null && document.forms["guestCardForm"].uid != null) {
            document.forms["guestCardForm"].uid.value = getURLParam('uid');
        }
        document.forms["guestCardForm"].action = PW_WEBSITE_ACTION + "?action=SubmitForm";
        document.forms["guestCardForm"].retUrl.value = PW_WEBSITE_ACTION_RETURN_URL;
        document.forms["guestCardForm"].sid.value =  PW_SID;
    }


    return isValid;
}

function validateContactUs() {
    var errors = "You must correct the following errors: \n\n";
    var isValid = true;
    if (document.forms["contactUsForm"].elements["webform.contact.contact.firstName"].value == "") {
        errors += "\n\t* First Name is required";
        document.forms["contactUsForm"].elements["webform.contact.contact.firstName"].style.border = "3px solid red"
        isValid = false;
    }
    if (document.forms["contactUsForm"].elements["webform.contact.contact.lastName"].value == "") {
        errors += "\n\t* Last Name is required";
        document.forms["contactUsForm"].elements["webform.contact.contact.lastName"].style.border = "3px solid red"
        isValid = false;
    }
    if (document.forms["contactUsForm"].elements["webform.contact.contact.email"].value == "") {
        errors += "\n\t* Email is required";
        document.forms["contactUsForm"].elements["webform.contact.contact.email"].style.border = "3px solid red"
        isValid = false;
    }


    if (!isValid) {
        alert(errors);
    } else {
        if(getURLParam('uid') != null && document.forms["contactUsForm"].uid != null) {
            document.forms["contactUsForm"].uid.value = getURLParam('uid');
        }
        document.forms["contactUsForm"].action = PW_WEBSITE_ACTION + '?action=SubmitForm';
        document.forms["contactUsForm"].retUrl.value = PW_WEBSITE_ACTION_RETURN_URL;
        document.forms["contactUsForm"].sid.value =  PW_SID;
    }


    return isValid;
}
/* =========================================================

// jquery.innerfade.js

// Datum: 2007-01-29
// Firma: Medienfreunde Hofmann & Baldes GbR
// Autor: Torsten Baldes
// Mail: t.baldes@medienfreunde.com
// Web: http://medienfreunde.com

// based on the work of Matt Oakes http://portfolio.gizone.co.uk/applications/slideshow/

// ========================================================= */


(function($) {

$.fn.innerfade = function(options) {

	this.each(function(){

		var settings = {
			animationtype: 'fade',
			speed: 'normal',
			timeout: 2000,
			type: 'sequence',
			containerheight: 'auto',
			runningclass: 'innerfade'
		};

		if(options)
			$.extend(settings, options);

		var elements = $(this).children();

		if (elements.length > 1) {

			$(this).css('position', 'relative');

			$(this).css('height', settings.containerheight);
			$(this).addClass(settings.runningclass);

			for ( var i = 0; i < elements.length; i++ ) {
				$(elements[i]).css('z-index', String(elements.length-i)).css('position', 'absolute');
				$(elements[i]).hide();
			};

			if ( settings.type == 'sequence' ) {
				setTimeout(function(){
					$.innerfade.next(elements, settings, 1, 0);
				}, settings.timeout);
				$(elements[0]).show();
			} else if ( settings.type == 'random' ) {
				setTimeout(function(){
					do { current = Math.floor ( Math.random ( ) * ( elements.length ) ); } while ( current == 0 )
					$.innerfade.next(elements, settings, current, 0);
				}, settings.timeout);
				$(elements[0]).show();
			}	else {
				alert('type must either be \'sequence\' or \'random\'');
			}

		}

	});
};


$.innerfade = function() {}
$.innerfade.next = function (elements, settings, current, last) {

	if ( settings.animationtype == 'slide' ) {
		$(elements[last]).slideUp(settings.speed, $(elements[current]).slideDown(settings.speed));
	} else if ( settings.animationtype == 'fade' ) {
		$(elements[last]).fadeOut(settings.speed);
		$(elements[current]).fadeIn(settings.speed);
	} else {
		alert('animationtype must either be \'slide\' or \'fade\'');
	};

	if ( settings.type == 'sequence' ) {
		if ( ( current + 1 ) < elements.length ) {
			current = current + 1;
			last = current - 1;
		} else {
			current = 0;
			last = elements.length - 1;
		};
	}	else if ( settings.type == 'random' ) {
		last = current;
		while (	current == last ) {
			current = Math.floor ( Math.random ( ) * ( elements.length ) );
		};
	}	else {
		alert('type must either be \'sequence\' or \'random\'');
	};
	setTimeout((function(){$.innerfade.next(elements, settings, current, last);}), settings.timeout);
};
})(jQuery);

/*****************/
/* JQUERY onload */
/*****************/

jQuery(document).ready(function() 
{
    	//force table layout to support design
	
/*
	jQuery("#header").after("<table id='main_layout'><tr><td id='left'></td><td id='center'></td><td id='right'><div id='right-images'><br></div></td></tr></table>");
	jQuery("#navigation").appendTo(jQuery("#left"));
	jQuery("#center").append(jQuery("#content"));
*/



	//move quick search '#searchlistings' to start of the header (home page only)
	//add miantenence box (home page only)
/*
  	if(jQuery("BODY.home").length)
	{
		jQuery("#homePageContent").after(jQuery("#searchListings"));
		jQuery("#searchListings").after(jQuery("#home-maint"));

	}	
*/

	//move featured elements around (home page only)
/*
  	if(jQuery("BODY.home").length)
  	{
		jQuery("DIV.featuredListing h2").prependTo(jQuery("DIV.location"));
		jQuery("DIV.featuredListing A.button").appendTo(jQuery("DIV.location"));
		jQuery("DIV.featuredListing A.button").wrap("<p></p>");
	}		
*/

	//fix gallery (rentals page only - bldg/unit)
/*
  	if(jQuery("BODY.rentals").length)
  	{
		//wrap for v-align...
 		jQuery("DIV.Thumbnail IMG").wrap("<div class='thumbnail_align'></div>");

		jQuery("DIV.Thumbnail IMG").each(function(i){
		    this.onload=function(){ImageLoaded(i);};
		});
 	}
*/


	//fix row hover for IE - rentals page
/*
  	if(jQuery("BODY.rentals").length)
	{	
   	   jQuery("TABLE.list tr").hover(
		   function(){jQuery(this).addClass("hover");},
		   function(){jQuery(this).removeClass("hover");});
   	}
	 	
 	
 	if(jQuery("BODY.tenants").length)
 	{
		jQuery("#layoutDiv2").after(jQuery("#layoutDiv1"))   ;
	}
*/


});



/* -= Slideshow standard site license agreement =- */

/*
 * (c) Copyright 2006, Klika, all rights reserved.
 *
 * This JavaScript code (hereafter, the Code) is the
 * property of Klika d.o.o (hereafter, Klika).
 * The Code and this notice may not be modified
 * without express permission of Klika.
 *
 * Klika d.o.o. grants You (hereafter, Licensee) a
 * non-exclusive, perpetual license to include and
 * run this Code in web pages which are hosted on
 * on the registered site. Permission is granted to
 * copy and to host the Code on the registered site.
 * Images that are referenced by the code may be
 * modified or replaced by the Licensee.
 *
 * The Code, and any auxiliary files referenced by the
 * Code, are provided "as is", without warranty of any
 * kind, either explicit or implied. Klika will attempt
 * to provide email support for the use of this code,
 * but is in no way obligated to do so. In no event
 * shall Klika be liable for damages of any sort caused
 * by, or otherwise related to, the use of this Code,
 * even if advised of the possibility of such damage.
 *
 * Email: info at triptracker.net
 * Web:   http://slideshow.triptracker.net
 */

/* This script is licensed to run on the site propertyware.com */

var MESSAGES = {
  "format.date":                     "MM/dd/yyyy",
  "format.time":                     "h:mm a",

  "photoviewer.toolbar.first":       "Go to Start (Home)",
  "photoviewer.toolbar.prev":        "Previous Photo (Left arrow)",
  "photoviewer.toolbar.slideShow":   "Start/Pause Slide Show (Space)",
  "photoviewer.toolbar.next":        "Next Photo (Right arrow)",
  "photoviewer.toolbar.last":        "Go to End (End)",
  "photoviewer.toolbar.email":       "Email Photo",
  "photoviewer.toolbar.permalink":   "Link to Photo",
  "photoviewer.toolbar.close":       "Close (Esc)",
  "photoviewer.email.subject.photo": "Photo",

  "gallery.nophotos":                "No photos",
  "gallery.thumbs.start":            "Start",
  "gallery.thumbs.end":              "End",
  "gallery.toolbar.first":           "First Photo",
  "gallery.toolbar.prev":            "Previous Photo",
  "gallery.toolbar.view":            "View Photo",
  "gallery.toolbar.next":            "Next Photo",
  "gallery.toolbar.last":            "Last Photo",
  "gallery.view.full":               "Maximize Window",
  "gallery.view.photo":              "Show Photo Only",
  "gallery.view.text":               "Show Description Only",
  "gallery.view.close":              "Close Window"
};

var agent=navigator.userAgent.toLowerCase();var IE=(agent.indexOf("msie")!=-1&&agent.indexOf("opera")==-1);var IE7=(agent.indexOf("msie 7")!=-1);var OPERA=(agent.indexOf("opera")!=-1);var SAFARI=(agent.indexOf("safari")!=-1);var FIREFOX=(agent.indexOf("gecko")!=-1);var STRICT_MODE=(document.compatMode=="CSS1Compat");var _DOMAIN=undefined;var GALLERY_W=650;var GALLERY_H=530;if(USE_GOOGLE_MAPS==undefined){var USE_GOOGLE_MAPS=true;}
var USE_OLD_MAPS=!USE_GOOGLE_MAPS;var TESTING=false;var log=getLogger();if(document.location.href.indexOf("#jslog")!=-1)
log.enable();function Logger(){this.enable=loggerEnable;this.clear=loggerClear;this.log=loggerLog;this.debug=loggerDebug;this.info=loggerInfo;this.error=loggerError;var console=undefined;try{console=document.createElement("textarea");console.style.display="none";console.style.position="absolute";console.style.right="2px";console.style.bottom="2px";console.style.width="23em";console.style.height="40em";console.style.fontFamily="monospace";console.style.fontSize="9px";console.style.color="#000000";setOpacity(console,0.7);console.border="1px solid #808080";console.ondblclick=clearLogger;}catch(e){}
this.console=console;this.enabled=false;this.logTimeStart=getTimeMillis();}
function getLogger(){var log=undefined;var win=window;while(log==undefined){try{log=win.document.log;}catch(e){break;}
if(win==win.parent)
break;win=win.parent;}
if(log==undefined){log=new Logger();document.log=log;}
return log;}
function clearLogger(){getLogger().clear();}
function loggerEnable(){if(this.enabled||this.console==undefined)
return;if(window.document.body!=undefined){window.document.body.appendChild(this.console);this.console.style.display="";this.enabled=true;}}
function loggerDebug(msg){this.log("DEBUG",msg);}
function loggerInfo(msg){this.log("INFO",msg);}
function loggerError(msg,e){this.log("ERROR",msg,e);}
function loggerLog(level,msg,e){if(!this.enabled||this.console==undefined)
return;var millis=(getTimeMillis()-this.logTimeStart)+"";while(millis.length<6)
millis+=" ";var m=millis+" ";if(msg!=undefined)
m+=msg+" ";if(e!=undefined)
m+=e.name+": "+e.message;this.console.value+=m+"\n";}
function loggerClear(){if(!this.enabled||this.console==undefined)
return;this.console.value="";}
function getTimeMillis(){var t=new Date();return Date.UTC(t.getFullYear(),t.getMonth(),t.getDay(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds());}
function getEvent(event){return(event!=undefined?event:window.event);}
function preventDefault(event){if(event.preventDefault){event.preventDefault();event.stopPropagation();}else{event.returnValue=false;event.cancelBubble=true;}}
function getEventTarget(event){if(event==undefined)
return undefined;if(event.srcElement!=undefined)
return event.srcElement;else
return event.target;}
function getResponse(url,async,getXML,callback,data){var req=undefined;try{req=new ActiveXObject("Msxml2.XMLHTTP");}catch(e1){try{req=new ActiveXObject("Microsoft.XMLHTTP");}catch(e2){req=new XMLHttpRequest();}}
if(req==undefined){log.error("Failed to initialize XML/HTTP");return undefined;}
req.open("GET",url,async);if(!async){req.send(undefined);if(req.readyState!=4){log.error("Request failed: "+req.readyState);return undefined;}
if(!getXML)
return req.responseText;else
return req.responseXML;}else{pollResponse(req,callback,data);req.send(undefined);return undefined;}}
function pollResponse(req,callback,data){if(req.readyState!=4)
window.setTimeout(function(){pollResponse(req,callback,data);},100);else
callback(req,data);}
function getElementsByTagName(node,tag){if(node==undefined)
return undefined;if(IE){return node.getElementsByTagName(tag);}
if(tag.indexOf(":")!=-1){tag=tag.split(":")[1];}
return node.getElementsByTagNameNS("*",tag);}
function getFirstElementsValue(node,tag){if(node==undefined)
return undefined;var nodes=getElementsByTagName(node,tag);if(nodes.length===0)
return undefined;else
return getElementValue(nodes[0]);}
function getElementValue(node){var i;var val="";for(i=0;i<node.childNodes.length;i++){if(node.childNodes[i].nodeValue!==null)
val+=node.childNodes[i].nodeValue;}
return val;}
function trim(str){if(str==undefined)
return undefined;return str.replace(/^\s*([\s\S]*\S+)\s*$|^\s*$/,'$1');}
function trimToLen(str,len){if(str==undefined){return undefined;}
if(str.length>len){str=str.substring(0,len)+"...";}
return str;}
function getRootWindow(){var win=window;while(win!=undefined){try{if(win===win.parent){break;}else if(win.parent!=undefined&&win.parent.document.location.href.indexOf("/selenium-server/")!=-1){break;}
win=win.parent;}catch(e){win.permissionDenied=true;break;}}
return win;}
function getURLParams(){var i,params=[];var url=window.location.search;if(url==undefined||url.length===0)
return undefined;url=url.substring(1);var namevals=url.replace(/\+/g," ").split("&");for(i=0;i<namevals.length;i++){var name,val;var pos=namevals[i].indexOf("=");if(pos!=-1){name=namevals[i].substring(0,pos);val=unescape(namevals[i].substring(pos+1));}else{name=namevals[i];val=undefined;}
params[name]=val;}
return params;}
function joinLists(list1,list2){var i;var size=0;var result=[];if(list1!=undefined&&list1.length>0){for(i=0;i<list1.length;i++)
result[i]=list1[i];size=list1.length;}
if(list2!=undefined&&list2.length>0){for(i=0;i<list2.length;i++)
result[i+size]=list2[i];}
return result;}
function setCookie(name,value,expire){var expiry=(expire==undefined)?"":("; expires="+expire.toGMTString());document.cookie=name+"="+value+expiry;}
function getCookie(name){if(document.cookie==undefined||document.cookie.length===0)
return undefined;var search=name+"=";var index=document.cookie.indexOf(search);if(index!=-1){index+=search.length;var end=document.cookie.indexOf(";",index);if(end==-1)
end=document.cookie.length;return unescape(document.cookie.substring(index,end));}}
function removeCookie(name){var today=new Date();var expires=new Date();expires.setTime(today.getTime()-1);setCookie(name,"",expires);}
function getMessage(id){if(MESSAGES[id]==undefined){return"("+id+")";}else{return MESSAGES[id];}}
function localizeNodeAttribs(node){var i;if(node==undefined)
return;if(node.alt!=undefined&&node.alt.indexOf("#")===0){node.alt=getMessage(node.alt.substring(1));}
if(node.title!=undefined&&node.title.indexOf("#")===0){node.title=getMessage(node.title.substring(1));}
if(node.childNodes!=undefined){for(i=0;i<node.childNodes.length;i++){localizeNodeAttribs(node.childNodes[i]);}}}
function padNumber(n,pad){n=n+"";while(n.length<pad){n="0"+n;}
return n;}
function isArray(obj){if(obj instanceof Array)
return true;else
return false;}
function simpleDateFormatter(date,pattern){var d=pattern;d=d.replace(/yyyy/g,date.getFullYear());d=d.replace(/yy/g,padNumber(date.getFullYear()%100,2));d=d.replace(/MM/g,padNumber(date.getMonth()+1,2));d=d.replace(/M/g,date.getMonth()+1);d=d.replace(/dd/g,padNumber(date.getDate(),2));d=d.replace(/d/g,date.getDate());d=d.replace(/HH/g,padNumber(date.getHours(),2));d=d.replace(/H/g,date.getHours());d=d.replace(/hh/g,padNumber(date.getHours()%12,2));d=d.replace(/h/g,date.getHours()%12);d=d.replace(/mm/g,padNumber(date.getMinutes(),2));d=d.replace(/m/g,date.getMinutes());d=d.replace(/ss/g,padNumber(date.getSeconds(),2));d=d.replace(/s/g,date.getSeconds());var am=(date.getHours()<12?"AM":"PM");d=d.replace(/a/g,am);return d;}
function formatDateTime(date){if(date==undefined)
return undefined;return formatDate(date)+" "+formatTime(date);}
function formatDate(date){var datePattern=getMessage("format.date");return simpleDateFormatter(date,datePattern);}
function formatTime(date){var timePattern=getMessage("format.time");return simpleDateFormatter(date,timePattern);}
function parseISOTime(strTime){if(strTime==undefined)
return undefined;var isoRE=/^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)(\.\d{3})?([Z+-])?(\d\d)?:?(\d\d)?$/;if(!isoRE.test(strTime)){return undefined;}else{return new Date(RegExp.$1,RegExp.$2-1,RegExp.$3,RegExp.$4,RegExp.$5,RegExp.$6);}}
function setOpacity(elt,opacity){if(IE){elt.style.filter="alpha(opacity="+parseInt(opacity*100)+")";}
elt.style.KhtmlOpacity=opacity;elt.style.opacity=opacity;}
function validCoordinates(lat,lon){if(Math.abs(lat)>90||Math.abs(lon)>180){return false;}
if(lat===0.0&&lon===0.0){return false;}
return true;}
function isHosted(){var host=document.location.host;if(host==undefined)
host="";return true;}
function checkDomain(){try{if(_DOMAIN==undefined)
return false;var protocol=document.location.protocol;if(protocol==undefined)
protocol="http:";var host=document.location.host;if(host==undefined)
host="";host=host.toLowerCase();if(protocol.toLowerCase().indexOf("file")===0){return true;}
var pos=host.lastIndexOf(":");if(pos!=-1){host=host.substring(0,pos);}
if(host.indexOf("www.")===0){host=host.substring(4);}
if(host===""||host=="localhost"||host=="127.0.0.1")
return true;var domain=_DOMAIN.toLowerCase();pos=domain.indexOf("://");if(pos!=-1){domain=domain.substring(pos+3);}
pos=domain.indexOf("/");if(pos!=-1){domain=domain.substring(0,pos);}
if(domain.indexOf("www.")===0){domain=domain.substring(4);}
if(host==domain){return true;}else if(new RegExp(domain).test(host)){return true;}
return false;}catch(e){return true;}}
function getWindowSize(win){var availW=win.innerWidth;if(availW==undefined||availW===0||isNaN(availW))
availW=win.document.documentElement.clientWidth;if(availW==undefined||availW===0||isNaN(availW))
availW=win.document.body.clientWidth;var availH=win.innerHeight;if(availH==undefined||availH===0||isNaN(availH))
availH=win.document.documentElement.clientHeight;if(availH==undefined||availH===0||isNaN(availH))
availH=win.document.body.clientHeight;return{w:availW,h:availH};}
function getDocumentSize(win){var winSize=getWindowSize(win);var scrollPos=getScrollPos(win);var w=winSize.w+scrollPos.left;var h=winSize.h+scrollPos.top;w=Math.max(w,win.document.body.offsetWidth);h=Math.max(h,win.document.body.offsetHeight);w=Math.max(w,win.document.body.scrollWidth);h=Math.max(h,win.document.body.scrollHeight);return{w:w,h:h};}
function getScrollPos(win){var scrollTop=win.pageYOffset;if(scrollTop==undefined||scrollTop===0)
scrollTop=win.document.documentElement.scrollTop;if(scrollTop==undefined||scrollTop===0)
scrollTop=win.document.body.scrollTop;var scrollLeft=win.pageXOffset;if(scrollLeft==undefined||scrollLeft===0)
scrollLeft=win.document.documentElement.scrollLeft;if(scrollLeft==undefined||scrollLeft===0)
scrollLeft=win.document.body.scrollLeft;return{top:scrollTop,left:scrollLeft};}
var CLEAR_EVENTS=["onclick","ondblclick","onkeydown","onkeypress","onmousedown","onmouseup","onmousemove","onmouseover","onmouseout","onmousewheeldown","oncontextmenu"];function clearEvents(){var i,j;var count=0;if(document.all==undefined)
return;for(i=0;i<document.all.length;i++){for(j=0;j<CLEAR_EVENTS.length;j++){var event=document.all[i][CLEAR_EVENTS[j]];if(event!=undefined){document.all[i][CLEAR_EVENTS[j]]=null;count++;}}}}
if(window.attachEvent)
window.attachEvent("onunload",clearEvents);function getGallery(){var gallery=undefined;var win=window;while(gallery==undefined){try{gallery=win.document.gallery;}catch(e){break;}
var tmpWin=win;win=win.parent;if(tmpWin===win){break;}}
return gallery;}
function viewerCloseCallback(photoIndex){var i,j,n=0;var gallery=getGallery();for(i=0;i<gallery.sets.length;i++){for(j=0;j<gallery.sets[i].photos.length;j++){var p=gallery.sets[i].photos[j];if(p==undefined||p.orig==undefined||p.orig.src==undefined)
continue;if(n==photoIndex){gallery.setIndex=i;gallery.photoIndex=j;gallery.renderPhotos();gallery.win.focus();return;}
n++;}}}
var VIEWER_INDEX=0;var SLIDE_DURATION=4000;var SLIDE_OFFSET=50;var SLIDE_PHOTOS=true;var FADE_BORDER=false;var FADE_STEPS=10;var MOVE_STEP=1;var PRELOAD_TIMEOUT=60000;var BORDER_WIDTH=5;var FONT_SIZE=10;var OFFSET_LEFT=0;var OFFSET_TOP=0;var REST_URL="/rest/";var P_IMG_ROOT="http://static.triptracker.net/jsmap/images/photoviewer";var TOOLBAR_IMG="toolbar.png";var TOOLBAR_IMG_RUNNING="toolbar2.png";var TOOLBAR_IMG_BACK="toolbar-back";var TOOLBAR_IMG_MASK="toolbar-mask.png";var TOOLBAR_IMG_LOADING="loading-anim.gif";var TOOLBAR_W=440;var TOOLBAR_H=75;var TOOLBAR_IMG_W=420;var TOOLBAR_IMG_H=44;var TOOLBAR_LINK="http://slideshow.triptracker.net";var TOOLBAR_FONT_COLOR="#c0c0c0";var TOOLBAR_FONT_STYLE="tahoma, verdana, arial, helvetica, sans-serif";var VIEWER_ID_PREFIX="PhotoViewer";var VIEWER_ID_BACK=VIEWER_ID_PREFIX+"Back";var VIEWER_ID_TOOLBAR=VIEWER_ID_PREFIX+"Toolbar";var VIEWER_ID_TOOLBAR_MAP=VIEWER_ID_PREFIX+"ToolbarMap";var VIEWER_ID_TOOLBAR_IMG=VIEWER_ID_PREFIX+"ToolbarImg";var VIEWER_ID_LOADING=VIEWER_ID_PREFIX+"Loading";var VIEWER_ID_TIME=VIEWER_ID_PREFIX+"Time";var VIEWER_ID_TITLE=VIEWER_ID_PREFIX+"Title";var VIEWER_ID_BYLINE=VIEWER_ID_PREFIX+"Byline";var TITLE_MAX_LENGTH=140;function PhotoViewer(win,handleKeys){this.setImageRoot=setImageRoot;this.add=addPhoto;this.show=showPhoto;this.close=closePhoto;this.isShown=isPhotoShown;this.setBackground=setPhotoBackground;this.setShowToolbar=setShowToolbar;this.setToolbarImage=setToolbarImage;this.setShowCallback=setShowCallback;this.setCloseCallback=setCloseCallback;this.setEndCallback=setEndCallback;this.setLoading=setPhotoLoading;this.addBackShade=addBackShade;this.addToolbar=addToolbar;this.addCaptions=addCaptions;this.next=nextPhoto;this.prev=prevPhoto;this.first=firstPhoto;this.last=lastPhoto;this.slideShow=slideShow;this.slideShowStop=slideShowStop;this.startSlideShow=startSlideShow;this.handleKey=viewerHandleKey;this.checkStartFragmentIdentifier=checkStartFragmentIdentifier;this.checkStopFragmentIdentifier=checkStopFragmentIdentifier;this.setStartFragmentIdentifier=setStartFragmentIdentifier;this.setStopFragmentIdentifier=setStopFragmentIdentifier;this.email=emailPhoto;this.favorite=favoritePhoto;this.permalink=linkPhoto;this.setBackgroundColor=setBackgroundColor;this.setBorderWidth=setBorderWidth;this.setSlideDuration=setSlideDuration;this.disablePanning=disablePanning;this.enablePanning=enablePanning;this.disableFading=disableFading;this.enableFading=enableFading;this.disableShade=disableShade;this.enableShade=enableShade;this.setShadeColor=setShadeColor;this.setShadeOpacity=setShadeOpacity;this.setFontSize=setFontSize;this.setFont=setFont;this.enableAutoPlay=enableAutoPlay;this.disableAutoPlay=disableAutoPlay;this.enableEmailLink=enableEmailLink;this.disableEmailLink=disableEmailLink;this.enablePhotoLink=enablePhotoLink;this.disablePhotoLink=disablePhotoLink;this.setOnClickEvent=setOnClickEvent;this.enableLoop=enableLoop;this.disableLoop=disableLoop;this.hideOverlappingElements=hideOverlappingElements;this.showOverlappingElements=showOverlappingElements;this.id=VIEWER_ID_PREFIX+VIEWER_INDEX;VIEWER_INDEX++;this.photos=[];this.index=0;this.win=(win!=undefined?win:window);this.shown=false;this.showToolbar=true;this.backgroundColor="#000000";this.shadeColor="#000000";this.shadeOpacity=0.7;this.borderColor="#000000";this.shadeColor="#000000";this.shadeOpacity=0.7;this.borderWidth=BORDER_WIDTH;this.backgroundShade=true;this.fadePhotos=true;this.autoPlay=false;this.enableEmailLink=true;this.enablePhotoLink=true;this.slideDuration=SLIDE_DURATION;this.panPhotos=SLIDE_PHOTOS;this.fontSize=FONT_SIZE;this.font=undefined;if(handleKeys==undefined||handleKeys){if(this.win.addEventListener){this.win.addEventListener("keydown",viewerHandleKey,false);}else{this.win.document.attachEvent("onkeydown",viewerHandleKey);}}
this.win.document.viewer=this;if(OPERA)
this.disableFading();}
function PhotoImg(id,src,w,h,time,title,byline){this.id=id;this.src=src;this.w=parseInt(w);this.h=parseInt(h);this.time=time;this.title=title;this.byline=byline;}
function getViewer(){var viewer=undefined;var win=window;while(viewer==undefined){try{viewer=win.document.viewer;}catch(e){break;}
if(win===win.parent){break;}
win=win.parent;}
return viewer;}
function setImageRoot(root){P_IMG_ROOT=root;}
function addPhoto(photo,title,time,byline){var type=typeof photo;if(typeof photo=="string"){photo=new PhotoImg(undefined,photo,undefined,undefined,time,title,byline);}
this.photos.push(photo);}
function setPhotoBackground(color,border,doShade){if(color!=undefined)
this.backgroundColor=color;if(border!=undefined)
this.borderColor=border;if(doShade!=undefined)
this.backgroundShade=doShade;}
function setPhotoLoading(isLoading){this.isLoading=isLoading;var elt=this.win.document.getElementById(VIEWER_ID_LOADING);if(elt==undefined)
return;elt.style.display=isLoading?"":"none";}
function setBackgroundColor(color){this.backgroundColor=color;this.borderColor=color;}
function setBorderWidth(width){this.borderWidth=width;}
function setSlideDuration(duration){this.slideDuration=duration;}
function disableShade(){this.backgroundShade=false;}
function enableShade(){this.backgroundShade=true;}
function setShadeColor(color){this.shadeColor=color;}
function setShadeOpacity(opacity){this.shadeOpacity=opacity;}
function disableFading(){this.fadePhotos=false;}
function enableFading(){this.fadePhotos=true;}
function disablePanning(){this.panPhotos=false;}
function enablePanning(){this.panPhotos=true;}
function setFontSize(size){this.fontSize=size;}
function setFont(font){this.font=font;}
function enableAutoPlay(){this.autoPlay=true;}
function disableAutoPlay(){this.autoPlay=false;}
function enableEmailLink(){this.enableEmailLink=true;}
function disableEmailLink(){this.enableEmailLink=false;}
function enablePhotoLink(){this.enablePhotoLink=true;}
function disablePhotoLink(){this.enablePhotoLink=false;}
function setOnClickEvent(newfunc){this.customOnClickEvent=newfunc;}
function enableLoop(){this.loop=true;}
function disableLoop(){this.loop=false;}
function showPhoto(index,cropWidth,opacity){if(this.photos.length===0){return true;}
if(getRootWindow().permissionDenied&&this.badgeMode==undefined){this.setStartFragmentIdentifier(index);return true;}
if(index!=undefined)
this.index=index;if(this.index<0||this.index>=this.photos.length){log.error("Invalid photo index");return true;}
var doc=this.win.document;var firstShow=false;if(!this.shown){firstShow=true;doc.viewer=this;try{this.hideOverlappingElements();}catch(e){}}
var zIndex=16384;var winSize=getWindowSize(this.win);var availW=winSize.w-20;var availH=winSize.h-20;var scrollPos=getScrollPos(this.win);var scrollLeft=scrollPos.left;var scrollTop=scrollPos.top;this.addBackShade(zIndex);if(this.showToolbar){this.addToolbar(availW,zIndex);this.addCaptions();}
var photo=this.photos[this.index];if(isNaN(photo.w)||isNaN(photo.h)){if(photo.preloadImage!=undefined){if(isNaN(photo.w)&&photo.preloadImage.width>0)
photo.w=photo.preloadImage.width;if(isNaN(photo.h)&&photo.preloadImage.height>0)
photo.h=photo.preloadImage.height;}else{this.index--;this.next();return false;}}
this.shown=true;var offset=20;var pw=-1;var ph=-1;if(parseInt(photo.w)>availW||parseInt(photo.h)>availH){if(parseInt(photo.w)/availW>parseInt(photo.h)/availH){pw=availW-offset;ph=parseInt(pw*photo.h/photo.w);}else{ph=availH-offset;pw=parseInt(ph*photo.w/photo.h);}}else{pw=parseInt(photo.w);ph=parseInt(photo.h);}
if(pw<=0||ph<=0){if(!this.showToolbar)
throw"Missing photo dimension";}
if(cropWidth==undefined)
cropWidth=0;var photoDiv=doc.createElement("div");photoDiv.style.visibility="hidden";photoDiv.style.position="absolute";photoDiv.style.zIndex=zIndex;photoDiv.style.overflow="hidden";photoDiv.style.border=this.borderWidth+"px solid "+this.borderColor;photoDiv.style.textAlign="center";photoDiv.style.backgroundColor=this.backgroundColor;var photoElt=doc.createElement("img");photoElt.style.visibility="hidden";photoElt.style.position="relative";photoElt.style.backgroundColor=this.backgroundColor;photoElt.style.border="none";photoElt.style.cursor="pointer";photoElt.style.zIndex=(parseInt(photoDiv.style.zIndex)+1)+"";photoElt.onclick=onClickEvent;if(opacity!=undefined&&this.fadePhotos){var fadeElt=(FADE_BORDER?photoDiv:photoElt);setOpacity(fadeElt,opacity);}
var left=parseInt((availW-pw)/2)+OFFSET_LEFT;photoDiv.style.left=(left+scrollLeft+cropWidth/2)+"px";var top=parseInt((availH-ph)/2)+OFFSET_TOP;photoDiv.style.top=(top+scrollTop)+"px";photoElt.style.visibility="hidden";photoDiv.style.width=(pw-cropWidth)+"px";photoDiv.style.height=ph+"px";photoElt.style.width=pw+"px";photoElt.style.height=ph+"px";photoElt.src=photo.src;photoDiv.style.visibility="visible";photoElt.style.visibility="visible";photoDiv.appendChild(photoElt);doc.body.appendChild(photoDiv);if(this.photoDiv!=undefined){try{doc.body.removeChild(this.photoDiv);}catch(e){}}
this.photoDiv=photoDiv;this.photoImg=photoElt;this.setLoading(false);if(this.showCallback!=undefined)
this.showCallback(this.index);if(firstShow&&this.autoPlay){this.slideShow(true);}
return false;}
function isPhotoShown(){return this.shown;}
function closeViewer(){getViewer().close();}
function onPhotoLoad(event){var viewer=getViewer();if(viewer!=undefined){if(flickrHack(viewer,viewer.index)){viewer.setLoading(false);viewer.index--;viewer.next();return;}
viewer.show();}}
function closePhoto(){var win=this.win;if(win==undefined)
win=window;var doc=win.document;var elt=this.photoDiv;if(elt!=undefined)
doc.body.removeChild(elt);elt=doc.getElementById(VIEWER_ID_BACK);if(elt!=undefined)
doc.body.removeChild(elt);elt=doc.getElementById(VIEWER_ID_TOOLBAR);if(elt!=undefined)
doc.body.removeChild(elt);this.shown=false;this.slideShowRunning=false;this.slideShowPaused=false;try{this.showOverlappingElements();}catch(e){}
if(this.closeCallback!=undefined)
this.closeCallback(this.index);}
function nextPhoto(n){if(this.isLoading)
return;if(n==undefined)
n=1;var oldIndex=this.index;if(this.index+n>=this.photos.length){if(this.loop&&n!=this.photos.length){this.index=0;}else{this.index=this.photos.length-1;}}else if(this.index+n<0){if(n<-1)
this.index=0;else if(this.loop)
this.index=this.photos.length-1;else
return;}else{this.index+=n;}
if(this.index==oldIndex)
return;this.slideShowStop();var img=new Image();this.photos[this.index].preloadImage=img;this.setLoading(true);img.onload=onPhotoLoad;img.onerror=onPhotoLoad;if(this.photos[this.index].src!=undefined){img.src=this.photos[this.index].src;}else{onPhotoLoad();}}
function prevPhoto(n){if(n==undefined)
n=1;this.next(-n);}
function firstPhoto(){this.prev(this.photos.length);}
function lastPhoto(){this.next(this.photos.length);}
function startSlideShow(){getViewer().slideShow(true);}
var slideTimeout;var slidePreloadImageLoaded=false;var slidePreloadTime=undefined;function slideShow(start){var nextIndex=this.index+1;if(nextIndex>=this.photos.length){if(this.loop)
nextIndex=0;else if(!this.slideShowPaused&&!this.slideShowRunning){this.setToolbarImage(P_IMG_ROOT+"/"+TOOLBAR_IMG);return;}}
var doc=this.win.document;var viewer=this;var photoElt=this.photoImg;if(photoElt==undefined)
return;var photoDiv=this.photoDiv;var fadeElt=(FADE_BORDER?photoDiv:photoElt);if(start!=undefined&&start===true){if(this.slideShowPaused){this.slideShowPaused=false;this.setToolbarImage(P_IMG_ROOT+"/"+TOOLBAR_IMG_RUNNING);return;}else if(this.slideShowRunning){this.slideShowPaused=true;this.setToolbarImage(P_IMG_ROOT+"/"+TOOLBAR_IMG);return;}else{this.slideShowRunning=true;this.slideShowPaused=false;this.slideFirstPhoto=true;this.setToolbarImage(P_IMG_ROOT+"/"+TOOLBAR_IMG_RUNNING);}
if(this.isLoading||this.index>=this.photos.length-1){return;}}else if(this.slideShowPaused){window.setTimeout(function(){viewer.slideShow(false);},200);return;}else if(!this.slideShowRunning){this.setToolbarImage(P_IMG_ROOT+"/"+TOOLBAR_IMG);return;}
var left=0;if(photoElt.leftOffset!=undefined){left=parseFloat(photoElt.leftOffset);}
if(left===0){if(nextIndex<this.photos.length){slidePreloadImageLoaded=false;var slidePreloadImage=new Image();this.photos[nextIndex].preloadImage=slidePreloadImage;slidePreloadTime=getTimeMillis();slidePreloadImage.onload=onSlideLoad;slidePreloadImage.onerror=onSlideLoad;slidePreloadImage.src=this.photos[nextIndex].src;}}
if(left>-SLIDE_OFFSET){left-=MOVE_STEP;if(-left<=FADE_STEPS){if(fadeElt.style.opacity!=undefined&&parseFloat(fadeElt.style.opacity)<1){if(this.fadePhotos&&this.photos[this.index].src!=undefined)
setOpacity(fadeElt,-left/FADE_STEPS);}}else if(left+SLIDE_OFFSET<FADE_STEPS){if(nextIndex<this.photos.length&&!slidePreloadImageLoaded){if(slidePreloadTime!=undefined&&getTimeMillis()-slidePreloadTime>PRELOAD_TIMEOUT)
slidePreloadImageLoaded=true;left++;this.setLoading(true);}else{if(nextIndex<this.photos.length&&this.fadePhotos&&this.photos[this.index].src!=undefined)
setOpacity(fadeElt,(left+SLIDE_OFFSET)/FADE_STEPS);}}
photoElt.leftOffset=left;if(this.panPhotos&&!this.slideFirstPhoto){photoElt.style.left=left+"px";}}else{if(nextIndex>=this.photos.length){this.slideShowRunning=false;this.slideShowPaused=false;this.setToolbarImage(P_IMG_ROOT+"/"+TOOLBAR_IMG);if(this.endCallback!=undefined)
this.endCallback();return;}
this.index=nextIndex;this.slideFirstPhoto=false;this.show(undefined,(this.panPhotos?SLIDE_OFFSET:0),0);fadeElt=(FADE_BORDER?this.photoDiv:this.photoImg);if(this.fadePhotos)
setOpacity(fadeElt,0);this.photoImg.leftOffset=0;if(this.panPhotos)
this.photoImg.style.left="0px";}
var pause=this.slideDuration/SLIDE_OFFSET;if(this.slideFirstPhoto){pause/=2;}
slideTimeout=window.setTimeout(function(){viewer.slideShow(false);},pause);}
function onSlideLoad(event){var viewer=getViewer();if(viewer!=undefined){if(flickrHack(viewer,viewer.index+1)){var slidePreloadImage=viewer.photos[viewer.index+1].preloadImage;slidePreloadImage.src=viewer.photos[viewer.index+1].src;slidePreloadTime=getTimeMillis();return;}
slidePreloadImageLoaded=true;viewer.setLoading(false);}}
function slideShowStop(){this.slideShowRunning=false;this.slideShowPaused=false;var doc=this.win.document;var photoElt=this.photoImg;if(photoElt!=undefined){if(this.fadePhotos){var fadeElt=(FADE_BORDER?this.photoDiv:photoElt);setOpacity(fadeElt,1);}
photoElt.style.left="0px";}}
function addBackShade(zIndex){var doc=this.win.document;if(doc.getElementById(VIEWER_ID_BACK)!=undefined){return;}
var photoBack=doc.createElement("div");photoBack.id=VIEWER_ID_BACK;photoBack.style.top="0px";photoBack.style.left="0px";photoBack.style.bottom="0px";photoBack.style.right="0px";photoBack.style.margin="0";photoBack.style.padding="0";photoBack.style.border="none";photoBack.style.cursor="pointer";if(IE&&!(IE7&&STRICT_MODE)){photoBack.style.position="absolute";var docSize=getDocumentSize(this.win);photoBack.style.width=(docSize.w-21)+"px";photoBack.style.height=(docSize.h-4)+"px";}else{photoBack.style.position="fixed";photoBack.style.width="100%";photoBack.style.height="100%";}
photoBack.style.zIndex=zIndex-1;photoBack.style.backgroundColor=this.shadeColor;if(this.backgroundShade)
setOpacity(photoBack,this.shadeOpacity);else
setOpacity(photoBack,0.0);photoBack.onclick=onClickEvent;doc.body.appendChild(photoBack);}
function addToolbar(availW,zIndex){var doc=this.win.document;var i;if(doc.getElementById(VIEWER_ID_TOOLBAR)!=undefined)
return;var photoToolbar=doc.createElement("div");photoToolbar.id=VIEWER_ID_TOOLBAR;var bottom=10;if(IE&&!(IE7&&STRICT_MODE)){photoToolbar.style.position="absolute";if(IE7){var top=getWindowSize(this.win).h+getScrollPos(this.win).top;photoToolbar.style.top=(top-TOOLBAR_H-10)+"px";}else{photoToolbar.style.bottom=bottom+"px";}}else{photoToolbar.style.position="fixed";photoToolbar.style.bottom=bottom+"px";}
photoToolbar.style.left=(availW-TOOLBAR_W+10)/2+"px";photoToolbar.style.width=TOOLBAR_W+"px";photoToolbar.style.height=TOOLBAR_H+"px";photoToolbar.style.textAlign="center";setOpacity(photoToolbar,0.7);photoToolbar.style.zIndex=zIndex+1;var imgBack=TOOLBAR_IMG_BACK;if(!isHosted()){imgBack+="-nologo";}
if(IE&&!IE7){imgBack+="-indexed";}
imgBack+=".png";photoToolbar.style.backgroundImage="url('"+P_IMG_ROOT+"/"+imgBack+"')";photoToolbar.style.backgroundPosition="50% 0%";photoToolbar.style.backgroundRepeat="no-repeat";photoToolbar.style.lineHeight="0.7em";var toolbarMask=undefined;if(!this.enableEmailLink){toolbarMask=doc.createElement("img");toolbarMask.style.position="absolute";toolbarMask.style.width=44;toolbarMask.style.height=44;toolbarMask.style.left="289px";toolbarMask.style.top="0px";toolbarMask.src=P_IMG_ROOT+"/"+TOOLBAR_IMG_MASK;photoToolbar.appendChild(toolbarMask);}
if(!this.enablePhotoLink){toolbarMask=doc.createElement("img");toolbarMask.style.position="absolute";toolbarMask.style.width=44;toolbarMask.style.height=44;toolbarMask.style.left="339px";toolbarMask.style.top="0px";toolbarMask.src=P_IMG_ROOT+"/"+TOOLBAR_IMG_MASK;photoToolbar.appendChild(toolbarMask);}
var imgMap=doc.createElement("map");imgMap.name=VIEWER_ID_TOOLBAR_MAP;imgMap.id=VIEWER_ID_TOOLBAR_MAP;var areas=[];areas.push(["getViewer().first()","17",getMessage("photoviewer.toolbar.first")]);areas.push(["getViewer().prev()","68",getMessage("photoviewer.toolbar.prev")]);areas.push(["getViewer().slideShow(true)","122",getMessage("photoviewer.toolbar.slideShow")]);areas.push(["getViewer().next()","175",getMessage("photoviewer.toolbar.next")]);areas.push(["getViewer().last()","227",getMessage("photoviewer.toolbar.last")]);if(this.enableEmailLink)
areas.push(["getViewer().email()","300",getMessage("photoviewer.toolbar.email")]);if(this.enablePhotoLink)
areas.push(["getViewer().permalink()","350",getMessage("photoviewer.toolbar.permalink")]);areas.push(["getViewer().close()","402",getMessage("photoviewer.toolbar.close")]);for(i=0;i<areas.length;i++){var area=doc.createElement("area");area.href="javascript:void(0)";area.alt=areas[i][2];area.title=area.alt;area.shape="circle";area.coords=areas[i][1]+", 21, 22";area.onclick=buildAreaMapClosure(areas[i][0]);imgMap.appendChild(area);}
var img=doc.createElement("img");img.id=VIEWER_ID_TOOLBAR_IMG;img.src=P_IMG_ROOT+"/"+TOOLBAR_IMG;img.width=TOOLBAR_IMG_W;img.height=TOOLBAR_IMG_H;img.style.border="none";img.style.background="none";if(STRICT_MODE){img.style.margin="4px 0px 0px 0px";}else{img.style.margin="4px";}
img.useMap="#"+VIEWER_ID_TOOLBAR_MAP;photoToolbar.appendChild(imgMap);photoToolbar.appendChild(img);if(isHosted()){var ttLink=doc.createElement("a");ttLink.style.position="absolute";ttLink.style.bottom="0px";ttLink.style.right="0px";ttLink.style.width="25px";ttLink.style.height="25px";ttLink.style.background="none";ttLink.alt="TripTracker.net";ttLink.title=ttLink.alt;ttLink.cursor=ttLink.alt;ttLink.href=TOOLBAR_LINK;ttLink.target="_new";ttLink.alt="TripTracker Slideshow";ttLink.title=ttLink.alt;photoToolbar.appendChild(ttLink);}
var loadingIcon=doc.createElement("img");loadingIcon.id=VIEWER_ID_LOADING;loadingIcon.width=16;loadingIcon.height=16;loadingIcon.style.display="none";loadingIcon.style.position="absolute";loadingIcon.style.left=(273-8)+"px";loadingIcon.style.top=(24-8)+"px";loadingIcon.src=P_IMG_ROOT+"/"+TOOLBAR_IMG_LOADING;loadingIcon.style.border="none";loadingIcon.style.background="none";photoToolbar.appendChild(loadingIcon);photoToolbar.appendChild(doc.createElement("br"));var photoTime=doc.createElement("span");photoTime.id=VIEWER_ID_TIME;photoTime.position="relative";photoTime.style.color=TOOLBAR_FONT_COLOR;photoTime.style.fontFamily=TOOLBAR_FONT_STYLE;photoTime.style.fontSize=this.fontSize+"px";if(STRICT_MODE){photoTime.style.lineHeight=this.fontSize+"px";}
if(this.font!=undefined){photoTime.style.font=this.font;}
photoTime.style.cssFloat="none";photoTime.style.textAlign="right";photoTime.style.padding="0px 10px";photoTime.appendChild(doc.createTextNode(" "));photoToolbar.appendChild(photoTime);var photoTitle=doc.createElement("span");photoTitle.id=VIEWER_ID_TITLE;photoTitle.position="relative";photoTitle.style.color=TOOLBAR_FONT_COLOR;photoTitle.style.fontFamily=TOOLBAR_FONT_STYLE;photoTitle.style.fontSize=this.fontSize+"px";if(STRICT_MODE){photoTitle.style.lineHeight=this.fontSize+"px";}
if(this.font!=undefined){photoTitle.style.font=this.font;}
photoTitle.style.cssFloat="none";photoTitle.style.textAlign="left";photoTitle.style.paddingRight="20px";photoTitle.appendChild(doc.createTextNode(" "));photoToolbar.appendChild(photoTitle);doc.body.appendChild(photoToolbar);var photoByline=doc.createElement("div");photoByline.appendChild(doc.createTextNode(""));photoByline.style.color=TOOLBAR_FONT_COLOR;photoByline.style.fontFamily=TOOLBAR_FONT_STYLE;photoByline.style.fontSize=this.fontSize+"px";if(this.font!=undefined){photoByline.style.font=this.font;}
photoByline.id=VIEWER_ID_BYLINE;photoByline.style.position="absolute";photoByline.style.right="5px";photoByline.style.bottom="5px";photoByline.style.zIndex=zIndex+1;photoByline.appendChild(doc.createTextNode(" "));doc.body.appendChild(photoByline);}
function buildAreaMapClosure(func){return function(event){eval(func);blurElement(event);return false;};}
function blurElement(event){var target=getEventTarget(getEvent(event));if(target!=undefined)
target.blur();}
function setToolbarImage(img){var doc=this.win.document;var elt=doc.getElementById(VIEWER_ID_TOOLBAR_IMG);if(elt!=undefined)
elt.src=img;}
function setShowToolbar(doShow){this.showToolbar=doShow;}
function addCaptions(){var photo=this.photos[this.index];var doc=this.win.document;var photoTime=doc.getElementById(VIEWER_ID_TIME);var photoTitle=doc.getElementById(VIEWER_ID_TITLE);var photoByline=doc.getElementById(VIEWER_ID_BYLINE);var time=(this.index+1)+"/"+this.photos.length;if(photo.time!=undefined){time+=" ["+photo.time+"]";}
photoTime.firstChild.nodeValue=time;var title=(photo.title!=undefined?photo.title:"");photoTitle.title="";photoTitle.alt="";if(title.length>TITLE_MAX_LENGTH){photoTitle.title=title;photoTitle.alt=title;title=title.substring(0,TITLE_MAX_LENGTH)+" ...";}
if(title.indexOf("\n")!==0){title=title.replace("\n","<br />");photoTitle.innerHTML=title;}else{photoTitle.nodeValue=title;}
if(photo.byline!=undefined&&photo.byline.length>0){photoByline.firstChild.nodeValue=photo.byline;}else{photoByline.firstChild.nodeValue="";}}
function setCloseCallback(callback){this.closeCallback=callback;}
function setShowCallback(callback){this.showCallback=callback;}
function setEndCallback(callback){this.endCallback=callback;}
function emailPhoto(){var photo=this.photos[this.index];var doc=this.win.document;var title=(photo.title!=undefined?photo.title:getMessage("photoviewer.email.subject.photo"));var mailtoLink="mailto:?subject="+title+"&body="+
getPhotoURL(photo.src);doc.location.href=mailtoLink;}
function getPhotoURL(url){var loc=document.location;if(/\w+:\/\/.+/.test(url)){return url;}else if(url.indexOf("/")===0){return loc.protocol+"//"+loc.host+url;}else{var path=loc.pathname;var pos=path.lastIndexOf("/");if(pos!=-1){path=path.substring(0,pos);}
return loc.protocol+"//"+loc.host+path+"/"+url;}}
function linkPhoto(){var photo=this.photos[this.index];window.open(photo.src);}
function favoritePhoto(){var photo=this.photos[this.index];var doc=this.win.document;var restURL=REST_URL+"markfeatured?id"+photo.id;try{var res=getResponse(restURL,false,true);}catch(e){return;}}
function hideOverlappingElements(node){if(node==undefined){node=this.win.document.body;this.hideOverlappingElements(node);return;}
if(node.style!=undefined&&node.style.visibility!="hidden"){var nodeName=node.nodeName.toLowerCase();if((node.className!=undefined&&node.className.indexOf("SlideshowDoHide")!=-1)||(IE&&(nodeName=="select"||nodeName=="object"||nodeName=="embed"))){node.style.visibility="hidden";if(this.hiddenElements==undefined)
this.hiddenElements=[];this.hiddenElements.push(node);}}
if(node.childNodes!=undefined){var i;for(i=0;i<node.childNodes.length;i++){this.hideOverlappingElements(node.childNodes[i]);}}}
function showOverlappingElements(){var i;if(this.hiddenElements!=undefined){for(i=0;i<this.hiddenElements.length;i++){this.hiddenElements[i].style.visibility="visible";}
this.hiddenElements=[];}}
function viewerHandleKey(event){if(!getViewer)
return true;var viewer=getViewer();if(viewer==undefined||!viewer.shown)
return true;event=getEvent(event);if(event.ctrlKey||event.altKey)
return true;var keyCode=event.keyCode;switch(keyCode){case 37:case 38:viewer.prev();break;case 39:case 40:viewer.next();break;case 33:viewer.prev(10);break;case 34:viewer.next(10);break;case 36:viewer.first();break;case 35:viewer.last();break;case 32:case 13:viewer.slideShow(true);break;case 27:viewer.close();break;default:return true;}
preventDefault(event);return false;}
function flickrHack(viewer,index){if(viewer.photos[index]!=undefined){var preloadPhoto=viewer.photos[index].preloadImage;if(preloadPhoto!=undefined&&preloadPhoto.width==500&&preloadPhoto.height==375){var flickrRE=/.+static\.flickr\.com.+_b\.jpg/;if(flickrRE.test(preloadPhoto.src)){viewer.photos[index].src=viewer.photos[index].src.replace(/_b\.jpg/,"_o.jpg");return true;}}}
return false;}
function findPhotosTT(viewer,node){var i;if(node.nodeName.toLowerCase()=="a"){var onclick=node.getAttribute("onclick");if(onclick==undefined){onclick=node.onclick;}
if(onclick!=undefined&&new String(onclick).indexOf("popupImg")!=-1){var popupRE=/.*popupImg\((.+?),(.+?),(.+?)\).*/;if(popupRE.test(onclick)){var url,w,h;if(node.photoUrl!=undefined){url=node.photoUrl;w=node.photoW;h=node.photoH;}else{url=RegExp.$1;if(url.charAt(0)=="'"&&url.charAt(url.length-1)=="'")
url=url.substring(1,url.length-1);w=parseInt(RegExp.$2);h=parseInt(RegExp.$3);}
var photo=new PhotoImg(undefined,url,w,h);var found=false;for(i=0;i<viewer.photos.length;i++){if(viewer.photos[i].src==photo.src){found=true;break;}}
if(!found)
viewer.add(photo);}}}
if(node.childNodes!=undefined){for(i=0;i<node.childNodes.length;i++){findPhotosTT(viewer,node.childNodes[i]);}}}
var defaultViewer=undefined;function popupImg(url,w,h,backColor,showToolbar){var i;if(defaultViewer==undefined)
defaultViewer=new PhotoViewer();else{defaultViewer.photos=[];defaultViewer.index=0;}
if(backColor!=undefined)
defaultViewer.setBackground(backColor,backColor,false);if(showToolbar==undefined||showToolbar){findPhotosTT(defaultViewer,window.document.body);for(i=0;i<defaultViewer.photos.length;i++){if(defaultViewer.photos[i].src==url){defaultViewer.show(i);}}}
if(defaultViewer.photos===undefined||defaultViewer.photos.length===0){defaultViewer.setShowToolbar(false);defaultViewer.add(new PhotoImg(undefined,url,w,h));defaultViewer.show();}
return false;}
function onClickEvent()
{var v=getViewer();if(v.customOnClickEvent!=undefined)
v.customOnClickEvent();else
closeViewer();}
function setupFragmentIdentifierModePhotoViewer(iframeLocation,iframename,viewerJSONArray)
{var viewer=new PhotoViewer();viewer.origRootLocation=document.location.href;viewer.origIFrameLocation=iframeLocation;viewer.iframename=iframename;viewer.setCloseCallback(viewer.setStopFragmentIdentifier);for(var i=0;i<viewerJSONArray.length;i++){viewer.add(viewerJSONArray[i].url,viewerJSONArray[i].title,viewerJSONArray[i].date,viewerJSONArray[i].byline);}
window.frames[viewer.iframename].location=viewer.origIFrameLocation+"#"+viewer.origRootLocation;viewer.checkStartFragmentIdentifier();}
function checkStartFragmentIdentifier(){var href=document.location.href;if(href.indexOf("#startphoto=")==-1){window.setTimeout(checkStartFragmentIdentifier,500);}else{var startPhoto=parseInt(href.substring(href.lastIndexOf("=")+1));var viewer=getViewer();if(viewer.origRootLocation.indexOf("#")==-1)
viewer.origRootLocation+="#";if(FIREFOX){window.history.back();}else{document.location.href=viewer.origRootLocation;}
viewer.show(startPhoto);}}
function setStopFragmentIdentifier(index){window.frames[getViewer().iframename].location=this.origIFrameLocation+"#stopphoto="+index;checkStartFragmentIdentifier();}
function setStartFragmentIdentifier(index){var rootWin=getRootWindow();if(this.origIFrameLocation==undefined)
this.origIFrameLocation=rootWin.location.href.substring(0,rootWin.location.href.indexOf("#"));if(this.origRootLocation==undefined)
this.origRootLocation=rootWin.location.href.substring(rootWin.location.href.indexOf("#")+1);this.checkStopFragmentIdentifier();var frIdentifier="#startphoto="+index;rootWin.parent.location=this.origRootLocation+frIdentifier;}
function checkStopFragmentIdentifier(){var href=getRootWindow().location.href;if(href.indexOf("#stopphoto")==-1){window.setTimeout(checkStopFragmentIdentifier,500);}else{var viewer=getViewer();var index=href.substring(href.lastIndexOf("=")+1);if(viewer.origIFrameLocation.indexOf("#")==-1)
viewer.origIFrameLocation+="#";if(FIREFOX){window.history.back();}else{getRootWindow().location.href=viewer.origIFrameLocation;}
viewerCloseCallback(index);}}
_DOMAIN = "propertyware.com";


/**********************************/
/* Gallery Image Loading Callback */
/**********************************/

var loaded_images=new Array();
function ImageLoaded(index)
{
	loaded_images[index]=true;

	for(var i=0;i<jQuery("DIV.Thumbnail IMG").length;i++)
	{
		if(!loaded_images[i]) return;
	}			

	//if loaded, positionbased on height
	//max image height...
	var max_h=0;
	jQuery("DIV.Thumbnail IMG").each(function(i){
		if(this.height>max_h) max_h=this.height+5;
	});
	
	//align images bottom...
	jQuery("DIV.Thumbnail DIV.thumbnail_align").each(function(i){
		this.style.marginTop = max_h-jQuery("DIV.Thumbnail IMG").get(i).height;
	});
}

function getPublishedBuildings() {
    presetSearchForm();
    outputBuildings(result.buildings, 'http://www.propertyware.com');
}

function presetSearchForm() {
    document.forms['searchListings'].city.value = getURLParam('city');
    document.forms['searchListings'].zip.value = getURLParam('zip');
    document.forms['searchListings'].state.value = getURLParam('state');
    document.forms['searchListings'].neighborhood.value = getURLParam('neighborhood');
    document.forms['searchListings'].min.value = getURLParam('min');
    document.forms['searchListings'].max.value = getURLParam('max');
    document.forms['searchListings'].bedrooms.value = getURLParam('bedrooms');
    document.forms['searchListings'].bathrooms.value = getURLParam('bathrooms');
}

function gotoTenantPortal() {
    document.location.href = PW_TENANT_PORTAL_URL;
}

function outputValue( value ) {
    document.write(value?value:"");
}

function outputFeaturedImage(imgElementId, image) {
    var oImage = document.getElementById(imgElementId);
    if (oImage != null && image != null) {
        oImage.src = 'http://www.propertyware.com/pw/marketing/imageService.do?iid='+image;
    }
}

function outputBuildingDetail(containerId, building) {
    if (building != null) {
        if (building.residential == "false" || building.rentable == "false") {
            var oRentableResidentialTBody = document.getElementById('rentableResidentialTBody');
            if (oRentableResidentialTBody != null) {
                oRentableResidentialTBody.parentNode.removeChild(oRentableResidentialTBody);
            }
        }
        if (building.rentable == "false") {
            var oRentableTBody = document.getElementById('rentableTBody');
            if (oRentableTBody != null) {
                oRentableTBody.parentNode.removeChild(oRentableTBody);
            }
        }
        if (building.neighborhood == "") {
            var oNeighborhoodTBody = document.getElementById('neighborhoodTBody');
            if (oNeighborhoodTBody != null) {
                oNeighborhoodTBody.parentNode.removeChild(oRentableTBody);
            }
        }
    }
}

function outputUnitDetail(containerId, unit) {
    if (unit != null) {
        if (unit.residential == "false") {
            var oRentableResidentialTBody = document.getElementById('rentableResidentialTBody');
            if (oRentableResidentialTBody != null) {
                oRentableResidentialTBody.parentNode.removeChild(oRentableResidentialTBody);
            }
        }
    }
}

var viewer = new PhotoViewer();
function outputGallery(containerId, images) {
    var oDiv = document.getElementById(containerId);
    if (images != null && images.length > 0 ) {
        for (i = 0; i < images.length; i++) {
            var image = images[i];
            outputImage(oDiv, image, i);
            viewer.add("http://www.propertyware.com/pw/marketing/imageService.do?iid="+image.originalID);
        }
        
    } else if (oDiv != null && oDiv.parentNode != null) {
        oDiv.parentNode.removeChild(oDiv);
    }
}

function outputImage(oParent, image, index) {
    if (oParent != null && image != null) {
        var oImgDiv = document.createElement("div");
        oImgDiv.setAttribute("class", "Image");
        oImgDiv.setAttribute("id", "thumbnail_" + index);
        oParent.appendChild(oImgDiv);

        var oThumbDiv = document.createElement("div");
        oThumbDiv.setAttribute("class", "Thumbnail");
        oImgDiv.appendChild(oThumbDiv)

        var oImg = document.createElement("img");
        oImg.setAttribute("src", "http://www.propertyware.com/pw/marketing/imageService.do?iid="+image.smallID);
        oImg.setAttribute("id", "thumbnailIMG_" + index);
        oThumbDiv.appendChild(oImg);

        var oImgZoomDiv = document.createElement("div");
        oImgZoomDiv.setAttribute("class", "ImageLink");
        oImgDiv.appendChild(oImgZoomDiv)
        oImgZoomDiv.innerHTML = '<a class="ImageLink" href="javascript:void(viewer.show(0))">Zoom</a>';

    }
}

function outputOtherTenantCharges(containerId, otherTenantCharges) {
    var oDiv = document.getElementById(containerId);
    if (oDiv != null && otherTenantCharges != null && otherTenantCharges != '' ) {
        var oPara = document.createElement("p");
        oPara.appendChild(document.createTextNode(otherTenantCharges));
        oDiv.appendChild(oPara);
        oDiv.appendChild(document.createElement("br"))
    }   else if (oDiv != null && oDiv.parentNode != null) {
        oDiv.parentNode.removeChild(oDiv);
    }
}

function outputLeasingContact(containerId, leasingContact) {
    var oDiv = document.getElementById(containerId);
    if (oDiv != null && leasingContact != null && leasingContact != '' ) {

    }   else if (oDiv != null && oDiv.parentNode != null) {
        oDiv.parentNode.removeChild(oDiv);
    }
}

function outputAmenities(containerId, amenities) {
    var oDiv = document.getElementById(containerId);
    if (amenities != null && amenities.length ) {
        var oUL = document.createElement('ul');
        oUL.setAttribute("class","AmenityList");
        for (i = 0; i < amenities.length; i++) {
            var amenity = amenities[i];
            var oLI = document.createElement("li");
            oLI.appendChild(document.createTextNode(amenity.name));
            oUL.appendChild(oLI);
        }
        oDiv.appendChild(oUL);
    }  else if (oDiv != null && oDiv.parentNode != null) {
        oDiv.parentNode.removeChild(oDiv);
    }
}

function outputDescription(containerId, description) {
    var oDiv = document.getElementById(containerId);
    if (description != null && description != '') {
        var oPara = document.createElement("p");
        oPara.appendChild(document.createTextNode(description));
        oDiv.appendChild(oPara);
        oDiv.appendChild(document.createElement("br"))
    } else if (oDiv != null && oDiv.parentNode != null) {
        oDiv.parentNode.removeChild(oDiv);
    }
}

function outputBuildingUnits(unitListTableId, units) {
    var oTable = document.getElementById(unitListTableId);
    if (oTable != null && units != null && units.length > 0) {
        var oTBody = oTable.tBodies[0];
        if (oTBody == null) {
            oTBody = document.createElement("tbody");
            oTable.appendChild(oTBody);
        }
        for (i = 0; i < units.length; i++) {
            var unit = units[i];

            var oRow = document.createElement("tr");
            oTBody.appendChild(oRow);

            var oCell1 = document.createElement("td");
            oRow.appendChild(oCell1);
            //oCell1.appendChild(document.createTextNode(unit.marketingName));
            oCell1.innerHTML = '<a class="link" href="unit.html?uid='+unit.id+'">'+unit.marketingName+'</a>';

            var oCell2 = document.createElement("td");
            oRow.appendChild(oCell2);
            oCell2.appendChild(document.createTextNode(unit.type));

            var oCell3 = document.createElement("td");
            oRow.appendChild(oCell3);
            oCell3.appendChild(document.createTextNode(unit.totalArea));

            var oCell4 = document.createElement("td");
            oRow.appendChild(oCell4);
            oCell4.appendChild(document.createTextNode(unit.targetRentDescription));

            var oCell5 = document.createElement("td");
            oRow.appendChild(oCell5);
            oCell5.appendChild(document.createTextNode(unit.targetDeposit));

        }

    }
}

function setCommunityInfoZip(elementId, zip) {
    var oCommunityInfoDiv = document.getElementById(elementId);
    if (oCommunityInfoDiv != null) {
        oCommunityInfoDiv.innerHTML = oCommunityInfoDiv.innerHTML.replace(/ZIP/g, zip)
    }
}


