﻿//====================================================================公共js函数
//日期格式验证
function   IsDate(dateStr)   
  {   
    var str=dateStr;
    if(str.length!=0){    
        var reg = /^(\d{1,4})(-|\-)(\d{1,2})\2(\d{1,2})$/;     
        var r = str.match(reg);     
        if(r==null)    
            return false;
        }  
  }


function checkemail()
{
	if($F("alluser")=="0" || $F("alluser")=="")
	{
		alert("请选择要发送的对方帐号,按Ctrl可多选!");
		return false;
	}
	if($F("alluser").indexOf("0")!="-1")
	{
		alert("请选择要发送的对方帐号,按Ctrl可多选!");
		return false;		
	}
}

//中文译英文
function cntoen(getstr)
{
var ocn=new ActiveXObject("Microsoft.XMLHTTP"); 
var myurl;
var y;
myurl="/iframe/cntoen.asp?id="+getstr;
ocn.open("POST",myurl,false); 
ocn.send();
y=bin2str(ocn.responseBody);
return y
}


//功能:过滤非法字符
var listmsg;
//检测提示内容
listmsg="因为不能包含object,<,>,script这些非法字符";
function trim(cstr)
{
//--------转换特殊字符
cstr=cstr.replace("object","");
cstr=cstr.replace("script","");
cstr=cstr.replace("select","");
cstr=cstr.replace("delete","");
cstr=cstr.replace("form","");
cstr=cstr.replace("=","");
cstr=cstr.replace("'","");
//--------置换空格
cstr=cstr.replace(/^ +/,"");
cstr=cstr.replace(/ +$/,"");

return cstr
}

//功能:检测非法字符
function checks(t)
{
szMsg="[#_%&'\",;:=!^]";
for(i=1;i<szMsg.length+1;i++)
{
if(t.indexOf(szMsg.substring(i-1,i))>-1)
{
Str="请勿包含非法字符如[#_%&'\",;:=!^]";
alert(Str);
}
}
}

//弹出对话框函数
function dels()
{
a=confirm("提示!你确定要本次执行吗");
if(a==true)
{
return true;
}
else
{
return false;
}
}

//在线翻译弹出窗口
function fy()
{
var getenwidth=window.screen.width/4;
window.showModalDialog("zxfy.asp","在线翻译","center:no;dialogLeft:"+getenwidth+"px;dialogTop:5px;scroll:0;status:0;help:0;resizable:0;dialogWidth:500px;dialogHeight:512px");
}

function myshow(geturl,geturl2,getwidth2,getheight2,getid,scroid,getaction)
{
var getwidth=(window.screen.width-getwidth2)/2;
var lscroid;
var laction=getaction;
if(scroid=="0")
{
	lscroid="0";
}
else
{
	lscroid="10px";
}
window.showModalDialog(geturl+".asp"+"?a="+geturl2+"&action="+laction+"&id="+getid+"&w="+getwidth2+"&h="+getheight2,"交友","center:no;dialogLeft:"+getwidth+"px;dialogTop:5px;scroll:"+lscroid+";status:0;help:0;resizable:0;dialogWidth:"+getwidth2+"px;dialogHeight:"+getheight2+"px;")
}