
var winners	= new Array();
var objWinners	= '';
var scrollPos 	= '';
var numScrolls	= '';
var heightOfElm = '62'; // Height of each element (px)
var numberOfElm = '';
var scrollOn 	= 'true';
	
function scrollState (val) {
	if (scrollOn != val) {
		scrollOn = val;
		if (val == 'true') {
			setTimeout("scrollWinners();", 1000);
		}
	}
}

function scrollWinners() {
	objWinners.scrollTop = objWinners.scrollTop + 1;
	scrollPos++;
	if ((scrollPos%heightOfElm) == 0) {
		numScrolls--;
		if (numScrolls == 0) {
			objWinners.scrollTop = '0';
			makeContent();
		} else {
			if (scrollOn == 'true') {
				makeContent();
			}
		}
	} else {
		setTimeout("scrollWinners();", 10);
	}
}

var winnerNum = 0;
/*
Creates amount to show + 1 for the scrolling ability to work
scrollTop is set to top position after each creation
Otherwise the scrolling cannot happen
*/
function makeContent() {
	var tmp = '';

	w = winnerNum - parseInt(numberOfElm);
	if (w < 0) {
		w = 0;
	} else {
		w = w%winners.length;
	}
	
	// Show amount of winners
	var elementsTmp = parseInt(numberOfElm) + 1;
	for (i = 0; i < elementsTmp; i++) {
		
		// Add HTML to tmp var
		tmp += winners[w%winners.length];
		w++;
	}
	
	// Set vars
	
/*	$('div#winnerHolder').html(tmp);*/
	objWinners.innerHTML 	= tmp;
	
	winnerNum 				= w;
	numScrolls 				= winners.length;
	objWinners.scrollTop 	= '0';
	// Begin scrolling
	setTimeout("scrollWinners();", 2000);
}

function createWinnerScroll() {
		
	winners[0] = '<table cellpadding="4" cellspacing="0" border="0" width="100%" onclick="window.location=\'/profile/myprofile/profile.php?profile=7773325\';"><tr><td width="56"><div style="position: relative; top: 0px; left: 0px;"><div style="position: absolute; top: 0px; left: 0px;"><a href="/profile/myprofile/profile.php?profile=7773325"><div class="recentWinnersCutout"><\/div><\/a><\/div><img src="/images/profiles/noimage70x52_male.gif" width="70" height="52" alt="KOV_TITLE" style="border: solid 1px #CCCCCC;"><\/div><\/td><td><table cellpadding="0" cellspacing="0" border="0"><tr><td colspan="2"><a href="/profile/myprofile/profile.php?profile=7773325" class="size13m"><strong>mehdi58270<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">Il y a 11 heures<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>€ 29,30<\/strong><\/td><\/tr><\/table><\/td><\/tr><\/table>';
	
		
	winners[1] = '<table cellpadding="4" cellspacing="0" border="0" width="100%" onclick="window.location=\'/profile/myprofile/profile.php?profile=8548476\';"><tr><td width="56"><div style="position: relative; top: 0px; left: 0px;"><div style="position: absolute; top: 0px; left: 0px;"><a href="/profile/myprofile/profile.php?profile=8548476"><div class="recentWinnersCutout"><\/div><\/a><\/div><img src="/images/profiles/noimage70x52_female.gif" width="70" height="52" alt="KOV_TITLE" style="border: solid 1px #CCCCCC;"><\/div><\/td><td><table cellpadding="0" cellspacing="0" border="0"><tr><td colspan="2"><a href="/profile/myprofile/profile.php?profile=8548476" class="size13k"><strong>brigitte6260<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">mercredi, à 17:32<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>€ 27,69<\/strong><\/td><\/tr><\/table><\/td><\/tr><\/table>';
	
		
	winners[2] = '<table cellpadding="4" cellspacing="0" border="0" width="100%" onclick="window.location=\'/profile/myprofile/profile.php?profile=8075152\';"><tr><td width="56"><div style="position: relative; top: 0px; left: 0px;"><div style="position: absolute; top: 0px; left: 0px;"><a href="/profile/myprofile/profile.php?profile=8075152"><div class="recentWinnersCutout"><\/div><\/a><\/div><img src="/images/profiles/noimage70x52_female.gif" width="70" height="52" alt="KOV_TITLE" style="border: solid 1px #CCCCCC;"><\/div><\/td><td><table cellpadding="0" cellspacing="0" border="0"><tr><td colspan="2"><a href="/profile/myprofile/profile.php?profile=8075152" class="size13k"><strong>ade4<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">mercredi, à 07:21<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>€ 71,26<\/strong><\/td><\/tr><\/table><\/td><\/tr><\/table>';
	
		
	winners[3] = '<table cellpadding="4" cellspacing="0" border="0" width="100%" onclick="window.location=\'/profile/myprofile/profile.php?profile=9984931\';"><tr><td width="56"><div style="position: relative; top: 0px; left: 0px;"><div style="position: absolute; top: 0px; left: 0px;"><a href="/profile/myprofile/profile.php?profile=9984931"><div class="recentWinnersCutout"><\/div><\/a><\/div><img src="/images/profiles/noimage70x52_male.gif" width="70" height="52" alt="KOV_TITLE" style="border: solid 1px #CCCCCC;"><\/div><\/td><td><table cellpadding="0" cellspacing="0" border="0"><tr><td colspan="2"><a href="/profile/myprofile/profile.php?profile=9984931" class="size13m"><strong>copmik<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">7 septembre, à 04:45<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>€ 19,96<\/strong><\/td><\/tr><\/table><\/td><\/tr><\/table>';
	
		
	winners[4] = '<table cellpadding="4" cellspacing="0" border="0" width="100%" onclick="window.location=\'/profile/myprofile/profile.php?profile=8579182\';"><tr><td width="56"><div style="position: relative; top: 0px; left: 0px;"><div style="position: absolute; top: 0px; left: 0px;"><a href="/profile/myprofile/profile.php?profile=8579182"><div class="recentWinnersCutout"><\/div><\/a><\/div><img src="/images/profiles/noimage70x52_female.gif" width="70" height="52" alt="KOV_TITLE" style="border: solid 1px #CCCCCC;"><\/div><\/td><td><table cellpadding="0" cellspacing="0" border="0"><tr><td colspan="2"><a href="/profile/myprofile/profile.php?profile=8579182" class="size13k"><strong>kouet13<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">6 septembre, à 02:14<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>€ 11,16<\/strong><\/td><\/tr><\/table><\/td><\/tr><\/table>';
	
		
	winners[5] = '<table cellpadding="4" cellspacing="0" border="0" width="100%" onclick="window.location=\'/profile/myprofile/profile.php?profile=8147080\';"><tr><td width="56"><div style="position: relative; top: 0px; left: 0px;"><div style="position: absolute; top: 0px; left: 0px;"><a href="/profile/myprofile/profile.php?profile=8147080"><div class="recentWinnersCutout"><\/div><\/a><\/div><img src="/images/profiles/noimage70x52_female.gif" width="70" height="52" alt="KOV_TITLE" style="border: solid 1px #CCCCCC;"><\/div><\/td><td><table cellpadding="0" cellspacing="0" border="0"><tr><td colspan="2"><a href="/profile/myprofile/profile.php?profile=8147080" class="size13k"><strong>lamome9<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">5 septembre, à 11:24<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>€ 13,35<\/strong><\/td><\/tr><\/table><\/td><\/tr><\/table>';
	
		
	winners[6] = '<table cellpadding="4" cellspacing="0" border="0" width="100%" onclick="window.location=\'/profile/myprofile/profile.php?profile=9398159\';"><tr><td width="56"><div style="position: relative; top: 0px; left: 0px;"><div style="position: absolute; top: 0px; left: 0px;"><a href="/profile/myprofile/profile.php?profile=9398159"><div class="recentWinnersCutout"><\/div><\/a><\/div><img src="/myprofile/profileimages/thumbs_fr/OTM5ODE1OQ==1263734298.JPG" width="70" height="52" alt="KOV_TITLE" style="border: solid 1px #CCCCCC;"><\/div><\/td><td><table cellpadding="0" cellspacing="0" border="0"><tr><td colspan="2"><a href="/profile/myprofile/profile.php?profile=9398159" class="size13k"><strong>brig74<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">4 septembre, à 17:40<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>€ 20,89<\/strong><\/td><\/tr><\/table><\/td><\/tr><\/table>';
	
		
	winners[7] = '<table cellpadding="4" cellspacing="0" border="0" width="100%" onclick="window.location=\'/profile/myprofile/profile.php?profile=9697817\';"><tr><td width="56"><div style="position: relative; top: 0px; left: 0px;"><div style="position: absolute; top: 0px; left: 0px;"><a href="/profile/myprofile/profile.php?profile=9697817"><div class="recentWinnersCutout"><\/div><\/a><\/div><img src="/images/profiles/noimage70x52_female.gif" width="70" height="52" alt="KOV_TITLE" style="border: solid 1px #CCCCCC;"><\/div><\/td><td><table cellpadding="0" cellspacing="0" border="0"><tr><td colspan="2"><a href="/profile/myprofile/profile.php?profile=9697817" class="size13k"><strong>dominik<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">3 septembre, à 13:55<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>€ 24,30<\/strong><\/td><\/tr><\/table><\/td><\/tr><\/table>';
	
		
	winners[8] = '<table cellpadding="4" cellspacing="0" border="0" width="100%" onclick="window.location=\'/profile/myprofile/profile.php?profile=7920355\';"><tr><td width="56"><div style="position: relative; top: 0px; left: 0px;"><div style="position: absolute; top: 0px; left: 0px;"><a href="/profile/myprofile/profile.php?profile=7920355"><div class="recentWinnersCutout"><\/div><\/a><\/div><img src="/myprofile/profileimages/thumbs_fr/NzkyMDM1NQ==1283419598.JPG" width="70" height="52" alt="KOV_TITLE" style="border: solid 1px #CCCCCC;"><\/div><\/td><td><table cellpadding="0" cellspacing="0" border="0"><tr><td colspan="2"><a href="/profile/myprofile/profile.php?profile=7920355" class="size13k"><strong>laetidu85<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">3 septembre, à 11:40<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>€ 37,16<\/strong><\/td><\/tr><\/table><\/td><\/tr><\/table>';
	
		
	winners[9] = '<table cellpadding="4" cellspacing="0" border="0" width="100%" onclick="window.location=\'/profile/myprofile/profile.php?profile=7085453\';"><tr><td width="56"><div style="position: relative; top: 0px; left: 0px;"><div style="position: absolute; top: 0px; left: 0px;"><a href="/profile/myprofile/profile.php?profile=7085453"><div class="recentWinnersCutout"><\/div><\/a><\/div><img src="/myprofile/profileimages/thumbs_fr/NzA4NTQ1Mw==1273784741.JPG" width="70" height="52" alt="KOV_TITLE" style="border: solid 1px #CCCCCC;"><\/div><\/td><td><table cellpadding="0" cellspacing="0" border="0"><tr><td colspan="2"><a href="/profile/myprofile/profile.php?profile=7085453" class="size13k"><strong>petitemaman2<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">2 septembre, à 05:38<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>€ 25,42<\/strong><\/td><\/tr><\/table><\/td><\/tr><\/table>';
	
		objWinners	= document.getElementById('winnerHolder');
	objWinners.style.height = (numberOfElm * heightOfElm) + 'px'; // Set height of DIV
	
	makeContent();
}

function changeContent(show, resultpage) {
  wait("Chargement des gagnants en cours...");
  makeHttpRequest("ajax/recentwinners.php?show="+show+"&resultpage="+resultpage, "showContent");
}

function paging(resultpage) {
  makeHttpRequest("ajax/recentwinners.php?show="+document.getElementById("show").value+"&resultpage="+resultpage, "showContent");
}

function initRecentWinners() {
  changeContent(0,1);
}

