function CargarFoto(img, titulo, ancho, alto){ 
derecha=(screen.width-ancho)/2; 
arriba=(screen.height-alto)/2; 
string="toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width="+ancho+",height="+alto+",left="+derecha+",top="+arriba+"";
fin=window.open(img,titulo,string); 
} 

function Reset()
{
     document.formulario.nombre.value="";	
	document.formulario.telefono.value="";
     document.formulario.apellidos.value="";
     document.formulario.coment.value="";
	 return true;
}
function validadatos()
{

if ((document.formulario.nombre.value.length==0) ||  (document.formulario.email.value.length==0) || (document.formulario.coment.value.length==0))
{
	alert("Debe introducir todos los datos solicitados para poder continuar");
	return false;
}

// validamos la direccion de correo


else
{
	ok1=CompruebaCorreo(document.formulario.email.value);
	return ok1;
   }

   //el formulario se envia

}

function validadatos2()
{

if ((document.formulario.nombre.value.length==0) || (document.formulario.email.value.length==0) || (document.formulario.coment.value.length==0) || (document.formulario.telefono.value.length==0))
{
	alert("Debe introducir todos los datos solicitados para poder continuar");
	return false;
}

// validamos la direccion de correo


else
{
	ok1=CompruebaCorreo(document.formulario.email.value);
	return ok1;
   }

   //el formulario se envia

}

function CompruebaCorreo(vmail)
{
	var ok=2;
	var fin=vmail.length;
 	for (var i=0;i<fin;i++)
	{
 		var sByte=vmail.substring(i,i+1);
 		if (sByte=="@" || sByte==".")
		 {
 			ok=ok-1;
		  }
 	}
 
	 if (ok>0)
	{
		alert("Debe introducir la direccion de correo correctamente");
		return false;

	}
	else
		return true;

 }

function get_map(direccion) {
	var geocoder;
	var map;
	geocoder = new google.maps.Geocoder();
	var latlng = new google.maps.LatLng(40.566, -3.506);
	var myOptions = {
		zoom: 17,
		center: latlng,
		mapTypeId: google.maps.MapTypeId.HYBRID
	};
	map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
	if (geocoder) {
		geocoder.geocode( { 'address': direccion }, function(results, status) {
		if (status == google.maps.GeocoderStatus.OK) {
			map.setCenter(results[0].geometry.location);
			var marker = new google.maps.Marker({
			map: map, 
			position: results[0].geometry.location
		  });
		} else {
			alert("Geocode was not successful for the following reason: " + status);
		}
		});
	}
}





