You should use “widget” mechanism, add file to widgets folder templates\{your_template}\widgets and load it with:
<?php _widget('custom_javascript');?>
Example can be found in property.php template file
Some guide is also available here:
http://geniuscript.com/wbooking/user_guide_theme/#!/add_pages