
function makearray(n) {
	this.length = n;
	for(var i = 1; i <= n; i++)
		this[i] = 0;
	return this;
}

function CalcMod(form)
    {
		form.srsmod.value= (5-form.rngspd.options.selectedIndex)+(form.size.options.selectedIndex-5)
    }

CriticalHit = new makearray(10);

CriticalHit[1] = "If the blow hit the torso, it does normal damage and the foe is knocked unconscious.  Roll vs. HT every 30 minutes to recover. Otherwise, triple normal damage.";
CriticalHit[2] = "The blow bypasses ALL armor and does normal damage.";
CriticalHit[3] = "The blow does triple normal damage.";
CriticalHit[4] = "The blow does double normal damage.";
CriticalHit[5] = "Normal damage only - and the foe is stunned until he makes his HT roll.";
CriticalHit[6] = "If the blow hit an arm, leg, hand or foot, it does normal damage, and that body part is crippled regardless of the damage done.  However, this is only a 'Funny Bone' injury, and will wear off in six turns.  ";
CriticalHit[7] = "(Of course, if enough damage was done to cripple the limb anyway, it does not wear off!)  Otherwise, the blow does normal damage.";
CriticalHit[8] = "Normal damage only.";
CriticalHit[9] = "If the blow hit an arm, leg, hand or foot, it does normal damage, and that body part is crippled regardless of the amount of damage done.  Otherwise, double normal damage.";
CriticalHit[10] = "Enemy's weapon is dropped, and he takes normal damage.";

function CriticalHitFunction(form)
    {

    Temp1 = 0;
    roll = 0;
    for (ndx = 0; ndx < 3; ndx++) {
		Temp1 = Math.ceil(Math.random() * 6);
		roll += Temp1;
    	}

    if (roll == 3 || roll == 18)
		form.Stats.value = roll+": "+CriticalHit[1];
    else if (roll == 4 || roll == 13)
		form.Stats.value = roll+": "+CriticalHit[2];
    else if (roll == 5 || roll == 17)
		form.Stats.value = roll+": "+CriticalHit[3];
    else if (roll == 6 || roll == 16)
		form.Stats.value = roll+": "+CriticalHit[4];
    else if (roll == 7)
		form.Stats.value = roll+": "+CriticalHit[5];
    else if (roll == 8 || roll == 12)
		form.Stats.value = roll+": "+CriticalHit[6]+CriticalHit[7];
    else if (roll >= 9 && roll <= 11)
		form.Stats.value = roll+": "+CriticalHit[8];
    else if (roll == 14)
		form.Stats.value = roll+": "+CriticalHit[9];
    else if (roll == 15)
		form.Stats.value = roll+": "+CriticalHit[10];
    }


CriticalMiss = new makearray(13);

CriticalMiss[1]="Your weapon breaks and is useless.  Exception:  Certain weapons are resistant to breakage.  These include maces, flails, mauls, metal bars, and other solid 'crushing' weapons; magic weapons; and finely-made weapons.  ";
CriticalMiss[2]="If you have a weapon like that, roll again.  Only if you get a 'broken weapon' result a second time does the weapon really break.  If you get any other result, you drop the weapon instead.";
CriticalMiss[3]="You managed to hit yourself in the arm or leg (50% chance each way).  Execption: If this was an imaling or ranged attact, roll again.  It's hard to  stab yourself, but it can be done.  ";
CriticalMiss[4]="If you get a 'hit-yourself' result a second time, count that result - half or full damage as the case may be.  If you get something other than 'hit-yourself, count that result.";
CriticalMiss[5]="You managed to hit yourself in the arm or leg (50% chance each way) for half damage.  Execption: If this was an imaling or ranged attact, roll again.  It's hard to  stab yourself, but it can be done.  ";
CriticalMiss[6]="If you get a 'hit-yourself' result a second time, count that result - half or full damage as the case may be.  If you get something other than 'hit-yourself, count that result.";
CriticalMiss[7]="You lost your balance.  You can do nothing else until your next turn.  All your active defenses are at -2 until your next turn.";
CriticalMiss[8]="The weapon turns in your hand.  Spend one extra turn to ready it before you use it again.";
CriticalMiss[9]="You drop the weapon.  Exception: A cheap weapon breaks."
CriticalMiss[10]="Your weapon flies 1d yards from your hand - 50% chance straight forward or straight back.  Anyone on the target spot must make their DX roll or take half damage from the falling weapon!  Exception: If this was an impaling attack, ";
CriticalMiss[11]="you simply drop the weapon, as in #9.  A missile weapon will not fly from your hand - it just drops.";
CriticalMiss[12]="You strained your shoulder!  Your weapon arm is 'crippled' for the rest of the encounter.  You do not have to drop your weapon, but you cannot use it, either to attack or defend, for 30 minutes.";
CriticalMiss[13]="You fall down.  (Ranged weapon users, see #7 instead).";


function CriticalMissFunction (form)
    {

    Temp1 = 0;
    roll = 0;
    for (ndx = 0; ndx < 3; ndx++) {
		Temp1 = Math.ceil(Math.random() * 6);
		roll += Temp1;
    }

    if (roll <= 4 || roll >= 17)
		form.Stats.value = roll+": "+CriticalMiss[1]+CriticalMiss[2];
    else if (roll == 5)
		form.Stats.value = roll+": "+CriticalMiss[3]+CriticalMiss[4];
    else if (roll == 6)
		form.Stats.value = roll+": "+CriticalMiss[5]+CriticalMiss[6];
    else if (roll == 7 || roll == 13)
		form.Stats.value = roll+": "+CriticalMiss[7];
    else if (roll == 8 || roll == 12)
		form.Stats.value = roll+": "+CriticalMiss[8];
    else if (roll >= 9 && roll <= 11)
		form.Stats.value = roll+": "+CriticalMiss[9];
    else if (roll == 14)
		form.Stats.value = roll+": "+CriticalMiss[10]+CriticalMiss[11]+"\r\n9: "+CriticalMiss[9];
    else if (roll == 15)
		form.Stats.value = roll+": "+CriticalMiss[12]+"\r\n7: "+CriticalMiss[7];
    else if (roll == 16)
		form.Stats.value = roll+": "+CriticalMiss[13];
    }

CriticalHead = new makearray(11);

CriticalHead[1]="Foe is killed instantly.";
CriticalHead[2]="Foe is knocked unconscious.  Roll vs. HT every 30 minutes to recover.";
CriticalHead[3]="Foe is hit across both eyes and blinded.   Use 'crippling' rules to determine whether eys can heal (roll seperately for each).  Foe is stunned an fights at -10 DX for the rest of the battle.";
CriticalHead[4]="Foe is blinded in one eye.  Use 'crippling' rules to determine if it heals.  Foe is stunned; will fight at -2 DX for the rest of the battle.";
CriticalHead[5]="Foe is knocked off balance; he may defend normally next turn but may do nothing else.  The blow also does normal head-blow damage.";
CriticalHead[6]="Normal head blow damage only.";
CriticalHead[7]="If the attack was a crushing blow, it does normal head-blow damage and the foe will be deaf for 24 hours.  If was a cutting or impaling blow, it does only 1 hit damage, but the foe's face is scarred.";
CriticalHead[8]="If the attack was a crushing blow, it does normal head-blow damage and foe may be permanently deafened (use 'crippling' rules to see if he recovers).  If it was a cutting or impaling blow, it does only 2 hits damage but the foe's ";
CriticalHead[9]="face is badly scarred.";
CriticalHead[10]="Normal head-blow damage.  Foe flinches and drops his weapon (if foe has two weapons, roll randomly to see which is dropped).";
CriticalHead[11]="Normal head-blow damage, and foe is stunned.";

function CriticalHeadFunction (form)
    {

    Temp1 = 0;
    roll = 0;
    for (ndx = 0; ndx < 3; ndx++) {
		Temp1 = Math.ceil(Math.random() * 6)
		roll += Temp1
		}

    if (roll == 3)
		form.Stats.value = roll+": "+CriticalHead[1];
    else if (roll == 4 || roll == 5)
		form.Stats.value = roll+": "+CriticalHead[2];
    else if (roll == 6)
		form.Stats.value = roll+": "+CriticalHead[3];
    else if (roll == 7)
		form.Stats.value = roll+": "+CriticalHead[4];
    else if (roll == 8)
		form.Stats.value = roll+": "+CriticalHead[5];
    else if (roll >= 9 && roll <= 11)
		form.Stats.value = roll+": "+CriticalHead[6];
    else if (roll == 12)
		form.Stats.value = roll+": "+CriticalHead[7];
    else if (roll == 13)
		form.Stats.value = roll+": "+CriticalHead[8]+CriticalHead[9];
    else if (roll == 14)
		form.Stats.value = roll+": "+CriticalHead[10];
    else if (roll >= 15)
		form.Stats.value = roll+": "+CriticalHead[11];
    }

value1 = 10024145;

FirearmCritical = new makearray(11);

FirearmCritical[1]="The firearm breaks.  It can be repaired (with the proper tools) in 1d hours with a successful Armoury roll.  If the attack is with a grenade, it simply fails to go off.";
FirearmCritical[2]="You managed to shoot yourself in the leg (50% chance right or left), doing normal damage.";
FirearmCritical[3]="You managed to shoot yourself in the foot (50% chance right or left), doing normal damage.";
FirearmCritical[4]="The weapon recoil knocks you off balance.  You can do nothing until next turn, and all active defenses are at -2 until then.  if the attack is with a grenade or recoilless weapon, ignore this result.";
FirearmCritical[5]="A dud.  This shot simply doesn't go off (and the ammunition is wasted), but the weapon is not harmed.";
FirearmCritical[6]="The weapon jams.  It will require a successful skill roll (Guns-4 or Armoury) to unjam it.  If the weapon is cheap, the skill is at a -3 penalty.  If the attack is with a grenade, ignore this result and reroll.";
FirearmCritical[7]="You drop the weapon.  A cheap weapon breaks (to fix it, see #3 and #4).  Otherwise, you must pick it up and ready it again.  If the attack is with a grenade, place the activated grenade in an adjacent hex.";
FirearmCritical[8]="The weapon recoil knocks you down.  You are on the ground, sitting or lying (your choice).  Make a DX roll to hold onto the weapon!  If your ST is at least 5 more than the minimum ST for the weapon (or 12 ";
FirearmCritical[9]="and higher, in the case of weapons with no minimum ST rating), ignore this result, and use #7, instead.  But if the weapon is recoilless, nothing happens.";
FirearmCritical[10]="The weapon explodes.  You take the damage amount of the weapon in crushing damage, plus: If the Aim manuver was taken before the shot was made, you are also blinded for five minutes.  If the weapon was a grenade ";
FirearmCritical[11]="it goes off in your hand, doing maximum damage to that hand plus normal damage.  If the weapon was a laser, blaster or flamethrower, you are also on fire.";

function FirearmCriticalFunction (form)
    {

    Temp1 = 0;
    roll = 0;
    for (ndx = 0; ndx < 3; ndx++) {
		Temp1 = Math.ceil(Math.random() * 6);
		roll += Temp1;
		}

    if (roll == 3 || roll == 4)
		form.Stats.value = roll+": "+FirearmCritical[1];
    else if (roll == 5)
		form.Stats.value = roll+": "+FirearmCritical[2];
    else if (roll == 6)
		form.Stats.value = roll+": "+FirearmCritical[3];
    else if (roll == 7)
		form.Stats.value = roll+": "+FirearmCritical[4];
    else if (roll == 8 || roll == 12)
		form.Stats.value = roll+": "+FirearmCritical[5];
    else if (roll >= 9 && roll <= 11)
		form.Stats.value = roll+": "+FirearmCritical[6];
    else if (roll == 13 || roll == 14)
		form.Stats.value = roll+": "+FirearmCritical[7];
    else if (roll == 15)
		form.Stats.value = roll+": "+FirearmCritical[8]+FirearmCritical[9];
    else if (roll == 16 || roll == 17)
		form.Stats.value = roll+": "+FirearmCritical[9];
    else if (roll == 18)
		form.Stats.value = roll+": "+FirearmCritical[10]+FirearmCritical[11];
    }

CriticalTL8 = new makearray(10);

CriticalTL8[1]="The weapon breaks, or a critical circuit shorts out.  It can be repaired (with the proper tools) in 1d-1 hours, by a successful Armoury or Electronics skill roll.";
CriticalTL8[2]="If the attack is with a grenade or explosive device, it simply fails to go off.";
CriticalTL8[3]="The firing mechanism or circuitry has failed. An Armourer can repair it; each attempt requires 3d minutes.";
CriticalTL8[4]="The feeding mechanism or circuitry has failed.  Solid-projectile weapons can be used for single shots (reload time 5 seconds).  Others will not fire again until repaired (Armourer roll; each attempt requires 1d-1 hours, minimum 1).";
CriticalTL8[5]="A dud round, magazine or power cell.  Roll randomlly if more than one might apply.  It must be replaced, but the weapon is unharmed.";
CriticalTL8[6]="The weapon jams or shorts out completely; grenades or explosives fail to detonate.  It will require a successful skill roll (Weapon skill -4, Armoury or Electronics) to unjam or reconnect the circuit or correctly reset a ";
CriticalTL8[7]="grenade's fuse.  If the weaponis cheap, the skill is at a -3 penalty.  Time required will be 2d seconds.";
CriticalTL8[8]="You accidentally shoot yourself in the foot (or drop a live grenade) while attempting to fix the problem.  Roll to see which foot you hit.";
CriticalTL8[9]="The weapon explodes.  You take the damage amount of the weapon in crushing damage (1d for a laser pistol, for example, or 3d for a force sword), with the following additions; if you had been aiming, you are also blinded for 5 ";
CriticalTL8[10]="minutes unless wearing anti-glare goggles).  If the weapon was a grenade, it goes off in your hand, doing normal damage.";

function CriticalTL8Function (form)
    {

    Temp1 = 0;
    roll = 0;
    for (ndx = 0; ndx < 3; ndx++) {
		Temp1 = Math.ceil(Math.random() * 6);
		roll += Temp1;
		}

    if (roll == 3 || roll == 4)
		form.Stats.value = roll+": "+CriticalTL8[1]+CriticalTL8[2];
    else if (roll == 5 || roll == 6 || roll == 13 || roll == 14)
		form.Stats.value = roll+": "+CriticalTL8[3];
    else if (roll == 7 || roll == 15)
		form.Stats.value = roll+": "+CriticalTL8[4];
    else if (roll == 8 || roll == 12)
		form.Stats.value = roll+": "+CriticalTL8[5];
    else if (roll >= 9 && roll <= 11)
		form.Stats.value = roll+": "+CriticalTL8[6]+CriticalTL8[7];
    else if (roll == 16 || roll == 17)
		form.Stats.value = roll+": "+CriticalTL8[8];
    else if (roll == 18)
		form.Stats.value = roll+": "+CriticalTL8[9]+CriticalTL8[10];
    }

CriticalEquip = new makearray(16);

CriticalEquip[1]="Your equipment shorts out catastophically; a vital part breaks; your chemicals interact cataclysmically.  Roll 2d for the number of hours/days/weeks (as GM rules appropriate) it takes to repair damage, get replacement parts, or ";
CriticalEquip[2]="remix the proper chemicals to compensate for the set-back.";
CriticalEquip[3]="You set off an explosion, doing 2d of damage to yourself and anyone in an adjacent hex.";
CriticalEquip[4]="You set off an explosion, doing 1d of damage to yourself and anyone in an adjacent hex.";
CriticalEquip[5]="You botch the experiment or repair badly, but can repair your mistake with the loss of only 1 day or 1 hour of time (as appropriate); your next roll is at -3 to skill.";
CriticalEquip[6]="You almost make a serious error, but catch it in time.  No time is lost, but your confidence is shaken.  You have a -3 on your next roll for success (if that was the final roll, roll again at a -3).";
CriticalEquip[7]="You lose 1/2 day or 1/2 hour of time (as appropriate), and have a -3 to your next attempt.";
CriticalEquip[8]="You think you may have used the wrong procedure, but you're not quite sure because your notes (of the repair manual) has been misplaced, gotten out of order, etc.  Roll IQ-3 to know for sure (GM determines truth).  If you miss ";
CriticalEquip[9]="the IQ roll or you did goof, either start from scratch or attempt to complete the work wil a -5 to your skill roll (your choice).";
CriticalEquip[10]="A serious error.  Biochemical experiments produce a toxic chemical cloud; electrica repairs administer a sizeable shock; and mechanical repairs end in a heavy component failing on you.  Roll HT-5 or go to HT 0.  If you ";
CriticalEquip[11]="make your roll, you still take 1d of damage and pass out for 20-HT minutes.";
CriticalEquip[12]="A serious error.  Biochemical experiments produce a toxic chemical cloud; electrica repairs administer a sizeable shock; and mechanical repairs end in a heavy component failing on you.  Roll HT-5 or go to HT 0.   ";
CriticalEquip[13]="If you make your roll, you still take 2d of damage and pass out for 20-HT minutes.  If working with electricity, you take a point of damage every five seconds until someone shuts the power off.  You can do nothing during ";
CriticalEquip[14]="this time except use psionic abilities (at -6) if you have them.";
CriticalEquip[15]="A major explosion.  Biochemical experiments produce a toxic chemical cloud; electrica repairs administer a sizeable shock; and mechanical repairs end in a heavy component failing on you.  Roll HT-5 or go to HT 0.  If you ";
CriticalEquip[16]="make your roll, you still take 4d of damage and pass out for 20-HT minutes.  Anyone withing 10 yds. takes 2d damage.  Better hope someone stays conscious and gets you to an automedic or freeze tube quickly!";

function CriticalEquipFunction (form)
    {

    Temp1 = 0;
    roll = 0;
    for (ndx = 0; ndx < 3; ndx++) {
		Temp1 = Math.ceil(Math.random() * 6);
		roll += Temp1;
		}

    if (roll == 3 || roll == 4)
		form.Stats.value = roll+": "+CriticalEquip[1]+CriticalEquip[2];
    else if (roll == 5)
		form.Stats.value = roll+": "+CriticalEquip[3];
    else if (roll == 6)
		form.Stats.value = roll+": "+CriticalEquip[4];
    else if (roll == 7 || roll == 8)
		form.Stats.value = roll+": "+CriticalEquip[5];
    else if (roll >= 9 && roll <= 11)
		form.Stats.value = roll+": "+CriticalEquip[6];
    else if (roll == 12 || roll == 13)
		form.Stats.value = roll+": "+CriticalEquip[7];
    else if (roll == 14)
		form.Stats.value = roll+": "+CriticalEquip[8]+CriticalEquip[9];
    else if (roll == 15)
		form.Stats.value = roll+": "+CriticalEquip[10]+CriticalEquip[11];
    else if (roll == 16 || roll == 17)
		form.Stats.value = roll+": "+CriticalEquip[12]+CriticalEquip[13]+CriticalEquip[14];
    else
		form.Stats.value = roll+": "+CriticalEquip[15]+CriticalEquip[16];
    }

AdvancedTech = new makearray(20);

AdvancedTech[1]="Roll 3d for each use (each hour of use for continually-operating devices).  On a result of 6 or less, an agent of the Interstellar T'Vorging Commission teleports in and tells the operator to cease generating k'fith particles at ";
AdvancedTech[2]="once!  If the PC doesn't comply, the agent will frown at the gadget and it will disappear, immediately followed by the agent.";
AdvancedTech[3]="If the gadget is normally hand-held, it is so large and heavy as to need a cart or vehicle to move it around; if normally a vehicle borne device; it needs a really big vehicle, like a battleship, or must be mounted in a building; ";
AdvancedTech[4]="if normally the size of small building, the device takes up a city block.";
AdvancedTech[5]="Each use of the gadget (or hour of constant use) consumes $250 worth of exotic chemicals, rare herbs or the like.";
AdvancedTech[6]="The device has 1d+1 side-effects (see table)";
AdvancedTech[7]="The PC carrying the gadget is so inconvenience by its awkard shape and balance that all his DX rolls are made at -2 penalty.";
AdvancedTech[8]="The gadget has 1d-2 (minimum 1) side-effects";
AdvancedTech[9]="If normally powered by batteries or power cells, the device requires a large power supply, like building power or a vehicle power plant; if normally requiring power in the megawatt range, it needs to be tied into a continental ";
AdvancedTech[10]="power grid and causes brownouts whenever used.  (Magical devices use three times normal fatigue).";
AdvancedTech[11]="The gadget is twice as large, twice as heavy and uses twice a much pwer as it should.  (Magical items use 50% more fatigue than normal).  If it is a weapon, damage, range and Acc bonus are halved, and SS increases by 4.";
AdvancedTech[12]="The gadget gets too hot to handle after one or two uses, and must cool down for ten minutes before it can be used again.  (If used before it cools off, it burns out in a shower of sparks and inflicts 1d burn damage on the user.";
AdvancedTech[13]="Each use of the gadget (or hour of constant use) consumes $25 worth of exotic chemicals, rare herbs or the like.";
AdvancedTech[14]="The gadget in unreliable, and fails on a skill roll of 14 or higher.";
AdvancedTech[15]="The device requires repairs after every use; it will not work until repaired.  (Magical itesm require a Repair spell after every use.)";
AdvancedTech[16]="The device has a recoil like a heavy projecile weapon (even if it isn't a gun).  The user must make DX roll for every use to avoid being knocked down.";
AdvancedTech[17]="The gadget is very unreliable, and ails on a skill roll of 10 or higher.";
AdvancedTech[18]="The device is very complicated to operate.  If a weapon, it takes five seconds to ready.  (this represents pushing buttons, setting dials, chanting, etc.)  Non-weapon gadgets require two hours of painstaking preparation before ";
AdvancedTech[19]="On any critical failure using the device, it self-destructs in some appropriately spectacular fashion.  The user must make a DX roll at -2, or take 2d damage as the gadget vaporizes itself.  The entire gadget is gone, and cannot ";
AdvancedTech[20]="be repaired or even broken down for useable parts.";

function AdvancedTechFunction (form)
    {

    Temp1 = 0;
    roll = 0;
    for (ndx = 0; ndx < 3; ndx++) {
		Temp1 = Math.ceil(Math.random() * 6);
		roll += Temp1;
		}

    if (roll == 3)
		form.Stats.value = roll+": "+AdvancedTech[1]+AdvancedTech[2];
    else if (roll == 4)
		form.Stats.value = roll+": "+AdvancedTech[3]+AdvancedTech[4];
    else if (roll == 5)
		form.Stats.value = roll+": "+AdvancedTech[5];
    else if (roll == 6)
		form.Stats.value = roll+": "+AdvancedTech[6];
    else if (roll == 7)
		form.Stats.value = roll+": "+AdvancedTech[7];
    else if (roll == 8)
		form.Stats.value = roll+": "+AdvancedTech[8];
    else if (roll == 9)
		form.Stats.value = roll+": "+AdvancedTech[9]+AdvancedTech[10];
    else if (roll == 10 )
		form.Stats.value = roll+": "+AdvancedTech[11];
    else if (roll == 11)
		form.Stats.value = roll+": "+AdvancedTech[12];
    else if (roll == 12)
		form.Stats.value = roll+": "+AdvancedTech[13];
    else if (roll == 13)
		form.Stats.value = roll+": "+AdvancedTech[14];
    else if (roll == 14)
		form.Stats.value = roll+": "+AdvancedTech[15];
    else if (roll == 15)
		form.Stats.value = roll+": "+AdvancedTech[16];
    else if (roll == 16)
		form.Stats.value = roll+": "+AdvancedTech[17];
    else if (roll == 17)
		form.Stats.value = roll+": "+AdvancedTech[18]+"each use.";
    else if (roll == 18)
		form.Stats.value = roll+": "+AdvancedTech[19]+AdvancedTech[20];
    }

WeirdTech = new makearray(18);

WeirdTech[1]="Each use causes a small, cumulative change in the user's body or mind.  Roll vs. HT+4 (IQ+4) for each use, or acquire -1 point toward a physical (or mental) disadvantage of the GM's choice.";
WeirdTech[2]="Every use of the device inflicts 1d damage on the user (bypassing DR).";
WeirdTech[3]="Each use causes 1 point of damage to the operator (bypassing DR).";
WeirdTech[4]="The gadget mutates one person (choose randomly) within 10 yards into an animal (GM's choice) for 10 turns.";
WeirdTech[5]="The device makes an incredibly annoying, high-pitched screech when used.  This gives everyone within 20 yards a headache for ten minutes (-1 to all rolls).  The user gets a migraine (-3 to all rolls for 20 minutes).  Earplugs don't ";
WeirdTech[6]="help, although Deafness does.";
WeirdTech[7]="Use of the gadget disrupts electronics of a lower TL: TVs and radios within one mile get nothing but static, computers within 100 yards crash on a roll of 7 or less on 3d; within 10 yards, even flashlights and other simple devices ";
WeirdTech[8]="are affected.  This effect is popular with scanning devices on UFO's.  (Magical items produce local mana disruptions that cause a -3 penalty to all spellcasting within 10 yards for the next ten turns.)";
WeirdTech[9]="The device produces noxious fumes in a 4-hex radius.  These do no damage, but are extremeely unpeasant to breathe.  Characters must make HT+3 rolls each turn they breathe in the area, or suffer mild nausea for five minutes (-1 to all ";
WeirdTech[10]="The gadget produces a loud hum in operation (+3 to Hearing rolls to notice it.)";
WeirdTech[11]="Use of the device is accompanied by impressive, but harmless, special effects - beams of colored light, showers of sparks, et cetera.  The source of the effect will be obvious to any watcher, and anyone in the area gets a +5 to ";
WeirdTech[12]="The gadget emits dense clouds of steam or smoke while in operation.  Treat as a Fog spell of radius 4 (see p. B159 or M40).";
WeirdTech[13]="Every use of the gadget attracts swarms of vermin of the GM's choice.  The swarms disperse ten minutes after the device is shut off.";
WeirdTech[14]="Using the gadget renders the operator unconscious for 1d minutes.";
WeirdTech[15]="Each use of the device attracts the attention of nearby demons or punches holes into random dimensions through which strange creatures appear.";
WeirdTech[16]="The device inflicts one point of damage (bypassing DR) per use, on everyone within 10 yards, including the user.";
WeirdTech[17]="Every use of the gadget opens a gate into a random dimension for 1 turn; the user must roll vs. DX to avoid falling into the hole before it closes.";
WeirdTech[18]="Each time the device is used, roll for a different random side-effect.  (If this results comes up, roll for two side-effects.";

function WeirdTechFunction (form)
    {

    Temp1 = 0;
    roll = 0;
    for (ndx = 0; ndx < 3; ndx++) {
		Temp1 = Math.ceil(Math.random() * 6);
		roll += Temp1;
		}

    if (roll == 3)
		form.Stats.value = roll+": "+WeirdTech[1];
    else if (roll == 4)
		form.Stats.value = roll+": "+WeirdTech[2];
    else if (roll == 5)
		form.Stats.value = roll+": "+WeirdTech[3];
    else if (roll == 6)
		form.Stats.value = roll+": "+WeirdTech[4];
    else if (roll == 7)
		form.Stats.value = roll+": "+WeirdTech[5]+WeirdTech[6];
    else if (roll == 8)
		form.Stats.value = roll+": "+WeirdTech[7]+WeirdTech[8];
    else if (roll == 9)
		form.Stats.value = roll+": "+WeirdTech[9]+"rolls.)";
    else if (roll == 10 )
		form.Stats.value = roll+": "+WeirdTech[10];
    else if (roll == 11)
		form.Stats.value = roll+": "+WeirdTech[11]+" Vision to notice something is going on.";
    else if (roll == 12)
		form.Stats.value = roll+": "+WeirdTech[12];
    else if (roll == 13)
		form.Stats.value = roll+": "+WeirdTech[13];
    else if (roll == 14)
		form.Stats.value = roll+": "+WeirdTech[14];
    else if (roll == 15)
		form.Stats.value = roll+": "+WeirdTech[15];
    else if (roll == 16)
		form.Stats.value = roll+": "+WeirdTech[16];
    else if (roll == 17)
		form.Stats.value = roll+": "+WeirdTech[17];
    else if (roll == 18)
		form.Stats.value = roll+": "+WeirdTech[18];
    }


function Criticals (form) {

    ndx = form.Critical.options.selectedIndex+1;

    if (ndx == 1)
		CriticalHitFunction (form);
    else if (ndx == 2)
		CriticalMissFunction (form);
    else if (ndx == 3)
		CriticalHeadFunction (form);
    else if (ndx == 4)
		FirearmCriticalFunction (form);
    else if (ndx == 5)
		CriticalTL8Function (form);
    else if (ndx == 6)
		CriticalEquipFunction (form);
    else if (ndx == 7)
		AdvancedTechFunction (form);
    else if (ndx == 8)
		WeirdTechFunction (form);
    }

MeleeWeapon = new makearray(45);

MeleeWeapon[1]="Hatchet: type cut, damage sw, reach 1, cost $40, weight 2 lbs., min ST 7, notes: Throwable. 1 turn to ready.";
MeleeWeapon[2]="Axe: type cut, damage sw+2, reach 1, cost $50, weight 4 lbs., min ST 12, notes: 1 turn to ready.";
MeleeWeapon[3]="Throwing axe: type cut, damage sw+2, reach 1, cost $60, weight 4 lbs., min ST 12, notes: Throwable, 1 turn to ready.";
MeleeWeapon[4]="Small mace: type cr, damage sw+2, reach 1, cost $35, weight 3 lbs., min ST 11, notes: 1 turn to ready.";
MeleeWeapon[5]="Mace: type cr, damage sw+3, reach 1, cost $50, weight 5 lbs., min ST 12, notes: 1 turn to ready.";
MeleeWeapon[6]="Pick: type imp, damage sw+ 1, reach 1, cost $70, weight 3 lbs., min ST 11, notes: 1 turn to ready. May get stuck.";
MeleeWeapon[7]="Blackjack or sap: type cr, damage thr, reach c, cost $20, weight 1 lb., min ST 7, notes: May not parry.";
MeleeWeapon[8]="Broadsword: cost $500, weight 3 lbs., min ST 10\r\ntype cut, damage sw+1, reach 1\r\ntype cr, damage thr+ 1, reach 1, notes: Standard broadsword has blunt point.";
MeleeWeapon[9]="Thrusting: cost $600, weight 3 lbs., min ST 10, \r\ntype cut, damage sw+1, reach 1, notes: More expensive because of sharp point.\r\ntype imp, damage thr+2, reach 1";
MeleeWeapon[10]="Bastard sword: cost $650, Weight 5 lbs., min ST 11\r\ntype cut, damage sw+1, reach 1,2, notes: 1 turn to ready after swinging.\r\ntype cr, damage thr+ 1, reach 2, notes: Standard bastard sword has blunt point.";
MeleeWeapon[11]="Thrusting: cost $750, Weight 5 lbs., min ST 11\r\ntype Same as above, with thrusting point, damage cut, reach sw+1, notes: 1, 2\r\ntype imp, damage thr+2, reach 2";
MeleeWeapon[12]="Light club: type cr, damage sw+l, reach 1, cost $10, weight 3 lbs., min ST 10";
MeleeWeapon[13]="Smallsword, type imp, damage thr+1, reach 1, cost $400, weight 1 lb., min ST -, notes: Maximum damage 1d+1.";
MeleeWeapon[14]="Rapier, type imp, damage thr+ 1, reach 1, 2, cost $500, weight 1.5 lbs., min ST -, notes: Maximum damage 1d+1.";
MeleeWeapon[15]="Saber: cost $700, Weight 2 lbs., min ST 7\r\ntype Thrust: maximum damage 1d+2., damage cut, reach sw, notes: 1\r\ntype imp, damage thr+ 1, reach 1";
MeleeWeapon[16]="Morningstar, type cr, damage sw+3, reach 1, cost $80, weight 6 lbs., min ST 12, notes: 1 turn to ready.";
MeleeWeapon[17]="Flail, type cr, damage sw+4, reach 1, 2*, cost $100, weight 8 lbs., min ST 1 3, notes: 2-handed. 1 turn to ready.";
MeleeWeapon[18]="Large Knife: cost $40, wt. 1 lb.\rtype cut, dam sw-2, reach C,1, notes: max. damage 1d+2\rtype imp, dam thr, reach C, notes: throwable, max. damage 1d+2";
MeleeWeapon[19]="Small Knife: cost $30, wt. 1/2 lb.\rtype cut, dam sw-3, reach C,1, notes: max. damage 1d+1\rtype imp, dam thr-1, reach C, notes: throwable, max. damage 1d+1";
MeleeWeapon[20]="Dagger: cost $20, wt. 1/4 lb.\rtype imp, dam thr-1, reach C, notes: throwable, max. damage 1d";
MeleeWeapon[21]="Lance, type imp, damage thrust+3, reach 4, cost $60, weight 6 lbs., min ST 12, notes: May not parry. See p. 136";
MeleeWeapon[22]="Glaive: cost $100, weight 8 lbs, min ST 11\r\n type cut, damage sw+3, reach 2,3*, notes: 2 turns to ready.\r\n type imp, damage thr+3, reach 1-3*, notes: 1 turn to ready after thrust.";
MeleeWeapon[23]="Poleaxe: type cut or cr, damage sw+4, reach 2, 3*, cost $120, weight 10 lbs., min ST 12, notes: 2 turns to ready after swing.";
MeleeWeapon[24]="Halberd: cost $150, Weight 12 lbs., min ST 13\r\ntype cut, damage sw+5, reach 2,3*, note: 2 turns to ready.\r\ntype imp, damage sw+4, reach 2,3*, note: 2 turns to ready.\r\ntype imp, damage thr+3, reach 1-3*, note: 1 turn to ready.";
MeleeWeapon[25]="Shortsword: cost $400, Weight 2 lbs, min ST 7\r\ntype cut, damage sw, reach 1, notes: Sabers can be used w/Shortsword skill.\r\ntype imp, damage thr, reach 1";
MeleeWeapon[26]="Baton: cost $20, Weight 1 lb., min ST 7\r\ntype cr, damage sw, reach 1, notes: A short, well-balanced club.\r\ntype cr, damage thr, reach 1.";
MeleeWeapon[27]="Javelin: type imp, damage thr+1, reach 1, cost $30, weight 2 lbs., min ST -, notes: Primarily for throwing.";
MeleeWeapon[28]="Spear: cost $40, Weight 4 lbs., min ST 9\r\ntype imp, damage thr+2, reach 1*, notes: Used 1-handed. Throwable.\r\ntype imp, damage thr+3, reach 1, 2*, notes: Same spear used 2-handed";
MeleeWeapon[29]="Quarterstaff: cost $10, Weight 4 lbs., min ST 6\r\ntype cr, damage sw+2, reach 1,2, notes: Parry is 2/3 Staff skill.\r\ntype cr, damage thr+2, reach 1, 2";
MeleeWeapon[30]="Great axe, type cut, damage sw+3, reach 1, 2*, cost $100, weight 8 lbs., min ST 13, notes: 1 turn to ready.";
MeleeWeapon[31]="Warhammer, type imp, damage sw+3, reach 1, 2*, cost $100, weight 7 lbs., min ST 13, notes: 1 turn to ready. May get stuck.";
MeleeWeapon[32]="Maul, type cr, damage sw+4, reach 1, 2*, cost $80, weight 12 lbs., min ST 14, notes: 1 turn to ready.";
MeleeWeapon[33]="Scythe: cost $15, Weight 5 lbs, min ST 12\r\ntype cut, damage sw+2, reach 1, notes: 2-handed. I turn to ready\r\ntype imp, damage sw, reach 16, notes: -2 to hit when impaling.";
MeleeWeapon[34]="Bastard Sword: cost $650, Weight 5 lbs., min ST 10\r\ntype cut, damage sw+2, reach 1,2, notes: Exactly as with Broadsword, but used two-handed.\r\ntype cr, damage thr+2, reach 2";
MeleeWeapon[35]="Thrusting: cost $750, Weight 5 lbs., min ST 10\r\ntype cut, damage sw+2, reach 1, 2, notes: As above, with thrusting point.\r\ntype imp, damage thr+3, reach 2";
MeleeWeapon[36]="Greatsword: cost $800, Weight 7 lbs., min ST 12\r\ntype cut, damage sw+3, reach 1, 2, notes: Usually has blunt point.\r\ntype cr, damage thr+2, reach 2";
MeleeWeapon[37]="Thrusting: cost $900, Weight 7 lbs., min ST 12\r\ntype cut, damage sw+3, reach 1, 2, notes: As above, with thnisting point.\r\ntype imp, damage thr+3, reach 2";
MeleeWeapon[38]="Quarterstaff: cost $10, Weight 4 lbs., min ST 9\r\ntype cr, damage sw+2, reach 1, 2, notes: Using sword technique with staff.\r\ntype cr, damage thr+ 1, reach 2";
MeleeWeapon[39]="Whip, type cr, damage sw-2, reach 1-7, cost $20/yd, weight 2 lbs.lyd., min ST 10, notes: Max. dam. 1d-1, see p. 52.";
MeleeWeapon[40]="Vibroblade: type imp/cut, dam +1d (5), cost +$200 knife/+$400 sword/+$1000 other, TL 8";
MeleeWeapon[41]="Monomolecular Blade: type cut, dam +1d (10), cost +$500 knife/+$1000 sword/+$1500 other, TL 9";
MeleeWeapon[42]="Monowire Whip: type cut, dam sw-2+1d (10), reach 1-7, cost $900, wt. 0.5 lb., TL 9";
MeleeWeapon[43]="Sonic Blade: type cr, dam 5d (5), reach 1, cost $2500, wt. 2 lb., TL 10";
MeleeWeapon[44]="Force sword: type imp/cut, dam 4d/8d (5), reach 1, cost $3000, wt. 2 lb., LC 3, TL 11";
MeleeWeapon[45]="Bat'letlh: type imp, dam sw+1, reach 1, cost $70, wt. 3 lb., notes: balanced pick, may get stuck";

function MeleeWeaponFunction (form)
    {
    ndx = form.Melee.options.selectedIndex+1;
    form.Stats.value = MeleeWeapon[ndx];
    }

RangedWeapon = new makearray(24);

RangedWeapon[1]="Hatchet: type cut, damage sw, SS 11, Acc 1, 1/2D STx1.5, Max STx2.5, cost $40, weight 2 lbs., min ST 7";
RangedWeapon[2]="Throwing axe: type cut, damage sw+2, SS 10, Acc 2, 1/2D ST, Max STx1.5, cost $60, weight 4 lbs., min ST 11";
RangedWeapon[3]="Blowpipe: type Special (p. B49), damage -, SS 10, Acc 1, 1/2D -, Max STx4, cost $30, weight 1 lb., min ST -, notes:   See p. B49.";
RangedWeapon[4]="Bola: type Special (p. B49), damage thr-1, SS 12, Acc 0, 1/2D -, Max STx3, cost $20, weight 2 lbs., min ST -, notes:   See p. B49.";
RangedWeapon[5]="Short Bow: type imp, dam thr, SS 12, acc 1, 1/2D STx10, max. STx15, cost $50/$2, wt. 2 lb., min ST 7, notes: max. damage 1d+3";
RangedWeapon[6]="Regular bow: type imp, damage thr+1, SS 13, Acc 2, 1/2D STx15, Max STx20, cost $100/$2, weight 2 lbs., min ST 10, notes:  Max. dam. 1d+4.";
RangedWeapon[7]="Long bow: type imp, damage thr+2, SS 15, Acc 3, 1/2D STxl5, Max STx20, cost $200/$2, weight 3 lbs., min ST 7, notes: Max. dam. 3d";
RangedWeapon[8]="Composite bow: type imp, damage thr+3, SS 14, Acc 3, 1/2D STx20, Max STx25, cost $900/$2, weight 4 lbs., min ST 10, notes: Max. dam. 1d+4.";
RangedWeapon[9]="Crossbow: type imp, dam thr+4, SS 12, acc 4, 1/2D STx20, max. STx25, cost $150/$2, wt. 6 lb., min ST 7, notes: max. damage 3d";
RangedWeapon[10]="Prodd: type cr, damage thr+4, SS 12, Acc 2, 1/2D STx20, Max STx25, cost $150/$.10, weight 6 lbs., min ST 7, notes: Fires lead pellets.";
RangedWeapon[11]="Large Knife: type imp, dam thr, SS 12, acc 0, 1/2D ST-2, max. ST+5, cost $40, wt. 1 lb., min ST -, notes: max. damage 1d+2";
RangedWeapon[12]="Small Knife: type imp, dam thr-1, SS 11, acc 0, 1/2D ST-5, max. ST, cost $30, wt. 1/2 lb., min ST -, notes: max. damage 1d+1";
RangedWeapon[13]="Dagger: type imp, dam thr-1, SS 12, acc 0, 1/2D ST-5, max. ST, cost $20, wt. 1/4 lb., min ST -, notes: max. damage 1d";
RangedWeapon[14]="Lasso: type Special, damage Special, SS 16, Acc 0, 1/2D -, Max - cost $40, weight 3 lbs., min ST -, notes: See p. 51.";
RangedWeapon[15]="Large Net: type Special (p. B51), damage -, SS 13, Acc 1, 1/2D -, Max ST/2 + Skill/5, cost $40, weight 20 lbs., min ST -, notes: See p. B51.";
RangedWeapon[16]="Melee Net: type Special (p. B51), damage -, SS 12, Acc 1, 1/2D -, Max ST + Skill/5, cost $20, weight 5 lbs., min ST -, notes: See p. B51.";
RangedWeapon[17]="Sling: type cr, damage sw, SS 12, Acc 0, 1/2D STx6, Max STx10, cost $10, weight 1/2 lb., min ST -, notes:  Fires rocks.";
RangedWeapon[18]="Staff Sling: type cr, damage sw+1, SS 14, Acc 1, 1/2D STx10, Max STxl5, cost $20, weight 2 lbs., min ST -, notes: Fires rocks.";
RangedWeapon[19]="Javelin: type imp, damage thr+1, SS 10, Acc 3, 1/2D STx1.5, Max STx2.5, cost $30, weight 2 lbs., min ST 7";
RangedWeapon[20]="Spear: type imp, damage thr+3, SS 11, Acc 2, 1/2D ST, Max STx1.5, cost $40, weight 4 lbs., min ST 9";
RangedWeapon[21]="TL7 Fragmentation Grenade, type expl., damage 3d concussion, 2d frag (30 yds.), SS 12, Acc 0, 1/2D STx2, Max STx3.5, cost $25, wt. 1 lb.";
RangedWeapon[22]="TL7 Concussion Grenade, type expl., damage 3d concussion, SS 12, Acc 0, 1/2D STx2, Max STx3.5, cost $25, wt. 1 lb.";
RangedWeapon[23]="TL8 Fragmentation Grenade, type expl., damage 6dx2 concussion, 2d frag (10 yds.), SS 12, Acc 0, 1/2D STx2, Max STx3.5, cost $25, wt. 1 lb.";
RangedWeapon[24]="TL8 Concussion Grenade, type expl., damage 3d concussion, SS 12, Acc 0, 1/2D STx2, Max STx3.5, cost $25, wt. 1 lb.";

function RangedWeaponFunction (form)
    {
    ndx = form.Ranged.options.selectedIndex+1;
    form.Stats.value = RangedWeapon[ndx];
    }

PistolWeapon = new makearray(33);

PistolWeapon[1]="Phaser I: malf verC, type imp, dam 2d-1(10), SS 9, acc 12, 1/2D 600, max. 1100, wt. 1.1 lb., ROF 2, shots 15/3B, ST 0, rcl 0, cost $1640, LC 0, TL 10";
PistolWeapon[2]="Phaser II: malf verC, type imp, dam 2d+1(10), SS 5, acc 12, 1/2D 800, max. 1500, wt. 1.9 lb., ROF 4, shots 30/C, ST 0, rcl 0, cost $1790, LC 2, TL 10";
PistolWeapon[3]="ST Disruptor: malf ver, type imp, dam 7d, SS 10, acc 6, 1/2D -, max. 660, wt. 2 lb., ROF 3~, shots 20/C, ST 8, rcl -1, cost $2000, LC 3, TL 10";
PistolWeapon[4]="Nerve Pistol, Malf Ver., Type Spcl., Damage Spcl., SS 8, Acc 4, 1/2D 15, Max 30, Wt. 2, RoF 3 -, Shots 30/C, ST _, Rcl 0, Cost 1,000, LC 2, TL 10";
PistolWeapon[5]="Paralysis Gun, Malf Ver., Type Spcl., Damage -, SS 6, Acc 4, 1/2D -, Max 25, Wt. 5, RoF 1, Shots 15/C, ST -, Rcl 0, Cost 1,500, LC 3, TL 10";
PistolWeapon[6]="Blaster: type imp, dam 6d, SS 10, acc 6, 1/2D -, max. 300, wt. 2 lb., ROF 3~, shots 20/C, ST 8, rcl -1, cost $2000, LC 3, TL 9";
PistolWeapon[7]="Stunner: type stun, dam Sp., SS 10, acc 3, 1/2D 12, max. 20, wt. 1 lb., ROF 3~, shots 40/C, ST -, rcl 0, cost $800, LC 6, TL 9, notes: roll against HT-3 (HT at 12 yds. or more) or be incapacitated for 20-HT minutes.";
PistolWeapon[8]="Holdout Laser, Malf Crit., Type Imp., Damage ld-l, SS 10, Acc 4, 1/2D 50, Max 100, Wt. -, RoF 1, Shots 5/B, ST -, Rcl 0, Cost 500, LC 0, TL 9";
PistolWeapon[9]="Electrolaser, Malf Crit., Type Spcl., Damage 2d+1, SS 8, Acc 4, 1/2D 60, Max 120, Wt. 1.5, RoF 1, Shots 10/C, ST 0, Rcl 0, Cost 1,200, LC 3, TL 9";
PistolWeapon[10]="Flamer, Malf crit., Type Spcl., Damage 5d, SS 4, Acc 12, 1/2D 70, Max 150, Wt. 4, RoF 1, Shots 8/C, ST 6, Rcl 0, Cost 1,300, LC 2, TL 9";
PistolWeapon[11]="Needler, .01 Ne, SF, type imp, damage 1 d+2, SS 9, Acc 1, 1/2D 100, Max 3(}0, Wt. 1, Rof 3 ~, Shots 100, ST -, Rcl -1, Cost 800, TL 8";
PistolWeapon[12]="Gauss Needler,.02 GN, SF, type imp, damage 1d+2, SS 10, Acc 4, 1/2D 100, Max 300, Wt. 1.5, Rof 12, Shots 100/B, ST -, Rcl -1, Cost 2000, TL 8";
PistolWeapon[13]="Heavy Laser Pistol Malf Ver.(Crit.), Type Imp., Damage 2d, SS 9, Acc 8, 1/2D 300, Max 800, Wt. 3, RoF 4, Shots 12/C, ST -, Rcl 0, Cost 1,500, LC 2, TL 8";
PistolWeapon[14]="Laser Pistol, SF (BW), type imp, damage 1d, SS 9, Acc 7, 1/2D 400, Max 500, Wt. 2, Rof 4*, Shots 20/C, ST -, Rcl 0, Cost 1,000, TL 8";
PistolWeapon[15]="AMT Backup, 9mm S, 1976, US, type cr, damage 2d, SS 11, Acc 0, 1/2D 125, Max 1,467, Wt. 1, RoF 3~, Shots 5, ST 8, Rcl -2, Cost 180, TL 7";
PistolWeapon[16]="Beretta 92, 9mm P, 1976, IT, type cr, damage 2d+2, SS 10, Acc 3, 1/2D 150, Max 1,867, Wt. 2.5, RoF 3~, Shots 15, ST 9, Rcl -1, Cost 400, TL 7";
PistolWeapon[17]="Glock 17, 9mm P, 1982, AU, type cr, damage 2d+2, SS 10, Acc 3, 1/2D 150, Max 1,867, Wt. 2, RoF 3~, Shots 17, ST 9, Rcl -1, Cost 450, TL 7";
PistolWeapon[18]="IMI Eagle,.44 M, 1984, IS, type cr, damage 3d, SS 12, Acc 3, 1/2D 230, Max 2,500, Wt. 4.5, RoF 3~, Shots 9, ST 12, Rcl -3, Cost 750, TL 7";
PistolWeapon[19]="Colt Python, .357M, 1955, US, type cr, damage 3d- 1, SS 10, Acc 3, 1/2D 185, Max 2,034, Wt. 3, RoF 3~, Shots 6, ST 10, Rcl -2, Cost 100, TL 7";
PistolWeapon[20]="S&W M29, .44M, 1956, US, type cr, damage 3d, SS 10, Acc 2, 1/2D 200, Max 2,500, Wt. 3.25, RoF 3~, Shots 6, ST 11, Rcl -3, Cost 100, TL 7";
PistolWeapon[21]="Mauser '96, 7.63mm Msr, GE, type cr, dam. 2d+1, SS 11, Acc 3, 1/2D 140, Max 1,800, Wt. 2.75, RoF 3~, Shots 10, ST 10, Rcl -1, Cost 20, TL 6";
PistolWeapon[22]="Msr Luger, 9mm P, 1904, GE, type cr, damage 2d+2, SS 9, Acc 4, 1/2D 220, Max 1,900, Wt. 2, RoF 3~, Shots 9, ST 9, Rcl -1, Cost 25, TL 6";
PistolWeapon[23]="C M1911,.45 ACP, 1910, US, type cr, damage 2d, SS 10, Acc 2, 1/2D 220, Max 1,700, Wt. 2.75, Rof 3~, Shots 7, ST 10, Rcl -2, Cost 30, TL 6";
PistolWeapon[24]="Wltr PPK,.32 ACP, 1929, GE, type cr, damage 2d-1, SS 10, Acc 2, 1/2D 100, Max 1,467, Wt. 1.25, RoF 3~, Shots 7, ST 8, Rcl -1, Cost 75, TL 6";
PistolWeapon[25]="FN HP35, 9mm P, 1935, BE, type cr, damage 2d+2, SS 10, Acc 3, 1/2D 150, Max 1,867, Wt. 2.5, Rof 3~, Shots 13, ST 9, Rcl -1, Cost 80, TL 6";
PistolWeapon[26]="Ruger STD, .22 I,R, 1949, US, type cr, damage 1d+1, SS 9, Acc 4, 1/2D 75, Max 1,200, Wt. 2.5, Rof 3~, Shots 9, ST 7, Rcl -1, Cost 25, TL 6";
PistolWeapon[27]="S&W M10, .38Sp, 1902, US, type cr, damage 2d- 1, SS 10, Acc 2, 1/2D 120, Max 1,934, Wt. 2, RoF 3~, Shots 6, ST 8, Rcl -1, Cost 20, TL 6";
PistolWeapon[28]="Colt Texas, .34, 1836, US (BP), type cr, damage 2d-1, SS 10, Acc 1, 1/2D 100, Max 1,100, Wt. 4, Rof 1, Shots 5, ST 10, Rcl -1, Cost 10, TL 5";
PistolWeapon[29]="S&W Russian, .44R, 1871, US, type cr, damage 2d, SS 10, Acc 3, 1/2D 150, Max 1,700, Wt. 2.5, Rof 1, Shots 6, ST 10, Rcl -2, Cost 20, TL 5";
PistolWeapon[30]="W Nol.,.455W, 1877, UK, type cr, damage 2d, SS 11, Acc 2, 1/2D 160, Max 1,600, Wt. 3, Rof 3~, Shots 6, ST 11, Rcl -3, Cost 40, TL 5";
PistolWeapon[31]="Flintlock Pistol, .5 1, I Sth century (BP),, type cr, damage 2d-1, SS 11, Acc 1, 1/2D 75, Max 467, Wt. 3, Rof 1/20, Shots 1, ST 10, Rcl -1, Cost 200, TL 5";
PistolWeapon[32]="Wogdon Pistol, .45, 1 800 (BP), type cr, damage 2d- 1, SS 10, Acc 3, 1/2D 75, Max 467, Wt. 2.75, Rof 1120, Shots 1, ST 9, Rcl -1, Cost 20, TL 5";
PistolWeapon[33]="Wheellock Pistol, .60, 17th century (BP) type cr, damage ld+1, SS 13, Acc 1, 1/2D 75, Max 400, Wt. 3.25, RoF 1/60, Shots 1, ST 10, Rcl -1, Cost 700, TL 4";

function PistolWeaponFunction (form)
    {
    ndx = form.Pistol.options.selectedIndex+1;
    form.Stats.value = PistolWeapon[ndx];
    }

RifleWeapon = new makearray(42);

RifleWeapon[1]="Phaser Rifle: malf verC, type imp, dam 3d(10), SS 9, acc 15, 1/2D 2200, max. 4200, wt. 7.8 lb., ROF 8, shots 150/D, ST 0, rcl 0, cost $4950, LC 0, TL 10";
RifleWeapon[2]="ST Disruptor Rifle: malf ver, type imp, dam 14d, SS 14, acc 13, 1/2D 450, max. 900, wt. 10 lb., ROF 3~, shots 18/C, ST 9, rcl -1, cost $3000, LC 4, TL 10";
RifleWeapon[3]="Stun Rifle, SF (BW) - see p. I 1 9, type Stun, dam stun, SS 12, acc 10, 1/2d 300, max 1,000, wt 4, rof 3~, shots 20/C,ST -, rcl 0, cost $1,000, TL 9";
RifleWeapon[4]="Disruptor, SF (BW) , type Imp., dam 6d, SS 13, acc 10, 1/2d 500, max 1,000, wt 9, shots 20/C, rof 20/C, ST -, rcl 0, cost $2,500, TL 9";
RifleWeapon[5]="Blast Rifle: type imp, dam 12d, SS 14, acc 13, 1/2D 400, max. 800, wt. 10 lb., ROF 3~, shots 12/C, ST 9, rcl -1, cost $3000, LC 4, TL 9";
RifleWeapon[6]="Gauss Needle Rifle, .02 ON, SF, type Imp, dam 2+1, SS 14, acc 11, 1/2d 500, max 1,000, wt 6, rof  20*, shots 100/B, ST 9, rcl -1, cost $2,500, TL 8";
RifleWeapon[7]="Military Laser Rifle, SF (BW) , type Imp., dam 2d, SS 12, acc 15, 1/2d 1,500, max 2,000, wt 9, rof 8*, shots 140/D, ST -, rcl 0, cost $4,000, TL 8";
RifleWeapon[8]="Laser Rifle, SF (BW) , type Imp., dam 2d, SS 15, acc 13, 1/2d 900, max 1,00, wt 5, rof 3~, shots 12/C, ST -, rcl  0, cost $ 2,000, TL 8";
RifleWeapon[9]="Needle Rifle,.01 Ne, SF, type Imp., dam 2d, SS 13, acc 9, 1/2d 300, max 800, wt 5, rof 3~, shots 100, ST 8, rcl -1, cost $1,200, TL 8";
RifleWeapon[10]="IMI Uzi, 9mm P, 1952, IS, type Cr, dam 3d-1, SS 10, acc 7, 1/2d 160, max 1,900, wt 9.5, rof 10*, shots 32, ST 10, rcl -1, cost $150, TL 7";
RifleWeapon[11]="H&K MP5,9mm P, 1966, GE, type Cr., dam 3d-l, SS 10, acc 8, 1/2d 160, max 1,900, wt 7.25, rof 10*, shots 30, ST 10, rcl -1, cost $340, TL 7";
RifleWeapon[12]="H&K PSG1, .308 Win, 1982, GE, type Cr., dam 7d, SS 15, acc 13, 1/2d 1,200, max 4,655, wt 11, rof 3~, shots 20, ST 12, cost $4,500, TL 7";
RifleWeapon[13]="AUG .223 Rem, 1978, AU, type Cr., dam 5d, SS 11, acc 10, 1/2d 500, max 3,843, wt 9, rof 11*, shots 30, ST 9, rcl -1, cost $540, TL 7";
RifleWeapon[14]="M16,.223 Rem, 1964, US, type Cr., dam 5d, SS 12 ,acc 11, 1/2d 500, max 3,843, wt 8, rof 12*, shots 20, ST 9, rcl -1, cost $540, TL 7";
RifleWeapon[15]="H&K G3,.308 Win, 1959, GE, type Cr., dam 7d, SS 14, acc 11, 1/2d 1,000, max 4,655, wt 11, rof 10*, shots 20, ST 11, rcl -2, cost $550,  TL 7";
RifleWeapon[16]="FN-FAL, .308 Win, 1950, BE, type Cr., dam 7d, SS 14, acc 11, 1/2d 1,000, max 4,655, wt 11, rof 11*, shots 20, ST 11, rcl -2, cost $900, TL 7";
RifleWeapon[17]="AK-47, 7.62mm R, 1949, SU, type Cr., dam 5d+1, SS 12, acc 7, 1/2d 400, max 3,011, wt 10.5, rof 10*, shots 30, ST 10, rcl -1, cost $290, TL 7";
RifleWeapon[18]="Rem M870, 12G, 1950. US, type cr., damage 4d, SS 12, acc 5, 1/2D 25, max 150, wt 8, ROF 3~, shots 5, ST 12, rcl -3, cost $235, TL 7";
RifleWeapon[19]="PPsh41,7.62 RP, 1941, USSR, type Cr., dam 3d-l, SS 10, acc 6, 1/2d 160, max 1,900, wt 12, rof 16,shots 71,ST 10, rcl -1, cost $65, TL 6";
RifleWeapon[20]="MP40, 9mm P, 1940, GE, type Cr., dam 3d-1, SS 10, acc 6, 1/2d 160, max 1,900, wt 10.5, rof 8, shots 32, ST 10, rcl -1,cost $70, TL 6";
RifleWeapon[21]="Thompson .45 ACP 1922, US, type Cr., dam 2d+1, SS 11, acc 7, 1/2d 190, max 1,750, wt 12,rof 20*, shots 30, ST 11, rcl -3, TL 6";
RifleWeapon[22]="M1 Garand, .30-06, 1936, US, type Cr., dam 7d+1, SS 14, 11, 1/2d 1,000, max 3,710, wt 10, rof 3~, shots 8, ST 12, rcl -3, cost $590, TL 6";
RifleWeapon[23]="H&H Express, .600 N, 1923, UK, type Cr., dam 10, SS 16, acc 7, 1/2d 1,500, max 5,063, wt 16, rof 2, shots 2, ST 13, rcl -6, cost $200, TL 6";
RifleWeapon[24]="M1903A1, .30-06, 1906, US, type Cr., dam 7d+1, SS 14, acc 11, 1/2d 1,000, max 3,710, wt 9.5, rof 1/2, shots 5, ST 12, rcl -3, cost $135, TL 6";
RifleWeapon[25]="LE Mk3#1, .303 Br, 1903, UK, type Cr., dam 6d+1, SS 14, acc 10, 1/2d 1,000, max 3,800, wt 10.2, rof 1, shots 10, ST 12, rcl -2, cost $130, TL 6";
RifleWeapon[26]="Msr '98k, 8mm Msr, 1898, GE, type Cr., dam 7d, SS 14, acc 11, 1/2d 1,000, max 3, 972, wt  9.5, rof 1/2, shots 5, ST 12, cost $70, TL 6";
RifleWeapon[27]="Ithaca 1OG, 1900, US, type Cr., dam 5d, SS 12, acc 5, 1/2D 25, max 150, wt 10, ROF 2~, shots 2, ST 13, rcl -4, cost $45, TL 6";
RifleWeapon[28]="Win '94, .30-30 Win, 1894, US, type Cr., dam 5d, SS 13, acc 8, 1/2d 450, max 3,011, wt 7, rof 2~, shots 6, ST 10, rcl -1, cost $475, TL 5";
RifleWeapon[29]="Sharps 50, .50-90,1890, US, type Cr., dam 6d, SS 15, acc 7, 1/2d 600, max 3,300, wt 1, rof 1/4, shots 1, ST 12, rcl -3, cost $150, TL 5";
RifleWeapon[30]="Lebel '86, 8mm L, 1886, FR, type Cr., dam 6d+1, SS 15, acc 10, 1/2d  1,000, max 3,900, wt 10, rof 1/2, shots 8, ST 12, rcl -3, cost $125, TL 5";
RifleWeapon[31]="Win '73, .44-40 Win, 1873, US, type Cr., dam 3d, SS 13, acc 7, 1/2d 300, max 2,200, wt 7.1, rof, 2~, shots 6, ST 10, rcl -2, cost $40, TL 5";
RifleWeapon[32]="Spr '73,.45-70, 1873, US, type Cr., dam 4d, SS 15, acc 8, 1/2d 700, max 2,100, wt 9, rof 1/4,shots 1, ST 11, rcl -2, cost $20, TL 5";
RifleWeapon[33]="Rem Rifle, .45, 1871, US, type Cr., dam 4d, SS 15, acc 8, 1/2d 700, max 2,100, wt 9.25, rof 1/4, shots 1, ST 10, rcl -2, cost $55, TL 5";
RifleWeapon[34]="MH '71,.45 Br, 187 1, UK, type Cr., dam 4d, SS 15, acc 7, 1/2d 600, max 2,030, wt 6.5, rof 1/4, shots 1, wt 10, rcl -2, cost $20, TL 5";
RifleWeapon[35]="E '53, .577 Br, 1853, UK (BP), type Cr., dam 3d, SS 15, acc 8, 1/2d 700, max 2,100, wt 8.5, rof 1/15, shots 1, ST 10, rcl -2, cost $15, TL 5";
RifleWeapon[36]="Baker Rifle, .625, 1790, UK (BP), type Cr., dam 4d, SS 15, acc 7, 1/2d 300, max 2,500, wt 9.25,rof 1/20, shots 1, ST 12, rcl -3, cost $20, TL 5";
RifleWeapon[37]="Ferguson Rifle .60,1777, UK (BP), type Cr., dam 4d, SS 14, acc 7, 1/2d 400, max 3,700, wt 7, rof 1/10, shots 1, ST 10, rcl -2, TL 5";
RifleWeapon[38]="Kentucky Rifle, .45, 2200, US (BP), type Cr, dam 4d, SS 15, acc 7, 1/2d 400, max 3,700, wt 6.75, rof 1/20, shots 1, ST 10, rcl -2, cost $40, TL 5";
RifleWeapon[39]="Brown Bess, .75,1720, UK (BP), type Cr., dam 3d, SS 15, acc 5, 1/2d 100, max 1,500, wt 13,rof 1/15, shots 1, ST 11, cost $10, TL 4";
RifleWeapon[40]="Matchlock Musket, .80, 17th century (BP), type Cr, dam 4d, SS 18, acc 2, 1/2d 100, max 600, wt 20, rof 1/60, shots 1, ST 12, rcl -2, cost $400, TL 4";
RifleWeapon[41]="Cannon-lock, .90, 16th century (BP), type Cr., damage 2d, SS 20, acc 1, 1/2D 100, max. 600, wt 5, ROF 1/60, shots 1, ST 10, rcl -3, cost $300, TL 4";
RifleWeapon[42]="Blunderbuss 8G, 18th C, UK, (BP), type Cr. damage 5d, SS 14, Acc 3, 1/2D is, Max 100, wt 12,  ROF 1/15, shots 1, ST 13, rcl -4, cost $15, TL 5";

function RifleWeaponFunction (form)
    {
    ndx = form.Rifle.options.selectedIndex+1;
    form.Stats.value = RifleWeapon[ndx];
    }

ArmorStats = new makearray(21);

ArmorStats[1]="Light Monocrys Suit: PD 2 (1 vs. impaling), DR 8 (2 vs. impaling), wt. 7 lb., cost $1000, TL 8";
ArmorStats[2]="Medium Monocrys Suit: PD 2 (1 vs. impaling), DR 16 (2 vs. impaling), wt. 14 lb., cost $1500, TL 8";
ArmorStats[3]="Heavy Monocrys Suit: PD 2 (1 vs. impaling), DR 24 (2 vs. impaling), wt. 16 lb., cost $2000, TL 8";
ArmorStats[4]="Light Body Armor: PD 4, DR 15, wt. 22 lb., cost $320, TL 7";
ArmorStats[5]="Medium Body Armor: PD 6, DR 25, wt. 32 lb., cost $1,520, TL 8";
ArmorStats[6]="Heavy Combat Armor: PD 6, DR 50, wt. 52 lb., cost $2,520, TL 9";
ArmorStats[7]="Combat Infantry Dress: PD 4, DR 40, wt. 40 lb., cost $510, TL 8";
ArmorStats[8]="Infantry Combat Armor: PD 6, DR 65, wt. 60 lb., cost $2,550, TL 9";
ArmorStats[9]="Reflex Armor: PD 5 (2 vs. impaling weapons), DR 30 (15 vs. impaling), wt. 10 lb., cost $4000";
ArmorStats[10]="Reflec: PD 6 (vs. beams), DR 2 (vs. beams), wt. 4 lb., cost $320, TL 8";
ArmorStats[11]="Light Kevlar: PD 2 (1 vs. impaling weapons), DR 4 (2 vs. impaling), wt. 5 lb., cost $220, TL 7";
ArmorStats[12]="Heavy Kevlar: PD 2 (1 vs. impaling weapons), DR 12 (2 vs. impaling), wt. 7 lb., cost $420, TL 7";
ArmorStats[13]="Flack Jacket: PD 2, DR 3, wt. 17 lb., cost $220, TL 7";
ArmorStats[14]="Padded Cloth: PD 1, DR 1, wt. 14 lb., cost $180, TL 1-4";
ArmorStats[15]="Light Leather: PD 1, DR 1, wt. 10 lb., cost $220, TL 1-4";
ArmorStats[16]="Heavy Leather: PD 2, DR 2, wt. 20 lb., cost $350, TL 1-4";
ArmorStats[17]="Chainmail: PD 3 (1 vs. impaling weapons), DR 4 (2 vs. impaling), wt. 45 lb., cost $550, TL 3-4";
ArmorStats[18]="Scale: PD 3, DR 4, wt. 50 lb., cost $750, TL 2-4";
ArmorStats[19]="Half Plate: PD 4, DR 5, wt. 70 lb., cost $2000, TL 2-4, notes: all combat skills at -1";
ArmorStats[20]="Light Plate: PD 4, DR 6, wt. 90 lb., cost $4000, TL 3-4, notes: all combat skills at -1";
ArmorStats[21]="Heavy Plate: PD 4, DR 7, wt. 110 lb., cost $6000, TL 3-4, notes: all combat skills at -1";

function ArmorStatsFunction (form)
    {
    ndx = form.Armor.options.selectedIndex+1;
    form.Stats.value = ArmorStats[ndx];
    }

ShieldStats = new makearray(5);

ShieldStats[1]="Buckler: PD 1, cost $25, wt. 2 lb., hits 5/20";
ShieldStats[2]="Small Shield: PD 2, cost $40, wt. 8 lb., hits 5/30";
ShieldStats[3]="Medium Shield: PD 3, cost $60, wt. 15 lb., hits 7/40";
ShieldStats[4]="Large Shield: PD 4, cost $90, wt. 25 lb., hits 9/60, notes: effective weapon skill at -2";
ShieldStats[5]="Force Shield: PD 4, cost $1,500, wt. 1/2 lb., hits -";

function ShieldStatsFunction (form)
    {
    ndx = form.Shield.options.selectedIndex+1;
    form.Stats.value = ShieldStats[ndx];
    }

function STVal(form)
    {
    if ((form.ST.options.selectedIndex+4) <= 40)
		str = form.ST.options.selectedIndex+4;
    else if (form.ST.options.selectedIndex+4 > 40 && 							form.ST.options.selectedIndex+4 <= 52)
		str = (form.ST.options.selectedIndex+4-40)*5 + 40;
    else if (form.ST.options.selectedIndex+4 > 52)
		str = (form.ST.options.selectedIndex+4-52)*10 + 100;

    if (str == 4)
		thrdice = "0";
    else if (str >= 5 && str <=18)
		thrdice = "1d";
    else if (str > 18 && str <=26)
		thrdice = "2d";
    else if (str > 26 && str <=34)
		thrdice = "3d";
    else if (str > 34 && str <=40)
		thrdice = "4d";
    else if (str > 40 && str <=50)
		thrdice = "5d";
    else if (str == 55)
		thrdice = "6d";
    else if (str >= 60 && str <=100)
		thrdice = (Math.ceil((str-55)/10))+6+"d";
    else if (str > 100)
		thrdice = 1 + str/10 +"d";

    if (str == 4)
		thrplus = 0;
    else if (str == 5)
		thrplus = -5;
    else if (str >= 6 && str <= 12)
		thrplus = Math.ceil(str/2)-7;
    else if (str > 12 && str <= 39)
		thrplus = (Math.ceil((str-12)/2)%4)-1;
    else if (str == 40 || str == 65)
		thrplus = 1;
    else if (str == 45 || str == 55)
		thrplus = 0;
    else if (str == 60 || str == 65)
		thrplus = -1;
    else if (str == 50)
		thrplus = 2;
    else if (str >= 70 && str <= 100)
		thrplus = (((str-70)/5)%2)*2;
    else if (str > 100)
		thrplus = 0;

    if (str == 4)
		swdice = "0";
    else if (str <= 12)
		swdice = "1d";
    else if (str >= 12 && str <= 16)
		swdice = "2d";
    else if (str > 16 && str <= 20)
		swdice = "3d";
    else if (str > 20 && str <= 24)
		swdice = "4d";
    else if (str > 24 && str <= 30)
		swdice = "5d";
    else if (str > 30 && str <= 38)
		swdice = "6d";
    else if (str > 38 && str <= 45)
		swdice = "7d";
    else if (str > 45 && str <= 95)
		swdice = Math.ceil((str-45)/10)+7+"d";
    else if (str > 95)
		swdice = 3 + str/10 +"d";

    if (str == 4)
		swplus = 0;
    else if (str > 4 && str <= 12)
		swplus = str - 10;
    else if (str > 12 && str <= 26)
		swplus = ((str - 13) % 4) - 1;
    else if (str > 26 && str <= 40)
		swplus = (Math.ceil((str-24)/2)%4)-1;
    else if (str == 45 || str == 55)
		swplus = 1;
    else if (str == 50)
		swplus = -1;
    else if (str > 55 && str <= 95)
		swplus = (Math.ceil((str-60)/5)%2)*2;
    else if (str > 95)
		swplus = 0;

    if (thrplus < 0)
		thrdam = thrdice + thrplus;
    else if (thrplus == 0)
		thrdam = thrdice;
    else
		thrdam = thrdice + "+" + thrplus;

    if (swplus < 0)
		swdam = swdice + swplus;
    else if (swplus == 0)
		swdam = swdice;
    else
		swdam = swdice + "+" + swplus;

    form.Stats.value= "Thrust: "+thrdam+" Swing: "+swdam+"\r\nEncumbrance (lb.): None(0) "+2*str+", Light(-1) "+4*str;
    form.Stats.value+= ", Medium(-2) "+6*str+", Heavy(-3) "+12*str+", Extra-heavy(-4) "+20*str;
    form.Stats.value+="\r\nFeats: High Jump "+3*str+"in. Running High Jump "+(3*str+24)+"in. Broad Jump: "+(str-3)+" ft. (+1 ft for every yard of take off distance to double normal distance)";
    form.Stats.value+="\r\nLifting (lb.): One hand "+6*str+", Two hand "+25*str;

    if (str > 16)
	form.Stats.value+=", w. Extra Effort "+(25*str+(str-16)*str*2.5);

    form.Stats.value+=", Carry on back "+30*str+", Shove and knock over "+25*str;
    form.Stats.value+=" (or x2 with a running start), Shift slightly "+100*str;

    objweight = parseFloat(form.weight.value, 10);
	if (objweight < 0) {
		alert("Please give the thrown object a positive weight.");
		return;
		}

    ratio = objweight / str;

    if (ratio <= .1)
		distmod = 3.5;
    else if (ratio > .1 && ratio <= .125)
		distmod = 3;
    else if (ratio > .125 && ratio <= .2)
		distmod = 2.5;
    else if (ratio > .2 && ratio <= .3)
		distmod = 1.9;
    else if (ratio > .3 && ratio <= .4)
		distmod = 1.5;
    else if (ratio > .4 && ratio <= .5)
		distmod = 1.2;
    else if (ratio > .5 && ratio <= .75)
		distmod = 1;
    else if (ratio > .75 && ratio <= 1)
		distmod = .8;
    else if (ratio > 1 && ratio <= 1.5)
		distmod = .7;
    else if (ratio > 1.5 && ratio <= 2)
		distmod = .6;
    else if (ratio > 2 && ratio <= 2.5)
		distmod = .5;
    else if (ratio > 2.5 && ratio <= 3)
		distmod = .4;
    else if (ratio > 3 && ratio <= 4)
		distmod = .3;
    else if (ratio > 4 && ratio <= 5)
		distmod = .25;
    else if (ratio > 5 && ratio <= 6)
		distmod = .2;
    else if (ratio > 6 && ratio <= 8)
		distmod = .15;
    else if (ratio > 8 && ratio <= 10)
		distmod = .1;
    else if (ratio > 10)
		distmod = .05;

    form.distthrw.value = distmod * str;

    if (objweight < 2)
		form.thrwdamage.value =  "thrust-2/die";
    else if (objweight >= 2 && objweight < 5)
		form.thrwdamage.value =  "thr-1/die";
    else if (objweight >= 5 && objweight < str)
		form.thrwdamage.value =  "thr";
    else if (objweight >= str && objweight < (3*str))
		form.thrwdamage.value =  "thr+1/die";
    else if (objweight >= (3*str) && objweight < (7*str))
		form.thrwdamage.value =  "thrust";
    else if (objweight >= (7*str) && objweight < (11*str))
		form.thrwdamage.value =  "thr-0.5/die";
    else if (objweight > (11*str))
		form.thrwdamage.value =  "thr-1/die";

    }

PositionsStats = new makearray(5);

PositionsStats[1]="Crouching: Attack -2, Defense ranged weapons -2 to hit; normal vs. others, Movement +1/2 cost per hex"
PositionsStats[2]="Kneeling: Attack -2, Defense ranged weapons -2 to hit; -2 to any active defense, Movement +2 cost per hex"
PositionsStats[3]="Crawling (2 hexes): Attack only close attacks, Defense ranged weapons -4 to hit; -3 to any active defense, Movement +2 cost per hex"
PositionsStats[4]="Sitting: Attack -2, Defense ranged weapons -2 to hit; -2 to any active defense, Movement cannot move"
PositionsStats[5]="Lying Down (2 hexes): Attack -4 except with crossbow or gun +1, Defense ranged weapons -4 to hit; -3 to any active defense, Movement only 1 hex per turn"

function PositionsStatsFunction (form)
    {
    ndx = form.Positions.options.selectedIndex+1;
    form.Stats.value = PositionsStats[ndx];
    }


BodyParts = new makearray(23);

BodyParts[1]="Brain--Hit Penalty -7";
BodyParts[2]="Head--Hit Penalty -5, No DR; no special damage to results, but critical hits to to the Critical Head Blow table.";
BodyParts[3]="Eyes--Hit Penalty -9";
BodyParts[4]="Eyeslits--Hit Penalty -10, Armor does not protect";
BodyParts[5]="Shield (far) arm--Hit Penalty -4, Damage over HT/2 cripples arm.  Excess damage is lost.";
BodyParts[6]="Hand (roll for left or right)--Hit Penalty -4, Damage over HT/3 cripples arm.  Excess damage is lost.";
BodyParts[7]="Shield (left) Hand--Hit Penalty -8, Damage over HT/3 cripples arm.  Excess damage is lost.";
BodyParts[8]="Weapon (near) arm--Hit Penalty -2, Damage over HT/2 cripples arm.  Excess damage is lost.";
BodyParts[9]="Body--Hit Penalty 0, No special results";
BodyParts[10]="Far leg--Hit Penalty -2, Damage over HT/2 cripples leg.  Excess damage is lost";
BodyParts[11]="Near leg--Hit Penalty -2, Damage over HT/2 cripples leg.  Excess damage is lost";
BodyParts[12]="Foot (roll for left or right)--Hit Penalty -4, Damage over HT/3 cripples leg.  Excess damage is lost.";
BodyParts[13]="Vital organs (in torso)--Hit Penalty -3, Impaling weapons that penetrate armor do triple damage, not double";
BodyParts[14]="Weapon--Hit Penalty -3 to -5";
BodyParts[15]="\r\nIf the brain is hit, the skull provides a natural DR of 2.  This is in addition to any armor, toughness, etc., the victim possesses.";
BodyParts[16]="However, shooting for the eyes avoids this DR, and shooting for the eyeslits of a helm avoids both the helm's DR and the skull!  ";
BodyParts[17]="After the DR of 2 is subtracted, any hit does 4 times basic damage (regardless of weapon type).  Victim is stunned on hits over HT/3, knocking out if over HT/2";
BodyParts[18]="\r\nMore than 2 hits of damage blinds the eye.  An impaling or missile hit (if the missile is under 1 inch across) gives an automatic brain hit, as above; ";
BodyParts[19]="skull's DR does not protect!  If the target is wearing a helm, only a missile or thrusting attack can hit the eye, and the attack is at -10.";
BodyParts[20]="\r\nThe table is designed to distinguish between the arms of a shield carrying man.  If a shield is not present, and neither arm is nearer, ";
BodyParts[21]="the left arm/hand is no hard to hit than the right; roll randomly to determine which arm (or leg) is hit.";
BodyParts[22]="\r\nAny blow to the head or brain, or any crushing blow to the vitals requires the victim to make a roll against HT to avoid knockout.  If the brain or head is the target of a swung hand weapon, ";
BodyParts[23]="or if the vitals are the target of a bullet  or impaling attack, a roll that misses by only 1 gives a hit on the torso.";

function BodyPartsFunction (form)
    {
    ndx = form.Body.options.selectedIndex+1;

    if (ndx <= 1)
		form.Stats.value = BodyParts[ndx]+BodyParts[15]+BodyParts[16]+BodyParts[16]+BodyParts[22]+BodyParts[23];
    else if (ndx == 2)
		form.Stats.value = BodyParts[ndx]+BodyParts[22]+BodyParts[23];
    else if (ndx == 3 || ndx ==  4)
		form.Stats.value = BodyParts[ndx]+BodyParts[18]+BodyParts[19];
    else if (ndx == 5)
		form.Stats.value = BodyParts[ndx]+BodyParts[20]+BodyParts[21];
    else if (ndx == 7 || ndx == 8 || ndx == 10 || ndx == 11)
		form.Stats.value = BodyParts[ndx]+BodyParts[20]+BodyParts[21];
    else if (ndx <= 14)
		form.Stats.value = BodyParts[ndx];
    else {
		Temp1 = 0;
		roll = 0;
		for (ndx = 0; ndx < 3; ndx++) {
			Temp1 = Math.ceil(Math.random() * 6);
			roll += Temp1;
			}

		if (roll <= 4)
			form.Stats.value = roll+": "+BodyParts[1]+BodyParts[15]+BodyParts[16]+BodyParts[17]+BodyParts[22]+BodyParts[23];
		else if (roll == 5)
			form.Stats.value = roll+": "+BodyParts[2]+BodyParts[22]+BodyParts[23];
		else if (roll == 6)
			form.Stats.value = roll+": "+BodyParts[5]+BodyParts[20]+BodyParts[21];
		else if (roll == 8)
			form.Stats.value = roll+": "+BodyParts[8];
		else if (roll >= 9 && roll <= 11)
			form.Stats.value = roll+": "+BodyParts[9];
		else if (roll == 12)
			form.Stats.value = roll+": "+BodyParts[10]+BodyParts[20]+BodyParts[21];
		else if (roll == 13 || roll == 14)
			form.Stats.value = roll+": "+BodyParts[11]+BodyParts[22]+BodyParts[23];
		else if (roll == 15 || roll == 16)
			form.Stats.value = roll+": "+BodyParts[12];
		else if (roll >= 17)
			form.Stats.value = roll+": "+BodyParts[13]+BodyParts[22]+BodyParts[23];
	    }

    }

NPC= new makearray(8);

NPC[1] = "0 or less: Disastrous.\r\n\tGeneral reaction: The NPC hates the characters and will act in their worst interest.  \r\n\tIn a potential combat situation, the NPCs will attack viciously, asking no quarter and giving none.  \r\n\tCommercial transactions are doomed: The merchant will have nothing to do with you.  Make a potential combat roll at -2.  \r\n\tRequests for aid are denied totally.  Make a potential combat roll at -4.  If combat is called for but not possible, the NPC will work against the PCs in any way possible.  \r\n\tRequests for information are met with anger.  Make a potential combat reaction roll, at -2.  \r\n\tLoyalty: The NPC hates you or is in the pay of your enemies, and will take the first good chance to betray you.";

NPC[2] = "1 to 3: Very Bad.  \r\n\tGeneral reaction: The NPC dislikes the characters and will act against them if it's convenient to do so.  \r\n\tIn a potential combat situation, the NPCs attack, and flee only if they see they have no chance. (A fight in progress will continue).  \r\n\tCommercial transactions are next to impossible.  The merchant asks three times the fair price, or offers 1/3 the fair price.  \r\n\tRequests for aid are denied.  Make a potential combat roll; no reaction better than neutral is possible.  \r\n\tRequests for information are met with malicious lies.  \r\n\tLoyalty: The NPC dislikes you, and will leave your service (probably taking everything he can carry) or sell you out as soon as possible.";

NPC[3] = "4 to 6: Bad.  \r\n\tGeneral reaction: The NPC cares nothing for the characters and will act against them if he can profit by doing so.  \r\n\tIn a potential combat situation, the NPCs will attack unless outnumbered.  If they are outnumbered they will flee, possibly to attempt an ambush later. (A fight already in progress will continue).  \r\n\tCommercial transactions go badly.  The merchant asks twice the fair price, or offers half the fair price.  \r\n\tRequests for aid are denied.  The NPCs go about their business, ignoring the player characters.  \r\n\tRequests for information are denied.  NPCs will lie maliciously or demand payment for information.  If paid, the NPC will give true, but incomplete, information.  \r\n\tLoyalty: The NPC has no respect for you.  He will leave or betray you given even moderate temptation, and will be a sluggish worker.";


NPC[4] = "7 to 9: Poor.  \r\n\tGeneral reaction: The NPC is unimpressed.  He may become hostile if there is much profit in it, or little danger.  \r\n\tIn a potential combat situation, the NPCs will shout threats or insults.  They will demand the PCs leave the area. If the PCs stick around, the NPCs will attack unless outnumbered, in which case they will flee. (If a fight is in progress, it will continue).  \r\n\tCommercial transactions are unprofitable.  The merchant asks 120% of the fair price , or offers 75% of the fair price.  \r\n\tRequests for aid are denied, but bribes, pleas, or threats might work.  PCs may roll again, at -2.  \r\n\tRequests for information are unproductive.  The NPCs will claim not to know, or will give incomplete data.  A bribe may improve their memory; roll again if a bribe is offered.  \r\n\tLoyalty: The NPC is unimpressed with you and/or dislikes the job; he thinks he's overworked and underpaid.  He'11 probably betray you if offered enough, and would certainly take a better job if he thought he had one.";

NPC[5] = "10 to 12: Neutral.  \r\n\tGeneral reaction: The NPC ignores the characters as much as possible.  He is totally uninterested.  \r\n\tIn a potential combat situation, the NPCs are inclined to go their own way and let the PCs go theirs. (If a fight is already in progress, the NPCs will try to back off).  \r\n\tCommercial transactions go routinely.  The merchant will buy and sell at fair prices.  \r\n\tRequests for aid are granted - if they are simple.  Complex requests are denied, but the PCs can try again at -2.  \r\n\tRequests for information will be successful.  The NPC will give the information requested if it is simple. If the question is complex, the answer will be sketchy.  \r\n\tLoyalty: The NPC thinks you're just another boss, and this is just another job.  He will work hard enough to keep you happy, but no harder.  He will not leave unless he is sure the new job is better, and will not betray you unless the temptation is very strong.";

NPC[6] = "13 to 15: Good.  \r\n\tGeneral reaction: The NPC likes the characters and will be helpful within reasonable, everyday limits.  \r\n\tIn a potential combat situation, the NPCs find the characters likeable, or else too formidable to attack.  The characters may request aid or information - +1 on a second roll. (If a fight is in progress, the NPCs will flee).  \r\n\tCommercial transactions go pleasantly.  The merchant will buy and sell at fair prices, and will volunteer useful information or small bits of help if possible.  \r\n\tRequests for aid will be granted if the request is reasonable.  The NPCs' attitude is helpful.  Even if the request is silly and must be denied, they will offer helpful advice.  \r\n\tRequests for information will be successful.  The question will be answered accurately.  \r\n\tLoyalty: The NPC likes you and/or the job.  He will be loyal, work hard, and accept any reasonable hazard that you will accept.";

NPC[7] = "16 to 18: Very Good.  \r\n\tGeneral reaction: The NPC thinks highly of the characters and will be quite helpful and friendly.  \r\n\tIn a potential combat situation, the NPCs are friendly.  The PCs may ask for aid or information (+3 on a reaction roll).  Even sworn foes will find an excuse to let the PCs go ... for now. (If a fight has already started, the NPCs will flee if they can, or surrender otherwise).  \r\n\tCommercial transactions will go very well.  The merchant will accept your offer unless you tried to buy below 80% of the fair price or sell above 150% of the fair price.  In that case, he will offer those rates.  He will also offer help and advice.  \r\n\tRequests for aid are granted unless they are totally unreasonable.  Any useful information NPCs have will be volunteered freely.  \r\n\tRequests for information will be successful.  The NPC will answer in detail and volunteer any related information he has.  \r\n\tLoyalty: The NPC will work very hard, and risk his life if need be.  Under most circumstances, he puts your interests ahead of his own.";

NPC[8] = "19 or better:  Excellent.  \r\n\tGeneral reaction: The NPC is extremely impressed by the characters, and will act in their best interests at all times, within the limits of his own ability.  Merchants will offer very good deals.  \r\n\tIn a potential combat situation, the NPCs are extremely friendly.  They may even join the party temporarily.  The PCs may ask for aid or information: +5 on this reaction toll. (If the fight has already started, the NPCs will surrender).  \r\n\tCommercial transactions will go extremely well.  The merchant will accept your offer unless you tried to buy below 50% of fair price or sell above 200% of fair price.  In that case, he will offer those rates.  He will also offer help and advice.  \r\n\tRequests for aid will be granted.  NPCs will help in every way within their power, offering extra aid.  \r\n\tRequests for information will be extremely successful.  The question will be answered completely.  If the NPC doesn't know everything you need, he will exert himself to find out.  He may even offer to help; roll a request for aid (at +2), with no reaction worse than 'poor' possible.  \r\n\tLoyalty: The NPC worships you (or your cause), will work incredibly hard, puts your interests ahead of his own at all times, and would even die for you.";

function NPCFunction ( form ) {

    Temp1 = 0;
    roll = 0;
	modifier = parseInt( form.npcmod.value,10 );

    for (ndx = 0; ndx < 3; ndx++) {
		Temp1 = Math.ceil(Math.random() * 6);
		roll += Temp1;
    }
	roll += modifier;

	ndx = 0 ;

	if ( roll <= 0 )
		ndx = 1;
	else if ( roll >= 1 && roll <= 3)
		ndx = 2
	else if ( roll >= 4 && roll <= 6)
		ndx = 3
	else if ( roll >= 7 && roll <= 9)
		ndx = 4
	else if ( roll >= 10 && roll <= 12)
		ndx = 5
	else if ( roll >= 13 && roll <= 15)
		ndx = 6
	else if ( roll >= 16 && roll <= 18)
		ndx = 7
	else if ( roll >= 19 )
		ndx = 8;

	form.Stats.value = NPC[ndx];
}

Reaction = new makearray(5);

Reaction[1] = "Special Modifiers for Combat Reactions: \r\n+1 to +5 if the party seems notably stronger than the NPC group.  \r\n-1 to -5 if the party seems to be notably weaker than the NPC group.  \r\n-2 if the party has no language in common with the NPC's.  \r\n-2 if the characters are intruders on the NPC's home turf.";
Reaction[2] = "Special Modifiers for Transactions: \r\n-1 for every 10% by which proposed price favors the PC, relative to the fair price.  \r\n+1 for every 10% by which proposed price favors the NPC.  \r\n+1 if the PC has the Merchant skill at any level.  \r\n+2 if the PC has the Merchant skill at expert level, 20 or better.";
Reaction[3] = "Special Modifiers for Request for Aid:  \r\n+1 if the request is very simple.  \r\n-1 to -3 (or more) if the request is very complex or unreasonable.  \r\n-1 if the request would inconvenience the NPC or cost him money.  \r\n-2 or more if the NPC's job or social status would be endangered.  \r\n-1 or more if the request would physically endanger the NPC.  This depends on the degree of the risk and the bravery of the NPC!";
Reaction[4] = "Special Modifiers for information Requests:  \r\n-1 for a complex question or -2 for a very complex question.  \r\n-3 if the NPC thinks it's none of their business!  \r\n-3 or more if an answer would endanger the NPC.  \r\n+ 1 to +3 if a bribe is offered.  To be effective, a bribe must be appropriate in size and discreet.  Not everyone will take a cash payoff.  You don't offer a newspaper reporter a $20 bill - he would be insulted - but buy him a good dinner and he'll appreciate it.  GMs should reward intelligent use of disguised 'bribes.'  \r\n+2 to +4 if the NPC is a librarian, historian, scribe, teacher, etc.  Such people are naturally disposed to help any seeker of knowledge.";
Reaction[5] = "Special Modifiers for Loyalty:  \r\n+ 1 for every 10% the PCs offer above the going pay rate.  \r\n-1 for every 10% the PCs offer below the going pay rate.  \r\n+2 or more if the PCs are serving a cause that the NPC believes in, or a leader to whom the NPC is very loyal.  \r\n+ or - as appropriate for the PCs' reputation in the area (if any).";


function ReactionTypeFunction (form)
    {
    ndx = form.Reaction.options.selectedIndex+1;
    form.Stats.value = Reaction[ndx];
    }

