// JScript File
ICombo.id = 0;
ICombo.buttonHeight = 20;
ICombo.buttonWidth = 17;
ICombo.comboOpen = null;
ICombo.documentHook = null;

function ICombo(id)
{
    if (id == undefined)
        return this; // This is so the new function can be used to subclass the ICombo2 Object
        
    if (getElement(id))
    {
        this.usingDiv = arguments[3];
		
		var holderId = '$CBX$'+ICombo.id++;
		this.Id = holderId;
        this.comboType = 1;
        if (ICombo.ComboMap[holderId])
		{
			alert('C100: Select element (id='+id+') already replaced');
			return ICombo.ComboMap[holderId];
		}
		this.forceUpper = false;
        this.dropped = false;
		this.dynamicDrop = false;
		this.editListItem = null;
		
        this.replaced = getElement(id);
		if (this.replaced.tagName != 'SELECT')
		{
			alert('C000: Only SELECT elements can by replaced (id='+this.replaced.id+')');
			return this;
		}
        this.holder = document.createElement('span');
        this.usingClass = 'iwCombo';
        this.holder.className = this.usingClass+' iwComboCool';

		var replacedWidth = getElementWidth(this.replaced)<1?154:getElementWidth(this.replaced);
        this.holder.id = holderId;
        this.holder.style.width = parseInt(replacedWidth-4) +'px';
        this.holder.style.margin='0px 0px 0px 0px';
        this.holder.style.marginLeft='0px';
        this.holder.style.marginRight='0px';
        
        ICombo.ComboMap[this.holder.id] = this;
        
        this.input = this.usingDiv?document.createElement('div'):document.createElement('input');
        this.input.id = '$CBXI$'+id;
        this.input.name = '$CBXN$'+this.replaced.name;
        if (this.usingDiv)
        {
            this.input.className = "iwComboInputDiv";
        }
        else
        {
            this.input.type="text";
            this.input.className = "iwComboInput";
        }
        this.input.tabIndex = this.replaced.tabIndex;
        this.replaced.tabIndex = 500+this.input.tabIndex;
        this.input.style.width = parseInt(replacedWidth-(ICombo.buttonWidth+3)) + 'px';
        this.input.style.margin='0px 0px 0px 0px';
        this.input.style.marginLeft='0px';
        this.input.style.marginRight='0px';
        this.input.style.border='none 0px transparent';
        
        // Humm what other attributes do we need to copy ?
        this.input.style.fontSize = this.replaced.style.fontSize;
        
        this.input.onpropertychange = new Function("ICombo.InputInitialise('"+this.holder.id+"');");
         
		if (arguments[1])
		{
			 this.input.readOnly=true;
		}                
        this.img = document.createElement('span');
        this.img.className = 'iwComboClicker';
        this.img.style.margin='0px 0px 0px 0px';
        
        this.ul = document.createElement('ul');
        this.ul.className = "comboList";
        this.ul.style.width = (replacedWidth-2)+'px';
        
        this.img.onmouseover = new Function("ICombo.MouseOver('"+this.holder.id+"');");
        this.img.onmouseout = new Function("ICombo.MouseOut('"+this.holder.id+"');");
        this.img.onclick = new Function("ICombo.ShowComboList('"+this.holder.id+"');");
        this.input.onclick = new Function("ICombo.InputClickList('"+this.holder.id+"');");
        this.input.onkeyup = ICombo.KeyPressType1;
        this.input.onchange = ICombo.OnChange;
        
        if (isIE7())
        {
            this.img.style.top = '-1px';
            this.img.style.paddingLeft = '1px';
            this.holder.style.paddingRight = '1px';
            this.holder.style.paddingLeft = '1px';
	        if (getElementHeight(this.replaced) < 4)
		        this.input.style.top='-4px';
	        else
		        this.input.style.top='-2px';
        }
        else if (isIE())
        {
            this.img.style.top = '0px';
            this.img.style.paddingLeft = '1px';
            this.holder.style.paddingRight = '1px';
            this.holder.style.paddingLeft = '1px';
	        if (getElementHeight(this.replaced) < 4)
		        this.input.style.top='-3px';
	        else
	            this.input.style.top='-1px';
        }
        else
        {
            this.img.style.top = '4px';
            this.img.style.paddingLeft = '1px';
            this.holder.style.paddingTop = '1px';
            this.holder.style.paddingLeft = '1px';
            this.holder.style.paddingRight = '1px';
        }
        if (getElementHeight(this.replaced) < 4)
        {
			this.input.style.height = this.replaced.currentStyle.height;
        }
        else
			this.input.style.height = (getElementHeight(this.replaced)-4) +'px';
                
        this.selectedIndex = 0;

		this._fillDropDown(true);
        
        this.holder.appendChild(this.input);
        this.holder.appendChild(this.img);
        
        this.replaced.style.display = 'none';
        this.replaced.style.visibility='hidden';
        this.replaced.parentNode.insertBefore(this.holder,this.replaced);    
        this.replaced.style.position='absolute';
        this.replaced.style.top = '-1000px';
        this.replaced.style.left = '-1000px';
        
        this.lastMatch = -1;
        this.lastKey = 0;
        
        document.body.insertBefore(this.ul,document.body.firstChild);
        
    }
    else
        alert("C008:Unable to find select element '"+id+"' for sub classing");
	return this;
}


function ICombo2(id)
{
    if (getElement(id))
    {
		var holderId = '$CBXI$'+id;
		this.Id = holderId;
        this.comboType = 2;
        if (ICombo.ComboMap[holderId])
		{
			alert('C100: Select element (id='+id+') already replaced');
			return ICombo.ComboMap[holderId];
		}
		this.forceUpper = false;
        this.dropped = false;
		this.dynamicDrop = false;
		this.editListItem = null;
		
        this.replaced = getElement(id);        
		if (this.replaced.tagName != 'SELECT')
		{
			alert('C000: Only SELECT elements can by replaced (id='+this.replaced.id+')');
			return this;
		}
		
        ICombo.ComboMap[holderId] = this;
        
        this.input = document.createElement('input');
        this.input.id = holderId;
        this.input.name = '$CBXN$'+this.replaced.name;
        this.input.type="text";
        this.input.className = "iwComboDropInput";
        this.input.tabIndex = this.replaced.tabIndex;
        
        // Humm what other attributes do we need to copy ?
        this.input.style.fontSize = this.replaced.style.fontSize;
        
        this.replaced.tabIndex = 500+this.input.tabIndex;
        this.input.style.margin='0px 0px 0px 0px';
        
        this.input.onpropertychange = new Function("ICombo.InputInitialise('"+holderId+"');");
         
		if (arguments[1])
		{
			 this.input.readOnly=true;
		}                
        this.img = document.createElement('span');
        if (AltimisApplication && AltimisApplication.IsThemed)
        {
			this.hotClass = 'iwComboDropThmdHot';
			this.coolClass = 'iwComboDropThmdNorm';
		}
		else
		{
			this.hotClass = 'iwComboDropHot';
			this.coolClass = 'iwComboDropNorm';
		}
        this.img.className = 'iwComboClicker iwComboDropClick iwComboDropNorm '+this.coolClass;
        this.img.style.margin='0px 0px 0px 0px';
        
        this.ul = document.createElement('ul');
        this.ul.className = "comboList";
        this.ul.style.width = (getElementWidth(this.replaced)-2)+'px';
        
        this.img.onmouseover = new Function("ICombo.MouseOver('"+holderId+"');");
        this.img.onmouseout = new Function("ICombo.MouseOut('"+holderId+"');");
        this.img.onclick = new Function("ICombo.ShowComboList('"+holderId+"');");
        this.input.onclick = new Function("ICombo.InputClickList('"+holderId+"');");
        this.input.onkeyup = ICombo.KeyPressType2;
        this.input.onchange = ICombo.OnChange;
        
        if (isIE7())
        {
            this.img.style.top = '1px';
            this.input.style.width = parseInt(getElementWidth(this.replaced)-(ICombo.buttonWidth+5)) + 'px';
//            if (AltimisApplication && AltimisApplication.IsThemed)
//	            this.img.style.height = '18px'; // Humm ??? only want this if themed
//            else if (AltimisApplication)
//            {
//	            this.img.style.height = '18px'; // Humm ??? only want this if themed
//				this.img.style.borderTop = 'solid 1px ThreeDShadow';
//				this.img.style.borderRight = 'solid 1px ThreeDHighlight';
//				this.img.style.borderBottom = 'solid 1px ThreeDHighlight';
//			}
        }
        else if (isIE())
        {
            this.img.style.top = '1px';
            this.img.style.left = '-1px';
            if (AltimisApplication && AltimisApplication.IsThemed)
	            this.img.style.height = '18px'; // Humm ??? only want this if themed
            else if (AltimisApplication)
            {
	            this.img.style.height = '20px'; // Humm ??? only want this if themed
				this.img.style.borderTop = 'solid 1px ThreeDShadow';
				this.img.style.borderRight = 'solid 1px ThreeDHighlight';
				this.img.style.borderBottom = 'solid 1px ThreeDHighlight';
            }
            this.input.style.width = parseInt(getElementWidth(this.replaced)-(ICombo.buttonWidth+5)) + 'px';
        }
        else
        {
            this.input.style.width = parseInt(getElementWidth(this.replaced)-(ICombo.buttonWidth+3)) + 'px';
        }
                
        this.selectedIndex = 0;

		this._fillDropDown(true);
        
        this.replaced.style.display = 'none';
        this.replaced.style.visibility='hidden';
        
        this.replaced.parentNode.insertBefore(this.img,this.replaced);    
        this.replaced.parentNode.insertBefore(this.input,this.img);    
        this.holder = this.input;
                        
        this.replaced.style.position='absolute';
        this.replaced.style.top = '-1000px';
        this.replaced.style.left = '-1000px';
        
        this.lastMatch = -1;
        this.lastKey = 0;
        
        document.body.insertBefore(this.ul,document.body.firstChild);
        
    }
    else
        alert("C008:Unable to find select element '"+id+"' for sub classing");
        
    return this;
}

ICombo2.prototype = new ICombo();
ICombo2.prototype.constructor = ICombo2;

ICombo.ComboMap = new Array();

ICombo.DocumentClick = function()
{
    if (ICombo.comboOpen)
    {
       var ico = ICombo.comboOpen;
       ICombo.comboOpen = null;
       ico._hideComboList();
       ico.focus();
    }
    if (ICombo.documentHook)
    {
        try {
            eval(ICombo.documentHook());
        } catch (e)
        {
        }
    }    
}

ICombo.HookDocument = function(combo)
{
	if (ICombo.documentHook == null)
	{
		ICombo.documentHook = document.onclick;
		document.onclick = new Function("ICombo.DocumentClick();");
	}
}

ICombo.UnHookDocument = function(combo)
{
	document.onclick = ICombo.documentHook;
	ICombo.documentHook = null;
}

ICombo.Subclass = function()
{
    try {
    var s = document.getElementsByTagName("SELECT");
    for (i=0;i<s.length;s++)
    {
        alert('Subclass one');
        if (!ICombo.ComboMap[s[i].id])
        {
            new ICombo(s[i].id);
        }
    }
    } catch (ex) {
        alert('C001:'+(ex.description?ex.description:ex)); 
    }    
}

ICombo.KeyPressType1 = function(e)
{
    try {
        var evt = getEvent(e);
        var keyCode = evt.keyCode; //isIE() ? event.keyCode : e.keyCode;  
        var altKey = evt.altKey; // isIE() ? event.altKey : e.altKey;  
        var id = getEventElement(e).parentNode.id;
        if (ICombo.ComboMap[id])
        {
            if (!ICombo.ComboMap[id]._keypress(keyCode,altKey))
            {
                evt.cancelBubble = true;
                evt.returnValue = false;
            }
            ICombo.ComboMap[id].fireEvent('onkeyup',evt);
        }
  }
  catch (ex) {
    alert('C114:'+(ex.description?ex.description:ex)); 
  }
}
ICombo.KeyPressType2 = function(e)
{
    try {
        var evt = getEvent(e);
        var keyCode = evt.keyCode; //isIE() ? event.keyCode : e.keyCode;  
        var altKey = evt.altKey; // isIE() ? event.altKey : e.altKey;  
        var id = getEventElement(e).id;
        if (ICombo.ComboMap[id])
        {
            if (!ICombo.ComboMap[id]._keypress(keyCode,altKey))
            {
                evt.cancelBubble = true;
                evt.returnValue = false;
            }
            ICombo.ComboMap[id].fireEvent('onkeyup',evt);
        }
  }
  catch (ex) {
    alert('C214:'+(ex.description?ex.description:ex)); 
  }
}
ICombo.OnChange = function(e)
{
    var evt = getEvent(e);
    var keyCode = evt.keyCode;  
    if (this.comboType == 2)
        id = getEventElement(e).id;
    else
        id = getEventElement(e).parentNode.id;  
    if (ICombo.ComboMap[id])
    {
        ICombo.ComboMap[id].fireEvent('onchange',evt);
    }
}
ICombo.InputInitialise = function(id)
{
    if (isIE() && ICombo.ComboMap[id])
        ICombo.ComboMap[id]._inputinitialise();
}
ICombo.MouseOver = function(id)
{
    if (ICombo.ComboMap[id])
        ICombo.ComboMap[id]._mouseover();
}
ICombo.MouseOut = function(id)
{
    if (ICombo.ComboMap[id])
    {
        ICombo.ComboMap[id]._mouseout();
        if (ICombo.comboOpen)
			ICombo.HookDocument(ICombo.comboOpen)
    }
}
ICombo.ClickComboList = function(id,sel)
{
    if (ICombo.ComboMap[id])
        ICombo.ComboMap[id]._clickComboList(sel);
}
ICombo.ShowComboList = function(id)
{
    if (ICombo.ComboMap[id])
    {
        ICombo.ComboMap[id]._showComboList();
    }
}
ICombo.InputClickList = function(id)
{
    if (ICombo.ComboMap[id])
        ICombo.ComboMap[id]._inputClickList();
}

ICombo.prototype.setDynamic = function()
{
	this.dynamicDrop = true;
	return this;
}

ICombo.prototype._clearDropDown = function()
{
	while (this.ul.firstChild)
		this.ul.removeChild(this.ul.firstChild);
}

ICombo.prototype._fillDropDown = function(init)
{
    // collect our object's <option>s
    var opts = this.replaced.options;

    // iterate through them, creating <li>s from each
    var i = 0;
    this.options = this.replaced.options;
    if (this.dynamicDrop && !this.input.readOnly)
    {
		var li = document.createElement('li');
		li.className = 'comboHidden';
		var txt = document.createTextNode("");
		li.appendChild(txt);
		this.editListItem = txt;
		this.ul.appendChild(li);
		this.editSelection = 0;        
    }
	for (i=0; opts.length && i<opts.length; i++) {
		// create the <li>
		var li = document.createElement('li');
		li.onclick = new Function("ICombo.ClickComboList('"+this.Id+"',"+i+");");
		if (opts[i].selected)
		{
		var html = opts[i].innerText.replace(/{/g,'<').replace(/}/g,'>');
		
		 // get the <option>'s text
		 this.input.value = html;
		 try {
         this.input.innerHTML = html;
         } catch (e) { }
         
		 li.className = 'selected';
		 this.selectedIndex = i;
		}
		var a = document.createElement('a');
		a.onclick = new Function('return false;'); // Stop clicks ??
		a.href = "http://Click To Select";
		var txt = document.createTextNode('<b>Hello</b>');
		var html = opts[i].innerText.replace(/{/g,'<').replace(/}/g,'>');
		// append the text to the <li>
		a.innerHTML = html; // appendChild(txt);
		li.appendChild(a);
		// append the <li> to the <ul>
		this.ul.appendChild(li);
	}
	if (!this.input.readOnly && !this.dynamicDrop)
	{
		if (this.editListItem == null)
		{
			var li = document.createElement('li');
			li.className = 'comboHidden';
			var txt = document.createTextNode("");
			li.appendChild(txt);
			this.editListItem = txt;
		}
		else
			li = this.editListItem.parentNode;
		this.ul.appendChild(li);
		this.editSelection = i;        
	}
	if (!this.input.readOnly && !this.dynamicDrop)
		this.replaced.appendChild(document.createElement('option'));

}

ICombo.prototype.focus = function()
{
	this.input.focus();
	return this;
}

ICombo.prototype.setUpperCase = function()
{
	this.forceUpper = true;
	this.input.style.textTransform = 'uppercase';
	return this;
}

ICombo.prototype.setHeight = function()
{
	// Not yet implemented
	return this;
}

ICombo.prototype._inputinitialise = function()
{
	if (window.event.propertyName=='linkedChanged')
	{
		this._clearDropDown();
		this._fillDropDown();
	}
}


ICombo.prototype._mouseover = function()
{
    if (this.comboType == 2)
    {
        removeClassName(this.img,this.coolClass);
        addClassName(this.img,this.hotClass);
    }
    else
       this.holder.className=this.usingClass+' iwComboHot';
}

ICombo.prototype._mouseout = function()
{
    if (!this.dropped)
    {
        if (this.comboType==2)
        {
            removeClassName(this.img,this.hotClass);
            addClassName(this.img,this.coolClass);
        }
        else
            this.holder.className=this.usingClass+' iwComboCool';
    }
}

ICombo.prototype._inputClickList = function () {
	if (this.input.readOnly)
		this._showComboList();
	else
		this._hideComboList();
}

ICombo.prototype._hideComboList = function () {
	ICombo.UnHookDocument();
    if (ICombo.comboOpen)
    {
       var ico = ICombo.comboOpen;
       ICombo.comboOpen = null;
       ico._hideComboList();
    }
    if (this.dropped)
    {
        if (this.comboType==2)
        {
            removeClassName(this.img,this.hotClass);
            addClassName(this.img,this.coolClass);
        }
        else
            this.holder.className=this.usingClass+' iwComboCool';
        this.ul.style.display = 'none';
        this.dropped = false;
        ICombo.comboOpen = null;
    }
}

ICombo.prototype._showComboList = function () {
    if (ICombo.comboOpen && ICombo.comboOpen != this)
    {
        var ico = ICombo.comboOpen;
       ICombo.comboOpen = null;
       ico._hideComboList();
    }
    if (this.dropped)
    {
		this._hideComboList();
        this.input.focus();
    }
    else
    {
		if (this.dynamicDrop)
		{
			this._clearDropDown();
			this._fillDropDown();
		}
        try { this.ul.style.top = (parseInt(getElementBottom(this.holder))) + 'px'; } 
        catch(ex) { alert('C006:'+(ex.description?ex.description:ex)); }
        try { this.ul.style.left = parseInt(getElementLeft(this.holder)) + 'px'; } 
        catch(ex) { alert('C007:'+(ex.description?ex.description:ex)); }
        this.ul.style.position='absolute';
        this.ul.style.display = 'block';
        this.dropped = true;
        ICombo.comboOpen = this;
        if (getElementBottom(this.ul) > getInsideWindowHeight())
        {
            this.ul.style.overflow='scroll';
			try
			{
	            this.ul.style.height = (getInsideWindowHeight()-getElementTop(this.ul)-16)+'px';
			}
			catch (e)
			{
			}
        }
        else
        {
        }
		if (this.input.readOnly)
			this.input.focus();
	    }
}

ICombo.prototype.dispatchEvent = function (evt) {
    this.fireEvent('',evt);
}

ICombo.prototype.fireEvent = function (name,evt) {
    try {
          if (this.replaced.dispatchEvent)
          {
//            alert('Create '+evt.type+', '+evt.detail+', '+evt.keyCode+', '+window.KeyEvent);
            if (window.KeyEvent)
            {
              ev = document.createEvent('KeyEvents');
              ev.initKeyEvent(evt.type,true,true,window,evt.ctrlKey,evt.altKey,evt.shiftKey,evt.metaKey,evt.keyCode,evt.charCode);
            }
            else
            {
              ev = document.createEvent('UIEvents');
              ev.initUIEvent(evt.type,true,true,window,1);
            }
            this.replaced.dispatchEvent(ev);
          }
          else if (this.replaced.fireEvent)
          {
              this.replaced.fireEvent(name,evt);
          }
      } catch (ex)
      {
          alert("C009:Failed to bubble Event : "+ex.description?ex.description:ex); 
      }
}

ICombo.prototype._clickComboList = function (sel) {
    this._hideComboList();
    this.replaced.selectedIndex = sel;
    this.selectedIndex = sel;
//    alert('Sel='+sel+', '+this.]ions[sel].text);
	var html = this.replaced.options[sel].innerText.replace(/{/g,'<').replace(/}/g,'>');
//    this.input.value = unescape(this.replaced.options[sel].text);
    this.input.value = unescape(html);
	 try {
     this.input.innerHTML = html;
     } catch (e) { }
    if (document.createEvent)
    {
        evt = document.createEvent('Events');
        evt.initEvent('change',true,true);
        this.replaced.dispatchEvent(evt);
    }
    else
    {
        evt = document.createEventObject();
        evt.type = 'onchange';
        evt.cancelBubble = true;
        this.fireEvent(evt.type,evt);
    }
}

ICombo.prototype._matchInput = function (value) {
    if (value && value.length > 0)
    {
        try {
            for (i = 0; i < this.replaced.options.length; i++)
            {
            
                if (i != this.editSelection && this.replaced.options[i].text.substring(0,value.length) == value)
                {
                    return i;
                }
            }
        } catch (ex) 
        { 
            alert('C002:'+(ex.description?ex.description:ex)); 
        }
    }
    return -1;
}

ICombo.prototype._keypress = function (keyCode,altKey) {
    // 8 = backspace
    // 46 = Delete
    // 35 = end
    // 36 = home
    // 37 = cursor left
    // 39 = cursor right
    if ((keyCode < 32 || keyCode == 35 || keyCode == 36 ||
         keyCode == 37 || keyCode == 39) && keyCode != 8)
    {
        this.lastKey = keyCode;
        return true;
    }
    if (altKey && (keyCode == 40 || keyCode == 38))
    {
        this._showComboList();
        return false;
    }
    if (keyCode == 40) /* down */
    {
        match = -1;
        if (this.replaced.selectedIndex < 0)
        {
            match = 0;
        }
        else if (this.replaced.selectedIndex == this.editSelection)
        {
            match = this._matchInput(this.input.value);
            if (match != -1)
            {
                this.replaced.selectedIndex = match;
            }
        }
        if (match == -1)
        {
            if (this.replaced.selectedIndex >= (this.editSelection-1))
                this.replaced.selectedIndex = 0;
             else
             {
                if ((this.replaced.selectedIndex+1) == this.replaced.options.length)
                    this.replaced.selectedIndex = 0;
                else
                    this.replaced.selectedIndex++;
             }
        }
        this._clickComboList(this.replaced.selectedIndex);
        return false;
    }
    else if (keyCode == 38) /* up */
    {
        match = -1;
        if (this.replaced.selectedIndex == this.editSelection)
        {
            match = this._matchInput(this.input.value);
            if (match != -1)
            {
                this.replaced.selectedIndex = match;
            }
        }
        if (match == -1)
        {
            this.replaced.selectedIndex--;
            if (this.replaced.selectedIndex < 0)
                this.replaced.selectedIndex = this.editSelection-1;
            this._clickComboList(this.replaced.selectedIndex);
        }
        return false;
    }
    else
    {
		var matchWhat = this.input.readOnly?String.fromCharCode(keyCode):(this.forceUpper?this.input.value.toUpperCase():this.input.value);
        var match = this._matchInput(matchWhat);
        if ((keyCode == 8 || keyCode == 46) && this.lastMatch != -1 || (keyCode==8 && this.lastKey==8))
        {
            match = -1;
        }
        this.lastMatch = match;
        if (!this.input.readOnly && this.input.value != '' && match != -1)
        {
            this.replaced.selectedIndex = match;
            try { tr = this.input.createTextRange() } catch(e) { }
            before = this.input.value.length;
            if (before < this.replaced.options[match].text.length)
            {
                try {
                    if (this.input.createTextRange)
                    {
                        this.input.value = this.replaced.options[match].text
                        if (tr.findText(this.input.value.substring(before)))
                            tr.select();
                    }
                    else
                    {
                        this.input.value = this.replaced.options[match].text
                        this.input.setSelectionRange(before,this.input.value.length);
                        this.input.focus();
                    }
                } catch (ex) {
                    alert('C003:'+(ex.description?ex.description:ex)); 
                }
                if (document.createEvent)
                {
                    evt = document.createEvent('Events');
                    evt.initEvent('change',true,true);
                    this.replaced.dispatchEvent(evt);
                }
                else
                {
                    evt = document.createEventObject();
                    evt.type = 'onchange';
                    evt.cancelBubble = true;
                    this.fireEvent(evt.type,evt);
                }
            }
        }
        else
        {
			if (!this.input.readOnly)
			{
				if (this.forceUpper && keyCode >= 65 && keyCode <= 90 && this.input.value != this.input.value.toUpperCase())
					this.input.value = this.input.value.toUpperCase();
	            try {
		            this.replaced.options[this.editSelection].value=this.input.value;
			        this.replaced.options[this.editSelection].innerText=this.input.value;
				    this.replaced.selectedIndex = this.editSelection; 
	            } catch (ex) 
		        { 
			        alert('C004:'+(ex.description?ex.description:ex)); 
				}
	            try {
		            var txt = document.createTextNode(this.input.value);
			        this.editListItem.parentNode.replaceChild(txt,this.editListItem);
				    this.editListItem = txt;
	            } catch (ex) 
		        { 
			        alert('C005:'+(ex.description?ex.description:ex)); 
				}
			}
			else if (match != -1)
			{
                this.replaced.selectedIndex = match;
                this._clickComboList(this.replaced.selectedIndex);
			}
        }
    }
    this.lastKey = keyCode;
    return true;
}
