function ajaxCarrinho(url)
{
req = null;
// Procura por um objeto nativo (Mozilla/Safari)


if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
		req.onreadystatechange = AtualizaCarrinho;
		req.open("GET",url,true);
		req.send('');
		

// Procura por uma versão ActiveX (IE)
} else if (window.ActiveXObject) {
	req = new ActiveXObject("Microsoft.XMLHTTP");
	if (req) {
	req.onreadystatechange = AtualizaCarrinho;
	req.open("GET",url,true);
	req.send('');
	

	}
	 else {
		alert("Seu Browser(Mozila, Internet Explorer, Safari)?");
	}
  }
}

function limpaTabela()
{
	var tble = document.getElementById("to");
	for (var i=tble.rows.length-1; i>-1; i--) {
		tble.deleteRow(i);
	}
}


function AtualizaCarrinho()
{
if (req.readyState == 4 || req.readyState == 0) {

if (req.status == 200) {

aux = req.responseText;

erro = "erro";
if(aux == erro){
alert(aux);
}else{

	try{
	limpaTabela()
	var tbl = document.getElementById("to");
	var str = aux.split("asdfasdf");
	for(j = 0; j < str.length-1;j++){
	var dados = str[j].split("qazsw");	
	
	var novalinha = tbl.insertRow(-1);
	var coluna0 = novalinha.insertCell(0);
	coluna0.setAttribute('width', '270');
		coluna0.setAttribute('align', 'left');
		coluna0.setAttribute('class', 'tabesq');
	coluna0.innerHTML = dados[0];
	var coluna1 = novalinha.insertCell(1);
	coluna1.setAttribute('width', '300');
		coluna1.setAttribute('align', 'left');
		coluna1.setAttribute('class', 'tabdesc');
	coluna1.innerHTML = dados[1];
	var coluna2 = novalinha.insertCell(2);
	coluna2.setAttribute('width', '68');
	coluna2.setAttribute('class', 'tabmeio');
	coluna2.innerHTML = dados[2];
	var coluna3 = novalinha.insertCell(3);
	coluna3.setAttribute('width', '112');
	coluna3.setAttribute('class', 'tabmeio');	
	coluna3.innerHTML = dados[3];
	var coluna4 = novalinha.insertCell(4);
	coluna4.setAttribute('width', '115');
	coluna4.setAttribute('class', 'tabdir');
	coluna4.innerHTML = '<a href="javascript:void(0);" onclick="ajax(\'excluir\',\''+dados[5]+'\')"><img src="../images/excluir.jpg" /></a>';
	}



}
catch(Exception){
	document.getElementById("tabelaprodutos").value = innerHTML = aux;
	}
	}
}
else {
alert("Houve um problema, tente novamente:n" + req.statusText);
}
}
}