/*function immSfondo() {
	
	//var dimX=screen.width; //larghezza pagina
	var dimX = document.body.clientWidth;
	document.getElementById("vetrina2").style.left=(dimX-140)+"px";

}*/

function mkHTTPRequest() {
	
	var richiestaHTTP = undefined;
	
	if(window.XMLHttpRequest) richiestaHTTP = new XMLHttpRequest();
	else richiestaHTTP = new ActiveXObject("Microsoft.XMLHTTP");
	
	return richiestaHTTP;
}

function mostraCarrello() {
	
		var richiesta =  mkHTTPRequest();
		
		richiesta.onreadystatechange = function () {

		ajaxChiamata(richiesta);}
		
		richiesta.open('POST', 'aggiornaCarrello.php', true);
		richiesta.setRequestHeader("content-type", "application/x-www-form-urlencoded");
		richiesta.send("mostra=true");
}


function mettiCarrello(idP,tipo) {
	
		if(tipo=="multi") var quanti = document.getElementById("quantita_"+idP).value;
		else var quanti = document.getElementById("quantita").value;
		
		var richiesta =  mkHTTPRequest();
		richiesta.onreadystatechange = function () {

		ajaxChiamata(richiesta);}
		
		richiesta.open('POST', 'aggiornaCarrello.php', true);
		richiesta.setRequestHeader("content-type", "application/x-www-form-urlencoded");
		richiesta.send("idProdotto="+idP+"&quantita="+quanti);

}
function togliCarrello(idP) {
	
		var richiesta =  mkHTTPRequest();
		richiesta.onreadystatechange = function () {

		ajaxChiamata(richiesta);}
		
		richiesta.open('POST', 'aggiornaCarrello.php', true);
		richiesta.setRequestHeader("content-type", "application/x-www-form-urlencoded");
		richiesta.send("rigaDaTogliere="+idP);

}

function ajaxChiamata( request) {

	try {
		if(request.readyState == 4){ 

			if(request.status == 200) { aggiornaCarrello(request.responseText);
										} else { return false }

									}
		} catch(a){ }

}


function aggiornaCarrello(testo) {
	
	document.getElementById("carrello").innerHTML=testo;
	
	
}
