function showCredential(invNum) {
	if (!invNum) invNum = 0;
	label = null;
	invUser = $F('inv');
	if (invUser.length) {
		re = /[^0-9]/;
		invUserTrim = invUser.replace(/^\s*|\s*$/g,"");
		if (invUserTrim.match(re) || (invUser.length > 10)) {
			alert('Incorrect value for Invoice Number.  Please try again.');
			Field.activate('inv');
		} else {
			if ((parseInt(invUser) > parseInt(invNum)) || 
                (parseInt(invUser) < 1000)) { //modern style
				if ($F('invPassword')=='NULL') $('invPassword').value = '';
				Element.show('invPassword');
				displayGroup('invExpiration', 'hide');		
				label = 'Invoice Password:';
			} else if (invUser) { // deprecated auth style
				Element.hide('invPassword');
				displayGroup('invExpiration', 'show');		
				label = 'Expiration Date:';
				$('invPassword').value = 'NULL';
			}
			if (label) Element.update('credentialLabel', '<span style="color: #ff0000">*</span><b>' + label + '</b>');
		}
    }
}

function displayGroup(className, state) {
		nodes = document.getElementsByClassName(className);
		for (i=0; i < nodes.length; i++) {
			if (state == 'hide') {
				Element.hide(nodes[i]);
			} else {
				Element.show(nodes[i]);
			}
		}
}
