I am attempting to use the CookieProvider for storing values of input fields for a login script.

Login Task
- if [ ] is checked keep the username state until it is unchecked.
- if [ ] is uncheck remove the username cookie

Code:
	//////////////////////////////////////////////////////////
	// Load Cookie for Username and move focus to password
	//////////////////////////////////////////////////////////
	var cp = new YAHOO.ext.state.CookieProvider();
	document.loginForm.userName.value = cp.get("userName","");
	if (document.loginForm.userName.value != "") {
		setTimeout("document.loginForm.userPass.focus()",50);
		document.loginForm.userRemember.checked = true;
	}
	/////////////////////////////////////////////
Code:
	var cp = new YAHOO.ext.state.CookieProvider();
	if (document.loginForm.userRemember.checked) {
	 	cp.set("userName",document.loginForm.userName.value);
	} else {
		cp.set("userName","");
	}
The PROBLEM is the cookie is never getting deleted. I looked at the clear command and it does not seem to do a specific delete.

I think that there should be a "remove" or "erase" which takes a specific "name" to set that cookie with a expire time less then now. Or it could be possible to have the set function take a additional unique expire date.

Or am I completly using this wrong and stick with the basic document.cookie to do these kind of things.