function random( min, max ){
	return Math.floor(min + Math.random() * (max - min + 1));
};

$(document).ready(function() {

	$("body").delegate("a.fancy", "mousedown", function(){
      	$("a.fancy").fancybox();
    });
    
    $('ul.attivita li').click(function(){
					$('ul.attivita li ul:visible').hide('slow');
					$('ul',this).show('slow');
	});
	
	$("a.nav_portfolio").click(function(){
					$("#mostralavoro").html(" ");
					$("a.nav_portfolio").hide('slow');
					$('div.nav_portfolio').show('slow');
										
	});
	
	setInterval(function(){
		var estrai= random(minx,maxx);
		var estrai2= random(miny,maxy)
		$('div.logo1').animate({left:estrai,top:estrai2},9000);
		}, 2000);

	setInterval(function(){
		var estrai= random(minx,maxx);
		var estrai2= random(miny,maxy)
		$('div.logo2').animate({left:estrai,top:estrai2},9000);
		}, 2000);
	

	setInterval(function(){
		var estrai= random(minx,maxx);
		var estrai2= random(miny,maxy)
		$('div.logo3').animate({left:estrai,top:estrai2},9000);
		}, 2000);
		
	setInterval(function(){
		var estrai= random(minx,maxx);
		var estrai2= random(miny,maxy)
		$('div.logo4').animate({left:estrai,top:estrai2},9000);
		}, 2000);
	
	setInterval(function(){
		var estrai= random(minx,maxx);
		var estrai2= random(miny,maxy)
		$('div.logo5').animate({left:estrai,top:estrai2},9000);
		}, 2000);
		
	setInterval(function(){
		var estrai= random(minx,maxx);
		var estrai2= random(miny,maxy)
		$('div.logo6').animate({left:estrai,top:estrai2},9000);
		}, 2000);
	
	setInterval(function(){
		var estrai= random(minx,maxx);
		var estrai2= random(miny,maxy)
		$('div.logo7').animate({left:estrai,top:estrai2},9000);
		}, 2000);
		
	setInterval(function(){
		var estrai= random(minx,maxx);
		var estrai2= random(miny,maxy)
		$('div.logo8').animate({left:estrai,top:estrai2},9000);
		}, 2000);
		
	setInterval(function(){
		var estrai= random(minx,maxx);
		var estrai2= random(miny,maxy)
		$('div.logo9').animate({left:estrai,top:estrai2},9000);
		}, 2000);
		
	setInterval(function(){
		var estrai= random(minx,maxx);
		var estrai2= random(miny,maxy)
		$('div.logo10').animate({left:estrai,top:estrai2},9000);
		}, 2000);
		
	setInterval(function(){
		var estrai= random(minx,maxx);
		var estrai2= random(miny,maxy)
		$('div.logo11').animate({left:estrai,top:estrai2},9000);
		}, 2000);
		
	setInterval(function(){
		var estrai= random(minx,maxx);
		var estrai2= random(miny,maxy)
		$('div.logo12').animate({left:estrai,top:estrai2},9000);
		}, 2000);
		
	setInterval(function(){
		var estrai= random(minx,maxx);
		var estrai2= random(miny,maxy)
		$('div.logo13').animate({left:estrai,top:estrai2},9000);
		}, 2000);
		
	setInterval(function(){
		var estrai= random(minx,maxx);
		var estrai2= random(miny,maxy)
		$('div.logo14').animate({left:estrai,top:estrai2},9000);
		}, 2000);
		
	setInterval(function(){
		var estrai= random(minx,maxx);
		var estrai2= random(miny,maxy)
		$('div.logo15').animate({left:estrai,top:estrai2},9000);
		}, 2000);
	
	
	
			
      $('div.logo1').hover(
      	function() {$('div.logo1>div.titolomobile').fadeIn('slow');},
      	function() {$('div.logo1>div.titolomobile').fadeOut('slow');}
      );
      $('div.logo2').hover(
      	function() {$('div.logo2>div.titolomobile').fadeIn('slow');},
      	function() {$('div.logo2>div.titolomobile').fadeOut('slow');}
      );
      $('div.logo3').hover(
      	function() {$('div.logo3>div.titolomobile').fadeIn('slow');},
      	function() {$('div.logo3>div.titolomobile').fadeOut('slow');}
      );
      $('div.logo4').hover(
      	function() {$('div.logo4>div.titolomobile').fadeIn('slow');},
      	function() {$('div.logo4>div.titolomobile').fadeOut('slow');}
      );
      $('div.logo5').hover(
      	function() {$('div.logo5>div.titolomobile').fadeIn('slow');},
      	function() {$('div.logo5>div.titolomobile').fadeOut('slow');}
      );
      $('div.logo6').hover(
      	function() {$('div.logo6>div.titolomobile').fadeIn('slow');},
      	function() {$('div.logo6>div.titolomobile').fadeOut('slow');}
      );
      $('div.logo7').hover(
      	function() {$('div.logo7>div.titolomobile').fadeIn('slow');},
      	function() {$('div.logo7>div.titolomobile').fadeOut('slow');}
      );
      $('div.logo8').hover(
      	function() {$('div.logo8>div.titolomobile').fadeIn('slow');},
      	function() {$('div.logo8>div.titolomobile').fadeOut('slow');}
      );
      $('div.logo9').hover(
      	function() {$('div.logo9>div.titolomobile').fadeIn('slow');},
      	function() {$('div.logo9>div.titolomobile').fadeOut('slow');}
      );
      $('div.logo10').hover(
      	function() {$('div.logo10>div.titolomobile').fadeIn('slow');},
      	function() {$('div.logo10>div.titolomobile').fadeOut('slow');}
      );
      $('div.logo11').hover(
      	function() {$('div.logo11>div.titolomobile').fadeIn('slow');},
      	function() {$('div.logo11>div.titolomobile').fadeOut('slow');}
      );
      $('div.logo12').hover(
      	function() {$('div.logo12>div.titolomobile').fadeIn('slow');},
      	function() {$('div.logo12>div.titolomobile').fadeOut('slow');}
      );
      $('div.logo13').hover(
      	function() {$('div.logo13>div.titolomobile').fadeIn('slow');},
      	function() {$('div.logo13>div.titolomobile').fadeOut('slow');}
      );
      $('div.logo14').hover(
      	function() {$('div.logo14>div.titolomobile').fadeIn('slow');},
      	function() {$('div.logo14>div.titolomobile').fadeOut('slow');}
      );
      $('div.logo15').hover(
      	function() {$('div.logo15>div.titolomobile').fadeIn('slow');},
      	function() {$('div.logo15>div.titolomobile').fadeOut('slow');}
      );
      
      document.getElementById('barrafooter').style.backgroundColor = colore ;
      
      $("h3.comunicazione").click(function() {
					$("#comunicazione").show('slow');
					$("#eventi").hide('slow');
					$("#pr").hide('slow');
					$("#mostralavoro").html(" ");
				});
				
	$("h3.eventi").click(function() {
					$("#eventi").show('slow');
					$("#comunicazione").hide('slow');
					$("#pr").hide('slow');
					$("#mostralavoro").html(" ");
				});
				
	$("h3.pr").click(function() {
					$("#comunicazione").hide('slow');
					$("#eventi").hide('slow');
					$("#pr").show('slow');
					$("#mostralavoro").html(" ");
				});
	
				
});

