// Derringers banner image slideshow
// 2010/12/17	Doug Hardy	First version

(function($)
{
  $.fn.configure = function(cfg)
  {
    if (cfg !== undefined) 
    {
      if (cfg.basePath !== undefined) 
      {
        this.basePath = cfg.basePath;
      }
    }
    this.css("overflow","hidden");
    this.empty();
    return this;
  }
  
  $.fn.addBanner = function(bannerItem)
  {
    var base = (bannerItem.link === undefined)
    ? 
      this
    : 
      $("<a>")
      .attr("href", bannerItem.link)
      .appendTo(this);
    ;

    base.append(
      $("<img>")
      .attr("src", this.basePath !== undefined ? this.basePath + bannerItem.image : bannerItem.image)
      .attr("alt", bannerItem.description)
      .width(790)
      .height(223)
    );

    return this;
  }

  $.fn.cycleBanner = function()
  {
    this.cycle({
      fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
      pause: 6,
      timeout: 10000, // ms between slide transitions
      speed: 1000 // ms transition speed
    });
  };
})(jQuery);



$(document).ready(function() {
  $.banner = $(".header_nest").configure({ basePath: "/templates/Infinity/images/banners/" });
});


