function shuffle ( myArray ) {
  var i = myArray.length;
  if ( i == 0 ) return false;
  while ( --i ) {
     var j = Math.floor( Math.random() * ( i + 1 ) );
     var tempi = myArray[i];
     var tempj = myArray[j];
     myArray[i] = tempj;
     myArray[j] = tempi;
   }
}

function loadBox(box_id) {
    $(box_id).load('content.php', function() {
        $(this).fadeIn({ duration: 600 });
        $("a[rel='gallery']").colorbox();
    });
}

function loadContent(boxes) {
    shuffle(boxes);
    
    for(box in boxes){
        setTimeout("loadBox('"+ boxes[box] +"')", 1800);
    }
}

$(document).ready(function(){
    $("div[id^='grid_']").hide();
    
    $(".name").hover(
        function(){
            $(this).switchClass('more', 'name');
        },
        function(){
            $(this).switchClass('name', 'more');
        }
    );

    
    var boxes = new Array;
    
    for(i = 1; i < 11; i++){
        boxes.push('#grid_' + i);
    }
    
    loadContent(boxes);
    
    $(".contact").colorbox();
});