
// JScript File

//Send and XMLHttp request.
function sendXMLHTTP(sURI, sParam, async, postMethod)
{
	//Set default values :
	var sAsync = ((typeof(async) == "undefined") || (async == "")) ? false : async ;
	var sParam = ((typeof(sParam) == "undefined") || (sParam == "")) ? null : sParam ;
	var sPostMethod = (typeof(postMethod) == "undefined")? "GET" : postMethod ;
	
	//Get the xml object.
	var xmlHttp = getActiveXObjectType();
	
	//Send request to the server.
//alert(sURI);
xmlHttp.open(sPostMethod, sURI, sAsync);
   	xmlHttp.send(sParam);

	return xmlHttp;
}

//Decide the type of the xml object according to the browser type.
function getActiveXObjectType(xmlhttp)
{
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	  	try{
	  		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP.4.0");
	  	}
	  	catch (e)
	  	{
	  		try {
	  			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	 		} 
			catch (e) {
	  			try{ 
	  				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
	  			} 
				catch (e) { 
					xmlhttp = false; 
				}
	 		}
	 	}
	@else
	 	xmlhttp=false
	@end @*/
	
	if (!xmlhttp) {
		try { xmlhttp = new XMLHttpRequest(); }
		catch (e){ xmlhttp = false; }
	}

	return xmlhttp;
}

