function IsNumeric(sText)
{
 var ValidChars = "0123456789";
 var IsNumber=true;
 var Char;
 for (i = 0; i < sText.length && IsNumber == true; i++) 
 { 
  Char = sText.charAt(i); 
  if (ValidChars.indexOf(Char) == -1) 
  {
   IsNumber = false;
  }
 }
 return IsNumber;
}

function invalid_email(emailadd)
{
 return ((emailadd.indexOf("@") < 1) || (emailadd.indexOf(".") < 3) || (emailadd.indexOf(" ") >= 0));
}
function confirmRegisterChinese()
{
 if (!document.registrationform.firstname.value)
 {
  alert("请输入您的名.");
  document.registrationform.firstname.focus();
  return false;
 }
 if (!document.registrationform.lastname.value)
 {
  alert("请输入您的姓名.");
  document.registrationform.lastname.focus();
  return false;
 }
 gender=false;
 for (counter=0; counter<document.registrationform.gender.length; counter++)
 {
  if (document.registrationform.gender[counter].checked)
  {
   gender=true;
  }
 }
 if (!gender)
 {
  alert("请选择您的性别.");
  return false;
 }
 /*if (!document.registrationform.religion.value)
 {
  alert("请输入您的宗教信仰.");
  document.registrationform.religion.focus();
  return false;
 }*/
 if (!document.registrationform.address.value)
 {
  alert("请输入您的地址.");
  document.registrationform.address.focus();
  return false;
 }
 if (document.registrationform.postal.value)
 {
	//if ((!document.registrationform.postal.value) || (IsNumeric(document.registrationform.postal.value)==false))
	if (IsNumeric(document.registrationform.postal.value)==false)
	{
		alert("请输入您的邮编.");
		document.registrationform.postal.focus();
		return false;
	}
 }
 if ((!document.registrationform.phone.value) || (IsNumeric(document.registrationform.phone.value)==false))
 {
  alert("请输入您的电话号码.");
  document.registrationform.phone.focus();
  return false;
 }
 if ((!document.registrationform.phonecc.value) || (IsNumeric(document.registrationform.phonecc.value)==false))
 {
  alert("请输入您的国际代码.");
  document.registrationform.phonecc.focus();
  return false;
 }
 if ((document.registrationform.phoneac.value) && (IsNumeric(document.registrationform.phoneac.value)==false))
 {
  alert("请输入您的城市区号.");
  document.registrationform.phoneac.focus();
  return false;
 }
 if ((document.registrationform.mobile.value) && (IsNumeric(document.registrationform.mobile.value)==false))
 {
  alert("请输入您的手机号码.");
  document.registrationform.mobile.focus();
  return false;
 }
 if ((document.registrationform.mobile.value) && ((!document.registrationform.mobilecc.value) || (IsNumeric(document.registrationform.mobilecc.value)==false)))
 {
  alert("请输入您的国际代码.");
  document.registrationform.mobilecc.focus();
  return false;
 }
 if ((!document.registrationform.email.value) || (invalid_email(document.registrationform.email.value)))
 {
  alert("请输入您正确的邮箱e-mail.");
  document.registrationform.email.focus();
  return false;
 }
 price=false;
 for (counter=0; counter<document.registrationform.price.length; counter++)
 {
  if (document.registrationform.price[counter].checked)
  {
   price=true;
  }
 }
 if (!price)
 {
  alert("请选择会议费用.");
  return false;
 }
 /*
 if (!document.registrationform.ccno.value)
 {
  alert("请输入您正确的信用卡号码.");
  document.registrationform.ccno.focus();
  return false;
 }
 if (!document.registrationform.ccname.value)
 {
  alert("请输入您的信用用户名.");
  document.registrationform.ccname.focus();
  return false;
 }
 if (!document.registrationform.ccvalidmonth.value)
 {
  alert("请选择信用卡有效期的月份.");
  document.registrationform.ccvalidmonth.focus();
  return false;
 }
 if (!document.registrationform.ccvalidyear.value)
 {
  alert("请选择信用卡有效期的年份.");
  document.registrationform.ccvalidyear.focus();
  return false;
 }*/

 document.registrationform.submit();
}
function confirmRegister()
{
 if (!document.registrationform.firstname.value)
 {
  alert("Please enter your first name");
  document.registrationform.firstname.focus();
  return false;
 }
 if (!document.registrationform.lastname.value)
 {
  alert("Please enter your last name");
  document.registrationform.lastname.focus();
  return false;
 }
 gender=false;
 for (counter=0; counter<document.registrationform.gender.length; counter++)
 {
  if (document.registrationform.gender[counter].checked)
  {
   gender=true;
  }
 }
 if (!gender)
 {
  alert("Please enter a valid gender");
  return false;
 }
 if (!document.registrationform.address.value)
 {
  alert("Please enter your address");
  document.registrationform.address.focus();
  return false;
 }
 if ((!document.registrationform.postal.value) || (IsNumeric(document.registrationform.postal.value)==false))
 {
  alert("Please enter a valid postal code");
  document.registrationform.postal.focus();
  return false;
 }
 if ((!document.registrationform.phone.value) || (IsNumeric(document.registrationform.phone.value)==false))
 {
  alert("Please enter a valid telephone number");
  document.registrationform.phone.focus();
  return false;
 }
 if ((!document.registrationform.phonecc.value) || (IsNumeric(document.registrationform.phonecc.value)==false))
 {
  alert("Please enter a valid telephone number's country code");
  document.registrationform.phonecc.focus();
  return false;
 }
 if ((document.registrationform.phoneac.value) && (IsNumeric(document.registrationform.phoneac.value)==false))
 {
  alert("Please enter a valid telephone number's city code");
  document.registrationform.phoneac.focus();
  return false;
 }
 if ((document.registrationform.mobile.value) && (IsNumeric(document.registrationform.mobile.value)==false))
 {
  alert("Please enter a valid mobile number");
  document.registrationform.mobile.focus();
  return false;
 }
 if ((document.registrationform.mobile.value) && ((!document.registrationform.mobilecc.value) || (IsNumeric(document.registrationform.mobilecc.value)==false)))
 {
  alert("Please enter a valid mobile number's country code");
  document.registrationform.mobilecc.focus();
  return false;
 }
 if ((!document.registrationform.email.value) || (invalid_email(document.registrationform.email.value)))
 {
  alert("Please enter a valid email address");
  document.registrationform.email.focus();
  return false;
 }
 price=false;
 for (counter=0; counter<document.registrationform.price.length; counter++)
 {
  if (document.registrationform.price[counter].checked)
  {
   price=true;
  }
 }
 if (!price)
 {
  alert("Please select a conference price.");
  return false;
 }

 document.registrationform.submit();
}

function confirmPayment()
{
 document.paymentform.submit();
}

function confirmSubscribe()
{
 if (!document.subform1.firstname.value)
 {
  alert("Please enter your first name");
  document.subform1.firstname.focus();
  return false;
 }
 if (!document.subform1.lastname.value)
 {
  alert("Please enter your last name");
  document.subform1.lastname.focus();
  return false;
 }
 gender=false;
 for (counter=0; counter<document.subform1.gender.length; counter++)
 {
  if (document.subform1.gender[counter].checked)
  {
   gender=true;
  }
 }
 if (!gender)
 {
  alert("Please enter a valid gender");
  return false;
 }

 if (!document.subform1.address.value)
 {
  alert("Please enter your address");
  document.subform1.address.focus();
  return false;
 }
 if ((!document.subform1.postal.value) || (IsNumeric(document.subform1.postal.value)==false))
 {
  alert("Please enter a valid postal code");
  document.subform1.postal.focus();
  return false;
 }
 if ((!document.subform1.phone.value) || (IsNumeric(document.subform1.phone.value)==false))
 {
  alert("Please enter a valid telephone number");
  document.subform1.phone.focus();
  return false;
 }
 if ((!document.subform1.phonecc.value) || (IsNumeric(document.subform1.phonecc.value)==false))
 {
  alert("Please enter a valid telephone number's country code");
  document.subform1.phonecc.focus();
  return false;
 }
 if ((document.subform1.phoneac.value) && (IsNumeric(document.subform1.phoneac.value)==false))
 {
  alert("Please enter a valid telephone number's city code");
  document.subform1.phoneac.focus();
  return false;
 }
 if ((document.subform1.mobile.value) && (IsNumeric(document.subform1.mobile.value)==false))
 {
  alert("Please enter a valid mobile number");
  document.subform1.mobile.focus();
  return false;
 }
 if ((document.subform1.mobile.value) && ((!document.subform1.mobilecc.value) || (IsNumeric(document.subform1.mobilecc.value)==false)))
 {
  alert("Please enter a valid mobile number's country code");
  document.subform1.mobilecc.focus();
  return false;
 }
 if ((!document.subform1.email.value) || (invalid_email(document.subform1.email.value)))
 {
  alert("Please enter a valid email address");
  document.subform1.email.focus();
  return false;
 }
 if ((document.subform1.style.selectedIndex==26) && (!document.subform1.style2.value))
 {
  alert("Please enter a specific (Others) yoga style");
  document.subform1.style2.focus();
  return false;
 }


 document.subform1.submit();
}

function confirmSubscribe2()
{
 if (!document.subform2.studioname.value)
 {
  alert("Please enter your studio name");
  document.subform2.studioname.focus();
  return false;
 }
 if (!document.subform2.contactperson.value)
 {
  alert("Please enter your contact person");
  document.subform2.contactperson.focus();
  return false;
 }
 if (!document.subform2.address.value)
 {
  alert("Please enter your address");
  document.subform2.address.focus();
  return false;
 }
 if ((!document.subform2.postal.value) || (IsNumeric(document.subform2.postal.value)==false))
 {
  alert("Please enter a valid postal code");
  document.subform2.postal.focus();
  return false;
 }
 if ((!document.subform2.phone.value) || (IsNumeric(document.subform2.phone.value)==false))
 {
  alert("Please enter a valid telephone number");
  document.subform2.phone.focus();
  return false;
 }
 if ((!document.subform2.phonecc.value) || (IsNumeric(document.subform2.phonecc.value)==false))
 {
  alert("Please enter a valid telephone number's country code");
  document.subform2.phonecc.focus();
  return false;
 }
 if ((document.subform2.phoneac.value) && (IsNumeric(document.subform2.phoneac.value)==false))
 {
  alert("Please enter a valid telephone number's city code");
  document.subform2.phoneac.focus();
  return false;
 }
 if ((document.subform2.mobile.value) && (IsNumeric(document.subform2.mobile.value)==false))
 {
  alert("Please enter a valid mobile number");
  document.subform2.mobile.focus();
  return false;
 }
 if ((document.subform2.mobile.value) && ((!document.subform2.mobilecc.value) || (IsNumeric(document.subform2.mobilecc.value)==false)))
 {
  alert("Please enter a valid mobile number's country code");
  document.subform2.mobilecc.focus();
  return false;
 }
 if ((!document.subform2.email.value) || (invalid_email(document.subform2.email.value)))
 {
  alert("Please enter a valid email address");
  document.subform2.email.focus();
  return false;
 }
 if ((document.subform2.style.selectedIndex==26) && (!document.subform2.style2.value))
 {
  alert("Please enter a specific (Others) yoga style");
  document.subform2.style2.focus();
  return false;
 }
function Trim(inputString)
{
	var retValue = inputString;
	var ch = retValue.substring(0, 1);

	while (ch == " ")
	{ // Check for space at the start of the string
		retValue = retValue.substring(1, retValue.length);
		ch = retValue.substring(0, 1);
	}

	ch = retValue.substring(retValue.length-1, retValue.length);

	while (ch == " ")
	{ // Check for spaces at the end of the string
		retValue = retValue.substring(0, retValue.length-1);
		ch = retValue.substring(retValue.length-1, retValue.length);
	}	
	return retValue;
}
function IsEmpty(v){
	varValue = Trim(v);
	if (varValue.length == 0){ return true; }else{ return false; }
}
 ///////////////////////////////////////
 /*added in for username and password */
 ///////////////////////////////////////
 if (IsEmpty(document.getElementById("username").value))
 {
	alert("Please enter your choice of username.");
	document.getElementById("username").focus();
	return;
 }
 if (Trim(document.getElementById("username").value).length < 6)
 {
	alert("Please enter at least 6 characters for your choice of username.");
	document.getElementById("username").focus();
	return;
 }
 if (IsEmpty(document.getElementById("password").value))
 {
	alert("Please enter your choice of password.");
	document.getElementById("password").focus();
	return;
 }
 if (Trim(document.getElementById("password").value).length < 6)
 {
	alert("Please enter at least 6 characters for your choice of password.");
	document.getElementById("password").focus();
	return;
 }
 if (IsEmpty(document.getElementById("con_password").value))
 {
	alert("Please confirm your choice of password.");
	document.getElementById("con_password").focus();
	return;
 }
 if (Trim(document.getElementById("con_password").value) != Trim(document.getElementById("password").value))
 {
	alert("Please confirm your choice of password again.");
	document.getElementById("con_password").focus();
	return;
 }
 document.subform2.submit();
}

