var strFOCUS = "none";
var blnDEBUG = false;

function formExt(blnDEBUG) {
  blnDEBUG = blnDEBUG || false;
  // append new properties and functions to each form

  for (var j=0; j<document.forms.length; j++) {
    var theForm = document.forms[j];
    var strGroup = "none";

    // append validatePass property to form
    theForm.validatePass = false;
    // append new properties and functions to each form item
    for (var i=0; i<theForm.length; i++) {
      var theItem = theForm[i];
      var strType = String(theItem.type);
      switch (strType) {
        case "text" :
        case "textarea" :
        case "password" :
        case "file" :
          normalPlugIn(theItem);
          textPlugIn(theItem);
          break;

        // radio, checkbox are all collection type
        case "radio" :
        case "checkbox" :
          if ( (theItem.name != "") && (theItem.name != strGroup) ) {
            strGroup = theItem.name;
            theItem = eval('theForm["' + theItem.name + '"]');
            normalPlugIn(theItem);
            checkboxPlugIn(theItem);
          }
          break;

        case "select-one" :
        case "select-multiple" :
          normalPlugIn(theItem);
          selectPlugIn(theItem);
          break;

        case "hidden" :
          normalPlugIn(theItem);
          theItem.validate = function() {
            this.normalValidate();
          }
          theItem.getValue = function() {
            return this.value;
          }
          theItem.setValue = function(strValue) {
            if (strValue)
              this.value = strValue;
          }
          break;

        case "button" :
          break;
      }
    }

    // append validate Method to form
    theForm.validate = function() {
      var strGroup = "none";

      for (var i=0; i<this.length; i++) {
        var theItem = this[i];
        var strType = String(theItem.type);
        var blnValidatePass = false;

        switch (strType) {
          case "text" :
          case "textarea" :
          case "password" :
          case "select-one" :
          case "select-multiple" :
          case "file" :
            // check if this item had validate() function
            if (theItem.validate) {
              blnValidatePass = theItem.validate();
            }
            else
              blnValidatePass = true;
            break;

          case "radio" :
          case "checkbox" :
            if ( (theItem.name != "") && (theItem.name != strGroup) ) {
              strGroup = theItem.name;
              theItem = eval('this["' + theItem.name + '"]');
              // check if this item had validate() function
              if (theItem.validate) {
                blnValidatePass = theItem.validate();
              }
              else
                blnValidatePass = true;
            }
            else
              blnValidatePass = true;
            break;

          case "hidden" :
          case "button" :
            blnValidatePass = true;
            break;
          default :
            blnValidatePass = true;
            break;
        }
        if (!blnValidatePass)
          break;
      }
      return blnValidatePass;
    }

    // append getItem Method to form
    theForm.getItem = function(strName) {
      var objItem = null;
      for (var i=0; i<this.length; i++) {
        if (this[i].name == strName) {
          objItem = this[i];
          break;
        }
      }
      return objItem;
    }

    theForm._reset = theForm.reset;
    theForm.reset = function() {
       this._reset();
       if (typeof(formInit) == "function") {
        formInit();
      }
    }

    theForm.disabledAll = function() {
      for (var i=0; i<theForm.length; i++) {
        var theItem = theForm[i];
        theItem.disabled = true;
      }
    }
  }

  // if user has defined formInit function, call it
  if (typeof(formInit) == "function") {
    formInit();
  }
}

// appedn general properties, methods and event handlers
function normalPlugIn(theItem) {
  theItem.required = false;        // if required field, default is false
  theItem.compareTo =  new Array();  // compare to which field
  theItem.operator =  new Array();    // OP, == > < >= <=
  theItem.custom = "";            // customized function name
  theItem.dataType = 129;          // data type, default is adChar!}String!~
  theItem.caption = theItem.name;    // field caption, default is the name of this Item
  theItem.events = new Array();

  // append normalValidate Method
  theItem.normalValidate = function() {
    for (var i=0; i<this.compareTo.length; i++) {
      var compareTo = this.compareTo[i];
      var operator = this.operator[i];

      if (this.form.getItem(compareTo) != null) {
        compareTo = this.form.getItem(compareTo);
        var blnPass = eval("this.getValue()" + operator + "compareTo.getValue()");
        if(!blnPass) {
          alert(MSG_COMPARE_ERROR.getMsg(this.caption, operator, compareTo.caption));
          return false;
        }
      }
      else {
        var blnPass = eval("this.getValue()" + operator + compareTo);
        if(!blnPass) {
          alert(MSG_COMPARE_ERROR.getMsg(this.caption, operator, compareTo));
          return false;
        }
      }
    }

    if (this.custom != "") {
      var aryCustom  = this.custom.split(";");
      for (var i=0; i<aryCustom.length; i++) {
        if (eval('typeof(' + aryCustom[i] + ') == "function"'))
          eval(aryCustom[i] + "()");
        else
          alert(MSG_EVENT_UNDEF.getMsg(aryCustom[i]));
      }
    }
      return true;
  }

  theItem.addEvent = function(intEvent,strEvent) {
    var aryEvents = new Array("onafterupdate", "onbeforeupdate", "onblur", "onchange",
                      "onclick", "ondblclick", "onerrorupdate", "onfilterchange",
                      "onfocus", "onhelp", "onkeydown", "onkeypress", "onkeyup",
                      "onmousedown", "onmousemove", "onmouseout", "onmouseover",
                      "onmouseup", "onresize", "onselect");
    if (intEvent || intEvent == 0) {  // if intEvent == 0, JS think it's false
      this.events[intEvent] = this.events[intEvent] || "";
      strEvent = strEvent || "";
      this.events[intEvent] += strEvent + ";";
      // delegate event to this.fireEvents function
      eval("this." + aryEvents[intEvent] + " = function() {this.fireEvents(" + intEvent + ");}");
    }
  }

  theItem.fireEvents = function(intEvent) {
    if (intEvent || intEvent == 0) {
      var strEvent = this.events[intEvent] || "";
      if (strEvent != "") {
        strEvent = strEvent.substring(0, strEvent.length-1);
        var aryEvents = strEvent.split(";");
        for (var i=0; i<aryEvents.length; i++) {
          if (eval('typeof(' + aryEvents[i] + ') == "function"'))
            eval(aryEvents[i] + "()");
          else
            alert(MSG_EVENT_UNDEF.getMsg(aryCustom[i]));
        }
      }
    }
  }

  theItem.setRequire = function(blnRequired) {
    if (blnRequired == true || blnRequired == false)
      this.required = blnRequired;
  }

  theItem.setDataType = function(intDataType) {
    if (intDataType)
      this.dataType = intDataType;
  }

  theItem.setCaption = function(strCaption) {
    if (strCaption)
      this.caption = strCaption;
  }

  theItem.setCompare = function(strOperator, strCompareTo) {
    if (strOperator && strCompareTo) {
      this.operator[this.operator.length] = strOperator;
      this.compareTo[this.compareTo.length] = strCompareTo;
    }
  }

}

// append new functions to text type input Item
function textPlugIn(theItem) {
  theItem.VT = 1;
  theItem.mask = "";        // keyboard mask, allowed key code
  theItem.range = "";        // allowed value range
  theItem.regExp = new Array();  // allowed value Regexp (array[])
  theItem.tips = new Array();  // help tip (array[])

  if(!theItem.maxLength)
    theItem.maxLength = -1;    //AcAOAa|i?iħµ?uao|r|eao??A-1 ai?U??--?i
  if(!theItem.minLength)
    theItem.minLength = -1;    
  if(!theItem.inputLength)
    theItem.inputLength = -1;

  //alert(theItem.name + ": " + typeof theItem.onclick);

  theItem.validate = function() {
    if (typeof this.pureValue == 'string')
      var strTmp = this.getPureValue();
    else
      var strTmp = String(this.value);

    // check if it's required field
    if (this.required) {
      if (strTmp.regExpTest(/^\s+$/) || strTmp == "") {
        // noone focus or focus by itself
        if (strFOCUS == "none" || strFOCUS == this.name) {
          alert(MSG_REQUIRED_ERROR.getMsg(this.caption));
          strFOCUS = this.name;
          this.focus();
        }
        else
          strFOCUS = "none";
        return false;
      }
    }
    if (this.maxLength != -1 && this.value.length > 0) {
         if(this.value.length > this.maxLength) {
            alert(MSG_MAXLENGTH_ERROR.getMsg(this.caption, this.maxLength));
            strFOCUS = this.name;
            this.focus();

            return false;
         }
         else {
            strFOCUS = "none";
         }
      }
    if (this.minLength != -1 && this.value.length > 0) {
         if(this.value.length < this.minLength) {
            alert(MSG_MINLENGTH_ERROR.getMsg(this.caption, this.minLength));
            strFOCUS = this.name;
            this.focus();

            return false;
         }
         else {
            strFOCUS = "none";
         }
      }
    if (this.inputLength != -1 && this.value.length > 0) {
         if(this.value.length != this.inputLength) {
            alert(MSG_INPUTLENGTH_ERROR.getMsg(this.caption, this.inputLength));
            strFOCUS = this.name;
            this.focus();

            return false;
         }
         else {
            strFOCUS = "none";
         }
      }
    if (this.required || this.value != "") {
      // check data type
      var blnPass = true;
      var strMsg = "";

      //alert(this.name + ": " + blnPass);
      switch (this.dataType) {
        case 2 :    //adSmallInt
        case 3 :    //adInteger
        case 4 :    //adSingle
          blnPass = strTmp.regExpTest(/^(\d)*$/);
          strMsg = MSG_NUM_FORMATE_ERROR.getMsg(this.caption);
          break;
        case 5 :    //adDouble
        case 131 :  //adNumeric
          blnPass = strTmp.regExpTest(/^(\d)*(\.){0,1}(\d)*$/);
          strMsg = MSG_FLOAT_FORMATE_ERROR.getMsg(this.caption);
          break;
        case 7 :    //adDate
        case 133 :  //adDBDate
          blnPass = strTmp.regExpTest(/^\d{2,4}\/([1-9]|1[0-2])\/([1-9]|[0-2][1-9]|10|20|3[0-1])$/);
          strMsg = MSG_DATE_FORMATE_ERROR.getMsg(this.caption);
          break;
        case 134 :  //adDBTime
        case 135 :  //adDBTimeStamp
          blnPass = strTmp.regExpTest(/^([1-9]|1[0-2]):[0-5]\d$/);
          strMsg = MSG_TIME_FORMATE_ERROR.getMsg(this.caption);
          break;
        case 301 :  //adSID
        	blnPass = strTmp.regExpTest(/^[a-hj-np-zA-HJ-NP-Z][12]\d{8}$/);
				if( blnPass ) {
				var acc;
				var locationNumber = new Array( 1, 10, 19, 28, 37, 46, 55, 64, 73, 82,
					2, 11, 20, 29, 38, 47, 56, 65, 74, 83, 
					3, 12, 21, 30);
				var locationChar = new Array( 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H','J', 
					'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 
					'U', 'V', 'X', 'Y', 'W', 'Z' );
				for(var i = 0 ; i<26; i++){
					if( strTmp.charAt(0).toUpperCase() == locationChar[i] ){
						acc = locationNumber[i];
						break;
					}
				}
				var d1 = strTmp.charAt(1);
				var d2 = strTmp.charAt(2);
				var d3 = strTmp.charAt(3);
				var d4 = strTmp.charAt(4);
				var d5 = strTmp.charAt(5);
				var d6 = strTmp.charAt(6);
				var d7 = strTmp.charAt(7);
				var d8 = strTmp.charAt(8);
				var d9 = strTmp.charAt(9);
				var checksum = acc+8*d1+7*d2+6*d3+5*d4+4*d5+3*d6+2*d7+1*d8+1*d9;
				var check1 = parseInt(checksum/10);
				var check2 = checksum/10;
				var check3 = (check2-check1)*10;
				if (checksum == check1*10){ 
					;
				} else { 
					if (d9 == (10-check3)) { 
						;
					} else { 
						blnPass = false;
					}
				}
			}
			strMsg = MSG_TW_SID_FORMATE_ERROR.getMsg(this.caption);
			break;
        case 302 :  //adEMail
          blnPass = strTmp.regExpTest(/^[\w-_\.]+@([\w-_]+\.)+([\w-_]+)$/);
          strMsg = MSG_EMAIL_FORMATE_ERROR.getMsg(this.caption);
          break;
        case 303 :  //adTelephone
          blnPass = strTmp.regExpTest(/^([0-9]|\-|\(|\))*$/);
          strMsg = MSG_TELEPHONE_FORMATE_ERROR.getMsg(this.caption);
          break;
        case 304 :  //adHTTPURL
          blnPass = strTmp.regExpTest(/^([hH][tT][tT][pP][sS]?\:\/\/([\w-_]+\.)+([\w-_]+))((\/.*)?)$/);
          strMsg = MSG_HTTP_URL_FORMATE_ERROR.getMsg(this.caption);
          break;
        case 201 :  // adName
          blnPass = strTmp.regExpTest(/^[a-zA-Z_][\w\.]*$/)
                && (!strTmp.regExpTest(/\.\./))
                && (!strTmp.regExpTest(/^\./))
                && (!strTmp.regExpTest(/\.$/));
          strMsg = MSG_NAME_FORMATE_ERROR.getMsg(this.caption);
          break;
        case 401 :  // adNumId
          blnPass = strTmp.regExpTest(/^[0-9a-zA-Z_][\w\.]*$/)
                && (!strTmp.regExpTest(/\.\./))
                && (!strTmp.regExpTest(/^\./))
                && (!strTmp.regExpTest(/\.$/));
          strMsg = MSG_NUM_ID_FORMATE_ERROR.getMsg(this.caption);
          break;
        case 402 :  // adAlphamericDash
          blnPass = strTmp.regExpTest(/^[0-9a-zA-Z\-]*$/);
          strMsg = MSG_ALPHAMERIC_DASH_FORMATE_ERROR.getMsg(this.caption);
          break;
        case 403 :  // adAlphameric
          blnPass = strTmp.regExpTest(/^[0-9a-zA-Z]*$/);
          strMsg = MSG_ALPHAMERIC_FORMATE_ERROR.getMsg(this.caption);
          break;
      }
      if (!blnPass) {
        if (strFOCUS == "none" || strFOCUS == this.name) {
          alert(strMsg);
          strFOCUS = this.name;
          this.focus();
        }
        else
          strFOCUS = "none";
        return false;
      }

      for (var i=0; i<this.regExp.length; i++) {
        if (!strTmp.regExpTest(this.regExp[i])) {
          if (strFOCUS == "none" || strFOCUS == this.name) {
            strTips = this.tips[i] || MSG_REINPUT;
            alert(MSG_INPUT_TIP.getMsg(this.caption, strTips));
            strFOCUS = this.name;
            this.focus();
          }
          else
            strFOCUS = "none";
          return false;
        }
      }

      if (this.range != "") {
        var aryRange = this.range.split(",");
        if(!(this.getValue()>=aryRange[0] && this.getValue()<=aryRange[1])) {
          if (strFOCUS == "none" || strFOCUS == this.name) {
            alert(MSG_RANGE_ERROR.getMsg(this.caption, aryRange[0], aryRange[1]));
            strFOCUS = this.name;
            this.focus();
          }
          else
            strFOCUS = "none";
          return false;
        }
      }
      if (!this.normalValidate()) {
        strFOCUS = this.name;
        this.focus();
        return false;
      }
         else {
            strFOCUS = "none";
         }
    }
    strFOCUS = "none";

    return true;
  }

  theItem.setMaxLength = function(intMaxLength) {
    this.maxLength = intMaxLength;
  }
  theItem.setMinLength = function(intMinLength) {
    this.minLength = intMinLength;
  }
  theItem.setInputLength = function(intInputLength) {
    this.inputLength = intInputLength;
  }

  theItem.inputMask = function() {
    if (!eval(this.mask))
      event.returnValue = false;
  }

  theItem.setRange = function(intMinValue, intMaxValue) {
    this.range = intMinValue + "," + intMaxValue;
  }

  theItem.setMask = function(strMask) {
    this.mask = strMask.replace(/key/ig, "event.keyCode");
    this.onkeypress = this.inputMask;
  }

  theItem.setRegExp = function(objRegExp, strTips) {
    if (objRegExp && strTips) {
      this.regExp[this.regExp.length] = objRegExp;
      this.tips[this.tips.length] = strTips;
    }
  }

  theItem.getValue = function() {
    if (this.dataType==131 || (this.dataType>=2 && this.dataType<=5))
      return parseInt(this.value);
    else
      return this.value;
  }

  theItem.setValue = function(strValue) {
    if (strValue)
      this.value = strValue;
  }
}

function checkboxPlugIn(theItem) {
  theItem.alertMessage = "";
  theItem.setAlertMessage = function(strValue){
  	this.alertMessage = strValue;
  }
  theItem.validate = function() {
    if (this.required) {
      if (!this.length) {  // only one
        if (!this.checked) {
          if(this.alertMessage==''){
            alert(MSG_SELECT_REQUIRED_ERROR.getMsg(this.caption));
          }else{
            alert(this.alertMessage);
          }
          this.focus();
          return false;
        }
      }
      else {
        for (var i=0; i<this.length; i++) {
          var theItem = this[i];
          if (theItem.checked)
            return true;
        }
        if(this.alertMessage==''){
          alert(MSG_SELECT_REQUIRED_ERROR.getMsg(this.caption));
        }else{
          alert(this.alertMessage);
        }
        this[0].focus();
        return false;
      }  
    }
    this.normalValidate();
    return true;
  }

  theItem.selectAll = function() {
    if (!this.length) {  // only one
      this.checked = true;
    }
    else {
      for (var i=0; i<this.length; i++) {
        this[i].checked = true;
      }
    }
  }
  
  theItem.disSelectAll = function() {
    if (!this.length) {  // only one
      this.checked = false;
    }
    else {
      for (var i=0; i<this.length; i++) {
        this[i].checked = false;
      }
    }
  }	

  theItem.getLength = function() {
    if (!this.length) {  // only one
      return 1;
    }
    else {
      return this.length;
    }
  }


  theItem.getValue = function(strSeparator) {
    strSeparator = strSeparator || ";";
    var strValue = "";
    if (!this.length) {  // only one
      if (this.checked)
        strValue += this.value + strSeparator;
    }
    else {
      for (var i=0; i<this.length; i++) {
        var theItem = this[i];
        if (theItem.checked)
          strValue += theItem.value + strSeparator;
      }
    }
    if (strValue!="" && strSeparator!="")
      strValue = strValue.substring(0, strValue.length-1)

    return strValue;
  }

  theItem.setValue = function(strValue, strSeparator) {
    if (strValue && strValue != "") {
      if (!this.length) {  // only one
        if (strValue == this.value ||
            strValue.toLowerCase() == "true" ||
            strValue.toLowerCase() == "on") {

          this.checked = true;
        }
      }
      else {
        strSeparator = strSeparator || ";";
        var aryValue = strValue.split(strSeparator);
        for (var i=0; i<this.length; i++) {
          var theItem = this[i];
          for (var j=0; j<aryValue.length; j++) {
            strValue = aryValue[j];
            if (strValue == theItem.value) {
              theItem.checked = true;
              break;
            }
          }
        }
      }
    }
  }
    theItem.setDisabled = function(boVale) {
      if(this.length){
        for (var i=0; i<this.length; i++) {
          var theItem = this[i];
          theItem.disabled = boVale;
        }
      }else{
      	this.disabled = boVale;
      }
    }


}

function selectPlugIn(theItem) {
  theItem.validate = function() {
    if (this.required) {
      var blnPass = false;
      for (var i=0; i<this.options.length; i++) {
        var theItem = this.options[i];
        if (theItem.selected && theItem.value!="none") {
          blnPass = true;
          break;
        }
      }
      if (!blnPass) {
        alert(MSG_SELECT_REQUIRED_ERROR.getMsg(this.caption));
        this.focus();
        return false;
      }
    }
    this.normalValidate();
    return true;
  }

  theItem.selectAll = function() {
    for (var i=0; i<this.options.length; i++) {
      this.options[i].selected = true;
    }
  }

  theItem.removeAll = function() {
    for (var i=this.options.length-1; i>=0; i--) {
      this.options[i] = null;
    }
  }

  theItem.removeSelected = function() {
    for (var i=this.options.length-1; i>=0; i--) {
      if (this.options[i].selected) {
        this.options[i] = null;
      }
    }
  }

  theItem.isContainsValue = function(value) {
    for (var i=0; i<this.options.length; i++) {
      if (this.options[i].value == value) {
        return true;
      }
    }

    return false;
  }

  theItem.isContainsText = function(text) {
    for (var i=0; i<this.options.length; i++) {
      if (this.options[i].text == text) {
        return true;
      }
    }

    return false;
  }

  theItem.getValue = function(strSeparator) {
    strSeparator = strSeparator || ";";
    var strValue = "";
    for (var i=0; i<this.options.length; i++) {
      var theItem = this.options[i];
      if (theItem.selected)
        strValue += theItem.value + strSeparator;
    }
    if (strValue!="" && strSeparator!="")
      strValue = strValue.substring(0, strValue.length-1);

    return strValue;
  }

  theItem.setValue = function(strValue, strSeparator) {
    if (strValue && strValue != "") {
      strSeparator = strSeparator || ";";
      var aryValue = strValue.split(strSeparator);
      for (var i=0; i<this.options.length; i++) {
        var theItem = this.options[i];
        for (var j=0; j<aryValue.length; j++) {
          strValue = aryValue[j];
          //alert(j);
          if (strValue == theItem.value) {
            theItem.selected = true;
            break;
          }
        }
      }
    }
  }
}

// if using dhtmllib2.js at the same page, window.onload = setup; -> then call formExt
if (typeof(setup) != "function") {
  window.onload = formExt;
}	

// helper functions
function getMsg() {
  var msg = this.toString();

  for (var i=0; i<arguments.length; i++) {
    var key = "\\{" + i + "\\}";
    var value = arguments[i].toString();
    var regExp = new RegExp(key, "ig");
    msg = msg.replace(regExp, value);
  }

  return msg;
}
String.prototype.getMsg = getMsg;

function regExpTest(objRegExp) {
  var strTest = this.toString();
  return objRegExp.test(strTest);
}
String.prototype.regExpTest = regExpTest;

function getTextFromHTML(strHTML) {
  if (strHTML != "" && strHTML + "" != 'null') {
    strHTML = strHTML.replace(/<br>/g, "\n");
    strHTML = strHTML.replace(/&nbsp;&nbsp;&nbsp;/g, '\t');
    strHTML = strHTML.replace(/&nbsp;/g, ' ');
    return strHTML;
  }
  else
    return "";
}

function setCookie(name, value, expire) {
  document.cookie = name + "=" + escape(value)
  + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()));
}

function getCookie(name) {
  var strSearch = name + "=";
  if (document.cookie.length > 0) {
    var offset = document.cookie.indexOf(strSearch);
    if (offset != -1) {
      offset += strSearch.length;
      var end = document.cookie.indexOf(";", offset);
      if (end == -1)
        end = document.cookie.length;
      return unescape(document.cookie.substring(offset, end));
    }
  }
  return "";
}

function isIE55up() {
    var agt = navigator.userAgent.toLowerCase();

    // *** BROWSER VERSION ***
    // Note: On IE5, these return 4, so use isIE5up to detect IE5.
    var majorVer = parseInt(navigator.appVersion);
    var minorVer = parseFloat(navigator.appVersion);

    var isIE     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    var isIE55   = (isIE && (majorVer == 4) && (agt.indexOf("msie 5.5") !=-1));
    var isIE6    = (isIE && (majorVer == 4) && (agt.indexOf("msie 6.")!=-1) );

    return (isIE55 || isIE6);
}
/*
function isTableColumnsAllNull(){
 
	var rowLength=arguments[0].length;

	if(rowLength){
		
		for(var i = 0 ; i < rowLength; i++){

			var args = new Array();
			for(var j = 0; j < arguments.length; j++) {

			  args[args.length] = arguments[j][i];
			}
			if (!isRowColumnsAllNull(args)){
				return false;
			}
		}
		return true;
	}
	else{
		return isRowColumnsAllNull(arguments);
	}
}
*/

function isRowColumnsAllNull() {
	  
	  
		for(var i = 0; i < arguments.length; i++) {
			if(!arguments[i].value.regExpTest(/^\s+$/) && arguments[i].value != ""){
					return false;
			}	
		}
		return true;
	
}


// CONSTANTS
var strComma = String.fromCharCode(184);
var strCR = String.fromCharCode(182);

// EVENTS CONSTANTS
var intAfterupdate = 0;
var intBeforeupdate = 1;
var intBlur = 2;
var intChange = 3;
var intClick = 4;
var intDblclick = 5;
var intErrorupdate = 6;
var intFilterchange = 7;
var intFocus = 8;
var intHelp = 9;
var intKeydown = 10;
var intKeypress = 11;
var intKeyup = 12;
var intMousedown = 13;
var intMousemove = 14;
var intMouseout = 15;
var intMouseover = 16;
var intMouseup = 17;
var intResize = 18;
var intSelect = 19;

// DATA TYPE CONSTANTS
var adSmallInt = 2;
var adInteger = 3;
var adSingle = 4;
var adDouble = 5;
var adNumeric = 131;
var adBoolean = 11;
var adDate = 7;
var adDBDate = 133;
var adDBTime = 134;
var adDBTimeStamp = 135;
var adChar = 129;
var adVarChar = 200;
var adName = 201;

var adSID = 301;
var adEMail = 302;
var adTelephone = 303;
var adHTTPURL = 304;
var adNumId = 401;
var adAlphamericDash = 402;
var adAlphameric = 403;
