// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
Event.addBehavior.reassignAfterAjax = true;
  Event.addBehavior({
    '#comment_pagination a' : Remote.Link,
	'span.voting a' : Remote.Link
  })

function reply_to_comment(id, username) {
	$('comment_parent_id').value = id;
	$('new_comment').scrollTo();
	$('username').innerHTML = username;
	$('in_reply_to').show();
    new Effect.Highlight('in_reply_to');
}

function reset_reply() {
	$('comment_parent_id').value = null;
	$('in_reply_to').hide();
	$('username').innerHTML = '';
}

function $RF(el, radioGroup) {
    if($(el).type && $(el).type.toLowerCase() == 'radio') {
        var radioGroup = $(el).name;
        var el = $(el).form;
    } else if ($(el).tagName.toLowerCase() != 'form') {
        return false;
    }

    var checked = $(el).getInputs('radio', radioGroup).find(
        function(re) {return re.checked;}
    );
    return (checked) ? $F(checked) : null;
}