<!--
var persistclose=0 //set to 0 or 1. 1 means once the bar is manually closed, it will remain closed for browser session
var startX = screen.width/100 //set x offset of bar in pixels
var startY =510 //set y offset of bar in pixels
var verticalpos="fromtop" //enter "fromtop" or "frombottom"

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function closebar(){
if (persistclose)
document.cookie="remainclosed=1"
document.getElementById("topbar").style.visibility="hidden"
}

function staticbar()
{ barheight=document.getElementById("topbar").offsetHeight;
 var ns = (navigator.appName.indexOf("Netscape") != -1) || window.opera;
    var d = document;
    function ml(id){
        var el=d.getElementById(id);
        if (!persistclose || persistclose && get_cookie("remainclosed")=="")
        el.style.visibility="visible"
        if(d.layers)el.style=el;
        el.sP=function(x,y){this.style.right=x+"px";this.style.top=y+"px";};
        el.x = startX;
        if (verticalpos=="fromtop")
        el.y = startY;
        else{
        el.y = ns ? pageYOffset + innerHeight : iecompattest().scrollTop + iecompattest().clientHeight;
        el.y -= startY;
        }
        return el;
    }
    window.stayTopLeft=function(){
        if (verticalpos=="fromtop"){
        var pY = ns ? pageYOffset : iecompattest().scrollTop;
        ftlObj.y += (pY + startY - ftlObj.y)/8;
        }
        else{
        var pY = ns ? pageYOffset + innerHeight - barheight: iecompattest().scrollTop + iecompattest().clientHeight - barheight;
        ftlObj.y += (pY - startY - ftlObj.y)/8;
        }
        ftlObj.sP(ftlObj.x, ftlObj.y);
        setTimeout("stayTopLeft()", 10);
    }
    ftlObj = ml("topbar");

    stayTopLeft();
}

if (window.addEventListener)
window.addEventListener("load", staticbar, false)
else if (window.attachEvent)
window.attachEvent("onload", staticbar)
else if (document.getElementById)
window.onload=staticbar
// -->
<!--
function AbrirJanela(link) {imgWin=window.open(link,"displayWindow","toolbar=no,location=no,directories=no,menubar=no,status=no,resizeable=no,scrollbars=yes, width=750,height=540,top=100,left=140')");}
window.defaultStatus='index'
// -->
 
<!--
function Abrir(link) {imgWin=window.open(link,"displayWindow","toolbar=no,location=no,directories=no,menubar=no,status=no,resizeable=no,scrollbars=no, fullscreen=yes, width=1200,height=1500')");}
window.defaultStatus='index'
// -->


<!--
function AbrirJornal(link) {imgWin=window.open(link,"displayWindow","toolbar=no,location=no,directories=no,menubar=no,status=no,resizeable=yes,scrollbars=yes, width=800,height=600,top=2,left=0')");}
window.defaultStatus='index'
// -->



<!--
function AbrirNova(link) {imgWin=window.open(link,"displayWindow","toolbar=no,location=no,directories=no,menubar=no,status=no,resizeable=yes,scrollbars=yes, width=700,height=545,top=0,left=90')");}
window.defaultStatus='index'
// -->


<!--
function AbrirLogin(link) {imgWin=window.open(link,"displayWindow","toolbar=no,location=no,directories=no,menubar=no,status=no,resizeable=yes,scrollbars=yes, width=300,height=200,top=0,left=190')");}
window.defaultStatus='index'
// -->




<!--
function at_display(x)
{
  var win = window.open();
  for (var i in x) win.document.write(i+' = '+x[i]+'<br>');
}

// ***** Show Aux *****

function at_show_aux(parent, child)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child );

  var top  = (c["at_position"] == "y") ? p.offsetHeight+ 3 : 0;
  var left = (c["at_position"] == "x") ? p.offsetWidth + 0 : 0;

  for (; p; p = p.offsetParent)
  {
    top  += p.offsetTop;
    left += p.offsetLeft;
  }

  c.style.position   = "absolute";
  c.style.top        = top +'px';
  c.style.left       = left+'px';
  c.style.visibility = "visible";
}

// ***** Show *****

function at_show()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  at_show_aux(p.id, c.id);

  clearTimeout(c["at_timeout"]);
}

// ***** Hide *****

function at_hide()
{
  var c = document.getElementById(this["at_child"]);

  c["at_timeout"] = setTimeout("document.getElementById('"+c.id+"').style.visibility = 'hidden'", 333);
}

// ***** Click *****

function at_click()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  if (c.style.visibility != "visible")
       at_show_aux(p.id, c.id);
  else c.style.visibility = "hidden";

  return false;
<!--
}
function goBack() {
window.history.back();
}
// -->
<!--
// ***** Attach *****

// PARAMETERS:
// parent   - id of visible html element
// child    - id of invisible html element that will be dropdowned
// showtype - "click" = you should click the parent to show/hide the child
//            "hover" = you should place the mouse over the parent to show
//                      the child
// position - "x" = the child is displayed to the right of the parent
//            "y" = the child is displayed below the parent
// cursor   - Omit to use default cursor or check any CSS manual for possible
//            values of this field

function at_attach(parent, child, showtype, position, cursor)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child);

  p["at_parent"]     = p.id;
  c["at_parent"]     = p.id;
  p["at_child"]      = c.id;
  c["at_child"]      = c.id;
  p["at_position"]   = position;
  c["at_position"]   = position;

  c.style.position   = "absolute";
  c.style.visibility = "hidden";

  if (cursor != undefined) p.style.cursor = cursor;

  switch (showtype)
  {
    case "click":
      p.onclick     = at_click;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
    case "hover":
      p.onmouseover = at_show;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
  }
}

function formatar_moeda(campo, separador_milhar, separador_decimal, tecla) {
	
 var sep = 0;
	var key = '';
	var i = j = 0;
	var len = len2 = 0;
	var strCheck = '0123456789';
	var aux = aux = '0';
	var whichCode = (window.Event) ? tecla.which : tecla.keyCode;
	if (whichCode == 13) return true; // Tecla Enter
	if (whichCode == 8) return true; // Tecla Delete
	key = String.fromCharCode(whichCode); // Pegando o valor digitado
	if (strCheck.indexOf(key) == -1) return false; // Valor inválido (não inteiro)
	len = campo.value.length;
	for(i = 0; i < len; i++)
	if ((campo.value.charAt(i) != '0') && (campo.value.charAt(i) != separador_decimal)) break;
	aux = '';
	for(; i < len; i++)
	if (strCheck.indexOf(campo.value.charAt(i))!=-1) aux += campo.value.charAt(i);
	aux += key;
	len = aux.length;
	if (len == 0) campo.value = '';
	if (len == 1) campo.value = '0'+ separador_decimal + '0' + aux;
	if (len == 2) campo.value = '0'+ separador_decimal + aux;
 
	if (len > 0) {
		aux0 = '';
 
		for (j = 0, i = len -4; i >= 0; i--) {
			if (j == 3) {
				aux0 += separador_milhar;
				j = 0;
			}
			aux0 += aux.charAt(i);
			j++;
		}
 
		campo.value = '';
		len2 = aux0.length;
		for (i = len2 - 1; i >= 0; i--)
		campo.value += aux0.charAt(i);
		campo.value += separador_decimal + aux.substr(len - 3, len);
	}
 
	return false;
}
 


function showElement(layer){
	var myLayer = document.getElementById(layer);
	if(myLayer.style.display=="none"){
		myLayer.style.display="block";
		myLayer.backgroundPosition="top";
	} else { 
		myLayer.style.display="none";
	}
}

function FormataValor(id,tammax,teclapres) {
    
        if(window.event) { // Internet Explorer
         var tecla = teclapres.keyCode; }
        else if(teclapres.which) { // Nestcape / firefox
         var tecla = teclapres.which;
        }
    

vr = document.getElementById(id).value;
vr = vr.toString().replace( "/", "" );
vr = vr.toString().replace( "/", "" );
vr = vr.toString().replace( ",", "" );
vr = vr.toString().replace( ".", "" );
vr = vr.toString().replace( ".", "" );
vr = vr.toString().replace( ".", "" );
vr = vr.toString().replace( ".", "" );
tam = vr.length;

if (tam < tammax && tecla != 7){ tam = vr.length + 0; }

if (tecla == 7 ){ tam = tam - 0; }

if ( tecla == 7 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ){
if ( tam <= 2 ){
document.getElementById(id).value = vr; }
if ( (tam > 2) && (tam <= 5) ){
document.getElementById(id).value = vr.substr( 0, tam - 2 ) + '.' + vr.substr( tam - 2, tam ); }
if ( (tam >= 6) && (tam <= 7) ){
document.getElementById(id).value = vr.substr( 0, tam - 5 ) + '.' + vr.substr( tam - 5, 3 ) + '.' + vr.substr( tam - 2, tam ); }
if ( (tam >= 9) && (tam <= 11) ){
document.getElementById(id).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.getElementById(id).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.getElementById(id).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 );}
}
}


function FormataValores(id,tammax,teclapres) {
    
        if(window.event) { // Internet Explorer
         var tecla = teclapres.keyCode; }
        else if(teclapres.which) { // Nestcape / firefox
         var tecla = teclapres.which;
        }
    

vr = document.getElementById(id).value;
vr = vr.toString().replace( "/", "" );
vr = vr.toString().replace( "/", "" );
vr = vr.toString().replace( ",", "" );
vr = vr.toString().replace( ".", "" );
vr = vr.toString().replace( ".", "" );
vr = vr.toString().replace( ".", "" );
vr = vr.toString().replace( ".", "" );
tam = vr.length;

if (tam < tammax && tecla != 7){ tam = vr.length + 0; }

if (tecla == 7 ){ tam = tam - 0; }

if ( tecla == 7 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ){
if ( tam <= 2 ){
document.getElementById(id).value = vr; }
if ( (tam > 2) && (tam <= 5) ){
document.getElementById(id).value = vr.substr( 0, tam - 2 ) + '.' + vr.substr( tam - 2, tam ); }
if ( (tam >= 6) && (tam <= 7) ){
document.getElementById(id).value = vr.substr( 0, tam - 5 ) + '.' + vr.substr( tam - 5, 3 ) + '.' + vr.substr( tam - 2, tam ); }
if ( (tam >= 9) && (tam <= 11) ){
document.getElementById(id).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.getElementById(id).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.getElementById(id).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 );}
}
}



function mascara(src, mask){
var i = src.value.length;
var saida = mask.substring(1,2);
var texto = mask.substring(i)
if (texto.substring(0,1) != saida)
{
src.value += texto.substring(0,1);
}
}
function Mascara(tipo, campo, teclaPress) { 
if (window.event) 
{ 
var tecla = teclaPress.keyCode; 
} else { 
tecla = teclaPress.which; 
} 

var s = new String(campo.value); 
// Remove todos os caracteres à seguir: ( ) / - . e espaço, para tratar a string denovo. 
s = s.replace(/(\.|\(|\)|\/|\-| )+/g,''); 

tam = s.length + 1; 

if ( tecla != 9 && tecla != 8 ) { 
switch (tipo) 
{ 
case 'CPF' : 
if (tam > 3 && tam < 7) 
campo.value = s.substr(0,3) + '.' + s.substr(3, tam); 
if (tam >= 7 && tam < 10) 
campo.value = s.substr(0,3) + '.' + s.substr(3,3) + '.' + s.substr(6,tam-6); 
if (tam >= 10 && tam < 12) 
campo.value = s.substr(0,3) + '.' + s.substr(3,3) + '.' + s.substr(6,3) + '-' + s.substr(9,tam-9); 
break; 

case 'CNPJ' : 

if (tam > 2 && tam < 6) 
campo.value = s.substr(0,2) + '.' + s.substr(2, tam); 
if (tam >= 6 && tam < 9) 
campo.value = s.substr(0,2) + '.' + s.substr(2,3) + '.' + s.substr(5,tam-5); 
if (tam >= 9 && tam < 13) 
campo.value = s.substr(0,2) + '.' + s.substr(2,3) + '.' + s.substr(5,3) + '/' + s.substr(8,tam-8); 
if (tam >= 13 && tam < 15) 
campo.value = s.substr(0,2) + '.' + s.substr(2,3) + '.' + s.substr(5,3) + '/' + s.substr(8,4)+ '-' + s.substr(12,tam-12); 
break; 

case 'TEL' : 
if (tam > 2 && tam < 4) 
campo.value = '(' + s.substr(0,2) + ') ' + s.substr(2,tam); 
if (tam >= 7 && tam < 11) 
campo.value = '(' + s.substr(0,2) + ') ' + s.substr(2,4) + '-' + s.substr(6,tam-6); 
break; 

case 'DATA' : 
if (tam > 2 && tam < 4) 
campo.value = s.substr(0,2) + '/' + s.substr(2, tam); 
if (tam > 4 && tam < 11) 
campo.value = s.substr(0,2) + '/' + s.substr(2,2) + '/' + s.substr(4,tam-4); 
break; 

case 'CEP' : 
if (tam > 5 && tam < 7) 
campo.value = s.substr(0,5) + '-' + s.substr(5, tam); 
break; 
} 
} 
} 

//--->Função para verificar se o valor digitado é número...<--- 
function digitos(event){ 
if (window.event) { 
// IE 
key = event.keyCode; 
} else if ( event.which ) { 
// netscape 
key = event.which; 
} 
if ( key != 8 || key != 13 || key < 48 || key > 57 ) 
return ( ( ( key > 47 ) && ( key < 58 ) ) || ( key == 8 ) || ( key == 13 ) ); 
return true; 
} 
 

