/* ==================================== */
/* SISOP Informática - www.sisop.com.br */
/* ==================================== */



// Retira os espaços no início e no final de uma string
function trim(str) {
  while (str.charAt(0) == " ") {
    str = str.substr (1 , str.length - 1);
  }
  while (str.charAt(str.length - 1) == " ") {
    str = str.substr (0 , str.length - 1);
  }

  return str;
}

// Abre um arquivo em uma janela popup
function popup(caminho , frame , largura , altura) {
  var esquerda = (screen.width - largura) / 2;
  var topo = (screen.height - altura) / 2;

  window.open (caminho , frame , "status=no , resizable=no , scrollbars=no , menubar=no , width=" + largura + " , height=" + altura + " , top=" + topo + " , left=" + esquerda + "");
}

// Mascara os campos de quantidade
function masc_quantidade(e) {
  if (window.event) {
    var key = e.keyCode;
  }
  else if (e.which) {
         var key = e.which;
       }
  if ((key != 8) || (key < 49) || (key > 57)) {
    return ((key == 8) || ((key >= 48) && (key <= 57)));
  }
}
