// JavaScript Document
function nuovaFinestra(cPicture,descrizione) 
{ 
day = new Date(); 
now = day.getTime(); 
img = new Image; 
img.src= cPicture; 
posh=Math.floor((screen.height-img.height)/2); 
posw=Math.floor((screen.width-img.width)/2);
eval("NewWin=window.open('','"+now+"','HEIGHT='+img.height+',WIDTH='+img. width+',scrollbars=no,resizable=yes,top='+posh+',left='+posw);"); 
NewWin.document.write ("<HTML><HEAD><TITLE>");
NewWin.document.write (descrizione); 
NewWin.document.write (" - Emilio Lussu</TITLE>"); 
NewWin.document.write ("</HEAD>\n"); 
NewWin.document.write ("<BODY OnLoad='this.focus("); 
if (document.layers) { 
NewWin.document.write (");this.resizeTo("); 
NewWin.document.write (img.width); 
NewWin.document.write (","); 
NewWin.document.write (img.height); 
} 
NewWin.document.write (")' BGCOLOR=#FFFFFF MARGINWIDTH='0' MARGINHEIGHT='0' TOPMARGIN='0' LEFTMARGIN='0'>\n"); 
NewWin.document.write ("<CENTER><IMG SRC="); 
NewWin.document.write (cPicture); 
NewWin.document.write (">"); 
NewWin.document.write ("</CENTER></BODY></HTML>"); 
NewWin.document.close(); 
}
function GP_AdvOpenWindow(theURL,winName,features,popWidth,popHeight,winAlign,ignorelink,alwaysOnTop,autoCloseTime,borderless) { //v2.0
  var leftPos=0,topPos=0,autoCloseTimeoutHandle, ontopIntervalHandle, w = 480, h = 340;  
  if (popWidth > 0) features += (features.length > 0 ? ',' : '') + 'width=' + popWidth;
  if (popHeight > 0) features += (features.length > 0 ? ',' : '') + 'height=' + popHeight;
  if (winAlign && winAlign != "" && popWidth > 0 && popHeight > 0) {
    if (document.all || document.layers || document.getElementById) {w = screen.availWidth; h = screen.availHeight;}
		if (winAlign.indexOf("center") != -1) {topPos = (h-popHeight)/2;leftPos = (w-popWidth)/2;}
		if (winAlign.indexOf("bottom") != -1) topPos = h-popHeight; if (winAlign.indexOf("right") != -1) leftPos = w-popWidth; 
		if (winAlign.indexOf("left") != -1) leftPos = 0; if (winAlign.indexOf("top") != -1) topPos = 0; 						
    features += (features.length > 0 ? ',' : '') + 'top=' + topPos+',left='+leftPos;}
  if (document.all && borderless && borderless != "" && features.indexOf("fullscreen") != -1) features+=",fullscreen=1";
  if (window["popupWindow"] == null) window["popupWindow"] = new Array();
  var wp = popupWindow.length;
  popupWindow[wp] = window.open(theURL,winName,features);
  if (popupWindow[wp].opener == null) popupWindow[wp].opener = self;  
  if (document.all || document.layers || document.getElementById) {
    if (borderless && borderless != "") {popupWindow[wp].resizeTo(popWidth,popHeight); popupWindow[wp].moveTo(leftPos, topPos);}
    if (alwaysOnTop && alwaysOnTop != "") {
    	ontopIntervalHandle = popupWindow[wp].setInterval("window.focus();", 50);
    	popupWindow[wp].document.body.onload = function() {window.setInterval("window.focus();", 50);}; }
    if (autoCloseTime && autoCloseTime > 0) {
    	popupWindow[wp].document.body.onbeforeunload = function() {
  			if (autoCloseTimeoutHandle) window.clearInterval(autoCloseTimeoutHandle);
    		window.onbeforeunload = null;	}  
   		autoCloseTimeoutHandle = window.setTimeout("popupWindow["+wp+"].close()", autoCloseTime * 1000); }
  	window.onbeforeunload = function() {for (var i=0;i<popupWindow.length;i++) popupWindow[i].close();}; }   
  document.MM_returnValue = (ignorelink && ignorelink != "") ? false : true;
}
