//用户注册格式校验
function check(){
	var weburl=$("#weburl").val();
	var $rn=$("#reg_name");
	var $rp1=$("#reg_pass1");
	var $rp2=$("#reg_pass2");
	
	var $rm=$("#reg_mail");
	var $fn=$("#name");
	var $ln=$("#lname");
	var $cn=$("#country");
	var $ph=$("#phone");
	var $ad=$("#address");
	var $ct=$("#city");
	var $zip=$("#postcode");
	
	var $rk=$("#reg_key");
	if($.trim($rn.val())==""){
		switch(getLan()){
			case 0:
			alert("الرجاء ملء اسم المستخدم");
			break
			case 1:
			alert("Please fill in user name");
			break
		}
		return false;
	}
	/*if(!isName($.trim($rn.val()))){
		switch(getLan()){
			case 0:
			alert("请用字母，数字，下划线的组合，必须以字母开头");
			break
			case 1:
			alert("Please use letters, numbers, underscores the combination, you must start with a letter");
			break
		}
		return false;
	}*/
	if(getLength($.trim($rn.val()))<4){
		switch(getLan()){
			case 0:
			alert("اسم المستخدم طول لا يقل عن أربعة");
			break
			case 1:
			alert("User Name minimum length 4 characters");
			break
		}
		return false;
	}
	if($.trim($rp1.val())==""){
		switch(getLan()){
			case 0:
			alert("الرجاء إدخال كلمة المرور");
			break
			case 1:
			alert("Please enter a Password");
			break
		}
		return false;
	}
	if($.trim($rp1.val()).length<4){
		switch(getLan()){
			case 0:
			alert("كلمة السر لا يقل عن أربعة");
			break
			case 1:
			alert("User name Password minimum length 4");
			break
		}
		return false;
	}
	if($.trim($rp2.val())==""){
		switch(getLan()){
			case 0:
			alert("يرجى ملء كلمة السر الخاصة بك مرة أخرى");
			break
			case 1:
			alert("Please re-enter your password");
			break
		}
		return false;
	}
	if($.trim($rp1.val())!=$.trim($rp2.val())){
		switch(getLan()){
			case 0:
			alert("أدخل كلمة المرور في كل مرة تختلف ، والاختيار");
			break
			case 1:
			alert("Both times the password is not the same as");
			break
		}
		return false;
	}
	//验证邮箱
	if($.trim($rm.val())==""){
		switch(getLan()){
			case 0:
			alert("يرجى ملء في بريدك");
			break
			case 1:
			alert("Please enter a user Email");
			break
		}
		return false;
	}
	if(!isMail($.trim($rm.val()))){
		switch(getLan()){
			case 0:
			alert("يرجى التحقق من البريد الإلكتروني الخاص بك شكل");
			break
			case 1:
			alert("Please fill in the correct e-mail address format");
			break
		}
		return false;
	}
	//first name 
	if($.trim($fn.val())==""){
		switch(getLan()){
			case 0:
			alert("يرجى ملء في اسم");
			break
			case 1:
			alert("Please enter the firstname");
			break
		}
		return false;
	}
	//lase name
	if($.trim($ln.val())==""){
		switch(getLan()){
			case 0:
			alert("يرجى ملء في اسم");
			break
			case 1:
			alert("Please enter the lastname");
			break
		}
		return false;
	}
	//country
	if($.trim($cn.val())=="0"){
		switch(getLan()){
			case 0:
			alert("الرجاء اختيار بلد");
			break
			case 1:
			alert("Please select a country");
			break
		}
		return false;
	}
	//phone
	if($.trim($ph.val())==""){
		switch(getLan()){
			case 0:
			alert("يرجى ملء رقم الهاتف");
			break
			case 1:
			alert("Please fill in the phone number");
			break
		}
		return false;
	}
	if(!isNumber($.trim($ph.val()))){
		switch(getLan()){
			case 0:
			alert("رقم الهاتف الوحيد لالرقمية");
			break
			case 1:
			alert("Phone number only to digital");
			break
		}
		return false;
	}
	//验证地址
	if($.trim($ad.val())==""){
		switch(getLan()){
			case 0:
			alert("يرجى ملء في عنوان الاتصال");
			break
			case 1:
			alert("Please fill in the contact address");
			break
		}
		return false;
	}
	//验证邮编
	if($.trim($zip.val())==""){
		switch(getLan()){
			case 0:
			alert("الرجاء ملء الرمز البريدي");
			break
			case 1:
			alert("Please fill in the Zip Code");
			break
		}
		return false;
	}
	
	if($.trim($ct.val())=="0"){
		switch(getLan()){
			case 0:
			alert("الرجاء اختيار بلد");
			break
			case 1:
			alert("Please select the 'Where do you know us'");
			break
		}
		return false;
	}
	//验证注册码
	if($.trim($rk.val())==""){
		switch(getLan()){
			case 0:
			alert("يرجى ملء رمز التحقق");
			break
			case 1:
			alert("Please enter the verification code");
			break
		}
		return false;
	}
	/*if($("#isck").val()=="false"){
		switch(getLan()){
			case 0:
			alert("请点击“检测用户名”按钮检查用户名是否可用");
			break
			case 1:
			alert("Please click 'check' button, check the user name exists");
			break
		}
		return false;
	}*/
	$("#user_reg").submit();
}
function ckuser(){
	//检测用户名
	var weburl=$("#weburl").val();
	var rn=$.trim($("#reg_name").val());
	if(rn==""){
		switch(getLan()){
			case 0:
			alert("الرجاء إدخال اسم المستخدم");
			break
			case 1:
			alert("Please fill in user name");
			break
		}
		return false;
	}
	/*if(!isName(rn)){
		switch(getLan()){
			case 0:
			alert("请用字母，数字，下划线的组合，必须以字母开头");
			break
			case 1:
			alert("Please use letters, numbers, underscores the combination, you must start with a letter");
			break
		}
		return false;
	}*/
	if(getLength(rn)<4){
		switch(getLan()){
			case 0:
			alert("اسم المستخدم طول لا يقل عن أربعة");
			break
			case 1:
			alert("User Name minimum length 4 characters");
			break
		}
		return false;
	}
	checkUser(rn);
	$("#isck").val("true");
}
