// Documento JavaScript que incluye las funciones necesarias para declarar las
// inicializaciones del mapa de Google 
  
// La versión en español
function load() {

    function crearMarcador(point, icon, text) {
        var marker = new GMarker(point, icon);
        
        GEvent.addListener(marker, "click", function() {
            marker.openInfoWindowHtml(text);
        });
        return marker;
    }    
        
    if (GBrowserIsCompatible()) {
        var point = new GLatLng(43.537660, -5.636243);
        
        var html_fidma = '<div style="text-align:center"><p><strong><abbr title="Feria Internacional de Muestras de Asturias" xml:lang="es">FIDMA</abbr></strong><br />Palacio de Congresos</p><address class="adr">  <span class="street-address" xml:lang="es"><abbr title="Avenida">Avda.</abbr>Doctor Fleming, 481</span><br /><span class="locality">Gijón</span> (<span class="postal-code">33203</span>), <span class="region">Asturias</span><br />  <span class="country-name">España</span></address></div>';
        
        var map = new GMap2(document.getElementById("mapa-google"));
        
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        map.addControl(new GScaleControl());
        map.setCenter( new GLatLng(43.54, -5.637) , 14);
        map.setMapType(G_SATELLITE_MAP);
        
        var icon = new GIcon();
        icon.iconSize = new GSize(37,40);
        icon.iconAnchor = new GPoint(13, 40);
        icon.infoWindowAnchor = new GPoint(13, 40);        
        icon.image = "http://www.fundamentosweb.org/2008/img/bocadillo_wefo.png";
        icon.shadow = "http://www.fundamentosweb.org/2006/img/bocadillo_sombra.png";
        map.addOverlay(crearMarcador(point, icon, html_fidma));
        
        // Introduce el punto de la espicha
        var pointEspicha = new GLatLng(43.54209355, -5.644354820);
        var html_espicha = '<div style="text-align:center"><p><strong>Espicha en el Restaurante Bellavista</strong><br /><address><abbr title="Avenida">Avda.</abbr> José García Bernardo, 256</address></div>';
        
        var iconEspicha = new GIcon();
        iconEspicha.iconSize = new GSize(37,40);
        iconEspicha.iconAnchor = new GPoint(13, 40);
        iconEspicha.infoWindowAnchor = new GPoint(13, 40);        
        iconEspicha.image = "http://www.fundamentosweb.org/2008/img/bocadillo_restaurante.png";
        iconEspicha.shadow = "http://www.fundamentosweb.org/2006/img/bocadillo_sombra.png";
        map.addOverlay(crearMarcador(pointEspicha, iconEspicha, html_espicha));
        
        map.openInfoWindowHtml(point, html_fidma);
    }             

}

// En inglés
function load_en() {

    function crearMarcador(point, icon, text) {
        var marker = new GMarker(point, icon);
        
        GEvent.addListener(marker, "click", function() {
            marker.openInfoWindowHtml(text);
        });
        return marker;
    }    
        
    if (GBrowserIsCompatible()) {
        var point = new GLatLng(43.537660, -5.636243);
        
        var html_fidma = '<div style="text-align:center"><p><strong><abbr title="Feria Internacional de Muestras de Asturias" xml:lang="es">FIDMA</abbr></strong><br />Palacio de Congresos</p><address class="adr"><span class="street-address" xml:lang="es"><abbr title="Avenida" xml:lang="es">Avda.</abbr> Doctor Fleming, 481</span><br /><span class="locality">Gijón</span> (<span class="postal-code">33203</span>), <span class="region">Asturias</span><br /><span class="country-name">Spain</span></address></div>';
        
        var map = new GMap2(document.getElementById("mapa-google"));
        
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        map.addControl(new GScaleControl());
        map.setCenter( new GLatLng(43.54, -5.637) , 14);
        map.setMapType(G_SATELLITE_MAP);
        
        var icon = new GIcon();
        icon.iconSize = new GSize(37,40);
        icon.iconAnchor = new GPoint(13, 40);
        icon.infoWindowAnchor = new GPoint(13, 40);        
        icon.image = "http://www.fundamentosweb.org/2008/img/bocadillo_wefo.png";
        icon.shadow = "http://www.fundamentosweb.org/2006/img/bocadillo_sombra.png";
        
        map.addOverlay(crearMarcador(point, icon, html_fidma));
        
                // Introduce el punto de la espicha
        var pointEspicha = new GLatLng(43.54209355, -5.644354820);
        var html_espicha = '<div style="text-align:center"><p><strong>Espicha at Restaurante Bellavista</strong><br /><address><abbr title="Avenida">Avda.</abbr> José García Bernardo, 256</address></div>';
        
        var iconEspicha = new GIcon();
        iconEspicha.iconSize = new GSize(37,40);
        iconEspicha.iconAnchor = new GPoint(13, 40);
        iconEspicha.infoWindowAnchor = new GPoint(13, 40);        
        iconEspicha.image = "http://www.fundamentosweb.org/2008/img/bocadillo_restaurante.png";
        iconEspicha.shadow = "http://www.fundamentosweb.org/2006/img/bocadillo_sombra.png";
        map.addOverlay(crearMarcador(pointEspicha, iconEspicha, html_espicha));
        
        map.openInfoWindowHtml(point, html_fidma);
    }             
}
