Perhaps instead of using the File / Save and File / SaveAs menu options, you could disable those and add your own save / save as buttons. That way you would know what the user is trying to do.
Not sure about jscript, but in C# for IP 2003, for example:
//save as newfile.xml
SaveFileDialog saveDialog = new SaveFileDialog();
saveDialog.FileName = "newfile.xml";
saveDialog.DefaultExt = ".xml";
saveDialog.Title = "Save newfile.xml";
if (saveDialog.ShowDialog() == DialogResult.OK)
{
mapping.Save(saveDialog.FileName);
}
You can look into SaveFileDialog at MSDN