		// loading
		function home_loading()
		{
			// check browser support for opacity
			if(jQuery.support.opacity)
			{
				$('#slides .home_slides_container').animate({opacity:1},750);
				$('#slides .home_slides_pagination').animate({opacity:1,bottom:20},1000);
			}
			else
			{
				$('#slides .home_slides_container').fadeTo(1,1).animate({opacity:1}).show();
				$('#slides .home_slides_pagination').fadeTo(1,1).animate({bottom:20});		
			}
		}

		$(function(){
			$('#slides').slides(
			{
				preload: true,
				generateNextPrev: false,
				generatePagination: false,
				effect: 'slide',
				crossfade: true,
				play: 3500,
				slideSpeed: 750,
				generatePagination: false,
				container: 'home_slides_container',
				paginationClass: 'home_slides_pagination'
			});

			// slider e slideshow news			
			$('#cycle').slides(
			{
				preload: true,
				generateNextPrev: false,
				generatePagination: false,
				effect: 'fade',
				crossfade: true,
				play: 3500,
				slideSpeed: 750,
				generatePagination: false,
				container: 'article_slides_container',
				paginationClass: 'article_slides_pagination'
			});
			$("#cycle div.article_slides_container a").fancybox({
				'titleShow' : false
			});
			
			// slider e slideshow news			
			$('#cycle_list').slides(
			{
				preload: true,
				generateNextPrev: false,
				generatePagination: false,
				effect: 'fade',
				crossfade: true,
				play: 3500,
				slideSpeed: 750,
				generatePagination: false,
				container: 'article_slides_container',
				paginationClass: 'article_slides_pagination'
			});

			
			
			// boxes
			$('#slides ul.home_slides_pagination li div.container').each(function(i)
			{
				// elimino il link presente (a.destination)
				// ed il suo indirizzo lo applico al click di tutto il box
				var href = $(this).css('cursor','pointer')
				.find('a.destination').hide().attr('href');
				$(this).click(function()
				{
					window.location = href;
				});
				
				// calcolo l'altezza iniziale per ripristinarla quando i boxes cambiano dimensione
				var element_height = $(this).css('height');

				// hovering dei boxes				
				$(this).mouseenter(
					function(e)
					{
						$(this).stop().animate({height: 100},150).addClass('current')
						.find('.hide').fadeIn(50);
					}
				);
				$(this).mouseleave(
					function(e)
					{
						$(this).stop().animate({height: element_height},200).removeClass('current')
						.find('.hide').fadeOut(50);
					}
				);
			});
			
			// news
			$('#bd div.main h1 a').each(function()
			{
				var link = $(this).attr('href');

				$(this).closest('div.container')
				.click(function()
				{
					window.location = link;
				})
				.css('cursor','pointer')
				.hover(function()
					{
						$(this).css('background','#fafafa');
					},function()
					{
						$(this).css('background','#fff');
					}
				);
				
				// elimino l'a
				$(this).replaceWith($(this).html());
			});

			var home_loading = setTimeout('home_loading()',750);
			
		// UNIFORM
		$("select, input:text, input:checkbox, textarea, input:password, input:file, select, input:submit").uniform();

		// informativa
		var submit = $('#informativa').closest('form').find('input[type=submit]');
		$(submit).attr('disabled',true);
		$.uniform.update(submit);
		$('#informativa').change(function()
		{
			var submit = $(this).closest('form').find('input[type=submit]');
			var status = $(submit).attr('disabled') ? true : false;
			
			if(status)
			{
				$(submit).attr('disabled',false);
			}
			else
			{
				$(submit).attr('disabled',true);
			}
			
			$.uniform.update(submit);
		});
		
		// FAQ BOX, ovvero tutti i box con accordion
		$('.faq_box')
		.each(function(){
			$(this).find('.faq_content').hide();
			$(this).find('.faq_title').click(function() {

				// chiudo tutti, tranne il corrente se è se stesso
				$('.faq_content').not($(this).closest('.faq_container').find('.faq_content')).slideUp()
				.closest('.faq_box').addClass('unactive').removeClass('active');
				
				// apro quello selezionato
			  $(this).closest('.faq_container').find('.faq_content').slideToggle()
			  .closest('.faq_box').addClass('active').removeClass('unactive');
			});
		});
		// chi apro per primo?
			$('.faq_content:first').show()
			.closest('.faq_box').addClass('active');

});
