HD.Content=function(A){this.model=new HD.Content.Model(A);
this.view=new HD.Content.View(this.model);
this.controller=new HD.Content.Controller(this.model,this.view);
this.model.addObserver(this.view)
};
HD.Content.prototype={addObserver:function(A){this.model.addObserver(A)
}};
HD.Content.Model=function(A){this.config=A;
this.observers=[]
};
HD.Content.Model.prototype={getContent:function(B){this.notifyObservers("getContent_Start");
var B=HD.util.Common.hasValue(B)?B:this.config.source;
var A=this;
HD.util.Common.requestContent(B,function(D){var C=HD.util.Common.hasValue(D)?"getContent_Finish":"getContent_Error";
A.notifyObservers.call(A,C,D)
})
}};
HD.extend(HD.Content.Model,[HD.util.Observable]);
HD.Content.View=function(A){this.model=A;
this.config=this.model.config;
var B=HD.get(this.config.trigger);
var C=function(){A.getContent.call(A)
};
if(this.config.onclick!=null){C=this.config.onclick
}B.onclick=C;
this.observers=[]
};
HD.Content.View.prototype={update:function(C,F){if(C=="getContent_Start"){this.loading(true)
}else{if(C=="getContent_Finish"){var G=HD.util.Common.generateElementId();
var D=['<div id="',G,'">',F,"</div>"].join("");
var E=this.getParent();
var B=this.model;
var A=this;
HD.util.DOM.onContentReady(G,function(){B.notifyObservers.call(B,"getContent_Rendered");
A.loading.call(A,false)
});
this.render(D)
}}},getHtml:function(A){return A
}};
HD.extend(HD.Content.View,[HD.Widget]);
HD.Content.Controller=function(B,A){this.model=B;
this.view=A
};
HD.Content.Controller.prototype={};
HD.register("hd_content","HD.Content",{version:"1.0",build:"1"});