text: /**
   * @fileOverview jui_datagrid is an Ajax-enabled jQuery plugin, useful to manipulate database data in tabular format.
   *               <p>License MIT
   *               <br />Copyright 2012 Christos Pontikis <a href="http://pontikis.net">http://pontikis.net</a>
   *               <br />Project page <a href="http://pontikis.net/labs/jui_datagrid/">http://pontikis.net/labs/jui_datagrid/</a>
   *               <br />Minified using Online YUI Compressor http://www.refresh-sf.com/yui/
   * @version 0.9.1 (20 Oct 2013)
   * @author Christos Pontikis http://pontikis.net
   * @requires jquery, jquery-ui, jui_dropdown, jui_pagination, jui_filter_rules plugins, bowser.js
   */
  "use strict";(function(n){var c="jui_datagrid",p="jui_datagrid_status";var B={init:function(E){var F=this;return this.each(function(){var Y=F.data(c);if(typeof(Y)==="undefined"){var Q=F.jui_datagrid("getDefaults");Y=n.extend({},Q,E)}else{Y=n.extend({},Y,E)}F.data(c,Y);if(typeof F.data(p)==="undefined"){F.data(p,{});F.data(p)["a_selected_ids"]=[];F.data(p)["count_selected_ids"]=0;F.data(p)["filter_rules"]=[];if(bowser.mozilla||(bowser.msie&&parseInt(bowser.version)>=10)){F.data(p)["fix_border_collapse_td_width"]=0}else{F.data(p)["fix_border_collapse_td_width"]=Y.fix_border_collapse_td_width}}if(Y.rowSelectionMode=="single"||Y.rowSelectionMode==false){F.data(p)["a_selected_ids"]=[];F.data(p)["count_selected_ids"]=0}var W=F.attr("id");F.unbind("onCellClick").bind("onCellClick",Y.onCellClick);F.unbind("onRowClick").bind("onRowClick",Y.onRowClick);F.unbind("onDelete").bind("onDelete",Y.onDelete);F.unbind("onDatagridError").bind("onDatagridError",Y.onDatagridError);F.unbind("onDebug").bind("onDebug",Y.onDebug);F.unbind("onChangeSelectedRows").bind("onChangeSelectedRows",Y.onChangeSelectedRows);F.unbind("onDisplay").bind("onDisplay",Y.onDisplay);var ab=v(Y.caption_id_prefix,W),U=v(Y.datagrid_header_id_prefix,W),P=v(Y.datagrid_id_prefix,W),M=v(Y.tools_id_prefix,W),J=v(Y.pagination_id_prefix,W),O=v(Y.pref_dialog_id_prefix,W),S=v(Y.sort_dialog_id_prefix,W),X=v(Y.filters_dialog_id_prefix,W),V=v(Y.filter_rules_id_prefix,W),I=Y.debug_mode,aa,L;if(!F.data(p)["initialize"]){aa='<div id="'+ab+'">'+Y.caption+"</div>";aa+='<div id="'+U+'"></div>';aa+='<div id="'+P+'"></div>';aa+='<div id="'+M+'"></div>';aa+='<div id="'+J+'"></div>';aa+='<div id="'+O+'"></div>';aa+='<div id="'+S+'"></div>';aa+='<div id="'+X+'">';aa+='<div id="'+V+'"></div>';aa+="</div>";F.html(aa);F.data(p)["initialize"]=true}var T=n("#"+ab),K=n("#"+U),R=n("#"+P),H=n("#"+M),Z=n("#"+J),N=n("#"+O),G=n("#"+V);F.removeClass().addClass(Y.containerClass);if(typeof Y.caption==="undefined"){T.hide()}else{T.show().text(Y.caption).removeClass().addClass(Y.captionClass)}K.removeClass().addClass(Y.datagridHeaderClass);R.removeClass().addClass(Y.datagridClass);H.removeClass().addClass(Y.toolsClass);Z.removeClass().addClass(Y.paginationClass);n.ajax({type:"POST",url:Y.ajaxFetchDataURL,data:{page_num:Y.pageNum,rows_per_page:Y.rowsPerPage,columns:Y.columns,sorting:Y.sorting,filter_rules:F.data(p)["filter_rules"],debug_mode:I},success:function(aK){var ac,aB,ao,aq,al,ax,aL,ay,ak=Y.columns,am=ak.length,aC,aM,aJ,ae,aE,an,ai,ad=[];ac=n.parseJSON(aK);aB=ac.error;if(aB!=null){L="ERROR: "+aB;F.html('<span style="color: red;">'+L+"</span>");F.triggerHandler("onDatagridError",{err_code:"server_error",err_description:aB});n.error(L)}ao=ac.filter_error;if(ao.error_message!=null){G.jui_filter_rules("markRuleAsError",ao.element_rule_id,true);G.triggerHandler("onValidationError",{err_code:"filter_validation_server_error",err_description:ao.error_message});n.error(ao.error_message)}al=ac.total_rows;ax=ac.page_data;aL=ax.length;aq=Y.row_primary_key;if(I=="yes"){F.triggerHandler("onDebug",{debug_message:ac.debug_message})}if(aL>0){for(ay=0;ay<aL;ay++){for(aM=0;aM<am;aM++){aC=ak[aM];if(aC.hasOwnProperty("visible")&&aC.visible=="yes"){if(ax[ay][aC.field]==null){ax[ay][aC.field]=""}}}}}if(aL>0){for(aM=0;aM<am;aM++){aC=ak[aM];if(aC.hasOwnProperty("visible")&&aC.visible=="yes"){if(aC.hasOwnProperty("column_value_conversion")){ae=aC.column_value_conversion;aE=ae.function_name;an=ae.args;ai=an.length;for(ay=0;ay<aL;ay++){ad=[];for(var aN=0;aN<ai;aN++){if(an[aN].hasOwnProperty("col_index")){aJ=parseInt(an[aN]["col_index"]);ad.push(ax[ay][ak[aJ]["field"]])}if(an[aN].hasOwnProperty("value")){ad.push(an[aN]["value"])}}try{ax[ay][aC.field]=window[aE].apply(null,ad)}catch(aI){L=rsc_jui_dg.error_converting_column_value+" ("+ax[ay][aC.field]+") :\n\n"+aI.message;F.triggerHandler("onDatagridError",{err_code:"column_conversion_error_0",err_description:L});F.html('<span style="color: red;">'+L+"</span>");n.error(L)}}}}}}if(al==0){Z.hide();A(W);i(W,al)}else{Z.show();a(W,al,ax,aq);s(W);q(W,aq);i(W,al,aq);e(W,al)}var af,aO,aF,aj;if(al>0){var ar=v(F.jui_datagrid("getOption","table_id_prefix"),W),aw=n("#"+ar),aA,ag;aj=(ar+"_tr_").length;af="tbody tr td";aw.off("click",af).on("click",af,function(){aA=n(this).index()+1;ag=n(this).parent("tr").index()+1;F.triggerHandler("onCellClick",{col:aA,row:ag})});af="tbody tr";aw.off("click",af).on("click",af,function(){if(aq){var aR=parseInt(n(this).attr("id").substr(aj)),aQ;if(Y.rowSelectionMode===false){l(W);aQ="clicked"}else{if(Y.rowSelectionMode=="single"){l(W);aQ="selected"}var aP=n.inArray(aR,F.data(p)["a_selected_ids"]);if(aP>-1){y(W,aR,aP);aQ="deselected"}else{D(W,aR);aQ="selected"}}h(W)}F.triggerHandler("onRowClick",{row_id:aR,row_status:aQ})})}if(Y.showPrefButton){af="#"+v(Y.tools_id_prefix,W)+"_pref";F.off("click",af).on("click",af,function(){j(W,O);var aX=v(Y.pref_tabs_id_prefix,W);n("#"+aX).tabs({create:function(){n("#"+aX+" li a").blur()},activate:function(){n("#"+aX+" li a").blur()}});var aU=v(F.jui_datagrid("getOption","col_order_list_id_prefix"),W),aT=n("#"+aU),aP=F.jui_datagrid("getOption","sortableListLiDisabledClass"),aV,aW,aQ,aR,aS;aT.sortable({cancel:aP,start:function(aY,aZ){aV=aZ.item.index()},stop:function(aY,aZ){aW=aZ.item.index();if(aW!==aV){aQ=F.jui_datagrid("getOption","columns");aR=[];if(aW>aV){for(aH in aQ){if(aH<aV||aH>aW){aR[aH]=aQ[aH]}if(aH>=aV&&aH<aW){aR[aH]=aQ[parseInt(aH)+1]}if(aH==aW){aR[aH]=aQ[aV]}}}if(aW<aV){for(aH in aQ){if(aH>aV||aH<aW){aR[aH]=aQ[aH]}if(aH<=aV&&aH>aW){aR[aH]=aQ[parseInt(aH)-1]}if(aH==aW){aR[aH]=aQ[aV]}}}F.jui_datagrid({columns:aR})}}}).disableSelection();af="input[type=checkbox]";aT.off("click",af).on("click",af,function(){aS=parseInt(n(this).index("#"+aU+" "+af));n("#"+aU+" li").eq(aS).toggleClass(aP);aR=F.jui_datagrid("getOption","columns");aR[aS]["visible"]=n(this).is(":checked")?"yes":"no";F.jui_datagrid({columns:aR})})});var au,aG,aH;au=["_row_numbers","_sort_indicator"];aG=["showRowNumbers","showSortingIndicator"];for(aH in au){m(F,N,"#"+O+au[aH],aG[aH])}au=["_btn_select","_btn_refresh","_btn_delete","_btn_print","_btn_export","_btn_sorting","_btn_filters"];aG=["showSelectButtons","showRefreshButton","showDeleteButton","showPrintButton","showExportButton","showSortingButton","showFiltersButton"];for(aH in au){m(F,N,"#"+O+au[aH],aG[aH])}au=["_slider","_goto_page","_rows_per_page","_rows_info","_nav_buttons"];aG=["useSlider","showGoToPage","showRowsPerPage","showRowsInfo","showNavButtons"];for(aH in au){g(F,N,"#"+O+au[aH],aG[aH])}}if(Y.showSelectButtons&&Y.rowSelectionMode=="multiple"&&aq&&al>0){aj=(ar+"_tr_").length;var aD=n("#"+ar+" tbody tr");aO=v(F.jui_datagrid("getOption","tools_id_prefix"),W);aF=aO+"_drop_select";var ap={all_in_page:1,none_in_page:2,inv_in_page:3,none:4};n("#"+aF).jui_dropdown({onSelect:function(aQ,aR){var aP=aR.index;switch(aP){case ap.all_in_page:case ap.none_in_page:case ap.inv_in_page:aD.each(function(){var aT=parseInt(n(this).attr("id").substr(aj));var aS=n.inArray(aT,F.data(p)["a_selected_ids"]);if(aP==ap.all_in_page){if(aS>-1){}else{D(W,aT)}}else{if(aP==ap.none_in_page){if(aS>-1){y(W,aT,aS)}}else{if(aP==ap.inv_in_page){if(aS>-1){y(W,aT,aS)}else{D(W,aT)}}}}});break;case ap.none:l(W);break}h(W)}})}if(Y.showRefreshButton){af="#"+v(Y.tools_id_prefix,W)+"_refresh";F.off("click",af).on("click",af,function(){n("#"+W).jui_datagrid("refresh")})}if(Y.showDeleteButton&&aq){af="#"+v(Y.tools_id_prefix,W)+"_delete";F.off("click",af).on("click",af,function(){F.triggerHandler("onDelete")})}if(Y.showSortingButton){af="#"+v(Y.tools_id_prefix,W)+"_sorting";F.off("click",af).on("click",af,function(){d(W,S);var aY=v(F.jui_datagrid("getOption","sorting_list_id_prefix"),W),a0=n("#"+aY),aP=F.jui_datagrid("getOption","sortableListLiDisabledClass"),aW,aX,aU,aV;a0.sortable({cancel:aP,start:function(a1,a2){aW=a2.item.index()},stop:function(a1,a2){aX=a2.item.index();if(aX!==aW){aU=F.jui_datagrid("getOption","sorting");aV=[];if(aX>aW){for(aH in aU){if(aH<aW||aH>aX){aV[aH]=aU[aH]}if(aH>=aW&&aH<aX){aV[aH]=aU[parseInt(aH)+1]}if(aH==aX){aV[aH]=aU[aW]}}}if(aX<aW){for(aH in aU){if(aH>aW||aH<aX){aV[aH]=aU[aH]}if(aH<=aW&&aH>aX){aV[aH]=aU[parseInt(aH)-1]}if(aH==aX){aV[aH]=aU[aW]}}}F.jui_datagrid({sorting:aV})}}}).disableSelection();af="input[type=radio]";var aR,aZ,aQ,aS,aT;a0.off("click",af).on("click",af,function(){aR=parseInt(n(this).index("#"+aY+" "+af));aZ=Math.floor(aR/3);aQ=aR%3;aT=n("#"+aY+" li");switch(aQ){case 0:aS="ascending";aT.eq(aZ).removeClass(aP);break;case 1:aS="descending";aT.eq(aZ).removeClass(aP);break;case 2:aS="none";aT.eq(aZ).addClass(aP);break}aV=F.jui_datagrid("getOption","sorting");aV[aZ]["order"]=aS;F.jui_datagrid({sorting:aV})})})}if(Y.showFiltersButton){af="#"+v(Y.tools_id_prefix,W)+"_filters";F.off("click",af).on("click",af,function(){r(W)})}if(al>0){var ah=Y.pageNum,av=Y.rowsPerPage,az=Y.maxRowsPerPage,at=F.jui_datagrid("getPaginationOption","showRowsInfo");Z.jui_pagination({onSetRowsPerPage:function(aP,aQ){if(isNaN(aQ)||aQ<=0){F.jui_datagrid("refresh")}else{az=parseInt(az);if(az>0){if(aQ>az){aQ=az}}F.jui_datagrid({pageNum:1,rowsPerPage:aQ})}},onChangePage:function(aQ,aP){F.jui_datagrid({pageNum:aP})},onDisplay:function(){if(at){var aP=((ah-1)*av)+1,aQ=Math.min(aP+av-1,al),aR=aP+"-"+aQ+" "+rsc_jui_dg.rows_info_of+" "+al+" "+rsc_jui_dg.rows_info_records;n(this).jui_pagination("setRowsInfo",aR)}}})}F.triggerHandler("onDisplay")}})})},getDefaults:function(){return{columns:[{field:"",visible:"no",header:"",headerClass:"",dataClass:""}],sorting:[{sortingName:"",field:"",order:"none"}],filterOptions:{filters:[]},pageNum:1,rowsPerPage:10,maxRowsPerPage:100,row_primary_key:"",rowSelectionMode:"multiple",autoSetColumnsWidth:true,showRowNumbers:false,showSortingIndicator:true,showPrefButton:true,showSelectButtons:true,showRefreshButton:true,showDeleteButton:true,showPrintButton:true,showExportButton:true,showSortingButton:true,showFiltersButton:true,showPrefButtonText:false,showRefreshButtonText:false,showDeleteButtonText:false,showPrintButtonText:false,showExportButtonText:false,showSortingButtonText:false,showFiltersButtonText:false,dropdownSelectOptions:{menuClass:"dropdown_select_menu",launcherClass:"dropdown_select_launcher"},usePagination:true,paginationOptions:{visiblePageLinks:5,useSlider:true,showGoToPage:false,showRowsPerPage:true,showRowsInfo:true,showPreferences:false,disableSelectionNavPane:true},containerClass:"grid_container ui-state-default ui-corner-all",captionClass:"grid_caption ui-widget-header ui-corner-top",datagridHeaderClass:"grid_header ui-state-default",datagridClass:"grid_data ui-widget-content",noResultsClass:"no_records_found",toolsClass:"grid_tools ui-state-default ui-corner-all",paginationClass:"grid_pagination",headerTableClass:"grid_header_table",dataTableClass:"grid_data_table",trHoverTrClass:"",trHoverTdClass:"ui-state-hover",thClass:"grid_th_common ui-state-default",tdClass:"grid_td_common ui-widget-content",thRowNumberClass:"grid_th_common grid_th_row_number ui-state-default",tdRowNumberClass:"grid_td_common grid_td_row_number ui-widget-content",rowIndexHeaderClass:"",rowIndexClass:"",selectedTrTrClass:"",selectedTrTdClass:"ui-state-highlight",tbButtonContainer:"tbBtnContainer",tbPrefIconClass:"ui-icon-gear",tbRefreshIconClass:"ui-icon-refresh",tbDeleteIconClass:"ui-icon-trash",tbPrintIconClass:"ui-icon-print",tbExportIconClass:"ui-icon-extlink",tbSortingIconClass:"ui-icon ui-icon-carat-2-n-s",tbFiltersIconClass:"ui-icon-search",sortableListClass:"grid_sortable_list",sortableListLiClass:"ui-state-default grid_sortable_list_li",sortableListLiDisabledClass:"ui-state-disabled",sortableListLiIconClass:"ui-icon ui-icon-arrowthick-2-n-s grid_sortable_list_li_icon",commonListClass:"grid_common_list",dlgPrefClass:"dlg_pref",dlgPrefButtonClass:"dlg_pref_button",dlgSortClass:"dlg_sort",dlgSortButtonClass:"dlg_sort_button",dlgFiltersClass:"dlg_filters",dlgFiltersButtonClass:"dlg_filters_button",caption_id_prefix:"caption_",datagrid_header_id_prefix:"dgh_",datagrid_id_prefix:"dg_",table_id_prefix:"tbl_",header_table_id_prefix:"tblh_",tools_id_prefix:"tools_",pagination_id_prefix:"pag_",pref_dialog_id_prefix:"pref_dlg_",pref_tabs_id_prefix:"pref_tabs_",col_order_list_id_prefix:"col_order_",col_visible_chk_id_prefix:"col_visible_",sort_dialog_id_prefix:"sort_dlg_",filters_dialog_id_prefix:"filter_dlg_",filter_rules_id_prefix:"flt_rules_",sorting_list_id_prefix:"sort_criteria_",sort_radio_name_prefix:"sort_order_",sort_asc_radio_id_prefix:"sort_asc_",sort_desc_radio_id_prefix:"sort_desc_",sort_none_radio_id_prefix:"sort_none_",fix_border_collapse_td_width:1,debug_mode:"no",onCellClick:function(){},onRowClick:function(){},onDelete:function(){},onDatagridError:function(){},onDebug:function(){},onChangeSelectedRows:function(){},onDisplay:function(){}}},getOption:function(E){var F=this;return F.data(c)[E]},getAllOptions:function(){var E=this;return E.data(c)},setOption:function(E,H,G){var F=this;F.data(c)[E]=H;if(G){F.jui_datagrid("init")}},refresh:function(){var E=this;E.jui_datagrid()},destroy:function(){return n(this).each(function(){var G=n(this),F=G.attr("id"),E=G.jui_datagrid("getOption","pagination_id_prefix")+F;n("#"+E).removeData();G.removeData()})},getSelectedIDs:function(){var E=this;return E.data(p)["a_selected_ids"]},getGridElemTableID:function(){var E=this;return v(E.jui_datagrid("getOption","table_id_prefix"),E.attr("id"))},getGridElemHeaderTableID:function(){var E=this;return v(E.jui_datagrid("getOption","header_table_id_prefix"),E.attr("id"))},setPageColClass:function(J,H,L,E){var I=this,K=I.attr("id"),G="#"+v(I.jui_datagrid("getOption","header_table_id_prefix"),K),F="#"+v(I.jui_datagrid("getOption","table_id_prefix"),K);if(H!==""){n(G+" th").eq(J).addClass(H)}if(L!==""){n(F+" tr").each(function(){n(this).find("td").eq(J).addClass(L)})}if(E){x(K)}},removePageColClass:function(J,H,L,E){var I=this,K=I.attr("id"),G="#"+v(I.jui_datagrid("getOption","header_table_id_prefix"),K),F="#"+v(I.jui_datagrid("getOption","table_id_prefix"),K);n(G+" th").eq(J).removeClass(H);n(F+" tr").each(function(){n(this).find("td").eq(J).removeClass(L)});if(E){x(K)}},getPaginationOption:function(G){var F=this.attr("id"),E=n("#"+F).jui_datagrid("getOption","pagination_id_prefix")+F;return n("#"+E).jui_pagination("getOption",G)},getAllPaginationOptions:function(){var F=this.attr("id"),E=n("#"+F).jui_datagrid("getOption","pagination_id_prefix")+F;return n("#"+E).jui_pagination("getAllOptions")},getDropdownLauncherID:function(){var E=this,F=E.attr("id");return v(E.jui_datagrid("getOption","tools_id_prefix"),F)+"_drop_select"}};var v=function(F,E){return F+E};var b=function(E){return(n("#"+E).length===0?false:true)};var w=function(E,H,G,F){E.button({label:H,text:G,icons:{primary:F}})};var u=function(E,F){if(!b(E)){return false}else{return(typeof n("#"+E).data(F)==="object"?true:false)}};var g=function(G,F,E,H){F.off("click",E).on("click",E,function(){var I={};I[H]=n(this).is(":checked");G.jui_datagrid({paginationOptions:I})})};var m=function(G,F,E,H){F.off("click",E).on("click",E,function(){var I={};I[H]=n(this).is(":checked");G.jui_datagrid(I)})};var t=function(E,F){var G;G="<li>";G+='<input type="checkbox" id="'+E+'" /><label for="'+E+'">'+F+"</label>";G+="</li>";return G};var f=function(G,H){var F="";for(var E in G){if(G[E].field==H){if(G[E].order=="ascending"){F="&nbsp;&uarr;"}else{if(G[E].order=="descending"){F="&nbsp;&darr;"}}break}}return F};var o=function(H){var W=n("#"+H),K=W.jui_datagrid("getOption","pref_dialog_id_prefix"),M=v(K,H),P=W.jui_datagrid("getOption","pref_tabs_id_prefix"),G=v(P,H),Y=W.jui_datagrid("getOption","commonListClass"),F=W.jui_datagrid("getOption","columns"),O=W.jui_datagrid("getOption","sortableListClass"),J=W.jui_datagrid("getOption","sortableListLiClass"),X=W.jui_datagrid("getOption","sortableListLiDisabledClass"),I=W.jui_datagrid("getOption","sortableListLiIconClass"),V=v(W.jui_datagrid("getOption","col_order_list_id_prefix"),H),Q=v(W.jui_datagrid("getOption","col_visible_chk_id_prefix"),H)+"_",N,R,L,T,U="",S,E;U+='<div id="'+G+'">';U+="<ul>";U+='<li><a href="#'+G+'_grid">'+rsc_jui_dg.pref_tab_grid+"</a></li>";U+='<li><a href="#'+G+'_tools">'+rsc_jui_dg.pref_tab_tools+"</a></li>";U+='<li><a href="#'+G+'_nav">'+rsc_jui_dg.pref_tab_nav+"</a></li>";U+="</ul>";U+='<div id="'+G+'_grid">';U+='<ul class="'+Y+'" style="margin-bottom: 20px;">';U+=t(M+"_row_numbers",rsc_jui_dg.pref_show_row_numbers);U+=t(M+"_sort_indicator",rsc_jui_dg.pref_show_sorting_indicator);U+="</ul>";U+="<p>"+rsc_jui_dg.pref_col_order_visibility+"</p>";U+='<ul id="'+V+'" class="'+O+'">';for(T in F){L=F[T]["visible"]=="no"?" "+X:"";R=F[T]["visible"]=="no"?"":' checked="checked"';N=Q+T;U+='<li class="'+J+L+'"><span class="'+I+'"></span><input type="checkbox" id="'+N+'"'+R+'><label for="'+N+'">'+F[T].header+"</label></li>"}U+="</ul>";U+="</div>";U+='<div id="'+G+'_tools">';U+='<ul style="list-style-type: none;">';U+=t(M+"_btn_select",rsc_jui_dg.pref_show_select);U+=t(M+"_btn_refresh",rsc_jui_dg.pref_show_refresh);U+=t(M+"_btn_delete",rsc_jui_dg.pref_show_delete);U+=t(M+"_btn_print",rsc_jui_dg.pref_show_print);U+=t(M+"_btn_export",rsc_jui_dg.pref_show_export);U+=t(M+"_btn_sorting",rsc_jui_dg.pref_show_sorting);U+=t(M+"_btn_filters",rsc_jui_dg.pref_show_filters);U+="</ul>";U+="</div>";U+='<div id="'+G+'_nav">';U+='<ul style="list-style-type: none;">';U+=t(M+"_slider",rsc_jui_pag.pref_show_slider);U+=t(M+"_goto_page",rsc_jui_pag.pref_show_goto_page);U+=t(M+"_rows_per_page",rsc_jui_pag.pref_show_rows_per_page);U+=t(M+"_rows_info",rsc_jui_pag.pref_show_rows_info);U+=t(M+"_nav_buttons",rsc_jui_pag.pref_show_nav_buttons);U+="</ul>";U+="</div>";U+="</div>";n("#"+M).html(U);S=["_row_numbers","_sort_indicator"];E=["showRowNumbers","showSortingIndicator"];for(T in S){n("#"+M+S[T]).attr("checked",W.jui_datagrid("getOption",E[T]))}S=["_btn_select","_btn_refresh","_btn_delete","_btn_print","_btn_export","_btn_sorting","_btn_filters"];E=["showSelectButtons","showRefreshButton","showDeleteButton","showPrintButton","showExportButton","showSortingButton","showFiltersButton"];for(T in S){n("#"+M+S[T]).attr("checked",W.jui_datagrid("getOption",E[T]))}S=["_slider","_goto_page","_rows_per_page","_rows_info","_nav_buttons"];E=["useSlider","showGoToPage","showRowsPerPage","showRowsInfo","showNavButtons"];for(T in S){n("#"+M+S[T]).attr("checked",W.jui_datagrid("getPaginationOption",E[T]))}};var j=function(F,G){var I=n("#"+F),H=n("#"+G),J=I.jui_datagrid("getOption","dlgPrefClass"),E=I.jui_datagrid("getOption","dlgPrefButtonClass");if(u(G,"dialog")){H.dialog("destroy")}H.dialog({autoOpen:true,width:400,height:"auto",position:{my:"top",at:"top",of:"#"+F},title:rsc_jui_dg.preferences,buttons:[{text:rsc_jui_dg.preferences_close,click:function(){n(this).dialog("close")}}],open:o(F),create:function(){n(this).addClass(J);n(this).closest(".ui-dialog").find(".ui-button").addClass(E)}})};var k=function(G){var ab=n("#"+G),H=ab.jui_datagrid("getOption","sort_dialog_id_prefix"),R=v(H,G),ad=ab.jui_datagrid("getOption","commonListClass"),F=ab.jui_datagrid("getOption","sorting"),U=ab.jui_datagrid("getOption","sortableListClass"),L=ab.jui_datagrid("getOption","sortableListLiClass"),ac=ab.jui_datagrid("getOption","sortableListLiDisabledClass"),I=ab.jui_datagrid("getOption","sortableListLiIconClass"),ae=v(ab.jui_datagrid("getOption","sorting_list_id_prefix"),G),P=v(ab.jui_datagrid("getOption","sort_radio_name_prefix"),G)+"_",E,J=v(ab.jui_datagrid("getOption","sort_asc_radio_id_prefix"),G)+"_",M=v(ab.jui_datagrid("getOption","sort_desc_radio_id_prefix"),G)+"_",K=v(ab.jui_datagrid("getOption","sort_none_radio_id_prefix"),G)+"_",Q,O,Z,aa,T,N,S,W,Y,X,V="";V+='<div style="margin: 5px; padding: 5px;">';V+="<p>"+rsc_jui_dg.sorting_criteria+"</p>";V+='<ul id="'+ae+'" class="'+U+'">';for(X in F){Y=F[X]["order"]=="none"?" "+ac:"";E=P+X;Q=J+X;O=M+X;Z=K+X;aa=F[X]["order"]=="ascending"?' checked="checked"':"";T=F[X]["order"]=="descending"?' checked="checked"':"";N=F[X]["order"]=="none"?' checked="checked"':"";V+='<li class="'+L+Y+'"><span class="'+I+'"></span>'+F[X].sortingName+'<span style="float: right; vertical-align: middle;"><input type="radio" name="'+E+'" id="'+Q+'"'+aa+'><label for="'+Q+'">'+rsc_jui_dg.sort_ascending+'</label><input type="radio" name="'+E+'" id="'+O+'"'+T+'><label for="'+O+'">'+rsc_jui_dg.sort_descending+'</label><input type="radio" name="'+E+'" id="'+Z+'"'+N+'><label for="'+Z+'">'+rsc_jui_dg.sort_none+"</label></span></li>"}V+="</ul>";V+="</div>";n("#"+R).html(V)};var d=function(F,G){var I=n("#"+F),J=n("#"+G),E=I.jui_datagrid("getOption","dlgSortClass"),H=I.jui_datagrid("getOption","dlgSortButtonClass");if(u(G,"dialog")){J.dialog("destroy")}J.dialog({autoOpen:true,width:500,height:"auto",position:{my:"top",at:"top",of:"#"+F},title:rsc_jui_dg.sorting,buttons:[{text:rsc_jui_dg.sorting_close,click:function(){n(this).dialog("close")}}],open:function(){k(F)},create:function(){n(this).addClass(E);n(this).closest(".ui-dialog").find(".ui-button").addClass(H).focus()}})};var C=function(O){var F=n("#"+O),G=v(F.jui_datagrid("getOption","filter_rules_id_prefix"),O),L=n("#"+G),H,P,I,K,N,E,J,M;H=F.jui_datagrid("getOption","filterOptions");P=["onValidationError"];for(K=0;K<I;K++){if(typeof(H[P[K]])!="undefined"){delete H[P[K]]}}E=L.data("jui_filter_rules");if(typeof(E)==="undefined"){J=F.jui_datagrid("getDefaults");M=J.filterOptions;E=n.extend({},M,H)}else{E=n.extend({},E,H)}N={onValidationError:function(Q,R){F.triggerHandler("onDatagridError",R)}};E=n.extend({},E,N);L.jui_filter_rules(E)};var r=function(L){var E=n("#"+L),K=v(E.jui_datagrid("getOption","filters_dialog_id_prefix"),L),F=v(E.jui_datagrid("getOption","filter_rules_id_prefix"),L),H=n("#"+K),I=n("#"+F),G=E.jui_datagrid("getOption","dlgFiltersClass"),M=E.jui_datagrid("getOption","dlgFiltersButtonClass"),J;if(u(K,"dialog")){H.dialog("destroy")}H.dialog({autoOpen:true,width:"auto",height:"auto",position:{my:"top",at:"top",of:"#"+L},title:rsc_jui_dg.filters,buttons:[{text:rsc_jui_dg.filters_apply,click:function(){J=I.jui_filter_rules("getRules",0,[]);if(J!==false){I.jui_filter_rules("markAllRulesAsApplied");E.data(p)["filter_rules"]=J;E.data(p)["a_selected_ids"]=[];E.data(p)["count_selected_ids"]=0;E.jui_datagrid({pageNum:1})}}},{text:rsc_jui_dg.filters_reset,click:function(){I.jui_filter_rules("clearAllRules");E.data(p)["filter_rules"]=[];E.jui_datagrid({pageNum:1})}}],open:function(){C(L)},create:function(){n(this).addClass(G);n(this).closest(".ui-dialog").find(".ui-button").addClass(M)}})};var a=function(aa,L,V,P){var ab=n("#"+aa),G=ab.jui_datagrid("getOption","columns"),H=ab.jui_datagrid("getOption","sorting"),ac=parseInt(ab.jui_datagrid("getOption","pageNum")),O=parseInt(ab.jui_datagrid("getOption","rowsPerPage")),Y=ab.jui_datagrid("getOption","showRowNumbers"),F=V.length,W=v(ab.jui_datagrid("getOption","datagrid_header_id_prefix"),aa),N=v(ab.jui_datagrid("getOption","datagrid_id_prefix"),aa),E=n("#"+W),T=n("#"+N),Q=v(ab.jui_datagrid("getOption","header_table_id_prefix"),aa),S=v(ab.jui_datagrid("getOption","table_id_prefix"),aa),X=ab.jui_datagrid("getOption","showSortingIndicator"),J,ad,Z,K,U,M,R,I;I=((ac-1)*O);U="";U+='<table id="'+Q+'">';U+="<thead>";ad=(P?' id="'+Q+'_tr_0"':"");U+="<tr"+ad+">";if(Y){U+="<th>"+rsc_jui_dg.row_index_header+"</th>"}for(Z in G){if(G[Z].visible=="yes"){J="";if(X){J=f(H,G[Z].field)}U+="<th>"+G[Z].header+J+"</th>"}}U+="</tr>";U+="</thead>";U+="</table>";E.html(U);M="";M+='<table id="'+S+'">';M+="<tbody>";for(K in V){ad=(P?' id="'+S+"_tr_"+V[K][P]+'"':"");M+="<tr"+ad+">";if(Y){R=I+parseInt(K)+1;M+="<td>"+R+"</td>"}for(Z in G){if(G[Z].visible=="yes"){M+="<td>"+V[K][G[Z].field]+"</td>"}}M+="</tr>"}M+="<tbody>";M+="</table>";T.html(M)};var s=function(R){var U=n("#"+R),I="#"+v(U.jui_datagrid("getOption","header_table_id_prefix"),R),W="#"+v(U.jui_datagrid("getOption","table_id_prefix"),R),T=n(I),S=n(W),X=U.jui_datagrid("getOption","headerTableClass"),O=U.jui_datagrid("getOption","dataTableClass"),V=U.jui_datagrid("getOption","trHoverTrClass"),H=U.jui_datagrid("getOption","trHoverTdClass"),E=U.jui_datagrid("getOption","thClass"),N=U.jui_datagrid("getOption","tdClass"),F=U.jui_datagrid("getOption","thRowNumberClass"),L=U.jui_datagrid("getOption","tdRowNumberClass"),G=U.jui_datagrid("getOption","columns"),P=U.jui_datagrid("getOption","showRowNumbers"),K,J,Q,M=P?1:0;T.removeClass(X).addClass(X);T.find("th").removeClass(E).addClass(E);S.removeClass(O).addClass(O);S.find("td").removeClass(N).addClass(N);if(P){T.find("th:first").removeClass(F).addClass(F);S.find("tr").find("td:first").removeClass(L).addClass(L)}if(V!=""){S.on("mouseover mouseout","tbody tr",function(Y){n(this).toggleClass(V,Y.type=="mouseover")})}if(H!=""){S.on("mouseover mouseout","tbody tr",function(Y){n(this).children().toggleClass(H,Y.type=="mouseover")})}for(Q in G){if(G[Q].visible=="yes"){K=G[Q]["headerClass"];J=G[Q]["dataClass"];U.jui_datagrid("setPageColClass",M,K,J,false);M++}}x(R)};var q=function(K,M){if(M){var F=n("#"+K),J=F.jui_datagrid("getOption","rowSelectionMode"),L=F.jui_datagrid("getOption","selectedTrTrClass"),H=F.jui_datagrid("getOption","selectedTrTdClass"),I=v(F.jui_datagrid("getOption","table_id_prefix"),K),E=(I+"_tr_").length;if(J=="multiple"){var G="#"+I+" tbody tr";n(G).each(function(){var O=parseInt(n(this).attr("id").substr(E));var N=n.inArray(O,F.data(p)["a_selected_ids"]);if(N>-1){z(n(this),true,L,H)}})}else{l(K)}}else{l(K)}};var i=function(ah,S,ab){var ax=n("#"+ah),aC=v(ax.jui_datagrid("getOption","tools_id_prefix"),ah),aq=ax.jui_datagrid("getOption","toolsClass"),ar=ax.jui_datagrid("getOption","rowSelectionMode"),ad=ax.jui_datagrid("getOption","tbButtonContainer"),at=ax.jui_datagrid("getOption","showPrefButton"),ag=ax.jui_datagrid("getOption","showPrefButtonText"),K=ax.jui_datagrid("getOption","tbPrefIconClass"),au=ax.jui_datagrid("getOption","showSelectButtons"),af=ax.jui_datagrid("getOption","showRefreshButton"),aw=ax.jui_datagrid("getOption","showRefreshButtonText"),J=ax.jui_datagrid("getOption","tbRefreshIconClass"),ay=ax.jui_datagrid("getOption","showDeleteButton"),X=ax.jui_datagrid("getOption","showDeleteButtonText"),ai=ax.jui_datagrid("getOption","tbDeleteIconClass"),M=ax.jui_datagrid("getOption","showPrintButton"),az=ax.jui_datagrid("getOption","showPrintButtonText"),Q=ax.jui_datagrid("getOption","tbPrintIconClass"),ao=ax.jui_datagrid("getOption","showExportButton"),V=ax.jui_datagrid("getOption","showExportButtonText"),Z=ax.jui_datagrid("getOption","tbExportIconClass"),ak=ax.jui_datagrid("getOption","showSortingButton"),ap=ax.jui_datagrid("getOption","showSortingButtonText"),H=ax.jui_datagrid("getOption","tbSortingIconClass"),P=ax.jui_datagrid("getOption","showFiltersButton"),al=ax.jui_datagrid("getOption","showFiltersButtonText"),an=ax.jui_datagrid("getOption","tbFiltersIconClass");var O="";if(at){O+='<div class="'+ad+'">';var F=aC+"_pref";O+='<button id="'+F+'">'+rsc_jui_dg.preferences+"</button>";O+="</div>"}if(S>0){if(au&&ar=="multiple"&&ab){var av=aC+"_drop_select";var L=ax.data(p)["count_selected_ids"];O+='<div class="'+ad+'">';O+='<div id="'+av+'">';O+='<div id="'+av+'_launcher_container">';O+='<button id="'+av+'_launcher">'+rsc_jui_dg.tb_selected_label+": "+L+"</button>";O+="</div>";O+='<ul id="'+av+'_menu">';O+='<li id="'+av+'_all_in_page"><a href="javascript:void(0);">'+rsc_jui_dg.tb_select_all_in_page+"</a></li>";O+='<li id="'+av+'_none_in_page"><a href="javascript:void(0);">'+rsc_jui_dg.tb_select_none_in_page+"</a></li>";O+='<li id="'+av+'_inv_in_page"><a href="javascript:void(0);">'+rsc_jui_dg.tb_select_inverse_in_page+"</a></li>";O+="<hr>";O+='<li id="'+av+'_none"><a href="javascript:void(0);">'+rsc_jui_dg.tb_select_none+"</a></li>";O+="</ul>";O+="</div>";O+="</div>"}}if(af){O+='<div class="'+ad+'">';var aD=aC+"_refresh";O+='<button id="'+aD+'">'+rsc_jui_dg.tb_refresh+"</button>";O+="</div>"}if(S>0){if(ay&&ab){O+='<div class="'+ad+'">';var R=aC+"_delete";O+='<button id="'+R+'">'+rsc_jui_dg.tb_delete+"</button>";O+="</div>"}}if(S>0){if(M||ao){O+='<div class="'+ad+'">'}if(M){var W=aC+"_print";O+='<button id="'+W+'">'+rsc_jui_dg.tb_print+"</button>"}if(ao){var I=aC+"_export";O+='<button id="'+I+'">'+rsc_jui_dg.tb_export+"</button>"}if(M||ao){O+="</div>"}}if(ak){O+='<div class="'+ad+'">';var U=aC+"_sorting";O+='<button id="'+U+'">'+rsc_jui_dg.tb_sorting+"</button>";O+="</div>"}if(P){O+='<div class="'+ad+'">';var ac=aC+"_filters";O+='<button id="'+ac+'">'+rsc_jui_dg.tb_filters+"</button>";O+="</div>"}n("#"+aC).html(O);if(at){w(n("#"+F),rsc_jui_dg.preferences,ag,K)}if(S>0){if(au&&ar=="multiple"&&ab){var G=n("#"+av),ae=av+"_launcher",T=av+"_launcher_container",E=av+"_menu",N=ax.jui_datagrid("getOption","dropdownSelectOptions"),aa=["launcher_id","launcher_container_id","menu_id","onSelect"];for(var aA in aa){if(typeof(N[aa[aA]])!="undefined"){delete N[aa[aA]]}}var aj=G.data("jui_dropdown");if(typeof(aj)==="undefined"){var Y=ax.jui_datagrid("getDefaults");var aB=Y.dropdownSelectOptions;aj=n.extend({},aB,N)}else{aj=n.extend({},aj,N)}var am={launcher_id:ae,launcher_container_id:T,menu_id:E};aj=n.extend({},aj,am);G.jui_dropdown(aj)}}if(af){w(n("#"+aD),rsc_jui_dg.tb_refresh,aw,J)}if(S>0){if(ay){w(n("#"+R),rsc_jui_dg.tb_delete,X,ai)}}if(S>0){if(M){w(n("#"+W),rsc_jui_dg.tb_print,az,Q)}if(ao){w(n("#"+I),rsc_jui_dg.tb_export,V,Z)}}if(ak){w(n("#"+U),rsc_jui_dg.tb_sorting,ap,H)}if(P){w(n("#"+ac),rsc_jui_dg.tb_filters,al,an)}};var e=function(M,J){var I=n("#"+M),Q=I.jui_datagrid("getOption","pageNum"),F=I.jui_datagrid("getOption","rowsPerPage"),K=I.jui_datagrid("getOption","maxRowsPerPage"),T=Math.ceil(J/F),E=I.jui_datagrid("getOption","paginationClass"),P=v(I.jui_datagrid("getOption","pagination_id_prefix"),M),H=n("#"+P),L=I.jui_datagrid("getOption","paginationOptions"),U=["currentPage","rowsPerPage","totalPages","containerClass","onSetRowsPerPage","onChangePage","onDisplay"];for(var O in U){if(typeof(L[U[O]])!="undefined"){delete L[U[O]]}}var R=H.data("jui_pagination");if(typeof(R)==="undefined"){var N=I.jui_datagrid("getDefaults");var S=N.paginationOptions;R=n.extend({},S,L)}else{R=n.extend({},R,L)}var G={currentPage:Q,rowsPerPage:F,totalPages:T,containerClass:E};R=n.extend({},R,G);H.jui_pagination(R)};var A=function(H){var F=n("#"+H),E=F.jui_datagrid("getOption","datagrid_id_prefix")+H,G=F.jui_datagrid("getOption","noResultsClass");n("#"+E).html('<div class="'+G+'">'+rsc_jui_dg.no_records_found+"</div>")};var z=function(G,F,H,E){if(F==true){if(H){G.addClass(H)}if(E){G.children("td").addClass(E)}}else{if(H){G.removeClass(H)}if(E){G.children("td").removeClass(E)}}};var D=function(G,H){var K=n("#"+G),F=K.jui_datagrid("getOption","table_id_prefix"),L=v(F,G),J=n("#"+L+"_tr_"+H),E=K.jui_datagrid("getOption","selectedTrTrClass"),I=K.jui_datagrid("getOption","selectedTrTdClass");K.data(p)["a_selected_ids"].push(H);K.data(p)["count_selected_ids"]+=1;z(J,true,E,I)};var y=function(L,F,H){var G=n("#"+L),I=G.jui_datagrid("getOption","table_id_prefix"),K=v(I,L),E=n("#"+K+"_tr_"+F),M=G.jui_datagrid("getOption","selectedTrTrClass"),J=G.jui_datagrid("getOption","selectedTrTdClass");G.data(p)["a_selected_ids"].splice(H,1);G.data(p)["count_selected_ids"]-=1;z(E,false,M,J)};var l=function(G){var J=n("#"+G),F=J.jui_datagrid("getOption","table_id_prefix"),K=v(F,G),I=n("#"+K),E=J.jui_datagrid("getOption","selectedTrTrClass"),H=J.jui_datagrid("getOption","selectedTrTdClass");J.data(p)["a_selected_ids"]=[];J.data(p)["count_selected_ids"]=0;I.find("tr").removeClass(E);I.find("td").removeClass(H)};var h=function(E){var G=n("#"+E),H=G.data(p)["count_selected_ids"],F=v(G.jui_datagrid("getOption","tools_id_prefix"),E),I=F+"_drop_select";n("#"+I+"_launcher").button({label:rsc_jui_dg.tb_selected_label+": "+H});G.triggerHandler("onChangeSelectedRows")};var x=function(J){var G=n("#"+J),E="#"+v(G.jui_datagrid("getOption","header_table_id_prefix"),J),H="#"+v(G.jui_datagrid("getOption","table_id_prefix"),J),S=n(E+" th").length,P=S-1,K,L,F,T=false,I,N,M,R,Q=[],O=parseInt(G.data(p)["fix_border_collapse_td_width"]);for(K=0;K<P;K++){L=n(E+" th").eq(K).width();F=n(H).find("tr").eq(0).find("td").eq(K).width();if(L!==F){T=true;break}}if(T){n(E).addClass("shrink");for(K=0;K<S;K++){M=n(E).find("tr").eq(0).find("th").eq(K);N=M.width();R=n(H).find("tr").eq(0).find("td").eq(K);R.css("min-width",N+"px")}n(E).removeClass("shrink");n(E).width(n(H).width());for(K=0;K<S;K++){var U=n(H).find("tr").eq(0).find("td").eq(K);I=U.width()+O;Q.push(I);n(E+" th").eq(K).width(I)}}};n.fn.jui_datagrid=function(F){if(this.size()!=1){var E="You must use this plugin ("+c+") with a unique element (at once)";this.html('<span style="color: red;">ERROR: '+E+"</span>");n.error(E)}if(B[F]){return B[F].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof F==="object"||!F){return B.init.apply(this,arguments)}else{n.error("Method "+F+" does not exist on jQuery."+c)}}}})(jQuery);