	var xml;

	function trocaProduto(id) {
		xml = xmlRequest();
		xml.open("POST", "produtos_ajax.php", true);
		montarHeaders();
		xml.send("id="+id);		
		xml.onreadystatechange = function() {
			if (xml.readyState == 4) {
				var dados = eval("("+xml.responseText+")");
				
				var prod = document.getElementById("trocaProdutos");
				prod.innerHTML = '<h3 class="titulo_'+id+'">'+dados["titulo"]+'</h3>';
				prod.innerHTML+= dados["txt"];
				
				window.location = "#trocaProdutos";
				
			}
		}
	}
	
	function xmlRequest() {
		if (window.XMLHttpRequest) {
			return new XMLHttpRequest();
		} else if (window.ActiveXObject) {
			return new ActiveXObject("Microsoft.XMLHTTP");
		} else {
			return new ActiveXObject("Msxml2.XMLHTTP");
		}
	}
	
	function montarHeaders() {
		xml.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xml.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate"); 
		xml.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
		xml.setRequestHeader("Pragma", "no-cache");
	}