fires before the mode of viewing files is changed on clicking the Modes button
$$("fmanager").attachEvent("onBeforeModeChange", function(){ // your code return true; });