function Cookie(cname) {
  this.name = cname;
  this.value = '';
  this.days = '';  //In Days
  this.build = createCookie;
  this.reader = readCookie;
  this.remove = deleteCookie;

  function createCookie() {
    if (this.days) {
      var date = new Date();
      date.setTime(date.getTime()+(this.days*24*60*60*1000));
      var expire = "; expires="+date.toGMTString();
      }
    else {
     var expire = '';
    }
    document.cookie = this.name+"="+this.value+expire+"; path=/";
  }

  function readCookie() {
    var ca = document.cookie.split(';');
    var nameEQ = this.name + "=";
    for(var i=0; i < ca.length; i++) {
      var c = ca[i];
      while (c.charAt(0)==' ') c = c.substring(1, c.length); //delete spaces
      if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
      }
    return null;
  }

  function deleteCookie(name) {
    createCookie(this.name, "", -1);
  }
}
 


