var countStars = 0;
var viewallprods = false;
var staron = "images/staron.gif";
var staroff = "images/staroff.gif";

function getStar2(off){
var toprate = 5;
	for(i = 0; i < off; i++){
		document.write('<img src="'+gpath2+staron+'" />');
	}
	for(n = 0; n < (toprate-off); n++){
		document.write('<img src="'+gpath2+staroff+'" />');
	}
}

function checkRateForm(thisform)
{
	var title = thisform.title;
	var name = thisform.name;
	var review = thisform.review;

	if(title.value == '') {
		alert('Please enter a title for your review');
		title.focus();
		return false;
	}
	if(name.value == '') {
		alert('Please enter your name');
		name.focus();
		return false;
	}
	if(review.value == '') {
		alert('Please enter your review');
		review.focus();
		return false;
	}
}

function Init2()
{
	for (i=1; i<=5; i++)
		document["star" + i].src = gpath2 + staroff;
}
function Activate2(pos)
{
	if (pos > 5) return;
	for (i=1; i<=pos; i++)
		document["star" + i].src = gpath2 + staron;
}
function openPopup2(pos)
{
	countStars = pos;
	var addr2 = gpath2 + "stars-popup.php?stars=" + countStars + "&theid=" + gid + "&thename=" + escape(gname);
	var popUpWin2=0;
	if(popUpWin2){
		if(!popUpWin2.closed)
			popUpWin2.close();
	}
	popUpWin2 = open(addr2,'reviewwin2','scrollbars=no,resizable=no,top=0,left=0,width=600,height=300');
	popUpWin2.focus();
}

function viewall2(obj)
{
	if (viewallprods)
	{
		document.getElementById("reviews2").style.display = "none";
		viewallprods = false;
		obj.innerHTML = "View ratings";
	} else {
		document.getElementById("reviews2").style.display = "block";
		viewallprods = true;
		obj.innerHTML = "Hide ratings";
	}		
}

function showallreviews2 (theid)
{
	var addr2 = gpath2 + "viewall.php?theid=" + theid;
	var showall2=0;
	if(showall2){
		if(!showall2.closed)
			showall2.close();
	}
	showall2 = open(addr2,'reviewwin2','scrollbars=yes,resizable=yes,top=0,left=0,width=438,height=470');
	showall2.focus();
}