/**
 * XMLHttpRequest オブジェクトを作成する
 *
 * @return	XMLHttpRequest
 **/
function createXMLHttpRequest()
{
	var request = null;
	
	if (window.XMLHttpRequest)
	{
		try
		{
			request = new XMLHttpRequest();
		}
		catch (e)
		{
		}
	}
	else if (window.ActiveXObject)
	{
	    var names = new Array(
				'Msxml2.XMLHTTP.5.0',
				'Msxml2.XMLHTTP.4.0',
				'Msxml2.XMLHTTP.3.0',
				'Msxml2.XMLHTTP',
				'Microsoft.XMLHTTP'
			);
		
		for (var i = 0, iMax = names.length; i < iMax; i++)
		{
			try
			{
				request = new ActiveXObject(names[i]);
				break;
			}
			catch (e)
			{
			}
		}
	}

	return request;
}

/**
 * DOM Document オブジェクトを作成する
 *
 * @return	DOMDocument
 */
function createDOMDocument()
{
	var dom = null;
	
	if (document.implementation.createDocument)
	{
		try
		{
			dom = document.implementation.createDocument("xml", "xml", null);
		}
		catch (e)
		{
		}
	}
	else if (window.ActiveXObject)
	{
	    var names = new Array(
				'Msxml2.DOMDocument.4.0',
				'Msxml2.DOMDocument.3.0',
				'Msxml2.DOMDocument',
				'MSXML.DOMDocument',
				'Microsoft.XMLDOM'
			);
		
		for (var i = 0, iMax = names.length; i < iMax; i++)
		{
			try
			{
				dom = new ActiveXObject(names[i]);
				break;
			}
			catch (e)
			{
			}
		}
	}
	
	if (dom !== null)
	{
		if (dom.documentElement)
		{
			dom.removeChild(dom.documentElement);
		}
	}

	return dom;
}