static function lookup($exhibit_id, $address_field, $datum_id, $address)
 {
     global $wpdb;
     $table = WpExhibitConfig::table_name(WpExhibitConfig::$GEOCODE_TABLE_KEY);
     $sql = "SELECT lat, lng FROM {$table} WHERE exhibit_id = %d AND addressField = %s AND datum_id = %s AND address = %s;";
     $query = $wpdb->prepare($sql, $exhibit_id, $address_field, $datum_id, $address);
     $row = $wpdb->get_row($query, ARRAY_A);
     if ($row != NULL) {
         return array($row['lat'], $row['lng']);
     } else {
         try {
             // Delete any old address for <ExhibitID, AddressField, DatumID, *>
             $deleteSQL = "DELETE FROM {$table} WHERE exhibit_id = %d AND addressField = %s AND datum_id = %s;";
             $deleteQuery = $wpdb->prepare($deleteSQL, $exhibit_id, $address_field, $datum_id);
             $wpdb->query($deleteQuery);
             $geo_results = json_decode(WpExhibitGeocoder::geocode($address), true);
             $latlng = $geo_results['results'][0]['geometry']['location'];
             if ($latlng['lat'] == 0 && $latlng['lng'] == 0) {
                 return false;
             }
             $query = "INSERT INTO {$table}(lat, lng, exhibit_id, addressField, datum_id, address) VALUES(%f, %f, %d, %s, %s, %s)";
             $query = $wpdb->prepare($query, $latlng['lat'], $latlng['lng'], $exhibit_id, $address_field, $datum_id, $address);
             $wpdb->query($query);
         } catch (Exception $e) {
             return null;
         }
         return $latlng;
     }
 }
            $callBacks += 1;
        }
    }
}
?>
        var callBacks = <?php 
echo $callBacks;
?>
;

<?php 
/* Step 1: Figure out what fields we need to geocode. */
if (isset($exhibits_to_show) && count($exhibits_to_show) > 0) {
    foreach ($exhibits_to_show as $exhibit_to_show) {
        $exhibit_id = $exhibit_to_show->get('id');
        $fields = WpExhibitGeocoder::getGeocodedFieldsForExhibit($exhibit_id);
        foreach ($fields as $field) {
            /* Step 2: Build up a big list of all the data (itemID, field, value) for these fields */
            ?>
            geoExId = "<?php 
            echo $exhibit_id;
            ?>
";
            geoAddressField = "<?php 
            echo $field;
            ?>
";
            geoIds = Array();
            geoAddresses = Array();
            
            // TOOD: getItemProps
<?php

ob_start();
$root = dirname(dirname(dirname(dirname(__FILE__))));
if (file_exists($root . '/wp-load.php')) {
    // WP 2.6
    require_once $root . '/wp-load.php';
} else {
    // Before 2.6
    require_once $root . '/wp-config.php';
}
ob_end_clean();
//Ensure we don't have output from other plugins.
require_once 'wp-exhibit-geocoder.php';
if (isset($_GET['exhibit-id'])) {
    header('Content-type: application/json');
    echo WpExhibitGeocoder::json_for($_GET['exhibit-id']);
} else {
    if (isset($_POST['exhibitid']) and isset($_POST['datumids']) and isset($_POST['addresses'])) {
        WpExhibitGeocoder::batch_add($_POST['exhibitid'], $_POST['addressField'], $_POST['datumids'], $_POST['addresses']);
    } else {
    }
}