function addCommas(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;
}
/**
 * Get the rent includes display string. Dash is returned if no utilities included.
 * @param Rental listing
 * @return string
 */
function getRentalIncludes(listing)
{
	var txt = "";
	if (listing.includeElectricity == 1 && listing.includeGas == 1 && listing.includeHeat == 1 && listing.includeHotWater == 1)
		txt += "All Utilities";
	else if (listing.includeElectricity == 1 || listing.includeGas == 1 || listing.includeHeat == 1 || listing.includeHotWater == 1)
	{
		if (listing.includeElectricity == 1)
			txt += "Electricity, ";
		if (listing.includeGas == 1)
			txt += "Gas, ";
		if (listing.includeHeat == 1)
			txt += "Heat, ";
		if (listing.includeHotWater == 1)
			txt += "Hot Water, ";
		txt = txt.substring(0, txt.length - 2);
	}
	else
		txt += "-";

	return txt;
}

function getFeeDisplay(fee)
{
	if (fee == "Full Fee")
		return "No Fee";
	else if (fee == "Half Fee")
		return "Half Month";
	else if (fee == "75% Fee")
		return "Quarter Month";
	else if (fee == "Negotiable")
		return "Negotiable";
	else 
		return "Discounted";
}