var new_work = new Array("New Work",  "Mahjong", "Apartment",  "Twist", "Afternoon Old Town", "Chausseestrasse", "Kindergarden", "Two houses that no longer exist", "An Invitation to Remain");
var pink_house = new Array("The Pink House series", "Weight", "Wander", "And I lowered myself in", "Witness", "Spilling", "Dismantled", "In amongst the ruins", "Detail of In Amongst the ruins", "Installation view");
var dr_vid = new Array("Drawings &amp; video (2005)", "The red velvet chair", "Walking in the ruins", "Ripped and stuffed, stuffed and torn", "And the door flew out the window", "Evidence (and through the curtain)", "When I walked by I dreamt ...");
var t_arch = new Array("Temporary Architecture (2004)", "Forest", "Cage", "The sweeper", "Temporary Architecture"); 
var wall = new Array("Working with the wall (2003/04)", "The doll's house &amp; its monstrous shadow", "Domestic circus", "Pin & thread drawings I", "Pin &amp; thread drawings II", "Confronting the storefront window");
var berlin = new Array("Berlin Series (2001-03)", "In amongst the world", "If what was said was heard", "Midnight response team", "Cave writings", "Slides", "Coloured explosives", "Peeling advertisments", "Shelter shelter", "Look to the east");
var headings = new Array(new_work, pink_house, dr_vid, t_arch, wall, berlin);

content = "";
function generatemenu() {
  var menubox = document.getElementById("menubox");
  for(i = 0; i < headings.length; i++) {
    content += "<div id='hed" + i + "' onclick='words(" + i + ", " + 0 +")'><a href='#' class='maj'>" + headings[i][0] + "</a></div><div id='exp" + i + "'>";
  if (i == ii) {
      for(b = 0; b < headings[i].length - 1; b++) {
        bob = b + 1;
        content += "<div id='sub" + b + "' onclick='words(" + i + ", " + bob + ")'><a href='#'>";
        if (b+1 == jj) {
          content += "&#187; ";
        }
        content += headings[i][b + 1] + "</a></div>";
      }
    }
  }
  content += "</div>";
  menubox.innerHTML = content;
}

function delineate(str) {
  str = str.toLowerCase();
  str = str.replace(/[^A-Za-z0-9]+/g, '');
  str = str.substring(0, 8);
  return str;
}

function words(id, b) {
  b == 0 ? b = 1 : "";
  var dir = delineate(headings[id][0]);
  var file = delineate(headings[id][b]);
  var ii = id;
  var jj = b;
  window.location = "./artwork.php?di=" + ii + dir + "&fi=" + jj + file;
}

function delinURL(urel, identifier) {
  pt = urel.indexOf(identifier) + identifier.length + 1;
  urel = urel.substring(pt);
  urel = urel.substring(0, 1);
  return urel;
}

function swapslash(curthing) {
  for(i = 0; i < 5; i++) {
    if(i != curthing) {
      tab = document.getElementById("tab" + i);
      tab.style.background = "url(images/tab" + i + ".jpg) no-repeat";
    }
  }
  hometab = document.getElementById("tab" + curthing);
  hometab.style.background = "url(images/tab" + curthing + "ovr.jpg) no-repeat";
}

function mail() {
  document.write("<a href='&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#105;&#110;&#102;&#111;&#64;&#101;&#104;&#114;&#121;&#110;&#116;&#111;&#114;&#114;&#101;&#108;&#108;&#46;&#99;&#111;&#109;'><div id='footer'></div></a>");
}

function show(id) {
  eyedee = document.getElementById(id);
  eyedee.style.visibility = "visible";
}

function hide(id) {
  eyedee = document.getElementById(id);
  eyedee.style.visibility = "hidden";
}
  
