<!-- // This is a flag to know if JS is enabled
document.documentElement.id = "JSenabled";
window.onload = rateIt ;
function rateIt() {
	var ratingForm = document.getElementById("rating");
	var ratingFieldsets = ratingForm.getElementsByTagName("fieldset");	
	var fieldsetLength = ratingFieldsets.length;
	var ratingLabels = ratingForm.getElementsByTagName("label");	
	var labelLength = ratingLabels.length;	
	for (var i=0; i < fieldsetLength; i++) {
			ratingFieldsets[i].style.visibility = "visible";
	}
	for (var i=0; i < labelLength; i++) {
		ratingLabels[i].onclick = addSelection;
		ratingLabels[i].onmouseover = setTitle;
		ratingLabels[i].onmouseout = unsetTitle;
		ratingLabels[i].getElementsByTagName("input")[0].onfocus = addFocus;
		ratingLabels[i].getElementsByTagName("input")[0].onclick = addFocus;
		ratingLabels[i].getElementsByTagName("input")[0].onblur = removeFocus;						
	}
		
}
// setting class names depending on user's selection
var addSelection = function () {	
	switch(this.innerHTML.charAt(0)*1) {
		case 1:
			this.parentNode.className="one";
		break;
		case 2:
			this.parentNode.className="two";
		break;
		case 3:
			this.parentNode.className="three";
		break;
		case 4:
			this.parentNode.className="four";
		break;
		case 5:
			this.parentNode.className="five";
		break;
		default:
		  	alert("Something went horribly wrong!");
	}
}
// Using JS to plug titles (to be nice to SR users)
// See test case http://public.yahoo.com/~thierryk/test-case/implicit-labeling-and-attributes.html
var setTitle = function () {
	switch(this.innerHTML.charAt(0)*1) {
		case 1:
			this.title = "1 out of 5";
		break;
		case 2:
			this.title = "2 out of 5";
		break;
		case 3:
			this.title = "3 out of 5";
		break;
		case 4:
			this.title = "4 out of 5";
		break;
		case 5:
			this.title = "5 out of 5";
		break;
		default:
		  	alert("Something went horribly wrong!");
	}
}
// Reset
var unsetTitle = function () {
	this.title = "";
}
// Setting the class "focus" when the element gets focus
var addFocus = function () {
	this.parentNode.getElementsByTagName("IMG")[0].className = "focus";
}
// Reset
var removeFocus = function () {
	this.parentNode.getElementsByTagName("IMG")[0].className = "";
}
//--><!]]>
