
Element.extend({
	diselected: function() {
		with (this) {
			onselectstart = function() { return false; };
			['MozUser', 'KhtmlUser', 'User'].each(function(p) {
				setStyle(p + 'Select', 'none');
			});
		}		
		return this;
	},
	/*
	 * BUG: if not is dom tree, with IE before 
	 *		center element use injectInside, example:
	 * 		
	 *		img.injectInside(container).center(container);
	 */	
	center: function(container) {
		var eoo = this.getCoordinates(), coo = container.getCoordinates(), h, w;

		// For image
		h = (eoo && eoo.height) ? eoo.height : this.height;
		w = (eoo && eoo.width) ? eoo.width : this.width;

		this.setStyles({
			'top': -(h / 2) + (coo.height / 2),
			'left': -(w / 2) + (coo.width / 2),
			'height': h,
			'width': w
		});
		return this;
	},	
	setHref: function() {
		if (this.getTag() != 'a')
			return this;
	
		this.setProperty('href', 'javascript:void(0);');
		return this;
	},
	show: function() {
		this.setStyle('display', 'block');
		return this;
	},
	hide: function() {
		this.setStyle('display', 'none');
		return this;
	}
	/*
	Replaced by hasChild()
	
	getRecursiveParent: function(element) {	
		var el = element;
		while (el != document.body) {
			if (el == this)
				return true;
				
			el = el.getParent();
		}
		return false
	}*/
});
