$(document).ready(function () {

	//salva height
	 jQuery.each($('.main-news.schedaformazione'), function(){
	 	var $altezza = $(this).outerHeight() + 100;
	 	$(this).attr('rel', $altezza +'px');
	 	var $gettt = $(this).attr('rel');	 	
	 	//alert($gettt + '/' + $altezza);
	 });

	$('.main-news.schedaformazione').css('overflow','hidden');

	$('.main-news.schedaformazione').css('height','50px');
	
	$('.open-tabs').removeAttr('href');
	$('.close-tabs').removeAttr('href');
	
	$('.open-tabs').css('display','inline');
	$('.close-tabs').css('display','none');
	
	
	$('.open-tabs').click(function() {
		$('.main-news.schedaformazione').css('height','50px');
		$('.open-tabs').css('display','inline');
		$('.close-tabs').css('display','none');
	});


	//apertura
	 jQuery.each($('.main-news.schedaformazione'), function(){
	 	var $animeto = $(this).attr('rel');
	 	$(this).find('.open-tabs').click(function() {
	 		//alert($(this).parent().parent().height());
	 		$(this).parent().parent().animate({height:$animeto},1000,function(){
	 				$(this).find('.close-tabs').css('display','inline');
					$(this).find('.open-tabs').css('display','none');
	 		});
	 	});	 	
	 });
	 
	 
	 //chiudi
	 jQuery.each($('.main-news.schedaformazione'), function(){
	 	var $animeto = '50px';
	 	$(this).find('.close-tabs').click(function() {
	 	
	 		$(this).parent().parent().animate({height:$animeto},1000,function(){
	 				$(this).find('.open-tabs').css('display','inline');
					$(this).find('.close-tabs').css('display','none');
	 		});
	 	});	 	
	 });



	
 });
 
 

