function iframeNav (iframe, gotoHere) {

isnetscape = (window.navigator.appName.toUpperCase().indexOf("NETSCAPE") >= 0)

// select the iFrame differently, depending on the browser
if (isnetscape) {
	var iframeObj = document.getElementById(iframe);
} else {
	var iframeObj = frames[iframe];
}

// if the iFrame exists, navigate in it. Navigation depends on browser
if (typeof(iframeObj) != 'undefined' && null != iframeObj) {
	if (isnetscape) {
		iframeObj.contentWindow.location.replace(gotoHere);
	} else {
		iframeObj.location.replace(gotoHere);
	}
}

}

function doRating (item, rating) {

	toupdate = ratepage + item + '/' + rating;
	iframeNav ('rateFrame', toupdate);
	updateStars (item, rating);

}
function doRatingToSubmit (item, rating) {

	toupdate = ratepage + item + '/' + rating;
	iframeNav ('rateFrame', toupdate);
	updateStars (item, rating);
	document.getElementById('itemrating').value = rating;

}
function doRatingForAdd (item, rating) {

	updateStars (item, rating);
	document.getElementById('itemrating').value = rating;

}
function updateStars (item, rating) {
	
	document.getElementById(item+'unrated').style.display = 'none';
	document.getElementById(item+'rated').style.display = 'inline';

	for (var i=0; i < rating; i++) {
		document.images[item+'rated'+i].src = '/img/common/star-on.gif';
	}
	
}
function resetStars (item) {

	document.getElementById(item+'unrated').style.display = 'inline';
	document.getElementById(item+'rated').style.display = 'none';

	for (var i=0; i < 5; i++) {
		document.images[item+'rated'+i].src = '/img/common/star-off.gif';
	}

}
function overStar (item, index) {

	for (var i=1; i <= index; i++) {
		document.images[item+'unrated'+i].src = '/img/common/star-hover.gif';
	}
	
}
function outStar (item, index) {

	for (var i=1; i <= 5; i++) {
		document.images[item+'unrated'+i].src = '/img/common/star-off.gif';
	}
	
}
