// funcions per la gestió del carritu

var responseSuccess = function(o){ 
/* Please see the Success Case section for more 
 * details on the response object's properties. 
 * o.tId 
 * o.status 
 * o.statusText 
 * o.getResponseHeader[ ] 
 * o.getAllResponseHeaders 
 * o.responseText 
 * o.responseXML 
 * o.argument 
 */ 
 document.getElementById('carritu').innerHTML = o.responseText;
}; 
 
var responseFailure = function(o){ 
// Access the response object's properties in the 
// same manner as listed in responseSuccess( ). 
// Please see the Failure Case section and 
// Communication Error sub-section for more details on the 
// response object's properties. 
alert("FAIL");

} 

var callback = 
{ 
	  success:responseSuccess, 
	  failure:responseFailure, 
	  argument:null
}; 

function AlCarritu(idplaca,iduser)
{
	MostraCarritu();
	$("#carritu").html("<p><img src=\"imatges/indicator.gif\"><em>Processant...</em></p>");
	$.get("gcarritu.php?action=add&niduser="+iduser+"&idplaca="+idplaca,function(data)
	{
		$('#carritu').html(data);
	});
	
}

function DelCarritu(idplaca,iduser)
{
	$("#carritu").html("<p><img src=\"imatges/indicator.gif\"><em>Processant...</em></p>");
	
	$.get("gcarritu.php?action=del&niduser="+iduser+"&idplaca="+idplaca,function(data)
	{
		$('#carritu').html(data);
	}); 
}
function MostraCarritu()
{
	
	$('#boxHandle').show("fast");
		 
}

function TancarCarritu()
{
	$('#boxHandle').hide("fast");
}
		
