

//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"){
    width = width - 13;
	H = H - 13;
  }else{
    width = width + 5;
	H = H + 5;
  }
  
  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);
}






//Get Cookie Function
function getCookie(name) {
  var cname = name + "=";
  var dc = document.cookie;
  if (dc.length > 0) {
    begin = dc.indexOf(cname);
    if (begin != -1) {
      begin += cname.length;
      end = dc.indexOf(";", begin);
      if (end == -1) end = dc.length;
      return unescape(dc.substring(begin, end));
    }
  }
  return null;
}



