Object.extend( String.prototype, {
	ucfirst: function() {
		return this.substr(0,1).toUpperCase() + this.substr(1,this.length);
	},
	isNumeric: function()
	{
		return parseFloat(this)+'' == parseFloat(this);
	},
	price: function(){
		nStr = this+'';
		x = nStr.split('.');
		x1 = x[0];
		x2 = x.length > 1 ? '.' + x[1] : '';
		var rgx = /(\d+)(\d{3})/;
		while (rgx.test(x1)) {
			x1 = x1.replace(rgx, '$1' + ',' + '$2');
		}
		return x1 + x2;
	},
	F: function()
	{
		return parseFloat( this.replace(/,/gi,'') );
	},
	round: function( r )
	{
		return this.F().toFixed( r ? r : 2 ).F();
	},
	I: function()
	{
		return parseInt( this );	
	},
	S: function()
	{
		return this+'';
	},
	urlencode: function( ) 
	{
		return encodeURIComponent(this).replace( /~/g , '%7E' ).replace( /%20/g , '+' );
	}
});

Object.extend( Number.prototype, {
	price: function(){
		nStr = this+'';
		x = nStr.split('.');
		x1 = x[0];
		x2 = x.length > 1 ? '.' + x[1] : '';
		var rgx = /(\d+)(\d{3})/;
		while (rgx.test(x1)) {
			x1 = x1.replace(rgx, '$1' + ',' + '$2');
		}
		return x1 + x2;
	},
	F: function()
	{
		return parseFloat( (this+'').replace(/,/gi,'') );	
	},
	round: function( r )
	{
		return this.toFixed( r ? r : 2 );
	},
	S: function()
	{
		return this+'';
	},
	bytes: function() 
	{
		var s = ['bytes', 'kb', 'MB', 'GB', 'TB', 'PB'];
		var e = Math.floor(Math.log(this)/Math.log(1024));
		
		return ( this / Math.pow(1024, Math.floor(e)) ).toFixed(2)+s[e];
	},
	seconds: function() 
	{
		var s = ['ms', 's', 'm', 'h'];
		var e = Math.floor( Math.log( this )/ Math.log( 1000 ) );
		
		return ( this / Math.pow( 1000 , Math.floor( e )) ).toFixed(2)+s[e];
	}
});