My ICO cookies.js script, originally written in May 2011 in Google Code, ported here.