function stampaFattura() {
	var testo 
	
	testo = "<html><head><title>"+document.title+"</title>";
	testo += "<link href=\"../include/stili.css\" rel=\"stylesheet\" type=\"text/css\"></head>";
	testo += "<body onload=\"self.print()\" id=\"bodyFattura\">";
	testo += "<div id=\"fattura\">";
	testo += document.getElementById('fattura').innerHTML;
	testo += "</div>";
	testo += "</body></html>";
	var ident_finestra = window.open("","finestra_stampa","height=600,width=600,scrollbars=1, location=0, statusbars=0, menubars=0, resizable=1");
	ident_finestra.document.open();
	ident_finestra.document.write(testo);
	ident_finestra.document.close();
	   
	   <!--aggiungete le seguenti righe di codiced dopo la funzione stampa_popup per stampare e -->
	   <!--chiudere immediatamente la finestra figlia generata: ident_finestra.print();ident_finestra.close(); -->
}
/*---------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------*/
function onLoadCommesse()
{
	var sa = document.getElementById("chkViewAll");
	if(typeof(IsPrinterFriendly) == "undefined") sa.checked = false;
	else sa.checked = true;
}

function selezionaTutto()
{
	var sa = document.getElementById("chkViewAll");
	
	if(sa.checked == false) sa.checked = true;
	else sa.checked = false;
	toggleAll()
}

function toggleAll()
{
	var sa = document.getElementById("chkViewAll");
	var ch = sa.checked;
	toggleQuestions(ch);
}

function toggleQuestions(checked)
{
	var secCount = 1;
	var faqEntryCount = 8;
	for(var j=1; j<=secCount; j++)
	{
		for (var i=1; i<=faqEntryCount; i++)
		{
			var title = document.getElementById("title" + j + i);
			if(checked == true)
				expandQuestion("title" + j + i, "question" + j + i, "answer" + j + i);
			else
				collapseQuestion("title" + j + i, "question" + j + i, "answer" + j + i);
		}
	}
	if(checked == false)
	{
	  var sa = document.getElementById("chkViewAll");
		sa.checked = false;
	}
}

function toggleQuestion(tName, qName, aName)
{
	var title = document.getElementById(tName);
	if (title == null) return;
	var ans = document.getElementById(aName);
	if (ans == null) return;
	var que = document.getElementById(qName);
	if (ans.style.display == '')
	{
	  if (que != null) que.style.display = 'none';
		ans.style.display = 'none';
		var sa = document.getElementById("chkViewAll");
		sa.checked = false;
	}
	else
	{
		if (que != null) que.style.display = '';
		ans.style.display = '';
	}
}

function expandQuestion(tName, qName, aName)
{
	var title = document.getElementById(tName);
	if (title == null) return;
	var ans = document.getElementById(aName);
	if (ans == null) return;
	var que = document.getElementById(qName);
	if (que != null) que.style.display = '';
	ans.style.display = '';
}

function collapseQuestion(tName, qName, aName)
{
	var title = document.getElementById(tName);
	if (title == null) return;
	var ans = document.getElementById(aName);
	if (ans == null) return;
	var que = document.getElementById(qName);
	if (que != null) que.style.display = 'none';
	ans.style.display = 'none';
}