﻿Cookie = {

  setCookie: function (title, value)
  {
    var date = new Date();

    date.setTime(date.getTime() + (10 * 24 * 60 * 60 * 1000));  //expirace na 10dni
    var expires = "; expires=" + date.toGMTString();

    document.cookie = title + "=" + value + expires + "; path=/";
  },

  getCookie: function (title)
  {
    var cookiestring = "" + document.cookie;

    var index1 = cookiestring.indexOf(title);
    if (index1 == -1 || title == "")
      return "";

    var index2 = cookiestring.indexOf(';', index1);
    if (index2 == -1)
      index2 = cookiestring.length;

    return unescape(cookiestring.substring(index1 + title.length + 1, index2));
  },

  removeCookie: function (title)
  {
    var date = new Date();

    date.setTime(date.getTime() - (1 * 24 * 60 * 60 * 1000));  //je prosla
    var expires = "; expires=" + date.toGMTString();

    var value = '';
    document.cookie = title + "=" + value + expires + "; path=/";
  }
}