var EventManager = {
	addListener:function() {
		if ( window.addEventListener ) {
			return function(el, type, fn) {
				el.addEventListener(type, fn, false);
			};
		} else if ( window.attachEvent ) {

			return function(el, type, fn) {
				var f = function() {
					caller = window.event;
					caller.target = window.event.srcElement;
					caller.pageX = window.event.clientX + document.body.scrollLeft ;
					caller.pageY = window.event.clientY + document.body.scrollTop ;
					fn.call(el, caller);
				};
				if(!el.FunctionsList) el.FunctionsList = [];
				el.FunctionsList.push([fn, f]);
				el.attachEvent('on'+type, f);
			};
		} else {
			// old Browser only 1 Event!!
			return function(el, type, fn) {
				element['on'+type] = fn;
			}
		}
	}(),
	
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

	removeListener:function() {
		if ( window.removeEventListener ) {
			return function(el, type, fn) {
				el.removeEventListener(type, fn, false);
			};
		} else if ( window.detachEvent ) {
			return function(el, type, fn) {
				for(i in el.FunctionsList){
					if(el.FunctionsList[i][0] == fn){
						el.detachEvent('on'+type, el.FunctionsList[i][1]);
						el.FunctionsList.splice(i,1);
						break;
					}
				}

			};
		} else {
			// old Browser only 1 Event!!
			return function(el, type, fn) {
				el['on'+type] = null;
			}
		}
	}()
};

