// JavaScript Document
function abrirjanela(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//<a href="abrirjanela('aaa.asp','abrir','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=333,height=333')"

// para indicar que o serviço está em manutenção
function manutencao()
{
alert("Encontra-se em Desenvolvimento/Manutenção! \n\n Volte mais tarde por favor.")
}



function expandir(div) {
	var ldiv = document.getElementById(div);
	if(ldiv.className == 'DivAberto'){
		ldiv.className = 'DivFechado';
	}else{
		ldiv.className = 'DivAberto';
	}
}


//funtion validar campo numero
//onKeyPress="return Tecla(event);"
function Tecla(e)
{
if (document.all) // Internet Explorer
var tecla = event.keyCode;
else if(document.layers) // Nestcape
var tecla = e.which;
if (tecla > 47 && tecla < 58) // numeros de 0 a 9
return true;
else
{
if (tecla != 8) // backspace
event.keyCode = 0;
//return false;
else
return true;
}
}



// para auementar/ diminuir o tamnanho do texto

var min=12;
var max=17;
function increaseFontSize() {
var p = document.getElementById('zonatexto');

if(p.style.fontSize) {
var s = parseInt(p.style.fontSize.replace("px",""));
} else {
var s = 12;
}
if(s!=max) {
s += 2;
}
p.style.fontSize = s+"px"

}
function decreaseFontSize() {
var p = document.getElementById('zonatexto');

if(p.style.fontSize) {
var s = parseInt(p.style.fontSize.replace("px",""));
} else {
var s = 12;
}
if(s!=min) {
s -= 2;
}
p.style.fontSize = s+"px"

}


<!--//

function Limpar(valor, validos) {
// retira caracteres invalidos da string
var result = "";
var aux;
for (var i=0; i < valor.length; i++) {
aux = validos.indexOf(valor.substring(i, i+1));
if (aux>=0) {
result += aux;
}
}
return result;
}

//Formata número tipo moeda usando o evento onKeyDown

function Formata(campo,tammax,teclapres,decimal) {
var tecla = teclapres.keyCode;
vr = Limpar(campo.value,"0123456789");
tam = vr.length;
dec=decimal

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 <= dec )
{ campo.value = vr ; }

if ( (tam > dec) && (tam <= 5) ){
campo.value = vr.substr( 0, tam - 2 ) + "," + vr.substr( tam - dec, tam ) ; }
if ( (tam >= 6) && (tam <= 8) ){
campo.value = vr.substr( 0, tam - 5 ) + "." + vr.substr( tam - 5, 3 ) + "," + vr.substr( tam - dec, tam ) ; 
}
if ( (tam >= 9) && (tam <= 11) ){
campo.value = vr.substr( 0, tam - 8 ) + "." + vr.substr( tam - 8, 3 ) + "." + vr.substr( tam - 5, 3 ) + "," + vr.substr( tam - dec, tam ) ; }
if ( (tam >= 12) && (tam <= 14) ){
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 - dec, tam ) ; }
if ( (tam >= 15) && (tam <= 17) ){
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 ) ;}
} 

}


 var div = "manipulada";  
 // atribuir o nome da div que quer mostrar e ocultar  
 
 function AparecerDiv(){ // função aparecer  
     document.getElementById(div).style.display = "block"; 

    // usamos o style.display para manupular o css da div e mostrar ela  
}  
 
function OcultarDiv(){  // função ocultar  
     document.getElementById(div).style.display = "none";  
     // usamos o style.display para manupular o css da div e ocultar ela  
}




