function rowOn (rowElement, color) {
  rowElement.style.backgroundColor = color;
  rowElement.style.cursor = "pointer";
}

function rowOff (rowElement) {
  rowElement.style.backgroundColor = "";
}

function rowHighlightToggle (rowId, color) {
  rowElement = document.getElementById(rowId);
alert(rowElement.style.backgroundColor);
  if (rowElement.style.backgroundColor == color) {
    rowOff(rowElement);
  } else {
    rowOn(rowElement, color);
  }
}

function redirect (path, confirmMessage) {
  if (!confirmMessage || confirm(confirmMessage)) {
    window.location = path;
  }
}

function toggleTable (tableId) {
  tableElement = document.getElementById(tableId);
  
  if (tableElement.style.display != "none") {
    tableElement.style.display = "none";
  } else {
    tableElement.style.display = "table";
  }
}

function toggleElement (elementId, imageId) {
  var imageFolder = "/img/";
  var toggleImage = new Array("toggle_less.gif", "toggle_more.gif");
  var element = document.getElementById(elementId);
  var image = document.getElementById(imageId);

  if (element.style.display != "none") {
    element.style.display = "none";
    image.src = imageFolder+toggleImage[1];
  } else {
    element.style.display = "block";
    image.src = imageFolder+toggleImage[0];
  }
}

function highlightColumn (className, state) {
  var modelTable = document.getElementById("modelTable")
  var cells = modelTable.getElementsByTagName("td")
  
  for (var i in cells) {
    if (cells[i].nodeType == 1 && cells[i].className.indexOf(className) != -1) {
      if (state) {
        cells[i].style.backgroundColor = "#fcfcef"
//        cells[i].style.color = "#678"
//        cells[i].style.borderBottomColor = "#cde"
      } else {
        cells[i].style.backgroundColor = ""
//        cells[i].style.color = ""
//        cells[i].style.borderBottomColor = ""
      }
    } else if (cells[i].nodeType == 1) {
      if (state) {
        cells[i].style.color = "#888"
      } else {
        cells[i].style.color = ""
      }
    }
  }
}
