
	function dame_correo(usuario,dominio){
	   return usuario + '@' + dominio
	}

	function escribe_correo(usuario,dominio){
	   document.write("<a href='mailto:" + dame_correo(usuario,dominio) + "'>" + dame_correo(usuario,dominio) + "</a>")
	}
	function escribe_correo_mensaje(usuario,dominio,mensaje){
	   document.write("<a href='mailto:" + dame_correo(usuario,dominio) + "'>" + mensaje + "</a>")
	}



	function enviarFormularioContacto(n_form){

	   mandar = true;
       form = document.getElementById(n_form)
	   if (form.nombre.value < 1){
			alert("Error, debe escribir un Nombre válido.");
			form.nombre.focus();
			mandar = false;            
        }
        if ((form.email.value < 8)&&(form.telefono.value < 1)){
			alert("Error, debe escribir un Email o Télefono valido.");
			form.email.focus();
			mandar = false;            
        }		
		
	   if (mandar){
			form.submit();		
	   }
	}
	
 	
	
	
	function enviarFormularioEventos(form){
		
        if (form.titulo.value < 1){
			alert("Error, debe escribir un Titulo válido.");
			form.titulo.focus();
            return(false);
        }
        if (form.titulo_corto.value < 1){
			alert("Error, debe escribir un Titulo Corto válido.");
			form.titulo_corto.focus();
            return(false);
        }
		
		 if  (isDate(form.fecha_orden.value) == false){
			alert("Error, debes introducir una fecha válida.");
			form.fecha_orden.focus();
            return(false);
        }
				
		form.submit();		
	}
	
	
	function enviarFormularioSocios(form){
		
        if (form.nombre.value < 3){
			alert("Error, debe escribir un nombre válido.");
			form.nombre.focus();
            return(false);
        }
		if (form.apellido_1.value < 2){
			alert("Error, debe escribir un apellido válido.");
			form.apellido_1.focus();
            return(false);
        }

		if (form.fecha_nacimiento.value != ""){
			if  (isDate(form.fecha_nacimiento.value) == false){
				alert("Error, debes introducir una fecha válida.");
				form.fecha_nacimiento.focus();
            	return(false);
			}
			
        }
		
		
		especialidad = false
		for (i=0; i< form.elements.length; i++) {
			if (form.elements[i].type == "checkbox" && form.elements[i].checked == true) { 
				especialidad = true;
			}
		}
		if (especialidad == false){
			alert("Error, debe elegir al menos una especialidad.");
            return(false);
        }
		form.submit();
	}






	function cambiarFotoEventos(evento,foto,titulo_corto){

		document.getElementById('eventos_imagen').src = 'imagenes/ficheros/med/'+foto+'.jpeg';	
		document.getElementById('eventos_enlace').href = 'evento.asp?idevento='+evento;

		document.getElementById('eventos_titulo').innerHTML = '<a href="evento.asp?idevento='+evento+'">'+titulo_corto+'</a>';
		
	}
	
	
	
	function cambiarFoto(tipo,evento,foto,titulo_corto){

		document.getElementById(''+tipo+'_imagen').src = 'imagenes/ficheros/med/'+foto+'.jpeg';	
		document.getElementById(''+tipo+'_enlace').href = 'evento.asp?idevento='+evento;

		document.getElementById('index_c_'+tipo+'_titulo').innerHTML = '<a href="evento.asp?idevento='+evento+'">'+titulo_corto+'</a>';
		
	}


	var nav4 = window.Event ? true : false;
	function acceptNum(evt){	
		// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57	
		var key = nav4 ? evt.which : evt.keyCode;	
		if (key == 13) {
			enviar();
		}else{
			return (key <= 13 || (key >= 48 && key <= 57));
		}
		return false;
	}

	function enviarFormulario(form){
		
		for (i=0; i< form.elements.length; i++) {
			if (form.elements[i].type == "text" && form.elements[i].value == "") {  
				alert("Por favor complete todos los campos del formulario");
				form.elements[i].focus(); 
				return false;
			}
		}			
		form.submit();
	}



	function  isDate(sDate) { 
		
		var  match  =  sDate.match(/^(\d\d?)\/(\d\d?)\/(\d{4})$/);
		if  (!match)  {  return  false;  }//no  es  una  fecha valida
		return  true;
	}


	function crearPopUp(URL, Nombre, popW, popH, scr, resize) {
		var winleft = (screen.width - popW) / 2;
		var winUp = (screen.height - popH) / 2;
		popW = popW + 20;
		popH = popH + 20;	
		winProp ='width='+popW+',height='+popH+',left='+winleft+',top='+winUp+',scrollbars='+scr+',resizable='+resize+',location=no';
		Win = window.open(URL, Nombre, winProp);
		Win.window.focus();
	}



	function text(c){
	
		var entra=new Array('\n' ,'\t');
		var sale =new Array('','&nbsp;&nbsp;&nbsp;&nbsp;');
		nt= "";
		for(var q=0; q < c.length; q++){
			nc = c.charAt(q)
			for(var w=0; w < entra.length ;w++){
				if(c.charAt(q) == entra[w]){
					nc = sale[w];
					break;
				}
			}
			nt+= nc;
		}
		
		text = nt;
		return text;
	}


	function setH() {
    	var maxH = Math.max(document.getElementById('menu_lateral').offsetHeight,document.getElementById('cuerpo_central').offsetHeight);
        document.getElementById('menu_lateral').style.height=maxH+'px';
	    document.getElementById('cuerpo_central').style.height=maxH+'px';
    }
    
 	//window.onload=setH;

	function hideSelects(action) {
		//documentation for this script at http://www.shawnolson.net/a/1198/
		//possible values for action are 'hidden' and 'visible'
		if (action!='visible'){action='hidden';}
		if (document.all) {
			for (var S = 0; S < document.forms.length; S++){
				for (var R = 0; R < document.forms[S].length; R++) {
					if (document.forms[S].elements[R].options) {
						document.forms[S].elements[R].style.visibility = action;
					}
				}
			}
		}
	}