var foto=new Image();
var apri=false;
var timer="";

function cambia()
{

if (F2.document.images[0].complete == false){
       timer=setTimeout("cambia()",10);
	   }
   else{
       clearTimeout(timer);
	   }
F2.resizeTo((foto.width),(foto.height+64));
}

function big(URL)
{
foto.src=URL;
if (apri==false){
   F2=open ("foto.htm","foto","scrollbars=no,width='300',height='200'");
   txt0="<html>";
   txt1="  <head>";
   txt2="    <title>Centro Frutta Castiglione - B2B</title>";
   txt3="    <link rel='stylesheet' href='../script/stile.css'>";
   txt4="  </head>";
   txt5="  <body leftmargin=0 topmargin=0 marginheight=0 marginwidth=0 onLoad='javascript:window.focus();setTimeout(stop(),100)'>";
   txt6="    <div>";
   txt7="      <div><img src="+URL+"></div>";
   txt8="      </div>";
   txt9="         <div id='popupFoot'><div id='closePop'><a href='javascript:window.close()'>&nbsp;chiudi questa finestra</a></div><div id='printPop'><a href='javascript:window.print()'>stampa</a></div>";
   txt10="      </div>";
   txt11="   </div>";
   txt12="  </body>";
   txt13="</html>";
   F2.document.writeln(txt0);
   F2.document.writeln(txt1);
   F2.document.writeln(txt2);
   F2.document.writeln(txt3);
   F2.document.writeln(txt4);
   F2.document.writeln(txt5);
   F2.document.writeln(txt6);
   F2.document.writeln(txt7);
   F2.document.writeln(txt8);
   F2.document.writeln(txt9);
   F2.document.writeln(txt10);
   F2.document.writeln(txt11);
   F2.document.writeln(txt12);
   F2.document.write(txt13);
   cambia();
   apri=true;
   }
else
{
	F2.close();
	apri=false;
	big (URL);
}
}

function genericPop(myUrl,myWinName,myWidth,myHeight,myPars) {
	var winl = (screen.width - myWidth) / 2;
	var wint = (screen.height - myHeight) / 2;
	parameters = myPars + '';
	if (parameters == '') parameters = ',toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no';
	gwin=window.open(myUrl,myWinName,'width='+myWidth+',height='+myHeight+',left='+winl+',top='+wint+parameters);
	gwin.focus();
}


	
function popupimage(url, ptitle, alttext, IdLang) {
	if ((ptitle=='')) {wintitle = 'Centro Frutta Castiglione';} 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');
  w.document.writeln("<html>");
  w.document.writeln("  <head>");
  w.document.writeln("    <title>"+wintitle+"</title>");
  w.document.writeln("    <link rel=\"stylesheet\" type=\"text/css\" href=\"/script/stile.css\" media=\"all\" />");
  w.document.writeln("    <script language=\"javascript\" type=\"text/javascript\">function checksize() { if (document.images[0].complete) { window.resizeTo(document.images[0].width+18,document.images[0].height+140); window.focus();} else { setTimeout('checksize()',250) } }</"+"script>");
  w.document.writeln("  </head>");
  w.document.writeln("  <body id=\"popup\" onload=\"checksize();\">");
  w.document.writeln("    <div>");
  w.document.writeln("      <div id=\"popupimg\"><img src=\""+url+"\" alt=\""+alttext+"\" onClick=\"top.close()\" /></div>");
  w.document.writeln("      <h3>"+alttext+"</h3>");
  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>");
  w.document.writeln("          <span><input type=\"button\" name=\"print\" id=\"print\" value=\""+TxtPrintWin+"\" onClick=\"javascript:self.print();return false;\" /></span>");
  w.document.writeln("        </form>");
  w.document.writeln("      </div>");
  w.document.writeln("    </div>");
  w.document.writeln("  </body>");
  w.document.write("</html>");
  w.document.close();
}