// Place application-specific JavaScript in here

function getPage(page_id) {
  if(!page_id) return;  // Can't do anything with nothing!
  
  // Fade out the current content area; when it's done, we'll add a loading thing
  new Effect.Fade('main_content', {duration: .3, afterFinish: function () {
      $('main_content').style.display = 'block';
      $('main_content').innerHTML = 'Loading...';
      new Ajax.Request('home/page/' + page_id, {asynchronous: true, evalScripts: true, onComplete: function (e) {
          new Effect.Fade('main_content', {duration: .3, afterFinish: function() {
            $('main_content').innerHTML = e.responseText;
            new Effect.Appear('main_content', {duration: .3});
          }});
        }});
    }});
}
