$(function(){
$("a.thm_up").click(function(){

var
 //get the id
 the_id = $(this).attr('id');
// alert(the_id);
 
 var grouping = $("input#group").val();  
	//alert(grouping);
 // show the spinner
$(this).parent().html("<img src='../images/spinner.gif'/>");
 
 //fadeout the vote-count 
 //$("span#votes_count"+the_id).fadeOut("fast");
// alert("test");
 //the main ajax request
  $.ajax({
   type: "POST",
   data: "action=thm_up&grouping="+ grouping +"&id="+$(this).attr("id"),
   url: "../scripts/priorityvoting.asp",
//   url=url+"?mycGroup="+ mycGroup;
   success: function(msg)
   {
    
	//alert(msg);
	//$("span#votes_count"+the_id).html(msg);
//	$("#HideVote"+the_id).hide();
	//$("thm_up"+the_id).hide();
//	$("thm_dwn"+the_id).hide();


//$("span#HideVote"+the_id).fadeOut();
			//$("span#green"+the_id).html(msg);
			//	$("span#HideVote"+the_id).html(msg);
			//	$("span#votes_count"+the_id).fadeIn();
			//$("#HideVote"+the_id).hide();

			$("span#votes_count"+the_id).html(msg);
			//	$("span#votes_count"+the_id).fadeIn();
			$("#HideVote"+the_id).hide();


 //   fadein the vote count
  //  $("span#votes_count"+the_id).fadeIn();
    //remove the spinner
//    $("span#vote_buttons"+the_id).remove();
   }
  });
 });
 
 $("a.thm_dwn").click(function(){
	//get the id
	the_id = $(this).attr('id');
	var grouping = $("input#group").val();  
//	alert(grouping);
	// show the spinner
	//$(this).parent().html("<img src='images/loader.gif'/>");
	
	$(this).parent().html("<img src='../images/spinner.gif'/>");
	
	//$("span#votes_count"+the_id).fadeOut("fast");

	//the main ajax request
		$.ajax({
			type: "POST",
			//data: "action=thm_dwn&id="+$(this).attr("id"),
			data: "action=thm_dwn&grouping="+ grouping +"&id="+$(this).attr("id"),
			url: "../scripts/priorityvoting.asp",
			success: function(msg)
			{
				//$("span#HideVote"+the_id).fadeOut();
				$("span#votes_count"+the_id).html(msg);
			//	$("span#votes_count"+the_id).fadeIn();
			$("#HideVote"+the_id).hide();
			}
		});
	});
});
