/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Script: extensions.js
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

if(!window.console) window.console = { 'log': $empty, 'dir': $empty };

Element.implement({

	visible: function(){
		return this.getStyle('display') == 'none' || this.getStyle('visibility') == 'hidden' ? false : true;
	},
	
	show: function(){
		return this.setStyle('display', '').set('opacity', 1);
	},
	
	hide: function(collapse){
		return collapse ? this.setStyle('display', 'none') : this.set('opacity', 0);
	},
	
	toggle: function(collapse){
		return this.visible() ? this.hide(collapse) : this.show();
	}
	
});

String.implement({

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

});

Number.implement({
	
	zeroPad: function(num){
		return this.toString().zeroPad(num);
	}
	
});
