function AutoPropCtrl(o_textbox ,  oSelopt ,  ostatTextbox ,  obase , o_dataPropCont ) {   this.cur = -1;  this.list_div = null;   this.dataPropCont = o_dataPropCont;   this.textbox = o_textbox; this.selopt = oSelopt; this.width = ostatTextbox.offsetWidth; this.base = obase;   this.init(); }AutoPropCtrl.prototype.autoprop = function (arrayProp , bTypeAhead ) {   if (arrayProp.length > 0) { if (bTypeAhead) { this.typeAhead(arrayProp[0]); }  this.dispProp(arrayProp); } else { this.hideSuggestions(); }};AutoPropCtrl.prototype.createDropDown = function () { var o_this = this;  this.list_div = document.createElement("div"); this.list_div.className = "prop"; this.list_div.style.visibility = "hidden"; this.list_div.style.width = this.width;    this.list_div.onmousedown =  this.list_div.onmouseup =  this.list_div.onmouseover = function (o_event) { o_event = o_event || window.event; o_target = o_event.target || o_event.srcElement; if (o_event.type == "mousedown") { o_this.textbox.value = o_target.firstChild.nodeValue; o_this.hideSuggestions(); } else if (o_event.type == "mouseover") { o_this.highlightSuggestion(o_target); } else { o_this.textbox.focus(); } };   document.body.appendChild(this.list_div);};AutoPropCtrl.prototype.getLeft = function () { var o_node = this.textbox; var iLeft = 0;  while(o_node.tagName != "BODY") { iLeft += o_node.offsetLeft; o_node = o_node.offsetParent;  }  return iLeft;};AutoPropCtrl.prototype.getTop = function () { var o_node = this.textbox; var iTop = 0;  while(o_node.tagName != "BODY") { iTop += o_node.offsetTop; o_node = o_node.offsetParent; }  return iTop;};AutoPropCtrl.prototype.handleKeyDown = function (o_event ) { switch(o_event.keyCode) { case 38:  this.previouProp(); break; case 40:  this.nextProp(); break; case 13:  this.hideSuggestions(); break; }};AutoPropCtrl.prototype.handleKeyUp = function (o_event ) { var key = o_event.keyCode;  if (key == 8 || key == 46) { this.dataPropCont.requestSuggestions(this, false);   } else if (key < 32 || (key >= 33 && key < 46) || (key >= 112 && key <= 123)) {  } else {  this.dataPropCont.requestSuggestions(this, true); }};AutoPropCtrl.prototype.hideSuggestions = function () { this.list_div.style.visibility = "hidden";};AutoPropCtrl.prototype.highlightSuggestion = function (oSuggestionNode) {  for (var i=0; i < this.list_div.childNodes.length; i++) { var o_node = this.list_div.childNodes[i]; if (o_node == oSuggestionNode) { o_node.className = "current" } else if (o_node.className == "current") { o_node.className = ""; } }};AutoPropCtrl.prototype.init = function () {  var o_this = this;   this.textbox.onkeyup = function (o_event) {   if (!o_event) { o_event = window.event; }    o_this.handleKeyUp(o_event); };   this.textbox.onkeydown = function (o_event) {   if (!o_event) { o_event = window.event; }    o_this.handleKeyDown(o_event); };   this.textbox.onblur = function () { o_this.hideSuggestions(); };   this.createDropDown();};AutoPropCtrl.prototype.nextProp = function () { var PropNodes = this.list_div.childNodes; if (PropNodes.length > 0 && this.cur < PropNodes.length-1) { var o_node = PropNodes[++this.cur]; this.highlightSuggestion(o_node); this.textbox.value = o_node.firstChild.nodeValue;  }};AutoPropCtrl.prototype.previouProp = function () { var PropNodes = this.list_div.childNodes; if (PropNodes.length > 0 && this.cur > 0) { var o_node = PropNodes[--this.cur]; this.highlightSuggestion(o_node); this.textbox.value = o_node.firstChild.nodeValue;  }};AutoPropCtrl.prototype.selectRange = function (iStart , length ) {  if (this.textbox.createTextRange) { var o_range = this.textbox.createTextRange();  o_range.moveStart("character", iStart);  o_range.moveEnd("character", length - this.textbox.value.length);  o_range.select();   } else if (this.textbox.setSelectionRange) { this.textbox.setSelectionRange(iStart, length); }   this.textbox.focus(); }; AutoPropCtrl.prototype.dispProp = function (arrayProp ) {  var o_div = null; this.list_div.innerHTML = "";   for (var i=0; i < arrayProp.length; i++) { o_div = document.createElement("div"); o_div.appendChild(document.createTextNode(arrayProp[i])); this.list_div.appendChild(o_div); }  this.list_div.style.left = this.getLeft() + "px"; this.list_div.style.top = (this.getTop()+this.textbox.offsetHeight) + "px"; this.list_div.style.visibility = "visible";};AutoPropCtrl.prototype.typeAhead = function (Prop ) {};
