window.onload = function() {
	sinopse();	
	fck("wysiwyg");
	fck2("wysiwyg-01");
	fck2("wysiwyg-02");
	fck2("wysiwyg-03");
	fck2("wysiwyg-04");
	fck2("wysiwyg-05");
	fck2("wysiwyg-06");
	fck2("wysiwyg-07");
	fck2("wysiwyg-08");
	fck2("wysiwyg-09");
}
function fck(id) {
	if(window.document.getElementById(id)) {
		var oFCKeditor = new FCKeditor(id);
		oFCKeditor.ReplaceTextarea();
	}	
}
function fck2(id) {
	if(window.document.getElementById(id)) {
		var oFCKeditor = new FCKeditor2(id);
		oFCKeditor.ReplaceTextarea();
	}	
}
function mostra(id) {
	window.document.getElementById(id).style.visibility = "visible";
	window.document.getElementById(id+"img").src = window.document.getElementById(id+"img").src;
}
function esconde(id) {
	window.document.getElementById(id).style.visibility = "hidden";
	window.document.getElementById(id+"img").src = window.document.getElementById(id+"img").src;
}
function sinopse() {
	if(document.getElementById("vfCaixaContador")) {
		document.getElementById("vfCaixaContador").focus();
		document.getElementById("vfCaixaContador").blur();
	}
	if(document.getElementById("vfCaixaContador01")) {
		document.getElementById("vfCaixaContador01").focus();
		document.getElementById("vfCaixaContador01").blur();
	}
	if(document.getElementById("vfCaixaContador02")) {
		document.getElementById("vfCaixaContador02").focus();
		document.getElementById("vfCaixaContador02").blur();
	}
	if(document.getElementById("vfCaixaContador03")) {
		document.getElementById("vfCaixaContador03").focus();
		document.getElementById("vfCaixaContador03").blur();
	}
	if(document.getElementById("vfCaixaContador04")) {
		document.getElementById("vfCaixaContador04").focus();
		document.getElementById("vfCaixaContador04").blur();
	}	
}
function ir(url) {
	window.location.href=url;	
}
function voltar() {
	window.history.back();
}
function apagar(id) {
	if(confirm("O registro será excluído\nVocê tem certeza?")) {
		ir('exec.php?e='+id);
	}
}
function tool(texto) {
	window.document.getElementById('label-ferramentas').innerHTML = texto;	
}
function bannerCad(num) {
	if(num==1) {
		window.document.getElementById("banner-texto").style.display = "block";
		sinopse();
		window.document.getElementById("banner-arquivo").style.display = "none";
	}else if(num==2||num==3) {
		window.document.getElementById("banner-arquivo").style.display = "block";
		window.document.getElementById("banner-texto").style.display = "none";
	}else{
		window.document.getElementById("banner-arquivo").style.display = "none";
		window.document.getElementById("banner-texto").style.display = "none";
	}
		
}	
function paginador(url,i) {
	ir(url+"&i="+i);
}
function vfSinopse(campo,event,id) {
		maximo = campo.title;
		var texto = campo.value;
		var falta = maximo - texto.length;
		var aviso = falta;
		document.getElementById("vfContador"+id).innerHTML = aviso;
		if(falta<0) 
			campo.value = campo.value.substr(0,maximo);
		if(falta>0)
			return true;
		else
			if(event.keyCode==46 || event.keyCode == 8)
				return true;
			else
				return false;
}
function abreForm() {
	if(window.document.getElementById("formEnvio").style.display!="block") {
		window.document.getElementById("formEnvio").style.display="block";
	} else {
		window.document.getElementById("formEnvio").style.display="none";
	}
}
