/**
 * Cookie manager
 *
 * @author Honza
 * @version 1.0
 */
Cookie = {

  DEFAULT_EXPIRATION : 30758400000,

  /**
   * Set cookie
   *
   * @param string name Name of the cookie
   * @param string value Value of the cookie
   * @param int expiration Expiration of the cookie in second
   */
  set : function (name, value, expiration){
    if(!expiration)
      expiration = Cookie.DEFAULT_EXPIRATION;

    var date = new Date();
    date.setTime(date.getTime()+expiration);
    cookie =name + "=" + value + "; expires="+date.toGMTString()+"; path=/";
    document.cookie = cookie;
  },

  /**
   * Get cookie
   *
   * @param string name Name of the cookie
   * @return string Value of the cookie
   */
  get : function (name){
    aCookie = document.cookie.split("; ");
    for (i=0; i < aCookie.length; i++)
    {
      var aCrumb = aCookie[i].split("=");
      if (name == aCrumb[0])
        return aCrumb[1];
    }
    return false;
  }
}
