;(function($) {
  'use strict';

  var app = $.sammy('#content', function() {
    this.use('EJS');
    this.use('Title');
    this.use('GoogleAnalytics');

    this.debug = false;

    this.get('#/', function() {
      this.title('Hello - Mike Haugland');
      this.partial('pages/index.ejs').then(function() {
        $('#twitter_tweets').showTweets({
          'username': 'mikehaugland',
          'amount': 2,
          'includeReplies': true,
          'includeRetweets': true
        });
        $('#recent_songs').showLastFM({
          'username':'haugland',
          'amount': 2,
          'includeCurrentPlaying' : true,
          'apikey': 'fde1fb0cf04c956c29fa75d2fa2c0db8'
        });
      });
    });

    this.get('#/projects', function() {
      this.title('Projects - Mike Haugland');
      this.partial('pages/projects.ejs').then(function() {
        $("#projects").showGithub({'username':'mhaugland'});
      });
    });

    this.get('#/blog', function() {
      this.title('Blog - Mike Haugland');
      this.partial('pages/blog.ejs').then(function() {
        $('#blog').showPosterous({'siteid':'2230884', 'amount':10, 'hidetitlevalue':'Untitled'});
      });
    });

    this.get('#/contact', function() {
      this.title('Contact - Mike Haugland');
      this.partial('pages/contact.ejs');
    });

    this.bind('run', function() {
      //console.log('startup logic');
    });
  });


  $(function() {
    app.run('#/');
  });

})(jQuery);

