$(document).ready(function(){

    // this is just to center the options,
    // I fix the size according the options number
    $('.inner').find('ul').each(function(){
        var liCount=$(this).find('li').size();
        //var ulsize=liCount*137;
		var ulsize=liCount*65; // dimensione pixel dedicata ad una stufa + la distanza che le separa
        $(this).css('width',ulsize);
    })

    // All animations are here, this include the arrow
    // and the options move.

    $('.menu').find('a').bind('click',function(){
        var position=$('.menu').find('a').index(this);
        var pos=position*960;
        var iconsMove='left';
        if (pos>position)
            {
                iconsMove='right';
            }

        $('.window').animate({'scrollLeft' : pos},1000,'easeInExpo',function(){
                var effect=55; // dimensione pixel dedicata ad una stufa 
                if (iconsMove=='left'){
                    effect=effect*(-1);
                }
                $('.submenu').find('a').animate({'margin-left':effect},100,'easeInOutCirc').animate({'margin-left':0},200,'easeOutBounce');
        });
        var linkPos=$(this).position();
        var left=linkPos.left;
        var siz= $(this).width();
        left=left + (siz/2) -5;
        $('.active').animate({'left' : left});
        $('.menu').find('a').removeClass('menu-active');
        $(this).addClass('menu-active');
    })
	
	
	
	
	
	
	
	//Serve per la Mappa Sito
	$('#' + variabile).click();
	


	

})

