function plotsingleaircraft() {
  lat = acraftdata['Latitude'+itemclicked];
  lon = acraftdata['Longitude'+itemclicked];
  var point = new GLatLng(lat, lon);
  map.panTo(new GLatLng(Number(lat), Number(lon))); //Center on the marker
  marker.setTooltipHiding(false);
  map.addOverlay(marker);
  var id = marker.getId();
  GEvent.trigger(marker, 'mouseover');
}
function plotallaircraft() {
  latall = Latitude; //acraftdata['Latitude'+ModeS];
  lonall = Longitude; //acraftdata['Longitude'+ModeS];
  trackall = Math.round(Track);
  if (Groundspeed != "Nil Data") {

    //Groundspeed = "0";
 
     if (Vertical_Rate == "Nil Data") {

    Vertical_Rate = "0";
  }

       if (Track == "Nil Data") {

    Track = "0";
  }



   if (Vertical_Rate < 0) {
    var vrate = "<font size='4'>&darr;</font>";
    } else if (Vertical_Rate > 0) {
    var vrate = "<font size='4'>&uarr;</font>";
    } else if (Vertical_Rate == 0) {
    var vrate = "<font size='4'>&rarr;</font>";
    }


  icon.image = "markers/" + trackall + ".png";
  var pointall = new GLatLng(latall, lonall);
  if (map.getZoom() == 10 ) {
  offseta = 23
  offsetb = 22
  icon.iconAnchor = new GPoint(offseta, offsetb);
  }
   else if (map.getZoom() == 11 ) {
  offseta = 23
  offsetb = 22
  icon.iconAnchor = new GPoint(offseta, offsetb);
  }
   else if (map.getZoom() == 12 ) {
  offseta = 23
  offsetb = 22
  icon.iconAnchor = new GPoint(offseta, offsetb);
  }
  else if (map.getZoom() == 13 ) {
  offseta = 23
  offsetb = 22

  icon.iconAnchor = new GPoint(offseta, offsetb);
  }
   else if (map.getZoom() == 14 ) {
  //perfect
  offseta = 23
  offsetb = 22
  icon.iconAnchor = new GPoint(offseta, offsetb);
  }
   else if (map.getZoom() == 15 ) {
  //perfect
  offseta = 23
  offsetb = 22
  icon.iconAnchor = new GPoint(offseta, offsetb);
  }
  //marker = new PdMarker(new GLatLng(latall, lonall)); //Use this if you use the default icon
  marker = new PdMarker(new GLatLng(latall, lonall), icon); //Use this if you change the icon to something else
  marker.setId(ModeS);
  aircrafttooltip = "<center>" + Track + "&#176; " + Groundspeed + " kts   " + Altitude + " ft " + vrate + "</center>";
  if (Aircraft_Registration == "Nil Data") {
    Aircraft_Registration1 = " (Nil Data)";
  } else
  {
    Aircraft_Registration1 = " (" + Aircraft_Registration + ")";
  }
  if(Callsign=="Nil Data") {
    marker.setTooltip("<center>" + Airline + "<br />" + ModeS + Aircraft_Registration1 + "</center>" + aircrafttooltip);} else {
    marker.setTooltip("<center>" + Airline + "<br />" + Callsign + " " + " (" + Aircraft_Registration + ")" + "</center>" + aircrafttooltip);
  }


  marker.setTooltipHiding(false);
  map.addOverlay(marker);
  var id = marker.getId();
  GEvent.trigger(marker, 'mouseover');
}}
function calculatedistance() {
  var glatlng1 = new GLatLng(-33.797261, 151.178309);
  var glatlng2 = new GLatLng(acraftdata['Latitude'+itemclicked], acraftdata['Longitude'+itemclicked]);
  miledistance = glatlng1.distanceFrom(glatlng2, 3959).toFixed(1);
  kmdistance = (miledistance * 1.609344).toFixed(1);
  $("#distancedata").html(kmdistance + " km");
}
