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