$(document).ready(function(){
	
	/*$('#sponsors .row img:nth-child(1), #sponsors .row img:nth-child(2), #news div:nth-child(1), #news div:nth-child(2), #pre-footer div:nth-child(1), #pre-footer div:nth-child(2)').css('margin-right', '11px');*/
	
	$('#sponsors .row .banner:last').css('padding', '0');
	$('#news div:last-child, #pre-footer div:last-child').css('margin', '0');

	$('#slider').cycle({
		fx:     'fade',
		speed:  'slow',
		timeout: 7000,
		next:   '#nextSlide', 
    	prev:   '#prevSlide'
	});
/*	
	$('#sponsors').cycle({
		fx:     'scrollLeft',
		speed:  'slow',
		timeout: 7000
	});
*/
	(function($){
		$.fn.clearDefault = function(){
			return this.each(function(){
				var default_value = $(this).val();
				$(this).focus(function(){
					if ($(this).val() == default_value) $(this).val("");
				});
				$(this).blur(function(){
					if ($(this).val() == "") $(this).val(default_value);
				});
			});
		};
	})(jQuery);

	$('input, textarea').clearDefault();	
	
	$("#history-back").click(function () {
			history.back(-1);
			return false;
	});
	
	$('a[rel="external"]').click(function () {
		$(this).attr({'target':'_blank'});
	});
	
	var options = { 
        target:        '#message',
        resetForm: true
    }; 
    $('#forms_newsletter').ajaxForm(options);
	
	
	$('#anuals a').each(function(){
      var href = $(this).attr('href');
	  
      $(this).click(function(){  
         $('#anualcontent').hide().load(href).show(); //Le damos efecto
         $(this).attr({ href: "javascript:"});
		 $('#anuals a').removeClass('active');
		 $(this).addClass('active');
   	  });
   });
	
	$("#anualcontent").hide().load("anuario2010.php").fadeIn("slow");
	
	
	$('#rubro a').each(function(){
      var href = $(this).attr('href');
	  
      $(this).click(function(){  
         $('#rubrocontent').hide().load(href).show(); //Le damos efecto
         $(this).attr({ href: "javascript:"});
		 $('#rubro a').removeClass('active');
		 $(this).addClass('active');
   	  });
   	});
	
	/*
	$('ul.pages a.paginaseventos').each(function(){
      var href = $(this).attr('href');
	  
      $(this).click(function(){  
         $('#main-content').load(href); //Le damos efecto
         $(this).attr({ href: "javascript:"});
   	  });
   	});
	*/
});



