XAJAX and ezSQL's $db used in several functions while register_globals is off ?

Situation:
---
1. register_globals is off
2. several PHP functions that query the datbase and return results
(functions can call one another (concrete example: chained comboboxes with selected state)
3. requests to these functions are made by an AJAX toolkit(e.g. XAJAX)

I have a $db object setup to run some initial queries to populate a combobox with an onchange() handler calling the Xajax generated function. This function will retrieve data from the database based on the selection made in the combobox.

Fairly easy, however that's only part of the application I'm buiding. And as I'm needng several PHP functions that require database interactivity, so does my need for using the $db object in those functions. Since register_globals is off, I think the only way to get this working is to pass the $db as a function argument to whatever function that needs it, right? (please correct me if I'm wrong here)

Problem:
---
I need a DB connection to fetch some initial data from the database, like populating that first combobox. Onchange() I need my AJAX library (XAJAX) to make a request to a PHP function that requires the $db which in turn triggers other PHP functions.

Is there a solution that doesn't come down to defining $db twice?
(right now I need to define $db in the initial PHP code and a second time in the first PHP function I call from Xajax).