function showimages (iddiv, nbimages) {
  // moreimgs = window.open('','moreimgs','width=600,height=300,scrollbars=1,resizable=1,copyhistory=no');
  var rows = nbimages % 4;
  var cols = parseInt(nbimages/4)+1;
  moreimgs = CenterPopup('','moreimgs',rows*100,cols*100,1,1);
  moreimgs.document.open();
  moreimgs.document.write('<html><head><title>Images produit</title></head><body  style=\'margin:0px; \'>'+document.getElementById(iddiv).innerHTML+'</body></html>');
  moreimgs.document.close(); 
}

function showvideo (popupurl, filetitle) {
  // window.open(popupurl,'showvideo','width=600,height=370,scrollbars=0,resizable=1,copyhistory=no');
  CenterPopup(popupurl,'showvideo',600,380,0,1);
 // alert("Lancement du player avec la vidéo : "+filetitle); 
}

/* Ouverture de popup centrée, auto-adaptée si écran trop petit */
function CenterPopup(winURL, winName, winWidth, winHeight, winScroll, winResize) {
    winResize = !winResize ? 0 : winResize;
    winHeight = winWidth > screen.width - 30 && winScroll == 0 ? winHeight + 16 : winHeight;
    winWidth = winHeight > screen.height - 20 && winScroll == 0 ? winWidth + 16 : winWidth;
    winScroll = winHeight > screen.height - 30 || winWidth > screen.width - 30 ? 1 : winScroll;
    winHeight = Math.min(winHeight, screen.height - 30);
    winWidth = Math.min(winWidth, screen.width - 20);
    winLeft = (screen.width - winWidth) / 2 - 5;
    winTop = (screen.height - winHeight) / 2 - 15;
    return window.open(winURL, winName, "width=" + winWidth + ",height=" + winHeight + ",left=" + winLeft + ",top=" + winTop + ",scrollbars=" + winScroll + ",resizable=" + winResize + ",copyhistory=no");
}

