// JavaScript Document
<!--

function foro_v(foro)
{
//--------------------> VALIDAR FORO
    //alert("Este formulario no esta disponible en este momento.");
    //foro.nombre.focus();
    //return (false);

  if (foro.nombre.value == "")
  {
    alert("Favor completar la casilla \"Nombre\".");
    foro.nombre.focus();
    return (false);
  }
  
  if (foro.apellido.value == "")
  {
    alert("Favor completar la casilla \"Apellido\".");
    foro.apellido.focus();
    return (false);
  }
  
  if (foro.email.value == "")
  {
    alert("Favor completar la casilla \"Email\".");
    foro.email.focus();
    return (false);
  }
  
  var valid_email = email_check (foro.email.value);
  if (valid_email == false)
  {
    foro.email.focus();
    return (false);
  }
return (true);
}

function sugerencias_v(sugerencias)
{
//--------------------> VALIDAR SUGERENCIAS
    //alert("Este formulario no esta disponible en este momento.");
    //sugerencias.nombre.focus();
    //return (false);

  if (sugerencias.nombre.value == "")
  {
    alert("Favor completar la casilla \"Nombre\".");
    sugerencias.nombre.focus();
    return (false);
  }
  
  if (sugerencias.apellido.value == "")
  {
    alert("Favor completar la casilla \"Apellido\".");
    sugerencias.apellido.focus();
    return (false);
  }
  
  if (sugerencias.email.value == "")
  {
    alert("Favor completar la casilla \"Email\".");
    sugerencias.email.focus();
    return (false);
  }
  
  var valid_email = email_check (sugerencias.email.value);
  if (valid_email == false)
  {
    sugerencias.email.focus();
    return (false);
  }
return (true);
}

function distribucion_v(distribucion)
{
//--------------------> VALIDAR DISTRIBUCION
    //alert("Este formulario no esta disponible en este momento.");
    //distribucion.nombre.focus();
    //return (false);

  if (distribucion.nombre.value == "")
  {
    alert("Favor completar la casilla \"Nombre\".");
    distribucion.nombre.focus();
    return (false);
  }
  
  if (distribucion.apellido.value == "")
  {
    alert("Favor completar la casilla \"Apellido\".");
    distribucion.apellido.focus();
    return (false);
  }
  
  if (distribucion.email.value == "")
  {
    alert("Favor completar la casilla \"Email\".");
    distribucion.email.focus();
    return (false);
  }
  
  var valid_email = email_check (distribucion.email.value);
  if ( valid_email == false)
  {
    distribucion.email.focus();
    return (false);
  }
return (true);
}

function anunciantes_v(anunciantes)
{
//--------------------> VALIDAR ANUNCIANTES
    //alert("Este formulario no esta disponible en este momento.");
    //anunciantes.nombre.focus();
    //return (false);

  if (anunciantes.compania.value == "")
  {
    alert("Favor completar la casilla \"Compania\".");
    anunciantes.compania.focus();
    return (false);
  }
  
  if (anunciantes.contacto.value == "")
  {
    alert("Favor completar la casilla \"Contacto\".");
    anunciantes.contacto.focus();
    return (false);
  }
  
  if (anunciantes.telefono.value == "")
  {
    alert("Favor completar la casilla \"Telefono\".");
    anunciantes.telefono.focus();
    return (false);
  }
  
  if (anunciantes.email.value == "")
  {
    alert("Favor completar la casilla \"Email\".");
    anunciantes.email.focus();
    return (false);
  }
  
  var valid_email = email_check (anunciantes.email.value);
  if (valid_email == false)
  {
    anunciantes.email.focus();
    return (false);
  }
return (true);
}
//------------------------------------------------------------------------------------------------------>
function step3a_validation (theForm)
{
   if (theForm.card_first_name.value == "")
  {
    alert("Please enter a value for the \"First Name\" field.");
    theForm.card_first_name.focus();
    return (false);
  }
  
  if (theForm.card_last_name.value == "")
  {
    alert("Please enter a value for the \"Last Name\" field.");
    theForm.card_last_name.focus();
    return (false);
  }

 
  if (theForm.card_address1.value == "")
  {
    alert("Please enter a value for the \"Address 1\" field.");
    theForm.card_address1.focus();
    return (false);
  }
  if (theForm.card_city.value == "")
  {
    alert("Please enter a value for the \"City\" field.");
    theForm.card_city.focus();
    return (false);
  }
  if (theForm.card_state.value == "Choose One")
  {
    alert("Please enter a value for the \"State/Province\" field.");
    theForm.card_state.focus();
    return (false);
  }
  if (theForm.card_zip.value == "")
  {
    alert("Please enter a value for the \"Zip/Postal Code\" field.");
    theForm.card_zip.focus();
    return (false);
  }
  if (theForm.card_country.value == "")
  {
    alert("Please enter a value for the \"Country\" field.");
    theForm.card_country.focus();
    return (false);
  }
  if (theForm.card_phone.value == "")
  {
    alert("Please enter a value for the \"Phone\" field.");
    theForm.phone.focus();
    return (false);
  }
  
  if (theForm.card_email.value == "")
  {
    alert("Please enter a value for the \"Email\" field.");
    theForm.card_email.focus();
    return (false);
  }
  
  var valid_email = email_check (theForm.card_email.value);
  if (valid_email == false)
  {
    theForm.card_email.focus();
    return (false);
  }
  
  if (theForm.card_number.value == "")
  {
    alert("Please enter a value for the \"Credit Card Number\" field.");
    theForm.card_number.focus();
    return (false);
  }
  
  if (theForm.card_month.value == "Choose One")
  {
    alert("Please enter a value for the \"Expiration Month\" field.");
    theForm.card_month.focus();
    return (false);
  }
  if (theForm.card_year.value == "Choose One")
  {
    alert("Please enter a value for the \"Expiration Year\" field.");
    theForm.card_year.focus();
    return (false);
  }
return (true); 
}

//------------------------------------------------------------------------------------------------------>
function step3b_validation (theForm)
{
   if (theForm.check_first_name.value == "")
  {
    alert("Please enter a value for the \"First Name\" field.");
    theForm.check_first_name.focus();
    return (false);
  }
  
  if (theForm.check_last_name.value == "")
  {
    alert("Please enter a value for the \"Last Name\" field.");
    theForm.check_last_name.focus();
    return (false);
  }

 
  if (theForm.check_address1.value == "")
  {
    alert("Please enter a value for the \"Address 1\" field.");
    theForm.check_address1.focus();
    return (false);
  }
  if (theForm.check_city.value == "")
  {
    alert("Please enter a value for the \"City\" field.");
    theForm.check_city.focus();
    return (false);
  }
  if (theForm.check_state.value == "Choose One")
  {
    alert("Please enter a value for the \"State/Province\" field.");
    theForm.check_state.focus();
    return (false);
  }
  if (theForm.check_zip.value == "")
  {
    alert("Please enter a value for the \"Zip/Postal Code\" field.");
    theForm.check_zip.focus();
    return (false);
  }
  if (theForm.check_country.value == "")
  {
    alert("Please enter a value for the \"Country\" field.");
    theForm.check_country.focus();
    return (false);
  }
  if (theForm.check_phone.value == "")
  {
    alert("Please enter a value for the \"Phone\" field.");
    theForm.check_phone.focus();
    return (false);
  }
return (true);
}

//___________________________________________________________________________________________

function email_check(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Direccion de email es invalida.")
		   return (false)
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Direccion de email es invalida.")
		   return (false)
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Direccion de email es invalida.")
		    return (false)
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Direccion de email es invalida.")
		    return (false)
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Direccion de email es invalida.")
		    return (false)
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Direccion de email es invalida.")
		    return (false)
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Direccion de email es invalida.")
		    return (false)
		 }

 		 return (true)					
}


function useles (){

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ";
  var checkStr = theForm.State.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("Please enter only letter characters in the \"State\" field.");
    theForm.State.focus();
    return (false);
  }
  return (true);
}
//-->