function alerta() {
	if (!confirm('Esta operação é irreversível!\nDeseja continuar ?')) { 
		return false; 
	}
}

// Essa funcao recebe uma referencia a um campo TEXTAREA, e limita a quantidade de caracteres desse campo
function conta(nome,maxlimit){
	// var maxlimit = 193;
	if (nome.value.length > (maxlimit-2)) {
		 // alert ("O máximo de caracteres permitidos para esse campo é 255!");
		 alert("Excedido o limite máximo de caracteres");
		 // charCode = 0;
		 nome.value = nome.value.substring(0, maxlimit);
	}
}
	

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_dmenu(objname) {
  var obj = MM_findObj(objname);
  if(obj && obj.style) obj.style.display = (obj.style.display=="none") ? "" : "none";
}

function MM_dmenuh() {
  var a=MM_dmenuh.arguments;
  for (i=0; i<a.length; i++) {var obj = MM_findObj(a[i]); if(obj && obj.style) obj.style.display = "none"; }
}

function MM_dmenus() {
  var a=MM_dmenus.arguments;
  for (i=0; i<a.length; i++) {var obj = MM_findObj(a[i]); if(obj && obj.style) obj.style.display = ""; }
}

function apagaAbas() {
  var a=apagaAbas.arguments;
  for (i=0; i<a.length; i++) {var obj = MM_findObj(a[i]); if(obj && obj.style) obj.style.backgroundColor = "#E5E6D8"; }
}

function acendeAba(objname) {
	var obj = MM_findObj(objname);
	if(obj && obj.style) obj.style.backgroundColor='#cccccc';
}

function mascara_cpf(cpf,formulario) {
    var mycpf = '';
	var meuform = '';
    mycpf = mycpf + cpf;
	meuform = meuform + formulario;
    if (mycpf.length == 3) {
        mycpf = mycpf + '.';
        document.getElementById(meuform).cpf.value = mycpf;
    }
    if (mycpf.length == 7) {
        mycpf = mycpf + '.';
        document.getElementById(meuform).cpf.value = mycpf;
    }
    if (mycpf.length == 11) {
        mycpf = mycpf + '-';
        document.getElementById(meuform).cpf.value = mycpf;
    }
    if (mycpf.length == 14) {
    }
}

function mascara_cartao(cartao,formulario) {
    var meucartao = '';
	var meuform = '';
    meucartao = meucartao + cartao;
	meuform = meuform + formulario;
    if (meucartao.length == 7) {
        meucartao = meucartao + '-';
        document.getElementById(meuform).cartao.value = meucartao;
    }
    if (meucartao.length == 8) {
    }
}

function mascara_cartao_provisorio(cartao,formulario) {
    var meucartao = '';
	var meuform = '';
    meucartao = meucartao + cartao;
	meuform = meuform + formulario;
    if (meucartao.length == 7) {
        meucartao = meucartao + '-';
        document.getElementById(meuform).num_cartao_provisorio.value = meucartao;
    }
    if (meucartao.length == 8) {
    }
}

function sobeWallpaper(variavel1,var2) {	
	var newURL = 'incluirWallpaper.asp?onde='+variavel1+'&var='+var2; 
	var newWindow = window.open(newURL, "uploadWindow","height=250,width=550,left=200,top=200, scrollbars=no, resizable=yes, location=yes, status=yes");
}

function sobe1(variavel1,var2) {	
	var newURL = 'incluir_img.asp?onde='+variavel1+'&var='+var2; 
	var newWindow = window.open(newURL, "uploadWindow","height=250,width=550,left=200,top=200, scrollbars=no, resizable=yes, location=yes, status=yes");
}

function sobe1_foto(variavel1,var2) {	

	h=250;
	w=550;
	
	vPosIniX=((screen.availWidth/2)-(w/2));
	vPosIniY=((screen.availHeight/2)-(h/2));

	var newURL = 'incluir_img_foto.asp?onde='+variavel1+'&var='+var2; 
	var newWindow = window.open(newURL, "uploadWindow","titlebar=0,toolbar=0,location=0,directories=0,status=0,scrollbars=1,resizable=yes,top=" +vPosIniY+",left="+vPosIniX+",width=" + w + ",height="+ h);

}

function sobeBanner(var2) {	
	var newURL = 'incluirBanner.asp?var='+var2; 
	var newWindow = window.open(newURL, "uploadWindow","height=250,width=550,left=200,top=200, scrollbars=no, resizable=yes, location=yes, status=yes");
}