
// <![CDATA[

$(document).ready(function() {
	
	//$("#InsertHere").html("Here is some new text");
	//$("#InsertHere").css("background-color", "#FFFFCC");
	//$("#InsertHere").load("/Forum/PostIncludes/AmalgamFillings/OtherThingsThatMayInterestYou.html");
	
 });


function cfg(Setting) {
	/*
	Purpose
		Used to globalize settings.
	Parameters
		Setting (string) = A string representing the setting we want to retrieve.
	*/

	switch(Setting) {

	case "MCIncludes_RootDir":
		return "/mc/assets/includes";
		
	case "PostIncludes_RootDir":
		return "/Forum/Posts/Includes";

	case "PostTemplates_RootDir":
		return "/Forum/Posts/Templates";

	case "Posts_RootDir":
		return "/Forum/Posts";

	default :
		return "";

	}

}



function Request_MCInclude(Category, IncludeFile) {
	/*
	Purpose
		Used to retreive an include file (webpage) from the media center directory and return the body of the page.
	Parameters
		ForumID (string) = The forum identifier. This is used to create the path to the file we're loading.
			For example, "AmalgamFillings" will translate into part of the path we're posting to:
				"/Forum/PostIncludes/AmalgamFillings/MyFile.html"
		IncludeFile (string) = The name of the file we're loading. The file suffix should be included.
	Return (string)
		Returns the BODY section of the retrieved webpage.
	*/

	// Get the root of the directory containing includes
	var RootDir = cfg("MCIncludes_RootDir");

	// Assemble the filespec of the file we're going to load
	var FileSpec = RootDir + "/" + Category + "/" + IncludeFile;

	// Request the post include file
	var HTML = $.ajax({url: FileSpec, async: false}).responseText;

	// Parse the BODY out of the retrieved webpage
	var r = HTML.substring(HTML.indexOf("<body>") + 6, HTML.indexOf("</body>"));
	
	return r;
	
}



// ]]>

