function TextBox_OnBlur(vsName) {
   var vcus = document.getElementById(vsName + '_vcus');
   
   if (vcus) {
      var s = vcus.attributes['SelectionChanged'].value;
      if ((s != null) && (s != '')) eval(s);
   }
}

function TextBox_SetControlValue(vsName, vsValue) {
   var sIntegraType = '';
   var sFixedID = vsName.split(':').join('_');
   var txt = document.getElementById(sFixedID);

   var txtText = document.getElementById(sFixedID + '_txt');
   var txtSpan = document.getElementById(sFixedID + '_lbl');

   if (txtText != null) {
      sIntegraType = GetAttribute(txtText, 'IntegraType');
   }
   else if (txtSpan != null) {
      sIntegraType = GetAttribute(txtSpan, 'IntegraType');
   }

   if (vsValue == null) vsValue = '';

   // handle formatting
   if (vsValue != '') {
      switch (sIntegraType.toUpperCase()) {
//         case 'CCD':    // CreditCardBox
//         case 'DAT':    // DateBox
//         case 'EML':    // EmailBox

         case 'NUM':    // NumberBox
            var ctl         = (txtText != null) ? txtText : txtSpan;
            var nDec        = parseInt(ctl.attributes['Decimals'].value);
            var bRound      = (ctl.attributes['Round'].value == 'True');
            var bCommas     = (ctl.attributes['ShowCommas'].value == 'True');
            var bCurrency   = (ctl.attributes['ShowCurrency'].value == 'True');
            var sNegDisplay = ctl.attributes['NegDisplay'].value;
            var dNumber     = ValidateNumber(vsValue);
            vsValue         = FormatNumber(dNumber, nDec, sNegDisplay, bCommas, bCurrency);
            break;

//         case 'PHN':    // PhoneBox
//         case 'PWD':    // Password
//         case 'SSN':    // SSNBox
//         case 'TIM':    // TimeBox
//         case 'TXT':    // TextBox
//         case 'ZIP':    // ZipCodeBox

         default:    // not a text box
            return;
      }
   }

   if (txtText != null) txtText.value = vsValue;
   if (txtSpan != null) txtSpan.innerText = vsValue;
}

