
        function setCookie (name, value, expires, path) {
          var cookie = name + '=' + value + ';';
          if (expires) {
            var h = new Date ();
            h.setTime (h.getTime () + expires * 24 * 60 * 60 * 1000);
            cookie += 'expires=' + h.toGMTString() + ';';
          }
          if (path) {
            cookie += 'path=' + path + ';';
          }
          document.cookie = cookie;
//          window.status = cookie;
          return true;
        }

        function getCookie (name, def) {
          found = document.cookie;
          var found = def ? def : false;
          var pars = document.cookie.split (/; */);
          for (var i = 0; i < pars.length; i++) {
//            alert ('x' + pars [i] + ' ' + pars [i].indexOf (name + '='));
            if (pars [i].indexOf (name + '=') == 0) {
              found = pars [i].split ('=');
              found = found [1];
              break;
            }
          }
//          alert ('GetCookie ' + name+ ': ' + found);
          return found;
        }


