jQuery(document).ready(function(){noteArray=new Array("Słabo","Dostatecznie","Średnio","Dobrze","Rewelacja!");jQuery("div.voteBox div.starBox a").removeAttr("href");jQuery("div.voteBox[rel!='voted'] div.starBox a").bind("mouseover",function() {jQuery(this).addClass("over");jQuery(this).prevAll().addClass("over");});jQuery("div.voteBox[rel!='voted'] div.starBox a").bind("mouseout",function() {jQuery(this).removeClass("over");jQuery(this).prevAll().removeClass("over");});jQuery("div.voteBox[rel!='voted'] div.starBox a").bind("click",function() {var id=jQuery(this).parent().parent().attr("id");jQuery("#"+id+" div.whiteBox").show();jQuery("#"+id+" div.whiteBox").css("opacity",0.8);jQuery("#"+id+" div.vote_loading").show();var note=jQuery(this).prevAll().length+1;jQuery.ajax({type:"POST",dataType:"json",url:VOTE_HREF,cache:false,data:{note:note,id:id,type:'ajax'},success:function(msg){if(msg.ok=="1"){voteSuccess(msg);}}});});jQuery("div.voteBox[rel='voted'] div.starBox a").css("cursor","default");});function voteSuccess(msg) {jQuery("#"+msg.id+" div.vote_loading").hide();jQuery("#"+msg.id+" div.whiteBox").hide();jQuery("#"+msg.id+" div.starBox a").unbind("click");jQuery("#"+msg.id+" div.starBox a").unbind("mouseover");jQuery("#"+msg.id+" div.starBox a").unbind("mouseout");jQuery("#"+msg.id+" div.starBox a").css("cursor","default");var noteNumber=new String(msg.note);noteNumber=noteNumber.replace(".",",");jQuery("#"+msg.id+" span em").text(noteNumber);jQuery("#"+msg.id+" div.starBox a").removeClass("over");jQuery("#"+msg.id+" div.starBox a").removeClass("full");jQuery("#"+msg.id+" div.starBox a").removeClass("half");jQuery("#"+msg.id+" div.starBox a").removeClass("empty");stars=getStars(msg.note);jQuery("#"+msg.id+" div.starBox a:nth-child(1)").addClass(stars[0]);jQuery("#"+msg.id+" div.starBox a:nth-child(2)").addClass(stars[1]);jQuery("#"+msg.id+" div.starBox a:nth-child(3)").addClass(stars[2]);jQuery("#"+msg.id+" div.starBox a:nth-child(4)").addClass(stars[3]);jQuery("#"+msg.id+" div.starBox a:nth-child(5)").addClass(stars[4]);jQuery("#"+msg.id+" .starBox").css("opacity",0.3);} function getStars(note){stars=[];if(note<=0.75){stars=Array("half","empty","empty","empty","empty");}else if(note>=0.76&¬e<=1.25){stars=Array("full","empty","empty","empty","empty");}else if(note>=1.26&¬e<=1.75){stars=Array("full","half","empty","empty","empty");}else if(note>=1.76&¬e<=2.25){stars=Array("full","full","empty","empty","empty");}else if(note>=2.26&¬e<=2.75){stars=Array("full","full","half","empty","empty");}else if(note>=2.76&¬e<=3.25){stars=Array("full","full","full","empty","empty");}else if(note>=3.26&¬e<=3.75){stars=Array("full","full","full","half","empty");}else if(note>=3.76&¬e<=4.25){stars=Array("full","full","full","full","empty");}else if(note>=4.26&¬e<=4.75){stars=Array("full","full","full","full","half");}else if(note>=4.76){stars=Array("full","full","full","full","full");} return stars;}