(function ($) {
  $.fn.fadeTransition = function(options) {
    var options = $.extend({pauseTime: 5000, transitionTime: 2000}, options);
    
    Trans = function(obj) {
      var timer = null;
      var current = 0;
      var els = $("> *", obj).css("display", "none").css("left", "0").css("top", "0").css("position", "absolute");
      $(obj).css("position", "relative");
      $(els[current]).css("display", "block");
      
      function transition() {
        var next = (current + 1) % els.length | 0;
        $(els[current]).fadeOut(options.transitionTime, function() { this.style.removeAttribute('filter'); });
        $(els[next]).fadeIn(options.transitionTime, function() { this.style.removeAttribute('filter'); });
        current = next;
        cue();
      };

      function cue() {
        if ($("> *", obj).length < 2) return false;
        if (timer) clearTimeout(timer);
        timer = setTimeout(transition, options.pauseTime);
      };
  
      cue();
    }
    
    return this.each(function() {
      var t = new Trans(this);
    });
  }
})(jQuery);

var DigitalFinery = new function() {
  this.showWarning = function() {
    var re = /robpoyntz\.com\//;
    if (!window.location.toString().match(re))
      alert('Dear site admin,\n\n\
You are seeing this message because you have linked to a script hosted on robpoyntz.com.\n\
\n\
I\'m very glad you find the script useful. You are welcome to use the script, but\n\
please host on your own server, instead of leaching my bandwidth.\n\
\n\
Thanks,\n\
Rob.');
  };
};

if (window.attachEvent) {
  window.attachEvent('onload', DigitalFinery.showWarning);
}
else {
  window.addEventListener('DOMContentLoaded', DigitalFinery.showWarning, true);
}


