function cookie(name) {

  this.name=name;
  this.lebensdauer=1000*60*60*24*365; //1 Jahr 

  this.set=function(wert) {
    var jetzt, verfall
    jetzt = new Date();
    verfall = new Date(jetzt.getTime() + this.lebensdauer);
    document.cookie = this.name+"="+wert+"; expires="+verfall.toGMTString()+";";
    }

  this.get=function() {
    var cookie, wert, pos, endpos;
    wert="";
    if(cookie = document.cookie) {
      if ((pos = cookie.indexOf(this.name+"="))!=-1) {
        cookie=cookie.substring(pos+this.name.length+1,cookie.length);  //rest ab "name="
        endpos=(cookie.indexOf(";")==-1)?cookie.length:cookie.indexOf(";"); //bis zum nächsten ";" oder stringende
        wert = cookie.substring(0,endpos);
        }
      }
    return(wert);
    }
    
  this.del=function() {
    var jetzt, verfall
    jetzt = new Date();
    verfall = new Date(jetzt.getTime());
    document.cookie = this.name+"=; expires="+verfall.toGMTString()+";";
    }
    
  }