function showcalendar(page,pwidth,pheight) {
    createPopUp(page,"ActiveCalendarWindow",pwidth,pheight,"no","no");
}

function createPopUp(theURL, Name, popW, popH, scroll, resize) {
    var winleft = (screen.width - popW) / 2;
    var winUp = (screen.height - popH) / 2;
    winProp = 'width='+popW+',height='+popH+',left='+winleft+',top='+winUp+',scrollbars='+scroll+',resizable='+resize+'';
    Win = window.open(theURL, Name, winProp);
    Win.window.focus();
}

function getInicio(year,month,day) {
    self.close();
    opener.setInicio(day,month,year);
}

function getFin(year,month,day) {
    self.close();
    opener.setFin(day,month,year);
}

function getFecha(year,month,day) {
    self.close();
    opener.setFecha(day,month,year);
}

function setInicio(day,month,year) {
    date=day+'/'+month+'/'+year;
    document.buscarEventos.ini.value = date;
}

function setFin(day,month,year) {
    date=day+'/'+month+'/'+year;
    document.buscarEventos.fin.value = date;
}

function setFecha(day,month,year) {
    date=day+'/'+month+'/'+year;
    document.evento.fecha.value = date;
}

function expandSection(id) {
    var mySection = document.getElementById(id);
    if(mySection.style.display == "block") {
        mySection.style.display = "none";
    } else {
        mySection.style.display = "block";
    }
}

function expandBuscar() {
    var secBuscar = document.getElementById('buscador');
    var secNueva = document.getElementById('formEvento');
    if(secBuscar.style.display == "block") {
        secBuscar.style.display = "none";
    } else {
        secBuscar.style.display = "block";
        secNueva.style.display = "none";
    }
}

function expandNueva() {
    var secBuscar = document.getElementById('formEvento');
    var secNueva = document.getElementById('buscador');
    if(secBuscar.style.display == "block") {
        secBuscar.style.display = "none";
    } else {
        secBuscar.style.display = "block";
        secNueva.style.display = "none";
    }
}


// Menu
sfHover = function() {
    var sfEls = document.getElementById("nav").getElementsByTagName("LI");
    for (var i=0; i<sfEls.length; i++) {
        sfEls[i].onmouseover=function() {
            this.className+=" sfhover";
        }
        sfEls[i].onmouseout=function() {
            this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
        }
    }
}

if (window.attachEvent) window.attachEvent("onload", sfHover);
