//
// ******************************************************************************************************
// *                                                                                                    *
// *                        Javascript Functions for Highlighting and Visibility                        *
// *                                                                                                    *
// ******************************************************************************************************
//

function changeObjectVisibility(objectName, newVisibility) {
  var o1 = window.document.getElementById(objectName),
      o2 = window.document.getElementsByName(objectName);
  if (o1) o1.style.visibility = newVisibility;                            // should not work on MSIE, but it does
  for (var i=0; i<o2.length; i++) o2[i].style.visibility = newVisibility; // should not work on MSIE, but it does
  return true;
}

function headLinksOver(objectName, menuName, eventObj) {
  if (!eventObj) eventObj = window.event;
  if (eventObj.stopPropagation) eventObj.stopPropagation(); else eventObj.cancelBubble = true;
  var o1 = window.document.getElementById(objectName),
      o2 = window.document.getElementsByName(objectName);
  if (o1) o1.style.backgroundColor = "#d8d8d8";                            // should not work on MSIE, but it does
  for (var i=0; i<o2.length; i++) o2[i].style.backgroundColor = "#d8d8d8"; // should not work on MSIE, but it does
  return changeObjectVisibility(menuName, "inherit");
}

function headLinksOut(objectName, menuName, eventObj) {
  if (!eventObj) eventObj = window.event;
  if (eventObj.stopPropagation) eventObj.stopPropagation(); else eventObj.cancelBubble = true;
  var o1 = window.document.getElementById(objectName),
      o2 = window.document.getElementsByName(objectName);
  if (o1) o1.style.backgroundColor = "transparent";                            // should not work on MSIE, but it does
  for (var i=0; i<o2.length; i++) o2[i].style.backgroundColor = "transparent"; // should not work on MSIE, but it does
  return changeObjectVisibility(menuName, "hidden");
}

function headMenuLinksOver(objectName, eventObj) {
  var o1 = window.document.getElementById(objectName),
      o2 = window.document.getElementsByName(objectName);
  if (o1) o1.style.backgroundColor = "#c8c8c8";                            // should not work on MSIE, but it does
  for (var i=0; i<o2.length; i++) o2[i].style.backgroundColor = "#c8c8c8"; // should not work on MSIE, but it does
  return true;
}

function headMenuLinksOut(objectName, eventObj) {
  var o1 = window.document.getElementById(objectName),
      o2 = window.document.getElementsByName(objectName);
  if (o1) o1.style.backgroundColor = "transparent";                            // should not work on MSIE, but it does
  for (var i=0; i<o2.length; i++) o2[i].style.backgroundColor = "transparent"; // should not work on MSIE, but it does
  return true;
}

function sideLinksOver(objectName, eventObj) {
  if (!eventObj) eventObj = window.event;
  if (eventObj.stopPropagation) eventObj.stopPropagation(); else eventObj.cancelBubble = true;
  var o1 = window.document.getElementById(objectName),
      o2 = window.document.getElementsByName(objectName);
  if (o1) o1.style.backgroundColor = "#c8c8c8";                        // should not work on MSIE, but it does
  for (i=0; i<o2.length; i++) o2[i].style.backgroundColor = "#c8c8c8"; // should not work on MSIE, but it does
  return true;
}

function sideLinksOut(objectName, eventObj) {
  if (!eventObj) eventObj = window.event;
  if (eventObj.stopPropagation) eventObj.stopPropagation(); else eventObj.cancelBubble = true;
  var o1 = window.document.getElementById(objectName),
      o2 = window.document.getElementsByName(objectName);
  if (o1) o1.style.backgroundColor = "transparent";                        // should not work on MSIE, but it does
  for (i=0; i<o2.length; i++) o2[i].style.backgroundColor = "transparent"; // should not work on MSIE, but it does
  return true;
}

function bodyLinksOver(objectName, eventObj) {
  if (!eventObj) eventObj = window.event;
  if (eventObj.stopPropagation) eventObj.stopPropagation(); else eventObj.cancelBubble = true;
  var o1 = window.document.getElementById(objectName),
      o2 = window.document.getElementsByName(objectName);
  if (o1) o1.style.backgroundColor = "#d8d8d8";                        // should not work on MSIE, but it does
  for (i=0; i<o2.length; i++) o2[i].style.backgroundColor = "#d8d8d8"; // should not work on MSIE, but it does
  return true;
}

function bodyLinksOut(objectName, eventObj) {
  if (!eventObj) eventObj = window.event;
  if (eventObj.stopPropagation) eventObj.stopPropagation(); else eventObj.cancelBubble = true;
  var o1 = window.document.getElementById(objectName),
      o2 = window.document.getElementsByName(objectName);
  if (o1) o1.style.backgroundColor = "transparent";                        // should not work on MSIE, but it does
  for (i=0; i<o2.length; i++) o2[i].style.backgroundColor = "transparent"; // should not work on MSIE, but it does
  return true;
}

function editOver(eventObj) {
  if (!eventObj) eventObj = window.event;
  if (eventObj.stopPropagation) eventObj.stopPropagation(); else eventObj.cancelBubble = true;
  if (eventObj.target) var o = eventObj.target;
  else if (eventObj.srcElement) var o = eventObj.srcElement;
  else return true;
  o.style.backgroundColor = "#b0b0b0"; // should not work on MSIE, but it does
  return true;
}

function editOut(eventObj) {
  if (!eventObj) eventObj = window.event;
  if (eventObj.stopPropagation) eventObj.stopPropagation(); else eventObj.cancelBubble = true;
  if (eventObj.target) var o = eventObj.target;
  else if (eventObj.srcElement) var o = eventObj.srcElement;
  else return true;
  o.style.backgroundColor = "transparent"; // should not work on MSIE, but it does
  return true;
}

function tdOver(eventObj) {
  if (!eventObj) eventObj = window.event;
  if (eventObj.target) var o = eventObj.target;
  else if (eventObj.srcElement) var o = eventObj.srcElement;
  else return true;
  for (i=0; i<4 && o.tagName.toLowerCase() != "td"; i++) o = o.parentNode;
  o.style.backgroundColor = "#d8d8d8"; // should not work on MSIE, but it does
  if (eventObj.stopPropagation) eventObj.stopPropagation(); else eventObj.cancelBubble = true;
  return true;
}

function tdOut(eventObj) {
  if (!eventObj) eventObj = window.event;
  if (eventObj.target) var o = eventObj.target;
  else if (eventObj.srcElement) var o = eventObj.srcElement;
  else return true;
  for (i=0; i<4 && o.tagName.toLowerCase() != "td"; i++) o = o.parentNode;
  o.style.backgroundColor = "transparent"; // should not work on MSIE, but it does
  if (eventObj.stopPropagation) eventObj.stopPropagation(); else eventObj.cancelBubble = true;
  return true;
}
