﻿Type.registerNamespace("Omnet");

Omnet.NewsPanel = function(id) {

    this._objectId = id;
    this._loaded = false;
    this._panelContent = null;
    this._container= null;
    this._caller = null;

}

Omnet.NewsPanel.prototype = {

    set_panelContent : function(value)
    {
        this._panelContent = value;
        this._loaded = true;
    },
    
    get_panelContent : function(container)
    {
        this._container = container;
        if(!this._loaded)
        {
             var xml="<request>";
                xml+="<operation>GetNews</operation>";
                xml+="<content>";
                xml+="<groupid>"+this._objectId+"</groupid>";
                xml+="<Style></Style>";
                xml+="</content>";
                xml+="</request>";
            
            PostWebRequest(xml, Function.createDelegate(this,this._fillData));
        }
        else
            this._container.innerHTML =  this._panelContent;
    },
    
    get_caller: function(){
        return this._caller;
    },
    
    set_caller: function(value){
        this._caller = value;
    },
    
    _fillData : function (executor, eventArgs)
    {
        if(executor.get_responseAvailable())
        {
            this._panelContent = executor.get_responseData();
            this._loaded = true;
            this._container.innerHTML = this._panelContent;
        }
    }
}

Omnet.NewsPanel.registerClass('Omnet.NewsPanel');