/*
todo: se ballader dans l'album grace a un pointeur
recreer ds ie5 les fonctions array absentes

methodes public:
- aller au debut de l'album (utile pour afficher l'index)
- aller sur telle image
- recuperer les donnees de l'image en cours, de la precedente, de la suivante
*/

function Album(_i)
{

  var images 	 = _i;
  var last_index = 0; // Private, renommage: index, current_index, pos current_pos
  var self 		 = this;

  var id 		 = this.id	   = '1787';
  var pseudo 	 = this.pseudo = 'jerome';

  
  this.images	 = images;
  this.br_path   = '/users/'+pseudo+'/images/'+id+'/';
  this.vign_path = '/users/'+pseudo+'/vignettes/'+id+'/';  
  this.hr_path   = '/users/'+pseudo+'/hr/'+id+'/';    

  this.set_path = function(){
  
  }
  
  this.set_next_index = function(){
    last_index++;
    if(last_index >= images.length) last_index = 0;
  }

  this.set_prev_index = function(){
    last_index--;
    if(last_index < 0) last_index = images.length - 1;
  }

  this.set_index = function(index){
    last_index = index;
  }
  
  this.init_album = function(){
    for(i in images){
	  this.images[i] = images[i] = new Photo(images[i]);
    }
  }
  
  this.get_index = function(){
    return last_index;
  }
    
  this.get_next_index = function(){
    var index = last_index;
	return ++index >= this.images.length?0:index;
  }
  
  this.get_image = function(){
    return images[last_index];
  }
  
  this.init();

}
Album.prototype.get_current_image = function () {
  return this.get_image();
}
Album.prototype.get_current_index = function () {
  return this.get_index();
}
Album.prototype.init = function () {
  this.init_album();
}
Album.prototype.next = function () {
  this.set_next_index();
}
Album.prototype.prev = function () {
  this.set_prev_index();
}
Album.prototype.go = function (index) {
  this.set_index(index);
}
Album.prototype.get_next_image = function () {
  return this.images[this.get_next_index()];
}
