public function Set($name, $value, $expiry = self::OneYear, $path = '/', $domain = false)
    {

        $retval = false;
        if (!headers_sent()) {

            if ($domain === false)
                $domain = $_SERVER['HTTP_HOST'];

            if ($expiry === -1)
                $expiry = 1893456000; // Lifetime = 2030-01-01 00:00:00
            elseif (is_numeric($expiry))
                $expiry += time();
            else
                $expiry = strtotime($expiry);

            //echo "$name, $value, $expiry, $path, $domain";
            $retval = setcookie($name, $value, $expiry, $path, $domain);
            if ($retval)
                $_COOKIE[$name] = $value;

        }
        return $retval;
    }