// Copyright (C) 2003 BDN Software Inc. All Rights Reserved.

var ISExplorer = (navigator.appName.indexOf("Microsoft") != -1);
var ISSafari = (navigator.userAgent.indexOf("Safari") != -1);

function show(but,paragraph,collapseName) {
  if(collapseName != '') {
     but.replaceChild( document.createTextNode(collapseName),but.firstChild);
  }
  if(ISExplorer || ISSafari) {
     paragraph.style.display = "";
  }
  else {
     paragraph.setAttribute("style","display:");
  }
}

function hide(but,paragraph,expandName) {
  if(expandName != '') {
    but.replaceChild( document.createTextNode(expandName),but.firstChild);
  }
  if(ISExplorer || ISSafari) {
     paragraph.style.display = "none";
  }
  else {
     paragraph.setAttribute("style","display: none");
  }
}

function showHide(button, paragraph, collapseName, expandName) {
  var para = document.getElementById(paragraph);
  var but = document.getElementById(button);
  if (but.firstChild.nodeValue == collapseName) {
     hide(but,para,expandName);
  } else {  
     show(but,para,collapseName);
  }
}

function expandAll(bname, pname, start, end, collapseName) {
  for(i = start; i < end; i++) {
     var button = document.getElementById(bname + i);
     var paragraph = document.getElementById(pname + i);
     show(button,paragraph,collapseName);
  }
}

function collapseAll(bname, pname, start, end, expandName) {
  for(i = start; i < end; i++) {
     var button = document.getElementById(bname + i);
     var paragraph = document.getElementById(pname + i);
     hide(button,paragraph,expandName);
  }
}
