var arrEmail=[105,110,102,111,64,100,111,110,99,117,114,115,111,115,46,99,111,109]
var infodoncursos='' //variable to contain encrypted email 
for (var i=0; i<arrEmail.length; i++)
 infodoncursos+=String.fromCharCode(arrEmail[i])
enlaceEmailContacto = '<a href="mailto:' + infodoncursos + '">' + infodoncursos + '</a>';

var esEmail=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;
 
function enviarbusqueda(form) {
	if (form.q.value != "" && form.q.value.length > 2) {
		form.submit();
	}
}
function enviarSugerencias(form){
	var texto = "";
	if (!form.campoAsunto.value) {texto += "- Falta seleccionar el asunto.\n";}
	if (!esEmail.test(form.campoEmail.value)) {texto += "- Falta o es erróneo tu e-mail para contestarte.\n";}
	if (!form.campoMensaje.value) {texto += "- Falta introducir el mensaje.\n";}
	if (texto) {
		alert("Se han encontrado los siguientes errores:\n\n" + texto);
		return false;
	} else {return true;}
}

function agregarFavoritos(){
   if ((navigator.appName=="Microsoft Internet Explorer") && 
         (parseInt(navigator.appVersion)>=4)) {
      var url= document.location.href; 
      var titulo=document.title;
      window.external.AddFavorite(url,titulo);
   } else { 
      if(navigator.appName == "Netscape") 
         alert("Presione Crtl+D para agregar este sitio en sus Bookmarks"); 
   }
}

function aceptarAvisoLegal(){
	opener.document.formularioaltacentros.avisolegal.checked = true;
	window.close();
}

function enviarDatosCentro(form){
	var texto = "";
	if (!form.nombre.value) {texto += "- Nombre del Centro.\n";}
	if (!form.url.value || form.url.value == "http://") {texto += "- Nombre de la URL del Centro.\n";}
	if (!form.email.value) {texto += "- Dirección e-mail de contacto.\n";}
	if (!form.avisolegal.checked) {texto += "- Leer y aceptar el aviso legal.";}
	if (texto) {
		alert("Se han encontrado los siguientes errores:\n\n" + texto);
		return false;
	} else {return true;}
}