/**
 *
 */

/*
 * Funcionalidades que devem ser executadas no final do carregamento da página.
 */
window.onload = function () {
	var a = document.links;
	for (var i = 0, s = a.length; i < s; i++) {
		if (a[i].rel == 'external') {
			 a[i].target = '_blank';
		}
	}
}

/**
 * 
 * @param c
 * @return void
 */
function p(c) {
	var p;
	var l = t('li');
	for (var i = 0, s = l.length; i < s; i++) {
		if (l[i].className.indexOf('paises') != -1) {
			p = l[i];
			break;
		}
	}
	if (p) {
		if (c.value == 1) {
			if (p.className.indexOf('ativo') == -1) {
				p.className += ' ativo';
			}
		} else {
			if (p.className.indexOf('ativo') != -1) {
				p.className = p.className.replace(/ativo/i, ' ');
			}
		}
	}
}

function c() {
	var c = i('cep').value;
	if (c) {
		x('/revestir2009/cep.php?cep=' + c, function (e) {
			e = eval(e);
			if (e.error) {
				window.alert(e.error);
			} else {
				i('estado').value = e.uf;
				i('cidade').value = e.cidade;
				i('endereco').value = e.endereco;
			}
		});
	}
}

function i(i) {
	return document.getElementById(i);
}

function t(t) {
	return document.getElementsByTagName(t);
}

function x(u, f) {
	var x = window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest();
	x.open('GET', u, true);
	x.send(null);
	x.onreadystatechange = function() {
		if (x.readyState == 4) {
			f(x.responseText);
		}
	}
}