$(document).ready(function(){function e(a,g){f.html(""+_("error")+": "+a).addClass("ui-state-highlight").addClass("text-small");var c;switch(g){case 1:c=b;break;case 2:c=d}c.addClass("ui-state-error").focus()}$("#login").attr("iac").length&&$("#login").autocomplete({source:function(a,b){$.ajax({type:"POST",url:"modules/autocomplete.php",data:{term:a.term},dataType:"json",cache:!1,success:function(a){b(a)}})},delay:500});var b=$("#login"),d=$("#pass"),f=$("#validate_auth_msg");$("#auth_button").click(function(){b.removeClass("ui-state-error"); d.removeClass("ui-state-error");f.removeClass("ui-state-highlight").text("");$.ajax({async:!1,type:"POST",url:"modules/authorization.php",data:{action:"enter",login:b.val(),pass:d.val()},dataType:"json",cache:!1,success:function(a){a.code!=-1?e(a.msg,a.code):document.location.href="/"},error:function(){e(_("error_contact_developers"),-1)}});return!1})});