function nuevoAjax(){
var xmlhttp=false;
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }

if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
  xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}

function AgregarCarrito(codigo){
	c = document.getElementById('contenido_carrito');
	ajax=nuevoAjax();
	c.innerHTML = 'procesando...';	
	ajax.open("POST", "ajax/envia_carrito.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {			
			c.innerHTML = ajax.responseText;
			document.getElementById('carro').src='carrito.php';
			
		}
	}
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	ajax.send("cod="+codigo)
}

function Actualiza(){
	c = window.parent.document.getElementById('contenido_carrito');
	ajax=nuevoAjax();
	c.innerHTML = 'procesando...';	
	ajax.open("POST", "ajax/envia_carrito.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {			
			c.innerHTML = ajax.responseText;						
		}
	}
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");	
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	ajax.send("ref=1")
}

