function setup() {
  var doc = document.getElementsByTagName('a'); // we get all the links on the webpage
  for (var i = 0; i < doc.length; i++){ // we loop though them one by one
    if (doc[i].className == 'tabs') { // we check if they have class="tabs"
      doc[i].onclick=toggletab; // we asign function foobar to onclick on this link
    }
  }
}

function toggletab() { //this is fired whenever a link is clicked
  var parent = this.parentNode;
  var arrChildren = parent.childNodes; // we get all the children of this link
  for(i = 0; i < arrChildren.length; i++) { // we loop though the children
    objChild = arrChildren[i]; // this is just so we don't have to write [i] all the time
    if (objChild.className == 'content') { // we check that the child has class="content"
      if (objChild.style.display != 'block') {
        objChild.style.display='block'; // we show the content div
      } else {
        objChild.style.display='none'; // we hide the content div
      }
    }
  }
}

