$(function(){$("#dialog-confirm-user-delete").dialog({modal:true,autoOpen:false,closeOnEscape:false,width:550,position:["center","center"],draggable:false,resizable:false,open:function(){$("#btn-confirm-user-delete-ok").blur()},buttons:[{text:"Yes. Delete this user",id:"btn-confirm-user-delete-ok","class":"bb_button bb_small bb_green",click:function(){$("#btn-confirm-user-delete-ok").prop("disabled",true);$("#btn-confirm-user-delete-cancel").hide();$("#btn-confirm-user-delete-ok").text("Deleting...");$("#btn-confirm-user-delete-ok").after("<div class='small_loader_box'><img src='images/loader_small_grey.gif' /></div>");var a=$("#vu_details").data("userid");var b=[{name:"entry_"+a,value:"1"}];$.ajax({type:"POST",async:true,url:"change_user_status.php",data:{action:"delete",origin:"view_user",selected_users:b},cache:false,global:false,dataType:"json",error:function(f,c,d){},success:function(c){if(c.status=="ok"){if(c.user_id!="0"&&c.user_id!=""){window.location.replace("view_user.php?id="+c.user_id)}else{window.location.replace("manage_users.php")}}}})}},{text:"Cancel",id:"btn-confirm-entry-delete-cancel","class":"btn_secondary_action",click:function(){$(this).dialog("close")}}]});$("#vu_action_delete").click(function(){$("#dialog-confirm-user-delete").dialog("open");return false});$("#vu_action_suspend").click(function(){if($(this).data("processing")!==true){$(this).data("processing",true);if($(this).hasClass("unsuspend")){$(this).removeClass("unsuspend").append(' <img src="images/loader_small_grey.gif" style="vertical-align: middle" />');var a=$("#vu_details").data("userid");var b=[{name:"entry_"+a,value:"1"}];$.ajax({type:"POST",async:true,url:"change_user_status.php",data:{action:"unsuspend",selected_users:b},cache:false,global:false,dataType:"json",error:function(f,c,d){},success:function(c){if(c.status=="ok"){$("#vu_action_suspend").data("processing",false);$("#vu_action_suspend").html("Suspend");$("#vu_suspended").fadeOut(function(){$(this).remove()})}}})}else{$(this).addClass("unsuspend").append(' <img src="images/loader_small_grey.gif" style="vertical-align: middle" />');var a=$("#vu_details").data("userid");var b=[{name:"entry_"+a,value:"1"}];$.ajax({type:"POST",async:true,url:"change_user_status.php",data:{action:"suspend",no_session_msg:"1",selected_users:b},cache:false,global:false,dataType:"json",error:function(f,c,d){},success:function(c){if(c.status=="ok"){$("#vu_action_suspend").data("processing",false);$("#vu_action_suspend").html("Unblock");$("#vu_profile").append('<div id="vu_suspended" style="display: none">This user is currently being <span>SUSPENDED</span></div>');$("#vu_suspended").fadeIn()}}})}}return false});$("#dialog-change-password").dialog({modal:true,autoOpen:false,closeOnEscape:false,width:400,position:["center","center"],draggable:false,resizable:false,buttons:[{text:"Save Password",id:"dialog-change-password-btn-save-changes","class":"bb_button bb_small bb_green",click:function(){var b=$.trim($("#dialog-change-password-input1").val());var a=$.trim($("#dialog-change-password-input2").val());var c=$("#vu_details").data("userid");var d=0;if($("#dialog-change-password-send-login").prop("checked")==true){d=1}if(b==""||a==""){alert("Please enter both password fields!")}else{if(b!=a){alert("Please enter the same password for both fields!")}else{$("#dialog-change-password-btn-save-changes").prop("disabled",true);$("#dialog-change-password-btn-cancel").hide();$("#dialog-change-password-btn-save-changes").text("Saving...");$("#dialog-change-password-btn-save-changes").after("<div class='small_loader_box'><img src='images/loader_small_grey.gif' /></div>");$.ajax({type:"POST",async:true,url:"change_password.php",data:{np:b,user_id:c,send_login:d},cache:false,global:false,dataType:"json",error:function(h,f,g){alert("Unable to save the password!");$(this).dialog("close")},success:function(e){$("#dialog-change-password").dialog("close");$("#dialog-change-password-btn-save-changes").prop("disabled",false);$("#dialog-change-password-btn-cancel").show();$("#dialog-change-password-btn-save-changes").text("Save Password");$("#dialog-change-password-btn-save-changes").next().remove();$("#dialog-change-password-input1").val("");$("#dialog-change-password-input2").val("");$("#dialog-change-password-send-login").prop("checked",false);if(e.status=="ok"){$("#dialog-password-changed").dialog("open")}}})}}}},{text:"Cancel",id:"dialog-change-password-btn-cancel","class":"btn_secondary_action",click:function(){$(this).dialog("close")}}]});$("#vu_action_password").click(function(){$("#dialog-change-password").dialog("open");return false});$("#dialog-password-changed").dialog({modal:true,autoOpen:false,closeOnEscape:false,width:400,position:["center","center"],draggable:false,resizable:false,buttons:[{text:"OK",id:"dialog-password-changed-btn-ok","class":"bb_button bb_small bb_green",click:function(){$(this).dialog("close")}}]})});