Moved javascript function to Joomla namespace