// rollOvers pour les images
// Application : class="roll"
window.addEvent('domready', function() {
	//preload images
	var aPreLoad = new Array();
	var aPreLoadi = 0;
	
	// resize the background please
	random_image_now();
	resize_background_image_now();	
});

// un background toujours visible, dependant la largeur et hauteur de la page
window.addEvent('resize', resize_background_image_now);

function resize_background_image_now()
{	
	var bg = $('background').getElement('img');
	
	var ratio = 12/8;
	
	bg.set('width', window.getWidth());
	bg.set('height', window.getWidth() / ratio);
	
	if (bg.getStyle('height').toInt() < window.getHeight()) {
		bg.set('height', window.getHeight());
		bg.set('width', window.getHeight() * ratio);
	}
}

function random_image_now()
{	
var randomImages = ['fondimg1','fondimg2','fondimg3','fondimg4','fondimg5','fondimg6'];
var rndNum = Math.floor(Math.random() * randomImages.length)+1;
var img = "images/fondimg"+rndNum+".jpg";
$('imgbackground').setProperty('src', img);
}
