Test for and run a dynamically named javascript function

Sometime in the world of dynamic coding,  you need the ability to dynamically create and run javascript functions depending on whether the javascript function is defined on the page. (so i can run different code depending on the context)

function email_action(action,obj)
 var functionname='email_action_'+action
 var t = setTimeout('alert("invalid function name: "'+functionname+'" n Cannot run email action: "'+action+')',100)
 if (typeof(eval(functionname))!= 'function') 
 var func = eval(functionname)