$(function(){$("#admin_forgot").bind("change",function(){if($(this).prop("checked")==true){$("#li_password,#li_remember_me").slideUp("slow",function(){$("#submit_button").html('<img src="images/icons/key_go.png" alt="Reset Password"/> Reset My Password')})}else{$("#li_password,#li_remember_me").slideDown("slow",function(){$("#submit_button").html('<img src="images/icons/tick.png" alt="Sign In"/> Sign In')})}});$("#form_login").submit(function(){if($("#admin_forgot").prop("checked")==true){if($("#admin_username").val().trim()==""){alert("Please enter your email address!")}else{var a=$("#admin_username").val().trim();$("#submit_button").after("<div class='forgot_password_loader'><img src='images/loader_small_grey.gif' /></div>");$("#submit_button").html('<img src="images/icons/key_go.png" alt="Reset Password"/> Sending...');$("#submit_button").prop("disabled",true);$("#admin_forgot").prop("disabled",true);$.ajax({type:"POST",async:true,url:"reset_password.php",data:{target_email:a},cache:false,global:false,dataType:"json",error:function(d,b,c){$(".forgot_password_loader").remove();$("#submit_button").html('<img src="images/icons/key_go.png" alt="Reset Password"/> Reset My Password');$("#submit_button").prop("disabled",false);$("#admin_forgot").prop("disabled",false);$("#ui-dialog-title-dialog-login-page").text("Error!");$("#dialog-login-page-msg").html("Unable to send new password. Error message:<br/><br/>"+d.responseText);$("#dialog-login-page img").attr("src","images/icons/warning.png");$("#dialog-login-page").dialog("open")},success:function(b){$(".forgot_password_loader").remove();$("#submit_button").html('<img src="images/icons/key_go.png" alt="Reset Password"/> Reset My Password');$("#submit_button").prop("disabled",false);$("#admin_forgot").prop("disabled",false);if(b.status=="ok"){$("#ui-dialog-title-dialog-login-page").text("Password sent!");$("#dialog-login-page-msg").text(b.message);$("#dialog-login-page img").attr("src","images/icons/62_green_48.png")}else{$("#ui-dialog-title-dialog-login-page").text("Error!");$("#dialog-login-page-msg").text(b.message);$("#dialog-login-page img").attr("src","images/icons/warning.png")}$("#dialog-login-page").dialog("open")}})}return false}else{return true}});$("#dialog-login-page").dialog({modal:true,autoOpen:false,closeOnEscape:false,width:400,position:["center",175],draggable:false,resizable:false,buttons:[{text:"OK",id:"dialog-entry-sent-btn-ok","class":"bb_button bb_small bb_green",click:function(){$(this).dialog("close");$("#li_password,#li_remember_me").slideDown("slow",function(){$("#submit_button").html('<img src="images/icons/tick.png" alt="Sign In"/> Sign In');$("#admin_password").val("").focus();$("#admin_forgot").prop("checked",false)})}}]})});