//
//
//
//
Preloader = function() {
  this.image_count = 0;
  this.images = [];
  this.images_loaded = 0;
  this.ids = [];
  this.urls = [];
}
Preloader.prototype.add = function(id, url) {
  this.ids[this.image_count] = id;
  this.urls[this.image_count] = url;
  
  var i = new Image();
  i.id = id;
  i.alt = id;
  i.oImagePreloader = this;
  i.onload = function() {
    this.oImagePreloader.onImageComplete(this);
    this.oImagePreloader.images_loaded++;
    if (this.oImagePreloader.images_loaded == this.oImagePreloader.image_count) {
      this.oImagePreloader.onComplete();
    }
  }
  this.images[this.image_count] = i;
  
  
  this.image_count++;
}
Preloader.prototype.load = function() {
  for(var x=0; x<this.images.length; x++) {
    this.images[x].src = this.urls[x];
  }
}
Preloader.prototype.onImageComplete = function(img) { }
Preloader.prototype.onComplete = function() { }

