// JavaScript Document
  $(document).ready(function(){
		theRotator();							 
	//Menu desplegable
	$("#menu ul li ul").hide();	
	$("#menu ul li span.current").addClass("open").next("ul").show();
	$("#menu ul li span").click(function(){	
		$(this).next("ul").slideToggle("slow").parent("li").siblings("li").find("ul:visible").slideUp("slow");
		$("#menu ul li").find("span").removeClass("open");
		$(this).addClass("open");
	});
	
	$("a.switch_thumb").toggle(function(){
	  $(this).addClass("swap"); 
	  $("ul.display").fadeOut("fast", function() {
	  	$(this).fadeIn("fast").addClass("thumb_view"); 
		 });
	  }, function () {
      $(this).removeClass("swap");
	  $("ul.display").fadeOut("fast", function() {
	  	$(this).fadeIn("fast").removeClass("thumb_view");
		});
	}); 
 	
$('.loading2').show();
        pagina2(4,'Fecha',1);
    }); 	
          
function theRotator() {
	$('div#rotatorder ul li').css({opacity: 0.0});
	$('div#rotatorder ul li:first').css({opacity: 1.0});
	setInterval('rotate()',10000);
}
function rotate() {	
	var current = ($('div#rotatorder ul li.show')?  $('div#rotatorder ul li.show') : $('div#rotatorer ul li:first'));
	var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div#rotatorder ul li:first') :current.next()) : $('div#rotatorder ul li:first'));	
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
};		  
    function pagina2(cat,ord1,page_id){
        var first = (page_id*10)+1, second = (page_id*10)+10;
		$('#resj2').hide();
		$('.loading2').show();
        $.ajax({
        type:'GET',
        url:'lis_eventos.php',
        data:'q2=2&ord2='+ord1+'&pag='+page_id,
        success:function(msg) {
		$('.loading2').hide();
		$('#resj2').fadeIn('slow');		
			$('#resj2').html(msg);
        }
        });
    }	


$(function() {
	$(".pag").click(function() {
	var name = this.text;
	pagina2(4,name,1);
							 })
return false;
	}); 
