Now completely based on plain JavaScript, no JQuery, with the help of http://youmaynotneedjquery.com/
Some changes for Chrome specific behavior.