function togYear(year,tblCls) {
  aObj = document.getElementById('a'+year);
  tblObj = document.getElementById('tbl'+year);
  currClass = aObj.className;
  newClass = (currClass=='show') ? 'hide' : 'show';
  aObj.className = newClass;
  if (tblCls==undefined) {
    tblObj.className = 'collapsible ' + newClass;
  } else {
    tblObj.className = tblCls + ' collapsible ' + newClass;
    if (tblCls=='econLet' && year < 2002) {
      pdfNoteCls = (document.getElementById('getReader').className.indexOf('show')!=-1) ? 'show' : 'hide';
      document.getElementById('pdfNote' + year).className = (newClass=='show' && pdfNoteCls=='show') ? 'pdfNote show' : 'pdfNote hide';
    }
  }
}

function togDetail(year,nn,type) {
  pref = type.substr(0,1)
  switch (type) {
    case 'abs': val = 'abstract'; break;
    case 'data': val = 'supplement'; break;
    default:
  }
  inputObj = document.getElementById(pref + year + '_' + nn);
  divObj = document.getElementById(pref + year + '_' + nn + 'div');
  currClass = inputObj.className.substr(0,4);
  newClass = (currClass=='hide') ? 'show' : 'hide';
  inputObj.className = newClass;
  inputObj.value = (currClass=='hide') ? currClass + ' ' + val : val;
  divObj.className = newClass + ' ' + type;
}

function init() {
  var thisYr, prevYr, reqYr, link;
  if (location.search!="") {
    today = new Date();
    thisYr = today.getFullYear();
    prevYr = thisYr - 1;
    reqYr = location.search.substr(1,4);
    reqYrLink=document.getElementById('a'+reqYr);
    if (reqYrLink && reqYr!=thisYr) {
      if (reqYrLink.className!='show') toggle(reqYr,'wPaper');
      if (thisYrLink=document.getElementById('a'+thisYr)) {
        if (thisYrLink.className=='show') toggle(thisYr,'wPaper');
      }
      if (prevYrLink=document.getElementById('a'+prevYr)) {
        if (prevYrLink.className=='show' && prevYr!=reqYr) toggle(prevYr,'wPaper');
      }
    } else {
      window.location = "http://fedinprint.frbsf.org/dbtw-wpd/exec/dbtwpcgi.exe?AC=QBE_QUERY&XC=/dbtw-wpd/exec/dbtwpcgi.exe&BU=http%3A%2F%2Ffedinprint.frbsf.org%2Findex2.html&TN=fipnew&MR=0&ES=0&CS=1&RF=brief%20bib%20by%20id&QB0=AND&QF0=BK&QI0=San&QB1=AND&QF1=NO&QI1=%3C" + reqYr + "&QB2=AND&QF2=PUB&QI2=working!pacific&RL=1&NP=3&MF=WPEngMsg.ini&QS=index.htm";
    }
  }
}
