This is a useful blog article I came across explaining how to run your own JScript code before the standard Save and Close event runs. Useful for performing your own validation routines. I use it to check a load of percentage fields all add up to a total of 100%.

microsoft sharepoint server tutorials: easier way to insert custom action before "save and close" event