/**
 * @package Ajax
 */

/** A requisição enviada ao servidor */
var req;

/*
    Acrescenta clicks no banner 
*/
function acrescenta_click (id)
{
	new Ajax.Request("_ajax_clicks.php",
	{
		method     : 'post',
		postBody   : 'id=' + id,
		onLoading  : function() {},
		onComplete : function(req) {},
		onFailure  : function() {}
	});
}

function login(assoc_email,assoc_senha,wwwroot)
{
	// >>>>>>>> ADICIONADO POR CHARLES em 15:54 11/11/2008 <<<<<<<<<<<<
	// devido ao mod_rewrite, não está encontrando o _ajax_login.php, então
	// criei a opção de passar a URL da raiz para páginas com reescrita de URL
	if (!wwwroot)
		wwwroot = '';
	
	new Ajax.Request(wwwroot+"_ajax_login.php",
	{
		method     : 'post',
		postBody   : 'assoc_email=' + assoc_email +
					 '&assoc_senha=' + assoc_senha,
		onLoading  : function() {},
		onComplete : function(req)
					 {
					 	$('resultado').update(req.responseText);
					 	$('resultado').style.display = '';
					 	$('f1').style.display = 'none';
					 },
		onFailure  : function() {}
	});
}

function logout()
{
	new Ajax.Request("_ajax_login.php",
	{
		method		:	'post',
		postBody	:	'acao=logout',
		onLoading	: 	function() {},
		onComplete	: 	function(req)
						{
					 		$('resultado').style.display = 'none';
					 		$('f1').style.display = '';
						},
		onFailure	:	function() {}
	});
}