$(document).ready(function(){
						   
	var voted = false;
	var the_item_id = 0;					   
	$('.creepy_yes').live('click', function(){

		if(the_item_id != $(this).attr('rel')){
			voted = false;	
		}
   		the_item_id = $(this).attr('rel');		
		var theElem = $(this);
		var count = $(this).text();
		if(voted === false){
			if(count == ''){
				$.post('/creepymeter/new_yes', {'id': the_item_id}, function(data){
					if(data === 'yes'){
						$(theElem).html('<span>1</span>');
						$(theElem).parent().children('.creepy_no').html('<span>0</span');
					};							   
				});
			}else{
				$.post('/creepymeter/yes', {'id': the_item_id}, function(data){
					if(data === 'yes'){
						$(theElem).html('<span>'+(parseInt(count)+1)+'</span>');
					};							   
				});
			}
			voted = true;
		}
		return false;
	});						   
	
	$('.creepy_no').live('click', function(){
		if(the_item_id != $(this).attr('rel')){
			voted = false;	
		}
   		the_item_id = $(this).attr('rel');		
		var theElem = $(this);
		var count = $(this).text();
		if(voted === false){
			if(count == ''){
				$.post('/creepymeter/new_no', {'id': the_item_id}, function(data){
					if(data === 'no'){
						$(theElem).html('<span>1</span>');
						$(theElem).parent().children('.creepy_yes').html('<span>0</span');
					};							   
				});
			}else{
				$.post('/creepymeter/no', {'id': the_item_id}, function(data){
					if(data === 'no'){
						$(theElem).html('<span>'+(parseInt(count)+1)+'</span>');
					};							   
				});
			}
			voted = true;
		}
		return false;				   
	});
});