function CompleteCall()
{
	this.completeFunction = null;
	this.completeParams = new Array();
	
	if (arguments.length > 0)
	{
		this.completeFunction = arguments[0];
	}
	var i;
	for(i=1;i<arguments.length;i++)
	{
		this.completeParams[this.completeParams.length] = arguments[i];
	}
	return this;
}
function AjaxCall(sendMethod, asynchronous)
{
	function validateSendMethod(sendMethod)
	{
	  if (sendMethod != 'POST')
	  {
	    return 'GET';
	  }  
	  return 'POST';
	}	
	this.sendMethod = validateSendMethod(sendMethod);
	this.asynchronous = asynchronous;		
  function getHttp()
  {
    var http = null;
    try
    {  
      http=new XMLHttpRequest();  
    }
    catch (e)
    {  
      try
      {    
        http=new ActiveXObject('Msxml2.XMLHTTP');    
      }
      catch (e)
      {    
        try
        {      
          http=new ActiveXObject('Microsoft.XMLHTTP');      
        }
        catch (e)
        {      
        }    
      }  
    }      
    return http;
  }
	function execute(serverUrl, completeCall, isResponseXML)
	{
	  var http = getHttp();	
	  if (http != null)
	  {
	    if (this.asynchronous)
	    {
	      if (isResponseXML)
	      {
		      http.onreadystatechange = function()
		      {
		        if(http.readyState == 4)
		        {
		        	if ((http.status == 200) || (http.status == 0))
		        	{
			        	if (completeCall != null)
			        	{
			        		if (completeCall.completeFunction != null)
			        		{
			        			completeCall.completeParams.splice(0, 0, http.responseXML.documentElement);
				          		completeCall.completeFunction.apply(this, completeCall.completeParams);		          	
				          	}
			        	}
			        }
		        }
		      }
	      }
	      else
	      {
		      http.onreadystatechange = function()
		      {
		        if(http.readyState == 4)
		        {
		        	if ((http.status == 200) || (http.status == 0))
		        	{
			        	if (completeCall != null)
			        	{
			        		if (completeCall.completeFunction != null)
			        		{
			        			completeCall.completeParams.splice(0, 0, http.responseText);
				          		completeCall.completeFunction.apply(this, completeCall.completeParams);		          	
				          	}
			        	}
			        }
		        }
		      }
		  }
	    }      
	    http.open(this.sendMethod, serverUrl, this.asynchronous);
	    http.send(null);
	
	    if (!this.asynchronous)
	    {
	      	if ((http.status == 200) || (http.status == 0))
	      	{
		    	if (completeCall != null)
		    	{
		    		if (completeCall.completeFunction != null)
		    		{
				      if (isResponseXML)
				      {
		    			completeCall.completeParams.splice(0, 0, http.responseXML.documentElement);
				      }
				      else
				      {		    		
		    			completeCall.completeParams.splice(0, 0, http.responseText);
		        	  }
  	        		  completeCall.completeFunction.apply(this, completeCall.completeParams);
		        	}
		    	}
		    }
	    }	      	    	    
	  }
	}	
	this.execute = execute;
	return this;
}