var domain = window.location.host.substr(window.location.host.lastIndexOf(".", window.location.host.lastIndexOf(".")-1));
function Cookie(name, value)
{
  this.name = name;
  this.value = value;
  this.path = "/";
  this.domain = domain;
  this.CookieSet = CookieSet;
  return this;
}
function CookieSet()
{
  var c = "";
  c += this.name + "=" + escape(this.value);
  if (this.expires != null) {
    c += "; expires=" + this.expires.toGMTString();
  } else {
    c += "; expires=" + (new Date("2010", "0", "1")).toGMTString();	
  }	
  if (this.path != null)  
    c += "; path=" + this.path;
  if (this.domain != null)  
    c += "; domain=" + this.domain;
  document.cookie = c;
}
function CookieDelete(name)
{
    var c = "";
    c += name + "=";
    c += "; path=/";
    c += "; domain=" + domain;
    c += "; expires=" + new Date(1970, 1, 1, 0, 0, 0).toGMTString();
    document.cookie = c;
}