ddocument.cookie = "score=" + lvl + expires + "; path=/";
One d too much in document. Is that typo also in your real code?
When I might suggest an alternative solution: Why don't you use HTML5 localStorage? As long as you don't have any server-sided programming which needs persistent data, it's a much superior solutionit's a much superior solution.
When you already require that the users browser supports canvas you don't have to worry about browser support for localStorage. Almost every browser which supports canvas also supports localstorage.