/*************************************************************\
 *	ShowImage - show an image in window with rightclick lock
 *
 *	Copyright (C) 2008, Riccardo 'Rico' Pareschi
 *	This script is released under GPL License.
 *	Feel free to use this script (or part of it) wherever you need
 *	it ...but please, give credit to original author. Thank you. :-)
 *	We will also appreciate any links you could give us.
 *	http://www.rico54.com
 *
 *  usage: <script type="text/javascript" src="ShowImage.js"></script>
 *
 *	Enjoy! ;-)
 * -----------------------------------------------------------
 * last update: 11.03.2009
\*************************************************************/
		// show an image in a window
		function ShowImage(ifile,ix,iy,ititle, stylepath) { 
		  var win;
		  var theTitle = "Gruppo Modellisti Lega Navale Italiana - Ferrara";
		  var btnClose = "Chiudi";

		  if (ititle != "") {
		  		iheight = iy+20;
		  } else {
		  	iheight = iy;
		  }
		  if (ix < 400) { 
		  		ix = 400;
		  } // for large title

		  win = window.open("","imageviewer","width="+(ix+60)+",height="+(iheight+60)+",menubar=no,toolbar=no");
		  win.document.write("<html><head><title>"+theTitle+"</title>");
		  win.document.write("<link rel='stylesheet' href='"+stylepath+"' type='text/css'>");
		  win.document.write("</head><body>");
		  //
		  win.document.write("<script language=JavaScript>");
		  win.document.write("var message='';");
		  win.document.write("function clickIE() {if (document.all) {(message);return false;}}");
		  win.document.write("function clickNS(e) {if ");
		  win.document.write("(document.layers||(document.getElementById&&!document.all)) {");
		  win.document.write("if (e.which==2||e.which==3) {(message);return false;}}}");
		  win.document.write("if (document.layers) ");
		  win.document.write("{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}");
		  win.document.write("else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}");
		  win.document.write("document.oncontextmenu=new Function('return false')");
		  win.document.write("<"+"/script"+">");
		  //
		  win.document.write("<table border=0 align=center>");
		  win.document.write("<tr><td align=center>");
		  win.document.write("<img src=" + ifile + " border='0' alt='" + ifile + "'>" );
		  win.document.write("</td></tr><tr><td colspan='2'>");
		  win.document.write("<form style='text-align: center;'>");
		  win.document.write("<p>"+ititle+"</p>");
		  win.document.write("<input type=button value='"+btnClose+"' onClick='window.close(self)'>");
		  win.document.write("</form><");
		  win.document.write("/td></tr></table>");
		  win.document.write("</body></html>");
		  win.document.close();
		  if (window.theNewWindow) 
  		theNewWindow.close();
		} // ShowImage

