<!--
function acepta() {
 if (document.altas.acepto.checked == false) {
   alert('Debe Aceptar las condiciones del \n contrato para poder continuar');
   return false;
  }
  if (navigator.appName.indexOf('Netscape')!= -1) {
  window.location.href='altas.asp?Actividad='+document.forms[0].txtActividad.value;
  } else {
  document.location ="altas.asp?Actividad="+document.forms[0].txtActividad.value;
  }
}
 
function valNumCod(n,c) {
 var campo = document.forms[0].elements[n].value;
// if (campo == "") {
//    alert('Escriba su Código Postal')
//    document.forms[0].elements[n].select();
//    document.forms[0].elements[n].focus();
//	return false;
// }
  if ((campo.length != c) || (isNaN(campo))) { 
  alert('El campo precisa ' + c + ' dígitos sin espacios u otros símbolos');
  document.forms[0].elements[n].select();
  document.forms[0].elements[n].focus();
  return false;
  }
  if (campo.indexOf(" ") != -1) {
  alert('El campo precisa '+ c +' dígitos sin espacios u otros símbolos');
  document.forms[0].elements[n].select();
  document.forms[0].elements[n].focus();
  return false;
  }
  return true;
}
function valOrigen() {
  if ((document.altas.ListProvincia.selectedIndex == 0) || (document.altas.txtCodPos.value=="")){
   alert('Complete los datos necesarios para el alta');
   return false;
  }
  document.forms[0].cod.value=document.forms[0].txtCodPos.value.substring(0,2);
  
  
 }
 function valOrigen2() {
  if ((document.altas2.txtPoblacion.value == "") || (document.altas2.ListActividad.selectedIndex == 0)) {
   alert('Se deja algún dato sin completar');
   return false;
  }
 }

function valTextos(num) {
var datos = document.altas.elements[num].value;
var letra;
for (i=0; i < datos.length; i++) {
 letra = datos.substring(i, i+1);
 if ((letra < "a" || "z" < letra) && (letra < "A" || "Z" < letra) && (letra != ' ') && (letra != "ª")) {
  alert('Este campo sólo acepta texto');
  document.altas.elements[num].select();
  document.altas.elements[num].focus();
  return false;
  } 
 }
}
function valNIF() {
var nif = document.forms[0].txtnif.value;
if ((nif == "") || (nif.length != 9)) {
 alert('El número de NIF o DNI no es correcto');
 document.forms[0].txtnif.select();
 document.forms[0].txtnif.focus();
 return false;
 }
if (isNaN(nif.substring(8, 9))) {
 
 } else if (isNaN(nif.substring(0, 1))==false) {
   alert('Escriba la letra de su NIF o DNI');
   document.forms[0].txtnif.select();
   document.forms[0].txtnif.focus();
   return false;
 }


var numNif;
for (i=1; i < nif.length-1; i++) {
 numNif = nif.substring(i, i+1);
  if (numNif < "0" || "9" < numNif) {
  alert('Escriba su DNI/NIF correctamente sin utilizar espacios u otros caracteres');
  document.forms[0].txtnif.select();
  document.forms[0].txtnif.focus();
  return false;
  }
 }
 
 if ((isNaN(nif.substring(0, 1))) && (isNaN(nif.substring(8, 9)))) {
 alert('Sólo puede haber una letra en el NIF o DNI');
  document.forms[0].txtnif.select();
  document.forms[0].txtnif.focus();
  return false;
  }
}
function valEmail(Email) {
// var Email = document.forms[0].elements[n].value;
if (Email=="") {
 return false;
}
 var novale = " /;,:";
 for(h=0; h < novale.length; h++) {
  cadena = novale.charAt(h)
  if (Email.indexOf(cadena, 0) > -1) {
   return false;
  }
 }
var posArroba = Email.indexOf("@", 0);
 if (posArroba == -1) {
 return false;
 } else if (Email.indexOf("@", posArroba+1) != -1) {
 return false;
 } else if (posArroba == 0) {
 return false; 
 } else if (posArroba == Email.length) {
 return false;
 }
 
var posPunto = Email.indexOf(".", 0);
 if (posPunto == -1) {
 return false;
 } else if (posPunto == 0) {
 return false;
 } else if (posPunto == Email.length) {
 return false;
 } else if (posArroba+1 == posPunto) {
 return false;
 }
}
function accionEmail() {
 if (valEmail(document.altas.txtemail.value) == false) {
  
  alert('Escriba el email correctamente');
  document.altas.txtemail.select();
  document.altas.txtemail.focus();
  return false;
 } 
 return true
}
function cuota() {
 if (document.altas.ListCCuota.selectedIndex == 1) {
 document.altas.txtImpPago.value = 0
 } else {
  document.altas.txtImpPago.value = 252
 }
}
function cuotaP() {
 if (document.altas.ListCCuota.selectedIndex == 1) {
 document.altas.txtImpPago.value = 612
 } else {
  document.altas.txtImpPago.value = 720
 }
}

function pasardatos() {
 for (i=0;i<3;i++){
  if (document.banco.elements[i].value=="") {
  alert('No ha rellenado todos los datos, no podrá darse de alta')
  return false;
   }
  } 
  valNumCod(0,4);
  valNumCod(1,4);
  valNumCod(2,2);
  valCtaCte();
window.opener.document.altas.txtEntidad.value=document.banco.txtEntidad.value;
window.opener.document.altas.txtAgencia.value=document.banco.txtAgencia.value;
window.opener.document.altas.txtDC.value=document.banco.txtDC.value;
window.opener.document.altas.txtCtaCte.value=document.banco.txtCtaCte.value;
window.close();
}
function pagoBanco() {
if (document.altas.ListFCobro.selectedIndex==1) {
    window.open("../html/datosBanco.htm", "DatosBanco", "width=500,height=200"); 
	 } 
if (document.altas.ListFCobro.selectedIndex==2) {
    window.open("../html/transferencia.htm", "DatosTransferecia", "width=500,height=200"); 
    }
}
function valCtaCte() {
  var campo = document.banco.txtCtaCte.value;
  if  ((isNaN(campo)) || (campo.indexOf(" ") != -1)) { 
  alert('El Nº de Cta no es correcto');
  document.banco.txtCtaCte.select();
  document.banco.txtCtaCte.focus();
  return false;
  }
}
function valOrigen3() {
with (document.forms[0]) {

  if  (txtPregunta.value=="" || txtRespuesta.value=="") {
    alert('Rellene  todos los campos con un \"asterisco\", campo obligatorio');
	return false;
 } 
 if (document.cookie.indexOf('Actividad=1') != -1) {
  if ((ListCCuota.selectedIndex==0) || (ListFCobro.selectedIndex==0)) {
   alert('Debe elegir un tipo de cuota y una forma de pago')
   return false;
  }
 }
 if (document.cookie.indexOf('Actividad=2') != -1) {
 if (ListCCuota.selectedIndex==0 || ListFCobro.selectedIndex==0 || ActProv.selectedIndex==0)  {
   alert('Debe elegir un tipo de cuota, una forma de pago y seleccionar el tipo de Actividad')
   return false;
   }
 } 
 if (document.cookie.indexOf('Actividad=3') == -1) {
 if (ListFCobro.selectedIndex == 1) {
  if(txtEntidad.value=="" || txtAgencia.value=="" || txtDC.value=="" || txtCtaCte.value=="") {
   alert('No rellenó los datos bancarios para la domiciliación');
   return false;
   }
  }
 }
  valPassw();
  accionEmail();
  valNIF();
  noComillas();
 }
}
function valPassw() {
 if (document.altas.txtClave.value != document.altas.txtClave2.value) {
   alert('Las contraseñas no coinciden');
   document.altas.txtClave2.select();
   document.altas.txtClave2.focus();
   return false;
   }
  if ((document.altas.txtClave.value =="") || (document.altas.txtClave2.value =="") ) {
   alert('Debe rellenar los campos de constraseña')
   }
 }
 function noComillas(){
 for (i=0;i<document.forms[0].elements.length;i++) {
  if (document.forms[0].elements[i].value.indexOf('"')!= -1) {
   alert('No escriba comillas \"\" en ninguno de los campo, elemento no valido');
   return false;
  }
 }
}
 function valOrigen4() {
  if (document.forms[0].elements[0].value == "" || document.forms[0].elements[1].value == "") {
  alert('Debe rellenar los dos campos para poder seguir');
  return false;
 }
 valNIF()
}

function valOrigen5() {
for (i=0;i<document.getSource.chBaja.length;i++) {
if (document.getSource.chBaja[i].checked) {
  confirm('Está apunto de BORRAR registro/s');
  return true;
  }
 } 
 alert('No ha seleccionado ningún registro para borrar');
 return false;
}
function intro(form) {
if (document.getSource.chBaja.checked) {
  document.getSource.txtBorrar.value = this.value;
 }
}
//-->