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