var r1, r2, r3;
		r1 = new RegExp('[^A-Za-z0-9_]','');
		r2 = new RegExp('[^A-Za-z0-9]','');
		r3 = new RegExp('[^0-9]','');
		
//用户名由<SPAN class=style1>a-z的英文字母(不分大小写)0-9的数字或下划线</SPAN>组成，并以英文字母开头
function verifyUsername(strUsername){
	//var patrn=/(^[A-Za-z]{1,}[A-Za-z0-9_]{0,}$)/; 
	var patrn=/(^[A-Za-z0-9]{1,}$)/; 
			if (!patrn.exec(strUsername)) return false 
			return true
}


//校验普通电话、传真号码：可以“+”开头，除数字外，可含有“-” 
			function isTel(s) 
			{ 
			/*
			(1)电话号码由数字、"("、")"和"-"构成
　　		(2)电话号码为3到8位
　　		(3)如果电话号码中包含有区号，那么区号为三位或四位
　　		(4)区号用"("、")"或"-"和其他部分隔开
			*/
			//var patrn=/(^[0-9]{3,4}\-[0-9]{5,8}$)|(^[0-9]{5,8}$)|(^\([0-9]{3,4}\)[0-9]{5,8}$)|(^[0-9]{3,4}\-[0-9]{5,8}\/[0-9]{3,6}$)|(^[0-9]{5,8}\/[0-9]{3,6}$)|(^\([0-9]{3,4}\)[0-9]{5,8}\/[0-9]{3,8}$)/; 

			var patrn=/(^[0-9]{3,4}\-[0-9]{5,8}$)|(^[0-9]{5,8}$)|(^\([0-9]{3,4}\)[0-9]{5,8}$)|(^[0-9]{3,4}\-[0-9]{5,8}\/[0-9]{1,8}$)/; 
			if (!patrn.exec(s)) return false 
			return true 
			} 
			
				function fMobile(s) 
			{ 
			/*
				固定电话
			*/
			var patrn=/(^[0-9]{6,20}$)/; 
			if (!patrn.exec(s)) return false 
			return true 
			} 
			//校验普通电话、传真号码：可以“+”开头，除数字外，可含有“-” 
			function isMobile(s) 
			{ 
			/*
　　		(5)移动电话号码为11或12位，如果为12位,那么第一位为0
　　		(6)11位移动电话号码的第一位和第二位为"13"
　　		(7)12位移动电话号码的第二位和第三位为"13"
			*/
			var patrn=/(^0{0,0}1[358]{1,1}[0-9]{9}$)/; 
			if (!patrn.exec(s)) return false 
			return true 
			} 
			
			function isPhoneD(s) 
			{ 
			/*
				区号
			*/
			var patrn=/(^[0-9]{3,4}$)/; 
			if (!patrn.exec(s)) return false 
			return true 
			} 
			
			function isPhoneG(s) 
			{ 
			/*
				固定电话
			*/
			var patrn=/(^[0-9]{6,8}$)/; 
			if (!patrn.exec(s)) return false 
			return true 
			} 
			
			function isPhoneSub(s) 
			{ 
			/*
				分机号码
			*/
			var patrn=/(^[0-9]{3,6}$)/; 
			if (!patrn.exec(s)) return false 
			return true 
			} 
			
			function isPostCode(s) 
			{ 
			/*
				邮政编码
			*/
			var patrn=/(^[0-9]{6,6}$)/; 
			if (!patrn.exec(s)) return false 
			return true 
			} 
			
			function isData(s) 
			{ 
			/*
				是否数字
			*/
			var patrn=/(^[0-9]*[1-9][0-9]*$)/; 
			if (!patrn.exec(s)) return false 
			return true 
			} 
			function NormalPD(str)
			{
			var patrn=/(^[A-Z]{2,2}[0-9]{1,12}$)/; 
				//var rexIP = new RegExp(@"^([A-Z]{2,2}\.[0-9]{1,12})$");
			if ( str.length < 2 )
				return "长度不能少于2";
			else if ( !patrn.exec(str) )
				return "请输入正确的常旅客卡号，例如：CA23423412342";
			return 0;
			
			
			
			}











function isIdCardNoLen(num) {

        var len = num.length;
        if (len != 15 && len != 18)
        {
			//alert("请输入15位或18位的身份证!\n"); 
			return false;
        }
        else
			return true;
}
function isIdCardNoNum(num) {

        var len = num.length;
        if ( isNaN(num.substring(0,14)) || isNaN(num.substring(0,17)) )
        { 
			//alert("身份证的前14或17位请输入数字!\n"); 
			return false;
        } 
        else
			return true;      
}

function isIdCardNoNum15(num) {

        var len = num.length;
        if ( isNaN(num) && len == 15 )
        { 
			//alert("身份证的前14或17位请输入数字!\n"); 
			return false;
        } 
        else
			return true;      
}

function isIdCardNoNum18(num) {

        var len = num.length;
        if ( ( len == 18 && isNaN(num.substring(0,17)) ) || (len == 18 && isNaN(num.substring(17,18)) && num.substring(17,18) != "X" ) )
        { 
			//alert("身份证的前14或17位请输入数字!\n"); 
			return false;
        } 
        else
			return true;      
}










/*	中文限制	*/
function isChinese(str){
  str = str.replace(" ", "");
  for (i=0;i<str.length;i++)
  { 
     if (str.charCodeAt(i)< 255)
     {
       return false;
     }
   }
   return true;
}
/*	中文限制	*/
function isCode(str){
  str = str.replace(" ", "");
  for (i=0;i<str.length;i++)
  { 
     if (str.charCodeAt(i) >= 255)
     {
       return false;
       break;
     }
   }
   return true;
}

function ValidValue(pstr,str)
{
	var patrn=new RegExp(pstr);
	return patrn.test(str);
}

//检查中英文姓名
//检查中英文姓名
function CheckName(v) {
//中文：至少2个字，不能包含数字、字母、符号
//英文：名和姓中间用/分割，不能包含数字和其他字符
//中文人名验证规则
var ChineseNamePattern=/^[\u4e00-\u9fa5]{2,20}$/;
//检验字符串是否是中文
var ChinesePattern=/^[\u4e00-\u9fa5]+$/;
//中文生僻字,例如:王she
var rareChineseName1=/^[\u4e00-\u9fa5]+[A-z]{2,}$/;
//中文生僻字,例如:she王
var rareChineseName2=/^[A-z]{2,}[\u4e00-\u9fa5]+$/;
//中文生僻字,例如:shewang
var rareChineseName3=/^[A-z]{3,}$/;
//英文名
var EnglishName=/^[a-z,A-Z ]{2,}\/[a-z,A-Z ]{2,}$/;

if(ValidValue(ChinesePattern,v))
	{
		if(!ValidValue(ChineseNamePattern,v))
		{
			return false;
		}		
	}
	else if(ValidValue(rareChineseName1,v))
	{
		return true;
	}
	else if(ValidValue(rareChineseName2,v))
	{
		return true;
	}
	else if(ValidValue(rareChineseName3,v))
	{
		return false;
	}
	else if(ValidValue(EnglishName,v))
	{
		return true;
	}
	else
	{
		return false;
	}

	return true;
}


//function isChi


<!-- Begin
/*

计算距离某天的时间:年月日
婴儿和儿童检验

*/
function HowLongSince(type,starttime) {
	var ydiff1,mdiff1,dayst
	var atime = starttime.split("-");
	
	sdate=atime[2];
	smonth=atime[1]-1;
	syear=atime[0];
	var DaysInMonth = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
	today = new Date()
	var thisyear = today.getFullYear();
	var thismonth = today.getMonth();
	var thisdate = today.getDate();
	mstart = new Date(syear,(smonth==12?1:smonth+1),1);
	days1 = (mstart - new Date(syear,smonth,sdate))/(24*60*60*1000)-1;
	mend = new Date(thisyear,thismonth,1);
	days2 = (new Date(thisyear,thismonth,thisdate) - mend)/(24*60*60*1000)+1;
	dayst = days1 + days2;
	if (dayst >= DaysInMonth[smonth])  {
	AddOneMonth = 1; 
	dayst -= DaysInMonth[smonth]; 
	}
	else AddOneMonth = 0;
	ydiff1 = thisyear-mstart.getFullYear();
	mdiff1 = thismonth-mstart.getMonth()+AddOneMonth;
	if (mdiff1 >11) { mdiff1=0; ydiff1++; }
	if (mdiff1 < 0) { mdiff1 = mdiff1 + 12; ydiff1--; }
	temp = (ydiff1==0?"":(ydiff1==1?ydiff1+" 年， ":ydiff1 + " 年，"));
	temp += (mdiff1==0?"0 months, ":(mdiff1==1?mdiff1+" month, ":mdiff1+" 个月，"));
	temp += (dayst==0?"no days":(dayst==1 ? " 1 day." : dayst + " 天" ));
	//婴儿 两年以下
	if ( type == "baby" ) {
		if ( ydiff1 == 2 &&  mdiff1 == 0 && dayst == 0)
			return true;
		if ( ydiff1 < 2 && ydiff1 >=0)
			return true;
	
	}
	//小孩
	if ( type == "child" ) {
		if ( ydiff1 == 2 &&  ( mdiff1 > 0 || dayst > 0 )  )
			return true;
		if ( ydiff1 == 12 &&  mdiff1 == 0 && dayst == 0 )
			return true;
		if ( ydiff1 < 12 && ydiff1 > 2  )
			return true;
	}
	
	return false;
	
	
	
	//return temp;
}
//  End -->

function HowLongTime(type,starttime,thisyear,thismonth,thisdate) {
	var ydiff1,mdiff1,dayst
	var atime = starttime.split("-");
	sdate=atime[2];
	smonth=atime[1]-1;
	syear=atime[0];
	var DaysInMonth = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
	
	
	mstart = new Date(syear,(smonth==12?1:smonth+1),1);
	days1 = (mstart - new Date(syear,smonth,sdate))/(24*60*60*1000)-1;
	mend = new Date(thisyear,thismonth,1);
	days2 = (new Date(thisyear,thismonth,thisdate) - mend)/(24*60*60*1000)+1;
	dayst = days1 + days2;
	if (dayst >= DaysInMonth[smonth])  {
	AddOneMonth = 1; 
	dayst -= DaysInMonth[smonth]; 
	}
	else AddOneMonth = 0;
	ydiff1 = thisyear-mstart.getFullYear();
	mdiff1 = thismonth-mstart.getMonth()+AddOneMonth;
	if (mdiff1 >11) { mdiff1=0; ydiff1++; }
	if (mdiff1 < 0) { mdiff1 = mdiff1 + 12; ydiff1--; }
	temp = (ydiff1==0?"":(ydiff1==1?ydiff1+" 年， ":ydiff1 + " 年，"));
	temp += (mdiff1==0?"0 months, ":(mdiff1==1?mdiff1+" month, ":mdiff1+" 个月，"));
	temp += (dayst==0?"no days":(dayst==1 ? " 1 day." : dayst + " 天" ));
	//婴儿 两年以下
	if ( type == "baby" ) {
		if ( ydiff1 == 2 &&  mdiff1 == 0 && dayst >= 0)
			return true;
		if ( ydiff1 < 2 && ydiff1 >=0)
			return true;
	
	}
	//小孩
	if ( type == "child" ) {
		if ( ydiff1 == 2 &&  ( mdiff1 > 0 || dayst > 0 )  )
			return true;
		if ( ydiff1 == 12 &&  mdiff1 == 0 && dayst >= 0 )
			return true;
		if ( ydiff1 < 12 && ydiff1 > 2  )
			return true;
	}
	
	return false;
	
	
	
	//return temp;
}

  function selectTime(txtId) 
    { 
		var timestring = showModalDialog("../Component/selecttime.htm", "", "dialogLeft:"+(event.screenX-80)+";dialogTop:"+(event.screenY-80)+";dialogWidth:165px; dialogHeight:165px; edge:raised;help:off;status:off;scroll:off");
		if(timestring!="")
		{
			document.all(txtId).value = timestring;  
		}   
    }
    
    //弹出新窗户居中
    
   function goURL(szURL,w, h) { 

	var width,height;
	if(w==null)
	width="600";
	else
	width=w;
	
	if(h==null)
	height="400";
	else
	height=h;
	
	
	xposition=0; yposition=0;
	if ((parseInt(navigator.appVersion) >= 4 ))
	{
	xposition = (screen.width - width) / 2;
	yposition = (screen.height - height) / 2;
	}
	theproperty= "width=" + width + "," 
	+ "height=" + height + "," 
	+ "location=0," 
	+ "menubar=0,"
	+ "resizable=1,"
	+ "scrollbars=0,"
	+ "status=0," 
	+ "titlebar=0,"
	+ "toolbar=0,"
	+ "hotkeys=0,"
	+ "screenx=" + xposition + "," //仅适用于Netscape
	+ "screeny=" + yposition + "," //仅适用于Netscape
	+ "left=" + xposition + "," //IE
	+ "top=" + yposition; //IE 
	window.open(szURL,"new",theproperty);
	var date = new Date();	
} 

function DivSetVisible(state)
			{
				try
				{
					var DivRef = document.getElementById('divNewPassenger');
					var IfrRef = document.getElementById('DivShim');
					if(state)
					{
						DivRef.style.display = "block";
						IfrRef.style.width = DivRef.offsetWidth;
						IfrRef.style.height = DivRef.offsetHeight;
						IfrRef.style.top = DivRef.style.top;
						IfrRef.style.left = DivRef.style.left;
						IfrRef.style.zIndex = DivRef.style.zIndex - 1;
						IfrRef.style.display = "block";
					}
					else
					{
						DivRef.style.display = "none";
						IfrRef.style.display = "none";
					   
					}
				}
				catch(e)
				{
					alert("执行脚本DivSetVisible发生错误，请与客服人员联系。");
				}	
			}
			
			function DivSetVisible1(state)
			{
				try
				{
					var DivRef = document.getElementById('divNewPassenger1');
					var IfrRef = document.getElementById('DivShim1');
					if(state)
					{
						DivRef.style.display = "block";
						IfrRef.style.width = DivRef.offsetWidth;
						IfrRef.style.height = DivRef.offsetHeight;
						IfrRef.style.top = DivRef.style.top;
						IfrRef.style.left = DivRef.style.left;
						IfrRef.style.zIndex = DivRef.style.zIndex - 1;
						IfrRef.style.display = "block";
					}
					else
					{
						DivRef.style.display = "none";
						IfrRef.style.display = "none";
					   
					}
				}
				catch(e)
				{
					alert("执行脚本DivSetVisible发生错误，请与客服人员联系。");
				}	
			}


