Well, your menu and javascript are in the browser. Your ClearFile procedure is in the server. Your menu item is trying to make an AJAX call to the server. The server is confused.
Attached may give you some ideas. Not saying it's the best way, but it's an approach.
changed the action on your menu item.
added 5 lines of code to the PageHeaderTag procedure
added your ClearFile procedure to the Calls list for PageHeaderTag
and I changed ClearFile to use regular Open and Close statements, rather than file manager. Emptying a file requires exclusive access. In a real-world multi-user environment you'd need to do something more robust to make sure that any other people who had that file open were dealt with.
HTH,
Jane