using("system.js");

function using(file) {
	if (typeof(using.path) == "undefined") {
		try {
			var scriptSource = document.evaluate("//script[contains(@src,'application.js')]", document, null, XPathResult.ANY_TYPE, null).iterateNext().src;
			using.path = scriptSource.replace(location.protocol + "//" + location.hostname, "").replace("application.js", "");
		} catch (error) {
			using.path = location.pathname;
		}
	}
	if (typeof(using[file]) == "undefined") {
		var scriptCount = document.evaluate("count(//script[contains(@src,'" + file + "')])", document, null, XPathResult.ANY_TYPE, null).numberValue;
		if (scriptCount == 0) {
			document.write('<script type="text/javascript" language="JavaScript" src="' + using.path + file + '"></script>');
		}
	}
	using[file] = true;
}

if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, index) {
	index || (index = 0);
	var length = this.length;
	for (var i = index; i < length; i++)
		if (this[i] === item) return i;
	return -1;
};

function Application() {
	this.system = new System();
}

/*
var now = new Date();
for (var i = 0; i < 10000; i++)
	
var later = new Date();
alert(later.getTime() - now.getTime());
*/