function punch_o_matic_punch(postid, message)
{
	menu = fetch_object('punch'+postid+'_menu');
	edit = fetch_object('edit_post_'+postid+'_1').checked ? 1 : 0;

	do_punch = new vB_AJAX_Handler(true)
	do_punch.postid = postid
	do_punch.message = message
	do_punch.edit = edit;
	do_punch.onreadystatechange(punch_o_matic_punch_done)
	do_punch.send('punch_o_matic.php?do=punch&using_ajax=1&p=' + postid + '&m=' + message + '&edit='+edit)

	// TODO : Cambiar el icono de punch a disabled
	//fetch_object('post_thanks_button_' + postid).style.display = ''
	menu.style.display = 'none';
}

function punch_o_matic_punch_done()
{
	if (do_punch.handler.readyState == 4 && do_punch.handler.status == 200)
	{
		var myObject = eval('(' + do_punch.handler.responseText + ')');
		if (myObject.error != undefined) {
			alert(myObject.error);
		} else {
			if (myObject.action == 'edit') {
				icon = fetch_object('punch'+do_punch.postid);
				icon.src = '/images/buttons/punch_o_matic_disabled_punch.gif';
				fetch_object('td_post_' + do_punch.postid).innerHTML = myObject.body;
			} else {
				alert(myObject.body);
			}
		}
	}
}

function punch_o_matic_show_childs(postid, parentid)
{
	count = 0;
	
	obj = fetch_object("message_"+postid+"_"+parentid+"_"+count);
	while (obj) {
		if (obj.style.display == '')
			obj.style.display = 'none';
		else
			obj.style.display = '';
		count++;
		obj = fetch_object("message_"+postid+"_"+parentid+"_"+count);
	}
}