krz/world-incarceration

An interactive map of world incarceration statistics.

clone: git clone https://gitbay.org/krz/world-incarceration.git

v1: assets/js/app.js · raw

   1/* initializes the map */
   2function Init() {
   3	zingchart.loadModules("maps, maps-world-countries", function (e) {
   4		zingchart.render({
   5			height: 800,
   6			width: "100%",
   7			id: "myChart",
   8			data: myConfig,
   9		});
  10	});
  11}
  12window.onload = Init;
  13
  14/* custom configuration for the map options */
  15var myConfig = {
  16	backgroundColor: "#161616",
  17	shapes: [
  18		{
  19			type: "zingchart.maps",
  20			options: {
  21				name: "world.countries",
  22				ignore: ["ATA", "FLK", "ATF", "VUT", "WEB"],
  23				zooming: true,
  24				panning: true,
  25				scrolling: true,
  26				style: {
  27					cursor: "hand",
  28					backgroundColor: "rgba(36, 171, 72, 0.8)",
  29					label: {
  30						visible: false,
  31					},
  32					tooltip: {
  33						"html-mode": true,
  34						"border-color": "#24ab48",
  35						"border-width": "2px",
  36						text: customTooltip,
  37					},
  38					controls: {
  39						visible: false,
  40					},
  41				},
  42			},
  43		},
  44	],
  45};
  46
  47/* toggles country labels */
  48function countryLabels() {
  49	if (myConfig.shapes[0].options.style.label.visible === false) {
  50		myConfig.shapes[0].options.style.label.visible = true;
  51		myConfig.shapes[0].options.style.label.color = "#ffffff";
  52	} else {
  53		myConfig.shapes[0].options.style.label.visible = false;
  54	}
  55	zingchart.exec("myChart", "setdata", {
  56		data: myConfig,
  57	});
  58}
  59
  60/* prepares for color gradient maps */
  61var myMinMax = {};
  62var myShortcut = ["pop", "rate", "females", "juveniles", "occupancy"];
  63var gradientVal = 0;
  64var chartColor = "rgb(255, 255, 255)";
  65
  66var gradientChart = {
  67	backgroundColor: "#161616",
  68	shapes: [
  69		{
  70			type: "zingchart.maps",
  71			options: {
  72				name: "world.countries",
  73				ignore: ["ATA", "FLK", "ATF", "VUT", "WEB"],
  74				zooming: true,
  75				panning: true,
  76				scrolling: true,
  77				style: {
  78					items: {
  79						AFG: {
  80							backgroundColor: "rgb(255, 255, 255)",
  81						},
  82					},
  83					cursor: "hand",
  84					backgroundColor: chartColor,
  85					opacity: gradientVal,
  86					label: {
  87						visible: false,
  88					},
  89					tooltip: {
  90						"html-mode": true,
  91						"border-color": "#24ab48",
  92						"border-width": "2px",
  93						text: customTooltip,
  94					},
  95					controls: {
  96						visible: false,
  97					},
  98				},
  99			},
 100		},
 101	],
 102};
 103
 104function gradientPrep() {
 105	var myVal = [];
 106	for (var n = 0; n < myShortcut.length; n++) {
 107		Object.keys(data).forEach((key, index) => {
 108			const check = data[key][myShortcut[n]];
 109			const num = isNaN(check) ? null : check;
 110			myVal[index] = num;
 111		});
 112		myMinMax[n] = [
 113			Math.min.apply(null, myVal),
 114			Math.max.apply(null, myVal),
 115		];
 116	}
 117}
 118
 119const numberRound = (x, y) => Math.round(x * Math.pow(10, y)) / Math.pow(10, y);
 120
 121function gradient(n) {
 122	var maxValue = myMinMax["" + n]["1"];
 123	Object.keys(data).forEach((key, index) => {
 124		const check = data[key][myShortcut[n]];
 125		const num = isNaN(check) ? 0 : check;
 126		gradientVal = numberRound(255 - (num / maxValue) * 255, 0);
 127		chartColor = "rgb(255, " + gradientVal + ", " + gradientVal + ")";
 128		gradientChart.shapes[0].options.style.items[key] = {
 129			backgroundColor: chartColor,
 130		};
 131		gradientChart.shapes[0].options.style.items[key].backgroundColor =
 132			chartColor;
 133	});
 134	zingchart.exec("myChart", "setdata", {
 135		data: gradientChart,
 136	});
 137}
 138
 139// Map configuration settings
 140var customTooltip =
 141	"<div style='text-align:center;font-weight:bold;font-size:14px;'>" +
 142	"%long-text" +
 143	"</div>";
 144zingchart.MODULESDIR = "https://cdn.zingchart.com/modules/";
 145ZC.LICENSE = [
 146	"569d52cefae586f634c54f86dc99e6a9",
 147	"ee6b7db5b51705a13dc2339db3edaf6d",
 148];
 149
 150// Secondary chart configuration
 151var myConfig2 = {
 152	"background-color": "#000",
 153	type: "pie",
 154	"scale-r": {
 155		aperature: 198,
 156		"ref-angle": 200 /*relative to starting 90 degree position*/,
 157	},
 158	legend: {
 159		x: "85%",
 160		y: "8%",
 161		"border-width": "3px",
 162		"border-color": "#2B313B",
 163		"border-radius": "5px",
 164		"font-size": "16px",
 165		header: {
 166			text: "Legend",
 167			"font-size": "18px",
 168			"font-color": "#0003cc",
 169			"font-weight": "normal",
 170		},
 171		marker: {
 172			type: "circle",
 173		},
 174		"toggle-action": "remove",
 175	},
 176	plot: {
 177		thousandsSeparator: ",",
 178		detach: false,
 179		cursor: "hand",
 180		borderColor: "#2B313B",
 181		borderWidth: 5,
 182		animation: {
 183			"on-legend-toggle": true,
 184			/* set to true to show animation and false to turn off */
 185			effect: 5,
 186			method: 1,
 187			sequence: 1,
 188			speed: 0.5,
 189		},
 190		"value-box": {
 191			text: "<b>%t:</b> %v",
 192			"font-size": 15,
 193			"font-weight": "normal",
 194		},
 195		tooltip: {
 196			text: "%t: %npv%",
 197			"font-color": "black",
 198			"font-family": "Georgia",
 199			"font-size": "17px",
 200			"text-alpha": 1,
 201			"background-color": "white",
 202			alpha: 0.8,
 203			"border-color": "#2B313B",
 204			"border-width": "2px",
 205			"border-radius": "7px",
 206			padding: "10%",
 207		},
 208	},
 209	series: [
 210		{
 211			values: [2145100],
 212			text: "United States",
 213			backgroundColor: "#0062ff",
 214		},
 215		{
 216			values: [1649804],
 217			text: "China",
 218			backgroundColor: "#da1e28",
 219		},
 220		{
 221			values: [657680],
 222			text: "Brazil",
 223			backgroundColor: "#fdd13a",
 224		},
 225		{
 226			values: [609485],
 227			text: "Russia",
 228			backgroundColor: "#24ab48",
 229		},
 230		{
 231			values: [419623],
 232			text: "India",
 233			backgroundColor: "#9966ff",
 234		},
 235		{
 236			values: [4564562],
 237			text: "Rest of the World",
 238			backgroundColor: "#606e85",
 239			"data-id": "wo",
 240		},
 241	],
 242};
 243zingchart.render({
 244	id: "myChart2",
 245	data: myConfig2,
 246	height: 770,
 247	width: "100%",
 248});
 249
 250// Drilldown charts within pie chart
 251var myDrilldownConfig = [];
 252
 253// Set drilldown chart configurations
 254myDrilldownConfig[0] = {
 255	backgroundColor: "#000",
 256	type: "line",
 257	title: {
 258		fontColor: "#ffffff",
 259		text: "United States",
 260	},
 261	subtitle: {
 262		fontColor: "#ffffff",
 263		text: "Prison Population Trend",
 264		fontWeight: "normal",
 265	},
 266	plot: {
 267		lineColor: "#0062ff",
 268		lineWidth: 3,
 269		marker: {
 270			backgroundColor: "#0062ff",
 271			size: 6,
 272		},
 273	},
 274	scaleX: {
 275		item: {
 276			fontSize: 14,
 277			fontColor: "#ffffff",
 278		},
 279		lineWidth: 3,
 280		lineColor: "#ffffff",
 281		tick: {
 282			lineWidth: 3,
 283			lineColor: "#ffffff",
 284		},
 285		labels: [
 286			"2000",
 287			"2002",
 288			"2004",
 289			"2006",
 290			"2008",
 291			"2010",
 292			"2012",
 293			"2014",
 294		],
 295	},
 296	scaleY: {
 297		lineWidth: 3,
 298		lineColor: "#ffffff",
 299		tick: {
 300			lineWidth: 3,
 301			lineColor: "#ffffff",
 302		},
 303		item: {
 304			fontSize: 14,
 305			fontColor: "#ffffff",
 306			padding: "2.5%",
 307			angle: -90,
 308		},
 309		values: "1900000:2400000:100000",
 310		thousandsSeparator: ",",
 311		guide: {
 312			lineStyle: "dotted",
 313		},
 314	},
 315	crosshairX: {
 316		plotLabel: {
 317			text: "%v prisoners",
 318			fontSize: 15,
 319			borderRadius: 3,
 320		},
 321		scaleLabel: {
 322			backgroundColor: "#53535e",
 323			fontColor: "#ffffff",
 324			fontSize: 14,
 325			borderRadius: 3,
 326		},
 327		marker: {
 328			size: 8,
 329			alpha: 0.5,
 330		},
 331	},
 332	series: [
 333		{
 334			values: [
 335				1937482, 2033022, 2135335, 2258792, 2307504, 2270142, 2228424,
 336				2217947,
 337			],
 338			thousandsSeparator: ",",
 339		},
 340	],
 341};
 342myDrilldownConfig[1] = {
 343	backgroundColor: "#000",
 344	type: "line",
 345	title: {
 346		text: "China",
 347		fontColor: "#ffffff",
 348	},
 349	subtitle: {
 350		text: "Prison Population Trend",
 351		fontWeight: "normal",
 352		fontColor: "#ffffff",
 353	},
 354	plot: {
 355		lineColor: "#da1e28",
 356		lineWidth: 3,
 357		marker: {
 358			backgroundColor: "#da1e28",
 359			size: 6,
 360		},
 361	},
 362	scaleX: {
 363		item: {
 364			fontSize: 14,
 365			fontColor: "#ffffff",
 366		},
 367		lineWidth: 3,
 368		lineColor: "#ffffff",
 369		tick: {
 370			lineWidth: 3,
 371			lineColor: "#ffffff",
 372		},
 373		labels: [
 374			"2000",
 375			"2002",
 376			"2004",
 377			"2006",
 378			"2008",
 379			"2010",
 380			"2012",
 381			"2014",
 382		],
 383	},
 384	scaleY: {
 385		lineWidth: 3,
 386		lineColor: "#ffffff",
 387		tick: {
 388			lineWidth: 3,
 389			lineColor: "#ffffff",
 390		},
 391		item: {
 392			fontSize: 14,
 393			fontColor: "#ffffff",
 394			padding: "2.5%",
 395			angle: -90,
 396		},
 397		values: "1400000:1800000:100000",
 398		thousandsSeparator: ",",
 399		guide: {
 400			lineStyle: "dotted",
 401		},
 402	},
 403	crosshairX: {
 404		plotLabel: {
 405			text: "%v prisoners",
 406			fontSize: 15,
 407			borderRadius: 3,
 408		},
 409		scaleLabel: {
 410			backgroundColor: "#53535e",
 411			fontColor: "#ffffff",
 412			fontSize: 14,
 413			borderRadius: 3,
 414		},
 415		marker: {
 416			size: 8,
 417			alpha: 0.5,
 418		},
 419	},
 420	series: [
 421		{
 422			values: [
 423				1427407, 1512194, 1583006, 1710641, 1735822, 1650000, 1657963,
 424				1657812,
 425			],
 426			thousandsSeparator: ",",
 427		},
 428	],
 429};
 430myDrilldownConfig[2] = {
 431	backgroundColor: "#000",
 432	type: "line",
 433	title: {
 434		text: "Brazil",
 435		fontColor: "#ffffff",
 436	},
 437	subtitle: {
 438		text: "Prison Population Trend",
 439		fontWeight: "normal",
 440		fontColor: "#ffffff",
 441	},
 442	plot: {
 443		lineColor: "#fdd13a",
 444		lineWidth: 3,
 445		marker: {
 446			backgroundColor: "#fdd13a",
 447			size: 6,
 448		},
 449	},
 450	scaleX: {
 451		item: {
 452			fontSize: 14,
 453			fontColor: "#ffffff",
 454		},
 455		lineWidth: 3,
 456		lineColor: "#ffffff",
 457		tick: {
 458			lineWidth: 3,
 459			lineColor: "#ffffff",
 460		},
 461		labels: [
 462			"2000",
 463			"2002",
 464			"2004",
 465			"2006",
 466			"2008",
 467			"2010",
 468			"2012",
 469			"2014",
 470			"2016",
 471		],
 472	},
 473	scaleY: {
 474		lineWidth: 3,
 475		lineColor: "#ffffff",
 476		tick: {
 477			lineWidth: 3,
 478			lineColor: "#ffffff",
 479		},
 480		item: {
 481			fontSize: 14,
 482			fontColor: "#ffffff",
 483			padding: "2.5%",
 484			angle: -90,
 485		},
 486		values: "200000:650000:50000",
 487		thousandsSeparator: ",",
 488		guide: {
 489			lineStyle: "dotted",
 490		},
 491	},
 492	crosshairX: {
 493		plotLabel: {
 494			text: "%v prisoners",
 495			fontSize: 15,
 496			borderRadius: 3,
 497		},
 498		scaleLabel: {
 499			backgroundColor: "#53535e",
 500			fontColor: "#ffffff",
 501			fontSize: 14,
 502			borderRadius: 3,
 503		},
 504		marker: {
 505			size: 8,
 506			alpha: 0.5,
 507		},
 508	},
 509	series: [
 510		{
 511			values: [
 512				232755, 239345, 336358, 401236, 451429, 496251, 548003, 622202,
 513				644575,
 514			],
 515			thousandsSeparator: ",",
 516		},
 517	],
 518};
 519myDrilldownConfig[3] = {
 520	backgroundColor: "#000",
 521	type: "line",
 522	title: {
 523		text: "Russian Federation",
 524		fontColor: "#ffffff",
 525	},
 526	subtitle: {
 527		text: "Prison Population Trend",
 528		fontWeight: "normal",
 529		fontColor: "#ffffff",
 530	},
 531	plot: {
 532		lineColor: "#24ab48",
 533		lineWidth: 3,
 534		marker: {
 535			backgroundColor: "#24ab48",
 536			size: 6,
 537		},
 538	},
 539	scaleX: {
 540		item: {
 541			fontSize: 14,
 542			fontColor: "#ffffff",
 543		},
 544		lineWidth: 3,
 545		lineColor: "#ffffff",
 546		tick: {
 547			lineWidth: 3,
 548			lineColor: "#ffffff",
 549		},
 550		labels: [
 551			"2000",
 552			"2002",
 553			"2004",
 554			"2006",
 555			"2008",
 556			"2010",
 557			"2012",
 558			"2014",
 559			"2014",
 560		],
 561	},
 562	scaleY: {
 563		lineWidth: 3,
 564		lineColor: "#ffffff",
 565		tick: {
 566			lineWidth: 3,
 567			lineColor: "#ffffff",
 568		},
 569		item: {
 570			fontSize: 14,
 571			fontColor: "#ffffff",
 572			padding: "2.5%",
 573			angle: -90,
 574		},
 575		values: "600000:1200000:50000",
 576		thousandsSeparator: ",",
 577		guide: {
 578			lineStyle: "dotted",
 579		},
 580	},
 581	crosshairX: {
 582		plotLabel: {
 583			text: "%v prisoners",
 584			fontSize: 15,
 585			borderRadius: 3,
 586		},
 587		scaleLabel: {
 588			backgroundColor: "#53535e",
 589			fontColor: "#ffffff",
 590			fontSize: 14,
 591			borderRadius: 3,
 592		},
 593		marker: {
 594			size: 8,
 595			alpha: 0.5,
 596		},
 597	},
 598	series: [
 599		{
 600			values: [
 601				1060404, 980151, 847004, 823403, 883436, 864197, 755651, 677287,
 602				646085,
 603			],
 604			thousandsSeparator: ",",
 605		},
 606	],
 607};
 608myDrilldownConfig[4] = {
 609	backgroundColor: "#000",
 610	type: "line",
 611	title: {
 612		text: "India",
 613		fontColor: "#ffffff",
 614	},
 615	subtitle: {
 616		text: "Prison Population Trend",
 617		fontWeight: "normal",
 618		fontColor: "#ffffff",
 619	},
 620	plot: {
 621		lineColor: "#9966ff",
 622		lineWidth: 3,
 623		marker: {
 624			backgroundColor: "#9966ff",
 625			size: 6,
 626		},
 627	},
 628	scaleX: {
 629		item: {
 630			fontSize: 14,
 631			fontColor: "#ffffff",
 632		},
 633		lineWidth: 3,
 634		lineColor: "#ffffff",
 635		tick: {
 636			lineWidth: 3,
 637			lineColor: "#ffffff",
 638		},
 639		labels: [
 640			"2000",
 641			"2002",
 642			"2004",
 643			"2006",
 644			"2008",
 645			"2010",
 646			"2012",
 647			"2014",
 648		],
 649	},
 650	scaleY: {
 651		lineWidth: 3,
 652		lineColor: "#ffffff",
 653		tick: {
 654			lineWidth: 3,
 655			lineColor: "#ffffff",
 656		},
 657		item: {
 658			fontSize: 14,
 659			fontColor: "#ffffff",
 660			padding: "2.5%",
 661			angle: -90,
 662		},
 663		values: "250000:450000:25000",
 664		thousandsSeparator: ",",
 665		guide: {
 666			lineStyle: "dotted",
 667		},
 668	},
 669	crosshairX: {
 670		plotLabel: {
 671			text: "%v prisoners",
 672			fontSize: 15,
 673			borderRadius: 3,
 674		},
 675		scaleLabel: {
 676			backgroundColor: "#53535e",
 677			fontColor: "#ffffff",
 678			fontSize: 14,
 679			borderRadius: 3,
 680		},
 681		marker: {
 682			size: 8,
 683			alpha: 0.5,
 684		},
 685	},
 686	series: [
 687		{
 688			values: [
 689				272079, 322357, 331391, 373271, 384753, 368998, 385135, 418536,
 690			],
 691			thousandsSeparator: ",",
 692		},
 693	],
 694};
 695
 696// Loads drilldown chart onclick
 697zingchart.node_click = function (e) {
 698	if (e.id === "myChart2") {
 699		if (e["data-id"] === "wo") {
 700			null;
 701		} else {
 702			zingchart.exec("myChart2", "destroy");
 703			zingchart.render({
 704				id: "myNextChart",
 705				data: myDrilldownConfig[e.plotindex],
 706				/*to reference the drilldown charts*/
 707				height: 500,
 708				width: "100%",
 709			});
 710		}
 711	} else if (e.id === "myNextChart") {
 712		zingchart.exec("myNextChart", "destroy");
 713		zingchart.render({
 714			id: "myChart2",
 715			data: myConfig2,
 716			height: 770,
 717			width: "100%",
 718		});
 719	}
 720};
 721
 722/* reset zoom back to full map */
 723function reset() {
 724	zingchart.render({
 725		height: 800,
 726		width: "100%",
 727		id: "myChart",
 728		data: myConfig,
 729	});
 730}
 731
 732/* opens the stats modal for each country */
 733zingchart.shape_click = function (e) {
 734	const newPopulation = isNaN(data[e.shapeid].pop)
 735		? "<span class='text-danger'>Information not available.</span>"
 736		: data[e.shapeid].pop.toLocaleString("en");
 737	const newRate = isNaN(data[e.shapeid].rate)
 738		? "<span class='text-danger'>Information not available.</span>"
 739		: data[e.shapeid].rate;
 740	const newFemales = isNaN(data[e.shapeid].females)
 741		? "<span class='text-danger'>Information not available.</span>"
 742		: (data[e.shapeid].females * 100).toFixed(2).concat(" %");
 743	const newJuveniles = isNaN(data[e.shapeid].juveniles)
 744		? "<span class='text-danger'>Information not available.</span>"
 745		: (data[e.shapeid].juveniles * 100).toFixed(2).concat(" %");
 746	const newOccupancy = isNaN(data[e.shapeid].occupancy)
 747		? "<span class='text-danger'>Information not available.</span>"
 748		: (data[e.shapeid].occupancy * 100).toFixed(2).concat(" %");
 749	var newModal =
 750		"<div class='modal fade' role='dialog'><div class='modal-dialog'><div class='modal-content'><div class='modal-header'><h4 class='modal-title'>" +
 751		data[e.shapeid].country +
 752		"</h4></div><div class='modal-body'><p><b>Prison Population:</b> " +
 753		newPopulation +
 754		"</p><p><b>Rate per 100,000 Citizens:</b> " +
 755		newRate +
 756		"</p><p><b>Females:</b> " +
 757		newFemales +
 758		"</p><p><b>Juveniles:</b> " +
 759		newJuveniles +
 760		"</p><p><b>Occupancy:</b> " +
 761		newOccupancy +
 762		"</p><p><b>Government:</b> " +
 763		data[e.shapeid].government +
 764		"</p></div><div class='modal-footer'><button type='button' class='btn btn-outline-success' data-dismiss='modal'>Close</button></div></div></div></div>";
 765	$(newModal).modal({
 766		show: false,
 767	});
 768	$(newModal).modal("show");
 769};
 770
 771/* comparison function #1 - creates selection modal */
 772function compare() {
 773	var str = "";
 774	Object.keys(data).forEach(function (key, index) {
 775		str +=
 776			"<option value=" + key + ">" + data[key]["country"] + "</option>";
 777	});
 778	/* this will create a modal with options to choose the two countries to compare */
 779	var modalPopup =
 780		"<div id='modal-popup' class='modal fade' role='dialog'><div class='modal-dialog modal-lg'><div class='modal-content'><div class='modal-header bg-success d-flex justify-content-between align-items-center' style='background-color:#24ab48'><h4 class='modal-title'>Country Comparison</h4><a href='#' onclick='questionModal()'><i id='qIcon' class='far fa-question-circle' style='color:#ffffff;font-size:18px;float:right;'></i></a></div><div class='modal-body'><div id='modalAlertDiv'></div><div class='row'><div class='col-md-6'><select id='select1'>" +
 781		str +
 782		"</select></div><div class='col-md-6'><select id='select2'>" +
 783		str +
 784		"</select></div></div></div><div class='modal-footer'><button type='button' class='btn btn-success' id='comparebtn' onclick='compare2()'>Compare!</button><button type='button' class='btn btn-outline-success' data-dismiss='modal'>Close</button></div></div></div></div>";
 785	$(modalPopup).modal({
 786		show: false,
 787	});
 788	$(modalPopup).modal("show");
 789}
 790
 791/* comparison function #2 - creates comparison modal */
 792function compare2() {
 793	var country1 = $("#select1 option:selected").val();
 794	var country2 = $("#select2 option:selected").val();
 795
 796	if (country1 === country2) {
 797		$("#modalAlertDiv").html(
 798			"<div class='alert alert-danger'><a href='#' class='close' data-dismiss='alert' aria-label='close'>&times;</a><strong>Oops!</strong> You chose to compare the same country. Try selecting two different countries.</div>"
 799		);
 800	} else {
 801		$("#modalAlertDiv").empty();
 802		/* variables for country1 */
 803		const newPopulation1 = isNaN(data[country1]["pop"])
 804			? "<span class='text-danger'>Information not available.</span>"
 805			: data[country1]["pop"].toLocaleString("en");
 806		const newRate1 = isNaN(data[country1]["rate"])
 807			? "<span class='text-danger'>Information not available.</span>"
 808			: data[country1]["rate"];
 809		const newFemales1 = isNaN(data[country1]["females"])
 810			? "<span class='text-danger'>Information not available.</span>"
 811			: (data[country1]["females"] * 100).toFixed(2).concat(" %");
 812		const newJuveniles1 = isNaN(data[country1]["juveniles"])
 813			? "<span class='text-danger'>Information not available.</span>"
 814			: (data[country1]["juveniles"] * 100).toFixed(2).concat(" %");
 815		const newOccupancy1 = isNaN(data[country1]["occupancy"])
 816			? "<span class='text-danger'>Information not available.</span>"
 817			: (data[country1]["occupancy"] * 100).toFixed(2).concat(" %");
 818		/* variables for country2 */
 819		const newPopulation2 = isNaN(data[country2]["pop"])
 820			? "<span class='text-danger'>Information not available.</span>"
 821			: data[country2]["pop"].toLocaleString("en");
 822		const newRate2 = isNaN(data[country2]["rate"])
 823			? "<span class='text-danger'>Information not available.</span>"
 824			: data[country2]["rate"];
 825		const newFemales2 = isNaN(data[country2]["females"])
 826			? "<span class='text-danger'>Information not available.</span>"
 827			: (data[country2]["females"] * 100).toFixed(2).concat(" %");
 828		const newJuveniles2 = isNaN(data[country2]["juveniles"])
 829			? "<span class='text-danger'>Information not available.</span>"
 830			: (data[country2]["juveniles"] * 100).toFixed(2).concat(" %");
 831		const newOccupancy2 = isNaN(data[country2]["occupancy"])
 832			? "<span class='text-danger'>Information not available.</span>"
 833			: (data[country2]["occupancy"] * 100).toFixed(2).concat(" %");
 834
 835		var newModalPopup =
 836			"<div class='fade modal' role=dialog><div class='modal-dialog modal-lg'><div class='modal-content'><div class='modal-header bg-success'><h4 class=modal-title>Side-By-Side Comparison</h4></div><div class=modal-body><table class='table'><thead><tr><th></th><th>" +
 837			data[country1]["country"] +
 838			"</th><th>" +
 839			data[country2]["country"] +
 840			"</th></thead><tbody><tr><td><b>Prison Population:</b></td><td>" +
 841			newPopulation1 +
 842			"</td><td>" +
 843			newPopulation2 +
 844			"</td></tr><tr><td><b>Rate per 100,000 Citizens:<b></td><td>" +
 845			newRate1 +
 846			"</td><td>" +
 847			newRate2 +
 848			"</td></tr><tr><td><b>Females:<b></td><td>" +
 849			newFemales1 +
 850			"</td><td>" +
 851			newFemales2 +
 852			"</td></tr><tr><td><b>Juveniles:</b></td><td>" +
 853			newJuveniles1 +
 854			"</td><td>" +
 855			newJuveniles2 +
 856			"</td></tr><tr><td><b>Occupancy:</b></td><td>" +
 857			newOccupancy1 +
 858			"</td><td>" +
 859			newOccupancy2 +
 860			"</td></tr><tr><td><b>Government:</b></td><td>" +
 861			data[country1]["government"] +
 862			"</td><td>" +
 863			data[country2]["government"] +
 864			"</td></tr></tbody></table></div><div class=modal-footer><button class='btn btn-outline-success' data-dismiss=modal type=button>Close</button></div></div></div></div>";
 865		$(newModalPopup).modal({
 866			show: false,
 867		});
 868		$(newModalPopup).modal("show");
 869		$("#modal-popup").modal({
 870			show: false,
 871		});
 872	}
 873}
 874
 875function graphInfoBtn() {
 876	var graphInfo =
 877		"<div class='fade modal' role=dialog><div class='modal-dialog modal-lg'><div class=modal-content><div class='modal-header bg-secondary text-dark'><h4 class=modal-title>Just a Tip!</h4></div><div class=modal-body><i style='color:#da1e28'><b>Did you know...</b></i> you can click any country's pie segment to see a trend of their recent incarceration populations!<hr style='border-top: dotted 1px;'/><i style='color:#da1e28'><b>Did you know...</b></i> you can click any point on the line graphs to return to the pie chart.</div><div class=modal-footer><button class='btn btn-secondary' data-dismiss=modal type=button>Close</button></div></div></div></div>";
 878	$(graphInfo).modal({
 879		show: false,
 880	});
 881	$(graphInfo).modal("show");
 882}
 883
 884function questionModal() {
 885	var questionModal =
 886		"<div class='modal fade' role='dialog'> <div class='modal-dialog modal-lg'> <div class='modal-content'> <div class='modal-header bg-success'><h4 class='modal-title'>Stuck?</h4></div><div class='modal-body'><p><b>Just a tip:</b> If the countries aren't changing in the comparison modal after you select new countries from the dropdown menus, just refresh the page and it should work!</p></div><div class='modal-footer'><button type='button' class='btn btn-outline-success' data-dismiss='modal'>Close</button></div></div></div></div>";
 887	$(questionModal).modal({
 888		show: false,
 889	});
 890	$(questionModal).modal("show");
 891}
 892
 893/* data for each country */
 894var data = {
 895	AFG: {
 896		country: "Afghanistan",
 897		pop: 27527,
 898		rate: 75,
 899		females: 0.028,
 900		juveniles: 0.04,
 901		occupancy: 1.9,
 902		government: "Presidential Islamic Republic",
 903	},
 904	ALB: {
 905		country: "Albania",
 906		pop: 5447,
 907		rate: 189,
 908		females: 0.019,
 909		juveniles: 0.012,
 910		occupancy: 1.058,
 911		government: "Parliamentary Republic",
 912	},
 913	DZA: {
 914		country: "Algeria",
 915		pop: 61000,
 916		rate: 155,
 917		females: 0.017,
 918		juveniles: 0.007,
 919		occupancy: 0.893,
 920		government: "Presidential Republic",
 921	},
 922	AGO: {
 923		country: "Angola",
 924		pop: 24165,
 925		rate: 96,
 926		females: 0.036,
 927		juveniles: "--",
 928		occupancy: 1.108,
 929		government: "Presidential Republic",
 930	},
 931	ARG: {
 932		country: "Argentina",
 933		pop: 72693,
 934		rate: 167,
 935		females: 0.041,
 936		juveniles: 0,
 937		occupancy: 1.062,
 938		government: "Presidential Republic",
 939	},
 940	ARM: {
 941		country: "Armenia",
 942		pop: 4873,
 943		rate: 162,
 944		females: 0.044,
 945		juveniles: 0.002,
 946		occupancy: 1.063,
 947		government: "Parliamentary Democracy",
 948	},
 949	AUS: {
 950		country: "Australia",
 951		pop: 41237,
 952		rate: 168,
 953		females: 0.081,
 954		juveniles: 0.001,
 955		occupancy: 0.96,
 956		government: "Parliamentary Democracy",
 957	},
 958	AUT: {
 959		country: "Austria",
 960		pop: 8290,
 961		rate: 94,
 962		females: 0.057,
 963		juveniles: 0.014,
 964		occupancy: 0.949,
 965		government: "Federal Parliamentary Republic",
 966	},
 967	AZE: {
 968		country: "Azerbaijan",
 969		pop: 23311,
 970		rate: 239,
 971		females: 0.031,
 972		juveniles: 0.003,
 973		occupancy: 0.949,
 974		government: "Presidential Republic",
 975	},
 976	BHS: {
 977		country: "Bahamas",
 978		pop: 1727,
 979		rate: 439,
 980		females: 0.032,
 981		juveniles: "--",
 982		occupancy: 1.727,
 983		government: "Parliamentary Democracy",
 984	},
 985	BGD: {
 986		country: "Bangladesh",
 987		pop: 78578,
 988		rate: 48,
 989		females: 0.038,
 990		juveniles: 0.004,
 991		occupancy: 2.146,
 992		government: "Parliamentary Republic",
 993	},
 994	BLR: {
 995		country: "Belarus",
 996		pop: 29776,
 997		rate: 314,
 998		females: 0.075,
 999		juveniles: 0.003,
1000		occupancy: 0.834,
1001		government: "Presidential Republic/Dictatorship",
1002	},
1003	BEL: {
1004		country: "Belgium",
1005		pop: 10619,
1006		rate: 94,
1007		females: 0.046,
1008		juveniles: 0.006,
1009		occupancy: 1.096,
1010		government: "Federal Parliamentary Democracy",
1011	},
1012	BLZ: {
1013		country: "Belize",
1014		pop: 1297,
1015		rate: 356,
1016		females: 0.035,
1017		juveniles: 0.031,
1018		occupancy: 0.873,
1019		government: "Parliamentary Democracy",
1020	},
1021	BEN: {
1022		country: "Benin",
1023		pop: 7067,
1024		rate: 67,
1025		females: 0.05,
1026		juveniles: 0.021,
1027		occupancy: 2.4,
1028		government: "Presidential Republic",
1029	},
1030	BTN: {
1031		country: "Bhutan",
1032		pop: 1119,
1033		rate: 145,
1034		females: 0.043,
1035		juveniles: 0.034,
1036		occupancy: "--",
1037		government: "Constitutional Monarchy",
1038	},
1039	BOL: {
1040		country: "Bolivia",
1041		pop: 14598,
1042		females: 0.082,
1043		juveniles: 0.129,
1044		occupancy: 2.539,
1045		government: "Presidential Republic",
1046	},
1047	BIH: {
1048		country: "Bosnia and Herzegovina",
1049		pop: 1722,
1050		rate: 73,
1051		females: 0.029,
1052		juveniles: 0.002,
1053		occupancy: 1.021,
1054		government: "Parliamentary Republic",
1055	},
1056	BWA: {
1057		country: "Botswana",
1058		pop: 4376,
1059		rate: 210,
1060		females: 0.018,
1061		juveniles: 0.104,
1062		occupancy: 1.009,
1063		government: "Parliamentary Republic",
1064	},
1065	BRA: {
1066		country: "Brazil",
1067		pop: 657680,
1068		rate: 318,
1069		females: 0.069,
1070		juveniles: 0,
1071		occupancy: 1.639,
1072		government: "Federal Presidential Republic",
1073	},
1074	BRN: {
1075		country: "Brunei Darussalam",
1076		pop: 565,
1077		rate: 134,
1078		females: 0.073,
1079		juveniles: 0.004,
1080		occupancy: 1.328,
1081		government: "Absolute Monarchy or Sultanate",
1082	},
1083	BGR: {
1084		country: "Bulgaria",
1085		pop: 9028,
1086		rate: 125,
1087		females: 0.032,
1088		juveniles: 0.008,
1089		occupancy: 0.856,
1090		government: "Parliamentary Republic",
1091	},
1092	BFA: {
1093		country: "Burkina Faso",
1094		pop: 7544,
1095		rate: 41,
1096		females: 0.015,
1097		juveniles: 0.032,
1098		occupancy: 1.886,
1099		government: "Presidential Republic",
1100	},
1101	BDI: {
1102		country: "Burundi",
1103		pop: 10049,
1104		rate: 86,
1105		females: 0.045,
1106		juveniles: 0.023,
1107		occupancy: 2.396,
1108		government: "Presidential Republic",
1109	},
1110	KHM: {
1111		country: "Cambodia",
1112		pop: 25500,
1113		rate: 159,
1114		females: 0.08,
1115		juveniles: 0.041,
1116		occupancy: 2.061,
1117		government: "Parliamentary Constitutional Monarchy",
1118	},
1119	CMR: {
1120		country: "Cameroon",
1121		pop: 27997,
1122		rate: 115,
1123		females: 0.027,
1124		juveniles: 0.029,
1125		occupancy: 1.578,
1126		government: "Presidential Republic",
1127	},
1128	CAN: {
1129		country: "Canada",
1130		pop: 41145,
1131		rate: 114,
1132		females: 0.056,
1133		juveniles: 0.026,
1134		occupancy: 1.022,
1135		government: "Federal Parliamentary Democracy",
1136	},
1137	CAF: {
1138		country: "Central African Republic",
1139		pop: 764,
1140		rate: 16,
1141		females: 0.082,
1142		juveniles: "--",
1143		occupancy: "--",
1144		government: "Presidential Republic",
1145	},
1146	TCD: {
1147		country: "Chad",
1148		pop: 4831,
1149		rate: 39,
1150		females: 0.028,
1151		juveniles: 0.033,
1152		occupancy: 2.323,
1153		government: "Presidential Republic",
1154	},
1155	CHL: {
1156		country: "Chile",
1157		pop: 42931,
1158		rate: 236,
1159		females: 0.089,
1160		juveniles: 0.004,
1161		occupancy: 1.109,
1162		government: "Presidential Republic",
1163	},
1164	CHN: {
1165		country: "China",
1166		pop: 1649804,
1167		rate: 118,
1168		females: 0.065,
1169		juveniles: 0.008,
1170		occupancy: "--",
1171		government: "Communist State",
1172	},
1173	COL: {
1174		country: "Colombia",
1175		pop: 115708,
1176		rate: 227,
1177		females: 0.066,
1178		juveniles: 0,
1179		occupancy: 1.464,
1180		government: "Presidential Republic",
1181	},
1182	COD: {
1183		country: "Democratic Republic of the Congo",
1184		pop: 20550,
1185		rate: 29,
1186		females: 0.03,
1187		juveniles: "--",
1188		occupancy: 5.33,
1189		government: "Unitary Semi-Presidential Republic",
1190	},
1191	COG: {
1192		country: "Republic of the Congo",
1193		pop: 1240,
1194		rate: 27,
1195		females: 0.037,
1196		juveniles: 0.044,
1197		occupancy: 5.33,
1198		government: "Unitary Semi-Presidential Republic",
1199	},
1200	CRI: {
1201		country: "Costa Rica",
1202		pop: 19226,
1203		rate: 374,
1204		females: 0.054,
1205		juveniles: 0.016,
1206		occupancy: 1.394,
1207		government: "Presidential Republic",
1208	},
1209	HRV: {
1210		country: "Croatia",
1211		pop: 3228,
1212		rate: 78,
1213		females: 0.041,
1214		juveniles: 0.007,
1215		occupancy: 0.803,
1216		government: "Parliamentary Republic",
1217	},
1218	CUB: {
1219		country: "Cuba",
1220		pop: 57337,
1221		rate: 510,
1222		females: "--",
1223		juveniles: "--",
1224		occupancy: "--",
1225		government: "Communist State",
1226	},
1227	CYP: {
1228		country: "Cyprus",
1229		pop: 654,
1230		rate: 77,
1231		females: 0.067,
1232		juveniles: 0.015,
1233		occupancy: 0.973,
1234		government: "Presidential Democracy",
1235	},
1236	CZE: {
1237		country: "Czech Republic",
1238		pop: 22508,
1239		rate: 212,
1240		females: 0.074,
1241		juveniles: 0.004,
1242		occupancy: 1.065,
1243		government: "--",
1244	},
1245	CIV: {
1246		country: "Cote d'Ivoire",
1247		pop: 11192,
1248		rate: 51,
1249		females: 0.021,
1250		juveniles: 0.017,
1251		occupancy: 2.18,
1252		government: "Presidential Republic",
1253	},
1254	DNK: {
1255		country: "Denmark",
1256		pop: 3418,
1257		rate: 59,
1258		females: 0.04,
1259		juveniles: 0.003,
1260		occupancy: 0.952,
1261		government: "Parliamentary Constitutional Monarchy",
1262	},
1263	DJI: {
1264		country: "Djibouti",
1265		pop: 600,
1266		rate: 66,
1267		females: 0.05,
1268		juveniles: 0.05,
1269		occupancy: 1.714,
1270		government: "Semi-Presidential Republic",
1271	},
1272	DOM: {
1273		country: "Dominican Republic",
1274		pop: 26796,
1275		rate: 245,
1276		females: 0.026,
1277		juveniles: 0.023,
1278		occupancy: 1.885,
1279		government: "Presidential Republic",
1280	},
1281	ECU: {
1282		country: "Ecuador",
1283		pop: 26421,
1284		rate: 160,
1285		females: 0.077,
1286		juveniles: 0.021,
1287		occupancy: 1.144,
1288		government: "Presidential Republic",
1289	},
1290	EGY: {
1291		country: "Egypt",
1292		pop: 106000,
1293		rate: 116,
1294		females: 0.037,
1295		juveniles: "--",
1296		occupancy: "--",
1297		government: "Presidential Republic",
1298	},
1299	SLV: {
1300		country: "El Salvador",
1301		pop: 38893,
1302		rate: 597,
1303		females: 0.099,
1304		juveniles: 0,
1305		occupancy: 3.482,
1306		government: "Presidential Republic",
1307	},
1308	GNQ: {
1309		country: "Equatorial Guinea",
1310		pop: 500,
1311		rate: 63,
1312		females: 0.05,
1313		juveniles: "--",
1314		occupancy: "--",
1315		government: "Presidential Republic",
1316	},
1317	ERI: {
1318		country: "Eritrea",
1319		pop: "--",
1320		rate: "--",
1321		females: "--",
1322		juveniles: "--",
1323		occupancy: "--",
1324		government: "Unitary Presidential Republic",
1325	},
1326	EST: {
1327		country: "Estonia",
1328		pop: 2774,
1329		rate: 210,
1330		females: 0.055,
1331		juveniles: 0.008,
1332		occupancy: 0.833,
1333		government: "Parliamentary Republic",
1334	},
1335	ETH: {
1336		country: "Ethiopia",
1337		pop: 113727,
1338		rate: 127,
1339		females: 0.042,
1340		juveniles: "--",
1341		occupancy: "--",
1342		government: "Federal Parliamentary Republic",
1343	},
1344	FJI: {
1345		country: "Fiji",
1346		pop: 1423,
1347		rate: 158,
1348		females: 0.052,
1349		juveniles: 0.007,
1350		occupancy: 1.037,
1351		government: "Parliamentary Republic",
1352	},
1353	FIN: {
1354		country: "Finland",
1355		pop: 3174,
1356		rate: 57,
1357		females: 0.077,
1358		juveniles: 0.003,
1359		occupancy: 1.058,
1360		government: "Parliamentary Republic",
1361	},
1362	FRA: {
1363		country: "France",
1364		pop: 70018,
1365		rate: 103,
1366		females: 0.035,
1367		juveniles: 0.012,
1368		occupancy: 1.185,
1369		government: "Semi-Presidential Republic",
1370	},
1371	GUF: {
1372		country: "French Guiana",
1373		pop: 840,
1374		rate: 305,
1375		females: 0.106,
1376		juveniles: 0.012,
1377		occupancy: 1.37,
1378		government: "--",
1379	},
1380	GAB: {
1381		country: "Gabon",
1382		pop: 3373,
1383		rate: 191,
1384		females: 0.035,
1385		juveniles: 0.029,
1386		occupancy: "--",
1387		government: "Presidential Republic",
1388	},
1389	GMB: {
1390		country: "Gambia",
1391		pop: 1121,
1392		rate: 58,
1393		females: 0.025,
1394		juveniles: 0.013,
1395		occupancy: 1.725,
1396		government: "Presidential Republic",
1397	},
1398	GEO: {
1399		country: "Georgia",
1400		pop: 9451,
1401		rate: 254,
1402		females: 0.029,
1403		juveniles: 0.003,
1404		occupancy: 0.456,
1405		government: "Semi-Presidential Republic",
1406	},
1407	DEU: {
1408		country: "Germany",
1409		pop: 64193,
1410		rate: 77,
1411		females: 0.058,
1412		juveniles: 0.069,
1413		occupancy: 0.874,
1414		government: "Federal Parliamentary Republic",
1415	},
1416	GHA: {
1417		country: "Ghana",
1418		pop: 13764,
1419		rate: 49,
1420		females: 0.012,
1421		juveniles: 0.009,
1422		occupancy: 1.394,
1423		government: "Presidential Republic",
1424	},
1425	GNB: {
1426		country: "Guinea Buissau",
1427		pop: 196,
1428		rate: 10,
1429		females: 0.026,
1430		juveniles: 0.026,
1431		occupancy: 1.022,
1432		government: "Presidential Republic",
1433	},
1434	GRC: {
1435		country: "Greece",
1436		pop: 9789,
1437		rate: 91,
1438		females: 0.055,
1439		juveniles: 0.029,
1440		occupancy: 0.99,
1441		government: "Parliamentary Republic",
1442	},
1443	GRL: {
1444		country: "Greenland",
1445		pop: 126,
1446		rate: 226,
1447		females: 0.138,
1448		juveniles: 0,
1449		occupancy: 0.753,
1450		government: "Parliamentary Democracy",
1451	},
1452	GTM: {
1453		country: "Guatemala",
1454		pop: 22907,
1455		rate: 134,
1456		females: 0.103,
1457		juveniles: 0.046,
1458		occupancy: 2.962,
1459		government: "Presidential Republic",
1460	},
1461	GIN: {
1462		country: "Guinea",
1463		pop: 2900,
1464		rate: 23,
1465		females: 0.037,
1466		juveniles: 0.063,
1467		occupancy: 1.748,
1468		government: "Presidential Republic",
1469	},
1470	GUY: {
1471		country: "Guyana",
1472		pop: 2113,
1473		rate: 278,
1474		females: 0.035,
1475		juveniles: 0.007,
1476		occupancy: 1.288,
1477		government: "Parliamentary Republic",
1478	},
1479	HTI: {
1480		country: "Haiti",
1481		pop: 10500,
1482		rate: 96,
1483		females: 0.041,
1484		juveniles: 0.024,
1485		occupancy: 4.544,
1486		government: "Semi-Presidential Republic",
1487	},
1488	HND: {
1489		country: "Honduras",
1490		pop: 17253,
1491		rate: 200,
1492		females: 0.043,
1493		juveniles: "--",
1494		occupancy: 1.628,
1495		government: "Presidential Republic",
1496	},
1497	HUN: {
1498		country: "Hungary",
1499		pop: 17963,
1500		rate: 184,
1501		females: 0.075,
1502		juveniles: 0.004,
1503		occupancy: 1.29,
1504		government: "Parliamentary Republic",
1505	},
1506	ISL: {
1507		country: "Iceland",
1508		pop: 131,
1509		rate: 38,
1510		females: 0.061,
1511		juveniles: 0,
1512		occupancy: 0.862,
1513		government: "Parliamentary Republic",
1514	},
1515	IND: {
1516		country: "India",
1517		pop: 419623,
1518		rate: 33,
1519		females: 0.043,
1520		juveniles: 0,
1521		occupancy: 1.144,
1522		government: "Federal Parliamentary Republic",
1523	},
1524	IDN: {
1525		country: "Indonesia",
1526		pop: 225025,
1527		rate: 86,
1528		females: 0.055,
1529		juveniles: 0.032,
1530		occupancy: 1.827,
1531		government: "Republic",
1532	},
1533	IRN: {
1534		country: "Iran",
1535		pop: 225624,
1536		females: 0.031,
1537		juveniles: 0.005,
1538		occupancy: 1.612,
1539		government: "Republic",
1540	},
1541	IRQ: {
1542		country: "Iraq",
1543		pop: 42880,
1544		rate: 123,
1545		females: 0.026,
1546		juveniles: 0.036,
1547		occupancy: 1.392,
1548		government: "Republic",
1549	},
1550	IRL: {
1551		country: "Ireland",
1552		pop: 3593,
1553		rate: 75,
1554		females: 0.038,
1555		juveniles: 0.01,
1556		occupancy: 0.841,
1557		government: "Republic",
1558	},
1559	ISR: {
1560		country: "Israel",
1561		pop: 21072,
1562		rate: 265,
1563		females: 0.01,
1564		juveniles: 0.027,
1565		occupancy: 0.801,
1566		government: "Republic",
1567	},
1568	ITA: {
1569		country: "Italy",
1570		pop: 57661,
1571		rate: 95,
1572		females: 0.042,
1573		juveniles: 0.003,
1574		occupancy: 1.142,
1575		government: "Republic",
1576	},
1577	JAM: {
1578		country: "Jamaica",
1579		pop: 3866,
1580		rate: 138,
1581		females: 0.047,
1582		juveniles: 0.052,
1583		occupancy: 0.888,
1584		government: "Constituitional Monarchy",
1585	},
1586	JPN: {
1587		country: "Japan",
1588		pop: 56805,
1589		rate: 45,
1590		females: 0.084,
1591		juveniles: 0,
1592		occupancy: 0.668,
1593		government: "Constituitional Monarchy",
1594	},
1595	JOR: {
1596		country: "Jordan",
1597		pop: 11489,
1598		rate: 150,
1599		females: 0.04,
1600		juveniles: "--",
1601		occupancy: 0.693,
1602		government: "Constituitional Monarchy",
1603	},
1604	KAZ: {
1605		country: "Kazakhstan",
1606		pop: 36343,
1607		rate: 202,
1608		females: 0.076,
1609		juveniles: 0.002,
1610		occupancy: 0.689,
1611		government: "Republic",
1612	},
1613	KEN: {
1614		country: "Kenya",
1615		pop: 53841,
1616		rate: 114,
1617		females: 0.074,
1618		juveniles: 0.012,
1619		occupancy: 2.017,
1620		government: "Republic",
1621	},
1622	KOS: {
1623		country: "Kosovo",
1624		pop: 1849,
1625		rate: 106,
1626		females: 0.025,
1627		juveniles: 0.034,
1628		occupancy: 0.87,
1629		government: "Republic",
1630	},
1631	KWT: {
1632		country: "Kuwait",
1633		pop: 5400,
1634		rate: 147,
1635		females: 0.025,
1636		juveniles: "--",
1637		occupancy: 0.87,
1638		government: "Constituitional Monarchy",
1639	},
1640	KGZ: {
1641		country: "Kyrgyzstan",
1642		pop: 10195,
1643		rate: 166,
1644		females: 0.042,
1645		juveniles: 0.004,
1646		occupancy: 0.585,
1647		government: "Republic",
1648	},
1649	LAO: {
1650		country: "Laos",
1651		pop: 8201,
1652		rate: 119,
1653		females: 0.183,
1654		juveniles: "--",
1655		occupancy: "--",
1656		government: "Republic",
1657	},
1658	LVA: {
1659		country: "Latvia",
1660		pop: 4243,
1661		rate: 218,
1662		females: 0.082,
1663		juveniles: 0.01,
1664		occupancy: 0.753,
1665		government: "Republic",
1666	},
1667	LBN: {
1668		country: "Lebanon",
1669		pop: 6500,
1670		rate: 128,
1671		females: 0.046,
1672		juveniles: 0.024,
1673		occupancy: 1.857,
1674		government: "Republic",
1675	},
1676	LSO: {
1677		country: "Lesotho",
1678		pop: 2073,
1679		rate: 92,
1680		females: 0.036,
1681		juveniles: 0.024,
1682		occupancy: 0.706,
1683		government: "Constitutional Monarchy",
1684	},
1685	LBR: {
1686		country: "Liberia",
1687		pop: 2023,
1688		rate: 44,
1689		females: 0.013,
1690		juveniles: 0.01,
1691		occupancy: 1.657,
1692		government: "Republic",
1693	},
1694	LBY: {
1695		country: "Libya",
1696		pop: 6187,
1697		rate: 99,
1698		females: 0.012,
1699		juveniles: "--",
1700		occupancy: 1.416,
1701		government: "--",
1702	},
1703	LTU: {
1704		country: "Lithuania",
1705		pop: 6616,
1706		rate: 235,
1707		females: 0.049,
1708		juveniles: 0.007,
1709		occupancy: 0.826,
1710		government: "Republic",
1711	},
1712	LUX: {
1713		country: "Luxembourg",
1714		pop: 690,
1715		rate: 115,
1716		females: 0.055,
1717		juveniles: 0.009,
1718		occupancy: 0.97,
1719		government: "Constituitional Monarchy",
1720	},
1721	MKD: {
1722		country: "Macedonia",
1723		pop: 3222,
1724		rate: 156,
1725		females: 0.032,
1726		juveniles: 0.007,
1727		occupancy: 1.323,
1728		government: "Republic",
1729	},
1730	MDG: {
1731		country: "Madagascar",
1732		pop: 22000,
1733		rate: 88,
1734		females: 0.045,
1735		juveniles: 0.034,
1736		occupancy: 1.93,
1737		government: "Republic",
1738	},
1739	MWI: {
1740		country: "Malawi",
1741		pop: 14018,
1742		rate: 79,
1743		females: 0.011,
1744		juveniles: 0.077,
1745		occupancy: 2.003,
1746		government: "Republic",
1747	},
1748	MYS: {
1749		country: "Malaysia",
1750		pop: 51602,
1751		rate: 167,
1752		females: 0.069,
1753		juveniles: 0.022,
1754		occupancy: 1.139,
1755		government: "Constitutional Monarchy",
1756	},
1757	MLI: {
1758		country: "Mali",
1759		pop: 5209,
1760		rate: 33,
1761		females: 0.028,
1762		juveniles: 0.013,
1763		occupancy: 2.233,
1764		government: "Republic",
1765	},
1766	MRT: {
1767		country: "Mauritania",
1768		pop: 1768,
1769		rate: 44,
1770		females: 0.012,
1771		juveniles: 0.031,
1772		occupancy: 1.019,
1773		government: "Republic",
1774	},
1775	MEX: {
1776		country: "Mexico",
1777		pop: 208689,
1778		rate: 169,
1779		females: 0.052,
1780		juveniles: 0.043,
1781		occupancy: 0.979,
1782		government: "Executive Republic",
1783	},
1784	MDA: {
1785		country: "Moldova",
1786		pop: 7868,
1787		rate: 222,
1788		females: 0.082,
1789		juveniles: 0.003,
1790		occupancy: 0.909,
1791		government: "Ceremonial Republic",
1792	},
1793	MNG: {
1794		country: "Mongolia",
1795		pop: 7690,
1796		rate: 262,
1797		females: 0.051,
1798		juveniles: 0.009,
1799		occupancy: 1.244,
1800		government: "Executive Republic",
1801	},
1802	MNE: {
1803		country: "Montenegro",
1804		pop: 1131,
1805		rate: 182,
1806		females: 0.031,
1807		juveniles: 0.004,
1808		occupancy: 0.838,
1809		government: "Ceremonial Republic",
1810	},
1811	MAR: {
1812		country: "Morocco",
1813		pop: 80000,
1814		rate: 227,
1815		females: 0.023,
1816		juveniles: 0.027,
1817		occupancy: 1.578,
1818		government: "Executive Constitutional Monarchy",
1819	},
1820	MOZ: {
1821		country: "Mozambique",
1822		pop: 15976,
1823		rate: 57,
1824		females: 0.029,
1825		juveniles: 0.086,
1826		occupancy: 1.951,
1827		government: "Executive Republic",
1828	},
1829	MMR: {
1830		country: "Myanmar",
1831		pop: 79668,
1832		rate: 145,
1833		females: 0.123,
1834		juveniles: 0.016,
1835		occupancy: 1.443,
1836		government: "Executive Republic",
1837	},
1838	NAM: {
1839		country: "Namibia",
1840		pop: 3742,
1841		rate: 149,
1842		females: 0.029,
1843		juveniles: 0.002,
1844		occupancy: 0.727,
1845		government: "Executive Republic",
1846	},
1847	NPL: {
1848		country: "Nepal",
1849		pop: 18881,
1850		rate: 65,
1851		females: 0.073,
1852		juveniles: 0.055,
1853		occupancy: 1.78,
1854		government: "Ceremonial Republic",
1855	},
1856	NLD: {
1857		country: "Netherlands",
1858		pop: 10102,
1859		rate: 59,
1860		females: 0.054,
1861		juveniles: 0.012,
1862		occupancy: 0.681,
1863		government: "Ceremonial Constitutional Monarchy",
1864	},
1865	NCL: {
1866		country: "New Caledonia",
1867		pop: 549,
1868		rate: 204,
1869		females: 0.015,
1870		juveniles: 0.031,
1871		occupancy: 1.366,
1872		government: "French Republic",
1873	},
1874	NZL: {
1875		country: "New Zealand",
1876		pop: 10260,
1877		rate: 214,
1878		females: 0.074,
1879		juveniles: 0.006,
1880		occupancy: 1.061,
1881		government: "Ceremonial Constitutional Monarchy",
1882	},
1883	NIC: {
1884		country: "Nicaragua",
1885		pop: 10569,
1886		rate: 171,
1887		females: 0.054,
1888		juveniles: 0.006,
1889		occupancy: 1.28,
1890		government: "Executive Republic",
1891	},
1892	NER: {
1893		country: "Niger",
1894		pop: 8525,
1895		rate: 44,
1896		females: 0.043,
1897		juveniles: "--",
1898		occupancy: 0.604,
1899		government: "Executive Republic",
1900	},
1901	NGA: {
1902		country: "Nigeria",
1903		pop: 68259,
1904		rate: 36,
1905		females: 0.02,
1906		juveniles: 0.017,
1907		occupancy: 1.259,
1908		government: "Executive Republic",
1909	},
1910	PRK: {
1911		country: "North Korea",
1912		pop: 100000,
1913		females: "--",
1914		juveniles: "--",
1915		occupancy: "--",
1916		government: "Executive Republic",
1917	},
1918	NOR: {
1919		country: "Norway",
1920		pop: 3933,
1921		rate: 74,
1922		females: 0.064,
1923		juveniles: 0.001,
1924		occupancy: 0.952,
1925		government: "Ceremonial Constitutional Monarchy",
1926	},
1927	OMN: {
1928		country: "Oman",
1929		pop: 1300,
1930		rate: 36,
1931		females: 0.045,
1932		juveniles: 0.038,
1933		occupancy: "--",
1934		government: "Executive Absolute Monarchy",
1935	},
1936	PAK: {
1937		country: "Pakistan",
1938		pop: 84315,
1939		rate: 44,
1940		females: 0.018,
1941		juveniles: 0.017,
1942		occupancy: 1.716,
1943		government: "Ceremonial Republic",
1944	},
1945	PAN: {
1946		country: "Panama",
1947		pop: 16151,
1948		rate: 393,
1949		females: 0.055,
1950		juveniles: 0,
1951		occupancy: 1.139,
1952		government: "Executive Republic",
1953	},
1954	PNG: {
1955		country: "Papau New Guinea",
1956		pop: 4945,
1957		rate: 63,
1958		females: 0.05,
1959		juveniles: 0.039,
1960		occupancy: 1.187,
1961		government: "Ceremonial Consititutional Monarchy",
1962	},
1963	PRY: {
1964		country: "Paraguay",
1965		pop: 12741,
1966		rate: 180,
1967		females: 0.065,
1968		juveniles: 0.028,
1969		occupancy: 1.786,
1970		government: "Executive Republic",
1971	},
1972	PER: {
1973		country: "Peru",
1974		pop: 84741,
1975		rate: 265,
1976		females: 0.058,
1977		juveniles: 0,
1978		occupancy: 2.293,
1979		government: "Executive Republic",
1980	},
1981	PHL: {
1982		country: "Philippines",
1983		pop: 178661,
1984		rate: 172,
1985		females: 0.089,
1986		juveniles: 0.004,
1987		occupancy: 4.36,
1988		government: "Executive Republic",
1989	},
1990	POL: {
1991		country: "Poland",
1992		pop: 73717,
1993		rate: 194,
1994		females: 0.038,
1995		juveniles: 0.004,
1996		occupancy: 0.9,
1997		government: "Executive Republic",
1998	},
1999	PRT: {
2000		country: "Portugal",
2001		pop: 13726,
2002		rate: 133,
2003		females: 0.064,
2004		juveniles: 0.001,
2005		occupancy: 1.069,
2006		government: "Executive Republic",
2007	},
2008	PRI: {
2009		country: "Puerto Rico",
2010		pop: 10475,
2011		rate: 313,
2012		females: 0.036,
2013		juveniles: 0.037,
2014		occupancy: 0.736,
2015		government: "Executive Republic",
2016	},
2017	QAT: {
2018		country: "Qatar",
2019		pop: 1150,
2020		rate: 53,
2021		females: 0.147,
2022		juveniles: 0,
2023		occupancy: "--",
2024		government: "Executive Absolute Monarchy",
2025	},
2026	ROU: {
2027		country: "Romania",
2028		pop: 26529,
2029		rate: 135,
2030		females: 0.051,
2031		juveniles: 0.013,
2032		occupancy: 0.956,
2033		government: "Executive Republic",
2034	},
2035	RUS: {
2036		country: "Russia",
2037		pop: 609485,
2038		rate: 421,
2039		females: 0.079,
2040		juveniles: 0.002,
2041		occupancy: 0.79,
2042		government: "Executive Republic",
2043	},
2044	RWA: {
2045		country: "Rwanda",
2046		pop: 54279,
2047		rate: 434,
2048		females: 0.065,
2049		juveniles: 0.004,
2050		occupancy: 0.956,
2051		government: "Executive Republic",
2052	},
2053	SAU: {
2054		country: "Saudi Arabia",
2055		pop: 47000,
2056		rate: 161,
2057		females: 0.057,
2058		juveniles: 0.009,
2059		occupancy: "--",
2060		government: "Executive Absolute Monarchy",
2061	},
2062	SEN: {
2063		country: "Senegal",
2064		pop: 9422,
2065		rate: 60,
2066		females: 0.029,
2067		juveniles: 0.02,
2068		occupancy: 1.173,
2069		government: "Executive Republic",
2070	},
2071	SRB: {
2072		country: "Serbia",
2073		pop: 10065,
2074		rate: 142,
2075		females: 0.036,
2076		juveniles: 0.01,
2077		occupancy: 1.064,
2078		government: "Cermonial Republic",
2079	},
2080	SLE: {
2081		country: "Sierra Leone",
2082		pop: 4179,
2083		rate: 64,
2084		females: 0.033,
2085		juveniles: 0,
2086		occupancy: 2.16,
2087		government: "Executive Republic",
2088	},
2089	SVK: {
2090		country: "Slovakia",
2091		pop: 10247,
2092		rate: 188,
2093		females: 0.07,
2094		juveniles: 0.008,
2095		occupancy: 0.937,
2096		government: "Ceremonial Republic",
2097	},
2098	SVN: {
2099		country: "Slovenia",
2100		pop: 1316,
2101		rate: 64,
2102		females: 0.074,
2103		juveniles: 0.005,
2104		occupancy: 0.983,
2105		government: "Ceremonial Republic",
2106	},
2107	SLB: {
2108		country: "Solomon Islands",
2109		pop: 435,
2110		rate: 73,
2111		females: 0.014,
2112		juveniles: 0.059,
2113		occupancy: 0.606,
2114		government: "Ceremonial Constitutional Monarchy",
2115	},
2116	SOL: {
2117		country: "Somaliland",
2118		pop: 2000,
2119		rate: "--",
2120		females: "--",
2121		juveniles: "--",
2122		occupancy: "--",
2123		government: "Presidential Constitutional Republic",
2124	},
2125	SOM: {
2126		country: "Somalia",
2127		pop: 3700,
2128		rate: "--",
2129		females: "--",
2130		juveniles: "--",
2131		occupancy: "--",
2132		government: "Federal Parliamentary Republic",
2133	},
2134	ZAF: {
2135		country: "South Africa",
2136		pop: 161984,
2137		rate: 291,
2138		females: 0.026,
2139		juveniles: 0.002,
2140		occupancy: 1.327,
2141		government: "Executive Republic",
2142	},
2143	KOR: {
2144		country: "South Korea",
2145		pop: 57451,
2146		rate: 114,
2147		females: 0.065,
2148		juveniles: 0.008,
2149		occupancy: 1.133,
2150		government: "Executive Republic",
2151	},
2152	ESP: {
2153		country: "Spain",
2154		pop: 59678,
2155		rate: 128,
2156		females: 0.075,
2157		juveniles: 0,
2158		occupancy: 0.809,
2159		government: "Ceremonial Constitutional Monarchy",
2160	},
2161	LKA: {
2162		country: "Sri Lanka",
2163		pop: 16990,
2164		rate: 78,
2165		females: 0.049,
2166		juveniles: 0.001,
2167		occupancy: 1.906,
2168		government: "Executive Republic",
2169	},
2170	SDN: {
2171		country: "Sudan",
2172		pop: 19101,
2173		rate: 50,
2174		females: 0.02,
2175		juveniles: 0.02,
2176		occupancy: 2.553,
2177		government: "Executive Republic",
2178	},
2179	SSD: {
2180		country: "S.Sudan",
2181		pop: 6504,
2182		rate: 52,
2183		females: 0.109,
2184		juveniles: "--",
2185		occupancy: 3.2925,
2186		government: "Constitutional Republic",
2187	},
2188	SUR: {
2189		country: "Suriname",
2190		pop: 1000,
2191		rate: 183,
2192		females: 0.028,
2193		juveniles: 0.057,
2194		occupancy: 0.752,
2195		government: "Executive Republic",
2196	},
2197	SWZ: {
2198		country: "Swaziland",
2199		pop: 3610,
2200		rate: 282,
2201		females: 0.029,
2202		juveniles: 0.007,
2203		occupancy: 1.272,
2204		government: "Executive Absolute Monarchy",
2205	},
2206	SWE: {
2207		country: "Sweden",
2208		pop: 5630,
2209		rate: 57,
2210		females: 0.061,
2211		juveniles: 0.003,
2212		occupancy: 0.842,
2213		government: "Ceremonial Constitutional Monarchy",
2214	},
2215	CHE: {
2216		country: "Switzerland",
2217		pop: 6912,
2218		rate: 82,
2219		females: 0.056,
2220		juveniles: 0.003,
2221		occupancy: 0.922,
2222		government: "Executive Republic",
2223	},
2224	SYR: {
2225		country: "Syria",
2226		pop: 10599,
2227		rate: 60,
2228		females: 0.074,
2229		juveniles: "--",
2230		occupancy: 0.656,
2231		government: "Executive Republic",
2232	},
2233	TWN: {
2234		country: "Taiwan",
2235		pop: 62445,
2236		rate: 265,
2237		females: 0.087,
2238		juveniles: 0.025,
2239		occupancy: 1.148,
2240		government: "Constitutional Republic",
2241	},
2242	TJK: {
2243		country: "Tajikistan",
2244		pop: 9317,
2245		rate: 121,
2246		females: 0.016,
2247		juveniles: 0.01,
2248		occupancy: 0.615,
2249		government: "Executive Republic",
2250	},
2251	TZA: {
2252		country: "Tanzania",
2253		pop: 31382,
2254		rate: 58,
2255		females: 0.034,
2256		juveniles: 0.039,
2257		occupancy: 1.157,
2258		government: "Executive Republic",
2259	},
2260	THA: {
2261		country: "Thailand",
2262		pop: 312855,
2263		rate: 462,
2264		females: 0.131,
2265		juveniles: "--",
2266		occupancy: 1.448,
2267		government: "--",
2268	},
2269	TLS: {
2270		country: "Timor-Leste",
2271		pop: 669,
2272		rate: 56,
2273		females: 0.04,
2274		juveniles: 0.055,
2275		occupancy: 1.373,
2276		government: "Constitutional Republic",
2277	},
2278	TGO: {
2279		country: "Togo",
2280		pop: 4427,
2281		rate: 62,
2282		females: 0.027,
2283		juveniles: 0.009,
2284		occupancy: 1.628,
2285		government: "Executive Republic",
2286	},
2287	TTO: {
2288		country: "Trinidad and Tobago",
2289		pop: 3667,
2290		rate: 270,
2291		females: 0.026,
2292		juveniles: 0.048,
2293		occupancy: 0.751,
2294		government: "Ceremonial Republic",
2295	},
2296	TUN: {
2297		country: "Tunisia",
2298		pop: 23553,
2299		rate: 206,
2300		females: 0.028,
2301		juveniles: 0.01,
2302		occupancy: 1.389,
2303		government: "Executive Republic",
2304	},
2305	TUR: {
2306		country: "Turkey",
2307		pop: 229790,
2308		rate: 285,
2309		females: 0.043,
2310		juveniles: 0.012,
2311		occupancy: 1.108,
2312		government: "Ceremonial Republic",
2313	},
2314	TKM: {
2315		country: "Turkmenistan",
2316		pop: 30568,
2317		rate: 583,
2318		females: 0.065,
2319		juveniles: 0.007,
2320		occupancy: 0.85,
2321		government: "Executive Republic",
2322	},
2323	UGA: {
2324		country: "Uganda",
2325		pop: 54059,
2326		rate: 129,
2327		females: 0.044,
2328		juveniles: 0,
2329		occupancy: 2.932,
2330		government: "Executive Republic",
2331	},
2332	UKR: {
2333		country: "Ukraine",
2334		pop: 60771,
2335		rate: 167,
2336		females: 0.046,
2337		juveniles: 0.007,
2338		occupancy: 0.63,
2339		government: "Executive Republic",
2340	},
2341	ARE: {
2342		country: "United Arab Emirates",
2343		pop: 9826,
2344		rate: 104,
2345		females: 0.117,
2346		juveniles: 0.02,
2347		occupancy: 1.589,
2348		government: "Executive Absolute Monarchy",
2349	},
2350	GBR: {
2351		country: "United Kingdom",
2352		pop: 95284,
2353		rate: 360,
2354		females: 0.0447,
2355		juveniles: 0.0047,
2356		occupancy: 0.972,
2357		government: "Ceremonial Constitutional Monarchy",
2358	},
2359	USA: {
2360		country: "United States of America",
2361		pop: 2145100,
2362		rate: 666,
2363		females: 0.098,
2364		juveniles: 0.002,
2365		occupancy: 1.039,
2366		government: "Executive Republic",
2367	},
2368	URY: {
2369		country: "Uruguay",
2370		pop: 11078,
2371		rate: 321,
2372		females: 0.053,
2373		juveniles: 0,
2374		occupancy: 1.121,
2375		government: "Executive Republic",
2376	},
2377	UZB: {
2378		country: "Uzbekistan",
2379		pop: 43900,
2380		rate: 150,
2381		females: "--",
2382		juveniles: "--",
2383		occupancy: 0.8,
2384		government: "Executive Republic",
2385	},
2386	VEN: {
2387		country: "Venezuela",
2388		pop: 54738,
2389		rate: 173,
2390		females: 0.05,
2391		juveniles: 0,
2392		occupancy: 1.539,
2393		government: "Executive Republic",
2394	},
2395	VNM: {
2396		country: "Vietnam",
2397		pop: 115035,
2398		rate: 122,
2399		females: 0.101,
2400		juveniles: "--",
2401		occupancy: "--",
2402		government: "Executive Republic",
2403	},
2404	SAH: {
2405		country: "Western Sahara",
2406		pop: "--",
2407		rate: "--",
2408		females: "--",
2409		juveniles: "--",
2410		occupancy: "--",
2411		government: "Disputed",
2412	},
2413	YEM: {
2414		country: "Yemen",
2415		pop: 14000,
2416		rate: 53,
2417		females: 0.016,
2418		juveniles: 0.019,
2419		occupancy: "--",
2420		government: "Provisional Government",
2421	},
2422	ZMB: {
2423		country: "Zambia",
2424		pop: 25000,
2425		rate: 160,
2426		females: 0.01,
2427		juveniles: 0.025,
2428		occupancy: 3.03,
2429		government: "Executive Republic",
2430	},
2431	ZWE: {
2432		country: "Zimbabwe",
2433		pop: 19521,
2434		rate: 120,
2435		females: 0.022,
2436		juveniles: 0.005,
2437		occupancy: 1.109,
2438		government: "Executive Republic",
2439	},
2440};