VEShape.SetDescription("<div onclick='SetOrigin(VEShape.GetPoint());'>Drive From</div><div onclick='SetDestination(VEShape.GetPoint());'>Drive To</div>");
function SetOrigin(ArrayLatLong)
{
document.GetElementByID('OriginLatitude').value = ArrayLatLong[0].Latitude;
document.GetElementByID('OriginLongitude').value = ArrayLatLong[0].Longitude;
}
function SetDestination(ArrayLatLong)
{
document.GetElementByID('DestinationLatitude').value = ArrayLatLong[0].Latitude;
document.GetElementByID('DestinationLongitude').value = ArrayLatLong[0].Longitude;
}
//You'll need a separate html button that triggers this function
function GenerateRoute()
{
VEMap.GetRoute(new VELatLong(document.GetElementByID('OriginLatitude').value, document.GetElementByID('OriginLongitude').value), new VELatLong(document.GetElementByID('DestinationLatitude').value, document.GetElementByID('DestinationLongitude').value));
}