function getRandomNum(lbound, ubound) {
	return (Math.floor(Math.random() * (ubound - lbound)) + lbound);
}

function getRandomChar() {
    var numberChars = "0123456789";
    var lowerChars = "abcdefghijklmnopqrstuvwxyz";
    var upperChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    charSet += numberChars;
    charSet += lowerChars;
    charSet += upperChars;
    return charSet.charAt(getRandomNum(0, charSet.length));
}

function generate_password() {
	document.getElementById('generate_password').type = "text";
	
	length = 8;

    var rc = "";
    if(length > 0) {
    	rc = rc + getRandomChar();
    }

    for(var idx = 1; idx < length; ++idx) {
        rc = rc + getRandomChar();
    }

	
    document.getElementById('generate_password').value = rc;
}
