// JavaScript Document
var ivot_msgs = new Array('mala', 'regular','normal','buena','excelente');


function ivot_marcar(obid, num)
{
	var ul = document.getElementById(obid);
	if (ul)
	{
		var lis = ul.getElementsByTagName('li');
		for (i = 0; i < lis.length; i++)
		{
			if (i < num)
				lis[i].className = 'over';
			else
				lis[i].className = 'normal';
		}

		// mensaje
		var mbox = document.getElementById('ivot_msg');
		if (mbox) {
			if (num == 0)
				mbox.innerHTML = 'Puntuaci&oacute;n:';
			else
				mbox.innerHTML = ivot_msgs[num-1];
		}
	}
}

function ivot_votar(obid, num)
{	
	var ul = document.getElementById(obid);
	if (ul)
	{
		var lis = ul.getElementsByTagName('li');
		for (i = 0; i < lis.length; i++)
		{
			if (i < num)
				lis[i].className = 'marcada';
			else
				lis[i].className = 'normal';

			lis[i].onmouseover = function () {}
			lis[i].onclick = function () {}
		}
		ul.onmouseout = function() {}

		var valor = document.getElementById('ivot_value');
		if (valor) { valor.value = num; }
	}
}

function ivot_crear (obid)
{
	document.write ('<label for="ivot_value" id="ivot_msg">Puntuaci&oacute;n:</label>');
	document.write ('<input type="hidden" name="ivot_value" id="ivot_value" value="0" />');
	document.write ('<ul class="ivot" id="' + obid + '" onmouseout="ivot_marcar(\'' + obid + '\', 0);">');
	document.write ('<li onmouseover="ivot_marcar(\'' + obid + '\', 1);" onclick="ivot_votar(\'' + obid + '\',1);"><span>1</span></li>');
	document.write ('<li onmouseover="ivot_marcar(\'' + obid + '\', 2);" onclick="ivot_votar(\'' + obid + '\',2);"><span>2</span></li>');
	document.write ('<li onmouseover="ivot_marcar(\'' + obid + '\', 3);" onclick="ivot_votar(\'' + obid + '\',3);"><span>3</span></li>');
	document.write ('<li onmouseover="ivot_marcar(\'' + obid + '\', 4);" onclick="ivot_votar(\'' + obid + '\',4);"><span>4</span></li>');
	document.write ('<li onmouseover="ivot_marcar(\'' + obid + '\', 5);" onclick="ivot_votar(\'' + obid + '\',5);"><span>5</span></li>');
	document.write ('</ul>');
	document.write ('<div style="clear:both; margin-bottom:0.5em;">&nbsp;</div>');
	document.fm.ivot_value.value=0;
	
}
