	var c = 0;
	var eConsole;
	var debug;
	var prefix = "cnet:\\> ";


	var text = "";
	var new_text = "";
	var id = 0;
	var ticktack = 0;
	var timelag = 0;
	
	var initDone = false;

	var wochentag = new Array("Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag");

	function init() {
		eConsole = document.getElementById("console");
		debug = document.getElementById("debug");
		swapConsole(mainActive, subActive);
		preloadImages();
		xtime();
		initDone = true;
	}

	function preloadImages() {
		var imageName;
		imageArray = new Array("button_infos", "button_startseite", "button_events", "button_kontakt", "pixel");
		for (var i = 0; i < imageArray.length; i++) {
			imageName = imageArray[i] + "_hl";
			self[imageName] = new Image();
			self[imageName].src = "css/" + imageName + ".gif";
		}
	}

	function retract() {
		window.clearTimeout(id);
		var speed = 25;
		var show_cursor = "_";
		var show_text = text.substr(0, c);

		eConsole.innerHTML = prefix + show_text + show_cursor;

		if (c > 0 && new_text.indexOf(show_text) == -1) {
			c--;
			id = window.setTimeout("retract()", speed);
		}
		else {
			text = new_text;
			expand(-1);
		}
	}

	function expand(cursor_blink) {
		window.clearTimeout(id);

		var speed = cursor_blink == -1 ? 25 : 450;
		var show_cursor = cursor_blink == 0 ? "" : "_";
		var show_text = text.substr(0, c);
		var next_state = c < text.length ? -1 : 1 - Math.abs(cursor_blink);

		eConsole.innerHTML = prefix + show_text + show_cursor;

		if (c < text.length) c++;
		id = window.setTimeout("expand(" + next_state + ")", speed);
	}

	function swapIcon(obj, state) {
		var mainId = obj.id.substr(7);
		if (mainActive == mainId) return;
		if (state == 1) {
			document.images[obj.name].src = self[obj.name + "_hl"].src;
			swapConsole(mainId, -1);
		}
		else {
			document.images[obj.name].src = self["pixel_hl"].src;
			swapConsole(mainActive, subActive);
		}
	}

	function swapTab(obj, state) {
		var subId = obj.id.substr(4);
		if (subActive == subId) return;
		if (state == 1) {
			obj.className = "tab_hl";
			swapConsole(mainActive, subId);
		}
		else {
			obj.className = "tab";
			swapConsole(mainActive, subActive);
		}
	}

	function swapConsole(mainId, subId) {
		window.clearTimeout(id);

		new_text = mainMenu[mainId] + (subId > -1 ? " \\ " + subMenu[mainId][subId] : "");
		retract();
	}

	function xtime()
	{
		window.clearTimeout(ticktack);
		today = new Date();
//		today.setTime(today.getTime() + 1000);
		day = today.getDate();
		month = today.getMonth()+1;
		year = today.getYear();
		if (year < 1000) year += 1900;
		hour = today.getHours();
		minutes = today.getMinutes();
		seconds = today.getSeconds();
		dow = today.getDay();

		if (day < 10) day = "0" + day;
		if (month < 10) month = "0" + month;
		if (hour < 10) hour = "0" + hour;
		if (minutes < 10) minutes = "0" + minutes;
		if (seconds < 10) seconds = "0" + seconds;
		var timeString = wochentag[dow] + " - " + day + "." + month + "." + year + "&nbsp;-&nbsp;" + hour + ":" + minutes + ":" + seconds;
		document.getElementById("datetime").innerHTML = timeString;
		ticktack = window.setTimeout("xtime()", 1000);
	}

	window.onload = init