
	/**
		© 2010 Алексей Забродин
		Расширения для библиотеки hybrid
	*/

	Box.preloader = null;
	Box.onload = null;
	Box.afterLoad = function()
	{
		var a = $('#_run_');
		if (a)
		{
			var t = setTimeout(function()
			{
				if (a.value == 'close') Box.hide();
				else if (a.value) location = a.value;
			}, 1500);
			_(Box.blind).event('click', function()
			{
				if (t) clearTimeout(t);
			});
		}
	},
	Box.load = function(u, fu)
	{
		if (Box.preloader)
		{
			Box.show(Box.preloader, true);
		}
		Ajax.load(u, function(c)
		{
			Box.show(c);
			if (Box.onload) Box.onload.call(this);
			if (fu) fu.call(this);
			Box.afterLoad();
		});
	};
	Box.submit = function(f, fi, fu)
	{
		if (fi)
		{
			var n = null;
			_(fi.split(', ')).each(function()
			{
				var field = this;
				_(f.elements).each(function()
				{
					if ((field == this.name) && (!this.value || /^\s+$/i.test(this.value)))
					{
						n = true;
					}
				});
			});
			if (n) return false;
		}
		if (Box.preloader)
		{
			setTimeout(function()
			{
				Box.show(Box.preloader, true);
			}, 1);
		}
		Ajax.submit(f, function(c)
		{
			setTimeout(function()
			{
				Box.show(c);
				if (Box.onload) Box.onload.call(this);
				if (fu) fu.call(this);
				Box.afterLoad();
			}, 1);
		});
	};