// JavaScript Document





function AbrirJanela(URL, Moldura, Args, Largura, Altura, Centro) { 
var Topo = (screen.height/2)-(Altura/2)
var Esquerda = (screen.width/2)-(Largura/2)
var Propriedades = Args


if (Centro == true) { Centro = 'true' }
if (Propriedades=='') {
	Propriedades = 'width=' + Largura + ', height=' + Altura
} else {
	Propriedades = Propriedades  + ', width=' + Largura + ', height=' + Altura
}

if (Centro == 'true') {
	Propriedades = Propriedades + ', left=' + Esquerda + ', Top=' + Topo
}


	downloadWindow = window.open(URL,Moldura,Propriedades);   
	   if (downloadWindow)
			  downloadWindow.focus();


}


function addEvent(obj, evt, func) {
  if (obj.attachEvent) {
    return obj.attachEvent(("on"+evt), func);
  } else if (obj.addEventListener) {
    obj.addEventListener(evt, func, true);
    return true;
  }
  return false;
}

function XMLHTTPRequest() {
  try {
    return new XMLHttpRequest(); // FF, Safari, Konqueror, Opera, ...
  } catch(ee) {
    try {
      return new ActiveXObject("Msxml2.XMLHTTP"); // activeX (IE5.5+/MSXML2+)
    } catch(e) {
      try {
        return new ActiveXObject("Microsoft.XMLHTTP"); // activeX (IE5+/MSXML1)
      } catch(E) {
        return false; // doesn't support
      }
    }
  }
}

try{
    xmlhttp = new XMLHttpRequest();
}catch(ee){
    try{
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
        try{
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }catch(E){
            xmlhttp = false;
        }
    }
}

function zero_esquerda(ptexto, ptamanho) {
	ptexto = '0000000000' + ptexto;
	return (ptexto.slice(-ptamanho));
}

