	
	function fetch_object(idname)
	{
		if (document.getElementById)
		{
			return document.getElementById(idname);
		}
		else if (document.all)
		{
			return document.all[idname];
		}
		else if (document.layers)
		{
			return document.layers[idname];
		}
		else
		{
			return null;
		}
	}
	
	function Loading(div,carga)
	{
		if(carga == 1)
		{
			
			obj = fetch_object(div);
			
			
			new Insertion.Top(div, '<img src="img/ajax.gif">')
		}
		else if(carga == 2)
		{
			obj = document.createElement('div');
			obj.innerHTML = 'Cargando...';
			obj.id = 'cargando';
			/*
			obj.style.color = '#FFFFFF';
			obj.style.background = '#FF0000';
			obj.style.top = '0px';
			obj.style.right = '3px';
			obj.style.position = 'absolute';
			obj.style.width = '100px';
			obj.style.heigth = '200px';
			obj.style.border = '1px solid #000000';
			*/
			document.body.appendChild(obj);
		}
	}
	function Complete()
	{
		var doc = document.getElementById('cargando');
		document.body.removeChild(doc);
	}
	function phpajax(id,url,prm,carga)
	{
		new Ajax.Updater(id, url,
			{
			encode: 'UTF-8',
			evalScripts: true,
			postBody: prm,
			onLoading: Loading(id,carga),
			onComplete: Complete
			}
		);
	}