//FUNCAO PARA ABRIR JANELA POPUP PERSONALIZADAS
function abre(URL,L,H,S){
  if (navigator.platform != "MacPPC"){
    var Janela2 = window.open('','Janela','width=1,height=1');
    Janela2.close();
  }
  if (!S){
    S = 'NO';
  }


  //Tentativa para abrir janela no centro da tela
  var leftprop, topprop, screenX, screenY, cursorX, cursorY, properties;
  var width  = L;
  var height = H;

  //Faz a gambis para o mac
  if (navigator.platform == "MacPPC"){
    L = L - 16;
    H = H - 16;
  }
  
  
  if(navigator.appName == "Microsoft Internet Explorer") {
    screenY = document.body.offsetHeight;
    screenX = window.screen.availWidth;
  }else{
    screenY = window.outerHeight
    screenX = window.outerWidth
  }

  leftvar  = (screenX - width) / 2;
  rightvar = (screenY - height) / 2;
  if(navigator.appName == "Microsoft Internet Explorer") {
    leftprop = leftvar;
    topprop  = rightvar;
  }else{
    leftprop = (leftvar - pageXOffset);
    topprop  = (rightvar - pageYOffset);
  }

  properties = properties + ", left = " + leftprop;
  properties = properties + ", top = " + topprop;


  var Miolo = 'toolbar=no,location=no,status=no,menubar=no,resizable=no,scrollbars='+S+',copyhistory=no,width='+L+',height='+H+properties;
  Janela2 = window.open(URL,'Janela',Miolo);
}


