﻿
Type.registerNamespace("SportsDo.Mapping");function veShowBubblePointTab(){var ptContent=$get("veBubbleTabContent_Point");ptContent.style.display="block";var ptTab=$get("veBubbleTab_Point");ptTab.className="selected";var mtContent=$get("veBubbleTabContent_Map");mtContent.style.display="none";var mtTab=$get("veBubbleTab_Map");mtTab.className="";}
function veShowBubbleMapTab(){var ptContent=$get("veBubbleTabContent_Point");ptContent.style.display="none";var ptTab=$get("veBubbleTab_Point");ptTab.className="";var mtContent=$get("veBubbleTabContent_Map");mtContent.style.display="block";var mtTab=$get("veBubbleTab_Map");mtTab.className="selected";}
SportsDo.Mapping.LMap=function(id,provider,mapType,mapMode,center,zoom,threeDSettings,opts){SportsDo.Mapping.LMap.initializeBase(this,[id,provider,mapType,mapMode,center,zoom]);var instance=this;var ffv=0;var ffn="Firefox/"
var ffp=navigator.userAgent.indexOf(ffn);if(ffp!=-1)ffv=parseFloat(navigator.userAgent.substring(ffp+ffn.length));if(ffv>=1.5){Msn.Drawing.Graphic.CreateGraphic=function(f,b){return new Msn.Drawing.SVGGraphic(f,b)}}
this._map=new VEMap(id);this._panelControls=[];this.getWrappedMap().sportsDoMap=this;var hideDashboard=true;if(opts!=null&&typeof(opts.dashboardSize)!=="undefined"){this.setDashboardSize(opts.dashboardSize);hideDashboard=false;}
this.getWrappedMap().LoadMap(this.convertLatLngClass(center),zoom,this.convertTypeToStyle(mapType),null,this.convertMode(mapMode));if(hideDashboard==true){this.hideDashboardPanel();}
function map_OnChangeView(e){instance.OnChangeView();}
this.addShim=function(el){var shim=document.createElement("iframe");shim.id="myShim";shim.frameBorder="0";shim.style.position="absolute";shim.style.zIndex="1";shim.style.top=el.offsetTop;shim.style.left=el.offsetLeft;shim.width=el.offsetWidth;shim.height=el.offsetHeight;el.shimElement=shim;el.parentNode.insertBefore(shim,el);};function _MapMouseOver(e){if(e.elementID){var popupShape=instance._map.GetShapeByID(e.elementID)
if(popupShape&&typeof(popupShape.sportsDoPoint)!=="undefined"){return true;}else if(popupShape.Type==="Polyline"){var spolyline=popupShape.sPolyLine;}}};var _hide;this.DisableEroHide=function(){if(typeof(veOverloadDisableBubbleAutoHide)!=="undefined"&&veOverloadDisableBubbleAutoHide===true){instance._hide=window.ero.hide;window.ero.hide=function(a){return;}}}
this.EnableEroHide=function(){if(typeof(veOverloadDisableBubbleAutoHide)!=="undefined"&&veOverloadDisableBubbleAutoHide===true){window.ero.hide=instance._hide;}}
this.ShowEroBubbleArrow=function(){if(typeof(veOverloadDisableBubbleAutoHide)!=="undefined"&&veOverloadDisableBubbleAutoHide===true){setTimeout("if (BrowserDetect.browser == 'Firefox') {var divs = document.getElementsByTagName('div'); } else { var InfoBoxElement = $get('MSVE_navAction_palette').nextSibling; var divs = InfoBoxElement.getElementsByTagName('div'); } for (var i=0; i<divs.length; i++ ) { var el = divs[i]; if (el.className == 'customInfoBox-beak' ) { el.style.visibility = 'visible'; break; }}",500);}}
this.HideEroBubbleArrow=function(){if(typeof(veOverloadDisableBubbleAutoHide)!=="undefined"&&veOverloadDisableBubbleAutoHide===true){if(BrowserDetect.browser=="Firefox"){var divs=document.getElementsByTagName("div");}else{var InfoBoxElement=$get('MSVE_navAction_palette').nextSibling;var divs=InfoBoxElement.getElementsByTagName("div");}
for(var i=0;i<divs.length;i++){var el=divs[i];if(el.className=="customInfoBox-beak"){el.style.visibility="hidden";break;}}};}
this._justPanned=false;instance.DisableEroHide();function _PinClicked(e){instance.HideEroBubbleArrow();if(e.elementID){var shape=instance._map.GetShapeByID(e.elementID)
if(shape){instance._onPointClickDelegate(shape.sportsDoPoint);if(typeof(shape.sportsDoPoint)!=="undefined"&&shape.sportsDoPoint!==null&&typeof(shape.sportsDoPoint.showBubble)!=="undefined"){shape.sportsDoPoint.showBubble();}else if(shape.Type==="Polyline"){var spolyline=shape.sPolyLine;}}}else{if(instance._justPanned===false){if(typeof(e.mapX)!=="undefined"&&typeof(e.mapY)!=="undefined"){var args={"point":instance.convertLatLngClass(instance._map.PixelToLatLong(new VEPixel(e.mapX,e.mapY)))}}
instance._onMapClickDelegate(args);instance.EnableEroHide();}
this._justPanned=false;}}
function _MapResize(e){var pnls=instance.getPanelControls();var addPnls=[];while(pnls.length>0){var panel=pnls[0];instance.removePanelControl(panel.getId());Array.add(addPnls,panel);}
for(var i=0;i<addPnls.length;i++){var panel=addPnls[i];instance.addPanelControl(panel);}
if(instance._overviewMapVisible===true){instance.showOverviewMapPanel();}}
this._overviewMapVisible=false;this.isFullyLoaded=false;function _MapEndPan(e){instance._justPanned=true;if(instance.isFullyLoaded===false){instance.isFullyLoaded=true;if(typeof(threeDSettings)!=="undefined"&&threeDSettings!==null){instance.setAltitude(threeDSettings.altitude);instance.setHeading(threeDSettings.heading);instance.setPitch(threeDSettings.pitch);}}}
function _MapEndZoom(a){var args={"before":null,"now":a.zoomLevel}
instance._onZoomedDelegate(args);}
this._map.AttachEvent("onstartpan",function(){instance.HideEroBubbleArrow();instance.EnableEroHide();});this.MapMouseOverDelegate=Function.createDelegate(this,_MapMouseOver);this._map.AttachEvent("onmouseover",this.MapMouseOverDelegate);this.PinClickDelegate=Function.createDelegate(this,_PinClicked);this._map.AttachEvent("onclick",this.PinClickDelegate);this.MapResizeDelegate=Function.createDelegate(this,_MapResize);this._map.AttachEvent("onresize",this.MapResizeDelegate);this.MapEndPanDelegate=Function.createDelegate(this,_MapEndPan);this._map.AttachEvent("onendpan",this.MapEndPanDelegate);this.MapEndZoomDelegate=Function.createDelegate(this,_MapEndZoom);this._map.AttachEvent("onendzoom",_MapEndZoom);this._map.AttachEvent("onchangeview",map_OnChangeView);this.hideDashboardPanel();this.setMapType(mapType);};SportsDo.Mapping.LMap.prototype={convertIconClass:function(icon){if(icon!=null){if(typeof(icon.GetCustomIcon)==="undefined"){var liveIcon=new VEShape(VEShapeType.Pushpin,new VELatLong(0,0));var iconSpec=new VECustomIconSpecification();iconSpec.Image=icon.getImageUrl();liveIcon.SetCustomIcon(iconSpec);liveIcon.SetTitle("");liveIcon.SetDescription("");if(this.getMapMode()==="2D"){var offset=this.convertPixelClass(icon.getIconAnchor());if(icon.getImageSize().getHeight()!==offset.y/2){offset.y=(-offset.y/2);iconSpec.ImageOffset=offset;}}
iconSpec.TextContent=" ";liveIcon.SetCustomIcon(iconSpec);return liveIcon;}else{var iconSpec=icon.GetCustomIcon();var sIcon=new SportsDo.Mapping.SIcon();sIcon.setImageUrl(iconSpec.Image);return sIcon;}}else{return new VEShape(VEShapeType.Pushpin,new VELatLong(0,0));}},convertLatLngClass:function(latlng){if(latlng.getType&&(latlng.getType()==SportsDo.Mapping.SLatLng.getName()||latlng.getType()==SportsDo.Mapping.SDetailLatLng.getName())){return new VELatLong(latlng.getLatitude(),latlng.getLongitude());}else{return new SportsDo.Mapping.SLatLng(latlng.Latitude,latlng.Longitude);}},convertSizeClass:function(size){},convertPixelClass:function(pixel){if(pixel!=null){if(pixel.getType&&pixel.getType()==SportsDo.Mapping.SPixel.getName()){return new VEPixel(pixel.getX(),pixel.getY());}else{return new SportsDo.Mapping.SPixel(pixel.x,pixel.y);}}},convertMode:function(mode){var lMapMode;if(mode=='3D'){lMapMode=VEMapMode.Mode3D;}else{lMapMode=VEMapMode.Mode2D;}
return lMapMode;},convertTypeToStyle:function(mapType){var lMapType;if(mapType=='Normal'){lMapType=VEMapStyle.Road;}else if(mapType=='Satellite'){lMapType=VEMapStyle.Aerial;}else if(mapType=='Hybrid'){lMapType=VEMapStyle.Hybrid;}else if(mapType=='Shaded'){lMapType=VEMapStyle.Shaded;}else if(mapType=='BirdsEye'){lMapType=VEMapStype.Birdseye;}else{lMapType=VEMapStyle.Road;}
return lMapType;},convertStyleToType:function(lMapType){var mapType;if(lMapType==VEMapStyle.Road){mapType='Normal';}else if(lMapType==VEMapStyle.Aerial){mapType='Satellite';}else if(lMapType==VEMapStyle.Hybrid){mapType='Hybrid';}else if(lMapType==VEMapStyle.Shaded){mapType='Shaded';}else if(lMapType==VEMapStyle.Birdseye){mapType='BirdsEye';}else{mapType='Normal';}
return mapType;},totalDistance:function(latlngs){var prevLatLng=null,totalDistance=0;for(var i=0;i<latlngs.length;i++){var latlng=latlngs[i];if(prevLatLng!=null){totalDistance+=latlng.distanceFrom(prevLatLng);}
prevLatLng=latlng;}
return totalDistance;},enableCustomBubble:function(){this.getWrappedMap().ClearInfoBoxStyles();},getMapType:function(){return this.convertStyleToType(this.getWrappedMap().GetMapStyle());},setMapType:function(mapType){this.getWrappedMap().SetMapStyle(this.convertTypeToStyle(mapType));},getMapMode:function(){if(this.getWrappedMap().GetMapMode()==VEMapMode.Mode3D){return'3D';}else{return'2D';}},setMapMode:function(mode){if(mode==="3D"){this.getWrappedMap().SetMapMode(VEMapMode.Mode3D);}else{this.getWrappedMap().SetMapMode(VEMapMode.Mode2D);}},setZoom:function(zoom){this.getWrappedMap().SetZoomLevel(zoom);},getMapCenter:function(){return this.convertLatLngClass(this.getWrappedMap().GetCenter());},setMapCenter:function(latlng,zoom){if(zoom==null){zoom=this.getWrappedMap().GetZoomLevel();}
this.getWrappedMap().SetCenterAndZoom(this.convertLatLngClass(latlng),zoom);},findAddress:function(address,callback){if(address===null||address.length===0){return;}
var instance=this;this._map.Find(null,address,null,null,null,null,null,false,false,false,function(a,b,c,d,e){var results=[];if(c!=null&&c.length>1){for(x=0;x<c.length;x++){var r={"name":c[x].Name,"latlng":instance.convertLatLngClass(c[x].LatLong)};Array.add(results,r);}}else if(c!=null){var r={"name":c[0].Name,"latlng":instance.convertLatLngClass(c[0].LatLong)}
Array.add(results,r);}
if(typeof(callback)!=="undefined"&&callback!==null){callback.call(instance,results);}});},moveToLatLng:function(latlng){this.getWrappedMap().PanToLatLong(this.convertLatLngClass(latlng));},resizeMap:function(width,height){if(width==null&&height==null){this.getWrappedMap().Resize();}else{this.getWrappedMap().Resize(width,height);}},getMapSize:function(){return new SportsDo.Mapping.SSize(this.getWrappedMap().GetWidth(),this.getWrappedMap().GetHeight());},getViewRegion:function(){var map=this.getWrappedMap();var v;if(map.GetMapStyle()===VEMapStyle.Birdseye){var be=map.GetBirdseyeScene();v=be.GetBoundingRectangle();}else{v=map.GetMapView();}
if(map.GetMapMode()===VEMapMode.Mode3D){var minLatLeft=v.BottomLeftLatLong.Latitude<v.TopLeftLatLong.Latitude?v.BottomLeftLatLong.Latitude:v.TopLeftLatLong.Latitude;var minLatRight=v.BottomRightLatLong.Latitude<v.TopRightLatLong.Latitude?v.BottomRightLatLong.Latitude:v.TopRightLatLong.Latitude;var minLat=minLatLeft<minLatRight?minLatLeft:minLatRight;var maxLatLeft=v.BottomLeftLatLong.Latitude>v.TopLeftLatLong.Latitude?v.BottomLeftLatLong.Latitude:v.TopLeftLatLong.Latitude;var maxLatRight=v.BottomRightLatLong.Latitude>v.TopRightLatLong.Latitude?v.BottomRightLatLong.Latitude:v.TopRightLatLong.Latitude;var maxLat=maxLatLeft>maxLatRight?maxLatLeft:maxLatRight;var minLngLeft=v.BottomLeftLatLong.Longitude<v.TopLeftLatLong.Longitude?v.BottomLeftLatLong.Longitude:v.TopLeftLatLong.Longitude;var minLngRight=v.BottomRightLatLong.Longitude<v.TopRightLatLong.Longitude?v.BottomRightLatLong.Longitude:v.TopRightLatLong.Longitude;var minLng=minLngLeft<minLngRight?minLngLeft:minLngRight;var maxLngLeft=v.BottomLeftLatLong.Longitude>v.TopLeftLatLong.Longitude?v.BottomLeftLatLong.Longitude:v.TopLeftLatLong.Longitude;var maxLngRight=v.BottomRightLatLong.Longitude>v.TopRightLatLong.Longitude?v.BottomRightLatLong.Longitude:v.TopRightLatLong.Longitude;var maxLng=maxLngLeft>maxLngRight?maxLngLeft:maxLngRight;var a={topLeft:$SLatLng(maxLat,minLng),bottomRight:$SLatLng(minLat,maxLng)};}else{var a={topLeft:this.convertLatLngClass(v.TopLeftLatLong),bottomRight:this.convertLatLngClass(v.BottomRightLatLong)};}
return a;},setAltitude:function(altitude){if(typeof(altitude)!=="undefined"&&altitude!==null){this.getWrappedMap().SetAltitude(altitude);}},setPitch:function(pitch){if(typeof(pitch)!=="undefined"&&pitch!==null){this.getWrappedMap().SetPitch(pitch);}},setHeading:function(heading){if(typeof(heading)!=="undefined"&&heading!==null){this.getWrappedMap().SetHeading(heading);}},getAltitude:function(){return this.getWrappedMap().GetAltitude();},getPitch:function(){return this.getWrappedMap().GetPitch();},getHeading:function(){return this.getWrappedMap().GetHeading();},setMapView:function(latlng,altitude,pitch,heading){if(this.getMapMode()==='2D'){this.setMapCenter(latlng);}else{var viewspec=new VEMapViewSpecification(this.convertLatLngClass(latlng),null,altitude,pitch,heading);this.getWrappedMap().SetMapView(viewspec);}},autoZoom:function(topRight,bottomLeft){SportsDo.Mapping.LMap.callBaseMethod(this,'autoZoom',[topRight,bottomLeft]);if(topRight.getLatitude()!=null&&topRight.getLongitude()!=null&&bottomLeft.getLatitude()!=null&&bottomLeft.getLongitude()!=null){var a=this.convertLatLngClass(bottomLeft);var b=this.convertLatLngClass(topRight);this.getWrappedMap().SetMapView([a,b]);}},getCurrentZoom:function(){return this.getWrappedMap().GetZoomLevel();},addPolyLine:function(polyline){var allowAdd=SportsDo.Mapping.LMap.callBaseMethod(this,'addPolyLine',[polyline]);if(allowAdd==true){var index=0;var lpoints=[];while(index<polyline.getLatLngs().length){var latlng=this.convertLatLngClass(polyline.getLatLngs()[index]);Array.add(lpoints,latlng);index++;};var rgb=SportsDo.colorHex2Decimal(polyline.getColor());var vecolor=new VEColor(rgb[0],rgb[1],rgb[2],0.8);if(lpoints.length==1){Array.add(lpoints,lpoints[0].Clone());}
var vpolyline=new VEShape(VEShapeType.Polyline,lpoints);vpolyline.SetLineWidth(polyline.getWidth());vpolyline.SetLineColor(vecolor);vpolyline.SetIconVisibility(false);polyline.setWrappedPolyLine(vpolyline);vpolyline.sPolyLine=polyline;this.getWrappedMap().AddShape(vpolyline);}},bulkAddShapes:function(shapes){try{this.getWrappedMap().AddShape(shapes);}catch(e){var map=this.getWrappedMap();for(var i=0;i<shapes.length;i++){map.AddShape(shapes[i]);}}},removePolyLine:function(polyline){var shape=polyline.getWrappedPolyLine();if(shape!=null){this.getWrappedMap().DeleteShape(shape);polyline.setWrappedPolyLine(null);SportsDo.Mapping.LMap.callBaseMethod(this,'removePolyLine',[polyline]);}},createPointHtml:function(mainContent){return"<div class='mapPoint'>"+"<div class='main'>"+mainContent+"</div>"+"<div class='arrow'><img src='/ui/small_down_arrow.gif'/></div></div>";},addPoint:function(point,opts){var allowAdd=SportsDo.Mapping.LMap.callBaseMethod(this,'addPoint',[point]);if(allowAdd==true){var latlng=this.convertLatLngClass(point.getLatLng());var pushpin=this.convertIconClass(point.getIcon());pushpin.SetPoints(latlng);if(typeof(window["overloadVEPointIcon"])!="undefined"){var iconSpec=new VECustomIconSpecification();iconSpec.CustomHTML=overloadVEPointIcon(point);iconSpec.Image=point.getIcon().getImageUrl();iconSpec.ImageOffset=new VEPixel(0,0);pushpin.SetCustomIcon(iconSpec);}else{if(point.getType()===SportsDo.Mapping.SPoint.getName()){}else if(point.getType()===SportsDo.Mapping.SDetailPoint.getName()){pushpin.SetTitle(point.getTitle());pushpin.SetDescription(point.getDetails());}}
pushpin.sportsDoPoint=point;point.setWrappedPoint(pushpin);if(typeof(opts)==="undefined"||opts.supressAdd===false){this.getWrappedMap().AddShape(pushpin);}else if(typeof(opts)!=="undefined"){opts.shape=pushpin;}
var args={"point":point};this._onPointAddDelegate(args);}
return allowAdd;},removePoint:function(point){this.getWrappedMap().DeleteShape(point.getWrappedPoint());SportsDo.Mapping.LMap.callBaseMethod(this,'removePoint',[point]);},movePoint:function(point){if(point!=null){var v=this.getViewRegion();if(this.isInRegion(v.topLeft,v.bottomRight,point.getLatLng())){var marker=point.getWrappedPoint();if(point.isVisible()){if(marker!=null){var llatlng=this.convertLatLngClass(point.getLatLng());marker.SetPoints(llatlng);}}else{point.show();}}else{point.hide();}}
SportsDo.Mapping.LMap.callBaseMethod(this,'movePoint',[point]);},hidePoint:function(point){if(point.isVisible()===true){var wpoint=point.getWrappedPoint();if(wpoint!=null){try{wpoint.Hide();}catch(err){debugger;}}}},showPoint:function(point){var wpoint=point.getWrappedPoint();if(wpoint!=null){wpoint.Show();}},showBubble:function(point){this.EnableEroHide();if(this.isBubbleEnabled()==true&&point.getType()===SportsDo.Mapping.SDetailPoint.getName()){var b=this.getBubblePoint();if(b!=null){var wp=b.getWrappedPoint();if(wp==null){return;}
wp.SetZIndex(10000,null);}
SportsDo.Mapping.LMap.callBaseMethod(this,'showBubble',[point]);var args={"point":point,"htmlContent":point.getDetails(),"showMapTab":true,"showBubble":true,"title":point.getTitle(),"links":[],"bubbleType":SportsDo.Mapping.SBubbleType.InfoOnly};this._prePointBubbleShowDelegate(args);if(args.links.length>0){args.htmlContent+="<ul class='veBubbleLinks'>";for(var l=0;l<args.links.length;l++){args.htmlContent+="<li>"+args.links[l]+"</li>";}
args.htmlContent+="</ul>";}
if(args.showBubble==true){this.ShowEroBubbleArrow();switch(args.bubbleType){case SportsDo.Mapping.SBubbleType.InfoOnly:var marker=point.getWrappedPoint();marker.SetZIndex(10001,null);marker.SetTitle(args.title);marker.SetDescription(args.htmlContent);this.getWrappedMap().HideInfoBox();this.getWrappedMap().ShowInfoBox(marker);break;case SportsDo.Mapping.SBubbleType.MapOnly:var marker=point.getWrappedPoint();marker.SetZIndex(10001,null);marker.SetDescription(args.htmlContent);this.getWrappedMap().HideInfoBox();this.getWrappedMap().ShowInfoBox(marker);break;case SportsDo.Mapping.SBubbleType.InfoAndMap:var marker=point.getWrappedPoint();marker.SetZIndex(10001,null);marker.SetDescription(args.htmlContent);this.getWrappedMap().HideInfoBox();this.getWrappedMap().ShowInfoBox(marker);break;}}}
this.DisableEroHide();},hideBubble:function(point){SportsDo.Mapping.LMap.callBaseMethod(this,'hideBubble',[point]);this.EnableEroHide();this.HideEroBubbleArrow();var bp=point.getWrappedPoint();if(bp!=null){bp.SetZIndex(10000,null);}
this.getWrappedMap().HideInfoBox();},addPhoto:function(photo){var allowAdd=SportsDo.Mapping.LMap.callBaseMethod(this,'addPhoto',[photo]);if(allowAdd==true){var latlng=this.convertLatLngClass(photo.getLatLng());var pushpin=this.convertIconClass(photo.getIcon());pushpin.SetPoints(latlng);if(typeof(window["overloadVEPhotoIcon"])!="undefined"){var iconSpec=new VECustomIconSpecification();iconSpec.CustomHTML=overloadVEPhotoIcon(photo);iconSpec.Image=photo.getIcon().getImageUrl();iconSpec.ImageOffset=new VEPixel(0,0);pushpin.SetCustomIcon(iconSpec);}
pushpin.sportsDoPoint=photo;photo.setWrappedPoint(pushpin);this.getWrappedMap().AddShape(pushpin);}},removePhoto:function(photo){if(photo!=null){var wpoint=photo.getWrappedPoint();if(wpoint!=null){this.getWrappedMap().DeleteShape(wpoint);SportsDo.Mapping.LMap.callBaseMethod(this,'removePhoto',[photo]);}}},hidePhoto:function(photo){this.hidePoint(photo);},showPhoto:function(photo){this.showPoint(photo);},showPhotoBubble:function(photo){this.EnableEroHide();if(this.isBubbleEnabled()==true){var b=this.getBubblePoint();if(b!=null){var wpoint=b.getWrappedPoint();b.hideBubble();if(wpoint!=null){wpoint.SetZIndex(10000,null);}}
SportsDo.Mapping.LMap.callBaseMethod(this,'showPhotoBubble',[photo]);this.generatePhotoBubbleHtml=function(photo){var title=photo.getTitle();var result="";if(typeof(title)!=="undefined"&&title!==null){result="<div><b>"+photo.getTitle()+"</b></div>";}
return result+"<div><a target=\"_blank\" href=\"/Photos/photo.aspx?id="+photo.getId()+"\"><img src=\"/Photos/photo.ashx?id="+photo.getId()+"&size=32\"></a></div>";}
var html=this.generatePhotoBubbleHtml(photo);this.ShowEroBubbleArrow();var marker=photo.getWrappedPoint();if(marker!=null){marker.SetZIndex(10001,null);marker.SetDescription(html);this.getWrappedMap().ShowInfoBox(marker);}}
this.DisableEroHide();},addDoer:function(doer){var allowAdd=SportsDo.Mapping.LMap.callBaseMethod(this,'addDoer',[doer]);if(allowAdd==true){var latlng=this.convertLatLngClass(doer.getLatLng());var pushpin=this.convertIconClass(doer.getIcon());if(typeof(doer.ext)!=="undefined"&&doer.ext.htmlPoint===true){var iconSpec=new VECustomIconSpecification();iconSpec.CustomHTML=this.createPointHtml("<img src='/picture.ashx?user="+doer.getId()+"&size=20x20'/>");iconSpec.Image=doer.getIcon().getImageUrl();iconSpec.ImageOffset=new VEPixel(0,0);pushpin.SetCustomIcon(iconSpec);}else{if(typeof(window["overloadVEDoerIcon"])!="undefined"){var iconSpec=new VECustomIconSpecification();iconSpec.CustomHTML=overloadVEDoerIcon(doer);iconSpec.Image=doer.getIcon().getImageUrl();iconSpec.ImageOffset=new VEPixel(0,0);pushpin.SetCustomIcon(iconSpec);}}
pushpin.SetPoints(latlng);pushpin.sportsDoPoint=doer;doer.setWrappedPoint(pushpin);this.getWrappedMap().AddShape(pushpin);}},removeDoer:function(doer){var wpoint=doer.getWrappedPoint();this.getWrappedMap().DeleteShape(wpoint);SportsDo.Mapping.LMap.callBaseMethod(this,'removeDoer',[doer]);},hideDoer:function(doer){this.hidePoint(doer);},showDoer:function(doer){this.showPoint(doer);},showDoerBubble:function(doer){this.EnableEroHide();if(this.isBubbleEnabled()==true){var b=this.getBubblePoint();if(b!=null){b.getWrappedPoint().SetZIndex(10000,null);}
SportsDo.Mapping.LMap.callBaseMethod(this,'showDoerBubble',[doer]);this.generateDoerBubbleHtml=function(nickname){return"<table width='320px' height='120px'><tr><td valign='top' width='100px'><img src=\"/picture.ashx?user="+nickname+"\"></td><td>"+"<table><tr><td>(("+nickname+"))</td></tr>"+"</table></td></tr></table>";}
if(typeof(doer.ext)==="undefined"||typeof(doer.ext.details)==="undefined"||doer.ext.details===null){var details="";}else{var details=doer.ext.details;}
var args={doer:doer,htmlContent:this.generateDoerBubbleHtml(doer.getId(),details),showBubble:true,"showPointOnMap":true,"mapHeight":160,"mapWidth":320,"bubbleType":SportsDo.Mapping.SBubbleType.InfoOnly};this._preDoerBubbleShowDelegate(args);if(args.showBubble===true){this.ShowEroBubbleArrow();var marker=doer.getWrappedPoint();marker.SetZIndex(10001,null);switch(args.bubbleType){case SportsDo.Mapping.SBubbleType.InfoAndMap:var bubbleMap="<div id=\"bubbleMap\" style=\"height: "+parseInt(args.mapHeight)+"px; width:"+parseInt(args.mapWidth)+"px; overflow: hidden;\"></div>";var tabs="<div><ul class='veBubbleTabs'><li id='veBubbleTab_Point' title='View the Doers info'><a href='javascript:veShowBubblePointTab();'>Doer</a></li><li id='veBubbleTab_Map' title='View a closeup map of this Doers location'><a href='javascript:veShowBubbleMapTab();'>Map</a></li></ul></div>";var tabDoer="<div id='veBubbleTabContent_Point' class='veBubbleTabs_Content' style='display:none'>"+args.htmlContent+"</div>";var tabMap="<div id='veBubbleTabContent_Map' class='veBubbleTabs_Content' style='display:block'>"+bubbleMap+"</div>";marker.SetDescription(tabs+tabDoer+tabMap);setTimeout("Sys.Application.findComponent('"+this.getId()+"')._loadBubbleMap("+args.showPointOnMap+","+doer.getLatLng().getLatitude()+","+doer.getLatLng().getLongitude()+")",700);break;case SportsDo.Mapping.SBubbleType.MapOnly:var bubbleMap="<div id=\"bubbleMap\" style=\"position: relative; height: "+parseInt(args.mapHeight)+"px; width:"+parseInt(args.mapWidth)+"px; overflow: hidden;\"></div>";marker.SetDescription(bubbleMap);setTimeout("Sys.Application.findComponent('"+this.getId()+"')._loadBubbleMap("+args.showPointOnMap+","+doer.getLatLng().getLatitude()+","+doer.getLatLng().getLongitude()+")",700);break;case SportsDo.Mapping.SBubbleType.InfoOnly:marker.SetDescription(args.htmlContent);break;}
var map=this.getWrappedMap();map.HideInfoBox();map.ShowInfoBox(marker);}}
this.DisableEroHide();},_loadBubbleMap:function(showPointOnMap){var parentMap=Sys.Application.findComponent(this.getId());var bpoint=parentMap.getBubblePoint();var compBubble=Sys.Application.findComponent("bubbleMap");if(compBubble!=null){if(compBubble.get_id()!="bubbleMap"){compBubble.set_id("bubbleMap");}
Sys.Application.removeComponent(compBubble);}
var options={"mp":'live',"mt":'Hybrid',"mm":'2D',"lt":bpoint.getLatLng().getLatitude(),"lg":bpoint.getLatLng().getLongitude(),"zm":15}
this._bubbleMap=SportsDo.createMap('bubbleMap',null,null,null,null,null,null,null,options);if(this._bubbleMap!=null){this._bubbleMap.suppressPhotoBubbleMap=true;if(this._bubbleMap!=null&&showPointOnMap===true){var pointInBubble=new SportsDo.Mapping.SPoint(bpoint.getId(),bpoint.getLatLng(),bpoint.getIcon());this._bubbleMap.addPoint(pointInBubble);}
if(this._bubbleMap!=null&&typeof(mapDatasource)!=="undefined"&&mapDatasource!==null){}}
veShowBubblePointTab();},addPanelControl:function(panel){if(SportsDo.Mapping.LMap.callBaseMethod(this,'addPanelControl',[panel])){var control=new SportsDo.Mapping.LGenericPanel(this,panel);this.getWrappedMap().AddControl(control._el);}},removePanelControl:function(id){var control=document.getElementById("lgenpanel_"+id);if(control!=null){this.getWrappedMap().DeleteControl(control);SportsDo.Mapping.LMap.callBaseMethod(this,'removePanelControl',[id]);}},setDashboardSize:function(size){if(typeof(size)==="undefined"||size==="large"){this.getWrappedMap().SetDashboardSize(VEDashboardSize.Normal);}else if(size==="small"){this.getWrappedMap().SetDashboardSize(VEDashboardSize.Tiny);}},showDashboardPanel:function(opts){this.getWrappedMap().ShowDashboard();},hideDashboardPanel:function(){this.getWrappedMap().HideDashboard();},showMapTypePanel:function(){},hideMapTypePanel:function(){},showReplayPanel:function(){},hideReplayPanel:function(){},showOverviewMapPanel:function(){this._overviewMapVisible=true;this.getWrappedMap().ShowMiniMap(this.getMapSize().getWidth()-152,0,VEMiniMapSize.Small);var minimap=document.getElementById("MSVE_minimap");var minimapResize=document.getElementById("MSVE_minimap_resize");minimapResize.style.display="none";},hideOverviewMapPanel:function(){this.getWrappedMap().HideMiniMap();this._overviewMapVisible=false;},showSportsDoLogo:function(){var container=document.createElement("div");container.style.width="135px";container.style.height="25px";container.style.top=parseInt(this.getMapSize().getHeight())-70+"px";container.style.left="10px";container.innerHTML="<a href=\"http://www.sportsdo.net/\" target=\"_blank\"><img border=\"0\" src='/ui/logos/sportsdo_logo_tiny.gif' /></a>";var panel=new SportsDo.Mapping.SPanelControl("sportsdologo",container,"BottomRight",new SportsDo.Mapping.SPixel(20,50));this.addPanelControl(panel);},dispose:function(){var map=this.getWrappedMap();if(map!=null){map.Dispose();}
this.PinHoverDelegate=null;SportsDo.Mapping.LMap.callBaseMethod(this,'dispose');},getType:function(){return SportsDo.Mapping.LMap.getName();}};SportsDo.Mapping.LMap.inheritsFrom(SportsDo.Mapping.SMap);SportsDo.Mapping.LMap.registerClass('SportsDo.Mapping.LMap',SportsDo.Mapping.SMap);SportsDo.Mapping.LGenericPanel=function(map,panel){this._el=document.createElement("div");this._el.setAttribute("id","lgenpanel_"+panel.getId());this._el.appendChild(panel.getDivObject());this._map=map;this._panel=panel;this.relocate();};SportsDo.Mapping.LGenericPanel.prototype={relocate:function(){var size=this._map.getMapSize();var height=size.getHeight();var width=size.getWidth();var location=this._panel.getLocation();var offset=this._panel.getOffset();var div=this._panel.getDivObject();switch(location){case"TopRight":this._el.style.top=offset.getY()+"px";this._el.style.left=parseInt(width)-parseInt(div.style.width)-offset.getX()-10+"px";break;case"TopLeft":this._el.style.top=offset.getY()+"px";this._el.style.left=offset.getX()+"px";break;case"BottomRight":this._el.style.top=parseInt(height)-parseInt(div.style.height)-offset.getY()+"px";this._el.style.left=parseInt(width)-parseInt(div.style.width)-offset.getX()-10+"px";break;case"BottomLeft":this._el.style.top=parseInt(height)-parseInt(div.style.height)-offset.getY()+"px";this._el.style.left=offset.getX()+"px";break;default:this._el.style.top=offset.getY()+"px";this._el.style.left=offset.getX()+"px";}}};if(typeof(Sys)!=='undefined'){Sys.Application.notifyScriptLoaded();}