function naxo_getobj(id)
{	
	if (document.getElementById)
	{
		return document.getElementById(id);
	}	
	else if (document.all)  
	{
		return document.all[id];
	}
	else if (document.layers)
	{
		return document.layers[id];
	}
}	

function naxo_debug(x)
{
	//return;
	if (navigator.userAgent.indexOf('MSIE')==-1 || document.getElementById('form_done'))
	{
		document.getElementById('main').appendChild(document.createTextNode(((new Date).toLocaleTimeString())+'.'+((new Date).getMilliseconds())+': '+x));
		document.getElementById('main').appendChild(document.createElement("BR"));
	}
	else
	{
		if (navigator.userAgent.indexOf('MSIE 6.0')!=-1)
		{
			//alert(x);
		}
	}
}

function naxo_dump(x)
{
	naxo_debug(x);
	var s	=	'';
	for (i in x)
	{
		naxo_debug(i+'='+x[i]);
	}
}

function naxo_build(i)
{
	//naxo_dump(i);
	if (i.type == "text")
	{
		//naxo_debug('text node: '+i.text);
		return document.createTextNode(i.text);
	}
	if (i.type == 'SCRIPT')
	{
		var script = i.contents[0].text;
		var s2 = script.match(/<!--(.*)-->/)[1];
		//naxo_debug(s2);
		eval(s2);
		return document.createTextNode('');
	}

	//naxo_debug('html node: '+i.type);
	var o;
	try
	{
		var s = '<'+i.type;
		for (var j in i.attrs)
		{
			s += ' '+j+'="'+i.attrs[j]+'"';
		}
		s += '>';
		//naxo_debug(s);
		o = document.createElement(s);
	}
	catch(e)
	{
		o = document.createElement(i.type);
		for (var j in i.attrs)
		{
			o.setAttribute(j.toLowerCase(),i.attrs[j]);
		}
	}
	//naxo_dump(o);
	if (i.contents)
	{
		//naxo_debug("length="+i.contents.length);
		for (var j=0;j<i.contents.length;j++)
		{
			//naxo_debug("j="+j);
			//naxo_debug('going in');
			if (i.contents[j])
			{
				o.appendChild(naxo_build(i.contents[j]));
			}
			//naxo_debug('and back');
		}
	}
	//naxo_debug('going out');
	return o;
}

