/*
Author: Addam M. Driver
Modifications: Brent CT Young
Date: 10/31/2006
*/

var sMax;	// Isthe maximum number of stars
var holder; // Is the holding pattern for clicked state
var preSet; // Is the PreSet value onces a selection has been made
var rated;

// Rollover for image Stars //
function starRate(num) {
	sMax = 0;	// Isthe maximum number of stars
	for(rn=0; rn<num.parentNode.childNodes.length; rn++){
		if(num.parentNode.childNodes[rn].nodeName == "A"){
			sMax++;	
		}
	}
	
	if(!rated){
		s = num.id; // Get the selected star
		a = 0;
		for(ri=1; ri<=sMax; ri++){		
			if(ri<=s){
				document.getElementById(ri).className = "on";
				document.getElementById("rateStatus").innerHTML = ' ' + num.title;	
				holder = a+1;
				a++;
			} else{
				document.getElementById(ri).className = "";
			}
		}
	}
}

// For when you roll out of the the whole thing //
function off(me){
	if(!rated){
			for(ri=1; ri<=sMax; ri++){		
				document.getElementById(ri).className = "";
				document.getElementById("rateStatus").innerHTML = "";
			}
	}
}

// When you actually rate something //
function rateIt(me){
	if(!rated){
		document.getElementById("rating").value = me.id;
		rated=1;
		starRate(me);
	}
}

