Velocity template code - please help if you can :D

I am doing some work in a java based cms called polopoly

I do not have much knowledge of vtl so I apologize if this is a stupid question

Does the following look okay?

#if($m.context.page.pathAfterPage.size())   <-- test that should check if the page the element is being displayed on is an article template and not an index page, not working though as this is firing as true on both articles and indexes.

<script type="text/javascript">
(function() {
... various gubbins here

</script>
#else
<!-- nothing to see here -->
#end

The direct html printing weirds me out a little as I am used to printing using either response.write or js equivalent.

http://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html#conditionals


gahhh, tired