
/* - generatePassword.js - */
// http://www.bedriftonline.com/portal_javascripts/generatePassword.js?original=1
function GeneratePassword(){if(parseInt(navigator.appVersion)<=3){alert("Sorry this only works in 4.0+ browsers");return true}
var length=8;var sPassword="";length=document.aForm.charLen.options[document.aForm.charLen.selectedIndex].value;var noPunction=(document.aForm.punc.checked);var randomLength=(document.aForm.rLen.checked);if(randomLength){length=Math.random();length=parseInt(length * 100);length=(length%7)+6}
for(i=0;i<length;i++){numI=getRandomNum();if(noPunction){while(checkPunc(numI)){numI=getRandomNum()}}
sPassword=sPassword+String.fromCharCode(numI)}
document.aForm.passField.value=sPassword
return true}
function getRandomNum(){var rndNum=Math.random()
rndNum=parseInt(rndNum * 1000);rndNum=(rndNum%94)+33;return rndNum}
function checkPunc(num){if((num>=33)&&(num<=47)){return true}
if((num>=58)&&(num<=64)){return true}
if((num>=91)&&(num<=96)){return true}
if((num>=123)&&(num<=126)){return true}
return false}

