//v.2.6 build 100722
/*
Copyright DHTMLX LTD. http://www.dhtmlx.com
You allowed to use this component or parts of it under GPL terms
To use it on other terms or get Professional edition of the component please contact us at sales@dhtmlx.com
*/
function dhtmlXComboFromSelect(parent,size){if (typeof(parent)=="string")
parent=document.getElementById(parent);size=size||parent.getAttribute("width")||(window.getComputedStyle?window.getComputedStyle(parent,null)["width"]:(parent.currentStyle?parent.currentStyle["width"]:0));if ((!size)||(size=="auto"))
size=parent.offsetWidth||100;var z=document.createElement("SPAN");parent.parentNode.insertBefore(z,parent);parent.style.display='none';var s_type = parent.getAttribute('opt_type');var w= new dhtmlXCombo(z,parent.name,size,s_type,parent.tabIndex);var x=new Array();var sel=0;for (var i=0;i= 48 && ev.keyCode <= 57)||(ev.keyCode >= 65 && ev.keyCode <= 90)){for(var i=0;i15 && ev<19)return true;if (ev==27)return;if ((that.DOMlist.style.display!="block")&&(ev!="13")&&(ev!="9")&&((!that._filter)||(that._filterAny)))
that.DOMelem.onclick(e||event);if ((ev!="13")&&(ev!="9")){window.setTimeout(function(){that._onKeyB(ev);},1);if (ev=="40" || ev=="38")return false;}else if (ev==9){that.closeAll();(e||event).cancelBubble=false;}};dhtmlXCombo.prototype._onKeyB = function(ev)
{if (ev=="40"){var z=this.selectNext(1);}else if (ev=="38"){this.selectNext(-1);}else{this.callEvent("onKeyPressed",[ev])
if (this._filter)return this.filterSelf((ev==8)||(ev==46));for(var i=0;i=0;i--)this.DOMlist.removeChild(this.DOMlist.childNodes[i]);for(var i=0;i0)this.DOMlist.scrollTop+=corr;corr=this.DOMlist.scrollTop-this._selOption.content.offsetTop;if (corr>0)this.DOMlist.scrollTop-=corr;var data=this._selOption.data();if (conf){this.setComboText(data[1]);this._confirmSelection(data[0],false);if ((this._autoxml)&&((ind+1)==this._lastLength))
this._fetchOptions(ind+1,this._lasttext||"");};if (filter){var text=this.getComboText();if (text!=data[1]){this.setComboText(data[1]);dhtmlXRange(this.DOMelem_input,text.length+1,data[1].length);}}else
this.setComboText(data[1]);this._selOption.RedrawHeader(this);this.callEvent("onSelectionChange",[]);};dhtmlXCombo.prototype._selectOption = function(e)
{(e||event).cancelBubble = true;var node=(_isIE?event.srcElement:e.target);var that=this.combo;while (!node._self){node = node.parentNode;if (!node)return;};var i=0;for (i;i0)this.DOMlist.scrollTop+=corr;corr=this.DOMlist.scrollTop-this._selOption.content.offsetTop;if (corr>0)this.DOMlist.scrollTop-=corr;};if (_isIE)this._IEFix(true);this.DOMelem_input.focus();if (this._filter)this.filterSelf();};dhtmlXCombo.prototype._toggleSelect = function(e)
{var that=this.combo;if ( that.DOMlist.style.display == "block" ){that.closeAll();}else {that.openSelect();};(e||event).cancelBubble = true;};dhtmlXCombo.prototype._fetchOptions=function(ind,text){if (text==""){this.closeAll();return this.clearAll();};var url=this._xml+((this._xml.indexOf("?")!=-1)?"&":"?")+"pos="+ind+"&mask="+encodeURIComponent(text);this._lasttext=text;if (this._load)this._load=url;else {if (!this.callEvent("onDynXLS",[text,ind])) return;this.loadXML(url);}};dhtmlXCombo.prototype.filterSelf = function(mode)
{var text=this.getComboText();if (this._xml){this._lkmode=mode;this._fetchOptions(0,text);};try{var filter=new RegExp("^"+text,"i");}catch (e){var filter=new RegExp("^"+text.replace(/([\[\]\{\}\(\)\+\*\\])/g,"\\$1"));};this.filterAny=false;for(var i=0;i End || Start > Length)Start = 0;if (End > Length)End = Length;if (Start==End)return;if (Input.setSelectionRange){Input.setSelectionRange(Start, End);}else if (Input.createTextRange){var range = Input.createTextRange();range.moveStart('character', Start);range.moveEnd('character', End-Length);try{range.select();}catch(e){}}};dhtmlXCombo_defaultOption = function(){this.init();};dhtmlXCombo_defaultOption.prototype.init = function(){this.value = null;this.text = "";this.selected = false;this.css = "";};dhtmlXCombo_defaultOption.prototype.select = function(){if (this.content){this.content.className="dhx_selected_option"+(dhtmlx.skin?" combo_"+dhtmlx.skin+"_sel":"");}};dhtmlXCombo_defaultOption.prototype.hide = function(mode){this.render().style.display=mode?"none":"";};dhtmlXCombo_defaultOption.prototype.isHidden = function(){return (this.render().style.display=="none");};dhtmlXCombo_defaultOption.prototype.deselect = function(){if (this.content)this.render();this.content.className="";};dhtmlXCombo_defaultOption.prototype.setValue = function(attr){this.value = attr.value||"";this.text = attr.text||"";this.css = attr.css||"";this.content=null;};dhtmlXCombo_defaultOption.prototype.render = function(){if (!this.content){this.content=document.createElement("DIV");this.content._self = this;this.content.style.cssText='width:100%;overflow:hidden;'+this.css;if (_isOpera || _isKHTML )this.content.style.padding="2px 0px 2px 0px";this.content.innerHTML=this.text;this._ctext=_isIE?this.content.innerText:this.content.textContent;};return this.content;};dhtmlXCombo_defaultOption.prototype.data = function(){if (this.content)return [this.value,this._ctext ? this._ctext : this.text];};dhtmlXCombo_defaultOption.prototype.DrawHeader = function(self, name, width, tab)
{var z=document.createElement("DIV");z.style.width = width+"px";z.className = 'dhx_combo_box '+(dhtmlx.skin||"");z._self = self;self.DOMelem = z;this._DrawHeaderInput(self, name, width,tab);this._DrawHeaderButton(self, name, width);self.DOMParent.appendChild(self.DOMelem);};dhtmlXCombo_defaultOption.prototype._DrawHeaderInput = function(self, name, width,tab)
{var z=document.createElement('input');z.setAttribute("autocomplete","off");z.type = 'text';z.className = 'dhx_combo_input';if (tab)z.tabIndex=tab;z.style.width = width-19-(document.compatMode=="BackCompat"?0:3)+'px';self.DOMelem.appendChild(z);self.DOMelem_input = z;z = document.createElement('input');z.type = 'hidden';z.name = name;self.DOMelem.appendChild(z);self.DOMelem_hidden_input = z;z = document.createElement('input');z.type = 'hidden';z.name = (name||"").replace(/(\]?)$/, "_new_value$1");z.value="true";self.DOMelem.appendChild(z);self.DOMelem_hidden_input2 = z;};dhtmlXCombo_defaultOption.prototype._DrawHeaderButton = function(self, name, width)
{var z=document.createElement('img');z.className = 'dhx_combo_img';if(dhtmlx.image_path)dhx_globalImgPath = dhtmlx.image_path;z.src = (window.dhx_globalImgPath?dhx_globalImgPath:"")+'combo_select'+(dhtmlx.skin?"_"+dhtmlx.skin:"")+'.gif';self.DOMelem.appendChild(z);self.DOMelem_button=z;};dhtmlXCombo_defaultOption.prototype.RedrawHeader = function(self)
{};dhtmlXCombo_optionTypes['default'] = dhtmlXCombo_defaultOption;dhtmlXCombo.prototype.dhx_Event=function()
{this.dhx_SeverCatcherPath="";this.attachEvent = function(original, catcher, CallObj)
{CallObj = CallObj||this;original = 'ev_'+original;if ( ( !this[original] )|| ( !this[original].addEvent ) ) {var z = new this.eventCatcher(CallObj);z.addEvent( this[original] );this[original] = z;};return ( original + ':' + this[original].addEvent(catcher) );};this.callEvent=function(name,arg0){if (this["ev_"+name])return this["ev_"+name].apply(this,arg0);return true;};this.checkEvent=function(name){if (this["ev_"+name])return true;return false;};this.eventCatcher = function(obj)
{var dhx_catch = new Array();var m_obj = obj;var func_server = function(catcher,rpc)
{catcher = catcher.split(":");var postVar="";var postVar2="";var target=catcher[1];if (catcher[1]=="rpc"){postVar=''+catcher[2]+'';postVar2="";target=rpc;};var z = function() {};return z;};var z = function()
{if (dhx_catch)var res=true;for (var i=0;i