<!---//
// To validate if the current credit exceeds the customer's credit limit or account
// being on hold (Wilson F. 02/22/99)

function validAccount(total) {
	var validinfo = true;
	var newtotal = :currentused + total;
	var creditlimit = :creditlimit;
	var onhold = :onhold;
	var custonaccount = <iSTRLWR SRC=":custOnAccount">;
	var globalonaccount = <iSTRLWR SRC=":globalOnAccount">;
	
	if (custonaccount && globalonaccount) {
		if (document.apply.onaccount.checked) {
			var username = prompt("Please enter your account username:\n(it is case-sensitive)","");
			var password = prompt("Please enter your account password:\n(it is case-sensitive)","");
			if ((username == ':dbusername') && (password == ':dbpassword')) {
				if (newtotal > creditlimit) validinfo = false;
				if (onhold) validinfo = false;
			 	if (validinfo) {
					return true;
			  	} else {
					var errMsg = ':errmessage';
					alert(errMsg);
					return false;
  				}
			} else {
				alert('Incorrect username or password');
				return false;
			}
   		} else {
			return true;
		}
	} else {
		return true;
	}
}
//-->