// JavaScript Document
//Marca todos os checkboxs de uma pagina
function MarcaTudo(){
	
	if (form.checkbox_marca_tudo.checked == true){
	
		for (i=0; i<form.length; i++){
			 if (form.elements[i].type == "checkbox"){
				  form.elements[i].checked = true;
		     }
		 }
	}
	else
	{
			for (i=0; i<form.length; i++){
				 if (form.elements[i].type == "checkbox")
					 form.elements[i].checked = false;
	        }
	}

}//fim da funcao*/

function PulaCampo(campo1,campo2,tamanho)
{
  if ( campo1.value.length==tamanho )
   campo2.focus();
}

//******************************************************************************************************

function FormataCpf(campo,tammax,teclapres) {
	var tecla = teclapres.keyCode;
	vr = document.form[campo].value;
	vr = vr.replace( "/", "" );
	vr = vr.replace( "/", "" );
	vr = vr.replace( ",", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( "-", "" );
	vr = vr.replace( "-", "" );
	vr = vr.replace( "-", "" );
	vr = vr.replace( "-", "" );
	vr = vr.replace( "-", "" );
	tam = vr.length;

	if (tam < tammax && tecla != 8){ tam = vr.length + 1 ; }

	if (tecla == 8 ){	tam = tam - 1 ; }
		
	if ( tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ){
		if ( tam <= 2 ){ 
	 		document.form[campo].value = vr ; }
	 	if ( (tam > 2) && (tam <= 5) ){
	 		document.form[campo].value = vr.substr( 0, tam - 2 ) + '-' + vr.substr( tam - 2, tam ) ; }
	 	if ( (tam >= 6) && (tam <= 8) ){
	 		document.form[campo].value = vr.substr( 0, tam - 5 ) + '.' + vr.substr( tam - 5, 3 ) + '-' + vr.substr( tam - 2, tam ) ; }
	 	if ( (tam >= 9) && (tam <= 11) ){
	 		document.form[campo].value = vr.substr( 0, tam - 8 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + '-' + vr.substr( tam - 2, tam ) ; }
	 	if ( (tam >= 12) && (tam <= 14) ){
	 		document.form[campo].value = vr.substr( 0, tam - 11 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + '-' + vr.substr( tam - 2, tam ) ; }
	 	if ( (tam >= 15) && (tam <= 17) ){
	 		document.form[campo].value = vr.substr( 0, tam - 14 ) + '.' + vr.substr( tam - 14, 3 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + '-' + vr.substr( tam - 2, tam ) ;}
	}		
}

<!--
//Funcao para carregar o iframe com tamanho maior a depender da configuraçaõ do browser do usuario
function Carrega_Iframe()
{
if (window.screen.width == 1024)
 document.writeln(' <iframe border=0 name="Lista_Informacao" id="Lista_Informacao" frameborder=0 scrolling="auto" marginwidth=0 width="100%" height=460px> </iframe>');
else
 document.writeln(' <iframe border=0 name="Lista_Informacao" id="Lista_Informacao" frameborder=0 scrolling="auto" marginwidth=0 width="100%" height=340px> </iframe>');
 }
//-->


// Estas funcoes mudam a cor da linha da tabela
  function mOvr(src,clrOver) {
	  src.style.cursor = 'hand';
	  src.bgColor = clrOver;
  }
  
  function mOut(src,clrIn) {
	  src.style.cursor = 'default';
	  src.bgColor = clrIn;
  }
  
  function mClk(src) {
	  src.children.tags('A')[0].click();
  }

//funcoes do menu 
function MostraFilhos(pai,filho)
{
	pai   = window.document.getElementById(pai);
	filho = window.document.getElementById(filho);

	filho.style.display='block';
	
	//Caso seja IE
	if(navigator.appName=='Microsoft Internet Explorer')
	{
		filho.style.pixelLeft=133;
		filho.style.pixelTop=pai.offsetTop+245;
	}
	else if(navigator.appName!=='Microsoft Internet Explorer')
	{
		filho.style.marginLeft=-12;
		filho.style.marginTop=-115;
	}
	
}

function EscondeFilhos(filho)
{
	filho               = window.document.getElementById(filho);
	filho.style.display = 'none';
}


function MostraSubmenu(subcategoria)
{
	subcategoria = window.document.getElementById(subcategoria);
	if(subcategoria.style.display == 'none')
	{
		subcategoria.style.display = 'block';
	}
}

function EscondeSubmenu(subcategoria)
{
	subcategoria = window.document.getElementById(subcategoria);
	if(subcategoria.style.display == 'block')
	{
		subcategoria.style.display = 'none';
	}
}
