$(document).ready(function(){
  $('ul.drops').each(function(){
    $(this).find('li:even').addClass('alt');
  });

  $('a.signature').click(function(){
    $('a.signature').hide();
    $('.signatures').fadeIn();
    return false;
  });

  $('a.show_signatures').click(function(){
    if ($(this).siblings('.signatures').length) {
      $(this).siblings('.signatures').toggle();
    } else {
      $(this).parent().parent().find('.signatures').toggle();
    }
    return false;
  });

  $(".expander span a").click( function() {
    $(this).parent().hide();
    $(this).parent().siblings().fadeIn();
    return false;
  });

  if (window.delayed_iframe) {
    window.delay_time = 4;
    $('#download_notice').show();
    var delay_function = function() {
      delay_time -= 1;
      $('#delay_time_span').html(delay_time+'');
      if (delay_time > 0) {
        $('#delay_time_span').css({fontSize: '1.5em'}).animate( { fontSize:'1em'});
        window.setTimeout(delay_function,1000);
      } else {
        // start the download
        $('body').append(window.delayed_iframe);
        $('.begin_msg').html($('.begin_msg').html().replace(/will start[^\.]*\./, "has begun."));
      }
    }
    delay_function();
  }
});

function detect_mode() {
  var mode=document.compatMode,m;
  if(mode) {
    if(mode=='BackCompat') {
      m='quirks';
    } else if (mode=='CSS1Compat') {
      m='Standards Compliance';
    } else {
      m='Almost Standards Compliance';
    }
    alert('The document is being rendered in '+m+' mode.');
  };
  return false;
}
