var webc = new Array("TRUCK WEB CENTRE");
var prog = new Array("PROGRAMMING", "current", "upcoming", "archive", "artists");
var abou = new Array("ABOUT TRUCK");
var memb = new Array("MEMBERS", "support", "volunteer");
var subm = new Array("SUBMISSIONS", "main space", "+15 window", "CAMPER", "gallery maps");
var link = new Array("LINKS", "artist-run centres", "galleries & museums", "arts organizations");
var headings = new Array(webc, prog, abou, memb, subm, link);
var colours = new Array("#b80", "#900", "#990", "#373", "#447", "#a66");

function tint(id, maj) {
  for(i = 0; i < headings.length; i++) {
    if(i != id && i != maj) {
      iud = document.getElementById("hed" + i);
      iud.style.backgroundColor = "transparent";
    }
  }
  if(arguments.length > 1) {
    iud = document.getElementById("hed" + id);
    iud.style.backgroundColor = colours[id];
    oud = document.getElementById("hed" + maj);
    oud.style.backgroundColor = colours[maj]
  }
}

function subtint(length, id) {
  for(i = 0; i < length - 1; i++) {
    if(i != id) {
      iud = document.getElementById("sub" + i);
      iud.style.backgroundColor = "#888";
    }
  }
  if(arguments.length > 1) {
    iud = document.getElementById("sub" + id);
    iud.style.backgroundColor = "#999";
  }
}

function delinURL(urel, identifier) {
  pt = urel.indexOf(identifier) + identifier.length + 1;
  urel = urel.substring(pt);
  urel = urel.substring(0, 1);
  return urel;
}

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) {
//  headings[id].length > 1 ? b == 0 ? b = 1 : "" : b = 0;
  var dir = delineate(headings[id][0]);
  var file = delineate(headings[id][b]);
  var maj = id;
  var min = b;
  window.location = "index01.php?maj=" + maj + dir + "&min=" + min + file;
}

function getcol(i) {
  c = colours[i];
  return c;
}

function open_window(url) {
	var new_win = null;
	new_win = window.open ("", "recordViewer",
			"toolbar=no,width=730,height=600,directories=no,status=no" +
			",scrollbars=yes,resize=no,menubar=no,location=yes");
	new_win.location.href = url;
}
