/*======================================*\
|| #################################### ||
|| # Post Hug Hack version 7.80 # ||
|| #################################### ||
\*======================================*/
var post_hug_handleSuccess = function(o)
{
	if(o.responseText !== undefined)
	{
		if (post_hug_callback.object_name[o.tId] !== undefined)
		{
			fetch_object(post_hug_callback.object_name[o.tId]).innerHTML = o.responseText;
		}
	}
}
var post_hug_handleFailure = function(o)
{
	if(o.responseText !== undefined)
	{
		alert(o.responseText);
	}
}
var post_hug_callback =
{
	success: post_hug_handleSuccess,
	failure: post_hug_handleFailure,
	timeout: vB_Default_Timeout,
	cache: false,
	object_name: new Array()
};
function post_hug_give(postid)
{
	fetch_object('post_hug_button_' + postid).style.display = 'none';

	var sUrl = 'post_hug.php';
	var postData = 'do=post_hug_add&using_ajax=1&p=' + postid + '&securitytoken=' + SECURITYTOKEN;

	var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, post_hug_callback, postData);

	post_hug_callback.object_name[request.tId] = 'post_hug_box_' + postid;

	fetch_object('post_hug_box_' + postid).style.display = '';

	return false;
}
function post_hug_remove_all(postid)
{
	var sUrl = 'post_hug.php';
	var postData = 'do=post_hug_remove_all&using_ajax=1&p=' + postid + '&securitytoken=' + SECURITYTOKEN;

	var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, post_hug_callback, postData);

	post_hug_callback.object_name[request.tId] = 'post_hug_box_' + postid;

	fetch_object('post_hug_button_' + postid).style.display = ''

	fetch_object('post_hug_box_' + postid).style.display = 'none';

	return false;
}
function post_hug_remove_user(postid)
{
	var sUrl = 'post_hug.php';
	var postData = 'do=post_hug_remove_user&using_ajax=1&p=' + postid + '&securitytoken=' + SECURITYTOKEN;

	var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, post_hug_callback, postData);

	post_hug_callback.object_name[request.tId] = 'post_hug_box_' + postid;

	fetch_object('post_hug_button_' + postid).style.display = ''

	fetch_object('post_hug_box_' + postid).style.display = 'none';

	return false;	
}
