/* Justified Gallery Version: 2.1 Author: Miro Mannino Author URI: http://miromannino.it Copyright 2012 Miro Mannino (miro.mannino@gmail.com) This file is part of Justified Gallery. This work is licensed under the Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. */ (function(d){d.fn.justifiedGallery=function(r){function n(b,i){return'
'+b+"
"}function o(b,i,j){d(b).find(".jg-loading").fadeOut(500,function(){d(this).remove();p(d,b,i,0,j);d.isFunction(j.onComplete)&&j.onComplete.call(this,b)})}function q(b,i,d,c){var a,h=0,g;for(a=0;am?f:m;e.suffix=100>= l?c.sizeRangeSuffixes.lt100:240>=l?c.sizeRangeSuffixes.lt240:320>=l?c.sizeRangeSuffixes.lt320:500>=l?c.sizeRangeSuffixes.lt500:640>=l?c.sizeRangeSuffixes.lt640:c.sizeRangeSuffixes.lt1024;b[a].l=h;c.fixedHeight||(0==a?g=b[a].nh:g>b[a].nh&&(g=b[a].nh));h+=b[a].nw+c.margins}c.fixedHeight&&(g=c.rowHeight);d="";for(a=0;a',f+=' ',f+=' '+h.alt+'',c.captions&&(f+='
'+h.alt+"
"),f+="
",d+=f;return'
'+d+"
"}function p(b,d,e,c,a){var c=[],h,g,k=0,f=b(d).width();for(h=g=0;g
'),d(i).find("a").each(function(a,b){var g=d(b).find("img");c[a]=Array(5);c[a].src="undefined"!=typeof d(g).data("safe-src")? d(g).data("safe-src"):d(g).attr("src");c[a].alt=d(g).attr("alt");c[a].href=d(b).attr("href");c[a].title=d(b).attr("title");c[a].rel=null!=e.rel?e.rel:d(b).attr("rel");c[a].target=null!=e.target?e.target:d(b).attr("target");c[a].extension=c[a].src.match(e.extension)[0];d(b).remove();g=new Image;d(g).load(function(){c[a].width=c[a].height!=e.rowHeight?Math.ceil(this.width/(this.height/e.rowHeight)):this.width;c[a].height=e.rowHeight;var b=RegExp("("+e.sizeRangeSuffixes.lt100+"|"+e.sizeRangeSuffixes.lt240+ "|"+e.sizeRangeSuffixes.lt320+"|"+e.sizeRangeSuffixes.lt500+"|"+e.sizeRangeSuffixes.lt640+"|"+e.sizeRangeSuffixes.lt1024+")$");c[a].src=c[a].src.replace(e.extension,"").replace(b,"");++j==c.length&&o(i,c,e)});d(g).error(function(){d(i).prepend(n("The image can't be loaded: \""+c[a].src+'"',"jg-usedPrefixImageNotFound"));c[a]=null;++j==c.length&&o(i,c,e)});d(g).attr("src",c[a].src)}))})}})(jQuery);