(function($){
	var defaults={
	};
	$.fn.getVnum = function(){
		
		var self = $(this);
		var time = 0;
		self.bind("click",function(){
			var kind = $("#kind").val();
			var telno = $("#telno").val();
			var yztelno = $("#yztelno").val();
			var security_key_2 = $("#security_key_2").val();
			var security_num = $("#security_num").val();
			var security_key = $("#security_key").val();
			//alert(security_key_2);
			if(time == 0)
			{
				var partten = /^1[0-9]{10}$/;//手机号码
				if(partten.test(telno))
				{
					$.post('http://user.house365.com/register/forget_getyzm',{act:'getyzm',telno:telno,kind:kind,yztelno:yztelno,security_key:security_key_2},
						function(data){
							if(data == '1'){
								time = 60;
								var oTime = null;
								self.val('重新获取('+time+')');
								self.css({"color":"#999"});
								oTime = setInterval(function(){if(time>0){time--;self.val('重新获取('+time+')');}else{clearInterval(oTime);self.val('获取验证码');self.css({"color":"#000"});$('#sendingnote').hide();}} ,1000);
							}else if(data == '2'){
								 $('#orderhouse_validcode').html('验证码获取失败，请刷新页面重新获取。').show();
							}else if(data == '4'){
                                 $('#orderhouse_validcode').html("今日操作已超过4次，请明日再来。").show();
							}else if(data == '6'){
                                 $("#js_errorBox1").removeClass("Validform_checktip Validform_right").addClass("Validform_checktip Validform_wrong")
		            		     $("#js_errorBox1").html("您的手机号码未注册过，请直接注册。");
							}else if(data == '7'){
                                 $("#js_errorBox1").removeClass("Validform_checktip Validform_right").addClass("Validform_checktip Validform_wrong")
		            		     $("#js_errorBox1").html("您的操作过于频繁，请稍后再试");
							}else if(data == '400'){
                                 $("#js_errorBox1").removeClass("Validform_checktip Validform_right").addClass("Validform_checktip Validform_wrong")
		            		     $("#js_errorBox1").html("页面参数错误，请刷新后再试");
							}
						}
					);
				}
				else
				{
					    $("#js_errorBox1").empty();
                        $("#js_errorBox1").removeClass("Validform_checktip Validform_right").addClass("Validform_checktip Validform_wrong")
		            	$("#js_errorBox1").html("请输入正确的手机号码。");
				}
			}
		})
	}

	$.fn.getVnumUcenter = function(){
		var self = $(this);
		var time = 0;
		self.bind("click",function(){
			var kind = $("#kind").val();
			var telno = $("#telno").val();
			var yztelno = $("#yztelno").val();
			var security_key_2 = $("#security_key_2").val();
			var security_num = $("#security_num").val();
			var security_key = $("#security_key").val();
			//alert(security_key_2);
			if(time == 0)
			{
				var partten = /^1[0-9]{10}$/;//手机号码
				if(partten.test(telno))
				{
					$.post('http://user.house365.com/register/forget_getyzm_ucenter',{act:'getyzm',telno:telno,kind:kind,yztelno:yztelno,security_key:security_key_2},
						function(data){
							if(data == '1'){
								time = 60;
								var oTime = null;
								self.val('重新获取('+time+')');
								self.css({"color":"#999"});
								oTime = setInterval(function(){if(time>0){time--;self.val('重新获取('+time+')');}else{clearInterval(oTime);self.val('获取验证码');self.css({"color":"#000"});$('#sendingnote').hide();}} ,1000);
							}else if(data == '2'){
								$('#orderhouse_validcode').html('验证码获取失败，请刷新页面重新获取。').show();
							}else if(data == '4'){
								$('#orderhouse_validcode').html("今日操作已超过4次，请明日再来。").show();
							}else if(data == '6'){
								$("#js_errorBox1").removeClass("Validform_checktip Validform_right").addClass("Validform_checktip Validform_wrong")
								$("#js_errorBox1").html("您的手机号码未注册过，请直接注册。");
							}else if(data == '7'){
								$("#js_errorBox1").removeClass("Validform_checktip Validform_right").addClass("Validform_checktip Validform_wrong")
								$("#js_errorBox1").html("您的操作过于频繁，请稍后再试");
							}else if(data == '400'){
								$("#js_errorBox1").removeClass("Validform_checktip Validform_right").addClass("Validform_checktip Validform_wrong")
								$("#js_errorBox1").html("页面参数错误，请刷新后再试");
							}
						}
					);
				}
				else
				{
					$("#js_errorBox1").empty();
					$("#js_errorBox1").removeClass("Validform_checktip Validform_right").addClass("Validform_checktip Validform_wrong")
					$("#js_errorBox1").html("请输入正确的手机号码。");
				}
			}
		})
	}
})(jQuery);
