	// added by ocZio
	function thumb_clicked(up_down, $obj_clicked)
	{
		// sanity check.
		if(up_down == 'up' || up_down == 'down')
		{
			// send post requests with ajax.
			var section 	= $obj_clicked.attr('rel');
			var comment_id	= $obj_clicked.attr('ret');
			$.post('/js/ajax_thumb.php',{'section':section, 'comment_id':comment_id, 'action':up_down}, function(data){
				if(data.substr(0,3) == 'OK:')
				{
						var thumbs = parseInt(data.substr(3), 10); // base 10
						
						var $parent_box_date = $obj_clicked.parents('div.commentaires_box_date:first');
						
						if(thumbs <= -2)
						{
							// here we hide that box which is marked as junk.
							$obj_clicked.parents('div.commentaires_box_head:first').next('div.commentaires_box_texte').fadeOut('normal');
						}
						
						// show thank you message.
						//$parent_box_date.append('<span>Vote valid&eacute;</span>');
						
						$parent_box_date.children('span:eq(1)').fadeOut(300, function(){ 

        			        $(this).html('(<strong>'+ (thumbs > 0 ? '+' + thumbs:thumbs) +'</strong> votes)');
        			        $(this).fadeIn(600);
						}) 
						
						// since the vote was fine .. lets remove the links then.
						// and leave the images there.
						$parent_box_date.children('a').each(function(){
								$(this).replaceWith( $(this).children() );
						});
						
				}
				else 
				{
					alert(data);
				}
				
				
			});
		}
	}
	
	$(document).ready(function(){
	
		// first of all close all spam comments.
		$('div.spam_comment').hide();
		$('div.spam_comment').prev().children('div.commentaires_box_date')
			.append('<a href="#" class="see_spam_comment">voir le commentaire</a>');
		
		// setup listeners
		$('a.see_spam_comment').live('click', function(e){
			e.preventDefault();
			$(this).parents('div.commentaires_box_head:first').next().toggle();
		});
		
		$('a.thumb_clicked_up').live('click', function(e)  { 
		    if(e.button <= 1)
		    {
		        // left click;
		        e.preventDefault(); 
		        thumb_clicked('up', $(this)); 
		    }
		});
		
		$('a.thumb_clicked_down').live('click', function(e){ 
		    if(e.button <= 1)
		    {
		        // left click
		        e.preventDefault(); thumb_clicked('down', $(this)); 
		    }        
	    });
	
	});
