function include(f)
{
	this.first = this.first == true ? false : true;

	this.run = function(f)
	{
		if (this.first == true) {
			this.files = new Array(this.getFileName(f));
		}
		else {
			this.files.push(this.getFileName(f));
		}

		this.isLoaded(f) == false ? new includeIntern(f) : null;


	}

	this.isLoaded = function(f)
	{
		var o = false;

		for (var i = 0; i < this.files.length; i++) {
			o = this.files[i] == f ? true : false;
		}

		return o;
	}

	this.getFileName = function(s)
	{
		var s = new String(s);
		var w = s.split("/");
		return w[w.length-1];
	}

	this.run(f);
}

function includeIntern(f)
{
	this.script;
	this.file = f;

	this.init = function()
	{
		try{
			this.script = document.createElement('script');
			this.script.onload = function(){};
			this.script.type = 'text/javascript';
			this.script.src = this.file;
			document.getElementsByTagName('head')[0].appendChild(this.script);
		} catch(e){
			alert(e);
		}
	}

	this.init();
}

function trace(s)
{
	this.message = s;
	this.monitor;

	this.main = function()
	{
		try{
			this.monitor = document.getElementById("TG8TraceCont");
			this.monitor.innerHTML+= this.message+"<br/>";
			this.monitor.display = "block";

		} catch(e){

			try{
				this.monitor = document.createElement('div');
				this.monitor.setAttribute("id", "TG8TraceCont");

				var mS = this.monitor.style;
				mS.width  = "400px";
				mS.height = "300px";
				mS.backgroundColor = "#000000";
				mS.fontFamily = "Arial, Helvetica, _sans";
				mS.fontSize = "10px";
				mS.padding = "7px";
				mS.position = "absolute";
				mS.float = "right";
				mS.top = "100px";
				mS.right = "10px";
				mS.color = "#ffffff";

				this.addClose();

				document.getElementsByTagName('body')[0].appendChild(this.monitor);

				this.monitor.innerHTML+= this.message+"<br/>";
			} catch(e) {
				//alert(e);
			}
		}
		//alert(this.monitor.innerHTML);
	}

	this.addClose = function()
	{
		try{

			var k = this;

			var c = document.createElement('a');
			c.style.position = "absolute";
			c.style.float = "right";
			c.style.display = "block";
			c.style.padding = "5px";
			c.style.width = "10px;"
			c.style.height = "10px;"
			c.style.backgroundColor = "#ffffff";
			c.style.color = "#000000";
			c.style.fontFamily = "Arial, Helvetica, _sans";
			c.style.fontSize = "12px";
			c.style.cursor = "pointer";
			c.style.right = "5px";
			c.style.zIndex = "1000";
			c.innerHTML = "X";
			c.onmouseup = function(){alert("hallo?");};

			this.monitor.appendChild(c);
		} catch(e) {
			alert(e);
		}
	}

	this.main();
}

var OldSaf = function()
{
	return navigator.userAgent.toLowerCase().indexOf("applewebkit/3")>=0 ? true : false;
}

