/* originally I downloaded this function of the net, but in order 
to make it work with my pages the entire thing was recoded except 
for the line right after the crediting comment below.*/
function RollEm() {
var iTotal = 0;
var iResult = 0;
var sResult = "";
NumDice = document.DieRoller.NumDice.value;
TypeDie = document.DieRoller.TypeDice.value;
for (loop=0; loop < NumDice; loop++) {
// random number fix by George Johnston (cali_scripter@yahoo.com)
iResult = Math.round(Math.random() * TypeDie) % TypeDie + 1;
sResult = sResult + "+" + iResult;
iTotal = iTotal + iResult;
}
sResult = sResult.replace(/^[+]/g, '') ;
document.DieRoller.Result.value = sResult + "=" + iTotal;
}

