
// Punt Visual, s.l.
// C/ Sant Antoni, nº38
// 43530 Alcanar (Tarragona)
// Tel./Fax: 977 730 589
// e-mail:info@puntvisual.com
function comproba(t) 
{ 
  var checkStr = t.Nom.value;
  var allValid = true;
  if (checkStr == "") {
  alert("Introduzca: \nNombre");
  t.Nom.focus();
  return false;}
  var checkOK = "ABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚÀÈÏÒÜ" + "abcdefghijklmnñopqrstuvwxyzáéíóúàèïòü " + "-.ºª";
  var checkStr = t.Nom.value;
  var allValid = true;
  for (i = 0; i < checkStr.length; i++){
  ch = checkStr.charAt(i);
  for (j = 0; j < checkOK.length; j++)
  if (ch == checkOK.charAt(j))
  break;
  if (j == checkOK.length)
  {allValid = false;break;}}
  if (!allValid) {
  alert("Datos incorrectos: \n* Nombre *");
  t.Nom.focus();
  t.Nom.value="";
  return false;}
  if (t.Nom.value.length < 2) {
  alert("Datos incorrectos: \n* Nombre *");
  t.Nom.focus();
  t.Nom.value="";
  return false;
  } 
  var checkStr = t.Ciutat.value;
  var allValid = true;
  if (checkStr == "") {
  alert ("Introduzca: \nCiudad");
  t.Ciutat.focus();
  return false;}
  var checkOK = "ABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚÀÈÏÒÜ" + "abcdefghijklmnñopqrstuvwxyzáéíóúàèïòü " + "-.ºª";
  var checkStr = t.Ciutat.value;
  var allValid = true;
  for (i = 0; i < checkStr.length; i++){
  ch = checkStr.charAt(i);
  for (j = 0; j < checkOK.length; j++)
  if (ch == checkOK.charAt(j))
  break;
  if (j == checkOK.length)
  {allValid = false;break;}}
  if (!allValid) {
  alert("Datos incorrectos: \n* Ciudad *");
  t.Ciutat.focus();
  t.Ciutat.value="";
  return false;
  }
  var checkStr = t.C_P.value;
  var allValid = true;
  if (checkStr == "") {
  alert ("Introduzca: \nCódigo Postal");
  t.C_P.focus();     
  return false;}
  var checkOK = "0123456789";
  var checkStr = t.C_P.value;
  var allValid = true;
  for (i = 0; i < checkStr.length; i++){
  ch = checkStr.charAt(i);
  for (j = 0; j < checkOK.length ; j++)
  if (ch == checkOK.charAt(j))
  break;
  if (j == checkOK.length)
  {allValid = false;break;}}
  if (!allValid){
  alert("Datos incorrectos: \n* Código Postal *");
  t.C_P.focus();
  t.C_P.value="";
  return false;}
  if (t.C_P.value.length < 5) {
  alert("Datos incorrectos: \n* Código Postal *");
  t.C_P.focus();
  t.C_P.value="";
  return (false);
  }
  var checkStr = t.email.value;
  var allValid = true;
  if (checkStr == "") {
     alert ("Introduzca e-mail");
     t.email.focus();
     return false;}
  if (t.email.value.length < 7) {
  alert("Datos incorrectos: \n* e-mail *");
  t.email.focus();
  t.email.value="";
  return false;} 
  if (t.email.value.indexOf('@', 0) == -1 ||
      t.email.value.indexOf('.', 0) == -1){ 
  	alert("Datos incorrectos: \n* e-mail *");
  	t.email.focus();
  	t.email.value="";
  	 return false;}   
 
  return true;}
    
// End

