Storing checkbox Cookie

hi,
I have a little problem here. I know how to create cookies etc… I’ve got to the point where the checkbox is stored in a cookie. But how can i make it so that when the checkbox is checked and the person leaves the page, when they come back i need the checkbox to still be checked(ticked) instead of blank (the checkbox being ticked will run a function to do something else…).

do i need an if statement? how would i do this? is this right?
if(cookie is set){
make the checkbox checked
}

Thanks for any help

A simple if statement should work fine

http://www.quirksmode.org/js/cookies.html

myForm.myCheckbox.checked = !!readCookie( 'myCookie' );