function wpsc_country_region_list($form_id = null, $ajax = false, $selected_country = null, $selected_region = null, $supplied_form_id = null, $shippingfields = false)
{
    global $wpdb;
    $output = '';
    $selected_country = new WPSC_Country($selected_country);
    $selected_region = $selected_country->get_region($selected_region);
    if ($form_id != null) {
        $html_form_id = "region_country_form_{$form_id}";
    } else {
        $html_form_id = 'region_country_form';
    }
    if ($shippingfields) {
        $js = '';
        $title = 'shippingcountry';
        $id = 'shippingcountry';
    } else {
        $js = '';
        $title = 'billingcountry';
        $id = 'billingcountry';
    }
    if (empty($supplied_form_id)) {
        $supplied_form_id = $id;
    }
    $additional_attributes = 'data-wpsc-meta-key="' . $title . '" title="' . $title . '" ' . $js;
    $output .= "<div id='{$html_form_id}'>\n\r";
    $output .= wpsc_get_country_dropdown(array('id' => $supplied_form_id, 'name' => "collected_data[{$form_id}][0]", 'class' => 'current_country wpsc-visitor-meta', 'selected' => $selected_country->get_isocode(), 'additional_attributes' => $additional_attributes, 'placeholder' => __('Please select a country', 'wp-e-commerce')));
    $region_list = $selected_country->get_regions();
    $checkout_form = new WPSC_Checkout_Form();
    $region_form_id = $checkout_form->get_field_id_by_unique_name('shippingstate');
    if ($shippingfields) {
        $namevalue = ' name="collected_data[' . $region_form_id . ']" ';
        $title = 'shippingregion';
    } else {
        $namevalue = ' name="collected_data[' . $form_id . '][1]" ';
        $title = 'billingregion';
    }
    $region_form_id = $supplied_form_id . '_region';
    $output .= "<div id='region_select_{$form_id}'>";
    $output .= '<select id="' . $region_form_id . '" class="current_region wpsc-visitor-meta wpsc-region-dropdown" data-wpsc-meta-key="' . $title . '"  title="' . $title . '" ' . $namevalue . ">\n\r ";
    if ($region_list != null) {
        if (count($region_list) > 1) {
            $label = $selected_country->get('region_label');
            $please_select_message = sprintf(__('Please select a %s', 'wp-e-commerce'), $label);
            $output .= "<option value='0'>" . $please_select_message . "</option>\n\r";
        }
        foreach ($region_list as $region) {
            if ($selected_region && $selected_region->get_id() == $region->get_id()) {
                $selected = "selected='selected'";
            } else {
                $selected = '';
            }
            $output .= "<option value='" . $region->get_id() . "' {$selected}>" . esc_html($region->get_name()) . "</option>\n\r";
        }
    }
    $output .= "</select>\n\r";
    $output .= '</div>';
    $output .= "</div>\n\r";
    return $output;
}