//  Create global namespace and add include function
var global = {
	
	//  Object properties
	includes: new Array(),
	includePath: "",
	
	//  This function is used to include other scripts
	include: function include(path, prependIncludePath) {

		//  If the second argument isn't passed, default to true
		if (arguments.length < 2) {
			prependIncludePath = true;	
		}
		
		//  Prepend the include path is necessary
		if (prependIncludePath) {
			path = this.getIncludePath() + path;	
		}

		//  Only include the script if it hasn't already been included
		if (this.includes.toString().indexOf(path) == -1) {
			
			//  Write the script tag
			document.write('<script type="text/javascript" src="' + path + '"></script>');
			
			//  Append the path to the includes array
			this.includes.push(path);
			
		}
	
	},
	
	//  Sets the include path
	setIncludePath: function() {
		var scripts = document.getElementsByTagName("script");
		var scriptPath = scripts[scripts.length-1].getAttribute("src");
		this.includePath = scriptPath.substring(0, scriptPath.lastIndexOf("/"));
	},
	
	//  Get the include path
	getIncludePath: function() {
		return this.includePath;	
	}
	
};
global.setIncludePath();

//  Determine if the current browser is IE6
var isIe6 = false /*@cc_on || @_jscript_version < 5.7 @*/;

//  Include the JS library
global.include("/lib.js");

//  Include utilities library
global.include("/utils.js");

//  Include the menu object
if (isIe6) {
	global.include("/Menu.js");
}

//  Include Flash utils
global.include("/AC_RunActiveContent.js");

//  Include sIFR library
global.include("/sifr.js");
global.include("/sifr-config.js");

//  Include the CMS and PageManager objects only if in CMS mode
var cmsMode = document.getElementById("cms");
if (cmsMode) {
	global.include("/Cms.js");
	global.include("/PageManager.js");
}

//  Include Google Analytics
global.include("http://www.google-analytics.com/ga.js", false);

//  Include the config file
global.include("/config.js");

//  Include the main controller
global.include("/run.js");