function openImage(imageId, imageWidth, imageHeight) {
  openPopup (imageHeight, imageWidth, "/image.php?id="+imageId, "gallerie", "fullscreen=no,toolbar=no,menubar=no,location=no,status=no,scrollbars=no,resizable=no");
}
function openSelec(selecId) {
  openPopup (400, 500, "/marche_du_livre/livre.php?id="+selecId, "selection", "fullscreen=no,toolbar=no,menubar=no,location=no,status=no,scrollbars=yes,resizable=no");
}
function openSelecImage(selecId, imageHeight, imageWidth) {
        openPopup (imageHeight, imageWidth, "/marche_du_livre/image.php?id="+selecId, "selection", "fullscreen=no,toolbar=no,menubar=no,location=no,status=no,scrollbars=yes,resizable=no");
}


var newwin;
function openPopup(win_height, win_width, winurl, winname, winfeatures) {
  posX = (window.screen.width-win_width)/2;
  posY = (window.screen.height-win_height)/2;

  //This launches a new window and then
  //focuses it if window.focus() is supported.
  winfeatures_str = "height="+win_height+",width="+win_width+","+winfeatures;
  
  newwin = window.open(winurl, winname, winfeatures_str);
  
  setTimeout('newwin.focus();',250);
  if (window.moveTo){
    newwin.moveTo(posX,posY);
  }
}



//*****************************************************************
// Gestion du footer
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;
}
function setFooter() {
  if (document.getElementById) {
    var windowHeight = getWindowHeight();
    if (windowHeight > 0) {
      var contentHeight = document.getElementById('content_global').offsetHeight;
      var footerElement = document.getElementById('footer');
      var footerHeight  = footerElement.offsetHeight;
      if (windowHeight - (contentHeight + footerHeight) >= 0) {
        footerElement.style.position = 'absolute';
        footerElement.style.top = (windowHeight - footerHeight) + 'px';
      } else {
        footerElement.style.position = 'static';
      }
    }
  }
}
window.onload = function() {
  // setFooter();
}
window.onresize = function() {
  // setFooter();
}
//*****************************************************************
