/**
 *This is a bit of a hack. Try to load images before they are used
 */

function ImagePreLoader(){
  
  this.resources = [
    CapsoolGlobalVariables.AppBase + '/graphics/img/find_background.png'
  ];
};

ImagePreLoader.prototype.run = function(){
  
  //Get the html append point
  var body = dojo.query( 'html body' );
  body = body[0]; //There should always be one
  
  //Append each image to pre load
  for( var k = 0; k < this.resources.length; k++ ){
    
    var img = dojo.doc.createElement( 'img' );
    img.alt = 'Preloaded via the ImagePreloader.js';
    img.className = "NoShow";
    img.src = this.resources[k];
    
    body.appendChild( img );
  }
}

dojo.addOnLoad(
  function(){
    
    ImagePreLoader.instance = new ImagePreLoader();
    
    ImagePreLoader.instance.run();
  }
);
