
function getHTTPObject(){var xmlhttp;if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){try{xmlhttp=new XMLHttpRequest();}catch(e){xmlhttp=false;}}
return xmlhttp;}
var http=getHTTPObject();function paginacion(pagina){document.getElementById("formularioPaginacion").numPagina.value=pagina
document.getElementById("formularioPaginacion").submit();}

function zoomText(tipo){
	//inicializaciones
	obj=document.getElementById("Lectura");
	if (obj.style.fontSize==""){
		obj.style.fontSize="100%";
	}
	actual=parseInt(obj.style.fontSize);
	incremento=20;
	
	//operacion
	if(tipo=="normal"){
		obj.style.fontSize="100%"
	}
	if(tipo=="aumentar"){
		valor=actual+incremento;
		obj.style.fontSize=valor+"%"
	}
	if(tipo=="disminuir"){
		valor=actual-incremento;
		obj.style.fontSize=valor+"%"
	}
}

function validarEmail(valor){return(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor));}
function compruebaFecha(dia,mes,anyo){var error;if((dia>30)&&((mes==2)||(mes==4)||(mes==6)||(mes==9)||(mes==11))){return false;}
if((dia>29)&&(mes==2)){return false;}
var resto=parseInt(anyo)%4;if(resto!=0){if((dia>28)&&(mes==2)){return false;}}
return true;}
function cerrarAviso(){document.getElementById("mensajeError").innerHTML="";document.getElementById("capaError").style.display='none';}
function handleHttpResponseContacto(){if(http.readyState==4){alert(http.responseText);document.getElementById("formularioContacto").reset();}}
function openWindow(theURL,winName,features){window.open(theURL,winName,features);return}
function capaPosition(layer,position){element=document.getElementById(layer);screenCenterX=document.body.clientWidth/2;element.style.left=screenCenterX+position;element.style.display='inline';}
function openCenteredWindow(URL,WIDTH,HEIGHT){day=new Date();id=day.getTime();var width=WIDTH;var height=HEIGHT;var left=parseInt((screen.availWidth/2)-(width/2));var top=parseInt((screen.availHeight/2)-(height/2));var windowFeatures="width="+width+",height="+height+",status='no',resizable='no',scrollbars='no',left="+left+",top="+top+",screenX="+left+",screenY="+top;eval("page"+id+"  = window.open(URL, '"+id+"', windowFeatures);");}
function handleHttpResponse2(){if(http.readyState==4){capaModelosCU.innerHTML=http.responseText;}}
function buscarMotorpoint(){if(document.getElementById("busqueda").textobusqueda.value.length<1){alert("Introduzca el texto de búsqueda");}
else{document.getElementById("busqueda").submit()}}
function handleHttpResponseBusc(){if(http.readyState==4){window.open(http.responseText);}}
function validarContacto(){var texto;texto="";var cadenaEnvio;cadenaEnvio="";if(document.getElementById("formularioContacto").nombre.value==""){texto+=" * Debe indicar su nombre.<br>";}else{cadenaEnvio="nombre="+document.getElementById("formularioContacto").nombre.value;}
if(document.getElementById("formularioContacto").email.value==""){texto+=" * Debe indicar su e-mail.<br>";}
if(document.getElementById("formularioContacto").email.value!=""){if(!validarEmail(document.getElementById("formularioContacto").email.value)){texto+=" * Formato de E-mail incorrecto.<br>";}else{cadenaEnvio+="&email="+document.getElementById("formularioContacto").email.value;}}
if(document.getElementById("formularioContacto").comentarios.value==""){texto+=" * Debe incluir el motivo de su consulta.<br>";}else{cadenaEnvio+="&comentarios="+document.getElementById("formularioContacto").comentarios.value;}
if(document.getElementById("formularioContacto").direccion.value!=""){cadenaEnvio+="&direccion="+document.getElementById("formularioContacto").direccion.value;}
if(document.getElementById("formularioContacto").poblacion.value!=""){cadenaEnvio+="&poblacion="+document.getElementById("formularioContacto").poblacion.value;}
if(document.getElementById("formularioContacto").provincia.value!=""){cadenaEnvio+="&provincia="+document.getElementById("formularioContacto").provincia.value;}
if(document.getElementById("formularioContacto").telefono.value!=""){cadenaEnvio+="&telefono="+document.getElementById("formularioContacto").telefono.value;}
if(document.getElementById("formularioContacto").movil.value!=""){cadenaEnvio+="&movil="+document.getElementById("formularioContacto").movil.value;}
if(document.getElementById("formularioContacto").cpostal.value!=""){cadenaEnvio+="&cpostal="+document.getElementById("formularioContacto").cpostal.value;}
if(document.getElementById("formularioContacto").fax.value!=""){cadenaEnvio+="&fax="+document.getElementById("formularioContacto").fax.value;}
cadenaEnvio+="&pais="+document.getElementById("formularioContacto").pais.options[document.getElementById("formularioContacto").pais.selectedIndex].text
if(texto!=""){document.getElementById("mensajeError").innerHTML=texto;document.getElementById("capaError").style.display='block';}else{document.getElementById("mensaje-respuesta").innerHTML="";document.getElementById("mensajeError").innerHTML="";document.getElementById("capaError").style.display='none';http.open("GET","/includes/enviocontacto.php?"+cadenaEnvio,true);http.onreadystatechange=handleHttpResponseContacto2;http.send(null);}}
function validaContacto2009(){var texto;texto="";var cadenaEnvio;cadenaEnvio="";if(document.getElementById("formularioContacto").nombre.value==""){texto+=" * Debe indicar su nombre.<br>";}else{cadenaEnvio="nombre="+document.getElementById("formularioContacto").nombre.value;}
if(document.getElementById("formularioContacto").email.value==""){texto+=" * Debe indicar su e-mail.<br>";}
if(document.getElementById("formularioContacto").email.value!=""){if(!validarEmail(document.getElementById("formularioContacto").email.value)){texto+=" * Formato de E-mail incorrecto.<br>";}else{cadenaEnvio+="&email="+document.getElementById("formularioContacto").email.value;}}
if(document.getElementById("formularioContacto").comentarios.value==""){texto+=" * Debe incluir el motivo de su consulta.<br>";}else{cadenaEnvio+="&comentarios="+document.getElementById("formularioContacto").comentarios.value;}
if(document.getElementById("formularioContacto").direccion.value!=""){cadenaEnvio+="&direccion="+document.getElementById("formularioContacto").direccion.value;}
if(document.getElementById("formularioContacto").poblacion.value!=""){cadenaEnvio+="&poblacion="+document.getElementById("formularioContacto").poblacion.value;}
if(document.getElementById("formularioContacto").provincia.value!=""){cadenaEnvio+="&provincia="+document.getElementById("formularioContacto").provincia.value;}
if(document.getElementById("formularioContacto").telefono.value!=""){cadenaEnvio+="&telefono="+document.getElementById("formularioContacto").telefono.value;}
if(document.getElementById("formularioContacto").movil.value!=""){cadenaEnvio+="&movil="+document.getElementById("formularioContacto").movil.value;}
if(document.getElementById("formularioContacto").cpostal.value!=""){cadenaEnvio+="&cpostal="+document.getElementById("formularioContacto").cpostal.value;}
if(document.getElementById("formularioContacto").fax.value!=""){cadenaEnvio+="&fax="+document.getElementById("formularioContacto").fax.value;}
cadenaEnvio+="&pais="+document.getElementById("formularioContacto").pais.options[document.getElementById("formularioContacto").pais.selectedIndex].text
if(texto!=""){document.getElementById("mensajeError").innerHTML=texto;document.getElementById("capaError").style.display='block';}else{document.getElementById("mensaje-respuesta").innerHTML="";document.getElementById("mensajeError").innerHTML="";document.getElementById("capaError").style.display='none';http.open("GET","/includes-moraleja/enviocontacto.php?"+cadenaEnvio,true);http.onreadystatechange=handleHttpResponseContacto2;http.send(null);}}
function handleHttpResponseContacto2(){if(http.readyState==4){document.getElementById("mensaje-respuesta").innerHTML=http.responseText;document.getElementById("formularioContacto").reset();}}
function validarenviar(){var texto;texto="";var cadenaEnvio;cadenaEnvio="";if(document.getElementById("formularioContacto").email_el.value==""){texto+=" * Debe indicar el e-mail destino.<br>";}
if(document.getElementById("formularioContacto").email_el.value!=""){if(!validarEmail(document.getElementById("formularioContacto").email_el.value)){texto+=" * Formato de E-mail destino es incorrecto.<br>";}else{cadenaEnvio+="&email_el="+document.getElementById("formularioContacto").email_el.value;}}
if(texto!=""){document.getElementById("mensajeError").innerHTML=texto;document.getElementById("capaError").style.display='block';}else{cadenaEnvio=cadenaEnvio+"&idnoticias="+document.getElementById("formularioContacto").idnoticias.value;document.getElementById("mensaje-respuesta").innerHTML="";document.getElementById("mensajeError").innerHTML="";document.getElementById("capaError").style.display='none';http.open("GET","/includes/envionoticorreo.php?"+cadenaEnvio,true);http.onreadystatechange=handleHttpResponseEnvio2;http.send(null);}}
function handleHttpResponseEnvio2(){if(http.readyState==4){document.getElementById("mensaje-respuesta").innerHTML=http.responseText;document.getElementById("formularioContacto").reset();}}
function validaComentario(){var texto;texto="";var cadenaEnvio;cadenaEnvio="";if(document.getElementById("frmcomentario").autorComentario.value==""){texto+=" * Debe indicar su nombre.<br>";}else{cadenaEnvio="nombre="+document.getElementById("frmcomentario").autorComentario.value;}
if(document.getElementById("frmcomentario").emailComentario.value==""){texto+=" * Debe indicar su e-mail.<br>";}
if(document.getElementById("frmcomentario").emailComentario.value!=""){if(!validarEmail(document.getElementById("frmcomentario").emailComentario.value)){texto+=" * Formato de E-mail incorrecto.<br>";}else{cadenaEnvio+="&email="+document.getElementById("frmcomentario").emailComentario.value;}}
if(document.getElementById("frmcomentario").opinionComentario.value==""){texto+=" * Debe incluir el motivo de su consulta.<br>";}else{cadenaEnvio+="&comentarios="+document.getElementById("frmcomentario").opinionComentario.value;}
if(texto!=""){document.getElementById("mensajeError").innerHTML=texto;document.getElementById("capaError").style.display='block';}else{cadenaEnvio+="&pknotid="+document.getElementById("frmcomentario").pknotid.value;document.getElementById("mensaje-respuesta").innerHTML="";document.getElementById("mensajeError").innerHTML="";document.getElementById("capaError").style.display='none';http.open("GET","/includes-moraleja/ingresa-comentario.php?"+cadenaEnvio,true);http.onreadystatechange=handleHttpResponseComentario;http.send(null);}}
function handleHttpResponseComentario(){if(http.readyState==4){document.getElementById("mensaje-respuesta").innerHTML=http.responseText;document.getElementById("frmcomentario").reset();}}