
function seleccionar_materia(materia_actual, v_idmateria, v_language, v_url) {

  var mat = document.getElementById('bbdd_titulo_destacado_mat');
  var mat_izq = document.getElementById('bbdd_titulo_destacado_fondo_izq_mat');
  var mat_centro = document.getElementById('bbdd_titulo_destacado_fondo_centro_mat');
  var mat_fondo = document.getElementById('bbdd_titulo_destacado_fondo_mat');
  var mat_der = document.getElementById('bbdd_titulo_destacado_fondo_derecha_mat');

	deseleccionar_letras();
	deseleccionar_az();	
	deseleccionar_contenidos();	
  
	/*renombrar_ids_materias(); */
	deseleccionar_materias();	

	if (mat.className=='bbdd_titulo_destacado') {
		mat.className='bbdd_titulo_seleccionado';
		mat_izq.className='bbdd_titulo_seleccionado_fondo_izq';
		mat_centro.className='bbdd_titulo_seleccionado_fondo_centro';
		mat_fondo.className='bbdd_titulo_seleccionado_fondo';
		mat_der.className='bbdd_titulo_seleccionado_fondo_derecha';
	} 
	if (materia_actual.className.indexOf('bbdd_materia_apagada')!= -1) {
		materia_actual.style.color='';	
		materia_actual.className='bbdd_materia_seleccionada';
	}	
	
	$.get("/app/webinstitucional2010.biblioteca2010_busc_recursos.resultado_materia?p_materia="+v_idmateria+"&p_language="+v_language+"&p_url="+v_url, function(data) {
  
	x=$("#results_materia");

	/*x.hide().html(data).slideDown('slow');*/
	
	x.hide().html(data).fadeIn('slow');
	});	
}

function deseleccionar_materias() {

  var mat = document.getElementById('bbdd_titulo_destacado_mat');
  var mat_izq = document.getElementById('bbdd_titulo_destacado_fondo_izq_mat');
  var mat_centro = document.getElementById('bbdd_titulo_destacado_fondo_centro_mat');
  var mat_fondo = document.getElementById('bbdd_titulo_destacado_fondo_mat');
  var mat_der = document.getElementById('bbdd_titulo_destacado_fondo_derecha_mat');
  
	if (mat.className=='bbdd_titulo_seleccionado') {
		mat.className='bbdd_titulo_destacado';
		mat_izq.className='bbdd_titulo_destacado_fondo_izq';
		mat_centro.className='bbdd_titulo_destacado_fondo_centro';
		mat_fondo.className='bbdd_titulo_destacado_fondo';
		mat_der.className='bbdd_titulo_destacado_fondo_derecha';
	} 
	
  var v_span = document.getElementsByTagName("span");
  var act;
  var j = 0;
  var i = 0;
	
	while (i < v_span.length){
		act = v_span[i];
			if (act.className.indexOf('bbdd_materia_seleccionada')!= -1) {	 
				act.className='bbdd_materia_apagada';
			}
		i++;
	} 

	/*Eliminamos todo el contenedor de resultados (sólo podrá haber uno abierto cada vez)*/
	x=$(".bbdd_resultados_conte");

	/*x.slideUp('slow', function () {
	  x.remove();
	});*/
	
	x.fadeOut('slow', function () {
	  x.remove();
	});
	
	x.remove();
		
}
