function MontaHtml(codprod) {
	var areahtml = document.getElementById('AreaHtml');
	var codfonte = "&lt;p style=\"text-align: center;\"&gt;&lt;a href=\"http://www.logsystem.com.br/CEP/Busca/?cod="+codprod+"\" target=\"_blank\"&gt;&lt;img src=\"http://www.logsystem.com.br/CEP/bannerfrete.jpg\"&gt;&lt;/a&gt;&lt/p&gt;";
	
	if (codprod == "") {
		areahtml.style.display = "none";
	} else {
		areahtml.style.display = "block";
		areahtml.innerHTML = codfonte;		
	}
}
function Requisicao()
{
	var xmlHttp;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	return xmlHttp;
}

function PegaForm(codprod) {
	var xmlHttp=Requisicao();
	var AreaTeste = document.getElementById("AreaTeste");
	AreaTeste.style.display = "block";
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url="busca/default.asp?cod="+codprod;
	xmlHttp.onreadystatechange=function() {
		//Quando pegar respostas
		if(xmlHttp.readyState==4 && xmlHttp.status==200)
		{
			AreaTeste.innerHTML=xmlHttp.responseText;
		}
}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function MostraResultado() {
	var xmlHttp=Requisicao();
	var url = "calcFrete.asp";
	var AreaMostra = document.getElementById("AreaMostra");
	var CEPOrigem = document.getElementById("CEPOrigem").value;
	var CEPDestino = document.getElementById("CEPDestino").value;
	var PesoProd = document.getElementById("PesoProd").value;
	var volumeFrete = document.getElementById("volumeFrete").value;
	var Qtd = document.getElementById("Qtd").value;
	var params;
	params = "CEPOrigem="+CEPOrigem+"&CEPDestino="+CEPDestino+"&PesoProd="+PesoProd+"&volumeFrete="+volumeFrete+"&Qtd="+Qtd;
	xmlHttp.open("POST", url, true);

	//Send the proper header information along with the request
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", params.length);
	xmlHttp.setRequestHeader("Connection", "close");

	xmlHttp.onreadystatechange = function() {//Call a function when the state changes.
		if(xmlHttp.readyState == 3) {
			AreaMostra.innerHTML = "Aguarde, carregando...";
			AreaMostra.style.display = "block";
		}
		if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {
			AreaMostra.innerHTML = xmlHttp.responseText;
			AreaMostra.style.display = "block";
		}
	}
	xmlHttp.send(params);

}
