/*
* Doubletake.js 1.1
* A jQuery plugin for responsive images
*
* Copyright 2011, Graham Bird http://www.grahambird.co.uk
* Released under the WTFPL license
* http://sam.zoy.org/wtfpl/
*
* Date: 28 July 2011
*/
(function(a){a.fn.doubletake=function(b){var c={breakpoints:[320,480,640,960,1024],pattern:"/slir/w([0-9]+).*",watchresize:!1,shrinkToFit:!1};return this.each(function(d){var e=a(this);b&&a.extend(c,b);var f=function(){var b,d=a(this).width();c.breakpoints.sort(function(a,b){return c.shrinkToFit?b-a:a-b}),b=c.breakpoints[0],a.each(c.breakpoints,function(e,f){var g=c.shrinkToFit?d<=f:d>=f;if(!g)return a(".agency img").removeClass("js-hidden"),!1;b=f}),e.find("img").each(function(){var a=new RegExp(c.pattern);if(a.test(this.src)){var d=a.exec(this.src),e=d[1];this.src=this.src.replace(e,b)}})};f(),c.watchresize&&(a(window).resize(function(){this.resizeTO&&clearTimeout(this.resizeTO),this.resizeTO=setTimeout(function(){a(this).trigger("resizeEnd")},500)}),a(window).bind("resizeEnd",function(){f()}))})}})(jQuery);
