this.focus();

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function pop(page,pagename,features) 
{
//window.open(page,pagename,"toolbar=yes,location=no,status=no,menubar=no,scrollbars=yes,width=500,height=500,left=0,top=0,resizable=yes");
window.open(page,pagename,features);
}

//*************************//
function EmailValid(emailfield){
	 // test if valid email address, must have @ and .
	  var checkEmail = "@.";
	  var checkStr = emailfield.value;
	  var EmailValid = false;
	  var EmailAt = false;
	  var EmailPeriod = false;
	  for (i = 0;  i < checkStr.length;  i++)
	  {
	    ch = checkStr.charAt(i);
	    for (j = 0;  j < checkEmail.length;  j++)
	    {
	      if (ch == checkEmail.charAt(j) && ch == "@")
	        EmailAt = true;
	      if (ch == checkEmail.charAt(j) && ch == ".")
	        EmailPeriod = true;
		  if (EmailAt && EmailPeriod)
			break;
		  if (j == checkEmail.length)
			break;
		}
		// if both the @ and . were in the string
	    if (EmailAt && EmailPeriod)
	    {
			EmailValid = true
			break;
		}
	  }
	// require at least 7 (a@a.com) characters be entered
	if (emailfield.value.length < 7)
	{
		alert("Por favor indíquenos una dirección de correo electrónico (\"email\") válida.");
		emailfield.focus();
		return (false);
	}
	  return EmailValid;
}

function validate(thisform){
	if (thisform.email.value == "")
	{
	} else if (!EmailValid(thisform.email))
	  {
	    //alert("La dirección de \"email\" no es válida, por favor trate nuevamente.");
	    thisform.email.focus();
	    return (false);
	  }
    if (thisform.asunto.value == "")
	{
	  alert("Por favor indíquenos el asunto de su pregunta.");
	  thisform.asunto.focus();
	  return (false);
	}
    if (thisform.preguntas.value == "")
	{
	  alert("Por favor indíquenos su pregunta/s.");
	  thisform.preguntas.focus();
	  return (false);
	}
}

function validatereg(thisform){

    if (thisform.nombre.value == "")
	{
	  alert("Por favor indíquenos su nombre.");
	  thisform.nombre.focus();
	  return (false);
	}

    if (thisform.apellido.value == "")
	{
	  alert("Por favor indíquenos su apellido.");
	  thisform.apellido.focus();
	  return (false);
	}
	if (thisform.u_flag_email_bt.checked == true)
	{
		if (thisform.email.value == "")
		{
		alert("Usted seleccionó que desea recibir notificaciones de eventos especiales\ny ofertas a su correo electrónico. Por favor indíquenos el mismo.");
		thisform.email.focus();
		return (false);
		} else if (!EmailValid(thisform.email))
		  {
			//alert("La dirección de \"email\" no es válida, por favor trate nuevamente.");
			thisform.email.focus();
			return (false);
		  }
	}

	if (thisform.u_flag_address_bt.checked == true)
	{
		var flag;
		flag = true;
		if (thisform.direccion1.value == "")
		{
		  //alert("Por favor indíquenos su dirección.");
		  //thisform.direccion1.focus();
		  flag = false;
		}
		if (thisform.ciudad.value == "")
		{
		  //alert("Por favor indíquenos su ciudad.");
		  //thisform.ciudad.focus();
		  flag = false;
		}
		if (thisform.zip.value == "")
		{
		  //alert("Por favor indíquenos su zip code.");
		  //thisform.zip.focus();
		  flag = false;
		}
		if (thisform.estado.value == "")
		{
		  //alert("Por favor indíquenos su estado.");
		  //thisform.estado.focus();
		  flag = false;
		}
		if (thisform.pais.value == "")
		{
		  //alert("Por favor indíquenos su país.");
		  //thisform.pais.focus();
		  flag = false;
		}

		if (flag == false)
		{
		alert("Usted seleccionó que desea recibir notificaciones de eventos especiales y ofertas\na su dirección postal. Por favor indíquenos toda la información de la misma.");
		thisform.direccion1.focus();
		return (false);
		}
	}

}

function validatecont(thisform){
    if (thisform.comentarios.value == "")
	{
	  alert("Por favor indíquenos su comentario.");
	  thisform.comentarios.focus();
	  return (false);
	}
	if (thisform.email.value == "")
	{
	} else if (!EmailValid(thisform.email))
	  {
	    //alert("La dirección de \"email\" no es válida, por favor trate nuevamente.");
	    thisform.email.focus();
	    return (false);
	  }
}