function ShiftDate(n) {
  var fec = new Date();
  if (n != 0) {
    var txt = document.formdate.Fecha.value;
    var dia = txt.substring(0,2);
    var mes = txt.substring(3,5);
    var ano = txt.substring(6,10);
    var fec = new Date(ano, mes-1, dia);
  }
  var dia = fec.getDate() + n;
  var mes = fec.getMonth();
  var ano = fec.getFullYear();
  var fec = new Date(ano, mes, dia);
  var dia = fec.getDate();
  var mes = fec.getMonth() + 1;
  var ano = fec.getFullYear();
  var txt = "";
  if (dia < 10) txt = "0";
  txt = txt + dia + "-";
  if (mes < 10) txt = txt + "0";
  if (ano < 1900) ano += 1900;
  txt = txt + mes + "-" + ano;
  document.formdate.Fecha.value = txt;
}


function showlist(c) {
  app = "http://www.tribunet.com.ar/scripts/dr3.dll/";
  app = "/scripts/dr3.dll/";
  fec = document.formdate.Fecha.value.substring(6,10);
  fec = fec + document.formdate.Fecha.value.substring(3,5);
  fec = fec + document.formdate.Fecha.value.substring(0,2);
  document.formdate.IIOO.value = fec;
  document.formdate.IOIO.value = c;
  document.formdate.action = app + "list";
  if (c == "report") document.formdate.action = app + "report";
  if (c == "search") document.formdate.action = app + "search";
  document.formdate.submit(); 
}


function GetCookie(nam) {
  var c = "";
  var r = "";
  var i = document.cookie.indexOf(nam + "=");
  if (nam != "" && i != -1) {  
    i = i + nam.length + 1;
    for (j = i; c != ";" && j <= document.cookie.length; j++) {
      r = r + c;
      c = document.cookie.substring(j, j + 1);
    }
  }
  return r;
}


function lpelinks() {
  var lpe = GetCookie("LPE");
  page = "http://www.tribunet.com.ar/rep/";
  if (lpe != "")  {
    document.write("<a href=" + page + lpe + ".htm>Reporte de hoy</a>");
    document.write("<a href=lpeback.htm>Reportes anteriores</a>");
  }
}


function replink(n) {
var lpe = GetCookie("LPE");
var titulo = 'Lista personal'
if (n == 1) titulo = "Reportes anteriores";
if (lpe != "")  {
  page = "/tribunet/rep/";
  document.write("<table width=100% border=0 cellspacing=3 cellpadding=2><tr><td>");
  document.write("<table border=0 width=100% bgcolor=#39597D cellspacing=1 cellpadding=2><tr>");
  document.write("<td width=100% bgcolor=#7D92A9><font style='font-weight: normal; font-family: verdana; font-size: 10pt; color: #ffffff'>&nbsp;" + titulo + "</font></td></tr><tr>");
  document.write("<td width=100% bgcolor=#A5B4C4 align=left>");
  if (n == 1) {
    document.write("&nbsp;<a class=secintro href=" + page + "1/" + lpe +".htm>Lunes</a><br>");
    document.write("&nbsp;<a class=secintro href=" + page + "2/" + lpe +".htm>Martes</a><br>");
    document.write("&nbsp;<a class=secintro href=" + page + "3/" + lpe +".htm>Miércoles</a><br>");
    document.write("&nbsp;<a class=secintro href=" + page + "4/" + lpe +".htm>Jueves</a><br>");
    document.write("&nbsp;<a class=secintro href=" + page + "5/" + lpe +".htm>Viernes</a><br>");
    document.write("&nbsp;<a class=secintro href=" + page + "9/" + lpe +".htm>Reporte caducidades</a><br>");
    }
  else document.write("&nbsp;<a class=secintro href=" + page + lpe +".htm>Reporte de hoy</a><br>");  
  document.write("</td></tr></table>");
  document.write("</td></tr></table>");
  }
}


function lpeback() {
  var lpe = GetCookie("LPE");
  if (lpe != "")  {
    page = "http://www.tribunet.com.ar/rep/";
    document.write("<table width=300 border=0 cellspacing=6 bgcolor=#ffffff><tr>");
    for (i = 1; i < 32; i++) {
      document.write("<td align=center bgcolor=#f0f0f0><a href=" + page + i + "/" + lpe + ".htm>" + i + "</a></td>");
      if ( i == 7 || i == 14 || i == 21 || i == 28 ) {
        document.write("</tr><tr>")
      }
    }
    document.write("</tr></table>");
  }
}


function logout() {
  location = "/scripts/dr3.dll/logout";

}

function usraldia() {
  var prf = GetCookie("PRF");
  var msg = GetCookie("MSG");
  var usr = GetCookie("USR");
  if ((usr == "") || ((prf != "0") && (prf != "1")) || (msg == "msgenmora"))  {
    window.location="http://www.tribunet.com.ar/msgdeniega.htm";
  }
}


