// JavaScript Document
with(parent.document) {
	try {
		getElementById('barra_botoes_top').style.display = '';
		getElementById('barra_botoes_bottom').style.display = '';
		getElementById('cabecalho_interno').style.display = '';
		getElementById('td_titulo_pagina').style.display = '';		
	} catch(e) {
	}
	try {
		with(getElementById('btn_incluir')) {
		  style.display = '';
		  innerHTML = '<img src="_imagens/botoes/16x16/incluir.gif" id="img_incluir" width="16" height="16" align="absmiddle"> <cf_language><u>I</u>ncluir</cf_language>';
		}
		with(getElementById('btn_excluir')) {
		  style.display = '';
		  innerHTML = '<img src="_imagens/botoes/16x16/excluir.gif" id="img_excluir" width="16" height="16" align="absmiddle"> <cf_language>E<u>x</u>cluir</cf_language>';
		}
		with(getElementById('btn_editar')) {
		  style.display = '';
		  innerHTML = '<img src="_imagens/botoes/16x16/editar.gif" id="img_editar" width="16" height="16" align="absmiddle"> <cf_language><u>E</u>ditar</cf_language>';
		}
		with(getElementById('btn_atualizar')) {
		  style.display = '';
		  innerHTML = '<img src="_imagens/botoes/16x16/atualizar.gif" id="img_atualizar" width="16" height="16" align="absmiddle"> <cf_language><u>A</u>tualizar</cf_language>';
		}
		with(getElementById('btn_voltar')) {
		  style.display = '';
		  style.marginLeft = '4px';
		  innerHTML = '<img src="_imagens/botoes/16x16/voltar.gif" id="img_voltar" width="16" height="16" align="absmiddle"> <cf_language><u>V</u>oltar</cf_language>';
		}
		with(getElementById('btn_confirmar')) {
		  style.display = '';
		  style.marginLeft = '4px';
		  innerHTML = '<img src="_imagens/botoes/16x16/confirmar.gif" id="img_confirmar" width="16" height="16" align="absmiddle"> <cf_language>C<u>o</u>nfirmar</cf_language>';
		}
		with(getElementById('btn_cancelar')) {
		  style.display = '';
		  style.marginLeft = '4px';
		  innerHTML = '<img src="_imagens/botoes/16x16/cancelar.gif" id="img_cancelar" width="16" height="16" align="absmiddle"> <cf_language><u>C</u>ancelar</cf_language>';
		}		
	} catch(e) { 
	}
	try {
		for(var i=getElementById('barra_botoes_top').childNodes.length-1; i<getElementById('barra_botoes_top').childNodes.length; i--) {
			if ( getElementById('barra_botoes_top').childNodes[i].temp ) {
				getElementById('barra_botoes_top').removeChild(getElementById('barra_botoes_top').childNodes[i]);
			}
		}
	} catch(e) {}
	try {
		for(var i=getElementById('barra_botoes_bottom_sp').childNodes.length-1; i<getElementById('barra_botoes_bottom_sp').childNodes.length; i--) {
			if ( getElementById('barra_botoes_bottom_sp').childNodes[i].temp ) {
				getElementById('barra_botoes_bottom_sp').removeChild(getElementById('barra_botoes_bottom_sp').childNodes[i]);
			}
		}
	} catch(e) {}
	try {
		parent.document.getElementById('titulo_aplicacao').innerHTML = '';
		parent.document.getElementById('titulo_pagina').innerHTML = '';
	} catch(e) {
	}
}


parent.f_editar = function() {
	f_editar();
};
parent.f_incluir = function() {
	f_incluir();
};
parent.f_excluir = function() {
	f_excluir();
};
parent.f_confirmar = function() {
	f_confirmar();
};
parent.f_cancelar = function() {
	f_cancelar();
};
parent.f_atualizar = function() {
	f_atualizar();
};

function f_cancelar(){
	document.forms[0].OPERACAO.value = 1; // consultar
	f_desabilita_todos_campos();
	f_on_cancelar();
	try {
		f_habilitar_botao('localizar','f_localizar()');
	} catch(e) {
	}
	f_habilitar_botao('incluir','f_incluir()');
	f_desabilitar_botao('cancelar');
	f_desabilitar_botao('confirmar');
};

function f_incluir(){
	f_habilita_todos_campos();
	f_limpar_campos();
	f_on_incluir();
	try {
		f_desabilitar_botao('localizar');
	} catch(e) {}
	f_desabilitar_botao('incluir');
	f_desabilitar_botao('editar');
	f_desabilitar_botao('excluir');
	f_habilitar_botao('cancelar','f_cancelar()');
	f_habilitar_botao('confirmar','f_confirmar()');
	document.forms[0].OPERACAO.value = 2; // incluir
};	

function f_editar(){
	document.forms[0].OPERACAO.value = 3; // editar
	f_habilita_todos_campos();
	try {
		f_desabilitar_botao('localizar');
	} catch(e) {}
	f_desabilitar_botao('incluir');
	f_desabilitar_botao('editar');
	f_desabilitar_botao('excluir');
	f_habilitar_botao('cancelar','f_cancelar()');
	f_habilitar_botao('confirmar','f_confirmar()');
	f_on_editar();
};	

function f_atualizar(){
	try {
		top.principal.iconteudo.window.location.reload();
	} catch (e) {
		top.iconteudo.window.location.reload();
	}
};

function f_on_incluir() {}
function f_on_cancelar() {}
function f_on_editar() {}