// JavaScript Document

function mostrarSubmenu(submenu){
	document.getElementById(submenu).style.display="block";
}

function ocultarSubmenu(submenu){
	document.getElementById(submenu).style.display="none";
}

function validarFormulario(){

	if(document.getElementById('nombre').value !='')
		if(document.getElementById('comentario').value !=''){
			document.getElementById('submit_comment').value="formOK";
			document.getElementById('formComentario').submit();
			}
		else
				alert("El comentario no puede estar vacio.");
	else
		alert("Debe indicar un nombre.");
		
	return false;
}

    function initialize(origen, destino) {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map_canvas"));
       // map.setCenter(new GLatLng(37.4419, -122.1419), 13);
//		map.addControl(new GSmallMapControl());
		map.setUIToDefault();
        geocoder = new GClientGeocoder();
		if (origen!=""){
			map.setCenter(new GLatLng(40.111689,22.697754,7.173256,19.775391), 5);
			//directionsPanel = document.getElementById("route");

		  directions = new GDirections(map, directionsPanel);
	    	 directions.load("from: "+origen+" to: "+destino);
		}else{
			showAddress(destino);
		}
      }
    }

    function showAddress(address) {
      if (geocoder) {
	        geocoder.getLatLng(
          address,
          function(point) {
            if (point) {
              map.setCenter(point, 5);
              var marker = new GMarker(point);
              map.addOverlay(marker);
              marker.openInfoWindowHtml(address);
            }
          }
        );
      }
    }
	

