function show_search_box(str,obj_name,input_type,win){var textObj=_gId(obj_name,win);var div_w=textObj.offsetWidth;if(!textObj)textObj=_gName(obj_name,win)[0];if(str==""){if(_gId("search_box_div__"+obj_name,win)){_gId("search_box_div__"+obj_name,win).innerHTML="";_gId("search_box_div__"+obj_name,win).style.display="none";}return;}if(!_gId("search_box_div__"+obj_name,win)){var s="<div id='search_box_div__"+obj_name+"' style='width:"+div_w+"px;' class='search_box' onMouseOver=\"this.hid='no'\" onMouseOut=\"this.hid='yes'\" onclick=\"this.style.display='none'\"></div>";win.document.body.insertAdjacentHTML("beforeEnd",s);}else{_gId("search_box_div__"+obj_name,win).innerHTML="";_gId("search_box_div__"+obj_name,win).style.display="block";	}var a="";var cn="class='cur_select'";if(input_type=="class_tb") {var arr=str.split("|/tr|"),arr1;var max_item=arr.length;for(var i=0;i<max_item-1;i++){arr1=arr[i].split("|/td|");if(i!=0){cn="";}a+="<a href='#ytd;' "+cn+" style='width:100%' onclick=\"tops.sou_box_A_to_input('"+escape(arr1[2])+"','"+obj_name+"',window)\"><span style='width:65%'>"+arr1[0]+"</span><span>"+arr1[1]+"</span></a>";}}else if(input_type=="select"){var arr=str.split(","),title,simple;for(var i=0;i<arr.length;i++){if(i!=0){cn="";}if(arr[i].indexOf("|")>-1){title=arr[i].split("|")[0];simple=arr[i].split("|")[1];}else{title=arr[i];simple="";}if(!textObj){alert("对象不存在,可能字段名被修改.");return;}a+="<a href='#ytd' "+cn+" style='width:100%' onclick=tf.set_selectValue_onText('"+title+"','"+textObj.name+"',window)><span style='width:65%'>"+title+"</span><span>"+simple+"</span></a>";}textObj.focus();}else if(input_type=="tb"){var arr=str.split("|/tr|"),arr1;var max_item=arr.length;for(var i=0;i<max_item-1;i++){arr1=arr[i].split("|/td|");if(i!=0){cn="";}a+="<a href='#ytd' "+cn+" style='width:100%' onclick="+arr1[1]+">"+arr1[0]+"</a>";}}else if(input_type=="text"){_gId("search_box_div__"+obj_name,win).innerHTML="";_gId("search_box_div__"+obj_name,win).innerHTML=str;}var box=_gId("search_box_div__"+obj_name,win);box.style.left=get_left(textObj);box.style.top=textObj.offsetHeight+get_top(textObj);box.style.width=textObj.parentElement.offsetWidth;box.innerHTML="";box.insertAdjacentHTML("afterBegin",a);}function set_selectValue_onText(obj_A,obj_name,win){var pai=_gId("work_tr_exe"+obj_name+"_pai",win);if(pai){pai.removeNode(true)}var obj=_gName(obj_name,win)[0];if(obj)obj.value=obj_A;_gId("search_box_div__"+obj_name,win).style.display="none";}function send_search_req(obj_name,url,input_type,win){if(win.event.keyCode==38||win.event.keyCode==40||win.event.keyCode==13)return;obj=_gName(obj_name,win)[0];if(url.indexOf("?")>-1){url=url+"&word="+escape(obj.value);	}else{url=url+"?word="+escape(obj.value);	}if(win.event.altKey==true){window.open(url);	}if (url.indexOf('{tr_record_id}')>-1){var id=giv('tr_record_id',win);url=url.replace(/\{tr_record_id\}/,id);}var s=ajax(url);if(input_type=="text"){if(s+""==""){if(!_gId("work_tr_exe"+obj_name+"_pai"))return;_gId("work_tr_exe"+obj_name+"_pai").style.display="none";return;}var t=lang4("_similar_values");zhiShiPai_show(win,obj,t,s,"work_tr_exe"+obj.id+"_pai",'lt-lb',222,50,-8,-1);}else{show_search_box(s,obj_name,input_type,win);}};function get_select_tb_str(textObj,win){var col=(textObj.name.indexOf('$')>-1)?(textObj.name.split('$')[1]):(textObj.name);var box_id=col+"_select_tb_box";var str='';var codeObj=gid(box_id,win);if(codeObj) {if(codeObj.value!="")str=codeObj.value;	}else{var url="../"+asp_php+"/execute."+asp_php+"?exe=show_bind_sel_box&fileName="+request("fileName",win);url+="&col="+textObj.name.split('$')[1];if(win.event.altKey==true){window.open(url);return;}var s=ajax(url);s=s.replace(/\|\/td\|/g,",");str=s;s="<textarea id='"+box_id+"' style='display:none;'>"+s+"</textarea>";insertHtml("AfterBegin",win.document.body,s);}return str;}function sou_by_code(textObj,sel_str,win){if(textObj.value.replace(/ /g,"")=="")return;if(sel_str.indexOf("select_tb")>-1){sel_str=get_select_tb_str(textObj,win)
if(sel_str==""){return;}}if(win.event.keyCode==38||win.event.keyCode==40||win.event.keyCode==13)return;var box=_gId("search_box_div__"+textObj.name,win);if(!box){show_search_box(sel_str,textObj.name,"select",win);	}else{box.style.display="block";box.style.left=get_left(textObj);box.style.top=textObj.offsetHeight+get_top(textObj);box.style.width=textObj.parentElement.offsetWidth;}var v=textObj.value.replace(/\\/g,"");box=_gId("search_box_div__"+textObj.name,win);var a=box.getElementsByTagName("A");var sel_a=null;for(var i=0;i<a.length;i++){var span=a[i].getElementsByTagName("SPAN");span[0].innerText+="";span[1].innerText+="";if(a[i].innerText.indexOf(v)>-1){a[i].style.display='block';var span_1=a[i].all[0];var span_1_t=span_1.innerText;var span_2=a[i].all[1];var span_2_t=span_2.innerText;if(v!=""){eval("span_1.innerHTML=span_1_t.replace(/"+v+"/g,'<font color=red>"+v+"</font>')")
eval("span_2.innerHTML=span_2_t.replace(/"+v+"/g,'<font color=red>"+v+"</font>')")}if(sel_a==null){a[i].className="cur_select";sel_a=a[i];}else{a[i].className="";	}}else{a[i].style.display="none";a[i].className="";}}if(sel_a==null){box.style.display="none";	}}function search_box_upDown(obj,win){if(win.event.keyCode!=38&&win.event.keyCode!=40&&win.event.keyCode!=13)return;var d=_gId("search_box_div__"+obj.name,win);if(!d)return;if(d.style.display=="none")return;var arr=d.getElementsByTagName("A");var cur_node,next_node,show_a=new Array();for(var i=0;i<arr.length;i++){if(arr[i].className=="cur_select"){cur_node=arr[i];break;}}if(!cur_node){cur_node=arr[0];cur_node.className="cur_select";}if(win.event.keyCode==13) {cur_node.click();}if(win.event.keyCode==40) {if(!cur_node.nextSibling)return;next_node=cur_node.nextSibling
while(next_node.style.display=="none"){next_node=next_node.nextSibling;if(!next_node)return;}}else if(win.event.keyCode==38) {if(!cur_node.previousSibling)return;next_node=cur_node.previousSibling
while(next_node.style.display=="none"){next_node=next_node.previousSibling;if(!next_node)return;}}if(cur_node){cur_node.className="";}if(next_node){next_node.className="cur_select";}}function hid_search_box(obj,win){if(!obj.name)return;var d=tf.gid("search_box_div__"+obj.name,win);if(!d || !d.hid)return;if(d.hid=="yes"){d.style.display="none";}}function sou_box_A_to_input(t_value,obj_name,win){var obj=_gName(obj_name,win)[0];if(obj)obj.value=unescape(t_value);_gId("search_box_div__"+obj_name,win).style.display="none";}function get_link_mk_url(s,input_name){s=unescape(s);s=s.replace(/\"/g,"");s=s.replace(/\(/,")");s=s.split(')')[1];var arr_c=s.split(",");var curMk=arr_c[0];var curCol=arr_c[1];var bindCol=arr_c[2];var bindMk=arr_c[3];var firstCol=bindCol.split(".")[0];var url='../'+asp_php+'/execute.'+asp_php+"?exe=search_link_mk&fileName="+bindMk+"&col="+firstCol+"&curCol="+curCol+"&curMk="+curMk+"&bindCols="+bindCol+"&input_name="+input_name;return url;	}function show_bind_sel_box(obj,text_id,win){if(obj.tagName=='BUTTON'){obj=gid(text_id,win);}var box=gid("search_box_div__"+text_id,win);if(box){if(obj.name==text_id){box.style.display="";gid(text_id,win).focus();return}}else{}var url="../"+asp_php+"/execute."+asp_php+"?exe=show_bind_sel_box&fileName="+request("fileName",win)+"&col="+text_id;if(win.event.altKey==true){window.open(url)
return;}var s=ajax(url);if(s=="")return;var arr;arr=s.split("|/td|");var sel_str="<select style='width:100%' id='"+obj.id+"' name='"+obj.name+"' ";if(obj.check_value_str){sel_str+=" "+unescape(obj.check_value_str);}sel_str+=">";for(var i=0;i<arr.length-1;i++){var v=arr[i],t=arr[i];if(arr[i].indexOf('<vt>')>-1){var arr1=arr[i].split('<vt>');v=arr1[0];t=arr1[1];}var selected=(obj.value+''==v+'')?(' selected '):(' ');sel_str+="<option value='"+v+"'"+selected+">"+t+"</option>";}sel_str+="</select>";var tr=obj.parentElement.parentElement;tr.cells[1].style.display='none';tr.cells[0].innerHTML=sel_str;}function check_sel_value(obj,win){if(obj.value.replace(/ /g,"")==""){var pai=_gId("work_tr_exe"+obj.name+"_pai",win);if(pai){pai.removeNode(true)}return;}var box=_gId("search_box_div__"+obj.name,win);if(box&&box.innerHTML!=""){var chk_va=obj.value.replace(/ /g,"");var arr=box.getElementsByTagName("A"),sp;var is_ok=false;for(var i=0;i<arr.length;i++){sp=arr[i].getElementsByTagName("SPAN")[0];var sp_va=sp.innerText.replace(/ /g,"");if(sp_va==chk_va){is_ok=true;	}}if(!is_ok){var t=""+lang4("_system_ts")+"";var s=""+lang4("_correct_value")+"";zhiShiPai_show(win,obj,t,s,"work_tr_exe"+obj.name+"_pai",'lt-lb',222,50,-8,-1);	}}}