
var seenRand = new Array();

function getRand() {
	var randNo = Math.floor(Math.random() * 48) + 1;
	if (seenRand[randNo]) { randNo = getRand(); }
	seenRand[randNo] = 1;
	return randNo;
}

function genPicks(myForm) {
	seenRand.length = 0;

	for (var clear = 1 ; clear <= 49 ; clear++) {
		document.form1["checkbox" + clear].checked = false;
	}
	
	for (var i = 1 ; i <= 6 ; i++) {
		myRand = getRand();
		for (var c = 1; c <= myRand ; c++) {
			myForm["T" + i].value = c;
		}
		document.form1["checkbox" + myRand].checked = true;
	}
}

function getResult() {
	var found = 0;
	for (var count = 1 ; count <= 49 ; count++) {
		if (document.form1["checkbox" + count].checked == true) {
			found++;
		}
	}
	if (found > 6) {
		alert("Six numbers only, please! \nYou have chosen " + found);
		return false;
	} 
	if (found < 6) {
		alert("Not enough numbers! \nYou have only picked " + found);
		return false;
	}
	
	document.getElementById("loading").style.display = 'block';
	document.getElementById("message").style.display = 'block';
	
	var timer = setTimeout('document.location.href = "/you-won/" + thePrize + "/"', 3000);

}

function clearStuff() {
	document.getElementById("loading").style.display = 'none';
	document.getElementById("message").style.display = 'none';
}

