/* Author: 
	cordigitale / grafica e comunicazione
	www.cordigitale.it
*/

$(document).ready(function(){
	
	
	/*COMPONE LA HOME*/
	if($('body#home').length>0) {
		$('#container').delay( 400 ).fadeIn(600)

		$('#menuSx').hide()
		$('#menuSx').delay( 800 ).fadeIn(500);

		$('#logo').hide()
		$('#logo').delay( 1500 ).fadeIn(400);

		$('#dx h1').hide()
		$('#dx h1').delay( 2100 ).fadeIn(500);

		$('#menuSx ul').hide()
		$('#menuSx ul').delay( 2800 ).fadeIn(600);
	
		$('#dx li.menu').each(function(idx){
			$(this).hide();
			$(this).delay( 3600 + (idx * 150) ).fadeIn(240, function(){
				//action complete
			});
		});
		
		$('#formica').hide()
		$('#formica').delay( 4000 ).fadeIn();
	}
	
	
	
	/*ESTRAE E RIPONE I SUBMENU*/
	$('#dx li.menu').hover(function(){
		$(this).find('li').each(function(idx) {
    		$(this).delay( idx * 70 ).animate({
    			bottom: '+=22'
  			}, 150, function() {
    			// Animation complete.
  			});
		});
		},function(){
		$(this).find('li').each(function(idx) {
			$(this).delay( idx * 60 ).animate({
				bottom: '-=22'
			}, 140, function() {
				$(this).css('bottom','0px'); // Animation complete.
  			});
		});
	});
	
	
	/* ATTIVA LO SLIDER */
	if($('#slider').length>0) {
		$('#slider').nivoSlider({
			effect:'fade',
			directionNav:false,
			controlNav:false
		});
	}
	
	/* COLORA LA SCROLLBAR */
	if($('.scroll-pane').length>0) {
		$('.scroll-pane').jScrollPane({
			showArrows:true
		});
	}
});
