function popupimage(url, ptitle, alttext, IdLang) {
  var isIE = (navigator.appName == "Microsoft Internet Explorer");
  if ((ptitle=='')) {wintitle = 'R.C.S.M.';} else {wintitle = ptitle;}
  if ((IdLang=='italian')) {TxtCloseWin = 'Chiudi finestra';TxtPrintWin = 'Stampa immagine';} else {TxtCloseWin = 'Close window';TxtPrintWin = 'Print image';}
  w=open("",'image','width=400,height=400,toolbar=no,scrollbars=no,resizable=no,status=yes,location=no,menubar=no');
  w.document.writeln("<html>");
  w.document.writeln("  <head>");
  w.document.writeln("    <title>"+wintitle+"</title>");
  w.document.writeln("    <link rel='stylesheet' type='text/css' href='../RallyClub.css' media='all' />");
  w.document.writeln("    <script language=javascript type='text/javascript'>function checksize() { if (document.images[0].complete) {");
  if (isIE) { // (document.all) 
      //IE4 = true;
	w.document.writeln("    		DeltaHeight = 170;");
	w.document.writeln("    		DeltaWidth = 18;");
  }
  else {
      //IE4 = false;
	w.document.writeln("    		DeltaHeight = 140;");
	w.document.writeln("    		DeltaWidth = 18;");
  }
  w.document.writeln("    			window.resizeTo(document.images[0].width+DeltaWidth,document.images[0].height+DeltaHeight); window.focus();");
  w.document.writeln("    		} else { setTimeout('checksize()',250) }");
  w.document.writeln("    }");
  w.document.writeln("    </"+"script>");
  w.document.writeln("  </head>");
  if (isIE) { // (document.all)
      //IE4 = true;
    w.document.writeln("  <body id='popup' onload='checksize();' onblur='self.close();'>");
  }
  else {
      //IE4 = false;
    w.document.writeln("  <body id='popup' onload='checksize();' onblur='window.close();'>");
  }
  w.document.writeln("    <div>");
  w.document.writeln("      <div><img src='"+url+"' alt='"+alttext+"' onClick='top.close()' /></div>");
  w.document.writeln("      <div id='putext'>"+alttext+"</div>");
  w.document.writeln("      <div id='pubuttons'>");
  w.document.writeln("        <form>");
  w.document.writeln("          <span><input type='button' name='close' id='close' value='"+TxtCloseWin+"' onClick='top.close()' /></span>");

    if (isIE) { // (document.all)
      //IE4 = true;
    w.document.writeln("          <span><input type='button' name='print' id='print' value='"+TxtPrintWin+"' onClick='javascript:self.print();return false;' /></span>");
      }
  else {
      //IE4 = false;
    w.document.writeln("          <span><input type='button' name='print' id='print' value='"+TxtPrintWin+"' onClick='javascript:document.getElementById(\"btprint\").style.visibility=\"hidden\";document.getElementById(\"btclose\").style.visibility=\"hidden\";window.print();return false;'>");

        ///if (document.layers) {
      //  //NS4 = true;
    //}
    //else {
      //  //NS4 = false;
    //}
  }
  w.document.writeln("        </form>");
  w.document.writeln("      </div>");
  w.document.writeln("    </div>");
  w.document.writeln("  </body>");
  w.document.write("</html>");
  w.document.close();
}
