Change your 'if statement' in the checkCookie()
function from this
if (cookieValue==null || cookieValue=="")
To this
if (!cookieValue || cookieValue==null || cookieValue=="")
This will check to see if the cookie exists, not just check the value.