$(document).ready(function(){
   var url = document.location.toString();
   var intPhotoBlogID = -1;
   
   // look at the URL to see if it contains an anchor
   if (url.match('#')) {
      // if so, get it from the URL
      intPhotoBlogID = url.split('#')[1];
   }
   
   myPageViewController = new PhotoBlogViewController(intPhotoBlogID);
});


var PhotoBlogViewController = ViewController.extend({
   init: function(intPhotoBlogID){
      this._super();
      
      this.setBuffer('mainContentBuffer','A');
      this.setBuffer('photoBlogEntryBuffer','B');
      xajax_xInit(intPhotoBlogID);
   },
   
   loadPhotoBlog: function(intPhotoBlogID,strEffect) {
      var newContentBuffer = this.getBuffer('mainContentBuffer');
      this.setBuffer('photoBlogEntryBuffer','B');
      xajax_xLoadPhotoBlog(intPhotoBlogID,newContentBuffer,strEffect);
   },
    
   loadPhotoBlogCallback: function(strContentID,htmlContent,arrAdditionalBuffers,strEffect,arrPhotos) {
      this.loadContentCallback(strContentID,htmlContent,arrAdditionalBuffers,strEffect);
      
      var preLoad = new Image();

      for(strPhoto in arrPhotos) {
         preLoad.src = "images/photoBlog/"+arrPhotos[strPhoto]['photoFileName'];
      }      
   },

   loadEntry: function(intPhotoBlogID,intPhotoID,strEffect) {
      var newEntryBuffer = this.getBuffer('photoBlogEntryBuffer');
      xajax_xLoadEntry(intPhotoBlogID,intPhotoID,newEntryBuffer,strEffect);
   }
   
});
   
