/**
 * Noticia de portada
 */
function noticiaPortada(){

	this.store = new Ext.data.JsonStore({
	    url: '../portal/json/NoticiaPortada.action',
	    root: 'lista',
	    fields:[
		{name: 'titular'},
		{name: 'resumenPuntosSuspensivos'}
		]
	});
	
	this.init = function(){		
		var padre = this;
		this.store.on("load", function () {
			padre.pintar();
		});
		this.store.load();		
	}	
	
	this.pintar = function(){
		if(this.store.getCount()>0){
			var htmlTexto = '{texto}';
			var tpl = new Ext.Template(htmlTexto);
			tpl.compile();
			var textoNoticiaEl = Ext.get('textoNoticia')
			if(textoNoticiaEl){
				tpl.append(textoNoticiaEl, {texto:this.store.getAt(0).get('resumenPuntosSuspensivos')});
			}
			var tituloNoticiaEl = Ext.get('tituloNoticia')
			if(tituloNoticiaEl){
				Ext.get("tituloNoticia").dom.firstChild.nodeValue = Ext.util.Format.stripTags(this.store.getAt(0).get('titular'));	
			}
		}	
	}	
}