﻿function starOverHandler(obj) {
	var parentObject = $("#" + obj.id).parent();
	obj.style.cursor = "pointer";
	
	parentObject.children("input").each(function() {
		if ($(this).attr("alt") <= $(obj).attr("alt")) {
			$(this).attr("src", "media/star_full.jpg");
		} else {
			$(this).attr("src", "media/star_empty.jpg");
		}
	});
}

function starOutHandler(obj) {
	var parentObject = $("#" + obj.id).parent();
	var rating = parseFloat(parentObject.children("input:last").attr("value"));
	
	parentObject.children("input").each(function() {
		if (rating >= 1.0) {
			$(this).attr("src", "media/star_full.jpg");
			rating -= 1.0;
		} else if (rating >= 0.75 && rating < 1.0) {
			$(this).attr("src", "media/star_full.jpg");
			rating = 0;
		} else if (rating >= 0.25 && rating < 0.75) {
			$(this).attr("src", "media/star_half.jpg");
			rating = 0;
		} else {
			$(this).attr("src", "media/star_empty.jpg");
			rating = 0;
		}
	});
}

function starClick(obj) {
	//Send data somehow to the Edge-object.
}