﻿    var voto=false;
	var off=false;
	function ilumina(n){
		if(!off){
			var j=0;
			for (i=1;i<=n;i++){
				document.getElementById("estrella"+i).src = document.getElementById("estrella"+i).src.replace("_off.gif","_on.gif");
				j=i;
			}
			for (i=j+1;i<=5;i++){
				document.getElementById("estrella"+i).src = document.getElementById("estrella"+i).src.replace("_on.gif","_off.gif");
			}			
		}
	}
	function ilumina2(n){
			var j=0;
			for (i=1;i<=n;i++){
				document.getElementById("estrella"+i).src = document.getElementById("estrella"+i).src.replace("_off.gif","_on.gif");
				j=i;
			}
			for (i=j+1;i<=5;i++){
				document.getElementById("estrella"+i).src = document.getElementById("estrella"+i).src.replace("_on.gif","_off.gif");
			}
	}

	function apaga(){
		if(!voto && !off){
			for (i=1;i<=5;i++){
				document.getElementById("estrella"+i).src=document.getElementById('estrella'+i).src.replace("_on.gif","_off.gif");
			}
		}
	}
	function reinicia(){
		for (i=1;i<=5;i++){
			document.getElementById("estrella"+i).src=document.getElementById('estrella'+i).src.replace("_on.gif","_off.gif");
		}
	}
	function vota(n){
		// if(!off){
		if(true){
			// reinicia();			
			ilumina2(n);
			document.getElementById('botonVotar').src=document.getElementById('botonVotar').src.replace("_off.gif","_on.gif");
			off=true;
			voto=n;
		}
	}
	function votar(){
	    if(voto)
	    {
		    window.location.href = window.location.href + "&voto=" + voto;
            }
	}