You can check if a function exists when declaring a function, but you must change the way it works.
instead
function foo(){ something }
do
if(window.foo===undefined){
window.foo=function(){ something }
}
and you can still call him
foo();
find & replace, regexp, :)