// ESSA FUNCAO NAO SERVE APENAS PARA NOTICIA, SERVE TAMBEM PARA BLOG E CADERNO VIRTUAL.
function f_inserirnoticia() { 
	document.getElementById('dvinserir').innerHTML = '<img src=imgs/carregando.gif> Aguarde...';
	document.formnoticia.submit();
}

function apagar(codigo) {
	if (confirm('Voce tem certeza que deseja apagar este registro?') == true)
    	f_apagar(codigo);
}
function apagar_blog(codigo) {
	if (confirm('Voce tem certeza que deseja apagar este registro?') == true)
    	f_apagar_blog(codigo);
}
function cancelar_edicao() {
	document.getElementById('dveditar').style.display = 'none';
	document.getElementById('dvinserir').style.display = 'block';
}
function editar() {
	document.getElementById('dveditar').style.display = 'block';
	document.getElementById('dvinserir').style.display = 'none';
}
// JavaScript Document

function editaFoto(elemento) {
//	window.parent.document.getElementsByTagName('frameset').item(0).rows='*,70';
	jan = window.open("","","width=500, height=200");
	jan.location=elemento.href;

	
	var links = document.getElementsByTagName('a');
	for(var i=0;i<links.length;i++) {
		if((links[i].className.match('imgOnList') || links[i].className.match('imgExpd')) && links[i].className.match('ativo')) {
			links[i].className = links[i].className.replace('ativo','');
		}
	}
	elemento.className += ' ativo';
	
	return false;
}

function selecionaDiretorio(elemento) {
	if(elemento.value == 'selecione') return false;
        
        self.location='?pag=imagens_manipular&dir='+elemento.value;
}

function selecionaBancoimg(elemento) {
	if(elemento.value == 'selecione') return false;
        
        self.location='?pag=v_bancoimgs&dir='+elemento.value;
}

function selecionaNarrativa(elemento) {
	if(elemento.value == 'selecione') return false;
        
        self.location='?pag=v_narrativas&dir='+elemento.value;
}

function selecionaEnsaio(elemento) {
	if(elemento.value == 'selecione') return false;
        
        self.location='?pag=v_ensaios&dir='+elemento.value;
}
function selecionaLivro(elemento) {
	if(elemento.value == 'selecione') return false;
        self.location='?pag=v_livros&dir='+elemento.value;
}

function selecionaBiografia(elemento) {
	if(elemento.value == 'selecione') return false;
        
        self.location='?pag=v_biografia&dir='+elemento.value;
}
function selecionaTrabalho(elemento) {
	if(elemento.value == 'selecione') return false;
        
        self.location='?pag=v_trabalhos&dir='+elemento.value;
}

function expandeInfo(bool) {
	var links = document.getElementsByTagName('a');
	
	var procura = (bool) ? 'imgOnList' : 'imgExpd';
	var troca = (!bool) ? 'imgOnList' : 'imgExpd';
	
	for(var i=0;i<links.length;i++) {
		if(links[i].className.match(procura)) {
			links[i].className = links[i].className.replace(procura,troca);
		}
	}
}
