function writeDefinition(e, name, w) {
  var dictionary = doGebi('DictionaryDiv');
  dictionary.style.visibility='hidden';

  var html = '';
  for (var i=0; i<dictionaryNamesArray.length; i++) {
	  if (name.toUpperCase() == dictionaryNamesArray[i]) {
	    html = dictionaryValuesArray[i];
      }
  }

  writeTable(html, name, w);

  var dictionaryTable = doGebi('DictionaryTable');

  var dbsl=document.body.scrollLeft;
  if (!dbsl) dbsl=window.pageXOffset;
  if (!dbsl) dbsl=0;

  var dbst=document.body.scrollTop;
  if (!dbst) dbst=window.pageYOffset;
  if (!dbst) dbst=0;

  var dbcw=document.body.clientWidth;
  if (!dbcw) dbcw=window.innerWidth;
  if (!dbcw) dbcw=800;

  var h = dictionary.offsetHeight;
  w = dictionary.offsetWidth;


  var originalLeft = e.clientX - (w / 2);

  if (originalLeft + w > dbcw) originalLeft = dbcw - w;

  if (originalLeft < 0) originalLeft = 0;
  dictionary.style.left = originalLeft + dbsl;

  var newTop=dbst+e.clientY-(h+20);
  var allsels=document.getElementsByTagName('select');
  if (allsels)
  {
    for (var ind=0;ind<allsels.length;ind++)
    {
      var cursel=allsels[ind];
      if (!cursel)
        break;
      calcXY(cursel);
      if ((cursel.calcy+cursel.offsetHeight+2)>newTop)
        newTop=cursel.calcy+cursel.offsetHeight+2;
    }
  }

  dictionary.style.top = newTop;

  dictionary.style.visibility='visible';
  dictionaryTable.style.visibility='visible';
}

function writeTable(html, name, w) {
  if (w == 0) w = 200;

  var output = '<table id="DictionaryTable" width="100%" bordercolor="990000" bgcolor="#FFFFFF" border="0" cellpadding="0" cellspacing="0" class="abouttext">'
             + '  <tr height="19">'
             + '    <td bgcolor="' + dictionaryColor + '" align="left" valign="TOP" width="15" height="19"><IMG SRC="/images/body/topleft.gif" width="15"></td>'
             + '    <td bgcolor="' + dictionaryColor + '" align="left" height="19" style="font-family:arial;font-size:13px;color:#FFFFFF">' + name + '</td>'
             + '    <td bgcolor="' + dictionaryColor + '" align="right" height="19" style="font-family:arial;font-size:13px;color:#FFFFFF"><div style="cursor: pointer; cursor: hand;" onClick="closeDictionaryWindow();return false">Close [ X ]</font></b></div></td>'
             + '    <td bgcolor="' + dictionaryColor + '"  valign="TOP" width="15" height="19"><IMG SRC="/images/body/topright.gif" width="15"></td>'
             + '  </tr>'
             + '  <tr bgcolor="CCD9E5">'
             + '    <td>&nbsp;</td>'
             + '    <td valign="TOP" align="left" width='+w+' colspan="2" style="font-family:arial;font-size:13px;color:#000000"><BR>'
             + html
             + '    </td>'
             + '    <td>&nbsp;</td>'
             + '  </tr>'
             + '  <tr>'
             + '    <td align="left" valign="BOTTOM" bgcolor="CCD9E5" width="15"><IMG SRC="/images/body/CCD9E5_bottomleft.gif" width="15"></td>'
             + '    <td colspan="2" bgcolor="CCD9E5">&nbsp;</td>'
             + '    <td align="right" valign="BOTTOM" bgcolor="CCD9E5" width="15"><IMG SRC="/images/body/CCD9E5_bottomright.gif" width="15"></td>'
             + '  </tr>'
             + '</table>';

  var dictionary = doGebi('DictionaryDiv');
  dictionary.innerHTML = output;
  dictionary.style.width = w;
}

function closeDictionaryWindow() {
  document.getElementById('DictionaryTable').style.display='none';
}
