var new_work = new Array("New Work", "4039258", "Later mid-levels", "Detail, Later mid-levels", "Aspects of voyeurism", "Detail, Aspects of voyeurism", "Gymnasium", "Amhurst E8", "Insides 7", "Insides 6");  
var iself_sim = new Array("I Self similar", "Mongkok Mansion", "I know about women who run for trains", "Be more playing no", "Family tree", "Reflecting pool", "Badge", "I spy", "Industrial plaza"); 						  						  
var iiself_si = new Array("II Self similar", "Apartment", "Twist", "Mahjong", "Afternoon Old Town", "Dependent suspension", "G22065", "I installation view, Self-similar", "II installation view, Self-similar", "III installation view, Self-similar"); 
var pink_house = new Array("The Pink House", "Weight", "Wander", "And I lowered myself in", "Witness", "Spilling", "Dismantled", "In amongst the ruins", "Detail of In Amongst the ruins", "Installation view");
var berlin = new Array("Berlin Series", "Insides one", "Insides two", "Chausseestrasse", "Kindergarden", "Cardboard paper walls", "In amongst the world",
"If what was said was heard", "Midnight response team");
var res_proj = new Array("Residency projects", "I Florence Trust", "II Florence Trust", "Recording and listening, Song for Others project", "St. George's Square, Song for Others broadcast", "Two houses that no longer exist", "CAFKA installation", "Forest", "The sweeper", "Temporary Architecture"); 
var dr_vid = new Array("Drawings &amp; video", "The red velvet chair", "Walking in the ruins", "Ripped and stuffed, stuffed and torn", "And the door flew out the window", "When I walked by I dreamt ...");

var headings = new Array(new_work, iself_sim, iiself_si, pink_house, berlin, res_proj, dr_vid);

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";
}
  

