// ABRE UMA JANELA POP UP
	// Para usar passe os parametros abre_jan(arqiovo, janela, largra e altura)
function abre_jan(arq,loc,larg,alt){
	var topo = (screen.height-alt)/2;
    var esquerda = (screen.width-larg)/2;
window.open(arq,loc,"resizable=no,toolbar=no,status=no,menubar=no,scrollbars=yes,width=" + larg + ",height=" + alt + ",top=" + topo + ",left="+ esquerda)
}
// CONFIRMA A AÇÃO DE EXCLUSÃO DE UM REGISTRO
function certeza(codigo){
	if(confirm("Tem certeza que deseja EXCLUIR este item?")){
		return;
	}else{
		return false;
	}
}


// Correctly handle PNG transparency in Win IE 5.5 or higher.
function correctPNG()
   {
   for(var i=0; i<document.images.length; i++)
      {
      var img = document.images[i]
      var imgName = img.src.toUpperCase()
      if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
         var imgID = (img.id) ? "id='" + img.id + "' " : ""
         var imgClass = (img.className) ? "class='" + img.className + "' " : ""
         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
         var imgStyle = "display:inline-block;" + img.style.cssText
         if (img.align == "left") imgStyle = "float:left;" + imgStyle
         if (img.align == "right") imgStyle = "float:right;" + imgStyle
         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
         var strNewHTML = "<span " + imgID + imgClass + imgTitle
         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
         img.outerHTML = strNewHTML
         i = i-1
         }
      }
   }

// Funcao para gerenciar rolagem das caixas de texto
caixa='';
function rolar_texto_abaixo(caixa)
{
var m_div = document.getElementById(caixa);
//alert(m_div.scrollTop);
m_div.scrollTop = m_div.scrollTop + 100
//alert(m_div.scrollHeight);
}

function rolar_texto_acima(caixa)
{
var m_div = document.getElementById(caixa);
//alert(m_div.scrollTop);
m_div.scrollTop = m_div.scrollTop - 100
//alert(m_div.scrollTop);
}

// MASCARAS PARA VALORES
function Mascara(formato, keypress, objeto){
	campo = eval (objeto);

	// cep
	if (formato=='cep'){
		separador = '-';
		conjunto1 = 5;
		if (campo.value.length == conjunto1){
			campo.value = campo.value + separador;}
	}
	
	// cpf
	if (formato=='cpf'){
		separador1 = '.';
		separador2 = '-';
		conjunto1 = 3;
		conjunto2 = 7;
		conjunto3 = 11;
		if (campo.value.length == conjunto1){
		  campo.value = campo.value + separador1;}
		if (campo.value.length == conjunto2){
		  campo.value = campo.value + separador1;}
		if (campo.value.length == conjunto3){
		  campo.value = campo.value + separador2;}
	}
	
	// nascimento
	if (formato=='nascimento'){
		separador = '/';
		conjunto1 = 2;
		conjunto2 = 5;
		if (campo.value.length == conjunto1){
		  campo.value = campo.value + separador;}
		if (campo.value.length == conjunto2){
		  campo.value = campo.value + separador;}
	}
	
	// telefone
	if (formato=='telefone'){
		separador1 = '(';
		separador2 = ')';
		separador3 = '-';
		conjunto1 = 0;
		conjunto2 = 3;
		conjunto3 = 8;
		if (campo.value.length == conjunto1){
		campo.value = campo.value + separador1;}
		if (campo.value.length == conjunto2){
		campo.value = campo.value + separador2;}
		if (campo.value.length == conjunto3){
		campo.value = campo.value + separador3;}
	}
}
