Having written the majority of a website in javascript with a decent framework, one learns how much more efficient it really is than to write in php.
Here is a line from my comment voting system. It basically consists of three arrow links (a.c_up, a.c_dn, a.c_na in css notation) that dont go anywhere but onclick are intercepted by js that fetches out the value of what you clicked (easy), and additionally the value of your old vote if you had voted (hard).
var oldvote = (ele = $('c_'+cid).down('a.voted')) ? {'c_up':1,'c_dn':-1,'c_na':0}[ ele.removeClassName('voted').classNames() ] : 0;
So basically, if there is an a element down from the comment with your comment id that has classname voted, call that element ele, remove its active status (classname voted), find its remaining classname (i.e. figure out which arrow it is) then convert that classname to a number via the json array in curly brackets. If no such element exists, your oldvote is 0.
prototype is awesome, feel free to share yours