Videos = function(){
	
	var el = Ext.DomHelper.append(document.body, {tag: "div", id: "videos"}, true);
	
	var layout = new Ext.BorderLayout(el, {
		center: {
			autoScroll: true
		}
	});	
	
	var panel = layout.add("center", new Ext.ContentPanel({
		autoCreate: true/*,
		fitContainer: true,
		fitToFrame: true*/
	}));
	
	var store = new Ext.data.Store({
		proxy: new Ext.data.HttpProxy({
			url: "modulos/videos/listar.php"
		}),
		reader: new Ext.data.XmlReader({
		   record: "entry"
		}, [
		   {name: "content", type: "string"},
		   {name: "id", type: "string"},
		   {name: "link", mapping: "link/@href", type: "string"}
		])
	});
	
	var plantilla = new Ext.Template(
		'<div class="feed-item" id="{id}" style="background:url(images/background.png);">' +
		'{content}'+
		'</div>' /*+
		'<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/ogaU43ieTcA&hl=es_ES&fs=1&color1=0x006699&color2=0x54abd6"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/ogaU43ieTcA&hl=es_ES&fs=1&color1=0x006699&color2=0x54abd6" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>'*/
	);
	
	var elView = panel.getEl();
/*	elView.addClass("ychooser-view");*/
	
	var detalle = new Ext.View(elView, plantilla, {
		singleSelect: true,
		selectedClass:'selected-article',
		store: store					   
	});
	detalle.on("click", this.__abrir, this);
//	detalle.on("dblclick", this.__abrir, this);
	
	Videos.superclass.constructor.call(this, layout, {
		title: "Videos",
		closable: true,
		store: store,
		detalle: detalle
	});
	
};

Ext.extend(Videos, Ext.NestedLayoutPanel, {

	pintar: function(){
		
		this.store.load();
		
	},
	
	__abrir: function(){
	
		var index = this.detalle.getSelectedIndexes();
		
		if(index.length === 0){
			
			return;
			
		};
		
		var record = this.store.getAt(index[0]);
		
		if(!record){
			
			return;
			
		};
		
		var url = record.get("link");
		
		window.open(url);
		
	}
		   
});