function preloadStaticAssets(assetList, cb, onEachLoad) {
	var data     = assetList.dat;
	var imgCount = assetList.img.length;
	var count    = imgCount + assetList.snd.length;
	var root     = assetList.root;
	var load     = 0;
	var done     = 0;
	function storeAsset(path, obj) {
		var splitted = path.split('/');
		var filename = splitted.pop();
		var id = filename.split('.');
		id.pop();
		id = id.join('.');
		var container = data;
		for (var i = 0, len = splitted.length; i < len; i++) {
			container = container[splitted[i]];
		}
		container[id] = obj;
		splitted.push(id);
		obj.name = id;
		obj.path = splitted.join('/');
	}
	function loadAssets() {
		var current = load + done;
		var percent = current / count;
		onEachLoad && onEachLoad(load, current, count, percent);
		var path;
		var loadFunc;
		if (current < imgCount) {
			path = assetList.img[current];
			loadFunc = loadImage;
		} else {
			path = assetList.snd[current - imgCount];
			loadFunc = loadSound;
		}
		done += 1;
		loadFunc(root + path, function onAssetLoaded(error, img) {
			if (!error) storeAsset(path, img);
			load += 1;
			done -= 1;
			if (load + done < count) loadAssets()
			else if (done === 0) cb(null, data);
		});
	}
	// loading assets in parallel, with a limit of 5 parallel downloads.
	if (count === 0) return cb(null, data);
	var parallel = Math.min(5, count - 1);
	for (var j = 0; j <= parallel; j++) loadAssets();
	// });
}
@function module:loader.preloadStaticAssets

@desc   Preload all static assets of the game.
        The function first ask the server for the asset list.
        Server respond with an object containing the list of images
        to load and all data that are put in the www/asset folder.
        At this step, if request fail, function send an error.
        The function then proceed the loading of image assets.
        If an image loading fail, the loading continue, and loading
        status is set to 1 (an image load fail).
        Images are load by 5 in parallel.

        Function end and wil return an object that mix all data and
        all assets so that it will have the same structure as the
        'assets' folder.


        Assets list and data are automaticaly generated by server
        Just drop images and json files in the www/asset/ folder
        and the server will take care of it !


@param {Function} cb         - asynchronous callback function to
                               call when all is preloaded

@param {Function} onEachLoad - optional callback function called
                               every time one file is loaded
                               (for loading progress purpose)