var cant=0;
function valida(ff,n)
{
if (cant>=4) 
	{
	alert("Esta intentando sabotear nuestro sistema, su IP y Hora de acceso seran 		guardadas para tomar acciones correspondientes.");
	location.href="index.php";
	}

if (n==1)
  {

   if ((ff.zona.value=="")||(ff.zona.value.lenght<3)) 
      { 
        alert("Datos no Ingresados, de manera correcta, intente de nuevo !!!");
        ff.zona.focus();
        return false;
      } 
      else { return true;  }

 }


if (n==2){

  if (ff.nombre.value.length < 4)
  {
    alert("No ha Ingresado su Nombre!.");
    ff.nombre.focus();
    cant=cant+1;
    return (false);
  }

  var verificar =" ";
  var checkStr = ff.nombre.value;
  var aa=0;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);

      if (ch == verificar)
	{aa=aa+1;}
  }
  
  if (aa>=2)
  {
    alert("Escriba un nombre valido.");
    ff.nombre.value="";
    ff.nombre.focus();
    cant=cant+1;
    return (false);
  }



if (ff.telefono.value.length < 1)
  {
    alert("No ha Ingresado Correctamente su telefono!.");
    ff.telefono.focus();
    cant=cant+1;
    return (false);
  }

  var verificar = "0123456789";
  var checkStr = ff.telefono.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < verificar.length;  j++)
      if (ch == verificar.charAt(j))
        break;
    if (j == verificar.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Escriba sólo numeros en el campo Telefono.");
    ff.telefono.value="";
    ff.telefono.focus();
    cant=cant+1;
    return (false);
  }

 if (ff.email.value.indexOf("@") != -1 && ff.email.value.length >12)
      return true;
       else {
          alert('Debes escribir una dirección de e-mail válida');
	  ff.email.focus();
	  cant=cant+1;
          return false;
	    }


if (ff.comentario.value.length <5)
  {
    alert("No ha Ingresado su Comentario de manera correcta!.");
    ff.comentario.focus();
    cant=cant+1;
    return (false);
  }
} //fin del segundo if con n=2;

}

inicio = 0;
orden = 0;
nx = 1;
nx = 1;
velocidad = 10;
function ejecutar() { 
document.getElementById("moviendose").style.left = inicio;
document.getElementById("moviendose").style.top = orden;
largeur = (navigator.appName != "Microsoft Internet Explorer")? window.innerWidth : document.body.offsetWidth;
hauteur = (navigator.appName != "Microsoft Internet Explorer")? window.innerHeight : document.body.offsetHeight;
bas = (navigator.appName != "Microsoft Internet Explorer")? document.getElementById('moviendose').clientHeight : document.getElementById('moviendose').offsetHeight;
droite = (navigator.appName != "Microsoft Internet Explorer")? document.getElementById('moviendose').clientWidth : document.getElementById('moviendose').offsetWidth;
if ((orden + bas) >= hauteur) ny = -1; 
if ((inicio + droite) >= largeur) nx = -1; 
if (orden <= 0) ny = 1; 
if (inicio <= 0) nx = 1; 
inicio += nx; 
orden += ny; 
setTimeout('ejecutar()',velocidad);
} 


function salta(value) { //la que hace el cambio de paginas en el menu desplegable

if ((value != "")||(value != "Mas servicios")) { 
var links=value; 
location.href = links; 
} 

} 