var sMax = 5;	// 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

// Rollover for image Stars //
function rating(num){
	s = num.id.replace("_", ''); // Get the selected star
	a = 0;
	for(i=1; i<=sMax; i++){		
		if(i<=s){
			document.getElementById("_"+i).className = "on";				
			holder = a+1;
			a++;
		}else{
			document.getElementById("_"+i).className = "";
		}
	}
}
// For when you roll out of the the whole thing //
function off(me){	
		if(!preSet){	
			for(i=1; i<=sMax; i++){		
				document.getElementById("_"+i).className = "";				
			}
		}else{
			rating(preSet);			
		}
}

// When you actually rate something //
function rateIt(me, ratingValue){	
		preSet = me;				
		rating(me);	
		document.getElementById('ratingValue').value = ratingValue;
}

function displayStar(star) {
	document.write("<span>");
	for(i=1; i<=sMax; i++) {
		if(i<=star) {
			document.write("<img src='/sbweb_sb/common/images/sbu/icons/star_on.gif'/>");
		} else {
			document.write("<img src='/sbweb_sb/common/images/sbu/icons/star_off.gif'/>");
		}			
	}
	document.write("</span>");   
}

function expandComments() {
	var elementField = document.getElementById("moreComments").style;
	if(elementField.display == 'none') {
		elementField.display ='inline';
	} else {
		elementField.display = 'none';
	}
}


