function ajax_load (config)
{
	if ((config.where != '') && (typeof (config.where) != 'undefined'))
	{
		if ($(config.where) != null)
		{
			if (config.hideloading == true)
			{
				/*do nothing*/
			}
			else
			{
				var toinsert = '<span style="background:#CCFFCC;border:1px solid #77CC77;padding:3px;position:absolute;z-index:2">Loading...</span>'; /*hardcoded loading*/
				$(config.where).innerHTML = toinsert + $(config.where).innerHTML;
			}
		}
		else
		{
			alert('id="' + config.where + '" not found. cannot load "' + config.url + '"');
		}
	}
	else
	{
		config.where = '';
	}
	
	var myAjax = new Ajax.Request (
		config.url,
		{
			method: 'post',
			parameters: 'random=' + Math.random() + '&' + config.pars,
			onSuccess: function(t)
			{
				if (config.where != '')
				{
					$(config.where).innerHTML = t.responseText;
				}
				if (config.onsuccess)
				{
					(config.onsuccess).call (this,t.responseText);
				}
				/*eval(config.onsuccess);*/
				t.responseText.evalScripts();
			},
			onFailure: function(t)
			{
				error_filler (t, config.where, config.url);
			}
		}
	);
}

/* request() is overwritten in modal box*/
function ajax_request (config)
{
	request (config);
}

function request (config)
{
	if (typeof(config.where) != 'string')
	{
		config.where = 'div_' + config.request;
	}
	
	ajax_load({
		url:			site_url + config.request,
		pars:			config.pars,
		where:			config.where,
		hideloading:	true || config.hideloading,
		onsuccess : (config.onsuccess ? config.onsuccess : null)
	});
}
