function ajaxRequestObject( )
{
	var httpRequest = null;

	if ( window.XMLHttpRequest ) // Mozilla, Safari, ...
	{
		httpRequest = new XMLHttpRequest();
		//if (httpRequest.overrideMimeType)
		//{
		//	httpRequest.overrideMimeType('text/xml');
		//}
	}
	else if (window.ActiveXObject) // IE
	{
		try
		{
			httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
			}
		}
	}
	
	if (!httpRequest)
	{
		alert('Giving up. Cannot create request object.');
		return false;
	}
	else
	{
		return httpRequest;
	}
}


function ajaxHttpSend( http_obj_in, module_name, url_data, rtn_function, post_content_type, post_data, method, async )
{
	var request_sent = false;
	var is_async = ( ( async==null ) ? true : async);
	var method = ( ( method == null || method.toLowerCase() == "get" ) ? 'get' : 'post');

	var args = "page=" + PAGE_ID + "&a_page=" + A_PAGE_ID + "&module_name=" + module_name + url_data;
	
	if( method.toLowerCase() == "post" )
	{
		http_obj_in.open( method, "call.php", is_async );
	}
	else
	{
		http_obj_in.open( method, "call.php?" + args, is_async );
	}
	http_obj_in.onreadystatechange = rtn_function;
	
	switch ( post_content_type )
	{
		case 'xml':
			http_obj_in.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
			http_obj_in.send( 'web_form_post_data=' + encodeURIComponent( args ) );	
			break;
															
		case 'form':
			http_obj_in.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			http_obj_in.send( args );	
			break;
		
		default:
			http_obj_in.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			if( method.toLowerCase() == "post" )
			{
				http_obj_in.setRequestHeader('Content-length', args.length);
			}
			http_obj_in.send( args );
			break;
	}	
	
	request_sent = true;
	
	return request_sent;
}

function stripInner( content )
{
	content = content.replace(/[\r\n]/g,"!newline!");
	content = content.replace(/\<html.*\<body.*?\>/,"");
	content = content.replace(/\<\/body\>.*/,"");
	content = content.replace(/!newline!/g,"\n");
	return content;
}
