/*
 * jQuery 1.2.3 - 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-06 06:18:25 +0100 (on, 06 feb 2008) $
 * $Rev: 4660 $
 */
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(1e.3N)L w=1e.3N;L E=1e.3N=J(a,b){K 1B E.2l.4T(a,b)};7(1e.$)L D=1e.$;1e.$=E;L u=/^[^<]*(<(.|\\s)+>)[^>]*$|^#(\\w+)$/;L G=/^.[^:#\\[\\.]*$/;E.1n=E.2l={4T:J(d,b){d=d||T;7(d.15){6[0]=d;6.M=1;K 6}N 7(1o d=="25"){L c=u.2O(d);7(c&&(c[1]||!b)){7(c[1])d=E.4a([c[1]],b);N{L a=T.5J(c[3]);7(a)7(a.2w!=c[3])K E().2s(d);N{6[0]=a;6.M=1;K 6}N d=[]}}N K 1B E(b).2s(d)}N 7(E.1q(d))K 1B E(T)[E.1n.21?"21":"3U"](d);K 6.6E(d.1k==1M&&d||(d.5h||d.M&&d!=1e&&!d.15&&d[0]!=10&&d[0].15)&&E.2I(d)||[d])},5h:"1.2.3",87:J(){K 6.M},M:0,22:J(a){K a==10?E.2I(6):6[a]},2F:J(b){L a=E(b);a.54=6;K a},6E:J(a){6.M=0;1M.2l.1g.1i(6,a);K 6},R:J(a,b){K E.R(6,a,b)},4X:J(b){L a=-1;6.R(J(i){7(6==b)a=i});K a},1J:J(c,a,b){L d=c;7(c.1k==4e)7(a==10)K 6.M&&E[b||"1J"](6[0],c)||10;N{d={};d[c]=a}K 6.R(J(i){Q(c 1p d)E.1J(b?6.W:6,c,E.1l(6,d[c],b,i,c))})},1j:J(b,a){7((b==\'27\'||b==\'1R\')&&2M(a)<0)a=10;K 6.1J(b,a,"2o")},1u:J(b){7(1o b!="3V"&&b!=V)K 6.4x().3t((6[0]&&6[0].2i||T).5r(b));L a="";E.R(b||6,J(){E.R(6.3p,J(){7(6.15!=8)a+=6.15!=1?6.6K:E.1n.1u([6])})});K a},5m:J(b){7(6[0])E(b,6[0].2i).5k().3o(6[0]).2c(J(){L a=6;2b(a.1C)a=a.1C;K a}).3t(6);K 6},8w:J(a){K 6.R(J(){E(6).6z().5m(a)})},8p:J(a){K 6.R(J(){E(6).5m(a)})},3t:J(){K 6.3O(18,P,S,J(a){7(6.15==1)6.38(a)})},6q:J(){K 6.3O(18,P,P,J(a){7(6.15==1)6.3o(a,6.1C)})},6o:J(){K 6.3O(18,S,S,J(a){6.1a.3o(a,6)})},5a:J(){K 6.3O(18,S,P,J(a){6.1a.3o(a,6.2B)})},3h:J(){K 6.54||E([])},2s:J(b){L c=E.2c(6,J(a){K E.2s(b,a)});K 6.2F(/[^+>] [^+>]/.17(b)||b.1f("..")>-1?E.57(c):c)},5k:J(e){L f=6.2c(J(){7(E.14.1d&&!E.3E(6)){L a=6.69(P),4Y=T.3s("1x");4Y.38(a);K E.4a([4Y.3d])[0]}N K 6.69(P)});L d=f.2s("*").4R().R(J(){7(6[F]!=10)6[F]=V});7(e===P)6.2s("*").4R().R(J(i){7(6.15==3)K;L c=E.O(6,"2R");Q(L a 1p c)Q(L b 1p c[a])E.16.1b(d[i],a,c[a][b],c[a][b].O)});K f},1E:J(b){K 6.2F(E.1q(b)&&E.3y(6,J(a,i){K b.1P(a,i)})||E.3e(b,6))},56:J(b){7(b.1k==4e)7(G.17(b))K 6.2F(E.3e(b,6,P));N b=E.3e(b,6);L a=b.M&&b[b.M-1]!==10&&!b.15;K 6.1E(J(){K a?E.33(6,b)<0:6!=b})},1b:J(a){K!a?6:6.2F(E.37(6.22(),a.1k==4e?E(a).22():a.M!=10&&(!a.12||E.12(a,"3u"))?a:[a]))},3H:J(a){K a?E.3e(a,6).M>0:S},7j:J(a){K 6.3H("."+a)},5O:J(b){7(b==10){7(6.M){L c=6[0];7(E.12(c,"2k")){L e=c.3T,5I=[],11=c.11,2X=c.U=="2k-2X";7(e<0)K V;Q(L i=2X?e:0,2f=2X?e+1:11.M;i<2f;i++){L d=11[i];7(d.2p){b=E.14.1d&&!d.9J.1A.9y?d.1u:d.1A;7(2X)K b;5I.1g(b)}}K 5I}N K(6[0].1A||"").1r(/\\r/g,"")}K 10}K 6.R(J(){7(6.15!=1)K;7(b.1k==1M&&/5u|5t/.17(6.U))6.3k=(E.33(6.1A,b)>=0||E.33(6.31,b)>=0);N 7(E.12(6,"2k")){L a=b.1k==1M?b:[b];E("98",6).R(J(){6.2p=(E.33(6.1A,a)>=0||E.33(6.1u,a)>=0)});7(!a.M)6.3T=-1}N 6.1A=b})},3q:J(a){K a==10?(6.M?6[0].3d:V):6.4x().3t(a)},6S:J(a){K 6.5a(a).1V()},6Z:J(i){K 6.2K(i,i+1)},2K:J(){K 6.2F(1M.2l.2K.1i(6,18))},2c:J(b){K 6.2F(E.2c(6,J(a,i){K b.1P(a,i,a)}))},4R:J(){K 6.1b(6.54)},O:J(d,b){L a=d.23(".");a[1]=a[1]?"."+a[1]:"";7(b==V){L c=6.5n("8P"+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("8K"+a[1]+"!",[a[0],b]).R(J(){E.O(6,d,b)})},35:J(a){K 6.R(J(){E.35(6,a)})},3O:J(g,f,h,d){L e=6.M>1,3n;K 6.R(J(){7(!3n){3n=E.4a(g,6.2i);7(h)3n.8D()}L b=6;7(f&&E.12(6,"1O")&&E.12(3n[0],"4v"))b=6.3S("1U")[0]||6.38(6.2i.3s("1U"));L c=E([]);E.R(3n,J(){L a=e?E(6).5k(P)[0]:6;7(E.12(a,"1m")){c=c.1b(a)}N{7(a.15==1)c=c.1b(E("1m",a).1V());d.1P(b,a)}});c.R(6A)})}};E.2l.4T.2l=E.2l;J 6A(i,a){7(a.3Q)E.3P({1c:a.3Q,3l:S,1H:"1m"});N E.5g(a.1u||a.6x||a.3d||"");7(a.1a)a.1a.34(a)}E.1s=E.1n.1s=J(){L b=18[0]||{},i=1,M=18.M,5c=S,11;7(b.1k==8d){5c=b;b=18[1]||{};i=2}7(1o b!="3V"&&1o b!="J")b={};7(M==1){b=6;i=0}Q(;i<M;i++)7((11=18[i])!=V)Q(L a 1p 11){7(b===11[a])6w;7(5c&&11[a]&&1o 11[a]=="3V"&&b[a]&&!11[a].15)b[a]=E.1s(b[a],11[a]);N 7(11[a]!=10)b[a]=11[a]}K b};L F="3N"+(1B 3v()).3L(),6t=0,5b={};L H=/z-?4X|86-?84|1w|6k|7Z-?1R/i;E.1s({7Y:J(a){1e.$=D;7(a)1e.3N=w;K E},1q:J(a){K!!a&&1o a!="25"&&!a.12&&a.1k!=1M&&/J/i.17(a+"")},3E:J(a){K a.1F&&!a.1h||a.28&&a.2i&&!a.2i.1h},5g:J(a){a=E.3g(a);7(a){L b=T.3S("6f")[0]||T.1F,1m=T.3s("1m");1m.U="1u/4m";7(E.14.1d)1m.1u=a;N 1m.38(T.5r(a));b.38(1m);b.34(1m)}},12:J(b,a){K b.12&&b.12.2E()==a.2E()},1T:{},O:J(c,d,b){c=c==1e?5b:c;L a=c[F];7(!a)a=c[F]=++6t;7(d&&!E.1T[a])E.1T[a]={};7(b!=10)E.1T[a][d]=b;K d?E.1T[a][d]:a},35:J(c,b){c=c==1e?5b:c;L a=c[F];7(b){7(E.1T[a]){2V E.1T[a][b];b="";Q(b 1p E.1T[a])1Q;7(!b)E.35(c)}}N{1S{2V c[F]}1X(e){7(c.52)c.52(F)}2V E.1T[a]}},R:J(c,a,b){7(b){7(c.M==10){Q(L d 1p c)7(a.1i(c[d],b)===S)1Q}N Q(L i=0,M=c.M;i<M;i++)7(a.1i(c[i],b)===S)1Q}N{7(c.M==10){Q(L d 1p c)7(a.1P(c[d],d,c[d])===S)1Q}N Q(L i=0,M=c.M,1A=c[0];i<M&&a.1P(1A,i,1A)!==S;1A=c[++i]){}}K c},1l:J(b,a,c,i,d){7(E.1q(a))a=a.1P(b,i);K a&&a.1k==51&&c=="2o"&&!H.17(d)?a+"2S":a},1t:{1b:J(c,b){E.R((b||"").23(/\\s+/),J(i,a){7(c.15==1&&!E.1t.3Y(c.1t,a))c.1t+=(c.1t?" ":"")+a})},1V:J(c,b){7(c.15==1)c.1t=b!=10?E.3y(c.1t.23(/\\s+/),J(a){K!E.1t.3Y(b,a)}).6a(" "):""},3Y:J(b,a){K E.33(a,(b.1t||b).3X().23(/\\s+/))>-1}},68:J(b,c,a){L e={};Q(L d 1p c){e[d]=b.W[d];b.W[d]=c[d]}a.1P(b);Q(L d 1p c)b.W[d]=e[d]},1j:J(d,e,c){7(e=="27"||e=="1R"){L b,46={43:"4W",4U:"1Z",19:"3D"},3c=e=="27"?["7O","7M"]:["7J","7I"];J 5E(){b=e=="27"?d.7H:d.7F;L a=0,2N=0;E.R(3c,J(){a+=2M(E.2o(d,"7E"+6,P))||0;2N+=2M(E.2o(d,"2N"+6+"5X",P))||0});b-=24.7C(a+2N)}7(E(d).3H(":4d"))5E();N E.68(d,46,5E);K 24.2f(0,b)}K E.2o(d,e,c)},2o:J(e,k,j){L d;J 3x(b){7(!E.14.2d)K S;L a=T.4c.4K(b,V);K!a||a.4M("3x")==""}7(k=="1w"&&E.14.1d){d=E.1J(e.W,"1w");K d==""?"1":d}7(E.14.2z&&k=="19"){L c=e.W.50;e.W.50="0 7r 7o";e.W.50=c}7(k.1D(/4g/i))k=y;7(!j&&e.W&&e.W[k])d=e.W[k];N 7(T.4c&&T.4c.4K){7(k.1D(/4g/i))k="4g";k=k.1r(/([A-Z])/g,"-$1").2h();L h=T.4c.4K(e,V);7(h&&!3x(e))d=h.4M(k);N{L f=[],2C=[];Q(L a=e;a&&3x(a);a=a.1a)2C.4J(a);Q(L i=0;i<2C.M;i++)7(3x(2C[i])){f[i]=2C[i].W.19;2C[i].W.19="3D"}d=k=="19"&&f[2C.M-1]!=V?"2H":(h&&h.4M(k))||"";Q(L i=0;i<f.M;i++)7(f[i]!=V)2C[i].W.19=f[i]}7(k=="1w"&&d=="")d="1"}N 7(e.4n){L g=k.1r(/\\-(\\w)/g,J(a,b){K b.2E()});d=e.4n[k]||e.4n[g];7(!/^\\d+(2S)?$/i.17(d)&&/^\\d/.17(d)){L l=e.W.26,3K=e.3K.26;e.3K.26=e.4n.26;e.W.26=d||0;d=e.W.7f+"2S";e.W.26=l;e.3K.26=3K}}K d},4a:J(l,h){L k=[];h=h||T;7(1o h.3s==\'10\')h=h.2i||h[0]&&h[0].2i||T;E.R(l,J(i,d){7(!d)K;7(d.1k==51)d=d.3X();7(1o d=="25"){d=d.1r(/(<(\\w+)[^>]*?)\\/>/g,J(b,a,c){K c.1D(/^(aa|a6|7e|a5|4D|7a|a0|3m|9W|9U|9S)$/i)?b:a+"></"+c+">"});L f=E.3g(d).2h(),1x=h.3s("1x");L e=!f.1f("<9P")&&[1,"<2k 74=\'74\'>","</2k>"]||!f.1f("<9M")&&[1,"<73>","</73>"]||f.1D(/^<(9G|1U|9E|9B|9x)/)&&[1,"<1O>","</1O>"]||!f.1f("<4v")&&[2,"<1O><1U>","</1U></1O>"]||(!f.1f("<9w")||!f.1f("<9v"))&&[3,"<1O><1U><4v>","</4v></1U></1O>"]||!f.1f("<7e")&&[2,"<1O><1U></1U><6V>","</6V></1O>"]||E.14.1d&&[1,"1x<1x>","</1x>"]||[0,"",""];1x.3d=e[1]+d+e[2];2b(e[0]--)1x=1x.5o;7(E.14.1d){L g=!f.1f("<1O")&&f.1f("<1U")<0?1x.1C&&1x.1C.3p:e[1]=="<1O>"&&f.1f("<1U")<0?1x.3p:[];Q(L j=g.M-1;j>=0;--j)7(E.12(g[j],"1U")&&!g[j].3p.M)g[j].1a.34(g[j]);7(/^\\s/.17(d))1x.3o(h.5r(d.1D(/^\\s*/)[0]),1x.1C)}d=E.2I(1x.3p)}7(d.M===0&&(!E.12(d,"3u")&&!E.12(d,"2k")))K;7(d[0]==10||E.12(d,"3u")||d.11)k.1g(d);N k=E.37(k,d)});K k},1J:J(d,e,c){7(!d||d.15==3||d.15==8)K 10;L f=E.3E(d)?{}:E.46;7(e=="2p"&&E.14.2d)d.1a.3T;7(f[e]){7(c!=10)d[f[e]]=c;K d[f[e]]}N 7(E.14.1d&&e=="W")K E.1J(d.W,"9u",c);N 7(c==10&&E.14.1d&&E.12(d,"3u")&&(e=="9r"||e=="9o"))K d.9m(e).6K;N 7(d.28){7(c!=10){7(e=="U"&&E.12(d,"4D")&&d.1a)6Q"U 9i 9h\'t 9g 9e";d.9b(e,""+c)}7(E.14.1d&&/6O|3Q/.17(e)&&!E.3E(d))K d.4z(e,2);K d.4z(e)}N{7(e=="1w"&&E.14.1d){7(c!=10){d.6k=1;d.1E=(d.1E||"").1r(/6M\\([^)]*\\)/,"")+(2M(c).3X()=="96"?"":"6M(1w="+c*6L+")")}K d.1E&&d.1E.1f("1w=")>=0?(2M(d.1E.1D(/1w=([^)]*)/)[1])/6L).3X():""}e=e.1r(/-([a-z])/95,J(a,b){K b.2E()});7(c!=10)d[e]=c;K d[e]}},3g:J(a){K(a||"").1r(/^\\s+|\\s+$/g,"")},2I:J(b){L a=[];7(1o b!="93")Q(L i=0,M=b.M;i<M;i++)a.1g(b[i]);N a=b.2K(0);K a},33:J(b,a){Q(L i=0,M=a.M;i<M;i++)7(a[i]==b)K i;K-1},37:J(a,b){7(E.14.1d){Q(L i=0;b[i];i++)7(b[i].15!=8)a.1g(b[i])}N Q(L i=0;b[i];i++)a.1g(b[i]);K a},57:J(a){L c=[],2r={};1S{Q(L i=0,M=a.M;i<M;i++){L b=E.O(a[i]);7(!2r[b]){2r[b]=P;c.1g(a[i])}}}1X(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.1g(c[i]);K b},2c: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.71(b)}}K c}});L v=8Y.8W.2h();E.14={5K:(v.1D(/.+(?:8T|8S|8R|8O)[\\/: ]([\\d.]+)/)||[])[1],2d:/77/.17(v),2z:/2z/.17(v),1d:/1d/.17(v)&&!/2z/.17(v),48:/48/.17(v)&&!/(8L|77)/.17(v)};L y=E.14.1d?"6H":"75";E.1s({8I:!E.14.1d||T.6F=="79",46:{"Q":"8F","8E":"1t","4g":y,75:y,6H:y,3d:"3d",1t:"1t",1A:"1A",2Y:"2Y",3k:"3k",8C:"8B",2p:"2p",8A:"8z",3T:"3T",6C:"6C",28:"28",12:"12"}});E.R({6B:J(a){K a.1a},8y:J(a){K E.4u(a,"1a")},8x:J(a){K E.2Z(a,2,"2B")},8v:J(a){K E.2Z(a,2,"4t")},8u:J(a){K E.4u(a,"2B")},8t:J(a){K E.4u(a,"4t")},8s:J(a){K E.5i(a.1a.1C,a)},8r:J(a){K E.5i(a.1C)},6z:J(a){K E.12(a,"8q")?a.8o||a.8n.T:E.2I(a.3p)}},J(c,d){E.1n[c]=J(b){L a=E.2c(6,d);7(b&&1o b=="25")a=E.3e(b,a);K 6.2F(E.57(a))}});E.R({6y:"3t",8m:"6q",3o:"6o",8l:"5a",8k:"6S"},J(c,b){E.1n[c]=J(){L a=18;K 6.R(J(){Q(L i=0,M=a.M;i<M;i++)E(a[i])[b](6)})}});E.R({8j:J(a){E.1J(6,a,"");7(6.15==1)6.52(a)},8i:J(a){E.1t.1b(6,a)},8h:J(a){E.1t.1V(6,a)},8g:J(a){E.1t[E.1t.3Y(6,a)?"1V":"1b"](6,a)},1V:J(a){7(!a||E.1E(a,[6]).r.M){E("*",6).1b(6).R(J(){E.16.1V(6);E.35(6)});7(6.1a)6.1a.34(6)}},4x:J(){E(">*",6).1V();2b(6.1C)6.34(6.1C)}},J(a,b){E.1n[a]=J(){K 6.R(b,18)}});E.R(["8f","5X"],J(i,c){L b=c.2h();E.1n[b]=J(a){K 6[0]==1e?E.14.2z&&T.1h["5e"+c]||E.14.2d&&1e["8e"+c]||T.6F=="79"&&T.1F["5e"+c]||T.1h["5e"+c]:6[0]==T?24.2f(24.2f(T.1h["5d"+c],T.1F["5d"+c]),24.2f(T.1h["5L"+c],T.1F["5L"+c])):a==10?(6.M?E.1j(6[0],b):V):6.1j(b,a.1k==4e?a:a+"2S")}});L C=E.14.2d&&4s(E.14.5K)<8c?"(?:[\\\\w*4r-]|\\\\\\\\.)":"(?:[\\\\w\\8b-\\8a*4r-]|\\\\\\\\.)",6v=1B 4q("^>\\\\s*("+C+"+)"),6u=1B 4q("^("+C+"+)(#)("+C+"+)"),6s=1B 4q("^([#.]?)("+C+"*)");E.1s({6r:{"":J(a,i,m){K m[2]=="*"||E.12(a,m[2])},"#":J(a,i,m){K a.4z("2w")==m[2]},":":{89:J(a,i,m){K i<m[3]-0},88:J(a,i,m){K i>m[3]-0},2Z:J(a,i,m){K m[3]-0==i},6Z:J(a,i,m){K m[3]-0==i},3j:J(a,i){K i==0},3J:J(a,i,m,r){K i==r.M-1},6n:J(a,i){K i%2==0},6l:J(a,i){K i%2},"3j-4p":J(a){K a.1a.3S("*")[0]==a},"3J-4p":J(a){K E.2Z(a.1a.5o,1,"4t")==a},"83-4p":J(a){K!E.2Z(a.1a.5o,2,"4t")},6B:J(a){K a.1C},4x:J(a){K!a.1C},82:J(a,i,m){K(a.6x||a.81||E(a).1u()||"").1f(m[3])>=0},4d:J(a){K"1Z"!=a.U&&E.1j(a,"19")!="2H"&&E.1j(a,"4U")!="1Z"},1Z:J(a){K"1Z"==a.U||E.1j(a,"19")=="2H"||E.1j(a,"4U")=="1Z"},80:J(a){K!a.2Y},2Y:J(a){K a.2Y},3k:J(a){K a.3k},2p:J(a){K a.2p||E.1J(a,"2p")},1u:J(a){K"1u"==a.U},5u:J(a){K"5u"==a.U},5t:J(a){K"5t"==a.U},59:J(a){K"59"==a.U},3I:J(a){K"3I"==a.U},58:J(a){K"58"==a.U},6j:J(a){K"6j"==a.U},6i:J(a){K"6i"==a.U},2G:J(a){K"2G"==a.U||E.12(a,"2G")},4D:J(a){K/4D|2k|6h|2G/i.17(a.12)},3Y:J(a,i,m){K E.2s(m[3],a).M},7X:J(a){K/h\\d/i.17(a.12)},7W:J(a){K E.3y(E.3G,J(b){K a==b.Y}).M}}},6g:[/^(\\[) *@?([\\w-]+) *([!*$^~=]*) *(\'?"?)(.*?)\\4 *\\]/,/^(:)([\\w-]+)\\("?\'?(.*?(\\(.*?\\))?[^(]*?)"?\'?\\)/,1B 4q("^([:.#]*)("+C+"+)")],3e:J(a,c,b){L d,2m=[];2b(a&&a!=d){d=a;L f=E.1E(a,c,b);a=f.t.1r(/^\\s*,\\s*/,"");2m=b?c=f.r:E.37(2m,f.r)}K 2m},2s:J(t,p){7(1o t!="25")K[t];7(p&&p.15!=1&&p.15!=9)K[];p=p||T;L d=[p],2r=[],3J,12;2b(t&&3J!=t){L r=[];3J=t;t=E.3g(t);L o=S;L g=6v;L m=g.2O(t);7(m){12=m[1].2E();Q(L i=0;d[i];i++)Q(L c=d[i].1C;c;c=c.2B)7(c.15==1&&(12=="*"||c.12.2E()==12))r.1g(c);d=r;t=t.1r(g,"");7(t.1f(" ")==0)6w;o=P}N{g=/^([>+~])\\s*(\\w*)/i;7((m=g.2O(t))!=V){r=[];L l={};12=m[2].2E();m=m[1];Q(L j=0,3f=d.M;j<3f;j++){L n=m=="~"||m=="+"?d[j].2B:d[j].1C;Q(;n;n=n.2B)7(n.15==1){L h=E.O(n);7(m=="~"&&l[h])1Q;7(!12||n.12.2E()==12){7(m=="~")l[h]=P;r.1g(n)}7(m=="+")1Q}}d=r;t=E.3g(t.1r(g,""));o=P}}7(t&&!o){7(!t.1f(",")){7(p==d[0])d.4l();2r=E.37(2r,d);r=d=[p];t=" "+t.6e(1,t.M)}N{L k=6u;L m=k.2O(t);7(m){m=[0,m[2],m[3],m[1]]}N{k=6s;m=k.2O(t)}m[2]=m[2].1r(/\\\\/g,"");L f=d[d.M-1];7(m[1]=="#"&&f&&f.5J&&!E.3E(f)){L q=f.5J(m[2]);7((E.14.1d||E.14.2z)&&q&&1o q.2w=="25"&&q.2w!=m[2])q=E(\'[@2w="\'+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.2h()=="3V")a="3m";r=E.37(r,d[i].3S(a))}7(m[1]==".")r=E.55(r,m[2]);7(m[1]=="#"){L e=[];Q(L i=0;r[i];i++)7(r[i].4z("2w")==m[2]){e=[r[i]];1Q}r=e}d=r}t=t.1r(k,"")}}7(t){L b=E.1E(t,r);d=r=b.r;t=E.3g(b.t)}}7(t)d=[];7(d&&p==d[0])d.4l();2r=E.37(2r,d);K 2r},55: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.1g(r[i])}K c},1E:J(t,r,h){L d;2b(t&&t!=d){d=t;L p=E.6g,m;Q(L i=0;p[i];i++){m=p[i].2O(t);7(m){t=t.7V(m[0].M);m[2]=m[2].1r(/\\\\/g,"");1Q}}7(!m)1Q;7(m[1]==":"&&m[2]=="56")r=G.17(m[3])?E.1E(m[3],r,P).r:E(r).56(m[3]);N 7(m[1]==".")r=E.55(r,m[2],h);N 7(m[1]=="["){L g=[],U=m[3];Q(L i=0,3f=r.M;i<3f;i++){L a=r[i],z=a[E.46[m[2]]||m[2]];7(z==V||/6O|3Q|2p/.17(m[2]))z=E.1J(a,m[2])||\'\';7((U==""&&!!z||U=="="&&z==m[5]||U=="!="&&z!=m[5]||U=="^="&&z&&!z.1f(m[5])||U=="$="&&z.6e(z.M-m[5].M)==m[5]||(U=="*="||U=="~=")&&z.1f(m[5])>=0)^h)g.1g(a)}r=g}N 7(m[1]==":"&&m[2]=="2Z-4p"){L e={},g=[],17=/(-?)(\\d*)n((?:\\+|-)?\\d*)/.2O(m[3]=="6n"&&"2n"||m[3]=="6l"&&"2n+1"||!/\\D/.17(m[3])&&"7U+"+m[3]||m[3]),3j=(17[1]+(17[2]||1))-0,d=17[3]-0;Q(L i=0,3f=r.M;i<3f;i++){L j=r[i],1a=j.1a,2w=E.O(1a);7(!e[2w]){L c=1;Q(L n=1a.1C;n;n=n.2B)7(n.15==1)n.4k=c++;e[2w]=P}L b=S;7(3j==0){7(j.4k==d)b=P}N 7((j.4k-d)%3j==0&&(j.4k-d)/3j>=0)b=P;7(b^h)g.1g(j)}r=g}N{L f=E.6r[m[1]];7(1o f=="3V")f=f[m[2]];7(1o f=="25")f=6c("S||J(a,i){K "+f+";}");r=E.3y(r,J(a,i){K f(a,i,m,r)},h)}}K{r:r,t:t}},4u:J(b,c){L d=[];L a=b[c];2b(a&&a!=T){7(a.15==1)d.1g(a);a=a[c]}K d},2Z:J(a,e,c,b){e=e||1;L d=0;Q(;a;a=a[c])7(a.15==1&&++d==e)1Q;K a},5i:J(n,a){L r=[];Q(;n;n=n.2B){7(n.15==1&&(!a||n!=a))r.1g(n)}K r}});E.16={1b:J(f,i,g,e){7(f.15==3||f.15==8)K;7(E.14.1d&&f.53!=10)f=1e;7(!g.2D)g.2D=6.2D++;7(e!=10){L h=g;g=J(){K h.1i(6,18)};g.O=e;g.2D=h.2D}L j=E.O(f,"2R")||E.O(f,"2R",{}),1v=E.O(f,"1v")||E.O(f,"1v",J(){L a;7(1o E=="10"||E.16.5f)K a;a=E.16.1v.1i(18.3R.Y,18);K a});1v.Y=f;E.R(i.23(/\\s+/),J(c,b){L a=b.23(".");b=a[0];g.U=a[1];L d=j[b];7(!d){d=j[b]={};7(!E.16.2y[b]||E.16.2y[b].4j.1P(f)===S){7(f.3F)f.3F(b,1v,S);N 7(f.6b)f.6b("4i"+b,1v)}}d[g.2D]=g;E.16.2a[b]=P});f=V},2D:1,2a:{},1V:J(e,h,f){7(e.15==3||e.15==8)K;L i=E.O(e,"2R"),29,4X;7(i){7(h==10||(1o h=="25"&&h.7T(0)=="."))Q(L g 1p i)6.1V(e,g+(h||""));N{7(h.U){f=h.2q;h=h.U}E.R(h.23(/\\s+/),J(b,a){L c=a.23(".");a=c[0];7(i[a]){7(f)2V i[a][f.2D];N Q(f 1p i[a])7(!c[1]||i[a][f].U==c[1])2V i[a][f];Q(29 1p i[a])1Q;7(!29){7(!E.16.2y[a]||E.16.2y[a].4h.1P(e)===S){7(e.67)e.67(a,E.O(e,"1v"),S);N 7(e.66)e.66("4i"+a,E.O(e,"1v"))}29=V;2V i[a]}}})}Q(29 1p i)1Q;7(!29){L d=E.O(e,"1v");7(d)d.Y=V;E.35(e,"2R");E.35(e,"1v")}}},1N:J(g,c,d,f,h){c=E.2I(c||[]);7(g.1f("!")>=0){g=g.2K(0,-1);L a=P}7(!d){7(6.2a[g])E("*").1b([1e,T]).1N(g,c)}N{7(d.15==3||d.15==8)K 10;L b,29,1n=E.1q(d[g]||V),16=!c[0]||!c[0].36;7(16)c.4J(6.4Z({U:g,2L:d}));c[0].U=g;7(a)c[0].65=P;7(E.1q(E.O(d,"1v")))b=E.O(d,"1v").1i(d,c);7(!1n&&d["4i"+g]&&d["4i"+g].1i(d,c)===S)b=S;7(16)c.4l();7(h&&E.1q(h)){29=h.1i(d,b==V?c:c.71(b));7(29!==10)b=29}7(1n&&f!==S&&b!==S&&!(E.12(d,\'a\')&&g=="4V")){6.5f=P;1S{d[g]()}1X(e){}}6.5f=S}K b},1v:J(c){L a;c=E.16.4Z(c||1e.16||{});L b=c.U.23(".");c.U=b[0];L f=E.O(6,"2R")&&E.O(6,"2R")[c.U],42=1M.2l.2K.1P(18,1);42.4J(c);Q(L j 1p f){L d=f[j];42[0].2q=d;42[0].O=d.O;7(!b[1]&&!c.65||d.U==b[1]){L e=d.1i(6,42);7(a!==S)a=e;7(e===S){c.36();c.44()}}}7(E.14.1d)c.2L=c.36=c.44=c.2q=c.O=V;K a},4Z:J(c){L a=c;c=E.1s({},a);c.36=J(){7(a.36)a.36();a.7S=S};c.44=J(){7(a.44)a.44();a.7R=P};7(!c.2L)c.2L=c.7Q||T;7(c.2L.15==3)c.2L=a.2L.1a;7(!c.4S&&c.5w)c.4S=c.5w==c.2L?c.7P:c.5w;7(c.64==V&&c.63!=V){L b=T.1F,1h=T.1h;c.64=c.63+(b&&b.2v||1h&&1h.2v||0)-(b.62||0);c.7N=c.7L+(b&&b.2x||1h&&1h.2x||0)-(b.60||0)}7(!c.3c&&((c.4f||c.4f===0)?c.4f:c.5Z))c.3c=c.4f||c.5Z;7(!c.7b&&c.5Y)c.7b=c.5Y;7(!c.3c&&c.2G)c.3c=(c.2G&1?1:(c.2G&2?3:(c.2G&4?2:0)));K c},2y:{21:{4j:J(){5M();K},4h:J(){K}},3C:{4j:J(){7(E.14.1d)K S;E(6).2j("4P",E.16.2y.3C.2q);K P},4h:J(){7(E.14.1d)K S;E(6).3w("4P",E.16.2y.3C.2q);K P},2q:J(a){7(I(a,6))K P;18[0].U="3C";K E.16.1v.1i(6,18)}},3B:{4j:J(){7(E.14.1d)K S;E(6).2j("4O",E.16.2y.3B.2q);K P},4h:J(){7(E.14.1d)K S;E(6).3w("4O",E.16.2y.3B.2q);K P},2q:J(a){7(I(a,6))K P;18[0].U="3B";K E.16.1v.1i(6,18)}}}};E.1n.1s({2j:J(c,a,b){K c=="4H"?6.2X(c,a,b):6.R(J(){E.16.1b(6,c,b||a,b&&a)})},2X:J(d,b,c){K 6.R(J(){E.16.1b(6,d,J(a){E(6).3w(a);K(c||b).1i(6,18)},c&&b)})},3w:J(a,b){K 6.R(J(){E.16.1V(6,a,b)})},1N:J(c,a,b){K 6.R(J(){E.16.1N(c,a,6,P,b)})},5n:J(c,a,b){7(6[0])K E.16.1N(c,a,6[0],S,b);K 10},2g:J(){L b=18;K 6.4V(J(a){6.4N=0==6.4N?1:0;a.36();K b[6.4N].1i(6,18)||S})},7D:J(a,b){K 6.2j(\'3C\',a).2j(\'3B\',b)},21:J(a){5M();7(E.2Q)a.1P(T,E);N E.3A.1g(J(){K a.1P(6,E)});K 6}});E.1s({2Q:S,3A:[],21:J(){7(!E.2Q){E.2Q=P;7(E.3A){E.R(E.3A,J(){6.1i(T)});E.3A=V}E(T).5n("21")}}});L x=S;J 5M(){7(x)K;x=P;7(T.3F&&!E.14.2z)T.3F("5W",E.21,S);7(E.14.1d&&1e==3b)(J(){7(E.2Q)K;1S{T.1F.7B("26")}1X(3a){3z(18.3R,0);K}E.21()})();7(E.14.2z)T.3F("5W",J(){7(E.2Q)K;Q(L i=0;i<T.4L.M;i++)7(T.4L[i].2Y){3z(18.3R,0);K}E.21()},S);7(E.14.2d){L a;(J(){7(E.2Q)K;7(T.39!="5V"&&T.39!="1y"){3z(18.3R,0);K}7(a===10)a=E("W, 7a[7A=7z]").M;7(T.4L.M!=a){3z(18.3R,0);K}E.21()})()}E.16.1b(1e,"3U",E.21)}E.R(("7y,7x,3U,7w,5d,4H,4V,7v,"+"7G,7u,7t,4P,4O,7s,2k,"+"58,7K,7q,7p,3a").23(","),J(i,b){E.1n[b]=J(a){K a?6.2j(b,a):6.1N(b)}});L I=J(a,c){L b=a.4S;2b(b&&b!=c)1S{b=b.1a}1X(3a){b=c}K b==c};E(1e).2j("4H",J(){E("*").1b(T).3w()});E.1n.1s({3U:J(g,d,c){7(E.1q(g))K 6.2j("3U",g);L e=g.1f(" ");7(e>=0){L i=g.2K(e,g.M);g=g.2K(0,e)}c=c||J(){};L f="4Q";7(d)7(E.1q(d)){c=d;d=V}N{d=E.3m(d);f="61"}L h=6;E.3P({1c:g,U:f,1H:"3q",O:d,1y:J(a,b){7(b=="1W"||b=="5U")h.3q(i?E("<1x/>").3t(a.4b.1r(/<1m(.|\\s)*?\\/1m>/g,"")).2s(i):a.4b);h.R(c,[a.4b,b,a])}});K 6},7n:J(){K E.3m(6.5T())},5T:J(){K 6.2c(J(){K E.12(6,"3u")?E.2I(6.7m):6}).1E(J(){K 6.31&&!6.2Y&&(6.3k||/2k|6h/i.17(6.12)||/1u|1Z|3I/i.17(6.U))}).2c(J(i,c){L b=E(6).5O();K b==V?V:b.1k==1M?E.2c(b,J(a,i){K{31:c.31,1A:a}}):{31:c.31,1A:b}}).22()}});E.R("5S,6d,5R,6D,5Q,6m".23(","),J(i,o){E.1n[o]=J(f){K 6.2j(o,f)}});L B=(1B 3v).3L();E.1s({22:J(d,b,a,c){7(E.1q(b)){a=b;b=V}K E.3P({U:"4Q",1c:d,O:b,1W:a,1H:c})},7l:J(b,a){K E.22(b,V,a,"1m")},7k:J(c,b,a){K E.22(c,b,a,"3i")},7i:J(d,b,a,c){7(E.1q(b)){a=b;b={}}K E.3P({U:"61",1c:d,O:b,1W:a,1H:c})},85:J(a){E.1s(E.4I,a)},4I:{2a:P,U:"4Q",2U:0,5P:"4o/x-7h-3u-7g",5N:P,3l:P,O:V,6p:V,3I:V,49:{3M:"4o/3M, 1u/3M",3q:"1u/3q",1m:"1u/4m, 4o/4m",3i:"4o/3i, 1u/4m",1u:"1u/a7",4G:"*/*"}},4F:{},3P:J(s){L f,2W=/=\\?(&|$)/g,1z,O;s=E.1s(P,s,E.1s(P,{},E.4I,s));7(s.O&&s.5N&&1o s.O!="25")s.O=E.3m(s.O);7(s.1H=="4E"){7(s.U.2h()=="22"){7(!s.1c.1D(2W))s.1c+=(s.1c.1D(/\\?/)?"&":"?")+(s.4E||"7d")+"=?"}N 7(!s.O||!s.O.1D(2W))s.O=(s.O?s.O+"&":"")+(s.4E||"7d")+"=?";s.1H="3i"}7(s.1H=="3i"&&(s.O&&s.O.1D(2W)||s.1c.1D(2W))){f="4E"+B++;7(s.O)s.O=(s.O+"").1r(2W,"="+f+"$1");s.1c=s.1c.1r(2W,"="+f+"$1");s.1H="1m";1e[f]=J(a){O=a;1W();1y();1e[f]=10;1S{2V 1e[f]}1X(e){}7(h)h.34(g)}}7(s.1H=="1m"&&s.1T==V)s.1T=S;7(s.1T===S&&s.U.2h()=="22"){L i=(1B 3v()).3L();L j=s.1c.1r(/(\\?|&)4r=.*?(&|$)/,"$a4="+i+"$2");s.1c=j+((j==s.1c)?(s.1c.1D(/\\?/)?"&":"?")+"4r="+i:"")}7(s.O&&s.U.2h()=="22"){s.1c+=(s.1c.1D(/\\?/)?"&":"?")+s.O;s.O=V}7(s.2a&&!E.5H++)E.16.1N("5S");7((!s.1c.1f("a3")||!s.1c.1f("//"))&&s.1H=="1m"&&s.U.2h()=="22"){L h=T.3S("6f")[0];L g=T.3s("1m");g.3Q=s.1c;7(s.7c)g.a2=s.7c;7(!f){L l=S;g.9Z=g.9Y=J(){7(!l&&(!6.39||6.39=="5V"||6.39=="1y")){l=P;1W();1y();h.34(g)}}}h.38(g);K 10}L m=S;L k=1e.78?1B 78("9X.9V"):1B 76();k.9T(s.U,s.1c,s.3l,s.6p,s.3I);1S{7(s.O)k.4C("9R-9Q",s.5P);7(s.5C)k.4C("9O-5A-9N",E.4F[s.1c]||"9L, 9K 9I 9H 5z:5z:5z 9F");k.4C("X-9C-9A","76");k.4C("9z",s.1H&&s.49[s.1H]?s.49[s.1H]+", */*":s.49.4G)}1X(e){}7(s.6Y)s.6Y(k);7(s.2a)E.16.1N("6m",[k,s]);L c=J(a){7(!m&&k&&(k.39==4||a=="2U")){m=P;7(d){6I(d);d=V}1z=a=="2U"&&"2U"||!E.6X(k)&&"3a"||s.5C&&E.6J(k,s.1c)&&"5U"||"1W";7(1z=="1W"){1S{O=E.6W(k,s.1H)}1X(e){1z="5x"}}7(1z=="1W"){L b;1S{b=k.5q("6U-5A")}1X(e){}7(s.5C&&b)E.4F[s.1c]=b;7(!f)1W()}N E.5v(s,k,1z);1y();7(s.3l)k=V}};7(s.3l){L d=53(c,13);7(s.2U>0)3z(J(){7(k){k.9t();7(!m)c("2U")}},s.2U)}1S{k.9s(s.O)}1X(e){E.5v(s,k,V,e)}7(!s.3l)c();J 1W(){7(s.1W)s.1W(O,1z);7(s.2a)E.16.1N("5Q",[k,s])}J 1y(){7(s.1y)s.1y(k,1z);7(s.2a)E.16.1N("5R",[k,s]);7(s.2a&&!--E.5H)E.16.1N("6d")}K k},5v:J(s,a,b,e){7(s.3a)s.3a(a,b,e);7(s.2a)E.16.1N("6D",[a,s,e])},5H:0,6X:J(r){1S{K!r.1z&&9q.9p=="59:"||(r.1z>=6T&&r.1z<9n)||r.1z==6R||r.1z==9l||E.14.2d&&r.1z==10}1X(e){}K S},6J:J(a,c){1S{L b=a.5q("6U-5A");K a.1z==6R||b==E.4F[c]||E.14.2d&&a.1z==10}1X(e){}K S},6W:J(r,b){L c=r.5q("9k-U");L d=b=="3M"||!b&&c&&c.1f("3M")>=0;L a=d?r.9j:r.4b;7(d&&a.1F.28=="5x")6Q"5x";7(b=="1m")E.5g(a);7(b=="3i")a=6c("("+a+")");K a},3m:J(a){L s=[];7(a.1k==1M||a.5h)E.R(a,J(){s.1g(3r(6.31)+"="+3r(6.1A))});N Q(L j 1p a)7(a[j]&&a[j].1k==1M)E.R(a[j],J(){s.1g(3r(j)+"="+3r(6))});N s.1g(3r(j)+"="+3r(a[j]));K s.6a("&").1r(/%20/g,"+")}});E.1n.1s({1G:J(c,b){K c?6.2e({1R:"1G",27:"1G",1w:"1G"},c,b):6.1E(":1Z").R(J(){6.W.19=6.5s||"";7(E.1j(6,"19")=="2H"){L a=E("<"+6.28+" />").6y("1h");6.W.19=a.1j("19");7(6.W.19=="2H")6.W.19="3D";a.1V()}}).3h()},1I:J(b,a){K b?6.2e({1R:"1I",27:"1I",1w:"1I"},b,a):6.1E(":4d").R(J(){6.5s=6.5s||E.1j(6,"19");6.W.19="2H"}).3h()},6N:E.1n.2g,2g:J(a,b){K E.1q(a)&&E.1q(b)?6.6N(a,b):a?6.2e({1R:"2g",27:"2g",1w:"2g"},a,b):6.R(J(){E(6)[E(6).3H(":1Z")?"1G":"1I"]()})},9f:J(b,a){K 6.2e({1R:"1G"},b,a)},9d:J(b,a){K 6.2e({1R:"1I"},b,a)},9c:J(b,a){K 6.2e({1R:"2g"},b,a)},9a:J(b,a){K 6.2e({1w:"1G"},b,a)},99:J(b,a){K 6.2e({1w:"1I"},b,a)},97:J(c,a,b){K 6.2e({1w:a},c,b)},2e:J(l,k,j,h){L i=E.6P(k,j,h);K 6[i.2P===S?"R":"2P"](J(){7(6.15!=1)K S;L g=E.1s({},i);L f=E(6).3H(":1Z"),4A=6;Q(L p 1p l){7(l[p]=="1I"&&f||l[p]=="1G"&&!f)K E.1q(g.1y)&&g.1y.1i(6);7(p=="1R"||p=="27"){g.19=E.1j(6,"19");g.32=6.W.32}}7(g.32!=V)6.W.32="1Z";g.40=E.1s({},l);E.R(l,J(c,a){L e=1B E.2t(4A,g,c);7(/2g|1G|1I/.17(a))e[a=="2g"?f?"1G":"1I":a](l);N{L b=a.3X().1D(/^([+-]=)?([\\d+-.]+)(.*)$/),1Y=e.2m(P)||0;7(b){L d=2M(b[2]),2A=b[3]||"2S";7(2A!="2S"){4A.W[c]=(d||1)+2A;1Y=((d||1)/e.2m(P))*1Y;4A.W[c]=1Y+2A}7(b[1])d=((b[1]=="-="?-1:1)*d)+1Y;e.45(1Y,d,2A)}N e.45(1Y,a,"")}});K P})},2P:J(a,b){7(E.1q(a)||(a&&a.1k==1M)){b=a;a="2t"}7(!a||(1o a=="25"&&!b))K A(6[0],a);K 6.R(J(){7(b.1k==1M)A(6,a,b);N{A(6,a).1g(b);7(A(6,a).M==1)b.1i(6)}})},94:J(b,c){L a=E.3G;7(b)6.2P([]);6.R(J(){Q(L i=a.M-1;i>=0;i--)7(a[i].Y==6){7(c)a[i](P);a.72(i,1)}});7(!c)6.5p();K 6}});L A=J(b,c,a){7(!b)K 10;c=c||"2t";L q=E.O(b,c+"2P");7(!q||a)q=E.O(b,c+"2P",a?E.2I(a):[]);K q};E.1n.5p=J(a){a=a||"2t";K 6.R(J(){L q=A(6,a);q.4l();7(q.M)q[0].1i(6)})};E.1s({6P:J(b,a,c){L d=b&&b.1k==92?b:{1y:c||!c&&a||E.1q(b)&&b,2u:b,3Z:c&&a||a&&a.1k!=91&&a};d.2u=(d.2u&&d.2u.1k==51?d.2u:{90:8Z,9D:6T}[d.2u])||8X;d.5y=d.1y;d.1y=J(){7(d.2P!==S)E(6).5p();7(E.1q(d.5y))d.5y.1i(6)};K d},3Z:{70:J(p,n,b,a){K b+a*p},5j:J(p,n,b,a){K((-24.8V(p*24.8U)/2)+0.5)*a+b}},3G:[],3W:V,2t:J(b,c,a){6.11=c;6.Y=b;6.1l=a;7(!c.47)c.47={}}});E.2t.2l={4y:J(){7(6.11.30)6.11.30.1i(6.Y,[6.2J,6]);(E.2t.30[6.1l]||E.2t.30.4G)(6);7(6.1l=="1R"||6.1l=="27")6.Y.W.19="3D"},2m:J(a){7(6.Y[6.1l]!=V&&6.Y.W[6.1l]==V)K 6.Y[6.1l];L r=2M(E.1j(6.Y,6.1l,a));K r&&r>-8Q?r:2M(E.2o(6.Y,6.1l))||0},45:J(c,b,d){6.5B=(1B 3v()).3L();6.1Y=c;6.3h=b;6.2A=d||6.2A||"2S";6.2J=6.1Y;6.4B=6.4w=0;6.4y();L e=6;J t(a){K e.30(a)}t.Y=6.Y;E.3G.1g(t);7(E.3W==V){E.3W=53(J(){L a=E.3G;Q(L i=0;i<a.M;i++)7(!a[i]())a.72(i--,1);7(!a.M){6I(E.3W);E.3W=V}},13)}},1G:J(){6.11.47[6.1l]=E.1J(6.Y.W,6.1l);6.11.1G=P;6.45(0,6.2m());7(6.1l=="27"||6.1l=="1R")6.Y.W[6.1l]="8N";E(6.Y).1G()},1I:J(){6.11.47[6.1l]=E.1J(6.Y.W,6.1l);6.11.1I=P;6.45(6.2m(),0)},30:J(a){L t=(1B 3v()).3L();7(a||t>6.11.2u+6.5B){6.2J=6.3h;6.4B=6.4w=1;6.4y();6.11.40[6.1l]=P;L b=P;Q(L i 1p 6.11.40)7(6.11.40[i]!==P)b=S;7(b){7(6.11.19!=V){6.Y.W.32=6.11.32;6.Y.W.19=6.11.19;7(E.1j(6.Y,"19")=="2H")6.Y.W.19="3D"}7(6.11.1I)6.Y.W.19="2H";7(6.11.1I||6.11.1G)Q(L p 1p 6.11.40)E.1J(6.Y.W,p,6.11.47[p])}7(b&&E.1q(6.11.1y))6.11.1y.1i(6.Y);K S}N{L n=t-6.5B;6.4w=n/6.11.2u;6.4B=E.3Z[6.11.3Z||(E.3Z.5j?"5j":"70")](6.4w,n,0,1,6.11.2u);6.2J=6.1Y+((6.3h-6.1Y)*6.4B);6.4y()}K P}};E.2t.30={2v:J(a){a.Y.2v=a.2J},2x:J(a){a.Y.2x=a.2J},1w:J(a){E.1J(a.Y.W,"1w",a.2J)},4G:J(a){a.Y.W[a.1l]=a.2J+a.2A}};E.1n.5L=J(){L b=0,3b=0,Y=6[0],5l;7(Y)8M(E.14){L d=Y.1a,41=Y,1K=Y.1K,1L=Y.2i,5D=2d&&4s(5K)<8J&&!/a1/i.17(v),2T=E.1j(Y,"43")=="2T";7(Y.6G){L c=Y.6G();1b(c.26+24.2f(1L.1F.2v,1L.1h.2v),c.3b+24.2f(1L.1F.2x,1L.1h.2x));1b(-1L.1F.62,-1L.1F.60)}N{1b(Y.5G,Y.5F);2b(1K){1b(1K.5G,1K.5F);7(48&&!/^t(8H|d|h)$/i.17(1K.28)||2d&&!5D)2N(1K);7(!2T&&E.1j(1K,"43")=="2T")2T=P;41=/^1h$/i.17(1K.28)?41:1K;1K=1K.1K}2b(d&&d.28&&!/^1h|3q$/i.17(d.28)){7(!/^8G|1O.*$/i.17(E.1j(d,"19")))1b(-d.2v,-d.2x);7(48&&E.1j(d,"32")!="4d")2N(d);d=d.1a}7((5D&&(2T||E.1j(41,"43")=="4W"))||(48&&E.1j(41,"43")!="4W"))1b(-1L.1h.5G,-1L.1h.5F);7(2T)1b(24.2f(1L.1F.2v,1L.1h.2v),24.2f(1L.1F.2x,1L.1h.2x))}5l={3b:3b,26:b}}J 2N(a){1b(E.2o(a,"a8",P),E.2o(a,"a9",P))}J 1b(l,t){b+=4s(l)||0;3b+=4s(t)||0}K 5l}})();',62,631,'||||||this|if||||||||||||||||||||||||||||||||||||||function|return|var|length|else|data|true|for|each|false|document|type|null|style||elem||undefined|options|nodeName||browser|nodeType|event|test|arguments|display|parentNode|add|url|msie|window|indexOf|push|body|apply|css|constructor|prop|script|fn|typeof|in|isFunction|replace|extend|className|text|handle|opacity|div|complete|status|value|new|firstChild|match|filter|documentElement|show|dataType|hide|attr|offsetParent|doc|Array|trigger|table|call|break|height|try|cache|tbody|remove|success|catch|start|hidden||ready|get|split|Math|string|left|width|tagName|ret|global|while|map|safari|animate|max|toggle|toLowerCase|ownerDocument|bind|select|prototype|cur||curCSS|selected|handler|done|find|fx|duration|scrollLeft|id|scrollTop|special|opera|unit|nextSibling|stack|guid|toUpperCase|pushStack|button|none|makeArray|now|slice|target|parseFloat|border|exec|queue|isReady|events|px|fixed|timeout|delete|jsre|one|disabled|nth|step|name|overflow|inArray|removeChild|removeData|preventDefault|merge|appendChild|readyState|error|top|which|innerHTML|multiFilter|rl|trim|end|json|first|checked|async|param|elems|insertBefore|childNodes|html|encodeURIComponent|createElement|append|form|Date|unbind|color|grep|setTimeout|readyList|mouseleave|mouseenter|block|isXMLDoc|addEventListener|timers|is|password|last|runtimeStyle|getTime|xml|jQuery|domManip|ajax|src|callee|getElementsByTagName|selectedIndex|load|object|timerId|toString|has|easing|curAnim|offsetChild|args|position|stopPropagation|custom|props|orig|mozilla|accepts|clean|responseText|defaultView|visible|String|charCode|float|teardown|on|setup|nodeIndex|shift|javascript|currentStyle|application|child|RegExp|_|parseInt|previousSibling|dir|tr|state|empty|update|getAttribute|self|pos|setRequestHeader|input|jsonp|lastModified|_default|unload|ajaxSettings|unshift|getComputedStyle|styleSheets|getPropertyValue|lastToggle|mouseout|mouseover|GET|andSelf|relatedTarget|init|visibility|click|absolute|index|container|fix|outline|Number|removeAttribute|setInterval|prevObject|classFilter|not|unique|submit|file|after|windowData|deep|scroll|client|triggered|globalEval|jquery|sibling|swing|clone|results|wrapAll|triggerHandler|lastChild|dequeue|getResponseHeader|createTextNode|oldblock|checkbox|radio|handleError|fromElement|parsererror|old|00|Modified|startTime|ifModified|safari2|getWH|offsetTop|offsetLeft|active|values|getElementById|version|offset|bindReady|processData|val|contentType|ajaxSuccess|ajaxComplete|ajaxStart|serializeArray|notmodified|loaded|DOMContentLoaded|Width|ctrlKey|keyCode|clientTop|POST|clientLeft|clientX|pageX|exclusive|detachEvent|removeEventListener|swap|cloneNode|join|attachEvent|eval|ajaxStop|substr|head|parse|textarea|reset|image|zoom|odd|ajaxSend|even|before|username|prepend|expr|quickClass|uuid|quickID|quickChild|continue|textContent|appendTo|contents|evalScript|parent|defaultValue|ajaxError|setArray|compatMode|getBoundingClientRect|styleFloat|clearInterval|httpNotModified|nodeValue|100|alpha|_toggle|href|speed|throw|304|replaceWith|200|Last|colgroup|httpData|httpSuccess|beforeSend|eq|linear|concat|splice|fieldset|multiple|cssFloat|XMLHttpRequest|webkit|ActiveXObject|CSS1Compat|link|metaKey|scriptCharset|callback|col|pixelLeft|urlencoded|www|post|hasClass|getJSON|getScript|elements|serialize|black|keyup|keypress|solid|change|mousemove|mouseup|dblclick|resize|focus|blur|stylesheet|rel|doScroll|round|hover|padding|offsetHeight|mousedown|offsetWidth|Bottom|Top|keydown|clientY|Right|pageY|Left|toElement|srcElement|cancelBubble|returnValue|charAt|0n|substring|animated|header|noConflict|line|enabled|innerText|contains|only|weight|ajaxSetup|font|size|gt|lt|uFFFF|u0128|417|Boolean|inner|Height|toggleClass|removeClass|addClass|removeAttr|replaceAll|insertAfter|prependTo|contentWindow|contentDocument|wrap|iframe|children|siblings|prevAll|nextAll|prev|wrapInner|next|parents|maxLength|maxlength|readOnly|readonly|reverse|class|htmlFor|inline|able|boxModel|522|setData|compatible|with|1px|ie|getData|10000|ra|it|rv|PI|cos|userAgent|400|navigator|600|slow|Function|Object|array|stop|ig|NaN|fadeTo|option|fadeOut|fadeIn|setAttribute|slideToggle|slideUp|changed|slideDown|be|can|property|responseXML|content|1223|getAttributeNode|300|method|protocol|location|action|send|abort|cssText|th|td|cap|specified|Accept|With|colg|Requested|fast|tfoot|GMT|thead|1970|Jan|attributes|01|Thu|leg|Since|If|opt|Type|Content|embed|open|area|XMLHTTP|hr|Microsoft|onreadystatechange|onload|meta|adobeair|charset|http|1_|img|br|plain|borderLeftWidth|borderTopWidth|abbr'.split('|'),0,{}));
/* Copyright (c) 2006 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.
 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
 *
 * $LastChangedDate: 2007-12-14 23:57:10 -0600 (Fri, 14 Dec 2007) $
 * $Rev: 4163 $
 *
 * Version: 3.0
 * 
 * Requires: $ 1.2.2+
 */
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}('(5($){$.6.j.4={L:5(){9 b=$.6.j.4.i;7($.8.f)$(2).o(\'y.4\',5(a){$.d(2,\'h\',{x:a.x,l:a.l,s:a.s,r:a.r})});7(2.q)2.q(($.8.f?\'v\':\'4\'),b,n);m 2.w=b},D:5(){9 a=$.6.j.4.i;$(2).k(\'y.4\');7(2.u)2.u(($.8.f?\'v\':\'4\'),a,n);m 2.w=5(){};$.A(2,\'h\')},i:5(a){9 c=U.T.S.P(O,1);a=$.6.N(a||M.6);$.t(a,$.d(2,\'h\')||{});9 b=0,K=J;7(a.e)b=a.e/I;7(a.p)b=-a.p/3;7($.8.H)b=-a.e;a.d=a.d||{};a.G="4";c.z(b);c.z(a);g $.6.F.E(2,c)}};$.Q.t({4:5(a){g a?2.o("4",a):2.R("4")},C:5(a){g 2.k("4",a)}})})(B);',57,57,'||this||mousewheel|function|event|if|browser|var||||data|wheelDelta|mozilla|return|mwcursorposdata|handler|special|unbind|pageY|else|false|bind|detail|addEventListener|clientY|clientX|extend|removeEventListener|DOMMouseScroll|onmousewheel|pageX|mousemove|unshift|removeData|jQuery|unmousewheel|teardown|apply|handle|type|opera|120|true|returnValue|setup|window|fix|arguments|call|fn|trigger|slice|prototype|Array'.split('|'),0,{}));
var KrakMap=function(){
};

KrakMap.API=function(tc){
this.version="3.0";
this.tc=tc;
};
KrakMap.API.prototype.jump=function(_2,_3,_4,_5){
var _6=KrakMap.Util;
if(!_6.validateCoordinate(_2)||!(typeof (_3)=="number"&&isFinite(_3))||!_6.validateMapType(_4)||(_5&&!_6.validateObliqueDirection(_5))){
return;
}
this.tc.jumpToCoordinate(_3,_2.x,_2.y,_4,_5);
};
KrakMap.API.prototype.jumpToFullExtent=function(){
this.tc.jumpToFullExtent();
};
KrakMap.API.prototype.redrawGrid=function(){
this.tc.redrawGrid();
};
KrakMap.API.prototype.resizeMap=function(){
this.tc.resizeMap();
};
KrakMap.API.prototype.enableOverviewMap=function(){
this.tc.enableOverviewMap();
};
KrakMap.API.prototype.disableOverviewMap=function(){
this.tc.disableOverviewMap();
};
KrakMap.API.prototype.toggleOverviewMap=function(){
this.tc.toggleOverviewMap();
};
KrakMap.API.prototype.isOverviewMap=function(){
return this.tc.getOverviewMap()?true:false;
};
KrakMap.API.prototype.enableNavigationKeys=function(){
this.tc.enableNavigationKeys();
};
KrakMap.API.prototype.disableNavigationKeys=function(){
this.tc.disableNavigationKeys();
};
KrakMap.API.prototype.toggleNavigationKeys=function(){
this.tc.toggleNavigationKeys();
};
KrakMap.API.prototype.isNavigationKeys=function(){
return this.tc.getNavigationKeys();
};
KrakMap.API.prototype.enableMeasureTool=function(){
this.tc.enableMeasureLine();
};
KrakMap.API.prototype.disableMeasureTool=function(){
this.tc.disableMeasureLine();
};
KrakMap.API.prototype.toggleMeasureTool=function(){
this.tc.toggleMeasureLine();
};
KrakMap.API.prototype.isMeasureTool=function(){
return this.tc.measureLineEnabled;
};
KrakMap.API.prototype.enableRectangleDraw=function(){
this.tc.enableMeasureBox();
};
KrakMap.API.prototype.disableRectangleDraw=function(){
this.tc.disableMeasureBox();
};
KrakMap.API.prototype.toggleRectangleDraw=function(){
this.tc.toggleMeasureBox();
};
KrakMap.API.prototype.isRectangleDraw=function(){
return this.tc.getMeasureBox();
};
KrakMap.API.prototype.enableCircleDraw=function(){
this.tc.enableCircleDraw();
};
KrakMap.API.prototype.disableCircleDraw=function(){
this.tc.disableCircleDraw();
};
KrakMap.API.prototype.toggleCircleDraw=function(){
this.tc.toggleCircleDraw();
};
KrakMap.API.prototype.isCircleDraw=function(){
return this.tc.circleDrawEnabled;
};
KrakMap.API.prototype.enablePolygonDraw=function(){
this.tc.enablePolygonDraw();
};
KrakMap.API.prototype.disablePolygonDraw=function(){
this.tc.disablePolygonDraw();
};
KrakMap.API.prototype.togglePolygonDraw=function(){
this.tc.togglePolygonDraw();
};
KrakMap.API.prototype.isPolygonDraw=function(){
return this.tc.polygonDrawEnabled;
};
KrakMap.API.prototype.draw=function(_7,_8){
if(typeof (_7)!="string"||!(typeof (_8)=="undefined"||typeof (_8)=="boolean")){
return;
}
this.tc.enableRoute(_7,_8);
};
KrakMap.API.prototype.getWkt=function(){
var _9=this.tc.route.route.asWkt;
return (_9&&typeof (_9)=="string")?_9:"";
};
KrakMap.API.prototype.removeDrawing=function(){
this.tc.disableRoute();
};
KrakMap.API.prototype.setPrintMode=function(_a){
if(typeof (_a)!="boolean"){
return;
}
this.tc.setRouteFallBack(_a);
};
KrakMap.API.prototype.enableRouteSearch=function(){
this.tc.enableRouteSearch();
};
KrakMap.API.prototype.disableRouteSearch=function(){
this.tc.disableRouteSearch();
};
KrakMap.API.prototype.toggleRouteSearch=function(){
this.tc.toggleRouteSearch();
};
KrakMap.API.prototype.isRouteSearch=function(){
return this.tc.isRouteSearch();
};
KrakMap.API.prototype.addPoi=function(_b){
if(_b instanceof Array){
for(var i=0;i<_b.length;i++){
if(!KrakMap.Util.validatePoi(_b[i])){
return;
}
}
}else{
if(!KrakMap.Util.validatePoi(_b)){
return;
}
}
this.tc.addPoi(_b);
};
KrakMap.API.prototype.removePoi=function(_d){
if(typeof (_d)!="string"){
return;
}
this.tc.removePoi(false,_d);
};
KrakMap.API.prototype.removeAllPoi=function(_e){
if(_e&&typeof (_e)=="string"){
this.tc.removeAllPoiInLayer(_e);
return;
}
if(!_e){
this.tc.removeAllPoi();
}
};
KrakMap.API.prototype.sortPoiCategories=function(_f){
if(_f instanceof Array){
for(var i=0;i<_f.length;i++){
if(typeof (_f[i])!="string"){
return;
}
}
}else{
return;
}
this.tc.sortPoiLayers(_f);
};
KrakMap.API.prototype.switchPoiCategoryOn=function(_11){
if(!_11||typeof (_11)!="string"){
return;
}
this.tc.switchPoiLayerOn(_11);
};
KrakMap.API.prototype.switchPoiCategoryOff=function(_12){
if(!_12||typeof (_12)!="string"){
return;
}
this.tc.switchPoiLayerOff(_12);
};
KrakMap.API.prototype.togglePoiCategory=function(_13){
if(!_13||typeof (_13)!="string"){
return;
}
this.tc.togglePoiLayer(_13);
};
KrakMap.API.prototype.isPoiCategory=function(_14){
if(!_14||typeof (_14)!="string"){
return;
}
return this.tc.isPoiLayer(_14);
};
KrakMap.API.prototype.addTileLayer=function(_15,_16,url){
if(!(_15&&typeof (_15)=="string")||!(typeof (_16)=="number"&&isFinite(_16))||!(url&&typeof (url)=="string")){
return;
}
this.tc.addTileLayer(_15,_16,url);
};
KrakMap.API.prototype.removeTileLayer=function(_18){
if(!_18||typeof (_18)!="string"){
return;
}
this.tc.removeTileLayer(_18);
};
KrakMap.API.prototype.removeAllTileLayers=function(){
this.tc.removeAllTileLayers();
};
KrakMap.API.prototype.modifyTileLayer=function(_19,_1a,url){
if(!(_19&&typeof (_19)=="string")||!(typeof (_1a)&&isFinite(_1a))||!(url&&typeof (url)=="string")){
return;
}
this.tc.modifyTileLayer(_19,_1a,url);
};
KrakMap.API.prototype.switchTileLayerOn=function(_1c){
if(!_1c||typeof (_1c)!="string"){
return;
}
this.tc.switchTileLayerOn(_1c);
};
KrakMap.API.prototype.switchTileLayerOff=function(_1d){
if(!_1d||typeof (_1d)!="string"){
return;
}
this.tc.switchTileLayerOff(_1d);
};
KrakMap.API.prototype.toggleTileLayer=function(_1e){
if(!_1e||typeof (_1e)!="string"){
return;
}
this.tc.toggleTileLayer(_1e);
};
KrakMap.API.prototype.isTileLayer=function(_1f){
if(!_1f||typeof (_1f)!="string"){
return;
}
return this.tc.isTileLayer(_1f);
};
KrakMap.API.prototype.subscribeEvent=function(_20,_21){
if(typeof (_20)!="string"||typeof (_21)!="function"){
return;
}
this.tc.subscribeEvent(_20,_21);
};
KrakMap.API.prototype.unsubscribeEvent=function(_22,_23){
if(typeof (_22)!="string"||typeof (_23)!="function"){
return;
}
this.tc.unsubscribeEvent(_22,_23);
};
KrakMap.API.prototype.utmToDegrees=function(_24){
return this.tc.utmToDegrees(_24);
};
KrakMap.API.prototype.geoToPixelCoordinate=function(_25){
if(!KrakMap.Util.validateCoordinate(_25)){
return;
}
return this.tc.geoToPixelCoordinate(_25.x,_25.y);
};
KrakMap.API.prototype.pixelToGeoCoordinate=function(_26){
if(!KrakMap.Util.validateCoordinate(_26)){
return;
}
return this.tc.pixelToGeoCoordinate(_26.x,_26.y);
};
KrakMap.API.prototype.getMapViewCenter=function(){
return this.tc.getMapViewCenter();
};
KrakMap.API.prototype.setMapViewCenter=function(_27){
this.jump(_27,this.getZoomLevel(),this.getMapType(),this.getObliqueDirection());
};
KrakMap.API.prototype.getMapViewExtent=function(){
return this.tc.getMapViewExtent();
};
KrakMap.API.prototype.setMapViewExtent=function(_28,_29){
if(KrakMap.Util.validateExtent(_28)){
if(typeof (_29)=="number"&&isFinite(_29)){
this.tc.jumpToExtentWithBuffer(_28,_29);
}else{
this.tc.jumpToExtent(_28);
}
}else{
return;
}
};
KrakMap.API.prototype.getMapType=function(){
return this.tc.getMapType();
};
KrakMap.API.prototype.setMapType=function(_2a){
if(!KrakMap.Util.validateMapType(_2a)){
return;
}
this.tc.changeMapType(_2a);
};
KrakMap.API.prototype.getObliqueDirection=function(){
if(this.tc.obliqueResponse){
return this.tc.obliqueResponse.direction;
}
return null;
};
KrakMap.API.prototype.setObliqueDirection=function(_2b){
if(!KrakMap.Util.validateObliqueDirection(_2b)){
return;
}
this.tc.changeMapType("oblique",_2b);
};
KrakMap.API.prototype.getZoomLevel=function(){
return this.tc.getCurrentZoomLevel();
};
KrakMap.API.prototype.setZoomLevel=function(_2c){
if(!(typeof (_2c)=="number"&&isFinite(_2c))){
return;
}
this.tc.zoomToLevel(_2c);
};
KrakMap.API.prototype.getMetersPerPixel=function(){
return this.getZoomLevels()[this.getZoomLevel()];
};
KrakMap.API.prototype.setMetersPerPixel=function(_2d){
if(!(typeof (_2d)=="number"&&isFinite(_2d))){
return;
}
var _2e=this.getZoomLevels();
var _2f=0;
for(var i=0;i<_2e.length;i++){
if(_2e[i]<=_2d&&i>_2f){
_2f=i;
}
}
this.tc.zoomToLevel(_2f);
};
KrakMap.API.prototype.getMinZoomLevel=function(){
return this.getZoomLevels()[this.tc.getMinZoomLevel()];
};
KrakMap.API.prototype.setMinZoomLevel=function(_31){
if(!(typeof (_31)=="number"&&isFinite(_31))){
return;
}
var _32=this.getZoomLevels();
var _33=_32.length;
for(var i=_32.length-1;i>=0;i--){
if(_32[i]>=_31){
_33=i;
}
}
this.tc.setMinZoomLevel(_33);
};
KrakMap.API.prototype.getMaxZoomLevel=function(){
return this.getZoomLevels()[this.tc.getMaxZoomLevel()];
};
KrakMap.API.prototype.setMaxZoomLevel=function(_35){
if(!(typeof (_35)=="number"&&isFinite(_35))){
return;
}
var _36=this.getZoomLevels();
var _37=0;
for(var i=0;i<_36.length;i++){
if(_36[i]<=_35){
_37=i;
}
}
this.tc.setMaxZoomLevel(_37);
};
KrakMap.API.prototype.getRectangleExtent=function(){
return this.tc.getMeasuredExtent();
};
KrakMap.API.prototype.getPolygonPoints=function(){
return this.tc.polygonWKTString;
};
KrakMap.API.prototype.getCircleCenter=function(){
return this.tc.circleCenter;
};
KrakMap.API.prototype.getCircleRadius=function(){
return this.tc.circleRadius;
};
KrakMap.API.prototype.getMeasureToolPoints=function(){
return this.tc.measureLineCoordinates;
};
KrakMap.API.prototype.getMeasureToolLength=function(){
return this.tc.measureLineLength;
};
KrakMap.API.prototype.getMapGridExtent=function(){
return this.tc.getMapGridExtent();
};
KrakMap.API.prototype.getMousePosition=function(){
return this.tc.getMousePosition();
};
KrakMap.API.prototype.getZoomLevels=function(){
return this.tc.getZoomLevels();
};
KrakMap.API.prototype.setBookmark=function(_39,_3a,_3b,_3c){
this.tc.setToolbarCenterButtonCoordinate(_39,_3a,_3b,_3c);
};
KrakMap.API.prototype.setPrintAction=function(_3d){
if(typeof (_3d)!="function"){
return;
}
this.tc.setPrintAction(_3d);
};

KrakMap.Poi=function(_1,_2,_3,_4,_5){
if(!KrakMap.Util.validateCoordinate(_2)||typeof (_3)!="string"||!(_4&&typeof (_4)=="number"&&isFinite(_4))||!(_5&&typeof (_5)=="number"&&isFinite(_5))){
return;
}
var _6={dom:_1,coordinate:_2,category:_3};
if(_4&&_5){
_6.width=_4;
_6.height=_5;
}
return _6;
};

KrakMap.Util={};
KrakMap.Util.validateCoordinate=function(_1){
if(_1&&typeof (_1)=="object"&&isFinite(_1.x)&&isFinite(_1.y)&&typeof (_1.x)=="number"&&typeof (_1.y)=="number"){
return true;
}
return false;
};
KrakMap.Util.validateExtent=function(_2){
if(_2&&typeof (_2)=="object"&&isFinite(_2.top)&&isFinite(_2.bottom)&&isFinite(_2.left)&&isFinite(_2.right)&&typeof (_2.top)=="number"&&typeof (_2.bottom)=="number"&&typeof (_2.left)=="number"&&typeof (_2.right)=="number"){
return true;
}
return false;
};
KrakMap.Util.validateMapType=function(_3){
if(_3&&typeof (_3)=="string"&&(_3=="kvec"||_3=="ovc"||_3=="ortho"||_3=="oblique")){
return true;
}
return false;
};
KrakMap.Util.validateObliqueDirection=function(_4){
if(_4&&typeof (_4)=="string"&&(_4=="n"||_4=="s"||_4=="e"||_4=="w")){
return true;
}
return false;
};
KrakMap.Util.validatePoi=function(_5){
if(_5&&KrakMap.Util.validateCoordinate(_5.coordinate)&&typeof (_5.category)=="string"&&(_5.width&&typeof (_5.width)=="number"&&isFinite(_5.width))&&(_5.height&&typeof (_5.height)=="number"&&isFinite(_5.height))){
return true;
}
return false;
};

KrakMap.TileClient=function(_1){
this.tileVersion="1";
this.mapTypes=["kvec","ovc","ortho","oblique"];
this.settings=_1;
this.imgDir="http://tileclient.krak.dk/static/v3/img/";
if(_1.imgDir){
this.imgDir=_1.imgDir;
}
this.isPrint=false;
this.perspective=true;
if(_1&&_1.obliqueSettings&&typeof (_1.obliqueSettings.perspective)!="undefined"){
this.perspective=_1.obliqueSettings.perspective;
}
this.placeHolder=jQuery(_1.mapContainer);
var _2=this.placeHolder.width()-2;
var _3=this.placeHolder.height()-2;
this.Container=jQuery("<div></div>").css({overflow:"hidden",position:"relative",width:_2,height:_3}).appendTo(this.placeHolder);
if(!_1.mainMap){
this.Container.css({border:"1px solid #D8D8D8"});
}
this.toolbarContainer=null;
if(!_1.mainMap&&_1.toolBarSettings){
this.toolbarContainer=jQuery("<div></div>").css({position:"absolute",width:_2,left:0,top:0,zIndex:1}).appendTo(this.Container);
}
this.mapContainer=jQuery("<div></div>").css({position:"absolute",width:_2,height:_3,left:0,top:0,overflow:"hidden"}).appendTo(this.Container);
if(!_1.mainMap&&_1.toolBarSettings){
this.mapContainer.css({height:_3-20,left:0,top:20});
}
this.obliquePlaces=null;
var _4=this;
if(!_1.mainMap){
this.Container.css({border:"1px solid #D8D8D8"});
if(_1.toolBarSettings){
this.toolbarContainer=jQuery("<div></div>").css({position:"absolute",width:_2,left:0,top:0,zIndex:1}).appendTo(this.Container);
this.mapContainer.css({height:_3-20,left:0,top:20});
}
this.messageBoard=new KrakMap.MessageBoard(this);
this.initObliqueService();
this.ObliqueService.getBestPhotoPlaces(function(){
if(_4.mapType!="oblique"&&_4.toolbar&&_4.toolbar.oblique){
_4.toolbar.obliqueAvailable(_4);
}
});
this.obliqueResponse=null;
if(jQuery.browser.opera||(jQuery.browser.safari&&parseInt(jQuery.browser.version)<523)){
this.grabCursor="move";
this.grabbingCursor="move";
this.crosshairCursor="crosshair";
}else{
if(jQuery.browser.safari){
this.grabCursor="url("+this.imgDir+"cursors/cursor_grab.cur) 11 12,move";
this.grabbingCursor="url("+this.imgDir+"cursors/cursor_grabbing.cur) 10 12,move";
this.crosshairCursor="url("+this.imgDir+"cursors/cursor_crosshair.cur) 15 14,crosshair";
}else{
this.grabCursor="url("+this.imgDir+"cursors/cursor_grab.cur),move";
this.grabbingCursor="url("+this.imgDir+"cursors/cursor_grabbing.cur),move";
this.crosshairCursor="url("+this.imgDir+"cursors/cursor_crosshair.cur),crosshair";
}
}
}
this.eventCatcher=null;
this.gridContainer=jQuery("<div></div>").css({position:"absolute",zIndex:0}).appendTo(this.mapContainer);
this.gridContainerDomStyle=this.gridContainer.get(0).style;
this.mapGrid=jQuery("<div></div>").css({position:"absolute",zIndex:1}).appendTo(this.gridContainer);
this.mapGridDom=this.mapGrid.get(0);
this.zoomGrid=jQuery("<div></div>").css({position:"absolute",zIndex:0}).appendTo(this.gridContainer);
this.poiLayerContainer=jQuery("<div></div>").css({position:"absolute",zIndex:3}).appendTo(this.mapContainer);
this.poiLayerContainerDomStyle=this.poiLayerContainer.get(0).style;
this.mapContainerPixelWidth=this.mapContainer.width();
this.mapContainerPixelHeight=this.mapContainer.height();
if(!_1.mainMap){
this.logo=jQuery("<img></img>").attr("src",this.imgDir+"Krak_logo.gif").css({position:"absolute",zIndex:"1",right:5,bottom:15}).appendTo(this.mapContainer);
this.copyright=jQuery("<div></div>").css({position:"absolute",zIndex:1,right:0,bottom:0,whiteSpace:"nowrap",color:"black",fontSize:9,fontFamily:"Verdana, Arial, Helvetica, sans-serif"}).appendTo(this.mapContainer);
}
var _4=this;
if(!_1.mainMap){
var _5=(jQuery.browser.msie?{backgroundImage:"url("+this.imgDir+"transparent.gif)"}:{backgroundColor:"transparent"});
this.eventCatcher=jQuery("<div></div>").css({position:"absolute",width:this.mapContainer.width(),height:this.mapContainer.height(),zIndex:"2",cursor:this.grabCursor}).css(_5).html("&nbsp;").appendTo(this.mapContainer);
this.eventCatcher.bind("mousedown",function(_6){
_4.mapMoveMousedown(_6);
});
this.eventCatcher.bind("mousemove",function(_7){
_4.trackMousemove(_7);
});
this.eventCatcher.bind("dblclick",function(_8){
_4.zoomByDoubleClick(_8);
});
this.eventCatcher.bind("click",function(){
_4.throwEvent("clicked");
});
this.eventCatcher.mousewheel(function(_9,_a){
_4.zoomWithMouseWheel(_9,_a);
return false;
});
}
if(_1.zoomLevels){
this.zoomLevels=_1.zoomLevels;
}else{
this.zoomLevels=[0.125,0.25,0.5,1,2,4,8,16,32,64,128,256,512,1024];
}
this.currentZoomLevel=-1;
this.mapType="kvec";
this.minZoomLevel=0;
if(_1.minZoomLevel){
this.minZoomLevel=Number(_1.minZoomLevel);
}
this.maxZoomLevel=this.zoomLevels.length-1;
if(_1.maxZoomLevel){
this.maxZoomLevel=Number(_1.maxZoomLevel);
}
var _b=1;
this.vectorMinZoomLevel=0;
for(var i=0;i<this.zoomLevels.length;i++){
if(this.zoomLevels[i]<=_b&&i>this.vectorMinZoomLevel){
this.vectorMinZoomLevel=i;
}
}
this.metersPerPixel=0;
this.tilePixelWidth=256;
this.tilePixelHeight=256;
this.tileMeterWidth=0;
this.tileMeterHeight=0;
this.bufferSize=0;
if(_1.bufferSize){
this.bufferSize=Number(_1.bufferSize);
}
this.mapGridTilesWidth=0;
this.mapGridTilesHeight=0;
this.fullExtent=new KrakMap.Extent(6413000,6033000,27500,1302500);
this.tileExtent=new KrakMap.Extent(0,0,0,0);
this.mapGridExtent=new KrakMap.Extent(0,0,0,0);
this.mapGridPixelExtent=new KrakMap.Extent(0,0,0,0);
this.mapViewExtent=new KrakMap.Extent(0,0,0,0);
this.mapGridCenter=new KrakMap.Coordinate(0,0);
this.mapViewCenter=new KrakMap.Coordinate(0,0);
this.mapGridTopLeftCoordinate=new KrakMap.Coordinate(0,0);
this.customTiles={};
this.eventReceivers={};
this.eventSubscriptions={};
this.updateTimer=null;
this.zoomTimer=null;
this.deltaZoom=0;
this.domainDistroServers=new Array("tile10.krak.dk","tile11.krak.dk","tile12.krak.dk","tile13.krak.dk");
if(_1.domainDistroServers){
this.domainDistroServers=_1.domainDistroServers;
}
this.distributionBase=8;
this.mousePositionX=0;
this.mousePositionY=0;
this.measuredExtent=new KrakMap.Extent(0,0,0,0);
this.measureBox=false;
this.navigationKeys=false;
this.toolbar={};
this.toolBarSettings={};
if(!_1.mainMap&&_1.toolBarSettings){
this.toolBarSettings=_1.toolBarSettings;
this.createToolbar(_1.toolBarSettings);
}
this.overviewMap=null;
this.viewIndicator=null;
this.overviewMapContainer=null;
this.overviewMapSettings={};
if(_1.overviewMapSettings){
this.overviewMapSettings=_1.overviewMapSettings;
}
this.mainMap=null;
if(_1.mainMap){
this.mainMap=_1.mainMap;
}
this.viewIndicator=null;
this.animateMoveTimer=null;
this.animateMoveStepTo={};
this.targetPixelCoordinate=new KrakMap.Coordinate(null,null);
this.scrollDirection={horizontal:"",vertical:""};
this.scrollSpeed=5;
this.animateScrollTimer=null;
this.routeFallBack=false;
if(_1.routeFallBack){
this.routeFallBack=_1.routeFallBack;
}
this.route=null;
this.routeWkt=null;
this.routeSearchContainer=null;
this.routeSearchOpen=false;
this.poiLayers=new Object();
this.poiGeneratedId=1;
this.polygonDrawEnabled=false;
this.polygonDrawCoordinates=[];
this.polygonDrawStartPointX=0;
this.polygonDrawStartPointY=0;
this.polygonWKTString="";
this.polygonDrawTempRoute=null;
this.polygonDrawPoints=null;
this.circleDrawEnabled=false;
this.measureLineEnabled=false;
this.measureLineCoordinates=[];
this.measureLineStartPointX=0;
this.measureLineStartPointY=0;
this.measureLineWKTString="";
this.measureLineTempRoute=null;
this.measureLinePoints=null;
this.measureLineLength=0;
this.circleCenter=null;
this.circleRadius=null;
this.circleApproximationEdges=64;
this.circleSegmentLength=2*Math.PI/this.circleApproximationEdges;
this.nonObliqueZoomLevels=this.zoomLevels.concat();
this.nonObliqueFullExtent=new KrakMap.Extent(this.fullExtent.top,this.fullExtent.bottom,this.fullExtent.left,this.fullExtent.right);
if(!this.mainMap){
if(_1.startingPoint){
var sp=_1.startingPoint;
this.jumpToCoordinate(sp.zoomLevel,sp.coordinate.x,sp.coordinate.y,sp.mapType,sp.direction);
}else{
this.jumpToFullExtent();
}
}
this.firstJump=true;
return new KrakMap.API(this);
};
KrakMap.TileClient.prototype.initObliqueService=function(){
if(!this.ObliqueService){
this.ObliqueService=new KrakMap.ObliqueService(this);
}
};
KrakMap.TileClient.prototype.buildGrid=function(){
this.throwEvent("beforeBuildingGrid");
this.throwEvent("buildingGrid");
this.redrawPoiLayers();
if(this.mainMap==null){
this.updateCopyright();
}
if(this.overviewMap){
var _e=this.overviewMap;
clearInterval(this.animateMoveTimer);
clearInterval(this.animateScrollTimer);
clearInterval(_e.animateMoveTimer);
clearInterval(_e.animateScrollTimer);
if(this.mapType=="oblique"){
var _f=this.obliquePixelToGeoCoordinates(new KrakMap.Coordinate(this.mapViewCenter.x,this.obliqueResponse.actualpixeldimensions[1]-this.mapViewCenter.y));
}else{
var _f=this.mapViewCenter;
}
_e.jumpToCoordinate(this.currentZoomLevel+this.overviewMapSettings.elevation,_f.x,_f.y,"kvec");
}
var _10=this.mapGridTilesWidth;
var _11=this.mapGridTilesHeight;
var _12=this.mapGridExtent;
var _13=this.metersPerPixel;
var _14=this.tilePixelWidth;
var _15=this.tilePixelHeight;
var _16=this.mapGridPixelExtent.bottom;
var _17=this.tileExtent;
var _18=this.tileMeterWidth;
var _19=this.tileMeterHeight;
var _1a=this.mapType;
var _1b=this.domainDistroServers;
var _1c=this.mapGridDom;
var _1d=this.tileVersion;
var _1e=this.customTiles;
var _1f=document.createDocumentFragment();
for(key in _1e){
_1e[key].documentFragment=document.createDocumentFragment();
_1e[key].container.empty();
}
if(this.mapType=="oblique"){
var _20=((Math.floor(this.mapGridExtent.bottom/_15))*this.obliqueResponse.tiledimensions[0])+(Math.floor(this.mapGridExtent.left/_14));
var _21=this.obliqueResponse;
var _22=this.ObliqueService;
var _23=this.currentZoomLevel;
var _24=this;
var _25=function(x,y){
return _20+x+(y*_24.obliqueResponse.tiledimensions[0]);
};
}
_1c.innerHTML="";
for(var i=0;i<_10;i++){
for(var j=0;j<_11;j++){
var _2a=_12.left+(_13*_14*i);
var _2b=_12.bottom+(_13*_15*j);
if(_2a>=_17.left&&_2a<=_17.right-_18&&_2b>=_17.bottom&&_2b<=_17.top-_19){
if(_1a!="oblique"){
var _2c=_14*i;
var _2d=_16-(_15*(j+1));
var _2e=(((_2a-_17.left)/_18)+((_2b-_17.bottom)/_18));
var _2f=_2e%_1b.length;
var _30=_2e%this.distributionBase;
var _31=document.createElement("img");
var _32=_31.style;
_31.src="http://"+_1b[_2f]+"/"+_30+"/"+_1a+"/"+_13.toFixed(2)+"/"+_2a.toFixed(2)+"/"+_2b.toFixed(2)+"/v"+_1d;
_31.id=_2a.toFixed(0)+"_"+_2b.toFixed(0);
_32.position="absolute";
_32.left=_2c+"px";
_32.top=_2d+"px";
_32.width=_14+"px";
_32.height=_15+"px";
_1f.appendChild(_31);
for(key in _1e){
if(_1e[key].show){
var _31=document.createElement("img");
var _32=_31.style;
var url=_1e[key].url.replace("#LEFT#",_2a.toFixed(2));
url=url.replace("#BOTTOM#",_2b.toFixed(2));
_31.src=url.replace("#MPP#",_13.toFixed(2));
_31.id=_2a.toFixed(0)+"_"+_2b.toFixed(0)+"_"+key;
_32.position="absolute";
_32.left=_2c+"px";
_32.top=_2d+"px";
_32.width=_14+"px";
_32.height=_15+"px";
_1e[key].documentFragment.appendChild(_31);
}
}
}else{
if(this.mapType=="oblique"){
var _2c=_14*i;
var _2d=_16-(_15*(j+1));
var _34=_25(i,j);
var _2e=(Math.floor(_34/_21.tiledimensions[0]))+(_34%_21.tiledimensions[0]);
var _2f=_2e%_1b.length;
var _30=_2e%this.distributionBase;
var _31=document.createElement("img");
var _32=_31.style;
_31.src="http://"+_1b[_2f]+"/oblique/"+_30+"/"+_21.direction+"/"+_22.zoomLevels[_23]+"/"+_21.filename+"/"+_34+".jpg";
_31.id="obliqueTile"+_25(i,j);
_32.position="absolute";
_32.left=_2c+"px";
_32.top=_2d+"px";
_32.width=_14+"px";
_32.height=_15+"px";
_1f.appendChild(_31);
}
}
}
}
}
_1c.appendChild(_1f);
for(key in _1e){
_1e[key].container.get(0).appendChild(_1e[key].documentFragment);
_1e[key].documentFragment=null;
}
this.throwEvent("afterBuildingGrid");
};
KrakMap.TileClient.prototype.alignTiles=function(){
if(this.mapType!="oblique"){
switch(this.zoomLevels[this.currentZoomLevel]){
case 0.125:
return new KrakMap.Extent(6413000,6033000,427480,902520);
break;
case 0.25:
return new KrakMap.Extent(6413048,6032952,427464,902536);
break;
case 0.5:
return new KrakMap.Extent(6413016,6032984,427496,902504);
break;
case 1:
return new KrakMap.Extent(6413080,6032920,427304,902696);
break;
case 2:
return new KrakMap.Extent(6413208,6032792,427176,902824);
break;
case 4:
return new KrakMap.Extent(6413976,6032024,426920,903080);
break;
case 8:
return new KrakMap.Extent(6414488,6031512,426408,903592);
break;
case 16:
return new KrakMap.Extent(6413464,6032536,425384,904616);
break;
case 32:
return new KrakMap.Extent(6415512,6030488,423336,906664);
break;
case 64:
return new KrakMap.Extent(6427800,6018200,427432,902568);
break;
case 128:
return new KrakMap.Extent(6435992,6010008,419240,910760);
break;
case 256:
return new KrakMap.Extent(6452376,5993624,370088,959912);
break;
case 512:
return new KrakMap.Extent(6419608,6026392,337320,992680);
break;
case 750:
return new KrakMap.Extent(6511000,5935000,377000,953000);
break;
case 1024:
return new KrakMap.Extent(6616216,5829784,271784,1058216);
break;
case 2048:
return new KrakMap.Extent(6485144,5960856,402856,927144);
break;
case 3328:
return new KrakMap.Extent(6648984,5797016,239016,1090984);
break;
default:
var _35=this.fullExtent;
var _36=new KrakMap.Coordinate((_35.left+_35.right)/2,(_35.bottom+_35.top)/2);
var _37=this.zoomLevels[this.currentZoomLevel]*this.tilePixelWidth;
var _38=_37/2;
var _39=new KrakMap.Extent(_36.y+_38,_36.y-_38,_36.x-_38,_36.x+_38);
var _3a=new KrakMap.Extent(0,0,0,0);
if(_39.left<_35.left){
_3a.left=_39.left;
}else{
_3a.left=_39.left-(Math.ceil(Math.abs(_39.left-_35.left)/_37)*_37);
}
if(_39.bottom<_35.bottom){
_3a.bottom=_39.bottom;
}else{
_3a.bottom=_39.bottom-(Math.ceil(Math.abs(_39.bottom-_35.bottom)/_37)*_37);
}
if(_39.right>_35.right){
_3a.right=_39.right;
}else{
_3a.right=_39.right+(Math.ceil(Math.abs(_35.right-_39.right)/_37)*_37);
}
if(_39.top>_35.top){
_3a.top=_39.top;
}else{
_3a.top=_39.top+(Math.ceil(Math.abs(_35.top-_39.top)/_37)*_37);
}
_3a.left=Math.round(_3a.left*100)/100;
_3a.bottom=Math.round(_3a.bottom*100)/100;
_3a.right=Math.round(_3a.right*100)/100;
_3a.top=Math.round(_3a.top*100)/100;
return _3a;
break;
}
}else{
return new KrakMap.Extent(this.obliqueResponse.actualpixeldimensionswithblackborder[1],0,0,this.obliqueResponse.actualpixeldimensionswithblackborder[0]);
}
};
KrakMap.TileClient.prototype.validateExtent=function(){
var _3b=this.fullExtent;
var _3c=this.mapViewExtent;
var _3d=new KrakMap.Coordinate((_3b.right+_3b.left)/2,(_3b.top+_3b.bottom)/2);
if(_3b.top<_3c.top){
this.mapViewCenter.y=this.mapViewCenter.y-(_3c.top-_3b.top);
}
if(_3b.bottom>_3c.bottom){
this.mapViewCenter.y=this.mapViewCenter.y+(_3b.bottom-_3c.bottom);
}
if(_3b.left>_3c.left){
this.mapViewCenter.x=this.mapViewCenter.x+(_3b.left-_3c.left);
}
if(_3b.right<_3c.right){
this.mapViewCenter.x=this.mapViewCenter.x-(_3c.right-_3b.right);
}
if(_3b.right-_3b.left<_3c.right-_3c.left){
this.mapViewCenter.x=_3d.x;
}
if(_3b.top-_3b.bottom<_3c.top-_3c.bottom){
this.mapViewCenter.y=_3d.y;
}
this.calculateMapViewAndGridExtent();
};
KrakMap.TileClient.prototype.calculateMapViewAndGridExtent=function(){
var _3e=this.metersPerPixel;
var _3f=this.mapViewExtent;
var _40=this.mapViewCenter;
var _41=this.mapContainerPixelWidth;
var _42=this.mapContainerPixelHeight;
var _43=this.mapGridExtent;
var _44=this.tileExtent;
var _45=this.tileMeterWidth;
var _46=this.tileMeterHeight;
var _47=this.bufferSize;
_3f.top=_40.y+(_42*_3e/2);
_3f.bottom=_40.y-(_42*_3e/2);
_3f.left=_40.x-(_41*_3e/2);
_3f.right=_40.x+(_41*_3e/2);
_43.bottom=_44.bottom+(Math.floor((_3f.bottom-_44.bottom)/_46)*_46)-(_47*_46);
_43.top=_44.top-(Math.floor((_44.top-_3f.top)/_46)*_46)+(_47*_46);
_43.left=_44.left+(Math.floor((_3f.left-_44.left)/_45)*_45)-(_47*_45);
_43.right=_44.right-(Math.floor((_44.right-_3f.right)/_45)*_45)+(_47*_45);
this.mapGridTopLeftCoordinate.x=_43.left;
this.mapGridTopLeftCoordinate.y=_43.top;
this.mapViewExtent=_3f;
this.mapGridExtent=_43;
};
KrakMap.TileClient.prototype.addTile=function(_48,_49,_4a,_4b){
var _4c=this.metersPerPixel;
var _4d=this.tilePixelWidth;
var _4e=this.tilePixelHeight;
var _4f=this.mapGridPixelExtent.bottom;
var _50=this.tileExtent;
var _51=this.domainDistroServers;
var _52=this.tileMeterWidth;
var _53=this.tileMeterHeight;
var _54=this.mapType;
var _55=this.mapGridDom;
var _56=this.tileVersion;
if(_54=="oblique"){
var _57=this.obliqueResponse;
var _58=this.ObliqueService;
var _59=this.currentZoomLevel;
}
if(_48>=_50.left&&_48<=_50.right-_52&&_49>=_50.bottom&&_49<=_50.top-_53){
if(_54!="oblique"){
var _5a=(((_48-_50.left)/_52)+((_49-_50.bottom)/_52));
var _5b=_5a%_51.length;
var _5c=_5a%this.distributionBase;
var _5d=document.createElement("img");
var _5e=_5d.style;
_5d.src="http://"+_51[_5b]+"/"+_5c+"/"+_54+"/"+_4c.toFixed(2)+"/"+_48.toFixed(2)+"/"+_49.toFixed(2)+"/v"+_56;
_5d.id=_48.toFixed(0)+"_"+_49.toFixed(0);
_5e.position="absolute";
_5e.left=_4a+"px";
_5e.top=_4b+"px";
_5e.width=_4d+"px";
_5e.height=_4e+"px";
_55.appendChild(_5d);
var _5f=this.customTiles;
for(key in _5f){
if(_5f[key].show){
var _5d=document.createElement("img");
var _5e=_5d.style;
var url=_5f[key].url.replace("#LEFT#",_48.toFixed(2));
url=url.replace("#BOTTOM#",_49.toFixed(2));
_5d.src=url.replace("#MPP#",_4c.toFixed(2));
_5d.id=_48.toFixed(0)+"_"+_49.toFixed(0)+"_"+key;
_5e.position="absolute";
_5e.left=_4a+"px";
_5e.top=_4b+"px";
_5e.width=_4d+"px";
_5e.height=_4e+"px";
_5f[key].container.append(_5d);
}
}
}else{
if(_54=="oblique"){
var _5d=document.createElement("img");
var _5e=_5d.style;
var _61=((Math.ceil(_49/_4e))*_57.tiledimensions[0])+(Math.ceil(_48/_4d));
var _5a=(Math.floor(_61/_57.tiledimensions[0]))+(_61%_57.tiledimensions[0]);
var _5c=_5a%this.distributionBase;
_5d.src="http://"+_51[0]+"/oblique/"+_5c+"/"+_57.direction+"/"+_58.zoomLevels[_59]+"/"+_57.filename+"/"+_61+".jpg";
_5d.id="obliqueTile"+_61;
_5e.position="absolute";
_5e.left=_4a+"px";
_5e.top=_4b+"px";
_5e.width=_4d+"px";
_5e.height=_4e+"px";
_55.appendChild(_5d);
}
}
}
};
KrakMap.TileClient.prototype.updateCopyright=function(){
var _62=this.metersPerPixel;
var _63="";
switch(this.mapType){
case "kvec":
_63="&copy; Kraks Forlag AS &copy; D.A.V.";
break;
case "ortho":
_63="&copy; COWI";
break;
case "ovc":
_63="&copy; Kraks Forlag AS &copy; D.A.V. &copy; COWI";
break;
case "oblique":
_63="&copy; COWI";
break;
default:
_63="&copy; Kraks Forlag AS &copy; D.A.V. &copy; COWI";
break;
}
var _64={0.125:[80,"10 m"],0.25:[100,"25 m"],0.5:[100,"50 m"],1:[100,"100 m"],2:[100,"200 m"],3:[100,"300 m"],4:[100,"400 m"],8:[100,"800 m"],16:[94,"1,5 km"],32:[94,"3 km"],64:[94,"6 km"],128:[94,"12 km"],256:[98,"25 km"],512:[98,"50 km"],750:[100,"75 km"],1024:[98,"100 km"],2048:[98,"200 km"],3328:[90,"300 km"]};
if(_64[_62]==undefined){
if(_62>10){
_64[_62]=[100,(_62/10)+" km"];
}else{
_64[_62]=[100,(_62*100)+" m"];
}
}
if(this.mapType=="oblique"){
var _65="";
}else{
var _65="<img alt=\"\" src=\""+this.imgDir+"scale_end.gif\" width=\"1\" height=\"10\" border=\"0\"><img alt=\"\" src=\""+this.imgDir+"scale_middle.gif\" width=\""+_64[_62][0]+"\" height=\"10\" border=\"0\"><img alt=\"\" src=\""+this.imgDir+"scale_end.gif\" width=\"1\" height=\"10\" border=\"0\"> "+_64[_62][1];
}
this.copyright.html(_63+" "+_65);
};
KrakMap.TileClient.prototype.animateMove=function(obj,_67){
var _68=obj.gridContainerDomStyle;
var x=parseInt(_68.left);
var y=parseInt(_68.top);
if(this.mainMap){
var _6b=5;
}else{
if(this.overviewMap){
var _6b=60;
}
}
var _6c=Math.abs(_67.x-x);
var _6d=Math.abs(_67.y-y);
var _6e=Math.sqrt((_6c*_6c)+(_6d*_6d))/_6b;
var _6f=Math.round(_6c/_6e);
var _70=Math.round(_6d/_6e);
if(obj.mapViewExtent.left>=obj.fullExtent.left&&obj.mapViewExtent.right<=obj.fullExtent.right){
if(x+_6f<_67.x){
this.animateMoveStepTo.moveX=x+_6f;
}else{
if(x-_6f>_67.x){
this.animateMoveStepTo.moveX=x-_6f;
}else{
this.animateMoveStepTo.moveX=_67.x;
}
}
}else{
this.animateMoveStepTo.moveX=_67.x;
}
if(obj.mapViewExtent.top<=obj.fullExtent.top&&obj.mapViewExtent.bottom>=obj.fullExtent.bottom){
if(y+_70<_67.y){
this.animateMoveStepTo.moveY=y+_70;
}else{
if(y-_70>_67.y){
this.animateMoveStepTo.moveY=y-_70;
}else{
this.animateMoveStepTo.moveY=_67.y;
}
}
}else{
this.animateMoveStepTo.moveY=_67.y;
}
obj.mapMoveMousemove(null);
};
KrakMap.TileClient.prototype.scrollMap=function(){
clearInterval(this.animateScrollTimer);
var _71=this;
this.animateScrollTimer=setInterval(function(){
_71.animateScrollMap(_71,_71.scrollDirection);
},1);
};
KrakMap.TileClient.prototype.animateScrollMap=function(obj,_73){
var _74=obj.gridContainerDomStyle;
var _75={};
switch(_73.horizontal){
case "left":
_75.moveX=(parseInt(_74.left)+obj.scrollSpeed);
break;
case "right":
_75.moveX=(parseInt(_74.left)-obj.scrollSpeed);
break;
default:
_75.moveX=parseInt(_74.left);
break;
}
switch(_73.vertical){
case "up":
_75.moveY=(parseInt(_74.top)+obj.scrollSpeed);
break;
case "down":
_75.moveY=(parseInt(_74.top)-obj.scrollSpeed);
break;
default:
_75.moveY=parseInt(_74.top);
break;
}
obj.animateMoveStepTo=_75;
obj.mapMoveMousemove(null);
};
KrakMap.TileClient.prototype.getPoiLayer=function(_76){
if(this.poiLayers[_76]){
return this.poiLayers[_76];
}
var _77=document.createElement("div");
_77.id=_76;
_77.style.position="absolute";
this.poiLayerContainer.get(0).appendChild(_77);
this.poiLayers[_76]=new KrakMap.PoiLayerData(_77);
return this.poiLayers[_76];
};
KrakMap.TileClient.prototype.sortPoiLayers=function(_78){
for(var i=0;i<_78.length;i++){
if(this.poiLayers[_78[i]]){
this.poiLayers[_78[i]].layer.style.zIndex=i;
}
}
};
KrakMap.TileClient.prototype.isPoiLayer=function(_7a){
if(this.poiLayers&&this.poiLayers[_7a]&&this.poiLayers[_7a].layer.style.display!="none"){
return true;
}
return false;
};
KrakMap.TileClient.prototype.redrawPoiLayers=function(){
var _7b=this.poiLayers;
for(layerKey in _7b){
for(poiKey in _7b[layerKey].pois){
var _7c=this.geoToPixelCoordinate(_7b[layerKey].pois[poiKey].x,_7b[layerKey].pois[poiKey].y);
if(this.mapType=="oblique"){
_7b[layerKey].pois[poiKey].poi.style.display="none";
}else{
var _7d=_7b[layerKey].pois[poiKey].poi.style;
_7d.left=Math.round(_7c.x-_7b[layerKey].pois[poiKey].width/2)+"px";
_7d.top=Math.round(_7c.y-_7b[layerKey].pois[poiKey].height/2)+"px";
_7d.display="block";
}
}
}
};
KrakMap.TileClient.prototype.createToolbar=function(_7e){
this.toolbar.container=jQuery("<div></div>").css({height:"19px",borderTop:"1px solid #D8D8D8",borderBottom:"1px solid #D8D8D8",background:"url("+this.imgDir+"toolbar/gfx_bgtile_maptoolbar.gif) left center repeat-x"}).appendTo(this.toolbarContainer);
this.toolbar.group1=jQuery("<span></span>").css({borderRight:"1px solid #D8D8D8","float":"left",display:"block",width:"auto"}).appendTo(this.toolbar.container);
this.toolbar.group2=jQuery("<span></span>").css({"float":"right",display:"block",width:"auto"}).appendTo(this.toolbar.container);
this.toolbar.group3=jQuery("<span></span>").css({"float":"right",display:"block",width:"auto"}).appendTo(this.toolbar.container);
this.toolbar.group4=jQuery("<span></span>").css({"float":"right",display:"block",width:"auto"}).appendTo(this.toolbar.container);
jQuery("<div></div>").css({position:"absolute",left:"0px",top:"0px",height:"5px",width:"100%",margin:"0pt",padding:"0pt",zIndex:10,background:"transparent url("+this.imgDir+"toolbar/shadow.png) repeat-x scroll left top"}).appendTo(this.mapContainer);
var _7f=function(obj){
return jQuery("<a></a>").css({background:"transparent url("+obj.imgDir+"toolbar/gfx_bgimage_mapbuttons.gif) repeat-x scroll 0pt",backgroundPosition:"0pt 0pt",borderLeft:"1px solid #D8D8D8",color:"#737373",display:"block","float":"left",fontSize:"10px",height:"20px",lineHeight:"20px",padding:"0pt 8px",margin:"0pt",display:"block",textDecoration:"none",cursor:"pointer"}).attr("href","# ");
};
var _81=function(obj,_83,_84){
return jQuery("<span></span>").css({backgroundPosition:"50%",backgroundRepeat:"no-repeat",backgroundImage:"url("+obj.imgDir+"toolbar/"+_83+")",textIndent:"-3000px",width:"15px",display:"block",margin:"0pt",padding:"0pt",color:"#737373",fontSize:"10px",lineHeight:"20px",textAlign:"left"}).text(_84);
};
var _85=this;
if(_7e.kvec){
this.toolbar.kvec=_7f(this).text("Kort").attr("title","Vektor kort").appendTo(this.toolbar.group1);
this.toolbar.kvec.bind("click",function(){
if(_85.getMapType()!="kvec"){
_85.changeMapType("kvec");
}
return false;
});
}
if(_7e.ortho){
this.toolbar.ortho=_7f(this).text("Foto").attr("title","Luftfoto").appendTo(this.toolbar.group1);
this.toolbar.ortho.bind("click",function(){
if(_85.getMapType()!="ortho"){
_85.changeMapType("ortho");
}
return false;
});
}
if(_7e.ovc){
this.toolbar.ovc=_7f(this).text("Kombi").attr("title","Kort og luftfoto").appendTo(this.toolbar.group1);
this.toolbar.ovc.bind("click",function(){
if(_85.getMapType()!="ovc"){
_85.changeMapType("ovc");
}
return false;
});
}
if(_7e.oblique){
this.toolbar.oblique=_7f(this).html("Skr&aring;foto").attr("title","Skr\xe5foto").css({color:"#AAD",cursor:"default"}).appendTo(this.toolbar.group1);
this.toolbar.oblique.bind("click",function(){
if(_85.getMapType()!="oblique"&&_85.toolbar.isObliquePlace){
_85.changeMapType("oblique");
}
return false;
});
this.toolbar.isObliquePlace=false;
this.toolbar.obliqueAvailable=function(obj){
if(obj.mapType=="oblique"){
obj.toolbar.oblique.css({color:"#737373",cursor:"pointer"});
obj.toolbar.isObliquePlace=true;
}else{
if(obj.metersPerPixel<=2&&obj.ObliqueService.isAvailable(obj.mapViewCenter)){
obj.ObliqueService.getBestPhoto(0,obj.mapViewCenter.x,obj.mapViewCenter.y,"n",function(_87){
if(!_87.errorcode){
obj.toolbar.oblique.css({color:"#737373",cursor:"pointer"});
obj.toolbar.isObliquePlace=true;
}else{
obj.toolbar.oblique.css({color:"#AAD",cursor:"default"});
obj.toolbar.isObliquePlace=false;
}
});
}else{
obj.toolbar.oblique.css({color:"#AAD",cursor:"default"});
obj.toolbar.isObliquePlace=false;
}
}
};
this.getViewExtentUpdatedEvent(this,this.toolbar.obliqueAvailable);
this.getBuildingGridEvent(this,this.toolbar.obliqueAvailable);
}
if(this.toolbar[this.getMapType()]){
this.toolbar[this.getMapType()].css({color:"#71AAD5",fontWeight:"bold",backgroundPosition:"0px -20px"});
}
this.getMapTypeChangedEvent(this,function(obj){
obj.toolbar.group1.children().css({color:"#858585",fontWeight:"normal",backgroundPosition:"0px 0px"});
if(obj.toolbar[obj.getMapType()]){
obj.toolbar[obj.getMapType()].css({color:"#71AAD5",fontWeight:"bold",backgroundPosition:"0px -20px"});
}
});
if(_7e.zoom){
this.toolbar.zoomOut=_7f(this).html("&nbsp;").css({background:"transparent url("+this.imgDir+"toolbar/iconZoomOut.gif) no-repeat scroll 4px 6px",padding:"0pt",width:"16px"}).appendTo(this.toolbar.group2);
this.toolbar.zoomBar=jQuery("<span></span>").css({background:"transparent url("+this.imgDir+"toolbar/slideBar.gif) repeat-x scroll 100% 50%",display:"block","float":"left",height:"20px",position:"relative",width:"113px",margin:"0pt",padding:"0pt"}).appendTo(this.toolbar.group2);
this.toolbar.zoomBarEventcatcher=jQuery("<div></div>").css({cursor:"pointer",position:"absolute",width:"113px",height:"20px",zIndex:0,backgroundImage:"url("+this.imgDir+"transparent.gif)"}).appendTo(this.toolbar.zoomBar);
this.toolbar.zoomBarHandle=jQuery("<span></span>").css({background:"transparent url("+this.imgDir+"toolbar/iconSlider.gif) no-repeat scroll 50%",cursor:this.grabCursor,display:"block",height:"20px",left:"95px",position:"absolute",width:"18px",zIndex:1}).appendTo(this.toolbar.zoomBar);
this.toolbar.zoomIn=_7f(this).html("&nbsp;").css({background:"transparent url("+this.imgDir+"toolbar/iconZoomIn.gif) no-repeat scroll 4px 6px",padding:"0pt",width:"16px",border:"medium none"}).appendTo(this.toolbar.group2);
this.toolbar.adjustHandle=function(obj){
var _8a=obj.zoomLevelCheck(0);
if(obj.mapType=="oblique"){
var _8b=obj.ObliqueService.zoomLevels.length-1;
}else{
var _8b=obj.getMaxZoomLevel();
}
var _8c=(obj.toolbar.zoomBar.width()-obj.toolbar.zoomBarHandle.width())/(_8b-_8a);
if(obj.getCurrentZoomLevel()==_8a){
var _8d=Math.round(obj.toolbar.zoomBar.width()-obj.toolbar.zoomBarHandle.width());
}else{
if(obj.getCurrentZoomLevel()==_8b){
var _8d=0;
}else{
var _8d=_8c*(_8b-obj.getCurrentZoomLevel());
}
}
_85.toolbar.zoomBarHandle.css("left",Math.round(_8d)+"px");
};
this.toolbar.zoomBarMousedownAction=function(_8e){
var _8f=(_8e.pageX-_85.toolbar.zoomBar.offset().left);
var _90=_85.zoomLevelCheck(0);
var _91=(_85.toolbar.zoomBar.width())/(_85.getMaxZoomLevel()-_90);
var _92=_85.getMaxZoomLevel()-Math.round(_8f/_91);
if(!_8e.pageY&&_92==_85.currentZoomLevel){
_85.toolbar.adjustHandle(_85);
}else{
_85.zoomToLevel(_92);
}
};
this.getBuildingGridEvent(this,this.toolbar.adjustHandle);
this.toolbar.zoomIn.bind("click",function(){
_85.zoomToLevel(_85.getCurrentZoomLevel()-1);
return false;
});
this.toolbar.zoomOut.bind("click",function(){
_85.zoomToLevel(_85.getCurrentZoomLevel()+1);
return false;
});
this.toolbar.zoomBarEventcatcher.bind("mousedown",this.toolbar.zoomBarMousedownAction);
this.toolbar.zoomBarHandle.bind("mousedown",function(_93){
var x=_93.pageX;
var _95=_93.pageX-_85.toolbar.zoomBarHandle.offset().left;
var _96=parseInt(_85.toolbar.zoomBarHandle.css("left"));
var _97=function(_98){
if(_96+_98.pageX-x<0){
_85.toolbar.zoomBarHandle.css("left","0px");
}else{
if(_96+_98.pageX-x>(_85.toolbar.zoomBar.width()-_85.toolbar.zoomBarHandle.width())){
_85.toolbar.zoomBarHandle.css("left",(_85.toolbar.zoomBar.width()-_85.toolbar.zoomBarHandle.width())+"px");
}else{
_85.toolbar.zoomBarHandle.css("left",(_96+_98.pageX-x)+"px");
}
}
};
var _99=function(_9a){
_85.toolbar.zoomBarEventcatcher.unbind("mousemove").unbind("mouseup").unbind("mouseout");
_85.toolbar.zoomBarEventcatcher.css({zIndex:0,cursor:"pointer"});
_85.toolbar.zoomBarMousedownAction({pageX:_9a.pageX-_95+(_85.toolbar.zoomBarHandle.width()/2)});
};
_85.toolbar.zoomBarEventcatcher.css({zIndex:2,cursor:_85.grabbingCursor});
_85.toolbar.zoomBarEventcatcher.bind("mousemove",_97).bind("mouseup",_99).bind("mouseout",_99);
});
}
if(_7e.overviewMap){
var _9b=jQuery("<div></div>").css({position:"absolute",left:"-1px",bottom:"0px",zIndex:6,height:"19px",width:"20px",borderTop:"1px solid #D8D8D8",borderRight:"1px solid #D8D8D8",background:"url("+this.imgDir+"toolbar/gfx_bgtile_maptoolbar.gif) left center repeat-x"}).appendTo(this.mapContainer);
this.toolbar.overviewMap=_7f(this).html("&nbsp;").attr("title","Vis/Skjul oversigtskort").css({background:"transparent url("+this.imgDir+"toolbar/gfx_button_maptoggle.gif) no-repeat 2px 1px",padding:"0pt 8px"}).appendTo(_9b);
this.toolbar.overviewMap.bind("click",function(){
_85.toggleOverviewMap();
return false;
});
}
if(_7e.center){
this.toolbar.center=_7f(this).attr("title","Tilbage til udgangspunkt").html(_81(this,"gfx_bgimage_center.gif","Centr\xe9r")).appendTo(this.toolbar.group3);
}
if(_7e.print){
this.toolbar.print=_7f(this).attr("title","Udskriv kort").html(_81(this,"gfx_bgimage_print.gif","Print")).appendTo(this.toolbar.group3);
this.toolbar.print.bind("click",function(){
window.print();
return false;
});
}
if(_7e.polygonDraw){
this.toolbar.polygonDraw=_7f(this).attr("title","Mark\xe9r omr\xe5de").html(_81(this,"gfx_bgimage_polygon.gif","Polygon")).appendTo(this.toolbar.group4);
this.toolbar.polygonDraw.bind("click",function(){
_85.togglePolygonDraw();
return false;
});
}
if(_7e.radius){
this.toolbar.radius=_7f(this).attr("title","Mark\xe9r omr\xe5de").html(_81(this,"gfx_bgimage_radius.gif","Radius")).appendTo(this.toolbar.group4);
this.toolbar.radius.bind("click",function(){
_85.toggleCircleDraw();
return false;
});
}
if(_7e.measureTool){
this.toolbar.measureTool=_7f(this).attr("title","Mark\xe9r omr\xe5de").html(_81(this,"gfx_bgimage_meassure.gif","Measure")).appendTo(this.toolbar.group4);
this.toolbar.measureTool.bind("click",function(){
_85.toggleMeasureLine();
return false;
});
}
if(_7e.route){
this.toolbar.route=_7f(this).attr("title","Rute- og rejseplan").html(_81(this,"gfx_bgimage_route.gif","Ruteplan")).appendTo(this.toolbar.group4);
this.toolbar.route.bind("click",function(){
_85.toggleRouteSearch();
return false;
});
}
if(_7e.measureBox){
this.toolbar.measureBox=_7f(this).attr("title","Mark\xe9r omr\xe5de").html(_81(this,"gfx_bgimage_zoom.gif","Zoom")).appendTo(this.toolbar.group4);
this.toolbar.measureBoxZoom=function(){
_85.jumpToExtent(_85.measuredExtent);
};
this.toolbar.measureBox.bind("click",function(){
if(_85.getMeasureBox()){
_85.unsubscribeEvent("measuredExtent",_85.toolbar.measureBoxZoom);
_85.disableMeasureBox();
}else{
_85.subscribeEvent("measuredExtent",_85.toolbar.measureBoxZoom);
_85.enableMeasureBox();
}
return false;
});
}
};
KrakMap.TileClient.prototype.zoomLevelCheck=function(_9c){
if(this.mapType!="oblique"){
if(_9c>this.getMaxZoomLevel()){
_9c=this.getMaxZoomLevel();
}
if(this.getMapType()!="ortho"&&_9c<this.getVectorMinZoomLevel()){
_9c=this.getVectorMinZoomLevel();
}
if(_9c<this.getMinZoomLevel()){
_9c=this.getMinZoomLevel();
}
}else{
if(_9c<0){
_9c=0;
}
if(_9c>this.ObliqueService.zoomLevels.length-1){
_9c=this.ObliqueService.zoomLevels.length-1;
}
}
return _9c;
};
KrakMap.TileClient.prototype.polygonDrawAddCoordinate=function(_9d){
var _9e=this.pixelToGeoCoordinate(this.mousePositionX,this.mousePositionY);
if(this.polygonWKTString.length==0){
this.throwEvent("beforePolygonDraw");
this.polygonDrawStartPointX=_9e.x;
this.polygonDrawStartPointY=_9e.y;
if(this.route){
this.route.clearWkt();
}
this.route=new wktCanvas(this);
this.polygonDrawTempRoute=this.route;
if(this.polygonDrawEnabled){
var _9f=this;
this.eventCatcher.bind("mousemove",function(_a0){
_9f.polygonDrawUpdatePosition(_a0);
});
}
this.polygonWKTString=_9e.x+" "+_9e.y;
}else{
var dx=Math.abs(this.polygonDrawStartPointX-_9e.x)/this.zoomLevels[this.currentZoomLevel];
var dy=Math.abs(this.polygonDrawStartPointY-_9e.y)/this.zoomLevels[this.currentZoomLevel];
var _a3=Math.sqrt((dx*dx)+(dy*dy));
if(_a3<10){
_9e=this.polygonDrawCoordinates[0];
this.disablePolygonDraw();
}
this.polygonWKTString+=","+_9e.x+" "+_9e.y;
}
this.throwEvent("beforeAddPoint");
this.polygonDrawCoordinates.push(_9e);
var _a4="LINESTRING("+this.polygonWKTString+")";
this.route=this.polygonDrawTempRoute;
this.route.setWkt(_a4,true,false);
this.polygonDrawTempRoute=this.route;
this.throwEvent("afterAddPoint");
if(!this.polygonDrawEnabled){
this.throwEvent("polygonDraw");
this.throwEvent("afterPolygonDraw");
}
};
KrakMap.TileClient.prototype.polygonDrawUpdatePosition=function(_a5){
if(this.polygonDrawEnabled&&!jQuery.browser.msie){
var _a6=this.pixelToGeoCoordinate(this.mousePositionX,this.mousePositionY);
var _a7="LINESTRING("+this.polygonWKTString+","+_a6.x+" "+_a6.y+")";
this.route=this.polygonDrawTempRoute;
this.route.setWkt(_a7,true,false);
}
};
KrakMap.TileClient.prototype.measureLineAddCoordinate=function(_a8){
var _a9=this.pixelToGeoCoordinate(this.mousePositionX,this.mousePositionY);
if(this.measureLineWKTString.length==0){
this.throwEvent("beforeMeasureTool");
this.measureLineStartPointX=_a9.x;
this.measureLineStartPointY=_a9.y;
if(this.route){
this.route.clearWkt();
}
this.route=new wktCanvas(this);
this.measureLineTempRoute=this.route;
this.measureLineLength=0;
this.measureLineWKTString=_a9.x+" "+_a9.y;
}else{
this.measureLineWKTString+=","+_a9.x+" "+_a9.y;
}
this.throwEvent("beforeAddPoint");
this.measureLineCoordinates.push(_a9);
if(this.measureLineEnabled){
var _aa=this;
this.eventCatcher.bind("mousemove",function(_ab){
_aa.measureLineUpdatePosition(_ab);
});
}
var _ac="LINESTRING("+this.measureLineWKTString+")";
this.route=this.measureLineTempRoute;
this.route.setWkt(_ac,true,false);
this.measureLineTempRoute=this.route;
this.throwEvent("afterAddPoint");
};
KrakMap.TileClient.prototype.measureLineUpdatePosition=function(_ad){
if(this.measureLineEnabled){
var _ae=this.pixelToGeoCoordinate(this.mousePositionX,this.mousePositionY);
this.updateLengthOfMeasuredLine(_ae);
var _af="LINESTRING("+this.measureLineWKTString+","+_ae.x+" "+_ae.y+")";
this.route=this.measureLineTempRoute;
if(!jQuery.browser.msie){
this.route.setWkt(_af,true,false);
}
}
};
KrakMap.TileClient.prototype.updateLengthOfMeasuredLine=function(_b0){
var len=0,x1=0,y1=0,x2=0,y2=0,dx=0,dy=0;
for(var i=1;i<this.measureLineCoordinates.length;i++){
x1=this.measureLineCoordinates[i-1].x;
y1=this.measureLineCoordinates[i-1].y;
x2=this.measureLineCoordinates[i].x;
y2=this.measureLineCoordinates[i].y;
dx=x2-x1;
dy=y2-y1;
len+=Math.sqrt(dx*dx+dy*dy);
}
if(_b0!=undefined){
if(this.measureLineCoordinates.length==1){
dx=_b0.x-this.measureLineStartPointX;
dy=_b0.y-this.measureLineStartPointY;
}else{
dx=_b0.x-x2;
dy=_b0.y-y2;
}
len+=Math.sqrt(dx*dx+dy*dy);
}
this.measureLineLength=len;
this.throwEvent("measureLine");
return len;
};
KrakMap.TileClient.prototype.obliquePixelToGeoCoordinates=function(_b9){
var _ba=this.obliqueResponse;
var _bb=_ba.actualpixeldimensions[0];
var _bc=_ba.actualpixeldimensions[1];
if(_b9.x<0){
_b9.x=0;
}else{
if(_b9.x>_bb){
_b9.x=_bb;
}
}
if(_b9.y<0){
_b9.y=0;
}else{
if(_b9.y>_bc){
_b9.y=_bc;
}
}
var _bd=_ba.pixelsize;
var _be=_b9.x;
var _bf=_b9.y;
var rM=_ba.rotmat;
var _c1=_ba.offsetX;
var _c2=_ba.offsetY;
var _c3=_ba.cameraconstant;
var pcx=_ba.pcx;
var pcy=_ba.pcy;
var pcz=_ba.pcz;
var _c7=_ba.ndz0;
var xp=_bd*(_be-(_bb/2));
var yp=-(_bf-(_bc/2))*_bd;
var _ca=(rM[0][0]*(xp+_c1))+(rM[0][1]*(yp+_c2))-rM[0][2]*_c3;
var _cb=(rM[1][0]*(xp+_c1))+(rM[1][1]*(yp+_c2))-rM[1][2]*_c3;
var _cc=(rM[2][0]*(xp+_c1))+(rM[2][1]*(yp+_c2))-rM[2][2]*_c3;
var x=(_ca/_cc)*(_c7-pcz)+pcx;
var y=(_cb/_cc)*(_c7-pcz)+pcy;
return new KrakMap.Coordinate(x.toFixed(2),y.toFixed(2));
};
KrakMap.TileClient.prototype.obliqueGeoCoordinatesToPixel=function(utm){
var _d0=this.obliqueResponse;
var _d1=_d0.actualpixeldimensions[0];
var _d2=_d0.actualpixeldimensions[1];
var _d3=_d0.pixelsize;
var _d4=_d0.cameraconstant;
var _d5=_d0.offsetX;
var _d6=_d0.offsetY;
var rM=_d0.rotmat;
var pcx=_d0.pcx;
var pcy=_d0.pcy;
var pcz=_d0.pcz;
var _db=_d0.ndz0;
var _dc=utm.x;
var _dd=utm.y;
var _de=(rM[0][0]*(_dc-pcx))+(rM[1][0]*(_dd-pcy))+(rM[2][0]*(_db-pcz));
var _df=(rM[0][1]*(_dc-pcx))+(rM[1][1]*(_dd-pcy))+(rM[2][1]*(_db-pcz));
var _e0=(rM[0][2]*(_dc-pcx))+(rM[1][2]*(_dd-pcy))+(rM[2][2]*(_db-pcz));
var _e1=-_d4*(_de/_e0);
var _e2=-_d4*(_df/_e0);
var xp=_e1-_d5;
var yp=_e2-_d6;
var _e5=(xp/_d3)+(_d1/2);
var _e6=(_d2/2)-(yp/_d3);
return new KrakMap.Coordinate(Math.round(_e5),Math.round(_e6));
};
KrakMap.TileClient.prototype.obliquePixelToGeoExtent=function(ext){
var _e8=this.obliquePixelToGeoCoordinates(new KrakMap.Coordinate(ext.left,this.obliqueResponse.actualpixeldimensions[1]-ext.top));
var _e9=this.obliquePixelToGeoCoordinates(new KrakMap.Coordinate(ext.right,this.obliqueResponse.actualpixeldimensions[1]-ext.bottom));
switch(this.obliqueResponse.direction){
case "n":
return new KrakMap.Extent(_e8.y,_e9.y,_e8.x,_e9.x);
case "s":
return new KrakMap.Extent(_e9.y,_e8.y,_e9.x,_e8.x);
case "w":
return new KrakMap.Extent(_e9.y,_e8.y,_e8.x,_e9.x);
case "e":
return new KrakMap.Extent(_e8.y,_e9.y,_e9.x,_e8.x);
default:
return new KrakMap.Extent(0,0,0,0);
}
};
KrakMap.TileClient.prototype.obliqueResponseCompleted=function(_ea,x,y,_ed){
if(_ea.errorcode&&_ea.errorcode==204){
this.messageBoard.info(this.ObliqueService._texts.noimages);
this.jumpToCoordinate(this.currentZoomLevel,x,y,"kvec");
return;
}
if(this.obliqueResponse&&this.obliqueResponse.filename==_ea.filename&&this.obliqueResponse.tilemax==_ea.tilemax&&this.obliqueResponse.direction==_ea.direction&&this.mapViewCenter.x==x&&this.mapViewCenter.y==y){
return;
}
var _ee=this;
this.eventCatcher.unbind("mousemove").unbind("mouseup").unbind("mouseout");
this.eventCatcher.bind("mousemove",function(_ef){
_ee.trackMousemove(_ef);
});
this.eventCatcher.css({zIndex:2,cursor:this.grabCursor});
this.obliqueResponse=_ea;
this.fullExtent=new KrakMap.Extent(this.obliqueResponse.actualpixeldimensions[1],0,0,this.obliqueResponse.actualpixeldimensions[0]);
this.zoomLevels=[];
var _f0=this.ObliqueService.zoomLevels.length;
for(var i=0;i<_f0;i++){
this.zoomLevels[i]=1;
}
var _f2=this.obliqueGeoCoordinatesToPixel(new KrakMap.Coordinate(this.obliqueResponse.usercoordinates[0],this.obliqueResponse.usercoordinates[1]));
this.jumpToCoordinate(_ed,_f2.x,this.obliqueResponse.actualpixeldimensions[1]-_f2.y,"oblique",_ea.direction,true);
this.throwEvent("obliqueResponse");
};
KrakMap.TileClient.prototype.trackMousemove=function(_f3){
this.mousePositionX=_f3.pageX-this.eventCatcher.offset().left;
this.mousePositionY=_f3.pageY-this.eventCatcher.offset().top;
};
KrakMap.TileClient.prototype.mapMoveMousedown=function(_f4){
this.throwEvent("beforeMapMove");
if(this.overviewMap){
clearInterval(this.animateMoveTimer);
}
document.onselectstart=function(){
return false;
};
this.eventCatcher.css({zIndex:1000,cursor:this.grabbingCursor});
this.mapMoveStartMouseX=_f4.pageX;
this.mapMoveStartMouseY=_f4.pageY;
this.mapMoveStartGridX=parseInt(this.gridContainerDomStyle.left);
this.mapMoveStartGridY=parseInt(this.gridContainerDomStyle.top);
this.mapMoveStartViewExtent=this.mapViewExtent;
var _f5=this;
this.eventCatcher.bind("mousemove",function(_f6){
_f5.mapMoveMousemove(_f6);
});
this.eventCatcher.bind("mouseup",function(_f7){
_f5.mapMoveMouseup(_f7);
});
this.eventCatcher.bind("mouseout",function(_f8){
_f5.mapMoveMouseup(_f8);
});
};
KrakMap.TileClient.prototype.mapMoveMousemove=function(_f9){
clearTimeout(this.updateTimer);
var _fa=this.gridContainerDomStyle;
if(_f9){
var _fb=this.mapMoveStartGridX-(this.mapMoveStartMouseX-_f9.pageX);
var _fc=this.mapMoveStartGridY-(this.mapMoveStartMouseY-_f9.pageY);
}else{
var _fb=this.animateMoveStepTo.moveX;
var _fc=this.animateMoveStepTo.moveY;
}
var _fd=new KrakMap.Extent(this.mapViewExtent.top,this.mapViewExtent.bottom,this.mapViewExtent.left,this.mapViewExtent.right);
var _fe=this.metersPerPixel;
var _ff=this.mapType;
var _100=false;
var _101=false;
_fd.top=this.mapGridTopLeftCoordinate.y+(_fc*_fe);
_fd.bottom=_fd.top-(this.mapContainerPixelHeight*_fe);
_fd.left=this.mapGridTopLeftCoordinate.x-(_fb*_fe);
_fd.right=_fd.left+(this.mapContainerPixelWidth*_fe);
var _102=this.fullExtent;
if(_ff=="oblique"){
var _103=(_fd.right-_fd.left)/2;
var _104=(_fd.top-_fd.bottom)/2;
_102=new KrakMap.Extent(_102.top+_104,_102.bottom-_104,_102.left-_103,_102.right+_103);
}
if(_fd.top>_102.top){
var diff=_fd.top-_102.top;
_fd.top-=diff;
_fd.bottom-=diff;
_fc-=diff/_fe;
_101=true;
}
if(_fd.bottom<_102.bottom){
var diff=_102.bottom-_fd.bottom;
_fd.top+=diff;
_fd.bottom+=diff;
_fc+=diff/_fe;
_101=true;
}
if(_fd.left<_102.left){
var diff=_102.left-_fd.left;
_fd.left+=diff;
_fd.right+=diff;
_fb-=diff/_fe;
_100=true;
}
if(_fd.right>_102.right){
var diff=_fd.right-_102.right;
_fd.left-=diff;
_fd.right-=diff;
_fb+=diff/_fe;
_100=true;
}
if((this.targetPixelCoordinate.x==parseInt(_fa.left)||_100)&&(this.targetPixelCoordinate.y==parseInt(_fa.top)||_101)){
clearInterval(this.animateMoveTimer);
clearInterval(this.animateScrollTimer);
}
var _106=this.mapViewExtent;
if(_fd.top-_fd.bottom>_102.top-_102.bottom){
_fd.top=_106.top;
_fd.bottom=_106.bottom;
if(this.mapMoveStartGridY!="undefined"){
_fc=this.mapMoveStartGridY;
}
}
if(_fd.right-_fd.left>_102.right-_102.left){
_fd.right=_106.right;
_fd.left=_106.left;
if(this.mapMoveStartGridX!="undefined"){
_fb=this.mapMoveStartGridX;
}
}
_fb=Math.round(_fb);
_fc=Math.round(_fc);
_fa.left=_fb+"px";
_fa.top=_fc+"px";
this.poiLayerContainerDomStyle.left=_fb+"px";
this.poiLayerContainerDomStyle.top=_fc+"px";
this.mapViewCenter.x=(_fd.right+_fd.left)/2;
this.mapViewCenter.y=(_fd.top+_fd.bottom)/2;
this.mapViewExtent=_fd;
this.throwEvent("mapMoving");
this.throwEvent("mapMoved");
if(_f9){
var temp=this;
this.updateTimer=setTimeout(function(){
temp.updateTileGrid(true);
},50);
}else{
this.updateTileGrid(false);
}
};
KrakMap.TileClient.prototype.updateTileGrid=function(_108){
clearTimeout(this.updateTimer);
this.throwEvent("viewExtentUpdated");
var _109=this.tileMeterWidth;
var _10a=this.tileMeterHeight;
var _10b=this.bufferSize*_109;
var _10c=this.bufferSize*_10a;
var _10d=this.mapViewExtent;
var _10e=this.mapGridExtent;
var _10f=this.mapGridPixelExtent;
var _110=this.tilePixelWidth;
var _111=this.tilePixelHeight;
var _112=this.mapGridTilesWidth;
var _113=this.mapGridTilesHeight;
var _114=this.bufferSize;
var _115=this.metersPerPixel;
var _116=this.mapType;
var _117=this.mapGridDom;
var _118=false;
var _119=this.customTiles;
var _11a=this.fullExtent;
if(_116=="oblique"&&(_10d.top>_11a.top||_10d.bottom<_11a.bottom||_10d.left<_11a.left||_10d.right>_11a.right)){
var x=this.mapViewCenter.x;
if(x>_11a.right){
x=_11a.right;
}else{
if(x<_11a.left){
x=_11a.left;
}
}
var y=this.mapViewCenter.y;
if(y>_11a.top){
y=_11a.top;
}else{
if(y<_11a.bottom){
y=_11a.bottom;
}
}
var _11d=this.obliquePixelToGeoCoordinates(new KrakMap.Coordinate(x,this.obliqueResponse.actualpixeldimensions[1]-y));
this.jumpToCoordinate(this.currentZoomLevel,_11d.x.toFixed(2),_11d.y.toFixed(2),"oblique",this.obliqueResponse.direction);
}
while(_10d.top>_10e.top-_10c){
for(var i=0;i<_112;i++){
this.addTile(_10e.left+(_109*i),_10e.top,_10f.left+(_110*i),_10f.top-_111);
}
_10f.top=_10f.top-_111;
_113++;
_10e.top=_10e.top+_10a;
_118=true;
}
while(_10e.top-_10d.top>=_10a*(_114+1)){
for(var i=0;i<_112;i++){
var _11f=(_10e.left+(_115*_110*i)).toFixed(0);
var _120=(_10e.top-_10a).toFixed(0);
if(_116!="oblique"){
jQuery("#"+_11f+"_"+_120).remove();
for(key in _119){
jQuery("#"+_11f+"_"+_120+"_"+key).remove();
}
}else{
jQuery("#obliqueTile"+(((Math.ceil(_120/_111))*this.obliqueResponse.tiledimensions[0])+(Math.ceil(_11f/_110)))).remove();
}
}
_10f.top=_10f.top+_111;
_113--;
_10e.top=_10e.top-_10a;
_118=true;
}
while(_10d.bottom<_10e.bottom+_10b){
for(var i=0;i<_112;i++){
this.addTile(_10e.left+(_115*_110*i),_10e.bottom-_10a,_10f.left+(_110*i),_10f.bottom);
}
_10f.bottom=_10f.bottom+_111;
_113++;
_10e.bottom=_10e.bottom-_10a;
_118=true;
}
while(_10d.bottom-_10e.bottom>=_10a*(_114+1)){
for(var i=0;i<_112;i++){
var _11f=(_10e.left+(_115*_110*i)).toFixed(0);
var _120=(_10e.bottom).toFixed(0);
if(_116!="oblique"){
jQuery("#"+_11f+"_"+_120).remove();
for(key in _119){
jQuery("#"+_11f+"_"+_120+"_"+key).remove();
}
}else{
jQuery("#obliqueTile"+(((Math.ceil(_120/_111))*this.obliqueResponse.tiledimensions[0])+(Math.ceil(_11f/_110))).toFixed(0)).remove();
}
}
_10f.bottom=_10f.bottom-_111;
_113--;
_10e.bottom=_10e.bottom+_10a;
_118=true;
}
while(_10d.left<_10e.left+_10b){
for(var i=0;i<_113;i++){
this.addTile(_10e.left-_109,_10e.top-_10a-(_10a*i),_10f.left-_110,_10f.top+(_111*i));
}
_10f.left=_10f.left-_110;
_112++;
_10e.left=_10e.left-_109;
_118=true;
}
while(_10d.left-_10e.left>=_109*(_114+1)){
for(var i=0;i<_112;i++){
var _11f=(_10e.left).toFixed(0);
var _120=(_10e.bottom+(_115*_110*i)).toFixed(0);
if(_116!="oblique"){
jQuery("#"+_11f+"_"+_120).remove();
for(key in _119){
jQuery("#"+_11f+"_"+_120+"_"+key).remove();
}
}else{
jQuery("#obliqueTile"+(((Math.ceil(_120/_111))*this.obliqueResponse.tiledimensions[0])+(Math.ceil(_11f/_110))).toFixed(0)).remove();
}
}
_10f.left=_10f.left+_110;
_112--;
_10e.left=_10e.left+_109;
_118=true;
}
while(_10d.right>_10e.right-_10b){
for(var i=0;i<_113;i++){
this.addTile(_10e.right,_10e.bottom+(_10a*i),_10f.right,_10f.bottom-(_111*(i+1)));
}
_10f.right=_10f.right+_110;
_112++;
_10e.right=_10e.right+_109;
_118=true;
}
while(_10e.right-_10d.right>=_109*(_114+1)){
for(var i=0;i<_112;i++){
var _11f=(_10e.right-_109).toFixed(0);
var _120=(_10e.bottom+(_115*_110*i)).toFixed(0);
if(_116!="oblique"){
jQuery("#"+_11f+"_"+_120).remove();
for(key in _119){
jQuery("#"+_11f+"_"+_120+"_"+key).remove();
}
}else{
jQuery("#obliqueTile"+(((Math.ceil(_120/_111))*this.obliqueResponse.tiledimensions[0])+(Math.ceil(_11f/_110))).toFixed(0)).remove();
}
}
_10f.right=_10f.right-_110;
_112--;
_10e.right=_10e.right-_109;
_118=true;
}
if(_118){
this.throwEvent("mapGridExtentUpdated");
}
this.mapGridExtent=_10e;
this.mapGridPixelExtent=_10f;
this.mapGridTilesWidth=_112;
this.mapGridTilesHeight=_113;
this.mapGridCenter.x=(_10e.right+_10e.left)/2;
this.mapGridCenter.y=(_10e.top+_10e.bottom)/2;
};
KrakMap.TileClient.prototype.mapMoveMouseup=function(_121){
clearTimeout(this.updateTimer);
this.updateTileGrid();
this.eventCatcher.unbind("mousemove").unbind("mouseup").unbind("mouseout");
var temp=this;
this.eventCatcher.bind("mousemove",function(_123){
temp.trackMousemove(_123);
});
this.eventCatcher.css({zIndex:2,cursor:this.grabCursor});
document.onselectstart=function(){
return true;
};
if(this.overviewMap){
this.overviewMap.moveMap(this.mapViewCenter);
}else{
if(this.mainMap&&(this.mapMoveStartViewExtent.left!=this.mapViewExtent.left||this.mapMoveStartViewExtent.top!=this.mapViewExtent.top)){
this.mainMap.moveMap(this.mapViewCenter);
}
}
this.throwEvent("afterMapMoved");
};
KrakMap.TileClient.prototype.zoomWithMouseWheel=function(_124,_125){
clearTimeout(this.zoomTimer);
if(_125<0&&this.currentZoomLevel<(this.zoomLevels.length-1)){
this.deltaZoom++;
}
if(_125>0&&this.currentZoomLevel>0){
this.deltaZoom--;
}
var temp=this;
this.zoomTimer=setTimeout(function(_127){
temp.zoomWithMouseWheelAction(_127);
},150);
};
KrakMap.TileClient.prototype.zoomWithMouseWheelAction=function(_128){
this.throwEvent("beforeZoomWithMouseWheel");
var _129=this.zoomLevelCheck(this.currentZoomLevel+this.deltaZoom);
if(_129!=this.currentZoomLevel){
if(this.mapType!="oblique"){
var _12a=this.mousePositionX;
var _12b=this.mousePositionY;
var _12c=this.pixelToGeoCoordinate(_12a,_12b);
var _12d=_12a-(this.mapContainerPixelWidth/2);
var _12e=_12b-(this.mapContainerPixelHeight/2);
var _12f=new KrakMap.Coordinate(_12c.x-(_12d*this.zoomLevels[_129]),_12c.y+(_12e*this.zoomLevels[_129]));
this.jumpToCoordinate(_129,_12f.x,_12f.y,this.mapType);
}else{
this.jumpToCoordinate(_129,this.mapViewCenter.x,this.mapViewCenter.y,this.mapType);
}
}
this.deltaZoom=0;
clearTimeout(this.zoomTimer);
this.throwEvent("afterZoomWithMouseWheel");
};
KrakMap.TileClient.prototype.zoomByDoubleClick=function(_130){
if(this.currentZoomLevel>this.minZoomLevel||(this.mapType=="oblique"&&this.currentZoomLevel>0)){
var _131=this.pixelToGeoCoordinate(this.mousePositionX,this.mousePositionY);
this.jumpToCoordinate(this.zoomLevelCheck(this.currentZoomLevel-1),_131.x,_131.y,this.mapType);
}
};
KrakMap.TileClient.prototype.measureExtentMousedown=function(_132){
this.throwEvent("beforeRectangleDraw");
document.onselectstart=function(){
return false;
};
this.eventCatcher.css("z-index",1000);
var _133=_132.pageX-this.eventCatcher.offset().left;
var _134=_132.pageY-this.eventCatcher.offset().top;
this.measureExtentStartMouseX=_133;
this.measureExtentStartMouseY=_134;
this.measureExtentZoomBox=jQuery("<div></div>").css({position:"absolute",zIndex:7,left:_133,top:_134,width:0,height:0,border:"solid",borderWidth:"1px",borderColor:"red",backgroundColor:"#FFF",opacity:0.6}).appendTo(this.mapContainer);
var temp=this;
this.eventCatcher.bind("mousemove",function(_136){
temp.measureExtentMousemove(_136);
});
this.eventCatcher.bind("mouseup",function(_137){
temp.measureExtentMouseup(_137);
});
this.eventCatcher.bind("mouseout",function(_138){
temp.measureExtentMouseup(_138);
});
};
KrakMap.TileClient.prototype.measureExtentMousemove=function(_139){
var _13a=_139.pageX-this.eventCatcher.offset().left;
var _13b=_139.pageY-this.eventCatcher.offset().top;
if(_13a>this.measureExtentStartMouseX){
this.measureExtentZoomBox.css("width",_13a-this.measureExtentStartMouseX);
}else{
this.measureExtentZoomBox.css("left",this.measureExtentStartMouseX-(this.measureExtentStartMouseX-_13a)).css("width",this.measureExtentStartMouseX-_13a);
}
if(_13b>this.measureExtentStartMouseY){
this.measureExtentZoomBox.css("height",_13b-this.measureExtentStartMouseY);
}else{
this.measureExtentZoomBox.css("top",this.measureExtentStartMouseY-(this.measureExtentStartMouseY-_13b)).css("height",this.measureExtentStartMouseY-_13b);
}
};
KrakMap.TileClient.prototype.measureExtentMouseup=function(_13c){
if(Math.abs(this.measureExtentStartMouseX-_13c.pageX)>3||Math.abs(this.measureExtentStartMouseY-_13c.pageY)>3){
var _13d=this.pixelToGeoCoordinate(this.measureExtentStartMouseX,this.measureExtentStartMouseY);
var _13e=this.pixelToGeoCoordinate(_13c.pageX-this.eventCatcher.offset().left,_13c.pageY-this.eventCatcher.offset().top);
var _13f=new KrakMap.Extent(0,0,0,0);
if(_13d.x<_13e.x){
_13f.left=_13d.x;
_13f.right=_13e.x;
}else{
_13f.left=_13e.x;
_13f.right=_13d.x;
}
if(_13d.y<_13e.y){
_13f.bottom=_13d.y;
_13f.top=_13e.y;
}else{
_13f.bottom=_13e.y;
_13f.top=_13d.y;
}
this.measuredExtent=_13f;
this.throwEvent("measuredExtent");
}
this.measureExtentZoomBox.remove();
this.eventCatcher.unbind("mousemove").unbind("mouseup").unbind("mouseout");
var temp=this;
this.eventCatcher.bind("mousemove",function(_141){
temp.trackMousemove(_141);
});
this.eventCatcher.css("z-index",2);
document.onselectstart=function(){
return true;
};
this.throwEvent("afterRectangleDraw");
};
KrakMap.TileClient.prototype.viewIndicatorMouseDown=function(_142){
var _143=this.overviewMap;
_143.viewIndicatorMoveStartLeft=parseInt(_143.viewIndicator.css("left"));
_143.viewIndicatorMoveStartTop=parseInt(_143.viewIndicator.css("top"));
_143.viewIndicatorMoveStartMouseX=_142.pageX;
_143.viewIndicatorMoveStartMouseY=_142.pageY;
_143.viewIndicatorMoving=true;
_143.viewIndicatorEventCatcher.css("zIndex",1000);
var temp=this;
_143.viewIndicatorEventCatcher.bind("mousemove",function(_145){
temp.overviewMap.viewIndicatorMousemove(_145);
}).bind("mouseup",function(_146){
temp.overviewMap.viewIndicatorMouseup();
}).bind("mouseout",function(_147){
temp.overviewMap.viewIndicatorMouseup();
});
};
KrakMap.TileClient.prototype.viewIndicatorMousemove=function(_148){
var _149=this.viewIndicator;
var _14a=this.viewIndicatorMoveStartLeft-(this.viewIndicatorMoveStartMouseX-_148.pageX);
var _14b=this.viewIndicatorMoveStartTop-(this.viewIndicatorMoveStartMouseY-_148.pageY);
_149.css({left:_14a,top:_14b});
this.scrollDirection={horizontal:"",vertical:""};
clearInterval(this.animateScrollTimer);
if(this.mapContainerPixelWidth>parseInt(_149.css("width"))){
if(parseInt(_149.css("left"))<0){
this.scrollDirection.horizontal="left";
}else{
if(parseInt(_149.css("left"))>(this.mapContainerPixelWidth-parseInt(_149.css("width")))){
this.scrollDirection.horizontal="right";
}else{
this.scrollDirection.horizontal="";
}
}
}
if(this.mapContainerPixelHeight>parseInt(_149.css("height"))){
if(parseInt(_149.css("top"))<0){
this.scrollDirection.vertical="up";
}else{
if(parseInt(_149.css("top"))>(this.mapContainerPixelHeight-parseInt(_149.css("height")))){
this.scrollDirection.vertical="down";
}else{
this.scrollDirection.vertical="";
}
}
}
if(this.scrollDirection.horizontal||this.scrollDirection.vertical){
this.scrollMap();
}
};
KrakMap.TileClient.prototype.viewIndicatorMouseup=function(){
this.scrollDirection={horizontal:"",vertical:""};
clearInterval(this.animateScrollTimer);
this.viewIndicatorMoving=false;
var _14c=this.viewIndicator;
var _14d=this.mapViewExtent.left+((parseInt(_14c.css("left"))+(parseInt(_14c.css("width"))/2))*this.metersPerPixel);
var _14e=this.mapViewExtent.top-((parseInt(_14c.css("top"))+(parseInt(_14c.css("height"))/2))*this.metersPerPixel);
var _14f=this.mainMap;
var _150=_14f.mapViewExtent.top-_14f.mapViewExtent.bottom;
var _151=_14f.mapViewExtent.right-_14f.mapViewExtent.left;
var _152=Math.sqrt((_150*_150)+(_151*_151))/2;
if(_14f.mapType=="oblique"||Math.abs(_14d-_14f.mapViewCenter.x)>_152||Math.abs(_14e-_14f.mapViewCenter.y)>_152){
_14f.jumpToCoordinate(_14f.currentZoomLevel,_14d,_14e,_14f.mapType);
}else{
_14f.moveMap(new KrakMap.Coordinate(_14d,_14e));
this.jumpToCoordinate(_14f.currentZoomLevel+_14f.overviewMapSettings.elevation,_14d,_14e,"kvec");
}
var _153=this.mainMap.getMapViewExtent();
if(_14f.mapType!="oblique"){
this.viewIndicator.css({left:Math.round((_153.left-this.mapViewExtent.left)/this.metersPerPixel),top:Math.round((this.mapViewExtent.top-_153.top)/this.metersPerPixel)});
}
this.viewIndicatorEventCatcher.css("zIndex",-1);
this.viewIndicatorEventCatcher.unbind("mousemove").unbind("mouseup").unbind("mouseout");
};
KrakMap.TileClient.prototype.navigateKeyDown=function(_154){
var temp=this;
jQuery(document).bind("keyup",function(_156){
temp.navigateKeyUp(_156);
});
switch(_154.which){
case 37:
this.scrollDirection.horizontal="left";
this.scrollMap();
break;
case 39:
this.scrollDirection.horizontal="right";
this.scrollMap();
break;
case 38:
this.scrollDirection.vertical="up";
this.scrollMap();
break;
case 40:
this.scrollDirection.vertical="down";
this.scrollMap();
break;
case 33:
if(this.currentZoomLevel>this.minZoomLevel){
this.zoomToLevel(this.zoomLevelCheck(this.currentZoomLevel-1));
}
break;
case 34:
if(this.currentZoomLevel<this.maxZoomLevel){
this.zoomToLevel(this.currentZoomLevel+1);
}
break;
default:
break;
}
};
KrakMap.TileClient.prototype.navigateKeyUp=function(_157){
switch(_157.which){
case 37:
this.scrollDirection.horizontal="";
break;
case 39:
this.scrollDirection.horizontal="";
break;
case 38:
this.scrollDirection.vertical="";
break;
case 40:
this.scrollDirection.vertical="";
break;
default:
break;
}
if(!this.scrollDirection.horizontal&&!this.scrollDirection.vertical){
clearInterval(this.animateScrollTimer);
jQuery(document).unbind("keyup");
if(this.overviewMap){
this.overviewMap.moveMap(this.mapViewCenter);
}else{
if(this.mainMap){
var _158=this.mainMap;
var _159=this.mapViewCenter.x;
var _15a=this.mapViewCenter.y;
var _15b=_158.mapViewExtent.top-_158.mapViewExtent.bottom;
var _15c=_158.mapViewExtent.right-_158.mapViewExtent.left;
var _15d=Math.sqrt((_15b*_15b)+(_15c*_15c))/2;
if(Math.abs(_159-_158.mapViewCenter.x)>_15d||Math.abs(_15a-_158.mapViewCenter.y)>_15d){
_158.jumpToCoordinate(_158.currentZoomLevel,_159,_15a,_158.mapType);
}else{
_158.moveMap(new KrakMap.Coordinate(_159,_15a));
this.jumpToCoordinate(_158.currentZoomLevel+this.overviewMapSettings.elevation,_159,_15a,_158.mapType);
}
this.viewIndicator.css({left:Math.round((this.mainMap.mapViewExtent.left-this.mapViewExtent.left)/this.metersPerPixel),top:Math.round((this.mapViewExtent.top-this.mainMap.mapViewExtent.top)/this.metersPerPixel)});
}
}
}
};
KrakMap.TileClient.prototype.throwEvent=function(type){
var _15f=null;
switch(type){
case "buildingGrid":
_15f=this.eventReceivers.buildingGrid;
break;
case "mapMoved":
_15f=this.eventReceivers.mapMoved;
break;
case "viewExtentUpdated":
_15f=this.eventReceivers.viewExtentUpdated;
break;
case "mapGridExtentUpdated":
_15f=this.eventReceivers.mapGridExtentUpdated;
break;
case "zoomed":
_15f=this.eventReceivers.zoomed;
break;
case "jumped":
_15f=this.eventReceivers.jumped;
break;
case "clicked":
_15f=this.eventReceivers.clicked;
break;
case "measuredExtent":
_15f=this.eventReceivers.measuredExtent;
break;
case "mapTypeChanged":
_15f=this.eventReceivers.mapTypeChanged;
break;
case "routeSearch":
_15f=this.eventReceivers.routeSearch;
break;
case "obliqueResponse":
_15f=this.eventReceivers.obliqueResponse;
break;
case "circleDraw":
_15f=this.eventReceivers.circleDraw;
break;
case "polygonDraw":
_15f=this.eventReceivers.polygonDraw;
break;
default:
break;
}
if(_15f){
var func=null;
for(var i=0;i<_15f.length;i++){
func=_15f[i][1];
func(_15f[i][0]);
}
}
_15f=this.eventSubscriptions[type];
if(_15f){
for(var i=0;i<_15f.length;i++){
_15f[i]();
}
}
};
KrakMap.TileClient.prototype.subscribeEvent=function(_162,_163){
var _164=this.eventSubscriptions;
if(!_164[_162]){
_164[_162]=[];
}
_164[_162].push(_163);
};
KrakMap.TileClient.prototype.unsubscribeEvent=function(_165,_166){
var _167=this.eventSubscriptions;
if(!_167[_165]){
return;
}
for(var i=0;i<_167[_165].length;i++){
if(_167[_165][i]==_166){
_167[_165].splice(i,1);
return;
}
}
};
KrakMap.TileClient.prototype.getBuildingGridEvent=function(_169,_16a){
if(!this.eventReceivers.buildingGrid){
this.eventReceivers.buildingGrid=new Array(new Array(_169,_16a));
}else{
this.eventReceivers.buildingGrid.push(new Array(_169,_16a));
}
};
KrakMap.TileClient.prototype.getMapMovedEvent=function(_16b,_16c){
if(!this.eventReceivers.mapMoved){
this.eventReceivers.mapMoved=new Array(new Array(_16b,_16c));
}else{
this.eventReceivers.mapMoved.push(new Array(_16b,_16c));
}
};
KrakMap.TileClient.prototype.getViewExtentUpdatedEvent=function(_16d,_16e){
if(!this.eventReceivers.viewExtentUpdated){
this.eventReceivers.viewExtentUpdated=new Array(new Array(_16d,_16e));
}else{
this.eventReceivers.viewExtentUpdated.push(new Array(_16d,_16e));
}
};
KrakMap.TileClient.prototype.getMapGridExtentUpdatedEvent=function(_16f,_170){
if(!this.eventReceivers.mapGridExtentUpdated){
this.eventReceivers.mapGridExtentUpdated=new Array(new Array(_16f,_170));
}else{
this.eventReceivers.mapGridExtentUpdated.push(new Array(_16f,_170));
}
};
KrakMap.TileClient.prototype.getZoomedEvent=function(_171,_172){
if(!this.eventReceivers.zoomed){
this.eventReceivers.zoomed=new Array(new Array(_171,_172));
}else{
this.eventReceivers.zoomed.push(new Array(_171,_172));
}
};
KrakMap.TileClient.prototype.getJumpedEvent=function(_173,_174){
if(!this.eventReceivers.jumped){
this.eventReceivers.jumped=new Array(new Array(_173,_174));
}else{
this.eventReceivers.jumped.push(new Array(_173,_174));
}
};
KrakMap.TileClient.prototype.getClickedEvent=function(_175,_176){
if(!this.eventReceivers.clicked){
this.eventReceivers.clicked=new Array(new Array(_175,_176));
}else{
this.eventReceivers.clicked.push(new Array(_175,_176));
}
};
KrakMap.TileClient.prototype.getMeasuredExtentEvent=function(_177,_178){
if(!this.eventReceivers.measuredExtent){
this.eventReceivers.measuredExtent=new Array(new Array(_177,_178));
}else{
this.eventReceivers.measuredExtent.push(new Array(_177,_178));
}
};
KrakMap.TileClient.prototype.getMapTypeChangedEvent=function(_179,_17a){
if(!this.eventReceivers.mapTypeChanged){
this.eventReceivers.mapTypeChanged=new Array(new Array(_179,_17a));
}else{
this.eventReceivers.mapTypeChanged.push(new Array(_179,_17a));
}
};
KrakMap.TileClient.prototype.getRouteSearchEvent=function(_17b,_17c){
if(!this.eventReceivers.routeSearch){
this.eventReceivers.routeSearch=new Array(new Array(_17b,_17c));
}else{
this.eventReceivers.routeSearch.push(new Array(_17b,_17c));
}
};
KrakMap.TileClient.prototype.getObliqueResponseEvent=function(_17d,_17e){
if(!this.eventReceivers.obliqueResponse){
this.eventReceivers.obliqueResponse=new Array(new Array(_17d,_17e));
}else{
this.eventReceivers.obliqueResponse.push(new Array(_17d,_17e));
}
};
KrakMap.TileClient.prototype.getCircleDrawEvent=function(_17f,_180){
if(!this.eventReceivers.circleDraw){
this.eventReceivers.circleDraw=[[_17f,_180]];
}else{
this.eventReceivers.circleDraw.push([_17f,_180]);
}
};
KrakMap.TileClient.prototype.getPolygonDrawEvent=function(_181,_182){
if(!this.eventReceivers.polygonDraw){
this.eventReceivers.polygonDraw=[[_181,_182]];
}else{
this.eventReceivers.polygonDraw.push([_181,_182]);
}
};
KrakMap.TileClient.prototype.jumpToCoordinate=function(_183,x,y,_186,_187,_188){
x=Number(x);
y=Number(y);
if(!_186){
_186="kvec";
}
if(_186=="oblique"&&!_188){
if(this.mapType!="oblique"&&!this.isPrint){
_183=2;
}
var obj=this;
this.ObliqueService.getBestPhoto(_183,x,y,_187,function(json,x,y,_18d){
obj.obliqueResponseCompleted(json,x.toFixed(2),y.toFixed(2),_18d);
});
return;
}
var _18e=false;
var _18f=false;
var _190=false;
if(!this.firstJump){
if(this.currentZoomLevel!=_183){
this.throwEvent("beforeZoom");
_18e=true;
}
if(this.mapType!=_186){
this.throwEvent("beforeMapTypeChange");
_18f=true;
}
if(_187&&this.obliqueResponse&&this.obliqueResponse.direction!=_187){
this.throwEvent("beforeDirectionChange");
_190=true;
}
}
this.throwEvent("beforeJump");
if(this.toolbar.center&&this.firstJump){
this.setToolbarCenterButtonCoordinate(new KrakMap.Coordinate(x,y),_183,_186);
this.firstJump=false;
}
this.togglePerspectiveView(_186,_187);
if(this.mainMap&&this.mainMap.mapType=="oblique"){
_183=1;
}
var _191=false;
if(this.mapType!=_186&&_186!=""){
if(this.mapType=="oblique"){
this.zoomLevels=this.nonObliqueZoomLevels;
this.fullExtent=this.nonObliqueFullExtent;
if(x<99999&&y<99999){
var _192=this.obliquePixelToGeoCoordinates(new KrakMap.Coordinate(x,this.obliqueResponse.actualpixeldimensions[1]-y));
x=_192.x;
y=_192.y;
}
this.obliqueResponse={};
if(this.routeWkt){
this.enableRoute(this.routeWkt,false);
}
this.mapContainer.css("backgroundColor","#FFF");
}else{
if(_186=="oblique"){
if(this.route){
this.disableRoute();
}
this.mapContainer.css("backgroundColor","#000");
}
}
this.mapType=_186;
_191=true;
}
var _193=false;
_183=this.zoomLevelCheck(Number(_183));
if(this.currentZoomLevel!=_183){
if(!this.firstJump){
_193=true;
}
this.currentZoomLevel=_183;
}
this.metersPerPixel=this.zoomLevels[this.currentZoomLevel];
this.tileExtent=this.alignTiles();
this.tilePixelWidth=256;
this.tilePixelHeight=256;
var _194=this.tilePixelWidth;
var _195=this.tilePixelHeight;
var _196=this.metersPerPixel;
this.tileMeterWidth=_194*_196;
this.tileMeterHeight=_195*_196;
if(this.mapViewCenter.x!=0&&this.mapViewCenter.y!=0&&this.mapViewCenter.x!=Number(x)&&this.mapViewCenter.y!=Number(y)){
this.throwEvent("jumped");
}
this.mapViewCenter.x=Number(x);
this.mapViewCenter.y=Number(y);
this.calculateMapViewAndGridExtent();
if(this.mapType!="oblique"){
this.validateExtent();
}
var _197=this.mapGridExtent;
var _198=this.mapGridPixelExtent;
var _199=this.mapViewExtent;
this.mapGridTilesWidth=Math.ceil((_197.right-_197.left)/this.tileMeterWidth);
this.mapGridTilesHeight=Math.ceil((_197.top-_197.bottom)/this.tileMeterHeight);
_198.top=0;
_198.bottom=this.mapGridTilesHeight*_195;
_198.left=0;
_198.right=this.mapGridTilesWidth*_194;
this.mapGridPixelExtent=_198;
this.mapGridCenter.x=(_197.right+_197.left)/2;
this.mapGridCenter.y=(_197.top+_197.bottom)/2;
this.gridContainer.css("left",Math.round(((_197.left-_199.left)/_196))+"px");
this.gridContainer.css("top",Math.round(((_199.top-_197.top)/_196))+"px");
this.poiLayerContainer.css("left",Math.round(((_197.left-_199.left)/_196))+"px");
this.poiLayerContainer.css("top",Math.round(((_199.top-_197.top)/_196))+"px");
if(_191){
this.throwEvent("mapTypeChanged");
}
if(_193){
this.throwEvent("zoomed");
}
this.buildGrid();
if(_18e){
this.throwEvent("afterZoom");
}
if(_18f){
this.throwEvent("afterMapTypeChange");
}
if(_190){
this.throwEvent("afterDirectionChange");
}
this.throwEvent("afterJump");
};
KrakMap.TileClient.prototype.zoomToLevel=function(_19a){
_19a=this.zoomLevelCheck(Number(_19a));
if(_19a!=this.currentZoomLevel){
this.jumpToCoordinate(_19a,this.mapViewCenter.x,this.mapViewCenter.y,this.mapType);
}
};
KrakMap.TileClient.prototype.changeMapType=function(_19b,_19c){
if(this.currentZoomLevel<0){
this.mapType=_19b;
}else{
if(_19b!=this.mapType||(this.mapType=="oblique"&&this.obliqueResponse.direction!=_19c)){
if(this.mapType=="oblique"&&_19b!="oblique"){
this.jumpToCoordinate(this.vectorMinZoomLevel,this.mapViewCenter.x,this.mapViewCenter.y,_19b);
}else{
this.jumpToCoordinate(this.currentZoomLevel,this.mapViewCenter.x,this.mapViewCenter.y,_19b,_19c);
}
}
}
};
KrakMap.TileClient.prototype.jumpToExtent=function(_19d,_19e){
var _19f=0;
if(!_19e){
_19e=this.mapType;
}
if(((_19d.right-_19d.left)/this.mapContainerPixelWidth)>((_19d.top-_19d.bottom)/this.mapContainerPixelHeight)){
var _1a0=(_19d.right-_19d.left)/this.mapContainerPixelWidth;
}else{
var _1a0=(_19d.top-_19d.bottom)/this.mapContainerPixelHeight;
}
if(_1a0>=this.zoomLevels[_19f]&&_1a0<=this.zoomLevels[this.zoomLevels.length-1]){
while(_1a0>=this.zoomLevels[_19f]){
_19f++;
}
}else{
if(_1a0>=this.zoomLevels[this.zoomLevels.length-1]){
_19f=this.zoomLevels.length-1;
}
}
this.jumpToCoordinate(_19f,(_19d.right+_19d.left)/2,(_19d.top+_19d.bottom)/2,_19e);
};
KrakMap.TileClient.prototype.jumpToExtentWithBuffer=function(_1a1,_1a2,_1a3){
var _1a4=0;
if(((_1a1.right-_1a1.left)/this.mapContainerPixelWidth)>((_1a1.top-_1a1.bottom)/this.mapContainerPixelHeight)){
var _1a5=(_1a1.right-_1a1.left)/this.mapContainerPixelWidth;
}else{
var _1a5=(_1a1.top-_1a1.bottom)/this.mapContainerPixelHeight;
}
if(_1a5>=this.zoomLevels[_1a4]&&_1a5<=this.zoomLevels[this.zoomLevels.length-1]){
while(_1a5>=this.zoomLevels[_1a4]){
_1a4++;
}
}else{
if(_1a5>=this.zoomLevels[this.zoomLevels.length-1]){
_1a4=this.zoomLevels.length-1;
}
}
var _1a6=this.zoomLevels[_1a4]*Number(_1a2);
_1a1.top+=_1a6;
_1a1.bottom-=_1a6;
_1a1.left-=_1a6;
_1a1.right+=_1a6;
this.jumpToExtent(_1a1,_1a3);
};
KrakMap.TileClient.prototype.jumpToFullExtent=function(){
this.jumpToExtent(this.fullExtent);
};
KrakMap.TileClient.prototype.resizeMap=function(){
var _1a7=this.placeHolder.width()-2;
var _1a8=this.placeHolder.height()-2;
this.mapContainerPixelWidth=_1a7;
this.mapContainerPixelHeight=_1a8;
this.Container.css({width:_1a7,height:_1a8});
if(this.toolbarContainer){
this.toolbarContainer.css({width:_1a7});
_1a8-=20;
}
this.mapContainer.css({width:_1a7,height:_1a8});
this.eventCatcher.css({width:_1a7,height:_1a8});
this.jumpToCoordinate(this.currentZoomLevel,this.mapViewCenter.x,this.mapViewCenter.y,this.mapType);
};
KrakMap.TileClient.prototype.redrawGrid=function(){
this.jumpToCoordinate(this.currentZoomLevel,this.mapViewCenter.x,this.mapViewCenter.y,this.mapType);
};
KrakMap.TileClient.prototype.pixelToGeoCoordinate=function(_1a9,_1aa){
var ext=this.mapViewExtent;
var z=this.zoomLevels[this.currentZoomLevel];
return new KrakMap.Coordinate(ext.left+(Number(_1a9)*z),ext.top-(Number(_1aa)*z));
};
KrakMap.TileClient.prototype.geoToPixelCoordinate=function(geoX,geoY){
if(this.mapType!="oblique"){
var _1af=new KrakMap.Coordinate(this.mapGridPixelExtent.left+Math.round(((Number(geoX)-this.mapGridExtent.left)/this.zoomLevels[this.currentZoomLevel])),this.mapGridPixelExtent.top+Math.round(((this.mapGridExtent.top-Number(geoY))/this.zoomLevels[this.currentZoomLevel])));
return _1af;
}else{
var _1b0=this.obliqueGeoCoordinatesToPixel(new KrakMap.Coordinate(geoX,geoY));
_1b0.x=_1b0.x-this.mapGridExtent.left;
_1b0.y=this.mapGridExtent.top-(this.obliqueResponse.actualpixeldimensions[1]-_1b0.y);
return _1b0;
}
};
KrakMap.TileClient.prototype.utmToDegrees=function(_1b1){
var _1b2=new Array(2);
var _1b3=new coordConvert();
_1b3.UTMXYToLatLon(Number(_1b1.x),Number(_1b1.y),32,false,_1b2);
return new KrakMap.Coordinate(_1b3.RadToDeg(_1b2[0]),_1b3.RadToDeg(_1b2[1]));
};
KrakMap.TileClient.prototype.decimalDegreesToDegreesMinSec=function(_1b4){
var _1b5=Math.round(Number(_1b4.x)*1000000);
var _1b6=Math.round(Number(_1b4.y)*1000000);
var _1b7=new Array(3);
_1b7[0]=Math.floor(_1b5/1000000);
_1b7[1]=Math.floor(((_1b5/1000000)-_1b7[0])*60);
_1b7[2]=(Math.floor(((((_1b5/1000000)-_1b7[0])*60)-_1b7[1])*100000)*60/100000).toFixed(2);
var _1b8=new Array(3);
_1b8[0]=Math.floor(_1b6/1000000);
_1b8[1]=Math.floor(((_1b6/1000000)-_1b8[0])*60);
_1b8[2]=(Math.floor(((((_1b6/1000000)-_1b8[0])*60)-_1b8[1])*100000)*60/100000).toFixed(2);
return {longitude:_1b8,latitude:_1b7};
};
KrakMap.TileClient.prototype.enableMeasureBox=function(){
this.measureBox=true;
var temp=this;
this.eventCatcher.css("cursor",this.crosshairCursor).unbind("mousedown").bind("mousedown",function(_1ba){
temp.measureExtentMousedown(_1ba);
});
if(this.toolbar.measureBox){
this.toolbar.measureBox.css({color:"#71AAD5",fontWeight:"bold",backgroundPosition:"0px -20px"});
}
};
KrakMap.TileClient.prototype.disableMeasureBox=function(){
this.measureBox=false;
var temp=this;
this.eventCatcher.css("cursor",this.grabCursor).unbind("mousedown").bind("mousedown",function(_1bc){
temp.mapMoveMousedown(_1bc);
});
if(this.toolbar.measureBox){
this.toolbar.measureBox.css({color:"#858585",fontWeight:"normal",backgroundPosition:"0px 0px"});
}
};
KrakMap.TileClient.prototype.toggleMeasureBox=function(){
if(this.measureBox){
this.disableMeasureBox();
}else{
this.enableMeasureBox();
}
};
KrakMap.TileClient.prototype.togglePerspectiveView=function(_1bd,_1be){
if(this.perspective&&_1bd=="oblique"){
var left="0px";
var _1c0="0px";
if(this.overviewMapContainer){
left="107px";
_1c0="110px";
}
if(!this.obliqueDirectionPanel){
var self=this;
var _1c2="perspective"+new Date().getTime();
this.obliqueDirectionPanel=jQuery("<div style=\"display:block;position:absolute; z-index:5; bottom:"+_1c0+"; left:"+left+"; width:65px; height:60px; background:url("+this.imgDir+"gfx_bgimage_perspective_up.png) no-repeat; _background:none;\"><img src=\""+this.imgDir+"gfx_perspective_"+_1be+".gif\" alt=\"gfx_perspective_n\" width=\"60\" height=\"60\" border=\"0\" usemap=\"#"+_1c2+"\" /><map name=\""+_1c2+"\"><area shape=\"rect\" coords=\"19,-1,41,20\" href=\"#\" title=\"Nord\" id=\"n\" /><area shape=\"rect\" coords=\"40,19,59,41\" href=\"#\" title=\"\xd8st\" id=\"e\" /><area shape=\"rect\" coords=\"19,40,41,60\" href=\"#\" title=\"Syd\" id=\"s\" /><area shape=\"rect\" coords=\"-3,19,19,41\" href=\"#\" title=\"Vest\" id=\"w\" /></map></div>").appendTo(this.mapContainer).find("area").click(function(){
self.obliqueDirectionPanel.find("img").attr("src",self.imgDir+"gfx_perspective_"+jQuery(this).attr("id")+".gif");
self.changeMapType("oblique",jQuery(this).attr("id"));
return false;
}).end();
}else{
this.obliqueDirectionPanel.css({left:left,bottom:_1c0}).find("img").attr("src",this.imgDir+"gfx_perspective_"+_1be+".gif").end().show();
}
}else{
if(this.obliqueDirectionPanel){
this.obliqueDirectionPanel.hide();
}
}
};
KrakMap.TileClient.prototype.enableOverviewMap=function(){
settings=this.overviewMapSettings;
if(!this.overviewMapSettings.elevation){
this.overviewMapSettings.elevation=2;
}
if(!this.overviewMapSettings.zoomLevels){
this.overviewMapSettings.zoomLevels=new Array(1,2,4,8,16,32,64,128,256,512,1024,2048,3328);
}
if(!this.overviewMapSettings.minZoomLevel){
this.overviewMapSettings.minZoomLevel=0;
}
if(!this.overviewMapSettings.maxZoomLevel){
this.overviewMapSettings.maxZoomLevel=this.overviewMapSettings.zoomLevels.length-1;
}
if(!this.overviewMap&&!this.mainMap){
if(this.toolbar.overviewMap){
this.toolbar.overviewMap.css({backgroundPosition:"2px -18px"});
}
this.overviewMapContainer=jQuery("<div style=\"position: absolute;width: 171px; height: 140px;z-index:4;left:0px;bottom:0px;background:transparent url("+this.imgDir+"gfx_bgtile_mapmini.png) right repeat-y;\"><div style=\"width: 166px; height: 140px; background:white;\"></div></div>");
var _1c3=jQuery("<div style=\"overflow:hidden;position:absolute;left:10px;top:10px;width:150px;height:118px;\"></div>").appendTo(jQuery("<div style=\"display: block;overflow:hidden;width: 166px; height: 140px;border-right:1px solid #D8D8D8;border-top:1px solid #D8D8D8;\"></div>").appendTo(this.overviewMapContainer.children()));
var temp=this;
if(this.mapType=="oblique"&&this.obliqueDirectionPanel){
this.obliqueDirectionPanel.css({left:"107px",bottom:"110px"});
}
if(jQuery.browser.msie&&jQuery.browser.version=="6.0"){
this.overviewMapContainer.css("background","transparent");
}
this.mapContainer.append(this.overviewMapContainer);
var _1c5;
if(jQuery.browser.msie){
_1c5={backgroundImage:"url("+this.imgDir+"transparent.gif)"};
}else{
_1c5={backgroundColor:"transparent"};
}
var _1c6=new KrakMap.TileClient({mapContainer:_1c3.get(0),mainMap:temp,zoomLevels:temp.overviewMapSettings.zoomLevels,maxZoomLevel:temp.overviewMapSettings.maxZoomLevel,minZoomLevel:temp.overviewMapSettings.minZoomLevel,bufferSize:0,domainDistroServers:temp.domainDistroServers});
_1c6=_1c6.tc;
_1c6.viewIndicator=jQuery("<div></div>").css(jQuery.extend({position:"absolute",zIndex:3,cursor:"move",border:"solid",borderColor:"#000",borderWidth:1},_1c5)).appendTo(_1c3).attr("unselectable","on");
_1c6.viewIndicatorEventCatcher=jQuery("<div></div>").css(jQuery.extend({cursor:"move",position:"absolute",top:"0px",left:"0px",width:temp.mapContainer.width(),height:temp.mapContainer.height(),zIndex:"-1"},_1c5)).appendTo(temp.mapContainer);
_1c6.getBuildingGridEvent(_1c6,function(obj){
clearInterval(obj.animateMoveMapTimer);
clearInterval(obj.animateScrollTimer);
var _1c8=obj.mainMap.getMapViewExtent();
obj.viewIndicator.css({left:Math.round((_1c8.left-obj.mapViewExtent.left)/obj.metersPerPixel),top:Math.round((obj.mapViewExtent.top-_1c8.top)/obj.metersPerPixel),width:Math.round((_1c8.right-_1c8.left)/obj.metersPerPixel),height:Math.round((_1c8.top-_1c8.bottom)/obj.metersPerPixel)});
});
var _1c9=function(obj){
if(!obj.viewIndicatorMoving){
var _1cb=obj.mainMap.getMapViewExtent();
obj.viewIndicator.css({left:Math.round((_1cb.left-obj.mapViewExtent.left)/obj.metersPerPixel),top:Math.round((obj.mapViewExtent.top-_1cb.top)/obj.metersPerPixel)});
}
};
this.getMapMovedEvent(_1c6,_1c9);
_1c6.getMapMovedEvent(_1c6,_1c9);
if(this.mapType=="oblique"){
var _1cc=this.obliquePixelToGeoCoordinates(new KrakMap.Coordinate(this.mapViewCenter.x,this.obliqueResponse.actualpixeldimensions[1]-this.mapViewCenter.y));
}else{
var _1cc=temp.mapViewCenter;
}
_1c6.jumpToCoordinate(this.currentZoomLevel+this.overviewMapSettings.elevation,_1cc.x,_1cc.y,"kvec");
this.overviewMap=_1c6;
this.overviewMap.viewIndicator.bind("mousedown",function(_1cd){
temp.viewIndicatorMouseDown(_1cd);
});
}
};
KrakMap.TileClient.prototype.disableOverviewMap=function(){
if(this.overviewMap){
if(this.toolbar.overviewMap){
this.toolbar.overviewMap.css({backgroundPosition:"2px 1px"});
}
this.overviewMapContainer.remove();
this.overviewMap.viewIndicatorEventCatcher.remove();
this.overviewMap.viewIndicatorEventCatcher=null;
this.overviewMapContainer=null;
this.overviewMap=null;
if(this.mapType=="oblique"&&this.obliqueDirectionPanel){
this.obliqueDirectionPanel.css({left:"0px",bottom:"0px"});
}
}
};
KrakMap.TileClient.prototype.toggleOverviewMap=function(){
if(this.overviewMap){
this.disableOverviewMap();
}else{
this.enableOverviewMap(this.overviewMapSettings);
}
};
KrakMap.TileClient.prototype.enableNavigationKeys=function(){
this.navigationKeys=true;
var temp=this;
this.eventCatcher.bind("mouseover",function(_1cf){
jQuery(document).bind("keydown",function(_1d0){
temp.navigateKeyDown(_1d0);
});
});
this.eventCatcher.bind("mouseout",function(_1d1){
jQuery(document).unbind("keydown");
});
};
KrakMap.TileClient.prototype.disableNavigationKeys=function(){
this.navigationKeys=false;
this.eventCatcher.unbind("mouseover").unbind("mouseout").unbind("keydown").unbind("keyup");
clearInterval(this.animateScrollTimer);
clearInterval(this.animateMoveTimer);
};
KrakMap.TileClient.prototype.toggleNavigationKeys=function(){
if(this.navigationKeys){
this.disableNavigationKeys();
}else{
this.enableNavigationKeys();
}
};
KrakMap.TileClient.prototype.moveMap=function(_1d2){
var _1d3=new KrakMap.Coordinate(_1d2.x,_1d2.y);
if(this.mapType=="oblique"){
this.jumpToCoordinate(this.currentZoomLevel,_1d3.x,_1d3.y,this.mapType);
return;
}
this.mapMoveStartGridX=parseInt(this.gridContainerDomStyle.left);
this.mapMoveStartGridY=parseInt(this.gridContainerDomStyle.top);
this.mapMoveStartViewExtent=this.mapViewExtent;
var _1d4=this.mapContainerPixelWidth;
var _1d5=this.mapContainerPixelHeight;
var _1d6=this.metersPerPixel;
if(this.mainMap&&this.mainMap.mapType=="oblique"){
_1d3.y=this.mainMap.obliqueResponse.actualpixeldimensions[1]-_1d3.y;
_1d3=this.mainMap.obliquePixelToGeoCoordinates(_1d3);
}
var _1d7=new KrakMap.Extent(_1d3.y+((_1d5*_1d6)/2),_1d3.y-((_1d5*_1d6)/2),_1d3.x-((_1d4*_1d6)/2),_1d3.x+((_1d4*_1d6)/2));
this.targetPixelCoordinate=this.geoToPixelCoordinate(_1d7.left,_1d7.top);
this.targetPixelCoordinate=new KrakMap.Coordinate(-this.targetPixelCoordinate.x,-this.targetPixelCoordinate.y);
var temp=this;
clearInterval(this.animateMoveTimer);
this.animateMoveTimer=setInterval(function(){
temp.animateMove(temp,temp.targetPixelCoordinate);
},1);
};
KrakMap.TileClient.prototype.addTileLayer=function(id,_1da,url){
this.customTiles[id]={container:jQuery("<div></div>").css({position:"absolute",zIndex:Number(this.mapGrid.css("z-index"))+_1da}).appendTo(this.gridContainer),url:url,show:true};
};
KrakMap.TileClient.prototype.modifyTileLayer=function(id,_1dd,url){
this.customTiles[id].container.css({zIndex:Number(this.mapGrid.css("z-index"))+_1dd});
this.customTiles[id].url=url;
};
KrakMap.TileClient.prototype.removeTileLayer=function(id){
this.customTiles[id].container.remove();
delete this.customTiles[id];
};
KrakMap.TileClient.prototype.removeAllTileLayers=function(){
for(key in this.customTiles){
this.customTiles[key].container.remove();
delete this.customTiles[key];
}
};
KrakMap.TileClient.prototype.switchTileLayerOn=function(_1e0){
var _1e1=this.customTiles;
if(_1e1[_1e0]&&!_1e1[_1e0].show){
_1e1[_1e0].show=true;
_1e1[_1e0].container.css("display","block");
}
};
KrakMap.TileClient.prototype.switchTileLayerOff=function(_1e2){
var _1e3=this.customTiles;
if(_1e3[_1e2]&&_1e3[_1e2].show){
_1e3[_1e2].show=false;
_1e3[_1e2].container.css("display","none");
}
};
KrakMap.TileClient.prototype.toggleTileLayer=function(_1e4){
var _1e5=this.customTiles;
if(_1e5[_1e4]&&!_1e5[_1e4].show){
this.switchTileLayerOn(_1e4);
}else{
if(_1e5[_1e4]&&_1e5[_1e4].show){
this.switchTileLayerOff(_1e4);
}
}
};
KrakMap.TileClient.prototype.isTileLayer=function(_1e6){
if(this.customTiles[_1e6]&&this.customTiles[_1e6].show){
return true;
}
return false;
};
KrakMap.TileClient.prototype.enableRoute=function(_1e7,jump){
this.route=new wktCanvas(this);
this.route.setWkt(_1e7,true,jump);
};
KrakMap.TileClient.prototype.disableRoute=function(){
if(this.route){
this.route.clearWkt();
}
this.route=null;
};
KrakMap.TileClient.prototype.enableRouteSearch=function(){
this.routeSearchOpen=true;
if(this.toolbar.route){
this.toolbar.route.css({color:"#71AAD5",fontWeight:"bold",backgroundPosition:"0px -20px"});
}
if(!this.routeSearchContainer){
this.routeSearchContainer=jQuery("<div></div>").css({opacity:"0.9",background:"#FFFFFF none repeat scroll 0%",position:"absolute",top:"0px",width:"100%",zIndex:"3",display:"none",margin:"0pt",padding:"0pt"}).appendTo(this.mapContainer);
var _1e9=jQuery("<fieldset></fieldset>").css({borderStyle:"none none solid none",borderBottom:"1px solid #D8D8D8",padding:"10px",margin:"0pt",backgroundColor:"white"}).appendTo(this.routeSearchContainer);
var temp=this;
jQuery("<a href=\"#\"><img src=\""+this.imgDir+"gfx_icon_routeplan_close.gif\" border=\"0\"></a>").css({outline:"none",position:"absolute",right:"4px",bottom:"4px"}).bind("click",function(){
temp.disableRouteSearch();
return false;
}).appendTo(this.routeSearchContainer);
jQuery("<div></div>").css({position:"absolute",background:"transparent url("+this.imgDir+"toolbar/shadow.png) repeat-x scroll left top",height:"5px",width:"100%"}).appendTo(this.routeSearchContainer);
jQuery("<label></label>").css({font:"10px Verdana,Arial, Sans-serif"}).text("Vejnavn/Husnr").appendTo(_1e9);
this.toolbar.routeFrom=jQuery("<input type=\"text\"></input>").css({border:"1px solid #D8D8D8",margin:"0 0.38em 0 2px",padding:"0",width:"30%"}).bind("keypress",function(_1eb){
if(_1eb.which==13){
temp.toolbar.searchButton.click();
return false;
}
}).appendTo(_1e9);
jQuery("<label></label>").css({font:"10px Verdana,Arial, Sans-serif"}).text("Postnr/By").appendTo(_1e9);
this.toolbar.routeTo=jQuery("<input type=\"text\"></input><br />").css({border:"1px solid #D8D8D8",margin:"0 0.38em 0 2px",padding:"0",width:"30%"}).bind("keypress",function(_1ec){
if(_1ec.which==13){
temp.toolbar.searchButton.click();
return false;
}
}).appendTo(_1e9);
this.toolbar.searchButton=jQuery("<input type=\"image\"></input>").attr({src:this.imgDir+"gfx_bgimage_button_show.gif"}).css({marginLeft:"4px",marginTop:"4px"}).appendTo(_1e9);
var _1ed=jQuery("<span></span>").css({display:"none",border:"0pt none",padding:"0px"}).appendTo(_1e9);
this.toolbar.routeOption=jQuery("<select name=\"routeoption\"></select>").css("display","none").appendTo(_1e9);
this.toolbar.routeLink=jQuery("<input type=\"image\"></input> &nbsp;").attr({src:this.imgDir+"gfx_bgimage_button_route.gif"}).css({marginLeft:"4px",marginTop:"4px"}).appendTo(_1ed);
this.toolbar.travelLink=jQuery("<input type=\"image\" src=\""+this.imgDir+"/gfx_bgimage_button_travel.gif\" />").css({marginLeft:"4px",marginTop:"4px"}).appendTo(_1ed);
var temp=this;
this.toolbar.searchButton.bind("click",function(){
temp.throwEvent("routeSearch");
_1ed.show();
return false;
});
this.toolbar.routeOption.change(function(){
temp.throwEvent("routeOptionChange");
});
this.toolbar.travelLink.bind("click",function(){
temp.throwEvent("travelLinkClick");
return false;
});
this.toolbar.routeLink.click(function(){
temp.throwEvent("routeLinkClick");
return false;
});
}
this.routeSearchContainer.fadeIn();
};
KrakMap.TileClient.prototype.disableRouteSearch=function(){
if(this.routeSearchContainer){
this.routeSearchOpen=false;
this.routeSearchContainer.fadeOut();
if(this.toolbar.route){
this.toolbar.route.css({color:"#71AAD5",fontWeight:"bold",backgroundPosition:"0px 0px"});
}
}
};
KrakMap.TileClient.prototype.toggleRouteSearch=function(){
if(!this.routeSearchContainer){
this.enableRouteSearch();
}else{
if(this.routeSearchContainer.css("display")=="none"){
this.enableRouteSearch();
}else{
this.disableRouteSearch();
}
}
};
KrakMap.TileClient.prototype.isRouteSearch=function(){
return this.routeSearchOpen;
};
KrakMap.TileClient.prototype.addPoi=function(pois){
if(!(pois instanceof Array)){
pois=[pois];
}
var _1ef={};
for(var i=0;i<pois.length;i++){
var x=pois[i].coordinate.x;
var y=pois[i].coordinate.y;
var _1f3=pois[i].width;
var _1f4=pois[i].height;
var _1f5=pois[i].category;
var poi=pois[i].dom;
if(!_1ef[_1f5]){
_1ef[_1f5]=document.createDocumentFragment();
}
var _1f7=this.geoToPixelCoordinate(x,y);
var _1f8=this.getPoiLayer(_1f5);
var id=null;
if(poi.id){
id=poi.id;
}else{
id="poiGenratedId"+this.poiGeneratedId;
this.poiGeneratedId++;
}
if(!_1f8.pois[id]){
if(_1f3<=0){
_1f3=1;
}
if(_1f4<=0){
_1f4=1;
}
var _1fa=poi.style;
_1fa.left=Math.round(_1f7.x-_1f3/2)+"px";
_1fa.top=Math.round(_1f7.y-_1f4/2)+"px";
_1fa.position="absolute";
_1fa.display="none";
_1ef[_1f5].appendChild(poi);
_1f8.pois[id]=new KrakMap.PoiData(x,y,_1f3,_1f4,_1f5,poi);
if(this.mapType=="oblique"){
_1f8.pois[id].poi.style.display="none";
}else{
_1f8.pois[id].poi.style.display="block";
}
}
}
for(var _1f5 in _1ef){
this.getPoiLayer(_1f5).layer.appendChild(_1ef[_1f5]);
}
};
KrakMap.TileClient.prototype.addPoi2=function(x,y,_1fd,poi){
this.addPoi(x,y,0,0,_1fd,poi);
};
KrakMap.TileClient.prototype.removeAllPoi=function(){
this.poiLayerContainer.empty();
this.poiLayers=new Object();
};
KrakMap.TileClient.prototype.removeAllPoiInLayer=function(_1ff){
if(this.poiLayers[_1ff]){
this.poiLayers[_1ff].layer.innerHTML="";
this.poiLayerContainer.get(0).removeChild(this.poiLayers[_1ff].layer);
delete this.poiLayers[_1ff];
}
};
KrakMap.TileClient.prototype.removePoi=function(_200,id){
if(!_200){
for(key in this.poiLayers){
if(this.poiLayers[key].pois[id]){
_200=key;
break;
}
}
}
if(_200&&this.poiLayers[_200].pois[id]){
this.poiLayers[_200].layer.removeChild(this.poiLayers[_200].pois[id].poi);
delete this.poiLayers[_200].pois[id];
}
};
KrakMap.TileClient.prototype.togglePoiLayer=function(_202){
if(this.poiLayers[_202]){
if(this.poiLayers[_202].layer.style.display=="none"){
this.poiLayers[_202].layer.style.display="block";
}else{
this.poiLayers[_202].layer.style.display="none";
}
}
};
KrakMap.TileClient.prototype.switchPoiLayerOn=function(_203){
if(this.poiLayers[_203]){
this.poiLayers[_203].layer.style.display="block";
}
};
KrakMap.TileClient.prototype.switchPoiLayerOff=function(_204){
if(this.poiLayers[_204]){
this.poiLayers[_204].layer.style.display="none";
}
};
KrakMap.TileClient.prototype.enablePolygonDraw=function(){
this.disableCircleDraw();
this.disableMeasureLine();
this.polygonDrawCoordinates=[];
this.polygonDrawStartPointX=0;
this.polygonDrawStartPointY=0;
this.polygonWKTString="";
this.polygonDrawTempRoute=null;
this.polygonDrawPoints=null;
if(this.route){
this.route.clearWkt();
}
this.route=null;
this.polygonDrawEnabled=true;
this.polygonWKTString="";
var temp=this;
this.eventCatcher.unbind("mousedown").bind("mousedown",function(_206){
temp.polygonDrawAddCoordinate(_206);
});
};
KrakMap.TileClient.prototype.disablePolygonDraw=function(){
this.polygonDrawEnabled=false;
var temp=this;
this.eventCatcher.unbind("mousedown").bind("mousedown",function(_208){
temp.mapMoveMousedown(_208);
}).unbind("mousemove").bind("mousemove",function(_209){
temp.trackMousemove(_209);
});
};
KrakMap.TileClient.prototype.togglePolygonDraw=function(){
if(this.polygonDrawEnabled){
this.disablePolygonDraw();
}else{
this.enablePolygonDraw();
}
};
KrakMap.TileClient.prototype.enableMeasureLine=function(){
this.disableCircleDraw();
this.disablePolygonDraw();
this.measureLineEnabled=true;
this.measureLineCoordinates=[];
this.measureLineWKTString="";
if(this.route){
this.route.clearWkt();
}
var temp=this;
this.eventCatcher.unbind("mousedown").bind("mousedown",function(_20b){
temp.measureLineAddCoordinate(_20b);
});
this.eventCatcher.unbind("dblclick").bind("dblclick",function(_20c){
temp.disableMeasureLine(_20c);
});
};
KrakMap.TileClient.prototype.disableMeasureLine=function(){
this.updateLengthOfMeasuredLine();
if(this.measureLineEnabled){
this.throwEvent("afterMeasureTool");
}
this.measureLineEnabled=false;
var temp=this;
this.eventCatcher.unbind("mousedown").bind("mousedown",function(_20e){
temp.mapMoveMousedown(_20e);
}).bind("mousemove",function(_20f){
temp.trackMousemove(_20f);
});
this.eventCatcher.unbind("dblclick").bind("dblclick",function(_210){
temp.zoomByDoubleClick(_210);
});
};
KrakMap.TileClient.prototype.toggleMeasureLine=function(){
if(this.measureLineEnabled){
this.disableMeasureLine();
}else{
this.enableMeasureLine();
}
};
KrakMap.TileClient.prototype.enableCircleDraw=function(){
this.disablePolygonDraw();
this.disableMeasureLine();
this.circleCenter=null;
this.circleRadius=null;
if(this.route){
this.route.clearWkt();
}
var that=this;
this.circleDrawEnabled=true;
this.eventCatcher.css("cursor",this.crosshairCursor).unbind("mousedown");
this.eventCatcher.bind("mousedown",function(_212){
that.circleDraw(_212);
});
};
KrakMap.TileClient.prototype.disableCircleDraw=function(){
var that=this;
this.circleDrawEnabled=false;
this.eventCatcher.unbind("mousedown");
this.eventCatcher.unbind("mousemove");
this.eventCatcher.unbind("mouseup");
this.eventCatcher.css("cursor",this.grabCursor).bind("mousedown",function(_214){
that.mapMoveMousedown(_214);
}).bind("mousemove",function(_215){
that.trackMousemove(_215);
});
};
KrakMap.TileClient.prototype.circleDraw=function(_216){
var that=this;
switch(_216.type){
case "mousedown":
this.disableRoute();
this.throwEvent("beforeCircleDraw");
this.route=new wktCanvas(this);
this.throwEvent("beforeAddPoint");
this.circleCenter=this.pixelToGeoCoordinate(this.mousePositionX,this.mousePositionY);
this.throwEvent("afterAddPoint");
this.eventCatcher.bind("mousemove",function(_218){
that.circleDraw(_218);
});
this.eventCatcher.bind("mouseup",function(_219){
that.circleDraw(_219);
});
break;
case "mousemove":
var cur=this.pixelToGeoCoordinate(this.mousePositionX,this.mousePositionY);
var dx=Math.abs(cur.x-this.circleCenter.x);
var dy=Math.abs(cur.y-this.circleCenter.y);
this.circleRadius=Math.sqrt(dx*dx+dy*dy);
var wkt=["POLYGON(("];
for(var i=0;i<this.circleApproximationEdges;i++){
wkt[wkt.length]=(this.circleCenter.x+this.circleRadius*Math.sin(this.circleSegmentLength*i));
wkt[wkt.length]=" ";
wkt[wkt.length]=(this.circleCenter.y+this.circleRadius*Math.cos(this.circleSegmentLength*i));
wkt[wkt.length]=(i<this.circleApproximationEdges-1)?",":"))";
}
wkt=wkt.join("");
if(!this.route.setWkt(wkt,false,false)){
throw "Invalid geometry";
}
break;
case "mouseup":
this.eventCatcher.unbind("mousemove").bind("mousemove",function(_21f){
that.trackMousemove(_21f);
});
this.eventCatcher.unbind("mouseup");
this.throwEvent("circleDraw");
this.throwEvent("afterCircleDraw");
break;
default:
return;
}
};
KrakMap.TileClient.prototype.toggleCircleDraw=function(){
if(this.isCircleDraw()){
this.disableCircleDraw();
}else{
this.enableCircleDraw();
}
};
KrakMap.TileClient.prototype.isCircleDraw=function(){
return this.circleDrawEnabled;
};
KrakMap.TileClient.prototype.getMapViewCenter=function(){
var _220=null;
if(this.mapType=="oblique"){
return this.obliquePixelToGeoCoordinates(new KrakMap.Coordinate(this.mapViewCenter.x,this.obliqueResponse.actualpixeldimensions[1]-this.mapViewCenter.y));
}else{
_220=this.mapViewCenter;
}
return _220;
};
KrakMap.TileClient.prototype.getCurrentZoomLevel=function(){
return this.currentZoomLevel;
};
KrakMap.TileClient.prototype.getZoomLevels=function(){
return this.zoomLevels;
};
KrakMap.TileClient.prototype.getVectorMinZoomLevel=function(){
return this.vectorMinZoomLevel;
};
KrakMap.TileClient.prototype.getMapType=function(){
return this.mapType;
};
KrakMap.TileClient.prototype.getMapViewExtent=function(){
if(this.mapType=="oblique"){
return this.obliquePixelToGeoExtent(this.mapViewExtent);
}
return this.mapViewExtent;
};
KrakMap.TileClient.prototype.getMapGridExtent=function(){
if(this.mapType=="oblique"){
return this.obliquePixelToGeoExtent(this.mapGridExtent);
}
return this.mapGridExtent;
};
KrakMap.TileClient.prototype.getMetersPerPixel=function(){
return this.metersPerPixel;
};
KrakMap.TileClient.prototype.getMinZoomLevel=function(){
return this.minZoomLevel;
};
KrakMap.TileClient.prototype.getMaxZoomLevel=function(){
if(this.mapType=="oblique"){
return this.ObliqueService.zoomLevels.length-1;
}
return this.maxZoomLevel;
};
KrakMap.TileClient.prototype.getMeasuredExtent=function(){
if(this.mapType=="oblique"){
return this.obliquePixelToGeoExtent(this.measuredExtent);
}
return this.measuredExtent;
};
KrakMap.TileClient.prototype.getMeasureBox=function(){
return this.measureBox;
};
KrakMap.TileClient.prototype.getNavigationKeys=function(){
return this.navigationKeys;
};
KrakMap.TileClient.prototype.getOverviewMap=function(){
return this.overviewMap;
};
KrakMap.TileClient.prototype.getMousePosition=function(){
return new KrakMap.Coordinate(this.mousePositionX,this.mousePositionY);
};
KrakMap.TileClient.prototype.getMapState=function(){
var _221=this.getMapViewCenter();
return {zoomLevel:this.getCurrentZoomLevel(),mapType:this.getMapType(),mapViewCenter:{x:_221.x,y:_221.y},minZoomLevel:this.getMinZoomLevel(),maxZoomLevel:this.getMaxZoomLevel()};
};
KrakMap.TileClient.prototype.getSerializedMapState=function(){
var _222=this.getMapViewCenter();
var _223=this.overviewMapSettings;
var _224=(this.overviewMap)?true:false;
return "{"+"zoomLevel:"+this.getCurrentZoomLevel()+","+"mapType:'"+this.getMapType()+"',"+"mapViewCenter:{x:"+_222.x+",y: "+_222.y+"},"+"minZoomLevel:"+this.getMinZoomLevel()+","+"maxZoomLevel:"+this.getMaxZoomLevel()+"}";
};
KrakMap.TileClient.prototype.setMinZoomLevel=function(_225){
this.minZoomLevel=Number(_225);
};
KrakMap.TileClient.prototype.setMaxZoomLevel=function(_226){
this.maxZoomLevel=Number(_226);
};
KrakMap.TileClient.prototype.setRouteFallBack=function(flag){
this.routeFallBack=flag;
};
KrakMap.TileClient.prototype.setMapState=function(_228){
if(typeof (_228)=="string"){
eval("mapState ="+_228);
}
this.setMinZoomLevel(_228.minZoomLevel);
this.setMaxZoomLevel(_228.maxZoomLevel);
this.jumpToCoordinate(_228.zoomLevel,_228.mapViewCenter.x,_228.mapViewCenter.y,_228.mapType);
if(_228.overviewMap){
this.enableOverviewMap(_228.overviewMapSettings);
}
if(_228.measureBox){
this.enableMeasureBox();
}
if(_228.navigationKeys){
this.enableNavigationKeys();
}
};
KrakMap.TileClient.prototype.setOverviewMapSettings=function(_229){
this.overviewMapSettings=_229;
};
KrakMap.TileClient.prototype.setToolbarCenterButtonCoordinate=function(_22a,_22b,_22c,_22d){
if(_22a.x<99999&&_22a.y<99999){
_22a=this.obliquePixelToGeoCoordinates(new KrakMap.Coordinate(Math.round(Number(_22a.x)),this.obliqueResponse.actualpixeldimensions[1]-Math.round(Number(_22a.y))));
}
var temp=this;
this.toolbar.center.unbind("click").bind("click",function(){
temp.jumpToCoordinate(_22b,_22a.x,_22a.y,_22c,_22d);
return false;
});
};
KrakMap.TileClient.prototype.setPrintAction=function(_22f){
if(this.toolbar.print){
this.toolbar.print.unbind("click").bind("click",_22f).bind("click",function(){
return false;
});
}
};
KrakMap.Extent=function(top,_231,left,_233){
this.top=Number(top);
this.bottom=Number(_231);
this.left=Number(left);
this.right=Number(_233);
};
KrakMap.Extent.prototype.toString=function(_234){
_234=Number(_234);
if(_234==undefined){
_234=0;
}
var _235;
if(_234==0){
_235="{top: "+this.top+", bottom: "+this.bottom+", left: "+this.left+", right: "+this.right+"}";
}else{
_235="{top: "+this.top.toFixed(_234)+", bottom: "+this.bottom.toFixed(_234)+", left: "+this.left.toFixed(_234)+", right: "+this.right.toFixed(_234)+"}";
}
return _235;
};
KrakMap.Coordinate=function(x,y){
this.x=Number(x);
this.y=Number(y);
};
KrakMap.Coordinate.prototype.toString=function(_238){
_238=Number(_238);
if(_238==undefined){
_238=0;
}
var _239;
if(_238==0){
_239="{x: "+this.x+", y: "+this.y+"}";
}else{
_239="{x: "+this.x.toFixed(_238)+", y: "+this.y.toFixed(_238)+"}";
}
return _239;
};
KrakMap.PoiData=function(x,y,_23c,_23d,_23e,poi){
this.x=x;
this.y=y;
this.width=_23c;
this.height=_23d;
this.layer=_23e;
this.poi=poi;
};
KrakMap.PoiLayerData=function(_240){
this.layer=_240;
this.pois=new Object();
};
KrakMap.ObliqueService=function(_241){
this.tileclient=_241;
jQuery.extend(this,_241.settings.obliqueSettings);
};
KrakMap.ObliqueService.states={loading:"loading",completed:"completed",error:"error"};
KrakMap.ObliqueService.prototype={domainDistroServers:["otile00.krak.dk","otile01.krak.dk","otile02.krak.dk","otile03.krak.dk"],url:"tileclient.krak.dk",zoomLevels:["1.0","0.7","0.4"],distributionBase:1,timeOutMillesec:10000,state:KrakMap.ObliqueService.states.loading,_codes:{nocontentfound:204,badrequest:400,notfound:404,serviceunavailable:503,timeout:1000},_texts:{unknown:"Vi beklager, men der er sket en fejl.",fatal:"Vi beklager, men der er sket en fejl.",timeout:"Vi beklager, men der er sket en fejl.",noimages:"Vi har desv\xe6rre ingen skr\xe5foto i dette omr\xe5de"},_places:{},_retrys:3,isAvailable:function(_242){
if(this.state==KrakMap.ObliqueService.states.completed){
var x=_242.x;
var y=_242.y;
var _245=_places["n"];
for(var i=_245.length-1;i>=0;i--){
if(x>=_245[i][0]&&x<=_245[i][1]&&y>=_245[i][2]&&y<=_245[i][3]){
return true;
}
}
}
return false;
},getBestPhoto:function(_247,x,y,_24a,_24b){
if(_247<0){
_247=0;
}
if(_247>this.zoomLevels.length-1){
_247=this.zoomLevels.length-1;
}
if(x<99999&&y<99999){
var _24c=this.tileclient.obliquePixelToGeoCoordinates(new KrakMap.Coordinate(Math.round(Number(x)),this.tileclient.obliqueResponse.actualpixeldimensions[1]-Math.round(Number(y))));
x=_24c.x;
y=_24c.y;
}
if(!_24a&&this.tileclient.obliqueResponse){
_24a=this.tileclient.obliqueResponse.direction;
}
if(!_24a){
_24a="n";
}
var self=this;
var url="http://"+this.url+"/ObliqueService/bestphoto/"+_24a+"/"+x+","+y+"/"+this.zoomLevels[_247];
var _24f=false;
var _250=setTimeout(function(){
_24f=true;
self._getBestPhotoError(self._codes.timeout,null);
},this.timeOutMillesec);
jQuery.ajax({url:url,dataType:"jsonp",success:function(json){
clearTimeout(_250);
if(!_24f){
if(json.errorcode&&json.errorcode!=self._codes.nocontentfound){
self._getBestPhotoError(json.errorcode,json.errordesc);
}else{
_24b(json,x,y,_247);
}
}
}});
},getBestPhotoPlaces:function(_252){
var self=this;
var url="http://"+this.url+"/ObliqueService/bestphoto/places/extents";
var _255=(arguments[1]?arguments[1]:0);
var _256=false;
var _257=setTimeout(function(){
_256=true;
self._getBestPhotoPlacesError(self._codes.timeout,null,_252,_255);
},this.timeOutMillesec);
jQuery.ajax({url:url,dataType:"jsonp",success:function(json){
clearTimeout(_257);
if(!_256){
if(json.errorcode){
self._getBestPhotoPlacesError(json.errorcode,json.errordesc,null,null);
}else{
self._endBestPhotoPlaces(json);
_252();
}
}
}});
},_endBestPhotoPlaces:function(json){
_places=json;
this.state=KrakMap.ObliqueService.states.completed;
},_getBestPhotoError:function(_25a,_25b){
switch(_25a){
case this._codes.timeout:
this.tileclient.messageBoard.error(this._texts.timeout);
break;
case this._codes.serviceunavailable:
case this._codes.badrequest:
case this._codes.notfound:
this.tileclient.messageBoard.error(this._texts.fatal);
break;
default:
this.tileclient.messageBoard.error(this._texts.unknown);
break;
}
},_getBestPhotoPlacesError:function(_25c,_25d,_25e,_25f){
switch(_25c){
case this._codes.timeout:
_25f++;
if(_25f<this._retrys){
this.getBestPhotoPlaces(_25e,_25f);
}else{
this.tileclient.messageBoard.error(this._texts.timeout);
}
break;
case this._codes.nocontentfound:
self.tileclient.messageBoard.error(this._texts.fatal);
break;
case this._codes.serviceunavailable:
case this._codes.badrequest:
case this._codes.notfound:
self.tileclient.messageBoard.error(this._texts.fatal);
break;
default:
this.tileclient.messageBoard.error(this._texts.unknown);
break;
}
}};
KrakMap.Message=function(type,text,_262){
this.type=type;
this.text=text;
this.settings=_262;
};
KrakMap.Message.types={error:"error",info:"info",wating:"wating",loading:"loading"};
KrakMap.MessageBoard=function(_263){
this.tileclient=_263;
jQuery.extend(this._displayOptions,_263.settings.messageBoardSettings);
};
KrakMap.MessageBoard.prototype={_displayOptions:{visible:true},_genericMessages:{error:"Der er sket en fejl",info:"Der er sket noget",wating:"Vent venligst",loading:"Opretter; vent venligst"},_settings:{Retry:0,CallBack:null,Block:true,CanClose:false},messages:[],active:false,error:function(){
this.parseArgument(arguments,KrakMap.Message.types.error);
},info:function(){
this.parseArgument(arguments,KrakMap.Message.types.info);
},wating:function(){
this.parseArgument(arguments,message.types.wating);
},loading:function(){
this.parseArgument(arguments,message.types.loading);
},parseArgument:function(args,type){
var m;
if(args.length==0){
m=new KrakMap.Message(type,this._genericMessages[type],this._settings);
}else{
if(args.length==1){
if(typeof (args[0]).toLowerCase()=="string"){
m=new KrakMap.Message(type,args[0],this._settings);
}
}else{
m=new KrakMap.Message(type,jQuery.extend({},this._settings,args[1]));
}
}
this.show(m);
},_bottom:0,_stack:[],show:function(m){
if(this._displayOptions.visible){
this.active=true;
this.messages.push(m);
this.advancedShow(m);
}
},advancedShow:function(m){
var html=jQuery("<div style=\"position: absolute;z-index:1000;right:0px;bottom:"+this._bottom+"px; display:none; text-align:center;\"><div style=\"display:none;color:#ffffff;border:2px solid silver;background-color: #000000;width:150px;height:50px;  font-weight: bold;\"></div></div>");
switch(m.type){
case KrakMap.Message.types.error:
html.find("div").css("background-color","#FF0000").css("color","#000000");
break;
case KrakMap.Message.types.info:
html.find("div").css("background-color","#ffffff").css("color","#000000");
break;
}
var self=this;
this._stack.push(html);
html.appendTo(this.tileclient.mapContainer).show().find("div").html(m.text).show("slow",function(){
var _26b=jQuery(this).parent();
setTimeout(function(){
self._stack.shift().find("div").hide("slow",function(){
jQuery(this).parent().remove();
jQuery.each(self._stack,function(){
this.css("bottom",parseInt(this.css("bottom").replace("px",""))+"px");
});
});
},5000);
});
},hide:function(){
this.active=false;
this.messageLayer.hide("slow").css("z-index",-1);
}};

var MAXCOORD=32670;
function wktCanvas(_1){
this.browserDetect.init();
this.tileClient=_1;
this.renderSegmented=true;
this.forceFallback=_1.routeFallBack;
this.routeContainer=document.createElement("div");
this.routeContainer.style.position="absolute";
this.routeContainer.style.zIndex=2;
this.tileClient.gridContainer.get(0).appendChild(this.routeContainer);
this.nsSvg="http://www.w3.org/2000/svg";
this.strokeOpacity="100%";
this.strokeColor="#0000ff";
this.strokeWeight="3px";
this.strokeColorHighlighted="#ff0000";
this.strokeWeightHighlighted="4px";
this.polygonFill="#0000ff";
this.polygonOpacity="50%";
this.nullBBox={minx:Infinity,maxx:-Infinity,miny:Infinity,maxy:-Infinity,width:0,height:0};
this.route={asWkt:undefined,asData:undefined,BBox:this.nullBBox,UTMBBox:new KrakMap.Extent(-Infinity,Infinity,Infinity,-Infinity),segmentExtents:[]};
this.tileClient.getBuildingGridEvent(this,this.draw);
this.tileClient.getMapGridExtentUpdatedEvent(this,this.draw);
}
wktCanvas.prototype.browserDetect={init:function(){
this.browser=this.searchString(this.dataBrowser)||"An unknown browser";
this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";
this.OS=this.searchString(this.dataOS)||"an unknown OS";
},searchString:function(_2){
for(var i=0;i<_2.length;i++){
var _4=_2[i].string;
var _5=_2[i].prop;
this.versionSearchString=_2[i].versionSearch||_2[i].identity;
if(_4){
if(_4.indexOf(_2[i].subString)!=-1){
return _2[i].identity;
}
}else{
if(_5){
return _2[i].identity;
}
}
}
},searchVersion:function(_6){
var _7=_6.indexOf(this.versionSearchString);
if(_7==-1){
return;
}
return parseFloat(_6.substring(_7+this.versionSearchString.length+1));
},dataBrowser:[{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};
wktCanvas.prototype.svgEnabled=function(){
var b=this.browserDetect.browser;
return (!(b=="Explorer"||(b=="Safari"&&parseFloat(this.browserDetect.version)<523)||(b=="Mozilla"&&parseFloat(this.browserDetect.version)<2)||(b=="Opera"&&this.tileClient.currentZoomLevel<1)));
};
wktCanvas.prototype.vmlEnabled=function(){
return (this.browserDetect.OS=="Windows"&&this.browserDetect.browser=="Explorer");
};
wktCanvas.prototype.geoCoordinatesToPixel=function(x,y,_b,_c){
return this.tileClient.geoToPixelCoordinate(x,y);
};
wktCanvas.prototype.isValidWKT=function(_d){
var _e=false;
var _f;
try{
_f=_d.replace(/^SRID=\d+;/,"").match(/^(\w+)/)[1].toLowerCase();
}
catch(error){
_f="";
}
if(_f=="point"){
_e=/^POINT\s*\(\s*-?\d+(\.\d+)?\s+-?\d+(\.\d+)?\s*\)\s*$/i.test(_d);
}else{
if(_f=="multipoint"){
_e=/^MULTIPOINT\s*\(\s*-?\d+(\.\d+)?\s+-?\d+(\.\d+)?(\s*,\s*-?\d+(\.\d+)?\s+-?\d+(\.\d+)?)*\s*\)\s*$/i.test(_d);
}else{
if(_f=="linestring"){
_e=/^LINESTRING\s*\(\s*-?\d+(\.\d+)?\s+-?\d+(\.\d+)?\s*,\s*-?\d+(\.\d+)?\s+-?\d+(\.\d+)?(\s*,\s*-?\d+(\.\d+)?\s+-?\d+(\.\d+)?)*\s*\)\s*$/i.test(_d);
}else{
if(_f=="multilinestring"){
_e=/^MULTILINESTRING\s*\(\s*(\(\s*-?\d+(\.\d+)?\s+-?\d+(\.\d+)?\s*,\s*-?\d+(\.\d+)?\s+-?\d+(\.\d+)?(\s*,\s*-?\d+(\.\d+)?\s+-?\d+(\.\d+)?)*\s*\)\s*,?\s*)+\s*\)\s*$/i.test(_d);
}else{
if(_f=="polygon"){
_e=/^POLYGON\s*\(\s*(\(\s*-?\d+(\.\d+)?\s+-?\d+(\.\d+)?\s*,\s*-?\d+(\.\d+)?\s+-?\d+(\.\d+)?(\s*,\s*-?\d+(\.\d+)?\s+-?\d+(\.\d+)?)*\s*\)\s*,?\s*)+\s*\)\s*$/i.test(_d);
}else{
_e=false;
}
}
}
}
}
return _e;
};
wktCanvas.prototype.parseWKT=function(wkt){
var _11={type:"unknown",coords:new Array()};
this.rcoords=_11.coords;
var _12=wkt.replace(/^SRID=\d+;/,"");
_11.type=_12.match(/^(\w+)/)[1].toLowerCase();
var _13=/-?\d+(\.\d+)?/g;
var tc=this.tileClient;
var _15=tc.gridContainer.offset();
var _16=tc.pixelToGeoCoordinate(_15.left,_15.top,tc.currentZoomLevel);
var mpp=tc.metersPerPixel;
var _18=this.route.UTMBBox;
switch(_11.type){
case "point":
case "multipoint":
this.coords=_12.match(_13);
var cl=this.coords.length-1;
for(var i=0;i<cl;i++){
this.rcoords.push(this.geoCoordinatesToPixel(parseFloat(this.coords[i]),parseFloat(this.coords[++i]),_16,mpp));
}
break;
case "linestring":
case "multilinestring":
case "polygon":
var _1b=new Array();
var _1c=this.rcoords;
var _1d=_12.split(/\)\s*,?\s*\(/g);
var pl=_1d.length;
var _1f=this.route.segmentExtents;
for(var p=0;p<pl;p++){
_1c.push(new Array());
_1b[p]=_1d[p].match(_13);
var cl=_1b[p].length-1;
var _21=new KrakMap.Extent(-Infinity,Infinity,Infinity,-Infinity);
for(var i=0;i<cl;i++){
var _22=parseFloat(_1b[p][i]);
var _23=parseFloat(_1b[p][++i]);
var rcp=_1c[p];
if(_22<_18.left){
_18.left=_22;
}
if(_22>_18.right){
_18.right=_22;
}
if(_23<_18.bottom){
_18.bottom=_23;
}
if(_23>_18.top){
_18.top=_23;
}
if(_22<_21.left){
_21.left=_22;
}
if(_22>_21.right){
_21.right=_22;
}
if(_23<_21.bottom){
_21.bottom=_23;
}
if(_23>_21.top){
_21.top=_23;
}
rcp.push(new KrakMap.Coordinate(_22,_23));
}
_1f.push(_21);
}
this.coords=_1b;
break;
}
return _11;
};
wktCanvas.prototype.createSvgElement=function(id){
var svg=document.createElementNS(this.nsSvg,"svg");
svg.setAttributeNS(null,"id",id);
svg.setAttributeNS(null,"version","1.1");
svg.setAttributeNS(null,"overflow","visible");
var _27=this.route.BBox;
svg.setAttributeNS(null,"width",_27.width+4+"px");
svg.setAttributeNS(null,"height",_27.height+4+"px");
svg.setAttributeNS(null,"viewBox",(_27.minx-2)+" "+(_27.miny-2)+" "+(_27.width+4)+" "+(_27.height+4));
svg.style.position="absolute";
svg.style.left=(_27.minx-2)+"px";
svg.style.top=(_27.miny-2)+"px";
svg.style.zIndex="95";
return svg;
};
wktCanvas.prototype.createSvgPolylineElement=function(id,_29){
var _2a=document.createElementNS(this.nsSvg,"svg:polyline");
_2a.setAttributeNS(null,"id",id);
_2a.setAttributeNS(null,"fill","none");
_2a.setAttributeNS(null,"stroke",this.strokeColor);
_2a.setAttributeNS(null,"stroke-width",this.strokeWeight);
_2a.setAttributeNS(null,"stroke-linecap","round");
_2a.setAttributeNS(null,"stroke-linejoin","round");
_2a.setAttributeNS(null,"stroke-opacity","1");
_2a.setAttributeNS(null,"points",_29);
return _2a;
};
wktCanvas.prototype.createSvgTextElement=function(x,y,id,txt){
var _2f=document.createElementNS(this.nsSvg,"svg:text");
_2f.setAttributeNS(null,"id",id);
_2f.setAttributeNS(null,"x",x+"px");
_2f.setAttributeNS(null,"y",y+"px");
_2f.setAttributeNS(null,"fill","white");
_2f.setAttributeNS(null,"font-size",12);
_2f.appendChild(document.createTextNode(txt));
return _2f;
};
wktCanvas.prototype.wkt2svg=function(_30){
var svg=this.createSvgElement("svg");
if(_30==null){
return svg;
}
var tc=this.tileClient;
var dc=_30.coords;
switch(_30.type){
case "multilinestring":
case "linestring":
if(this.renderSegmented){
for(var i=0;i<dc.length;i++){
var _35=dc[i];
if(0==_35.length){
continue;
}
var _36=new Array(_35.length);
for(var j=0;j<_35.length;j++){
var cur=_35[j];
_36.push(cur.x+","+cur.y);
if(tc.polygonDrawEnabled&&0==i&&0==j){
var _39=document.createElementNS(this.nsSvg,"svg:circle");
_39.setAttributeNS(null,"id","polygon");
_39.setAttributeNS(null,"cx",cur.x);
_39.setAttributeNS(null,"cy",cur.y);
_39.setAttributeNS(null,"r",10);
_39.setAttributeNS(null,"fill","#ff00ff");
_39.setAttributeNS(null,"fill-rule","evenodd");
_39.setAttributeNS(null,"fill-opacity","0.75");
svg.appendChild(_39);
}
}
svg.appendChild(this.createSvgPolylineElement("segment"+i,_36.join(" ")));
if(tc.measureLineEnabled){
var _3a=this.route.BBox;
if(_3a.minx<Infinity){
var len=tc.measureLineLength/1000;
var _3c=this.createSvgTextElement(_3a.minx+_3a.width/2,_3a.miny+_3a.height/2,"measuredLength"+i,len.toFixed(1)+"km");
_3c.setAttributeNS(null,"fill","black");
svg.appendChild(_3c);
}
}
}
}else{
var _36=new Array();
for(var i=0;i<dc.length;i++){
for(var j=0;j<dc[i].length;j++){
var cur=dc[i][j];
_36.push(cur.x+","+cur.y);
}
}
svg.appendChild(this.createSvgPolylineElement("segment0",_36.join(" ")));
}
break;
case "polygon":
var _3d=document.createElementNS(this.nsSvg,"svg:polygon");
_3d.setAttributeNS(null,"id","polygon");
_3d.setAttributeNS(null,"fill","#0000ff");
_3d.setAttributeNS(null,"fill-rule","evenodd");
_3d.setAttributeNS(null,"stroke-width","0px");
_3d.setAttributeNS(null,"fill-opacity","0.5");
var rgD=new Array();
for(var i=0;i<dc.length;i++){
for(var j=0;j<dc[i].length;j++){
var cur=dc[i][j];
rgD.push(cur.x+","+cur.y);
}
}
_3d.setAttribute("points",rgD.join(" "));
svg.appendChild(_3d);
if(tc.circleDrawEnabled){
this.circleDrawEnabled=true;
}
if(this.circleDrawEnabled){
var _3a=this.route.BBox;
if(_3a.minx<Infinity){
var len=tc.circleRadius/1000;
var _3f=this.createSvgTextElement(_3a.minx+_3a.width/2,_3a.miny+_3a.height/2,"measuredLength"+i,len.toFixed(1)+"km");
svg.appendChild(_3f);
}
}
break;
}
return svg;
};
wktCanvas.prototype.createVmlElement=function(){
document.namespaces.add("vml","urn:schemas-microsoft-com:vml");
var _40=(document.styleSheets.length>0)?document.styleSheets[0]:document.createStyleSheet();
_40.addRule("vml\\:polyline","behavior:url(#default#VML);position:relative;display:inline-block;");
_40.addRule("vml\\:group","behavior:url(#default#VML);position:relative;display:inline-block;");
_40.addRule("vml\\:shape","behavior:url(#default#VML);position:relative;display:inline-block;");
_40.addRule("vml\\:stroke","behavior:url(#default#VML);position:relative;display:inline-block;");
_40.addRule("vml\\:fill","behavior:url(#default#VML);position:relative;display:inline-block;");
_40.addRule("vml\\:rect","behavior:url(#default#VML);position:relative;display:inline-block;");
_40.addRule("vml\\:oval","behavior:url(#default#VML);position:relative;display:inline-block;");
_40.addRule("vml\\:textbox","behavior:url(#default#VML);position:relative;display:inline-block;");
var vml=document.createElement("div");
var _42=vml.style;
_42.position="absolute";
_42.left="0px";
_42.top="0px";
_42.zIndex="95";
return vml;
};
wktCanvas.prototype.createVmlGroup=function(id){
var _44=document.createElement("vml:group");
_44.setAttribute("id",id);
_44.setAttribute("unselectable","on");
_44.setAttribute("stroke",true);
_44.setAttribute("coordorigin","0 0");
_44.setAttribute("coordsize","512 512");
_44.style.position="absolute";
_44.style.left="0px";
_44.style.top="0px";
_44.style.width="512px";
_44.style.height="512px";
_44.style.zIndex="95";
return _44;
};
wktCanvas.prototype.createVmlPolyline=function(id,_46){
var _47=document.createElement("vml:polyline");
_47.setAttribute("id",id);
_47.setAttribute("filled","false");
_47.setAttribute("points",_46);
var _48=document.createElement("vml:stroke");
_48.setAttribute("opacity",this.strokeOpacity);
_48.setAttribute("color",this.strokeColor);
_48.setAttribute("weight",this.strokeWeight);
_47.appendChild(_48);
return _47;
};
wktCanvas.prototype.createVmlPolygon=function(id,_4a){
var _4b=document.createElement("vml:polyline");
_4b.setAttribute("id",id);
_4b.setAttribute("filled","true");
_4b.setAttribute("stroked","false");
_4b.setAttribute("points",_4a);
var _4c=document.createElement("vml:fill");
_4c.setAttribute("opacity",this.polygonOpacity);
_4c.setAttribute("color",this.polygonFill);
_4c.setAttribute("weight",this.strokeWeight);
_4b.appendChild(_4c);
return _4b;
};
wktCanvas.prototype.createVmlTextElement=function(id,txt){
var _4f=document.createElement("vml:textbox");
_4f.setAttribute("id",id);
_4f.innerHTML=txt;
return _4f;
};
wktCanvas.prototype.wkt2vml=function(_50){
var vml=this.createVmlElement();
var tc=this.tileClient;
if(_50==null){
return vml;
}
var g=this.createVmlGroup("vml");
var dc=_50.coords;
switch(_50.type){
case "multilinestring":
case "linestring":
if(this.renderSegmented){
for(var i=0;i<dc.length;i++){
var _56=dc[i];
if(0==_56.length){
continue;
}
var _57=new Array(_56.length);
for(var j=0;j<_56.length;j++){
var cur=_56[j];
_57[j]=cur.x+","+cur.y;
if(tc.polygonDrawEnabled&&0==i&&0==j){
var _5a=document.createElement("vml:oval");
_5a.setAttribute("id","polygon");
_5a.style.left=(cur.x-10)+"px";
_5a.style.top=(cur.y-10)+"px";
_5a.style.width="20px";
_5a.style.height="20px";
_5a.style.fillcolor="#ff00ff";
_5a.setAttribute("filled","true");
_5a.setAttribute("stroked","false");
var _5b=document.createElement("vml:fill");
_5b.setAttribute("opacity","0.75");
_5b.setAttribute("color","#ff00ff");
_5a.appendChild(_5b);
g.appendChild(_5a);
}
}
var _5c=this.createVmlPolyline("segment"+i,_57.join(" "));
g.appendChild(_5c);
if(tc.measureLineEnabled){
var _5d=this.route.BBox;
if(_5d.minx<Infinity){
var len=tc.measureLineLength/1000;
g.appendChild(this.createVmlTextElement("measuredLength"+i,len.toFixed(1)+"km"));
}
}
}
}else{
var _5f=new Array();
for(var i=0;i<dc.length;i++){
for(var j=0;j<dc[i].length;j++){
var cur=dc[i][j];
_5f.push(cur.x+","+cur.y);
}
}
var _5c=this.createVmlPolyline("segment0",_5f.join(" "));
g.appendChild(_5c);
}
break;
case "polygon":
for(var i=0;i<dc.length;i++){
var _60=dc[i];
if(0==_60.length){
continue;
}
var _5f=new Array();
for(var j=0;j<_60.length;j++){
var _61=_60[j];
_5f.push(_61.x+","+_61.y);
}
var _62=this.createVmlPolygon("polygon"+i,_5f.join(" "));
g.appendChild(_62);
if(tc.circleDrawEnabled){
this.circleDrawEnabled=true;
}
if(this.circleDrawEnabled){
var _5d=this.route.BBox;
if(_5d.minx<Infinity){
var len=tc.circleRadius/1000;
if(!document.getElementById("radiusText")){
var _63=this.createVmlTextElement("radiusText",len.toFixed(1)+"km");
_63.style.color="white";
var _64=(len*1000)/this.tileClient.metersPerPixel;
_63.style.left=(_64-20)+"px";
_63.style.top=(_64-6)+"px";
g.appendChild(_63);
}else{
document.getElementById("radiusText").innerHTML=len.toFixed(1)+"km";
}
}
}
}
break;
}
vml.appendChild(g);
return vml;
};
wktCanvas.prototype.getBBox=function(_65){
var _66=this.nullBBox;
var cur={x:null,y:null};
var dc=_65.coords;
switch(_65.type){
case "linestring":
case "multilinestring":
case "polygon":
for(var i=0;i<dc.length;i++){
for(var j=0;j<dc[i].length;j++){
cur=dc[i][j];
if(cur.x<_66.minx){
_66.minx=cur.x;
}
if(cur.x>_66.maxx){
_66.maxx=cur.x;
}
if(cur.y<_66.miny){
_66.miny=cur.y;
}
if(cur.y>_66.maxy){
_66.maxy=cur.y;
}
}
}
if(this.tileClient.polygonDrawEnabled){
_66.minx=_66.minx-5;
_66.maxx=_66.maxx+5;
_66.miny=_66.miny-5;
_66.maxy=_66.maxy+5;
}
break;
case "point":
case "multipoint":
for(var i=0;i<dc.length;i++){
cur=dc[i];
if(cur.x<_66.minx){
_66.minx=cur.x;
}
if(cur.x>_66.maxx){
_66.maxx=cur.x;
}
if(cur.y<_66.miny){
_66.miny=cur.y;
}
if(cur.y>_66.maxy){
_66.maxy=cur.y;
}
}
break;
}
_66.width=_66.maxx-_66.minx;
_66.height=_66.maxy-_66.miny;
return _66;
};
wktCanvas.prototype.drawFallback=function(){
var rcr=this.route;
var tc=this.tileClient;
var dc=rcr.asData.coords;
var jg=new jsGraphics(this.routeContainer);
jg.setPrintable(this.forceFallback);
jg.setColor(this.strokeColor);
jg.setStroke(parseInt(this.strokeWeight,10));
var _6f=tc.mapGridPixelExtent.left;
var _70=tc.mapGridPixelExtent.right;
var _71=tc.mapGridPixelExtent.top;
var _72=tc.mapGridPixelExtent.bottom;
for(var i=0;i<dc.length;i++){
var l=dc[i].length-1;
for(var j=0;j<l;j++){
var _76=dc[i][j];
var fx=parseInt(_76.x);
var fy=parseInt(_76.y);
var to=dc[i][j+1];
var tx=parseInt(to.x);
var ty=parseInt(to.y);
if((fx>=_6f&&fx<=_70&&fy>=_71&&fy<=_72)||(tx>=_6f&&tx<=_70&&ty>=_71&&ty<=_72)){
jg.drawLine(fx,fy,tx,ty);
}
}
}
jg.paint();
};
wktCanvas.prototype.setWkt=function(wkt,_7d,_7e){
this.renderSegmented=(_7d!=undefined)?_7d:true;
this.clearWkt();
this.route.asWkt=wkt;
this.route.asData=this.parseWKT(this.route.asWkt);
if(_7e==undefined||_7e){
this.tileClient.jumpToExtent(this.route.UTMBBox);
}else{
this.draw(this);
}
return true;
};
wktCanvas.prototype.clearWkt=function(){
this.route={asWkt:undefined,asData:undefined,BBox:this.nullBBox,UTMBBox:new KrakMap.Extent(-Infinity,Infinity,Infinity,-Infinity),segmentExtents:new Array()};
this.routeContainer.innerHTML="";
if(this.circleDrawEnabled){
this.circleDrawEnabled=false;
}
return true;
};
wktCanvas.prototype.enablePrinting=function(){
this.forceFallback=true;
};
wktCanvas.prototype.disablePrinting=function(){
this.forceFallback=false;
};
wktCanvas.prototype.draw=function(rc){
if(rc!=undefined&&rc.route.asWkt!=undefined){
var tc=rc.tileClient;
var mpp=tc.metersPerPixel;
var _82=tc.gridContainer.offset();
var _83=tc.pixelToGeoCoordinate(_82.left,_82.top);
var _84=rc.coords;
var _85=tc.mapGridExtent;
var _86=rc.route.segmentExtents;
var _87=new Array();
for(i=0;i<_84.length;i++){
_87.push(new Array());
if(!(_86[i].left>_85.right||_85.left>_86[i].right||_86[i].bottom>_85.top||_85.bottom>_86[i].top)){
var _88=new KrakMap.Coordinate(0,0);
for(j=0;j<_84[i].length;j++){
var _89=parseFloat(_84[i][j]);
var _8a=parseFloat(_84[i][++j]);
var cur=rc.geoCoordinatesToPixel(_89,_8a,_83,mpp);
if(j==0||j==_84[i].length-1||_88.x!=cur.x||_88.y!=cur.y){
_88=cur;
_87[i].push(cur);
}
}
}
}
rc.route.asData.coords=_87;
rc.route.BBox=rc.getBBox(rc.route.asData);
rc.routeContainer.innerHTML="";
if(!rc.forceFallback&&(rc.svgEnabled()||rc.vmlEnabled())){
var _8c;
if(rc.svgEnabled()){
_8c=rc.wkt2svg(rc.route.asData);
}else{
_8c=rc.wkt2vml(rc.route.asData);
}
rc.routeContainer.appendChild(_8c);
}else{
rc.drawFallback();
}
}
};
wktCanvas.prototype.highlightNone=function(){
if(this.svgEnabled()){
var _8d=document.getElementsByTagNameNS(this.nsSvg,"polyline");
if(_8d){
for(var _8e=0;_8e<_8d.length;_8e++){
_8d[_8e].setAttributeNS(null,"stroke",this.strokeColor);
_8d[_8e].setAttributeNS(null,"stroke-width",this.strokeWeight);
}
}
}else{
var _8d=document.getElementsByTagName("polyline");
if(_8d){
for(var _8e=0;_8e<_8d.length;_8e++){
var _8f=_8d[_8e].childNodes[0];
_8f.setAttribute("color",this.strokeColor);
_8f.setAttribute("weight",this.strokeWeight);
}
}
}
};
wktCanvas.prototype.highlightSegment=function(n){
this.highlightNone();
var _91=document.getElementById(n);
if(_91){
if(this.svgEnabled()){
_91.setAttributeNS(null,"stroke",this.strokeColorHighlighted);
_91.setAttributeNS(null,"stroke-width",this.strokeWeightHighlighted);
}else{
var _92=_91.childNodes[0];
_92.setAttribute("color",this.strokeColorHighlighted);
_92.setAttribute("weight",this.strokeWeightHighlighted);
}
}
};

function coordConvert(){
this.pi=3.14159265358979;
this.sm_a=6378137;
this.sm_b=6356752.314;
this.sm_EccSquared=0.00669437999013;
this.UTMScaleFactor=0.9996;
}
coordConvert.prototype.DegToRad=function(_1){
return (_1/180*this.pi);
};
coordConvert.prototype.RadToDeg=function(_2){
return (_2/this.pi*180);
};
coordConvert.prototype.ArcLengthOfMeridian=function(_3){
var _4,_5,_6,_7,_8,n;
var _a;
n=(this.sm_a-this.sm_b)/(this.sm_a+this.sm_b);
_4=((this.sm_a+this.sm_b)/2)*(1+(Math.pow(n,2)/4)+(Math.pow(n,4)/64));
_5=(-3*n/2)+(9*Math.pow(n,3)/16)+(-3*Math.pow(n,5)/32);
_6=(15*Math.pow(n,2)/16)+(-15*Math.pow(n,4)/32);
_7=(-35*Math.pow(n,3)/48)+(105*Math.pow(n,5)/256);
_8=(315*Math.pow(n,4)/512);
_a=_4*(_3+(_5*Math.sin(2*_3))+(_6*Math.sin(4*_3))+(_7*Math.sin(6*_3))+(_8*Math.sin(8*_3)));
return _a;
};
coordConvert.prototype.UTMCentralMeridian=function(_b){
var _c;
_c=this.DegToRad(-183+(_b*6));
return _c;
};
coordConvert.prototype.FootpointLatitude=function(y){
var y_,_f,_10,_11,_12,_13,n;
var _15;
n=(this.sm_a-this.sm_b)/(this.sm_a+this.sm_b);
_f=((this.sm_a+this.sm_b)/2)*(1+(Math.pow(n,2)/4)+(Math.pow(n,4)/64));
y_=y/_f;
_10=(3*n/2)+(-27*Math.pow(n,3)/32)+(269*Math.pow(n,5)/512);
_11=(21*Math.pow(n,2)/16)+(-55*Math.pow(n,4)/32);
_12=(151*Math.pow(n,3)/96)+(-417*Math.pow(n,5)/128);
_13=(1097*Math.pow(n,4)/512);
_15=y_+(_10*Math.sin(2*y_))+(_11*Math.sin(4*y_))+(_12*Math.sin(6*y_))+(_13*Math.sin(8*y_));
return _15;
};
coordConvert.prototype.MapLatLonToXY=function(phi,_17,_18,xy){
var N,nu2,ep2,t,t2,l;
var _20,_21,_22,_23,_24,_25;
var tmp;
ep2=(Math.pow(this.sm_a,2)-Math.pow(this.sm_b,2))/Math.pow(this.sm_b,2);
nu2=ep2*Math.pow(Math.cos(phi),2);
N=Math.pow(this.sm_a,2)/(this.sm_b*Math.sqrt(1+nu2));
t=Math.tan(phi);
t2=t*t;
tmp=(t2*t2*t2)-Math.pow(t,6);
l=_17-_18;
_20=1-t2+nu2;
_21=5-t2+9*nu2+4*(nu2*nu2);
_22=5-18*t2+(t2*t2)+14*nu2-58*t2*nu2;
_23=61-58*t2+(t2*t2)+270*nu2-330*t2*nu2;
_24=61-479*t2+179*(t2*t2)-(t2*t2*t2);
_25=1385-3111*t2+543*(t2*t2)-(t2*t2*t2);
xy[0]=N*Math.cos(phi)*l+(N/6*Math.pow(Math.cos(phi),3)*_20*Math.pow(l,3))+(N/120*Math.pow(Math.cos(phi),5)*_22*Math.pow(l,5))+(N/5040*Math.pow(Math.cos(phi),7)*_24*Math.pow(l,7));
xy[1]=this.ArcLengthOfMeridian(phi)+(t/2*N*Math.pow(Math.cos(phi),2)*Math.pow(l,2))+(t/24*N*Math.pow(Math.cos(phi),4)*_21*Math.pow(l,4))+(t/720*N*Math.pow(Math.cos(phi),6)*_23*Math.pow(l,6))+(t/40320*N*Math.pow(Math.cos(phi),8)*_25*Math.pow(l,8));
return;
};
coordConvert.prototype.MapXYToLatLon=function(x,y,_29,_2a){
var _2b,Nf,_2d,_2e,ep2,tf,tf2,tf4,cf;
var _34,_35,_36,_37,_38,_39,_3a,_3b;
var _3c,_3d,_3e,_3f,_40,_41,_42;
_2b=this.FootpointLatitude(y);
ep2=(Math.pow(this.sm_a,2)-Math.pow(this.sm_b,2))/Math.pow(this.sm_b,2);
cf=Math.cos(_2b);
_2e=ep2*Math.pow(cf,2);
Nf=Math.pow(this.sm_a,2)/(this.sm_b*Math.sqrt(1+_2e));
_2d=Nf;
tf=Math.tan(_2b);
tf2=tf*tf;
tf4=tf2*tf2;
_34=1/(_2d*cf);
_2d*=Nf;
_35=tf/(2*_2d);
_2d*=Nf;
_36=1/(6*_2d*cf);
_2d*=Nf;
_37=tf/(24*_2d);
_2d*=Nf;
_38=1/(120*_2d*cf);
_2d*=Nf;
_39=tf/(720*_2d);
_2d*=Nf;
_3a=1/(5040*_2d*cf);
_2d*=Nf;
_3b=tf/(40320*_2d);
_3c=-1-_2e;
_3d=-1-2*tf2-_2e;
_3e=5+3*tf2+6*_2e-6*tf2*_2e-3*(_2e*_2e)-9*tf2*(_2e*_2e);
_3f=5+28*tf2+24*tf4+6*_2e+8*tf2*_2e;
_40=-61-90*tf2-45*tf4-107*_2e+162*tf2*_2e;
_41=-61-662*tf2-1320*tf4-720*(tf4*tf2);
_42=1385+3633*tf2+4095*tf4+1575*(tf4*tf2);
_2a[0]=_2b+_35*_3c*(x*x)+_37*_3e*Math.pow(x,4)+_39*_40*Math.pow(x,6)+_3b*_42*Math.pow(x,8);
_2a[1]=_29+_34*x+_36*_3d*Math.pow(x,3)+_38*_3f*Math.pow(x,5)+_3a*_41*Math.pow(x,7);
return;
};
coordConvert.prototype.LatLonToUTMXY=function(lat,lon,_45,xy){
this.MapLatLonToXY(lat,lon,this.UTMCentralMeridian(_45),xy);
xy[0]=xy[0]*this.UTMScaleFactor+500000;
xy[1]=xy[1]*this.UTMScaleFactor;
if(xy[1]<0){
xy[1]=xy[1]+10000000;
}
return _45;
};
coordConvert.prototype.UTMXYToLatLon=function(x,y,_49,_4a,_4b){
var _4c;
x-=500000;
x/=this.UTMScaleFactor;
if(_4a){
y-=10000000;
}
y/=this.UTMScaleFactor;
_4c=this.UTMCentralMeridian(_49);
this.MapXYToLatLon(x,y,_4c,_4b);
return;
};
function btnToUTM_OnClick(){
var xy=new Array(2);
if(isNaN(parseFloat(document.frmConverter.txtLongitude.value))){
alert("Please enter a valid longitude in the lon field.");
return false;
}
lon=parseFloat(document.frmConverter.txtLongitude.value);
if((lon<-180)||(180<=lon)){
alert("The longitude you entered is out of range.  "+"Please enter a number in the range [-180, 180).");
return false;
}
if(isNaN(parseFloat(document.frmConverter.txtLatitude.value))){
alert("Please enter a valid latitude in the lat field.");
return false;
}
lat=parseFloat(document.frmConverter.txtLatitude.value);
if((lat<-90)||(90<lat)){
alert("The latitude you entered is out of range.  "+"Please enter a number in the range [-90, 90].");
return false;
}
zone=Math.floor((lon+180)/6)+1;
zone=this.LatLonToUTMXY(this.DegToRad(lat),this.DegToRad(lon),zone,xy);
document.frmConverter.txtX.value=xy[0];
document.frmConverter.txtY.value=xy[1];
document.frmConverter.txtZone.value=zone;
if(lat<0){
document.frmConverter.rbtnHemisphere[1].checked=true;
}else{
document.frmConverter.rbtnHemisphere[0].checked=true;
}
return true;
}
function btnToGeographic_OnClick(){
latlon=new Array(2);
var x,y,_50,_51;
if(isNaN(parseFloat(document.frmConverter.txtX.value))){
alert("Please enter a valid easting in the x field.");
return false;
}
x=parseFloat(document.frmConverter.txtX.value);
if(isNaN(parseFloat(document.frmConverter.txtY.value))){
alert("Please enter a valid northing in the y field.");
return false;
}
y=parseFloat(document.frmConverter.txtY.value);
if(isNaN(parseInt(document.frmConverter.txtZone.value))){
alert("Please enter a valid UTM zone in the zone field.");
return false;
}
_50=parseFloat(document.frmConverter.txtZone.value);
if((_50<1)||(60<_50)){
alert("The UTM zone you entered is out of range.  "+"Please enter a number in the range [1, 60].");
return false;
}
if(document.frmConverter.rbtnHemisphere[1].checked==true){
_51=true;
}else{
_51=false;
}
this.UTMXYToLatLon(x,y,_50,_51,latlon);
document.frmConverter.txtLongitude.value=this.RadToDeg(latlon[1]);
document.frmConverter.txtLatitude.value=this.RadToDeg(latlon[0]);
return true;
}

var jg_ok,jg_ie,jg_fast,jg_dom,jg_moz;
function _chkDHTM(_1,x,i){
x=_1.document.body||null;
jg_ie=x&&typeof x.insertAdjacentHTML!="undefined"&&_1.document.createElement;
jg_dom=(x&&!jg_ie&&typeof x.appendChild!="undefined"&&typeof _1.document.createRange!="undefined"&&typeof (i=_1.document.createRange()).setStartBefore!="undefined"&&typeof i.createContextualFragment!="undefined");
jg_fast=jg_ie&&_1.document.all&&!_1.opera;
jg_moz=jg_dom&&typeof x.style.MozOpacity!="undefined";
jg_ok=!!(jg_ie||jg_dom);
}
function _pntCnvDom(){
var x=this.wnd.document.createRange();
x.setStartBefore(this.cnv);
x=x.createContextualFragment(jg_fast?this._htmRpc():this.htm);
if(this.cnv){
this.cnv.appendChild(x);
}
this.htm="";
}
function _pntCnvIe(){
if(this.cnv){
this.cnv.insertAdjacentHTML("BeforeEnd",jg_fast?this._htmRpc():this.htm);
}
this.htm="";
}
function _pntDoc(){
this.wnd.document.write(jg_fast?this._htmRpc():this.htm);
this.htm="";
}
function _pntN(){
}
function _mkDiv(x,y,w,h){
this.htm+="<div style=\"position:absolute;"+"left:"+x+"px;"+"top:"+y+"px;"+"width:"+w+"px;"+"height:"+h+"px;"+"clip:rect(0,"+w+"px,"+h+"px,0);"+"background-color:"+this.color+(!jg_moz?";overflow:hidden":"")+";\"></div>";
}
function _mkDivIe(x,y,w,h){
this.htm+="%%"+this.color+";"+x+";"+y+";"+w+";"+h+";";
}
function _mkDivPrt(x,y,w,h){
this.htm+="<div style=\"position:absolute;"+"border-left:"+w+"px solid "+this.color+";"+"left:"+x+"px;"+"top:"+y+"px;"+"width:0px;"+"height:"+h+"px;"+"clip:rect(0,"+w+"px,"+h+"px,0);"+"background-color:"+this.color+(!jg_moz?";overflow:hidden":"")+";\"></div>";
}
var _regex=/%%([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);/g;
function _htmRpc(){
return this.htm.replace(_regex,"<div style=\"overflow:hidden;position:absolute;background-color:"+"$1;left:$2px;top:$3px;width:$4px;height:$5px\"></div>\n");
}
function _htmPrtRpc(){
return this.htm.replace(_regex,"<div style=\"overflow:hidden;position:absolute;background-color:"+"$1;left:$2px;top:$3px;width:$4px;height:$5px;border-left:$4px solid $1\"></div>\n");
}
function _mkLin(x1,y1,x2,y2){
if(x1>x2){
var _x2=x2;
var _y2=y2;
x2=x1;
y2=y1;
x1=_x2;
y1=_y2;
}
var dx=x2-x1,dy=Math.abs(y2-y1),x=x1,y=y1,_1b=(y1>y2)?-1:1;
if(dx>=dy){
var pr=dy<<1,pru=pr-(dx<<1),p=pr-dx,ox=x;
while(dx>0){
--dx;
++x;
if(p>0){
this._mkDiv(ox,y,x-ox,1);
y+=_1b;
p+=pru;
ox=x;
}else{
p+=pr;
}
}
this._mkDiv(ox,y,x2-ox+1,1);
}else{
var pr=dx<<1,pru=pr-(dy<<1),p=pr-dy,oy=y;
if(y2<=y1){
while(dy>0){
--dy;
if(p>0){
this._mkDiv(x++,y,1,oy-y+1);
y+=_1b;
p+=pru;
oy=y;
}else{
y+=_1b;
p+=pr;
}
}
this._mkDiv(x2,y2,1,oy-y2+1);
}else{
while(dy>0){
--dy;
y+=_1b;
if(p>0){
this._mkDiv(x++,oy,1,y-oy);
p+=pru;
oy=y;
}else{
p+=pr;
}
}
this._mkDiv(x2,oy,1,y2-oy+1);
}
}
}
function _mkLin2D(x1,y1,x2,y2){
if(x1>x2){
var _x2=x2;
var _y2=y2;
x2=x1;
y2=y1;
x1=_x2;
y1=_y2;
}
var dx=x2-x1,dy=Math.abs(y2-y1),x=x1,y=y1,_2b=(y1>y2)?-1:1;
var s=this.stroke;
if(dx>=dy){
if(dx>0&&s-3>0){
var _s=(s*dx*Math.sqrt(1+dy*dy/(dx*dx))-dx-(s>>1)*dy)/dx;
_s=(!(s-4)?Math.ceil(_s):Math.round(_s))+1;
}else{
var _s=s;
}
var ad=Math.ceil(s/2);
var pr=dy<<1,pru=pr-(dx<<1),p=pr-dx,ox=x;
while(dx>0){
--dx;
++x;
if(p>0){
this._mkDiv(ox,y,x-ox+ad,_s);
y+=_2b;
p+=pru;
ox=x;
}else{
p+=pr;
}
}
this._mkDiv(ox,y,x2-ox+ad+1,_s);
}else{
if(s-3>0){
var _s=(s*dy*Math.sqrt(1+dx*dx/(dy*dy))-(s>>1)*dx-dy)/dy;
_s=(!(s-4)?Math.ceil(_s):Math.round(_s))+1;
}else{
var _s=s;
}
var ad=Math.round(s/2);
var pr=dx<<1,pru=pr-(dy<<1),p=pr-dy,oy=y;
if(y2<=y1){
++ad;
while(dy>0){
--dy;
if(p>0){
this._mkDiv(x++,y,_s,oy-y+ad);
y+=_2b;
p+=pru;
oy=y;
}else{
y+=_2b;
p+=pr;
}
}
this._mkDiv(x2,y2,_s,oy-y2+ad);
}else{
while(dy>0){
--dy;
y+=_2b;
if(p>0){
this._mkDiv(x++,oy,_s,y-oy+ad);
p+=pru;
oy=y;
}else{
p+=pr;
}
}
this._mkDiv(x2,oy,_s,y2-oy+ad+1);
}
}
}
function _mkLinDott(x1,y1,x2,y2){
if(x1>x2){
var _x2=x2;
var _y2=y2;
x2=x1;
y2=y1;
x1=_x2;
y1=_y2;
}
var dx=x2-x1,dy=Math.abs(y2-y1),x=x1,y=y1,_3e=(y1>y2)?-1:1,drw=true;
if(dx>=dy){
var pr=dy<<1,pru=pr-(dx<<1),p=pr-dx;
while(dx>0){
--dx;
if(drw){
this._mkDiv(x,y,1,1);
}
drw=!drw;
if(p>0){
y+=_3e;
p+=pru;
}else{
p+=pr;
}
++x;
}
}else{
var pr=dx<<1,pru=pr-(dy<<1),p=pr-dy;
while(dy>0){
--dy;
if(drw){
this._mkDiv(x,y,1,1);
}
drw=!drw;
y+=_3e;
if(p>0){
++x;
p+=pru;
}else{
p+=pr;
}
}
}
if(drw){
this._mkDiv(x,y,1,1);
}
}
function _mkOv(_43,top,_45,_46){
var a=(++_45)>>1,b=(++_46)>>1,wod=_45&1,hod=_46&1,cx=_43+a,cy=top+b,x=0,y=b,ox=0,oy=b,aa2=(a*a)<<1,aa4=aa2<<1,bb2=(b*b)<<1,bb4=bb2<<1,st=(aa2>>1)*(1-(b<<1))+bb2,tt=(bb2>>1)-aa2*((b<<1)-1),w,h;
while(y>0){
if(st<0){
st+=bb2*((x<<1)+3);
tt+=bb4*(++x);
}else{
if(tt<0){
st+=bb2*((x<<1)+3)-aa4*(y-1);
tt+=bb4*(++x)-aa2*(((y--)<<1)-3);
w=x-ox;
h=oy-y;
if((w&2)&&(h&2)){
this._mkOvQds(cx,cy,x-2,y+2,1,1,wod,hod);
this._mkOvQds(cx,cy,x-1,y+1,1,1,wod,hod);
}else{
this._mkOvQds(cx,cy,x-1,oy,w,h,wod,hod);
}
ox=x;
oy=y;
}else{
tt-=aa2*((y<<1)-3);
st-=aa4*(--y);
}
}
}
w=a-ox+1;
h=(oy<<1)+hod;
y=cy-oy;
this._mkDiv(cx-a,y,w,h);
this._mkDiv(cx+ox+wod-1,y,w,h);
}
function _mkOv2D(_59,top,_5b,_5c){
var s=this.stroke;
_5b+=s+1;
_5c+=s+1;
var a=_5b>>1,b=_5c>>1,wod=_5b&1,hod=_5c&1,cx=_59+a,cy=top+b,x=0,y=b,aa2=(a*a)<<1,aa4=aa2<<1,bb2=(b*b)<<1,bb4=bb2<<1,st=(aa2>>1)*(1-(b<<1))+bb2,tt=(bb2>>1)-aa2*((b<<1)-1);
if(s-4<0&&(!(s-2)||_5b-51>0&&_5c-51>0)){
var ox=0,oy=b,w,h,pxw;
while(y>0){
if(st<0){
st+=bb2*((x<<1)+3);
tt+=bb4*(++x);
}else{
if(tt<0){
st+=bb2*((x<<1)+3)-aa4*(y-1);
tt+=bb4*(++x)-aa2*(((y--)<<1)-3);
w=x-ox;
h=oy-y;
if(w-1){
pxw=w+1+(s&1);
h=s;
}else{
if(h-1){
pxw=s;
h+=1+(s&1);
}else{
pxw=h=s;
}
}
this._mkOvQds(cx,cy,x-1,oy,pxw,h,wod,hod);
ox=x;
oy=y;
}else{
tt-=aa2*((y<<1)-3);
st-=aa4*(--y);
}
}
}
this._mkDiv(cx-a,cy-oy,s,(oy<<1)+hod);
this._mkDiv(cx+a+wod-s,cy-oy,s,(oy<<1)+hod);
}else{
var _a=(_5b-(s<<1))>>1,_b=(_5c-(s<<1))>>1,_x=0,_y=_b,_75=(_a*_a)<<1,_76=_75<<1,_77=(_b*_b)<<1,_78=_77<<1,_st=(_75>>1)*(1-(_b<<1))+_77,_tt=(_77>>1)-_75*((_b<<1)-1),pxl=new Array(),pxt=new Array(),_7d=new Array();
pxl[0]=0;
pxt[0]=b;
_7d[0]=_b-1;
while(y>0){
if(st<0){
pxl[pxl.length]=x;
pxt[pxt.length]=y;
st+=bb2*((x<<1)+3);
tt+=bb4*(++x);
}else{
if(tt<0){
pxl[pxl.length]=x;
st+=bb2*((x<<1)+3)-aa4*(y-1);
tt+=bb4*(++x)-aa2*(((y--)<<1)-3);
pxt[pxt.length]=y;
}else{
tt-=aa2*((y<<1)-3);
st-=aa4*(--y);
}
}
if(_y>0){
if(_st<0){
_st+=_77*((_x<<1)+3);
_tt+=_78*(++_x);
_7d[_7d.length]=_y-1;
}else{
if(_tt<0){
_st+=_77*((_x<<1)+3)-_76*(_y-1);
_tt+=_78*(++_x)-_75*(((_y--)<<1)-3);
_7d[_7d.length]=_y-1;
}else{
_tt-=_75*((_y<<1)-3);
_st-=_76*(--_y);
_7d[_7d.length-1]--;
}
}
}
}
var ox=-wod,oy=b,_oy=_7d[0],l=pxl.length,w,h;
for(var i=0;i<l;i++){
if(typeof _7d[i]!="undefined"){
if(_7d[i]<_oy||pxt[i]<oy){
x=pxl[i];
this._mkOvQds(cx,cy,x,oy,x-ox,oy-_oy,wod,hod);
ox=x;
oy=pxt[i];
_oy=_7d[i];
}
}else{
x=pxl[i];
this._mkDiv(cx-x,cy-oy,1,(oy<<1)+hod);
this._mkDiv(cx+ox+wod,cy-oy,1,(oy<<1)+hod);
ox=x;
oy=pxt[i];
}
}
this._mkDiv(cx-a,cy-oy,1,(oy<<1)+hod);
this._mkDiv(cx+ox+wod,cy-oy,1,(oy<<1)+hod);
}
}
function _mkOvDott(_81,top,_83,_84){
var a=(++_83)>>1,b=(++_84)>>1,wod=_83&1,hod=_84&1,_89=hod^1,cx=_81+a,cy=top+b,x=0,y=b,aa2=(a*a)<<1,aa4=aa2<<1,bb2=(b*b)<<1,bb4=bb2<<1,st=(aa2>>1)*(1-(b<<1))+bb2,tt=(bb2>>1)-aa2*((b<<1)-1),drw=true;
while(y>0){
if(st<0){
st+=bb2*((x<<1)+3);
tt+=bb4*(++x);
}else{
if(tt<0){
st+=bb2*((x<<1)+3)-aa4*(y-1);
tt+=bb4*(++x)-aa2*(((y--)<<1)-3);
}else{
tt-=aa2*((y<<1)-3);
st-=aa4*(--y);
}
}
if(drw&&y>=_89){
this._mkOvQds(cx,cy,x,y,1,1,wod,hod);
}
drw=!drw;
}
}
function _mkRect(x,y,w,h){
var s=this.stroke;
this._mkDiv(x,y,w,s);
this._mkDiv(x+w,y,s,h);
this._mkDiv(x,y+h,w+s,s);
this._mkDiv(x,y+s,s,h-s);
}
function _mkRectDott(x,y,w,h){
this.drawLine(x,y,x+w,y);
this.drawLine(x+w,y,x+w,y+h);
this.drawLine(x,y+h,x+w,y+h);
this.drawLine(x,y,x,y+h);
}
function jsgFont(){
this.PLAIN="font-weight:normal;";
this.BOLD="font-weight:bold;";
this.ITALIC="font-style:italic;";
this.ITALIC_BOLD=this.ITALIC+this.BOLD;
this.BOLD_ITALIC=this.ITALIC_BOLD;
}
var Font=new jsgFont();
function jsgStroke(){
this.DOTTED=-1;
}
var Stroke=new jsgStroke();
function jsGraphics(cnv,wnd){
this.setColor=function(x){
this.color=x.toLowerCase();
};
this.setStroke=function(x){
this.stroke=x;
if(!(x+1)){
this.drawLine=_mkLinDott;
this._mkOv=_mkOvDott;
this.drawRect=_mkRectDott;
}else{
if(x-1>0){
this.drawLine=_mkLin2D;
this._mkOv=_mkOv2D;
this.drawRect=_mkRect;
}else{
this.drawLine=_mkLin;
this._mkOv=_mkOv;
this.drawRect=_mkRect;
}
}
};
this.setPrintable=function(arg){
this.printable=arg;
if(jg_fast){
this._mkDiv=_mkDivIe;
this._htmRpc=arg?_htmPrtRpc:_htmRpc;
}else{
this._mkDiv=arg?_mkDivPrt:_mkDiv;
}
};
this.setFont=function(fam,sz,sty){
this.ftFam=fam;
this.ftSz=sz;
this.ftSty=sty||Font.PLAIN;
};
this.drawPolyline=this.drawPolyLine=function(x,y){
for(var i=x.length-1;i;){
--i;
this.drawLine(x[i],y[i],x[i+1],y[i+1]);
}
};
this.fillRect=function(x,y,w,h){
this._mkDiv(x,y,w,h);
};
this.drawPolygon=function(x,y){
this.drawPolyline(x,y);
this.drawLine(x[x.length-1],y[x.length-1],x[0],y[0]);
};
this.drawEllipse=this.drawOval=function(x,y,w,h){
this._mkOv(x,y,w,h);
};
this.fillEllipse=this.fillOval=function(_b3,top,w,h){
var a=w>>1,b=h>>1,wod=w&1,hod=h&1,cx=_b3+a,cy=top+b,x=0,y=b,oy=b,aa2=(a*a)<<1,aa4=aa2<<1,bb2=(b*b)<<1,bb4=bb2<<1,st=(aa2>>1)*(1-(b<<1))+bb2,tt=(bb2>>1)-aa2*((b<<1)-1),xl,dw,dh;
if(w){
while(y>0){
if(st<0){
st+=bb2*((x<<1)+3);
tt+=bb4*(++x);
}else{
if(tt<0){
st+=bb2*((x<<1)+3)-aa4*(y-1);
xl=cx-x;
dw=(x<<1)+wod;
tt+=bb4*(++x)-aa2*(((y--)<<1)-3);
dh=oy-y;
this._mkDiv(xl,cy-oy,dw,dh);
this._mkDiv(xl,cy+y+hod,dw,dh);
oy=y;
}else{
tt-=aa2*((y<<1)-3);
st-=aa4*(--y);
}
}
}
}
this._mkDiv(cx-a,cy-oy,w,(oy<<1)+hod);
};
this.fillArc=function(iL,iT,iW,iH,_cd,_ce){
var a=iW>>1,b=iH>>1,_d1=(iW&1)|((iH&1)<<16),cx=iL+a,cy=iT+b,x=0,y=b,ox=x,oy=y,aa2=(a*a)<<1,aa4=aa2<<1,bb2=(b*b)<<1,bb4=bb2<<1,st=(aa2>>1)*(1-(b<<1))+bb2,tt=(bb2>>1)-aa2*((b<<1)-1),_de,_df,_e0,_e1,_e2=(1<<(Math.floor((_cd%=360)/180)<<3))|(2<<(Math.floor((_ce%=360)/180)<<3))|((_cd>=_ce)<<16),_e3=new Array(b+1),_e4=new Array(b+1);
_cd*=Math.PI/180;
_ce*=Math.PI/180;
_de=cx+Math.round(a*Math.cos(_cd));
_df=cy+Math.round(-b*Math.sin(_cd));
_mkLinVirt(_e3,cx,cy,_de,_df);
_e0=cx+Math.round(a*Math.cos(_ce));
_e1=cy+Math.round(-b*Math.sin(_ce));
_mkLinVirt(_e4,cx,cy,_e0,_e1);
while(y>0){
if(st<0){
st+=bb2*((x<<1)+3);
tt+=bb4*(++x);
}else{
if(tt<0){
st+=bb2*((x<<1)+3)-aa4*(y-1);
ox=x;
tt+=bb4*(++x)-aa2*(((y--)<<1)-3);
this._mkArcDiv(ox,y,oy,cx,cy,_d1,_e3,_e4,_e2);
oy=y;
}else{
tt-=aa2*((y<<1)-3);
st-=aa4*(--y);
if(y&&(_e3[y]!=_e3[y-1]||_e4[y]!=_e4[y-1])){
this._mkArcDiv(x,y,oy,cx,cy,_d1,_e3,_e4,_e2);
ox=x;
oy=y;
}
}
}
}
this._mkArcDiv(x,0,oy,cx,cy,_d1,_e3,_e4,_e2);
if(_d1>>16){
if(_e2>>16){
var xl=(_df<=cy||_e1>cy)?(cx-x):cx;
this._mkDiv(xl,cy,x+cx-xl+(_d1&65535),1);
}else{
if((_e2&1)&&_e1>cy){
this._mkDiv(cx-x,cy,x,1);
}
}
}
};
this.fillPolygon=function(_e6,_e7){
var i;
var y;
var _ea,_eb;
var x1,y1;
var x2,y2;
var _f0,_f1;
var _f2;
var n=_e6.length;
if(!n){
return;
}
_ea=_e7[0];
_eb=_e7[0];
for(i=1;i<n;i++){
if(_e7[i]<_ea){
_ea=_e7[i];
}
if(_e7[i]>_eb){
_eb=_e7[i];
}
}
for(y=_ea;y<=_eb;y++){
var _f4=new Array();
_f2=0;
for(i=0;i<n;i++){
if(!i){
_f0=n-1;
_f1=0;
}else{
_f0=i-1;
_f1=i;
}
y1=_e7[_f0];
y2=_e7[_f1];
if(y1<y2){
x1=_e6[_f0];
x2=_e6[_f1];
}else{
if(y1>y2){
y2=_e7[_f0];
y1=_e7[_f1];
x2=_e6[_f0];
x1=_e6[_f1];
}else{
continue;
}
}
if((y>=y1)&&(y<y2)){
_f4[_f2++]=Math.round((y-y1)*(x2-x1)/(y2-y1)+x1);
}else{
if((y==_eb)&&(y>y1)&&(y<=y2)){
_f4[_f2++]=Math.round((y-y1)*(x2-x1)/(y2-y1)+x1);
}
}
}
_f4.sort(_CompInt);
for(i=0;i<_f2;i+=2){
this._mkDiv(_f4[i],y,_f4[i+1]-_f4[i]+1,1);
}
}
};
this.drawString=function(txt,x,y){
this.htm+="<div style=\"position:absolute;white-space:nowrap;"+"left:"+x+"px;"+"top:"+y+"px;"+"font-family:"+this.ftFam+";"+"font-size:"+this.ftSz+";"+"color:"+this.color+";"+this.ftSty+"\">"+txt+"</div>";
};
this.drawStringRect=function(txt,x,y,_fb,_fc){
this.htm+="<div style=\"position:absolute;overflow:hidden;"+"left:"+x+"px;"+"top:"+y+"px;"+"width:"+_fb+"px;"+"text-align:"+_fc+";"+"font-family:"+this.ftFam+";"+"font-size:"+this.ftSz+";"+"color:"+this.color+";"+this.ftSty+"\">"+txt+"</div>";
};
this.drawImage=function(_fd,x,y,w,h,a){
this.htm+="<div style=\"position:absolute;"+"left:"+x+"px;"+"top:"+y+"px;"+(w?("width:"+w+"px;"):"")+(h?("height:"+h+"px;"):"")+"\">"+"<img src=\""+_fd+"\""+(w?(" width=\""+w+"\""):"")+(h?(" height=\""+h+"\""):"")+(a?(" "+a):"")+">"+"</div>";
};
this.clear=function(){
this.htm="";
if(this.cnv){
this.cnv.innerHTML="";
}
};
this._mkOvQds=function(cx,cy,x,y,w,h,wod,hod){
var xl=cx-x,xr=cx+x+wod-w,yt=cy-y,yb=cy+y+hod-h;
if(xr>xl+w){
this._mkDiv(xr,yt,w,h);
this._mkDiv(xr,yb,w,h);
}else{
w=xr-xl+w;
}
this._mkDiv(xl,yt,w,h);
this._mkDiv(xl,yb,w,h);
};
this._mkArcDiv=function(x,y,oy,cx,cy,_114,_115,_116,_117){
var _118=cx+x+(_114&65535),y2,h=oy-y,xl,xr,w;
if(!h){
h=1;
}
x=cx-x;
if(_117&16711680){
y2=cy-y-h;
if(_117&255){
if(_117&2){
xl=Math.max(x,_116[y]);
w=_118-xl;
if(w>0){
this._mkDiv(xl,y2,w,h);
}
}
if(_117&1){
xr=Math.min(_118,_115[y]);
w=xr-x;
if(w>0){
this._mkDiv(x,y2,w,h);
}
}
}else{
this._mkDiv(x,y2,_118-x,h);
}
y2=cy+y+(_114>>16);
if(_117&65280){
if(_117&256){
xl=Math.max(x,_115[y]);
w=_118-xl;
if(w>0){
this._mkDiv(xl,y2,w,h);
}
}
if(_117&512){
xr=Math.min(_118,_116[y]);
w=xr-x;
if(w>0){
this._mkDiv(x,y2,w,h);
}
}
}else{
this._mkDiv(x,y2,_118-x,h);
}
}else{
if(_117&255){
if(_117&2){
xl=Math.max(x,_116[y]);
}else{
xl=x;
}
if(_117&1){
xr=Math.min(_118,_115[y]);
}else{
xr=_118;
}
y2=cy-y-h;
w=xr-xl;
if(w>0){
this._mkDiv(xl,y2,w,h);
}
}
if(_117&65280){
if(_117&256){
xl=Math.max(x,_115[y]);
}else{
xl=x;
}
if(_117&512){
xr=Math.min(_118,_116[y]);
}else{
xr=_118;
}
y2=cy+y+(_114>>16);
w=xr-xl;
if(w>0){
this._mkDiv(xl,y2,w,h);
}
}
}
};
this.setStroke(1);
this.setFont("verdana,geneva,helvetica,sans-serif","12px",Font.PLAIN);
this.color="#000000";
this.htm="";
this.wnd=wnd||window;
if(!jg_ok){
_chkDHTM(this.wnd);
}
if(jg_ok){
if(cnv){
if(typeof (cnv)=="string"){
this.cont=document.all?(this.wnd.document.all[cnv]||null):document.getElementById?(this.wnd.document.getElementById(cnv)||null):null;
}else{
if(cnv==window.document){
this.cont=document.getElementsByTagName("body")[0];
}else{
this.cont=cnv;
}
}
this.cnv=this.wnd.document.createElement("div");
this.cnv.style.fontSize=0;
this.cont.appendChild(this.cnv);
this.paint=jg_dom?_pntCnvDom:_pntCnvIe;
}else{
this.paint=_pntDoc;
}
}else{
this.paint=_pntN;
}
this.setPrintable(false);
}
function _mkLinVirt(aLin,x1,y1,x2,y2){
var dx=Math.abs(x2-x1),dy=Math.abs(y2-y1),x=x1,y=y1,_127=(x1>x2)?-1:1,_128=(y1>y2)?-1:1,p,i=0;
if(dx>=dy){
var pr=dy<<1,pru=pr-(dx<<1);
p=pr-dx;
while(dx>0){
--dx;
if(p>0){
aLin[i++]=x;
y+=_128;
p+=pru;
}else{
p+=pr;
}
x+=_127;
}
}else{
var pr=dx<<1,pru=pr-(dy<<1);
p=pr-dy;
while(dy>0){
--dy;
y+=_128;
aLin[i++]=x;
if(p>0){
x+=_127;
p+=pru;
}else{
p+=pr;
}
}
}
for(var len=aLin.length,i=len-i;i;){
aLin[len-(i--)]=x;
}
}
function _CompInt(x,y){
return (x-y);
}


