function digitos(f){

var Numero="abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";

texto=f.value;

for (i=0;i<texto.length;i++){

 if (Numero.indexOf(texto.charAt(i))==-1) {

  alert('El campo seleccionado solo acepta numeros, letras o el signo "-".\n'+

  'Caracter no valido "'+texto.charAt(i)+'"');

  f.focus();

  f.select();

  return false;

  }

 }

}



function letras(f){

var Numero="abcdefghijklmnopqrstuvwxyz- ABCDEFGHIJKLMNOPQRSTUVWXYZ";

texto=f.value;

for (i=0;i<texto.length;i++){

 if (Numero.indexOf(texto.charAt(i))==-1) {

  alert('El campo seleccionado solo acepta numeros, letras o el signo "-".\n'+

  'Caracter no valido "'+texto.charAt(i)+'"');

  f.focus();

  f.select();

  return false;

  }

 }

}



function otros(f){

var Numero="¿?¡!@_*+#&$%.()";

texto=f.value;

for (i=0;i<texto.length;i++){

 if (Numero.indexOf(texto.charAt(i))!=-1) {

	alert('Caracter ilegal "'+texto.charAt(i)+'"');

	f.focus();

	f.select();

	return false;

	}

  }

}



function email(t){

Val=t.value;

arroba=Val.indexOf("@");

punto=Val.lastIndexOf(".");

if (arroba!=-1 && punto>arroba){ return true;}

else{

 alert('El email que ha escrito no es valido.');

 t.focus();

 t.select();

 return false;

 }

}



function numeros(f){

var Numero="1234567890";

texto=f.value;

for (i=0;i<texto.length;i++){

 if (Numero.indexOf(texto.charAt(i))==-1) {

  alert('El campo seleccionado solo acepta numeros.');

  f.focus();

  f.select();

  return false;

  }

 }

}



function fechas(f){

var Numero="1234567890/";

texto=f.value;

for (i=0;i<texto.length;i++){

 if (Numero.indexOf(texto.charAt(i))==-1) {

  alert('El formato de fecha es dd/mm/aaaa.\n'+

  'Caracter no valido "'+texto.charAt(i)+'"');

  f.focus();

  f.select();

  return false;

  }

 }

}



function valor(f,min,max,tipo,req){

var s="";

if (f.value!="" || req==1){

  if (f.value==""){

    if (min>0||max>0){

    s='Rellene el campo seleccionado con un ';

	if (min>0) s+='minimo de '+min;

	if (min>0 && max>0)s+=' y un ';

	if (max>0) s+='maximo de '+max;

	s+=' caracteres.';

	}

	else{s="Escriba un valor para el campo seleccionado.";}

	alert(s);

    f.focus();

    return (false);

  }

  if (min>0){

  if (f.value.length<min){

    alert("Escriba como minimo "+min+" caracteres en el campo seleccionado.");

    f.focus();

    return (false);

  }

}

  if (max>0){

   if (f.value.length>max){

    alert("Escriba como maximo "+max+" caracteres en el campo seleccionado.");

    f.focus();

    return (false);

  }

}

}

if (tipo!=""){

return eval(tipo)(f);

}

}



function CreaLista(FIN){

for (i=1;i<FIN+1;i++){

 texto=i+'';

 if (texto.length==1) texto='0'+texto;

 document.write('<option value='+texto+'>'+texto+"</option>")

}

}
