var HomeVOGallery = Class.create();
HomeVOGallery.prototype = {
	/*-----------------------------*/
	initialize: function(container){
		this.container = $(container);

    this.options = Object.extend({
      delay:4000,	//temps en ms entre chaque roulement.
      direction:'bottomtop' //sens de déroulement (bottomtop, topbottom, leftright, rightleft)
    }, arguments[1] || {});

		//à chaque intervalle de temps, on enleve la première annonce affichée, et on affiche la suivante.
		var My = this;
		var interval = setInterval(function(){My.defileAnnonces();},this.options.delay);

		//si souris dans le conteneur, on bloque le rafraichissement
		this.container.parentNode.onmouseout=function(){
			if(interval){
				interval = setInterval(function(){My.defileAnnonces();},My.options.delay);
			}
		}
		this.container.parentNode.onmouseover=function(){
			if(interval){clearInterval(interval);}
		}
	},
	/*-----------------------------*/
	defileAnnonces: function(){
		var first = this.container.getElementsByTagName('li')[0];
		if(first){
			var last = first.cloneNode(true);
			if(last){
				new Effect.SlideUp(first,{
					afterFinish: function(){
						this.container.removeChild(first);
						this.container.appendChild(last);
					}.bind(this)
				});
			}
		}
	}
};

//var HomeVOGallery = Class.create();
//HomeVOGallery.prototype = {
//	/*-----------------------------*/
//	initialize: function(container){
//		this.container = $(container);
//
//		var delay = 4000;
//
//		//à chaque intervalle de temps, on enleve la première annonce affichée, et on affiche la suivante.
//		var My = this;
//		var interval = setInterval(function(){My.defileAnnonces();},delay);
//
//		//si souris dans le conteneur, on bloque le rafraichissement
//		this.container.parentNode.onmouseout=function(){
//			if(interval){
//				interval = setInterval(function(){My.defileAnnonces();},delay);
//			}
//		}
//		this.container.parentNode.onmouseover=function(){
//			if(interval){clearInterval(interval);}
//		}
//	},
//	/*-----------------------------*/
//	defileAnnonces: function(){
//		first= this.container.getElementsByTagName('li')[0];
//		if(first){
//			last = first.cloneNode(true);
//			if(last){
//				new Effect.SlideUp(first,{
//					afterFinish: function(){Element.remove(first); this.container.appendChild(last);}.bind(this)
//				});
//			}
//		}
//	}
//};