Math.parentRound = Math.round;
Math.round = function(x, y) {
	var y = parseInt(y-1);
	y = isNaN(y) ? 1 : eval('10e'+y);
	return (Math.parentRound(x*y)/y);
}

function formatNumber(nStr) {
	nStr += '';
	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;
}

function formatAmount(amount) {
	if(Math.abs(amount) < 1e3) return amount;
	if(Math.abs(amount) < 1e6) return Math.floor(amount / 1e3)+'K';
	if(Math.abs(amount) < 1e9) return Math.floor(amount / 1e6)+'M';
	if(Math.abs(amount) < 1e12) return Math.floor(amount / 1e9)+'G';
	if(Math.abs(amount) < 1e15) return Math.floor(amount / 1e12)+'T';
	return Math.floor(amount / 1e15)+'P';
}