function box_jiSuan(obj_str,jiSuan_str,default_value)
{
var obj=tf.gid(obj_str,window);
var news='',word='';
var is_word=0;
for(var i=0;i<jiSuan_str.length;i++)
{
var a=jiSuan_str.substr(i,1);
if(a=="$")
{
news+="giv('$";
is_word=1;
}
else if("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_".indexOf(a)>-1)
{
word+=a;
}
else
{ 
if(is_word==1)
{
news+=word+"')"+a;
word='';
is_word=0;
}
else{
news+=word+a;
word='';
}
}
if(i==jiSuan_str.length-1)
{
if(word.length>0)
{
news+=word+"')";
}
}
}
var v='';
try
{
eval("v="+news);
if(v.length<1)return;
}catch(e)
{
if (default_value.length>0)
{
v=default_value;
}else
{return;}
}
if(obj)obj.value=v;
}
function shaixuan_objSelect(obj_id,tbName,colName,where,cur_obj)
{
var obj=tf.gid(obj_id,window);
if(!obj)
{
alert('['+obj_id+']对象不存在');
return;	
}
if(obj.tagName=='INPUT')
{
obj.click();
var obj=tf.gid(obj_id,window);
}
var url="../"+asp_php+"/execute."+asp_php+"?exe=shaixuan_objSelect&tbName="+tbName+"&colName="+colName+"&where="+encodeURIComponent(where)+"&cur_obj="+cur_obj;
var s=ajax(url);
if(obj.options.length>0)
{
var arr=obj.outerHTML.split("<OPTION")
}else
{
var arr=obj.outerHTML.split("</SELECT")
}
var s=arr[0]+s+"</select>";
obj.parentElement.innerHTML=s;
}
function myc(obj,s1,s2,ok_exe)
{
if(obj.value.length<1)
{
return true;
}
else
{
s1=eval(s1)
if(obj.value.search(s1)< 0)
{
tf.zhiShiPai_show(window,obj,"系统提示",s2,"work_tr_exe"+obj.id+"_pai",'lt-lb',222,50,0,0);
var cla=obj.className.replace(/input_err /g,"");
obj.className="input_err "+cla;
return false;
}
else
{
var cla=obj.className.replace(/input_err /g,"");
obj.className=cla;
var pai=tf.gid("work_tr_exe"+obj.id+"_pai",window)
if(pai)pai.removeNode(true);
if(ok_exe)
{
try
{
ok_exe=ok_exe.replace(/`/g,"'");
ok_exe=ok_exe.replace(/{cur_fileName}/g,tf.request("fileName"),window);
ok_exe=ok_exe.replace(/{cur_colName}/g,obj.id);
ok_exe=ok_exe.replace(/{obj.value}/g,obj.value);
eval(ok_exe);
}catch(t)
{
}
}
}
}
}
function sfz_to_value(s,tos,id_or_str)
{
if(s.length<1 || tos.length<1)return;
if(!id_or_str || id_or_str!=1)
{
s=tf.giv(s.window);
}
if(s.length!=18){alert('身份证必须为18位');return}
var arr=(tos+",").split(',');
for(var i=0;i<arr.length;i++)
{
if(arr[i]!="")
{
if(arr[i].indexOf("=")>-1)
{
var arr1=arr[i].split("=");
var obj=tf.gid(arr1[0],window);
var v=arr1[1];
var box=tf.gid(arr1[0],window);
var typ=arr1[0];
var diqu=left(s,6);
var sheng="";
var xian="";
var yyyy=s.substr(6,4);
var cur_yyyy=new Date().getYear();
var age=cur_yyyy-yyyy;
var mm=s.substr(10,2);
var dd=s.substr(12,2);
var sex=s.substring(17,18);
sex=sex+'';
if(sex=="x" || sex=="X" || sex=="0" || sex=="2" || sex=="4" || sex=="6" || sex=="8")
{
sex='女';
}
else
{
sex="男";	
}
v=v.replace("age",age);
v=v.replace("sex",sex);
v=v.replace("yyyy",yyyy);
v=v.replace("mm",mm);
v=v.replace("dd",dd);
v=v.replace("sheng",sheng);
v=v.replace("xian",xian);
if(obj)obj.value=v;
}
}
}
}
function getform(input){
var text=document.getElementById(input);
var arr=document.getElementsByName(input);
for(var i=0;i<arr.length;i++){
document.getElementById(input).value+=arr[i].value+",";
}
text.value=text.value.substring(0,text.value.length-1);
}
function get_box_value()
{
var s;
if (document.location.href.indexOf('main_work.htm')>-1)
{
return(cur_td.innerHTML);
}
else
{
var obj=event.srcElement;
var tb=tf._gPar("obj.id=='tb'",obj)
var text_td=tb.rows[0].cells[2];
var box=text_td.getElementsByTagName("INPUT")[0];
if (box)
{
s=box.value;
}
else
{
s=text_td.innerText;
}
}
return s
}
function myc2(obj,s1,s2)
{
s1=s1.replace(/＼/g,"\\")
s1=s1.replace(/／/g,"/")
myc(obj,s1,s2)
}
function number_from_to(obj,s1,s2)
{
if (obj.value.length<1)
{
obj.className='input_ok';	
}
else
{
if(myc(obj,/^[\d]{1,99}$/,s2)==false)
{
obj.className='input_err';
return false;
}
else
{
var arr=s1.split('-')
if(  (arr[0]-0)<=(obj.value-0) && (obj.value-0)<=(arr[1]-0)  )
{
obj.className='input_ok';
}
else
{
obj.className='input_err';
return false;
}
}
}
}
function s_text_blur(obj)
{
var op=obj.parentElement;
if (op.all[0].value==op.all[1].value)
{
op.innerHTML=obj.value;
}
}
function send_dx() 
{
var mobile=get_box_value();
tf.open_dialog('dialog.htm?go=../'+asp_php+'/send_dx_write_msg.'+asp_php+'?mobile='+mobile+"&fileName="+tf.request("fileName",window),700,520,1);
}
function search_mobile() 
{
var mobile;
if (document.getElementById('editBox'))
{
mobile=document.getElementById('editBox').value;
}
else
{
var obj=event.srcElement;
var oTD=obj.parentElement.parentElement;
var oTR=oTD.parentElement;
var text_td=oTR.cells[oTD.cellIndex-1];
if (text_td.all[0])
{
mobile=text_td.all[0].value;
}
else
{
mobile=text_td.innerText;
}
}
if (mobile.length<7)
{
alert('手机号码不能小于7位');
return;
}
var str="<FORM METHOD=POST ACTION='http://www.ip138.com:8080/search.asp' name='mobile_form' target='search_mobile_frame'>";
str+="<input type=hidden name=mobile value="+mobile+">";
str+="<INPUT TYPE=hidden name=action value=mobile> ";
str+="</FORM>";
if(document.all.mobile_form)
{
document.all.mobile_form.removeNode(true);
}
document.body.insertAdjacentHTML("beforeEnd",str);
window.open('about:blank','search_mobile_frame','width=380,height=320,scrollbars=yes,resizable=yes');
mobile_form.submit();
}
function search_quhao() 
{
var zone=get_box_value();
if (zone.indexOf('-')<1)
{
alert('电话号码没有使用“-”作为分隔，所以不能查询。');
return;
}
var arr=new Array();
arr=zone.split("-");
zone=arr[0];
window.open('http://www.ip138.com/post/search.asp?action=zone2area&zone='+zone,'search_quhao_frame','width=380,height=320,scrollbars=yes,resizable=yes');
}
function get_wl_tel()
{
var url='../'+asp_php+'/tel_wl_check_sub.'+asp_php+'?exe=get_server_ip'
var str=ajax(url)
str=str.substring(str.indexOf("<textarea>")+10,str.indexOf("</textarea>"))
return str;
}
function call_tel() 
{
var tel=get_box_value();
var str=get_wl_tel();
if(tops.gbl("tel_type")=="wanyi")
{
var ip=str.split(",")[0]
var mytel=str.split(",")[1]
if (ip+""=="")
{
alert("呼叫中心服务器地址不能为空")
return;
}
if (mytel+""=="")
{
alert("座机号不能为空")
return;
}
var url=ip+"yscrm/jsp/webCall.jsp?agentNum="+mytel+"&tel="+tel
try
{
var f=gid("frame_blank")
if(!f)
{
f=tf.gid("frame_blank")
}
f.src=url
}catch(e)
{
alert("拨号出现异常,请检查座机号和服务器地址！")	
}
}
else
{
tf.open_dialog('tel_bo.htm?toNum='+tel,500,353,1)
}
}
function email() 
{
var hao=get_box_value();
window.open('mailto:'+hao,'','')
}
function qq() 
{
var hao=get_box_value();
if(hao.length>0)
{
window.open("tencent://message/?uin="+hao+"&Site=QQ交谈&Menu=yes")
}else
{
alert('没有找到qq号码')
}
}
function baidu_hi() 
{
var hao=get_box_value();
window.open('baidu://message/?id='+hao,'','')
}
function baidu_so() 
{
var hao=get_box_value();
window.open('http://www.baidu.com/s?wd='+hao,'','')
}
function msn() 
{
var hao=get_box_value();
window.open('msnim:chat?contact='+hao,'','')
}
function myt() 
{
var hao=get_box_value();
window.open('http://amos1.sh1.china.alibaba.com/msg.atc?v=1&uid='+hao,'','')
}
function wangwang() 
{
var hao=get_box_value();
window.open('http://amos1.taobao.com/msg.ww?v=2&s=2&uid='+hao,'','')
}
function play() 
{
var hao=get_box_value();
if(hao=="")
{
alert('没有录音文件。');
return;
}
tf.open_dialog('tel_play.htm?play_auto=yes&file='+hao,600,200,1);
}
function paiZhao(fileName,colName,id,url,win)
{
if(!win)win=window;
if(url=='')url='http://127.0.0.1:20157';
url+="?exe=paiZhao&fileName="+fileName+"&colName="+colName+"&id="+id;
var f=tf.gid('frame_blank',win);
if(f==null)
{
f=tf.gid('frame_asp',win);
}
if(f)
{
f.src=url;
}
else
{
open_dialog(url,400,260,1)	
}
}
function webhost()
{
var hao=get_box_value();
if(hao.indexOf(".")>-1)
{
if(hao.indexOf("http")<0)
{
hao="http://"+hao;
}
}
window.open(hao,'','')
}
function in_mx(id)
{
window.showModelessDialog('dialog.asp?title=物品明细&url=caigou_dan_minXi.asp?caiGouID='+id,'window','status:no;help:no;dialogWidth:620px;dialogHeight:490px')
}
function in_mx_self(id)
{
var obj=event.srcElement;
var oTD=obj.parentElement;
var oTB=oTD.parentElement.parentElement.parentElement;
oTB.style.width='100%';
oTD.innerHTML="<br><iframe src='' width='100%' id=in_mx_frame frameborder=0 scrolling=no></iframe>"
in_mx_frame.location='caigou_dan_minXi.asp?print=yes&caiGouID='+id
setTimeout("document.getElementById('in_mx_frame').style.height=in_mx_frame.document.body.scrollHeight",2000)
setTimeout("document.getElementById('in_mx_frame').style.height=in_mx_frame.document.body.scrollHeight",5000)
setTimeout("document.getElementById('in_mx_frame').style.height=in_mx_frame.document.body.scrollHeight",8000)
setTimeout("document.getElementById('in_mx_frame').style.height=in_mx_frame.document.body.scrollHeight",10000)
setTimeout("document.getElementById('in_mx_frame').style.height=in_mx_frame.document.body.scrollHeight",20000)
}
function out_mx(id)
{
window.showModelessDialog('dialog.asp?title=产品清单&url=wms_chuku_minXi.asp?id='+id,'window','status:no;help:no;dialogWidth:620px;dialogHeight:490px')
}
function out_mx_self(id)
{
var obj=event.srcElement;
var oTD=obj.parentElement;
var oTB=oTD.parentElement.parentElement.parentElement;
oTB.style.width='100%';
oTD.innerHTML="<br><iframe src='' width='100%' id=out_mx_frame frameborder=0 scrolling=no></iframe>"
out_mx_frame.location='wms_chuku_minXi.asp?print=yes&ID='+id
setTimeout("document.getElementById('out_mx_frame').style.height=out_mx_frame.document.body.scrollHeight",2000)
setTimeout("document.getElementById('out_mx_frame').style.height=out_mx_frame.document.body.scrollHeight",5000)
setTimeout("document.getElementById('out_mx_frame').style.height=out_mx_frame.document.body.scrollHeight",8000)
setTimeout("document.getElementById('out_mx_frame').style.height=out_mx_frame.document.body.scrollHeight",10000)
setTimeout("document.getElementById('out_mx_frame').style.height=out_mx_frame.document.body.scrollHeight",20000)
}
function open_set_tixin(obj,a,b)
{
tf.open_dialog("set_tixin.htm?objName="+obj.name,580,320,0)
}
function tiaoGuo_tiXing()
{
url=document.location.href;
if(url.indexOf('work_tr_exe.htm')>-1)
{
var id=tf.request("id",window)
}
url="../"+asp_php+"/execute."+asp_php+"?exe=tiaoGuo_tiXing&fileName="+tf.request("fileName",window)+"&id="+id
frame_blank.src=asp_php+"execute."+asp_php+"?execute=get_next_time"
}
function ytd_tiXing(obj)
{
var par=obj.parentElement;
var input=par.getElementsByTagName('INPUT')[0];
var n=input.name
tf.open_dialog('set_tixin.htm?objName='+n,500,300,0)
}