// Envia la petición ajax para realizar un voto.
function votar(id, voto){

	if(id == undefined){
		alert("Error: se esperaba un id");
		return;
	}

	if(voto == undefined){
		alert("Error: se esperaba un voto");
		return;
	}

	$.ajax({
		type: "GET",
		url: "http://cantitos.riverplate.com/votacion_ajax.php",
		data: "id="+id+"&voto="+voto+"",
		success: function(msg){
			document.getElementById("votar_cantito_"+id).innerHTML = msg;
			document.getElementById('calif_texto_'+id).style.display = 'none';
		}, 
		error: function(xho){
			document.getElementById("votar_cantito_"+id).innerHTML = "Error:"+xho.responseText;
		}
	});
}

function obtener(id){

	if(id == undefined){
		alert("Error: se esperaba un id");
		return;
	}

	$.ajax({
		type: "GET",
		url: "http://cantitos.riverplate.com/votacion_leer.php",
		data: "id="+id+"",
		success: function(msg){
			document.getElementById("votar_leer_"+id).innerHTML = msg;
		}, 
		error: function(xho){
			document.getElementById("votar_leer_"+id).innerHTML = "Error:"+xho.responseText;
		}
	});
}


function effects_over(star_number,idc) {
		for (i=1; i<=star_number; i++) {
			document.getElementById('star'+idc+'-'+i).src = 'http://cantitos.riverplate.com/template/estrella_over.gif';
		}
		for (i=star_number+1; i<=5; i++) {
			document.getElementById('star'+idc+'-'+i).src = 'http://cantitos.riverplate.com/template/estrella_out.gif';
		}

	switch(star_number) {
		case 1:	txt = 'Malo'; break;
		case 2:	txt = 'Regular'; break;
		case 3: txt = 'Bueno'; break;
		case 4: txt = 'Muy bueno'; break;
		case 5: txt = 'Excelente'; break;
			txt
	}
	document.getElementById('calif_texto_'+idc).innerHTML = txt;
	return;
}

function calif_texto(calif_id) {
	document.getElementById('calif_texto_'+calif_id).style.display = 'block';
	return;
}

function calif_texto_out(calif_o_id) {
	document.getElementById('calif_texto_'+calif_o_id).style.display = 'none';
	return;
}