var totalecarrello=null;
var trichiesta="";
var tipo1sel=0;
function GetXmlHttpObject()
{
totalecarrello=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 totalecarrello=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  totalecarrello=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  totalecarrello=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return totalecarrello;
}

function show_totale_carrello(chiamata,tipo)
{ 
trichiesta=chiamata;
tipo1sel=tipo;
totalecarrello=GetXmlHttpObject();
if (totalecarrello==null)
 {
 alert ("Browser does not support HTTP Request");
 return
 } 
var url="totalecarrello.php";
url=url+"?chiamata="+trichiesta;
url=url+"&sid="+Math.random();
totalecarrello.onreadystatechange=statetotale; 
totalecarrello.open("GET",url,true);
totalecarrello.send(null);
}

function statetotale() 
{ 
if (totalecarrello.readyState==4 || totalecarrello.readyState=="complete")
 { 
 //alert("totcarrello: "+totalecarrello.responseText);
 document.getElementById("totale").innerHTML='';
 var tmp=totalecarrello.responseText.split('+');
 totalegenerale=parseFloat(tmp[0]) + parseFloat(tmp[1]);
 spese=parseFloat(tmp[1]);
 if(tipo1sel==0 && spese>0)
 {
 document.getElementById("totale").innerHTML="TOTALE CARRELLO: &euro; "+FormatPrz(tmp[0])+"<br>SPESE DI SPEDIZIONE: &euro; "+FormatPrz(tmp[1]);
 }
 else
 {
	if(tmp[0]>0){ document.getElementById("totale").innerHTML="TOTALE CARRELLO: &euro; "+FormatPrz(tmp[0]);}
 } 
 } 
 }
