function NumberObj(){
	this.value = 0;
	this.get = function() 				{return this.value;}
	this.set = function(val)			{this.value = val;}
	
	this.addPos	= function(val)			{this.value += this.setPos(val);}
	this.substPos = function(val)		{this.value -= this.setPos(val);}
	this.makePos = function()			{this.value = Math.max(this.value, 0);}
	this.setWithoutComma = function(val){this.value = Number(val.replace(/,/g, ""));}
}

// Returns a number only if 
// 		it is not null
// 		and it is a number (or can be converted into a number)
//		and is greater than 0
//	If any of those conditions is not met, it will return 0
NumberObj.prototype.setPos = function(val){
	if ( val && !isNaN(Number(val)) && Number(val)>=0 )
		return Number(val);
	else
		return 0;
}

// Formats a number with commas
//	@param num as plain number, e.g. 123456789
//	@return formatted string, e.g. 123,456,789
NumberObj.prototype.getWithComma = function(){
	result = this.value+"";
	temp = "";
	
	while (Number(result)>999){
		temp =  "," + result.slice(-3) + temp; 		// add a comma and the last three digits of 'result' in front of 'temp'
		result = result.substr(0, result.length-3);	// take away the last three digits of 'result'
	}
	
	if (result>0)
		result = result + temp; // prepend the rest
	
	return result;
}



