// Copyright (c) Position s.r.o.
// All rights reserved.

var ngMapVer=1,ngMapSubVer=1,ngMapAPIVersion=ngMapVer+"."+ngMapSubVer,ngMapAPIKey="",ngCurrentMap=null,ngMouseMap=null,ngKeyMap=null,CTRL_DOWN=false,PROJ_WGS="WGS-84",PROJ_UTM="UTM",curZoomIn=101,curZoomOut=102,curPan=103,curDefault=0,OnKeyDownBefore=null,OnKeyDownAfter=null,OnKeyUpBefore=null,OnKeyUpAfter=null,OnMouseDownBefore=null,OnMouseDownAfter=null,OnMouseUpBefore=null,OnMouseUpAfter=null,OnMouseMoveBefore=null,OnMouseMoveAfter=null,OnDblClickBefore=null,OnDblClickAfter=null,OnMouseWheelBefore=
null,OnMouseWheelAfter=null,ngMapEventsInitialized=false;function PosProj(b,a){if(a!="")b=a+";"+b;return b}function FormatScale(b){b=String(b);var a=b.indexOf(".");if(a<0)a=b.indexOf(",");if(a>=0)b=b.substring(0,a);var c,d="";c=0;for(a=b.length-1;a>=0;a--){if(c!=0&&c%3==0)d=" "+d;d=b.charAt(a)+d;c++}return d}
function PopupIcon(b,a,c,d,e){this.id=b;this.url=a;this.pos=c;this.descr=d;this.hotspot=e;this.update=true;if(a!=""){this.icon=ngPreloadedImages[a];if(typeof this.icon!="object")this.icon=ng_PreloadImage(a)}else this.icon=null}function ng_StartAnimation(){this.LastAnimationTime=(new Date).getTime();if(!this.AnimationStarted){this.AnimationStarted=true;this.OnStartAnimation&&this.OnStartAnimation(this)}}
function ng_EndAnimation(){if(this.AnimationStarted){this.AnimationStarted=false;this.OnEndAnimation&&this.OnEndAnimation(this)}}function ng_CancelMapMove(){this.EndAnimation();this.PanNoPosChanged=false;this.PanTimer&&clearTimeout(this.PanTimer);this.PanTimer=null}
function ng_DoPan(b){var a=getMapByID(b);if(a){a.PanTimer&&clearTimeout(a.PanTimer);a.PanTimer=null;for(var c=a.LastAnimationTime,d=0,e=1;d<e;){a.PanX+=a.PanSX;a.PanY+=a.PanSY;if(a.PanSX<0){if(a.PanDX-a.PanX>a.PanSX)a.PanSX=a.PanDX-a.PanX}else if(a.PanDX-a.PanX<a.PanSX)a.PanSX=a.PanDX-a.PanX;if(a.PanSY<0){if(a.PanDY-a.PanY>a.PanSY)a.PanSY=a.PanDY-a.PanY}else if(a.PanDY-a.PanY<a.PanSY)a.PanSY=a.PanDY-a.PanY;if(!d||a.PanSX==0&&a.PanSY==0){a.SetMapOffsetEx(a.PanStartX+a.PanX,a.PanStartY+a.PanY);if(a.PanSX==
0&&a.PanSY==0)break}if(!d&&c){e=((new Date).getTime()-c)/a.PanDelay;var f=a.PanMinInterval/a.PanDelay/4;if(e>f)e=f}d++}a.LastAnimationTime=(new Date).getTime()+a.PanDelay;if(a.PanSX!=0||a.PanSY!=0)a.PanTimer=setTimeout("ng_DoPan('"+b+"');",a.PanDelay);else{a.PanNoPosChanged||a.MapCommand("P");a.EndAnimation()}}}
function ng_DoImageZoomAnim(b){var a=getMapByID(b);if(a){a.PanTimer&&clearTimeout(a.PanTimer);a.PanTimer=null;for(var c,d=a.LastAnimationTime,e=0,f=1;e<f;){a.ImageZoomC+=a.ImageZoomD;if(a.ImageZoomD<0){if(a.ImageZoomF-a.ImageZoomC>a.ImageZoomD)a.ImageZoomD=a.ImageZoomF-a.ImageZoomC}else if(a.ImageZoomF-a.ImageZoomC<a.ImageZoomD)a.ImageZoomD=a.ImageZoomF-a.ImageZoomC;if(!e||a.ImageZoomD==0){if(a.ImageZoomNC)a.SetImageZoom(a.ImageZoomC,a.ImageZoomL,a.ImageZoomX,a.ImageZoomY,a.ImageZoomCX,a.ImageZoomCY);
else{c=a.ImageZoomF>a.ImageZoomS?(a.ImageZoomF-a.ImageZoomC)/(a.ImageZoomF-a.ImageZoomS):(a.ImageZoomC-a.ImageZoomF)/(a.ImageZoomS-a.ImageZoomF);c=1-c*a.ImageZoomC;a.SetImageZoom(a.ImageZoomC,a.ImageZoomL,a.ImageZoomX-a.ImageZoomDX*c,a.ImageZoomY-a.ImageZoomDY*c,a.ImageZoomCX+a.ImageZoomDX*c,a.ImageZoomCY+a.ImageZoomDY*c)}if(a.ImageZoomD==0)break}if(!e&&d){f=((new Date).getTime()-d)/a.PanDelay;c=a.PanMinInterval/a.PanDelay/4;if(f>c)f=c}e++}a.LastAnimationTime=(new Date).getTime()+a.PanDelay;if(a.ImageZoomD!=
0)a.PanTimer=setTimeout("ng_DoImageZoomAnim('"+b+"');",a.PanDelay);else{a.CancelImageZoomAnim();a.EndAnimation()}}}function ng_ImageZoomAnimFinished(){this.TileLoadingCnt<=0&&this.ImageZoomL==-1&&this.HideSecondMapLayer()}
function ng_CancelImageZoomAnim(){if(this.ImageZoomPan){this.ImageZoomPan==1&&this.SetMapOffset(this.ImageZoomPanX,this.ImageZoomPanY);this.ImageZoomPan==2&&this.SetMapOffsetEx(this.ImageZoomPanX,this.ImageZoomPanY);this.ImageZoomPan=0}if(this.ImageZoomL!=-1){this.CancelMapMove();this.SwapMapLayers(this.MapLayer==1?2:1);this.ImageZoomL=-1;this.ShowCanvas();this.ImageZoomAnimFinished()}}
function ng_ImageZoomAnim(b,a,c,d,e,f,g){this.ImageZoomHookPan=false;if(this.ImageZoomL!=-1){this.HideCanvas();this.CancelMapMove();this.ClearCanvas();if(this.ZoomAnimation){this.ImageZoomX=b;this.ImageZoomY=a;c+=(this.MapWidth-this.TileWidth)/2;d+=(this.MapHeight-this.TileHeight)/2;this.ImageZoomDX=this.MapWidth/2-c;this.ImageZoomDY=this.MapHeight/2-d;this.ImageZoomCX=c;this.ImageZoomCY=d;this.ImageZoomC=this.ImageZoomS=e;this.ImageZoomF=f;this.ImageZoomNC=typeof g!="undefined"?g:false;this.ImageZoomD=
(this.ImageZoomF-this.ImageZoomC)/(this.PanMinInterval/this.PanDelay);this.StartAnimation();ng_DoImageZoomAnim(this.MapID)}else this.CancelImageZoomAnim()}}
function ng_Pan(b,a){this.HideSecondMapLayer();this.CancelMapCommand();this.CancelMapMove();this.HideMapMenu();this.HidePopup();this.CancelDisplayPopup();if(this.PanAnimation){this.PanDX=b;this.PanDY=a;this.PanStartX=this.X;this.PanStartY=this.Y;this.PanY=this.PanX=0;this.PanSX=b/(this.PanMinInterval/this.PanDelay);this.PanSY=a/(this.PanMinInterval/this.PanDelay);this.StartAnimation();ng_DoPan(this.MapID)}else{this.SetMapOffsetEx(this.X+b,this.Y+a);this.PanNoPosChanged||this.PositionChanged()}}
function ng_EnterMap(b){if(!b)b=window.event;if(this.ngMap&&(!ngCurrentMap||ng_CheckMouseEnter(this,b))){if(ngCurrentMap)ngCurrentMap.MouseOnMap=false;ngCurrentMap=this.ngMap;ngCurrentMap.MouseOnMap=true;ngCurrentMap.OnMouseEnter&&ngCurrentMap.OnMouseEnter(ngCurrentMap)}}
function ng_LeaveMap(b){if(!b)b=window.event;if(this.ngMap==ngCurrentMap&&ng_CheckMouseLeave(this,b)){if(ngCurrentMap){ngCurrentMap.MouseOnMap=false;ngCurrentMap.OnMouseLeave&&ngCurrentMap.OnMouseLeave(ngCurrentMap)}ngCurrentMap=null}}function ng_MapContainerLeft(){var b=this.ObjMap[0];if(b)return ng_findPosX(b);return 0}function ng_MapContainerTop(){var b=this.ObjMap[0];if(b)return ng_findPosY(b);return 0}
function ng_GetMousePosition(b){if(!b)b=window.event;var a=this.MouseX,c=this.MouseY;this.MouseX=(b.clientX?b.clientX:b.offsetX)-this.MapContainerLeft()+ng_DocumentScrollX();this.MouseY=(b.clientY?b.clientY:b.offsetY)-this.MapContainerTop()+ng_DocumentScrollY();this.OnGetMousePosition&&this.OnGetMousePosition(this);if(isNaN(this.MouseX))this.MouseX=a;if(isNaN(this.MouseY))this.MouseY=c}
function ng_SetCursor(b){var a="",c=this.MouseEvents;switch(b){case curDefault:a="";break;case curZoomIn:a=this.CursorZoomIn;break;case curZoomOut:a=this.CursorZoomOut;break;case curPan:a=this.CursorPan;break;default:a=b;c=true;break}if(this.CurrentCursor!=a){if(c){if(this.ObjMap[1])try{this.ObjMap[1].style.cursor=a}catch(d){}if(this.ObjMap[2])try{this.ObjMap[2].style.cursor=a}catch(e){}if(this.ObjCanvasDC)try{this.ObjCanvasDC.style.cursor=a}catch(f){}if(this.ObjSelRect)try{this.ObjSelRect.style.cursor=
a}catch(g){}if(this.ObjSelRect2)try{this.ObjSelRect2.style.cursor=a}catch(h){}if(this.ObjPreview)try{this.ObjPreview.style.cursor=a}catch(k){}if(b=document.getElementById(this.MapID+"_ImgMap"))try{b.style.cursor=a}catch(l){}}this.CurrentCursor=a}}function ng_SyncCursor(b,a){if(b=getMapByID(b))try{if(a.style.cursor!=b.CurrentCursor)a.style.cursor=b.CurrentCursor}catch(c){}}
function ng_UpdateRect(){var b=this.ObjSelRect,a=this.ObjSelRect2;if(b&&a){a.style.width=b.style.width;a.style.height=b.style.height;a.style.left=b.style.left;a.style.top=b.style.top;a.style.visibility=b.style.visibility}}function ng_UpdateRectIE(){var b=this.ObjSelRect,a=this.ObjSelRect2;if(b&&a){a.style.pixelWidth=b.style.pixelWidth;a.style.pixelHeight=b.style.pixelHeight;a.style.pixelLeft=b.style.pixelLeft;a.style.pixelTop=b.style.pixelTop;a.style.visibility=b.style.visibility}}
function ng_EnterMapMenu(b){if(!b)b=window.event;if(ng_CheckMouseEnter(this,b))if(this.ngMap)this.ngMap.InMapMenu=true}function ng_LeaveMapMenu(b){if(!b)b=window.event;if(ng_CheckMouseLeave(this,b))if(this.ngMap){this.ngMap.InMapMenu=false;this.ngMap.HideMapMenuTimer=setTimeout("ng_HideMapMenuTimer('"+this.ngMap.MapID+"');",100)}}function ng_HideMapMenuTimer(b){(b=getMapByID(b))&&!b.InMapMenu&&b.HideMapMenu()}
function ng_HideMapMenu(){clearTimeout(this.HideMapMenuTimer);var b=this.ObjMenu;if(b){if(this.PopupX==this.MapMenuX&&this.PopupY==this.MapMenuY)this.PopupY=this.PopupX=-1000;this.MapMenuY=this.MapMenuX=-1000;this.InMapMenu=false;b.style.visibility="hidden";b.innerHTML=""}}
function OnMapMouseDown(b){if(!b)b=window.event;if(OnMouseDownBefore&&!OnMouseDownBefore(b))return true;var a=ngCurrentMap;if(a&&!a.InPopupRect&&!a.InMapMenu){if(a.OnMapMenu){clearTimeout(a.MapMenuTimer);a.MapMenuTimer=null}a.HidePopup();a.GetMousePosition(b);if(!a.OnMouseDown||a.OnMouseDown(a,b))if(a.MouseEvents){b.preventDefault&&b.preventDefault();if(ngOpera&&ngOperaVersion<10.5&&a.OnMapMenu&&a.MapMenuTimeout>0)a.MapMenuTimer=setTimeout("ng_ShowMapMenuTimer("+a.MouseX+","+a.MouseY+",'"+a.MapID+
"');",a.MapMenuTimeout);if(b.button==2){if((!ngOpera||ngOperaVersion>=10.5)&&a.OnMapMenu&&a.MapMenuTimeout>0)a.MapMenuTimer=setTimeout("ng_ShowMapMenuTimer("+a.MouseX+","+a.MouseY+",'"+a.MapID+"');",a.MapMenuTimeout)}else{a.MouseSelLeft=a.MouseX;a.MouseSelRight=a.MouseX;a.MouseSelTop=a.MouseY;a.MouseSelBottom=a.MouseY;if(a.MouseMode=="R"){var c=a.ObjSelRect;if(c){ng_setBounds(c,a.MouseSelLeft,a.MouseSelTop,0,0);c.style.visibility="visible";a.UpdateRect()}}if(a.Mode=="Z+"||a.Mode=="Z-")a.CancelMapCommand();
if(a.Mode=="P"){a.CancelMapCommand();a.MousePanMoved=false}}a.MouseDown=b.button==2?2:1;ngMouseMap=a}}if(OnMouseDownAfter){b=OnMouseDownAfter(b);if(typeof b!="undefined")return b}return true}
function OnMapMouseMove(b){if(!b)b=window.event;ngIExplorer&&ngMouseMap&&ngMouseMap.MouseDown&&!b.button&&OnMapMouseUp(b);if(OnMouseMoveBefore&&!OnMouseMoveBefore(b))return true;var a=ngMouseMap;if(a){a.GetMousePosition(b);if(!a.OnMouseMove||a.OnMouseMove(a,b))if(a.MouseDown){var c=a.MouseX,d=a.MouseY;a.MouseSelRight=c;a.MouseSelBottom=d;if(a.MouseMode=="R"){var e=a.ObjSelRect;if(e){if(c>a.MouseSelLeft)if(ngIExplorer){e.style.pixelWidth=c-a.MouseSelLeft;e.style.pixelLeft=a.MouseSelLeft}else{e.style.width=
c-a.MouseSelLeft+"px";e.style.left=a.MouseSelLeft+"px"}else if(ngIExplorer){e.style.pixelWidth=a.MouseSelLeft-c;e.style.pixelLeft=c}else{e.style.width=a.MouseSelLeft-c+"px";e.style.left=c+"px"}if(d>a.MouseSelTop)if(ngIExplorer){e.style.pixelHeight=d-a.MouseSelTop;e.style.pixelTop=a.MouseSelTop}else{e.style.height=d-a.MouseSelTop+"px";e.style.top=a.MouseSelTop+"px"}else if(ngIExplorer){e.style.pixelHeight=a.MouseSelTop-d;e.style.pixelTop=d}else{e.style.height=a.MouseSelTop-d+"px";e.style.top=d+"px"}a.UpdateRect()}}if(a.MouseMode==
"P"){e=a.MouseSelRight-a.MouseSelLeft;var f=a.MouseSelBottom-a.MouseSelTop;a.MouseSelLeft=c;a.MouseSelTop=d;a.CancelImageZoomAnim();if(a.Mode=="P")if(e||f){a.MousePanMoved=true;a.SetMapOffsetEx(a.X-e,a.Y-f)}}}}else if(ngCurrentMap){a=ngCurrentMap;a.GetMousePosition(b)}if(a&&a.DisplayPopupTimer)if(a.DisplayPopupTimerMX!=a.MouseX||a.DisplayPopupTimerMY!=a.MouseY){clearTimeout(a.DisplayPopupTimer);a.DisplayPopupTimerMX=a.MouseX;a.DisplayPopupTimerMY=a.MouseY;if(a.DisplayPopupTimeout)a.DisplayPopupTimer=
setTimeout("ngAPU2('"+a.MapID+"');",a.DisplayPopupTimeout)}if(OnMouseMoveAfter){b=OnMouseMoveAfter(b);if(typeof b!="undefined"){a&&a.IEForceUpdate();return b}}a&&a.IEForceUpdate();return true}function OnMapMouseOut(b){if(!b)b=window.event;var a=ngMouseMap;a&&a.MouseDown&&!ngIExplorer&&!b.relatedTarget&&OnMapMouseUp(b);return true}
function ng_ShowMapMenuTimer(b,a,c){if((c=getMapByID(c))&&c.OnMapMenu&&b==c.MouseX&&a==c.MouseY){c.MapMenuX=c.MouseX;c.MapMenuY=c.MouseY;c.PopupX=c.MapMenuX;c.PopupY=c.MapMenuY;if(b=c.ObjMenu){a=c.OnMapMenu(c);if(a!=""){clearTimeout(c.HideMapMenuTimer);c.CreatePopup(b,c.MouseX,c.MouseY,a,0,0);c.MouseDown=0;ngMouseMap=null;return false}}}}
function OnMapMouseUp(b){var a=ngMouseMap;if(a&&a.OnMapMenu){clearTimeout(a.MapMenuTimer);a.MapMenuTimer=null}if(!b)b=window.event;if(OnMouseUpBefore&&!OnMouseUpBefore(b)){a.MouseDown=0;ngMouseMap=null;return true}if(a){a.GetMousePosition(b);var c=!a.OnMouseUp||a.OnMouseUp(a,b),d=a.MouseDown;a.MouseDown=0;ngMouseMap=null;if(c)if(d)if(d==2)if(a.OnMapMenu&&a.MapMenuTimeout<=0)ng_ShowMapMenuTimer(a.MapID);else{a.MouseZoomOut&&a.ZoomOut();return true}else{a.MouseSelRight=a.MouseX;a.MouseSelBottom=a.MouseY;
if(a.MouseMode=="R"||a.MouseMode=="P"){if(c=a.ObjSelRect)c.style.visibility="hidden";a.UpdateRect()}if(a.Mode=="Z+"){a.CancelImageZoomAnim();a.ZoomIn(a.MouseSelLeft,a.MouseSelTop,a.MouseSelRight,a.MouseSelBottom)}if(a.Mode=="Z-"){a.CancelImageZoomAnim();a.ZoomOut()}a.Mode=="P"&&a.MousePanMoved&&a.PositionChanged()}}if(OnMouseUpAfter){b=OnMouseUpAfter(b);if(typeof b!="undefined")return b}return true}
function OnMapDblClick(b){if(!b)b=window.event;if(OnDblClickBefore&&!OnDblClickBefore(b))return true;var a=ngCurrentMap;if(a&&!a.InPopupRect&&!a.InMapMenu){if(a.OnMapMenu){clearTimeout(a.MapMenuTimer);a.MapMenuTimer=null}a.HidePopup();a.GetMousePosition(b);if(!a.OnDblClick||a.OnDblClick(a,b))if(a.MouseEvents)if(a.Mode=="P")if(b.button==0)a.PreviewParent?a.Center(a.MouseX,a.MouseY):a.ZoomIn(a.MouseX,a.MouseY)}if(OnDblClickAfter){b=OnDblClickAfter(b);if(typeof b!="undefined")return b}return true}
function OnMapWheel(b){if(!b)b=window.event;if(OnMouseWheelBefore&&!OnMouseWheelBefore(b))return true;var a=ngCurrentMap;if(a)if(!a.OnMouseWheel||a.OnMouseWheel(a,b))if(a.MouseEvents&&a.MouseWheel){var c=0;if(b.detail)c=-b.detail/3;else if(b.wheelDelta){c=b.wheelDelta/120;if(window.opera)c=-c}if(c){a.HidePopup();var d=a.MouseWheelMode;if(d==0)d=a.Mode=="Z+"||a.Mode=="Z-"?2:1;if(d==2){if(!a.AnimationStarted||!a.KeyScroll)a.KeyScroll=a.KeyScrollStart;else if(a.KeyScroll<a.KeyScrollMax)a.KeyScroll+=
a.KeyScrollDelta*Math.abs(c);c<0?a.Pan(0,a.KeyScroll):a.Pan(0,-a.KeyScroll)}else if(!a.AnimationStarted)if(a.LimitCommandFreq(1E3)){c<0?a.ZoomOut(a.MouseX,a.MouseY,true):a.ZoomIn(a.MouseX,a.MouseY,a.MouseX,a.MouseY,true);a.EndLimitCommand()}}b.preventDefault&&b.preventDefault();b.returnValue=false}if(OnMouseWheelAfter){b=OnMouseWheelAfter(b);if(typeof b!="undefined")return b}return true}
function ng_SwapMapLayers(b){var a=this.ObjMap[1],c=this.ObjMap[2];if(a&&c)if(b==1){a.style.zIndex=1;c.style.zIndex=2}else{a.style.zIndex=2;c.style.zIndex=1}}function ng_HideSecondMapLayer(){this.ClearMapLayer(this.MapLayer==1?2:1)}function ng_GetMapLayer(){return this.MapLayer}function ng_ResetLoadEvents(b){b.onload=null;b.onabort=null;b.onerror=null}
function ng_CancelTileLoading(b){var a,c,d;for(c=0;c<this.TileRowCount;c++)for(a=0;a<this.TileColCount;a++)if(d=this.Tiles[b][c][a])if(this.TileLoading[b][c][a]){ng_ResetLoadEvents(d);this.TileLoading[b][c][a]=false;this.TileLoadingCnt--;d.src=ngEmptyURL;if(this.TileLoadingCnt<=0){this.TileLoadingCnt=0;this.OnTilesLoaded&&this.OnTilesLoaded(this)}}}
function ng_ClearMapLayer(b){if(b!=this.LastClearedLayer){this.LastClearedLayer=b;var a,c,d;for(c=0;c<this.TileRowCount;c++)for(a=0;a<this.TileColCount;a++)if(d=this.Tiles[b][c][a]){d.style.visibility="hidden";if(this.TileLoading[b][c][a]){ng_ResetLoadEvents(d);this.TileLoading[b][c][a]=false;this.TileLoadingCnt--;d.src=ngEmptyURL;if(this.TileLoadingCnt<=0){this.TileLoadingCnt=0;this.OnTilesLoaded&&this.OnTilesLoaded(this)}}}}}
function ng_Offset(b,a,c){typeof c=="undefined"||c?this.SetMapOffset(b,a):this.SetMapOffsetEx(b,a);this.PositionChanged()}
function ng_SetMapOffset(b,a){if(this.ImageZoomHookPan){this.ImageZoomPan=1;this.ImageZoomPanX=b;this.ImageZoomPanY=a}else{b=Math.round(b);a=Math.round(a);if(this.X!=b||this.Y!=a||this.MapNeedRefresh){var c=b-this.X,d=a-this.Y,e=2*this.MapWidth,f=2*this.MapHeight;if(e<400)e=400;if(f<400)f=400;if(this.MapNeedRefresh||Math.abs(c)>e||Math.abs(d)>f||Math.abs(c)<=3&&Math.abs(d)<=3)this.SetMapOffsetEx(b,a);else{this.Pan(c,d);this.PanNoPosChanged=true}}}}
function ng_SetMapOffsetEx(b,a){if(this.ImageZoomHookPan){this.ImageZoomPan=2;this.ImageZoomPanX=b;this.ImageZoomPanY=a}else{b=Math.round(b);a=Math.round(a);if(this.Initialized){if((this.X!=b||this.Y!=a||this.MapNeedRefresh)&&this.MapURL!=""&&(!this.OnOffsetChanging||this.OnOffsetChanging(this,b,a))){var c,d,e,f,g,h,k,l,m,s;this.X=b;this.Y=a;!this.InCmd&&this.TileLoadingCnt>0&&this.HideSecondMapLayer();this.TilesCanceledByCommand=false;var n=Math.round((b-this.TileColCount*this.TileWidth/2)/this.TileWidth+
0.5),p=Math.round((a-this.TileRowCount*this.TileHeight/2)/this.TileHeight+0.5);this.TileOffsetX=Math.round(this.MapWidth/2+(n*this.TileWidth-b)-this.TileWidth/2);this.TileOffsetY=Math.round(this.MapHeight/2+(p*this.TileHeight-a)-this.TileHeight/2);(c=this.ObjMap[this.MapLayer])&&ng_setLeftTop(c,this.TileOffsetX,this.TileOffsetY);this.SetCanvasOffset(this.CanvasX-b,this.CanvasY-a);this.LastTileStx=n;this.LastTileSty=p;h=n%this.TileColCount;k=p%this.TileRowCount;if(h<0)h+=this.TileColCount;if(k<0)k+=
this.TileRowCount;var t=h;a=0;b=this.ObjMap[this.MapLayer];this.OnTilesLoading&&this.TileLoadingCnt<=0&&this.OnTilesLoading(this);this.TileLoadingCnt++;var q=[];e=this.MapWidth/2+this.TileWidth;d=this.MapHeight/2+this.TileHeight;var r=Math.sqrt(e*e+d*d);if(r<1)r=1;var u=this.TileRowCount*this.TileColCount;for(g=0;g<this.TileRowCount;g++){b=0;h=t;for(f=0;f<this.TileColCount;f++){if(c=this.Tiles[this.MapLayer][k][h]){e=ng_AddURLParam(ngHTTPProtocol+this.MapURL,"PX="+(n+f)+"&PY="+(p+g));if(c.src!=e){l=
b+this.TileOffsetX;d=a+this.TileOffsetY;m=l+this.TileWidth;s=d+this.TileHeight;if(m<0||s<0||l>=this.MapWidth||d>=this.MapHeight){ng_setBounds(c,b,a,this.TileWidth,this.TileHeight);c.style.visibility="hidden"}else{this.TileLoading[this.MapLayer][k][h]||this.TileLoadingCnt++;this.TileLoading[this.MapLayer][k][h]=true;c.style.visibility="hidden";ng_setBounds(c,b,a,this.TileWidth,this.TileHeight);c.onload=ng_TileLoaded;c.onerror=ng_TileFailed;c.onabort=ng_TileFailed;c.ngMap=this;c.retrycnt=0;c.retryurl=
"";c.tilesrc=e;e=l+this.TileWidth/2-this.MapWidth/2;d=d+this.TileHeight/2-this.MapHeight/2;e=Math.round(Math.sqrt(e*e+d*d)/r*u);d=q[e];if(typeof d=="undefined")q[e]=new Array(c);else d[d.length]=c}}else{ng_setBounds(c,b,a,this.TileWidth,this.TileHeight);if(!this.TileLoading[this.MapLayer][k][h])c.style.visibility="visible"}}b+=this.TileWidth;h++;if(h>=this.TileColCount)h=0}a+=this.TileHeight;k++;if(k>=this.TileRowCount)k=0}for(f=0;f<q.length;f++){c=q[f];if(typeof c!="undefined")for(g=c.length-1;g>=
0;g--){d=c[g];d.alt="";d.src=d.tilesrc;ngOpera&&d.complete&&d.onload()}}this.TileLoadingCnt--;if(this.TileLoadingCnt<=0){this.TileLoadingCnt=0;this.DoTilesLoaded()}this.OnOffsetChanged&&this.OnOffsetChanged(this)}}else{this.X=b;this.Y=a}this.MapNeedRefresh=false}}
function ng_SetImageZoom(b,a,c,d,e,f){var g,h,k=this.TileWidth*b,l=this.TileHeight*b;h=Math.round((c*b-this.TileColCount*k/2)/k+0.5);g=Math.round((d*b-this.TileRowCount*l/2)/l+0.5);c=this.MapWidth/2+(h*k-c*b)-k/2;d=this.MapHeight/2+(g*l-d*b)-l/2;c+=(this.MapWidth/2-e)*(b-1);d+=(this.MapHeight/2-f)*(b-1);(b=this.ObjMap[a])&&ng_setLeftTop(b,c,d);h=h%this.TileColCount;f=g%this.TileRowCount;if(h<0)h+=this.TileColCount;if(f<0)f+=this.TileRowCount;c=h;d=Math.round(k+0.5);var m=Math.round(l+0.5);for(e=0;e<
this.TileRowCount;e++){h=c;for(g=0;g<this.TileColCount;g++){(b=this.Tiles[a][f][h])&&ng_setBounds(b,Math.round(g*k),Math.round(e*l),d,m);h++;if(h>=this.TileColCount)h=0}f++;if(f>=this.TileRowCount)f=0}}
function ng_TileLoaded(){if(this.src!=this.tilesrc){this.style.visibility="visible";this.src=this.tilesrc}else{this.retrycnt=0;this.retryurl="";var b=this.ngMap;ng_ResetLoadEvents(this);this.style.visibility="visible";if(b&&b.TileLoading[this.layer][this.row][this.col]){b.TileLoadingCnt--;b.TileLoading[this.layer][this.row][this.col]=false;if(b.TileLoadingCnt<=0){b.TileLoadingCnt=0;b.DoTilesLoaded()}}}}function ng_ReloadFailedTilesTimer(b){(b=getMapByID(b))&&b.ReloadFailedTiles()}
function ng_TileFailed(){if(this.src!=this.tilesrc){this.style.visibility="visible";this.src=this.tilesrc}else{var b=this.ngMap;if(b){b.TileRetryTimer&&clearTimeout(b.TileRetryTimer);b.TileRetryTimer=null;var a=this.id;ng_ResetLoadEvents(this);this.retryurl=this.src;this.src=ngEmptyURL;if(this.retrycnt<3){b.TileRetry[b.TileRetryCnt++]=a;this.retrycnt++;b.TileRetryTimer=setTimeout("ng_ReloadFailedTilesTimer('"+b.MapID+"');",1E3)}else if(b.TileLoading[this.layer][this.row][this.col]){b.TileLoadingCnt--;
b.TileLoading[this.layer][this.row][this.col]=false;if(b.TileLoadingCnt<=0){b.TileLoadingCnt=0;b.DoTilesLoaded()}}}}}function ng_ReloadFailedTiles(){this.TileRetryTimer&&clearTimeout(this.TileRetryTimer);this.TileRetryTimer=null;for(var b=0;b<this.TileRetryCnt;b++)if((o=document.getElementById(this.TileRetry[b]))&&o.retryurl!=""){o.onload=ng_TileLoaded;o.onerror=ng_TileFailed;o.onabort=ng_TileFailed;o.ngMap=this;o.src=o.retryurl}this.TileRetry=[];this.TileRetryCnt=0}
function ng_DoTilesLoaded(){this.ImageZoomAnimFinished();this.OnTilesLoaded&&this.OnTilesLoaded(this)}
function ng_SetMapSize(b,a){var c=false,d=this.ObjMap[1],e=this.ObjMap[2];if(d&&e){if(b>0)d.style.width=b;else b=d.clientWidth;if(a>0)d.style.height=a;else a=d.clientHeight;e.style.width=d.style.width;e.style.height=d.style.height;this.TileColCount=Math.round(b/this.TileWidth+0.5);this.TileRowCount=Math.round(a/this.TileHeight+0.5);if(this.TileColCount%2)this.TileColCount+=2;else this.TileColCount++;if(this.TileRowCount%2)this.TileRowCount+=2;else this.TileRowCount++;var f=new ngStringBuilder,g=new ngStringBuilder;
for(j=0;j<this.TileRowCount;j++)for(i=0;i<this.TileColCount;i++){f.append('<img id="'+this.MapID+"T1_"+i+"_"+j+'" class="cMT" />');g.append('<img id="'+this.MapID+"T2_"+i+"_"+j+'" class="cMT" />')}d.innerHTML=f.toString();e.innerHTML=g.toString();this.TileLoadingCnt=0;this.TileLoading=new Array(null,[],[]);this.Tiles=new Array(null,[],[]);for(j=0;j<this.TileRowCount;j++){this.Tiles[1][j]=[];this.Tiles[2][j]=[];this.TileLoading[1][j]=[];this.TileLoading[2][j]=[];for(i=0;i<this.TileColCount;i++){d=
document.getElementById(this.MapID+"T1_"+i+"_"+j);d.layer=1;d.col=i;d.row=j;e=document.getElementById(this.MapID+"T2_"+i+"_"+j);e.layer=2;e.col=i;e.row=j;this.Tiles[1][j][i]=d;this.Tiles[2][j][i]=e;this.TileLoading[1][j][i]=false;this.TileLoading[2][j][i]=false}}}if(!ngIExplorer)if(d=this.ObjCanvasDC){d.width=this.TileColCount*this.TileWidth;d.height=this.TileRowCount*this.TileHeight}if(d=this.ObjCanvasDI){d.width=this.TileColCount*this.TileWidth;d.height=this.TileRowCount*this.TileHeight}if(b!=this.MapWidth||
a!=this.MapHeight){this.MapWidth=b;this.MapHeight=a;this.ClearCanvas();c=true}this.Refresh();c&&this.Update()}function ng_HideCanvas(){var b=this.ObjCanvasDI;if(b)b.style.visibility="hidden";if(!ngIExplorer)if(b=this.ObjCanvasDC)b.style.visibility="hidden";if(b=this.ObjPreview)b.style.visibility="hidden"}
function ng_ShowCanvas(){var b=this.ObjCanvasDI;if(b)b.style.visibility="visible";if(!ngIExplorer)if(b=this.ObjCanvasDC)b.style.visibility="visible";if(b=this.ObjPreview)b.style.visibility="visible"}function ng_ClearCanvasEx(b,a){this.ClearCanvasEx2(b-this.X,a-this.Y);this.CanvasX=b;this.CanvasY=a}function ng_ClearCanvas(){this.ClearCanvasEx2(0,0)}
function ng_ClearCanvasEx2(b,a){if(d=this.ObjCanvasDI){var c='<img id="'+this.MapID+'_ImgMap" src="'+ngMapAPIURL+'/empty.gif" style="position: relative; visibility: hidden; z-index: 10; cursor:'+this.CurrentCursor+';" alt="" border="0" usemap="#ngmap" />';c+='<div id="'+this.MapID+'_Popup" class="'+this.PopupStyle+'" onmouseover="ng_EnterPopup(event,this,\''+this.MapID+"');\" onmouseout=\"ng_LeavePopup(event,this,'"+this.MapID+"');\"></div>";d.innerHTML=c;ng_setLeftTop(d,this.TileOffsetX+b,this.TileOffsetY+
a);this.InPopupObj=this.InPopupRect=false}this.CanvasOffsetX=this.TileOffsetX;this.CanvasOffsetY=this.TileOffsetY;this.CanvasX=this.X;this.CanvasY=this.Y;this.CanvasHTML=new ngStringBuilder;if(!ngIExplorer){var d=this.ObjCanvasDC;if(d){ng_setLeftTop(d,this.TileOffsetX+b,this.TileOffsetY+a);d.getContext&&d.getContext("2d").clearRect(0,0,this.TileColCount*this.TileWidth,this.TileRowCount*this.TileHeight)}}}
function ng_SetCanvasOffset(b,a){b+=this.CanvasOffsetX;a+=this.CanvasOffsetY;var c=this.ObjCanvasDI;c&&ng_setLeftTop(c,b,a);if(!ngIExplorer)(c=this.ObjCanvasDC)&&ng_setLeftTop(c,b,a)}function ng_CanvasBeginUpdate(){this.CanvasUpdateCnt++}function ng_CanvasEndUpdate(){this.CanvasUpdateCnt--;if(this.CanvasUpdateCnt<=0){this.CanvasUpdateCnt=0;var b=this.ObjCanvasDI;if(b)b.innerHTML+=this.CanvasHTML.toString();this.CanvasHTML=new ngStringBuilder}}
function ng_CanvasDrawOffsetX(){return out=-this.CanvasOffsetX}function ng_CanvasDrawOffsetY(){return out=-this.CanvasOffsetY}function ng_DrawOverlay(){this.OnDrawOverlay&&this.OnDrawOverlay(this)}
function ng_DrawIcon(b,a,c,d,e){var f=this.CanvasDrawOffsetX(),g=this.CanvasDrawOffsetY();a.x+=f-e.x;a.y+=g-e.y;e=false;if(!ngIExplorer)if((f=this.ObjCanvasDC)&&f.getContext){e=f.getContext("2d");e.globalAlpha=1;f=ngPreloadedImages[b];if(typeof f!="object"){f=new Image;f.src=b}e.beginPath();e.drawImage(f,a.x,a.y,c,d);e=true}if(!e){this.CanvasBeginUpdate();e=new ngStringBuilder;e.append('<span class="cMI" style="left:'+a.x+"px;top:"+a.y+"px;width:"+c+"px;height:"+d+"px;");ngIExplorer&&e.append("filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+
b+"', sizingMethod='image')");e.append(';"></span>');this.CanvasHTML.append(e);this.CanvasEndUpdate()}}function ng_DrawLine(b,a,c,d){if(!(b.lenght<2)){var e=this.CanvasDrawOffsetX(),f=this.CanvasDrawOffsetY(),g=this.ObjCanvasDC;if(g&&g.getContext){g=g.getContext("2d");g.globalAlpha=d;g.strokeStyle=a;g.lineWidth=c;g.beginPath();for(i=0;i<b.length;i++)i==0?g.moveTo(b[i].x+e,b[i].y+f):g.lineTo(b[i].x+e,b[i].y+f);g.stroke()}}}
function ng_DrawLineIE(b,a,c,d){if(!(b.lenght<2)){var e=this.CanvasDrawOffsetX(),f=this.CanvasDrawOffsetY();this.CanvasBeginUpdate();var g=new ngStringBuilder,h=this.TileColCount*this.TileWidth,k=this.TileRowCount*this.TileHeight;g.append('<v:shape class="cDC" onmousemove="ng_SyncCursor(\''+this.MapID+'\',this);" style="width:'+h+"px; height:"+k+'px;" coordorigin="0 0" coordsize="'+h+" "+k+'" filled="f" stroked="t" strokecolor="'+a+'" strokeweight="'+c+'px" path="');for(i=0;i<b.length;i++){i==0?g.append("m "):
g.append("l ");g.append(Math.round(b[i].x+e)+","+Math.round(b[i].y+f)+" ")}d<1?g.append('e" ><v:stroke opacity="'+d+'" /></v:shape>'):g.append('e" />');this.CanvasHTML.append(g);this.CanvasEndUpdate()}}
function ng_DrawLineFromStr(b,a,c,d){if(typeof b=="object"&&b!=null){this.CanvasBeginUpdate();for(var e=0;e<b.length;e++){var f=PointsFromStr(b[e]);this.DrawLine(f,a,c,d)}this.CanvasEndUpdate()}if(typeof b=="string"){this.CanvasBeginUpdate();f=PointsFromStr(b);this.DrawLine(f,a,c,d);this.CanvasEndUpdate()}}
function ng_DrawArea(b,a,c,d,e){if(!(b.lenght<3)){var f=this.CanvasDrawOffsetX(),g=this.CanvasDrawOffsetY(),h=this.ObjCanvasDC;if(h&&h.getContext){h=h.getContext("2d");h.globalAlpha=e;h.strokeStyle=a;h.fillStyle=d;h.lineWidth=c;h.beginPath();for(i=0;i<b.length;i++)i==0?h.moveTo(b[i].x+f,b[i].y+g):h.lineTo(b[i].x+f,b[i].y+g);h.lineTo(b[0].x+f,b[0].y+g);h.fill();c>0&&h.stroke()}}}
function ng_DrawAreaIE(b,a,c,d,e){if(!(b.lenght<3)){var f=this.CanvasDrawOffsetX(),g=this.CanvasDrawOffsetY();this.CanvasBeginUpdate();var h=new ngStringBuilder,k=this.TileColCount*this.TileWidth,l=this.TileRowCount*this.TileHeight;h.append('<v:shape class="cDC" onmousemove="ng_SyncCursor(\''+this.MapID+'\',this);" style="width:'+k+"px; height:"+l+'px;" coordorigin="0 0" coordsize="'+k+" "+l+'" filled="t" stoked="t" fillcolor="'+d+'" strokecolor="'+a+'" strokeweight="'+c+'px" path="');for(i=0;i<b.length;i++){i==
0?h.append("m "):h.append("l ");h.append(Math.round(b[i].x+f)+","+Math.round(b[i].y+g)+" ")}h.append(Math.round(b[0].x+f)+","+Math.round(b[0].y+g)+" ");e<1?h.append('e" ><v:fill opacity="'+e+'" /><v:stroke opacity="'+e+'" /></v:shape></v:shape>'):h.append('e" />');this.CanvasHTML.append(h);this.CanvasEndUpdate()}}
function ng_DrawAreaFromStr(b,a,c,d,e){if(typeof b=="object"&&b!=null){this.CanvasBeginUpdate();for(var f=0;f<b.length;f++){var g=PointsFromStr(b[f]);this.DrawArea(g,a,c,d,e)}this.CanvasEndUpdate()}if(typeof b=="string"){this.CanvasBeginUpdate();g=PointsFromStr(b);this.DrawArea(g,a,c,d,e);this.CanvasEndUpdate()}}
function ng_DrawPopupIcon(b,a,c){var d=this.PopupIcons[b];if(!(typeof d!="object"||!d)){var e=new ScreenPt(a.x,a.y);d.screenpos=new ScreenPt(a.x,a.y);this.CanvasBeginUpdate();var f=this.CanvasDrawOffsetX(),g=this.CanvasDrawOffsetY();e.x-=d.hotspot.x;e.y-=d.hotspot.y;a=d.icon.width;var h=d.icon.height,k=d.icon.src;d.offsetx=f;d.offsety=g;d.popupx=e.x+a/2;d.popupy=e.y+h/2;e.x+=f;e.y+=g;d=0;if(typeof c!="undefined")d=c;c=new ngStringBuilder;f=this.DisplayPopupTimeout>0&&this.DisplayPopupByClick;if(ngIExplorer&&
k.indexOf("png")>=0){c.append('<span class="cMI" id="'+b+'" style="left:'+e.x+"px;top:"+e.y+"px;width:"+a+"px;height:"+h+"px;");f&&c.append("cursor:pointer;");c.append("filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+k+"', sizingMethod='image')");c.append(';" onmouseover="ngSPU(event,this,\''+this.MapID+"',"+d+');"');f&&c.append(" onclick=\"ngSPU3(this, '"+this.MapID+"');\"");c.append(" onmouseout=\"ngHPU(event,this,'"+this.MapID+"')\"></span>")}else{c.append('<img class="cMI" id="'+
b+'" style="left:'+e.x+"px;top:"+e.y+"px;width:"+a+"px;height:"+h+"px;");f&&c.append("cursor:pointer;");c.append('" src="'+k+'" alt="" border="0"');f&&c.append(" onclick=\"ngSPU3(this, '"+this.MapID+"');\"");c.append(" onmouseover=\"ngSPU(event,this,'"+this.MapID+"',"+d+');" onmouseout="ngHPU(event,this,\''+this.MapID+"')\" />")}this.CanvasHTML.append(c);this.CanvasEndUpdate()}}
function ng_DrawPopupIcons(b,a){this.CanvasBeginUpdate();a=PointsFromStr(a);for(var c=0;c<b.length&&c<a.length;c++)this.DrawPopupIcon(b[c],a[c]);this.CanvasEndUpdate()}function ng_PopupIconExists(b){b=this.PopupIcons[b];if(typeof b!="object"||!b)return false;return true}
function ngSPU(b,a,c,d){if(!b)b=window.event;if(ng_CheckMouseEnter(a,b))if(b=getMapByID(c)){if(b.DisplayPopupTimeout){b.DisplayPopupTimer&&clearTimeout(b.DisplayPopupTimer);b.DisplayPopupTimerIcon=a;b.DisplayPopupTimerMX=b.MouseX;b.DisplayPopupTimerMY=b.MouseY;b.DisplayPopupTimer=setTimeout("ngAPU2('"+c+"');",b.DisplayPopupTimeout)}else b.ShowPopup(a,a.id,d);return false}}function ngSPU3(b,a){(a=getMapByID(a))&&a.ShowPopup(b,b.id);return false}
function ngHPU(b,a,c){if(!b)b=window.event;if(ng_CheckMouseLeave(a,b))if(b=getMapByID(c)){b.InPopupObj=false;b.HidePopupTimer=setTimeout("ng_HidePopupRectTimer('"+c+"');",100);b.CancelDisplayPopup();if(b.DisplayPopupTimeout>0&&b.DisplayPopupByClick){c=b.CurrentCursor;b.CurrentCursor="";b.SetCursor(c)}}}function ng_AddPopupIcon(b,a,c,d,e){a=new PopupIcon(b,a,c,d,e);return this.PopupIcons[b]=a}function ng_SetPopupIcons(b){for(var a=0;a<b.length;a++)this.PopupIcons[b[a].id]=b[a]}
function ng_ClearPopupIcons(){this.RemovePopupIconsByID("")}function ng_RemovePopupIconsByID(b){var a,c=b.length,d=0,e=0;this.HidePopup();for(var f in this.PopupIcons){e++;if(f.substring(0,c)==b){this.PopupIcons[f]=false;(a=document.getElementById(f))&&a.parentNode&&a.parentNode.removeChild(a);d++}}if(e==d)this.PopupIcons=[]}function ng_RemovePopupIconByID(b){this.HidePopup();this.PopupIcons[b]=false;(b=document.getElementById(b))&&b.parentNode&&b.parentNode.removeChild(b)}
function ng_ShowPopupByID(b,a){var c=document.getElementById(b);if(c)return this.ShowPopup(c,b,a);return false}function ng_CreatePopupHTML(b,a){var c="";if(b!="")c+='<div class="'+this.PopupTextStyle+'">'+b+"</div>";c+=typeof a!="undefined"&&a!=""?'<div class="'+this.PopupMenuStyle+'">'+a+"</div>":'<div class="'+this.PopupMenuStyle+'"></div>';return c}
function ng_CreatePopup(b,a,c,d,e,f){if(b){b.innerHTML='<div class="'+this.PopupFrameStyle+'">'+d+"</div>";var g=false,h=false;if(a+b.offsetWidth-28>this.MapWidth+e){g=true;a+=-b.offsetWidth+28}else a-=28;if(c-b.offsetHeight-12>f){h=true;c+=-b.offsetHeight-12}d=h?'<div class="'+this.PopupFrameStyle+'">'+d+'</div><div style="z-index: 503; position: relative; top:-1px; text-align:'+(g?"right":"left")+'"><img src="'+ngMapAPIURL+'/popupArrDown.gif" width="55" height="13" alt="" border="0" /></div>':'<div style="position: relative; z-index: 503; text-align:'+
(g?"right":"left")+'"><img src="'+ngMapAPIURL+'/popupArrUp.gif" width="55" height="13" alt="" border="0" /></div><div class="'+this.PopupFrameStyle+'" style="position: relative; top: -1px;">'+d+"</div>";b.innerHTML=d;ng_setLeftTop(b,a,c);b.style.visibility="visible"}}
function ng_ShowPopup(b,a,c){if(this.MouseDown)return false;a=this.PopupIcons[a];if(typeof a!="object"||!a)return false;var d=document.getElementById(this.MapID+"_Popup");if(d){var e;e=a.onpopup?a.onpopup(this,a):a.descr;if(e=="")return false;else{clearTimeout(this.HidePopupTimer);this.InPopupObj=true;if(this.ActivePopupIcon)this.ActivePopupIcon.style.zIndex="10";if(b)b.style.zIndex="500";this.MapPopupX=a.popupx;this.MapPopupY=a.popupy;this.PopupX=this.MapPopupX;this.PopupY=this.MapPopupY;this.CreatePopup(d,
a.popupx+a.offsetx,a.popupy+a.offsety,e,-this.TileOffsetX,-this.TileOffsetY);this.ActivePopupIcon=b;if(c>0){this.InPopupObj=this.InPopupRect=false;this.HidePopupTimer=setTimeout("ng_HidePopupRectTimer('"+this.MapID+"');",c)}}}return true}function ng_HidePopupRectTimer(b){if(b=getMapByID(b)){clearTimeout(b.HidePopupTimer);!b.InPopupRect&&!b.InPopupObj&&b.HidePopup()}}
function ng_HidePopup(){this.InPopupObj=this.InPopupRect=false;clearTimeout(this.HidePopupTimer);var b=document.getElementById(this.MapID+"_Popup");if(b){if(this.ActivePopupIcon){this.ActivePopupIcon.style.zIndex="10";this.ActivePopupIcon=null}b.style.visibility="hidden";b.innerHTML="";if(this.PopupX==this.MapPopupX&&this.PopupY==this.MapPopupY)this.PopupY=this.PopupX=-1000;this.MapPopupY=this.MapPopupX=-1000;typeof this.OnHidePopup=="function"&&this.OnHidePopup(this)}}
function ng_EnterPopup(b,a,c){if(!b)b=window.event;if(ng_CheckMouseEnter(a,b))if(b=getMapByID(c))b.InPopupRect=true}function ng_LeavePopup(b,a,c){if(!b)b=window.event;if(ng_CheckMouseLeave(a,b))if(b=getMapByID(c)){b.InPopupRect=false;b.HidePopupTimer=setTimeout("ng_HidePopupRectTimer('"+c+"');",100)}}
function ngAPU(b,a,c,d,e,f){if(!b)b=window.event;if(ng_CheckMouseEnter(a,b))if(b=getMapByID(c)){if(!b.DisplayPopupTimeout)return b.ShowActiveObjPopup(d,e,f);f=b.CurrentCursor;b.SetCursor("pointer");b.CurrentCursor=f;b.DisplayPopupTimer&&clearTimeout(b.DisplayPopupTimer);b.DisplayPopupTimerIdxL=d;b.DisplayPopupTimerIdxO=e;b.DisplayPopupTimerIcon=null;b.DisplayPopupTimerMX=b.MouseX;b.DisplayPopupTimerMY=b.MouseY;b.DisplayPopupTimer=setTimeout("ngAPU2('"+c+"');",b.DisplayPopupTimeout);return false}}
function ngAPU2(b){if(b=getMapByID(b)){b.CancelDisplayPopup();if(b.DisplayPopupTimerMX==b.MouseX&&b.DisplayPopupTimerMY==b.MouseY){var a=b.DisplayPopupTimerIcon;a?b.ShowPopup(a,a.id):b.ShowActiveObjPopup(b.DisplayPopupTimerIdxL,b.DisplayPopupTimerIdxO,0)}}}function ngAPU3(b,a,c){if(b=getMapByID(b)){b.ShowActiveObjPopup(a,c);return false}}function ng_CancelDisplayPopup(){this.DisplayPopupTimer&&clearTimeout(this.DisplayPopupTimer);this.DisplayPopupTimer=null}function ngNop(){}
function ng_GetActiveObjByID(b,a){var c,d=-1;if(typeof b=="string"){c=this.ActiveLayers.length;for(var e=0;e<c;e++)if(this.ActiveLayers[e].objid==b){d=e;break}}else d=b;if(d>=0&&d<this.ActiveLayers.length){b=this.ActiveLayers[d].objs;c=b.length;for(e=0;e<c;e++)if(b[e].objid==a)return e}return-1}
function ng_ShowActiveObjPopupByID(b,a,c){if(!document.getElementById(this.MapID+"_Popup"))return false;var d,e=-1;if(typeof b=="string"){d=this.ActiveLayers.length;for(var f=0;f<d;f++)if(this.ActiveLayers[f].objid==b){e=f;break}}else e=b;b=this.GetActiveObjByID(b,a);if(b>=0)return this.ShowActiveObjPopup(e,b,c);return false}
function ng_ShowActiveObjPopup(b,a,c){if(this.MouseDown)return false;var d=document.getElementById(this.MapID+"_Popup");if(d&&b<this.ActiveLayers.length){b=this.ActiveLayers[b];if(typeof b!="object")return false;if(a>=b.objs.length)return false;a=b.objs[a];if(typeof a!="object")return false;b=a.onpopup?a.onpopup(map,a):this.OnActiveObjectMenu?this.OnActiveObjectMenu(map,b,a):a.descr;if(b!=""){clearTimeout(this.HidePopupTimer);this.InPopupObj=true;if(this.ActivePopupIcon)this.ActivePopupIcon.style.zIndex=
"10";this.MapPopupX=a.popupx;this.MapPopupY=a.popupy;this.PopupX=this.MapPopupX;this.PopupY=this.MapPopupY;this.CreatePopup(d,a.popupx+a.offsetx,a.popupy+a.offsety,b,-this.TileOffsetX,-this.TileOffsetY);this.ActivePopupIcon=null;if(typeof c!="undefined"&&c>0){this.InPopupObj=this.InPopupRect=false;this.HidePopupTimer=setTimeout("ng_HidePopupRectTimer('"+this.MapID+"');",c)}return true}}return false}
function ng_SetActiveLayers(b){if(typeof b=="object")if(!(this.OnActiveLayers&&!this.OnActiveLayers(this,b))){this.CancelDisplayPopup();this.ActiveLayers=b;var a=this.CanvasDrawOffsetX(),c=this.CanvasDrawOffsetY(),d,e,f,g,h=new ngStringBuilder,k=b.length,l=this.DisplayPopupTimeout>0&&this.DisplayPopupByClick;for(d=0;d<k;d++){g=b[d];if(typeof g=="object"){f=g.objs.length;for(e=0;e<f;e++){g.objs[e].offsetx=a;g.objs[e].offsety=c;h.append('<area shape="'+g.objs[e].shape+'" coords="'+g.objs[e].coords+
'"');l&&h.append(" onclick=\"ngAPU3('"+this.MapID+"',"+d+","+e+');"');h.append(" onmouseover=\"ngAPU(event,this,'"+this.MapID+"',"+d+","+e+');" onmouseout="ngHPU(event,this,\''+this.MapID+"')\" />")}}}if(h.empty()){if(b=document.getElementById(this.MapID+"_ImgMap"))b.style.visibility="hidden"}else{ngFireFox1x&&h.append('<area href="javascript:ngNop();" shape="rect" coords="0,0,'+this.MapWidth+","+this.MapHeight+'" />');if(b=document.getElementById(this.MapID+"_ImgMap")){ng_setBounds(b,a,c,this.MapWidth,
this.MapHeight);b.style.visibility="visible"}this.CanvasBeginUpdate();this.CanvasHTML.append('<map name="ngmap">');this.CanvasHTML.append(h);this.CanvasHTML.append("</map>");this.CanvasEndUpdate()}}}function ng_LocatePopupIcon(b,a,c){var d=this.PopupIcons[b],e="";if(typeof c!="undefined")e="&PT="+c;typeof d!="object"||!d||(d.update?this.MapCommand("LI",ng_URLEncode(b)+"&SC="+a+e):this.MapCommand("L",ng_URLEncode(d.pos)+"&SC="+a+"&LI="+ng_URLEncode(b)+e))}
function ng_LocatePopupIcons(b,a){var c="";if(typeof a!="undefined")c="&PT="+a;this.MapCommand("LI",ng_URLEncode(b)+c)}function ng_ProcessUrl(b){this.rpc.sendRequest(b)}
function ng_URLStateParams(b,a,c,d){if(typeof a=="undefined")a=false;if(typeof b=="undefined")b=true;if(typeof c=="undefined")c=false;if(typeof d=="undefined")d=false;var e=new ngStringBuilder;e.append("&S="+this.MapSession+"&PX="+this.X+"&PY="+this.Y);if(a){e.append("&M="+this.MapID+"&W="+this.MapWidth+"&H="+this.MapHeight);this.PHPSession!=""&&e.append("&"+this.PHPSession)}if(d){this.Initialized||e.append("&INIT=1");this.APIKey!=""&&e.append("&KEY="+this.APIKey)}a=this.PreviewMap;if(c&&a){e.append("&PM="+
a.MapID);e.append("&PPX="+a.X);e.append("&PPY="+a.Y);e.append("&PW="+a.MapWidth);e.append("&PH="+a.MapHeight);e.append("&PZ="+a.PreviewZoom);e.append("&PS="+a.MapSession)}if(b){b=new ngStringBuilder;c=new ngStringBuilder;a="";a=PROJ_WGS;for(var f in this.PopupIcons)if(typeof this.PopupIcons[f].pos!="undefined"&&this.PopupIcons[f].update){b.append(f+";");c.empty()?c.append(this.PopupIcons[f].pos):c.append("|"+this.PopupIcons[f].pos)}if(!b.empty()){e.append("&IC=");e.append(ng_URLEncode(b.toString()));
e.append("&ICP=");e.append(ng_URLEncode(c.toString()))}}e=e.toString();return e.substring(1,e.length)}function ng_SetPHPSession(b){this.PHPSession=b}function ng_SetMapCommandParam(b){this.RemoveMapCommandParam(b);this.MapCommandParams=this.MapCommandParams+"&"+b}
function ng_RemoveMapCommandParam(b){var a=b.indexOf("=");if(a>=0)b=b.substring(0,a);a=this.MapCommandParams.indexOf(b+"=");if(a>=0){b=this.MapCommandParams.substring(0,a-1);var c=this.MapCommandParams.substring(a,this.MapCommandParams.length+1);a=c.indexOf("&");c=a>=0?c.substring(a,c.length+1):"";this.MapCommandParams=b+c}}function ng_IsActiveCmd(b){return b==this.ActiveCommandID}
function ng_MapCommand(b,a){if(!this.InCmd){var c="";if(typeof a!="undefined")c=a;if(!(this.OnCommand&&!this.OnCommand(this,b,c))){this.CancelMapCommand();if(this.PreviewParent&&b=="P"&&c=="")this.PreviewParent.MapCommand("UP");else{if(this.TileLoadingCnt>0){this.TilesCanceledByCommand=true;this.CancelTileLoading(this.MapLayer)}this.ActiveCommand=b;this.ActiveCommandParams=c;this.ActiveCommandID++;if(this.ActiveCommandID>99)this.ActiveCommandID=0;this.ProcessUrl(ng_AddURLParam(this.CommandURL,this.URLStateParams(true,
true,true,true)+"&C="+b+"_"+this.ActiveCommandID+"&P="+c+this.MapCommandParams))}}}}function ng_LimitCommandFreq(b){var a=(new Date).getTime();if(!this.LimitCommandTimeout||a>this.LimitCommandTimeout){this.LimitCommandTimeout=a+b;return true}return false}function ng_EndLimitCommand(){this.LimitCommandID=this.ActiveCommandID}
function ng_CmdFinished(){if(this.ActiveCommandID==this.LimitCommandID)this.LimitCommandTimeout=0;this.TilesCanceledByCommand&&this.Refresh();this.InCmd=false;this.OnCommandFinished&&this.OnCommandFinished(this);if(this.Initialized==1){this.Initialized=2;this.OnInitialize&&this.OnInitialize(this)}this.PreviewParent&&this.PreviewParent.MapCommand("UP");this.ActiveCommandCallback&&this.ActiveCommandCallback(this);this.ActiveCommandParams=this.ActiveCommand="";this.ActiveCommandCallback=null}
function ng_GetMapSession(){return this.MapSession}function ng_GetMapURL(){return this.MapURL}function ng_SetMapSession(b,a,c){if(this.MapSession!=b||this.MapURL!=a){if(c){this.ImageZoomL=this.MapLayer;this.CancelTileLoading(this.MapLayer);this.MapLayer=this.MapLayer==1?2:1;this.LastClearedLayer=-1}this.ClearMapLayer(this.MapLayer);this.MapURL=a;this.MapSession=b;this.MapNeedRefresh=true;this.Y=this.X=0;this.OnSetMapSession&&this.OnSetMapSession(this);return true}return false}
function ng_CancelMapCommand(){if(!this.InCmd){if(this.ActiveCommand!=""){this.OnCommandCancel&&this.OnCommandCancel(this);this.ActiveCommandCallback=null}this.ActiveCommandID++;if(this.ActiveCommandID>99)this.ActiveCommandID=0;this.ActiveCommandParams=this.ActiveCommand="";this.MapCommandTimer&&clearTimeout(this.MapCommandTimer);this.MapCommandTimer=null}}function ng_PositionChangedTimer(b){(b=getMapByID(b))&&b.MapCommand("P")}
function ng_PositionChanged(){this.OnPositionChanged&&this.OnPositionChanged(this);this.CancelMapCommand();this.MapCommandTimer=setTimeout("ng_PositionChangedTimer('"+this.MapID+"');",500)}
function ng_SetMode(b){if(this.Initialized){if(!(this.OnModeChanging&&!this.OnModeChanging(this,b))){if(b!=this.Mode){this.HidePopup();this.HideMapMenu()}this.MouseMode="";if(b=="P"){this.MouseMode="P";this.SetCursor(curPan)}if(b=="Z+"){this.MouseMode="R";this.SetCursor(curZoomIn)}this.Mode=b;this.OnModeChanged&&this.OnModeChanged(this)}}else this.InitMode=b}function ng_PanMode(){this.SetMode("P")}function ng_ZoomMode(){this.SetMode("Z+")}
function ng_GetVerticalPan(){var b=this.VerticalPan;if(b==0)b=this.MapHeight/2-30;if(b<30)b=30;return b}function ng_GetHorizontalPan(){var b=this.HorizontalPan;if(b==0)b=this.MapWidth/2-30;if(b<30)b=30;return b}function ng_MapLeft(){this.Pan(-this.GetHorizontalPan(),0)}function ng_MapRight(){this.Pan(this.GetHorizontalPan(),0)}function ng_MapUp(){this.Pan(0,-this.GetVerticalPan())}function ng_MapDown(){this.Pan(0,this.GetVerticalPan())}
function ng_MapLeftUp(){this.Pan(-this.GetHorizontalPan(),-this.GetVerticalPan())}function ng_MapRightUp(){this.Pan(this.GetHorizontalPan(),-this.GetVerticalPan())}function ng_MapLeftDown(){this.Pan(-this.GetHorizontalPan(),this.GetVerticalPan())}function ng_MapRightDown(){this.Pan(this.GetHorizontalPan(),this.GetVerticalPan())}function ng_ZoomOut(b,a,c){var d="";d+=typeof c!="undefined"&&c?"1":"0";if(typeof b!="undefined"&&typeof a!="undefined")d+="&SL="+b+"&ST="+a;this.MapCommand("ZO",d)}
function ng_ZoomIn(b,a,c,d,e){var f="";f+=typeof e!="undefined"&&e?"1":"0";if(typeof b!="undefined"&&typeof a!="undefined"){if(typeof c=="undefined")c=b;if(typeof d=="undefined")d=a;f+="&SL="+b+"&ST="+a+"&SR="+c+"&SB="+d}this.MapCommand("ZI",f)}function ng_MaxDetail(b,a,c){var d="";d+=typeof c!="undefined"&&c?"1":"0";if(typeof b!="undefined"&&typeof a!="undefined")d+="&SL="+b+"&ST="+a;this.MapCommand("MI",d)}
function ng_MinDetail(b,a,c){var d="";d+=typeof c!="undefined"&&c?"1":"0";if(typeof b!="undefined"&&typeof a!="undefined")d+="&SL="+b+"&ST="+a;this.MapCommand("MO",d)}function ng_Home(){this.MapSession="";this.Y=this.X=0;if(this.PreviewMap){this.PreviewMap.MapSession="";this.PreviewMap.X=0;this.PreviewMap.Y=0}this.MapCommand("P")}function ng_Refresh(){this.MapNeedRefresh=true;this.SetMapOffsetEx(this.X,this.Y)}function ng_Update(){this.MapCommand("P")}
function ng_SetScale(b,a,c){b=b;if(typeof a!="undefined"&&typeof c!="undefined")b+="&SL="+a+"&ST="+c;this.MapCommand("SC",b)}function ng_LocateXY(b){typeof b=="undefined"||b==""||this.MapCommand("L",ng_URLEncode(b))}function ng_LocateScaleXY(b,a){typeof a=="undefined"||a==""||this.MapCommand("L",ng_URLEncode(a)+"&SC="+b)}function ng_SetRegion(b){typeof b=="undefined"||b==""||this.MapCommand("R",ng_URLEncode(b))}function ng_Center(b,a){this.Pan(b-this.MapWidth/2,a-this.MapHeight/2)}
function ng_MoveTo(b,a){this.SetMapOffsetEx(this.X+b-this.MapWidth/2,this.Y+a-this.MapHeight/2)}function ng_OnDrag(b){if(b)b.preventDefault&&b.preventDefault();else{b=window.event;b.returnValue=false}return false}function ng_OnContextMenu(b){if(b)b.preventDefault&&b.preventDefault();else{b=window.event;b.returnValue=false}return false}
function ng_HandleCtrl(b){if(b!=CTRL_DOWN)if((CTRL_DOWN=b)&&!ngKeyMap&&ngCurrentMap&&ngCurrentMap.AllowCtrl&&ngCurrentMap.MouseEvents&&ngCurrentMap.MouseOnMap&&!ngCurrentMap.MouseDown){ngCurrentMap.SetMode(ngCurrentMap.Mode=="P"?"Z+":"P");ngKeyMap=ngCurrentMap}else if(!b&&ngKeyMap){ngKeyMap.SetMode(ngKeyMap.Mode=="P"?"Z+":"P");ngKeyMap=null}}
function OnMapKeyDown(b){if(!b)b=window.event;if(OnKeyDownBefore&&!OnKeyDownBefore(b))return true;var a=ngCurrentMap,c=b.keyCode;ng_HandleCtrl(b.ctrlKey||c==32&&(ngKeyMap||a&&a.Mode!="P"));if(a&&a.KeyEvents&&a.MouseOnMap){if(a.OnKeyDown&&!a.OnKeyDown(a,b))return true;if(c==37||c==38||c==39||c==40){if(!a.AnimationStarted||!a.KeyScroll)a.KeyScroll=a.KeyScrollStart;else if(a.KeyScroll<a.KeyScrollMax)a.KeyScroll+=a.KeyScrollDelta;if(a.AnimationStarted){switch(c){case 37:a.PanDX=-a.KeyScroll;a.PanDY=0;
break;case 38:a.PanDY=-a.KeyScroll;a.PanDX=0;break;case 39:a.PanDX=a.KeyScroll;a.PanDY=0;break;case 40:a.PanDY=a.KeyScroll;a.PanDX=0;break}a.PanStartX=a.X+a.PanSX;a.PanStartY=a.Y+a.PanSY;a.PanX=a.PanSX;a.PanY=a.PanSY;a.PanSX=a.PanDX/(a.PanMinInterval/a.PanDelay);a.PanSY=a.PanDY/(a.PanMinInterval/a.PanDelay);c=0}}switch(c){case 33:a.Up();break;case 34:a.Down();break;case 37:a.Pan(-a.KeyScroll,0);break;case 38:a.Pan(0,-a.KeyScroll);break;case 39:a.Pan(a.KeyScroll,0);break;case 40:a.Pan(0,a.KeyScroll);
break;case 187:case 107:a.LimitCommandFreq(1E3)&&a.ZoomIn();break;case 189:case 109:a.LimitCommandFreq(1E3)&&a.ZoomOut();break}return false}if(OnKeyDownAfter){b=OnKeyDownAfter(b);if(typeof b!="undefined")return b}return true}
function OnMapKeyUp(b){if(!b)b=window.event;if(OnKeyUpBefore&&!OnKeyUpBefore(b))return true;var a=ngCurrentMap;ng_HandleCtrl(b.ctrlKey);if(a&&a.KeyEvents&&a.MouseOnMap)if(a.OnKeyUp&&!a.OnKeyUp(a,b))return true;if(OnKeyUpAfter){b=OnKeyUpAfter(b);if(typeof b!="undefined")return b}return true}function getMapByID(b){if((b=document.getElementById(b))&&b.ngMap)return b.ngMap;return null}
function ng_RefreshObjReferences(){this.ObjMap=new Array(document.getElementById(this.MapID),document.getElementById(this.MapID+"_M1"),document.getElementById(this.MapID+"_M2"));var b=document.getElementById(this.MapID+"_Holder");b.ondrag=function(){return false};b.onselectstart=function(){return false};this.ObjCanvasDC=document.getElementById(this.MapID+"DC");this.ObjCanvasDI=document.getElementById(this.MapID+"DI");this.ObjSelRect=document.getElementById(this.MapID+"_Sel");this.ObjSelRect2=document.getElementById(this.MapID+
"_Sel2");this.ObjMenu=document.getElementById(this.MapID+"_Menu");this.ObjPreview=document.getElementById(this.MapID+"_Preview")}function ng_IEForceUpdate(){var b=this.ObjMap[0].offsetLeft}function ng_SetKeyEvents(b){if(this.KeyEvents!=b)this.KeyEvents=b}function ng_SetMouseEvents(b){if(this.MouseEvents!=b){b?this.SetCursor(this.CurrentCursor):this.SetCursor(curDefault);this.MouseEvents=b}}
function ng_Initialize(){if(!this.Initialized){this.SetMapSize(this.MapWidth,this.MapHeight);this.Initialized=1;this.SetMode(this.InitMode)}}function ng_Assign(b){if(b!=this){this.SetMapSession(b.MapSession,b.MapURL,false);this.SetMapOffsetEx(b.X,b.Y);this.ClearCanvas()}}
function ng_Preview(b,a){if(typeof a=="undefined"||a=="")a="cMapPreviewDefault";var c=this.ObjMap[0];if(c)if(b){var d=c.innerHTML;if(d.indexOf(this.MapID+"_Preview")==-1){c.innerHTML=d+'<div class="cMapPreview '+a+'" id="'+this.MapID+'_Preview"></div>';this.RefreshObjReferences()}}if(this.PreviewParent)this.PreviewParent.PreviewMap=null;if(this.PreviewParent=b)b.PreviewMap=this;this.SetKeyEvents(false);this.MouseWheel=this.MouseZoomOut=this.AllowCtrl=false;this.PanMode()}
function ng_SetPreviewRect(b,a,c,d){var e=this.ObjPreview;if(e){e.style.visibility="visible";ng_setBounds(e,b,a,c-b,d-a);this.OnPreviewRectChanged&&this.OnPreviewRectChanged(this,e)}}
function ngMap(b,a){this.MapID=b;this.rpc=new ngRPC(this.MapID);this.APIKey="";if(typeof ngMapAPIKey!="undefined")this.APIKey=ngMapAPIKey;ng_PreloadImage(ngMapAPIURL+"/popupArrDown.gif");ng_PreloadImage(ngMapAPIURL+"/popupArrUp.gif");var c=document.getElementById(b);if(c){c.ngMap=this;c.onmouseover=ng_EnterMap;c.onmouseout=ng_LeaveMap;var d=new ngStringBuilder;d.append('<canvas id="'+b+'DC" class="cDC"></canvas>');d.append('<div id="'+b+'DI" class="cDC"></div>');d.append('<div id="'+b+'_Menu" class="csMAPPopup"></div>');
d.append('<div id="'+b+'_Holder" class="cMapHolder">');d.append('<div class="cMapSelRect"  id="'+b+'_Sel"></div>');d.append('<div class="cMapSelRect2" id="'+b+'_Sel2"></div>');d.append('<div id="'+b+'_M1" class="cMap1"></div>');d.append('<div id="'+b+'_M2" class="cMap2"></div>');d.append("</div>");c.innerHTML=d.toString();c.oncontextmenu=ng_OnContextMenu;c.ondrag=ng_OnDrag;if(c=document.getElementById(this.MapID+"_Menu")){c.ngMap=this;c.onmouseover=ng_EnterMapMenu;c.onmouseout=ng_LeaveMapMenu}}this.RefreshObjReferences=
ng_RefreshObjReferences;this.RefreshObjReferences();this.IEForceUpdate=ngIExplorer?ng_IEForceUpdate:ngNop;this.TileOffsetY=this.TileOffsetX=this.TileRowCount=this.TileColCount=this.TileHeight=this.TileWidth=this.Initialized=0;this.TileLoading=new Array(null,null,null);this.TileLoadingCnt=0;this.TileRetryTimer=null;this.TileRetry=[];this.TileRetryCnt=0;this.LastTileSty=this.LastTileStx=-1;this.MapLayer=1;this.LastClearedLayer=2;this.MapHeight=this.MapWidth=0;this.MouseOnMap=this.MapNeedRefresh=false;
if(c=this.ObjMap[1]){this.MapWidth=c.clientWidth;this.MapHeight=c.clientHeight}this.MapMenuY=this.MapMenuX=this.PopupY=this.PopupX=-1000;this.MapMenuTimeout=300;this.MapMenuTimer=null;this.InMapMenu=false;this.HideMapMenuTimer=null;this.MapSession=this.MapURL="";this.MapCommandTimer=null;this.PHPSession=this.MapCommandParams="";this.CommandURL=ngMapAPIURL+"/map.php";if(typeof a!="undefined")this.CommandURL=a;this.InCmd=false;this.ActiveCommandParams=this.ActiveCommand="";this.ActiveCommandID=0;this.LimitCommandID=
-1;this.LimitCommandTimeout=0;this.ActiveCommandCallback=null;this.TilesCanceledByCommand=false;this.PreviewZoom=10;this.PreviewParent=this.PreviewMap=null;this.InitMode=this.Mode="Z+";this.CurrentCursor=this.MouseMode="";if(ngOpera){this.CursorZoomOut=this.CursorZoomIn="crosshair";this.CursorPan="move"}else{this.CursorZoomIn="url('"+ngMapAPIURL+"/DynamicZoomIn.cur'), crosshair";this.CursorZoomOut="url('"+ngMapAPIURL+"/ZoomOut.cur'), crosshair";this.CursorPan="url('"+ngMapAPIURL+"/Pan.cur'), move"}this.AnimationStarted=
false;this.PanTimer=null;this.PanMinInterval=600;this.PanDelay=10;this.PanNoPosChanged=false;this.VerticalPan=this.HorizontalPan=0;this.ImageZoomL=-1;this.ImageZoomHookPan=false;this.CanvasOffsetY=this.CanvasOffsetX=this.CanvasY=this.CanvasX=this.MouseSelBottom=this.MouseSelRight=this.MouseSelTop=this.MouseSelLeft=this.MouseY=this.MouseX=this.MouseUpTicks=this.MouseDown=this.ImageZoomPan=0;this.CanvasHTML=new ngStringBuilder;this.CanvasUpdateCnt=0;this.MapPopupY=this.MapPopupX=-1000;this.PopupIcons=
[];this.InPopupObj=this.InPopupRect=false;this.ActivePopupIcon=this.HidePopupTimer=null;this.PopupStyle="csMAPPopup";this.PopupTextStyle="csMAPPopupText";this.PopupMenuStyle="csMAPPopupMenu";this.PopupFrameStyle="csMAPPopupFrame";this.DisplayPopupTimeout=0;this.DisplayPopupByClick=true;this.DisplayPopupTimer=null;this.Y=this.X=0;this.MouseWheel=this.MouseZoomOut=this.AllowCtrl=this.KeyEvents=this.MouseEvents=this.PanAnimation=this.ZoomAnimation=true;this.MouseWheelMode=0;this.KeyScrollStart=100;this.KeyScrollDelta=
10;this.KeyScrollMax=1E3;this.KeyScroll=0;this.Initialize=ng_Initialize;this.CancelMapMove=ng_CancelMapMove;this.ImageZoomAnimFinished=ng_ImageZoomAnimFinished;this.CancelImageZoomAnim=ng_CancelImageZoomAnim;this.ImageZoomAnim=ng_ImageZoomAnim;this.StartAnimation=ng_StartAnimation;this.EndAnimation=ng_EndAnimation;this.GetMousePosition=ng_GetMousePosition;this.UpdateRect=ngIExplorer?ng_UpdateRectIE:ng_UpdateRect;this.SwapMapLayers=ng_SwapMapLayers;this.HideSecondMapLayer=ng_HideSecondMapLayer;this.GetMapLayer=
ng_GetMapLayer;this.GetMapURL=ng_GetMapURL;this.CancelTileLoading=ng_CancelTileLoading;this.ClearMapLayer=ng_ClearMapLayer;this.SetImageZoom=ng_SetImageZoom;this.ReloadFailedTiles=ng_ReloadFailedTiles;this.DoTilesLoaded=ng_DoTilesLoaded;this.SetMapOffset=ng_SetMapOffset;this.SetMapOffsetEx=ng_SetMapOffsetEx;this.HideCanvas=ng_HideCanvas;this.ShowCanvas=ng_ShowCanvas;this.ClearCanvasEx=ng_ClearCanvasEx;this.ClearCanvasEx2=ng_ClearCanvasEx2;this.SetCanvasOffset=ng_SetCanvasOffset;this.CanvasDrawOffsetX=
ng_CanvasDrawOffsetX;this.CanvasDrawOffsetY=ng_CanvasDrawOffsetY;this.DrawOverlay=ng_DrawOverlay;this.DrawPopupIcons=ng_DrawPopupIcons;this.DrawPopupIcon=ng_DrawPopupIcon;this.SetPopupIcons=ng_SetPopupIcons;this.CreatePopup=ng_CreatePopup;this.ShowPopup=ng_ShowPopup;this.CancelDisplayPopup=ng_CancelDisplayPopup;this.ActiveLayers=[];this.SetActiveLayers=ng_SetActiveLayers;this.IsActiveCmd=ng_IsActiveCmd;this.CmdFinished=ng_CmdFinished;this.PositionChanged=ng_PositionChanged;this.GetVerticalPan=ng_GetVerticalPan;
this.GetHorizontalPan=ng_GetHorizontalPan;this.SetPreviewRect=ng_SetPreviewRect;this.SetKeyEvents=ng_SetKeyEvents;this.SetMouseEvents=ng_SetMouseEvents;this.Assign=ng_Assign;this.Preview=ng_Preview;this.SetMapSize=ng_SetMapSize;this.HideMapMenu=ng_HideMapMenu;this.MapCommand=ng_MapCommand;this.CancelMapCommand=ng_CancelMapCommand;this.SetMapCommandParam=ng_SetMapCommandParam;this.RemoveMapCommandParam=ng_RemoveMapCommandParam;this.LimitCommandFreq=ng_LimitCommandFreq;this.EndLimitCommand=ng_EndLimitCommand;
this.SetPHPSession=ng_SetPHPSession;this.SetMode=ng_SetMode;this.PanMode=ng_PanMode;this.ZoomMode=ng_ZoomMode;this.Left=ng_MapLeft;this.Right=ng_MapRight;this.Up=ng_MapUp;this.Down=ng_MapDown;this.LeftUp=ng_MapLeftUp;this.RightUp=ng_MapRightUp;this.LeftDown=ng_MapLeftDown;this.RightDown=ng_MapRightDown;this.ZoomOut=ng_ZoomOut;this.ZoomIn=ng_ZoomIn;this.MaxDetail=ng_MaxDetail;this.MinDetail=ng_MinDetail;this.Home=ng_Home;this.Refresh=ng_Refresh;this.Update=ng_Update;this.Pan=ng_Pan;this.SetScale=ng_SetScale;
this.LocateXY=ng_LocateXY;this.LocateScaleXY=ng_LocateScaleXY;this.LocatePopupIcon=ng_LocatePopupIcon;this.LocatePopupIcons=ng_LocatePopupIcons;this.SetRegion=ng_SetRegion;this.Center=ng_Center;this.MoveTo=ng_MoveTo;this.DrawIcon=ng_DrawIcon;this.DrawLine=ngIExplorer?ng_DrawLineIE:ng_DrawLine;this.DrawLineFromStr=ng_DrawLineFromStr;this.DrawArea=ngIExplorer?ng_DrawAreaIE:ng_DrawArea;this.DrawAreaFromStr=ng_DrawAreaFromStr;this.ClearCanvas=ng_ClearCanvas;this.CanvasEndUpdate=ng_CanvasEndUpdate;this.CanvasBeginUpdate=
ng_CanvasBeginUpdate;this.AddPopupIcon=ng_AddPopupIcon;this.ClearPopupIcons=ng_ClearPopupIcons;this.RemovePopupIconByID=ng_RemovePopupIconByID;this.RemovePopupIconsByID=ng_RemovePopupIconsByID;this.CreatePopupHTML=ng_CreatePopupHTML;this.PopupIconExists=ng_PopupIconExists;this.ShowPopupByID=ng_ShowPopupByID;this.HidePopup=ng_HidePopup;this.GetActiveObjByID=ng_GetActiveObjByID;this.ShowActiveObjPopupByID=ng_ShowActiveObjPopupByID;this.ShowActiveObjPopup=ng_ShowActiveObjPopup;this.SetMapSession=ng_SetMapSession;
this.GetMapSession=ng_GetMapSession;this.Offset=ng_Offset;this.URLStateParams=ng_URLStateParams;this.SetCursor=ng_SetCursor;this.ProcessUrl=ng_ProcessUrl;this.MapContainerLeft=ng_MapContainerLeft;this.MapContainerTop=ng_MapContainerTop;this.OnHidePopup=this.OnEndAnimation=this.OnStartAnimation=this.OnMouseLeave=this.OnMouseEnter=this.OnKeyUp=this.OnKeyDown=this.OnMouseWheel=this.OnDblClick=this.OnMouseUp=this.OnMouseMove=this.OnMouseDown=this.OnGetMousePosition=this.OnActiveObjectMenu=this.OnActiveLayers=
this.OnMapMenu=this.OnDrawOverlay=this.OnPreviewRectChanged=this.OnPositionChanged=this.OnOffsetChanged=this.OnOffsetChanging=this.OnSetMapSession=this.OnTilesLoaded=this.OnTilesLoading=this.OnCommandCancel=this.OnCommandFinished=this.OnCommand=this.OnModeChanged=this.OnModeChanging=this.OnInitialize=null;if(!ngMapEventsInitialized){document.onkeydown=ngAddEvent(document.onkeydown,OnMapKeyDown);document.onkeyup=ngAddEvent(document.onkeyup,OnMapKeyUp);document.onmousedown=ngAddEvent(document.onmousedown,
OnMapMouseDown);document.onmousemove=ngAddEvent(document.onmousemove,OnMapMouseMove);document.onmouseout=ngAddEvent(document.onmouseout,OnMapMouseOut);document.onmouseup=ngAddEvent(document.onmouseup,OnMapMouseUp);document.ondblclick=ngAddEvent(document.ondblclick,OnMapDblClick);document.onmousewheel=ngAddEvent(document.onmousewheel,OnMapWheel);window.addEventListener&&window.addEventListener("DOMMouseScroll",OnMapWheel,false);ngMapEventsInitialized=true}};
