// JavaScript Document



function createXMLHttpRequest()
{
	var request = null;
	// Other the IE
	if(window.XMLHttpRequest)
	{
		request = new XMLHttpRequest();
	} 
	// Using IE
	else if (window.ActiveXObject)
	{
		request=new ActiveXObject("Msxml2.XMLHTTP");
		if (! request)
		{
			request=new ActiveXObject("MSXML2.XmlHttp.5.0");
		}
	}
	return request;
}
/* 
  reqType   : The HTTP request type, such as GET or POST.
  url       : The URL of the server program.
  asynch    : Whether to send the request asynchronously or not.
  respHandle: The name of the function that will handle the response.
  Any fifth parameters, represented as arguments[4], are the data a
  POST request is designed to send. 
*/
function httpRequest(request, reqType,url,asynch,respHandle)
{
	if(request) 
	{
     	//if the reqType parameter is POST, then the
     	//5th argument to the function is the POSTed data
     	if(reqType.toLowerCase( ) == "post") 
		{ 
			//the POSTed data
			var args = arguments[5];
			if(args != null && args.length > 0)
			{
				initReq(request, reqType,url,asynch,respHandle,args);
			}
		}  
		else 
		{
			initReq(request, reqType,url,asynch,respHandle);
		}
	} 
	else 
	{
		alert("Your browser does not permit the use of all of this application's features!");
	}
}

/* Initialize a request object that is already constructed */
function initReq(request, reqType,url,bool,respHandle)
{    
	try
	{
		/* Specify the function that will handle the HTTP response */
		request.onreadystatechange=respHandle;
		request.open(reqType,url,bool);   
		request.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );   
		request.setRequestHeader("Cache-Control", "no-cache");
		request.setRequestHeader("Pragma", "no-cache");
		
		//if the reqType parameter is POST, then the
		//5th argument to the function is the POSTed data
		if(reqType.toLowerCase(  ) == "post") 
		{
			request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
			request.send(arguments[5]);
		}  
		else 
		{
			request.send(null);
		}
	} 
	catch (errv) 
	{
        alert("The application cannot contact "+
				"the server at the moment. "+
				"Please try again in a few seconds.\\n"+
				"Error detail: "+ errv.message);
	}
}




function respHandle()
{

}

