function Prices() {
	
	travelCosts = new Array();
	travelCosts[0] = 0; 
	travelCosts[1] = 1493; 
	travelCosts[2] = 9720; 
	travelCosts[3] = 982; 
	travelCosts[4] = 5054; 
	travelCosts[5] = 442;  
	travelCosts[6] = 216; 
	travelCosts[7] = 9600;
	
	travelCosts[10] = 1493;
	travelCosts[11] = 0;
	travelCosts[12] = 10440;
	travelCosts[13] = 574;
	travelCosts[14] = 3648;
	travelCosts[15] = 1723;
	travelCosts[16] = 1627;
	travelCosts[17] = 10320;
	
	travelCosts[20] = 9750;
	travelCosts[21] = 10440;
	travelCosts[22] = 0;
	travelCosts[23] = 9360;
	travelCosts[24] = 13320;
	travelCosts[25] = 9000;
	travelCosts[26] = 9450;
	travelCosts[27] = 120;
	
	travelCosts[30] = 982;
	travelCosts[31] = 574;
	travelCosts[32] = 9360;
	travelCosts[33] = 0;
	travelCosts[34] = 4219;
	travelCosts[35] = 1169;
	travelCosts[36] = 1090;
	travelCosts[37] = 9240;
	
	travelCosts[40] = 5054;
	travelCosts[41] = 3648;
	travelCosts[42] = 13320;
	travelCosts[43] = 4219;
	travelCosts[44] = 0;
	travelCosts[45] = 5357;
	travelCosts[46] = 5225;
	travelCosts[47] = 13200;
	
	travelCosts[50] = 442;
	travelCosts[51] = 1723;
	travelCosts[52] = 9000;
	travelCosts[53] = 1169;
	travelCosts[54] = 5357;
	travelCosts[55] = 0;
	travelCosts[56] = 226;
	travelCosts[57] = 8800;
	
	travelCosts[60] = 216;
	travelCosts[61] = 1627;
	travelCosts[62] = 9450;
	travelCosts[63] = 1090;
	travelCosts[64] = 5225;
	travelCosts[65] = 226;
	travelCosts[66] = 0;
	travelCosts[67] = 9360;
	
	travelCosts[70] = 9600;
	travelCosts[71] = 10320;
	travelCosts[72] = 120;
	travelCosts[73] = 9240;
	travelCosts[74] = 13200;
	travelCosts[75] = 8800;
	travelCosts[76] = 9360;
	travelCosts[77] = 0;
	
	cityType = new Array();
	cityType[0] = "Baltimore-Morphine";
	cityType[1] = "Chicago-Morphine";
	cityType[2] = "Corleone-Morphine";
	cityType[3] = "Detroit-Morphine";
	cityType[4] = "LasVegas-Morphine";
	cityType[5] = "NewYork-Morphine";
	cityType[6] = "Philadelphia-Morphine";
	cityType[7] = "Palermo-Morphine";
	cityType[8] = "Profit-Morphine";
	
	cityType[10] = "Baltimore-Heroin";
	cityType[11] = "Chicago-Heroin";
	cityType[12] = "Corleone-Heroin";
	cityType[13] = "Detroit-Heroin";
	cityType[14] = "LasVegas-Heroin";
	cityType[15] = "NewYork-Heroin";
	cityType[16] = "Philadelphia-Heroin";
	cityType[17] = "Palermo-Heroin";
	cityType[18] = "Profit-Heroin";
	
	cityType[20] = "Baltimore-Opium";
	cityType[21] = "Chicago-Opium";
	cityType[22] = "Corleone-Opium";
	cityType[23] = "Detroit-Opium";
	cityType[24] = "LasVegas-Opium";
	cityType[25] = "NewYork-Opium";
	cityType[26] = "Philadelphia-Opium";
	cityType[27] = "Palermo-Opium";
	cityType[28] = "Profit-Opium";
	
	cityType[30] = "Baltimore-Cocaine";
	cityType[31] = "Chicago-Cocaine";
	cityType[32] = "Corleone-Cocaine";
	cityType[33] = "Detroit-Cocaine";
	cityType[34] = "LasVegas-Cocaine";
	cityType[35] = "NewYork-Cocaine";
	cityType[36] = "Philadelphia-Cocaine";
	cityType[37] = "Palermo-Cocaine";
	cityType[38] = "Profit-Cocaine";
	
	cityType[40] = "Baltimore-Marihuana";
	cityType[41] = "Chicago-Marihuana";
	cityType[42] = "Corleone-Marihuana";
	cityType[43] = "Detroit-Marihuana";
	cityType[44] = "LasVegas-Marihuana";
	cityType[45] = "NewYork-Marihuana";
	cityType[46] = "Philadelphia-Marihuana";
	cityType[47] = "Palermo-Marihuana";
	cityType[48] = "Profit-Marihuana";
	
	cityType[50] = "Baltimore-Tobacco";
	cityType[51] = "Chicago-Tobacco";
	cityType[52] = "Corleone-Tobacco";
	cityType[53] = "Detroit-Tobacco";
	cityType[54] = "LasVegas-Tobacco";
	cityType[55] = "NewYork-Tobacco";
	cityType[56] = "Philadelphia-Tobacco";
	cityType[57] = "Palermo-Tobacco";
	cityType[58] = "Profit-Tobacco";
	
	cityType[60] = "Baltimore-Glue";
	cityType[61] = "Chicago-Glue";
	cityType[62] = "Corleone-Glue";
	cityType[63] = "Detroit-Glue";
	cityType[64] = "LasVegas-Glue";
	cityType[65] = "NewYork-Glue";
	cityType[66] = "Philadelphia-Glue";
	cityType[67] = "Palermo-Glue";
	cityType[68] = "Profit-Glue";
	
	cityType[70] = "Baltimore-Wine";
	cityType[71] = "Chicago-Wine";
	cityType[72] = "Corleone-Wine";
	cityType[73] = "Detroit-Wine";
	cityType[74] = "LasVegas-Wine";
	cityType[75] = "NewYork-Wine";
	cityType[76] = "Philadelphia-Wine";
	cityType[77] = "Palermo-Wine";
	cityType[78] = "Profit-Wine";
	
	cityType[80] = "Baltimore-Cognac";
	cityType[81] = "Chicago-Cognac";
	cityType[82] = "Corleone-Cognac";
	cityType[83] = "Detroit-Cognac";
	cityType[84] = "LasVegas-Cognac";
	cityType[85] = "NewYork-Cognac";
	cityType[86] = "Philadelphia-Cognac";
	cityType[87] = "Palermo-Cognac";
	cityType[88] = "Profit-Cognac";
	
	cityType[90] = "Baltimore-Whiskey";
	cityType[91] = "Chicago-Whiskey";
	cityType[92] = "Corleone-Whiskey";
	cityType[93] = "Detroit-Whiskey";
	cityType[94] = "LasVegas-Whiskey";
	cityType[95] = "NewYork-Whiskey";
	cityType[96] = "Philadelphia-Whiskey";
	cityType[97] = "Palermo-Whiskey";
	cityType[98] = "Profit-Whiskey";
	
	cityType[100] = "Baltimore-Amaretto";
	cityType[101] = "Chicago-Amaretto";
	cityType[102] = "Corleone-Amaretto";
	cityType[103] = "Detroit-Amaretto";
	cityType[104] = "LasVegas-Amaretto";
	cityType[105] = "NewYork-Amaretto";
	cityType[106] = "Philadelphia-Amaretto";
	cityType[107] = "Palermo-Amaretto";
	cityType[108] = "Profit-Amaretto";
	
	cityType[110] = "Baltimore-Beer";
	cityType[111] = "Chicago-Beer";
	cityType[112] = "Corleone-Beer";
	cityType[113] = "Detroit-Beer";
	cityType[114] = "LasVegas-Beer";
	cityType[115] = "NewYork-Beer";
	cityType[116] = "Philadelphia-Beer";
	cityType[117] = "Palermo-Beer";
	cityType[118] = "Profit-Beer";
	
	cityType[120] = "Baltimore-Port";
	cityType[121] = "Chicago-Port";
	cityType[122] = "Corleone-Port";
	cityType[123] = "Detroit-Port";
	cityType[124] = "LasVegas-Port";
	cityType[125] = "NewYork-Port";
	cityType[126] = "Philadelphia-Port";
	cityType[127] = "Palermo-Port";
	cityType[128] = "Profit-Port";
	
	cityType[130] = "Baltimore-Rum";
	cityType[131] = "Chicago-Rum";
	cityType[132] = "Corleone-Rum";
	cityType[133] = "Detroit-Rum";
	cityType[134] = "LasVegas-Rum";
	cityType[135] = "NewYork-Rum";
	cityType[136] = "Philadelphia-Rum";
	cityType[137] = "Palermo-Rum";
	cityType[138] = "Profit-Rum";
	
	narcsRank = new Array();
	narcsRank[0] = 0;
	narcsRank[1] = 0;
	narcsRank[2] = 1;
	narcsRank[3] = 2;
	narcsRank[4] = 4;
	narcsRank[5] = 5;
	narcsRank[6] = 7;
	narcsRank[7] = 8;
	narcsRank[8] = 10;
	narcsRank[9] = 11;
	narcsRank[10] = 13;
	narcsRank[11] = 14;
	narcsRank[12] = 16;
	narcsRank[13] = 17;
	narcsRank[14] = 20;
	narcsRank[15] = 20;
	
	boozeRank = new Array();
	boozeRank[0] = 1;
	boozeRank[1] = 2;
	boozeRank[2] = 5;
	boozeRank[3] = 7;
	boozeRank[4] = 10;
	boozeRank[5] = 15;
	boozeRank[6] = 20;
	boozeRank[7] = 25;
	boozeRank[8] = 30;
	boozeRank[9] = 35;
	boozeRank[10] = 40;
	boozeRank[11] = 45;
	boozeRank[12] = 50;
	boozeRank[13] = 60;
	boozeRank[14] = 70;
	boozeRank[15] = 70;
	
	BestRunNarcs = new Array();
	BestRunNarcs[0] = 0;
	BestRunNarcs[1] = 0;
	BestRunNarcs[2] = 0;
	BestRunNarcs[3] = 0;
	BestRunNarcs[4] = 0;
	BestRunNarcs[5] = 0;
	BestRunNarcs[6] = 0;
	BestRunNarcs[7] = 0;
	
	BestRunNarcs[10] = "";
	BestRunNarcs[11] = "";
	BestRunNarcs[12] = "";
	BestRunNarcs[13] = "";
	BestRunNarcs[14] = "";
	BestRunNarcs[15] = "";
	BestRunNarcs[16] = "";
	BestRunNarcs[17] = "";
	
	BestRunBooze = new Array();
	BestRunBooze[0] = 0;
	BestRunBooze[1] = 0;
	BestRunBooze[2] = 0;
	BestRunBooze[3] = 0;
	BestRunBooze[4] = 0;
	BestRunBooze[5] = 0;
	BestRunBooze[6] = 0;
	BestRunBooze[7] = 0;
	
	BestRunBooze[10] = "";
	BestRunBooze[11] = "";
	BestRunBooze[12] = "";
	BestRunBooze[13] = "";
	BestRunBooze[14] = "";
	BestRunBooze[15] = "";
	BestRunBooze[16] = "";
	BestRunBooze[17] = "";
	
	type = new Array();
	type[0] = "Morphine";
	type[10] = "Heroin";
	type[20] = "Opium";
	type[30] = "Cocaine";
	type[40] = "Marihuana";
	type[50] = "Tobacco";
	type[60] = "Glue";
	type[70] = "Wine";
	type[80] = "Cognac";
	type[90] = "Whiskey";
	type[100] = "Amaretto";
	type[110] = "Beer";
	type[120] = "Port";
	type[130] = "Rum";
	
	paypre = parseFloat(document.getElementById("PayBR").value);
	famstat = document.getElementById("FamilyBR").value;

	switch (famstat) {
		case "0" : 
		  paypre -= 0.01; 
		  break; 
		case "1" : 
		  paypre = 1; 
		  break; 
		case "2" : 
		  break; 
		case "3" : 
		  paypre = 1; 
		  break; 
	} 

	brnarcs = 0;
	brnarcscity = '';
	brbooze = 0;
	brboozecity = '';
	
	for (var j = 0; j < 140; j+=10 ) {
	
		pmax = 0;
		citymax = '';
		pmin = 30000;
		citymin = '';
		
		for (var i = 0; i < 8; i++) {
			city = cityType[i+j];
			price = parseInt(document.getElementById(city).innerHTML);
			if (price != 0) {
				if (price > pmax) {
					pmax = price;
					citymax = city;
				}
				if (price < pmin) {
					pmin = price;
					citymin = city;
				}
			}
		
			if (parseInt(document.getElementById("CityBR").value) != -1) {
				citystartprice = parseInt(document.getElementById(cityType[parseInt(document.getElementById("CityBR").value)+j]).innerHTML);
				if (j<70) {
					narcsruntemp = Math.floor((price*paypre - citystartprice)*narcsRank[parseInt(document.getElementById("RankBR").value)]);
					if (narcsruntemp > BestRunNarcs[i]) { 
						BestRunNarcs[i] = narcsruntemp;
						BestRunNarcs[i+10] = type[j];
					}
				} else {
					boozeruntemp = Math.floor((price*paypre - citystartprice)*boozeRank[parseInt(document.getElementById("RankBR").value)]);
					if (boozeruntemp > BestRunBooze[i]) { 
						BestRunBooze[i] = boozeruntemp;
						BestRunBooze[i+10] = type[j];
					}
				}
			}
		
		}
		document.getElementById(citymax).style.background='#FF6600';
		document.getElementById(citymin).style.background='#66FF00';

		if (parseInt(document.getElementById("CityBR").value) != -1 && parseInt(document.getElementById("RankBR").value) != -1) {
			document.getElementById(cityType[i+j]).style.background='#FFFFFF';
			cityprice = parseInt(document.getElementById(cityType[parseInt(document.getElementById("CityBR").value)+j]).innerHTML);
			if (cityprice == 0) {
				document.getElementById(cityType[i+j]).innerHTML = "Please update your city price first.";
			} else {
				document.getElementById(cityType[i+j]).style.background='#FFFFFF';
			if (j<70) {
					narcsruntemp = Math.floor((pmax*paypre - cityprice)*narcsRank[parseInt(document.getElementById("RankBR").value)]);
					document.getElementById(cityType[i+j]).innerHTML = narcsruntemp;
					if (narcsruntemp > brnarcs) { 
						brnarcs = narcsruntemp;
						brnarcscity = cityType[i+j];
					}
				} else {
					boozeruntemp = Math.floor((pmax*paypre - cityprice)*boozeRank[parseInt(document.getElementById("RankBR").value)]);
					document.getElementById(cityType[i+j]).innerHTML = boozeruntemp;
					if (boozeruntemp > brbooze) { 
						brbooze = boozeruntemp; 
						brboozecity = cityType[i+j];
					}
				}
			}
		}
	}
	document.getElementById(brnarcscity).style.background='#FF6600';
	document.getElementById(brboozecity).style.background='#FF6600';
	if (parseInt(document.getElementById("CityBR").value) != -1) {
				
		baltimoreRunProfit = BestRunBooze[0] + BestRunNarcs[0] - travelCosts[parseInt(document.getElementById("CityBR").value)];
		document.getElementById("BR-booze-Baltimore").innerHTML = BestRunBooze[10];	
		document.getElementById("BR-narcs-Baltimore").innerHTML = BestRunNarcs[10];	
		document.getElementById("BR-profit-Baltimore").innerHTML = baltimoreRunProfit;
		bestRunProfit = baltimoreRunProfit;
		bestBoozeBuy = BestRunBooze[10];
		bestNarcsBuy = BestRunNarcs[10];
		bestSellCity = "Baltimore";
		
		chicagoRunProfit = BestRunBooze[1] + BestRunNarcs[1] - travelCosts[parseInt(document.getElementById("CityBR").value)+10];
		document.getElementById("BR-booze-Chicago").innerHTML = BestRunBooze[11];	
		document.getElementById("BR-narcs-Chicago").innerHTML = BestRunNarcs[11];	
		document.getElementById("BR-profit-Chicago").innerHTML = chicagoRunProfit;
		if (chicagoRunProfit > bestRunProfit) {
			bestRunProfit = chicagoRunProfit;
			bestBoozeBuy = BestRunBooze[11];
			bestNarcsBuy = BestRunNarcs[11];
			bestSellCity = "Chicago";
		}
		
		corleoneRunProfit = BestRunBooze[2] + BestRunNarcs[2] - travelCosts[parseInt(document.getElementById("CityBR").value)+20];
		document.getElementById("BR-booze-Corleone").innerHTML = BestRunBooze[12];	
		document.getElementById("BR-narcs-Corleone").innerHTML = BestRunNarcs[12];	
		document.getElementById("BR-profit-Corleone").innerHTML = corleoneRunProfit;
		if (corleoneRunProfit > bestRunProfit) {
			bestRunProfit = corleoneRunProfit;
			bestBoozeBuy = BestRunBooze[12];
			bestNarcsBuy = BestRunNarcs[12];
			bestSellCity = "Corleone";
		}
		
		detroitRunProfit = BestRunBooze[3] + BestRunNarcs[3] - travelCosts[parseInt(document.getElementById("CityBR").value)+30];
		document.getElementById("BR-booze-Detroit").innerHTML = BestRunBooze[13];	
		document.getElementById("BR-narcs-Detroit").innerHTML = BestRunNarcs[13];	
		document.getElementById("BR-profit-Detroit").innerHTML = detroitRunProfit;
		if (detroitRunProfit > bestRunProfit) {
			bestRunProfit = detroitRunProfit;
			bestBoozeBuy = BestRunBooze[13];
			bestNarcsBuy = BestRunNarcs[13];
			bestSellCity = "Detroit";
		}
		
		lasVegasRunProfit = BestRunBooze[4] + BestRunNarcs[4] - travelCosts[parseInt(document.getElementById("CityBR").value)+40];
		document.getElementById("BR-booze-LasVegas").innerHTML = BestRunBooze[14];	
		document.getElementById("BR-narcs-LasVegas").innerHTML = BestRunNarcs[14];	
		document.getElementById("BR-profit-LasVegas").innerHTML = lasVegasRunProfit;
		if (lasVegasRunProfit > bestRunProfit) {
			bestRunProfit = lasVegasRunProfit;
			bestBoozeBuy = BestRunBooze[14];
			bestNarcsBuy = BestRunNarcs[14];
			bestSellCity = "Las Vegas";
		}
		
		newYorkRunProfit = BestRunBooze[5] + BestRunNarcs[5] - travelCosts[parseInt(document.getElementById("CityBR").value)+50];
		document.getElementById("BR-booze-NewYork").innerHTML = BestRunBooze[15];	
		document.getElementById("BR-narcs-NewYork").innerHTML = BestRunNarcs[15];	
		document.getElementById("BR-profit-NewYork").innerHTML = newYorkRunProfit;
		if (newYorkRunProfit > bestRunProfit) {
			bestRunProfit = newYorkRunProfit;
			bestBoozeBuy = BestRunBooze[15];
			bestNarcsBuy = BestRunNarcs[15];
			bestSellCity = "New York";
		}
		
		philadelphiaRunProfit = BestRunBooze[6] + BestRunNarcs[6] - travelCosts[parseInt(document.getElementById("CityBR").value)+60];
		document.getElementById("BR-booze-Philadelphia").innerHTML = BestRunBooze[16];	
		document.getElementById("BR-narcs-Philadelphia").innerHTML = BestRunNarcs[16];	
		document.getElementById("BR-profit-Philadelphia").innerHTML = philadelphiaRunProfit;
		if (philadelphiaRunProfit > bestRunProfit) {
			bestRunProfit = philadelphiaRunProfit;
			bestBoozeBuy = BestRunBooze[16];
			bestNarcsBuy = BestRunNarcs[16];
			bestSellCity = "Philadelphia";
		}
		
		palermoRunProfit = BestRunBooze[7] + BestRunNarcs[7] - travelCosts[parseInt(document.getElementById("CityBR").value)+70];
		document.getElementById("BR-booze-Palermo").innerHTML = BestRunBooze[17];	
		document.getElementById("BR-narcs-Palermo").innerHTML = BestRunNarcs[17];	
		document.getElementById("BR-profit-Palermo").innerHTML = palermoRunProfit;
		if (palermoRunProfit > bestRunProfit) {
			bestRunProfit = palermoRunProfit;
			bestBoozeBuy = BestRunBooze[17];
			bestNarcsBuy = BestRunNarcs[17];
			bestSellCity = "Palermo";
		}
	
		cityName = new Array();
		cityName[0] = "Baltimore";
		cityName[1] = "Chicago";
		cityName[2] = "Corleone";
		cityName[3] = "Detroit";
		cityName[4] = "Las Vegas";
		cityName[5] = "New York";
		cityName[6] = "Philadelphia";
		cityName[7] = "Palermo";
	
		document.getElementById("bestruntext").innerHTML = "<h1>The best run is: Buy " + bestBoozeBuy + " and " + bestNarcsBuy + " in your city (" + cityName[parseInt(document.getElementById("CityBR").value)] + ") and sell it in " + bestSellCity + ".</h1>";
		
	}
}
