;(function($) {
	
	$.fn.ajaxify = function(_opts)
	{				
		// For obvious reasons only forms are allowed here
		return this.filter('form').each(function()
		{
			// Submit the AJAX request on form submission
			$(this).bind('submit.ajaxify', function(e)
			{
				var $this = $(this);
				
				// Create a copy of the initial options
				var opts = $.extend({}, _opts);
				
				// Provide a default URL; that of the form action
				opts.url = (opts.url) ? opts.url : $this.attr('action');
				opts.type = (opts.type) ? opts.type : $this.attr('method');

				// Append data for the submission
				opts.data = $this.serialize();
								
				$.ajax(opts);
				
				// Prevent submission
				e.preventDefault();
			});
		});
	};
	
})(jQuery);