Element.implement({

	isVisible: function(){
		return (this.getStyle('display') || 'none') != 'none' && this.getStyle('visibility') != 'hidden';
	},

	show: function(){
		return this.setStyle('display', this.retrieve('display', '')).set('opacity', 1);
	},

	hide: function(visibility){
		if (!this.retrieve('display')){
			var display = this.getStyle('display');
			this.store('display', (display == 'none') ? 'block' : display);
		}
		return (visibility) ? this.set('opacity', 0) : this.setStyle('display', 'none');
	},

	toggle: function(visibility){
		return this[this.isVisible() ? 'hide' : 'show'](visibility);
	}

});
