var Asset={javascript:function(d,b){if(!b){b={}}var a=new Element("script",{src:d,type:"text/javascript"}),e=b.document||document,c=b.onload||b.onLoad;delete b.onload;delete b.onLoad;delete b.document;if(c){if(typeof a.onreadystatechange!="undefined"){a.addEvent("readystatechange",function(){if(["loaded","complete"].contains(this.readyState)){c.call(this)}})}else{a.addEvent("load",c)}}return a.set(b).inject(e.head)},css:function(d,a){if(!a){a={}}var b=new Element("link",{rel:"stylesheet",media:"screen",type:"text/css",href:d});var c=a.onload||a.onLoad,e=a.document||document;delete a.onload;delete a.onLoad;delete a.document;if(c){b.addEvent("load",c)}return b.set(a).inject(e.head)},image:function(c,b){if(!b){b={}}var d=new Image(),a=document.id(d)||new Element("img");["load","abort","error"].each(function(e){var g="on"+e,f="on"+e.capitalize(),h=b[g]||b[f]||function(){};delete b[f];delete b[g];d[g]=function(){if(!d){return}if(!a.parentNode){a.width=d.width;a.height=d.height}d=d.onload=d.onabort=d.onerror=null;h.delay(1,a,a);a.fireEvent(e,a,1)}});d.src=a.src=c;if(d&&d.complete){d.onload.delay(1)}return a.set(b)},images:function(c,b){c=Array.from(c);var d=function(){},a=0;b=Object.merge({onComplete:d,onProgress:d,onError:d,properties:{}},b);return new Elements(c.map(function(f,e){return Asset.image(f,Object.append(b.properties,{onload:function(){a++;b.onProgress.call(this,a,e,f);if(a==c.length){b.onComplete()}},onerror:function(){a++;b.onError.call(this,a,e,f);if(a==c.length){b.onComplete()}}}))}))}};