A javascript binary tree based algorithm for 2d bin-packing suitable for generating CSS sprites