// A TextualZoomControl is a GControl that displays textual "Zoom In"
// and "Zoom Out" buttons (as opposed to the iconic buttons used in
// Google Maps).
function TextualZoomControl()
{}
TextualZoomControl.prototype = new GControl();

// Creates a one DIV for each of the buttons and places them in a container
// DIV which is returned as our control element. We add the control to
// to the map container and return the element for the map class to
// position properly.
TextualZoomControl.prototype.initialize = function(mega_map) {
  var container = document.createElement("div");

  var zoomInDiv = document.createElement("div");
  this.setButtonStyle_(zoomInDiv);
  container.appendChild(zoomInDiv);
  zoomInDiv.appendChild(document.createTextNode("+"));
  GEvent.addDomListener(zoomInDiv, "click", function() {
    mega_map.zoomIn();
  });

  var zoomOutDiv = document.createElement("div");
  this.setButtonStyle_(zoomOutDiv);
  container.appendChild(zoomOutDiv);
  zoomOutDiv.appendChild(document.createTextNode("-"));
  GEvent.addDomListener(zoomOutDiv, "click", function() {
    mega_map.zoomOut();
  });

  mega_map.getContainer().appendChild(container);
  return container;
}

// By default, the control will appear in the top left corner of the
// map with 7 pixels of padding.
TextualZoomControl.prototype.getDefaultPosition = function() {
  return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(7, 7));
}

// Sets the proper CSS for the given button element.
TextualZoomControl.prototype.setButtonStyle_ =
function(button)
{
  //button.style.textDecoration = "underline";
  button.style.color = "white";
  button.style.backgroundColor = "#52361F";
  button.style.font = "12px 'Verdana'";
  button.style.border = "2px outset #3A2616";
  button.style.paddingTop = "2px";
  button.style.marginBottom = "3px";
  button.style.textAlign = "center";
  button.style.width = "18px";
  button.style.height = "18px";
  button.style.cursor = "pointer";
}
function createInfoMarker(point, text, map, color)
{
// Afficher le marqueur
        var marker=getIcon(point, color);
        // ========== Open the EWindow instead of a Google Info Window ==========
        GEvent.addListener(marker, "click", function() {
          ew.openOnMarker(marker,text);
        });
        return marker;
}

function createTabbedMarker(point,str_site_geo, str_activite, label_site_geo, label_activite, map, color)
{
   var marker=getIcon(point, color);
   map.addOverlay(marker);
   GEvent.addListener(marker, "click", function() {
    var tab_site_geo=new GInfoWindowTab(label_site_geo,str_site_geo);
    tab_site_geo.maxWidth="250px";
    var tab_activite=new GInfoWindowTab(label_activite,str_activite);
    marker.openInfoWindowTabsHtml([tab_site_geo, tab_activite]);
   });
   //return marker;
}
function getLatLong()
{

}
function getIcon(point, color)
{
      /*Cr�ation de l'incone */
   var icon = new GIcon();
   icon.image = "/includes/images/ico_cabane.png";
/*   icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
   icon.image = "http://labs.google.com/ridefinder/images/mm_20_"+color+".png";
   icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";*/
   icon.iconSize = new GSize(20, 15);
   icon.shadowSize = new GSize(22, 20);
   icon.iconAnchor = new GPoint(6, 20);
   icon.infoWindowAnchor = new GPoint(5, 1);  // Cr�ation d'un marqueur
   var marker = new GMarker(point, icon);


   return marker
}
function dec2dms(l) {
	d = Math.floor(l);
	p = (l - d) * 60;
	m = Math.floor(p);
	s = Math.round((p - m) * 60);
	alert(d+"&deg;"+m+"'"+s);
}
