function buscacep(caminhoINC, dsCep, dsLogradouro, dsBairro, dsCidade, dsUf){
	
	cep = dsCep.value.replace("-","");

	//window.alert(caminhoINC+"/buscacep.asp?cep="+cep);

	$(function() {
		$.ajax({
		type: "GET",
		url: caminhoINC+"/buscacep.asp?cep="+cep,
		dataType: "html",
		contentType: "application/x-www-form-urlencoded; charset=UTF-8",
		success: function(xml) {
			$.xmlDOM(xml).find('resposta').each(function(){
				if($(this).attr('retorno')==1){

					dsLogradouro.value = $(this).attr('endereco');
					dsBairro.value = $(this).attr('bairro');
					dsCidade.value = $(this).attr('cidade');
					var sel = dsUf;

					for (i=0 ; i < sel.options.length; i++) {
						if (sel.options[i].value == $(this).attr('estado')) {
							sel.selectedIndex = i;
						}
					}
				}else{
					window.alert($(this).attr('erro'));
				}
		   });
		}});
	});
}

