var copyright="zzbaivong - devs.forumvi.com";$(function(){function a(c,a){var e="check-square";"success"!=c&&(e="exclamation-triangle");$("#reg_tip").html('<p class="'+c+'"><i class="fa fa-'+e+' fa-1"></i> '+a+"</p>")}function d(a){$("#"+a).addClass("error");$("#zzRegFancy input").attr("disabled",!1)}"/login"!=location.pathname?$("a[href^='/login']").click(function(a){a.preventDefault();$('#zzLoginFancy input[name="redirect"]').val(location.pathname);$.fancybox("#zzLoginFancy",{closeBtn:!1,openEffect:"elastic",closeEffect:"elastic",wrapCSS:"zzForm"})}):$("#zzLoginFancy").remove();"/register"!=location.pathname?($("a[href='/register']").click(function(a){a.preventDefault();$.fancybox("#zzRegFancy",{closeBtn:!1,openEffect:"elastic",closeEffect:"elastic",wrapCSS:"zzForm"})}),$("#zzRegFancy input[name='reset']").click(function(){a("","B\u1ea1n ph\u1ea3i \u0111i\u1ec1n \u0111\u1ea7y \u0111\u1ee7 th\u00f4ng tin \u0111\u0103ng k\u00fd!");$("#zzRegFancy input").removeClass("error")}),$("#zzRegFancy").on("focus",".form_input_field",function(){$(this).removeClass("error")}),$("#zzRegFancy").submit(function(c){c.preventDefault();a("info","\u0110ang ki\u1ec3m tra d\u1eef li\u1ec7u...");$("#zzRegFancy input").attr("disabled",!0);$.ajax({type:"POST",url:"/register?agreed=true&step=2",data:{username:$("#username_reg").val(),email:$("#email").val(),password:$("#password_reg").val(),submit:"Save"},success:function(b){if($(b).find("p.message").length)a("info","Qu\u1ea3n tr\u1ecb vi\u00ean \u0111\u00e3 gi\u1edbi h\u1ea1n s\u1ed1 l\u1ea7n t\u1ea1o t\u00e0i kho\u1ea3n h\u00f4m nay."),$("#zzRegFancy .box-content").hide();else if(a("info","\u0110ang ki\u1ec3m tra t\u00e0i kho\u1ea3n, m\u1eadt kh\u1ea9u..."),$(b).find("#form_confirm").length)$("#regHiddenData").empty(),$(b).find("input[name='confirm_pass'], input[name='auth[]']").prependTo("#regHiddenData"),a("info","\u0110ang ki\u1ec3m tra E-mail..."),$.ajax({type:"POST",url:"/register?agreed=true&step=2",data:{password_confirm:$("#password_reg").val(),"auth[]":$("#regHiddenData input[name='auth[]']:first").val(),username:$("#username_reg").val(),email:$("#email").val(),password:$("#password_reg").val(),confirm_pass:$("#regHiddenData input[name='confirm_pass']").val(),submit:"Save"},success:function(b){if($(b).find("div.msg a").length)a("info","\u0110\u0103ng k\u00fd th\u00e0nh c\u00f4ng."),$.ajax({type:"POST",url:"/login",data:{username:$("#username_reg").val(),password:$("#password_reg").val(),login:"true"},success:function(){window.location.reload()}});else if(-1!==$(b).find(".box-content.error:first span").text().indexOf("e-mail address")||-1!==$(b).find(".box-content.error:first span").text().indexOf("\u0111\u1ecba ch\u1ec9 email"))a("error","\u0110\u1ecba ch\u1ec9 E-mail kh\u00f4ng h\u1ee3p l\u1ec7 ho\u1eb7c \u0111\u00e3 \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng."),d("email")}});else if(-1!==$(b).find(".box-content.error").text().indexOf("username has")||-1!==$(b).find(".box-content.error").text().indexOf("\u00ean truy c\u1eadp"))a("error","T\u00e0i kho\u1ea3n \u0111\u00e3 \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng ho\u1eb7c b\u1ecb c\u1ea5m."),d("username_reg");else if(0===$(b).find(".box-content.error").text().indexOf("Your password")||0===$(b).find(".box-content.error").text().indexOf("M\u1eadt kh\u1ea9u"))a("error","M\u1eadt kh\u1ea9u ph\u1ea3i t\u1eeb 6 - 32 k\u00fd t\u1ef1 v\u00e0 kh\u00f4ng \u0111\u01b0\u1ee3c tr\u00f9ng t\u00e0i kho\u1ea3n."),d("password_reg")}})})):$("#zzRegFancy").remove();$(".closeQuickForm").click(function(){$.fancybox.close()})});