I am trying to save cookies in JavaScript and then display them on the page again but for some reason my setCookies function and displayCookies function is not working properly.. I want it to also expire after 1 week.  It is coming from a form and when I put it in Web Developer in FireFox it says Reference Error setCookies and displayCookies is not defined.  My jsfiddle is : http://jsfiddle.net/FmXJW/
    function setCookies()
    {
        // this function will set cookies for each field in the reservation form, and set them to expire after one day
        var Name = document.forms[0].txtName.value;
        var Address = document.forms[0].txtAddress.value;
        var City = document.forms[0].txtCity.value;
        var State = document.forms[0].txtState.value;
        var Zip = document.forms[0].txtZip.value;
        var Email = document.forms[0].txtEmail.value;
        var CarType = document.forms[0].txtCarType.value;
        var PickupDate = document.forms[0].txtPickupDate.value;
        var ReturnDate = document.forms[0].txtReturnDate.value;
        var myDate = newDate();
        myDate.setDate(myDate.getDate() + 7);
        document.cookie = "name=" + encodeURIComponent(Name) + "; expires=" + myDate.toUTCString();
        document.cookie = "address=" + encodeURIComponent(Address) + "; expires=" + myDate.toUTCString();
        document.cookie = "city=" + encodeURIComponent(City) + "; expires=" + myDate.toUTCString();
        document.cookie = "state=" + encodeURIComponent(State) + "; expires=" + myDate.toUTCString();
        document.cookie = "zip=" + encodeURIComponent(Zip) + "; expires=" + myDate.toUTCString();
        document.cookie = "email=" + encodeURIComponent(Email) + "; expires=" + myDate.toUTCString();
        document.cookie = "carType=" + encodeURIComponent(CarType) + "; expires=" + myDate.toUTCString();
        document.cookie = "pickupDate=" + encodeURIComponent(PickupDate) + "; expires=" + myDate.toUTCString();
        document.cookie = "returnDate=" + encodeURIComponent(ReturnDate) + "; expires=" + myDate.toUTCString();
        window.alert ("Your reservation has been saved.");
    } // end function setCookies()
    function displayCookies()
    {
        // this function will read the saved cookies, and repopulate the form with the cookie values
        var cookieString = decodeURIComponent(document.cookie);
        var cookieArray = cookieString.split("; ");
        if (document.cookie == 0)
        {
            alert("You have not made a reservation");
        }
        else
        {
            // retrieve each cookie, and display the cookie value in the appropriate form field
        document.forms[0].txtName.value = cookieArray[0].lastIndexOf("=") + 1);
        document.forms[0].txtAddress.value = cookieArray[1].lastIndexOf("=") + 1);
        document.forms[0].txtCity.value = cookieArray[2].lastIndexOf("=") + 1);
        document.forms[0].txtState.value = cookieArray[3].lastIndexOf("=") + 1);
        document.forms[0].txtZip.value = cookieArray[4].lastIndexOf("=") + 1);
        document.forms[0].txtEmail.value = cookieArray[5].lastIndexOf("=") + 1);
        document.forms[0].txtCarType.value = cookieArray[6].lastIndexOf("=") + 1);
        document.forms[0].txtPickupDate.value = cookieArray[7].lastIndexOf("=") + 1);
        document.forms[0].txtReturnDate.value = cookieArray[8].lastIndexOf("=") + 1);
        }
    } // end function displayCookies()
 
    