Map={metersXS:[155731.125,155863.567,155929,197648,215659,220603,231528,235595,237180,238324,238845,239105],metersYS:[6225814,6225814,6225814,6225814,6225814.016,6225814.008,6225814.004,6225813.984,6225814.01,6225814.01,6225814,6225814],metersY:6225814,PixelMeterX:[1057.1208,528.3879,264.1509,132.0755,64.0333,32.509,15.6519,7.76826,4.0018,2.00089,1.00044,0.50212],PixelMeterY:[1056.4316,528.2158,264.1074,132.054,64.0262,32.5056,15.6508,7.76788,4.0016,2.00081,1.0004,0.5021],PixelKeyMeterS:[79,158,316,316,370,577,501,486,547,521,521,521],PixelKeyMeterE:[79,158,316,948,1852,4171,7469,14843,34991,65433,130866,261733,523466],mscaleX:[1,2,2,2,2,2,2,2,2,2,2,2,2,2],mscaleY:[1,2,2,2,2,2,2,2,2,2,2,2,2,2],array_scaleX:[768,1536,3072,6144,12288,24576,49152,98304,196608,393216,786432,1572864,3145728],array_scaleY:[512,1024,2048,4096,8448,16640,34560,69632,135169,270338,540676,1081352,2162704],what_do:0,num_scale:1,max_scale:12,deltaX:0,deltaY:0,tileWidth:768,tileHeight:512,tileLeft:0,tileTop:0,width:768,height:512,widthLayout:0,heightLayout:0,www:0,hhh:0,dX:0,dY:0,urlMap:"",typeVector:0,LastClickBL:["",""],observe:function(c,b,d){element=document.getElementById(c);if(element.addEventListener){element.addEventListener(b,d,false)}else{if(element.attachEvent){element.attachEvent("on"+b,d)}}},NAME_SPACE:"Map"};function MapObserve(d,c,b){var e=b;getData(d);b=function(g){var f=Map.LastClickBL[0];var h=Map.LastClickBL[1];return e.call(this,g,f,h)};Map.observe("belgd_main_div",c,b)}var downClick=false;var downClickDrag=false;var downClickMain=false;var downClickPoint=false;var moveMouseXStart=0;var moveMouseYStart=0;var moveMouseXEnd=0;var moveMouseYEnd=0;Tile=function(f,d,h,g,c,b,e){this.id=f;this.isLoading=false;this.Left=h;this.Top=g;this.isBack=false;this.Url=d;this.draw=draw;this.placeX=c;this.placeY=b;this.width=e;this.height=e};tileSize=256;urlMapF="http://tut.belgeodesy.by/";MapApiKey=0;LastdX=0;LastdY=0;oldPoiID=0;loaded=false;distance="";firstEdit="";secondEdit="";function draw(b){if(typeof(b)==="undefined"){b="transparent"}var c=document.getElementById(this.id);if(c.src!==this.Url){c.src=this.Url}c.style.left=parseInt(this.Left+Map.tileLeft)+"px";c.style.top=parseInt(this.Top+Map.tileTop)+"px";c.style.width=tileSize+"px";c.style.height=tileSize+"px";c.onerror=function(){if(this.src.indexOf("spacer.gif")==-1){this.src=urlMapF+"/images/navigate/noimage.png"}}}var Tiles=new Array();function FindMinX(){var d=0;var b=tileSize;for(var c=1;c<=Map.www;c++){if((Tiles[c].Left+Map.tileLeft+Map.deltaX)<b){b=Tiles[c].Left+Map.tileLeft+Map.deltaX;d=c}}return Array(d,b)}function FindMaxX(){var d=0;var c=Map.width;for(var b=1;b<=Map.www;b++){if((Tiles[b].Left+Map.tileLeft+Map.deltaX)>c){c=Tiles[b].Left+Map.tileLeft+Map.deltaX;d=b}}return Array(d,c)}function FindMinY(){var d=0;var b=tileSize;for(var c=0;c<Map.hhh;c++){if((Tiles[c*Map.www+1].Top+Map.tileTop+Map.deltaY)<b){b=Tiles[c*Map.www+1].Top+Map.tileTop+Map.deltaY;d=c*Map.www+1}}return Array(d,b)}function FindMaxY(){var d=0;var c=Map.height;for(var b=0;b<Map.hhh;b++){if((Tiles[b*Map.www+1].Top+Map.tileTop+Map.deltaY)>c){c=Tiles[b*Map.www+1].Top+Map.tileTop+Map.deltaY;d=b*Map.www+1}}return Array(d,c)}function getOffset(b){if(b.getBoundingClientRect){return getOffsetRect(b)}else{return getOffsetSum(b)}}function getOffsetSum(b){var d=0,c=0;while(b){d=d+parseInt(b.offsetTop);c=c+parseInt(b.offsetLeft);b=b.offsetParent}return{top:d,left:c}}function getOffsetRect(e){var d=e.getBoundingClientRect();var c=document.body;var b=document.documentElement;var l=b.clientTop||c.clientTop||0;var h=b.clientLeft||c.clientLeft||0;var g=d.top-l;var f=d.left-h;return{top:Math.round(g),left:Math.round(f)}}function getSize(d){var b=d.clientHeight;var c=d.clientWidth;if(c==0&&b==0||isNaN(c)&&isNaN(b)){if(d.style.display!="none"){b=d.offsetHeight;c=d.offsetWidth}}if(c==0&&b==0||isNaN(c)&&isNaN(b)){c=parseInt(d.style.width);b=parseInt(d.style.height)}if(d.style.position=="absolute"){b=b-d.offsetTop;c=c-d.offsetLeft}return{width:c,height:b}}function toggle(){if(document.getElementById("belgd_keymap_m").style.width=="16px"){document.getElementById("belgd_vh_mini").src=urlMapF+"/images/hide_mini.png";document.getElementById("belgd_keymap_m").style.width="215px";document.getElementById("belgd_keymap_m").style.height="170px"}else{document.getElementById("belgd_vh_mini").src=urlMapF+"/images/view_mini.png";document.getElementById("belgd_keymap_m").style.width="16px";document.getElementById("belgd_keymap_m").style.height="16px"}}function switch_(b){if(b==1){document.getElementById("belgd_map").style.marginLeft="0px";document.getElementById("belgd_choose_result").style.display="none";document.getElementById("belgd_select_choose").style.display="none";document.getElementById("belgd_select_search_string").style.display="block"}else{if(b==2){ClearSearchResult();document.getElementById("belgd_map").style.marginLeft="299px";document.getElementById("belgd_choose_result").style.display="block";document.getElementById("belgd_select_choose").style.display="block";document.getElementById("belgd_select_search_string").style.display="none"}}}function initMap(e,d,c,b){def=$.ajax({type:"GET",url:urlMapF+"/getright.php",data:"key="+e,dataType:"jsonp",success:function(f){size_div=getSize(document.getElementById("belgd_div_map"));MapApiKey=e;Map.widthLayout=size_div.width;Map.heightLayout=size_div.height;Map.urlMap=f.MapUrl;setTimeout("updateSize(false)",0);setTimeout("checkSupportSVG()",0);if(typeof(d)!=="undefined"&&typeof(c)!=="undefined"&&typeof(b)!=="undefined"){setTimeout("onUrlMap("+d+","+c+","+b+")",0)}copyrights='<br />&copy; Госкомимущество Республики Беларусь, <a href="http://belgeodesy.by">&copy; РУП &quot;Белгеодезия&quot;</a><br />';setTimeout("ViewScale()",0);if(document.getElementById("belgd_map").childNodes[0].tagName==="DIV"){document.getElementById("belgd_map").childNodes[0].innerHTML=copyrights}else{if(document.getElementById("belgd_map").childNodes[1].tagName==="DIV"){document.getElementById("belgd_map").childNodes[1].innerHTML=copyrights}}}});return def}function checkSupportSVG(){if(supportsSVG()){Map.typeVector=1}else{Map.typeVector=0}}function hideControl(b){if(b){for(i=2;i<8;i++){document.getElementById("belgd_map").children.item(i).style.display="none"}document.getElementById("belgd_keymap_m").style.display="none";document.getElementById("belgd_border_tools").style.display="none";document.getElementById("belgd_keymap_div").style.display="none";document.getElementById("belgd_border_tools").style.display="none"}else{for(i=2;i<8;i++){document.getElementById("belgd_map").children.item(i).style.display="block"}document.getElementById("belgd_keymap_m").style.display="block";document.getElementById("belgd_border_tools").style.display="block";document.getElementById("belgd_keymap_div").style.display="block";document.getElementById("belgd_border_tools").style.display="block"}}function ThreeNum(c){var b=c.toString().length;if(b==4){return c}else{if(b==3){return"0"+c}else{if(b==2){return"00"+c}else{return"000"+c}}}}function abroad(){var b=getSize(document.getElementById("belgd_div_map"));if((Math.abs(Map.tileLeft)+Map.width)>(Map.tileWidth-Map.PixelKeyMeterE[Map.num_scale-1]+Map.PixelKeyMeterS[Map.num_scale-1])){Map.tileLeft=Map.width-Map.tileWidth+Map.PixelKeyMeterE[Map.num_scale-1]-Map.PixelKeyMeterS[Map.num_scale-1]}if((Math.abs(Map.tileTop)+Map.height)>Map.tileHeight){Map.tileTop=Map.height-Map.tileHeight}if((parseInt(Map.tileLeft))>0){if(Map.tileWidth>Map.width){Map.tileLeft=0}else{Map.tileLeft=Map.tileLeft/2}}if((parseInt(Map.tileTop))>0){if(Map.tileHeight>Map.height){Map.tileTop=0}else{Map.tileTop=Map.tileTop/2}}}function zoomMap(c,h){spacerZoom();var o=document.getElementById("belgd_tiles_1");var m=document.getElementById("belgd_tiles_2");var g=document.getElementById("belgd_poi_1");m.style.display="none";if(c==-128){scale_f=-4;plmin=-0.5}else{if(c==256){scale_f=2;plmin=1}}scale_factor=1+c/tileSize;tileSize+=c;if(h==1){var p=moveMouseXStart-Map.width/2;var f=moveMouseYStart-Map.height/2;m.style.top=parseInt(-Map.height/scale_f-plmin*f)+"px";m.style.left=parseInt(-Map.width/scale_f-plmin*p)+"px";g.style.top=parseInt(-Map.height/scale_f-plmin*f)+"px";g.style.left=parseInt(-Map.width/scale_f-plmin*p)+"px"}else{m.style.top=parseInt(-Map.height/scale_f)+"px";m.style.left=parseInt(-Map.width/scale_f)+"px";g.style.top=parseInt(-Map.height/scale_f)+"px";g.style.left=parseInt(-Map.width/scale_f)+"px"}var d=document.getElementById("belgd_tiles_1").children.length;for(i=0;i<d;i++){var b=document.getElementById("belgd_tiles_1").children.item(i);var e=document.getElementById("belgd_tiles_2").children.item(i);var l=document.createElement("img");l.id=e.id;l.className="belgd_img_tile";l.src=e.src;l.style.left=parseInt(b.style.left.replace("px",""))*scale_factor+"px";l.style.top=parseInt(b.style.top.replace("px",""))*scale_factor+"px";l.style.width=tileSize+"px";l.style.height=tileSize+"px";document.getElementById("belgd_tiles_2").replaceChild(l,e)}tileSize-=c;m.style.display="block";o.style.display="none"}function spacerZoom(){loaded=true;abroad();document.getElementById("belgd_wait").style.display="block";var d=document.getElementById("belgd_tiles_1").children.length;for(i=0;i<d;i++){var c=document.getElementById("belgd_tiles_1").children.item(i);var f=document.getElementById("belgd_tiles_2").children.item(i);f.src=c.src;f.style.left=c.style.left;f.style.top=c.style.top;f.style.width=c.style.width;f.style.height=c.style.height}var e=document.getElementById("belgd_tiles_2");e.style.display="block";var b=document.getElementById("belgd_tiles_1");b.style.display="none";for(i=0;i<d;i++){var c=document.getElementById("belgd_tiles_1").children.item(i);c.src=urlMapF+"/images/spacer.gif"}}function dragMap_space(e,c){if(typeof(e)==="undefined"){e=false}if(typeof(c)==="undefined"){c=false}loaded=true;abroad();document.getElementById("belgd_wait").style.display="block";var l=document.getElementById("belgd_tiles_2");l.innerHTML="";var g=document.getElementById("belgd_tiles_1").children.length;for(i=0;i<g;i++){var f=document.getElementById("belgd_tiles_1").children.item(i);var h=document.createElement("img");if(e){h.src=urlMapF+"/images/spacer.gif"}else{h.src=f.src}h.id="belgd_img2_"+f.id.replace("belgd_img","");h.className="belgd_img_tile";h.style.left=f.style.left;h.style.top=f.style.top;h.style.width=f.style.width;h.style.height=f.style.height;f.src=urlMapF+"/images/spacer.gif";document.getElementById("belgd_tiles_2").appendChild(h)}l.style.display="block";var b=document.getElementById("belgd_tiles_1");b.style.display="none";b.innerHTML="";for(yM=0;yM<Map.hhh;yM++){for(xM=0;xM<Map.www;xM++){var d=document.createElement("img");d.id="belgd_img"+((yM)*Map.www+xM+1);d.className="belgd_img_tile";d.src=urlMapF+"/images/spacer.gif";d.style.left=(xM*tileSize)+"px";d.style.top=(yM*tileSize)+"px";d.style.width=tileSize+"px";d.style.height=tileSize+"px";document.getElementById("belgd_tiles_1").appendChild(d)}}}function dragMap(){abroad();var h=document.getElementById("belgd_tiles_1");h.style.top="0px";h.style.left="0px";var l=Math.floor((-(Map.tileLeft))/tileSize);var f=Math.floor((-(Map.tileTop))/tileSize);for(yM=0;yM<Map.hhh;yM++){for(xM=0;xM<Map.www;xM++){var d=(yM)*Map.www+xM+1;var e=parseInt(yM)+parseInt(f);var m=parseInt(xM)+parseInt(l);var b=Map.urlMap+Map.num_scale+"/"+ThreeNum(m)+ThreeNum(e)+".png";Tiles[d]=new Tile("belgd_img"+d,b,((m)*tileSize),((e)*tileSize),m,e,tileSize);Tiles[d].draw("white")}}var o=128-(Map.num_scale-1)*(117/Map.max_scale);document.getElementById("belgd_drag").style.marginTop=o+"px";var c=202*Map.width/Map.tileWidth;var g=170*Map.height/Map.tileHeight;document.getElementById("belgd_keymap_scale").style.width=c+"px";document.getElementById("belgd_keymap_scale").style.height=g+"px";document.getElementById("belgd_keymap_scale").style.marginTop=((Math.abs(Map.tileTop-Map.height))/Map.tileHeight)*170-g+"px";document.getElementById("belgd_keymap_scale").style.marginLeft=parseInt((-Map.tileLeft+Map.width/2-Map.PixelKeyMeterS[Map.num_scale-1])/(Map.array_scaleX[Map.num_scale-1]-Map.PixelKeyMeterS[Map.num_scale-1]-Map.PixelKeyMeterE[Map.num_scale-1])*202+10-c/2)+"px";document.getElementById("belgd_main_div").style.cursor="default";h.style.display="block";if(Map.num_scale<=2){recalcAllPOI("first")}return"belgd_img"+d}function returnedblock(){var b=document.getElementById("belgd_tiles_1");b.style.display="block";document.getElementById("belgd_wait").style.display="none";loaded=false}function zoomer(){dragMap();returnedblock()}function ViewScale(){document.getElementById("belgd_scale_ch").src=Map.urlMap+"scale"+Map.num_scale+".gif"}function onClickDrag(f){if(Map.num_scale>=1){if(!loaded){if(Map.num_scale>2&&Map.num_scale<Map.max_scale){if(f=="minimize"){zoomMap(-128,0)}if(f=="maximize"){zoomMap(256,0)}}else{if(Map.num_scale==1&&Map.num_scale==Map.max_scale){dragMap_space(false)}}}}var e=Map.width/2;var d=Map.height/2;var c=-parseInt((Map.tileLeft-e)*Map.PixelMeterX[Map.num_scale-1]-Map.metersXS[Map.num_scale-1]);var b=parseInt((Map.tileTop-d)*Map.PixelMeterY[Map.num_scale-1]+Map.metersY);if(f=="minimize"){Map.num_scale=parseInt(Map.num_scale)-1}if(f=="maximize"){Map.num_scale=parseInt(Map.num_scale)+1}if(Map.num_scale<1){Map.num_scale=1;return}if(Map.num_scale>Map.max_scale){Map.num_scale=Map.max_scale;return}Map.tileLeft=parseInt(((Map.metersXS[Map.num_scale-1]-c)/Map.PixelMeterX[Map.num_scale-1])+e);Map.tileTop=parseInt(((b-Map.metersY)/Map.PixelMeterY[Map.num_scale-1])+d);Map.tileWidth=Map.array_scaleX[Map.num_scale-1]-Map.PixelKeyMeterS[Map.num_scale-1];Map.tileHeight=Map.array_scaleY[Map.num_scale-1];ViewScale();setTimeout("zoomer()",0);recalcAllPOI(f)}function onClickDragW(d){if(!loaded){if(Map.num_scale>2&&Map.num_scale<Map.max_scale){if(d=="minimize"){zoomMap(-128,1)}if(d=="maximize"){zoomMap(256,1)}}else{if(Map.num_scale==1&&Map.num_scale==Map.max_scale){dragMap_space()}}var c=-parseInt((Map.tileLeft-moveMouseXStart)*Map.PixelMeterX[Map.num_scale-1]-Map.metersXS[Map.num_scale-1]);var b=parseInt((Map.tileTop-moveMouseYStart)*Map.PixelMeterY[Map.num_scale-1]+Map.metersYS[Map.num_scale-1]);if(d=="minimize"){Map.num_scale=parseInt(Map.num_scale)-1}if(d=="maximize"){Map.num_scale=parseInt(Map.num_scale)+1}if(Map.num_scale<1){Map.num_scale=1;return}if(Map.num_scale>Map.max_scale){Map.num_scale=Map.max_scale;return}Map.tileLeft=parseInt(((Map.metersXS[Map.num_scale-1]-c)/Map.PixelMeterX[Map.num_scale-1])+moveMouseXStart);Map.tileTop=parseInt(((b-Map.metersYS[Map.num_scale-1])/Map.PixelMeterY[Map.num_scale-1])+moveMouseYStart);Map.tileWidth=Map.array_scaleX[Map.num_scale-1]-Map.PixelKeyMeterS[Map.num_scale-1];Map.tileHeight=Map.array_scaleY[Map.num_scale-1];ViewScale();setTimeout("zoomer()",0);recalcAllPOI(d)}}function onClickMove(b){Map.deltaX=0;Map.deltaY=0;switch(b){case"left":Map.tileLeft=Map.tileLeft+Math.round((Map.width*2/3));if(Map.tileLeft>0){Map.tileLeft=0}break;case"right":Map.tileLeft=Map.tileLeft-Math.round((Map.width*2/3));if(Map.tileLeft<(Map.width-Map.tileWidth)){Map.tileLeft=Map.width-Map.tileWidth}break;case"top":Map.tileTop=Map.tileTop+Math.round((Map.height*2/3));if(Map.tileTop>0){Map.tileTop=0}break;case"bottom":Map.tileTop=Map.tileTop-Math.round((Map.height*2/3));if(Map.tileTop<(Map.height-Map.tileHeight)){Map.tileTop=Map.height-Map.tileHeight}break}if(!loaded){dragMap_space()}var c=document.getElementById(dragMap());c.onload=function(){returnedblock()};recalcAllPOI(b)}document.oncontextmenu=function(b){return false};function updateSize(e){var c=document.getElementById("belgd_main_div");c.style.left="0px";c.style.top="0px";var c=document.getElementById("belgd_main_nd");c.style.left="0px";c.style.top="0px";var c=document.getElementById("belgd_tiles_2");c.style.left="0px";c.style.top="0px";var c=document.getElementById("belgd_tiles_1");c.style.left="0px";c.style.top="0px";var c=document.getElementById("belgd_poi_1");c.style.left="0px";c.style.top="0px";size_div=getSize(document.getElementById("belgd_div_map"));if(Map.width!=size_div.width){Map.width=size_div.width;Map.height=size_div.height}Map.www=Math.ceil(Map.width/tileSize)+2;Map.hhh=Math.ceil(Map.height/tileSize)+2;if(document.getElementById("belgd_img"+((Map.www-1)*(Map.hhh-1)+Map.www))==null){document.getElementById("belgd_tiles_1").innerHTML="";for(yM=0;yM<Map.hhh;yM++){for(xM=0;xM<Map.www;xM++){var d=document.createElement("img");var b=document.createElement("img");d.onload=function(){};d.id="belgd_img"+((yM)*Map.www+xM+1);d.className="belgd_img_tile";d.src=urlMapF+"/images/spacer.gif";d.style.left=(xM*tileSize)+"px";d.style.top=(yM*tileSize)+"px";d.style.width=tileSize+"px";d.style.height=tileSize+"px";document.getElementById("belgd_tiles_1").appendChild(d);b.id="belgd_img2_"+((yM)*Map.www+xM+1);b.className="belgd_img_tile";b.src=urlMapF+"/images/spacer.gif";b.style.left=(xM*tileSize)+"px";b.style.top=(yM*tileSize)+"px";b.style.width=tileSize+"px";b.style.height=tileSize+"px";document.getElementById("belgd_tiles_2").appendChild(b)}}}if(e!=true){setTimeout("zoomer()",0)}recalcAllPOI("center")}document.getElementById("belgd_keymap_div").onmousedown=function(g){if(!g){var g=window.event}if(!loaded){dragMap_space(true)}var b=getOffset(document.getElementById("belgd_keymap_div"));moveMouseXStart=(g.clientX-b.left);moveMouseYStart=(g.clientY-b.top);var d=(moveMouseXStart-10)/202*(Map.array_scaleX[Map.num_scale-1]-Map.PixelKeyMeterS[Map.num_scale-1]-Map.PixelKeyMeterE[Map.num_scale-1])+Map.PixelKeyMeterS[Map.num_scale-1];var c=(moveMouseYStart)*(Map.tileHeight/170);data1=-parseInt((-d)*Map.PixelMeterX[Map.num_scale-1]-Map.metersXS[Map.num_scale-1]);data2=parseInt((-c)*Map.PixelMeterY[Map.num_scale-1]+Map.metersY);Map.tileLeft=parseInt((-d)+Map.width/2);Map.tileTop=parseInt((-c)+Map.height/2);var f=document.getElementById(dragMap());f.onload=function(){returnedblock()};recalcAllPOI("center");return false};document.getElementById("belgd_drag").onmousedown=function(c){if(!c){var c=window.event}downClickDrag=true;var b=getOffset(document.getElementById("belgd_drag"));moveMouseXStart=(c.clientX-b.left);moveMouseYStart=(c.clientY-b.top);return false};function vmlGraphics(){if(document.getElementById("belgd_swgGraphics")===null){var d=document.createElement("div");d.id="belgd_swgGraphics";d.style.top="0px";d.style.position="absolute";d.style.left="0px";document.getElementById("belgd_poi_1").appendChild(d);var c=document.createElement("v:group");d.appendChild(c);var b=document.createElement("v:group");d.appendChild(b);return d}else{var d=document.getElementById("belgd_swgGraphics");return d}}function swgGraphics(){var b=document.getElementById("belgd_poi_1");topswg=b.style.top.replace("px","");topswg=(topswg=="")?0:topswg;leftswg=b.style.left.replace("px","");leftswg=(leftswg=="")?0:leftswg;if(document.getElementById("belgd_swgGraphics")===null){var e=document.createElement("div");e.setAttribute("id","belgd_swgGraphicsDiv");e.style.top="0px";e.style.position="absolute";e.style.left="0px";e.style.width="0px";e.style.zindex="0";e.style.height="0px";document.getElementById("belgd_poi_1").appendChild(e);var f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.setAttributeNS(null,"id","belgd_swgGraphics");f.setAttributeNS(null,"version","1.1");f.setAttributeNS(null,"viewBox",(-Map.widthLayout)+" "+(-Map.heightLayout)+" "+parseInt(Map.widthLayout*3)+" "+parseInt(Map.heightLayout*3));f.setAttributeNS(null,"width",Map.widthLayout*3);f.setAttributeNS(null,"height",Map.heightLayout*3);e.appendChild(f);var d=document.createElementNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"stroke","#0000ff");f.appendChild(d);var d=document.createElementNS("http://www.w3.org/2000/svg","g");f.appendChild(d);return f}else{var f=document.getElementById("belgd_swgGraphics");size_div=getSize(document.getElementById("belgd_div_map"));f.setAttributeNS(null,"viewBox",(-parseInt(Map.widthLayout)+parseInt(-leftswg))+" "+(-parseInt(Map.heightLayout)+parseInt(-topswg))+" "+parseInt(Map.widthLayout*3)+" "+parseInt(Map.heightLayout*3));var c=document.getElementById("belgd_swgGraphicsDiv");c.style.left=(-parseInt(Map.widthLayout)+parseInt(-leftswg))+"px";c.style.top=(-parseInt(Map.heightLayout)+parseInt(-topswg))+"px";return f}}function supportsSVG(){if(!(document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"))){if(!document.namespaces.v){document.namespaces.add("v","urn:schemas-microsoft-com:vml");var d=document.createStyleSheet();var e=["line","stroke","polyline","fill","oval","rect","roundrect"];for(var c=0,b=e.length;c<b;c++){d.addRule("v\\:"+e[c],"behavior: url(#default#VML);");d.addRule("v\\:"+e[c],"antialias: true;");d.addRule("v\\:"+e[c],"filter:progid:DXImageTransform.Microsoft.Alpha(opacity=85)")}}vmlGraphics();return true}else{swgGraphics();return false}}function DrawLineWGS(e,c,h,d){if(typeof(d)==="undefined"){d=false}var f=document.getElementById("belgd_poi_1");var b=0;var g=0;if(f.style.top!=""){b=parseInt(f.style.left.replace("px",""));g=parseInt(f.style.top.replace("px",""))}first=e.split("|");XY1=GradToM(first[0],first[1],false);second=c.split("|");XY2=GradToM(second[0],second[1],false);size_div=getSize(document.getElementById("belgd_div_map"));widthLocalVal=size_div.width;heightLocalVal=size_div.height;XY1[1]=Map.tileLeft-parseInt(-(XY1[1]-Map.metersXS[Map.num_scale-1])/Map.PixelMeterX[Map.num_scale-1]+widthLocalVal/2)+widthLocalVal/2;XY1[0]=Map.tileTop-parseInt((XY1[0]-Map.metersY)/Map.PixelMeterY[Map.num_scale-1]+heightLocalVal/2)+heightLocalVal/2;XY1[1]=XY1[1]-parseInt(b);XY1[0]=XY1[0]-parseInt(g);XY2[1]=Map.tileLeft-parseInt(-(XY2[1]-Map.metersXS[Map.num_scale-1])/Map.PixelMeterX[Map.num_scale-1]+widthLocalVal/2)+widthLocalVal/2;XY2[0]=Map.tileTop-parseInt((XY2[0]-Map.metersY)/Map.PixelMeterY[Map.num_scale-1]+heightLocalVal/2)+heightLocalVal/2;XY2[1]=XY2[1]-parseInt(b);XY2[0]=XY2[0]-parseInt(g);if(Map.typeVector==1){VMLDrawCircle(XY1[1],XY1[0],1,h);VMLDrawLine(XY1[1]+","+XY1[0],XY2[1]+","+XY2[0],parseInt(h)+1);if(d){VMLDrawCircle(XY2[1],XY2[0],1,parseInt(h)+2)}}else{SWGDrawCircle(XY1[1],XY1[0],2,h);SWGDrawLine(XY1[1]+" "+XY1[0],XY2[1]+" "+XY2[0],parseInt(h)+1);if(d){SWGDrawCircle(XY2[1],XY2[0],2,parseInt(h)+2)}}}function VMLDrawLine(e,c,f){var b=vmlGraphics().firstChild;var d=document.createElement("v:line");d.id="belgd_line"+f;d.fill="none";d.strokeweight="2px";d.from=e;d.to=c;d.strokecolor="#0000ff";b.appendChild(d)}function SWGDrawLine(d,b,f){var e=swgGraphics().firstChild;var c=document.createElementNS("http://www.w3.org/2000/svg","path");c.setAttributeNS(null,"id","belgd_line"+f);c.setAttributeNS(null,"fill","none");c.setAttributeNS(null,"stroke-width","3px");c.setAttributeNS(null,"stroke-opacity","0.5");c.setAttributeNS(null,"d","M "+((d))+" L "+((b)));e.appendChild(c)}function VMLDrawCircle(Xcoor,Ycoor,diam,id){var poi_layer=document.getElementById("belgd_poi_1");topswg=poi_layer.style.top.replace("px","");topswg=(topswg=="")?0:topswg;leftswg=poi_layer.style.left.replace("px","");leftswg=(leftswg=="")?0:leftswg;var vmlEl=vmlGraphics().firstChild;var circleEl=document.createElement("v:oval");circleEl.id="belgd_circle"+id;circleEl.fill="true";circleEl.strokeweight="1px";circleEl.opacity="0.5";circleEl.fillcolor="#0000ff";circleEl.strokecolor="#0000ff";divLeft=parseInt(((Xcoor+parseInt(leftswg))-Map.tileLeft)*Map.PixelMeterX[Map.num_scale-1]+Map.metersXS[Map.num_scale-1]);divTop=parseInt((Map.tileTop-(Ycoor+parseInt(topswg)))*Map.PixelMeterY[Map.num_scale-1]+Map.metersY);circleEl.textcontent=divLeft+" "+divTop;with(circleEl.style){position="absolute";top=Ycoor-diam/2;left=Xcoor-diam/2;width=diam;height=diam}circleEl.onmousedown=function(){downClickMain=false;downClickDrag=false;downClickPoint=this.id;return false};circleEl.onmouseover=function(){this.style.cursor="move"};circleEl.onmouseout=function(){this.style.cursor="default"};vmlEl.appendChild(circleEl)}function SWGDrawCircle(d,h,b,g){var e=swgGraphics().firstChild;var c=document.getElementById("belgd_poi_1");topswg=c.style.top.replace("px","");topswg=(topswg=="")?0:topswg;leftswg=c.style.left.replace("px","");leftswg=(leftswg=="")?0:leftswg;var f=document.createElementNS("http://www.w3.org/2000/svg","circle");f.setAttributeNS(null,"id","belgd_circle"+g);f.setAttributeNS(null,"fill","#0000ff");f.setAttributeNS(null,"stroke-width","2px");f.setAttributeNS(null,"stroke-opacity","0.5");f.setAttributeNS(null,"stroke","#ffffff");f.setAttributeNS(null,"cx",((d)));f.setAttributeNS(null,"cy",((h)));f.setAttributeNS(null,"r",b);divLeft=parseInt(((d+parseInt(leftswg))-Map.tileLeft)*Map.PixelMeterX[Map.num_scale-1]+Map.metersXS[Map.num_scale-1]);divTop=parseInt((Map.tileTop-(h+parseInt(topswg)))*Map.PixelMeterY[Map.num_scale-1]+Map.metersY);f.setAttributeNS(null,"textcontent",divLeft+" "+divTop);f.addEventListener("mousedown",function(){downClickMain=false;downClickDrag=false;downClickPoint=this.id;return false},false);f.addEventListener("mouseover",function(){this.style.cursor="move"},true);f.addEventListener("mouseout",function(){this.style.cursor="default"},true);e.appendChild(f)}function VMLDrawDistance(){distance=CalcDistance();if(distance>1000){distance=parseInt(distance/10)/100+" км."}else{distance=distance+" м."}forAppend=vmlGraphics();lastCircle=forAppend.firstChild.lastChild;Xcoor=parseInt(lastCircle.style.left.replace("px",""))+5;Ycoor=parseInt(lastCircle.style.top.replace("px",""))+5;var rectEl=document.createElement("v:roundrect");rectEl.id="belgd_distance_rect";rectEl.fill="#ffffff";rectEl.strokeweight="2px";rectEl.opacity="0.5";rectEl.strokecolor="#000000";rectEl.arcsize="0.20";with(rectEl.style){position="absolute";top=Ycoor;left=Xcoor;width=100;height=25}var rectCr=document.createElement("v:rect");rectCr.id="belgd_distance_crest";rectCr.style.position="absolute";rectCr.fill="#ffffff";rectCr.strokeweight="2px";rectCr.opacity="1";rectCr.strokecolor="#000000";rectCr.style.zIndex="1000";with(rectCr.style){position="absolute";top=(Ycoor+7);left=(Xcoor+80);width=10;height=10}rectCr.onmousedown=function(){document.getElementById("belgd_poi_1").removeChild(document.getElementById("belgd_swgGraphics"));downClickMain=false;downClickPoint=-1;return false};rectCr.onmouseover=function(){this.style.cursor="pointer"};rectCr.onmouseout=function(){this.style.cursor="default"};var lineCr=document.createElement("v:polyline");lineCr.id="belgd_distance_crestL";lineCr.style.position="absolute";lineCr.fillcolor="#ffffff";lineCr.strokeweight="1px";lineCr.opacity="1";lineCr.strokecolor="#000000";lineCr.style.zIndex="1000";lineCr.points=(Xcoor+80)+" "+(Ycoor+7)+" L "+(Xcoor+90)+" "+(Ycoor+17)+" M "+(Xcoor+90)+" "+(Ycoor+7)+" L "+(Xcoor+80)+" "+(Ycoor+17);lineCr.onmousedown=function(){document.getElementById("belgd_poi_1").removeChild(document.getElementById("belgd_swgGraphics"));downClickMain=false;downClickPoint=-1;return false};lineCr.onmouseover=function(){this.style.cursor="pointer"};lineCr.onmouseout=function(){this.style.cursor="default"};var textEl=document.createElement("v:textbox");textEl.id="belgd_distance_text";textEl.style.position="absolute";textEl.style.top="7px";textEl.style.left="12px";textEl.style.fontSize="12px";textEl.style.fontFamily="Arial";textEl.style.fontWeight="bold";textEl.innerHTML=distance;rectEl.appendChild(textEl);if(document.getElementById("belgd_distance_rect")===null){forAppend.lastChild.appendChild(rectEl);forAppend.lastChild.appendChild(rectCr);forAppend.lastChild.appendChild(lineCr)}else{forAppend.lastChild.replaceChild(rectEl,document.getElementById("belgd_distance_rect"));forAppend.lastChild.replaceChild(rectCr,document.getElementById("belgd_distance_crest"));forAppend.lastChild.replaceChild(lineCr,document.getElementById("belgd_distance_crestL"))}}function SWGDrawDistance(){distance=CalcDistance();if(distance>1000){distance=parseInt(distance/10)/100+" км."}else{distance=distance+" м."}forAppend=swgGraphics();lastCircle=forAppend.firstChild.lastChild;Xcoor=parseInt(lastCircle.getAttribute("cx"))+5;Ycoor=parseInt(lastCircle.getAttribute("cy"))+5;var b=document.createElementNS("http://www.w3.org/2000/svg","rect");b.setAttributeNS(null,"id","belgd_distance_rect");b.setAttributeNS(null,"fill","#ffffff");b.setAttributeNS(null,"stroke-width","2px");b.setAttributeNS(null,"stroke-opacity","0.5");b.setAttributeNS(null,"stroke","#000000");b.setAttributeNS(null,"x",(Xcoor));b.setAttributeNS(null,"y",(Ycoor));b.setAttributeNS(null,"width",100);b.setAttributeNS(null,"height",25);b.setAttributeNS(null,"rx",12);b.setAttributeNS(null,"ry",12);var d=document.createElementNS("http://www.w3.org/2000/svg","rect");d.setAttributeNS(null,"id","belgd_distance_crest");d.setAttributeNS(null,"fill","#ffffff");d.setAttributeNS(null,"stroke-width","2px");d.setAttributeNS(null,"stroke-opacity","1");d.setAttributeNS(null,"stroke","#000000");d.setAttributeNS(null,"x",(Xcoor+80));d.setAttributeNS(null,"y",(Ycoor+7));d.setAttributeNS(null,"width",10);d.setAttributeNS(null,"height",10);d.addEventListener("mousedown",function(){document.getElementById("belgd_poi_1").removeChild(document.getElementById("belgd_swgGraphicsDiv"));downClickMain=false;downClickPoint=-1;return false},false);d.addEventListener("mouseover",function(){this.style.cursor="pointer"},true);d.addEventListener("mouseout",function(){this.style.cursor="default"},true);var e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttributeNS(null,"id","belgd_distance_crestL");e.setAttributeNS(null,"fill","none");e.setAttributeNS(null,"stroke","#000000");e.setAttributeNS(null,"stroke-width","2px");e.setAttributeNS(null,"stroke-opacity","0.8");e.setAttributeNS(null,"stroke-linejoin","round");e.setAttributeNS(null,"stroke-linecap","round");e.setAttributeNS(null,"d","M "+(Xcoor+80)+" "+(Ycoor+7)+" L "+(Xcoor+90)+" "+(Ycoor+17)+" M "+(Xcoor+90)+" "+(Ycoor+7)+" L "+(Xcoor+80)+" "+(Ycoor+17));e.addEventListener("mousedown",function(){document.getElementById("belgd_poi_1").removeChild(document.getElementById("belgd_swgGraphicsDiv"));downClickMain=false;downClickPoint=-1;return false},false);e.addEventListener("mouseover",function(){this.style.cursor="pointer"},true);e.addEventListener("mouseout",function(){this.style.cursor="default"},true);var c=document.createElementNS("http://www.w3.org/2000/svg","text");c.setAttributeNS(null,"id","belgd_distance_text");c.setAttributeNS(null,"font-size","12px");c.setAttributeNS(null,"font-family","Arial");c.setAttributeNS(null,"font-weight","bold");c.setAttributeNS(null,"x",(Xcoor+12));c.setAttributeNS(null,"y",(Ycoor+17));c.appendChild(document.createTextNode(distance));if(document.getElementById("belgd_distance_rect")===null){forAppend.lastChild.appendChild(b);forAppend.lastChild.appendChild(d);forAppend.lastChild.appendChild(e);forAppend.lastChild.appendChild(c)}else{forAppend.lastChild.replaceChild(b,document.getElementById("belgd_distance_rect"));forAppend.lastChild.replaceChild(d,document.getElementById("belgd_distance_crest"));forAppend.lastChild.replaceChild(e,document.getElementById("belgd_distance_crestL"));forAppend.lastChild.replaceChild(c,document.getElementById("belgd_distance_text"))}}function CalcDistance(){var e=0;var d=Array(-1,-1);if(Map.typeVector==0){image=swgGraphics();if(typeof(image.viewBox)!=="undefined"){var c=image.firstChild.childNodes.length;for(j=0;j<c;j++){myObj=image.firstChild.childNodes.item(j);if(typeof(myObj.cx)!=="undefined"){coordXY=myObj.getAttribute("textcontent").split(" ");if(d[0]==-1){d=coordXY}else{e+=Math.sqrt(Math.abs((d[0]-coordXY[0])*(d[0]-coordXY[0])+(d[1]-coordXY[1])*(d[1]-coordXY[1])));d=coordXY}}}return parseInt(e)}}else{if(Map.typeVector==1){image=vmlGraphics().firstChild;var b=image.children.length;for(j=0;j<b;j++){myObj=image.children.item(j);if(myObj.tagName=="oval"){coordXY=myObj.getAttribute("textcontent").split(" ");if(d[0]==-1){d=coordXY}else{e+=Math.sqrt(Math.abs((d[0]-coordXY[0])*(d[0]-coordXY[0])+(d[1]-coordXY[1])*(d[1]-coordXY[1])));d=coordXY}}}return parseInt(e)}}}document.getElementById("belgd_main_div").onmousedown=function(c){if(!c){var c=window.event}if(Map.what_do==0||Map.what_do==1||Map.what_do==2){document.getElementById("belgd_main_div").style.cursor="pointer";var d=document.getElementById("belgd_main_div");var b=getOffset(d);moveMouseXStart=(c.clientX-b.left);moveMouseYStart=(c.clientY-b.top);Map.dX=0;Map.dY=0;LastdX=(Math.floor((Map.deltaX-Map.tileLeft)/tileSize));LastdY=(Math.floor((Map.deltaY-Map.tileTop)/tileSize));if(downClickPoint===false){downClickMain=true}}return false};parent.onmouseup=document.onmouseup=function(d){if(!d){var d=window.event}if(downClickDrag===true){downClickDrag=false;onClickDrag();moveMouseXEnd=0;moveMouseYEnd=0}if(downClickMain===true&&downClickPoint===false){downClickMain=false;if((Math.abs(Map.deltaX)>5)||(Math.abs(Map.deltaY)>5)){var f=document.getElementById("belgd_main_div");var c=document.getElementById("belgd_tiles_1");var g=document.getElementById("belgd_tiles_2");var e=document.getElementById("belgd_poi_1");g.style.left=f.style.left;g.style.top=f.style.top;c.style.left=g.style.left;c.style.top=g.style.top;e.style.left=(parseInt(c.style.left.replace("px",""))+parseInt(e.style.left.replace("px","")))+"px";e.style.top=(parseInt(c.style.top.replace("px",""))+parseInt(e.style.top.replace("px","")))+"px";f.style.left="0px";f.style.top="0px";if(!loaded){dragMap_space(false,true)}Map.tileLeft=parseInt(Map.tileLeft)+parseInt(Map.deltaX);Map.tileTop=parseInt(Map.tileTop)+parseInt(Map.deltaY);moveMouseXEnd=0;moveMouseYEnd=0;setTimeout("zoomer()",0);if(Map.typeVector==0){swgGraphics()}else{if(Map.typeVector==1){vmlGraphics()}}}else{if(Map.what_do==1){var e=document.getElementById("belgd_poi_1");if(Map.typeVector==1){diam=10;XC=moveMouseXStart-parseInt(e.style.left.replace("px",""));YC=moveMouseYStart-parseInt(e.style.top.replace("px",""));if(vmlGraphics().firstChild.lastChild!==null){myObj=vmlGraphics().firstChild.lastChild;cx=parseInt(myObj.style.left.replace("px",""))+diam/2;cy=parseInt(myObj.style.top.replace("px",""))+diam/2;VMLDrawLine(cx+", "+cy,parseInt(XC)+", "+parseInt(YC),vmlGraphics().firstChild.childNodes.length);VMLDrawCircle(XC,YC,diam,vmlGraphics().firstChild.childNodes.length);VMLDrawDistance()}else{VMLDrawCircle(XC,YC,diam,0)}}else{XC=moveMouseXStart-parseInt(e.style.left.replace("px",""));YC=moveMouseYStart-parseInt(e.style.top.replace("px",""));if(swgGraphics().firstChild.lastChild!==null){cx=swgGraphics().firstChild.lastChild.getAttribute("cx");cy=swgGraphics().firstChild.lastChild.getAttribute("cy");SWGDrawLine(cx+" "+cy,XC+" "+YC,swgGraphics().firstChild.childNodes.length);SWGDrawCircle(XC,YC,5,swgGraphics().firstChild.childNodes.length);SWGDrawDistance()}else{SWGDrawCircle(XC,YC,5,0)}}}else{if(Map.what_do==2){var b=getOffset(document.getElementById("belgd_main_div"));XClick=(d.clientX-b.left);YClick=(d.clientY-b.top);data1=-parseInt((Map.tileLeft-XClick)*Map.PixelMeterX[Map.num_scale-1]-Map.metersXS[Map.num_scale-1]);data2=parseInt((Map.tileTop-YClick)*Map.PixelMeterY[Map.num_scale-1]+Map.metersY);Map.LastClickBL=XYtoBL(data1,data2);Map.LastClickBL[0]=Math.round(Map.LastClickBL[0]*100000)/100000;Map.LastClickBL[1]=Math.round(Map.LastClickBL[1]*100000)/100000;if(d.ctrlKey){if(firstEdit!=""){document.getElementById(firstEdit).value=Map.LastClickBL[0];document.getElementById(secondEdit).value=Map.LastClickBL[1]}}else{if(firstEdit!=""){document.getElementById(firstEdit).value=Map.LastClickBL[0];document.getElementById(secondEdit).value=Map.LastClickBL[1]}}}}}document.getElementById("belgd_main_div").style.cursor="default";Map.deltaX=0;Map.deltaY=0}if(downClickPoint!==false){downClickPoint=false}return false};parent.onmousemove=document.onmousemove=function(e){if(!e){var e=window.event}var shiftX=0;var shiftY=0;var offsetIMG=getOffset(document.getElementById("belgd_main_div"));XClick=(e.clientX-offsetIMG.left);YClick=(e.clientY-offsetIMG.top);data1=-parseInt((Map.tileLeft-XClick)*Map.PixelMeterX[Map.num_scale-1]-Map.metersXS[Map.num_scale-1]);data2=parseInt((Map.tileTop-YClick)*Map.PixelMeterY[Map.num_scale-1]+Map.metersY);Map.LastClickBL=XYtoBL(data1,data2);Map.LastClickBL[0]=Math.round(Map.LastClickBL[0]*100000)/100000;Map.LastClickBL[1]=Math.round(Map.LastClickBL[1]*100000)/100000;if(downClickDrag===true){var offsetIMG=getOffset(document.getElementById("belgd_drag"));moveMouseYEnd=(e.clientY-offsetIMG.top)-10;var top=parseInt(document.getElementById("belgd_drag").style.marginTop.replace("px",""));top=Math.ceil((top-22+moveMouseYEnd)/(117/Map.max_scale));if(top<=0){top=0}if(top>=(Map.max_scale-1)){top=Map.max_scale-1}if(Map.num_scale>(Map.max_scale-top)){onClickDrag("minimize");top=128-(Map.num_scale-1)*(117/Map.max_scale);document.getElementById("belgd_drag").style.marginTop=top+"px"}else{if(Map.num_scale<(Map.max_scale-top)){onClickDrag("maximize");top=128-(Map.num_scale-1)*(117/Map.max_scale);document.getElementById("belgd_drag").style.marginTop=top+"px"}}return false}if(downClickPoint!==false&&downClickPoint!=="-1"){var objMainND=document.getElementById("belgd_main_nd");var offsetIMG=getOffset(objMainND);Xcoor=(e.clientX-offsetIMG.left);Ycoor=(e.clientY-offsetIMG.top);var objPOI=document.getElementById("belgd_poi_1");topswg=objPOI.style.top.replace("px","");topswg=(topswg=="")?0:topswg;leftswg=objPOI.style.left.replace("px","");leftswg=(leftswg=="")?0:leftswg;Xcoor=Xcoor-parseInt(leftswg);Ycoor=Ycoor-parseInt(topswg);whatObj=downClickPoint.replace("belgd_circle","");if(Map.typeVector==0){var objSVGcircle=document.getElementById("belgd_circle"+whatObj);objSVGcircle.setAttribute("cx",Xcoor);objSVGcircle.setAttribute("cy",Ycoor);divLeft=parseInt(((Xcoor+parseInt(leftswg))-Map.tileLeft)*Map.PixelMeterX[Map.num_scale-1]+Map.metersXS[Map.num_scale-1]);divTop=parseInt((Map.tileTop-(Ycoor+parseInt(topswg)))*Map.PixelMeterY[Map.num_scale-1]+Map.metersY);objSVGcircle.setAttributeNS(null,"textcontent",divLeft+" "+divTop);objSVGcircle=document.getElementById("belgd_line"+(parseInt(whatObj)-1));if(objSVGcircle!==null){d_path=objSVGcircle.getAttribute("d");d_path=d_path.substr(0,d_path.indexOf("L")+1);objSVGcircle.setAttribute("d",d_path+" "+Xcoor+" "+Ycoor)}objSVGcircle=document.getElementById("belgd_line"+(parseInt(whatObj)+1));if(objSVGcircle!==null){d_path=objSVGcircle.getAttribute("d");d_path=d_path.substr(d_path.indexOf("L")-1);objSVGcircle.setAttribute("d","M "+Xcoor+" "+Ycoor+" "+d_path)}if(Map.what_do==1){SWGDrawDistance()}}else{if(Map.typeVector==1){var objVMLcircle=document.getElementById("belgd_circle"+whatObj);with(objVMLcircle.style){top=Ycoor-5;left=Xcoor-5}divLeft=parseInt(((Xcoor+parseInt(leftswg))-Map.tileLeft)*Map.PixelMeterX[Map.num_scale-1]+Map.metersXS[Map.num_scale-1]);divTop=parseInt((Map.tileTop-(Ycoor+parseInt(topswg)))*Map.PixelMeterY[Map.num_scale-1]+Map.metersY);objVMLcircle.textcontent=divLeft+" "+divTop;objVMLcircle=document.getElementById("belgd_line"+(parseInt(whatObj)-1));if(objVMLcircle!==null){objVMLcircle.from=objVMLcircle.from;objVMLcircle.to=Xcoor+","+Ycoor}objVMLcircle=document.getElementById("belgd_line"+(parseInt(whatObj)+1));if(objVMLcircle!==null){objVMLcircle.from=Xcoor+","+Ycoor;objVMLcircle.to=objVMLcircle.to}if(Map.what_do==1){VMLDrawDistance()}}}}if(downClickMain===true){var objMainND=document.getElementById("belgd_main_nd");var objMain=document.getElementById("belgd_main_div");var offsetIMG=getOffset(objMainND);moveMouseXEnd=(e.clientX-offsetIMG.left);moveMouseYEnd=(e.clientY-offsetIMG.top);if((Math.abs(Map.tileLeft)-(moveMouseXEnd-moveMouseXStart))>=0&&(Math.abs(Map.tileLeft+(moveMouseXEnd-moveMouseXStart))+Map.width)<=(Map.tileWidth-Map.PixelKeyMeterE[Map.num_scale-1]+Map.PixelKeyMeterS[Map.num_scale-1])){if(Map.deltaX>(moveMouseXEnd-moveMouseXStart)){shiftX=1}else{if(Map.deltaX<(moveMouseXEnd-moveMouseXStart)){shiftX=-1}else{shiftX=0}}Map.deltaX=(moveMouseXEnd-moveMouseXStart)}else{moveMouseXStart=(e.clientX-offsetIMG.left)-Map.deltaX}if((Math.abs(Map.tileTop)-(moveMouseYEnd-moveMouseYStart))>=0&&(Math.abs(Map.tileTop+(moveMouseYEnd-moveMouseYStart))+Map.height)<=Map.tileHeight){if(Map.deltaY>(moveMouseYEnd-moveMouseYStart)){shiftY=1}else{if(Map.deltaY<(moveMouseYEnd-moveMouseYStart)){shiftY=-1}else{shiftY=0}}Map.deltaY=(moveMouseYEnd-moveMouseYStart)}else{moveMouseYStart=(e.clientY-offsetIMG.top)-Map.deltaY}objMain.style.left=parseInt(Map.deltaX)+"px";objMain.style.top=parseInt(Map.deltaY)+"px";if(LastdX!=(Math.floor((Map.deltaX-Map.tileLeft)/tileSize))){LastdX=(Math.floor((Map.deltaX-Map.tileLeft)/tileSize));var lastfind=true;var notX=false;while(lastfind){MinX=FindMinX();if(MinX[1]>-tileSize||MinX[0]==0){lastfind=false}else{notX=true;for(yM=0;yM<Map.hhh;yM++){var id_pic=MinX[0];id_pic+=(yM)*Map.www;var tile=document.createElement("img");tile.id=Tiles[id_pic].id;var image=document.getElementById(Tiles[id_pic].id);document.getElementById("belgd_tiles_1").removeChild(image);Tiles[id_pic].placeX+=Map.www;Tiles[id_pic].Left=Tiles[id_pic].placeX*tileSize;tile.className="belgd_img_tile";tile.src=Map.urlMap+Map.num_scale+"/"+ThreeNum(Tiles[id_pic].placeX)+ThreeNum(Tiles[id_pic].placeY)+".png";tile.style.left=parseInt(Tiles[id_pic].Left+Map.tileLeft)+"px";tile.style.top=parseInt(Tiles[id_pic].Top+Map.tileTop)+"px";tile.style.width=tileSize+"px";tile.style.height=tileSize+"px";tile.onerror=function(){if(this.src.indexOf("spacer.gif")==-1){this.src=urlMapF+"/images/navigate/noimage.png"}};document.getElementById("belgd_tiles_1").appendChild(tile)}}}lastfind=true;if(!notX){while(lastfind){MaxX=FindMaxX();if(MaxX[1]<(Map.width+tileSize)||MaxX[0]==0){lastfind=false}else{for(yM=0;yM<Map.hhh;yM++){var id_pic=MaxX[0];id_pic+=(yM)*Map.www;var tile=document.createElement("img");tile.id=Tiles[id_pic].id;var image=document.getElementById(Tiles[id_pic].id);document.getElementById("belgd_tiles_1").removeChild(image);Tiles[id_pic].placeX-=Map.www;Tiles[id_pic].Left=Tiles[id_pic].placeX*tileSize;tile.className="belgd_img_tile";tile.src=Map.urlMap+Map.num_scale+"/"+ThreeNum(Tiles[id_pic].placeX)+ThreeNum(Tiles[id_pic].placeY)+".png";tile.style.left=parseInt(Tiles[id_pic].Left+Map.tileLeft)+"px";tile.style.top=parseInt(Tiles[id_pic].Top+Map.tileTop)+"px";tile.style.width=tileSize+"px";tile.style.height=tileSize+"px";tile.onerror=function(){if(this.src.indexOf("spacer.gif")==-1){this.src=urlMapF+"/images/navigate/noimage.png"}};document.getElementById("belgd_tiles_1").appendChild(tile)}}}}}if(LastdY!=(Math.floor((Map.deltaY-Map.tileTop)/tileSize))){LastdY=(Math.floor((Map.deltaY-Map.tileTop)/tileSize));lastfind=true;notY=false;while(lastfind){MinY=FindMinY();if(MinY[1]>-tileSize||MinY[0]==0){lastfind=false}else{notY=true;for(yM=0;yM<Map.www;yM++){var id_pic=MinY[0]+(yM);var tile=document.createElement("img");tile.id=Tiles[id_pic].id;var image=document.getElementById(Tiles[id_pic].id);document.getElementById("belgd_tiles_1").removeChild(image);Tiles[id_pic].placeY+=Map.hhh;Tiles[id_pic].Top=Tiles[id_pic].placeY*tileSize;tile.className="belgd_img_tile";tile.src=Map.urlMap+Map.num_scale+"/"+ThreeNum(Tiles[id_pic].placeX)+ThreeNum(Tiles[id_pic].placeY)+".png";tile.style.left=parseInt(Tiles[id_pic].Left+Map.tileLeft)+"px";tile.style.top=parseInt(Tiles[id_pic].Top+Map.tileTop)+"px";tile.style.width=tileSize+"px";tile.style.height=tileSize+"px";tile.onerror=function(){if(this.src.indexOf("spacer.gif")==-1){this.src=urlMapF+"/images/navigate/noimage.png"}};document.getElementById("belgd_tiles_1").appendChild(tile)}}}lastfind=true;if(!notY){while(lastfind){MaxY=FindMaxY();if(MaxY[1]<(Map.height+tileSize)||MaxY[0]==0){lastfind=false}else{for(yM=0;yM<Map.www;yM++){var id_pic=MaxY[0]+yM;var tile=document.createElement("img");tile.id=Tiles[id_pic].id;var image=document.getElementById(Tiles[id_pic].id);document.getElementById("belgd_tiles_1").removeChild(image);Tiles[id_pic].placeY-=Map.hhh;Tiles[id_pic].Top=Tiles[id_pic].placeY*tileSize;tile.className="belgd_img_tile";tile.src=Map.urlMap+Map.num_scale+"/"+ThreeNum(Tiles[id_pic].placeX)+ThreeNum(Tiles[id_pic].placeY)+".png";tile.style.left=parseInt(Tiles[id_pic].Left+Map.tileLeft)+"px";tile.style.top=parseInt(Tiles[id_pic].Top+Map.tileTop)+"px";tile.style.width=tileSize+"px";tile.style.height=tileSize+"px";tile.onerror=function(){if(this.src.indexOf("spacer.gif")==-1){this.src=urlMapF+"/images/navigate/noimage.png"}};document.getElementById("belgd_tiles_1").appendChild(tile)}}}}}return false}return false};if(document.getElementById("belgd_main_div").addEventListener){document.getElementById("belgd_main_div").addEventListener("DOMMouseScroll",wheel,false)}document.getElementById("belgd_main_div").onmousewheel=wheel;function wheel(f){if(!f){var f=window.event}var c=f.wheelDelta?(f.wheelDelta/120):f.detail/3*-1;if(f.preventDefault){f.preventDefault()}f.returnValue=false;var d=0;if((Map.num_scale+c)>0&&(Map.num_scale+c)<=Map.max_scale){var b=getOffset(document.getElementById("belgd_main_nd"));moveMouseXStart=(f.clientX-b.left);moveMouseYStart=(f.clientY-b.top);if(c<0){onClickDragW("minimize");d=128-(Map.num_scale-1)*(117/Map.max_scale);document.getElementById("belgd_drag").style.marginTop=d+"px"}else{if(c>0){onClickDragW("maximize");d=128-(Map.num_scale-1)*(117/Map.max_scale);document.getElementById("belgd_drag").style.marginTop=d+"px"}}}}function XYtoBL(g,f,c){if(typeof(c)==="undefined"){c=false}var b=new Array(2);a=6378137;e2=0.00669438;k=0.9996;if(c){n=parseInt(parseInt(g/1000000-5)/6);L0=n*6-3;if(n==0){L0=27}if(n!=0){g=g-(6*n+5)*1000000}}else{L0=27}L0=L0*0.017453292519943295;g=g-500000;f=f/k;Mu=f/(a*((1-e2/4)-(3*e2*e2/64)-(5*e2*e2*e2/256)));Eps=(1-Math.sqrt(1-e2))/(1+Math.sqrt(1-e2));Eps2=Eps*Eps;B1=Mu+((3*Eps/2-27*Eps*Eps2/32)*Math.sin(2*Mu)+(21*Eps2/16-55*Eps2*Eps2/32)*Math.sin(4*Mu)+(151*Eps*Eps2/96)*Math.sin(6*Mu)+(1097*Eps2*Eps2/512)*Math.sin(8*Mu));var d=Math.cos(B1)*Math.cos(B1);var e=Math.sin(B1)*Math.sin(B1);e2_=e2/(1-e2);T1=e/d;C1=e2_*d;N1=a/Math.sqrt(1-e2*e);T12=T1*T1;D=g/(N1*k);Phi=Math.tan(B1)*(1-e2*e)/(1-e2);D2=D*D;B=B1-Phi*(D2/2-(5+3*T1+10*C1-4*C1*C1-9*e2_)*D2*D2/24+(61+90*T1+298*C1+45*T12-252*e2_-3*C1*C1)*D2*D2*D2/720);L=L0+(D-(1+2*T1+C1)*D*D2/6+(5-2*C1+28*T1-3*C1*C1+8*e2_+24*T12)*D2*D2*D/120)/Math.cos(B1);b[0]=L/0.017453292519943295;b[1]=B/0.017453292519943295;return b}function GradToM(b,g,c){if(typeof(c)==="undefined"){c=false}var f=new Array(2);f[0]=0;f[1]=0;a=6378137;e2=0.00669438;k=0.9996;if(c){L0=parseInt((b-0.001)/6)*6+3;n=Math.ceil(L0/6)}else{L0=27}b=b*0.017453292519943295;g=g*0.017453292519943295;L0=L0*0.017453292519943295;var d=Math.cos(g)*Math.cos(g);var e=Math.sin(g)*Math.sin(g);m0=a*(1-e2);m2=1.5*e2*m0;m4=1.25*e2*m2;m6=7/6*(e2*m4);m8=1.125*e2*m6;n0=a;n2=0.5*e2*n0;n4=0.75*e2*n2;n6=5/6*(e2*n4);n8=0.875*e2*n6;a0=m0+m2/2+3*m4/8+5*m6/16+35*m8/128;a2=m2/2+m4/2+15*m6/32+7*m8/16;a4=m4/8+3*m6/16+7*m8/32;a6=m6/32+m8/16;p1=n0+n2+n4+n6+63*n8/128;p2=n2+2*n4+3*n6+13*n8/4;p3=n4+3*n6+19*n8/4;p4=n6+2*n8;Y=a0*g-Math.sin(g)*Math.cos(g)*((a2-a4+a6)+(2*a4-16*a6/3)*e+(16*a6*e*e)/3);N=p1-d*(p2-d*(p3-p4*d));e2_=e2/(1-e2);T=e/d;C=e2_*d;A=(b-L0)*Math.cos(g);A2_=A*A;f[1]=k*N*[A+(1-T+C)*A*A2_/6+(5-18*T+T*T+72*C-58*e2_)*A2_*A2_*A/120];f[0]=k*(Y+N*Math.tan(g)*(A2_/2+(5-T+9*C+4*C*C)*A2_*A2_/24+(61-58*T+T*T+600*C-330*e2_)*A2_*A2_*A2_/720));f[1]=f[1]+500000;if(c){f[1]=f[1]+(6*n+5)*1000000}return f}function onUrlMap(e,c,b){Map.num_scale=parseInt(b);Map.tileWidth=Map.array_scaleX[Map.num_scale-1]-Map.PixelKeyMeterS[Map.num_scale-1];Map.tileHeight=Map.array_scaleY[Map.num_scale-1];arrLL=GradToM(e,c);latRect=arrLL[0];lonRect=arrLL[1];Map.tileLeft=parseInt(-(lonRect-Map.metersXS[Map.num_scale-1])/Map.PixelMeterX[Map.num_scale-1]+Map.width/2);Map.tileTop=parseInt((latRect-Map.metersY)/Map.PixelMeterY[Map.num_scale-1]+Map.height/2);var d=document.getElementById("belgd_poi_1");d.style.top="0px";d.style.left="0px";ViewScale();setTimeout("dragMap()",0);setTimeout("recalcAllPOI()",0)}function getBL(){return Map.LastClickBL}function getData(c,d,b){if(typeof(c)==="undefined"){Map.what_do=!Map.what_do}else{Map.what_do=c}if(Map.what_do==2){if(typeof(d)==="undefined"){firstEdit="";secondEdit=""}else{firstEdit=d;secondEdit=b}}else{if(Map.what_do==0){document.getElementById("belgd_ruler").src="images/navigate/ruler1.png"}else{if(Map.what_do==1){document.getElementById("belgd_ruler").src="images/navigate/ruler1_over.png"}}}}function OblastSelected(b){document.getElementById("belgd_region").innerHTML='<option value="0"> - - - - - - - - - - - - - - -</option>';document.getElementById("belgd_region").outerHTML='<select name="region" size="6" id="belgd_region" onchange="RegionSelected(this.value)"><option value="0"> - - - - - - - - - - - - - - -</option></select>';$.get("getregion.php",{region:b},onRegionSuccess);RegionSelected2(b)}function RegionSelected2(b){if(b==0){return false}document.getElementById("belgd_city").innerHTML='<option value="0">- - - - - - - - - - - - - - -</option>';document.getElementById("belgd_city").outerHTML='<select name="city" size="6" id="belgd_city" class="last"  onchange="CitySelected(this.value)"><option value="0">- - - - - - - - - - - - - - -</option></select>';$.get("getcity2.php",{region:b},onCitySuccess)}function RegionSelected(b){if(b==0){return false}document.getElementById("belgd_city").innerHTML='<option value="0">- - - - - - - - - - - - - - -</option>';document.getElementById("belgd_city").outerHTML='<select name="city" size="6" id="belgd_city" class="last"  onchange="CitySelected(this.value)"><option value="0">- - - - - - - - - - - - - - -</option></select>';$.get("getcity.php",{region:b},onCitySuccess)}function CitySelected(b){if(b==0){return false}def=$.ajax({type:"GET",url:urlMapF+"/getmap.php",data:"city="+b+"&key="+MapApiKey,dataType:"jsonp",success:function(c){onMapSuccess(c.Data)}})}function HouseSelected(b){if(b==0){return false}def=$.ajax({type:"GET",url:urlMapF+"/getmaph.php",data:"city="+b+"&key="+MapApiKey,dataType:"jsonp",success:function(c){onHouseSuccess(c.Data)}})}function onRegionSuccess(b){document.getElementById("belgd_region").innerHTML=b;document.getElementById("belgd_region").outerHTML='<select name="region" size="6" id="belgd_region" onclick="RegionSelected(this.value)" onchange="RegionSelected(this.value)">'+b+"</select>"}function onCitySuccess(c){var b=c.split("|");document.getElementById("belgd_city").innerHTML=b[0];document.getElementById("belgd_city").outerHTML='<select name="city" size="6" id="belgd_city" class="last" onclick="CitySelected(this.value)"  onchange="CitySelected(this.value)">'+b[0]+"</select>";if(b.length>1){onMapSuccessR(b[1],b[2],b[3])}}function onMapSuccess(c){deltaX=0;deltaY=0;var b=c.split(",");Map.num_scale=parseInt(b[2]);Map.tileWidth=Map.array_scaleX[Map.num_scale-1]-Map.PixelKeyMeterS[Map.num_scale-1];Map.tileHeight=Map.array_scaleY[Map.num_scale-1];Map.tileLeft=parseInt(-(b[0]-Map.metersXS[Map.num_scale-1])/Map.PixelMeterX[Map.num_scale-1]+Map.width/2);Map.tileTop=parseInt((b[1]-Map.metersY)/Map.PixelMeterY[Map.num_scale-1]+Map.height/2);ViewScale();dragMap()}function onHouseSuccess(d){document.getElementById("belgd_poi_1").style.display="block";document.getElementById("belgd_poi_1").style.left="0px";document.getElementById("belgd_poi_1").style.top="0px";if(document.getElementById("house")!==null){document.getElementById("belgd_poi_1").removeChild(document.getElementById("house"))}recalcAllPOI("center");deltaX=0;deltaY=0;var b=d.split(",");Map.num_scale=parseInt(b[2]);Map.tileWidth=Map.array_scaleX[Map.num_scale-1]-Map.PixelKeyMeterS[Map.num_scale-1];Map.tileHeight=Map.array_scaleY[Map.num_scale-1];Map.tileLeft=parseInt(-(b[0]-Map.metersXS[Map.num_scale-1])/Map.PixelMeterX[Map.num_scale-1]+Map.width/2);Map.tileTop=parseInt((b[1]-Map.metersY)/Map.PixelMeterY[Map.num_scale-1]+Map.height/2);ViewScale();dragMap();recalcAllPOI();divWidth=Map.array_scaleX[Map.num_scale-1]-Map.PixelKeyMeterS[Map.num_scale-1];divHeight=Map.array_scaleY[Map.num_scale-1];divLeft=Map.tileLeft-parseInt(-(b[0]-Map.metersXS[Map.num_scale-1])/Map.PixelMeterX[Map.num_scale-1]+Map.width/2)+Map.width/2-10;divTop=Map.tileTop-parseInt((b[1]-Map.metersY)/Map.PixelMeterY[Map.num_scale-1]+Map.height/2)+Map.height/2-10;var c=document.createElement("div");c.id="house";c.style.top=parseInt(divTop-16)+"px";c.style.position="absolute";c.style.left=parseInt(divLeft-16)+"px";var e=new Image();e.src=urlMapF+"/images/navigate/where.png";e.style.cursor="pointer";e.setAttribute("height","32");e.setAttribute("width","32");if(Map.typeVector==1){e.runtimeStyle.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="images/navigate/where.png", sizingMethod="crop")';e.src="images/spacer.gif";e.style.width="32px";e.style.height="32px";e.imgY=32;e.imgX=24;e.textcontent=b[0]+"|"+b[1];e.attachEvent("onclick",function(){onShowDescription(b[0]+"|"+b[1]+"|"+b[4]);return false})}else{e.setAttribute("textcontent",b[0]+"|"+b[1]);e.setAttribute("imgY",32);e.setAttribute("imgX",24);e.addEventListener("click",function(){onShowDescription(b[0]+"|"+b[1]+"|"+b[4]);return false},false)}c.appendChild(e);document.getElementById("belgd_poi_1").appendChild(c)}function onMapSuccessR(b,d,c){Map.num_scale=parseInt(c);Map.tileWidth=Map.array_scaleX[Map.num_scale-1]-Map.PixelKeyMeterS[Map.num_scale-1];Map.tileHeight=Map.array_scaleY[Map.num_scale-1];Map.tileLeft=parseInt(-(b-Map.metersXS[Map.num_scale-1])/Map.PixelMeterX[Map.num_scale-1]+350);Map.tileTop=parseInt((d-Map.metersY)/Map.PixelMeterY[Map.num_scale-1]+212);ViewScale();dragMap()}function OnSearch(b){if(b.length==0||b.search("Город, улица, дом")==0){alert("Пожалуйста, заполните поле для поиска!");return 0}def=$.ajax({type:"GET",url:urlMapF+"/search.php",data:"search_text="+b+"&key="+MapApiKey,dataType:"jsonp",success:function(c){onSearchSuccess(c.Data)}})}function onSearchSuccess(c){var b=c.split("|");document.getElementById("belgd_scroll_div").innerHTML=b[2];document.getElementById("belgd_scroll_div").style.height=parseInt(Map.height-20)+"px";document.getElementById("belgd_search_result").style.display="block";first=b[2].indexOf("HouseSelected(");if(first!=-1){second=b[2].indexOf(")",first);HouseSelected(parseInt(b[2].substr(first+14,second-first-14)))}updateSize(false)}function ClearSearchResult(){document.getElementById("belgd_scroll_div").innerHTML="";document.getElementById("belgd_map").style.marginLeft="0";document.getElementById("belgd_search_result").style.display="none";updateSize(false)}function ClearChooseResult(){document.getElementById("belgd_map").style.marginLeft="0";document.getElementById("belgd_choose_result").style.display="none";updateSize(false)}function ShowDescription(b){if(b==0){return false}$.get("getinfo.php",{object:b},onShowDescription)}function onBubble(d,c,b){arrLL=GradToM(d,c);data=arrLL[1]+"|"+arrLL[0]+"|"+b.replace("|","");onShowDescription(data)}function onBubbleID(b){var c=document.getElementById("belgd_p"+b);if(c===null){return}pos=c.innerHTML.indexOf("onShowDescription")+19;poslast=c.innerHTML.lastIndexOf(");")-3;poslast=c.innerHTML.lastIndexOf(",",poslast)-1;if(pos==18){c.firstChild.onclick()}else{data=c.innerHTML.substr(pos,poslast-pos).replace(/&quot;/g,'"').replace(/\\\'/g,"'").replace(/&lt;/g,"<").replace(/&gt;/g,">");onShowDescription(data,b)}}function onShowDescription(f,e){if(typeof(e)==="undefined"){e=0}if(typeof(document.getElementById("belgd_bubles"))!="undefined"&&document.getElementById("belgd_bubles")!=null){onCloseBubble(oldPoiID)}oldPoiID=e;var b=f.split("|");divLeft=Map.tileLeft-parseInt(-(b[0]-Map.metersXS[Map.num_scale-1])/Map.PixelMeterX[Map.num_scale-1]+Map.width/2)+Map.width/2-10;divTop=Map.tileTop-parseInt((b[1]-Map.metersYS[Map.num_scale-1])/Map.PixelMeterY[Map.num_scale-1]+Map.height/2)+Map.height/2-10;divLeft=divLeft-parseInt(document.getElementById("belgd_poi_1").style.left.replace("px",""));divTop=divTop-parseInt(document.getElementById("belgd_poi_1").style.top.replace("px",""));code=b[2].replace(/<\/?(script|embed|applet|object)[^>]*?(>|$)/gi,"");var d={w:280,h:0};d=getDimensions(code,d);d.w=350;if(d.h<80){d.h=80}var c=document.createElement("div");c.id="belgd_bubles";c.style.top=parseInt(divTop-20)+"px";c.style.position="absolute";c.style.zIndex="200";c.style.left=parseInt(divLeft-20)+"px";c.innerHTML='<div textcontent="'+b[0]+"|"+b[1]+'" style="display:none;"></div><div style="position: relative; left: 55px; top: 7px; z-index:200; width: '+(d.w-75)+"px; height: "+d.h+'px; background: #FFFFFF; overflow:hidden;">'+code+'</div><div style="width: 16px; height: 16px; overflow: hidden; z-index: 10000; position: absolute; left: '+(d.w-24)+'px; top: 10px;"><img style="position: absolute; left: -409px; top: -11px; width: 436px; height: 739px; border: 0px none; padding: 0px; margin: 0px; cursor:pointer;" src="'+urlMapF+'/images/navigate/dialog_tut.png" onclick="onCloseBubble(\''+e+'\')" /></div><div style="width: 55px; height: 63px; overflow: hidden; z-index: 1; position: absolute; left: 0px; top: 0px;"><img style="position: absolute; left: 0px; top: 0px; width: 436px; height: 739px; border: 0px none; padding: 0px; margin: 0px;" src="'+urlMapF+'/images/navigate/dialog_tut.png"></div><div style="width: 7px; height: 7px; overflow: hidden; z-index: 1; position: absolute; left: '+(d.w)+'px; top: 0px;"><img style="position: absolute; left: -431px; top: 0px; width: 436px; height: 739px; border: 0px none; padding: 0px; margin: 0px;" src="'+urlMapF+'/images/navigate/dialog_tut.png"></div><div style="width: 7px; height: 7px; overflow: hidden; z-index: 1; position: absolute; left: 31px; top: '+(d.h+5)+'px;"><img src="'+urlMapF+'/images/navigate/dialog_tut.png" style="position: absolute; left: -31px; top: -730px; width: 436px; height: 739px; border: 0px none; padding: 0px; margin: 0px;"></div><div style="width: 7px; height: 7px; overflow: hidden; z-index: 1; position: absolute; left: '+(d.w)+"px; top: "+(d.h+5)+'px;"><img style="position: absolute; left: -431px; top: -730px; width: 436px; height: 739px; border: 0px none; padding: 0px; margin: 0px;" src="'+urlMapF+'/images/navigate/dialog_tut.png"></div><div style="position: absolute; left: 25px; top: 0px; width: '+(d.w-25)+'px; height: 7px; overflow: hidden; "><img style="position: absolute; left: -31px; top: 0px; width: 436px; height: 739px; border: 0px none; padding: 0px; margin: 0px;" src="'+urlMapF+'/images/navigate/dialog_tut.png"></div><div style="position: absolute; left: '+(d.w-22)+"px; top: 7px; width: 27px; height: "+(d.h)+'px; overflow:hidden; "><img style="position: absolute; left: -409px; top: -35px; width: 436px; height: 739px; border: 0px none; padding: 0px; margin: 0px;" src="'+urlMapF+'/images/navigate/dialog_tut.png"></div><div style="position: absolute; left: 31px; top: 63px; width: 27px; height: '+(d.h-58)+'px; overflow:hidden; "><img style="position: absolute; left: -31px; top: -63px; width: 436px; height: 739px; border: 0px none; padding: 0px; margin: 0px;" src="'+urlMapF+'/images/navigate/dialog_tut.png"></div><div style="position: absolute; left: 35px; top: '+(d.h+5)+"px; width: "+(d.w-35)+'px; height: 7px; overflow:hidden; "><img style="position: absolute; left: -40px; top: -730px; width: 436px; height: 739px; border: 0px none; padding: 0px; margin: 0px;" src="'+urlMapF+'/images/navigate/dialog_tut.png"></div>';if(e!="0"){var g=document.getElementById("belgd_p"+e);if(g){g.style.zIndex="220"}}document.getElementById("belgd_poi_1").appendChild(c)}function onCloseBubble(b){if(typeof(b)==="undefined"){b=0}document.getElementById("belgd_poi_1").removeChild(document.getElementById("belgd_bubles"));if(b!=0){var c=document.getElementById("belgd_p"+b);c.style.zIndex="99"}}function addPOI(b,m,g,p,r,s){if(typeof(r)==="undefined"){r=0}if(typeof(s)==="undefined"){s=""}if(typeof(g)==="undefined"){g=""}var h=document.getElementById("belgd_poi_1");var l=0;var d=0;if(h.style.top!=""){d=parseInt(h.style.top.replace("px",""));l=parseInt(h.style.left.replace("px",""))}arrLL=GradToM(b,m);if(g!==""){data=arrLL[1]+"|"+arrLL[0]+"|"+g.replace("|","").replace(/\"/g,"&quot;").replace(/\'/g,"\\'")}else{data=arrLL[1]+"|"+arrLL[0]+"|"}divWidth=Map.array_scaleX[Map.num_scale-1]-Map.PixelKeyMeterS[Map.num_scale-1];divHeight=Map.array_scaleY[Map.num_scale-1];var o=Map.tileLeft-parseInt(-(arrLL[1]-Map.metersXS[Map.num_scale-1])/Map.PixelMeterX[Map.num_scale-1]+Map.width/2)+Map.width/2-l;var f=Map.tileTop-parseInt((arrLL[0]-Map.metersYS[Map.num_scale-1])/Map.PixelMeterY[Map.num_scale-1]+Map.height/2)+Map.height/2-d;var c=document.createElement("img");if(s!==""){var e=document.createElement("div");e.innerHTML=s;e.className="belgd_text_for_poi";if(g!==""){e.style.cursor="pointer";e.setAttribute("onclick","onShowDescription('"+data+"','"+r+"');")}e.setAttribute("textcontent",arrLL[1]+"|"+arrLL[0]);if(e.attachEvent){var q=data;var u=r;var t=function(){onShowDescription(q,u)};if(g!==""){e.attachEvent("onclick",t)}e.textcontent=arrLL[1]+"|"+arrLL[0]}}else{c.style.cursor="pointer";if(g!==""){c.setAttribute("onclick","onShowDescription('"+data+"','"+r+"');")}c.setAttribute("textcontent",arrLL[1]+"|"+arrLL[0]);if(c.attachEvent){var q=data;var u=r;var t=function(){onShowDescription(q,u)};if(g!==""){c.attachEvent("onclick",t)}c.textcontent=arrLL[1]+"|"+arrLL[0]}}c.onload=function(){if(typeof(this.height)==="undefined"){this.imgY=this.clientHeight/2;this.imgX=this.clientWidth/2}else{this.imgY=this.height/2;this.imgX=this.width/2}var v=document.createElement("div");v.className="belgd_for_poi";v.id="belgd_p"+r;v.style.top=parseInt(f-this.imgY)+"px";v.style.position="absolute";v.style.left=parseInt(o-this.imgX)+"px";v.style.zIndex="99";if(s!==""){v.appendChild(e)}v.appendChild(c);document.getElementById("belgd_poi_1").appendChild(v)};c.src=p}function removeAllPOI(){document.getElementById("belgd_poi_1").innerHTML=""}function removePOI(b){if(document.getElementById("belgd_p"+b)===null){return}poiForClose=document.getElementById("belgd_p"+b);if(poiForClose.style.zIndex=="220"){onCloseBubble()}document.getElementById("belgd_poi_1").removeChild(poiForClose)}function recalcAllPOI(scale_factor){var objTiles_poi=document.getElementById("belgd_poi_1");var POIleft=parseInt(objTiles_poi.style.left.replace("px",""));var POItop=parseInt(objTiles_poi.style.top.replace("px",""));var coordXY=new Array(2);var divLeft=0;var divTop=0;var countCh=objTiles_poi.children.length;for(i=0;i<countCh;i++){var image=objTiles_poi.children.item(i);if(image.firstChild!==null){if(typeof(image.firstChild.viewBox)!=="undefined"||image.firstChild.tagName=="group"){if(typeof(image.firstChild.viewBox)!=="undefined"){var countChSVG=image.firstChild.firstChild.childNodes.length;for(j=0;j<countChSVG;j++){myObj=image.firstChild.firstChild.childNodes.item(j);if(typeof(myObj.cx)!=="undefined"){coordXY=myObj.getAttribute("textcontent").split(" ");widthLocalVal=Map.width;heightLocalVal=Map.height;if(scale_factor=="first"){size_div=getSize(document.getElementById("belgd_div_map"));widthLocalVal=size_div.width;heightLocalVal=size_div.height}divLeft=Map.tileLeft-parseInt(-(coordXY[0]-Map.metersXS[Map.num_scale-1])/Map.PixelMeterX[Map.num_scale-1]+widthLocalVal/2)+widthLocalVal/2;divTop=Map.tileTop-parseInt((coordXY[1]-Map.metersYS[Map.num_scale-1])/Map.PixelMeterY[Map.num_scale-1]+heightLocalVal/2)+heightLocalVal/2;divLeft=divLeft-parseInt(POIleft);divTop=divTop-parseInt(POItop);myObj.setAttribute("cx",divLeft);myObj.setAttribute("cy",divTop);whatObj=myObj.getAttribute("id").replace("belgd_circle","");objSVGcircle=document.getElementById("belgd_line"+(parseInt(whatObj)-1));if(objSVGcircle!==null){d_path=objSVGcircle.getAttribute("d");d_path=d_path.substr(0,d_path.indexOf("L")+1);objSVGcircle.setAttribute("d",d_path+" "+divLeft+" "+divTop)}objSVGcircle=document.getElementById("belgd_line"+(parseInt(whatObj)+1));if(objSVGcircle!==null){d_path=objSVGcircle.getAttribute("d");d_path=d_path.substr(d_path.indexOf("L")-1);objSVGcircle.setAttribute("d","M "+divLeft+" "+divTop+" "+d_path)}}}if(countChSVG>0&&distance!=""){SWGDrawDistance()}}else{var countChVML=image.firstChild.children.length;for(j=0;j<countChVML;j++){myObj=image.firstChild.children.item(j);if(myObj.tagName=="oval"){coordXY=myObj.textcontent.split(" ");widthLocalVal=Map.width;heightLocalVal=Map.height;if(scale_factor=="first"){size_div=getSize(document.getElementById("belgd_div_map"));widthLocalVal=size_div.width;heightLocalVal=size_div.height}divLeft=Map.tileLeft-parseInt(-(coordXY[0]-Map.metersXS[Map.num_scale-1])/Map.PixelMeterX[Map.num_scale-1]+widthLocalVal/2)+widthLocalVal/2;divTop=Map.tileTop-parseInt((coordXY[1]-Map.metersYS[Map.num_scale-1])/Map.PixelMeterY[Map.num_scale-1]+heightLocalVal/2)+heightLocalVal/2;divLeft=divLeft-parseInt(POIleft);divTop=divTop-parseInt(POItop);with(myObj.style){top=parseInt(divTop-5)+"px";left=parseInt(divLeft-5)+"px"}whatObj=myObj.id.replace("belgd_circle","");objVMLcircle=document.getElementById("belgd_line"+(parseInt(whatObj)-1));if(objVMLcircle!==null){objVMLcircle.from=objVMLcircle.from;objVMLcircle.to=divLeft+","+divTop}objVMLcircle=document.getElementById("belgd_line"+(parseInt(whatObj)+1));if(objVMLcircle!==null){objVMLcircle.from=divLeft+","+divTop;objVMLcircle.to=objVMLcircle.to}}}if(countChVML>0&&distance!=""){VMLDrawDistance()}}}else{if(typeof(image.innerHTML)!=="undefined"){if(image.children.length>0){var tmpImg=image.children.item(0);if(typeof(tmpImg.attributes.textcontent)!=="undefined"){tmpImg=tmpImg.attributes.textcontent.value;coordXY=tmpImg.split("|")}else{tmpImg=image.children.item(1);if(typeof(tmpImg.attributes.textcontent)!=="undefined"){tmpImg=tmpImg.attributes.textcontent.value;coordXY=tmpImg.split("|")}}}if(typeof(coordXY[1])!=="undefined"){widthLocalVal=Map.width;heightLocalVal=Map.height;if(scale_factor=="first"){size_div=getSize(document.getElementById("belgd_div_map"));widthLocalVal=size_div.width;heightLocalVal=size_div.height}divLeft=Map.tileLeft-parseFloat(-(coordXY[0]-Map.metersXS[Map.num_scale-1])/Map.PixelMeterX[Map.num_scale-1]+widthLocalVal/2)+widthLocalVal/2;divTop=Map.tileTop-parseFloat((coordXY[1]-Map.metersYS[Map.num_scale-1])/Map.PixelMeterY[Map.num_scale-1]+heightLocalVal/2)+heightLocalVal/2;divLeft=divLeft-parseFloat(POIleft);divTop=divTop-parseFloat(POItop);heightTemp=0;widthTemp=0;if(image.children.length>0){var tmpImg=image.children.item(0);if(typeof(tmpImg.attributes.imgY)!=="undefined"){heightTemp=tmpImg.attributes.imgY.value;widthTemp=tmpImg.attributes.imgX.value}else{if(typeof(tmpImg.imgY)!=="undefined"){heightTemp=tmpImg.imgY;widthTemp=tmpImg.imgX}else{tmpImg=image.children.item(1);if(tmpImg!=null){if(typeof(tmpImg.attributes.imgY)!=="undefined"){heightTemp=tmpImg.attributes.imgY.value;widthTemp=tmpImg.attributes.imgX.value}else{if(typeof(tmpImg.imgY)!=="undefined"){heightTemp=tmpImg.imgY;widthTemp=tmpImg.imgX}}}}}if(isNaN(divTop)){divTop=0}if(isNaN(divLeft)){divLeft=0}if(isNaN(widthTemp)){widthTemp=0}if(isNaN(heightTemp)){heightTemp=0}image.style.top=parseFloat(divTop-heightTemp)+"px";image.style.position="absolute";image.style.left=parseFloat(divLeft-widthTemp)+"px"}}}}}}var objTiles_bubles=document.getElementById("belgd_bubles");if(objTiles_bubles!==null){coordXY=objTiles_bubles.children.item(0).attributes.textcontent.value.split("|");widthLocalVal=Map.width;heightLocalVal=Map.height;if(scale_factor=="first"){size_div=getSize(document.getElementById("belgd_div_map"));widthLocalVal=size_div.width;heightLocalVal=size_div.height}divLeft=Map.tileLeft-parseInt(-(coordXY[0]-Map.metersXS[Map.num_scale-1])/Map.PixelMeterX[Map.num_scale-1]+widthLocalVal/2)+widthLocalVal/2-10;divTop=Map.tileTop-parseInt((coordXY[1]-Map.metersYS[Map.num_scale-1])/Map.PixelMeterY[Map.num_scale-1]+heightLocalVal/2)+heightLocalVal/2-10;divLeft=divLeft-parseInt(document.getElementById("belgd_poi_1").style.left.replace("px",""));divTop=divTop-parseInt(document.getElementById("belgd_poi_1").style.top.replace("px",""));code=objTiles_bubles.children.item(1).innerHTML;var size={w:350,h:80};size=getDimensions(code,size);if(Map.height/(size.h)<2){size.w=size.w*Map.height/(size.h);size.h=0;size=getDimensions(code,size)}if(size.h<80){size.h=80}objTiles_bubles.style.top=parseInt(divTop-20)+"px";objTiles_bubles.style.left=parseInt(divLeft-20)+"px"}}function getMapStatus(){var c=new Array(2);var b=new Array(2);var d=new Array(7);c[1]=parseInt((Map.width/2-Map.tileLeft)*Map.PixelMeterX[Map.num_scale-1]+Map.metersXS[Map.num_scale-1]);c[0]=parseInt((Map.tileTop-Map.height/2)*Map.PixelMeterY[Map.num_scale-1]+Map.metersY);b=XYtoBL(c[1],c[0]);d[0]=Map.num_scale;d[1]=b[0];d[2]=b[1];c[1]=parseInt((0-Map.tileLeft)*Map.PixelMeterX[Map.num_scale-1]+Map.metersXS[Map.num_scale-1]);c[0]=parseInt((Map.tileTop-Map.height)*Map.PixelMeterY[Map.num_scale-1]+Map.metersY);b=XYtoBL(c[1],c[0]);d[3]=b[0];d[4]=b[1];c[1]=parseInt((Map.width-Map.tileLeft)*Map.PixelMeterX[Map.num_scale-1]+Map.metersXS[Map.num_scale-1]);c[0]=parseInt((Map.tileTop)*Map.PixelMeterY[Map.num_scale-1]+Map.metersY);b=XYtoBL(c[1],c[0]);d[5]=b[0];d[6]=b[1];return d}function getDimensions(c,s){var p,f;var b=document.createElement("div");b.id="belgd_bubles";b.style.visibility="hidden";var r=document.body;if(s){if(s.w){p=s.w;b.style.width=p+"px"}else{if(s.h){f=s.h;b.style.height=f+"px"}}}var g=document.createElement("div");g.innerHTML=c;g.style.overflow="visible";if(g.childNodes){for(var e=0,d=g.childNodes.length;e<d;e++){if(!g.childNodes[e].style){continue}g.childNodes[e].style.overflow="visible"}}b.appendChild(g);r.appendChild(b);var q=false;var o=b.parentNode;while(o&&o.tagName.toLowerCase()!="body"){var m=OpenLayers.Element.getStyle(o,"position");if(m=="absolute"){q=true;break}else{if(m&&m!="static"){break}}o=o.parentNode}if(!q){b.style.position="absolute"}if(!p){p=parseInt(g.scrollWidth);b.style.width=p+"px"}if(!f){f=parseInt(g.scrollHeight)}b.removeChild(g);r.removeChild(b);s.w=p;s.h=f;return s};
