function textCounter(maxlimit) {
  field = document.getElementById('post_content');
  cntfield = document.getElementById('num_characters');
  if(field && cntfield)
  {
	  count = maxlimit - field.value.length;
	  cntfield.innerHTML = count;
	  if(count < 0){
	    cntfield.style.color = "#FF0000";
	  } else {
	    cntfield.style.color = "#CCCCCC";
	  }
  }
}

$(function()
{
    $("a.vote_link").click(function()
    {
        //get the id
        the_id = $(this).attr('id');
        the_secret = $(this).attr('secret');
        the_action = $(this).attr('action');

        // Strip out the anchor
        $(this).parent().html($(this).text());

        //fadeout the vote-count 
        $("span#votes-"+the_action+"-"+the_id)
            .html( Number($("span#votes-"+the_action+"-"+the_id).text()) +1);

        //the main ajax request
        $.ajax({
            type: "POST",
            data: "action=votes_"+the_action+"&id="+the_id+"&secret="+the_secret,
            url: "http://imontherun.com/votes.php",
            success: function(msg)
            {
                $("div#ajaxstatus-"+the_id).show();
                $("div#ajaxstatus-"+the_id).html(msg);
            }
            });
    });
});