// Create a base icon for all of our markers that specifies the shadow, icon
// dimensions, etc.
var baseIcon = new GIcon();
baseIcon.shadow = "_etc/maps/shadow50.png";
baseIcon.iconSize = new GSize(20, 34);
baseIcon.shadowSize = new GSize(37, 34);
baseIcon.iconAnchor = new GPoint(9, 34);
baseIcon.infoWindowAnchor = new GPoint(9, 2);
baseIcon.infoShadowAnchor = new GPoint(18, 25);

function createMarker(map, lng, lat, index, img, title, price, agent, phone, logo) {
  var icon = new GIcon(baseIcon);
  if(index<10) { i="0"+index; } else { i=index; }
  icon.image = "_etc/maps/pin_" + i + ".png";
  var marker = new GMarker(new GPoint(lng, lat), icon);
  // Show this marker's info in the window when it is clicked
  var html = "<img src='" + img + "' width='150'><br>";
  if(title!=null&&title!='') { html += "<br /><b>" + title + "<\/b>"; }
  if(price!=null&&price!='') { html += "<br />" + price; }
  if(agent!=null&&agent!='') { html += "<br />" + agent; }
  if(phone!=null&&phone!='') { html += "<br />" + phone; }
  GEvent.addListener(marker, "click", function() {
    marker.openInfoWindowHtml(html);
  });
  map.addOverlay(marker);
  return(marker);
}

function centerZoom(map,marker,lng,lat,zoom, img, title, price, agent, phone, logo) {
  var point = new GPoint(lng,lat)
  map.centerAndZoom(point, zoom);
   // Show this marker's info in the window when it is clicked
  var html = '';
  if(img!=null&&img!='') { html += "<img src='" + img + "' width='150'><br>"; }
  if(title!=null&&title!='') { html += "<br /><b>" + title + "<\/b>"; }
  if(price!=null&&price!='') { html += "<br />" + price; }
  if(agent!=null&&agent!='') { html += "<br />" + agent; }
  if(phone!=null&&phone!='') { html += "<br />" + phone; }
  marker.openInfoWindowHtml(html);
}