<!--
    // This function gets things set up, creates the cookie,
    // and then moves to the next page
    //
    function StoreVisit() {
        // Set variable name
        var cookieData = "Visit";

        // If this is the users first visit
        if (cookieData != null) {

            // Use this variable to set the name of the cookie
            var cookieName = "Thurrock-DTS";

            // Use this variable to set the number of days after which the cookie will expire
            var days = 90;

            // Calculate the expiration date
            var expires = new Date ();
            expires.setTime(expires.getTime() + days * (24 * 60 * 60 * 1000)); 

            // Set the cookie
            SetCookie(cookieName, cookieData, expires);
        }

    }

    function SetCookie(cookieName, cookieData, expireDate) {
        document.cookie = cookieName + "=" + escape(cookieData) + "; expires=" + expireDate.toGMTString();
    }    

    function GetCookie(name) {
        var arg = name + "=";
        var alen = arg.length;
        var clen = document.cookie.length;
        var i = 0;
        while (i < clen) {
            var j = i + alen;
            if (document.cookie.substring(i, j) == arg)
                return GetCookieVal (j);
            i = document.cookie.indexOf(" ", i) + 1;
            if (i == 0) break; 
          }
        return null;
        }

    function GetCookieVal (offset) {
        var endstr = document.cookie.indexOf (";", offset);
        if (endstr == -1)
            endstr = document.cookie.length;
        return unescape(document.cookie.substring(offset, endstr));
        }
//-->

