function muda_div(_divVer, _divEsconde)		 
{  
//	  alert(document.getElementById(_divVer).id )
	  
   document.getElementById(_divEsconde).style.overflow = "hidden";
 //   document.getElementById(_divEsconde).style.height  = 0;
   document.getElementById(_divEsconde).style.display = "none";
   document.getElementById(_divVer).style.overflow= "auto";
  //  document.getElementById(_divVer).style.height  = 400;  
   document.getElementById(_divVer).style.display = "block";
  // alert( document.getElementById(_divVer).style.height)
}



function abrecada(_op, _id)		// abre/altera cadastro.... em tipo_andamento, tipo_processo, etc....
{ 
   muda_div("divTopo","divCorpo")
   _div = "divTopo"
   filaget("cada/campos.php?op="+_op+"&id="+_id, _div)
   
}

function buscacada(_form, _op, _fn) // módulo conslta - partes
{
	muda_div("divCorpo","divTopo")	
	_param = param(_form, 'input')
	_param = _param + param(_form, 'select')

	_par = "fn=" + _fn+ "&op=" + _op + "&"+_param
 //alert(_par)
     loader = new net.ContentLoader("cada/busca.php", auxlistagem, null, 'POST', _par); 

  // filapost(_par, "divCorpo", 0, )
}

function auxlistagem(){
//	alert( loader.req.responseText)
	$('divCorpo').innerHTML  = loader.req.responseText
	sorttable.init();

}

function salvacada(_form, _arq)
{ 
	_param = todparam(_form,0)
//	
 	_param = _param + param(_form, 'select')
	_param = _param + param(_form, 'textarea')
//	alert(_param)
    loader = new net.ContentLoader("cada/grava/"+ _arq, _tmpsav1, null, 'POST', _param); 
}
function _tmpsav1(){
 //   alert(loader.req.responseText)
	muda_div("divCorpo", "divTopo")
	elem = $("idnomebusca").value
	paramaux = "&nomebusca="+elem + "&exc=" + $('idchkexc').checked
 	filapost(loader.req.responseText + paramaux, "divCorpo",0,"cada/busca.php" )
}
function salvanovo(_form, _arq)
{ 
	_param = todparam(_form,0)
//	alert(_param)
    loader = new net.ContentLoader("cada/grava/"+ _arq, _tmpsavenovo, null, 'POST', _param); 
}

function _tmpsavenovo(){
  // alert(loader.req.responseText)
//	muda_div("divCorpo", "divTopo")
   _div = "divTopo"
   filaget("cada/campos.php?"+loader.req.responseText, _div, 0,"idnome")
   
   //	filapost(loader.req.responseText + "&nomebusca="+elem, "divCorpo",0,"cada/busca.php" )
}



function salvaestagio(_form, _arq)
{ 
	_param = todparam(_form,0)
//	alert(_param)
    loader = new net.ContentLoader("/intra2/cada/grava/"+ _arq, _tmpsav3, null, 'POST', _param); 
}


function sohsalva(_form, _arq)
{   
	_param = todparam(_form,0)
    loader = new net.ContentLoader("/intra2/cada/grava/"+ _arq, _tmpsav2, null, 'POST', _param); 
}

function _tmpsav2(){
	muda_div("divCorpo", "divTopo")
	document.getElementById("divCorpo").innerHTML = loader.req.responseText;
 	alert(loader.req.responseText)
	//alert("Dados Gravados com sucesso!\n ")
//	alert("Dados não foram gravados... sistema em manutenção!\n ")
}


function _tmpsav3(){
 //	 alert(loader.req.responseText)
     if (loader.req.responseText == '-1')
     	 alert('Candidato com documento já cadastrado!')
     else if (loader.req.responseText == '-2')
     	 alert('Candidato com nome já cadastrado!')
     else if (loader.req.responseText == '-3')
     	 alert('E-Mail Inválido!')
     else if (loader.req.responseText == '-4')
     	 alert('Data Inválida!')
     else {
	 	//param = "/texto/estagio/ficha.php?id=" + loader.req.responseText
	 //	alert('Cadastro realizado com sucesso!')
	 	filaget("/texto/estagio/tela.php?id=" + loader.req.responseText, "divConteudo")
		//document.getElementById("divConteudo").innerHTML =""
	 }
}
	// exclui..
function excluicada(_op, _id)	
{
 //alert(document.getElementById("divLista").style.display)alert(0)
 //alert("op="+_op+"&id="+_id)
 	if (confirm("Excluir Andamento?")) { 
 		loader = new net.ContentLoader("cada/exclui.php",_tmpsav1, null, 'POST', "op="+_op+"&id="+_id); 
    }
}


function tmpsavfoto(){
   // alert(loader.req.responseText)
   muda_div("divLista", "divConteudo")
    if (loader.req.responseText == 0)
    	filaget("busca.php?op="+loader.req.responseText, "divLista" )
  
    if (loader.req.responseText == 1)
    	net.ContentLoader("buscaevento.php?op="+loader.req.responseText ,null, null, 'POST',"");
    //	location =   
   hidebox()
   // document.getElementById("divLista").innerHTML  = loader.req.responseText 
}


function arquivozip(_op, _id){
  showbox()
 // document.getElementById("miniJanela").style.width = "480px"
  document.getElementById("miniJanela").style.height = "400px"
  filaget("cada/arquivozip.php?op="+_op+"&id="+_id, "miniJanela")
}

function _consulta_com(_pasta, _op)			// módulo conslta - partes
{
  // alert(_pasta);
   // filaget(_pasta+"/index.php?op="+_op, "divConteudo" )
    filaget(_pasta+"/cadastro.php?op="+_op, "div_comum" )
}

function _consulta_adm(_pasta, _op)			// módulo conslta - partes
{
  // alert(_pasta);
   // filaget(_pasta+"/index.php?op="+_op, "divConteudo" )
    filaget(_pasta+"/cadastro.php?op="+_op, "div_divadm" )
}
function _consulta_div(_pasta, _op)			// módulo conslta - partes
{
  // alert(_pasta);
   // filaget(_pasta+"/index.php?op="+_op, "divConteudo" )
    filaget(_pasta+"/cadastro.php?op="+_op, "div_diver" )
    _menu_retorno = mnadm;
}
function _consulta_pro(_pasta, _op)			// módulo conslta - partes
{
  // alert(_pasta);
   // filaget(_pasta+"/index.php?op="+_op, "divConteudo" )
    filaget(_pasta+"/cadastro.php?op="+_op, "div_divpro" )
    _menu_retorno = mnadm;
}

