var section = 0;
var timeOut = 0;
var status = 0;

var showDelay = 100;
var hideDelay = 400;

function showMenu(idMenu) {

     if (status == 0) {
       section = idMenu;
       status = 1;
       timeOut = setTimeout("show();", showDelay);
     } else if (status == 3) {
       clearTimeout(timeOut);
       if (idMenu == section) {
	   status = 2;
       } else {
	   hide();
           section = idMenu;
           status = 1;
           timeOut = setTimeout("show();", showDelay);           
       }

     }
}

function hideMenu() {
     if (status == 2) {
        status = 3;
        timeOut = setTimeout("hide();", hideDelay);
     } else if (status == 1) {
        clearTimeout(timeOut);
        status = 0;
     }
}

function showSection() {
     if (status == 3) {
        status = 2;
        clearTimeout(timeOut);
     }
}

function hideSection() {
     if (status == 2) {
	status = 3;
           timeOut = setTimeout("hide();", hideDelay);           
     }
}

function show() {
     element = document.getElementById("menu"+section);
     element.style.display = "block";
     status = 2;
}

function hide() {
     element = document.getElementById("menu"+section);
     element.style.display = "none";
     section = 0;
     status = 0;
}

function winopen(url) {
  window.open('imageshow.php?'+url,'image','width=800,height=600,top=30,left=30,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes');
}

