First, set document.cookie to the first parameter.

Nice, this is the name of the cookie.

Make sure to spell cname.