fix dajax when minified
pass the correct variables to included templates

These all look like they're included from other places, so until we
can refactor those as well we'll just have to define the variables
that they want to access. Fortunately, we can do this without adding
global variables by using 'with' blocks.