var off = true;
var ratingloc;

function flip_colors(obj) {
	if (off) {
		obj.style.backgroundColor = "#FFFF00";
		obj.style.color = "#333366";
		obj.style.borderColor = "#333366";
		off = false;
	}
	else {
		obj.style.backgroundColor = "#333366";
		obj.style.color = "#FFFF00";
		obj.style.borderColor = "#FFFF00";
		off = true;
	}
}

function showrating(loc) {
	ratingloc = loc.slice(26);
//	alert(ratingloc);
	if (document.getElementById("ratingscell").style.display == "none")
	{
		document.getElementById('ratingscell').style.display = "";
		adjustHeight();
	}
	
	document.getElementById("ratingsframe").src = "ratings.php?fme=" + ratingloc;
}

function hiderating() {
	document.getElementById('ratingscell').style.display = "none";
	adjustHeight();
}

function rating_expand(expand,s5,s4,s3,s2,s1,spos) {
	var mybox = document.getElementById("ratings_box");
	if (expand) {
		var star_array = new Array(s5,s4,s3,s2,s1);
		mybox.style.left = parseInt(spos) + 160 + "px";
		var composite = "<div style='float: left'><p style='line-height: 20px'>";
		composite += "<img src='images/stars/stars-5.jpg' align='left' width='80' height='16' style='margin: 0 5px 0 0' /><br />";
		composite += "<img src='images/stars/stars-4.jpg' align='left' width='80' height='16' style='margin: 0 5px 0 0' /><br />";
		composite += "<img src='images/stars/stars-3.jpg' align='left' width='80' height='16' style='margin: 0 5px 0 0' /><br />";
		composite += "<img src='images/stars/stars-2.jpg' align='left' width='80' height='16' style='margin: 0 5px 0 0' /><br />";
		composite += "<img src='images/stars/stars-1.jpg' align='left' width='80' height='16' style='margin: 0 5px 0 0' />";
		composite += "</p></div><div style='float: left'><p style='line-height: 20px; font-size: 14px'>";
		
		for (var i = 0; i < 5; i++)
		{
			composite += star_array[i];
			if (star_array[i] == 1)
				composite += " vote<br />";
			else
				composite += " votes<br />";
		}
		composite += "</p></div>";
		mybox.style.display = "";
		mybox.innerHTML = composite;
	}
	else
	{
		mybox.innerHTML = "&nbsp;"
		mybox.style.left = "0px";
		mybox.style.display = "none";
	}
}