function ajaxify(url){
  var request = new Json.Remote(url, {
    onComplete: function(jsonObj) {
      if (jsonObj.pagehtml) {
        $('middle').setHTML(jsonObj.pagehtml);
      };
    },
    onFailure: function() {
      alert('Something went wrong.');
    },
    autoCancel: true,
    evalScripts: true
  }).send();
}

window.addEvent('domready', function() {
  ajaxify('ajax.php?module=pages&id=1');
});