// Copyright (c) Position s.r.o.
// All rights reserved.

var ngMapVer=2,ngMapSubVer=0,ngMapAPIVersion=ngMapVer+"."+ngMapSubVer,ngMapAPIKey="",ngCurrentMap=null,ngCurrentMapElm=null,ngMouseMap=null,ngKeyMap=null,CTRL_DOWN=false,ALT_DOWN=false,SHIFT_DOWN=false,PROJ_WGS="WGS-84",PROJ_UTM="UTM",curZoomIn=101,curZoomOut=102,curPan=103,curDefault=0,NGLAYER_POPUP="_popup",NGLAYER_POPUPICONS="_popupicons",NGLAYER_ACTIVEOBJS="_activeobjs",NGLAYER_SERVERDRAW="_serverdraw",OnKeyDownBefore=typeof OnKeyDownBefore=="undefined"?null:OnKeyDownBefore,OnKeyDownAfter=typeof OnKeyDownAfter==
"undefined"?null:OnKeyDownAfter,OnKeyUpBefore=typeof OnKeyUpBefore=="undefined"?null:OnKeyUpBefore,OnKeyUpAfter=typeof OnKeyUpAfter=="undefined"?null:OnKeyUpAfter,OnMouseDownBefore=typeof OnMouseDownBefore=="undefined"?null:OnMouseDownBefore,OnMouseDownAfter=typeof OnMouseDownAfter=="undefined"?null:OnMouseDownAfter,OnMouseUpBefore=typeof OnMouseUpBefore=="undefined"?null:OnMouseUpBefore,OnMouseUpAfter=typeof OnMouseUpAfter=="undefined"?null:OnMouseUpAfter,OnMouseMoveBefore=typeof OnMouseMoveBefore==
"undefined"?null:OnMouseMoveBefore,OnMouseMoveAfter=typeof OnMouseMoveAfter=="undefined"?null:OnMouseMoveAfter,OnDblClickBefore=typeof OnDblClickBefore=="undefined"?null:OnDblClickBefore,OnDblClickAfter=typeof OnDblClickAfter=="undefined"?null:OnDblClickAfter,OnMouseWheelBefore=typeof OnMouseWheelBefore=="undefined"?null:OnMouseWheelBefore,OnMouseWheelAfter=typeof OnMouseWheelAfter=="undefined"?null:OnMouseWheelAfter,OnWindowResize=typeof OnWindowResize=="undefined"?null:OnWindowResize,OnMapCreated=
typeof OnMapCreated=="undefined"?null:OnMapCreated,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;this.icon=a!=""?ng_PreloadImage(a):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}this.CancelMapMove();if(this.ImageZoomL!=-1){this.SwapMapLayers(this.MapLayer==1?2:1);this.ImageZoomL=-1;this.ShowCanvas();this.ImageZoomAnimFinished()}}
function ng_ImageZoomAnim(b,a,c,d,e,f,h){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 h!="undefined"?h: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,c){c=ngVal(c,false);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();this.PanNoPosChanged=c;ng_DoPan(this.MapID)}else{this.SetMapOffsetEx(this.X+b,this.Y+a);c||this.PositionChanged()}}
var ng_LeaveMapTimer=null;function ng_EnterMap(b){if(!ng_inDOM(ngCurrentMapElm))ngCurrentMap=ngCurrentMapElm=null;if(this.ngMap&&(!ngCurrentMapElm||ng_containsDOM(ngCurrentMapElm,this))){ng_LeaveMapTimer&&clearTimeout(ng_LeaveMapTimer);ng_LeaveMapTimer=null;ngCurrentMap&&ngCurrentMap!=this.ngMap&&ng_DoLeaveMap();ngCurrentMap=this.ngMap;ngCurrentMap.MouseOnMap=true;ngCurrentMapElm=this;ngCurrentMap.OnMouseEnter&&ngCurrentMap.OnMouseEnter(ngCurrentMap)}}
function ng_DoLeaveMap(){ng_LeaveMapTimer&&clearTimeout(ng_LeaveMapTimer);ng_LeaveMapTimer=null;if(ngCurrentMap){ngCurrentMap.MouseOnMap=false;ngCurrentMap.OnMouseLeave&&ngCurrentMap.OnMouseLeave(ngCurrentMap)}ngCurrentMap=null}function ng_LeaveMap(b){if(!ng_inDOM(ngCurrentMapElm))ngCurrentMap=ngCurrentMapElm=null;if(ngCurrentMapElm==this){ng_LeaveMapTimer=setTimeout("ng_DoLeaveMap();",100);ngCurrentMapElm=null}}
function ng_MapContainerLeft(){var b=this.ObjMap[0];if(b)return ng_findMousePosX(b);return 0}function ng_MapContainerTop(){var b=this.ObjMap[0];if(b)return ng_findMousePosY(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();this.MouseY=(b.clientY?b.clientY:b.offsetY)-this.MapContainerTop();if(ngIExplorer&&screen.width>document.body.offsetWidth){this.MouseX-=2;this.MouseY-=2}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;if(typeof b=="undefined"){a=this.CurrentCursor;this.CurrentCursor=b+"_"}else 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[0])try{this.ObjMap[0].style.cursor=a}catch(d){}if(this.ObjMap[1])try{this.ObjMap[1].style.cursor=a}catch(e){}if(this.ObjMap[2])try{this.ObjMap[2].style.cursor=
a}catch(f){}if(this.ObjCanvas)try{this.ObjCanvas.style.cursor=a}catch(h){}for(var g in this.Canvas){if(this.ObjCanvasDI[g])try{this.ObjCanvasDI[g].style.cursor=a}catch(i){}if(this.ObjCanvasDC[g])try{this.ObjCanvasDC[g].style.cursor=a}catch(k){}}if(this.ObjSelRect)try{this.ObjSelRect.style.cursor=a}catch(l){}if(this.ObjSelRect2)try{this.ObjSelRect2.style.cursor=a}catch(n){}if(this.ObjPreview)try{this.ObjPreview.style.cursor=a}catch(p){}if(b=document.getElementById(this.MapID+"_ImgMap"))try{b.style.cursor=
a}catch(m){}}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=this.ngMap){if(!ng_inDOM(b.CurrentMapMenu))b.CurrentMapMenu=null;if(!b.CurrentMapMenu||ng_containsDOM(b.CurrentMapMenu,this)){b.CurrentMapMenu=this;b.InMapMenu=true}}}
function ng_LeaveMapMenu(b){if(b=this.ngMap){if(!ng_inDOM(b.CurrentMapMenu))b.CurrentMapMenu=null;if(b.CurrentMapMenu==this){b.CurrentMapMenu=null;b.InMapMenu=false;b.HideMapMenuTimer=setTimeout("ng_HideMapMenuTimer('"+b.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;this.CurrentMapMenu=null;b.style.visibility="hidden";b.innerHTML=""}}function ng_FixKeyEventsSimulate(b,a,c){var d=b.keyCode;try{b.keyCode=a}catch(e){}c?OnMapKeyUp(b):OnMapKeyDown(b);try{b.keyCode=d}catch(f){}}
function ng_FixKeyEvents(b){ngVal(b.shiftKey,SHIFT_DOWN)!=SHIFT_DOWN&&ng_FixKeyEventsSimulate(b,16,SHIFT_DOWN);ngVal(b.ctrlKey,CTRL_DOWN)!=CTRL_DOWN&&ng_FixKeyEventsSimulate(b,17,CTRL_DOWN);ngVal(b.altKey,ALT_DOWN)!=ALT_DOWN&&ng_FixKeyEventsSimulate(b,18,ALT_DOWN)}
function OnMapMouseDown(b){if(!b)b=window.event;ng_FixKeyEvents(b);if(OnMouseDownBefore&&!ngVal(OnMouseDownBefore(b),false))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||ngVal(a.OnMouseDown(a,b),false))if(a.MouseEvents){b.preventDefault&&b.preventDefault();a.MouseSelLeft=a.MouseX;a.MouseSelRight=a.MouseX;a.MouseSelTop=a.MouseY;a.MouseSelBottom=a.MouseY;if(ngOpera&&
ngOperaVersion<10.5&&a.OnMapMenu&&a.MapMenuTimeout>0){a.CancelImageZoomAnim();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.CancelImageZoomAnim();a.MapMenuTimer=setTimeout("ng_ShowMapMenuTimer("+a.MouseX+","+a.MouseY+",'"+a.MapID+"');",a.MapMenuTimeout)}}else{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;a.MouseDownTime=(new Date).getTime();ngMouseMap=a}}if(OnMouseDownAfter){b=OnMouseDownAfter(b);if(typeof b!="undefined")return b}return true}
function OnMapMouseMove(b){if(!b)b=window.event;ng_FixKeyEvents(b);ngIExplorer&&ngMouseMap&&ngMouseMap.MouseDown&&!b.button&&OnMapMouseUp(b);if(OnMouseMoveBefore&&!ngVal(OnMouseMoveBefore(b),false))return true;var a=ngMouseMap;if(a){a.GetMousePosition(b);if(!a.OnMouseMove||ngVal(a.OnMouseMove(a,b),false))if(a.MouseDown==1){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);a.OnMouseMove&&a.OnMouseMove(a,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){b.className=c.PopupStyle;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&&!ngVal(OnMouseUpBefore(b),false)){if(a)a.MouseDown=0;ngMouseMap=null;return true}if(a){a.GetMousePosition(b);var c=!a.OnMouseUp||ngVal(a.OnMouseUp(a,b),false),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&&!ngVal(OnDblClickBefore(b),false))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||ngVal(a.OnDblClick(a,b),false))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&&!ngVal(OnMouseWheelBefore(b),false))return true;var a=ngCurrentMap;if(a)if(!a.OnMouseWheel||ngVal(a.OnMouseWheel(a,b),false))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;this.MapNeedRefresh||Math.abs(c)>e||Math.abs(d)>f||Math.abs(c)<=3&&Math.abs(d)<=3?this.SetMapOffsetEx(b,a):this.Pan(c,d,true)}}}
function ng_SetMapOffsetEx(b,a){this.CancelRefreshTiles();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.MapServers.length!=0&&this.MapURL!=""&&(!this.OnOffsetChanging||ngVal(this.OnOffsetChanging(this,b,a),false))){var c,d,e,f,h,g,i,k,l,n;this.X=b;this.Y=a;!this.InCmd&&this.TileLoadingCnt>0&&this.HideSecondMapLayer();this.TilesCanceledByCommand=false;
var p=Math.round((b-this.TileColCount*this.TileWidth/2)/this.TileWidth+0.5),m=Math.round((a-this.TileRowCount*this.TileHeight/2)/this.TileHeight+0.5);this.TileOffsetX=Math.round(this.MapWidth/2+(p*this.TileWidth-b)-this.TileWidth/2);this.TileOffsetY=Math.round(this.MapHeight/2+(m*this.TileHeight-a)-this.TileHeight/2);(c=this.ObjMap[this.MapLayer])&&ng_setLeftTop(c,this.TileOffsetX,this.TileOffsetY);var t=this.CanvasX-b,u=this.CanvasY-a;this.LastTileStx=p;this.LastTileSty=m;g=p%this.TileColCount;i=
m%this.TileRowCount;if(g<0)g+=this.TileColCount;if(i<0)i+=this.TileRowCount;var v=g;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 w=this.TileRowCount*this.TileColCount,s="";if(this.RefreshTimeStamp!="")s="&"+this.RefreshTimeStamp;for(h=0;h<this.TileRowCount;h++){b=0;g=v;for(f=0;f<this.TileColCount;f++){if(c=
this.Tiles[this.MapLayer][i][g]){d=p+f;e=m+h;e=ng_AddURLParam(this.MapServers[Math.abs(d+e)%this.MapServers.length]+this.MapURL,"PX="+d+"&PY="+e+s);if(c.src!=e){k=b+this.TileOffsetX;d=a+this.TileOffsetY;l=k+this.TileWidth;n=d+this.TileHeight;if(l<0||n<0||k>=this.MapWidth||d>=this.MapHeight){ng_setBounds(c,b,a,this.TileWidth,this.TileHeight);c.style.visibility="hidden"}else{this.TileLoading[this.MapLayer][i][g]||this.TileLoadingCnt++;this.TileLoading[this.MapLayer][i][g]=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=k+this.TileWidth/2-this.MapWidth/2;d=d+this.TileHeight/2-this.MapHeight/2;e=Math.round(Math.sqrt(e*e+d*d)/r*w);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][i][g])c.style.visibility="visible"}}b+=this.TileWidth;
g++;if(g>=this.TileColCount)g=0}a+=this.TileHeight;i++;if(i>=this.TileRowCount)i=0}this.SetCanvasOffset(t,u);for(f=0;f<q.length;f++){c=q[f];if(typeof c!="undefined")for(h=c.length-1;h>=0;h--){d=c[h];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 h,g,i=this.TileWidth*b,k=this.TileHeight*b;g=Math.round((c*b-this.TileColCount*i/2)/i+0.5);h=Math.round((d*b-this.TileRowCount*k/2)/k+0.5);c=this.MapWidth/2+(g*i-c*b)-i/2;d=this.MapHeight/2+(h*k-d*b)-k/2;c+=(this.MapWidth/2-e)*(b-1);d+=(this.MapHeight/2-f)*(b-1);(b=this.ObjMap[a])&&ng_setLeftTop(b,c,d);g=g%this.TileColCount;f=h%this.TileRowCount;if(g<0)g+=this.TileColCount;if(f<0)f+=this.TileRowCount;c=g;d=Math.round(i+0.5);var l=Math.round(k+0.5);for(e=0;e<
this.TileRowCount;e++){g=c;for(h=0;h<this.TileColCount;h++){(b=this.Tiles[a][f][g])&&ng_setBounds(b,Math.round(h*i),Math.round(e*k),d,l);g++;if(g>=this.TileColCount)g=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();if(this.RefreshL!=-1){this.SwapMapLayers(this.RefreshL==1?2:1);this.MapLayer=this.RefreshL;this.RefreshTimeStamp=this.RefreshTS;this.RefreshL=-1}this.OnTilesLoaded&&this.OnTilesLoaded(this)}
function ng_SetMapSize(b,a){var c=false;if(b<=0||a<=0){var d=this.ObjMap[0];if(b<=0)b=ng_ClientWidth(d);if(a<=0)a=ng_ClientHeight(d)}if(b<=0)b=this.MapWidth;if(a<=0)a=this.MapHeight;if(!(b<=0||a<=0)){d=this.ObjMap[1];var e=this.ObjMap[2];if(d&&e){b>0&&ng_SetClientWidth(d,b);a>0&&ng_SetClientHeight(d,a);e.style.width=d.style.width;e.style.height=d.style.height;if(!this.Initialized){this.MapWidth=b;this.MapHeight=a;return}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,h=new ngStringBuilder;for(j=0;j<this.TileRowCount;j++)for(g=0;g<this.TileColCount;g++){f.append('<img id="'+this.MapID+"T1_"+g+"_"+j+'" class="cMT" />');h.append('<img id="'+this.MapID+"T2_"+g+"_"+j+'" class="cMT" />')}d.innerHTML=f.toString();e.innerHTML=h.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(g=0;g<this.TileColCount;g++){d=document.getElementById(this.MapID+"T1_"+g+"_"+j);d.layer=1;d.col=g;d.row=j;e=document.getElementById(this.MapID+"T2_"+g+"_"+j);e.layer=2;e.col=g;e.row=j;this.Tiles[1][j][g]=d;this.Tiles[2][j][g]=e;this.TileLoading[1][j][g]=false;this.TileLoading[2][j][g]=false}}}d=this.TileColCount*this.TileWidth;e=
this.TileRowCount*this.TileHeight;if(this.ObjCanvas){ng_SetClientWidth(this.ObjCanvas,d);ng_SetClientHeight(this.ObjCanvas,e)}for(var g in this.Canvas)if(f=this.ObjCanvasDC[g]){f.width=d;f.height=e}if(b!=this.MapWidth||a!=this.MapHeight){this.MapWidth=b;this.MapHeight=a;this.ClearCanvas();c=true}this.Refresh();if(c)this.PreviewParent?this.PreviewParent.Update():this.Update()}}var AutoSizeMaps=null,AutoSizeMapsCnt=0,AutoSizeTimer=null;
function OnMapResize(b){clearTimeout(AutoSizeTimer);if(AutoSizeMaps&&AutoSizeMapsCnt>0)AutoSizeTimer=setTimeout("OnMapResizeEvent()",100);if(OnWindowResize){b=OnWindowResize(b);if(typeof b!="undefined")return b}}
function OnMapResizeEvent(){clearTimeout(AutoSizeTimer);if(AutoSizeMaps&&AutoSizeMapsCnt>0){var b,a;for(var c in AutoSizeMaps)if(b=AutoSizeMaps[c]){if(b.PreviewParent)if(a=AutoSizeMaps[b.PreviewParent.MapID])continue;if(b.PreviewMap)if(a=AutoSizeMaps[b.PreviewMap.MapID])a.OnMapResize?a.OnMapResize(a):a.SetMapSize(0,0);b.OnMapResize?b.OnMapResize(b):b.SetMapSize(0,0)}}}
function ng_SetAutoSize(b){if(b){AutoSizeMaps||(AutoSizeMaps=[]);if(!AutoSizeMaps[this.MapID]){AutoSizeMaps[this.MapID]=this;AutoSizeMapsCnt++}}else if(AutoSizeMaps&&AutoSizeMaps[this.MapID]){AutoSizeMaps[this.MapID]=null;AutoSizeMapsCnt--;if(AutoSizeMapsCnt<=0){AutoSizeMapsCnt=0;AutoSizeMaps=null}}}function ng_HideCanvas(){var b=this.ObjCanvas;if(b){b.style.visibility="hidden";b.style.display="none"}if(b=this.ObjPreview){b.style.visibility="hidden";b.style.display="none"}}
function ng_ShowCanvas(){var b=this.ObjCanvas;if(b){b.style.visibility="visible";b.style.display="block"}if(b=this.ObjPreview){b.style.visibility="visible";b.style.display="block"}}function ng_ShowCanvasLayer(b){var a=this.CanvasLayerDC(b);if(a){a.style.visibility="visible";a.style.display="block"}if(a=this.CanvasLayerDI(b)){a.style.visibility="visible";a.style.display="block"}}
function ng_HideCanvasLayer(b){var a=this.CanvasLayerDC(b);if(a){a.style.visibility="hidden";a.style.display="none"}if(a=this.CanvasLayerDI(b)){a.style.visibility="hidden";a.style.display="none"}}function ng_IsCanvasLayerVisible(b){var a=this.CanvasLayerDC(b);if(a)return ng_GetCurrentStyle(a,"display")=="block";if(a=this.CanvasLayerDI(b))return ng_GetCurrentStyle(a,"display")=="block";return false}
function ng_ClearCanvasEx(b,a,c){this.ClearCanvasEx2(b-this.X,a-this.Y,c);this.CanvasX=b;this.CanvasY=a}function ng_ClearCanvas(b){this.ClearCanvasEx2(0,0,b)}
function ng_ClearCanvasEx2(b,a,c){var d=this.TileColCount*this.TileWidth,e=this.TileRowCount*this.TileHeight,f,h;for(var g in this.Canvas){f=typeof c=="undefined"?g:c;if(ngChrome&&f==NGLAYER_ACTIVEOBJS)if(h=document.getElementById(this.MapID+"_ImgMap2"))h.name="";if(h=ngVal(this.Canvas[f],null)){if(ngVal(h.NoClear,false)){if(typeof c!="undefined")break;continue}h.HTML=new ngStringBuilder}if(h=this.ObjCanvasDI[f])h.innerHTML="";if(!ngIExplorer)if((h=this.ObjCanvasDC[f])&&h.getContext)(h=h.getContext("2d"))&&
h.clearRect(0,0,d,e);switch(f){case NGLAYER_POPUP:this.InPopupObj=this.InPopupRect=false;h=this.CanvasBeginUpdate(NGLAYER_POPUP);h.HTML.append('<div id="'+this.MapID+'_Popup" class="'+this.PopupStyle+'" onmouseover="ng_EnterPopup(event,this,\''+this.MapID+"');\" onmouseout=\"ng_LeavePopup(event,this,'"+this.MapID+"');\"></div>");this.CanvasEndUpdate();break}if(typeof c!="undefined")break}if(typeof b!="undefined"){if(h=this.ObjCanvas){ng_setLeftTop(h,this.TileOffsetX+b,this.TileOffsetY+a);b=h.offsetLeft}this.CanvasOffsetX=
this.TileOffsetX;this.CanvasOffsetY=this.TileOffsetY;this.CanvasX=this.X;this.CanvasY=this.Y}}function ng_SetCanvasOffset(b,a){b+=this.CanvasOffsetX;a+=this.CanvasOffsetY;var c=this.ObjCanvas;if(c){ng_setLeftTop(c,b,a);b=c.offsetLeft}}function ng_CurrentCanvas(){return this.CanvasUpdates.length>0?this.CanvasUpdates[this.CanvasUpdates.length-1]:"Client"}
function ng_CanvasLayer(b){if(typeof b=="undefined"||b=="")return null;var a=this.Canvas[b];if(typeof a!="object"){a={};a.HTML=new ngStringBuilder;a.UpdateCnt=0;this.Canvas[b]=a}return a}function ng_ClearCanvasLayer(b){this.ClearCanvasEx2(undefined,undefined,b)}
function ng_CanvasLayerDC(b){if(ngIExplorer)return null;var a=ngVal(this.ObjCanvasDC[b],null);if(a)return a;var c=this.MapID+"_CDC_"+b;if(a=document.getElementById(c))return this.ObjCanvasDC[b]=a;if(a=document.getElementById(this.MapID+"_Canvas")){var d=this.TileColCount*this.TileWidth,e=this.TileRowCount*this.TileHeight,f=document.createElement("canvas");f.className="cDC";f.id=c;f.width=d;f.height=e;c=this.CanvasLayer(b);if(typeof c.zIndex!="undefined")f.style.zIndex=c.zIndex;a.appendChild(f);this.ObjCanvasDC[b]=
f}this.SetCursor();return ngVal(this.ObjCanvasDC[b],null)}
function ng_CanvasLayerDI(b){var a=ngVal(this.ObjCanvasDI[b],null);if(a)return a;var c=this.MapID+"_CDI_"+b;if(a=document.getElementById(c))return this.ObjCanvasDI[b]=a;if(a=document.getElementById(this.MapID+"_Canvas")){var d=document.createElement("div");d.className="cDC";d.id=c;d.onselectstart=function(){return false};d.onselect=function(){return false};c=this.CanvasLayer(b);if(typeof c.zIndex!="undefined")d.style.zIndex=c.zIndex;a.appendChild(d);this.ObjCanvasDI[b]=d}this.SetCursor();return ngVal(this.ObjCanvasDI[b],
null)}function ng_CanvasBeginUpdate(b){if(typeof b=="undefined"||b=="")b=this.CurrentCanvas();var a=this.CanvasLayer(b);this.CanvasUpdates.push(b);a.UpdateCnt++;return a}function ng_CanvasEndUpdate(){var b="";if(this.CanvasUpdates.length>0)b=this.CanvasUpdates.pop();var a=this.CanvasLayer(b);if(!a)return"";a.UpdateCnt--;if(a.UpdateCnt<=0){a.UpdateCnt=0;if(!a.HTML.empty()){var c=this.CanvasLayerDI(b);if(c)c.innerHTML+=a.HTML.toString();a.HTML=new ngStringBuilder}}return b}
function ng_CanvasDrawOffsetX(){return-this.CanvasOffsetX}function ng_CanvasDrawOffsetY(){return-this.CanvasOffsetY}function ng_CanvasScreenPt(b,a){return new ScreenPt(b+(this.X-this.CanvasX),a+(this.Y-this.CanvasY))}function ng_CanvasOffsetPt(b,a){return new ScreenPt(b+(this.CanvasX-(this.MapWidth-this.TileWidth)/2),a+(this.CanvasY-(this.MapHeight-this.TileHeight)/2))}function ng_CanvasMousePt(){return this.CanvasScreenPt(this.MouseX,this.MouseY)}
function ng_DrawOverlay(){this.OnDrawOverlay&&this.OnDrawOverlay(this)}
function ng_DrawIcon(b,a,c,d,e,f,h){if(typeof h=="undefined")h=this.CurrentCanvas();f=ngVal(f,"");var g=this.CanvasDrawOffsetX(),i=this.CanvasDrawOffsetY();a=new ScreenPt(a.x,a.y);a.x+=g-e.x;a.y+=i-e.y;e=false;if(!ngIExplorer)if((g=this.CanvasLayerDC(h))&&g.getContext){e=g.getContext("2d");e.globalAlpha=1;g=ng_PreloadImage(b);e.beginPath();e.drawImage(g,a.x,a.y,c,d);e=true}if(!e)if(e=document.getElementById(f)){e.style.left=a.x+"px";e.style.top=a.y+"px";e.style.width=c+"px";e.style.height=d+"px";
if(ngIExplorer)e.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+b+"', sizingMethod='image')"}else{h=this.CanvasBeginUpdate(h);h.HTML.append("<span "+(f==""?"":'id="'+f+'" ')+'class="cMI" style="left:'+a.x+"px;top:"+a.y+"px;width:"+c+"px;height:"+d+"px;");ngIExplorer&&h.HTML.append("filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+b+"', sizingMethod='image')");h.HTML.append(';"></span>');this.CanvasEndUpdate()}}
function ng_DrawLine(b,a,c,d,e,f){if(!(b.lenght<2)){if(typeof f=="undefined")f=this.CurrentCanvas();e=this.CanvasDrawOffsetX();var h=this.CanvasDrawOffsetY();if((f=this.CanvasLayerDC(f))&&f.getContext)if(f=f.getContext("2d")){f.globalAlpha=d;f.strokeStyle=a;f.lineWidth=c;f.beginPath();for(a=0;a<b.length;a++)a==0?f.moveTo(b[a].x+e,b[a].y+h):f.lineTo(b[a].x+e,b[a].y+h);f.stroke()}}}
function ng_DrawLineIE(b,a,c,d,e,f){if(!(b.lenght<2)){e=ngVal(e,"");for(var h=this.CanvasDrawOffsetX(),g=this.CanvasDrawOffsetY(),i=this.TileColCount*this.TileWidth,k=this.TileRowCount*this.TileHeight,l=new ngStringBuilder,n=0;n<b.length;n++)l.append((!n?"m ":"l ")+Math.round(b[n].x+h)+","+Math.round(b[n].y+g)+" ");l.append("e");if(b=document.getElementById(e)){b.style.width=i+"px";b.style.height=k+"px";b.coordsize=i+" "+k;b.strokecolor=a;b.strokeweight=c+"px";b.path=l.toString();a=document.getElementById(e+
"_s");if(d<1){if(!a){a=document.createElement("v:stroke");a.id=e+"_s";b.appendChild(a)}a.opacity=d}else if(a)a.opacity=1}else{f=this.CanvasBeginUpdate(f);f.HTML.append("<v:shape "+(e==""?"":'id="'+e+'" ')+'class="cDC" onmousemove="ng_SyncCursor(\''+this.MapID+'\',this);" onselectstart="return false;" onselect="return false;" style="width:'+i+"px; height:"+k+'px;" coordorigin="0 0" coordsize="'+i+" "+k+'" filled="f" stroked="t" strokecolor="'+a+'" strokeweight="'+c+'px" path="');f.HTML.append(l);d<
1?f.HTML.append('" ><v:stroke '+(e==""?"":'id="'+e+'_s" ')+'opacity="'+d+'" /></v:shape>'):f.HTML.append('" />');this.CanvasEndUpdate()}}}function ng_DrawLineFromStr(b,a,c,d,e,f){if(typeof b=="object"&&b!=null){this.CanvasBeginUpdate(f);for(var h=0;h<b.length;h++){var g=PointsFromStr(b[h]);this.DrawLine(g,a,c,d,e+"_"+(h+1))}this.CanvasEndUpdate()}if(typeof b=="string"){this.CanvasBeginUpdate(f);g=PointsFromStr(b);this.DrawLine(g,a,c,d,e);this.CanvasEndUpdate()}}
function ng_DrawArea(b,a,c,d,e,f,h){this.DrawAreaEx(b,a,c,e,d,e,f,h)}function ng_DrawAreaFromStr(b,a,c,d,e,f,h){if(typeof b=="object"&&b!=null){this.CanvasBeginUpdate(h);for(var g=0;g<b.length;g++){var i=PointsFromStr(b[g]);this.DrawArea(i,a,c,d,e,f+"_"+(g+1))}this.CanvasEndUpdate()}if(typeof b=="string"){this.CanvasBeginUpdate(h);i=PointsFromStr(b);this.DrawArea(i,a,c,d,e,f);this.CanvasEndUpdate()}}
function ng_DrawCircleArc(b,a,c,d,e,f,h,g,i,k,l){e=ngVal(e,0);f=ngVal(f,"");h=ngVal(h,1);g=ngVal(g,"");i=ngVal(i,1);if(typeof l=="undefined")l=this.CurrentCanvas();k=this.CanvasDrawOffsetX();var n=this.CanvasDrawOffsetY();if((l=this.CanvasLayerDC(l))&&l.getContext)if(l=l.getContext("2d")){l.globalAlpha=h;l.strokeStyle=f;l.lineWidth=e;l.beginPath();l.arc(b.x+k,b.y+n,a,(c-90)*(Math.PI/180),(d-90)*(Math.PI/180),false);if(g!=""){l.fillStyle=g;l.globalAlpha=i;l.fill()}if(e>0){l.lineWidth=e;l.strokeStyle=
f;l.globalAlpha=h;l.stroke()}l.closePath()}}
function ng_DrawCircleArcIE(b,a,c,d,e,f,h,g,i,k,l){e=ngVal(e,0);f=ngVal(f,"");h=ngVal(h,1);g=ngVal(g,"");i=ngVal(i,1);k=ngVal(k,"");var n=this.CanvasDrawOffsetX(),p=this.CanvasDrawOffsetY(),m=document.getElementById(k);if(m){m.style.left=b.x+n-a+"px";m.style.top=b.y+p-a+"px";m.style.width=2*a+"px";m.style.height=2*a+"px";m.startangle=c;m.endangle=d;m.filled=g==""?"False":"True";m.stroked=e==0?"False":"True";if(e>0){m.strokecolor=f;m.strokeweight=e+"px"}if(g!="")m.fillcolor=g;b=document.getElementById(k+
"_s");if(h<1){if(!b){b=document.createElement("v:stroke");b.id=k+"_s";m.appendChild(b)}b.opacity=h}else if(b)b.opacity=h;h=document.getElementById(k+"_f");if(i<1){if(!h){h=document.createElement("v:fill");h.id=k+"_f";m.appendChild(h)}h.opacity=i}else if(h)h.opacity=i}else{m=this.CanvasBeginUpdate(l);m.HTML.append("<v:arc "+(k==""?"":'id="'+k+'" ')+'class="cDC" onmousemove="ng_SyncCursor(\''+this.MapID+'\', this);" onselectstart="return false;" onselect="return false;" style="left:'+(b.x+n-a)+"px;top:"+
(b.y+p-a)+"px;width:"+2*a+"px; height:"+2*a+'px;" startangle="'+c+'" endangle="'+d+'" filled="'+(g==""?"False":"True")+'" stroked="'+(e==0?"False":"True")+'"');e>0&&m.HTML.append(' strokecolor="'+f+'" strokeweight="'+e+'px"');g!=""&&m.HTML.append(' fillcolor="'+g+'" ');m.HTML.append(">");if(h<1)m.HTML.append("<v:stroke "+(k==""?"":'id="'+k+'_s" ')+'opacity="'+h+'" />');if(i<1)m.HTML.append("<v:fill "+(k==""?"":'id="'+k+'_f" ')+'opacity="'+i+'" />');m.HTML.append("</v:arc>");this.CanvasEndUpdate()}}
function ng_DrawAreaEx(b,a,c,d,e,f,h,g){if(!(b.lenght<3)){a=ngVal(a,"");c=ngVal(c,0);d=ngVal(d,1);e=ngVal(e,"");f=ngVal(f,1);if(typeof g=="undefined")g=this.CurrentCanvas();h=this.CanvasDrawOffsetX();var i=this.CanvasDrawOffsetY();if((g=this.CanvasLayerDC(g))&&g.getContext){g=g.getContext("2d");g.beginPath();for(var k=0;k<b.length;k++)k==0?g.moveTo(b[k].x+h,b[k].y+i):g.lineTo(b[k].x+h,b[k].y+i);g.lineTo(b[0].x+h,b[0].y+i);if(e!=""){g.fillStyle=e;g.globalAlpha=f;g.fill()}if(c>0){g.lineWidth=c;g.strokeStyle=
a;g.globalAlpha=d;g.stroke()}g.closePath()}}}
function ng_DrawAreaExIE(b,a,c,d,e,f,h,g){if(!(b.lenght<3)){a=ngVal(a,"");c=ngVal(c,0);d=ngVal(d,1);e=ngVal(e,"");f=ngVal(f,1);h=ngVal(h,"");for(var i=this.CanvasDrawOffsetX(),k=this.CanvasDrawOffsetY(),l=this.TileColCount*this.TileWidth,n=this.TileRowCount*this.TileHeight,p=new ngStringBuilder,m=0;m<b.length;m++)p.append((!m?"m ":"l ")+Math.round(b[m].x+i)+","+Math.round(b[m].y+k)+" ");closed&&p.append("l "+Math.round(b[0].x+i)+","+Math.round(b[0].y+k)+" ");p.append(" l "+Math.round(b[0].x+i)+","+
Math.round(b[0].y+k)+" xe");if(b=document.getElementById(h)){b.style.width=l+"px";b.style.height=n+"px";b.coordsize=l+" "+n;b.stroked=c==0?"False":"True";b.filled=e==""?"False":"True";if(c>0){b.strokecolor=a;b.strokeweight=c+"px"}if(e!="")b.fillcolor=e;b.path=p.toString();a=document.getElementById(h+"_s");if(d<1){if(a){a=document.createElement("v:stroke");a.id=h+"_s";b.appendChild(a)}a.opacity=d}else if(a)a.opacity=1;d=document.getElementById(h+"_f");if(f<1){if(!d){d=document.createElement("v:fill");
d.id=h+"_f";b.appendChild(d)}d.opacity=f}else if(d)d.opacity=1}else{g=this.CanvasBeginUpdate(g);g.HTML.append("<v:shape "+(h==""?"":'id="'+h+'" ')+'class="cDC" onmousemove="ng_SyncCursor(\''+this.MapID+'\',this);" onselectstart="return false;" onselect="return false;" style="width:'+l+"px; height:"+n+'px;" coordorigin="0 0" coordsize="'+l+" "+n+'" stroked="'+(c==0?"False":"True")+'" filled="'+(e==""?"False":"True")+'"');c>0&&g.HTML.append(' strokecolor="'+a+'" strokeweight="'+c+'px"');e!=""&&g.HTML.append(' fillcolor="'+
e+'"');g.HTML.append(' path="');g.HTML.append(p);g.HTML.append('" >');if(d<1)g.HTML.append("<v:stroke "+(h==""?"":'id="'+h+'_s" ')+'opacity="'+d+'" />');if(f<1)g.HTML.append("<v:fill "+(h==""?"":'id="'+h+'_f" ')+'opacity="'+f+'" />');g.HTML.append("</v:shape>");this.CanvasEndUpdate()}}}
function ng_GetElementHW(b){var a={height:0,width:0};if(typeof b=="string")b=document.getElementById(b);if(!b)return a;a.height=b.offsetHeight;a.width=b.offsetWidth;if(a.height==0||a.width==0){for(var c=[],d=b;d.parentNode;)if((d=d.parentNode)&&d.style&&d.style.display=="none"){c.push(d);d.style.display=ngIExplorer?"":"inherit"}d=b.offsetLeft;a.height=b.offsetHeight;a.width=b.offsetWidth;for(b=c.length-1;b>=0;b--)c[b].style.display="none"}return a}
function ng_DrawText(b,a,c,d,e,f,h){if(!(ngVal(b,"")==""||typeof a=="undefined")){c=ngVal(c,"");d=ngVal(d,0);e=ngVal(e,"top");f=ngVal(f,"");var g=this.CanvasDrawOffsetX(),i=this.CanvasDrawOffsetY(),k=0,l=0,n=document.getElementById(f);if(n&&n.innerHTML==b&&n.className==c){k=n.offsetHeight;l=n.offsetWidth}else{if(typeof h=="undefined"||h=="")h=this.CurrentCanvas();var p=this.CanvasLayerDI(h);if(!p)return;var m=document.createElement("DIV");if(!m)return;p.appendChild(m);m.className=c;m.style.position=
"absolute";m.style.visibility="hidden";m.style.whiteSpace="nowrap";m.innerHTML=b;k=m.offsetLeft;l=ng_GetElementHW(m);k=l.height;l=l.width;p.removeChild(m)}switch(e){case "center":e=a.x+g-l/2;a=a.y+i-k/2;break;case "topleft":e=a.x+g-d-l;a=a.y+i-d-k;break;case "topright":e=a.x+g+d;a=a.y+i-d-k;break;case "left":e=a.x+g-d-l;a=a.y+i-k/2;break;case "right":e=a.x+g+d;a=a.y+i-k/2;break;case "bottomleft":e=a.x+g-d-l;a=a.y+i+d;break;case "bottom":e=a.x+g-l/2;a=a.y+i+d;break;case "bottomright":e=a.x+g+d;a=a.y+
i+d;break;case "top":default:e=a.x+g-l/2;a=a.y+i-d-k;break}if(n){n.className=c;n.style.left=e+"px";n.style.top=a+"px";n.style.height=k+"px";n.style.width=l+"px";n.innerHTML=b}else{this.CanvasBeginUpdate(h).HTML.append('<DIV id="'+f+'" class="'+c+'" style="position: absolute; left: '+e+"px; top: "+a+"px; height: "+k+"px; width: "+l+'px; white-space: nowrap; overflow: hidden;">'+b+"</DIV>");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);a=this.CanvasBeginUpdate(NGLAYER_POPUPICONS);var f=this.CanvasDrawOffsetX(),h=this.CanvasDrawOffsetY();e.x-=d.hotspot.x;e.y-=d.hotspot.y;var g=d.icon.width,i=d.icon.height,k=d.icon.src;d.offsetx=f;d.offsety=h;d.popupx=e.x+g/2;d.popupy=e.y+i/2;e.x+=f;e.y+=h;d=0;if(typeof c!="undefined")d=c;c=this.DisplayPopupTimeout>0&&this.DisplayPopupByClick;if(ngIExplorer&&
k.indexOf("png")>=0){a.HTML.append('<span class="cMI" id="'+b+'" style="left:'+e.x+"px;top:"+e.y+"px;width:"+g+"px;height:"+i+"px;");c&&a.HTML.append("cursor:pointer;");a.HTML.append("filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+k+"', sizingMethod='image')");a.HTML.append(';" onmouseover="ngSPU(event,this,\''+this.MapID+"',"+d+');"');c&&a.HTML.append(" onclick=\"ngSPU3(this, '"+this.MapID+"');\"");a.HTML.append(" onmouseout=\"ngHPU(event,this,'"+this.MapID+"')\"></span>")}else{a.HTML.append('<img class="cMI" id="'+
b+'" style="left:'+e.x+"px;top:"+e.y+"px;width:"+g+"px;height:"+i+"px;");c&&a.HTML.append("cursor:pointer;");a.HTML.append('" src="'+k+'" alt="" border="0"');c&&a.HTML.append(" onclick=\"ngSPU3(this, '"+this.MapID+"');\"");a.HTML.append(" onmouseover=\"ngSPU(event,this,'"+this.MapID+"',"+d+');" onmouseout="ngHPU(event,this,\''+this.MapID+"')\" />")}this.CanvasEndUpdate()}}
function ng_DrawPopupIcons(b,a){this.CanvasBeginUpdate(NGLAYER_POPUPICONS);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=getMapByID(c)){if(!ng_inDOM(b.CurrentPopupIcon))b.CurrentPopupIcon=null;if(!b.CurrentPopupIcon||ng_containsDOM(b.CurrentPopupIcon,a)){b.CurrentPopupIcon=a;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)}}}
function ngSPU3(b,a){(a=getMapByID(a))&&a.ShowPopup(b,b.id);return false}function ngHPU(b,a,c){if(b=getMapByID(c)){if(!ng_inDOM(b.CurrentPopupIcon))b.CurrentPopupIcon=null;if(b.CurrentPopupIcon==a){b.CurrentPopupIcon=null;b.InPopupObj=false;b.HidePopupTimer=setTimeout("ng_HidePopupRectTimer('"+c+"');",100);b.CancelDisplayPopup();if(b.DisplayPopupTimeout>0&&b.DisplayPopupByClick){a=b.CurrentCursor;b.CurrentCursor="";b.SetCursor(a)}}}}
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 h=false,g=false;if(a+b.offsetWidth-28>this.MapWidth+e){h=true;a+=-b.offsetWidth+28}else a-=28;if(c-b.offsetHeight-12>f){g=true;c+=-b.offsetHeight-12}d=g?'<div class="'+this.PopupFrameStyle+'">'+d+'</div><div style="z-index: 503; position: relative; top:-1px; text-align:'+(h?"right":"left")+'"><img src="'+ngMapAPIURL+'/popupArrDown.gif" width="55" height="13" alt="" border="0" /></div>':'<div style="position: relative; z-index: 503; text-align:'+
(h?"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=getMapByID(c)){if(!ng_inDOM(b.CurrentPopup))b.CurrentPopup=null;if(!b.CurrentPopup||ng_containsDOM(b.CurrentPopup,a)){b.InPopupRect=true;b.CurrentPopup=a}}}function ng_LeavePopup(b,a,c){if(b=getMapByID(c)){if(!ng_inDOM(b.CurrentPopup))b.CurrentPopup=null;if(b.CurrentPopup==a){b.CurrentPopup=null;b.InPopupRect=false;b.HidePopupTimer=setTimeout("ng_HidePopupRectTimer('"+c+"');",100)}}}
function ngAPU(b,a,c,d,e,f){if(b=getMapByID(c)){if(!ng_inDOM(b.CurrentPopupIcon))b.CurrentPopupIcon=null;if(!b.CurrentPopupIcon||ng_containsDOM(b.CurrentPopupIcon,a)){b.CurrentPopupIcon=a;if(!b.DisplayPopupTimeout)return b.ShowActiveObjPopup(d,e,f);a=b.CurrentCursor;b.SetCursor("pointer");b.CurrentCursor=a;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)}}}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(this,a):this.OnActiveObjectMenu?this.OnActiveObjectMenu(this,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&&!ngVal(this.OnActiveLayers(this,b),false))){this.CancelDisplayPopup();this.ActiveLayers=b;var a=this.CanvasDrawOffsetX(),c=this.CanvasDrawOffsetY(),d,e,f,h,g=new ngStringBuilder,i=b.length,k=this.DisplayPopupTimeout>0&&this.DisplayPopupByClick;for(d=0;d<i;d++){h=b[d];if(typeof h=="object"){f=h.objs.length;for(e=0;e<f;e++){h.objs[e].offsetx=a;h.objs[e].offsety=c;g.append('<area shape="'+h.objs[e].shape+'" coords="'+h.objs[e].coords+
'"');k&&g.append(" onclick=\"ngAPU3('"+this.MapID+"',"+d+","+e+');"');g.append(" onmouseover=\"ngAPU(event,this,'"+this.MapID+"',"+d+","+e+');" onmouseout="ngHPU(event,this,\''+this.MapID+"')\" />")}}}if(g.empty()){if(b=document.getElementById(this.MapID+"_ImgMap"))b.style.visibility="hidden"}else{ngFireFox1x&&g.append('<area href="javascript:ngNop();" shape="rect" coords="0,0,'+this.MapWidth+","+this.MapHeight+'" />');h=this.CanvasBeginUpdate(NGLAYER_ACTIVEOBJS);h.HTML.clear();h.HTML.append('<img id="'+
this.MapID+'_ImgMap" src="'+ngMapAPIURL+'/empty.gif" style="position: absolute; left: '+a+"px; top: "+c+"px; width: "+this.MapWidth+"px; height: "+this.MapHeight+"px; z-index: 10; cursor:"+this.CurrentCursor+';" alt="" border="0" usemap="#'+this.MapID+'_ngmap" />');h.HTML.append('<map id="'+this.MapID+'_ImgMap2" name="'+this.MapID+'_ngmap">');h.HTML.append(g);h.HTML.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&&this.rpc.sendRequest(b)}
function ng_URLStateParams(b,a,c,d){a=ngVal(a,false);b=ngVal(b,true);c=ngVal(c,false);d=ngVal(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){if(this.Drawings){b=this.Drawings.GetServerData();b!=""&&e.append("&"+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&&!ngVal(this.OnCommand(this,b,c),false))){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(typeof this.ServerScale!="undefined"){this.Scale=this.ServerScale;this.ServerScale=undefined}else if(this.ZoomLevels&&this.ZoomLevel>=0&&this.ZoomLevel<this.ZoomLevels.length)this.Scale=this.ZoomLevels[this.ZoomLevel];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.PreviewMap&&this.PreviewMap.OnInitialize&&this.PreviewMap.OnInitialize(this.PreviewMap)}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){this.CancelRefreshTiles();if(c&&this.ZoomAnimation){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(ngKeyMap==this&&(b=="P"||b=="Z+"))b=b=="P"?"Z+":"P";if(!(this.OnModeChanging&&!ngVal(this.OnModeChanging(this,b),false))){if(b!=this.Mode){this.HidePopup();this.HideMapMenu()}this.SetMouseMode("");if(b=="P"){this.SetMouseMode("P");this.SetCursor(curPan)}if(b=="Z+"){this.SetMouseMode("R");this.SetCursor(curZoomIn)}this.Mode=b;if(ngKeyMap==this&&b!="P"&&b!="Z+")ngKeyMap=null;this.OnModeChanged&&this.OnModeChanged(this)}}else this.InitMode=b}
function ng_SetMouseMode(b){if(!(this.OnMouseModeChanging&&!ngVal(this.OnMouseModeChanging(this,b),false))){this.MouseMode=b;this.OnMouseModeChanged&&this.OnMouseModeChanged(this)}}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_RefreshTiles(b,a){if(!(!this.Initialized||this.RefreshL!=-1)){if(typeof b=="undefined")b=(new Date).getTime();if(typeof a=="undefined")a=true;clearTimeout(this.RefreshTimeout);this.RefreshTimeout=null;if(this.PanTimer||this.MouseDown||this.InCmd||this.TileLoadingCnt>0)this.RefreshTimeout=setTimeout("ng_DoRefreshTiles('"+this.MapID+"','"+b+"',"+(a?"true":"false")+");",1E3);else{var c=this.PreviewMap;c&&a&&c.RefreshTiles(b,false);a=this.MapLayer;c=this.RefreshTimeStamp;this.MapLayer=this.MapLayer==
1?2:1;this.LastClearedLayer=-1;this.ClearMapLayer(this.MapLayer);this.RefreshTimeStamp=b;this.MapNeedRefresh=true;this.SetMapOffsetEx(this.X,this.Y);this.RefreshL=this.MapLayer;this.RefreshTS=this.RefreshTimeStamp;this.MapLayer=a;this.RefreshTimeStamp=c}}}function ng_DoRefreshTiles(b,a,c){(b=getMapByID(b))&&b.RefreshTiles(a,c)}
function ng_CancelRefreshTiles(b){if(this.RefreshL!=-1){this.LastClearedLayer=-1;this.ClearMapLayer(this.RefreshL);if(typeof b=="undefined")b=1E3;clearTimeout(this.RefreshTimeout);this.RefreshTimeout=b>0?setTimeout("ng_DoRefreshTiles('"+this.MapID+"','"+this.RefreshTS+"',false);",b):null}this.RefreshL=-1}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,a){typeof b=="undefined"||b==""||this.MapCommand("L",ng_URLEncode(b)+"&LA="+(ngVal(a,true)?"1":"0"))}function ng_LocateScaleXY(b,a,c){typeof a=="undefined"||a==""||this.MapCommand("L",ng_URLEncode(a)+"&SC="+b+"&LA="+(ngVal(c,true)?"1":"0"))}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_HandleCtrlMode(b){if(b&&!ngKeyMap&&ngCurrentMap&&ngCurrentMap.AllowCtrl&&ngCurrentMap.MouseEvents&&ngCurrentMap.MouseOnMap&&!ngCurrentMap.MouseDown&&!ngCurrentMap.CurrentPopup&&!ngCurrentMap.CurrentMapMenu){if(ngCurrentMap.Mode=="P"||ngCurrentMap.Mode=="Z+"){ngCurrentMap.SetMode(ngCurrentMap.Mode=="P"?"Z+":"P");ngKeyMap=ngCurrentMap}}else if(!b&&ngKeyMap){b=ngKeyMap;ngKeyMap=null;b.SetMode(b.Mode=="P"?"Z+":"P")}}
function OnMapKeyDown(b){if(!b)b=window.event;if(OnKeyDownBefore&&!ngVal(OnKeyDownBefore(b),false))return true;var a=ngCurrentMap,c=b.keyCode;if(b.ctrlKey)CTRL_DOWN=true;if(b.altKey)ALT_DOWN=true;if(b.shiftKey)SHIFT_DOWN=true;ng_HandleCtrlMode(CTRL_DOWN||c==32&&(ngKeyMap||a&&a.Mode!="P"));if(a&&a.KeyEvents&&a.MouseOnMap){if(a.OnKeyDown&&!ngVal(a.OnKeyDown(a,b),false))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&&!ngVal(OnKeyUpBefore(b),false))return true;var a=ngCurrentMap;b.ctrlKey||(CTRL_DOWN=false);b.altKey||(ALT_DOWN=false);b.shiftKey||(SHIFT_DOWN=false);ng_HandleCtrlMode(CTRL_DOWN);if(a&&a.KeyEvents&&a.MouseOnMap){if(a.OnKeyUp&&!ngVal(a.OnKeyUp(a,b),false))return true;var c=b.keyCode;if(c==37||c==38||c==39||c==40){a.CancelMapMove();a.PositionChanged()}}if(OnKeyUpAfter){b=OnKeyUpAfter(b);if(typeof b!="undefined")return b}return true}
var ngMapIDs=[];function getMapByID(b){var a=document.getElementById(b);if(a){if(a.ngMap)return a.ngMap;(b=ngVal(ngMapIDs[b],null))&&b.RefreshObjReferences();return b}return null}
function ng_RefreshObjReferences(){var b=document.getElementById(this.MapID);if(b){b.ngMap=this;b.style.overflow="hidden";b.onmouseover=ng_EnterMap;b.onmouseout=ng_LeaveMap;if(b.style.background=="")b.style.background="url("+ngMapAPIURL+"/empty.gif)";b.oncontextmenu=ng_OnContextMenu;b.ondrag=ng_OnDrag}this.ObjMap=new Array(b,document.getElementById(this.MapID+"_M1"),document.getElementById(this.MapID+"_M2"));if(b=document.getElementById(this.MapID+"_Menu")){b.ngMap=this;b.onmouseover=ng_EnterMapMenu;
b.onmouseout=ng_LeaveMapMenu}this.ObjCanvas=document.getElementById(this.MapID+"_Canvas");this.ObjCanvasDI=[];this.ObjCanvasDC=[];for(var a in this.Canvas){this.ObjCanvasDI[a]=document.getElementById(this.MapID+"_CDI_"+a);this.ObjCanvasDC[a]=document.getElementById(this.MapID+"_CDC_"+a)}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");if(this.Initialized){var c,d;this.Tiles=new Array(null,[],[]);for(b=0;b<this.TileRowCount;b++){this.Tiles[1][b]=[];this.Tiles[2][b]=[];for(a=0;a<this.TileColCount;a++){c=document.getElementById(this.MapID+"T1_"+a+"_"+b);if(!c){this.SetMapSize(0,0);b=this.TileRowCount;break}c.layer=1;c.col=a;c.row=b;d=document.getElementById(this.MapID+"T2_"+a+"_"+b);if(!d){this.SetMapSize(0,0);b=this.TileRowCount;break}d.layer=2;d.col=a;d.row=b;this.Tiles[1][b][a]=c;this.Tiles[2][b][a]=d}}}}
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){if(this.MapServers.length)for(var b=0;b<this.MapServers.length;b++)this.MapServers[b]=ngHTTPProtocol+this.MapServers[b];else{b=document.location.href;var a=b.indexOf("://");if(a>=0)a=b.indexOf("/",a+3);if(a>=0){b=b.substring(0,a);this.MapServers[0]=b}}this.Initialized=1;this.SetMapSize(this.MapWidth,this.MapHeight);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 ngMapPreloadImages(){ng_PreloadImage(ngMapAPIURL+"/DynamicZoomIn.cur");ng_PreloadImage(ngMapAPIURL+"/ZoomOut.cur");ng_PreloadImage(ngMapAPIURL+"/Pan.cur");ng_PreloadImage(ngMapAPIURL+"/empty.gif");ng_PreloadImage(ngMapAPIURL+"/locate.png");ng_PreloadImage(ngMapAPIURL+"/popupArrDown.gif");ng_PreloadImage(ngMapAPIURL+"/popupArrUp.gif");typeof ngMapDrawingsPreloadImages=="function"&&ngMapDrawingsPreloadImages()}
function ngMap(b,a){var c;if(typeof b=="object"){c=b;b=c.id}else c=document.getElementById(b);this.MapID=b;if(b!=""){ngMapIDs[b]=this;this.rpc=new ngRPC(this.MapID)}else this.rpc=null;this.APIKey="";if(typeof ngMapAPIKey!="undefined")this.APIKey=ngMapAPIKey;this.CanvasUpdates=[];this.Canvas=[];if(c){var d=new ngStringBuilder;d.append('<div id="'+b+'_Canvas" class="cDC" onselectstart="return false;" onselect="return false;"></div>');d.append('<div id="'+b+'_M2" style="position: absolute;left: 0px;top: 0px;width: 100%;height: 100%;z-index: 1;" onselectstart="return false;" onselect="return false;"></div>');
d.append('<div id="'+b+'_M1" style="position: absolute;left: 0px;top: 0px;width: 100%;height: 100%;z-index: 2;" onselectstart="return false;" onselect="return false;"></div>');d.append('<div id="'+b+'_Menu" class="csMAPPopup"></div>');d.append('<div id="'+b+'_Sel" style="position: absolute;visibility:hidden;font-size:0px;line-height:0px;left:0px;top:0px;height:0px;width:0px;_cursor:auto;border: dashed 1px #FFFFFF;z-index: 100;" onselectstart="return false;" onselect="return false;"></div>');d.append('<div id="'+
b+'_Sel2" style="position: absolute;visibility:hidden;font-size:0px;line-height:0px;left:0px;top:0px;height:0px;width:0px;_cursor:auto;border: solid 1px #000000;z-index: 99;" onselectstart="return false;" onselect="return false;"></div>');d.append("</div>");c.innerHTML=d.toString()}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=this.CurrentMapMenu=null;this.MapSession=this.MapURL="";this.MapServers=[];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.Images={};this.Images.LocatePt={Src:ngMapAPIURL+
"/locate.png",HotSpot:new ScreenPt(15,15)};this.PreviewZoom="auto";this.PreviewParent=this.PreviewMap=null;this.InitMode=this.Mode="Z+";this.CurrentCursor=this.MouseMode="";this.Cursors={};if(ngOpera||ngChrome){this.Cursors.ZoomIn="crosshair";this.Cursors.ZoomOut="crosshair";this.Cursors.Pan="move"}else{this.Cursors.ZoomIn="url('"+ngMapAPIURL+"/DynamicZoomIn.cur'), crosshair";this.Cursors.ZoomOut="url('"+ngMapAPIURL+"/ZoomOut.cur'), crosshair";this.Cursors.Pan="url('"+ngMapAPIURL+"/Pan.cur'), move"}this.CursorZoomIn=
this.Cursors.ZoomIn;this.CursorZoomOut=this.Cursors.ZoomOut;this.CursorPan=this.Cursors.Pan;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.ImageZoomPan=0;this.RefreshL=-1;this.RefreshTimeout=null;this.RefreshTimeStamp="";this.CanvasOffsetY=this.CanvasOffsetX=this.CanvasY=this.CanvasX=this.MouseSelBottom=this.MouseSelRight=this.MouseSelTop=this.MouseSelLeft=
this.MouseY=this.MouseX=this.MouseUpTicks=this.MouseDown=0;this.MapPopupY=this.MapPopupX=-1000;this.PopupIcons=[];this.InPopupObj=this.InPopupRect=false;this.ActivePopupIcon=this.HidePopupTimer=this.CurrentPopupIcon=this.CurrentPopup=null;this.PopupStyle="csMAPPopup";this.PopupTextStyle="csMAPPopupText";this.PopupMenuStyle="csMAPPopupMenu";this.PopupFrameStyle="csMAPPopupFrame";this.DisplayPopupTimeout=0;this.DisplayPopupByClick=true;this.Drawings=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.ClearCanvasLayer=ng_ClearCanvasLayer;this.SetCanvasOffset=ng_SetCanvasOffset;this.CanvasDrawOffsetX=ng_CanvasDrawOffsetX;this.CanvasDrawOffsetY=ng_CanvasDrawOffsetY;this.CanvasScreenPt=ng_CanvasScreenPt;this.CanvasOffsetPt=ng_CanvasOffsetPt;this.CanvasMousePt=ng_CanvasMousePt;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.SetAutoSize=ng_SetAutoSize;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.SetMouseMode=
ng_SetMouseMode;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.RefreshTiles=ng_RefreshTiles;this.CancelRefreshTiles=ng_CancelRefreshTiles;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=ng_DrawArea;this.DrawAreaFromStr=ng_DrawAreaFromStr;this.DrawCircleArc=ngIExplorer?ng_DrawCircleArcIE:ng_DrawCircleArc;this.DrawAreaEx=ngIExplorer?ng_DrawAreaExIE:ng_DrawAreaEx;
this.DrawText=ng_DrawText;this.CurrentCanvas=ng_CurrentCanvas;this.CanvasLayer=ng_CanvasLayer;this.ShowCanvasLayer=ng_ShowCanvasLayer;this.HideCanvasLayer=ng_HideCanvasLayer;this.IsCanvasLayerVisible=ng_IsCanvasLayerVisible;this.CanvasLayerDC=ng_CanvasLayerDC;this.CanvasLayerDI=ng_CanvasLayerDI;this.ClearCanvas=ng_ClearCanvas;this.CanvasEndUpdate=ng_CanvasEndUpdate;this.CanvasBeginUpdate=ng_CanvasBeginUpdate;b=this.CanvasLayer(NGLAYER_ACTIVEOBJS);b.zIndex=60;b=this.CanvasLayer(NGLAYER_POPUPICONS);
b.zIndex=61;b=this.CanvasLayer(NGLAYER_POPUP);b.zIndex=501;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.AddEvent=ngObjAddEvent;this.RemoveEvent=ngObjRemoveEvent;this.OnMapResize=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.OnMouseModeChanged=this.OnMouseModeChanging=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.onresize=ngAddEvent(window.onresize,OnMapResize);window.addEventListener&&window.addEventListener("DOMMouseScroll",OnMapWheel,false);ngMapEventsInitialized=true}OnMapCreated&&OnMapCreated(this)};
