
var Ajax = false;
function AjaxRequest()
{
	Ajax = false;

	if(window.XMLHttpRequest)
	{
		Ajax = new XMLHttpRequest();
	}
	else if(window.ActiveXObject)
	{
		try{
			Ajax = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e){
			try{
				Ajax = new ActiveXObject("Microsoft.XMLHTTP")
			}
			catch (e){
				
			}
		}
	}
	return Ajax;
}

function load(pagina)
{
	Ajax = AjaxRequest();
	if(!Ajax)
	{
		get('conteudo').innerHTML = 'Erro';
	}
	Ajax.onreadystatechange = enviaPagina;
	var hora = new Date();
	var tmp = hora.getTime();
	pagina = pagina+'?t='+tmp;
	Ajax.open('GET', pagina, true);
	Ajax.send('null');
}

function enviaPagina()
{
	if(Ajax.readyState == 1)
	{
		get('conteudo_texto').innerHTML = '';
		//get('carregando').style.display= "block";
	}
	if(Ajax.readyState == 4)
	{
		setTimeout('status()',300);
	}
}
function status()
{
	if(Ajax.status == 200)
	{
		get('conteudo_texto').innerHTML = Ajax.responseText;
		//get('carregando').style.display = 'none';
	}
	else
	{
		get('conteudo_texto').InneHTML = "Erro";
	}
}
function get(id)
{
	return document.getElementById(id);
}

function contador(codigo, tipo)
{
	var param  = 'tipo='+tipo+'&codigo='+codigo;
	Ajax = AjaxRequest();
	Ajax.open('GET', 'conta.php?'+param, true);
	Ajax.send('null');
}