/*
 * D2JS
 * Copyright (C) SatisKia. All rights reserved.
 */
function _httpOpen( method, url )
{
	var request = null;
	if( !!XMLHttpRequest )
	{
		request = new XMLHttpRequest();
	}
	else if( !!ActiveXObject )
	{
		try
		{
			request = new ActiveXObject( "Msxml2.XMLHTTP.6.0" );
		}
		catch( e )
		{
			try
			{
				request = new ActiveXObject( "Msxml2.XMLHTTP.3.0" );
			}
			catch( e )
			{
				try
				{
					request = new ActiveXObject( "Msxml2.XMLHTTP" );
				}
				catch( e )
				{
					try
					{
						request = new ActiveXObject( "Microsoft.XMLHTTP" );
					}
					catch( e ){}
				}
			}
		}
	}
	if( request != null )
	{
		request.open( method, url, true );
		request.onreadystatechange = function()
		{
			if( request.readyState == 4 )
			{
				if( request.status == 200 )
				{
					onHttpResponse( request, request.responseText );
				}
				else
				{
					onHttpError( request, request.status );
				}
			}
		};
	}
	return request;
}
function httpGet( url )
{
	var request = _httpOpen( "GET", url );
	if( request != null )
	{
		request.setRequestHeader( "If-Modified-Since", "Thu, 01 Jun 1970 00:00:00 GMT" );
		request.send( null );
	}
	return request;
}
function httpPost( url, data, type )
{
	var request = _httpOpen( "POST", url );
	if( request != null )
	{
		request.setRequestHeader( "If-Modified-Since", "Thu, 01 Jun 1970 00:00:00 GMT" );
		request.setRequestHeader( "Content-Type", type );
		request.send( data );
	}
	return request;
}
