function crearMenu(idPadre){

		var bloque = document.createElement('div');
		var padre = document.getElementById(idPadre);
		
		bloque.setAttribute('id','MenuPTS');
		padre.appendChild(bloque);
		
		crearSeccion('Seccion0','MenuPTS','block','seccionPrincipalMenu');

		//seccion PTS Granada
		//*******************************************************************
		anadirElemento('Seccion0','e1','PTS GRANADA','PTS_Granada.html','botonPtsGranada');			
		crearSeccion('Seccion1','e1','none','seccion');
		
		//detalle ENTORNO SALUDABLE
		anadirElemento('Seccion1','e1_1','Entorno Saludable','Entorno_Saludable.html','subSeccionPtsGranada');
		//detalle MISION
		anadirElemento('Seccion1','e1_2','Misión','Mision.html','subSeccionPtsGranada');
		//detalle PROMOTORES Y ALIANZAS
		anadirElemento('Seccion1','e1_3','Promotores y Alianzas','Promotores_Y_Alianzas.html','subSeccionPtsGranada');
		//detalle INFRAESTRUCTURAS
		anadirElemento('Seccion1','e1_4','Infraestructuras','Infraestructuras.html','subSeccionPtsGranada');
		
		//subseccion QUIENES SOMOS
		//------------------------------------------------------------
		anadirElemento('Seccion1','e1_5','Quienes Somos','Quienes_Somos.html','subSeccionPtsGranada');
		crearSeccion('Seccion1_1','e1_5','none','seccion');
		
		//detalle PRESENTE
		anadirElemento('Seccion1_1','e1_5_1','Presente','Presente.html','detallePtsGranada');
		//detalle FUTURO
		anadirElemento('Seccion1_1','e1_5_2','Futuro','Futuro.html','detallePtsGranada');
		//------------------------------------------------------------
		
		//detalle PROYECTOS
		anadirElemento('Seccion1','e1_6','Objetivos','Proyectos.html','subSeccionPtsGranada');
		anadirElemento('Seccion1','e1_7','Visitas Virtuales','http://www.3dvista.com/pts/','subSeccionPtsGranada');
		//*******************************************************************
		
		//seccion INVESTIGACI?N
		//*******************************************************************
		anadirElemento('Seccion0','e2','INVESTIGACION','Investigacion.html','botonInvestigacion');		
		crearSeccion('Seccion2','e2','none','seccion');
		
		//subseccion CENTROS DE INVESTIGACI?N
		//------------------------------------------------------------		
		anadirElemento('Seccion2','e2_1','Centros de Investigación','Centro_Investigacion.html','subSeccionInvestigacion');		
		/*crearSeccion('Seccion2_1','e2_1','none','seccion');
		
		anadirElemento('Seccion2_1','e2_1_1','Centro Investigación Biomédica','Centro_Inv_Biomedica.html','detalleInvestigacion');
		anadirElemento('Seccion2_1','e2_1_2','Instituto Parasitología Biomedicina Lopez Neyra, CSIC','IPB_Lopez_Neyra.html','detalleInvestigacion');
		anadirElemento('Seccion2_1','e2_1_3','Instituto Andaluz Medicina Legal','Inst_And_Medicina_Legal.html','detalleInvestigacion');		
		anadirElemento('Seccion2_1','e2_1_4','Laboratorio de Estudios Cristalográficos','LEC.html','detalleInvestigacion');
		anadirElemento('Seccion2_1','e2_1_5','Centro de Genómica e Investigación Oncológica','Genomica.html','detalleInvestigacion');
		anadirElemento('Seccion2_1','e2_1_6','Laboratorio-Observatorio Andaluz I+D+i Prevención de Riesgos Laborales','LabPrevencion.html','detalleInvestigacion');
		anadirElemento('Seccion2_1','e2_1_7','Centro Excelencia para la Investigación en Medicamentos Innovadores en Andalucía','CexMedicamentos.html','detalleInvestigacion');*/
		
		//------------------------------------------------------------
		
		//detalle 
		anadirElemento('Seccion2','e2_2','Investigación Privada','Investigacion_Privada.html','subSeccionInvestigacion');		
		
		//detalle LINEAS DE INVESTIGACI?N
		anadirElemento('Seccion2','e2_3','Líneas de Investigación','Lineas_Investigacion.html','subSeccionInvestigacion');		
		
		//subseccion SERVICIOS
		anadirElemento('Seccion2','e2_4','Servicios','Servicios_Investigacion.html','subSeccionInvestigacion');
			
		//*******************************************************************		
		
		//seccion DESARROLLO EMPRESARIAL
		anadirElemento('Seccion0','e3','DESARROLLO EMPRESARIAL','Desarrollo_Empresarial.html','botonDesarrolloEmpresarial');		
		crearSeccion('Seccion3','e3','none','seccion');			
		
		//subseccion BIC-GRANADA
		//------------------------------------------------------------		
		anadirElemento('Seccion3','e3_1','Centro BIC Granada','Centro_BIC_Granada.html','subSeccionDesarrolloEmpresarial');		
		crearSeccion('Seccion3_1','e3_1','none','seccion');
		
		//detalles
		anadirElemento('Seccion3_1','e3_1_1','Empresas','Empresas_BIC.html','detalleDesarrolloEmpresarial');
		anadirElemento('Seccion3_1','e3_1_2','Servicios','Servicios_BIC.html','detalleDesarrolloEmpresarial');
		
		//------------------------------------------------------------
		
		//subseccion CENTRO DE DESARROLLO FARMACEUTICO Y ALIMENTARIO
		//------------------------------------------------------------		
		anadirElemento('Seccion3','e4_1','Centro de Desarrollo Farmaceútico y Alimentario','Centro_Des_Farm_Alim.html','subSeccionDesarrolloEmpresarial');		
		
		//------------------------------------------------------------
		
		anadirElemento('Seccion3','e5_1','ROVI','ROVI.html','subSeccionDesarrolloEmpresarial');		
		anadirElemento('Seccion3','e6_1','Telefónica I+D','Telefonica.html','subSeccionDesarrolloEmpresarial');	
		anadirElemento('Seccion3','e7_1','SERVILENS FIT&COVER','ServilensFit.html','subSeccionDesarrolloEmpresarial');	
		anadirElemento('Seccion3','e8_1','Master Diagnóstica','Master.html','subSeccionDesarrolloEmpresarial');
		anadirElemento('Seccion3','e9_1','Centro de Empresas IDEA','IDEA.html','subSeccionDesarrolloEmpresarial');			
		//*******************************************************************
		
		//seccion ASISTENCIA SANITARIA
		//*******************************************************************
		anadirElemento('Seccion0','e4','ASISTENCIA SANITARIA','Asistencia_Sanitaria.html','botonAsistenciaSanitaria');		
		crearSeccion('Seccion4','e4','none','seccion');
		
		//detalle HOSPITAL UNIVERSITARIO
		anadirElemento('Seccion4','e4_1','Hospital Universitario','Hospital_Universitario.html','subSeccionAsistenciaSanitaria');
		
		//detalle CMAT 061 EMERGENCIAS
		anadirElemento('Seccion4','e4_2','CMAT 061 Emergencias','CMAT_Emergencias.html','subSeccionAsistenciaSanitaria');
		//*******************************************************************
		
		//seccion DOCENCIA
		anadirElemento('Seccion0','e5','DOCENCIA','Docencia.html','botonDocencia');
		// -- v
		crearSeccion('Seccion5','e5','none','seccion');
		anadirElemento('Seccion5','e5_1','OTRI','OTRI.html','subSeccionDocencia');
		// -- ^ 
		
		//seccion SERVICIOS
		anadirElemento('Seccion0','e6','SERVICIOS','Servicios.html','botonServicios');
		
		//seccion ENLACES
		anadirElemento('Seccion0','e7','ENLACES','Enlaces.html','botonEnlaces');
				
		//seccion PREGUNTAS
		anadirElemento('Seccion0','e8','PREGUNTAS SALUD','Preguntas.html','botonPreguntas');
		
	}

	//funcion que crea una seccion
	function crearSeccion(idSec, idPadre, display, estilo){
	
		//creamos un elemento de tipo lista
		var seccion = document.createElement('ul');

		//obtenemos el padre
		var padre = document.getElementById(idPadre);

		var abuelo = padre.parentNode;

		//completamos las propiedades de la seccion
		//seccion.setAttribute('style','display:none');
		seccion.setAttribute('id',idSec);
		seccion.className = estilo;
		seccion.style.display = display;

		if(idSec!='Seccion0'){
			funcion = function () {
				Alternar(this);
			};
			padre.onclick = funcion;
		}
		
		//aniadimos el elemento al padre
		abuelo.appendChild(seccion);
	}

	//funcion que aniade un elemento a una seccion
	function anadirElemento(idSec,idElement,text,ref,estilo){
		//obtenemos la secci?n
		var seccion = document.getElementById(idSec);

		//creamos el elemento
		var elemento = document.createElement('li');
		var Texto = document.createTextNode(text);
		var enlace = document.createElement('a');

		enlace.setAttribute('href',ref);		
		
		if(idElement=='e1_7'){
			enlace.setAttribute('target',"_blank");
		}
		//frame donde vamos a cargar la pagina referenciada
		else{
			if(ref!='#'){
			enlace.setAttribute('target',"");
			//enlace.setAttribute('target',"iframe");
			}
		}
		
		
		//completamos las propiedades del elemento		
		enlace.appendChild(Texto);
		elemento.appendChild(enlace);
		
		elemento.className = estilo;
		elemento.setAttribute('id',idElement);

		//aniadimos a esa seccion un elemento
		seccion.appendChild(elemento);
	}

	//funcion que despliega una seccion o la oculta
	function Alternar(Seccion1){
	
		//El siguiente hermano es la seccion en si
		Seccion = Seccion1.nextSibling;
		var padre = Seccion.parentNode;
		var hijo = padre.firstChild;

		//cerramos todos los hermanos	
		while(hijo){
			if(hijo.tagName=='UL'){
				if(hijo==Seccion){
					if (Seccion.style.display=="none"){
						Seccion.style.display="block";
					}
					//La secci?n est? desplegada
					else{
						Seccion.style.display="none";
					}	
				}
				else{
					hijo.style.display = "none";
				}
			}
			hijo = hijo.nextSibling;
		}

	}
	
	