function chkSignUpPhone(language)
{
if(checkIsRead(language))
{
if(checkPhone(language,0))
{
if(chkPhoneYzm(language))
{
if(checkUserPwd(language))
{
if(checkUserPwdCfm(language))
{
$("#submitBTN")[0].disabled = true;
return true;
}
}
}
}
}
return false;
}
function chkSignUp(language)
{
if(checkIsRead(language)){
if(chkUserEmail(language,0)){
if(checkUserName(language,0)){
if(checkUserPwd(language)){
if(checkUserPwdCfm(language)){
if(checkVerifyCode(language,'')){
$("#submitBTN")[0].disabled = true;
return true;
}
}
}
}
}
}
return false;
}
function showObj( objID )
{
$(objID).show();
$("#notice_"+objID).show();
if(objID == 'useremail')
{
clearMsg( 'useremail' );
$("#floatboxemail").show();
}
if(objID =='username'){
clearMsg('username');
$("#floatboxusername").show();
}
if(objID == 'userpwdcfm')
{
clearMsg( 'userpwdcfm' );
$("#floatboxpwd").hide();
}
if(objID == 'captcha')
{
clearMsg( 'captcha' );
$("#floatboxpwd").hide();
}
if(objID == 'userpwd')
{
clearMsg( 'userpwd' );
//clearMsg( 'userpwdcfm' );
var str1 = $("#userpwd")[0].value ;
$("#userpwd")[0].value = '';
var str = $("#userpwd")[0].value;
pwStrength(str);
if(str1 != '')
{
var language=$.trim($("#language")[0].value);
if(language == 'EN')
{
document.getElementById("notice_userpwd").innerHTML = 'Password must be between 6 to 16 characters,
and include at least two of followings:letters,
numbers and symbols. Case sensitive';
}
else
{
document.getElementById("notice_userpwd").innerHTML = '密码设置至少6-16位,数字、字母或常用符号至少
包含2种组合,且字母区分大小写';
}
}
if(language != 'EN') $('#userpwd_notice3').css("width","380px");
$("#userpwdcfm")[0].value = '';
$("#floatboxpassword").show();
$("#floatboxpwd").hide();
}
if(objID == 'alitalk')
{
$("#error_"+objID).hide();
$("#errorMsg_"+objID).hide();
$("#download_alitalk").show();
}
if(objID == 'qqid')
{
$("#"+objID+"_ok").hide();
$("#error_"+objID).hide();
$("#errorMsg_"+objID).hide();
$("#download_qqid").show();
$("#register_qqid").show();
}
}
function checkIsRead(language)
{
if($("#isread")[0].checked == false)
{
if(language == 'EN')
{
$("#errorMsg_isread").html('Please check this box.');
}
else
{
$("#errorMsg_isread").html('请勾选此项');
}
$("#error_isread").show();
return false;
}
else
{
$("#error_isread").hide();
return true;
}
}
function checkqq(language,ajax,DOMAIN_MY)
{
var result='';
var ajax = (arguments[1] == 0)?arguments[1]:1;
var DOMAIN_MY = (arguments[2]!='')?arguments[2]:'';
var qqidstr = $.trim($("#qqid")[0].value);
//$("#register_qqid").hide();
//$("#download_qqid").hide();
if(qqidstr == '')
{
//$("#notice_qqid").hide();
//$("#register_qqid").show();
//$("#download_qqid").show();
return true;
}
qqidtmp = qqidstr.replace(/[^\x00-\xff]/g,"**");
if(qqidtmp.length > 20)
{
clearMsg( 'qqid' );
$("#error_qqid").show();
if(language == 'EN')
{
$("#errorMsg_qqid").html('Your QQ ID should not have more than 20 characters!');
}
else
{
$("#errorMsg_qqid").html('QQ号长度不能超过20位 ');
}
//$("#register_qqid").hide();
//$("#download_qqid").hide();
$("#errorMsg_qqid").show();
return false;
}
if(ajax == 1 && qqidstr != '')
{
$.post(DOMAIN_MY+"/my/in/checkinfo.php", { type: "qqid", value: qqidstr } , function(result){
if(result == 1)
{
clearMsg( 'qqid' );
$("#error_qqid").show();
if(language == 'EN')
{
$("#errorMsg_qqid").html('This QQ ID is not available.Try again.');
}else
{
$("#errorMsg_qqid").html('QQ号已使用过 ');
}
//$("#register_qqid").hide();
//$("#download_qqid").hide();
$("#errorMsg_qqid").show();
return false;
}else
{
clearMsg( 'qqid' );
$("#qqid_ok").show();
return true;
}
});
}
}
function chkUserEmail(language,ajax,DOMAIN_MY)
{
var ajax = (arguments[1]==0)?arguments[1]:1;
var DOMAIN_MY = (arguments[2]!='')?arguments[2]:'';
var str = $.trim($("#useremail")[0].value);
$("#notice_useremail").hide();
var psw = $.trim($("#userpwd")[0].value);
if( str.toLowerCase() == psw && psw != '' )
{
clearMsg( 'useremail' );
$("#floatboxemail").show();
$("#error_useremail").show();
if(language == 'EN')
{
$("#floatboxpassword").show();
$("#error_userpwd").show();
$("#errorMsg_userpwd").html('Password can not be with the username or email!');
$("#errorMsg_userpwd").show();
$("#userpwd_strength").hide();
$("#notice_userpwd").hide();
}
else
{
$("#floatboxpassword").show();
$("#error_userpwd").show();
$("#errorMsg_userpwd").html('密码与用户名/邮箱不能相同');
$("#errorMsg_userpwd").show();
$("#userpwd_strength").hide();
$("#notice_userpwd").hide();
if(language != 'EN') $('#userpwd_notice3').css("width","180px");
}
}
else if (psw != '')
{
checkUserPwd(language);
}
if( $.trim(str) == '' )
{
clearMsg( 'useremail' );
$("#floatboxemail").show();
$("#error_useremail").show();
if(language == 'EN')
{
$("#errorMsg_useremail").html('Please enter your email address!');
}
else
{
$("#errorMsg_useremail").html('请输入您的Email地址');
}
$("#errorMsg_useremail").show();
return false;
}
if( str.length > 100 )
{
clearMsg( 'useremail' );
$("#floatboxemail").show();
$("#error_useremail").show();
if(language == 'EN')
{
$("#errorMsg_useremail").html('Your email address should not have more than 100 characters!');
}
else
{
$("#errorMsg_useremail").html('Email地址长度不能超过100位');
}
$("#errorMsg_useremail").show();
return false;
}
str = str.toLowerCase();
if(isEmail(str) == false)
{
clearMsg( 'useremail' );
$("#floatboxemail").show();
$("#error_useremail").show();
if(language == 'EN')
{
$("#errorMsg_useremail").html('Please use correct email address!');
}
else
{
$("#errorMsg_useremail").html('Email书写不正确');
}
$("#errorMsg_useremail").show();
return false;
}
//ada insert 屏蔽雅虎邮箱 2013-6-27 start @yahoo.com.cn
var myreg = /^(([0-9a-zA-Z]+)|([0-9a-zA-Z]+[_.0-9a-zA-Z-]*))@yahoo.(\S)+$/;
if(myreg.test(str))
{
clearMsg( 'useremail' );
$("#floatboxemail").show();
$("#error_useremail").show();
if(language == 'EN')
{
$("#errorMsg_useremail").html( "Recommend that you do not use Yahoo Mail registration, Yahoo
Mail has stopped services." );
}
else
{
$("#errorMsg_useremail").html('建议您不要使用雅虎邮箱,雅虎邮箱已停止服务!');
}
$("#errorMsg_useremail").show();
return false;
}
//ada insert 屏蔽雅虎邮箱 2013-6-27 end
if(ajax == 1)
{
$.post(DOMAIN_MY+"/my/in/checkinfo.php", { type: "useremail", value: str } , function(result) {
if(result == 1)
{
clearMsg( 'useremail' );
$("#floatboxemail").show();
$("#error_useremail").show();
if(language == 'EN')
{
$("#errorMsg_useremail").html('This email is not available.Try again.');
}
else
{
$("#errorMsg_useremail").html('该Email已使用过或已被作为用户名使用。点此取回用户名和密码');
}
$("#errorMsg_useremail").show();
return false;
}
else
{
clearMsg( 'useremail' );
$("#floatboxemail").show();
$("#useremail_ok").show();
return true;
}
} );
}
return true;
}
function checkUserName(language,ajax,DOMAIN_MY)
{
var ajax = (arguments[1]==0)?arguments[1]:1;
var DOMAIN_MY = (arguments[2]==0)?arguments[2]:'';
var str = $.trim($("#username")[0].value);
var ismysingup = false;
var localhref = window.location.href;
if(localhref.indexOf('/my/My_SignUp.php') > 0 ){
ismysingup = true;
}
$("#notice_username").hide();
var psw = $.trim($("#userpwd")[0].value);
if( str.toLowerCase() == psw && psw != '' )
{
$("#floatboxusername").show();
$("#error_username").show();
if(language == 'EN')
{
$("#floatboxpassword").show();
$("#error_userpwd").show();
$("#errorMsg_userpwd").html('Password can not be with the username or email!');
$("#errorMsg_userpwd").show();
$("#userpwd_strength").hide();
$("#notice_userpwd").hide();
}
else
{
$("#floatboxpassword").show();
$("#error_userpwd").show();
$("#errorMsg_userpwd").html('密码与用户名/邮箱不能相同');
$("#errorMsg_userpwd").show();
$("#userpwd_strength").hide();
$("#notice_userpwd").hide();
$('#userpwd_notice3').css("width","180px");
}
}
else if(psw != ''){
checkUserPwd(language);
}
if( str == '' )
{
$("#floatboxusername").show();
$("#error_username").show();
if(language == 'EN')
{
$("#errorMsg_username").html('Please enter your member ID!');
}
else
{
$("#errorMsg_username").html('请输入用户名');
}
$("#errorMsg_username").show();
$("#username_ok").hide();
return false;
}
var regu = "^([0-9a-zA-Z]+[a-zA-Z]*)$";
var re = new RegExp( regu );
if( str.substr(0,1).search( re ) == -1 )
{
$("#floatboxusername").show();
$("#error_username").show();
if(language == 'EN')
{
$("#errorMsg_username").html('Please use correct member ID!');
}
else
{
$("#errorMsg_username").html('用户名须以字母或数字开头,至少4位');
}
$("#errorMsg_username").show();
$("#username_ok").hide();
return false;
}
var regu = "^([0-9a-zA-Z]+[_0-9a-zA-Z@.-]*)$"
var re = new RegExp(regu);
if( str.search( re ) == -1 )
{
$("#floatboxusername").show();
$("#error_username").show();
if(language == 'EN')
{
$("#errorMsg_username").html('Please use correct member ID!');
}
else
{
$("#errorMsg_username").html('请使用规范的用户名');
}
$("#errorMsg_username").show();
$("#username_ok").hide();
return false;
}
var sReg = /^(1[3456789]{1,1}[0-9]{9,9})$/;
if(sReg.test(str))
{
$("#floatboxusername").show();
$("#error_username").show();
if(language == 'EN')
{
$("#errorMsg_username").html('Please use correct member ID!');
}
else
{
if(ismysingup){
$("#errorMsg_username").html('系统判断您的用户名可能为手机号,建议您使用手机注册');
}else{
$("#errorMsg_username").html('用户名不能为手机号,建议手机号注册方式注册');
}
}
$("#errorMsg_username").show();
$("#username_ok").hide();
return false;
}
if( str.length < 4 )
{
$("#floatboxusername").show();
$("#error_username").show();
if(language == 'EN')
{
$("#errorMsg_username").html('Your member ID should have more than 3 characters!');
}
else
{
$("#errorMsg_username").html('用户名不合要求,必须大于3位');
}
$("#errorMsg_username").show();
$("#username_ok").hide();
return false;
}
if( str.length > 50 )
{
$("#floatboxusername").show();
$("#error_username").show();
if(language == 'EN')
{
$("#errorMsg_username").html('Your member ID should not have more than 50 characters!');
}
else
{
$("#errorMsg_username").html('用户名不合要求,不能超过50位');
}
$("#errorMsg_username").show();
$("#username_ok").hide();
return false;
}
if(ajax == 1)
{
$.post(DOMAIN_MY+"/my/in/checkinfo.php", { type: "username", value: str } , function(result) {
if(result == 1)
{
$("#floatboxusername").show();
$("#error_username").show();
if(language == 'EN')
{
$("#errorMsg_username").html('Member ID already exist!');
}
else
{
$("#errorMsg_username").html('用户名已使用过或者被作为email使用过。建议用Email作用户名');
}
$("#errorMsg_username").show();
$("#username_ok").hide();
return false;
}
else
{
$("#floatboxusername").show();
$("#username_ok").show();
$("#error_username").hide();
$("#errorMsg_username").hide();
return true;
}
} );
}
return true;
}
function checkCaptcha(){
var captcha=$.trim($('#captcha')[0].value);
if(captcha==''){
$('#captcha_ok').hide();
$('#error_captcha').show();
return false;
}
return true;
}
function checkVerifyCode(language,DOMAIN_MY){
var showtips = function(issucess,msg){
$("#floatverifycodebox").show();
if(issucess == false){
$("#verifycode_ok").hide();
$("#verifycode_error").show();
$("#errorMsg_verifycode").html(msg);
}else{
$("#verifycode_error").hide();
$("#errorMsg_verifycode").html(msg)
$("#verifycode_ok").show();
}
};
if(language=='EN'){
var tips = {
verifycode_no : 'please enter verify code',
verifycode_err : 'verify code error or has been expired'
};
}else{
var tips = {
verifycode_no : '请填写验证码',
verifycode_err : '验证码错误或已过期,看不清请换一张'
};
}
var verifycode = $.trim($("#verifycode")[0].value);
if(verifycode == ''){
showtips(false,tips['verifycode_no']);
return false;
}else{
var oldasync = $.ajaxSettings.async;
$.ajaxSettings.async = false;
var type = $('#verifyPic_img').attr('type');
var rt = new Object();
$.post(DOMAIN_MY+"/AjaxAction/check_verifycode.php", { type: type, verifycode: verifycode } , function(result){
rt = eval('(' + result + ')');;
});
$.ajaxSettings.async = oldasync;
if(rt.result == 1){
showtips(true,'');
return true;
}else{
showtips(false,tips['verifycode_err']);
}
}
return false;
}
function showPWdError(error_msg)
{
$("#floatboxpassword").show();
$("#error_userpwd").show();
$("#errorMsg_userpwd").html(error_msg);
$("#errorMsg_userpwd").show();
}
function getPwdLevel(password)
{
var chkResult = chkUpwdIsCorrect();
var pwdLevel = 'N';
if( chkResult == 0 ) //chkResult=0说明密码中数字,字母,特殊符号至少包含2种且长度在6-16
{
var re_num = /[0-9]+/g; //包含数字
var re_char = /[a-zA-Z]+/gi; //包含字母
var re_spchar = /[^0-9a-zA-Z]+/gi; //包含特殊字符
if(password.length > 5 && password.length < 11) //6-10 中或者低
{
if(re_num.test(password) && re_char.test(password) && re_spchar.test(password))
{
pwdLevel = 'M';
}else
{
pwdLevel = 'L';
}
}else if(password.length > 10 && password.length < 17) //11-16 中或者高
{
if(re_num.test(password) && re_char.test(password) && re_spchar.test(password))
{
pwdLevel = 'H';
}else
{
pwdLevel = 'M';
}
}
}
return pwdLevel;
}
function chkUpwdIsCorrect()
{
var chkResult = 0;
var str = $.trim($("#userpwd")[0].value);
if(str.length == '')
{
chkResult = 1;
}else if(str.length < 6 || str.length > 16)
{
chkResult = 2;
}else
{
//检查密码中是否输入ascii码在[0,32],[127-255]之间的字符,这2个区间的字符非法
var i,as_code;
for(i = 0; i < str.length; i++)
{
as_code = str.charCodeAt(i);
if(as_code < 33 || as_code > 126 )
{
chkResult = 3;
return chkResult;
}
}
//检查密码与用户名或者邮箱是否重复
var user_email = $.trim($("#useremail").val());
var user_name = $.trim($("#username").val());
if(str == user_email.toLowerCase() || str.toLowerCase() == user_name.toLowerCase())
{
chkResult = 4;
}else //检查密码是否单一类型
{
//单一数字,字母,特殊符号
var re_num = /^[0-9]+$/g;
var re_char = /^[a-zA-Z]+$/gi;
var re_spchar = /^[^0-9a-zA-Z]+$/gi;
if( re_num.test(str) || re_char.test(str) || re_spchar.test(str))
{
chkResult = 5;
}
}
}
return chkResult;
}
function checkUserPwd(language)
{
var error_msg = '';
var str = $.trim($("#userpwd")[0].value);
clearMsg( 'userpwd' );
$("#userpwd_strength").hide();
$("#notice_userpwd").hide();
$("#floatboxpwd").hide();
var chkResult = chkUpwdIsCorrect();
switch(chkResult)
{
case 1:
error_msg = language == 'EN' ? 'Please enter your password.' : '请输入密码';
if(language != 'EN') $('#userpwd_notice3').css("width","80px");
break;
case 2:
error_msg = language == 'EN' ? 'The passwords you entered do not match. Please re-enter them.' : '您的密码不符合要求,请重新输入。';
if(language != 'EN') $('#userpwd_notice3').css("width","220px");
break;
case 3:
error_msg = language == 'EN' ? 'The password can not contain special characters.' : '密码中不能含有特殊字符';
if(language != 'EN') $('#userpwd_notice3').css("width","160px");
break;
case 4:
error_msg = language == 'EN' ? 'Password can not be with the username or email.' : '密码与用户名/邮箱不能相同';
if(language != 'EN') $('#userpwd_notice3').css("width","180px");
break;
case 5:
error_msg = language == 'EN' ? 'The passwords you entered do not match. Please re-enter them.' : '您的密码不符合要求,请重新输入。';
if(language != 'EN') $('#userpwd_notice3').css("width","220px");
break;
default:
clearMsg( 'userpwdcfm' );
pwStrength(str);
return true;
}
showPWdError(error_msg);
return false;
}
function checkUserPwdCfm(language)
{
var userpwd = $.trim($("#userpwd")[0].value);
var userpwdcfm = $.trim($("#userpwdcfm")[0].value);
clearMsg( 'userpwdcfm' );
$("#floatboxpwd").show();
if( userpwdcfm == '' )
{
$("#error_userpwdcfm").show();
if(language == 'EN')
{
$("#errorMsg_userpwdcfm").html('Please confirm your password!');
}
else
{
$("#errorMsg_userpwdcfm").html('请输入您的重复密码');
}
$("#errorMsg_userpwdcfm").show();
return false;
}
if(userpwdcfm !== userpwd)
{
$("#floatboxpwd").show();
$("#error_userpwdcfm").show();
if(language == 'EN')
{
$("#errorMsg_userpwdcfm").html('Your passwords do not match!');
}
else
{
$("#errorMsg_userpwdcfm").html('密码重复不一致');
}
$("#errorMsg_userpwdcfm").show();
return false;
}
if(userpwdcfm != '') $("#userpwdcfm_ok").show();
return true;
}
function chkAlitalkId( language )
{
if(language=='EN') return true;
var alitalk = $.trim($("#alitalk")[0].value);
if( (alitalk == '') || (strlength(alitalk) >= 5 && strlength(alitalk) <= 20) )
{
return true;
}else{
$("#error_alitalk").show();
if(language == 'EN')
{
$("#errorMsg_alitalk").html('Wangwang ID is too long or too short!');
}
else
{
$("#errorMsg_alitalk").html('旺旺ID必须为5-20个字符!');
}
$("#errorMsg_alitalk").show();
$("#download_alitalk").hide();
return false;
}
}
//返回强度级别
function checkStrong(sPW){
if (sPW.length < 4)
{
//位数不够
return 0;
}
if (sPW.length == 4)
{
//长度等于4位,强度:低
return 1;
}
var level = 0;
if(hasCapital(sPW))
{
//有大写字母
level++;
}
if(hasLowercase(sPW))
{
//有小写字母
level++;
}
if(hasNumber(sPW))
{
//有数字
level++;
}
if(hasOther(sPW))
{
//有其他字符
level++;
}
if(level == 1)
{
//只有一种组合,强度:低
return 1;
}
else if(level == 2)
{
//只有两种组合,强度:中
return 2;
}
else if(level > 2)
{
//有三种或以上组合,强度:高
return 3;
}
}
//显示颜色
function pwStrength(pwd)
{
clearMsg( 'userpwd' );
$("#userpwd_strength").show();
var O_color="#eeeeee";
var L_color="#eb0027";
var M_color="#ffc200";
var H_color="#11b100";
var language=$.trim($("#language")[0].value);
$("#strength_L").css("color","#000000");
$("#strength_M").css("color","#000000");
$("#strength_H").css("color","#000000");
if (pwd==null||pwd==''){
Lcolor=Mcolor=Hcolor=O_color;
}
else{
S_level=getPwdLevel(pwd);
switch(S_level) {
case 'N':
Lcolor=Mcolor=Hcolor=O_color;
document.getElementById("notice_userpwd").innerHTML = '';
if(language != 'EN') $('#userpwd_notice3').css("width","110px");
break;
case 'L':
Lcolor=L_color;
Mcolor=Hcolor=O_color;
$("#strength_L").css("color","#ffffff");
document.getElementById("notice_userpwd").innerHTML = language == "EN" ? 'Your password is too simple' : '您的密码过于简单';
if(language != 'EN') $('#userpwd_notice3').css("width","210px");
break;
case 'M':
Lcolor=Mcolor=M_color;
Hcolor=O_color;
$("#strength_L").css("color","#ffffff");
$("#strength_M").css("color","#ffffff");
document.getElementById("notice_userpwd").innerHTML = language == "EN" ? 'Your password can be more complex' : '您的密码可以再复杂点';
if(language != 'EN') $('#userpwd_notice3').css("width","240px");
break;
case 'H':
Lcolor=Mcolor=Hcolor=H_color;
$("#strength_L").css("color","#ffffff");
$("#strength_M").css("color","#ffffff");
$("#strength_H").css("color","#ffffff");
document.getElementById("notice_userpwd").innerHTML = language == "EN" ? 'Your password is safe' : '您的密码很安全';
if(language != 'EN') $('#userpwd_notice3').css("width","200px");
break;
}
}
$("#notice_userpwd").show();
$("#strength_L").css("background",Lcolor);
$("#strength_M").css("background",Mcolor);
$("#strength_H").css("background",Hcolor);
return ;
}
function clearMsg( name )
{
$("#error_"+name).hide();
$("#errorMsg_"+name).hide();
$("#"+name+"_ok").hide();
}
//输入手机号的提示信息以及错误提示
function showPhoneMsg(msg,isErr)
{
if(isErr == 1)
{
//错误后的文案提示
$('#phone_ok').hide();
$('#phone_err').show();
$('#notice_phone').addClass('text_red');
$('#notice_phone').html(msg);
$('#notice_phone').show();
$('#floatbox_phone').show();
$('.phone_notice').css("height","29px");
}
if(isErr == 0){
//鼠标点击后的提示
$('#phone_ok').hide();
$('#phone_err').hide();
$('#notice_phone').removeClass('text_red');
$('#notice_phone').html(msg);
$('#notice_phone').show();
$('#floatbox_phone').show();
$('.phone_notice').css("width","auto");
$('.phone_notice').css("height","29px");
}
if(isErr == -1)
{//验证正确
$('#phone_ok').show();
$('#phone_err').hide();
$('#notice_phone').removeClass('text_red');
$('#notice_phone').html('');
$('#notice_phone').hide();
$('#floatbox_phone').show();
$('.phone_notice').css("width","auto");
$('.phone_notice').css("height","29px");
}
}
function checkPhone(language,ajax,DOMAIN_MY,imgpath)
{
var ajax = (arguments[1]==0)?arguments[1]:1;
var DOMAIN_MY = (arguments[2]!='')?arguments[2]:'';
var phoneNum = $.trim($('#userPhone').attr('value'));
if($.trim(phoneNum) == '')
{
if(language == 'CN'){
var errMsg = '请输入手机号';
}else{
$('.phone_notice').css("width","210px");
var errMsg = 'Please confirm your phone number';
}
showPhoneMsg(errMsg,1);
return false;
}
var objPhoneCheck = new mobileComponent();
if(objPhoneCheck.checkMobile(phoneNum,'086') <= 0)
{
if(language == 'CN'){
$('.phone_notice').css("width","160px");
var errMsg = '您输入的手机号格式有误';
}else{
$('.phone_notice').css("width","180px");
var errMsg = 'your phone number is error';
}
showPhoneMsg(errMsg,1);
return false;
}
if(ajax ==1)
{
//验证手机号是否已经被占用
$.post(DOMAIN_MY+"/my/in/checkinfo.php", { type: "mobilePhone", value: phoneNum } , function(result) {
if(result == 1){
clearTimeout(id_set_timeout);
if(language == 'CN'){
var loginUrl = DOMAIN_MY+"/my/My_SignIn.php";
var fandPWDUrl = DOMAIN_MY + '/my/My_ForgetPhone.php';
var errMsg = '此号码已存在,可直接登录或找回密码';
$('.phone_notice').css("width","270px");
showPhoneMsg(errMsg,1);
$('#btn').attr('value','发送验证码');
$('#btn').css('background',"url('"+imgpath+"/im/mobile_code/2014/send_img_h.gif')");
}else{
var loginUrl = DOMAIN_MY + '/emy/My_SignIn.php';
var fandPWDUrl = DOMAIN_MY + 'emy/My_ForgetPhone.php';
var errMsg = 'This number has already existed, you can log in directly or forget password';
$('.phone_notice').css("width","450px");
showPhoneMsg(errMsg,1);
$('#btn').attr('value','Send Code');
$('#btn').css('background',"url('"+imgpath+"/im/mobile_code/2014/btn-send-cr.gif')");
}
//发送验证码功能取消
document.getElementById("btn").onclick=function(){return false;};
return false;
}else{
if($('#btn').attr('value') == '发送验证码' || $('#btn').attr('value') == 'Send Code'){
$('#btn').attr('value','');
if(language == 'CN'){
$('#btn').css('background',"url('"+imgpath+"/im/mobile_code/2014/send_img.gif')");
}else{
$('#btn').css('background',"url('"+imgpath+"/im/mobile_code/2014/btn-send-e.gif')");
}
document.getElementById("btn").onclick=function(){sendVerifyCode(DOMAIN_MY,imgpath,language)}
}
showPhoneMsg('',-1)
return true;
}
})//end post
}
return true;
}
//手机验证码检测
function chkPhoneYzm(language)
{
var yzm = $('#yzm').attr('value');
if($.trim(yzm) == '')
{
if(language == 'CN'){
$('#errorMsg_yzm').html('请输入验证码');
}else{
$('.yzm_notice').css("width","230px");
$('#errorMsg_yzm').addClass('text_red');
$('#errorMsg_yzm').html('Please confirm your verification Code');
}
$('#floatbox_yzm').show();
return false;
}
else
{
$('#errorMsg_yzm').html('');
$('#floatbox_yzm').hide();
return true;
}
}
//发送验证图片记时功能
var wait=60;
var id_set_timeout = null;
function sendVerifytime(DOMAIN_MY,imgpath,language) {
var obj = $('#btn');
if (wait <= 0) {
$("#verifycodeli").css("height", "34px");
$("#mobiletips").show();
obj.attr('value','');
obj.css('background',"url('"+imgpath+"/im/mobile_code/2014/send_img.gif')");
document.getElementById("btn").onclick=function(){sendVerifyCode(DOMAIN_MY,imgpath,language);}
wait = 60;
} else {
document.getElementById("btn").onclick=function(){return false;};
if(language == 'CN'){
obj.attr('value',"重新发送(" + wait + ")");
}else{
obj.attr('value',"Resend (" + wait + ") s");
}
obj.css('background',"url('"+imgpath+"/im/mobile_code/2014/send_img_h.gif')");
wait--;
id_set_timeout = setTimeout(function() {
sendVerifytime(DOMAIN_MY,imgpath,language);
},
1000);
}
}
function showPicCodeTips(func,issucess , msgtype,language){
if(language=='EN'){
var tips = {
verifycode_no : { info:'please enter verify code',width:'160px'},
verifycode_err : { info:'verify code error or has been expired',width:'250px'}
};
}else{
var tips = {
verifycode_no : { info:'请填写验证码',width:'160px'},
verifycode_err : { info:'验证码错误或已过期,看不清请换一张',width:'220px'}
};
}
if(func == 'phonesignup'){
$("#floatverifycodebox").show();
if(issucess == false){
$("#verifycode_ok").hide();
$("#verifycode_error").show();
$("#errorMsg_verifycode").html(tips[msgtype]['info']);
$("#piccode_tips").css("width",tips[msgtype]['width']);
}else{
$("#verifycode_error").hide();
$("#verifycode_ok").show();
$("#errorMsg_verifycode").html('');
$("#piccode_tips").css("width","20px");
}
}
}
function chechPhonePicCode(language,DOMAIN_MY,ajax){
var verifycode = $.trim($("#verifycode")[0].value);
if(verifycode == ''){
showPicCodeTips('phonesignup',false,'verifycode_no',language);
return false;
}else{
if(ajax == 1){
var oldasync = $.ajaxSettings.async;
$.ajaxSettings.async = false;
var type = $('#verifyPic_img').attr('type');
var rt = new Object();
$.post(DOMAIN_MY+"/AjaxAction/check_verifycode.php", { type: type, verifycode: verifycode } , function(result){
rt = eval('(' + result + ')');;
});
$.ajaxSettings.async = oldasync;
if(rt.result == 1){
showPicCodeTips('phonesignup',true,'verifycode_no',language);
return true;
}else{
showPicCodeTips('phonesignup',false,'verifycode_err',language);
return false;
}
}else{
if($("#errorMsg_verifycode").html() == ''){
return true;
}
}
}
return false;
}
function sendVerifyCode(DOMAIN_MY,imgpath,language)
{
var phoneNum = $.trim($('#userPhone').attr('value'));
if(checkPhone(language,0))
{
if(chechPhonePicCode(language,DOMAIN_MY,0) == false){
return ;
}
var verifycode = $.trim($("#verifycode")[0].value);
sendVerifytime(DOMAIN_MY,imgpath,language);
//ajax 发送手机验证码短信
$.post(DOMAIN_MY+"/AjaxAction/mobile_code/send_mobile_code.php", { mobile: phoneNum, apptype: 4 ,piccode:verifycode} , function(result) {
result = eval('(' + result + ')');
if(result.status != 1){
//发送失败
if(result.status == -2)//发送次数或者间隔错误
{
if(language == 'CN'){
$('.phone_notice').css("width","360px");
showPhoneMsg(result.result,1);
}else{
$('.phone_notice').css("width","300px");
showPhoneMsg('The verification code can be sent 3 times one day and 5 minutes to send one more time',1);
$('.phone_notice').css("height","60px");
}
}
else if(result.status == -8){
if(language == 'CN'){
var loginUrl = DOMAIN_MY+"/my/My_SignIn.php";
var fandPWDUrl = DOMAIN_MY + '/my/My_ForgetPhone.php';
var errMsg = '此号码已存在,可直接登录或找回密码';
$('.phone_notice').css("width","270px");
showPhoneMsg(errMsg,1);
$('#btn').attr('value','发送验证码');
$('#btn').css('background',"url('"+imgpath+"/im/mobile_code/2014/send_img_h.gif')");
}else{
var loginUrl = DOMAIN_MY + '/emy/My_SignIn.php';
var fandPWDUrl = DOMAIN_MY + 'emy/My_ForgetPhone.php';
var errMsg = 'This number has already existed, you can log in directly or forget password';
$('.phone_notice').css("width","450px");
showPhoneMsg(errMsg,1);
$('#btn').attr('value','Send Code');
$('#btn').css('background',"url('"+imgpath+"/im/mobile_code/2014/btn-send-cr.gif')");
}
}else if(result.status == -21){
//验证码为空
var obj = $('#btn');
obj.attr('value','');
obj.css('background',"url('"+imgpath+"/im/mobile_code/2014/send_img.gif')");
wait = 0;
showPicCodeTips('phonesignup',false,'verifycode_no',language);
}else if(result.status == -22){
var obj = $('#btn');
obj.attr('value','');
obj.css('background',"url('"+imgpath+"/im/mobile_code/2014/send_img.gif')");
wait = 0;
showPicCodeTips('phonesignup',false,'verifycode_err',language);
}else {
if(language == 'CN'){
var errMsg = '操作失败';
}else{
var errMsg = 'fail to send phone code';
}
showPhoneMsg(errMsg,1);
}
}else{
//发送成功
if(language == 'CN'){
showPhoneMsg(result.result,0);
$('.phone_notice').css("width","190px");
}else{
showPhoneMsg('We have sended the code to your phone,please check your SMS',0);
$('.phone_notice').css("width","370px");
}
}
})// end post
}
}