
function Comprar() {
	
	this.carregar = function(id) {
		if (id == '')
			return;
		ajax = new sack('../xml/comocomprar/'+id);
		ajax.onCompletion = comprar.mostrar;
		ajax.method = "GET";
		ajax.runAJAX();
	}
	
	this.mostrar = function() {
		obj = ajax.responseXML;
		campos = obj.getElementsByTagName('representante');
		
		var sigla       = campos[0].getElementsByTagName('sigla')[0].firstChild.nodeValue;
		var estado      = campos[0].getElementsByTagName('estado')[0].firstChild.nodeValue;
		var html        = campos[0].getElementsByTagName('html')[0].firstChild.nodeValue;
		
		$('imgrepresentante').src = '../imagens/comocomprar/comocomprar_' + sigla + '.jpg';
		$('imgrepresentante').alt = estado;
		$('imgrepresentante').style.display = 'block';
		
		$('representante').childNodes[0].innerHTML = estado;
		$('representantes').innerHTML = html;
	}
}

comprar = new Comprar;