function validateLoginForm(){
	var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>? ";
	var invalidun;
	var invalidpw;
	for (var i = 0; i < document.forms[0].txtfUserName.value.length; i++) {
		if (iChars.indexOf(document.forms[0].txtfUserName.value.charAt(i)) != -1) {
			invalidun = "yes";
		}
	}
	for (var j = 0; j < document.forms[0].txtfPassword.value.length; j++) {
		if (iChars.indexOf(document.forms[0].txtfPassword.value.charAt(j)) != -1) {
			invalidpw = "yes";
		}
	}
	if (document.forms[0].txtfUserName.value.length < 6 || invalidun == "yes"){
		alert('请使用最少6个字符的有效用户名。记住：只允许使用字母和数字。');
	}
	else if (document.forms[0].txtfPassword.value.length <6 || invalidpw == "yes"){
	  	alert('请使用最少6个字符的有效密码。记住：只允许使用字母和数字。');
	}
  	else {
		document.forms[0].action='myimark_zh.asp';
      	document.forms[0].submit();
	 }
}
function validateEmail(){
	var email = document.forgotpwform.email.value;
	var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;

	if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
		alert('请插入一个正确的电子邮件地址');
		document.forgotpwform.email.focus();
	} else {
		document.forgotpwform.submit();
	}
}
var newwindow
function winalert(url) {
    newwindow=window.open(url,"Window","menubar=no,width=450,height=350,toolbar=no,top=200,left=300");	
	
}
function validateRegistrationForm(){
	var email = document.registrationform.email.value;
	var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
	var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>? ";
	var invalidun;
	var invalidpw;

	for (var i = 0; i < document.registrationform.username.value.length; i++) {
		if (iChars.indexOf(document.registrationform.username.value.charAt(i)) != -1) {
			invalidun = "yes";
		}
	}
	for (var j = 0; j < document.registrationform.password.value.length; j++) {
		if (iChars.indexOf(document.registrationform.password.value.charAt(j)) != -1) {
			invalidpw = "yes";
		}
	}
	if ((document.registrationform.firstname.value == "")||(document.registrationform.firstname.value == "undefined")){
		alert("请填写你的姓。");
		document.registrationform.firstname.focus();
	}
	else if ((document.registrationform.lastname.value == "")||(document.registrationform.lastname.value == "undefined")){
		alert("请填写你的名。");
		document.registrationform.lastname.focus();
	}
	else if(!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
		alert('请填写一个正确的电子邮件地址。');
		document.registrationform.email.focus();
	}
	else if ((document.registrationform.gender[0].checked==false)&&(document.registrationform.gender[1].checked==false)){
		alert("请提供你的性别。");
	}
	else if (document.registrationform.selectcountry.options[0].selected){
		alert("请选择你的国家");
	}
	else if (document.registrationform.username.value.length < 6 || invalidun == "yes"){
		alert('请使用最少6个字符的有效用户名。记住：只允许使用字母和数字。');
		document.registrationform.username.focus();
	}
	else if (document.registrationform.password.value.length <6 || invalidpw == "yes"){
	  	alert('请使用最少6个字符的有效密码。记住：只允许使用字母和数字。');
		document.registrationform.password.focus();
	}
	else if (document.registrationform.password.value!=document.registrationform.retypepassword.value){
	  	alert('"密码"和"重新输入密码"值不一致，请再试一次。');
		document.registrationform.password.focus();
	}
	else{
		document.registrationform.submit();
	}
}

function resetRegistrationForm(){
	document.registrationform.reset();
}

function validateUpdateRegistrationForm(){
 var email = document.updateregistrationform.email.value;
 var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;

 if ((document.updateregistrationform.firstname.value == "")||(document.updateregistrationform.firstname.value == "undefined")){
 alert("请填写你的姓。");
 document.updateregistrationform.firstname.focus();
 }
 else if ((document.updateregistrationform.lastname.value == "")||(document.updateregistrationform.lastname.value == "undefined")){
 alert("请填写你的名。");
 document.updateregistrationform.lastname.focus();
 }
 else if(!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
 alert('请填写一个正确的电子邮件地址。');
 document.updateregistrationform.email.focus();
 }
 else if ((document.updateregistrationform.lastname.value == "")||(document.updateregistrationform.lastname.value == "undefined")){
 alert("请填写你的名。");
 document.updateregistrationform.lastname.focus();
 }
 else if (document.updateregistrationform.selectcountry.options[0].selected){
 alert("请选择你的国家");
 }
 else{
 document.updateregistrationform.submit();
 }
}

function resetRegistrationForm(){
 document.updateregistrationform.reset();
}

function validateOrderForm(){
	var email = document.orderform.email.value;
	var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
	if ((document.orderform.firstname.value == "")||(document.orderform.firstname.value == "undefined")){
		alert("请填写你的姓。");
		document.orderform.firstname.focus();
	}
	else if ((document.orderform.lastname.value == "")||(document.orderform.lastname.value == "undefined")){
		alert("请填写你的名。");
		document.orderform.lastname.focus();
	}
	else if (((document.orderform.address1.value == "")||(document.orderform.address1.value == "undefined"))&&((document.orderform.address2.value == "")||(document.orderform.address2.value == "undefined"))){
		alert("请填写你的邮寄地址。");
		document.orderform.address1.focus();
	}
	else if ((document.orderform.city.value == "")||(document.orderform.city.value == "undefined")){
		alert("请提供你所在的城镇。");
		document.orderform.city.focus();
	}
	else if (document.orderform.selectcountry.options[0].selected){
		alert("请选择你的国家。");
	}
	else if(!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
		alert('请填写一个正确的电子邮件地址。');
		document.orderform.email.focus();
	}
	else{
		document.orderform.submit();
	}
}

function resetOrderForm(){
	document.orderform.reset();
}
function showContent(objectIdToShow, objectIdToRename, objectIdToSelect){
	try{
		var objectToShow = document.getElementById(objectIdToShow);
		var objectToRename = document.getElementById(objectIdToRename);
		var objectToSelect = document.getElementById(objectIdToSelect);
		
		var styleStatus = objectToShow.style.display;
		if (styleStatus == 'none') {
			styleStatus = 'block';
			objectToRename.innerHTML = "关闭"
			objectToSelect.innerHTML = "<b>" + objectToSelect.innerHTML + "</b>"
			objectToSelect.style.color = "#CC3348";
		}else{
			styleStatus = 'none';
			objectToRename.innerHTML = "更多"
			var str = objectToSelect.innerHTML
			var l = str.length - 4;
			str = str.substring(3,l)
			objectToSelect.innerHTML = str;

			}
		objectToShow.style.display = styleStatus;
		
		}
	
	catch(e){//
	      }
}
