function findLowestAvailableStack(item) {
		for (var stackLevel = 0; stackLevel < 1000; stackLevel++) {
			var stackLayer = stackedResult[stackLevel];
			if (!stackLayer) stackLayer = stackedResult[stackLevel] = [];

			if (!findItemInLayer(item, stackLayer)) {   //If we found a hole, stick this item in it and bail
				stackLayer.push(item);
				return stackLevel;
			}
		}
	}
//This brute-force search is going to be slow if there are too many items.
This brute-force search is going to be slow if there are too many items.
This brute - force search is going to be slow if there are too many items .
function findLowestAvailableStack(item) {
		for (var stackLevel = 0; stackLevel < 1000; stackLevel++) {
			var stackLayer = stackedResult[stackLevel];
			if (!stackLayer) stackLayer = stackedResult[stackLevel] = [];
			if (!findItemInLayer(item, stackLayer)) {   
				stackLayer.push(item);
				return stackLevel;
			}
		}
	}
function findLowestAvailableStack ( item ) { for ( var stackLevel = 0 ; stackLevel < 1000 ; stackLevel ++ ) { var stackLayer = stackedResult [ stackLevel ] ; if ( ! stackLayer ) stackLayer = stackedResult [ stackLevel ] = [ ] ; if ( ! findItemInLayer ( item , stackLayer ) ) { stackLayer . push ( item ) ; return stackLevel ; } } }
This brute-force search is going to be slow if there are too many items.
This brute - force search is going to be slow if there are too many items .
//If we found a hole, stick this item in it and bail