new function(){
	var sent = false, h = new HTTPRequest();
	function votar(nota){
		
		if(sent) return;
		var ok = false;
		var e = {"end": function(e){
			if(e.status == 200){
				ok = true;
				var o = new Function("return " + e.responseText)();
				//if(+o.ok){
				//	var r = ge("ratingText");
				//	r.style.width = r.parentNode.offsetWidth * (o.nota / 5) + "px";
				//}
			}
			if(!ok)
				sent = false;
		}}
		sent = true;
		h.post("rate.php", {id: materia_id, v: nota, t: t}, e, false);
	}

	ge("StarsRating").style.display = "block";
	var l = ge("StarsRating").getElementsByTagName("a"), i = 0;
	while(o = l.item(i++))
		new function(i){
			addEvent(o, "click", function(){
				votar(i);
				return alert("Seu voto foi recebido, obrigado."), false;
			});
		}(i);
}