function preloadImages(img, callback) {
	this.load = function() {
		var _self = this;
		for (var i=0; i<this.images.length; i++) {
			var preload = new Image();
			preload.onload = function(){_self.precallback()};
			preload.src = this.images[i];
		}
	}
	
	this.precallback = function() {
		this.loaded++;
		if (this.loaded == this.images.length) {
			// final callback
			if (this.callback) {
				eval(this.callback);
			}
		}
	}
	
	if (img.length) {
		// array of images
		this.images = img;
		this.callback = callback;
		this.loaded = 0;
		this.load();
	}
}