function getFecha(){
    var dayNames = new Array("Domingo", "Lunes","Martes","Miercoles","Jueves","Viernes","Sabado");
    var monthNames = new Array( "Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
    var now = new Date();

    thisYear = now.getYear();
    if(thisYear < 1900) {thisYear += 1900}; // corrections if Y2K display problem
    document.write(dayNames[now.getDay()] + ", " + now.getDate() + " de " + monthNames[now.getMonth()] + " de " + thisYear);        
}

function swapImage(element,source) { 
    var img;
    img = document.getElementById(element)
    img.src=source;
}

function resizeElements() {

    if (document.getElementById) {
        
        /*ASIGNAR ALTO DE CONTENIDO*/
        var windowHeight=getWindowHeight();        
        
        if (windowHeight>0) {
        
            var contentElement=document.getElementById('bloque_central'); 
                       
            var headerHeight=document.getElementById('page_header').offsetHeight;
            var footerHeight=document.getElementById('page_footer').offsetHeight;
            
            if (contentElement != null){                
                var contentHeight=document.getElementById('bloque_central').offsetHeight;
            }
                         
            if ((windowHeight-(headerHeight + footerHeight + contentHeight))>=0) {
                contentElement.style.height= windowHeight - headerHeight - footerHeight + 'px';
            }            
        }               
    }
}

function getWindowHeight() {
    var windowHeight=0;
    if (typeof(window.innerHeight)=='number') {
        windowHeight=window.innerHeight;
    }
    else {
        if (document.documentElement&&document.documentElement.clientHeight) {
            windowHeight=document.documentElement.clientHeight;
        }
        else {
            if (document.body&&document.body.clientHeight) {
            windowHeight=document.body.clientHeight;
            }
        }
    }
return windowHeight;
}

activateMenu = function(nav) {

    //currentStyle restricts the Javascript to IE only
	if (document.all && document.getElementById(nav).currentStyle) {  
        var navroot = document.getElementById(nav);
        
        //Get all the list items within the menu 
        var lis=navroot.getElementsByTagName("LI");  
        for (i=0; i<lis.length; i++) {
        
           // If the LI has another menu level 
            if(lis[i].lastChild.tagName=="UL"){
            
                // assign the function to the LI 
             	lis[i].onmouseover=function() {	
                
                   // display the inner menu 
                   this.lastChild.style.display="block";
                   this.lastChild.style.overflow="visible";
                   
                }
                lis[i].onmouseout=function() {                       
                   this.lastChild.style.display="none";
                }
            }
        }
    }
}

window.onload = function() {  
  activateMenu('nav'); 
  resizeElements();   
}

window.onresize = function() {
  resizeElements();  
}
