POC: http://jsfiddle.net/moagrius/vftL6fvh/