/**
 * news component.
 *	
 */

function News($element) {
	PopularContents.baseConstructor.call(this, $element, "news"); 

	this.getContentsURL = MACEConstants.componentsURL+"news/php/get_news.php";
	this.initDOMElems();
	

	this.buildNews();
}

News.extend(Component);

News.prototype.initDOMElems = function(){
	this.$element.html('<div class="dark loadingMessage">Loading...</div>');

}

News.prototype.buildNews = function(){
	var _this = this;
	var o={};
	

  	$.getJSON(this.getContentsURL,o,function (contentsObj) {
			if(contentsObj.success==false){
				
			}
			else{
				_this.$element.empty();
				$.each(contentsObj, function(i,obj) {

					_this.$element.append(	"<li ><a href='"+obj.link+"' target='_blank'> "+obj.title+"</a><br/><div class='bodydarkbg'>"+obj.description+"</div></li>");
				//<br/><div class='bodydarkbg'>"+obj.description+"</div>
				});
			}
	});

}






