function PopupImage(url,titre){
  var img=null;
  img=new Image();
  img.src=url;
  waitForLoading();

  function waitForLoading(){
    if(!img.complete) {setTimeout(waitForLoading, 30); return;}
    
    if(titre==undefined){titre='';} else{titre=' : '+titre;}
    var start=Math.max(url.indexOf('=',0)+1,0);
    if(url.indexOf('&',0)==-1){var len=url.length-start;} else{var len=url.indexOf('&',0);}
    w=img.width; h=img.height;

    if((typeof(poplp)=='undefined')||poplp.closed){
      var top=(screen.height-h)/2; var left=(screen.width-w)/2;
      poplp=window.open('', 'lpimg', 'location=no,directories=no,status=no,menubar=no,toolbar=no,scrollbars=no,resizable=yes,top='+top+',left='+left+',width='+w+',height='+h);
    }
    else{poplp.resizeBy(img.width-poplp.document.body.clientWidth,img.height-poplp.document.body.clientHeight);}
    
    poplp.document.write('<?xml version="1.0" encoding="iso-8859-1"?>\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">\n<head>\n  <meta http-equiv="Content-Script-Type" content="text/javascript"/>\n  <meta http-equiv="Content-Style-Type" content="text/css"/>\n  <style type="text/css">html, body {height: 100%;}</style>\n  <title>Association Life Parade'+titre+'</title>\n');
    poplp.document.write('  <script type="text/javascript">\n    function imgwidth(){return Math.min(document.body.clientWidth,'+w+');}\n    function imgheight(){return Math.min(document.body.clientHeight,'+h+');}\n    function imgresize(){\n      var ww=imgwidth();\n      var hh=imgheight();\n      if(ww/hh>'+w+'/'+h+'){\n        document.getElementById("img").height=hh;\n        document.getElementById("img").width=hh*'+w+'/'+h+';\n      }\n      else{\n        document.getElementById("img").width=ww;\n        document.getElementById("img").height=ww*'+h+'/'+w+';\n      }\n    }\n    function popresize(){window.resizeBy('+w+'-document.body.clientWidth,'+h+'-document.body.clientHeight);}\n    window.onload=popresize;\n    window.onresize=imgresize;\n  </script>\n');
    poplp.document.write('</head>\n<body style="margin: 0; padding: 0; overflow: hidden;" bgcolor="#000000">\n');
    poplp.document.write('<table width="100%" cellspacing="0" cellpadding="0" border="0" style="height: 100%;">\n  <tr valign="middle">\n    <td align="center">\n');
    poplp.document.write('      <img src="'+url.replace(/\&/g,'&amp;')+'" onclick="document.location.href=\'download.php?file='+url.substring(start,len)+'\'" title="Cliquez pour t&eacute;l&eacute;charger l\'image" style="cursor: pointer;" border="0" alt="image'+titre+'" id="img"/>\n');
    poplp.document.write('    </td>\n  </tr>\n</table>\n');
    poplp.document.write('</body>\n</html>');
    poplp.document.close();
    poplp.focus();
  }  
}  
