var LONELIEST_ADDR = '462 7th Avenue at 35th Street';

// Produced from 'find_furthest'
var MOST_ISOLATED_LAT = 40.6010269999999;
var MOST_ISOLATED_LNG = -73.8477129999999;

function inConvexHull(addr) {
  for (var i in HULL) {
    if (addr == HULL[i]) return true;
  }
  return false;
}

function getIcon(addr) {
  if (addr == LONELIEST_ADDR) {
    icon = BLUE_ICON;
  } else if (inConvexHull(addr)) {
    icon = GREEN_ICON;
  } else {
    icon = RED_ICON;
  }
  return icon;
}

function afterOnLoad() {
  //
  // Connect all the points in the hull
  //
  var latlngs = [];
  for (var i in HULL) {
    latlngs.push(getPoint(HULL[i]));
  }
  latlngs.push(getPoint(HULL[0])); //wrap it around
  map.addOverlay(new GPolyline(latlngs,'#000077'));
  //
  // Add the most isolated pernt
  //
  var isolatedPoint = new GLatLng(MOST_ISOLATED_LAT,MOST_ISOLATED_LNG);
  var icon = YELLOW_ICON;
  addPointToMap('Most isolated',isolatedPoint,YELLOW_ICON);
}

