///////////////////////////////////////////
// reg.js
//
// David Yang (yangjh@doe2e.com)
// 2002.12.12
///////////////////////////////////////////

function checkUserInfo()
{
	var e = document.all.frmReg;
	
	if (e.sAccount.value == "") {
		alert("必须给出用户帐号名！");
		e.sAccount.focus();
		return;
	}
	
	if (e.sPassword.value == "") {
		alert("口令不能为空！");
		e.sPassword.focus();
		return;
	}
	
	if (e.sPassword.value.length < 6) {
		alert("口令是6-12位的字母数字组合，您的口令太短！");
		e.sPassword.focus();
		return;
	}

	if (e.sPassword.value.length > 12) {
		alert("口令是6-12位的字母数字组合，您的口令太长！");
		e.sPassword.focus();
		return;
	}

	if (e.sPassword.value != e.sPasswordConfirm.value) {
		alert("您两次给出的口令不一样！");
		e.sPasswordConfirm.focus();
		return;
	}
		
	if (e.sEmail.value == "") {
		alert("必须给出有效的e-mail地址！");
		e.sEmail.focus();
		return;
	}

	var wid = e.wid.value;
	var sAccount = e.sAccount.value;
	var sPassword = e.sPassword.value;
	var sExpireCycle = e.sExpireCycle.value;
	var sEmail = e.sEmail.value;
	var sName = e.sName.value;
	var sSex = e.sSex.value;
	var sBirthday = e.sBirthday.value;
	var sEducation = e.sEducation.value;
	var sCompany = e.sCompany.value;
	var sOfficeTel = e.sOfficeTel.value;
	var sOfficeTelExt = e.sOfficeTelExt.value;
	var sFax = e.sFax.value;
	var sBP = e.sBP.value;
	var sHomeTel = e.sHomeTel.value;
	var sMobile = e.sMobile.value;
	var sCompanyWebsite = e.sCompanyWebsite.value;
	var sPersonalWebsite = e.sPersonalWebsite.value;
	var sCountry = e.sCountry.value;
	var sProvince = e.sProvince.value;
	var sCity = e.sCity.value;
	var sAddress = e.sAddress.value;
	var sPostcode = e.sPostcode.value;
	var sMemberShip = e.sMemberShip.value;

	ifrmReg.submitData(wid, sAccount, sPassword, sExpireCycle, sEmail, sName, sSex, sBirthday, sEducation, sCompany, sOfficeTel, sOfficeTelExt, sFax, sHomeTel, sBP, sMobile, sCompanyWebsite, sPersonalWebsite, sCountry, sProvince, sCity, sAddress, sPostcode, sMemberShip);
	
}

function getData(sID, sMsg)
{
	if (sID == 'idError') {
		alert(sMsg);
	}
	else {
		for (var i = 0; i < document.all.length; i++) {
			var e = document.all[i];
			if (e.id == 'oRegTip' || e.id == 'oRegForm') {
				e.style.display = 'none';
			}
			if (e.id == 'oMsgTable') {
				e.style.display = '';
			}
			if (e.id == 'oMsg') {
				e.innerHTML = "<SPAN STYLE='FONT-SIZE:10pt;COLOR:#FF0000'>" + sMsg + "</SPAN>";
			}
		}
	}
}

function checkKeyVal(obj)
{
	var e = window.event;
	if (obj.sAccount.value.length > 0 && obj.sPassword.value.length > 0 && e.keyCode == 13) {
		obj.submit();
	}
}

function submitMe(obj)
{
//	window.event.returnValue = false;
	obj.action = "/web/reg/auth.asp";
	obj.submit();
}

function regMe(obj)
{
//	window.event.returnValue = false;
	obj.action = "/web/reg/reg.asp";
	obj.submit();
}
