

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 now = new Date();
    now.setMonth(now.getMonth()+1);
   
    var c = "";
    c += this.name + "=" + escape(this.value);
    c += "; expires=" + now.toGMTString();
    if (this.path != null)
        c += "; path=" + this.path;
    if (this.domain != null)
        c += "; domain=" + this.domain;
    document.cookie = c;
}
function CookieGet(name)
{
    var cookies = document.cookie;
    var pos1 = cookies.indexOf(name + "=");
    if (pos1 == -1) return null;
    var pos2 = cookies.indexOf(";", pos1);
    if (pos2 != -1) {
        return cookies.substring(pos1 + name.length + 1, pos2);
    } else {
        return cookies.substr(pos1 + name.length + 1);
    }
}

var numbers = "0123456789";
function IsNumber(s)
{
    if (s == null) return false;
    if (s == "") return false;
    var length = s.length;
    for (var i = 0; i < length; i++) {
        if (numbers.indexOf(s.charAt(i)) == -1) return false;
    }
    return true;
}