// Functions for TOC

//Added by DG with help from David Rose 1/4/07
//This will cause the page to break INTO the frameset if initially accessed as a single page

var url = self.location.href;
if (top == self) 
self.location.href = 
  "skbredir.htm?toc.htm?" + 
     url.substring(url.lastIndexOf("/") + 1, url.length);

//Original stuff from AIT

function exp(id) {
  var mySrc=document.getElementById('p'+id).src;

  // check current display state
  if (mySrc.slice(mySrc.lastIndexOf('/')+1) == 'minus.gif') {
    collapse(id);
  } else{
    expand(id);
  }
}

function expand(id) {
  var myDoc= top.TOC.document;

  with(myDoc.getElementById('s'+id)) {
    className='x';
    style.display=''; 
  }
  myDoc.getElementById('p'+id).src='minus.gif';
  myDoc.getElementById('b'+id).src='obook.gif';
}

function collapse(id) {
  with(document.getElementById('s'+id)) {
    className='x';
    style.display='none'; 
  }
  document.getElementById('p'+id).src='plus.gif';
  document.getElementById('b'+id).src='cbook.gif';
}

function highlight(id) {
  top.TOC.document.getElementById('a'+id).focus();
}

function loadTOC() {
  // check current page displayed in TOC window.  If not toc.htm, load it.
  if (!isTOCLoaded()) {
    top.TOC.location.href='toc.htm';
  }
}

function isTOCLoaded() {
  // return true, if toc.htm is loaded in TOC window.
  var myPath=top.TOC.location.pathname;
  var myFile=myPath.substr(myPath.length-7);

  if (myFile != 'toc.htm') {
    return false;
  } else {
    return true;
  }
}
