function star(obj){
	var quotes = new Array();
	quotes.push(obj);
	$(".star-rating").stars();
		var obj = quotes[0];
		/* The e.target.id of the quote corresponds to its position in the quotes array */
           // alert(obj.id);
	         var tmpstr='';
			for(var z=0;z<5;z++)
			{
				tmpstr+='<input type="radio" name="voteQ'+obj.id+'" value="'+(z+1)+'" ';

				if(z+1==obj.rating) tmpstr+='checked=checked ';
				if(parseInt(obj.voted)) tmpstr+='disabled="disabled" ';
				
				tmpstr+='/>';
			}
			
			tmpstr='<div id="voteRating'+obj.id+'">'+tmpstr+'</div>';
			
			if(!obj) return false;
			$('#votes'+obj.id).html(tmpstr);
			
			$('#voteRating'+obj.id).stars({
				cancelShow: false,
				oneVoteOnly: true,
				callback:function(ui, type, value){vote(obj,value);}
			});

				//Cufon.refresh();
		//setTimeout(function(){$('#q-1').click();},250);
};
/* The global array holding all the data about the quotes. Filled in on page load. */

function vote(ob,value)
{
	/* Sending the votes to vote.php */
	$.post('/vote.php',{qid:ob.id,vote:value},function(data){
		//alert(data);
		if(data=="1")
		{
			/* If the vote was saved successfully, update the quote data.. */
			ob.voted=1;
			ob.votes=ob.votes+1;
			ob.vsum=ob.vsum+parseInt(value);
			ob.rating = Math.round(ob.vsum/ob.votes);
			
			/* ..and update the star rating */
			$('#rating-'+ob.id).stars("select", ob.rating);
			//quotes[ob.id-1]=ob;
		}
	});
}
