var JomsLocal = false;var Joms=new Object();if(JomsLocal){Joms.baseUrl="http://test/";Joms.mapsDomainTemplate="http://mapy{0}.webmapy.cz";Joms.mapsDomainCount=4;Joms.layerDir="http://localhost/planstudio/!!layers/";Joms.servletUrl="http://localhost:8080/omsmap/"}else{Joms.baseUrl="http://api.planstudio.cz/";Joms.mapDir="http://maps.webmapy.cz";Joms.mapsDomainTemplate="http://mapy{0}.webmapy.cz";Joms.mapsDomainCount=4;Joms.layerDir="http://layers.webmapy.cz";Joms.servletUrl="http://tomcat.planstudio.cz:80/omsmap/"}String.prototype.parseJSON=function(){try{return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u\n\r\t]/.test(this.replace(/"(\\.|[^"\\])*"/g,"")))&&eval("("+this+")")}catch(e){return false}};var zXml={useActiveX:(typeof ActiveXObject!="undefined"),useDom:document.implementation&&document.implementation.createDocument,useXmlHttp:(typeof XMLHttpRequest!="undefined")};zXml.ARR_XMLHTTP_VERS=["MSXML2.XmlHttp.6.0","MSXML2.XmlHttp.3.0"];zXml.ARR_DOM_VERS=["MSXML2.DOMDocument.6.0","MSXML2.DOMDocument.3.0"];function zXmlHttp(){}zXmlHttp.createRequest=function(){if(zXml.useActiveX){if(!zXml.XMLHTTP_VER){for(var A=0;A<zXml.ARR_XMLHTTP_VERS.length;A++){try{new ActiveXObject(zXml.ARR_XMLHTTP_VERS[A]);zXml.XMLHTTP_VER=zXml.ARR_XMLHTTP_VERS[A];break}catch(B){}}}if(zXml.XMLHTTP_VER){return new ActiveXObject(zXml.XMLHTTP_VER)}else{throw new Error("Could not create XML HTTP Request.")}}else{if(zXml.useXmlHttp){return new XMLHttpRequest()}else{throw new Error("Your browser doesn't support an XML HTTP Request.")}}};zXmlHttp.isSupported=function(){return zXml.useXmlHttp||zXml.useActiveX};function zXmlDom(){}zXmlDom.createDocument=function(){if(zXml.useDom){var A=document.implementation.createDocument("","",null);A.parseError={valueOf:function(){return this.errorCode},toString:function(){return this.errorCode.toString()}};A.__initError__();A.addEventListener("load",function(){this.__checkForErrors__();this.__changeReadyState__(4)},false);return A}else{if(zXml.useActiveX){if(!zXml.DOM_VER){for(var B=0;B<zXml.ARR_DOM_VERS.length;B++){try{new ActiveXObject(zXml.ARR_DOM_VERS[B]);zXml.DOM_VER=zXml.ARR_DOM_VERS[B];break}catch(C){}}}if(zXml.DOM_VER){return new ActiveXObject(zXml.DOM_VER)}else{throw new Error("Could not create XML DOM document.")}}else{throw new Error("Your browser doesn't support an XML DOM document.")}}};zXmlDom.isSupported=function(){return zXml.useDom||zXml.useActiveX};var oMozDocument=null;if(typeof XMLDocument!="undefined"){oMozDocument=XMLDocument}else{if(typeof Document!="undefined"){oMozDocument=Document}}if(oMozDocument&&!window.opera){oMozDocument.prototype.onreadystatechange=null;oMozDocument.prototype.__changeReadyState__=function(A){this.readyState=A;if(typeof this.onreadystatechange=="function"){this.onreadystatechange()}};oMozDocument.prototype.__initError__=function(){this.parseError.errorCode=0;this.parseError.filepos=-1;this.parseError.line=-1;this.parseError.linepos=-1;this.parseError.reason=null;this.parseError.srcText=null;this.parseError.url=null};oMozDocument.prototype.__checkForErrors__=function(){if(this.documentElement.tagName=="parsererror"){var A=/>([\s\S]*?)Location:([\s\S]*?)Line Number (\d+), Column (\d+):<sourcetext>([\s\S]*?)(?:\-*\^)/;A.test(this.xml);this.parseError.errorCode=-999999;this.parseError.reason=RegExp.$1;this.parseError.url=RegExp.$2;this.parseError.line=parseInt(RegExp.$3);this.parseError.linepos=parseInt(RegExp.$4);this.parseError.srcText=RegExp.$5}};oMozDocument.prototype.loadXML=function(E){this.__initError__();this.__changeReadyState__(1);var B=new DOMParser();var A=B.parseFromString(E,"text/xml");while(this.firstChild){this.removeChild(this.firstChild)}for(var D=0;D<A.childNodes.length;D++){var C=this.importNode(A.childNodes[D],true);this.appendChild(C)}this.__checkForErrors__();this.__changeReadyState__(4)};oMozDocument.prototype.__load__=oMozDocument.prototype.load;oMozDocument.prototype.load=function(A){this.__initError__();this.__changeReadyState__(1);this.__load__(A)}}Joms.Coord=function(A,B){if(A!=undefined){this.x=parseFloat(A)}else{this.x=0}if(B!=undefined){this.y=parseFloat(B)}else{this.y=0}};Joms.Coord.prototype={toString:function(){return"x:"+this.x+",y:"+this.y},fromString:function(B){var A;A=B.split(",");if(A.length!=2){Joms.error("Joms.Coord","Neplatný řetězec souřadnic.");return }this.x=parseFloat(A[0].substr(A[0].indexOf(":")+1));this.y=parseFloat(A[1].substr(A[1].indexOf(":")+1))},clone:function(){return new Joms.Coord(this.x,this.y)},change:function(A,B){this.x=A;this.y=B},add:function(A,B){this.x+=A;this.y+=B},toGpsString:function(){var A=Joms.Convert.UtmToWgs(this.x,this.y);return Joms.deg(A.x,"n")+", "+Joms.deg(A.y,"e")},fromGpsString:function(D){var B=/([ns])*\s*(\d+)[°º\s]+(\d+[\.\d]*)[\'′\s]+(\d+[\.\d]*)[″"\'′\s]*([ns])*[,;\s\t]*([ew])*\s*(\d+)[°º\s]+(\d+[\.\d]*)[\'′\s]+(\d+[\.\d]*)[″"\'′\s]*([ew])*/i;var A=D.match(B);var G,H;var C;var F;if(A!=null){if(A[1]==undefined){F=A[5].toUpperCase()}else{F=A[1].toUpperCase()}C=(F=="S")?-1:1;G=C*(parseFloat(A[2])+(parseFloat(A[3])/60)+(parseFloat(A[4])/3600));if(A[6]==undefined){F=A[10]}else{F=A[6]}C=(F=="W")?-1:1;H=C*(parseFloat(A[7])+(parseFloat(A[8])/60)+(parseFloat(A[9])/3600));var E=Joms.Convert.WgsToUtm(G,H);this.x=E.x;this.y=E.y;return true}return false},fromS42:function(){new Joms.Ajax.Request(this,Joms.dataScript+"?t=c&type=1&x="+this.x+"&y="+this.y,false,function(B){var A=B.split(";");this.x=parseInt(A[0]);this.y=parseInt(A[1])})},fromWgs84:function(){var A=Joms.Convert.WgsToUtm(this.x,this.y);this.x=A.x;this.y=A.y},toWgs84:function(){var A=Joms.Convert.UtmToWgs(this.x,this.y);this.x=A.x;this.y=A.y},fromPx2Unit:function(B){var A=this.clone();A.x=B.px2unitX(this.x);A.y=B.px2unitY(this.y);return A},fromUnit2Px:function(B){var A=this.clone();A.x=B.unit2pxX(this.x);A.y=B.unit2pxY(this.y);return A},distance:function(A){return Math.sqrt((this.x-A.x)*(this.x-A.x)+(this.y-A.y)*(this.y-A.y))}};Joms.Rect=function(B,A){this.setRect(B,A);this.normalize()};Joms.Rect.prototype={lb:null,rt:null,setRect:function(B,A){if(B!=undefined&&A!=undefined){this.lb=B.clone();this.rt=A.clone()}else{if(B!=undefined){this.lb=B.clone();this.rt=B.clone()}else{this.lb=new Joms.Coord(0,0);this.rt=new Joms.Coord(0,0)}}},isInside:function(A){return this.lb.x<=A.x&&A.x<=this.rt.x&&this.lb.y<=A.y&&A.y<=this.rt.y},isIntersecting:function(A){return !(A.rt.x<this.lb.x||this.rt.x<A.lb.x||A.rt.y<this.lb.y||this.rt.y<A.lb.y)},isRectInside:function(A){return this.lb.x<=A.lb.x&&A.rt.x<=this.rt.x&&this.lb.y<=A.lb.y&&A.rt.y<=this.rt.y},normalize:function(){var A;if(this.lb.x>this.rt.x){A=this.rt.x;this.rt.x=this.lb.x;this.lb.x=A}if(this.lb.y>this.rt.y){A=this.rt.y;this.rt.y=this.lb.y;this.lb.y=A}},enlargeRect:function(A){this.lb.x=Math.min(this.lb.x,A.lb.x);this.lb.y=Math.min(this.lb.y,A.lb.y);this.rt.x=Math.max(this.rt.x,A.rt.x);this.rt.y=Math.max(this.rt.y,A.rt.y)},enlargePoint:function(A){this.lb.x=Math.min(this.lb.x,A.x);this.lb.y=Math.min(this.lb.y,A.y);this.rt.x=Math.max(this.rt.x,A.x);this.rt.y=Math.max(this.rt.y,A.y)},toString:function(){return this.lb.x+";"+this.lb.y+";"+this.rt.x+";"+this.rt.y}};function $A(C){if(!C){return[]}if(C.toArray){return C.toArray()}var B=C.length||0,A=new Array(B);while(B--){A[B]=C[B]}return A}Function.prototype.bindAsEventListener=function(){var A=this,C=$A(arguments),B=C.shift();return function(D){return A.apply(B,[D||window.event].concat(C))}};Function.prototype.bind=function(){if(arguments.length<2&&typeof arguments[0]=="undefined"){return this}var A=this,C=$A(arguments),B=C.shift();return function(){return A.apply(B,C.concat($A(arguments)))}};String.prototype.startsWith=function(A){return(this.match("^"+A)==A)};String.prototype.trim=function(A){return A.replace(/^\s\s*/,"").replace(/\s\s*$/,"")};String.prototype.rtrim=function(C,B){var A=new RegExp("["+B+"]*$","ig");return C.replace(A,"")};String.prototype.htmlEntities=function(){var B=this.length;var C="";for(var A=0;A<B;A++){var D=this.charCodeAt(A);if(D==34||D==38||D==39||D==60||D==62||(D>=160&&D<=255)||D==338||D==339||D==352||D==353||D==376||D==402||D==710||D==732||(D>=913&&D<=929)||(D>=931&&D<=937)||(D>=945&&D<=969)||D==977||D==978||D==982||D==8194||D==8195||D==8201||(D>=8204&&D<=8207)||D==8211||D==8212||(D>=8216&&D<=8218)||(D>=8220&&D<=8222)||(D>=8224&&D<=8226)||D==8230||D==8240||D==8242||D==8243||D==8249||D==8250||D==8254||D==8260||D==8364||D==8465||D==8472||D==8476||D==8482||D==8501||(D>=8592&&D<=8596)||D==8629||(D>=8656&&D<=8660)||D==8704||D==8706||D==8707||D==8709||(D>=8711&&D<=8713)||D==8715||D==8719||D==8721||D==8722||D==8727||D==8730||D==8733||D==8734||D==8736||(D>=8743&&D<=8747)||D==8756||D==8764||D==8773||D==8776||D==8800||D==8801||D==8804||D==8805||(D>=8834&&D<=8836)||D==8838||D==8839||D==8853||D==8855||D==8869||D==8901||(D>=8968&&D<=8971)||D==9001||D==9002||D==9674||D==9824||D==9827||D==9829||D==9830){C+="&#"+D+";"}else{C+=this.charAt(A)}}return C};Joms.Event={observers:false,getEvent:function(){var A=arguments[0];A=A?A:window.event;return A},getElement:function(A){var B=Event.getEvent(A);if(!B.currentTarget){B.currentTarget=B.srcElement}return B.currentTarget},addEvent:function(C,B,D,A){A=A||false;if(B=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||C.attachEvent)){B="keydown"}if(typeof C=="string"){C=$(C)}this._observeAndCache(C,B,D,A)},addClickEventId:function(A,B){if(gid(A)!=null){this.addClickEvent(gid(A),B)}},addClickEvent:function(A,B){Event.addEvent(A,"click",B,false);Event.addEvent(A,"click",Event.preventDefault,false)},disableSelect:function(A){if(typeof A.onselectstart!="undefined"){A.onselectstart=function(){return false}}else{if(typeof A.style.MozUserSelect!="undefined"){A.style.MozUserSelect="none"}else{A.onmousedown=function(){return false}}}},removeEvent:function(D,C,B,A){A=A||false;if(C=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||D.detachEvent)){C="keydown"}if(D.removeEventListener){D.removeEventListener(C,B,A)}else{if(D.detachEvent){try{D.detachEvent("on"+C,B)}catch(E){}}}},stopEvent:function(A){var B=Event.getEvent(A);if(browser.client=="ie"&&typeof (clickTracker)!="undefined"&&B.type=="click"){clickTracker.logger()}if(B.stopPropagation){B.stopPropagation()}else{B.cancelBubble=true}},preventDefault:function(A){e=Event.getEvent(A);if(e.preventDefault){e.preventDefault()}else{e.returnValue=false}},_observeAndCache:function(D,C,B,A){if(D.addEventListener){D.addEventListener(C,B,A)}else{if(D.attachEvent){D.attachEvent("on"+C,B)}}},unloadCache:function(){if(!Joms.Event.observers){return }for(var A=0;A<Joms.Event.observers.length;A++){Joms.Event.removeEvent.apply(this,Joms.Event.observers[A]);Joms.Event.observers[A][0]=null}Joms.Event.observers=false},findElement:function(C,B){var A=Joms.Event.getElement(C);while(A.parentNode&&(!A.tagName||(A.tagName.toUpperCase()!=B.toUpperCase()))){A=A.parentNode}return A},isRightClick:function(A){return A.button==2||(browser.client=="saf"&&A.altKey)}};Joms.Event.addEvent(window,"unload",Joms.Event.unloadCache,false);if(window.Event){for(property in Joms.Event){window.Event[property]=Joms.Event[property]}}else{var Event=Joms.Event}Joms.Ajax={requests:new Array(),requestsCount:0,newRequest:function(){var A=this.requests.length;this.requests[A]=zXmlHttp.createRequest();++this.requestsCount;return this.requests[A]},clearRequests:function(){for(var A=0;A<this.requests.length;++A){if(this.requests[A].readyState!=0){this.requests[A].abort()}}Joms.showLoading(false);this.requests=new Array();this.requestsCount=0},requestDone:function(){if(--this.requestsCount<=0){Joms.showLoading(false);this.requestCount=0}}};Joms.Ajax.Request=function(D,A,C,G,F,B){var E=Joms.Ajax.newRequest();if(F==undefined){F="get"}if(B==undefined){B=null}if(C){E.onreadystatechange=function(){try{if(E&&E.readyState==4){if(E.status==200){G.call(D,E.responseText)}Joms.Ajax.requestDone()}}catch(H){Joms.Ajax.requestDone()}}}if(F=="get"){A=A+"&a="+Joms.appId+"&time="+(new Date()).getTime()}else{B=B+"&a="+Joms.appId+"&time="+(new Date()).getTime()}E.open(F,A,C);Joms.showLoading(true);if(F=="post"){E.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}E.send(B);if(!C){G.call(D,E.responseText);Joms.Ajax.requestDone()}this.request=E};Joms.Ajax.Request.prototype={};Joms.Browser=function(){this.getBrowser()};Joms.Browser.prototype={platform:"",client:"",version:"",getPlatform:function(){var A=navigator.userAgent;if(A.indexOf("X11")!=-1){return"lin"}else{if(A.indexOf("Mac")!=-1){return"mac"}else{if(A.indexOf("Win")!=-1){return"win"}else{return"oth"}}}},getClient:function(){var A=navigator.userAgent;if(document.addEventListener&&!window.opera&&(A.indexOf("KHTML")==-1)){return"geck"}else{if(document.addEventListener&&window.opera){return"op"}else{if(document.attachEvent&&!window.opera){return"ie"}else{if(A.indexOf("KHTML")!=-1){if(A.indexOf("Safari")!=-1){return"saf"}else{return"kon"}}else{return"oth"}}}}},getVersion:function(){var C,B,A;A=navigator.userAgent;if(this.client=="ie"){C=A.indexOf("MSIE");B=parseFloat(A.substr(C+5,3));if(B<5.5){return 1}else{if(B<5.9){return 2}else{if(B<6.9){return 3}else{return 4}}}}else{if(this.client=="op"){var D=A.indexOf("Opera");B=A.substr(D+6,5);return parseInt(B,10)>7?1:0}else{if(this.client=="kon"){C=A.indexOf("KHTML/");return parseFloat(A.substr(C+6,4))}else{return 0}}}},isIE:function(){return this.client=="ie"},getBrowser:function(){this.platform=this.getPlatform();this.client=this.getClient();this.version=this.getVersion()},hasPngSupport:function(){if(this.client=="ie"&&this.version<=4){return false}else{return true}}};Joms.UtmWgsConvertor=function(B,A){if(B==undefined){this.zone=33}else{this.zone=B}if(A==undefined){this.utmSouth=false}else{this.utmSouth=A}this.setConstants();this.init()};Joms.UtmWgsConvertor.prototype={PI:Math.PI,HALF_PI:Math.PI*0.5,TWO_PI:Math.PI*2,FORTPI:0.7853981633974483,R2D:57.2957795131,D2R:0.0174532925199,SEC_TO_RAD:0.00000484813681109536,EPSLN:1e-10,MAX_ITER:20,COS_67P5:0.3826834323650898,AD_C:1.0026,PJD_UNKNOWN:0,PJD_3PARAM:1,PJD_7PARAM:2,PJD_GRIDSHIFT:3,PJD_WGS84:4,PJD_NODATUM:5,SRS_WGS84_SEMIMAJOR:6378137,sign:function(A){if(A<0){return(-1)}else{return(1)}},adjust_lon:function(A){A=(Math.abs(A)<this.PI)?A:(A-(this.sign(A)*this.TWO_PI));return A},e0fn:function(A){return(1-0.25*A*(1+A/16*(3+1.25*A)))},e1fn:function(A){return(0.375*A*(1+0.25*A*(1+0.46875*A)))},e2fn:function(A){return(0.05859375*A*A*(1+0.75*A))},e3fn:function(A){return(A*A*A*(35/3072))},mlfn:function(E,D,C,B,A){return(E*A-D*Math.sin(2*A)+C*Math.sin(4*A)-B*Math.sin(6*A))},setConstants:function(){this.a=6378137;this.rf=298.257223563;if(this.rf&&!this.b){this.b=(1-1/this.rf)*this.a}if(Math.abs(this.a-this.b)<this.EPSLN){this.sphere=true}this.a2=this.a*this.a;this.b2=this.b*this.b;this.es=(this.a2-this.b2)/this.a2;this.e=Math.sqrt(this.es);this.ep2=(this.a2-this.b2)/this.b2;if(!this.k0){this.k0=1}},init:function(){this.lat0=0;this.long0=((6*Math.abs(this.zone))-183)*this.D2R;this.x0=500000;this.y0=this.utmSouth?10000000:0;this.k0=0.9996;this.e0=this.e0fn(this.es);this.e1=this.e1fn(this.es);this.e2=this.e2fn(this.es);this.e3=this.e3fn(this.es);this.ml0=this.a*this.mlfn(this.e0,this.e1,this.e2,this.e3,this.lat0)},WgsToUtmCoord:function(A){return this.WgsToUtm(A.x,A.y)},UtmToWgsCoord:function(A){return this.UtmToWgs(A.x,A.y)},WgsToUtm:function(J,A){J=J*this.D2R;A=A*this.D2R;var D=this.adjust_lon(A-this.long0);var B;var O,M;var N=Math.sin(J);var H=Math.cos(J);if(this.sphere){var L=H*Math.sin(D);if((Math.abs(Math.abs(L)-1))<1e-10){alert("tmerc:forward: Point projects into infinity");return(93)}else{O=0.5*this.a*this.k0*Math.log((1+L)/(1-L));B=Math.acos(H*Math.cos(D)/Math.sqrt(1-L*L));if(J<0){B=-B}M=this.a*this.k0*(B-this.lat0)}}else{var G=H*D;var F=Math.pow(G,2);var I=this.ep2*Math.pow(H,2);var K=Math.tan(J);var P=Math.pow(K,2);B=1-this.es*Math.pow(N,2);var C=this.a/Math.sqrt(B);var E=this.a*this.mlfn(this.e0,this.e1,this.e2,this.e3,J);O=this.k0*C*G*(1+F/6*(1-P+I+F/20*(5-18*P+Math.pow(P,2)+72*I-58*this.ep2)))+this.x0;M=this.k0*(E-this.ml0+C*K*(F*(0.5+F/24*(5-P+9*I+4*Math.pow(I,2)+F/30*(61-58*P+Math.pow(P,2)+600*I-330*this.ep2)))))+this.y0}return new Joms.Coord(O,M)},UtmToWgs:function(O,M){var E,C;var Y;var R;var H=6;var G,D;if(this.sphere){var U=Math.exp(O/(this.a*this.k0));var T=0.5*(U-1/U);var W=this.lat0+M/(this.a*this.k0);var S=Math.cos(W);E=Math.sqrt((1-S*S)/(1+T*T));G=Math.asinz(E);if(W<0){G=-G}if((T==0)&&(S==0)){D=this.long0}else{D=this.adjust_lon(Math.atan2(T,S)+this.long0)}}else{var J=O-this.x0;var I=M-this.y0;E=(this.ml0+I/this.k0)/this.a;C=E;for(R=0;;R++){Y=((E+this.e1*Math.sin(2*C)-this.e2*Math.sin(4*C)+this.e3*Math.sin(6*C))/this.e0)-C;C+=Y;if(Math.abs(Y)<=this.EPSLN){break}if(R>=H){alert("tmerc:inverse: Latitude failed to converge");return(95)}}if(Math.abs(C)<this.HALF_PI){var B=Math.sin(C);var Z=Math.cos(C);var K=Math.tan(C);var X=this.ep2*Math.pow(Z,2);var F=Math.pow(X,2);var L=Math.pow(K,2);var A=Math.pow(L,2);E=1-this.es*Math.pow(B,2);var Q=this.a/Math.sqrt(E);var N=Q*(1-this.es)/E;var V=J/(Q*this.k0);var P=Math.pow(V,2);G=C-(Q*K*P/N)*(0.5-P/24*(5+3*L+10*X-4*F-9*this.ep2-P/30*(61+90*L+298*X+45*A-252*this.ep2-3*F)));D=this.adjust_lon(this.long0+(V*(1-P/6*(1+2*L+X-P/20*(5-2*X+28*L-3*F+8*this.ep2+24*A)))/Z))}else{G=this.HALF_PI*this.sign(I);D=this.long0}}return new Joms.Coord(G*this.R2D,D*this.R2D)},convertCoords:function(C,H,G){if(G==undefined){G="utm"}var B="";for(var D=0,A=C.length;D<A;++D){if(B!=""){B+=";"}var F=C[D];B+=F.x+";"+F.y}var E=new Array(C.length);new Joms.Ajax.Request(this,Joms.dataScript,false,function(M){var L,K,I,J;J=M.split(";");for(L=0,K=0,I=C.length;L<I;++L,K+=2){E[L]=new Joms.Coord(J[K],J[K+1])}},"post","t=cm&from="+H+"&to="+G+"&c="+B);return E}};Joms.App=function(C,B,D,A){this.elname=C;this.el=gid(this.elname);if(!this.el){Joms.error("Joms.App","Hlavní element applikace nenalezen.");return }if(typeof B=="undefined"){this.cfg=new Joms.AppConf()}else{this.cfg=B}if(D!=undefined){this.cfg.width=D}if(A!=undefined){this.cfg.height=A}if(!this.cfg.repairMapSize&&(this.cfg.width==null||this.cfg.width==undefined||this.cfg.height==null||this.cfg.height==undefined)){Joms.error("Joms.App","Šířka nebo výška mapy není definována");return }this.initialized=false;this.name="Joms"+C;this.mapWidth=this.cfg.width;this.mapHeight=this.cfg.height;this.resultMouseEvent=this.resultMouse.bindAsEventListener(this);this.hooks=new Joms.Hooks(this);this.bounds=new Object();this.servletContext=new Joms.ServletContext(this)};Joms.App.prototype={map:null,hooks:null,textBox:null,name:null,query:null,zoom:null,mapId:-1,baseMap:-1,events:null,mapWidth:null,mapHeight:null,elname:null,el:null,resultShown:null,initilized:null,bounds:null,appPostObjectGroupChange:function(){return""},appObjectGroupChange:function(A){if(A!=undefined&&A!=""){return"<h2>"+A+"</h2>"}else{return""}},appNoObjectList:function(){return"Pro tuto úroveň nejsou dostupné žádné objekty"},appCloseResult:function(){var A},resultMouseEvent:null,maxScaleWidth:700,servletContext:null,init:function(G,D,A,E){var C;if(this.query&&this.query.vars){if(this.query.vars.map){G=this.query.vars.map}if(this.query.vars.base){E=this.query.vars.base}if(this.query.vars.pos){A=this.query.vars.pos}if(this.query.vars.zoom){D=this.query.vars.zoom}}if(G==undefined){G=Joms.baseMaps[0]}if(D==undefined){D=0}if(E==undefined||E==0||E==""||E==null||E=="undefined"){E=Joms.baseMaps[0]}if(!(G=this.getMapId(G))){Joms.error("Joms.App","Zadán neplatný identifikátor mapy.");return }if(!(E=this.getMapId(E))){Joms.error("Joms.App","Zadán neplatný identifikátor základní mapy.");return }this.baseMap=E;C=cel("div");C.id="map"+this.name;C.className="jomsMapView";this.el.appendChild(C);this.zoom=new Joms.Zoom(this);if(this.cfg.repairMapSize){if(!this.hooks.check("repairMapSize")){Joms.error("Joms.App","repairMapSize hook must be defined if repairMapSize is true in AppConf.")}this.repairMapSize();Event.addEvent(window,"resize",this.repairMapSize.bindAsEventListener(this),false)}else{if(this.mapWidth){this.el.style.width=this.mapWidth+"px"}if(this.mapHeight){this.el.style.height=this.mapHeight+"px"}}this.createMap(G,A,D);this.createCopyright();this.registerEvents();if(Joms.adds!=null&&Joms.adds.length>0){this.adds=new Joms.TextAddArea(this);for(var B=0;B<Joms.adds.length;B++){var F=Joms.adds[B];this.adds.addMapAdd(F.id,F.t,F.u,F.h)}this.adds.mapChanged()}this.textBox=new Joms.TextBox(this);this.initialized=true;this.hooks.call("postInit")},initRect:function(B,A){this.init(A,0,B,A)},getMapId:function(A){if(Joms.maps[A]!=undefined){return Joms.maps[A]}else{if(isInt(A)){if(Joms.maps_r[A]!=undefined){return A}}}return 0},setMapSize:function(B,A){this.mapWidth=B;this.mapHeight=A;this.map.setSize(B,A);this.el.style.width=this.mapWidth+"px";this.el.style.height=this.mapHeight+"px"},createCopyright:function(){var A=cel("div");A.className="jomsCopyright";A.id="jomsCopyright";A.title="Autor aplikace: PLANstudio s.r.o., Matouš Voldřich; Mapy, data a plánovač cest: PLANstudio (http://www.planstudio.cz)";var B="";B+='<a target="_blank" title="Mapy, gps navigace pro pda, pocketpc, palm, pc" href="http://www.smartmaps.cz/">Mapy a aplikace</a>';B+=", (c) ";B+='<a target="_blank" href="http://www.planstudio.cz" title="mapy pro internet, mapové informační systémy pro města, firmy, portály, ...">PLANstudio s.r.o.</a>';A.innerHTML=B;this.el.appendChild(A)},createMap:function(D,C,A){Joms.Ajax.clearRequests();if(this.mapId==D){return }this.hooks.call("appDestroy");if(this.map!=null){this.events.destroy(this.map.el)}this.mapId=D;this.zoom.id=D;this.zoom.loadMapData();if(this.zoom.zoom.length<=A){A=this.zoom.zoom.length-1}if(this.zoom.zoom[0].base_map){this.baseMap=D}var B=new Joms.Map(this,this.name,"map"+this.name);B.init(C,A)},changeMap:function(B,A,C){if(A==undefined){A=0}if(!(B=Joms.maps[B])){Joms.error("Joms.App","Zadán neplatný identifikátor mapy.");return }this.changeApp(B,C,A);this.map.redraw()},changeMapAndPreservePosition:function(A){if(!(A=Joms.maps[A])){Joms.error("Joms.App","Zadán neplatný identifikátor mapy.");return }if(this.compareMapDimensions(A)){this.changeApp(A,this.map.center,this.map.zoom.id)}else{this.changeApp(A,undefined,0)}this.map.redraw()},setBounds:function(C,B,A){if(!(C=Joms.maps[C])){Joms.error("Joms.App","Zadán neplatný identifikátor mapy.");return }this.bounds[C]=new Array(B,A)},changeApp:function(F,E,B,C){var A=this.baseMap,D;if(F==undefined){return }if(B==undefined){B=0}this.hooks.call("appDestroy");this.mapId=F;this.zoom.id=F;this.zoom.loadMapData();if(this.zoom.zoom[0].base_map){this.baseMap=F}if(B>=this.zoom.zoom.length){B=0}this.appChanged(A);if(!E){this.map.setZoom(B);this.map.setMapToCenter()}else{this.map.setPos(E.x,E.y,B,true,C)}this.zoomChanged(this.map)},compareMapDimensions:function(A){var C=Joms.mapLevelCache[this.mapId][0];var B=Joms.mapLevelCache[A][0];if(C.count!=B.count||C.ldx!=B.ldx||C.ldy!=B.ldy||C.rux!=B.rux||C.ruy!=B.ruy){return false}return true},createMapLink:function(){var A=window.location.protocol+"//"+window.location.host+window.location.pathname;if(this.query&&this.query.createUrlParams){A+="?"+this.query.createUrlParams()}return A},zoomChanged:function(B,A){this.hooks.call("zoomChanged",A)},appChanged:function(A){this.hooks.call("appChanged",A)},getLevelFromMppx:function(O,N,K,B){var F=false,M=0,I,L;var D=false;var H,E,C,J;N=parseInt(N);K=parseInt(K);if(B==undefined){B=false}if(Joms.inRange(N,K,this.zoom.mapBorder)){for(E=0,J=this.zoom.zoom.length;E<J;++E){if(Joms.checkMppx(F,O,this.zoom.zoom[E].mppx,B)){F=Math.abs(this.zoom.zoom[E]["mppx"]-O);M=this.zoom.zoom[E]["id"];I="zoom"+this.name+"_"+this.mapId+"_"+this.zoom.zoom[E]["id"];D=true}}}if(N&&K){var A,G;for(H=0,C=this.zoom.outMap.length;H<C;++H){for(E=0,J=this.zoom.mppxs[this.zoom.outMap[H].id].length;E<J;++E){L=this.zoom.mppxs[this.zoom.outMap[H].id][E].mppx;if(Joms.checkMppx(F,O,L,B)){F=Math.abs(L-O);I="zoom"+this.name+"_"+this.zoom.outMap[H].id+"_"+this.zoom.mppxs[this.zoom.outMap[H].id][E].zoom;D=true}}}for(H=0,C=this.zoom.inMap.length;H<C;++H){if(Joms.inRange(N,K,this.zoom.inMap[H].border)){for(E=0,J=this.zoom.mppxs[this.zoom.inMap[H].id].length;E<J;++E){L=this.zoom.mppxs[this.zoom.inMap[H].id][E].mppx;if(Joms.checkMppx(F,O,L,B)){F=Math.abs(L-O);I="zoom"+this.name+"_"+this.zoom.inMap[H].id+"_"+this.zoom.mppxs[this.zoom.inMap[H].id][E].zoom;D=true}}}}return I}else{if(D){return M}else{return 0}}},error:function(C,B,A){this.hooks.call("jomsError",C,B,A)},warning:function(C,B,A){this.hooks.call("jomsWarning",C,B,A)},notice:function(C,B,A){this.hooks.call("jomsNotice",C,B,A)},changeZoom:function(E,G,A,F){var B,D=null,C;if(typeof E!="undefined"){D=E;C=Event.getElement(D);G=C.id}if(typeof G=="undefined"||G==0){this.error(1,"Joms.App","Zadány špatné parametry přiblížení mapy. Pravděpodobně byly zadány špatné souřadnice.");return false}else{B=G.split("_")}if(!A||!F){A=this.map.center.x;F=this.map.center.y}if(B[0]!="zoom"+this.name){return }if(B[1]==this.mapId){this.map.setPos(A,F,B[2])}else{this.changeApp(B[1],new Joms.Coord(A,F),B[2],undefined)}if(D){Event.preventDefault(D)}return true},setMark:function(){if(this.context){this.context.showItem("cm-arrhide")}},hideMark:function(){if(this.context){this.context.hideItem("cm-arrhide")}},registerEvents:function(){if(this.cfg.mapEvents){this.events=this.cfg.mapEvents}else{this.events=new Joms.MapEvents(this)}this.events.init(this.map.el,this.cfg.enableMouseWheel);this.events.initGlogal(this.cfg.enableKeys)},repairMapSize:function(){var A,B;if(this.map&&this.map.fullscreen){B=true}else{B=false}this.hooks.call("repairMapSize",Joms.getPageSize(),B);if(this.map){this.map.setSize(this.mapWidth,this.mapHeight)}this.el.style.width=this.mapWidth+"px";this.el.style.height=this.mapHeight+"px"},appObjectClicked:function(B,A,C){},createResult:function(C,A,B){this.hooks.call("preCreateResult",B);B.innerHTML+="<h2><span>"+C+'</span></h2><div class="cont"><div>'+A+"</div></div>";this.hooks.call("postCreateResult",C,A,B)},showCustomResult:function(B,A,C){B=gid(B);A=gid(A);C=gid(C);if(!B||!A||!C){return }this.hideCustomResult();A.appendChild(B);this.resultShown=new Array(B,C)},hideCustomResult:function(){if(this.resultShown){if(this.resultShown[0]&&this.resultShown[1]){this.resultShown[1].appendChild(this.resultShown[0])}this.resultShown[0]=this.resultShown[1]=undefined}},clearResult:function(){if(this.cfg.routeResult){this.cfg.routeResult.innerHTML=""}if(this.cfg.searchResult){this.cfg.searchResult.innerHTML=""}},closeResult:function(A){this.hideCustomResult();this.clearResult();this.route=null;this.search=null;this.map.hideMark();this.map.hideRoute();this.showCustomResult("normalHelp","search-result","resultPool");this.hooks.call("closeResult",A)},makeSearch:function(C,B,A){this.search=new Joms.Search(this,C,B,A,undefined)},showCrossing:function(A,C,B){this.map.setMark(new Joms.Coord(A,C),true)},msg:function(A,B){alert(A)},resultMouse:function(C){var B=Event.getElement(C);var A;if(browser.client=="ie"){while(B&&B.name!="r-item"){B=B.parentNode}}A=B.id.split("-");if(C.type=="mouseover"){this.map.showArrow(parseInt(A[1]),parseInt(A[2]));if(browser.client=="ie"){B.style.background=resultBg}}else{if(C.type=="mouseout"){this.map.hideArrow();if(browser.client=="ie"){if(B.className.indexOf("sbalovaci")>-1&&B.className.indexOf("isbalovaci")==-1){B.style.background="#dedede"}else{B.style.background=""}}}}},print:function(){var D=this.mapWidth;var A=this.mapHeight;var E="";if(D>screen.width){D=screen.width}if(A>screen.height){A=screen.height}if(this.query){for(var C in this.query.layers){if(!this.query.layers[C]){continue}if(E==""){E+="&layer="}else{E+=","}E+=C}}var B="/?print=1&width="+D+"&height="+A+"&x="+this.map.center.x+"&y="+this.map.center.y+"&zoom="+(this.map.zoom.id+this.map.zoom.first)+"&base="+this.baseMap+"&map="+this.mapId+(this.map.mark&&this.map.mark.isVisible()?"&mark_x="+this.map.mark.position.x+"&mark_y="+this.map.mark.position.y:"")+(this.map.route?"&context="+this.route.params.context:"")+E;window.open(B,"print","width="+(D+50)+",height="+(A+100)+",location=yes,scrollbars=yes,menubar=yes,resizable=yes,left="+10+",top="+10)},printNetmap:function(){var C=this.mapWidth;var J=this.mapHeight;var D="";if(C>screen.width){C=screen.width}if(J>screen.height){J=screen.height}var F="";var E="";if(this.query){for(var G in this.query.layers){if(!this.query.layers[G]){continue}F+=G+",";var I=this.map.getOverlayLayer(G);if(I){E+=I.opacity+","}}}if(F!=""){F="&layer="+F.rtrim(F,",")}if(E!=""){E="&layerOpacity="+E.rtrim(E,",")}var H="";if(this.netmapObjects){H="&voc="+this.netmapObjects.getVisibleCategoryIdList()}var B=this.getServletContext();var A=Joms.getUrlPath()+"print.php?a="+Joms.appId+(B.isValid()?"&context="+B.id:"")+(this.query.isRouteValid()?"&trackId="+this.query.route.id:"")+"&width="+C+"&height="+J+"&x="+this.map.center.x+"&y="+this.map.center.y+"&zoom="+(this.map.zoom.id+this.map.zoom.first)+"&map="+Joms.maps_r[this.mapId]+(this.map.mark&&this.map.mark.isVisible()?"&mark_x="+this.map.mark.position.x+"&mark_y="+this.map.mark.position.y:"")+F+E+H;window.open(A,"print","width="+(C+50)+",height="+(J+100)+",location=yes,scrollbars=yes,menubar=yes,resizable=yes,left="+10+",top="+10)},help:function(){if(!this.hooks.call("preHelp")){return }new Joms.Ajax.Request(this,Joms.dataScript+"?t=h",true,function(A){this.hooks.call("help",A)})},legend:function(){if(!this.hooks.call("preLegend")){return }new Joms.Ajax.Request(this,Joms.dataScript+"?t=le",true,function(A){this.hooks.call("legend",A)})},link:function(){},showLegend:function(A){return false},showHelp:function(A){return false},getLeft:function(A){return A-Joms.findPosX(this.map.cont)-this.map.left},getTop:function(A){return A-Joms.findPosY(this.map.cont)-this.map.top},objectInfo:function(B,A){if(!this.fullBox){return }this.fullBox.show(A);new Joms.Ajax.Request(this,Joms.dataScript+"?t=o&f=f&id="+B,true,function(D){var C=D.split("###");var E=C[0].parseJSON();this.fullBox.setMenu(E[0],E[1]);this.fullBox.setText(C[1])})},isMapMoving:function(){return this.events.moving},showObjectInfo:function(B,A){this.objectInfo(B,A)},startMarkerDrag:function(A){this.events.startMarkerDrag(A)},getServletContext:function(){return this.servletContext}};Joms.AppConf=function(){};Joms.AppConf.prototype={zoomWidth:16,zoomHeight:20,searchResult:null,routeResult:null,loadingBox:null,mapEvents:null,enableKeys:false,enableMouseWheel:true,width:null,height:null,repairMapSize:false,iconCategories:null};Joms.Map=function(B,A,C){this.cont=gid(C);if(!this.cont){Joms.error("Joms.Map","Kritická chyba! Element "+C+" nenalezen.");return }this.app=B;this.app.map=this;this.setSize(this.app.mapWidth,this.app.mapHeight);this.el=cel("div");this.el.style.position="absolute";this.el.style.display="block";this.el.id=A;this.el.className="jomsMap";this.name=A;this.cont.appendChild(this.el);this.center=new Joms.Coord();this.leftBottom=new Joms.Coord();this.leftBottomView=new Joms.Coord();this.rightTop=new Joms.Coord();this.layers=new Object();this.overlayLayers=new Object()};Joms.Map.prototype={leftBottomView:null,viewWidth:null,viewHeight:null,center:null,app:null,name:null,inMap:null,inMaps:null,mark:null,markLayer:null,mapLayer:null,arrow:null,route:false,moving:false,moveObject:null,selectObject:null,app:null,fullscreen:false,opacity:100,layers:null,overlayLayers:null,el:null,zoom:null,timeout:null,realX:null,realY:null,cordX:null,cordY:null,leftBottom:null,rightTop:null,width:null,height:null,ratioX:null,ratioY:null,X:null,Y:null,left:null,top:null,moveDistance:300,positionDiff:null,init:function(A,B){this.addDefaultLayers();if(A!=undefined&&A.lb!=undefined){this.zoomToRect(A)}else{this.setZoom(B);if(A!=undefined&&A.x>=this.zoom.ldx&&A.x<=this.zoom.rux&&A.y>=this.zoom.ldy&&A.y<=this.zoom.ruy){this.setPos(A.x,A.y)}else{this.setMapToCenter()}this.app.appChanged(null)}},moveRight:function(){this.moveTo(this.px2unitX(this.X+this.moveDistance),this.center.y)},moveUpRight:function(){this.moveTo(this.px2unitX(this.X-this.moveDistance),this.px2unitY(this.Y-this.moveDistance))},moveUp:function(){this.moveTo(this.center.x,this.px2unitY(this.Y-this.moveDistance))},moveUpLeft:function(){this.moveTo(this.px2unitX(this.X+this.moveDistance),this.px2unitY(this.Y-this.moveDistance))},moveLeft:function(){this.moveTo(this.px2unitX(this.X-this.moveDistance),this.center.y)},moveDownLeft:function(){this.moveTo(this.px2unitX(this.X+this.moveDistance),this.px2unitY(this.Y+this.moveDistance))},moveDown:function(){this.moveTo(this.center.x,this.px2unitY(this.Y+this.moveDistance))},moveDownRight:function(){this.moveTo(this.px2unitX(this.X-this.moveDistance),this.px2unitY(this.Y+this.moveDistance))},changeZoom:function(A){this.setPos(this.center.x,this.center.y,A)},setMapToCenter:function(){if(this.app.zoom.zoom[0].center_x&&this.app.zoom.zoom[0].center_y){this.setPos(this.app.zoom.zoom[0].center_x,this.app.zoom.zoom[0].center_y)}else{this.setPos(this.zoom.ldx+Math.round(this.cordX/2),this.zoom.ldy+Math.round(this.cordY/2))}},zoomOut:function(A,C,B){if(A==undefined||C==undefined||!isInt(A)||!isInt(C)){A=this.center.x;C=this.center.y}if(B){this.setPos(A,C,this.zoom.id-1,false,new Joms.Coord(A,C))}else{this.setPos(A,C,this.zoom.id-1)}},zoomIn:function(A,C,B){if(A==undefined||C==undefined||!isInt(A)||!isInt(C)){A=this.center.x;C=this.center.y}if(B){this.setPos(A,C,this.zoom.id+1,false,new Joms.Coord(A,C))}else{this.setPos(A,C,this.zoom.id+1)}},setCenter:function(B,A){this.setPos(B.x,B.y,A)},getLayer:function(A){if(!this.layers[A]){return false}return this.layers[A].tiles},zoomToRect:function(E){var D,C;var A;var B;var G=Joms.mapBorder;E.normalize();if(!this.checkRectInMap(E)){this.app.notice(4,"Joms.Map","Čtvercová oblast neleží v oblasti zobrazitelné v mapě.");return }var F=true;if(E.lb.x<G.ldx){E.lb.x=G.ldx+100;F=false}if(E.rt.x>G.phx){E.rt.x=G.phx-100;F=false}if(E.lb.y<G.ldy){E.lb.y=G.ldy+100;F=false}if(E.rt.y>G.phy){E.rt.y=G.phy-100;F=false}if(!F){this.app.notice(3,"Joms.Map","Čtvercová oblast je větší než oblast zobrazitelná v mapě a byla oříznuta.")}D=(E.rt.x-E.lb.x)/this.viewWidth;C=(E.rt.y-E.lb.y)/this.viewHeight;A=new Joms.Coord((E.rt.x-E.lb.x)/2+E.lb.x,(E.lb.y-E.rt.y)/2+E.rt.y);B=this.app.getLevelFromMppx((D>C?D:C),A.x,A.y,true);this.app.changeZoom(undefined,B,A.x,A.y);return F},maxZoom:function(A){if(typeof A=="undefined"){A=this.center}tmp=this.app.getLevelFromMppx(0,A.x,A.y,true);this.app.changeZoom(undefined,tmp,A.x,A.y)},minZoom:function(A){if(typeof A=="undefined"){A=this.center}tmp=this.app.getLevelFromMppx(1000,A.x,A.y,true);this.app.changeZoom(undefined,tmp,A.x,A.y)},disableServletLayer:function(){this.getLayer("servlet").disable()},enableServletLayer:function(){this.getLayer("servlet").enable()},move:function(A){this.moveTo(A.x,A.y)},setMark:function(B,A){if(A){this.move(B)}if(!this.markLayer){var C=new Joms.Icon(Joms.baseUrl+"images/arrow.png",57,46,Joms.IconCenter.BOTTOM_LEFT,"png");this.markLayer=new Joms.CustomLayer(this.app,"mapMark",20);this.mark=new Joms.Marker(this.app,B,C);this.mark.show();this.markLayer.add(this.mark)}else{this.mark.setPosition(B);this.mark.show();this.markLayer.show()}this.app.setMark();this.app.hooks.call("mapChanged")},hideMark:function(){if(!this.markLayer){return }this.mark.hide();this.markLayer.hide();this.app.hideMark();this.app.hooks.call("mapChanged")},setOpacity:function(A){this.opacity=A;this.mapLayer.zoomChanged();this.mapLayer.tiles.setView(this.leftBottomView,false)},switchOpacity:function(){if(this.opacity>=100){this.setOpacity(50)}else{this.setOpacity(100)}},getCurrentZoom:function(){return this.zoom.id},getCurrentIconSize:function(){return this.zoom.icon_width},getCurrentMap:function(){return Joms.maps_r[this.app.mapId]},px2unitX:function(A){return Math.round(A*this.ratioX+this.leftBottom.x)},px2unitY:function(A){return Math.round(this.rightTop.y-A*this.ratioY)},unit2pxX:function(A){return Math.round((A-this.leftBottom.x)/this.ratioX)},unit2pxY:function(A){return Math.round((this.rightTop.y-A)/this.ratioY)},unit2mapX:function(A){return this.unit2pxX(A)+(this.positionDiff?this.positionDiff.x:0)},unit2mapY:function(A){return this.unit2pxY(A)+(this.positionDiff?this.positionDiff.y:0)},addDefaultLayers:function(){this.mapLayer=new Joms.Layer(this,"mapTile",Joms.MapTile,2,true);new Joms.Layer(this,"mapIcons",Joms.IconTile,11,false);new Joms.Layer(this,"servlet",Joms.ServletTile,10,false);new Joms.Layer(this,"mapFlags",Joms.MapFlags,14,false)},entireMap:function(){changeZoom(undefined,gid("zoom").firstChild.id)},setZoom:function(A,D,C){if(!(tmp=this.app.zoom.getZoom(A))){var B;if(this.app.zoom.outMap.length){B=this.app.zoom.outMap[0]}else{B=false}this.checkInMap(D);if(A>=this.app.zoom.zoom.length&&this.inMap&&A-this.app.zoom.zoom.length<this.inMap.count){this.app.changeApp(this.inMap.id,D,A-this.app.zoom.zoom.length,C);return 3}else{if(A<0&&B&&Math.abs(A)<=B.count){this.app.changeApp(B.id,D,B.count+A,C);return 3}}return 0}this.positionDiff=null;this.zoom=tmp;if(this.zoom.digiZoomId!=undefined){this.realX=this.zoom.x_length*this.zoom.digiZoomTileSizeX;this.realY=this.zoom.y_length*this.zoom.digiZoomTileSizeY}else{this.realX=this.zoom.x_length*this.zoom.tile_width;this.realY=this.zoom.y_length*this.zoom.tile_height}this.cordX=this.zoom.rux-this.zoom.ldx;this.cordY=this.zoom.ruy-this.zoom.ldy;this.leftBottom=new Joms.Coord(this.zoom.ldx,this.zoom.ldy);this.rightTop=new Joms.Coord(this.zoom.rux,this.zoom.ruy);this.width=this.realX;this.height=this.realY;this.ratioX=this.cordX/this.realX;this.ratioY=this.cordY/this.realY;return 1},updateLayers:function(A){for(layer in this.layers){if((!this.moveObject&&!this.moving)||this.layers[layer].updateOnMove){this.layers[layer].update(this.leftBottomView,A)}}},setOverlayLayersVisibility:function(B){for(index in this.overlayLayers){var A=this.overlayLayers[index];A.setVisibility(B)}},getOverlayLayer:function(A){if(this.overlayLayers[A]){return this.overlayLayers[A]}},showOverlayLayer:function(A){if(this.overlayLayers[A]){this.overlayLayers[A].setVisibility(true)}},hideOverlayLayer:function(A){if(this.overlayLayers[A]){this.overlayLayers[A].setVisibility(false)}},redraw:function(){for(layer in this.layers){this.layers[layer].zoomChanged();this.layers[layer].update(this.leftBottomView,false)}},checkCoordInMap:function(A){mapDef=Joms.mapBorder;if(A.x<mapDef.ldx){return false}if(A.y<mapDef.ldy){return false}if(A.x>mapDef.phx){return false}if(A.y>mapDef.phy){return false}return true},getViewRect:function(){var A=this.viewWidth/2;var B=this.viewHeight/2;return new Joms.Rect(new Joms.Coord(this.px2unitX(this.X-A),this.px2unitY(this.Y-B)),new Joms.Coord(this.px2unitX(this.X+A),this.px2unitY(this.Y+B)))},getMapsBorderRect:function(){return new Joms.Rect(new Joms.Coord(Joms.mapBorder.ldx,Joms.mapBorder.ldy),new Joms.Coord(Joms.mapBorder.phx,Joms.mapBorder.phy))},checkRectInMap:function(A){mapDef=Joms.mapBorder;if(A.rt.x<mapDef.ldx){return false}if(A.lb.x>mapDef.phx){return false}if(A.lb.y>mapDef.phy){return false}if(A.rt.y<mapDef.ldy){return false}return true},setPos:function(I,H,L,K,C){var B=false,F,J,E;if(!this.checkCoordInMap(new Joms.Coord(I,H))){return }if(this.timeout){window.clearTimeout(this.timeout);this.timeout=false}if(this.app.textBox&&this.app.textBox.visible&&!this.moveObject&&!this.moving){var D,G=true;D=this.app.textBox.position;E=D.fromUnit2Px(this);if(E.x<this.leftBottomView.y||E.x>this.leftBottomView.x+this.viewWidth){G=false}if(E.y>this.leftBottomView.x||E.y<this.leftBottomView.y-this.viewHeight){G=false}if(G){C=D}}if(C){J=new Array(this.X-this.unit2pxX(C.x),this.Y-this.unit2pxY(C.y))}if(!this.zoom||(L!=undefined&&L!=this.zoom.id)||K){if(!this.zoom){F=undefined}else{F="zoom"+this.app.name+"_"+this.app.mapId+"_"+this.zoom.id}B=this.setZoom(L,new Joms.Coord(I,H),C);if(B==3){return }}if(!this.moveObject&&!this.moving&&!Joms.inRange(I,H,this.app.zoom.mapBorder)){var A=this.app.getLevelFromMppx(this.zoom.mppx,I,H);if(A==0){this.app.notice(2,"Joms.Map","No map available for specified coord");return }this.app.changeZoom(undefined,A,I,H);return }if(C){this.center.x=this.px2unitX(this.unit2pxX(this.center.x)-(this.unit2pxX(this.center.x)-this.unit2pxX(C.x)-J[0]));this.center.y=this.px2unitY(this.unit2pxY(this.center.y)-(this.unit2pxY(this.center.y)-this.unit2pxY(C.y)-J[1]))}else{this.center.x=Math.round(I);this.center.y=Math.round(H)}if(E=this.app.bounds[this.app.mapId]){if(this.center.x<E[0].x){this.center.x=E[0].x}if(this.center.y<E[0].y){this.center.y=E[0].y}if(this.center.x>E[1].x){this.center.x=E[1].x}if(this.center.y>E[1].y){this.center.y=E[1].y}}this.X=this.unit2pxX(this.center.x);this.Y=this.unit2pxY(this.center.y);if(this.X>this.realX){this.X=this.realX}if(this.Y>this.realY){this.Y=this.realY}if(this.X<0){this.X=0}if(this.Y<0){this.Y=0}this.leftBottomView=new Joms.Coord(this.X-Math.round(this.viewWidth/2),this.Y+Math.round(this.viewHeight/2));this.left=-this.leftBottomView.x;this.top=-(this.leftBottomView.y-this.viewHeight);this.setStyle();if(B){for(layer in this.layers){this.layers[layer].zoomChanged()}this.app.zoomChanged(this,F)}if(!this.moveObject&&!this.moving){this.updateMap()}else{this.updateLayers(true)}},moveTo:function(B,H,F){var A,G,D,C=false;if(F==undefined){F=1.1}else{F=parseFloat(F)}var E=new Array(B-this.center.x,H-this.center.y);if(Math.abs(this.unit2pxX(B)-this.X)>3*this.viewWidth||Math.abs(this.unit2pxY(H)-this.Y)>3*this.viewHeight){this.setPos(B,H);return }if(Math.abs(E[0])>0.6){D=Math.round(E[0]/20*F);if(D>=Math.abs(E[0])){D=E[0];C=true}A=this.center.x+D}else{C=true;A=this.center.x}if(Math.abs(E[1])>0.6){D=Math.round(E[1]/20*F);if(D>=Math.abs(E[1])){D=E[1]}else{C=false}G=this.center.y+D}else{G=this.center.y}this.moving=true;this.setPos(Math.round(A),Math.round(G),this.zoom.id);this.moving=false;if(C){this.updateMap();this.app.hooks.call("moveToEnded")}else{this.timeout=window.setTimeout(function(){this.moveTo(B,H,F*1.2)}.bind(this),20)}},showArrow:function(A,B){this.arrow=new Joms.Coord(A,B);this.layers.mapArrow.tiles.show(A,B)},hideArrow:function(){this.arrow=null;this.layers.mapArrow.tiles.hide()},addFlag:function(A,B){return this.layers.mapFlags.tiles.add(A,B)},removeFlag:function(A,B){this.layers.mapFlags.tiles.remove(A,B)},removeFlags:function(){this.layers.mapFlags.tiles.removeAll()},showRoute:function(B){if(!this.app.route){return }this.route=true;if(B){var E,D;var A,F;var C;E=(this.app.route.params.x2-this.app.route.params.x1)/this.viewWidth;D=(this.app.route.params.y1-this.app.route.params.y2)/this.viewHeight;A=(this.app.route.params.x2-this.app.route.params.x1)/2+this.app.route.params.x1;F=(this.app.route.params.y1-this.app.route.params.y2)/2+this.app.route.params.y2;C=this.app.getLevelFromMppx((E>D?E:D),A,F,true);this.app.changeZoom(undefined,C,A,F)}this.layers.routeTiles.tiles.show(this.app.route.params.context,this.app.route.params.x1,this.app.route.params.y2,this.app.route.params.x2,this.app.route.params.y1)},hideRoute:function(){this.layers.routeTiles.tiles.hide();this.route=false},updateMap:function(){this.checkInMap(new Joms.Coord(this.center.x,this.center.y));this.updateLayers(false);this.app.hooks.call("mapChanged")},checkInMap:function(D){var B,A;var C=false;this.inMaps=new Array();this.inMap=null;if(D){for(B=0,A=this.app.zoom.inMap.length;B<A;++B){if(D.x>this.app.zoom.inMap[B].ldx&&D.x<this.app.zoom.inMap[B].rux&&D.y>this.app.zoom.inMap[B].ldy&&D.y<this.app.zoom.inMap[B].ruy&&Joms.inRange(D.x,D.y,this.app.zoom.inMap[B].border)){if(!C){this.inMap=this.app.zoom.inMap[B];C=true}this.inMaps.push(this.app.zoom.inMap[B])}}}},setStyle:function(){if(this.positionDiff==null){this.positionDiff=new Joms.Coord(this.left,this.top)}this.el.style.top=this.top-this.positionDiff.y+"px";this.el.style.left=this.left-this.positionDiff.x+"px"},addLeftTop:function(B,A){x=this.X-B;x=this.px2unitX(x);y=this.Y-A;y=this.px2unitY(y);this.setPos(x,y)},switchFullscreen:function(){if(this.fullscreen){this.fullscreen=false;this.app.repairMapSize()}else{this.fullscreen=true;this.app.repairMapSize()}},setSize:function(B,A){var C;C=new Joms.Coord(this.viewWidth-B,this.viewHeight-A);this.viewWidth=B;this.viewHeight=A;this.cont.style.width=this.viewWidth+"px";this.cont.style.height=this.viewHeight+"px";if(this.center!=null){this.setPos(this.px2unitX(this.X-Math.round(C.x/2)),this.px2unitY(this.Y-Math.round(C.y/2)))}}};Joms.Zoom=function(A){this.app=A;this.zoom=new Array();this.inMap=new Array();this.outMap=new Array();this.mppxs=new Object();if(Joms.mapDataCache!=undefined&&Joms.mapDataCache!=null){this.currentMapDataCache=Joms.mapDataCache}else{this.currentMapDataCache=new Object()}};Joms.Zoom.prototype={mapBorder:null,currentMapDataCache:null,loadMapData:function(){if(this.currentMapDataCache[this.app.mapId]!=undefined){var A=this.currentMapDataCache[this.app.mapId];this.setMapDataResponse(A);return }new Joms.Ajax.Request(this,Joms.dataScript+"?t=md&map="+this.app.mapId,false,function(D){if(D!="error"){var C;var B=D.parseJSON();this.currentMapDataCache[B[0]]=B;this.setMapDataResponse(B)}else{Joms.error("Joms.Zoom","Chyba komunikace s databázovým serverem. Zkuste prosím stránku obnovit.")}})},setMapDataResponse:function(E){var A=new Array();var B=new Array();var D;var C;this.zoom=E[1];this.mapBorder=E[2];if(E[3]!="0"){for(C=0;C<E[3].length;C++){D=E[3][C].id;A[D]=Joms.mapLevelCache[D][1]}this.outMap=E[3]}else{this.outMap=new Array()}if(E[4]!="0"){for(C=0;C<E[4].length;C++){D=E[4][C];B[C]=Joms.mapLevelCache[D][0];A[D]=Joms.mapLevelCache[D][1]}this.inMap=B}else{this.inMap=new Array()}this.mppxs=A},getZoom:function(A){if(A=="max"){A=this.zoom.length-1}return(this.zoom[A])?this.zoom[A]:false}};Joms.MapEvents=function(A){this.app=A;this.map=A.map;this.mouseDownEvent=this.mouseDown.bindAsEventListener(this);this.mouseDblclickEvent=this.mouseDblclick.bindAsEventListener(this);this.keyDownEvent=this.keyDown.bindAsEventListener(this);this.mouseMoveEvent=this.mouseMove.bindAsEventListener(this);this.mouseUpEvent=this.mouseUp.bindAsEventListener(this);this.mouseWheelEvent=this.mouseWheel.bindAsEventListener(this);this.endMoveEvent=this.endMove.bindAsEventListener(this)};Joms.MapEvents.prototype={mouseDownEvent:null,mouseDblclickEvent:null,keyDownEvent:null,mouseMoveEvent:null,mouseUpEvent:null,mouseWheelEvent:null,clicked:null,rightClicked:null,lastMouseWheelTime:null,moving:false,zooming:false,showContext:null,mousePos:null,map:null,app:null,init:function(B,A){Event.addEvent(B,"mousedown",this.mouseDownEvent,false);Event.addEvent(B,"dblclick",this.mouseDblclickEvent,false);Event.addEvent(B,"contextmenu",Event.preventDefault,false);Event.addEvent(B,"mouseup",this.mouseUpEvent,false);if(Joms.browser.isIE()){Event.addEvent(B,"onselectstart",Event.preventDefault,false)}if(A==undefined||A){if(window.addEventListener){Event.addEvent(B,"DOMMouseScroll",this.mouseWheelEvent,false)}Event.addEvent(B,"mousewheel",this.mouseWheelEvent,false)}},initGlogal:function(A){Event.addEvent(document,"mousemove",this.mouseMoveEvent,false);if(A==undefined||A){Event.addEvent(document,"keypress",this.keyDownEvent,false)}},destroy:function(A){Event.removeEvent(A,"mousedown",this.mouseDownEvent,false);Event.removeEvent(A,"dblclick",this.mouseDblclickEvent,false);Event.removeEvent(A,"contextmenu",Event.preventDefault,false);Event.removeEvent(A,"mouseup",this.mouseUpEvent,false);if(window.addEventListener){Event.removeEvent(A,"DOMMouseScroll",this.mouseWheelEvent,false)}Event.removeEvent(A,"mousewheel",this.mouseWheelEvent,false);if(Joms.browser.isIE()){Event.removeEvent(A,"onselectstart",Event.preventDefault,false)}Event.removeEvent(document,"keypress",this.keyDownEvent,false);Event.removeEvent(document,"mousemove",this.mouseMoveEvent,false)},onSelectStart:function(A){return false},keyDown:function(D){var C=Event.getElement(D);var B=browser.client=="ie"?C.nodeName.toLowerCase():D.target.nodeName.toLowerCase();var A=D.keyCode?D.keyCode:D.which;if(B=="input"||B=="select"||B=="textarea"||B=="option"){return }switch(A){case 107:case 43:this.map.zoomIn();break;case 109:case 45:this.map.zoomOut();break;case 54:case 102:case 39:this.map.moveRight();break;case 52:case 100:case 37:this.map.moveLeft();break;case 56:case 104:case 38:this.map.moveUp();break;case 50:case 98:case 40:this.map.moveDown();break;case 55:case 103:this.map.moveUpRight();break;case 57:case 105:this.map.moveUpLeft();break;case 49:case 97:this.map.moveDownRight();break;case 51:case 99:if(A==51||browser.klient=="ie"){this.map.moveDownLeft()}break}Event.stopEvent(D)},mouseWheel:function(D){var F;var B=new Date().getTime();if((B-this.lastMouseWheelTime)<500||this.mousePos==null){Event.preventDefault(D);Event.stopEvent(D);return }this.lastMouseWheelTime=B;var C=Event.getElement(D);if(D.wheelDelta){F=D.wheelDelta/120}else{if(D.detail){F=-D.detail/3}}var A=this.map.px2unitX(this.mousePos.x);var E=this.map.px2unitY(this.mousePos.y);if(F>0){this.map.zoomIn(A,E,true)}else{this.map.zoomOut(A,E,true)}this.mousePos=new Joms.Coord(this.map.unit2pxX(A),this.map.unit2pxY(E));Event.preventDefault(D);Event.stopEvent(D)},contextMenu:function(){if(this.showContext&&this.app.context){this.app.hooks.call("preContextMenu",this.app.context,this.showContext);this.app.context.changeDisplay(this.showContext)}this.showContext=null},mouseDown:function(A){if(this.app.context&&this.app.context.display){this.app.context.close()}if(Event.isRightClick(A)){return }if(A.altKey){this.showContext=new Joms.Coord(this.app.getLeft(A.clientX)+Joms.getOffsetX(),this.app.getTop(A.clientY)+Joms.getOffsetY());this.contextMenu();return }if(Joms.browser.client=="op"&&A.ctrlKey){}else{if(A.ctrlKey||A.metaKey||A.shiftKey){this.zooming=true;this.map.el.style.cursor="crosshair"}else{this.moving=true}}Event.stopEvent(A)},endMove:function(A){this.moving=false;if(this.map.moveObject){this.app.hooks.call("mapMoveEnded");this.map.moveObject=null;this.map.el.style.cursor="default";this.map.updateMap()}Event.removeEvent(document,"mouseup",this.endMoveEvent,true);Event.stopEvent(A)},mouseMove:function(C){if(this.markerDrag){this.map.el.style.cursor="drag";var B=new Joms.Coord(this.app.getLeft(C.clientX)+Joms.getOffsetX(),this.app.getTop(C.clientY)+Joms.getOffsetY());B.x-=Math.floor(this.markerDrag.icon.iconDragPos.x);B.y+=Math.floor(this.markerDrag.icon.iconDragPos.y);this.markerDrag.setPosition(new Joms.Coord(this.app.map.px2unitX(B.x),this.app.map.px2unitY(B.y)));Event.stopEvent(C)}else{if(this.moving){if(!this.map.moveObject){this.app.hooks.call("mapMoveStarted");this.map.moveObject=new Joms.Moving(new Joms.Coord(C.clientX,C.clientY));this.map.el.style.cursor="move";Event.addEvent(document,"mouseup",this.endMoveEvent,true)}else{diff=this.map.moveObject.getDifference(C.clientX,C.clientY);this.map.addLeftTop(diff.x,diff.y);this.map.el.style.cursor="move"}Event.stopEvent(C)}else{if(this.zooming){var A=this.app.getLeft(C.clientX)+Joms.getOffsetX();var D=this.app.getTop(C.clientY)+Joms.getOffsetY();if(!this.map.selectObject){this.map.selectObject=new Joms.Select(new Joms.Coord(A,D),this.map)}else{this.map.selectObject.changeSelection(A,D)}Event.stopEvent(C)}else{this.changeMousePos(this.app.getLeft(C.clientX)+Joms.getOffsetX(),this.app.getTop(C.clientY)+Joms.getOffsetY())}}}},mouseUp:function(B){if(browser.client=="ie"&&this.map.moveObject){return }if(this.markerDrag){this.map.el.style.cursor="default";var G=this.markerDrag;this.markerDrag=null;G.dragEnd(B);Event.stopEvent(B);return }var H=new Joms.Coord(this.app.getLeft(B.clientX)+Joms.getOffsetX(),this.app.getTop(B.clientY)+Joms.getOffsetY());var K,J;this.moving=false;this.zooming=false;if(Event.isRightClick(B)){var C=new Date().getTime();if(Math.abs(C-this.rightClicked)<300){K=this.map.px2unitX(H.x);J=this.map.px2unitY(H.y);this.rightClicked=false;this.showContext=false;this.map.zoomOut(K,J);this.changeMousePos(this.app.getLeft(B.clientX)+Joms.getOffsetX(),this.app.getTop(B.clientY)+Joms.getOffsetY());return }else{this.rightClicked=C}if(browser.client!="op"){this.showContext=new Joms.Coord(this.app.getLeft(B.clientX)+Joms.getOffsetX(),this.app.getTop(B.clientY)+Joms.getOffsetY());window.setTimeout(this.contextMenu.bind(this),300)}}else{if(this.map.selectObject){this.map.el.style.cursor="default";if(this.map.selectObject){var E,D,N,I,F,L,A,M=false;K=this.map.px2unitX(this.map.selectObject.left-this.map.positionDiff.x+Math.round(this.map.selectObject.width/2));J=this.map.px2unitY(this.map.selectObject.top-this.map.positionDiff.y+Math.round(this.map.selectObject.height/2));E=this.map.selectObject.width*this.map.zoom.mppx/this.map.viewWidth;D=this.map.selectObject.height*this.map.zoom.mppx/this.map.viewHeight;N=(E+D)/2;this.map.selectObject=this.map.selectObject.destroy();this.app.changeZoom(undefined,this.app.getLevelFromMppx(N,K,J),K,J);this.changeMousePos(this.app.getLeft(B.clientX)+Joms.getOffsetX(),this.app.getTop(B.clientY)+Joms.getOffsetY())}}else{if(browser.client=="kon"){var C=new Date().getTime();if(Math.abs(C-this.clicked)<300){K=this.map.px2unitX(H.x);J=this.map.px2unitY(H.y);this.map.zoomIn(K,J);this.changeMousePos(this.app.getLeft(B.clientX)+Joms.getOffsetX(),this.app.getTop(B.clientY)+Joms.getOffsetY());this.clicked=false}else{this.clicked=C}}}}this.app.hooks.call("mapClicked",H,new Joms.Coord(this.map.px2unitX(H.x),this.map.px2unitY(H.y)),Event.isRightClick(B))},mouseDblclick:function(B){if(browser.client!="kon"){var A=this.app.getLeft(B.clientX)+Joms.getOffsetX();var C=this.app.getTop(B.clientY)+Joms.getOffsetY();A=this.map.px2unitX(A);C=this.map.px2unitY(C);this.map.zoomIn(A,C);this.changeMousePos(this.app.getLeft(B.clientX)+Joms.getOffsetX(),this.app.getTop(B.clientY)+Joms.getOffsetY())}},changeMousePos:function(A,B){if(!this.mousePos){this.mousePos=new Joms.Coord(A,B)}else{this.mousePos.change(A,B)}},startMarkerDrag:function(A){this.markerDrag=A}};Joms.Select=function(B,A){this.map=A;this.el=cel("div");this.el.el=cel("div");this.el.el.style.width="50px";this.el.el.style.height="50px";if(browser.client!="op"&&browser.client!="kon"){this.el.el.style.backgroundColor="black";this.el.el.style.filter="alpha(opacity:33,style=0)";this.el.el.style.KHTMLOpacity=33/100;this.el.el.style.MozOpacity=33/100;this.el.el.style.opacity=33/100}this.startPos=B;this.top=B.y-4+this.map.positionDiff.y;this.left=B.x-10+this.map.positionDiff.x;this.width=0;this.height=0;this.el.style.overflow="hidden";this.el.style.cursor="crosshair";this.el.style.position="absolute";this.el.style.zIndex=50;this.el.id="cut";this.el.style.border="3px solid black";this.setStyle();Event.addEvent(this.el,"mousedown",Event.preventDefault,false);Event.addEvent(this.el,"click",Event.stopEvent,false);Event.addEvent(this.el,"mousemove",Event.preventDefault,false);Event.addEvent(this.el,"mouseover",Event.preventDefault,false);this.el.appendChild(this.el.el);this.map.el.appendChild(this.el)};Joms.Select.prototype={el:null,map:null,startPos:null,top:null,left:null,width:null,height:null,changeSelection:function(A,B){this.width=A-this.startPos.x;this.height=B-this.startPos.y;if(this.width<0){this.left=A+this.map.positionDiff.x-10;this.width=-this.width}if(this.height<0){this.top=B+this.map.positionDiff.y-4;this.height=-this.height}this.setStyle()},setStyle:function(){this.el.style.width=this.width+"px";this.el.style.height=this.height+"px";this.el.el.style.width=this.width+10+"px";this.el.el.style.height=this.height+10+"px";this.el.style.top=this.top+"px";this.el.style.left=this.left+"px"},destroy:function(){Event.removeEvent(this.el,"mousedown",Event.preventDefault,false);Event.removeEvent(this.el,"click",Event.stopEvent,false);Event.removeEvent(this.el,"mousemove",Event.preventDefault,false);Event.removeEvent(this.el,"mouseover",Event.preventDefault,false);this.map.el.removeChild(this.el);return null}};Joms.Moving=function(A){this.startPos=A};Joms.Moving.prototype={startPos:null,getDifference:function(A,C){var B=new Joms.Coord(A-this.startPos.x,C-this.startPos.y);this.startPos.change(A,C);return B}};Joms.ContextMenu=function(A){if(!A){Joms.error("Joms.ContextMenu","Objekt aplikace nebyl definován.");return }this.display=false;this.items=new Object();this.app=A;this.app.context=this;this.app.hooks.register("closeResult",this.clearRoute,this);this.el=cel("div");this.el.id="contextMenu"+this.app.name;this.el.className="jomsContextMenu";this.el.appendChild(cel("ul"));this.app.map.el.appendChild(this.el);this.width=150;this.el.style.width=this.width+"px";this.itemMouseUpEvent=this.itemMouseUp.bindAsEventListener(this)};Joms.ContextMenu.prototype={mapPos:null,display:null,width:null,items:null,app:null,el:null,itemMouseUpEvent:null,addDefaultItems:function(){this.addItem("cm-out","Oddálit mapu",function(){this.app.map.zoomOut(this.mapPos.x,this.mapPos.y)});this.addItem("cm-in","Přiblížit mapu",function(){this.app.map.zoomIn(this.mapPos.x,this.mapPos.y)});this.addItem("cm-center","Vystředit mapu",function(){this.app.map.moveTo(this.mapPos.x,this.mapPos.y)})},addItem:function(E,D,C){var B=cel("li");var A=cel("a");B.id=E+this.app.name;A.innerHTML=D;A.href="";B.appendChild(A);Joms.Event.addEvent(A,"mousedown",Joms.Event.stopEvent,true);Joms.Event.addEvent(A,"click",this.itemMouseUpEvent,true);this.el.firstChild.appendChild(B);this.items[E+this.app.name]=C;this.height=""},addLine:function(){var A=cel("li");A.className="line";A.innerHTML='<img src="'+Joms.blankImage+'" alt="" width="1" height="1" />';this.el.firstChild.appendChild(A)},hideItem:function(B){var A;if(A=gid(B+this.app.name)){A.style.display="none";this.height=""}},showItem:function(B){var A;if(A=gid(B+this.app.name)){A.style.display="block";this.height=""}},open:function(A){var B;B=A.fromUnit2Px(this.app.map);this.changeDisplay(B)},close:function(){this.el.style.display="none";this.display=false},clearItems:function(){var C=this.el.getElementsByTagName("A");var B,A;for(B=0,A=C.length;B<A;++B){Joms.Event.removeEvent(C,"mousedown",Joms.Event.stopEvent,true);Joms.Event.removeEvent(C,"click",this.itemMouseUpEvent,true)}this.el.firstChild.innerHTML=""},changeDisplay:function(A){A=A.clone();this.mapPos=new Joms.Coord(this.app.map.px2unitX(A.x),this.app.map.px2unitY(A.y));this.x=A.x;this.y=A.y;this.setSize();tmp=A.x+this.width;if(tmp>this.app.map.leftBottomView.x+this.app.map.viewWidth-5){A.x-=this.width;A.x-=1}else{A.x+=1}tmp=A.y+this.height;if(tmp>this.app.map.leftBottomView.y-20){A.y-=this.height;A.y-=2}else{A.y-=2}this.el.style.left=A.x+this.app.map.positionDiff.x+"px";this.el.style.top=A.y+this.app.map.positionDiff.y+"px";this.el.style.display="block";this.display=true},setSize:function(){if(!this.height||!this.width){this.el.style.left="0";this.el.style.top="0";this.el.style.display="block";this.height=this.el.offsetHeight;this.el.style.display="none"}},itemMouseUp:function(C){var B=Joms.Event.findElement(C,"li");try{B.blur()}catch(A){}if(!B||!B.id){return }this.x=0;this.y=0;this.items[B.id].call(this);this.close();Joms.Event.preventDefault(C);Joms.Event.stopEvent(C)},addRoute:function(A,C){var B;if(this.app.route){this.app.closeResult()}if((B=this.app.map.addFlag(A,C)>=2)){this.showItem("cm-routesearch")}this.showItem("cm-routedel")},clearRoute:function(){this.app.map.removeFlags();this.hideItem("cm-routesearch");this.hideItem("cm-routedel")},searchRoute:function(){this.hideItem("cm-routesearch");this.hideItem("cm-routedel")}};Joms.Navigator=function(A){this.map=A;this.mouseDownEvent=this.mouseDown.bindAsEventListener(this);this.blockSelectEvent=this.blockSelect.bindAsEventListener(this);this.endSelectEvent=this.endSelect.bindAsEventListener(this);this.blockMoveEvent=this.blockMove.bindAsEventListener(this);this.stopMoveEvent=this.stopMove.bindAsEventListener(this)};Joms.Navigator.prototype={id:null,map:null,ldx:null,ldy:null,rux:null,ruy:null,cordX:null,cordY:null,width:null,height:null,ratioX:null,ratioY:null,mapWidth:null,mapHeight:null,mppx:null,block:null,mouseDownEvent:null,blockSelectEvent:null,endSelectEvent:null,blockMoveEvent:null,endMoveEvent:null,init:function(){new Joms.Ajax.Request(this,Joms.dataScript+"?t=n&map="+this.map.app.mapId,false,function(C){if(C!="error"){var A=C.parseJSON();var D,B=A.type;this.id=A.id;this.ldx=A.ldx;this.ldy=A.ldy;this.rux=A.rux;this.ruy=A.ruy;this.cordX=this.rux-this.ldx;this.cordY=this.ruy-this.ldy;this.width=A.width;this.height=A.height;this.ratioX=this.cordX/this.width;this.ratioY=this.cordY/this.height;this.mapWidth=this.map.viewWidth;this.mapHeight=this.map.viewHeight;this.mppx=(this.cordX/this.width+this.cordY/this.height)/2;if(gid("navigator-img")){gid("navigator").removeChild(gid("navigator-img"))}gid("navigator").innerHTML="";A=cel("img");A.id="navigator-img";A.style.width=this.width+"px";A.style.height=this.height+"px";if(B=="png"){A.src=Joms.blankImage;if(browser.client=="ie"&&browser.version==3){A.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/navigator/"+this.id+".png',sizingMethod='scale')";A.style.zIndex="1000"}else{A.src="/images/navigator/"+this.id+".png"}}else{A.src="/images/navigator/"+this.id+".gif"}A.title="Tažením změníte výběr mapy. Při stisku klávesy CTRL můžete výběr posunout.";A.galleryimg="no";this.el=A;gid("navigator").appendChild(this.el);if(!(D=gid("navigator-block"))){D=cel("div");D.id="navigator-block";D.style.position="absolute";D.style.top="10px";D.style.left="10px";D.style.width="10px";D.style.height="10px";D.style.overflow="hidden";D.style.zIndex=10;D.style.background="transparent";gid("navigator").appendChild(D);this.block=D}Event.addEvent(this.block,"mousedown",this.mouseDownEvent,false);Event.addEvent(this.el,"mousedown",this.mouseDownEvent,false);Event.addEvent(this.el,"contextmenu",Event.preventDefault,false)}else{gid("navigator").innerHTML="Došlo k chybě při dotazu na databázový server. Navigátor nebude funkční.";this.block=false}})},destroy:function(){},hide:function(){gid("navigator").style.display="none"},show:function(){gid("navigator").style.display="block"},viewUpdate:function(A,E){var B;if(!this.block){return }this.rcenterX=this.unit2pxX(A);this.rcenterY=this.unit2pxY(E);this.rwidth=Math.round(this.mapWidth*this.map.zoom.mppx/this.mppx);this.rheight=Math.round(this.mapHeight*this.map.zoom.mppx/this.mppx);var D=Math.round(this.rcenterX-this.rwidth/2+3);var C=Math.round(this.rcenterY-this.rheight/2-0);if(this.rwidth>this.width){B=this.rwidth-this.width;this.rwidth=this.width;D+=Math.floor(B/2);D=5}if(this.rheight>this.height){B=this.rheight-this.height;this.rheight=this.height;C+=Math.floor(B/2)}if(D<0){D=2}if(C<0){C=2}if(D+this.rwidth>this.width){D=this.width-this.rwidth+2;this.rwidth-=6}if(C+this.rheight>this.height){C=this.height-this.rheight+2;this.rheight-=6}this.block.style.width=this.rwidth+"px";this.block.style.height=this.rheight+"px";this.block.style.left=D+"px";this.block.style.top=C+"px"},blockUpdate:function(){var B=Math.round(this.rcenterX-this.rwidth/2)+4;var A=Math.round(this.rcenterY-this.rheight/2)+4;this.block.style.left=B+"px";this.block.style.top=A+"px"},updateMap:function(){this.map.setPos(this.px2unitX(this.rcenterX),this.px2unitY(this.rcenterY))},mouseDown:function(B){var A=Event.getElement(B);if(!A){return }if((A.id=="navigator-block"||browser.client=="ie")&&(B.ctrlKey||e.metaKey)){this.blockStartMove(B)}else{Event.addEvent(this.block,"mousemove",this.blockSelectEvent,false);Event.addEvent(this.el,"mousemove",this.blockSelectEvent,false);Event.addEvent(this.el,"mouseup",this.endSelectEvent,false);Event.addEvent(this.block,"mouseup",this.endSelectEvent,false)}Event.preventDefault(B);Event.stopEvent(B)},blockSelect:function(B){var A=this.getLeft(B.clientX)+getOffsetX();var C=this.getTop(B.clientY)+getOffsetY();if(!this.select){this.select=new this.Select(this.block,A,C);this.el.style.cursor="crosshair"}else{this.select.changeSelection(A,C)}Event.preventDefault(B);Event.stopEvent(B)},endSelect:function(F){this.el.style.cursor="default";Event.removeEvent(this.el,"mousemove",this.blockSelectEvent,false);Event.removeEvent(this.block,"mousemove",this.blockSelectEvent,false);Event.removeEvent(this.el,"mouseup",this.endSelectEvent,false);Event.removeEvent(this.block,"mouseup",this.endSelectEvent,false);if(this.select){var C,B,E,D;C=(Math.abs(this.px2unitX(this.ldx+this.select.width)-this.px2unitX(this.ldx))/this.mapWidth+Math.abs(this.px2unitY(this.ldy+this.select.height)-this.px2unitY(this.ldy))/this.mapHeight)/2;B=this.px2unitX(this.select.left+Math.round(this.select.width/2-4));E=this.px2unitY(this.select.top+Math.round(this.select.height/2-4));this.select=this.select.destroy();D=this.map.app.getLevelFromMppx(C,B,E);if(!D){return }this.map.app.changeZoom(undefined,D,B,E)}else{var A=Math.round(this.px2unitX(this.getLeft(F.clientX)+getOffsetX()));var G=Math.round(this.px2unitY(this.getTop(F.clientY)+getOffsetY()));this.map.setPos(A,G)}Event.stopEvent(F)},blockStartMove:function(A){this.moveX=A.clientX;this.moveY=A.clientY;this.block.style.cursor="move";this.el.style.cursor="move";Event.addEvent(this.block,"mousemove",this.blockMoveEvent,false);Event.addEvent(this.el,"mousemove",this.blockMoveEvent,false);Event.addEvent(this.block,"mouseup",this.stopMoveEvent,false);Event.addEvent(this.el,"mouseup",this.stopMoveEvent,false);Event.preventDefault(A);Event.stopEvent(A)},blockMove:function(B){var A=B.clientX;var C=B.clientY;if((this.rcenterX-this.moveX+A-this.rwidth/2)<0){this.rcenterX=this.rwidth/2}else{if((this.rcenterX-this.moveX+A+this.rwidth/2)>this.width){this.rcenterX=this.width-this.rwidth/2}else{this.rcenterX-=this.moveX-A}}if((this.rcenterY-this.moveY+C-this.rheight/2)<0){this.rcenterY=this.rheight/2}else{if((this.rcenterY-this.moveY+C+this.rheight/2)>this.height){this.rcenterY=this.height-this.rheight/2}else{this.rcenterY-=this.moveY-C}}this.moveX=A;this.moveY=C;this.updateMap();Event.preventDefault(B);Event.stopEvent(B)},stopMove:function(A){this.block.style.cursor="default";this.el.style.cursor="default";Event.removeEvent(this.block,"mousemove",this.blockMoveEvent,false);Event.removeEvent(this.el,"mousemove",this.blockMoveEvent,false);Event.removeEvent(this.block,"mouseup",this.stopMoveEvent,false);Event.removeEvent(this.el,"mouseup",this.stopMoveEvent,false)},px2unitX:function(A){return A*this.ratioX+this.ldx},px2unitY:function(A){return this.ruy-A*this.ratioY},unit2pxX:function(A){return Math.round((A-this.ldx)/this.ratioX)},unit2pxY:function(A){return Math.round((this.ruy-A)/this.ratioY)},Select:function(C,B,A){this.changeSelection=function(D,E){this.width=D-this.start_x+3;this.height=E-this.start_y;if(this.width<0){this.left=D;this.width=-this.width}if(this.height<0){this.top=E;this.height=-this.height}this.setStyle()};this.setStyle=function(){this.el.style.width=this.width+"px";this.el.style.height=this.height+"px";this.el.style.top=this.top+"px";this.el.style.left=this.left+"px"};this.destroy=function(){Event.removeEvent(this.el,"mousedown",Event.preventDefault,false);Event.removeEvent(this.el,"click",Event.stopEvent,false);Event.removeEvent(this.el,"mousemove",Event.preventDefault,false);Event.removeEvent(this.el,"mouseover",Event.preventDefault,false);this.el.style.cursor="default";return false};this.el=C;this.start_x=B;this.start_y=A;this.top=A-4;this.left=B-10;this.width=0;this.height=0;this.el.style.cursor="crosshair";this.el.style.zIndex=50;this.setStyle();Event.addEvent(this.el,"mousedown",Event.preventDefault,false);Event.addEvent(this.el,"click",Event.stopEvent,false);Event.addEvent(this.el,"mousemove",Event.preventDefault,false);Event.addEvent(this.el,"mouseover",Event.preventDefault,false)},getLeft:function(A){return A-findPosX(gid("navigator"))},getTop:function(A){return A-findPosY(gid("navigator"))}};Joms.TitleBox=function(B){var A;if(!B){Joms.error("Joms.TitleBox","Objekt aplikace nebyl definován.");return }this.app=B;this.map=this.app.map;this.app.titleBox=this;this.app.hooks.register("zoomChanged",this.hide,this);this.app.hooks.register("iconMouseOver",this.start,this);this.app.hooks.register("iconMouseOut",this.end,this);this.app.hooks.register("iconClicked",this.end,this);this.waitFor=null;this.visiable=false;this.pos=new Joms.Coord();this.parent=this.map.el;this.mouseMoveEvent=this.mouseMove.bindAsEventListener(this);this.el=cel("div");this.el.id="titleBox"+this.app.name;this.el.className="jomsTitleBox";this.el.style.width="297px";this.el.style.height="60px";this.el.style.display="none";A=cel("div");A.style.width="297px";A.style.height="8px";A.style.fontSize="1px";if(browser.client=="ie"&&browser.version>=3){A.style.background="url("+Joms.blankImage+")";A.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/title-box/top.png',sizingMethod='scale')"}else{A.style.background="url(/images/title-box/top.png)"}this.el.appendChild(A);A=cel("div");A.style.width="297px";A.style.height="50px";if(browser.client=="ie"&&browser.version>=3){A.style.background="url("+Joms.blankImage+")";A.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/title-box/background.png',sizingMethod='scale')"}else{A.style.background="url(/images/title-box/background.png)"}this.el.appendChild(A);this.content=cel("div");this.content.id="titleBoxContent"+this.app.name;this.content.className="jomsTitleBoxContent";A.appendChild(this.content);this.img=cel("img");this.img.style.width="32px";this.img.style.height="32px";this.content.appendChild(this.img);this.text=cel("div");this.content.appendChild(this.text);A=cel("div");A.style.width="297px";A.style.height="8px";A.style.fontSize="1px";if(browser.client=="ie"&&browser.version>=3){A.style.background="url("+Joms.blankImage+")";A.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/title-box/bottom.png',sizingMethod='scale')"}else{A.style.background="url(/images/title-box/bottom.png)"}this.el.appendChild(A);this.parent.appendChild(this.el)};Joms.TitleBox.prototype={pos:null,waitFor:null,app:null,map:null,visible:null,img:null,content:null,text:null,mouseMoveEvent:null,move:null,show:function(B){var C,A;if(B!=this.waitFor||this.visible){return }this.img.src=B.src;this.text.innerHTML="<h2>Nahrávám...</h2>";var A=new Joms.Ajax.Request(this,Joms.dataScript+"?t=o2&id="+(B.id.split("_")[1]),true,function(D){this.text.innerHTML=D});this.setStyle();this.el.style.display="block";this.visible=true},setStyle:function(){var A=this.pos.x,B=this.pos.y;A-=15;B+=10;diff=this.map.leftBottomView.x+this.map.viewWidth-A;if(diff<297){A-=297-diff}diff=this.map.leftBottomView.y-B;if(diff<66){B-=90}this.el.style.left=parseInt(A)+this.map.positionDiff.x+"px";this.el.style.top=parseInt(B)+this.map.positionDiff.y+"px"},hide:function(){this.el.style.display="none";this.visible=false},start:function(B,A){this.waitFor=A;this.pos.change(B.x,B.y);window.setTimeout(function(){this.show(A)}.bind(this),700);Event.addEvent(A,"mousemove",this.mouseMoveEvent,false);this.move=true},end:function(A){this.waitFor=null;this.hide();if(this.move){this.move=false;Event.removeEvent(A,"mousemove",this.mouseMoveEvent,false)}},mouseMove:function(B){var A=this.app.getLeft(B.clientX)+Joms.getOffsetX();var C=this.app.getTop(B.clientY)+Joms.getOffsetY();this.pos.change(A,C);if(this.visible){this.setStyle()}}};Joms.MsgBox=function(B,A){this.closeEvent=this.close.bind(this);this.el=cel("div");this.pg=Joms.getPageSize();this.el.id="msg";this.el.style.width=this.pg.width+"px";this.el.style.height=this.pg.height+"px";this.el.style.top=Joms.getOffsetY()+"px";if(A==undefined){A="Chyba"}this.bg=this.createBg(50);this.msg=this.createMsg(B,A);this.el.appendChild(this.msg);tmp=document.getElementsByTagName("body")[0];tmp.appendChild(this.bg);tmp.appendChild(this.el);Event.addEvent(gid("msg-button"),"click",this.closeEvent,false);gid("msg-button").focus()};Joms.MsgBox.prototype={el:null,pg:null,bg:null,msg:null,closeEvent:null,createMsg:function(C,B){var A=cel("div");A.id="cont";A.style.background="white";A.style.left=(this.pg.width/2-140)+"px";A.style.top=(this.pg.height/2-80)+"px";A.innerHTML='<div id="head">&#0160;'+B+'</div><div id="text">'+C+'</div><div><input type="button" id="msg-button" value="Ok" /></div>';return A},createBg:function(A){var B=cel("div");B.id="msg-bg";B.style.width=this.pg.width+"px";B.style.height=this.pg.height+"px";B.style.top=Joms.getOffsetY()+"px";if(browser.client!="kon"&&browser.client!="op"){B.style.backgroundColor="black";A=(A)?((A==100)?99.999:A):50;B.style.filter="alpha(opacity:"+(A)+",style=0)";B.style.KHTMLOpacity=A/100;B.style.MozOpacity=A/100;B.style.opacity=A/100}else{B.style.background="transparent url(/images/msg-bg.png)"}return B},close:function(){var A=document.getElementsByTagName("body")[0];Event.removeEvent(gid("msg-button"),"click",this.closeEvent,false);A.removeChild(this.bg);A.removeChild(this.el)}};Joms.TextBox=function(){};Joms.TextBox=function(B,A){if(!B){Joms.error("Joms.TextBox","Objekt aplikace nebyl definován.");return }if(typeof A=="undefined"){A=new Joms.TextBoxConf()}this.app=B;this.cfg=A;this.app.textBox=this;this.app.hooks.register("closeResult",this.hide,this);this.app.hooks.register("mapClicked",this.mapClicked,this);this.visible=false;this.animateStep=5;this.maximized=false;this.menuClickedEvent=this.menuClicked.bindAsEventListener(this);this.init();this.app.map.el.appendChild(this.el);Event.addEvent(this.el,"mouseup",Event.stopEvent,false);Event.addEvent(this.el,"mousedown",Event.stopEvent,false);Event.addEvent(this.el,"dblclick",Event.stopEvent,false);Event.addEvent(this.el,"mousewheel",Event.stopEvent,false);Event.addEvent(this.el,"mousemove",Event.stopEvent,false);if(window.addEventListener){Event.addEvent(this.el,"DOMMouseScroll",Event.stopEvent,false)}this.app.hooks.register("zoomChanged",this.zoomChanged,this);this.app.hooks.register("moveToEnded",this.checkMove,this);this.app.hooks.register("mapMoveStarted",this.startMove,this);this.app.hooks.register("mapMoveEnded",this.endMove,this)};Joms.TextBox.prototype={cfg:null,name:null,visible:null,app:null,el:null,table:null,animateStep:null,menuClickedEvent:null,menu:null,elems:null,width:null,height:null,maximized:null,position:null,node:null,maxNode:null,text:null,maxText:null,header:null,moving:false,init:function(){var C,H,I,G,D,A;this.el=cel("div");this.el.id="textBox"+this.app.name;this.el.className="jomsTextBox";this.el.style.display="none";this.table=cel("table");this.table.cellPadding="0";this.table.cellSpacing="0";this.table.style.position="relative";this.table.style.zIndex=2;D=cel("tbody");this.table.appendChild(D);var E=cel("tr");E.style.height="10px";C=cel("td");this.addTransparentImageBackground(C,Joms.baseUrl+"images/"+this.cfg.style+"/left-top.png",10,10);E.appendChild(C);C=cel("td");this.addTransparentImageBackground(C,Joms.baseUrl+"images/"+this.cfg.style+"/top.png",undefined,10,"repeat-x");this.up=C;E.appendChild(C);C=cel("td");this.addTransparentImageBackground(C,Joms.baseUrl+"images/"+this.cfg.style+"/right-top.png",10,10);E.appendChild(C);D.appendChild(E);if(this.cfg.headerHeight>0){var B=cel("tr");B.style.height=this.cfg.headerHeight+"px";C=cel("td");C.innerHTML="&nbsp;";this.addTransparentImageBackground(C,Joms.baseUrl+"images/"+this.cfg.style+"/left.png",10,undefined,"repeat-y");C.style.borderBottom="1px solid #"+this.cfg.borderColor;B.appendChild(C);var F=cel("td");F.style.background="#"+this.cfg.bgColor;B.appendChild(F);this.header=cel("div");this.header.style.background="#"+this.cfg.bgColor;this.header.style.borderBottom="1px solid #"+this.cfg.borderColor;this.header.style.position="relative";F.appendChild(this.header);C=cel("td");C.innerHTML="&nbsp;";this.addTransparentImageBackground(C,Joms.baseUrl+"images/"+this.cfg.style+"/right.png",10,undefined,"repeat-y left");C.style.borderBottom="1px solid #"+this.cfg.borderColor;this.right=C;B.appendChild(C);D.appendChild(B)}H=cel("tr");C=cel("td");this.addTransparentImageBackground(C,Joms.baseUrl+"images/"+this.cfg.style+"/left.png",10,undefined,"repeat-y");this.left=C;H.appendChild(C);C=cel("td");C.style.background=this.cfg.bgColor;H.appendChild(C);this.content=C;C=cel("div");C.style.position="absolute";C.style.width="12px";C.style.height="12px";C.style.right="10px";C.style.fontSize="1px";C.style.top="8px";C.style.zIndex=3;C.style.cursor="pointer";C.style.background='url("'+Joms.baseUrl+'images/object-box/close.png") no-repeat';C.title="Zavřít";Event.addEvent(C,"mouseup",function(){this.hide()}.bind(this),false);this.content.appendChild(C);C=cel("div");C.id="jomsTextBoxMenu";C.className="jomsTextBoxMenu";C.innerHTML="&#160;";C.style.margin="0";C.style.display="none";this.menu=C;this.content.appendChild(C);this.text=cel("div");this.text.style.background="#"+this.cfg.bgColor;this.text.style.padding="5px 5px 5px";this.text.style.overflow=this.cfg.overflowStyle;this.text.style.position="relative";this.content.appendChild(this.text);this.maxText=cel("div");this.maxText.style.padding="5px 5px 5px";this.text.style.background="#"+this.cfg.bgColor;this.maxText.style.overflow=this.cfg.overflowStyle;this.maxText.style.position="relative";this.maxText.style.display="none";this.content.appendChild(this.maxText);C=cel("td");this.addTransparentImageBackground(C,Joms.baseUrl+"images/"+this.cfg.style+"/right.png",10,undefined,"repeat-y left");this.right=C;H.appendChild(C);D.appendChild(H);if(this.cfg.footerHeight>0){G=cel("tr");C=cel("td");C.innerHTML="&nbsp;";C.style.borderTop="1px solid #"+this.cfg.borderColor;this.addTransparentImageBackground(C,Joms.baseUrl+"images/"+this.cfg.style+"/left-ft.png",10,undefined,"repeat-y");G.appendChild(C);C=cel("td");C.style.borderTop="1px solid #"+this.cfg.borderColor;C.style.background="#"+this.cfg.footerBgColor;this.footer=cel("div");this.footer.style.height=this.cfg.footerHeight+"px";this.footer.className="jomsTextBoxFooter";this.footer.style.background="#"+this.cfg.footerBgColor;C.appendChild(this.footer);G.appendChild(C);this.footer.innerHTML="";C=cel("td");C.innerHTML="&nbsp;";C.style.borderTop="1px solid #"+this.cfg.borderColor;this.addTransparentImageBackground(C,Joms.baseUrl+"images/"+this.cfg.style+"/right-ft.png",10,undefined,"repeat-y");G.appendChild(C);D.appendChild(G)}I=cel("tr");I.style.height="10px";C=cel("td");this.addTransparentImageBackground(C,Joms.baseUrl+"images/"+this.cfg.style+"/left-bottom.png",10,10);I.appendChild(C);C=cel("td");this.addTransparentImageBackground(C,Joms.baseUrl+"images/"+this.cfg.style+"/bottom.png",undefined,10,"repeat-x");I.appendChild(C);C=cel("td");this.addTransparentImageBackground(C,Joms.baseUrl+"images/"+this.cfg.style+"/right-bottom.png",10,10);I.appendChild(C);D.appendChild(I);this.el.appendChild(this.table);C=cel("div");this.addTransparentImageBackground(C,Joms.baseUrl+"images/"+this.cfg.style+"/zub.png",63,58);C.style.position="relative";C.style.top="-1px";C.style.left="25px";C.style.zIndex=2;this.el.appendChild(C);if(this.cfg.showShade){C=cel("div");this.addTransparentImageBackground(C,Joms.baseUrl+"images/"+this.cfg.style+"/shade.png",405,99);C.style.position="relative";C.style.top="-99px";C.style.left="15px";C.style.zIndex=1}this.el.appendChild(C)},addTransparentImageBackground:function(C,E,B,A,D){if(B!=undefined&&B>0){C.width=B;C.style.width=B+"px"}if(A!=undefined&&A>0){C.height=A;C.style.height=A+"px"}if(D==undefined){D="no-repeat"}C.style.fontSize="1px";if(!Joms.browser.hasPngSupport()){C.style.background="url("+Joms.blankImage+")";C.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+E+'",sizingMethod="scale")'}else{C.style.background='url("'+E+'") '+D}},mapClicked:function(B,A){if(this.visible){if(this.mapClickHandler){this.mapClickHandler.call(this,A)}else{this.hide()}}},setSize:function(B){var C=false,A=false;if(!this.visible){return }if(!this.cfg.maxWidth||this.cfg.maxWidth>(this.app.mapWidth-20)){this.cfg.maxWidth=this.app.mapWidth-20}if(!this.cfg.maxHeight||this.cfg.maxHeight>(this.app.mapHeight-25)){this.cfg.maxHeight=this.app.mapHeight-25}if(this.cfg.width){this.width=this.cfg.width;C=true}if(this.cfg.height){this.height=this.cfg.height;A=true}if(!this.maximized){if(!C){if(this.el.offsetWidth+26>this.cfg.maxWidth){this.width=this.cfg.maxWidth}else{this.width=this.el.offsetWidth+26}if(this.width<this.cfg.minWidth){this.width=this.cfg.minWidth}}this.el.style.width=this.width+"px";this.maxText.style.width=this.text.style.width=(this.width-30)+"px";if(!A){if(this.el.offsetHeight-60>this.cfg.maxHeight){this.height=this.cfg.maxHeight}else{this.height=this.el.offsetHeight-60}if(this.height<this.cfg.minHeight){this.height=this.cfg.minHeight}}this.el.style.height=this.height+"px";this.maxText.style.height=this.text.style.height=(this.height-30)+"px"}else{this.width=Math.round(this.app.mapWidth*B/100);this.height=Math.round(this.app.mapHeight*B*0.8/100)-30;this.el.style.width=this.width+"px";this.maxText.style.width=this.text.style.width=(this.width-30)+"px";this.el.style.height=this.height+"px";this.maxText.style.height=this.text.style.height=(this.height-30)+"px"}},getBubbleHeight:function(){return(this.height+60+this.cfg.footerHeight+this.cfg.headerHeight)},setPosition:function(D){if(typeof D=="undefined"){D=true}var B,E,A;var C=this.getBubbleHeight();A=this.position.fromUnit2Px(this.app.map);E=A.y-this.getBubbleHeight();B=A.x-27;this.el.style.left=parseInt(B)+this.app.map.positionDiff.x+"px";this.el.style.top=parseInt(E)+this.app.map.positionDiff.y+"px";if(D){D=false;B=B+this.width;if(B>this.app.map.leftBottomView.x+this.app.map.viewWidth-this.cfg.moveOffset[1]){B=B-(this.app.map.leftBottomView.x+this.app.map.viewWidth-this.cfg.moveOffset[1]);B=this.app.map.X+B;D=true}else{if(B-this.width<this.app.map.leftBottomView.x+this.cfg.moveOffset[3]){B=B-this.width-(this.app.map.leftBottomView.x+this.cfg.moveOffset[3]);B=this.app.map.X+B;D=true}else{B=this.app.map.X}}if(E<this.app.map.leftBottomView.y-this.app.map.viewHeight+this.cfg.moveOffset[0]){E=(this.app.map.leftBottomView.y-this.app.map.viewHeight+this.cfg.moveOffset[0])-E;E=this.app.map.Y-E;D=true}else{if(E>this.app.map.leftBottomView.y-this.height-this.cfg.moveOffset[2]){E=(this.app.map.leftBottomView.y-this.height-this.cfg.moveOffset[2])-E;E=this.app.map.Y-E;D=true}else{E=this.app.map.Y}}if(D){this.moving=true;this.startMove();window.setTimeout(function(){this.app.map.moveTo(this.app.map.px2unitX(B),this.app.map.px2unitY(E))}.bind(this),100)}}},startMove:function(){this.maxText.style.overflow=this.text.style.overflow="hidden";var A=Joms.getElementsByClassName(this.text,"div","jomsTextBoxTabContent");for(var B=0;B<A.length;B++){A[B].style.overflow="hidden";A[B].style.paddingRight="18px"}},endMove:function(){this.maxText.style.overflow=this.text.style.overflow=this.cfg.overflowStyle;var A=Joms.getElementsByClassName(this.text,"div","jomsTextBoxTabContent");for(var B=0;B<A.length;B++){A[B].style.overflow="auto";A[B].style.paddingRight="0px"}},checkMove:function(){if(this.moving){this.moving=false;this.endMove()}},clearPosition:function(){this.el.style.left="-5000px";this.el.style.top="-5000px"},zoomChanged:function(){if(this.visible){this.setPosition(false)}},showBox:function(A,B){if(typeof B=="undefined"){B=true}if(this.visible){this.hide()}this.text.scrollTop=0;this.maxText.scrollTop=0;this.position=A;this.clearPosition();this.el.style.display="block";this.visible=true;this.setSize();this.setPosition(B);this.text.style.overflow="auto"},setMenu:function(E,D){var F=cel("ul");F.id="text-box-menu-ul";if(this.menu.firstChild){this.menu.removeChild(this.menu.firstChild)}for(var C=0;C<E.length;++C){var B=cel("li"),A=cel("a");A.innerHTML=E[C];if(C==0){A.className="a"}A.id="text-box-menu_"+D[C];A.href="";Event.addEvent(A,"click",this.menuClickedEvent,false);Event.addEvent(A,"click",Event.preventDefault,false);B.appendChild(A);F.appendChild(B)}this.elems=D;this.menu.appendChild(F)},menuClicked:function(D){var C=Event.getElement(D);var E=C.id.split("_")[1];var B;if(!E){return }if(!(B=gid("text-box-menu-ul"))){return }for(var A=0;A<B.childNodes.length;++A){B.childNodes[A].firstChild.className=""}C.className="a";C.blur();this.hideElements();if(B=gid(E)){B.style.display="block"}this.setSize()},maximize:function(A){this.maximized=true;this.setSize(A);this.text.style.display="none";this.menu.style.display="block";this.maxText.style.display="block";this.setPosition()},restore:function(){this.maximized=false;this.setSize();this.menu.style.display="none";this.maxText.style.display="none";this.text.style.display="block";this.setPosition()},hideElements:function(){for(var A=0;A<this.elems.length;++A){if(tmp=gid(this.elems[A])){tmp.style.display="none"}}},show:function(A,D,B,C){if(A==undefined||A.x==undefined||A.y==undefined){Joms.error("Joms.TextBox","position param must be Joms.Coord");return }if(this.visible){this.hide()}if(D!=undefined){this.setText(D)}if(B!=undefined){this.setFooterText(B)}if(C!=undefined){this.setHeaderText(C)}this.showBox(A)},setHeaderText:function(A){if(this.header){this.header.innerHTML=A}},setFooterText:function(A){if(this.footer){this.footer.innerHTML=A}},setText:function(B){if(typeof B=="object"&&B.nodeType==1){var A=B.cloneNode(true);this.text.appendChild(A);if(this.node!=null){this.text.removeChild(this.node)}this.node=A}else{this.text.innerHTML=B}},setMaxText:function(A){if(typeof A=="object"&&A.nodeType==1){this.maxNode=A.cloneNode(true);this.maxText.appendChild(this.maxNode)}else{this.maxText.innerHTML=A}},setHeader:function(B,A){this.header.innerHTML="<h2>"+B+""+(A?",</h2> <h3>"+A+"</h3>":"</h2>")},hide:function(){var A;if(!this.visible){return }this.clearPosition();this.el.style.width="auto";this.el.style.height="auto";this.maxText.style.width=this.text.style.width="auto";this.maxText.style.height=this.text.style.height="auto";this.maxText.style.overflow=this.text.style.overflow="hidden";this.text.style.display="block";this.maxText.style.display="none";this.el.style.display="none";this.visible=false;this.maximized=false;this.name=null;if(this.node){this.text.removeChild(this.node);this.node=null}if(this.maxNode){this.maxText.removeChild(this.maxNode);this.maxNode=null}if(this.menu.firstChild){this.menu.removeChild(this.menu.firstChild)}}};Joms.TextBoxConf=function(){};Joms.TextBoxConf.prototype={maxWidth:null,minWidth:null,maxHeight:null,minHeight:null,width:null,height:null,headerHeight:0,footerHeight:0,moveOffset:Array(20,20,50,20),style:"text-box",footerBgColor:"ffffff",borderColor:"ffffff",bgColor:"ffffff",overflowStyle:"auto",showShade:false};Joms.Hooks=function(){};Joms.Hooks=function(A){this.app=A;this.hook=new Object()};Joms.Hooks.prototype={app:null,hook:null,register:function(A,C,B){if(!C){Joms.error("Joms.Hooks",'Callback pro hook "'+A+'" nebyl definován.')}if(!this.hook[A]){this.hook[A]=new Array()}if(B==undefined){B=this.app}this.hook[A].push(new Array(C,B))},check:function(A){if(!this.hook[A]){return false}else{return true}},call:function(C){var E,B=new Array();var D,G;var A=true;var F=true;if(!this.hook[C]){return }for(D=0;D<arguments.length;D++){B.push(arguments[D])}for(D=0;D<this.hook[C].length;++D){G=this.hook[C][D];if(G[0]){if(arguments.length>1){A=G[0].apply(G[1],B.slice(1))}else{A=G[0].call(G[1])}F=F&&A}}return F}};Joms.Icon=function(C,E,B,A,D){this.el=cel("div");this.el.style.position="absolute";if(typeof D=="undefined"){D="png"}this.url=C;this.type=D;this.width=E;this.height=B;this.iconCenter=A;this.iconDragPos=new Joms.Coord(Math.floor(E/2),Math.floor(B/2));this.el.style.width=E+"px";this.el.style.height=B+"px";if(D=="png"){if(Joms.browser.hasPngSupport()){this.el.style.backgroundImage="url("+C+")"}else{this.el.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+C+"',sizingMethod='scale')"}}else{this.el.style.backgroundImage="url("+C+")"}};Joms.IconCenter={BOTTOM_LEFT:0,BOTTOM:1,BOTTOM_RIGHT:2,LEFT:3,CENTER:4,RIGHT:5,TOP_LEFT:6,TOP:7,TOP_RIGHT:8};Joms.Icon.prototype={el:null,width:null,height:null,iconCenter:null,iconCenterPos:null,url:null,urlHighlight:null,iconTextLeft:0,iconTextTop:0,iconTextWidth:0,iconTextHeight:0,setHighlightUrl:function(A){this.urlHighlight=A},setIconInnerTextPosition:function(D,C,B,A){this.iconTextLeft=D;this.iconTextTop=C;this.iconTextWidth=B;this.iconTextHeight=A},setIconCenterPosition:function(A,B){this.iconCenterPos=new Joms.Coord(A,B)},setIconDragPosition:function(A,B){this.iconDragPos=new Joms.Coord(A,B)},clone:function(){return this.el.cloneNode(true)},setHighlightImg:function(A){if(this.urlHighlight==null){return }if(this.type=="png"&&!Joms.browser.hasPngSupport()){A.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this.urlHighlight+"',sizingMethod='scale')"}else{A.style.backgroundImage="url("+this.urlHighlight+")"}},removeHighlightImg:function(A){if(this.urlHighlight==null){return }if(this.type=="png"&&!Joms.browser.hasPngSupport()){A.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this.url+"',sizingMethod='scale')"}else{A.style.backgroundImage="url("+this.url+")"}}};Joms.Marker=function(C,A,B){if(!B){Joms.error("Joms.Icon","Ikona objektu nebyla definována.");return }this.app=C;this.position=A;this.icon=B;this.iconMouseOverEvent=this.iconMouseOver.bindAsEventListener(this);this.iconMouseOutEvent=this.iconMouseOut.bindAsEventListener(this);this.el=B.clone();Event.disableSelect(this.el)};Joms.Marker.prototype={position:null,app:null,el:null,layer:null,icon:null,callback:null,args:null,clicked:function(B){var A=Event.getElement(B);if(this.args!=undefined||this.args!=null){this.callback.apply(this,this.args.concat([B]))}else{this.callback.call(this,B)}},destroy:function(){},show:function(){this.el.style.display="block"},hide:function(){this.el.style.display="none"},isVisible:function(){return this.el.style.display!="none"},setPosition:function(A){this.position=A;if(this.layer){this.layer.setStyle(this)}},setClickAction:function(){this.args=Array.prototype.slice.call(this.setClickAction.arguments);this.callback=this.args.shift();this.clickEvent(this.callback)},dragStart:function(A){this.app.startMarkerDrag(this);Event.stopEvent(A)},dragEnd:function(A){if(this.dragEndFnc){if(this.dragArgs!=undefined||this.dragArgs!=null){this.dragEndFnc.apply(this,this.dragArgs.concat([A]))}else{this.dragEndFnc.call(this,A)}}},enableDrag:function(){this.dragArgs=Array.prototype.slice.call(this.enableDrag.arguments);this.dragEndFnc=this.dragArgs.shift();Joms.Event.addEvent(this.el,"mousedown",this.dragStart.bindAsEventListener(this),false);Joms.Event.addEvent(this.el,"dblclick",Joms.Event.stopEvent,false);Joms.Event.addEvent(this.el,"mousewheel",Joms.Event.stopEvent,false);this.el.style.cursor="pointer";this.el.style.cursor="hand"},clickEvent:function(A){if(!A||typeof A!="function"){Joms.error("Joms.Icon","Callback nebyl definován.");return }this.callback=A;Joms.Event.addEvent(this.el,"mouseup",this.clicked.bindAsEventListener(this),false);Joms.Event.addEvent(this.el,"mouseup",Joms.Event.stopEvent,false);Joms.Event.addEvent(this.el,"mousedown",Joms.Event.stopEvent,false);Joms.Event.addEvent(this.el,"dblclick",Joms.Event.stopEvent,false);Joms.Event.addEvent(this.el,"mousewheel",Joms.Event.stopEvent,false);this.el.style.cursor="pointer";this.el.style.cursor="hand"},openTextBox:function(C,B){var A=new Joms.Coord(parseInt(this.el.style.left)+Math.round(this.icon.width/2),parseInt(this.el.style.top)+Math.round(this.icon.height/2));if(typeof B!="undefined"){this.app.textBox.cfg=B}this.app.textBox.show(this.position,C)},setInnerText:function(B,A){var C=cel("div");if(A!=undefined){C.className=A}C.style.position="absolute";C.style.overflow="hidden";C.style.left=this.icon.iconTextLeft+"px";C.style.top=this.icon.iconTextTop+"px";C.style.width=this.icon.iconTextWidth+"px";C.style.height=this.icon.iconTextHeight+"px";C.appendChild(ctn(B));this.el.appendChild(C)},highlight:function(){this.icon.setHighlightImg(this.el);this.el.style.zIndex+=1},removeHighlight:function(){this.icon.removeHighlightImg(this.el);this.el.style.zIndex-=1},enableHighlightOnMouseOver:function(){Event.addEvent(this.el,"mouseover",this.iconMouseOverEvent,false);Event.addEvent(this.el,"mouseout",this.iconMouseOutEvent,false)},disableHighlightOnMouseOver:function(){Event.removeEvent(this.el,"mouseover",this.iconMouseOverEvent,false);Event.removeEvent(this.el,"mouseout",this.iconMouseOutEvent,false)},setTitle:function(A){this.el.title=A},iconMouseOver:function(A){this.highlight()},iconMouseOut:function(A){this.removeHighlight()}};Joms.Markers=function(C,B,A){this.layer=B;if(typeof A=="undefined"){A="utm"}this.coordType=A.toLowerCase();if(!this.checkCoordType(this.coordType)){Joms.error("Joms.Markers","Neplatný typ souřadnic.");return }if(!this.layer){Joms.error("Joms.Markers","Byla zadána neplatná vrstva.");return }this.app=C;this.markers=new Array();this.tmpMarkers=new Array()};Joms.Markers.prototype={app:null,coordType:null,markers:null,tmpMarkers:null,layer:null,show:function(){var B,A;for(B=0,A=this.tmpMarkers.length;B<A;++B){tmp=new Joms.Marker(this.app,this.tmpMarkers[B].position,this.tmpMarkers[B].icon);if(this.tmpMarkers[B].title){tmp.setTitle(this.tmpMarkers[B].title)}if(this.tmpMarkers[B].clickEvent){if(this.tmpMarkers[B].clickEventParams!=undefined){tmp.args=this.tmpMarkers[B].clickEventParams}tmp.clickEvent(this.tmpMarkers[B].clickEvent)}this.layer.add(tmp);this.markers.push(tmp)}this.resetTmpMarkers()},resetTmpMarkers:function(){this.tmpMarkers=new Array()},checkCoordType:function(A){switch(A){case"utm":case"wgs84":return true}return false},add:function(B,C,E,A,D){this.tmpMarkers.push({position:B,icon:C,title:E,clickEvent:A,clickEventParams:D})},clear:function(){this.layer.clear();this.markers=new Array()},send:function(){var D,C;if(this.coordType=="wgs84"){for(C=0,A=this.tmpMarkers.length;C<A;++C){var B=this.tmpMarkers[C];D=Joms.Convert.WgsToUtm(B.position.x,B.position.y);B.position.change(D.x,D.y)}this.show()}else{if(this.coordType!="utm"){var E="",C,A;for(C=0,A=this.tmpMarkers.length;C<A;++C){if(E!=""){E+=";"}E+=this.tmpMarkers[C].position.x+";"+this.tmpMarkers[C].position.y}new Joms.Ajax.Request(this,Joms.dataScript,false,function(J){var I,H,F,G;G=J.split(";");for(I=0,H=0,F=this.tmpMarkers.length;I<F;++I,H+=2){this.tmpMarkers[I].position.change(G[H],G[H+1])}this.show()},"post","t=cm&from="+this.coordType+"&c="+E)}else{this.show()}}}};Joms.MapTile=function(B,A){this.tiles=new Object();this.map=B;this.el=A;this.visible=true;this.tileNum=false;this.tileMax=false;this.updateAlways=false;this.tilesAdded=0;this.tilesDeleted=0;this.zoomChange=false;this.delayViewOnZoomChange=false;this.delayViewMs=1000;this.redrawTimeOut=null};Joms.MapTile.prototype={isAvailable:function(){return true},setView:function(B,A){if(this.delayViewOnZoomChange){if(this.redrawTimeOut!=null){this.redrawTimeOut.cancel()}this.redrawTimeOut=new CCallWrapper(this,this.delayViewMs,"setViewFnc",B,A);CCallWrapper.asyncExecute(this.redrawTimeOut)}else{this.setViewFnc(B,A)}this.zoomChange=false},setViewFnc:function(F,H){if(!this.isAvailable()){return }var A,I,E;if(this.map.zoom.digiZoomId!=undefined){A=this.map.zoom.digiZoomId;I=this.map.zoom.digiZoomTileSizeX;E=this.map.zoom.digiZoomTileSizeY}else{A=this.map.zoom.id;I=this.map.zoom.tile_width;E=this.map.zoom.tile_height}tileNum=new Joms.Coord(Math.floor(F.x/I),Math.floor((this.map.realY-F.y)/E));if(tileNum.x<0){tileNum.x=0}if(tileNum.y<0){tileNum.y=0}tileMax=new Joms.Coord(Math.floor((F.x+this.map.viewWidth)/I),Math.floor((this.map.realY-F.y+this.map.viewHeight)/E));if(tileMax.x>=this.map.zoom.x_length){tileMax.x=this.map.zoom.x_length-1}if(tileMax.y>=this.map.zoom.y_length){tileMax.y=this.map.zoom.y_length-1}if(this.updateAlways||!this.tileNum||!this.tileMax){for(var G=tileNum.y;G<=tileMax.y;++G){for(var J=tileNum.x;J<=tileMax.x;++J){this.addTile(this.map.zoom,J,G,A,I,E)}}}else{var D;diff=new Array(tileMax.x-tileNum.x,tileMax.y-tileNum.y);if(tileNum.x<this.tileNum.x){D=this.tileNum.x-tileNum.x;if(D>tileMax.x-tileNum.x+1){D=tileMax.x-tileNum.x+1}for(var B=0;B<D;++B){for(var C=0;C<=diff[1];++C){this.addTile(this.map.zoom,tileNum.x+B,tileNum.y+C,A,I,E)}}}if(tileMax.x>this.tileMax.x){D=tileMax.x-this.tileMax.x;if(D>tileMax.x-tileNum.x+1){D=tileMax.x-tileNum.x+1}for(var B=0;B<D;++B){for(var C=0;C<=diff[1];++C){this.addTile(this.map.zoom,tileMax.x-B,tileNum.y+C,A,I,E)}}}if(tileNum.y<this.tileNum.y){D=this.tileNum.y-tileNum.y;if(D>tileMax.y-tileNum.y+1){D=tileMax.y-tileNum.y+1}for(var B=0;B<D;++B){for(var C=0;C<=diff[0];++C){this.addTile(this.map.zoom,tileNum.x+C,tileNum.y+B,A,I,E)}}}if(tileMax.y>this.tileMax.y){D=tileMax.y-this.tileMax.y;if(D>tileMax.y-tileNum.y+1){D=tileMax.y-tileNum.y+1}for(var B=0;B<D;++B){for(var C=0;C<=diff[0];++C){this.addTile(this.map.zoom,tileNum.x+C,tileMax.y-B,A,I,E)}}}}this.tileNum=tileNum;this.tileMax=tileMax;if(!H){for(tile in this.tiles){D=tile.split("_");if(D[2]>tileMax.x||D[2]<tileNum.x||D[3]<tileNum.y||D[3]>tileMax.y){this.removeTile(tile)}}}},getTileDir:function(A,B){if(Joms.mapsDomainTemplate!=undefined&&Joms.mapsDomainCount>0){return Joms.mapsDomainTemplate.replace("{0}",(A+B)%Joms.mapsDomainCount)}else{return Joms.mapDir}},addTile:function(D,A,H,G,F,B){var C=this.map.app.mapId+"_"+G+"_"+A+"_"+H;if(this.tiles[C]){return }var E=cel("img");E.className="jomsMapTile";E.style.position="absolute";E.style.top=(D.y_length-H)*B-B+this.map.positionDiff.y+"px";E.style.left=A*F+this.map.positionDiff.x+"px";E.style.width=F+"px";E.style.height=B+"px";E.galleryimg="no";E.src=this.getTileDir(A,H)+"/"+D.dir+"/"+(G+D.first).toString()+"/"+(parseInt(A/D.columns)).toString()+"/"+D.dir+"_"+A+"_"+H+"."+D.type+"?width="+F+"&height="+B;if(this.map.opacity<100){E.style.opacity=this.map.opacity/100;E.style.MozOpacity=this.map.opacity/100;E.style.KhtmlOpacity=this.map.opacity/100;if(Joms.browser.client=="ie"){E.style.filter="alpha(opacity="+this.map.opacity+"), progid:DXImageTransform.Microsoft.BasicImage(grayScale=1)"}}this.el.appendChild(E);this.tiles[C]=E;Event.addEvent(E,"mousedown",Event.preventDefault,false);Event.addEvent(E,"click",Event.stopEvent,false);Event.addEvent(E,"mousemove",Event.preventDefault,false);Event.addEvent(E,"mouseover",Event.preventDefault,false);Event.disableSelect(E);this.tilesAdded+=1},removeTile:function(B){if(!this.tiles[B]){return }var A=this.tiles[B];Event.removeEvent(A,"mousedown",Event.preventDefault,false);Event.removeEvent(A,"click",Event.stopEvent,false);Event.removeEvent(A,"mousemove",Event.preventDefault,false);Event.removeEvent(A,"mouseover",Event.preventDefault,false);if(Joms.browser.isIE()){Event.removeEvent(A,"onselectstart",Event.preventDefault,false)}this.el.removeChild(A);delete A;delete this.tiles[B];this.tilesDeleted+=1},zoomChanged:function(){if(this.redrawTimeOut!=null){this.redrawTimeOut.cancel();this.redrawTimeOut=null}this.zoomChange=true;this.tileNum=false;this.tileMax=false;this.removeTiles()},removeTiles:function(){for(tile in this.tiles){this.removeTile(tile)}this.tilesAdded=0;this.tilesDeleted=0}};Joms.IconTile=function(B,A){this.lastBottomLeft=false;this.icons=new Object();this.map=B;this.el=A;this.visible=true;this.zoomChng=true;this.iconMouseUpEvent=this.iconMouseUp.bindAsEventListener(this);this.iconMouseOverEvent=this.iconMouseOver.bindAsEventListener(this);this.iconMouseOutEvent=this.iconMouseOut.bindAsEventListener(this)};Joms.IconTile.prototype={request:null,requestTimeOut:null,zoomChanged:function(){if(this.request){this.request.request.abort()}this.zoomChng=true;this.removeIcons()},setView:function(A){this.bottomLeft=A;this.ldx=this.map.px2unitX(this.bottomLeft.x);this.ldy=this.map.px2unitY(this.bottomLeft.y);this.rux=this.map.px2unitX(this.bottomLeft.x+this.map.viewWidth);this.ruy=this.map.px2unitY(this.bottomLeft.y-this.map.viewHeight);if(this.zoomChng){this.zoomChng=false}else{this.loadIcons()}},newIcon:function(A){var C=A.id+"_"+A.x+"_"+A.y;if(this.icons[C]){return }var B=cel("img");B.id="icon_"+C;B.className="idnesIcon";B.style.position="absolute";B.style.top=this.map.unit2pxY(A.y)+this.map.positionDiff.y-Math.round(this.map.zoom.icon_height/2)+"px";B.style.left=this.map.unit2pxX(A.x)+this.map.positionDiff.x-Math.round(this.map.zoom.icon_width/2)+"px";if(A.icon){B.src=Joms.iconsDir+A.icon}else{B.src=Joms.iconsDir+A.grp+"."+Joms.iconsType;B.style.width=this.map.zoom.icon_width+"px";B.style.height=this.map.zoom.icon_height+"px"}B.active=A.active;if(A.active){B.style.cursor="pointer";Event.addEvent(B,"mouseup",this.iconMouseUpEvent,false);Event.addEvent(B,"mouseover",this.iconMouseOverEvent,false);Event.addEvent(B,"mouseout",this.iconMouseOutEvent,false)}Event.addEvent(B,"mouseup",Event.preventDefault,false);Event.addEvent(B,"mousedown",Event.stopEvent,false);Event.addEvent(B,"contextmenu",Event.preventDefault,false);this.icons[C]=B;this.icons[C].i=A;this.el.appendChild(B)},loadIcons:function(){if(this.requestTimeOut!=null){this.requestTimeOut.cancel()}this.requestTimeOut=new CCallWrapper(this,750,"loadIconsAfterTimeOut");CCallWrapper.asyncExecute(this.requestTimeOut)},loadIconsAfterTimeOut:function(){var A="",B;if(this.map.app.nativeObjects){A=this.map.app.nativeObjects.categories.join(";")}else{var C,D=document.getElementsByName("objectlist"+this.map.app.name);for(B=0;B<D.length;++B){if(D[B].checked){if(A!=""){A+=";"}A+=D[B].id.split("_")[1]}}}if(A==""){this.removeIcons();return }this.request=new Joms.Ajax.Request(this,Joms.dataScript+"?t=i&cords="+this.ldx+"_"+this.ldy+"_"+this.rux+"_"+this.ruy+"&map="+this.map.app.mapId+"&zoom="+this.map.zoom.id+"&base_map="+this.map.app.baseMap+"&cat="+A,true,function(F){this.removeIcons();icons=F.parseJSON();if(icons=="0"){return }for(var E=0;E<icons.length;++E){this.newIcon(icons[E])}this.request=null})},removeIcon:function(B){var A=this.icons[B];if(A){if(A.active){Event.removeEvent(A,"mouseup",this.iconMouseUpEvent,false);Event.removeEvent(A,"mouseover",this.iconMouseOverEvent,false);Event.removeEvent(A,"mouseout",this.iconMouseOutEvent,false)}Event.removeEvent(A,"mouseup",Event.preventDefault,false);Event.removeEvent(A,"mousedown",Event.stopEvent,false);Event.removeEvent(A,"contextmenu",Event.preventDefault,false);this.el.removeChild(A);delete this.icons[B]}},removeIcons:function(){for(icon in this.icons){this.removeIcon(icon)}this.icons=new Object()},iconMouseOver:function(C){var B=Event.getElement(C);var A=this.map.app.getLeft(C.clientX)+Joms.getOffsetX();var D=this.map.app.getTop(C.clientY)+Joms.getOffsetY();B.style.zIndex="8";B.parentNode.style.zIndex="7";this.map.app.hooks.call("iconMouseOver",new Joms.Coord(A,D),B)},iconMouseOut:function(B){var A=Event.getElement(B);A.style.zIndex="4";A.parentNode.style.zIndex="4";this.map.app.hooks.call("iconMouseOut",A)},iconMouseUp:function(B){var A=Event.getElement(B);if(Event.isRightClick(B)){return }var D=A.id.split("_");var C=new Joms.Coord(D[2],D[3]);new Joms.Ajax.Request(this,Joms.dataScript+"?t=o2&f=b&id="+D[1],true,function(E){this.map.app.textBox.setText(E)});this.map.app.textBox.show(C);Event.stopEvent(B)},hide:function(){this.visible=false;this.el.style.display="none"},show:function(){this.visible=true;this.el.style.display="block"}};Joms.ServletTile=function(B,A){this.visible=true;this.context=false;this.tiles=new Object();this.map=B;this.el=A;this.routes=new Array();this.lines=new Array();this.context=null;this.delayViewMs=1000;this.redrawTimeOut=null;this.tileGeneration=1;this.increaseTileGeneration()};Joms.ServletTile.prototype={tileGeneration:1,lastChange:"",enabled:true,context:null,routes:null,lines:null,envelopeRect:null,addRoute:function(A,B){if(B!=undefined){if(!B.isValid()){return }this.context=B}this.routes[A.id]=A;this.redraw()},addLine:function(A,B){if(B!=undefined){if(!B.isValid()){return }this.context=B}this.lines[A.id]=A;this.redraw()},removeRoute:function(A){delete this.routes[A.id];this.redraw()},removeLine:function(A){delete this.lines[A.id];this.redraw()},redraw:function(){this.setEnvelopeRect();this.increaseTileGeneration();this.setViewFnc(this.map.leftBottomView)},increaseTileGeneration:function(){this.tileGeneration++;var A=new Date();this.lastChange=A.getTime();this.removeTiles()},setView:function(B,A){if(!this.enabled||this.envelopeRect==null){this.removeTiles();return }if(this.redrawTimeOut!=null){this.redrawTimeOut.cancel()}this.redrawTimeOut=new CCallWrapper(this,this.delayViewMs,"setViewFnc",B,A);CCallWrapper.asyncExecute(this.redrawTimeOut)},setViewFnc:function(B){if(!this.enabled||this.envelopeRect==null){this.removeTiles();return }var D=new Joms.Coord(B.x,B.y);var E=new Joms.Coord(B.x+this.map.viewWidth,B.y-this.map.viewHeight);if(D.x<this.x1px){D.x=this.x1px-40}if(D.y>this.y1px){D.y=this.y1px+40}if(E.x>this.x2px){E.x=this.x2px+40}if(E.y<this.y2px){E.y=this.y2px-40}tileNumX=Math.floor(D.x/this.map.zoom.tile_width);tileNumY=Math.floor((this.map.realY-D.y)/this.map.zoom.tile_height);if(tileNumX<0){tileNumX=0}if(tileNumY<0){tileNumY=0}tileMaxX=Math.floor(E.x/this.map.zoom.tile_width);tileMaxY=Math.floor((this.map.realY-E.y)/this.map.zoom.tile_height);if(tileMaxX>=this.map.zoom.x_length){tileMaxX=this.map.zoom.x_length-1}if(tileMaxY>=this.map.zoom.y_length){tileMaxY=this.map.zoom.y_length-1}for(var F=tileNumY;F<=tileMaxY;++F){for(var A=tileNumX;A<=tileMaxX;++A){this.addTile(this.map.zoom,A,F)}}var C;for(tile in this.tiles){C=tile.split("_");if(C[2]>tileMaxX||C[2]<tileNumX||C[3]<tileNumY||C[3]>tileMaxY){this.removeTile(tile)}}},addTile:function(I,H,E){var D=this.map.app.mapId+"_"+I.id+"_"+H+"_"+E;var G=(I.y_length-E)*I.tile_height-I.tile_height;var C=H*I.tile_width;var A=Joms.servletUrl+"overlay/"+this.context.hash+"/"+Joms.maps_r[this.map.app.mapId]+"/"+(I.id+I.first)+"/"+H+"/"+(I.y_length-E-1)+"/"+this.tileGeneration+"_"+this.lastChange+".png";var F=this.map.px2unitX(C)+";"+this.map.px2unitY(G)+";"+this.map.px2unitX(C+I.tile_width)+";"+this.map.px2unitY(G+I.tile_height);if(this.tiles[D]){return }var B=B=cel("img");B.id=D;B.className="jomsMapTile";B.style.position="absolute";B.style.top=G+this.map.positionDiff.y+"px";B.style.left=C+this.map.positionDiff.x+"px";B.style.width=I.tile_width+"px";B.style.height=I.tile_height+"px";B.src=Joms.blankImage;if(!Joms.browser.hasPngSupport()){B.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+A+"',sizingMethod='scale')"}else{B.src=A}this.el.appendChild(B);this.tiles[D]=B;Event.addEvent(B,"mousedown",Event.preventDefault,false);Event.addEvent(B,"click",Event.stopEvent,false);Event.addEvent(B,"mousemove",Event.preventDefault,false);Event.addEvent(B,"mouseover",Event.preventDefault,false);Event.disableSelect(B)},removeTile:function(B){if(!this.tiles[B]||B=="toJSONString"){return }var A=this.tiles[B];Event.removeEvent(A,"mousedown",Event.preventDefault,false);Event.removeEvent(A,"click",Event.stopEvent,false);Event.removeEvent(A,"mousemove",Event.preventDefault,false);Event.removeEvent(A,"mouseover",Event.preventDefault,false);if(Joms.browser.isIE()){Event.removeEvent(A,"onselectstart",Event.preventDefault,false)}this.el.removeChild(A);delete A;delete this.tiles[B]},zoomChanged:function(){if(this.redrawTimeOut!=null){this.redrawTimeOut.cancel();this.redrawTimeOut=null}this.removeTiles();this.setCoords()},removeTiles:function(){for(tile in this.tiles){this.removeTile(tile)}},setEnvelopeRect:function(){this.envelopeRect=null;for(var A in this.routes){this.addRectToEnvelopeRect(this.routes[A].envelopeRect)}for(var A in this.lines){this.addRectToEnvelopeRect(this.lines[A].envelopeRect)}this.setCoords()},addRectToEnvelopeRect:function(A){if(A==null){return }if(this.envelopeRect==null){this.envelopeRect=new Joms.Rect(A.lb,A.rt)}else{this.envelopeRect.enlargeRect(A)}},setCoords:function(){if(this.envelopeRect!=null){this.envelopeRect.normalize();this.x1px=this.map.unit2pxX(this.envelopeRect.lb.x);this.y1px=this.map.unit2pxY(this.envelopeRect.lb.y);this.x2px=this.map.unit2pxX(this.envelopeRect.rt.x);this.y2px=this.map.unit2pxY(this.envelopeRect.rt.y)}},show:function(){this.visible=true;this.setView(this.map.leftBottomView)},hide:function(){this.visible=false;this.removeTiles()},enable:function(){this.enabled=true;if(this.context!=null&&this.context.isValid()){this.setView(this.map.leftBottomView)}},disable:function(){this.enabled=false}};Joms.OverlayTile=function(B,A){Joms.MapTile.apply(this,arguments);this.updateAlways=true;this.delayViewOnZoomChange=true};Joms.OverlayTile.prototype=new Joms.MapTile();Joms.OverlayTile.prototype.layerCode="";Joms.OverlayTile.prototype.opacity=100;Joms.OverlayTile.prototype.maxMppx=0;Joms.OverlayTile.prototype.isWms=false;Joms.OverlayTile.prototype.useCache=true;Joms.OverlayTile.prototype.wmsBaseUrl="http://geoportal.cenia.cz/wmsconnector/com.esri.wms.Esrimap/";Joms.OverlayTile.prototype.wmsMap="cenia_prparky";Joms.OverlayTile.prototype.wmsLayers="0";Joms.OverlayTile.prototype.isAvailable=function(){if(this.maxMppx==0||this.map.zoom.mppx<=this.maxMppx){return true}else{return false}};Joms.OverlayTile.prototype.addTile=function(J,I,H){var C=this.map.app.mapId+"_"+J.id+"_"+I+"_"+H,A;if(this.tiles[C]){return }imgEl=cel("img");imgEl.className="jomsMapTile";imgEl.style.position="absolute";imgEl.style.top=(J.y_length-H)*J.tile_height-J.tile_height+this.map.positionDiff.y+"px";imgEl.style.left=I*J.tile_width+this.map.positionDiff.x+"px";imgEl.style.width=J.tile_width+"px";imgEl.style.height=J.tile_height+"px";imgEl.galleryimg="no";imgEl.preCached=-1;imgEl.unselectable="on";var B;if(J.layers_dir){B=J.layers_dir}else{B=J.dir}var A;if(this.isWms){var L=(J.rux-J.ldx)/J.x_length;var K=(J.ruy-J.ldy)/J.y_length;var G=J.ldx+(L*I);var F=J.ldy+(K*H);var E=G+L;var D=F+K;if(this.useCache){A=Joms.layerDir+"/wmscache/"+this.layerCode+"/"+J.dir+"/"+(J.id+J.first).toString()+"/"+(parseInt(I/J.columns)).toString()+"/"+J.dir+"_"+I+"_"+H+"."+this.imgType;A+="?width="+J.tile_width+"&height="+J.tile_height;A+="&wmsMap="+this.wmsMap+"&wmsLayers="+this.wmsLayers+"&BBOX="+G+","+F+","+E+","+D;A+="&layerCode="+this.layerCode;A+="&dir="+J.dir+"_"+(J.id+J.first).toString()+"_"+(parseInt(I/J.columns)).toString();A+="&file="+J.dir+"_"+I+"_"+H;A+="&imgType="+this.imgType}else{var A=this.wmsBaseUrl+this.wmsMap+"?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&TRANSPARENT=TRUE&SRS=EPSG:32633&LAYERS="+this.wmsLayers+"&BBOX="+G+","+F+","+E+","+D+"&WIDTH="+J.tile_width+"&HEIGHT="+J.tile_height+"&FORMAT=image/"+this.imgType+"&EXCEPTION=application/vnd.ogc.se_xml"}}else{A=Joms.layerDir+"/"+this.layerCode+"/"+B+"/"+(J.id+J.first).toString()+"/"+(parseInt(I/J.columns)).toString()+"/"+B+"_"+I+"_"+H+".png?width="+J.tile_width+"&height="+J.tile_height}if(browser.client=="ie"){if(this.imgType=="png"&&!Joms.browser.hasPngSupport()){imgEl.src=Joms.blankImage;imgEl.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+A+"')"}else{imgEl.src=A;imgEl.style.filter="alpha(opacity="+this.opacity+")"}}else{imgEl.src=A;imgEl.style.opacity=this.opacity/100;imgEl.style.MozOpacity=this.opacity/100;imgEl.style.KhtmlOpacity=this.opacity/100}this.el.appendChild(imgEl);this.tiles[C]=imgEl;Event.addEvent(imgEl,"mousedown",Event.preventDefault,false);Event.addEvent(imgEl,"click",Event.stopEvent,false);Event.addEvent(imgEl,"mousemove",Event.preventDefault,false);Event.addEvent(imgEl,"mouseover",Event.preventDefault,false);Event.disableSelect(imgEl);this.tilesAdded+=1};Joms.OverlayTile.prototype.onTileError=function(A,C,B){this.deleteImage(B)};Joms.OverlayTile.prototype.deleteImage=function(A){A.onload=null;A.onerror=null;A.onabort=null;A.src=null;delete A};Joms.OverlayTile.prototype.onTileLoad=function(A,D,C){if(!this.tiles[A]){this.deleteImage(C);return }var B=this.tiles[A];var E="";E+="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+D+"')";B.style.filter=E;this.deleteImage(C)};Joms.CustomObjects=function(B,A){this.objs=new Array();this.map=B;this.el=A;this.el.style.display="block"};Joms.CustomObjects.prototype={objs:null,el:null,map:null,visible:true,setView:function(B,A){this.zoomChanged()},zoomChanged:function(){for(var A=0;A<this.objs.length;++A){this.setStyle(this.objs[A])}},setStyle:function(B){var A,D;A=this.map.unit2mapX(B.position.x);D=this.map.unit2mapY(B.position.y);if(B.icon.iconCenterPos!=null){var C=B.icon.iconCenterPos;A-=C.x;D-=C.y}else{switch(B.icon.iconCenter){case Joms.IconCenter.BOTTOM_LEFT:D-=B.icon.height;break;case Joms.IconCenter.BOTTOM:A-=Math.round(B.icon.width/2);D-=B.icon.height;break;case Joms.IconCenter.BOTTOM_RIGHT:A-=B.icon.width;D-=B.icon.height;break;case Joms.IconCenter.RIGHT:A-=Math.round(B.icon.width/2);D-=B.icon.height;break;case Joms.IconCenter.CENTER:A-=Math.round(B.icon.width/2);D-=Math.round(B.icon.height/2);break;case Joms.IconCenter.LEFT:A-=Math.round(B.icon.width/2);D-=B.icon.height;break;case Joms.IconCenter.TOP_LEFT:break;case Joms.IconCenter.TOP:A-=Math.round(B.icon.width/2);break;case Joms.IconCenter.TOP_RIGHT:A-=B.icon.width;break}}B.el.style.top=D+"px";B.el.style.left=A+"px"},add:function(A){this.objs.push(A);A.layer=this;this.setStyle(A)},remove:function(A){var B=Joms.obtainObjectIndexInArray(this.objs,A);if(B!=-1){this.objs.splice(B,1)}},clear:function(){for(var A=0;A<this.objs.length;++A){this.el.removeChild(this.objs[A].el)}this.objs=new Array()},show:function(){this.visible=true;this.el.style.display="block"},hide:function(){this.visible=false;this.el.style.display="none"}};Joms.MapFlags=function(B,A){this.flags=new Object;this.flagsLength=0;this.map=B;this.el=A;this.el.style.display="block";this.visible=false};Joms.MapFlags.prototype={zoomChanged:function(){for(var A in this.flags){this.setStyle(this.flags[A])}},hide:function(A){var B;if(!(B=this.flags[A])){return }B.style.display="none";if(--this.flagsLength<=0){this.visible=false}},show:function(A){var B;if(!(B=this.flags[A])){return }this.visible=true;++this.flagsLength;this.setStyle(B);B.style.display="block"},setStyle:function(A){A.style.top=this.map.unit2pxY(A.y)-45+this.map.positionDiff.y+"px";A.style.left=this.map.unit2pxX(A.x)+this.map.positionDiff.x+"px"},add:function(A,D){var C=A+";"+D;var B;if(this.flags[C]){this.show(C);return this.flagsLength}B=cel("div");B.style.display="none";B.style.width="53px";B.style.height="46px";B.style.position="absolute";B.x=A;B.y=D;if(browser.client=="ie"&&browser.version>=3){B.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/flag.png',sizingMethod='scale')"}else{B.style.backgroundImage="url(/images/flag.png)"}this.el.appendChild(B);this.flags[C]=B;this.show(C);return this.flagsLength},remove:function(A,C){var B=A+";"+C;if(!this.flags[B]){return }this.el.removeChild(this.flags[B]);delete this.flags[B]},removeAll:function(){for(var A in this.flags){this.el.removeChild(this.flags[A])}this.visible=false;this.flagsLength=0;this.flags=new Object}};Joms.MapArrow=function(B,A){this.map=B;this.el=A;this.X=0;this.Y=0;this.el.style.width="57px";this.el.style.height="46px";this.el.style.display="none";this.visible=false;if(browser.client=="ie"&&browser.version>=3){this.el.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/app-data/images/arrow.png',sizingMethod='scale')"}else{this.el.style.backgroundImage='url("/app-data/images/arrow.png")'}};Joms.MapArrow.prototype={zoomChanged:function(){if(!this.visible){return }this.setStyle()},hide:function(){this.el.style.display="none";this.visible=false},show:function(A,B){this.X=A;this.Y=B;this.el.style.display="block";this.visible=true;this.setStyle()},setStyle:function(){this.el.style.top=this.map.unit2pxY(this.Y)-46+this.map.positionDiff.y+"px";this.el.style.left=this.map.unit2pxX(this.X)+this.map.positionDiff.x+"px"}};Joms.Layer=function(D,B,A,F,E,C){this.map=D;if(this.map.layers[B]){Joms.error("Joms.ImageLayer","Vrstva s názvem "+B+" již existuje.");return }this.map.layers[B]=this;this.name=B;this.el=cel("div");this.el.style.position="absolute";this.el.style.top="0";this.el.style.left="0";this.el.style.zIndex=F;this.el.id=B+this.map.name;this.tiles=new A(this.map,this.el);this.appendAsStatic=C!=undefined?C:false;if(this.appendAsStatic){this.map.app.el.appendChild(this.el)}else{this.map.el.appendChild(this.el)}this.updateOnMove=E};Joms.Layer.prototype={el:null,tiles:null,map:null,name:null,destructor:function(){if(this.map.layers[this.name]){delete this.map.layers[this.name]}this.tiles.removeTiles();if(this.appendAsStatic){this.map.app.el.removeChild(this.el)}else{this.map.el.removeChild(this.el)}},update:function(A,B){if(this.tiles.visible&&this.tiles.setView){this.tiles.setView(A,B)}},zoomChanged:function(){if(this.tiles.visible){this.tiles.zoomChanged()}}};Joms.OverlayLayer=function(D,C,A,E){if(!D){Joms.error("Joms.OverlayLayer","Objekt aplikace nebyl definován.");return }this.app=D;this.app.map.overlayLayers[C]=this;if(A!=undefined){this.opacity=A;if(this.opacity>100){this.opacity=100}if(this.opacity<0){this.opacity=0}}else{this.opacity=100}if(E==undefined){this.zIndex=3}else{this.zIndex=E}if(!this.app.initialized){Joms.error("Joms.OverlayLayer","Objekt vytvořte až po zavolání metody init v Joms.App.");return }this.wmsBaseUrl="http://geoportal.cenia.cz/wmsconnector/com.esri.wms.Esrimap/";this.wmsUseCache=true;this.copyright="Cenia";this.copyrightHref="http://www.cenia.cz";this.isWms=false;this.layerCode=C;this.imgType="png";this.maxMppx=0;this.type=C;switch(this.type){case"cycle":this.name="Cyklotrasy";this.layerCode="cycle-signs";break;case"gradient":this.name="Stínování";break;case"tourist":this.name="Turistické trasy";break;case"tourist-outline":this.name="Turistické trasy";break;case"ski":this.name="Lyžařské stopy";break;case"reach":this.name="Reach";break;case"orto":this.isWms=true;this.wmsMap="cenia_b_ortorgb1m_sde";this.wmsLayers="0";this.name="Ortofoto 1 m (2004-2006)";this.maxMppx=100;this.imgType="jpeg";break;case"parking":this.isWms=true;this.wmsBaseUrl="http://wgp.urhmp.cz/ArcGIS/services/INF/zony_placeneho_stani_HMP/MapServer/WMSServer/";this.copyright="urhmp";this.copyrightHref="http://wgp.urhmp.cz/";this.wmsMap="";this.wmsLayers="0";this.name="Parkovací zóny v Praze";this.maxMppx=100;this.imgType="png";this.wmsUseCache=false;break;case"parks":this.isWms=true;this.wmsMap="cenia_prparky";this.wmsLayers="0";this.name="Národní parky";break;case"contour_lines":this.isWms=true;this.wmsMap="cenia_dmu25";this.wmsLayers="380,371";this.name="Vrstevnice";this.maxMppx=50;break;case"regions":this.isWms=true;this.wmsMap="cenia_dmu25";this.wmsLayers="145";this.name="Hranice krajů";break;case"zchu":this.isWms=true;this.wmsMap="cenia_zchu";this.wmsLayers="0";this.name="Chráněná území";break;default:return }if(this.isWms){this.copyrightEl=cel("span");this.copyrightEl.appendChild(ctn(", "));var B=cel("a");B.href=this.copyrightHref;B.target="_blank";B.appendChild(ctn(this.copyright));this.copyrightEl.appendChild(B)}};Joms.OverlayLayer.prototype={app:null,layer:null,type:null,layerCode:null,opacity:100,imgType:"png",maxMppx:0,zIndex:2,isWms:false,wmsBaseUrl:null,wmsMap:null,wmsLayers:"0",copyrightEl:null,show:function(){if(this.layer){return }this.layer=new Joms.Layer(this.app.map,this.type+"OverlayTile",Joms.OverlayTile,this.zIndex,false);if(this.isWms){this.layer.tiles.wmsBaseUrl=this.wmsBaseUrl;this.layer.tiles.wmsMap=this.wmsMap;this.layer.tiles.wmsLayers=this.wmsLayers;this.layer.tiles.useCache=this.wmsUseCache}this.layer.tiles.isWms=this.isWms;this.layer.tiles.layerCode=this.layerCode;this.layer.tiles.opacity=this.opacity;this.layer.tiles.imgType=this.imgType;this.layer.tiles.maxMppx=this.maxMppx;this.app.map.updateLayers();if(this.copyrightEl){gid("jomsCopyright").appendChild(this.copyrightEl)}},hide:function(){if(!this.layer){return }this.layer.destructor();this.layer=null;if(this.copyrightEl){gid("jomsCopyright").removeChild(this.copyrightEl)}},setOpacity:function(A){this.opacity=A;if(this.layer){this.layer.tiles.opacity=A;this.layer.tiles.zoomChanged();this.layer.tiles.setView(this.app.map.leftBottomView,false)}},setVisibility:function(A){if(A){if(!this.layer){this.show();this.app.hooks.call("layerSwitch",this.type,true)}}else{if(this.layer){this.hide();this.app.hooks.call("layerSwitch",this.type,false)}}},toggle:function(){if(this.layer){this.hide();this.app.hooks.call("layerSwitch",this.type,false)}else{this.show();this.app.hooks.call("layerSwitch",this.type,true)}this.app.hooks.call("mapChanged")}};Joms.CustomLayer=function(B,A,C){if(!B){Joms.error("Joms.CustomLayer","Objekt aplikace nebyl definován.");return }if(C==undefined){C=21}this.app=B;this.name=A;this.visible=true;this.layer=this.app.map.getLayer(A);if(!this.layer||this.layer.add==undefined){new Joms.Layer(this.app.map,A,Joms.CustomObjects,C,false);this.layer=this.app.map.getLayer(A)}};Joms.CustomLayer.prototype={app:null,name:null,layer:null,visible:null,add:function(A){this.layer.add(A);this.layer.el.appendChild(A.el)},remove:function(A){this.layer.el.removeChild(A.el);this.layer.remove(A)},clear:function(){this.layer.clear()},show:function(){this.layer.show();this.visible=true},hide:function(){this.layer.hide();this.visible=false}};Joms.ZoomControl=function(B,A){this.app=B;if(!this.app.initialized){Joms.error("Joms.ZoomControl","Objekt vytvořte až po zavolání metody init v Joms.App.");return }if(typeof A=="undefined"){A=new Joms.ZoomControlConf(this.app)}this.cfg=A;if(typeof this.cfg.elname!="undefined"){this.el=gid(this.cfg.elname)}if(!this.el){this.el=cel("div");if(this.cfg.vertical){this.el.style.width=this.cfg.plus[1]+"px"}this.app.el.appendChild(this.el)}this.el.className="jomsZoomControl";this.minus=Joms.createTransparentImage(this.cfg.minus[0],this.cfg.minus[1],this.cfg.minus[2],this.cfg.minus[3]);this.minus.alt="Oddálit mapu";this.minus.title="Oddálit mapu";this.zooms=cel("div");this.append=cel("div");this.plus=Joms.createTransparentImage(this.cfg.plus[0],this.cfg.plus[1],this.cfg.plus[2],this.cfg.plus[3]);this.plus.alt="Přiblížit mapu";this.plus.title="Přiblížit mapu";this.el.appendChild(this.minus);this.el.appendChild(this.zooms);this.el.appendChild(this.append);this.el.appendChild(this.plus);Joms.Event.addEvent(this.minus,"click",this.app.map.zoomOut.bind(this.app.map),false);Joms.Event.addEvent(this.plus,"click",this.app.map.zoomIn.bind(this.app.map),false);this.app.hooks.register("appChanged",this.load,this);this.app.hooks.register("mapChanged",this.update,this);this.app.hooks.register("zoomChanged",this.change,this);this.load();this.update();this.change()};Joms.ZoomControl.prototype={app:null,el:null,plus:null,minus:null,zooms:null,append:null,count:0,appendCount:0,cfg:null,newZoomLabel:function(E,B,D){var A,C;A=Joms.createTransparentImage(this.cfg.barwithout[0],this.cfg.barwithout[1],this.cfg.barwithout[2],this.cfg.barwithout[3]);A.id="zoom"+this.app.name+"_"+E+"_"+B;A.className="jomsZoomLabel";++this.count;D.appendChild(A);Event.addEvent(A,"click",this.app.changeZoom.bindAsEventListener(this.app),false)},load:function(){var B;this.unload();for(B=this.app.zoom.outMap.length-1;B>=0;--B){for(var A=0;A<this.app.zoom.outMap[B].count;++A){this.newZoomLabel(this.app.zoom.outMap[B].id,A,this.zooms)}}for(B=0;B<this.app.zoom.zoom.length;++B){this.newZoomLabel(this.app.mapId,B,this.zooms)}},unload:function(){for(j=0;j<this.zooms.childNodes.length;++j){this.zooms.childNodes[j].src=Joms.blankImage}Joms.removeAllChilds(this.zooms);for(j=0;j<this.append.childNodes.length;++j){this.append.childNodes[j].src=Joms.blankImage}Joms.removeAllChilds(this.append);this.count=0;this.appendCount=0},update:function(){var A;for(A=0;A<this.append.childNodes.length;++A){this.append.childNodes[A].src=Joms.blankImage}Joms.removeAllChilds(this.append);this.appendCount=0;for(inMap in this.app.map.inMaps){for(A=0;A<this.app.map.inMaps[inMap].count;++A){this.newZoomLabel(this.app.map.inMaps[inMap].id,A,this.append);++this.appendCount}}},change:function(A){var B,C;if(B=gid(A)){Joms.updateTransparentImage(B,this.cfg.barwithout[0],this.cfg.barwithout[1],this.cfg.barwithout[2],this.cfg.barwithout[3])}if(B=gid("zoom"+this.app.name+"_"+this.app.mapId+"_"+this.app.map.zoom.id)){Joms.updateTransparentImage(B,this.cfg.barwith[0],this.cfg.barwith[1],this.cfg.barwith[2],this.cfg.barwith[3])}},getZoom:function(A){return(this.zoom[A])?this.zoom[A]:false},hide:function(){this.el.style.display="none"},show:function(){this.el.style.display="block"}};Joms.MoveControl=function(D,A){var B;this.app=D;if(typeof A=="undefined"){A=new Joms.MoveControlConf(this.app)}if(typeof A.elname!=null){this.el=gid(A.elname)}if(!this.el){this.el=cel("div");this.app.el.appendChild(this.el)}this.el.className="jomsMoveControl";this.el.style.width="49px";this.el.style.height="48px";if(!$("jomsMoveMap")){var C=cel("map");C.id="jomsMoveMap";C.name="jomsMoveMap";B=cel("area");B.shape="rect";B.alt="vlevo";B.title="Posun vlevo";B.href="";B.coords="3,17,17,29";Joms.Event.addEvent(B,"click",A.leftEvent,false);Joms.Event.addEvent(B,"click",Joms.Event.preventDefault,false);C.appendChild(B);B=cel("area");B.shape="rect";B.alt="vpravo";B.title="Posun vpravo";B.href="";B.coords="30,18,45,30";Joms.Event.addEvent(B,"click",A.rightEvent,false);Joms.Event.addEvent(B,"click",Joms.Event.preventDefault,false);C.appendChild(B);B=cel("area");B.shape="rect";B.alt="vpravo";B.title="Posun nahoru";B.href="";B.coords="17,3,30,18";Joms.Event.addEvent(B,"click",A.upEvent,false);Joms.Event.addEvent(B,"click",Joms.Event.preventDefault,false);C.appendChild(B);B=cel("area");B.shape="rect";B.alt="vpravo";B.title="Posun dolů";B.href="";B.coords="18,30,30,44";Joms.Event.addEvent(B,"click",A.downEvent,false);Joms.Event.addEvent(B,"click",Joms.Event.preventDefault,false);C.appendChild(B);this.el.appendChild(C)}B=cel("img");B.useMap="#jomsMoveMap";B.width="49";B.height="48";B.style.width="49px";B.style.height="48px";if(!Joms.browser.hasPngSupport()){B.src=Joms.blankImage;B.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+Joms.baseUrl+"images/move.png',sizingMethod='scale');"}else{B.src=Joms.baseUrl+"images/move.png"}this.el.appendChild(B);this.app.hooks.register("hideControl",this.hide,this);this.app.hooks.register("showControl",this.show,this)};Joms.MoveControl.prototype={app:null,el:null,hide:function(){this.el.style.display="none"},show:function(){this.el.style.display="block"}};Joms.LayerControl=function(B,A){this.app=B;this.el=cel("div");this.el.className="jomsLayerControl";this.el.style.width="200px";this.app.el.appendChild(this.el);if(A!=undefined){this.showOpacity=A}else{this.showOpacity=false}Joms.addTransparentBg(this.el);this.app.hooks.register("layerSwitch",this.changeLayer,this);this.app.hooks.register("hideControl",this.hide,this);this.app.hooks.register("showControl",this.show,this)};Joms.LayerControl.prototype={app:null,el:null,showOpacity:false,changeLayer:function(B,C){var A;A=$(B+"Layer");if(A){if(C){A.checked="checked"}else{A.checked=""}}},add:function(E,G,I){var B,H,F;B=cel("div");H=cel("input");H.type="checkbox";H.id=E.type+"Layer";if(I){H.checked=true;E.toggle()}F=cel("label");F.htmlFor=E.type+"Layer";F.innerHTML=G;if(this.showOpacity&&(E.imgType!="png"||Joms.browser.client!="ie"||Joms.browser.hasPngSupport())){var D=cel("div");D.className="jomsLayerControlOpacityBlock";for(var C=25;C<=100;C+=25){var A=Math.max(255-Math.floor((C/100)*200),0);var K=cel("div");K.className="jomsLayerControlOpacityItem";K.style.backgroundColor="rgb("+A+","+A+","+A+")";if(E.opacity==C){K.style.border="1px solid red"}else{K.style.border="1px solid black"}K.onclick=this.setOpacity.bind(this,E,C,K,D);var J=cel("img");J.src=Joms.blankImage;J.width=7;J.height=7;K.appendChild(J);D.appendChild(K)}B.appendChild(D)}B.appendChild(H);B.appendChild(F);Joms.Event.addEvent(H,"click",function(){E.toggle()},false);this.el.appendChild(B)},setOpacity:function(E,C,F,A){E.setOpacity(C);var B=Joms.getElementsByClassName(A,"div","jomsLayerControlOpacityItem");for(var D=0;D<B.length;D++){B[D].style.border="1px solid black"}F.style.border="1px solid red"},addCustom:function(G,B,F){var D,A,E,C;D=cel("div");A=cel("input");A.type="checkbox";A.id=G;E=cel("label");E.htmlFor=G;E.innerHTML=B;D.appendChild(A);D.appendChild(E);Joms.Event.addEvent(A,"click",F,false);this.el.appendChild(D)},addMap:function(E,B){var D,A,F,C;D=cel("div");A=cel("a");A.href="";A.appendChild(ctn(B));D.appendChild(A);this.el.appendChild(D);Joms.Event.addClickEvent(A,this.setMap.bind(this,E))},setMap:function(A){this.app.changeMapAndPreservePosition(A)},hide:function(){this.el.style.display="none"},show:function(){this.el.style.display="block"}};Joms.MoveControlConf=function(A){this.leftEvent=A.map.moveLeft.bind(A.map);this.rightEvent=A.map.moveRight.bind(A.map);this.upEvent=A.map.moveUp.bind(A.map);this.downEvent=A.map.moveDown.bind(A.map)};Joms.MoveControlConf.prototype={leftEvent:null,rightEvent:null,upEvent:null,downEvent:null,elname:null};Joms.Scale=function(A){if(!A){Joms.error("Joms.Scale","Objekt aplikace nebyl definován.");return }this.app=A;this.scale=cel("div");this.scale.id="scale"+this.app.name;this.scale.className="jomsScale";this.scale.style.width="360px";this.scale.style.height="25px";this.scaleBar=cel("img");this.scaleBar.id="scale-bar"+this.app.name;this.scaleBar.className="jomsScaleBar";this.scaleBar.src=Joms.blankImage;this.scaleBar.width="360";this.scaleBar.height="25";this.scaleBar.style.width="360px";this.scaleBar.style.height="25px";this.scale.appendChild(this.scaleBar);this.app.el.appendChild(this.scale);this.app.scale=this;this.app.hooks.register("zoomChanged",this.changeScale,this);this.changeScale()};Joms.Scale.prototype={app:null,scaleBar:null,scale:null,hide:function(){this.scale.style.display="none"},show:function(){this.scale.style.display="block"},changeScale:function(){if(!Joms.browser.hasPngSupport()){this.scale.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+Joms.baseUrl+"data/server.php?t=sc&a="+Joms.appId+"&map="+this.app.mapId+"&zoom="+(this.app.map.zoom.id+this.app.map.zoom.first)+"',sizingMethod='scale');";this.scaleBar.src=Joms.blankImage}else{this.scaleBar.src=Joms.baseUrl+"data/server.php?t=sc&a="+Joms.appId+"&map="+this.app.mapId+"&zoom="+(this.app.map.zoom.id+this.app.map.zoom.first)}}};Joms.NativeObjects=function(B,A){if(!B){Joms.error("Joms.NativeObjects","Objekt aplikace nebyl definován.");return }this.app=B;if(this.app.objectList){Joms.error("Joms.NativeObjects","Nelze vytvořit objekt ObjectList a NativeObjects zároveň.");return }if(!this.app.initialized){Joms.error("Joms.NativeObjects","Objekt vytvořte až po zavolání metody init v Joms.App.");return }this.app.nativeObjects=this;this.categories=A;this.app.hooks.register("zoomChanged",this.reload,this);this.reload()};Joms.NativeObjects.prototype={categories:null,app:null,reload:function(){this.app.map.getLayer("mapIcons").setView(this.app.map.leftBottomView)},hide:function(){this.app.map.getLayer("mapIcons").hide()},show:function(){this.app.map.getLayer("mapIcons").show();this.reload()}};Joms.ZoomControlConf=function(A){};Joms.ZoomControlConf.prototype={plus:Array(Joms.baseUrl+"images/zoom-control/plus.png",26,21,"png"),minus:Array(Joms.baseUrl+"images/zoom-control/minus.png",26,21,"png"),barwithout:Array(Joms.baseUrl+"images/zoom-control/without.png",26,13,"png"),barwith:Array(Joms.baseUrl+"images/zoom-control/with.png",26,13,"png"),elname:null,vertical:true};Joms.VisibilityGroupControll=function(C,B,A){this.app=C;this.ctrlList=new Array();this.app.hooks.register("mapClicked",this.mapClicked,this)};Joms.VisibilityGroupControll.prototype={app:null,ctrlList:null,nextCtrlPos:5,add:function(A){this.ctrlList.push(A);A.setGroup(this);A.el.style.right=this.nextCtrlPos+"px";this.nextCtrlPos+=A.width+3;A.hide()},addButton:function(){},hideAll:function(){for(var A=0;A<this.ctrlList.length;A++){this.ctrlList[A].hide()}},mapClicked:function(){this.hideAll()}};Joms.VisibilityControll=function(E,B,D,A){this.app=E;this.el=cel("div");this.el.className="jomsVisibilityControl";this.app.el.appendChild(this.el);Joms.addTransparentBg(this.el);this.el.style.width=D+"px";var C=cel("a");C.href="";C.appendChild(ctn(B));this.el.appendChild(C);Event.addEvent(C,"click",Event.preventDefault,false);this.width=D;this.controlledEl=A;this.iconMouseUpEvent=this.iconMouseUp.bindAsEventListener(this);this.iconMouseOverEvent=this.iconMouseOver.bindAsEventListener(this);this.iconMouseOutEvent=this.iconMouseOut.bindAsEventListener(this);Event.addEvent(this.el,"mouseup",this.iconMouseUpEvent,false);Event.addEvent(this.controlledEl,"mouseover",this.iconMouseOverEvent,false);Event.addEvent(this.controlledEl,"mouseout",this.iconMouseOutEvent,false);Event.addEvent(this.el,"mouseup",Event.preventDefault,false);Event.addEvent(this.el,"mousedown",Event.stopEvent,false);Event.addEvent(this.el,"contextmenu",Event.preventDefault,false)};Joms.VisibilityControll.prototype={app:null,el:null,width:null,controlledEl:null,group:null,ctrlPos:0,visible:false,autoCloseTimeMs:1000,timerWrapper:null,setGroup:function(A){this.group=A;this.ctrlPos=A.nextCtrlPos;this.visible=false;this.controlledEl.style.display="none"},show:function(){this.group.hideAll();this.controlledEl.style.top="28px";this.controlledEl.style.right=this.ctrlPos+"px";this.controlledEl.style.display="block";this.visible=true},hide:function(){if(this.visible){this.visible=false;this.controlledEl.style.display="none"}},iconMouseOver:function(B){var A=Event.getElement(B);if(this.timerWrapper!=null){this.timerWrapper.cancel();this.timerWrapper=null}},iconMouseOut:function(B){var A=Event.getElement(B);this.setCloseTimer(this.autoCloseTimeMs)},setCloseTimer:function(A){if(this.timerWrapper==null){this.timerWrapper=new CCallWrapper(this,A,"onCloseTimer");CCallWrapper.asyncExecute(this.timerWrapper)}},iconMouseUp:function(A){if(!this.visible){this.show();this.setCloseTimer(this.autoCloseTimeMs*3)}else{this.hide()}},onCloseTimer:function(){this.hide();this.timerWrapper=null}};Joms.Button=function(C,A,B){this.app=C;this.el=cel("div");this.el.className="jomsVisibilityControl";this.app.el.appendChild(this.el);Joms.addTransparentBg(this.el);this.el.style.width=B+"px";this.aEl=cel("a");this.aEl.href="";this.aEl.target="_blank";this.aEl.appendChild(ctn(A));this.el.appendChild(this.aEl);this.iconMouseUpEvent=this.iconMouseUp.bindAsEventListener(this);Event.addEvent(this.el,"mouseup",this.iconMouseUpEvent,false);Event.addEvent(this.el,"mouseup",Event.preventDefault,false);Event.addEvent(this.el,"mousedown",Event.stopEvent,false);Event.addEvent(this.el,"contextmenu",Event.preventDefault,false)};Joms.Button.prototype={app:null,el:null,width:null,onClick:null,show:function(){},hide:function(){},setGroup:function(){},iconMouseUp:function(A){this.aEl.href=Joms.getAppUrl()+"#"+this.app.query.createUrlParams()}};Joms.GeocodingResult=function(B,A){this.position=new Joms.Coord(B.x,B.y);this.geoType=B.type;this.city=B.city;this.part=B.part;this.street=B.street;this.cp=B.cp;this.co=B.co;this.district=B.district;this.zipCode=B.zipCode;this.orderId=A};Joms.GeocodingResult.prototype={position:null,type:"geocoding",geoType:null,city:null,part:null,street:null,cp:null,co:null,district:null,zipCode:null,getIcon:function(){return this.geoType+".gif"},getTypeName:function(){if(this.geoType=="cp"){return"dům, číslo popisné"}else{if(this.geoType=="s"){return"ulice"}else{if(this.geoType=="p"){return"část obce"}else{if(this.geoType=="c"){return"obec"}}}}},toString:function(){var A="";if(this.geoType=="cp"){A+=this.street;if(this.co!=undefined){A+=" "+this.co+"/"+this.cp}else{A+=" "+this.cp}A+=", "+this.city;if(this.part!=undefined){A+=" ("+this.part+")"}}else{if(this.geoType=="s"){A+=this.street;A+=", "+this.city;if(this.part!=undefined){A+=" ("+this.part+")"}}else{if(this.geoType=="p"){A+=this.part;A+=", "+this.city}else{if(this.geoType=="c"){A+=this.city}}}}if(this.district!=undefined){A+=", okres "+this.district}return A}};Joms.Geocoding=function(B,A){this.app=B;if(typeof A=="undefined"){A=new Joms.GeocodingConf()}this.cfg=A};Joms.GeocodingConf=function(){this.setSearchRectFromMapsBorder()};Joms.GeocodingConf.prototype={searchRect:null,searchInCities:true,searchInStreets:true,setSearchRectFromMapsBorder:function(){this.searchRect=new Joms.Rect(new Joms.Coord(Joms.mapBorder.ldx,Joms.mapBorder.ldy),new Joms.Coord(Joms.mapBorder.phx,Joms.mapBorder.phy))}};Joms.Geocoding.prototype={app:null,cfg:null,results:null,envelopeRect:null,getResultCount:function(){if(this.results==null){return 0}return this.results.length},showResults:function(E,F,G){if(F){this.zoomToResults()}var D=this.getLayer();D.clear();if(this.results!=null){for(var C=0;C<this.results.length;C++){var B=this.results[C];var A=new Joms.Marker(this.app,B.position,E);if(G){A.setClickAction(G,A,B)}A.setTitle(B.toString());D.add(A)}}},hideResults:function(){var A=this.getLayer();this.layer.clear()},zoomToResults:function(){if(this.envelopeRect!=null){this.app.map.zoomToRect(this.envelopeRect)}},searchText:function(B){this.reset();var A=this.app.getServletContext();if(this.cfg.searchRect!=null){A.addCommand("geoCodingSetResultBoundaryRect",this.cfg.searchRect.lb.x,this.cfg.searchRect.lb.y,this.cfg.searchRect.rt.x,this.cfg.searchRect.rt.y)}A.addCommand("geoCodingSetSearchParams",this.cfg.searchInStreets,this.cfg.searchInCities);A.setReturn("geoCodingTextSearchJson",removeDiacritics(B),true);this._sendAndHandleRequest(A,"text")},searchStreetsInCity:function(B){this.reset();var A=this.app.getServletContext();A.setReturn("geocodingGetStreetsInCity",true,removeDiacritics(B),"json");this._sendAndHandleRequest(A,"streetsincity")},searchNearestCp:function(C,B){this.reset();var A=this.app.getServletContext();A.setReturn("geocodingInverseSearchJson",C.x,C.y,B);this._sendAndHandleRequest(A,"nearestcp")},searchCpInCity:function(C,B){this.reset();var A=this.app.getServletContext();A.setReturn("geocodingSearchCpInCity",true,C,removeDiacritics(B),"json");this._sendAndHandleRequest(A,"cpincity")},_sendAndHandleRequest:function(A,C){var B=A.createRequest();new Joms.Ajax.Request(this,Joms.dataScript+"?t=servlet&"+B,true,function(E){var D=E.parseJSON();if(D[0]==null){A.update(D[1]);this.setResults(D[2]);this.app.hooks.call("geoSearched",this,C)}else{}})},getLayer:function(){var A;if(typeof this.layer=="undefined"){A=new Joms.CustomLayer(this.app,"geocodingResults",15);this.layer=A}return this.layer},setResults:function(B){if(B!=null){var D,A;this.results=new Array();for(D=0,A=B.length;D<A;++D){var C=new Joms.GeocodingResult(B[D]);this.results[D]=C;if(this.envelopeRect==null){this.envelopeRect=new Joms.Rect(C.position)}else{this.envelopeRect.enlargePoint(C.position)}}}},reset:function(){this.results=null;this.envelopeRect=null;if(this.layer){this.layer.clear()}}};Joms.ServletContext=function(A){this.app=A;this.id="new";this.hash=null};Joms.ServletContext.prototype={id:null,hash:null,app:null,commands:null,returnCommand:null,sendRequest:function(A){if(A==undefined){A=false}var B="?t=servlet&"+this.createRequest();new Joms.Ajax.Request(this,Joms.dataScript+(A?"":B),false,function(D){var C=D.parseJSON();if(C[0]!=null){this.app.error(C[0].id,C[0].name,C[0].desc)}else{return C}},(A?"post":"get"),(A?B:""))},isValid:function(){if(this.hash==null||this.hash==false){return false}return true},update:function(A){this.id=A.cid;this.hash=A.chash},addCommand:function(A){var C=A;for(var B=1;B<this.addCommand.arguments.length;B++){C+=";"+this.addCommand.arguments[B]}if(this.commands==null){this.commands=C}else{this.commands+="%0A"+C}},setReturn:function(A){var C=A;for(var B=1;B<this.setReturn.arguments.length;B++){C+=";"+this.setReturn.arguments[B]}this.returnCommand=C},createRequest:function(){var A=this.createRequestEx(this.commands,this.returnCommand);this.commands=null;this.returnCommand=null;return A},createRequestEx:function(A,C){var B="";B+="context="+this.id;if(A!=null){B+="&commands="+encodeURI(A)}if(C!=null){B+="&return="+encodeURI(C)}return B}};Joms.Destination=function(B,C,A){this.app=B;this.id=C;this.markerId=A};Joms.Destination.prototype={app:null,markerId:null,id:null,marker:null,position:null,geoQueryText:null,searchResults:null,name:null,iterationId:null,distance:null,nearestPoint:null,nearestPointHeight:0,setPosition:function(A){this.position=A.clone()},setQuery:function(A){this.geoQueryText=A}};Joms.Route=function(B,C,A){this.app=B;this.id=C;if(typeof A=="undefined"){A=new Joms.RouteConf()}this.cfg=A;this.destinationList=new Array();this.defaultDestIcon=new Joms.Icon("http://api.webmapy.cz/images/flag.png",53,46,Joms.IconCenter.BOTTOM_LEFT,"png");this.defaultDestIcon.setHighlightUrl("http://api.webmapy.cz/images/flag_red.png");this.defaultDestIcon.setIconDragPosition(10,25);this.defaultDestIcon.setIconInnerTextPosition(2,5,20,19)};Joms.Route.prototype={app:null,cfg:null,valid:0,visible:true,destinationList:null,id:"",length:0,time:0,ascent:0,descent:0,envelopeRect:null,iconsLayer:null,defaultDestIcon:null,addDestination:function(C,B){if(B==undefined){B=this.destinationList.length}var A=new Joms.Destination(this.app,B,this.destinationList.length+1);if(typeof C=="object"){A.setPosition(C);A.marker=this.addDestinationMarker(C,A)}else{A.setQuery(C)}this.destinationList[this.destinationList.length]=A;if(this.cfg.autoUpdate&&this.destinationList.length>1){this.search()}return A},addDestinationNamedPos:function(D,B,C){if(C==undefined){C=this.destinationList.length}if(B==undefined||B==""){B=D.toGpsString()}var A=new Joms.Destination(this.app,C,this.destinationList.length+1);A.name=B;A.setPosition(D);A.marker=this.addDestinationMarker(D,A);this.destinationList[this.destinationList.length]=A;if(this.cfg.autoUpdate&&this.destinationList.length>1){this.search()}return A},removeDestination:function(A){var B=Joms.obtainObjectIndexInArray(this.destinationList,A);if(B==-1){return false}this.destinationList.splice(B,1);this.layer.remove(A.marker);delete A;if(this.cfg.autoUpdate){if(this.destinationList.length>1){this.search()}else{this.destroyRoute()}}return true},removeLastDestination:function(){this.removeDestination(this.destinationList[this.destinationList.length-1])},getDestinations:function(){return this.destinationList},setCriterium:function(B,A){this.cfg.criterium=B;this.cfg.criteriumParam=A;if(this.cfg.autoUpdate){this.search()}},banRoutesInArea:function(B,A){var C=this.app.getServletContext();C.addCommand("routingBanRoutesInArea",B.x,B.y,A);C.setReturn("getContextInfoJson");C.sendRequest();if(this.cfg.autoUpdate){this.search()}},unbanAllRoutes:function(){var A=this.app.getServletContext();A.addCommand("routingUnbanAllRoutes");A.setReturn("getContextInfoJson");A.sendRequest();if(this.cfg.autoUpdate){this.search()}},show:function(){if(this.valid&&!this.visible){var A=this.app.getServletContext();A.addCommand("mapShowRoute",this.id,true);A.setReturn("getContextInfoJson");A.sendRequest();this.app.map.getLayer("servlet").addRoute(this);this.visible=true;if(this.layer){this.layer.show()}}},hide:function(){if(this.valid&&this.visible){var A=this.app.getServletContext();A.addCommand("mapShowRoute",this.id,false);A.setReturn("getContextInfoJson");A.sendRequest();this.app.map.getLayer("servlet").removeRoute(this);this.visible=false;if(this.layer){this.layer.hide()}}},destroy:function(){if(this.valid){var A=this.app.getServletContext();A.addCommand("routingReset","route",this.id);A.setReturn("getContextInfoJson");A.sendRequest();this.destroyRoute()}if(this.layer){this.layer.clear()}this.app.map.hideMark();this.destinationList=new Array()},destroyRoute:function(){this.app.map.getLayer("servlet").removeRoute(this);this.valid=false;this.length=0;this.time=0;this.app.hooks.call("routeDestroyed",this)},search:function(A){if(this.destinationList.length<2){return false}var B=this.app.getServletContext();B.addCommand("routingReset","destinations");if(this.cfg.searchRect!=null){B.addCommand("geoCodingSetResultBoundaryRect",this.cfg.searchRect.lb.x,this.cfg.searchRect.lb.y,this.cfg.searchRect.rt.x,this.cfg.searchRect.rt.y)}for(i=0,l=this.destinationList.length;i<l;++i){var C=this.destinationList[i];if(C.geoQueryText!=null){B.addCommand("routingAddDestinationGeo",removeDiacritics(C.geoQueryText))}else{if(C.position!=null){if(C.name!=null){B.addCommand("routingAddDestinationNamedCoord",C.position.x,C.position.y,C.name)}else{B.addCommand("routingAddDestinationCoord",C.position.x,C.position.y)}}else{}}}B.addCommand("routingSearchRoute",this.cfg.criterium,this.cfg.criteriumParam,this.id);this._setRouteParamsAndReturnFnc(B);this.sendRequestAndUpdateRouteInfo(B,false);return true},searchHighwayDetour:function(B,C,D){var A=this.app.getServletContext();A.addCommand("routingReset","destinations");A.addCommand("routingSearchSmsDetour",B,C,D,this.id);this._setRouteParamsAndReturnFnc(A);this.sendRequestAndUpdateRouteInfo(A,true)},searchCycleTrack:function(B){var A=this.app.getServletContext();A.addCommand("routingReset","destinations");A.addCommand("routingSearchRouteCycleById",this.id,B);this._setRouteParamsAndReturnFnc(A);this.sendRequestAndUpdateRouteInfo(A,true)},isValid:function(){return this.valid},getLength:function(){if(!this.valid){return""}if(this.length<1){return(this.length*1000)+" m"}else{return(this.length)+" km"}},getTime:function(){if(!this.valid){return""}var D=Math.floor(this.time);var C=D%60;var A=Math.floor(D/60)%60;var B=Math.floor(D/3600)%24;return B+":"+(A<10?"0"+A:A)+":"+(C<10?"0"+C:C)},getItinerary:function(C,B,G,F,E){var D;if(!this.valid){return }if(typeof C=="object"&&C.nodeType==1){D=C}else{D=gid(C)}if(D==null){this.app.warning(1,"Joms.Route","Neplatný element pro výpis itineráře.");return }var A=this.app.getServletContext();new Joms.Ajax.Request(this,Joms.dataScript+"?t=ri&context="+A.id+"&trackId="+this.id+"&detailed="+(B?1:0)+"&printDestinations="+(G?1:0)+"&printRouteDesc="+(F?1:0)+"&printStats="+(E?1:0),true,function(H){D.innerHTML=H;this.createCrossroadHrefs(D)})},getNetmapItinerary:function(D,B){var C;if(typeof D=="string"){C=gid(D)}else{C=D}if(!this.valid){return }if(C==null){this.app.warning(1,"Joms.Route","Neplatný element pro výpis itineráře.");return }if(B==undefined){B=true}var A=this.app.getServletContext();new Joms.Ajax.Request(this,Joms.dataScript+"?t=rinetmap&context="+A.id+"&trackId="+this.id+"&detailed="+B+"&lang="+Joms.lang,true,function(E){C.innerHTML=E;this.app.hooks.call("routeItineraryCreated",this)})},getHeightProfile:function(C,D,A){var E=gid(C);var B=this.app.getServletContext();if(!this.valid){return }if(D==undefined){D=this.app.mapWidth-18}if(A==undefined){A=170}if(E==null){this.app.error(0,"Joms.Route","Neplatný element pro výpis profilu.");return }E.innerHTML="";new Joms.Ajax.Request(this,Joms.dataScript+"?t=rhp&context="+B.id+"&trackId="+this.id+"&width="+D+"&height="+A,true,function(F){var G=F.parseJSON();if(G[0]==null){G[1].src=Joms.dataScriptUrl+"?t=rhpimg&context="+B.id+"&width="+D+"&height="+A+"&a="+Joms.appId+"&trackId="+this.id+"&time="+(new Date()).getTime();this.app.hooks.call("routeHeightProfileCreated",this,G)}})},createCrossroadHrefs:function(E){var D,C,A;D=getElementsByClass("cross",E,"a");for(C=0,A=D.length;C<A;++C){var B=D[C].id.split("_");if(B.length==4){Joms.Event.addClickEvent(D[C],this.zoomToCrossroad.bindAsEventListener(this),false)}else{Joms.Event.addClickEvent(D[C],this.zoomToPart.bindAsEventListener(this),false)}}},zoomToRoute:function(){if(this.valid){this.app.map.zoomToRect(this.envelopeRect)}},zoomToCrossroad:function(C){var B=Joms.Event.getElement(C);var A=B.id.split("_");this.app.map.setMark(new Joms.Coord(A[2],A[3]),true)},zoomToPart:function(C){var B=Joms.Event.getElement(C);var A=B.id.split("_");this.app.map.setMark(new Joms.Coord(A[2],A[3]),true)},sendRequestAndUpdateRouteInfo:function(A,C){var B=Joms.dataScript+"?t=servlet&"+A.createRequest();new Joms.Ajax.Request(this,B,false,function(F){var E=F.parseJSON();if(E[0]==null){A.update(E[1]);if(E[2]){this.setResult(E[2],C);this.app.map.getLayer("servlet").addRoute(this,A);this.app.hooks.call("routeSearched",this,C)}else{this.valid=false;this.app.hooks.call("routeSearchFailed",this)}}else{this.valid=false;this.length=0;this.time=0;var D="";switch(E[0].id){case 401:case 406:case 407:D="Trasa nebyla nalezena";break;case 408:D="Nejbližší úsek k destinaci nebyl nalezen";break;case 413:D="Adresa nebyla nalezena";break;case 414:D="Trasa je příliš dlouhá";break;default:this.app.error(E[0].id,E[0].name,E[0].desc);return }this.app.hooks.call("routeSearchFailed",this,E[0].id,D)}})},setResult:function(F,E){var D,B;this.length=F.length;this.time=F.time;this.ascent=F.ascent;this.descent=F.descent;this.envelopeRect=new Joms.Rect(new Joms.Coord(F.tl_x,F.br_y),new Joms.Coord(F.br_x,F.tl_y));this.envelopeRect.normalize();this.valid=true;if(E){if(this.layer){this.layer.clear()}this.app.map.hideMark();this.destinationList=new Array();for(D=0,B=F.destinations.length;D<B;++D){var A=F.destinations[D];var C=new Joms.Destination(this.app,D,D+1);C.position=new Joms.Coord(A.x,A.y);C.marker=this.addDestinationMarker(C.position,C);this.setResultDestination(C,A);this.destinationList[D]=C}this.cfg.criterium=Joms.Route.Criterium.CYCLE_MEDIUM;this.cfg.criteriumParam=true}else{for(D=0,B=this.destinationList.length;D<B;++D){var C=this.destinationList[D];var A=F.destinations[D];if(C.position==null){C.position=new Joms.Coord(A.x,A.y)}if(C.marker==null){C.marker=this.addDestinationMarker(C.position,C)}this.setResultDestination(C,A)}}},getDefinition:function(){var B=""+this.cfg.criterium+";"+this.cfg.criteriumParam;for(i=0,l=this.destinationList.length;i<l;++i){var A=this.destinationList[i];B+=";"+Math.floor(A.position.x)+";"+Math.floor(A.position.y)+";";if(A.name){B+=A.name}}return B},setResultDestination:function(B,A){B.name=A.name;if(this.cfg.enableDestinationDrag){B.marker.setTitle(B.name+", tažením lze průjezdní bod posunout")}else{B.marker.setTitle(B.name)}B.nearestPoint=new Joms.Coord(A.npx,A.npy);B.nearestPointHeight=A.nph;B.distance=A.distance;B.searchResults=A.results},addDestinationMarker:function(C,B){var A=new Joms.Marker(this.app,C,this.defaultDestIcon);A.setInnerText(B.markerId,"netmapSearchResultIconText");if(this.cfg.enableDestinationDrag){A.enableDrag(this.destinationMarkerDragEnd,this,B);A.enableHighlightOnMouseOver();A.setTitle(C.toGpsString()+", tažením lze průjezdní bod posunout")}else{A.setTitle(C.toGpsString())}if(typeof this.layer=="undefined"){this.layer=new Joms.CustomLayer(this.app,this.id,15)}this.layer.add(A);return A},destinationMarkerDragEnd:function(A,B){if(B.position){if(B.position.distance(this.position)==0){return }}B.setPosition(this.position);this.app.hooks.call("routeDestinationPositionChanged",A,B)},updateDrawParams:function(){var A=this.app.getServletContext();this._setRouteParamsAndReturnFnc(A);this.sendRequestAndUpdateRouteInfo(A,false)},_setRouteParamsAndReturnFnc:function(A){A.addCommand("mapSetRouteDrawParams",this.id,this.cfg.drawLine,this.cfg.drawArrows,1,1,this.cfg.trackLineWidth,this.cfg.trackLineColor,this.cfg.trackArrowColor,this.cfg.drawDestinationLine);A.addCommand("mapSetRouteDrawIcons",this.id,"angel_flag","circle");A.setReturn("getRouteInfoJson",this.id)}};Joms.Route.Criterium={MINLENGTH:1,MINTIME:3,MAXSPEED:3,ECONOMIC:4,CYCLE_LOW:11,CYCLE_MEDIUM:12,CYCLE_HIGH:13,CYCLE_ROAD:17,TOURIST_SHORTEST:21,TOURIST:22};Joms.RouteConf=function(){};Joms.RouteConf.prototype={criterium:Joms.Route.Criterium.MINLENGTH,criteriumParam:true,autoUpdate:false,drawLine:true,drawArrows:1,drawDestinationLine:1,trackLineWidth:15,trackLineColor:"0000FF88",trackArrowColor:"FFFFFFAA",searchRect:null,enableDestinationDrag:false};Joms.Polyline=function(C,D,A,B){this.app=C;this.id=D;this.envelopeRect=null;this.points=new Array();this.width=5;this.strokeType=Joms.Polyline.Stroke.SOLID;if(A==undefined){this.type=Joms.Polyline.Type.LINE}else{this.type=A}if(B==undefined){this.renderer=new Joms.PolylineServletRenderer(this.app)}else{this.renderer=B}};Joms.Polyline.Type={LINE:1,CLOSED_LINE:2,POLYGON:3};Joms.Polyline.Stroke={SOLID:1,DASHED:2,DOT:3};Joms.Polyline.prototype={app:null,renderer:null,envelopeRect:null,visible:true,id:null,points:null,callback:null,args:null,type:Joms.Polyline.Type.LINE,width:5,color:"FF0000FF",strokeType:Joms.Polyline.Stroke.SOLID,sizeWithMppx:false,drawPoints:false,fillColor:"000000AA",addPoint:function(A){for(var B=0;B<this.addPoint.arguments.length;B++){var C=this.addPoint.arguments[B];this.points.push(C)}this._setEnvRect()},addPointNumArr:function(B){for(var A=0;A<this.addPointNumArr.arguments.length-1;A+=2){var C=new Joms.Coord(this.addPointNumArr.arguments[A],this.addPointNumArr.arguments[A+1]);this.points.push(C)}this._setEnvRect()},removePoint:function(A){if(A.rap){A.rap.remove();A.rap=null}var B=Joms.removeObjectFromArr(this.points,A);this._setEnvRect();return B},setClickAction:function(){this.args=Array.prototype.slice.call(this.setClickAction.arguments);this.callback=this.args.shift()},remove:function(){this.renderer.remove(this);this.reset()},reset:function(){for(var A=0;A<this.points.length;A++){var B=this.points[A];if(B.rap){B.rap.remove();B.rap=null}}this.envelopeRect=null;this.points=new Array()},redraw:function(){this.renderer.render(this)},zoomToLine:function(){this.app.map.zoomToRect(this.envelopeRect)},getPointCount:function(){return this.points.length},getLength:function(){if(this.points.length<2){return 0}var C=0;var A=this.points[0];for(var B=1;B<this.points.length;B++){p=this.points[B];C+=p.distance(A);A=p}return C},setType:function(A){this.type=A},setWidth:function(A){this.width=Math.min(A,30);this.width=Math.max(A,1)},setStroke:function(A){this.strokeType=A},setColor:function(A){this.color=A},setFillColor:function(A){this.fillColor=A},show:function(){if(!this.visible){this.visible=true;this.renderer.show(this)}},hide:function(){if(this.visible){this.visible=false;this.renderer.hide(this)}},_pointClicked:function(A){if(this.callback==null){return }if(this.args!=undefined||this.args!=null){this.callback.apply(this,this.args.concat([this,A]))}else{this.callback.call(this)}},_setEnvRect:function(){this.envelopeRect=null;if(this.points.length==0){return }this.envelopeRect=new Joms.Rect(this.points[0]);for(var A=1;A<this.points.length;A++){this.envelopeRect.enlargePoint(this.points[A])}}};Joms.PolylineServletRenderer=function(A){this.app=A};Joms.PolylineServletRenderer.prototype={app:null,remove:function(B){var A=this.app.getServletContext();A.addCommand("mapDeleteLine",B.id);A.setReturn("getContextInfoJson");A.sendRequest();this.app.map.getLayer("servlet").removeLine(B)},show:function(B){var A=this.app.getServletContext();A.addCommand("mapShowLine",B.id,true);A.setReturn("getContextInfoJson");A.sendRequest();this.app.map.getLayer("servlet").addLine(B)},showCategory:function(B){var A=this.app.getServletContext();A.addCommand("mapShowLine",B,true);A.setReturn("getContextInfoJson");A.sendRequest();this.app.map.getLayer("servlet").addLine(line)},hide:function(B){var A=this.app.getServletContext();A.addCommand("mapShowLine",B.id,false);A.setReturn("getContextInfoJson");A.sendRequest();this.app.map.getLayer("servlet").removeLine(B)},render:function(B){if(B.points.length==0){return }var A=this.app.getServletContext();A.addCommand("mapAddLine",B.id,"jomsapi",B.width,B.color,B.type,B.strokeType,B.fillColor,B.sizeWithMppx);var D="mapAddLinePoint;"+B.id;for(var C=0;C<B.points.length;C++){var E=B.points[C];D+=";"+E.x+";"+E.y}A.addCommand(D);A.addCommand("mapShowLine",B.id,B.visible);A.setReturn("getContextInfoJson");new Joms.Ajax.Request(this,Joms.dataScript+"?t=servlet&"+A.createRequest(),false,function(G){var F=G.parseJSON();if(F[0]==null){A.update(F[1]);this.app.map.getLayer("servlet").addLine(B,A)}else{Joms.error("Joms.PolylineServletRenderer","Comunication error")}})}};var Raphael=(function(){var E=/[, ]+/,M,g=document,F=window,G=function(){return M.apply(G,arguments)},N={},A={cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10",height:0,href:"http://raphaeljs.com/",opacity:1,path:"M0,0",r:0,rx:0,ry:0,scale:"1 1",src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,target:"_blank",title:"Raphael",width:0,x:0,y:0},B=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup"];G.version="0.7.3";G.type=(window.SVGAngle?"SVG":"VML");G.svg=!(G.vml=G.type=="VML");G.idGenerator=0;G.fn={};G.toString=function(){return"Your browser "+(this.vml?"doesn't ":"")+"support"+(this.svg?"s":"")+" SVG.\nYou are running "+unescape("Rapha%EBl%20")+this.version};G.setWindow=function(R){F=R;g=F.document};G.parsePathString=function(R){var m={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},h=[],k=function(){var o="";for(var n=0,q=this.length;n<q;n++){o+=this[n][0]+this[n].join(",").substring(2)}return o};if(R.toString.toString()==k.toString()){return R}R.replace(/([achlmqstvz])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?\s*,?\s*)+)/ig,function(o,n,s){var r=[],q=n.toLowerCase();s.replace(/(-?\d*\.?\d*(?:e[-+]?\d+)?)\s*,?\s*/ig,function(u,t){t&&r.push(+t)});while(r.length>=m[q]){h.push([n].concat(r.splice(0,m[q])));if(!m[q]){break}}});h.toString=k;return h};var O=function(u){var R=u;if(typeof u=="string"){R=Raphael.parsePathString(u)}R=b(R);var q=[],o=[],h=0;for(var m=0,t=R.length;m<t;m++){switch(R[m][0]){case"Z":break;case"A":q.push(R[m][R[m].length-2]);o.push(R[m][R[m].length-1]);break;default:for(var k=1,n=R[m].length;k<n;k++){if(k%2){q.push(R[m][k])}else{o.push(R[m][k])}}}}var s=Math.min.apply(Math,q),r=Math.min.apply(Math,o);return{x:s,y:r,width:Math.max.apply(Math,q)-s,height:Math.max.apply(Math,o)-r,X:q,Y:o}};var b=function(h){var o=[];if(typeof h=="string"){h=G.parsePathString(h)}var r=0,q=0,R=0;if(h[0][0]=="M"){r=+h[0][1];q=+h[0][2];R++;o[0]=h[0]}for(var m=R,s=h.length;m<s;m++){o[m]=[];if(h[m][0]!=(h[m][0]+"").toUpperCase()){o[m][0]=(h[m][0]+"").toUpperCase();switch(o[m][0]){case"A":o[m][1]=h[m][1];o[m][2]=h[m][2];o[m][3]=0;o[m][4]=h[m][4];o[m][5]=h[m][5];o[m][6]=+(h[m][6]+r).toFixed(3);o[m][7]=+(h[m][7]+q).toFixed(3);break;case"V":o[m][1]=+h[m][1]+q;break;default:for(var k=1,n=h[m].length;k<n;k++){o[m][k]=+h[m][k]+((k%2)?r:q)}}}else{o[m]=h[m]}switch(o[m][0]){case"Z":break;case"H":r=o[m][1];break;case"V":q=o[m][1];break;default:r=o[m][o[m].length-2];q=o[m][o[m].length-1]}}o.toString=h.toString;return o};var U=function(){var k,h,n,m,R;if(typeof arguments[0]=="string"||typeof arguments[0]=="object"){if(typeof arguments[0]=="string"){k=g.getElementById(arguments[0])}else{k=arguments[0]}if(k.tagName){if(arguments[1]==null){return{container:k,width:k.style.pixelWidth||k.offsetWidth,height:k.style.pixelHeight||k.offsetHeight}}else{return{container:k,width:arguments[1],height:arguments[2]}}}}else{if(typeof arguments[0]=="number"&&arguments.length>3){return{container:1,x:arguments[0],y:arguments[1],width:arguments[2],height:arguments[3]}}}};var P=function(R,h,k){for(var m in k){if(!(m in R)){switch(typeof k[m]){case"function":R[m]=R===h?k[m]:function(){k[m].apply(h,arguments)};break;case"object":R[m]={};P(R[m],R,k[m]);break;default:R[m]=k[m];break}}}};if(G.svg){var J=function(m,R,n){var h=g.createElementNS(n.svgns,"path");h.setAttribute("fill","none");if(n.canvas){n.canvas.appendChild(h)}var k=new Q(h,n);k.isAbsolute=true;k.type="path";k.last={x:0,y:0,bx:0,by:0};k.absolutely=function(){this.isAbsolute=true;return this};k.relatively=function(){this.isAbsolute=false;return this};k.moveTo=function(o,s){var r=this.isAbsolute?"M":"m";r+=parseFloat(o,10).toFixed(3)+" "+parseFloat(s,10).toFixed(3)+" ";var q=this[0].getAttribute("d")||"";(q=="M0,0")&&(q="");this[0].setAttribute("d",q+r);this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(o,10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(s,10);this.attrs.path=q+r;return this};k.lineTo=function(o,s){this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(o,10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(s,10);var r=this.isAbsolute?"L":"l";r+=parseFloat(o,10).toFixed(3)+" "+parseFloat(s,10).toFixed(3)+" ";var q=this[0].getAttribute("d")||"";this[0].setAttribute("d",q+r);this.attrs.path=q+r;return this};k.andClose=function(){var o=this[0].getAttribute("d")||"";this[0].setAttribute("d",o+"Z ");this.attrs.path=o+"Z ";return this};if(R){k.attrs.path=""+R;k.absolutely();N.pathfinder(k,k.attrs.path)}if(m){W(k,m)}return k};var C=function(h){if(h.pattern){var R=h.node.getBBox();h.pattern.setAttribute("patternTransform","translate("+[R.x,R.y].join(",")+")")}};var W=function(m,q){var v={"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},R=function(AI,AH){AH=v[AH.toString().toLowerCase()];if(AH){var AF=AI.attrs["stroke-width"]||"1",AC={round:AF,square:AF,butt:0}[AI.attrs["stroke-linecap"]||q["stroke-linecap"]]||0,AG=[];for(var AD=0,AE=AH.length;AD<AE;AD++){AG.push(AH[AD]*AF+((AD%2)?1:-1)*AC)}AH=AG.join(",");AI.node.setAttribute("stroke-dasharray",AH)}};for(var t in q){if(!(t in A)){continue}var z=q[t];m.attrs[t]=z;switch(t){case"href":case"title":case"target":var n=m.node.parentNode;if(n.tagName.toLowerCase()!="a"){var h=g.createElementNS(m.svg.svgns,"a");n.insertBefore(h,m.node);h.appendChild(m.node);n=h}n.setAttributeNS(m.svg.xlink,t,z);break;case"path":if(m.type=="path"){m.node.setAttribute("d","M0,0");N.pathfinder(m,z)}case"rx":case"cx":case"x":m.node.setAttribute(t,z);C(m);break;case"ry":case"cy":case"y":m.node.setAttribute(t,z);C(m);break;case"width":m.node.setAttribute(t,z);break;case"height":m.node.setAttribute(t,z);break;case"src":if(m.type=="image"){m.node.setAttributeNS(svg.xlink,"href",z)}break;case"stroke-width":m.node.style.strokeWidth=z;m.node.setAttribute(t,z);if(m.attrs["stroke-dasharray"]){R(m,m.attrs["stroke-dasharray"])}break;case"stroke-dasharray":R(m,z);break;case"fill":var s=z.match(/^url\(([^\)]+)\)$/i);if(s){var k=g.createElementNS(m.svg.svgns,"pattern");var AB=g.createElementNS(m.svg.svgns,"image");k.id="raphael-pattern-"+Raphael.idGenerator++;k.setAttribute("x",0);k.setAttribute("y",0);k.setAttribute("patternUnits","userSpaceOnUse");AB.setAttribute("x",0);AB.setAttribute("y",0);AB.setAttributeNS(m.svg.xlink,"href",s[1]);k.appendChild(AB);var r=g.createElement("img");r.style.position="absolute";r.style.top="-9999em";r.style.left="-9999em";r.onload=function(){k.setAttribute("width",this.offsetWidth);k.setAttribute("height",this.offsetHeight);AB.setAttribute("width",this.offsetWidth);AB.setAttribute("height",this.offsetHeight);g.body.removeChild(this);N.safari()};g.body.appendChild(r);r.src=s[1];m.svg.defs.appendChild(k);m.node.style.fill="url(#"+k.id+")";m.node.setAttribute("fill","url(#"+k.id+")");m.pattern=k;C(m);break}delete q.gradient;delete m.attrs.gradient;if(typeof m.attrs.opacity!="undefined"&&typeof q.opacity=="undefined"){m.node.style.opacity=m.attrs.opacity;m.node.setAttribute("opacity",m.attrs.opacity)}if(typeof m.attrs["fill-opacity"]!="undefined"&&typeof q["fill-opacity"]=="undefined"){m.node.style.fillOpacity=m.attrs["fill-opacity"];m.node.setAttribute("fill-opacity",m.attrs["fill-opacity"])}case"stroke":m.node.style[t]=z;m.node.setAttribute(t,z);break;case"opacity":case"fill-opacity":if(m.attrs.gradient){var w=g.getElementById(m.node.getAttribute("fill").replace(/^url\(#|\)$/g,""));if(w){var AA=w.getElementsByTagName("stop");AA[AA.length-1].setAttribute("stop-opacity",z)}break}default:var u=t.replace(/(\-.)/g,function(o){return o.substring(1).toUpperCase()});m.node.style[u]=z;m.node.setAttribute(t,z);break}}K(m,q)};var d=1.2;var K=function(k,h){if(k.type!="text"||!("text" in h||"font" in h||"font-size" in h||"x" in h)){return }var s=k.node.firstChild?parseInt(g.defaultView.getComputedStyle(k.node.firstChild,"").getPropertyValue("font-size"),10):10;var r=0;if("text" in h){while(k.node.firstChild){k.node.removeChild(k.node.firstChild)}var R=(h.text+"").split("\n");for(var m=0,q=R.length;m<q;m++){var n=g.createElementNS(k.svg.svgns,"tspan");m&&n.setAttribute("dy",s*d);m&&n.setAttribute("x",k.attrs.x);n.appendChild(g.createTextNode(R[m]));k.node.appendChild(n);r+=s*d}}else{var R=k.node.getElementsByTagName("tspan");for(var m=0,q=R.length;m<q;m++){m&&R[m].setAttribute("dy",s*d);m&&R[m].setAttribute("x",k.attrs.x);r+=s*d}}r-=s*(d-1);var o=r/2-s;if(o){k.node.setAttribute("y",k.attrs.y-o)}setTimeout(function(){})};var Q=function(h,R){var m=0,k=0;this[0]=h;this.node=h;this.svg=R;this.attrs=this.attrs||{};this.transformations=[];this._={tx:0,ty:0,rt:{deg:0,x:0,y:0},sx:1,sy:1}};Q.prototype.hide=function(){this.node.style.display="none";return this};Q.prototype.show=function(){this.node.style.display="block";return this};Q.prototype.remove=function(){this.node.parentNode.removeChild(this.node)};Q.prototype.getBBox=function(){return this.node.getBBox()};Q.prototype.attr=function(){if(arguments.length==1&&typeof arguments[0]=="string"){return this.attrs[arguments[0]]}if(arguments.length==1&&arguments[0] instanceof Array){var R={};for(var h in arguments[0]){R[arguments[0][h]]=this.attrs[arguments[0][h]]}return R}if(arguments.length==2){var k={};k[arguments[0]]=arguments[1];W(this,k)}else{if(arguments.length==1&&typeof arguments[0]=="object"){W(this,arguments[0])}}return this};Q.prototype.toFront=function(){this.node.parentNode.appendChild(this.node);return this};Q.prototype.toBack=function(){if(this.node.parentNode.firstChild!=this.node){this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild)}return this};Q.prototype.insertAfter=function(R){if(R.node.nextSibling){R.node.parentNode.insertBefore(this.node,R.node.nextSibling)}else{R.node.parentNode.appendChild(this.node)}return this};Q.prototype.insertBefore=function(R){R.node.parentNode.insertBefore(this.node,R.node);return this};var I=function(h,R,o,n){var m=g.createElementNS(h.svgns,"circle");m.setAttribute("cx",R);m.setAttribute("cy",o);m.setAttribute("r",n);m.setAttribute("fill","none");m.setAttribute("stroke","#000");if(h.canvas){h.canvas.appendChild(m)}var k=new Q(m,h);k.attrs=k.attrs||{};k.attrs.cx=R;k.attrs.cy=o;k.attrs.r=n;k.attrs.stroke="#000";k.type="circle";return k};var a=function(m,R,t,k,q,s){var o=g.createElementNS(m.svgns,"rect");o.setAttribute("x",R);o.setAttribute("y",t);o.setAttribute("width",k);o.setAttribute("height",q);if(s){o.setAttribute("rx",s);o.setAttribute("ry",s)}o.setAttribute("fill","none");o.setAttribute("stroke","#000");if(m.canvas){m.canvas.appendChild(o)}var n=new Q(o,m);n.attrs=n.attrs||{};n.attrs.x=R;n.attrs.y=t;n.attrs.width=k;n.attrs.height=q;n.attrs.stroke="#000";if(s){n.attrs.rx=n.attrs.ry=s}n.type="rect";return n};var L=function(h,R,q,o,n){var m=g.createElementNS(h.svgns,"ellipse");m.setAttribute("cx",R);m.setAttribute("cy",q);m.setAttribute("rx",o);m.setAttribute("ry",n);m.setAttribute("fill","none");m.setAttribute("stroke","#000");if(h.canvas){h.canvas.appendChild(m)}var k=new Q(m,h);k.attrs=k.attrs||{};k.attrs.cx=R;k.attrs.cy=q;k.attrs.rx=o;k.attrs.ry=n;k.attrs.stroke="#000";k.type="ellipse";return k};var T=function(R){var k=g.createElementNS(R.svgns,"g");if(R.canvas){R.canvas.appendChild(k)}var h=new Q(k,R);for(var m in R){if(m[0]!="_"&&typeof R[m]=="function"){h[m]=(function(n){return function(){var o=R[n].apply(R,arguments);k.appendChild(o[0]);return o}})(m)}}h.type="group";return h};var Z=function(h,R){this.width=h||this.width;this.height=R||this.height;this.canvas.setAttribute("width",this.width);this.canvas.setAttribute("height",this.height);return this};var M=function(){var m=U.apply(null,arguments);var k=m.container,h=m.x,q=m.y,n=m.width,R=m.height;if(!k){throw new Error("SVG container not found.")}N.canvas=g.createElementNS(N.svgns,"svg");N.canvas.setAttribute("width",n||320);N.width=n||320;N.canvas.setAttribute("height",R||200);N.height=R||200;if(k==1){g.body.appendChild(N.canvas);N.canvas.style.position="absolute";N.canvas.style.left=h+"px";N.canvas.style.top=q+"px"}else{if(k.firstChild){k.insertBefore(N.canvas,k.firstChild)}else{k.appendChild(N.canvas)}}k={canvas:N.canvas,clear:function(){while(this.canvas.firstChild){this.canvas.removeChild(this.canvas.firstChild)}this.defs=g.createElementNS(N.svgns,"defs");this.canvas.appendChild(this.defs)}};for(var o in N){if(o!="create"){k[o]=N[o]}}P(k,k,G.fn);k.clear();return k};N.remove=function(){this.canvas.parentNode.removeChild(this.canvas)};N.svgns="http://www.w3.org/2000/svg";N.xlink="http://www.w3.org/1999/xlink";N.safari=function(){if(navigator.vendor=="Apple Computer, Inc."){var R=this.rect(-this.width,-this.height,this.width*3,this.height*3).attr({stroke:"none"});setTimeout(function(){R.remove()},0)}}}if(G.vml){J=function(r,R,o){var m=f("group"),q=m.style;q.position="absolute";q.left=0;q.top=0;q.width=o.width+"px";q.height=o.height+"px";var k=f("shape"),h=k.style;h.width=o.width+"px";h.height=o.height+"px";k.path="";if(r["class"]){k.className="rvml "+r["class"]}k.coordsize=this.coordsize;k.coordorigin=this.coordorigin;m.appendChild(k);o.canvas.appendChild(m);var n=new Q(k,m,o);n.isAbsolute=true;n.type="path";n.path=[];n.last={x:0,y:0,bx:0,by:0,isAbsolute:true};n.Path="";n.absolutely=function(){this.isAbsolute=true;return this};n.relatively=function(){this.isAbsolute=false;return this};n.moveTo=function(s,u){var t=this.isAbsolute?"m":"t";t+=Math.round(parseFloat(s,10))+" "+Math.round(parseFloat(u,10));this.node.path=this.Path+=t;this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(s,10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(u,10);this.last.isAbsolute=this.isAbsolute;this.attrs.path+=(this.isAbsolute?"M":"m")+[s,u];return this};n.lineTo=function(s,u){var t=this.isAbsolute?"l":"r";t+=Math.round(parseFloat(s,10))+" "+Math.round(parseFloat(u,10));this[0].path=this.Path+=t;this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(s,10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(u,10);this.last.isAbsolute=this.isAbsolute;this.attrs.path+=(this.isAbsolute?"L":"l")+[s,u];return this};n.andClose=function(){this.node.path=(this.Path+="x e");this.attrs.path+="z";return this};if(R){n.absolutely();n.attrs.path="";N.pathfinder(n,""+R)}W(n,r);return n};var W=function(R,h){var v=R.node.style,n=R;R.attrs=R.attrs||{};for(var m in h){R.attrs[m]=h[m]}h.href&&(R.node.href=h.href);h.title&&(R.node.title=h.title);h.target&&(R.node.target=h.target);if(h.path&&R.type=="path"){R.Path="";R.path=[];N.pathfinder(R,h.path)}if(R.type=="image"&&h.src){R.node.src=h.src}if(R.type=="image"&&h.opacity){R.node.filterOpacity=" progid:DXImageTransform.Microsoft.Alpha(opacity="+(h.opacity*100)+")";R.node.style.filter=(R.node.filterMatrix||"")+(R.node.filterOpacity||"")}h.font&&(v.font=h.font);h["font-family"]&&(v.fontFamily=h["font-family"]);h["font-size"]&&(v.fontSize=h["font-size"]);h["font-weight"]&&(v.fontWeight=h["font-weight"]);h["font-style"]&&(v.fontStyle=h["font-style"]);if(typeof h.opacity!="undefined"||typeof h["stroke-width"]!="undefined"||typeof h.fill!="undefined"||typeof h.stroke!="undefined"||h["stroke-width"]||h["stroke-opacity"]||h["stroke-dasharray"]||h["stroke-miterlimit"]||h["stroke-linejoin"]||h["stroke-linecap"]){R=R.shape||R.node;var t=(R.getElementsByTagName("fill")&&R.getElementsByTagName("fill")[0])||f("fill");if("fill-opacity" in h||"opacity" in h){t.opacity=((+h["fill-opacity"]+1||2)-1)*((+h.opacity+1||2)-1)}if(h.fill){t.on=true}if(typeof t.on=="undefined"||h.fill=="none"){t.on=false}if(t.on&&h.fill){var k=h.fill.match(/^url\(([^\)]+)\)$/i);if(k){t.src=k[1];t.type="tile"}else{t.color=h.fill;t.src="";t.type="solid"}}R.appendChild(t);var u=(R.getElementsByTagName("stroke")&&R.getElementsByTagName("stroke")[0])||f("stroke");if((h.stroke&&h.stroke!="none")||h["stroke-width"]||typeof h["stroke-opacity"]!="undefined"||h["stroke-dasharray"]||h["stroke-miterlimit"]||h["stroke-linejoin"]||h["stroke-linecap"]){u.on=true}if(h.stroke=="none"||typeof u.on=="undefined"||h.stroke==0){u.on=false}if(u.on&&h.stroke){u.color=h.stroke}u.opacity=((+h["stroke-opacity"]+1||2)-1)*((+h.opacity+1||2)-1);h["stroke-linejoin"]&&(u.joinstyle=h["stroke-linejoin"]||"miter");u.miterlimit=h["stroke-miterlimit"]||8;h["stroke-linecap"]&&(u.endcap={butt:"flat",square:"square",round:"round"}[h["stroke-linecap"]]||"miter");h["stroke-width"]&&(u.weight=(parseFloat(h["stroke-width"],10)||1)*12/16);if(h["stroke-dasharray"]){var q={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};u.dashstyle=q[h["stroke-dasharray"]]||""}R.appendChild(u)}if(n.type=="text"){var r=g.createElement("span"),v=r.style;n.attrs.font&&(v.font=n.attrs.font);n.attrs["font-family"]&&(v.fontFamily=n.attrs["font-family"]);n.attrs["font-size"]&&(v.fontSize=n.attrs["font-size"]);n.attrs["font-weight"]&&(v.fontWeight=n.attrs["font-weight"]);n.attrs["font-style"]&&(v.fontStyle=n.attrs["font-style"]);n.node.parentNode.appendChild(r);r.innerText=n.node.string;n.W=n.attrs.w=r.offsetWidth;n.H=n.attrs.h=r.offsetHeight;n.X=n.attrs.x;n.Y=n.attrs.y+Math.round(n.H/2);n.node.parentNode.removeChild(r);switch(n.attrs["text-anchor"]){case"start":n.node.style["v-text-align"]="left";n.bbx=Math.round(n.W/2);break;case"end":n.node.style["v-text-align"]="right";n.bbx=-Math.round(n.W/2);break;default:n.node.style["v-text-align"]="center";break}}};var H=function(h,R,n,m){var k=Math.round(Math.atan((parseFloat(n,10)-parseFloat(h,10))/(parseFloat(m,10)-parseFloat(R,10)))*57.29)||0;if(!k&&parseFloat(h,10)<parseFloat(R,10)){k=180}k-=180;if(k<0){k+=360}return k};var Q=function(n,q,R){var o=0,k=0,h=0,m=1;this[0]=n;this.node=n;this.X=0;this.Y=0;this.attrs={};this.Group=q;this.vml=R;this._={tx:0,ty:0,rt:{deg:0},sx:1,sy:1}};Q.prototype.setBox=function(n,o,m){var R=this.Group.style,q=(this.shape&&this.shape.style)||this.node.style;for(var r in n){this.attrs[r]=n[r]}o=o||this._.rt.cx;m=m||this._.rt.cy;var u=this.attrs,AA,z,AB,t;switch(this.type){case"circle":AA=u.cx-u.r;z=u.cy-u.r;AB=t=u.r*2;break;case"ellipse":AA=u.cx-u.rx;z=u.cy-u.ry;AB=u.rx*2;t=u.ry*2;break;case"rect":case"image":AA=u.x;z=u.y;AB=u.width||0;t=u.height||0;break;case"text":this.textpath.v=["m",Math.round(u.x),", ",Math.round(u.y-2),"l",Math.round(u.x)+1,", ",Math.round(u.y-2)].join("");AA=u.x-Math.round(this.W/2);z=u.y-this.H/2;AB=this.W;t=this.H;break;case"path":if(!this.attrs.path){AA=0;z=0;AB=this.vml.width;t=this.vml.height}else{var s=O(this.attrs.path),AA=s.x;z=s.y;AB=s.width;t=s.height}break;default:AA=0;z=0;AB=this.vml.width;t=this.vml.height;break}o=(o==null)?AA+AB/2:o;m=(m==null)?z+t/2:m;var k=o-this.vml.width/2,v=m-this.vml.height/2;if(this.type=="path"||this.type=="text"){R.left=k+"px";R.top=v+"px";this.X=this.type=="text"?AA:-k;this.Y=this.type=="text"?z:-v;this.W=AB;this.H=t;q.left=-k+"px";q.top=-v+"px"}else{R.left=k+"px";R.top=v+"px";this.X=AA;this.Y=z;this.W=AB;this.H=t;R.width=this.vml.width+"px";R.height=this.vml.height+"px";q.left=AA-k+"px";q.top=z-v+"px";q.width=AB+"px";q.height=t+"px"}};Q.prototype.hide=function(){this.Group.style.display="none";return this};Q.prototype.show=function(){this.Group.style.display="block";return this};Q.prototype.getBBox=function(){this.bbx=this.bbx||0;return{x:this.X+this.bbx,y:this.Y,width:this.W,height:this.H}};Q.prototype.remove=function(){this[0].parentNode.removeChild(this[0]);this.Group.parentNode.removeChild(this.Group);this.shape&&this.shape.parentNode.removeChild(this.shape)};Q.prototype.attr=function(){if(arguments.length==1&&typeof arguments[0]=="string"){return this.attrs[arguments[0]]}if(this.attrs&&arguments.length==1&&arguments[0] instanceof Array){var R={};for(var h=0,k=arguments[0].length;h<k;h++){R[arguments[0][h]]=this.attrs[arguments[0][h]]}return R}var m;if(arguments.length==2){m={};m[arguments[0]]=arguments[1]}if(arguments.length==1&&typeof arguments[0]=="object"){m=arguments[0]}if(m){if(m.text&&this.type=="text"){this.node.string=m.text}if(m.id){this.node.id=m.id}W(this,m);this.setBox(m)}return this};Q.prototype.toFront=function(){this.Group.parentNode.appendChild(this.Group);return this};Q.prototype.toBack=function(){if(this.Group.parentNode.firstChild!=this.Group){this.Group.parentNode.insertBefore(this.Group,this.Group.parentNode.firstChild)}return this};Q.prototype.insertAfter=function(R){if(R.Group.nextSibling){R.Group.parentNode.insertBefore(this.Group,R.Group.nextSibling)}else{R.Group.parentNode.appendChild(this.Group)}return this};Q.prototype.insertBefore=function(R){R.Group.parentNode.insertBefore(this.Group,R.Group);return this};var I=function(h,R,s,n){var m=f("group");var q=f("oval");m.appendChild(q);h.canvas.appendChild(m);var k=new Q(q,m,h);k.type="circle";W(k,{stroke:"#000",fill:"none"});k.attrs.cx=R;k.attrs.cy=s;k.attrs.r=n;k.setBox({x:R-n,y:s-n,width:n*2,height:n*2});return k};var a=function(k,u,t,v,n,R){var q=f("group");var m=f(R?"roundrect":"rect");if(R){m.arcsize=R/(Math.min(v,n))}q.appendChild(m);k.canvas.appendChild(q);var s=new Q(m,q,k);s.type="rect";W(s,{stroke:"#000"});s.attrs.x=u;s.attrs.y=t;s.attrs.w=v;s.attrs.h=n;s.attrs.r=R;s.setBox({x:u,y:t,width:v,height:n});return s};var L=function(h,R,s,q,n){var m=f("group");var r=f("oval");m.appendChild(r);h.canvas.appendChild(m);var k=new Q(r,m,h);k.type="ellipse";W(k,{stroke:"#000"});k.attrs.cx=R;k.attrs.cy=s;k.attrs.rx=q;k.attrs.ry=n;k.setBox({x:R-q,y:s-n,width:q*2,height:n*2});return k};var Z=function(h,R){this.width=h||this.width;this.height=R||this.height;this.canvas.style.width=this.width+"px";this.canvas.style.height=this.height+"px";this.canvas.parentNode.style.clip="rect(0 "+this.width+" "+this.height+" 0)";this.canvas.coordsize=this.width+" "+this.height;return this};g.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");try{if(!g.namespaces.rvml){g.namespaces.add("rvml","urn:schemas-microsoft-com:vml")}var f=function(R){return g.createElement("<rvml:"+R+' class="rvml">')}}catch(Y){var f=function(R){return g.createElement("<"+R+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}var M=function(){var n=U.apply(null,arguments);var k=n.container,w=n.x,v=n.y,m=n.width,AA=n.height;if(!k){throw new Error("VML container not found.")}var t=g.createElement("div"),s=g.createElement("div"),R=N.canvas=f("group"),q=t.style,o=R.style;N.width=m;N.height=AA;m=m||"320px";AA=AA||"200px";q.clip="rect(0 "+m+"px "+AA+"px 0)";q.top="-2px";q.left="-2px";q.position="absolute";o.position="absolute";s.style.position="relative";o.width=m;o.height=AA;R.coordsize=(/%$/.test(m)?m:parseFloat(m,10))+" "+(/%$/.test(AA)?AA:parseFloat(AA,10));R.coordorigin="0 0";var u=f("rect"),z=u.style;z.left=z.top=0;z.width=o.width;z.height=o.height;u.filled=u.stroked="f";R.appendChild(u);t.appendChild(R);s.appendChild(t);if(k==1){g.body.appendChild(s);q.position="absolute";q.left=w+"px";q.top=v+"px";q.width=m;q.height=AA;k={style:{width:m,height:AA}}}else{q.width=k.style.width=m;q.height=k.style.height=AA;if(k.firstChild){k.insertBefore(s,k.firstChild)}else{k.appendChild(s)}}for(var h in N){k[h]=N[h]}P(k,k,G.fn);k.clear=function(){var r=[];for(var AB=0,AC=R.childNodes.length;AB<AC;AB++){if(R.childNodes[AB]!=u){r.push(R.childNodes[AB])}}for(AB=0,AC=r.length;AB<AC;AB++){R.removeChild(r[AB])}};return k};N.remove=function(){this.canvas.parentNode.parentNode.parentNode.removeChild(this.canvas.parentNode.parentNode)};N.safari=function(){}}var S=(function(){if(g.addEventListener){return function(n,k,h,R){var m=function(o){return h.call(R,o)};n.addEventListener(k,m,false);return function(){n.removeEventListener(k,m,false);return true}}}else{if(g.attachEvent){return function(o,m,k,h){var n=function(q){return k.call(h,q||F.event)};o.attachEvent("on"+m,n);var R=function(){o.detachEvent("on"+m,n);return true};if(m=="mouseover"){o.attachEvent("onmouseenter",n);return function(){o.detachEvent("onmouseenter",n);return R()}}else{if(m=="mouseout"){o.attachEvent("onmouseleave",n);return function(){o.detachEvent("onmouseleave",n);return R()}}}return R}}}})();for(var V=B.length;V--;){(function(R){Q.prototype[R]=function(h){if(typeof h=="function"){this.events=this.events||{};this.events[R]=this.events[R]||{};this.events[R][h]=this.events[R][h]||[];this.events[R][h].push(S(this.shape||this.node,R,h,this))}return this};Q.prototype["un"+R]=function(h){this.events&&this.events[R]&&this.events[R][h]&&this.events[R][h].length&&this.events[R][h].shift()()&&!this.events[R][h].length&&delete this.events[R][h]}})(B[V])}N.circle=function(R,k,h){return I(this,R,k,h)};N.rect=function(R,o,k,m,n){return a(this,R,o,k,m,n)};N.ellipse=function(R,m,k,h){return L(this,R,m,k,h)};N.path=function(h,R){return J(h,R,this)};N.group=function(){return this};N.drawGrid=function(t,s,u,q,o,r,m){m=m||"#000";var v=["M",t,s,"L",t+u,s,t+u,s+q,t,s+q,t,s],R=q/r,k=u/o;for(var n=1;n<r;n++){v=v.concat(["M",t,s+n*R,"L",t+u,s+n*R])}for(var n=1;n<o;n++){v=v.concat(["M",t+n*k,s,"L",t+n*k,s+q])}return this.path({stroke:m,"stroke-width":1},v.join(","))};N.pathfinder=function(o,n){var h={M:function(q,r){this.moveTo(q,r)},L:function(q,r){o.lineTo(q,r)},H:function(q){this.lineTo(q,this.last.y)},V:function(q){this.lineTo(this.last.x,q)},Z:function(){this.andClose()}};n=b(n);for(var k=0,m=n.length;k<m;k++){var R=n[k].shift();h[R].apply(o,n[k])}};N.set=function(R){return new X(R)};N.setSize=Z;Q.prototype.stop=function(){clearTimeout(this.animation_in_progress)};var X=function(h){this.items=[];this.length=(h&&h.length)||0;if(h&&h.constructor==Array){for(var R=h.length;R--;){if(h[R].constructor==Q){this.items[this.items.length]=h[R]}}}};X.prototype.push=function(h){if(h&&h.constructor==Q){var R=this.items.length;this.items[R]=h;this[R]=h;this.length++}return this};X.prototype.pull=function(m){var h=this.items.splice(m,1)[0];for(var R=m,k=this.items.length;R<k;R++){this[R]=this[R+1]}delete this[k+1];this.length--;return h};for(var D in Q.prototype){X.prototype[D]=(function(R){return function(){for(var h=this.items.length;h--;){this.items[h][R].apply(this.items[h],arguments)}return this}})(D)}X.prototype.getBBox=function(){var R=[],q=[],k=[],n=[];for(var m=this.items.length;m--;){var o=this.items[m].getBBox();R.push(o.x);q.push(o.y);k.push(o.x+o.width);n.push(o.y+o.height)}R=Math.min.apply(Math,R);q=Math.min.apply(Math,q);return{x:R,y:q,width:Math.max.apply(Math,k)-R,height:Math.max.apply(Math,n)-q}};return G})();Joms.PolylineBrowserRenderer=function(A){this.app=A;this.layer=new Joms.RaphaelLayer(this.app,"raphaelLayer",11)};Joms.PolylineBrowserRenderer.prototype={app:null,remove:function(A){this.layer.remove(A)},show:function(A){this.layer.add(A)},showCategory:function(A){},hide:function(A){this.layer.remove(A)},render:function(A){this.layer.remove(A);this.layer.add(A)}};Joms.RaphaelTile=function(B,A){this.lines=new Array();this.map=B;this.el=A;this.el.style.display="block";this.paperWidth=this.map.app.mapWidth;this.paperHeight=this.map.app.mapHeight;this.paper=Raphael(this.el,this.paperWidth,this.paperHeight);this.setPaperPosition()};Joms.RaphaelTile.prototype={lines:null,el:null,map:null,visible:true,setPaperPosition:function(){this.el.style.top=(-(this.map.top-(this.map.positionDiff?this.map.positionDiff.y:0)))+"px";this.el.style.left=(-(this.map.left-(this.map.positionDiff?this.map.positionDiff.x:0)))+"px";this.viewrect=this.map.getViewRect()},setView:function(B,A,C){this.setPaperPosition();this.setPaperSize();this.zoomChanged()},setPaperSize:function(){if(this.paperWidth!=this.map.app.mapWidth||this.paperHeight!=this.map.app.mapHeight){this.paper.setSize(this.map.app.mapWidth,this.map.app.mapHeight);this.paperWidth=this.map.app.mapWidth;this.paperHeight=this.map.app.mapHeight}},zoomChanged:function(){for(var B=0;B<this.lines.length;++B){var A=this.lines[B];this.dlfp(A);this.render(A)}},getColor:function(A){if(A.length>6){return A.substr(0,6)}return A},getOpacity:function(A){if(A.length>6){var B=A.substr(6,A.length);return Math.min(1,parseInt(B,16)/255)}return 1},unit2paperX:function(A){return this.map.unit2pxX(A)+this.map.left},unit2paperY:function(A){return this.map.unit2pxY(A)+this.map.top},render:function(B){if(B.envelopeRect==null||!this.viewrect.isIntersecting(B.envelopeRect)){return }var A,G,E,C;var F;if(B.points.length>1){var F=this.paper.path({});F.attr("stroke","#"+this.getColor(B.color));F.attr("stroke-opacity",this.getOpacity(B.color));F.attr("stroke-width",B.width);p=B.points[0];E=this.unit2paperX(p.x);C=this.unit2paperY(p.y);this.drawPoint(B,p);F.moveTo(E,C);for(var D=1;D<B.points.length;D++){p=B.points[D];A=this.unit2paperX(p.x);G=this.unit2paperY(p.y);if(E!=A&&C!=G){F.lineTo(A,G);E=A;C=G;this.drawPoint(B,p)}}switch(B.strokeType){case Joms.Polyline.Stroke.DASHED:F.attr("stroke-dasharray","-");break;case Joms.Polyline.Stroke.DOT:F.attr("stroke-dasharray",".");break}if(B.type==Joms.Polyline.Type.CLOSED_LINE){F.andClose()}else{if(B.type==Joms.Polyline.Type.POLYGON){F.andClose();F.attr("fill","#"+this.getColor(B.fillColor));F.attr("fill-opacity",this.getOpacity(B.fillColor))}}B.rap=F}else{this.drawPoint(B,B.points[0])}},drawPoint:function(A,B){if(A.drawPoints){c=this.paper.circle(this.unit2paperX(B.x),this.unit2paperY(B.y),A.width);c.attr("fill","#"+this.getColor(A.color));c.attr("fill-opacity",this.getOpacity(A.color));Event.addEvent(c.node,"mouseup",A._pointClicked.bind(A,B),false);Event.addEvent(c.node,"mouseup",Event.stopEvent,false);Event.addEvent(c.node,"mouseup",Event.preventDefault,false);Event.addEvent(c.node,"mousedown",Event.stopEvent,false);Event.addEvent(c.node,"contextmenu",Event.preventDefault,false);B.rap=c}},add:function(A){this.lines.push(A);this.render(A)},remove:function(A){var B=Joms.obtainObjectIndexInArray(this.lines,A);if(B!=-1){this.lines.splice(B,1)}this.dlfp(A)},dlfp:function(A){if(A.rap){A.rap.remove();A.rap=null}for(var B=0;B<A.points.length;B++){var C=A.points[B];if(C.rap){C.rap.remove();C.rap=null}}},clear:function(){for(var A=0;A<this.lines.length;++A){this.dlfp(this.lines[A])}this.lines=new Array()},show:function(){this.visible=true;this.el.style.display="block"},hide:function(){this.visible=false;this.el.style.display="none"}};Joms.RaphaelLayer=function(B,A,C){if(!B){Joms.error("Joms.CustomLayer","Objekt aplikace nebyl definován.");return }if(C==undefined){C=21}this.app=B;this.name=A;this.visible=true;this.layer=this.app.map.getLayer(A);if(!this.layer||this.layer.add==undefined){new Joms.Layer(this.app.map,A,Joms.RaphaelTile,C,false);this.layer=this.app.map.getLayer(A)}};Joms.RaphaelLayer.prototype={app:null,name:null,layer:null,visible:null,add:function(A){this.layer.add(A)},remove:function(A){this.layer.remove(A)},clear:function(){this.layer.clear()},show:function(){this.layer.show();this.visible=true},hide:function(){this.layer.hide();this.visible=false}};Joms.TextAddArea=function(A){this.app=A;this.el=cel("div");this.el.className="jomsTextAddAreaControl";Joms.addTransparentBg(this.el);this.app.el.appendChild(this.el);this.app.hooks.register("mapChanged",this.mapChanged,this);this.app.hooks.register("jomsDbSearched",this.jomsDbSearched,this);this.app.hooks.register("routeSearched",this.routeSearched,this);this.app.hooks.register("layerSwitch",this.setLayer,this);this.aEl=cel("a");this.aEl.onclick=this.onAddClick.bind(this);this.aEl.innerHTML="Reklama";this.aEl.target="_blank";var B=cel("div");B.className="add";B.appendChild(ctn("Reklama: "));B.appendChild(this.aEl);this.el.appendChild(B);this.setSize()};Joms.TextAddArea.prototype={el:null,aEl:null,visible:false,addsMap:new Array(),currentAdd:null,addMapAdd:function(B,E,A,D){var C=this.createAdd(E,A,D);C.mapId=B;this.addsMap.push(C)},showAdd:function(D,A,C){var B=this.createAdd(D,A,C);this.showAddObj(B)},show:function(){if(!this.visible){this.el.style.display="block";if(this.app.scale!=undefined){this.app.scale.scale.style.bottom="35px"}if(this.app.copyrightEl!=undefined){this.app.copyrightEl.style.bottom="23px"}this.visible=true}},hide:function(){if(this.visible){this.el.style.display="none";if(this.app.scale!=undefined){this.app.scale.scale.style.bottom="15px"}if(this.app.copyrightEl!=undefined){this.app.copyrightEl.style.bottom="3px"}this.visible=false}},createAdd:function(D,A,C){var B=new Object();B.title=D;B.url=A;B.hash=C;return B},mapChanged:function(){this.setSize();var B=this.app.map.getCurrentMap();for(var A=0;A<this.addsMap.length;A++){var C=this.addsMap[A];if(C.mapId==B){this.showAddObj(C);return }}this.hide()},jomsDbSearched:function(B,A){},routeSearched:function(A){},setLayer:function(A,B){},showAddObj:function(B){if(this.currentAdd!=B){this.aEl.innerHTML=B.title;var A=B.url+"?ad=jomsapi&amp;type=add&amp;name=jomsapi";if(B.hash!=""){A=A+"#"+B.hash}this.aEl.href=A;this.aEl.title=B.title;this.currentAdd=B}this.show()},setSize:function(){this.el.style.width=(this.app.mapWidth)+"px"},onAddClick:function(){return true}};function CCallWrapper(K,M,B,A,L,J,I,H,G,F,E,D,C){this.mId="CCallWrapper_"+(CCallWrapper.mCounter++);this.mObjectReference=K;this.mDelay=M;this.mTimerId=0;this.mMethodName=B;this.mArgument0=A;this.mArgument1=L;this.mArgument2=J;this.mArgument3=I;this.mArgument4=H;this.mArgument5=G;this.mArgument6=F;this.mArgument7=E;this.mArgument8=D;this.mArgument9=C;CCallWrapper.mPendingCalls[this.mId]=this}CCallWrapper.prototype.execute=function(){this.mObjectReference[this.mMethodName](this.mArgument0,this.mArgument1,this.mArgument2,this.mArgument3,this.mArgument4,this.mArgument5,this.mArgument6,this.mArgument7,this.mArgument8,this.mArgument9);delete CCallWrapper.mPendingCalls[this.mId]};CCallWrapper.prototype.cancel=function(){clearTimeout(this.mTimerId);delete CCallWrapper.mPendingCalls[this.mId]};CCallWrapper.asyncExecute=function(A){CCallWrapper.mPendingCalls[A.mId].mTimerId=setTimeout('CCallWrapper.mPendingCalls["'+A.mId+'"].execute()',A.mDelay)};CCallWrapper.mCounter=0;CCallWrapper.mPendingCalls={};function Jcea(H,D,G,B,E,F,C){var A=cel("a");if(B!=undefined){Joms.Event.addClickEvent(A,B.bind(D,G))}if(E!=undefined){A.onmouseover=E.bind(D,G)}if(F!=undefined){A.onmouseout=F.bind(D,G)}if(C!=undefined){A.className=C}A.appendChild(document.createTextNode(H));A.href="";return A}function JceaImg(A,I,E,J,C,B,F,G){var H=cel("a");if(B!=undefined){Joms.Event.addClickEvent(H,B.bind(J,C))}var D=cel("img");D.src=A;D.className=E;D.alt=I;D.title=I;if(F!=undefined){D.width=F}if(G!=undefined){D.height=G}H.appendChild(D);H.href="";return H}Joms.checkMail=function(A){var B=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;return B.test(A)};Joms.sendMail=function(C){var D="",A="",B;if(C.feedback){A+="feedback=1&"}else{B=app.query.get();A+="query="+urlEncode(B[0])+"&link="+urlEncode(B[1])+"&";if(!Joms.checkMail(C.t.value)){D+="Špatný formát e-mailu příjemce.<br />"}else{A+="to="+C.t.value+"&"}}if(!Joms.checkMail(C.f.value)){D+="Špatný formát e-mailu odesílatele.<br />"}else{A+="f="+C.f.value+"&"}if(D==""){A+="v="+C.v.value;new Joms.Ajax.Request(this,Joms.dataScript+"?t=m",true,function(E){app.msg(E,"Odeslání e-mailu")},"post",A)}else{app.msg(D)}};Joms.highlight=function(C,A,B){if(B==undefined){B=0}if(A==undefined){A=C.style.border}if(C.style.border==A){C.style.border="1px solid darkred"}else{C.style.border=A}if(B<5){window.setTimeout(function(){Joms.highlight(C,A,++B)},100)}};Joms.createTransparentImage=function(E,B,A,C){var D=cel("img");Joms.updateTransparentImage(D,E,B,A,C);return D};Joms.addTransparentBg=function(A){if(!Joms.browser.hasPngSupport()){A.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(				src='"+Joms.baseUrl+"/images/white-bg.png',sizingMethod='scale');"}else{A.style.background="url("+Joms.baseUrl+"images/white-bg.png)"}};Joms.getAppUrl=function(){return window.location.protocol+"//"+window.location.host+window.location.pathname};Joms.removeObjectFromArr=function(A,C){for(var B=0;B<A.length;B++){if(A[B]==C){A.splice(B,1);return true}}return false};Joms.updateTransparentImage=function(D,E,B,A,C){D.width=B;D.height=A;D.style.width=B+"px";D.style.height=A+"px";if(C=="png"&&!Joms.browser.hasPngSupport()){D.src=Joms.blankImage;D.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+E+"',sizingMethod='scale')"}else{D.src=E}};Joms.error=function(A,B){alert("Chyba ["+A+"]: "+B)};Joms.obtainObjectIndexInArray=function(A,C){for(var B=0;B<A.length;B++){if(C==A[B]){return B}}return -1};Joms.nl2br=function(B){var A="<br />";return(B+"").replace(/([^>]?)\n/g,"$1"+A+"\n")};Joms.Utm2Wgs84=function(A,B){return Joms.Convert.UtmToWgs(B,A)};Joms.deg=function(F,C){function A(J,K){J=parseFloat(J);K=parseFloat(K);J=Math.round(J*Math.pow(10,K))/Math.pow(10,K);return J}var G;var H=Math.abs(parseFloat(F));var D=parseInt(H+1)-1;var I=H-D;var E=parseInt(I*60+1)-1;var B=((I*60)-E)*60;B=A(B,3);if(B==60){B="0";E=E*1+1;if(E==60){E="0";D=D*1+1}}if(C=="e"){if(F<0){G="W"}else{G="E"}}else{if(F<0){G="S"}else{G="N"}}return D+"\260"+E+"'"+B+'"'+G};Joms.checkMppx=function(C,A,D,B){if((C===false||Math.abs(D-A)<=C)&&(!B||D>A)){return true}else{return false}};Joms.inRange=function(A,G,C){var D,B,F=0;var E=C.length;A=parseFloat(A);G=parseFloat(G);for(D=0,B=E-2;D<E;B=D,D+=2){C[D]=parseFloat(C[D]);C[D+1]=parseFloat(C[D+1]);C[B]=parseFloat(C[B]);C[B+1]=parseFloat(C[B+1]);if((((C[D+1]<=G)&&(G<C[B+1]))||((C[B+1]<=G)&&(G<C[D+1])))&&(A<(C[B]-C[D])*(G-C[D+1])/(C[B+1]-C[D+1])+C[D])){F=!F}}return F};Joms.removeAllChilds=function(A){while(A.hasChildNodes()){A.removeChild(A.firstChild)}};Joms.getElementsByClassName=function(B,F,A){var E=(F=="*"&&B.all)?B.all:B.getElementsByTagName(F);var H=new Array();A=A.replace(/\-/g,"\\-");var G=new RegExp("(^|\\s)"+A+"(\\s|$)");var D;for(var C=0;C<E.length;C++){D=E[C];if(G.test(D.className)){H.push(D)}}return(H)};Joms.className=function(A,E,C,B){switch(A){case"swap":E.className=!Joms.className("check",E,C)?E.className.replace(B,C):E.className.replace(C,B);break;case"add":if(!Joms.className("check",E,C)){E.className+=E.className?" "+C:C}break;case"remove":var D=E.className.match(" "+C)?" "+C:C;E.className=E.className.replace(D,"");break;case"check":return new RegExp("\\b"+C+"\\b").test(E.className);break}};Joms.showLoading=function(A){var B;if(Joms.loadingBox){if(A){Joms.loadingBox.style.display="block"}else{Joms.loadingBox.style.display="none"}}};Joms.showObject=function(B,D){var C,A;C=B.split("_");app.changeZoom(undefined,app.getLevelFromMppx(C[3],C[1],C[2]),C[1],C[2]);if(D){Joms.showObjectCategory(D,false)}app.map.setMark(new Joms.Coord(C[1],C[2]),false)};Joms.showObjectCategory=function(A,C){var B=gid("objectlist"+app.name+"_"+A);if(C&&!B){window.setTimeout(function(){Joms.showObjectCategory(A,true)},200);return }if(B&&!B.checked){B.click()}};Joms.changeObjects=function(C,A,D,B){app.objectList.changeObjects.call(app.objectList,C,A,D,B)};Joms.findPosX=function(A){var B=0;if(A.offsetParent){while(A.offsetParent){B+=A.offsetLeft;A=A.offsetParent}}else{if(A.x){B+=A.x}}return B};Joms.findPosY=function(B){var A=0;if(B.offsetParent){while(B.offsetParent){A+=B.offsetTop;B=B.offsetParent}}else{if(B.y){A+=B.y}}return A};Joms.getOffsetX=function(){var A=0;if(window.pageXOffset){A=window.pageXOffset}else{if(document.documentElement&&document.documentElement.scrollLeft){A=document.documentElement.scrollLeft}else{if(document.body){A=document.body.scrollLeft}}}return A};Joms.getOffsetY=function(){var A=0;if(window.pageYOffset){A=window.pageYOffset}else{if(document.documentElement&&document.documentElement.scrollTop){A=document.documentElement.scrollTop}else{if(document.body){A=document.body.scrollTop}}}return A};function isInt(A){var B=parseInt(A);if(isNaN(B)){return false}return A==B&&A.toString()==B.toString()}function $(A){if(typeof A=="string"){A=document.getElementById(A)}return A}function gid(A){return document.getElementById(A)}function cel(A){return document.createElement(A)}function ctn(A){return document.createTextNode(A)}function scrollToElem(A){window.scrollTo(Joms.findPosX(A),Joms.findPosY(A))}function urlEncode(A){return encodeURIComponent(A)}function urlDecode(A){return decodeURIComponent(A)}Joms.getPageSize=function(){var B=0,A=0;if(window.innerWidth){B=window.innerWidth;A=window.innerHeight}else{if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){B=document.documentElement.clientWidth;A=document.documentElement.clientHeight}else{if(document.body&&(document.body.clientWidth||document.body.clientHeight)){B=document.body.clientWidth;A=document.body.clientHeight}}}return{width:B,height:A}};function getElementsByClass(G,E,A){var D=new Array();if(E==null){E=document}if(A==null){A="*"}var C=E.getElementsByTagName(A);var B=C.length;var F=new RegExp("(^|\\s)"+G+"(\\s|$)");for(i=0,j=0;i<B;i++){if(F.test(C[i].className)){D[j]=C[i];j++}}return D}function getElementsByName(A,C){var E=document.getElementsByTagName(A);var B=new Array();for(var D=0;D<E.length;++D){if(E[D].name==C){B.push(E[D])}}return B}function utfEncode(B){B=B.replace(/\r\n/g,"\n");var A="";for(var D=0;D<B.length;D++){var C=B.charCodeAt(D);if(C<128){A+=String.fromCharCode(C)}else{if((C>127)&&(C<2048)){A+=String.fromCharCode((C>>6)|192);A+=String.fromCharCode((C&63)|128)}else{A+=String.fromCharCode((C>>12)|224);A+=String.fromCharCode(((C>>6)&63)|128);A+=String.fromCharCode((C&63)|128)}}}return A}function utfDecode(A){var B="";var C=0;var D=c1=c2=0;while(C<A.length){D=A.charCodeAt(C);if(D<128){B+=String.fromCharCode(D);C++}else{if((D>191)&&(D<224)){c2=A.charCodeAt(C+1);B+=String.fromCharCode(((D&31)<<6)|(c2&63));C+=2}else{c2=A.charCodeAt(C+1);c3=A.charCodeAt(C+2);B+=String.fromCharCode(((D&15)<<12)|((c2&63)<<6)|(c3&63));C+=3}}}return B}function removeDiacritics(A){var B="áäčďéěíĺľňóô öŕšťúů üýřžÁÄČĎÉĚÍĹĽŇÓÔ ÖŔŠŤÚŮ ÜÝŘŽ";var C="aacdeeillnoo orstuu uyrzAACDEEILLNOO ORSTUU UYRZ";tx="";for(p=0;p<A.length;p++){if(B.indexOf(A.charAt(p))!=-1){tx+=C.charAt(B.indexOf(A.charAt(p)))}else{tx+=A.charAt(p)}}return tx}Joms.getUrlPath=function(){var A=window.location.pathname;var B=A.lastIndexOf("/");if(B!=-1){A=A.substr(0,B+1)}return window.location.protocol+"//"+window.location.host+A};function debug(){var B=gid("jomsDebug");if(!B){return }B.style.display="block";debug_count++;if(debug_count==40){B.innerHTML="";debug_count=0}str="";for(var A=0;A<debug.arguments.length;++A){str+=debug.arguments[A]+";"}B.innerHTML=B.innerHTML+str+"<br />"};Joms.browser = new Joms.Browser();
Joms.Convert = new Joms.UtmWgsConvertor();

Joms.dataScript = '/data/server.php';
Joms.dataScriptUrl = Joms.baseUrl + '/data/server.php';
Joms.loadingBox = null;
Joms.blankImage = Joms.baseUrl + 'images/blank.gif';
Joms.iconsDir = Joms.baseUrl + 'images/map-icons/';
Joms.iconsType = 'gif';

var resultBg = '#dedede';
var debug_count = 0;
var browser = Joms.browser;
Joms.lang='cze';
Joms.maps={"beroun":3,"blansko":4,"breclav":5,"brno":6,"ceska-lipa":7,"ceske-budejovice":8,"cesky-krumlov":9,"decin":11,"dobris":12,"havlickuv-brod":15,"hodonin":16,"hradec-kralove":17,"cheb":19,"chomutov":20,"jihlava":21,"jindrichuv-hradec":22,"karlovy-vary":23,"klatovy":25,"kolin":26,"kromeriz":29,"kutna-hora":30,"liberec":31,"louny":33,"melnik":36,"most":37,"nachod":38,"novy-jicin":39,"olomouc":40,"opava":41,"ostrava":42,"pardubice":43,"pisek":45,"plzen":46,"praha":47,"prerov":49,"pribram":50,"prostejov":51,"rokycany":52,"sokolov":55,"strakonice":57,"sumperk":58,"tabor":60,"tachov":61,"teplice":62,"trebic":63,"trutnov":66,"uherske-hradiste":68,"usti-nad-labem":69,"vsetin":72,"vyskov":73,"zdar-nad-sazavou":75,"zlin":76,"znojmo":77,"zatec":78,"czt-cesko":86,"boskovice":91,"domazlice":101,"chrudim":102,"jesenik":103,"jicin":104,"kladno":105,"litomerice":106,"mlada-boleslav":107,"pelhrimov":109,"rakovnik":110,"rychnov-nad-kneznou":111,"semily":112,"svitavy":113,"usti-nad-orlici":114,"bruntal":3194,"dvur-kralove-nad-labem":3207,"havirov":3212,"hranice":3224,"karvina":3240,"kraslice":3248,"krnov":3250,"litomysl":3258,"marianske-lazne":3264,"nove-mesto-na-morave":3275,"prestice":3293,"rumburk":3300,"trinec":3321,"votice":3344};
Joms.maps_r={"3":"beroun","4":"blansko","5":"breclav","6":"brno","7":"ceska-lipa","8":"ceske-budejovice","9":"cesky-krumlov","11":"decin","12":"dobris","15":"havlickuv-brod","16":"hodonin","17":"hradec-kralove","19":"cheb","20":"chomutov","21":"jihlava","22":"jindrichuv-hradec","23":"karlovy-vary","25":"klatovy","26":"kolin","29":"kromeriz","30":"kutna-hora","31":"liberec","33":"louny","36":"melnik","37":"most","38":"nachod","39":"novy-jicin","40":"olomouc","41":"opava","42":"ostrava","43":"pardubice","45":"pisek","46":"plzen","47":"praha","49":"prerov","50":"pribram","51":"prostejov","52":"rokycany","55":"sokolov","57":"strakonice","58":"sumperk","60":"tabor","61":"tachov","62":"teplice","63":"trebic","66":"trutnov","68":"uherske-hradiste","69":"usti-nad-labem","72":"vsetin","73":"vyskov","75":"zdar-nad-sazavou","76":"zlin","77":"znojmo","78":"zatec","86":"czt-cesko","91":"boskovice","101":"domazlice","102":"chrudim","103":"jesenik","104":"jicin","105":"kladno","106":"litomerice","107":"mlada-boleslav","109":"pelhrimov","110":"rakovnik","111":"rychnov-nad-kneznou","112":"semily","113":"svitavy","114":"usti-nad-orlici","3194":"bruntal","3207":"dvur-kralove-nad-labem","3212":"havirov","3224":"hranice","3240":"karvina","3248":"kraslice","3250":"krnov","3258":"litomysl","3264":"marianske-lazne","3275":"nove-mesto-na-morave","3293":"prestice","3300":"rumburk","3321":"trinec","3344":"votice"};
Joms.appId="03820cae5bce5f662af3b3711db36bfd";
Joms.domains=["*.rwe.cz","map.rwe.cz","rwe.webmapy.cz"];
Joms.mapBorder = {"ldx":181284,"ldy":5280242,"phx":892834,"phy":5754292};
Joms.mapLevelCache = {"3":[{"id":3,"count":3,"ldx":429332,"ldy":5530448,"rux":436420,"ruy":5537508,"border":["429332.00","5537508.00","436420.00","5537508.00","436420.00","5530448.00","429332.00","5530448.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"4":[{"id":4,"count":3,"ldx":618022,"ldy":5467148,"rux":621102,"ruy":5471708,"border":["618022.00","5471708.00","621102.00","5471708.00","621102.00","5467148.00","618022.00","5467148.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"5":[{"id":5,"count":3,"ldx":635252,"ldy":5399180,"rux":641708,"ruy":5405508,"border":["635252.00","5405508.00","641708.00","5405508.00","641708.00","5399180.00","635252.00","5399180.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"6":[{"id":6,"count":3,"ldx":604257,"ldy":5442040,"rux":625865,"ruy":5460488,"border":["604257.00","5460488.00","625865.00","5460488.00","625865.00","5442040.00","604257.00","5442040.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"7":[{"id":7,"count":3,"ldx":464842,"ldy":5612396,"rux":469234,"ruy":5617268,"border":["464842.00","5617268.00","469234.00","5617268.00","469234.00","5612396.00","464842.00","5612396.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"8":[{"id":8,"count":3,"ldx":457992,"ldy":5420406,"rux":467272,"ruy":5429318,"border":["457992.00","5429318.00","467272.00","5429318.00","467272.00","5420406.00","457992.00","5420406.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"9":[{"id":9,"count":3,"ldx":448202,"ldy":5404146,"rux":452118,"ruy":5409498,"border":["448202.00","5409498.00","452118.00","5409498.00","452118.00","5404146.00","448202.00","5404146.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"11":[{"id":11,"count":3,"ldx":438852,"ldy":5620050,"rux":447804,"ruy":5628098,"border":["438852.00","5628098.00","447804.00","5628098.00","447804.00","5620050.00","438852.00","5620050.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"12":[{"id":12,"count":3,"ldx":439232,"ldy":5513088,"rux":443640,"ruy":5517008,"border":["439232.00","5517008.00","443640.00","5517008.00","443640.00","5513088.00","439232.00","5513088.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"15":[{"id":15,"count":3,"ldx":538947,"ldy":5493002,"rux":543755,"ruy":5496998,"border":["538947.00","5496998.00","543755.00","5496998.00","543755.00","5493002.00","538947.00","5493002.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"16":[{"id":16,"count":3,"ldx":653482,"ldy":5411308,"rux":658278,"ruy":5416288,"border":["653482.00","5416288.00","658278.00","5416288.00","658278.00","5411308.00","653482.00","5411308.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"17":[{"id":17,"count":3,"ldx":553162,"ldy":5556902,"rux":565342,"ruy":5566498,"border":["553162.00","5566498.00","565342.00","5566498.00","565342.00","5556902.00","553162.00","5556902.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"19":[{"id":19,"count":3,"ldx":309952,"ldy":5548008,"rux":315320,"ruy":5552208,"border":["309952.00","5552208.00","315320.00","5552208.00","315320.00","5548008.00","309952.00","5548008.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"20":[{"id":20,"count":3,"ldx":383692,"ldy":5586838,"rux":391772,"ruy":5597218,"border":["383692.00","5597218.00","391772.00","5597218.00","391772.00","5586838.00","383692.00","5586838.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"21":[{"id":21,"count":3,"ldx":538757,"ldy":5469137,"rux":546741,"ruy":5478053,"border":["538757.00","5478053.00","546741.00","5478053.00","546741.00","5469137.00","538757.00","5469137.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"22":[{"id":22,"count":3,"ldx":498972,"ldy":5441288,"rux":502496,"ruy":5446028,"border":["498972.00","5446028.00","502496.00","5446028.00","502496.00","5441288.00","498972.00","5441288.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"23":[{"id":23,"count":3,"ldx":343302,"ldy":5563178,"rux":351870,"ruy":5569458,"border":["343302.00","5569458.00","351870.00","5569458.00","351870.00","5563178.00","343302.00","5563178.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"25":[{"id":25,"count":3,"ldx":373162,"ldy":5469967,"rux":378082,"ruy":5475223,"border":["373162.00","5475223.00","378082.00","5475223.00","378082.00","5469967.00","373162.00","5469967.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"26":[{"id":26,"count":3,"ldx":511942,"ldy":5538819,"rux":517058,"ruy":5545443,"border":["511942.00","5545443.00","517058.00","5545443.00","517058.00","5538819.00","511942.00","5538819.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"29":[{"id":29,"count":3,"ldx":670577,"ldy":5460492,"rux":676693,"ruy":5466228,"border":["670577.00","5466228.00","676693.00","5466228.00","676693.00","5460492.00","670577.00","5460492.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"30":[{"id":30,"count":3,"ldx":517217,"ldy":5530110,"rux":522633,"ruy":5537278,"border":["517217.00","5537278.00","522633.00","5537278.00","522633.00","5530110.00","517217.00","5530110.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"31":[{"id":31,"count":3,"ldx":499002,"ldy":5618008,"rux":510434,"ruy":5628608,"border":["499002.00","5628608.00","510434.00","5628608.00","510434.00","5618008.00","499002.00","5618008.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"33":[{"id":33,"count":3,"ldx":411432,"ldy":5575634,"rux":417408,"ruy":5582698,"border":["411432.00","5582698.00","417408.00","5582698.00","417408.00","5575634.00","411432.00","5575634.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"36":[{"id":36,"count":3,"ldx":460102,"ldy":5575046,"rux":466942,"ruy":5583798,"border":["460102.00","5583798.00","466942.00","5583798.00","466942.00","5575046.00","460102.00","5575046.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"37":[{"id":37,"count":3,"ldx":401252,"ldy":5592900,"rux":407020,"ruy":5598628,"border":["401252.00","5598628.00","407020.00","5598628.00","407020.00","5592900.00","401252.00","5592900.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"38":[{"id":38,"count":3,"ldx":580172,"ldy":5583337,"rux":585060,"ruy":5587673,"border":["580172.00","5587673.00","585060.00","5587673.00","585060.00","5583337.00","580172.00","5583337.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"39":[{"id":39,"count":3,"ldx":714572,"ldy":5494742,"rux":720324,"ruy":5500398,"border":["714572.00","5500398.00","720324.00","5500398.00","720324.00","5494742.00","714572.00","5494742.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"40":[{"id":40,"count":3,"ldx":656162,"ldy":5490344,"rux":672738,"ruy":5502988,"border":["656162.00","5502988.00","672738.00","5502988.00","672738.00","5490344.00","656162.00","5490344.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"41":[{"id":41,"count":3,"ldx":705087,"ldy":5532219,"rux":712203,"ruy":5538583,"border":["705087.00","5538583.00","712203.00","5538583.00","712203.00","5532219.00","705087.00","5532219.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"42":[{"id":42,"count":3,"ldx":723007,"ldy":5514353,"rux":742991,"ruy":5533533,"border":["723007.00","5533533.00","742991.00","5533533.00","742991.00","5514353.00","723007.00","5514353.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"43":[{"id":43,"count":3,"ldx":547742,"ldy":5538349,"rux":560762,"ruy":5548393,"border":["547742.00","5548393.00","560762.00","5548393.00","560762.00","5538349.00","547742.00","5538349.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"45":[{"id":45,"count":3,"ldx":435572,"ldy":5460076,"rux":440352,"ruy":5464188,"border":["435572.00","5464188.00","440352.00","5464188.00","440352.00","5460076.00","435572.00","5460076.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"46":[{"id":46,"count":3,"ldx":372547,"ldy":5500718,"rux":394163,"ruy":5521218,"border":["372547.00","5521218.00","394163.00","5521218.00","394163.00","5500718.00","372547.00","5500718.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"47":[{"id":47,"count":3,"ldx":423652,"ldy":5509468,"rux":484060,"ruy":5573148,"border":["423652.00","5573148.00","484060.00","5573148.00","484060.00","5509468.00","423652.00","5509468.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"49":[{"id":49,"count":3,"ldx":674322,"ldy":5475598,"rux":680862,"ruy":5483598,"border":["674322.00","5483598.00","680862.00","5483598.00","680862.00","5475598.00","674322.00","5475598.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"50":[{"id":50,"count":3,"ldx":425842,"ldy":5501308,"rux":430882,"ruy":5506548,"border":["425842.00","5506548.00","430882.00","5506548.00","430882.00","5501308.00","425842.00","5501308.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"51":[{"id":51,"count":3,"ldx":649292,"ldy":5480032,"rux":656572,"ruy":5484948,"border":["649292.00","5484948.00","656572.00","5484948.00","656572.00","5480032.00","649292.00","5480032.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"52":[{"id":52,"count":3,"ldx":396852,"ldy":5508728,"rux":401492,"ruy":5512728,"border":["396852.00","5512728.00","401492.00","5512728.00","401492.00","5508728.00","396852.00","5508728.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"55":[{"id":55,"count":3,"ldx":330222,"ldy":5558720,"rux":334862,"ruy":5563128,"border":["330222.00","5563128.00","334862.00","5563128.00","334862.00","5558720.00","330222.00","5558720.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"57":[{"id":57,"count":3,"ldx":418442,"ldy":5453746,"rux":423074,"ruy":5459858,"border":["418442.00","5459858.00","423074.00","5459858.00","423074.00","5453746.00","418442.00","5453746.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"58":[{"id":58,"count":3,"ldx":638947,"ldy":5534525,"rux":644983,"ruy":5539453,"border":["638947.00","5539453.00","644983.00","5539453.00","644983.00","5534525.00","638947.00","5534525.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"60":[{"id":60,"count":3,"ldx":473377,"ldy":5468217,"rux":480061,"ruy":5476153,"border":["473377.00","5476153.00","480061.00","5476153.00","480061.00","5468217.00","473377.00","5468217.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"61":[{"id":61,"count":3,"ldx":327532,"ldy":5517598,"rux":331860,"ruy":5520658,"border":["327532.00","5520658.00","331860.00","5520658.00","331860.00","5517598.00","327532.00","5517598.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"62":[{"id":62,"count":3,"ldx":413072,"ldy":5607940,"rux":422480,"ruy":5616348,"border":["413072.00","5616348.00","422480.00","5616348.00","422480.00","5607940.00","413072.00","5607940.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"63":[{"id":63,"count":3,"ldx":561282,"ldy":5449884,"rux":567046,"ruy":5453568,"border":["561282.00","5453568.00","567046.00","5453568.00","567046.00","5449884.00","561282.00","5449884.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"66":[{"id":66,"count":3,"ldx":561982,"ldy":5600576,"rux":568694,"ruy":5605328,"border":["561982.00","5605328.00","568694.00","5605328.00","568694.00","5600576.00","561982.00","5600576.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"68":[{"id":68,"count":3,"ldx":675752,"ldy":5433340,"rux":683992,"ruy":5440588,"border":["675752.00","5440588.00","683992.00","5440588.00","683992.00","5433340.00","675752.00","5433340.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"69":[{"id":69,"count":3,"ldx":427522,"ldy":5608708,"rux":440410,"ruy":5616748,"border":["427522.00","5616748.00","440410.00","5616748.00","440410.00","5608708.00","427522.00","5608708.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"72":[{"id":72,"count":3,"ldx":715352,"ldy":5467116,"rux":720412,"ruy":5471428,"border":["715352.00","5471428.00","720412.00","5471428.00","720412.00","5467116.00","715352.00","5467116.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"73":[{"id":73,"count":3,"ldx":641417,"ldy":5458660,"rux":647301,"ruy":5464308,"border":["641417.00","5464308.00","647301.00","5464308.00","647301.00","5458660.00","641417.00","5458660.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"75":[{"id":75,"count":3,"ldx":566662,"ldy":5488809,"rux":569454,"ruy":5493373,"border":["566662.00","5493373.00","569454.00","5493373.00","569454.00","5488809.00","566662.00","5488809.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"76":[{"id":76,"count":3,"ldx":685902,"ldy":5449638,"rux":702782,"ruy":5461818,"border":["685902.00","5461818.00","702782.00","5461818.00","702782.00","5449638.00","685902.00","5449638.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"77":[{"id":77,"count":3,"ldx":574767,"ldy":5408441,"rux":580907,"ruy":5415633,"border":["574767.00","5415633.00","580907.00","5415633.00","580907.00","5408441.00","574767.00","5408441.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"78":[{"id":78,"count":3,"ldx":393702,"ldy":5574480,"rux":398002,"ruy":5577888,"border":["393702.00","5577888.00","398002.00","5577888.00","398002.00","5574480.00","393702.00","5574480.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"86":[{"id":86,"count":6,"ldx":181284,"ldy":5280242,"rux":892834,"ruy":5754292,"border":["181284.00","5754292.00","892834.00","5754292.00","892834.00","5280242.00","181284.00","5280242.00"]},[{"zoom":0,"mppx":950},{"zoom":1,"mppx":246},{"zoom":2,"mppx":100},{"zoom":3,"mppx":50},{"zoom":4,"mppx":25},{"zoom":5,"mppx":15}]],"91":[{"id":91,"count":3,"ldx":618587,"ldy":5481822,"rux":622431,"ruy":5484618,"border":["618587.00","5484618.00","622431.00","5484618.00","622431.00","5481822.00","618587.00","5481822.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"101":[{"id":101,"count":3,"ldx":347727,"ldy":5476846,"rux":352331,"ruy":5480478,"border":["347727.00","5480478.00","352331.00","5480478.00","352331.00","5476846.00","347727.00","5476846.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"102":[{"id":102,"count":3,"ldx":553997,"ldy":5530998,"rux":558989,"ruy":5534998,"border":["553997.00","5534998.00","558989.00","5534998.00","558989.00","5530998.00","553997.00","5530998.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"103":[{"id":103,"count":3,"ldx":654687,"ldy":5564048,"rux":659183,"ruy":5569708,"border":["654687.00","5569708.00","659183.00","5569708.00","659183.00","5564048.00","654687.00","5564048.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"104":[{"id":104,"count":3,"ldx":523452,"ldy":5585468,"rux":528152,"ruy":5589808,"border":["523452.00","5589808.00","528152.00","5589808.00","528152.00","5585468.00","523452.00","5585468.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"105":[{"id":105,"count":3,"ldx":432342,"ldy":5547470,"rux":442630,"ruy":5558798,"border":["432342.00","5558798.00","442630.00","5558798.00","442630.00","5547470.00","432342.00","5547470.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"106":[{"id":106,"count":3,"ldx":436362,"ldy":5596972,"rux":440850,"ruy":5601408,"border":["436362.00","5601408.00","440850.00","5601408.00","440850.00","5596972.00","436362.00","5596972.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"107":[{"id":107,"count":3,"ldx":490422,"ldy":5580708,"rux":496334,"ruy":5589248,"border":["490422.00","5589248.00","496334.00","5589248.00","496334.00","5580708.00","490422.00","5580708.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"109":[{"id":109,"count":3,"ldx":514402,"ldy":5472468,"rux":517810,"ruy":5477148,"border":["514402.00","5477148.00","517810.00","5477148.00","517810.00","5472468.00","514402.00","5472468.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"110":[{"id":110,"count":3,"ldx":407072,"ldy":5549158,"rux":411252,"ruy":5552258,"border":["407072.00","5552258.00","411252.00","5552258.00","411252.00","5549158.00","407072.00","5549158.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"111":[{"id":111,"count":3,"ldx":590042,"ldy":5555674,"rux":593046,"ruy":5559118,"border":["590042.00","5559118.00","593046.00","5559118.00","593046.00","5555674.00","590042.00","5555674.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"112":[{"id":112,"count":3,"ldx":521942,"ldy":5604450,"rux":525070,"ruy":5607458,"border":["521942.00","5607458.00","525070.00","5607458.00","525070.00","5604450.00","521942.00","5604450.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"113":[{"id":113,"count":3,"ldx":604032,"ldy":5510048,"rux":607276,"ruy":5514408,"border":["604032.00","5514408.00","607276.00","5514408.00","607276.00","5510048.00","604032.00","5510048.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"114":[{"id":114,"count":3,"ldx":597267,"ldy":5534041,"rux":601787,"ruy":5538073,"border":["597267.00","5538073.00","601787.00","5538073.00","601787.00","5534041.00","597267.00","5534041.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"3194":[{"id":3194,"count":3,"ldx":675092,"ldy":5538699,"rux":678260,"ruy":5541963,"border":["675092.00","5541963.00","678260.00","5541963.00","678260.00","5538699.00","675092.00","5538699.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"3207":[{"id":3207,"count":3,"ldx":555582,"ldy":5584714,"rux":559214,"ruy":5588938,"border":["555582.00","5588938.00","559214.00","5588938.00","559214.00","5584714.00","555582.00","5584714.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"3212":[{"id":3212,"count":3,"ldx":742942,"ldy":5516898,"rux":752162,"ruy":5523978,"border":["742942.00","5523978.00","752162.00","5523978.00","752162.00","5516898.00","742942.00","5516898.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"3224":[{"id":3224,"count":3,"ldx":694102,"ldy":5489956,"rux":700062,"ruy":5494788,"border":["694102.00","5494788.00","700062.00","5494788.00","700062.00","5489956.00","694102.00","5489956.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"3240":[{"id":3240,"count":3,"ldx":751492,"ldy":5526072,"rux":758176,"ruy":5531348,"border":["751492.00","5531348.00","758176.00","5531348.00","758176.00","5526072.00","751492.00","5526072.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"3248":[{"id":3248,"count":3,"ldx":321372,"ldy":5576187,"rux":323852,"ruy":5580483,"border":["321372.00","5580483.00","323852.00","5580483.00","323852.00","5576187.00","321372.00","5576187.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"3250":[{"id":3250,"count":3,"ldx":690612,"ldy":5550649,"rux":695404,"ruy":5553773,"border":["690612.00","5553773.00","695404.00","5553773.00","695404.00","5550649.00","690612.00","5550649.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"3258":[{"id":3258,"count":3,"ldx":592802,"ldy":5523821,"rux":595546,"ruy":5526893,"border":["592802.00","5526893.00","595546.00","5526893.00","595546.00","5523821.00","592802.00","5523821.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"3264":[{"id":3264,"count":3,"ldx":331442,"ldy":5534098,"rux":337442,"ruy":5539538,"border":["331442.00","5539538.00","337442.00","5539538.00","337442.00","5534098.00","331442.00","5534098.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"3275":[{"id":3275,"count":3,"ldx":576377,"ldy":5489363,"rux":579017,"ruy":5493063,"border":["576377.00","5493063.00","579017.00","5493063.00","579017.00","5489363.00","576377.00","5489363.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"3293":[{"id":3293,"count":3,"ldx":377917,"ldy":5491538,"rux":380281,"ruy":5493798,"border":["377917.00","5493798.00","380281.00","5493798.00","380281.00","5491538.00","377917.00","5491538.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"3300":[{"id":3300,"count":3,"ldx":466437,"ldy":5641647,"rux":471653,"ruy":5647643,"border":["466437.00","5647643.00","471653.00","5647643.00","471653.00","5641647.00","466437.00","5641647.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"3321":[{"id":3321,"count":3,"ldx":761272,"ldy":5505429,"rux":767612,"ruy":5511733,"border":["761272.00","5511733.00","767612.00","5511733.00","767612.00","5505429.00","761272.00","5505429.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"3344":[{"id":3344,"count":3,"ldx":472912,"ldy":5497622,"rux":475248,"ruy":5499938,"border":["472912.00","5499938.00","475248.00","5499938.00","475248.00","5497622.00","472912.00","5497622.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]]};
Joms.baseMaps = [86];
Joms.mapDataCache = {"86":{"1":[{"id":0,"column_length":3,"x_length":3,"y_length":2,"ldx":181284,"ldy":5280242,"rux":892834,"ruy":5754292,"mppx":950,"tile_width":250,"tile_height":250,"icon_width":16,"icon_height":16,"base_map":1,"columns":3,"type":"png","dir":"czt-cesko","scale":"0","layers_dir":"","first":0,"repl":1,"center_x":537059,"center_y":5517267,"group":0,"virtual":0},{"id":1,"column_length":8,"x_length":8,"y_length":5,"ldx":292269,"ldy":5362638,"rux":784269,"ruy":5670138,"mppx":246,"tile_width":250,"tile_height":250,"icon_width":16,"icon_height":16,"base_map":1,"columns":8,"type":"png","dir":"cesko","scale":"0","layers_dir":"","first":0,"repl":1,"center_x":537059,"center_y":5517267,"group":0,"virtual":0},{"id":2,"column_length":20,"x_length":20,"y_length":12,"ldx":288196,"ldy":5366429,"rux":788196,"ruy":5666429,"mppx":100,"tile_width":250,"tile_height":250,"icon_width":16,"icon_height":16,"base_map":1,"columns":20,"type":"png","dir":"cesko","scale":"0","layers_dir":"","first":0,"repl":1,"center_x":537059,"center_y":5517267,"group":0,"virtual":0},{"id":3,"column_length":41,"x_length":41,"y_length":24,"ldx":279500,"ldy":5365614,"rux":792000,"ruy":5665614,"mppx":50,"tile_width":250,"tile_height":250,"icon_width":16,"icon_height":16,"base_map":1,"columns":41,"type":"png","dir":"cesko","scale":"0","layers_dir":"","first":0,"repl":1,"center_x":537059,"center_y":5517267,"group":0,"virtual":0},{"id":4,"column_length":21,"x_length":82,"y_length":47,"ldx":279438,"ldy":5368770,"rux":791938,"ruy":5662520,"mppx":25,"tile_width":250,"tile_height":250,"icon_width":16,"icon_height":16,"base_map":1,"columns":21,"type":"png","dir":"cesko","scale":"0","layers_dir":"","first":0,"repl":1,"center_x":537059,"center_y":5517267,"group":0,"virtual":0},{"id":5,"column_length":13,"x_length":136,"y_length":78,"ldx":280680,"ldy":5369397,"rux":790680,"ruy":5661897,"mppx":15,"tile_width":250,"tile_height":250,"icon_width":16,"icon_height":16,"base_map":1,"columns":13,"type":"png","dir":"cesko","scale":"0","layers_dir":"","first":0,"repl":1,"center_x":537059,"center_y":5517267,"group":0,"virtual":0}],"0":"86","2":["181284.00","5754292.00","892834.00","5754292.00","892834.00","5280242.00","181284.00","5280242.00"],"3":"0","4":[60,77,78,91,101,102,103,104,105,76,75,61,62,63,66,68,69,72,73,106,107,109,3248,3250,3258,3264,3275,3293,3300,3321,3240,3224,110,111,112,113,114,3194,3207,3212,3344,3,17,19,20,21,22,23,25,26,16,15,4,5,6,7,8,9,11,12,29,30,31,46,47,49,50,51,52,55,57,45,43,33,36,37,38,39,40,41,42,58]}};
Joms.adds = [];

for (var i = 0; i < Joms.domains.length; ++i) 
{
	var alDom = Joms.domains[i];
	if (document.domain == alDom || document.domain == 'www.'+alDom) {
		break;
	}

	if (alDom.substring(1,0) == '*') 
	{	
		var regExp = '[.]' + alDom.replace('.', '\\.');
		var ret = document.domain.match(regExp);
		if (ret != null) {
			break;
		}
	}
	
	if (i == Joms.domains.length-1) {
		alert('Přístup k Joms API odepřen. Klíč není určen k použití na této doméně ("'+ document.domain +'").');
	}
}


