/*  bgImageTween, a Jquery plugin for smooth background image transition loops.
    Copyright (C) 2010  Toni Anzlovar

    Amended to work as centered background on every page.
    09/2011 by Steve Andrews
    
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

(function( $ ){
  $.fn.bgImageTween = function(images, staytime, fadetime) {
    $(this).wrapInner('<div class="bgImageTweenfaderContent" style="background-position:center top;background-repeat:no-repeat;"></div>');
    var content = $('.bgImageTweenfaderContent', this);
    $(this).prepend('<div class="bgImageTweenfader" style="background-position:center top;background-repeat:no-repeat;"></div>');
    var fader = $('.bgImageTweenfader', this);
    
    content.css('position', 'absolute');
    fader.css('position', 'absolute');
    fader.css('width', '100%');
    fader.css('height', $(this).height() );
    fader.css('opacity', 0);
    
    n = images.shift(); images.push(n);
    $(this).css('backgroundImage', 'url('+n+')');
    n= images.shift(); images.push(n);
    fader.css('backgroundImage', 'url('+n+')');
    
    function switcher() {
      fader.delay(staytime);
      fader.animate({opacity: 1},fadetime);
      fader.queue(function(){
        n = images.shift(); images.push(n);
        fader.parent().css('backgroundImage', 'url('+n+")");
        $(this).dequeue();
      });
      fader.delay(staytime);
      fader.animate({opacity: 0},fadetime);
      fader.queue(function(){
        n = images.shift(); images.push(n);
        fader.css('backgroundImage', 'url('+n+")", switcher() );
        $(this).dequeue();
      });
    };
    switcher();
  };
})( jQuery );

/* Modernizr 2.0.6 (Custom Build) | MIT & BSD
 * Build: http://www.modernizr.com/download/#-borderradius-boxshadow-opacity-testprop-testallprops-prefixes-domprefixes
 */
;window.Modernizr=function(a,b,c){function y(a,b){var c=a.charAt(0).toUpperCase()+a.substr(1),d=(a+" "+m.join(c+" ")+c).split(" ");return x(d,b)}function x(a,b){for(var d in a)if(j[a[d]]!==c)return b=="pfx"?a[d]:!0;return!1}function w(a,b){return!!~(""+a).indexOf(b)}function v(a,b){return typeof a===b}function u(a,b){return t(l.join(a+";")+(b||""))}function t(a){j.cssText=a}var d="2.0.6",e={},f=b.documentElement,g=b.head||b.getElementsByTagName("head")[0],h="modernizr",i=b.createElement(h),j=i.style,k,toString=Object.prototype.toString,l=" -webkit- -moz- -o- -ms- -khtml- ".split(" "),m="Webkit Moz O ms Khtml".split(" "),n={},o={},p={},q=[],r,s={}.hasOwnProperty,hasOwnProperty;!v(s,c)&&!v(s.call,c)?hasOwnProperty=function(a,b){return s.call(a,b)}:hasOwnProperty=function(a,b){return b in a&&v(a.constructor.prototype[b],c)},n.borderradius=function(){return y("borderRadius")},n.boxshadow=function(){return y("boxShadow")},n.opacity=function(){u("opacity:.55");return/^0.55$/.test(j.opacity)};for(var z in n)hasOwnProperty(n,z)&&(r=z.toLowerCase(),e[r]=n[z](),q.push((e[r]?"":"no-")+r));t(""),i=k=null,e._version=d,e._prefixes=l,e._domPrefixes=m,e.testProp=function(a){return x([a])},e.testAllProps=y;return e}(this,this.document);

