var Load = {
	image: function(o) {
		var g = new Image(), e = o.onerror, a = o.onabort;
		if(o.onload) g.onload = function() {
			if(arguments.callee.done) return false;
			arguments.callee.done = true;
			this.onload = null;
			return o.onload.call(this);
		};
		if(e) g.onerror = e;
		if(a) g.onabort = a;
		g.src = o.url;
		return g;
	},
	images: function(o) {
		var i = o.images, l = 0, j = 0, r = [], s = o.onstart, p = o.onprogress, c = o.oncomplete;
		i = (i instanceof Array) ? i : [i];
		s = (s) ? s : function(){};
		p = (p) ? p : function(){};
		c = (c) ? c : function(){};
		l = i.length;
		s(l);
		i.forEach(function(g){
			if(typeof g == 'string') g = {url: g};
			var d = g.onload, e = g.onerror, a = g.onabort;
			d = (d) ? d : function(){};
			e = (e) ? e : function(){};
			a = (a) ? a : function(){};
			g.onload = function() {
				d.apply(this);
				j++;
				p.call(this, j, l);
				if(j == l) c(l);
			};
			g.onerror = function() {
				e.apply(this);
				j++;
				p.call(this, j, l);
				if(j == l) c(l);
			};
			g.onabort = function() {
				a.apply(this);
				j++;
				p.call(this, j, l);
				if(j == l) c(l);
			};
			r.push(Load.image(g));
		});
		return r;
	},
	css: function(o) {
		var a = {href: o.url, type: 'text/css'};
		a.rel = (o.rel) ? o.rel : 'stylesheet';
		a.media = (o.media) ? o.media : 'screen';
		var e = (a.append) ? Dom.head() : null;
		return Dom.create(['link', a], e);
	},
	javascript: function(o) {
		var a = {src: o.url, type: 'text/javascript'};
		if(o.id) a.id = o.id;
		var e = (a.append) ? Dom.head() : null;
		return Dom.create(['script', a], e);
	}
};
