Harem Heroes++

Adding things here and there in Harem Heroes game.

اعتبارا من 19-09-2017. شاهد أحدث إصدار.

// ==UserScript==
// @name			Harem Heroes++
// @namespace		haremheroes.com
// @description		Adding things here and there in Harem Heroes game.
// @version			0.04.1
// @match			http://nutaku.haremheroes.com/*
// @match			https://www.hentaiheroes.com/*
// @match			https://www.gayharem.com/*
// @run-at			document-end
// @grant			none
// @author			Raphael
// ==/UserScript==

var CurrentPage = window.location.pathname;

// css define
var sheet = (function() {
	var style = document.createElement('style');
	// style.appendChild(document.createTextNode('')); // WebKit hack :(
	document.head.appendChild(style);
	return style.sheet;
})();

FightATroll();													// added everywhere
if (CurrentPage.indexOf('shop') != -1) ModifyMarket();			// Current page: Market
else if (CurrentPage.indexOf('harem') != -1) ModifyHarem();		// Current page: Harem
else if (CurrentPage.indexOf('quest') != -1) ModifyScenes();	// Current page: Haremettes' Scenes


/* ======================
	 Fight A Troll Menu
   ====================== */

function FightATroll() {
	// Trolls' database
	var Trolls = ['Dark Lord', 'Ninja Spy', 'Gruntt', 'Edwarda', 'Donatien', 'Silvanus', 'Bremen'];

	// get current world of player
	var CurrentWorld = Hero.infos.questing.id_world - 1,
		TrollName = '',
		TrollsMenu = '';

	// generate troll list
	for (var i = 0; i < CurrentWorld; i++) {
		if (typeof Trolls[i] !== typeof undefined && Trolls[i] !== false) {
			TrollName = Trolls[i];
		} else TrollName = 'World ' + (i+1) + ' troll';
		TrollsMenu += '<a href="/battle.html?id_troll=' + (i+1) + '">' + TrollName + '</a><br />';
	}

	// display: 'Fight a troll' menu
	$('#contains_all > header > div[type=energy_fight]').append('<div id="FightTroll">Fight a Troll<span class="OverArrow"></span></div><div id="TrollsMenu">' + TrollsMenu + '</div>');

	// -----------------
	//     CSS RULES
	// -----------------

	sheet.insertRule('#FightTroll {'
						+ 'position: absolute;'
						+ 'z-index: 99;'
						+ 'width: 90%;'
						+ 'margin:21px 0 0 13px;'
						+ 'border-radius: 8px 10px 10px 8px;'
						+ 'background: rgba(102,136,153,0.67);'
						+ 'box-shadow: 0 0 0 1px rgba(255,255,255,0.73);'
						+ 'text-align: center; }');

	sheet.insertRule('#FightTroll .OverArrow {'
						+ 'float:right;'
						+ 'background-image: url("http://i.harem-battle.club/images/2017/09/19/Fmo.png");'
						+ 'background-size: 18px 18px;'
						+ 'background-repeat: no-repeat;'
						+ 'width: 18px;'
						+ 'height: 18px; }');

	sheet.insertRule('#FightTroll:hover + div {'
						+ 'display: block; }');

	sheet.insertRule('#TrollsMenu {'
						+ 'position: absolute;'
						+ 'z-index: 99;'
						+ 'width: 80%;'
						+ 'margin:39px 0 0 19px;'
						+ 'border-radius: 0px 0 8px 8px;'
						+ 'background: rgba(102,136,153,0.67);'
						+ 'text-align: center;'
						+ 'line-height: 15px;'
						+ 'display:none; }');

	sheet.insertRule('#TrollsMenu:hover {'
						+ 'display: block; }');

	sheet.insertRule('#TrollsMenu a {'
						+ 'color: rgb(218, 247, 255);'
						+ 'text-decoration: none; }');

	sheet.insertRule('#TrollsMenu a:hover {'
						+ 'color: rgb(161, 255, 242);'
						+ 'text-decoration: underline; }');
}


/* ==========
	 Market
   ========== */

function ModifyMarket() {
	// first load
	equipments_shop(0);
	boosters_shop(0);
	books_shop(0);
	gifts_shop(0);

	// catch click on Buy, Equip/Offer or Sell > update tooltip after 1.5s
	var timer,
		use_buttons = $('#shop > button[rel=buy], #inventory > button');
	use_buttons.click(function() {
		clearTimeout(timer); // kill previous update
		timer = setTimeout( function() {
			var opened_shop = $('#inventory > .selected');
			if (opened_shop.hasClass('armor')) {
				equipments_shop(1);
			} else if (opened_shop.hasClass('booster')) {
				boosters_shop(1);
			} else if (opened_shop.hasClass('potion')) {
				books_shop(1);
			} else if (opened_shop.hasClass('gift')) {
				gifts_shop(1);
			}
		}, 1500 );
    });

	function equipments_shop(update) {
		tt_create(update, 'armor', 'EquipmentsTooltip', 'equipments', '');
	}
	function boosters_shop(update) {
		tt_create(update, 'booster', 'BoostersTooltip', 'boosters', '');
	}
	function books_shop(update) {
		tt_create(update, 'potion', 'BooksTooltip', 'books', 'Xp');
	}
	function gifts_shop(update) {
		tt_create(update, 'gift', 'GiftsTooltip', 'gifts', 'affection');
	}

	// create/update tooltip
	function tt_create(update, loc_class, tt_class, itemName, itemUnit) {
		// initialize
		var itemNb = 0,
			itemXp = (itemUnit === '') ? -1 : 0,
			itemSell = 0,
			loc = $('#inventory > div.' + loc_class);

		// get stats
		loc.find('div.slot').each(function() {
			if ($(this).hasClass('empty')) return false;
			var item = $(this).data('d'),
				nb = 0;
			nb = parseInt(item.count);
			itemNb += nb;
			itemSell += nb * parseInt(item.price_sell);
			if (itemXp != -1) itemXp += nb * parseInt(item.value);
		});

		// remove old tooltip
		if (update == 1) {
			loc.children('.CustomTT').remove();
			loc.children('.' + tt_class).remove();
		}

		// add tooltip
		loc.prepend('<span class="CustomTT"></span><div class="' + tt_class + '">'
				  + 'You own <b>' + NbCommas(itemNb) + '</b> ' + itemName + '.<br />'
				  + (itemXp == -1 ? '' : 'You can give a total of <b>' + NbCommas(itemXp) + '</b> ' + itemUnit + '.<br />')
				  + 'You can sell everything for <b>' + NbCommas(itemSell) + '</b> <span class="imgMoney"></span>.'
				  + '</div>');
	}

	// -----------------
	//     CSS RULES
	// -----------------

	sheet.insertRule('#inventory .CustomTT {'
						+ 'float: right;'
						+ 'margin: 11px 1px 0 0;'
						+ 'background-image: url("http://i.harem-battle.club/images/2017/09/13/FPE.png");'
						+ 'background-size: 20px 20px;'
						+ 'width: 20px;'
						+ 'height: 20px; }');

	sheet.insertRule('#inventory .CustomTT:hover {'
						+ 'cursor: help; }');

	sheet.insertRule('#inventory .CustomTT:hover + div {'
						+ 'display: block; }');

	sheet.insertRule('#inventory .EquipmentsTooltip, #inventory .BoostersTooltip, #inventory .BooksTooltip, #inventory .GiftsTooltip {'
						+ 'position: absolute;'
						+ 'z-index: 99;'
						+ 'width: 240px;'
						+ 'border: 1px solid rgb(162, 195, 215);'
						+ 'border-radius: 8px;'
						+ 'box-shadow: 0px 0px 4px 0px rgba(0,0,0,0.1);'
						+ 'padding: 3px 7px 4px 7px;'
						+ 'background-color: #F2F2F2;'
						+ 'font: normal 10px/17px Tahoma, Helvetica, Arial, sans-serif;'
						+ 'color: #057;'
						+ 'display: none; }');

	sheet.insertRule('#inventory .EquipmentsTooltip, #inventory .BoostersTooltip {'
						+ 'margin: -33px 0 0 210px;'
						+ 'height: 43px; }');

	sheet.insertRule('#inventory .BooksTooltip, #inventory .GiftsTooltip {'
						+ 'margin: -50px 0 0 210px;'
						+ 'height: 60px; }');

	sheet.insertRule('#inventory .EquipmentsTooltip b, #inventory .BoostersTooltip b, #inventory .BooksTooltip b, #inventory .GiftsTooltip b {'
						+ 'font-weight:bold; }');

	sheet.insertRule('#inventory .imgMoney {'
						+ 'background-size: 12px 12px;'
						+ 'background-repeat: no-repeat;'
						+ 'width: 12px;'
						+ 'height: 14px;'
						+ 'vertical-align: text-bottom;'
						+ 'background-image: url("http://i.harem-battle.club/images/2017/01/07/0Gsvn.png");'
						+ 'display: inline-block; }');
}


/* =========
	 Harem
   ========= */

function ModifyHarem() {
	// initialize
	var i = 0,
		GirlId = '',
		GirlName = '',
		Anchor = '',
		Specialty = [0, 0, 0], // [Hardcore, Charm, Know-how]
		UnlockedSc = 0,
		AvailableSc = 0,
		IncHourly = 0,
		IncCollect = 0,
		HList = [],
		Saffection = 0, // S= Stats tab
		Smoney = 0,
		Skobans = 0,
		ScenesLink = '';

	var EvoReq = [];
	EvoReq.push({ affection: 15, money: 3150, kobans: 30 });
	EvoReq.push({ affection: 50, money: 6750, kobans: 90 });
	EvoReq.push({ affection: 150, money: 18000, kobans: 150 });
	EvoReq.push({ affection: 700, money: 135000, kobans: 240 });
	EvoReq.push({ affection: 1750, money: 968000, kobans: 300 });

	// parse haremettes list
	$('#harem_left div[girl]').each( function(){
		i++;

		GirlId = $(this).attr('girl');
		GirlName = $(this).find('h4').text();
		IncCollect += parseInt($(this).find('.sal').text());
		HList.push({Id: GirlId, Order: i, Name: GirlName});

		// add anchor
		$(this).attr('id', GirlName);
		// display: haremette number
		$(this).find('h4').append('<div class="HaremetteNb">' + i + '</div>');

		// is opened girl?
		if ($(this).hasClass('opened')) Anchor = GirlName;
	});
	var HaremBottom = '<a href="#' + GirlName + '">Bottom</a>';

	// auto-scroll to anchor
	location.hash = '#' + Anchor;

	// get haremettes stats & display wiki link
	i = 0;
	$('#harem_right div[girl]').each( function() {
		// display: wiki link
		$(this).append('<div class="WikiLink"><a href="http://harem-battle.club/wiki/Harem-Heroes/HH:' + HList[i].Name + '" target="_blank"> her wiki page </a></div>');
		i++;

		var j = 0,
			Taffection = 0, // T= Total requirements (right tooltip)
			Tmoney = 0,
			Tkobans = 0,
			FirstLockedScene = 1,
			AffectionTT = 'She is your <b>' + i + '</b>th haremette. Her evolution costs are:<br />',
			girl_quests = $(this).find('div.girl_quests');

		// get stats: specialty
		Spe = parseInt($(this).find('h3 span').attr('carac')) - 1;
		Specialty[Spe]++;

		// get stats: hourly income
		IncHourly += parseInt($(this).find('div.salary').text());

		girl_quests.find('g').each( function() {
			// prepare affection tooltip
			var Raffection = EvoReq[j].affection * i, // R= Required for this star (right tooltip)
				Rmoney = EvoReq[j].money * i,
				Rkobans = EvoReq[j].kobans * i;
			Taffection += Raffection;
			Tmoney += Rmoney;
			Tkobans += Rkobans;
			j++;
			AffectionTT += '<b>' + j + '</b><span class="imgStar"></span> : '
						 + NbCommas(Raffection) + ' affection, '
						 + NbCommas(Rmoney) + ' <span class="imgMoney"></span> or '
						 + NbCommas(Rkobans) + ' <span class="imgKobans"></span><br />';

			// get stats: unlocked/available scenes & prepare scenes link
			AvailableSc++;
			ScenesLink += (ScenesLink === '') ? 'hh_scenes=' : ',';
			var SceneHref = $(this).parent().attr('href');
			if ($(this).hasClass('grey')) {
				if (FirstLockedScene === 0) {
					Saffection += Raffection;
					ScenesLink += '0';
				} else {
					FirstLockedScene = 0;
					var XpLeft = girl_quests.parent().children('div.girl_exp_left');
					var isUpgradable = girl_quests.parent().children('a.green_text_button');
					// girl has Xp left
					Saffection += (XpLeft.length) ? parseInt(XpLeft.text().match(/^.*: (.*)$/)[1].replace(',','')) : 0;
					// girl is upgradable
					ScenesLink += (isUpgradable.length) ? '0.' + isUpgradable.attr('href').substr(7) : '0';
				}
				Smoney += Rmoney;
				Skobans += Rkobans;
			} else {
				UnlockedSc++;
				ScenesLink += $(this).parent().attr('href').substr(7);
			}
		});

		// change scene links
		girl_quests.children('a').each(function() {
			var attr = $(this).attr('href');
			if (typeof attr !== typeof undefined && attr !== false) {
				$(this).attr('href', attr + '?' + ScenesLink);
			}
		});
		ScenesLink = '';

		AffectionTT += '<b>Total:</b> '
					 + NbCommas(Taffection) + ' affection, '
					 + NbCommas(Tmoney) + ' <span class="imgMoney"></span> or '
					 + NbCommas(Tkobans) + ' <span class="imgKobans"></span>';

		// display: Affection costs tooltip
		girl_quests.parent().children('h4').prepend('<span class="CustomTT"></span><div class="AffectionTooltip">' + AffectionTT + '</div>');
	});

	// ### TAB: Quick List ###

	// order haremettes alphabetically
	HList.sort(function(a, b) {
		var textA = a.Name.toUpperCase(),
			textB = b.Name.toUpperCase();
		return (textA < textB) ? -1 : (textA > textB) ? 1 : 0;
	});
	// html quick list
	var len = HList.length,
		QListString = '<div id="HaremQListContainer">Quick List:<div class="CustomContainer">';
	for (i = 0; i < len; i++) {
		QListString += '<a f="ql_girl" girl="' + HList[i].Id + '" href="#' + HList[i].Name + '">' + HList[i].Name + '</a> (#' + HList[i].Order + ')<br />';
	}
	QListString += '</div></div>';

	// ### TAB: Stats ###

	StatsString = '<div id="HaremStatsContainer">Harem Stats:<div class="CustomContainer">'
				+ '<b>' + i + ' haremettes</b>'
				+ '<br />- ' + Specialty[0] + ' Hardcore'
				+ '<br />- ' + Specialty[1] + ' Charm'
				+ '<br />- ' + Specialty[2] + ' Know-how'
				+ '<br />' + UnlockedSc + '/' + AvailableSc + ' unlocked scenes'
				+ '<br />'
				+ '<br /><b>Required to unlock all locked scenes:</b>'
				+ '<br />- ' + NbCommas(Saffection) + ' affection'
				+ '<br />- ' + NbCommas(Smoney) + ' <img src="http://i.harem-battle.club/images/2017/01/07/0Gsvn.png">'
							 + ' or ' + NbCommas(Skobans) + ' <img src="http://i.harem-battle.club/images/2016/08/30/gNUo3XdY.png">'
				+ '<br />'
				+ '<br /><b>Money incomes:</b>'
				+ '<br />~' + NbCommas(IncHourly) + ' <img src="http://i.harem-battle.club/images/2017/01/07/0Gsvn.png"> per hour'
				+ '<br />' + NbCommas(IncCollect) + ' <img src="http://i.harem-battle.club/images/2017/01/07/0Gsvn.png"> when all collectable'
				+ '</div></div>';

	// add custom bar buttons/links
	$('#harem_left').append('<div id="CustomBar">'
						  + '<img f="list" src="http://i.harem-battle.club/images/2017/09/10/FRW.png">'
						  + '<img f="stats" src="http://i.harem-battle.club/images/2017/09/11/FRh.png">'
						  + '<div class="TopBottomLinks"><a href="#Bunny">Top</a>&nbsp;&nbsp;|&nbsp;&nbsp;' + HaremBottom + '</div>'
						  + '</div>');

	// add quick list div
	$('#CustomBar').append(QListString);

	// add stats div
	$('#CustomBar').append(StatsString);

	// cache
	QList = $('#HaremQListContainer');
	Stats = $('#HaremStatsContainer');

	// catch clicks
	$('body').click(function(e) {
		var clickOn = e.target.getAttribute('f');
		switch (clickOn) {
			// on quick list button
			case 'list':
				QList.toggle();
				Stats.toggle(false);
				break;
			// on stats button
			case 'stats':
				Stats.toggle();
				QList.toggle(false);
				break;
			// on a girl in quick list
			case 'ql_girl':
				var clickedGirl = e.target.getAttribute('girl');
				$('#harem_left div[girl=' + clickedGirl + ']').triggerHandler('click');
				break;
			// somewhere else except custom containers
			default:
				var clickedContainer = $(e.target).closest('[id]').attr('id');
				if (clickedContainer == 'HaremQListContainer' || clickedContainer == 'HaremStatsContainer') return;
				QList.toggle(false);
				Stats.toggle(false);
				break;
		}
    });

	// -----------------
	//     CSS RULES
	// -----------------

	sheet.insertRule('#harem_left .HaremetteNb {'
						+ 'float: right;'
						+ 'line-height: 14px;'
						+ 'font-size: 12px; }');

	sheet.insertRule('#CustomBar {'
						+ 'position: absolute;'
						+ 'z-index: 99;'
						+ 'width: 100%;'
						+ 'padding: 3px 10px 0 3px;'
						+ 'font: bold 10px Tahoma, Helvetica, Arial, sans-serif; }');

	sheet.insertRule('#CustomBar img {'
						+ 'width: 20px;'
						+ 'height: 20px;'
						+ 'margin-right: 3px; }');

	sheet.insertRule('#CustomBar img:hover {'
						+ 'cursor: pointer; }');

	sheet.insertRule('#CustomBar .TopBottomLinks {'
						+ 'float: right;'
						+ 'margin-top: 2px; }');

	sheet.insertRule('#CustomBar a, #harem_right .WikiLink a {'
						+ 'color: #057;'
						+ 'text-decoration: none; }');

	sheet.insertRule('#CustomBar a:hover, #harem_right .WikiLink a:hover {'
						+ 'color: #B14;'
						+ 'text-decoration: underline; }');

	sheet.insertRule('#HaremQListContainer, #HaremStatsContainer {'
						+ 'position: absolute;'
						+ 'z-index: 99;'
						+ 'margin: -298px 0 0 -4px;'
						+ 'width: 220px;'
						+ 'height: 275px;'
						+ 'overflow-y: scroll;'
						+ 'border: 1px solid rgb(156, 182, 213);'
						+ 'padding: 2px 0 0 3px;'
						+ 'background-color: #ffffff;'
						+ 'font: bold 12px/18px Tahoma, Helvetica, Arial, sans-serif;'
						+ 'color: #B14;'
						+ 'display: none; }');

	sheet.insertRule('#harem_right .AffectionTooltip {'
						+ 'position: absolute;'
						+ 'z-index: 99;'
						+ 'margin: -130px 0 0 -28px;'
						+ 'width: 280px;'
						+ 'height: 127px;'
						+ 'border: 1px solid rgb(162, 195, 215);'
						+ 'border-radius: 8px;'
						+ 'box-shadow: 0px 0px 4px 0px rgba(0,0,0,0.1);'
						+ 'padding: 3px 7px 4px 7px;'
						+ 'background-color: #F2F2F2;'
						+ 'font: normal 10px/17px Tahoma, Helvetica, Arial, sans-serif;;'
						+ 'text-align: left;'
						+ 'display: none; }');

	sheet.insertRule('#harem_left .CustomContainer b, #harem_right .AffectionTooltip b {'
						+ 'font-weight: bold; }');

	sheet.insertRule('#harem_left .CustomContainer {'
						+ 'padding: 3px 0 3px 6px;'
						+ 'font: normal 10px/16px Tahoma, Helvetica, Arial, sans-serif;;'
						+ 'color: #000000; }');

	sheet.insertRule('#harem_left .CustomContainer img {'
						+ 'width:14px;'
						+ 'height:14px;'
						+ 'vertical-align: text-bottom; }');

	sheet.insertRule('#harem_right .WikiLink {'
						+ 'float: right;'
						+ 'margin: -13px 7px 0 0;'
						+ 'font-size: 12px; }');

	sheet.insertRule('#harem_right .CustomTT {'
						+ 'float: right;'
						+ 'margin-left: -25px;'
						+ 'background-image: url("http://i.harem-battle.club/images/2017/09/13/FPE.png");'
						+ 'background-size: 18px 18px;'
						+ 'width: 18px;'
						+ 'height: 18px; }');

	sheet.insertRule('#harem_right .CustomTT:hover {'
						+ 'cursor: help; }');

	sheet.insertRule('#harem_right .CustomTT:hover + div {'
						+ 'display: block; }');

	sheet.insertRule('#harem_right .imgStar, #harem_right .imgMoney, #harem_right .imgKobans {'
						+ 'background-size: 10px 10px;'
						+ 'background-repeat: no-repeat;'
						+ 'width: 10px;'
						+ 'height: 14px;'
						+ 'display: inline-block; }');

	sheet.insertRule('#harem_right .imgStar {'
						+ 'background-image: url("http://i.harem-battle.club/images/2016/12/29/R9HWCKEtD.png"); }');

	sheet.insertRule('#harem_right .imgMoney {'
						+ 'background-image: url("http://i.harem-battle.club/images/2017/01/07/0Gsvn.png"); }');

	sheet.insertRule('#harem_right .imgKobans {'
						+ 'background-image: url("http://i.harem-battle.club/images/2016/08/30/gNUo3XdY.png"); }');
}


/* ==========
	 Scenes
   ========== */

function ModifyScenes() {
	var ScenesNavigate = '<div class="Scenes" style="display:block;">Navigate:<br/>',
		SceneLink = '';

	// parse GET hh_scenes variable
	var currentScene = CurrentPage.substr(7),
		hh_scenesParams = new URL(window.location.href).searchParams.get('hh_scenes'),
		hh_scenes = hh_scenesParams.split(','),
		len = hh_scenes.length;

	// no scenes or more than 5
	if (!len || len > 5) {
		return false;
	} else {
		for (var i = 0; i < len; i++ ) {
			// string format certification
			if (/^(0\.)?[0-9]{1,5}$/.test(hh_scenes[i]) === true) {
				if (hh_scenes[i] == currentScene) {
					SceneLink = '<span class="current">current</span>';
				} else if (hh_scenes[i] == '0') {
					SceneLink = '<span class="locked">locked</span>';
				} else if (parseInt(hh_scenes[i]) < 1) {
					SceneLink = '<a href="/quest/' + hh_scenes[i].substr(2) + '">unlock it!</a>';
				} else {
					SceneLink = '<a href="/quest/' + hh_scenes[i] + '?hh_scenes=' + hh_scenesParams + '">scene</a>';
				}
				ScenesNavigate += (i+1) + '<span class="imgStar"></span> ' + SceneLink + '<br />';
			}
			// string error: doesn't match (human manipulation)
			else return false;
		}
	}
	ScenesNavigate += '<span class="backToHarem">< <a href="' + $('#breadcrumbs').children('a').eq(2).attr('href') + '">Harem</a></span></div>';

	// insert navigate interface
	$('#controls').append(ScenesNavigate);

	// -----------------
	//     CSS RULES
	// -----------------

	sheet.insertRule('#controls .Scenes {'
						+ 'height:200px;'
						+ 'box-shadow: 3px 3px 0px 0px rgba(0,0,0,0.3);'
						+ 'background-color:#000000;'
						+ 'background: linear-gradient(to bottom, rgba(196,3,35,1) 0%,rgba(132,2,30,1) 51%,rgba(79,0,14,1) 100%);'
						+ 'text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.4);'
						+ 'display: block !important; }');

	sheet.insertRule('#controls .current {'
						+ 'color: rgb(251, 255, 108); }');

	sheet.insertRule('#controls .locked {'
						+ 'color: rgb(150, 99, 99); }');

	sheet.insertRule('#controls .Scenes a {'
						+ 'color: rgb(233, 142, 228);'
						+ 'text-decoration: none; }');

	sheet.insertRule('#controls .Scenes a:hover {'
						+ 'color: rgb(254, 202, 255);'
						+ 'text-decoration: underline; }');

	sheet.insertRule('#controls .backToHarem {'
						+ 'position: absolute;'
						+ 'bottom: 0;'
						+ 'left: 0;'
						+ 'width: 100%; }');

	sheet.insertRule('#controls .imgStar {'
						+ 'background-image: url("http://i.harem-battle.club/images/2016/12/29/R9HWCKEtD.png");'
						+ 'background-size: 10px 10px;'
						+ 'background-repeat: no-repeat;'
						+ 'width: 10px;'
						+ 'height: 18px;'
						+ 'display: inline-block; }');
}


// adds thousands commas
function NbCommas(x) {
	return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}