var Download = {
	setupFileSystem: function(){
		$('ajahResponseContainer').select('a.filesGroup').each(function(element){
			element.observe('click', function(event){
				$('otcoverlayer').show();
				var fileSystemContainer = element.up().next('div.fileSystem');
				Utils.showSimpleWindow('otpopup','otpopupcontent', fileSystemContainer, true);
				$('documentoTitle').update(element.innerHTML);
				OT_Position.center($('otpopup'));
				Download.setupShowFiles(fileSystemContainer);
			});
		});
	},
	
	setupShowFiles: function(fileSystemContainer){
		$('otpopup').down('div.folders').select('a.categoria').each(function(categoriaElement, index){
			categoriaElement.observe('click', function(event){
				categoriaElement.up('div.folders').select('a.categoria').invoke('removeClassName', 'active');
				categoriaElement.addClassName('active');
				$('filesListContainer').update(categoriaElement.next('div.files').innerHTML);
			});
			
			if(index == 0){
				categoriaElement.addClassName('active');
				$('filesListContainer').update(categoriaElement.next('div.files').innerHTML);
			}
			
		});
	}
};