function Cookie(name,expires){
  this.name=name;
  this.expires=expires;
}




Cookie.prototype.getValue=function(name,default_value){
  var strCookie=document.cookie.split("; ");
  for(var i=0;i<strCookie.length;i++){
    var strPar=strCookie[i].split("=");
    if(this.name+"_"+name==strPar[0])return unescape(strPar[1]);
  };
  return default_value;
}




Cookie.prototype.setValue=function(name,value,uexpires){
  var date=new Date();
		date.setTime(date.getTime()+((uexpires?uexpires:this.expires)*24*60*60*1000));
		var expires="; expires="+date.toGMTString();
  document.cookie=this.name+"_"+name+"="+value+expires+"; path=/";
  return value;
}




Cookie.prototype.destroy=function(name){
  if(name){
    this.setValue(name,"",-1);
  }else{
    var strCookie=document.cookie.split("; ");
    for(var i=0;i<strCookie.length;i++){
      var strPar=strCookie[i].split("=");
      if(strPar[0].substring(0,this.name.length+1)==this.name+"_")this.setValue(strPar[0].substring(this.name.length+1),"",-1);
    }
  }
}




