var VISICOM_API_URL="http://maps.visicom.ua/api/1.0.0//";var BG_IE_WIDTH=1024;var BG_IE_HEIGHT=768;var MSG_SEARCH_ADDRESS="Поиск по адресной базе";var MSG_MORE_2="Введите более 2-х символов...";var MSG_PLEASE_WAIT=new Array();MSG_PLEASE_WAIT.ukraine_ua="Зачекайте, іде завантаження...";MSG_PLEASE_WAIT.ukraine_ru="Подождите, идет загрузка...";MSG_PLEASE_WAIT.ukraine_en="Please wait...";var MSG_NOT_FOUND=new Array();MSG_NOT_FOUND.ukraine_ua="Нічого не знайдено.";MSG_NOT_FOUND.ukraine_ru="Нет результатов.";MSG_NOT_FOUND.ukraine_en="Not found.";var ZINDEX_MARKERS_HOVER="520";var ZINDEX_MARKERS="500";var ZINDEX_INFOWINDOW="490";var ZINDEX_POLYLINE="450";var VisicomEvents=(function(){function a(h,g,e){var c=null;var f=null;var d=null;if(e!=null){c=h;f=g;d=e}else{f=h;d=g}if(c==null){mapEngine.addEventListener(f,d)}else{if(c instanceof VMarker){c.addEventListener(f,d)}else{if(c instanceof VInfoWindow){c.addEventListener(f,d)}}}}function b(f,e){var c=null;var d=null;if(e!=null){c=f;d=e}else{d=f}if(c==null){mapEngine.removeEventListener(d)}else{if(c instanceof VMarker){c.removeEventListener(d)}else{if(c instanceof VInfoWindow){c.removeEventListener(d)}}}}return{addListener:a,removeListener:b}})();var VEvents=VisicomEvents;function VEvent(b,a){this._event_name=b;this._handler=a;return(this)}VEvent.prototype._event_name=null;VEvent.prototype._handler=null;var USER_DATA={Browser:{KHTML:/Konqueror|KHTML/.test(navigator.userAgent)&&!/Apple/.test(navigator.userAgent),Safari:/KHTML/.test(navigator.userAgent)&&/Apple/.test(navigator.userAgent),Opera:!!window.opera,MSIE:!!(window.attachEvent&&!window.opera),Gecko:/Gecko/.test(navigator.userAgent)&&!/Konqueror|KHTML/.test(navigator.userAgent)},OS:{Windows:navigator.platform.indexOf("Win")>-1,Mac:navigator.platform.indexOf("Mac")>-1,Linux:navigator.platform.indexOf("Linux")>-1}};VPoint.prototype._x=null;VPoint.prototype._y=null;VPoint.prototype.getX=function(){return(Math.floor(this._x))};VPoint.prototype.getY=function(){return(Math.floor(this._y))};VPoint.prototype.setX=function(a){this._x=a};VPoint.prototype.setY=function(a){this._y=a};VPoint.prototype.convertToGeoPoint=function(){return(geoUtil.convertToGeoProjection(this._x,this._y))};function VPoint(a,b){this._x=a;this._y=b;return(this)}VPoint.prototype.distanceTo=function(b){var a=(Math.sqrt(Math.pow(b.getX()-this.getX(),2)+Math.pow(b.getY()-this.getY(),2)))*0.01;return(a)};VGeoPoint.prototype._longitude=null;VGeoPoint.prototype._latitude=null;VGeoPoint.prototype.getLongitude=function(){return(this._longitude)};VGeoPoint.prototype.getLatitude=function(){return(this._latitude)};VGeoPoint.prototype.convertToLocalPoint=function(){return(geoUtil.convertFromGeoProjection(this._longitude,this._latitude))};function VGeoPoint(a,b){this._longitude=a;this._latitude=b;return(this)}VGeoPoint.prototype.distanceTo=function(a){return(this.convertToLocalPoint().distanceTo(a.convertToLocalPoint()))};VGeoObject.POINT="points";VGeoObject.POLYLINE="polyline";VGeoObject.POLYGONE="polygone";VGeoObject.prototype.points;VGeoObject.prototype.type;VGeoObject.prototype.options;function VGeoObject(){return(this)}MBR.prototype._point_min=null;MBR.prototype._point_max=null;MBR.prototype.getMinPoint=function(){return(this._point_min)};MBR.prototype.getMaxPoint=function(){return(this._point_max)};function MBR(b,a){this._point_min=b;this._point_max=a;return(this)}VBounds.prototype._point_min=null;VBounds.prototype._point_max=null;VBounds.prototype.getMinPoint=function(){return(this._point_min)};VBounds.prototype.getMaxPoint=function(){return(this._point_max)};function VBounds(b,a){this._point_min=b;this._point_max=a;return(this)}VBounds.prototype.containsPoint=function(a){return((a.getX()>=this._point_min.getX())&&(a.getX()<=this._point_max.getX())&&(a.getY()>=this._point_min.getY())&&(a.getY()<=this._point_max.getY()))};function trim(a){return a.replace(/(^\s+)|(\s+$)/g,"")}function getBounds(a){if(a==null){return(null)}var d=a.offsetLeft;var c=a.offsetTop;for(var b=a.offsetParent;b;b=b.offsetParent){d+=b.offsetLeft-b.scrollLeft;c+=b.offsetTop-b.scrollTop}return{left:d,top:c,width:a.offsetWidth,height:a.offsetHeight}}function getClientsTop(){var a=self.pageYOffset||(document.documentElement&&document.documentElement.scrollTop)||(document.body&&document.body.scrollTop);return(a)}function getClientsLeft(){var a=self.pageXOffset||(document.documentElement&&document.documentElement.scrollLeft)||(document.body&&document.body.scrollLeft);return(a)}VTransformFactor.prototype.m_Cx=null;VTransformFactor.prototype.m_Ax=null;VTransformFactor.prototype.m_Bx=null;VTransformFactor.prototype.m_Cy=null;VTransformFactor.prototype.m_Ay=null;VTransformFactor.prototype.m_By=null;VTransformFactor.prototype.setFactor=function(a){this.set(a.m_Cx,a.m_Ax,a.m_Bx,a.m_Cy,a.m_Ay,a.m_By)};VTransformFactor.prototype.set=function(c,e,a,b,d,f){this.m_Cx=c;this.m_Ax=e;this.m_Bx=a;this.m_Cy=b;this.m_Ay=d;this.m_By=f};function VTransformFactor(){this.set(0,1,0,0,0,1);return(this)}VGeoUtil.prototype.AaxisWGS84=6378137;VGeoUtil.prototype.BaxisWGS84=6356752.314245179;VGeoUtil.prototype.PreferableScale=0.01;VGeoUtil.prototype.m_TransToDB=new VTransformFactor();VGeoUtil.prototype.m_TransFromDB=new VTransformFactor();VGeoUtil.prototype.setToDBKoef=function(a){this.m_TransToDB.setFactor(a)};VGeoUtil.prototype.setFromDBKoef=function(a){this.m_TransFromDB.setFactor(a)};VGeoUtil.prototype.getMeridianLength=function(j,g,f){var i,l,d;var k,h,e,n;var c,b,o,m,a;j*=Math.PI/180;l=(g-f)/(g+f);i=g/(1+l);d=l*l;n=l*35*d/42;e=d*15*d/16;e=d*15/16-e;h=l*3*d/16;h=l*3/2-h;k=d*d/64;k+=d/4;k+=1;m=n*Math.sin(j*6);o=e*Math.sin(j*4);b=h*Math.sin(j*2);c=k*j;a=m+b;a=o-a;a+=c;return(a*i)};VGeoUtil.prototype.degreeToRadian=function(a){return(a*Math.PI/180)};VGeoUtil.prototype.convertToGeoProjection=function(a,d){var b=this.m_TransFromDB.m_Cx+this.m_TransFromDB.m_Ax*a+this.m_TransFromDB.m_Bx*d;var c=this.m_TransFromDB.m_Cy+this.m_TransFromDB.m_Ay*a+this.m_TransFromDB.m_By*d;return(new VGeoPoint(b,c))};VGeoUtil.prototype.convertFromGeoProjection=function(b,d){var a=this.m_TransToDB.m_Cx+this.m_TransToDB.m_Ax*b+this.m_TransToDB.m_Bx*d;var c=this.m_TransToDB.m_Cy+this.m_TransToDB.m_Ay*b+this.m_TransToDB.m_By*d;return(new VPoint(a,c))};VGeoUtil.prototype.initialization=function(k,c,q,h){var f,o,g,l,b;var d=111134.78;var j,i;var e=new VTransformFactor();var p,m,a,n;f=this.degreeToRadian((c+h)/2);j=this.getMeridianLength(h,this.AaxisWGS84,this.BaxisWGS84);i=this.getMeridianLength(c,this.AaxisWGS84,this.BaxisWGS84);d=j-i;d=d/(h-c);p=d/this.PreferableScale;a=p*Math.cos(f);o=a*k;g=a*q;l=p*c;b=p*h;n=-(o+g)/2;m=-(l+b)/2;e.set(n,a,0,m,0,p);this.setToDBKoef(e);a=1/a;p=1/p;n=-n*a;m=-m*p;e.set(n,a,0,m,0,p);this.setFromDBKoef(e);return(true)};function VGeoUtil(){return(this)}var geoUtil=new VGeoUtil();geoUtil.initialization(21.784987,44.027712,40.581624,52.379496);VRulerItem.prototype._div;VRulerItem.prototype._image;VRulerItem.prototype._index;function VRulerItem(c,b,a){this._left=c;this._top=b;this._index=a;this._div=document.createElement("div");this._div.id="ruller_div_"+a;this._div.className="shadow";this._div.style.position="absolute";this._div.style.left=c+"px";this._div.style.top=b+"px";this._div.style.width="17px";this._div.style.height="14px";this._div.style.zIndex="100";this._div.style.cursor="pointer";this._image=document.createElement("img");this._image.id="ruller_"+a;this._image.className="shadow";this._image.style.position="absolute";this._image.style.left="0px";this._image.style.top="0px";this._image.style.width="17px";this._image.style.height="14px";this._image.style.zIndex="100";this._image.style.background="none";this._image.style.cursor="pointer";this._div.appendChild(this._image);return(this)}VRulerItem.prototype.getDOMElement=function(){return(this._div)};VRulerItem.prototype.setImageSource=function(a){this._image.src=a};VRulerItem.prototype.onMouseDown=function(c){var b=mapEngine.getZoomIndex();var a=this._index;zoomControl.setRunnerPosition(this._index);mapEngine.setCenterCoords(VIEWPORT_WIDTH/2,VIEWPORT_HEIGHT/2);mapEngine.setZoom(this._index);mapEngine.showMap();mapEngine.fireMapEvent("zoomchange",b,a);zoomControl._index=this._index};VRulerItem.prototype.onMouseMove=function(a){if(!zoomControl._mousedown){return}};var RULER_ITEM_WIDTH=17;var RULER_ITEM_HEIGHT=14;var ZOOM_BUTTON_WIDTH=17;var ZOOM_BUTTON_HEIGHT=17;var RUNNER_WIDTH=17;var RUNNER_HEIGHT=16;VZoomControl.prototype._left;VZoomControl.prototype._top;VZoomControl.prototype._length;VZoomControl.prototype._mousedown=false;VZoomControl.prototype._index;VZoomControl.prototype._button_zoom_in;VZoomControl.prototype._button_zoom_out;VZoomControl.prototype._ruler=null;VZoomControl.prototype._runner=null;VZoomControl.prototype._ruler_div=null;VZoomControl.prototype.setCurrentIndex=function(a){this._index=a};function VZoomControl(f,e,d){this._left=f;this._top=e;this._length=d;this._ruler=new Array();var h=this;this._button_zoom_in=document.createElement("img");this._button_zoom_in.id="button_zoom_in";this._button_zoom_in.src=VISICOM_API_URL+"/images/zoom/zoom-in.gif";this._button_zoom_in.className="shadow";this._button_zoom_in.style.position="absolute";this._button_zoom_in.style.left=f+"px";this._button_zoom_in.style.top=e+"px";this._button_zoom_in.style.width=ZOOM_BUTTON_WIDTH+"px";this._button_zoom_in.style.height=ZOOM_BUTTON_HEIGHT+"px";this._button_zoom_in.style.zIndex="102";this._button_zoom_in.style.background="none";this._button_zoom_in.style.cursor="pointer";this._button_zoom_in.onmousedown=function(i){mapEngine.setCenterCoords(VIEWPORT_WIDTH/2,VIEWPORT_HEIGHT/2);mapEngine.zoomIn()};var a=document.createElement("div");this._ruler_div=a;a.style.position="absolute";a.style.left=f+"px";a.style.top=(e+RULER_ITEM_WIDTH)+"px";a.style.width=RULER_ITEM_WIDTH+"px";a.style.height=(this._length*RULER_ITEM_HEIGHT)+"px";a.style.zIndex="107";a.style.cursor="pointer";a.onmousedown=function(k){if(!k){k=window.event}h._mousedown=true;if(USER_DATA.Browser.MSIE){var l=k.clientY+getClientsTop()}else{l=k.pageY}var j=getBounds(a);if(j!=null){var i=h._length-Math.floor((l-j.top)/RULER_ITEM_HEIGHT)-1;if(i<0){i=0}if(i>(h._length-1)){i=h._length-1}h._ruler[i].onMouseDown(k)}if(k.stopPropagation){k.stopPropagation()}else{k.cancelBubble=true}if(k.preventDefault){k.preventDefault()}else{k.returnValue=false}};a.onmouseup=function(i){zoomControl._mousedown=false};a.onmousemove=function(l){if(!zoomControl._mousedown){return}var j;if(l==undefined){l=window.event;j=l.button}else{j=l.which}if(j!=1){return}a.style.cursor="pointer";if(USER_DATA.Browser.MSIE){var m=l.clientY+getClientsTop()}else{m=l.pageY}var k=getBounds(a);var i=h._length-Math.floor((m-k.top)/RULER_ITEM_HEIGHT)-1;if(i<0){i=0}if(i>(h._length-1)){i=h._length-1}if(zoomControl._index!=i){h._ruler[i].onMouseDown(l)}if(l.stopPropagation){l.stopPropagation()}else{l.cancelBubble=true}if(l.preventDefault){l.preventDefault()}else{l.returnValue=false}};mapEngine.getViewport().appendChild(a);var c=0;for(var b=this._length-1;b>=0;b--){var g=new VRulerItem(0,c,b);this._ruler[b]=g;if(b==0){g.setImageSource(VISICOM_API_URL+"/images/zoom/ruler-bottom.gif")}else{if(b==this._length-1){g.setImageSource(VISICOM_API_URL+"/images/zoom/ruler-top.gif")}else{g.setImageSource(VISICOM_API_URL+"/images/zoom/ruler-middle.gif")}}a.appendChild(g.getDOMElement());c+=RULER_ITEM_HEIGHT}this._button_zoom_out=document.createElement("img");this._button_zoom_out.id="button_zoom_out";this._button_zoom_out.src=VISICOM_API_URL+"/images/zoom/zoom-out.gif";this._button_zoom_out.className="shadow";this._button_zoom_out.style.position="absolute";this._button_zoom_out.style.left=f+"px";this._button_zoom_out.style.top=(c+this._top+RULER_ITEM_WIDTH)+"px";this._button_zoom_out.style.width=ZOOM_BUTTON_WIDTH+"px";this._button_zoom_out.style.height=ZOOM_BUTTON_HEIGHT+"px";this._button_zoom_out.style.zIndex="102";this._button_zoom_out.style.cursor="pointer";this._button_zoom_out.onmousedown=function(i){mapEngine.setCenterCoords(VIEWPORT_WIDTH/2,VIEWPORT_HEIGHT/2);mapEngine.zoomOut()};mapEngine.getViewport().appendChild(this._button_zoom_in);mapEngine.getViewport().appendChild(this._button_zoom_out);zoomControl=this;return(this)}VZoomControl.prototype.onMouseMove=function(c){if(!zoomControl._flag){return}var b;if(c==undefined){c=window.event;b=c.button}else{b=c.which}if(b!=1){return}var a=__length-Math.round(c.pageY-getBounds(rulerDiv).top/RULER_ITEM_HEIGHT);zoomControl._ruler[a].onMouseDown(c)};VZoomControl.prototype.setRunnerPosition=function(a){if(this._runner==null){this._runner=document.createElement("img");this._runner.id="runner";this._runner.src=VISICOM_API_URL+"/images/zoom/runner.gif";this._runner.style.position="absolute";this._runner.style.left="0px";this._runner.style.top="0px";this._runner.style.width=RUNNER_WIDTH+"px";this._runner.style.height=RUNNER_HEIGHT+"px";this._runner.style.zIndex="107";this._runner.style.background="none";this._runner.style.cursor="pointer";var c=this;this._runner.onmouseup=function(d){c._mousedown=false};mapEngine.getViewport().appendChild(this._runner)}this._index=a;try{this._ruler[this._index].getDOMElement().removeChild(this._runner)}catch(b){}this._ruler[a].getDOMElement().appendChild(this._runner)};VZoomControl.prototype.showRuler=function(){mapEngine.getViewport().appendChild(rulerDiv)};VZoomControl.prototype.hideRuler=function(){try{mapEngine.getViewport().removeChild(rulerDiv)}catch(a){}};VZoomControl.prototype.showZoomButoons=function(){};VZoomControl.prototype.hideZoomButoons=function(){};VMarkerIcon.prototype._width=null;VMarkerIcon.prototype._height=null;VMarkerIcon.prototype._image_src=null;VMarkerIcon.prototype._alpha_enable=false;VMarkerIcon.prototype.getWidth=function(){return(this._width)};VMarkerIcon.prototype.getHeight=function(){return(this._height)};VMarkerIcon.prototype.getImageSource=function(){return(this._image_src)};VMarkerIcon.prototype.isAlphaEnabled=function(){return(this._alpha_enable)};function VMarkerIcon(d,a,c,b){this._width=d;this._height=a;this._image_src=c;if(b!=null){this._alpha_enable=b}return(this)}VMarkerIcon.prototype.setAlphaEnable=function(a){this._alpha_enable=a};var MARKER_WIDTH=27;var MARKER_HEIGHT=35;var DEFAULT_MARKER_ICON=new VMarkerIcon(MARKER_WIDTH,MARKER_HEIGHT,VISICOM_API_URL+"images/markers/pointer-trans.png");DEFAULT_MARKER_ICON.setAlphaEnable(true);VMarker.prototype=new VMapObject();VMarker.prototype._info_window=null;VMarker.prototype._hint=null;VMarker.prototype._icon=DEFAULT_MARKER_ICON;VMarker.prototype._point=null;VMarker.prototype._draggable=false;VMarker.prototype._mousedown=false;VMarker.prototype._moved=false;VMarker.prototype._mousedown_x=null;VMarker.prototype._mousedown_y=null;VMarker.prototype._current_x=null;VMarker.prototype._current_y=null;VMarker.prototype._event_listeners=null;VMarker.prototype._mouse_event_listeners=null;VMarker.prototype.isDraggable=function(){return(this._draggable)};VMarker.prototype.setDraggable=function(a){this._draggable=a};function VMarker(a,b){}function VMarker(a,b){if(a instanceof VGeoPoint){this._point=geoUtil.convertFromGeoProjection(a.getLongitude(),a.getLatitude())}else{if(a instanceof VPoint){this._point=a}}if(b!=undefined){this._icon=b}this._visible=true;this._displayed=false;this._event_listeners=new Array();this._mouse_event_listeners=new Array();return(this)}VMarker.prototype.getDOMElement=function(){return(this._div)};VMarker.prototype.bindInfoWindow=function(a){this._info_window=a};VMarker.prototype.openInfoWindow=function(){if(!this._info_window.isVisible()){this._info_window.show(this)}};VMarker.prototype.closeInfoWindow=function(){if(this._info_window==null){return}if(this._info_window.isVisible()){this._info_window.hide()}};VMarker.prototype._hideHint=function(){if(this._hint==null){return}if(!this._hint.isVisible()){return}this._hint.hide()};VMarker.prototype.getParentTile=function(){return(this._parent_tile)};VMarker.prototype._createDOMElement=function(){this._div=document.createElement("img");this._div.id="marker_"+this._point.getX()+this._point.getY();this._div.style.position="absolute";this._div.width=this._icon.getWidth();this._div.height=this._icon.getHeight();this._div.style.background="none";this._div.style.zIndex=ZINDEX_MARKERS;if(this._icon.isAlphaEnabled()){if(USER_DATA.Browser.MSIE){this._div.src=VISICOM_API_URL+"/images/blank.gif";this._div.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this._icon.getImageSource()+"')"}else{this._div.src=this._icon.getImageSource()}}else{this._div.src=this._icon.getImageSource()}this._div.style.cursor="pointer";var a=this;this._div.onclick=function(b){a.onMouseClick(b)};this._div.onmousedown=function(b){a.onMouseDown(b)};this._div.onmouseup=function(b){a.onMouseUp(b)};this._div.ondblclick=function(b){a.fireMouseEvent("mousedblclick",a._point)};this._div.onmouseover=function(b){if(a._mousedown){return}if(a._hint==null){return}if(a._hint.isVisible()){return}a._hint.setOffset(0,-a._icon.getHeight());a._hint.show(a.getPoint());mapEngine._current_hint_window=a._hint;a._div.style.zIndex=ZINDEX_MARKERS_HOVER};this._div.onmouseout=function(b){a._hideHint();mapEngine._current_hint_window=null;a._div.style.zIndex=ZINDEX_MARKERS}};VMarker.prototype.onMouseDown=function(a){if(!a){a=window.event}mapEngine.mouse_over_flag=false;this._moved=false;this.fireMouseEvent("mousedown",this._point);if(this._draggable){mapEngine._draggable_marker=this;this.closeInfoWindow();this._hideHint();this._mousedown=true;this._mousedown_x=a.clientX;this._mousedown_y=a.clientY;this._current_x=a.clientX;this._current_y=a.clientY;this._div.style.zIndex=ZINDEX_MARKERS_HOVER;this.fireDraggingEvent("startdrag")}if(a.stopPropagation){a.stopPropagation()}else{a.cancelBubble=true}if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}};VMarker.prototype.onMouseUp=function(a){if(!a){a=window.event}if(!this._moved){this.fireMouseEvent("mouseup",this._point)}mapEngine.mouse_over_flag=true;mapEngine._draggable_marker=null;if(!this._mousedown){return}if(!this._draggable){return}this._mousedown=false;if(this._moved){this._relocateMarker(a.clientX,a.clientY);this.fireMouseEvent("mouseup",this._point);this.fireDraggingEvent("enddrag")}if(a.stopPropagation){a.stopPropagation()}else{a.cancelBubble=true}if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}};VMarker.prototype.onMouseClick=function(a){if(!a){a=window.event}if(!this._moved){this.fireMouseEvent("mouseclick",this._point)}if(this._info_window==null){return}if(!this._moved){mapEngine.dragging=true;this._info_window.show(this.getPoint())}if(a.stopPropagation){a.stopPropagation()}else{a.cancelBubble=true}if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}};VMarker.prototype.onMouseOut=function(a){if(!a){a=window.event}mapEngine._draggable_marker=null;if(!this._mousedown){return}if(!this._draggable){return}this._mousedown=false;this._relocateMarker(a.clientX,a.clientY)};VMarker.prototype._relocateMarker=function(b,a){this._div.style.zIndex=ZINDEX_MARKERS;var d=mapEngine.convertToScreenCoords(this._point._x-mapEngine.getMinX(),mapEngine.getMaxY()-this._point._y,mapEngine._currentMap._units_per_pixel);d.setLeft(d.getLeft()+(b-this._mousedown_x));d.setTop(d.getTop()+(a-this._mousedown_y));var c=mapEngine.convertToLocalCoords(d.getLeft(),d.getTop(),mapEngine._currentMap._units_per_pixel);this.setPoint(c);mapEngine.repaintMap()};VMarker.prototype._init=function(){if(mapEngine._currentMap==null){return}if(this._div==null){this._createDOMElement()}var a=mapEngine.convertToScreenCoords(this._point._x-mapEngine.getMinX(),mapEngine.getMaxY()-this._point._y,mapEngine._currentMap._units_per_pixel);this._left=Math.round(a.getLeft()-(this._icon.getWidth()/2));this._top=Math.round(a.getTop()-this._icon.getHeight());this._bounds=mapEngine.createBounds([this._point])};VMarker.prototype._show=function(){if(this._displayed){return}if(this._info_window!=null){if(this._info_window.isVisible()&&this._info_window.isAlwaysOpen()){this._info_window._show(this.getPoint())}}mapEngine._currentMap.getDOMElement().appendChild(this._div);this._displayed=true};VMarker.prototype._hide=function(){if(!this._displayed){return}try{mapEngine._currentMap.getDOMElement().removeChild(this._div)}catch(a){}if(this._info_window!=null&&this._info_window.isVisible()){this._info_window._hide()}this._displayed=false};VMarker.prototype.getPoint=function(){return(this._point)};VMarker.prototype._setPoint=function(a){if(a instanceof VGeoPoint){this._point=geoUtil.convertFromGeoProjection(a.getLongitude(),a.getLatitude())}else{if(a instanceof VPoint){this._point=a}}mapEngine._removeObject(this);this.init()};VMarker.prototype.setPoint=function(a){if(a instanceof VGeoPoint){this._point=geoUtil.convertFromGeoProjection(a.getLongitude(),a.getLatitude())}else{if(a instanceof VPoint){this._point=a}}this._hide();mapEngine._removeObject(this);this._bounds=mapEngine.createBounds(this._point);this.init()};VMarker.prototype.setHint=function(a){if(this._hint!=null){this._hint.hide()}this._hint=new VHintWindow(a)};VMarker.prototype.setIcon=function(a){this._icon=a;if(this._div==null){this._createDOMElement()}this._div.width=this._icon.getWidth();this._div.height=this._icon.getHeight();if(this._icon.isAlphaEnabled()){if(USER_DATA.Browser.MSIE){this._div.src=VISICOM_API_URL+"/images/blank.gif";this._div.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this._icon.getImageSource()+"')"}else{this._div.src=this._icon.getImageSource()}}else{this._div.src=this._icon.getImageSource()}};VMarker.prototype.addEventListener=function(b,a){switch(b){case"mousedown":this._mouse_event_listeners.push(new VEvent(b,a));break;case"mouseup":this._mouse_event_listeners.push(new VEvent(b,a));break;case"mousemove":this._mouse_event_listeners.push(new VEvent(b,a));break;case"mouseclick":this._mouse_event_listeners.push(new VEvent(b,a));break;case"mousedblclick":this._mouse_event_listeners.push(new VEvent(b,a));break;case"startdrag":this._event_listeners.push(new VEvent(b,a));break;case"dragging":this._event_listeners.push(new VEvent(b,a));break;case"enddrag":this._event_listeners.push(new VEvent(b,a));break}};VMarker.prototype.removeEventListener=function(b){for(var a=0;a<this._event_listeners.length;a++){var c=this._event_listeners[a];if(c._handler!=b){continue}this._event_listeners.splice(a,1);return}for(a=0;a<this._mouse_event_listeners.length;a++){c=this._mouse_event_listeners[a];if(c._handler!=b){continue}this._mouse_event_listeners.splice(a,1);return}};VMarker.prototype.fireDraggingEvent=function(d,a){for(var b=0;b<this._event_listeners.length;b++){var c=this._event_listeners[b];if(c._event_name!=d){continue}if(a==null){c._handler(this._point)}else{c._handler(a)}}};VMarker.prototype.fireMouseEvent=function(d,a){for(var b=0;b<this._mouse_event_listeners.length;b++){var c=this._mouse_event_listeners[b];if(c._event_name!=d){continue}if(a.getX()<this._min_x){a.setX(this._min_x)}if(a.getY()<this._min_y){a.setY(this._min_y)}if(a.getX()>this._max_x){a.setX(this._max_x)}if(a.getY()>this._max_y){a.setY(this._max_y)}c._handler(a)}};VInfoWindow.SMALL="small";VInfoWindow.MEDIUM="medium";VInfoWindow.LARGE="large";VInfoWindow.prototype._size=null;VInfoWindow.prototype._width=null;VInfoWindow.prototype._height=null;VInfoWindow.prototype._x=null;VInfoWindow.prototype._y=null;VInfoWindow.prototype._point=null;VInfoWindow.prototype._header="";VInfoWindow.prototype._html="";VInfoWindow.prototype._div=null;VInfoWindow.prototype._visible=false;VInfoWindow.prototype._displayed=false;VInfoWindow.prototype._always_open=false;VInfoWindow.prototype._scrool_on_open=true;VInfoWindow.prototype.isDisplayed=function(){return(this._displayed)};VInfoWindow.prototype.setDisplayed=function(a){this._displayed=a};VInfoWindow.prototype._event_listeners=null;VInfoWindow.prototype.setAlwaysOpen=function(a){this._always_open=a};VInfoWindow.prototype.isAlwaysOpen=function(){return(this._always_open)};VInfoWindow.prototype.setScrollOnOpen=function(a){this._scrool_on_open=a};function VInfoWindow(d,b,c,a){}function VInfoWindow(c,b,a){this._header=c;this._html=b;if(a!=null){this.setSize(a)}this._event_listeners=new Array()}VInfoWindow.prototype._createDOMElement=function(){if(this._div==null){if(this._width==null){this._width=290}if(this._height==null){this._height=141}this._div=document.createElement("div");this._div.id="info_window_";this._div.style.position="absolute";this._div.style.zIndex=ZINDEX_INFOWINDOW;this._div.style.cursor="default";this._div.style.border="0px";if(USER_DATA.Browser.MSIE){var c=this._div;var g=document.createElement("div");g.style.marginLeft="13px";g.style.padding="0px";g.style.height="15px";g.style.width=this._width+"px";g.style.position="relative";c.appendChild(g);var t=document.createElement("div");t.style.height="15px";t.style.width="15px";t.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+VISICOM_API_URL+"images/balloon/top_left.png')";t.style.styleFloat="left";g.appendChild(t);var u=document.createElement("div");u.style.height="15px";u.style.width=(this._width-45)+"px";u.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+VISICOM_API_URL+"images/balloon/top.png', sizingMethod='scale')";u.style.styleFloat="left";g.appendChild(u);var p=document.createElement("div");p.style.height="15px";p.style.width="30px";p.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+VISICOM_API_URL+"images/balloon/top_right.png')";p.style.styleFloat="left";g.appendChild(p);var k=document.createElement("div");k.style.marginTop="-7px";k.style.padding="0px";k.style.clear="both";k.style.fontSize="1px";c.appendChild(k);var f=document.createElement("div");f.style.margin="0px";f.style.padding="0px";f.style.position="relative";f.style.width="303px";c.appendChild(f);var w=document.createElement("div");w.style.height="12px";w.style.width="12px";w.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+VISICOM_API_URL+"images/button_close.png')";w.style.position="absolute";w.style.left=(this._width-20)+"px";w.style.top="6px";w.style.zIndex=ZINDEX_INFOWINDOW;w.style.cursor="pointer";this._div.appendChild(w);var r=this;w.onmouseover=function(){this.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+VISICOM_API_URL+"images/button_close_hover.png')"};w.onmouseout=function(){this.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+VISICOM_API_URL+"images/button_close.png')"};w.onclick=function(){r.hide();this.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+VISICOM_API_URL+"images/button_close.png')"};var l=document.createElement("div");l.style.height="61px";l.style.width="13px";l.style.position="absolute";l.style.left="1px";l.style.top="1px";l.style.zIndex=ZINDEX_INFOWINDOW;l.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+VISICOM_API_URL+"images/balloon/arrow.png', sizingMethod='scale')";f.appendChild(l);var b=document.createElement("div");b.style.height=this._height+"px";b.style.width=this._width+"px";b.style.marginLeft="13px";b.style.padding="0px";f.style.zIndex=ZINDEX_INFOWINDOW;var j=Math.random();b.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+VISICOM_API_URL+"bgimage?x="+(BG_IE_WIDTH-this._width)+"&y=0&w="+this._width+"&h="+this._height+"&t="+j+"', sizingMethod='scale')";f.appendChild(b);var m=document.createElement("div");m.innerHTML=this._header;m.style.height="20px";m.style.width=(this._width-45)+"px";m.style.marginLeft="15px";m.style.padding="0px";m.style.backgroundColor="#ffffff";m.style.color="#4a6384";m.style.font="bold 12px Arial, Helvetica, sans-serif";b.appendChild(m);var i=document.createElement("div");i.style.height=(this._height-21)+"px";i.style.width=(this._width-45)+"px";i.style.marginLeft="15px";i.style.padding="0px";i.style.backgroundColor="#ffffff";i.style.font="11px Arial, Helvetica, sans-serif";b.appendChild(i);var n=document.createElement("div");n.innerHTML=this._html;n.style.height="100%";n.style.width="100%";n.style.margin="0px";n.style.padding="0px";n.style.position="relative";n.style.overflow="auto";i.appendChild(n);var s=document.createElement("div");s.style.margin="0px";s.style.padding="0px";s.style.clear="both";s.style.fontSize="1px";c.appendChild(s);var o=document.createElement("div");o.style.marginLeft="13px";o.style.padding="0px";o.style.height="30px";o.style.width=this._width+"290px";c.appendChild(o);var d=document.createElement("div");d.style.height="30px";d.style.width="15px";d.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+VISICOM_API_URL+"images/balloon/bottom_left.png', sizingMethod='scale')";d.style.styleFloat="left";o.appendChild(d);var a=document.createElement("div");a.style.height="30px";a.style.width=(this._width-45)+"px";a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+VISICOM_API_URL+"images/balloon/bottom.png', sizingMethod='scale')";a.style.styleFloat="left";o.appendChild(a);var e=document.createElement("div");e.style.height="30px";e.style.width="30px";e.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+VISICOM_API_URL+"images/balloon/bottom_right.png', sizingMethod='scale')";e.style.styleFloat="left";o.appendChild(e)}else{c=this._div;g=document.createElement("div");g.style.margin="0px";g.style.padding="0px";g.style.height="15px";g.style.width=this._width+"px";g.style.position="relative";c.appendChild(g);t=document.createElement("div");t.style.height="15px";t.style.width="15px";t.style.backgroundImage="url("+VISICOM_API_URL+"images/balloon/top_left.png)";t.style.backgroundPosition="0px 0px";t.style.backgroundRepeat="no-repeat";t.style.cssFloat="left";g.appendChild(t);u=document.createElement("div");u.style.backgroundImage="url("+VISICOM_API_URL+"images/balloon/top.png)";u.style.backgroundPosition="0px 0px";u.style.backgroundRepeat="repeat-x";u.style.height="15px";u.style.width=(this._width-45)+"px";u.style.cssFloat="left";g.appendChild(u);p=document.createElement("div");p.style.height="15px";p.style.width="30px";p.style.backgroundImage="url("+VISICOM_API_URL+"images/balloon/top_right.png)";p.style.backgroundPosition="0px 0px";p.style.backgroundRepeat="no-repeat";p.style.cssFloat="left";g.appendChild(p);var w=document.createElement("div");w.style.height="12px";w.style.width="12px";w.style.backgroundPosition="0px 0px";w.style.backgroundRepeat="no-repeat";w.style.position="absolute";w.style.left=(this._width-34)+"px";w.style.top="6px";w.style.zIndex=ZINDEX_INFOWINDOW;w.style.cursor="pointer";this._div.appendChild(w);var v=document.createElement("img");v.src=VISICOM_API_URL+"images/button_close.png";w.appendChild(v);var r=this;w.onmouseover=function(){v.src=VISICOM_API_URL+"images/button_close_hover.png"};w.onmouseout=function(){v.src=VISICOM_API_URL+"images/button_close.png"};w.onclick=function(){v.src=VISICOM_API_URL+"images/button_close.png";r.hide()};k=document.createElement("div");k.style.margin="0px";k.style.padding="0px";k.style.clear="both";k.style.fontSize="1px";c.appendChild(k);f=document.createElement("div");f.style.margin="0px";f.style.padding="0px";f.style.position="relative";f.style.width=this._width+"px";c.appendChild(f);var h=document.createElement("div");h.style.height="auto";h.style.width=this._width+"px";h.style.backgroundImage="url("+VISICOM_API_URL+"images/balloon/left.png)";h.style.backgroundPosition="0px 0px";h.style.backgroundRepeat="repeat-y";h.style.position="relative";f.appendChild(h);var q=document.createElement("div");q.style.height="auto";q.style.width=this._width+"px";q.style.backgroundImage="url("+VISICOM_API_URL+"images/balloon/right.png)";q.style.backgroundPosition="100% 0px";q.style.backgroundRepeat="repeat-y";q.style.position="relative";h.appendChild(q);l=document.createElement("div");l.style.height="61px";l.style.width="13px";l.style.position="absolute";l.style.left="-12px";l.style.top="1px";l.style.backgroundImage="url("+VISICOM_API_URL+"images/balloon/arrow.png)";l.style.backgroundPosition="0px 0px";l.style.backgroundRepeat="no-repeat";q.appendChild(l);m=document.createElement("div");m.innerHTML=this._header;m.style.height="20px";m.style.width=(this._width-45)+"px";m.style.marginLeft="15px";m.style.padding="0px";m.style.backgroundColor="#ffffff";m.style.color="#4a6384";m.style.font="bold 12px Arial, Helvetica, sans-serif";q.appendChild(m);i=document.createElement("div");i.style.height=(this._height-15)+"px";i.style.width=(this._width-45)+"px";i.style.marginLeft="15px";i.style.padding="0px";i.style.backgroundColor="#ffffff";i.style.font="11px Arial, Helvetica, sans-serif";q.appendChild(i);n=document.createElement("div");n.innerHTML=this._html;n.style.height="100%";n.style.width="100%";n.style.margin="0px";n.style.padding="0px";n.style.position="relative";n.style.overflow="auto";i.appendChild(n);k=document.createElement("div");k.style.margin="0px";k.style.padding="0px";k.style.clear="both";k.style.fontSize="1px";c.appendChild(k);o=document.createElement("div");o.style.margin="0px";o.style.padding="0px";o.style.height="30px";o.style.width=this._width+"px";c.appendChild(o);d=document.createElement("div");d.style.height="30px";d.style.width="15px";d.style.backgroundImage="url("+VISICOM_API_URL+"images/balloon/bottom_left.png)";d.style.backgroundPosition="0px 100%";d.style.backgroundRepeat="no-repeat";d.style.cssFloat="left";o.appendChild(d);a=document.createElement("div");a.style.backgroundImage="url("+VISICOM_API_URL+"images/balloon/bottom.png)";a.style.backgroundPosition="0px 100%";a.style.backgroundRepeat="repeat-x";a.style.height="30px";a.style.width=(this._width-45)+"px";a.style.cssFloat="left";o.appendChild(a);e=document.createElement("div");e.style.height="30px";e.style.width="30px";e.style.backgroundImage="url("+VISICOM_API_URL+"images/balloon/bottom_right.png)";e.style.backgroundPosition="0px 100%";e.style.backgroundRepeat="no-repeat";e.style.cssFloat="left";o.appendChild(e)}this._div.onmouseover=function(x){if(!x){x=window.event}mapEngine.mouse_over_flag=false;if(x.stopPropagation){x.stopPropagation()}else{x.cancelBubble=true}if(x.preventDefault){x.preventDefault()}else{x.returnValue=false}};this._div.onmouseout=function(x){mapEngine.mouse_over_flag=true};this._div.onmouseup=function(x){if(!x){x=window.event}mapEngine.mouse_over_flag=false;if(x.stopPropagation){x.stopPropagation()}else{x.cancelBubble=true}if(x.preventDefault){x.preventDefault()}else{x.returnValue=false}}}};VInfoWindow.prototype._init=function(){};VInfoWindow.prototype._show=function(a){if(this._displayed){return}if(this._div==null){this._createDOMElement()}this._point=a;this.repaint();mapEngine._viewport.appendChild(this._div);if(mapEngine._current_info_window!=this){mapEngine.closeCurrentInfoWindow();mapEngine.setCurrentInfoWindow(this)}this._displayed=true;if(this._scrool_on_open){var b=new VPoint(a.getX()+Math.round(this._width/2)*mapEngine._currentMap._units_per_pixel,a.getY()-Math.round(this._height/2)*mapEngine._currentMap._units_per_pixel);mapEngine.panTo(b)}};VInfoWindow.prototype.show=function(a){};VInfoWindow.prototype.show=function(a){if(this._visible){return}if(a instanceof VPoint){this._show(a)}else{if(a instanceof VMarker){this._show(a.getPoint())}else{if(a instanceof VGeoPoint){this._show(a.convertToLocalPoint())}}}this._visible=true;this.fireEvent("open")};VInfoWindow.prototype.repaint=function(){if(this._div==null){return}var a=mapEngine.convertToScreenCoords(this._point.getX()-mapEngine.getMinX(),mapEngine.getMaxY()-this._point.getY(),mapEngine._currentMap._units_per_pixel);var b=a.getLeft()+mapEngine._currentMap._left;if(!USER_DATA.Browser.MSIE){b+=13}var c=a.getTop()+mapEngine._currentMap._top;if(!USER_DATA.Browser.MSIE){c-=46}else{c-=40}this._div.style.left=b+"px";this._div.style.top=c+"px"};VInfoWindow.prototype._hide=function(){if(!this._displayed){return}try{mapEngine._viewport.removeChild(this._div)}catch(a){}this._displayed=false};VInfoWindow.prototype.hide=function(){if(!this._visible){return}this.fireEvent("close");this._hide();this._div=null;this._visible=false};VInfoWindow.prototype.isVisible=function(){return(this._visible)};VInfoWindow.prototype.setSize=function(a){};VInfoWindow.prototype.setSize=function(b,a){if(a==null){switch(b){case VInfoWindow.SMALL:this._width=190;this._height=55;break;case VInfoWindow.MEDIUM:this._width=290;this._height=141;break;case VInfoWindow.LARGE:this._width=490;this._height=302;break}return}this._width=b;this._height=a;if(this._width>800){this._width=800}if(this._height>600){this._height=600}};VInfoWindow.prototype.addEventListener=function(b,a){switch(b){case"open":this._event_listeners.push(new VEvent(b,a));break;case"close":this._event_listeners.push(new VEvent(b,a));break}};VInfoWindow.prototype.removeEventListener=function(c){for(var b=0;b<this._event_listeners.length;b++){var a=this._event_listeners[b];if(a!=c){continue}this._event_listeners.splice(b,1);return}};VInfoWindow.prototype.fireEvent=function(c){for(var a=0;a<this._event_listeners.length;a++){var b=this._event_listeners[a];if(b._event_name!=c){continue}b._handler(this)}};VHintWindow.prototype._x_offset;VHintWindow.prototype._y_offset;function VHintWindow(a){this._header=a;this._x_offset=0;this._y_offset=0;return(this)}VHintWindow.prototype=new VInfoWindow();VHintWindow.prototype._createDOMElement=function(){if(this._div==null){this._div=document.createElement("div");this._div.id="info_window_";this._div.style.position="absolute";this._div.style.zIndex="0";this._div.style.cursor="default";this._div.style.font="normal 12px Tahoma";this._div.style.color="#4a6384";this._div.style.padding="3px";this._div.style.border="1px solid gray";this._div.style.backgroundColor="white";this._div.innerHTML=this._header}};VHintWindow.prototype._show=function(a){if(this._div==null){this._createDOMElement()}this._point=a;mapEngine._viewport.appendChild(this._div);this.repaint();this._displayed=true};VHintWindow.prototype.repaint=function(){var b=mapEngine.convertToScreenCoords(this._point.getX()-mapEngine.getMinX(),mapEngine.getMaxY()-this._point.getY(),mapEngine._currentMap._units_per_pixel);var d=getBounds(this._div);var a=d.height;var c=b.getLeft()+mapEngine._currentMap._left+this._x_offset;var e=b.getTop()+mapEngine._currentMap._top-a+this._y_offset;this._div.style.left=c+"px";this._div.style.top=e+"px";this._div.style.zIndex=ZINDEX_INFOWINDOW};VHintWindow.prototype.setOffset=function(a,b){this._x_offset=a;this._y_offset=b};VLayer.prototype._markers;VLayer.prototype._routes;VLayer.prototype._polylines;VLayer.prototype._polygones;VLayer.prototype._objects;VLayer.prototype._visible=true;VLayer.prototype.getMarkers=function(){return(this._markers)};VLayer.prototype.getRoutes=function(){return(this._routes)};VLayer.prototype.getPolylines=function(){return(this._polylines)};VLayer.prototype.getPolygones=function(){return(this._polygones)};VLayer.prototype.isVisible=function(){return(this._visible)};function VLayer(){this._markers=new Array();this._routes=new Array();this._polylines=new Array();this._polygones=new Array();this._objects=new Array()}VLayer.prototype.init=function(){for(var f=0;f<this._markers.length;f++){var a=this._markers[f];a.init()}for(f=0;f<this._polylines.length;f++){var c=this._polylines[f];c.init()}for(f=0;f<this._polygones.length;f++){var e=this._polygones[f];e.init()}for(f=0;f<this._routes.length;f++){var b=this._routes[f];b._init()}for(f=0;f<this._objects.length;f++){var d=this._objects[f];d._init()}};VLayer.prototype.addMarker=function(a){this._markers.push(a);if(!this.isVisible()){return}a._init();mapEngine._addObject(a)};VLayer.prototype.removeMarker=function(a){for(var b=0;b<this._markers.length;b++){if(this._markers[b]!=a){continue}a._remove();this._markers.splice(b,1);break}};VLayer.prototype.addRoute=function(a){this._routes.push(a);if(!this.isVisible()){return}a._init();mapEngine.repaintMap()};VLayer.prototype.removeRoute=function(a){for(var b=0;b<this._routes.length;b++){if(this._routes[b]!=a){continue}a._remove();this._routes.splice(b,1);break}};VLayer.prototype.addPolyline=function(a){this._polylines.push(a);if(!this.isVisible()){return}a._init();mapEngine._addObject(a);mapEngine.repaintMap()};VLayer.prototype.removePolyline=function(a){for(var b=0;b<this._polylines.length;b++){if(this._polylines[b]!=a){continue}a._remove();this._polylines.splice(b,1);break}};VLayer.prototype.addPolygone=function(a){this._polygones.push(a);if(!this.isVisible()){return}a._init();mapEngine._addObject(a);mapEngine.repaintMap()};VLayer.prototype.removePolygone=function(b){for(var a=0;a<this._polygones.length;a++){if(this._polygones[a]!=b){continue}b._remove();this._polygones.splice(a,1);break}};VLayer.prototype.addGeo=function(a){switch(a.type){case VGeoObject.POINT:var k=a.options[0];for(var d=0;d<a.points.length;d++){var h=a.points[d];if(k.image_url!=undefined){var f=new VMarkerIcon(k.image_width,k.image_height,k.image_url,true);var e=new VMarker(new VGeoPoint(h.lng,h.lat),f)}else{e=new VMarker(new VGeoPoint(h.lng,h.lat))}if(h.name!=undefined){var c=new VInfoWindow("Waypoint",h.name);e.bindInfoWindow(c)}e.setHint(h.lng+", "+h.lat);this.addMarker(e)}break;case VGeoObject.POLYLINE:var j=new Array();var b=0;for(var d=0;d<a.points.length;d++){var h=a.points[d];j.push(new VGeoPoint(h.lng,h.lat));if(b>700){var g=new VPolyline(j);g.setLineWidth(4);g.setColor("#FF0000");this.addPolyline(g);j=new Array();j.push(new VGeoPoint(h.lng,h.lat));b=0}b++}g=new VPolyline(j);g.setLineWidth(4);g.setColor("#FF0000");this.addPolyline(g);mapEngine.repaintMap();break;case VGeoObject.POLYGONE:break}};VLayer.prototype._addObject=function(a){this._objects.push(a);if(!this.isVisible()){return}a._init()};VLayer.prototype._removeObject=function(a){for(var b=0;b<this._polygones.length;b++){if(this._objects[b]!=a){continue}a._remove();this._polygones.splice(b,1);break}};VLayer.prototype._removeAllObjects=function(){for(var e=0;e<this._markers.length;e++){var a=this._markers[e];a._remove()}for(e=0;e<this._routes.length;e++){var c=this._routes[e];c._remove()}for(e=0;e<this._polylines.length;e++){var b=this._polylines[e];b._remove()}for(e=0;e<this._polygones.length;e++){var d=this._polygones[e];d._remove()}this._visible=false};VLayer.prototype.show=function(){for(var e=0;e<this._markers.length;e++){var a=this._markers[e];a.show()}for(e=0;e<this._routes.length;e++){var c=this._routes[e];c.show()}for(e=0;e<this._polylines.length;e++){var b=this._polylines[e];b.show()}for(e=0;e<this._polygones.length;e++){var d=this._polygones[e];d.show()}this._visible=true;mapEngine.repaintMap()};VLayer.prototype.hide=function(){for(var e=0;e<this._markers.length;e++){var a=this._markers[e];a.hide()}for(e=0;e<this._routes.length;e++){var c=this._routes[e];c.hide()}for(e=0;e<this._polylines.length;e++){var b=this._polylines[e];b.hide()}for(e=0;e<this._polygones.length;e++){var d=this._polygones[e];d.hide()}this._visible=false;mapEngine.repaintMap()};VLayer.prototype._hide=function(){for(var e=0;e<this._markers.length;e++){var a=this._markers[e];a._hide()}for(e=0;e<this._polylines.length;e++){var c=this._polylines[e];c._hide(true)}for(e=0;e<this._polygones.length;e++){var d=this._polygones[e];d._hide()}for(e=0;e<this._routes.length;e++){var b=this._routes[e];b._hide()}};VScreenPoint.prototype._left=null;VScreenPoint.prototype._top=null;VScreenPoint.prototype.getLeft=function(){return(this._left)};VScreenPoint.prototype.getTop=function(){return(this._top)};VScreenPoint.prototype.setLeft=function(a){this._left=a};VScreenPoint.prototype.setTop=function(a){this._top=a};function VScreenPoint(b,a){this._left=b;this._top=a;return(this)}VPolyline.prototype=new VMapObject();VPolyline.prototype._color;VPolyline.prototype._lineWidth;VPolyline.prototype._opacity;VPolyline.prototype.setColor=function(a){this._color=a};VPolyline.prototype.setLineWidth=function(a){this._lineWidth=a};VPolyline.prototype.setOpacity=function(a){this._opacity=a};VPolyline.prototype._points=null;VPolyline.prototype._screen_points=null;VPolyline.prototype._childs=null;function VPolyline(a){this._childs=new Array();this._visible=true;this._color=null;this._lineWidth=3;if(a==null){return(this)}if(a.length==0){return(this)}this._setPoints(a);return(this)}VPolyline.prototype._init=function(){if(mapEngine._currentMap==null){return}var j=this;this._childs.forEach(function(i){i._remove()});this._childs=new Array();var p=3500;var h=3500;var k=function(q){var i=new Array();q.forEach(function(r){var s=mapEngine.convertToScreenCoords(r._x-mapEngine.getMinX(),mapEngine.getMaxY()-r._y,mapEngine._currentMap._units_per_pixel);i.push(new VScreenPoint(s.getLeft()-a.getLeft()+j._lineWidth,j._height-(a.getTop()-s.getTop())+j._lineWidth))});return(i)};var g=function(t){var u=mapEngine.createBounds(t);var s=mapEngine.convertToScreenCoords(u.getMinPoint().getX()-mapEngine.getMinX(),mapEngine.getMaxY()-u.getMinPoint().getY(),mapEngine._currentMap._units_per_pixel);var q=mapEngine.convertToScreenCoords(u.getMaxPoint().getX()-mapEngine.getMinX(),mapEngine.getMaxY()-u.getMaxPoint().getY(),mapEngine._currentMap._units_per_pixel);var r=(q.getLeft()-s.getLeft());var i=(s.getTop()-q.getTop());return(!(r>p||i>h))};var o=function(x){var t=x[0];var s=x[1];var z=(s.getX()-t.getX())/1000000;var y=(s.getY()-t.getY())/1000000;var w=Math.sqrt(Math.pow(z,2)+Math.pow(y,2));var r=z/w;var u=y/w;var q=new Array();var i=mapEngine._currentMap._units_per_pixel;var v=new VPoint(t.getX()+((p-20)*i)*r,t.getY()+((h-20)*i)*u);q.push(t);q.push(v);q.push(s);return(q)};var d=new Array();var c=0;b=g(this._points);if(this._points!=null){if(!b){for(var f=0;f<this._points.length;f++){var n=this._points[f];d.push(n);var b=false;while(!b){b=g(d);if(!b){if(d.length==2){d=o(d);var m=d[1];d.splice(2,1);var l=new VPolyline(d);l.setOpacity(this._opacity);l.setLineWidth(this._lineWidth);l.setColor(this._color);l.init();j._childs.push(l);d=new Array();d.push(m);d.push(n);c=2}else{d.splice(c,1);m=d[c-1];l=new VPolyline(d);l.setOpacity(this._opacity);l.setLineWidth(this._lineWidth);l.setColor(this._color);l.init();j._childs.push(l);d=new Array();d.push(m);d.push(n);c=2}}}c++}}else{d=this._points}}this._bounds=mapEngine.createBounds(d);var a=mapEngine.convertToScreenCoords(this._bounds.getMinPoint().getX()-mapEngine.getMinX(),mapEngine.getMaxY()-this._bounds.getMinPoint().getY(),mapEngine._currentMap._units_per_pixel);var e=mapEngine.convertToScreenCoords(this._bounds.getMaxPoint().getX()-mapEngine.getMinX(),mapEngine.getMaxY()-this._bounds.getMaxPoint().getY(),mapEngine._currentMap._units_per_pixel);this._left=a.getLeft()-this._lineWidth;this._top=a.getTop()-this._lineWidth;this._width=Math.abs(e.getLeft()-a.getLeft());this._height=a.getTop()-e.getTop();this._screen_points=k(d);this._top-=this._height;this._width+=this._lineWidth*2;this._height+=this._lineWidth*2;this._displayed=false};VPolyline.prototype._setPoints=function(c){if(c==null){return}if(c.length==0){return}this._points=c;if(this._points[0] instanceof VGeoPoint){for(var b=0;b<this._points.length;b++){var a=this._points[b];this._points[b]=geoUtil.convertFromGeoProjection(a.getLongitude(),a.getLatitude())}}};VPolyline.prototype.setPoints=function(a){this._setPoints(a);this._hide(true);mapEngine._removeObject(this);this.init()};VPolyline.prototype.getPoints=function(){return(this._points)};VPolyline.prototype.addPoint=function(a){if(a instanceof VGeoPoint){a=a.convertToLocalPoint()}this._points.push(a);this.setPoints(this._points)};VPolyline.prototype._show=function(){if(this._displayed){return}if(this._screen_points==null){return}if(this._screen_points.length==0){return}if(USER_DATA.Browser.MSIE){this._div=document.createElement("div");this._div.id="polyline_"+mapEngine.getZoomIndex()+"_"+this._left+"_"+this._top;this._div.style.position="absolute";this._div.style.width=Math.round(this._width);this._div.style.height=Math.round(this._height);this._div.style.zIndex=ZINDEX_POLYLINE;this._div.style.border="none";var a=document.createElement("v:polyline");a.style.position="absolute";a.style.antialias="true";var g=document.createElement("v:stroke");if(this._opacity!=null){g.setAttribute("opacity",this._opacity)}g.setAttribute("joinstyle","round");g.setAttribute("filltype","solid");a.appendChild(g);a.setAttribute("strokecolor",((this._color==null)?"#0000C8":this._color));a.setAttribute("strokeweight",this._lineWidth+"px");a.setAttribute("filled","false");var d="";for(var c=0;c<this._screen_points.length;c++){var f=this._screen_points[c];d+=f.getLeft()+","+f.getTop()+" "}a.setAttribute("points",d);a.setAttribute("opacity",this._opacity);this._div.appendChild(a)}else{this._div=document.createElement("canvas");this._div.id="polyline_"+mapEngine.getZoomIndex()+"_"+this._left+"_"+this._top;this._div.style.position="absolute";this._div.width=Math.round(this._width);this._div.height=Math.round(this._height);this._div.style.zIndex=ZINDEX_POLYLINE;this._div.style.border="0px dashed black";var b;try{b=this._div.getContext("2d")}catch(e){return}b.lineWidth=this._lineWidth;b.lineCap="round";b.lineJoin="round";b.strokeStyle=(this._color==null)?"rgb(0, 0, 200)":this._color;if(this._opacity!=null){b.globalAlpha=this._opacity}b.beginPath();for(c=0;c<this._screen_points.length;c++){f=this._screen_points[c];if(c==0){b.moveTo(f.getLeft(),f.getTop())}else{b.lineTo(f.getLeft(),f.getTop())}}b.stroke()}mapEngine._currentMap.getDOMElement().appendChild(this._div);this._displayed=true};VPolyline.prototype.show=function(){this._visible=true;this._childs.forEach(function(a){a.show()})};VPolyline.prototype._hide=function(b){if(b){this._childs.forEach(function(c){c._remove()})}if(!this._displayed){return}try{mapEngine._currentMap.getDOMElement().removeChild(this._div)}catch(a){}delete (this._div);this._displayed=false};VPolyline.prototype._remove=function(){this._childs.forEach(function(a){a._remove()});if(this._displayed){this._hide()}if(this._visible){this.hide()}mapEngine._removeObject(this)};VPolyline.prototype.hide=function(){this._visible=false;this._childs.forEach(function(a){a.hide()})};VPolygone.prototype=new VPolyline();function VPolygone(a){this._opacity=0.35;this._color="#0000AF";this._setPoints(a);return(this)}VPolygone.prototype._show=function(){if(this._displayed){return}if(this._screen_points==null){return}if(this._screen_points.length==0){return}if(this._opacity==null){this._opacity=0.25}if(USER_DATA.Browser.MSIE){this._div=document.createElement("div");this._div.id="polygone_"+mapEngine.getZoomIndex()+"_"+this._left+"_"+this._top;this._div.style.position="absolute";this._div.style.width=Math.round(this._width);this._div.style.height=Math.round(this._height);this._div.style.zIndex="102";var e=document.createElement("v:shape");e.setAttribute("fillcolor",this._color);e.setAttribute("coordorigin","0 0");e.setAttribute("coordsize",Math.round(this._width)+" "+Math.round(this._height));e.style.left="0px";e.style.top="0px";e.style.width=Math.round(this._width)+"px";e.style.height=Math.round(this._height)+"px";e.style.position="absolute";var g=document.createElement("v:fill");g.opacity=this._opacity;e.appendChild(g);var h=document.createElement("v:stroke");h.fillstyle=this._color;h.opacity=this._opacity;h.joinstyle="miter";e.appendChild(h);var k=document.createElement("v:path");e.appendChild(k);var f=this._screen_points[0];var a="m "+Math.round(f.getLeft())+","+Math.round(f.getTop())+" l ";for(var d=1;d<this._screen_points.length;d++){if(d!=1){a+=", "}var j=this._screen_points[d];a+=Math.round(j.getLeft())+","+Math.round(j.getTop())}a+=" x e";k.setAttribute("v",a);this._div.appendChild(e)}else{this._div=document.createElement("canvas");this._div.id="polygone_"+mapEngine.getZoomIndex()+"_"+this._left+"_"+this._top;this._div.style.position="absolute";this._div.width=Math.round(this._width);this._div.height=Math.round(this._height);this._div.style.zIndex="102";var b;try{b=this._div.getContext("2d")}catch(c){return}b.lineWidth=this._lineWidth;b.lineCap="round";b.lineJoin="round";b.fillStyle=(this._color==null)?"rgb(0, 0, 200)":this._color;b.globalAlpha=this._opacity;b.beginPath();for(d=0;d<this._screen_points.length;d++){var j=this._screen_points[d];if(d==0){b.moveTo(j.getLeft(),j.getTop())}else{b.lineTo(j.getLeft(),j.getTop())}}b.fill()}mapEngine._currentMap.getDOMElement().appendChild(this._div);this._displayed=true};VRoute.prototype._div;VRoute.prototype._left;VRoute.prototype._top;VRoute.prototype._width;VRoute.prototype._height;VRoute.prototype._visible=true;VRoute.prototype.isVisible=function(){return(this._visible)};VRoute.prototype._displayed=true;VRoute.prototype.isDisplayed=function(){return(this._displayed)};VRoute.prototype._edges;VRoute.prototype._distance=null;VRoute.prototype.setDistance=function(a){this._distance=a};VRoute.prototype.getDistance=function(){return(this._distance)};function VRoute(a){if(a!=null){this._edges=a}else{this._edges=new Array()}return(this)}VRoute.prototype.getEdges=function(){return(this._edges)};VRoute.prototype.addEdge=function(a){this._edges.push(a)};VRoute.prototype._init=function(){var a=null;var e=null;var b=null;var g=null;for(var d=0;d<this._edges.length;d++){var f=this._edges[d];f._init();var c=f.getPolyline();a=((a==null)||(c.getLeft()<a))?c.getLeft():a;e=((e==null)||(c.getTop()<e))?c.getTop():e;b=((b==null)||(c.getLeft()>b))?c.getLeft():b;g=((g==null)||(c.getTop()>g))?c.getTop():g}};VRoute.prototype._createDOMElement=function(){if(this._div==null){this._div=document.createElement("div");this._div.id="route";this._div.style.position="absolute";this._div.style.width=this._width;this._div.style.height=this._height;this._div.style.zIndex="103";this._div.style.border="1px dashed black"}};VRoute.prototype.getDOMElement=function(){return(this._div)};VRoute.prototype.show=function(){if(this._visible){return}for(var a=0;a<this._edges.length;a++){var b=this._edges[a];b.show(this.getDOMElement())}this._visible=true;mapEngine.repaintMap()};VRoute.prototype.repaint=function(){this._div.style.left=Math.round(mapEngine._currentMap.getLeft()+this._left+TILE_WIDTH)+"px";this._div.style.top=Math.round(mapEngine._currentMap.getTop()+this._top+TILE_WIDTH)+"px";for(var a=0;a<this._edges.length;a++){var b=this._edges[a];b.repaint()}};VRoute.prototype._hide=function(){for(var a=0;a<this._edges.length;a++){var b=this._edges[a];b._hide()}};VRoute.prototype.hide=function(){if(!this._visible){return}for(var a=0;a<this._edges.length;a++){var b=this._edges[a];b.hide()}this._visible=false};VRoute.prototype._remove=function(){for(var a=0;a<this._edges.length;a++){var b=this._edges[a];b._remove()}this._visible=false};function VEdge(a){if(a!=null){this._points=a}else{this._points=new Array()}return(this)}VEdge.prototype._polyline=null;VEdge.prototype._points=null;VEdge.prototype._distance=null;VEdge.prototype._name=null;VEdge.prototype.setDistance=function(a){this._distance=a};VEdge.prototype.getDistance=function(){return(this._distance)};VEdge.prototype.setName=function(a){this._name=a};VEdge.prototype.getName=function(){return(this._name)};VEdge.prototype.getPoints=function(){return(this._points)};VEdge.prototype.getPolyline=function(){return(this._polyline)};VEdge.prototype._init=function(){if(this._polyline==null){this._polyline=new VPolyline(this._points)}this._polyline.setColor("#0000AF");this._polyline.setLineWidth(3);this._polyline.init()};VEdge.prototype._createDOMElement=function(){if(this._div==null){this._div=document.createElement("div");this._div.id="route";this._div.style.position="absolute";this._div.style.width=this._width;this._div.style.height=this._height;this._div.style.zIndex="103";this._div.style.border="1px dashed black"}};VEdge.prototype.getDOMElement=function(){return(this._div)};VEdge.prototype.show=function(){if(this._polyline==null){return}this._polyline.show()};VEdge.prototype.repaint=function(){if(this._polyline==null){return}this._polyline.repaint()};VEdge.prototype._hide=function(){if(this._polyline==null){return}this._polyline._hide(true)};VEdge.prototype.hide=function(){if(this._polyline==null){return}this._polyline.hide()};VEdge.prototype._remove=function(){if(this._polyline==null){return}this._polyline._remove()};function VTrack(){this._polylines=new Array();this._current_points=new Array();return(this)}VTrack.prototype._polylines;VTrack.prototype._current_points;VTrack.prototype.addPoint=function(a){var d;function b(){if(d==null){d=new VEdge()}if(e==null){var e=d.getPoints()}if(e.length>10){this._edge=new VEdge();this._route.addEdge(this._edge);e=this._edge.getPoints()}return(d.getPoints())}var c=b();c.push(a);d.init()};VRemoteRequest.prototype._script;VRemoteRequest.prototype._callback;function VRemoteRequest(){}var _VISICOM_remoteRequestMap=new Object();VRemoteRequest.prototype.request=function(a,c){this._callback=c;var b="remote_"+Math.random();_VISICOM_remoteRequestMap[b]=this;this._script=document.createElement("script");this._script.id=b;this._script.type="text/javascript";this._script.src=a+"&id="+b+"&mapname="+mapEngine._getMapName();document.body.appendChild(this._script)};function _VISICOM_remoteRequestCallback(c,b){var a=_VISICOM_remoteRequestMap[c];if(a==null){return}if(a._callback!=null){a._callback(b)}if(a._script!=null){document.body.removeChild(a._script);delete (a._script)}_VISICOM_remoteRequestMap[c]=null}VGeoService.prototype._request;function VGeoService(){this._request=new VRemoteRequest()}VGeoService.prototype.geocode=function(a,b){this._request.request(VISICOM_API_URL+"geocoder/"+a+"/json/",function(c){b(c)})};VGeoService.prototype.importDataFromURL=function(a,b){this._request.request(VISICOM_API_URL+"GeoDataParser?direct=1&url="+a,function(c){b(c)})};VRouteService.prototype._request;function VRouteService(){this._request=new VRemoteRequest()}VRouteService.prototype.calculateRoute=function(b,a,c){};VRouteService.prototype.calculateRoute=function(b,a,e){if(b instanceof VGeoPoint){var d=geoUtil.convertFromGeoProjection(b.getLongitude(),b.getLatitude());b=new VPoint(d.getX(),d.getY())}if(a instanceof VGeoPoint){d=geoUtil.convertFromGeoProjection(a.getLongitude(),a.getLatitude());a=new VPoint(d.getX(),d.getY())}var c=false;if(Math.abs(a.getX()-b.getX())<=2380000){c=true}if(Math.abs(a.getY()-b.getY())<=1927000){c=true}this._request.request(VISICOM_API_URL+"RemoteRoute?startX="+b.getX()+"&startY="+b.getY()+"&finishX="+a.getX()+"&finishY="+a.getY()+"&detail="+c,function(k){var p=new VRoute();var n=null;var m=k;if(m!=null){p.setDistance(m.distance);for(var l=0;l<m.edges.length;l++){var q=m.edges[l];var g=new Array();if(n!=null){g.push(n)}for(var h=0;h<q.route.length;h++){var o=q.route[h];var r=new VPoint(o.x,o.y);g.push(r);if(h<=q.route.length-1){n=r}}var f=new VEdge(g);f.setDistance(q.distance);f.setName(q.name);p.addEdge(f)}}e(p)})};if(!Array.prototype.push){Array.prototype.push=function(a){return this[this.length]=a}}if(!Array.prototype.forEach){Array.prototype.forEach=function(c,b){b=b||this;for(var a=0;a<this.length;a++){c.call(b,this[a],a,this)}}}if(!Array.indexOf){Array.prototype.indexOf=function(b){for(var a=0;a<this.length;a++){if(this[a]==b){return(a)}}return(-1)}}var mapEngine;var zoomControl;var debugWindow;var infoWindow;var VIEWPORT_LEFT=null;var VIEWPORT_TOP=null;var VIEWPORT_WIDTH=null;var VIEWPORT_HEIGHT=null;var PROJECTION_FACTOR=0.666485;var mouse_down_flag=false;VMapEngine.prototype.mouse_over_flag=false;VMapEngine.prototype._viewport;VMapEngine.prototype._min_x;VMapEngine.prototype._max_x;VMapEngine.prototype._min_y;VMapEngine.prototype._max_y;VMapEngine.prototype.getMinX=function(){return(this._min_x)};VMapEngine.prototype.getMaxX=function(){return(this._max_x)};VMapEngine.prototype.getMinY=function(){return(this._min_y)};VMapEngine.prototype.getMaxY=function(){return(this._max_y)};VMapEngine.prototype._maps=Array();VMapEngine.prototype._markers=Array();VMapEngine.prototype._default_layer;VMapEngine.prototype._layers=new Array();VMapEngine.prototype._currentMap=null;VMapEngine.prototype._current_zoom_index=null;VMapEngine.prototype.getZoomControl=function(){return(zoomControl)};VMapEngine.prototype.getZoomIndex=function(){return(this._current_zoom_index)};VMapEngine.prototype.setZoomIndex=function(a){var c=this._current_zoom_index;var b=a;this._current_zoom_index=a;this.setZoom(this._current_zoom_index);this.showMap();this.fireMapEvent("zoomchange",c,b)};VMapEngine.prototype._center_x;VMapEngine.prototype._center_y;VMapEngine.prototype._current_client_x;VMapEngine.prototype._current_client_y;VMapEngine.prototype.getCurrentClientX=function(){return(this._current_client_x)};VMapEngine.prototype.getCurrentClientY=function(){return(this._current_client_y)};VMapEngine.prototype.getMaps=function(){return(this._maps)};VMapEngine.prototype.getViewport=function(){return(this._viewport)};VMapEngine.prototype.getDefaultLayer=function(){return(this._default_layer)};VMapEngine.prototype.setCenterX=function(a){this._center_x=a};VMapEngine.prototype.getCenterX=function(){return(this._center_x)};VMapEngine.prototype.setCenterY=function(a){this._center_y=a};VMapEngine.prototype.getCenterY=function(){return(this._center_y)};VMapEngine.prototype._draggable_marker=null;VMapEngine.prototype._routes;VMapEngine.prototype._mapName=null;VMapEngine.prototype._map_event_listeners=Array();VMapEngine.prototype._mouse_event_listeners=Array();VMapEngine.prototype._current_info_window=null;VMapEngine.prototype._current_hint_window=null;VMapEngine.prototype.dragging=false;function VMapEngine(a){VIEWPORT_LEFT=getBounds(a).left+getClientsLeft();VIEWPORT_TOP=getBounds(a).top+getClientsTop();VIEWPORT_WIDTH=a.offsetWidth;VIEWPORT_HEIGHT=a.offsetHeight;this._viewport=a;if(!this._checkCopyrightLink()){return(null)}this._viewport.style.overflow="hidden";this._viewport.style.position="absolute";this._viewport.style.zIndex="1";X_TILES_COUNT=Math.floor((VIEWPORT_WIDTH/TILE_WIDTH))+1;Y_TILES_COUNT=Math.floor((VIEWPORT_HEIGHT/TILE_HEIGHT));mapEngine=this;window.onmouseup=function(b){mouse_down_flag=false};this._default_layer=new VLayer();this._default_layer.show();return(this)}VMapEngine.prototype._logo_image=null;VMapEngine.prototype._checkCopyrightLink=function(){this._logo_image=document.getElementById("visicom_copyright_link");if(this._logo_image==null){this._logo_image=document.createElement("a");this._logo_image.href="http://maps.visicom.ua";this._logo_image.target="_blank";this._viewport.appendChild(this._logo_image)}this._logo_image.style.position="absolute";this._logo_image.style.display="block";this._logo_image.style.zIndex="220";this._logo_image.style.marginLeft="0px";this._logo_image.style.marginRight="0px";this._logo_image.style.marginTop="0px";this._logo_image.style.marginBottom="0px";this._logo_image.style.maxWidth="none";this._logo_image.style.maxHeight="none";if(USER_DATA.Browser.MSIE){this._logo_image.innerHTML='<img style="background: none;" border="0" width="132" height="21" src="'+VISICOM_API_URL+'/images/blank.gif" style="FILTER: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+VISICOM_API_URL+"/images/logo-with-alpha.png');\" />"}else{this._logo_image.innerHTML='<img style="background: none;" border="0" width="132" height="21"  src="'+VISICOM_API_URL+'images/logo-with-alpha.png">'}this._logo_image.style.border="0px";this._repaintCopyrightLink();return(true)};VMapEngine.prototype._repaintCopyrightLink=function(){this._logo_image.style.left=(VIEWPORT_WIDTH-135)+"px";this._logo_image.style.top=(VIEWPORT_HEIGHT-25)+"px"};VMapEngine.prototype.setZoom=function(a){if(this._maps[a]==null){return}this.closeCurrentInfoWindow();this.closeCurrentHintWindow();if(this._currentMap!=null){this._currentMap.hide()}this._currentMap=this._maps[a];this._current_zoom_index=a;this._currentMap._current_min_i=null;this._currentMap._current_max_i=null;this._currentMap._current_min_j=null;this._currentMap._current_max_j=null;zoomControl.setRunnerPosition(a)};VMapEngine.prototype.zoomIn=function(){if(this._maps[this._currentMap.getZoomIndex()+1]==null){return}var b=this._currentMap.getZoomIndex();var a=this._currentMap.getZoomIndex()+1;this.setZoom(this._currentMap.getZoomIndex()+1);this.showMap();this.fireMapEvent("zoomchange",b,a)};VMapEngine.prototype.zoomOut=function(){if(this._maps[this._currentMap.getZoomIndex()-1]==null){return}var b=this._currentMap.getZoomIndex();var a=this._currentMap.getZoomIndex()-1;this.setZoom(this._currentMap.getZoomIndex()-1);this.showMap();this.fireMapEvent("zoomchange",b,a)};VMapEngine.prototype.setCenter=function(a,b){if(a instanceof VGeoPoint){var f=a.convertToLocalPoint();this._center_x=f.getX();this._center_y=f.getY()}else{if(a instanceof VPoint){this._center_x=a.getX();this._center_y=a.getY()}else{if(a instanceof VBounds){var e=a;var h=this.getMinimalZoomForBounds(e);var d=new VPoint(e.getMinPoint().getX()+(e.getMaxPoint().getX()-e.getMinPoint().getX())/2,e.getMinPoint().getY()+(e.getMaxPoint().getY()-e.getMinPoint().getY())/2);this.setCenter(d,h);return}}}if((b!=null)&&(this.getZoomIndex()!=b)){var g=this.getZoomIndex();var c=b;this._current_zoom_index=b;this.setZoom(this._current_zoom_index);this.showMap();this.fireMapEvent("zoomchange",g,c)}else{if(this._currentMap!=null){this._currentMap.hide();this._currentMap._current_min_i=null;this._currentMap._current_max_i=null;this._currentMap._current_min_j=null;this._currentMap._current_max_j=null}this.showMap()}};VMapEngine.prototype.getCenter=function(){var a=this.convertToLocalCoords(Math.round(VIEWPORT_WIDTH/2-this._currentMap._left),Math.round(VIEWPORT_HEIGHT/2-this._currentMap._top),this._currentMap._units_per_pixel);return(a)};VMapEngine.prototype.getClientRect=function(){var c=this.convertToLocalCoords(-this._currentMap._left,VIEWPORT_HEIGHT-this._currentMap._top,this._currentMap._units_per_pixel);var a=this.convertToLocalCoords(VIEWPORT_WIDTH-this._currentMap._left,-this._currentMap._top,this._currentMap._units_per_pixel);var b=new VBounds(new VPoint((c.getX()<this._min_x)?this._min_x:c.getX(),(c.getY()<this._min_y)?this._min_y:c.getY()),new VPoint((a.getX()>this._max_x)?this._max_x:a.getX(),(a.getY()>this._max_y)?this._max_y:a.getY()));return(b)};VMapEngine.prototype.getClientMBR=function(){var g=this.convertToLocalCoords(-this._currentMap._left,VIEWPORT_HEIGHT-this._currentMap._top,this._currentMap._units_per_pixel);var c=this.convertToLocalCoords(VIEWPORT_WIDTH-this._currentMap._left,-this._currentMap._top,this._currentMap._units_per_pixel);var f=geoUtil.convertToGeoProjection(g.getX(),g.getY());var d=new VGeoPoint(f.getLongitude(),f.getLatitude());var b=geoUtil.convertToGeoProjection(c.getX(),c.getY());var a=new VGeoPoint(b.getLongitude(),b.getLatitude());var e=new MBR(d,a);return(e)};VMapEngine.prototype.resizeViewport=function(){this._resizeViewport()};VMapEngine.prototype._resizeViewport=function(a){VIEWPORT_LEFT=getBounds(this._viewport).left+getClientsLeft();VIEWPORT_TOP=getBounds(this._viewport).top+getClientsTop();VIEWPORT_WIDTH=this._viewport.offsetWidth;VIEWPORT_HEIGHT=this._viewport.offsetHeight;X_TILES_COUNT=Math.floor((VIEWPORT_WIDTH/TILE_WIDTH))+1;Y_TILES_COUNT=Math.floor((VIEWPORT_HEIGHT/TILE_HEIGHT));this._repaintCopyrightLink();this.setCenterCoords(VIEWPORT_WIDTH/2,VIEWPORT_HEIGHT/2);clearTimeout(VISICOM_MOVING_TIMER_ID);this._currentMap.hide();this.showMap()};VMapEngine.prototype._initObjectsIndex=function(){delete (this._currentMap._objects_index);this._currentMap._objects_index=new Array()};VMapEngine.prototype._addObject=function(b){if(this._currentMap==null){return}var a=b._getBounds();var m=a.getMinPoint();var h=a.getMaxPoint();var l=this.convertToScreenCoords(m.getX()-this.getMinX(),this.getMaxY()-m.getY(),this._currentMap._units_per_pixel);var f=Math.floor((Math.abs(l.getLeft()))/TILE_WIDTH);var d=Math.floor((this._currentMap._height-l.getTop())/TILE_HEIGHT);l=this.convertToScreenCoords(h.getX()-this.getMinX(),this.getMaxY()-h.getY(),this._currentMap._units_per_pixel);var k=Math.floor((Math.abs(l.getLeft()))/TILE_WIDTH);var g=Math.floor((this._currentMap._height-l.getTop())/TILE_HEIGHT);for(var e=f;e<=k;e++){for(var c=d;c<=g;c++){this._addObjectToIndex(e,c,b)}}};VMapEngine.prototype._removeObject=function(b){var a=b._getBounds();if(a==null){return}var m=a.getMinPoint();var h=a.getMaxPoint();var l=this.convertToScreenCoords(m.getX()-this.getMinX(),this.getMaxY()-m.getY(),this._currentMap._units_per_pixel);var f=Math.floor((Math.abs(l.getLeft()))/TILE_WIDTH);var d=Math.floor((this._currentMap._height-l.getTop())/TILE_HEIGHT);l=this.convertToScreenCoords(h.getX()-this.getMinX(),this.getMaxY()-h.getY(),this._currentMap._units_per_pixel);var k=Math.floor((Math.abs(l.getLeft()))/TILE_WIDTH);var g=Math.floor((this._currentMap._height-l.getTop())/TILE_HEIGHT);for(var e=f;e<=k;e++){for(var c=d;c<=g;c++){this._removeObjectFromIndex(e,c,b)}}};VMapEngine.prototype._addObjectToIndex=function(c,b,a){var d=this._currentMap._objects_index[c];if(d==null){this._currentMap._objects_index[c]=Array()}d=this._currentMap._objects_index[c][b];if(d==null){d=this._currentMap._objects_index[c][b]=Array()}this._currentMap._objects_index[c][b].push(a)};VMapEngine.prototype._removeObjectFromIndex=function(c,b,a){var f=this._currentMap._objects_index[c];if(f==null){return}f=this._currentMap._objects_index[c][b];if(f==null){return}for(var e=0;e<f.length;e++){var d=f[e];if(a!=d){continue}f.splice(e,1);break}};VMapEngine.prototype._getMapName=function(){return(this._mapName)};VMapEngine.prototype._switchMap=function(a,d){var c=this;var b=new VRemoteRequest();b.request(VISICOM_API_URL+"InitMap?map="+a,function(l){c._mapName=a;var h=c.getZoomIndex();var e=c.getCenter();c._currentMap.hide();c._min_x=l.minx;c._max_x=l.maxx;c._min_y=l.miny;c._max_y=l.maxy;c._maps=new Array();for(var g=0;g<l.tilesets.length;g++){var f=l.tilesets[g];var k=(3*Math.pow(2,g))*TILE_WIDTH;var j=(2*Math.pow(2,g))*TILE_HEIGHT;var m=new VMap(k,j,g);m.setBaseURL(f.href);m.setUnitsPerPixel(f.units_per_pixel);c._maps[g]=m}if(h>=l.tilesets.length){c._currentMap=c._maps[l.tilesets.length-1]}else{c._currentMap=c._maps[h]}c.showMap();c.setCenter(e,h);if(d!=null){d()}})};VMapEngine.prototype.switchMap=function(a,b){};VMapEngine.prototype.switchMap=function(a,c,b){if((b==null)&&!(c instanceof String)){this._switchMap(a,c);return}this._switchMap(a+"_"+c,b)};VMapEngine.prototype.showMap=function(){if(this._currentMap==null){return}this._initObjectsIndex();this._currentMap.showMap()};VMapEngine.prototype.repaintMap=function(){if(this._currentMap==null){return}this._currentMap.repaintMap()};VMapEngine.prototype.setCenterCoords=function(d,c){this._currentMap._center_screen_x=d-this._currentMap._left;this._currentMap._center_screen_y=c-this._currentMap._top;var b=this._currentMap._center_screen_x*this._currentMap._units_per_pixel;b+=this._min_x;var a=this._currentMap._center_screen_y*this._currentMap._units_per_pixel;a=this._max_y-a;this._center_x=b;this._center_y=a};VMapEngine.prototype.panTo=function(a){};VMapEngine.prototype.panTo=function(b){if(VISICOM_MOVING_TIMER_ID!=null){clearTimeout(VISICOM_MOVING_TIMER_ID)}if(b instanceof VGeoPoint){b=b.convertToLocalPoint()}var a=this.getCenter();var d=(b.getX()-a.getX());var c=(b.getY()-a.getY());var g=Math.sqrt(Math.pow(d,2)+Math.pow(c,2));var f=d/g;var e=c/g;VISICOM_MOVE(b.getX(),b.getY(),f,e,g)};VMapEngine.prototype._reCenterMap=function(a){this._center_x=a.getX();this._center_y=a.getY();var c=(this.getCenterX()-this.getMinX());var e=c/this._currentMap._units_per_pixel;this._currentMap._left=Math.round((VIEWPORT_WIDTH/2)-e);var b=(this.getMaxY()-this.getCenterY());var d=b/this._currentMap._units_per_pixel;this._currentMap._top=Math.round((VIEWPORT_HEIGHT/2)-d);this.repaintMap()};var VISICOM_MOVING_TIMER_ID;function VISICOM_MOVE(g,f,h,i,b){var c=mapEngine;var j=22;var e=c._currentMap._units_per_pixel;var a=c.getCenter();if((b<j*e)||(!c._currentMap.checkPosition())){clearTimeout(VISICOM_MOVING_TIMER_ID);c.fireMapEvent("enddrag");return}var m=new VPoint(a.getX()+j*e*h,a.getY()+j*e*i);c._reCenterMap(m);var l=(g-m.getX());var k=(f-m.getY());var d=Math.sqrt(Math.pow(l,2)+Math.pow(k,2));if(d>b){clearTimeout(VISICOM_MOVING_TIMER_ID);c.fireMapEvent("enddrag");return}b=d;VISICOM_MOVING_TIMER_ID=setTimeout("VISICOM_MOVE("+g+", "+f+", "+h+","+i+", "+b+")",10)}VMapEngine.prototype.convertToScreenCoords=function(b,a,c){var e=b/c;var d=a/c;return(new VScreenPoint(e,d))};VMapEngine.prototype.convertToLocalCoords=function(d,b,e){var c=d*e;c+=this._min_x;var a=b*e;a=this._max_y-a;return(new VPoint(c,a))};VMapEngine.prototype.createBounds=function(e){var c=null;var b=null;var h=null;var g=null;for(var d=0;d<e.length;d++){var a=e[d];if((a.getX()<c)||(c==null)){c=a.getX()}if((a.getY()<b)||(b==null)){b=a.getY()}if((a.getX()>h)||(h==null)){h=a.getX()}if((a.getY()>g)||(g==null)){g=a.getY()}}var f=new VBounds(new VPoint(c,b),new VPoint(h,g));return(f)};VMapEngine.prototype.getMinimalZoomForBounds=function(e){var a=0;for(var c=this.getMaps().length-1;c>=0;c--){var f=this.getMaps()[c];var g=this.convertToScreenCoords(e.getMinPoint().getX(),e.getMinPoint().getY(),f._units_per_pixel);var d=this.convertToScreenCoords(e.getMaxPoint().getX(),e.getMaxPoint().getY(),f._units_per_pixel);var h=d.getLeft()-g.getLeft();var b=d.getTop()-g.getTop();if((VIEWPORT_WIDTH>=h)&&(VIEWPORT_HEIGHT>=b)){a=f._zoom_index;break}}return(a)};VMapEngine.prototype.addMarker=function(a){this._default_layer.addMarker(a)};VMapEngine.prototype.removeMarker=function(a){this._default_layer.removeMarker(a)};VMapEngine.prototype.addRoute=function(a){this._default_layer.addRoute(a)};VMapEngine.prototype.removeRoute=function(a){this._default_layer.removeRoute(a)};VMapEngine.prototype.addPolyline=function(a){this._default_layer.addPolyline(a)};VMapEngine.prototype.removePolyline=function(a){this._default_layer.removePolyline(a)};VMapEngine.prototype.addPolygone=function(a){this._default_layer.addPolygone(a)};VMapEngine.prototype.removePolygone=function(a){this._default_layer.removePolygone(a)};VMapEngine.prototype.addLayer=function(a){this._layers.push(a)};VMapEngine.prototype.removeLayer=function(b){for(var a=0;a<this._layers.length;a++){if(this._layers[a]!=b){continue}b._removeAllObjects();this._layers.splice(a,1);break}};VMapEngine.prototype._initLayers=function(){this._default_layer.init();for(var b=0;b<this._layers.length;b++){var a=this._layers[b];a.init()}};VMapEngine.prototype._hideLayers=function(){this._default_layer._hide();for(var b=0;b<this._layers.length;b++){var a=this._layers[b];a._hide()}};VMapEngine.prototype.removeAllMarkers=function(){var d=this._default_layer.getMarkers();for(var c=0;c<d.length;c++){var a=d[c];a.hide()}for(c=0;c<this._layers.length;c++){var b=this._layers[c];b.hide()}};VMapEngine.prototype.addEventListener=function(b,a){switch(b){case"zoomchange":this._map_event_listeners.push(new VEvent(b,a));break;case"startdrag":this._map_event_listeners.push(new VEvent(b,a));break;case"dragging":this._map_event_listeners.push(new VEvent(b,a));break;case"enddrag":this._map_event_listeners.push(new VEvent(b,a));break;case"load":this._map_event_listeners.push(new VEvent(b,a));break;case"mousedown":this._mouse_event_listeners.push(new VEvent(b,a));break;case"mouseup":this._mouse_event_listeners.push(new VEvent(b,a));break;case"mousemove":this._mouse_event_listeners.push(new VEvent(b,a));break;case"mouseclick":this._mouse_event_listeners.push(new VEvent(b,a));break;case"mousedblclick":this._mouse_event_listeners.push(new VEvent(b,a));break}};VMapEngine.prototype.removeEventListener=function(b){for(var a=0;a<this._map_event_listeners.length;a++){var c=this._map_event_listeners[a];if(c._handler!=b){continue}this._map_event_listeners.splice(a,1);return}for(a=0;a<this._mouse_event_listeners.length;a++){c=this._mouse_event_listeners[a];if(c._handler!=b){continue}this._mouse_event_listeners.splice(a,1);return}};VMapEngine.prototype.fireMapEvent=function(e,d,b){for(var a=0;a<this._map_event_listeners.length;a++){var c=this._map_event_listeners[a];if(c._event_name!=e){continue}if(e=="zoomchange"){c._handler(d,b)}else{c._handler()}}};VMapEngine.prototype.fireMouseEvent=function(d,a){for(var b=0;b<this._mouse_event_listeners.length;b++){var c=this._mouse_event_listeners[b];if(c._event_name!=d){continue}if(a.getX()<this._min_x){a.setX(this._min_x)}if(a.getY()<this._min_y){a.setY(this._min_y)}if(a.getX()>this._max_x){a.setX(this._max_x)}if(a.getY()>this._max_y){a.setY(this._max_y)}c._handler(a)}};VMapEngine.prototype.setCurrentInfoWindow=function(a){this._current_info_window=a};VMapEngine.prototype.closeCurrentInfoWindow=function(){if(this._current_info_window==null){return}if(this._current_info_window.isAlwaysOpen()){return}this._current_info_window.hide()};VMapEngine.prototype.closeCurrentHintWindow=function(){if(this._current_hint_window==null){return}this._current_hint_window.hide()};function VMap(c,a,b){this._width=c;this._height=a;this._zoom_index=b;this._x_tiles_count=Math.round(this._width/TILE_WIDTH);this._y_tiles_count=Math.round(this._height/TILE_HEIGHT);this._left=Math.round((VIEWPORT_WIDTH-this._width)/2);this._top=Math.round((VIEWPORT_HEIGHT-this._height)/2);this._map=document.createElement("div");this._map.id="map_"+b;this._map.style.position="absolute";this._map.style.left="-"+TILE_WIDTH+"px";this._map.style.top="-"+TILE_HEIGHT+"px";this._map.style.width=VIEWPORT_WIDTH+TILE_WIDTH+"px";this._map.style.height=VIEWPORT_HEIGHT+TILE_HEIGHT+"px";this._map.style.zIndex="101";this._map.style.cursor='url("'+VISICOM_API_URL+'images/cursor/openhand.cur.ico"), default';var f=this;var e=0;var d=0;if(window.addEventListener){window.addEventListener("DOMMouseScroll",this.onMouseWheel,false)}window.onmousewheel=this.onMouseWheel;document.onmousewheel=this.onMouseWheel;this._map.oncontextmenu=function(g){};this._map.onmouseover=function(g){zoomControl._mousedown=false;mapEngine.mouse_over_flag=true};this._map.onmouseout=function(g){mapEngine.mouse_over_flag=false};this._map.onclick=function(h){if(!h){h=window.event}if(!mapEngine.dragging){var g=mapEngine.convertToLocalCoords((h.clientX-VIEWPORT_LEFT)-f._left+getClientsLeft(),(h.clientY-VIEWPORT_TOP)-f._top+getClientsTop(),f._units_per_pixel);mapEngine.fireMouseEvent("mouseclick",g)}};this._map.ondblclick=function(h){if(!h){h=window.event}var g=mapEngine.convertToLocalCoords((h.clientX-VIEWPORT_LEFT)-f._left+getClientsLeft(),(h.clientY-VIEWPORT_TOP)-f._top+getClientsTop(),f._units_per_pixel);mapEngine.fireMouseEvent("mousedblclick",g);if(mapEngine.getMaps().length==f._zoom_index+1){if(VISICOM_MOVING_TIMER_ID!=null){clearTimeout(VISICOM_MOVING_TIMER_ID)}mapEngine.panTo(g)}else{f._zoomByPoint(1)}};this._map.onmousedown=function(h){if(!h){h=window.event}if(!mapEngine.mouse_over_flag){h.returnValue=true;return}mouse_down_flag=true;mapEngine.dragging=false;if(USER_DATA.Browser.Opera){f._map.style.cursor="move"}else{f._map.style.cursor='url("'+VISICOM_API_URL+'images/cursor/closedhand.cur.ico"), move'}e=h.clientX-f._left;d=h.clientY-f._top;mapEngine.closeCurrentInfoWindow();mapEngine.closeCurrentHintWindow();var g=mapEngine.convertToLocalCoords((h.clientX-VIEWPORT_LEFT)-f._left+getClientsLeft(),(h.clientY-VIEWPORT_TOP)-f._top+getClientsTop(),f._units_per_pixel);mapEngine.fireMouseEvent("mousedown",g);mapEngine.fireMapEvent("startdrag");if(h.stopPropagation){h.stopPropagation()}else{h.cancelBubble=true}if(h.preventDefault){h.preventDefault()}else{h.returnValue=false}};this._map.onmouseup=function(h){if(!h){h=window.event}mouse_down_flag=false;mapEngine.mouse_over_flag=true;if(mapEngine._draggable_marker!=null){mapEngine._draggable_marker.onMouseUp(h)}if(USER_DATA.Browser.Opera){f._map.style.cursor="default"}else{f._map.style.cursor='url("'+VISICOM_API_URL+'images/cursor/openhand.cur.ico"), default'}var g=mapEngine.convertToLocalCoords((h.clientX-VIEWPORT_LEFT)-f._left+getClientsLeft(),(h.clientY-VIEWPORT_TOP)-f._top+getClientsTop(),f._units_per_pixel);mapEngine.fireMouseEvent("mouseup",g);mapEngine.fireMapEvent("enddrag")};this._map.onmousemove=function(k){var g;if(k==undefined){k=window.event;g=k.button}else{g=k.which}var h=mapEngine.convertToLocalCoords((k.clientX-VIEWPORT_LEFT)-f._left+getClientsLeft(),(k.clientY-VIEWPORT_TOP)-f._top+getClientsTop(),f._units_per_pixel);mapEngine.fireMouseEvent("mousemove",h);if(mapEngine._draggable_marker!=null){mapEngine._draggable_marker._left+=(k.clientX-mapEngine._draggable_marker._current_x);mapEngine._draggable_marker._top+=(k.clientY-mapEngine._draggable_marker._current_y);mapEngine._draggable_marker._current_x=k.clientX;mapEngine._draggable_marker._current_y=k.clientY;mapEngine._draggable_marker._moved=true;dragging=true;mapEngine._draggable_marker.fireDraggingEvent("dragging");if(k.stopPropagation){k.stopPropagation()}else{k.cancelBubble=true}if(k.preventDefault){k.preventDefault()}else{k.returnValue=false}mapEngine.repaintMap();return}mapEngine._current_client_x=k.clientX;mapEngine._current_client_y=k.clientY;if(!mouse_down_flag){return}if(g!=1){return}var j=k.clientX-e;if(f._width>VIEWPORT_WIDTH){if(((j<=0)&&(j+f._width>VIEWPORT_WIDTH))||((j>0)&&(j+f._width<=VIEWPORT_WIDTH))){f._left=Math.round(j)}}var i=k.clientY-d;if(f._height>VIEWPORT_HEIGHT){if(((i<=0)&&(i+f._height>VIEWPORT_HEIGHT))||((i>0)&&(i+f._height<=VIEWPORT_HEIGHT))){f._top=Math.round(i)}}if(k.stopPropagation){k.stopPropagation()}else{k.cancelBubble=true}if(k.preventDefault){k.preventDefault()}else{k.returnValue=false}mapEngine.dragging=true;mapEngine.fireMapEvent("dragging");f.repaintMap()};if(USER_DATA.Browser.MSIE||USER_DATA.Browser.FireFox){this._map.onkeydown=function(g){f.onKeyDown(g)}}else{window.onkeydown=function(g){f.onKeyDown(g)}}return(this)}VMap.prototype.onKeyDown=function(f){if(!mapEngine.mouse_over_flag){return}if(!f){f=window.event}var d=f.keyCode;var a=false;var c=mapEngine._currentMap._left;var b=mapEngine._currentMap._top;switch(d){case 38:b+=Math.round(VIEWPORT_WIDTH/10);a=true;break;case 40:b-=Math.round(VIEWPORT_WIDTH/10);a=true;break;case 37:c+=Math.round(VIEWPORT_HEIGHT/10);a=true;break;case 39:c-=Math.round(VIEWPORT_HEIGHT/10);a=true;break;case 33:b+=Math.round(VIEWPORT_WIDTH/2);a=true;break;case 34:b-=Math.round(VIEWPORT_WIDTH/2);a=true;break;case 36:c+=Math.round(VIEWPORT_WIDTH/2);a=true;break;case 35:c-=Math.round(VIEWPORT_WIDTH/2);a=true;break}if(a){if(((c<=0)&&(c+mapEngine._currentMap._width>VIEWPORT_WIDTH))||((c>0)&&(c+mapEngine._currentMap._width<=VIEWPORT_WIDTH))){mapEngine._currentMap._left=Math.round(c)}if(((b<=0)&&(b+mapEngine._currentMap._height>VIEWPORT_HEIGHT))||((b>0)&&(b+mapEngine._currentMap._height<=VIEWPORT_HEIGHT))){mapEngine._currentMap._top=Math.round(b)}mapEngine._currentMap.repaintMap()}};VMap.prototype.onMouseWheel=function(a){if(!mapEngine.mouse_over_flag){return}var b=0;if(!a){a=window.event}if(a.wheelDelta){b=a.wheelDelta/120}else{if(a.detail){b=-a.detail/3}}if(b){mapEngine._currentMap._zoomByPoint(b)}if(a.stopPropagation){a.stopPropagation()}else{a.cancelBubble=true}if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}};VMap.prototype._zoomByPoint=function(g){if(VISICOM_MOVING_TIMER_ID!=null){clearTimeout(VISICOM_MOVING_TIMER_ID)}var c=mapEngine._current_client_x-VIEWPORT_LEFT;var a=mapEngine._current_client_y-VIEWPORT_TOP;var e=mapEngine.convertToLocalCoords(c-this._left-((g<0)?getClientsLeft():0),a-this._top-((g<0)?getClientsTop():0),this._units_per_pixel);if(g<0){var f=this.getZoomIndex();var d=this.getZoomIndex()-1;if(mapEngine._maps[this.getZoomIndex()-1]==null){return}mapEngine.setZoom(this.getZoomIndex()-1)}else{f=this.getZoomIndex();d=this.getZoomIndex()+1;if(mapEngine._maps[this.getZoomIndex()+1]==null){return}mapEngine.setZoom(this.getZoomIndex()+1)}var b=mapEngine.convertToScreenCoords(e.getX()-mapEngine.getMinX(),mapEngine.getMaxY()-e.getY(),mapEngine._currentMap._units_per_pixel);mapEngine._currentMap._left=Math.round(c-b.getLeft()-((g<0)?0:getClientsLeft()));mapEngine._currentMap._top=Math.round(a-b.getTop())-((g<0)?0:getClientsTop());mapEngine.setCenterCoords(VIEWPORT_WIDTH/2,VIEWPORT_HEIGHT/2);mapEngine._initObjectsIndex();mapEngine._initLayers();delete (mapEngine._currentMap._tiles);mapEngine._currentMap._tiles=new Array();mapEngine._currentMap.checkPosition();mapEngine._currentMap.repaintMap();mapEngine._viewport.appendChild(mapEngine._currentMap._map);mapEngine.fireMapEvent("zoomchange",f,d)};VMap.prototype._map;VMap.prototype._left;VMap.prototype._top;VMap.prototype._width;VMap.prototype._height;VMap.prototype._base_url;VMap.prototype._zoom_index;VMap.prototype._units_per_pixel;VMap.prototype._x_tiles_count;VMap.prototype._y_tiles_count;VMap.prototype._tiles=Array();VMap.prototype._polylines_tiles=null;VMap.prototype._objects_index=Array();VMap.prototype._current_min_i=null;VMap.prototype._current_min_j=null;VMap.prototype._current_max_i=null;VMap.prototype._current_max_j=null;VMap.prototype._center_screen_x;VMap.prototype._center_screen_y;VMap.prototype.getDOMElement=function(){return(this._map)};VMap.prototype.getLeft=function(){return(this._left)};VMap.prototype.getTop=function(){return(this._top)};VMap.prototype.getWidth=function(){return(this._width)};VMap.prototype.getHeight=function(){return(this._height)};VMap.prototype.setBaseURL=function(a){this._base_url=a};VMap.prototype.getBaseURL=function(){return(this._base_url)};VMap.prototype.setZoomIndex=function(a){this._zoom_index=a};VMap.prototype.getZoomIndex=function(){return(this._zoom_index)};VMap.prototype.getUnitsPerPixel=function(){return(this._units_per_pixel)};VMap.prototype.setUnitsPerPixel=function(a){this._units_per_pixel=parseFloat(a)};VMap.prototype.checkPosition=function(){var a=true;if(this._width>VIEWPORT_WIDTH){if(this._left>0){this._left=0;a=false}}else{if(this._width<VIEWPORT_WIDTH){this._left=VIEWPORT_WIDTH/2-this._width/2;a=false}}if(this._height>VIEWPORT_HEIGHT){if(this._top>0){this._top=0;a=false}}else{if(this._height<VIEWPORT_HEIGHT){this._top=VIEWPORT_HEIGHT/2-this._height/2;a=false}}if(this._left<0){if(this._width+this._left<VIEWPORT_WIDTH){this._left=-1*(this._width-VIEWPORT_WIDTH);a=false}}if(this._top<0){if(this._height+this._top<VIEWPORT_HEIGHT){this._top=-1*(this._height-VIEWPORT_HEIGHT);a=false}}return(a)};VMap.prototype.showMap=function(){if(VISICOM_MOVING_TIMER_ID!=null){clearTimeout(VISICOM_MOVING_TIMER_ID)}delete (this._tiles);this._tiles=new Array();delete (this._polylines_index);this._polylines_index=new Array();if((mapEngine.getCenterX()!=null)&&(mapEngine.getCenterY()!=null)){var b=(mapEngine.getCenterX()-mapEngine.getMinX());var d=b/this._units_per_pixel;this._left=Math.round((VIEWPORT_WIDTH/2)-d);var a=(mapEngine.getMaxY()-mapEngine.getCenterY());var c=a/this._units_per_pixel;this._top=Math.round((VIEWPORT_HEIGHT/2)-c)}else{d=(mapEngine.getCenterX()-mapEngine.getMinX())/this._units_per_pixel;this._left=(VIEWPORT_WIDTH/2)-d;c=(mapEngine.getCenterY()-mapEngine.getMinY())/this._units_per_pixel;this._top=(VIEWPORT_HEIGHT/2)-c}this.checkPosition();mapEngine._initLayers();this.repaintMap();mapEngine._viewport.appendChild(this._map)};VMap.prototype.repaintMap=function(){var k,e,l,f;var h,d,n,m;if(this._width<VIEWPORT_WIDTH){k=h=0;l=n=this._x_tiles_count-1;e=d=0;f=m=this._y_tiles_count-1}else{h=Math.floor(Math.abs(this._left)/TILE_WIDTH);d=Math.floor((this._height-(Math.abs(this._top)+VIEWPORT_HEIGHT))/TILE_HEIGHT);n=Math.floor((Math.abs(this._left)+VIEWPORT_WIDTH)/TILE_WIDTH);m=Math.floor((this._height-Math.abs(this._top))/TILE_HEIGHT);k=((this._current_min_i!=null)&&(this._current_min_i<h))?this._current_min_i:h-1;l=((this._current_max_i!=null)&&(this._current_max_i>n))?this._current_max_i:n;e=((this._current_min_j!=null)&&(this._current_min_j<d))?this._current_min_j:d-1;f=((this._current_max_j!=null)&&(this._current_max_j>m))?this._current_max_j:m;k=(k<0)?k=0:k;e=(e<0)?e=0:e;l=(l>=this._x_tiles_count)?l=this._x_tiles_count-1:l;f=(f>=this._y_tiles_count)?f=this._y_tiles_count-1:f}this._current_min_i=h;this._current_max_i=n;this._current_min_j=d;this._current_max_j=m;var c=new Array();var a=new Array();for(var g=k;g<=l;g=g+2){for(var b=e+1;b<=f;b=b+2){this._repaintTile(g,b,c,a)}}for(g=k+1;g<=l;g=g+2){for(b=e;b<=f;b=b+2){this._repaintTile(g,b,c,a)}}for(g=k;g<=l;g=g+2){for(b=e;b<=f;b=b+2){this._repaintTile(g,b,c,a)}}for(g=k+1;g<=l;g=g+2){for(b=e+1;b<=f;b=b+2){this._repaintTile(g,b,c,a)}}c.forEach(function(i){if(!i.isDisplayed()){i._show()}i.repaint()});a.forEach(function(i){if(i.isDisplayed()){i._hide()}});if(mapEngine._current_info_window!=null){mapEngine._current_info_window.repaint()}};VMap.prototype._repaintTile=function(e,d,c,a){if(this._tiles[e]==null){this._tiles[e]=Array()}if(this._tiles[e][d]==null){this._tiles[e][d]=new VMapTile(e,d,this)}var h=this._tiles[e][d];if((e>=this._current_min_i)&&(e<=this._current_max_i)&&(d>=this._current_min_j)&&(d<=this._current_max_j)){if(!h.isVisible()){h.show()}h.repaint();if((this._objects_index[e]!=null)&&(this._objects_index[e][d]!=null)){var g=this._objects_index[e][d];if(g.length==0){return}for(var k=0;k<g.length;k++){var b=g[k];if(b.isVisible()){if(c.indexOf(b)<0){c.push(b)}var f=a.indexOf(b,0);if(f>=0){a.splice(f,1)}b.repaint()}else{if(a.indexOf(b)>=0){continue}a.push(b)}}}}else{if(h.isVisible()){h.hide()}if((this._objects_index[e]!=null)&&(this._objects_index[e][d]!=null)){g=this._objects_index[e][d];if(g.length==0){return}for(k=0;k<g.length;k++){b=g[k];if(b.isDisplayed()){if(c.indexOf(b)>=0){continue}if(a.indexOf(b)>=0){continue}a.push(b)}}}}};VMap.prototype.hide=function(){for(var b=this._current_min_i;b<=this._current_max_i;b++){if(this._tiles[b]==null){continue}for(var a=this._current_min_j;a<=this._current_max_j;a++){var c=this._tiles[b][a];if(c!=null){c.hide()}}}mapEngine._hideLayers();mapEngine._viewport.removeChild(this._map)};VMapObject.prototype._div;VMapObject.prototype._left;VMapObject.prototype._top;VMapObject.prototype._width=null;VMapObject.prototype._height=null;VMapObject.prototype._bounds;VMapObject.prototype._visible=false;VMapObject.prototype._displayed=false;VMapObject.prototype.getLeft=function(){return(this._left)};VMapObject.prototype.getTop=function(){return(this._top)};VMapObject.prototype.setLeft=function(a){this._left=a};VMapObject.prototype.setTop=function(a){this._top=a};VMapObject.prototype.isVisible=function(){return(this._visible)};VMapObject.prototype.isDisplayed=function(){return(this._displayed)};function VMapObject(){return(this)}VMapObject.prototype.getDOMElement=function(){return(this._div)};VMapObject.prototype.init=function(){this._init();mapEngine._addObject(this)};VMapObject.prototype._init=function(){};VMapObject.prototype._show=function(){};VMapObject.prototype.show=function(){this._visible=true};VMapObject.prototype._hide=function(){};VMapObject.prototype.hide=function(){this._visible=false};VMapObject.prototype._remove=function(){if(this._displayed){this._hide()}if(this._visible){this.hide()}mapEngine._removeObject(this)};VMapObject.prototype.repaint=function(){if(this._div==null){return}this._div.style.left=Math.round(mapEngine._currentMap.getLeft()+TILE_WIDTH+this._left)+"px";this._div.style.top=Math.round(mapEngine._currentMap.getTop()+TILE_HEIGHT+this._top)+"px"};VMapObject.prototype._getBounds=function(){return(this._bounds)};VMapObject.prototype.mouseclick=function(a){};VMapObject.prototype.mousedown=function(a){};VMapObject.prototype.mouseup=function(a){};VMapObject.prototype.mousemove=function(a){};VMapObject.prototype.startdrag=function(a){};VMapObject.prototype.dragging=function(a){};VMapObject.prototype.enddrag=function(a){};var TILE_WIDTH=256;var TILE_HEIGHT=256;var X_TILES_COUNT=null;var Y_TILES_COUNT=null;VMapTile.TMS_NUMBER=0;function VMapTile(a,c,b){this._x=a;this._y=c;this._left=this._x*TILE_WIDTH;this._top=(b.getHeight()-TILE_HEIGHT)-this._y*TILE_HEIGHT;this._parent_map=b;this._error_counter=0;return(this)}VMapTile.prototype._parent_map;VMapTile.prototype._x;VMapTile.prototype._y;VMapTile.prototype._left;VMapTile.prototype._top;VMapTile.prototype._tile=null;VMapTile.prototype._visible=false;VMapTile.prototype._error_counter;VMapTile.prototype.getX=function(){return(this._x)};VMapTile.prototype.getY=function(){return(this._y)};VMapTile.prototype.getLeft=function(){return(this._left)};VMapTile.prototype.getTop=function(){return(this._top)};VMapTile.prototype.isVisible=function(){return(this._visible)};VMapTile.prototype.getDOMElement=function(){return(this._tile)};VMapTile.prototype.show=function(){if(this._tile==null){this._tile=document.createElement("img");this._tile.id="tile_"+this._x+"_"+this._y;this._tile.style.left="0px";this._tile.style.top="0px";this._tile.style.width=TILE_WIDTH;this._tile.style.height=TILE_HEIGHT;this._tile.style.position="absolute";this._tile.style.background="none";this._tile.style.border="0px";this._tile.style.zIndex="101";this._tile.lowSrc=VISICOM_API_URL+"/images/low_src.png";var a=this._parent_map.getBaseURL();a=a.replace(/tms\./,"tms"+VMapTile.TMS_NUMBER+".");this._tile.src=a+"/"+this._x+"/"+this._y+".png";var b=this;this._tile.onerror=function(c){b._error_counter++;if(b._error_counter>5){b._tile.onerror=null;return}VMapTile.TMS_NUMBER++;if(VMapTile.TMS_NUMBER>3){VMapTile.TMS_NUMBER=0}a=b._parent_map._base_url;a=a.replace(/tms\./,"tms"+VMapTile.TMS_NUMBER+".");b._tile.src=a+"/"+b._x+"/"+b._y+".png"};VMapTile.TMS_NUMBER++;if(VMapTile.TMS_NUMBER>3){VMapTile.TMS_NUMBER=0}}this._parent_map.getDOMElement().appendChild(this._tile);this._visible=true};VMapTile.prototype.repaint=function(){if(this._tile==null){return}this._tile.style.left=this._parent_map.getLeft()+this._left+TILE_WIDTH+"px";this._tile.style.top=this._parent_map.getTop()+this._top+TILE_HEIGHT+"px"};VMapTile.prototype.hide=function(){try{this._parent_map.getDOMElement().removeChild(this._tile)}catch(a){}this._visible=false};VMapEngine.prototype.initialize=function(){this._mapName="ukraine";this._min_x=parseFloat(-69650301);this._max_x=parseFloat(69650302);this._min_y=parseFloat(-46433534);this._max_y=parseFloat(46433535);var a=0;var d=(3*Math.pow(2,a))*TILE_WIDTH;var c=(2*Math.pow(2,a))*TILE_HEIGHT;var e=new VMap(d,c,a);e.setBaseURL("http://tms.visicom.ua/1.0.1/ukraine_ru/0");e.setUnitsPerPixel(181380.993489583);this._maps[a]=e;a++;var d=(3*Math.pow(2,a))*TILE_WIDTH;var c=(2*Math.pow(2,a))*TILE_HEIGHT;var e=new VMap(d,c,a);e.setBaseURL("http://tms.visicom.ua/1.0.1/ukraine_ru/1");e.setUnitsPerPixel(90690.4967447917);this._maps[a]=e;a++;var d=(3*Math.pow(2,a))*TILE_WIDTH;var c=(2*Math.pow(2,a))*TILE_HEIGHT;var e=new VMap(d,c,a);e.setBaseURL("http://tms.visicom.ua/1.0.1/ukraine_ru/2");e.setUnitsPerPixel(45345.2483723958);this._maps[a]=e;a++;var d=(3*Math.pow(2,a))*TILE_WIDTH;var c=(2*Math.pow(2,a))*TILE_HEIGHT;var e=new VMap(d,c,a);e.setBaseURL("http://tms.visicom.ua/1.0.1/ukraine_ru/3");e.setUnitsPerPixel(22672.6241861979);this._maps[a]=e;a++;var d=(3*Math.pow(2,a))*TILE_WIDTH;var c=(2*Math.pow(2,a))*TILE_HEIGHT;var e=new VMap(d,c,a);e.setBaseURL("http://tms.visicom.ua/1.0.1/ukraine_ru/4");e.setUnitsPerPixel(11336.312093099);this._maps[a]=e;a++;var d=(3*Math.pow(2,a))*TILE_WIDTH;var c=(2*Math.pow(2,a))*TILE_HEIGHT;var e=new VMap(d,c,a);e.setBaseURL("http://tms.visicom.ua/1.0.1/ukraine_ru/5");e.setUnitsPerPixel(5668.1560465495);this._maps[a]=e;a++;var d=(3*Math.pow(2,a))*TILE_WIDTH;var c=(2*Math.pow(2,a))*TILE_HEIGHT;var e=new VMap(d,c,a);e.setBaseURL("http://tms.visicom.ua/1.0.1/ukraine_ru/6");e.setUnitsPerPixel(2834.0780232747);this._maps[a]=e;a++;var d=(3*Math.pow(2,a))*TILE_WIDTH;var c=(2*Math.pow(2,a))*TILE_HEIGHT;var e=new VMap(d,c,a);e.setBaseURL("http://tms.visicom.ua/1.0.1/ukraine_ru/7");e.setUnitsPerPixel(1417.0390116374);this._maps[a]=e;a++;var d=(3*Math.pow(2,a))*TILE_WIDTH;var c=(2*Math.pow(2,a))*TILE_HEIGHT;var e=new VMap(d,c,a);e.setBaseURL("http://tms.visicom.ua/1.0.1/ukraine_ru/8");e.setUnitsPerPixel(708.5195058187);this._maps[a]=e;a++;var d=(3*Math.pow(2,a))*TILE_WIDTH;var c=(2*Math.pow(2,a))*TILE_HEIGHT;var e=new VMap(d,c,a);e.setBaseURL("http://tms.visicom.ua/1.0.1/ukraine_ru/9");e.setUnitsPerPixel(354.2597529093);this._maps[a]=e;a++;var d=(3*Math.pow(2,a))*TILE_WIDTH;var c=(2*Math.pow(2,a))*TILE_HEIGHT;var e=new VMap(d,c,a);e.setBaseURL("http://tms.visicom.ua/1.0.1/ukraine_ru/10");e.setUnitsPerPixel(177.1298764547);this._maps[a]=e;a++;var d=(3*Math.pow(2,a))*TILE_WIDTH;var c=(2*Math.pow(2,a))*TILE_HEIGHT;var e=new VMap(d,c,a);e.setBaseURL("http://tms.visicom.ua/1.0.1/ukraine_ru/11");e.setUnitsPerPixel(88.5649382273);this._maps[a]=e;a++;this._currentMap=this._maps[this._current_zoom_index];var b=/.*(http\:\/\/maps\.visicom\.ua)|(193.200.248.99)((#.*)|$)/i;if(b.exec(document.location.href)!=null){new VZoomControl(10,35,this._maps.length);this.showMap()}else{new VZoomControl(10,10,this._maps.length);this.showMap()}zoomControl.setRunnerPosition(this._current_zoom_index)};