function load() {
  if (GBrowserIsCompatible()) {
    
	//botones de posicion La Rioja Logroņo
	
	function posiciones() {
	}
	posiciones.prototype = new GControl();
	posiciones.prototype.initialize = function(map) {
		var container = document.createElement("div");

		var rioja = document.createElement("div");
		this.setButtonStyle_(rioja);
		container.appendChild(rioja);
		rioja.appendChild(document.createTextNode("La Rioja"));
		GEvent.addDomListener(rioja, "click", function() {
		map.setCenter(new GLatLng(42.32403179535469,-2.39776611328125), 9);
	     });

		map.getContainer().appendChild(container);
		return container;
		}

		posiciones.prototype.getDefaultPosition = function() {
		return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(100, 7));
		}

		//
		function posiciones2() {
	}
	posiciones2.prototype = new GControl();
	posiciones2.prototype.initialize = function(map) {
		var container2 = document.createElement("div");

		var logrono = document.createElement("div");
		this.setButtonStyle_(logrono);
		container2.appendChild(logrono);
		logrono.appendChild(document.createTextNode("Logroņo"));
		GEvent.addDomListener(logrono, "click", function() {
		map.setCenter(new GLatLng(42.46193494922249, -2.4469470977783203), 14);
	     });

		map.getContainer().appendChild(container2);
		return container2;
		}

		posiciones2.prototype.getDefaultPosition = function() {
		return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(180, 7));
		}
		
		// estilos de los botones
		
		posiciones2.prototype.setButtonStyle_ = posiciones.prototype.setButtonStyle_ = function(button) {
		button.style.textDecoration = "none";
		button.style.color = "#563157";
		button.style.backgroundColor = "white";
		button.style.font = "small Arial";
		button.style.fontWeight = "bold";
		button.style.border = "1px solid black";
		button.style.padding = "1px";
		button.style.marginRight = "10px";
		button.style.marginBottom = "10px";
		button.style.textAlign = "center";
		button.style.width = "5em";
		button.style.cursor = "pointer";
		}
	
	//fin de botones rioja logroņo
	
    //disable right menu
		function disableContextMenu(element) 
		{
		element.oncontextmenu = function() {return false;}
		}
		disableContextMenu(document.getElementById("map"));
        
    // Prevent from scrolling the page when zooming the map
		function wheelZoom(event) 
		{
		if(window.event) { event.returnValue = false; } // IE
		if(event.cancelable) { event.preventDefault(); } // DOM-Standard
		if((event.detail || -event.wheelDelta) < 0) {
		map.zoomIn(); } else {
		map.zoomOut(); }
		} 
        
    //adds the html in the markers
		function myclick(i) {
        gmarkers[i].openInfoWindowHtml('<div class="map_info_window" style="white-space:nowrap;">'+gmarkers[i].my_html+'</div>');
		}

     // create the map
		var map = new GMap(document.getElementById("map"));
	    map.addControl(new GSmallMapControl());
	    map.addControl(new GMapTypeControl());
		map.addControl(new posiciones());
		map.addControl(new posiciones2());
	    map.centerAndZoom(new GLatLng(42.46193494922249, -2.4469470977783203), 3);
		map.enableDoubleClickZoom();
		map.enableContinuousZoom();
		GEvent.addDomListener(document.getElementById("map"),"DOMMouseScroll", wheelZoom); // Firefox
        GEvent.addDomListener(document.getElementById("map"),"mousewheel",     wheelZoom); // IE 
			    
	// array to hold copies of the markers 
        var gmarkers = [];
      
	 // Read the data from xml file
      var request = GXmlHttp.create();
      request.open("GET", "lista_h.xml", true);
      request.onreadystatechange = function() {
        if (request.readyState == 4) {
          var xmlDoc = request.responseXML;
          
			var cincIcon = new GIcon();
			cincIcon.image="5star.gif";
			cincIcon.iconSize = new GSize(20, 29);
			cincIcon.iconAnchor = new GPoint(10, 29);
			cincIcon.infoWindowAnchor = new GPoint(5, 1);

			var multiIcon = new GIcon();
			multiIcon.image="red.gif";
			multiIcon.iconSize = new GSize(20, 29);
			multiIcon.iconAnchor = new GPoint(10, 29);
			multiIcon.infoWindowAnchor = new GPoint(20, 1);
			
			var cuatIcon = new GIcon();
			cuatIcon.image="4star.gif";
			cuatIcon.iconSize = new GSize(20, 29);
			cuatIcon.iconAnchor = new GPoint(10, 29);
			cuatIcon.infoWindowAnchor = new GPoint(5, 1);
			
			var tresIcon = new GIcon();
			tresIcon.image="3star.gif";
			tresIcon.iconSize = new GSize(20, 29);
			tresIcon.iconAnchor = new GPoint(10, 29);
			tresIcon.infoWindowAnchor = new GPoint(5, 1);
			
			var encIcon = new GIcon();
			encIcon.image="enc.gif";
			encIcon.iconSize = new GSize(20, 29);
			encIcon.iconAnchor = new GPoint(10, 29);
			encIcon.infoWindowAnchor = new GPoint(5, 1);
			
          // obtain the array of markers and loop through it
          var markers = xmlDoc.documentElement.getElementsByTagName("marker");
  			var sbcount =0;
  			var nabecount = 0;
          for (var i = 0; i < markers.length; i++) {
            // obtain the attribues of each marker
            var lat = parseFloat(markers[i].getAttribute("lat"));
            var lng = parseFloat(markers[i].getAttribute("lng"));
            var point = new GPoint(lng,lat);
            var html = markers[i].getAttribute("html");
            var sidelabel = markers[i].getAttribute("sidelabel");
            var thetitle = markers[i].getAttribute("title");
            var mrole = markers[i].getAttribute("mrole");
            // create the marker
            var  markerCreated = true;	// check below
            if (mrole=="5") { 
           	 var marker = new GMarker(point, {icon:cincIcon,title:thetitle}); }
            else if (mrole=="4") {
           	 var marker = new GMarker(point, {icon:cuatIcon,title:thetitle}); }            
            else if (mrole=="multi") {
           	 var marker = new GMarker(point, {icon:multiIcon,title:thetitle}); }            
            else if (mrole=="3") {
           	 var marker = new GMarker(point, {icon:tresIcon,title:thetitle}); }
           	 else if (mrole=="enc") {
           	 var marker = new GMarker(point, {icon:encIcon,title:thetitle}); }
	else { markerCreated=false; }
            
            if (markerCreated) {    // maybe marker not set (e.g. if mrole == multiother)
            
            marker.my_html = html;
            if (mrole=="5") {
            marker.sidelabel = sidelabel;
            sbcount++;}
            else if (mrole=="4") {
            marker.sidelabel = sidelabel;
            sbcount++;}            
            else if (mrole=="3") {
            marker.sidelabel_nabe = sidelabel;
            nabecount++;}
		map.addOverlay(marker); 
			var topElement = marker.iconImage;
		   gmarkers.push(marker);
           }
          }
          // these variables will collect the html which will eventually be placed in the sidebar
          var sidebar_html = "";
          var sidebar_nabe_html = "";
            }
      }
      request.send(null);

	    GEvent.addListener(map, "click", function(overlay, point) {
        if (overlay) {
          if (overlay.my_html) {
            overlay.openInfoWindowHtml('<div class="map_info_window" style="white-space:nowrap;">'+overlay.my_html+'</div>');
          }
        }
      });      
    
  // Set up the polyline with full blown data.  
    var gLatLngs = new Array(
      new GLatLng(42.64089642304886, -3.084197044372558),
      new GLatLng(42.62865429351794, -3.087844848632812),
      new GLatLng(42.58873028357689, -3.061408996582031),
      new GLatLng(42.54093947168063, -3.134193420410156),
      new GLatLng(42.52854328521114, -3.072395324707031),
      new GLatLng(42.47969355851231, -3.090248107910156),
      new GLatLng(42.44524802967223, -3.045272827148437),
      new GLatLng(42.41154400141296, -3.060722351074218),
      new GLatLng(42.369705548164845, -3.057289123535156),
      new GLatLng(42.39557261051849, -3.08441162109375),
      new GLatLng(42.421175572932114, -3.088188171386718),
      new GLatLng(42.4120509631092, -3.099174499511718),
      new GLatLng(42.38517634676783, -3.104324340820312),
      new GLatLng(42.356514317057886, -3.064155578613281),
      new GLatLng(42.352708639553654, -3.109474182128906),
      new GLatLng(42.32250876543571, -3.097801208496093),
      new GLatLng(42.245801966774025, -3.090934753417968),
      new GLatLng(42.20258156406216, -3.126296997070312),
      new GLatLng(42.1333673840616, -3.083724975585937),
      new GLatLng(42.08599350447723, -3.034629821777343),
      new GLatLng(42.08828660407765, -2.933349609375),
      new GLatLng(42.02277326296908, -2.913093566894531),
      new GLatLng(42.00950942549377, -2.88665771484375),
      new GLatLng(42.036034334077875, -2.812156677246093),
      new GLatLng(42.06433236471607, -2.793617248535156),
      new GLatLng(42.0793685289225, -2.80426025390625),
      new GLatLng(42.12521956084993, -2.76580810546875),
      new GLatLng(42.11859868281563, -2.750358581542968),
      new GLatLng(42.124964924487664, -2.740745544433593),
      new GLatLng(42.102043461013096, -2.706756591796875),
      new GLatLng(42.084974322493515, -2.709503173828125),
      new GLatLng(42.03348434294521, -2.756881713867187),
      new GLatLng(42.00823391072399, -2.744522094726562),
      new GLatLng(42.012825644202145, -2.702293395996093),
      new GLatLng(41.99777372492389, -2.67242431640625),
      new GLatLng(41.997263427969735, -2.578697204589843),
      new GLatLng(42.05541092308213, -2.540931701660156),
      new GLatLng(42.06535187823538, -2.51861572265625),
      new GLatLng(42.08191667830631, -2.522392272949218),
      new GLatLng(42.12216385695591, -2.510032653808593),
      new GLatLng(42.10637370579324, -2.485313415527343),
      new GLatLng(42.1371863154211, -2.438621520996093),
      new GLatLng(42.13413118875602, -2.283782958984375),
      new GLatLng(42.0872674589327, -2.263526916503906),
      new GLatLng(42.100005596427735, -2.229881286621093),
      new GLatLng(42.09771292048307, -2.127571105957031),
      new GLatLng(42.080642616405385, -2.126884460449218),
      new GLatLng(42.06688111781768, -2.161216735839843),
      new GLatLng(42.00109055538583, -2.109031677246093),
      new GLatLng(41.99547735640674, -2.122764587402343),
      new GLatLng(41.95770296764293, -2.111434936523437),
      new GLatLng(41.940595032710625, -2.037620544433593),
      new GLatLng(41.95234127309011, -2.029380798339843),
      new GLatLng(41.91913979219502, -1.975135803222656),
      new GLatLng(41.965872301512256, -1.856002807617187),
      new GLatLng(41.977103425369904, -1.863212585449218),
      new GLatLng(41.98756700839311, -1.845016479492187),
      new GLatLng(42.02506864632003, -1.882781982421875),
      new GLatLng(42.03118926345036, -1.901664733886718),
      new GLatLng(42.069174908123216, -1.905784606933593),
      new GLatLng(42.13031207317188, -1.83746337890625),
      new GLatLng(42.153732356884845, -1.822013854980468),
      new GLatLng(42.13795007405907, -1.781158447265625),
      new GLatLng(42.15093256154524, -1.762619018554687),
      new GLatLng(42.134385788273896, -1.720046997070312),
      new GLatLng(42.15245973799263, -1.681594848632812),
      new GLatLng(42.173327456435366, -1.702194213867187),
      new GLatLng(42.18986405028881, -1.681251525878906),
      new GLatLng(42.191644656281895, -1.703910827636718),
      new GLatLng(42.20944795735601, -1.709403991699218),
      new GLatLng(42.22139878761366, -1.765365600585937),
      new GLatLng(42.21377085914557, -1.77154541015625),
      new GLatLng(42.22648356137063, -1.7852783203125),
      new GLatLng(42.23055108552288, -1.820640563964843),
      new GLatLng(42.24910583856138, -1.821327209472656),
      new GLatLng(42.243768728900164, -1.828193664550781),
      new GLatLng(42.25977870328815, -1.853599548339843),
      new GLatLng(42.25113890442506, -1.854972839355468),
      new GLatLng(42.25749181289547, -1.877975463867187),
      new GLatLng(42.284929023632834, -1.867332458496093),
      new GLatLng(42.301436402364864, -1.915740966796875),
      new GLatLng(42.30854593989868, -1.907501220703125),
      new GLatLng(42.31514693442048, -1.920547485351562),
      new GLatLng(42.32657009662252, -1.917800903320312),
      new GLatLng(42.3280930282246, -1.927413940429687),
      new GLatLng(42.320985698648215, -1.93084716796875),
      new GLatLng(42.33494576417536, -1.943550109863281),
      new GLatLng(42.33494576417536, -1.966896057128906),
      new GLatLng(42.3425590395686, -1.964836120605468),
      new GLatLng(42.353469793490646, -1.973075866699218),
      new GLatLng(42.34991766291947, -1.98028564453125),
      new GLatLng(42.36387130676623, -1.997108459472656),
      new GLatLng(42.36133451106724, -2.009468078613281),
      new GLatLng(42.36919824433562, -2.016334533691406),
      new GLatLng(42.3425590395686, -2.070579528808593),
      new GLatLng(42.346872819794896, -2.089805603027343),
      new GLatLng(42.369451896762385, -2.080535888671875),
      new GLatLng(42.376300125104, -2.092208862304687),
      new GLatLng(42.38390839192567, -2.09014892578125),
      new GLatLng(42.39937569141588, -2.117271423339843),
      new GLatLng(42.416106509162205, -2.105598449707031),
      new GLatLng(42.418387638568504, -2.15606689453125),
      new GLatLng(42.40875563883781, -2.162933349609375),
      new GLatLng(42.40900913146671, -2.177352905273437),
      new GLatLng(42.41864109226924, -2.187995910644531),
      new GLatLng(42.415853045217105, -2.21649169921875),
      new GLatLng(42.42142901536395, -2.213058471679687),
      new GLatLng(42.42979204089282, -2.2412109375),
      new GLatLng(42.43891406906795, -2.238121032714843),
      new GLatLng(42.44980808481614, -2.26593017578125),
      new GLatLng(42.4449946835423, -2.274169921875),
      new GLatLng(42.46652544694582, -2.288589477539062),
      new GLatLng(42.46804498583046, -2.297859191894531),
      new GLatLng(42.45766073497765, -2.297515869140625),
      new GLatLng(42.46855149059522, -2.330131530761718),
      new GLatLng(42.4634862585205, -2.338027954101562),
      new GLatLng(42.45411449876218, -2.333908081054687),
      new GLatLng(42.45208798790661, -2.34832763671875),
      new GLatLng(42.465512400530805, -2.352790832519531),
      new GLatLng(42.467031964005734, -2.358627319335937),
      new GLatLng(42.461966608980134, -2.3675537109375),
      new GLatLng(42.468804741440685, -2.373733520507812),
      new GLatLng(42.47310984904908, -2.402915954589843),
      new GLatLng(42.490707062010614, -2.415790557861328),
      new GLatLng(42.4893146571508, -2.438793182373047),
      new GLatLng(42.49665607907153, -2.454414367675781),
      new GLatLng(42.487289285659095, -2.478790283203125),
      new GLatLng(42.49171970062172, -2.517414093017578),
      new GLatLng(42.51665075361142, -2.506942749023437),
      new GLatLng(42.51804254979258, -2.514667510986328),
      new GLatLng(42.491593121691935, -2.538356781005859),
      new GLatLng(42.484504292781125, -2.52960205078125),
      new GLatLng(42.493618353828474, -2.56805419921875),
      new GLatLng(42.48323834594138, -2.577838897705078),
      new GLatLng(42.48235216791193, -2.592258453369140),
      new GLatLng(42.47197029055813, -2.59002685546875),
      new GLatLng(42.483871322563296, -2.601871490478515),
      new GLatLng(42.491593121691935, -2.592601776123047),
      new GLatLng(42.502984199407415, -2.605648040771484),
      new GLatLng(42.496149801777875, -2.610969543457031),
      new GLatLng(42.49589666159403, -2.628822326660156),
      new GLatLng(42.483618132683006, -2.648906707763672),
      new GLatLng(42.50931167929992, -2.66693115234375),
      new GLatLng(42.50956476517421, -2.677230834960937),
      new GLatLng(42.52626616716249, -2.677230834960937),
      new GLatLng(42.51690380976825, -2.706413269042968),
      new GLatLng(42.595049077851826, -2.682380676269531),
      new GLatLng(42.60465241823049, -2.717742919921875),
      new GLatLng(42.62233890747704, -2.763748168945312),
      new GLatLng(42.60465241823049, -2.77679443359375),
      new GLatLng(42.5925216370156, -2.773704528808593),
      new GLatLng(42.580388494236956, -2.779197692871093),
      new GLatLng(42.57356256365908, -2.799110412597656),
      new GLatLng(42.564965884528505, -2.802886962890625),
      new GLatLng(42.568758683136274, -2.815933227539062),
      new GLatLng(42.55459772508892, -2.822113037109375),
      new GLatLng(42.5816524734597, -2.841339111328125),
      new GLatLng(42.6006524734597, -2.820224761962890),
      new GLatLng(42.613243626050405, -2.821426391601562),
      new GLatLng(42.612232957220876, -2.844085693359375),
      new GLatLng(42.638126171295504, -2.858676910400390),
      new GLatLng(42.62688605000682, -2.898330688476562),
      new GLatLng(42.61930729461038, -2.907943725585937),
      new GLatLng(42.622844161937174, -2.924423217773437),
      new GLatLng(42.64153569439977, -2.971115112304687),
      new GLatLng(42.63648448242716, -2.982101440429687),
      new GLatLng(42.64305097803165, -3.00750732421875),
      new GLatLng(42.63193804106213, -3.01849365234375),
      new GLatLng(42.64089642304886, -3.084197044372558));
    var polyline = new GPolyline(gLatLngs,"#563157",5,0.9);
    map.addOverlay(polyline);
  }
}

    