function cpabc_appointments_get_public_form()
{
    global $wpdb;
    $myrows = $wpdb->get_results("SELECT * FROM " . CPABC_APPOINTMENTS_CONFIG_TABLE_NAME . " WHERE id=1");
    define('CP_CALENDAR_ID', 1);
    $button_label = cpabc_get_option('vs_text_submitbtn', 'Continue');
    $button_label = $button_label == '' ? 'Continue' : $button_label;
    $previous_label = __("Previous", 'cpabc');
    $next_label = __("Next", 'cpabc');
    wp_enqueue_script('jquery');
    $calendar_items = '';
    foreach ($myrows as $item) {
        $calendar_items .= '<option value=' . $item->id . '>' . $item->uname . '</option>';
    }
    $cpabc_buffer = "";
    $services = array();
    $codes = $wpdb->get_results('SELECT * FROM ' . CPABC_APPOINTMENTS_DISCOUNT_CODES_TABLE_NAME . ' WHERE `cal_id`=' . CP_CALENDAR_ID);
    $quant_buffer = '';
    if (CPABC_APPOINTMENTS_ENABLE_QUANTITY_FIELD) {
        $quant_buffer = __('Quantity', 'cpabc') . ':<br /><select id="abc_capacity" name="abc_capacity" onchange="apc_clear_date();">';
        for ($i = 1; $i <= CPABC_APPOINTMENTS_ENABLE_QUANTITY_FIELD; $i++) {
            $quant_buffer .= '<option' . ($i == 1 ? ' selected="selected"' : '') . '>' . $i . '</option>';
        }
        $quant_buffer .= '</select><br />';
    }
    ?>
</p> <!-- this p tag fixes a IE bug -->
<link rel="stylesheet" type="text/css" href="<?php 
    echo plugins_url('TDE_AppCalendar/' . cpabc_get_option('calendar_theme', '') . 'all-css.css', __FILE__);
    ?>
" />
<script>
var pathCalendar = "<?php 
    echo cpabc_appointment_get_site_url();
    ?>
";
var cpabc_global_date_format = '<?php 
    echo cpabc_get_option('calendar_dateformat', CPABC_APPOINTMENTS_DEFAULT_CALENDAR_DATEFORMAT);
    ?>
';
var cpabc_global_military_time = '<?php 
    echo cpabc_get_option('calendar_militarytime', CPABC_APPOINTMENTS_DEFAULT_CALENDAR_MILITARYTIME);
    ?>
';
var cpabc_global_start_weekday = '<?php 
    echo cpabc_get_option('calendar_weekday', CPABC_APPOINTMENTS_DEFAULT_CALENDAR_WEEKDAY);
    ?>
';
var cpabc_global_mindate = '<?php 
    $value = cpabc_get_option('calendar_mindate', CPABC_APPOINTMENTS_DEFAULT_CALENDAR_MINDATE);
    if ($value != '') {
        echo date("n/j/Y", strtotime($value));
    }
    ?>
';
var cpabc_global_maxdate = '<?php 
    $value = cpabc_get_option('calendar_maxdate', CPABC_APPOINTMENTS_DEFAULT_CALENDAR_MAXDATE);
    if ($value != '') {
        echo date("n/j/Y", strtotime($value));
    }
    ?>
';
var cpabc_global_close_on_select = <?php 
    $value = cpabc_get_option('close_fpanel', 'yes');
    if ($value == '' || $value == 'yes') {
        echo 'true';
    } else {
        echo 'false';
    }
    ?>
;
var cpabc_global_cancel_text = '<?php 
    _e("Cancel", 'cpabc');
    ?>
';
var cpabc_global_pagedate = '<?php 
    $sm = cpabc_get_option('calendar_startmonth', date("n"));
    $sy = cpabc_get_option('calendar_startyear', date("Y"));
    if ($sm == '0' || $sm == '') {
        $sm = date("n");
    }
    if ($sy == '0' || $sy == '') {
        $sy = date("Y");
    }
    echo $sm . "/" . $sy;
    ?>
';
</script>
<script type="text/javascript" src="<?php 
    echo plugins_url('TDE_AppCalendar/all-scripts.js', __FILE__);
    ?>
"></script>
<script type="text/javascript">
 var cpabc_current_calendar_item;
 function apc_clear_date()
 {
    document.getElementById("selDaycal"+cpabc_current_calendar_item ).value = "";
    cpabc_updateItem();
 }
 function cpabc_updateItem()
 {
    document.getElementById("calarea_"+cpabc_current_calendar_item).style.display = "none";
    var i = document.FormEdit.cpabc_item.options.selectedIndex;
    var selecteditem = document.FormEdit.cpabc_item.options[i].value;
    cpabc_do_init(selecteditem);
 }
 function cpabc_do_init(id)
 {
    cpabc_current_calendar_item = id;
    document.getElementById("calarea_"+cpabc_current_calendar_item).style.display = "";
    initAppCalendar("cal"+cpabc_current_calendar_item,<?php 
    echo cpabc_get_option('calendar_pages', CPABC_APPOINTMENTS_DEFAULT_CALENDAR_PAGES);
    ?>
,2,"<?php 
    echo cpabc_get_option('calendar_language', CPABC_APPOINTMENTS_DEFAULT_CALENDAR_LANGUAGE);
    ?>
",{m1:"<?php 
    _e('Please select the appointment time.', 'cpabc');
    ?>
"});
 }
 function updatedate()
 {
    if (document.getElementById("selDaycal"+cpabc_current_calendar_item ).value != '')
    {
        var timead = "";
        var hour = document.getElementById("selHourcal"+cpabc_current_calendar_item ).value;
        if (cpabc_global_military_time == '0')
        {
            if (parseInt(hour) > 12)
            {
                timead = " pm";
                hour = parseInt(hour)-12;
            }
            else
                timead = " am";
        }
        var minute = document.getElementById("selMinutecal"+cpabc_current_calendar_item ).value;
        if (minute.length == 1)
            minute = "0"+minute;
        minute = hour + ":" + minute + timead;
    }
 }
 </script>
    <?php 
    $current_user = wp_get_current_user();
    define('CPABC_AUTH_INCLUDE', true);
    @(include dirname(__FILE__) . '/cpabc_scheduler.inc.php');
}
                               if (expires == '') { alert('Please enter an expiration date for the code'); return; }
                               var params = '&add=1&expires='+encodeURI(expires)+'&discount='+encodeURI(discount)+'&code='+encodeURI(code);
                               $j('#cpabc_nocodes_availmsg').load('<?php 
    echo cpabc_appointment_get_site_url(true);
    ?>
/?cpabc_app=cpabc_loadcoupons&inAdmin=1&cpabc_item=<?php 
    echo CP_CALENDAR_ID;
    ?>
'+params);
                               $j('#cpabc_dc_code').val();
                             });
                             
  function cpabc_delete_coupon(id)                             
  {
     $j('#cpabc_nocodes_availmsg').load('<?php 
    echo cpabc_appointment_get_site_url(true);
    ?>
/?cpabc_app=cpabc_loadcoupons&inAdmin=1&cpabc_item=<?php 
    echo CP_CALENDAR_ID;
    ?>
&delete=1&code='+id);
  }
  
  function cpabc_updatemaxslots()
  {
      try
      {
          var default_request_cost = new Array(<?php 
    echo $request_costs_exploded;
    ?>
);
?>
"><br />
<?php 
_e('Comments/Questions', 'cpabc');
?>
:<br />
<textarea name="question" style="width:100%"></textarea><br />
<?php 
if (cpabc_get_option('dexcv_enable_captcha', CPABC_TDEAPP_DEFAULT_dexcv_enable_captcha) != 'false') {
    ?>
  <?php 
    _e('Please enter the security code:', 'cpabc');
    ?>
<br />
  <img src="<?php 
    echo cpabc_appointment_get_site_url() . '/?cpabc_app=captcha&inAdmin=1&width=' . cpabc_get_option('dexcv_width', CPABC_TDEAPP_DEFAULT_dexcv_width) . '&height=' . cpabc_get_option('dexcv_height', CPABC_TDEAPP_DEFAULT_dexcv_height) . '&letter_count=' . cpabc_get_option('dexcv_chars', CPABC_TDEAPP_DEFAULT_dexcv_chars) . '&min_size=' . cpabc_get_option('dexcv_min_font_size', CPABC_TDEAPP_DEFAULT_dexcv_min_font_size) . '&max_size=' . cpabc_get_option('dexcv_max_font_size', CPABC_TDEAPP_DEFAULT_dexcv_max_font_size) . '&noise=' . cpabc_get_option('dexcv_noise', CPABC_TDEAPP_DEFAULT_dexcv_noise) . '&noiselength=' . cpabc_get_option('dexcv_noise_length', CPABC_TDEAPP_DEFAULT_dexcv_noise_length) . '&bcolor=' . cpabc_get_option('dexcv_background', CPABC_TDEAPP_DEFAULT_dexcv_background) . '&border=' . cpabc_get_option('dexcv_border', CPABC_TDEAPP_DEFAULT_dexcv_border) . '&font=' . cpabc_get_option('dexcv_font', CPABC_TDEAPP_DEFAULT_dexcv_font);
    ?>
"  id="captchaimg" alt="security code" border="0"  />
  <br />
  <?php 
    _e('Security Code (lowercase letters):', 'cpabc');
    ?>
<br />
  <div class="dfield">
  <input type="text" size="20" name="hdcaptcha" id="hdcaptcha" value="" />
  <div class="error message" id="hdcaptcha_error" generated="true" style="display:none;position: absolute; left: 0px; top: 25px;"></div>
  </div>
  <br />
<?php 
}
?>