function funcion() {
	var aler='';
	if (document.getElementById && document.createElement) {
		node = document.getElementById('menuBar');
		for (i = 0; i < node.childNodes.length; i++) {
			li = node.childNodes[i];
			if (li.nodeName == "LI") {
				li.setAttribute('style','display: block;');
				ul = li.getElementsByTagName('ul')[0];
				if(ul != undefined){
					aler = aler + '\n'+ul.id+'\n';				
					enlace = ul.getElementsByTagName('li');
					var ya = 'true';
					for (w = 0; w < enlace.length; w++) {
						a = enlace[w].getElementsByTagName('a');
						for (q = 0; q < a.length; q++) {
							//aler = aler + '\n' +location.href+ '   '+a[0].href+ '   '+location.href.indexOf(a[0].href);
							if (location.href==a[0].href){//location.href.indexOf(a[0].href)>=0){
								$('#menuBar ul:visible').slideUp('normal');
								$(ul).show();//slideDown('normal');
								a[0].setAttribute('style','font-weight:bold;');
								ya = 'false';
							}/*else if (ya='true' && location.href.lastIndexOf(ul.id)>=0 ){
								ya = 'false';
								aler = aler + '\n'+location.href+' contiene '+ul.id+'='+location.href.lastIndexOf(ul.id)+'\n'+ul.id+'\n'+ya;	
								$('#menuBar ul:visible').slideUp('normal');
								$(ul).show();//slideDown('normal');
							}*/
						}
					}
				}
				//alert('Muestra li: '+li.tagName);
				//}
			}
		}
	} 
	
	//alert(aler);
}

function initMenu() {
  $('#menuBar ul').hide();
//	$('#menuBar ul').show();
	//$('#menuBar ul:visible').slideUp('normal');
	//alert("Enseņa en el menu: "+location.href);
	funcion();
 // $('#menuBar ul:first').hide();
  $('#menuBar li a').click(
    function() {
    
      var checkElement = $(this).next();      
      var idElementoPinchado=checkElement.attr("id");   
      var etiqueta=document.getElementById("etiqueta"+idElementoPinchado);                 
      var textoSeccion=document.getElementById("textoSeccion");                       
      textoSeccion.innerHTML=etiqueta.value;      
                
      if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
        return false;
        }
      if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
        $('#menuBar ul:visible').slideUp('normal');
        checkElement.slideDown('normal');
        return false;
        }
        
        
        
        
      }
    );
  }
$(document).ready(function() {initMenu();});


