jQuery.preloadCssImages=function(a){function i(b,c){var f=false,g=[],j=[],k;var l=b.length;while(l--){var m="";if(c&&c[l]){k=c[l]}else{var n=b[l].href?b[l].href:"window.location.href";var o=n.split("/");o.pop();k=o.join("/");if(k){k+="/"}}try{var p=b[l].cssRules}catch(q){continue}if(b[l].cssRules||b[l].rules){e=b[l].cssRules?b[l].cssRules:b[l].rules;var r=e.length;while(r--){if(e[r].style&&e[r].style.cssText){var s=e[r].style.cssText;if(s.toLowerCase().indexOf("url")!=-1){m+=s}}else if(e[r].styleSheet){g.push(e[r].styleSheet);f=true}}}var t=m.match(/[^\("]+\.(gif|jpg|jpeg|png)/g);if(t){var u=t.length;while(u--){var v=t[u].charAt(0)=="/"||t[u].match("://")?t[u]:k+t[u];if(jQuery.inArray(v,d)==-1){d.push(v)}}}if(!f&&b[l].imports&&b[l].imports.length){for(var w=0,x=b[l].imports.length;w<x;w++){var y=b[l].imports[w].href;y=y.split("/");y.pop();y=y.join("/");if(y){y+="/"}var z=y.charAt(0)=="/"||y.match("://")?y:k+y;j.push(z);g.push(b[l].imports[w])}}}if(g.length){i(g,j);return false}var A=a.simultaneousCacheLoading;while(A--){setTimeout(h,A)}}function h(){if(d&&d.length&&d[c]){var b=new Image;b.src=d[c];if(!b.complete){jQuery(b).bind("error load onreadystatechange",g)}else{g()}f=setTimeout(g,a.errorDelay)}}function g(){clearTimeout(f);if(d&&d.length&&d[c]){c++;if(a.statusTextEl){var b=d[c]?"Now Loading: <span>"+d[c].split("/")[d[c].split("/").length-1]:"Loading complete";jQuery(a.statusTextEl).html('<span class="numLoaded">'+c+'</span> of <span class="numTotal">'+d.length+'</span> loaded (<span class="percentLoaded">'+(c/d.length*100).toFixed(0)+'%</span>) <span class="currentImg">'+b+"</span></span>")}if(a.statusBarEl){var e=jQuery(a.statusBarEl).width();jQuery(a.statusBarEl).css("background-position",-(e-(e*c/d.length).toFixed(0))+"px 50%")}h()}}a=jQuery.extend({statusTextEl:null,statusBarEl:null,errorDelay:999,simultaneousCacheLoading:2},a);var b=[],c=0,d=[],e,f;i(document.styleSheets);return d}
