// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

jQuery.ajaxSetup({
	'beforeSend': function(xhr) { xhr.setRequestHeader("Accept", "text/javascript")}
})

jQuery.fn.submitWithAjax = function() {
	this.submit(function() {
	    $.post($(this).attr("action"), $(this).serialize(), null, "script");
		return false;
	});
};
  
jQuery(document).ready(function() {

	$("abbr[class*=timeago]").timeago();	

	$(".flash_notice, .flash_error, .flash_success").fadeIn("slow");
	$(".flash_notice a.close_notify").click(function() {
	    $(".flash_notice").fadeOut("slow");
	    return false;
	});
	$(".flash_error a.close_notify").click(function() {
	    $(".flash_error").fadeOut("slow");
	    return false;
	});
	$(".flash_success a.close_notify").click(function() {
	    $(".flash_success").fadeOut("slow");
	    return false;
	});

	$(":input[type=textarea]").textCounting({lengthExceededClass: 'count_over'});
	
	$("#search_box").DefaultValue("Search the directory")
	
	$("a.rjs").click( function() {
	  $.ajax({
	      url: this.href,
	      dataType: "script",
	      beforeSend: function(xhr) {xhr.setRequestHeader("Accept", "text/javascript");}
	  });
	  return false;
	});
	
});