//<![CDATA[
    var iconGreen = new GIcon(); 
    iconGreen.image = 'images/rov_google_gr.png';
    iconGreen.shadow = 'images/google_shadow.png';
    iconGreen.iconSize = new GSize(12, 20);
    iconGreen.shadowSize = new GSize(22, 20);
    iconGreen.iconAnchor = new GPoint(6, 20);
    iconGreen.infoWindowAnchor = new GPoint(5, 1);

    var iconYellow = new GIcon(); 
    iconYellow.image = 'images/rov_google_yl.png';
    iconYellow.shadow = 'images/google_shadow.png';
    iconYellow.iconSize = new GSize(12, 20);
    iconYellow.shadowSize = new GSize(22, 20);
    iconYellow.iconAnchor = new GPoint(6, 20);
    iconYellow.infoWindowAnchor = new GPoint(5, 1);

    var iconRed = new GIcon(); 
    //iconRed.image = 'http://labs.google.com/ridefinder/images/mm_20_red.png';
	iconRed.image = 'images/rov_google_rd.png';
    iconRed.shadow = 'images/google_shadow.png';
    iconRed.iconSize = new GSize(12, 20);
    iconRed.shadowSize = new GSize(22, 20);
    iconRed.iconAnchor = new GPoint(6, 20);
    iconRed.infoWindowAnchor = new GPoint(5, 1);

    var customIcons = [];
    customIcons[1] = iconRed;
    customIcons[2] = iconYellow;
    customIcons[3] = iconYellow;
    customIcons[4] = iconGreen;
    customIcons[5] = iconGreen;
 
function load() 
{
 if (GBrowserIsCompatible()) 
 {
  var map = new GMap2(document.getElementById("map"));
  map.addControl(new GLargeMapControl());
  map.setCenter(new GLatLng(40, 0), 5);
  GDownloadUrl("genxml.php", function(data) 
  { 
   var xml = GXml.parse(data);
   var markers = xml.documentElement.getElementsByTagName("marker");
   for (var i = 0; i < markers.length; i++) {
    var name = markers[i].getAttribute("Name");
    var address = markers[i].getAttribute("Address");
    var price = markers[i].getAttribute("Price");
    var mark = markers[i].getAttribute("Mark");
	var description = markers[i].getAttribute("Description");
	var image = markers[i].getAttribute("ImageRoute");
	var id = markers[i].getAttribute("Id");
    var point = new GLatLng(parseFloat(markers[i].getAttribute("Lat")),
                            parseFloat(markers[i].getAttribute("Lng")));
    var marker = createMarker(point, name, address, price, mark, description, image, id);
    map.addOverlay(marker);
   } 
  });
 }
}

function createMarker(point, name, address, price, mark, description, image,id) {
  var marker = new GMarker(point, customIcons[mark]);
  var html = "<b>" + name + "</b> <br/>" + address + "<br/><br/>" + description + "<br/><br/>" + "<img width=220 src=" + image + "></img>" + "<br/><br>" +
             "<a style='text-decoration:underline'; href=restaurantes.php?id=" + id +">Ficha completa del restaurante</a>";
  GEvent.addListener(marker, 'click', function() {
    marker.openInfoWindowHtml(html,{maxWidth:200}); 

  });
  return marker;
}
//]]>

