function popup(url, name, width, height)
{
if (screen) {
	LeftPos = (screen.width - width) / 2
	TopPos = (screen.height - height) / 2
}

settings="top="+TopPos+",left="+LeftPos+",fullscreen=no,location=no,directories=no,"+
"status=no,menubar=no,scrollbars=yes,"+
"resizable=no,width="+width+",height="+height;

MyNewWindow=window.open(url,name,settings);
}


function poptec(url)
{
width=730
height=500

if (screen) {
	LeftPos = (screen.width - width) / 2
	TopPos = (screen.height - height) / 2
}

settings="top="+TopPos+",left="+LeftPos+",fullscreen=no,location=no,directories=no,"+
"status=no,menubar=no,scrollbars=yes,"+
"resizable=no,width="+width+",height="+height;

MyNewWindow=window.open(url,'TABELLE',settings);
}


//FINESTRA A DIMENSIONE AUTOMATICA PER IMMAGINI

//@deprecated?
function getNomeBigImg(NomeImg){
	nome = NomeImg.substring(0, NomeImg.lastIndexOf("."));
	ext = NomeImg.substring(NomeImg.lastIndexOf("."), NomeImg.length());
	nome = nome + "_g" + ext;
}

function OpenPhoto(NomeImg){
  //NomeImg = getNomeBigImg(NomeImg);
  //NomeImg = "resize/" + NomeImg;	//?x=...&y=...&thumb=  !?
  BigImg = new Image();
  BigImg.src = (NomeImg);
  Controlla(NomeImg);
}

function Controlla(NomeImg){
  if((BigImg.width!=0)&&(BigImg.height!=0)){
    viewFoto(NomeImg);
  }
  else{
    funzione="Controlla('"+NomeImg+"')";
    intervallo=setTimeout(funzione,20);
  }
}

function viewFoto(img){
	wImg = BigImg.width
	hImg = BigImg.height
	ImgSrc = BigImg.src
	
	//if(hImg>100) {
		hImg=230
		wImg=wImg+20 // aggiungo spazio x scrollbar verticale
		blnScrollbars="yes"
	//} else {
		//blnScrollbars="no"
	//}
	
	if (screen) {
		leftPos = (screen.width - wImg) / 2
		topPos = (screen.height - hImg) / 2
	}
	newWindow=window.open("","_blank","width="+wImg+",height="+hImg+",left="+leftPos+",top="+topPos+",status=no,menubar=no,resizable=no,scrollbars="+blnScrollbars);
	newWindow.resizeTo(wImg+10,hImg+29+27) /** aumentato per xp che ha status bar sempre attiva**/
	newWindow.document.write("<HTML>")
	newWindow.document.write("<HEAD>")
	newWindow.document.write("<TITLE>Image</TITLE>")
	newWindow.document.write("<link href='theme/struttura.css' rel='stylesheet' type='text/css'>")
	newWindow.document.write("</HEAD>")
	newWindow.document.write("<BODY onLoad='top.window.focus();' topmargin='0' leftmargin='0' bgproperties='fixed'>")
	newWindow.document.write("<TABLE BORDER='0' CELLSPACING='0' CELLPADDING='0' WIDTH='100%' HEIGHT='100%'>")
	newWindow.document.write("<TR>")
	newWindow.document.write("<TD ALIGN='center' VALIGN='top'>")
	newWindow.document.write("<IMG BORDER='0' NAME='MyImg' SRC='"+ImgSrc+"'>")
	newWindow.document.write("</TD>")
	newWindow.document.write("</TR>")
	newWindow.document.write("<TR>")
	newWindow.document.write("<TD ALIGN='center'>")
	newWindow.document.write("<a href='javascript:window.close();' class='testoNormal'><b>Close</b></a>")
	newWindow.document.write("</TD>")
	newWindow.document.write("</TR>")

	newWindow.document.write("</TABLE>")
	newWindow.document.write("</BODY>")
	newWindow.document.write("</HTML>")
	newWindow.document.close()
}