function objetoAjax()
{
	var xmlhttp=false;
	try 
	{
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} 
	catch (e)
	{
		try 
		{
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch (E)
		{
			xmlhttp = false;
  		}
	}

	if (!xmlhttp && typeof(XMLHttpRequest) != 'undefined') 
	{
		xmlhttp = new XMLHttpRequest();
	}
	
	return xmlhttp;
}

var CommandPageUrl = 'includes/Helper-Ajax.php';

function ExecuteCommand(CommandName, AuxFunction)
{
	var self = this;
	
	self.AuxFunction = AuxFunction;

	ajax=objetoAjax();
	
	var ParamsString = '';
	
	if(arguments.length > 2)
	{
		for( i = 2; i < arguments.length; i++)
		{
			index = i - 2;
			ParamsString += '&p' + index + '=' + arguments[i];
		}
	}	
	
	var CommandURL = CommandPageUrl + '?cmd=' + CommandName + ParamsString;
	
	ajax.open("GET", CommandURL);
	
	ajax.onreadystatechange = function() {
		if (ajax.readyState==4) {
			if(typeof(self.AuxFunction) == 'function')
			{
				self.AuxFunction(ajax.responseText);
			}
			else
			{
				return ajax.responseText;
			}
		}
	}
	
	ajax.send(null);
}