// HTTP [START]
function handleHttpResponse()
{
  if (http.readyState == 4)
	{
		return http.responseText;
    /*results = http.responseText.split(",");
		allResult="";
		for(i=0;i<results.length;i++)
			allResult+=results[i]+"<br>"*/
  }
}

function getHTTPObject()
{
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
	{
    try
		{
      xmlhttp = new XMLHttpRequest();
    }
		catch (e)
		{
      xmlhttp = false;
    }
  }
  return xmlhttp;
}

var http = getHTTPObject();
// HTTP [END]

function HTTPRequest(Method, Asynchronous, URL, Params, Ret)
{
	// method = GET or POST
	http.open(Method, URL , Asynchronous);
	if(Ret == true)
	{
		http.onreadystatechange = function () 
															{
																if (http.readyState == 4)
																{
																	res = handleHttpResponse();
																	http.abort();
																	return res;
																}
																return false;
															}
	}
	header='Content-Type:application/x-www-form-urlencoded; charset=UTF-8';
	http.setRequestHeader(header.split(':')[0],header.split(':')[1]);
	// SEND DATA LIKE THIS: var1=value1&var2=value2...etc
  http.send(Params);
}

function HttpReq()
{
	this.Http	= getHTTPObject();
	
	this.Request = function(Method, Asynchronous, URL, Params, Ret)
									{
										// method = GET or POST
										this.Http.open(Method, URL , Asynchronous);
										if(Ret == true)
										{
											this.Http.onreadystatechange = function () 
																											{
																												if (this.readyState == 4)
																												{
																													res = this.HandleResponse();
																													this.Http.abort();
																													return res;
																												}
																												return false;
																											}
										}
										header='Content-Type:application/x-www-form-urlencoded; charset=UTF-8';
										this.Http.setRequestHeader(header.split(':')[0],header.split(':')[1]);
										// SEND DATA LIKE THIS: var1=value1&var2=value2...etc
										this.Http.send(Params);
									}
									
	this.HandleResponse = function()
	{
		if (this.Http.readyState == 4)
		{
			return this.Http.responseText;
		}
	}
}
