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($   <-- 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

<!-- nothing to see here -->

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

gahhh, tired