// a few helping functions
function _pagePosX(e){ return (document.all) ? window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft : e.clientX + window.scrollX ; }
function _pagePosY(e){ return (document.all) ? window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop : e.clientY + window.scrollY ; }
function _absLeft(obj) { return (obj.offsetParent)? obj.offsetLeft+_absLeft(obj.offsetParent) : obj.offsetLeft; }
function _absTop(obj) { return (obj.offsetParent)? obj.offsetTop+_absTop(obj.offsetParent) : obj.offsetTop; }
function _checkForShiftKey(e){ return ( (!e && window.event.shiftKey) || (e && e.shiftKey) ); }
function _checkForCtrlKey(e){ return ( (!e && window.event.ctrlKey) || (e && e.ctrlKey) ); }
/////////////////////////////////////////////////////
// simple initDispatcher
/////////////////////////////////////////////////////
if(typeof(fncAll)=="undefined")
	var fncAll = new Array(); //global
/////////////////////////////////////////////////////
	function initAllx(){
		for(var i=0; i<fncAll.length; i++){
			eval(fncAll[i]+"();");
		}
	}
/////////////////////////////////////////////////////
	function attachAllx(fncNam){
		var notFound = true;
		for(var m=0; m<fncAll.length; m++){
			if(typeof(fncAll[m]) == fncNam){
				notFound = false;
			}
		}
		if(notFound){
			fncAll[fncAll.length] = fncNam;
		}
	}
/////////////////////////////////////////////////////
// from: http://www.scottandrew.com/weblog/articles/cbs-events
function addEvent(obj, evType, fn, useCapture){
  if (obj.addEventListener){
    obj.addEventListener(evType, fn, useCapture);
    return true;
  } else if (obj.attachEvent){
    var r = obj.attachEvent("on"+evType, fn);
    return r;
  } else {
    alert("Handler could not be attached");
  }
}
/////////////////////////////////////////////////////
function removeEvent(obj, evType, fn, useCapture){
  if (obj.removeEventListener){
    obj.removeEventListener(evType, fn, useCapture);
    return true;
  } else if (obj.detachEvent){
    var r = obj.detachEvent("on"+evType, fn);
    return r;
  } else {
    alert("Handler could not be removed");
  }
}
/////////////////////////////////////////////////////
function _noBubbling(e){
	if (document.all) {
		window.event.cancelBubble = true;
		window.event.returnValue = false;
	}else if(e.preventDefault){
		e.cancelBubble = true;
		e.stopPropagation();
		e.preventDefault();
	}
	return false;
}

