// Google Maps Helper Functions - Build Objects

function createCARLAMarker(point,content,iconImage,iconType) {
  var icon = new GIcon();
  icon.image = '/media/coverage/' + iconImage;
  icon.infoWindowAnchor = new GPoint(8,2);
  if (iconType == 'single') {
    icon.iconSize = new GSize(20,20);
    icon.iconAnchor = new GPoint(10,10);
    icon.shadow = '/media/coverage/shadow_single.png';
    icon.shadowSize = new GSize(28,20);
  }
  else if (iconType == 'double') {
    icon.iconSize = new GSize(20,40);
    icon.iconAnchor = new GPoint(10,20);
    icon.shadow = '/media/coverage/shadow_double.png';
    icon.shadowSize = new GSize(38,40);
  }

  var marker = new GMarker(point,icon);
  GEvent.addListener(marker, "click", function() {
    marker.openInfoWindowHtml(content);
  } );

  return marker;
}


// debug - depreciated after move to dbv2?
// might as well leave it for historical purposes, in case we want to make a 'createCARLAMarkerTabbed' function
// or just rework the thing...
function createTabbedMarker(point,image,tabs,hover) {
  var icon = new GIcon(G_DEFAULT_ICON, image);
  var marker = new GMarker(point,icon);

  var infotabs = new Array();
  for (var i=0; i < tabs.length; i++) {
    infotabs[i] = new GInfoWindowTab(tabs[i][0],tabs[i][1]);
  }

  if (hover) {
    GEvent.addListener(marker, "mouseover", function() {
       marker.openInfoWindowTabsHtml(infotabs);
    } );
    GEvent.addListener(marker, "mouseout", function() {
       marker.closeInfoWindow();
    } );
  }
  else {
    GEvent.addListener(marker, "click", function() {
       marker.openInfoWindowTabsHtml(infotabs);
    } );
  }

  return marker;
}

function createToolTipMarker(point,image,tooltip) {
  var icon = new GIcon(G_DEFAULT_ICON, image);
  var options = {
    'icon': icon,
//    'clickable': false,
    'title': tooltip
  }
  var marker = new GMarker(point,options);
  return marker;
}

function createLabeledMarker(point,image,label) {
  var icon = new GIcon(G_DEFAULT_ICON, image);
  var options = {
    'icon': icon,
//    'clickable': false,
    'labelText': label,
    'labelOffset': new GSize(15,-32)
  };
  var marker = new LabeledMarker(point, options);
  return marker;
}

