function SwitchTab(tabnum) {
  var nlcol = document.getElementById('NextLastCol');
  nlcol.removeChild(nlcol.firstChild);
  nlcol.insertBefore(nlboxes[tabnum],nlcol.firstChild);
}
function CreateTab(tabnum,active) {
  if(tabnum == 0) {
    var tabtext = document.getElementById('NextTitle').firstChild.cloneNode(true);
  } else {
    var tabtext = document.getElementById('LastTitle').firstChild.cloneNode(true);
  }
  var tab = document.createElement('div');
  if(tabnum == active) {
    tab.className = 'ActiveTab';
    tab.appendChild(tabtext);
  } else {
    tab.className = 'PassiveTab';
    var link = document.createElement('a');
    link.href = 'javascript:SwitchTab(' + tabnum + ');';
    link.appendChild(tabtext);
    tab.appendChild(link);
  }
  return tab;
}
var nlboxes = new Array(2);
nlboxes[0] = document.createElement('div');
nlboxes[0].className = 'Box';
nlboxes[1] = nlboxes[0].cloneNode(true);
for (var boxnum = 0; boxnum < 2; boxnum++) {
  var title = document.createElement('div');
  title.className = 'TabBoxTitle';
  for (var tabnum = 0; tabnum < 2; tabnum++) {
    title.appendChild(CreateTab(tabnum,boxnum));
  }
  title.appendChild(document.createElement('div'));
  title.lastChild.className = 'Clear';
  nlboxes[boxnum].appendChild(title);
}
nlboxes[0].appendChild(document.getElementById('NextContent').cloneNode(true));
nlboxes[1].appendChild(document.getElementById('LastContent').cloneNode(true));
var nlcol = document.getElementById('NextLastCol');
nlcol.removeChild(document.getElementById('NextBox'));
nlcol.removeChild(document.getElementById('LastBox'));
nlcol.insertBefore(nlboxes[0],nlcol.firstChild);
