//<!--
//<![CDATA[
//---------------------
// Rating Functions
// coder: Sean Newton
// completed: 08/06/07
//---------------------
// <!-- start configuration -->
var currentPrefix = 'ctl00_LeftContent_Rating1_';
var ratingAmts = new Array('0 stars','½ star','1 star','1 ½ stars',
						   '2 stars','2 ½ stars','3 stars','3 ½ stars',
						   '4 stars','4 ½ stars','5 stars');
var ratingDescs = new Array('Not yet reviewed!',
							'The horrible taste still lingers in my mouth.',
							'I’ve tasted better dishwater.',
							'Somethings just not quite right about it.',
							'Average, wouldn\'t pay for it.',
							'Okay, not bad, so so…',
							'Quite enjoyed this recipe.',
							'Now that’s more like it…',	
							'Excellent dish, really delicious.',
							'The tender flavours make my tastbuds dance!',
							'Wow. This is now one of favourite recipes of all time.');
// <!-- end configuration -->

function calculateRating(ratingLink,isPersonalRating) {
	var rating = ratingLink.id.replace(currentPrefix+'rated',"").trim();
	var classToUse='';
	if(isPersonalRating==null) isPersonalRating=true;
	if(isPersonalRating){classToUse='full_b';}
	else{classToUse='full';}
	resetStars();		
	for(rated=1;rated<=rating;rated++) {
		if((rated%2)==0) document.getElementById(currentPrefix+'rated'+rated).className="star_right_"+classToUse;
		else document.getElementById(currentPrefix+'rated'+rated).className="star_left_"+classToUse;
	}
	var ratAmt=document.getElementById('ratingAmount');
	var ratDesc=document.getElementById('ratingDesc');
	ratAmt.innerHTML=ratingAmts[rating];
	ratDesc.innerHTML=ratingDescs[rating];
}
function setRating(ratingLink) {
	var rating=ratingLink.id.replace(currentPrefix+'rated',"");
	var obj= document.getElementById(currentPrefix+'inpRating');
	obj.value=rating;
}
function resetRating(isPersonalRating, canSetRating) {
	var rating=document.getElementById(currentPrefix+'inpRating').value;
	if(isPersonalRating==null){isPersonalRating=true;}
	if(canSetRating==null){canSetRating=false;}
	var classToUse='';
	if(isPersonalRating){classToUse='full_b';}
	else{classToUse='full';}
	resetStars();
	if(canSetRating) {
		for(rated=1;rated<=rating;rated++) {
			if((rated%2)==0){document.getElementById(currentPrefix+'rated'+rated).className="star_right_"+classToUse;}
			else{document.getElementById(currentPrefix+'rated'+rated).className="star_left_"+classToUse;}
		}
	}
	var ratAmt=document.getElementById('ratingAmount');
	var ratDesc=document.getElementById('ratingDesc');
	ratAmt.innerHTML=ratingAmts[rating];
	ratDesc.innerHTML=ratingDescs[rating];
}
function resetStars() {
	for(rated=1;rated<=10;rated++) {
		if((rated%2)==0){document.getElementById(currentPrefix+'rated' + rated).className = "star_right_empty";}
		else{document.getElementById(currentPrefix+'rated' + rated).className = "star_left_empty";}
	}	
}
String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}
function getObject(clientId) {
    var obj = document.getElementById(clientId);
    return obj; 
}
if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
//]]>
//-->
