function makeLoading(_id)
{
	document.getElementById(_id).innerHTML = '<div style="text-align:center"><img src="images/load.gif" alt="A Carregar..."></div>';
}
function refreshForumBody(_connection)
{
	makeLoading("forumBody");

	if (_connection.readyState == 4)
	{
		if (_connection.status == 200)
		{
			document.getElementById('forumBody').innerHTML = _connection.responseText;
		}
	}
}
function refreshForumHeader(_connection)
{
//	makeLoading("forumHeader");

	if (_connection.readyState == 4)
	{
		if (_connection.status == 200)
		{

			document.getElementById('forumHeader').innerHTML = _connection.responseText;
		}
	}
}
function openBoard(_boardID)
{

	sendPost("forum/board.php","boardID="+_boardID+"&mod=openBoard",refreshForumBody,"text/html");
	sendPost("forum/board.php","boardID="+_boardID+"&mod=openBoard&r=header",refreshForumHeader,"text/html");
}

function openTopic(_topicID)
{
	//makeLoading("forumBody");

	var message = "topicID=" + _topicID;

	sendPost("forum/board.php",message+"&mod=openTopic",refreshForumBody,"text/html");
	sendPost("forum/board.php",message+"&mod=openTopic&r=header",refreshForumHeader,"text/html");
}

function submitNewTopic(_obj)
{
	makeLoading("forumBody");
	submitForm(_obj,'forum/board.php',refreshForumBody, "text/html","&mod=saveTopic");
}
function submitNewReply(_obj)
{
	makeLoading("forumBody");
	submitForm(_obj,'forum/board.php',refreshForumBody, "text/html","&mod=replyTopic");
}

function newTopic(_boardID)
{
	makeLoading("forumBody");

	var message="boardID=" + _boardID + "&mod=formNewTopic";

	sendPost("forum/board.php",message,refreshForumBody,"text/html");
}

function replyToTopic(_topicID)
{
	makeLoading("forumBody");

	var message = "topicID=" + _topicID + "&mod=formNewReply";

	sendPost("forum/board.php",message,refreshForumBody,"text/html");
}
/**
 *
 * @access public
 * @return void
 **/
function removeReply(_postID)
{
	makeLoading("forumBody");

	var message = "postID=" + _postID + "&mod=removeReplyTopic";

	sendPost("forum/board.php",message,refreshForumBody,"text/html");
}

function editReply(_postID)
{
    makeLoading("forumBody");
    
    var message = "postID=" + _postID + "&mod=editReplyTopic";
    
    sendPost("forum/board.php",message,refreshForumBody,"text/html");
}
function submitEditReply(_obj)
{
	makeLoading("forumBody");
	submitForm(_obj,'forum/board.php',refreshForumBody, "text/html","&mod=editReply");
}

