var JomsLocal = false;var Joms=new Object();var J=new Object();if(JomsLocal){Joms.baseUrl="http://joms/";Joms.mapDir="http://maps.planstudio.cz";Joms.mapsDomainTemplate="http://m{0}.planstudio.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.planstudio.cz";Joms.mapsDomainTemplate="http://m{0}.planstudio.cz";Joms.mapsDomainCount=4;Joms.layerDir="http://layers.planstudio.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){this.set(A,B)};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},set: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}},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.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};function CCallWrapper(L,N,B,A,M,K,I,H,G,F,E,D,C){this.mId="CCallWrapper_"+(CCallWrapper.mCounter++);this.mObjectReference=L;this.mDelay=N;this.mTimerId=0;this.mMethodName=B;this.mArgument0=A;this.mArgument1=M;this.mArgument2=K;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={};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=J.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.startsWith=function(B,A){return(B.substr(0,4)==A)};Joms.trim=function(A){return A.replace(/^\s\s*/,"").replace(/\s\s*$/,"")};Joms.rtrim=function(C,B){var A=new RegExp("["+B+"]*$","ig");return C.replace(A,"")};Joms.Utm2Wgs84=function(A,B){return Joms.Convert.UtmToWgs(B,A)};Joms.deg=function(F,C){function A(K,L){K=parseFloat(K);L=parseFloat(L);K=Math.round(K*Math.pow(10,L))/Math.pow(10,L);return K}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=J.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(E,A,F,D,C,B){app.objectList.changeObjects.call(app.objectList,E,A,F,D,C,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};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}};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};Joms.ShowPopUpWindowCenter=function(C,B,A){iMyWidth=(window.screen.width-B)/2;iMyHeight=(window.screen.height-A)/2;return window.open(C,"","width="+B+"px, height="+A+"px, left="+iMyWidth+",top="+iMyHeight+", resizable=yes, titlebar=no, status=yes, address=no, scrollbars=no, dependent=yes, modal=yes")};J.isInt=function(A){var B=parseInt(A);if(isNaN(B)){return false}return A==B&&A.toString()==B.toString()};J.gid=function(A){return document.getElementById(A)};J.gidc=function(B){if(B==undefined||B==null){return null}var A=document.getElementById(B);if(A==null){debug("element "+B+" was not found")}return A};J.cel=function(A){return document.createElement(A)};J.ctn=function(A){return document.createTextNode(A)};J.cea=function(H,D,G,B,E,F,C){var A=J.cel("a");if(B!=undefined){Joms.Event.addClickEvent(A,function(){B.call(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};J.ceaImg=function(A,I,E,K,C,B,F,G){var H=J.cel("a");if(B!=undefined){Joms.Event.addClickEvent(H,function(){B.call(K,C)})}var D=J.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};J.ArrContains=function(C,B){var A=C.length;while(A--){if(C[A]===B){return true}}return false};gid=J.gid;gidc=J.gidc;cel=J.cel;ctn=J.ctn;isInt=J.isInt;JceaImg=J.ceaImg;Jcea=J.cea;function $(A){if(typeof A=="string"){A=document.getElementById(A)}return A}function scrollToElem(A){window.scrollTo(Joms.findPosX(A),Joms.findPosY(A))}function urlEncode(A){return encodeURIComponent(A)}function urlDecode(A){return decodeURIComponent(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}function debug(){var B=J.gid("jomsDebug");if(!B){return }B.style.display="block";debug_count++;str="";for(var A=0;A<debug.arguments.length;++A){str+=debug.arguments[A]+";"}B.innerHTML=B.innerHTML+str+"<br />"}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(J.gid(A)!=null){this.addClickEvent(J.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,H,G,B,F){var E=Joms.Ajax.newRequest();if(G==undefined){G="get"}if(B==undefined){B=null}if(C){E.onreadystatechange=function(){try{if(E&&E.readyState==4){if(E.status==200){H.call(D,E.responseText,F)}Joms.Ajax.requestDone()}}catch(I){Joms.Ajax.requestDone()}}}if(G=="get"){A=A+"&a="+Joms.appId+"&time="+(new Date()).getTime()}else{B=B+"&a="+Joms.appId+"&time="+(new Date()).getTime()}E.open(G,A,C);Joms.showLoading(true);if(G=="post"){E.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}E.send(B);if(!C){H.call(D,E.responseText,F);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.9){return 5}else{if(B<6.9){return 6}else{if(B<7.9){return 7}else{return 8}}}}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"){return false}else{return true}}};Joms.UtmWgsConvertor=function(B,A){this.setZone(B,A)};Joms.UtmWgsConvertor.prototype={setZone: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()},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(K,A){K=K*this.D2R;A=A*this.D2R;var D=this.adjust_lon(A-this.long0);var B;var P,N;var O=Math.sin(K);var H=Math.cos(K);if(this.sphere){var M=H*Math.sin(D);if((Math.abs(Math.abs(M)-1))<1e-10){alert("tmerc:forward: Point projects into infinity");return(93)}else{P=0.5*this.a*this.k0*Math.log((1+M)/(1-M));B=Math.acos(H*Math.cos(D)/Math.sqrt(1-M*M));if(K<0){B=-B}N=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 L=Math.tan(K);var Q=Math.pow(L,2);B=1-this.es*Math.pow(O,2);var C=this.a/Math.sqrt(B);var E=this.a*this.mlfn(this.e0,this.e1,this.e2,this.e3,K);P=this.k0*C*G*(1+F/6*(1-Q+I+F/20*(5-18*Q+Math.pow(Q,2)+72*I-58*this.ep2)))+this.x0;N=this.k0*(E-this.ml0+C*L*(F*(0.5+F/24*(5-Q+9*I+4*Math.pow(I,2)+F/30*(61-58*Q+Math.pow(Q,2)+600*I-330*this.ep2)))))+this.y0}return new Joms.Coord(P,N)},UtmToWgs:function(P,N){var E,C;var Z;var S;var H=6;var G,D;if(this.sphere){var V=Math.exp(P/(this.a*this.k0));var U=0.5*(V-1/V);var X=this.lat0+N/(this.a*this.k0);var T=Math.cos(X);E=Math.sqrt((1-T*T)/(1+U*U));G=Math.asinz(E);if(X<0){G=-G}if((U==0)&&(T==0)){D=this.long0}else{D=this.adjust_lon(Math.atan2(U,T)+this.long0)}}else{var K=P-this.x0;var I=N-this.y0;E=(this.ml0+I/this.k0)/this.a;C=E;for(S=0;;S++){Z=((E+this.e1*Math.sin(2*C)-this.e2*Math.sin(4*C)+this.e3*Math.sin(6*C))/this.e0)-C;C+=Z;if(Math.abs(Z)<=this.EPSLN){break}if(S>=H){alert("tmerc:inverse: Latitude failed to converge");return(95)}}if(Math.abs(C)<this.HALF_PI){var B=Math.sin(C);var a=Math.cos(C);var L=Math.tan(C);var Y=this.ep2*Math.pow(a,2);var F=Math.pow(Y,2);var M=Math.pow(L,2);var A=Math.pow(M,2);E=1-this.es*Math.pow(B,2);var R=this.a/Math.sqrt(E);var O=R*(1-this.es)/E;var W=K/(R*this.k0);var Q=Math.pow(W,2);G=C-(R*L*Q/O)*(0.5-Q/24*(5+3*M+10*Y-4*F-9*this.ep2-Q/30*(61+90*M+298*Y+45*A-252*this.ep2-3*F)));D=this.adjust_lon(this.long0+(W*(1-Q/6*(1+2*M+Y-Q/20*(5-2*Y+28*M-3*F+8*this.ep2+24*A)))/a))}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(N){var M,L,I,K;K=N.split(";");for(M=0,L=0,I=C.length;M<I;++M,L+=2){E[M]=new Joms.Coord(K[L],K[L+1])}},"post","t=cm&from="+H+"&to="+G+"&c="+B);return E}};Joms.App=function(C,B,D,A){this.elname=C;if(C.indexOf("_")!=-1){Joms.error("Joms.App",'Id elementu nesmí obsahovat znak "_". Některé funkce API pak nemusí být funkční.')}this.el=J.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=J.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(J.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=J.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/?ad=jomsapi&amp;type=copyright&amp;name=jomsapi">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.copyrightEl=A;this.el.appendChild(A)},addStaticElement:function(A){this.el.appendChild(A)},removeStaticElement:function(A){this.el.removeChild(A)},setZoomInfo:function(A){this.changeApp(A.map,new Joms.Coord(this.map.center.x,this.map.center.y),A.zoom,undefined)},getAvailableZoomInfoArray:function(){var B=new Array();for(var C=this.zoom.outMap.length-1;C>=0;--C){for(var A=0;A<this.zoom.outMap[C].count;++A){this._addAvailableZoomInfo(B,this.zoom.outMap[C].id,A)}}for(A=0;A<this.zoom.zoom.length;++A){this._addAvailableZoomInfo(B,this.mapId,A)}for(var D=0;D<this.map.inMaps.length;D++){for(A=0;A<this.map.inMaps[D].count;++A){this._addAvailableZoomInfo(B,this.map.inMaps[D].id,A)}}return B},_addAvailableZoomInfo:function(A,B,D){var C=this.zoom.getZoomInfo(B,D);C.selected=(this.mapId==B&&this.map.zoom.id==D?true:false);A.push(C)},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)},removeBounds:function(A){if(!(A=Joms.maps[A])){Joms.error("Joms.App","Zadán neplatný identifikátor mapy.");return false}if(this.bounds[A]!=undefined){delete this.bounds[A];return true}else{return false}},print:function(A){this.printNetmap(A)},printNetmap:function(B){var D=this.mapWidth;var A=this.mapHeight;if(D>screen.width){D=screen.width}if(A>screen.height){A=screen.height}if(B==undefined){if(this.query&&this.query.isRouteValid()){B=this.query.route}}var C=Joms.baseUrl+"print/"+this.getPrintUrlParams(D,A)+(B&&B.isValid()?"&trackId="+B.id:"");window.open(C,"print","width="+(D+50)+",height="+(A+100)+",location=yes,scrollbars=yes,menubar=yes,resizable=yes,left="+10+",top="+10)},getImageUrl:function(B,A){return Joms.baseUrl+"data/servlet/print.php"+this.getPrintUrlParams(B,A)},getPrintUrlParams:function(B,I){var G="";if(this.netmapObjects){G="&voc="+this.netmapObjects.getVisibleCategoryIdList()}var E="";var D="";if(this.query){for(var F in this.query.layers){if(!this.query.layers[F]){continue}E+=F+",";var H=this.map.getOverlayLayer(F);if(H){D+=H.opacity+","}}}if(E!=""){E="&layer="+Joms.rtrim(E,",")}if(D!=""){D="&layerOpacity="+Joms.rtrim(D,",")}var C=this.getServletContext();var A="?a="+Joms.appId+(C.isValid()?"&context="+C.id:"")+"&width="+B+"&height="+I+"&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:"")+E+D+G;return 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.map.checkInMap(E);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(P,O,L,B){var F=false,N=0,I=0,M;var D=false;var H,E,C,K;O=parseInt(O);L=parseInt(L);if(B==undefined){B=false}if(Joms.inRange(O,L,this.zoom.mapBorder)){for(E=0,K=this.zoom.zoom.length;E<K;++E){if(Joms.checkMppx(F,P,this.zoom.zoom[E].mppx,B)){F=Math.abs(this.zoom.zoom[E]["mppx"]-P);N=this.zoom.zoom[E]["id"];I="zoom"+this.name+"_"+this.mapId+"_"+this.zoom.zoom[E]["id"];D=true}}}if(O&&L){var A,G;for(H=0,C=this.zoom.outMap.length;H<C;++H){for(E=0,K=this.zoom.mppxs[this.zoom.outMap[H].id].length;E<K;++E){M=this.zoom.mppxs[this.zoom.outMap[H].id][E].mppx;if(Joms.checkMppx(F,P,M,B)){F=Math.abs(M-P);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(O,L,this.zoom.inMap[H].border)){for(E=0,K=this.zoom.mppxs[this.zoom.inMap[H].id].length;E<K;++E){M=this.zoom.mppxs[this.zoom.inMap[H].id][E].mppx;if(Joms.checkMppx(F,P,M,B)){F=Math.abs(M-P);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 N}else{return 0}}},error:function(C,B,A){this.hooks.call("error","e",C,B,A)},errorservlet:function(A){this.hooks.call("error","e",A.id,"servlet",A.desc)},warning:function(C,B,A){this.hooks.call("error","w",C,B,A)},notice:function(C,B,A){this.hooks.call("error","n",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.notice(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 false}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){debug("aaarg")},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)},clearResult:function(){if(this.cfg.routeResult){this.cfg.routeResult.innerHTML=""}if(this.cfg.searchResult){this.cfg.searchResult.innerHTML=""}},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)},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},objectBubble:function(B,A){new Joms.Ajax.Request(this,Joms.dataScript+"?t=o2&f=b&id="+B,true,function(C){this.textBox.setText(C)});this.textBox.show(A)},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(){this.markerIcon=new Joms.Icon(Joms.baseUrl+"images/arrow.png",57,46,Joms.IconCenter.BOTTOM_LEFT,"png")};Joms.AppConf.prototype={zoomWidth:16,zoomHeight:20,searchResult:null,routeResult:null,loadingBox:null,mapEvents:null,enableKeys:false,enableMouseWheel:true,width:null,height:null,markerIcon:null,repairMapSize:false,iconCategories:null,opacity:100};Joms.Map=function(B,A,C){this.cont=J.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=J.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();this.opacity=B.cfg.opacity};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||!J.isInt(A)||!J.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||!J.isInt(A)||!J.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)},setCenterZoomMppx:function(C,B){var A=this.app.getLevelFromMppx(B,C.x,C.y,true);this.app.changeZoom(undefined,A,C.x,C.y)},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(Math.max(D,C),A.x,A.y,true);if(B==0){this.app.notice(3,"Joms.Map","Čtvercová oblast je větší než oblast zobrazitelná v mapě. Byla zvolena nejméně podrobná mapa, ale oblast nebude celá viditelná.");B="zoom"+this.app.name+"_"+Joms.baseMaps[0]+"_0"}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){this.markLayer=new Joms.CustomLayer(this.app,"mapMark",20);this.mark=new Joms.Marker(this.app,B,this.app.cfg.markerIcon);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.tiles.setOpacity()},switchOpacity:function(){if(this.opacity>=100){this.setOpacity(50)}else{this.setOpacity(100)}},getCurrentZoom:function(){return this.zoom.id},getCurrentZoomMppx:function(){return this.zoom.mppx},getCurrentIconSize:function(){return this.zoom.icon_width},getCurrentMap:function(){return Joms.maps_r[this.app.mapId]},px2unit:function(A){return new Joms.Coord(this.px2unitX(A.x),this.px2unitY(A.y))},unit2px:function(A){return new Joms.Coord(this.unit2pxX(A.x),this.unit2pxY(A.y))},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)))},getCenter:function(){return new Joms.Coord(this.px2unitX(this.X),this.px2unitY(this.Y))},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,13,false);new Joms.Layer(this,"servlet",Joms.ServletTile,10,false);new Joms.Layer(this,"mapFlags",Joms.MapFlags,14,false)},entireMap:function(){changeZoom(undefined,J.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},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,M,L,C){var B=false,F,K,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.app.textBox.cfg.holdMapPositionOnZoom&&!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){K=new Array(this.X-this.unit2pxX(C.x),this.Y-this.unit2pxY(C.y))}if(!this.zoom||(M!=undefined&&M!=this.zoom.id)||L){if(!this.zoom){F=undefined}else{F="zoom"+this.app.name+"_"+this.app.mapId+"_"+this.zoom.id}B=this.setZoom(M,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)-K[0]));this.center.y=this.px2unitY(this.unit2pxY(this.center.y)-(this.unit2pxY(this.center.y)-this.unit2pxY(C.y)-K[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},getZoomInfo:function(B,C){var A=new Object();A.map=B;A.zoom=C;if(this.currentMapDataCache[B]!=undefined){var D=this.currentMapDataCache[B][1][C];A.scale=D.scale;A.mppx=D.mppx}return 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.changeMousePos(this.app.getLeft(D.clientX)+Joms.getOffsetX(),this.app.getTop(D.clientY)+Joms.getOffsetY());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 I=new Joms.Coord(this.app.getLeft(B.clientX)+Joms.getOffsetX(),this.app.getTop(B.clientY)+Joms.getOffsetY());var M,L;var H=true;this.moving=false;this.zooming=false;if(Event.isRightClick(B)){var C=new Date().getTime();if(Math.abs(C-this.rightClicked)<300){M=this.map.px2unitX(I.x);L=this.map.px2unitY(I.y);this.rightClicked=false;this.showContext=false;this.map.zoomOut(M,L);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,P,K,F,N,A,O=false;M=this.map.px2unitX(this.map.selectObject.left-this.map.positionDiff.x+Math.round(this.map.selectObject.width/2));L=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;P=(E+D)/2;this.map.selectObject=this.map.selectObject.destroy();this.app.changeZoom(undefined,this.app.getLevelFromMppx(P,M,L),M,L);this.changeMousePos(this.app.getLeft(B.clientX)+Joms.getOffsetX(),this.app.getTop(B.clientY)+Joms.getOffsetY())}H=false}else{if(browser.client=="kon"){var C=new Date().getTime();if(Math.abs(C-this.clicked)<300){M=this.map.px2unitX(I.x);L=this.map.px2unitY(I.y);this.map.zoomIn(M,L);this.changeMousePos(this.app.getLeft(B.clientX)+Joms.getOffsetX(),this.app.getTop(B.clientY)+Joms.getOffsetY());this.clicked=false}else{this.clicked=C}}}}if(H){this.app.hooks.call("mapClicked",I,new Joms.Coord(this.map.px2unitX(I.x),this.map.px2unitY(I.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=J.cel("div");this.el.el=J.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,C,B){if(!A){Joms.error("Joms.ContextMenu","Objekt aplikace nebyl definován.");return }if(C==undefined){C=true}this.display=false;this.items=new Object();this.app=A;this.app.hooks.register("closeResult",this.clearRoute,this);this.el=J.cel("div");this.el.className="jomsContextMenu";this.el.appendChild(J.cel("ul"));this.app.map.el.appendChild(this.el);this.width=150;this.el.style.width=this.width+"px";if(C){this.el.id="contextMenu"+this.app.name;this.app.context=this}else{this.el.id="contextMenu"+B}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=J.cel("li");var A=J.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,"mouseup",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=J.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=J.gid(B+this.app.name)){A.style.display="none";this.height=""}},showItem:function(B){var A;if(A=J.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,"mouseup",Joms.Event.stopEvent,true);Joms.Event.removeEvent(C,"click",this.itemMouseUpEvent,true)}this.el.firstChild.innerHTML=""},trackCoord:function(A){this.changeDisplay(this.app.map.px2unit(A))},track:function(A){this.changeDisplay(A)},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(J.gid("navigator-img")){J.gid("navigator").removeChild(J.gid("navigator-img"))}J.gid("navigator").innerHTML="";A=J.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;J.gid("navigator").appendChild(this.el);if(!(D=J.gid("navigator-block"))){D=J.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";J.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{J.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(){J.gid("navigator").style.display="none"},show:function(){J.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(J.gid("navigator"))},getTop:function(A){return A-findPosY(J.gid("navigator"))}};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=J.cel("div");this.el.id="textBox"+this.app.name;this.el.className="jomsTextBox";this.el.style.display="none";this.table=J.cel("table");this.table.cellPadding="0";this.table.cellSpacing="0";this.table.style.position="relative";this.table.style.zIndex=2;D=J.cel("tbody");this.table.appendChild(D);var E=J.cel("tr");E.style.height="10px";C=J.cel("td");this.addTransparentImageBackground(C,Joms.baseUrl+"images/"+this.cfg.style+"/left-top.png",10,10);E.appendChild(C);C=J.cel("td");this.addTransparentImageBackground(C,Joms.baseUrl+"images/"+this.cfg.style+"/top.png",undefined,10,"repeat-x");this.up=C;E.appendChild(C);C=J.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=J.cel("tr");B.style.height=this.cfg.headerHeight+"px";C=J.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=J.cel("td");F.style.background="#"+this.cfg.bgColor;B.appendChild(F);this.header=J.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=J.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=J.cel("tr");C=J.cel("td");this.addTransparentImageBackground(C,Joms.baseUrl+"images/"+this.cfg.style+"/left.png",10,undefined,"repeat-y");this.left=C;H.appendChild(C);C=J.cel("td");C.style.background=this.cfg.bgColor;H.appendChild(C);this.content=C;C=J.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=J.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=J.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.text.className="netmapObjectBubbleMain";this.content.appendChild(this.text);this.maxText=J.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=J.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=J.cel("tr");C=J.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=J.cel("td");C.style.borderTop="1px solid #"+this.cfg.borderColor;C.style.background="#"+this.cfg.footerBgColor;this.footer=J.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=J.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=J.cel("tr");I.style.height="10px";C=J.cel("td");this.addTransparentImageBackground(C,Joms.baseUrl+"images/"+this.cfg.style+"/left-bottom.png",10,10);I.appendChild(C);C=J.cel("td");this.addTransparentImageBackground(C,Joms.baseUrl+"images/"+this.cfg.style+"/bottom.png",undefined,10,"repeat-x");I.appendChild(C);C=J.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=J.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=J.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-55>this.cfg.maxHeight){this.height=this.cfg.maxHeight}else{this.height=this.el.offsetHeight-55}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=this.cfg.moveMapOnShow}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=this.cfg.moveMapOnShow}if(this.visible){this.hide()}this.text.scrollTop=0;this.maxText.scrollTop=0;this.position=new Joms.Coord(A.x,A.y);this.clearPosition();this.el.style.display="block";this.visible=true;this.setSize();this.setPosition(B);this.text.style.overflow=this.cfg.overflowStyle},setMenu:function(E,D){var F=J.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=J.cel("li"),A=J.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=J.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=J.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=J.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)}this.app.hooks.call("textBoxClosed",this)},close:function(){this.hide()}};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),moveMapOnShow:true,holdMapPositionOnZoom:true,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=J.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=new Joms.Coord(A.x,A.y);this.icon=B;this.iconMouseOverEvent=this.iconMouseOver.bindAsEventListener(this);this.iconMouseOutEvent=this.iconMouseOut.bindAsEventListener(this);this.el=B.clone();Event.addEvent(this.el,"mouseover",this.iconMouseOverEvent,false);Event.addEvent(this.el,"mouseout",this.iconMouseOutEvent,false);Event.disableSelect(this.el)};Joms.Marker.prototype={position:null,isRightClick:false,app:null,el:null,layer:null,icon:null,callback:null,args:null,callbackOver:null,outArgs:null,callbackOut:null,overArgs:null,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)},setOverAction:function(){this.overArgs=Array.prototype.slice.call(this.setOverAction.arguments);this.callbackOver=this.overArgs.shift()},setOutAction:function(){this.outArgs=Array.prototype.slice.call(this.setOutAction.arguments);this.callbackOut=this.outArgs.shift()},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(C,B,A){var D=J.cel("div");if(B!=undefined){D.className=B}D.style.position="absolute";D.style.overflow="hidden";D.style.left=this.icon.iconTextLeft+"px";D.style.top=this.icon.iconTextTop+"px";D.style.width=this.icon.iconTextWidth+"px";D.style.height=this.icon.iconTextHeight+"px";D.appendChild(J.ctn(C));this.innerTextDiv=D;this.innerTextDivClass=B;if(A!=undefined){this.innerTextDivClassHighlight=A}else{this.innerTextDivClassHighlight=B}this.el.appendChild(D)},highlight:function(){this.icon.setHighlightImg(this.el);if(this.innerTextDiv){this.innerTextDiv.className=this.innerTextDivClassHighlight}this.el.style.zIndex+=1},removeHighlight:function(){this.icon.removeHighlightImg(this.el);if(this.innerTextDiv){this.innerTextDiv.className=this.innerTextDivClass}this.el.style.zIndex-=1},enableHighlightOnMouseOver:function(){this.highlightEnabled=true},disableHighlightOnMouseOver:function(){this.highlightEnabled=false},setTitle:function(A){this.el.title=A},iconMouseOver:function(A){if(this.highlightEnabled){this.highlight()}this.callCallback(this.callbackOver,this.overArgs)},iconMouseOut:function(A){if(this.highlightEnabled){this.removeHighlight()}this.callCallback(this.callbackOut,this.outArgs)},clicked:function(A){this.isRightClick=Joms.Event.isRightClick(A);this.callCallback(this.callback,this.args,A)},callCallback:function(C,A,B){if(C==null||C==undefined){return }if(A!=undefined||A!=null){C.apply(this,A)}else{C.call(this)}}};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(K){var I,H,F,G;G=K.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 K=tileNum.x;K<=tileMax.x;++K){this.addTile(this.map.zoom,K,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(this.map.zoom.repl&&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=J.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.isIE()){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);A.src="";if(Joms.browser.isIE()){A.onselectstart="";A.style.filter=""}this.el.removeChild(A);delete A;delete this.tiles[B];this.tilesDeleted+=1},setOpacity:function(){for(tile in this.tiles){var A=this.tiles[tile];if(Joms.browser.isIE()){if(this.map.opacity<100){A.style.filter="alpha(opacity="+this.map.opacity+"), progid:DXImageTransform.Microsoft.BasicImage(grayScale=1)"}else{A.style.filter=""}}else{A.style.opacity=this.map.opacity/100;A.style.MozOpacity=this.map.opacity/100;A.style.KhtmlOpacity=this.map.opacity/100}}},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=J.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="14";B.parentNode.style.zIndex="13";this.map.app.hooks.call("iconMouseOver",new Joms.Coord(A,D),B)},iconMouseOut:function(B){var A=Event.getElement(B);A.style.zIndex="13";A.parentNode.style.zIndex="13";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 Object();this.lines=new Object();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=J.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(K,I,H){var C=this.map.app.mapId+"_"+K.id+"_"+I+"_"+H,A;if(this.tiles[C]){return }imgEl=J.cel("img");imgEl.className="jomsMapTile";imgEl.style.position="absolute";imgEl.style.top=(K.y_length-H)*K.tile_height-K.tile_height+this.map.positionDiff.y+"px";imgEl.style.left=I*K.tile_width+this.map.positionDiff.x+"px";imgEl.style.width=K.tile_width+"px";imgEl.style.height=K.tile_height+"px";imgEl.galleryimg="no";imgEl.preCached=-1;imgEl.unselectable="on";var B;if(K.layers_dir){B=K.layers_dir}else{B=K.dir}var A;if(this.isWms){var M=(K.rux-K.ldx)/K.x_length;var L=(K.ruy-K.ldy)/K.y_length;var G=K.ldx+(M*I);var F=K.ldy+(L*H);var E=G+M;var D=F+L;if(this.useCache){A=Joms.layerDir+"/wmscache/"+this.layerCode+"/"+K.dir+"/"+(K.id+K.first).toString()+"/"+(parseInt(I/K.columns)).toString()+"/"+K.dir+"_"+I+"_"+H+"."+this.imgType;A+="?width="+K.tile_width+"&height="+K.tile_height;A+="&wmsMap="+this.wmsMap+"&wmsLayers="+this.wmsLayers+"&BBOX="+G+","+F+","+E+","+D;A+="&layerCode="+this.layerCode;A+="&dir="+K.dir+"_"+(K.id+K.first).toString()+"_"+(parseInt(I/K.columns)).toString();A+="&file="+K.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="+K.tile_width+"&HEIGHT="+K.tile_height+"&FORMAT=image/"+this.imgType+"&EXCEPTION=application/vnd.ogc.se_xml"}}else{A=Joms.layerDir+"/"+this.layerCode+"/"+B+"/"+(K.id+K.first).toString()+"/"+(parseInt(I/K.columns)).toString()+"/"+B+"_"+I+"_"+H+".png?width="+K.tile_width+"&height="+K.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]){debug("deleting");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.zoomChanged();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=J.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=J.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"wms":this.copyright="";this.copyrightHref="";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.copyright!=""){this.copyrightEl=J.cel("span");this.copyrightEl.appendChild(J.ctn(", "));var B=J.cel("a");B.href=this.copyrightHref;B.target="_blank";B.appendChild(J.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){J.gid("jomsCopyright").appendChild(this.copyrightEl)}this.app.hooks.call("layerSwitch",this.type,true);this.setNetmapCategoryVisibility(true)},setWms:function(F,A,B,D,E,C){this.layerCode=F;this.type=F;this.name=A;this.isWms=true;this.wmsBaseUrl=B;this.wmsMap=D;this.wmsLayers=E;this.maxMppx=0;this.imgType=C;this.wmsUseCache=false;if(this.layer){this.layer.tiles.zoomChanged();this.layer.tiles.setView(this.app.map.leftBottomView,false)}},setNetmapCategories:function(A){this.catIdArr=A},setNetmapCategoryVisibility:function(A){netmap=this.app.netmapObjects;if(netmap&&this.catIdArr!=undefined&&this.catIdArr!=null){for(var B=0;B<this.catIdArr.length;B++){if(A){netmap.showCategory(this.catIdArr[B],false)}else{netmap.hideCategory(this.catIdArr[B],false)}}netmap.reloadNow()}},hide:function(){if(!this.layer){return }this.layer.destructor();this.layer=null;if(this.copyrightEl){J.gid("jomsCopyright").removeChild(this.copyrightEl)}this.app.hooks.call("layerSwitch",this.type,false);this.setNetmapCategoryVisibility(false)},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()}}else{if(this.layer){this.hide()}}},toggle:function(){if(this.layer){this.hide()}else{this.show()}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=J.gid(this.cfg.elname)}if(!this.el){this.el=J.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=J.cel("div");this.append=J.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.plus);this.el.appendChild(this.zooms);this.el.appendChild(this.append);this.el.appendChild(this.minus);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 A;this.unload();for(var B=this.app.map.inMaps.length-1;B>=0;--B){if(this.app.mapId==this.app.map.inMaps[B].id){continue}for(j=this.app.map.inMaps[B].count-1;j>=0;--j){this.newZoomLabel(this.app.map.inMaps[B].id,j,this.zooms)}}for(A=this.app.zoom.zoom.length-1;A>=0;--A){this.newZoomLabel(this.app.mapId,A,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;var C=this.app.zoom.outMap;if(C!=null){for(var B=0;B<C.length;B++){for(A=C[B].count-1;A>=0;--A){this.newZoomLabel(C[B].id,A,this.append);++this.appendCount}}}},change:function(A){var B,C;if(B=J.gid(A)){Joms.updateTransparentImage(B,this.cfg.barwithout[0],this.cfg.barwithout[1],this.cfg.barwithout[2],this.cfg.barwithout[3])}if(B=J.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.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.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=J.gid(A.elname)}if(!this.el){this.el=J.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=J.cel("map");C.id="jomsMoveMap";C.name="jomsMoveMap";B=J.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=J.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=J.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=J.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=J.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.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.LayerControl=function(B,A){this.app=B;this.el=J.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=J.cel("div");H=J.cel("input");H.type="checkbox";H.id=E.type+"Layer";if(I){H.checked=true;E.toggle()}F=J.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=J.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 L=J.cel("div");L.className="jomsLayerControlOpacityItem";L.style.backgroundColor="rgb("+A+","+A+","+A+")";if(E.opacity==C){L.style.border="1px solid red"}else{L.style.border="1px solid black"}if(Joms.browser.isIE()&&Joms.browser.getVersion()<8){L.style.display="inline"}else{L.style.display="inline-block"}L.onclick=this.setOpacity.bind(this,E,C,L,D);var K=J.cel("img");K.src=Joms.blankImage;K.width=7;K.height=7;L.appendChild(K);D.appendChild(L)}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=J.cel("div");A=J.cel("input");A.type="checkbox";A.id=G;E=J.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=J.cel("div");A=J.cel("a");A.href="";A.appendChild(J.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.Scale=function(A){if(!A){Joms.error("Joms.Scale","Objekt aplikace nebyl definován.");return }this.app=A;this.scale=J.cel("div");this.scale.id="scale"+this.app.name;this.scale.className="jomsScale";this.scale.style.width="360px";this.scaleBar=J.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();if(A.adds&&A.adds.visible){this.scale.style.bottom="35px"}else{this.scale.style.bottom="15px"}};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.RoutingControll=function(B,A){this.app=B;if(A==undefined){this.cfg=new RoutingControllConf(B)}else{this.cfg=A}this.id=this.cfg.id;this.cfg.routeCfg.autoUpdate=false;this.route=new Joms.Route(this.app,this.id,this.cfg.routeCfg,this.cfg.searchCfg);this.cfg.resultListCfg.setIconHandlers(this,this._searchResultClick,this._searchResultOver,this._searchResultOut);this.cfg.routeCfg.setCrossroadHandlers(this,this.mouseCrossroadClicked,this.mouseOverPos,this.mouseOutPos);this.num=0;this.destId=0;this.destElems=new Object()};Joms.RoutingControll.prototype={id:"route",formElCont:null,resultEl:null,hProfileEl:null,hProfileVisible:false,formEl:null,criteriumEl:null,destListEl:null,init:function(B,A,C){this.formElCont=B;this.resultEl=A;this.hProfileEl=C;this.drawForm();this.formEl=J.gidc(this.id+"Form");this.formEl.onsubmit=this.searchLink.bind(this);this.criteriumEl=J.gidc(this.id+"Criterium");this.criteriumEl.onchange=this.criteriumChange.bind(this);this.criteriumParamEl=J.gid(this.id+"Param");this.destListEl=J.gid(this.id+"DestList");Joms.Event.addClickEventId(this.id+"AddDest",this.addDestinationHref.bind(this));Joms.Event.addClickEventId(this.id+"ReverseDest",this.reverseDestinationOrderHref.bind(this));Joms.Event.addClickEventId(this.id+"Reset",this.reset.bind(this,true));this.app.hooks.register("routeSearched",this.routeSearched,this);this.app.hooks.register("routeDestinationNotFound",this.routeDestinationNotFound,this);this.app.hooks.register("routeItineraryCreated",this.routeItineraryCreated,this);this.app.hooks.register("routeHeightProfileCreated",this.routeHeightProfileCreated,this);this.app.hooks.register("routeSearchFailed",this.routeSearchFailed,this);this.app.hooks.register("routeDestroyed",this.routeDestroyed,this);this.app.hooks.register("routeDestinationPositionChanged",this.routeDestinationPositionChanged,this);this.addDefaultCriteria();this.setCriterium(this.cfg.routeCfg.criterium,this.cfg.routeCfg.criteriumParam);this.addDestinationBox("");this.addDestinationBox("");this.criteriumChange();this.initialized=true},drawForm:function(){this.formElCont.style.position="relative";var A="";A+='<div style="display: block;">';A+='<a href="#" id="'+this.id+'AddDest">přidat</a>, <a href="#" id="'+this.id+'ReverseDest">otočit pořadí</a>';A+="</div>";A+='<form id="'+this.id+'Form" class="routingCtrlForm">';A+='<div id="'+this.id+'DestList"></div>';A+='<select id="'+this.id+'Criterium" class="routingCtrlCriteriumSelect">';A+="</select>";A+='<input id="'+this.id+'SearchButton" tabindex="999" class="routingCtrlSearchRouteButton" type="submit" value="Vyhledat" />';A+="<br>";A+='<input type="checkbox" value="1" id="'+this.id+'Param" class="routingCtrlCriteriumCheckBox" checked="1" /> <span id="'+this.id+'ParamText">zahrnout silnice I. třídy</span>';A+="</form>";this.formElCont.innerHTML=A},addDefaultCriteria:function(){if(this.cfg.allowTouristRoutes){this.addCriterium(22,"Pěšky - turistická");this.addCriterium(21,"Pěšky - nejkratší")}if(this.cfg.allowCycleRoutes){this.addCriterium(12,"Na kole - více cyklotras");this.addCriterium(11,"Na kole - méně cyklotras");this.addCriterium(17,"Na kole - silniční")}if(this.cfg.allowCarRoutes){this.addCriterium(3,"Autem - nejrychlejší");this.addCriterium(1,"Autem - nejkratší");this.addCriterium(4,"Autem - ekonomická")}},setCriterium:function(C,D){for(var B=0,A=this.criteriumEl.options.length;B<A;B++){if(this.criteriumEl.options[B].value==C){this.criteriumEl.selectedIndex=B}}this.criteriumParamEl.checked=D},addDestination:function(D,F){if(F!=undefined&&!this.app.map.checkCoordInMap(F)){this.app.error(0,"Joms.RoutingControll","Route coord "+F+" is out of map area");return false}var B=false;var C=this.findEmptyDestBox(D,F);if(C!=null){var A=this.getDestElems(C);A.input.value=D;A.pos=F;B=true}else{B=this.addDestinationBox(D,F)}if(B){var E=new Joms.Coord();if(E.fromGpsString(D)){this.route.addDestination(E)}}return B},search:function(A){this.route.destroy();this.hideHeightProfile();var G=J.gid(this.id+"Criterium").value;var E=J.gid(this.id+"Param").checked;this.route.setCriterium(G,E);for(var F in this.destElems){var B=this.destElems[F];var D=B.input;var C=D.value;var H=new Joms.Coord();if(H.fromGpsString(C)){this.route.addDestination(H,F)}else{if(B.pos){this.route.addDestinationNamedPos(B.pos,C,F)}else{if(C!=""){this.route.addDestination(C,F)}}}}if(A){this.zoomToRouteAfterSearch=true}else{this.zoomToRouteAfterSearch=false}this.route.search()},searchCycleTrack:function(A){this.hideHeightProfile();this.reset(true);this.zoomToRouteAfterSearch=true;this.route.searchCycleTrack(A)},setAndSearchRoutingDefinition:function(E,G,B){var A=E.split(";");this.reset(true);this.setCriterium(A[0],A[1]?1:0);for(var D=2;D<A.length;D+=3){var F=new Joms.Coord(A[D],A[D+1]);var C=A[D+2];this.addDestination(C,F)}this.showProfileAfterSearch=G;this.search(B)},getRoutingDefinition:function(){return this.route.getDefinition()},reset:function(A){this.route.destroy();if(A){for(var B in this.destElems){this.removeDestination(B)}}this.app.hooks.call("routingCtrlAction",this,"route","reset",A)},print:function(){this.app.printNetmap(this.route)},switchHeightProfile:function(){if(!this.route.isValid()||this.hProfileEl==null){return }if(!this.hProfileVisible){this.showHeightProfile()}else{this.hideHeightProfile()}},showHeightProfile:function(){if(!this.route.isValid()||this.hProfileEl==null){return }if(!this.hProfileVisible){this.route.getHeightProfile(this.hProfileEl);this.hProfileVisible=true;this.app.hooks.call("routingCtrlAction",this,"heightprofile","visible",true)}},hideHeightProfile:function(){if(this.hProfileEl==null){return }if(this.hProfileVisible){this.hProfileEl.innerHTML="";this.hProfileVisible=false;this.app.hooks.call("routingCtrlAction",this,"heightprofile","visible",false)}},searchLink:function(){this.search(true);return false},routeDestinationPositionChanged:function(B,C){var A=this.getDestElems(C.id);A.pos=C.position;A.input.value=C.position.toGpsString();this.search(false)},setDestBox:function(D,C,A){var B=this.getDestElems(D);B.input.value=C;B.resList.style.display="none";B.pos=A;return false},mouseOverPos:function(C,B){var A;if(B!=undefined&&this.route!=null&&(A=J.gid(this.route.id+"_hgt_"+B))!=null){A.className="heightProfilePointSel"}this.app.hooks.call("routingCtrlAction",this,"crossroad","over",C,B);return false},mouseOutPos:function(C,B){var A;if(B!=undefined&&this.route!=null&&(A=J.gid(this.route.id+"_hgt_"+B))!=null){A.className="heightProfilePoint"}this.app.hooks.call("routingCtrlAction",this,"crossroad","out",C,B);return false},mouseCrossroadClicked:function(B,A){this.app.hooks.call("routingCtrlAction",this,"crossroad","click",B,A);return false},showCrossroadBubble:function(D,C){if(C!=undefined){var A=Joms.baseUrl+"data/servlet/print.php?a="+Joms.appId+"&width=270&height=140&scale=0&copyright=0&x="+D.x+"&y="+D.y+"&zoom=max&context="+this.app.servletContext.id;var B="";B+='<img src="'+A+'" width="270" height="140" border="1">';this.app.textBox.show(D,B,"<b>GPS:</b> "+D.toGpsString())}},routeDestinationNotFound:function(A,B){this.app.hooks.call("routingCtrlAction",this,"route","destinationNotFound",B)},routeSearched:function(B,H){this.app.hooks.call("routingCtrlAction",this,"route","searched");for(var E in this.route.destinationList){var C=this.route.destinationList[E];var A=this.getDestElems(C.id);if(A==null){continue}else{this.setDestBox(C.id,C.name,C.position)}A.numEl.innerHTML=C.markerId;if(C.searchResults!=null){A.resBtn.innerHTML="";A.resList.innerHTML="";A.resList.style.display="none";var G=C.searchResults;var F=new Joms.SearchResultList(this.app,this.cfg.resultListCfg,G);F.createResultList(A.resList);if(G.getCount()>1){A.resBtn.appendChild(J.ceaImg(this.cfg.destIconUrlShowList,"Zobrazit výsledky vyhledávání ("+G.getCount()+")","routingCtrlIcon",this,C.id,this.showHideSearchResultBox,10,10));if(this.cfg.autoShowResultList){A.resList.style.display="block"}}var D=G.getFirstResult();if(D!=null){A.input.value=D.toString();A.pos=D.position}}else{if(!this.cfg.keepSearchResultList){A.resBtn.innerHTML="";A.resList.innerHTML="";A.resList.style.display="none"}}}this.app.textBox.hide();if(this.zoomToRouteAfterSearch){this.zoomToRouteAfterSearch=false;this.route.zoomToRoute()}if(this.showProfileAfterSearch){this.showProfileAfterSearch=false;this.showHeightProfile()}this.app.hooks.call("routingCtrlAction",this,"route","preItinerary");if(this.resultEl){this.route.getItinerary(this.resultEl,true,true,false,true,true)}},routeSearchFailed:function(C,B,A){this.app.hooks.call("routingCtrlAction",this,"route","searchFailed",B,A);this.resultEl.innerHTML="<b>"+A+"</b>"},routeDestroyed:function(){this.app.hooks.call("routingCtrlAction",this,"route","destroyed");this.resultEl.innerHTML="";this.hideHeightProfile()},routeItineraryCreated:function(){var C=this.resultEl;tmp=getElementsByClass("mapAction",C,"a");for(i=0,l=tmp.length;i<l;++i){var B=tmp[i];switch(B.id){case"zoomToRoute":Joms.Event.addClickEvent(B,this.zoomToRoute.bind(this));break;case"hide":Joms.Event.addClickEvent(B,this.hideRoute.bind(this));break;case"showHeightProfile":Joms.Event.addClickEvent(B,this.switchHeightProfile.bind(this));break;case"reset":Joms.Event.addClickEvent(B,this.reset.bind(this));break;case"print":Joms.Event.addClickEvent(B,this.print.bind(this));break;case"getgpx":var A=this.app.getServletContext();B.href=Joms.baseUrl+"/data/server.php?t=rgpx&a="+Joms.appId+"&context="+A.id+"&trackId="+this.route.id;break}}this.app.hooks.call("routingCtrlAction",this,"route","postItinerary")},routeHeightProfileCreated:function(A,B){this.app.hooks.call("routingCtrlAction",this,"heightprofile","created")},criteriumChange:function(){var B=J.gid(this.id+"Criterium").value;var A=J.gid(this.id+"ParamText");if(B<10){A.innerHTML="využít placené úseky"}else{A.innerHTML="zahrnout silnice I. třídy"}this.search()},hideRoute:function(){this.route.hide()},showRoute:function(){this.route.show()},zoomToRoute:function(){this.showRoute();this.route.zoomToRoute()},addDestinationHref:function(A){this.addDestinationBox();return false},reverseDestinationOrderHref:function(){var A=0;var B=this.createDestArrs();A=B.elems.length-1;for(i=0;i<B.elems.length/2;i++){this.switchDestinationOrder(B.elems,B.ids,i,A-i)}this.search()},createDestArrs:function(A){var E=new Array();var D=new Array();var C=0;var B=-1;for(var F in this.destElems){E[C]=this.destElems[F];D[C]=F;if(F==A){B=C}C++}return{elems:E,ids:D,i:B}},switchDestinationOrder:function(E,D,C,B){var G=E[C];var F=E[B];var A;A=G.pos;G.pos=F.pos;F.pos=A;A=G.input.tabIndex;G.input.tabIndex=F.input.tabIndex;F.input.tabIndex=A;A=G.input.value;G.input.value=F.input.value;F.input.value=A;G.resList.innerHTML="";F.resList.innerHTML="";G.resBtn.innerHTML="";F.resBtn.innerHTML=""},findEmptyDestBox:function(C,E){var A=null;for(var D in this.destElems){var B=this.destElems[D].input;if(B.value==""||B.value==C){if(A==null){A=D}}else{A=null}}return A},addDestinationBox:function(D,F){if(this.cfg.maxDestinationCount&&this.num>=this.cfg.maxDestinationCount){return false}var A=new Object();var E=this.destId;A.boxEl=J.cel("div");A.boxEl.id=this.id+"Dest_"+E;A.boxEl.className="routingCtrlDestBox";A.numEl=J.cel("div");A.numEl.id=this.id+"DestResultsNum_"+E;A.numEl.className="routingCtrlDestBtn routingCtrlDestNum";A.numEl.appendChild(J.ctn(" "));A.boxEl.appendChild(A.numEl);if(this.cfg.allowDestinationPositionSwitch){A.mvDownBtn=J.ceaImg(this.cfg.destIconUrlMoveDown,"move down","routingCtrlSmallIcon",this,E,this.moveDestinationDown);A.mvDownBtn.tabIndex=1000+E;A.mvUpBtn=J.ceaImg(this.cfg.destIconUrlMoveUp,"move up","routingCtrlSmallIcon",this,E,this.moveDestinationUp);A.mvUpBtn.tabIndex=1000+E;var C=J.cel("div");C.appendChild(A.mvUpBtn);C.appendChild(A.mvDownBtn);C.className="routingCtrlDestSwitchBox";A.boxEl.appendChild(C)}A.input=J.cel("input");A.input.tabIndex=E+1;A.input.id=this.id+"DestText_"+E;A.input.className="routingCtrlDestText";A.input.value=D!=undefined?D:"";A.input.type="text";A.boxEl.appendChild(A.input);A.boxEl.appendChild(J.ctn(" "));A.resBtn=J.cel("span");A.resBtn.id=this.id+"DestResultsButton_"+E;A.boxEl.appendChild(A.resBtn);var B=J.cel("span");B.className="routingCtrlDestBtn";A.delBtn=J.ceaImg(this.cfg.destIconUrlDelete,"odstranit průjezdní bod","routingCtrlIcon",this,E,this.removeDestination,10,10);A.delBtn.tabIndex=1000+E;B.appendChild(A.delBtn);A.boxEl.appendChild(B);A.resList=J.cel("div");A.resList.className="routingCtrlDestSearchResult";A.resList.id=this.id+"DestResults_"+E;A.boxEl.appendChild(A.resList);A.pos=F;this.destListEl.appendChild(A.boxEl);this.destElems[this.destId]=A;this.destId+=1;this.num+=1;A.input.onkeydown=this.destinationTextKeyDown.bind(this,E);return true},addCriterium:function(C,B){var A=J.cel("option");A.value=C;A.appendChild(J.ctn(B));this.criteriumEl.appendChild(A)},moveDestinationDown:function(B){var A=this.createDestArrs(B);if(A.i>=0&&A.i<A.elems.length-1){this.switchDestinationOrder(A.elems,A.ids,A.i,A.i+1)}},moveDestinationUp:function(B){var A=this.createDestArrs(B);if(A.i>0){this.switchDestinationOrder(A.elems,A.ids,A.i,A.i-1)}},destinationTextKeyDown:function(B){var A=this.getDestElems(B);A.pos=null},showHideSearchResultBox:function(B){var A=this.getDestElems(B);if(A.resList.style.display=="none"){A.resList.style.display="block"}else{A.resList.style.display="none"}},_searchResultOver:function(A){this.app.hooks.call("routingCtrlAction",this,"searchresult","over",A)},_searchResultOut:function(A){this.app.hooks.call("routingCtrlAction",this,"searchresult","out",A)},_searchResultClick:function(A){this.setDestBox(A.obj.id,A.toString(),A.position);this.app.hooks.call("routingCtrlAction",this,"searchresult","click",A)},getDestElems:function(A){if(this.destElems[A]!=undefined){return this.destElems[A]}else{return null}},removeDestination:function(C){var A=this.getDestElems(C);if(C>1){this.destListEl.removeChild(A.boxEl);delete this.destElems[C];delete A;this.num-=1}else{A.pos=null;A.input.value="";var B=A.resList;B.innerHTML="";B.style.display="none";A.resBtn.innerHTML="";A.numEl.innerHTML=""}if(this.route.isValid()){this.search()}}};Joms.RoutingControllConf=function(C,B,A){if(B==undefined){B=new Joms.SearchConf();B.listLimit=5}this.searchCfg=B;if(C==undefined){C=new Joms.RouteConf()}this.routeCfg=C;if(A==undefined){A=new Joms.SearchResultListConf();A.showResultNums=false}this.resultListCfg=A};Joms.RoutingControllConf.prototype={id:"routingCtrl",searchCfg:null,resultListCfg:null,routeCfg:null,maxDestinationCount:5,allowTouristRoutes:false,allowCycleRoutes:false,allowCarRoutes:true,allowDestinationPositionSwitch:true,destIconUrlShowList:Joms.baseUrl+"images/routing-ctrl/results.gif",destIconUrlDelete:Joms.baseUrl+"images/routing-ctrl/delete.gif",destIconUrlMoveUp:Joms.baseUrl+"images/routing-ctrl/destMoveUp.gif",destIconUrlMoveDown:Joms.baseUrl+"images/routing-ctrl/destMoveDown.gif",autoShowResultList:false,keepSearchResultList: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=J.cel("div");this.el.className="jomsVisibilityControl";this.app.el.appendChild(this.el);Joms.addTransparentBg(this.el);if(Joms.browser.isIE()&&Joms.browser.version<8){this.el.style.width=(D-12)+"px"}else{this.el.style.width=D+"px"}var C=J.cel("a");C.href="";C.appendChild(J.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);if(this.autoCloseTimeMs>0){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();if(this.autoCloseTimeMs>0){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=J.cel("div");this.el.className="jomsVisibilityControl";this.app.el.appendChild(this.el);Joms.addTransparentBg(this.el);this.el.style.width=B+"px";this.aEl=J.cel("a");this.aEl.href="";this.aEl.target="_blank";this.aEl.appendChild(J.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()+"?lang="+this.app.netmapObjects.cfg.lang+"#"+this.app.query.createUrlParams()}};Joms.InfoBox=function(A){this.el=J.cel("div");this.el.className="jomsInfoBox";Joms.addTransparentBg(this.el);this.headerEl=J.cel("div");this.headerEl.className="jomsInfoBoxHeader";this.headerEl.appendChild(J.ctn(A));this.el.appendChild(this.headerEl);var B=J.cel("div");B.className="jomsInfoBoxCloseIcon";B.style.background='url("'+Joms.baseUrl+'images/object-box/close.png") no-repeat';B.title="Zavřít";this.headerEl.appendChild(B);this.closeIconEl=B;this.contentEl=J.cel("div");this.contentEl.className="jomsInfoBoxContent";this.el.appendChild(this.contentEl);this.closeActionFnc=this.hide;Event.addEvent(this.closeIconEl,"mouseup",this.hide.bind(this),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);this.visible=true;this.hide()};Joms.InfoBox.prototype={el:null,closeIconEl:null,visible:false,closeActionFnc:null,headerEl:null,contentEl:null,show:function(){if(!this.visible){this.el.style.display="block";this.visible=true}},hide:function(){if(this.visible){this.visible=false;this.el.style.display="none"}},setSize:function(B,A){this.el.style.width=B+"px";this.el.style.height=A+"px"},setPosition:function(B,A){this.el.style.left=B+"px";this.el.style.top=A+"px"},setCloseAction:function(A){Event.removeEvent(this.closeIconEl,"mouseup",this.closeActionFnc,false);Event.addEvent(this.closeIconEl,"mouseup",A,false);this.closeActionFnc=A},addToMap:function(A){A.addStaticElement(this.el)}};Joms.MeasureControll=function(C){this.app=C;this.infoBox=new Joms.InfoBox("Měření vzdálenosti");this.infoBox.setSize(200,60);this.infoBox.setPosition(35,40);this.infoBox.setCloseAction(this.hide.bind(this));this.app.addStaticElement(this.infoBox.el);var B=this.infoBox.contentEl;this.lengthEl=J.cel("span");B.appendChild(this.lengthEl);this.ctrlEl=J.cel("div");B.appendChild(this.ctrlEl);var A=J.cel("a");A.appendChild(J.ctn("smazat body"));Joms.Event.addClickEvent(A,this.reset.bind(this));this.ctrlEl.appendChild(A);this.app.hooks.register("mapClicked",this._onMapClick,this)};Joms.MeasureControll.prototype={infoBox:null,app:null,polyline:null,visible:false,checkLine:function(){if(this.polyline==null){var A=new Joms.Polyline(this.app,"measure",Joms.Polyline.Type.LINE,new Joms.PolylineBrowserRenderer(this.app));A.setWidth(5);A.setStroke(Joms.Polyline.Stroke.SOLID);A.drawPoints=true;A.setClickAction(this._onLinePointClick,this);this.polyline=A;this._setLineInfo()}},show:function(){if(!this.visible){this.checkLine();this.polyline.show();this.infoBox.show();this.visible=true}},hide:function(){if(this.visible){this.checkLine();this.polyline.hide();this.visible=false;this.infoBox.hide()}},reset:function(){this.checkLine();this.polyline.remove();this._setLineInfo()},_setLineInfo:function(){if(this.polyline.getPointCount()>0){this.lengthEl.innerHTML="Délka: "+(Math.round(this.polyline.getLength())/1000)+" km";this.ctrlEl.style.display="block"}else{this.lengthEl.innerHTML="Kliknutím do mapy zahajte měření.";this.ctrlEl.style.display="none"}},_onMapClick:function(A,B,C){if(this.visible&&!C){this.polyline.addPoint(B);this.polyline.redraw();this._setLineInfo()}},_onLinePointClick:function(C,B,A,D){if(B.removePoint(A)){B.redraw();C._setLineInfo()}}};Joms.GpsControll=function(B){this.app=B;this.infoBox=new Joms.InfoBox("GPS souřadnice");this.infoBox.setSize(200,35);this.infoBox.setPosition(35,105);this.infoBox.setCloseAction(this.hide.bind(this));this.app.el.appendChild(this.infoBox.el);var A=this.infoBox.contentEl;this.gpsEl=J.cel("span");A.appendChild(this.gpsEl);B.hooks.register("mapClicked",this._onMapClick,this);this._setGpsInfo();this.visible=true;this.hide()};Joms.GpsControll.prototype={app:null,infoBox:null,gpsCoord:null,visible:false,show:function(){this.infoBox.show();this.visible=true},hide:function(){if(this.visible){this.visible=false;this.infoBox.hide();this.reset()}},_setGpsInfo:function(){if(this.gpsCoord==null){this.gpsEl.innerHTML="Klikněte do mapy"}else{this.gpsEl.innerHTML=this.gpsCoord.toGpsString()}},_onMapClick:function(A,B,C){if(this.visible&&!C){this.gpsCoord=B;this._setGpsInfo()}},reset:function(){this.gpsCoord=null;this._setGpsInfo()}};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.state=B.state;this.orderId=A};Joms.GeocodingResult.prototype={position:null,type:"geocoding",geoType:null,city:null,part:null,street:null,cp:null,co:null,district:null,state:null,zipCode:null,getIconUrl:function(){return Joms.baseUrl+"images/geocoding/"+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"}else{if(this.geoType=="l"){return"místní název"}}}}}return""},createBubbleHtml:function(){var A="";if(this.geoType=="cp"){A+="<b>"+this.street;if(this.co!=undefined){A+=" "+this.cp+"/"+this.co}else{A+=" "+this.cp}A+="</b>";if(this.part!=undefined){A+="<br />"+this.part}A+="<br />"+this.zipCode+" "+this.city}else{if(this.geoType=="s"){A+="<b>"+this.street+"</b>";if(this.part!=undefined){A+="<br />"+this.part}A+="<br />"+this.city}else{if(this.geoType=="p"){A+="<b>"+this.part+"</b>";A+="<br />"+this.city}else{A+="<b>"+this.city+"</b>"}}}if(this.district){A+="<br />okres "+this.district}if(this.state){A+="<br />stát "+this.state}return A},toString:function(B,C){var A="";if(this.geoType=="cp"){A+=this.street;if(this.co!=undefined){A+=" "+this.cp+"/"+this.co}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{A+=this.city}}}if(B==undefined){B=true}if(C==undefined){C=false}if(this.district&&B){A+=", okres "+this.district}if(this.state&&C){A+=", stát "+this.state}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(C,B){this.reset();if(B==undefined){B="text"}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(C),true);this._sendAndHandleRequest(A,B)},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(C,D,A,B){this.app=C;this.id=D;if(typeof A=="undefined"){A=new Joms.RouteConf()}this.cfg=A;if(typeof B=="undefined"){B=new Joms.SearchConf();B.addSearchSource(new Joms.PlanstudioSearchSource(this.app))}this.searchCfg=B;this.jomsSearch=new Joms.Search(this.app,B);this.app.hooks.register("jomsDbSearched",this.jomsDbSearched,this);this.destinationList=new Array();if(!this.app.map){C.warning(0,"Joms.Route","Mapa nebyla dosud inicializována")}else{this.layer=new Joms.CustomLayer(this.app,this.id,15)}};Joms.Route.prototype={app:null,cfg:null,searchCfg:null,jomsSearch:null,valid:0,visible:true,destinationList:null,id:"",layer:null,length:0,time:0,ascent:0,descent:0,envelopeRect:null,iconsLayer: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;this.autoupdate();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;this.autoupdate();return A},autoupdate:function(){if(this.cfg.autoUpdate){if(this.destinationList.length>1){this.search()}else{this.destroyRoute()}}},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;this.autoupdate();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;this.autoupdate()},banRoutesInArea:function(B,A){var C=this.app.getServletContext();C.addCommand("routingBanRoutesInArea",B.x,B.y,A);C.setReturn("getContextInfoJson");C.sendRequest();this.autoupdate()},unbanAllRoutes:function(){var A=this.app.getServletContext();A.addCommand("routingUnbanAllRoutes");A.setReturn("getContextInfoJson");A.sendRequest();this.autoupdate()},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()}}},showDestinations:function(){if(this.layer){this.layer.show()}},setDestinationsIcon:function(A){this.cfg.destinationIcon=A},hideDestinations:function(){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();this.app.map.hideMark()}if(this.layer){this.layer.clear()}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(){if(this.destinationList.length<2){return false}if(this.getNonpositionedDestinations(true)==0){return this.searchRoute()}},getNonpositionedDestinations:function(B){var C=0;for(i=0,l=this.destinationList.length;i<l;++i){var A=this.destinationList[i];if(A.geoQueryText!=null){C+=1;if(B){this.jomsSearch.searchText(A.geoQueryText,A)}}}return C},jomsDbSearched:function(E,F,G){if(E!=this.jomsSearch){return }var A=G;var D=F.getFirstResult();if(D!=null){A.position=D.position;A.geoQueryText=null;A.searchResults=F;var C=F.getResultArr();for(var B=0;B<C.length;B++){C[B].obj=A}}else{this.app.hooks.call("routeDestinationNotFound",this,A);return }if(this.getNonpositionedDestinations(false)==0){this.searchRoute()}},searchRoute:function(){var A=this.app.getServletContext();A.addCommand("routingReset","destinations");for(i=0,l=this.destinationList.length;i<l;++i){var B=this.destinationList[i];if(B.geoQueryText!=null){this.app.error(0,"Joms.Route","Destination position not set for "+B.geoQueryText)}else{if(B.position!=null){if(B.name!=null){A.addCommand("routingAddDestinationNamedCoord",B.position.x,B.position.y,B.name)}else{A.addCommand("routingAddDestinationCoord",B.position.x,B.position.y)}}else{return false}}}A.addCommand("routingSearchRoute",this.cfg.criterium,this.cfg.criteriumParam,this.id);this._setRouteParamsAndReturnFnc(A);this.sendRequestAndUpdateRouteInfo(A,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(H,F,D,C,E,A){var G;if(typeof H=="string"){G=J.gid(H)}else{G=H}if(!this.valid){return }if(G==null){this.app.warning(1,"Joms.Route","Neplatný element pro výpis itineráře.");return }if(F==undefined){F=true}if(D==undefined){D=true}var B=this.app.getServletContext();new Joms.Ajax.Request(this,Joms.dataScript+"?t=rinetmap&context="+B.id+"&trackId="+this.id+"&detailed="+F+"&lang="+Joms.lang+"&crossroads="+(D?1:0)+"&destinations="+(C?1:0)+"&stats="+(E?1:0)+"&commands="+(A?1:0),true,function(I){G.innerHTML=I;this.createCrossroadHrefs(G);this.app.hooks.call("routeItineraryCreated",this)})},getNetmapItinerary:function(B,A){this.getItinerary(B,A)},zoomToRoute:function(){if(this.valid){this.app.map.zoomToRect(this.envelopeRect)}},updateDrawParams:function(){var A=this.app.getServletContext();this._setRouteParamsAndReturnFnc(A);this.sendRequestAndUpdateRouteInfo(A,false)},getHeightProfile:function(C,D,A){var E=C;var B=this.app.getServletContext();if(!this.valid){return }if(D==undefined){D=this.app.mapWidth-18}if(A==undefined){A=this.cfg.hProfileHeight}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+"&oneLine="+(this.cfg.hProfileOneLine?"1":"0"),true,function(I){var K=I.parseJSON();if(K[0]==null){K[1].src=this.getHeightProfileImageUrl(D,A,this.cfg.hProfileOneLine?"1":"0");for(var G=0;G<K[2].length;G++){var M=K[2][G];if(this.cfg.crFncScope){var L=new Joms.Coord(M.x,M.y);var F=J.cel("div");F.style.position="absolute";F.id=this.id+"_hgt_"+M.i;F.style.width=10+"px";F.style.height=10+"px";F.style.left=(M.px-5)+"px";F.style.top=(M.py-5)+"px";F.className="heightProfilePoint";var H=this.cfg.crFncScope;if(this.cfg.onCrClickFnc){F.onclick=this.cfg.onCrClickFnc.bind(H,L,M.i)}if(this.cfg.onCrMouseOutFnc){F.onmouseout=this.cfg.onCrMouseOutFnc.bind(H,L,M.i)}if(this.cfg.onCrMouseOverFnc){F.onmouseover=this.cfg.onCrMouseOverFnc.bind(H,L,M.i)}}imgEl=J.cel("img");imgEl.width=10;imgEl.height=10;imgEl.src=Joms.blankImage;F.appendChild(imgEl);E.appendChild(F)}imgEl=J.cel("img");imgEl.src=K[1].src;imgEl.width=K[1].w;imgEl.height=K[1].h;E.appendChild(imgEl);this.app.hooks.call("routeHeightProfileCreated",this,K)}else{this.app.errorservlet(K[0])}})},getHeightProfileImageUrl:function(C,A,D){var B=Joms.dataScriptUrl+"?t=rhpimg&context="+this.app.getServletContext().id+"&width="+C+"&height="+A+"&a="+Joms.appId+"&oneLine="+D+"&trackId="+this.id+"&bgColor="+this.cfg.hProfileBgColor+"&time="+(new Date()).getTime();if(this.cfg.hProfileParams!=null){B+="&params="+this.cfg.hProfileParams}if(this.cfg.hProfileLineParams!=null){B+="&lineParams="+this.cfg.hProfileLineParams}if(this.cfg.hProfileGridParams!=null){B+="&gridParams="+this.cfg.hProfileGridParams}if(this.cfg.hProfileIconParams!=null){B+="&iconParams="+this.cfg.hProfileIconParams}return B},createCrossroadHrefs:function(F){var D,C,B;D=getElementsByClass("mapPosition",F,"a");for(C=0,B=D.length;C<B;++C){var G=D[C].id.split("_");var H=new Joms.Coord(G[0],G[1]);var A=G[2];if(this.cfg.crFncScope){var E=this.cfg.crFncScope;if(this.cfg.onCrClickFnc){D[C].onclick=this.cfg.onCrClickFnc.bind(E,H,A)}if(this.cfg.onCrMouseOutFnc){D[C].onmouseout=this.cfg.onCrMouseOutFnc.bind(E,H,A)}if(this.cfg.onCrMouseOverFnc){D[C].onmouseover=this.cfg.onCrMouseOverFnc.bind(E,H,A)}}}},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)}}},setResultDestination:function(B,A){if(A.name!=""){B.name=A.name}else{B.name=B.position.toGpsString()}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},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},addDestinationMarker:function(C,B){var A=new Joms.Marker(this.app,C,this.cfg.destinationIcon);A.setInnerText(B.markerId,"jomsDestinationIconText");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){this.app.hooks.call("routeDestinationClicked",A,B);return }}B.setPosition(this.position);this.app.hooks.call("routeDestinationPositionChanged",A,B)},_setRouteParamsAndReturnFnc:function(A){A.addCommand("mapSetRouteDrawParams",this.id,this.cfg.drawLine,this.cfg.drawArrows,this.cfg.printCrossroads,this.cfg.printDestinations,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(){var A=new Joms.Icon("http://api.planstudio.cz/images/flag.png",53,46,Joms.IconCenter.BOTTOM_LEFT,"png");A.setHighlightUrl("http://api.planstudio.cz/images/flag_red.png");A.setIconDragPosition(10,25);A.setIconInnerTextPosition(2,5,20,19);this.destinationIcon=A};Joms.RouteConf.prototype={criterium:Joms.Route.Criterium.MINLENGTH,criteriumParam:true,autoUpdate:false,drawLine:true,drawArrows:true,drawDestinationLine:true,trackLineWidth:15,trackLineColor:"0000FF88",trackArrowColor:"FFFFFFAA",enableDestinationDrag:false,destinationIcon:null,hProfileBgColor:"ffffff",hProfileOneLine:true,hProfileHeight:170,hProfileParams:null,hProfileLineParams:null,hProfileGridParams:null,hProfileIconParams:null,setCrossroadHandlers:function(B,C,D,A){this.crFncScope=B;this.onCrClickFnc=C;this.onCrMouseOverFnc=D;this.onCrMouseOutFnc=A},crFncScope:this,onCrClickFnc:undefined,onCrMouseOverFnc:undefined,onCrMouseOutFnc:undefined,printCrossroads:1,printDestinations:1};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(){if(this.envelopeRect!=null){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])}}};var Raphael=(function(){var E=/[, ]+/,N,h=document,F=window,G=function(){return N.apply(G,arguments)},O={},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;h=F.document};G.parsePathString=function(R){var n={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},k=[],m=function(){var q="";for(var o=0,r=this.length;o<r;o++){q+=this[o][0]+this[o].join(",").substring(2)}return q};if(R.toString.toString()==m.toString()){return R}R.replace(/([achlmqstvz])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?\s*,?\s*)+)/ig,function(q,o,t){var s=[],r=o.toLowerCase();t.replace(/(-?\d*\.?\d*(?:e[-+]?\d+)?)\s*,?\s*/ig,function(v,u){u&&s.push(+u)});while(s.length>=n[r]){k.push([o].concat(s.splice(0,n[r])));if(!n[r]){break}}});k.toString=m;return k};var P=function(v){var R=v;if(typeof v=="string"){R=Raphael.parsePathString(v)}R=d(R);var r=[],q=[],k=0;for(var n=0,u=R.length;n<u;n++){switch(R[n][0]){case"Z":break;case"A":r.push(R[n][R[n].length-2]);q.push(R[n][R[n].length-1]);break;default:for(var m=1,o=R[n].length;m<o;m++){if(m%2){r.push(R[n][m])}else{q.push(R[n][m])}}}}var t=Math.min.apply(Math,r),s=Math.min.apply(Math,q);return{x:t,y:s,width:Math.max.apply(Math,r)-t,height:Math.max.apply(Math,q)-s,X:r,Y:q}};var d=function(k){var q=[];if(typeof k=="string"){k=G.parsePathString(k)}var s=0,r=0,R=0;if(k[0][0]=="M"){s=+k[0][1];r=+k[0][2];R++;q[0]=k[0]}for(var n=R,t=k.length;n<t;n++){q[n]=[];if(k[n][0]!=(k[n][0]+"").toUpperCase()){q[n][0]=(k[n][0]+"").toUpperCase();switch(q[n][0]){case"A":q[n][1]=k[n][1];q[n][2]=k[n][2];q[n][3]=0;q[n][4]=k[n][4];q[n][5]=k[n][5];q[n][6]=+(k[n][6]+s).toFixed(3);q[n][7]=+(k[n][7]+r).toFixed(3);break;case"V":q[n][1]=+k[n][1]+r;break;default:for(var m=1,o=k[n].length;m<o;m++){q[n][m]=+k[n][m]+((m%2)?s:r)}}}else{q[n]=k[n]}switch(q[n][0]){case"Z":break;case"H":s=q[n][1];break;case"V":r=q[n][1];break;default:s=q[n][q[n].length-2];r=q[n][q[n].length-1]}}q.toString=k.toString;return q};var V=function(){var m,k,o,n,R;if(typeof arguments[0]=="string"||typeof arguments[0]=="object"){if(typeof arguments[0]=="string"){m=h.getElementById(arguments[0])}else{m=arguments[0]}if(m.tagName){if(arguments[1]==null){return{container:m,width:m.style.pixelWidth||m.offsetWidth,height:m.style.pixelHeight||m.offsetHeight}}else{return{container:m,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 Q=function(R,k,m){for(var n in m){if(!(n in R)){switch(typeof m[n]){case"function":R[n]=R===k?m[n]:function(){m[n].apply(k,arguments)};break;case"object":R[n]={};Q(R[n],R,m[n]);break;default:R[n]=m[n];break}}}};if(G.svg){var K=function(n,R,o){var k=h.createElementNS(o.svgns,"path");k.setAttribute("fill","none");if(o.canvas){o.canvas.appendChild(k)}var m=new S(k,o);m.isAbsolute=true;m.type="path";m.last={x:0,y:0,bx:0,by:0};m.absolutely=function(){this.isAbsolute=true;return this};m.relatively=function(){this.isAbsolute=false;return this};m.moveTo=function(q,t){var s=this.isAbsolute?"M":"m";s+=parseFloat(q,10).toFixed(3)+" "+parseFloat(t,10).toFixed(3)+" ";var r=this[0].getAttribute("d")||"";(r=="M0,0")&&(r="");this[0].setAttribute("d",r+s);this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(q,10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(t,10);this.attrs.path=r+s;return this};m.lineTo=function(q,t){this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(q,10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(t,10);var s=this.isAbsolute?"L":"l";s+=parseFloat(q,10).toFixed(3)+" "+parseFloat(t,10).toFixed(3)+" ";var r=this[0].getAttribute("d")||"";this[0].setAttribute("d",r+s);this.attrs.path=r+s;return this};m.andClose=function(){var q=this[0].getAttribute("d")||"";this[0].setAttribute("d",q+"Z ");this.attrs.path=q+"Z ";return this};if(R){m.attrs.path=""+R;m.absolutely();O.pathfinder(m,m.attrs.path)}if(n){X(m,n)}return m};var C=function(k){if(k.pattern){var R=k.node.getBBox();k.pattern.setAttribute("patternTransform","translate("+[R.x,R.y].join(",")+")")}};var X=function(n,r){var w={"-":[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(AJ,AI){AI=w[AI.toString().toLowerCase()];if(AI){var AG=AJ.attrs["stroke-width"]||"1",AD={round:AG,square:AG,butt:0}[AJ.attrs["stroke-linecap"]||r["stroke-linecap"]]||0,AH=[];for(var AE=0,AF=AI.length;AE<AF;AE++){AH.push(AI[AE]*AG+((AE%2)?1:-1)*AD)}AI=AH.join(",");AJ.node.setAttribute("stroke-dasharray",AI)}};for(var u in r){if(!(u in A)){continue}var AA=r[u];n.attrs[u]=AA;switch(u){case"href":case"title":case"target":var q=n.node.parentNode;if(q.tagName.toLowerCase()!="a"){var k=h.createElementNS(n.svg.svgns,"a");q.insertBefore(k,n.node);k.appendChild(n.node);q=k}q.setAttributeNS(n.svg.xlink,u,AA);break;case"path":if(n.type=="path"){n.node.setAttribute("d","M0,0");O.pathfinder(n,AA)}case"rx":case"cx":case"x":n.node.setAttribute(u,AA);C(n);break;case"ry":case"cy":case"y":n.node.setAttribute(u,AA);C(n);break;case"width":n.node.setAttribute(u,AA);break;case"height":n.node.setAttribute(u,AA);break;case"src":if(n.type=="image"){n.node.setAttributeNS(svg.xlink,"href",AA)}break;case"stroke-width":n.node.style.strokeWidth=AA;n.node.setAttribute(u,AA);if(n.attrs["stroke-dasharray"]){R(n,n.attrs["stroke-dasharray"])}break;case"stroke-dasharray":R(n,AA);break;case"fill":var t=AA.match(/^url\(([^\)]+)\)$/i);if(t){var m=h.createElementNS(n.svg.svgns,"pattern");var AC=h.createElementNS(n.svg.svgns,"image");m.id="raphael-pattern-"+Raphael.idGenerator++;m.setAttribute("x",0);m.setAttribute("y",0);m.setAttribute("patternUnits","userSpaceOnUse");AC.setAttribute("x",0);AC.setAttribute("y",0);AC.setAttributeNS(n.svg.xlink,"href",t[1]);m.appendChild(AC);var s=h.createElement("img");s.style.position="absolute";s.style.top="-9999em";s.style.left="-9999em";s.onload=function(){m.setAttribute("width",this.offsetWidth);m.setAttribute("height",this.offsetHeight);AC.setAttribute("width",this.offsetWidth);AC.setAttribute("height",this.offsetHeight);h.body.removeChild(this);O.safari()};h.body.appendChild(s);s.src=t[1];n.svg.defs.appendChild(m);n.node.style.fill="url(#"+m.id+")";n.node.setAttribute("fill","url(#"+m.id+")");n.pattern=m;C(n);break}delete r.gradient;delete n.attrs.gradient;if(typeof n.attrs.opacity!="undefined"&&typeof r.opacity=="undefined"){n.node.style.opacity=n.attrs.opacity;n.node.setAttribute("opacity",n.attrs.opacity)}if(typeof n.attrs["fill-opacity"]!="undefined"&&typeof r["fill-opacity"]=="undefined"){n.node.style.fillOpacity=n.attrs["fill-opacity"];n.node.setAttribute("fill-opacity",n.attrs["fill-opacity"])}case"stroke":n.node.style[u]=AA;n.node.setAttribute(u,AA);break;case"opacity":case"fill-opacity":if(n.attrs.gradient){var z=h.getElementById(n.node.getAttribute("fill").replace(/^url\(#|\)$/g,""));if(z){var AB=z.getElementsByTagName("stop");AB[AB.length-1].setAttribute("stop-opacity",AA)}break}default:var v=u.replace(/(\-.)/g,function(o){return o.substring(1).toUpperCase()});n.node.style[v]=AA;n.node.setAttribute(u,AA);break}}L(n,r)};var f=1.2;var L=function(m,k){if(m.type!="text"||!("text" in k||"font" in k||"font-size" in k||"x" in k)){return }var t=m.node.firstChild?parseInt(h.defaultView.getComputedStyle(m.node.firstChild,"").getPropertyValue("font-size"),10):10;var s=0;if("text" in k){while(m.node.firstChild){m.node.removeChild(m.node.firstChild)}var R=(k.text+"").split("\n");for(var n=0,r=R.length;n<r;n++){var o=h.createElementNS(m.svg.svgns,"tspan");n&&o.setAttribute("dy",t*f);n&&o.setAttribute("x",m.attrs.x);o.appendChild(h.createTextNode(R[n]));m.node.appendChild(o);s+=t*f}}else{var R=m.node.getElementsByTagName("tspan");for(var n=0,r=R.length;n<r;n++){n&&R[n].setAttribute("dy",t*f);n&&R[n].setAttribute("x",m.attrs.x);s+=t*f}}s-=t*(f-1);var q=s/2-t;if(q){m.node.setAttribute("y",m.attrs.y-q)}setTimeout(function(){})};var S=function(k,R){var n=0,m=0;this[0]=k;this.node=k;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}};S.prototype.hide=function(){this.node.style.display="none";return this};S.prototype.show=function(){this.node.style.display="block";return this};S.prototype.remove=function(){this.node.parentNode.removeChild(this.node)};S.prototype.getBBox=function(){return this.node.getBBox()};S.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 k in arguments[0]){R[arguments[0][k]]=this.attrs[arguments[0][k]]}return R}if(arguments.length==2){var m={};m[arguments[0]]=arguments[1];X(this,m)}else{if(arguments.length==1&&typeof arguments[0]=="object"){X(this,arguments[0])}}return this};S.prototype.toFront=function(){this.node.parentNode.appendChild(this.node);return this};S.prototype.toBack=function(){if(this.node.parentNode.firstChild!=this.node){this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild)}return this};S.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};S.prototype.insertBefore=function(R){R.node.parentNode.insertBefore(this.node,R.node);return this};var I=function(k,R,q,o){var n=h.createElementNS(k.svgns,"circle");n.setAttribute("cx",R);n.setAttribute("cy",q);n.setAttribute("r",o);n.setAttribute("fill","none");n.setAttribute("stroke","#000");if(k.canvas){k.canvas.appendChild(n)}var m=new S(n,k);m.attrs=m.attrs||{};m.attrs.cx=R;m.attrs.cy=q;m.attrs.r=o;m.attrs.stroke="#000";m.type="circle";return m};var b=function(m,R,t,k,q,s){var o=h.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 S(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 M=function(k,R,r,q,o){var n=h.createElementNS(k.svgns,"ellipse");n.setAttribute("cx",R);n.setAttribute("cy",r);n.setAttribute("rx",q);n.setAttribute("ry",o);n.setAttribute("fill","none");n.setAttribute("stroke","#000");if(k.canvas){k.canvas.appendChild(n)}var m=new S(n,k);m.attrs=m.attrs||{};m.attrs.cx=R;m.attrs.cy=r;m.attrs.rx=q;m.attrs.ry=o;m.attrs.stroke="#000";m.type="ellipse";return m};var U=function(R){var m=h.createElementNS(R.svgns,"g");if(R.canvas){R.canvas.appendChild(m)}var k=new S(m,R);for(var n in R){if(n[0]!="_"&&typeof R[n]=="function"){k[n]=(function(o){return function(){var q=R[o].apply(R,arguments);m.appendChild(q[0]);return q}})(n)}}k.type="group";return k};var a=function(k,R){this.width=k||this.width;this.height=R||this.height;this.canvas.setAttribute("width",this.width);this.canvas.setAttribute("height",this.height);return this};var N=function(){var n=V.apply(null,arguments);var m=n.container,k=n.x,r=n.y,o=n.width,R=n.height;if(!m){throw new Error("SVG container not found.")}O.canvas=h.createElementNS(O.svgns,"svg");O.canvas.setAttribute("width",o||320);O.width=o||320;O.canvas.setAttribute("height",R||200);O.height=R||200;if(m==1){h.body.appendChild(O.canvas);O.canvas.style.position="absolute";O.canvas.style.left=k+"px";O.canvas.style.top=r+"px"}else{if(m.firstChild){m.insertBefore(O.canvas,m.firstChild)}else{m.appendChild(O.canvas)}}m={canvas:O.canvas,clear:function(){while(this.canvas.firstChild){this.canvas.removeChild(this.canvas.firstChild)}this.defs=h.createElementNS(O.svgns,"defs");this.canvas.appendChild(this.defs)}};for(var q in O){if(q!="create"){m[q]=O[q]}}Q(m,m,G.fn);m.clear();return m};O.remove=function(){this.canvas.parentNode.removeChild(this.canvas)};O.svgns="http://www.w3.org/2000/svg";O.xlink="http://www.w3.org/1999/xlink";O.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){K=function(s,R,q){var n=g("group"),r=n.style;r.position="absolute";r.left=0;r.top=0;r.width=q.width+"px";r.height=q.height+"px";var m=g("shape"),k=m.style;k.width=q.width+"px";k.height=q.height+"px";m.path="";if(s["class"]){m.className="rvml "+s["class"]}m.coordsize=this.coordsize;m.coordorigin=this.coordorigin;n.appendChild(m);q.canvas.appendChild(n);var o=new S(m,n,q);o.isAbsolute=true;o.type="path";o.path=[];o.last={x:0,y:0,bx:0,by:0,isAbsolute:true};o.Path="";o.absolutely=function(){this.isAbsolute=true;return this};o.relatively=function(){this.isAbsolute=false;return this};o.moveTo=function(t,v){var u=this.isAbsolute?"m":"t";u+=Math.round(parseFloat(t,10))+" "+Math.round(parseFloat(v,10));this.node.path=this.Path+=u;this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(t,10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(v,10);this.last.isAbsolute=this.isAbsolute;this.attrs.path+=(this.isAbsolute?"M":"m")+[t,v];return this};o.lineTo=function(t,v){var u=this.isAbsolute?"l":"r";u+=Math.round(parseFloat(t,10))+" "+Math.round(parseFloat(v,10));this[0].path=this.Path+=u;this.last.x=(this.isAbsolute?0:this.last.x)+parseFloat(t,10);this.last.y=(this.isAbsolute?0:this.last.y)+parseFloat(v,10);this.last.isAbsolute=this.isAbsolute;this.attrs.path+=(this.isAbsolute?"L":"l")+[t,v];return this};o.andClose=function(){this.node.path=(this.Path+="x e");this.attrs.path+="z";return this};if(R){o.absolutely();o.attrs.path="";O.pathfinder(o,""+R)}X(o,s);return o};var X=function(R,k){var w=R.node.style,q=R;R.attrs=R.attrs||{};for(var n in k){R.attrs[n]=k[n]}k.href&&(R.node.href=k.href);k.title&&(R.node.title=k.title);k.target&&(R.node.target=k.target);if(k.path&&R.type=="path"){R.Path="";R.path=[];O.pathfinder(R,k.path)}if(R.type=="image"&&k.src){R.node.src=k.src}if(R.type=="image"&&k.opacity){R.node.filterOpacity=" progid:DXImageTransform.Microsoft.Alpha(opacity="+(k.opacity*100)+")";R.node.style.filter=(R.node.filterMatrix||"")+(R.node.filterOpacity||"")}k.font&&(w.font=k.font);k["font-family"]&&(w.fontFamily=k["font-family"]);k["font-size"]&&(w.fontSize=k["font-size"]);k["font-weight"]&&(w.fontWeight=k["font-weight"]);k["font-style"]&&(w.fontStyle=k["font-style"]);if(typeof k.opacity!="undefined"||typeof k["stroke-width"]!="undefined"||typeof k.fill!="undefined"||typeof k.stroke!="undefined"||k["stroke-width"]||k["stroke-opacity"]||k["stroke-dasharray"]||k["stroke-miterlimit"]||k["stroke-linejoin"]||k["stroke-linecap"]){R=R.shape||R.node;var u=(R.getElementsByTagName("fill")&&R.getElementsByTagName("fill")[0])||g("fill");if("fill-opacity" in k||"opacity" in k){u.opacity=((+k["fill-opacity"]+1||2)-1)*((+k.opacity+1||2)-1)}if(k.fill){u.on=true}if(typeof u.on=="undefined"||k.fill=="none"){u.on=false}if(u.on&&k.fill){var m=k.fill.match(/^url\(([^\)]+)\)$/i);if(m){u.src=m[1];u.type="tile"}else{u.color=k.fill;u.src="";u.type="solid"}}R.appendChild(u);var v=(R.getElementsByTagName("stroke")&&R.getElementsByTagName("stroke")[0])||g("stroke");if((k.stroke&&k.stroke!="none")||k["stroke-width"]||typeof k["stroke-opacity"]!="undefined"||k["stroke-dasharray"]||k["stroke-miterlimit"]||k["stroke-linejoin"]||k["stroke-linecap"]){v.on=true}if(k.stroke=="none"||typeof v.on=="undefined"||k.stroke==0){v.on=false}if(v.on&&k.stroke){v.color=k.stroke}v.opacity=((+k["stroke-opacity"]+1||2)-1)*((+k.opacity+1||2)-1);k["stroke-linejoin"]&&(v.joinstyle=k["stroke-linejoin"]||"miter");v.miterlimit=k["stroke-miterlimit"]||8;k["stroke-linecap"]&&(v.endcap={butt:"flat",square:"square",round:"round"}[k["stroke-linecap"]]||"miter");k["stroke-width"]&&(v.weight=(parseFloat(k["stroke-width"],10)||1)*12/16);if(k["stroke-dasharray"]){var r={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};v.dashstyle=r[k["stroke-dasharray"]]||""}R.appendChild(v)}if(q.type=="text"){var t=h.createElement("span"),w=t.style;q.attrs.font&&(w.font=q.attrs.font);q.attrs["font-family"]&&(w.fontFamily=q.attrs["font-family"]);q.attrs["font-size"]&&(w.fontSize=q.attrs["font-size"]);q.attrs["font-weight"]&&(w.fontWeight=q.attrs["font-weight"]);q.attrs["font-style"]&&(w.fontStyle=q.attrs["font-style"]);q.node.parentNode.appendChild(t);t.innerText=q.node.string;q.W=q.attrs.w=t.offsetWidth;q.H=q.attrs.h=t.offsetHeight;q.X=q.attrs.x;q.Y=q.attrs.y+Math.round(q.H/2);q.node.parentNode.removeChild(t);switch(q.attrs["text-anchor"]){case"start":q.node.style["v-text-align"]="left";q.bbx=Math.round(q.W/2);break;case"end":q.node.style["v-text-align"]="right";q.bbx=-Math.round(q.W/2);break;default:q.node.style["v-text-align"]="center";break}}};var H=function(k,R,o,n){var m=Math.round(Math.atan((parseFloat(o,10)-parseFloat(k,10))/(parseFloat(n,10)-parseFloat(R,10)))*57.29)||0;if(!m&&parseFloat(k,10)<parseFloat(R,10)){m=180}m-=180;if(m<0){m+=360}return m};var S=function(o,r,R){var q=0,m=0,k=0,n=1;this[0]=o;this.node=o;this.X=0;this.Y=0;this.attrs={};this.Group=r;this.vml=R;this._={tx:0,ty:0,rt:{deg:0},sx:1,sy:1}};S.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=P(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"}};S.prototype.hide=function(){this.Group.style.display="none";return this};S.prototype.show=function(){this.Group.style.display="block";return this};S.prototype.getBBox=function(){this.bbx=this.bbx||0;return{x:this.X+this.bbx,y:this.Y,width:this.W,height:this.H}};S.prototype.remove=function(){this[0].parentNode.removeChild(this[0]);this.Group.parentNode.removeChild(this.Group);this.shape&&this.shape.parentNode.removeChild(this.shape)};S.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 k=0,m=arguments[0].length;k<m;k++){R[arguments[0][k]]=this.attrs[arguments[0][k]]}return R}var n;if(arguments.length==2){n={};n[arguments[0]]=arguments[1]}if(arguments.length==1&&typeof arguments[0]=="object"){n=arguments[0]}if(n){if(n.text&&this.type=="text"){this.node.string=n.text}if(n.id){this.node.id=n.id}X(this,n);this.setBox(n)}return this};S.prototype.toFront=function(){this.Group.parentNode.appendChild(this.Group);return this};S.prototype.toBack=function(){if(this.Group.parentNode.firstChild!=this.Group){this.Group.parentNode.insertBefore(this.Group,this.Group.parentNode.firstChild)}return this};S.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};S.prototype.insertBefore=function(R){R.Group.parentNode.insertBefore(this.Group,R.Group);return this};var I=function(k,R,t,q){var n=g("group");var s=g("oval");n.appendChild(s);k.canvas.appendChild(n);var m=new S(s,n,k);m.type="circle";X(m,{stroke:"#000",fill:"none"});m.attrs.cx=R;m.attrs.cy=t;m.attrs.r=q;m.setBox({x:R-q,y:t-q,width:q*2,height:q*2});return m};var b=function(k,u,t,v,n,R){var q=g("group");var m=g(R?"roundrect":"rect");if(R){m.arcsize=R/(Math.min(v,n))}q.appendChild(m);k.canvas.appendChild(q);var s=new S(m,q,k);s.type="rect";X(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 M=function(k,R,t,r,q){var n=g("group");var s=g("oval");n.appendChild(s);k.canvas.appendChild(n);var m=new S(s,n,k);m.type="ellipse";X(m,{stroke:"#000"});m.attrs.cx=R;m.attrs.cy=t;m.attrs.rx=r;m.attrs.ry=q;m.setBox({x:R-r,y:t-q,width:r*2,height:q*2});return m};var a=function(k,R){this.width=k||this.width;this.height=R||this.height;this.canvas.style.width=this.width+"px";this.canvas.style.height=this.height+"px";if(Joms.browser.isIE()&&Joms.browser.version<8){this.canvas.parentNode.style.clip="rect(0px "+this.width+"px "+this.height+"px 0px)"}else{this.canvas.parentNode.style.clip="rect(0px, "+this.width+"px, "+this.height+"px, 0px)"}this.canvas.coordsize=this.width+" "+this.height;return this};h.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");try{if(!h.namespaces.rvml){h.namespaces.add("rvml","urn:schemas-microsoft-com:vml")}var g=function(R){return h.createElement("<rvml:"+R+' class="rvml">')}}catch(Z){var g=function(R){return h.createElement("<"+R+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}var N=function(){var o=V.apply(null,arguments);var m=o.container,z=o.x,w=o.y,n=o.width,AB=o.height;if(!m){throw new Error("VML container not found.")}var u=h.createElement("div"),t=h.createElement("div"),R=O.canvas=g("group"),s=u.style,q=R.style;O.width=n;O.height=AB;n=n||"320px";AB=AB||"200px";s.clip="rect(0px "+n+"px "+AB+"px 0px)";s.top="-2px";s.left="-2px";s.position="absolute";q.position="absolute";t.style.position="relative";q.width=n;q.height=AB;R.coordsize=(/%$/.test(n)?n:parseFloat(n,10))+" "+(/%$/.test(AB)?AB:parseFloat(AB,10));R.coordorigin="0 0";var v=g("rect"),AA=v.style;AA.left=AA.top=0;AA.width=q.width;AA.height=q.height;v.filled=v.stroked="f";R.appendChild(v);u.appendChild(R);t.appendChild(u);if(m==1){h.body.appendChild(t);s.position="absolute";s.left=z+"px";s.top=w+"px";s.width=n;s.height=AB;m={style:{width:n,height:AB}}}else{s.width=m.style.width=n;s.height=m.style.height=AB;if(m.firstChild){m.insertBefore(t,m.firstChild)}else{m.appendChild(t)}}for(var k in O){m[k]=O[k]}Q(m,m,G.fn);m.clear=function(){var r=[];for(var AC=0,AD=R.childNodes.length;AC<AD;AC++){if(R.childNodes[AC]!=v){r.push(R.childNodes[AC])}}for(AC=0,AD=r.length;AC<AD;AC++){R.removeChild(r[AC])}};return m};O.remove=function(){this.canvas.parentNode.parentNode.parentNode.removeChild(this.canvas.parentNode.parentNode)};O.safari=function(){}}var T=(function(){if(h.addEventListener){return function(o,m,k,R){var n=function(q){return k.call(R,q)};o.addEventListener(m,n,false);return function(){o.removeEventListener(m,n,false);return true}}}else{if(h.attachEvent){return function(q,n,m,k){var o=function(r){return m.call(k,r||F.event)};q.attachEvent("on"+n,o);var R=function(){q.detachEvent("on"+n,o);return true};if(n=="mouseover"){q.attachEvent("onmouseenter",o);return function(){q.detachEvent("onmouseenter",o);return R()}}else{if(n=="mouseout"){q.attachEvent("onmouseleave",o);return function(){q.detachEvent("onmouseleave",o);return R()}}}return R}}}})();for(var W=B.length;W--;){(function(R){S.prototype[R]=function(k){if(typeof k=="function"){this.events=this.events||{};this.events[R]=this.events[R]||{};this.events[R][k]=this.events[R][k]||[];this.events[R][k].push(T(this.shape||this.node,R,k,this))}return this};S.prototype["un"+R]=function(k){this.events&&this.events[R]&&this.events[R][k]&&this.events[R][k].length&&this.events[R][k].shift()()&&!this.events[R][k].length&&delete this.events[R][k]}})(B[W])}O.circle=function(R,m,k){return I(this,R,m,k)};O.rect=function(R,o,k,m,n){return b(this,R,o,k,m,n)};O.ellipse=function(R,n,m,k){return M(this,R,n,m,k)};O.path=function(k,R){return K(k,R,this)};O.group=function(){return this};O.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(","))};O.pathfinder=function(q,o){var k={M:function(r,s){this.moveTo(r,s)},L:function(r,s){q.lineTo(r,s)},H:function(r){this.lineTo(r,this.last.y)},V:function(r){this.lineTo(this.last.x,r)},Z:function(){this.andClose()}};o=d(o);for(var m=0,n=o.length;m<n;m++){var R=o[m].shift();k[R].apply(q,o[m])}};O.set=function(R){return new Y(R)};O.setSize=a;S.prototype.stop=function(){clearTimeout(this.animation_in_progress)};var Y=function(k){this.items=[];this.length=(k&&k.length)||0;if(k&&k.constructor==Array){for(var R=k.length;R--;){if(k[R].constructor==S){this.items[this.items.length]=k[R]}}}};Y.prototype.push=function(k){if(k&&k.constructor==S){var R=this.items.length;this.items[R]=k;this[R]=k;this.length++}return this};Y.prototype.pull=function(n){var k=this.items.splice(n,1)[0];for(var R=n,m=this.items.length;R<m;R++){this[R]=this[R+1]}delete this[m+1];this.length--;return k};for(var D in S.prototype){Y.prototype[D]=(function(R){return function(){for(var k=this.items.length;k--;){this.items[k][R].apply(this.items[k],arguments)}return this}})(D)}Y.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.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")}})}};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)}}if(!Joms.browser.isIE()||Joms.browser.getVersion()>7){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){var B=Joms.obtainObjectIndexInArray(this.lines,A);if(B==-1){this.lines.push(A);this.render(A)}},findLineIndex:function(A){for(var B=0;B<this.lines.length;B++){if(A.id==this.lines[B].id){return B}}return -1},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.SearchConf=function(){this.sources=new Array()};Joms.SearchConf.prototype={searchRect:null,lang:"cs",listLimit:10,sources:null,addSearchSource:function(A){A.cfg=this;this.sources.push(A)},resetSources:function(){this.sources=new Array()}};Joms.Search=function(B,A){this.app=B;if(typeof A=="undefined"){A=new Joms.SearchConf()}this.cfg=A};Joms.Search.prototype={app:null,cfg:null,searchText:function(F,E){var B=new Joms.SearchResults(this.app,this.cfg,F);if(F==undefined||F.length==0){return B}var G=new Joms.Coord();if(G.fromGpsString(F)){var D=new Joms.SearchResultGroup(this.cfg);D.addCoordResultArray(new Array(G));B.addResultGroup(D);this.app.hooks.call("jomsDbSearched",this,B,E);return true}if(this.cfg.sources.length==0){this.app.error(0,"Joms.Search","No search sources defined")}for(var A=0;A<this.cfg.sources.length;A++){var C=this.cfg.sources[A];new Joms.Ajax.Request(this,C.getQueryUrl(F),true,function(I,H){H.source.handleResponse(I,H.srs);this.incrementFinishedSearchResult(H)},"get",null,{source:C,srs:B,p:E})}return true},incrementFinishedSearchResult:function(A){A.srs.sf++;if(A.srs.sf==this.cfg.sources.length){A.srs.resultArr.sort(this.sortGroups);this.app.hooks.call("jomsDbSearched",this,A.srs,A.p)}},sortGroups:function(B,A){if(B.order<A.order){return -1}else{if(B.order>A.order){return 1}else{return 0}}}};Joms.PlanstudioSearchSource=function(B,A){this.app=B;this.con=B.getServletContext();if(A==undefined||A.length==undefined){A=null}else{this.searchGroups=A}};Joms.PlanstudioSearchSource.prototype={getQueryUrl:function(A){if(this.cfg.searchRect!=null){this.con.addCommand("geoCodingSetResultBoundaryRect",this.cfg.searchRect.lb.x,this.cfg.searchRect.lb.y,this.cfg.searchRect.rt.x,this.cfg.searchRect.rt.y)}else{this.con.addCommand("geoCodingSetResultBoundaryRect;0;0;0;0")}this.con.setReturn("jomsTextSearchJson",removeDiacritics(A),this.cfg.lang);return Joms.dataScript+"?t=servlet&"+this.con.createRequest()},handleResponse:function(N,B){var E=N.parseJSON();var O=E.shift();if(O==null){var P=E.shift();this.con.update(P);var G=E;for(var H=0;H<G.length;H++){var A=G[H];if(this.searchGroups!=null){if(!J.ArrContains(this.searchGroups,A.sti)){continue}}if(A.results.length>0){var C=new Joms.SearchResultGroup(this.cfg,A.sti,this.getResultGroupName(A.sti),this.getResultGroupOrder(A.sti));var M=1;var K=this.getResultGroupClass(A.sti);for(var F=0,D=A.results.length;F<D;++F){var I=A.results[F];var L=new K(I,M++,this.id);L.type=A.sti;C.add(L)}C.finalizeResults();B.addResultGroup(C)}}return true}else{this.app.error(O.id,"Joms.Search",O.desc);return false}},getResultGroupOrder:function(A){switch(A){case"geocoding":return 1;case"netmap":return 2;case"zipcode":return 3;case"poi":return 4;case"cyclenum":return 5;default:return 10}},getResultGroupClass:function(A){switch(A){case"netmap":return Joms.NetmapResult;case"geocoding":return Joms.GeocodingResult;case"zipcode":return Joms.ZipcodeResult;case"poi":return Joms.PoiResult;default:return Joms.SearchResult}},getResultGroupName:function(A){switch(A){case"netmap":return"Body zájmu";case"geocoding":return"Adresy";case"zipcode":return"PSČ";case"cyclenum":return"Cyklo";case"poi":return"Body zájmu";default:return"Result"}}};Joms.SearchResults=function(C,A,B){this.app=C;this.cfg=A;this.resultArr=new Array();this.queryText=B};Joms.SearchResults.prototype={app:null,cfg:null,queryText:null,sf:0,resultArr:null,getCount:function(){var B=0;for(var A=0;A<this.resultArr.length;A++){B+=this.resultArr[A].count}return B},getFirstResult:function(){for(var B=0;B<this.resultArr.length;B++){var A=this.resultArr[B];if(A.count>0){return A.results[0]}}return null},getResultArr:function(){var E,D,B;var C=new Array();for(E=0;E<this.resultArr.length;E++){var A=this.resultArr[E];for(D=0,B=A.results.length;D<B;++D){C.push(A.results[D])}}return C},addResultGroup:function(A){A.finalizeResults();this.resultArr.push(A)},reset:function(){this.resultArr=new Array()}};Joms.SearchResultGroup=function(B,D,C,A){this.cfg=B;this.id=D;this.name=C;if(A!=undefined){this.order=A}else{this.order=0}this.listStart=0;this.results=new Array()};Joms.SearchResultGroup.prototype={id:null,name:null,results:null,envelopeRect:null,cfg:null,count:null,listStart:0,visibleResults:null,visibleResultsRect:null,add:function(A){this.results.push(A)},finalizeResults:function(){this.count=this.results.length;this.envelopeRect=this.createEnvelopeRect(this.results);this.setVisibleResults()},getGroupName:function(){var A=this.name;A+=" ("+this.getPageDescription()+")";return A},getPageDescription:function(){var B="";if(this.count>this.cfg.listLimit){B+=(this.listStart+1);var A=this.listStart+this.cfg.listLimit;if(A>this.count){A=this.count}B+=" - "+A+" / "+this.count}else{B+="0 - "+this.count}return B},moveToNextPage:function(){if(this.listStart+this.cfg.listLimit<this.count){this.listStart+=this.cfg.listLimit;this.setVisibleResults();return true}return false},moveToPrevPage:function(){if(this.listStart-this.cfg.listLimit>=0){this.listStart-=this.cfg.listLimit;this.setVisibleResults();return true}return false},addCoordResultArray:function(A){this.count=A.length;this.id="coord";this.name="Souřadnice";for(i=0,l=A.length;i<l;++i){var C=A[i];var B=new Joms.SearchResult();B.set(i+1,C.x,C.y,C.toGpsString(),"coord");this.results.push(B)}this.finalizeResults()},createEnvelopeRect:function(D){var E=null;for(var C=0,A=D.length;C<A;++C){var B=D[C];if(E==null){E=new Joms.Rect(B.position)}else{E.enlargePoint(B.position)}}return E},setVisibleResults:function(){var B=new Array();var A=0;for(var C=this.listStart;C<this.results.length&&C<this.cfg.listLimit+this.listStart;C++,A++){B[A]=this.results[C]}this.visibleResults=B;this.visibleResultsRect=this.createEnvelopeRect(B)}};Joms.SearchResultList=function(C,A,B){this.app=C;this.se=B;if(A==undefined){this.cfg=new Joms.SearchResultListConf(C)}else{this.cfg=A}};Joms.SearchResultList.prototype={app:null,cfg:null,se:null,createResultList:function(B){B.innerHTML="";if(this.se.getCount()==0){B.innerHTML="Žádný výsledek nebyl nelezen.";return }for(var D=0;D<this.se.resultArr.length;D++){var E=this.se.resultArr[D];if(E.count>0){var A=J.cel("div");A.className=this.cfg.listHeaderClass;A.appendChild(J.ctn(E.name));B.appendChild(A);var F=J.cel("div");F.className=this.cfg.listCtrlClass;if(this.cfg.resultIcon!=null){F.appendChild(J.cea("zobrazit v mapě",this,E,this.showResults));F.appendChild(J.ctn(", "))}if(E.count>this.se.cfg.listLimit){F.appendChild(J.cea("předchozí",this,E,this._setPrevResults));F.appendChild(J.ctn(", "));F.appendChild(J.cea("následující",this,E,this._setNextResults))}B.appendChild(F);var C=J.cel("ul");C.className=this.cfg.listUlClass;B.appendChild(C);E.ulElement=C;E.nameElement=A;this._createResultList(E)}}},showResults:function(A){if(this.cfg.resultIcon!=null){this._showVisibleResults(A,true)}},hideResults:function(){for(var C=0;C<this.se.resultArr.length;C++){var D=this.se.resultArr[C];for(var A=0;A<D.visibleResults.length;A++){D.visibleResults[A].marker=null}}var B=this._getLayer();this.layer.clear()},_setPrevResults:function(A){if(A.moveToPrevPage()){this._createResultList(A)}},_setNextResults:function(A){if(A.moveToNextPage()){this._createResultList(A)}},_createResultList:function(F){this.hideResults();var E=F.ulElement;E.innerHTML="";var D=F.visibleResults;for(var B=0;B<D.length;B++){var C=D[B];var A=this._createResLi(C);E.appendChild(A)}F.nameElement.innerHTML=F.getGroupName()},_createResLi:function(D){var C=J.cel("li");if(this.cfg.showResultNums){var B=J.cel("div");B.className="searchCtrlResultNum";if(Joms.browser.isIE()&&Joms.browser.getVersion()<8){B.style.display="inline"}else{B.style.display="inline-block"}B.appendChild(J.ctn(D.orderId));C.appendChild(B)}var F,E,A=16;if(D.type=="netmap"){F=this.app.netmapObjects.iconDir+D.getIcon();E=D.toString(true)}else{if(D.type=="geocoding"){F=D.getIconUrl();E=D.toString()+" ("+D.getTypeName()+")";A=11}else{F=D.getIconUrl();E=D.toString()}}if(F){C.appendChild(J.ceaImg(F,E,"icon",this,D,this.resultClicked,A,A))}C.appendChild(J.cea(D.toString(),this,D,this.resultClicked,this.resultOver,this.resultOut,"searchCtrlResultHref"));D.liEl=C;return C},_getLayer:function(){var A;if(typeof this.layer=="undefined"){A=new Joms.CustomLayer(this.app,"searchResults",15);this.layer=A}return this.layer},_showVisibleResults:function(D,C){if(C){this.zoomToVisibleResults(D)}var B=this._getLayer();B.clear();for(var A=0;A<D.visibleResults.length;A++){B.add(this._addResultMarker(D.visibleResults[A]))}},_addResultMarker:function(B){var A=new Joms.Marker(this.app,B.position,this.cfg.resultIcon);A.setClickAction(this.resultClicked.bind(this),B,A);A.setOverAction(this.resultOver.bind(this),B,A);A.setOutAction(this.resultOut.bind(this),B,A);A.setInnerText(B.orderId,"searchCtrlResultNumText","searchCtrlResultNumTextHighlight");A.setTitle(B.toString());B.marker=A;return A},zoomToVisibleResults:function(A){if(A.visibleResultsRect!=null){this.app.map.zoomToRect(A.visibleResultsRect)}},resultClicked:function(B,A,C){this.cfg.onResultIconClickFnc.call(this.cfg.onResultIconFncScope,B,A)},resultOver:function(B,A,C){this.cfg.onResultIconMouseOverFnc.call(this.cfg.onResultIconFncScope,B,A)},resultOut:function(B,A,C){this.cfg.onResultIconMouseOutFnc.call(this.cfg.onResultIconFncScope,B,A)}};Joms.SearchResultListConf=function(){this.onResultIconClickFnc=this.retFalse;this.onResultIconMouseOverFnc=this.retFalse;this.onResultIconMouseOutFnc=this.retFalse};Joms.SearchResultListConf.prototype={listHeaderClass:"searchCtrlListHeader",listCtrlClass:"searchCtrlListControlls",listUlClass:"searchCtrlList",showResultNums:true,resultIcon:null,onResultIconClickFnc:null,onResultIconMouseOverFnc:null,onResultIconMouseOutFnc:null,onResultIconFncScope:this,retFalse:function(){return false},setIconHandlers:function(B,C,D,A){this.onResultIconFncScope=B;this.onResultIconClickFnc=C;this.onResultIconMouseOverFnc=D;this.onResultIconMouseOutFnc=A}};Joms.SearchResult=function(B,A,C){if(B!=undefined){this.orderId=A;this.position=new Joms.Coord(B.x,B.y);this.name=B.name;this.type=C;this.id=B.id}};Joms.SearchResult.prototype={orderId:0,type:null,id:null,position:null,name:null,iconUrl:"",toString:function(){return this.name},set:function(B,A,F,C,D,E){this.orderId=B;this.position=new Joms.Coord(A,F);this.name=C;this.type=D;this.iconUrl=E},getIconUrl:function(){return this.iconUrl}};Joms.NetmapResult=function(B,A,C){this.orderId=A;if(B!=undefined){this.initFromResult(B)}if(C!=undefined){this.type=C}};Joms.NetmapResult.prototype={orderId:0,type:"netmap",position:null,id:null,name:null,icon:null,catName:null,initFromResult:function(A){this.position=new Joms.Coord(A.x,A.y);this.name=A.na;this.id=A.id;this.catId=A.ca;this.icon=A.ic;this.catName=A.cana},getIcon:function(){return this.icon+"16.png"},toString:function(B){var A=this.name;if(B&&this.catName!=null){A+=" ("+this.catName+")"}return A}};Joms.ZipcodeResult=function(B,A){this.orderId=A;if(B!=undefined){this.initFromResult(B)}};Joms.ZipcodeResult.prototype={orderId:0,type:"zipcode",position:null,zipCode:null,city:null,district:null,stateName:null,stateCode:null,initFromResult:function(A){this.position=new Joms.Coord(A.x,A.y);this.zipCode=A.zipCode;this.city=A.city;this.district=A.district;this.state=A.stateName;this.stateCode=A.stateCode},getIconUrl:function(){return Joms.baseUrl+"images/geocoding/cp.gif"},toString:function(A){return this.stateCode.toUpperCase()+"-"+this.zipCode+", "+this.city+" ("+(this.district?this.district+", ":"")+this.state+")"}};Joms.PoiResult=function(B,A){this.orderId=A;if(B!=undefined){this.initFromResult(B)}};Joms.PoiResult.prototype={id:0,orderId:0,type:"poi",position:null,name:null,categoryName:null,district:null,categoryId:null,initFromResult:function(A){this.position=new Joms.Coord(A.x,A.y);this.id=A.id;this.name=A.na;this.district=A.dist;this.categoryName=A.cana;this.categoryId=A.caid},getIconUrl:function(){return Joms.baseUrl+"images/map-icons/"+this.categoryId+".gif"},toString:function(A){return this.name+" ("+this.categoryName+")"}};Joms.TextAddArea=function(A){this.app=A;this.el=J.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=J.cel("a");this.aEl.onclick=this.onAddClick.bind(this);this.aEl.innerHTML="Reklama";this.aEl.target="_blank";var B=J.cel("div");B.className="add";B.appendChild(J.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}};Joms.NetmapObjectsConf=function(){this.leftEvent=app.map.moveLeft.bind(app.map);this.rightEvent=app.map.moveRight.bind(app.map);this.upEvent=app.map.moveUp.bind(app.map);this.downEvent=app.map.moveDown.bind(app.map)};Joms.NetmapObjectsConf.prototype={lang:"cs",visibleCategories:null,visibleObjects:null,reloadDelay:500,objectGrouping:true,iconSize:0,setIconSizeByMppx:true,objectUrlParamValue:null,objectUrlParamName:null,objectUrlTarget:"_blank",drawIconFoot:true,convertNL2BR:true};Joms.NetmapObjects=function(B,A){if(!B){Joms.error("Joms.NetmapObjects","Objekt aplikace nebyl definován.");return }if(typeof A==undefined){this.cfg=new Joms.NetmapObjectsConf()}else{this.cfg=A}if(!B.initialized){Joms.error("Joms.NetmapObjects","Objekt vytvořte až po zavolání metody init v Joms.App.");return }this.app=B;this.app.netmapObjects=this;new Joms.Layer(this.app.map,"netmapIconsShadow",Joms.NetmapIconShadowTile,12,false);new Joms.Layer(this.app.map,"netmapIcons",Joms.NetmapIconTile,13,false);this.app.hooks.register("zoomChanged",this.reload,this);this.initialize()};Joms.NetmapObjects.prototype={categories:null,objects:[],app:null,cfg:null,iconDir:null,imageDir:null,reload:function(){this.app.map.getLayer("netmapIcons").setView(this.app.map.leftBottomView,false,true)},reloadNow:function(){this.app.map.getLayer("netmapIcons").setView(this.app.map.leftBottomView,false,false)},hide:function(){this.app.map.getLayer("netmapIcons").hide()},show:function(){this.app.map.getLayer("netmapIcons").show();this.reloadNow()},setLang:function(A){this.lang=A;this.initialize()},setObjectGrouping:function(A){this.cfg.objectGrouping=A;this.reloadNow()},showCategory:function(C,B){var A=this.getCategoryById(C);if(A!=null){if(!A.visible){this.setCategoryVisibility(A,true)}}else{this.app.warning(0,"NetmapObjects","Category with id "+C+" was not found")}if(B==undefined||B){this.reloadNow()}},setCategoriesVisibility:function(D,C){for(var B=0;B<this.categories.length;B++){var A=this.categories[B];this.setCategoryVisibility(A,D)}if(C==undefined||C){this.reloadNow()}},hideCategory:function(C,B){var A=this.getCategoryById(C);if(A.visible){this.setCategoryVisibility(A,false)}if(B==undefined||B){this.reloadNow()}},switchCategory:function(A){this.setCategoryVisibility(A,!A.visible);this.reloadNow()},setCategoryVisibility:function(A,B){A.visible=B;this.app.hooks.call("netmapCategoryVisibilityChanged",A);if(A.layer){if(B){this.app.map.showOverlayLayer(A.layer)}else{this.app.map.hideOverlayLayer(A.layer)}}},getCategoryCount:function(){return this.categories.length},getObjectCount:function(){var A=0;for(var B=0;B<this.categories.length;B++){A+=this.categories[B].objectCount}return A},getCategoryById:function(B){for(var A=0;A<this.categories.length;A++){if(this.categories[A].id==B){return this.categories[A]}}return null},getCategoryByDbId:function(A){for(var B=0;B<this.categories.length;B++){if(this.categories[B].dbid==A){return this.categories[B]}}return null},getVisibleCategoryDbIdList:function(){var A="";for(var B=0;B<this.categories.length;B++){if(this.categories[B].visible){A+=this.categories[B].dbid+","}}return A.substr(0,A.length-1)},getVisibleObjectIdList:function(){if(this.cfg.visibleObjects==null){return""}var A="";for(var B=0;B<this.cfg.visibleObjects.length;B++){A+=this.cfg.visibleObjects[B]+","}return A.substr(0,A.length-1)},getVisibleCategoryIdList:function(){var A="";for(var B=0;B<this.categories.length;B++){if(this.categories[B].visible){A+=this.categories[B].id+","}}return A.substr(0,A.length-1)},setVisibleCategories:function(B){if(B!=null){for(var C=0;C<this.categories.length;C++){this.categories[C].visible=false}var A;for(C=0;C<B.length;C++){if((A=this.getCategoryById(B[C]))!=null){A.visible=true}}}},getIconSize:function(){if(this.cfg.setIconSizeByMppx){var A=this.app.map.zoom.mppx;if(A<4){return 32}else{if(A<20){return 24}else{return 16}}}else{if(this.cfg.iconSize>0){return this.cfg.iconSize}else{return Math.max(this.app.map.getCurrentIconSize(),16)}}},initialize:function(){this.bubbleTabs=[["bubbleShowDescription","bubbleContentDescription","Popis",true,this.hasDescription],["bubbleShowAddress","bubbleContentAddress","Kontakt",false,this.hasContact],["bubbleShowGps","bubbleContentGps","GPS",false,function(){return true}]];new Joms.Ajax.Request(this,Joms.dataScript+"?t=ninit&lang="+this.cfg.lang,false,function(B){ret=B.parseJSON();this.categories=ret.categories;this.iconDir=ret.icondir;this.imageDir=ret.imagedir;var A=this.cfg.visibleCategories;if(A!=null){this.setVisibleCategories(A)}this.reloadNow()})},setDefaultHooks:function(){this.app.hooks.register("netmapIconClicked",this.netmapIconClicked,this)},netmapIconClicked:function(A,B){if(!B){this.showObjectBubble(A)}else{if(B.t=="g"){this.showObjectGroupBubble(B)}else{this.showObjectBubble(B.id)}}},showObjectBubble:function(G){var F=this.loadObjectDetail(G);if(F!=null){var C=this.createHeaderHtml(F);var D=this.createBubbleHtml(F);var B=this.createFooterHtml(F);this.app.textBox.close();this.app.textBox.show(F.position,C+D,B);this.createBubbleLinks(F);var A=document.getElementById("bubbleContentDescriptionImage"+G);if(!(!(A))){var E=A.parentNode.parentNode.parentNode;if(!(!(E))&&E.className=="netmapObjectBubbleMain"&&A.offsetHeight>A.offsetWidth){E.style.height=(A.offsetHeight+35)+"px"}}}else{this.app.notice(0,"Joms.NetmapObjects","Object with id "+G+" was not found")}return F},showObjectGroupBubble:function(F){var E=this.loadGroupObjectList(F);var D="";var B="";D+='<div class="netmapObjectBubbleHeader">';D+='<span class="netmapObjectBubbleHeaderText">Skupina objektů, počet: '+F.co+"</span>";D+="</div>";D+='<ul class="netmapObjectList">';for(var A=0;A<E.length;A++){var C=E[A];D+='<li style="background: url('+this.iconDir+C.ic+'16.png) no-repeat 0 0;">';D+='<a class="objectListHref" href="#" id="grpObj'+C.id+'" >';D+=C.na;D+="</a>";D+="</li>"}D+="</ul>";B+='<a href="#" id="bubbleZoom">Zoom</a>';this.app.textBox.show(F.position,D,B);for(var A=0;A<E.length;A++){Joms.Event.addClickEventId("grpObj"+E[A].id,this.showObjectBubble.bind(this,E[A].id))}Joms.Event.addClickEventId("bubbleZoom",this.zoomToGroup.bind(this,F))},createBubbleLinks:function(D){var C=true;for(var B=0;B<this.bubbleTabs.length;B++){var A=J.gid(this.bubbleTabs[B][1]);if(A!=null){Joms.Event.addClickEventId(this.bubbleTabs[B][0],this.switchBubbleTab.bind(this,this.bubbleTabs[B][1]));if(C){A.style.display="block";C=false}}}Joms.Event.addClickEventId("bubbleShowAddress",this.switchBubbleTab.bind(this,"bubbleContentAddress"));Joms.Event.addClickEventId("bubbleShowGps",this.switchBubbleTab.bind(this,"bubbleContentGps"));Joms.Event.addClickEventId("bubbleZoom",this.bubbleZoom.bind(this,D));if(routingTab){Joms.Event.addClickEventId("bubbleAddToRoute",this.bubbleAddToRoute.bind(this,D))}},switchBubbleTab:function(A){for(var B=0;B<this.bubbleTabs.length;B++){if(J.gid(this.bubbleTabs[B][1])!=null){if(this.bubbleTabs[B][1]==A){J.gid(this.bubbleTabs[B][1]).style.display="block";J.gid(this.bubbleTabs[B][0]).className="selected"}else{if(this.bubbleTabs[B][1]!=null){J.gid(this.bubbleTabs[B][1]).style.display="none";J.gid(this.bubbleTabs[B][0]).className=""}}}}},bubbleZoom:function(A){this.app.map.maxZoom(A.position)},zoomToGroup:function(B){var A=new Joms.Rect(new Joms.Coord(B.x1,B.y1),new Joms.Coord(B.x2,B.y2));this.app.textBox.close();this.app.map.zoomToRect(A)},bubbleAddToRoute:function(A){routingTab.addDestination(A.na,A.position);routingTab.show()},createObjectUrlHref:function(C){var B='<a href="';var A=C.url;if(!Joms.startsWith(A,"http")){A="http://"+A}if(this.cfg.objectUrlParamName!=null&&this.cfg.objectUrlParamValue!=null){if(A.indexOf("?")===-1){A+="?"}else{A+="&"}A+=this.cfg.objectUrlParamName+"="+this.cfg.objectUrlParamValue}B+=A+'" target="'+this.cfg.objectUrlTarget+'">';return B},createHeaderHtml:function(B){var A="";A+='<div class="netmapObjectBubbleHeader">';A+='<img src="'+netmap.iconDir+B.ic+'24.png" class="netmapObjectBubbleIcon" alt="'+B.caName+'" />';if(B.url){A+=this.createObjectUrlHref(B)}A+='<span class="netmapObjectBubbleHeaderText">'+B.na+"</span><br />";if(B.url){A+="</a>"}A+='<span class="netmapObjectBubbleHeaderSubText">'+B.caName+"</span><br />";A+="</div>";return A},hasDescription:function(A){if(A.imageThumbnailUrl||A.description){return true}else{return false}},hasContact:function(A){if(A.street||A.mobile||A.url||A.email){return true}else{return false}},createBubbleHtml:function(B){var A="";if(this.hasDescription(B)){A+='<div class="jomsTextBoxTabContent" id="bubbleContentDescription" style="display: none;">';if(B.imageThumbnailUrl){if(B.imageUrl){if(B.imageWidth>0&&B.imageHeight>0){A+='<a href="'+B.imageUrl+'" target="_blank" onclick="return !Joms.ShowPopUpWindowCenter(this.href,'+B.imageWidth+","+B.imageHeight+');" >'}else{A+='<a href="'+B.imageUrl+'" target="_blank">'}}else{if(B.url){A+=this.createObjectUrlHref(B)}}if(B.description){A+='<img id="bubbleContentDescriptionImage'+B.id+'" src="'+B.imageThumbnailUrl+'" class="netmapObjectBubblePhoto" alt="'+B.na+'" />'}else{A+='<img id="bubbleContentDescriptionImage'+B.id+'" src="'+B.imageThumbnailUrl+'" class="netmapObjectBubblePhotoCenter" alt="'+B.na+'" />'}if(B.imageUrl||B.url){A+="</a>"}}if(B.description){if(this.cfg.convertNL2BR){A+=Joms.nl2br(B.description)}else{A+=B.description}}A+="</div>"}if(this.hasContact(B)){A+='<div class="jomsTextBoxTabContent" id="bubbleContentAddress" style="display: none;">';if(B.street){A+="<b>Adresa:</b><br/>";A+=B.street+"<br/>";A+=B.zipcode+" "+B.city+"<br/>";A+="<br />"}if(B.mobile){A+="<b>Telefon</b>: "+B.mobile+"<br/>"}if(B.email){A+='<b>E-mail</b>: <a href="mail:'+B.email+'" target="_blank">'+B.email+"</a><br/>"}if(B.url){A+="<b>WWW</b>: "+this.createObjectUrlHref(B)+B.url+"</a><br/>"}A+="</div>"}A+='<div class="jomsTextBoxTabContent" id="bubbleContentGps" style="display: none;">';A+="<b>GPS</b>: "+B.position.toGpsString()+"<br/>";A+="<b>UTM</b>: "+B.position.toString()+"<br/>";A+="<br/><b>URL</b>: "+Joms.getAppUrl()+"?lang="+this.cfg.lang+"&id="+B.id+"&zoom=max&showBubble=1";A+="</div>";return A},createFooterHtml:function(E){var D="";var C=true;for(var B=0;B<this.bubbleTabs.length;B++){var A=this.bubbleTabs[B];if(A[4](E)){D+='<a href="#" id="'+A[0]+'" "'+(C?' class="selected"':"")+'">'+A[2]+"</a> | ";if(C){C=false}}}D+='<a href="#" id="bubbleZoom">Zoom</a>';if(routingTab){D+=' | <a href="#" id="bubbleAddToRoute">Do trasy</a>'}if(E.url){D+=" | "+this.createObjectUrlHref(E)+"Více</a>"}return D},loadGroupObjectList:function(D){var C=new Array();var B=Joms.dataScript+"?t=nogl&coords="+D.x1+"_"+D.y1+"_"+D.x2+"_"+D.y2+"&lang="+this.cfg.lang;var A=this.getVisibleCategoryDbIdList();if(A!=""){B+="&cat="+A}new Joms.Ajax.Request(this,B,false,function(E){var F=E.parseJSON();if(F[0]==0){this.app.error(0,"Joms.NetmapObject",C[1])}C=F});return C},loadObjectDetail:function(B){var A=null;new Joms.Ajax.Request(this,Joms.dataScript+"?t=nod&id="+B+"&lang="+this.cfg.lang,false,function(C){A=C.parseJSON();if(A[0]==0){this.app.error(0,"Joms.NetmapObject",A[1])}A.position=new Joms.Coord(A.x,A.y)});return A}};Joms.NetmapCategoryControlConf=function(){};Joms.NetmapCategoryControlConf.prototype={iconSize:16,onColor:"FFFFFF",offColor:"000000",elname:null,vertical:true};Joms.NetmapCategoryControl=function(D,C,A){this.app=D;if(!this.app.initialized){Joms.error("Joms.NetmapCategoryControl","Objekt vytvořte až po zavolání metody init v Joms.App.");return }this.netmap=C;if(C.categories==null){Joms.error("Joms.NetmapCategoryControl","Žádné kategorie");return }if(typeof A=="undefined"){A=new Joms.NetmapCategoryControlConf()}this.cfg=A;if(typeof this.cfg.elname!="undefined"){this.el=J.gid(this.cfg.elname)}if(!this.el){this.el=J.cel("div");this.app.el.appendChild(this.el)}this.el.className="netmapCategoryControl";this.catDivs=new Array();for(var B=0;B<this.netmap.categories.length;B++){this.newCategoryIcon(this.netmap.categories[B])}D.hooks.register("netmapCategoryVisibilityChanged",this.netmapCategoryVisibilityChanged,this)};Joms.NetmapCategoryControl.prototype={app:null,el:null,catDivs:null,cfg:null,newCategoryIcon:function(B){var A,D,C;D=J.cel("div");D.id="netmap_catdiv_"+B.id;D.style.width=(this.cfg.iconSize+6)+"px";D.style.height=(this.cfg.iconSize+6)+"px";if(B.visible){D.style.backgroundColor="#"+this.cfg.onColor}else{D.style.backgroundColor="#"+this.cfg.offColor}A=Joms.createTransparentImage(this.netmap.iconDir+B.icon+this.cfg.iconSize+".png",this.cfg.iconSize,this.cfg.iconSize,"png");A.title="Zobrazit objekty v kategorii "+B.name;A.alt="Zobrazit objekty v kategorii "+B.name;A.id="netmap_catimg_"+B.id;D.appendChild(A);this.el.appendChild(D);Event.addEvent(D,"click",this.iconClicked.bind(this),true);Event.addEvent(D,"contextmenu",Event.preventDefault,false);this.catDivs[B.id]=D},iconClicked:function(C){var B=Event.getElement(C);var D=B.id.split("_");var A=this.netmap.getCategoryById(D[2]);if(A!=null){this.netmap.switchCategory(A)}},netmapCategoryVisibilityChanged:function(A){if(A.visible){this.catDivs[A.id].style.backgroundColor="#"+this.cfg.onColor}else{this.catDivs[A.id].style.backgroundColor="#"+this.cfg.offColor}},hide:function(){this.el.style.display="none"},show:function(){this.el.style.display="block"}};Joms.NetmapCategoryCheckboxControl=function(E,D){this.app=E;if(!this.app.initialized){Joms.error("Joms.NetmapCategoryControl","Objekt vytvořte až po zavolání metody init v Joms.App.");return }this.netmap=D;if(D.categories==null){Joms.error("Joms.NetmapCategoryCheckboxControl","Žádné kategorie");return }this.el=J.cel("div");this.el.className="jomsLayerControl";this.el.style.width="250px";this.app.el.appendChild(this.el);Joms.addTransparentBg(this.el);this.catInputs=new Object();var C=0;for(var B=0;B<this.netmap.categories.length;B++){if(this.newCategory(this.netmap.categories[B])){C+=1}}if(C==0){this.el.appendChild(J.ctn("V databázi nejsou žádné objekty."))}else{var A=J.cel("a");A.href="#";A.onclick=this.setCategoriesVisibility.bind(this,1);A.appendChild(J.ctn("Zobrazit vše"));this.el.appendChild(A);this.el.appendChild(J.ctn(" / "));var A=J.cel("a");A.href="#";A.onclick=this.setCategoriesVisibility.bind(this,0);A.appendChild(J.ctn("Skrýt vše"));this.el.appendChild(A)}E.hooks.register("netmapCategoryVisibilityChanged",this.netmapCategoryVisibilityChanged,this)};Joms.NetmapCategoryCheckboxControl.prototype={app:null,el:null,catInputs:null,cfg:null,newCategory:function(B){if(B.name==""){return false}var A,C;C=J.cel("div");C.className="netmapCategoryBox";A=Joms.createTransparentImage(this.netmap.iconDir+B.icon+"16.png",16,16,"png");A.title=B.name;A.className="categoryIcon";A.alt=B.name;var D=J.cel("input");D.type="checkbox";D.defaultChecked=B.visible;C.appendChild(A);C.appendChild(D);C.appendChild(J.ctn(B.name+" ("+B.objectCount+") "));this.el.appendChild(C);D.checked=B.visible;D.onclick=this.showHideCategory.bind(this,B);this.catInputs[B.id]=D;return true},showHideCategory:function(A){this.netmap.switchCategory(A)},setCategoriesVisibility:function(A){this.netmap.setCategoriesVisibility(A);return false},netmapCategoryVisibilityChanged:function(A){this.catInputs[A.id].checked=A.visible},hide:function(){this.el.style.display="none"},show:function(){this.el.style.display="block"}};Joms.NetmapIconTile=function(B,A){this.lastBottomLeft=false;this.icons=new Object();this.map=B;this.el=A;this.visible=true;this.zoomChng=false;this.netmap=B.app.netmapObjects;this.iconMouseUpEvent=this.iconMouseUp.bindAsEventListener(this);this.iconMouseOverEvent=this.iconMouseOver.bindAsEventListener(this);this.iconMouseOutEvent=this.iconMouseOut.bindAsEventListener(this)};Joms.NetmapIconTile.prototype={request:null,requestTimeOut:null,zoomChng:false,zoomChanged:function(){if(this.requestTimeOut!=null){this.requestTimeOut.cancel();this.requestTimeOut=null}if(this.request){this.request.request.abort()}this.zoomChng=true;this.removeIcons()},setView:function(B,A,C){if(C==undefined){C=true}this.bottomLeft=B;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);this.loadIcons(C)},loadIcons:function(A){if(A||this.netmap.cfg.reloadDelay<=0){if(this.requestTimeOut!=null){this.requestTimeOut.cancel()}this.requestTimeOut=new CCallWrapper(this,this.netmap.cfg.reloadDelay,"loadIconsAfterTimeOut");CCallWrapper.asyncExecute(this.requestTimeOut)}else{this.loadIconsAfterTimeOut()}},loadIconsAfterTimeOut:function(){var C="";var E;var B=this.netmap.getIconSize();var A=this.netmap.getVisibleCategoryDbIdList();var F=this.netmap.getVisibleObjectIdList();if(A==""&&F==""){this.removeIcons();this.map.app.hooks.call("netmapObjectsInMapChanged",this.objects,this.netmap);return }var D=Joms.dataScript+"?t=nol&coords="+this.ldx+"_"+this.ldy+"_"+this.rux+"_"+this.ruy+"&mppx="+this.map.zoom.mppx+"&lang="+this.netmap.cfg.lang+"&iconSize="+B;if(!this.netmap.cfg.objectGrouping){D+="&grp=0"}if(A!=""){D+="&cat="+A}if(F!=""){D+="&obj="+F}this.request=new Joms.Ajax.Request(this,D,true,function(I){this.removeIcons();var H=I.parseJSON();if(H=="0"){return }var L=new Array(H.length);for(var G=0;G<H.length;++G){var K=H[G];if(K.t=="o"){K.x+=this.ldx;K.y+=this.ldy}else{K.x1+=this.ldx;K.y1+=this.ldy;K.x2+=this.ldx;K.y2+=this.ldy;K.x=(K.x2+K.x1)/2;K.y=K.y1}K.position=new Joms.Coord(K.x,K.y);L[G]=K}L.sort(this.sortObjectsByCoord);for(var G=0;G<L.length;++G){this.newIcon(L[G],B)}this.objects=H;this.netmap.objects=H;this.request=null;this.map.app.hooks.call("netmapObjectsInMapChanged",this.objects,this.netmap)})},sortObjectsByCoord:function(B,A){return(B.y<A.y)},newIcon:function(G,H){var D;var A;var K;if(!G.ic){return }D=G.id;if(G.t=="o"){K=G.na}else{if(G.t=="g"){if(G.co>10){H=Math.min(32,H+16)}else{H=Math.min(32,H+8)}K="Skupina objektů, počet: "+G.co}else{}}A=this.netmap.iconDir+G.ic+H+".png";if(this.icons[D]){return }var B=J.cel("div");var F=H;var E=H;if(this.netmap.cfg.drawIconFoot){F+=12;if(Joms.browser.hasPngSupport()){var C=Joms.baseUrl+"images/netmap/icon_foot.png";B.style.background="url("+C+") no-repeat center bottom"}else{var C=Joms.baseUrl+"images/netmap/icon_foot_ie_"+H+".png";B.src=Joms.blankImage;B.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+C+"',sizingMethod='scale')"}}B.style.height=(F)+"px";B.style.width=(E)+"px";B.style.position="absolute";B.style.top=(this.map.unit2pxY(G.y)+this.map.positionDiff.y-F)+"px";B.style.left=(this.map.unit2pxX(G.x)+this.map.positionDiff.x-Math.round(H/2))+"px";B.style.cursor="pointer";var I=Joms.createTransparentImage(A,H,H,"png");I.title=K;I.id="netmapicon_"+D;I.style.cursor="pointer";Event.addEvent(I,"mouseup",this.iconMouseUpEvent,false);Event.addEvent(I,"mouseover",this.iconMouseOverEvent,false);Event.addEvent(I,"mouseout",this.iconMouseOutEvent,false);Event.addEvent(I,"mouseup",Event.preventDefault,false);Event.addEvent(I,"mousedown",Event.stopEvent,false);Event.addEvent(I,"contextmenu",Event.preventDefault,false);Event.disableSelect(I);this.icons[D]=B;this.icons[D].i=G;B.appendChild(I);this.el.appendChild(B)},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();this.objects=new Array()},iconMouseOver:function(C){var B=Event.getElement(C);var A=this.map.app.getLeft(C.clientX)+Joms.getOffsetX();var E=this.map.app.getTop(C.clientY)+Joms.getOffsetY();var D=this.getObjectFromElementId(B);B.style.zIndex="8";B.parentNode.style.zIndex="7";this.map.app.hooks.call("netmapIconMouseOver",B,D,new Joms.Coord(A,E))},iconMouseOut:function(B){var A=Event.getElement(B);A.style.zIndex="4";A.parentNode.style.zIndex="4";var C=this.getObjectFromElementId(A);this.map.app.hooks.call("netmapIconMouseOut",A,C)},iconMouseUp:function(C){var B=Event.getElement(C);if(Event.isRightClick(C)){return }var A=this.map.app.getLeft(C.clientX)+Joms.getOffsetX();var E=this.map.app.getTop(C.clientY)+Joms.getOffsetY();var D=this.getObjectFromElementId(B);if(D!=null){this.map.app.hooks.call("netmapIconClicked",D.id,D)}Event.stopEvent(C)},getObjectFromElementId:function(B){var A=B.id.match(/netmapicon_(.*)/);if(A!=null){return this.icons[A[1]].i}else{return null}return },hide:function(){this.visible=false;this.el.style.display="none"},show:function(){this.visible=true;this.el.style.display="block"}};Joms.NetmapIconShadowTile=function(B,A){this.lastBottomLeft=false;this.icons=new Object();this.map=B;this.el=A;this.visible=true;this.zoomChng=false;this.netmap=B.app.netmapObjects;this.map.app.hooks.register("netmapObjectsInMapChanged",this.netmapObjectsInMapChanged,this)};Joms.NetmapIconShadowTile.prototype={icons:null,zoomChanged:function(){this.zoomChng=true;this.removeIcons()},setView:function(B,A,C){},netmapObjectsInMapChanged:function(D,C){this.removeIcons();var A=this.netmap.cfg.iconSize;for(var B=0;B<D.length;++B){var E=D[B];this.newIcon(E,A)}},newIcon:function(C,A){var F=C.id;var E;var D;if(this.icons[F]){return }var B=Joms.createTransparentImage(Joms.baseUrl+"images/netmap/icon_shadow.png",32,28,"png");B.title=D;B.className="idnesIcon";B.style.position="absolute";B.style.top=(this.map.unit2pxY(C.y)+this.map.positionDiff.y-26)+"px";B.style.left=(this.map.unit2pxX(C.x)+this.map.positionDiff.x-8)+"px";this.icons[F]=B;this.icons[F].i=C;this.el.appendChild(B)},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();this.objects=new Array()},hide:function(){this.visible=false;this.el.style.display="none"},show:function(){this.visible=true;this.el.style.display="block"}};Joms.NetmapTab=function(B,C,A){this.app=B;this.id=C;this.title=A};Joms.NetmapTab.prototype={app:null,netmap:null,id:null,active:false,initialized:false,initializeOnCreate:false,menuEl:null,contentEl:null,create:function(A,B){this.tabs=A;this.netmap=A.netmap;this.menuEl=B;this.contentEl=J.cel("div");this.contentEl.id="netmapTabContent"+this.id;this.contentEl.className="netmapTabContent";this.contentEl.style.display="none";this.tabs.content.appendChild(this.contentEl)},init:function(){this.initialized=true},show:function(){this.tabs.changeTab(this.id)},activate:function(){if(!NG_TabsVisible){return }if(!this.initialized){this.init()}this.active=true;this.contentEl.style.display="block";this.menuEl.className="a";this.v_activate()},v_activate:function(){},v_deactivate:function(){},deactivate:function(){this.active=false;this.contentEl.style.display="none";this.menuEl.className="";this.v_deactivate()}};Joms.NetmapTabSearch=function(D,C,B){this.app=D;this.id="search";this.title="Vyhledat";this.initializeOnCreate=true;this.jomsSearch=new Joms.Search(D,C);var A=new Joms.Icon("http://api.planstudio.cz/images/search_res_y.png",40,32,Joms.IconCenter.BOTTOM,"png");A.setIconInnerTextPosition(5,5,29,15);A.setHighlightUrl("http://api.planstudio.cz/images/search_res_y_sel.png");this.resultIcon=A;B.showResultNums=true;B.resultIcon=A;B.setIconHandlers(this,this.resultClicked,this.mouseOver,this.mouseOut);this.searchListCfg=B};Joms.NetmapTabSearch.prototype=new Joms.NetmapTab();Joms.NetmapTabSearch.prototype.init=function(){var B='<form id="netmapTabSearchForm">';B+='<input type="text" value=""  class="netmapTabSearch" id="netmapTabSearchText" />';B+='<input id="netmapTabSearchButton" type="submit" value="Vyhledat" />';B+='<div id="netmapTabSearchResults">Vyhledávání umožňuje hledat v mapách sídla, ulice, čísla popisná, městské časti, objekty v mapě a vybrané instituce.';B+="</div>";B+='<div id="netmapTabSearchExamples">';B+="</div>";B+="</form>";this.contentEl.innerHTML=B;var A=J.gid("netmapTabSearchForm");A.onsubmit=this.search.bind(this);app.hooks.register("jomsDbSearched",this.jomsDbSearched,this);this.initialized=true};Joms.NetmapTabSearch.prototype.search=function(){var A=J.gid("netmapTabSearchText").value;this.tabs.markerCross.hide();if(A!=""){this.jomsSearch.searchText(A)}return false};Joms.NetmapTabSearch.prototype.jomsDbSearched=function(B,D){if(B!=this.jomsSearch){return }this.searchResults=D;this.app.textBox.hide();var C=J.gid("netmapTabSearchResults");C.innerHTML="";var E=this.tabs.createTabContentHeader(C,"Výsledek vyhledávání",this.reset.bind(this));this.searchResultList=new Joms.TabbedSearchResultList(app,this.searchListCfg,D);this.searchResultList.createResultList(E);var A=D.getFirstResult();if(A!=null){this.resultClicked(A,null)}};Joms.NetmapTabSearch.prototype.hideResults=function(){this.searchResults.hideResults()};Joms.NetmapTabSearch.prototype.reset=function(){this.searchResultList.hideResults();this.searchResults.reset();var A=J.gid("netmapTabSearchResults");A.innerHTML=""};Joms.NetmapTabSearch.prototype.resultClicked=function(B,A){if(A==null&&B.type!="cyclenum"&&B.type!="geocoding"){this.app.map.maxZoom(B.position);this.app.map.setMark(B.position,true)}if(B.type=="netmap"){this.app.hooks.call("netmapIconClicked",B.id,B)}else{if(B.type=="cyclenum"){routingTab.show();routingTab.searchCycleTrack(B.id)}else{if(B.type=="poi"){this.app.showObjectInfo(B.id,B.name)}else{if(B.type=="geocoding"){if(A==null){if(B.geoType=="cp"||B.geoType=="s"){mppx=0.5}else{mppx=25}var C=B.position;app.changeZoom(undefined,app.getLevelFromMppx(mppx,C.x,C.y),C.x,C.y);app.map.setCenter(C)}this.app.textBox.show(B.position,B.createBubbleHtml(),"<b>GPS:</b> "+B.position.toGpsString())}else{this.app.textBox.show(B.position,B.toString(),"<b>GPS:</b> "+B.position.toGpsString())}}}}return false};Joms.NetmapTabSearch.prototype.mouseOver=function(A){if(A.marker){A.marker.highlight()}else{this.tabs.markerCross.setPosition(A.position);this.tabs.markerCross.show()}};Joms.NetmapTabSearch.prototype.mouseOut=function(A){if(A.marker){A.marker.removeHighlight()}else{this.tabs.markerCross.hide()}};Joms.NetmapTabStreets=function(B,A){this.app=B;this.id="streets";this.title="Ulice";this.initializeOnCreate=false;this.cityName=A};Joms.NetmapTabStreets.prototype=new Joms.NetmapTab();Joms.NetmapTabStreets.prototype.init=function(){var B="";B+='<div class="netmapTabHeader">Seznam ulic města '+this.cityName+"</div>";B+='<div id="netmapStreetList"><i>Nahrávám seznam ulic</i></div>';B+='<div class="netmapTabHeader">Vyhledávání v číslech popisných</div>';B+='<form id="netmapTabSearchCpForm">';B+='<input class="netmapTabSearch" type="text" value="" id="netmapTabSearchCpText" />';B+='<input type="submit" value="Vyhledat" />';B+="</form>";B+='<div id="netmapTabSearchCpResults">';B+="Zadejte prosím číslo popisné nebo orientační. Vyhledáváno bude v adresních bodech města "+this.cityName;B+="</div>";B+='<div class="netmapTabHeader">Nejbližší čísla popisná</div>';B+='<form id="netmapTabSearchNearestCpForm">';B+='<input class="netmapTabSearch" type="text" value="" id="netmapTabSearchNearestCpText" />';B+='<input type="submit" value="Vyhledat" />';B+="</form>";B+='<div id="netmapTabSearchNearestCpResults">';B+="Kliknutím do mapy zvolte pozici v mapě. Kliknutím na vyhledat budou vyhledány nejbližší čísla popisná v okolí.";B+="</div>";this.contentEl.innerHTML=B;var A=J.gid("netmapTabSearchCpForm");A.onsubmit=this.searchCp.bind(this);var A=J.gid("netmapTabSearchNearestCpForm");A.onsubmit=this.searchNearestCp.bind(this);this.geocoding=new Joms.Geocoding(app);this.app.hooks.register("geoSearched",this.geoSearched,this);this.geocoding.searchStreetsInCity(this.cityName);this.app.hooks.register("mapClicked",this.mapClicked,this);this.initialized=true};Joms.NetmapTabStreets.prototype.createResLi=function(B){var A=J.cel("li");A.appendChild(J.cea(B.toString(),this,B,this.resultClick,this.mouseOverRes,this.mouseOut,"objectListHref"));return A};Joms.NetmapTabStreets.prototype.mouseOverRes=function(A){this.tabs.markerCross.setPosition(A.position);this.tabs.markerCross.show()};Joms.NetmapTabStreets.prototype.mouseOut=function(B,A){this.tabs.markerCross.hide()};Joms.NetmapTabStreets.prototype.resultClick=function(A){this.app.map.maxZoom(A.position);this.app.map.setMark(A.position,true)};Joms.NetmapTabStreets.prototype.streetListItemSelected=function(C,B){var A=J.gid("netmapStreetSelect");if(A.value!=""){var D=new Joms.Coord();D.fromString(A.value);this.app.map.maxZoom(D);this.app.map.setMark(D,true)}};Joms.NetmapTabStreets.prototype.geoSearched=function(B,I){if(I=="streetsincity"){var H=J.gid("netmapStreetList");H.innerHTML="";var A=J.cel("select");A.onchange=this.streetListItemSelected.bind(this);A.className="netmapStreetSelect";A.id="netmapStreetSelect";var F=J.cel("option");F.value="";F.appendChild(J.ctn("Vyberte prosím ulici"));A.appendChild(F);for(var C=0;C<this.geocoding.results.length;C++){var G=this.geocoding.results[C];F=J.cel("option");F.value=G.position.toString();F.appendChild(J.ctn(G.street));A.appendChild(F)}H.appendChild(A)}else{if(I=="cpincity"||I=="nearestcp"){var D=this.geocoding.results.length;var H=null;var L;if(I=="cpincity"){H=J.gid("netmapTabSearchCpResults");L="Bylo nalezeno "+D+" čísel popisných"}else{H=J.gid("netmapTabSearchNearestCpResults");L="V nejbližším okolí bylo nalezeno "+D+" čísel popisných"}if(D>0){H.innerHTML=L;var E=J.cel("ul");E.className="netmapRouteDestSearchResultList";for(C=0;C<D;C++){G=this.geocoding.results[C];var K=this.createResLi(G);K.style.background="url("+this.netmap.imageDir+"geo/"+G.type+".gif) no-repeat 0 2px";E.appendChild(K)}H.appendChild(E)}else{H.innerHTML="Žádná čísla popisná nebyla nalezena"}}}};Joms.NetmapTabStreets.prototype.searchCp=function(){var A=J.gid("netmapTabSearchCpText").value;if(A!=""){this.geocoding.searchCpInCity(A,this.cityName)}return false};Joms.NetmapTabStreets.prototype.searchNearestCp=function(){var A=J.gid("netmapTabSearchNearestCpText").value;if(A!=""){this.geocoding.searchNearestCp(this.searchCenterCoord,10)}return false};Joms.NetmapTabStreets.prototype.setCoord=function(A){J.gid("netmapTabSearchNearestCpText").value=A.toGpsString();this.searchCenterCoord=A};Joms.NetmapTabStreets.prototype.mapClicked=function(C,B,A){if(this.active&&!A){this.setCoord(B)}};Joms.NetmapTabObjectsInMap=function(A){this.app=A;this.id="objectsInMap";this.title="V mapě";this.groupByCategories=true};Joms.NetmapTabObjectsInMap.prototype=new Joms.NetmapTab();Joms.NetmapTabObjectsInMap.prototype.init=function(){app.hooks.register("netmapObjectsInMapChanged",this.objectsChanged,this);this.objectsChanged(this.netmap.objects,this.netmap)};Joms.NetmapTabObjectsInMap.prototype.objectsChanged=function(N,K){this.contentEl.innerHTML="";this.tabs.markerCross.hide();var H=16;if(this.netmap.cfg.objectGrouping){this.contentEl.appendChild(J.ctn("Seznam objektů v mapě není možné používat při zapnutém seskupování objektů."));return }this.contentEl.appendChild(J.ctn("V aktuálním výřezu mapy je zobrazeno "+N.length+" objektů"));if(!this.groupByCategories){var F=J.cel("ul");F.className="netmapObjectList";for(var E=0;E<N.length;E++){var D=N[E];var M=this.createObjectLi(D);F.appendChild(M)}this.contentEl.appendChild(F)}else{for(var E=0;E<K.categories.length;E++){var I=K.categories[E];if(I.name==""){continue}var G=J.cel("div");G.className="categoryObjectListHeader";var L=J.cel("input");L.type="checkbox";L.id="netmapObjectListCheckBox_"+I.dbid;L.defaultChecked=I.visible;L.onclick=this.showHideCategory.bind(this,I);var C=Joms.createTransparentImage(this.netmap.iconDir+I.icon+H+".png",H,H,"png");G.appendChild(C);G.appendChild(L);var B;if(I.visible){B=J.ctn(I.name+" ("+this.getObjectCount(N,I)+"/"+I.objectCount+")")}else{B=J.ctn(I.name)}var A=J.cel("a");A.onclick=this.showHideCategory.bind(this,I);A.href="#";A.appendChild(B);G.appendChild(A);this.contentEl.appendChild(G);L.checked=I.visible;var F=J.cel("ul");F.className="netmapObjectList";F.id="netmapObjectList_"+I.dbid;this.contentEl.appendChild(F)}for(var E=0;E<N.length;E++){var D=N[E];if(D.t=="o"){var M=this.createObjectLi(D);var F=J.gid("netmapObjectList_"+D.ca);if(F!=null){F.appendChild(M)}}}}this.initialized=true};Joms.NetmapTabObjectsInMap.prototype.getObjectCount=function(D,A){var C=0;for(var B=0;B<D.length;B++){if(D[B].ca==A.dbid){C+=1}}return C};Joms.NetmapTabObjectsInMap.prototype.showHideCategory=function(A){this.netmap.switchCategory(A);return false};Joms.NetmapTabObjectsInMap.prototype.createObjectLi=function(B){var A=J.cel("li");A.appendChild(J.cea(B.na,this,B,this.zoomMax,this.mouseOver,this.mouseOut,"objectListHref"));A.style.background="url("+netmap.iconDir+B.ic+"16.png) no-repeat 0 0";return A};Joms.NetmapTabObjectsInMap.prototype.centerMove=function(A){this.app.map.moveTo(A.x,A.y);return false};Joms.NetmapTabObjectsInMap.prototype.zoomMax=function(A){var B=new Joms.Coord(A.x,A.y);this.app.map.maxZoom(B);this.app.hooks.call("netmapIconClicked",A.id,A)};Joms.NetmapTabObjectsInMap.prototype.mouseOver=function(A){this.tabs.markerCross.setPosition(A.position);this.tabs.markerCross.show()};Joms.NetmapTabObjectsInMap.prototype.mouseOut=function(A){this.tabs.markerCross.hide()};Joms.NetmapTabObjectList=function(B,A){this.app=B;this.id="objectList";this.title="Rejstřík";this.objectListLimit=A};Joms.NetmapTabObjectList.prototype=new Joms.NetmapTab();Joms.NetmapTabObjectList.prototype.init=function(){this.catLists=new Object();this.createCategories();this.initialized=true;app.hooks.register("netmapObjectsInMapChanged",this.setCategoriesCheckboxes,this)};Joms.NetmapTabObjectList.prototype.createCategories=function(){this.contentEl.innerHTML="";var I=16;var M=this.netmap.getCategoryCount();var D=this.netmap.getObjectCount();if(this.netmap.categories.length==0){this.contentEl.innerHTML="V databázi nejsou žádné objekty."}else{this.contentEl.innerHTML="V databázi je "+D+" objektů v "+M+" kategoriích."}for(var F=0;F<this.netmap.categories.length;F++){var K=this.netmap.categories[F];var H=J.cel("div");H.className="categoryObjectListHeader";var L=J.cel("input");L.type="checkbox";L.id="netmapObjectListCheckBox_"+K.dbid;L.defaultChecked=K.visible;var G=Joms.createTransparentImage(this.netmap.iconDir+K.icon+I+".png",I,I,"png");H.appendChild(G);H.appendChild(L);var C=J.ctn(K.name+" ("+K.objectCount+")");var B=J.cel("a");B.href="#";B.appendChild(C);B.title="Zobrazit / schovat seznam objektů v kategorii "+K.name+"";H.appendChild(B);this.contentEl.appendChild(H);L.checked=K.visible;var A=J.cel("div");A.innerHTML="Nahrávám ...";A.style.display="none";this.contentEl.appendChild(A);var E=new Object;E.listEl=A;E.checkbox=L;E.visible=false;E.nameEl=H;E.category=K;E.pos=0;E.loaded=false;E.limit=this.objectListLimit;this.catLists[K.id]=E;L.onclick=this.changeVisibility.bind(this,E);B.onclick=this.switchHideCategoryObjectList.bind(this,E)}};Joms.NetmapTabObjectList.prototype.setCategoriesCheckboxes=function(E,C){for(var B=0;B<this.netmap.categories.length;B++){var A=this.netmap.categories[B];var D=this.catLists[A.id];D.checkbox.checked=A.visible}};Joms.NetmapTabObjectList.prototype.changeVisibility=function(A){this.netmap.switchCategory(A.category);if(A.category.visible){this.switchHideCategoryObjectList(A)}};Joms.NetmapTabObjectList.prototype.switchHideCategoryObjectList=function(B){if(B.visible){B.listEl.style.display="none";B.visible=false}else{B.listEl.style.display="block";B.visible=true;for(var A in this.catLists){if(A!=B.category.id){var C=this.catLists[A];C.listEl.style.display="none";C.visible=false}}if(!B.loaded){this.loadObjectList(B)}}return false};Joms.NetmapTabObjectList.prototype.loadObjectList=function(A){var B="&cat="+A.category.dbid+"&pos="+A.pos+"&limit="+A.limit+"&lang="+this.netmap.cfg.lang;new Joms.Ajax.Request(this,Joms.dataScript+"?t=nolist"+B,true,function(C){A.objects=C.parseJSON();A.loaded=true;this.createObjectList(A)})};Joms.NetmapTabObjectList.prototype.setNext=function(A){A.pos+=A.limit;this.loadObjectList(A)};Joms.NetmapTabObjectList.prototype.setPrev=function(A){A.pos-=A.limit;this.loadObjectList(A)};Joms.NetmapTabObjectList.prototype.createObjectList=function(D){var E=D.category.objectCount;D.listEl.innerHTML="";var G=J.cel("div");G.className="netmapTabObjectListCtrl";if(D.pos-D.limit>=0){G.appendChild(J.ceaImg(Joms.baseUrl+"images/netmap/prev.gif","předchozí stránka objektů","netmapTabObjectListCtrlIconPrev",this,D,this.setPrev))}if(D.pos+D.limit<E){G.appendChild(J.ceaImg(Joms.baseUrl+"images/netmap/next.gif","následující stránka objektů","netmapTabObjectListCtrlIconNext",this,D,this.setNext))}G.appendChild(J.ctn(D.pos+" - "+Math.min(D.pos+D.limit,E)+" z celkových "+E));D.listEl.appendChild(G);var C=J.cel("ul");C.className="netmapObjectList";for(var B=0;B<D.objects.length;B++){var F=D.objects[B];var A=this.createObjectLi(F);C.appendChild(A)}D.listEl.appendChild(C)};Joms.NetmapTabObjectList.prototype.createObjectLi=function(B){var A=J.cel("li");A.appendChild(J.cea(B.na,this,B,this.zoomMax,this.mouseOver,this.mouseOut,"objectListHref"));A.style.background="url("+this.netmap.iconDir+B.ic+"16.png) no-repeat 0 0";return A};Joms.NetmapTabObjectList.prototype.centerMove=function(A){this.app.map.moveTo(A.x,A.y);return false};Joms.NetmapTabObjectList.prototype.zoomMax=function(B){var C=new Joms.Coord(B.x,B.y);this.app.map.maxZoom(C);this.app.hooks.call("netmapIconClicked",B.id,B);var A=this.netmap.getCategoryByDbId(B.ca);this.netmap.showCategory(A.id)};Joms.NetmapTabObjectList.prototype.mouseOver=function(A){this.tabs.markerCross.setPosition(new Joms.Coord(A.x,A.y));this.tabs.markerCross.show()};Joms.NetmapTabObjectList.prototype.mouseOut=function(A){this.tabs.markerCross.hide()};Joms.NetmapTabRouting=function(B,A){this.app=B;this.id="routing";this.title="Plánovač";this.initializeOnCreate=true;this.hideDestinationForm=false;this.routingCfg=A;if(A==undefined){this.routingCfg=new Joms.RoutingControllConf()}else{this.routingCfg=A}this.routingCfg.destIconUrlDelete=Joms.baseUrl+"images/routing-ctrl2/delete.gif";this.routingCfg.destIconUrlShowList=Joms.baseUrl+"images/routing-ctrl2/results.gif";this.routingCfg.destIconUrlMoveUp=Joms.baseUrl+"images/routing-ctrl2/destMoveUp.gif";this.routingCfg.destIconUrlMoveDown=Joms.baseUrl+"images/routing-ctrl2/destMoveDown.gif";this.routingCtrl=new Joms.RoutingControll(B,this.routingCfg);this.app.hooks.register("routingCtrlAction",this.routingCtrlAction,this)};Joms.NetmapTabRouting.prototype=new Joms.NetmapTab();Joms.NetmapTabRouting.prototype.init=function(){this.contentEl.innerHTML="";this.destinationFormEl=J.cel("div");var A=this.tabs.createTabContentHeaderEx(this.destinationFormEl,this.contentEl,"Průjezdní body trasy",this.reset.bind(this,true));A.id="routingTabRoutingForm";var B=J.cel("div");B.id="routingTabRoutingResult";this.contentEl.appendChild(B);this.routingCtrl.id="routingCtrl";if(J.gid("heightProfile")!=null){this.routingCtrl.init(A,B,J.gid("heightProfile"))}else{this.routingCtrl.init(A,B,null)}this.initialized=true};Joms.NetmapTabRouting.prototype.addDestination=function(A){return this.routingCtrl.addDestination(A)};Joms.NetmapTabRouting.prototype.search=function(){this.routingCtrl.search()};Joms.NetmapTabRouting.prototype.searchCycleTrack=function(A){this.routingCtrl.searchCycleTrack(A)};Joms.NetmapTabRouting.prototype.reset=function(A){this.routingCtrl.reset(A);this.destinationFormEl.style.display="block";J.gid("routingTabRoutingResult").innerHTML=""};Joms.NetmapTabRouting.prototype.setAndSearchRoutingDefinition=function(B,C,A){this.routingCtrl.setAndSearchRoutingDefinition(B,C,A)};Joms.NetmapTabRouting.prototype.routingCtrlAction=function(G,D,E,I,H){switch(D){case"route":var A=J.gid("routingTabRoutingResult");switch(E){case"preItinerary":if(this.hideDestinationForm){this.destinationFormEl.style.display="none"}A.innerHTML="";var C=this.tabs.createTabContentHeader(A,"Vyhledaná trasa",this.reset.bind(this,false));C.innerHTML="Itinerář se načítá ...";this.routingCtrl.resultEl=C;break;case"postItinerary":this.routingCtrl.resultEl=A;break;case"destinationNotFound":this.app.msg("Průjezdní bod "+I.geoQueryText+" nebyl nalezen","Vyhledaná trasa");break;case"reset":if(this.hideDestinationForm){this.destinationFormEl.style.display="block"}}case"searchresult":switch(E){case"over":this.tabs.markerCross.setPosition(I.position);this.tabs.markerCross.show();break;case"out":this.tabs.markerCross.hide();break;case"click":this.app.map.setCenter(I.position);this.app.map.setMark(I.position,true);break}case"heightprofile":switch(E){case"visible":NG_RouteProfileVisible=I;break;case"created":var F=J.cel("a");F.href="";Joms.Event.addClickEvent(F,this.routingCtrl.hideHeightProfile.bind(this.routingCtrl));var B=J.cel("img");B.style.position="absolute";B.style.top="2px";B.style.right="2px";B.style.border="0";B.alt="Zavřít";B.title="Zavřít";B.src=Joms.baseUrl+"images/object-box/close.png";F.appendChild(B);$("heightProfile").appendChild(F);break}this.app.repairMapSize();break;case"crossroad":switch(E){case"over":this.tabs.markerCross.setPosition(I);this.tabs.markerCross.show();break;case"out":this.tabs.markerCross.hide();break;case"click":if(H!=undefined){this.routingCtrl.showCrossroadBubble(I,H)}else{this.app.map.setMark(I,true)}break}}};Joms.NetmapTabLegend=function(A){this.app=A;this.id="legend";this.title="?"};Joms.NetmapTabLegend.prototype=new Joms.NetmapTab();Joms.NetmapTabLegend.prototype.addDefaultHelpPages=function(){this.addHelpPage({name:"Nápověda",id:"help-basic"});this.addHelpPage({name:"Legenda",id:"legend-map"})};Joms.NetmapTabLegend.prototype.addHelpPage=function(A){if(!this.pages){this.pages=new Array()}this.pages.push(A)};Joms.NetmapTabLegend.prototype.init=function(){var C=J.cel("div");if(this.pages.length>0){this.currentPage=this.pages[0];for(var A=0;A<this.pages.length;A++){if(A>0){C.appendChild(J.ctn(" | "))}var B=this.pages[A];C.appendChild(J.cea(B.name,this,B,this.setHelpPage))}}this.contentEl.appendChild(C);this.helpEl=J.cel("div");this.contentEl.appendChild(this.helpEl);this.loadHelpPage();this.initialized=true};Joms.NetmapTabLegend.prototype.setHelpPage=function(A){if(this.currentPage.id!=A.id){this.currentPage=A;this.loadHelpPage()}};Joms.NetmapTabLegend.prototype.loadHelpPage=function(){this.request=new Joms.Ajax.Request(this,Joms.dataScript+"?t=hlp&page="+this.currentPage.id+"&lang="+Joms.lang,true,function(A){this.helpEl.innerHTML=A})};Joms.NetmapTabTrashReporter=function(A){this.app=A;this.id="trashReport";this.title="Nahlásit";this.initializeOnCreate=true;this.reportSenderEmail="info@planstudio.cz";this.reportAppName="NETMAP"};Joms.NetmapTabTrashReporter.prototype=new Joms.NetmapTab();Joms.NetmapTabTrashReporter.prototype.reportedCoord=null;Joms.NetmapTabTrashReporter.prototype.addReportOption=function(A){if(!this.options){this.options=new Array()}this.options.push(A)};Joms.NetmapTabTrashReporter.prototype.init=function(){this.markerReport=new Joms.Marker(app,new Joms.Coord(0,0),new Joms.Icon(this.tabs.netmap.imageDir+"arrow.png",32,32,Joms.IconCenter.CENTER,"png"));this.markerReport.hide();this.tabs.markerIconLayer.add(this.markerReport);var D="";D+="<p>Kliknutím do mapy zvolte souřadnici, poté zvolte typ hlášení, vyplňte popis a vaše kontaktní údaje a formulář odešlete tlačítkem Podat hlášení.</p>";D+='<form enctype="multipart/form-data" id="netmapTabTrashReporter" action="'+Joms.baseUrl+'data/server.php" method="post">';D+='<input type="hidden" value="nreporttrash" name="t" />';D+='<input type="hidden" value="'+Joms.appId+'" name="a" />';D+='<input type="hidden" value="" name="repMailList" />';D+='<input type="hidden" value="" name="appName" />';D+='<input type="hidden" value="" name="repFromEmail" />';D+='<input type="hidden" value="" name="repName" />';D+='<input type="hidden" value="" name="catCode" />';D+="<b>Chci nahlásit:</b><br />";for(var C=0;C<this.options.length;C++){var B=this.options[C];var E=this.netmap.getCategoryById(B.code);if(E==null){this.app.error(0,"Joms.NetmapTabTrashReporter","Category with code "+B.code+" doesn't exist");this.contentEl.innerHTML="Hlášení problémů bohužel není v tuto chvíli dostupné.";this.initialized=true;return }D+='<input type="radio" value="'+E.dbid+'" name="catId" '+(B.checked?'checked="1"':"")+" />"+B.name;D+="<br />";B.cat=E}D+="<br />";D+='<label>Poloha</label> (zvolte kliknutím do mapy)<br /> <input class="text" type="text" value="" name="loc" id="netmapTabTrashReporterCoord" /><br />';D+='<label>Popis</label> <br /><input class="text" type="text" value="" name="name" id="netmapTabTrashReporterShortDesc" /><br />';D+='<label>Podrobný popis</label><br /><textarea type="text" value="" name="description" style="width: 300px; height: 150px;" id="netmapTabTrashReporterDesc" ></textarea><br />';D+='<label>Fotografie</label> <br /><input class="text" type="file" value="" name="uploadPhoto" /><br />';D+='<label>Vaše jméno</label> <br /><input class="text" type="text" value="" name="from" id="netmapTabTrashReporterName" /><br />';D+='<label>Váš email</label> <br /><input class="text" type="text" value="" name="fromEmail" id="netmapTabTrashReporterEmail" /><br />';D+='<input class="text" type="hidden" value="" name="x" id="netmapTabTrashReporterCoordX" />';D+='<input class="text" type="hidden" value="" name="y" id="netmapTabTrashReporterCoordY" />';D+="<br />";D+='<input id="netmapTabTrashReporterReportButton" type="submit" value="Podat hlášení" /><br />';D+="</form>";this.contentEl.innerHTML=D;var A=J.gid("netmapTabTrashReporter");A.onsubmit=this.report.bind(this);this.app.hooks.register("mapClicked",this.mapClicked,this);this.initialized=true};Joms.NetmapTabTrashReporter.prototype.v_activate=function(){if(this.reportedCoord!=null){this.markerReport.show()}};Joms.NetmapTabTrashReporter.prototype.v_deactivate=function(){this.markerReport.hide()};Joms.NetmapTabTrashReporter.prototype.setCoord=function(A){J.gid("netmapTabTrashReporterCoord").value=A.toGpsString();this.markerReport.setPosition(A);this.markerReport.show();this.reportedCoord=A};Joms.NetmapTabTrashReporter.prototype.mapClicked=function(C,B,A){if(this.active&&!A){this.setCoord(B)}};Joms.CheckEmail=function(A){emailRegExp=/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.([a-z]){2,4})$/;if(emailRegExp.test(A)){return true}else{return false}};Joms.NetmapTabTrashReporter.prototype.report=function(){var D="";var I=J.gid("netmapTabTrashReporter");for(var C=0;C<this.options.length;C++){var B=this.options[C];var F=I.catId[C]!=undefined?I.catId[C].checked:I.catId.checked;if(F){I.repMailList.value=B.mailList;I.repName.value=B.name;I.catCode.value=B.code}}I.repFromEmail.value=this.reportSenderEmail;I.appName.value=this.reportAppName;var A=J.gid("netmapTabTrashReporterShortDesc").value;var H=J.gid("netmapTabTrashReporterDesc").value;var E=J.gid("netmapTabTrashReporterName").value;var G=J.gid("netmapTabTrashReporterEmail").value;if(this.reportedCoord==null){D+="Kliknutím do mapy prosím zvolte polohu\n"}if(A==""){D+="Vyplňte prosím stručný popis.\n"}if(H==""){D+="Vyplňte prosím alespoň stručně podrobný popis.\n"}if(E==""){D+="Zadejte prosím své jméno\n"}if(!Joms.CheckEmail(G)){D+="Zadejte prosím validní emailovou adresu.\n"}if(D!=""){alert(D);return false}J.gid("netmapTabTrashReporterCoordX").value=this.reportedCoord.x;J.gid("netmapTabTrashReporterCoordY").value=this.reportedCoord.y;return true};Joms.NetmapTabTrashReporter.prototype.reset=function(){J.gid("netmapTabTrashReporterDesc").value="";J.gid("netmapTabTrashReporterShortDesc").value="";J.gid("netmapTabTrashReporterName").value="";J.gid("netmapTabTrashReporterCoord").value="";J.gid("netmapTabTrashReporterEmail").value="";this.reportedCoord=null;this.markerReport.hide()};Joms.NetmapTabs=function(E,C,A,D,B){this.app=E;this.netmap=C;this.elname=A;this.num=0;this.tabs=new Array();this.el=J.gid(this.elname);if(!this.el){Joms.error("Chyba Joms.NetmapTabs, kořenový element pro záložky nenalezen.");return }if(D==undefined){Joms.error("Joms.NetmapTabs","Width is not defined");return }this.el.className="netmapTabs";this.el.style.width=D+"px";this.listDiv=J.cel("div");this.listDiv.className="tabmenu";this.list=J.cel("ul");this.list.className="tabmenu";this.listDiv.appendChild(this.list);this.el.appendChild(this.listDiv);this.content=J.cel("div");this.content.id="netmapTabContainer"+this.app.name;this.content.className="netmapTabContainer";this.el.appendChild(this.content);this.markerIconLayer=new Joms.CustomLayer(E,"netmapRouteTabIcons",16);this.markerCross=new Joms.Marker(E,new Joms.Coord(0,0),new Joms.Icon(this.netmap.imageDir+"arrow.png",32,32,Joms.IconCenter.CENTER,"png"));this.markerCross.hide();this.markerIconLayer.add(this.markerCross)};Joms.NetmapTabs.prototype={app:null,netmap:null,el:null,content:null,elname:null,num:null,tabs:null,markerIconLayer:null,activeTab:null,markerCross:null,addTab:function(A,E){var C,B,D;C=J.cel("li");C.id="netmapTab"+A.id;B=J.cel("a");B.innerHTML=A.title;B.href="";Joms.Event.addEvent(B,"click",this.changeTab.bind(this,A.id),false);Joms.Event.addEvent(B,"click",Joms.Event.preventDefault,false);C.appendChild(B);this.list.appendChild(C);A.create(this,C,E);this.tabs.push(A);if(A.initializeOnCreate){A.init()}if(E||this.num==0){this.activeTab=A;A.activate()}++this.num},getTab:function(B){for(var A=0;A<this.tabs.length;++A){if(this.tabs[A].id==B){return this.tabs[A]}}return null},show:function(){NG_TabsVisible=true;this.activeTab.activate();this.app.repairMapSize()},hide:function(){NG_TabsVisible=false;this.activeTab.deactivate();this.app.repairMapSize()},changeTab:function(C,B){if(B==undefined){B=true}if(!NG_TabsVisible&&B){this.show()}this.markerCross.hide();if(this.activeTab.id==C){return }var A=this.getTab(C);if(A!=null){this.activeTab.deactivate();A.activate();this.activeTab=A}},createTabContentHeader:function(B,A,C){var D=J.cel("div");return this.createTabContentHeaderEx(D,B,A,C)},createTabContentHeaderEx:function(A,E,B,H){A.className="netmapTabContentHeader";if(H!=undefined){var G=J.cel("div");G.className="close";var C=J.cel("a");C.onclick=H;C.appendChild(J.ctn("x"));G.appendChild(C);A.appendChild(G)}var I=J.cel("h2");var D=J.cel("span");D.appendChild(J.ctn(B));I.appendChild(D);A.appendChild(I);var F=J.cel("div");F.className="cont";A.appendChild(F);E.appendChild(A);return F},setContent:function(C,A){var B=this.getTab(C);if(B!=null){B.contentEl.innerHTML=A}}};Joms.NetmapQuery=function(B,A){if(!B){Joms.error("Joms.Query","Objekt aplikace nebyl definován.");return }this.app=B;this.app.query=this;this.app.hooks.register("mapChanged",this.update,this);this.app.hooks.register("closeResult",this.clearQuery,this);this.app.hooks.register("layerSwitch",this.setLayer,this);this.app.hooks.register("netmapCategoryVisibilityChanged",this.setObjectCategory,this);this.app.hooks.register("routeSearched",this.routeSearched,this);this.app.hooks.register("routeDestroyed",this.routeDestroyed,this);this.layers=new Object();this.objectCategories=new Object();this.initialized=false;this.updateUrl=(A==undefined?true:A)};Joms.NetmapQuery.prototype={query:"",rest:"",vars:null,hash:null,initialized:false,layers:null,objectCategories:null,visibleObjectId:null,route:null,parse:function(D){var C,B,A;this.vars=new Object();if(D==undefined){C=this.getQueryString()}else{C=D}C=C.split("&");for(A=0;A<C.length;++A){B=C[A].split("=");if(typeof B[0]=="string"){this.vars[B[0]]=B[1]}}if(this.vars.mark){B=this.vars.mark;this.vars.mark=new Joms.Coord();this.vars.mark.fromString(B)}else{if(this.vars.mark_x&&this.vars.mark_y){this.vars.mark=new Joms.Coord(this.vars.mark_x,this.vars.mark_y)}}if(this.vars.pos){B=this.vars.pos;this.vars.pos=new Joms.Coord();this.vars.pos.fromString(B)}else{if(this.vars.x&&this.vars.y){this.vars.pos=new Joms.Coord(this.vars.x,this.vars.y)}}if(this.vars.gpos){B=this.vars.gpos;this.vars.gpos=new Joms.Coord();this.vars.gpos.fromString(B)}if(this.vars.s42){if(this.vars.pos){this.vars.pos.fromS42()}if(this.vars.mark){this.vars.mark.fromS42()}this.vars.s42=undefined}if(this.vars.layer){B=this.vars.layer.split(",");for(A=0;A<B.length;++A){this.layers[B[A]]=true}}if(this.vars.id){this.visibleObjectId=this.vars.id}if(this.vars.voc){B=this.vars.voc.split(",");for(A=0;A<B.length;++A){this.objectCategories[B[A]]=true}}this.app.hooks.call("queryParsed")},positionDefined:function(){if(this.vars.pos&&this.vars.map&&this.vars.zoom){return true}else{return false}},poll:function(){if(!this.app||!this.app.map||this.moving){debug("move");return }if(location.hash!="#"+this.hash){this.parse();this.app.map.setPos(this.vars.x,this.vars.y,this.vars.zoom)}},createUrlParams:function(){var B;if(!this.app.map){return""}B="zoom="+this.app.map.zoom.id+"&x="+this.app.map.center.x+"&y="+this.app.map.center.y+"&map="+Joms.maps_r[this.app.mapId];if(this.app.map.markLayer&&this.app.map.markLayer.visible){B+="&mark="+this.app.map.mark.position.toString()}if(this.app.map.fullscreen){B+="&fs=1"}this.rest=B;if(this.query){B="query="+this.query+"&"+B}var H="";var F="";for(var A in this.layers){if(this.layers[A]){H+=A+",";var G=this.app.map.getOverlayLayer(A);if(G){F+=G.opacity+","}}}if(H!=""){B="layer="+Joms.rtrim(H,",")+"&"+B}if(F!=""){B="layerOpacity="+Joms.rtrim(F,",")+"&"+B}var E="";for(var C in this.objectCategories){if(this.objectCategories[C]){if(E==""){E+="voc="}else{E+=","}E+=C}}var D=this.app.netmapObjects.getVisibleObjectIdList();if(D){B+="&id="+D}if(E!=""){B=E+"&"+B}if(this.route!=null){B+="&route="+urlEncode(this.route.getDefinition())}return B},update:function(){var A;if(browser.client!="saf"&&this.initialized&&this.updateUrl){A=this.createUrlParams();location.hash=""+A}this.hash=A;return A},get:function(){return new Array(this.query,this.rest)},getQueryString:function(){return location.hash.substr(location.hash.indexOf("#")+1)},setQuery:function(B,C){this.query=B+"(";for(var A=0;A<C.length;++A){if(A!=0){this.query+="@"}this.query+=urlEncode(C[A].toString())}this.query+=")"},clearQuery:function(){this.query="";this.update()},init:function(){if(this.vars.pos||this.vars.map||this.vars.zoom){this.app.changeMap(this.vars.map,this.vars.zoom,this.vars.pos)}if(this.vars.mark){this.app.map.setMark(this.vars.mark)}if(this.vars.query){var H,B,A;B=this.vars.query.indexOf("(");action=this.vars.query.substr(0,B);A=this.vars.query.substr(B+1,this.vars.query.length-B-2);A=urlDecode(A);A=A.split("@");switch(action){case"search":J.gid("search-box").value=A[0];this.app.makeSearch(A[0],A[1],parseInt(A[2]));break}this.app.hooks.call("queryAction",action,A)}var F=this.countVisible(this.layers);if(F>0){this.app.map.setOverlayLayersVisibility(false);for(var E in this.layers){this.app.map.showOverlayLayer(E)}}else{}F=this.countVisible(this.objectCategories);if(F>0){this.app.netmapObjects.setCategoriesVisibility(false,false);for(var G in this.objectCategories){if(this.objectCategories[G]){this.app.netmapObjects.showCategory(G,false)}}this.app.netmapObjects.reloadNow()}else{var I=this.app.netmapObjects.categories;for(var C=0;C<I.length;C++){this.objectCategories[I[C].id]=I[C].visible}}if(this.visibleObjectId!=null){var D=new Array();D[0]=this.visibleObjectId;this.app.netmapObjects.cfg.visibleObjects=D}if(this.vars.route&&routingTab){routingTab.setAndSearchRoutingDefinition(urlDecode(this.vars.route))}this.initialized=true;this.update()},countVisible:function(C){var B=0;for(var A in C){if(C[A]){B+=1}}return B},setLayer:function(A,B){if(this.initialized){this.layers[A]=B}},isRouteValid:function(){if(this.route!=null){return this.route.isValid()}return false},routeSearched:function(A){this.route=A;this.update()},routeDestroyed:function(A){this.route=null;this.update()},setObjectCategory:function(A,B){if(this.initialized){this.objectCategories[A.id]=A.visible;this.update()}}};Joms.NetmapExamples=function(C,B,A){this.app=C;this.netmap=C.netmapObjects;this.searchTab=B;this.routingTab=A;this.searchExamples=new Array();this.mapExamples=new Array();this.routingExamples=new Array()};Joms.NetmapExamples.prototype={app:null,netmap:null,searchTab:null,routingTab:null,searchExamples:null,mapExamples:null,routingExamples:null,searchUlEl:null,mapUlEl:null,routingUlEl:null,addSearchExample:function(A){this.searchExamples[this.searchExamples.length]=[A]},addMapExample:function(B,C,F,A,G,E,D){this.mapExamples[this.mapExamples.length]=[B,C,F,new Joms.Coord(A,G),E,D]},addRoutingExample:function(A,B,D,C){this.routingExamples[this.routingExamples.length]=[A,B,D,C]},createHtml:function(C){var B=J.gid(C);if(B==null){return }var A=this.searchTab.tabs.createTabContentHeader(B,"Příklady a ukázky");this.createList(A,"Ukázky vyhledávání",this.searchExamples,this.setSearchExample);this.createList(A,"Ukázky map a mapových vrstev",this.mapExamples,this.setMapExample);this.createList(A,"Ukázky plánování tras",this.routingExamples,this.setRoutingExample)},createList:function(F,E,C,B){if(C.length>0){var G=J.cel("h3");G.appendChild(J.ctn(E));F.appendChild(G);var A=J.cel("ul");A.className="netmapExampleList";F.appendChild(A);for(var D=0;D<C.length;D++){var I=this.createLi(C[D][0],B.bind(this,C[D]));A.appendChild(I)}var H=J.cel("hr");F.appendChild(H)}},createLi:function(B,D){var A=J.cel("li");var C=J.cel("a");C.onclick=D;C.href="";C.appendChild(J.ctn(B));A.appendChild(C);return A},setSearchExample:function(B){var A=J.gid("netmapTabSearchText");if(A!=null){A.value=B;this.searchTab.search()}return false},setMapExample:function(A){if(A[1]){this.app.changeMap(A[1],A[2],A[3])}if(A[4]){this.app.map.setOverlayLayersVisibility(false);for(var B=0;B<A[4].length;B++){this.app.map.showOverlayLayer(A[4][B])}}if(A[5]&&this.netmap){this.netmap.setCategoriesVisibility(false,false);for(var B=0;B<A[5].length;B++){this.netmap.showCategory(A[5][B],false)}this.netmap.reloadNow()}return false},setRoutingExample:function(A){this.routingTab.setAndSearchRoutingDefinition(A[1],A[2],true);this.routingTab.show();if(A[3]){this.app.map.setOverlayLayersVisibility(false);for(var B=0;B<A[3].length;B++){this.app.map.showOverlayLayer(A[3][B])}}return false}};Joms.TabbedSearchResultList=function(D,A,C,B){this.app=D;this.se=C;if(A==undefined){this.cfg=new Joms.SearchResultListConf(D)}else{this.cfg=A}this.routingCtrl=B};Joms.TabbedSearchResultList.prototype={app:null,cfg:null,se:null,resultsVisible:true,group:null,createResultList:function(E,O){E.innerHTML="";if(this.se.getCount()==0){this.hideResults();E.innerHTML="Žádný výsledek nebyl nelezen..";return }if(O==undefined){O=true}var M=cel("div");M.className=this.cfg.listHeaderClass;E.appendChild(M);var N=cel("div");N.className="tabbedSearchListCtrls";this.setPrevEl=JceaImg(Joms.baseUrl+"images/searchlist/arrow_left.gif","předchozí","searchCtrlIcon",this,null,this._setPrevResults,16,16);N.appendChild(this.setPrevEl);var C=cel("span");C.className="tabbedSearchListPageDesc";N.appendChild(C);this.setNextEl=JceaImg(Joms.baseUrl+"images/searchlist/arrow_right.gif","následující","searchCtrlIcon",this,null,this._setNextResults,16,16);N.appendChild(this.setNextEl);N.appendChild(JceaImg(Joms.baseUrl+"images/searchlist/icon_world.gif","zobrazit v mapě","searchCtrlIcon",this,null,this.zoomToVisibleResults,16,16));E.appendChild(N);var G=cel("div");G.className="tabbedSearchListTitle";E.appendChild(G);this.nameDiv=G;this.cmdDiv=N;if(this.se.resultArr.length>0){var L=J.cel("ul");L.className="searchGroupSel";M.appendChild(L);for(var D=0;D<this.se.resultArr.length;D++){var K=this.se.resultArr[D];if(K.count>0){var A=J.cel("li");if(D==0){A.className="selected"}var I=cel("a");I.className=this.cfg.listHeaderClass;I.appendChild(ctn(K.name));I.href="#";I.title="Celkem "+K.count+" výsledků";I.onclick=this.setGroup.bind(this,D);A.appendChild(I);L.appendChild(A);var H=cel("div");H.style.display=(D==0?"block":"none");var B=cel("div");B.className=this.cfg.listUlClass;H.appendChild(B);E.appendChild(H);K.nameElement=G;K.pageDescElement=C;K.dataElement=H;K.resultsElement=B;K.titleElement=I;K.tabElement=A}}this.setGroup(0);if(O){this.app.map.hideMark();var F=this.se.getFirstResult();if(F){if(F.type=="geocoding"){this.app.map.maxZoom(F.position);this.app.map.setMark(F.position,false)}else{this.zoomToVisibleResults()}}}}},setGroup:function(B){var C=this.se.resultArr[B];this.nameDiv.innerHTML=C.name;for(var A=0;A<this.se.resultArr.length;A++){var D=this.se.resultArr[A];if(A==B){D.dataElement.style.display="block";D.tabElement.className="selected"}else{D.dataElement.style.display="none";D.tabElement.className=""}}this.group=C;this._createResultList(C);this._showVisibleResults(false);return false},showResults:function(){if(this.cfg.resultIcon!=null){this._showVisibleResults(true);this.resultsVisible=true}},switchResults:function(){if(!this.resultsVisible){this.showResults();this.resultsVisible=true}else{this.hideResults();this.resultsVisible=false}},hideResults:function(){for(var C=0;C<this.se.resultArr.length;C++){var D=this.se.resultArr[C];for(var A=0;A<D.visibleResults.length;A++){D.visibleResults[A].marker=null}}var B=this._getLayer();this.layer.clear()},_setPrevResults:function(){this.app.map.hideMark();if(this.group.moveToPrevPage()){this._createResultList(this.group);if(this.resultsVisible){this._showVisibleResults(true)}}},_setNextResults:function(){this.app.map.hideMark();if(this.group.moveToNextPage()){this._createResultList(this.group);if(this.resultsVisible){this._showVisibleResults(true)}}},_createResultList:function(F){this.hideResults();var A=this.se.cfg.listLimit;if(F.listStart-A<0){this.setPrevEl.style.visibility="hidden"}else{this.setPrevEl.style.visibility="visible"}if(F.listStart+A>=F.count){this.setNextEl.style.visibility="hidden"}else{this.setNextEl.style.visibility="visible"}var E=F.resultsElement;E.innerHTML="";var D=F.visibleResults;for(var B=0;B<D.length;B++){var C=D[B];E.appendChild(this._createResEl(C))}F.nameElement.innerHTML=F.name;F.pageDescElement.innerHTML=F.getPageDescription()},_createResEl:function(H){var C=J.cel("div");C.className="tabbedSearchListItem";var A,G,K=16;var L,I;if(H.type=="geocoding"){K=11;A=H.getIconUrl();G=I=H.getTypeName();L=H.toString(false,false);if(H.district){I+=", okres "+H.district}if(H.state){I+=", stát "+H.state}}else{if(H.type=="cyclenum"){A=Joms.baseUrl+"/images/map-icons/80.gif";L=H.toString()}else{if(H.type=="zipcode"){A=H.getIconUrl();G=H.toString();L=H.stateCode.toUpperCase()+"-"+H.zipCode+", "+H.city;I=(H.district?H.district+", ":"")+H.state;K=11}else{if(H.type=="poi"){A=H.getIconUrl();G=H.categoryName;L=H.name;I=H.categoryName;if(H.district){I+=", okres "+H.district}}else{if(H.type=="tk"){A=H.getIconUrl();if(H.a){G="prověřeno"}else{G="neprověřeno"}L=H.name}else{if(H.type=="netmap"){A=this.app.netmapObjects.iconDir+H.icon+"16.png";L=H.name;I=H.catName}else{A=H.getIconUrl();G=H.toString();L=H.toString()}}}}}}var M=cel("div");M.className="tabbedSearchCtrlResultNum";M.appendChild(ctn(H.orderId));C.appendChild(M);if(L){var B=J.cel("div");B.className="searchTextLine";if(A){B.appendChild(JceaImg(A,G,"searchIcon",this,H,this.resultClicked,K,K))}B.appendChild(Jcea(L,this,H,this.resultClicked,null,null,"searchCtrlResultHref"));C.appendChild(B)}var E;if(H.type=="tk"){if(H.address){E=this.createDetailEl(C,"searchItemDetail");E.appendChild(J.ctn(H.address))}if(H.detail){E=this.createDetailEl(C,"searchItemDescription");E.appendChild(J.ctn(H.detail))}}else{if(H.type=="cyclenum"){E=this.createDetailEl(C,"searchItemDetail");var F=Jcea("itinerář",this,H,this.showCycleTrackItinerary,null,null);E.appendChild(J.ctn("zobrazit "));E.appendChild(F)}else{if(I){E=this.createDetailEl(C,"searchItemDetail");E.appendChild(J.ctn(I))}}}if(Joms.browser.isIE()){B.onmouseover=this.resultOver.bind(this,H);B.onmouseout=this.resultOut.bind(this,H)}else{C.onmouseover=this.resultOver.bind(this,H);C.onmouseout=this.resultOut.bind(this,H)}var D=J.cel("div");D.className="cleaner";C.appendChild(D);H.liEl=C;return C},showCycleTrackItinerary:function(A){if(this.routingCtrl){this.routingCtrl.searchCycleTrack(A.id)}else{this.app.error(0,"","Routing Ctrl not set")}},createDetailEl:function(B,A){var C=J.cel("div");C.className=A;B.appendChild(C);return C},_getLayer:function(){var A;if(typeof this.layer=="undefined"){A=new Joms.CustomLayer(this.app,"searchResults",15);this.layer=A}return this.layer},_showVisibleResults:function(C){if(C){this.zoomToVisibleResults()}var B=this._getLayer();B.clear();for(var A=0;A<this.group.visibleResults.length;A++){B.add(this._addResultMarker(this.group.visibleResults[A]))}},_addResultMarker:function(B){var A=new Joms.Marker(this.app,B.position,this.cfg.resultIcon);A.setClickAction(this.resultClicked.bind(this),B,A);A.setOverAction(this.resultOver.bind(this),B,A);A.setOutAction(this.resultOut.bind(this),B,A);A.setInnerText(B.orderId,"searchCtrlResultNumText");A.setTitle(B.toString());B.marker=A;return A},zoomToVisibleResults:function(){if(this.group.visibleResultsRect!=null){this.app.map.zoomToRect(this.group.visibleResultsRect)}},resultClicked:function(B,A,C){this.cfg.onResultIconClickFnc.call(this.cfg.onResultIconFncScope,B,A)},resultOver:function(B,A,C){this.cfg.onResultIconMouseOverFnc.call(this.cfg.onResultIconFncScope,B,A)},resultOut:function(B,A,C){this.cfg.onResultIconMouseOutFnc.call(this.cfg.onResultIconFncScope,B,A)}};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';
Joms.lang = 'cze';

var resultBg = '#dedede';
var debug_count = 0;
var browser = Joms.browser;
Joms.lang='cze';
Joms.maps={"sumava-net":1009,"sumava-net-75":1010};
Joms.maps_r={"1009":"sumava-net","1010":"sumava-net-75"};
Joms.appId="26b560644a800a53b8191849a58fcdf6";
Joms.domains=["*.klatovy.net","*.klatovynet.cz","*.planstudio.cz","*.regioweb.cz","*.sumava.net","*.sumavanet.cz","klatovy.net","klatovynet.cz","localhost","regioweb.cz","sumava.net","sumavanet.cz"];
Joms.mapBorder = {"ldx":328865,"ldy":5377494,"phx":466092,"phy":5502578};
Joms.mapLevelCache = {"1009":[{"id":1009,"count":3,"ldx":328865,"ldy":5377494,"rux":466079,"ruy":5502578,"border":["328867.50","5502552.00","466078.50","5502577.50","466006.50","5377534.50","432334.50","5377494.00","328864.50","5476866.00","328867.50","5502552.00"]},[{"zoom":0,"mppx":4},{"zoom":1,"mppx":2},{"zoom":2,"mppx":1}]],"1010":[{"id":1010,"count":6,"ldx":329092,"ldy":5377561,"rux":466092,"ruy":5502361,"border":["329092.00","5502361.00","466092.00","5502361.00","466092.00","5377561.00","329092.00","5377561.00"]},[{"zoom":0,"mppx":200},{"zoom":1,"mppx":100},{"zoom":2,"mppx":50},{"zoom":3,"mppx":25},{"zoom":4,"mppx":15},{"zoom":5,"mppx":9}]]};
Joms.baseMaps = [1010];
Joms.mapDataCache = {"1009":{"1":[{"id":0,"column_length":8,"x_length":137,"y_length":125,"ldx":328967,"ldy":5377523,"rux":465967,"ruy":5502523,"mppx":4,"tile_width":250,"tile_height":250,"icon_width":16,"icon_height":16,"base_map":0,"columns":8,"type":"png","dir":"sumava-net","scale":"40000","layers_dir":"","first":0,"repl":1,"center_x":397467,"center_y":5440023,"group":0},{"id":1,"column_length":4,"x_length":274,"y_length":250,"ldx":328965,"ldy":5377524,"rux":465965,"ruy":5502524,"mppx":2,"tile_width":250,"tile_height":250,"icon_width":16,"icon_height":16,"base_map":0,"columns":4,"type":"png","dir":"sumava-net","scale":"20000","layers_dir":"","first":0,"repl":1,"center_x":397467,"center_y":5440023,"group":0},{"id":2,"column_length":2,"x_length":548,"y_length":500,"ldx":328965,"ldy":5377525,"rux":465965,"ruy":5502525,"mppx":1,"tile_width":250,"tile_height":250,"icon_width":16,"icon_height":16,"base_map":0,"columns":2,"type":"png","dir":"sumava-net","scale":"10000","layers_dir":"","first":0,"repl":1,"center_x":397467,"center_y":5440023,"group":0}],"0":"1009","2":["328867.50","5502552.00","466078.50","5502577.50","466006.50","5377534.50","432334.50","5377494.00","328864.50","5476866.00","328867.50","5502552.00"],"3":[{"id":1010,"count":6}],"4":"0"},"1010":{"1":[{"id":0,"column_length":3,"x_length":3,"y_length":3,"ldx":322592,"ldy":5364961,"rux":472592,"ruy":5514961,"mppx":200,"tile_width":250,"tile_height":250,"icon_width":16,"icon_height":16,"base_map":1,"columns":3,"type":"png","dir":"sumava-net-75","scale":"0","layers_dir":null,"first":0,"repl":1,"center_x":397592,"center_y":5439961,"group":0},{"id":1,"column_length":6,"x_length":6,"y_length":5,"ldx":322492,"ldy":5377461,"rux":472492,"ruy":5502461,"mppx":100,"tile_width":250,"tile_height":250,"icon_width":16,"icon_height":16,"base_map":1,"columns":6,"type":"png","dir":"sumava-net-75","scale":"0","layers_dir":null,"first":0,"repl":1,"center_x":397592,"center_y":5439961,"group":0},{"id":2,"column_length":11,"x_length":11,"y_length":10,"ldx":328742,"ldy":5377511,"rux":466242,"ruy":5502511,"mppx":50,"tile_width":250,"tile_height":250,"icon_width":16,"icon_height":16,"base_map":1,"columns":11,"type":"png","dir":"sumava-net-75","scale":"0","layers_dir":null,"first":0,"repl":1,"center_x":397592,"center_y":5439961,"group":0},{"id":3,"column_length":22,"x_length":22,"y_length":20,"ldx":328730,"ldy":5377511,"rux":466230,"ruy":5502511,"mppx":25,"tile_width":250,"tile_height":250,"icon_width":16,"icon_height":16,"base_map":1,"columns":22,"type":"png","dir":"sumava-net-75","scale":"0","layers_dir":null,"first":0,"repl":1,"center_x":397592,"center_y":5439961,"group":0},{"id":4,"column_length":30,"x_length":37,"y_length":34,"ldx":328100,"ldy":5376266,"rux":466850,"ruy":5503766,"mppx":15,"tile_width":250,"tile_height":250,"icon_width":24,"icon_height":24,"base_map":1,"columns":30,"type":"png","dir":"sumava-net-75","scale":"0","layers_dir":null,"first":0,"repl":1,"center_x":397592,"center_y":5439961,"group":0},{"id":5,"column_length":18,"x_length":61,"y_length":56,"ldx":328845,"ldy":5377019,"rux":466095,"ruy":5503019,"mppx":9,"tile_width":250,"tile_height":250,"icon_width":24,"icon_height":24,"base_map":1,"columns":18,"type":"png","dir":"sumava-net-75","scale":"0","layers_dir":null,"first":0,"repl":1,"center_x":397592,"center_y":5439961,"group":0}],"0":"1010","2":["329092.00","5502361.00","466092.00","5502361.00","466092.00","5377561.00","329092.00","5377561.00"],"3":"0","4":[1009]}};
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 +'").');
	}
}

