﻿/// <reference path="../Edentity.Global.js" />
/// <reference path="../External/jquery-1.3.2-vsdoc.js" />

Agility.RegisterNamespace("BNN.Cookie");

(function(BC, $) {

    BC.Set = function(c_name, value, expireminutes) {
        var exdate = new Date();

        if (expireminutes == undefined) {
            expireminutes = -1;
        }

        if (expireminutes == -1) {
            exdate.setMinutes(exdate.getYear() + 10);
        }
        else {
            exdate.setMinutes(exdate.getMinutes() + expireminutes);
        }

        var domain = null;
        //if (CookieDomain != undefined && CookieDomain != null) {
        //    domain = CookieDomain;
        //}

        document.cookie = c_name + "=" + escape(value) +
            ((expireminutes == null) ? "expires=Thu, 01-Jan-1970 00:00:01 GMT" : ";expires=" + exdate.toGMTString()) +
            "; path=" + escape("/") + ((domain) ? ";domain=" + domain : "");
    };

    BC.Get = function(c_name) {
        if (document.cookie.length > 0) {
            c_start = document.cookie.indexOf(c_name + "=");
            if (c_start != -1) {
                c_start = c_start + c_name.length + 1;
                c_end = document.cookie.indexOf(";", c_start);
                if (c_end == -1) {
                    c_end = document.cookie.length;
                }
                return unescape(document.cookie.substring(c_start, c_end));
            }
        }
        return "";
    };

    BC.Clear = function(cookieName) {
        BNN.Cookie.Set(cookieName, '', null);
    };
	
	BC.SetCommentAbuseCookie = function(IDs) {
		BNN.Cookie.Set("BNN.CommentAbuseCookie", IDs);
	};
	
	BC.GetCommentAbuseCookie = function() {
		return BNN.Cookie.Get("BNN.CommentAbuseCookie");
	};

})(BNN.Cookie, jQuery);

