function NewsBlock(parentDiv, info, path, onloadfunc, showfunc, editable)
{
    this.info = info;
    this.path = path;
    this.onloadfunc = onloadfunc;
    this.showfunc = showfunc;

    this.div = dojo.create("div", {"class":"NewsBlockMessage"}, parentDiv);

    this.title = dojo.create("div", {"class":"NewsBlockMessageTitle"}, this.div);
    this.text = dojo.create("div", {"class":"NewsBlockMessageText"}, this.div);

    var This = this;

    if (editable)
    {
        this.title.innerHTML = "<dummyA><b>"+info.title+"</b></dummyA>";
        if (info.image)
        {
            this.text.innerHTML = "<dummyA><div style='float:right;wdith:5em;height:5em;'>" + 
                "<img src='"+info.image+"' style='width:5em;height:5em;'/></div>" +
                "<div style='float:right;width:14em;padding-right:0.2em'>"+info.description+"</div></dummyA>";
        }
        else
        {
            this.text.innerHTML = "<dummyA>" + info.description + "</dummyA>";
        }

        this.div.style.cursor = 'pointer';
        dojo.connect(this.div, 'onclick', function()
                {
                    This.edit();
                }
        );
    }
    else 
    {
        this.title.innerHTML = "<b>"+info.title+"</b>";
        if (info.image)
        {
            this.text.innerHTML = "<div style='float:right;wdith:5em;height:5em;'>" + 
                "<img src='"+info.image+"' style='width:5em;height:5em;'/></div>" + 
                "<div style='float:right;width:14em;padding-right:0.2em'>"+info.description+"</div>";
        }
        else
        {
            this.text.innerHTML = info.description;
        }

        this.div.style.cursor = 'pointer';
        dojo.connect(this.div, 'onclick', function()
                {
                    window.open(info.link, "_blank");
                }
        );
    }
}

NewsBlock.prototype.edit = function()
{
    var dialog = new NewsBlockInfo(this.path, this.info);
    var This = this;
    dialog.callback = function()
    {
        get(This.path, This.onloadfunc, 
                function() {
                    This.showfunc();
                    dialog.hide();
                });	
    }
}

NewsBlock.prototype.setBackground = function(bg)
{
    this.text.style.backgroundColor = bg;
}

