function please_wait(){
  return($('#content').html('<p><img src="/images/spinner.gif" alt="Spinner" /> Please wait...</p>'));
}

$(function(){
  $('#anim-header').css({ backgroundPosition: '0 0', backgroundRepeat: 'no-repeat'}).animate({ backgroundPosition: '0 -526px'}, 40000);
  $('#anim-header h1').html('').hide()
    .css({ padding: '0', margin: '0', width: '968px', height: '200px', backgroundImage: 'url(/images/titles-1.png)'})
    .delay(2000).fadeIn(2000).delay(2000)
    .fadeOut(2000, function(){ $('#anim-header h1').css({ backgroundImage: 'url(/images/titles-2.png)' }) })
    .delay(1000).fadeIn(2000).delay(2000)
    .fadeOut(2000, function(){ $('#anim-header h1').css({ backgroundImage: 'url(/images/titles-3.png)' }) })
    .delay(1000).fadeIn(2000).delay(2000)
    .fadeOut(2000, function(){ $('#anim-header h1').css({ backgroundImage: 'url(/images/titles-4.png)' }) })
    .delay(4000).fadeIn(2000);

  $('a.internal').live('click', function(){
    please_wait().load($(this).attr('href'));
    return false;
  });

  $('form.internal').live('submit', function(){
    please_wait();
    $.post($(this).attr('action'), $(this).serialize(), function(data, textStatus, XMLHTTPRequest){
      $('#content').html(data);
    });
    return false;
  });
});

