// cross-browser function to get an objects style object given its id
function getStyleObject(objectId)
 {
  if(document.getElementById && document.getElementById(objectId))
   {
    // W3C DOM
    return(document.getElementById(objectId).style);
   }
  else if(document.all && document.all(objectId))
   {
    // MSIE 4 DOM
    return(document.all(objectId).style);
   }
  else if(document.layers && document.layers[objectId])
   {
    // NN 4 DOM note: this will not find nested layers
    return(document.layers[objectId]);
   }
  else
   {
    return(false);
   }
 }
 
function isIE()
 {
  if(navigator.userAgent.indexOf("MSIE") == -1)
   {
    return(0);
   }
  else
   {
    return(1);
   }
 }

function hideLayer(whichLayer)
 {
  getStyleObject(whichLayer).visibility = "hidden";
  getStyleObject(whichLayer).display = "none";
 }

function showLayer(whichLayer)
 {
  getStyleObject(whichLayer).visibility = "visible";
  getStyleObject(whichLayer).display = "block";
 }

function toggleLayer(whichLayer)
 {
  if(getStyleObject(whichLayer).visibility == "visible" || getStyleObject(whichLayer).display == "block")
   {
    hideLayer(whichLayer);
   }
  else
   {
    showLayer(whichLayer);
   }
 }

function showCell(whichCell)
 {
  if(isIE())
   {
    getStyleObject(whichRow).visibility = "visible";
    getStyleObject(whichRow).display = "block";
   }
  else
   {
    getStyleObject(whichCell).visibility = "visible";
    getStyleObject(whichCell).display = "table-cell";
   }
 }

function toggleCell(whichCell)
 {
  if(getStyleObject(whichCell).visibility == "visible" || getStyleObject(whichCell).display == "table-cell")
   {
    hideLayer(whichCell);
   }
  else
   {
    showCell(whichCell);
   }
 }
 
function showRow(whichRow)
 {
  if(isIE())
   {
    getStyleObject(whichRow).visibility = "visible";
    getStyleObject(whichRow).display = "block";
   }
  else
   {
    getStyleObject(whichRow).visibility = "visible";
    getStyleObject(whichRow).display = "table-row";
   }
 }
 
function toggleRow(whichCell)
 {
  if(getStyleObject(whichCell).visibility == "visible" || getStyleObject(whichCell).display == "table-row")
   {
    hideLayer(whichCell);
   }
  else
   {
    showRow(whichCell);
   }
 }
