/** 
 * loadData()
 *
 * Here we load up all the data we need to run this web page.
 */
function loadData()
{
    global $seriesID;
    global $seriesManager;
    global $formValues;
    global $formFields;
    // read in the expected seriesID from the querystring ...
    // if not set, default to -1
    $seriesID = -1;
    if (isset($_REQUEST['seriesID'])) {
        $seriesID = $_REQUEST['seriesID'];
    }
    // Load in the requested SeriesManager from the DB
    $seriesManager = new RowManager_SeriesManager($seriesID);
    // initialize the formValues from the data in the RowManager
    $formValues = $seriesManager->getArrayOfValues();
    // if the form was submitted, then load Form Data:
    if (isset($_REQUEST['submit'])) {
        // step through each field
        for ($indx = 0; $indx < count($formFields); $indx++) {
            $key = $formFields[$indx];
            // if field was found in form submission then
            if (isset($_REQUEST[$key])) {
                // update formValues with data from form
                $formValues[$key] = $_REQUEST[$key];
            }
        }
    }
}