(function()
{
		var my = [], myobj = {}, lazzy = 1;

		function install()
		{
			if (arguments.length == 1)
			{
				lazzy = arguments[0];
			}
			if (lazzy == 1)
			{
				if(window.attachEvent) window.attachEvent('onload', _install); else window.addEventListener('load', _install, false);
			}
			else
			{
				_install();
			}
		}
		function _install()
		{
			var obj = document.getElementsByTagName('img');
			var j = 0;
			for(var i = 0;i < obj.length ; i++)
			{
				var v = obj[i].getAttribute('avatar');
				if(v == null) continue;
				else {
					my.push(v);
					myobj[j] = obj[i];
					j++;
				}
			}
			if(my.length > 0)
			{
				var str = my.join(";");
				lj("http://space.yoka.com/public/avatar.php?ulist="+str);
			}
		}
		function update(obj)
		{
			if(obj.length > 0)
			{
				for(var i = 0;i < obj.length ; i++)
				{
					try{
						myobj[i].src = obj[i];
					}catch(e){}
				}
			}
		}
		function lj(remoteSrc)
		{
			if (document.all && document.readyState != 4 && document.readyState != 'complete' && document.readyState != 'loaded')
			{
				document.write('<script src="' + remoteSrc + '" type="text/javascript" charset="utf-8"></script>');
			}
			else
			{
				var script = document.createElement("script");
				script.type = "text/javascript";
				script.src = remoteSrc;
				document.body.appendChild(script);
			}
		}
	window.yoka_avatar = {'install':install,'update':update,'_install':_install};
})();