/*
 * jQuery 1.2.3b - New Wave Javascript
 *
 * Copyright (c) 2008 John Resig (jquery.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * $Date: 2008-02-03 16:46:47 -0500 (Sun, 03 Feb 2008) $
 * $Rev: 4625 $
 */
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}('(J(){7(1d.47)L w=1d.47;L E=1d.47=J(a,b){K 1A E.2h.4Z(a,b)};7(1d.$)L D=1d.$;1d.$=E;L u=/^[^<]*(<(.|\\s)+>)[^>]*$|^#(\\w+)$/;L G=/^.[^:#\\[\\.]*$/;E.1m=E.2h={4Z:J(d,b){d=d||T;7(d.15){6[0]=d;6.M=1;K 6}N 7(1u d=="2f"){L c=u.2S(d);7(c&&(c[1]||!b)){7(c[1])d=E.4b([c[1]],b);N{L a=T.5i(c[3]);7(a)7(a.2u!=c[3])K E().2w(d);N{6[0]=a;6.M=1;K 6}N d=[]}}N K 1A E(b).2w(d)}N 7(E.1o(d))K 1A E(T)[E.1m.1Z?"1Z":"45"](d);K 6.6F(d.1k==1M&&d||(d.5j||d.M&&d!=1d&&!d.15&&d[0]!=10&&d[0].15)&&E.2I(d)||[d])},5j:"1.2.3b",81:J(){K 6.M},M:0,21:J(a){K a==10?E.2I(6):6[a]},2A:J(b){L a=E(b);a.55=6;K a},6F:J(a){6.M=0;1M.2h.1h.1i(6,a);K 6},S:J(a,b){K E.S(6,a,b)},4V:J(b){L a=-1;6.S(J(i){7(6==b)a=i});K a},1F:J(c,a,b){L d=c;7(c.1k==4e)7(a==10)K 6.M&&E[b||"1F"](6[0],c)||10;N{d={};d[c]=a}K 6.S(J(i){Q(c 1r d)E.1F(b?6.W:6,c,E.1l(6,d[c],b,i,c))})},1j:J(b,a){7((b==\'27\'||b==\'1T\')&&2L(a)<0)a=10;K 6.1F(b,a,"2s")},1s:J(b){7(1u b!="43"&&b!=V)K 6.4B().3p((6[0]&&6[0].2g||T).5n(b));L a="";E.S(b||6,J(){E.S(6.3q,J(){7(6.15!=8)a+=6.15!=1?6.6L:E.1m.1s([6])})});K a},5M:J(b){7(6[0])E(b,6[0].2g).5I().3o(6[0]).2a(J(){L a=6;2b(a.1E)a=a.1E;K a}).3p(6);K 6},8s:J(a){K 6.S(J(){E(6).6B().5M(a)})},8k:J(a){K 6.S(J(){E(6).5M(a)})},3p:J(){K 6.3Q(19,P,R,J(a){7(6.15==1)6.3l(a)})},6r:J(){K 6.3Q(19,P,P,J(a){7(6.15==1)6.3o(a,6.1E)})},6o:J(){K 6.3Q(19,R,R,J(a){6.1b.3o(a,6)})},58:J(){K 6.3Q(19,R,P,J(a){6.1b.3o(a,6.2D)})},3j:J(){K 6.55||E([])},2w:J(b){L c=E.2a(6,J(a){K E.2w(b,a)});K 6.2A(/[^+>] [^+>]/.17(b)||b.1f("..")>-1?E.56(c):c)},5I:J(e){L f=6.2a(J(){7(E.14.1e&&!E.3E(6)){L a=6.69(P),4Y=T.3s("1x");4Y.3l(a);K E.4b([4Y.3v])[0]}N K 6.69(P)});L d=f.2w("*").4U().S(J(){7(6[F]!=10)6[F]=V});7(e===P)6.2w("*").4U().S(J(i){7(6.15==3)K;L c=E.O(6,"2Q");Q(L a 1r c)Q(L b 1r c[a])E.16.1a(d[i],a,c[a][b],c[a][b].O)});K f},1B:J(b){K 6.2A(E.1o(b)&&E.3y(6,J(a,i){K b.1P(a,i)})||E.38(b,6))},4J:J(b){7(b.1k==4e)7(G.17(b))K 6.2A(E.38(b,6,P));N b=E.38(b,6);L a=b.M&&b[b.M-1]!==10&&!b.15;K 6.1B(J(){K a?E.35(6,b)<0:6!=b})},1a:J(a){K!a?6:6.2A(E.31(6.21(),a.1k==4e?E(a).21():a.M!=10&&(!a.12||E.12(a,"39"))?a:[a]))},3J:J(a){K a?E.38(a,6).M>0:R},7k:J(a){K 6.3J("."+a)},6t:J(b){7(b==10){7(6.M){L c=6[0];7(E.12(c,"2q")){L e=c.3R,5J=[],11=c.11,2W=c.U=="2q-2W";7(e<0)K V;Q(L i=2W?e:0,29=2W?e+1:11.M;i<29;i++){L d=11[i];7(d.2t){b=E.14.1e&&!d.9A.1D.9v?d.1s:d.1D;7(2W)K b;5J.1h(b)}}K 5J}N K(6[0].1D||"").1q(/\\r/g,"")}K 10}K 6.S(J(){7(6.15!=1)K;7(b.1k==1M&&/5w|5v/.17(6.U))6.3r=(E.35(6.1D,b)>=0||E.35(6.2R,b)>=0);N 7(E.12(6,"2q")){L a=b.1k==1M?b:[b];E("96",6).S(J(){6.2t=(E.35(6.1D,a)>=0||E.35(6.1s,a)>=0)});7(!a.M)6.3R=-1}N 6.1D=b})},3u:J(a){K a==10?(6.M?6[0].3v:V):6.4B().3p(a)},6N:J(a){K 6.58(a).1X()},6M:J(i){K 6.2J(i,i+1)},2J:J(){K 6.2A(1M.2h.2J.1i(6,19))},2a:J(b){K 6.2A(E.2a(6,J(a,i){K b.1P(a,i,a)}))},4U:J(){K 6.1a(6.55)},O:J(d,b){L a=d.22(".");a[1]=a[1]?"."+a[1]:"";7(b==V){L c=6.5p("8L"+a[1]+"!",[a[0]]);7(c==10&&6.M)c=E.O(6[0],d);K c==V&&a[1]?6.O(a[0]):c}N K 6.1N("8I"+a[1]+"!",[a[0],b]).S(J(){E.O(6,d,b)})},2Y:J(a){K 6.S(J(){E.2Y(6,a)})},3Q:J(g,f,h,d){L e=6.M>1,3n;K 6.S(J(){7(!3n){3n=E.4b(g,6.2g);7(h)3n.8z()}L b=6;7(f&&E.12(6,"1W")&&E.12(3n[0],"4u"))b=6.40("1V")[0]||6.3l(6.2g.3s("1V"));L c=E([]);E.S(3n,J(){L a=e?E(6).5I(P)[0]:6;7(E.12(a,"1n")){c=c.1a(a)}N{7(a.15==1)c=c.1a(E("1n",a).1X());d.1P(b,a)}});c.S(6C)})}};E.2h.4Z.2h=E.2h;J 6C(i,a){7(a.3T)E.3S({1c:a.3T,3m:R,1I:"1n"});N E.5h(a.1s||a.6z||a.3v||"");7(a.1b)a.1b.34(a)}E.1p=E.1m.1p=J(){L b=19[0]||{},i=1,M=19.M,5d=R,11;7(b.1k==8b){5d=b;b=19[1]||{};i=2}7(1u b!="43"&&1u b!="J")b={};7(M==1){b=6;i=0}Q(;i<M;i++)7((11=19[i])!=V)Q(L a 1r 11){7(b===11[a])6x;7(5d&&11[a]&&1u 11[a]=="43"&&b[a]&&!11[a].15)b[a]=E.1p(b[a],11[a]);N 7(11[a]!=10)b[a]=11[a]}K b};L F="47"+(1A 3P()).3O(),6s=0,5b={};L H=/z-?4V|85-?82|1v|6l|80-?1T/i;E.1p({7Y:J(a){1d.$=D;7(a)1d.47=w;K E},1o:J(a){K!!a&&1u a!="2f"&&!a.12&&a.1k!=1M&&/J/i.17(a+"")},3E:J(a){K a.1H&&!a.1g||a.26&&a.2g&&!a.2g.1g},5h:J(a){a=E.3i(a);7(a){L b=T.40("6g")[0]||T.1H,1n=T.3s("1n");1n.U="1s/4j";7(E.14.1e)1n.1s=a;N 1n.3l(T.5n(a));b.3l(1n);b.34(1n)}},12:J(b,a){K b.12&&b.12.2F()==a.2F()},1R:{},O:J(c,d,b){c=c==1d?5b:c;L a=c[F];7(!a)a=c[F]=++6s;7(d&&!E.1R[a])E.1R[a]={};7(b!=10)E.1R[a][d]=b;K d?E.1R[a][d]:a},2Y:J(c,b){c=c==1d?5b:c;L a=c[F];7(b){7(E.1R[a]){2U E.1R[a][b];b="";Q(b 1r E.1R[a])1S;7(!b)E.2Y(c)}}N{1O{2U c[F]}1U(e){7(c.52)c.52(F)}2U E.1R[a]}},S:J(c,a,b){7(b){7(c.M==10){Q(L d 1r c)7(a.1i(c[d],b)===R)1S}N Q(L i=0,M=c.M;i<M;i++)7(a.1i(c[i],b)===R)1S}N{7(c.M==10){Q(L d 1r c)7(a.1P(c[d],d,c[d])===R)1S}N Q(L i=0,M=c.M,1D=c[0];i<M&&a.1P(1D,i,1D)!==R;1D=c[++i]){}}K c},1l:J(b,a,c,i,d){7(E.1o(a))a=a.1P(b,i);K a&&a.1k==51&&c=="2s"&&!H.17(d)?a+"36":a},1t:{1a:J(c,b){E.S((b||"").22(/\\s+/),J(i,a){7(c.15==1&&!E.1t.3U(c.1t,a))c.1t+=(c.1t?" ":"")+a})},1X:J(c,b){7(c.15==1)c.1t=b!=10?E.3y(c.1t.22(/\\s+/),J(a){K!E.1t.3U(b,a)}).6b(" "):""},3U:J(b,a){K E.35(a,(b.1t||b).3D().22(/\\s+/))>-1}},68:J(b,c,a){L e={};Q(L d 1r c){e[d]=b.W[d];b.W[d]=c[d]}a.1P(b);Q(L d 1r c)b.W[d]=e[d]},1j:J(d,e,c){7(e=="27"||e=="1T"){L b,3C={3W:"4X",5y:"23",18:"3g"},3f=e=="27"?["7O","7N"]:["7M","7L"];J 4R(){b=e=="27"?d.7K:d.7J;L a=0,2N=0;E.S(3f,J(){a+=2L(E.2s(d,"7G"+6,P))||0;2N+=2L(E.2s(d,"2N"+6+"5Z",P))||0});b-=1Y.7E(a+2N)}7(E(d).3J(":4d"))4R();N E.68(d,3C,4R);K 1Y.29(0,b)}K E.2s(d,e,c)},2s:J(e,k,j){L d;J 3z(b){7(!E.14.2d)K R;L a=T.4c.4K(b,V);K!a||a.4M("3z")==""}7(k=="1v"&&E.14.1e){d=E.1F(e.W,"1v");K d==""?"1":d}7(E.14.2z&&k=="18"){L c=e.W.18;e.W.18="3g";e.W.18=c}7(k.1C(/4f/i))k=y;7(!j&&e.W&&e.W[k])d=e.W[k];N 7(T.4c&&T.4c.4K){7(k.1C(/4f/i))k="4f";k=k.1q(/([A-Z])/g,"-$1").2k();L h=T.4c.4K(e,V);7(h&&!3z(e))d=h.4M(k);N{L f=[],2H=[];Q(L a=e;a&&3z(a);a=a.1b)2H.5c(a);Q(L i=0;i<2H.M;i++)7(3z(2H[i])){f[i]=2H[i].W.18;2H[i].W.18="3g"}d=k=="18"&&f[2H.M-1]!=V?"2G":(h&&h.4M(k))||"";Q(L i=0;i<f.M;i++)7(f[i]!=V)2H[i].W.18=f[i]}7(k=="1v"&&d=="")d="1"}N 7(e.4l){L g=k.1q(/\\-(\\w)/g,J(a,b){K b.2F()});d=e.4l[k]||e.4l[g];7(!/^\\d+(36)?$/i.17(d)&&/^\\d/.17(d)){L l=e.W.28,3L=e.3L.28;e.3L.28=e.4l.28;e.W.28=d||0;d=e.W.7i+"36";e.W.28=l;e.3L.28=3L}}K d},4b:J(l,h){L k=[];h=h||T;7(1u h.3s==\'10\')h=h.2g||h[0]&&h[0].2g||T;E.S(l,J(i,d){7(!d)K;7(d.1k==51)d=d.3D();7(1u d=="2f"){d=d.1q(/(<(\\w+)[^>]*?)\\/>/g,J(b,a,c){K c.1C(/^(7h|7f|7e|a6|4F|7c|a1|3w|9X|9U|9S)$/i)?b:a+"></"+c+">"});L f=E.3i(d).2k(),1x=h.3s("1x");L e=!f.1f("<9Q")&&[1,"<2q 77=\'77\'>","</2q>"]||!f.1f("<9N")&&[1,"<76>","</76>"]||f.1C(/^<(9I|1V|9G|9E|9z)/)&&[1,"<1W>","</1W>"]||!f.1f("<4u")&&[2,"<1W><1V>","</1V></1W>"]||(!f.1f("<9x")||!f.1f("<9w"))&&[3,"<1W><1V><4u>","</4u></1V></1W>"]||!f.1f("<7e")&&[2,"<1W><1V></1V><6Z>","</6Z></1W>"]||E.14.1e&&[1,"1x<1x>","</1x>"]||[0,"",""];1x.3v=e[1]+d+e[2];2b(e[0]--)1x=1x.5B;7(E.14.1e){L g=!f.1f("<1W")&&f.1f("<1V")<0?1x.1E&&1x.1E.3q:e[1]=="<1W>"&&f.1f("<1V")<0?1x.3q:[];Q(L j=g.M-1;j>=0;--j)7(E.12(g[j],"1V")&&!g[j].3q.M)g[j].1b.34(g[j]);7(/^\\s/.17(d))1x.3o(h.5n(d.1C(/^\\s*/)[0]),1x.1E)}d=E.2I(1x.3q)}7(d.M===0&&(!E.12(d,"39")&&!E.12(d,"2q")))K;7(d[0]==10||E.12(d,"39")||d.11)k.1h(d);N k=E.31(k,d)});K k},1F:J(d,e,c){7(!d||d.15==3||d.15==8)K 10;L f=E.3E(d)?{}:E.3C;7(e=="2t"&&E.14.2d)d.1b.3R;7(f[e]){7(c!=10)d[f[e]]=c;K d[f[e]]}N 7(E.14.1e&&e=="W")K E.1F(d.W,"9u",c);N 7(c==10&&E.14.1e&&E.12(d,"39")&&(e=="9s"||e=="9p"))K d.9n(e).6L;N 7(d.26){7(c!=10){7(e=="U"&&E.12(d,"4F")&&d.1b)6U"U 9j 9h\'t 9g 9f";d.9c(e,""+c)}7(E.14.1e&&/6S|3T/.17(e)&&!E.3E(d))K d.4A(e,2);K d.4A(e)}N{7(e=="1v"&&E.14.1e){7(c!=10){d.6l=1;d.1B=(d.1B||"").1q(/6Q\\([^)]*\\)/,"")+(2L(c).3D()=="97"?"":"6Q(1v="+c*6P+")")}K d.1B&&d.1B.1f("1v=")>=0?(2L(d.1B.1C(/1v=([^)]*)/)[1])/6P).3D():""}e=e.1q(/-([a-z])/95,J(a,b){K b.2F()});7(c!=10)d[e]=c;K d[e]}},3i:J(a){K(a||"").1q(/^\\s+|\\s+$/g,"")},2I:J(b){L a=[];7(1u b!="93")Q(L i=0,M=b.M;i<M;i++)a.1h(b[i]);N a=b.2J(0);K a},35:J(b,a){Q(L i=0,M=a.M;i<M;i++)7(a[i]==b)K i;K-1},31:J(a,b){7(E.14.1e){Q(L i=0;b[i];i++)7(b[i].15!=8)a.1h(b[i])}N Q(L i=0;b[i];i++)a.1h(b[i]);K a},56:J(a){L c=[],2i={};1O{Q(L i=0,M=a.M;i<M;i++){L b=E.O(a[i]);7(!2i[b]){2i[b]=P;c.1h(a[i])}}}1U(e){c=a}K c},3y:J(c,a,d){L b=[];Q(L i=0,M=c.M;i<M;i++)7(!d&&a(c[i],i)||d&&!a(c[i],i))b.1h(c[i]);K b},2a:J(d,a){L c=[];Q(L i=0,M=d.M;i<M;i++){L b=a(d[i],i);7(b!==V&&b!=10){7(b.1k!=1M)b=[b];c=c.6X(b)}}K c}});L v=8Y.8W.2k();E.14={5H:(v.1C(/.+(?:8U|8S|8R|8Q)[\\/: ]([\\d.]+)/)||[])[1],2d:/6K/.17(v),2z:/2z/.17(v),1e:/1e/.17(v)&&!/2z/.17(v),49:/49/.17(v)&&!/(8N|6K)/.17(v)};L y=E.14.1e?"6J":"6I";E.1p({8J:!E.14.1e||T.6G=="79",3C:{"Q":"8F","8E":"1t","4f":y,6I:y,6J:y,3v:"3v",1t:"1t",1D:"1D",2V:"2V",3r:"3r",8D:"8C",2t:"2t",8B:"8A",3R:"3R",6E:"6E",26:"26",12:"12"}});E.S({6D:J(a){K a.1b},8y:J(a){K E.4v(a,"1b")},8x:J(a){K E.2X(a,2,"2D")},8w:J(a){K E.2X(a,2,"4t")},8v:J(a){K E.4v(a,"2D")},8u:J(a){K E.4v(a,"4t")},8t:J(a){K E.5m(a.1b.1E,a)},8r:J(a){K E.5m(a.1E)},6B:J(a){K E.12(a,"8q")?a.8p||a.8o.T:E.2I(a.3q)}},J(c,d){E.1m[c]=J(b){L a=E.2a(6,d);7(b&&1u b=="2f")a=E.38(b,a);K 6.2A(E.56(a))}});E.S({6A:"3p",8n:"6r",3o:"6o",8m:"58",8l:"6N"},J(c,b){E.1m[c]=J(){L a=19;K 6.S(J(){Q(L i=0,M=a.M;i<M;i++)E(a[i])[b](6)})}});E.S({8j:J(a){E.1F(6,a,"");7(6.15==1)6.52(a)},8i:J(a){E.1t.1a(6,a)},8h:J(a){E.1t.1X(6,a)},8g:J(a){E.1t[E.1t.3U(6,a)?"1X":"1a"](6,a)},1X:J(a){7(!a||E.1B(a,[6]).r.M){E("*",6).1a(6).S(J(){E.16.1X(6);E.2Y(6)});7(6.1b)6.1b.34(6)}},4B:J(){E(">*",6).1X();2b(6.1E)6.34(6.1E)}},J(a,b){E.1m[a]=J(){K 6.S(b,19)}});E.S(["8f","5Z"],J(i,c){L b=c.2k();E.1m[b]=J(a){K 6[0]==1d?E.14.2z&&T.1g["5g"+c]||E.14.2d&&1d["8e"+c]||T.6G=="79"&&T.1H["5g"+c]||T.1g["5g"+c]:6[0]==T?1Y.29(1Y.29(T.1g["5f"+c],T.1H["5f"+c]),1Y.29(T.1g["5e"+c],T.1H["5e"+c])):a==10?(6.M?E.1j(6[0],b):V):6.1j(b,a.1k==4e?a:a+"36")}});L C=E.14.2d&&4r(E.14.5H)<8d?"(?:[\\\\w*4p-]|\\\\\\\\.)":"(?:[\\\\w\\8c-\\8a*4p-]|\\\\\\\\.)",6y=1A 4n("^>\\\\s*("+C+"+)"),6w=1A 4n("^("+C+"+)(#)("+C+"+)"),6v=1A 4n("^([#.]?)("+C+"*)");E.1p({6u:{"":J(a,i,m){K m[2]=="*"||E.12(a,m[2])},"#":J(a,i,m){K a.4A("2u")==m[2]},":":{89:J(a,i,m){K i<m[3]-0},88:J(a,i,m){K i>m[3]-0},2X:J(a,i,m){K m[3]-0==i},6M:J(a,i,m){K m[3]-0==i},3c:J(a,i){K i==0},3M:J(a,i,m,r){K i==r.M-1},6q:J(a,i){K i%2==0},6p:J(a,i){K i%2},"3c-4m":J(a){K a.1b.40("*")[0]==a},"3M-4m":J(a){K E.2X(a.1b.5B,1,"4t")==a},"87-4m":J(a){K!E.2X(a.1b.5B,2,"4t")},6D:J(a){K a.1E},4B:J(a){K!a.1E},86:J(a,i,m){K(a.6z||a.84||E(a).1s()||"").1f(m[3])>=0},4d:J(a){K"23"!=a.U&&E.1j(a,"18")!="2G"&&E.1j(a,"5y")!="23"},23:J(a){K"23"==a.U||E.1j(a,"18")=="2G"||E.1j(a,"5y")=="23"},83:J(a){K!a.2V},2V:J(a){K a.2V},3r:J(a){K a.3r},2t:J(a){K a.2t||E.1F(a,"2t")},1s:J(a){K"1s"==a.U},5w:J(a){K"5w"==a.U},5v:J(a){K"5v"==a.U},5a:J(a){K"5a"==a.U},3K:J(a){K"3K"==a.U},59:J(a){K"59"==a.U},6m:J(a){K"6m"==a.U},6k:J(a){K"6k"==a.U},2B:J(a){K"2B"==a.U||E.12(a,"2B")},4F:J(a){K/4F|2q|6j|2B/i.17(a.12)},3U:J(a,i,m){K E.2w(m[3],a).M},7Z:J(a){K/h\\d/i.17(a.12)},7X:J(a){K E.3y(E.3I,J(b){K a==b.Y}).M}}},6i:[/^(\\[) *@?([\\w-]+) *([!*$^~=]*) *(\'?"?)(.*?)\\4 *\\]/,/^(:)([\\w-]+)\\("?\'?(.*?(\\(.*?\\))?[^(]*?)"?\'?\\)/,1A 4n("^([:.#]*)("+C+"+)")],38:J(a,c,b){L d,2o=[];2b(a&&a!=d){d=a;L f=E.1B(a,c,b);a=f.t.1q(/^\\s*,\\s*/,"");2o=b?c=f.r:E.31(2o,f.r)}K 2o},2w:J(t,p){7(1u t!="2f")K[t];7(p&&p.15!=1&&p.15!=9)K[];p=p||T;L d=[p],2i=[],3M,12;2b(t&&3M!=t){L r=[];3M=t;t=E.3i(t);L o=R;L g=6y;L m=g.2S(t);7(m){12=m[1].2F();Q(L i=0;d[i];i++)Q(L c=d[i].1E;c;c=c.2D)7(c.15==1&&(12=="*"||c.12.2F()==12))r.1h(c);d=r;t=t.1q(g,"");7(t.1f(" ")==0)6x;o=P}N{g=/^([>+~])\\s*(\\w*)/i;7((m=g.2S(t))!=V){r=[];L l={};12=m[2].2F();m=m[1];Q(L j=0,3h=d.M;j<3h;j++){L n=m=="~"||m=="+"?d[j].2D:d[j].1E;Q(;n;n=n.2D)7(n.15==1){L h=E.O(n);7(m=="~"&&l[h])1S;7(!12||n.12.2F()==12){7(m=="~")l[h]=P;r.1h(n)}7(m=="+")1S}}d=r;t=E.3i(t.1q(g,""));o=P}}7(t&&!o){7(!t.1f(",")){7(p==d[0])d.4k();2i=E.31(2i,d);r=d=[p];t=" "+t.6f(1,t.M)}N{L k=6w;L m=k.2S(t);7(m){m=[0,m[2],m[3],m[1]]}N{k=6v;m=k.2S(t)}m[2]=m[2].1q(/\\\\/g,"");L f=d[d.M-1];7(m[1]=="#"&&f&&f.5i&&!E.3E(f)){L q=f.5i(m[2]);7((E.14.1e||E.14.2z)&&q&&1u q.2u=="2f"&&q.2u!=m[2])q=E(\'[@2u="\'+m[2]+\'"]\',f)[0];d=r=q&&(!m[3]||E.12(q,m[3]))?[q]:[]}N{Q(L i=0;d[i];i++){L a=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];7(a=="*"&&d[i].12.2k()=="43")a="3w";r=E.31(r,d[i].40(a))}7(m[1]==".")r=E.57(r,m[2]);7(m[1]=="#"){L e=[];Q(L i=0;r[i];i++)7(r[i].4A("2u")==m[2]){e=[r[i]];1S}r=e}d=r}t=t.1q(k,"")}}7(t){L b=E.1B(t,r);d=r=b.r;t=E.3i(b.t)}}7(t)d=[];7(d&&p==d[0])d.4k();2i=E.31(2i,d);K 2i},57:J(r,m,a){m=" "+m+" ";L c=[];Q(L i=0;r[i];i++){L b=(" "+r[i].1t+" ").1f(m)>=0;7(!a&&b||a&&!b)c.1h(r[i])}K c},1B:J(t,r,h){L d;2b(t&&t!=d){d=t;L p=E.6i,m;Q(L i=0;p[i];i++){m=p[i].2S(t);7(m){t=t.7W(m[0].M);m[2]=m[2].1q(/\\\\/g,"");1S}}7(!m)1S;7(m[1]==":"&&m[2]=="4J")r=G.17(m[3])?E.1B(m[3],r,P).r:E(r).4J(m[3]);N 7(m[1]==".")r=E.57(r,m[2],h);N 7(m[1]=="["){L g=[],U=m[3];Q(L i=0,3h=r.M;i<3h;i++){L a=r[i],z=a[E.3C[m[2]]||m[2]];7(z==V||/6S|3T|2t/.17(m[2]))z=E.1F(a,m[2])||\'\';7((U==""&&!!z||U=="="&&z==m[5]||U=="!="&&z!=m[5]||U=="^="&&z&&!z.1f(m[5])||U=="$="&&z.6f(z.M-m[5].M)==m[5]||(U=="*="||U=="~=")&&z.1f(m[5])>=0)^h)g.1h(a)}r=g}N 7(m[1]==":"&&m[2]=="2X-4m"){L e={},g=[],17=/(-?)(\\d*)n((?:\\+|-)?\\d*)/.2S(m[3]=="6q"&&"2n"||m[3]=="6p"&&"2n+1"||!/\\D/.17(m[3])&&"7V+"+m[3]||m[3]),3c=(17[1]+(17[2]||1))-0,d=17[3]-0;Q(L i=0,3h=r.M;i<3h;i++){L j=r[i],1b=j.1b,2u=E.O(1b);7(!e[2u]){L c=1;Q(L n=1b.1E;n;n=n.2D)7(n.15==1)n.4i=c++;e[2u]=P}L b=R;7(3c==0){7(j.4i==d)b=P}N 7((j.4i-d)%3c==0&&(j.4i-d)/3c>=0)b=P;7(b^h)g.1h(j)}r=g}N{L f=E.6u[m[1]];7(1u f=="43")f=f[m[2]];7(1u f=="2f")f=6e("R||J(a,i){K "+f+";}");r=E.3y(r,J(a,i){K f(a,i,m,r)},h)}}K{r:r,t:t}},4v:J(b,c){L d=[];L a=b[c];2b(a&&a!=T){7(a.15==1)d.1h(a);a=a[c]}K d},2X:J(a,e,c,b){e=e||1;L d=0;Q(;a;a=a[c])7(a.15==1&&++d==e)1S;K a},5m:J(n,a){L r=[];Q(;n;n=n.2D){7(n.15==1&&(!a||n!=a))r.1h(n)}K r}});E.16={1a:J(f,i,g,e){7(f.15==3||f.15==8)K;7(E.14.1e&&f.54!=10)f=1d;7(!g.2C)g.2C=6.2C++;7(e!=10){L h=g;g=J(){K h.1i(6,19)};g.O=e;g.2C=h.2C}L j=E.O(f,"2Q")||E.O(f,"2Q",{}),1z=E.O(f,"1z")||E.O(f,"1z",J(){L a;7(1u E=="10"||E.16.53)K a;a=E.16.1z.1i(19.3G.Y,19);K a});1z.Y=f;E.S(i.22(/\\s+/),J(c,b){L a=b.22(".");b=a[0];g.U=a[1];L d=j[b];7(!d){d=j[b]={};7(!E.16.2r[b]||E.16.2r[b].4s.1P(f)===R){7(f.3F)f.3F(b,1z,R);N 7(f.6d)f.6d("4h"+b,1z)}}d[g.2C]=g;E.16.25[b]=P});f=V},2C:1,25:{},1X:J(e,h,f){7(e.15==3||e.15==8)K;L i=E.O(e,"2Q"),2c,4V;7(i){7(h==10||h[0]==".")Q(L g 1r i)6.1X(e,g+(h||""));N{7(h.U){f=h.2l;h=h.U}E.S(h.22(/\\s+/),J(b,a){L c=a.22(".");a=c[0];7(i[a]){7(f)2U i[a][f.2C];N Q(f 1r i[a])7(!c[1]||i[a][f].U==c[1])2U i[a][f];Q(2c 1r i[a])1S;7(!2c){7(!E.16.2r[a]||E.16.2r[a].4g.1P(e)===R){7(e.6c)e.6c(a,E.O(e,"1z"),R);N 7(e.6a)e.6a("4h"+a,E.O(e,"1z"))}2c=V;2U i[a]}}})}Q(2c 1r i)1S;7(!2c){L d=E.O(e,"1z");7(d)d.Y=V;E.2Y(e,"2Q");E.2Y(e,"1z")}}},1N:J(g,c,d,f,h){c=E.2I(c||[]);7(g.1f("!")>=0){g=g.2J(0,-1);L a=P}7(!d){7(6.25[g])E("*").1a([1d,T]).1N(g,c)}N{7(d.15==3||d.15==8)K 10;L b,2c,1m=E.1o(d[g]||V),16=!c[0]||!c[0].30;7(16)c.5c(6.50({U:g,2K:d}));c[0].U=g;7(a)c[0].67=P;7(E.1o(E.O(d,"1z")))b=E.O(d,"1z").1i(d,c);7(!1m&&d["4h"+g]&&d["4h"+g].1i(d,c)===R)b=R;7(16)c.4k();7(h&&E.1o(h)){2c=h.1i(d,b==V?c:c.6X(b));7(2c!==10)b=2c}7(1m&&f!==R&&b!==R&&!(E.12(d,\'a\')&&g=="5t")){6.53=P;1O{d[g]()}1U(e){}}6.53=R}K b},1z:J(c){L a;c=E.16.50(c||1d.16||{});L b=c.U.22(".");c.U=b[0];L f=E.O(6,"2Q")&&E.O(6,"2Q")[c.U],3Z=1M.2h.2J.1P(19,1);3Z.5c(c);Q(L j 1r f){L d=f[j];3Z[0].2l=d;3Z[0].O=d.O;7(!b[1]&&!c.67||d.U==b[1]){L e=d.1i(6,3Z);7(a!==R)a=e;7(e===R){c.30();c.3X()}}}7(E.14.1e)c.2K=c.30=c.3X=c.2l=c.O=V;K a},50:J(c){L a=c;c=E.1p({},a);c.30=J(){7(a.30)a.30();a.7U=R};c.3X=J(){7(a.3X)a.3X();a.7T=P};7(!c.2K)c.2K=c.7S||T;7(c.2K.15==3)c.2K=a.2K.1b;7(!c.5z&&c.4W)c.5z=c.4W==c.2K?c.7R:c.4W;7(c.66==V&&c.65!=V){L b=T.1H,1g=T.1g;c.66=c.65+(b&&b.2p||1g&&1g.2p||0)-(b.64||0);c.7Q=c.7P+(b&&b.2x||1g&&1g.2x||0)-(b.63||0)}7(!c.3f&&((c.4C||c.4C===0)?c.4C:c.62))c.3f=c.4C||c.62;7(!c.61&&c.60)c.61=c.60;7(!c.3f&&c.2B)c.3f=(c.2B&1?1:(c.2B&2?3:(c.2B&4?2:0)));K c},2r:{1Z:{4s:J(){4T();K},4g:J(){K}},48:{4s:J(){7(E.14.1e)K R;E(6).2y("4S",E.16.2r.48.2l);K P},4g:J(){7(E.14.1e)K R;E(6).3H("4S",E.16.2r.48.2l);K P},2l:J(a){7(I(a,6))K P;19[0].U="48";K E.16.1z.1i(6,19)}},3B:{4s:J(){7(E.14.1e)K R;E(6).2y("4P",E.16.2r.3B.2l);K P},4g:J(){7(E.14.1e)K R;E(6).3H("4P",E.16.2r.3B.2l);K P},2l:J(a){7(I(a,6))K P;19[0].U="3B";K E.16.1z.1i(6,19)}}}};E.1m.1p({2y:J(c,a,b){K c=="4O"?6.2W(c,a,b):6.S(J(){E.16.1a(6,c,b||a,b&&a)})},2W:J(d,b,c){K 6.S(J(){E.16.1a(6,d,J(a){E(6).3H(a);K(c||b).1i(6,19)},c&&b)})},3H:J(a,b){K 6.S(J(){E.16.1X(6,a,b)})},1N:J(c,a,b){K 6.S(J(){E.16.1N(c,a,6,P,b)})},5p:J(c,a,b){7(6[0])K E.16.1N(c,a,6[0],R,b);K 10},2m:J(){L b=19;K 6.5t(J(a){6.4N=0==6.4N?1:0;a.30();K b[6.4N].1i(6,19)||R})},7I:J(a,b){K 6.2y(\'48\',a).2y(\'3B\',b)},1Z:J(a){4T();7(E.2O)a.1P(T,E);N E.3x.1h(J(){K a.1P(6,E)});K 6}});E.1p({2O:R,3x:[],1Z:J(){7(!E.2O){E.2O=P;7(E.3x){E.S(E.3x,J(){6.1i(T)});E.3x=V}E(T).5p("1Z")}}});L x=R;J 4T(){7(x)K;x=P;7(T.3F&&!E.14.2z)T.3F("5Y",E.1Z,R);7(E.14.1e&&1d==3e)(J(){7(E.2O)K;1O{T.1H.7F("28")}1U(3a){3A(19.3G,0);K}E.1Z()})();7(E.14.2z)T.3F("5Y",J(){7(E.2O)K;Q(L i=0;i<T.4L.M;i++)7(T.4L[i].2V){3A(19.3G,0);K}E.1Z()},R);7(E.14.2d){L a;(J(){7(E.2O)K;7(T.3d!="5X"&&T.3d!="1w"){3A(19.3G,0);K}7(a===10)a=E("W, 7c[7D=7C]").M;7(T.4L.M!=a){3A(19.3G,0);K}E.1Z()})()}E.16.1a(1d,"45",E.1Z)}E.S(("7B,7A,45,7z,5f,4O,5t,7y,"+"7x,7w,7v,4S,4P,7H,2q,"+"59,7u,7t,7s,3a").22(","),J(i,b){E.1m[b]=J(a){K a?6.2y(b,a):6.1N(b)}});L I=J(a,c){L b=a.5z;2b(b&&b!=c)1O{b=b.1b}1U(3a){b=c}K b==c};E(1d).2y("4O",J(){E("*").1a(T).3H()});E.1m.1p({45:J(g,d,c){7(E.1o(g))K 6.2y("45",g);L e=g.1f(" ");7(e>=0){L i=g.2J(e,g.M);g=g.2J(0,e)}c=c||J(){};L f="4Q";7(d)7(E.1o(d)){c=d;d=V}N{d=E.3w(d);f="5W"}L h=6;E.3S({1c:g,U:f,1I:"3u",O:d,1w:J(a,b){7(b=="1Q"||b=="5V")h.3u(i?E("<1x/>").3p(a.4G.1q(/<1n(.|\\s)*?\\/1n>/g,"")).2w(i):a.4G);h.S(c,[a.4G,b,a])}});K 6},7r:J(){K E.3w(6.5U())},5U:J(){K 6.2a(J(){K E.12(6,"39")?E.2I(6.7q):6}).1B(J(){K 6.2R&&!6.2V&&(6.3r||/2q|6j/i.17(6.12)||/1s|23|3K/i.17(6.U))}).2a(J(i,c){L b=E(6).6t();K b==V?V:b.1k==1M?E.2a(b,J(a,i){K{2R:c.2R,1D:a}}):{2R:c.2R,1D:b}}).21()}});E.S("5T,5S,5R,5Q,6h,5P".22(","),J(i,o){E.1m[o]=J(f){K 6.2y(o,f)}});L B=(1A 3P).3O();E.1p({21:J(d,b,a,c){7(E.1o(b)){a=b;b=V}K E.3S({U:"4Q",1c:d,O:b,1Q:a,1I:c})},7p:J(b,a){K E.21(b,V,a,"1n")},7o:J(c,b,a){K E.21(c,b,a,"3k")},7n:J(d,b,a,c){7(E.1o(b)){a=b;b={}}K E.3S({U:"5W",1c:d,O:b,1Q:a,1I:c})},7m:J(a){E.1p(E.4I,a)},4I:{25:P,U:"4Q",2T:0,5O:"4a/x-7l-39-7j",5N:P,3m:P,O:V,6n:V,3K:V,4o:{3N:"4a/3N, 1s/3N",3u:"1s/3u",1n:"1s/4j, 4a/4j",3k:"4a/3k, 1s/4j",1s:"1s/7g",4q:"*/*"}},4w:{},3S:J(s){L f,37=/=\\?(&|$)/g,1y,O;s=E.1p(P,s,E.1p(P,{},E.4I,s));7(s.O&&s.5N&&1u s.O!="2f")s.O=E.3w(s.O);7(s.1I=="4H"){7(s.U.2k()=="21"){7(!s.1c.1C(37))s.1c+=(s.1c.1C(/\\?/)?"&":"?")+(s.4H||"7d")+"=?"}N 7(!s.O||!s.O.1C(37))s.O=(s.O?s.O+"&":"")+(s.4H||"7d")+"=?";s.1I="3k"}7(s.1I=="3k"&&(s.O&&s.O.1C(37)||s.1c.1C(37))){f="4H"+B++;7(s.O)s.O=(s.O+"").1q(37,"="+f+"$1");s.1c=s.1c.1q(37,"="+f+"$1");s.1I="1n";1d[f]=J(a){O=a;1Q();1w();1d[f]=10;1O{2U 1d[f]}1U(e){}7(h)h.34(g)}}7(s.1I=="1n"&&s.1R==V)s.1R=R;7(s.1R===R&&s.U.2k()=="21"){L i=(1A 3P()).3O();L j=s.1c.1q(/(\\?|&)4p=.*?(&|$)/,"$a3="+i+"$2");s.1c=j+((j==s.1c)?(s.1c.1C(/\\?/)?"&":"?")+"4p="+i:"")}7(s.O&&s.U.2k()=="21"){s.1c+=(s.1c.1C(/\\?/)?"&":"?")+s.O;s.O=V}7(s.25&&!E.5L++)E.16.1N("5T");7((!s.1c.1f("a2")||!s.1c.1f("//"))&&s.1I=="1n"&&s.U.2k()=="21"){L h=T.40("6g")[0];L g=T.3s("1n");g.3T=s.1c;7(s.7b)g.a0=s.7b;7(!f){L l=R;g.9Z=g.9Y=J(){7(!l&&(!6.3d||6.3d=="5X"||6.3d=="1w")){l=P;1Q();1w();h.34(g)}}}h.3l(g);K 10}L m=R;L k=1d.7a?1A 7a("9W.9V"):1A 78();k.9T(s.U,s.1c,s.3m,s.6n,s.3K);1O{7(s.O)k.4E("9R-9P",s.5O);7(s.5F)k.4E("9O-5D-9M",E.4w[s.1c]||"9L, 9K 9J 9H 5C:5C:5C 9F");k.4E("X-9D-9B","78");k.4E("9y",s.1I&&s.4o[s.1I]?s.4o[s.1I]+", */*":s.4o.4q)}1U(e){}7(s.74)s.74(k);7(s.25)E.16.1N("5P",[k,s]);L c=J(a){7(!m&&k&&(k.3d==4||a=="2T")){m=P;7(d){73(d);d=V}1y=a=="2T"&&"2T"||!E.72(k)&&"3a"||s.5F&&E.71(k,s.1c)&&"5V"||"1Q";7(1y=="1Q"){1O{O=E.70(k,s.1I)}1U(e){1y="5q"}}7(1y=="1Q"){L b;1O{b=k.5o("6Y-5D")}1U(e){}7(s.5F&&b)E.4w[s.1c]=b;7(!f)1Q()}N E.5u(s,k,1y);1w();7(s.3m)k=V}};7(s.3m){L d=54(c,13);7(s.2T>0)3A(J(){7(k){k.9t();7(!m)c("2T")}},s.2T)}1O{k.9r(s.O)}1U(e){E.5u(s,k,V,e)}7(!s.3m)c();J 1Q(){7(s.1Q)s.1Q(O,1y);7(s.25)E.16.1N("6h",[k,s])}J 1w(){7(s.1w)s.1w(k,1y);7(s.25)E.16.1N("5R",[k,s]);7(s.25&&!--E.5L)E.16.1N("5S")}K k},5u:J(s,a,b,e){7(s.3a)s.3a(a,b,e);7(s.25)E.16.1N("5Q",[a,s,e])},5L:0,72:J(r){1O{K!r.1y&&9q.9o=="5a:"||(r.1y>=6W&&r.1y<9m)||r.1y==6V||r.1y==9l||E.14.2d&&r.1y==10}1U(e){}K R},71:J(a,c){1O{L b=a.5o("6Y-5D");K a.1y==6V||b==E.4w[c]||E.14.2d&&a.1y==10}1U(e){}K R},70:J(r,b){L c=r.5o("9k-U");L d=b=="3N"||!b&&c&&c.1f("3N")>=0;L a=d?r.9i:r.4G;7(d&&a.1H.26=="5q")6U"5q";7(b=="1n")E.5h(a);7(b=="3k")a=6e("("+a+")");K a},3w:J(a){L s=[];7(a.1k==1M||a.5j)E.S(a,J(){s.1h(3t(6.2R)+"="+3t(6.1D))});N Q(L j 1r a)7(a[j]&&a[j].1k==1M)E.S(a[j],J(){s.1h(3t(j)+"="+3t(6))});N s.1h(3t(j)+"="+3t(a[j]));K s.6b("&").1q(/%20/g,"+")}});E.1m.1p({1G:J(c,b){K c?6.2e({1T:"1G",27:"1G",1v:"1G"},c,b):6.1B(":23").S(J(){6.W.18=6.5x||"";7(E.1j(6,"18")=="2G"){L a=E("<"+6.26+" />").6A("1g");6.W.18=a.1j("18");7(6.W.18=="2G")6.W.18="3g";a.1X()}}).3j()},1J:J(b,a){K b?6.2e({1T:"1J",27:"1J",1v:"1J"},b,a):6.1B(":4d").S(J(){6.5x=6.5x||E.1j(6,"18");6.W.18="2G"}).3j()},6T:E.1m.2m,2m:J(a,b){K E.1o(a)&&E.1o(b)?6.6T(a,b):a?6.2e({1T:"2m",27:"2m",1v:"2m"},a,b):6.S(J(){E(6)[E(6).3J(":23")?"1G":"1J"]()})},9e:J(b,a){K 6.2e({1T:"1G"},b,a)},9d:J(b,a){K 6.2e({1T:"1J"},b,a)},9b:J(b,a){K 6.2e({1T:"2m"},b,a)},9a:J(b,a){K 6.2e({1v:"1G"},b,a)},99:J(b,a){K 6.2e({1v:"1J"},b,a)},98:J(c,a,b){K 6.2e({1v:a},c,b)},2e:J(l,k,j,h){L i=E.6R(k,j,h);K 6[i.32===R?"S":"32"](J(){7(6.15!=1)K R;L g=E.1p({},i);L f=E(6).3J(":23"),4z=6;Q(L p 1r l){7(l[p]=="1J"&&f||l[p]=="1G"&&!f)K E.1o(g.1w)&&g.1w.1i(6);7(p=="1T"||p=="27"){g.18=E.1j(6,"18");g.2P=6.W.2P}}7(g.2P!=V)6.W.2P="23";g.3Y=E.1p({},l);E.S(l,J(c,a){L e=1A E.2j(4z,g,c);7(/2m|1G|1J/.17(a))e[a=="2m"?f?"1G":"1J":a](l);N{L b=a.3D().1C(/^([+-]=)?([\\d+-.]+)(.*)$/),24=e.2o(P)||0;7(b){L d=2L(b[2]),2E=b[3]||"36";7(2E!="36"){4z.W[c]=(d||1)+2E;24=((d||1)/e.2o(P))*24;4z.W[c]=24+2E}7(b[1])d=((b[1]=="-="?-1:1)*d)+24;e.42(24,d,2E)}N e.42(24,a,"")}});K P})},32:J(a,b){7(E.1o(a)||(a&&a.1k==1M)){b=a;a="2j"}7(!a||(1u a=="2f"&&!b))K A(6[0],a);K 6.S(J(){7(b.1k==1M)A(6,a,b);N{A(6,a).1h(b);7(A(6,a).M==1)b.1i(6)}})},94:J(b,c){L a=E.3I;7(b)6.32([]);6.S(J(){Q(L i=a.M-1;i>=0;i--)7(a[i].Y==6){7(c)a[i](P);a.6O(i,1)}});7(!c)6.5A();K 6}});L A=J(b,c,a){7(!b)K 10;c=c||"2j";L q=E.O(b,c+"32");7(!q||a)q=E.O(b,c+"32",a?E.2I(a):[]);K q};E.1m.5A=J(a){a=a||"2j";K 6.S(J(){L q=A(6,a);q.4k();7(q.M)q[0].1i(6)})};E.1p({6R:J(b,a,c){L d=b&&b.1k==92?b:{1w:c||!c&&a||E.1o(b)&&b,2v:b,3V:c&&a||a&&a.1k!=91&&a};d.2v=(d.2v&&d.2v.1k==51?d.2v:{90:8Z,8X:6W}[d.2v])||9C;d.5r=d.1w;d.1w=J(){7(d.32!==R)E(6).5A();7(E.1o(d.5r))d.5r.1i(6)};K d},3V:{75:J(p,n,b,a){K b+a*p},5K:J(p,n,b,a){K((-1Y.8V(p*1Y.8T)/2)+0.5)*a+b}},3I:[],44:V,2j:J(b,c,a){6.11=c;6.Y=b;6.1l=a;7(!c.41)c.41={}}});E.2j.2h={4y:J(){7(6.11.2Z)6.11.2Z.1i(6.Y,[6.2M,6]);(E.2j.2Z[6.1l]||E.2j.2Z.4q)(6);7(6.1l=="1T"||6.1l=="27")6.Y.W.18="3g"},2o:J(a){7(6.Y[6.1l]!=V&&6.Y.W[6.1l]==V)K 6.Y[6.1l];L r=2L(E.1j(6.Y,6.1l,a));K r&&r>-8P?r:2L(E.2s(6.Y,6.1l))||0},42:J(c,b,d){6.5s=(1A 3P()).3O();6.24=c;6.3j=b;6.2E=d||6.2E||"36";6.2M=6.24;6.4x=6.4D=0;6.4y();L e=6;J t(a){K e.2Z(a)}t.Y=6.Y;E.3I.1h(t);7(E.44==V){E.44=54(J(){L a=E.3I;Q(L i=0;i<a.M;i++)7(!a[i]())a.6O(i--,1);7(!a.M){73(E.44);E.44=V}},13)}},1G:J(){6.11.41[6.1l]=E.1F(6.Y.W,6.1l);6.11.1G=P;6.42(0,6.2o());7(6.1l=="27"||6.1l=="1T")6.Y.W[6.1l]="8O";E(6.Y).1G()},1J:J(){6.11.41[6.1l]=E.1F(6.Y.W,6.1l);6.11.1J=P;6.42(6.2o(),0)},2Z:J(a){L t=(1A 3P()).3O();7(a||t>6.11.2v+6.5s){6.2M=6.3j;6.4x=6.4D=1;6.4y();6.11.3Y[6.1l]=P;L b=P;Q(L i 1r 6.11.3Y)7(6.11.3Y[i]!==P)b=R;7(b){7(6.11.18!=V){6.Y.W.2P=6.11.2P;6.Y.W.18=6.11.18;7(E.1j(6.Y,"18")=="2G")6.Y.W.18="3g"}7(6.11.1J)6.Y.W.18="2G";7(6.11.1J||6.11.1G)Q(L p 1r 6.11.3Y)E.1F(6.Y.W,p,6.11.41[p])}7(b&&E.1o(6.11.1w))6.11.1w.1i(6.Y);K R}N{L n=t-6.5s;6.4D=n/6.11.2v;6.4x=E.3V[6.11.3V||(E.3V.5K?"5K":"75")](6.4D,n,0,1,6.11.2v);6.2M=6.24+((6.3j-6.24)*6.4x);6.4y()}K P}};E.2j.2Z={2p:J(a){a.Y.2p=a.2M},2x:J(a){a.Y.2x=a.2M},1v:J(a){E.1F(a.Y.W,"1v",a.2M)},4q:J(a){a.Y.W[a.1l]=a.2M+a.2E}};E.1m.5e=J(){L b=0,3e=0,Y=6[0],5E;7(Y)8M(E.14){L d=Y.1b,46=Y,1K=Y.1K,1L=Y.2g,5G=2d&&4r(5H)<8K,33=E.1j(Y,"3W")=="33";7(Y.6H){L c=Y.6H();1a(c.28+1Y.29(1L.1H.2p,1L.1g.2p),c.3e+1Y.29(1L.1H.2x,1L.1g.2x));1a(-1L.1H.64,-1L.1H.63)}N{1a(Y.5l,Y.5k);2b(1K){1a(1K.5l,1K.5k);7(49&&!/^t(8H|d|h)$/i.17(1K.26)||2d&&!5G)2N(1K);7(!33&&E.1j(1K,"3W")=="33")33=P;46=/^1g$/i.17(1K.26)?46:1K;1K=1K.1K}2b(d&&d.26&&!/^1g|3u$/i.17(d.26)){7(!/^8G|1W.*$/i.17(E.1j(d,"18")))1a(-d.2p,-d.2x);7(49&&E.1j(d,"2P")!="4d")2N(d);d=d.1b}7((5G&&(33||E.1j(46,"3W")=="4X"))||(49&&E.1j(46,"3W")!="4X"))1a(-1L.1g.5l,-1L.1g.5k);7(33)1a(1Y.29(1L.1H.2p,1L.1g.2p),1Y.29(1L.1H.2x,1L.1g.2x))}5E={3e:3e,28:b}}J 2N(a){1a(E.2s(a,"a4",P),E.2s(a,"a5",P))}J 1a(l,t){b+=4r(l)||0;3e+=4r(t)||0}K 5E}})();',62,627,'||||||this|if||||||||||||||||||||||||||||||||||||||function|return|var|length|else|data|true|for|false|each|document|type|null|style||elem||undefined|options|nodeName||browser|nodeType|event|test|display|arguments|add|parentNode|url|window|msie|indexOf|body|push|apply|css|constructor|prop|fn|script|isFunction|extend|replace|in|text|className|typeof|opacity|complete|div|status|handle|new|filter|match|value|firstChild|attr|show|documentElement|dataType|hide|offsetParent|doc|Array|trigger|try|call|success|cache|break|height|catch|tbody|table|remove|Math|ready||get|split|hidden|start|global|tagName|width|left|max|map|while|ret|safari|animate|string|ownerDocument|prototype|done|fx|toLowerCase|handler|toggle||cur|scrollLeft|select|special|curCSS|selected|id|duration|find|scrollTop|bind|opera|pushStack|button|guid|nextSibling|unit|toUpperCase|none|stack|makeArray|slice|target|parseFloat|now|border|isReady|overflow|events|name|exec|timeout|delete|disabled|one|nth|removeData|step|preventDefault|merge|queue|fixed|removeChild|inArray|px|jsre|multiFilter|form|error||first|readyState|top|which|block|rl|trim|end|json|appendChild|async|elems|insertBefore|append|childNodes|checked|createElement|encodeURIComponent|html|innerHTML|param|readyList|grep|color|setTimeout|mouseleave|props|toString|isXMLDoc|addEventListener|callee|unbind|timers|is|password|runtimeStyle|last|xml|getTime|Date|domManip|selectedIndex|ajax|src|has|easing|position|stopPropagation|curAnim|args|getElementsByTagName|orig|custom|object|timerId|load|offsetChild|jQuery|mouseenter|mozilla|application|clean|defaultView|visible|String|float|teardown|on|nodeIndex|javascript|shift|currentStyle|child|RegExp|accepts|_|_default|parseInt|setup|previousSibling|tr|dir|lastModified|pos|update|self|getAttribute|empty|charCode|state|setRequestHeader|input|responseText|jsonp|ajaxSettings|not|getComputedStyle|styleSheets|getPropertyValue|lastToggle|unload|mouseout|GET|getWH|mouseover|bindReady|andSelf|index|fromElement|absolute|container|init|fix|Number|removeAttribute|triggered|setInterval|prevObject|unique|classFilter|after|submit|file|windowData|unshift|deep|offset|scroll|client|globalEval|getElementById|jquery|offsetTop|offsetLeft|sibling|createTextNode|getResponseHeader|triggerHandler|parsererror|old|startTime|click|handleError|checkbox|radio|oldblock|visibility|relatedTarget|dequeue|lastChild|00|Modified|results|ifModified|safari2|version|clone|values|swing|active|wrapAll|processData|contentType|ajaxSend|ajaxError|ajaxComplete|ajaxStop|ajaxStart|serializeArray|notmodified|POST|loaded|DOMContentLoaded|Width|ctrlKey|metaKey|keyCode|clientTop|clientLeft|clientX|pageX|exclusive|swap|cloneNode|detachEvent|join|removeEventListener|attachEvent|eval|substr|head|ajaxSuccess|parse|textarea|reset|zoom|image|username|before|odd|even|prepend|uuid|val|expr|quickClass|quickID|continue|quickChild|textContent|appendTo|contents|evalScript|parent|defaultValue|setArray|compatMode|getBoundingClientRect|cssFloat|styleFloat|webkit|nodeValue|eq|replaceWith|splice|100|alpha|speed|href|_toggle|throw|304|200|concat|Last|colgroup|httpData|httpNotModified|httpSuccess|clearInterval|beforeSend|linear|fieldset|multiple|XMLHttpRequest|CSS1Compat|ActiveXObject|scriptCharset|link|callback|col|br|plain|abbr|pixelLeft|urlencoded|hasClass|www|ajaxSetup|post|getJSON|getScript|elements|serialize|keyup|keypress|keydown|mousemove|mouseup|mousedown|dblclick|resize|focus|blur|stylesheet|rel|round|doScroll|padding|change|hover|offsetHeight|offsetWidth|Bottom|Top|Right|Left|clientY|pageY|toElement|srcElement|cancelBubble|returnValue|0n|substring|animated|noConflict|header|line|size|weight|enabled|innerText|font|contains|only|gt|lt|uFFFF|Boolean|u0128|417|inner|Height|toggleClass|removeClass|addClass|removeAttr|wrap|replaceAll|insertAfter|prependTo|contentWindow|contentDocument|iframe|children|wrapInner|siblings|prevAll|nextAll|prev|next|parents|reverse|maxLength|maxlength|readOnly|readonly|class|htmlFor|inline|able|setData|boxModel|522|getData|with|compatible|1px|10000|ie|ra|it|PI|rv|cos|userAgent|fast|navigator|600|slow|Function|Object|array|stop|ig|option|NaN|fadeTo|fadeOut|fadeIn|slideToggle|setAttribute|slideUp|slideDown|changed|be|can|responseXML|property|content|1223|300|getAttributeNode|protocol|method|location|send|action|abort|cssText|specified|th|td|Accept|cap|attributes|With|400|Requested|colg|GMT|tfoot|1970|thead|Jan|01|Thu|Since|leg|If|Type|opt|Content|embed|open|area|XMLHTTP|Microsoft|hr|onreadystatechange|onload|charset|meta|http|1_|borderLeftWidth|borderTopWidth|img'.split('|'),0,{}));/*
 * jQuery Form Plugin
 * version: 2.03 (01/20/2008)
 * @requires jQuery v1.1 or later
 *
 * Examples at: http://malsup.com/jquery/form/
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id$
 */
 (function($) {
/**
 * ajaxSubmit() provides a mechanism for submitting an HTML form using AJAX.
 *
 * ajaxSubmit accepts a single argument which can be either a success callback function
 * or an options Object.  If a function is provided it will be invoked upon successful
 * completion of the submit and will be passed the response from the server.
 * If an options Object is provided, the following attributes are supported:
 *
 *  target:   Identifies the element(s) in the page to be updated with the server response.
 *            This value may be specified as a jQuery selection string, a jQuery object,
 *            or a DOM element.
 *            default value: null
 *
 *  url:      URL to which the form data will be submitted.
 *            default value: value of form's 'action' attribute
 *
 *  type:     The method in which the form data should be submitted, 'GET' or 'POST'.
 *            default value: value of form's 'method' attribute (or 'GET' if none found)
 *
 *  data:     Additional data to add to the request, specified as key/value pairs (see $.ajax).
 *
 *  beforeSubmit:  Callback method to be invoked before the form is submitted.
 *            default value: null
 *
 *  success:  Callback method to be invoked after the form has been successfully submitted
 *            and the response has been returned from the server
 *            default value: null
 *
 *  dataType: Expected dataType of the response.  One of: null, 'xml', 'script', or 'json'
 *            default value: null
 *
 *  semantic: Boolean flag indicating whether data must be submitted in semantic order (slower).
 *            default value: false
 *
 *  resetForm: Boolean flag indicating whether the form should be reset if the submit is successful
 *
 *  clearForm: Boolean flag indicating whether the form should be cleared if the submit is successful
 *
 *
 * The 'beforeSubmit' callback can be provided as a hook for running pre-submit logic or for
 * validating the form data.  If the 'beforeSubmit' callback returns false then the form will
 * not be submitted. The 'beforeSubmit' callback is invoked with three arguments: the form data
 * in array format, the jQuery object, and the options object passed into ajaxSubmit.
 * The form data array takes the following form:
 *
 *     [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
 *
 * If a 'success' callback method is provided it is invoked after the response has been returned
 * from the server.  It is passed the responseText or responseXML value (depending on dataType).
 * See jQuery.ajax for further details.
 *
 *
 * The dataType option provides a means for specifying how the server response should be handled.
 * This maps directly to the jQuery.httpData method.  The following values are supported:
 *
 *      'xml':    if dataType == 'xml' the server response is treated as XML and the 'success'
 *                   callback method, if specified, will be passed the responseXML value
 *      'json':   if dataType == 'json' the server response will be evaluted and passed to
 *                   the 'success' callback, if specified
 *      'script': if dataType == 'script' the server response is evaluated in the global context
 *
 *
 * Note that it does not make sense to use both the 'target' and 'dataType' options.  If both
 * are provided the target will be ignored.
 *
 * The semantic argument can be used to force form serialization in semantic order.
 * This is normally true anyway, unless the form contains input elements of type='image'.
 * If your form must be submitted with name/value pairs in semantic order and your form
 * contains an input of type='image" then pass true for this arg, otherwise pass false
 * (or nothing) to avoid the overhead for this logic.
 *
 *
 * When used on its own, ajaxSubmit() is typically bound to a form's submit event like this:
 *
 * $("#form-id").submit(function() {
 *     $(this).ajaxSubmit(options);
 *     return false; // cancel conventional submit
 * });
 *
 * When using ajaxForm(), however, this is done for you.
 *
 * @example
 * $('#myForm').ajaxSubmit(function(data) {
 *     alert('Form submit succeeded! Server returned: ' + data);
 * });
 * @desc Submit form and alert server response
 *
 *
 * @example
 * var options = {
 *     target: '#myTargetDiv'
 * };
 * $('#myForm').ajaxSubmit(options);
 * @desc Submit form and update page element with server response
 *
 *
 * @example
 * var options = {
 *     success: function(responseText) {
 *         alert(responseText);
 *     }
 * };
 * $('#myForm').ajaxSubmit(options);
 * @desc Submit form and alert the server response
 *
 *
 * @example
 * var options = {
 *     beforeSubmit: function(formArray, jqForm) {
 *         if (formArray.length == 0) {
 *             alert('Please enter data.');
 *             return false;
 *         }
 *     }
 * };
 * $('#myForm').ajaxSubmit(options);
 * @desc Pre-submit validation which aborts the submit operation if form data is empty
 *
 *
 * @example
 * var options = {
 *     url: myJsonUrl.php,
 *     dataType: 'json',
 *     success: function(data) {
 *        // 'data' is an object representing the the evaluated json data
 *     }
 * };
 * $('#myForm').ajaxSubmit(options);
 * @desc json data returned and evaluated
 *
 *
 * @example
 * var options = {
 *     url: myXmlUrl.php,
 *     dataType: 'xml',
 *     success: function(responseXML) {
 *        // responseXML is XML document object
 *        var data = $('myElement', responseXML).text();
 *     }
 * };
 * $('#myForm').ajaxSubmit(options);
 * @desc XML data returned from server
 *
 *
 * @example
 * var options = {
 *     resetForm: true
 * };
 * $('#myForm').ajaxSubmit(options);
 * @desc submit form and reset it if successful
 *
 * @example
 * $('#myForm).submit(function() {
 *    $(this).ajaxSubmit();
 *    return false;
 * });
 * @desc Bind form's submit event to use ajaxSubmit
 *
 *
 * @name ajaxSubmit
 * @type jQuery
 * @param options  object literal containing options which control the form submission process
 * @cat Plugins/Form
 * @return jQuery
 */
$.fn.ajaxSubmit = function(options) {
    if (typeof options == 'function')
        options = { success: options };

    options = $.extend({
        url:  this.attr('action') || window.location.toString(),
        type: this.attr('method') || 'GET'
    }, options || {});

    // hook for manipulating the form data before it is extracted;
    // convenient for use with rich editors like tinyMCE or FCKEditor
    var veto = {};
    $.event.trigger('form.pre.serialize', [this, options, veto]);
    if (veto.veto) return this;

    var a = this.formToArray(options.semantic);
	if (options.data) {
	    for (var n in options.data)
	        a.push( { name: n, value: options.data[n] } );
	}

    // give pre-submit callback an opportunity to abort the submit
    if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) return this;

    // fire vetoable 'validate' event
    $.event.trigger('form.submit.validate', [a, this, options, veto]);
    if (veto.veto) return this;

    var q = $.param(a);//.replace(/%20/g,'+');

    if (options.type.toUpperCase() == 'GET') {
        options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
        options.data = null;  // data is null for 'get'
    }
    else
        options.data = q; // data is the query string for 'post'

    var $form = this, callbacks = [];
    if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
    if (options.clearForm) callbacks.push(function() { $form.clearForm(); });

    // perform a load on the target only if dataType is not provided
    if (!options.dataType && options.target) {
        var oldSuccess = options.success || function(){};
        callbacks.push(function(data) {
            if (this.evalScripts)
                $(options.target).attr("innerHTML", data).evalScripts().each(oldSuccess, arguments);
            else // jQuery v1.1.4
                $(options.target).html(data).each(oldSuccess, arguments);
        });
    }
    else if (options.success)
        callbacks.push(options.success);

    options.success = function(data, status) {
        for (var i=0, max=callbacks.length; i < max; i++)
            callbacks[i](data, status, $form);
    };

    // are there files to upload?
    var files = $('input:file', this).fieldValue();
    var found = false;
    for (var j=0; j < files.length; j++)
        if (files[j])
            found = true;

    // options.iframe allows user to force iframe mode
   if (options.iframe || found) { 
       // hack to fix Safari hang (thanks to Tim Molendijk for this)
       // see:  http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
       if ($.browser.safari && options.closeKeepAlive)
           $.get(options.closeKeepAlive, fileUpload);
       else
           fileUpload();
       }
   else
       $.ajax(options);

    // fire 'notify' event
    $.event.trigger('form.submit.notify', [this, options]);
    return this;


    // private function for handling file uploads (hat tip to YAHOO!)
    function fileUpload() {
        var form = $form[0];
        var opts = $.extend({}, $.ajaxSettings, options);

        var id = 'jqFormIO' + $.fn.ajaxSubmit.counter++;
        var $io = $('<iframe id="' + id + '" name="' + id + '" />');
        var io = $io[0];
        var op8 = $.browser.opera && window.opera.version() < 9;
        if ($.browser.msie || op8) io.src = 'javascript:false;document.write("");';
        $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });

        var xhr = { // mock object
            responseText: null,
            responseXML: null,
            status: 0,
            statusText: 'n/a',
            getAllResponseHeaders: function() {},
            getResponseHeader: function() {},
            setRequestHeader: function() {}
        };

        var g = opts.global;
        // trigger ajax global events so that activity/block indicators work like normal
        if (g && ! $.active++) $.event.trigger("ajaxStart");
        if (g) $.event.trigger("ajaxSend", [xhr, opts]);

        var cbInvoked = 0;
        var timedOut = 0;

        // take a breath so that pending repaints get some cpu time before the upload starts
        setTimeout(function() {
            // make sure form attrs are set
            var encAttr = form.encoding ? 'encoding' : 'enctype';
            var t = $form.attr('target'), a = $form.attr('action');
            $form.attr({
                target:   id,
                method:  'POST',
                action:   opts.url
            });
            form[encAttr] = 'multipart/form-data';

            // support timout
            if (opts.timeout)
                setTimeout(function() { timedOut = true; cb(); }, opts.timeout);

            // add iframe to doc and submit the form
            $io.appendTo('body');
            io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
            form.submit();
            // reset attrs
            $form.attr({ action: a, target: t });
        }, 10);

        function cb() {
            if (cbInvoked++) return;

            io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);

            var ok = true;
            try {
                if (timedOut) throw 'timeout';
                // extract the server response from the iframe
                var data, doc;
                doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
                xhr.responseText = doc.body ? doc.body.innerHTML : null;
                xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;

                if (opts.dataType == 'json' || opts.dataType == 'script') {
                    var ta = doc.getElementsByTagName('textarea')[0];
                    data = ta ? ta.value : xhr.responseText;
                    if (opts.dataType == 'json')
                        eval("data = " + data);
                    else
                        $.globalEval(data);
                }
                else if (opts.dataType == 'xml') {
                    data = xhr.responseXML;
                    if (!data && xhr.responseText != null)
                        data = toXml(xhr.responseText);
                }
                else {
                    data = xhr.responseText;
                }
            }
            catch(e){
                ok = false;
                $.handleError(opts, xhr, 'error', e);
            }

            // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
            if (ok) {
                opts.success(data, 'success');
                if (g) $.event.trigger("ajaxSuccess", [xhr, opts]);
            }
            if (g) $.event.trigger("ajaxComplete", [xhr, opts]);
            if (g && ! --$.active) $.event.trigger("ajaxStop");
            if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error');

            // clean up
            setTimeout(function() {
                $io.remove();
                xhr.responseXML = null;
            }, 100);
        };

        function toXml(s, doc) {
            if (window.ActiveXObject) {
                doc = new ActiveXObject('Microsoft.XMLDOM');
                doc.async = 'false';
                doc.loadXML(s);
            }
            else
                doc = (new DOMParser()).parseFromString(s, 'text/xml');
            return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
        };
    };
};
$.fn.ajaxSubmit.counter = 0; // used to create unique iframe ids

/**
 * ajaxForm() provides a mechanism for fully automating form submission.
 *
 * The advantages of using this method instead of ajaxSubmit() are:
 *
 * 1: This method will include coordinates for <input type="image" /> elements (if the element
 *    is used to submit the form).
 * 2. This method will include the submit element's name/value data (for the element that was
 *    used to submit the form).
 * 3. This method binds the submit() method to the form for you.
 *
 * Note that for accurate x/y coordinates of image submit elements in all browsers
 * you need to also use the "dimensions" plugin (this method will auto-detect its presence).
 *
 * The options argument for ajaxForm works exactly as it does for ajaxSubmit.  ajaxForm merely
 * passes the options argument along after properly binding events for submit elements and
 * the form itself.  See ajaxSubmit for a full description of the options argument.
 *
 *
 * @example
 * var options = {
 *     target: '#myTargetDiv'
 * };
 * $('#myForm').ajaxSForm(options);
 * @desc Bind form's submit event so that 'myTargetDiv' is updated with the server response
 *       when the form is submitted.
 *
 *
 * @example
 * var options = {
 *     success: function(responseText) {
 *         alert(responseText);
 *     }
 * };
 * $('#myForm').ajaxSubmit(options);
 * @desc Bind form's submit event so that server response is alerted after the form is submitted.
 *
 *
 * @example
 * var options = {
 *     beforeSubmit: function(formArray, jqForm) {
 *         if (formArray.length == 0) {
 *             alert('Please enter data.');
 *             return false;
 *         }
 *     }
 * };
 * $('#myForm').ajaxSubmit(options);
 * @desc Bind form's submit event so that pre-submit callback is invoked before the form
 *       is submitted.
 *
 *
 * @name   ajaxForm
 * @param  options  object literal containing options which control the form submission process
 * @return jQuery
 * @cat    Plugins/Form
 * @type   jQuery
 */
$.fn.ajaxForm = function(options) {
    return this.ajaxFormUnbind().submit(submitHandler).each(function() {
        // store options in hash
        this.formPluginId = $.fn.ajaxForm.counter++;
        $.fn.ajaxForm.optionHash[this.formPluginId] = options;
        $(":submit,input:image", this).click(clickHandler);
    });
};

$.fn.ajaxForm.counter = 1;
$.fn.ajaxForm.optionHash = {};

function clickHandler(e) {
    var $form = this.form;
    $form.clk = this;
    if (this.type == 'image') {
        if (e.offsetX != undefined) {
            $form.clk_x = e.offsetX;
            $form.clk_y = e.offsetY;
        } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
            var offset = $(this).offset();
            $form.clk_x = e.pageX - offset.left;
            $form.clk_y = e.pageY - offset.top;
        } else {
            $form.clk_x = e.pageX - this.offsetLeft;
            $form.clk_y = e.pageY - this.offsetTop;
        }
    }
    // clear form vars
    setTimeout(function() { $form.clk = $form.clk_x = $form.clk_y = null; }, 10);
};

function submitHandler() {
    // retrieve options from hash
    var id = this.formPluginId;
    var options = $.fn.ajaxForm.optionHash[id];
    $(this).ajaxSubmit(options);
    return false;
};

/**
 * ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
 *
 * @name   ajaxFormUnbind
 * @return jQuery
 * @cat    Plugins/Form
 * @type   jQuery
 */
$.fn.ajaxFormUnbind = function() {
    this.unbind('submit', submitHandler);
    return this.each(function() {
        $(":submit,input:image", this).unbind('click', clickHandler);
    });

};

/**
 * formToArray() gathers form element data into an array of objects that can
 * be passed to any of the following ajax functions: $.get, $.post, or load.
 * Each object in the array has both a 'name' and 'value' property.  An example of
 * an array for a simple login form might be:
 *
 * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
 *
 * It is this array that is passed to pre-submit callback functions provided to the
 * ajaxSubmit() and ajaxForm() methods.
 *
 * The semantic argument can be used to force form serialization in semantic order.
 * This is normally true anyway, unless the form contains input elements of type='image'.
 * If your form must be submitted with name/value pairs in semantic order and your form
 * contains an input of type='image" then pass true for this arg, otherwise pass false
 * (or nothing) to avoid the overhead for this logic.
 *
 * @example var data = $("#myForm").formToArray();
 * $.post( "myscript.cgi", data );
 * @desc Collect all the data from a form and submit it to the server.
 *
 * @name formToArray
 * @param semantic true if serialization must maintain strict semantic ordering of elements (slower)
 * @type Array<Object>
 * @cat Plugins/Form
 */
$.fn.formToArray = function(semantic) {
    var a = [];
    if (this.length == 0) return a;

    var form = this[0];
    var els = semantic ? form.getElementsByTagName('*') : form.elements;
    if (!els) return a;
    for(var i=0, max=els.length; i < max; i++) {
        var el = els[i];
        var n = el.name;
        if (!n) continue;

        if (semantic && form.clk && el.type == "image") {
            // handle image inputs on the fly when semantic == true
            if(!el.disabled && form.clk == el)
                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
            continue;
        }

        var v = $.fieldValue(el, true);
        if (v && v.constructor == Array) {
            for(var j=0, jmax=v.length; j < jmax; j++)
                a.push({name: n, value: v[j]});
        }
        else if (v !== null && typeof v != 'undefined')
            a.push({name: n, value: v});
    }

    if (!semantic && form.clk) {
        // input type=='image' are not found in elements array! handle them here
        var inputs = form.getElementsByTagName("input");
        for(var i=0, max=inputs.length; i < max; i++) {
            var input = inputs[i];
            var n = input.name;
            if(n && !input.disabled && input.type == "image" && form.clk == input)
                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
        }
    }
    return a;
};


/**
 * Serializes form data into a 'submittable' string. This method will return a string
 * in the format: name1=value1&amp;name2=value2
 *
 * The semantic argument can be used to force form serialization in semantic order.
 * If your form must be submitted with name/value pairs in semantic order then pass
 * true for this arg, otherwise pass false (or nothing) to avoid the overhead for
 * this logic (which can be significant for very large forms).
 *
 * @example var data = $("#myForm").formSerialize();
 * $.ajax('POST', "myscript.cgi", data);
 * @desc Collect all the data from a form into a single string
 *
 * @name formSerialize
 * @param semantic true if serialization must maintain strict semantic ordering of elements (slower)
 * @type String
 * @cat Plugins/Form
 */
$.fn.formSerialize = function(semantic) {
    //hand off to jQuery.param for proper encoding
    return $.param(this.formToArray(semantic));
};


/**
 * Serializes all field elements in the jQuery object into a query string.
 * This method will return a string in the format: name1=value1&amp;name2=value2
 *
 * The successful argument controls whether or not serialization is limited to
 * 'successful' controls (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
 * The default value of the successful argument is true.
 *
 * @example var data = $("input").formSerialize();
 * @desc Collect the data from all successful input elements into a query string
 *
 * @example var data = $(":radio").formSerialize();
 * @desc Collect the data from all successful radio input elements into a query string
 *
 * @example var data = $("#myForm :checkbox").formSerialize();
 * @desc Collect the data from all successful checkbox input elements in myForm into a query string
 *
 * @example var data = $("#myForm :checkbox").formSerialize(false);
 * @desc Collect the data from all checkbox elements in myForm (even the unchecked ones) into a query string
 *
 * @example var data = $(":input").formSerialize();
 * @desc Collect the data from all successful input, select, textarea and button elements into a query string
 *
 * @name fieldSerialize
 * @param successful true if only successful controls should be serialized (default is true)
 * @type String
 * @cat Plugins/Form
 */
$.fn.fieldSerialize = function(successful) {
    var a = [];
    this.each(function() {
        var n = this.name;
        if (!n) return;
        var v = $.fieldValue(this, successful);
        if (v && v.constructor == Array) {
            for (var i=0,max=v.length; i < max; i++)
                a.push({name: n, value: v[i]});
        }
        else if (v !== null && typeof v != 'undefined')
            a.push({name: this.name, value: v});
    });
    //hand off to jQuery.param for proper encoding
    return $.param(a);
};


/**
 * Returns the value(s) of the element in the matched set.  For example, consider the following form:
 *
 *  <form><fieldset>
 *      <input name="A" type="text" />
 *      <input name="A" type="text" />
 *      <input name="B" type="checkbox" value="B1" />
 *      <input name="B" type="checkbox" value="B2"/>
 *      <input name="C" type="radio" value="C1" />
 *      <input name="C" type="radio" value="C2" />
 *  </fieldset></form>
 *
 *  var v = $(':text').fieldValue();
 *  // if no values are entered into the text inputs
 *  v == ['','']
 *  // if values entered into the text inputs are 'foo' and 'bar'
 *  v == ['foo','bar']
 *
 *  var v = $(':checkbox').fieldValue();
 *  // if neither checkbox is checked
 *  v === undefined
 *  // if both checkboxes are checked
 *  v == ['B1', 'B2']
 *
 *  var v = $(':radio').fieldValue();
 *  // if neither radio is checked
 *  v === undefined
 *  // if first radio is checked
 *  v == ['C1']
 *
 * The successful argument controls whether or not the field element must be 'successful'
 * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
 * The default value of the successful argument is true.  If this value is false the value(s)
 * for each element is returned.
 *
 * Note: This method *always* returns an array.  If no valid value can be determined the
 *       array will be empty, otherwise it will contain one or more values.
 *
 * @example var data = $("#myPasswordElement").fieldValue();
 * alert(data[0]);
 * @desc Alerts the current value of the myPasswordElement element
 *
 * @example var data = $("#myForm :input").fieldValue();
 * @desc Get the value(s) of the form elements in myForm
 *
 * @example var data = $("#myForm :checkbox").fieldValue();
 * @desc Get the value(s) for the successful checkbox element(s) in the jQuery object.
 *
 * @example var data = $("#mySingleSelect").fieldValue();
 * @desc Get the value(s) of the select control
 *
 * @example var data = $(':text').fieldValue();
 * @desc Get the value(s) of the text input or textarea elements
 *
 * @example var data = $("#myMultiSelect").fieldValue();
 * @desc Get the values for the select-multiple control
 *
 * @name fieldValue
 * @param Boolean successful true if only the values for successful controls should be returned (default is true)
 * @type Array<String>
 * @cat Plugins/Form
 */
$.fn.fieldValue = function(successful) {
    for (var val=[], i=0, max=this.length; i < max; i++) {
        var el = this[i];
        var v = $.fieldValue(el, successful);
        if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))
            continue;
        v.constructor == Array ? $.merge(val, v) : val.push(v);
    }
    return val;
};

/**
 * Returns the value of the field element.
 *
 * The successful argument controls whether or not the field element must be 'successful'
 * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
 * The default value of the successful argument is true.  If the given element is not
 * successful and the successful arg is not false then the returned value will be null.
 *
 * Note: If the successful flag is true (default) but the element is not successful, the return will be null
 * Note: The value returned for a successful select-multiple element will always be an array.
 * Note: If the element has no value the return value will be undefined.
 *
 * @example var data = jQuery.fieldValue($("#myPasswordElement")[0]);
 * @desc Gets the current value of the myPasswordElement element
 *
 * @name fieldValue
 * @param Element el The DOM element for which the value will be returned
 * @param Boolean successful true if value returned must be for a successful controls (default is true)
 * @type String or Array<String> or null or undefined
 * @cat Plugins/Form
 */
$.fieldValue = function(el, successful) {
    var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
    if (typeof successful == 'undefined') successful = true;

    if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
        (t == 'checkbox' || t == 'radio') && !el.checked ||
        (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
        tag == 'select' && el.selectedIndex == -1))
            return null;

    if (tag == 'select') {
        var index = el.selectedIndex;
        if (index < 0) return null;
        var a = [], ops = el.options;
        var one = (t == 'select-one');
        var max = (one ? index+1 : ops.length);
        for(var i=(one ? index : 0); i < max; i++) {
            var op = ops[i];
            if (op.selected) {
                // extra pain for IE...
                var v = $.browser.msie && !(op.attributes['value'].specified) ? op.text : op.value;
                if (one) return v;
                a.push(v);
            }
        }
        return a;
    }
    return el.value;
};


/**
 * Clears the form data.  Takes the following actions on the form's input fields:
 *  - input text fields will have their 'value' property set to the empty string
 *  - select elements will have their 'selectedIndex' property set to -1
 *  - checkbox and radio inputs will have their 'checked' property set to false
 *  - inputs of type submit, button, reset, and hidden will *not* be effected
 *  - button elements will *not* be effected
 *
 * @example $('form').clearForm();
 * @desc Clears all forms on the page.
 *
 * @name clearForm
 * @type jQuery
 * @cat Plugins/Form
 */
$.fn.clearForm = function() {
    return this.each(function() {
        $('input,select,textarea', this).clearFields();
    });
};

/**
 * Clears the selected form elements.  Takes the following actions on the matched elements:
 *  - input text fields will have their 'value' property set to the empty string
 *  - select elements will have their 'selectedIndex' property set to -1
 *  - checkbox and radio inputs will have their 'checked' property set to false
 *  - inputs of type submit, button, reset, and hidden will *not* be effected
 *  - button elements will *not* be effected
 *
 * @example $('.myInputs').clearFields();
 * @desc Clears all inputs with class myInputs
 *
 * @name clearFields
 * @type jQuery
 * @cat Plugins/Form
 */
$.fn.clearFields = $.fn.clearInputs = function() {
    return this.each(function() {
        var t = this.type, tag = this.tagName.toLowerCase();
        if (t == 'text' || t == 'password' || tag == 'textarea')
            this.value = '';
        else if (t == 'checkbox' || t == 'radio')
            this.checked = false;
        else if (tag == 'select')
            this.selectedIndex = -1;
    });
};


/**
 * Resets the form data.  Causes all form elements to be reset to their original value.
 *
 * @example $('form').resetForm();
 * @desc Resets all forms on the page.
 *
 * @name resetForm
 * @type jQuery
 * @cat Plugins/Form
 */
$.fn.resetForm = function() {
    return this.each(function() {
        // guard against an input with the name of 'reset'
        // note that IE reports the reset function as an 'object'
        if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
            this.reset();
    });
};


/**
 * Enables or disables any matching elements.
 *
 * @example $(':radio').enabled(false);
 * @desc Disables all radio buttons
 *
 * @name select
 * @type jQuery
 * @cat Plugins/Form
 */
$.fn.enable = function(b) { 
    if (b == undefined) b = true;
    return this.each(function() { 
        this.disabled = !b 
    });
};

/**
 * Checks/unchecks any matching checkboxes or radio buttons and
 * selects/deselects and matching option elements.
 *
 * @example $(':checkbox').selected();
 * @desc Checks all checkboxes
 *
 * @name select
 * @type jQuery
 * @cat Plugins/Form
 */
$.fn.select = function(select) {
    if (select == undefined) select = true;
    return this.each(function() { 
        var t = this.type;
        if (t == 'checkbox' || t == 'radio')
            this.checked = select;
        else if (this.tagName.toLowerCase() == 'option') {
            var $sel = $(this).parent('select');
            if (select && $sel[0] && $sel[0].type == 'select-one') {
                // deselect all other options
                $sel.find('option').select(false);
            }
            this.selected = select;
        }
    });
};

})(jQuery);
/*
 * Autocomplete - jQuery plugin 1.0 Beta
 *
 * Copyright (c) 2007 Dylan Verheul, Dan G. Switzer, Anjesh Tuladhar, Jörn Zaefferer
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.autocomplete.js 5326 2008-04-26 20:17:44Z dswitzer $
 *
 */

/**
 * Provide autocomplete for text-inputs or textareas.
 *
 * Depends on dimensions plugin's offset method for correct positioning of the select box and bgiframe plugin
 * to fix IE's problem with selects.
 *
 * @example $("#input_box").autocomplete("my_autocomplete_backend.php");
 * @before <input id="input_box" />
 * @desc Autocomplete a text-input with remote data. For small to giant datasets.
 *
 * When the user starts typing, a request is send to the specified backend ("my_autocomplete_backend.php"),
 * with a GET parameter named q that contains the current value of the input box and a paremeter "limit" with
 * the value specified for the max option.
 *
 * A value of "foo" would result in this request url: my_autocomplete_backend.php?q=foo&limit=10
 *
 * The result must return with one value on each line. The result is presented in the order
 * the backend sends it.
 *
 * @example $("#input_box").autocomplete(["Cologne", "Berlin", "Munich"]);
 * @before <input id="input_box" />
 * @desc Autcomplete a text-input with local data. For small datasets.
 *
 * @example $.getJSON("my_backend.php", function(data) {
 *   $("#input_box").autocomplete(data);
 * });
 * @before <input id="input_box" />
 * @desc Autcomplete a text-input with data received via AJAX. For small to medium sized datasets.
 *
 * @example $("#mytextarea").autocomplete(["Cologne", "Berlin", "Munich"], {
 *  multiple: true
 * });
 * @before <textarea id="mytextarea" />
 * @desc Autcomplete a textarea with local data (for small datasets). Once the user chooses one
 * value, a separator is appended (by default a comma, see multipleSeparator option) and more values
 * are autocompleted.
 *
 * @name autocomplete
 * @cat Plugins/Autocomplete
 * @type $
 * @param String|Array urlOrData Pass either an URL for remote-autocompletion or an array of data for local auto-completion
 * @param Map options Optional settings
 * @option String inputClass This class will be added to the input box. Default: "ac_input"
 * @option String resultsClass The class for the UL that will contain the result items (result items are LI elements). Default: "ac_results"
 * @option String loadingClass The class for the input box while results are being fetched from the server. Default: "ac_loading"
 * @option Number minChars The minimum number of characters a user has to type before the autocompleter activates. Default: 1
 * @option Number delay The delay in milliseconds the autocompleter waits after a keystroke to activate itself. Default: 400 for remote, 10 for local
 * @option Number cacheLength The number of backend query results to store in cache. If set to 1 (the current result), no caching will happen. Do not set below 1. Default: 10
 * @option Boolean matchSubset Whether or not the autocompleter can use a cache for more specific queries. This means that all matches of "foot" are a subset of all matches for "foo". Usually this is true, and using this options decreases server load and increases performance. Only useful with cacheLength settings bigger than one, like 10. Default: true
 * @option Boolean matchCase Whether or not the comparison is case sensitive. Important only if you use caching. Default: false
 * @option Boolean matchContains Whether or not the comparison looks inside (i.e. does "ba" match "foo bar") the search results. Important only if you use caching. Don't mix with autofill. Default: false
 * @option Booolean mustMatch If set to true, the autocompleter will only allow results that are presented by the backend. Note that illegal values result in an empty input box. Default: false
 * @option Object extraParams Extra parameters for the backend. If you were to specify { bar:4 }, the autocompleter would call my_autocomplete_backend.php?q=foo&bar=4 (assuming the input box contains "foo"). The param can be a function that is called to calculate the param before each request. Default: none
 * @option Boolean selectFirst If this is set to true, the first autocomplete value will be automatically selected on tab/return, even if it has not been handpicked by keyboard or mouse action. If there is a handpicked (highlighted) result, that result will take precedence. Default: true
 * @option Function formatItem Provides advanced markup for an item. For each row of results, this function will be called. The returned value will be displayed inside an LI element in the results list. Autocompleter will provide 4 parameters: the results row, the position of the row in the list of results (starting at 1), the number of items in the list of results and the search term. Default: none, assumes that a single row contains a single value.
 * @option Function formatMatch This defaults to the formatItem (for backwards compatibility) and is supplied with the same arguments. Use this option if you want to limit the data that autocomplete actuall searches for matches. For example, there may be items you want displayed to the user, but don't want included in the data that's searched.
 * @option Function formatResult Similar to formatItem, but provides the formatting for the value to be put into the input field. Again three arguments: Data, position (starting with one) and total number of data. Default: none, assumes either plain data to use as result or uses the same value as provided by formatItem.
 * @option Boolean multiple Whether to allow more than one autocomplted-value to enter. Default: false
 * @option String multipleSeparator Seperator to put between values when using multiple option. Default: ", "
 * @option Number width Specify a custom width for the select box. Default: width of the input element
 * @option Boolean autoFill Fill the textinput while still selecting a value, replacing the value if more is typed or something else is selected. Default: false
 * @option Number max Limit the number of items in the select box. Is also sent as a "limit" parameter with a remote request. Default: 10
 * @option Boolean|Function highlight Whether and how to highlight matches in the select box. Set to false to disable. Set to a function to customize. The function gets the value as the first argument and the search term as the second and must return the formatted value. Default: Wraps the search term in a <strong> element 
 * @option Boolean scroll Whether to scroll when more results than configured via scrollHeight are available. Default: true 
 * @option Number scrollHeight height of scrolled autocomplete control in pixels
 * @option String attachTo The element to attach the autocomplete list to. Useful if used inside a modal window like Thickbox. Default: body -MM
 */

/**
 * Handle the result of a search event. Is executed when the user selects a value or a
 * programmatic search event is triggered (see search()).
 *
 * You can add and remove (using unbind("result")) this event at any time.
 *
 * @example $('input#suggest').result(function(event, data, formatted) {
 *   $("#result").html( !data ? "No match!" : "Selected: " + formatted);
 * });
 * @desc Bind a handler to the result event to display the selected value in a #result element.
 *    The first argument is a generic event object, in this case with type "result".
 *    The second argument refers to the selected data, which can be a plain string value or an array or object.
 *    The third argument is the formatted value that is inserted into the input field.
 *
 * @param Function handler The event handler, gets a default event object as first and
 * 		the selected list item as second argument.
 * @name result
 * @cat Plugins/Autocomplete
 * @type $
 */

/**
 * Trigger a search event. See result(Function) for binding to that event.
 *
 * A search event mimics the same behaviour as when the user selects a value from
 * the list of autocomplete items. You can use it to execute anything that does something
 * with the selected value, beyond simply putting the value into the input and submitting it.
 *
 * @example $('input#suggest').search();
 * @desc Triggers a search event.
 *
 * @name search
 * @cat Plugins/Autocomplete
 * @type $
 */
 
/**
 * Flush (empty) the cache of matched input's autocompleters.
 *
 * @example $('input#suggest').flushCache();
 *
 * @name flushCache
 * @cat Plugins/Autocomplete
 * @type $
 */

/**
 * Updates the options for the current autocomplete field. This allows 
 * you to change things like the URL, max items to display, etc. If you're
 * changing the URL, be sure to remember to call the flushCache() method.
 *
 * @example $('input#suggest').setOptions({
 *  max: 15
 * });
 * @desc Changes the maximum number of items to display to 15.
 *
 * @name setOptions
 * @cat Plugins/Autocomplete
 * @type $
 */

;(function($) {
	
$.fn.extend({
	autocomplete: function(urlOrData, options) {
		var isUrl = typeof urlOrData == "string";
		options = $.extend({}, $.Autocompleter.defaults, {
			url: isUrl ? urlOrData : null,
			data: isUrl ? null : urlOrData,
			delay: isUrl ? $.Autocompleter.defaults.delay : 10,
			max: options && !options.scroll ? 10 : 150
		}, options);
		
		// if highlight is set to false, replace it with a do-nothing function
		options.highlight = options.highlight || function(value) { return value; };
		
		// if the formatMatch option is not specified, then use formatItem for backwards compatibility
		options.formatMatch = options.formatMatch || options.formatItem;
		
		return this.each(function() {
			new $.Autocompleter(this, options);
		});
	},
	result: function(handler) {
		return this.bind("result", handler);
	},
	search: function(handler) {
		return this.trigger("search", [handler]);
	},
	flushCache: function() {
		return this.trigger("flushCache");
	},
	setOptions: function(options){
		return this.trigger("setOptions", [options]);
	},
	unautocomplete: function() {
		return this.trigger("unautocomplete");
	}
});

$.Autocompleter = function(input, options) {

	var KEY = {
		UP: 38,
		DOWN: 40,
		DEL: 46,
		TAB: 9,
		RETURN: 13,
		ESC: 27,
		COMMA: 188,
		PAGEUP: 33,
		PAGEDOWN: 34
	};

	// Create $ object for input element
	var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass);

	var timeout;
	var previousValue = "";
	var cache = $.Autocompleter.Cache(options);
	var hasFocus = 0;
	var lastKeyPressCode;
	var config = {
		mouseDownOnSelect: false
	};
	var select = $.Autocompleter.Select(options, input, selectCurrent, config);
	
	$input.keydown(function(event) {
		// track last key pressed
		lastKeyPressCode = event.keyCode;
		switch(event.keyCode) {
		
			case KEY.UP:
				event.preventDefault();
				if ( select.visible() ) {
					select.prev();
				} else {
					onChange(0, true);
				}
				break;
				
			case KEY.DOWN:
				event.preventDefault();
				if ( select.visible() ) {
					select.next();
				} else {
					onChange(0, true);
				}
				break;
				
			case KEY.PAGEUP:
				event.preventDefault();
				if ( select.visible() ) {
					select.pageUp();
				} else {
					onChange(0, true);
				}
				break;
				
			case KEY.PAGEDOWN:
				event.preventDefault();
				if ( select.visible() ) {
					select.pageDown();
				} else {
					onChange(0, true);
				}
				break;
			
			// matches also semicolon
			case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA:
			case KEY.TAB:
			case KEY.RETURN:
				if( selectCurrent() ){
					// make sure to blur off the current field
					if( !options.multiple )
						$input.blur();
					event.preventDefault();
				}
				break;
				
			case KEY.ESC:
				select.hide();
				break;
				
			default:
				clearTimeout(timeout);
				timeout = setTimeout(onChange, options.delay);
				break;
		}
	}).keypress(function() {
		// having fun with opera - remove this binding and Opera submits the form when we select an entry via return
	}).focus(function(){
		// track whether the field has focus, we shouldn't process any
		// results if the field no longer has focus
		hasFocus++;
	}).blur(function() {
		hasFocus = 0;
		if (!config.mouseDownOnSelect) {
			hideResults();
		}
	}).click(function() {
		// show select when clicking in a focused field
		if ( hasFocus++ > 1 && !select.visible() ) {
			onChange(0, true);
		}
	}).bind("search", function() {
		// TODO why not just specifying both arguments?
		var fn = (arguments.length > 1) ? arguments[1] : null;
		function findValueCallback(q, data) {
			var result;
			if( data && data.length ) {
				for (var i=0; i < data.length; i++) {
					if( data[i].result.toLowerCase() == q.toLowerCase() ) {
						result = data[i];
						break;
					}
				}
			}
			if( typeof fn == "function" ) fn(result);
			else $input.trigger("result", result && [result.data, result.value]);
		}
		$.each(trimWords($input.val()), function(i, value) {
			request(value, findValueCallback, findValueCallback);
		});
	}).bind("flushCache", function() {
		cache.flush();
	}).bind("setOptions", function() {
		$.extend(options, arguments[1]);
		// if we've updated the data, repopulate
		if ( "data" in arguments[1] )
			cache.populate();
	}).bind("unautocomplete", function() {
		select.unbind();
		$input.unbind();
	});
	
	
	function selectCurrent() {
		var selected = select.selected();
		if( !selected )
			return false;
		
		var v = selected.result;
		previousValue = v;
		
		if ( options.multiple ) {
			var words = trimWords($input.val());
			if ( words.length > 1 ) {
				v = words.slice(0, words.length - 1).join( options.multipleSeparator ) + options.multipleSeparator + v;
			}
			v += options.multipleSeparator;
		}
		
		$input.val(v);
		hideResultsNow();
		$input.trigger("result", [selected.data, selected.value]);
		return true;
	}
	
	function onChange(crap, skipPrevCheck) {
		if( lastKeyPressCode == KEY.DEL ) {
			select.hide();
			return;
		}
		
		var currentValue = $input.val();
		
		if ( !skipPrevCheck && currentValue == previousValue )
			return;
		
		previousValue = currentValue;
		
		currentValue = lastWord(currentValue);
		if ( currentValue.length >= options.minChars) {
			$input.addClass(options.loadingClass);
			if (!options.matchCase)
				currentValue = currentValue.toLowerCase();
			request(currentValue, receiveData, hideResultsNow);
		} else {
			stopLoading();
			select.hide();
		}
	};
	
	function trimWords(value) {
		if ( !value ) {
			return [""];
		}
		var words = value.split( options.multipleSeparator );
		var result = [];
		$.each(words, function(i, value) {
			if ( $.trim(value) )
				result[i] = $.trim(value);
		});
		return result;
	}
	
	function lastWord(value) {
		if ( !options.multiple )
			return value;
		var words = trimWords(value);
		return words[words.length - 1];
	}
	
	// fills in the input box w/the first match (assumed to be the best match)
	function autoFill(q, sValue){
		// autofill in the complete box w/the first match as long as the user hasn't entered in more data
		// if the last user key pressed was backspace, don't autofill
		if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != 8 ) {
			// fill in the value (keep the case the user has typed)
			$input.val($input.val() + sValue.substring(lastWord(previousValue).length));
			// select the portion of the value not typed by the user (so the next character will erase)
			$.Autocompleter.Selection(input, previousValue.length, previousValue.length + sValue.length);
		}
	};

	function hideResults() {
		clearTimeout(timeout);
		timeout = setTimeout(hideResultsNow, 200);
	};

	function hideResultsNow() {
		select.hide();
		clearTimeout(timeout);
		stopLoading();
		if (options.mustMatch) {
			// call search and run callback
			$input.search(
				function (result){
					// if no value found, clear the input box
					if( !result ) $input.val("");
				}
			);
		}
	};

	function receiveData(q, data) {
		if ( data && data.length && hasFocus ) {
			stopLoading();
			select.display(data, q);
			autoFill(q, data[0].value);
			select.show();
		} else {
			hideResultsNow();
		}
	};

	function request(term, success, failure) {
		if (!options.matchCase)
			term = term.toLowerCase();
		var data = cache.load(term);
		// recieve the cached data
		if (data && data.length) {
			success(term, data);
		// if an AJAX url has been supplied, try loading the data now
		} else if( (typeof options.url == "string") && (options.url.length > 0) ){
			
			var extraParams = {};
			$.each(options.extraParams, function(key, param) {
				extraParams[key] = typeof param == "function" ? param() : param;
			});
			
			$.ajax({
				// try to leverage ajaxQueue plugin to abort previous requests
				mode: "abort",
				// limit abortion to this input
				port: "autocomplete" + input.name,
				dataType: options.dataType,
				url: options.url,
				data: $.extend({
					q: lastWord(term),
					limit: options.max
				}, extraParams),
				success: function(data) {
					var parsed = options.parse && options.parse(data) || parse(data);
					cache.add(term, parsed);
					success(term, parsed);
				}
			});
		} else {
			// if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match
			select.emptyList();
			failure(term);
		}
	};
	
	function parse(data) {
		var parsed = [];
		var rows = data.split("\n");
		for (var i=0; i < rows.length; i++) {
			var row = $.trim(rows[i]);
			if (row) {
				row = row.split("|");
				parsed[parsed.length] = {
					data: row,
					value: row[0],
					result: options.formatResult && options.formatResult(row, row[0]) || row[0]
				};
			}
		}
		return parsed;
	};

	function stopLoading() {
		$input.removeClass(options.loadingClass);
	};

};

$.Autocompleter.defaults = {
	inputClass: "ac_input",
	resultsClass: "ac_results",
	loadingClass: "ac_loading",
	minChars: 1,
	delay: 400,
	matchCase: false,
	matchSubset: true,
	matchContains: false,
	cacheLength: 10,
	max: 100,
	mustMatch: false,
	extraParams: {},
	selectFirst: true,
	formatItem: function(row) { return row[0]; },
	formatMatch: null,
	autoFill: false,
	width: 0,
	multiple: false,
	multipleSeparator: ", ",
	highlight: function(value, term) {
		return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");
	},
    scroll: true,
    scrollHeight: 180,
	attachTo: 'body'
};

$.Autocompleter.Cache = function(options) {

	var data = {};
	var length = 0;
	
	function matchSubset(s, sub) {
		if (!options.matchCase) 
			s = s.toLowerCase();
		var i = s.indexOf(sub);
		if (i == -1) return false;
		return i == 0 || options.matchContains;
	};
	
	function add(q, value) {
		if (length > options.cacheLength){
			flush();
		}
		if (!data[q]){ 
			length++;
		}
		data[q] = value;
	}
	
	function populate(){
		if( !options.data ) return false;
		// track the matches
		var stMatchSets = {},
			nullData = 0;

		// no url was specified, we need to adjust the cache length to make sure it fits the local data store
		if( !options.url ) options.cacheLength = 1;
		
		// track all options for minChars = 0
		stMatchSets[""] = [];
		
		// loop through the array and create a lookup structure
		for ( var i = 0, ol = options.data.length; i < ol; i++ ) {
			var rawValue = options.data[i];
			// if rawValue is a string, make an array otherwise just reference the array
			rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue;
			
			var value = options.formatMatch(rawValue, i+1, options.data.length);
			if ( value === false )
				continue;
				
			var firstChar = value.charAt(0).toLowerCase();
			// if no lookup array for this character exists, look it up now
			if( !stMatchSets[firstChar] ) 
				stMatchSets[firstChar] = [];

			// if the match is a string
			var row = {
				value: value,
				data: rawValue,
				result: options.formatResult && options.formatResult(rawValue) || value
			};
			
			// push the current match into the set list
			stMatchSets[firstChar].push(row);

			// keep track of minChars zero items
			if ( nullData++ < options.max ) {
				stMatchSets[""].push(row);
			}
		};

		// add the data items to the cache
		$.each(stMatchSets, function(i, value) {
			// increase the cache size
			options.cacheLength++;
			// add to the cache
			add(i, value);
		});
	}
	
	// populate any existing data
	setTimeout(populate, 25);
	
	function flush(){
		data = {};
		length = 0;
	}
	
	return {
		flush: flush,
		add: add,
		populate: populate,
		load: function(q) {
			if (!options.cacheLength || !length)
				return null;
			/* 
			 * if dealing w/local data and matchContains than we must make sure
			 * to loop through all the data collections looking for matches
			 */
			if( !options.url && options.matchContains ){
				// track all matches
				var csub = [];
				// loop through all the data grids for matches
				for( var k in data ){
					// don't search through the stMatchSets[""] (minChars: 0) cache
					// this prevents duplicates
					if( k.length > 0 ){
						var c = data[k];
						$.each(c, function(i, x) {
							// if we've got a match, add it to the array
							if (matchSubset(x.value, q)) {
								csub.push(x);
							}
						});
					}
				}				
				return csub;
			} else 
			// if the exact item exists, use it
			if (data[q]){
				return data[q];
			} else
			if (options.matchSubset) {
				for (var i = q.length - 1; i >= options.minChars; i--) {
					var c = data[q.substr(0, i)];
					if (c) {
						var csub = [];
						$.each(c, function(i, x) {
							if (matchSubset(x.value, q)) {
								csub[csub.length] = x;
							}
						});
						return csub;
					}
				}
			}
			return null;
		}
	};
};

$.Autocompleter.Select = function (options, input, select, config) {
	var CLASSES = {
		ACTIVE: "ac_over"
	};
	
	var listItems,
		active = -1,
		data,
		term = "",
		needsInit = true,
		element,
		list;
	
	// Create results
	function init() {
		if (!needsInit)
			return;
		element = $("<div/>")
		.hide()
		.addClass(options.resultsClass)
		.css("position", "absolute")
		.appendTo(options.attachTo);
	
		list = $("<ul>").appendTo(element).mouseover( function(event) {
			if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') {
	            active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event));
			    $(target(event)).addClass(CLASSES.ACTIVE);            
	        }
		}).click(function(event) {
			$(target(event)).addClass(CLASSES.ACTIVE);
			select();
			input.focus();
			return false;
		}).mousedown(function() {
			config.mouseDownOnSelect = true;
		}).mouseup(function() {
			config.mouseDownOnSelect = false;
		});
		
		if( options.width > 0 )
			element.css("width", options.width);
			
		needsInit = false;
	} 
	
	function target(event) {
		var element = event.target;
		while(element && element.tagName != "LI")
			element = element.parentNode;
		// more fun with IE, sometimes event.target is empty, just ignore it then
		if(!element)
			return [];
		return element;
	}

	function moveSelect(step) {
		listItems.slice(active, active + 1).removeClass();
		movePosition(step);
        var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE);
        if(options.scroll) {
            var offset = 0;
            listItems.slice(0, active).each(function() {
				offset += this.offsetHeight;
			});
            if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) {
                list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight());
            } else if(offset < list.scrollTop()) {
                list.scrollTop(offset);
            }
        }
	};
	
	function movePosition(step) {
		active += step;
		if (active < 0) {
			active = listItems.size() - 1;
		} else if (active >= listItems.size()) {
			active = 0;
		}
	}
	
	function limitNumberOfItems(available) {
		return options.max && options.max < available
			? options.max
			: available;
	}
	
	function fillList() {
		list.empty();
		var max = limitNumberOfItems(data.length);
		for (var i=0; i < max; i++) {
			if (!data[i])
				continue;
			var formatted = options.formatItem(data[i].data, i+1, max, data[i].value, term);
			if ( formatted === false )
				continue;
			var li = $("<li>").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ac_event" : "ac_odd").appendTo(list)[0];
			$.data(li, "ac_data", data[i]);
		}
		listItems = list.find("li");
		if ( options.selectFirst ) {
			listItems.slice(0, 1).addClass(CLASSES.ACTIVE);
			active = 0;
		}
		list.bgiframe();
	}
	
	return {
		display: function(d, q) {
			init();
			data = d;
			term = q;
			fillList();
		},
		next: function() {
			moveSelect(1);
		},
		prev: function() {
			moveSelect(-1);
		},
		pageUp: function() {
			if (active != 0 && active - 8 < 0) {
				moveSelect( -active );
			} else {
				moveSelect(-8);
			}
		},
		pageDown: function() {
			if (active != listItems.size() - 1 && active + 8 > listItems.size()) {
				moveSelect( listItems.size() - 1 - active );
			} else {
				moveSelect(8);
			}
		},
		hide: function() {
			element && element.hide();
			active = -1;
		},
		visible : function() {
			return element && element.is(":visible");
		},
		current: function() {
			return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]);
		},
		show: function() {
			var offset = $(input).offset();
			element.css({
				width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(),
				top: offset.top + input.offsetHeight,
				left: offset.left
			}).show();
            if(options.scroll) {
                list.scrollTop(0);
                list.css({
					maxHeight: options.scrollHeight,
					overflow: 'auto'
				});
				
                if($.browser.msie && typeof document.body.style.maxHeight === "undefined") {
					var listHeight = 0;
					listItems.each(function() {
						listHeight += this.offsetHeight;
					});
					var scrollbarsVisible = listHeight > options.scrollHeight;
                    list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight );
					if (!scrollbarsVisible) {
						// IE doesn't recalculate width when scrollbar disappears
						listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) );
					}
                }
                
            }
		},
		selected: function() {
			var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);
			return selected && selected.length && $.data(selected[0], "ac_data");
		},
		emptyList: function (){
			// only empty the list if it doesn't exist
			if( list ) list.empty();
		},
		unbind: function() {
			element && element.remove();
		}
	};
};

$.Autocompleter.Selection = function(field, start, end) {
	if( field.createTextRange ){
		var selRange = field.createTextRange();
		selRange.collapse(true);
		selRange.moveStart("character", start);
		selRange.moveEnd("character", end);
		selRange.select();
	} else if( field.setSelectionRange ){
		field.setSelectionRange(start, end);
	} else {
		if( field.selectionStart ){
			field.selectionStart = start;
			field.selectionEnd = end;
		}
	}
	field.focus();
};

})(jQuery);/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2007-09-11 05:38:31 +0300 (Вт, 11 сен 2007) $
 * $Rev: 3238 $
 *
 * Version: @VERSION
 *
 * Requires: jQuery 1.2+
 */

(function($){
	
$.dimensions = {
	version: '@VERSION'
};

// Create innerHeight, innerWidth, outerHeight and outerWidth methods
$.each( [ 'Height', 'Width' ], function(i, name){
	
	// innerHeight and innerWidth
	$.fn[ 'inner' + name ] = function() {
		if (!this[0]) return;
		
		var torl = name == 'Height' ? 'Top'    : 'Left',  // top or left
		    borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
		
		return this[ name.toLowerCase() ]() + num(this, 'padding' + torl) + num(this, 'padding' + borr);
	};
	
	// outerHeight and outerWidth
	$.fn[ 'outer' + name ] = function(options) {
		if (!this[0]) return;
		
		var torl = name == 'Height' ? 'Top'    : 'Left',  // top or left
		    borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
		
		options = $.extend({ margin: false }, options || {});
		
		return this[ name.toLowerCase() ]()
				+ num(this, 'border' + torl + 'Width') + num(this, 'border' + borr + 'Width')
				+ num(this, 'padding' + torl) + num(this, 'padding' + borr)
				+ (options.margin ? (num(this, 'margin' + torl) + num(this, 'margin' + borr)) : 0);
	};
});

// Create scrollLeft and scrollTop methods
$.each( ['Left', 'Top'], function(i, name) {
	$.fn[ 'scroll' + name ] = function(val) {
		if (!this[0]) return;
		
		return val != undefined ?
		
			// Set the scroll offset
			this.each(function() {
				this == window || this == document ?
					window.scrollTo( 
						name == 'Left' ? val : $(window)[ 'scrollLeft' ](),
						name == 'Top'  ? val : $(window)[ 'scrollTop'  ]()
					) :
					this[ 'scroll' + name ] = val;
			}) :
			
			// Return the scroll offset
			this[0] == window || this[0] == document ?
				self[ (name == 'Left' ? 'pageXOffset' : 'pageYOffset') ] ||
					$.boxModel && document.documentElement[ 'scroll' + name ] ||
					document.body[ 'scroll' + name ] :
				this[0][ 'scroll' + name ];
	};
});

$.fn.extend({
	position: function() {
		var left = 0, top = 0, elem = this[0], offset, parentOffset, offsetParent, results;
		
		if (elem) {
			// Get *real* offsetParent
			offsetParent = this.offsetParent();
			
			// Get correct offsets
			offset       = this.offset();
			parentOffset = offsetParent.offset();
			
			// Subtract element margins
			offset.top  -= num(elem, 'marginTop');
			offset.left -= num(elem, 'marginLeft');
			
			// Add offsetParent borders
			parentOffset.top  += num(offsetParent, 'borderTopWidth');
			parentOffset.left += num(offsetParent, 'borderLeftWidth');
			
			// Subtract the two offsets
			results = {
				top:  offset.top  - parentOffset.top,
				left: offset.left - parentOffset.left
			};
		}
		
		return results;
	},
	
	offsetParent: function() {
		var offsetParent = this[0].offsetParent;
		while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && $.css(offsetParent, 'position') == 'static') )
			offsetParent = offsetParent.offsetParent;
		return $(offsetParent);
	}
});

var num = function(el, prop) {
	return parseInt($.css(el.jquery?el[0]:el,prop))||0;
};

})(jQuery);/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2007-07-22 01:45:56 +0200 (Son, 22 Jul 2007) $
 * $Rev: 2447 $
 *
 * Version 2.1.1
 */
(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&/6.0/.test(navigator.userAgent)){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild);});}return this;};})(jQuery);/*
 * Thickbox 3.1 - One Box To Rule Them All.
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/
      
var tb_pathToImage = "/obr/loadingThickbox.gif";
/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/
//on page load call tb_init
$(document).ready(function(){   
  tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
  imgLoader = new Image();// preload image
  imgLoader.src = tb_pathToImage;
});
//add thickbox to href & area elements that have a class of .thickbox
function tb_init(domChunk){
  $(domChunk).click(function(){
  var t = this.title || this.name || null;
  var a = this.href || this.alt;
  var g = this.rel || false;
  tb_show(t,a,g);
  this.blur();
  return false;
  });
}
function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link
  try {
    if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
      $("body","html").css({height: "100%", width: "100%"});
      $("html").css("overflow","hidden");
      if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
        $("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
        $("#TB_overlay").click(tb_remove);
      }
    }else{//all others
      if(document.getElementById("TB_overlay") === null){
        $("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
        $("#TB_overlay").click(tb_remove);
      }
    }
    
    if(tb_detectMacXFF()){
      $("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
    }else{
      $("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
    }
    
    if(caption===null){caption="";}
    $("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page
    $('#TB_load').show();//show loader
    
    var baseURL;
     if(url.indexOf("?")!==-1){ //ff there is a query string involved
      baseURL = url.substr(0, url.indexOf("?"));
     }else{ 
         baseURL = url;
     }
     
     var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
     var urlType = baseURL.toLowerCase().match(urlString);
    if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
        
      TB_PrevCaption = "";
      TB_PrevURL = "";
      TB_PrevHTML = "";
      TB_NextCaption = "";
      TB_NextURL = "";
      TB_NextHTML = "";
      TB_imageCount = "";
      TB_FoundURL = false;
      if(imageGroup){
        TB_TempArray = $("a[@rel="+imageGroup+"]").get();
        for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
          var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
            if (!(TB_TempArray[TB_Counter].href == url)) {            
              if (TB_FoundURL) {
                TB_NextCaption = TB_TempArray[TB_Counter].title;
                TB_NextURL = TB_TempArray[TB_Counter].href;
                TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>další &gt;</a></span>";
              } else {
                TB_PrevCaption = TB_TempArray[TB_Counter].title;
                TB_PrevURL = TB_TempArray[TB_Counter].href;
                TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>&lt; předchozí</a></span>";
              }
            } else {
              TB_FoundURL = true;
              TB_imageCount = "Obrázek " + (TB_Counter + 1) +" of "+ (TB_TempArray.length);                      
            }
        }
      }
      imgPreloader = new Image();
      imgPreloader.onload = function(){    
      imgPreloader.onload = null;
        
      // Resizing large images - orginal by Christian Montoya edited by me.
      var pagesize = tb_getPageSize();
      var x = pagesize[0] - 150;
      var y = pagesize[1] - 150;
      var imageWidth = imgPreloader.width;
      var imageHeight = imgPreloader.height;
      if (imageWidth > x) {
        imageHeight = imageHeight * (x / imageWidth); 
        imageWidth = x; 
        if (imageHeight > y) { 
          imageWidth = imageWidth * (y / imageHeight); 
          imageHeight = y; 
        }
      } else if (imageHeight > y) { 
        imageWidth = imageWidth * (y / imageHeight); 
        imageHeight = y; 
        if (imageWidth > x) { 
          imageHeight = imageHeight * (x / imageWidth); 
          imageWidth = x;
        }
      }
      // End Resizing
      
      TB_WIDTH = imageWidth + 30;
      TB_HEIGHT = imageHeight + 60;
      $("#TB_window").append("<a href='' id='TB_ImageOff' title='zavřít'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Zavřít'>zavřít</a> nebo Esc</div>");     
      
      $("#TB_closeWindowButton").click(tb_remove);
      
      if (!(TB_PrevHTML === "")) {
        function goPrev(){
          if($(document).unbind("click",goPrev)){$(document).unbind("click",goPrev);}
          $("#TB_window").remove();
          $("body").append("<div id='TB_window'></div>");
          tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
          return false;  
        }
        $("#TB_prev").click(goPrev);
      }
      
      if (!(TB_NextHTML === "")) {    
        function goNext(){
          $("#TB_window").remove();
          $("body").append("<div id='TB_window'></div>");
          tb_show(TB_NextCaption, TB_NextURL, imageGroup);        
          return false;  
        }
        $("#TB_next").click(goNext);
        
      }
      document.onkeydown = function(e){   
        if (e == null) { // ie
          keycode = event.keyCode;
        } else { // mozilla
          keycode = e.which;
        }
        if(keycode == 27){ // close
          tb_remove();
        } else if(keycode == 190){ // display previous image
          if(!(TB_NextHTML == "")){
            document.onkeydown = "";
            goNext();
          }
        } else if(keycode == 188){ // display next image
          if(!(TB_PrevHTML == "")){
            document.onkeydown = "";
            goPrev();
          }
        }  
      };
      
      tb_position();
      $("#TB_load").remove();
      $("#TB_ImageOff").click(tb_remove);
      $("#TB_window").css({display:"block"}); //for safari using css instead of show
      };
      
      imgPreloader.src = url;
    }else{//code to show html
      
      var queryString = url.replace(/^[^\?]+\??/,'');
      var params = tb_parseQuery( queryString );
      TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL
      TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL
      ajaxContentW = TB_WIDTH - 30;
      ajaxContentH = TB_HEIGHT - 45;
      
      if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window    
          urlNoQuery = url.split('TB_');
          $("#TB_iframeContent").remove();
          if(params['modal'] != "true"){//iframe no modal
            $("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");
          }else{//iframe modal
          $("#TB_overlay").unbind();
            $("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>");
          }
      }else{// not an iframe, ajax
          if($("#TB_window").css("display") != "block"){
            if(params['modal'] != "true"){//ajax no modal
            $("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>close</a> or Esc Key</div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");
            }else{//ajax modal
            $("#TB_overlay").unbind();
            $("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");  
            }
          }else{//this means the window is already up, we are just loading new content via ajax
            $("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
            $("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
            $("#TB_ajaxContent")[0].scrollTop = 0;
            $("#TB_ajaxWindowTitle").html(caption);
          }
      }
          
      $("#TB_closeWindowButton").click(tb_remove);
      
        if(url.indexOf('TB_inline') != -1){  
          $("#TB_ajaxContent").append($('#' + params['inlineId']).children());
          $("#TB_window").unload(function () {
            $('#' + params['inlineId']).append( $("#TB_ajaxContent").children() ); // move elements back when you're finished
          });
          tb_position();
          $("#TB_load").remove();
          $("#TB_window").css({display:"block"}); 
        }else if(url.indexOf('TB_iframe') != -1){
          tb_position();
          if($.browser.safari){//safari needs help because it will not fire iframe onload
            $("#TB_load").remove();
            $("#TB_window").css({display:"block"});
          }
        }else{
          $("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method
            tb_position();
            $("#TB_load").remove();
            tb_init("#TB_ajaxContent a.thickbox");
            $("#TB_window").css({display:"block"});
          });
        }
      
    }
    if(!params['modal']){
      document.onkeyup = function(e){   
        if (e == null) { // ie
          keycode = event.keyCode;
        } else { // mozilla
          keycode = e.which;
        }
        if(keycode == 27){ // close
          tb_remove();
        }  
      };
    }
    
  } catch(e) {
    //nothing here
  }
}
//helper functions below
function tb_showIframe(){
  $("#TB_load").remove();
  $("#TB_window").css({display:"block"});
}
function tb_remove() {
   $("#TB_imageOff").unbind("click");
  $("#TB_closeWindowButton").unbind("click");
  $("#TB_window").fadeOut("fast",function(){$('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});
  $("#TB_load").remove();
  if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
    $("body","html").css({height: "auto", width: "auto"});
    $("html").css("overflow","");
  }
  document.onkeydown = "";
  document.onkeyup = "";
  return false;
}
function tb_position() {
$("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
  if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
    $("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
  }
}
function tb_parseQuery ( query ) {
   var Params = {};
   if ( ! query ) {return Params;}// return empty object
   var Pairs = query.split(/[;&]/);
   for ( var i = 0; i < Pairs.length; i++ ) {
      var KeyVal = Pairs[i].split('=');
      if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
      var key = unescape( KeyVal[0] );
      var val = unescape( KeyVal[1] );
      val = val.replace(/\+/g, ' ');
      Params[key] = val;
   }
   return Params;
}
function tb_getPageSize(){
  var de = document.documentElement;
  var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
  var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
  arrayPageSize = [w,h];
  return arrayPageSize;
}
function tb_detectMacXFF() {
  var userAgent = navigator.userAgent.toLowerCase();
  if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
    return true;
  }
}
tinyMCE.init({
	mode : "textareas",
	editor_selector: "tinyMCEsimple",
	theme : "advanced",
	theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,undo,redo,separator,bullist,numlist,separator,link,unlink",
	theme_advanced_buttons2 : "",
	theme_advanced_buttons3 : "",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "none",
	theme_advanced_resizing : true,
	theme_advanced_resize_horizontal: false, 
	entity_encoding : "raw",
	extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style|title]"
});

tinyMCE.init({
	mode : "textareas",
	editor_selector: "tinyMCEadvanced",
	theme : "advanced",
	plugins : "table",
	theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,,undo,redo,link,unlink,separator,cut,copy,paste,pastetext,separator,bullist,numlist,separator,forecolor,backcolor",
	theme_advanced_buttons2 : "tablecontrols,code",
	theme_advanced_buttons3 : "",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "center",
	theme_advanced_statusbar_location : "none",
	theme_advanced_resizing : true,
	theme_advanced_resize_horizontal: false,
	entity_encoding : "raw", 
	extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style|title]"
});
$(document).ready
(
  function()
  {
    /* NAPOVEDA */

	$(".napoveda,.cnapoveda").tooltip
	(
		{
			track: true,
			delay: 0,
			showURL: false,
			opacity: 1,
			fixPNG: true,
			showBody: " ~ ",
			extraClass: "pretty fancy",
			top: -15,
			left: 5
		}
	);
	
	/* konec NAPOVEDA */
	
	$('#upload-button').click
    (
    	function()
    	{
    		$('#upload-loading').removeClass('hidden');
    		$('#upload-file').addClass('hidden');
    	}
    )
    
    
    $('#formAdminKmeny :input[@type=text]').keyup
    (
      function()
      {
        
        var trida = this.className;
        var value = this.value;
        
        if (this.value != this.lastValue)
        {
          $('.stav'+trida).css('color', '');
          $('.stav'+trida).html('<img src="/obr/loading.gif" height="16" width="16" alt="..." /> oveřuji ..');
          
          if (this.timer) 
          {
            clearTimeout(this.timer);
          }
          
          this.timer = setTimeout(function ()
          {
            $.ajax({
              url: '/overeni/kmeny/',
              data: 'value=' + value + '&id=' + trida,
              dataType: 'json',
              type: 'post',
              success: function (j)
              {
                if(j.stav)
                {
                  $('.stav'+trida).css('color', 'green');
                } else
                {
                  $('.stav'+trida).css('color', 'red');
                }
                $('.url'+trida).val(j.url);
                $('.stav'+trida).html(j.text);
              }
            });
          }, 200);
          
          this.lastValue = this.value;
        }
      }
    );
    
    $('#formAdminVetve :input[@type=text]').keyup
    (
      function()
      {
        var trida = this.className;
        var value = this.value;
        var kmen = $('.kmen'+trida+' option:selected').val();
        
        if (this.value != this.lastValue)
        {
          $('.stav'+trida).css('color', '');
          $('.stav'+trida).html('<img src="/obr/loading.gif" height="16" width="16" /> oveřuji ..');
          
          if (this.timer) 
          {
            clearTimeout(this.timer);
          }
          
          this.timer = setTimeout(function ()
          {
            $.ajax({
              url: '/overeni/vetve/',
              data: 'value=' + value + '&id=' + trida + '&kmen=' + kmen,
              dataType: 'json',
              type: 'post',
              success: function (j)
              {
                if(j.stav)
                {
                  $('.stav'+trida).css('color', 'green');
                } else
                {
                  $('.stav'+trida).css('color', 'red');
                }
                $('.url'+trida).val(j.url);
                $('.stav'+trida).html(j.text);
              }
            });
          }, 200);
          
          this.lastValue = this.value;
        }
      }
    );
    
    $('#formAdminListy :input[@type=text]').keyup
    (
      function ()
      {
        var trida = this.className;
        var value = this.value;
        var kmen = $('.kmen'+trida+' option:selected').val();
        var vetev = $('.vetev'+trida+' option:selected').val();
        
        if (this.value != this.lastValue)
        {
          $('.stav'+trida).css('color', '');
          $('.stav'+trida).html('<img src="/obr/loading.gif" height="16" width="16" /> oveřuji ..');
          
          if (this.timer) 
          {
            clearTimeout(this.timer);
          }
          
          this.timer = setTimeout(function ()
          {
            $.ajax({
              url: '/overeni/listy/',
              data: 'value=' + value + '&id=' + trida + '&kmen=' + kmen + '&vetev=' + vetev,
              dataType: 'json',
              type: 'post',
              success: function (j)
              {
                if(j.stav)
                {
                  $('.stav'+trida).css('color', 'green');
                } else
                {
                  $('.stav'+trida).css('color', 'red');
                }
                $('.url'+trida).val(j.url);
                $('.stav'+trida).html(j.text);
              }
            });
          }, 200);
          
          this.lastValue = this.value;
        }
      }
    );
    
    /*
    var upravanickorig = $('#uprava-nick').val();
    $('#uprava-nick').keyup
    (
      function ()
      {
        var value = this.value;
        
        if (this.value != this.lastValue)
        {
          $('.stav-nick').css('color', '');
          $('.stav-nick').html('<img src="/obr/loading.gif" height="16" width="16" /> oveřuji ..');
          
          if (this.timer) 
          {
            clearTimeout(this.timer);
          }
          
          this.timer = setTimeout(function ()
          {
          	if(value == upravanickorig)
          	{
          		$('.stav-nick').css('color', 'green');
          		$('.stav-nick').html('v pořádku');
          	} else
          	{
          		$.ajax({
	              url: '/overeni/nick/',
	              data: 'value=' + value,
	              dataType: 'json',
	              type: 'post',
	              success: function (j)
	              {
	                if(j.stav)
	                {
	                  $('.stav-nick').css('color', 'green');
	                } else
	                {
	                  $('.stav-nick').css('color', 'red');
	                }
	                $('.stav-nick').html(j.text);
	              }
	            });
          	}
          }, 200);
          
          this.lastValue = this.value;
        }
      }
    );
    */
    
    $('#formAdminListy .kmennovy').change
    (
      function ()
      {
        var trida = 'novy';
        var value = this.value;
        var options = '';
        
        if(value != "")
        {
          $('#formAdminListy .vetev'+trida).removeAttr('disabled');
          $.ajax
          ({
            url: '/options/',
            data: 'kategorie=vetve&value='+value,
            dataType: 'json',
            type: 'post',
            success: function (j)
            {
              for (var i = 0; i < j.length; i++)
              {
                options += '<option value="' + j[i].value + '">' + j[i].option + '</option>';
              }
              $('#formAdminListy .vetev'+trida).html(options);
            }
          });
        } else
        {
          $('#formAdminListy .vetev'+trida).html('<option value="">- - -</option>');
          $('#formAdminListy .vetev'+trida).attr('disabled', true);
        }  
      }
    );

    $('#formAdminListy .kmenedit').change
    (
    	function()
    	{
    		var tridy = explode(' ', this.className);
    		var trida = tridy[1];
    		var value = this.value;
	        var options = '';
	        
	        if(value != "")
			{
				$('#formAdminListy .vetev'+trida).removeAttr('disabled');
				$.ajax
				({
					url: '/options/',
					data: 'kategorie=vetve&pom=no&value='+value,
					dataType: 'json',
					type: 'post',
					success: function (j)
					{
						for (var i = 0; i < j.length; i++)
						{
							options += '<option value="' + j[i].value + '">' + j[i].option + '</option>';
						}
						$('#formAdminListy .vetev'+trida).html(options);
					}
				});
			} else
			{
				$('#formAdminListy .vetev'+trida).html('<option value="">- - -</option>');
				$('#formAdminListy .vetev'+trida).attr('disabled', true);
			} 
    		//$('#formAdminListy .vetev'+trida).html('ads');
    	}
    );
    
  /* NOVY POLOZKA */
    
    $('#novy-nazev').keyup
    (
      function()
      {
        var value = this.value;
        var kmen = $('#novy-kmen').val();
        var vetev = $('#nova-vetev').val();
        var list = $('#novy-list').val();
        
        if (this.value != this.lastValue)
        {
          $('#novy-stav').css('color', 'orange');
          $('#novy-stav').html('<img src="/obr/loading.gif" height="16" width="16" /> oveřuji ..');
        
          if (this.timer) 
          {
            clearTimeout(this.timer);
          }
          
          this.timer = setTimeout(function ()
          {
            $.ajax({
              url: '/overeni/nazev/',
              data: 'value=' + value + '&kmen=' + kmen + '&vetev=' + vetev + '&list=' + list,
              dataType: 'json',
              type: 'post',
              success: function (j)
              {
                if(j.stav)
                {
                  $('#novy-stav').css('color', 'green');
                  $('#novy-submit').removeAttr('disabled');
                } else
                {
                  $('#novy-stav').css('color', 'red');
                  $('#novy-submit').attr('disabled', true);
                }
                $('#nova-url').attr('value', j.url);
                $('#novy-stav').html(j.text);
              }
            });
          }, 200);
          
          this.lastValue = this.value;
        }
      }
    );
    
	$('#nova-recenze-submit').attr('disabled', true);
    $('#nova-recenze-nadpis').keyup
    (
      function()
      {
        var value = this.value;
      	var polozka = $('#polozka').val();
      	
        if (this.value != this.lastValue)
        {
          $('#nova-recenze-stav').css('color', 'orange');
          $('#nova-recenze-stav').html('<img src="/obr/loading.gif" height="16" width="16" /> oveřuji ..');
        
          if (this.timer) 
          {
            clearTimeout(this.timer);
          }
          
          this.timer = setTimeout(function ()
          {
            $.ajax({
              url: '/overeni/nazevrecenze/',
              data: 'value=' + value + '&polozka=' + polozka,
              dataType: 'json',
              type: 'post',
              success: function (j)
              {
                if(j.stav)
                {
                  $('#nova-recenze-stav').css('color', 'green');
                  $('#nova-recenze-submit').removeAttr('disabled');
                } else
                {
                  $('#nova-recenze-stav').css('color', 'red');
                  $('#nova-recenze-submit').attr('disabled', true);
                }
                $('#nova-recenze-url').attr('value', j.url);
                $('#nova-recenze-stav').html(j.text);
              }
            });
          }, 200);
          
          this.lastValue = this.value;
        }
      }
    );
    
    $('#nova-vetev').attr('disabled', true);
    $('#novy-nazev').attr('disabled', true);
    $('#novy-submit').attr('disabled', true);
    $('#novy-kmen').change
    (
      function()
      {
        options = '';
        if(this.value == "")
        {
          $('#nova-vetev').attr('disabled', true);
          $('#novy-list').attr('disabled', true);
          $('#novy-list').html('<option value="">- - -</option>');
        } else
        {
          $('#nova-vetev').removeAttr('disabled');
          $('#novy-list').attr('disabled', true);
          $('#novy-list').html('<option value="">- - -</option>');
        }
        $('#novy-nazev').attr('disabled', true);
        
        $.ajax({
          url: '/options/',
          data: 'kategorie=vetve&value='+this.value,
          dataType: 'json',
          type: 'post',
          success: function (j)
          {
            for (var i = 0; i < j.length; i++)
            {
              options += '<option value="' + j[i].value + '">' + j[i].option + '</option>';
            }
            $('#nova-vetev').html(options);
          }
        });
        //poucka:
        $.ajax({
          url: '/poucka/',
          data: 'value='+this.value,
          dataType: 'json',
          type: 'post',
          success: function (j)
          {
            $('#admin-poucka').html(j.text);
          }
        });
      }
    );
    
    $('#novy-list').attr('disabled', true);
    $('#nova-vetev').change
    (
      function()
      {
        options = '';
        if(this.value == "")
        {
          $('#novy-list').attr('disabled', true);
        } else
        {
          $('#novy-list').removeAttr('disabled');
        }
        $('#novy-nazev').attr('disabled', true);
        
        $.ajax({
          url: '/options/',
          data: 'kategorie=listy&value='+this.value,
          dataType: 'json',
          type: 'post',
          success: function (j)
          {
            for (var i = 0; i < j.length; i++)
            {
              options += '<option value="' + j[i].value + '">' + j[i].option + '</option>';
            }
            $('#novy-list').html(options);
          }
        });
      }
    );
    
    $('#novy-list').change
    (
      function()
      {
        if(this.value == "")
        {
          $('#novy-nazev').attr('disabled', true);
        } else
        {
          $('#novy-nazev').removeAttr('disabled');
        }
      }
    );
    
  /* konec NOVA POLOZKA */
  
  /* UPRAVA POLOZKY */
    
    var upravanazevorigpol = $('#uprava-nazev').val();
    var upravaurlorigpol = $('#uprava-url').val();
    
    $('#uprava-nazev').keyup
    (
      function()
      {
        var value = this.value;
        var kmen = $('#uprava-kmen').val();
        var vetev = $('#uprava-vetev').val();
        var list = $('#uprava-list').val();
        var polozka = $('#uprava-polozka').val();
      	
        if (this.value != this.lastValue)
        {
          $('#uprava-stav').css('color', 'orange');
          $('#uprava-stav').html('<img src="/obr/loading.gif" height="16" width="16" /> oveřuji ..');
        
          if (this.timer) 
          {
            clearTimeout(this.timer);
          }
          
          this.timer = setTimeout(function ()
          {
            
            if(value == upravanazevorigpol)
            {
              $('#uprava-stav').css('color', 'green');
              $('#uprava-submit').removeAttr('disabled');
              $('#uprava-stav').html('v pořádku');
              $('#uprava-url').attr('value', upravaurlorigpol);
            } else
            {
              $.ajax({
                url: '/overeni/nazev/',
                data: 'value=' + value + '&kmen=' + kmen + '&vetev=' + vetev + '&list=' + list + '&polozka=' + polozka,
                dataType: 'json',
                type: 'post',
                success: function (j)
                {
                  if(j.stav)
                  {
                    $('#uprava-stav').css('color', 'green');
                    $('#uprava-submit').removeAttr('disabled');
                  } else
                  {
                    $('#uprava-stav').css('color', 'red');
                    $('#uprava-submit').attr('disabled', true);
                  }
                  $('#uprava-url').attr('value', j.url);
                  $('#uprava-stav').html(j.text);
                }
              });
            }
          }, 200);
          
          this.lastValue = this.value;
        }
      }
    );
    
    /* UPRAVA RECENZE */
    
    var upravanazevorig = $('#uprava-recenze-nazev').val();
    var upravaurlorig = $('#uprava-url').val();
    
    $('#uprava-recenze-nazev').keyup
    (
      function()
      {
        var value = this.value;
        var kmen = $('#uprava-kmen').val();
        var vetev = $('#uprava-vetev').val();
        var list = $('#uprava-list').val();
        var polozka = $('#uprava-polozka').val();
        
        if (this.value != this.lastValue)
        {
          $('#uprava-stav').css('color', 'orange');
          $('#uprava-stav').html('<img src="/obr/loading.gif" height="16" width="16" /> oveřuji ..');
        
          if (this.timer) 
          {
            clearTimeout(this.timer);
          }
          
          this.timer = setTimeout(function ()
          {
            if(value == upravanazevorig)
            {
              $('#uprava-stav').css('color', 'green');
              $('#uprava-submit').removeAttr('disabled');
              $('#uprava-stav').html('v pořádku');
              $('#uprava-url').attr('value', upravaurlorig);
            } else
            {
              $.ajax({
                url: '/overeni/nazevrecenze/',
                data: 'value=' + value + '&kmen=' + kmen + '&vetev=' + vetev + '&list=' + list + '&polozka=' + polozka,
                dataType: 'json',
                type: 'post',
                success: function (j)
                {
                  if(j.stav)
                  {
                    $('#uprava-stav').css('color', 'green');
                    $('#uprava-submit').removeAttr('disabled');
                  } else
                  {
                    $('#uprava-stav').css('color', 'red');
                    $('#uprava-submit').attr('disabled', true);
                  }
                  $('#uprava-url').attr('value', j.url);
                  $('#uprava-stav').html(j.text);
                }
              });
            }
          }, 200);
          
          this.lastValue = this.value;
        }
      }
    );    
    
    $('#uprava-kmen').change
    (
      function()
      {
        options = '';
        if(this.value == "")
        {
          $('#uprava-vetev').attr('disabled', true);
          $('#uprava-list').attr('disabled', true);
          $('#uprava-list').html('<option value="">- - -</option>');
          $('#uprava-polozka').attr('disabled', true);
          $('#uprava-polozka').html('<option value="">- - -</option>');
          $('#uprava-submit').attr('disabled', true);
        } else
        {
          $('#uprava-vetev').removeAttr('disabled');
          $('#uprava-list').attr('disabled', true);
          $('#uprava-list').html('<option value="">- - -</option>');
          $('#uprava-polozka').attr('disabled', true);
          $('#uprava-polozka').html('<option value="">- - -</option>');
          $('#uprava-submit').attr('disabled', true);
        }
        $('#uprava-nazev').attr('disabled', true);
        
        $.ajax({
          url: '/options/',
          data: 'kategorie=vetve&value='+this.value,
          dataType: 'json',
          type: 'post',
          success: function (j)
          {
            for (var i = 0; i < j.length; i++)
            {
              options += '<option value="' + j[i].value + '">' + j[i].option + '</option>';
            }
            $('#uprava-vetev').html(options);
          }
        });
        //poucka:
        $.ajax({
          url: '/poucka/',
          data: 'value='+this.value,
          dataType: 'json',
          type: 'post',
          success: function (j)
          {
            $('#admin-poucka').html(j.text);
          }
        });
      }
    );
    
    $('#uprava-vetev').change
    (
      function()
      {
        options = '';
        if(this.value == "")
        {
          $('#uprava-list').attr('disabled', true);
          $('#uprava-list').html('<option value="">- - -</option>');
          $('#uprava-polozka').attr('disabled', true);
          $('#uprava-polozka').html('<option value="">- - -</option>');
        } else
        {
          $('#uprava-list').removeAttr('disabled');
          $('#uprava-polozka').attr('disabled', true);
          $('#uprava-polozka').html('<option value="">- - -</option>');
          $('#uprava-submit').attr('disabled', true);
        }
        $('#uprava-nazev').attr('disabled', true);
        
        $.ajax({
          url: '/options/',
          data: 'kategorie=listy&value='+this.value,
          dataType: 'json',
          type: 'post',
          success: function (j)
          {
            for (var i = 0; i < j.length; i++)
            {
              options += '<option value="' + j[i].value + '">' + j[i].option + '</option>';
            }
            $('#uprava-list').html(options);
          }
        });
      }
    );
    
    $('#uprava-list').change
    (
      function()
      {
      	options = '';
        if(this.value == "")
        {
          $('#uprava-nazev').attr('disabled', true);
          $('#uprava-polozka').attr('disabled', true);
          $('#uprava-polozka').html('<option value="">- - -</option>');
        } else
        {
          $('#uprava-polozka').removeAttr('disabled');
          $('#uprava-submit').attr('disabled', true);
        }
        
        $.ajax({
          url: '/options/',
          data: 'kategorie=polozka&value='+this.value,
          dataType: 'json',
          type: 'post',
          success: function (j)
          {
            for (var i = 0; i < j.length; i++)
            {
              options += '<option value="' + j[i].value + '">' + j[i].option + '</option>';
            }
            $('#uprava-polozka').html(options);
          }
        });
      }
    );
    
    $('#uprava-polozka').change
    (
    	function()
    	{
    		if(this.value == "")
    		{
    			$('#uprava-nazev').attr('disabled', true);
    			$('#uprava-submit').attr('disabled', true);
    		} else
    		{
    			$('#uprava-nazev').removeAttr('disabled');
    			$('#uprava-submit').removeAttr('disabled');
    		}
    	}
    );
    
  /* konec UPRAVA POLOZKY */
  
   /* RAZENI TABULEK *
		$('#radit').tablesorter
		({
			headers:
			{
				//0: { sorter: false}, 
				//1: {sorter: false}
			} 
		});
		$('.radit').tablesorter
		({
			headers:
			{
				//0: { sorter: false}, 
				//1: {sorter: false}
			} 
		});
		$('.novinky-radit').tablesorter
		({
			headers:
			{
				2: {sorter: false}
			} 
		});
		$('#sz-radit').tablesorter
		({
			headers:
			{
				0: { sorter: false}
				//1: {sorter: false}
			} 
		});
		$('#mh-radit').tablesorter
		({
			headers:
			{
				1: { sorter: false}
				//1: {sorter: false}
			} 
		});
		$('#rec-radit').tablesorter //recenze
		({
			headers:
			{
				//0: { sorter: false}, 
				//1: {sorter: false}
			} 
		});
   
   /* konec RAZENI TABULEK */
   
    $('#vybratVse').click
    (
      function()
      {
        var status = $('#vybratVse').attr('checked');
        $('input[type=checkbox]').each
        (
          function()
          {
            this.checked = status;
          }
        );
    
      }
    );
    
    /* HODNOCENI POLOZKY */
    
    $('#formHodnotitPolozka').removeClass('hidden');//style.display = 'block';
    
    $('#formHodnotitPolozka').ajaxForm
    ({
      beforeSubmit: function()
      {
        $('#formHodnotitPolozka').hide("slow");
      },
      success: ohodnoceno,
      url: '/form/hodnotit/polozka/?akce=ajax'
    });
    
    function ohodnoceno(responseText, statusText) 
	{ 
	  text = explode('-',  responseText);
	
	  $('#verdikt-Jsum').text(  text[0]  );
	  $('#cenaVerdikt').text( text[1] );
	  $('#kvalitaVerdikt').text( text[2] );
	  $('#verdikt-Jpocet').text( text[3] );
	} 
    
    /* konec HODNOCENI POLOZKY */
    
    
    $('#novy-vyber').removeClass('hidden');
    $('#uprava-vyber').removeClass('hidden');
    
    /*
    $('#ZadaniCena0').mousedown( function() { bodPruh('ZadaniCena', '0'); bodPruhValue('ZadaniCenaH', '0'); } )
    $('#ZadaniCena5').mousedown( function() { bodPruh('ZadaniCena', '5'); bodPruhValue('ZadaniCenaH', '5'); } )
    $('#ZadaniCena10').mousedown( function() { bodPruh('ZadaniCena', '10'); bodPruhValue('ZadaniCenaH', '10'); } )
    $('#ZadaniCena15').mousedown( function() { bodPruh('ZadaniCena', '15'); bodPruhValue('ZadaniCenaH', '15'); } )
    $('#ZadaniCena20').mousedown( function() { bodPruh('ZadaniCena', '20'); bodPruhValue('ZadaniCenaH', '20'); } )
    $('#ZadaniCena25').mousedown( function() { bodPruh('ZadaniCena', '25'); bodPruhValue('ZadaniCenaH', '25'); } )
    $('#ZadaniCena30').mousedown( function() { bodPruh('ZadaniCena', '30'); bodPruhValue('ZadaniCenaH', '30'); } )
    $('#ZadaniCena35').mousedown( function() { bodPruh('ZadaniCena', '35'); bodPruhValue('ZadaniCenaH', '35'); } )
    $('#ZadaniCena40').mousedown( function() { bodPruh('ZadaniCena', '40'); bodPruhValue('ZadaniCenaH', '40'); } )
    $('#ZadaniCena45').mousedown( function() { bodPruh('ZadaniCena', '45'); bodPruhValue('ZadaniCenaH', '45'); } )
    $('#ZadaniCena50').mousedown( function() { bodPruh('ZadaniCena', '50'); bodPruhValue('ZadaniCenaH', '50'); } )
    $('#ZadaniCena55').mousedown( function() { bodPruh('ZadaniCena', '55'); bodPruhValue('ZadaniCenaH', '55'); } )
    $('#ZadaniCena60').mousedown( function() { bodPruh('ZadaniCena', '60'); bodPruhValue('ZadaniCenaH', '60'); } )
    $('#ZadaniCena65').mousedown( function() { bodPruh('ZadaniCena', '65'); bodPruhValue('ZadaniCenaH', '65'); } )
    $('#ZadaniCena70').mousedown( function() { bodPruh('ZadaniCena', '70'); bodPruhValue('ZadaniCenaH', '70'); } )
    $('#ZadaniCena75').mousedown( function() { bodPruh('ZadaniCena', '75'); bodPruhValue('ZadaniCenaH', '75'); } )
    $('#ZadaniCena80').mousedown( function() { bodPruh('ZadaniCena', '80'); bodPruhValue('ZadaniCenaH', '80'); } )
    $('#ZadaniCena85').mousedown( function() { bodPruh('ZadaniCena', '85'); bodPruhValue('ZadaniCenaH', '85'); } )
    $('#ZadaniCena90').mousedown( function() { bodPruh('ZadaniCena', '90'); bodPruhValue('ZadaniCenaH', '90'); } )
    $('#ZadaniCena95').mousedown( function() { bodPruh('ZadaniCena', '95'); bodPruhValue('ZadaniCenaH', '95'); } )
    $('#ZadaniCena100').mousedown( function() { bodPruh('ZadaniCena', '100'); bodPruhValue('ZadaniCenaH', '100'); } )
    
    $('#ZadaniCena0').mouseover( function() { bodPruh('ZadaniCenaZ', '0'); } )
    $('#ZadaniCena5').mouseover( function() { bodPruh('ZadaniCenaZ', '5'); } )
    $('#ZadaniCena10').mouseover( function() { bodPruh('ZadaniCenaZ', '10'); } )
    $('#ZadaniCena15').mouseover( function() { bodPruh('ZadaniCenaZ', '15'); } )
    $('#ZadaniCena20').mouseover( function() { bodPruh('ZadaniCenaZ', '20'); } )
    $('#ZadaniCena25').mouseover( function() { bodPruh('ZadaniCenaZ', '25'); } )
    $('#ZadaniCena30').mouseover( function() { bodPruh('ZadaniCenaZ', '30'); } )
    $('#ZadaniCena35').mouseover( function() { bodPruh('ZadaniCenaZ', '35'); } )
    $('#ZadaniCena40').mouseover( function() { bodPruh('ZadaniCenaZ', '40'); } )
    $('#ZadaniCena45').mouseover( function() { bodPruh('ZadaniCenaZ', '45'); } )
    $('#ZadaniCena50').mouseover( function() { bodPruh('ZadaniCenaZ', '50'); } )
    $('#ZadaniCena55').mouseover( function() { bodPruh('ZadaniCenaZ', '55'); } )
    $('#ZadaniCena60').mouseover( function() { bodPruh('ZadaniCenaZ', '60'); } )
    $('#ZadaniCena65').mouseover( function() { bodPruh('ZadaniCenaZ', '65'); } )
    $('#ZadaniCena70').mouseover( function() { bodPruh('ZadaniCenaZ', '70'); } )
    $('#ZadaniCena75').mouseover( function() { bodPruh('ZadaniCenaZ', '75'); } )
    $('#ZadaniCena80').mouseover( function() { bodPruh('ZadaniCenaZ', '80'); } )
    $('#ZadaniCena85').mouseover( function() { bodPruh('ZadaniCenaZ', '85'); } )
    $('#ZadaniCena90').mouseover( function() { bodPruh('ZadaniCenaZ', '90'); } )
    $('#ZadaniCena95').mouseover( function() { bodPruh('ZadaniCenaZ', '95'); } )
    $('#ZadaniCena100').mouseover( function() { bodPruh('ZadaniCenaZ', '100'); } )
    
    function bodPruh(nazev, i)
    {
      $('#'+nazev).text(i+'%');
    }
    function bodPruhValue(nazev, i)
    {
      $('#'+nazev).text('a');
    }
    */
    
    $(".stripeMe tr").mouseover
    (
      function()
      {
        $(this).addClass("over");
      }
    ).mouseout
    (
      function()
      {
        $(this).removeClass("over");
      }
    );
    
    $(".stripeRecenze tr").mouseover
    (
      function()
      {
        $(this).addClass("recenze_listOver");
      }
    ).mouseout
    (
      function()
      {
        $(this).removeClass("recenze_listOver");
      }
    );
    
    /* autocomplete */
    $("#prijemce").autocomplete("/form/soukromezpravyautocomplete/"); 
    /* autocomplete */
  }
);


function strpos( haystack, needle, offset)
{  
  var i = haystack.indexOf( needle, offset ); // returns -1
  return i >= 0 ? i : false;
}

function explode( delimiter, string )
{
  var emptyArray = { 0: '' };

  if ( arguments.length != 2
      || typeof arguments[0] == 'undefined'
      || typeof arguments[1] == 'undefined' )
  {
      return null;
  }

  if ( delimiter === ''
      || delimiter === false
      || delimiter === null )
  {
      return false;
  }

  if ( typeof delimiter == 'function'
      || typeof delimiter == 'object'
      || typeof string == 'function'
      || typeof string == 'object' )
  {
      return emptyArray;
  }

  if ( delimiter === true ) {
      delimiter = '1';
  }

  return string.toString().split ( delimiter.toString() );
}

function strpos( haystack, needle, offset)
{
  var i = haystack.indexOf( needle, offset ); // returns -1
  return i >= 0 ? i : false;
}

function oznacitVse( container_id )
{
    var rows = document.getElementById(container_id).getElementsByTagName('tr');
    var unique_id;
    var checkbox;
    
    for ( var i = 0; i < rows.length; i++ ) {

        checkbox = rows[i].getElementsByTagName( 'input' )[0];

        if ( checkbox && checkbox.type == 'checkbox' ) {
            unique_id = checkbox.name + checkbox.value;
            checkbox.checked = true;
        }
    }

    return true;
}

/* GOOGLE adSense */
google_ad_client = "pub-9639241478378569";
/* adsence_levy_sloupec */
google_ad_slot = "4795248738";
google_ad_width = 160;
google_ad_height = 600;
/* konec GOOGLE adSence*/

/* GOOGLE coop */
var googleSearchIframeName = "cse-search-results";
var googleSearchFormName = "cse-search-box";
var googleSearchFrameWidth = 600;
var googleSearchDomain = "www.google.com";
var googleSearchPath = "/cse";
var googleSearchResizeIframe = true;
/* konec GOOGLE coop */

/* PHPmyVISITES zapocet */
var a_vars = Array();
var pagename='';

var phpmyvisitesSite = 1;
var phpmyvisitesURL = "http://localhost/phpmv2/phpmyvisites.php";
/* konec PHPmyVISITES zapocet */

/* PHPmyVISITES vypis *
function strpos(haystack, needle, offset){
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // *     example 1: strpos('Kevin van Zonneveld', 'e', 5);
    // *     returns 1: 14
 
    var i = haystack.indexOf( needle, offset ); // returns -1
    return i >= 0 ? i : false;
}

function substr( f_string, f_start, f_length ) {
    // http://kevin.vanzonneveld.net
    // +     original by: Martijn Wieringa
    // *         example 1: substr('abcdef', 0, -1);
    // *         returns 1: 'abcde'
 
    if(f_start < 0) {
        f_start += f_string.length;
    }
 
    if(f_length == undefined) {
        f_length = f_string.length;
    } else if(f_length < 0){
        f_length += f_string.length;
    } else {
        f_length += f_start;
    }
 
    if(f_length < f_start) {
        f_length = f_start;
    }
 
    return f_string.substring(f_start, f_length);
}

function root()
{
	return substr(''+window.location, 0, strpos(''+window.location, '/', 7));
}

var pmv2c_nbseconds=5;			  	// Time (ins sec) between each refresh (0 no refresh)
var pmv2c_text='$nbVisits<span class="mensi">&nbsp;($pageview dnes)</span>'; // Text to show : $nbVisits (celkem) and $pageview (dnes)will be replace by their values
var pmv2c_calculatingText="...";		// Texte between calculation
var pmv2c_site=1;					// phpMyVisites site id
var pmv2c_objectName='phpmyvisites';  // DIV where you want to write result
var pmv2c_phpmv2Path=root()+'/phpmv2'; 	    // Start url to phpMyVisites 'http://YourServer/phpmv'
/* konec PHPmyVISITES vypis */

/* GOOGLE Analytics */

var pageTracker = _gat._getTracker("UA-4507322-1");
pageTracker._initData();
pageTracker._trackPageview();

/* konec GOOGLE Analytics */

