/* Javascript stuff for various things. */

// Used in tables to show/hide table rows.
function toggle_reveal()
{
  var displayValue = "table-row";
  // Assume sniffer.js has run
  if (navigator.org == "microsoft") displayValue = "block";
  if (document.getElementById(arguments[0]).style.display != "none") {
    displayValue = "none";
  }
  for (i = 0; i < arguments.length; i++) {
    document.getElementById(arguments[i]).style.display = displayValue;
  }
}

// Uses the helptip JS library, and takes a div id and pulls the text to
// display
function showHelpTipWrapper(event, id)
{
  showHelpTip(event, document.getElementById(id).innerHTML);
}

function createPopup()
{
  var myBars = 'directories=no,location=no,menubar=no,status=no';
  myBars += ',titlebar=no,toolbar=no';
  var myOptions = 'scrollbars=no,width=400,height=200,resizeable=no';
  var myFeatures = myBars + ',' + myOptions;

  var win = window.open('', 'popup', myFeatures);
  win.close();

  return win;
}

//var popup = createPopup();

function showPopup(id)
{
  var div = document.getElementById(id);
  var body = popup.document.body;
  body.style.backgroundColor = 'lightyellow';
  body.style.border = 'solid black 1px';
  body.style.padding = '5px';
  body.style.fontFamily = 'Arial';
  body.style.fontSize = '12px';
  body.innerHTML = div.innerHTML;

  popup.show(0, 0, 300, 0);

  // Determine the real height
  var realHeight = body.scrollHeight;
  popup.close();

  // Now really show the popup
  popup.show(0, 20, 300, realHeight, event.srcElement);
  popup.focus();
}

function hidePopup(id)
{
  popup.close();
}
