// 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(map) {
  var container = document.createElement("div");

  var zoomInDiv = document.createElement("div");
  this.setButtonStyle_(zoomInDiv);
  container.appendChild(zoomInDiv);
  zoomInDiv.appendChild(document.createTextNode("Zoom +"));
  GEvent.addDomListener(zoomInDiv, "click", function() {
    map.zoomIn();
  });

  var zoomOutDiv = document.createElement("div");
  this.setButtonStyle_(zoomOutDiv);
  container.appendChild(zoomOutDiv);
  zoomOutDiv.appendChild(document.createTextNode("Zoom -"));
  GEvent.addDomListener(zoomOutDiv, "click", function() {
    map.zoomOut();
  });

  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 = "#2D6497";
  button.style.font = "12px 'Trebuchet MS'";
  button.style.border = "2px outset #20476A";
  button.style.paddingTop = "2px";
  button.style.marginBottom = "3px";
  button.style.textAlign = "center";
  button.style.width = "100px";
  button.style.height = "18px";
  button.style.cursor = "pointer";
}
function createInfoMarker(point, text, map)
{
  // Afficher le marqueur
  var marker=getIcon(point);
  map.addOverlay(marker);
   marker.openInfoWindowHtml(text);
  // Lorsque le marqueur est cliqu�, on ouvre l'info-bulle
  /*GEvent.addListener(marker,
                     "mouseover",
                     function()
                    {
                        marker.openInfoWindowHtml(text);
                    }
  );*/
}
function getLatLong()
{

}
function getIcon(point)
{
      /*Cr�ation de l'incone */
   var icon = new GIcon();
   icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
   icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
   icon.iconSize = new GSize(12, 20);
   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+"�"+m+"'"+s);
}
function mk_map_plan_acces(o_div)
{
    if (GBrowserIsCompatible())
    {
          /* Variable qui va correspondre � l'affichage de la carte dans la "div" */
       var map = new GMap2(o_div);
       /* Centre la carte aux coordonn�es indiqu�es et r�alise un zoom de niveau 14 */
       var pointVH = new GLatLng(48.6152360080842, -1.9861221313476562);
       var center = new GLatLng(48.5, -0.1);

       map.addControl(new TextualZoomControl());

       map.setCenter(center, 6);
       createInfoMarker(pointVH, "<div><strong><span style='font-size:18px'>Domaine de La Ville Huchet</span></strong><br/>Adresse : <ul><li>rte de la passag&egrave;re</li><li>35400 SAINT MALO</li></ul><br/>Coordon&eacute;es GPS :<ul><li>Latitude : 48&deg; 36' 55  Nord</li><li>Longitude : 1&deg; 59' 10 Ouest</li></ul></div>",map);
       o_div.childNodes[1].style.bottom="-15px";
       o_div.childNodes[2].style.bottom="-33px";
    }
    else
    {
       setTimeout('mk_map_plan_acces(o_div)', 10500);
    }
}
