Javascript works only in some pages

I don´t know if someone can answer this question here but I want to try.

I have a joomla site, for which I have created a calendar, it is built with javascript and php, there is also an ajax request to update the calendar.

The calendar works fine in the main page, but when I go to any other link the calendar stops working.

This is the site

Can anyone help me out with this?

I looked at the Ajax requests and here is what i found.

Home page - http://www.republica-tecnologica.com/modules/mod_tlak_calendar/includes/update_calendar.php
Other pages - http://www.republica-tecnologica.com/index.php/modules/mod_tlak_calendar/includes/update_calendar.php

What i recommend you do is set a var within your PHP script called siteURL or something to that extent and use the Joomla site url set in the database. Once that is set within the javascript before your Ajax request URL add the siteURL variable so it directs the request to the absolute URL rather then the relative URL.

I did not think that was needed, in Joomla 1.5 it works just fine, but it is not the case for Joomla 1.6, by calling JURI::root() I fixed the problem.