



		/* ----------------------------------------------------------------------------------------
		 * private tags
		 */
		var EFFECT_ALL				= 0;
		var EFFECT_LEVELED    		= 1;
		var EFFECT_STEPPED    		= 2;

		var EFFECT_COLLAPSING 		= 0;
		var EFFECT_FADING     		= 4;
		var EFFECT_SHRINKING     	= 8;

		/* constants */
		var leaveDelay  = 100;
		var createDelay = 1;
		var transSteps  = 1 / 5;
		var shrinkStep  = 10;

		/* ----------------------------------------------------------------------------------------
		 */
		function setEnterEffect(entry, type, levelsdown) {
			/* call custom hook, if it exists */
			if (entry.hovereffect == EFFECT_HOOK)
				return entry.hoverparams(entry, type, levelsdown);

			/* the following only affect the hovered element */
			if (type != HOOK_HOVERED)
				return BREAK_CONTINUE;

			/* continue processing? how? */
			return BREAK_CONTINUE;
		}

		/* ----------------------------------------------------------------------------------------
		 */
		function effectFadeOut(obj) {
			var opa = appliedStyle(obj, 'opacity');

			/* if opacity becomes too small, switch to remove */
			if ((opa -= transSteps) >= transSteps) {
				obj.style.opacity = opa;

				ret = true;
			}
			else
				ret = false;

			/* spread the opacity steps to previous entries */
			while ((ps = obj.previousSibling)) {
				if ((opa += transSteps) < 1.0)
					ps.style.opacity = opa;
				else
					break;

				obj = ps;
			}

			return ret;
		}

		function effectFadeOutSingle(obj) {
			var opa = appliedStyle(obj, 'opacity');

			/* if opacity becomes too small, switch to remove */
			if ((opa -= transSteps) >= transSteps) {
				obj.style.opacity = opa;

				return true;
			}

			return false;
		}

		function effectShrinkOut(obj) {
			return effectFadeOutSingle(obj);

			var w = appliedStyle(obj, 'width');
			var h = appliedStyle(obj, 'height');
			var s = Math.max(1, idMap[obj.id].parent.sumWidth  / shrinkStep);
			var t = Math.max(1, idMap[obj.id].parent.sumHeight / shrinkStep);

			w -= s;
            h -= t;

			if ((w >= s) ||
				(h >= t)) {
//				obj.style.position = 'relative';
				obj.style.width  = Math.max(1, parseInt(w)) + 'px';
				obj.style.height = Math.max(1, parseInt(h)) + 'px';
//				obj.style.left   = ((obj.offsetWidth - parseInt(obj.style.width)) >> 1) + 'px';

				return true;
			}

			return false;
		}

		/* ----------------------------------------------------------------------------------------
		 */
		function setLeaveEffect(entry, type, levelsdown) {
			/* TODO: abort if we have grand-childs, that are open and
			 * in deconstruction (implicit, open grand-children always
			 * are in destruction)
			 */
			if (!getObj(entry.id))
				return BREAK_ABORT;

			/* the following only affect the hovered element */
			if (isLocked(entry))
				return BREAK_CONTINUE;

			/* call custom hook, if it exists */
			if (entry.leaveeffect == EFFECT_HOOK) {
				var flow = entry.leaveparams(entry, type, levelsdown);

				/* work-arround for non-returning hooks (old ones) */
				return isNaN(flow) ? BREAK_CONTINUE : flow;
			}

			/* remove entry after entry STEPPED */
			if ((entry.leaveeffect & EFFECT_STEPPED)) { try {
				/* here's the content in */
				var container = getObj(entry.id + '.container');

				/* as long as there are entries remove only the last
				 * entry and repeat
				 * if there is only one left, prevent the additional delay
				 * and pass to remove-everything
				 */
				if (container && (container.childNodes.length > 1)) {
					/* is it fade, then we reduce opacity */
					if ((entry.leaveeffect & EFFECT_FADING)) {
						if (effectFadeOut(container.lastChild))
							return BREAK_ONENTRY;
					}
					/* is it shrink, then we reduce size */
					else if ((entry.leaveeffect & EFFECT_SHRINKING)) {
						if (effectShrinkOut(container.lastChild))
							return BREAK_ONENTRY;
					}

					container.removeChild(container.lastChild);
					return BREAK_ONENTRY;
				}
			} catch(e) { return BREAK_REPEAT; } }

			/* remove entry after entry ALL */
			if (!(entry.leaveeffect & EFFECT_ALL)) { try {
				/* here's the content in */
				var container = getObj(entry.id + '.container');

				/* if there is no container pass to remove-everything */
				if (container) {
					/* is it fade, then we reduce opacity */
					if ((entry.leaveeffect & EFFECT_FADING)) {
						if (effectFadeOut(container))
							return BREAK_ONENTRY;
					}
					/* is it shrink, then we reduce size */
					else if ((entry.leaveeffect & EFFECT_SHRINKING)) {
						if (effectShrinkOut(container))
							return BREAK_ONENTRY;
					}
				}
			} catch(e) { return BREAK_REPEAT; } }

			/* continue processing? how? */
			return (entry.leaveeffect & EFFECT_LEVELED ? BREAK_ONBLOCK : BREAK_CONTINUE);
		}
