Element.Events.outerClick = {
	base : 'click',
	condition : function(event){
		event.stopPropagation();
		return false;
	},
	onAdd : function(fn){
		this.getDocument().addEvent('click', fn);
	},
	onRemove : function(fn){
		this.getDocument().removeEvent('click', fn);
	}
};

Element.implement({
	addPosition: function(oPos){
		var newPos = this.getPosition();
		newPos.x += oPos.x;
		newPos.y += oPos.y;
		 this.setPosition(newPos);
		 return this;
	},
	subtractPosition: function(oPos){
		var newPos = this.getPosition();
		newPos.x -= oPos.x;
		newPos.y -= oPos.y;
		this.setPosition(newPos);
		return this;
	},
	grabProperty: function(property,elSource){
		if(elSource.getProperty(property).length){
			this.setProperty(property,elSource.getProperty(property));
			elSource.removeProperty(property);
		}
		return this;
	},
	blink: function(value,duration,property){
		if(!$defined(property))property='background-color';
		var oldVal = this.getStyle(property);
		this.set('tween',{durration:duration,link:'chain'});
		this.tween(property,value);
		this.tween(property,oldVal);
	},
	/* fix mouseenter + mousemove bug in association with dom-api */
	hasChild: function(el){
		el = document.id(el, true);
		if (!el) return false;
		if (Browser.Engine.webkit && Browser.Engine.version < 420) return $A(this.getElementsByTagName(el.tagName)).contains(el);
		/* set this.contains to null if var is dom-api function  */
		if($type(this.contains) == 'function')
			this.contains = null;
		return (this.contains) ? (this != el && this.contains(el)) : !!(this.compareDocumentPosition(el) & 16);
	}
});

/**
 * Class Extension to add the function dev, which checks if an variable is defined.
 * @class Defined
 * @author MPE
 */
var Defined = new Class(
	/** @lends Defined */
	{
	/**
	 * check if an variable is defined
	 * @param (Any) vari Variable to check if it's defined
	 * @param (Any) def Default value to use if vari is not defined
	 * @return (Any) The variable if defined or the default value if not
	 * @type Any
	 * @author MPE
	 */
	def: function(vari,def){
		if($defined(vari)){
			return vari;
		}else{
			return def;
		}
	}
});
