/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	AttachEventLib.js - AttachEvent Library v1.1 - allows multiple onEvent functions
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	(c) Copyright 2003, Aleksandar Vacic, aleck@sezampro.yu, www.aplus.co.yu
	## This work is licensed under the Creative Commons Attribution-ShareAlike License.
	## To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/1.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	v1.1 -	only for ONLOAD, ONRESIZE. add other events if you need them
			Load this script at the page begin.	
			Add your functions like this:
			- AE_AttachEvent("onload", "functionName");		//	DO NOT include brackets "()"
	12. 02. 03.	-	initial release, IE5+ uses it's own attachEvent method
	22. 04. 03.	-	IE doesn't start attached functions by the order they were attached. it seems it works randomly.
					hence this code is used in IE5+ too (with added benefit that browser-detection is removed)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

function AE_AttachEventSetup(oObj) {
	oObj.aeFN = new Array();
	oObj.attachEvent = AE_AttachEventFn;
	window.onload = AE_WindowOnload;
	window.onresize = AE_WindowOnresize;
}

function AE_AttachEventFn(sEvent, fpNotify) {
	if (this.aeFN[sEvent])
		this.aeFN[sEvent][this.aeFN[sEvent].length] = fpNotify;
	else {
		this.aeFN[sEvent] = new Array();
		this.aeFN[sEvent][this.aeFN[sEvent].length] = fpNotify;
	}
}

function AE_AttachEvent(sEvent, fpNotify) {
	if (!(sEvent == "onload" || sEvent == "onresize")) return;
	AE_oWindow.attachEvent(sEvent, fpNotify);
}

function AE_PlayEvent(sEvent) {
	eval("window." + sEvent);
	if (AE_oWindow.aeFN[sEvent])
		for (var i=0;i<AE_oWindow.aeFN[sEvent].length;i++)
			eval(AE_oWindow.aeFN[sEvent][i] + "()");
}

function AE_WindowOnload() {
	AE_PlayEvent("onload");
}

function AE_WindowOnresize() {
	AE_PlayEvent("onresize");
}

var AE_oWindow = new Object();
AE_AttachEventSetup(AE_oWindow);
