/**
	@ 장희영 hygod
	@ 윈도우 onload 이벤트를 관리함
	@ 방법 : 

		1. onLoad 시에 작동될 함수나 함수코드를 onLoadAdd 로 셋팅
			- onLoadController.onLoadAdd('온로드 될 함수이름', function () {});

			- function foo () {alert(1);}
			- onLoadController.onLoadAdd('온로드 될 함수이름', foo);

		2. onLoad 처리, onLoadAdd 에 큐에 쌓인 onload 함수들이 차례대로 이벤트 작동됨
			- onLoadController.onLoad();

		3. onLoad 의 disable | enable
			- onLoadController.onLoadActive(false | true);

		4. onLoad 의 선택적인 disable | enable
			- onLoadController.onLoadSelectActive('온로드 될 함수이름', false | true)

	@ 2010-12-10
*/

var onLoadController = {
	onLoadFuncList : {},
	onLoadActiveList : {},
	onLoadActive : true,

	onLoadSelectActive : function (name, bool) {
		this.onLoadActiveList[name] = bool;
	},

	onLoadActive : function (bool) {
		this.onLoadActive = bool;
	},

	onLoadAdd : function (name, func) {
		if (!this.onLoadFuncList[name]) {
			this.onLoadFuncList[name] = func;
			this.onLoadSelectActive(name, true);
		}
	},

	onLoad : function () {
		if (this.onLoadActive == false) {
			return;
		}

		if (this.onLoadFuncList == {}) {
			return;
		}

		funcList		= this.onLoadFuncList;
		funcActiveList	= this.onLoadActiveList;

		window.onload = function () {
			for (name in funcList) {
				if (funcActiveList[name] == true) {
					funcList[name]();
				}
			}
		}
	},

	getOnloadList : function () {
		onLoadList = null;
		
		if (this.onLoadFuncList != {}) {
			onLoadList = "";

			for (name in this.onLoadFuncList) {
				onLoadList = onLoadList + name + ":" + this.onLoadActiveList[name] + ", ";
			}
		}

		alert(onLoadList);
	}
};

