function addEvent(elm, evType, fn, useCapture)	{
	if(elm.addEventListener) {
		elm.addEventListener(evType, fn, useCapture);
		return true;
	} else if(elm.attachEvent) {
		var r = elm.attachEvent('on' + evType, fn);
		return r;
	} else {
		elm['on' + evType] = fn;
	}
}

function getEventTag(e) {
	if(e.srcElement) elm = e.srcElement; else if(e.target) elm = e.target;
	return elm;
}

function getEventTag(e) {
	if(e.srcElement) elm = e.srcElement; else if(e.target) elm = e.target;
	return elm;
}

function inArray(arr,str) {
	for(i in arr) if(arr[i] == str) return true;
	return false;
}

function display(elm) {
	try {
		elm.style.display = "block";
	} catch(e) {
		window.status = "Erro ao mostrar o elemento \n"+e;
	}
}

function hide(elm) {
	try{
		elm.style.display = "none";
	} catch(e) {
		window.status = "Erro ao ocultar o elemento \n"+e;
	}
}

function QueryString(variavel){
	qs=new Array()
	variaveis=location.search.replace(/\x3F/,"").replace(/\x2B/g," ").split("&")
	if(variaveis!=""){
		for(i=0;i<variaveis.length;i++){
			nvar=variaveis[i].split("=")
			qs[nvar[0]]=unescape(nvar[1])
		}
	}

    return qs[variavel]
}

function copyrightColor() {
	if (!document.body || typeof(document.body.innerHTML) == "undefined") return false;

	var bodyText = document.body.innerHTML;
	var searchTerm = "gpHOT";

	var newHTML = "";
	var i = -1;

	while (bodyText.length > 0) {
		i = bodyText.indexOf(searchTerm, i+1);
		if (i < 0) {
			newHTML += bodyText;
			bodyText = "";
		} else {
			if (bodyText.lastIndexOf(">", i) >= bodyText.lastIndexOf("<", i)) {
				if (bodyText.lastIndexOf("/script>", i) >= bodyText.lastIndexOf("<script", i)) {
					newHTML += bodyText.substring(0, i);
					newHTML += "<span style='color:#2894d0'>gp</span>";
					newHTML += "<span style='color:#f64d1f'>HOT</span>";
					bodyText = bodyText.substr(i + searchTerm.length);
					i = -1;
				}
			}
		}
	}
	document.body.innerHTML = newHTML;
	return true;
}

function correctHeight() {
	var oLateral = document.getElementById("lateral");
	var oMiolo = document.getElementById("miolo");

	if(oLateral && oMiolo) {
		if(oLateral.offsetHeight > oMiolo.offsetHeight)
			oMiolo.style.height = oLateral.offsetHeight -42 +"px"; // 20 = padding
		else if(oLateral.offsetHeight < oMiolo.offsetHeight)
			oLateral.style.height = oMiolo.offsetHeight+42+"px";
	}
}