function changeStyle() {
  setActiveStyle(window.document.style.items[document.style.selectedItem].name);
  document.print("asdf");
}

function setActiveStyle(title) {
  var i, a;

  /* set active style */
  for (i = 0; (a = document.getElementsByTagName("link")[i]); i++) {
    if (a.getAttribute("rel").indexOf("style") != -1 &&
        a.getAttribute("title")) {
      a.disabled = true;
      if (a.getAttribute("title") == title)
        a.disabled = false;
    }
  }

  /* select sidebar item */
  for (i = 0; (a = document.getElementsByTagName("a")[i]); i++) {
    a_class = a.getAttribute("class");
    if (a_class.indexOf("theme-") != -1) {
      if (a_class == ("theme-" + title))
        a.attributes['font-weight'] = 'bold';
      else
        a.attributes['font-weight'] = 'normal';
    }
  }
}

function getActiveStyle() {
  var i, a;

  for (i = 0; (a = document.getElementsByTagName("link")[i]); i++)
    if (a.getAttribute("rel").indexOf("style") != -1 &&
        a.getAttribute("title") && !a.disabled)
      return a.getAttribute("title");
  return null;

}

function getPreferredStyle() {
  var i, a;

  for (i = 0; (a = document.getElementsByTagName("link")[i]); i++)
    if (a.getAttribute("rel").indexOf("style") != -1 &&
        a.getAttribute("rel").indexOf("alt") == -1 &&
        a.getAttribute("title"))
      return a.getAttribute("title");

  return null;
}


