
/**
Quizz specific functions
TODO: Remove onclickevents in HTML code and convert to oop.
**/

function radioValidator() {
	radioOption = -1
	for (counter=0; counter<document.questionnaire.choice.length; counter++) {
		if (document.questionnaire.choice[counter].checked) {
			radioOption = counter
		}
	}
	//return (radioOption == -1) ? false : true;
	if (radioOption == -1) {
		return false;
	}
	return true;
}

function hide_all(nr) {
	for (var i = 1; i <= nr; i++) {
		// get table row element
		var tr_elem = document.getElementById("comment" + i);
		// if null, get next
		if (tr_elem != null) {
			// hide it
			tr_elem.className = 'cmnt';
		}
	}
}

function show_hide(pos, nr) {
	// hide all elements
	hide_all(nr);

	// get table row element
	var tr_elem = document.getElementById("comment" + pos);

	// if null, return
	if (tr_elem == null) {
		return false;
	}

	// show comment
	tr_elem.className = 'cmnt_visible';
}
