function ddlVarsChanged(n){var t=$(n).val();$("#varName").val(t).css("width",getTextWidth(t)+2)}function isTopMode(n){var t=$("#dplOper"+n).val();return!IsVoid(t)&&t.indexOf("最")==0}function FiledsChged(n,t){var i=n.id.substr(n.id.length-1),e=n.options[n.selectedIndex],f=e.getAttribute("dbType"),r=$("#dplOper"+i),u,s,o;f=="Boolean"?($f("dplYN"+i).style.display="inline",$f("tb1_"+i).style.display="none",$f("span"+i).style.display="none",r[0].selectedIndex=2,r.prop("disabled",!0)):($f("dplYN"+i).style.display="none",$f("tb1_"+i).style.display="inline",r.removeProp("disabled"));u=$("#tb1_"+i+",#tb2_"+i);t||u.val("");u.unbind().focus(checkThis).removeAttr("My97").click(function(){$(this).attr("My97")!="1"&&$dp.hide();isTopMode(i)&&setTimeout("$dp.hide();",0)});s=$(e).is("[fType]");f=="DateTime"?(o=e.getAttribute("strFormat"),$("#tb1_"+i).attr("My97","1").focus(function(){isTopMode(i)||WdatePicker({onpicked:function(){try{$f("tb2_"+i).focus()}catch(n){}},dateFmt:o,errDealMode:3,enableInputMask:!1})}),$("#tb2_"+i).attr("My97","1").focus(function(){isTopMode(i)||WdatePicker({dateFmt:o,errDealMode:3,enableInputMask:!1})}),$("option.DatePart",r).length==0&&arr[i].appendTo("#dplOper"+i)):s?getEventSrc()==n&&e.getAttribute("fType")=="SingleList"&&r.val("等于"):f=="Double";try{u.removeAttr("acfid").autocomplete("destroy")}catch(h){}if(f!="DateTime"&&f!="Boolean"&&r.val().indexOf("最")==-1){u.attr("acfid",tid+"|"+$(n).val());AutoComplete(u);u.on("autocompletesearch",function(){var n=$(this).closest("li").find("select[id^='dplOper']").val();if(!IsVoid(n)&&n.indexOf("最")==0)return!1});if($("body").is(".finderBody"))u.on({autocompleteopen:function(){resizeFinder(!1,!0)},autocompleteclose:function(){resizeFinder(!1,!0)}})}f!="DateTime"&&$("option.DatePart",r).length>0&&(arr[i]=$("#dplOper"+i+" option.DatePart").remove());symChged(r[0])}function InitFilter(){for(var t=1,n=1;n<=5;n++)$f("dplFileds"+n).selectedIndex>0&&(t=n);for(n=1;n<=t;n++)$f("Cond"+n).className="show",FiledsChged($f("dplFileds"+n),!0),symChged($f("dplOper"+n))}function symChged(n){var t=n.id.substr(n.id.length-1),i=$(n).val();$("body").is(".finderBody")&&$(getEventSrc()).attr("id")==n.id&&resizeFinder(!0,!1);$("#span"+t).css("display",i=="介于"?"inline":"none");n.options[n.selectedIndex].className=="DatePart"?($("#s"+t).hide(),$("#d_"+t).show()):($("#s"+t).show(),$("#d_"+t).hide(),inited||setTimeout(function(){$("#tb1_"+t).trigger("focus")},0));$("#tb3_"+t).css("display",i=="Last"||i=="Future"?"inline":"none");$(n).closest("li").find(".topUnit").css("display",isTopMode(t)?"inline":"none")}function resizeFinder(n,t){var i,r,u;try{i=parent.$("#fixedFinder");n&&(r=$("#conds select[id^='dplOper']:visible option[value='介于']:selected").length>0?514:386,i.width(r));t&&(u=$("ul.ui-autocomplete:visible").length>0?Math.max(document.documentElement.scrollHeight,document.body.scrollHeight)+4:$("#conds").outerHeight(!0)+72,i.find("#finderMain").height(u))}catch(f){}}function addCond(){return $("#Cond3").is(".hide")?$("#Cond3").removeClass("hide"):$("#Cond4").is(".hide")?$("#Cond4").removeClass("hide"):$("#Cond5").is(".hide")&&($("#Cond5").removeClass("hide"),$("#addCond").parent().hide()),$("body.finderBody").length>0&&resizeFinder(!1,!0),tryFitParent(),!1}function setAutoCheck(){$("li select,li :text,li :radio","ul.cond").focus(checkThis)}function checkThis(){$(this).closest("li").find(":checkbox").prop("checked",!0)}function CancelFilter(){var n=window.dialogArguments||opener;try{n.CancelFilter(getUrlParam("SessionName"))}catch(t){}window.close()}function filterSetted(n){var t=window.dialogArguments||opener;try{t.filterSetted(n)}catch(i){}window.close()}function preSave(){return hasSelected("conds")?!0:showAndExit("至少应勾选并设置一个条件！")}function toSaveFilter(){return hasSelected("conds")?ShowPop("filterAttr_popup"):showAndExit("至少应勾选并设置一个条件！")}function toSavesc(n){return __doPostBack("ibSavesc",n),!0}LoadDatePicker();var lastFocusBoxID,inited=!0,arr=new Array(5),tid;$(function(){tid=getUrlParam("tid");ddlVarsChanged("#ddlVars");$("select[id^='dplFileds']").each(function(){FiledsChged(this,!0)});bindCopy("iconCopy","varName");$("#conds .tb").change(function(){var n=$(this),t=n.val(),i;!IsVoid(t)&&/^\[\w{2,20}\]$/.test(t)?(i=$("#ddlVars option[value='"+t+"']").text(),IsVoid(i)?n.removeAttr("title"):n.attr("title",i)):n.removeAttr("title")}).trigger("change");inIframe()&&$("#divHeader").hide();$(window).load(function(){$("body").is(".finderBody")&&($("html").css("overflow","hidden"),resizeFinder(!0,!0))});inited=!1})