jQuery(document).ready(function(){
	
	$j = jQuery.noConflict();
	
	$j("#post_comment_submit").live('click', function() {
	  
  	$j("form#new_medium_comment").submit(function() {

  	  $j("#post_comment_submit").attr('disabled', 'disabled');
      $j(".spinner").show().css({ display: 'block' });

  	  $j.post(this.action, $j(this).serialize(), null, "script");
      
      return false;
      
  	});
  	
  	$j("form#new_medium_comment").submit();
  	
  	return false;
  	
	});
	
	
  $j.ajaxSetup({ 
    'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")} 
  })
  
});

jQuery(document).ajaxSend(function(event, request, settings) {
  if (typeof(AUTH_TOKEN) == "undefined") return;
  settings.data = settings.data || "";
  settings.data += (settings.data ? "&" : "") + "authenticity_token=" + encodeURIComponent(AUTH_TOKEN);
});