/**
 * Dead simple JSON queue for jQuery
 * 
 * NOTE: Developed for jQuery 1.2.3+
 * 
 * @author August Kaiser <august.kaiser@beehivemedia.com>
 */

/*
 * Queue JSON requests so that they process in original order of execution
 * 
 * Example:
 *
 * $.jsonQueue(url, [data]);
 */

;(function($) {
	$.jsonQueue = function(url, data) {
		var _previous = data;

		var newData = function(json) {
			if ( _previous ) _previous.apply(this, arguments);

			$([$.jsonQueue]).dequeue("json");
		};

		$([$.jsonQueue]).queue("json", function() {
			$.getJSON(url, newData);
		});
	};
})($);
