function check(){


//if(checkShCard(document.forms.register['register:shCard'].value);
open();
show("正在提交信息,请耐心等待...");
}


var $ = function (tagName) {
	return document.getElementById(tagName);
};
function showInfo(info, obj, msg) {
	imgs = "/html/images/reguser/";	
//alert(info==1);
	if (info == 1) {
		$(obj).innerHTML = "<img align='absmiddle' src='" + imgs + "" + "yesno.gif' /><font color='red'>" + msg + "</font>";
	}
	if (info == 0) {
		$(obj).innerHTML = "<img align='absmiddle' src='" + imgs + "" + "yesok.gif' />";
	}
}
function show(info){
	$("info").innerHTML="<br/><br/><br/><img align='absmiddle' src='/html/images/reguser/loading.gif' />"+info+"<br/>";
}

function showRegister(isSuccess) {
	//alert(isSuccess);
	if(isSuccess!="3")
	{
	var rs = isSuccess.split(",");
	var sum = (rs.length);
	for (i = 0; i < sum; i++) {
	//alert(rs[i]);
		switch (i) {
		  case 0:
			
			if (rs[0] == 2) {
				showInfo(1, "userReg", "\u6b64\u7528\u6237\u540d\u5df2\u7ecf\u88ab\u4f7f\u7528\u4e86\uff0c\u8bf7\u8f93\u5165\u5176\u5b83\u7684\u7528\u6237\u540d");
			} else {
				showInfo(rs[0], "userReg", "\u53ef\u4ee5\u5305\u62ec\u6570\u5b57\u3001\u5b57\u6bcd(\u4e0d\u5206\u5927\u5c0f\u5199)\u3001\u6c49\u5b57\u3002 \u957f\u5ea6\u4e3a3\uff5e20\u4f4d");
			}
		  case 1:
			
			showInfo(rs[1], "pwdReg", "\u5fc5\u987b\u75316\u4f4d\u4ee5\u4e0a\u7684\u82f1\u6587\u5b57\u6bcd\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u7ec4\u6210\uff0c\u82f1\u6587\u5b57\u6bcd\u8bf7\u533a\u5206\u5927\u5c0f\u5199");
		  case 2:
			//open("\u6b63\u5728\u9a8c\u8bc1\u786e\u8ba4\u5bc6\u7801....");
			showInfo(rs[2], "repwdReg", "\u4e24\u6b21\u8f93\u5165\u7684\u5bc6\u7801\u4e0d\u4e00\u81f4或确认密码为空");
		  case 3:
			
			if (rs[3] == 2) {
				showInfo(1, "emailReg", "\u6b64\u90ae\u7bb1\u5df2\u7ecf\u6ce8\u518c\u8fc7\u4e86\uff0c\u8bf7\u4f7f\u7528\u5176\u5b83\u90ae\u7bb1");
			} else {
				showInfo(rs[3], "emailReg", "\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u90ae\u7bb1");
			}
		  case 4:
			
			showInfo(rs[4], "pathReg", "\u8bf7\u9009\u62e9\u6216\u586b\u5199\u83b7\u6089\u667a\u4e70\u9053\u9014\u5f84");
		  case 5:
			
			showInfo(rs[5], "codeReg", "\u9a8c\u8bc1\u7801\u4e0d\u6b63\u786e");
		  case 6:
			
			showInfo(rs[6], "LFReg", "卡号已被绑定");
		  case 7:
			
			showInfo(rs[7], "SHReg", "卡号已被绑定");
		  case 8:
			
			showInfo(rs[8], "SHRegName", "请填写金鹤俱乐部会员卡姓名.");			
		}
		}
		if(isSuccess=="3")
		{
			open();
			show("正在提交信息,请耐心等待...");
		}
		
		
	}
	closeInfo();
}
function add() {

}
function checkPwdStrong(obj) {

	var result = getPWDResult(obj);
	
	imgs = "/html/images/reguser/";
	switch (result) {
	  case 0:
		$("strongPwd").innerHTML = "<img align='absmiddle' src='" + imgs + "" + "strong1.gif' />";
		break;
	  case 1:
		$("strongPwd").innerHTML = "<img align='absmiddle' src='" + imgs + "" + "strong2.gif' />";
		break;
	  case 2:
		$("strongPwd").innerHTML = "<img align='absmiddle' src='" + imgs + "" + "strong3.gif' />";
		break;
	}
}
function getPWDResult(s) {
	var ls = -1;
	if (s.match(/[a-z]/ig)) {
		ls++;
	}
	if (s.match(/[0-9]/ig)) {
		ls++;
	}
	if (s.match(/(.[^a-z0-9])/ig)) {
		ls++;
	}
	
	return ls;
}


//hidden
var W = screen.width;//取得屏幕分辨率宽度
var H = screen.height;//取得屏幕分辨率高度
function M(id) {
	return document.getElementById(id);//用M()方法代替document.getElementById(id)
}
function MC(t) {
	return document.createElement(t);//用MC()方法代替document.createElement(t)
}

//判断浏览器是否为IE
function isIE() {
	return (document.all && window.ActiveXObject && !window.opera) ? true : false;
} 

//取得页面的高宽
function getBodySize() {
	var bodySize = [];
	with (document.documentElement) {
		bodySize[0] = (scrollWidth > clientWidth) ? scrollWidth : clientWidth;//如果滚动条的宽度大于页面的宽度，取得滚动条的宽度，否则取页面宽度
		bodySize[1] = (scrollHeight > clientHeight) ? scrollHeight : clientHeight;//如果滚动条的高度大于页面的高度，取得滚动条的高度，否则取高度
	}
	return bodySize;
}

//创建遮盖层
function popCoverDiv() {
	if (M("cover_div")) {

   //如果存在遮盖层，则让其显示 
		M("cover_div").style.display = "block";
		M("cover_div").style.zIndex = "999";
	} else {

   //否则创建遮盖层
		var coverDiv = MC("div");
		document.body.appendChild(coverDiv);
		coverDiv.id = "cover_div";
		with (coverDiv.style) {
			position = "absolute";
			background = "#CCCCCC";
			zIndex = "999";
			left = "0px";
			top = "0px";
			var bodySize = getBodySize();
			width = bodySize[0] + "px";
			height = bodySize[1] + "px";
			zIndex = 0;
			if (isIE()) {
				filter = "Alpha(Opacity=60)";//IE逆境
			} else {
				opacity = 0.6;
			}
		}
	}
}

 

 

 

 

//让提示层显示为块 
function showRegInfo(info) {
	var reg = M("RegInfos");
	reg.style.display = "block";
	M("info").innerText = info;
            
            //alert( M("productid").value);
}

 

//设置DIV层的样式
function change() {
	var reg = M("RegInfos");
	reg.style.position = "absolute";
	reg.style.border = "1px solid #CCCCCC";
	reg.style.background = "#F6F6F6";
	reg.style.zIndex = "9999";
	var i = 0;
	var bodySize = getBodySize();
	reg.style.left = (document.body.clientWidth - reg.offsetWidth) / 2 + 200 + document.body.scrollLeft + "px";
	reg.style.top = (document.body.clientHeight - reg.offsetHeight) / 2 + document.body.scrollTop + "px";
	reg.style.width = i * i * 4 + "px";
	reg.style.height = i * i * 1.5 + "px";
	popChange(i);
}

//让DIV层大小循环增大
function popChange(i) {
	var reg = M("RegInfos");
	var bodySize = getBodySize();
	reg.style.left = (document.documentElement.clientWidth - reg.offsetWidth - i * i * 4) / 2 + 200 + document.documentElement.scrollLeft + "px";
	reg.style.top = (document.documentElement.clientHeight - reg.offsetHeight - i * i) / 2 + document.documentElement.scrollTop + "px";
	reg.style.width = i * i * 4 + "px";
	reg.style.height = i * i * 1.5 + "px";
	if (i <= 10) {
		i++;
		setTimeout("popChange(" + i + ")", 10);//设置超时10毫秒
	}
}

//打开DIV层
function open() {
	change();
	showRegInfo();
	popCoverDiv();
	void (0);//不进行任何操作,如：<a href="#">aaa</a>
}

//关闭DIV层
function closeInfo() {
	M("RegInfos").style.display = "none";
	M("cover_div").style.display = "none";
	void (0);
}
	
//检查汉莎卡号
function checkLfCard(custId) {
	
	if((document.forms.register['register:lf'].checked))
	{			
	validity=false;
	if (custId.length == 15 || custId.length == 16 || custId.length == 9) {				
		if ((custId.length == 15 && (custId.slice(0,6).indexOf('33303') != -1 || custId.slice(0,6).indexOf('22201') != -1 || custId.slice(0,6).indexOf('99222') != -1 || custId.slice(0,6).indexOf('99200') != -1 || custId.slice(0,6).indexOf('99990') != -1)) || (custId.length == 16 && (custId.slice(0,6).indexOf('403400') != -1 || custId.slice(0,6).indexOf('401000') != -1 || custId.slice(0,6).indexOf('401001') != -1 || custId.slice(0,6).indexOf('401002') != -1 || custId.slice(0,6).indexOf('401003') != -1 || custId.slice(0,6).indexOf('523400') != -1 || custId.slice(0,6).indexOf('531000') != -1 || custId.slice(0,6).indexOf('531001') != -1 || custId.slice(0,6).indexOf('531002') != -1 || custId.slice(0,6).indexOf('531003') != -1)) || (custId.length == 9)) {				
			checkDigit = custId.charAt(custId.length-1);
					
			digits = new Array();
					
			for (i=0; i<custId.length-1; i++)
				digits.push(custId.charAt(i));		
					
			digits.reverse();
							
			m = 2;
			checkValue = new Array();
						
			for (i=0; i<digits.length;i++) {
				checkValue.push(m*digits[i]);
	
				if (m == 2) {
					m = 1
				} 
				else {
					m = 2
				}	
			}
					
			for (i=0; i<checkValue.length; i++)
				if (checkValue[i]>9) {
					checkValue[i] = checkValue[i]+'';
					checkValue[i]=parseInt(checkValue[i].charAt(0))+parseInt(checkValue[i].charAt(1));
				}
					
			res = 0;
			for (i=0; i<checkValue.length; i++)
				res = res + checkValue[i];
					
			res = Math.ceil(res/10)*10 - res;
					
			if (res == checkDigit) {
				validity = true;	
			} 
		}  
	}  
	
	if(!validity)
	{
	$("LFReg").innerHTML = "<img align='absmiddle' src='/html/images/reguser/yesno.gif' /><font color='red'>卡号错误或为空 </font>";
	$("divGo").style.display="none";
	$("divGo1").style.display="block";
	
	}
	else{
	$("LFReg").innerHTML = "<img align='absmiddle' src='/html/images/reguser/yesok.gif' />";
	$("divGo1").style.display="none";
	$("divGo").style.display="block";
	}
	}
}

//检查上海航空卡号
function checkShCard(obj){
	if((document.forms.register['register:sh'].checked)){
		isBool=false;
		if(obj.length==10){
			objFirst=obj.substring(0,1)
			if(objFirst==8){
				subObj=objFirst+obj.substring(2,10);
				mod=subObj%7;
				if(mod>=0&&mod<=6){
					objCheck=obj.substring(1,2);
					if(objCheck==mod){				
						isBool=true;
					}
				}
			}
		}
		if(document.getElementById('register:shName').value.replace(/(^\s*)|(\s*$)/g, '')==''){
			$("SHRegName").innerHTML = "<img align='absmiddle' src='/html/images/reguser/yesno.gif' /><font color='red'>金鹤俱乐部会员卡姓名不能为空 </font>";
			$("divGo").style.display="none";
			$("divGo1").style.display="block";
		}else{
			$("SHRegName").innerHTML = "<img align='absmiddle' src='/html/images/reguser/yesok.gif' />";
			$("divGo1").style.display="none";
			$("divGo").style.display="block";
		}
		if(!isBool){
			$("SHReg").innerHTML = "<img align='absmiddle' src='/html/images/reguser/yesno.gif' /><font color='red'>卡号错误或为空 </font>";
			$("divGo").style.display="none";
			$("divGo1").style.display="block";
		}else{
			$("SHReg").innerHTML = "<img align='absmiddle' src='/html/images/reguser/yesok.gif' />";
			$("divGo1").style.display="none";
			$("divGo").style.display="block";
		}
		
	}
}

//
function changeDiv(){
	//alert(document.forms.register['register:sh'].checked);
	//alert(document.forms.register['register:lf'].checked);
	if((document.forms.register['register:sh'].checked)||(document.forms.register['register:lf'].checked)){
		$("divGo").style.display="none";
		$("divGo1").style.display="block";
	}else
	{
		$("divGo1").style.display="none";
		$("divGo").style.display="block";
		
	}
	
	if(!document.forms.register['register:sh'].checked){
		$("SHReg").innerHTML="";
		$("SHRegName").innerHTML="";		
	}
	
	if(!document.forms.register['register:lf'].checked)
	{	
	$("LFReg").innerHTML="";
	}

}

//
function checkCard(){
checkShCard(document.forms.register['register:shCard'].value);
checkLfCard(document.forms.register['register:lfCard'].value);

}



