function openfoto( foto, altura, largura )
{
	abrir = 'visualizarfoto.php?id_foto='+foto;
	apr = 'width='+altura+', height='+largura+', scrollbars=no, top=10, left=10';
	var foto_ = window.open( abrir, 'JANELA_FOTO',  apr );
	foto_.focus();
}

function openurl(url)
{
	window.open(url,'PROCURAR','width=800, height=300, top=10, left=10, scrollbars=yes')
}

function retorna(form, campo, valor)
{
	window.opener.document.getElementById(campo).value=valor;
	campo = campo + "_";
	window.opener.document.getElementById(campo).value=valor;
	window.opener.insereSubmit();
	window.close();
}
function insereSubmit( )
{
	document.getElementById('formcadastro').tipoacao.value = "";
	//document.formcadastro.tipoacao.value = "";
	document.getElementById('formcadastro').submit();
	//document.formcadastro.submit();
	
}

function insereSubmitNomeArquivo(nome)
{
	if(document.getElementById(nome).value)
	{
		document.getElementById('formcadastro').tipoacao.value = "";
		//document.formcadastro.tipoacao.value = "";
		document.getElementById('formcadastro').submit();
		//document.formcadastro.submit();
	}else
	{
		alert("Por Favor Insira um nome para o Arquivo");
	}
}


function insereSubmitValor(valor, campo )
{
	document.getElementById(campo).value = valor;
	document.getElementById('formcadastro').tipoacao.value = "";
	//document.formcadastro.tipoacao.value = "";
	document.getElementById('formcadastro').submit();
	//document.formcadastro.submit();
	
}

function reload( operador )
{
	if( document.getElementById('operador').value < 7 )
	{
		if( document.getElementById('valor').value != "" )
		{
			if( document.getElementById('logico').value != 0 )
			{
				document.getElementById('operador_logico').value = operador;
				document.formcadastro.submit();
			}
		}
		else
		{
			document.getElementById('logico_0').selected = true;
			alert("Insira o Valor");
		}
	}
	else
	{
		document.getElementById('operador_logico').value = operador;
		document.formcadastro.submit();
	}
}

function meusdadosReload( tipo )
{
	document.getElementById( 'reloading' ).value = 1;
	objSec = document.getElementById( 'f_ref_sec' );
	objDep = document.getElementById( 'f_ref_dept' );
	objSet = document.getElementById( 'f_ref_setor' );
	if( typeof objDep.selectedIndex == 'number' && tipo < 2 )
	{
		document.getElementById( 'f_ref_dept_0' ).selected = true;
	}
	if( typeof objSet.selectedIndex == 'number' && tipo < 3 )
	{
		document.getElementById( 'f_ref_setor_0' ).selected = true;
	}
	document.formcadastro.action='';
	document.formcadastro.submit();
}
function meusdadosReload2( tipo )
{
	document.getElementById( 'reloading' ).value = 1;
	objSec = document.getElementById( 'f_ref_sec' );
	objDep = document.getElementById( 'f_ref_dept' );
	objSet = document.getElementById( 'f_ref_setor' );
	if( typeof objDep.selectedIndex == 'number' && tipo < 2 )
	{
		document.getElementById( 'f_ref_dept_0' ).selected = true;
	}
	if( typeof objSet.selectedIndex == 'number' && tipo < 3 )
	{
		document.getElementById( 'f_ref_setor_0' ).selected = true;
	}
	document.formcadastro.action='';
	document.getElementById('TipoAcao').value='';
	document.formcadastro.submit();
}

function excluirSumit(id, nome_campo )
{
	if(id && nome_campo)
	{
		document.getElementById(nome_campo).value = id;
	}
	if( id == 0)
	{
		document.getElementById(nome_campo).value = "0";
	}
	document.formcadastro.tipoacao.value = "";
	document.formcadastro.submit();
	
}




