function enviarform(pagina,busqueda){document.enviar.action=pagina;document.enviar.busqueda.value=busqueda;document.enviar.submit();}
function createMarker(input,numero){var marker=new GMarker(input.point,iconm);imagen="images/museum_icon.png";GEvent.addListener(marker,"click",function(){initialize(input.point.lat(),input.point.lng(),input.idwifi);marker.openInfoWindowHtml('<div id="globo"><img src="'+imagen+'" style="margin-right:5px;float:left;width:30px"/><h3 style="padding:8px">'+input.nombre+'</h3><br />'+input.ciudad+'</strong><br /><a href="museo-'+input.enlace+'-ID'+input.idwifi+'.htm">Ver más detalles</a></div>');});return marker;}
function clicked(overlay,latlng){if(latlng){geocoder.getLocations(latlng,function(addresses){if(addresses.Status.code!=200){alert("No conocemos esta dirección, sin embargo puedes introducirla "+latlng.toUrlValue());}
else{address=addresses.Placemark[0];var myHtml=address.address;document.getElementById('info').innerHTML=myHtml;return myHtml;}});}}
function clicked2(overlay,latlng){if(latlng){geocoder.getLocations(latlng,function(addresses){if(addresses.Status.code!=200){alert("No conocemos esta dirección"+latlng.toUrlValue());}
else{address=addresses.Placemark[0];var myHtml=address.address;direccionarray=myHtml.split(",");if(direccionarray.length==5)
{document.f.calle.value=direccionarray[0];document.f.numero.value=direccionarray[1];document.f.cp.value=direccionarray[2];document.f.ciudad.value=direccionarray[3];document.f.pais.value=direccionarray[4];html='Calle: <strong>'+direccionarray[0]+'</strong><br />';html+='Nº: <strong>'+direccionarray[1]+'</strong><br />';html+='C.P.: <strong>'+direccionarray[2]+'</strong><br />';html+='Ciudad: <strong>'+direccionarray[3]+'</strong><br />';html+='País: <strong>'+direccionarray[4]+'</strong><br />';}
if(direccionarray.length==4)
{document.f.calle.value=direccionarray[0];document.f.numero.value='';document.f.cp.value=direccionarray[1];document.f.ciudad.value=direccionarray[2];document.f.pais.value=direccionarray[3];html='Calle: <strong>'+direccionarray[0]+'</strong><br />';html+='C.P.: <strong>'+direccionarray[1]+'</strong><br />';html+='Ciudad: <strong>'+direccionarray[2]+'</strong><br />';html+='País: <strong>'+direccionarray[3]+'</strong><br />';}
if(direccionarray.length==3)
{document.f.calle.value='';document.f.numero.value='';document.f.cp.value=direccionarray[0];document.f.ciudad.value=direccionarray[1];document.f.pais.value=direccionarray[2];html='C.P.: <strong>'+direccionarray[0]+'</strong><br />';html+='Ciudad: <strong>'+direccionarray[1]+'</strong><br />';html+='País: <strong>'+direccionarray[2]+'</strong><br />';}
marker.openInfoWindowHtml('<h2>Dirección encontrada</h2>'+html+'<br />');}});}}
function cabiardireccion(dir)
{document.f.direccion.value=dir;}
function localizar2(direccion){showAddress2(direccion);}
function showAddress2(address){if(geocoder){geocoder.getLatLng(address,function(point){if(!point){alert("Lo sentimos, pero no hemos encontrado esta dirección:\n"+address+".\nIntenta ser un poco más preciso. Gracias");}else{map.setCenter(point,17);marker.setLatLng(point);document.f.lat.value=marker.getPoint().lat();document.f.lng.value=marker.getPoint().lng();clicked2(map,point)}});}}
function votar2(tipo,id)
{var url='votar2.php?tipo='+tipo+'&id='+id;xmlhttp.open("GET",url,true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){data=xmlhttp.responseText;alert('Gracias por votar!!!\nHemos tomado nota.');}}
xmlhttp.setRequestHeader('Accept','message/x-jl-formresult');xmlhttp.send(null);return false;}
function enviarcomentario(){var msgerror='';if(document.forms['contacto'].nombre.value=='')
msgerror='* Nombre o apodo\n';if(document.forms['contacto'].comentario.value=='')
msgerror+='* Tu comentario\n';if(document.forms['contacto'].email.value=='')
msgerror+='* Email\n';else
if(validarEmail(document.forms['contacto'].email.value)==false)
msgerror=msgerror+'* El Email parece incorrecto\n';if(msgerror!='')
{alert('Los siguientes campos son obligatorios:\n\n'+msgerror);return false;}
else
{document.forms['contacto'].action='enviaropinion.php';return true;}}
function localizarx(direccion){direccion=document.buscador.buscar.value;showAddressx(direccion);return false;}
function showAddressx(address){if(geocoder){geocoder.getLatLng(address,function(point){if(!point){alert("Lo sentimos, pero no hemos encontrado esta dirección:\n"+address+".\nIntenta ser un poco más preciso. Gracias");}else{map.setCenter(point,13);mostrarnegocios(0);}});}}
function buscarprovincia(destino){if(destino!='')
location.href=destino;}
function buscarcampos(){document.getElementById('resultadosxx').innerHTML='<center><h3>Buscando abogados</h3><img src="./images/loading.gif"></center>';var texto=document.getElementById('buscar').value;if(texto.length>3)
{var url='buscar.php?texto='+escape(texto);xmlhttp.open("GET",url,true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){data=xmlhttp.responseText;document.getElementById('resultadosxx').innerHTML=data;}}
xmlhttp.setRequestHeader('Accept','message/x-jl-formresult');xmlhttp.send(null);return false;}
else{alert('Debe escribir al menos 4 letras en su búsqueda');return false;}}
function trim(stringToTrim){return stringToTrim.replace(/^\s+|\s+$/g,"");}
function ltrim(stringToTrim){return stringToTrim.replace(/^\s+/,"");}
function rtrim(stringToTrim){return stringToTrim.replace(/\s+$/,"");}
function validarEmail(valor){if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){return(true)}else{return(false);}}
function comprobar(){var msgerror='';var telefono=trim(document.forms['contacto'].telefono.value);if(document.forms['contacto'].nombre.value=='')
msgerror='* Nombre completo\n';if(document.forms['contacto'].telefono=='')
{msgerror+='* Teléfono\n';}
if(document.forms['contacto'].email.value=='')
msgerror+='* Email\n';else
{if(validarEmail(document.forms['contacto'].email.value)==false)
msgerror+=msgerror+'* El Email parece incorrecto\n';}
if(document.forms['contacto'].mensaje.value=='')
msgerror+=msgerror+'* Debe escribir un mensaje\n';if(msgerror==''){if((document.forms['contacto'].telefono.length)<9)
msgerror+='* El teléfono ha de tener 9 cifras como mínimo\n';document.forms['contacto'].telefono.focus();}
if(msgerror!=''){alert('Los siguientes campos son obligatorios:\n\n'+msgerror);return false;}
else{document.forms['contacto'].action='envcont.php';document.forms['contacto'].submit();return false;}}
function buscarnotarios(){
	document.getElementById('resultadosxx').innerHTML='<center><h3>Buscando notarios</h3><img src="./images/loading.gif"></center>';
	var texto=document.getElementById('buscar').value;
	if(texto.length>3)
	{
		var url='buscarnotarios.php?texto='+escape(texto);xmlhttp.open("GET",url,true);
		xmlhttp.onreadystatechange=function(){
			if(xmlhttp.readyState==4){
				data=xmlhttp.responseText;document.getElementById('resultadosxx').innerHTML=data;}}
				xmlhttp.setRequestHeader('Accept','message/x-jl-formresult');
				xmlhttp.send(null);
				return false;
			}else{
				alert('Debe escribir al menos 4 letras en su búsqueda');
				return false;
			}
}
function buscarregistros(){
	document.getElementById('resultadosxx').innerHTML='<center><h3>Buscando registros</h3><img src="./images/loading.gif"></center>';
	var texto=document.getElementById('buscar').value;
	if(texto.length>3)
	{
		var url='buscarregistros.php?texto='+escape(texto);xmlhttp.open("GET",url,true);
		xmlhttp.onreadystatechange=function(){
			if(xmlhttp.readyState==4){
				data=xmlhttp.responseText;document.getElementById('resultadosxx').innerHTML=data;}}
				xmlhttp.setRequestHeader('Accept','message/x-jl-formresult');
				xmlhttp.send(null);
				return false;
			}else{
				alert('Debe escribir al menos 4 letras en su búsqueda');
				return false;
			}
}
function buscarprocurador(){
	document.getElementById('resultadosxx').innerHTML='<center><h3>Buscando procuradores</h3><img src="./images/loading.gif"></center>';
	var texto=document.getElementById('buscar').value;
	if(texto.length>3)
	{
		var url='buscarprocurador.php?texto='+escape(texto);xmlhttp.open("GET",url,true);
		xmlhttp.onreadystatechange=function(){
			if(xmlhttp.readyState==4){
				data=xmlhttp.responseText;document.getElementById('resultadosxx').innerHTML=data;}}
				xmlhttp.setRequestHeader('Accept','message/x-jl-formresult');
				xmlhttp.send(null);
				return false;
			}else{
				alert('Debe escribir al menos 4 letras en su búsqueda');
				return false;
			}
}