var PopList = {
	initalize: function(){
		var blocks = $('blocks');
		if(blocks){
			this.items = blocks.getChildren();
			this.handles = $$('#cont li');
			this.titles = $$('#blocks h2');

			this.container = new Element('div',{'class':'hidden','id':'popList'}).inject(document.body);

			new Element('div',{'class':'top'}).inject(this.container)
			this.info = new Element('div').inject(new Element('div',{'class':'center'}).inject(this.container));
			this.title = new Element('h3').injectBefore(this.info);
			this.close = new Element('span').inject(new Element('div',{'class':'bottom'}).inject(this.container)).set('html','&nbsp;').addEvent('click',this.hide.bind(this));

			this.handles.each(function(handle,i){
				handle.addEvent('click',this.show.bind(this,[i])).setStyle('cursor','pointer');
			},this);

			this.fx = new Fx.Morph(this.container,{duration:'long'});
		}
	},

	show: function(i){
		this.title.set('html',this.titles[i].innerHTML);
		this.info.empty().adopt(this.items[i].clone().removeClass('hidden'));
		this.info.getElement('h2').dispose();
		this.container.setOpacity(0).removeClass('hidden');
		this.fx.options.transition = Fx.Transitions.Back.easeOut;
		this.fx.start({'top':[0,200],'opacity':[0,1]});
	},

	hide: function(){
		this.fx.options.transition = Fx.Transitions.Linear;
		this.fx.start({'opacity':[1,0]});
	}
};


window.addEvent('domready',function(){
	new Swiff(BASE.www+(SUI ? 'ui/'+SUI+'/' : '')+'css/'+swf,{
		width: 410,
		height: 361,
		params: {
			quality: 'high',
			wMode: 'transparent',
			scale: 'exactfit'
		}
	}).inject(new Element('div',{'id':'servicios_flash'}).injectAfter('descripcion'));
	
	PopList.initalize();
});
