(function($) {

	$.fn.reverse = function() {
		return this.pushStack(this.get().reverse(), arguments);
	};

	$.fn.sort = function() {
		return this.pushStack($.makeArray([].sort.apply(this, arguments)));
	};

	$.fn.replace = function() {
		var stack = [];
		return this.domManip(arguments, true, 1, function(a) {
			this.parentNode.replaceChild(a, this);
			stack.push(a);
		}).pushStack(stack);
	};

	$.fn.dump = function(groupTitle) {
		if ("console" in window && "log" in console) {
			if (groupTitle && typeof console.group == "function") console.group(groupTitle);
			for (var i=0; i<this.length; i++) {
				console.log("("+i+") ", this[i]);
			}
			if (groupTitle && typeof console.groupEnd == "function") console.groupEnd();
		}
		return this;
	};

	$.fn.inArray = function(elem, array) {
		return array.indexOf(elem);
	}

})(jQuery);

