
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=7400146\';"><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=7400146"><div class="recentWinnersCutout"><\/div><\/a><\/div><img src="/myprofile/profileimages/thumbs_nl/NzQwMDE0Ng==1251062085.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=7400146" class="size13k"><strong>lida32<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">Gisteren om 16:45<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>EUR 10.00<\/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=10556279\';"><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=10556279"><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=10556279" class="size13k"><strong>brigitwitteveen<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">Gisteren om 13:26<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>EUR 12.62<\/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=8698932\';"><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=8698932"><div class="recentWinnersCutout"><\/div><\/a><\/div><img src="/myprofile/profileimages/thumbs_nl/ODY5ODkzMg==1252366277.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=8698932" class="size13k"><strong>alifan<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">Gisteren om 2:38<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>EUR 10.00<\/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=7321195\';"><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=7321195"><div class="recentWinnersCutout"><\/div><\/a><\/div><img src="/myprofile/profileimages/thumbs_nl/NzMyMTE5NQ==1220202013.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=7321195" class="size13k"><strong>daanisra<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">Zaterdag om 20:40<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>EUR 14.97<\/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=9831204\';"><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=9831204"><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=9831204" class="size13k"><strong>craba<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">Zaterdag om 0:47<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>EUR 26.66<\/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=9469782\';"><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=9469782"><div class="recentWinnersCutout"><\/div><\/a><\/div><img src="/myprofile/profileimages/thumbs_nl/OTQ2OTc4Mg==1260357332.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=9469782" class="size13m"><strong>Maxje1963<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">02 februari om 13:22<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>EUR 19.60<\/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=10703927\';"><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=10703927"><div class="recentWinnersCutout"><\/div><\/a><\/div><img src="/myprofile/profileimages/thumbs_nl/MTA3MDM5Mjc=1327232456.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=10703927" class="size13k"><strong>Saggi45<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">02 februari om 3:08<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>EUR 20.00<\/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=9457275\';"><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=9457275"><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=9457275" class="size13m"><strong>danger12<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">01 februari om 11:20<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>EUR 15.68<\/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=8431445\';"><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=8431445"><div class="recentWinnersCutout"><\/div><\/a><\/div><img src="/myprofile/profileimages/thumbs_nl/ODQzMTQ0NQ==1239124273.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=8431445" class="size13m"><strong>disney14<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">31 januari om 23:42<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>EUR 44.40<\/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=7217360\';"><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=7217360"><div class="recentWinnersCutout"><\/div><\/a><\/div><img src="/myprofile/profileimages/thumbs_nl/NzIxNzM2MA==1322311281.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=7217360" class="size13k"><strong>reinaldie<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">31 januari om 14:30<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>EUR 13.21<\/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("Winnaars laden");
  //makeHttpRequest("ajax/recentwinners.php?show="+show+"&resultpage="+resultpage, "showContent");
  $.get('ajax/recentwinners.php', {show : show, resultpage : resultpage}, showContent);
}

function paging(resultpage) {
  //makeHttpRequest("ajax/recentwinners.php?show="+document.getElementById("show").value+"&resultpage="+resultpage, "showContent");
  $.get('ajax/recentwinners.php', {show : $('#show').val(), resultpage : resultpage }, showContent);
}

function initRecentWinners() {
  changeContent(0,1);
}


