/* FUNCIONES JAVASCRIPT */

// Muestra emails por pantalla
// con cierta seguridad contra Spambots
function showEmail(user,domain,extension){
    email=user + "@" + domain + "." + extension;
    document.write('<a href="mailto:'+email+'">'+email+'</a>');
}

function menu (id, action){
   var style = document.getElementById(id).style;
	var x=0;
	var y=0;
	switch(id)
	{
       case "inicio":
	    	x= " 0px";
    		break;
       case "agenda":
	    	x= " -100px";
    		break;
       case "articulos":
	    	x= " -214px";
    		break;
       case "noticias":
	    	x= " -325px";
    		break;
       case "hemeroteca":
	    	x= " -453px";
    		break;
       case "asociacion":
	    	x= " -602px";
    		break;
	}

	switch (action)
	{
      case "over":
		y=" -81px"
		break;
	  case "out":
		y=" -0px"
		break;
	  case "click":
		y=" -162px"
			switch(id)
			{
            //acciones
                case "inicio":
					window.location.href="index.php";
					break;
                case "agenda":
					window.location.href    ="http://www.aemc.org.es/agenda/";
					break;
                case "articulos":
					window.location.href    ="http://www.aemc.org.es/articulos/";
					break;
                case "noticias":
					window.location.href    ="http://www.aemc.org.es/noticias/";
					break;
                case "hemeroteca":
					window.location.href    ="http://www.aemc.org.es/documentos/";
					break;
                case "asociacion":
						window.location.href="http://www.aemc.org.es/asociacion.html";
					break;
			}
		break;
  	  case "on":
       // alert("entre");
		y=" -162px"
		break;
	}
	valor =x +" " + y;
   //alert (valor);
	style.backgroundPosition = valor;
}

function comprobar_agenda()
{
  	if(isEmpty(document.getElementById('nombre').value)){
		document.getElementById('nombre').style.backgroundColor='#FFCCCC';
		alert("Falta campo nombre");
		document.getElementById('nombre').focus();
		return false;
	}else{
       document.getElementById('nombre').style.backgroundColor='#CCCC00';
	}

   	if(isEmpty(document.getElementById('email').value)){
		document.getElementById('email').style.backgroundColor='#FFCCCC';
		alert("Falta campo email");
		document.getElementById('email').focus();
		return false;
	}
   	document.frmEmail.submit();
    return true;
}
