window.debug = false;
var SystemLoader = Class.create();
SystemLoader.prototype = {
	initialize : function() {
		window.taskManager = new TaskManager("javawideTaskManager");
		this.buildSystemWindows();
		this.buildTopicWindows();
	},
	buildSystemWindows : function() {
		this.createLogger();
		this.createMenu();
		this.createNotice();
		this.createMediaPlayer();
	},
	buildTopicWindows : function() {
		aWindow = this.menu.show({id : "4"});
		aWindow.toggle();
		aWindow.cannotClose();
		aWindow = this.menu.show({id : "1111"});
		aWindow.toggle();
		aWindow.cannotClose();
		aWindow = this.menu.show({id : "57"});
		aWindow.toggle();
		aWindow.cannotClose();
		aWindow = this.menu.show({id : "6"});
		aWindow.toggle();
		aWindow.cannotClose();
	},
	createMenu : function() {
		this.menu = new MenuManager({id:"menuContainer", title: "Menu Manager", state : "popup",
		icon:"style/ico/logo.png", fixedPos: "{x:0, y:0}", fixed: "{ width: 300, height: 600 }"});
		this.menu.toggleCss = "toggleMenu";
		this.menu.toggle();
	},
	createLogger : function() {
		if(window.debug) {
			window.jLog = new Window({link: "log", title: "Logger", fixed: "{width : 1024, height : 25}"});
			window.taskManager.addTask(window.jLog);
			window.jLog.setPosition({x : 0, y : (document.documentElement.clientHeight || document.body.clientHeight) - 245});
			window.jLog.cannotClose();
		}
	},
	createNotice : function() {
		var option = {
			id : "56", state : "popup",
				subtract : { heights : [$("javawideTaskManager"), $("copyright")]}
			};
		var notice = this.menu.show(option);
	},
	createMediaPlayer : function() {
		window.mediaplayer = this.menu.show({id:"54"});
		if(mediaplayer) {
			mediaplayer.cannotClose();
			setTimeout("mediaplayer.toggle();", 1);
		}
	}
};
Event.observe(window, "load", function(evt) {
	window.system = new SystemLoader();
});

Event.observe(document, "keydown", function(evt) {
	if(116 == evt.keyCode) {
//		Event.stop(evt);
//		evt.keyCode = 0;
	}
});

Event.observe(document, "contextmenu", function(evt) {
//	Event.stop(evt);
//	alert("System menu not implemented");
});