 //*************************************************************************************************************************

function agregarFavoritos(){ 

	var url="http://www2.promoemail.com.mx";
	var titulo="Promoemail, suscribete y gana!!";

    if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) { 


       window.external.AddFavorite(url,titulo); 

    } 

    else { 

       if(navigator.appName == "Netscape") 

          alert ("Presione Crtl+D para agregar este sitio en sus Bookmarks"); 

    } 

 } 
 
 
 //*************************************************************************************************************************
 
function checkEnviarAmigo(idioma)
						{
						

if(document.form.nombre.value==""){ alertaAmigo(idioma); document.form.nombre.focus();}
else if(document.form.email.value==""){ alertaAmigo(idioma); document.form.email.focus();}
else if(!check_email(document.form.email.value)){ alertaEmail(idioma); document.form.email.focus();}
else if(document.form.anombre.value==""){ alertaAmigo(idioma); document.form.anombre.focus();}
else if(document.form.aemail.value==""){ alertaAmigo(idioma); document.form.aemail.focus();}
else if(!check_email(document.form.aemail.value)){ alertaEmail(idioma); document.form.aemail.focus();}
else if(document.form.comentario.value==""){ alertaAmigo(idioma); document.form.comentario.focus();}
else{
document.form.submit();
}
						
						
						}
function alertaAmigo(idioma)						
{
	if(idioma=='esp')
	alert("Por favor, llene todos los campos");
	else
	alert("Please, fills all the fields ");
	
}
function alertaEmail(idioma)
{
	if(idioma=='esp')
	alert("Por favor, proporcione un E-Mail válido");
	else
	alert("Please, write a valid email");
	
}
						
 //*************************************************************************************************************************

 
  function recomendar(idioma)  { 
  
 
  var theURL="recomendar/enviaraunamigo.php?idioma="+idioma;
  var winName="InterfaceAmigo";
  var features="scrollbars=no,width=590,height=350";

           var _W=window.open(theURL,winName,features); 

           _W.focus(); 

       _W.moveTo(20,20); 

 }

function noticias(idioma)  { 
  
 
  var theURL="noticia.php?id="+idioma;
  var winName="InterfaceAmigo";
  var features="scrollbars=yes,width=590,height=350";

           var _W=window.open(theURL,winName,features); 

           _W.focus(); 

       _W.moveTo(20,20); 

 }

//****************************** Roll overs*******************************************************************************************
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_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_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];}
}

//*************************** validar formulario de contacto

function check_contacto()
			{

			
			if(document.form.nombre.value==""){ alertaAmigo(idioma); document.form.nombre.focus(); }
			else if(document.form.email.value==""){ alertaAmigo(idioma); document.form.email.focus(); }		
			
			else if(document.form.telefono.value==""){ alertaAmigo(idioma); document.form.telefono.focus(); }			
			else if(document.form.estado.value==""){ alertaAmigo(idioma); document.form.estado.focus(); }
	
			else if(!check_email(document.form.email.value)){ alertaEmail(idioma); document.form.email.focus();}
		
			else if(document.form.comentario.value==""){ alertaAmigo(idioma); document.form.comentario.focus(); }						
			else
			{
			document.form.submit();
			}
			
			}

function check_anuncio()
			{

			
			if(document.form.nombre.value==""){ alertaAmigo(idioma); document.form.nombre.focus(); }
			else if(document.form.email.value==""){ alertaAmigo(idioma); document.form.email.focus(); }		
			else if(document.form.empresa.value==""){ alertaAmigo(idioma); document.form.empresa.focus(); }
			else if(document.form.telefono.value==""){ alertaAmigo(idioma); document.form.telefono.focus(); }			
			else if(document.form.estado.value==""){ alertaAmigo(idioma); document.form.estado.focus(); }
	
			else if(!check_email(document.form.email.value)){ alertaEmail(idioma); document.form.email.focus();}
		
			else if(document.form.comentario.value==""){ alertaAmigo(idioma); document.form.comentario.focus(); }						
			else
			{
			document.form.submit();
			}
			
}

			
function check_email(e) { 
ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM"; 

for(i=0; i < e.length ;i++){ 
if(ok.indexOf(e.charAt(i))<0){ 
return (false); 
} 
} 

if (document.images) { 
re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/; 
re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/; 
if (!e.match(re) && e.match(re_two)) { 
return (-1); 
} 

} 

}
function checarBaja()
{
	if(!check_email(document.dardebaja.email.value)){
		alertaEmail(); document.dardebaja.email.focus();
			 
	}	else {
		document.dardebaja.submit();
	}
}
function check(chequear,cantidad,tema)
{

	for (i=0; i < cantidad ; i++ )
	{
		if (chequear==true)
		{
			if(tema==1)
			{
			document.forms[0].tema_1[i].checked=true;
			}
			if(tema==2)
			{
			document.forms[0].tema_2[i].checked=true;
			}
			if(tema==3)
			{
			document.forms[0].tema_3[i].checked=true;
			}
			if(tema==4)
			{
			document.forms[0].tema_4[i].checked=true;
			}

			if(tema==5)
			{
			document.forms[0].tema_5[i].checked=true;
			}

			if(tema==6)
			{
			document.forms[0].tema_6[i].checked=true;
			}

			if(tema==7)
			{
			document.forms[0].tema_7[i].checked=true;
			}
			if(tema==8)
			{
			document.forms[0].tema_8[i].checked=true;
			}
			if(tema==9)
			{
			document.forms[0].tema_9[i].checked=true;
			}
			if(tema==10)
			{
			document.forms[0].tema_10[i].checked=true;
			}			
			if(tema==11)
			{
			document.forms[0].tema_11[i].checked=true;
			}
		}if(chequear==false)
		{
				if(tema==1)
				{
					document.forms[0].tema_1[i].checked=false;
				}
				
				if(tema==2)
				{
					document.forms[0].tema_2[i].checked=false;
				}
				if(tema==3)
				{
					document.forms[0].tema_3[i].checked=false;
				}
				if(tema==4)
				{
					document.forms[0].tema_4[i].checked=false;
				}		

				if(tema==5)
				{
					document.forms[0].tema_5[i].checked=false;
				}	
				if(tema==6)
				{
					document.forms[0].tema_6[i].checked=false;
				}	
				if(tema==7)
				{
					document.forms[0].tema_7[i].checked=false;
				}	
				if(tema==8)
				{
					document.forms[0].tema_8[i].checked=false;
				}	
				if(tema==9)
				{
					document.forms[0].tema_9[i].checked=false;
				}	
				if(tema==10)
				{
					document.forms[0].tema_10[i].checked=false;
				}	
				if(tema==11)
				{
					document.forms[0].tema_11[i].checked=false;
				}	
			}
	 }
}

function validaTodos(cantidad,dedonde)
 {
	 if(dedonde == "admin")
		  	check2("dedonde");
		  else {
			 check1("dedonde");
		  }
 } // termina validosTodos


function valida(cantidad,cantidad2,cantidad3,cantidad4,cantidad5,cantidad6,cantidad7,cantidad8,cantidad9,cantidad10,cantidad11,dedonde)
 {

 var contador=0;
 
 for (i=0; i < cantidad ; i++ )
   	{
		if(document.forms[0].tema_1[i].checked==true)
      		{
			document.theForm.tema1.value=document.theForm.tema1.value+"-"+document.forms[0].tema_1[i].value;
     		 contador=contador+1; 
       		}
	}
	for (i=0; i < cantidad2 ; i++ )
   	{
			if(document.forms[0].tema_2[i].checked==true)
      		{
			document.theForm.tema2.value=document.theForm.tema2.value+"-"+document.forms[0].tema_2[i].value;
     		 contador=contador+1; 
       		}
	}
	for (i=0; i < cantidad3 ; i++ )
		{	
			if(document.forms[0].tema_3[i].checked==true)
      		{
			document.theForm.tema3.value=document.theForm.tema3.value+"-"+document.forms[0].tema_3[i].value;
     		 contador=contador+1; 
       		}
		}	


	for (i=0; i < cantidad4 ; i++ )
		{	
			if(document.forms[0].tema_4[i].checked==true)
      		{
			document.theForm.tema4.value=document.theForm.tema4.value+"-"+document.forms[0].tema_4[i].value;
     		 contador=contador+1; 
       		}
		}	
	for (i=0; i < cantidad5 ; i++ )
		{	
			if(document.forms[0].tema_5[i].checked==true)
      		{
			document.theForm.tema5.value=document.theForm.tema5.value+"-"+document.forms[0].tema_5[i].value;
     		 contador=contador+1; 
       		}
		}	

	for (i=0; i < cantidad6 ; i++ )
		{	
			if(document.forms[0].tema_6[i].checked==true)
      		{
			document.theForm.tema6.value=document.theForm.tema6.value+"-"+document.forms[0].tema_6[i].value;
     		 contador=contador+1; 
       		}
		}	
	for (i=0; i < cantidad7 ; i++ )
		{	
			if(document.forms[0].tema_7[i].checked==true)
      		{
			document.theForm.tema7.value=document.theForm.tema7.value+"-"+document.forms[0].tema_7[i].value;
     		 contador=contador+1; 
       		}
		}	
	for (i=0; i < cantidad8 ; i++ )
		{	
			if(document.forms[0].tema_8[i].checked==true)
      		{
			document.theForm.tema8.value=document.theForm.tema8.value+"-"+document.forms[0].tema_8[i].value;
     		 contador=contador+1; 
       		}
		}	
	for (i=0; i < cantidad9 ; i++ )
		{	
			if(document.forms[0].tema_9[i].checked==true)
      		{
			document.theForm.tema9.value=document.theForm.tema9.value+"-"+document.forms[0].tema_9[i].value;
     		 contador=contador+1; 
       		}
		}			
		
	for (i=0; i < cantidad10 ; i++ )
		{	
			if(document.forms[0].tema_10[i].checked==true)
      		{
			document.theForm.tema10.value=document.theForm.tema10.value+"-"+document.forms[0].tema_10[i].value;
     		 contador=contador+1; 
       		}
		}			
		for (i=0; i < cantidad11 ; i++ )
		{	
			if(document.forms[0].tema_11[i].checked==true)
      		{
			document.theForm.tema11.value=document.theForm.tema11.value+"-"+document.forms[0].tema_11[i].value;
     		 contador=contador+1; 
       		}
		}		
			
		
    
		if(contador==0)
      {
			alert("Debe Seleccionar al menos una casilla");
      } else {
	  	  	
		  document.theForm.submit();
	  }

 } 
 
 
 
function alertaAmigo()						
{
	alert("Por favor, llene todos los campos");
	
}
function alertaEmail()						
{
	alert("Por favor, escribe un email valido");
	
}
function check_email(e) { 
	ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM"; 

	for(i=0; i < e.length ;i++){ 
		if(ok.indexOf(e.charAt(i))<0){ 
		return (false); 
		} 
	} 



	if (document.images) { 
		re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/; 
		re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/; 
		if (!e.match(re) && e.match(re_two)) { 
			return (-1); 
		} 

	} 

}

function check1(){

			
			if(document.theForm.nombre.value==""){ 
				alertaAmigo(); document.theForm.nombre.focus();
			
			} 
			
			
		else if(!check_email(document.theForm.email.value)){
			  	alertaEmail(); document.theForm.email.focus();
			 
			  }
			
			else if(document.theForm.sexo.value==""){ 
				alertaAmigo(); document.theForm.sexo.focus();
			
			}
			else if(document.theForm.codigopostal.value==""){ 
				alertaAmigo(); document.theForm.codigopostal.focus();
			
			}		
			else if(document.theForm.estado.value==""){ 
				alertaAmigo(); document.theForm.estado.focus();
			
			}				
			else if(document.theForm.ocupacion.value==""){ 
				alertaAmigo(); document.ocupacion.focus();
			
			}
			else if(document.theForm.sector.value==""){ 
				alertaAmigo(); document.theForm.sector.focus();
			
			}
			else if(document.theForm.edad.value==""){ 
				alertaAmigo(); document.theForm.edad.focus();
			
			} else { 
			alert('HOLA');
			document.theForm.submit();
			}
			
}

function validaActualiza(){

			
			if(document.theForm.nombre.value==""){ 
				alertaAmigo(); document.theForm.nombre.focus();
			
			} 
			
		
			else if(document.theForm.sexo.value==""){ 
				alertaAmigo(); document.theForm.sexo.focus();
			
			}
			else if(document.theForm.codigopostal.value==""){ 
				alertaAmigo(); document.theForm.codigopostal.focus();
			
			}		
			else if(document.theForm.estado.value==""){ 
				alertaAmigo(); document.theForm.estado.focus();
			
			}				
			else if(document.theForm.ocupacion.value==""){ 
				alertaAmigo(); document.ocupacion.sector.focus();
			
			}

			else if(document.theForm.sector.value==""){ 
				alertaAmigo(); document.theForm.sector.focus();
			
			}

            else { 
				document.theForm.submit();
			}
			
}


function check2(){

			if(document.theForm.asunto.value == ""){
				alert("Por favor llena el campo de asunto.");
				document.theForm.asunto.focus();
			}	else if(document.theForm.listInclude.value == ""){
				alert("Por favor selecciona una lista de suscritores.");
				document.theForm.listInclude.focus();
			}  else {
				document.theForm.submit();
			}

}

 function seleccionaListas(categ){
 	for (x=0;x < document.theFrom.tema_1.length;x++){
		alert();
	}
 }


