/* Some config: */
var thumbs_root	= 'http://promotion.cashixxx.com/produits/webcams/_thumbs';
var thumbs_dest = 'http://promotion.cashixxx.com/produits/webcams.php?tracker=';
var thumbs_nb	= { '120x90':207  };

/* Some variables: */
if(typeof(Webcam_Thumbs) == "undefined")				var Webcam_Thumbs		= {};
if(typeof(Webcam_Thumbs.synergie) == "undefined") 		Webcam_Thumbs.synergie	= 'hetero';
if(typeof(Webcam_Thumbs.size) == "undefined") 			Webcam_Thumbs.size		= '120x90';
if(typeof(Webcam_Thumbs.tracker) == "undefined") 		Webcam_Thumbs.tracker	= '';
if(typeof(Webcam_Thumbs.x) == "undefined") 				Webcam_Thumbs.x			= 1;
if(typeof(Webcam_Thumbs.y) == "undefined") 				Webcam_Thumbs.y			= 1;
if(typeof(Webcam_Thumbs.id) == "undefined") 			Webcam_Thumbs.id		= 'Webcam_Thumbs';
if(typeof(Webcam_Thumbs.txt) == "undefined") 			Webcam_Thumbs.txt		= 'Voir sa webcam!';

var already		= new Array();
var nb_thumbs	= Webcam_Thumbs.x * Webcam_Thumbs.y;
var ligne		= 0;

document.write('<div id="' + Webcam_Thumbs.id + '">');
for (var i=0; i<nb_thumbs; i++) {

	// Get random number
	var rand_num				= getRand(1,thumbs_nb[Webcam_Thumbs.size],already);
	already[already.length++]	= rand_num;

	document.write('<span><a href="' + thumbs_dest + Webcam_Thumbs.tracker +'" target="_blank" title="' + Webcam_Thumbs.txt + '"><img src="' + thumbs_root + '/' + Webcam_Thumbs.synergie + '/' + Webcam_Thumbs.size + '/' + rand_num + '.jpg" alt="' + Webcam_Thumbs.txt + '" border="0" /></a><br /><a href="' + thumbs_dest + Webcam_Thumbs.tracker +'" target="_blank" title="' + Webcam_Thumbs.txt + '" class="txt">' + Webcam_Thumbs.txt + '<' + '/' + 'a><' + '/' + 'span>');

	// Passer à la ligne?
	ligne++;
	if(ligne == Webcam_Thumbs.x)	{
		document.write('<br />');
		ligne					= 0;
	}
}
document.write('</div>');

/* Some functions: */
function getRand(min,max,except) {
	if (typeof except=="undefined") except=new Array();
	var rand_num=Math.round(Math.random()*max);
	do {
		rand_num=Math.round(Math.random()*max);
	} while (rand_num<min || inArray(rand_num,except));
	return rand_num;
}

function inArray(needle, haystack) {
	var found=false;
	for (var i=0; i<haystack.length; i++) {
		if (haystack[i]==needle) found=true;
	}
	return found;
}