See gist 428626. Works in Firefox, Opera, and Chrome. Fails in Safari and Internet Explorer. — Mathias