$(function(){
	$("#get_pay_pwd").bind('click',function(){
		get_pay_pwd();
	});
});
function body_position(){
	var body = $('body').css("position");
	if(body=='relative'){
		$('body').css("position","");
	}
}
function get_pay_pwd(){
	var mobile = $("#mobile").val();
	if(mobile == null || mobile == ''){showtoast('手机号不能为空');body_position();return false;}
	var sms_reg_verify = $("#sms_reg_verify").val();
	if(sms_reg_verify == null || sms_reg_verify == ''){showtoast('验证码不能为空');body_position();return false;}
	var sms_code = $("#verify").val();
	if(sms_code == null || sms_code == ''){showtoast('短信验证码不能为空');body_position();return false;}
	
	var paypassword = $("#paypassword").val();var repaypassword = $("#confirm_paypwd").val();
	if(paypassword == null || repaypassword == null || paypassword == '' || repaypassword == ''){
		showtoast('密码或确认密码不能为空');body_position();return false;}
	if(!paypassword.match(/^[\w]{6,12}$/)){
		$("#paypassword").val('');showtoast('密码格式不正确');body_position();return false;}
	if(paypassword != repaypassword){
		$("#paypassword").val('');$("#confirm_pwd").val('');
		showtoast('两次密码不一致');body_position();return false;}
		
	var query = new Object();
	query.mobile = mobile;
	query.mobilecode = sms_code;
	query.paypassword = paypassword;
	query.repaypassword = repaypassword;
	query.mid = $("input[name='mid']").val();
	query.code = 'get_pay_pwd';
	$.ajax({
		url:APP+'mobile/Login/resetpwd',
		data:query,
		dataType:'json',
		success:function(obj){
			if(obj.status){
				showtoast('找回支付密码成功');body_position();
			}else{
				showtoast(obj.info);body_position();
			}
			if(obj.url){
				window.location.href = obj.url;
			}
		}
	});
}
