(function(){
  var htmlClass = document.getElementsByTagName('html')[0].className;
  if(/still/.exec(htmlClass)) return; // bail if page requests no animation
  if(/front/.exec(htmlClass)) {
  // Front page
    var actions = {
      'T':['#sitetitle, #menu',{opacity:1},function(){ $(this).css('filter',0); }],
      'W':['#white',{opacity:0.7}],
      '1':['#i1',{left:0,opacity:1}],
      '2':['#i2',{left:140,opacity:1}],
      '3':['#i3',{left:298,opacity:1}],
      '4':['#i4',{left:443,opacity:1}],
      '5':['#i5',{left:616,opacity:1}],
      '6':['#i6',{left:758,opacity:1}],
      'L':['#logo',{opacity:1},function(){ $(this).css('filter',0); }]
    };
    var timeline = 'T|W|1|2|3|4|5|6|L';
    $(function(){ LB.timeline.perform(actions,timeline,2500); });
    document.write('<style type="text/css">'+
      '#photohead #i1 { left:900px; opacity:0; filter:alpha(opacity=0); }'+
      '#photohead #i2 { left:-158px; opacity:0; filter:alpha(opacity=0); }'+
      '#photohead #i3 { left:900px; opacity:0; filter:alpha(opacity=0); }'+
      '#photohead #i4 { left:-173px; opacity:0; filter:alpha(opacity=0); }'+
      '#photohead #i5 { left:900px; opacity:0; filter:alpha(opacity=0); }'+
      '#photohead #i6 { left:-142px; opacity:0; filter:alpha(opacity=0); }'+
      '#head #sitetitle, #head #logo { opacity:0; filter:alpha(opacity=0); }'+
      '#head #menu { opacity:0; filter:alpha(opacity=0); }'+
      '#photohead #white { opacity:0; filter:alpha(opacity=0); }'+
    '</style>');
  } else {
  // Inner pages
    var actions = {
      'T':['#sitetitle, #white',{top:0}],
      'M':['#menu',{top:10}],
      '1':['#i1',{left:760}],
      '2':['#i2',{left:457}],
      '3':['#i3',{left:615}],
      '4':['#i4',{left:284}],
      '5':['#i5',{left:142}],
      '6':['#i6',{left:0}],
      'L':['#logo',{opacity:1},function(){ $(this).css('filter',''); }]
    };
    var timeline = 'T|M|1|2|3|4|5|6|L';
    $(function(){ LB.timeline.perform(actions,timeline,2000); });
    document.write('<style type="text/css">'+
      '#photohead #i1 { left:0px; }'+
      '#photohead #i2 { left:140px; }'+
      '#photohead #i3 { left:298px; }'+
      '#photohead #i4 { left:443px; }'+
      '#photohead #i5 { left:616px; }'+
      '#photohead #i6 { left:758px; }'+
      '#head #sitetitle { top:-216px; }'+
      '#head #menu { top:226px; }'+
      '#photohead #white { top:216px; }'+
      '#head #logo { opacity:0; filter:alpha(opacity=0); }'+
    '</style>');
  }
})();

