
function validateASCII(form) {
    var bValid = true;
    var focusField = null;
    var i = 0;
    var fields = new Array();
    var formName = form.getAttributeNode("name");

    oascii = eval('new ' + formName.value + '_AsciiValidations()');
    for (x in oascii) { //--2003.01.20
        if ((form[oascii[x][0]].type == 'text' ||
             form[oascii[x][0]].type == 'textarea') &&
            !(isASCII(form[oascii[x][0]].value))) {
            if (i == 0) {
                focusField = form[oascii[x][0]];
            }
            fields[i++] = oascii[x][1];
            bValid = false;
        }
    }
    if (fields.length > 0) {
       focusField.focus();
       alert(fields.join('\n'));
    }
    return bValid;
}

function isASCII(value) {
	for (i = 0; i < value.length; i++) {
		if (!isAsciiCharacter(value.charCodeAt(i)))
			return false;
	}
	return true;
}

function isAsciiCharacter(val) {
	var ival = val;
	if ((ival >= 0x0020 && ival <= 0x007f)) {
		return true;
	}
	return false;
}


