/*
	RATING.JS BY JOSH LAWTON
	This script changes a series of images onMouseOver.
	Useful for rating systems to display stars for each record.
*/

var image_location = "images/";					// Absolute location for rating images
if (document.images) {
	turnon = new Image();
	turnon.src = "images/rate_on.gif";
}


function lightup(imgname, howmany) {										// Change image source for selected row
	if (document.images) {													// Two parameters: which image and how many to change
		var turnon = image_location + "rate_on.gif";
		var jj = 0;
		for(jj = 0; jj < howmany; jj++) {
			var thisimage = imgname + "z" + jj;								// "z" delimits the image name and number
			document[thisimage].src = turnon;
		}
	}
}

function turnoff(imgname, howmany) {										// Corrollary to function above; returns images back
	if (document.images) {													// to default source
		var turnoff = image_location + "rate_off.gif";
		var cc = 0;
		for(cc = 0; cc < howmany; cc++) {
			var thisimage = imgname + "z" + cc;
			document[thisimage].src = turnoff;
		}
	}
}

function change_status(which_img, status) {									// Change the text displayed in the span
	if(status == 0) {														// Two parameters: which span and what message to show
		var here = "document.all.status" + which_img + ".innerHTML";
		eval(here + "='Rate Me!'");
	}
	if(status == 1) {
		var here = "document.all.status" + which_img + ".innerHTML";
		eval(here + "='Lame'");
	}
	if(status == 2) {
		var here = "document.all.status" + which_img + ".innerHTML";
		eval(here + "='Almost Funny'");
	}
	if(status == 3) {
		var here = "document.all.status" + which_img + ".innerHTML";
		eval(here + "='Mildly Amusing'");
	}
	if(status == 4) {
		var here = "document.all.status" + which_img + ".innerHTML";
		eval(here + "='A Good Laugh'");
	}
	if(status == 5) {
		var here = "document.all.status" + which_img + ".innerHTML";
		eval(here + "='Hilarious'");
	}
}
