function qem_event_construct($atts)
{
    global $post;
    $event = event_get_stored_options();
    $display = event_get_stored_display();
    $vertical = $display['vertical'];
    $style = qem_get_stored_style();
    $cal = qem_get_stored_calendar();
    $custom = get_post_custom();
    $link = get_post_meta($post->ID, 'event_link', true);
    $endtime = get_post_meta($post->ID, 'event_end_time', true);
    $endmonth = $amalgamated = $target = '';
    $unixtime = get_post_meta($post->ID, 'event_date', true);
    $day = date_i18n("d", $unixtime);
    $enddate = get_post_meta($post->ID, 'event_end_date', true);
    $image = get_post_meta($post->ID, 'event_image', true);
    if (!$atts['popup'] && $atts['fullevent'] != 'popup') {
        $register = qem_get_stored_register();
        $payment = qem_get_stored_payment();
        $cost = get_post_meta($post->ID, 'event_cost', true);
        $usereg = get_post_meta($post->ID, 'event_register', true);
        $usecounter = get_post_meta($post->ID, 'event_counter', true);
        $usepay = get_post_meta($post->ID, 'event_pay', true);
    }
    $today = strtotime(date('Y-m-d'));
    $category = get_the_category();
    $cat = $category && (!$atts['widget'] && $style['cat_border'] || $atts['cb']) ? ' ' . $category[0]->slug : ' ';
    $titlecat = $datecat = '';
    if ($display['showcategory']) {
        if ($display['categorylocation'] == 'title') {
            $titlecat = ' - ' . $category[0]->name;
        }
        if ($display['categorylocation'] == 'date') {
            $datecat = ' - ' . $category[0]->name;
        }
    }
    if ($today > $unixtime && $register['notarchive']) {
        $register['useform'] = '';
        $usereg = '';
    }
    if ($atts['images'] == 'off') {
        $image = '';
    }
    if ($atts['vw']) {
        $style['vanillawidget'] = 'checked';
    }
    if ($atts['fields']) {
        foreach (explode(',', $event['sort']) as $name) {
            $event['summary'][$name] = '';
        }
        $derek = explode(',', $atts['fields']);
        $event['sort'] = '';
        foreach ($derek as $item) {
            $event['summary']['field' . $item] = 'checked';
            $event['sort'] = $event['sort'] . 'field' . $item . ',';
        }
    }
    if ($display['external_link'] && $link) {
        add_filter('post_type_link', 'qem_external_permalink', 10, 2);
    }
    if ($display['external_link_target'] && $link) {
        $target = ' target="_blank" ';
    }
    if ($atts['popup']) {
        $popupcontent = get_event_popup($atts);
    }
    if ($display['show_end_date'] && $enddate || $enddate && is_singular('event')) {
        $join = 'checked';
    } else {
        $join = '';
    }
    if ($atts['size']) {
        $width = '-' . $atts['size'];
    } else {
        $atts['size'] = $style['calender_size'];
        $width = '-' . $style['calender_size'];
    }
    $h = $atts['headersize'] == 'headthree' ? 'h3' : 'h2';
    $content = '<div class="qem' . $cat . '">';
    if ($display['amalgamated']) {
        $month = date_i18n("M", $unixtime);
        $year = date_i18n("Y", $unixtime);
        if ($enddate) {
            $endmonth = date_i18n("M", $enddate);
            $endday = date_i18n("d", $enddate);
            $endyear = date_i18n("Y", $enddate);
        }
        if ($month == $endmonth && $year == $endyear && $endday) {
            $amalgamated = 'checked';
        }
    }
    if (!$style['vanilla'] && !$style['vanillawidget'] || !$style['vanilla'] && $style['vanillawidget'] && !$atts['widget']) {
        if ($day != $atts['lastday']) {
            $content .= '<div class="qem-icon">' . get_event_calendar_icon($atts['size'], 'event_date', $join, $atts['vw'], $atts['widget']);
            if ($join && !$amalgamated && !$vertical) {
                $content .= '</div><div class="qem-icon">';
            }
            if (($display['show_end_date'] || is_singular('event')) && !$amalgamated) {
                $content .= get_event_calendar_icon($atts['size'], 'event_end_date', '', $atts['vw'], $atts['widget']);
            }
            $content .= '</div>';
        }
        $content .= '<div class="qem' . $width . '">';
        $clear = '<div style="clear:both"></div></div>';
    }
    if (!$display['titlelink']) {
        $linkclose = '</a>';
        if ($atts['popup']) {
            $linkopen = '<a onclick=\'pseudo_popup("<div class =\\"qemeventpop\\">' . $popupcontent . '</div>")\'>';
        } else {
            $linkopen = '<a href="' . get_permalink() . '">';
        }
    }
    $content .= '<div class="qemright">';
    if ($image && $display['event_image'] && !is_singular('event') && !$atts['widget'] || $image && $atts['images']) {
        $content .= $linkopen . '<img class="qem-list-image" src=' . $image . '>' . $linkclose . '<br>';
    }
    if ($image && is_singular('event') && !$atts['widget']) {
        $content .= $linkopen . '<img class="qem-image" src=' . $image . '>' . $linkclose . '<br>';
    }
    if ($image && $display['event_image'] && $atts['widget']) {
        $content .= $linkopen . '<img class="qem-list-image" src=' . $image . '>' . $linkclose . '<br>';
    }
    if (function_exists('file_get_contents') && ($atts['fullevent'] && !$image || $display['map_in_list'] || $display['map_and_image'] && ($display['map_in_list'] || $atts['fullevent']))) {
        $content .= get_event_map();
    }
    if ($atts['fullevent'] && (($register['useform'] && $usereg || $usereg) && $register['ontheright'])) {
        $content .= '<div class="qem-rightregister">' . qem_loop() . '</div>';
    }
    $content .= '</div>';
    if (!is_singular('event') || $atts['widget']) {
        $content .= '<' . $h . '>';
        if ($atts['links'] == 'checked') {
            if ($display['titlelink']) {
                $content .= $post->post_title;
            } elseif ($atts['popup']) {
                $content .= '<a onclick=\'pseudo_popup("<div class =\\"qemeventpop\\">' . $popupcontent . '</div>")\'>' . $post->post_title . '</a>';
            } else {
                $content .= '<a href="' . get_permalink() . '"' . $target . '>' . $post->post_title . $titlecat . '</a>';
            }
        } else {
            $content .= $post->post_title . $titlecat;
        }
        $content .= '</' . $h . '>';
    }
    if ($style['vanilla'] || $style['vanillawidget'] && $atts['widget']) {
        $content .= '<h3>' . get_event_calendar_icon($atts['size'], 'event_date', $join, $atts['vw'], $atts['widget']);
        if (($display['show_end_date'] || is_singular('event')) && !$amalgamated) {
            $content .= get_event_calendar_icon($atts['size'], 'event_end_date', '', $atts['vw'], $atts['widget']);
        }
        $content .= $datecat . '</h3>';
    }
    if ($atts['fullevent'] == 'popup') {
        foreach (explode(',', $event['sort']) as $name) {
            if ($event['active_buttons'][$name]) {
                $content .= qem_build_event($name, $event, $display, $custom, 'checked');
            }
        }
    } elseif ($atts['fullevent']) {
        foreach (explode(',', $event['sort']) as $name) {
            if ($event['active_buttons'][$name]) {
                $content .= qem_build_event($name, $event, $display, $custom, 'checked');
            }
        }
        if (!$atts['popup']) {
            $content .= get_the_content();
            if (($register['useform'] && $usereg || $usereg) && !$register['ontheright']) {
                $content .= qem_loop();
            }
        }
    } else {
        foreach (explode(',', $event['sort']) as $name) {
            if ($event['summary'][$name] == 'checked') {
                $content .= qem_build_event($name, $event, $display, $custom, $atts['settings']);
            }
        }
        $content .= qem_totalcoming($register, $payment);
        if ($register['eventlist'] && $usecounter) {
            $num = qem_numberscoming($register, $post->ID, $payment);
            if (!$num) {
                $content .= '<p class="qem_full">' . $register['eventfullmessage'] . '</p>';
            } else {
                $content .= $num;
            }
        }
    }
    if ($atts['links'] == 'checked' && ($atts['fullevent'] == 'popup' || !$atts['fullevent']) && $atts['popup']) {
        $content .= '<p style="cursor:pointer"><a onclick=\'pseudo_popup("<div class =\\"qemeventpop\\">' . $popupcontent . '</div>")\'>' . $display['read_more'] . '</a></p>';
    }
    if ($display['uselistics'] && !is_singular('event')) {
        $content .= qem_ics();
    }
    if (!$atts['popup'] && !$display['readmorelink'] && ($atts['fullevent'] == 'popup' || !$atts['fullevent'])) {
        $content .= '<p><a href="' . get_permalink() . '#eventtop"' . $target . '>' . $display['read_more'] . '</a></p>';
    }
    if (is_singular('event') && $display['useics'] && !$atts['widget'] && !$atts['popup']) {
        $content .= qem_ics();
    }
    if ($display['back_to_list'] && is_singular('event')) {
        if ($display['back_to_url']) {
            $content .= '<p><a href="' . $display['back_to_url'] . '">' . $display['back_to_list_caption'] . '</a></p>';
        } else {
            $content .= '<p><a href="javascript:history.go(-1)">' . $display['back_to_list_caption'] . '</a></p>';
        }
    }
    $content .= $clear . "</div>";
    return $content;
}
function qem_register()
{
    $processpercent = $processfixed = $qem_apikey = '';
    if (isset($_POST['Submit']) && check_admin_referer("save_qem")) {
        $options = array('useform', 'formwidth', 'notarchive', 'useqpp', 'usename', 'usemail', 'usetelephone', 'useplaces', 'usemessage', 'useattend', 'usecaptcha', 'useblank1', 'useblank2', 'usedropdown', 'useselector', 'usenumber1', 'reqname', 'reqmail', 'reqtelephone', 'reqmessage', 'reqblank1', 'reqblank2', 'reqdropdown', 'reqnumber1', 'formborder', 'sendemail', 'subject', 'subjecttitle', 'subjectdate', 'title', 'blurb', 'yourname', 'youremail', 'yourtelephone', 'yourplaces', 'yourmessage', 'yourcaptcha', 'yourattend', 'yourblank1', 'yourblank2', 'yourdropdown', 'yourselector', 'yournumber1', 'useaddinfo', 'addinfo', 'qemsubmit', 'error', 'replytitle', 'replyblurb', 'whoscoming', 'whosavatar', 'whoscomingmessage', 'placesbefore', 'placesafter', 'eventfull', 'eventfullmessage', 'eventlist', 'showuser', 'linkback', 'usecopy', 'copyblurb', 'alreadyregistered', 'useread_more', 'read_more', 'sort', 'registeredusers', 'paypal', 'qempaypalsubmit', 'numberattending', 'numberattendingbefore', 'numberattendingafter', 'allowmultiple', 'nameremoved', 'checkremoval', 'allowtags', 'useterms', 'termslabel', 'termsurl', 'termstarget', 'ontheright', 'usemorenames', 'morenames');
        foreach ($options as $item) {
            $register[$item] = stripslashes($_POST[$item]);
            if ($_POST['allowtags']) {
                $register[$item] = strip_tags($register[$item], '<p><b><a><em><i><strong>');
            } else {
                $register[$item] = filter_var($register[$item], FILTER_SANITIZE_STRING);
            }
        }
        update_option('qem_register', $register);
        qem_create_css_file('update');
        qem_admin_notice(__('The registration form settings have been updated', 'quick-event-manager'));
    }
    if (isset($_POST['Reset']) && check_admin_referer("save_qem")) {
        delete_option('qem_register');
        qem_admin_notice(__('The registration form settings have been reset', 'quick-event-manager'));
    }
    if (isset($_POST['Validate']) && check_admin_referer("save_qem")) {
        $apikey = $_POST['qem_apikey'];
        $blogurl = get_site_url();
        $akismet = new qem_akismet($blogurl, $apikey);
        if ($akismet->isKeyValid()) {
            qem_admin_notice("Valid Akismet API Key. All messages will now be checked against the Akismet database.");
            update_option('qem-akismet', $apikey);
        } else {
            qem_admin_notice("Your Akismet API Key is not Valid");
        }
    }
    if (isset($_POST['Delete']) && check_admin_referer("save_qem")) {
        delete_option('qem-akismet');
        qem_admin_notice("Akismet validation is no longer active on the Quick Event Manager");
    }
    $register = qem_get_stored_register();
    $content = '<div class="qem-settings"><div class="qem-options">
    <form id="" method="post" action="">
    <table width="100%">
    <tr>
    <td colspan="3"><h2>' . __('General Settings', 'quick-event-manager') . '</h2></td></tr>
    <tr>
    <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="useform"' . $register['useform'] . ' value="checked" /></td>
    <td colspan="2">' . __('Add a registration form to ALL your events', 'quick-event-manager') . '<br>
    <span class="description">' . __('To add a registration form to individual events use the event editor', 'quick-event-manager') . '.</span></td>
    </tr>
    <tr>
    <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="formborder"' . $register['formborder'] . ' value="checked" /></td>
    <td colspan="2">' . __('Add a border to the form', 'quick-event-manager') . '</td>
    </tr>
    <tr>
    <td></td>
    <td colspan="2">' . __('Form Width', 'quick-event-manager') . '<input type="text" style="width:4em" name="formwidth" value="' . $register['formwidth'] . '" /> use px, em or %. Default is px.</td>
    </tr>
    <tr>
    <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="ontheright"' . $register['ontheright'] . ' value="checked" /></td>
    <td colspan="2">' . __('Display the registration form on the right below the event image and map (if used)', 'quick-event-manager') . '</td>
    </tr>
    <tr>
    <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="notarchive" ' . $register['notarchive'] . ' value="checked" /></td>
    <td colspan="2">' . __('Do not display registration form on old events', 'quick-event-manager') . '</td>
    </tr>
    <tr>
    <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="showuser" ' . $register['showuser'] . ' value="checked" /></td>
    <td colspan="2">' . __('Pre-fill user name if logged in', 'quick-event-manager') . '</td>
    </tr>
    <tr>
    <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="registeredusers" ' . $register['registeredusers'] . ' value="checked" /></td>
    <td colspan="2">' . __('Only users who have logged in can register', 'quick-event-manager') . '</td>
    </tr>
    <tr>
    <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="allowmultiple" ' . $register['allowmultiple'] . ' value="checked" /></td>
    <td colspan="2">' . __('Allow multiple registrations', 'quick-event-manager') . '</td>
    </tr>
    <tr>
    <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="eventfull" ' . $register['eventfull'] . ' value="checked" /></td>
    <td colspan="2">' . __('Hide registration form when event is full', 'quick-event-manager') . '</td>
    </tr>
    <tr>
    <td></td>
    <td>' . __('Message to display', 'quick-event-manager') . ':</td>
    <td><input type="text" style="" name="eventfullmessage" value="' . $register['eventfullmessage'] . '" /></td>
    </tr>
    <tr>
    <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="allowtags"' . $register['allowtags'] . ' value="cheFcked" /></td>
    <td colspan="2">' . __('Allow HTML tags', 'quick-event-manager') . ' ' . __('Warning: this may leave your site open to CSRF and XSS attacks so be careful.', 'quick-event-manager') . '</td>
    </tr>
    <td colspan="3"><h2>' . __('Notifications', 'quick-event-manager') . '</h2></td>
    <tr>
    <td colspan="2">' . __('Your Email Address', 'quick-event-manager') . '</td>
    <td><input type="text" style="" name="sendemail" value="' . $register['sendemail'] . '" /><br><span class="description">' . __('This is where registration notifications will be sent', 'quick-event-manager') . '</span></td>
    </tr>
    <tr>
    <td colspan="3"><h2>' . __('Registration Form', 'quick-event-manager') . '</h2></td>
    </tr>
    <tr>
    <td colspan="2">' . __('Form title', 'quick-event-manager') . '</td>
    <td><input type="text" style="" name="title" value="' . $register['title'] . '" /></td>
    </tr>
    <tr>
    <td colspan="2">' . __('Form blurb', 'quick-event-manager') . '</td>
    <td><input type="text" style="" name="blurb" value="' . $register['blurb'] . '" /></td>
    </tr>
    <td colspan="2">' . __('Submit Button', 'quick-event-manager') . '</td>
    <td><input type="text" style="" name="qemsubmit" value="' . $register['qemsubmit'] . '" /></td>
    </tr>
    </table>
    <p>' . __('Check those fields you want to use. Drag and drop to change the order', 'quick-event-manager') . '.</p>
    <style>table#sorting{width:100%;}
    #sorting tbody tr{outline: 1px solid #888;background:#E0E0E0;}
    #sorting tbody td{padding: 2px;vertical-align:middle;}
    #sorting{border-collapse:separate;border-spacing:0 5px;}</style>
    <script>
    jQuery(function() 
    {var qem_rsort = jQuery( "#qem_rsort" ).sortable(
    {axis: "y",cursor: "move",opacity:0.8,update:function(e,ui)
    {var order = qem_rsort.sortable("toArray").join();jQuery("#qem_register_sort").val(order);}});});
    </script>
    <table id="sorting">
    <thead>
    <tr>
    <th width="5%">U</th>
    <th width="5%">R</th>
    <th width="20%">' . __('Field', 'quick-event-manager') . '</th>
    <th>' . __('Label', 'quick-event-manager') . '</th>
    </tr>
    </thead><tbody id="qem_rsort">';
    $sort = explode(",", $register['sort']);
    foreach ($sort as $name) {
        switch ($name) {
            case 'field1':
                $use = 'usename';
                $req = 'reqname';
                $label = __('Name', 'quick-event-manager');
                $input = 'yourname';
                break;
            case 'field2':
                $use = 'usemail';
                $req = 'reqmail';
                $label = __('Email', 'quick-event-manager');
                $input = 'youremail';
                break;
            case 'field3':
                $use = 'useattend';
                $req = '';
                $label = __('Not Attending', 'quick-event-manager');
                $input = 'yourattend';
                break;
            case 'field4':
                $use = 'usetelephone';
                $req = 'reqtelephone';
                $label = __('Telephone', 'quick-event-manager');
                $input = 'yourtelephone';
                break;
            case 'field5':
                $use = 'useplaces';
                $req = '';
                $label = __('Places', 'quick-event-manager');
                $input = 'yourplaces';
                break;
            case 'field6':
                $use = 'usemessage';
                $req = 'reqmessage';
                $label = __('Message', 'quick-event-manager');
                $input = 'yourmessage';
                break;
            case 'field7':
                $use = 'usecaptcha';
                $req = '';
                $label = __('Captcha', 'quick-event-manager');
                $input = 'Displays a simple maths captcha to confuse the spammers.';
                break;
            case 'field8':
                $use = 'usecopy';
                $req = '';
                $label = __('Copy Message', 'quick-event-manager');
                $input = 'copyblurb';
                break;
            case 'field9':
                $use = 'useblank1';
                $req = 'reqblank1';
                $label = __('User defined', 'quick-event-manager');
                $input = 'yourblank1';
                break;
            case 'field10':
                $use = 'useblank2';
                $req = 'reqblank2';
                $label = __('User defined', 'quick-event-manager');
                $input = 'yourblank2';
                break;
            case 'field11':
                $use = 'usedropdown';
                $req = '';
                $label = __('Dropdown', 'quick-event-manager');
                $input = 'yourdropdown';
                break;
            case 'field12':
                $use = 'usenumber1';
                $req = 'reqnumber1';
                $label = __('Number', 'quick-event-manager');
                $input = 'yournumber1';
                break;
            case 'field13':
                $use = 'useaddinfo';
                $req = '';
                $label = __('Additional Info (displays as plain text)', 'quick-event-manager');
                $input = 'addinfo';
                break;
            case 'field14':
                $use = 'useselector';
                $req = '';
                $label = __('Dropdown', 'quick-event-manager');
                $input = 'yourselector';
                break;
        }
        $content .= '<tr id="' . $name . '">
        <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="' . $use . '" ' . $register[$use] . ' value="checked" /></td>
        <td width="5%">';
        if ($req) {
            $content .= '<input type="checkbox" style="margin:0; padding: 0; border: none" name="' . $req . '" ' . $register[$req] . ' value="checked" />';
        }
        $content .= '</td><td width="20%">' . $label . '</td><td>';
        if ($name == 'field7') {
            $content .= $input;
        } else {
            $content .= '<input type="text" style="padding:1px;border: 1px solid #343838;" name="' . $input . '" value="' . $register[$input] . '" />';
        }
        $content .= '</td></tr>';
    }
    $content .= '</tbody>
    </table>
    <input type="hidden" id="qem_register_sort" name="sort" value="' . $register['sort'] . '" />
    <table>
    <td colspan="3"><h2>' . __('Show box for more names', 'quick-event-manager') . '</h2></td>
    <tr>
    <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="usemorenames" ' . $register['usemorenames'] . ' value="checked" /></td>
    <td colspan="2">' . __('Show box to add more names if number attending is greater than 1') . '</td>
    </tr>
    <tr>
    <td></td>
    <td>' . __('More names label', 'quick-event-manager') . '</td>
    <td><input type="text" style="" name="morenames" value="' . $register['morenames'] . '" /></td>
    </tr>
    <tr>
    <td colspan="3"><h2>' . __('Terms and Conditions', 'quick-event-manager') . '</h2></td>
    </tr>
    <tr>
    <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="useterms" ' . $register['useterms'] . ' value="checked" />
    </td>
    <td colspan="2">' . __('Include Terms and Conditions checkbox') . '</td>
    </tr>
    <tr>
    <td></td>
    <td>' . __('T&C label', 'quick-event-manager') . '</td>
    <td><input type="text" style="" name="termslabel" value="' . $register['termslabel'] . '" /></td>
    </tr>
    <tr>
    <td></td>
    <td>' . __('T&C URL', 'quick-event-manager') . '</td>
    <td><input type="text" style="" name="termsurl" value="' . $register['termsurl'] . '" /></td>
    </tr>
    <tr>
    <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="termstarget" ' . $register['termstarget'] . ' value="checked" /></td>
    <td colspan="2">' . __('Open link in new Tab/Window') . '</td>
    </tr>
    <tr>
    <td colspan="3"><h2>' . __('Error and Thank-you messages', 'quick-event-manager') . '</h2></td>
    </tr>
    <tr>
    <td colspan="2">' . __('Thank you message title', 'quick-event-manager') . '</td>
    <td><input type="text" style="" name="replytitle" value="' . $register['replytitle'] . '" /></td>
    </tr>
    <tr>
    <td colspan="2">' . __('Thank you message blurb', 'quick-event-manager') . '</td>
    <td><textarea style="width:100%;height:100px;" name="replyblurb">' . $register['replyblurb'] . '</textarea></td>
    </tr>
    <tr>
    <td colspan="2">' . __('Error Message', 'quick-event-manager') . '</td>
    <td><input type="text" style="" name="error" value="' . $register['error'] . '" /></td>
    </tr>
    <tr>
    <td colspan="2">' . __('Already Registered', 'quick-event-manager') . '</td>
    <td><input type="text" style="" name="alreadyregistered" value="' . $register['alreadyregistered'] . '" /></td>
    </tr>
    <tr>
    <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="checkremoval" ' . $register['checkremoval'] . ' value="checked" /></td>
    <td colspan="2">' . __('Use \'Not Attending\' option to allow people to remove their names from the list', 'quick-event-manager') . '</td>
    </tr>
    <tr>
    <td></td>
    <td>' . __('Name Removed Message', 'quick-event-manager') . '</td>
    <td><input type="text" style="" name="nameremoved" value="' . $register['nameremoved'] . '" /></td>
    </tr>
    <tr>
    <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="useread_more"' . $register['useread_more'] . ' value="checked" /></td>
    <td colspan="2">' . __('Display a \'return to event\' message after registration', 'quick-event-manager') . '</td>
    </tr>
    <tr>
    <td></td>
    <td>' . __('Return to event message:', 'quick-event-manager') . '</td>
    <td><input type="text" style="width:100%;" label="read_more" name="read_more" value="' . $register['read_more'] . '" /></td>
    </tr>
    <tr>
    <td colspan="3"><h2>' . __('Confirmation Email', 'quick-event-manager') . '</h2></td>
    </tr>
    <tr>
    <td colspan="3">You can reply to the sender using the <a href="?page=quick-event-manager/settings.php&tab=auto">Auto Responder</a>.</td>
    </tr>
    <tr>
    <td colspan="3"><h2>' . __('Show Attendees', 'quick-event-manager') . '</h2></td>
    </tr>
    <tr>
    <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="whoscoming" ' . $register['whoscoming'] . ' value="checked" /></td>
    <td colspan="2">' . __('List attendees', 'quick-event-manager') . '</td>
    </tr>
    <tr>
    <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="whosavatar" ' . $register['whosavatar'] . ' value="checked" /></td>
    <td colspan="2">' . __('Show avatars', 'quick-event-manager') . '</td>
    </tr>
    <tr>
    <td colspan="2">' . __('Message', 'quick-event-manager') . '</td>
    <td><input type="text" style="" name="whoscomingmessage" value="' . $register['whoscomingmessage'] . '" /></td>
    </tr>
    <tr>
    <td colspan="3"><h2>' . __('Places Available and Numbers Attending', 'quick-event-manager') . '</h2></td>
    </tr>
    <tr>
    <td colspan="3">' . __('Show how many places are left for an event', 'quick-event-manager') . '. ' . __('Set the number of places in the event editor', 'quick-event-manager') . '.</td>
    </tr>
    <tr>
    <td></td>
    <td>' . __('Message to display', 'quick-event-manager') . ':</td>
    <td><input type="text" style="width:40%;" name="placesbefore" value="' . $register['placesbefore'] . '" /> {number} <input type="text" style="width:40%;" name="placesafter" value="' . $register['placesafter'] . '" />
    </td>
    </tr>
    <tr>
    <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="eventlist" ' . $register['eventlist'] . ' value="checked" /></td>
    <td colspan="2">' . __('Show places available on event list - this only works if you have selected \'Add an attendee counter to this form\' on the event editor.', 'quick-event-manager') . '</td>
    </tr>
    <tr>
    <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="numberattending" ' . $register['numberattending'] . ' value="checked" /></td>
    <td colspan="2">' . __('Show number of people attending.', 'quick-event-manager') . '</td>
    </tr>
    <tr>
    <td></td><td>' . __('Message to display', 'quick-event-manager') . ':</td>
    <td><input type="text" style="width:40%; " name="numberattendingbefore" value="' . $register['numberattendingbefore'] . '" /> {number} <input type="text" style="width:40%; " name="numberattendingafter" value="' . $register['numberattendingafter'] . '" /></td>
    </tr>
    </table>
    <p><input type="submit" name="Submit" class="button-primary" style="color: #FFF;" value="' . __('Save Changes', 'quick-event-manager') . '" />
    <input type="submit" name="Reset" class="button-primary" style="color: #FFF;" value="' . __('Reset', 'quick-event-manager') . '" onclick="return window.confirm( \'' . __('Are you sure you want to reset the registration form?', 'quick-event-manager') . '\' );"/></p>
    <h2>' . __('Use Akismet Validation', 'quick-event-manager') . '</h2>
    <p>' . __('Enter your API Key to check all messages against the Akismet database.', 'quick-event-manager') . '</p> 
    <p><input type="text" label="akismet" name="qem_apikey" value="' . $qem_apikey . '" /></p>
    <p><input type="submit" name="Validate" class="button-primary" style="color: #FFF;" value="Activate Akismet Validation" /> <input type="submit" name="Delete" class="button-secondary" value="Deactivate Aksimet Validation" onclick="return window.confirm( \'This will delete the Akismet Key.\\nAre you sure you want to do this?\' );"/></p>';
    $content .= wp_nonce_field("save_qem");
    $content .= '</form>
    </div>
    <div class="qem-options" style="float:right">
    <h2>' . __('Example form', 'quick-event-manager') . '</h2>
    <p>' . __('This is an example of the form. When it appears on your site it will use your theme styles.', 'quick-event-manager') . '</p>';
    $content .= qem_loop();
    $content .= '</div></div>';
    echo $content;
}