function open_window(name, url, centerscreen, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)
{

  centerscreen_str = centerscreen ? 'yes' : 'no';
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'no';
  resizable_str = resizable ? 'yes' : 'no';

  if (centerscreen_str == "yes") {
		left = Math.floor((screen.width-width)/2);
   		top = Math.floor((screen.height-height)/2);
  }
		
  cookie_str = document.cookie;
  cookie_str.toString();

  pos_start  = cookie_str.indexOf(name);
  pos_end    = cookie_str.indexOf('=', pos_start);

  cookie_name = cookie_str.substring(pos_start, pos_end);

  pos_start  = cookie_str.indexOf(name);
  pos_start  = cookie_str.indexOf('=', pos_start);
  pos_end    = cookie_str.indexOf(';', pos_start);
  
  if (pos_end <= 0) pos_end = cookie_str.length;
  cookie_val = cookie_str.substring(pos_start + 1, pos_end);
  if (cookie_name == name && cookie_val  == "done")
    return;

  window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}


function PopupCentrato(name,url, w, h, dir, loc, menubar, resize, scrollbar, statusbar, toolbar) {
/* Questa funzione richiede i seguenti parametri:
          name : nome della finestra - facoltativo 
		   url : nome e percorso della pagina da aprire nella finestra di popup - obbligatorio (es. 'xxx.html' )
             w : specifica la larghezza della finestra in pixel, minimo 100
	         h : specifica l'altezza della finestra in pixel, minimo 100
   directories : specifica se debba essere presente o meno la barra dei Collegamenti (yes - no / 1 - 0)
      location : specifica se debba essere presente o meno la barra degli Indirizzi (yes - no / 1 - 0)
	   menubar : specifica se debba essere presente o meno la barra dei Menu (yes - no / 1 - 0)
	 resizable : specifica se la finestra possa essere ridimensionabile oppure no (yes - no / 1 - 0)
	scrollbars : specifica se debbano essere presenti o meno le barre di scorrimento, verticale e orizzontale (yes - no / 1 - 0)
	    status : specifica se debba essere presente o meno la barra di Stato (yes - no / 1 - 0)
	   toolbar : specifica se debba essere presente o meno la barra degli Strumenti (yes - no / 1 - 0)
*/
   var l = Math.floor((screen.width-w)/2);
   var t = Math.floor((screen.height-h)/2);
   window.open(url,name,"width=" + w + ",height=" + h + ",top=" + t + ",left=" + l + ",direrctories=" + dir + ",location=" + loc + ",menubar=" + menubar + ",resizable=" + resize + ",scrollbars=" + scrollbar + ",status=" + statusbar + ",toolbar=" + toolbar);
}