/********* Bloquer CTRL + v / CTRL + C -- Controle de Caracteres *************/
function Bloquear(e,campo,exibe,tipo){
	var ctrl = null;
	var tecla = null;
	if(window.event){
		ctrl = window.event.ctrlKey;//IE
		tecla = window.event.keyCode;//IE
	}else{
		ctrl = e.ctrlKey;//firefox
		tecla = e.which;//firefox
	}

	if ((ctrl && tecla==67) || (ctrl && tecla==86))
		return false;
	else
		soma(campo,exibe,tipo);
}

limite = 499;
limite2 = 299;
function soma(campo,exibe,tipo){
	if (tipo == "1")
		limit = limite;
	else
		limit = limite2;

	var mais_um = campo.value.length - 1;
	mais_um++;
	if (campo.value.length > limit) {
		campo.value = '';
		campo.value = valor_limite;
		alert("A campo deve ter no máximo "+(limit+1)+" caracteres");
	}else{
		valor_limite = campo.value;
		exibe.value = '';
		exibe.value = (limit-mais_um);
	}
	campo.focus();
}
/********* Fim Bloquer CTRL + v / CTRL + C -- Controle de Caracteres *************/

/****** Popup *************/
function abrir(url, nome, largura, altura){
	window.open(url,nome,"height=" + altura + ",width=" + largura + ",directories=no,menubar=no,personalbar=no,toolbar=no,scrollbars=no");
}
/****** Fim Popup *************/

/************ Monta layout *******************/
function resolucao(){
	var el = document.getElementsByTagName("div");
	var tam = (screen.width >= 1024 ? 983 : 767);
	var dp	= (screen.width >= 1024 ? "block" : "none");
	
	for (i = 0; i < el.length; i++){
		if (el[i].className == "setTam")
			el[i].style.width = tam+"px";
		if (el[i].className == "c3" || el[i].id == "c3")
			el[i].style.display = dp;
	}
}
/************ Fim Monta layout *******************/


/************** Problemas com acesso ******************/
function EfeitoAparecer(id, tamInicio, tamFim) {
	try{
		document.getElementById(id).style.display = 'block';
		var velocidade = Math.round(100/100);
		var timer = 0;
		var i = 0;
		if(tamInicio > tamFim){
			for(i = tamInicio; i >= tamFim; i--){
				setTimeout("Efeito(" + i + ",'" + id + "','fechar')",(timer * velocidade));
				timer = timer + 2;
			}
		}else if(tamInicio < tamFim){
			document.getElementById(id).style.height = '0';
			for(i = tamInicio; i <= tamFim; i++){
				setTimeout("Efeito(" + i + ",'" + id + "','abrir')",(timer * velocidade));
				timer = timer + 2;
			}
		}
	}catch(e){}
}

function Efeito(tamanho, id, operacao){
	try{
		var d = document.getElementById(id);
		d.style.height = tamanho + 'px';
		if (parseInt(tamanho) == 0 && operacao == "fechar")document.getElementById(id).style.display = 'none';
	}catch(e){}
}
/************** Fim Problemas com acesso ******************/

/****** Abas *******/
function doClick(index, numTabs){
	location.href = "#"+index;
	document.getElementById("tabevento"+index).className = "ligado";
	document.getElementById("tab"+index).style.display = "block";
	for (var i=0; i < numTabs; i++){
		if (i != index){
			document.getElementById("tabevento"+i).className = "aba";
			document.getElementById("tab"+i).style.display = "none";
		}
	}
}

function ativarAba(){
	var str = window.location.toString();
	str = str.split("#")[1];
	if (str == null){
		document.getElementById("tabevento1").className = "ligado";
		document.getElementById("tab1").style.display = 'block';
	}else{
		var abas = document.getElementById("conteudoAba").getElementsByTagName("div");
		var contAba = 1;
		for (i = 0; i < abas.length; i++){
			if (abas[i].id.substring(0,3) == "tab")
				contAba++;
		}
		for (i = 0; i < contAba; i++){
			if (i != parseInt(str)){
				document.getElementById("tabevento"+str).className = "ligado";
				document.getElementById("tab"+str).style.display = "block";
			}else{
				document.getElementById("tabevento"+str).className = "aba";
				document.getElementById("tab"+str).style.display = "none";
			}	
		}
	}
}
/****** Fim Abas *******/