
	function getwindowheight() { var windowHeight = 0; if (typeof(window.innerHeight) == 'number') { windowHeight = window.innerHeight; } else { if (document.documentElement && document.documentElement.clientHeight) { windowHeight = document.documentElement.clientHeight; } else { if (document.body && document.body.clientHeight) { windowHeight = document.body.clientHeight; } } } return windowHeight; }; 
	function resizeApp() {	
		var offsetTop = 0;
		var mapElem = document.getElementById("map_canvas");
		for (var elem = mapElem; elem; elem = elem.offsetParent) {
			//alert (elem.nodeName+"-"+elem.offsetTop);
			offsetTop += elem.offsetTop;
			}

		var dH = getwindowheight() - offsetTop - 20;
		if (!dH || dH<550) dH=550;
		mapElem.style.height = dH + " px";
	};
    function initializeMap() {	
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map_canvas"));
        map.addControl(new GLargeMapControl());
		map.addControl(new GMapTypeControl());
		map.addControl(new GOverviewMapControl());
		var center=	new GLatLng(42.228278,-8.710774);
		map.setCenter(center, 13);
		map.enableScrollWheelZoom();
		map.enableDoubleClickZoom();
		map.enableContinuousZoom();
		var icon = new GIcon();
		icon.image = "themes/IP/images/mapa_ico.png";
		//icon.shadow = "images/icoalfaroshadow.png";
		icon.iconSize = new GSize(79, 88);
		//icon.shadowSize = new GSize(58, 57);
		icon.iconAnchor = new GPoint(6, 43);

        pointCentral = new GLatLng(42.228278,-8.710774);		
		var marker = new GMarker(pointCentral, icon);
		map.addOverlay(marker);
		hcard = '<div class="vcard"> <span class="adr">'
             + '<span class="fn org" title="IP publicidad & multimedia"><strong>IP publicidad & web</strong><br />Ideaspropias Publicidad S.L.<br/></span>'
			 + '<a href="http://www.ideaspropias.com" class="fn url">ideaspropias.com</a><br />'
             + '<span class="street-address">San Roque 57, Bajo</span><br />'
			 + '<span class="postal-code">94043</span> '
             + '<span class="locality">Vigo</span>, ' 
             + '<abbr class="region" title="Pontevedra">PO</abbr><br />'
			 + '<span class="tel">+34 986 493 621</span></span>'            
             + '</div>';
		GEvent.addListener(marker, "click", function() {
			map.setCenter(pointCentral);
			map.zoomIn();
			map.openInfoWindowHtml(map.getCenter(), hcard);
			});
        };
    };
	
	$(window).load(function(){
	  //resizeApp();
	  initializeMap();
	});
	$(window).resize(function(){
  		//resizeApp();
	});
	$(window).unload( function () {
		GUnload();
	});
	
