/*
* This script change a sponsor image in a banner.
*
* All sponsors logos must be named as following : sponsorX.jpg where X represents a number.
* You must specify the numbre of logos, logo sizes and transition time.
*/

/* --- PARAMETERS --- */
/* Pictures width and height */
var pic_width = 150;
var pic_height = 80;

/* Time between images transition */
var delay = 2000; // millisecond unit used

var nbSponsors = 15;
/* --- END OF PARAMETERS --- */

/* --- SCRIPT --- */
/* Urls of each picture */
if (document.images) {
	var images = new Array(nbSponsors);
	
	for (var i=0; i<nbSponsors; i++) {
		// image object construction
		images[i] = new Image(pic_width, pic_height);
		
		// pictures url
		images[i].src = "http://www.rondegivreedusidobre.com/newSite/wp-content/themes/rondeGivree/images/sponsors/sponsor" + (i+1) + ".jpg";
	}
		
}

var pics = new Array(nbSponsors);

for (var i=0; i<nbSponsors; i++)
	pics[i] = images[i].src;


var numpics = pics.length;
var thenum = 0;
imgName = "img1";

function changePicture() {
	if (document.images) {
		document.write("<img src='" + pics[thenum] + "' border='0' width='" + pic_width + "' height='" + pic_height + "' name='img1'>");
		setTimeout('change_it2()', delay);
	}
}

function change_it2() {
	var x = 0;
	thenum += 1;
	if (thenum > numpics-1)
		thenum = 0;

	document[imgName].src = pics[thenum];
	x += 1;
	setTimeout('change_it2()', delay);
}
/* --- END OF SCRIPT --- */


