$(document).ready(function(){
  $.getJSON('js/projects.json', function(data){
    var projectsTemplate = $('#projects-template').html();
    var compiledHTML = Handlebars.compile(projectsTemplate)(data);
    $('.projects').html(compiledHTML);
  });

  $.getJSON('js/blog.json', function(data){
    var blogTemplate = $('#blog-template').html();
    var compiledHTML = Handlebars.compile(blogTemplate)(data);
    $('.blog').html(compiledHTML);
  });

  $.getJSON('js/photos.json', function(data){
    var photosTemplate = $('#photos-template').html();
    data["photos"] = shuffle(data["photos"]);
    var compiledHTML = Handlebars.compile(photosTemplate)(data);
    $('.photos ul').html(compiledHTML);
    $('img').unveil(200);
    $('img').trigger('unveil');
  })
})

function loadJSON(section){
}


// F-Y Shuffle, from the internet
function shuffle(array) {
  var currentIndex = array.length;
  var temporaryValue;
  var randomIndex;

  while (0 !== currentIndex) {
    randomIndex = Math.floor(Math.random() * currentIndex);
    currentIndex -= 1;

    temporaryValue = array[currentIndex];
    array[currentIndex] = array[randomIndex];
    array[randomIndex] = temporaryValue;
  }

  return array;
}
@@ -29,222 +29,55 @@
 %7B%0A  
-$.getJSON('js/projects.json', function(data)%7B%0A    var projectsTemplate = $('#projects-template').html();%0A    var compiledHTML = Handlebars.compile(projectsTemplate)(data);%0A    $('.projects').html(compiledHTML);%0A  %7D
+%5B'projects', 'blog', 'photos'%5D.forEach(loadJSON
 );%0A%0A
@@ -623,18 +623,526 @@
 ction)%7B%0A
+  $.getJSON('js/' + section + '.json', function(data)%7B%0A    var template = $('#' + section + '-template').html();%0A    var compiledHTML;%0A%0A    if (section === %22photos%22)%7B%0A      data%5B%22photos%22%5D = shuffle(data%5B%22photos%22%5D);%0A      compiledHTML = Handlebars.compile(template)(data);%0A      $('.' + section + ' ul').html(compiledHTML);%0A      $('img').unveil(200);%0A      $('img').trigger('unveil');%0A    %7D else %7B%0A      compiledHTML = Handlebars.compile(template)(data);%0A      $('.' + section).html(compiledHTML);%0A    %7D%0A  %7D)%0A
 %7D
-%0A
 %0A%0A// F-Y
@@ -1168,16 +1168,40 @@
 internet
+, so photos are more fun
 %0Afunctio

Refactor template logic