function toInit(){var u=$("#conds span.fname"),n,t,i,r;if(u.length>1&&(n=0,u.each(function(){t=$(this).width();t>n&&(n=t)}).each(function(){i=n-$(this).width();i>0&&$(this).css("padding-left",i)})),$("#conds .dateTrigger").each(function(){BindDateMenu(this,$(this).closest("li"),function(){$("#conds li.actived").length==1&&doSearch()})}),fixWidth(),r=AutoComplete("#conds :text[acfid]"),r.length==1&&$("#conds li.actived").length==1)r.on("autocompleteselect",function(n,t){return this.value=t.item.value,this.value!=""&&doSearch(),!1});switchArea(!0);setTimeout(focusFirst,0)}function fixWidth(){var n=$("#header").width()-2;if($("#main").css({width:n}),$("#btnSearch").is(".big")){var t=$("#conds"),i=!$("#main").is(".float"),r=t.outerWidth(!0)+$("#btnSearch").outerWidth(!0)>n;$("#btns").toggleClass("wraped",i||r)}}function focusFirst(){$("#conds :text:first").select().focus()}function doSearch(n){var t,i,e=$(n),u,f,r;if(e.is("#conds .btn"))i=new Array(1),t=new Array(1),t[0]=e.val(),i[0]=t;else if(u=null,f=$("#conds li.actived"),i=new Array(f.length),f.each(function(n){if(r=$(":text, span:has(:radio), select",this),r.length==0||r.length>2)return u="意外错误：输入元素的数量不符合预期，请与软件开发商联系。",!1;t=new Array(r.length);r.each(function(n){t[n]=$(this).is("span")?$(":radio:checked:first",this).val():$(this).val()});i[n]=t}),u)return showAndExit(u);return __doPostBack("btnSearch",$.toJSON(i)),showLoading(),$("#reswin").css("visibility","visible").attr("src","about:blank"),!1}function blured(n){var i=$("#reswin").attr("src"),t;/\.aspx|to\.htm/ig.test(i)&&switchArea(!1);hideDates(n);try{t=getTop().mainFrame;t.CloseFinder();t.CloseAcHelper()}catch(r){}}function searched(n,t){hideLoading();var i=$("#reswin");if(n)alert(n),i.attr("src","about:blank");else{if(!$("#main").is(".float")){if($("#main").addClass("float"),$.browser.msie||$.browser.ie11)i.focus(blured);else i.on("load",function(){$(i[0].contentWindow).focus(blured)});fixWidth();$("#header").addClass("pointer").poshytip({content:function(){return $("#main").is(".hidden")?"点击展开搜索区":"点击隐藏搜索区"}}).click(toSwitch);$("#tdHeader").addClass("down")}switchArea(!1);i[0].contentWindow.location.replace(t);hideAlert()}}function toSwitch(n){if(!$(getEventSrc(n)).is("select")){var t=$("#main").is(".hidden");switchArea(t)}}function switchArea(n){$("#main").toggleClass("hidden",!n);$("#main").is(".float")&&$("#tdHeader").toggleClass("down",!n).toggleClass("up",n)}function focusNext(){var n=$(this).next(":text");n.length>0?n.focus():$("#conds li").length==1&&doSearch()}function rblClicking(n){var t=$(getEventSrc(n));t.is("label")&&(t=$("#"+t.attr("for")));t.is(":radio:checked")&&setTimeout(function(){t.prop("checked",!1).closest("[onmouseup^='rblClicking']").trigger("click")},0)}LoadDatePicker();$(function(){$(window).resize(function(){fixWidth()});toInit();setFinder(getUrlParam("tid"))})