﻿Cufon.replace('h1, h3, h4, h5, h6');
Cufon.replace('.cufon');
Cufon.replace('.sub_menu a', { hover: true });
Cufon.replace('#home .news a', { hover: true });

$(document).ready(function () {
  // Custom Tabs
  $('.tabs .tab li a')
    .click(function () {
      $('.tabs .tab li a')
        .remove('.shadow')
        .removeClass('active');

      var i = $(this)
                .addClass('active')
                .append('<span class="l shadow"></span><span class="b shadow"></span><span class="r shadow"></span>')
                .index('.tabs .tab li a');

      $('.tabs .contenuto > li.active')
        .slideUp('normal', function () { $(this).removeClass('active') });

      $('.tabs .contenuto > li')
        .eq(i)
        .slideDown('normal', function () { $(this).addClass('active') });


      return false;
    })
    .eq(0)
    .each(function () {
      $(this)
        .addClass('active')
        .append('<span class="l shadow"></span><span class="b shadow"></span><span class="r shadow"></span>');

      $('.tabs .contenuto > li')
        .hide()
        .eq(0)
        .addClass('active');
    });

  // Altri progetti - box
  $('#altri_progetti .scroller')
    .hover(
      function () {
        $img = $('img', this);

        $img
          .stop()
          .animate({ marginTop: -164 }, 400);
      },
      function () {
        $img = $('img', this);

        $img
          .stop()
          .animate({ marginTop: 0 }, 400);
      });

  // Cycle testata interna
  $('.smusso_interno .imgs')
    .cycle({
      fx: 'fade',
      speed: 1000,
      timeout: 5000
    });

  // Animazione banda rossa interna
  $('.smusso_interno .banda')
    .width(0)
    .animate({ width: 403 }, 1000, 'easeOutCubic');

  // Modal newsletter
  $('.menu .newsletter a')
    .click(function () {
      $('#newsletter')
        .css({ opacity: 0 })
        .show()
        .animate({ opacity: 1 }, 400)
    });

  $('#newsletter .close')
    .click(function () {
      $('#newsletter')
        .animate({
          opacity: 0,
          duration: 400
        },
        function () {
          $(this)
            .hide();
        });
    });
});
