if(!apex.da||typeof(apex.da)!="object"){apex.da={}}apex.da={gEventList:[],gTriggerIsColumn:false,init:function(){apex.jQuery(apex.da.gEventList).each(function(){var a,c,b;apex.da.gTriggerIsColumn=false;a={name:null};c=apex.jQuery.extend(a,this);b=apex.da.constructSelector(c.triggeringElementType,c.triggeringElement,c.triggeringRegionId);apex.jQuery(b)[c.bindType](c.bindEventType,function(e,d){apex.da.actions(this,c,e,d)});apex.da.actions(b,c,"load")})},constructSelector:function(pElementType,pElement,pRegionId,pTriggeringElement,pEventTarget){var lSelector,lArray,lLength,lfxx,i;lSelector="";switch(pElementType){case"ITEM":lSelector="#"+pElement.replace(/,/g,",#");break;case"REGION":lSelector="#"+pRegionId;break;case"DOM_OBJECT":lSelector="#"+pElement.replace(/,/g,",#");if(!apex.jQuery(lSelector).length){try{lSelector=eval(pElement)}catch(err){lSelector=pElement}}break;case"JQUERY_SELECTOR":lSelector=pElement;break;case"TRIGGERING_ELEMENT":lSelector=pTriggeringElement;break;case"EVENT_SOURCE":lSelector=pEventTarget;break;default:lSelector=document}return lSelector},show:function(){var a;if(this.affectedElements){a=(this.action.attribute01==="Y");apex.jQuery(this.affectedElements).each(function(){apex.item(this).show(a)})}},hide:function(){var a;if(this.affectedElements){a=(this.action.attribute01==="Y");apex.jQuery(this.affectedElements).each(function(){apex.item(this).hide(a)})}},enable:function(){if(this.affectedElements){apex.jQuery(this.affectedElements).each(function(){apex.item(this).enable()})}},disable:function(){if(this.affectedElements){apex.jQuery(this.affectedElements).each(function(){apex.item(this).disable()})}},setValue:function(){var lAction,lSetType,lValue,lPageItemsToSubmit,lJavaScriptExpression,lAjaxRequest,lAjaxResult,lPageItem,lResult;lAction=this.action;lSetType=lAction.attribute01;lValue=lAction.attribute02;lPageItemsToSubmit=lAction.attribute04;lJavaScriptExpression=lAction.attribute05;if(lSetType==="STATIC_ASSIGNMENT"){apex.jQuery(this.affectedElements).each(function(){$s(this,lValue)})}else{if(lSetType==="SQL_STATEMENT"||lSetType==="PLSQL_EXPRESSION"||lSetType==="FUNCTION_BODY"){lAjaxRequest=new htmldb_Get(null,$v("pFlowId"),"NATIVE="+lAction.ajaxIdentifier,$v("pFlowStepId"));lAjaxResult=null;if(lPageItemsToSubmit){apex.jQuery.each(lPageItemsToSubmit.split(","),function(){lPageItem=apex.jQuery("#"+this)[0];if(lPageItem){lAjaxRequest.add(this,$v(lPageItem))}})}lAjaxResult=lAjaxRequest.get();if(lAjaxResult){var lData=apex.jQuery.parseJSON(lAjaxResult);if(lData.error){alert(lData.error);return false}else{this.affectedElements.each(function(){$s(this,lData.value)})}}}else{if(lSetType==="JAVASCRIPT_EXPRESSION"){lResult=eval(lJavaScriptExpression);if(lResult){this.affectedElements.each(function(){$s(this,lResult)})}}}}},clear:function(){if(this.affectedElements){apex.jQuery(this.affectedElements).each(function(){$s(this,"","")})}},addClass:function(){if(this.affectedElements){this.affectedElements.addClass(this.action.attribute01)}},removeClass:function(){if(this.affectedElements){if(this.action.attribute01){this.affectedElements.removeClass(this.action.attribute01)}else{this.affectedElements.removeClass()}}},setCSS:function(){if(this.affectedElements){this.affectedElements.css(this.action.attribute01,this.action.attribute02)}},setFocus:function(){if(this.affectedElements){this.affectedElements.focus()}},submitPage:function(){apex.submit(this.action.attribute01)},refresh:function(){if(this.affectedElements){this.affectedElements.trigger("apexrefresh")}},executePlSqlCode:function(){var d,b,a;d=this.action.attribute01;b=new htmldb_Get(null,$v("pFlowId"),"NATIVE="+this.action.ajaxIdentifier,$v("pFlowStepId"));a=null;if(d){apex.jQuery.each(d.split(","),function(){var e;e=apex.jQuery("#"+this)[0];if(e){b.add(this,$v(e))}})}a=b.get();if(a){var c=apex.jQuery.parseJSON(a);alert(c.error);return false}},cancelEvent:function(){apex.event.gCancelFlag=true;apex.event.gCancelActions=true;this.browserEvent.stopImmediatePropagation();this.browserEvent.preventDefault()},showAlert:function(){alert(this.action.attribute01)},askConfirm:function(){if(!confirm(this.action.attribute01)){apex.da.cancelEvent.call(this)}},doAction:function(g,a,b,f,e,d){var c;c={triggeringElement:g,affectedElements:apex.jQuery(a),action:b,browserEvent:f,data:e};if(b.javascriptFunction){apex.debug("Dynamic Action Fired: "+d+" ("+b.action+")");return b.javascriptFunction.call(c)}},actions:function(b,a,e,d){var f,c;apex.event.gCancelFlag=false;apex.event.gCancelActions=false;apex.jQuery(b).each(function(){var h,k,j,i,g;h=this;k=apex.item(h.id);j=k.getValue();switch(a.triggeringConditionType){case"EQUALS":if(!apex.jQuery.isArray(j)){f=(j==a.triggeringExpression)}else{f=false;apex.jQuery.each(j,function(l,m){f=(m==a.triggeringExpression);if(f){return}})}break;case"NOT_EQUALS":if(!apex.jQuery.isArray(j)){f=(j!=a.triggeringExpression)}else{f=true;apex.jQuery.each(j,function(l,m){f=(m!=a.triggeringExpression);if(!f){return}})}break;case"IN_LIST":i=a.triggeringExpression.split(",");if(!apex.jQuery.isArray(j)){f=(apex.jQuery.inArray(j,i)!==-1)?true:false}else{f=false;apex.jQuery.each(j,function(l,m){f=(apex.jQuery.inArray(m,i)!==-1)?true:false;if(f){return}})}break;case"NOT_IN_LIST":i=a.triggeringExpression.split(",");if(!apex.jQuery.isArray(j)){f=(apex.jQuery.inArray(j,i)===-1)?true:false}else{f=true;apex.jQuery.each(j,function(l,m){f=(apex.jQuery.inArray(m,i)===-1)?true:false;if(!f){return}})}break;case"GREATER_THAN":if(!apex.jQuery.isArray(j)){f=j>parseFloat(a.triggeringExpression,10)}else{f=true;apex.jQuery.each(j,function(l,m){f=m>parseFloat(a.triggeringExpression,10);if(!f){return}})}break;case"GREATER_THAN_OR_EQUAL":if(!apex.jQuery.isArray(j)){f=j>=parseFloat(a.triggeringExpression,10)}else{f=true;apex.jQuery.each(j,function(l,m){f=m>=parseFloat(a.triggeringExpression,10);if(!f){return}})}break;case"LESS_THAN":if(!apex.jQuery.isArray(j)){f=j<parseFloat(a.triggeringExpression,10)}else{f=true;apex.jQuery.each(j,function(l,m){f=m<parseFloat(a.triggeringExpression,10);if(!f){return}})}break;case"LESS_THAN_OR_EQUAL":if(!apex.jQuery.isArray(j)){f=j<=parseFloat(a.triggeringExpression,10)}else{f=true;apex.jQuery.each(j,function(l,m){f=m<=parseFloat(a.triggeringExpression,10);if(!f){return}})}break;case"NULL":f=k.isEmpty();break;case"NOT_NULL":f=!k.isEmpty();break;case"JAVASCRIPT_EXPRESSION":c={triggeringElement:h,browserEvent:e,data:d};g=new Function("return "+a.triggeringExpression);f=g.call(c);break;default:f=true}apex.jQuery.each(a.actionList,function(){if(apex.event.gCancelActions){return}var l,m,n;l={eventResult:null,executeOnPageInit:false,stopExecutionOnError:true,action:null,affectedElementsType:null,affectedRegionId:null,affectedElements:null,javascriptFunction:null,ajaxIdentifier:null,attribute01:null,attribute02:null,attribute03:null,attribute04:null,attribute05:null,attribute06:null,attribute07:null,attribute08:null,attribute09:null,attribute10:null};m=apex.jQuery.extend(l,this);if(e!="load"||(e=="load"&&m.executeOnPageInit)){if(m.eventResult==f){n=apex.da.constructSelector(m.affectedElementsType,m.affectedElements,m.affectedRegionId,h,e.target);if(apex.da.doAction(h,n,m,e,d,a.name)===false&&m.stopExecutionOnError){apex.event.gCancelActions=true}}}});apex.event.gCancelActions=false})}};