AppController = function(param)
{
	this.options = param || {
		modulo:'',	
		metodo:'',
		callBack:function(){}
	} // fim options
	
	this.exec = function(parametros, authenticate){
		
		parametros = parametros || '';
		authenticate = arguments.length > 1 ? authenticate : true;
		
		if (authenticate)
		{
			ClientAuthentication.loginCheck(parametros, this.options);		// checa se o usuario esta logado
		} // fim if
		else
		{
			this.callAjax(parametros);		// executar chamada ajax
		} // fim else
	} // fim exec
	
	this.callAjax = function(parametros) {
		
		var options = this.options;
			
		$.ajax({
			type		: 'POST',
			url			: 'AppController.php?modulo=' + options.modulo + '&metodo=' + options.metodo,
			data		: parametros + '&authentication=cliente',
			dataType	: 'html',
			complete	: function(retorno) 
			{
				if (retorno) 
				{ 
					options.callBack(retorno.responseText);
				} // fim if
				else
				{
					alert('Não foi possível carregar a página, tente novamente.');
				} // fim else
			} // fim complete
		}); // fim ajax
	} // fim callAjax
};
