
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=10651263\';"><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=10651263"><div class="recentWinnersCutout"><\/div><\/a><\/div><img src="/myprofile/profileimages/thumbs_de/MTA2NTEyNjM=1318115660.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=10651263" class="size13m"><strong>XxEuroxX<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">Gestern um 00:46<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>EUR 20.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=5179510\';"><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=5179510"><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=5179510" class="size13k"><strong>Ginga77<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">01. Februar um 16:16<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>EUR 10.00<\/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=10334117\';"><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=10334117"><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=10334117" class="size13m"><strong>essbee<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">01. Februar um 12:33<\/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=9494356\';"><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=9494356"><div class="recentWinnersCutout"><\/div><\/a><\/div><img src="/myprofile/profileimages/thumbs_de/OTQ5NDM1Ng==1262154364.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=9494356" class="size13m"><strong>Achimp1988<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">29. Januar um 22:06<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>EUR 10.00<\/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=5303203\';"><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=5303203"><div class="recentWinnersCutout"><\/div><\/a><\/div><img src="/myprofile/profileimages/thumbs_de/NTMwMzIwMw==1241872612.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=5303203" class="size13k"><strong>melhil<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">26. Januar um 17:51<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>EUR 10.00<\/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=9193832\';"><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=9193832"><div class="recentWinnersCutout"><\/div><\/a><\/div><img src="/myprofile/profileimages/thumbs_de/OTE5MzgzMg==1255768418.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=9193832" class="size13m"><strong>ACDCFan1<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">25. Januar um 05:28<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>EUR 20.00<\/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=6666674\';"><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=6666674"><div class="recentWinnersCutout"><\/div><\/a><\/div><img src="/myprofile/profileimages/thumbs_de/NjY2NjY3NA==1207592608.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=6666674" class="size13k"><strong>ingelein2008<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">22. Januar um 10:46<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>EUR 10.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=8990332\';"><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=8990332"><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=8990332" class="size13k"><strong>ilka57<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">18. Januar um 04:25<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>EUR 20.00<\/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=6863129\';"><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=6863129"><div class="recentWinnersCutout"><\/div><\/a><\/div><img src="/myprofile/profileimages/thumbs_de/Njg2MzEyOQ==1311755465.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=6863129" class="size13k"><strong>Schwuppeline<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">17. Januar um 02:40<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>EUR 10.00<\/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=10325047\';"><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=10325047"><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=10325047" class="size13k"><strong>gisi<\/strong><\/a><\/td><\/tr><tr><td colspan="2"><div style="overflow: hidden; height: 16px; color: #999999; font-size: 9px;">12. Januar um 03:19<\/div><\/td><\/tr><tr><td class="recentWinnersMoney"><\/td><td class="size12darkgrey">&nbsp;<strong>EUR 20.00<\/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("Gewinner werden eingelesen");
  //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);
}


