"use strict";var staff_status=new function(){this.max_call_age=0;this.max_call_age_timers={}};staff_status.init=function(portlet_id){if($("#"+portlet_id+" .portlet-content").hasClass("initialized")){return}var uid="a"+$.getUID(14);$("#"+portlet_id).addClass(uid);$("#"+portlet_id+" .portlet-content").addClass("initialized");$("#"+portlet_id).find("span.update").closest("a").click()};staff_status.refresh=function(portlet_id,force,uid,staff_id,disconnected){force=typeof force!=="undefined"?force:false;uid=typeof uid!=="undefined"?uid:false;staff_id=typeof staff_id!=="undefined"?staff_id:false;disconnected=typeof disconnected!=="undefined"?disconnected:null;if($("#"+portlet_id).length===0||!$("#"+portlet_id).is(":visible")||uid&&!$("#"+portlet_id).hasClass(uid)){return false}staff_status.refresh_do(staff_id,disconnected,portlet_id);return true};staff_status.refresh_do=function(staff_id,disconnected,portlet_id){portlet_id=typeof portlet_id!=="undefined"?portlet_id:false;staff_id=typeof staff_id!=="undefined"?staff_id:false;disconnected=typeof disconnected!=="undefined"?disconnected:null;if(staff_id){if(disconnected===true){staff_status._toggle_call_icon(staff_id,"disconnected_wait");staff_status.max_call_age_timers[staff_id]=window.setTimeout(staff_status._toggle_call_icon,staff_status.max_call_age*60*1e3,staff_id,"disconnected")}else{staff_status._toggle_call_icon(staff_id,"connected")}}else if(portlet_id){$("#"+portlet_id+" form span.update").parent("a").click()}else{$("div.portlet").filter(function(){return this.id.match(/Staff_status___/)}).find("form span.update").parent("a").click()}};staff_status._toggle_call_icon=function(staff_id,status){var elem_connected=$("div").filter(function(){return this.id.match(/staff_status_.+__form_data/)}).find("tr.staff_id_"+staff_id).find("span.call_2d").closest("div");var elem_disconnected_wait=$("div").filter(function(){return this.id.match(/staff_status_.+__form_data/)}).find("tr.staff_id_"+staff_id).find("span.call_end_2d").closest("div");switch(status){case"connected":window.clearTimeout(staff_status.max_call_age_timers[staff_id]);$(elem_connected).show();$(elem_disconnected_wait).hide();break;case"disconnected_wait":$(elem_connected).hide();$(elem_disconnected_wait).show();break;case"disconnected":window.clearTimeout(staff_status.max_call_age_timers[staff_id]);$(elem_connected).hide();$(elem_disconnected_wait).hide();break;default:}};