function openOnLoad() {
  try {
  var q = location.href;
  if (q.indexOf("?") != 0)
    q = q.split("?")[1];
  if (q && parseInt(q) != NaN)
    openIllustrations(q); 
  } catch (e) {}
}

function openIllustrations(q) {
  var a = [];
  a.push({player: "img", title:"Kaatje en Mieke", content:"portfolio/kamiek.png"});
  a.push({player: "img", title:"Doodle", content:"portfolio/bigdoodle.jpg"});
  a.push({player: "img", title:"Brrrd", content:"portfolio/brrrd.png"});
  a.push({player: "img", title:"Hold on", content:"portfolio/mannetje2.jpg"});
  a.push({player: "img", title:"Captain Xlate", content:"portfolio/xlate-logo.jpg"});
  a.push({player: "img", title:"A lonely spider", content:"portfolio/spiffy.jpg"});
  a.push({player: "img", title:"The astonished bird", content:"portfolio/birdsandtrees.png"});

  if (q && q < a.length) {
    a.unshift(a[q]);
  }
  Shadowbox.open(a);
  pageTracker._trackEvent("gallery_illustrations", "open")
  return false;
}

function openJoost() {
  var a = [];
  a.push({player: "img", title:"Joost Jigsaw: an intelligent jukebox based on Joost and Last.fm", content:"portfolio/joost-jigsaw.jpg"});
  a.push({player: "img", title:"Jigsaw User Interface graphics", content:"portfolio/joost-jigsaw-toolbar.png"});
  //a.push({player: "img", title:"Jigsaw User Interface graphics", content:"portfolio/bsno-beta.png"});

  Shadowbox.open(a);
  pageTracker._trackEvent("gallery_joost", "open")
  return false;
}

function openMeora() {
  var a = [];
  a.push({player: "img", title:"Meora site", content:"portfolio/meora-site.jpg"});
  a.push({player: "img", title:"Meora logo", content:"portfolio/meora-logo.png"});
  a.push({player: "img", title:"Meora business card", content:"portfolio/meora-bcard.png"});

  Shadowbox.open(a);
  pageTracker._trackEvent("gallery_meora", "open")
  return false;
}

function openFlickr() {
  var a = [];
  a.push({player: "img", title:"", content:"http://farm4.static.flickr.com/3223/2591958811_6cb1d05d8b.jpg"});
  a.push({player: "img", title:"", content:"http://farm3.static.flickr.com/2620/4176577058_038e189506.jpg"});
  a.push({player: "img", title:"", content:"http://farm4.static.flickr.com/3259/2788576777_c5e6163e06.jpg"});
  a.push({player: "img", title:"", content:"http://farm4.static.flickr.com/3036/2774316680_f51a18a5d9.jpg"});
  a.push({player: "img", title:"", content:"http://farm4.static.flickr.com/3162/2583224499_da7ffe4d88.jpg"});
  a.push({player: "img", title:"", content:"http://farm2.static.flickr.com/1383/1097595496_24461f4b9b.jpg"});
  a.push({player: "img", title:"", content:"http://farm4.static.flickr.com/3152/2584051878_a9926befc4.jpg"});
  a.push({player: "img", title:"", content:"http://farm4.static.flickr.com/3024/2583223703_b0bab8e742.jpg"});
  a.push({player: "img", title:"", content:"http://farm2.static.flickr.com/1299/1393030451_09837b7e99.jpg"});
  a.push({player: "img", title:"", content:"http://farm2.static.flickr.com/1206/1297924168_4b407bf30d.jpg"});

  Shadowbox.open(a);
  pageTracker._trackEvent("gallery_flickr", "open")
  return false;
}

if (window.addEventListener)
  window.addEventListener("load", openOnLoad, true);
else
  window.attachEvent("onload", openOnLoad);

