function Switcher(links, panels, initiallink, initialpanel, selected, unselected) {
  this.links=links;
  this.panels=panels;
  this.currentlink=initiallink;
  this.currentpanel=initialpanel;
  this.selected=selected;
  this.unselected=unselected;
}

Switcher.prototype.switchTo=function(link, panel) {
  var oldpanel=Elem.getById(this.currentpanel);
  var newpanel=Elem.getById(panel);
  try {
     oldpanel.setVisible(false);
     newpanel.setVisible(true);
     
     var oldlink=Elem.getById(this.currentlink);
     var newlink=Elem.getById(link);
     oldlink.ensureClassIncludes("unselected", true);
     oldlink.ensureClassIncludes("selected", false);
     newlink.ensureClassIncludes("selected", true);
     newlink.ensureClassIncludes("unselected", false);

     this.currentlink=link;
     this.currentpanel=panel;
  } catch (e) {
     log(e);
  }
}

