var _OfbIsBrowserMSIE,_OfbIsBrowserNetscape,_OfbMouseX,_OfbMouseY,_strHideDisplayStyle,_strShowDisplayStyle,WIDTH=0,HEIGHT=1,LEFT=0,TOP=1,MIN_OBJECT_HEIGHT=8,OFB_HDN_SELECTED_OBJECT_ID="__hdnOfbSelectedObjectId",OFB_HDN_SELECTED_OBJECT_VALUE="__hdnOfbSelectedItemValue";_strHideDisplayStyle="none";_strShowDisplayStyle="block";_OfbIsBrowserNetscape=_OfbIsBrowserMSIE=false;_OfbMouseX=_OfbMouseY=0;_OfbCurObject=null;
if(navigator.userAgent.indexOf("MSIE")>=0){_OfbIsBrowserMSIE=true;_OfbIsBrowserNetscape=false}else if(navigator.userAgent.indexOf("Mozilla")>=0)_OfbIsBrowserNetscape=true;_OfbIsBrowserNetscape&&document.captureEvents(Event.MOUSEMOVE);document.onmousemove=__ofbTrackMousePos;
function __ofbGetBrowserSize(){var a=document.documentElement.clientWidth,b=document.documentElement.clientHeight;if(self.innerHeight){a=self.innerWidth;b=self.innerHeight}else if(document.documentElement&&document.documentElement.clientHeight){a=document.documentElement.clientWidth;b=document.documentElement.clientHeight}else if(document.body){a=document.body.clientWidth;b=document.body.clientHeight}return[a,b]}
function __getScrollXY(){var a=0,b=0;if(typeof window.pageYOffset=="number"){b=window.pageYOffset;a=window.pageXOffset}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){b=document.body.scrollTop;a=document.body.scrollLeft}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){b=document.documentElement.scrollTop;a=document.documentElement.scrollLeft}return[a,b]}
function __ofbGetClientResolution(a){var b=screen.width,e=screen.height;if(a=document.getElementById(a))a.value=e+", "+b}function __ofbGetScrollWidth(){var a=window.pageXOffset||document.body.scrollLeft||document.documentElement.scrollLeft;return a?a:0}function __ofbGetScrollHeight(){var a=window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop;return a?a:0}
function __ofbTrackMousePos(a){if(_OfbIsBrowserNetscape){_OfbMouseX=a.pageX;_OfbMouseY=a.pageY}else{_OfbMouseX=event.x;_OfbMouseY=event.y}_OfbMouseX+=__ofbGetScrollWidth();_OfbMouseY+=__ofbGetScrollHeight()}function __ofbGetMouseX(){return _OfbMouseX}function __ofbGetMouseY(){return _OfbMouseY}function __ofbShowHideDiv(a){if(a)if(a=document.getElementById(a))a.style.display=a.style.display==_strHideDisplayStyle?_strShowDisplayStyle:_strHideDisplayStyle}
function __ofbShowDiv(a){if(a)if(a=document.getElementById(a))a.style.display=_strShowDisplayStyle}function __ofbHideDiv(a){if(a)if(a=document.getElementById(a))a.style.display=_strHideDisplayStyle}function __ofbHideDivWithLocationSense(a){if(a)if(a=document.getElementById(a))a.style.display=_strHideDisplayStyle}function __ofbHideDivWithDelay(a,b){a&&setTimeout("__ofbHideDiv( '"+a+"')",b)}
function __ofbEscapeHTML(a){var b=document.createElement("div");a=document.createTextNode(a);b.appendChild(a);return b.innerHTML}function __ofbGetCurrentEvent(a){a||(a=event);return a}function __ofbGetCurrentEventObject(a){if(a=__ofbGetCurrentEvent(a))return a.target||a.srcElement;return null}function __ofbGetPercentHeight(a,b){var e=__ofbGetBrowserSize(),d=0;a=__ofbStringToInt(a);b=__ofbStringToInt(b);d=e[HEIGHT]-b;if(a>0)d=d/100*a;return d}
function __ofbSetHeightByPercent(a,b){var e=document.getElementById(a),d=null;d=0;if(!(!e||e==null)){d=__ofbFindAbsolutePosition(e);d=__ofbGetPercentHeight(b,d[TOP]);if(e&&d>0)e.style.height=d+"px"}}function __ofbSetHeightByBottomOffset(a,b){var e=__ofbGetBrowserSize(),d=document.getElementById(a),f=null;f=0;if(!(!d||d==null)){b=__ofbStringToInt(b);f=__ofbFindAbsolutePosition(d);f=e[HEIGHT]-f[TOP]-b;if(f<=0)f=MIN_OBJECT_HEIGHT;if(d&&f>0)d.style.height=f+"px"}}
function __ofbSetHeightByBottomOffsetControlHeight(a,b){var e=document.getElementById(b),d=0;if(e)d=e.offsetHeight;return __ofbSetHeightByBottomOffset(a,d)}function __ofbGetStyleProperty(a,b){var e="";if(typeof a=="string")a=document.getElementById(a);if(!a)return e;if(a.currentStyle)e=a.currentStyle[b];else if(window.getComputedStyle)e=document.defaultView.getComputedStyle(a,null).getPropertyValue(b);return e}
function __ofbStringToInt(a){var b=0,e=0,d="",f="";if(!a)return b;if(f=a.toString())if(f.length){for(e=0;e<f.length;e++)if(f.charAt(e)>="0"&&f.charAt(e)<="9"||f.charAt(e)=="-"||f.charAt(e)=="+"||f.charAt(e)==".")d=d.concat(f.charAt(e));else break;if(d.length>0)b=parseInt(d,0)}else b=parseInt(d,0);return b}
function __ofbFindAbsolutePosition(a){var b=intCurrTop=0;if(a.offsetParent){b=a.offsetLeft;for(intCurrTop=a.offsetTop;a=a.offsetParent;){b+=a.offsetLeft;intCurrTop+=a.offsetTop}}return[b,intCurrTop]}
function __ofbGetControlCalcuatedPositionSize(a){var b=0,e=0,d=0,f=0,c;if(a){c=__ofbGetStyleProperty(a,"left").toLowerCase();if(c!="auto"&&c.indexOf("%")<0&&__ofbStringToInt(c)>0){b=__ofbStringToInt(__ofbGetStyleProperty(a,"left"));if((c=__ofbGetStyleProperty(a,"padding-Left"))&&c.length>0)b+=__ofbStringToInt(c);if((c=__ofbGetStyleProperty(a,"border-Left-Width"))&&c.length>0)b+=__ofbStringToInt(c)}else b=__ofbStringToInt(a.offsetLeft);c=__ofbGetStyleProperty(a,"top").toLowerCase();if(c!="auto"&&c.indexOf("%")<
0&&__ofbStringToInt(c)>0){e=__ofbStringToInt(c);if((c=__ofbGetStyleProperty(a,"padding-Top"))&&c.length>0)e+=__ofbStringToInt(c);if((c=__ofbGetStyleProperty(a,"border-Top-Width"))&&c.length>0)e+=__ofbStringToInt(c)}else e=__ofbStringToInt(a.offsetTop);c=__ofbGetStyleProperty(a,"width").toLowerCase();if(c!="auto"&&c.indexOf("%")<0&&__ofbStringToInt(c)>0){d=__ofbStringToInt(c);if((c=__ofbGetStyleProperty(a,"padding-Left"))&&c.length>0)d+=__ofbStringToInt(c);if((c=__ofbGetStyleProperty(a,"padding-Right"))&&
c.length>0)d+=__ofbStringToInt(c);if((c=__ofbGetStyleProperty(a,"border-Left-Width"))&&c.length>0)d+=__ofbStringToInt(c);if((c=__ofbGetStyleProperty(a,"border-Right-Width"))&&c.length>0)d+=__ofbStringToInt(c)}else d=__ofbStringToInt(a.offsetWidth);c=__ofbGetStyleProperty(a,"height").toLowerCase();if(c!="auto"&&c.indexOf("%")<0&&__ofbStringToInt(c)>0){f=__ofbStringToInt(c);if((c=__ofbGetStyleProperty(a,"padding-Top"))&&c.length>0)f+=__ofbStringToInt(c);if((c=__ofbGetStyleProperty(a,"padding-Bottom"))&&
c.length>0)f+=__ofbStringToInt(c);if((c=__ofbGetStyleProperty(a,"border-Top-Width"))&&c.length>0)f+=__ofbStringToInt(c);if((c=__ofbGetStyleProperty(a,"border-Bottom-Width"))&&c.length>0)f+=__ofbStringToInt(c)}else f=__ofbStringToInt(a.offsetHeight)}return[__ofbStringToInt(b),__ofbStringToInt(e),__ofbStringToInt(d),__ofbStringToInt(f)]}
function __ofbSetSelectedObjectStyle(a,b,e,d,f){var c=null,u=null,m=c=null;if(c=document.getElementById(OFB_HDN_SELECTED_OBJECT_ID)){if(c.value&&c.value.length>0)if((u=document.getElementById(c.value))&&u.style)u.style.borderWidth=0;if(m=document.getElementById(a)){if(m.style){m.style.borderColor=e;m.style.borderWidth=d;m.style.borderStyle=f}if(m.id)c.value=m.id;if(b)if(c=document.getElementById(OFB_HDN_SELECTED_OBJECT_VALUE))c.value=b}}}
function __ofbGetSelectedObjectValue(){var a=null,b="";if(a=document.getElementById(OFB_HDN_SELECTED_OBJECT_ID)&&a.value)b=a.value;document.getElementById(OFB_HDN_SELECTED_OBJECT_VALUE);return[b,""]}
function __ofbSubmitAjaxForm(a,b){function e(i,h,g,n){w[p]=d(h,null,n);h={RC:w[p]};g=new A(j,g&&g!=""?g:x);i=new F(i.attr("id"),g,h);B[p]=i;p++}function d(i,h,g){var n=[];s=0;if(h)i.find(h).each(function(){n[s++]=f($(this),true)});else if(g==true)n[s++]=f(i,true);else i.find(G).each(function(){var t=[];q=0;t[q]=new H(q,$(this).attr("name"),$(this).is("input:checkbox")?$(this).is(":checked").toString():$(this).val());q++;l=new I(s,C,t);n[s++]=l});return n}function f(i,h){var g=[];q=0;i.find(G).each(function(){g[q]=
new H(q,$(this).attr("name"),$(this).is("input:checkbox")?$(this).is(":checked").toString():$(this).val());q++});if(h)C=i.attr("id");return l=new I(s,C,g)}var c={GetRecord:"201",SetRecord:"202",AddRecord:"203",DeleteRecord:"204",ResetRecord:"205"},u={None:0,Default:2,Int:1,String:2,Bool:3},m={CurrentRowId:-1};b=$.extend({},{AjaxDataPacketHeader:"PH",AjaxFormData:"FD",AjaxFormCollection:"FC",FormID:"FI",ActionHeader:"AH",ActionPayload:"AP",ActionResponse:"AR",ActionCode:"AC",MetaSessionID:"MSI",ActionCodeAttr:"data-ofboac",
MetaSessionIDAttr:"data-ofbmsi",RowSelectorAttr:"data-ofbfrs",RowDataCollection:"RC",RowID:"RI",RowValue:"RV",RowData:"RD",ColID:"CI",ColName:"CN",ColValue:"CV",QueryStringParamName:"080.DTA",FormSelector:"body",DataSelector:':input[name]:not("#__OFBVSTATE,#__VIEWSTATE")',RowSelector:null,SubmitUrl:false,OnSuccess:function(){}},b);if(!b.SubmitUrl)return false;var D=DataTable(b.AjaxDataPacketHeader+","+b.AjaxFormData),F=DataTable(b.FormID+","+b.ActionHeader+","+b.ActionPayload),A=DataTable(b.ActionCode+
","+b.MetaSessionID),I=DataTable(b.RowID+","+b.RowValue+","+b.RowData),H=DataTable(b.ColID+","+b.ColName+","+b.ColValue),B=[],J,w=[],p=0,s=0,q=0,G=b.DataSelector,l,C="",v=null,j="",x="";if(a&&a.length){(j=a.attr(b.ActionCodeAttr))||(j="");(x=a.attr(b.MetaSessionIDAttr))||(x="")}v=null;if(a&&a.length&&j&&(j==c.GetRecord||j==c.SetRecord||j==c.AddRecord||j==c.DeleteRecord||j==c.ResetRecord))$(a).closest(b.SubFormSelector).each(function(){if($(this).attr(b.RowSelectorAttr)){v=$(a).closest($(this).attr(b.RowSelectorAttr));
e($(this),v,$(this).attr(b.MetaSessionIDAttr),true)}});else b.SubFormSelector?$(b.SubFormSelector).each(function(){w[p]=d($(this),$(this).attr(b.RowSelectorAttr)?$(this).attr(b.RowSelectorAttr):b.RowSelector,false);var i={RC:w[p]},h=new A(j,$(this).attr(b.MetaSessionIDAttr));J=new F($(this).attr("id"),h,i);B[p]=J;p++}):e($(b.FormSelector),$(b.FormSelector),b.RowSelector,false);c=new A(j,x);D=new D(c,{FC:B});strPortParam=b.QueryStringParamName+"="+escape(JSON.stringify(D));$.ajax({type:"POST",url:b.SubmitUrl,
data:strPortParam,success:function(i){var h;if(i.length){h=JSON.parse(i);if(h.FD){var g,n=0,t=0,E=0,r;if(!(!h||!h.FD||!h.FD.FC))for(;n<h.FD.FC.length;){g=h.FD.FC[n++];if(!(!g||!g.AH||!g.AH.MSI||!g.AR||!g.AR.RC||!g.AR.RC.length)){t=0;if(g.FI)r=$("[id="+g.FI+"]");if(!r||!r.length)r=$("["+b.MetaSessionIDAttr+"="+g.AH.MSI+"]");if(r&&r.length)for(;t<g.AR.RC.length;){l=g.AR.RC[t++];if(!(!l||!l.RD||!l.RD.length))for(E=0;E<l.RD.length;)if((oCol=l.RD[E++])&&oCol.RA)b:{var y=r,K=l.RI,k=oCol,o=void 0;o=void 0;
var z=void 0;if(!(!y||!k||!k.RA||!k.CD))if(o=y.attr(b.RowSelectorAttr)?y.attr(b.RowSelectorAttr):b.RowSelector){if(K==m.CurrentRowId){if(!v)break b;o=v.find("[id$="+k.CD+"]")}else o=y.find(o).eq(K).find("[id$="+k.CD+"]");if(o&&o.length){z=k.CV;if(k.CVT==u.Bool)z=k.CV==="true";switch(k.RA){case 701:o.val(z);break;case 702:k.CA&&o.attr(k.CA,z);break}}}}}}}}}b.OnSuccess&&b.OnSuccess(i)},error:function(){alert("A System Error occured while processing your request. Please redo your action. If this error persists, please contact technical support.")}})}
function DataTable(a){var b=a.split(","),e=b.length;return function(){for(var d=0;d<e;d++)this[b[d]]=arguments[d]}}function OfbDialogClose(){if(parent&&parent.$&&parent.$.nyroModalRemove)parent.$.nyroModalRemove();else $&&$.nyroModalRemove&&$.nyroModalRemove();return false};