<!--------------- IMAGENES DE SUSTITUCION ------------------------->
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->

function target_top(targ){ //v3.0
eval(targ+".location='/'");
}

<!------------------------------------------------------------------->

function validar_form(elform) 
{
	if (elform.buscar.value==''){elform.buscar.focus(); alert ('Introduzca algún término de búsqueda. Gracias.'); return(false);}
	else {return(true);}
	
}

function validar_form2(elform) 
{
	if (elform.q.value==''){elform.q.focus(); alert ('Introduzca algún término de búsqueda. Gracias.'); return(false);}
	else {return(true);}
	
}

function copyright_foto (URL, alto, ancho){ 
window.open(URL,"Ventana","top=150, left=350, width="+ancho+", height="+alto+", scrollbars=no, menubar=no, location=no, resizable=no") 
}

function info (URL){ 
window.open(URL,"Ventana","top=180, left=300, width=390, height=334, scrollbars=yes, menubar=no, location=no, resizable=no") 
}


function info_360 (URL){ 
window.open(URL,"Ventana","top=150, left=140, width=400, height=270, scrollbars=no, menubar=no, location=no, resizable=no") 
}


function inscribir (URL){ 
window.open(URL,"Ventana","top=150, left=250, width=525, height=420, scrollbars=no, menubar=no, location=no, resizable=no") 
}

function anuncio (URL){ 
window.open(URL,"Ventana","top=150, left=250, width=525, height=420, scrollbars=no, menubar=no, location=no, resizable=no") 
}

function leer_anuncio (URL){ 
window.open(URL,"Ventana","top=200, left=250, width=525, height=250, scrollbars=yes, menubar=no, location=no, resizable=no") 
}


function Foto (pagina, propiedades){
window.open(pagina,"Ventana",propiedades) 
}


function pelicula (URL){ 
window.open(URL,"Ventana","top=200, left=250, width=525, height=420, scrollbars=yes, menubar=no, location=no, resizable=no") 
}

function limite(a,b)
{
var v=a.value
if(v.length>b)
a.value=v.substring(0,b)
else
document.form_anuncio.contador.value=b-v.length

}

// Abre ventana para ver foto
function OpenFoto(imagen, ancho, alto, nombre){
var codigo1='<html><head><title>' + nombre + ' .::. Fotografías</title></head><body leftmargin=0 topmargin=0 class="open_foto"><table cellspacing="0" cellpadding="0" border=0 width="100%" height="90%"><tr><td width="100%" height="70%" align=left valign=middle">';
var codigo2='</td></tr></table></body></html>';
doctag = '<img src="' + imagen + '" border=0>';
ventana=open("","IMAGEN","width="+ancho+",height="+alto+",scrollbars=no,menubar=no, location=no,resizable=no,left=300,top=190,screenX=100,screenY=100");
ventana.document.write(codigo1);
ventana.document.write(doctag);
ventana.document.write(codigo2);
}


/* PARA VIDEO 1 DE PACK */
function sp_uno_spgo(){
sp_uno_closestarted=0
sp_uno_goon=1
sp_uno_fullspopupwidth=290 // posicion desde la izquierda de panoramica flash
sp_uno_fullspopupheight=0
document.getElementById("sp_uno_spbox").style.visibility="visible"
sp_uno_deg=10
sp_uno_totspins=1
sp_uno_timeperspin=0
sp_uno_maxdeg=sp_uno_totspins*0
sp_uno_sizemult=0
if(sp_uno_moz){
sp_uno_scroll()
}
else{
sp_uno_spbox.style.filter="progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand')"
sp_uno_spin()
sp_uno_spinint=setInterval("sp_uno_spin()",100)
}
}
var sp_uno_goon=0
var sp_uno_spinint, sp_uno_scrollint
var sp_uno_deg, sp_uno_totspins, sp_uno_timeperspin, sp_uno_maxdeg
var sp_uno_fullspopupwidth, sp_uno_fullspopupheight
function sp_uno_spin(){
sp_uno_rad=sp_uno_deg*Math.PI/180
sp_uno_cosval=Math.cos(sp_uno_rad)
sp_uno_sinval=Math.sin(sp_uno_rad)
if(sp_uno_deg<=sp_uno_maxdeg){
document.getElementById("sp_uno_spbox").filters.item(0).M11=sp_uno_cosval
document.getElementById("sp_uno_spbox").filters.item(0).M12=-sp_uno_sinval
document.getElementById("sp_uno_spbox").filters.item(0).M21=sp_uno_sinval
document.getElementById("sp_uno_spbox").filters.item(0).M22=sp_uno_cosval
sp_uno_sizechange()
}
else{
sp_uno_spindone=1
document.getElementById("sp_uno_spbox").style.filter=""
clearInterval(sp_uno_spinint)
}
sp_uno_deg+=36/sp_uno_timeperspin
sp_uno_scroll()
}
var sp_uno_sizemult
function sp_uno_sizechange(){
document.getElementById("sp_uno_spbox").filters.item(0).M11*=sp_uno_sizemult
document.getElementById("sp_uno_spbox").filters.item(0).M12*=sp_uno_sizemult
document.getElementById("sp_uno_spbox").filters.item(0).M21*=sp_uno_sizemult
document.getElementById("sp_uno_spbox").filters.item(0).M22*=sp_uno_sizemult
if(sp_uno_sizemult<1){
sp_uno_sizemult+=0.1/(sp_uno_timeperspin*sp_uno_totspins)
}
else{
sp_uno_sizemult=1
}
}
var sp_uno_spx, sp_uno_spy, sp_uno_spindone=0
function sp_uno_scroll(){
if(sp_uno_moz){
var sp_uno_bodywidth=self.innerWidth-20
var sp_uno_bodyheight=self.innerHeight-20
sp_uno_spx=Math.round((sp_uno_bodywidth-293)/2)
sp_uno_spy=Math.round((sp_uno_bodyheight-42)/2)
sp_uno_spx=sp_uno_spx*1+(sp_uno_fullspopupwidth-document.getElementById("sp_uno_spbox").offsetWidth-2)/2
sp_uno_spy=sp_uno_spy*1+(sp_uno_fullspopupheight-document.getElementById("sp_uno_spbox").offsetHeight-2)/2
document.getElementById("sp_uno_spbox").style.left=sp_uno_spx*1+self.pageXOffset
document.getElementById("sp_uno_spbox").style.top=sp_uno_spy*1+self.pageYOffset
}
else{
var sp_uno_bodywidth=document.body.clientWidth
var sp_uno_bodyheight=document.body.clientHeight
sp_uno_spx=Math.round((sp_uno_bodywidth-293)/2)
sp_uno_spy=Math.round((sp_uno_bodyheight-42)/2)
sp_uno_spx=sp_uno_spx*1+(sp_uno_fullspopupwidth-sp_uno_spbox.offsetWidth-2)/2
sp_uno_spy=sp_uno_spy*1+(sp_uno_fullspopupheight-sp_uno_spbox.offsetHeight-2)/2
sp_uno_spbox.style.left=sp_uno_spx*1+document.body.scrollLeft
sp_uno_spbox.style.top=sp_uno_spy*1+document.body.scrollTop
}
if(sp_uno_closestarted!=1){
setTimeout("sp_uno_scroll()",100)
}
}
var sp_uno_closestarted=0
function sp_uno_close(){
if(sp_uno_closestarted!=1){
sp_uno_closestarted=1
sp_uno_goon=0
document.getElementById("sp_uno_spbox").style.visibility="hidden"
var selelm=document.getElementsByTagName("SELECT")
for(var a=0;a<selelm.length;a++){
selelm[a].style.visibility="visible"
}
}
}
function sp_uno_spongo(){
sp_uno_spgo()
}
var sp_uno_temp
var sp_uno_browsversion=0
var sp_uno_moz=false
if (navigator.appVersion.indexOf("MSIE")!=-1){
sp_uno_temp=navigator.appVersion.split("MSIE")
sp_uno_browsversion=parseFloat(sp_uno_temp[1])
}
if (sp_uno_browsversion>=5.5){
}
else{
if(!document.all && document.getElementById && document.getElementById("sp_uno_spbox").innerHTML){
sp_uno_moz=true
}
}



/* PARA VIDEO 2 DE PACK */
function sp_dos_spgo(){
sp_dos_closestarted=0
sp_dos_goon=1
sp_dos_fullspopupwidth=290 // posicion desde la izquierda de panoramica flash
sp_dos_fullspopupheight=0
document.getElementById("sp_dos_spbox").style.visibility="visible"
sp_dos_deg=10
sp_dos_totspins=1
sp_dos_timeperspin=0
sp_dos_maxdeg=sp_dos_totspins*0
sp_dos_sizemult=0
if(sp_dos_moz){
sp_dos_scroll()
}
else{
sp_dos_spbox.style.filter="progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand')"
sp_dos_spin()
sp_dos_spinint=setInterval("sp_dos_spin()",100)
}
}
var sp_dos_goon=0
var sp_dos_spinint, sp_dos_scrollint
var sp_dos_deg, sp_dos_totspins, sp_dos_timeperspin, sp_dos_maxdeg
var sp_dos_fullspopupwidth, sp_dos_fullspopupheight
function sp_dos_spin(){
sp_dos_rad=sp_dos_deg*Math.PI/180
sp_dos_cosval=Math.cos(sp_dos_rad)
sp_dos_sinval=Math.sin(sp_dos_rad)
if(sp_dos_deg<=sp_dos_maxdeg){
document.getElementById("sp_dos_spbox").filters.item(0).M11=sp_dos_cosval
document.getElementById("sp_dos_spbox").filters.item(0).M12=-sp_dos_sinval
document.getElementById("sp_dos_spbox").filters.item(0).M21=sp_dos_sinval
document.getElementById("sp_dos_spbox").filters.item(0).M22=sp_dos_cosval
sp_dos_sizechange()
}
else{
sp_dos_spindone=1
document.getElementById("sp_dos_spbox").style.filter=""
clearInterval(sp_dos_spinint)
}
sp_dos_deg+=36/sp_dos_timeperspin
sp_dos_scroll()
}
var sp_dos_sizemult
function sp_dos_sizechange(){
document.getElementById("sp_dos_spbox").filters.item(0).M11*=sp_dos_sizemult
document.getElementById("sp_dos_spbox").filters.item(0).M12*=sp_dos_sizemult
document.getElementById("sp_dos_spbox").filters.item(0).M21*=sp_dos_sizemult
document.getElementById("sp_dos_spbox").filters.item(0).M22*=sp_dos_sizemult
if(sp_dos_sizemult<1){
sp_dos_sizemult+=0.1/(sp_dos_timeperspin*sp_dos_totspins)
}
else{
sp_dos_sizemult=1
}
}
var sp_dos_spx, sp_dos_spy, sp_dos_spindone=0
function sp_dos_scroll(){
if(sp_dos_moz){
var sp_dos_bodywidth=self.innerWidth-20
var sp_dos_bodyheight=self.innerHeight-20
sp_dos_spx=Math.round((sp_dos_bodywidth-293)/2)
sp_dos_spy=Math.round((sp_dos_bodyheight-42)/2)
sp_dos_spx=sp_dos_spx*1+(sp_dos_fullspopupwidth-document.getElementById("sp_dos_spbox").offsetWidth-2)/2
sp_dos_spy=sp_dos_spy*1+(sp_dos_fullspopupheight-document.getElementById("sp_dos_spbox").offsetHeight-2)/2
document.getElementById("sp_dos_spbox").style.left=sp_dos_spx*1+self.pageXOffset
document.getElementById("sp_dos_spbox").style.top=sp_dos_spy*1+self.pageYOffset
}
else{
var sp_dos_bodywidth=document.body.clientWidth
var sp_dos_bodyheight=document.body.clientHeight
sp_dos_spx=Math.round((sp_dos_bodywidth-293)/2)
sp_dos_spy=Math.round((sp_dos_bodyheight-42)/2)
sp_dos_spx=sp_dos_spx*1+(sp_dos_fullspopupwidth-sp_dos_spbox.offsetWidth-2)/2
sp_dos_spy=sp_dos_spy*1+(sp_dos_fullspopupheight-sp_dos_spbox.offsetHeight-2)/2
sp_dos_spbox.style.left=sp_dos_spx*1+document.body.scrollLeft
sp_dos_spbox.style.top=sp_dos_spy*1+document.body.scrollTop
}
if(sp_dos_closestarted!=1){
setTimeout("sp_dos_scroll()",100)
}
}
var sp_dos_closestarted=0
function sp_dos_close(){
if(sp_dos_closestarted!=1){
sp_dos_closestarted=1
sp_dos_goon=0
document.getElementById("sp_dos_spbox").style.visibility="hidden"
var selelm=document.getElementsByTagName("SELECT")
for(var a=0;a<selelm.length;a++){
selelm[a].style.visibility="visible"
}
}
}
function sp_dos_spongo(){
sp_dos_spgo()
}
var sp_dos_temp
var sp_dos_browsversion=0
var sp_dos_moz=false
if (navigator.appVersion.indexOf("MSIE")!=-1){
sp_dos_temp=navigator.appVersion.split("MSIE")
sp_dos_browsversion=parseFloat(sp_dos_temp[1])
}
if (sp_dos_browsversion>=5.5){
}
else{
if(!document.all && document.getElementById && document.getElementById("sp_dos_spbox").innerHTML){
sp_dos_moz=true
}
}


/* PARA SPOT PACK */
function sp_tres_spgo(){
sp_tres_closestarted=0
sp_tres_goon=1
sp_tres_fullspopupwidth=290 // posicion desde la izquierda de panoramica flash
sp_tres_fullspopupheight=0
document.getElementById("sp_tres_spbox").style.visibility="visible"
sp_tres_deg=10
sp_tres_totspins=1
sp_tres_timeperspin=0
sp_tres_maxdeg=sp_tres_totspins*0
sp_tres_sizemult=0
if(sp_tres_moz){
sp_tres_scroll()
}
else{
sp_tres_spbox.style.filter="progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand')"
sp_tres_spin()
sp_tres_spinint=setInterval("sp_tres_spin()",100)
}
}
var sp_tres_goon=0
var sp_tres_spinint, sp_tres_scrollint
var sp_tres_deg, sp_tres_totspins, sp_tres_timeperspin, sp_tres_maxdeg
var sp_tres_fullspopupwidth, sp_tres_fullspopupheight
function sp_tres_spin(){
sp_tres_rad=sp_tres_deg*Math.PI/180
sp_tres_cosval=Math.cos(sp_tres_rad)
sp_tres_sinval=Math.sin(sp_tres_rad)
if(sp_tres_deg<=sp_tres_maxdeg){
document.getElementById("sp_tres_spbox").filters.item(0).M11=sp_tres_cosval
document.getElementById("sp_tres_spbox").filters.item(0).M12=-sp_tres_sinval
document.getElementById("sp_tres_spbox").filters.item(0).M21=sp_tres_sinval
document.getElementById("sp_tres_spbox").filters.item(0).M22=sp_tres_cosval
sp_tres_sizechange()
}
else{
sp_tres_spindone=1
document.getElementById("sp_tres_spbox").style.filter=""
clearInterval(sp_tres_spinint)
}
sp_tres_deg+=36/sp_tres_timeperspin
sp_tres_scroll()
}
var sp_tres_sizemult
function sp_tres_sizechange(){
document.getElementById("sp_tres_spbox").filters.item(0).M11*=sp_tres_sizemult
document.getElementById("sp_tres_spbox").filters.item(0).M12*=sp_tres_sizemult
document.getElementById("sp_tres_spbox").filters.item(0).M21*=sp_tres_sizemult
document.getElementById("sp_tres_spbox").filters.item(0).M22*=sp_tres_sizemult
if(sp_tres_sizemult<1){
sp_tres_sizemult+=0.1/(sp_tres_timeperspin*sp_tres_totspins)
}
else{
sp_tres_sizemult=1
}
}
var sp_tres_spx, sp_tres_spy, sp_tres_spindone=0
function sp_tres_scroll(){
if(sp_tres_moz){
var sp_tres_bodywidth=self.innerWidth-20
var sp_tres_bodyheight=self.innerHeight-20
sp_tres_spx=Math.round((sp_tres_bodywidth-293)/2)
sp_tres_spy=Math.round((sp_tres_bodyheight-42)/2)
sp_tres_spx=sp_tres_spx*1+(sp_tres_fullspopupwidth-document.getElementById("sp_tres_spbox").offsetWidth-2)/2
sp_tres_spy=sp_tres_spy*1+(sp_tres_fullspopupheight-document.getElementById("sp_tres_spbox").offsetHeight-2)/2
document.getElementById("sp_tres_spbox").style.left=sp_tres_spx*1+self.pageXOffset
document.getElementById("sp_tres_spbox").style.top=sp_tres_spy*1+self.pageYOffset
}
else{
var sp_tres_bodywidth=document.body.clientWidth
var sp_tres_bodyheight=document.body.clientHeight
sp_tres_spx=Math.round((sp_tres_bodywidth-293)/2)
sp_tres_spy=Math.round((sp_tres_bodyheight-42)/2)
sp_tres_spx=sp_tres_spx*1+(sp_tres_fullspopupwidth-sp_tres_spbox.offsetWidth-2)/2
sp_tres_spy=sp_tres_spy*1+(sp_tres_fullspopupheight-sp_tres_spbox.offsetHeight-2)/2
sp_tres_spbox.style.left=sp_tres_spx*1+document.body.scrollLeft
sp_tres_spbox.style.top=sp_tres_spy*1+document.body.scrollTop
}
if(sp_tres_closestarted!=1){
setTimeout("sp_tres_scroll()",100)
}
}
var sp_tres_closestarted=0
function sp_tres_close(){
if(sp_tres_closestarted!=1){
sp_tres_closestarted=1
sp_tres_goon=0
document.getElementById("sp_tres_spbox").style.visibility="hidden"
var selelm=document.getElementsByTagName("SELECT")
for(var a=0;a<selelm.length;a++){
selelm[a].style.visibility="visible"
}
}
}
function sp_tres_spongo(){
sp_tres_spgo()
}
var sp_tres_temp
var sp_tres_browsversion=0
var sp_tres_moz=false
if (navigator.appVersion.indexOf("MSIE")!=-1){
sp_tres_temp=navigator.appVersion.split("MSIE")
sp_tres_browsversion=parseFloat(sp_tres_temp[1])
}
if (sp_tres_browsversion>=5.5){
}
else{
if(!document.all && document.getElementById && document.getElementById("sp_tres_spbox").innerHTML){
sp_tres_moz=true
}
}


function validar_postal(elform){
var todok=true;
var msgerror='Los siguientes datos son necesarios:\n\n';
msgerror+='--------------------------\n'; 
msgerror+='    Datos de la Postal\n'; 
msgerror+='--------------------------\n'; 
if (!EmailCorrecto (elform.email_destino.value)){msgerror+=' - Email destino incorrecto.\n';todok=false;}
if (!EmailCorrecto (elform.email_origen.value)){msgerror+=' - Email remite incorrecto.\n';todok=false;}
if (elform.tit_post.value==""){msgerror+=' - T\xEDtulo Postal.\n';todok=false;}
if (elform.email_destino.value==""){msgerror+=' - Email destino.\n';todok=false;}
if (elform.email_origen.value==""){msgerror+=' - Email remite.\n';todok=false;}
if (elform.nombre_destino.value==""){msgerror+=' - Nombre destino.\n';todok=false;}
if (elform.nombre_origen.value==""){msgerror+=' - Nombre remite.\n';todok=false;}
if (elform.texto.value==""){msgerror+=' - Texto de la Postal.\n';todok=false;}
if (!todok){alert(msgerror);return(false)} else {return(true)}
}

function validar_recomendacion(elform){
var todok=true;
var msgerror='Los siguientes datos son necesarios:\n\n';
msgerror+='-------------------------------\n'; 
msgerror+='    Env\xEDo Recomendaci\xF3n\n'; 
msgerror+='-------------------------------\n'; 
if (elform.nombre.value==""){msgerror+=' - T\xFA Nombre.\n';todok=false;}
if (elform.amigo.value==""){msgerror+=' - Nombre de Amigo.\n';todok=false;}
if (elform.tuemail.value==""){msgerror+=' - T\xFA email.\n';todok=false;}
if (elform.email.value==""){msgerror+=' - Email de amigo.\n';todok=false;}
if (!todok){alert(msgerror);return(false)} else {return(true)}
}

function validar_form_promoweb(elform){
var todok=true;
var msgerror='Los siguientes datos son necesarios:\n\n';
msgerror+='-------------------------------\n'; 
msgerror+='    Datos del Formulario\n'; 
msgerror+='-------------------------------\n'; 
if (elform.nombre.value==""){msgerror+=' - Nombre.\n';todok=false;}
if (elform.apellidos.value==""){msgerror+=' - Apellidos.\n';todok=false;}
if (!EmailCorrecto (elform.email_usuario.value)){msgerror+=' - Email incorrecto.\n';todok=false;}
if (elform.telefono.value==""){msgerror+=' - Telefono.\n';todok=false;}
if (elform.comentarios.value==""){msgerror+=' - Comentarios.\n';todok=false;}
if (!todok){alert(msgerror);return(false)} else {return(true)}
}

function validar_publicidad(elform){
var todok=true;
var msgerror='Los siguientes datos son necesarios:\n\n';
msgerror+='----------------------------\n'; 
msgerror+='    Datos del formulario\n'; 
msgerror+='----------------------------\n'; 
if (elform.empresa.value==""){msgerror+=' - Empresa.\n';todok=false;}
if (elform.contacto.value==""){msgerror+=' - Persona de contacto.\n';todok=false;}
if (elform.email.value==""){msgerror+=' - Email.\n';todok=false;}
if (elform.telefono.value==""){msgerror+=' - Tel\xE9fono.\n';todok=false;}
if (elform.comentarios.value==""){msgerror+=' - \xBFQu\xE9 desea?.\n';todok=false;}
if (!todok){alert(msgerror);return(false)} else {return(true)}
}

function validar_buzones(elform){
var todok=true;
var msgerror='Los siguientes datos son necesarios:\n\n';
msgerror+='----------------------------\n'; 
msgerror+='    Datos del formulario\n'; 
msgerror+='----------------------------\n'; 
if (elform.remite.value==""){msgerror+=' - Nombre.\n';todok=false;}
if (!EmailCorrecto (elform.correo.value)){msgerror+=' - Email incorrecto.\n';todok=false;}
//if (elform.telefono.value==""){msgerror+=' - Tel\xE9fono.\n';todok=false;}
if (elform.asunto.value==""){msgerror+=' - Asunto.\n';todok=false;}
if (elform.mensaje.value==""){msgerror+=' - Mensaje.\n';todok=false;}
if (elform.recaptcha_response_field.value==""){msgerror+=' - C\xF3digo de Seguridad.\n';todok=false;}
if (!todok){alert(msgerror);return(false)} else {return(true)}
}

function validar_link(elform){
var todok=true;
var msgerror='Los siguientes datos son necesarios:\n\n';
msgerror+='------------------------------------------\n'; 
msgerror+='    Datos del enlace recomendado\n'; 
msgerror+='------------------------------------------\n'; 
if (elform.nombre.value==""){msgerror+=' - Nombre de la Web.\n';todok=false;}
if (elform.web.value==""){msgerror+=' - Web.\n';todok=false;}
if (elform.descripcion.value==""){msgerror+=' - Descripci\xF3n.\n';todok=false;}
if (!todok){alert(msgerror);return(false)} else {return(true)}
}

function validar_anuncio(elform){
var todok=true;
var msgerror='Los siguientes datos son necesarios:\n\n';
msgerror+='---------------------------\n'; 
msgerror+='    Datos del anuncio\n'; 
msgerror+='---------------------------\n'; 
if (elform.anuncio.value==""){msgerror+=' - T\xEDtulo del anuncio.\n';todok=false;}
if (elform.contacto.value==""){msgerror+=' - Persona de contacto.\n';todok=false;}
if (elform.telefono.value==""){msgerror+=' - Tel\xE9fono.\n';todok=false;}
if (elform.texto.value==""){msgerror+=' - Texto del anuncio.\n';todok=false;}
if (elform.foto){if (elform.foto.value!=''){
extension = (elform.foto.value.substring(elform.foto.value.lastIndexOf("."))).toLowerCase(); 
if (extension!=".jpg"){msgerror+=' - Imagen incorrecta. (s\xF3lo JPG)\n';todok=false;} 
}}
if (!todok){alert(msgerror);return(false)} else {return(true)}
}

function validar_empresa_gratis(elform){
var todok=true;
var msgerror='Los siguientes datos son necesarios:\n\n';
msgerror+='------------------------------\n'; 
msgerror+='    Datos de la empresa\n'; 
msgerror+='------------------------------\n'; 
if (elform.nombre.value==""){msgerror+=' - Raz\xF3n Social.\n';todok=false;}
if (elform.direccion.value==""){msgerror+=' - Direcci\xF3n de la empresa.\n';todok=false;}
if (elform.localidad.value==""){msgerror+=' - Localidad.\n';todok=false;}
if (elform.provincia.value==""){msgerror+=' - Provincia.\n';todok=false;}
if (elform.telefono.value==""){msgerror+=' - Tel\xE9fono.\n';todok=false;}
if (elform.codigo.value==""){msgerror+=' - C\xF3digo de Seguridad.\n';todok=false;}
msgerror+='--------------------------\n'; 
msgerror+='    Datos del sector\n'; 
msgerror+='--------------------------\n'; 
if (elform.contacto.value==""){msgerror+=' - Persona de contacto.\n';todok=false;}
if (!todok){alert(msgerror);return(false)} else {return(true)}
}

function validar_usuario(elform){
var todok=true;
var msgerror='Los siguientes datos son necesarios:\n\n';
msgerror+='------------------------------\n'; 
msgerror+='    Datos del formulario\n'; 
msgerror+='------------------------------\n'; 
if (!EmailCorrecto (elform.email.value)){msgerror+=' - Email incorrecto.\n';todok=false;}
if (elform.nombre.value==""){msgerror+=' - Nombre.\n';todok=false;}
if (elform.apellidos.value==""){msgerror+=' - Apellidos.\n';todok=false;}
if (!comprueba_nif (elform.ndni.value) || elform.ndni.value==""){msgerror+=' - DNI ausente o incorrecto.\n';todok=false;}
if (elform.telefono.value==""){msgerror+=' - Tel\xE9fono.\n';todok=false;}
if (elform.email.value==""){msgerror+=' - Email.\n';todok=false;}
if (elform.clave0.value.length<6){msgerror+=' - Clave: m\xEDnimo 6 caracteres.\n';todok=false;}
if ((elform.clave0.value!=elform.clave1.value) && (elform.clave0.value.length>=6)){msgerror+=' - Las claves no coinciden.\n';todok=false;}
if (elform.recaptcha_response_field.value==""){msgerror+=' - C\xF3digo de Seguridad.\n';todok=false;}
if (!todok){alert(msgerror);return(false)} else {return(true)}
}

function validar_sorteo(elform){
var todok=true;
var msgerror='Los siguientes datos son necesarios:\n\n';
msgerror+='------------------------------\n'; 
msgerror+='    Datos de usuario\n'; 
msgerror+='------------------------------\n'; 
if (!EmailCorrecto (elform.email.value)){msgerror+=' - Email incorrecto.\n';todok=false;}
if (elform.email.value==""){msgerror+=' - Email.\n';todok=false;}
if (elform.clave.value.length<6){msgerror+=' - Clave: m\xEDnimo 6 caracteres.\n';todok=false;}
if (!todok){alert(msgerror);return(false)} else {return(true)}
}

function validar_reserva_hotel(elform){
var todok=true;

var f1 = elform.fecha_entrada.value.split("/"); 
var fc1 = f1[2]+f1[1]+f1[0];
//alert (fc1);
var f2 = elform.fecha_salida.value.split("/"); 
var fc2 = f2[2]+f2[1]+f2[0];
//alert (fc2);
var dia_actual = new Date();
var dia_hoy=dia_actual.getDate();
var mes_hoy=dia_actual.getMonth() +1;
var anio_hoy=dia_actual.getFullYear();
anio_hoy = anio_hoy.toString();
mes_hoy = mes_hoy.toString();if (mes_hoy<10){mes_hoy='0'+mes_hoy;}
dia_hoy = dia_hoy.toString();if (dia_hoy<10){dia_hoy='0'+dia_hoy;}
var hoy=anio_hoy+mes_hoy+dia_hoy;
//alert (hoy);
var msgerror='Los siguientes datos son necesarios:\n\n';
msgerror+='------------------------------\n'; 
msgerror+='    Solicitud de Reserva\n'; 
msgerror+='------------------------------\n'; 
if (elform.nombre.value==""){msgerror+=' - Nombre.\n';todok=false;}
if (elform.apellidos.value==""){msgerror+=' - Apellidos.\n';todok=false;}
if (elform.dni.value==""){msgerror+=' - DNI.\n';todok=false;}
if (elform.telefono.value==""){msgerror+=' - Tel\xE9fono.\n';todok=false;}
if (elform.email_cliente.value==""){msgerror+=' - Email.\n';todok=false;}else{
if (!EmailCorrecto (elform.email_cliente.value)){msgerror+=' - Email incorrecto.\n';todok=false;}}
if (elform.fecha_entrada.value==""){msgerror+=' - Fecha Entrada.\n';todok=false;}
if (fc1<hoy){msgerror+=' - Fecha Entrada ya pasada.\n';todok=false;}
if (elform.fecha_salida.value==""){msgerror+=' - Fecha Salida.\n';todok=false;}
if (fc2<hoy){msgerror+=' - Fecha Salida ya pasada.\n';todok=false;}
if (fc2<=fc1 && f1!="" && f2!=""){msgerror+=' - La Fecha Salida debe ser posterior a la de Entrada.\n';todok=false;}
if (!todok){alert(msgerror);return(false)} else {return(true)}
}

// Verifica que los parametros del email sean los correctos
function EmailCorrecto(email) {
caracNoValidos = " /:,;";
if(email=="") {alert('Debe escribir su email.');return false;} // debe rellenarse
for(i=0;i<caracNoValidos.length; i++) {
// ¿hay algún carácter no válido ?
            caracMal = caracNoValidos.charAt(i);
            if(email.indexOf(caracMal,0) > -1){ alert('Hay caracteres no válidos en el campo Email');return false;}
            }
posArroba = email.indexOf("@",1); // debe haber una arroba
if(posArroba==-1) { alert('Debe haber una ARROBA (@) en el campo Email');return false;}
if (email.indexOf("@",posArroba+1)!= -1){ alert('Hay más de una ARROBA (@) en el campo Email');return false;}
// y sólo una arroba
posPunto = email.indexOf(".",posArroba);
if(posPunto == -1){ alert('Debe haber un PUNTO (.) tras la ARROBA (@) en el campo Email');return false;}
// y al menos un punto despues de la arroba
if (posPunto+3 > email.length){ alert('No es una dirección de email válida'); return false;}
// debe haber al menos 2 caracteres tras el punto
return true;
}

function comprueba_nif(dni) {
  numero = dni.substr(0,dni.length-1);
  let = dni.substr(dni.length-1,1);
  numero = numero % 23;
  letra='TRWAGMYFPDXBNJZSQVHLCKET';
  letra=letra.substring(numero,numero+1);
  if (letra!=let) { return false; /*alert('Dni erroneo');*/}else{return true;}
}