function ScrollText(id) {
	this.e = document.getElementById(id);
	this.span = this.e.getElementsByTagName('SPAN')[0];
	this.e.style.overflow = 'hidden';
	this.e.style.position = 'relative';
	this.e.style.height = '1.5em';
	this.span.style.whiteSpace = 'nowrap';
	this.span.style.position = 'absolute';
	this.span.style.top = '0';
	this.startpos = this.e.clientWidth + 10;
	this.pos = this.startpos;
	this.span.style.left = this.pos + 'px';
	setInterval( function() { 
		this.pos -= 2;
		if(this.pos < -this.span.clientWidth) this.pos = this.startpos;
		this.span.style.left = this.pos + 'px';
	}.bind(this), 25);
}

function NewsBox(id) {
	this.e = document.getElementById(id);
	this.showlink = this.e.getElementsByTagName('a')[0];
	this.hidelink = this.e.getElementsByTagName('a')[1];
	this.news = this.e.getElementsByTagName('div')[0];
	this.news.style.display = 'none';
	this.showlink.style.display = 'inline';
	addEvent(this.showlink, 'click', function(event) { 
	  var event = event || window.event;
	  if (event.preventDefault) event.preventDefault();
	  else event.returnValue = false;
	  this.showlink.style.display = 'none';
	  this.hidelink.style.display = 'inline';
	  this.news.style.display = 'block';
	}.bind(this));
	addEvent(this.hidelink, 'click', function(event) { 
	  var event = event || window.event;
	  if (event.preventDefault) event.preventDefault();
	  else event.returnValue = false;
	  this.showlink.style.display = 'inline';
	  this.hidelink.style.display = 'none';
	  this.news.style.display = 'none';
	}.bind(this));
}

var MgsBasket = {

	nb_images: 8, // nombre d'images aléatoires

	randomImage: function() {
		var img = document.getElementById('randomimage');
		var i = Math.floor(Math.random()*MgsBasket.nb_images);
		img.src = 'images/random/img' + i + '.jpg';
	}
}