$(document).ready(function(){
// code here

	

	$('#menu').hover(
		function(){
			$('#menu ul#menu-menu').slideDown()
			$('#menuOpen,.currentPage#underLogo').css({visibility:'hidden'})
		},
		function(){
			$('#menu ul#menu-menu').hide()
			$('#menuOpen,.currentPage#underLogo').css({visibility:'visible'})
		}
	)
	
	$('.logoRight',this).hover(
		function(){
			$('#to_'+$(this).attr('ID')).css({visibility:'visible'})
		},
		function(){
			$('#to_'+$(this).attr('ID')).css({visibility:'hidden'})
		}
	)
	
	$('#logoRight').hover(
		function(){
			$('#messHome').hide()
			$('#to_'+$(this).attr('ID')).css({visibility:'visible'})
		},
		function(){
			$('#messHome').show()
			$('#to_'+$(this).attr('ID')).css({visibility:'hidden'})
		}
	)
	
	//Background color, mouseover and mouseout
    var colorOver = '#333';
    var colorOut = '#ccc';
 
    //Padding, mouseover
    var padLeft = '20px';
    var padRight = '20px'
     
    //Default Padding
    var defpadLeft = $('#links li a').css('paddingLeft');
    var defpadRight = $('#links li a').css('paddingRight');
         
    //Animate the LI on mouse over, mouse out
    $('#links li').click(function () {   
        //Make LI clickable
       // window.location = $(this).find('a').attr('href');
         
    }).mouseover(function (){
         
        //mouse over LI and look for A element for transition
        $(this).find('a')
        .animate( { paddingLeft: padLeft, paddingRight: padRight}, { queue:false, duration:100 } )
        .animate( { backgroundColor: colorOver }, { queue:false, duration:200 });
 
    }).mouseout(function () {
     
        //mouse oout LI and look for A element and discard the mouse over transition
        $(this).find('a')
        .animate( { paddingLeft: defpadLeft, paddingRight: defpadRight}, { queue:false, duration:100 } )
        .animate( { backgroundColor: colorOut }, { queue:false, duration:200 });
    }); 
     
    //Scroll the menu on mouse move above the #sidebar layer
    $('#sidebar').mousemove(function(e) {
 
        //Sidebar Offset, Top value
        var s_top = parseInt($('#sidebar').offset().top);       
         
        //Sidebar Offset, Bottom value
        var s_bottom = parseInt($('#sidebar').height() + s_top);
     
        //Roughly calculate the height of the menu by multiply height of a single LI with the total of LIs
        var mheight = parseInt($('#links li').height() * $('#links li').length);
     
        //I used this coordinate and offset values for debuggin
        $('#debugging_mouse_axis').html("X Axis : " + e.pageX + " | Y Axis " + e.pageY);
        $('#debugging_status').html(Math.round(((s_top - e.pageY)/100) * mheight / 2));
             
        //Calculate the top value
        //This equation is not the perfect, but it 's very close    
        var top_value = Math.round(( (s_top - e.pageY) /150) * mheight / 2)
         
        //Animate the #links by chaging the top value
        $('#links').animate({top: top_value}, { queue:false, duration:500});
    });
	
	$('#toGal').click(
		function(){
				$('#gallery').fadeIn()
				$('#ilcuoco').fadeOut()
			} 
	)
	
	$('a#terms').click(function(){
		$('#confirm').fadeIn()
	})
	
	//$('#sendit_subscribe_button').attr('disabled',true)
	
	$('#nAnnulla').click(function(){
		$('#confirm').hide()
	})
	
	$('.textLang:eq(1)').hide()
	$('#tabLang h2').click(
		function() {
			$('#tabLang h2').removeClass('att')
			$(this).addClass('att')
			$('.textLang').fadeOut(250)
			$('.'+$(this).attr('id')).delay(250).fadeIn()
		}
	)
	
	
	/*
	$('#nOk').click(function(){
		$('#sendit_subscribe_button').attr('disabled',false)
		$('#sendit_subscribe_button').removeClass('inputDisabled')
		$('#sendit_subscribe_button').css({'boxShadow':'0 0 5px #ff0000'})
		$('#confirm').hide()
	})
	
	if ($('#sendit_subscribe_button').attr('disabled',true)) {
		$('#sendit_subscribe_button').addClass('inputDisabled')
	}
	*/
}) // fine jQuery

