$(document).ready(function(){
	//Creacion de avisos de precarga
	$('#precarga').ajaxStart(function() {
	  $(this).html("");
	  $(this).html("<img src='css/spinner.gif' >");
	}).ajaxStop(function() {
	  $(this).html("");
	});
	
	// Creacion de Tabs
	$("#botones > ul").tabs({ fx: { opacity: 'toggle' } });
	$.post("includes/todas.php", function(data){
		if(data.length >0) {			
			$('#fragmento-1').html(data);
			alterTable();
		}
	});	
	
	$('#enviarInst').click(function(){
		var valor = $("#institucion").val();
		$.post("includes/instituciones.php",{institucion: ""+valor+""}, function(data){
			if(data.length >0) {			
				$('#respuestaInst').html(data);
				alterTable();
			}
		});	
	});
	$('#enviarTem').click(function(){
		var valor = $("#tema").val();
		$.post("includes/temas.php",{tema: ""+valor+""}, function(data){
			if(data.length >0) {			
				$('#respuestaTem').html(data);
				alterTable();
			}
		});	
	});	
});


function alterTable(){
	// Lanzador de tablas cebreadas
	$("table.stripeMe tr").mouseover(function(){ $(this).addClass("over");}).mouseout(function() {$(this).removeClass("over");});
	$("table.stripeMe tr:even").addClass("alt");	
}