$(document).ready(function(){
    var tm;
    var tm2;
    var nw;
	/* network */
	function esciNet(){
		$('#network').css({display:"none"});
    }
	$('#net').hover(
        function()
        { 
            clearTimeout(nw);
			$('#network').css({display:"block"});
        }, function()
        {
			nw = setTimeout(esciNet, 1000);
    	}
	);
	$('#network').hover(
        function()
        { 
		   clearTimeout(nw);
        }, function()
        {
			nw = setTimeout(esciNet, 100);
    	}
	);
	/* tendine home page */
	function esciC(){
		$('#s1').animate({"bottom":"-156px"},1000);
    }
    $('#corsi').mouseover(
        function()
        { 
           // $('#s1').queue('fx', []);
			clearTimeout(tm);
			$('#s1').css({display:"block"});
            $('#s1').stop().animate({"bottom":"0"},1000);
        }
	);
	$('#corsi').mouseout(
		function()
        {
			//$('#s1').queue('fx', []);
			$('#s1').stop();
			tm = setTimeout(esciC, 100);
        }
	);
    
    $('#s1').hover(
        function()
        { 
           clearTimeout(tm);
        }, function()
        {
            tm = setTimeout(esciC, 100);
        }
	);
        
    function esciM(){
        $('#s2').animate({"bottom":"-156px"},1000);
    }

    $('#master').mouseover(
        function()
        { 
            //$('#s2').queue('fx', []);
			clearTimeout(tm2);
            $('#s2').css({display:"block"});
            $('#s2').stop().animate({"bottom":"0"},1000);
        });
	$('#master').mouseout(
		function()
        {
         	//$('#s2').queue('fx', []);
			$('#s2').stop();
			tm2 = setTimeout(esciM, 100);
        }
	);
    
    $('#s2').hover(
        function()
        { 
           clearTimeout(tm2);
        }, function()
        {
            tm2 = setTimeout(esciM, 100);
        }
	);
});
