(function($) {

  var $alert = $("#alert");
    if ($alert.is(":hidden")) {
      $alert.slideDown("slow");
      $alert.find('.close').click(function() {
        $alert.find('p').fadeOut('slow');
        $alert.slideUp(600, function() {
          $(this).remove();
        });
        return false;
      });
    } else { 
      $alert.hide();
    }

  // Date picker
  $("#freeform .date").datepicker({ dateFormat: 'dd/mm/yy' });

  // Feature slider
  $('#home .slider').anythingSlider({
    easing: "easeInOutExpo",
    autoPlay: true,
    delay: 10000,
    startStopped: false,
    animationTime: 2000,
    hashTags: true,
    buildNavigation: true,
    pauseOnHover: true,
    startText: "Play",
    stopText: "Pause"
  });

  $("#slide-jump").click(function(){
    $('.anythingSlider').anythingSlider(6);
  });

  // Used car galleries
  var $galleria = Galleria;
  $galleria.loadTheme('/assets/scripts/themes/classic/galleria.classic.js');
  $('#gallery').galleria();

})(jQuery);