﻿// Fader Function for unordered lists
//Can be used by calling the following method style
//$('ul').ezslide({
//    fadeIn  : 600,
//    fadeOut : 450,
//    delay   : 1500
//});

$.fn.ezslide = function (options) {
  var defaults = {
    fadeIn: 1000,
    fadeOut: 100,
    delay: 3000
  },
        settings = $.extend(defaults, options),
        $this = this,
        cur = 0,
        fadeIt = function (which) {
          var li = $this.find('li');

          cur = which = (which >= li.length) ? 0 : which;

          li.fadeOut(settings.fadeOut);
          li.eq(which)
              .delay(settings.fadeOut)
              .fadeIn(settings.fadeIn, function () {
                setTimeout(function () {
                  cur++;
                  fadeIt(cur);
                }, settings.delay);
              });

        };

  fadeIt(cur);
};

$(document).ready(function () {
  // TEAM FADER SLIDER
  $('#team-fader').ezslide({
    fadeIn: 600,
    fadeOut: 450,
    delay: 5000
  });
});


