﻿// --------------------------------------------------------------------------------------
// PT.GoogleMaps Javascript helper API
// --------------------------------------------------------------------------------------

function createMarkerPoint(latitude,longtitude) {
  var markerPoint = new GLatLng(latitude,longtitude);
  return markerPoint;
}

function createMarkerOptions(iconUrl, iconWidth, iconHeight, iconShadowUrl, shadowWidth, shadowHeight) {
    var baseIcon = new GIcon(G_DEFAULT_ICON);
    if (iconUrl) {
      var customIcon = new GIcon(baseIcon);
      customIcon.image = iconUrl;
      customIcon.iconSize = new GSize(iconWidth, iconHeight);
      customIcon.shadow = iconShadowUrl;
      customIcon.shadowSize = new GSize(shadowWidth, shadowHeight);
      customIcon.infoWindowAnchor = new GPoint(iconWidth / 2, iconHeight / 4);
      customIcon.iconAnchor = new GPoint(iconWidth / 2, iconHeight);
    }
    else
      var customIcon = new GIcon(baseIcon);
    markerOptions = { icon:customIcon };
    return markerOptions;
}

function createMarker(markerPoint, markerInfo, markerOptions) {
  var marker = new GMarker(markerPoint, markerOptions);
  if (markerInfo != "") {
    GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(decodeURIComponent(markerInfo)); });
  }
  return marker;
}

