I am trying to add a simple JS random image script to the header.tpl. Basically, I want pages to display one of several images randomly in the header. The problem is that I get a script error:
Fatal error: Smarty error: [in header.tpl line 34]: syntax error: unrecognized tag 'var' (Smarty_Compiler.class.php, line 590) in /home/eskillet/public_html/include/smarty/libs/Smarty.class.php on line 1095
Here is what I am adding to the tpl file. I add the following to the <head> section:
<script type="text/javascript" language="JavaScript">
<!-- Copyright 2002 Bontrager Connection, LLC
//
// Type the number of images you are rotating.

NumberOfImagesToRotate = 15;

// Specify the first and last part of the image tag.

FirstPart = '<img src="{$baseurl}/templates/assets/headerimage';
LastPart = '.jpg" height="520" width="280">';

function printImage() {
var r = Math.ceil(Math.random() * NumberOfImagesToRotate);
document.write(FirstPart + r + LastPart);
}
//-->
</script>
and the following in the <body> section:
<script type="text/javascript" language="JavaScript"><!--
printImage();
//--></script>
Is there any solution to this?

As well, I see that the header.tpl file applies to all pages. Is there any way to display a specific image in the header of a specific sub page? What I would like to do, ideally, is randomly display header images on the home page, but then display a specific header image in specific sub pages since they will be relevant to the page content.

Vito