function toggleHighlight() {
  var changeElem = $("span.change2");
  var notHighlighted = changeElem.css("backgroundColor") == 'rgb(255, 255, 255)' || changeElem.css("backgroundColor") == 'rgb(255,255,255)';
  var newColor = notHighlighted ? 'rgb(255, 255, 102)' : 'rgb(255, 255, 255)', newText = notHighlighted ? 'Hide Highlight' : 'Show Highlight';
  
  changeElem.animate({'backgroundColor': newColor}, 250);
  $("p#highlighttext input").val(newText);
}

function toggleTOC(obj) {
  var list = $("#toc ol:first"), newtext = list.is(":visible") ? 'Show' : 'Hide';
  
  if(/msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent))
    list.toggle();
  else
    list.toggle("normal");
  
  $("#toc h2:first a").text(newtext);
}

function stripeTables() {
  var rows, tables = $("table.striped tbody");

  for(var i=0; i < tables.length; i++) {
    rows = tables[i].getElementsByTagName('tr');
    for(var j=0; j < rows.length; j++) {
      rows[j].className += j%2 ? 'even' : 'odd';
    }
  }
}

$(document).ready(stripeTables);

