//  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;	
	},
	
	//  Import configuration data
	importConfig: function(config) {
		this.config	= config;
	}
	
};
global.setIncludePath();

//  Include the JS library
global.include("/mootools.v1.11.js");

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

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