(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
    $(function(){
      var actions = {
        B:['#i-bird','fadeIn'],
        P:['#i-plant',{left:9,top:-32,opacity:1}],
        C:['#i-char','fadeIn'],
        W:['#white',{opacity:0.5}],
        M:['#menu',{top:10}],
        F:['#flat-mask',{top:385}],
        m:['#main',{opacity:1},function(){ $(this).css('filter',''); }],
        L:['#logo',{opacity:1}]
      };
      var timeline =
        'MMMMMM             LLLLLLLLL|'+
        'PPPPPPPPPPPPPPPPPPPPPPPPCCCCCCWWWW|'+
        'FFFFFFF        BBBBBBBBBBB';
      LB.timeline.perform(actions,timeline,5500);
    });
    document.write('<style type="text/css">'+
      'html.front #i-bird, html.front #i-char { display:none; }'+
      'html.front #white { opacity:0; filter:alpha(opacity=0); }'+
      'html.front #i-plant { left:100px; top:15px; opacity:0.2; filter:alpha(opacity=20); }'+
      '#photohead #flat-mask { display:block; }'+
      '#head #menu { top:-305px; }'+
      '#head #logo { opacity:0; filter:alpha(opacity=0);}'+
      '/*#main { opacity:0; filter:alpha(opacity=0); }*/'+
    '</style>');
  } else {
  // Other pages
    $(function(){
      var actions = {
        B:['#i-bird',{opacity:0.75},'easeOutBack'],
        P:['#i-plant',{left:0}],
        C:['#i-char',{opacity:0.5},'easeOutBack'],
        L:['#logo',{opacity:1}]
      };
      var timeline =
        'LLLLLLL|'+
        'BBBBBBB|'+
        '    CCCCCCC|'+
        'PPPPPPPPP';
      LB.timeline.perform(actions,timeline,2000);
    });
    document.write('<style type="text/css">'+
      '#photohead #i-bird { opacity:0.3; filter:alpha(opacity=30); }'+
      '#photohead #i-plant { left:9px; }'+
      '#photohead #i-char { opacity:0; filter:alpha(opacity=0); }'+
      '#head #logo { opacity:0; filter:alpha(opacity=0);}'+
    '</style>');
  }
})();