// All this code is the creation of laserdog@gmail.com
// Save for the addCommas() function, which I found released via public domain
// my real name is available here: http://101010.org/kyle/gurps/images/name_g.jpg
// All the encoded data is the property of Steve Jackson Games, and is used
// here in accordance with their Online Policy

var sections = new Array('front', 'center', 'rear');
var subSections = new Array('1', '2', '3', '4', '5', '6', 'core');
var designFeatures = new Array('1', '2', '3', '4', '5', '6', '7', '8');
var miscDesignFeatures = new Array('high_automation', 'total_automation', 'ramRockets', 'nmpDrive', 'singularityDrive');
var armorDesignFeatures = new Array('front_harden_armor', 'center_harden_armor', 'rear_harden_armor');

function init () {
	var getVars = getQsArgs();
	if (getVars['s'].length == 44) {
		// eat the sm first
		var serialCfg = getVars['s'];
		document.getElementById('sm').selectedIndex = serialCfg.substring(0,2);

		// now do systems
		var systemCnt = 1;
		for (var i in sections) {
			for (var j in subSections) {
				var sysSelectId = sections[i]+'_'+subSections[j];
				var sysSelect = document.getElementById(sysSelectId);
				sysSelect.selectedIndex = parseInt(serialCfg.substring(2*systemCnt, 2*systemCnt+2));
				systemCnt++;
			}
		}
	}
	if ( getVars['h'].length == 22 ) {
		var habOptCnt = 0;
		for (habitatOpt in HabitatCost) {
			document.getElementById(habitatOpt).value = parseInt(getVars['h'].substring(2*habOptCnt, 2*habOptCnt+2));
			habOptCnt++;
		}
	}
	if ( getVars['d'].length == 16 ) {
		designCnt = 0;
		for (var i in designFeatures) {
			var designFeatureNum = designFeatures[i];
			var designFeatureId = "opt"+designFeatureNum;
			document.getElementById(designFeatureId).checked = parseInt(getVars['d'].substring(designCnt, designCnt+1)) % 2;
			designCnt++;
		}
	   	 for (var i in miscDesignFeatures) {
			var miscFeatureId = miscDesignFeatures[i];
			document.getElementById(miscFeatureId).checked = parseInt(getVars['d'].substring(designCnt, designCnt+1)) % 2;
			designCnt++;
		}
	   	 for (var i in armorDesignFeatures) {
			document.getElementById(armorDesignFeatures[i]).checked = parseInt(getVars['d'].substring(designCnt, designCnt+1)) % 2;
			designCnt++;
		}
	}
	recalculate();
}

function getSerializedUrl (setCost) {
	var keyPairs = new Array;

	var s = padDigits(document.getElementById('sm').selectedIndex,2);
	for (var i in sections) {
		for (var j in subSections) {
			var sysSelectId = sections[i]+'_'+subSections[j];
			s += padDigits(document.getElementById(sysSelectId).selectedIndex,2);
		}
	}
	keyPairs.push('s='+s);

	var h = '';
	var hUsed = false;
	for (habitatOpt in HabitatCost) {
		var hVal = padDigits(document.getElementById(habitatOpt).value,2);
		if ( hVal != '00' ) hUsed = true;
		h += hVal;
	}
	if (hUsed) keyPairs.push('h='+h);

	var d = '';
	var dUsed = '';
	for (var i in designFeatures) {
		var designFeatureNum = designFeatures[i];
		var designFeatureId = "opt"+designFeatureNum;
		var dVal = document.getElementById(designFeatureId).checked + 0;
		if ( dVal != 0 ) dUsed = true;
		d += dVal;
	}
	for (var i in miscDesignFeatures) {
		var miscFeatureId = miscDesignFeatures[i];
		var dVal = document.getElementById(miscFeatureId).checked + 0;
		if ( dVal != 0 ) dUsed = true;
		d += dVal;
	}
	for (var i in armorDesignFeatures) {
		var miscFeatureId = miscDesignFeatures[i];
		var dVal = document.getElementById(armorDesignFeatures[i]).checked + 0;
		if ( dVal != 0 ) dUsed = true;
		d += dVal;
	}
	if (dUsed) keyPairs.push('d='+d);

	if (setCost) keyPairs.push('c='+document.getElementById('finalCost').innerHTML);

	return keyPairs.join('&');
}

function getQsArgs () {
	var qs = window.location.search.split('?')[1]; // substr eats the '?'
	if (!qs) return false;
	var keyPairResult = new Object;
	keyPairResult['s'] = '';
	keyPairResult['h'] = '';
	keyPairResult['d'] = '';
	var q = qs.split('&');
	for (var i=0; i<q.length; i++) {
		var keyPair = q[i].split('=');
		keyPairResult[keyPair[0]]=keyPair[1];
	}
	return keyPairResult;
}

function recalculate () {
	var errors = '';
	var featureErrors = '';
	var runningCost = 0;
	var workspaceCount = 0;
	var coreSysCount = 0;
	var ramRocketFound = 0;
	var nmpDriveFound = 0;
	var singularityDriveFound = 0;
	var size = document.getElementById('sm').value;
	if ( size >= 5 && size < 20 ) {
		for (var i in sections) {
			for (var j in subSections) {
				var sysSelectId = sections[i]+'_'+subSections[j];
				var sysSelect = document.getElementById(sysSelectId);
				if ( sysSelect.value != null && sysSelect.value != '' ) {
					if ( subSections[j] == 'core' ) {
						coreSysCount++;
					}
					if ( SystemsCost[size][sysSelect.value] == -1 ) {
						errors += 'Error: ' + sysSelect.value + ' is not allowed at SM ' + size + '<br />';
					} else {
						workspaceCount += calcWorkspace(sysSelect.value, size);
						if ( sysSelect.value == 'weapons,spinal_battery') {
							runningCost += SystemsCost[size][sysSelect.value] / 3;
						} else {
							runningCost += SystemsCost[size][sysSelect.value];
						}
						if ( document.getElementById(sections[i]+'_harden_armor').checked && sysSelect.value.substr(0,5) == 'armor' && sysSelect.value != 'armor,organic' ) {
							runningCost += SystemsCost[size][sysSelect.value];
						}
						if ( sections[i] == 'rear' && document.getElementById('ramRockets').checked && sysSelect.value.substr(0,15) == 'reaction_engine' ) {
							for (var engineType in ramRocketEngines) {
								if (engineType == sysSelect.value) {
									runningCost += 4 * SystemsCost[size][sysSelect.value];
									ramRocketFound = 1;
								}
							}
						} else if ( sections[i] == 'rear' && document.getElementById('nmpDrive').checked && sysSelect.value.substr(0,19) == 'reactionless_engine' ) {
									runningCost += 9 * SystemsCost[size][sysSelect.value];
									nmpDriveFound = 1;
						} else if ( document.getElementById('singularityDrive').checked && (sysSelect.value.substr(0,19) == 'reactionless_engine' || sysSelect.value == 'stardrive') ) {
									runningCost += 4 * SystemsCost[size][sysSelect.value];
									singularityDriveFound = 1;
						}
					}
				}
			}
		}
		for (var i in designFeatures) {
			var designFeatureNum = designFeatures[i];
			var designFeatureId = "opt"+designFeatureNum;
			var designFeature = document.getElementById(designFeatureId);

			if ( designFeature.checked ) {
				if ( SystemsCost[size][designFeature.value] == -1 ) {
					featureErrors += 'Error: ' + designFeature.value + ' is not allowed at SM ' + size + '<br />';
				} else {
					runningCost += SystemsCost[size][designFeature.value];
				}
			}
		}
	// Calc habitat costs
	runningCost += getHabitatCost(size);


	// Calc automation costs
	runningCost += applyAutomation(workspaceCount, size);

	if ( document.getElementById('high_automation').checked && size < 12 ) {
		featureErrors += 'Error: High Automation is not allowed at SM ' + size + '<br />';
	}

	if ( document.getElementById('ramRockets').checked && ramRocketFound == 0 ) {
		featureErrors += 'Error: No compatible Ram-Rocket engines found<br />';
	}
	if ( document.getElementById('nmpDrive').checked && nmpDriveFound == 0 ) {
		featureErrors += 'Error: No compatible Negative Mass Propulsion engines found<br />';
	}
	if ( document.getElementById('singularityDrive').checked && singularityDriveFound == 0 ) {
		featureErrors += 'Error: No compatible Singularity Drive engines found<br />';
	}
		
	if ( coreSysCount > 2 ) {
		errors += 'Error: You have too many core systems selected';
	}
	} else {
		errors += 'Error: bad size';
	}

	var sysError=document.getElementById("sysError")
	sysError.innerHTML = errors.replace('_', ' ');

	var featureError=document.getElementById("featureError")
	featureError.innerHTML = featureErrors.replace('_', ' ');

	var fcost=document.getElementById("finalCost")
	fcost.innerHTML = addCommas(Math.round(Math.max(runningCost,0)));

    var urlSpan=document.getElementById("serialCfg")
    urlSpan.innerHTML = getSerializedUrl(0);
    document.getElementById('printLink').href = 'ss_print.html?'+getSerializedUrl(1);

}

function getHabitatCost (size) {
	var total = 0;
	for (habitatOpt in HabitatCost) {
		var habitatTextbox=document.getElementById(habitatOpt);
		if ( habitatTextbox.value > 0 ) {
			total += habitatTextbox.value * HabitatCost[habitatOpt];
		}
	}
	if ( document.getElementById('lessMediumBattery').value > 0 ) {
		total -= document.getElementById('lessMediumBattery').value * SystemsCost[size]['weapons,medium_battery'] / 3;
	}
	if ( document.getElementById('lessSecondaryBattery').value > 0 ) {
		total -= document.getElementById('lessSecondaryBattery').value * SystemsCost[size]['weapons,secondary_battery'] / 10;
	}
	if ( document.getElementById('lessTertiaryBattery').value > 0 ) {
		total -= document.getElementById('lessTertiaryBattery').value * SystemsCost[size]['weapons,tertiary_battery'] / 30;
	}
	return total;
}

function calcWorkspace (system, size) {
	var sysWorkspace = 0;
	var noMaintenceSys = new Array ('armor', 'cargo_hold', 'external_clamp', 'fuel_tank', 'passenger_seating', 'soft-landing_system', 'solar_panel_array');
	var requiredWorkspaces = new Array(0, 0, 0, 0, 0, 1, 3, 10, 30, 100, 300);
	var systemBase = system.split(',');
	if ( system == 'engine_room' ) {
		if ( size >= 5 && size <= 8 ) {
			sysWorkspace++;
		} else if ( size == 9 ) {
			sysWorkspace += 2;
		}
	} else {
		var needsMaintence = 1;
		for ( var i=0; i<noMaintenceSys.length; i++ ) {
			if (systemBase[0] == noMaintenceSys[i]) {
				needsMaintence = 0;
			}
		}
		if ( needsMaintence == 1 ) {
			sysWorkspace += requiredWorkspaces[(size-5)];
		}
	}
	return sysWorkspace;
}

function applyAutomation (workspaces, size) {
	var totalAutomationCost = 5e6;
	var highAutomationCost = 1e6;
	var automationCost = 0;

	if ( document.getElementById('high_automation').checked ) {
		if ( size >= 12 ) {
			automationCost = highAutomationCost * (workspaces - Math.floor(workspaces/10));
			workspaces = Math.floor(workspaces / 10);
		}
	}
	if ( document.getElementById('total_automation').checked) {
		automationCost += workspaces * totalAutomationCost;
		workspaces = 0;
	}

	var workspaceSpan=document.getElementById("workspaces")
	workspaceSpan.innerHTML = workspaces;
	return automationCost
}

function reset() {
	for (var i in sections) {
		for (var j in subSections) {
			var sysSelectId = sections[i]+'_'+subSections[j];
			document.getElementById(sysSelectId).value = '';
		}
	}
	for (var i in designFeatures) {
		var designFeatureNum = designFeatures[i];
		var designFeatureId = "opt"+designFeatureNum;
		document.getElementById(designFeatureId).checked = 0;
	}
    for (var i in miscDesignFeatures) {
		var miscFeatureId = miscDesignFeatures[i];
		document.getElementById(miscFeatureId).checked = 0;
	}
	for (var i in armorDesignFeatures) {
		document.getElementById(armorDesignFeatures[i]).checked = 0;
	}

	for (habitatOpt in HabitatCost) {
		document.getElementById(habitatOpt).value=0;
	}
	document.getElementById('sm').value = 5;
	recalculate();
}

function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}

function padDigits(n, totalDigits) 
{
	if (parseInt(n) > 99) return '99';
	n = n.toString(); 
	var pd = ''; 
	if (totalDigits > n.length) { 
		for (i=0; i < (totalDigits-n.length); i++) { 
			pd += '0'; 
		} 
	} 
	return pd + n.toString(); 
} 

var SystemsCost = new Object();
for (i=5; i<22; i++) {
  SystemsCost[i] = new Object();
}
SystemsCost[5]['armor,ice'] = 0;
SystemsCost[5]['armor,rock'] = 0;
SystemsCost[5]['armor,steel'] = 6e3;
SystemsCost[5]['armor,light_alloy'] = 15e3;
SystemsCost[5]['armor,metallic_laminate'] = 30e3;
SystemsCost[5]['armor,adv_metallic_laminate'] = 60e3;
SystemsCost[5]['armor,nanocomposite'] = 150e3;
SystemsCost[5]['armor,organic'] = 10e3;
SystemsCost[5]['armor,diamondoid'] = 300e3;
SystemsCost[5]['armor,exotic_laminate'] = 600e3;
SystemsCost[5]['cargo_hold'] = 0;
SystemsCost[5]['cloaking_device'] = 1e6;
SystemsCost[5]['contragravity_lifter'] = 300e3;
SystemsCost[5]['control_room'] = 60e3;
SystemsCost[5]['defensive_ecm'] = 300e3;
SystemsCost[5]['engine_room'] = 15e3;
SystemsCost[5]['array,enhanced'] = 60e3;
SystemsCost[5]['array,science'] = 300e3;
SystemsCost[5]['array,tactical'] = 300e3;
SystemsCost[5]['array,multipurpose'] = 600e3;
SystemsCost[5]['external_clamp'] = 3e3;
SystemsCost[5]['factory'] = -1;
SystemsCost[5]['force_screen,light'] = 500e3;
SystemsCost[5]['force_screen,heavy'] = 500e3;
SystemsCost[5]['fuel_tank'] = 10e3;
SystemsCost[5]['habitat'] = -1;
SystemsCost[5]['hangar_bay'] = 3e3;
SystemsCost[5]['jet_engine'] = 300e3;
SystemsCost[5]['jump_gate'] = -1;
SystemsCost[5]['mining'] = 30e3;
SystemsCost[5]['refinery'] = 30e3;
SystemsCost[5]['open_space'] = -1;
SystemsCost[5]['passenger_seating'] = 10e3;
SystemsCost[5]['power_plant,chemical'] = 15e3;
SystemsCost[5]['power_plant,fission'] = 100e3;
SystemsCost[5]['power_plant,fusion'] = 300e3;
SystemsCost[5]['power_plant,antimatter'] = 600e3;
SystemsCost[5]['power_plant,super_fusion'] = 1e6;
SystemsCost[5]['power_plant,total_conversion'] = 2e6;
SystemsCost[5]['ramscoop'] = 3e6;
SystemsCost[5]['robot_arm'] = 300e3;
SystemsCost[5]['soft-landing_system'] = 50e3;
SystemsCost[5]['solar_panel_array'] = 150e3;
SystemsCost[5]['space_sails'] = 300e3;
SystemsCost[5]['stardrive'] = 300e3;
SystemsCost[5]['stasis_web'] = 2e6;
SystemsCost[5]['weapons,major_battery'] = 150e3;
SystemsCost[5]['weapons,medium_battery'] = 150e3;
SystemsCost[5]['weapons,secondary_battery'] = -1;
SystemsCost[5]['weapons,tertiary_battery'] = -1;
//SystemsCost[5]['weapons,spinal_battery'] = 166.66e3;
SystemsCost[5]['artificial_gravity'] = 30e3;
SystemsCost[5]['gravitic_compensators'] = 30e3;
SystemsCost[5]['reaction_engine,chemical'] = 60e3;
SystemsCost[5]['reaction_engine,electric'] = 100e3;
SystemsCost[5]['reaction_engine,fission'] = 150e3;
SystemsCost[5]['reaction_engine,nuclear_pulse'] = 300e3;
SystemsCost[5]['reaction_engine,fusion'] = 300e3;
SystemsCost[5]['reaction_engine,antimatter'] = 150e3;
//SystemsCost[5]['reaction_engine,total_conv'] = 150e3;
SystemsCost[5]['reactionless_engine,rotary'] = 15e3;
SystemsCost[5]['reactionless_engine,standard'] = 30e3;
SystemsCost[5]['reactionless_engine,hot'] = 100e3;
SystemsCost[5]['reactionless_engine,super'] = 200e3;
SystemsCost[5]['reactionless_engine,subwarp'] = 300e3;
SystemsCost[6]['armor,ice'] = 0;
SystemsCost[6]['armor,rock'] = 0;
SystemsCost[6]['armor,steel'] = 20e3;
SystemsCost[6]['armor,light_alloy'] = 50e3;
SystemsCost[6]['armor,metallic_laminate'] = 100e3;
SystemsCost[6]['armor,adv_metallic_laminate'] = 200e3;
SystemsCost[6]['armor,nanocomposite'] = 500e3;
SystemsCost[6]['armor,organic'] = 30e3;
SystemsCost[6]['armor,diamondoid'] = 1e6;
SystemsCost[6]['armor,exotic_laminate'] = 2e6;
SystemsCost[6]['cargo_hold'] = 0;
SystemsCost[6]['cloaking_device'] = 3e6;
SystemsCost[6]['contragravity_lifter'] = 1e6;
SystemsCost[6]['control_room'] = 200e3;
SystemsCost[6]['defensive_ecm'] = 1e6;
SystemsCost[6]['engine_room'] = 30e3;
SystemsCost[6]['array,enhanced'] = 200e3;
SystemsCost[6]['array,science'] = 1e6;
SystemsCost[6]['array,tactical'] = 1e6;
SystemsCost[6]['array,multipurpose'] = 2e6;
SystemsCost[6]['external_clamp'] = 10e3;
SystemsCost[6]['factory'] = 5e6;
SystemsCost[6]['force_screen,light'] = 1.5e6;
SystemsCost[6]['force_screen,heavy'] = 1.5e6;
SystemsCost[6]['fuel_tank'] = 30e3;
SystemsCost[6]['habitat'] = 100e3;
SystemsCost[6]['hangar_bay'] = 10e3;
SystemsCost[6]['jet_engine'] = 1e6;
SystemsCost[6]['jump_gate'] = -1;
SystemsCost[6]['mining'] = 100e3;
SystemsCost[6]['refinery'] = 100e3;
SystemsCost[6]['open_space'] = -1;
SystemsCost[6]['passenger_seating'] = 30e3;
SystemsCost[6]['power_plant,chemical'] = 50e3;
SystemsCost[6]['power_plant,fission'] = 300e3;
SystemsCost[6]['power_plant,fusion'] = 1e6;
SystemsCost[6]['power_plant,antimatter'] = 2e6;
SystemsCost[6]['power_plant,super_fusion'] = 3e6;
SystemsCost[6]['power_plant,total_conversion'] = 6e6;
SystemsCost[6]['ramscoop'] = 10e6;
SystemsCost[6]['robot_arm'] = 1e6;
SystemsCost[6]['soft-landing_system'] = 100e3;
SystemsCost[6]['solar_panel_array'] = 500e3;
SystemsCost[6]['space_sails'] = 1e6;
SystemsCost[6]['stardrive'] = 1e6;
SystemsCost[6]['stasis_web'] = 5e6;
SystemsCost[6]['weapons,major_battery'] = 600e3;
SystemsCost[6]['weapons,medium_battery'] = 600e3;
SystemsCost[6]['weapons,secondary_battery'] = 600e3;
SystemsCost[6]['weapons,tertiary_battery'] = -1;
//SystemsCost[6]['weapons,spinal_battery'] = 500e3;
SystemsCost[6]['artificial_gravity'] = 0.1e6;
SystemsCost[6]['gravitic_compensators'] = 0.1e6;
SystemsCost[6]['reaction_engine,chemical'] = 200e3;
SystemsCost[6]['reaction_engine,electric'] = 300e3;
SystemsCost[6]['reaction_engine,fission'] = 500e3;
SystemsCost[6]['reaction_engine,nuclear_pulse'] = 1e6;
SystemsCost[6]['reaction_engine,fusion'] = 1e6;
SystemsCost[6]['reaction_engine,antimatter'] = 500e3;
//SystemsCost[6]['reaction_engine,total_conv'] = 500e3;
SystemsCost[6]['reactionless_engine,rotary'] = 50e3;
SystemsCost[6]['reactionless_engine,standard'] = 100e3;
SystemsCost[6]['reactionless_engine,hot'] = 300e3;
SystemsCost[6]['reactionless_engine,super'] = 600e6;
SystemsCost[6]['reactionless_engine,subwarp'] = 1e6;
SystemsCost[7]['armor,ice'] = 0;
SystemsCost[7]['armor,rock'] = 0;
SystemsCost[7]['armor,steel'] = 60e3;
SystemsCost[7]['armor,light_alloy'] = 150e3;
SystemsCost[7]['armor,metallic_laminate'] = 300e3;
SystemsCost[7]['armor,adv_metallic_laminate'] = 600e3;
SystemsCost[7]['armor,nanocomposite'] = 1.5e6;
SystemsCost[7]['armor,organic'] = 100e3;
SystemsCost[7]['armor,diamondoid'] = 3e6;
SystemsCost[7]['armor,exotic_laminate'] = 6e6;
SystemsCost[7]['cargo_hold'] = 0;
SystemsCost[7]['cloaking_device'] = 10e6;
SystemsCost[7]['contragravity_lifter'] = 3e6;
SystemsCost[7]['control_room'] = 600e3;
SystemsCost[7]['defensive_ecm'] = 3e6;
SystemsCost[7]['engine_room'] = 100e3;
SystemsCost[7]['array,enhanced'] = 600e3;
SystemsCost[7]['array,science'] = 3e6;
SystemsCost[7]['array,tactical'] = 3e6;
SystemsCost[7]['array,multipurpose'] = 6e6;
SystemsCost[7]['external_clamp'] = 30e3;
SystemsCost[7]['factory'] = 15e6;
SystemsCost[7]['force_screen,light'] = 5e6;
SystemsCost[7]['force_screen,heavy'] = 5e6;
SystemsCost[7]['fuel_tank'] = 100e3;
SystemsCost[7]['habitat'] = 300e3;
SystemsCost[7]['hangar_bay'] = 30e3;
SystemsCost[7]['jet_engine'] = 3e6;
SystemsCost[7]['jump_gate'] = -1;
SystemsCost[7]['mining'] = 300e3;
SystemsCost[7]['refinery'] = 300e3;
SystemsCost[7]['open_space'] = -1;
SystemsCost[7]['passenger_seating'] = 100e3;
SystemsCost[7]['power_plant,chemical'] = 1.5e5;
SystemsCost[7]['power_plant,fission'] = 1e6;
SystemsCost[7]['power_plant,fusion'] = 3e6;
SystemsCost[7]['power_plant,antimatter'] = 6e6;
SystemsCost[7]['power_plant,super_fusion'] = 10e6;
SystemsCost[7]['power_plant,total_conversion'] = 20e6;
SystemsCost[7]['ramscoop'] = 30e6;
SystemsCost[7]['robot_arm'] = 3e6;
SystemsCost[7]['soft-landing_system'] = 200e3;
SystemsCost[7]['solar_panel_array'] = 1.5e6;
SystemsCost[7]['space_sails'] = 3e6;
SystemsCost[7]['stardrive'] = 3e6;
SystemsCost[7]['stasis_web'] = 10e6;
SystemsCost[7]['weapons,major_battery'] = 1.5e6;
SystemsCost[7]['weapons,medium_battery'] = 1.5e6;
SystemsCost[7]['weapons,secondary_battery'] = 1.5e6;
SystemsCost[7]['weapons,tertiary_battery'] = 1.5e6;
//SystemsCost[7]['weapons,spinal_battery'] = 1.666e6;
SystemsCost[7]['artificial_gravity'] = 0.3e6;
SystemsCost[7]['gravitic_compensators'] = 0.3e6;
SystemsCost[7]['reaction_engine,chemical'] = 600e3;
SystemsCost[7]['reaction_engine,electric'] = 1e6;
SystemsCost[7]['reaction_engine,fission'] = 1.5e6;
SystemsCost[7]['reaction_engine,nuclear_pulse'] = 3e6;
SystemsCost[7]['reaction_engine,fusion'] = 3e6;
SystemsCost[7]['reaction_engine,antimatter'] = 1.5e6;
//SystemsCost[7]['reaction_engine,total_conv'] = 1.5e6;
SystemsCost[7]['reactionless_engine,rotary'] = 150e3;
SystemsCost[7]['reactionless_engine,standard'] = 300e3;
SystemsCost[7]['reactionless_engine,hot'] = 1e6;
SystemsCost[7]['reactionless_engine,super'] = 2e6;
SystemsCost[7]['reactionless_engine,subwarp'] = 3e6;
SystemsCost[8]['armor,ice'] = 0;
SystemsCost[8]['armor,rock'] = 0;
SystemsCost[8]['armor,steel'] = 200e3;
SystemsCost[8]['armor,light_alloy'] = 500e3;
SystemsCost[8]['armor,metallic_laminate'] = 1e6;
SystemsCost[8]['armor,adv_metallic_laminate'] = 2e6;
SystemsCost[8]['armor,nanocomposite'] = 5e6;
SystemsCost[8]['armor,organic'] = 300e3;
SystemsCost[8]['armor,diamondoid'] = 10e6;
SystemsCost[8]['armor,exotic_laminate'] = 20e6;
SystemsCost[8]['cargo_hold'] = 0;
SystemsCost[8]['cloaking_device'] = 30e6;
SystemsCost[8]['contragravity_lifter'] = 10e6;
SystemsCost[8]['control_room'] = 2e6;
SystemsCost[8]['defensive_ecm'] = 10e6;
SystemsCost[8]['engine_room'] = 300e3;
SystemsCost[8]['array,enhanced'] = 2e6;
SystemsCost[8]['array,science'] = 10e6;
SystemsCost[8]['array,tactical'] = 10e6;
SystemsCost[8]['array,multipurpose'] = 20e6;
SystemsCost[8]['external_clamp'] = 100e3;
SystemsCost[8]['factory'] = 50e6;
SystemsCost[8]['force_screen,light'] = 15e6;
SystemsCost[8]['force_screen,heavy'] = 15e6;
SystemsCost[8]['fuel_tank'] = 300e3;
SystemsCost[8]['habitat'] = 1e6;
SystemsCost[8]['hangar_bay'] = 100e3;
SystemsCost[8]['jet_engine'] = 10e6;
SystemsCost[8]['jump_gate'] = -1;
SystemsCost[8]['mining'] = 1e6;
SystemsCost[8]['refinery'] = 1e6;
SystemsCost[8]['open_space'] = 100e3;
SystemsCost[8]['passenger_seating'] = 300e3;
SystemsCost[8]['power_plant,chemical'] = 5e5;
SystemsCost[8]['power_plant,fission'] = 3e6;
SystemsCost[8]['power_plant,fusion'] = 10e6;
SystemsCost[8]['power_plant,antimatter'] = 20e6;
SystemsCost[8]['power_plant,super_fusion'] = 30e6;
SystemsCost[8]['power_plant,total_conversion'] = 60e6;
SystemsCost[8]['ramscoop'] = 100e6;
SystemsCost[8]['robot_arm'] = 10e6;
SystemsCost[8]['soft-landing_system'] = 500e3;
SystemsCost[8]['solar_panel_array'] = 5e6;
SystemsCost[8]['space_sails'] = 10e6;
SystemsCost[8]['stardrive'] = 10e6;
SystemsCost[8]['stasis_web'] = 20e6;
SystemsCost[8]['weapons,major_battery'] = 6e6;
SystemsCost[8]['weapons,medium_battery'] = 6e6;
SystemsCost[8]['weapons,secondary_battery'] = 6e6;
SystemsCost[8]['weapons,tertiary_battery'] = 6e6;
//SystemsCost[8]['weapons,spinal_battery'] = 3e6;
SystemsCost[8]['artificial_gravity'] = 1e6;
SystemsCost[8]['gravitic_compensators'] = 1e6;
SystemsCost[8]['reaction_engine,chemical'] = 2e6;
SystemsCost[8]['reaction_engine,electric'] = 3e6;
SystemsCost[8]['reaction_engine,fission'] = 5e6;
SystemsCost[8]['reaction_engine,nuclear_pulse'] = 10e6;
SystemsCost[8]['reaction_engine,fusion'] = 10e6;
SystemsCost[8]['reaction_engine,antimatter'] = 5e6;
//SystemsCost[8]['reaction_engine,total_conv'] = 5e6;
SystemsCost[8]['reactionless_engine,rotary'] = 500e3;
SystemsCost[8]['reactionless_engine,standard'] = 1e6;
SystemsCost[8]['reactionless_engine,hot'] = 3e6;
SystemsCost[8]['reactionless_engine,super'] = 6e6;
SystemsCost[8]['reactionless_engine,subwarp'] = 10e6;
SystemsCost[9]['armor,ice'] = 0;
SystemsCost[9]['armor,rock'] = 0;
SystemsCost[9]['armor,steel'] = 600e3;
SystemsCost[9]['armor,light_alloy'] = 1.5e6;
SystemsCost[9]['armor,metallic_laminate'] = 3e6;
SystemsCost[9]['armor,adv_metallic_laminate'] = 6e6;
SystemsCost[9]['armor,nanocomposite'] = 15e6;
SystemsCost[9]['armor,organic'] = 1e6;
SystemsCost[9]['armor,diamondoid'] = 30e6;
SystemsCost[9]['armor,exotic_laminate'] = 60e6;
SystemsCost[9]['cargo_hold'] = 0;
SystemsCost[9]['cloaking_device'] = 100e6;
SystemsCost[9]['contragravity_lifter'] = 30e6;
SystemsCost[9]['control_room'] = 6e6;
SystemsCost[9]['defensive_ecm'] = 30e6;
SystemsCost[9]['engine_room'] = 1e6;
SystemsCost[9]['array,enhanced'] = 6e6;
SystemsCost[9]['array,science'] = 30e6;
SystemsCost[9]['array,tactical'] = 30e6;
SystemsCost[9]['array,multipurpose'] = 60e6;
SystemsCost[9]['external_clamp'] = 300e3;
SystemsCost[9]['factory'] = 150e6;
SystemsCost[9]['force_screen,light'] = 50e6;
SystemsCost[9]['force_screen,heavy'] = 50e6;
SystemsCost[9]['fuel_tank'] = 1e6;
SystemsCost[9]['habitat'] = 3e6;
SystemsCost[9]['hangar_bay'] = 300e3;
SystemsCost[9]['jet_engine'] = 30e6;
SystemsCost[9]['jump_gate'] = 150e6;
SystemsCost[9]['mining'] = 3e6;
SystemsCost[9]['refinery'] = 3e6;
SystemsCost[9]['open_space'] = 200e3;
SystemsCost[9]['passenger_seating'] = 1e6;
SystemsCost[9]['power_plant,chemical'] = 15e5;
SystemsCost[9]['power_plant,fission'] = 10e6;
SystemsCost[9]['power_plant,fusion'] = 30e6;
SystemsCost[9]['power_plant,antimatter'] = 60e6;
SystemsCost[9]['power_plant,super_fusion'] = 100e6;
SystemsCost[9]['power_plant,total_conversion'] = 200e6;
SystemsCost[9]['ramscoop'] = 300e6;
SystemsCost[9]['robot_arm'] = 30e6;
SystemsCost[9]['soft-landing_system'] = 1e6;
SystemsCost[9]['solar_panel_array'] = 15e6;
SystemsCost[9]['space_sails'] = 30e6;
SystemsCost[9]['stardrive'] = 30e6;
SystemsCost[9]['stasis_web'] = 50e6;
SystemsCost[9]['weapons,major_battery'] = 15e6;
SystemsCost[9]['weapons,medium_battery'] = 15e6;
SystemsCost[9]['weapons,secondary_battery'] = 15e6;
SystemsCost[9]['weapons,tertiary_battery'] = 15e6;
//SystemsCost[9]['weapons,spinal_battery'] = 16.666e6;
SystemsCost[9]['artificial_gravity'] = 3e6;
SystemsCost[9]['gravitic_compensators'] = 3e6;
SystemsCost[9]['reaction_engine,chemical'] = 6e6;
SystemsCost[9]['reaction_engine,electric'] = 10e6;
SystemsCost[9]['reaction_engine,fission'] = 15e6;
SystemsCost[9]['reaction_engine,nuclear_pulse'] = 30e6;
SystemsCost[9]['reaction_engine,fusion'] = 30e6;
SystemsCost[9]['reaction_engine,antimatter'] = 15e6;
//SystemsCost[9]['reaction_engine,total_conv'] = 15e6;
SystemsCost[9]['reactionless_engine,rotary'] = 1.5e6;
SystemsCost[9]['reactionless_engine,standard'] = 3e6;
SystemsCost[9]['reactionless_engine,hot'] = 10e6;
SystemsCost[9]['reactionless_engine,super'] = 20e6;
SystemsCost[9]['reactionless_engine,subwarp'] = 30e6;
SystemsCost[10]['armor,ice'] = 0;
SystemsCost[10]['armor,rock'] = 0;
SystemsCost[10]['armor,steel'] = 2e6;
SystemsCost[10]['armor,light_alloy'] = 5e6;
SystemsCost[10]['armor,metallic_laminate'] = 10e6;
SystemsCost[10]['armor,adv_metallic_laminate'] = 20e6;
SystemsCost[10]['armor,nanocomposite'] = 50e6;
SystemsCost[10]['armor,organic'] = 3e6;
SystemsCost[10]['armor,diamondoid'] = 100e6;
SystemsCost[10]['armor,exotic_laminate'] = 200e6;
SystemsCost[10]['cargo_hold'] = 0;
SystemsCost[10]['cloaking_device'] = 300e6;
SystemsCost[10]['contragravity_lifter'] = 100e6;
SystemsCost[10]['control_room'] = 20e6;
SystemsCost[10]['defensive_ecm'] = 100e6;
SystemsCost[10]['engine_room'] = -1;
SystemsCost[10]['array,enhanced'] = 20e6;
SystemsCost[10]['array,science'] = 100e6;
SystemsCost[10]['array,tactical'] = 100e6;
SystemsCost[10]['array,multipurpose'] = 200e6;
SystemsCost[10]['external_clamp'] = 1e6;
SystemsCost[10]['factory'] = 500e6;
SystemsCost[10]['force_screen,light'] = 150e6;
SystemsCost[10]['force_screen,heavy'] = 150e6;
SystemsCost[10]['fuel_tank'] = 3e6;
SystemsCost[10]['habitat'] = 10e6;
SystemsCost[10]['hangar_bay'] = 1e6;
SystemsCost[10]['jet_engine'] = 100e6;
SystemsCost[10]['jump_gate'] = 500e6;
SystemsCost[10]['mining'] = 10e6;
SystemsCost[10]['refinery'] = 10e6;
SystemsCost[10]['open_space'] = 500e3;
SystemsCost[10]['passenger_seating'] = 3e6;
SystemsCost[10]['power_plant,chemical'] = 50e5;
SystemsCost[10]['power_plant,fission'] = 30e6;
SystemsCost[10]['power_plant,fusion'] = 100e6;
SystemsCost[10]['power_plant,antimatter'] = 200e6;
SystemsCost[10]['power_plant,super_fusion'] = 300e6;
SystemsCost[10]['power_plant,total_conversion'] = 600e6;
SystemsCost[10]['ramscoop'] = 1e9;
SystemsCost[10]['robot_arm'] = 100e6;
SystemsCost[10]['soft-landing_system'] = 2e6;
SystemsCost[10]['solar_panel_array'] = 50e6;
SystemsCost[10]['space_sails'] = 100e6;
SystemsCost[10]['stardrive'] = 100e6;
SystemsCost[10]['stasis_web'] = 100e6;
SystemsCost[10]['weapons,major_battery'] = 60e6;
SystemsCost[10]['weapons,medium_battery'] = 60e6;
SystemsCost[10]['weapons,secondary_battery'] = 60e6;
SystemsCost[10]['weapons,tertiary_battery'] = 60e6;
//SystemsCost[10]['weapons,spinal_battery'] = 50e6;
SystemsCost[10]['artificial_gravity'] = 10e6;
SystemsCost[10]['gravitic_compensators'] = 10e6;
SystemsCost[10]['reaction_engine,chemical'] = 20e6;
SystemsCost[10]['reaction_engine,electric'] = 30e6;
SystemsCost[10]['reaction_engine,fission'] = 50e6;
SystemsCost[10]['reaction_engine,nuclear_pulse'] = 100e6;
SystemsCost[10]['reaction_engine,fusion'] = 100e6;
SystemsCost[10]['reaction_engine,antimatter'] = 50e6;
//SystemsCost[10]['reaction_engine,total_conv'] = 50e6;
SystemsCost[10]['reactionless_engine,rotary'] = 5e6;
SystemsCost[10]['reactionless_engine,standard'] = 10e6;
SystemsCost[10]['reactionless_engine,hot'] = 30e6;
SystemsCost[10]['reactionless_engine,super'] = 60e6;
SystemsCost[10]['reactionless_engine,subwarp'] = 100e6;
SystemsCost[11]['armor,ice'] = 0;
SystemsCost[11]['armor,rock'] = 0;
SystemsCost[11]['armor,steel'] = 6e6;
SystemsCost[11]['armor,light_alloy'] = 15e6;
SystemsCost[11]['armor,metallic_laminate'] = 30e6;
SystemsCost[11]['armor,adv_metallic_laminate'] = 60e6;
SystemsCost[11]['armor,nanocomposite'] = 150e6;
SystemsCost[11]['armor,organic'] = 10e6;
SystemsCost[11]['armor,diamondoid'] = 300e6;
SystemsCost[11]['armor,exotic_laminate'] = 600e6;
SystemsCost[11]['cargo_hold'] = 0;
SystemsCost[11]['cloaking_device'] = 1e9;
SystemsCost[11]['contragravity_lifter'] = 300e6;
SystemsCost[11]['control_room'] = 60e6;
SystemsCost[11]['defensive_ecm'] = 300e6;
SystemsCost[11]['engine_room'] = -1;
SystemsCost[11]['array,enhanced'] = 60e6;
SystemsCost[11]['array,science'] = 300e6;
SystemsCost[11]['array,tactical'] = 300e6;
SystemsCost[11]['array,multipurpose'] = 600e6;
SystemsCost[11]['external_clamp'] = 3e6;
SystemsCost[11]['factory'] = 1.5e9;
SystemsCost[11]['force_screen,light'] = 500e6;
SystemsCost[11]['force_screen,heavy'] = 500e6;
SystemsCost[11]['fuel_tank'] = 10e6;
SystemsCost[11]['habitat'] = 30e6;
SystemsCost[11]['hangar_bay'] = 3e6;
SystemsCost[11]['jet_engine'] = 300e6;
SystemsCost[11]['jump_gate'] = 1.5e9;
SystemsCost[11]['mining'] = 30e6;
SystemsCost[11]['refinery'] = 30e6;
SystemsCost[11]['open_space'] = 1e6;
SystemsCost[11]['passenger_seating'] = 10e6;
SystemsCost[11]['power_plant,chemical'] = 15e6;
SystemsCost[11]['power_plant,fission'] = 100e6;
SystemsCost[11]['power_plant,fusion'] = 300e6;
SystemsCost[11]['power_plant,antimatter'] = 600e6;
SystemsCost[11]['power_plant,super_fusion'] = 1e9;
SystemsCost[11]['power_plant,total_conversion'] = 2e9;
SystemsCost[11]['ramscoop'] = 3e9;
SystemsCost[11]['robot_arm'] = 300e6;
SystemsCost[11]['soft-landing_system'] = 5e6;
SystemsCost[11]['solar_panel_array'] = 150e6;
SystemsCost[11]['space_sails'] = 300e6;
SystemsCost[11]['stardrive'] = 300e6;
SystemsCost[11]['stasis_web'] = 200e6;
SystemsCost[11]['weapons,major_battery'] = 150e6;
SystemsCost[11]['weapons,medium_battery'] = 150e6;
SystemsCost[11]['weapons,secondary_battery'] = 150e6;
SystemsCost[11]['weapons,tertiary_battery'] = 150e6;
//SystemsCost[11]['weapons,spinal_battery'] = 166.66e6;
SystemsCost[11]['artificial_gravity'] = 30e6;
SystemsCost[11]['gravitic_compensators'] = 30e6;
SystemsCost[11]['reaction_engine,chemical'] = 60e6;
SystemsCost[11]['reaction_engine,electric'] = 100e6;
SystemsCost[11]['reaction_engine,fission'] = 150e6;
SystemsCost[11]['reaction_engine,nuclear_pulse'] = 300e6;
SystemsCost[11]['reaction_engine,fusion'] = 300e6;
SystemsCost[11]['reaction_engine,antimatter'] = 150e6;
//SystemsCost[11]['reaction_engine,total_conv'] = 150e6;
SystemsCost[11]['reactionless_engine,rotary'] = 15e6;
SystemsCost[11]['reactionless_engine,standard'] = 30e6;
SystemsCost[11]['reactionless_engine,hot'] = 100e6;
SystemsCost[11]['reactionless_engine,super'] = 200e6;
SystemsCost[11]['reactionless_engine,subwarp'] = 300e6;
SystemsCost[12]['armor,ice'] = 0;
SystemsCost[12]['armor,rock'] = 0;
SystemsCost[12]['armor,steel'] = 20e6;
SystemsCost[12]['armor,light_alloy'] = 50e6;
SystemsCost[12]['armor,metallic_laminate'] = 100e6;
SystemsCost[12]['armor,adv_metallic_laminate'] = 200e6;
SystemsCost[12]['armor,nanocomposite'] = 500e6;
SystemsCost[12]['armor,organic'] = 30e6;
SystemsCost[12]['armor,diamondoid'] = 1e9;
SystemsCost[12]['armor,exotic_laminate'] = 2e9;
SystemsCost[12]['cargo_hold'] = 0;
SystemsCost[12]['cloaking_device'] = 3e9;
SystemsCost[12]['contragravity_lifter'] = 1e9;
SystemsCost[12]['control_room'] = 200e6;
SystemsCost[12]['defensive_ecm'] = 1e9;
SystemsCost[12]['engine_room'] = -1;
SystemsCost[12]['array,enhanced'] = 200e6;
SystemsCost[12]['array,science'] = 1e9;
SystemsCost[12]['array,tactical'] = 1e9;
SystemsCost[12]['array,multipurpose'] = 2e9;
SystemsCost[12]['external_clamp'] = 10e6;
SystemsCost[12]['factory'] = 5e9;
SystemsCost[12]['force_screen,light'] = 1.5e9;
SystemsCost[12]['force_screen,heavy'] = 1.5e9;
SystemsCost[12]['fuel_tank'] = 30e6;
SystemsCost[12]['habitat'] = 100e6;
SystemsCost[12]['hangar_bay'] = 10e6;
SystemsCost[12]['jet_engine'] = 1e9;
SystemsCost[12]['jump_gate'] = 5e9;
SystemsCost[12]['mining'] = 100e6;
SystemsCost[12]['refinery'] = 100e6;
SystemsCost[12]['open_space'] = 2e6;
SystemsCost[12]['passenger_seating'] = 30e6;
SystemsCost[12]['power_plant,chemical'] = 50e6;
SystemsCost[12]['power_plant,fission'] = 300e6;
SystemsCost[12]['power_plant,fusion'] = 1e9;
SystemsCost[12]['power_plant,antimatter'] = 2e9;
SystemsCost[12]['power_plant,super_fusion'] = 3e9;
SystemsCost[12]['power_plant,total_conversion'] = 6e9;
SystemsCost[12]['ramscoop'] = 10e9;
SystemsCost[12]['robot_arm'] = 1e9;
SystemsCost[12]['soft-landing_system'] = 10e6;
SystemsCost[12]['solar_panel_array'] = 500e6;
SystemsCost[12]['space_sails'] = 1e9;
SystemsCost[12]['stardrive'] = 1e9;
SystemsCost[12]['stasis_web'] = 500e6;
SystemsCost[12]['weapons,major_battery'] = 600e6;
SystemsCost[12]['weapons,medium_battery'] = 600e6;
SystemsCost[12]['weapons,secondary_battery'] = 600e6;
SystemsCost[12]['weapons,tertiary_battery'] = 600e6;
//SystemsCost[12]['weapons,spinal_battery'] = 500e6;
SystemsCost[12]['artificial_gravity'] = 100e6;
SystemsCost[12]['gravitic_compensators'] = 100e6;
SystemsCost[12]['reaction_engine,chemical'] = 200e6;
SystemsCost[12]['reaction_engine,electric'] = 300e6;
SystemsCost[12]['reaction_engine,fission'] = 500e6;
SystemsCost[12]['reaction_engine,nuclear_pulse'] = 1e9;
SystemsCost[12]['reaction_engine,fusion'] = 1e9;
SystemsCost[12]['reaction_engine,antimatter'] = 500e6;
//SystemsCost[12]['reaction_engine,total_conv'] = 500e6;
SystemsCost[12]['reactionless_engine,rotary'] = 50e6;
SystemsCost[12]['reactionless_engine,standard'] = 100e6;
SystemsCost[12]['reactionless_engine,hot'] = 300e6;
SystemsCost[12]['reactionless_engine,super'] = 600e6;
SystemsCost[12]['reactionless_engine,subwarp'] = 1e9;
SystemsCost[13]['armor,ice'] = 0;
SystemsCost[13]['armor,rock'] = 0;
SystemsCost[13]['armor,steel'] = 60e6;
SystemsCost[13]['armor,light_alloy'] = 150e6;
SystemsCost[13]['armor,metallic_laminate'] = 300e6;
SystemsCost[13]['armor,adv_metallic_laminate'] = 600e6;
SystemsCost[13]['armor,nanocomposite'] = 1.5e9;
SystemsCost[13]['armor,organic'] = 100e6;
SystemsCost[13]['armor,diamondoid'] = 3e9;
SystemsCost[13]['armor,exotic_laminate'] = 6e9;
SystemsCost[13]['cargo_hold'] = 0;
SystemsCost[13]['cloaking_device'] = 10e9;
SystemsCost[13]['contragravity_lifter'] = 3e9;
SystemsCost[13]['control_room'] = 600e6;
SystemsCost[13]['defensive_ecm'] = 3e9;
SystemsCost[13]['engine_room'] = -1;
SystemsCost[13]['array,enhanced'] = 600e6;
SystemsCost[13]['array,science'] = 3e9;
SystemsCost[13]['array,tactical'] = 3e9;
SystemsCost[13]['array,multipurpose'] = 6e9;
SystemsCost[13]['external_clamp'] = 30e6;
SystemsCost[13]['factory'] = 15e9;
SystemsCost[13]['force_screen,light'] = 5e9;
SystemsCost[13]['force_screen,heavy'] = 5e9;
SystemsCost[13]['fuel_tank'] = 100e6;
SystemsCost[13]['habitat'] = 300e6;
SystemsCost[13]['hangar_bay'] = 30e6;
SystemsCost[13]['jet_engine'] = 3e9;
SystemsCost[13]['jump_gate'] = 50e9;
SystemsCost[13]['mining'] = 300e6;
SystemsCost[13]['refinery'] = 300e6;
SystemsCost[13]['open_space'] = 5e6;
SystemsCost[13]['passenger_seating'] = 100e6;
SystemsCost[13]['power_plant,chemical'] = 1.5e8;
SystemsCost[13]['power_plant,fission'] = 1e9;
SystemsCost[13]['power_plant,fusion'] = 3e9;
SystemsCost[13]['power_plant,antimatter'] = 6e9;
SystemsCost[13]['power_plant,super_fusion'] = 10e9;
SystemsCost[13]['power_plant,total_conversion'] = 20e9;
SystemsCost[13]['ramscoop'] = 30e9;
SystemsCost[13]['robot_arm'] = 3e9;
SystemsCost[13]['soft-landing_system'] = 20e6;
SystemsCost[13]['solar_panel_array'] = 1.5e9;
SystemsCost[13]['space_sails'] = -1;
SystemsCost[13]['stardrive'] = 3e9;
SystemsCost[13]['stasis_web'] = 1e9;
SystemsCost[13]['weapons,major_battery'] = 1.5e9;
SystemsCost[13]['weapons,medium_battery'] = 1.5e9;
SystemsCost[13]['weapons,secondary_battery'] = 1.5e9;
SystemsCost[13]['weapons,tertiary_battery'] = 1.5e9;
//SystemsCost[13]['weapons,spinal_battery'] = 1.666e9;
SystemsCost[13]['artificial_gravity'] = 300e6;
SystemsCost[13]['gravitic_compensators'] = 300e6;
SystemsCost[13]['reaction_engine,chemical'] = 600e6;
SystemsCost[13]['reaction_engine,electric'] = 1e9;
SystemsCost[13]['reaction_engine,fission'] = 1.5e9;
SystemsCost[13]['reaction_engine,nuclear_pulse'] = 3e9;
SystemsCost[13]['reaction_engine,fusion'] = 3e9;
SystemsCost[13]['reaction_engine,antimatter'] = 1.5e9;
//SystemsCost[13]['reaction_engine,total_conv'] = 1.5e9;
SystemsCost[13]['reactionless_engine,rotary'] = 150e6;
SystemsCost[13]['reactionless_engine,standard'] = 300e6;
SystemsCost[13]['reactionless_engine,hot'] = 1e9;
SystemsCost[13]['reactionless_engine,super'] = 2e9;
SystemsCost[13]['reactionless_engine,subwarp'] = 3e9;
SystemsCost[14]['armor,ice'] = 0;
SystemsCost[14]['armor,rock'] = 0;
SystemsCost[14]['armor,steel'] = 200e6;
SystemsCost[14]['armor,light_alloy'] = 500e6;
SystemsCost[14]['armor,metallic_laminate'] = 1e9;
SystemsCost[14]['armor,adv_metallic_laminate'] = 2e9;
SystemsCost[14]['armor,nanocomposite'] = 5e9;
SystemsCost[14]['armor,organic'] = 300e6;
SystemsCost[14]['armor,diamondoid'] = 10e9;
SystemsCost[14]['armor,exotic_laminate'] = 20e9;
SystemsCost[14]['cargo_hold'] = 0;
SystemsCost[14]['cloaking_device'] = 30e9;
SystemsCost[14]['contragravity_lifter'] = 10e9;
SystemsCost[14]['control_room'] = 2e9;
SystemsCost[14]['defensive_ecm'] = 10e9;
SystemsCost[14]['engine_room'] = -1;
SystemsCost[14]['array,enhanced'] = 2e9;
SystemsCost[14]['array,science'] = 10e9;
SystemsCost[14]['array,tactical'] = 10e9;
SystemsCost[14]['array,multipurpose'] = 20e9;
SystemsCost[14]['external_clamp'] = 100e6;
SystemsCost[14]['factory'] = 50e9;
SystemsCost[14]['force_screen,light'] = 15e9;
SystemsCost[14]['force_screen,heavy'] = 15e9;
SystemsCost[14]['fuel_tank'] = 300e6;
SystemsCost[14]['habitat'] = 1e9;
SystemsCost[14]['hangar_bay'] = 100e6;
SystemsCost[14]['jet_engine'] = 10e9;
SystemsCost[14]['jump_gate'] = 150e9;
SystemsCost[14]['mining'] = 1e9;
SystemsCost[14]['refinery'] = 1e9;
SystemsCost[14]['open_space'] = 10e6;
SystemsCost[14]['passenger_seating'] = 300e6;
SystemsCost[14]['power_plant,chemical'] = 5e8;
SystemsCost[14]['power_plant,fission'] = 3e9;
SystemsCost[14]['power_plant,fusion'] = 10e9;
SystemsCost[14]['power_plant,antimatter'] = 20e9;
SystemsCost[14]['power_plant,super_fusion'] = 30e9;
SystemsCost[14]['power_plant,total_conversion'] = 60e9;
SystemsCost[14]['ramscoop'] = 100e9;
SystemsCost[14]['robot_arm'] = 10e9;
SystemsCost[14]['soft-landing_system'] = 50e6;
SystemsCost[14]['solar_panel_array'] = 5e9;
SystemsCost[14]['space_sails'] = -1;
SystemsCost[14]['stardrive'] = 10e9;
SystemsCost[14]['stasis_web'] = 2e9;
SystemsCost[14]['weapons,major_battery'] = 6e9;
SystemsCost[14]['weapons,medium_battery'] = 6e9;
SystemsCost[14]['weapons,secondary_battery'] = 6e9;
SystemsCost[14]['weapons,tertiary_battery'] = 6e9;
//SystemsCost[14]['weapons,spinal_battery'] = 5e9;
SystemsCost[14]['artificial_gravity'] = 1e9;
SystemsCost[14]['gravitic_compensators'] = 1e9;
SystemsCost[14]['reaction_engine,chemical'] = 2e9;
SystemsCost[14]['reaction_engine,electric'] = 3e9;
SystemsCost[14]['reaction_engine,fission'] = 5e9;
SystemsCost[14]['reaction_engine,nuclear_pulse'] = 10e9;
SystemsCost[14]['reaction_engine,fusion'] = 10e9;
SystemsCost[14]['reaction_engine,antimatter'] = 5e9;
//SystemsCost[14]['reaction_engine,total_conv'] = 5e9;
SystemsCost[14]['reactionless_engine,rotary'] = 500e6;
SystemsCost[14]['reactionless_engine,standard'] = 1e9;
SystemsCost[14]['reactionless_engine,hot'] = 3e9;
SystemsCost[14]['reactionless_engine,super'] = 6e9;
SystemsCost[14]['reactionless_engine,subwarp'] = 10e9;
SystemsCost[15]['armor,ice'] = 0;
SystemsCost[15]['armor,rock'] = 0;
SystemsCost[15]['armor,steel'] = 600e6;
SystemsCost[15]['armor,light_alloy'] = 1.5e9;
SystemsCost[15]['armor,metallic_laminate'] = 3e9;
SystemsCost[15]['armor,adv_metallic_laminate'] = 6e9;
SystemsCost[15]['armor,nanocomposite'] = 15e9;
SystemsCost[15]['armor,organic'] = 1e9;
SystemsCost[15]['armor,diamondoid'] = 30e9;
SystemsCost[15]['armor,exotic_laminate'] = 60e9;
SystemsCost[15]['cargo_hold'] = 0;
SystemsCost[15]['cloaking_device'] = 100e9;
SystemsCost[15]['contragravity_lifter'] = 30e9;
SystemsCost[15]['control_room'] = 6e9;
SystemsCost[15]['defensive_ecm'] = 30e9;
SystemsCost[15]['engine_room'] = -1;
SystemsCost[15]['array,enhanced'] = 6e9;
SystemsCost[15]['array,science'] = 30e9;
SystemsCost[15]['array,tactical'] = 30e9;
SystemsCost[15]['array,multipurpose'] = 60e9;
SystemsCost[15]['external_clamp'] = 300e6;
SystemsCost[15]['factory'] = 150e9;
SystemsCost[15]['force_screen,light'] = 50e9;
SystemsCost[15]['force_screen,heavy'] = 50e9;
SystemsCost[15]['fuel_tank'] = 1e9;
SystemsCost[15]['habitat'] = 3e9;
SystemsCost[15]['hangar_bay'] = 300e6;
SystemsCost[15]['jet_engine'] = 30e9;
SystemsCost[15]['jump_gate'] = 500e9;
SystemsCost[15]['mining'] = 3e9;
SystemsCost[15]['refinery'] = 3e9;
SystemsCost[15]['open_space'] = 20e6;
SystemsCost[15]['passenger_seating'] = 1e9;
SystemsCost[15]['power_plant,chemical'] = 15e8;
SystemsCost[15]['power_plant,fission'] = 10e9;
SystemsCost[15]['power_plant,fusion'] = 30e9;
SystemsCost[15]['power_plant,antimatter'] = 60e9;
SystemsCost[15]['power_plant,super_fusion'] = 100e9;
SystemsCost[15]['power_plant,total_conversion'] = 200e9;
SystemsCost[15]['ramscoop'] = 300e9;
SystemsCost[15]['robot_arm'] = 30e9;
SystemsCost[15]['soft-landing_system'] = 100e6;
SystemsCost[15]['solar_panel_array'] = 15e9;
SystemsCost[15]['space_sails'] = -1;
SystemsCost[15]['stardrive'] = 30e9;
SystemsCost[15]['stasis_web'] = 5e9;
SystemsCost[15]['weapons,major_battery'] = 15e9;
SystemsCost[15]['weapons,medium_battery'] = 15e9;
SystemsCost[15]['weapons,secondary_battery'] = 15e9;
SystemsCost[15]['weapons,tertiary_battery'] = 15e9;
//SystemsCost[15]['weapons,spinal_battery'] = 16.666e9;
SystemsCost[15]['artificial_gravity'] = 3e9;
SystemsCost[15]['gravitic_compensators'] = 3e9;
SystemsCost[15]['reaction_engine,chemical'] = 6e9;
SystemsCost[15]['reaction_engine,electric'] = 10e9;
SystemsCost[15]['reaction_engine,fission'] = 15e9;
SystemsCost[15]['reaction_engine,nuclear_pulse'] = 30e9;
SystemsCost[15]['reaction_engine,fusion'] = 30e9;
SystemsCost[15]['reaction_engine,antimatter'] = 15e9;
//SystemsCost[15]['reaction_engine,total_conv'] = 15e9;
SystemsCost[15]['reactionless_engine,rotary'] = 1.5e9;
SystemsCost[15]['reactionless_engine,standard'] = 3e9;
SystemsCost[15]['reactionless_engine,hot'] = 10e9;
SystemsCost[15]['reactionless_engine,super'] = 20e9;
SystemsCost[15]['reactionless_engine,subwarp'] = 30e9;
SystemsCost[5]['weapons,spinal_battery'] = 500e3;
SystemsCost[6]['weapons,spinal_battery'] = 1.5e6;
SystemsCost[7]['weapons,spinal_battery'] = 5e6;
SystemsCost[8]['weapons,spinal_battery'] = 15e6;
SystemsCost[9]['weapons,spinal_battery'] = 50e6;
SystemsCost[10]['weapons,spinal_battery'] = 150e6;
SystemsCost[11]['weapons,spinal_battery'] = 500e6;
SystemsCost[12]['weapons,spinal_battery'] = 1.5e9;
SystemsCost[13]['weapons,spinal_battery'] = 5e9;
SystemsCost[14]['weapons,spinal_battery'] = 15e9;
SystemsCost[15]['weapons,spinal_battery'] = 50e9;

// Begin Design Options Costs
SystemsCost[5]['emergency_ejection'] = 500e3;
SystemsCost[5]['spin_gravity'] = -1;
SystemsCost[5]['stealth_hull'] = 250e3;
SystemsCost[5]['chameleon_hull'] = 180e3;
SystemsCost[5]['winged'] = 150e3;
SystemsCost[6]['emergency_ejection'] = 500e3;
SystemsCost[6]['spin_gravity'] = -1;
SystemsCost[6]['stealth_hull'] = 500e3;
SystemsCost[6]['chameleon_hull'] = 350e3;
SystemsCost[6]['winged'] = 500e3;
SystemsCost[7]['emergency_ejection'] = 500e3;
SystemsCost[7]['spin_gravity'] = -1;
SystemsCost[7]['stealth_hull'] = 1e6;
SystemsCost[7]['chameleon_hull'] = 700e3;
SystemsCost[7]['winged'] = 1.5e6;
SystemsCost[8]['emergency_ejection'] = 500e3;
SystemsCost[8]['spin_gravity'] = 0.1e6;
SystemsCost[8]['stealth_hull'] = 2e6;
SystemsCost[8]['chameleon_hull'] = 1.5e6;
SystemsCost[8]['winged'] = 5e6;
SystemsCost[9]['emergency_ejection'] = -1;
SystemsCost[9]['spin_gravity'] = 0.3e6;
SystemsCost[9]['stealth_hull'] = 5e6;
SystemsCost[9]['chameleon_hull'] = 3e6;
SystemsCost[9]['winged'] = 15e6;
SystemsCost[10]['emergency_ejection'] = -1;
SystemsCost[10]['spin_gravity'] = 1e6;
SystemsCost[10]['stealth_hull'] = 10e6;
SystemsCost[10]['chameleon_hull'] = 7e6;
SystemsCost[10]['winged'] = 50e6;
SystemsCost[11]['emergency_ejection'] = -1;
SystemsCost[11]['spin_gravity'] = 3e6;
SystemsCost[11]['stealth_hull'] = 20e6;
SystemsCost[11]['chameleon_hull'] = 15e6;
SystemsCost[11]['winged'] = 150e6;
SystemsCost[12]['emergency_ejection'] = -1;
SystemsCost[12]['spin_gravity'] = 10e6;
SystemsCost[12]['stealth_hull'] = 50e6;
SystemsCost[12]['chameleon_hull'] = 35e6;
SystemsCost[12]['winged'] = 500e6;
SystemsCost[13]['emergency_ejection'] = -1;
SystemsCost[13]['spin_gravity'] = 30e6;
SystemsCost[13]['stealth_hull'] = 100e6;
SystemsCost[13]['chameleon_hull'] = 70e6;
SystemsCost[13]['winged'] = -1;
SystemsCost[14]['emergency_ejection'] = -1;
SystemsCost[14]['spin_gravity'] = 100e6;
SystemsCost[14]['stealth_hull'] = 200e6;
SystemsCost[14]['chameleon_hull'] = 150e6;
SystemsCost[14]['winged'] = -1;
SystemsCost[15]['emergency_ejection'] = -1;
SystemsCost[15]['spin_gravity'] = 300e6;
SystemsCost[15]['stealth_hull'] = 500e6;
SystemsCost[15]['chameleon_hull'] = 350e6;
SystemsCost[15]['winged'] = -1;
SystemsCost[5]['reaction_engine,fusion_pulse'] = 300e3;
SystemsCost[5]['reaction_engine,advanced_fusion_pulse'] = 600e3;
SystemsCost[5]['reaction_engine,super_fusion_pulse'] = 1.2e6;
SystemsCost[6]['reaction_engine,fusion_pulse'] = 1e6;
SystemsCost[6]['reaction_engine,advanced_fusion_pulse'] = 2e6;
SystemsCost[6]['reaction_engine,super_fusion_pulse'] = 4e6;
SystemsCost[7]['reaction_engine,fusion_pulse'] = 3e6;
SystemsCost[7]['reaction_engine,advanced_fusion_pulse'] = 6e6;
SystemsCost[7]['reaction_engine,super_fusion_pulse'] = 12e6;
SystemsCost[8]['reaction_engine,fusion_pulse'] = 10e6;
SystemsCost[8]['reaction_engine,advanced_fusion_pulse'] = 20e6;
SystemsCost[8]['reaction_engine,super_fusion_pulse'] = 40e6;
SystemsCost[9]['reaction_engine,fusion_pulse'] = 30e6;
SystemsCost[9]['reaction_engine,advanced_fusion_pulse'] = 60e6;
SystemsCost[9]['reaction_engine,super_fusion_pulse'] = 120e6;
SystemsCost[10]['reaction_engine,fusion_pulse'] = 100e6;
SystemsCost[10]['reaction_engine,advanced_fusion_pulse'] = 200e6;
SystemsCost[10]['reaction_engine,super_fusion_pulse'] = 400e6;
SystemsCost[11]['reaction_engine,fusion_pulse'] = 300e6;
SystemsCost[11]['reaction_engine,advanced_fusion_pulse'] = 600e6;
SystemsCost[11]['reaction_engine,super_fusion_pulse'] = 1.2e9;
SystemsCost[12]['reaction_engine,fusion_pulse'] = 1e9;
SystemsCost[12]['reaction_engine,advanced_fusion_pulse'] = 2e9;
SystemsCost[12]['reaction_engine,super_fusion_pulse'] = 4e9;
SystemsCost[13]['reaction_engine,fusion_pulse'] = 3e9;
SystemsCost[13]['reaction_engine,advanced_fusion_pulse'] = 6e9;
SystemsCost[13]['reaction_engine,super_fusion_pulse'] = 12e9;
SystemsCost[14]['reaction_engine,fusion_pulse'] = 10e9;
SystemsCost[14]['reaction_engine,advanced_fusion_pulse'] = 20e9;
SystemsCost[14]['reaction_engine,super_fusion_pulse'] = 40e9;
SystemsCost[15]['reaction_engine,fusion_pulse'] = 30e9;
SystemsCost[15]['reaction_engine,advanced_fusion_pulse'] = 60e9;
SystemsCost[15]['reaction_engine,super_fusion_pulse'] = 120e9;
SystemsCost[5]['reaction_engine,fusion_torch'] = 600e3;
SystemsCost[5]['reaction_engine,super_fusion_torch'] = 1200e3;
SystemsCost[6]['reaction_engine,fusion_torch'] = 2e6;
SystemsCost[6]['reaction_engine,super_fusion_torch'] = 4e6;
SystemsCost[7]['reaction_engine,fusion_torch'] = 6e6;
SystemsCost[7]['reaction_engine,super_fusion_torch'] = 12e6;
SystemsCost[8]['reaction_engine,fusion_torch'] = 20e6;
SystemsCost[8]['reaction_engine,super_fusion_torch'] = 40e6;
SystemsCost[9]['reaction_engine,fusion_torch'] = 60e6;
SystemsCost[9]['reaction_engine,super_fusion_torch'] = 120e6;
SystemsCost[10]['reaction_engine,fusion_torch'] = 200e6;
SystemsCost[10]['reaction_engine,super_fusion_torch'] = 400e6;
SystemsCost[11]['reaction_engine,fusion_torch'] = 600e6;
SystemsCost[11]['reaction_engine,super_fusion_torch'] = 1200e6;
SystemsCost[12]['reaction_engine,fusion_torch'] = 2e9;
SystemsCost[12]['reaction_engine,super_fusion_torch'] = 4e9;
SystemsCost[13]['reaction_engine,fusion_torch'] = 6e9;
SystemsCost[13]['reaction_engine,super_fusion_torch'] = 12e9;
SystemsCost[14]['reaction_engine,fusion_torch'] = 20e9;
SystemsCost[14]['reaction_engine,super_fusion_torch'] = 40e9;
SystemsCost[15]['reaction_engine,fusion_torch'] = 60e9;
SystemsCost[15]['reaction_engine,super_fusion_torch'] = 120e9;
SystemsCost[5]['reaction_engine,antimatter_plasma_torch'] = 300e3;
SystemsCost[5]['reaction_engine,antimatter_pion'] = 300e3;
SystemsCost[5]['reaction_engine,antimatter_pion_torch'] = 600e3;
SystemsCost[5]['reaction_engine,super_antimatter_plasma_torch'] = 600e3;
SystemsCost[5]['reaction_engine,total_conv_torch'] = 600e3;
SystemsCost[5]['reaction_engine,super_conv_torch'] = 150e4;
SystemsCost[6]['reaction_engine,antimatter_plasma_torch'] = 1e6;
SystemsCost[6]['reaction_engine,antimatter_pion'] = 1e6;
SystemsCost[6]['reaction_engine,antimatter_pion_torch'] = 2e6;
SystemsCost[6]['reaction_engine,super_antimatter_plasma_torch'] = 2e6;
SystemsCost[6]['reaction_engine,total_conv_torch'] = 2e6;
SystemsCost[6]['reaction_engine,super_conv_torch'] = 500e4;
SystemsCost[7]['reaction_engine,antimatter_plasma_torch'] = 3e6;
SystemsCost[7]['reaction_engine,antimatter_pion'] = 3e6;
SystemsCost[7]['reaction_engine,antimatter_pion_torch'] = 6e6;
SystemsCost[7]['reaction_engine,super_antimatter_plasma_torch'] = 6e6;
SystemsCost[7]['reaction_engine,total_conv_torch'] = 6e6;
SystemsCost[7]['reaction_engine,super_conv_torch'] = 1.5e7;
SystemsCost[8]['reaction_engine,antimatter_plasma_torch'] = 10e6;
SystemsCost[8]['reaction_engine,antimatter_pion'] = 10e6;
SystemsCost[8]['reaction_engine,antimatter_pion_torch'] = 20e6;
SystemsCost[8]['reaction_engine,super_antimatter_plasma_torch'] = 20e6;
SystemsCost[8]['reaction_engine,total_conv_torch'] = 20e6;
SystemsCost[8]['reaction_engine,super_conv_torch'] = 5e7;
SystemsCost[9]['reaction_engine,antimatter_plasma_torch'] = 30e6;
SystemsCost[9]['reaction_engine,antimatter_pion'] = 30e6;
SystemsCost[9]['reaction_engine,antimatter_pion_torch'] = 60e6;
SystemsCost[9]['reaction_engine,super_antimatter_plasma_torch'] = 60e6;
SystemsCost[9]['reaction_engine,total_conv_torch'] = 60e6;
SystemsCost[9]['reaction_engine,super_conv_torch'] = 15e7;
SystemsCost[10]['reaction_engine,antimatter_plasma_torch'] = 100e6;
SystemsCost[10]['reaction_engine,antimatter_pion'] = 100e6;
SystemsCost[10]['reaction_engine,antimatter_pion_torch'] = 200e6;
SystemsCost[10]['reaction_engine,super_antimatter_plasma_torch'] = 200e6;
SystemsCost[10]['reaction_engine,total_conv_torch'] = 200e6;
SystemsCost[10]['reaction_engine,super_conv_torch'] = 50e7;
SystemsCost[11]['reaction_engine,antimatter_plasma_torch'] = 300e6;
SystemsCost[11]['reaction_engine,antimatter_pion'] = 300e6;
SystemsCost[11]['reaction_engine,antimatter_pion_torch'] = 600e6;
SystemsCost[11]['reaction_engine,super_antimatter_plasma_torch'] = 600e6;
SystemsCost[11]['reaction_engine,total_conv_torch'] = 600e6;
SystemsCost[11]['reaction_engine,super_conv_torch'] = 150e7;
SystemsCost[12]['reaction_engine,antimatter_plasma_torch'] = 1000e6;
SystemsCost[12]['reaction_engine,antimatter_pion'] = 1000e6;
SystemsCost[12]['reaction_engine,antimatter_pion_torch'] = 2000e6;
SystemsCost[12]['reaction_engine,super_antimatter_plasma_torch'] = 2000e6;
SystemsCost[12]['reaction_engine,total_conv_torch'] = 2000e6;
SystemsCost[12]['reaction_engine,super_conv_torch'] = 500e7;
SystemsCost[13]['reaction_engine,antimatter_plasma_torch'] = 3e9;
SystemsCost[13]['reaction_engine,antimatter_pion'] = 3e9;
SystemsCost[13]['reaction_engine,antimatter_pion_torch'] = 6e9;
SystemsCost[13]['reaction_engine,super_antimatter_plasma_torch'] = 6e9;
SystemsCost[13]['reaction_engine,total_conv_torch'] = 6e9;
SystemsCost[13]['reaction_engine,super_conv_torch'] = 1.5e10;
SystemsCost[14]['reaction_engine,antimatter_plasma_torch'] = 10e9;
SystemsCost[14]['reaction_engine,antimatter_pion'] = 10e9;
SystemsCost[14]['reaction_engine,antimatter_pion_torch'] = 20e9;
SystemsCost[14]['reaction_engine,super_antimatter_plasma_torch'] = 20e9;
SystemsCost[14]['reaction_engine,total_conv_torch'] = 20e9;
SystemsCost[14]['reaction_engine,super_conv_torch'] = 5e10;
SystemsCost[15]['reaction_engine,antimatter_plasma_torch'] = 30e9;
SystemsCost[15]['reaction_engine,antimatter_pion'] = 30e9;
SystemsCost[15]['reaction_engine,antimatter_pion_torch'] = 60e9;
SystemsCost[15]['reaction_engine,super_antimatter_plasma_torch'] = 60e9;
SystemsCost[15]['reaction_engine,total_conv_torch'] = 60e9;
SystemsCost[15]['reaction_engine,super_conv_torch'] = 15e10;
SystemsCost[5]['reaction_engine,hedm_rocket'] = 90e3;
SystemsCost[6]['reaction_engine,hedm_rocket'] = 300e3;
SystemsCost[7]['reaction_engine,hedm_rocket'] = 900e3;
SystemsCost[8]['reaction_engine,hedm_rocket'] = 3e6;
SystemsCost[9]['reaction_engine,hedm_rocket'] = 9e6;
SystemsCost[10]['reaction_engine,hedm_rocket'] = 30e6;
SystemsCost[11]['reaction_engine,hedm_rocket'] = 90e6;
SystemsCost[12]['reaction_engine,hedm_rocket'] = 300e6;
SystemsCost[13]['reaction_engine,hedm_rocket'] = 900e6;
SystemsCost[14]['reaction_engine,hedm_rocket'] = 3e9;
SystemsCost[15]['reaction_engine,hedm_rocket'] = 9e9;
SystemsCost[5]['power_plant,mhd_turbine'] = 30e3;
SystemsCost[6]['power_plant,mhd_turbine'] = 100e3;
SystemsCost[7]['power_plant,mhd_turbine'] = 3e5;
SystemsCost[8]['power_plant,mhd_turbine'] = 10e5;
SystemsCost[9]['power_plant,mhd_turbine'] = 30e5;
SystemsCost[10]['power_plant,mhd_turbine'] = 100e5;
SystemsCost[11]['power_plant,mhd_turbine'] = 30e6;
SystemsCost[12]['power_plant,mhd_turbine'] = 100e6;
SystemsCost[13]['power_plant,mhd_turbine'] = 3e8;
SystemsCost[14]['power_plant,mhd_turbine'] = 10e8;
SystemsCost[15]['power_plant,mhd_turbine'] = 30e8;
SystemsCost[5]['factory,fabricator'] = -1;
SystemsCost[5]['factory,robofac'] = -1;
SystemsCost[5]['factory,nanofactory'] = -1;
SystemsCost[5]['factory,replicator'] = -1;
SystemsCost[6]['factory,fabricator'] = 5e6;
SystemsCost[6]['factory,robofac'] = 10e6;
SystemsCost[6]['factory,nanofactory'] = 20e6;
SystemsCost[6]['factory,replicator'] = 10e7;
SystemsCost[7]['factory,fabricator'] = 15e6;
SystemsCost[7]['factory,robofac'] = 30e6;
SystemsCost[7]['factory,nanofactory'] = 60e6;
SystemsCost[7]['factory,replicator'] = 30e7;
SystemsCost[8]['factory,fabricator'] = 50e6;
SystemsCost[8]['factory,robofac'] = 100e6;
SystemsCost[8]['factory,nanofactory'] = 200e6;
SystemsCost[8]['factory,replicator'] = 100e7;
SystemsCost[9]['factory,fabricator'] = 150e6;
SystemsCost[9]['factory,robofac'] = 300e6;
SystemsCost[9]['factory,nanofactory'] = 600e6;
SystemsCost[9]['factory,replicator'] = 300e7;
SystemsCost[10]['factory,fabricator'] = 500e6;
SystemsCost[10]['factory,robofac'] = 1000e6;
SystemsCost[10]['factory,nanofactory'] = 2000e6;
SystemsCost[10]['factory,replicator'] = 1000e7;
SystemsCost[11]['factory,fabricator'] = 1.5e9;
SystemsCost[11]['factory,robofac'] = 30e9;
SystemsCost[11]['factory,nanofactory'] = 60e9;
SystemsCost[11]['factory,replicator'] = 30e10;
SystemsCost[12]['factory,fabricator'] = 5e9;
SystemsCost[12]['factory,robofac'] = 10e9;
SystemsCost[12]['factory,nanofactory'] = 20e9;
SystemsCost[12]['factory,replicator'] = 10e10;
SystemsCost[13]['factory,fabricator'] = 15e9;
SystemsCost[13]['factory,robofac'] = 30e9;
SystemsCost[13]['factory,nanofactory'] = 60e9;
SystemsCost[13]['factory,replicator'] = 30e10;
SystemsCost[14]['factory,fabricator'] = 50e9;
SystemsCost[14]['factory,robofac'] = 100e9;
SystemsCost[14]['factory,nanofactory'] = 200e9;
SystemsCost[14]['factory,replicator'] = 100e10;
SystemsCost[15]['factory,fabricator'] = 150e9;
SystemsCost[15]['factory,robofac'] = 300e9;
SystemsCost[15]['factory,nanofactory'] = 600e9;
SystemsCost[15]['factory,replicator'] = 300e10;
SystemsCost[16]['factory,fabricator'] = 150e9;
SystemsCost[17]['factory,fabricator'] = 500e9;
SystemsCost[18]['factory,fabricator'] = 1500e9;
SystemsCost[19]['factory,fabricator'] = 5000e9;
SystemsCost[20]['factory,fabricator'] = 15e12;
SystemsCost[21]['factory,fabricator'] = 50e12;
SystemsCost[5]['super_stardrive'] = 1500e3;
SystemsCost[6]['super_stardrive'] = 5e6;
SystemsCost[7]['super_stardrive'] = 15e6;
SystemsCost[8]['super_stardrive'] = 50e6;
SystemsCost[9]['super_stardrive'] = 150e6;
SystemsCost[10]['super_stardrive'] = 500e6;
SystemsCost[11]['super_stardrive'] = 1500e6;
SystemsCost[12]['super_stardrive'] = 5e9;
SystemsCost[13]['super_stardrive'] = 15e9;
SystemsCost[14]['super_stardrive'] = 50e9;
SystemsCost[15]['super_stardrive'] = 150e9;
SystemsCost[5]['armor,indestructable'] = 600e4;
SystemsCost[6]['armor,indestructable'] = 2e7;
SystemsCost[7]['armor,indestructable'] = 6e7;
SystemsCost[8]['armor,indestructable'] = 20e7;
SystemsCost[9]['armor,indestructable'] = 60e7;
SystemsCost[10]['armor,indestructable'] = 200e7;
SystemsCost[11]['armor,indestructable'] = 600e7;
SystemsCost[12]['armor,indestructable'] = 2e10;
SystemsCost[13]['armor,indestructable'] = 6e10;
SystemsCost[14]['armor,indestructable'] = 20e10;
SystemsCost[15]['armor,indestructable'] = 60e10;

// Start Habitat Options Cost
var HabitatCost = new Object;
HabitatCost['lab'] = 1e6;
HabitatCost['physics_lab'] = 1e7;
HabitatCost['science_lab'] = 3e7;
HabitatCost['automed'] = 1e5;
HabitatCost['teleporter'] = 20e6;
HabitatCost['teleporter_oneway'] = 10e6;
HabitatCost['minifac'] = SystemsCost[6]['factory,fabricator'] / 10;
HabitatCost['lessControlStations'] = -50e3;
HabitatCost['lessMediumBattery'] = 0;
HabitatCost['lessSecondaryBattery'] = 0;
HabitatCost['lessTertiaryBattery'] = 0;

var ramRocketEngines = new Object;
ramRocketEngines['reaction_engine,fission'] = 1;
ramRocketEngines['reaction_engine,fusion_torch'] = 1;
ramRocketEngines['reaction_engine,super_fusion_torch'] = 1;
ramRocketEngines['reaction_engine,antimatter'] = 1;
ramRocketEngines['reaction_engine,antimatter_plasma_torch'] = 1;
ramRocketEngines['reaction_engine,super_antimatter_plasma_torch'] = 1;
SystemsCost[5]['genuinePeoplePersonality'] = 5e6;
SystemsCost[6]['genuinePeoplePersonality'] = 5e6;
SystemsCost[7]['genuinePeoplePersonality'] = 5e6;
SystemsCost[8]['genuinePeoplePersonality'] = 5e6;
SystemsCost[9]['genuinePeoplePersonality'] = 5e6;
SystemsCost[10]['genuinePeoplePersonality'] = 5e6;
SystemsCost[11]['genuinePeoplePersonality'] = 5e6;
SystemsCost[12]['genuinePeoplePersonality'] = 5e6;
SystemsCost[13]['genuinePeoplePersonality'] = 5e6;
SystemsCost[14]['genuinePeoplePersonality'] = 5e6;
SystemsCost[15]['genuinePeoplePersonality'] = 5e6;
