function showOrHide(thisBlock, thisRow) {
	if (document.getElementById) {
		var element = document.getElementById(thisBlock).style;
		if (element.display != "none") {
			element.display = "none";
		} 
		else {
			element.display = '';
			document.getElementByID(thisRow).className = "scores";
		}
		return false;
	} 
	else {
			return true;
	}
}

function confirmation(course, date, ID) {
	var answer = confirm("Are you sure you want to delete your round at "+course+" on "+date+"?")
	if (answer){
		window.location = "delete.php?id="+ID;
	}
}

function course_confirmation(course, ID) {
	var answer = confirm("Are you sure you want to delete "+course+"?")
	if (answer){
		window.location = "delete.php?course="+ID;
	}
}
					
function cancel() {
		window.location = "scores.php";
	}
	
function updateTotal(index, field){
	var frontTotal=0;
	var backTotal=0;
	var total=0;
	var count = 0;
	var allEls=document.getElementsByTagName("*");
	for(var i=0;i<allEls.length;i++) {
		if(allEls[i].getAttribute("name")!=index)continue;
		if(isNaN(allEls[i].value))continue;
		if(count<9) {
			frontTotal+=new Number(allEls[i].value);
			var a=document.getElementById(field+"-front");
			a.firstChild.data=" "+frontTotal;
		}
		else {
			backTotal+=new Number(allEls[i].value);
			var b=document.getElementById(field+"-back");
			b.firstChild.data=" "+backTotal;
		}
		total+=new Number(allEls[i].value);
		count++;
		if(allEls[i].checked) {
			frontTotal+=new Number(allEls[i].value);
			var a=document.getElementById(field+"-front");
			a.firstChild.data=" "+frontTotal;
		}
	}
	var e=document.getElementById(field+'-total');
	e.firstChild.data=" "+total;
} 
