why doesnt this javascript cookie code work?
    <script>
    var username=getCookie("username");if(username!=null&&username!=""){}else{username=confirm("Save Password?");if(username!=null&&username!=""){setCookie("username",username);}}
    var today=new Date();today.setTime(today.getTime());var expires=5*60*1000*60;var today=new Date(today.getTime()+(expires));document.cookie=c_name+"="+value+";expires="+today.toGMTString();}
    function getCookie(c_name){var i,x,y,ARRcookies=document.cookie.split(";");for(i=0;i<ARRcookies.length;i++){x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);x=x.replace(/^\s+|\s+$/g,"");if(x==c_name){return unescape(y);}}}
    function unsetCookie(c_name,value){var today=new Date();today.setTime(today.getTime());var expires=0;var today=new Date(today.getTime()+(expires));document.cookie=c_name+"="+value+";expires="+today.toGMTString();setTimeout("window.top.location.reload();",0);}
    function uncheckCookie(){var username=getCookie("username");if(username!=null&&username!=""){var username=true;unsetCookie("username",username);}else{setTimeout("window.top.location.reload();",0);}}
    </script>

    <BODY onLoad="javascript:checkCookie();">foo</body>

This function just doesnt work after i take it out of a separate js file..
why is that??  i cant find any logical explanation

When it is on a separated js file it pops up a confirm messege box, and if value= true it sets cookie if not it doesnt.. An if the uncheck cookie function is used the cookie is set to expire imidiatly.
why doesnt this javascript cookie code work?
===

    <script>
    var username=getCookie("username");if(username!=null&&username!=""){}else{username=confirm("Save Password?");if(username!=null&&username!=""){setCookie("username",username);}}
    var today=new Date();today.setTime(today.getTime());var expires=5*60*1000*60;var today=new Date(today.getTime()+(expires));document.cookie=c_name+"="+value+";expires="+today.toGMTString();}
    function getCookie(c_name){var i,x,y,ARRcookies=document.cookie.split(";");for(i=0;i<ARRcookies.length;i++){x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);x=x.replace(/^\s+|\s+$/g,"");if(x==c_name){return unescape(y);}}}
    function unsetCookie(c_name,value){var today=new Date();today.setTime(today.getTime());var expires=0;var today=new Date(today.getTime()+(expires));document.cookie=c_name+"="+value+";expires="+today.toGMTString();setTimeout("window.top.location.reload();",0);}
    function uncheckCookie(){var username=getCookie("username");if(username!=null&&username!=""){var username=true;unsetCookie("username",username);}else{setTimeout("window.top.location.reload();",0);}}
    </script>

    <BODY onLoad="javascript:checkCookie();">foo</body>

This function just doesnt work after i take it out of a separate js file..
why is that??  i cant find any logical explanation

When it is on a separated js file it pops up a confirm messege box, and if value= true it sets cookie if not it doesnt.. An if the uncheck cookie function is used the cookie is set to expire imidiatly.