function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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 MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function validar_anuncios(formname)
{
	if (formname.titulo.value=="") {
		alert("Por favor, ingrese el título del anuncio.");
		formname.titulo.focus();
		return false;
	}
	if (formname.linea1.value=="") {
		alert("Por favor, ingrese la primera línea del anuncio.");
		formname.linea1.focus();
		return false;
	}
	if (formname.linea2.value=="") {
		alert("Por favor, ingrese la segunda línea del anuncio.");
		formname.linea2 .focus();
		return false;
	}
	
	return true;
}

function validar_keywords(formname)
{
	haytexto=0;
	for (i=0;i<formname.keyword.length;i++) {
		if (formname.keyword[i].value!="") haytexto=1;
	}
	if (haytexto==0) {
		alert("Debe ingresar al menos una palabra clave para su campaña.");
		return false;
	} 
	return true;
}


function validar_datos(formname,campo1,campo2,campo3)
{

	if (formname.RazonSocial.value=="") {
		alert("Por favor, ingrese su nombre o razón social.");
		formname.RazonSocial.focus();
		return false;
	}
	
	
	if (formname.DomicilioLegal.value=="") {
		alert("Por favor, ingrese su domicilio legal.");
		formname.DomicilioLegal.focus();
		return false;
	}
	
	if (formname.Contacto.value=="") {
		alert("Por favor, ingrese su contacto.");
		formname.Contacto.focus();
		return false;
	}
	
	if (formname.Telefono.value=="") {
		alert("Por favor, ingrese su teléfono.");
		formname.Telefono.focus();
		return false;
	}
	
	strErr = "";

      if ( !strErr.length && !formname.Email.value.length ){
        strErr = "Por favor, ingrese un E-Mail.";
      }

      if ( !strErr.length && ( formname.Email.value.indexOf("@") == -1 || formname.Email.value.indexOf(".") == -1 ) ){
        strErr = "Por favor, ingrese un E-Mail valido.";
      }

      if ( strErr.length ){
        alert(strErr);
        formname.Email.focus();
        return false;
     
      }
	
    if (formname.Password.value=="") {
		alert("Por favor, ingrese una contraseña.");
		formname.Password.focus();
		return false;
	}
	
	
    if (formname.Password2.value=="") {
		alert("Por favor, ingrese la confirmación de la contraseña.");
		formname.Password2.focus();
		return false;
	}
	
	if (formname.Password.value != formname.Password2.value) {
		alert("Las contraseñas no coinciden, por favor ingreselas nuevamente.");
		formname.Password.focus();
		return false;
	}
	
	if (formname.terms.checked==false) {
		alert("Para continuar, debe leer y aceptar los Términos y Condiciones del servicio.")
		return false;
	}
//	alert('ATENCION: A continuación, usted será direccionado a DineroMail, donde podrá realizar su pago con su tarjeta de crédito. Al finalizar, regresará automáticamente a este sitio.');
	return true;
}


function mostrar(nombreCapa){ 
    document.getElementById(nombreCapa).style.visibility="visible"; 
}
 
function ocultar(nombreCapa){ 
    document.getElementById(nombreCapa).style.visibility="hidden"; 
}

function ocultar(nombreCapa){ 
    document.getElementById(nombreCapa).style.visibility="hidden"; 
}
function ValidarLogin(){
   
	strErr = "";

      if ( !strErr.length && !document.form1.User.value.length ){
        strErr = "Por favor, ingrese un E-Mail.";
      }

      if ( !strErr.length && ( document.form1.User.value.indexOf("@") == -1 || document.form1.User.value.indexOf(".") == -1 ) ){
        strErr = "Por favor, ingrese un E-Mail valido.";
      }

      if ( strErr.length ){
        alert(strErr);
        document.form1.User.focus();
      }else{
      
         if (document.form1.Pass.value=="") {
		    alert("Por favor, ingrese una contraseña.");
		    document.form1.Pass.focus();
		 }else{  
		    location.href='step_6.asp?User=' + document.form1.User.value + '&Pass=' + document.form1.Pass.value + '&ID_Partner=' + document.form1.ID_Partner.value + '&ID_Paquete=' + document.form1.ID_Paquete.value + '&ID_Campana=' + document.form1.ID_Campana.value +'&Keywords='+ document.form1.Keywords.value  + '&Keyword=' + document.form1.Keyword.value  + '&Paises=' + document.form1.Paises.value +'&Titulo=' + document.form1.Titulo.value +'&Linea1='+ document.form1.Linea1.value +'&Linea2='+ document.form1.Linea2.value +'&chk='+ document.form1.chk.value  +'&ID_Pais='+ document.form1.ID_Pais.value +'&ID_Lenguaje=' + document.form1.ID_Lenguaje.value +'&Sitio_web=' + document.form1.Sitio_web.value ;
	     }
     
      }
   

}


function validar_datos_PDF()
{

	if (window.document.WebToLeadForm.SF2.value=="") {
		alert("Por favor, ingrese su nombre.");
		window.document.WebToLeadForm.SF2.focus();
		return false;
	}
	
	
	if (window.document.WebToLeadForm.SF3.value=="") {
		alert("Por favor, ingrese su apellido.");
		window.document.WebToLeadForm.SF3.focus();
		return false;
	}
	
	if (window.document.WebToLeadForm.AF3.value=="") {
		alert("Por favor, ingrese su empresa.");
		window.document.WebToLeadForm.AF3.focus();
		return false;
	}
	
	
	
	strErr = "";

      if ( !strErr.length && !window.document.WebToLeadForm.EMAIL.value.length ){
        strErr = "Por favor, ingrese un E-Mail.";
      }

      if ( !strErr.length && ( window.document.WebToLeadForm.EMAIL.value.indexOf("@") == -1 || window.document.WebToLeadForm.EMAIL.value.indexOf(".") == -1 ) ){
        strErr = "Por favor, ingrese un E-Mail valido.";
      }

      if ( strErr.length ){
        alert(strErr);
        window.document.WebToLeadForm.EMAIL.focus();
        return false;
     
      }
	
   


	 window.document.WebToLeadForm.submit();
}

function validarActualizar(url)
{
 if (confirm("¿Esta seguro que quiere actualizar desde Google? - Tenga en cuenta que esto generará un gasto con las APIs!!")) {
    location.href=url ;
  }else{
    return false;
  }
}