POIMapAPI={};POIMapAPI.CreatePOI=function(){return JSMapAPI.CreateJSPointLocation()};POIMapAPI.CreatePOIMapSpec=function(){var A=JSMapAPI.CreateJSMapSpec();A.MapPOI=[];A.AddPOI=function(B){this.MapPOI[this.MapPOI.length]=B};A.DisposePOI=function(){for(var B=0;B<this.MapPOI.length;B++){this.MapPOI[B].Dispose()}this.MapPOI=null};return A};POIMapAPI.CreatePOIMap=function(){var A=JSMapAPI.CreateJSMap();A._initialize=function(){try{var B=new VEShapeLayer();this.Impl.AddShapeLayer(B);var G=[];var F=[];for(var D=0;D<this.Spec.MapPOI.length;D++){G[D]=this.Spec.MapPOI[D].GetLatLong();var C=new VEShape(VEShapeType.Pushpin,this.Spec.MapPOI[D].GetLatLong());C.SetTitle(this.Spec.MapPOI[D].Name);C.SetDescription(this.Spec.MapPOI[D].Desc);F[D]=C}B.AddShapes(F);this.Impl.SetMapView(G);if(this.Spec.MapPOI.length==1){this.Impl.SetZoomLevel(this.Impl.GetZoomLevel()-4)}var H=new VEClusteringOptions();H.Callback=A._clustering;B.SetClusteringConfiguration(VEClusteringType.Grid,H)}catch(E){throw new Error("POIMapAPI.POIMap._initialize() Error:"+E.message)}};A._clustering=function(F){try{var E=null;var I=null;for(var C=0;C<F.length;++C){var B=F[C];var H=B.GetClusterShape();I="";E="";for(var D=0;D<B.Shapes.length;++D){if((B.Shapes[D].GetTitle()!="")&&(B.Shapes[D].GetTitle()!=" ")&&(B.Shapes[D].GetTitle()!=null)){if((JSMapAPI.Environment.BROWSER_INTERNET_EXPLORER)||(D==0)){E+="<b>"+B.Shapes[D].GetTitle()+"</b><br />"+B.Shapes[D].GetDescription()}else{E+="<br /><b>"+B.Shapes[D].GetTitle()+"</b><br />"+B.Shapes[D].GetDescription()}}else{if((JSMapAPI.Environment.BROWSER_INTERNET_EXPLORER)||(D==0)){E+=B.Shapes[D].GetDescription()}else{E+="<br />"+B.Shapes[D].GetDescription()}}}H.SetTitle(I);H.SetDescription(E)}}catch(G){throw new Error("POIMapAPI.POIMap._clustering() Error:"+G.message)}};A.Load=function(){A._initialize_impl();A._initialize();A._adjust_map_view()};A.LoadInPrintMode=function(){A._initialize_printable_impl();A._initialize();A._adjust_map_view()};A.StartEditing=function(){if(this.Spec.MapPOI.length!=1){throw new Error("POIMapAPI.POIMap.StartEditing() Error:To Edit the POIMapSpec must contain 1 POI.")}var B=this;this.MovingPoiPin=false;this.Impl.AttachEvent("onmousedown",function(C){if(C.rightMouseButton&&C.elementID){B.MovingPoiPin=true;B.Impl.vemapcontrol.EnableGeoCommunity(true);B.SetMapCursor("move")}});this.Impl.AttachEvent("onmousemove",function(D){if(B.MovingPoiPin){var C=B.Impl.GetShapeLayerByIndex(1).GetShapeByIndex(0);B.Impl.HideInfoBox();C.SetPoints(B.MouseMapLatLong)}});this.Impl.AttachEvent("onmouseup",function(D){if(B.MovingPoiPin&&D.rightMouseButton){var C=B.Impl.GetShapeLayerByIndex(1).GetShapeByIndex(0);B.MovingPoiPin=false;B.Impl.vemapcontrol.EnableGeoCommunity(false);B.SetMapCursor("")}})};A.SaveEdits=function(){var B=this.Impl.GetShapeLayerByIndex(1).GetShapeByIndex(0);this.Spec.MapPOI[0].Latitude=B.GetPoints()[0].Latitude;this.Spec.MapPOI[0].Longitude=B.GetPoints()[0].Longitude};A.StopEditing=function(){this.Impl.Dispose();this.Load()};A.UnLoad=function(){this.Spec.DisposePOI();this.DisposeImpl()};return A};