// JQuery extensions
(function($) {
	$.fn.show2 = function(speed, callback) { // so now you could call show with callback even if the speed is 0 - the show and callback will be executed
		if (!speed && callback) {
			$(this).show();
			callback.call(this);
		} else {
			$(this).show(speed, callback);
		}
	};

	$.fn.hide2 = function(speed, callback) { // so now you could call hide with callback even if the speed is 0 - the hide and callback will be executed
		if (!speed && callback) {
			$(this).hide();
			callback.call(this);
		} else {
			$(this).hide(speed, callback);
		}
	};

})(jQuery);

jQuery.grepDict = function(dict, callback) {	// Go through the dict, only saving the items that pass the validator function with the original id
	var ret = {};
	for (var i in dict)	if (callback(i, dict[i])) ret[i] = dict[i];
	return ret; 		
};

// change default behavior of the populate plugin not to reset the form
// JQuery extensions
jQuery.fn._original_populate = jQuery.fn.populate;
jQuery.fn.populate = function(obj, options) { this._original_populate(obj, jQuery.extend({resetForm: false}, options)); };
