gx.GxObject=function(){this._isTrn=null;this.Gx_mode="";this.ServerClass="";this.ReadonlyForm=false;this.ObjectType="web";this.MasterPage=null;this.IsMasterPage=false;this.IsComponent=false;this.AjaxSecurity=gx.ajax.securityLevels.high;this.JustCreated=false;this.CmpContext="";this.WebComponents=[];this.Grids=[];this.UserControls=[];this.GridUCsProps={};this.GridUCsEvts={};this.UCBindings=[];this.GXValidFnc=[];this.GXLastCtrlId=0;this.GXCtrlIds=[];this.MsgList=[];this.CmpControls=[];this.VarControlMap=[];this.FormBCs=[];this.LvlOlds=[];this.ServerEvents=[];this.hasEnterEvent=false;this.autoRefresh=false;this.conditionsChanged=false;this.fromValid=0;this.toValid=0;this.setObjectType=function(Type){this.ObjectType=Type};this.getObjectType=function(){return this.ObjectType};this.isTransaction=function(){if(this._isTrn!=null){return this._isTrn}this._isTrn=(this.getObjectType()=="trn");return this._isTrn};this.setAjaxSecurity=function(level){switch(level){case"Medium":this.AjaxSecurity=gx.ajax.securityLevels.medium;break;case"Low":this.AjaxSecurity=gx.ajax.securityLevels.low;break;default:this.AjaxSecurity=gx.ajax.securityLevels.high;break}};this.addKeyListener=function(fKey,evt){gx.evt.addKeyListener(this.CmpContext,fKey,evt)};this.clearMessages=function(){this.MsgList.length=0};this.addMessage=function(Msg){this.MsgList.push(Msg)};this.showMessages=function(){var msgsArr=[];var len=this.MsgList.length;for(var i=0;i<len;i++){msgsArr.push({att:"",type:2,text:this.MsgList[i]})}var msgs={};var msgsKey=(this.CmpContext=="")?"MAIN":this.CmpContext;msgs[msgsKey]=msgsArr;gx.fn.setErrorViewer(msgs);this.clearMessages()};this.setPrompt=function(CtrlId,Deps){gx.fn.attachCtrl(CtrlId,{isPrompt:true,wc:this.CmpContext,mp:this.IsMasterPage,controls:Deps});if(!this.promptKeyHandlers){this.promptKeyHandlers={}}this.promptKeyHandlers[CtrlId]=function(){var el=gx.dom.el(this.CmpContext+CtrlId);var anchor=el.parentNode;if(anchor&&anchor.href){var match=anchor.href.match("javascript:(.+)");if(match&&match.length>1){var code=decodeURIComponent(match[1]);try{eval(code)}catch(e){gx.dbg.logEx(e,"gxfrmutl.js","setPrompt")}}}}};this.readServerVars=function(){if(!gx.lang.emptyObject(gx.csv.lastEvtResponse)){var objValues=[];var vals=gx.csv.lastEvtResponse.gxValues;var len=vals.length;for(var i=0;i<len;i++){var objV=vals[i];if(objV.CmpContext==this.CmpContext&&gx.lang.booleanValue(objV.IsMasterPage)==this.IsMasterPage){objValues.push(objV);break}}gx.fn.setPostValues(objValues)}};this.refreshInputs=function(Inputs){var len=Inputs.length;for(var i=0;i<len;i++){var inObj=Inputs[i];var validStruct=this.getValidStructFld(inObj[1]);if(validStruct!=null&&typeof(validStruct.c2v)=="function"){validStruct.c2v()}}};this.refreshOutputs=function(Outputs){var controls=[];for(var i=0,len=Outputs.length;i<len;i++){var outObj=Outputs[i];if(outObj.fld){var validStruct=this.getValidStructFld(outObj.fld);if(validStruct!=null){validStruct.v2c()}else{var varValue=this.getVariable(outObj.av);if(varValue!=null&&typeof(varValue)=="object"){var formBC=this.getFormBCForVar(outObj.av);
if(formBC!=null){this.bcToScreen(formBC,varValue)}var boundGrid=this.getGridForColl(outObj.av);if(boundGrid){boundGrid.refreshCollection(varValue)}}gx.fn.setHidden(outObj.fld,varValue)}}else{if(outObj.ctrl){controls.push(outObj)}}}for(var i=0,len=controls.length;i<len;i++){var outObj=controls[i];if(gx.uc.isUserControl(outObj.ctrl)){outObj.ctrl.execV2CFunctions();outObj.ctrl.execShowFunction()}}this.showMessages()};this.refreshServerOutputs=function(Outputs){var len=Outputs.length;for(var i=0;i<len;i++){var outObj=Outputs[i];var hiddenValue=gx.fn.getHidden(this.CmpContext+outObj.fld);if(hiddenValue!=undefined){var vStruct=this.getValidStructFld(outObj.fld);if(vStruct&&vStruct.v2v){vStruct.v2v(hiddenValue);vStruct.v2c()}else{this.setVariable(Outputs[i].av,hiddenValue)}}}};this.getContextObject=function(ControlId){var validStruct=this.getValidStructFld(ControlId);if(validStruct!=null){var Value=gx.fn.getControlValue_impl(this.CmpContext+ControlId);if(Value!=null){return Value}}return""};this.getValidStructId=function(Fld){if(!gx.lang.emptyObject(Fld)){var ctrlIds=this.getControlIds();for(var i=0;i<ctrlIds.length;i++){validStruct=this.getValidStruct(ctrlIds[i]);if(this.isSameField(validStruct,Fld)){return ctrlIds[i]}}}return -1};this.getValidStructFld=function(Fld){if(!gx.lang.emptyObject(Fld)){var ctrlIds=this.getControlIds();var len=ctrlIds.length;for(var i=0;i<len;i++){var validStruct=this.getValidStruct(ctrlIds[i]);if(this.isSameField(validStruct,Fld)){return validStruct}}}return null};this.isSameField=function(validStruct,TestFld){var Fld=validStruct.fld;if(Fld==TestFld){return true}if(this.IsComponent){var ctxIdx=TestFld.indexOf(this.CmpContext);if(ctxIdx==0){TestFld=TestFld.substring(this.CmpContext.length)}}if(validStruct.grid!=0){var regEx=/^([\s\S]+)_((?:[0-9]{4})*)/;var parts=regEx.exec(TestFld);if(parts&&parts.length==3){TestFld=parts[1]}}return(Fld==TestFld)};this.getUserFocus=function(){var usrFocusId=gx.fn.getHidden(this.CmpContext+"GX_FocusControl");if(gx.lang.emptyObject(usrFocusId)){if(this.hasMasterPage()){usrFocusId=this.MasterPage.getUserFocus();if(!gx.lang.emptyObject(usrFocusId)){return usrFocusId}}for(var i=this.WebComponents.length-1;i>=0;i--){usrFocusId=this.WebComponents[i].getUserFocus();if(!gx.lang.emptyObject(usrFocusId)){return usrFocusId}}}else{if(usrFocusId!="notset"){var Control=gx.dom.byId(usrFocusId);if(!gx.lang.emptyObject(Control)&&!gx.fn.isAccepted(Control)){var tCmp=gx.csv.cmpCtx;gx.csv.cmpCtx=this.CmpContext;Control=gx.fn.firstAcceptedControl(gx.popup.ispopup());gx.csv.cmpCtx=tCmp;if(!gx.lang.emptyObject(Control)){usrFocusId=Control.id}}}}return usrFocusId};this.hasMasterPage=function(){return(this.MasterPage!=null)};this.setComponent=function(CmpCtrl){this.CmpControls[CmpCtrl.id.toLowerCase()]=CmpCtrl};this.getComponentPrefix=function(CtrlName){var wc=this.getComponentData(CtrlName);if(wc){return(wc.Prefix||"")}return""};this.getComponentData=function(CtrlName){return this.CmpControls[CtrlName.toLowerCase()]};
this.createWebComponent=function(CtrlName,PgmName,Parms,Row,TargetCtrlId,CmpPrefix){var gRow=Row||"";var Prefix=CmpPrefix||this.getComponentPrefix(CtrlName);var srvResponse=gx.ajax.dynComponent(PgmName,Parms,Prefix,gRow);if(!srvResponse.DynComponentMap){srvResponse.DynComponentMap={}}srvResponse.DynComponentMap[CmpPrefix+gRow]=TargetCtrlId;gx.ajax.setPostResponse(srvResponse)};this.setWebComponent=function(gxComponent){this.deleteComponent(gxComponent.CmpContext,gxComponent);this.WebComponents[gxComponent.CmpContext]=gxComponent;this.WebComponents.push(gxComponent);gxComponent.JustCreated=true};this.getWebComponent=function(cmpCtx){return this.WebComponents[cmpCtx]};this.deleteComponent=function(cmpCtx,newCompObj){var cmpObj=this.getWebComponent(cmpCtx);if(cmpObj){gx.cache.deleteInlineCode(cmpCtx+cmpObj.ServerClass.toLowerCase());this.deleteComponentHiddens(cmpCtx);if(!gx.lang.emptyObject(newCompObj)){gx.fn.setHidden(newCompObj.CmpContext,newCompObj.ServerClass)}cmpObj.ondestroy();delete this.WebComponents[cmpCtx];var len=this.WebComponents.length;for(var i=0;i<len;i++){if(this.WebComponents[i].CmpContext==cmpCtx){this.WebComponents.removeAt(i);break}}var localArray=this.WebComponents;for(var currentCtx in localArray){if(isNaN(parseInt(currentCtx))){if(currentCtx.indexOf(cmpCtx)==0){this.deleteComponent(currentCtx)}}}}};this.deleteComponentHiddens=function(cmpCtx){var hiddens=gx.fn.filterHiddens(new RegExp("^"+cmpCtx),gx.http.viewState);for(var hiddenName in hiddens){if(hiddenName){gx.fn.deleteHidden(hiddenName)}}};this.setCmpContext=function(cmpCtx){if(cmpCtx!=undefined){if(cmpCtx!=""){this.IsComponent=true}this.CmpContext=cmpCtx}};this.getOldLvl=function(Name){for(var lvl in this.LvlOlds){var lvlOlds=this.LvlOlds[lvl];var len=lvlOlds.length;for(var i=0;i<len;i++){if(lvlOlds[i]==Name){return lvl}}}return -1};this.refreshDependantGrids=function(validStruct){var len=this.Grids.length;for(var i=0;i<len;i++){var gxGrid=this.Grids[i];var refreshVars=gxGrid.refreshVars;var len1=refreshVars.length;for(var j=0;j<len1;j++){if(refreshVars[j].fld==validStruct.fld){gxGrid.filterVarChanged();break}}}};this.setGrid=function(gxGrid){this.Grids[gxGrid.gridName]=gxGrid;var gridIdx=this.getGridIdxByName(gxGrid.gridName);if(gridIdx!=-1){this.Grids[gridIdx]=gxGrid}else{this.Grids.push(gxGrid)}};this.getGrid=function(gridName){return this.Grids[gridName]};this.getGridIdxByName=function(gridName){var len=this.Grids.length;for(var i=0;i<len;i++){var gxGrid=this.Grids[i];if(gxGrid.gridName==gridName){return i}}return -1};this.getGridIdx=function(gridId){var len=this.Grids.length;for(var i=0;i<len;i++){var gxGrid=this.Grids[i];if(gxGrid.gridId==gridId){return i}}return -1};this.getGridById=function(gridId){var len=this.Grids.length;for(var i=0;i<len;i++){var gxGrid=this.Grids[i];if(gxGrid.gridId==gridId){return gxGrid}}return null};this.getGridForColl=function(collVarName){var len=this.Grids.length;for(var i=0;i<len;i++){var gxGrid=this.Grids[i];if(gxGrid.boundedCollName==collVarName){return gxGrid
}}return null};this.getFormBCForVar=function(varName){for(var bcName in this.FormBCs){var bc=this.FormBCs[bcName];if(bc&&bc.gxvar==varName){return bc}}return null};this.getFormBC=function(bcName){var bcName1=bcName;if(this.IsComponent){var ctxIdx=bcName.indexOf(this.CmpContext);if(ctxIdx==0){bcName1=bcName.substring(this.CmpContext.length)}}return this.FormBCs[bcName1]};this.addBCProperty=function(bcName,bcProp,vStruct,bcVarName){var bc=this.getFormBC(bcName);if(typeof(bc)=="undefined"){bc={};bc.gxvar=bcVarName;this.FormBCs[bcName]=bc}if(bcProp instanceof Array){var obj=bc;var len=bcProp.length;for(var i=0;i<len;i++){if(typeof(obj[bcProp[i]])=="undefined"){if(i<len-1){obj[bcProp[i]]={}}else{obj[bcProp[i]]=vStruct;if(typeof(this[bcVarName])=="object"){vStruct.v2bc=function(){var propValue=this[vStruct.gxvar];if(vStruct.type=="date"){var dateObj=new gx.date.gxdate(propValue);propValue=dateObj.getString("Y4MD")}this.valueToBCProp(this[bcVarName],bcProp,propValue)}}break}}obj=obj[bcProp[i]]}}else{if(typeof(bcProp)=="string"){bc[bcProp]=vStruct}}};this.valueToBCProp=function(bc,bcProp,pValue){try{var obj=bc;var len=bcProp.length;for(var i=0;i<len;i++){if(len>1&&i<len-1&&obj[bcProp[i]]===undefined){obj[bcProp[i]]={}}if(typeof(obj[bcProp[i]])=="object"){obj=obj[bcProp[i]]}else{obj[bcProp[i]]=pValue;break}}}catch(e){gx.dbg.logEx(e,"gxfrmutl.js","valueToBCProp")}};this.bcToScreen=function(bc,data){for(var prop in bc){if(prop=="gxvar"){continue}try{if(typeof(data[prop])=="object"){this.bcToScreen(bc[prop],data[prop])}else{var vStruct=bc[prop];if(vStruct.grid==0&&gx.lang.emptyObject(vStruct.hc)){if(vStruct.v2v){vStruct.v2v(data[prop]);vStruct.v2c()}}}}catch(e){gx.dbg.logEx(e,"gxfrmutl.js","bcToScreen")}}};this.addGridUCEventHandler=function(CtrlName,EvtName,EvtHandler){if(gx.lang.emptyObject(this.GridUCsEvts[CtrlName])){this.GridUCsEvts[CtrlName]=[]}this.GridUCsEvts[CtrlName].push({e:EvtName,h:EvtHandler})};this.getGridUCEventHandlers=function(CtrlName){var handlers=this.GridUCsEvts[CtrlName];if(gx.lang.emptyObject(handlers)){return[]}return handlers};this.setGridUCDynProperty=function(CtrlName,PropName,HiddenName,PropType){this.setGridUCProperty(CtrlName,PropName,HiddenName,undefined,PropType)};this.setGridUCProperty=function(CtrlName,PropName,HiddenName,Value,PropType){if(gx.lang.emptyObject(this.GridUCsProps[CtrlName])){this.GridUCsProps[CtrlName]=[]}this.GridUCsProps[CtrlName].push({p:PropName,h:HiddenName,v:Value,t:PropType})};this.getGridUCProperties=function(CtrlName){var props=this.GridUCsProps[CtrlName];if(gx.lang.emptyObject(props)){return[]}return props};this.addUsercontrolBinding=function(VarName,CtrlName){this.UCBindings[VarName]=CtrlName};this.setUserControl=function(gxUC){this.UserControls[gxUC.ContainerName]=gxUC;this.UserControls.push(gxUC)};this.getUserControl=function(cName){var uc=this.UserControls[cName];if(!uc&&this.CmpContext!=""){uc=this.UserControls[this.CmpContext+cName]}return uc};this.execV2CFunctions=function(Show){var len=this.UserControls.length;
for(var i=0;i<len;i++){var uc=this.UserControls[i];try{uc.execV2CFunctions()}catch(e){gx.dbg.logEx(e,"gxfrmutl.js","execV2CFunctions")}if(Show==true){try{uc.execShowFunction()}catch(e){gx.dbg.logEx(e,"gxfrmutl.js","execV2CFunctions")}}}};this.execC2VFunctions=function(){var len=this.UserControls.length;for(var i=0;i<len;i++){try{this.UserControls[i].execC2VFunctions()}catch(e){gx.dbg.logEx(e,"gxfrmutl.js","execC2VFunctions")}try{this.UserControls[i].saveProperties()}catch(e){gx.dbg.logEx(e,"gxfrmutl.js","execC2VFunctions")}}};this.setMode=function(){gx.fn.setHidden(this.CmpContext+"_MODE",this.Gx_mode);gx.fn.setHidden(this.CmpContext+"Mode",this.Gx_mode)};this.setVariable=function(VarName,Value){this[VarName]=Value;FormattedValue=Value;if(VarName.indexOf(this.CmpContext)!=0){gx.fn.setHidden(this.CmpContext+VarName,Value)}if(this.VarControlMap[VarName]!=undefined){var type=this.VarControlMap[VarName].type;if(type=="date"||type=="dtime"){if(typeof(Value)=="string"){FormattedValue=new gx.date.gxdate(Value)}if(Value instanceof gx.date.gxdate){FormattedValue=Value.getStringWithFmt("Y4MD")}}if(type=="decimal"&&gx.decimalPoint!="."){FormattedValue=Value.toString().replace(".",gx.decimalPoint);if(typeof(Value)=="string"){this[VarName]=gx.num.parseFloat(Value)}}else{if(type=="int"&&typeof(Value)=="string"){this[VarName]=gx.num.parseInt(Value)}}gx.fn.setHidden(this.CmpContext+this.VarControlMap[VarName].id,FormattedValue)}if(VarName=="Gx_mode"){this.setMode()}if(this.UCBindings[VarName]!=undefined){gx.fn.setHidden(this.CmpContext+this.UCBindings[VarName],Value)}};this.getVariable=function(VarName){return this[VarName]};this.isServerEvent=function(EvtName){var len=this.ServerEvents.length;for(var i=0;i<len;i++){if(this.ServerEvents[i]==EvtName){return true}}return false};this.setEventParameters=function(ParmsData,Values){gx.csv.lastEvtRow=null;gx.O=this;var allSameGrid=true;var pGrid=-1;gx.csv.cmpCtx=this.CmpContext;var len=ParmsData.length;for(var i=0;i<len;i++){var ParmName=ParmsData[i][0];var CtrlName=ParmsData[i][1];var VarName=ParmsData[i][2];var found=false;for(var valProp in Values){if(valProp.toLowerCase()==ParmName.toLowerCase()){this.setVariable(VarName,Values[valProp]);found=true;break}}if(!found){this.setVariable(VarName,Values)}var validStruct=this.getValidStructFld(CtrlName);if(validStruct!=null){if((validStruct.grid!=0)&&(pGrid==-1)){pGrid=validStruct.grid}else{if((validStruct.grid!=0)&&(validStruct.grid!=pGrid)){allSameGrid=false}}validStruct.v2c()}else{gx.fn.setHidden(this.CmpContext+CtrlName,this.getVariable(VarName))}}if(allSameGrid){gx.csv.lastEvtRow=gx.fn.currentGridRowImpl(pGrid)}};this.executeServerEvent=function(EvtName,Synch,EvtRow){gx.O=this;gx.csv.cmpCtx=this.CmpContext;var synchReq=true;if((Synch!=undefined)&&(Synch==false)){synchReq=false}var row=(typeof(EvtRow)=="string")?EvtRow:"";if(!gx.lang.emptyObject(gx.csv.lastEvtRow)){row=gx.csv.lastEvtRow}if((row=="")&&(!gx.lang.emptyObject(gx.csv.validatingGrid))){row=gx.csv.lastRow[gx.csv.validatingGrid.gridId]
}var evtName=this.CmpContext+"E"+EvtName+"."+row;gx.evt.execEvt(evtName,gx.evt.dummyCtrl,synchReq)};this.executeEnterEvent=function(evt,ctrl){if(gx.evt.cancelAndRefresh(evt)){return}if(gx.dom.hasSubmitControl()){gx.evt.cancel(evt,true)}if(ctrl&&ctrl.nodeName=="INPUT"&&(ctrl.type=="text"||ctrl.type=="password")){gx.evt.cancel(evt,true)}var gxOEnter=this.gxOWithEnter();if(gxOEnter!=null){gx.evt.enter=true;var enterName="ENTER";if(gxOEnter.IsMasterPage){enterName=enterName+"_MPAGE"}enterName=gxOEnter.CmpContext+"E"+enterName+".";if(ctrl&&ctrl.onblur){ctrl.onblur()}gx.evt.execEvt(enterName,gx.evt.dummyCtrl);gx.evt.enter=false;gx.evt.cancel(evt,true)}};this.gxOWithEnter=function(){if(this.hasEnterEvent){return this}else{if(this.IsComponent){var cmpRegex=/((?:(?:MP)?W[0-9]{4})*)((?:MP)?W[0-9]{4})/;var cmpType=cmpRegex.exec(this.CmpContext);var isMPage=((cmpType[1]=="")&&(cmpType[0].indexOf("MP")==0));var parent=gx.getObj(cmpType[1],isMPage);if(!gx.lang.emptyObject(parent)){return parent.gxOWithEnter()}}else{if(this.hasMasterPage()){return this.MasterPage.gxOWithEnter()}}}return null};this.getLastControlId=function(){return this.GXLastCtrlId};this.getValidStruct=function(ctrlId){return this.GXValidFnc[ctrlId]};this.getControlIds=function(){return this.GXCtrlIds};this.getControlIdsh=function(){return this.GXCtrlIdsh};this.getUsercontrolFromChild=function(Child){var len=this.UserControls.length;for(var i=0;i<len;i++){var ctrl=this.UserControls[i].getContainerControl();if(gx.dom.isChildNode(Child,ctrl)){return this.UserControls[i]}}return null};this.installFlatLevelDatePickers=function(){var validStruct=null;var ctrlIds=this.getControlIds();var len=ctrlIds.length;for(var i=0;i<len;i++){validStruct=this.getValidStruct(ctrlIds[i]);if((validStruct!=undefined)&&(validStruct.grid==0)&&(validStruct.dp!=undefined)){var controlId=this.CmpContext+validStruct.fld;gx.fn.installDatePicker(controlId,validStruct.dp.f,validStruct.dp.st,validStruct.dp.wn,validStruct.dp.mf,gx.fn.datePickerFormat(validStruct.dp.pic,validStruct.dp.dec,validStruct.len))}}};this.refreshOlds=function(){for(var lvl in this.LvlOlds){var lvlOlds=this.LvlOlds[lvl];if(typeof(lvlOlds)!="function"){var gridId=gx.fn.lvlGrid(parseInt(lvl));var gridRow=undefined;if(gridId!=0){gridRow=gx.fn.currentGridRow(gridId)}var len=lvlOlds.length;for(var i=0;i<len;i++){var name=lvlOlds[i];var varName=name;var oldVal="";var vStruct=gx.fn.vStructForOld(varName);if(vStruct){oldVal=gx.typedOld(vStruct.fld,varName,vStruct.type)}else{if(!gx.lang.emptyObject(gridRow)){name+="_"+gridRow}oldVal=gx.fn.getHidden(name)}if(typeof(oldVal)!="undefined"){if(!vStruct){window[varName]=oldVal}this[varName]=oldVal}}}}};this.deleteEventHandlers=function(){try{gx.fx.ctx.deleteHandlers(this);gx.fx.dnd.deleteHandlers(this)}catch(e){gx.dbg.logEx(e,"gxfrmutl.js","deleteEventHandlers")}};this.ondestroy=function(){try{this.deleteEventHandlers();var len=this.UserControls.length;for(var i=0;i<len;i++){var uc=this.UserControls[i];if(!gx.lang.emptyObject(uc.destroy)){try{uc.destroy()
}catch(e){gx.dbg.logEx(e,"gxfrmutl.js","ondestroy")}}}}catch(e){gx.dbg.logEx(e,"gxfrmutl.js","ondestroy")}};this.onpost=function(){var gxO=gx.O;gx.setGxO(this.CmpContext,this.IsMasterPage);if(this.hasMasterPage()){this.MasterPage.onpost()}var len=this.WebComponents.length;for(var i=0;i<len;i++){this.WebComponents[i].onpost()}if(this.ReadonlyForm&&this.IsComponent&&gxO!=this){this.roControlsAsHidden()}this.execC2VFunctions();gx.setGxO(gxO.CmpContext,gxO.IsMasterPage)};this.roControlsAsHidden=function(){var ctrlIds=this.getControlIds();var len=ctrlIds.length;for(var i=0;i<len;i++){var validStruct=this.getValidStruct(ctrlIds[i]);if(validStruct.grid==0&&typeof(validStruct.val)=="function"){var ctrlId=this.CmpContext+validStruct.fld;var ctrl=gx.dom.el(ctrlId);if(ctrl&&!gx.fn.isAccepted(ctrl)){gx.fn.setHidden(ctrlId,validStruct.val())}}}};this.getCtrlIdx=function(CtrlId){var ctrlIds=this.getControlIds();var len=ctrlIds.length;for(var i=0;i<len;i++){var validStruct=this.getValidStruct(ctrlIds[i]);if(validStruct&&this.CmpContext+validStruct.fld==CtrlId){return gx.fn.controlIds()[i]}}return null};this.onload=function(){gx.setGxO(this.CmpContext,this.IsMasterPage);this.screenToVars();if(this.hasMasterPage()){this.MasterPage.onload()}var len=this.Grids.length;for(var i=0;i<len;i++){this.Grids[i].loadGrid()}len=this.WebComponents.length;for(var i=0;i<len;i++){this.WebComponents[i].onload()}this.installFlatLevelDatePickers();this.refreshOlds();this.execV2CFunctions(true);this.JustCreated=false};this.onunload=function(){if(this.hasMasterPage()){this.MasterPage.onunload()}var len=this.Grids.length;for(var i=0;i<len;i++){this.Grids[i].cleanup();this.Grids[i]=null}this.Grids=[];len=this.WebComponents.length;for(var i=0;i<len;i++){this.WebComponents[i].onunload();this.WebComponents[i]=null}this.WebComponents=[]};this.screenToVars=function(){try{var ctrlIds=this.getControlIds();var len=ctrlIds.length;for(var i=0;i<len;i++){var validStruct=this.getValidStruct(ctrlIds[i]);if(validStruct&&validStruct.lvl==0&&typeof(validStruct.c2v)=="function"){validStruct.c2v()}}}catch(e){gx.dbg.logEx(e,"gxfrmutl.js","screenToVars")}};this.postbackLoad=function(){if(this.hasMasterPage()){this.MasterPage.postbackLoad()}var len=this.WebComponents.length;for(var i=0;i<len;i++){this.WebComponents[i].postbackLoad()}if(this.IsComponent&&this.JustCreated){this.installFlatLevelDatePickers()}this.execV2CFunctions(true);this.JustCreated=false;this.conditionsChanged=false};this.addDragSource=function(ControlId,CSSClass,Types,Handler){gx.fx.dnd.addSource(this,ControlId,CSSClass,Types,Handler)};this.addDropTarget=function(ControlId,CSSClass,Types,Handler){gx.fx.dnd.addTarget(this,ControlId,CSSClass,Types,Handler)};this.addContextSetter=function(ControlId,CSSClass,Types,Handler){gx.fx.ctx.addSetter(this,ControlId,CSSClass,Types,Handler)};this.addContextTracker=function(ControlId,CSSClass,Types,Handler){gx.fx.ctx.addTracker(this,Types,Handler)};this.addEventHandler=function(EvtType,ControlId,Handler){gx.fx.dom.addEventHandler(this,EvtType,ControlId,Handler)
}};gx.uc={getNew:function(ParentObject,ControlId,LastId,ClassName,ContainerName,ControlName,GridLvl,GridId,GridRow){var subclass=eval(ClassName);gx.lang.inherits(subclass,gx.uc.UserControl);var userCtrl=new subclass();userCtrl.ContainerName=ContainerName;userCtrl.DesignContainerName=ContainerName;userCtrl.setupControl(ParentObject,ControlName,ControlId,LastId,GridLvl,GridId,GridRow);return userCtrl},fromChild:function(c){var d=gx.pO.getUsercontrolFromChild(c);if(d!=null){return d}if(gx.pO.hasMasterPage()){d=gx.pO.MasterPage.getUsercontrolFromChild(c);if(d!=null){return d}}var a=gx.pO.WebComponents.length;for(var b=0;b<a;b++){d=gx.pO.WebComponents[b].getUsercontrolFromChild(c);if(d!=null){return d}}return null},getUserControlObj:function(c){var b=gx.O.getUserControl(c);if(gx.lang.emptyObject(b)){if(gx.pO.hasMasterPage()){b=gx.pO.MasterPage.getUserControl(c);if(!gx.lang.emptyObject(b)){return b}}var a=gx.pO.WebComponents.length;for(var d=0;d<a;d++){b=gx.pO.WebComponents[d].getUserControl(c);if(!gx.lang.emptyObject(b)){return b}}}return b},userControlContainerId:function(a){var c=a.lastIndexOf("_");if(c!=-1){var b=a.substring(0,c)+"Container"+a.substring(c);if(gx.dom.byId(b)!=null){return b}}return a+"Container"},setProperties:function(f,b){var c=gx.uc.getUserControlObj(gx.uc.userControlContainerId(f));if(c!=null){if(b.length!=undefined){var a=b.length;for(var d=0;d<a;d++){for(var e in b[d]){var g=b[d][e];c[e]=g}}}else{for(var e in b){var g=b[e];c[e]=g}}}},isUserControl:function(b){if(b instanceof gx.uc.UserControl){return true}else{var a=gx.dom.byId(gx.uc.userControlContainerId(b));if(a!=null){if(a.tagName=="DIV"){return true}}}return false},UserControl:function(){this.ParentObject=null;this.GridId="";this.GridRow="";this.ControlId=0;this.ControlLvl=0;this.ContainerName="";this.ControlName="";this.LastIdBefore=0;this.Properties=[];this.DynProperties=[];this.PropTypes=[];this.ValidFunctions=[];this.V2CFunctions=[];this.C2VFunctions=[];this.C2ShowFunction=null;this.RealControl=null;this.IsPostBack=false;this.clearFunctions=function(){this.ValidFunctions=[];this.V2CFunctions=[];this.C2VFunctions=[];this.C2ShowFunction=null};this.me=function(){return"gx.getObj('"+this.ParentObject.CmpContext+"', "+this.ParentObject.IsMasterPage.toString()+").getUserControl('"+this.ContainerName+"')"};this.getChildContainer=function(a){var b=(this.GridRow!="")?("_"+this.GridRow):"";return gx.dom.byId(this.DesignContainerName+a+b)};this.getContainerControl=function(){return gx.dom.byId(this.ContainerName)};this.getRealControl=function(){return this.RealControl};this.setupControl=function(c,g,b,d,f,e,a){this.ParentObject=c;this.ControlName=g;this.ControlId=b;this.LastIdBefore=d;this.ControlLvl=(f!=undefined)?f:0;this.GridId=(e!=undefined)?e:0;this.GridRow=(a!=undefined)?a:"";this.ParentObject.GXValidFnc[this.ControlId]={lvl:this.ControlLvl,grid:this.GridId,op:[],ip:[],isuc:true,uc:this,fnc:this.validateControl}};this.addValidFunction=function(c,d,a){this.ValidFunctions.push(c);
var b=(this.GridRow=="")?"":"_"+this.GridRow;this.ParentObject.addUsercontrolBinding(d,a+b)};this.validateControl=function(){gx.csv.validatingUC=this;var a=this.ValidFunctions.length;for(var c=0;c<a;c++){var b=this.ValidFunctions[c].call(gx.O);if(!b){gx.O.AnyError=1;gx.csv.validatingUC=null;return false}}gx.csv.validatingUC=null;return true};this.attachEvents=function(){try{var c=this.getContainerControl();if(!gx.lang.emptyObject(document.frames)){var a=document.frames.length;if(a>0){var b=0;for(b=0;b<a;b++){var f=document.frames[b];if(gx.dom.isChildNode(f,c)==true){f.frameElement.onfocus=this.onfocus;this.RealControl=f.frameElement;return}}}}else{c.onfocus=this.onfocus;this.RealControl=c}}catch(d){gx.dbg.logEx(d,"gxfrmutl.js","attachEvents")}};this.onfocus=function(){gx.evt.onfocus(this.getRealControl(),this.ControlId,this.ParentObject.CmpContext,this.ParentObject.IsMasterPage,this.GridRow,this.GridId);this.execShowFunction();if(!gx.csv.anyError){this.setFocusBase()}};this.setFocusBase=function(){if(typeof(this.setFocus)=="function"){this.setFocus()}};this.setHtml=function(a){this.getContainerControl().innerHTML=a};this.createWebComponent=function(c,e,a,b,d){this.ParentObject.createWebComponent(c,e,a,this.GridRow,b,d)};this.deleteWebComponent=function(a){var b=gx.fn.cmpContextFromCtrl(a);this.ParentObject.deleteComponent(b)};this.notifyContext=function(b,a){gx.fx.ctx.notify(null,b,a)};this.addV2CFunction=function(a){this.V2CFunctions.push(a)};this.addC2VFunction=function(a){this.C2VFunctions.push(a)};this.setC2ShowFunction=function(a){this.C2ShowFunction=a};this.execV2CFunctions=function(){var d=gx.csv.cmpCtx;gx.csv.cmpCtx=this.ParentObject.CmpContext;var c=0;var b=this.V2CFunctions;var a=b.length;for(c=0;c<a;c++){try{b[c](this,this.GridRow)}catch(f){gx.dbg.logEx(f,"gxfrmutl.js","execV2CFunctions")}}gx.csv.cmpCtx=d};this.execC2VFunctions=function(){var d=gx.csv.cmpCtx;gx.csv.cmpCtx=this.ParentObject.CmpContext;var c=0;var b=this.C2VFunctions;var a=b.length;for(c=0;c<a;c++){try{b[c](this,this.GridRow)}catch(f){gx.dbg.logEx(f,"gxfrmutl.js","execC2VFunctions")}}gx.csv.cmpCtx=d};this.execShowFunction=function(){if(this.C2ShowFunction!=null){this.C2ShowFunction(this)}this.IsPostBack=true};this.getEventRow=function(){return this.GridRow};this.addEventHandler=function(a,c){var b=this;this[a]=function(){gx.evt.userReady=false;gx.setGxO(b.ParentObject.CmpContext,b.ParentObject.IsMasterPage);if(b.GridId>0){var d=b.DesignContainerName;var e=new RegExp("^(?:"+b.ParentObject.CmpContext+")?(.+)$");var f=e.exec(b.DesignContainerName);if(f&&f[1]){d=f[1]}b.ParentObject[d]=b;var g=b.ParentObject.getGridById(b.GridId);if(g){g.instanciateRow(b.GridRow)}}b.execC2VFunctions();c.call(b.ParentObject,b.getEventRow());gx.evt.userReady=true}};this.addProperty=function(b,a){this.Properties[b]=a};this.setProperty=function(b,a,c,d){this.addProperty(b,a);this.PropTypes[b]=d;if(gx.lang.isBooleanType(d)){this[b]=gx.lang.gxBoolean(c)}else{if(d=="color"){if(!gx.lang.emptyObject(c)){this[b]=(typeof(c)=="number"||typeof(c)=="string")?gx.color.html(c):c
}}else{if(gx.lang.isNumericType(d)){if(!gx.lang.emptyObject(c)){this[b]=gx.num.parseFloat(c)}}else{this[b]=c}}}};this.setDynProperty=function(b,a,c){this.DynProperties.push(b);this.setProperty(b,a,gx.fn.getHidden(this.getHiddenName(a)),c)};this.refreshDynProperties=function(){var a=this.DynProperties.length;for(var c=0;c<a;c++){var d=this.DynProperties[c];var b=this.Properties[d];this[d]=gx.fn.getHidden(this.getHiddenName(b))}};this.setGridProperties=function(){var d=this.ParentObject.getGridUCProperties(this.ControlName);var a=d.length;for(var c=0;c<a;c++){var f=d[c];var e=f.v;if(typeof(e)=="undefined"){var b=this.getHiddenName(f.h);e=gx.fn.getHidden(b);if(f.t=="color"){e=gx.color.html(e)}}this.setProperty(f.p,f.h,e,f.t)}};this.setGridEventHandlers=function(){var b=this.ParentObject.getGridUCEventHandlers(this.ControlName);var a=b.length;for(var c=0;c<a;c++){var d=b[c];this.addEventHandler(d.e,d.h)}};this.getHiddenName=function(a){var b="";if(this.GridRow!=""){b="_"+this.GridRow}return this.ParentObject.CmpContext+this.ControlName.toUpperCase()+(this.ParentObject.IsMasterPage?"_MPAGE":"")+"_"+a+b};this.saveProperties=function(){for(var b in this.Properties){var a=this[b];if(typeof(this.Properties[b])!="function"){if(typeof(a)!="undefined"&&typeof(a.R)!="undefined"&&typeof(a.G)!="undefined"&&typeof(a.B)!="undefined"){a=gx.color.rgb(a.R,a.G,a.B)}if(gx.lang.isBooleanType(this.PropTypes[b])){a=(a?1:0)}gx.fn.setHidden(this.getHiddenName(this.Properties[b]),a)}}}}};gx.printing={loaded:false,tries:0,waitInterval:100,print:function(b){if(!this.loaded){var a=gx.util.resourceUrl("printingappletsigned.jar",true);var c='<applet name="GeneXusPrintAppletForWindows" archive="'+a+'" code="com/genexus/printing/Printer.class" width="0" height="0">';c+='<param name="path" value="'+gx.util.resourceUrl(gx.basePath,true)+'">';c+='<p>No java plugin detected. Click <a href="http://java.com/en/download/" target="new">here</a> to download it.</p>';c+="</applet>";document.body.appendChild(gx.html.nodesFromText(c)[0]);this.loaded=true}if(this.tries==0){this.printWhenReady(b)}else{gx.dbg.logMsg("Already trying to print a document.")}},printWhenReady:function(a){if(this.tries>=(this.waitInterval*60)){this.tries=0;gx.dbg.logMsg("The printing applet was not loaded.");return}this.tries++;if(this.isReady()){document.GeneXusPrintAppletForWindows.printReport(a.reportFile,a.printerRule,"GXPRN.INI");this.tries=0}else{setTimeout(function(){gx.printing.printWhenReady(a)},this.waitInterval)}},isReady:function(){var a=document.GeneXusPrintAppletForWindows;if(a){if(typeof(a.isReady)=="function"||typeof(a.isReady)=="unknown"){return a.isReady()}}return false}};gx.fn={attachedControls:function(){return gx.attachedControls},closeWindow:function(a){if(typeof(a)=="string"){if(this.closeFromServer(a)){return}a=[]}if(!a){a=[]}if(gx.popup.ispopup()){var c=gx.popup.getPopup();var b=gx.util.noParmsUrl(c.url);if(!c.frameWindow||(c.frameWindow.location.href.search(b+"(\\?.*)?$")!=-1)||gx.grid.drawAtServer){c.close(a);
return}}if(location.href.indexOf("gxCalledAsPopup")!=-1){this.closeWindowImpl();return}var d=gx.fn.getControlValue("sCallerURL");if(!gx.lang.emptyObject(d)){gx.ajax.windowClosed(-1);location.href=gx.ajax.absoluteurl(d)}else{this.closeWindowImpl()}},closeWindowImpl:function(){if(gx.util.browser.isIE()){window.close()}else{if(history.length>0){history.back()}else{window.location.assign("about:blank")}}},closeFromServer:function(a){try{if(window.parent&&window.parent.gx){if(gx.popup.ispopup()&&!(gx.grid.drawAtServer||window.parent.gx.grid.drawAtServer)){gx.fn.closeWindow(gx.json.evalJSON(a))}else{window.parent.gx.fn.closeWindow(gx.json.evalJSON(a))}return true}}catch(b){gx.dbg.logEx(b,"gxfrmutl.js","closeFromServer")}return false},invalidEmptyValue:function(b){if(gx.lang.emptyObject(b.s)){var a=b.v.length;for(var c=0;c<a;c++){if(b.v[c][0]===b.s){return false}}return true}return false},selectedDescription:function(b){var a=b.v.length;for(var c=0;c<a;c++){if(b.v[c][0]===b.s){return b.v[c][1]}}return null},setGridCheckBoxValue:function(d,a,b,c){this.setCheckBoxValue(d+"_"+a,b,c)},setGridDecimalValue:function(e,a,b,d,c){b=b.toString().replace(c,".");b=Number(b).toFixed(d);b=b.replace(".",c);return this.setGridControlValue(e,a,b)},setGridControlValue:function(d,b,a,c){if(b!==undefined){return this.setControlValue(d+"_"+b,a,c)}},setVarValues:function(VarIds,VarValues){var len=VarIds.length;for(var i=0;i<len;i++){var validStruct=gx.fn.vStructForVar(VarIds[i]);if(validStruct&&validStruct.v2v){validStruct.v2v(VarValues[i])}else{eval(VarIds[i]+'="'+VarValues[i]+'"')}}},setControlValue:function(c,a,b){c=gx.csv.ctxControlId(c);this.setControlValueAny(c,a,b)},setControlValueAny:function(b,f,h){this.persistGridControlValue(b,f);var g=gx.O.getValidStructFld(b);var c=gx.dom.el(b);if(g&&(g.type=="dtime"||g.type=="date")){if(f===""){f=gx.date.nulldate_toc(g.len,g.dec)}else{if(typeof(f)=="string"){f=new gx.date.gxdate(f)}}}if(f instanceof gx.date.gxdate){g=gx.O.getValidStructFld(b);if(!gx.lang.emptyObject(g)){var a="";if(g.type=="dtime"&&f.HasTimePart){a=f.getTimeString(g.dec>=4,g.dec>=8)}var d=gx.dateFormat;if(g.dp!=undefined&&g.len>8&&gx.dateFormat.indexOf("Y4")==-1){d=d.replace("Y","Y4")}if(g.len>0){f=f.getStringWithFmt(d)+((f.HasTimePart)?" "+a:"")}else{f=(f.HasTimePart)?a:""}}}else{if(gx.lang.instanceOf(f,Number)||(typeof(gx.num.dec)!="undefined"&&f instanceof gx.num.dec.bigDecimal)){g=gx.O.getValidStructFld(b);if(!gx.lang.emptyObject(g)&&g.pic!=undefined){f=gx.num.formatNumber(f,g.dec,g.pic,g.len,g.sign,false)}}else{if(typeof(f)=="string"&&c!=null&&c.nodeName=="SPAN"){g=gx.O.getValidStructFld(b);if(!gx.lang.emptyObject(g)&&g.isPwd!=undefined){f=gx.text.formatString(f,g.len,g.isPwd)}}}}var j=h||0;if((c!=null)&&(c.nodeName!="SPAN")){this.setControlValue_impl(c,f,h)}else{gx.fn.setHidden(b,f)}var e=b;if((c!=null)&&(c.nodeName=="SPAN")){e=c}this.setControlValue_span_safe(e,f,h)},setDecimalValue:function(d,a,c,b){this.setControlValue(d,a)},toDecimalValue:function(a,c,b){return gx.num.parseFloat(a,c,b)
},toDatetimeValue:function(a,b){return new gx.date.gxdate(a,b)},setCheckBoxValue:function(d,a,b){try{d=gx.csv.ctxControlId(d);var c=gx.dom.form()[d];if(c==null){c=gx.dom.byId(d)}if(c){c.checked=(a.toString()==b.toString());c.value=a}}catch(f){gx.dbg.logEx(f,"gxfrmutl.js","setCheckBoxValue")}},persistGridControlValue:function(d,a,f){var e=d.lastIndexOf("_");if(e!=-1){var h;if(f){h=f}else{h=gx.O.getValidStructFld(d.substring(0,e))}if(h&&h.gxgrid){var c=d.substring(e+1);if(c.length>4){var g=c.substring(4,c.length);var b=gx.O.getGrid(h.gxgrid.gridName+"_"+g);if(b){b.persistControlValue(d,a,h)}}else{h.gxgrid.persistControlValue(d,a,h)}}}},setControlValue_span_safe:function(c,a,b){if(typeof(c)=="string"){c=gx.dom.el("span_"+c)}if(c!=null){if(c.nodeName!="SPAN"){var d="span_";if(typeof(c)=="string"){d+=c}else{d+=gx.dom.id(c)}c=gx.dom.byId(d)}this.setControlValue_fmt(c,a,b)}},setControlValue_fmt:function(d,b,c){try{if(d!=null){if(c==1){var g=d.getAttribute("gxlink");if(!gx.lang.emptyObject(g)){if(d.firstChild!=null&&d.firstChild.nodeName=="A"){d=d.firstChild}}gx.html.setInnerHtml(d,b,true)}else{if(c==0&&typeof(b)=="string"){b=b.replace(/ +/g," ")}var a=d;while(d.firstChild!=null&&d.firstChild.nodeName!="#text"){d=d.firstChild}if(c==0&&(d.firstChild==null||d.firstChild.nodeName!="#text")){gx.html.setInnerText(a,b,c)}else{gx.html.setInnerText(d,b,c)}}}}catch(f){gx.dbg.logEx(f,"gxfrmutl.js","setControlValue_fmt")}},setControlValue_impl:function(c,a,b){if(typeof(c)=="string"){c=gx.dom.el(c)}if(a instanceof gx.date.gxdate){a=a.getString()}if(c!=null){if((c!=null)&&(typeof(c.length)!="undefined")&&(typeof(c[0])!="undefined")&&(c[0].type=="radio")){this.setRadioValue(c,a);return}if(c.type=="text"||c.type=="textarea"){c.value=gx.lang.decodeValue(a)}else{if(c.value!=undefined){c.value=a}else{this.setControlValue_span_safe(c,a,b)}}}},setGridComboBoxValue:function(c,a,b){this.setComboBoxValue(c+"_"+a,b)},setComboBoxValue:function(c,m){var d=gx.util.browser.isIE();c=gx.csv.ctxControlId(c);var g=gx.dom.byId(c);if(!g){return}var a="";var j=gx.O.getValidStructFld(c);if(!gx.lang.emptyObject(j)){a=j.type}if(a=="int"){m=gx.text.trim(m)}else{if(a=="date"&&m instanceof gx.date.gxdate){m=m.getStringWithFmt("Y4MD")}else{if(a!="decimal"){m=gx.text.rtrim(m)}}}var o=m;var f=false;try{var k=g.options.length;var n;for(var h=0;h<k;h++){var b=g.options[h];if((a=="decimal"&&gx.num.parseFloat(b.value)==m)||(b.value==m)){if(typeof(b.innerText)!="undefined"){o=b.innerText}else{o=b.text}g.selectedIndex=h;f=true;b.setAttribute("selected","selected");n=b;if(d){break}}else{if(!d){b.removeAttribute("selected")}}}if(n&&n.value!=g.value&&gx.util.browser.isFirefox()){gx.dom.redrawControl(g)}if(!f){g.selectedIndex=0}if(j.grid>0){this.persistGridControlValue(c,m,j)}}catch(l){gx.dbg.logEx(l,"gxfrmutl.js","setComboBoxValue")}this.setControlValue_span_safe(c,o,0)},loadComboBox:function(b,a){this.setComboValues(b,a)},setGridComboValues:function(f,e){var a=this.controlGridId(f);if(a==0){this.setComboValues(f,e)
}else{for(var c=1;c<999;c++){var b=gx.text.padr(c.toString(),4,"0");var d=gx.dom.el(f+"_"+b);if(d==null){break}this.setComboValues(d.name,e)}}},setComboValues:function(g,e){var d=gx.dom.el(g);if(d==null){return}var b="";if(d.selectedIndex!=-1){b=d.options[d.selectedIndex].value}while(d.options.length>e.length){d.remove(d.options.length-1)}while(e.length>d.options.length){var f=document.createElement("OPTION");d.options.add(f)}var a=e.length;for(var c=0;c<a;c++){var f=d.options[c];f.value=e[c][0];f.text=e[c][1];if(f.value==b){d.selectedIndex=c}}if(d.options.length==0){d.selectedIndex=-1}else{if(d.selectedIndex==-1||d.selectedIndex>d.options.length-1){d.options[0].selected=true}}},getControlRefById:function(b){var a=this.validStruct(b);if(a){if(a.grid==0){return this.getControlRef(a.fld,false)}else{return this.getControlGridRef(a.fld,a.grid)}}return null},getControlRef:function(c,a){if(!a){c=gx.csv.ctxControlId(c)}if(c=="FORM"){return document}var b=gx.dom.el(c);if(b!=null){return b}b=gx.dom.el("span_"+c);if(b!=null){return b}b=gx.dom.el("Object_"+c);if(b!=null){return b}b=gx.dom.el("_"+c);if(b!=null){return b}return null},getControlRef_list:function(c){var a=gx.dom.byName(c);if(a!=null){return a}var b=gx.dom.byId(c);if(b!=null){return[b]}return null},screen_CtrlRef:function(b){var a=this.getControlGridRef(b,this.controlGridId(b));if(!gx.lang.emptyObject(a)){if(a.type=="hidden"){a=gx.dom.el("span_"+gx.dom.id(a))}return a}return null},screen_CtrlId:function(a){return this.getControlGridId(a,this.controlGridId(a))},getControlGridId:function(b,d,f){b=gx.csv.ctxControlId(b);var a=gx.dom.el(b);if(a){return b}try{if(d==0){return b}if(f==undefined){f=this.currentGridRow(d)}return b+"_"+f}catch(c){gx.dbg.logEx(c,"gxfrmutl.js","getControlGridId")}},getControlGridRef:function(b,d,f){b=gx.csv.ctxControlId(b);var a=gx.dom.el(b);if(a){return a}try{if(d==0){return gx.dom.el(b)}if(f==undefined){f=this.currentGridRow(d)}return gx.dom.el(b+"_"+f)}catch(c){gx.dbg.logEx(c,"gxfrmutl.js","getControlGridRef")}},setCurrentGridRow:function(c,a){if(a!="0000"){try{return gx.currentRows[c]=a}catch(b){gx.dbg.logEx(b,"gxfrmutl.js","setCurrentGridRow")}}return undefined},currentGridRowImpl:function(b){try{return gx.currentRows[b]}catch(a){gx.dbg.logEx(a,"gxfrmutl.js","currentGridRowImpl")}return undefined},currentGridRow:function(a){var b=this.currentGridRowImpl(a);return(b==undefined)?"0001":b},gridDuplicateKey:function(c){var a=gx.fn.validStruct(c);if(a!=undefined){var b=a.gxgrid;if(b!=null){b=b.updateControlValue(a,true);if(b){return b.gxHasDuplicateKey()}}}return false},firstGridControl:function(c){var d=gx.fn.controlIds();var a=d.length;for(i=0;i<a;i++){var b=gx.fn.validStruct(d[i]);if(b!=undefined&&b.grid==c){return d[i]}}return -1},lastGridControl:function(b){var c=gx.fn.controlIds();for(i=c.length-1;i>=0;i--){var a=gx.fn.validStruct(c[i]);if(a!=undefined&&a.grid==b){return c[i]}}return -1},getGridDecimalValue:function(d,a,c,b){return this.getDecimalValue(d+"_"+a,c,b)},getGridIntegerValue:function(c,a,b){return this.getIntegerValue(c+"_"+a,b)
},getGridControlValue:function(b,a){return this.getControlValue(b+"_"+a)},getGridCheckBoxValue:function(d,a,b,c){return this.getCheckBoxValue(d+"_"+a,b,c)},getCheckBoxValue:function(d,a,c){d=gx.csv.ctxControlId(d);var b=gx.dom.form()[d];if(b==null){ControlList=gx.dom.byName(d);if(ControlList!=null){b=ControlList[0]}}if(b==null){return 0}if(b.checked){return a}return c},getControlValue:function(a,b){return this.getControlValue_impl(gx.csv.ctxControlId(a),b)},getControlValue_impl:function(a,f){try{var b=gx.dom.el(a);if(b!=null){var d=gx.O.getValidStructFld(gx.dom.id(b));if((b.type=="hidden")||(b.type=="text")||(b.type=="textarea")||(b.type=="checkbox")){return b.value}if(b.type=="radio"){var j=gx.fn.getRadioValue(gx.dom.byName(a));if(d&&d.type=="boolean"){return gx.lang.gxBoolean(j)}return j}if(b.nodeName=="SELECT"&&b.options.length>0){if(b.selectedIndex!=-1){return(f=="screen")?b.options[b.selectedIndex].text:b.options[b.selectedIndex].value}else{return(f=="screen")?b.options[0].text:b.options[0].value}}if(!gx.lang.emptyObject(d)&&(d.type!="date")&&(d.type!="dtime")&&(d.type!="bits")){return b.value}if(b.nodeName=="IMG"){return b.src}}b=gx.dom.el("span_"+a);if(b!=null){var k=gx.fn.getHidden(a);if(k!=undefined){return k}else{return gx.fn.getControlValue_span(b)}}b=gx.dom.form()[a];if(b!=null){return this.getControlValueInt(b)}b=gx.dom.byId("_"+a);if(b!=null){return b.value}ControlList=gx.dom.byName(a);if(ControlList&&ControlList.length==0){ControlList=gx.dom.byName("_"+a)}if(ControlList!=null){var g=ControlList.length;for(var c=0;c<g;c++){b=ControlList[c];if(b!=null){return this.getControlValueInt(b)}}b=ControlList[0];if(b){return b.value}}if(b==null){return gx.fn.getHidden(a)}}catch(h){gx.dbg.logEx(h,"gxfrmutl.js","getControlValue_impl")}return""},setRadioValue:function(e,b){e=gx.csv.ctxControlId(e);var d=gx.dom.byName(e);if(d==null){return}var a=d.length;for(var c=0;c<a;c++){if(gx.text.ltrim(d[c].value)==gx.text.ltrim(b)){d[c].checked=true;return}}},getRadioValue:function(c){var a=c.length;for(var b=0;b<a;b++){if(c[b].checked){return c[b].value}}return""},getControlValueInt:function(b){if((b.length!=undefined)&&(b[0].type=="radio")){return this.getRadioValue(b)}if(b.type=="checkbox"){return b.checked}if(b.tagName=="SPAN"){var a=gx.fn.getHidden(gx.dom.id(b));if(a!=undefined){return a}else{return gx.fn.getControlValue_span(b)}}return b.value},getControlValue_span:function(a){while(a&&!a.nodeValue){a=a.childNodes[0]}if(a&&a.nodeValue){return a.nodeValue}return""},getDateValue:function(b){try{var a=gx.fn.getHidden(gx.csv.ctxControlId(b));if(!gx.lang.emptyObject(a)){return new gx.date.gxdate(a,"Y4MD")}return new gx.date.gxdate(this.getControlValue(b),gx.dateFormat)}catch(c){gx.dbg.logEx(c,"gxfrmutl.js","getDateValue")}return""},getIntegerValue:function(c,a){var b=0;var d=this.getControlValue(c);if(typeof(d)!="undefined"){d=d.toString()}else{d=""}if(d.length<gx.num.maxNumericPrecision()||typeof(gx.num.dec)=="undefined"){b=gx.num.parseInt(d,10,a)}else{b=new gx.num.dec.bigDecimal(d).setScale(0,gx.num.dec.ROUND_UP).toString()
}return isNaN(b)?0:b},getDecimalValue:function(c,b,a){var d=gx.num.parseFloat(this.getControlValue(c),b,a);return isNaN(d)?0:d},getBlobValue:function(b){var a=gx.dom.el("Object_"+b);if(a!=null){if(a.data){return a.data}}else{a=gx.dom.el("Link_"+b);if(a!=null){return a.href}}return""},getVarControlMap:function(a){for(var c in gx.O.VarControlMap){if(typeof(c)!="function"){var b=gx.O.VarControlMap[c];if(b.id==a||(gx.O.CmpContext+b.id)==a){return c}}}return null},getVarControlMapForVar:function(b){for(var a in gx.O.VarControlMap){if(typeof(a)=="string"&&a==b){return gx.O.VarControlMap[a]}}return null},v2cMap:function(c){var b=this.getVarControlMapForVar(c);if(b!=null){var a="";if(typeof(b.grid)=="number"&&b.grid!=0){a="_"+gx.fn.currentGridRowImpl(b.grid)}gx.fn.setHidden(gx.O.CmpContext+b.id+a,gx.O[c])}},c2vMap:function(c){var b=this.getVarControlMapForVar(c);if(b!=null){var a="";if(typeof(b.grid)=="number"&&b.grid!=0){a="_"+gx.fn.currentGridRowImpl(b.grid)}gx.O[c]=gx.fn.getHidden(gx.O.CmpContext+b.id+a)}},depsToVars:function(b){for(var a=0;a<b.length;a++){var d=b[a];var c=gx.fn.vStructForVar(d);if(!gx.lang.emptyObject(c)&&typeof(c.c2v)=="function"){c.c2v()}else{this.c2vMap(d)}}},verticalFormula:function(o,j,f,r,p,e){var n=gx.fn.vStructForVar(o);if(!gx.lang.emptyObject(n)){n.v2c()}else{this.v2cMap(o)}var l=gx.fn.currentGridRowImpl(f);var d=gx.fn.getGridObj(f);var b=0;var a=false;var k=d.grid.rows.length;for(var g=0;g<k;g++){var m=d.grid.rows[g];var c=m.gxDeleted();var h=m.gxExists();var q=m.gxIsMod();if(!c&&(h||q)){gx.fn.setCurrentGridRow(f,m.gxId);if(e&&e.length>0){this.depsToVars(e)}else{if(!gx.lang.emptyObject(n)&&typeof(n.c2v)=="function"){n.c2v()}else{this.c2vMap(o)}}if(r.call(gx.O)){a=true;b+=p()}}}gx.fn.setCurrentGridRow(f,l);if(e&&e.length>0){this.depsToVars(e)}else{if(!gx.lang.emptyObject(n)&&typeof(n.c2v)=="function"){n.c2v()}else{this.c2vMap(o)}}if(!a){b=j}return b},sumFrm:function(f,a,d,c,g,b,e){return gx.fn.verticalFormula(f,a,g,b,function(){return gx.num.parseFloat(gx.O[f],d,c)},e)},countFrm:function(d,a,e,b,c){return gx.fn.verticalFormula(d,a,e,b,function(){return 1},c)},serialRule:function(e,h,b,c,j){j=j||gx.O;var f=gx.fn.currentGridRow(b);var a=gx.fn.getGridRowMode(gx.fn.gridLvl(b),b);if(a!="INS"||gx.fn.isNewRow(b,f)==false){return j[e]}gx.fn.setNewRow(b,f,false);j[h]=j[e]+c;var g=gx.fn.vStructForVar(h);if(g){g.v2c()}var d=j.VarControlMap[e];if(d){gx.fn.setControlValue(d.id,j[h])}return j[h]},setReturnParms:function(f,d,c){try{if(f&&d&&c){var k=d.length;if(k==c.length){gx.setGxO(f.CmpContext,f.IsMasterPage);var m=null;for(var h=0;h<k;h++){var g=d[h];if(g){var b=c[h];var j=gx.fn.vStructForVar(g);if(j){var a=gx.fn.screen_CtrlRef(gx.csv.ctxControlId(j.fld));if(gx.fn.isAccepted(a)){m=a}if(j.v2v){j.v2v(b);j.v2c()}}else{f.setVariable(g,b)}}}if(m){gx.fn.setFocus(m)}}}}catch(l){gx.dbg.logEx(l,"gxfrmutl.js","setReturnParms")}},checkPopupFocus:function(c){if(gx.popup.ispopup()){var a=gx.popup.getPopup();if(a&&a.frameDocument){var b=(c.ownerDocument?c.ownerDocument:c.document);
if(b.URL!=a.frameWindow.location.href){a.setFocusFirst();return false}}}return true},persistControlProperty:function(c,d,b){var a=gx.fn.screen_CtrlId(gx.csv.ctxControlId(c));if(!gx.usrPtys[a]){gx.usrPtys[a]={}}gx.usrPtys[a][d.toLowerCase()]=b},setCtrlProperty:function(c,d,a){if(!gx.O){gx.fx.obs.addObserver("gx.onready",this,gx.fn.setCtrlProperty.closure(this,arguments),{single:true});return}var b=null;if(c=="FORM"){b=document}else{b=gx.fn.screen_CtrlRef(gx.csv.ctxControlId(c))}if(b==null){return}this.persistControlProperty(c,d,a);this.setCtrlPropertyImpl(b,d,a)},setGridCtrlProperty:function(c,e,a){var b=gx.fn.screen_CtrlRef(c);if(b==null){return}this.setCtrlPropertyImpl(b,e,a);var d=b.parentElement;if(d.tagName!="TD"){return}this.persistControlProperty(c,e,a);this.setCtrlPropertyImpl(d,e,a)},setCtrlPropertyImpl:function(s,f,k){if(s==null){return}switch(f){case"Caption":this.setCtrlCaption(s,k);break;case"Tooltiptext":s.title=k;break;case"Visible":if(s.nodeName=="INPUT"&&s.type=="button"){this.setButtonVisibility(s,!this.propertyValueFalse(k))}else{if(s.nodeName=="INPUT"&&s.type=="checkbox"){if(s.parentNode.nodeName=="SPAN"){s=s.parentNode}}var h=this.propertyValueFalse(k);if(h){var p=gx.dom.el("span_"+s.id);this.setVisible(s,!h);if(p){this.setVisible(p,!h)}gx.fn.showHideDatepicker(s,!h)}else{var p=this.getRONode(s.id,true);var d=(s.gxusrdisabled)?s.gxusrdisabled:false;if(p){this.setVisible(p,d)}this.setVisible(s,!d);gx.fn.showHideDatepicker(s,!d)}}gx.fn.checkAttachedProperty(s.id,f,k);break;case"Enabled":var h=this.propertyValueFalse(k);if(s.type=="text"||s.type=="textarea"||s.tagName=="SELECT"){var p=this.getRONode(s.id,true);if(gx.fn.isVisible(s)||(p&&gx.fn.isVisible(p))){if(p){this.setVisible(p,h)}this.setVisible(s,!h);gx.fn.showHideDatepicker(s,!h)}gx.fn.checkAttachedProperty(s.id,f,k)}if(s.type=="hidden"){return}if(s.tagName=="SPAN"&&h){return}if(s.nodeName=="INPUT"&&s.type=="radio"){var e=gx.dom.byName(gx.dom.id(s));var o=e.length;for(var n=0;n<o;n++){this.setEnabledProperty(e[n],!h)}return}this.setEnabledProperty(s,!h);break;case"Class":this.setCtrlClass(s,k);break;case"Link":this.setCtrlLink(s,k);break;case"Linktarget":this.setCtrlLinkTarget(s,k);break;case"Backcolor":var b=gx.color.html(k);if(b&&s.gxGridName==undefined){s.style.backgroundColor=b.Html}break;case"Forecolor":var b=gx.color.html(k);if(b){s.style.color=b.Html}break;case"Fontbold":var h=this.propertyValueFalse(k);s.style.fontWeight=(h?"normal":"bold");break;case"Fontitalic":var h=this.propertyValueFalse(k);s.style.fontStyle=(h?"normal":"italic");break;case"Fontunderline":var h=this.propertyValueFalse(k);s.style.textDecoration=(h?"none":"underline");break;case"Fontstrikethru":var h=this.propertyValueFalse(k);s.style.textDecoration=(h?"none":"line-through");break;case"Fontname":s.style.fontFamily=k;break;case"Fontsize":s.style.fontSize=k+"pt";break;case"Filetype":this.setBlobFiletype(s,k);break;case"URL":this.setBlobUrl(s,k);break;case"Bitmap":s.src=k;break;case"Jsonclick":s.jsevent=k;
break;case"Source":var j=k;var m=j.indexOf("?");if(m>0){j=j.substring(0,m)}if(j.indexOf(":")==-1&&j.indexOf("/")==-1){s.src=gx.ajax.objectUrl(k)}else{s.src=gx.util.resourceUrl(k,true)}gx.evt.attach(s,"load",gx.dom.autofitIFrame);break;case"Values":if((s.tagName=="SELECT")||(s.tagName=="SPAN")){k=gx.json.evalJSON(k);if(s.tagName=="SELECT"){if(k.isset!=false){gx.fn.loadComboBox(s.id,k.v);gx.fn.setComboBoxValue(s.id,k.s)}}else{var l=s.id.substring(5);var g="";var q=k.s;var r=gx.O.getValidStructFld(l);if(!gx.lang.emptyObject(r)){g=r.type}if(g=="int"){q=gx.text.trim(q)}else{q=gx.text.rtrim(q)}k.s=q;gx.fn.setControlValue_span_safe(l,gx.fn.selectedDescription(k))}}break;case"Width":if(s.width){s.width=k}s.style.width=this.convertSize(k);break;case"Height":if(s.height){s.height=k}s.style.height=this.convertSize(k);break}var c=gx.dom.id(s);if(c){var a=c+"_"+f;if(gx.fn.isHidden(a)){gx.fn.setHidden(a,k)}}},convertSize:function(a){if(gx.lang.instanceOf(a,Number)||(a.indexOf("%")==-1&&a.indexOf("px")==-1)){return a+"px"}else{return a}},setEnabledProperty:function(d,a){var c=gx.dom.id(d);if(gx.lang.gxBoolean(a)&&gx.fn.isAccepted(d,false)){return}if(gx.csv.validating==true){if(a&&gx.csv.validActivatedControl==null&&d!=gx.csv.lastControl){var b=gx.O.getValidStructId(c);if(b>gx.O.fromValid&&b<=gx.O.toValid){gx.csv.validActivatedControl=d}}}if(!a){gx.util.addOnce(gx.disabledControls,d,c)}else{delete gx.disabledControls[c]}d.gxusrdisabled=(!a);if(d.gxdisabled){if(d.gxdisabled==true){d.disabled=true}else{d.disabled=d.gxusrdisabled}}else{d.disabled=d.gxusrdisabled}this.setEnabled(d,a)},setEnabled:function(d,b){if(this.disabledAsSpan(d)){var a;var g;var c;try{if(d.type=="checkbox"){c=d.parentNode}if(d.type=="radio"){c=d.parentNode.parentNode.parentNode.parentNode}}catch(f){}if(gx.lang.booleanValue(b)){if(c&&c.className.indexOf("Readonly")==0){c.className=c.className.substring(8)}if(this.isVisible(d)){this.setVisible(d,1);a=this.getRONode(d.id,true);if(a){this.setVisible(a,0)}}}else{if(c&&c.className.indexOf("Readonly")<0){c.className="Readonly"+c.className}if(this.isVisible(d)&&d.type!="password"&&d.type!="image"){a=this.getRONode(d.id,true);if(a){this.setVisible(d,0);this.setVisible(a,1);this.setControlValue_span_safe(a,gx.fn.getControlValue(gx.dom.id(d),"screen")||d.value)}}}}},disabledAsSpan:function(a){return(a.tagName!="IMG")},setVisible:function(b,a){b.style.display=(a==0)?"none":this.displayByType(b.nodeName)},getRONode:function(f,b){if(gx.lang.emptyObject(f)){return null}var e=gx.dom.byId(f);var d="span_"+f;var a=gx.dom.byId(d);if(a!=null){return a}if(!b||e==null){return null}var c=document.createElement("SPAN");c.setAttribute("id",d);this.setVisible(c,false);c.className="Readonly"+e.className;c.appendChild(document.createTextNode(e.value));e.parentNode.insertBefore(c,e);return c},showHideDatepicker:function(b,a){var c=gx.dom.el(gx.dom.id(b)+"_dp_trigger");if(c){c.style.display=(a)?"inline":"none"}},getGridCtrlProperty:function(a,b,g){try{if(a!=0){var f=this.getGridObj(a);
if(f){var c=f.grid.getColumnByHtmlName(b);if(c){return c[g.toLowerCase()]}}}else{return this.getCtrlProperty(b,g)}}catch(d){gx.dbg.logEx(d,"gxfrmutl.js","getGridCtrlProperty")}return""},getCtrlProperty:function(b,c){var a=this.screen_CtrlRef(b);if(a==null){return}return this.getCtrlProperty_impl(a,c)},getCtrlProperty_impl:function(b,c){if(b==null){return""}switch(c){case"Tooltiptext":return b.title;case"Visible":return b.style.display!="none";case"Enabled":return b.disabled==0;case"Class":return b.className;case"Backcolor":return gx.color.css(b.style.backgroundColor);case"Forecolor":return gx.color.css(b.style.color);case"Width":return gx.dom.dimensions(b).w;case"Height":return gx.dom.dimensions(b).h;case"Caption":return this.getCtrlCaption(b);case"Fontbold":return(b.style.fontWeight=="bold");case"Fontitalic":return(b.style.fontStyle=="italic");case"Fontunderline":return(b.style.textDecoration=="underline");case"Fontstrikethru":return(b.style.textDecoration=="line-through");case"Fontname":return b.style.fontFamily;case"Fontsize":var a=parseInt(b.style.fontSize);if(isNaN(a)){return 12}return a}},displayByType:function(a){switch(a){case"TABLE":if(!gx.util.browser.isIE()||(gx.util.browser.ieVersion()>=8)){return"table"}return"block";case"P":case"DIV":return"block"}return"inline"},setCtrlCaption:function(c,a){try{switch(c.tagName){case"SPAN":case"DIV":case"FIELDSET":var b=c.getAttribute("gxformat");if(b==null){b=0}gx.fn.setControlValue_fmt(c,a,b);return;case"INPUT":if(c.type!="checkbox"){c.value=a}return}if(c.nodeName=="#document"){c.title=a}}catch(d){gx.dbg.logEx(d,"gxfrmutl.js","setCtrlCaption")}},getCtrlCaption:function(b){switch(b.tagName){case"SPAN":case"DIV":case"FIELDSET":var a=b.getAttribute("gxformat");if(a!=null&&a=="1"){return b.innerHTML}else{while(b.firstChild!=null&&b.firstChild.nodeName!="#text"){b=b.firstChild}if(typeof(b.innerText)!="undefined"){return b.innerText}return b.text}case"INPUT":if(b.type!="checkbox"){return b.value}break;default:return""}},propertyValueFalse:function(a){if(typeof(a)=="string"){a=a.toLowerCase();if((a=="false")||(gx.num.parseFloat(a)==0)){return true}}return(a==0)},setButtonVisibility:function(d,c){var f=c?"":"none";var a=d.parentNode;if(!gx.lang.emptyObject(a)&&a.nodeName=="SPAN"){a.style.display=f;var g=a.parentNode;if(!gx.lang.emptyObject(g)&&g.nodeName=="SPAN"){g.style.display=f;var b=g.parentNode;if(!gx.lang.emptyObject(b)&&b.nodeName=="SPAN"){b.style.display=f;var e=b.parentNode;if(!gx.lang.emptyObject(e)&&e.nodeName=="SPAN"){e.style.display=f}}}}d.style.display=f},setBlobValue:function(c,a){var b=gx.dom.el(c)||gx.dom.el("Object_"+c);this.setBlobUrl(b,a)},setBlobFiletype:function(c,a){if(c!=null){var b=c;if(b.nodeName=="INPUT"&&b.type=="file"){b=gx.dom.el("Object_"+c.id)}if(b!=null){a=gx.util.getContentType(a);this.setObjectCtrlType(b,a)}}},setBlobUrl:function(d,a){if(!a.match(/^[a-z]:[\S]*/i)){if(d!=null){var c=d;if(c.nodeName=="INPUT"&&c.type=="file"){c=gx.dom.el("Object_"+d.id)}if(c!=null){var b=gx.util.getContentTypeFromExt(a);
c=this.setObjectCtrlType(c,b)}if(c!=null){if(c.tagName=="IMG"){if(a==""){a=gx.util.resourceUrl(gx.basePath+gx.staticDirectory+"blank.jpg",true)}c.src=a}else{if(a==""){a="about:blank"}c.data=a;this.resizeObject(c)}gx.dom.redrawControl(c)}else{c=gx.dom.el("Link_"+d.id);if(c!=null){if(a!=""){c.style.display="block"}else{c.style.display="none"}c.href=a}}}}},setObjectCtrlType:function(a,g){var f=a;if(a.nodeName=="IMG"&&g.indexOf("image/")==0){return f}if((a.type!=g)||(a.nodeName=="OBJECT"&&g.indexOf("image/")==0)){if(g.indexOf("image/")==0){f=gx.html.nodesFromText('<img id="'+a.id+'">')[0]}else{f=gx.html.nodesFromText('<object id="'+a.id+'" type="'+g+'">')[0]}if(f){try{for(var c in a.attributes){if(c!="id"&&c!="type"&&c!="implementation"){if(a[c]){try{f[c]=a[c]}catch(j){gx.dbg.logEx(j,"gxfrmutl.js","setObjectCtrlType")}}}}}catch(j){gx.dbg.logEx(j,"gxfrmutl.js","setObjectCtrlType")}var b=a.parentNode;if(b){var d=null;var h=b.childNodes.length;for(i=0;i<h;i++){if(b.childNodes[i]==a){if(i<h-1){d=b.childNodes[i+1]}break}}b.removeChild(a);if(d!=null){b.insertBefore(f,d)}else{b.appendChild(f)}}}}return f},resizeObject:function(b){var a=gx.lang.emptyObject;if(!a(b.data)&&b.data!="about:blank"){if(a(b.width)&&a(b.height)&&a(b.style.width)&&a(b.style.height)){b.style.width="200px";b.style.height="200px"}}},checkboxClick:function(a,d,c,b){if(d.checked){d.value=c}else{d.value=b}var e=gx.fn.validStruct(a);if(e&&typeof(e.c2v)=="function"){e.c2v()}},setCtrlClass:function(b,a){if(b==null){return}b.className=a},setCtrlLink:function(c,a){if(c==null){return}if(a==""){this.unsetCtrlLink(c);return}var b=c.firstChild;if(b&&b.tagName=="A"){b.href=a}else{var e=c.parentNode;if(e.tagName=="A"){e.href=a}else{var d=document.createElement("A");d.href=a;if(b&&b.nodeName=="#text"){d.innerHTML=b.nodeValue;c.replaceChild(d,b)}else{e.replaceChild(d,c);d.appendChild(c)}}}},unsetCtrlLink:function(b){if(b==null){return}var c=b.parentNode;if(c.tagName=="A"){var a=c.firstChild;ParentTag2=c.parentNode;if(ParentTag2!=null){while(a!=null){ParentTag2.insertBefore(a,c);a=c.firstChild}ParentTag2.removeChild(c)}}},setCtrlLinkTarget:function(a,b){if(a==null){return}if(a.nodeName=="SPAN"&&a.firstChild){a=a.firstChild}if(a.nodeName=="A"){if(a.setAttribute){a.setAttribute("target",b)}else{a.target=b}}},isVisible:function(a){try{while(a){if(a.style&&(a.style.visibility=="hidden"||a.style.display=="none")){return false}a=a.parentNode}}catch(b){gx.dbg.logEx(b,"gxfrmutl.js","isVisible")}return true},gridRowIsMod:function(h,c){var b=this.gridObjByLvl(h);var f=null;if(b){var f=b.grid.getRowByGxId(c);if(f){return f.gxIsMod()}return true}var a=false;try{var g=this.getControlValue("nIsMod_"+h+"_"+c);a=(g==1)}catch(d){a=false}return a},gridObjByLvl:function(d){var b=gx.O.Grids;var a=b.length;for(var c=0;c<a;c++){if(b[c].gridLvl==d){return b[c]}}return null},forceEnableControls:function(f){for(var c in gx.disabledControls){c=this.getControlRef_list(c);var a=c.length;for(var b=0;b<a;b++){try{if(c[b].type!="button"&&c[b].type!="submit"){c[b].disabled=f
}}catch(d){gx.dbg.logEx(d,"gxfrmutl.js","forceEnableControls")}}}},alert:function(c,b){try{var a=gx.util.balloon.getNew(c.id);a.setError(b);a.show();gx.csv.invalidForcedCtrl=c}catch(d){alert(b)}},getGridRowMode:function(b,d){var e=this.currentGridRow(d);var a=this.rowIsRemoved(d,e);var c=this.getControlValue("nRcdExists_"+b+"_"+e);if(a=="1"){return"DLT"}if(c=="0"){return"INS"}return"UPD"},rowIsRemoved:function(c,d){var a=this.getGridObj(c);if(a!=null){var b=a.grid.getRowByGxId(d);if(b){return b.gxDeleted()}}return"0"},getGridObj:function(a){return gx.O.getGridById(a)},changeCmpContext:function(){try{gx.O.SetStandaloneVars()}catch(a){gx.dbg.logEx(a,"gxfrmutl.js","changeCmpContext")}},initOld:function(a){if(gx.oldValues[a.id]==undefined){gx.oldValues[a.id]=a.value}},setFocusOnError:function(c){var a=gx.fn.controlGridId(c);var d=gx.csv.ctxControlId(c);var b=null;if(a==0){b=gx.dom.el(d)}else{b=gx.fn.getControlGridRef(d,a)}if(b!=null){gx.O.AnyError=1;gx.csv.anyError=true;b.setAttribute("gxvalid","0");gx.fn.setFocus(b)}},usrSetFocus:function(b){b=gx.csv.ctxControlId(b);if(gx.csv.validating==true){gx.usrFocusControl=b}else{var a=gx.dom.el(b);if(a!=null){gx.fn.setFocus(a)}}},setFocus:function(a){if(a){try{if(gx.popup.ispopup()){if(gx.util.browser.isIE()&&window.parent.document.selection){window.parent.document.selection.empty()}else{if(window.parent.gx.csv.lastControl&&window.parent.gx.csv.lastControl.blur){window.parent.gx.csv.lastControl.blur()}}}}catch(b){gx.dbg.logEx(b,"gxfrmutl.js","setFocus")}try{try{if(!gx.lang.emptyObject(a.id)){a=gx.dom.byId(a.id);if(!a){return}gx.fn.setFocusSafe(a)}else{gx.fn.setFocusSafe(a)}}catch(b){gx.fn.setFocusSafe(a)}gx.fn.setSelection(a);a.forcedFocus=true}catch(b){gx.dbg.logEx(b,"gxfrmutl.js","setFocus")}}},setFocusSafe:function(a){if(a){if(gx.util.browser.isFirefox()){gx.lang.doCallTimeout(a.focus,a,[],100)}else{a.focus()}}},setFocusOnload:function(){var c=null;var a=gx.pO.getUserFocus();if(!gx.lang.emptyObject(a)){if(a=="notset"){return}var b=gx.pO.getUserControl(gx.uc.userControlContainerId(a));if(!gx.lang.emptyObject(b)){b.setFocusBase();return}else{gx.csv.userFocus=gx.fn.getControlRef(a)}}if(gx.csv.userFocus=="notset"){return}c=gx.csv.userFocus;if(!gx.fn.isAccepted(c)){if(gx.csv.lastActiveControl&&gx.fn.isAccepted(gx.csv.lastActiveControl)){c=gx.csv.lastActiveControl}else{var d=gx.fn.firstAcceptedControl(gx.popup.ispopup());c=d}}try{if(c){gx.csv.lastControl=c;gx.csv.setFocusOnload=true;if(gx.fn.isAccepted(c)){gx.fn.setFocus(c)}else{gx.popup.setFocus()}gx.csv.setFocusOnload=false}else{gx.popup.setFocus()}}catch(f){gx.dbg.logEx(f,"gxfrmutl.js","setFocusOnload")}},setSelection:function(a){if(a&&gx.fn.isVisible(a)){try{gx.csv.lastControl=a;if((a.type=="text"||a.type=="password"||a.type=="file")&&a.select){a.select()}else{if(a.nodeName=="TEXTAREA"||a.nodeName=="SELECT"){a.focus();if(a.select){a.select()}}}}catch(b){gx.dbg.logEx(b,"gxfrmutl.js","setSelection")}}},isAccepted:function(c,b){var b=b==undefined||b;var f=true;if(c!=null&&c.type!=undefined&&c.type!="hidden"&&gx.fn.isVisible(c)&&c.disabled==false&&(c.readOnly==null||c.readOnly==false)){if(b){var d=gx.dom.id(c);
var e=gx.O.getValidStructFld(d);var a=gx.getVar("Gx_mode");if(gx.csv.lastGrid>0){gx.setVar("Gx_mode",gx.fn.getGridRowMode(gx.fn.gridLvl(gx.csv.lastGrid),gx.csv.lastGrid))}if(!gx.lang.emptyObject(e)&&e.nac){f=(e.nac.call(gx.O)==false)}else{f=true}gx.setVar("Gx_mode",a)}}else{f=false}return f},enterHasFocus:function(){gx.csv.lastControl;if(gx.csv.lastControl==null){return false}return gx.evt.isEnterEvtCtrl(gx.csv.lastControl)},skipFocus:function(h){var f=gx.fn.getControlIndex(gx.csv.lastControl),d=f;var a=this.controlGridId(gx.csv.lastControl.id);var g=false;if(h&&gx.dom.hasClass(gx.csv.lastControl,"gx_newrow")){d=gx.csv.lastControl.gxControlIdx;g=true}if(d==-1){return true}var e=null;for(e=gx.fn.searchFocus(++d,true);;e=gx.fn.searchFocus(++d,true)){if(e==null||d==gx.dom.form().elements.length){d=-1}else{if(h){break}if(gx.evt.isEnterEvtCtrl(e)){break}if(e.nodeName=="INPUT"&&e.type!="submit"&&e.type!="button"&&e.type!="image"){break}}}if(!g&&a&&gx.O.isTransaction()){if(this.controlGridId(e.id)!=a){var c=gx.O.getGridById(a);var b=gx.dom.el(c.containerName+"_NewRow");e=b.parentNode;e.gxControlIdx=f}}gx.fn.setFocus(e)},getControlIndex:function(b){var a=gx.dom.form().elements.length-1;var c=0;el=this.controlIndex(b,c,a);return el},controlIndex:function(d,g,c){if(!document.all){return d.gxIndex}else{var f=gx.dom.form();var e=f.elements[g].sourceIndex;var a=f.elements[c].sourceIndex;var h=parseInt(g+((c-g)/2))+1;var b=f.elements[h].sourceIndex;if((g==c)&&(d.sourceIndex==e)&&(d.sourceIndex==a)){return g}if(d.sourceIndex==e){return g}if(d.sourceIndex==a){return c}if(d.sourceIndex==b){return h}if((d.sourceIndex>b)&&(d.sourceIndex<a)){return this.controlIndex(d,h+1,c-1)}if((d.sourceIndex>e)&&(d.sourceIndex<b)){return this.controlIndex(d,g+1,h-1)}}},searchFocus:function(b,a){if(a){return this.searchFocusFwd(b)}return this.searchFocusBack(b)},searchFocusBack:function(b){var c=gx.dom.form();for(var a=b;a>=0;a--){if(gx.fn.isAccepted(c.elements[a])){return c.elements[a]}}return null},searchFocusFwd:function(c){var d=gx.dom.form();var a=d.elements.length;for(var b=c;b<a;b++){if(gx.fn.isAccepted(d.elements[b])){return d.elements[b]}}return null},rowGridId:function(a){if(!a||!a.getAttribute){return null}var b=a.getAttribute("gxgridid");if(b!=null){return b}return gx.fn.rowGridId(a.parentNode)},controlRowId:function(a){if(!a||!a.getAttribute){return null}var b=a.getAttribute("gxrow");if(b!=null){return b}return gx.fn.controlRowId(a.parentNode)},controlGridId:function(b){try{var f=gx.fn.controlIds();var a=f.length;for(i=0;i<a;i++){var c=gx.fn.validStruct(f[i]);if(gx.O.isSameField(c,b)){return c.grid}}}catch(d){}return 0},oldGridId:function(b){try{var f=gx.fn.controlIds();var a=f.length;for(i=0;i<a;i++){var c=gx.fn.validStruct(f[i]);if(c!=undefined&&c.gxold==b){return c.grid}}}catch(d){gx.dbg.logEx(d,"gxfrmutl.js","oldGridId")}return 0},saveLvlOldParm:function(a,b){var c="no_mode";if(gx.csv.validatingGrid!=null){if(this.isLvlParmOld(gx.csv.lastGrid,a)){c=gx.fn.getGridRowMode(gx.fn.gridLvl(gx.csv.lastGrid),gx.csv.lastGrid)
}}else{if(this.isLvlParmOld(0,a)){c=gx.O.Gx_mode}}if(c=="no_mode"){return true}if((c=="UPD")||(gx.csv.validatingGrid==null)){window[a]=b;return true}return false},isLvlParmOld:function(f,a){try{var c=gx.O.getOldLvl(a);if(c>=0){if(f>0){var b=gx.fn.gridLvl(f);return(c<b)}return true}}catch(d){gx.dbg.logEx(d,"gxfrmutl.js","isLvlParmOld")}return false},gridLvl:function(d){try{var f=gx.fn.controlIds();var a=f.length;for(i=0;i<a;i++){var b=gx.fn.validStruct(f[i]);if(b!=undefined&&b.grid==d){return b.lvl}}}catch(c){gx.dbg.logEx(c,"gxfrmutl.js","gridLvl")}return 0},lvlGrid:function(f){try{var d=gx.fn.controlIds();var a=d.length;for(i=0;i<a;i++){var b=gx.fn.validStruct(d[i]);if(b!=undefined&&b.lvl==f){return b.grid}}}catch(c){gx.dbg.logEx(c,"gxfrmutl.js","lvlGrid")}return 0},vStructId:function(d){try{var c=gx.fn.controlIds();for(i=0;i<c.length;i++){var b=gx.fn.validStruct(c[i]);if(b!=undefined&&b.fld==d){return c[i]}}}catch(a){gx.dbg.logEx(a,"gxfrmutl.js","vStructId")}return 0},getVStruct:function(b,d){try{var c=null;if(d){c=[]}var h=gx.fn.controlIds();var a=h.length;for(i=0;i<a;i++){var g=gx.fn.validStruct(h[i]);if(g!=undefined&&b(g)){g.id=h[i];if(d){c.push(g)}else{return g}}}}catch(f){gx.dbg.logEx(f,"gxfrmutl.js","getVStruct")}return c},vStructForOld:function(a){return gx.fn.getVStruct(function(b){return b.gxold==a})},vStructForVar:function(a){return gx.fn.getVStruct(function(b){return b.gxvar==a})},vStructForVarWId:function(c,b){var e=gx.fn.getVStruct(function(g){return g.gxvar==c},true);var f=e[0];var a=e.length;if(a>1){for(var d=0;d<a;d++){f=e[d];if(f.id==b){break}}}return f},vStructForHC:function(a){return gx.fn.getVStruct(function(b){return b.hc==a})},firstCtrlAfterGrid:function(d,a){var c=gx.fn.lastCtrlId();for(var b=d;b<c;b++){var e=gx.fn.validStruct(b);if(e!=undefined&&e.grid!=a){return b}}return c},clearOldKeys:function(){gx.oldKeyValues=[]},oldKey:function(a){try{return gx.oldKeyValues[a]}catch(b){gx.dbg.logEx(b,"gxfrmutl.js","oldKey")}return""},oldGridKey:function(a,c){try{return gx.oldKeyValues[a+gx.fn.currentGridRow(c)]}catch(b){gx.dbg.logEx(b,"gxfrmutl.js","oldGridKey")}return""},setKey:function(a,b){if(a!=null){gx.oldKeyValues[a]=b}},unsetKey:function(a){if(a!=null){gx.oldKeyValues[a]=undefined}},setGridKey:function(a,b,c){if(a!=null){gx.oldKeyValues[a+gx.fn.currentGridRow(b)]=c}},unsetGridKey:function(a,b){if(a!=null){gx.oldKeyValues[a+gx.fn.currentGridRow(b)]=undefined}},removeGridRow:function(j,g){var b=gx.fn.rowIsRemoved(g,j);try{var h=gx.fn.controlIds();var a=h.length;for(i=0;i<a;i++){var d=gx.fn.validStruct(h[i]);if(d!=undefined&&d.grid==g){var c=gx.dom.el(d.fld+"_"+j);if(c!=null){c.gxdisabled=b}}}}catch(f){gx.dbg.logEx(f,"gxfrmutl.js","removeGridRow")}gx.csv.validGridRow(g,j)},controlIds:function(){return gx.O.getControlIds()},validStruct:function(a){return gx.O.getValidStruct(a)},lastCtrlId:function(c){if(c===true){var b=this.controlIds();for(var a=b.length-1;a>=0;a--){var d=this.validStruct(b[a]);if(d.v2v){return b[a]}}}else{return gx.O.getLastControlId()
}},lastMainLevelCtrlId:function(b,a){return(a==0&&b==this.lastCtrlId(true))},vStructsArray:function(){return gx.O.GXValidFnc},firstAcceptedControl:function(g){try{var f=gx.fn.vStructsArray();var j=gx.fn.controlIds();var a=j.length;for(var b=0;b<a;b++){var h=f[j[b]];if(h!=null){var d=gx.fn.getControlGridRef(h.fld,h.grid);if(d&&gx.fn.isAccepted(d)){if(g||(d.type!="submit"&&d.type!="image"&&d.type!="button"&&d.type!="fieldset")){return d}}}}}catch(c){gx.dbg.logEx(c,"gxfrmutl.js","firstAcceptedControl")}return null},setNewRow:function(c,a,b){if(gx.newRows[c]==null){gx.newRows[c]=[]}gx.newRows[c][a]=b},enableDisableDelete:function(){var a=gx.dom.el(gx.csv.cmpCtx+"BTN_DELETE");if(a!=null){gx.fn.setCtrlPropertyImpl(a,"Enabled",(gx.getVar("Gx_mode")=="INS")?0:1)}},setFocusAfterLoad:function(){if(gx.csv.validating==true){return}gx.csv.invalidateForm();gx.csv.onloadFocus=true;if(!gx.lang.emptyObject(gx.usrFocusControl)){gx.fn.setFocus(gx.dom.byId(gx.usrFocusControl));gx.usrFocusControl=""}else{if(!gx.lang.emptyObject(gx.csv.lastControl)){gx.fn.setFocus(gx.csv.lastControl)}else{gx.fn.setFocus(gx.fn.firstAcceptedControl())}}gx.csv.onloadFocus=false},isNewRow:function(c,a){try{return gx.newRows[c][a]}catch(b){return true}},disableCtrl:function(d){try{var c=gx.fn.getControlRef_list(d);if(c==null){return}var a=c.length;for(var b=0;b<a;b++){gx.fn.setCtrlPropertyImpl(c[b],"Enabled",0)}}catch(f){gx.dbg.logEx(f,"gxfrmutl.js","disableCtrl")}},refreshFormBC:function(a,b){try{var d=gx.O.getFormBC(a);if(typeof(d)!="undefined"){gx.O.bcToScreen(d,b);gx.setVar(a,b);gx.fn.setGridHidden(a,b);return true}}catch(c){gx.dbg.logEx(c,"gxfrmutl.js","refreshFormBC")}return false},isHidden:function(a){if(gx.http.viewState==null){gx.http.loadState()}return(typeof(gx.http.viewState[a])!="undefined")},getHidden:function(a){if(gx.http.viewState==null){gx.http.loadState()}return gx.http.viewState[a]},setHidden:function(a,b){if(gx.http.viewState==null){gx.http.loadState()}gx.http.viewState[a]=b},setGridHidden:function(a,b){var c=a;var d=gx.fn.oldGridId(a);if(d>0){c=a+"_"+gx.fn.currentGridRowImpl(d)}gx.fn.setHidden(c,b)},deleteHidden:function(a){if(gx.http.viewState){delete gx.http.viewState[a]}},setPostHiddens:function(b){for(var a in b){gx.fn.setGridHidden(a,b[a])}},filterHiddens:function(a,d){var b={};for(var c in d){if(c&&c.search(a)==0){b[c]=d[c]}}return b},setPostValues:function(c){if(!c){return}var a=gx.O;var f=c.length;for(var d=0;d<f;d++){var j=c[d];var h=j.CmpContext;var e=gx.lang.booleanValue(j.IsMasterPage);gx.setGxO(h,e);if(!gx.lang.emptyObject(gx.O)){for(var g in j){if(g=="CmpContext"||g=="IsMasterPage"){continue}if(typeof(j[g])=="object"){if(gx.fn.refreshFormBC(g,j[g])){continue}}if(typeof(j[g])!="function"){var k=gx.fn.vStructForVar(g);if(k){if(k.v2v){k.v2v(j[g]);k.v2c()}}else{if(g=="GX_FocusControl"){if((a.CmpContext==h)&&(a.IsMasterPage==e)){gx.usrFocusControl=j[g]}}else{var b=gx.fn.getVarControlMap(g);if(!gx.lang.emptyObject(b)){gx.setVar(b,j[g])}else{gx.setVar(g,j[g])}gx.fn.setGridHidden(g,j[g])
}}}}}}gx.setGxO(a.CmpContext,a.IsMasterPage)},setPostProperties:function(k){if(!k){return}var a=gx.O;var h=k.length;for(var f=0;f<h;f++){var e=k[f];var l=e.CmpContext;var g=gx.lang.booleanValue(e.IsMasterPage);gx.setGxO(l,g);if(!gx.lang.emptyObject(gx.O)){for(var c in e){if(c=="CmpContext"||c=="IsMasterPage"){continue}if(gx.uc.isUserControl(c)){gx.uc.setProperties(c,e[c])}else{if(typeof(e[c])!="function"){var b=gx.fn.getControlRef(c,true);for(var j in e[c]){if(typeof(e[c][j])=="object"){for(var d in e[c][j]){gx.fn.setCtrlPropertyImpl(b,d,e[c][j][d])}}else{gx.fn.setCtrlPropertyImpl(b,j,e[c][j])}if(j=="Filetype"||j=="URL"){b=gx.fn.getControlRef(c,true)}}}}}}}gx.setGxO(a.CmpContext,a.IsMasterPage)},loadPostGrids:function(j){if(j!=undefined){var f=j.length;for(var d=0;d<f;d++){try{var k=j[d];if(k.Count!=undefined){var h=k.CmpContext;var c=k.GridName;var a=gx.csv.validatingGrid;if(gx.lang.emptyObject(a)||((a.gxComponentContext!=h)&&(a.gridName!=c))){var b=(k.InMasterPage=="true")?true:false;gx.fn.gridObj(h,c,b).loadGrid(k,true)}}}catch(g){gx.dbg.logEx(g,"gxfrmutl.js","loadPostGrids")}}}},getErrorViewerCtrls:function(){var d=gx.dom.byName("gxErrorViewer");if(d.length==0){d=[];var c=gx.dom.byTag("span");var a=c.length;for(var b=0;b<a;b++){if(c[b].name=="gxErrorViewer"){d.push(c[b])}}}return d},setErrorViewer:function(a){gx.O.AnyError=0;if(!a){return}try{gx.fx.obs.notify("gx.onmessages",[a]);var p=gx.dom.byClass("gx_ev","span");var r=p.length;for(var n in a){var c=a[n];if(n=="MAIN"){n=""}if(typeof(c)!="undefined"){var h=gx.csv.setFocusOnload&&p[0]?p[0].innerHTML:"";var s="";var q={};for(var k in c){var g=c[k];if(g&&g.type==1){gx.O.AnyError=1}if(!gx.lang.emptyObject(g.text)){if(typeof(g)!="function"){if(g.att!=""){var o=q[g.att];if(!o){o=gx.util.balloon.getNew(g.att);q[g.att]=o}if(g.type==1){o.setError(g.text)}else{o.setMessage(g.text)}}else{h+=s+'<span align="left">'+g.text+"</span>";s="<BR/>"}}}}for(var m in q){var o=q[m];if(o.show()==false){gx.fn.setFocusOnError(m);break}}for(var f=0;f<r;f++){var l=p[f];if(l&&l.id==(n+"gxErrorViewer")){if(l.innerHTML!=h){l.innerHTML=h;if(h!=""){var d=gx.fx.dom.highlight(l,[255,255,165],2500);d.play()}}}}}}}catch(j){gx.dbg.logEx(j,"gxfrmutl.js","setErrorViewer")}},cmpContextFromCtrl:function(b){var c=/((?:(?:MP)?W[0-9a-zA-Z\-]{4}[\S]*)*)gxHTMLWrp((?:MP)?W[0-9]{4}[\S]*)*/;var a=c.exec(b);if(a){return a[1]+a[2]}return b},setPostComponents:function(c,l,a,r){try{var q=[];var m=false;var b=gx.gen.isDotNet();for(var s in c){if(typeof(c[s])!="function"){try{var d=c[s];var o=gx.dom.el(s);if(!o&&l){o=gx.dom.el(l[s])}if(!gx.lang.emptyObject(o)){gx.html.setInnerHtml(o,d);var h=gx.fn.cmpContextFromCtrl(s);var p=gx.fn.getHidden(h+"_CMPPGM");var g=p.split(".");var f=g.length;if(b&&(f>1)){p=g[f-2].toLowerCase()}else{p=g[f-1].toLowerCase()}q.push({type:h,name:p,html:d})}}catch(j){m=true;gx.dbg.logEx(j,"gxfrmutl.js","setPostComponents")}}}}catch(j){m=true;gx.dbg.logEx(j,"gxfrmutl.js","setPostComponents")}if((q.length==0||m)&&typeof(r)=="function"){r()
}else{var n=null;var k=function(){if(q.length>0){n=q.shift();gx.fn.createComponentAsync(n,a,k)}else{if(typeof(r)=="function"){r()}}};n=q.shift();gx.fn.createComponentAsync(n,a,k)}},createComponentAsync:function(c,b,h){var a=c.type;var f=c.name;var g=c.html;try{if(!gx.cache.codeLoaded(a+f)){gx.cache.addInlineCode(a+f);gx.html.processCode(g,false,function(e,j){gx.fn.createComponentObj(e,j);gx.fn.setPostHiddens(gx.fn.filterHiddens(new RegExp("^"+j),b));if(typeof(h)=="function"){h();return}},[f,a],f)}else{gx.fn.createComponentObj(f,a);if(typeof(h)=="function"){h()}}}catch(d){gx.dbg.logEx(d,"gxfrmutl.js","createComponentAsync");if(typeof(h)=="function"){h()}}},createComponentObj:function(c,a){var b=gx.createComponent(c,a);if(b!=null){gx.addComponent(b)}},getAttachedCtrl:function(d){var a=gx.attachedControls.length;for(var c=0;c<a;c++){var b=gx.attachedControls[c];if(b.id==d){return b}}return null},attachCtrl:function(c,b){var a=gx.fn.getAttachedCtrl(c);if(a==null){gx.attachedControls.push({id:c,info:b})}},doAttachs:function(){var g=gx.fn.attachedControls();var f=g.length;var a=gx.O;for(var b=0;b<f;b++){var k=g[b];gx.setGxO(k.info.wc,k.info.mp);if(k.info.isPrompt&&gx.O.isTransaction()&&gx.O.Gx_mode=="DSP"){gx.fn.setCtrlPropertyImpl(gx.dom.el(k.info.wc+k.id),"Visible",false)}else{var h=k.info.controls;var c=h.length;for(var d=0;d<c;d++){gx.fn.addAttach(h[d],k);var e=gx.fn.validStruct(h[d]).fld;gx.fn.checkAttachedProperty(e,"Visible",false);gx.fn.checkAttachedProperty(e,"Enabled",false)}}}gx.setGxO(a.CmpContext,a.IsMasterPage)},addAttach:function(a,b){var c=gx.fn.validStruct(a);if(c.attachedCtrls==undefined){c.attachedCtrls=[]}c.attachedCtrls.push(b)},checkAttachedProperty:function(c,e,b){var g=gx.O.getValidStructFld(c);if(g==undefined){return}var f=g.attachedCtrls;if(f==undefined){return}var a=f.length;for(var d=0;d<a;d++){gx.fn.checkAttachedControlProperty(f[d],e,b)}},checkAttachedControlProperty:function(g,f,d){var a=g.id;g=g.info;var h=false;var j=g.controls;var k=g.wc;var e=j.length;for(var b=0;b<e&&!h;b++){if(gx.fn.getCtrlProperty_impl(gx.dom.el(k+gx.fn.validStruct(j[b]).fld),f)==d){h=((d==true)||(b==e-1))}}if(h){var c=(g.isPrompt)?"Visible":f;gx.fn.setCtrlPropertyImpl(gx.dom.el(k+a),c,d)}},changeControlOpacity:function(d,f,a,c){var b=Math.round(c);var e="";if(typeof(d)=="string"){e=d}else{e=d.id}if(f>a){gx.fn.setOpacity(f,e);setTimeout(function(){gx.fn.changeControlOpacity(d,f-10,a,c)},b)}else{if(f<a){gx.fn.setOpacity(f,e);setTimeout(function(){gx.fn.changeControlOpacity(d,f+10,a,c)},b)}else{gx.fn.setOpacity(a,e)}}},setOpacity:function(a,b){var d=b;if(typeof(b)=="string"){if(b=="body"){d=document.body}else{d=gx.dom.el(b)}}if(d!=null){var c=d.style;c.opacity=(a/100);c.MozOpacity=(a/100);c.filter="alpha(opacity="+a+")"}},fadeControl:function(b,c,a){if(c=="in"){gx.fn.changeControlOpacity(b,0,100,a)}else{gx.fn.changeControlOpacity(b,100,0,a)}},fadeIn:function(b,a){gx.fn.fadeControl(b,"in",a)},statusMsg:function(a){window.status=a},objectOnload:function(){if(gx.pO!=null){gx.pO.onload();
gx.setGxO(gx.pO.CmpContext,gx.pO.IsMasterPage)}},objectOnUnload:function(){if(gx.pO!=null){gx.pO.onunload()}},objectOnpost:function(){if(gx.pO!=null){gx.pO.onpost()}},objectPostback:function(){if(gx.pO!=null){gx.pO.postbackLoad()}},gridObjFromGxO:function(a){return gx.fn.gridObj(gx.O.CmpContext,a,gx.O.IsMasterPage)},gridObj:function(b,a,c){return gx.getObj(b,c).getGrid(a)},installComponents:function(f){var e=gx.fn.getHidden("GX_CMP_OBJS");if(e!=undefined){var c=gx.gen.isDotNet();for(var h in e){if(f||!gx.pO.getWebComponent(h)){var a=e[h].toLowerCase();var g=a.split(".");var b=g.length;if(c&&(b>1)){a=g[b-2]}else{a=g[b-1]}var d=gx.createComponent(a,h);if(d!=null){gx.addComponent(d);setTimeout(function(){gx.fn.addComponentRemoteFiles(h)},1)}}}}},addComponentRemoteFiles:function(c){var d=/((?:(?:MP)?W[0-9]{4})*)((?:MP)?W[0-9]{4})/;var a=d.exec(c);var b=gx.dom.el(a[1]+"gxHTMLWrp"+a[2]);if(b!=null){gx.html.processCode(b.innerHTML,true);gx.dom.fitToParent(b)}},datePickerFormat:function(b,e,f){var h=gx.dateFormat;var d=h.substr(0,1);var c=h.substr(1,1);var a=h.substr(2,1);var l=gx.fn.datePickerDateFormat(d,b);var k=gx.fn.datePickerDateFormat(c,b);var j=gx.fn.datePickerDateFormat(a,b);var g=gx.fn.datePickerTimeFormat(e);if(f>0&&e>0){return l+"/"+k+"/"+j+" "+g}else{if(f>0){return l+"/"+k+"/"+j}else{return g}}},datePickerDateFormat:function(a,b){if(a=="Y"&&b.substr(0,10)=="99/99/9999"){return"%Y"}else{if(a=="Y"){return"%y"}else{if(a=="M"){return"%m"}else{if(a=="D"){return"%d"}else{return""}}}}},datePickerTimeFormat:function(c){var a=gx.timeFormat;var b,d,e;if(a==12){b="%I";d=" %p"}else{if(a==24){b="%H";d=""}else{b="";d=""}}if(c==2){e=""}else{if(c==5){e=":%M"}else{if(c==8){e=":%M:%S"}else{return""}}}return b+e+d},installDatePicker:function(e,d,b,c,f,a){gx.html.onTypeAvailable("Calendar",gx.fn.installDatePickerIfReady,[e,d,b,c,f,a])},installDatePickerIfReady:function(f,e,b,d,g,a){var c=gx.dom.el(f);if(!gx.lang.emptyObject(c)&&c.nodeName=="SELECT"){return}if(e==0){Calendar.setup({inputField:f,showsTime:b,weekNumbers:d,mondayFirst:g,ifFormat:a,button:f+"_dp_trigger",onSelect:gx.fn.datePickerChanged,align:"Bl",singleClick:true})}else{if(!gx.lang.emptyObject(c)){c.style.display="none"}Calendar.setup({inputField:f,showsTime:b,weekNumbers:d,mondayFirst:g,ifFormat:a,flat:f+"_dp_container",flatCallback:gx.fn.datePickerChanged,align:"Bl",singleClick:true})}},datePickerChanged:function(e,c,f){if(e&&e.dateClicked){if(!f){f=e.params.inputField}var h=gx.O;var j=null;var d=gx.fn.controlIds();var g=d.length;for(i=0;i<g;i++){j=gx.fn.validStruct(d[i]);var a=(j.grid!=0)?"_"+gx.fn.currentGridRow(j.grid):"";var k=h.CmpContext+j.fld+a;if(f.id==k){break}}if((j!=null)&&(j.dp!=undefined)){var b=e.date.print(gx.fn.datePickerFormat(j.dp.pic,j.dp.dec,j.len));if(b!=f.value){f.setAttribute("gxvalid","0");f.value=b;e.callCloseHandler();if(j.grid>0){gx.fn.getGridObj(j.grid).setRowModified(gx.fn.currentGridRow(j.grid))}h.refreshDependantGrids(j)}}}}};gx.thread={Map:function(){this.map={};this.add=function(a,b){this.map[a]=b
};this.remove=function(a){delete this.map[a]};this.get=function(a){return a==null?null:this.map[a]};this.first=function(){return this.get(this.nextKey())};this.next=function(a){return this.get(this.nextKey(a))};this.nextKey=function(a){for(i in this.map){if(!a){return i}if(a==i){a=null}}return null}},Command:function(c,b,a){if(!gx.thread.Command.LastID){gx.thread.Command.LastID=0}this.id=++gx.thread.Command.LastID;this.execute=function(){b.apply(c,a)};this.syncExecute=function(){new gx.thread.Mutex(this,"execute")}},Mutex:function(c,b,a,d){if(!gx.thread.Mutex.Wait){gx.thread.Mutex.Wait=new gx.thread.Map()}gx.thread.Mutex.SLICE=function(f,e){gx.thread.Mutex.Wait.get(f).attempt(gx.thread.Mutex.Wait.get(e))};this.attempt=function(h){for(var f=h;f;f=gx.thread.Mutex.Wait.next(f.c.id)){if(f.enter||(f.number&&(f.number<this.number||(f.number==this.number&&f.c.id<this.c.id)))){return setTimeout("gx.thread.Mutex.SLICE("+this.c.id+","+f.c.id+")",10)}}try{retVal=this.c.execute()}catch(g){gx.dbg.logEx(g,"gxfrmutl.js","Mutex Call")}this.number=0;gx.thread.Mutex.Wait.remove(this.c.id);if(typeof(d)=="function"){try{d.call(c,retVal)}catch(g){gx.dbg.logEx(g,"gxfrmutl.js","Mutex CallBack")}}};this.c=new gx.thread.Command(c,b,a);gx.thread.Mutex.Wait.add(this.c.id,this);this.enter=true;this.number=(new Date()).getTime();this.enter=false;this.attempt(gx.thread.Mutex.Wait.first())}};gx.sec={key:null,keyName:"GX_AJAX_KEY",secToken:null,secTokenName:"AJAX_SECURITY_TOKEN",loadKey:function(){var a=gx.fn.getHidden(this.keyName);if(gx.lang.emptyObject(a)){this.key=null}else{this.key=a}if(this.key!=null){this.loadSecToken()}},loadSecToken:function(){var a=gx.fn.getHidden(this.secTokenName);if(gx.lang.emptyObject(a)){this.secToken=null}else{this.secToken=a}},encrypt:function(b,a){try{a=(a==null)?this.key:a;if(a!=null){var g=this.rijndael;a=g.hexToByteArray(a);var c=g.rijndaelEncrypt(b,a);var f=g.byteArrayToHex(c);return f}}catch(d){gx.dbg.logEx(d,"gxfrmutl.js","encrypt")}return b},decrypt:function(d,a){try{a=(a==null)?this.key:a;if(a!=null){var g=this.rijndael;a=g.hexToByteArray(a);var c=g.hexToByteArray(d);var b=g.rijndaelDecrypt(c,a);return g.byteArrayToString(b)}}catch(f){gx.dbg.logEx(f,"gxfrmutl.js","decrypt")}return d},_init:function(){this.rijndael._init()}};gx.MD5={RotateLeft:function(b,a){return(b<<a)|(b>>>(32-a))},AddUnsigned:function(e,b){var g,a,d,f,c;d=(e&2147483648);f=(b&2147483648);g=(e&1073741824);a=(b&1073741824);c=(e&1073741823)+(b&1073741823);if(g&a){return(c^2147483648^d^f)}if(g|a){if(c&1073741824){return(c^3221225472^d^f)}else{return(c^1073741824^d^f)}}else{return(c^d^f)}},F:function(a,c,b){return(a&c)|((~a)&b)},G:function(a,c,b){return(a&b)|(c&(~b))},H:function(a,c,b){return(a^c^b)},I:function(a,c,b){return(c^(a|(~b)))},FF:function(g,f,l,k,e,h,j){g=gx.MD5.AddUnsigned(g,gx.MD5.AddUnsigned(gx.MD5.AddUnsigned(gx.MD5.F(f,l,k),e),j));return gx.MD5.AddUnsigned(gx.MD5.RotateLeft(g,h),f)},GG:function(g,f,l,k,e,h,j){g=gx.MD5.AddUnsigned(g,gx.MD5.AddUnsigned(gx.MD5.AddUnsigned(gx.MD5.G(f,l,k),e),j));
return gx.MD5.AddUnsigned(gx.MD5.RotateLeft(g,h),f)},HH:function(g,f,l,k,e,h,j){g=gx.MD5.AddUnsigned(g,gx.MD5.AddUnsigned(gx.MD5.AddUnsigned(gx.MD5.H(f,l,k),e),j));return gx.MD5.AddUnsigned(gx.MD5.RotateLeft(g,h),f)},II:function(g,f,l,k,e,h,j){g=gx.MD5.AddUnsigned(g,gx.MD5.AddUnsigned(gx.MD5.AddUnsigned(gx.MD5.I(f,l,k),e),j));return gx.MD5.AddUnsigned(gx.MD5.RotateLeft(g,h),f)},ConvertToWordArray:function(e){var h;var d=e.length;var c=d+8;var b=(c-(c%64))/64;var g=(b+1)*16;var j=Array(g-1);var a=0;var f=0;while(f<d){h=(f-(f%4))/4;a=(f%4)*8;j[h]=(j[h]|(e.charCodeAt(f)<<a));f++}h=(f-(f%4))/4;a=(f%4)*8;j[h]=j[h]|(128<<a);j[g-2]=d<<3;j[g-1]=d>>>29;return j},WordToHex:function(c){var b="",d="",e,a;for(a=0;a<=3;a++){e=(c>>>(a*8))&255;d="0"+e.toString(16);b=b+d.substr(d.length-2,2)}return b},Utf8Encode:function(b){b=b.replace(/\r\n/g,"\n");var a="";for(var e=0;e<b.length;e++){var d=b.charCodeAt(e);if(d<128){a+=String.fromCharCode(d)}else{if((d>127)&&(d<2048)){a+=String.fromCharCode((d>>6)|192);a+=String.fromCharCode((d&63)|128)}else{a+=String.fromCharCode((d>>12)|224);a+=String.fromCharCode(((d>>6)&63)|128);a+=String.fromCharCode((d&63)|128)}}}return a},getHsh:function(e){var n=Array();var y,z,f,m,w,I,H,F,D;var u=7,s=12,q=17,o=22;var G=5,E=9,B=14,A=20;var l=4,j=11,h=16,g=23;var v=6,t=10,r=15,p=21;e=gx.MD5.Utf8Encode(e);n=gx.MD5.ConvertToWordArray(e);I=1732584193;H=4023233417;F=2562383102;D=271733878;for(y=0;y<n.length;y+=16){z=I;f=H;m=F;w=D;I=gx.MD5.FF(I,H,F,D,n[y+0],u,3614090360);D=gx.MD5.FF(D,I,H,F,n[y+1],s,3905402710);F=gx.MD5.FF(F,D,I,H,n[y+2],q,606105819);H=gx.MD5.FF(H,F,D,I,n[y+3],o,3250441966);I=gx.MD5.FF(I,H,F,D,n[y+4],u,4118548399);D=gx.MD5.FF(D,I,H,F,n[y+5],s,1200080426);F=gx.MD5.FF(F,D,I,H,n[y+6],q,2821735955);H=gx.MD5.FF(H,F,D,I,n[y+7],o,4249261313);I=gx.MD5.FF(I,H,F,D,n[y+8],u,1770035416);D=gx.MD5.FF(D,I,H,F,n[y+9],s,2336552879);F=gx.MD5.FF(F,D,I,H,n[y+10],q,4294925233);H=gx.MD5.FF(H,F,D,I,n[y+11],o,2304563134);I=gx.MD5.FF(I,H,F,D,n[y+12],u,1804603682);D=gx.MD5.FF(D,I,H,F,n[y+13],s,4254626195);F=gx.MD5.FF(F,D,I,H,n[y+14],q,2792965006);H=gx.MD5.FF(H,F,D,I,n[y+15],o,1236535329);I=gx.MD5.GG(I,H,F,D,n[y+1],G,4129170786);D=gx.MD5.GG(D,I,H,F,n[y+6],E,3225465664);F=gx.MD5.GG(F,D,I,H,n[y+11],B,643717713);H=gx.MD5.GG(H,F,D,I,n[y+0],A,3921069994);I=gx.MD5.GG(I,H,F,D,n[y+5],G,3593408605);D=gx.MD5.GG(D,I,H,F,n[y+10],E,38016083);F=gx.MD5.GG(F,D,I,H,n[y+15],B,3634488961);H=gx.MD5.GG(H,F,D,I,n[y+4],A,3889429448);I=gx.MD5.GG(I,H,F,D,n[y+9],G,568446438);D=gx.MD5.GG(D,I,H,F,n[y+14],E,3275163606);F=gx.MD5.GG(F,D,I,H,n[y+3],B,4107603335);H=gx.MD5.GG(H,F,D,I,n[y+8],A,1163531501);I=gx.MD5.GG(I,H,F,D,n[y+13],G,2850285829);D=gx.MD5.GG(D,I,H,F,n[y+2],E,4243563512);F=gx.MD5.GG(F,D,I,H,n[y+7],B,1735328473);H=gx.MD5.GG(H,F,D,I,n[y+12],A,2368359562);I=gx.MD5.HH(I,H,F,D,n[y+5],l,4294588738);D=gx.MD5.HH(D,I,H,F,n[y+8],j,2272392833);F=gx.MD5.HH(F,D,I,H,n[y+11],h,1839030562);H=gx.MD5.HH(H,F,D,I,n[y+14],g,4259657740);I=gx.MD5.HH(I,H,F,D,n[y+1],l,2763975236);D=gx.MD5.HH(D,I,H,F,n[y+4],j,1272893353);
F=gx.MD5.HH(F,D,I,H,n[y+7],h,4139469664);H=gx.MD5.HH(H,F,D,I,n[y+10],g,3200236656);I=gx.MD5.HH(I,H,F,D,n[y+13],l,681279174);D=gx.MD5.HH(D,I,H,F,n[y+0],j,3936430074);F=gx.MD5.HH(F,D,I,H,n[y+3],h,3572445317);H=gx.MD5.HH(H,F,D,I,n[y+6],g,76029189);I=gx.MD5.HH(I,H,F,D,n[y+9],l,3654602809);D=gx.MD5.HH(D,I,H,F,n[y+12],j,3873151461);F=gx.MD5.HH(F,D,I,H,n[y+15],h,530742520);H=gx.MD5.HH(H,F,D,I,n[y+2],g,3299628645);I=gx.MD5.II(I,H,F,D,n[y+0],v,4096336452);D=gx.MD5.II(D,I,H,F,n[y+7],t,1126891415);F=gx.MD5.II(F,D,I,H,n[y+14],r,2878612391);H=gx.MD5.II(H,F,D,I,n[y+5],p,4237533241);I=gx.MD5.II(I,H,F,D,n[y+12],v,1700485571);D=gx.MD5.II(D,I,H,F,n[y+3],t,2399980690);F=gx.MD5.II(F,D,I,H,n[y+10],r,4293915773);H=gx.MD5.II(H,F,D,I,n[y+1],p,2240044497);I=gx.MD5.II(I,H,F,D,n[y+8],v,1873313359);D=gx.MD5.II(D,I,H,F,n[y+15],t,4264355552);F=gx.MD5.II(F,D,I,H,n[y+6],r,2734768916);H=gx.MD5.II(H,F,D,I,n[y+13],p,1309151649);I=gx.MD5.II(I,H,F,D,n[y+4],v,4149444226);D=gx.MD5.II(D,I,H,F,n[y+11],t,3174756917);F=gx.MD5.II(F,D,I,H,n[y+2],r,718787259);H=gx.MD5.II(H,F,D,I,n[y+9],p,3951481745);I=gx.MD5.AddUnsigned(I,z);H=gx.MD5.AddUnsigned(H,f);F=gx.MD5.AddUnsigned(F,m);D=gx.MD5.AddUnsigned(D,w)}var C=gx.MD5.WordToHex(I)+gx.MD5.WordToHex(H)+gx.MD5.WordToHex(F)+gx.MD5.WordToHex(D);return C.toLowerCase()}};gx.base64={b64:[],f64:[],decode:function(a){return this.bytesToString(this.bytesFromUTF8Bytes(this.decodeImpl(a)))},encode:function(a){return this.encodeImpl(this.UTF8BytesFromString(a))},bytesFromUTF8Bytes:function(d){var f=[];var b=0;var e=c1=c2=0;var a=d.length;while(b<a){e=d[b];if(e<128){f.push(e);b++}else{if((e>191)&&(e<224)){c2=d[b+1];f.push(((e&31)<<6)|(c2&63));b+=2}else{c2=d[b+1];c3=d[b+2];f.push(((e&15)<<12)|((c2&63)<<6)|(c3&63));b+=3}}}return f},UTF8BytesFromString:function(b){b=b.replace(/\r\n/g,"\n");var d=[];var a=b.length;for(var f=0;f<a;f++){var e=b.charCodeAt(f);if(e<128){d.push(e)}else{if((e>127)&&(e<2048)){d.push((e>>6)|192);d.push(((e&63)|128))}else{d.push(((e>>12)|224));d.push((((e>>6)&63)|128));d.push(((e&63)|128))}}}return d},bytesToString:function(Arr){var BUFFER_SIZE=gx.util.browser.isChrome()?32765:50000;var strOut=[];while(Arr.length>=BUFFER_SIZE){strOut.push(eval("String.fromCharCode("+Arr.slice(0,BUFFER_SIZE).join(",")+");"));Arr=Arr.slice(BUFFER_SIZE)}if(Arr.length!=0){strOut.push(eval("String.fromCharCode("+Arr.join(",")+");"))}return strOut.join("")},decodeImpl:function(c){var f=this.f64;var e=[];var b=0;c=c.replace(/\n|\r/g,"");c=c.replace(/=/g,"");var a=c.length;while(b<a){e[e.length]=(f[c.charAt(b)]<<2)|(f[c.charAt(b+1)]>>4);e[e.length]=(((f[c.charAt(b+1)]&15)<<4)|(f[c.charAt(b+2)]>>2));e[e.length]=(((f[c.charAt(b+2)]&3)<<6)|(f[c.charAt(b+3)]));b+=4}if(c.length%4==2){e=e.slice(0,e.length-2)}if(c.length%4==3){e=e.slice(0,e.length-1)}return e},encodeImpl:function(h){var f=this.b64;var g=[];var e=0;var b=h.length;if((b%3)==1){h[h.length]=0;h[h.length]=0}if((b%3)==2){h[h.length]=0}var a=h.length;while(e<a){g[g.length]=f[h[e]>>2];g[g.length]=f[((h[e]&3)<<4)|(h[e+1]>>4)];
g[g.length]=f[((h[e+1]&15)<<2)|(h[e+2]>>6)];g[g.length]=f[h[e+2]&63];e+=3}if((b%3)==1){g[g.length-1]=g[g.length-2]="="}if((b%3)==2){g[g.length-1]="="}var c=g.join("");return c},_init:function(){var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var a=d.length;for(var b=0;b<a;b++){var e=d.charAt(b);this.b64[b]=e;this.f64[e]=b}}};