/*--------------------------------------------------------------------
JAVASCRIPT - google maps, SPLASH

Version: 	2.0 - 2008
author: 	Burocratik (alexandre gomes)
email: 		alex@burocratik.com
website: 	http://www.burocratik.com
-----------------------------------------------------------------------*/

/* =GOOGLE MAPS
-----------------------------------------------------------------------*/
function iniciarMapa() {
	if (GBrowserIsCompatible()) {
   	var map = new GMap2(document.getElementById("flashContent")); //usar div. Da Erro em IE se usar um p ou outro elemento
    	map.addControl(new GSmallMapControl());
		map.addControl(new GMenuMapTypeControl(true));
    	map.setCenter(new GLatLng(40.30300,-8.165819), 16);		
 		map.setMapType(G_HYBRID_MAP);
		map.addMapType(G_PHYSICAL_MAP);

// Criar marker icon
		var icon = new GIcon();
		icon.image = "imgs/gmap-icon.png";
		icon.shadow = "imgs/gmap-icon-sombra.png";
		icon.iconSize = new GSize(71, 68); //Pixel size(width,height)
		icon.shadowSize = new GSize(104, 70); //Pixel size(width,height)
		icon.iconAnchor = new GPoint(30, 68); //Top left corner of the icon image at which this icon is anchored to the map.
	  	icon.infoWindowAnchor = new GPoint(35, 5); //Pixel coordinate relative to the top left corner of the icon image at which the INFO WINDOW is anchored to this icon (tipo iconAnchor). APAGAR se nao usar Info Windows

// Funcao Criar Marker com Info Windows
		function fMarker(point,icon,html){
			var marker = new GMarker(point,icon);
			GEvent.addListener(marker, "click", function() {
	   		 marker.openInfoWindowHtml(html, {maxWidth:250}); //Tamanho minimo e' de 250px
  			});	
 			return marker;
		}

///////LOCALIZACAO
		var point = new GLatLng(40.30252,-8.165819);
		var html = "<h4>Fundação Mário de Cunha Brito</h4><p>Largo Engº Maurício Vieira de Brito<br>Apartado 4<br>3360-908 São Pedro de Alva<br>Portugal<br><br></p><p><strong>GPS:</strong> +40&deg; 18' 9.07'', -8&deg; 9' 56.95''</p><p>&nbsp;</p>";
		var marker = fMarker(point,icon,html);
		map.addOverlay(marker);
	}
}

/* =window.onunload
-----------------------------------------------------------------------*/
window.onunload = GUnload;


/* =Preparar Eventos
-----------------------------------------------------------------------*/
addLoadEvent(iniciarMapa);

