(function(j){var h=window.FileManager||window.ImageManager,f=window.FileManager?"fm":"im";h.addSpecialFolder({title:"{#favorites.special_folder_title}",path:"favorite:///",type:"favorites"});j().bind("DropMenu:beforeshow",function(a,b){if(h.path.indexOf("://")==-1){b.addSeparator();b.add({title:j.translate("{#favorites.addfavorites}"),disabled:h.isDisabled("addfavorites")||!h.selectedFiles.length,onclick:g})}if(h.path.indexOf("favorite://")!=-1){b.addSeparator();b.add({title:j.translate("{#favorites.removefavorites}"),disabled:h.isDisabled("removefavorites")||!h.selectedFiles.length,onclick:i})}});j().bind("filelist:changed",function(){if(h.path.indexOf("favorite://")!=-1){j(h.tools).each(function(a,b){h.setDisabled(b,1)})}});function g(){var a={};j(h.selectedFiles).each(function(c,b){a["path"+c]=b.path});RPC.exec(f+".addFavorites",a,function(b){RPC.handleError({message:"{#error.addfavorites_failed}",visual_path:a.visual_path,response:b})})}function i(){var a={};j(h.selectedFiles).each(function(c,b){a["path"+c]=b.path});RPC.exec(f+".removeFavorites",a,function(b){if(!RPC.handleError({message:"{#error.removefavorites_failed}",visual_path:a.visual_path,response:b})){h.listFiles()}})}})(jQuery);