/*------------------------ 
功能：弹出窗 
-------------------------*/ 
function MyAlert_cn(str)	
{
	var myStr;
	myStr="系统提示：\n-----------------------------------------------------------------------";
	myStr+=str
	myStr+="\n-----------------------------------------------------------------------";
	alert(myStr);
}

function MyAlert_en(str)	
{
	var myStr;
	myStr="System Prompt：\n-----------------------------------------------------------------------";
	myStr+=str
	myStr+="\n-----------------------------------------------------------------------";
	alert(myStr);
}

function MyConfirm_cn(str)	
{
	var myStr;
	myStr="系统提示：\n-----------------------------------------------------------------------";
	myStr+=str
	myStr+="\n-----------------------------------------------------------------------";
	if(confirm(myStr))
	{
		return true;
	}
	else
	{
		return false;
	}
}

function MyConfirm_en(str)	
{
	var myStr;
	myStr="System Prompt：\n-----------------------------------------------------------------------";
	myStr+=str
	myStr+="\n-----------------------------------------------------------------------";
	if(confirm(myStr))
	{
		return true;
	}
	else
	{
		return false;
	}
}

	
/*------------------------ 
功能：替换任何空白字符 
-------------------------*/ 
function TrimString (strVal) 
{ 
strTmp = strVal + ""; 
if (strTmp.length == 0) 
return (strTmp); 
reVal = /^\s*/; 
strTmp = strTmp.replace (reVal, ''); 
reVal = /\s*$/; 
return (strTmp.replace (reVal, '')); 
} 

/*------------------------ 
功能：检测是否是有效数字 
-------------------------*/ 
function Check_Num( num ) 
{ 
num = ( TrimString( num ) ); 
if (num.length == 0) 
return (false); 
return ( Number( num ) ); 
} 

/*------------------------ 
功能：检测是否是有效日期 
-------------------------*/ 
function Check_Date (strDate) 
{ 
strDate = (TrimString (strDate)); 
if (strDate.length == 0) 
return (false); 
reVal = /^([1-2]\d{3})[\/|\-](0?[1-9]|10|11|12)[\/|\-]([1-2]?[0-9]|0[1-9]|30|31)$/; 
return (reVal.test (strDate)); 
} 

/*------------------------ 
功能：检测是否是有效Email 
-------------------------*/ 
function Check_Email (strEmail) 
{ 
strEmail = (TrimString (strEmail)); 
if (strEmail.length == 0) 
return (false); 
reVal =/^[\-!#\$%&'\*\+\\\.\/0-9=\?A-Z\^_`a-z{|}~]+@[\-!#\$%&'\*\+\\\.\/0-9=\?A-Z\^_`a-z{|}~]+(\.[\-!#\$%&'\*\+\\\.\/0-9=\?A-Z\^_`a-z{|}~]+)+$/;
return (reVal.test (strEmail)); 
} 

/*------------------------ 
功能：检测是否是有效时间 
-------------------------*/ 
function Check_Time (strTime) 
{ 
strTime = (TrimString (strTime)); 
if (strTime.length == 0) 
return (false); 

reVal = /^(([0-9]|[01][0-9]|2[0-3])(:([0-9]|[0-5][0-9])){0,2}|(0?[0-9]|1[0-1])(:([0-9]|[0-5][0-9])){0,2}\s?[aApP][mM])?$/; 
return (reVal.test (strTime)); 
} 

/*------------------------ 
功能：检测是否是有效日期特定格式 
-------------------------*/ 
function Check_Date_1 (strDate) 
{ 
strDate = (TrimString (strDate)); 
if (strDate.length == 0) 
return (false); 
reVal = /^([1-2]\d{3})[\/](0?[1-9]|10|11|12)[\/]([1-2]?[0-9]|0[1-9]|30|31)$/; 
return (reVal.test (strDate)); 
} 

/*------------------------ 
功能：检测是否是有效日期特定格式 
-------------------------*/ 
function Check_Date_2 (strDate) 
{ 
strDate = (TrimString (strDate)); 
if (strDate.length == 0) 
return (false); 
reVal = /^([1-2]\d{3})[\-](0[1-9]|10|11|12)[\-]([1-2][0-9]|0[1-9]|30|31)$/; 
return (reVal.test (strDate)); 
} 

/*-------------------------------------- 
功能：换行定行 
---------------------------------------*/ 
function enter( form, temp ) 
{ 
if ( window.event.keyCode == 13 ) 
{ 
eval( form + temp + ".focus()" ); 
eval( form + temp + ".select()" ); 
} 
else 
return (false); 
} 

/*-------------------------------------- 
功能：检查字符串长度 
---------------------------------------*/ 
function ByteString (strVal) 
{ 
nLen = 0; 

for (i = 0; i < strVal.length; i ++) 
{ 
if (strVal.charCodeAt (i) > 255) 
nLen += 2; 
else 
nLen ++; 
}; 
return (nLen); 
} 

/*-------------------------------------- 
功能：按要求截取字符串长度 
---------------------------------------*/ 
function SubString(strVal,nStrLen) 
{ 
nLen = 0; 
nTemp = 0; 
for (i = 0; i < strVal.length; i ++) 
{ 
if (strVal.charCodeAt (i) > 255) 
nLen += 2; 
else 
nLen ++; 
if(nLen <= nStrLen) 
nTemp = i; 
else 
break; 
}; 
return(strVal.substr(0,nTemp+1)); 
} 

/*------------------------ 
功能：检测密码，密码只能由英文字母、数字、减号、下划线、$、#、*、(和)构成，且首位必须是英文字母 
-------------------------*/ 
function Check_Pass( strPass ) 
{ 
strPass = ( TrimString( strPass ) ); 
if (strPass.length == 0) 
return (false); 
reVal = /^[a-zA-Z]{1}[a-zA-Z0-9-_$#*()]{0,29}$/; 
return ( reVal.test (strPass) ); 
} 

/*----------------------------
功能：限制长度
----------------------------*/
function  CheckLength(source,arguments)    
{
    if(arguments.Value.length<6)
    {
        arguments.IsValid=false;
    }
    else
    {
        arguments.IsValid=true;
    }
}     
/*----------------------------
功能：打开新窗口
----------------------------*/
	function new_win(url,width,height,wName,sb,status)
	{   
		var param = "";
		var swidth;
		var sheight;
		if(status)
		{
			param = status;
		}
		else
		{
			if(sb)
			{		
				param = "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no";		
			}
			else
			{
				param = "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no";		
			}
		}
		if(width)
		{
			swidth=(screen.width-width)/2;
			param = param + ",width=" + width+",left="+swidth;
		}
		else
		{
			param = param + ",height=540";
		}
		if(height)
		{
			sheight=(screen.height-height)/2;
			param = param + ",height=" + height+",top="+sheight;
		}
		else
		{
			param = param + ",height=518";
		}
		newwin=window.open(url,wName,param);
	}
