var local;
var req;
function loadXMLDoc(url)
{
	req = null;
	if (window.XMLHttpRequest)
	{
		req = new XMLHttpRequest();
		req.onreadystatechange = processReqChange;
		req.open("GET", url, true);
		req.send(null);
	}
	else if (window.ActiveXObject)
	{
		try
		{
			req = new ActiveXObject("Msxml2.XMLHTTP.4.0");
		}
		catch(e)
		{
			try
			{
				req = new ActiveXObject("Msxml2.XMLHTTP.3.0");
			}
			catch(e)
			{
				try
				{
					req = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e)
				{
					try
					{
						req = new ActiveXObject("Microsoft.XMLHTTP");
					}
					catch(e)
					{
						req = false;
					}
				}
			}
		}
		if (req)
		{
			req.onreadystatechange = processReqChange;
			req.open("GET", url, true);
			req.send();
		}
	}//fim do objeto
}


function processReqChange()
{
	if(req.readyState == 1)
	{
		switch(div_destino)
		{
			case "status":
			document.getElementById("status").innerHTML = "<b>enviando email, aguarde...</b>";
			break;
		}

	}

	if (req.readyState == 4)
	{
		if (req.status == 200)
		{
			switch(div_destino)
			{
				case "status":
				document.getElementById("status").innerHTML = req.responseText;
				document.frm.reset();
				break;
			}

		}
		else
		{
			alert("Houve um problema ao obter os dados:\n" + req.statusText);
		}
	}
}

function submetecontato(nome,email,fone,assunto,msg)
{
	div_destino = status;
	loadXMLDoc("ajax_envia_email.php?nome="+nome+"&tel="+fone+"&email="+email+"&assunto="+assunto+"&msg="+msg);
}
