

//------------------------------------------------------------------------------------
//    Scripts para manipulação da consuta processual
function abreConsultacomarca() {
	var form = document.formProcesso;
 
	    if (formProcesso.cktipo[1].checked != true){
			if (formProcesso.comarca.value == '.JECentral'){
				metodo = "Get" ;
				url = "http://www.tjrn.gov.br/cje/index.jsp";
				}
		    else		
			if (formProcesso.comarca.value == 'capital'){
				metodo = "Post" ;
				url = "http://www.tjrn.gov.br/cpopg/pcpoSelecaoPG.jsp?codForo=1";
				}
		    else{
				metodo = "Post" ;
				url ="http://10.100.7.108:8080/DefaultWebSite/website.do";
				}
			}
	else{
		metodo = "Post" ;
		url = "http://www.tjrn.gov.br/cposg/pcpoSelecaoProcesso2Grau.jsp";
		}
	

form.method = metodo;
form.action = url;
if (form.tipo.value == "parte"){
  form.cbPesquisa.value = "NMPARTE";
}
form.dePesquisa.value = form.texto.value;

alert(form.cbPesquisa.value);
alert(form.dePesquisa.value);

form.submit();
//return false;		*/

}

function mostraListaComarca()
{
	if (document.formProcesso.comarca.value == '-1'){
		document.getElementById("mostraListaComarca").innerHTML = "<a href='pages/intranet/gtSaj/comarcas_interior_SAJPG5.pdf' class='links_principal' target='_blank'>Lista de Comarcas com o SAJ</a>";
		}			 
	else{
		document.getElementById("mostraListaComarca").innerHTML = "";	
	}
	
}

function dennycmr()
{
		
	for(i=0; i<document.formProcesso.comarca.length; i++)
		if(document.formProcesso.comarca.options[i].value.charAt(0) != '.')
		{
			var opt = new Option(document.formProcesso.comarca.options[i].text,document.formProcesso.comarca.options[i].value);
			document.formProcesso.auxCmr.options[document.formProcesso.auxCmr.length] = opt;
			document.formProcesso.comarca.options[i--] = null;
		}
	
	for(i=0; i<document.formProcesso.auxJdz.length; i++)
	{
		var opt = new Option(document.formProcesso.auxJdz.options[i].text,document.formProcesso.auxJdz.options[i].value);
		document.formProcesso.comarca.options[document.formProcesso.comarca.length] = opt;
		document.formProcesso.auxJdz.options[i--] = null;
	}
	document.getElementById("CmrJzd").innerHTML = "Juizado:";
	if (document.formProcesso.comarca.value == '.JECentral'){
		//document.getElementById("CmrTipo").innerHTML = ""
		//document.getElementById("CmrInforme").innerHTML = ""
		//document.getElementById("CmrInformeComp").innerHTML = ""
		//document.getElementById("CmrCodigo").innerHTML = "Código:"
		//document.getElementById("CmrImagem").innerHTML = "<input name=\"deAuthCode\" type=\"text\" class=\"canais-pesquisa\"            size=\"6\" maxlength=\"5\"   />&nbsp;<img src=\"http://ww2.tjrn.gov.br/cje/servlet/AuthImageServlet\" alt=Código de        autenticação border=0 align=\"absbottom\" />"
					 
		
	}
	else if (document.formProcesso.comarca.value == '.JUNP'){
		document.getElementById("CmrCodigo").innerHTML = ""
		document.getElementById("CmrImagem").innerHTML = ""
		}
	else{
		document.getElementById("CmrTipo").innerHTML = "Juizado Especial - "
		document.getElementById("CmrInforme").innerHTML = "Informe : Juizado, Tipo e Texto";
		//document.getElementById("CmrCodigo").innerHTML = ""
		//document.getElementById("CmrImagem").innerHTML =""
		//document.getElementById("CmrInformeComp").innerHTML = ""
	}
	document.formProcesso.comarca.disabled = false;

}

function loadcmr()
{
	for(i=0; i<document.formProcesso.comarca.length; i++)
		if(document.formProcesso.comarca.options[i].value.charAt(0) == '.')
		{
			var opt = new Option(document.formProcesso.comarca.options[i].text,document.formProcesso.comarca.options[i].value);
			document.formProcesso.auxJdz.options[document.formProcesso.auxJdz.length] = opt;
			document.formProcesso.comarca.options[i--] = null;
		}
}

function checkcmr()
{

	
	
	for(i=0; i<document.formProcesso.comarca.length; i++)
	{
		var opt = new Option(document.formProcesso.comarca.options[i].text,document.formProcesso.comarca.options[i].value);
		document.formProcesso.auxCmr.options[document.formProcesso.auxCmr.length] = opt;
		document.formProcesso.comarca.options[i--] = null;
	}
		
	for(i=0; i<document.formProcesso.auxCmr.length; i++)
	{
		var opt = new Option(document.formProcesso.auxCmr.options[i].text,document.formProcesso.auxCmr.options[i].value);
		document.formProcesso.comarca.options[document.formProcesso.comarca.length] = opt;
		//if(document.formProcesso.comarca.options[document.formProcesso.comarca.length - 1].text == "Campo Grande")
		//	document.formProcesso.comarca.options[document.formProcesso.comarca.length - 1].selected = true;
		document.formProcesso.auxCmr.options[i--] = null;
	}
	
	loadcmr();
	document.getElementById("CmrJzd").innerHTML = "Comarca:";
	//document.getElementById("CmrTipo").innerHTML = ""
	//document.getElementById("CmrInforme").innerHTML = "";
	//document.getElementById("CmrInformeComp").innerHTML = ""
	document.formProcesso.comarca.disabled = false;
	
	//verifica se e necessário o código de autenticação
	
	
	
	
}
function checkcmr2()
{
	
	document.getElementById("CmrJzd").innerHTML = "Comarca:";
	//document.getElementById("CmrTipo").innerHTML = ""
	//document.getElementById("CmrInforme").innerHTML = "";
	document.getElementById("CmrImagem").innerHTML =""
	document.getElementById("CmrCodigo").innerHTML = ""
	//document.getElementById("CmrInformeComp").innerHTML = ""

}

function checkcmr3()
{
	
	if (document.getElementById("comarca").value == 'capital-1' 
		|| 	document.getElementById("comarca").value == 'capital-2' 
		|| 	document.getElementById("comarca").value == 'capital-3'
		)
	{
		document.getElementById("CmrCodigo").innerHTML = "&nbsp;"
		document.getElementById("CmrImagem").innerHTML ="&nbsp;"
		
	}
	else{
		document.getElementById("CmrCodigo").innerHTML = "Código:"
		document.getElementById("CmrImagem").innerHTML ="<input name=vlCaptcha type=text class=canais-pesquisa  size=10 maxlength=10/> <img src=http://www2.tjrn.jus.br/cpo/captchaServlet border=0 align=middle >"
		
		}

}

function checkselect()
{
	/**
	if(formProcesso.cktipo[2].checked ==true)
       dennycmr();
    **/

}


function checkPressed()
{
	var PressedKey = event.keyCode;
	if(PressedKey == 13)
		abreConsultacomarca();
}

function bodyLoad()
{
	loadcmr(); 
	if(formProcesso.cktipo[1].checked ==true)
		formProcesso.comarca.disabled = true;
	else if(formProcesso.cktipo[2].checked == true)
		dennycmr();
}

function menuscreen(){
if(screen.width>="1024") 
{ 
alert(screen.width);
} 
else if(screen.width=="800") 
{
alert(screen.width); 
} 

} 


//------------------------------------------------------------------------------------

