//Apre una finestra secondo i valori dei parametri
//esempio: apri_finestra(url_pag,windowsname,'no','800','600','0','0','no','no','no',1,'no','yes','no')
function apri_finestra_2(url_pag,windowsname,v_toolbar,v_width,v_height,v_left,v_top,v_directories,v_status,v_statusbar,v_resizable,v_menubar,v_scrollbar,v_location){
   	var finestra=window.open(url_pag,windowsname,'toolbar='+v_toolbar+',width='+v_width+',height='+v_height+',left='+v_left+',top='+v_top+',directories='+v_directories+',status='+v_status+',statusbar='+v_statusbar+',resizable='+v_resizable+',menubar='+v_menubar+',scrollbars='+v_scrollbar+',location='+v_location);
   	if(!finestra.opener) finestra.opener=self;
   	if(finestra.focus!=null) finestra.focus();
}

//apre una finestra con tutti i menu
function apri_finestra(url, nomeWindow, lunghezza, altezza) {
	nome = nomeWindow;
	//alert("ciao");
	// ------------------------------------------
	// Altezza della finestra [numero]
	if (altezza == null) {
		altezza = 600;
	}
	// ------------------------------------------
	// Lunghezza della finestra [numero]
	if (lunghezza == null) {
		lunghezza = 800;
	}	
	// ------------------------------------------
	// Posiziona finestra al centro [true|false]
	centra = true;
	// ------------------------------------------
	// Distanza dal margine sinistro [numero]
	posX = 100;
	// ------------------------------------------
	// Distanza dal margine destro [numero]
	posY = 100;
	// ------------------------------------------
	// Visualizza a pieno schermo - solo IE4
	fullscreen='no';
	// ------------------------------------------
	// Ridimensionabile [yes|no]
	resizable='yes';
	// ------------------------------------------
	// Visualizza barra del menu [yes|no]
	menuB='yes';
	// ------------------------------------------
	// Visualizza barre di scorrimento [yes|no]
	scrollB='yes';	
	// ------------------------------------------
	// Visualizza barra di stato [yes|no]
	statusB='no';	
	// ------------------------------------------

	if (centra) {
		posX = Math.round((screen.width - lunghezza)/2);
		posY = Math.round((screen.height - altezza)/2);		
	}

	caratteristiche = "menubar=" + menuB;
	caratteristiche += ",scrollbars=" + scrollB;
	caratteristiche += ",statusbar=" + statusB;		//Netscape
	caratteristiche += ",status=" + statusB;		//IE4
	caratteristiche += ",height=" + altezza;
	caratteristiche += ",width=" + lunghezza;
	caratteristiche += ",screenX=" + posX;			//Netscape
	caratteristiche += ",left=" + posX;			//IE4
	caratteristiche += ",screenY=" + posY;			//Netscape
	caratteristiche += ",top=" + posY;			//IE4
	caratteristiche += ",fullscreen=" + fullscreen; 	//solo IE4
	caratteristiche += ",resizable=" + resizable;

	popupWindow = window.open(url, nome, caratteristiche);
	popupWindow.opener = self;

}

//apre una finestra senza la barra del menu e la status bar
function apri_finestra_nobar(url, nomeWindow, lunghezza, altezza) {
	nome = nomeWindow;
	// ------------------------------------------
	// Altezza della finestra [numero]
	if (altezza == null) {
		altezza = 600;
	}
	// ------------------------------------------
	// Lunghezza della finestra [numero]
	if (lunghezza == null) {
		lunghezza = 800;
	}	
	// ------------------------------------------
	// Posiziona finestra al centro [true|false]
	centra = true;
	// ------------------------------------------
	// Distanza dal margine sinistro [numero]
	posX = 100;
	// ------------------------------------------
	// Distanza dal margine destro [numero]
	posY = 100;
	// ------------------------------------------
	// Visualizza a pieno schermo - solo IE4
	fullscreen='no';
	// ------------------------------------------
	// Ridimensionabile [yes|no]
	resizable='yes';
	// ------------------------------------------
	// Visualizza barra del menu [yes|no]
	menuB='no';
	// ------------------------------------------
	// Visualizza barre di scorrimento [yes|no]
	scrollB='yes';	
	// ------------------------------------------
	// Visualizza barra di stato [yes|no]
	statusB='no';	
	// ------------------------------------------

	if (centra) {
		posX = Math.round((screen.width - lunghezza)/2);
		posY = Math.round((screen.height - altezza)/2);		
	}

	caratteristiche = "menubar=" + menuB;
	caratteristiche += ",scrollbars=" + scrollB;
	caratteristiche += ",statusbar=" + statusB;		//Netscape
	caratteristiche += ",status=" + statusB;		//IE4
	caratteristiche += ",height=" + altezza;
	caratteristiche += ",width=" + lunghezza;
	caratteristiche += ",screenX=" + posX;			//Netscape
	caratteristiche += ",left=" + posX;			//IE4
	caratteristiche += ",screenY=" + posY;			//Netscape
	caratteristiche += ",top=" + posY;			//IE4
	caratteristiche += ",fullscreen=" + fullscreen; 	//solo IE4
	caratteristiche += ",resizable=" + resizable;

	popupWindow = window.open(url, nome, caratteristiche);
	popupWindow.focus();
	popupWindow.opener = self;
	//document.form1.action=pag;
	//opener.form1.submit();
	
	//document.form1.action=url;
	
	//document.form1.target="importa_allegato";
	
	//document.form1.submit();
	
	//popupWindow.name.value=nome
	//alert(popupWindow.name.value)

}

//apre una finestra senza la barra del menu e la status bar
function apri_finestra_fissa(url, nomeWindow, lunghezza, altezza) {
	nome = nomeWindow;
	// ------------------------------------------
	// Altezza della finestra [numero]
	if (altezza == null) {
		altezza = 600;
	}
	// ------------------------------------------
	// Lunghezza della finestra [numero]
	if (lunghezza == null) {
		lunghezza = 800;
	}	
	// ------------------------------------------
	// Posiziona finestra al centro [true|false]
	centra = true;
	// ------------------------------------------
	// Distanza dal margine sinistro [numero]
	posX = 100;
	// ------------------------------------------
	// Distanza dal margine destro [numero]
	posY = 100;
	// ------------------------------------------
	// Visualizza a pieno schermo - solo IE4
	fullscreen='no';
	// ------------------------------------------
	// Ridimensionabile [yes|no]
	resizable='no';
	// ------------------------------------------
	// Visualizza barra del menu [yes|no]
	menuB='no';
	// ------------------------------------------
	// Visualizza barre di scorrimento [yes|no]
	scrollB='yes';	
	// ------------------------------------------
	// Visualizza barra di stato [yes|no]
	statusB='no';	
	// ------------------------------------------

	if (centra) {
		posX = Math.round((screen.width - lunghezza)/2);
		posY = Math.round((screen.height - altezza)/2);		
	}

	caratteristiche = "menubar=" + menuB;
	caratteristiche += ",scrollbars=" + scrollB;
	caratteristiche += ",statusbar=" + statusB;		//Netscape
	caratteristiche += ",status=" + statusB;		//IE4
	caratteristiche += ",height=" + altezza;
	caratteristiche += ",width=" + lunghezza;
	caratteristiche += ",screenX=" + posX;			//Netscape
	caratteristiche += ",left=" + posX;			//IE4
	caratteristiche += ",screenY=" + posY;			//Netscape
	caratteristiche += ",top=" + posY;			//IE4
	caratteristiche += ",fullscreen=" + fullscreen; 	//solo IE4
	caratteristiche += ",resizable=" + resizable;

	popupWindow = window.open(url, nome, caratteristiche);
	popupWindow.focus();
	popupWindow.opener = self;
	//document.form1.action=pag;
	//opener.form1.submit();
	
	//document.form1.action=url;
	
	//document.form1.target="importa_allegato";
	
	//document.form1.submit();
	
	//popupWindow.name.value=nome
	//alert(popupWindow.name.value)

}
