function roll(num, dice){
	var sum=0;
	var times=0;
	while (times < num){
		sum = sum + ((Math.floor(Math.random()*dice))+1);
		times=times+1;
	}
	return sum;
}

function statsUpdate(){
	document.getElementById("wsTotal").value= 25 + parseInt(document.getElementById("ws2d10").value) + parseInt(document.getElementById("wsHW").value) + parseInt(document.getElementById("wsMisc1").value) + parseInt(document.getElementById("wsMisc2").value);
	document.getElementById("bsTotal").value= 25 + parseInt(document.getElementById("bs2d10").value) + parseInt(document.getElementById("bsHW").value) + parseInt(document.getElementById("bsMisc1").value) + parseInt(document.getElementById("bsMisc2").value);
	document.getElementById("sTotal").value= 25 + parseInt(document.getElementById("s2d10").value) + parseInt(document.getElementById("sHW").value) + parseInt(document.getElementById("sMisc1").value) + parseInt(document.getElementById("sMisc2").value);
	document.getElementById("tTotal").value= 25 + parseInt(document.getElementById("t2d10").value) + parseInt(document.getElementById("tHW").value) + parseInt(document.getElementById("tMisc1").value) + parseInt(document.getElementById("tMisc2").value);
	document.getElementById("agTotal").value= 25 + parseInt(document.getElementById("ag2d10").value) + parseInt(document.getElementById("agHW").value) + parseInt(document.getElementById("agMisc1").value) + parseInt(document.getElementById("agMisc2").value);
	document.getElementById("intTotal").value= 25 + parseInt(document.getElementById("int2d10").value) + parseInt(document.getElementById("intHW").value) + parseInt(document.getElementById("intMisc1").value) + parseInt(document.getElementById("intMisc2").value);
	document.getElementById("perTotal").value= 25 + parseInt(document.getElementById("per2d10").value) + parseInt(document.getElementById("perHW").value) + parseInt(document.getElementById("perMisc1").value) + parseInt(document.getElementById("perMisc2").value);
	document.getElementById("wilTotal").value= 25 + parseInt(document.getElementById("wil2d10").value) + parseInt(document.getElementById("wilHW").value) + parseInt(document.getElementById("wilMisc1").value) + parseInt(document.getElementById("wilMisc2").value);
	document.getElementById("felTotal").value= 25 + parseInt(document.getElementById("fel2d10").value) + parseInt(document.getElementById("felHW").value) + parseInt(document.getElementById("felMisc1").value) + parseInt(document.getElementById("felMisc2").value);
	document.getElementById("wounds2xTB").value = Math.floor((parseInt(document.getElementById("tTotal").value) / 10)) *2;
  setWounds();
}

function setWounds(){
  var woundw = parseInt(document.getElementById("woundsSC").value);
  var woundx = parseInt(document.getElementById("woundsd5").value);
  var woundy = parseInt(document.getElementById("wounds2xTB").value);
  var woundz = parseInt(document.getElementById("woundsHW").value);
  document.getElementById("woundsTotal").value = woundx + woundy + woundz + woundw;
}

function setFate(num){
  var fatedice = roll(1,10);
  document.getElementById("fated10").value = fatedice;
  switch(parseInt(num)){
    case 0:
    break;
    case 1:
      if (fatedice >= 6){
        document.getElementById("fateTotal").value = 3 + parseInt(document.getElementById("fateMisc1").value);
      } else {
        document.getElementById("fateTotal").value = 2 + parseInt(document.getElementById("fateMisc1").value);
      }
      break;
    case 2:
      if (fatedice >= 6){
        document.getElementById("fateTotal").value = 4 + parseInt(document.getElementById("fateMisc1").value);
      } else {
        document.getElementById("fateTotal").value = 3 + parseInt(document.getElementById("fateMisc1").value);
      }
      break;
    case 3:
      if (fatedice == 10){
        document.getElementById("fateTotal").value = 4 + parseInt(document.getElementById("fateMisc1").value);
      } else if (fatedice >=6) {
        document.getElementById("fateTotal").value = 3 + parseInt(document.getElementById("fateMisc1").value);
      } else {
        document.getElementById("fateTotal").value = 2 + parseInt(document.getElementById("fateMisc1").value);
      }
      break;
    case 4:
      if (fatedice >= 9){
        document.getElementById("fateTotal").value = 4 + parseInt(document.getElementById("fateMisc1").value);
      } else if (fatedice >=6) {
        document.getElementById("fateTotal").value = 3 + parseInt(document.getElementById("fateMisc1").value);
      } else {
        document.getElementById("fateTotal").value = 2 + parseInt(document.getElementById("fateMisc1").value);
      }
      break;
    case 5:
      if (fatedice >= 9){
        document.getElementById("fateTotal").value = 4 + parseInt(document.getElementById("fateMisc1").value);
      } else {
        document.getElementById("fateTotal").value = 3 + parseInt(document.getElementById("fateMisc1").value);
      }
      break;
    case 6:
      if (fatedice == 10){
        document.getElementById("fateTotal").value = 4 + parseInt(document.getElementById("fateMisc1").value);
      } else if (fatedice >=4){
        document.getElementById("fateTotal").value = 3 + parseInt(document.getElementById("fateMisc1").value);
      } else {
        document.getElementById("fateTotal").value = 2 + parseInt(document.getElementById("fateMisc1").value);
      }
      break;
  }
}

function sheetInit(){
  document.getElementById("hwselect").value = 0;
  document.getElementById("brselect").value = 0;
  document.getElementById("lureselect").value = 0;
  document.getElementById("trialsselect").value = 0;
  document.getElementById("motiveselect").value = 0;
  document.getElementById("careerselect").value = 0;

  document.getElementById("hwselect").disabled = false;
  document.getElementById("hwrand").disabled = false;
  document.getElementById("brselect").disabled = true;
  document.getElementById("brrand").disabled = true;
  document.getElementById("brrandr").disabled = true;
  document.getElementById("lureselect").disabled = true;
  document.getElementById("lurerand").disabled = true;
  document.getElementById("lurerandr").disabled = true;
  document.getElementById("trialsselect").disabled = true;
  document.getElementById("trialsrand").disabled = true;
  document.getElementById("trialsrandr").disabled = true;
  document.getElementById("motiveselect").disabled = true;
  document.getElementById("motiverand").disabled = true;
  document.getElementById("motiverandr").disabled = true;
  document.getElementById("careerselect").disabled = true;
  document.getElementById("careerrand").disabled = true;
  document.getElementById("careerrandr").disabled = true;

  document.getElementById("hwselection").innerHTML = " ";
  document.getElementById("hwtype").innerHTML = " ";
  document.getElementById("hwcrunch").innerHTML = " ";
  document.getElementById("brselection").innerHTML = " ";
  document.getElementById("brtype").innerHTML = " ";
  document.getElementById("brcrunch").innerHTML = " ";
  document.getElementById("lureselection").innerHTML = " ";
  document.getElementById("luretype").innerHTML = " ";
  document.getElementById("lurecrunch").innerHTML = " ";
  document.getElementById("trialsselection").innerHTML = " ";
  document.getElementById("trialstype").innerHTML = " ";
  document.getElementById("trialscrunch").innerHTML = " ";
  document.getElementById("motiveselection").innerHTML = " ";
  document.getElementById("motivetype").innerHTML = " ";
  document.getElementById("motivecrunch").innerHTML = " ";
  document.getElementById("careerselection").innerHTML = " ";
  document.getElementById("careertype").innerHTML = " ";
  document.getElementById("careercrunch").innerHTML = " ";

  document.getElementById("rerollcheck").value = "0";

	document.getElementById("ws2d10").value=roll(2, 10);
	document.getElementById("bs2d10").value=roll(2, 10);
	document.getElementById("s2d10").value=roll(2, 10);
	document.getElementById("t2d10").value=roll(2, 10);
	document.getElementById("ag2d10").value=roll(2, 10);
	document.getElementById("int2d10").value=roll(2, 10);
	document.getElementById("per2d10").value=roll(2, 10);
	document.getElementById("wil2d10").value=roll(2, 10);
	document.getElementById("fel2d10").value=roll(2, 10);

  document.getElementById("wsHW").value=0;
  document.getElementById("bsHW").value=0;
  document.getElementById("sHW").value=0;
  document.getElementById("tHW").value=0;
  document.getElementById("agHW").value=0;
  document.getElementById("intHW").value=0;
  document.getElementById("perHW").value=0;
  document.getElementById("wilHW").value=0;
  document.getElementById("felHW").value=0;

  document.getElementById("wsMisc1").value=0;
  document.getElementById("bsMisc1").value=0;
  document.getElementById("sMisc1").value=0;
  document.getElementById("tMisc1").value=0;
  document.getElementById("agMisc1").value=0;
  document.getElementById("intMisc1").value=0;
  document.getElementById("perMisc1").value=0;
  document.getElementById("wilMisc1").value=0;
  document.getElementById("felMisc1").value=0;

  document.getElementById("wsMisc2").value=0;
  document.getElementById("bsMisc2").value=0;
  document.getElementById("sMisc2").value=0;
  document.getElementById("tMisc2").value=0;
  document.getElementById("agMisc2").value=0;
  document.getElementById("intMisc2").value=0;
  document.getElementById("perMisc2").value=0;
  document.getElementById("wilMisc2").value=0;
  document.getElementById("felMisc2").value=0;

  document.getElementById("woundsd5").value=roll(1, 5);
  document.getElementById("woundsOther").value=0;
  document.getElementById("woundsSC").value=0;

  document.getElementById("fated10").value=0;
  document.getElementById("fateTotal").value=0;
  document.getElementById("fateMisc1").value=0;

  document.getElementById("insanTotal").value=0;
  document.getElementById("corruptTotal").value=0;

  document.getElementById("hwdiv").style.display = "block";
  document.getElementById("brdiv").style.display = "none";
  document.getElementById("lurediv").style.display = "none";
  document.getElementById("trialsdiv").style.display = "none";
  document.getElementById("motivediv").style.display = "none";
  document.getElementById("careerdiv").style.display = "none";
  document.getElementById("hwfinal").style.display = "none";
  document.getElementById("brfinal").style.display = "none";
  document.getElementById("lurefinal").style.display = "none";
  document.getElementById("trialsfinal").style.display = "none";
  document.getElementById("motivefinal").style.display = "none";
  document.getElementById("careerfinal").style.display = "none";

	statsUpdate();
}

function reroll(stat){
  if (document.getElementById("rerollcheck").value == "0"){
    document.getElementById(stat + "2d10").value=roll(2,10);
  } else {
    alert("You've already re-rolled!");
  }
  statsUpdate();
  document.getElementById("rerollcheck").value = "1";
}

function updateHW(num){
  switch(parseInt(num)){
  case 0:
    break;
  case 1:
    document.getElementById("woundsHW").value = 2;
    document.getElementById("sHW").value = 5;
    document.getElementById("tHW").value = 5;
    document.getElementById("wilHW").value = -5;
    document.getElementById("felHW").value = -5;
    // subtract 5 Fellowship and Willpower
    break;
  case 2:
    document.getElementById("sHW").value = -5;
    document.getElementById("wilHW").value = 5;
    break;
  case 3:
    document.getElementById("wsHW").value = -5;
    document.getElementById("intHW").value = 5;
    document.getElementById("woundsHW").value = 1;
    var chbonus = parseInt(document.getElementById("hwForgeOption").value);
    switch(chbonus){
      case 0:
        break;
      case 1:
        document.getElementById("wsMisc2").value = 3;
        document.getElementById("hwForgeOption").disabled = true;
        break;
      case 2:
        document.getElementById("bsMisc2").value = 3;
        document.getElementById("hwForgeOption").disabled = true;
        break;
      case 3:
        document.getElementById("sMisc2").value = 3;
        document.getElementById("hwForgeOption").disabled = true;
        break;
      case 4:
        document.getElementById("tMisc2").value = 3;
        document.getElementById("hwForgeOption").disabled = true;
        break;
      case 5:
        document.getElementById("agMisc2").value = 3;
        document.getElementById("hwForgeOption").disabled = true;
        break;
      case 6:
        document.getElementById("intMisc2").value = 3;
        document.getElementById("hwForgeOption").disabled = true;
        break;
      case 7:
        document.getElementById("perMisc2").value = 3;
        document.getElementById("hwForgeOption").disabled = true;
        break;
      case 8:
        document.getElementById("wilMisc2").value = 3;
        document.getElementById("hwForgeOption").disabled = true;
        break;
      case 9:
        document.getElementById("felMisc2").value = 3;
        document.getElementById("hwForgeOption").disabled = true;
        break;
    }
    break;
  case 4:
    document.getElementById("tHW").value = -5;
    document.getElementById("felHW").value = 5;
    document.getElementById("woundsHW").value = 1;
    break;
  case 5:
    document.getElementById("wilHW").value = 3;
    break;
  case 6:
    document.getElementById("wilHW").value = -5;
    document.getElementById("felHW").value = 5;
    break;
  }
  statsUpdate();
  setFate(num);
}

function updateBR(num){
}

function updateLure(num){
}

function updateTrials(num){
}

function updateMotive(num){
  switch(parseInt(num)){
    case 0:
      break;
    case 25:
      document.getElementById("woundsOther").value = 1;
      break;
    case 26:
      document.getElementById("fateMisc1").value = 1;
      var oldFate = parseInt(document.getElementById("fateTotal").value);
      document.getElementById("fateTotal").value = oldFate + 1;
      break;
    case 27:
      break;
    case 28:
      break;
    case 29:
      break;
    case 30:
      break;
  }
  statsUpdate();
}

function updateCareer(num){
  switch(parseInt(num)){
    case 31:
      break;
    case 32:
      break;
    case 33:
      break;
    case 34:
      break;
    case 35:
      break;
    case 36:
      break;
    case 37:
      break;
    case 38:
      break;
  }
}

function updateOrigin(sect){
  document.getElementById(sect+"div").style.display = "none";
  document.getElementById(sect+"final").style.display = "block";
  var number = document.getElementById(sect+"select").value;
  document.getElementById(sect+"type").innerHTML = "<b>"+originName[number]+"</b> ";
  document.getElementById(sect+"crunch").innerHTML = originData[number];

  switch(sect){
    case "hw":
      nextTier = "br";
      updateHW(number);
      break;
    case "br":
      nextTier = "lure";
      updateBR(number);
      break;
    case "lure":
      nextTier = "trials";
      updateLure(number);
      break;
    case "trials":
      nextTier = "motive";
      updateTrials(number);
      break;
    case "motive":
      nextTier = "career";
      updateMotive(number);
      break;
    case "career":
      updateCareer(number);
      break;
  }

  if (sect != "career" && sect != "hw"){
    document.getElementById(sect+"select").disabled = true;
    document.getElementById(sect+"rand").disabled = true;
    document.getElementById(sect+"randr").disabled = true;
    document.getElementById(nextTier+"select").disabled = false;
    document.getElementById(nextTier+"rand").disabled = false;
    document.getElementById(nextTier+"randr").disabled = false;
    document.getElementById(nextTier+"div").style.display = "block";
  }
  if (sect == "career"){
    document.getElementById(sect+"select").disabled = true;
    document.getElementById(sect+"rand").disabled = true;
    document.getElementById(sect+"randr").disabled = true;
  }
  if (sect == "hw"){
    document.getElementById(sect+"select").disabled = true;
    document.getElementById(sect+"rand").disabled = true;
    document.getElementById(nextTier+"select").disabled = false;
    document.getElementById(nextTier+"rand").disabled = false;
    document.getElementById(nextTier+"randr").disabled = false;
    document.getElementById(nextTier+"div").style.display = "block";
  }
  var xxx;
  xxx = parseInt(document.getElementById(sect+"select").value) % 6;
  if (nextTier == "career"){
    if (xxx == 0) {
      document.getElementById(nextTier+"select").options[6].style.background = "#00ff00";
      document.getElementById(nextTier+"select").options[7].style.background = "#00ff00";
      document.getElementById(nextTier+"select").options[8].style.background = "#00ff00";
    } else {
      document.getElementById(nextTier+"select").options[xxx].style.background = "#00ff00";
      document.getElementById(nextTier+"select").options[xxx+1].style.background = "#00ff00";
      document.getElementById(nextTier+"select").options[xxx+2].style.background = "#00ff00";
    }
  } else {
    if (xxx == 1) {
      document.getElementById(nextTier+"select").options[1].style.background = "#00ff00";
      document.getElementById(nextTier+"select").options[2].style.background = "#00ff00";
    } else if (xxx == 0) {
      document.getElementById(nextTier+"select").options[5].style.background = "#00ff00";
      document.getElementById(nextTier+"select").options[6].style.background = "#00ff00";
    } else {
      document.getElementById(nextTier+"select").options[xxx-1].style.background = "#00ff00";
      document.getElementById(nextTier+"select").options[xxx].style.background = "#00ff00";
      document.getElementById(nextTier+"select").options[xxx+1].style.background = "#00ff00";
    }
  }
}

function randUpdate(sect){
  switch(sect){
    case "hw":
      tier = 1;
      break;
    case "br":
      tier = 2;
      break;
    case "lure":
      tier = 3;
      break;
    case "trials":
      tier = 4;
      break;
    case "motive":
      tier = 5;
      break;
    case "career":
      tier = 6;
      break;
  }
  var randnum;
  if (tier < 6){
    randnum = roll(1, 6) + (6 * (tier - 1));
  } else{
    randnum = roll(1, 8) + (6 * (tier - 1));
  }
  document.getElementById(sect+"select").value = randnum;
  document.getElementById(sect+"selection").innerHTML = "Random: ";
  updateOrigin(sect);
}

function randRigidUpdate(sect){
  switch(sect){
    case "hw":
      tier = 1;
      break;
    case "br":
      tier = 2;
      var lastSelect = "hw";
      break;
    case "lure":
      tier = 3;
      var lastSelect = "br";
      break;
    case "trials":
      tier = 4;
      var lastSelect = "lure";
      break;
    case "motive":
      tier = 5;
      var lastSelect = "trials";
      break;
    case "career":
      tier = 6;
      var lastSelect = "motive";
      break;
  }
  var randnum;
  if (tier == 6){
    randnum = roll(1, 3) + 5 + (parseInt(document.getElementById(lastSelect+"select").value));
  } else {
    if (parseInt(document.getElementById(lastSelect+"select").value) - ((tier -2)*6) == 1) {
      randnum = roll(1, 2) + 5 + parseInt(document.getElementById(lastSelect+"select").value);
    } else if (parseInt(document.getElementById(lastSelect+"select").value) - ((tier -2)*6) == 6) {
      randnum = roll(1, 2) + 4 + parseInt(document.getElementById(lastSelect+"select").value);
    } else {
      randnum = roll(1, 3) + 4 + parseInt(document.getElementById(lastSelect+"select").value);
    }
  }
  document.getElementById(sect+"select").value = randnum;
  document.getElementById(sect+"selection").innerHTML = "Random-Rigid: ";
  updateOrigin(sect);
}

function selectUpdate(sect){
    document.getElementById(sect+"selection").innerHTML = "Selected: ";
    updateOrigin(sect);
}

// this here is the origin path definition array.  it is MASSIVE.
var originName = new Array();
originName[0] = "";
originName[1] = "Death World";
originName[2] = "Void Born";
originName[3] = "Forge World";
originName[4] = "Hive World";
originName[5] = "Imperial World";
originName[6] = "Noble Born";
originName[7] = "Scavenger";
originName[8] = "Scapegrace";
originName[9] = "Stubjack";
originName[10] = "Child of the Creed";
originName[11] = "Savant";
originName[12] = "Vaunted";
originName[13] = "Tainted";
originName[14] = "Criminal";
originName[15] = "Renegade";
originName[16] = "Duty Bound";
originName[17] = "Zealot";
originName[18] = "Chosen by Destiny";
originName[19] = "The Hand of War";
originName[20] = "Press-Ganged";
originName[21] = "Calamity";
originName[22] = "Ship-Lorn";
originName[23] = "Dark Voyage";
originName[24] = "High Vendetta";
originName[25] = "Endurance";
originName[26] = "Fortune";
originName[27] = "Vengeance";
originName[28] = "Renown";
originName[29] = "Pride";
originName[30] = "Prestige";
originName[31] = "Astropath Ascendant";
originName[32] = "Arch-Militant";
originName[33] = "Void Master";
originName[34] = "Explorator";
originName[35] = "Missionary";
originName[36] = "Seneschal";
originName[37] = "Navigator";
originName[38] = "Rogue Trader";

var originData = new Array();
originData[0] = "";
originData[1] = "<b>Characteristics:</b> S +5, T +5, Wil -5, Fel -5;<br /><b>Wounds:</b> +2; <b>Fate Points</b>: 2 (1-5), 3 (6-10);<br /><b>Skills:</b> Survival; <b>Traits:</b> Survivor, Paranoid;<br /><b>Talents:</b> Melee Weapon Training (Primitive), <select id=\"deathHWTalent\"><option value=\"Jaded\">Jaded</option><option value=\"Resistance (Poisons)\">Resistance (Poisons)</option></select>";
originData[2] = "<b>Characteristics:</b> S -5, Wil +5; <b>Fate Points:</b> 3 (1-5), 4 (6-10);<br /><b>Skills:</b> Speak Language (Ship Dialect);<br /><b>Untrained Basic Skills:</b> Navigation (Stellar) and Pilot (Spacecraft);<br /><b>Traits:</b> Charmed, Ill-Omened, Void Accustomed";
originData[3] = "<b>Characteristics:</b> WS -5, Int +5, <select id=\"hwForgeOption\" onChange=\"updateHW(3)\"><option>(choose one)</option><option value=\"1\">WS +3</option><option value=\"2\">BS +3</option><option value=\"3\">S +3</option><option value=\"4\">T +3</option><option value=\"5\">Ag +3</option><option value=\"6\">Int +3</option><option value=\"7\">Per +3</option><option value=\"8\">Wil +3</option><option value=\"9\">Fel +3</option></select>; <b>Wounds:</b> +1; <br /><b>Fate Points:</b> 2 (1-5), 3 (6-9), 4 (10); <br /><b>Untrained Basic Skills:</b> Common Lore (Machine Cult), Common Lore (Tech);<br /><b>Talents:</b> Technical Knock; <b>Traits:</b> Stranger to the Cult";
originData[4] = "<b>Characteristics:</b> T -5, Fel +5; <b>Wounds:</b> +1;<br /><b>Fate Points:</b> 2 (1-5), 3 (6-8), 4 (9-10);<br /> <b>Traits:</b> Accustomed to Crowds, Hivebound, Wary;<br /><b>Skills:</b> Speak language (Hive Dialect); <b>Untrained Basic Skills:</b> Tech Use;";
originData[5] = "<b>Characteristics:</b> Wil +3; <b>Fate Points:</b> 3 (1-8), 4 (9-10);<br /> <b>Untrained Basic Skills:</b> Common Lore (Imperial Creed), Common Lore (Imperium), Common Lore (War), Literacy, Speak Language (High Gothic);<br /><b>Trait:</b> Blessed Ignorance";
originData[6] = "<b>Characteristics:</b> Wil -5, Fel +5; <b>Fate Points:</b> 2 (1-3), 3 (4-9), 4 (10);<br /><b>Talents:</b> Peer (Nobility), <select><option>Peer (Academics)</option><option>Peer (Adeptus Mechanicus)</option><option>Peer (Administratum)</option><option>Peer (Astropaths)</option><option>Peer (Ecclesiarchy)</option><option>Peer (Government)</option><option>Peer (Military)</option><option>Peer (Mercantile)</option><option>Peer (Underworld)</option></select>;<br /><b>Traits:</b> Vendetta, Legacy of Wealth, Etiquette;<br /><b>Untrained Basic Skills:</b> Speak Language (High Gothic), Speak Language (Low Gothic), Literacy";
originData[7] = "+Characteristic: <select><option>Wil +3</option><option>Ag +3</option></select><br />+Talent: <select><option>Unremarkable</option><option>Resistance (Fear)</option></select><br />+Trauma: <select><option>1d5 Corruption</option><option>1d5 Insanity</option></select>";
originData[8] = "+Characteristic: <select><option>Int +3</option><option>Per +3</option></select><br />+Skill: Slight of Hand (Basic)<br />+Trauma: <select><option>1d5 Corruption</option><option>1d5 Insanity</option></select>";
originData[9] = "+Characteristic: <select><option>WS +5</option><option>BS +5</option></select>, Fel -5<br />+Talent: Quick Draw; +Skill: Intimidate<br />+Trauma: 1d5 Insanity";
originData[10] = "+Characteristic: <select><option>Wil +3</option><option>Fel +3</option></select>, WS -3<br />+Talent: Unshakeable Faith";
originData[11] = "+Characteristic: <select><option>Int +3</option><option>Fel +3</option></select>, T -3<br />choose: <select><option>+Skill: Logic</option><option>+Talent: Peer (Academic)</option></select>";
originData[12] = "+Characteristic: <select><option>Ag +3</option><option>Fel +3</option></select>, Per -3<br />+Talent: Decadence; +Trauma: 1d5 Corruption";
originData[13] = "<select><option>Random Mutation (table 14-3)</option><option>Select Mutation (table 14-3, no higher than 75) for 200xp</option><option>2d10 Insanity, +Talent: Peer (the insane), T +3, and Fel -3</option><option>2d10 Insanity, +Talent: Peer (the insane), T +3, and Fate Point -1</option><option>Wil +3, +Talent: Enemy (Ecclesiarchy)</option></select>";
originData[14] = "gain Enemy (Adeptus Arbites) and Peer (Underworld) OR Per+3 and Enemy (Underworld) OR Fel-5 and one poor-craftsmanship bionic limb or implant (can become common for 200xp or good for 300xp)";
originData[15] = "<select><option>+Skill: Concealment; +Talent: Enemy (Adeptus Arbites), Resistance (Interrogation)</option><option>Int +3, Wil -3; +Talent: Enemy (Ecclesiarchy)</option><option>Per +3, Wil -3; +Talent: Enemy (Ecclesiarchy)</option><option>+Trauma: 1d5+1 Corruption; +Talent: Dark Soul; +Skill: Forbiden Lore (choose)(basic) or insanity points</option><option>+Trauma: 1d5+1 Insanity; +Talent: Dark Soul; +Skill: Forbiden Lore (choose)(basic)</option>";
originData[16] = "Wil+3 and (if you have at least 40 Wil) the Armour of Contempt talent, -10 on tests to interact with sources from beyond the Imperium; OR Int+3 or Per+3, -1 groups starting profit factor; OR +1 groups profit factor, gain Rival (Rogue Trader family) talent";
originData[17] = "+10 on Intimidate tests and -10 on Charm tests<br />You have one poor-quality bionic (upgrade to Common for 200xp or Good for 300xp); OR Wil+5, Fel-5 or 1d10 Insanity; OR Fel+5, T-5, gain thePeer (Ecclesiarchy) talent";
originData[18] = "gain the Foresight talent, Wil-3, Enemy  (academics or ecclesiarchy); OR +10 on Fellowships tests when interacting with xenos, Wil-5 on willpower tests involving alien artefacts; OR FP+1 and 1d10+1 Insanity";
originData[19] = "+Talent: <select><option>Leap Up</option><option>Weapon Training (choose any one)</option></seelct><br />+Talent: Hatred ( <select><option>Orks</option><option>Eldar</option><option>Chaos Worshippers</option><option>Mutants</option><option>The Imperial Guard</option><option>The Imperial Navy</option><option>Void Pirates</option></select><br />You avoid dealing with those you hate at all costs.  If you must, Fel -10 on all interactions with them. You lash out violently against them at the slightest provocation (Willpower test to negate).";
originData[20] = "+Skill: Choose one (must meet all prereqs), Common Lore (choose).<br />The thought of inprisonment is horrifying.  When threatened or faced with imprisonment, take a Willpower test.  If you fail, you lash out violently.";
originData[21] = "+Talent: Light Sleeper, <select><option>Hardy</option><option>Nerves of Steel</option></select><br />Reduce your group's starting profit factor by 1";
originData[22] = "-1 Fate Point. <select><option>+Skill: Survival</option><option>+Talent: Dark Soul</option></select><br />You may re-roll the dice when you spend a Fate Point to recover wounds, but you must accept the new result.<br />Fel -5 when interacting with other void born or rogue traders that are not personal friends, if they know of your past.";
originData[23] = "choose: <select><option>+Skill: Forbidden Lore (choose)</option><option>+Talent: Resistance (Fear)</option></select>+Trauma: 1d5 Insanity";
originData[24] = "+Skill: Inquiry; +Talent: <select><option>Die Hard</option><option>Paranoia</option></select>";
originData[25] = "+1 Wound";
originData[26] = "+1 Fate Point";
originData[27] = "+Talent: Hatred: ( <input value=\"choose one\"/> )";
originData[28] = "<select><option>Air of Authority</option><option>Peer (choose)</option></select>";
originData[29] = "<select><option>Random Heirloom Item</option><option>T +3</option></select>";
originData[30] = "<select><option>Talented (choose)</option><option>Peer (choose)</option></select>";
originData[31] = "Special Abilities: Soul-Bound to the Emperor, Psychic Powers, See Without Eyes<br />+Skill: Awareness, Common Lore (Adeptus Astra Telepathica), Forbidden Lore (Psykers), Invocation, Psyniscience, Scholastic Lore (Cryptology), Speak Language (High Gothic, Low Gothic)<br />+Talent: Heightened Senses (Sound), Pistol Weapon Training (Universal), Psy Rating 2<br />+Gear: best-craftsmanship laspistol or best-craftsmanship stub automatic, best-craftsmaship mono-sword or common-craftsmanship shock staff, Guard Flak armor, void suit, charm, microbead, psy-focus";
originData[32] = "Special Ability: Weapon Master<br />+Skill: Common Lore (War), Dodge, Intimidate, Scholastic Lore (Tactica Imperialis), Secret Tongue (Military), Speak language (Low Gothic)<br />+Talent: Basic Weapon Training (Universal), Pistol Weapon Training (Universal), Melee Weapon Training (Universal), Thrown Weapon Training (Universal), Sound Constitution<br />+Gear: one good-craftsmanship hellgun OR one best-craftsmanship hunting rifle OR two bolt pistols, one best-craftsmanship mono primitive melee weapon, microbead, void suit, enforcer light carapoace armour, bolt shell keepsake, medikit, manacles, data-slate full of wanted bounties OR amrs coffer OR 3 doses of stimm";
originData[33] = "Special Ability: Mastery of (choose one: Space, Gunnery, Augers, Small Craft)<br />+Skill: Common Lore (Imperial Navy, War), Forbidden Lore (Xenos), Navigation (Stellar), Pilot (Spacecraft, Flyers), Scholastic Lore (Astromancy), Speak language (Low Gothic)<br />+Talent: Pistol Weapon Training (Universal), Melee Weapon Training (Universal), Nerves of Steel<br />+Gear: best-craftsmanship mono-sword or common-craftsmanship power sword, best-craftsmanship hand cannon or common-craftsmanship bolt pistol, guard flak armour, void suit, microbead, blessed ship token, rebreather, imperial navy uniform or beggar's cloak, 2 bottles of amasec, pict-recorder, vox-caster";
originData[34] = "Special Ability: Explorator Implants; +Trait: Mechanicus Implants<br />+Skill: Common Lore (Machine Cult, Tech), Forbidden Lore (Archeotech, Adeptus Mechanicus), Literacy, Logic, Speak Language (Explorator Binary, Low Gothic, Techna-lingua), Tech-Use, Trade (Technomat)<br />+Talent: Basic Weapon Training (Universal), Melee Weapon Training (Universal), Logis Implant<br />+Gear: boltgun or best-craftsmanship lasgun or good-craftsmanship hellgun, best-craftsmanship shock staff or good-craftsmanship power axe, enforcer light carapace, multikey, microbead, void suit, injector, sacred unguents, combi-tool, dataslate, one servo-skull familiar";
originData[35] = "Special Ability: Pure Faith;<br />+Skill: Common Lore (Imperial Creed, Imperium), Forbidden Lore (Heresy), Medicae, Scholastic Lore (Imperial Creed), Speak Language (High Gothic, Low Gothic)<br />+Talent: Basic Weapon Training (Universal), melee weapon training (universal), Pure Faith, Unshakeable Faith<br />+Gear: good-craftsmanship chainsword or best-craftsmanship staff, good-craftsmanship flamer or best-craftsmanship lasgun, best-craftsmanship guard flak armour, ecclesiarchical robes, aquila pendant, sephulcre, censer and incense, microbead";
originData[36] = "Special Ability: Seeker of Lore<br />+Skill: Barter, Commerce, Common Lore (Underworld), Deceive, Evaluate, Forbidden Lore (Archeotech), Inquiry, Literacy, Speak Language (Low Gothic, Trader's Cant)<br />+Talent: Basic Weapon Training (Universal), Pistol Weapon Training (Universal)<br />+Gear: best-craftsmanship hellpistol or common-craftsmanship inferno pistol, best-craftsmanship hellgun or common-craftsmanship boltgun, xeno-mesh armour, autoquil, dataslate, microbead, multikey, two sets of robes, synskin, chrono, cameleoline cloak";
originData[37] = "Special Abilities: Warp Eye, The Boons of Lineage, Navigator Mutations<br />+Skill: Common Lore (Navis Nobilite), Foridden Lore (Navigators, Warp), Literacy, Navigation (Stellar, Warp), Scholastic Lore (Astromancy), Speak language (High Gothic, Low Gothic)<br />+Talent: Navigator, Pistol Weapon Training (Universal)<br />+Gear: best-craftsmanship hellpistol or good-craftsmnaship hand cannon, best-craftsmanship metal staff, best-craftsmanship xeno-mesh armour, Emperor's tarot deck, silk headscarph, charm, microbead, Nobilite robes";
originData[38] = "Special Ability: Exceptional Leader<br />+Skill: Command, Commerce, Charm, Common Lore (Imperium) Evaluate, Literacy, Scholastic Lore (Astromancy), Speak Language (High Gothic, Low Gothic)<br />+Talent: Air of Authority, Pistol Weapon Training (Universal), Melee Weapon Training (Universal)<br />+Gear: best-craftsmanship laspistol or good-craftsmanship hand cannon or common-craftsmanship plasma pistol, best-craftsmanship mono sword or common-craftsmanship power sword, microbead, void suit, set of fine clothing, xeno-pelt cloak, best-craftsmanship enforcer light carapace or storm trooper carapace";

var mutations = new Array();
mutations[0] = "1-5: Grotesque (-20 on Fel tests with 'normals', +10 on Intimidate tests)";
mutations[1] = "6-10: Tough Hide (gain trait: Natural Armour 2)";
mutations[2] = "11-15: Misshapen (may no longer Run, -2d10 Agility";
mutations[3] = "16-20: Feels No Pain (+5 Wounds, gain trait: Iron Jaw)";
mutations[4] = "21-25: Brute (S+10 and T+10)";
mutations[5] = "26-30: Nightsider (gain trait: Dark Sight, -10 on all tests when in bright light unless eyes and flesh shielded)";
mutations[6] = "31-35: Mental Regressive (roll 1d10 for Int, Per, Wil and Fel seperately. 1-5: -1d10, 6-7: halve, 8-9: no change, 10: reduce to 5)";
mutations[7] = "36-40: Malformed Hands (Hands are digit-less slabs of flesh. -10 WS, -10 BS, -20 on all tests involving fine physical manipulation)";
mutations[8] = "41-45: Tox Blood (+20 on toughness tests to resist poison, T and Int -1d10 each, creatures exposed to your blood must make a -10 toughness test or take 1d10 poison damage that ignores armour and toughness)";
mutations[9] = "46-50: Hulking (gain trait: Hulking Size, wounds +5, Strength +10";
mutations[10] = "51-55: Wyrdling (Psy Rating 2 (or next highest if already at 2), gain two psychic techniques of your choice from one disciple of your choice)";
mutations[11] = "56-59: Vile Deformity (Lovecraftian defects.  gain trait: Fear 1)";
mutations[12] = "60-63: Abberation (Animal/man hybrid.  S+10, Ag+10, Int-1d10, Fel-10)";
mutations[13] = "64-67: Degenerate Mind (Fel-1d10, Int-1d10, roll 1d10: gain Frenzy talent on 1-3, Fearless talent on 4-7, From Beyond trait on 8-10)";
mutations[14] = "68-71: Ravaged Body (Gain 1d5 mutations at random from this table.  Sucks to be you.)";
mutations[15] = "72-74: Clawed/Fanged (gain trait: Natural Weapon (either R or I)";
mutations[16] = "75-78: Necrophage (gain trait: Regeneration, T+10, must eat 'copious amounts of raw meat or starve')";
mutations[17] = "79-81: Corrupted Flesh (gain Fear 2 when dealt critical damage)";
mutations[18] = "82-85: Venomous (gain trait: Toxic)";
mutations[19] = "86-89: Hideous Strength (gain trait: Unnatural Strength)";
mutations[20] = "90-91: Multiple Appendages (You have extra arms/tentacles/prehensile tail(s); gain talent: Ambidextrous and Two Weapon Wielder; +10 on grapple and climb checks.)";
mutations[21] = "92-93: Worm (+5 wounds, gain trait: Crawler)";
mutations[22] = "94: Nightmarish (gain trait: Fear 3)";
mutations[23] = "95: Malleable (Ag+10, +20 on Climb and Grapple checks, may squeeze through openings 1/4th of the normal allowable size)";
mutations[24] = "96: Winged (gain trait: Flyer (rate: ABx2))";
mutations[25] = "97: Corpulent (Can no longer run.  +5 Wounds.  gain trait: Unnatural Toughness)";
mutations[26] = "98: Shadow Kin (gain trait: phase, S-10, T-10)";
mutations[27] = "99: Corrosive Bile (gain full-action attack: BS test, can be dodged, unparryable, 1d10+2R (or E) Tearing damage)";
mutations[28] = "100: Hellspawn (gain traits: Daemonic, Fear 2, From Beyond)";

//  document.getElementById("").value
