Element.extend({

	visible: function(){
		return this.getStyle('display') == 'none' || this.getStyle('opacity') == 0 ? false : true;
	},

	hide: function(){
		return this.setStyle('display', 'none');
	},
	
	show: function(){
		return this.setOpacity(1).setStyle('display', '');
	},
	
	toggle: function(){
		return this.visible() ? this.hide() : this.show();
	},
	
	cleanWhitespace: function(){
		$A(this.childNodes).each(function(node){
			if ($type(node) == 'whitespace') this.removeChild(node);
		}, this);
		return this;
	},

	disableSelection: function(){
		if (window.ie) this.onselectstart = function(){ return false; };
		this.style.MozUserSelect = "none";
		return this;
	},
	
	getSiblings: function(){
		var children = new Array();
		this.getParent().getChildren().each(function(e){ if(e != this) children.push(e); }.bind(this));
		return children;
	},
	
	getHeight: function(){
		return this.getCoordinates().height;
	}

});


String.extend({
	zeroPad: function(num){
		return new Array(num - this.length).join('0') + this;
	}
});


