handy trick from http://www.sitepoint.com/call-javascript-function-string-without-using-eval/ to avoid some if's