$(document).ready(function(){
/*
	if(fadeOut){
		
		if(logoFadeOut)
			$('#nero').css('background-color','#000000');

		window.setTimeout(function() {
			if(logoFadeOut)
				fadeLogo();
			else
				fadeBg();
		}, 50);
	}
	else
		fadeInContent();*/
	
});

/*function SetFullScreenBG(imgPath){
	window.setTimeout(function() {
		$('body').css("background-image", "url("+imgPath+")");
	}, 500);
}*/

function fadeBg(){
	$('#neroBG').fadeOut(1000,function() {
		fadeInContent();

	  });
}

function fadeLogo(){
	$('#nero').fadeOut(1300,function() {
		fadeBg()

	  });
}

function growAndGo(url){
	$('#neroBG').css('display','inline');
	$('#neroBG').css('width','0px');
	$('#neroBG').css('background-color','#000000');
	$('#neroBG').stop().animate({width:'100%'},{queue:false, duration:900,complete:function() {
		location.replace(url);
	  	}
	});
}

function fadeInContent(){
	$('#body_cont-DX').fadeIn(700);
	
}

function subMenuSlideDown(){
	$('#subMenuUl').slideDown('slow', function() {
	    // Animation complete.
	});
}


function expand_att(elem){
	//alert('espando '+elem);
	name='#attivita_'+elem;//document.getElementById('name_'+elem);
	$(name).stop().animate({width:'1005px'},{duration:600});
	fullColor_att(elem);
}

function contract_att(elem,width){
	//alert('comprimo '+elem);
	if(width=='')
		width='50';
	
	name='#attivita_'+elem;//document.getElementById('name_'+elem);
	$(name).stop().animate({width:width+'px'},{duration:600});	
	fade_att(elem);
}

function fullColor_att(elem){
	name='#attivita_cont_'+elem;//document.getElementById('name_'+elem);
	$(name).animate({opacity: 1.0},{queue:false, duration:600});	
	
}

function fade_att(elem){
	if(opened!=elem){
		name='#attivita_cont_'+elem;//document.getElementById('name_'+elem);
		$(name).animate({opacity: 0.0},{queue:false, duration:600});
	}
	
}

function onClickAtt(id){
	if(opened==id){
		opened=0;
		width='241';
	}
	else{
		opened=id;
		width='';
	}
	for(i=0;i<numAtt;i++){
		if(att_arr[i]!=opened)
			contract_att(att_arr[i],width);
		else{
			expand_att(opened);
		}
	}
}

function expand_gallery(elem,h){
	
	name='#gallery_'+elem;
	if($(name).height()>85)
		h='85';
	$(name).stop().animate({height:h+'px'},{queue:false, duration:700});
	$('#freccia_'+elem).toggleClass('giu');
		
}

function contract_gallery(elem,height){
	
	elem=document.getElementById(elem);
	
	$(elem).stop().animate({height:'show'},{queue:false, duration:700});
	//$(name).stop().animate({opacity: 0.1},{queue:false, duration:990});
		
}



//ooooold


function expand(elem,width){
	//alert(elem.id);
	if(width=='')
		width='150';

	elem=document.getElementById(elem);
	$(elem).stop().animate({width:width+'px'},{queue:false, duration:800, easing: 'easeOutBounce'});
}

function contract(elem){
	//alert('out');
	elem=document.getElementById(elem);
	$(elem).stop().animate({width:'5px'},{queue:false, duration:800, easing: 'easeOutBounce'});
}

function expand_sub(elem){
	elem=document.getElementById(elem);
	$(elem).stop().animate({width:'10px',height:'23px'},{queue:false, duration:200});
	$(elem).css('background-color','#000000');
}

function contract_sub(elem){
	//alert('out');
	elem=document.getElementById(elem);
	$(elem).css('background-color','#cccccc');
	$(elem).stop().animate({width:'5px',height:'19px'},{queue:false, duration:200});
}

function expand_img(elem,width,showName){
	//alert(elem.id);
	name='#name_'+elem;//document.getElementById('name_'+elem);
	
	elem=document.getElementById(elem);	
	$(elem).stop().animate({width:width+'px'},{queue:false, duration:800});	
	
	if(showName){
		
		//$(name).stop().animate({opacity: 1.0}, {queue:false, duration:1000}, function() {  });
		$(name).stop(true, true).fadeIn(1000);
	}
	


	//$(name).stop().animate({opacity: 0.1},{queue:false, duration:990});
		
}

function contract_img(elem,width,hideName){
	
	name='#name_'+elem;//document.getElementById('name_'+elem);
	
	elem=document.getElementById(elem);
	$(elem).stop().animate({width:width+'px'},{queue:false, duration:800});
	
	
	if(hideName){
		
		//$(name).stop().animate({opacity: 0.0}, 1000, function() { });
		$(name).stop(true, true).fadeOut(1000);
	}
	
	
}

