// JavaScript 
$(function(){
/*
	//form
	$('.toggleForm').hide();
	$(".toggleSegue").click(
	function(){
		if($('.toggleForm').is(":hidden")) {
		  $('.toggleForm').slideDown("slow");		
		}else{
		  $('.toggleForm').slideUp("slow");	
		}
	})
			
	$(".toggleClose").click(
		function(){
		$('.toggleForm').slideUp("slow");
	})
*/



	//pagine
	$('.toggleDiv').each(function(){
		$(this).prev('.toggleClose').hide();//nascondo il bottone di chiusura
		$(this).hide();// e il div con il testo in pił
	});
	
	$('.toggleSegue').click(
			function(){
				if($(this).next().next('.toggleDiv').is(":hidden")) {
					$(this).next().next('.toggleDiv').slideToggle('fast');	
					$(this).hide();	
					$(this).next('.toggleClose').show();			
				}
		})

	$('.toggleClose').click(
			function(){
				if($(this).next('.toggleDiv').not(":hidden")) {
					$(this).next('.toggleDiv').slideToggle('fast');	
					$(this).hide();	
					$(this).prev('.toggleSegue').show();			
				}
		})



	//form
	$('.toggleDivForm').each(function(){
		$(this).hide();
		$(this).prev('.toggleSegueForm').click(
			function(){
				if($(this).next('.toggleDivForm').is(":hidden")) {
				  $(this).next('.toggleDivForm').slideToggle('fast');	
				}else{
				 $(this).next('.toggleDivForm').slideToggle('fast');
				}
		})
		
				
		$(this).children('.toggleCloseForm').click(
			function(){
				$(this).parent('.toggleDivForm').slideToggle('fast');
			});
		});

})


