$(document).ready(function(){
    lastBlock = $("#a1");
    maxWidth = 285;
    minWidth = 150;

    $("#footer ul li a").hover(
      function(){
        $(lastBlock).animate({width: minWidth+"px"}, { queue:false, duration:400 });
	$(this).animate({width: maxWidth+"px"}, { queue:false, duration:400});
	lastBlock = this;
      }
    );

    //menu
   $(".downservices").click(function(){
		$(".servicesdropped").toggle("fast");
	});


   //tooltips
   //
    $('a[rel="modal"]').live('click', function() {
       $(this).qtip({
          content: {
                         title: {
                            text: $(this).next('span').text(),
                            button: 'Chiudi'
                         },
                         text:'<div class="clear"></div>'+$(this).next('span').next('span').html()
                      },
                 position: {
                         target: $(document.body), // Position it via the document body...
                         corner: 'center' // ...at the center of the viewport
                      },
                      show: {
                         when: 'click', // Show it on click
                         solo: true // And hide all other tooltips
                      },
                      hide: false,
                      style: {
                         width: { max: 550 },
                         padding: '14px',
                         border: {
                            width: 9,
                            radius: 9,
                            color: '#666666'
                         },
                         name: 'light'
                      },
                      api: {
                         beforeShow: function()
                         {
                            // Fade in the modal "blanket" using the defined show speed
                            $('#qtip-blanket').fadeIn(this.options.show.effect.length);
                         },
                         beforeHide: function()
                         {
                            // Fade out the modal "blanket" using the defined hide speed
                            $('#qtip-blanket').fadeOut(this.options.hide.effect.length);
                         }
                      },
          overwrite: false, // Make sure another tooltip can't override this one without it being explicitly destroyed
          show: { ready: true } // Required so the tooltip shows on first mouseover
       })
    });

});
