http://blogs.sitepointstatic.com/examples/tech/battery-api/index.html