function initializeTinyMCE() {
	tinyMCE.init({
	theme : "advanced",
	plugins : "spellchecker",
	theme_advanced_buttons1 : "spellchecker,separator,bold,italic,underline,separator,link,unlink,bullist,numlist",
	theme_advanced_buttons2 : "removeformat,separator,undo,redo,separator,charmap",
	theme_advanced_buttons3 : "",
	mode : "specific_textareas",
	editor_selector : "mceEditor",
	convert_urls : false,
	spellchecker_languages : "+English=en"
	});
}
function doRenderForumSiteThreadAuthoring(wrapperDivID, topicID, responseToPostID, rootVariate, threadViewBool) {
	if (threadViewBool === false) {
		var divIDthreadViewBoolAdjust = 'threadless_';
	} else {
		var divIDthreadViewBoolAdjust = '';
	}
     hidePreviousForumSiteThreadAuthoring();
	if (typeof forumSiteReplyAuthoringPreviousTopicID !== 'undefined' &&
		typeof forumSiteReplyAuthoringPreviousResponseToPostID !== 'undefined') {
			//Clean up previous editor instance
			//mceEditorForumSiteRemove('topic_id_'+forumSiteReplyAuthoringPreviousTopicID+'_response_to_post_id_'+forumSiteReplyAuthoringPreviousResponseToPostID+'_content');
		}
	var divThreadActivator = 'topic_id_'+topicID+'_post_id_'+responseToPostID+'_thread_activator_container';
	if (typeof divThreadActivator !== 'undefined') {
		$('#'+divThreadActivator).fadeOut('slow');
		forumSiteAuthoringPreviousDivThreadActivator = divThreadActivator;
	}
	var divToRenderTo = 'topic_id_'+topicID+'_response_to_post_id_'+responseToPostID+'_thread_authoring_container';
	$('#'+divToRenderTo).load(rootVariate+'js_resources/forumsite_ajax.php?mode=render_create_thread_controls&topicID='+topicID+'&wrapperDivID='+escape(wrapperDivID)+'&topicID='+topicID+'&responseToPostID='+responseToPostID+'&time='+getCurrentTime(), function(){$('#'+divToRenderTo).slideDown('fast', function(){window.location = '#forum_post_id_' + responseToPostID + '_top';})});
	forumSiteReplyAuthoringPreviousDivRenderedTo = divToRenderTo;
	forumSiteReplyAuthoringPreviousTopicID = topicID;
	forumSiteReplyAuthoringPreviousResponseToPostID = responseToPostID;
	return true;
}
function hidePreviousForumSiteThreadAuthoring() {
	if (typeof forumSiteReplyAuthoringPreviousDivRenderedTo !== 'undefined') {
		if (typeof forumSiteAuthoringPreviousDivThreadActivator !== 'undefined') {
			$('#' + forumSiteAuthoringPreviousDivThreadActivator).fadeIn('slow');
		}
		//Close up previous authoring containers
		//document.getElementById(forumSiteReplyAuthoringPreviousDivRenderedTo).innerHTML = '';
		$('#' + forumSiteReplyAuthoringPreviousDivRenderedTo).slideUp('fast');
	}
}
function doRenderForumSitePost(postID, threadViewBool, showDivBool) {
	if (threadViewBool === false) {
		var divIDthreadViewBoolAdjust = 'threadless_';
		var threadViewBoolString = 'false';
	} else {
		var divIDthreadViewBoolAdjust = '';
		var threadViewBoolString = 'true';
	}
	var thisDivID = 'post_id_'+postID+'_'+divIDthreadViewBoolAdjust+'content_container';
	if (showDivBool === true) {
		$('#'+thisDivID).slideDown('slow');
		document.getElementById('post_id_'+postID+'_'+divIDthreadViewBoolAdjust+'show_post_activator_container').innerHTML = '<a style="cursor: pointer; color: #ef3900" onclick="doRenderForumSitePost('+postID+', '+threadViewBoolString+', false)">Hide Post</a>';
	} else {
		$('#'+thisDivID).slideUp('slow');
		document.getElementById('post_id_'+postID+'_'+divIDthreadViewBoolAdjust+'show_post_activator_container').innerHTML = '<a style="cursor: pointer; color: #ef3900" onclick="doRenderForumSitePost('+postID+', '+threadViewBoolString+', true)">Show Post</a>';
	}
	return true;
}
function doCreatePost(wrapperDivID, topicID, responseToPostID, title, content, rootVariate) {
	var processVars = 'mode=create_post';
	processVars += '&topicID='+topicID;
	processVars += '&responseToPostID='+escape(responseToPostID);
	processVars += '&postTitle='+escape(title);
	processVars += '&postContent='+escape(content);
	$.getJSON(rootVariate+'js_resources/forumsite_ajax.php?'+processVars, function(json){if (json.result == 'Error') {alert(json.reason)} else {$('#'+wrapperDivID).load(rootVariate+'js_resources/forumsite_ajax.php?mode=re-render_forumsite&topicID='+json.topicID+'&wrapperDivID='+wrapperDivID, function(){mceEditorForumSiteRemove('topic_id_'+topicID+'_response_to_post_id_'+responseToPostID+'_content'); window.location = '#forum_post_id_'+json.postID+'_top'})}});
	return true;
}
function mceEditorForumSiteRemove(ID) {
	if (tinyMCE.execCommand('mceRemoveControl', true, ID)) {
		return true;
	} else {
		return false;
	}
}
