﻿	
function send(link, body, callbackFn) 
{
	try
	{
		try
		{
		    netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
		}catch(e){}
		var xml=window.ActiveXObject?new ActiveXObject('Microsoft.XmlHttp'):new XMLHttpRequest();
		if(xml.overrideMimeType)xml.overrideMimeType("text/xml");
		xml.onreadystatechange=watcher;
		xml.open('POST',link,true);
		xml.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		xml.send(body);
	}
	catch(e)
	{
		alert('Error: '+(e.description?e.description:e))
	}
	
	function watcher()
	{
		if(xml.readyState==4)
		{
//		alert('to get: '+xml.responseText)
			var response={responseText:'',responseXML:xml.responseXML,responseBody:xml.responseBody,responseStream:xml.responseStream,statusText:xml.statusText,status:xml.status};
			if(xml.responseText.indexOf('<!DOCTYPE')<0)response.responseText=xml.responseText;
			callback(response);
		}
	}
    
    function callback(response)
    {
//		alert('POST: '+link+' \nto get: '+response.responseText)
		if(callbackFn&&typeof(callbackFn)=='function')callbackFn(response);
	}
};


