Sounds like a job for a wrapper function to me.
Write a function that calls the other function, and put your code at the end of that (or wherever). Then always call your version instead.
Sort of an adapter pattern. http://en.wikipedia.org/wiki/Adapter_pattern
I believe you can hide the scope of the original function and name yours the same if you cannot modify calling code (doesn't work on some intrinsic functions like alert, but should work for library code). If that isn't an option, see if prototype will let you extend the object to add the functionality. http://phrogz.net/js/classes/ExtendingJavaScriptObjectsAndClasses.html
//Only add this implementation if one does not already exist.
if (Array.prototype.slice==null) Array.prototype.slice=function(start,end){
if (start<0) start=this.length+start; //'this' refers to the object to which the prototype is applied
if (end==null) end=this.length;
else if (end<0) end=this.length+end;
var newArray=[];
for (var ct=0,i=start;i<end;i++) newArray[ct++]=this[i];
return newArray;
}
For arguments, you can also make your version take optional arguments (similar to jQuery / MooTools) and then look at what was passed.
Examples of optional arguments here.
http://www.openjs.com/articles/optional_function_arguments.php
function accident() {
for( var i = 0; i < arguments.length; i++ ) {
alert("This accident was caused by " + arguments[i]);
}
}