var UNKNOWN_ALTITUDE_KM = -10;

function WaypointType()
{
}
WaypointType.Arrive = 0;
WaypointType.BearLeft = 1;
WaypointType.BearRight = 2;
WaypointType.TurnAround = 3;
WaypointType.TurnLeft = 4;
WaypointType.TurnRight = 5;
WaypointType.Reserved500 = 6;
WaypointType.Reserved400 = 7;
WaypointType.Reserved300 = 8;
WaypointType.Reserved200 = 9;
WaypointType.Reserved100 = 10;
WaypointType.Start = 11;  //11
WaypointType.Finish = 12;               //12
WaypointType.StartInterval = 13;
WaypointType.FinishInterval = 14;
WaypointType.Continue = 15;              //15
WaypointType.Summit = 16;
WaypointType.FeedZone = 17;
WaypointType.Announcement = 18; 


 
function ClientWaypoint() 
{
   this.Longitude = 0;
   this.Latitude = 0;
   
   this.Timestamp = new Date(0);
   this.CourseId = "";
   this.Altitude = UNKNOWN_ALTITUDE_KM;
   this.Heading = -1;
   this.WaypointType = WaypointType.Continue;
   this.TextDescription = "";
   
//   this.toString = function() {
//       var alt = "";
//       if (this.Altitude != UNKNOWN_ALTITUDE_KM)
//           alt = ' Alt:' + KilosToFeet(this.Altitude).toFixed(1) + 'ft';
//             
//       var status = 'Time: ' + this.Timestamp.toString() + ' Lat:' + this.Latitude.toFixed(5) + ' Lon:' + this.Longitude.toFixed(5) + alt + ' ElapsedDist:' + KilosToMiles(this.ElapsedDistanceKM).toFixed(3) +'mi';
//       if ( this.TextDescription )
//           status += ' Desc:' + this.TextDescription 
//              
//       if (this.AudioDescriptionURL)     
//           status += ' AudioURL:' + this.AudioDescriptionURL; 
//   }
   
   this.Position = function() { return new Position(this.Longitude,this.Latitude)}
   this.DistanceTo = function(target) 
   {
      return Position().DistanceTo(target.Position());
   }
   this.BearingTo = function(target) 
   {
      return Position().BearingTo(target.Position());
   }
}