
jQuery.extend({
	preload: function(what, callback) {
		if(typeof what == 'string')
			what = [what];
		
		var count = 0;
		
		jQuery.each(what, function(e,f) {
			jQuery('<img src="'+this+'" />')
				.load(function() {
					if(jQuery.isFunction(callback))
						callback(e, ++count, what.length, f);
				});
		});

	}
});

