function popImage (img)
{
	var w = open ("", 'image', 'width=1, height=1, toolbar=no, scrollbars=yes, resizable=no, left=0, top=0'); 

	w.document.write ("<script type='text/javascript'>\n"); 

	w.document.write ("function checksize ()\n");
	w.document.write ("{\n");
	w.document.write ("  if (document.images[0].complete)\n");
	w.document.write ("  {\n");
	w.document.write ("    var width;\n");
	w.document.write ("    var height;\n");
	w.document.write ("    var offset = 20;\n");
	w.document.write ("\n");
	w.document.write ("    var ratioWidth = (document.images[0].width + offset) / screen.availWidth;\n");
	w.document.write ("    var ratioHeight = (document.images[0].height + offset) / screen.availHeight;\n");
	w.document.write ("\n");
	w.document.write ("    if (ratioWidth > 1)\n");
	w.document.write ("      width = screen.availWidth;\n");
	w.document.write ("    else\n");
	w.document.write ("      width = document.images[0].width + offset;\n");
	w.document.write ("\n");
	w.document.write ("    if (ratioHeight > 1)\n");
	w.document.write ("      height = screen.availHeight;\n");
	w.document.write ("    else\n");
	w.document.write ("      height = document.images[0].height + offset;\n");
	w.document.write ("\n");
	w.document.write ("    window.resizeTo (width, height);\n");
	w.document.write ("    window.focus ();\n");
	w.document.write ("  }\n");
	w.document.write ("  else\n");
	w.document.write ("  {\n");
	w.document.write ("    settimeout ('checksize ()', 250)\n");
	w.document.write ("  }\n");
	w.document.write ("}\n"); 

	w.document.write ("</script>\n"); 

//	w.document.write ("<body onload='checksize()' onblur='window.close()' onclick='window.close()' topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>"); 
	w.document.write ("<body onLoad='checksize()' onClick='window.close ();' onContextMenu='return (false);' style='margin: 0 0 0 0;'>\n"); 
	w.document.write ("<img style='cursor: pointer' src='" + img + "' alt='" + img + "' title='Cliquez pour Fermer' />\n"); 

	w.document.close (); 
} 

function popImageLogo (img, title)
{
	var w = open ("", 'image', 'width=1, height=1, directories=no, menubar=no, status=no, location=no, toolbar=no, scrollbars=yes, resizable=yes, left=0, top=0'); 

    w.document.write( "<html>\n");
	w.document.write ("<head>\n");
	w.document.write ("<title>"+title+"</title>\n"); 
	w.document.write ("<script type='text/javascript'>\n"); 

	w.document.write ("function checksize ()\n");
	w.document.write ("{\n");
	w.document.write ("  if (document.images[0].complete)\n");
	w.document.write ("  {\n");
	w.document.write ("    var width;\n");
	w.document.write ("    var height;\n");
	w.document.write ("\n");
	w.document.write ("    var ratioWidth = (document.images[0].width) / screen.availWidth;\n");
	w.document.write ("    var ratioHeight = (document.images[0].height) / screen.availHeight;\n");
	w.document.write ("\n");
	w.document.write ("    if (ratioWidth > 1)\n");
	w.document.write ("      width = screen.availWidth;\n");
	w.document.write ("    else\n");
	w.document.write ("      width = document.images[0].width + 20;\n");
	w.document.write ("\n");
	w.document.write ("    if (ratioHeight > 1)\n");
	w.document.write ("      height = screen.availHeight;\n");
	w.document.write ("    else\n");
	w.document.write ("      height = document.images[0].height + 90;\n");
	w.document.write ("\n");
	w.document.write ("    window.resizeTo (width, height);\n");
	w.document.write ("    window.focus ();\n");
	w.document.write ("  }\n");
	w.document.write ("  else\n");
	w.document.write ("  {\n");
	w.document.write ("    settimeout ('checksize ()', 250)\n");
	w.document.write ("  }\n");
	w.document.write ("}\n"); 
	w.document.write ("</script>\n"); 
	w.document.write ("</head>\n");

	w.document.write ("<body onLoad='checksize()' onClick='window.close ();' onContextMenu='return (false);' style='margin: 0 0 0 0;'>\n"); 
	w.document.write ("<img style='cursor: pointer' src='/common/scripts/imageLogo.php?image=" + img + "' alt='photo : " + title + "' title='" + title + "' />\n"); 
	w.document.write ("</body>\n");

	w.document.close (); 
} 

function showCaserneImage (img, title)
{

	var reg = new RegExp (".jpg", "g");
	var miniImg = img.replace (reg, "_mini.jpg");

	document.write ('<br />');
	document.write ('<div style="text-align: center;">');
	document.write ('<a href="javascript:popImageLogo(\'../../mili/photos/casernes/' + img + '\', \'' + title + '\')">');
	document.write ("<img src='/common/scripts/imageMini.php?image=../../mili/photos/casernes/" + img + "' alt='photo : " + title + "' title='" + title + "' />\n"); 
	document.write ('<br />');
	document.write ('</a>');
	document.write ('<div style="margin: auto; width: 400px;">');
	document.write (title);
	document.write ('</div>');
	document.write ('</div>');
}

function showRegimentImage (img, title)
{

	var reg = new RegExp (".jpg", "g");
	var miniImg = img.replace (reg, "_mini.jpg");

	document.write ('<br />');
	document.write ('<div style="text-align: center;">');
	document.write ('<a href="javascript:popImageLogo(\'../../mili/photos/regiments/' + img + '\', \'' + title + '\')">');
	document.write ("<img src='/common/scripts/imageMini.php?image=../../mili/photos/regiments/" + img + "' alt='photo : " + title + "' title='" + title + "' />\n"); 
	document.write ('<br />');
	document.write ('</a>');
	document.write ('<div style="margin: auto; width: 400px;">');
	document.write (title);
	document.write ('</div>');
	document.write ('</div>');
}

function showActeImage (img, title)
{
	var reg = new RegExp (".jpg", "g");

	document.write ('<br />');
	document.write ('<div style=" text-align: center;">');

	document.write ('<a href=\'javascript:popImage ("' + img + '")\'>');

	document.write ('<img style="max-width: 600px; max-height: 600px;" alt="' + title + '" title="' + title + '" src="' + img + '">');
	document.write ('<br />');
	document.write ('</a>');
	document.write (title);
	document.write ('<br />');
	document.write ('</div>');
}
