

   function openImg(ID) {
      link = "mostraimg.php?id=" + ID
      window.open(link, 'Cartao', 'width=280 height=400 toolbar=no, location=no, directories=no, status=yes, menubar=no, resizeable=yes')
   }

   function openImgMnt(ID) {
      link = "mostraimg.php?id=" + ID + "&mnt=1"
      window.open(link, 'Cartao', 'width=280 height=400 toolbar=no, location=no, directories=no, status=yes, menubar=no, resizeable=yes')
   }


   function abre_esqueci() {
      window.open('esqueci.php', 'Esqueci', 'width=450 height=200 toolbar=no, location=no, directories=no, status=yes, menubar=no, resizeable=yes')
   }


   function abre_imprime(query) {
      link = 'impressao.php?' + query
      window.open(link, 'Impressao', 'width=678 height=500 toolbar=no, location=no, directories=no, status=yes, menubar=no, resizeable=yes')
   }


   function markTD(id, color) {
      var ITD = document.getElementById('td' + id)
      var ICK = document.getElementById('ck' + id)
      if(!ICK.checked) {
         ITD.bgColor = color
         ICK.checked = false
      } else {
         ITD.bgColor="#BBDDFF"
         ICK.checked = true
      }
   }


   function setLink(j, pag, link) {
      var c = document.getElementsByName('ck')
      itens = ""
      for(i=0; i<j; ++ i) {
         if(c[i].checked) {
            itens = itens + (c[i].value) + "-"
         }
      }
      link.href=pag + itens
   }


   function troca_img(ID, link_img, link_a) {
      var i = document.getElementById('img' + ID)
      i.src = link_img;
      var L = document.getElementById('L' + ID)
      var L2 = document.getElementById('L2' + ID)
      if(L.href.indexOf("add")>0) {
         L.href = L.href.replace("add", "del")
         L2.href = L.href
         L2.innerText = 'Remover da lista'

      } else {
         L.href = L.href.replace("del", "add")
         L2.href = L.href
         L2.innerText = 'Adicionar na lista'
      }
   }

   function selectall() {
      var c = document.getElementsByName('ck')
      for(i=0; i<c.length; ++ i) {
         if(c[i].checked == false) {
            c[i].click()
         }
      }
   }

   function uncheckall() {
      var c = document.getElementsByName('ck')
      for(i=0; i<c.length; ++ i) {
         if(c[i].checked == true) {
            c[i].click()
         }
      }
   }
   
   function color_bg(ID, color) {
      var OBJ = document.getElementById(ID)
      OBJ.style.background = color;
   }

