// JavaScript Document


atual=0

function CarregaCombo(destino,url){
	
    //Exibe o texto carregando no div conteúdo
    var conteudo=document.getElementById(destino)
	conteudo.innerHTML = '';
    conteudo.innerHTML='<select><option>carregando...</option></select>'


    //criando o objeto http request
   try{
		xmlhttp = new XMLHttpRequest();
	}catch(ee){
		try{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(E){
				xmlhttp = false;
			}
		}
	}
   
    //Abre a url
    xmlhttp.open("GET",url,true);
	
	//Executada quando o navegador obtiver o código
    xmlhttp.onreadystatechange=function(){

        if (xmlhttp.readyState==4){

            //Lê o texto
            var texto=xmlhttp.responseText

            //Desfaz o urlencode
            texto=texto.replace(/\+/g," ")
            texto=unescape(texto)

            //Exibe o texto no div conteúdo
            var conteudo=document.getElementById(destino)			
            conteudo.innerHTML=texto
        }
    }
    xmlhttp.send(null)
}

function RetornaValor(valor,campo){
	document.getElementById(campo).value = valor;	
}


