function AdReport(button, baseUrl) {
    this.button = button;
    this.baseUrl = baseUrl;
    this.content = null;
    this.init();
}

AdReport.prototype = {
    init: function() {
        var top = 0, left = 0;
        var obj = this.button;

        if (obj.offsetParent) {
            do {
                top += obj.offsetTop;
                left += obj.offsetLeft;
            }
            while ((obj = obj.offsetParent));
        }

        var div = document.createElement('div');
        div.style.position = 'absolute';
        div.style.top = Number(top + this.button.offsetHeight) + 'px';
        div.style.left = left + 'px';
        div.style.display = 'none';
        div.style.background = '#dfdfdf';
        div.style.border = '#000 solid 1px';
        div.style.padding = '3px';
        div.style.width = '150px';
        div.style.textAlign = 'left';
        div.innerHTML = '- <a href="javascript:void(0);" onclick="self.location.href=\'' + this.baseUrl + '/type/1\';" rel="nofollow">Spam</a><br />';
        div.innerHTML += '- <a href="javascript:void(0);" onclick="self.location.href=\'' + this.baseUrl + '/type/2\';" rel="nofollow">Thông tin không đúng</a><br />';
        div.innerHTML += '- <a href="javascript:void(0);" onclick="self.location.href=\'' + this.baseUrl + '/type/3\';" rel="nofollow">Bán hàng đa cấp</a><br />';
        document.body.appendChild(div);
        this.content = div;
        var instance = this;
        this.button.onclick = function() {
            instance.toggle();
        };
    },

    toggle: function () {
        var display = this.content.style.display;
        this.content.style.display = '' == display ? 'none' : '';
    }
};
