// JavaScript Document

function abrirpromocion()
{
	
	
	 var theURL="promocion.html";
  var winName="InterfaceAmigo";
  var features="scrollbars=no,width=760,height=560";
  var _W=window.open(theURL,winName,features); 
   _W.focus(); 
    iz=(screen.width-760) / 2;
    de=(screen.height-560) / 2;
    _W.moveTo(iz,de);
	
	
	}
	
//***********************************************************************************************
function check()
			{

			
			if(document.form.Nombre.value==""){ alerta(); document.form.Nombre.focus(); }
			else if(document.form.Apellidos.value==""){ alerta(); document.form.Apellidos.focus(); }
			else if(document.form.email.value==""){ alerta(); document.form.email.focus(); }			
			else if(!check_email(document.form.email.value)){ alert("Por favor, escriba un E-Mail Válido"); document.form.email.focus();}
			else if(document.form.Telefono.value==""){ alerta(); document.form.Telefono.focus(); }			
			else if(document.form.Comentarios.value==""){ alerta(); document.form.Comentarios.focus(); }						
			else
			{
			document.form.submit();
			}
			
			}
			
			
			function alerta(){
			
			alert("\nPor favor:\nComplete los campos obligatorios\n");
			
			}



function menu(estado)
{
	
	if(estado=='over')
	document.getElementById('submenu').style.display='block';
	else
	document.getElementById('submenu').style.display='none';	
	
	
	
	}
	
	
function favoritos(x){ 
	var url="http://www.coparmexmerida.org.mx";
	var titulo="Coparmex - Delegación Yucatán";
    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 cerrar(){
//setInterval("xajax_MostrarDestacado();",10000);
setTimeout("cerraventana();",4000);
}
function cerraventana(){	window.close();	}
 //*
 
 
 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(x)  { 

  var theURL="recomendar/enviaraunamigo.php?idioma=esp";
  var winName="InterfaceAmigo";
  var features="scrollbars=no,width=450,height=320";
  var _W=window.open(theURL,winName,features); 
   _W.focus(); 
    iz=(screen.width-450) / 2;
    de=(screen.height-320) / 2;
    _W.moveTo(iz,de);
 }
 
 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); 
} 

} 

}


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