﻿
Type.registerNamespace("SportsDo.Mapping");SportsDo.IComponent=function(){};SportsDo.IComponent.prototype={getType:function(){}};SportsDo.IComponent.registerInterface('SportsDo.IComponent');SportsDo.Mapping.createMap=function(mapid,provider,mapType,mapMode,latitude,longitude,zoom,datasource,options){if($get(mapid)==null){return;}
var map;zoom=options.zm==-1?5:options.zm;if(options.mp==="live"){if(options.mm==="3D"){var threeDSettings={"heading":options.mvh,"pitch":options.mvp,"altitude":options.mva}}
map=new SportsDo.Mapping.LMap(mapid,options.mp,options.mt,options.mm,new $SLatLng(options.lt,options.lg),options.zm,threeDSettings,options);if(typeof(options.dashboardSize)!=="undefined"){map.showDashboardPanel();}}else{map=new SportsDo.Mapping.GMap(mapid,options.mp,options.mt,options.mm,new SportsDo.Mapping.SLatLng(options.lt,options.lg),zoom);if(typeof(options.dashboardSize)!=="undefined"){map.showDashboardPanel({"size":options.dashboardSize});}}
if(options.zm==-2){map.centerOnViewerLocation(4);}
Sys.Application.addComponent(map);if(datasource!=null){map.showLoadingPanel();}
var autoZoom=options.zm==-1?true:false;setTimeout(function(){if(options.dsid!=null){var ds=eval(options.dsid);if(ds!=null){map.dataBind(ds,autoZoom);}
map.hideLoadingPanel();}},10);return map;};SportsDo.Mapping.SBubbleType=new Object();SportsDo.Mapping.SBubbleType.InfoOnly=0;SportsDo.Mapping.SBubbleType.MapOnly=1;SportsDo.Mapping.SBubbleType.InfoAndMap=2;SportsDo.Mapping.SLatLng=function(lat,lng){SportsDo.Mapping.SLatLng.initializeBase(this);this._latitude=lat;this._longitude=lng;};SportsDo.Mapping.SLatLng.prototype={getLatitude:function(){return this._latitude;},setLatitude:function(lat){this._latitude=lat;},getLongitude:function(){return this._longitude;},setLongitude:function(lng){this._longitude=lng;},dispose:function(){this._latitude=null;this._longitude=null;},distanceFrom:function(latlng){var lat1=this.getLatitude();var lat2=latlng.getLatitude();var lng1=this.getLongitude();var lng2=latlng.getLongitude();var R=6371;return Math.acos(Math.sin(lat1)*Math.sin(lat2)+
Math.cos(lat1)*Math.cos(lat2)*Math.cos(lng2-lng1))*R;},toString:function(){return this._latitude+", "+this._longitude;},getType:function(){return SportsDo.Mapping.SLatLng.getName();}};SportsDo.Mapping.SLatLng.inheritsFrom(Sys.Component);SportsDo.Mapping.SLatLng.registerClass('SportsDo.Mapping.SLatLng',Sys.Component,SportsDo.IComponent);var $SLatLng=SportsDo.Mapping.createSLatLng=function SportsDo$Mapping$createSLatLng(lat,lng,ext){var o=new SportsDo.Mapping.SLatLng(lat,lng);o.ext=ext;return o;}
SportsDo.Mapping.SDetailLatLng=function(lat,lng,time,speed,distance){SportsDo.Mapping.SDetailLatLng.initializeBase(this,[lat,lng]);this._time=time;if(speed===null){this._speed=0;}else{this._speed=speed;}
if(distance===null){this._distance=0;}else{this._distance=distance;}};SportsDo.Mapping.SDetailLatLng.prototype={getTime:function(){return this._time;},setTime:function(time){this._time=time;},getSpeed:function(){return this._speed;},setSpeed:function(speed){this._speed=speed;},getDistance:function(){return this._distance;},setDistance:function(distance){this._distance=distance;},dispose:function(){this._time=null;this._speed=null;this._distance=null;SportsDo.Mapping.SDetailLatLng.callBaseMethod(this,'dispose');},toString:function(){return SportsDo.Mapping.SDetailLatLng.callBaseMethod(this,'toString');},getType:function(){return SportsDo.Mapping.SDetailLatLng.getName();}};SportsDo.Mapping.SDetailLatLng.inheritsFrom(SportsDo.Mapping.SLatLng);SportsDo.Mapping.SDetailLatLng.registerClass('SportsDo.Mapping.SDetailLatLng',SportsDo.Mapping.SLatLng);var $SDetailLatLng=SportsDo.Mapping.createSDetailLatLng=function SportsDo$Mapping$createSDetailLatLng(lat,lng,time,speed,distance){return new SportsDo.Mapping.SDetailLatLng(lat,lng,time,speed,distance);}
SportsDo.Mapping.SPoint=function(id,latlng,icon){this._id=id;this._latlng=latlng;this._icon=typeof(icon)==="undefined"?new SportsDo.Mapping.SIcon():icon;this._map=null;this._wrappedPoint=null;this._visible=true;};SportsDo.Mapping.SPoint.prototype={getId:function(){return this._id;},getLatLng:function(){return this._latlng;},setLatLng:function(latlng){if(latlng.getLatitude()!==this._latlng.getLatitude()||latlng.getLongitude()!==this._latlng.getLongitude()){this._latlng=latlng;if(this._map!==null){this._map.movePoint(this);}}},zoomTo:function(zoom){this._map.setMapCenter(this.getLatLng(),zoom);},getIcon:function(){return this._icon;},setIcon:function(icon){this._icon=icon;if(this._map!=null){this._map.changePointIcon(this,icon);}},setMap:function(map){this._map=map;},hide:function(){if(this._map!==null&&this.isVisible()===true){this._map.hidePoint(this);this._visible=false;}},show:function(){if(this._map!==null&&this.isVisible()===false){this._map.showPoint(this);this._visible=true;}},setWrappedPoint:function(point){this._wrappedPoint=point;},getWrappedPoint:function(){return this._wrappedPoint;},isVisible:function(){return this._visible;},dispose:function(){this._id=null;this._latlng.dispose();this._latlng=null;this._icon=null;this._wrappedPoint=null;this._visible=null;},getType:function(){return SportsDo.Mapping.SPoint.getName();}};SportsDo.Mapping.SPoint.inheritsFrom(Sys.Component);SportsDo.Mapping.SPoint.registerClass('SportsDo.Mapping.SPoint',Sys.Component,SportsDo.IComponent);SportsDo.Mapping.SDetailPoint=function(id,latlng,title,details,icon){SportsDo.Mapping.SDetailPoint.initializeBase(this,[id,latlng,icon]);this._title=title;this._details=details;this._bubbleEnabled=true;};SportsDo.Mapping.SDetailPoint.prototype={getTitle:function(){return this._title;},setTitle:function(title){this._title=title;},getDetails:function(){return this._details;},setDetails:function(details){this._details=details;},setLatLng:function(latlng){SportsDo.Mapping.SDetailPoint.callBaseMethod(this,'setLatLng',[latlng]);},hide:function(){if(this._map.getBubblePoint()!=null){if(this._map.getBubblePoint().getId()===this.getId()){this.hideBubble();}}
SportsDo.Mapping.SDetailPoint.callBaseMethod(this,'hide');},showBubble:function(){if(this._bubbleEnabled){if(this._map!==null){this._map.showBubble(this);}}},hideBubble:function(){if(this._map!==null){this._map.hideBubble(this);}
this._bubbleVisible=false;},disableBubble:function(){this.hideBubble();this._bubbleEnabled=false;},enableBubble:function(){this._bubbleEnabled=true;},isBubbleEnabled:function(){return this._bubbleEnabled;},dispose:function(){this._title=null;this._details=null;this._bubbleEnabled=null;SportsDo.Mapping.SDetailPoint.callBaseMethod(this,'dispose');},getType:function(){return SportsDo.Mapping.SDetailPoint.getName();}};SportsDo.Mapping.SDetailPoint.inheritsFrom(SportsDo.Mapping.SPoint);SportsDo.Mapping.SDetailPoint.registerClass('SportsDo.Mapping.SDetailPoint',SportsDo.Mapping.SPoint);SportsDo.Mapping.SDoerPoint=function(id,latlng,opts){SportsDo.Mapping.SDoerPoint.initializeBase(this,[id,latlng]);var imageUrl;if(typeof(opts)!=="undefined"&&opts!==null){if(typeof(opts.iconUrl)!=="undefined"&&opts.iconUrl!==null){imageUrl=opts.iconUrl;}}
this._icon=new SportsDo.Mapping.SDoerIcon(id+"_ic",imageUrl,"orange");this._visible=true;};SportsDo.Mapping.SDoerPoint.prototype={show:function(){if(this._map!==null&&this.isVisible()===false){this._map.showDoer(this);this._visible=true;}},showBubble:function(){if(this._bubbleEnabled){if(this._map!==null){this._map.showDoerBubble(this);}}},animate:function(lap){if(this._map!=null){this._map.animatePoint(this,lap);}},dispose:function(){this.doerLocationInfoComplete=null;this._visible=null;SportsDo.Mapping.SDoerPoint.callBaseMethod(this,'dispose');},getType:function(){return SportsDo.Mapping.SDoerPoint.getName();}};SportsDo.Mapping.SDoerPoint.inheritsFrom(SportsDo.Mapping.SDetailPoint);SportsDo.Mapping.SDoerPoint.registerClass('SportsDo.Mapping.SDoerPoint',SportsDo.Mapping.SDetailPoint);SportsDo.Mapping.SPhotoPoint=function(id,latlng,title){SportsDo.Mapping.SPhotoPoint.initializeBase(this,[id,latlng,title]);this._icon=new SportsDo.Mapping.SIcon(id+"_ic","/ui/sportsdo/photo.png",new SportsDo.Mapping.SSize(26,26),new SportsDo.Mapping.SPixel(13,13),null,null,new SportsDo.Mapping.SPixel(15,12));this._visible=true;};SportsDo.Mapping.SPhotoPoint.prototype={show:function(){if(this._map!==null&&this.isVisible()===false){this._map.showPhoto(this);this._visible=true;}},showBubble:function(){if(this._bubbleEnabled){if(this._map!==null){this._map.showPhotoBubble(this);}}},dispose:function(){this._visible=null;SportsDo.Mapping.SPhotoPoint.callBaseMethod(this,'dispose');},getType:function(){return SportsDo.Mapping.SPhotoPoint.getName();}};SportsDo.Mapping.SPhotoPoint.inheritsFrom(SportsDo.Mapping.SDetailPoint);SportsDo.Mapping.SPhotoPoint.registerClass('SportsDo.Mapping.SPhotoPoint',SportsDo.Mapping.SDetailPoint);SportsDo.Mapping.AnimationActor=function(point,laps){this._point=point;this._lapPoints=[];for(var i=0;i<laps.length;i++){Array.addRange(this._lapPoints,laps[i].getPoints());}
var lapPoint=this._lapPoints[0];var data={"speed":lapPoint.getSpeed(),"time":lapPoint.getTime(),"distance":lapPoint.getDistance(),"latlng":new SportsDo.Mapping.SLatLng(lapPoint.getLatitude(),lapPoint.getLongitude())};this._currentPositionInfo=data;};SportsDo.Mapping.AnimationActor.prototype={getPoint:function(){return this._point;},getLapPoints:function(){return this._lapPoints;},getCurrentPositionInfo:function(){return this._currentPositionInfo;},setCurrentPositionInfo:function(info){this._currentPositionInfo=info;},getType:function(){return SportsDo.Mapping.AnimationActor.getName();}};SportsDo.Mapping.AnimationActor.inheritsFrom(Sys.Component);SportsDo.Mapping.AnimationActor.registerClass('SportsDo.Mapping.AnimationActor',Sys.Component);SportsDo.Mapping.SIcon=function(id,imageUrl,imageSize,iconAnchor,shadowUrl,shadowSize,infoWindowAnchor){SportsDo.Mapping.SIcon.initializeBase(this);this._id=id;this._imageUrl=imageUrl;this._shadowUrl=shadowUrl;if(imageSize!==null){this._imageSize=imageSize;}else{this._imageSize=new SportsDo.Mapping.SSize(16,16);}
this._shadowSize=shadowSize;if(iconAnchor!==null){this._iconAnchor=iconAnchor;}else{this._iconAnchor=new SportsDo.Mapping.SPixel(this._imageSize.getWidth()/2,this._imageSize.getHeight());}
this._infoWindowAnchor=infoWindowAnchor;};SportsDo.Mapping.SIcon.prototype={getId:function(){return this._id;},getImageUrl:function(){return this._imageUrl;},setImageUrl:function(imageUrl){this._imageUrl=imageUrl;},getShadowUrl:function(){return this._shadowUrl;},setShadowUrl:function(shadowUrl){this._shadowUrl=shadowUrl;},getImageSize:function(){return this._imageSize;},setImageSize:function(imageSize){if(imageSize.getType!=null&&imageSize.getType()===SportsDo.Mapping.SSize.getName()){this._imageSize=imageSize;}else{throw"parameter 1 must be of type "+SportsDo.Mapping.SSize.getName();}},getShadowSize:function(){return this._shadowSize;},setShadowSize:function(size){this._shadowSize=size;},getIconAnchor:function(){return this._iconAnchor;},setIconAnchor:function(point){this._iconAnchor=point;},getInfoWindowAnchor:function(){return this._infoWindowAnchor;},setInfoWindowAnchor:function(point){this._infoWindowAnchor=point;},dispose:function(){this._id=null;this._imageUrl=null;this._shadowUrl=null;if(this._imageSize!=null){this._imageSize.dispose();this._imageSize=null;}
if(this._shadowSize!=null){this._shadowSize.dispose();this._shadowSize=null;}
if(this._iconAnchor!=null){this._iconAnchor.dispose();this._iconAnchor=null;}
this._infoWindowAnchor=null;},getType:function(){return SportsDo.Mapping.SIcon.getName();}};SportsDo.Mapping.SIcon.inheritsFrom(Sys.Component);SportsDo.Mapping.SIcon.registerClass('SportsDo.Mapping.SIcon',Sys.Component,SportsDo.IComponent);SportsDo.Mapping.SDefaultIcon=function(id,imageUrl){SportsDo.Mapping.SDefaultIcon.initializeBase(this,[id,imageUrl,new SportsDo.Mapping.SSize(24,24),new SportsDo.Mapping.SPixel(12,24),null,null,new SportsDo.Mapping.SPixel(6,12)]);}
SportsDo.Mapping.SDefaultIcon.inheritsFrom(SportsDo.Mapping.SIcon);SportsDo.Mapping.SDefaultIcon.registerClass('SportsDo.Mapping.SDefaultIcon',SportsDo.Mapping.SIcon);SportsDo.Mapping.SSmallIcon=function(id,imageUrl){SportsDo.Mapping.SSmallIcon.initializeBase(this,[id,imageUrl,new SportsDo.Mapping.SSize(16,16),new SportsDo.Mapping.SPixel(8,8),null,null,new SportsDo.Mapping.SPixel(8,8)]);}
SportsDo.Mapping.SSmallIcon.inheritsFrom(SportsDo.Mapping.SIcon);SportsDo.Mapping.SSmallIcon.registerClass('SportsDo.Mapping.SSmallIcon',SportsDo.Mapping.SIcon);SportsDo.Mapping.SFlagIcon=function(id,imageUrl){SportsDo.Mapping.SFlagIcon.initializeBase(this,[id,imageUrl,new SportsDo.Mapping.SSize(18,32),new SportsDo.Mapping.SPixel(0,32),null,null,new SportsDo.Mapping.SPixel(6,32)]);}
SportsDo.Mapping.SFlagIcon.inheritsFrom(SportsDo.Mapping.SIcon);SportsDo.Mapping.SFlagIcon.registerClass('SportsDo.Mapping.SFlagIcon',SportsDo.Mapping.SIcon);SportsDo.Mapping.SMarkerIcon=function(id,imageUrl){SportsDo.Mapping.SMarkerIcon.initializeBase(this,[id,imageUrl,new SportsDo.Mapping.SSize(18,32),new SportsDo.Mapping.SPixel(9,32),null,null,new SportsDo.Mapping.SPixel(6,32)]);}
SportsDo.Mapping.SMarkerIcon.inheritsFrom(SportsDo.Mapping.SIcon);SportsDo.Mapping.SMarkerIcon.prototype={getType:function(){return SportsDo.Mapping.SMarkerIcon.getName();}}
SportsDo.Mapping.SMarkerIcon.registerClass('SportsDo.Mapping.SMarkerIcon',SportsDo.Mapping.SIcon);SportsDo.Mapping.SLandmarkIcon=function(id,imageUrl){SportsDo.Mapping.SLandmarkIcon.initializeBase(this,[id,imageUrl,new SportsDo.Mapping.SSize(24,24),new SportsDo.Mapping.SPixel(12,24),null,null,new SportsDo.Mapping.SPixel(9,24)]);}
SportsDo.Mapping.SLandmarkIcon.inheritsFrom(SportsDo.Mapping.SIcon);SportsDo.Mapping.SLandmarkIcon.registerClass('SportsDo.Mapping.SLandmarkIcon',SportsDo.Mapping.SIcon);SportsDo.Mapping.SDoerIcon=function(id,imageUrl,color){if(typeof imageUrl==="undefined"||imageUrl===null){if(typeof color==="undefined"||color===null||color===''){color="orange";}
imageUrl='/ui/icons/doer-'+color+'.gif';}
SportsDo.Mapping.SDoerIcon.initializeBase(this,[id,imageUrl,new SportsDo.Mapping.SSize(16,22),new SportsDo.Mapping.SPixel(8,16),null,null,new SportsDo.Mapping.SPixel(8,16)]);}
SportsDo.Mapping.SDoerIcon.inheritsFrom(SportsDo.Mapping.SIcon);SportsDo.Mapping.SDoerIcon.registerClass('SportsDo.Mapping.SDoerIcon',SportsDo.Mapping.SIcon);SportsDo.Mapping.SSize=function(width,height){SportsDo.Mapping.SSize.initializeBase(this);this._width=width;this._height=height;};SportsDo.Mapping.SSize.prototype={getWidth:function(){return this._width;},setWidth:function(width){this._width=width;},getHeight:function(){return this._height;},setHeight:function(height){this._height=height;},dispose:function(){this._width=null;this._height=null;},getType:function(){return SportsDo.Mapping.SSize.getName();}};SportsDo.Mapping.SSize.inheritsFrom(Sys.Component);SportsDo.Mapping.SSize.registerClass('SportsDo.Mapping.SSize',Sys.Component,SportsDo.IComponent);SportsDo.Mapping.SPixel=function(x,y){SportsDo.Mapping.SPixel.initializeBase(this);this._x=x;this._y=y;};SportsDo.Mapping.SPixel.prototype={getX:function(){return this._x;},setX:function(x){this._x=x;},getY:function(){return this._y;},setY:function(y){this._y=y;},dispose:function(){this._x=null;this._y=null;},getType:function(){return SportsDo.Mapping.SPixel.getName();}};SportsDo.Mapping.SPixel.inheritsFrom(Sys.Component);SportsDo.Mapping.SPixel.registerClass('SportsDo.Mapping.SPixel',Sys.Component,SportsDo.IComponent);SportsDo.Mapping.SPolyLine=function(id,latlngs,color,width,name){this._id=id;this._latlngs=latlngs;this._color=color;this._width=width;this._name=name;this._originalColor=color;this._originalWidth=width;this._highlighted=false;this._wrappedPolyLine=null;};SportsDo.Mapping.SPolyLine.prototype={getId:function(){return this._id;},getLatLngs:function(){return this._latlngs;},getName:function(){return this._name;},getColor:function(){return this._color;},getWidth:function(){return this._width;},setWrappedPolyLine:function(polyline){this._wrappedPolyLine=polyline;},getWrappedPolyLine:function(){return this._wrappedPolyLine;},highlight:function(map){if(this.isHighlighted()==false){map.removePolyLine(this);this._width=this._width+3;this._color=this._color;this._highlighted=true;map.addPolyLine(this);}},unhighlight:function(map){if(this.isHighlighted()==true){map.removePolyLine(this);this._width=this._originalWidth;this._color=this._originalColor;this._highlighted=false;map.addPolyLine(this);}},isHighlighted:function(){return this._highlighted;},getType:function(){return SportsDo.Mapping.SPolyLine().getName();}};SportsDo.Mapping.SPolyLine.inheritsFrom(Sys.Component);SportsDo.Mapping.SPolyLine.registerClass('SportsDo.Mapping.SPolyLine',Sys.Component,SportsDo.IComponent);SportsDo.Mapping.SRoute=function(id,points){this._id=id;this._points=points;this._polylines=new Hash();this._hidden=false;this._map=null;};SportsDo.Mapping.SRoute.prototype={getId:function(){return this._id;},getPoints:function(){return this._points;},getPolyLines:function(){return this._polylines;},addPolyLine:function(polyline){polyline.parent=this;this._polylines.setItem(polyline.getId(),polyline);},hidePolyLine:function(id){var p=this._polylines.getItem(id);if(p!=null){this._map.removePolyLine(p);}},addPoints:function(points,draw,opts){var previousPoint=this._points[this._points.length-1];Array.addRange(this._points,points);var p=[previousPoint];Array.addRange(p,points);if(p.length>1&&draw===true){if(typeof(opts)==="undefined"||opts===null){opts={"color":"#ff0000","width":1};}
var polyline=new SportsDo.Mapping.SPolyLine(this.getId()+"_"+this._polylines.keys.length,p,opts.color,opts.width);this._map.addPolyLine(polyline);this._polylines.setItem(polyline.getId(),polyline);}},setOwnerMap:function(map){this._map=map;},getOwnerMap:function(){return this._map;},show:function(){if(this._hidden===true){var plines=this.getPolyLines();var key,item;for(var i=0;i<plines.keys.length;i++){key=plines.keys[i];item=plines.getItem(key);this._map.addPolyLine(item);}
this._hidden=false;this._map._routeVisibilityChangedHandler({"route":this});}else{var plines=this.getPolyLines();var key,item;for(var i=0;i<plines.keys.length;i++){key=plines.keys[i];item=plines.getItem(key);if(item.getWrappedPolyLine()==null){this._map.addPolyLine(item);}}}},hide:function(){if(this._hidden===false){var plines=this.getPolyLines();var key,item;for(var i=0;i<plines.keys.length;i++){key=plines.keys[i];item=plines.getItem(key);this._map.removePolyLine(item);}
this._hidden=true;this._map._routeVisibilityChangedHandler({"route":this});}},toggleVisibility:function(){if(this.isHidden()===true){this.show();}else{this.hide();}},isHidden:function(){return this._hidden;},getType:function(){return SportsDo.Mapping.SRoute.getName();}};SportsDo.Mapping.SRoute.inheritsFrom(Sys.Component);SportsDo.Mapping.SRoute.registerClass('SportsDo.Mapping.SRoute',Sys.Component,SportsDo.IComponent);SportsDo.Mapping.SLap=function(id,points){SportsDo.Mapping.SLap.initializeBase(this,[id,points]);if(this.getPoints().length>0){this._startTime=this.getPoints()[0].getTime();this._endTime=this.getPoints()[this.getPoints().length-1].getTime();}
this.minDisplayPosition=this._startTime;if(this.getPoints().length>100){this.maxDisplayPosition=this.getPoints()[100].getTime();}else{this.maxDisplayPosition=this._endTime;}};SportsDo.Mapping.SLap.prototype={getStartTime:function(){return this._startTime;},getEndTime:function(){return this._endTime;},getMaxTime:function(){return this._maxTime;},getType:function(){return SportsDo.Mapping.SLap.getName();}};SportsDo.Mapping.SLap.inheritsFrom(SportsDo.Mapping.SRoute);SportsDo.Mapping.SLap.registerClass('SportsDo.Mapping.SLap',SportsDo.Mapping.SRoute);SportsDo.Mapping.SPanelControl=function(id,div,location,offset,opts){this._id=id;this._div=div;this._offset=offset;this._location=location;if(typeof(opts)!=="undefined"&&opts!==null&&opts.visible==true){this.hide();}};SportsDo.Mapping.SPanelControl.prototype={getId:function(){return this._id;},getDivObject:function(){return this._div;},getOffset:function(){return this._offset;},getLocation:function(){return this._location;},hide:function(){this._div.style.display="none";},show:function(){this._div.style.display="block";},getType:function(){return SportsDo.Mapping.SPanelControl.getName();}};SportsDo.Mapping.SPanelControl.inheritsFrom(Sys.Component);SportsDo.Mapping.SPanelControl.registerClass('SportsDo.Mapping.SPanelControl',Sys.Component,SportsDo.IComponent);SportsDo.Mapping.SMap=function(id,provider,mapType,mapMode,center,zoom){SportsDo.Mapping.SMap.initializeBase(this);if(mapMode==null){mapMode='2D';}
if(mapType==null){mapType='Normal';}
this._id=id;this._provider=provider;this._panelControls=[];this._points=new Hash();this._doers=new Hash();this._photos=new Hash();this._routes=new Hash();this._polylines=new Hash();this._originalCenter=center;this._map=null;this._enableAddingPoints=true;this._animatedPoints=[];this._animateTimer=null;this._animationTickDelegate=null;this._bubbledPoint=null;this._enableBubble=true;this._animationActorCompleteDelegate=null;this._animationCompleteDelegate=null;this._onReplayStartDelegate=null;this._onReplayStopDelegate=null;this._onReplayPauseDelegate=null;this._onReplayFastForwardDelegate=null;this._onReplayRewindDelegate=null;this._onZoomedDelegate=null;if(this._onZoomedDelegate===null){this._onZoomedDelegate=Function.createDelegate(this,this._onZoomedHandler);}
this._onMapDataboundDelegate=null;if(this._onMapDataboundDelegate===null){this._onMapDataboundDelegate=Function.createDelegate(this,this._onMapDataboundHandler);}
this._onPointClickDelegate=null;if(this._onPointClickDelegate===null){this._onPointClickDelegate=Function.createDelegate(this,this._onPointClickHandler);}
this._onMapClickDelegate=null;if(this._onMapClickDelegate===null){this._onMapClickDelegate=Function.createDelegate(this,this._onMapClickHandler);}
this._routeVisibilityChangedDelegate=null;if(this._routeVisibilityChangedDelegate===null){this._routeVisibilityChangedDelegate=Function.createDelegate(this,this._routeVisibilityChangedHandler);}
this._onPointAddDelegate=null;if(this._onPointAddDelegate===null){this._onPointAddDelegate=Function.createDelegate(this,this._onPointAddHandler);}
this._onPointMovedDelegate=null;if(this._onPointMovedDelegate===null){this._onPointMovedDelegate=Function.createDelegate(this,this._onPointMovedHandler);}
this._onDoerAddDelegate=null;if(this._onDoerAddDelegate===null){this._onDoerAddDelegate=Function.createDelegate(this,this._onDoerAddHandler);}
this._onPhotoAddDelegate=null;if(this._onPhotoAddDelegate===null){this._onPhotoAddDelegate=Function.createDelegate(this,this._onPhotoAddHandler);}
this._preDoerBubbleShowDelegate=null;if(this._preDoerBubbleShowDelegate===null){this._preDoerBubbleShowDelegate=Function.createDelegate(this,this._preDoerBubbleShowHandler);}
this._prePointBubbleShowDelegate=null;if(this._prePointBubbleShowDelegate===null){this._prePointBubbleShowDelegate=Function.createDelegate(this,this._prePointBubbleShowHandler);}
this._onPointBubbleShowDelegate=null;if(this._onPointBubbleShowDelegate===null){this._onPointBubbleShowDelegate=Function.createDelegate(this,this._onPointBubbleShowHandler);}
this._onMapChangeViewDelegate=null;if(this._onMapChangeViewDelegate===null){this._onMapChangeViewDelegate=Function.createDelegate(this,this._onMapChangeViewHandler);}
this._prePointBubbleCloseDelegate=null;if(this._prePointBubbleCloseDelegate===null){this._prePointBubbleCloseDelegate=Function.createDelegate(this,this._prePointBubbleCloseHandler);}
var instance=this;if(window.attachEvent){window.attachEvent("onunload",function(evnt){instance.dispose(evnt)});}else{window.addEventListener("unload",function(evnt){instance.dispose(evnt)},false);}};SportsDo.Mapping.SMap.prototype={getWrappedMap:function(){return this._map;},getId:function(){return this._id;},toRadians:function(deg){return(deg*3.141592653)/180;},toDegrees:function(rad){return(rad*180)/3.141592653;},regionCenter:function(points){var smallestLongitude=null;var smallestLatitude=null;var largestLongitude=null;var largestLatitude=null;for(var p=0;p<points.length;p++){var point=points[p];if(smallestLatitude==null||point.getLatitude()<smallestLatitude){smallestLatitude=point.getLatitude();}
if(smallestLongitude==null||point.getLongitude()<smallestLongitude){smallestLongitude=point.getLongitude();}
if(largestLatitude==null||point.getLatitude()>largestLatitude){largestLatitude=point.getLatitude();}
if(largestLongitude==null||point.getLongitude()>largestLongitude){largestLongitude=point.getLongitude();}}
var lowerLeft=$SLatLng(smallestLatitude,smallestLongitude);var upperRight=$SLatLng(largestLatitude,largestLongitude);var centerLatitude=((largestLatitude-smallestLatitude)/2)+smallestLatitude;var centerLongitude=((largestLongitude-smallestLongitude)/2)+smallestLongitude;return $SLatLng(centerLatitude,centerLongitude);},findAddress:function(address,callback){},enableCustomBubble:function(){},getPermaLinkQueryString:function(keys){var sb=new Sys.StringBuilder();sb.append("zm=");sb.append(this.getCurrentZoom());sb.append("&mp=");sb.append(this.getMapProvider());sb.append("&mt=");sb.append(this.getMapType());var mm=this.getMapMode();if(mm!=null){sb.append("&mm=");sb.append(mm);if(mm==="3D"){sb.append("&mva=");sb.append(this.getAltitude());sb.append("&mvh=");sb.append(this.getHeading());sb.append("&mvp=");sb.append(this.getPitch());}}
var mapCenter=this.getMapCenter();sb.append("&mc=");sb.append(mapCenter.getLatitude()+","+mapCenter.getLongitude());if(typeof(keys)!=="undefined"&&keys!==null){for(var i=0;i<keys.length;i++){var key=keys[i];sb.append("&");var value=Request.queryString(key);if(value!=null){sb.append(key);sb.append("=");sb.append(value);}}}
return Request.currentUrlWithoutQueryString+"?"+sb.toString();},getPermaLink:function(keys){return Request.currentUrlWithoutQueryString+"?"+this.getPermaLinkQueryString(keys);},throwEvent:function(ev,args){var h=this.get_events().getHandler(ev);if(h){h(this,args);}},totalDistance:function(latlngs){},OnChangeView:function(){if(this.getMapType()!=="BirdsEye"){var v=this.getViewRegion();this.togglePointsInRegion(this.getDoers(),v);this.togglePointsInRegion(this.getPoints(),v);this.togglePointsInRegion(this.getPhotos(),v);}
if(typeof(this._blockChangeViewEvent)==="undefined"||this._blockChangeViewEvent===false){this._onMapChangeViewHandler();}else{this._blockChangeViewEvent=false;}},_onMapChangeViewHandler:function(args){var h=this.get_events().getHandler('onchangeview');if(h){h(this,args);}},addOnMapChangeView:function(handler){this.get_events().addHandler("onchangeview",handler);},removeOnMapChangeView:function(handler){this.get_events().removeHandler("onchangeview",handler);},_onZoomedHandler:function(args){this.throwEvent('onzoomed',args);},addOnMapZoomed:function(handler){this.get_events().addHandler("onzoomed",handler);},removeOnMapZoomed:function(handler){this.get_events().removeHandler("onzoomed",handler);},disableDoubleClickZoom:function(){},createRoute:function(route){var points=route.pts;var latlngs=[];var pointsIndex=0;var point;while(pointsIndex<points.length){point=points[pointsIndex];if(route.isl){Array.add(latlngs,new SportsDo.Mapping.SDetailLatLng(point.lt,point.lg,point.tm,point.s,point.d));}else{Array.add(latlngs,new SportsDo.Mapping.SLatLng(point.lt,point.lg));}
pointsIndex++;}
if(route.isl){var r=new SportsDo.Mapping.SLap(route.id,latlngs);r.setOwnerMap(this);return r;}else{var r=new SportsDo.Mapping.SRoute(route.id,latlngs);r.setOwnerMap(this);return r;}},dataBind:function(data,autoFocus){if(typeof(data)==="undefined"||data===null){return;}
var routes=data.Routes;var pois=data.PointsOfInterest;var photos=data.Photos;var doers=data.Doers;if(routes!=null){var routeIndex=0;var route,sroute;while(routeIndex<routes.length)
{route=routes[routeIndex];sroute=this.createRoute(route);if(sroute.getType()===SportsDo.Mapping.SLap.getName())
{this.addRoute(sroute);this.drawLap(sroute,0,sroute.getEndTime());}
else
{this.addRoute(sroute);this.drawRoute(sroute,route.c,route.w);}
routeIndex++;}}
var instance=this;instance._dataBindPois(pois);if(photos!=null){var photoIndex=0;var photo,photoPoint;while(photoIndex<photos.length){photo=photos[photoIndex];photoPoint=new SportsDo.Mapping.SPhotoPoint(photo.id,new $SLatLng(photo.lt,photo.lg),photo.t);if(photo.ext!=null){photoPoint.ext=photo.ext;}
this.addPhoto(photoPoint);photoIndex++;}}
if(doers!=null){var doerIndex=0;var doer,doerPoint;while(doerIndex<doers.length){doer=doers[doerIndex];if(doer.pt!=null)
{var opts={};if(doer.ic)
{opts.iconUrl=doer.ic.ImageUrl;}
var sLatLng=null;if(doer.pt)
{sLatLng=new $SLatLng(doer.pt.lt,doer.pt.lg);}
doerPoint=new SportsDo.Mapping.SDoerPoint(doer.nn,sLatLng,opts);if(doer.ext!=null){doerPoint.ext=doer.ext;}
this.addDoer(doerPoint);}
doerIndex++;}}
var autofocused=false;if(typeof(autoFocus)!=="undefined"&&autoFocus===true){var allPoints=this.getAllLatLngs();if(allPoints.length>0){this.focusView(allPoints);autofocused=true;}}
var args={"autofocused":autofocused,"allPoints":allPoints};this._onMapDataboundDelegate(args);},getAllLatLngs:function(){var allPoints=[];var routes=this.getRoutes();for(var r=0;r<routes.length;r++){var route=routes.getItem(routes.keys[r]);allPoints=allPoints.concat(route.getPoints());}
var points=this.getPoints();for(var p=0;p<points.length;p++){var point=points.getItem(points.keys[p]);allPoints.push(point.getLatLng());}
var photos=this.getPhotos();for(var p=0;p<photos.length;p++){var photo=photos.getItem(photos.keys[p]);allPoints.push(photo.getLatLng());}
var doers=this.getDoers();for(var d=0;d<doers.length;d++){var doer=doers.getItem(doers.keys[p]);allPoints.push(doer.getLatLng());}
return allPoints;},_dataBindPois:function(pois){if(pois!=null){var poiIndex=0;var route,poi,points,latlngs,pointsIndex,point,pic;var liveShapes=[];var mapProvider=this.getMapProvider();while(poiIndex<pois.length){poi=pois[poiIndex];points=pois[poiIndex].pts;latlngs=[];pointsIndex=0;while(pointsIndex<points.length){point=points[pointsIndex];Array.add(latlngs,new SportsDo.Mapping.SLatLng(point.lt,point.lg));pointsIndex++;}
if(latlngs.length==1){if(poi.dtt==null&&poi.dtd==null){pic=new SportsDo.Mapping.SPoint(poi.id,latlngs[0],this.createIcon(poi.id,poi.iu,poi.it));}else{pic=new SportsDo.Mapping.SDetailPoint(poi.id,latlngs[0],poi.dtt,poi.dtd,this.createIcon(poi.id,poi.iu,poi.it));}
pic.ext=poi.ext;if(mapProvider!=="live"){this.addPoint(pic);}else{var opts={"supressAdd":true,"shape":null};if(this.addPoint(pic,opts)==true){if(opts.shape!=null){Array.add(liveShapes,opts.shape);}}}}else{route=new SportsDo.Mapping.SRoute(poi.id,latlngs);route.setOwnerMap(this);this.addRoute(route);this.drawRoute(route,poi.c,poi.w);if(poi.iu!=null&&poi.iu.length>0){pic=new SportsDo.Mapping.SPoint(poi.id+'_ic',new SportsDo.Mapping.SLatLng(poi.ipt.lt,poi.ipt.lg),this.createIcon(poi.id,poi.iu,poi.it));pic.ext=poi.ext;if(mapProvider!=="live"){this.addPoint(pic);}else{var opts={"supressAdd":true,"shape":null};if(this.addPoint(pic,opts)==true){if(opts.shape!=null){Array.add(liveShapes,opts.shape);}}}}}
poiIndex++;}
if(mapProvider==="live"){this.bulkAddShapes(liveShapes);}}},createIcon:function(id,imageUrl,icontype){if(icontype==0){return new SportsDo.Mapping.SMarkerIcon(id,imageUrl);}else if(icontype==1){return new SportsDo.Mapping.SDefaultIcon(id,imageUrl);}else if(icontype==2){return new SportsDo.Mapping.SFlagIcon(id,imageUrl);}else if(icontype==3){return new SportsDo.Mapping.SLandmarkIcon(id,imageUrl);}else if(icontype==4){return new SportsDo.Mapping.SDoerIcon(id,imageUrl,"orange");}else if(icontype==5){return new SportsDo.Mapping.SSmallIcon(id,imageUrl);}else{return new SportsDo.Mapping.SIcon(id+"_icon",imageUrl);}},convertIconClass:function(icon){},convertLatLngClass:function(latlng){},resetCenter:function(){this.setMapCenter(this._originalCenter);},getMapProvider:function(){return this._provider;},getMapType:function(){},setMapType:function(mapType){},getMapMode:function(){},setMapMode:function(mode){},getMapCenter:function(){},setMapCenter:function(latlng,zoom){},centerOnViewerLocation:function(zoom){SportsDo.FindViewersLocationOnMap(this,zoom);},moveToLatLng:function(latlng){},resizeMap:function(width,height){},getMapSize:function(){},getViewRegion:function(){},autoZoom:function(topRight,bottomLeft){this._blockChangeViewEvent=true;},getCurrentZoom:function(){},setZoom:function(zoom){},focusView:function(points){if(points.length===0){this.setZoom(3);return;}
var point;var maxLatitude=minLatitude=maxLongitude=minLongitude=null;for(var i=0;i<points.length;i++){point=points[i];if(maxLatitude!=null){if(point.getLatitude()>maxLatitude){maxLatitude=point.getLatitude();}
else if(point.getLatitude()<minLatitude){minLatitude=point.getLatitude();}
if(point.getLongitude()>maxLongitude){maxLongitude=point.getLongitude();}
else if(point.getLongitude()<minLongitude){minLongitude=point.getLongitude();}}else{maxLatitude=minLatitude=point.getLatitude();maxLongitude=minLongitude=point.getLongitude();}}
var lowerLeft=$SLatLng(minLatitude,minLongitude);var upperRight=$SLatLng(maxLatitude,maxLongitude);var centerLatitude=((maxLatitude-minLatitude)/2)+minLatitude;var centerLongitude=((maxLongitude-minLongitude)/2)+minLongitude;var center=$SLatLng(centerLatitude,centerLongitude);this.autoZoom($SLatLng(maxLatitude,maxLongitude),$SLatLng(minLatitude,minLongitude));this.setMapCenter(center);},setAltitude:function(altitude){},setPitch:function(pitch){},setHeading:function(heading){},getAltitude:function(){},getPitch:function(){},getHeading:function(){},setMapView:function(latlng,altitude,pitch,heading){},enableAddingPoints:function(){this._enableAddingPoints=true;},disableAddingPoints:function(){this._enableAddingPoints=false;},isAddingPointsEnabled:function(){return this._enableAddingPoints;},addPolyLine:function(polyline){if(this.findPolyLineById(polyline.getId())==null){this._polylines.setItem(polyline.getId(),polyline);return true;}else{return false;}},removePolyLine:function(polyline){this._polylines.removeItem(polyline.getId());},findPolyLineById:function(id){return this._polylines.getItem(id);},getPolyLines:function(){return this._polylines;},getRoutes:function(){return this._routes;},_routeVisibilityChangedHandler:function(args){var h=this.get_events().getHandler('routeVisibilityChanged');if(h){h(this,args);}},addRouteVisibilityChanged:function(handler){this.get_events().addHandler("routeVisibilityChanged",handler);},removeRouteVisibilityChanged:function(handler){this.get_events().removeHandler("routeVisibilityChanged",handler);},addRoute:function(route,draw){if(!this._routes.hasItem(route.getId())){route.setOwnerMap(this);this._routes.setItem(route.getId(),route);if(route.getType()==SportsDo.Mapping.SLap.getName()&&draw==true){this.drawLap(route,0,100);}else if(draw==true){this.drawRoute(route,"#ff0000",1);}
this._routeVisibilityChangedHandler({"route":route});return true;}else{return false;}},removeAllRoutes:function(){var route,routes;var index=0;routes=this.getRoutes();while(routes.length>0){route=routes.getItem(routes.keys[0]);this.removeRoute(route);}},removeRoute:function(route){var id=route.getId();this.hideRouteById(id);this._routes.removeItem(id)},removeRouteById:function(id){this.hideRouteById(id);this._routes.removeItem(id)},drawRoute:function(route,color,width){var polyline=new SportsDo.Mapping.SPolyLine(route.getId(),route.getPoints(),color,width);this.addPolyLine(polyline);route.addPolyLine(polyline);},hideRouteById:function(id){var route=this._routes.getItem(id);if(route!=null){route.hide();}
return route;},findRouteById:function(id){return this._routes.getItem(id);},focusOnRoute:function(id){var route=this.findRouteById(id);if(route!=null){this.focusView(route.getPoints());}},drawLap:function(route,startTime,endTime){var points=route.getPoints();if(points.length>0){var pos1=-1,pos2=-1;var currentPoint;for(var i=0;i<points.length;i++){currentPoint=points[i];if(currentPoint.getTime()>=startTime&&pos1<0){pos1=i;if(pos1>0&&currentPoint.getTime()>startTime)pos1--;}
if(currentPoint.getTime()<=endTime){pos2=i;}else{break;}}
if(pos2<points.length-1)pos2++;var newpts=points.slice(pos1,pos2+1);var polyline;if(newpts.length==1){Array.add(newpts,newpts[0]);}
if(newpts.length>1){if(1==0){id=route.getId()+'-'+'0';polyline=new SportsDo.Mapping.SPolyLine(id,newpts,"#BB0000",3);this.addPolyLine(polyline);route.addPolyLine(polyline);}else{var maxSpeed=0;var newPoint;for(var i=0;i<newpts.length;i++){newPoint=newpts[i];if(newPoint.getSpeed()>maxSpeed)maxSpeed=newPoint.getSpeed();}
var color=["#000000","#1E90FF","#00F000","#F00000"];var sepSize=Math.ceil(maxSpeed/5);var trackSpeed=[2*sepSize,3*sepSize,4*sepSize,5*sepSize];var currentDivision=0;var currentDivisionStartPos=0;var speed,division,ln,lineId;for(var i=0;i<newpts.length;i++){newPoint=newpts[i];speed=newPoint.getSpeed();division=0;if(speed>=trackSpeed[0])division=1;if(speed>=trackSpeed[1])division=2;if(speed>=trackSpeed[2])division=3;if(division!=currentDivision){ln=newpts.slice(currentDivisionStartPos,i+1);lineId=route.getId()+'-'+i;polyline=new SportsDo.Mapping.SPolyLine(lineId,ln,color[currentDivision],3);this.addPolyLine(polyline);route.addPolyLine(polyline);currentDivision=division;currentDivisionStartPos=i;}}
ln=newpts.slice(currentDivisionStartPos,newpts.length);lineId=route.getId()+'-';polyline=new SportsDo.Mapping.SPolyLine(lineId,ln,color[currentDivision],3);this.addPolyLine(polyline);route.addPolyLine(polyline);}}}},findInArrayById:function(id,array){var index=0;while(index<array.length){if(array[index].getId()==id){return array[index];}
index++;}},runAnimation:function(speed,startTime){if(this._animationTickDelegate===null){this._animationTickDelegate=Function.createDelegate(this,this._onAnimationTickHandler);}
if(this._animationActorCompleteDelegate===null){this._animationActorCompleteDelegate=Function.createDelegate(this,this._onAnimationActorCompleteHandler);}
if(this._animationCompleteDelegate===null){this._animationCompleteDelegate=Function.createDelegate(this,this._onAnimationCompleteHandler);}
this._onReplayStartHandler();if(this._animatedPoints.length>0&&this._animateTimer==null){var instance=this;this._animateTime=startTime==null?0:startTime;speed=speed==null?100:speed;this.animateTimer_OnTick=function(){var numberAnimationsComplete=0;var args={actors:[]};var actor,apoint,actorArgs;for(var i=0;i<instance._animatedPoints.length;i++){actor=instance._animatedPoints[i];apoint=instance.getAnimatedPosition(actor.getLapPoints());if(apoint!=null){actor.setCurrentPositionInfo(apoint);}
if(apoint!=null){apoint.point=actor.getPoint();if(apoint!=null){actor.getPoint().setLatLng(apoint.latlng);instance._animateTime+=2;Array.add(args.actors,apoint);}else{actorArgs=new Object();actorArgs.actor=actor;actorArgs.completeSecond=instance.getCurrentAnimationTime();actorArgs.removeActor=true;instance._animationActorCompleteDelegate(actorArgs);if(actorArgs.removeActor===true){numberAnimationsComplete++;}}}else{numberAnimationsComplete++;}}
args.time=instance.getCurrentAnimationTime();instance._animationTickDelegate(args);if(numberAnimationsComplete==instance._animatedPoints.length){var cargs={time:instance.getCurrentAnimationTime()};instance.stopAnimation();instance._animationCompleteDelegate(cargs);}};this._animateTimer=$create(SportsDo.Timer,{enabled:true,id:this.getId()+"_animateTimer",interval:speed},{tick:this.animateTimer_OnTick},null,null);}},stopAnimation:function(){if(this._animateTimer!=null){this._animateTimer.set_enabled(false);Sys.Application.removeComponent(this._animateTimer);this._animateTime=0;this._animateTimer=null;this._onReplayStopHandler();}},pauseAnimation:function(value){if(this._animateTimer!=null){this._animateTimer.set_enabled(!value);this._onReplayPauseHandler({"paused":value});}},isAnimationPaused:function(){if(this._animateTimer!=null){return!this._animateTimer.get_enabled();}else{return true;}},changeAnimationSpeed:function(speed){speed=speed==null?100:speed;if(this._animateTimer!=null){this.pauseAnimation(true);this._animateTimer.set_interval(speed);this.pauseAnimation(false);}},getCurrentAnimationTime:function(){return this._animateTime;},getAnimatedPosition:function(lapPoints){var pos=-1;for(var i=1;i<lapPoints.length;i++){if(lapPoints[i].getTime()>this._animateTime){pos=i;break;}}
if(pos<0){return null;}else{var lapPoint=lapPoints[pos];var prevLapPoint=lapPoints[pos-1];var timeDiff=lapPoint.getTime()-prevLapPoint.getTime();var speedDiff=lapPoint.getSpeed()-prevLapPoint.getSpeed();var distanceDiff=lapPoint.getDistance()-prevLapPoint.getDistance();var latDiff=lapPoint.getLatitude()-prevLapPoint.getLatitude();var lngDiff=lapPoint.getLongitude()-prevLapPoint.getLongitude();var timeInto=this._animateTime-prevLapPoint.getTime();var data={"speed":lapPoint.getSpeed(),"time":lapPoint.getTime(),"distance":lapPoint.getDistance(),"latlng":new SportsDo.Mapping.SLatLng(prevLapPoint.getLatitude()+latDiff*timeInto/timeDiff,prevLapPoint.getLongitude()+lngDiff*timeInto/timeDiff)};return data;}},animatePoint:function(point,laps){Array.add(this._animatedPoints,new SportsDo.Mapping.AnimationActor(point,laps));},getAnimatedPoints:function(){return this._animatedPoints;},removeAllAnimationPoints:function(){Array.clear(this._animatedPoints);},_onAnimationTickHandler:function(args){var h=this.get_events().getHandler('animationTick');if(h){h(this,args);}},addOnAnimationTick:function(handler){this.get_events().addHandler("animationTick",handler);},removeOnAnimationTick:function(handler){this.get_events().removeHandler("animationTick",handler);},_onAnimationActorCompleteHandler:function(args){var h=this.get_events().getHandler('animationActorComplete');if(h){h(this,args);}},addOnAnimationActorComplete:function(handler){this.get_events().addHandler("animationActorComplete",handler);},removeOnAnimationActorComplete:function(handler){this.get_events().removeHandler("animationActorComplete",handler);},_onAnimationCompleteHandler:function(args){var h=this.get_events().getHandler('animationComplete');if(h){h(this,args);}},addOnAnimationComplete:function(handler){this.get_events().addHandler("animationComplete",handler);},removeOnAnimationComplete:function(handler){this.get_events().removeHandler("animationComplete",handler);},_onReplayStartHandler:function(args){var h=this.get_events().getHandler('replayStart');if(h){h(this,args);}},addOnReplayStart:function(handler){this.get_events().addHandler("replayStart",handler);},removeOnReplayStart:function(handler){this.get_events().removeHandler("replayStart",handler);},_onReplayStopHandler:function(args){var h=this.get_events().getHandler('replayStop');if(h){h(this,args);}},addOnReplayStop:function(handler){this.get_events().addHandler("replayStop",handler);},removeOnReplayStop:function(handler){this.get_events().removeHandler("replayStop",handler);},_onReplayPauseHandler:function(args){var h=this.get_events().getHandler('replayPause');if(h){h(this,args);}},addOnReplayPause:function(handler){this.get_events().addHandler("replayPause",handler);},removeOnReplayPause:function(handler){this.get_events().removeHandler("replayPause",handler);},_onReplayFastForwardHandler:function(args){var h=this.get_events().getHandler('replayFastForward');if(h){h(this,args);}},addOnReplayFastForward:function(handler){this.get_events().addHandler("replayFastForward",handler);},removeOnReplayFastForward:function(handler){this.get_events().removeHandler("replayFastForward",handler);},_onReplayRewindHandler:function(args){var h=this.get_events().getHandler('replayRewind');if(h){h(this,args);}},addOnReplayRewind:function(handler){this.get_events().addHandler("replayRewind",handler);},removeOnReplayRewind:function(handler){this.get_events().removeHandler("replayRewind",handler);},changePointIcon:function(point,icon){},addPoint:function(point){var allowAdd=false;if(this.isAddingPointsEnabled()&&this.findPointById(point.getId())==null){point.setMap(this);if(this.isInViewRegion(point.getLatLng())){allowAdd=true;point._onAddVisible=true;}else{point._visible=false;allowAdd=true;}
this._points.setItem(point.getId(),point);}
return allowAdd;},movePoint:function(point){var args={"point":point};this._onPointMovedDelegate(args);},removePointById:function(id){var point=this.findPointById(id);if(point)this.removePoint(point);},removePoint:function(point){if(point!=null){point.setWrappedPoint(null);this._points.removeItem(point.getId());}},removeAllPoints:function(){var point,points;var index=0;points=this.getPoints();while(points.length>0){point=points.getItem(points.keys[0]);this.removePoint(point);}},removePointOfInterest:function(id)
{var point=this.findPointById(id);if(point)this.removePoint(point);var route=this.findRouteById(id);if(route)this.removeRouteById(id);point=this.findPointById(id+"_ic");if(point)this.removePoint(point);},findPointById:function(id){return this._points.getItem(id);},centerPoint:function(id,zoom){var point=this.findPointById(id);if(point!=null&&!this.isInViewRegion(point.getLatLng())){this.setMapCenter(point.getLatLng(),zoom);}
return point;},getPoints:function(){return this._points;},hidePoint:function(point){},showPoint:function(point){},togglePointsInRegion:function(points,region,hideOthers){hideOthers=typeof(hideOthers)==="undefined"||hideOthers===null?true:false;if(points!=null&&region!=null){var point;for(var i=0;i<points.length;i++){point=points.getItem(points.keys[i]);if(this.isInRegion(region.topLeft,region.bottomRight,point.getLatLng())){point.show();}else{if(this.getBubblePoint()!=null&&point.getId()===this.getBubblePoint().getId()){this.centerDoer(point.getId());}else if(hideOthers===true){point.hide();}}}}},enableBubble:function(){this._enableBubble=true;},disableBubble:function(){this._enableBubble=false;},isBubbleEnabled:function(){return this._enableBubble;},showBubble:function(point){this._setBubblePoint(point);},hideBubble:function(point){this._setBubblePoint(null);},getBubblePoint:function(){return this._bubbledPoint;},_setBubblePoint:function(point){this._bubbledPoint=point;},_onPointAddHandler:function(args){var h=this.get_events().getHandler('onPointAdd');if(h){h(this,args);}},addOnPointAdd:function(handler){this.get_events().addHandler("onPointAdd",handler);},removeOnPointAdd:function(handler){this.get_events().removeHandler("onPointAdd",handler);},_onPointMovedHandler:function(args){var h=this.get_events().getHandler('onPointMoved');if(h){h(this,args);}},addOnPointMoved:function(handler){this.get_events().addHandler("onPointMoved",handler);},removeOnPointMoved:function(handler){this.get_events().removeHandler("onPointMoved",handler);},_onPointClickHandler:function(args){var h=this.get_events().getHandler('pointClick');if(h){h(this,args);}},addOnPointClick:function(handler){this.get_events().addHandler("pointClick",handler);},removeOnPointClick:function(handler){this.get_events().removeHandler("pointClick",handler);},_onMapDataboundHandler:function(args){var h=this.get_events().getHandler('mapDatabound');if(h){h(this,args);}},addOnMapDatabound:function(handler){this.get_events().addHandler("mapDatabound",handler);},removeOnMapDatabound:function(handler){this.get_events().removeHandler("mapDatabound",handler);},_onMapClickHandler:function(args){var h=this.get_events().getHandler('mapClick');if(h){h(this,args);}},addOnMapClick:function(handler){this.get_events().addHandler("mapClick",handler);},removeOnMapClick:function(handler){this.get_events().removeHandler("mapClick",handler);},_prePointBubbleShowHandler:function(args){var h=this.get_events().getHandler('prePointBubbleShow');if(h){h(this,args);}},addPrePointBubbleShow:function(handler){this.get_events().addHandler("prePointBubbleShow",handler);},removePrePointBubbleShow:function(handler){this.get_events().removeHandler("prePointBubbleShow",handler);},_onPointBubbleShowHandler:function(args){var h=this.get_events().getHandler('onPointBubbleShow');if(h){h(this,args);}},addOnPointBubbleShow:function(handler){this.get_events().addHandler("onPointBubbleShow",handler);},removeOnPointBubbleShow:function(handler){this.get_events().removeHandler("onPointBubbleShow",handler);},_prePointBubbleCloseHandler:function(args){var h=this.get_events().getHandler('prePointBubbleClose');if(h){h(this,args);}},addPrePointBubbleClose:function(handler){this.get_events().addHandler("prePointBubbleClose",handler);},removePrePointBubbleClose:function(handler){this.get_events().removeHandler("prePointBubbleClose",handler);},addPhoto:function(photo){var allowAdd=false;if(this.findPhotoById(photo.getId())==null){photo.setMap(this);var args={photo:photo};this._onPhotoAddDelegate(args);if(this.isInViewRegion(photo.getLatLng())){allowAdd=true;photo._onAddVisible=true;}else{photo._visible=false;allowAdd=true;}
this._photos.setItem(photo.getId(),photo);}
return allowAdd;},removePhotoById:function(id){var photo=this.findPhotoById(id);if(photo!=null){this.removePhoto(photo);}},removePhoto:function(photo){if(photo!=null){photo.setWrappedPoint(null);this._photos.removeItem(photo.getId());}},removeAllPhotos:function(){var photos,photo;var index=0;photos=this.getPhotos();while(photos.length>0){photo=photos.getItem(photos.keys[0]);this.removePhoto(photo);}},findPhotoById:function(id){return this._photos.getItem(id);},centerPhoto:function(id,zoom){var photo=this.findPhotoById(id);if(photo!=null&&!this.isInViewRegion(photo.getLatLng())){this.setMapCenter(photo.getLatLng(),zoom);}
return photo;},hidePhoto:function(photo){},showPhoto:function(photo){},showPhotoBubble:function(photo){this._setBubblePoint(photo);},getPhotos:function(){return this._photos;},addDoer:function(doer){var allowAdd=false;if(this.findDoerById(doer.getId())==null){var args={doer:doer};this._onDoerAddDelegate(args);doer.setMap(this);if(doer.getLatLng()==null){allowAdd=false;}else if(this.isInViewRegion(doer.getLatLng())){allowAdd=true;}else{allowAdd=true;doer._visible=false;}
this._doers.setItem(doer.getId(),doer);}
return allowAdd;},removeDoerById:function(id){var doer=this.findDoerById(id);this.removeDoer(doer);},removeDoer:function(doer){if(doer!=null){doer.setWrappedPoint(null);this._doers.removeItem(doer.getId());}},removeAllDoers:function(){var doer,doers;var index=0;doers=this.getDoers();while(doers.length>0){doer=doers.getItem(doers.keys[0]);this.removeDoer(doer);}},findDoerById:function(id){return this._doers.getItem(id);},centerDoer:function(id,zoom){var doer=this.findDoerById(id);if(doer!=null&&!this.isInViewRegion(doer.getLatLng())){this.setMapCenter(doer.getLatLng(),zoom);}
return doer;},showDoer:function(doer){},showDoerBubble:function(doer){this._bubbledPoint=doer;},getDoers:function(){return this._doers;},_onDoerAddHandler:function(args){var h=this.get_events().getHandler('onDoerAdd');if(h){h(this,args);}},addOnDoerAdd:function(handler){this.get_events().addHandler("onDoerAdd",handler);},removeOnDoerAdd:function(handler){this.get_events().removeHandler("onDoerAdd",handler);},_preDoerBubbleShowHandler:function(args){var h=this.get_events().getHandler('preDoerBubbleShow');if(h){h(this,args);}},addPreDoerBubbleShow:function(handler){this.get_events().addHandler("preDoerBubbleShow",handler);},removePreDoerBubbleShow:function(handler){this.get_events().removeHandler("preDoerBubbleShow",handler);},_onPhotoAddHandler:function(args){var h=this.get_events().getHandler('onPhotoAdd');if(h){h(this,args);}},addOnPhotoAdd:function(handler){this.get_events().addHandler("onPhotoAdd",handler);},removeOnPhotoAdd:function(handler){this.get_events().removeHandler("onPhotoAdd",handler);},addPanelControl:function(panel){if(this.findPanelControlById(panel.getId())==null){Array.add(this._panelControls,panel);return true;}else{return false;}},removePanelControl:function(id){var panel=this.findPanelControlById(id);if(panel!=null){Array.remove(this._panelControls,panel);}},findPanelControlById:function(id){return this.findInArrayById(id,this._panelControls);},getPanelControls:function(){return this._panelControls;},showDashboardPanel:function(opts){},hideDashboardPanel:function(){},showMapTypePanel:function(){},hideMapTypePanel:function(){},showReplayPanel:function(options){if(this._onReplayStartDelegate===null){this._onReplayStartDelegate=Function.createDelegate(this,this._onReplayStartHandler);}
if(this._onReplayStopDelegate===null){this._onReplayStopDelegate=Function.createDelegate(this,this._onReplayStopHandler);}
if(this._onReplayPauseDelegate===null){this._onReplayPauseDelegate=Function.createDelegate(this,this._onReplayPauseHandler);}
if(this._onReplayFastForwardDelegate===null){this._onReplayFastForwardDelegate=Function.createDelegate(this,this._onReplayFastForwardHandler);}
if(this._onReplayRewindDelegate===null){this._onReplayRewindDelegate=Function.createDelegate(this,this._onReplayRewindHandler);}},hideReplayPanel:function(){},showOverviewMapPanel:function(){},hideOverviewMapPanel:function(){},showLoadingPanel:function(){},hideLoadingPanel:function(){},isInRegion:function(topleft,bottomright,latlng){if(latlng.getLatitude()<topleft.getLatitude()&&latlng.getLatitude()>bottomright.getLatitude()&&latlng.getLongitude()>topleft.getLongitude()&&latlng.getLongitude()<bottomright.getLongitude()){return true;}else{return false;}},isInViewRegion:function(latlng){if(latlng==null)return false;var v=this.getViewRegion();return this.isInRegion(v.topLeft,v.bottomRight,latlng);},dispose:function(){this._id=null;this._provider=null;this._panelControls=null;this._points=null;this._doers=null;this._photos=null;this._routes=null;this._polylines=null;this._originalCenter=null;this._map=null;this._enableAddingPoints=null;this._animatedPoints=[];this._animateTimer=null;this._animationTickDelegate=null;this._bubbledPoint=null;this._enableBubble=null;this._animationActorCompleteDelegate=null;this._animationCompleteDelegate=null;this._onReplayStartDelegate=null;this._onReplayStopDelegate=null;this._onReplayPauseDelegate=null;this._onReplayFastForwardDelegate=null;this._onReplayRewindDelegate=null;SportsDo.Mapping.SMap.callBaseMethod(this,'dispose');},getType:function(){return SportsDo.Mapping.SMap.getName();}};SportsDo.Mapping.SMap.inheritsFrom(Sys.Component);SportsDo.Mapping.SMap.registerClass('SportsDo.Mapping.SMap',Sys.Component,SportsDo.IComponent);if(typeof(Sys)!=='undefined'){Sys.Application.notifyScriptLoaded();}