var fin=null;

function ImgPopUp(img, titolo, width, height) {
	if (fin && !fin.closed){		// chiude le finestre aperte
		fin.close()
	}
	
	var xc = screen.width;
	var yc = screen.height;
	fin="";	
	
	var cntxc = Math.round(( xc / 2 ) - ( width / 2 ));
	var cntyc = Math.round(( yc / 2 ) - (( height * 9 ) / 10 ));
	
	if(height < 481){var scroll = "no";} else {var scroll = "yes";height = 450;width = Math.round(width + 18);}
	if(width > xc){width = Math.round(( xc ) - ( xc / 4 ));}
	
	fin=open ('','_blank','scrollbars=' + scroll + ',status=no,menubar=no,toolbar=no,location=no,directories=no,resizable=yes,copyhistory=no,left=' + cntxc + ',top=' + cntyc + ',width=' + width + ',height=' + height);
	fin.document.open();
	fin.document.write("<html><head><title>");
	fin.document.write(titolo);
	fin.document.write("</title></head><body bgcolor=#FFFFFF topmargin=0 marginheight=0 leftmargin=0 marginwidth=0>");
	fin.document.write("<a href=javascript:window.close()><img src=" + img + " align=top border=0 alt=Chiudi/Colse></a>");
	fin.document.write("</body></html>");
	fin.focus();
}

function PagPopUp(pag,width, height) {
	
	var xc = screen.width;
	var yc = screen.height;
	
	var cntxc = Math.round(( xc / 2 ) - ( width / 2 ));
	var cntyc = Math.round(( yc / 2 ) - (( height * 9 ) / 10 ));
	
	window.open (pag,'_blank','scrollbars=no,status=no,menubar=no,toolbar=no,location=no,directories=no,resizable=no,copyhistory=no,left=' + cntxc + ',top=' + cntyc + ',width=' + width + ',height=' + height);
}

	function PopUp(url, width, height) {

	var xc = screen.width;
	var yc = screen.height;

	var cntxc = Math.round(( xc / 2 ) - ( width / 2 ));
	var cntyc = Math.round(( yc / 2 ) - (( height * 9 ) / 10 ));

	window.open (url,'_blank','scrollbars=yes,status=yes,menubar=yes,toolbar=yes,location=yes,directories=yes,resizable=yes,copyhistory=yes,left=' + cntxc + ',top=' + cntyc + ',width=' + width + ',height=' + height);
}

self.onerror = function() { return true }