First sources
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 10 Nov 2016 16:19:53 +0000 (11:19 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 10 Nov 2016 16:19:53 +0000 (11:19 -0500)
Initializing git repo for the copy of Registrations_V3 that was on ws0.

105 files changed:
.htaccess [new file with mode: 0644]
admin/Views/admin.html [new file with mode: 0644]
admin/Views/edit_attendees.html [new file with mode: 0644]
admin/Views/form_edit_test.html [new file with mode: 0644]
admin/Views/form_edit_test_result.html [new file with mode: 0644]
admin/Views/registrations_cc_confirmation.html [new file with mode: 0644]
admin/Views/report_by_activity.html [new file with mode: 0644]
admin/Views/report_by_activity_Body_Attendee.html [new file with mode: 0644]
admin/Views/report_by_activity_Body_Foot.html [new file with mode: 0644]
admin/Views/report_by_activity_Body_Head.html [new file with mode: 0644]
admin/Views/report_by_activity_csv.html [new file with mode: 0644]
admin/Views/report_by_activity_csv_Body_Attendee.html [new file with mode: 0644]
admin/Views/report_by_activity_csv_Body_Head.html [new file with mode: 0644]
admin/Views/report_by_attendee.html [new file with mode: 0644]
admin/Views/report_by_attendee_Body.html [new file with mode: 0644]
admin/Views/report_by_attendee_csv.html [new file with mode: 0644]
admin/Views/report_by_attendee_csv_Body.html [new file with mode: 0644]
admin/Views/report_by_registration.html [new file with mode: 0644]
admin/Views/report_by_registration_Body.html [new file with mode: 0644]
admin/Views/report_by_registration_MF_Data.html [new file with mode: 0644]
admin/Views/report_by_registration_csv.html [new file with mode: 0644]
admin/Views/report_by_registration_csv_Body.html [new file with mode: 0644]
admin/Views/report_request.html [new file with mode: 0644]
admin/Views/reports_csv.html [new file with mode: 0644]
admin/Views/reports_print.html [new file with mode: 0644]
admin/Views/view_attendees.html [new file with mode: 0644]
admin/Views/welcome.html [new file with mode: 0644]
admin/index.phtml [new file with mode: 0644]
admin/java_functions.js [new file with mode: 0644]
admin/style.css [new file with mode: 0644]
assets/add.png [new file with mode: 0644]
assets/arrow_left.png [new file with mode: 0644]
assets/basket.png [new file with mode: 0644]
assets/calendar.png [new file with mode: 0644]
assets/cancel.png [new file with mode: 0644]
assets/down.gif [new file with mode: 0644]
assets/down_small.png [new file with mode: 0644]
assets/logo.gif [new file with mode: 0644]
assets/tick.png [new file with mode: 0644]
assets/up.gif [new file with mode: 0644]
assets/up_small.png [new file with mode: 0644]
classes/EasyPassword.php [new file with mode: 0644]
classes/EasyPassword.words [new file with mode: 0644]
classes/FileServer/AdapterAbstract.php [new file with mode: 0644]
classes/FileServer/FileAdapter.php [new file with mode: 0644]
classes/ImageServer/Server.php [new file with mode: 0644]
classes/merchant_solutions.inc [new file with mode: 0644]
classes/merchant_solutions.inc.SAVE [new file with mode: 0644]
documentation/Conversion_from_V2.53_to_V3.txt [new file with mode: 0644]
documentation/Feature_Requests_and_Pending_Fixes.txt [new file with mode: 0644]
documentation/Install.txt [new file with mode: 0644]
documentation/Notes.txt [new file with mode: 0644]
documentation/Payment Gateways/Merchant Solutions/Documentation/IVR_Payment_By_Phone_Guide.pdf [new file with mode: 0644]
documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_Batch_Processing_Guide.pdf [new file with mode: 0644]
documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_MMC_WAP_User_Guide.pdf [new file with mode: 0644]
documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_Membership_Guide.pdf [new file with mode: 0644]
documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_SOAP_Integration_Guide.pdf [new file with mode: 0644]
documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_Stored_Profile_Tokenization_Guide.pdf [new file with mode: 0644]
documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_WebPay_Integration_Guide.pdf [new file with mode: 0644]
documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_XML_Integration_Guide.pdf [new file with mode: 0644]
documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_card_present_transactions_guide.pdf [new file with mode: 0644]
documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_first_mile_middleware_guide.pdf [new file with mode: 0644]
documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_getting_started_guide.pdf [new file with mode: 0644]
documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_integration_guide.pdf [new file with mode: 0644]
documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_soap_reporting_guide.pdf [new file with mode: 0644]
documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_web_cart_guide.pdf [new file with mode: 0644]
documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_web_link_guide.pdf [new file with mode: 0644]
documentation/Payment Gateways/Merchant Solutions/Notes.txt [new file with mode: 0644]
documentation/Payment Gateways/Merchant Solutions/merchant_solutions.wsdl [new file with mode: 0644]
documentation/Registrations.php [new file with mode: 0644]
documentation/Sites_Using.txt [new file with mode: 0644]
documentation/application.sql [new file with mode: 0644]
documentation/functions_docs.txt [new file with mode: 0644]
documentation/static_page.phtml [new file with mode: 0644]
documentation/work_in_progress.txt [new file with mode: 0644]
front-end/Views/Files_Explanation.txt [new file with mode: 0644]
front-end/Views/create_account.html [new file with mode: 0644]
front-end/Views/forgot_password.html [new file with mode: 0644]
front-end/Views/new_password.html [new file with mode: 0644]
front-end/Views/notify_event_contacts.html [new file with mode: 0644]
front-end/Views/notify_site_owner.html [new file with mode: 0644]
front-end/Views/password_reset.html [new file with mode: 0644]
front-end/Views/registration_price_guide.html [new file with mode: 0644]
front-end/Views/registrations_confirmation.html [new file with mode: 0644]
front-end/Views/registrations_step0.html [new file with mode: 0644]
front-end/Views/registrations_step1.html [new file with mode: 0644]
front-end/Views/registrations_step2.html [new file with mode: 0644]
front-end/Views/registrations_step3.html [new file with mode: 0644]
front-end/Views/registrations_step4.html [new file with mode: 0644]
front-end/Views/registrations_step5.SAVE2 [new file with mode: 0644]
front-end/Views/registrations_step5.html [new file with mode: 0644]
front-end/Views/registrations_step5.html.SAVE [new file with mode: 0644]
front-end/Views/registrations_step6.html [new file with mode: 0644]
front-end/Views/registrations_store.html [new file with mode: 0644]
front-end/Views/registrations_summary.html [new file with mode: 0644]
front-end/Views/style.css [new file with mode: 0644]
front-end/calendar.phtml [new file with mode: 0644]
front-end/category_select_popup.phtml [new file with mode: 0644]
front-end/index.html [new file with mode: 0644]
front-end/java_functions.js [new file with mode: 0644]
front-end/magic_forms_function.inc [new file with mode: 0644]
front-end/reg_functions.inc [new file with mode: 0644]
front-end/reg_setup.php [new file with mode: 0644]
front-end/registrations.inc [new file with mode: 0644]
front-end/registrations_support.php [new file with mode: 0644]

diff --git a/.htaccess b/.htaccess
new file mode 100644 (file)
index 0000000..ff03bf3
--- /dev/null
+++ b/.htaccess
@@ -0,0 +1 @@
+#Nothing Here
diff --git a/admin/Views/admin.html b/admin/Views/admin.html
new file mode 100644 (file)
index 0000000..5fde85d
--- /dev/null
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+  <head>
+    <title>{cust_name} Administration</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+    <META NAME="Author" CONTENT="Gaslight Media">
+    <META http-equiv="Pragma" content="no-cache">
+    <link rel="stylesheet" href="{stylesheet}">
+    <link rel="stylesheet" href="../main.css">
+       <script type="text/javascript" src="{base_app_url}ckeditor/4.4.6/ckeditor.js"></script>         
+    <script src="{base_app_url}Common/Registrations_V3/admin/java_functions.js"></script>
+  </head>
+  <body onLoad="defaultFieldFocus( '{field_focus}' );">
+    <center>
+   
+      <span class="title1">{application}</span><br>
+      <p>
+      <span class="navlink">{menu}</span>
+  <!--{if:message}-->
+      <p>
+      <table border="1" width="80%"><tr><td>{message}</td></tr></table>
+      <p>
+  <!--{/if:message}-->
+  
+      {body}
+      
+    </center>
+    <p>&nbsp;<p>
+    <hr>
+    <center><p class="copyright">Copyright &copy; {copyright_years} <a href="http://www.gaslightmedia.com" target="blank">Gaslight Media</a> All Rights Reserved</p></center>
+  </body>
+</html>
diff --git a/admin/Views/edit_attendees.html b/admin/Views/edit_attendees.html
new file mode 100644 (file)
index 0000000..ff12af4
--- /dev/null
@@ -0,0 +1,84 @@
+
+        <style>
+            .regRequired {
+                color: red;
+            }
+            .regWarning {
+                color: red;
+            }
+        </style>
+        <SPAN CLASS="title1">Edit {attendeesTermCap}</SPAN>
+       
+  <!--{if:have_reason=YES}-->
+        <div class="regWarning">
+            <h3>Your request was not submitted. Please check the following items.</h3>
+            <table border="0"><tr><td align="left">
+                   <ul>
+           <!--{list:reason}-->
+                       <li class="regWarning">{text}</li>
+           <!--{/list:reason}-->
+                   </ul>
+            </td></tr></table>
+        </div>
+  <!--{/if:have_reason}-->
+
+        <FORM ACTION="{this_script}" name="attendees" method="POST">
+          <INPUT TYPE="hidden" NAME="Action" VALUE="Reg_Att">
+          <input type="hidden" name="id" value="{reg_id}">
+
+          <table>
+              <tr><th align="right">Reg #: </th><td>{reg_id}</td></tr>
+              <tr><th align="right">Date Submittted: </th><td>{date_entered}</td></tr>
+              <tr><th align="right">Name: </th><td>{lname}, {fname}</td></tr>
+              <tr><th align="right">Status: </th><td>{status}</td></tr>
+              <tr><td colspan="2">&nbsp;</td></tr>
+<!--{if:have_regs=YES}-->
+
+ <!--{list:detail}-->
+                <tr>
+                  <td colspan="3">
+                      <table width="100%">
+                        <tr><th align="left">Activity: </th><td colspan="4" align="left">{regname}</td></tr>
+                        <tr>
+                          <th align="left" style="padding-right: 10px;">{attendeesTermCap}</th>
+                          <th colspan="4" align="left">&nbsp;</th>
+                               </tr>                
+      <!--{list:attendee_array}-->
+                        <tr>
+                            <td colspan="5">
+                                <input type="text" name="att_{id}_{attendee_id}_name" value="{name}">
+                                &nbsp;&nbsp;Delete this {attendeeTerm}: <input type="checkbox" name="att_{id}_{attendee_id}_delete">
+                            </td>    
+                        </tr>
+        <!--{if:med_info=t}-->
+                        <tr>                  
+                            <td>&nbsp;<input type="hidden" name="att_{id}_{attendee_id}_med_required" value="true"></td>
+                            <td class="regRequired">Date of Birth: </td><td><input type="text" name="att_{id}_{attendee_id}_dob" value="{dob}"></td>
+                            <td>Parent/Guardian: </td><td><input type="text" name="att_{id}_{attendee_id}_guardian" value="{guardian}"></td>
+                        </tr>
+                        <tr>
+                            <td>&nbsp;</td>
+                            <td class="regRequired">Emergency Contact: </td><td><input type="text" name="att_{id}_{attendee_id}_emer_contact" value="{emer_contact}"></td>
+                            <td class="regRequired">Emergency Phone: </td><td><input type="text" name="att_{id}_{attendee_id}_emer_phone" value="{emer_phone}"></td>
+                        </tr>
+                            <td>&nbsp;</td>
+                            <td>Brief Medical History: </td><td colspan="3"><input type="text" name="att_{id}_{attendee_id}_med_history" value="{med_history}" style="width: 400px;"></td>
+                        </tr>
+                            <td>&nbsp;</td>
+                            <td>Alergies/Medications: </td><td colspan="3"><input type="text" name="att_{id}_{attendee_id}_allergy_med" value="{allergy_med}" style="width: 400px;"></td>
+                        </tr>               
+        <!--{/if:med_info}-->
+      <!--{/list:attendee_array}-->                        
+                      </table>
+                  </td>
+                </tr>
+              <tr><td colspan="2">&nbsp;</td></tr>
+
+ <!--{/list:detail}-->
+
+<!--{/if:have_regs}-->
+              
+          </table>
+          <input type="submit" name="Option" value="Update">
+        </form>
+
diff --git a/admin/Views/form_edit_test.html b/admin/Views/form_edit_test.html
new file mode 100644 (file)
index 0000000..548e654
--- /dev/null
@@ -0,0 +1,43 @@
+<html>
+  <head>
+    <title>{cust_name} Administration</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+    <META NAME="Author" CONTENT="Gaslight Media">
+    <META http-equiv="Pragma" content="no-cache">
+
+<!--{exclude}-->
+    <link rel="stylesheet" href="{base_app_url}Common/Registrations_V3/admin/style.css">
+<!--{/exclude}-->
+<!--{include}
+    <link rel="stylesheet" href="{stylesheet}">
+{/include}-->
+<!--{exclude}-->
+    <script SRC="{base_app_url}Common/Registrations_V3/admin/java_functions.js"></script>
+<!--{/exclude}-->
+<!--{include}
+    <script src="{base_app_url}Common/Registrations_V3/admin/java_functions.js"></script>
+{/include}-->
+  </head>
+  <body onLoad="defaultFieldFocus( '{field_focus}' );">
+    <center>
+      <div class="standout">{cust_name}</div>
+      <span class="title1">Magic Form Builder</span><br>
+      <p>
+    </center>
+
+  <!--{if:problem}--><P>The form submission was invalid because:<p><dl>{problem}</dl><p><!--{/if:problem}-->
+    <p>  
+    <form enctype="multipart/form-data" action="{this_script}" method="post">
+      <input type="hidden" name="Action" value="Eve_For_Edi_Tes_Sub">
+      {form_data}
+      {magic_form}
+      <p>
+    <!--{if:required=Yes}--><font color="red">*</font> Required fields<p><!--{/if:required}-->
+      <input type="submit" name="Submit Form" value="Submit Form">
+    </form>
+      
+    <p>&nbsp;<p>
+    <hr>
+    <center><p class="copyright">Copyright &copy; {copyright_years} <a href="http://www.gaslightmedia.com" target="blank">Gaslight Media</a> All Rights Reserved</p></center>
+  </body>
+</html>
\ No newline at end of file
diff --git a/admin/Views/form_edit_test_result.html b/admin/Views/form_edit_test_result.html
new file mode 100644 (file)
index 0000000..b8a2491
--- /dev/null
@@ -0,0 +1,41 @@
+<html>
+  <head>
+    <title>{cust_name} Administration</title> 
+    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+    <META NAME="Author" CONTENT="Gaslight Media">
+    <META http-equiv="Pragma" content="no-cache">
+
+<!--{exclude}-->
+    <link rel="stylesheet" href="{base_app_url}Common/Registrations_V3/admin/style.css">
+<!--{/exclude}-->
+<!--{include}
+    <link rel="stylesheet" href="{stylesheet}">
+{/include}-->
+<!--{exclude}-->
+    <script SRC="{base_app_url}Common/Registrations_V3/admin/java_functions.js"></script>
+<!--{/exclude}-->
+<!--{include}
+    <script src="{base_app_url}Common/Registrations_V3/admin/java_functions.js"></script>
+{/include}-->
+  </head>
+  <body onLoad="defaultFieldFocus( '{field_focus}' );">
+    <center>
+      <div class="standout">{cust_name}</div>
+      <span class="title1">Magic Form Builder</span><br>
+      <p>
+    </center>
+  <!--{if:problem}--><P style="color: red;">The form submission was invalid because:<p><dl>{problem}</dl><p><!--{else:problem}The form submission was successful.<p>{/if:problem}-->
+    <p><form action="{this_script}">{return_data}{form_data}<input type="submit" name="Return" value="Return to Form"></FORM>
+    <p>&nbsp;<p>
+    <p><span class="standout">Results</span><br><hr><pre>{html}</pre><P>
+  <!--{if:total_value}-->
+    Total value of selected options = {total_value}<p>
+  <!--{/if:total_value}-->
+    <hr>
+    <p>&nbsp;<p>
+    <span class="standout">CSV export</span><br><hr><pre>{csv}</pre><hr>
+    <p>&nbsp;<p>
+    <hr>
+    <center><p class="copyright">Copyright &copy; {copyright_years} <a href="http://www.gaslightmedia.com" target="blank">Gaslight Media</a> All Rights Reserved</p></center>
+  </body>
+</html>
\ No newline at end of file
diff --git a/admin/Views/registrations_cc_confirmation.html b/admin/Views/registrations_cc_confirmation.html
new file mode 100644 (file)
index 0000000..9f30f90
--- /dev/null
@@ -0,0 +1,33 @@
+<HTML>
+  <HEAD>
+    <LINK REL="stylesheet" HREF="../Views/Default/style.css">
+  </head>
+  <body bgcolor="FFFFFF">
+    <table width="750" border="0" cellspacing="0" cellpadding="0">
+      <tr>
+        <td align="center">
+            <table border="0" width="100%" cellspacing="0" cellpadding="5">
+              <tr><td colspan="2" align="center"><font class="headertitle">{registrationTermCap}: {checkout_type}</font></td></tr>
+              <TR><TD COLSPAN="2" ALIGN="center">{registrationTermCap} #:&nbsp;&nbsp;{request_numb}</TD></TR>
+              <tr>
+                <td colspan="2" align="center">
+                  Thank you for your {registrationTerm}.<br>
+                  This confirms payment. Please print this page.
+               </td>
+              </tr>
+              <TR><TD COLSPAN="2">&nbsp;<P></TD></TR>
+              <tr><td colspan="3">{html_summary}</td></tr>
+             <TR><TD COLSPAN="3">&nbsp;</TD></TR>
+             <TR><TD COLSPAN="3"><hr width="90%"></TD></TR>
+             <tr><td colspan="3" align="center"><a href="{base_url}">{cust_name}</a></td></tr>
+             <tr><td colspan="3" align="center">{cust_address}</td></tr>
+             <tr><td colspan="3" align="center">{cust_city}, {cust_state} {cust_zip}</td></tr>
+             <tr><td colspan="3" align="center">{cust_phone}</td></tr>
+            </TABLE>
+        </TD>
+      </TR>
+    </table>
+  </BODY>
+</HTML>
+
+
diff --git a/admin/Views/report_by_activity.html b/admin/Views/report_by_activity.html
new file mode 100644 (file)
index 0000000..8762d76
--- /dev/null
@@ -0,0 +1,55 @@
+<!--{if:PrintReport=YES}-->
+<html>
+  <head>
+    <title>{cust_name} Reports</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+    <META NAME="Author" CONTENT="Gaslight Media">
+    <META http-equiv="Pragma" content="no-cache">
+    <link rel="stylesheet" href="{stylesheet}">
+    <link rel="stylesheet" href="../main.css">
+  </head>
+  <body onLoad="window.print();">
+<center class="report_title">
+       {application} - {cust_name}
+</center>
+<!--{/if:PrintReport}-->
+
+<!--{if:PrintReport=NO}-->
+       <p><A HREF="{this_script}?{print_params}&PrintReport=Yes" TARGET="printable_popup" onClick="w=window.open('{this_script}?{print_params}&PrintReport=Yes','conf_popup','toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width=1000,height=500');w.focus();return(false)">[Printable Report]</A></p>
+       <p>
+               <form href="{this_script}?{print_params}" method="POST" class="report_print_box">
+                       Send by E-Mail to: <input type="text" name="email_to"> <input type="submit" name="Send Email" value="Send Email">
+               </form>
+       </p>
+<!--{/if:PrintReport}-->
+
+<div class="report_sub_title">
+       <span class="report_sub_title_right">{date_time}</span>
+       <span class="report_sub_title_left">Report by Activity</span>
+</div> 
+
+
+<table border="0" cellspacing="0" cellpadding="0" width="100%">
+       <tr>
+               <td align="left"><table border="1" width="100%">
+                               <tr>
+                                       <th>Total Activities:</th>
+                                       <td>{total_activities}</td>
+                                       <th>Total {attendingTermCap}:</th>
+                                       <td>{total_attendees}</td>
+                               </tr>
+                       </table></td>
+       </tr>
+       <tr>
+               <td>&nbsp;</td>
+       </tr>
+
+{report_body}
+
+</table>
+
+<!--{if:PrintReport=YES}-->
+               </center>
+       </body>
+</html>
+<!--{/if:PrintReport}-->
diff --git a/admin/Views/report_by_activity_Body_Attendee.html b/admin/Views/report_by_activity_Body_Attendee.html
new file mode 100644 (file)
index 0000000..87b8e8a
--- /dev/null
@@ -0,0 +1,60 @@
+       <!--{list:attendees}-->
+                                                       <tr>
+                                                               <td align="left" valign="top" style="white-space: nowrap;">{attendee}</td>
+                                                               <td align="left" valign="top">{status_text}</td>
+                                                               <td align="left" valign="top">{phone}</td>
+                                                               <td align="left" valign="top">{desired_date}</td>
+                                                               <td align="left" valign="top">{email}</td>
+                                                       </tr>
+               <!--{if:using_medical_info=YES}-->
+                       <!--{if:have_med_info=YES}-->
+                                                       <tr>
+                                                               <td>&nbsp;</td>
+                                                               <td valign="top" colspan="2">
+                                                                       <table cellspacing="0" cellpadding="0">
+                                                                               <tr>
+                                                                                       <td>&nbsp;&nbsp;&nbsp;</td>
+                                                                                       <td align="left">Date of Birth:</td>
+                                                                                       <td>{dob}</td>
+                                                                                       <td align="left">Guardian:</td>
+                                                                                       <td>{guardian}</td>
+                                                                               </tr>
+                                                                               <tr>
+                                                                                       <td>&nbsp;&nbsp;&nbsp;</td>
+                                                                                       <td align="left">Emergency Contact:</td>
+                                                                                       <td>{emer_contact}</td>
+                                                                                       <td align="left">Emergency Phone:</td>
+                                                                                       <td>{emer_phone}</td>
+                                                                               </tr>
+                                                                               <tr>
+                                                                                       <td>&nbsp;&nbsp;&nbsp;</td>
+                                                                                       <td align="left">Medical history:</td>
+                                                                                       <td colspan="3">{med_history}</td>
+                                                                               </tr>
+                                                                               <tr>
+                                                                                       <td>&nbsp;&nbsp;&nbsp;</td>
+                                                                                       <td align="left">Allergy Meds:</td>
+                                                                                       <td colspan="3">{allergy_med}</td>
+                                                                               </tr>
+                                                                       </table>
+                                                               </td>
+                                                       </tr>
+                       <!--{/if:have_med_info}-->
+               <!--{/if:using_medical_info}-->
+               <!--{if:have_mf_data=YES}-->
+                                                       <tr>
+                                                               <td valign="top" colspan="3">
+                                                                       <table cellspacing="0" cellpadding="0">
+                       <!--{list:mf_data}-->
+                                                                               <tr>
+                                                                                       <td style="width: 2em">&nbsp;</td>
+                                                                                       <td align="left">{indent}{title}:&nbsp;&nbsp;</td>
+                                                               <td>{value}</td>
+                                                                               </tr>
+                       <!--{/list:mf_data}-->
+                                                                       </table>
+                                                               </td>
+                                                       </tr>
+               <!--{/if:have_mf_data}-->
+               
+       <!--{/list:attendees}-->
diff --git a/admin/Views/report_by_activity_Body_Foot.html b/admin/Views/report_by_activity_Body_Foot.html
new file mode 100644 (file)
index 0000000..1d736ac
--- /dev/null
@@ -0,0 +1,8 @@
+                                               </table>
+                                       </td>
+                               </tr>
+                       </table></td>
+       </tr>
+       <tr>
+               <td>&nbsp;</td>
+       </tr>
diff --git a/admin/Views/report_by_activity_Body_Head.html b/admin/Views/report_by_activity_Body_Head.html
new file mode 100644 (file)
index 0000000..8b4f432
--- /dev/null
@@ -0,0 +1,24 @@
+<!--{list:data}-->
+       <tr>
+               <td align="left"><table border="1" width="100%">
+                               <tr>
+                                       <th align="left" width="10%">Activity:</th>
+                                       <td align="left">{activity}</td>
+                                       <th align="left" width="10%">Attending:</th>
+                                       <td align="left" width="5%">{numb_attending}</td>
+                                       <th align="left" width="10%">Starting:</th>
+                                       <td align="left" width="10%">{start_date}</td>
+                                       <th align="left" width="10%">Ending:</th>
+                                       <td align="left" width="10%">{end_date}</td>
+                               </tr>
+                               <tr>
+                                       <td colspan="8" valign="top">
+                                               <table border="2" width="100%">
+                                                       <tr>
+                                                               <th align="left" width="20%">{attendeeTermCap}</th>
+                                                               <th align="left" width="20%">Status</th>
+                                                               <th align="left" width="20%">Phone</th>
+                                                               <th align="left" width="20%">Desired Date</th>
+                                                               <th align="left" width="20%">E-Mail</th>
+                                                       </tr>
+<!--{/list:data}-->
diff --git a/admin/Views/report_by_activity_csv.html b/admin/Views/report_by_activity_csv.html
new file mode 100644 (file)
index 0000000..be47a59
--- /dev/null
@@ -0,0 +1,4 @@
+"Activity","Number Attending","Start Date","End Date","{attendeeTermCap}","Pay Type","Status","Phone","Desired Date","E-Mail"<!--{if:med_info_on=YES}-->,"DOB","Guardian","Contact","Contact Phone","Med History","Allergy Meds"<!--{/if:med_info_on}--><!--{if:have_mf_fields=YES}--><!--{list:mf_fields}-->,"{title}"<!--{/list:mf_fields}--><!--{/if:have_mf_fields}-->
+{report_body}
+"Total Activities","{total_activities}"
+"Total {attendeesTermCap}","{total_attendees}"
diff --git a/admin/Views/report_by_activity_csv_Body_Attendee.html b/admin/Views/report_by_activity_csv_Body_Attendee.html
new file mode 100644 (file)
index 0000000..a4c4361
--- /dev/null
@@ -0,0 +1,2 @@
+<!--{list:attendees}-->"","","","","{attendee}","{pay_type}","{status_text}","{phone}","{desired_date}","{email}"<!--{if:have_med_info=YES}-->,"{dob}","{guardian}","{emer_contact}","{emer_phone}","{med_history}","{allergy_med}"<!--{/if:have_med_info}--><!--{if:have_mf_data=YES}--><!--{list:mf_data}-->,"{value}"<!--{/list:mf_data}--><!--{/if:have_mf_data}-->
+<!--{/list:attendees}-->
\ No newline at end of file
diff --git a/admin/Views/report_by_activity_csv_Body_Head.html b/admin/Views/report_by_activity_csv_Body_Head.html
new file mode 100644 (file)
index 0000000..7d95a67
--- /dev/null
@@ -0,0 +1,2 @@
+<!--{list:data}-->
+"{activity}","{numb_attending}","{start_date}","{end_date}","{email}"<!--{/list:data}-->
diff --git a/admin/Views/report_by_attendee.html b/admin/Views/report_by_attendee.html
new file mode 100644 (file)
index 0000000..5295029
--- /dev/null
@@ -0,0 +1,50 @@
+<!--{if:PrintReport=YES}-->
+<html>
+  <head>
+    <title>{cust_name} Reports</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+    <META NAME="Author" CONTENT="Gaslight Media">
+    <META http-equiv="Pragma" content="no-cache">
+    <link rel="stylesheet" href="{stylesheet}">
+    <link rel="stylesheet" href="../main.css">
+  </head>
+  <body onLoad="window.print();">
+<center class="report_title">
+       {application} - {cust_name}
+</center>
+<!--{/if:PrintReport}-->
+
+<!--{if:PrintReport=NO}-->
+       <p><A HREF="{this_script}?{print_params}&PrintReport=Yes" TARGET="printable_popup" onClick="w=window.open('{this_script}?{print_params}&PrintReport=Yes','conf_popup','toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width=1000,height=500');w.focus();return(false)">[Printable Report]</A></p>
+       <p>
+               <form href="{this_script}?{print_params}" method="POST" class="report_print_box">
+                       Send by E-Mail to: <input type="text" name="email_to"> <input type="submit" name="Send Email" value="Send Email">
+               </form>
+       </p>
+<!--{/if:PrintReport}-->
+
+<div class="report_sub_title">
+       <span class="report_sub_title_right">{date_time}</span>
+       <span class="report_sub_title_left">Report by {attendeesTermCap}</span>
+</div> 
+
+<table border="0" cellspacing="0" cellpadding="0" width="100%">
+       <tr>
+               <td align="left"><table border="1" width="100%">
+                               <tr>
+                                       <th>Total {attendeesTermCap}:</th>
+                                       <td>{total_attendees}</td>
+                               </tr>
+                       </table></td>
+       </tr>
+       <tr>
+               <td>&nbsp;</td>
+       </tr>
+{report_body}
+</table>
+
+<!--{if:PrintReport=YES}-->
+               </center>
+       </body>
+</html>
+<!--{/if:PrintReport}-->
diff --git a/admin/Views/report_by_attendee_Body.html b/admin/Views/report_by_attendee_Body.html
new file mode 100644 (file)
index 0000000..731a0e5
--- /dev/null
@@ -0,0 +1,100 @@
+<!--{list:data}-->
+       <tr>
+               <td align="left"><table border="1" width="100%">
+                               <tr>
+                                       <td valign="top" width="33%">
+                                               <table cellspacing="0" cellpadding="0">
+                                                       <tr>
+                                                               <th align="left">{attendeeTermCap}:</th>
+                                                               <td>{attendee}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <th align="left">Activity:</th>
+                                                               <td>{activity}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <th align="left">Phone:</th>
+                                                               <td>{phone}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <th align="left">Payment Method:</th>
+                                                               <td>{pay_type}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <th align="left">Status:</th>
+                                                               <td>{status_text}</td>
+                                                       </tr>
+                                               </table>
+                                       </td>
+                                       <td valign="top" width="33%">
+                                               <table cellspacing="0" cellpadding="0">
+               <!--{if:have_desired_date=YES}-->
+                                                       <tr>
+                                                               <th align="left">Desired Date:&nbsp;&nbsp;</th>
+                                                               <td>{desired_date}</td>
+                                                       </tr>
+               <!--{/if:have_desired_date}-->                                                  
+                       <!--{if:using_medical_info=YES}-->
+                               <!--{if:have_med_info=YES}-->
+                                                       <tr>
+                                                               <th align="left">Emergency Info:</th>
+                                                               <td>Required</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td align="left">Date of Birth:</td>
+                                                               <td>{dob}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td align="left">Guardian:</td>
+                                                               <td>{guardian}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td align="left">Contact:</td>
+                                                               <td>{emer_contact}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td align="left">Phone:</td>
+                                                               <td>{emer_phone}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td align="left">Medical history:</td>
+                                                               <td>{med_history}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td align="left">Allergy Meds:</td>
+                                                               <td>{allergy_med}</td>
+                                                       </tr>
+                               <!--{/if:have_med_info}-->
+                       <!--{/if:using_medical_info}-->
+                                               </table> 
+                                               &nbsp;
+                                       </td>
+                               </tr>
+                               
+                               
+               <!--{if:have_mf_data=YES}-->
+                               <tr>
+                                       <td valign="top" colspan="2" width="100%">
+                                               <table cellspacing="0" cellpadding="0">
+                                                       <tr>
+                                                               <th align="left" colspan="2">&nbsp;Additional Data</th>
+                                                       </tr>
+                       <!--{list:mf_data}-->
+                                                       <tr>
+                                                               <td align="left"><nobr>{indent}{title}:&nbsp;&nbsp;</nobr></td>
+                                       <td>{value}</td>
+                                                       </tr>
+                       <!--{/list:mf_data}-->
+                                               </table>
+                                       </td>
+                               </tr>
+               <!--{/if:have_mf_data}-->
+
+                               
+                               
+                       </table></td>
+       </tr>
+       <tr>
+               <td>&nbsp;</td>
+       </tr>
+<!--{/list:data}-->
diff --git a/admin/Views/report_by_attendee_csv.html b/admin/Views/report_by_attendee_csv.html
new file mode 100644 (file)
index 0000000..e0ee8cd
--- /dev/null
@@ -0,0 +1,3 @@
+"{attendeeTermCap}","Activity","Phone","PayMethod","Status","Desired Date"<!--{if:med_info_on=YES}-->,"DOB","Guardian","Contact","Contact Phone","Med History","Allergy Meds"<!--{/if:med_info_on}--><!--{if:have_mf_fields=YES}--><!--{list:mf_fields}-->,"{title}"<!--{/list:mf_fields}--><!--{/if:have_mf_fields}-->
+{report_body}
+"Total {attendeesTermCap}","{total_attendees}"
diff --git a/admin/Views/report_by_attendee_csv_Body.html b/admin/Views/report_by_attendee_csv_Body.html
new file mode 100644 (file)
index 0000000..7d64221
--- /dev/null
@@ -0,0 +1 @@
+<!--{list:data}-->"{attendee}","{activity}","{phone}","{pay_type}","{status_text}","{desired_date}"<!--{if:have_med_info=YES}-->,"{dob}","{guardian}","{emer_contact}","{emer_phone}","{med_history}","{allergy_med}"<!--{/if:have_med_info}--><!--{if:have_mf_data=YES}--><!--{list:mf_data}-->,"{value}"<!--{/list:mf_data}--><!--{/if:have_mf_data}--><!--{/list:data}-->
diff --git a/admin/Views/report_by_registration.html b/admin/Views/report_by_registration.html
new file mode 100644 (file)
index 0000000..3193ef3
--- /dev/null
@@ -0,0 +1,55 @@
+<!--{if:PrintReport=YES}-->
+<html>
+  <head>
+    <title>{cust_name} Reports</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+    <META NAME="Author" CONTENT="Gaslight Media">
+    <META http-equiv="Pragma" content="no-cache">
+    <link rel="stylesheet" href="{stylesheet}">
+    <link rel="stylesheet" href="../main.css">
+  </head>
+  <body onLoad="window.print();">
+<center class="report_title">
+       {application} - {cust_name}
+</center>
+<!--{/if:PrintReport}-->
+
+<!--{if:PrintReport=NO}-->
+       <p><A HREF="{this_script}?{print_params}&PrintReport=Yes" TARGET="printable_popup" onClick="w=window.open('{this_script}?{print_params}&PrintReport=Yes','conf_popup','toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width=1000,height=500');w.focus();return(false)">[Printable Report]</A></p>
+       <p>
+               <form href="{this_script}?{print_params}" method="POST" class="report_print_box">
+                       Send by E-Mail to: <input type="text" name="email_to"> <input type="submit" name="Send Email" value="Send Email">
+               </form>
+       </p>
+<!--{/if:PrintReport}-->
+
+<div class="report_sub_title">
+       <span class="report_sub_title_right">{date_time}</span>
+       <span class="report_sub_title_left">Report by Requests</span>
+</div> 
+
+<table border="0" cellspacing="0" cellpadding="0" width="100%">
+       <tr>
+               <td align="left">
+                       <table border="1" width="100%">
+                               <tr>
+                                       <th>Total Registrations:</th>
+                                       <td>{total_registrations}</td>
+                                       <th>Total {attendeesTermCap}:</th>
+                                       <td>{total_attendees}</td>
+                                       <th>Total Charges:</th>
+                                       <td>{total_charges}</td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+       <tr>
+               <td>&nbsp;</td>
+       </tr>
+{report_body}
+</table>
+
+<!--{if:PrintReport=YES}-->
+       </body>
+</html>
+<!--{/if:PrintReport}-->
diff --git a/admin/Views/report_by_registration_Body.html b/admin/Views/report_by_registration_Body.html
new file mode 100644 (file)
index 0000000..36c33e9
--- /dev/null
@@ -0,0 +1,260 @@
+<!--{list:data}-->
+       <tr>
+               <td align="left"><table border="1" width="100%">
+                               <tr>
+                                       <td valign="top" width="33%">
+                                               <table cellspacing="0" cellpadding="0">
+                                                       <tr>
+                                                               <th align="left">Registration ID:&nbsp;&nbsp;</th>
+                                                               <td>{id}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <th align="left">Date Registered:&nbsp;&nbsp;</th>
+                                                               <td>{date}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <th align="left">E-Mail Address:&nbsp;&nbsp;</th>
+                                                               <td>{email}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <th align="left">OK to E-Mail:&nbsp;&nbsp;</th>
+                                                               <td>{email_ok}</td>
+                                                       </tr>
+       <!--{if:admin_user=YES}-->
+                                                       <tr>
+                                                               <td colspan="2">&nbsp;</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <th align="center" colspan="2">Entered By Admin User</th>
+                                                       </tr>
+       <!--{/if:admin_user}-->
+                                                       <tr>
+                                                               <th align="left">Payment Method:&nbsp;&nbsp;</th>
+                                                               <td>{pay_type}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <th align="left">Status:&nbsp;&nbsp;</th>
+                                                               <td>{status_text}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <th align="left">Total Charges:&nbsp;&nbsp;</th>
+                                                               <td>{total_money}</td>
+                                                       </tr>
+       <!--{if:pay_type=comp_code}-->
+                                                       <tr>
+                                                               <td align="left">Comp Code Supplied:&nbsp;&nbsp;</td>
+                                                               <td>{pay_code}</td>
+                                                       </tr>
+       <!--{/if:pay_type}-->
+       <!--{if:pay_type=credit_card}-->
+                                                       <tr>
+                                                               <td align="left">Card Type:&nbsp;&nbsp;</td>
+                                                               <td>{cc_type}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td align="left">Name on Card:&nbsp;&nbsp;</td>
+                                                               <td>{cc_name}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td align="left">Card Number:&nbsp;&nbsp;</td>
+                                                               <td>{cc_numb}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td align="left">Expiration:&nbsp;&nbsp;</td>
+                                                               <td>{cc_exp}</td>
+                                                       </tr>
+       <!--{/if:pay_type}-->
+                                               </table>
+                                       </td>
+                                       <td valign="top" width="33%">
+                                               <table cellspacing="0" cellpadding="0">
+                                                       <tr><th colspan="2" align="center">Billing / Registered by</th></tr>
+                                                       <tr>
+                                                               <th align="left">Name:&nbsp;&nbsp;</th>
+                                                               <td>{lname}, {fname}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <th align="left">Address:&nbsp;&nbsp;</th>
+                                                               <td>{addr1}</td>
+                                                       </tr>
+       <!--{if:addr2}-->
+                                                       <tr>
+                                                               <th align="left">&nbsp;</th>
+                                                               <td>{addr2}</td>
+                                                       </tr>
+       <!--{/if:addr2}-->
+                                                       <tr>
+                                                               <th align="left">&nbsp;</th>
+                                                               <td>{city}, {state_name} {zip}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <th align="left">&nbsp;</th>
+                                                               <td>{country_name}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <th align="left">Phone:&nbsp;&nbsp;</th>
+                                                               <td>{phone}</td>
+                                                       </tr>
+       <!--{if:fax}-->
+                                                       <tr>
+                                                               <th align="left">FAX:&nbsp;&nbsp;</th>
+                                                               <td>{fax}</td>
+                                                       </tr>
+       <!--{/if:fax}-->
+                                               </table>
+                                       </td>
+                                       <td valign="top" width="33%">
+       <!--{if:show_contact_data=YES}-->
+                                               <table cellspacing="0" cellpadding="0">
+                                                       <tr><th colspan="2" align="center">{contact_information_title}</th></tr>
+               <!--{if:use_contact_fname=YES}-->                                                       
+                                                       <tr>
+                                                               <th align="left">{prompt_contact_fname}:&nbsp;&nbsp;</th>
+                                                               <td>{contact_fname}</td>
+                                                       </tr>
+               <!--{/if:use_contact_fname}-->
+               <!--{if:use_contact_lname=YES}-->                                                       
+                                                       <tr>
+                                                               <th align="left">{prompt_contact_lname}:&nbsp;&nbsp;</th>
+                                                               <td>{contact_lname}</td>
+                                                       </tr>
+               <!--{/if:use_contact_lname}-->
+               <!--{if:use_contact_addr1=YES}-->                                                       
+                                                       <tr>
+                                                               <th align="left">{prompt_contact_addr1}:&nbsp;&nbsp;</th>
+                                                               <td>{contact_addr1}</td>
+                                                       </tr>
+               <!--{/if:use_contact_addr1}-->
+               <!--{if:use_contact_addr2=YES}-->                                                       
+                                                       <tr>
+                                                               <th align="left">{prompt_contact_addr2}:&nbsp;&nbsp;</th>
+                                                               <td>{contact_fname}</td>
+                                                       </tr>
+               <!--{/if:use_contact_addr2}-->
+               <!--{if:use_contact_city=YES}-->                                                        
+                                                       <tr>
+                                                               <th align="left">&nbsp;</th>
+                                                               <td>{contact_city}, {contact_state_name} {contact_zip}</td>
+                                                       </tr>
+               <!--{/if:use_contact_city}-->
+               <!--{if:use_contact_country=YES}-->                                                     
+                                                       <tr>
+                                                               <th align="left">{prompt_contact_country}&nbsp;</th>
+                                                               <td>{contact_country_name}</td>
+                                                       </tr>
+               <!--{/if:use_contact_country}-->
+               <!--{if:use_contact_phone=YES}-->                                                       
+                                                       <tr>
+                                                               <th align="left">{prompt_contact_phone}:&nbsp;&nbsp;</th>
+                                                               <td>{contact_phone}</td>
+                                                       </tr>
+               <!--{/if:use_contact_phone}-->
+               <!--{if:use_contact_fax=YES}-->                                                 
+                                                       <tr>
+                                                               <th align="left">{prompt_contact_fax}:&nbsp;&nbsp;</th>
+                                                               <td>{contact_fax}</td>
+                                                       </tr>
+               <!--{/if:use_contact_fax}-->
+                                               </table>
+       <!--{else:show_contact_data}
+                                               &nbsp;
+       {/if:show_contact_data}-->                                              
+                                                                                       
+                                       </td>
+                               </tr>
+       <!--{list:detail}-->
+                               <tr>
+                                       <td colspan="3" valign="top">
+                                               <table cellspacing="0" cellpadding="0">
+                                                       <tr>
+                                                               <th align="left">{eventTermCap}:&nbsp;&nbsp;</th>
+                                                               <td>{activity}</td>
+                                                       </tr>
+               <!--{if:have_desired_date=YES}-->
+                                                       <tr>
+                                                               <th align="left">Desired Date:&nbsp;&nbsp;</th>
+                                                               <td>{desired_date}</td>
+                                                       </tr>
+               <!--{/if:have_desired_date}-->                                                  
+               <!--{if:have_attendees=YES}-->
+                                                       <tr>
+                                                               <th align="left" style="white-space: nowrap;">Number {attendingTermCap}:&nbsp;&nbsp;</th>
+                                                               <td>{numb_attending}</td>
+                                                       </tr>
+               <!--{/if:have_attendees}-->
+
+               <!--{if:have_attendees=YES}-->
+                       <!--{if:have_med_info=YES}-->
+                                                       <tr>
+                                                               <th align="left" valign="top">{attendeesTermCap}:&nbsp;&nbsp;</th>
+                                                               <td>
+                                                                       <table border="0">
+                               <!--{list:attendees}-->
+                                                                               <tr>
+                                                                                       <td colspan="5" align="left">{name}</td>
+                                                                               </tr>
+                                                                               <tr>
+                                                                                       <td>&nbsp;&nbsp;&nbsp;</td>
+                                                                                       <th align="left">Date of Birth:&nbsp;&nbsp;</th>
+                                                                                       <td>{dob}</td>
+                                                                                       <th align="left">Parent/Guardian:&nbsp;&nbsp;</th>
+                                                                                       <td>{guardian}</td>
+                                                                               </tr>
+                                                                               <tr>
+                                                                                       <td>&nbsp;</td>
+                                                                                       <th align="left">Emergency Contact:&nbsp;&nbsp;</th>
+                                                                                       <td>{emer_contact}</td>
+                                                                                       <th align="left">Emergency Phone:&nbsp;&nbsp;</th>
+                                                                                       <td>{emer_phone}</td>
+                                                                               </tr>
+                                                                               <td>&nbsp;</td>
+                                                                               <th align="left">Brief Medical History:&nbsp;&nbsp;</th>
+                                                                               <td colspan="3">{med_history}</td>
+                                                                               </tr>
+                                                                               <td>&nbsp;</td>
+                                                                               <th align="left">Alergies/Medications:&nbsp;&nbsp;</th>
+                                                                               <td colspan="3">{allergy_med}</td>
+                                                                               </tr>
+                               <!--{/list:attendees}-->
+                                                                       </table>
+                                                               </td>
+                                                       </tr>
+                       <!--{else:have_med_info}
+                    <tr>
+                        <th align="left" valign="top">{attendeesTermCap}:&nbsp;&nbsp;</th>
+                        <td>
+                       <!--{list:attendees}-->
+                                                       {name}
+                                       <!--{sep:attendees}-->
+                                                       ,
+                                       <!--{/sep:attendees}-->
+                                                       {name}
+                               <!--{/list:attendees}-->
+                                                       </td>
+                                                       </tr>
+                       {/if:have_med_info}-->
+               <!--{/if:have_attendees}-->
+
+               <!--{if:have_mf_fields=YES}-->
+                                                       <tr>
+                                                               <th align="left" colspan="2">&nbsp;Additional Data</th>
+                                                       </tr>
+                       <!--{list:mf_data}-->
+                                                       <tr>
+                                                               <td align="left"><nobr>{indent}{title}:&nbsp;&nbsp;</nobr></td>
+                                       <td>{value}</td>
+                                                       </tr>
+                       <!--{/list:mf_data}-->
+               <!--{/if:have_mf_fields}-->
+
+
+                                               </table>
+                                       </td>
+                               </tr>
+       <!--{/list:detail}-->
+                       </table></td>
+       </tr>
+       <tr>
+               <td>&nbsp;</td>
+       </tr>
+<!--{/list:data}-->
\ No newline at end of file
diff --git a/admin/Views/report_by_registration_MF_Data.html b/admin/Views/report_by_registration_MF_Data.html
new file mode 100644 (file)
index 0000000..e8d6470
--- /dev/null
@@ -0,0 +1,204 @@
+<!--{list:data}-->
+       <tr>
+               <td align="left"><table border="1" width="100%">
+                               <tr>
+                                       <td valign="top" width="33%">
+                                               <table cellspacing="0" cellpadding="0">
+                                                       <tr>
+                                                               <th align="left">Registration ID:</th>
+                                                               <td>{id}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <th align="left">Date Registered:&nbsp;&nbsp;</th>
+                                                               <td>{date}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <th align="left">Name:</th>
+                                                               <td>{lname}, {fname}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <th align="left">Address:</th>
+                                                               <td>{addr1}</td>
+                                                       </tr>
+       <!--{if:addr2}-->
+                                                       <tr>
+                                                               <th align="left">&nbsp;</th>
+                                                               <td>{addr2}</td>
+                                                       </tr>
+       <!--{/if:addr2}-->
+                                                       <tr>
+                                                               <th align="left">&nbsp;</th>
+                                                               <td>{city}, {state} {zip}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <th align="left">&nbsp;</th>
+                                                               <td>{country}</td>
+                                                       </tr>
+                                               </table>
+                                       </td>
+                                       <td valign="top" width="33%">
+                                               <table>
+                                                       <tr>
+                                                               <th align="left">E-Mail Address:</th>
+                                                               <td>{email}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <th align="left">OK to E-Mail:</th>
+                                                               <td>{email_ok}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <th align="left">Phone:</th>
+                                                               <td>{phone}</td>
+                                                       </tr>
+       <!--{if:fax}-->
+                                                       <tr>
+                                                               <th align="left">FAX:</th>
+                                                               <td>{fax}</td>
+                                                       </tr>
+       <!--{/if:fax}-->
+
+       <!--{if:admin_user=YES}-->
+                                                       <tr>
+                                                               <td colspan="2">&nbsp;</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <th align="center" colspan="2">Entered By Admin User</th>
+                                                       </tr>
+       <!--{/if:admin_user}-->
+                                               </table>
+                                       </td>
+                                       <td valign="top" width="33%">
+                                               <table cellspacing="0" cellpadding="0">
+                                                       <tr>
+                                                               <th align="left">Payment Method:</th>
+                                                               <td>{pay_type}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td align="left">Status:</td>
+                                                               <td>{status_text}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td align="left">Total Charges:</td>
+                                                               <td>{total_money}</td>
+                                                       </tr>
+       <!--{if:pay_type=comp_code}-->
+                                                       <tr>
+                                                               <td align="left">Comp Code Supplied:</td>
+                                                               <td>{pay_code}</td>
+                                                       </tr>
+       <!--{/if:pay_type}-->
+       <!--{if:pay_type=credit_card}-->
+                                                       <tr>
+                                                               <td align="left">Card Type:</td>
+                                                               <td>{cc_type}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td align="left">Name on Card:</td>
+                                                               <td>{cc_name}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td align="left">Card Number:</td>
+                                                               <td>{cc_numb}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td align="left">Expiration:</td>
+                                                               <td>{cc_exp}</td>
+                                                       </tr>
+       <!--{/if:pay_type}-->
+                                               </table>
+                                       </td>
+                               </tr>
+       <!--{list:detail}-->
+                               <tr>
+                                       <td colspan="3" valign="top">
+                                               <table cellspacing="0" cellpadding="0">
+                                                       <tr>
+                                                               <th align="left">{eventTermCap}:</th>
+                                                               <td>{activity}</td>
+                                                       </tr>
+               <!--{if:have_attendees=YES}-->
+                                                       <tr>
+                                                               <th align="left" style="white-space: nowrap;">Number {attendingTermCap}:&nbsp;&nbsp;</th>
+                                                               <td>{numb_attending}</td>
+                                                       </tr>
+               <!--{/if:have_attendees}-->
+
+               <!--{if:have_attendees=YES}-->
+                       <!--{if:have_med_info=YES}-->
+                                                       <tr>
+                                                               <th align="left" valign="top">{attendeesTermCap}:</th>
+                                                               <td>
+                                                                       <table border="0">
+                               <!--{list:attendees}-->
+                                                                               <tr>
+                                                                                       <td colspan="5" align="left">{name}</td>
+                                                                               </tr>
+                                                                               <tr>
+                                                                                       <td>&nbsp;&nbsp;&nbsp;</td>
+                                                                                       <th align="left">Date of Birth:</th>
+                                                                                       <td>{dob}</td>
+                                                                                       <th align="left">Parent/Guardian:</th>
+                                                                                       <td>{guardian}</td>
+                                                                               </tr>
+                                                                               <tr>
+                                                                                       <td>&nbsp;</td>
+                                                                                       <th align="left">Emergency Contact:</th>
+                                                                                       <td>{emer_contact}</td>
+                                                                                       <th align="left">Emergency Phone:</th>
+                                                                                       <td>{emer_phone}</td>
+                                                                               </tr>
+                                                                               <td>&nbsp;</td>
+                                                                               <th align="left">Brief Medical History:</th>
+                                                                               <td colspan="3">{med_history}</td>
+                                                                               </tr>
+                                                                               <td>&nbsp;</td>
+                                                                               <th align="left">Alergies/Medications:</th>
+                                                                               <td colspan="3">{allergy_med}</td>
+                                                                               </tr>
+                               <!--{/list:attendees}-->
+                                                                       </table>
+                                                               </td>
+                                                       </tr>
+                       <!--{else:have_med_info}
+                    <tr>
+                        <th align="left" valign="top">{attendeesTermCap}: </th>
+                        <td>
+                       <!--{list:attendees}-->
+                                                       {name}
+                                       <!--{sep:attendees}-->
+                                                       ,
+                                       <!--{/sep:attendees}-->
+                                                       {name}
+                               <!--{/list:attendees}-->
+                                                       </td>
+                                                       </tr>
+                       {/if:have_med_info}-->
+               <!--{/if:have_attendees}-->
+
+               <!--{if:have_mf_data=YES}-->
+                                                       <tr>
+                                                               <th align="left" colspan="2">&nbsp;Additional Data</th>
+                                                       </tr>
+                       <!--{list:mf_data}-->
+                                                       <tr>
+                                                               <td align="left"><nobr>{indent}{title}:&nbsp;&nbsp;</nobr></td>
+                               <!--{if:txt_val}-->
+                                                               <td>{txt_val}</td>
+                               <!--{else:txt_val}
+                                       <td>{value}</td>
+               {/if:txt_val}-->
+                                                       </tr>
+                       <!--{/list:mf_data}-->
+               <!--{/if:have_mf_data}-->
+
+
+                                               </table>
+                                       </td>
+                               </tr>
+       <!--{/list:detail}-->
+                       </table></td>
+       </tr>
+       <tr>
+               <td>&nbsp;</td>
+       </tr>
+<!--{/list:data}-->
\ No newline at end of file
diff --git a/admin/Views/report_by_registration_csv.html b/admin/Views/report_by_registration_csv.html
new file mode 100644 (file)
index 0000000..c7696ed
--- /dev/null
@@ -0,0 +1,7 @@
+"ID","Last Name","First Name","Address 1","Address 2","City","State","ZIP","Country","E-Mail","E-Mail OK","Phone","FAX",<!--{if:show_contact_data=YES}--><!--{if:use_contact_lname=YES}-->"{prompt_contact_lname}",<!--{/if:use_contact_lname}--><!--{if:use_contact_fname=YES}-->"{prompt_contact_fname}",<!--{/if:use_contact_fname}--><!--{if:use_contact_addr1=YES}-->"{prompt_contact_addr1}",<!--{/if:use_contact_addr1}--><!--{if:use_contact_addr2=YES}-->"{prompt_contact_addr2}",<!--{/if:use_contact_addr2}--><!--{if:use_contact_city=YES}-->"{prompt_contact_city}","{prompt_contact_state}","{prompt_contact_zip}",<!--{/if:use_contact_city}--><!--{if:use_contact_country=YES}-->"{prompt_contact_country}",<!--{/if:use_contact_country}--><!--{if:use_contact_phone=YES}-->"{prompt_contact_phone}",<!--{/if:use_contact_phone}--><!--{if:use_contact_fax=YES}-->"{prompt_contact_fax}",<!--{/if:use_contact_fax}--><!--{/if:show_contact_data}-->"Entered by Admin","Pay Method","Status","Total","Comp Code","Card Type","Name on Card","Card Number","Expiration","Activity","{attendeeTermCap}"<!--{if:med_info_on=YES}-->,"DOB","Guardian","Contact","Contact Phone","Med History","Allergy Meds"<!--{/if:med_info_on}--><!--{if:have_mf_fields=YES}--><!--{list:mf_fields}-->,"{title}"<!--{/list:mf_fields}--><!--{/if:have_mf_fields}-->
+
+{report_body}
+
+"Total Registrations","{total_registrations}"
+"Total {attendeesTermCap}","{total_attendees}"
+"Total Charges","{total_charges}"
diff --git a/admin/Views/report_by_registration_csv_Body.html b/admin/Views/report_by_registration_csv_Body.html
new file mode 100644 (file)
index 0000000..547eb90
--- /dev/null
@@ -0,0 +1,2 @@
+<!--{list:data}--><!--{list:detail}--><!--{if:have_attendees=YES}--><!--{list:attendees}-->"{id}","{lname}","{fname}","{addr1}","{addr2}","{city}","{state}","{zip}","{country}","{email}","{email_ok}","{phone}","{fax}",<!--{if:show_contact_data=YES}--><!--{if:use_contact_lname=YES}-->"{contact_lname}",<!--{/if:use_contact_lname}--><!--{if:use_contact_fname=YES}-->"{contact_fname}",<!--{/if:use_contact_fname}--><!--{if:use_contact_addr1=YES}-->"{contact_addr1}",<!--{/if:use_contact_addr1}--><!--{if:use_contact_addr2=YES}-->"{contact_addr2}",<!--{/if:use_contact_addr2}--><!--{if:use_contact_city=YES}-->"{contact_city}","{contact_state}","{contact_zip}",<!--{/if:use_contact_city}--><!--{if:use_contact_country=YES}-->"{contact_country}",<!--{/if:use_contact_country}--><!--{if:use_contact_phone=YES}-->"{contact_phone}",<!--{/if:use_contact_phone}--><!--{if:use_contact_fax=YES}-->"{contact_fax}",<!--{/if:use_contact_fax}--><!--{/if:show_contact_data}--><!--{if:admin_user=YES}-->"Yes"<!--{else:admin_user}""{/if:admin_user}-->,"{pay_type}","{status_text}","{total_money}","{pay_code}","{cc_type}","{cc_name}","{cc_numb}","{cc_exp}","{activity}","{name}"<!--{if:med_info_on=YES}-->,"{dob}","{guardian}","{emer_contact}","{emer_phone}","{med_history}","{allergy_med}"<!--{/if:med_info_on}--><!--{if:have_mf_data=YES}--><!--{list:mf_data}-->,"{value}"<!--{/list:mf_data}--><!--{/if:have_mf_data}--><!--{/list:attendees}--><!--{else:have_attendees}"{id}","{lname}","{fname}","{addr1}","{addr2}","{city}","{state}","{zip}","{country}","{email}","{email_ok}","{phone}","{fax}",<!--{if:show_contact_data=YES}--><!--{if:use_contact_lname=YES}-->"{contact_lname}",<!--{/if:use_contact_lname}--><!--{if:use_contact_fname=YES}-->"{contact_fname}",<!--{/if:use_contact_fname}--><!--{if:use_contact_addr1=YES}-->"{contact_addr1}",<!--{/if:use_contact_addr1}--><!--{if:use_contact_addr2=YES}-->"{contact_addr2}",<!--{/if:use_contact_addr2}--><!--{if:use_contact_city=YES}-->"{contact_city}","{contact_state}","{contact_zip}",<!--{/if:use_contact_city}--><!--{if:use_contact_country=YES}-->"{contact_country}",<!--{/if:use_contact_country}--><!--{if:use_contact_phone=YES}-->"{contact_phone}",<!--{/if:use_contact_phone}--><!--{if:use_contact_fax=YES}-->"{contact_fax}",<!--{/if:use_contact_fax}--><!--{/if:show_contact_data}--><!--{if:admin_user=YES}-->"Yes"<!--{else:admin_user}""{/if:admin_user}-->,"{pay_type}","{status_text}","{total_money}","{pay_code}","{cc_type}","{cc_name}","{cc_numb}","{cc_exp}","{activity}",""<!--{if:have_med_info=YES}-->,"{dob}","{guardian}","{emer_contact}","{emer_phone}","{med_history}","{allergy_med}"<!--{/if:have_med_info}--><!--{if:have_mf_data=YES}--><!--{list:mf_data}-->,"{value}"<!--{/list:mf_data}--><!--{/if:have_mf_data}-->
+{/if:have_attendees}--><!--{/list:detail}--><!--{/list:data}-->
\ No newline at end of file
diff --git a/admin/Views/report_request.html b/admin/Views/report_request.html
new file mode 100644 (file)
index 0000000..8914950
--- /dev/null
@@ -0,0 +1,235 @@
+
+<P>
+<h2>Select Report</h2>
+{reason_text}
+<P>
+<script>
+
+       function show(d, v) {
+               // Show the selected area       
+               document.getElementById(d).style.visibility = 'visible';
+               document.getElementById(d).style.display = v;
+    }
+
+       function hide(d) {
+               // Hide the selected area
+               document.getElementById(d).style.visibility = 'hidden';
+               document.getElementById(d).style.display = 'none';
+       }
+       
+       function changeByFunc() {       
+               var s = document.getElementById("output_pick");
+               var v = s.options[s.selectedIndex].value;
+               if (v == 'registration') {
+                       show("sort_by_title", 'inline');
+                       show("sort_by_pick", 'inline');
+               } else {
+                       hide("sort_by_title");
+                       hide("sort_by_pick");
+               }
+       }
+       
+       function changeDynAvailable() {
+               var s = document.getElementById("eventSelect");
+               var v = s.options[s.selectedIndex].value;
+               var x = document.getElementById("DynDataCheckbox");
+               var y = document.getElementById("showIDCheckbox");
+               if (v == (v-0) && v != 0) {
+                       show("DynDataCheck", 'inline');
+                       hide("DynDataMsg");
+               } else {
+                       hide("DynDataCheck");
+                       show("DynDataMsg", 'inline');
+                       x.checked = false;
+                       y.checked = false;
+               }
+               changeDynCheck();
+       }
+
+       function changeDynCheck() {
+               var s = document.getElementById("DynDataCheckbox");
+               var v = s.checked;
+               if (v) {
+                       show("showID", 'inline');
+                       show("showIDCheck", 'inline');
+               } else {
+                       hide("showID");
+                       hide("showIDCheck");
+               }
+       }
+       
+       function toggleSection(t,s) {
+               var e = document.getElementById(s);
+               if (t.checked) {
+                       show(s,'table-row-group');                      
+               } else {
+                       hide(s);
+               }
+       }
+       function sectionsReset() {              
+               toggleSection(document.getElementById("by_activity_date"),"activity_date_section");
+               toggleSection(document.getElementById("by_registration_date"),"registration_date_section");
+               toggleSection(document.getElementById("by_desired_date"),"desired_date_section");
+       }
+       function fixWait() {
+               show('displayButton', 'inline'); 
+               hide('pleaseWait');
+       }
+       
+</script>
+<FORM ACTION="{this_script}" name="report_selection">
+       <INPUT TYPE="hidden" NAME="Action" VALUE="Rep">
+       <TABLE BORDER="0">
+               <TR onMouseOver="fixWait();">
+                       <TH ALIGN="right">{eventTermCap}(s):</TH>
+                       <TD ALIGN="left">{reg_select}</TD>
+               </TR>
+               <TR onMouseOver="fixWait();">
+                       <TH ALIGN="right">Status:</TH>
+                       <TD ALIGN="left">{status_select}</TD>
+               </TR>
+               <TR onMouseOver="fixWait();">
+                       <TH ALIGN="right">Report by:</TH>
+                       <TD align="left">
+                               <SELECT NAME="output_by" id="output_pick" onchange="changeByFunc();">
+                                       <OPTION VALUE="registration">Requests</option>
+                                       <OPTION VALUE="activity">Activity</option>
+                                       <OPTION VALUE="attendee">{attendeesTermCap}</option>
+                               </SELECT>
+                       </TD>
+               </TR>
+               <TR onMouseOver="fixWait();">
+                       <TH ALIGN="right" id="sort_by_title" style="visibility: visible; display: block;">Sort by:</TH>
+                       <TD align="left">
+                               <SELECT NAME="sort_by" id="sort_by_pick" style="visibility: visible; display: block;">
+                                       <OPTION VALUE="id">Registration ID/Date</option>
+                                       <OPTION VALUE="name">Registrant Name</option>
+                                       <OPTION VALUE="state_city">Registrant State/City</option>
+                               </SELECT>
+                       </TD>
+               </TR>
+               </div>
+               <TR onMouseOver="fixWait();">
+                       <TH ALIGN="right">Output Type:</TH>
+                       <TD align="left">
+                               <SELECT NAME="output_type">
+                                       <OPTION VALUE="web">Output to Web Page</option>
+                                       <OPTION VALUE="csv">Download as CSV file</option>
+                               </SELECT>
+                       </TD>
+               </TR>
+               <tr>
+                       <td colspan="2">&nbsp;</td>
+               </tr>
+               <tr>
+                       <td align="right"><input type="checkbox" id="by_activity_date" name="by_activity_date" onChange="toggleSection(this,'activity_date_section');" {by_activity_date}></td>
+                       <td align="left">Filter by Activity Date</td>
+               </tr>
+               <tbody id="activity_date_section" style="visibility: hidden; display: none;">
+                       <TR onMouseOver="fixWait();">
+                               <TH ALIGN="right">From:</TH>
+                               <TD ALIGN="left">{activity_start_date}</TD>
+                       </TR>
+                       <TR onMouseOver="fixWait();">
+                               <TH ALIGN="right">Through:</TH>
+                               <TD ALIGN="left">{activity_end_date}</TD>
+                       </TR>
+               </tbody>
+               <tr>
+                       <td align="right"><input type="checkbox" id="by_registration_date" name="by_registration_date" onChange="toggleSection(this,'registration_date_section');" {by_registration_date}></td>
+                       <td align="left">Filter by Registration Date</td>
+               </tr>
+               <tbody id="registration_date_section" style="visibility: hidden; display: none;">
+                       <TR onMouseOver="fixWait();">
+                               <TH ALIGN="right">From:</TH>
+                               <TD ALIGN="left">{reg_start_date}</TD>
+                       </TR>
+                       <TR onMouseOver="fixWait();">
+                               <TH ALIGN="right">Through:</TH>
+                               <TD ALIGN="left">{reg_end_date}</TD>
+                       </TR>
+               </tbody>
+               <tr>
+                       <td align="right"><input type="checkbox" id="by_desired_date" name="by_desired_date" onChange="toggleSection(this,'desired_date_section');" {by_desired_date}></td>
+                       <td align="left">Filter by Desired Date</td>
+               </tr>
+               <tbody id="desired_date_section" style="visibility: hidden; display: none;">
+                       <TR onMouseOver="fixWait();">
+                               <TH ALIGN="right">From:</TH>
+                               <TD ALIGN="left">{desired_start_date}</TD>
+                       </TR>
+                       <TR onMouseOver="fixWait();">
+                               <TH ALIGN="right">Through:</TH>
+                               <TD ALIGN="left">{desired_end_date}</TD>
+                       </TR>
+               </tbody>
+               <tr>
+                       <td colspan="2">&nbsp;</td>
+               </tr>
+               <TR onMouseOver="fixWait();">
+                       <TH ALIGN="right">Entered By Admin User:</TH>
+                       <TD align="left">
+                               <select name="admin_user">
+                                       <option value="na">Doesn't matter</option>
+                                       <option value="yes">Yes</option>
+                                       <option value="no">No</option>
+                               </select>
+                       </TD>
+               </TR>
+               <tr>
+                       <td colspan="2">&nbsp;</td>
+               </tr>
+<!--{if:members=YES}-->
+               <TR onMouseOver="fixWait();">
+                       <TH ALIGN="right">Member:</TH>
+                       <TD align="left">
+                               <select name="is_member">
+                                       <option value="na">Doesn't matter</option>
+                                       <option value="yes">Yes</option>
+                                       <option value="no">No</option>
+                               </select>
+                       </TD>
+               </TR>
+               <TR onMouseOver="fixWait();">
+                       <TH ALIGN="right">Member ID:</TH>
+                       <TD align="left"><INPUT TYPE="text" NAME="member_id"></TD>
+               </TR>
+               <tr>
+                       <td colspan="2">&nbsp;</td>
+               </tr>
+<!--{/if:members}-->           
+               <TR onMouseOver="fixWait();">
+                       <TH ALIGN="right" id="DynData"><nobr>Include Dynamic Field Data:</nobr></TH>
+                       <TD align="left">
+                               <span id="DynDataCheck">
+                                       <INPUT TYPE="checkbox" name="dyn_data" id="DynDataCheckbox" onChange="changeDynCheck();">
+                               </span>
+                               <span id="DynDataMsg">Only available when reporting on a single activity.</span>
+                       </TD>
+               </TR>
+               <TR onMouseOver="fixWait();">
+                       <TH ALIGN="right" id="showID"><nobr>Show field IDs rather than titles:</nobr></TH>
+                       <TD align="left">
+                               <span id="showIDCheck">
+                                       <input type="checkbox" id="showIDCheckbox" name="show_id">
+                                       This conserves space in reports.<br>Consider using Custom field IDs in<br>form to make these more obvious.
+                               </span>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD COLSPAN="2" ALIGN="center">
+                               <input type="submit" id="displayButton" name="Option" value="Display Report" onClick="hide('displayButton'); show('pleaseWait', 'inline');">
+                               <div id="pleaseWait" style="visibility: hidden; display: none; text-align: center;" class="lightBorder">
+                                       <hr>
+                                         Please wait while we process your report.
+                                       <hr>
+                               </div>
+                       </TD>
+               </TR>
+       </TABLE>
+</FORM>
+<script>
+       changeDynAvailable();
+       changeDynCheck();
+       sectionsReset();
+</script>
diff --git a/admin/Views/reports_csv.html b/admin/Views/reports_csv.html
new file mode 100644 (file)
index 0000000..eee8a40
--- /dev/null
@@ -0,0 +1 @@
+{body}
diff --git a/admin/Views/reports_print.html b/admin/Views/reports_print.html
new file mode 100644 (file)
index 0000000..a5f5624
--- /dev/null
@@ -0,0 +1,23 @@
+<html>
+  <head>
+    <title>Registration Reports</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+    <META NAME="Author" CONTENT="Gaslight Media">
+    <META http-equiv="Pragma" content="no-cache">
+
+<!--{exclude}-->
+    <link rel="stylesheet" href="{base_app_url}Common/Registrations_V3/admin/style.css">
+<!--{/exclude}-->
+<!--{include}
+    <link rel="stylesheet" href="{stylesheet}">
+{/include}-->
+  </head>
+  <body">
+    <center>
+      <div class="standout">{cust_name}</div>
+  
+      {body}
+      
+    </center>
+  </body>
+</html>
\ No newline at end of file
diff --git a/admin/Views/view_attendees.html b/admin/Views/view_attendees.html
new file mode 100644 (file)
index 0000000..f611ede
--- /dev/null
@@ -0,0 +1,71 @@
+
+               <p>&nbsp;</p>
+        <SPAN CLASS="title1">{eventsTermCap} / {attendeesTermCap}</SPAN>
+          <table border="1">
+<!--{if:have_regs=YES}-->
+
+ <!--{list:detail}-->
+                       <tr><td><table border="0">
+                <tr><th align="left">{eventTermCap}:&nbsp;</th><td align="left">{regname}</td></tr>                
+               <!--{if:date_specific=YES}-->                                   
+                               <tr>
+                                       <th class="thCartLeft">Dates: </th>
+                                       <td class="tdCartLeft" colspan="3">{start_date} through {end_date}</td>
+                               </tr>
+               <!--{/if:date_specific}-->                                      
+                               <tr>
+               <!--{if:ask_date=YES}-->                                        
+                                       <th class="thCartLeft">Desired Date: </th>
+                                       <td class="tdCartLeft" colspan="3">{desired_date}</td>
+               <!--{else:ask_date}
+                                       <th class="thCartLeft">Days: </th>
+                                       <td class="tdCartLeft" colspan="3">{days}</td>
+               {/if:ask_date}-->
+                <tr><th align="left">Selected:&nbsp;</th><td align="left">{rate_class}</td></tr>
+                <tr>
+                  <th align="left" valign="top">{attendeesTermCap}:&nbsp;&nbsp;</th>
+                  <td>
+                      <table width="100%">
+      <!--{list:attendee_array}-->
+                        <tr>
+                            <td colspan="5">
+                                {name}
+                            </td>    
+                        </tr>
+        <!--{if:med_info=t}-->
+                        <tr>                  
+                            <td>&nbsp;</td>
+                            <td>Date of Birth: </td><td>{dob}</td>
+                            <td>&nbsp;&nbsp;&nbsp;&nbsp;Parent/Guardian: </td><td>{guardian}</td>
+                        </tr>
+                        <tr>
+                            <td>&nbsp;</td>
+                            <td>Emergency Contact: </td><td>{emer_contact}</td>
+                            <td>&nbsp;&nbsp;&nbsp;&nbsp;Emergency Phone: </td><td>{emer_phone}</td>
+                        </tr>
+                            <td>&nbsp;</td>
+                            <td>Brief Medical History: </td><td colspan="3">{med_history}</td>
+                        </tr>
+                            <td>&nbsp;</td>
+                            <td>Alergies/Medications: </td><td colspan="3">{allergy_med}</td>
+                        </tr>               
+        <!--{/if:med_info}-->
+      <!--{/list:attendee_array}-->                        
+                      </table>
+                  </td>
+                </tr>
+                       </table></td></tr>                      
+ <!--{/list:detail}-->
+                       
+<!--{else:have_regs}
+            <tr><td>(no attendees listed)</td></tr>
+{/if:have_regs}-->
+          </table>
+          <p>&nbsp;</p>
+          <SPAN CLASS="title1">Original Submission Summary</SPAN>
+          
+          <table>
+              <tr><th colspan="3">Updates do not show in this summary.<br>See above for current data.</th></tr>
+              <tr><td colspan="2">{summary}</td></tr>
+          </table>
+
diff --git a/admin/Views/welcome.html b/admin/Views/welcome.html
new file mode 100644 (file)
index 0000000..0359a80
--- /dev/null
@@ -0,0 +1,1099 @@
+<script>    
+       function show( d )
+       {
+           // Show the selected area
+           document.getElementById(d).style.visibility = 'visible';
+           document.getElementById(d).style.display = 'block';
+       }
+       
+       function hide( d )
+       {
+             // Hide the selected area
+           document.getElementById(d).style.visibility = 'hidden';
+           document.getElementById(d).style.display = 'none';
+       }
+       
+       function toggleVisible( d )
+       {
+               v = document.getElementById(d).style.visibility;
+               b = document.getElementById(d + '_button');
+               if (v == 'hidden') {
+                       show(d);
+                       b.innerHTML = 'Hide';
+               } else {
+                       hide(d);
+                       b.innerHTML = 'Show';
+               }
+       }
+</script>
+
+<h3>System Updates and Information</h3>
+
+<div class="welcome-text">
+<p>Welcome to the Gaslight Media Event Registration System.</p>
+<p>
+       In an effort to provide our customers with the best possible service, Gaslight Media will from time to 
+       time make improvements to this application and correct problems that we have noticed 
+       or that have been reported to us.
+       We will post information regarding such updates here so that you can be aware of improvements 
+       and learn how to use new features. As always, please let us know if you have any concerns,
+       need any assistance, or would like to suggest new features.
+</p>
+<p>
+       Some items below refer to a "configuration option". These options are not customer selectable. Please
+       let us know if you would like to consider a change with one of these options.<br>
+       <h3><button id="config_button" onClick="toggleVisible('config');" style="font-size: 10px;">Show</button>&nbsp;&nbsp;&nbsp;&nbsp;List of configurable options</h3>
+       <div id="config" style="visibility: hidden; display: none;">
+               <p>These are the configurable options for this application. Please let us know if there are any you would like to consider having changed.</p>
+               <p>Most of these options can be applied quickly at any time. Others may require updates to your database or other work to properly implement.</p>               
+               <table border="1">
+                       <tr>
+                               <th style="white-space:nowrap;">General customer information</th>
+                               <td>Your organization name, address, and phone numbers as they appear in this application</td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Integrate with member database</th>
+                               <td>If your Web site has an integrated member database, this application may be able to refer to the member accounts
+                               to permit members to log in when using this application. Their address and contact information will be inserted into
+                               the checkout form and any registgrations they make will be associated with them. It is also possible to provide
+                               special rates for members who log in that way.</td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Registered users</th>
+                               <td>Maintains a list of all users who have completed registrations using this system and permits them to log back in
+                               when making future registrations. The address and contact information they used previously will be inserted into the
+                               checkout form for them and all registrations they make will be associated with them.</td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Additional medical and emergency<br>contact information</th>
+                               <td>Permits requiring additional medical and emergency contact information for selected types of {eventsTerm}.</td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Save contact information</th>
+                               <td>Saves contact information for all users who have registered into your contact database. Requires an existing
+                               contact database in your Web site.</td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Default {eventsTerm} selection</th>
+                               <td>Determines if the default {eventsTerm} selection method is used. This is the standard two-step process of first
+                               selecting a {categoryTerm} then selecting a {subcategoryTerm}. If this is not selected, one of the other selection methods
+                               must be used.</td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Cascading picklist {eventsTerm} selection</th>
+                               <td>Selects whether a cascading picklist method is displayed for {eventsTerm} selection. This method displays a picklist (pull-down list)
+                               of {categoriesTerm} to select from. If {subcategoriesTerm} are being used, once a {categoryTerm} is selected a second
+                               picklist will be populated with {subcategoriesTerm} from the selected {categoryTerm}. The user can then submit that to view
+                               a list of {eventsTerm} in the selected {categoryTerm} or {subcategoryTerm}.<p>
+                               Note that it is possible in most cases to have this picklist selection method displayed in a small form on your Website
+                               so that it is always available regardless of where the user is in your site. Please let us know if this is of interest to you.</td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Select by month</th>
+                               <td>Displays a pick list of months in which {eventsTerm} are available for registration on the initial search page.
+                               This permits user to find activities in a particular month of interest.</td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Select by {eventTerm} code</th>
+                               <td>Permits users to find an {eventTerm} by {eventTerm} code. This is helpful if you publish a list of {eventsTerm}
+                               that include those codes.</td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Show {eventTerm} codes</th>
+                               <td>Displays the {eventTerm} code for an {eventTerm} along with other {eventTerm} information in lists of {eventsTerm} 
+                               and {eventTerm} detail pages.</td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Show past events</th>
+                               <td>Displays past {eventsTerm} in lists and searches. If this is not selected, only current and future {eventsTerm} are 
+                               displayed.</td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Restricted Area</th>
+                               <td>
+                                       Defines a particular Toolbox page as a "restricted" area that will display additional 
+                                       {categoriesTerm} that are not available when on a non-restricted Toolbox page. This would generally be
+                                       used when a particular Toolbox page has login or other restrictions associated with it.
+                               </td>
+                       </tr>   
+                       <tr>
+                               <th style="white-space:nowrap;">Automatic inactive</th>
+                               <td>Automatically marks past {eventsTerm} as inactive. This simplifies lists of {eventsTerm} in your admin area since
+                               inactive {eventsTerm} are not displayed in lists by default.</td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">{categoriesTermCap} on intro page</th>
+                               <td>The initial page is normally used for introduction to the application and possibly for members and
+                               registered users to log back into the system. With this option enabled, the initial page also includes a list of 
+                               available {eventsTerm} {categoriesTerm} from which they may select.</td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Use {categoriesTerm}</th>
+                               <td>This option enables the use of {eventTerm} {categoriesTerm}. If this is not enabled, a list of {eventsTerm} will 
+                               be offered without the use of any {categoriesTerm}.</td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Show empty {categoriesTerm}</th>
+                               <td>Displays {categoriesTerm} in lists and searches even if there are no available {eventsTerm} in the {categoryTerm}.</td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Use {subcategoriesTerm}</th>
+                               <td>This option enables the use of {eventTerm} {subcategoriesTerm} in addition to main {categoriesTerm}. This may be helpful  
+                               to users in situations where there are a large number of {eventsTerm}.</td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Show empty {subcategoriesTerm}</th>
+                               <td>Displays {subcategoriesTerm} in lists and searches even if there are no available {eventsTerm} in the {subcategoryTerm}.</td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Use {eventTerm} {attributesTerm}</th>
+                               <td>This option enables a list of {eventTerm} {attributesTerm} and permits assigning an {attributeTerm} to each {eventTerm}.
+                               Since {attributesTerm} may require changes to how your site works and is used, this capability is turned off by default.</td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Include events in {categoryTerm} lists</th>
+                               <td>When enabled, lists of {categoriesTerm} and/or {subcategoriesTerm} also include any active {eventsTerm} associated with them.
+                               This may be helpful if you would like a single page, organised by {categoriesTerm}, from which users may directly select
+                               {eventsTerm}.</td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Show rates in {eventsTerm} lists.</th>
+                               <td>Displays a rate summary for each {eventTerm} in lists of {eventsTerm}.</td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Show {registrationTerm} cutoff dates.</th>
+                               <td>Determines if the cutoff dates specified under "Rate Options and Dates" when editing a {eventTerm} should
+                               be displayed to users. This may be helpful if you want to permit {registrationTerm} after the {eventTerm} start
+                               date but don't want the user to be told they can do that. For this to make sense, only one cutoff date should be used.</td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Show {instructorTerm} in {eventsTerm} lists.</th>
+                               <td>Determines if the {instructorTerm} is displayed in lists of {eventsTerm}.</td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Show {instructorTerm} in {eventTerm} detail.</th>
+                               <td>Determines if the {instructorTerm} is displayed in {eventTerm} detail pages.</td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Show {eventTerm} specific terms in {eventTerm} detail.</th>
+                               <td>Determines if the {eventTerm} terms and conditions included in the detail for a specific {eventTerm} 
+                               is displayed in {eventTerm} detail pages.
+                               </td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Custom apperance</th>
+                               <td>This application normally uses the styles that are applied to your Web site as a whole. Because of this and the way the content 
+                               of this application is designed, it tends to conform well to the overall Web site appearance of most sites. In some cases, it may be
+                               necessary to override these styles, or if necessary to actually re-organize the way information is being displayed. This application
+                               has been designed to enable a wide range of such customization. Please let us know if you would like to consider changes. 
+                               </td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Payment options</th>
+                               <td>This application supports a range of payment options on checkout.
+                                       <ul>
+                                               <li>Credit Cards - may include any combination of Visa, MasterCard, American Express, Discover, and Diners Club.</li>
+                                               <li>Pay by Check - Accepts checkout but places the {registrationTerm} in an unpaid status till the check is received.</li>
+                                               <li>Cash - Indicates that the user paid, or will pay, cash.</li>
+                                               <li>Comp Code - Permits the user to enter a special code rather than provide payment. 
+                                       </ul>
+                               For each of these, it's possible to specify that they may be seleced by regular users or only selected by admin users who have entered
+                               the application from a link in the Website admin area. For example, if the application may be used at an {eventTerm} to {registerTerm}
+                               people and to accept cash or checks, those payment type may be made available only to staff and not show to normal users who 
+                               {registerTerm} on-line.         
+                               </td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Credit Card payment methods</th>
+                               <td>Several credit card payment methods are available through this application.
+                                       <ul>
+                                               <li>Processing by merchant - Merchant lists {eventsTerm} with pending credit card payments in the admin area and processes those
+                                               cards manually.</li>
+                                               <li>Authorize.net - Cards are processed automatically through Authorise.net when the user checks out. Requires an Authorize.net account.</li>
+                                               <li>Merchant Solutions -  Cards are processed automatically through Merchant Solutions when the user checks out. Requires a Merchant Solutions account.</li>
+                                       </ul>
+                               </td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Billing/Contact fields to show when checkout has no charges</th>
+                               <td>These options specify which billing contact fields are requested when there are no charges at checkout (free {eventsTerm}). For example,
+                               you may not need to request address and phone numbers if there is a free {eventsTerm} and you're mostly interested in getting a count of how many
+                               might attend.  
+                               </td>
+                       </tr> 
+                       <tr>
+                               <th style="white-space:nowrap;">Optional added checkout fields</th>
+                               <td>Set of additional fields that may be enabled in the checkout form. The title for this area of the checkout page, the fields that are used, and the
+                               names for these fields are all configuable. Typically these fields are configured to use for collecting contact information that may be the same or
+                               different from the billing contact information. These fields can therefore be used for a wide range of purposes.
+                               </td>
+                       </tr> 
+                       <tr>
+                               <th style="white-space:nowrap;">Terms used in this system</th>
+                               <td>A wide range of terms that are used this system may be configured to suit your needs. Terms available for configuration are currently 
+                               singular, plural, capitalized, and plural capitilized versions of these terms (and our default tems).
+                                       <ul>
+                                               <li>{eventTerm} (event)</li>
+                                               <li>{registrationTerm} (registration)</li>
+                                               <li>{registerTerm} (register)</li>
+                                               <li>{registeringTerm} (registering)</li>
+                                               <li>{registeredTerm} (registered)</li>
+                                               <li>{categoryTerm} (category)</li>
+                                               <li>{categoriesTerm} (categories)</li>
+                                               <li>{subcategoryTerm} (sub-category)</li>
+                                               <li>{subcategoriesTerm} (sub-categories)</li>
+                                               <li>{instructorTerm} (instructor)</li>
+                                               <li>{instructorsTerm} (instructors)</li>
+                                               <li>{attendeeTerm} (attendee)</li>
+                                               <li>{attendingTerm} (attending)</li>
+                                               <li>{attendedTerm} (attended)</li>
+                                               <li>{memberTerm} (member)</li>
+                                               <li>{user_idTerm} (user ID)</li>
+                                               <li>{passwordTerm} (password)</li>
+                                               <li>{restricted_userTerm} (employee)</li>
+                                               <li>
+                                       </ul>
+                                       These are specific titles and phrases that may be changed. 
+                                       <ul>
+                                               <li>{registrations_title}</li>
+                                               <li>{title_use_payment_comp_code}</li>
+                                               <li>{title_payment_comp_code}</li>
+                                               <li>{title_send_a_check}</li>
+                                               <li>{title_paid_cash}</li>
+                                               <li>{title_pay_by_credit_card}</li>
+                                       </ul>
+                               </td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Default [Submissions] list sorting</th>
+                               <td>The [Submissions] in the admin area of this application may be configured to by default sort by a
+                               particular column and in either an ascending or descending direction. Once the table is displayed, other columns may be used to sort the list by
+                               clicking on the column header. This options simply sets which column is used for sorting when the
+                               list is first displayed.</td>
+                       </tr>
+                       <tr>
+                               <th style="white-space:nowrap;">Default [Submissions] status selection</th>
+                               <td>The [Submissions] list in the adming area of this application may be configured to initially display
+                               submissions matching a specific set of status values. This makes it possible to have the list normally
+                               come up with submissions that have the desired status value, such as all types of pending submissions.
+                               <br>
+                               The status options available include: UNPAID, CC_PEND, CC_PAID, CC_DECL, CHECK_PEND, CHECK_PAID, COMP, AT_EVENT, CASH_PAID, OTHER_ADMIN, FAILED, CANCELED                               
+                               </td>
+                       </tr>
+                       
+               </table>
+       </div>
+</p>
+
+<h2>Recent Updates</h2>
+
+<h3><button id="2014-02-14_button" onClick="toggleVisible('2014-02-14');" style="font-size: 10px;">Hide</button>&nbsp;&nbsp;&nbsp;&nbsp;February 14, 2014</h3>
+<ul id="2014-02-14" style="visibility: visible; display: block;">
+       <h3 style="color: blue;">Minor Output Changes</h3>
+       <li>
+               <b>{eventTermCap} location is now included in registration confirmation E-Mail messages and stored summaries.</b>
+               <p>
+                       Due to customer requests, we have added the {eventTerm} location in all E-Mail messages and stored summaries for
+                       any new {registrationTerm} requests. If no location is provided for the {eventTerm}, the location line will not 
+                       be included in these E-Mail messages or summaries.       
+               </p>
+               <p>
+                       Note that summaries stored before this change will not include the location information.
+               </p>
+       </li>
+</ul>
+
+<h3><button id="2013-10-30_button" onClick="toggleVisible('2013-10-30');" style="font-size: 10px;">Hide</button>&nbsp;&nbsp;&nbsp;&nbsp;October 30, 2013</h3>
+<ul id="2013-10-30" style="visibility: hidden; display: none;">
+    <h3 style="color: blue;">Update to Form Processing</h3>
+    <li>
+        <b>{eventTermCap} forms now support simple to sophisticated numeric calculations.</b>
+        <p>
+            We added a "Calculated Field" field option to the user configurable forms that may be included with each {eventTerm}. A
+            calculated field is one that includes a formula consisting of the values of other fields along with a range of mathematical
+            operators and functions. 
+        </p><p>
+            Fields that may have numeric values and that may be used in these formulas include "Number" fields
+            and "Checkbox", "Picklist", and "Radio Buttons" that have values assigned to their options. Formulas may be as simple as 
+            adding the values of certain fields to as complex as using a mix of mathematical functions to perform complex calculations. 
+        </p>
+        </p><p>
+            The result of these calculations is reported as a value for the "Calculated Field" along with other field data.
+        </p>
+    </li>
+    <li>
+        <b>Certain Edit and Update operations now display the updated information after being submitted.</b>
+        <p>
+            We updated this application to redisplay the added or updated information after submitting with the "Add New" or "Update" button.
+            It used to be that after adding or updating certain information you were required to find the new or updated item in a list. This
+            should no longer be the case and should reduce work while performing these operations. 
+        </p>
+    </li>
+</ul>
+
+
+<h3><button id="2013-09-13_button" onClick="toggleVisible('2013-09-13');" style="font-size: 10px;">Hide</button>&nbsp;&nbsp;&nbsp;&nbsp;September 13, 2013</h3>
+<ul id="2013-09-13" style="visibility: hidden; display: none;">
+       <h3 style="color: blue;">Minor Fixes and Feature Additions</h3>
+       <li>
+               <b>{eventTermCap} specific terms and conditions now available in {eventTerm} detail pages.</b>
+               <p>
+                       We added the ability to have {eventTerm} specific terms and conditions included in the {eventTerm} detail pages. These
+                       terms and conditions were previously only being displayed in the checkout pages. Please let us know if you would like
+                       this to also be displayed in the {eventTerm} detail pages users see when selecting a specific {eventTerm}.     
+               </p>
+       </li>
+       <li>
+               <b>Fixed problem with loss of text formatting when adding {eventsTerm}.</b>
+               <p>
+                       In certain cases text formatting entered would be lost when adding an {eventTerm}. This problem may have affected other areas where text
+                       is entered into one of the formatted text editors when using [Add] to create a new entry. This should now be corrected.  
+               </p>
+       </li>
+       <li>
+               <b>Added option for restricting specific {categoriesTerm} to a particular Toolbox page.</b>
+               <p>
+                       Added the ability to define a particular Toolbox page as a "restricted" area that will display additional 
+                       {categoriesTerm} that are not available when on a non-restricted Toolbox page. This would generally be
+                       used when a particular Toolbox page has login or other restrictions associated with it. Contact Gaslight
+                       Media if you might be interested in using this option.  
+               </p>
+       </li>
+</ul>
+
+
+<h3><button id="2013-09-09_button" onClick="toggleVisible('2013-09-09');" style="font-size: 10px;">Hide</button>&nbsp;&nbsp;&nbsp;&nbsp;September 9, 2013</h3>
+<ul id="2013-09-09" style="visibility: hidden; display: none;">
+       <h3 style="color: blue;">Minor Fix and Feature Addition</h3>
+       <li>
+               <b>Fixed problem with loss of text formatting when adding {eventsTerm}.</b>
+               <p>
+                       In certain cases text formatting entered would be lost when adding an {eventTerm}. This problem may have affected other areas where text
+                       is entered into one of the formatted text editors when using [Add] to create a new entry. This should now be corrected.  
+               </p>
+       </li>
+       <li>
+               <b>Added option for restricting specific {categoriesTerm} to a particular Toolbox page.</b>
+               <p>
+                       Added the ability to define a particular Toolbox page as a "restricted" area that will display additional 
+                       {categoriesTerm} that are not available when on a non-restricted Toolbox page. This would generally be
+                       used when a particular Toolbox page has login or other restrictions associated with it. Contact Gaslight
+                       Media if you might be interested in using this option.  
+               </p>
+       </li>
+</ul>
+
+<h3><button id="2013-05-28_button" onClick="toggleVisible('2013-05-28');" style="font-size: 10px;">Hide</button>&nbsp;&nbsp;&nbsp;&nbsp;May 28, 2013</h3>
+<ul id="2013-05-28" style="visibility: hidden; display: none;">
+       <h3 style="color: blue;">Additional Reporting Field - E-Mail Address</h3>
+       <li>
+               <b>Added E-Mail address field to reports by "Activity"</b>
+               <p>
+                       The {registrationTerm} E-Mail address that was supplied at the time the {registrationTerm} was submitted is now included in both on-screen
+                       and CSV (spreadsheet) reports when "Activity" is selected for "Report by:". Note that this is not the E-Mail address for the individual registrants
+                       when multiple registrants are submitted, but rather the primary contact E-Mail address submitted with the request.
+               </p>
+       </li>
+</ul>
+
+<h3><button id="2013-03-21_button" onClick="toggleVisible('2013-03-21');" style="font-size: 10px;">Hide</button>&nbsp;&nbsp;&nbsp;&nbsp;March 21, 2013</h3>
+<ul id="2013-03-21" style="visibility: hidden; display: none;">
+       <h3 style="color: blue;">Additional configuration options</h3>
+       <li>
+               <b>Added ability to limit the number of billing contact fields requested at checkout when there is no charge.</b>
+               <p>
+                       In situations where there are no charges at checkout, which can happen if they select only free {eventsTerm}, you
+                       may not need or what the user to submit the full set of information that is normally requested for the Billing contact. It's
+                       now possible for us to configure the fields you would like to exclude when checkout is free. All billing contact fields will still
+                       be displayed and required when there are charges at checkout. Please let us know if you would like to have these settings adjusted.
+               </p>
+       </li>
+       <li>
+               <b>Improved control over the body of various E-Mail messages sent by this application.</b>
+               <p>
+                       You may now specify the Subject line and content for several types of E-Mail messages sent by this system. The settings for these 
+                       can be found at the bottom of the [Misc] option page in your admin area for this application. These settings may also include certain
+                       information from the current {registrationTerm} in the body of the messages using tags like "{recipient}".
+               </p>
+               <p>
+                       You may edit these yourself. These changes will take effect immediately. Please let us know if you would like assistance with the use of the
+                       the "{}" tags for including information from the {registrationTerm}.  
+               </p>
+       </li>
+       <li>
+               <b>More configurable options for checkout page.</b>
+               <p>
+                       We have added more configurable options to control checkout page behavior. These options make it possible to have different required 
+                       billing information fields for each type of payment, if desired. Previously, if there were any charges on checkout, the user was
+                       required to fill out complete "billing information" including name, full address, and phone numbers. It's now possible to reduce the
+                       required informatin for certain billing types. For example, if paying by cash or check, the complete address and phone numbers may 
+                       not be necessary. Please call us if you would like to discuss these options. 
+               </p>
+               <p>
+                       Note that an E-Mail address is still always required.
+               </p>
+       </li>
+       <li>
+               <b>{registrationTermCap} level selection no longer required if only one level available.</b>
+               <p>
+                       If there is only one {registrationTerm} level for a particular {eventTerm}, users will no longer see a request to select a level and will
+                       no longer be required to select that one level. This simplifies user interaction and reduces confusion. The level description and level
+                       name will still be displayed to the user.
+               </p>
+       </li>
+       <li>
+               <b>Improved "Wait" messages when certain buttons are clicked.</b>
+               <p>
+                       The "Wait" message displayed on certain steps when a button is clicked have been improved to make it more obvious what is taking place
+                       and that the user needs to wait for the result to be displayed. This message replaces the button to prevent users from clicking the 
+                       button twice and causing duplicate submissions. Occasionally users became confused as to what to expect. This should help relieve that 
+                       confusion.
+               </p>
+       </li>
+       
+</ul>
+
+<h3><button id="2013-02-19_button" onClick="toggleVisible('2013-02-19');" style="font-size: 10px;">Hide</button>&nbsp;&nbsp;&nbsp;&nbsp;February 19, 2013</h3>
+<ul id="2013-02-19" style="visibility: hidden; display: none;">
+       <h3 style="color: blue;">Major Version Upgrade: Version 3</h3>
+       <li>
+               <b>Added ability to override payment options by {eventTerm}.</b>
+               <p>
+                       A new section and new fields have been added to the screen for editing a {eventTerm} in the admin area. These "Payment Options"
+                       let you override checkout payment options for a specific {eventTerm}. Checking one of the options in this area will cause that
+                       payment option to only be available to administrative users. Regular front-end users will not see that payment option at checkout
+                       if that specific {eventTerm} has been selected.    
+               </p>
+               <p>
+                       Available payment options are configured for you when we install and configure this application for your site. These may include
+                       payment by credit card, cash, check, or by entering a comp-code. For each type of payment, we can completely disable it, make it
+                       only accessible to administrative users, or make it useable by all front-end users. These override fields can only affect those
+                       payment options set to be available to all front-end users. Please let us know if you need any changes related to these options.
+               </p>
+               <p>
+                       Please note that since this application lets users select multiple {eventsTerm} and then pay for them as a group, payment options
+                       that have been overriden for any of the selected {eventsTerm} will not be available for payment for the other {eventsTerm}. If the 
+                       user were then to remove the one {eventTerm} from their cart that has the payment overide set, that payment type would again be available
+                       to them on checkout. 
+               </p>
+       </li>
+       <li>
+               <b>Ability to limit number of {attendeesTerm} per {registrationTerm}.</b>
+               <p>
+                       It is now possible to limit the number of {attendeesTerm} who may be submitted for each {registrationTerm}. This feature is only used if 
+                       "Ask for {attendeesTerm}" is selected for the event. Note that this is not the maximum number of {attendeesTerm} for the entire {eventTerm}, 
+                       but only the number who can be entered for an individual {eventTerm} submission.
+               </p>
+       </li>
+       <li>
+               <b>Calendar of available dates for {registrationsTerm} that ask for a desired date.</b>
+               <p>
+                       {registrationsTermCap} that are set to ask for a desired date may now have specific dates that the user may select. A new [Dates Calendar] admin menu
+                       option displays a set of calendars, one year at a time, in which specific dates may be selected when the {registrationTerm} is available. The 
+                       front-end user will only be able to select available dates from the pop-up calendar.
+               </p>
+       </li>
+       <li>
+               <b>A problem with listing and editing {attendeesTerm} in sites that don't use {subcategoriesTerm} has been fixed.</b>
+               <p>
+                       A problem was reported where lists of {attendeesTerm} did not properly display when viewing a {registrationTerm} in the administration area. 
+                       It was also reported that it was not possible to edit the list of {attendeesTerm} for a submitted {registrationTerm}. Both of these
+                       problems were only affecting sites that do not use {subcategoriesTerm} and both problems have now been fixed. 
+               </p>
+       </li>
+       <li>
+               <b>Support added for additional fields in checkout form.</b>
+               <p>
+                       Support has been added for a limited set of additional fields of requested data in the {registrationsTerm} checkout page. 
+                       This capability is turned off by default but may be enabled on request. The default for these fields, if enabled, is name,
+                       address, and telephone numbers for a main contact that might be the same or different from the billing information. The title 
+                       of this area, the names of the various fields, and which fields to display is also configurable. Because of this, the additional
+                       fields may be used for a variety of purposes. Please contact Gaslight Media if you would like to discuss enabling these fields.
+               </p>
+       </li>
+       <li>
+               <b>The subject and notification messsage sent in E-Mail to {instructorsTerm} when a {eventTerm} {registrationTerm} is submitted is now editable.</b>
+               <p>
+                       You may now edit the subject line and the introduction message sent in E-Mail to {instructorsTerm} when a {registrationTerm} is 
+                       submitted. To edit these items, use the [Misc] menu item in the administration area. You'll find these fields near the bottom.
+               </p>
+       </li>
+       <li>
+               <b>The subject and notification messsage sent in E-Mail to {attendeeTerm} when a {eventTerm} {registrationTerm} is submitted is now editable.</b>
+               <p>
+                       You may now edit the subject line and the introduction message sent in E-Mail to {attendeeTerm} when a {registrationTerm} is 
+                       submitted. To edit these items, use the [Misc] menu item in the administration area. You'll find these fields near the bottom.
+               </p>
+       </li>
+       <li>
+               <b>Certain text fields in administration area now retain formatting and are more language compliant.</b>
+               <p>
+                       Certain text fields in the administration area will now retain some formatting and are more compliant with the characters used
+                       in various languages. You are encouraged to keep formatting in these fields to a minimum, but line and paragraph breaks, bolding,
+                       italics, tables, and (within reason) text sizes and colors may be used. 
+               </p>
+               <p>
+                       Please note that you use of the "Source" button, which permits editing the HTML codes directly, is discouraged as errors can cause
+                       serious problems with the entire Web page. Please let us know if you would like this button completely dissabled.
+               </p>  
+       </li>
+       <li>
+               <b>Text area fields now more readable in administration area.</b>
+               <p>
+                       When viewing information in the administration area, text fields that accommodate more than one line of text now will be displayed with a light border around them. 
+                       This makes it easier to see what text is associated with which field. There will not be a border around text fields that only accept a single line. Text fields 
+                       that have no content will now be indicated as "( no text supplied )" when viewing the information in the administration area. No change has been made to how
+                       this text is displayed to users on the front-end, this is simply to make use of the administration area a bit easier. 
+               </p>
+       </li>
+       <li>
+               <b>Cutoff dates no longer required for {eventsTerm} that are not date-specific.</b>
+               <p>
+                       {eventsTermCap} that are not date-specific no longer require a cutoff date. This permits creation of {eventsTerm} that can be used
+                       indefinately.  Also, when date-specific is not selected, only the first cutoff date settings and rates are displayed when editing
+                       or viewing an {eventTerm}.
+               </p>
+       </li>
+       <li>
+               <b>Added desired date request field for {eventsTerm} that are not date-specific.</b>
+               <p>
+                       You may now set an {eventTerm} to request a desired date from the user as they submit their {registrationTerm}. This will
+                       only be requested when the {eventTerm} is set to NOT BE date-specific. This permits you to have {eventsTerm} that are 
+                       perpetual but where you would like to know when they may be {attendingTerm}.
+               </p>
+       </li>
+       <li>
+               <b>More terms are now configurable.</b>
+               <p>
+                       It is now possible to have us configure the specific words you'd like to use for certain additional terms. These include terms 
+                       for {categoriesTerm}, {subcategoriesTerm}, and {instructorsTerm}. To see a complete list of configurable terms, click on the "Show"
+                       button above for the "List of configurable options".
+               </p>
+       </li>
+       <li>
+               <b>Certain information for each {eventTerm} in lists and detail pages can be dissabled.</b>
+               <p>
+                       We added more configuable options to determine if certain types of information is displayed in lists or detail pages of
+                       {eventsTerm}. Please let us know if there's certain {eventTerm} information you would like to have displayed or not have displayed. 
+               </p>
+       </li>
+       <li>
+               <b>Improved display and management of {categoriesTerm} and {subcategoriesTerm}.</b>
+               <p>
+                       Some of our customers who are using {subcategoriesTerm} in this system found that having {subcategoryTerm} names that are the
+                       same under different {categoriesTerm} caused confusion. To avoid this we added more information to the {eventTerm} view and edit
+                       pages in the admin area. The selected {categoryTerm} is now displayed in most of these pages. Also, when selecting a 
+                       {subcategoryTerm} for a particular {eventTerm}, the pick-list now displays both the {categoryTerm} and the {subcategoryTerm}.  
+               </p>
+       </li>
+       <li>
+               <b>Duration field added to {eventsTerm}.</b>
+               <p>
+                       A "Duration" field has been added to {eventsTerm}. This is a new descriptive field in which you can place an explanation
+                       of the duration or length of time for the {eventTerm}. If this field is empty, that field and the associated title for it are
+                       not displayed to the user.    
+               </p>
+       </li>
+       <li>
+               <b>The [Enter New Registration] link in the admin area now takes you directly to an {eventTerm}.</b>
+               <p>
+                       The [Enter New Registration] link at the top of the page in the admin area normally takes you directly to the front-end
+                       area for {registrationsTerm}. Now, if you are viewing a particular {eventTerm}, this link will take you directly to that
+                       {eventTerm} in the front-end.
+               </p>
+       </li>
+       <li>
+               <b>A "{attributeTerm}" field feature has been added to this system.</b>
+               <p>{attributeTerm}
+                       You may now create a list of {eventTerm} {attributesTerm} and assign an {attributeTerm} to each {eventTerm}. This means 
+                       that you may now have another way to idetify and search {eventsTerm}. These {attributesTerm} are independant of {categoriesTerm}
+                       and {subcategoriesTerm}.
+               </p>
+               <p>
+                       Since {attributesTerm} may require changes to how your site works and is used, this capability is turned off by default. Please 
+                       let us know if you would like to have this capability enabled and integrated into your site.  
+               </p>
+       </li>
+               
+</ul>
+
+<h3><button id="2012_button" onClick="toggleVisible('2012');" style="font-size: 10px;">Hide</button>&nbsp;&nbsp;&nbsp;&nbsp;2012 Updates</h3>
+<span id="2012" style="visibility: hidden; display: none;">
+
+<h3><button id="2012-12-18_button" onClick="toggleVisible('2012-12-18');" style="font-size: 10px;">Hide</button>&nbsp;&nbsp;&nbsp;&nbsp;December 18, 2012</h3>
+<ul id="2012-12-18" style="visibility: hidden; display: none;">
+       <li>
+               <b>Fixed problem with {eventTerm} notification not being sent to listed {eventTerm} contacts.</b>
+               <p>
+                       A problem was reported in which {eventTerm} contacts were not reciving notification when a {registrationTerm} occured. 
+               </p>
+               <p>
+                       When editing an {eventTerm}, there is a set of fields listed as "E-Mail Notification To". These fields may hold one or more
+                       E-Mail addresses of additional contacts you would like notified each time someone submits a {registrationTerm}. Adding a notification 
+                       address will result in an additional field being created for an additional address. It is, however, best to not list any 
+                       more than 4 addresses for each {eventTerm}.
+               </p>
+               <p>
+                       This notification is separate from the notification you recieve for each {registrationTerm}. Those notifications were not
+                       affected by this problem. 
+               </p>
+       </li>
+</ul>
+
+<h3><button id="2012-11-29_button" onClick="toggleVisible('2012-11-29');" style="font-size: 10px;">Hide</button>&nbsp;&nbsp;&nbsp;&nbsp;November 29, 2012</h3>
+<ul id="2012-11-29" style="visibility: hidden; display: none;">
+       <li>
+               <b>Added option to show or not show {registrationTerm} cutoff dates.</b>
+               <p>
+                       It is now possible to have the {registrationTerm} cutoff dates appear or not appear in lists and {eventsTerm} detail pages
+                       to front-end users. 
+               </p>
+       </li>
+</ul>
+
+<h3><button id="2012-11-14_button" onClick="toggleVisible('2012-11-14');" style="font-size: 10px;">Hide</button>&nbsp;&nbsp;&nbsp;&nbsp;November 14, 2012</h3>
+<ul id="2012-11-14" style="visibility: hidden; display: none;">
+       <li>
+               <b>Added configuration option to display rates and prices in {eventTerm} lists</b>
+               <p>
+                       This application may now be configured to display rates and prices in lists of {eventsTerm}. If enabled, it will attempt to display a textual description of the
+                       available rates and prices, associated cutoff dates, available rate options, per {attendeeTerm} charges, and the number of {attendeesTerm}
+                       included in the base rates.        
+               </p>
+       </li>
+</ul>
+
+<h3><button id="2012-11-08_button" onClick="toggleVisible('2012-11-08');" style="font-size: 10px;">Show</button>&nbsp;&nbsp;&nbsp;&nbsp;November 8, 2012</h3>
+<ul id="2012-11-08" style="visibility: hidden; display: none;">
+       <li>
+               <b>Fixed problem with formating being stripped from large text (description) fields in admin area.</b>
+               <p>
+                       A problem was introduced in the last major update that caused some text formatting in description fields to be lost when submitted
+                       in the admin areas. This was a result of a global security feature used to protect the system from nefarious input, part of which 
+                       should not have been applied to these larger text fields. This has been corrected.
+               </p>
+       </li>
+</ul>
+
+<h3><button id="2012-11-01_button" onClick="toggleVisible('2012-11-01');" style="font-size: 10px;">Show</button>&nbsp;&nbsp;&nbsp;&nbsp;November 1, 2012</h3>
+<ul id="2012-11-01" style="visibility: hidden; display: none;">
+       <li>
+               <b>Updated to support new system software and PCI DSS compliance</b>
+               <p>
+                       This application has been updated to be compatible with new server system software. Technically, we updated the code to work with PHP 5.3 and later.
+                       This update ensures that the application will continue to have a migration path to new servers as we deploy them. More importantly for our customers,
+                       the new system software and the way we have it deployed is a much more restrictive security environment. This will be important for customers doing 
+                       credit card processing since banks and card clearing houses are more and more insisting on compliance with the "Payment Card Industry Data Security Standard"
+                       (PCI DSS Compliance).      
+               </p>
+               <p>
+                       Your bank, credit card processor, or credit card clearing house may require PCI Compliance or may ask for that in the future. Please contact us if 
+                       this becomes the case so we can work with them and you to provide certification. This generally requires a third-party security scan of your Web site and the
+                       applications associated with it along with the completion of a form specifying various aspects of your Web site, the systems behind it, and the
+                       process by which you handle credit card information. Gaslight Media has specific systems that we maintain as PCI compliant for those requiring that.
+                       Now with this application updated to the new system software, it too should be compatible with PCI compliance. Please contact us if you need
+                       additional information.        
+               </p>
+       </li>
+       <li>
+               <b>Report processing enhanced to permit significantly larger reports</b>
+               <p>
+                       A problem came up earlier where a customer was attempting to produce reports with a large number of {eventsTerm} and attendees along with 
+                       considerable additional form data in which our systems were simply running out of memory. We have now made additional changes to report to 
+                       permit considerably larger reports without exhausting system memory.               
+                       You should now be able to produce reports in which there are many thousands of entries with a few form fields or as many as several thousand 
+                       entries with a large number of form fields (perhaps 50 or more).         
+               </p>
+       </li>
+       <li>
+               <b>CSV (spreadsheet) reports have been reworked to be more usable in spreadsheets</b>
+               <p>
+                       Previously, some of these reports included extra rows of headers to permit CSV output that could include the data from multiple forms. 
+                       This turned out to be unusable for further processing in spreadsheets or for import into other database programs. Now reports may only have
+                       output of the additional form data selected when reporting on a single {eventsTerm}, but those reports now have the form data headers
+                       at the top of the sheet rather than mixed in with each result. In addition, each line of the report includes all data relevant to that
+                       result so data is not orphaned when sorting the spreadsheet. 
+               </p>
+               <p>
+                       It is also now possible to select the form field IDs for the headers instead of the field titles. In situations where customers were using
+                       long form field titles, the reports because diffiult to read and manage. Note that if you click on the field IDs when editing a form, that
+                       you can provide a custom ID that would better relate to the data. Also note that keeping field titles shorter is generally a good idea. Each
+                       input field can include a more extensive description in addition to the title. Keeping the title short and using the description for additional
+                       direction to the user will not only keep your forms better organized, but will help when reporting with field titles.
+               </p>
+       </li>
+</ul>
+
+<h3><button id="2012-10-25_button" onClick="toggleVisible('2012-10-25');" style="font-size: 10px;">Show</button>&nbsp;&nbsp;&nbsp;&nbsp;October 25, 2012</h3>
+<ul id="2012-10-25" style="visibility: hidden; display: none;">
+       <li>
+               <b>Admin usability issues with recent Internet Explorer browsers</b>
+               <p>
+                       A problem was reported with certain admin area pages that didn't function properly or look right
+                       when viewed with certain current versions of Internet Explorer. These problems included alignment 
+                       of some input fields and difficulty submitting report requests. These problems have been corrected.
+               </p>
+       </li>
+       <li>
+               <b>Server memory could be exhausted when producing reports</b>
+               <p>
+                       A problem was reported where an attempt to produce certain reports resulted in our servers running out
+                       of memory available to the report. This would only happen if the conferences included a complex form and there were a large 
+                       number of submissions (hundreds). We have made changes to avoid this problem for now, but will be making 
+                       further changes to fully eliminate the problem in the future and to permit reports containing thousands
+                       of submissions with large forms.
+               </p>
+       </li>
+</ul>
+
+<h3><button id="2012-10-16_button" onClick="toggleVisible('2012-10-16');" style="font-size: 10px;">Show</button>&nbsp;&nbsp;&nbsp;&nbsp;October 16, 2012</h3>
+<ul id="2012-10-16" style="visibility: hidden; display: none;">
+       <li>
+               <b>Checkout problems caused by form text pasted in from some word processing applications corrected</b>
+               <p>
+                       We noticed that it was possible to paste some types of text that was copied from some word processing programs into form fields
+                       that would cause problems when the user attempted to submit the checkout form. Measures were added to exclude the character
+                       codes that were causing this.   
+               </p>
+               <p>
+                       This change may mean that some formatting and odd characters copied from these word processing programs may not be included
+                       in the stored user input. However, all actual user text will be preserved.
+               </p>
+       </li>
+       <li>
+               <b>Additional tests have been added to detect problems on checkout</b>
+               <p>
+                       We added more tests to make sure that checkout problems are properly detected and reported, and added more explicit 
+                       messages so that users will better understand what happened. In doing so, we also added tests to make sure that a 
+                       user's credit card is never charged multiple times due to repeated attempts to resubmit the checkout page.    
+               </p>
+               <p>
+                       In the event that there is a problem storing a request but the user's credit card had already been charged,
+                       an E-Mail will immediately be sent to your contact address notifying you of this problem. That E-Mail will 
+                       include as much user contact information as possible. This information will also help you identify any
+                       related credit card transactions and permit you to contact the user as soon as possible. 
+               </p>
+       </li>
+</ul>
+
+<h3><button id="2012-10-10_button" onClick="toggleVisible('2012-10-10');" style="font-size: 10px;">View</button>&nbsp;&nbsp;&nbsp;&nbsp;October 10, 2012</h3>
+<ul id="2012-10-10" style="visibility: hidden; display: none;">
+       <li>
+               <b>Issue regarding incorrect attendee counts showing in {eventsTerm} corrected</b>
+               <p>
+                       Some {eventsTerm} have been displaying incorrect attendee counts while the Reports displayed the correct number of attendees. This has been
+                       corrected and the processes for updating the attendee counts has been reverified. All attendee counts in {eventsTerm} were subsequently reconciled
+                       and discrepancies corrected.     
+               </p>
+               <p>
+                       It was also noticed that the system was not maintaining proper counts for some {eventsTerm} that do not have attendee limits. This has also been corrected.
+               </p>
+               <p>
+                       Note that only {eventsTerm} that ask for attendees report these counts. If you do not ask for attendees, you will see no changes.
+               </p>
+       </li>
+</ul>
+
+<h3><button id="2012-10-5_button" onClick="toggleVisible('2012-10-5');" style="font-size: 10px;">Show</button>&nbsp;&nbsp;&nbsp;&nbsp;October 5, 2012</h3>
+<ul id="2012-10-5" style="visibility: hidden; display: none;">
+       <li>
+               <b>Issues with Internet Explorer version 9 resolved</b>
+               <p>
+                       Users with certain versions of Internet Explorer who have certain setting configured were reporting problems with using a few of the 
+                       buttons in this system. Those problems have been corrected. Please report any additional problems that occur with specific Web
+                       browsers.  
+               </p>
+       </li>
+</ul>
+
+<h3><button id="2012-09-18_button" onClick="toggleVisible('2012-09-18');" style="font-size: 10px;">Show</button>&nbsp;&nbsp;&nbsp;&nbsp;September 18, 2012</h3>
+<ul id="2012-09-18" style="visibility: hidden; display: none;">
+       <li>
+               <b>Sub-Form problems with duplicated {eventsTerm} resolved</b>
+               <p>
+                       One customer reported problems with sub-forms after duplicating an {eventTerm}. When sub-forms in a duplicated form were edited,
+                       it was possible that sub-forms of the original {eventTerm} were also modified. This problem only affected sub-forms.  
+               </p>
+               <p>
+                       This problem has now been resolved and a process has been run to correct all existing forms. However, if you do use 
+                       sub-forms, have used the {eventTerm} [Duplicate] feature, and then edited the duplicate, you should check your forms to make sure
+                       they are correct.
+               </p>
+       </li>
+       <li>
+               <b>Additional data from forms being added to reports</b>
+               <p>
+                       Reports, including CVS output of reports, may now include all form data that was submitted by the user. There is a
+                       checkbox option for reports to indicate if you would like this data included in the report.
+               </p>
+       </li>
+</ul>
+
+<h3><button id="2012-09-11_button" onClick="toggleVisible('2012-09-11');" style="font-size: 10px;">Show</button>&nbsp;&nbsp;&nbsp;&nbsp;September 11, 2012</h3>
+<ul id="2012-09-11" style="visibility: hidden; display: none;">
+       <li>
+               <b>Output clean-up for cart and checkout completed - Style override now possible </b>
+               <p>
+                       Some sites were having problems with the layout and justification of information in the cart and checkout pages.
+                       Most of these problems were traced to incompatibilities between the Event Registration application styles and the main 
+                       Web site styles. Those issues have now been resolved. 
+               </p>
+               <p>
+                       A side benefit of this work is that we can now easily override specific style attributes in the Event Registration application
+                       for individual customer Web sites. For example, it's now easy for us to change the color of a border, background, or text
+                       in the Event Registration application to better match the appearance of the Web site.
+               </p>
+               <p>
+                       Please let us know if you have concerns about specific appearance issues.
+               </p>
+       </li>
+       <li>
+               <b>Credit Card authorization codes now searchable</b>
+               <p>
+                       A new filter field has been added to the [Submissions] list in the admin area for the Event Registration application
+                       to permit searching for submissions with specific credit card authorization codes.
+               </p>
+               <p>
+                       Note that you may want to select "Paid by Credit Card" for Status or simply leave that blank to make sure you find
+                       the desired submissions. Also note that, as it is with most of the other filter fields, you may enter any portion of
+                       the authorization code and the system will locate any entries where that match anywhere in the Credit Card authorization code. 
+               </p>
+       </li>
+</ul>
+
+<h3><button id="2012-09-05_button" onClick="toggleVisible('2012-09-05');" style="font-size: 10px;">Show</button>&nbsp;&nbsp;&nbsp;&nbsp;September 5, 2012</h3>
+<ul id="2012-09-05" style="visibility: hidden; display: none;">
+       <li>
+               <b>Enhanced ability to override the appearance of front-end content visible to users</b>
+               <p>
+                       Much of the appearance of the front-end content area for this Event Registration Application may be 
+                       customized to match the look of each customer's Web site appearance. Some changes were made to make
+                       this customization easier to do when only minor style changes are desired. 
+               </p>
+               <p>
+                       Please contact us if you would like consider changes to the appearance of this Event Registration Application.
+               </p>
+       </li>
+       <li>
+               <b>Fixed some chart and checkout layout issues</b>
+               <p>
+                       In some cases for certain customers the positioning of certain elements (generally dollar values) in the 
+                       Cart, Checkout, and summary pages was wrong. This has been fixed. 
+               </p>
+       </li>
+</ul>
+
+<h3><button id="2012-09-01_button" onClick="toggleVisible('2012-09-01');" style="font-size: 10px;">Show</button>&nbsp;&nbsp;&nbsp;&nbsp;September 1, 2012</h3>
+<ul id="2012-09-01" style="visibility: hidden; display: none;">
+       <li>
+               <b>Ability to set default behavior for lists in the administration area of Event Registration System </b>
+               <p>
+                       Due to a customer request, it's now possible for us to set a default column and direction for ordering of 
+                       items in the [Submissions] list. You may still click on a column header in most of the administration lists to
+                       have the list sorted by that column or to change the direction in which it's sorted.   
+               </p>
+               <p>
+                       It's also now possible to set a different default selection for the "Status" pick-list displayed at the top of the
+                       [Submissions] list. You may of course override that selection by clicking on other items.
+               </p>
+               <p>
+                       Please let us know if you would like us to set the defaults for this or other lists to something different than how
+                       it is now. 
+               </p>
+               <p>
+                       <b>Hint:</b> Press the "Shift" or "Ctrl" key when clicking on the "Status" pick-list to select more than one option.
+               </p>
+       </li>
+</ul>
+
+<h3><button id="2012-08-30_button" onClick="toggleVisible('2012-08-30');" style="font-size: 10px;">Show</button>&nbsp;&nbsp;&nbsp;&nbsp;August 30, 2012</h3>
+<ul id="2012-08-30" style="visibility: hidden; display: none;">
+       <li>
+               <b>New Credit Card Payment Gateway Added</b>
+               <p>
+                       This Event Registration System is now capable of processing credit cards through Merchant Solutions. 
+               </p>
+               <p>
+                       http://www.merchantsolution.com/
+               </p>
+               <p>
+                       In addition to Merchant Solutions, this system is capable of processing credit cards through Authorize.net 
+                       or can hold card data for manual processing. Please let us know if you would like to change how 
+                       cards are processed on your site.
+               </p>
+       </li>
+       <li>
+               <b>Toolbox ID now intelegent</b>
+               <p>
+                       The Event Registration System is now more intelligent regarding the GLM Toolbox ID it uses. 
+                       Previously, if different menu options (Toolbox pages) were used to access this application, the currently selected menu would
+                       change as the user progressed into this application. This no longer happens.
+               </p>
+               <p>
+                       This permits any number of Toolbox pages to be associated with this application and to target specific {categoriesTerm} or  
+                       {eventsTerm} without confusion and without having to turn on the Toolbox page for this application.
+               </p>
+       </li>
+</ul>
+
+<h3><button id="2012-08-24_button" onClick="toggleVisible('2012-08-24');" style="font-size: 10px;">Show</button>&nbsp;&nbsp;&nbsp;&nbsp;August 24, 2012</h3>
+<ul id="2012-08-24" style="visibility: hidden; display: none;">
+       <li>
+               <b>{eventTermCap} Codes may now be displayed to users</b>
+               <p>
+                       {eventTermCap} Codes may now be displayed with {eventTerm} data in listings and detail pages. 
+                       A configuration option has been added to enable/dissable this feature. Please contact us if you would like the setting for your site changed.
+               </p>
+       </li>
+       <li>
+               <b>Corrected {eventTermCap} Code field title in Admin</b>
+               <p>
+                       The "{eventTermCap} Code" field for listing, displaying, and editing {eventsTerm} was previously marked as for "Internal use only".
+                       This is no longer true (see item above), so the field title was updated to remove that reference.   
+               </p>
+       </li>
+       <li>
+               <b>New "Filters" for {categoriesTermCap} and {subcategoriesTermCap} list in Admin area</b>
+               <p>
+                       A "Filter" has been added to help in searching the list of {categoriesTermCap} in the admin area. You may now enter a {categoryTerm} name or
+                       any part of a {categoryTerm} name in the "Name" field below "Select items to list" to display only matching {categoriesTerm}.
+               </p>
+               <p>
+                       "Filter" fields have been added to help in searching the list of {subcategoriesTermCap} in the admin area. You may now enter a {subcategoriesTerm} name or
+                       any part of a {subcategoryTerm} name in the "Name" field or select a desired {categoryTermCap} below "Select items to list" to display only matching {categoriesTerm}.
+               </p>
+       </li>
+       <li>
+               <b>Added sort order to {categoriesTermCap} and {subcategoriesTermCap}</b>
+               <p>
+                       There is now an "Order" field for {categoriesTermCap} and {subcategoriesTermCap} in the admin area. 
+                       This is a numeric field that is used to set the display order in listings for front-end users. Lower numbers cause the entry 
+                       to be higher in the list and larger numbers cause the entry to be farther down in the list. The order 
+                       of entries that have the same Order number is determined by alphabetical order of the Name field. 
+               </p>
+               <p>
+                       Note that your site may or may not be using {categoriesTermCap} or {subcategoriesTermCap}. Please let us know if you would like to add or remove that feature.
+               </p>
+       </li>
+</ul>
+
+<h3><button id="2012-08-13_button" onClick="toggleVisible('2012-08-13');" style="font-size: 10px;">Show</button>&nbsp;&nbsp;&nbsp;&nbsp;August 13, 2012</h3>
+<ul id="2012-08-13" style="visibility: hidden; display: none;">
+       <li>
+               <b>Added option to display {eventsTermCap} in {categoriesTerm}</b>
+               <p>
+                       A configuration option has been added to enable/disable the display of {eventsTerm} in 
+                       {categoryTerm} (or {subcategoryTerm}) lists. This would be appropriate when there are a short list of {eventsTerm}
+                       under each {categoryTerm}.
+               </p>
+       </li>
+       <li>
+               <b>Added option to only display {categoriesTerm} that have active {eventsTermCap}</b>
+               <p>
+                       A configuration option has been added to enable/disable the display of only {categoriesTerm} (and {subcategoriesTerm})
+                       that have active {eventsTerm}.
+               </p>
+       </li>
+</ul>
+
+<h3><button id="2012-08-09_button" onClick="toggleVisible('2012-08-09');" style="font-size: 10px;">Show</button>&nbsp;&nbsp;&nbsp;&nbsp;August 9, 2012</h3>
+<ul id="2012-08-09" style="visibility: hidden; display: none;">
+       <li>
+               <b>Expired {eventsTermCap}</b>
+               <p>
+                       A configuration option has been added to enable/disable the display of past {eventsTerm}.
+                       Please let us know if you would like expired {eventsTerm} that are marked as "Active" to
+                       continue to appear in your lists of available {eventsTerm}.
+               </p>
+       </li>
+       <li>
+               <b>Downloadable file per {eventTermCap}</b>
+               <p>
+                       {eventsTermCap} may now include a file and optional description that is listed along with descriptions of the {eventTerm}. 
+                       A link will to this file will be displayed in {eventTerm} listings and {eventTerm} detail pages. This file is provided
+                       when creating or editing an {eventTerm}.        
+               </p>
+       </li>
+       <li>
+               <b>Print/E-Mail reports</b>
+               <p>
+                       Reports may now be printed or E-Mailed to someone using options at the top of report output.
+               </p>
+       </li>
+       <li>
+               <b>Date Specific / Perpetual {eventsTermCap}</b>
+               <p>
+                       An {eventTerm} may now be either Date Specific or Perpetual. Perpetual {eventsTerm} are shown to user as long as they are
+                       set to active and do not show start and end dates. The checkbox for this is located just above the start and
+                       end dates when editing {eventsTerm}. 
+               </p>
+       </li>
+               <li>
+               <b>Terms removed</b>
+               <p>
+                       The terms used to refer to {eventsTerm} has been removed from the bottom of {eventTerm} configuration screens. These were 
+                       never actually used by customers and created consistency problems for output to users. Instead, there are
+                       additional configuration options we can set for you to tailor the terms used for various purposes. (i.e. 
+                       instead of "{eventTermCap}", we can set "Class", "Activity", or some other desired term)
+               </p>
+       </li>
+       <li>
+               <b>Additional filters for {eventTermCap} list</b>
+               <p>
+                       Additional filters have been added at the top of the list of {eventsTerm} in this administration area. These
+                       include filters for Date Specific and {eventTerm} start and end dates. The filter for listing "Active" {eventsTerm}
+                       has been changed to default to "Yes" (show only active {eventsTerm}).
+               </p>
+       </li>
+       <li>
+               <b>Past {eventsTermCap} automatically change to Active "No"</b>
+               <p>
+                       By default, past {eventsTerm} will now be set to inactive each time the {eventTerm} list is displayed in the administration area.
+                       This should simplify working with lists of current and future {eventsTerm} in the administration area since past {eventsTerm} now no longer show by default.
+                       If this behavior is not desired, we do have a configuration option we can set to disable that.
+               </p>
+       </li>
+       <li>
+               <b>Better administration list ordering</b>
+               <p>
+                       Lists in the administration area now have a more obvious "sort by column" feature. Simply click on the title of 
+                       a column to sort the list in order of that column. Clicking a second time will cause the sort to be in reverse order.
+                       A up or down arrow will indicate which column and in which direction the list is sorted. Also note the prompt text
+                       at the top of each list reminding you of this feature.
+               </p>
+       </li>
+       <li>
+               <b>Better tracking of submissions by selected Rate Option</b>
+               <p>
+                       The system is now storing the rate option selected by the user and the "cutoff date" associated with each {eventTerm} 
+                       selected in a way that improves reporting. The reporting enhancements associated with this change are pending and
+                       should be implemented shortly.  
+               </p>
+       </li>
+       <li>
+               <b>Internal changes</b>
+               <p>
+                       In addition to the items listed above, a number of minor fixes and output changes have been made to correct for
+                       issues reported to us by customers.
+               </p>
+       </li>
+       
+       
+</ul>
+
+</span>  <!-- 2012 -->
+ <p>&nbsp;</p>
+ </p>
+
+       Gaslight Media<br>
+       120 E. Lake Street<br>
+       Petoskey, MI 49770<br>
+       231-487-0692<br>
+       info@gaslightmedia.com
+</p>
+
+</div>
+
+<img src="{base_app_url}Common/Registrations_V3/assets/logo.gif">
diff --git a/admin/index.phtml b/admin/index.phtml
new file mode 100644 (file)
index 0000000..a167638
--- /dev/null
@@ -0,0 +1,4135 @@
+<?
+//
+//    Common Registrations Application
+//    Copyright (c) 2002, 2012 by Gaslight Media Inc.
+//
+//    Admin Interface
+//
+//    FILE:    app.gaslightmedia.com/Common/Registrations_V3/admin/index.phtml
+//
+
+// Setup fatal error handling
+function shutDownFunction() {
+       $error = error_get_last();
+       switch ($error['type']) {
+               case 1:
+                       echo '
+                <html>
+                    <head>
+                    </head>
+                    <body>
+                        <h2>Oops! We have a problem here.</h2>
+                        <p>For some reason your last request could not be completed.</p>
+                        <p>
+                            We\'re sorry for the inconvenience. If this continues to be a problem for you,
+                            please call Gaslight Media at 231-487-0692 and tell us what is displayed below.
+                        </p>
+                        <p>
+                            <table border="1" padding="2" spacing="2">
+                                <tr><th>Application:</th><td>GLM Event Registration</td></tr>
+                                <tr><th>Section:</th><td>Admin</td></tr>
+                                <tr><th>File:</th><td>index.phtml</td></tr>
+                                <tr><th>Line:</th><td>'.$error['line'].'</td></tr>
+                                <tr><th>ERROR:</th><td>'.$error['message'].'</td></tr>
+                            </table>
+                        </p>
+                    </body>
+                </html>
+            ';
+                       break;
+               default:
+                       // No Problems Here
+                       break;
+       }
+}
+register_shutdown_function('shutdownFunction');
+
+// Route ancillary requests as required
+if (isset($_REQUEST['route_app'])) {
+    switch($_REQUEST['route_app']) {
+        case 'calendar_popup':
+            include( GLM_APP_BASE.'Common/Registrations_V3/front-end/calendar.phtml');
+            break;
+    }
+    exit;
+}
+
+include( GLM_APP_BASE.'Common/Registrations_V3/front-end/reg_setup.php');
+$config = new Zend_Config_Ini(BASE_PATH.'config/application.ini', strtolower($_ENV['GLM_HOST_ID']));
+$server_config = new Zend_Config_Ini(BASE_PATH.'/config/server.ini', strtolower($_ENV['GLM_HOST_ID']));
+
+$GLOBALS['reg_config'] = $config->event_registration->toArray();
+//var_dump($GLOBALS['reg_config']);
+
+include( GLM_APP_BASE.'Common/Registrations_V3/front-end/reg_functions.inc' );
+
+define( 'THIS_SCRIPT', BASE_URL.'admin/Registrations/index.php');
+
+
+$nl = "\n";        // New line character to ease use
+
+$link_data = '';
+$form_data = '';
+
+    //
+    // Local Functions
+    //
+
+    // Function to add parameters to $link_data
+
+function add_link_data( $name, $value )
+    {
+    global $link_data;
+
+    if( $link_data != '' )
+        $link_data .= '&';
+    $link_data .= "$name=$value";
+    }
+
+function add_form_data( $name, $value )
+    {
+    global $form_data;
+
+    $form_data .= '<INPUT TYPE="hidden" NAME="'.$name.'" VALUE="'.$value.'">'.$nl;
+    }
+
+// Get all standard input data
+$Action = filter_request('Action', FILTER_SANITIZE_STRING);
+$Option = filter_request('Option', FILTER_SANITIZE_STRING);
+$id = filter_request('id', FILTER_SANITIZE_STRING);
+$start = filter_request('start', FILTER_SANITIZE_NUMBER_INT);
+$status = filter_request('status', FILTER_SANITIZE_NUMBER_INT);
+$cc_conf = filter_request('cc_conf', FILTER_SANITIZE_STRING);
+
+       // Build global tag data for view files
+
+$view_tags = array ( "global"    => array() );
+$v = &$view_tags["global"];
+
+    // Set default view and style locations
+
+$qs_style = 'style.css';
+$v['stylesheet'] = BASE_APP_URL.'Common/Registrations_V3/admin/style.css';
+$qs_viewpath = GLM_APP_BASE.'Common/Registrations_V3/admin/Views';
+
+// Check for local/custom stylesheet
+if ($config->event_registration->custom_view_files && file_exists(SI_BASE_PATH.'Toolkit/Registrations/Views/admin/style.css')) {
+    $v['stylesheet'] = BASE_SECURE_URL.'Toolkit/Registrations/Views/admin/style.css';
+}
+
+// Function to check if a local/custom views are on and directory exists for front-end - replaces the normal parse_view() function
+function parse_view_localcheck($use_local, $file_name, $tokens, $show_unused = true)
+{
+    global $config;
+
+    $viewpath = GLM_APP_BASE.'Common/Registrations_V3/admin/Views/'.$file_name;
+
+    if ($use_local && file_exists(SI_BASE_PATH.'Toolkit/Registrations/Views/admin/'.$file_name)) {
+        $viewpath = SI_BASE_PATH.'Toolkit/Registrations/Views/admin/'.$file_name;
+    }
+
+    return parse_view($viewpath, $tokens, $show_unused);
+}
+
+    // Get some standard view tags
+
+$v['base_url']                = BASE_URL;
+$v['base_app_url']            = BASE_APP_URL;
+$v['this_script']             = THIS_SCRIPT;
+$v['copyright_years']         = '2002, '.date('Y');
+$v['cust_name']               = $config->event_registration->organization;
+$v['cust_address']            = $config->event_registration->organization_address;
+$v['cust_city']               = $config->event_registration->organization_city;
+$v['cust_state']              = $config->event_registration->organization_state;
+$v['cust_zip']                = $config->event_registration->organization_zip;
+$v['cust_phone']              = $config->event_registration->organization_phone;
+$v['cust_logo']               = SI_CUST_LOGO_MEDIUM_URL;
+$v['application']             = $config->event_registration->title;
+$v['gen_bulletin']            = '';
+$v['form_data']               = &$form_data;
+$v['link_data']               = &$link_data;
+$v['categoryTerm']            = $config->event_registration->word->category;
+$v['categoryTermCap']         = ucfirst($config->event_registration->word->category);
+$v['categoriesTerm']          = $config->event_registration->word->categories;
+$v['categoriesTermCap']       = ucfirst($config->event_registration->word->categories);
+$v['subcategoryTerm']         = $config->event_registration->word->sub_category;
+$v['subcategoryTermCap']      = ucfirst($config->event_registration->word->sub_category);
+$v['subcategoriesTerm']       = $config->event_registration->word->sub_categories;
+$v['subcategoriesTermCap']    = ucfirst($config->event_registration->word->sub_categories);
+$v['attributeTerm']           = $config->event_registration->word->attribute;
+$v['attributeTermCap']        = ucfirst($config->event_registration->word->attribute);
+$v['attributesTerm']          = $config->event_registration->word->attributes;
+$v['attributesTermCap']       = ucfirst($config->event_registration->word->attributes);
+$v['eventTerm']               = $config->event_registration->word->event;
+$v['eventTermCap']            = ucfirst($config->event_registration->word->event);
+$v['eventsTerm']              = $config->event_registration->word->events;
+$v['eventsTermCap']           = ucfirst($config->event_registration->word->events);
+$v['registerTerm']                   = $config->event_registration->word->register;
+$v['resisterTermCap']        = ucfirst($config->event_registration->word->register);
+$v['registrationTerm']        = $config->event_registration->word->registration;
+$v['registrationTermCap']     = ucfirst($config->event_registration->word->registration);
+$v['registrationsTerm']       = $config->event_registration->word->registrations;
+$v['registrationsTermCap']    = ucfirst($config->event_registration->word->registrations);
+$v['registeringTerm']         = $config->event_registration->word->registering;
+$v['registeringTermCap']      = ucfirst($config->event_registration->word->registering);
+$v['registeredTerm']          = $config->event_registration->word->registered;
+$v['registeredTermCap']       = ucfirst($config->event_registration->word->registered);
+$v['attendeeTerm']                       = $config->event_registration->word->attendee;
+$v['attendeeTermCap']         = ucfirst($config->event_registration->word->attendee);
+$v['attendeesTerm']           = $config->event_registration->word->attendees;
+$v['attendeesTermCap']        = ucfirst($config->event_registration->word->attendees);
+$v['attendingTerm']           = $config->event_registration->word->attending;
+$v['attendingTermCap']        = ucfirst($config->event_registration->word->attending);
+$v['attendedTerm']            = $config->event_registration->word->attended;
+$v['attendedTermCap']         = ucfirst($config->event_registration->word->attended);
+$v['memberTerm']                     = $config->event_registration->word->member;
+$v['memberTermCap']           = ucfirst($config->event_registration->word->member);
+$v['user_idTerm']             = $config->event_registration->word->user_id;
+$v['user_idTermCap']          = ucfirst($config->event_registration->word->user_id);
+$v['passwordTerm']            = $config->event_registration->word->password;
+$v['passwordTermCap']         = ucfirst($config->event_registration->word->password);
+$v['instructorTerm']          = $config->event_registration->word->instructor;
+$v['instructorTermCap']       = ucfirst($config->event_registration->word->instructor);
+$v['instructorsTerm']         = $config->event_registration->word->instructors;
+$v['instructorsTermCap']      = ucfirst($config->event_registration->word->instructors);
+$v['restricted_userTerm']        = $config->event_registration->word->restricted_user;
+$v['restricted_userTermCap']  = ucfirst($config->event_registration->word->restricted_user);
+$v['restricted_usersTerm']       = $config->event_registration->word->restricted_users;
+$v['restricted_usersTermCap'] = ucfirst($config->event_registration->word->restricted_users);
+
+$v["registrations_title"] = $config->event_registration->title;
+$v['title_use_payment_comp_code'] = $config->event_registration->titles->use_payment_comp_code;
+$v['title_payment_comp_code'] = $config->event_registration->titles->payment_comp_code;
+$v['title_send_a_check'] = $config->event_registration->titles->send_a_check;
+$v['title_call_from_merchant'] = $config->event_registration->titles->call_from_merchant;
+$v['title_paid_cash'] = $config->event_registration->titles->paid_cash;
+$v['title_pay_by_credit_card'] = $config->event_registration->titles->pay_by_credit_card;
+
+// Optional contact data
+$v['show_contact_data'] = ($config->event_registration->show_contact_data ? 'YES' : 'NO');
+$v['show_same_button'] = ($config->event_registration->show_same_button ? 'YES' : 'NO');
+$v['contact_information_title'] = $config->event_registration->titles->contact_information;
+$v['use_contact_fname'] = ($config->event_registration->prompt->contact_fname != '' ? 'YES' : 'NO');
+$v['required_contact_fname'] = ($config->event_registration->required->contact_fname ? 'YES' : 'NO');
+$v['prompt_contact_fname'] = $config->event_registration->prompt->contact_fname;
+$v['use_contact_lname'] = ($config->event_registration->prompt->contact_lname != '' ? 'YES' : 'NO');
+$v['required_contact_lname'] = ($config->event_registration->required->contact_lname ? 'YES' : 'NO');
+$v['prompt_contact_lname'] = $config->event_registration->prompt->contact_lname;
+$v['use_contact_addr1'] = ($config->event_registration->prompt->contact_addr1 != '' ? 'YES' : 'NO');
+$v['required_contact_addr1'] = ($config->event_registration->required->contact_addr1 ? 'YES' : 'NO');
+$v['prompt_contact_addr1'] = $config->event_registration->prompt->contact_addr1;
+$v['use_contact_addr2'] = ($config->event_registration->prompt->contact_addr2 != '' ? 'YES' : 'NO');
+$v['required_contact_addr2'] = ($config->event_registration->required->contact_addr2  ? 'YES' : 'NO');
+$v['prompt_contact_addr2'] = $config->event_registration->prompt->contact_addr2;
+$v['use_contact_city'] = ($config->event_registration->prompt->contact_city != '' ? 'YES' : 'NO');
+$v['required_contact_city'] = ($config->event_registration->required->contact_city ? 'YES' : 'NO');
+$v['prompt_contact_city'] = $config->event_registration->prompt->contact_city;
+$v['use_contact_state'] = ($config->event_registration->prompt->contact_state != '' ? 'YES' : 'NO');
+$v['required_contact_state'] = ($config->event_registration->required->contact_state ? 'YES' : 'NO');
+$v['prompt_contact_state'] = $config->event_registration->prompt->contact_state;
+$v['use_contact_zip'] = ($config->event_registration->prompt->contact_zip != '' ? 'YES' : 'NO');
+$v['required_contact_zip'] = ($config->event_registration->required->contact_zip ? 'YES' : 'NO');
+$v['prompt_contact_zip'] = $config->event_registration->prompt->contact_zip;
+$v['use_contact_country'] = ($config->event_registration->prompt->contact_country != '' ? 'YES' : 'NO');
+$v['required_contact_country'] = ($config->event_registration->required->contact_country ? 'YES' : 'NO');
+$v['prompt_contact_country'] = $config->event_registration->prompt->contact_country;
+$v['use_contact_phone'] = ($config->event_registration->prompt->contact_phone != '' ? 'YES' : 'NO');
+$v['required_contact_phone'] = ($config->event_registration->required->contact_phone ? 'YES' : 'NO');
+$v['prompt_contact_phone'] = $config->event_registration->prompt->contact_phone;
+$v['use_contact_fax'] = ($config->event_registration->prompt->contact_fax != '' ? 'YES' : 'NO');
+$v['required_contact_fax'] = ($config->event_registration->required->contact_fax ? 'YES' : 'NO');
+$v['prompt_contact_fax'] = $config->event_registration->prompt->contact_fax;
+
+
+    // Set some global flags
+
+$using_registered_users   = $config->event_registration->registered_users;
+$using_medical_info       = $config->event_registration->medical_info;
+
+    //
+    // Menus
+    //
+
+$menu1 = $menu2 = $menu3 = $menu4 = $menu5 = '';
+if( substr( $Action, 0, 3 ) == "Mis" )
+    {
+    $menu1 .= '<SPAN CLASS="menu_active">[Misc]</SPAN>&nbsp;';
+    $id = 1;
+    $menu2 .= admin_menu( "Mis", "Miscellaneous", $id, $Option, 've', '', $link_data );
+    }
+  else
+    $menu1 .= '<A HREF="'.THIS_SCRIPT.'?Action=Mis&Option=View&'.$link_data.'">[Misc]</A>&nbsp;';
+
+// Categories - Respects configuration of categories on/off and sub-categories on/off
+
+if ($config->event_registration->main_categories) {
+
+    if( substr( $Action, 0, 3 ) == "Tod" )
+        {
+        // Only include sub-menus if sub-categories are on
+        $menu1 .= '<SPAN CLASS="menu_active">['.$v['categoriesTermCap'].']</SPAN>&nbsp;';
+
+        if( substr( $Action, 0, 7 ) == 'Tod_Mai' )
+            {
+            if( substr( $Action, 0, 7 ) == 'Tod_Mai' )
+                {
+                if ($config->event_registration->sub_categories) {
+                    $menu2 .= '<SPAN CLASS="menu_active">['.$v['categoriesTermCap'].']</SPAN>&nbsp;';
+                }
+                $menu3 .= admin_menu( "Tod_Mai", $v['categoriesTermCap'], $id, $Option, 'aeuvdl', '', $link_data );
+                }
+              else
+                if ($config->event_registration->sub_categories) {
+                    $menu2 .= '['.$v['categoriesTermCap'].']&nbsp;';
+                }
+            }
+        else
+            $menu2 .= '<A HREF="'.THIS_SCRIPT.'?Action=Tod_Mai&'.$link_data.'">['.$v['categoriesTermCap'].']</A>&nbsp;';
+
+        // If we have sub-categories, include that in the sub menu
+        if ($config->event_registration->sub_categories) {
+
+            if( substr( $Action, 0, 7 ) == 'Tod_Cat' )
+                {
+                if( substr( $Action, 0, 7 ) == 'Tod_Cat' )
+                    {
+                    $menu2 .= '<SPAN CLASS="menu_active">['.$v['subcategoriesTermCap'].']</SPAN>&nbsp;';
+                    $menu3 .= admin_menu( "Tod_Cat", $v['subcategoriesTermCap'], $id, $Option, 'aeuvdl', '', $link_data );
+                    }
+                  else
+                    $menu2 .= '[Class/Activity Cateories]&nbsp;';
+                }
+              else
+                $menu2 .= '<A HREF="'.THIS_SCRIPT.'?Action=Tod_Cat&'.$link_data.'">['.$v['subcategoriesTermCap'].']</A>&nbsp;';
+
+        } // Sub Categories
+
+        }
+      else
+        $menu1 .= '<A HREF="'.THIS_SCRIPT.'?Action=Tod_Mai&Option=List&'.$link_data.'">['.$v['categoriesTermCap'].']</A>&nbsp;';
+
+} // categories
+
+
+// Attributes
+if ($config->event_registration->attributes) {
+       if( substr( $Action, 0, 3 ) == "Att" )
+       {
+               $menu1 .= '<SPAN CLASS="menu_active">['.$v['attributesTermCap'].']</SPAN>&nbsp;';
+               $menu2 .= admin_menu( "Att", $v['attributesTermCap'], $id, $Option, 'aeuvdl', '', $link_data );
+       }
+       else
+               $menu1 .= '<A HREF="'.THIS_SCRIPT.'?Action=Att&Option=List&'.$link_data.'">['.$v['attributesTermCap'].']</A>&nbsp;';
+}
+
+// Events
+if( substr( $Action, 0, 3 ) == "Eve" )
+    {
+    $menu1 .= '<SPAN CLASS="menu_active">['.$v['eventsTermCap'].']</SPAN>&nbsp;';
+    $menu2 .= admin_menu( "Eve", $v['eventsTermCap'], $id, $Option, 'lveda', '', $link_data );
+    $menu2 .= ' - ';
+
+    if( substr( $Action, 0, 11 ) == 'Eve_For_Edi' || empty($id) || $Option == 'Confirm Delete' )
+        {
+        if( substr( $Action, 0, 11 ) == 'Eve_For_Edi' && $option != 'Confirm Delete' )
+            $menu2 .= '<SPAN CLASS="menu_active">[Edit Form]</SPAN>&nbsp;';
+        else
+            $menu2 .= '[Edit Form]&nbsp;';
+        }
+    else
+        $menu2 .= '<A HREF="'.THIS_SCRIPT.'?Action=Eve_For_Edi&id='.$id.'&'.$link_data.'">[Edit Form]</A>&nbsp;';
+
+    if(!empty($id) )
+    {
+               $menu2 .= '<A HREF="'.THIS_SCRIPT.'?Action=Eve_Dat&id='.$id.'&'.$link_data.'">[Dates Calendar]</A>&nbsp;';
+    }
+    else
+       $menu2 .= '[Dates Calendar]&nbsp;';
+
+    }
+  else
+    $menu1 .= '<A HREF="'.THIS_SCRIPT.'?Action=Eve&Option=List&'.$link_data.'">['.$v['eventsTermCap'].']</A>&nbsp;';
+
+// Members
+if ($config->event_registration->have_members) {
+    if( substr( $Action, 0, 3 ) == "Mem" )
+        {
+        $menu1 .= '<SPAN CLASS="menu_active">[Members]</SPAN>&nbsp;';
+        $menu2 .= admin_menu( "Mem", "Members", $id, $Option, 'lve', '', $link_data );
+        }
+      else
+        $menu1 .= '<A HREF="'.THIS_SCRIPT.'?Action=Mem&Option=List&'.$link_data.'">[Members]</A>&nbsp;';
+}
+
+
+// Registered User
+if ($config->event_registration->registered_users) {
+    if( substr( $Action, 0, 3 ) == "Use" )
+        {
+        $menu1 .= '<SPAN CLASS="menu_active">[Registered Users]</SPAN>&nbsp;';
+        $menu2 .= admin_menu( "Use", "Registered Users", $id, $Option, 'alveda', '', $link_data );
+        }
+      else
+        $menu1 .= '<A HREF="'.THIS_SCRIPT.'?Action=Use&Option=List&'.$link_data.'">[Registered Users]</A>&nbsp;';
+}
+
+// Registrations
+if( substr( $Action, 0, 3 ) == "Reg" )
+    {
+
+    $Action_Save = $Action;
+    if ($Action == 'Reg_Att' && $_REQUEST['Option'] == 'Update') {
+        $Action = 'Reg';
+        $Option = 'View';
+    }
+
+    $menu1 .= '<SPAN CLASS="menu_active">[Submissions]</SPAN>&nbsp;';
+    $menu2 .= admin_menu( "Reg", "Submissions", $id, $Option, 'euvl', '', $link_data );
+    $menu2 .= ' - ';
+
+    if( substr( $Action, 0, 7 ) == 'Reg_Att' )
+        {
+        if( substr( $Action, 0, 7 ) == 'Reg_Att' )
+            $menu2 .= '<SPAN CLASS="menu_active">[Edit '.$v['attendeeTermCap'].']</SPAN>&nbsp;';
+          else
+            $menu2 .= '[Edit '.$v['attendeesTermCap'].']&nbsp;';
+        }
+      elseif (($id-0) > 0)
+        $menu2 .= '<A HREF="'.THIS_SCRIPT.'?Action=Reg_Att&id='.$id.'&'.$link_data.'">[Edit '.$v['attendeeTermCap'].']</A>&nbsp;';
+      else
+        $menu2 .= '[Edit '.$v['attendeeTermCap'].']&nbsp;';
+
+    $Action = $Action_Save;
+    }
+  else
+    $menu1 .= '<A HREF="'.THIS_SCRIPT.'?Action=Reg&Option=List&'.$link_data.'">[Submissions]</A>&nbsp;';
+
+// Reports
+if( substr( $Action, 0, 3 ) == 'Rep' )
+    {
+    $menu1 .= '<SPAN CLASS="menu_active"><A HREF="'.THIS_SCRIPT.'?Action=Rep&'.$link_data.'">[Reports]</A></SPAN>&nbsp;';
+    }
+  else
+    $menu1 .= '<A HREF="'.THIS_SCRIPT.'?Action=Rep&'.$link_data.'">[Reports]</A>&nbsp;';
+
+// If an event is currently selected, then take them directly to that event.
+if ($Action == 'Eve' && $Option == 'View') {
+       $menu1 .= ' - <A HREF="'.BASE_URL.'index.php?catid='.$config->event_registration->event_page.'&preview=1&Action=Step3&AdminUser=YES&event_id='.$id.'" target="registrations">[Enter New Registration]</a>';
+} else {
+       $menu1 .= ' - <A HREF="'.BASE_URL.'index.php?catid='.$config->event_registration->event_page.'&preview=1&Action=Step1&AdminUser=YES" target="registrations">[Enter New Registration]</a>';
+}
+
+// If we're not printing this page, do all the top stuff and nav
+if( !isset($_REQUEST['PrintReport']) || $_REQUEST['PrintReport'] != 'Yes' ) {
+    $v['menu'] = '<SPAN CLASS="navlink">';
+    if( !empty($menu1) ) $v['menu'] .= "$menu1<BR>";
+    if( !empty($menu2) ) $v['menu'] .= "$menu2<BR>";
+    if( !empty($menu3) ) $v['menu'] .= "$menu3<BR>";
+    if( !empty($menu4) ) $v['menu'] .= "$menu4<BR>";
+    if( !empty($menu5) ) $v['menu'] .= "$menu5<BR>";
+    $v['menu'] .= '</SPAN><BR>';
+} else {
+    $v['menu'] = '';
+}
+
+    //
+    // Main Processing
+    //
+
+$v['body'] = $v['message'] = '';
+$qs_viewfile = 'admin.html';
+
+switch( $Action )
+    {
+
+
+    case "Mis":
+
+        $reg_fields = array
+            (
+            'b_1'                => 'b_1,                break.<P><H2 STYLE="color: blue;">Misc '.$v['eventTermCap'].' Text</H2>, ,  FALSE,    b_4,                 ev',
+            'pay_codes'          => 'pay_codes,        multifield.2.{line_numb}: {field_1}         Description: {field_2} <br>,
+                                                                                                   Payment Codes,                                               FALSE,      pay_codes,         aeuv',
+            'b_2'                => 'b_2,                break.<P><H2 STYLE="color: blue;"> Text for Various Pages</H2>, ,  FALSE,    b_4,                 ev',
+            'regbulletin'        => 'regbulletin,        richtext.600.200.encoded,       <nobr>Text for top of first page</nobr>,                         FALSE,    regbulletin,         euv',
+            'cat_page_text'      => 'cat_page_text,      richtext.600.200.encoded,       <nobr>Text for top of Category page</nobr>,                      FALSE,    cat_page_text,       euv',
+            'sub_cat_page_text'  => 'sub_cat_page_text,  richtext.600.200.encoded,       <nobr>Text for top of Sub-Category page</nobr>,                  FALSE,    sub_cat_page_text,   euv',
+            'select_page_text'   => 'select_page_text,   richtext.600.200.encoded,       <nobr>Text for top of '.$v['eventTermCap'].' selection page</nobr>, FALSE,    select_page_text,     euv',
+            'event_page_text'    => 'event_page_text,    richtext.600.200.encoded,       <nobr>Text for top of '.$v['eventTermCap'].' detail page</nobr>, FALSE,    event_page_text,     euv',
+            'cart_page_text'     => 'cart_page_text,     richtext.600.200.encoded,       <nobr>Text for top of Shopping Cart page</nobr>,                 FALSE,    cart_page_text,      euv',
+            'checkout_page_text' => 'checkout_page_text, richtext.600.200.encoded,       <nobr>Text for top of Checkout page</nobr>,                      FALSE,    checkout_page_text,  euv',
+            'summary_page_text'  => 'summary_page_text,  richtext.600.200.encoded,       <nobr>Text for top of Summary page</nobr>,                       FALSE,    summary_page_text,   euv',
+            'b_3'                => 'b_3,                break.<P><H2 STYLE="color: blue;">Terms and Conditions</H2>, ,  FALSE,    b_4,                 ev',
+            'regterms'           => 'regterms,           richtext.600.200.encoded,       '.$v['eventTermCap'].' Terms and Conditions,        FALSE,    regterms,            euv',
+            'b_4'                => 'b_4,                break.<P><H2 STYLE="color: blue;">Notification E-Mail to '.$v['instructorTermCap'].' </H2>, ,  FALSE,    b_4,                 ev',
+            'notify_subject'    => 'notify_subject,     text.50,                                                        E-Mail Subject Line,                                                                                     TRUE,         notify_subject,         euv',
+            'notify_text'               => 'notify_text,                richtext.600.200.encoded,       <nobr>Notification E-Mail Message</nobr>, TRUE,    notify_text,         euv',
+            'b_5'                => 'b_5,                break.<P><H2 STYLE="color: blue;">Acknowledgement E-Mail to '.$v['attendeeTermCap'].'</H2>, ,  FALSE,    b_4,                 ev',
+            'req_ack_subject'   => 'req_ack_subject,    text.50,                                                        E-Mail Subject Line,                                                                                     TRUE,         req_ack_subject,                euv',
+            'req_ack_text'      => 'req_ack_text,               richtext.600.200.encoded,       <nobr>Acknowledgement E-Mail Message</nobr>, TRUE,    req_ack_text,         euv'
+        );
+
+        // Remove fields not used when either main or just sub cateogories are off.
+        if (!$config->event_registration->main_categories) {
+            unset($reg_fields['cat_page_text']);
+            unset($reg_fields['sub_cat_page_text']);
+        } elseif (!$config->event_registration->sub_categories) {
+            unset($reg_fields['sub_cat_page_text']);
+        }
+
+        $r = admin_process_records_r
+            (
+            "misc",                // Table
+            '',                    // Where
+            'sort',                // Order fields
+            CONN_STR,        // Connect String
+            1,                     // Current ID
+            $reg_fields,        // Fields array
+            'view,edit',        // Options
+            20,                 // Rows
+            THIS_SCRIPT,        // URL
+            'Mis',                // Action
+            "",                    // Passed parameter
+            'Miscellaneous',    // Base Title
+            array(),                 // View string
+            $Option,            // Option
+            $start,                // Starting row for lists
+            '',                    // Other Options
+            ''                // Title View
+            );
+
+        $v['body'] .= $r['text'];
+
+
+        // If a successful add, then reload page to display the newly added event.
+        if (($Option == 'Add New' || $Option == 'Update') && $r['status'] = true) {
+
+            $url = THIS_SCRIPT.'?Action=Mis&Option=View&id='.$r['id'];
+            echo '  <!DOCTYPE html>
+                    <html>
+                      <head>
+                        <title>Reloading to re-display page</title>
+                        <meta http-equiv="refresh" content="0; url='.$url.'">
+                      </head>
+                      <body>
+                        <center>
+                            <h2>Reloading to re-display page with updated information.</h2>
+                            <p>If you are not immediately redirected, please click below.</p>
+                            <a href="'.$url.'">Redisplay</a>
+                        </center>
+                      </body>
+                    </html>
+            ';
+            exit;
+
+        }
+
+        break;
+
+
+    case "Tod_Mai":
+
+        if( $Option == 'Add New' )
+        {
+            $sort = 9999;
+        }
+
+        $todo_fields = array
+            (
+            'id'     => 'id,       int,              ID,                 DISPLAY,    id,      euvl',
+            'name'   => 'name,     text.50,          Name,               UNIQUE,     name,    naeuvlfd',
+            'restricted' => 'restricted, checkbox,     '.$v['restricted_usersTermCap'].' Only,
+                                                                                                                                FALSE,         restricted,     naeuvl',
+            'med_info'=> 'med_info,checkbox,         Emergency/Med Info, FALSE,      med_info, naeuvl',
+            'image'  => 'image,    image.t,          Image,              FALSE,      image,   naeuv',
+            'descr'  => 'descr,    richtext.600.200.encoded, Description,        FALSE,      descr,   naeuvd',
+            'sort'   => 'sort,     order,            Order,              TRUE,       sort,    naeuvl'
+            );
+        if (!$using_medical_info) {
+            unset($todo_fields['med_info']);
+        }
+
+        // If there's no restricted area catid then drop that field.
+        if (($config->event_registration->restricted_area_catid-0) == 0) {
+               unset($todo_fields['restricted']);
+        }
+
+        $r = admin_process_records_r
+            (
+            "todo",                // Table
+            '',                    // Where
+            'name',                // Order fields
+            CONN_STR,        // Connect String
+            $id,                     // Current ID
+            $todo_fields,        // Fields array
+            'new,view,edit,delete,filter,strong,sortlinks',        // Options
+            20,                 // Rows
+            THIS_SCRIPT,        // URL
+            'Tod_Mai',                // Action
+            "",                    // Passed parameter
+            $v['categoriesTermCap'],    // Base Title
+            array(),                 // View string
+            $Option,            // Option
+            $start,                // Starting row for lists
+            '',                    // Other Options
+            ''                // Title View
+            );
+
+        $v['body'] .= $r['text'];
+
+        // If a successful add, then reload page to display the newly added event.
+        if (($Option == 'Add New' || $Option == 'Update') && $r['status'] = true) {
+
+            if (isset($r['id'])) {
+                $id = $r['id'];
+            }
+
+            $url = THIS_SCRIPT.'?Action=Tod_Mai&Option=View&id='.$id;
+            echo '  <!DOCTYPE html>
+                    <html>
+                      <head>
+                        <title>Reloading to re-display page</title>
+                        <meta http-equiv="refresh" content="0; url='.$url.'">
+                      </head>
+                      <body>
+                        <center>
+                            <h2>Reloading to re-display page with updated information.</h2>
+                            <p>If you are not immediately redirected, please click below.</p>
+                            <a href="'.$url.'">Redisplay</a>
+                        </center>
+                      </body>
+                    </html>
+            ';
+            exit;
+
+        }
+
+        break;
+
+
+    case "Tod_Cat":
+
+        if( !($t = reg_db_auto_get_data( "SELECT id FROM todo;;", SI_CONN_STR, FALSE )) )
+            {
+            $v['body'] = '<h3>No '.$v['categoriesTermCap'].'!<br>Please add '.$v['categoriesTermCap'].' first.</h3>';
+            break;
+            }
+
+        if( $Option == 'Add New' )
+            {
+                $sort = 9999;
+            }
+
+        $cat_fields = array
+            (
+            'id'     => 'id,       int,              ID,              DISPLAY,    id,      euvl',
+            'name'   => 'name,     text.50,          Name,            UNIQUE,     name,    naeuvlf',
+            'todo'   => 'todo,     pointer.todo.name,Main Category,   TRUE,       todo,    naeuvlf',
+            'image'  => 'image,    image.t,          Image,           FALSE,      image,   naeuv',
+            'descr'  => 'descr,    richtext.600.200.encoded, Description,     FALSE,      descr,   naeuv',
+            'sort'   => 'sort,     order,            Order,           TRUE,       sort,    naeuvl'
+            );
+
+        $r = admin_process_records_r
+            (
+            "category",                // Table
+            '',                    // Where
+            'name',                // Order fields
+            CONN_STR,        // Connect String
+            $id,                     // Current ID
+            $cat_fields,        // Fields array
+            'new,view,edit,delete,strong,filter,sortlinks',        // Options
+            20,                 // Rows
+            THIS_SCRIPT,        // URL
+            'Tod_Cat',                // Action
+            "",                    // Passed parameter
+            $v['subcategoriesTermCap'],    // Base Title
+            array(),                 // View string
+            $Option,            // Option
+            $start,                // Starting row for lists
+            '',                    // Other Options
+            ''                // Title View
+            );
+
+        $v['body'] .= $r['text'];
+
+        break;
+
+    case "Att":
+
+       if( $Option == 'Add New' ) {
+                       $sort = 9999;
+        }
+
+        $attr_fields = array
+               (
+                               'id'     => 'id,       int,              ID,                 DISPLAY,    id,      euvl',
+                               'name'   => 'name,     text.50,          Name,               UNIQUE,     name,    naeuvlfd',
+                               'descr'  => 'descr,    richtext.600.200.encoded, Description,        FALSE,      descr,   naeuvd',
+                               'sort'   => 'sort,     order,            Order,              TRUE,       sort,    naeuvl'
+        );
+
+        $r = admin_process_records_r
+               (
+                               "attribute",            // Table
+                               '',                     // Where
+                               'name',                 // Order fields
+                               CONN_STR,               // Connect String
+                               $id,                    // Current ID
+                               $attr_fields,           // Fields array
+                               'new,view,edit,delete,strong,sortlinks',        // Options
+                               20,                     // Rows
+                               THIS_SCRIPT,            // URL
+                               'Att',              // Action
+                               "",                     // Passed parameter
+                               $v['attributesTermCap'], // Base Title
+                               array(),                     // View string
+                               $Option,                // Option
+                               $start,                 // Starting row for lists
+                               '',                     // Other Options
+                               ''                      // Title View
+               );
+
+        $v['body'] .= $r['text'];
+
+               break;
+
+    case 'Eve':
+
+       // Check for a "Add" action and ask the user to select a main category (todo) first
+       if ($config->event_registration->sub_categories && $Option == 'Add' &&
+               (!isset($_REQUEST['todo']) || ($_REQUEST['todo']-0) <= 0) ) {
+
+               // Get list of main categories (todo)
+               $sql = "
+                       SELECT id, name
+                         FROM todo
+                        WHERE id IN
+                               (
+                               SELECT DISTINCT todo FROM category
+                               )
+                        ORDER BY sort, name;
+                       ";
+               $todos = reg_db_auto_get_data( $sql, SI_CONN_STR, FALSE );
+
+               $v['body'] .= '
+                       <SPAN CLASS="title1">New '.$v['eventTermCap'].'</SPAN><P>
+                       <FONT COLOR="red">(Required fields in red)</FONT>
+                       <form action="'.THIS_SCRIPT.'">
+                               <input type="hidden" name="Action" value="Eve">
+                       <input type="hidden" name="Option" value="Add">
+                               <p>Start by selecting a '.$v['categoryTermCap'].'.</p>
+                               <p>
+                                       <span style="color: red;">'.$v['categoryTermCap'].':</span>
+                                       <select name="todo">
+               ';
+               foreach ($todos as $t) {
+                       $v['body'] .= '
+                                               <option value="'.$t['id'].'">'.$t['name'].'</option>
+                       ';
+               }
+               $v['body'] .= '
+                                       </select>
+                               </p>
+                               <input type="submit" name="submit" value="Continue">
+                       </form>
+                       <p>Note: Only '.$v['categoriesTermCap'].' that have '.$v['subcategoriesTermCap'].' are shown.</p>
+               ';
+
+                       break;
+       }
+
+        // Check for duplicate request
+        if( $Option == 'Duplicate')
+        {
+            // If we have a good id and good data
+            if(($src_id = ($id-0)) > 0 &&
+                    ($src_data = db_auto_get_row( "SELECT * FROM reg WHERE id = $src_id;", 0, CONN_STR, FALSE )) )
+            {
+
+                // Copy the registration (event) data to a new ID adding --DUPLICATE-- to the name
+                $sql = "
+                INSERT INTO reg
+                    (
+                    category,
+                    name,
+                    descr,
+                    notify_email,
+                    active,
+                    image,
+                    start_date,
+                    end_date,
+                    dates,
+                    times,
+                       duration,
+                    location,
+                    cutoff_date,
+                    cutoff_date2,
+                    cutoff_date3,
+                    cutoff_date4,
+                    rates_descr,
+                    rates_1,
+                    rates_2,
+                    rates_3,
+                    rates_4,
+                    attendee_limit,
+                    attendee_max,
+                    attendee_count,
+                    form_revision,
+                    sort,
+                    terms,
+                    notes,
+                    need_attendees,
+                    event_code,
+                    short_descr
+                    )
+                VALUES
+                    (
+                    ".$src_data['category'].",
+                    '--DUPLICATE-- ".addslashes($src_data['name'])."',
+                    '".addslashes($src_data['descr'])."',
+                    '".addslashes($src_data['notify_email'])."',
+                    '".$src_data['active']."',
+                    '".addslashes($src_data['image'])."',
+                    ".($src_data['start_date']==''?'null,':"'".addslashes($src_data['start_date'])."',")."
+                    ".($src_data['end_date']==''?'null,':"'".addslashes($src_data['end_date'])."',")."
+                    '".addslashes($src_data['dates'])."',
+                    '".addslashes($src_data['times'])."',
+                    '".addslashes($src_data['duration'])."',
+                    '".addslashes($src_data['location'])."',
+                    ".($src_data['cutoff_date']==''?'null,':"'".addslashes($src_data['cutoff_date'])."',")."
+                    ".($src_data['cutoff_date2']==''?'null,':"'".addslashes($src_data['cutoff_date2'])."',")."
+                    ".($src_data['cutoff_date3']==''?'null,':"'".addslashes($src_data['cutoff_date3'])."',")."
+                    ".($src_data['cutoff_date4']==''?'null,':"'".addslashes($src_data['cutoff_date4'])."',")."
+                    '".addslashes($src_data['rates_descr'])."',
+                    '".addslashes($src_data['rates_1'])."',
+                    '".addslashes($src_data['rates_2'])."',
+                    '".addslashes($src_data['rates_3'])."',
+                    '".addslashes($src_data['rates_4'])."',
+                    '".$src_data['attendee_limit']."',
+                    ".$src_data['attendee_max'].",
+                    ".$src_data['attendee_count'].",
+                    ".$src_data['form_revision'].",
+                    ".$src_data['sort'].",
+                    '".addslashes($src_data['terms'])."',
+                    '".addslashes($src_data['notes'])."',
+                    '".$src_data['need_attendees']."',
+                    '".addslashes($src_data['event_code'])."',
+                    '".addslashes($src_data['short_descr'])."'
+                    )
+                RETURNING id;
+                ";
+
+                // Insert the new duplicate and get the new ID
+                $ret = db_auto_get_row( $sql, 0, CONN_STR, FALSE );
+                $dst_id = $ret['id'];
+
+                // Get any form data for the original
+                $sql = "
+                    SELECT *
+                      FROM magicform
+                     WHERE form_id = '$src_id'
+                        OR form_id LIKE '$id.%'
+                     ORDER BY form_id;
+                ";
+
+                $src_form_fields = reg_db_auto_get_data( $sql, CONN_STR, FALSE );
+                if (is_array($src_form_fields) && count ($src_form_fields) > 0) {
+
+                    // We have some form field information, so duplicate that also
+                    $sql = '';
+                    foreach ($src_form_fields as $s) {
+
+                        // Translate form_id for this field entry
+                        if ($s['form_id'] == $src_id) {
+                            $new_id = $dst_id;
+                        } else {
+                            $new_id = "$dst_id.".substr($s['form_id'],strlen($src_id)+1);
+                        }
+
+                        // Check for IDs in data1 and translate them
+                        $s['data1'] = str_replace('~'.$src_id.'.', '~'.$dst_id.'.', $s['data1']);
+
+                        $sql .= "
+                            INSERT INTO magicform
+                                (
+                                form_id,
+                                custom_id,
+                                title,
+                                type,
+                                descr,
+                                active,
+                                required,
+                                data1,
+                                sort,
+                                expanded,
+                                style,
+                                file,
+                                cols,
+                                rows,
+                                size,
+                                format,
+                                default_val
+                                )
+                            VALUES
+                                (
+                                '$new_id',
+                                '".$s['custom_id']."',
+                                '".addslashes($s['title'])."',
+                                ".$s['type'].",
+                                '".addslashes($s['descr'])."',
+                                '".$s['active']."',
+                                '".$s['required']."',
+                                '".addslashes($s['data1'])."',
+                                ".$s['sort'].",
+                                '".$s['expanded']."',
+                                '".addslashes($s['style'])."',
+                                '".addslashes($s['file'])."',
+                                ".$s['cols'].",
+                                ".$s['rows'].",
+                                '".addslashes($s['size'])."',
+                                '".addslashes($s['format'])."',
+                                '".addslashes($s['default_val'])."'
+                                );
+                        ";
+                    }
+                    reg_db_auto_exec( $sql, 0, CONN_STR, FALSE );
+
+                } // If have src_form data
+
+            } // Option Duplicate
+            $Option = 'View';
+            $id = $dst_id;
+        }
+
+        if( $Option == 'Add New' )
+            {
+            $attendee_count = 0;
+            $form_revision = 1;
+            }
+
+
+        $date_specific = filter_request('date_specific', FILTER_SANITIZE_STRING);
+        $start_date = filter_request('start_date', FILTER_SANITIZE_STRING);
+        $end_date = filter_request('end_date', FILTER_SANITIZE_STRING);
+        $cutoff_date = filter_request('cutoff_date', FILTER_SANITIZE_STRING);
+
+        if( ($Option == 'Add New' || $Option == 'Update') &&
+            $date_specific == 'on' &&
+            ($start_date == '' || $end_date == '' || $cutoff_date == '') ) {
+            $v['body'] .= '<center><font color="red">Error:</font><P>Start, End, and First Cutoff dates are required for a Date Specific '.$v['eventTermCap'].'.<br>
+               Click "Back" on your browser to make necessary corrections</center>';
+            break;
+        }
+
+        // Check if we're supposed to automatically mark past events as inactive
+        if ($Option == 'List' && $config->event_registration->auto_inactive) {
+            $sql = "UPDATE reg SET active = 'f' WHERE end_date < 'today'";
+            reg_db_auto_exec( $sql, CONN_STR, FALSE );
+        }
+
+        // Default to showing Active events only
+        if( $Option == 'List' && $active == '' ) {
+            $active = 2;
+        }
+
+        $date_specific_default = true;
+
+        $reg_fields = array
+            (
+            'id'                 => 'id,               int,                                        ID,                                                          DISPLAY,    id,                euvl',
+            'event_code'         => 'event_code,       text.15,                                    '.$v['eventTermCap'].' Code - Short</nobr>,    TRUE,       event_code,        naeu',
+            'event_code_l'       => 'event_code,       text.15,                                    Code,                                                        TRUE,       event_code,        lvf',
+            'category'                  => '(updated in conditionals below)',
+               'subcategory'           => '(updated in conditionals below)',
+               'subcategory_l'           => '(updated in conditionals below)',
+                       'attribute'                      => 'attribute,                 multipointer.attribute.name.....reg_attr.reg.attr,      '.$v['attributeTermCap'].',                                                                     FALSE,          attribute,                      naeuv',
+
+            'b_09'               => ',                 break.To select multiple '.$v['attributesTerm'].' above&#44; click and drag across multiple options&#46;<br>
+                                                                                                       To turn on or off an individual '.$v['attributeTerm'].' above&#44; hold the CTRL key and click an option&#46;,
+                                                                                                   ,                                                            FALSE,      ,                  ne',
+            'name'               => 'name,             text.50,                                    Name,                                                        TRUE,       name,              naeuvlf',
+            'active'             => 'active,           checkbox,                                   Active,                                                      FALSE,      active,            naeuvlf',
+            'b_05'               => ',                 break.<p>&nbsp;</p><span class="standout">'.$v['eventTermCap'].' dates</span>,
+                                                                                                   ,                                                            FALSE,      ,                  nev',
+            'date_specific_n'          => 'date_specific,        checkbox,                                   '.$v['eventTermCap'].' is Date Specific,                         SUPPLIED,      date_specific_default,         n',
+            'date_specific_l'          => 'date_specific,        checkbox,                                 Date Specific,                         FALSE,      date_specific,         l',
+            'date_specific'          => 'date_specific,        checkbox,                                   '.$v['eventTermCap'].' is Date Specific,                         FALSE,      date_specific,         aeuvf',
+            'b_06'                => ',                 break.If '.$v['eventTermCap'].' is Date Specific then the following dates are required&#46;,
+                                                                                                   ,                                                            FALSE,      ,                  ne',
+            'start_date_f'       => 'start_date,       daterange.0.720,                            Date '.$v['eventTermCap'].' Starts,                          FALSE,      start_date,        f',
+            'start_date_l'         => 'start_date,       date.0.720,                               Starts,                                                      FALSE,      start_date,        l',
+            'start_date'         => 'start_date,       date.0.720,                                 Date '.$v['eventTermCap'].' Starts,                          FALSE,      start_date,        naeuv',
+            'end_date_f'         => 'end_date,         daterange.0.720..start_date,                Date '.$v['eventTermCap'].' Ends,                            FALSE,      end_date,          f',
+            'end_date_l'           => 'end_date,         date.0.720..start_date,                   Ends,                          FALSE,      end_date,          l',
+            'end_date'           => 'end_date,         date.0.720..start_date,                     Date '.$v['eventTermCap'].' Ends,                            FALSE,      end_date,          naeuv',
+            'b_07'                => ',                 break.If '.$v['eventTermCap'].' is NOT Date Specific then do you want to ask user for a desired date?&#46;,
+                                                                                                   ,                                                            FALSE,      ,                  ne',
+            'ask_date'           => 'ask_date,         checkbox,                                   Ask for desired date,                                        FALSE,      ask_date,            naeuvf',
+            'use_calendar'       => 'use_calendar,     checkbox,                                   Use [Dates Calendar],                                        FALSE,      use_calendar,      naeuv',
+            'b_08'               => ',                 break.If you select the above option&#44; use the [Dates Calendar] menu option at the top of the page to set available dates&#46;,
+                                                                                                   ,                                                            FALSE,      ,                  nev',
+            'b_01'               => ',                 break.<p>&nbsp;</p><span class="standout">General '.$v['eventTermCap'].' Information</span>,
+                                                                                                   ,                                                            FALSE,      ,                  nev',
+            'notify_email'       => 'notify_email,     multifield.1.#{line_numb}: {field_1}<br>,   <nobr>E-Mail Notification To</nobr>,                         FALSE,      notify_email,      naeuv',
+            'dates'              => 'dates,            text.50,                                    Description of days held,                                    FALSE,      dates,             naeuv',
+            'times'              => 'times,            text.50,                                    Times,                                                       FALSE,      times,             naeuv',
+            'duration'           => 'duration,         text.50,                                    Duration,                                                    FALSE,      duration,          naeuv',
+            'location'           => 'location,         text.50,                                    Location,                                                    FALSE,      location,          naeuv',
+            'instructor'         => 'instructor,       text.50,                                    '.$v['instructorTermCap'].',                                 FALSE,      instructor,        naeuv',
+            'image'              => 'image,            image.t,                                    Image,                                                       FALSE,      image,             naeuv',
+            'reg_file'           => 'reg_file,         file,                                       File,                                                        FALSE,      reg_file,          naeuv',
+            'reg_file_title'     => 'reg_file_title,   text.50,                                    File Title,                                                  FALSE,      reg_file_title,    naeuv',
+            'b_02'               => ',                 break.<p>&nbsp;</p><span class="standout">Detailed '.$v['eventTermCap'].' Information</span>,
+                                                                                                   ,                                                            FALSE,      ,                  nev',
+            'short_descr'        => 'short_descr,      richtext.600.100.encoded,                   Short Description<br>(keep short),                           FALSE,      short_descr,       naeuv',
+            'descr'              => 'descr,            richtext.600.200.encoded,                   '.$v['eventTermCap'].' Description,                          FALSE,      descr,             naeuv',
+            'rates_descr'        => 'rates_descr,      richtext.600.200.encoded,                   Levels Description,                                          FALSE,      rates_descr,       naeuv',
+            'b_03'               => ',                 break.<p>&nbsp;</p><span class="standout">Rate options and dates</span>,
+                                                                                                   ,                                                            FALSE,      ,                  nev',
+            'b_1'                => ',                 break.<br>Supply date/price ranges as required&#46; Last supplied date is final reservation cut-off date&#46;<br>
+                                                                                               If '.$v['eventTermCap'].' is NOT Date Specific&#44; then the First Cutoff Date Settings are used&#46;,
+                                                                                                   ,                                                            FALSE,      ,                  nev'
+            );
+
+        // If we have sub-categories, update reg.todo field with correct data - it's used for reference to the category in admin only
+        if ($config->event_registration->sub_categories) {
+               // Also, forceably update all list_name fields for all category entries. *** NEED TO MAKE THIS MORE INTELEGENT ***
+               $sql = "
+                   UPDATE reg R
+                          SET todo =
+                               (
+                               SELECT C.todo
+                                 FROM category C
+                                WHERE C.id = R.category
+                               );
+                       UPDATE category CC SET list_name =
+                               (
+                               SELECT T.name || ' - ' || C.name
+                                 FROM todo T, category C
+                        WHERE C.id = CC.id
+                                  AND T.id = C.todo
+                               );
+               ";
+               reg_db_auto_exec( $sql, CONN_STR, FALSE );
+
+        }
+
+        // If we're not using categories or sub-categories, drop them
+        if (!$config->event_registration->main_categories) {
+            unset($reg_fields['category']);
+        }
+       if (!$config->event_registration->sub_categories) {
+            unset($reg_fields['subcategory']);
+        }
+
+        // If we are, then setup to show category and list_name
+        if ($config->event_registration->main_categories && $config->event_registration->sub_categories) {
+               $reg_fields['category'] = 'todo, pointer.todo.name, '.$v['categoryTermCap'].', DISPLAY, todo, naeuvlf';
+               if ($Option == "Add") {
+                       $reg_fields['subcategory'] = 'category, pointer.category.list_name.id.todo = '.$_REQUEST['todo'].', '.$v['subcategoryTermCap'].', TRUE, category, naeuf';
+               } else {
+                       $reg_fields['subcategory'] = 'category, pointer.category.list_name, '.$v['subcategoryTermCap'].', TRUE, category, naeuf';
+               }
+               $reg_fields['subcategory_l'] = 'category, pointer.category.name, '.$v['subcategoryTermCap'].', TRUE, category, vl';
+        }
+
+        // If we're not using sub-categories, just look at the main cateogories
+        if ($config->event_registration->main_categories && !$config->event_registration->sub_categories) {
+               $reg_fields['category'] = 'category, pointer.todo.name, Category, TRUE, category, naeuvlf';
+        // Otherwise if this is an "n,a,e,u" then trash the category field.
+        } elseif (in_array($Option,array('Add','Add New','Edit','Update'))) {
+               unset($reg_fields['category']);
+        }
+
+        // If we're not using attributes, drop them
+        if (!$config->event_registration->attributes) {
+               unset($reg_fields['attribute']);
+               unset($reg_fields['b_09']);
+        }
+
+        // If we're doing member registration
+        if ($config->event_registration->have_members) {
+
+            $rf2 = array(
+                'b_2'                => ',                 break.<br><b>First Cutoff Date Settings</b><BR><hr>,    ,                                                FALSE,      ,                  nev',
+                'rates_1_memb'       => 'rates_1_memb,     multifield.4.#{line_numb}: Name {field_1} Base $ {field_2} Per '.$v['attendeeTermCap'].' $ {field_3} '.$v['attendeeTermCap'].' Credits {field_4} <br>,
+                                                                                                       Members,                                                     FALSE,      rates_1_memb,      naeuv',
+                'rates_1'            => 'rates_1,          multifield.4.#{line_numb}: Name {field_1} Base $ {field_2} Per '.$v['attendeeTermCap'].' $ {field_3} '.$v['attendeeTermCap'].' Credits {field_4} <br>,
+                                                                                                       Non-Members,                                                 FALSE,      rates_1,           naeuv',
+                'cutoff_date'        => 'cutoff_date,      date.0.720,                                 First Cutoff Date,                                           FALSE,       cutoff_date,       naeuv',
+                'b_3'                => ',                 break.<br><b>Second Cutoff Date Settings</b><BR><hr>,    ,                                               FALSE,      ,                  nev',
+                'rates_2_memb'       => 'rates_2_memb,     multifield.4.#{line_numb}: Name {field_1} Base $ {field_2} Per '.$v['attendeeTermCap'].' $ {field_3} '.$v['attendeeTermCap'].' Credits {field_4} <br>,
+                                                                                                       Members,                                                     FALSE,      rates_2_memb,      naeuv',
+                'rates_2'            => 'rates_2,          multifield.4.#{line_numb}: Name {field_1} Base $ {field_2} Per '.$v['attendeeTermCap'].' $ {field_3} '.$v['attendeeTermCap'].' Credits {field_4} <br>,
+                                                                                                       Non-Members,                                                 FALSE,      rates_2,           naeuv',
+                'cutoff_date2'       => 'cutoff_date2,     date.0.720,                                 Second Cutoff Date,                                          FALSE,      cutoff_date2,      naeuv',
+                'b_4'                => ',                 break.<br><b>Third Cutoff Date Settings</b><BR><hr>,    ,                                                FALSE,      ,                  nev',
+                'rates_3_memb'       => 'rates_3_memb,     multifield.4.#{line_numb}: Name {field_1} Base $ {field_2} Per '.$v['attendeeTermCap'].' $ {field_3} '.$v['attendeeTermCap'].' Credits {field_4} <br>,
+                                                                                                       Members,                                                     FALSE,      rates_3_memb,      naeuv',
+                'rates_3'            => 'rates_3,          multifield.4.#{line_numb}: Name {field_1} Base $ {field_2} Per '.$v['attendeeTermCap'].' $ {field_3} '.$v['attendeeTermCap'].' Credits {field_4} <br>,
+                                                                                                       Non-Members,                                                 FALSE,      rates_3,           naeuv',
+                'cutoff_date3'       => 'cutoff_date3,     date.0.720,                                 Third Cutoff Date,                                           FALSE,      cutoff_date3,      naeuv',
+                'b_5'                => ',                 break.<br><b>Fourth Cutoff Date Settings</b><BR><hr>,    ,                                               FALSE,      ,                  nev',
+                'rates_4_memb'       => 'rates_4_memb,     multifield.4.#{line_numb}: Name {field_1} Base $ {field_2} Per '.$v['attendeeTermCap'].' $ {field_3} '.$v['attendeeTermCap'].' Credits {field_4} <br>,
+                                                                                                       Members,                                                     FALSE,      rates_4_memb,      naeuv',
+                'rates_4'            => 'rates_4,          multifield.4.#{line_numb}: Name {field_1} Base $ {field_2} Per '.$v['attendeeTermCap'].' $ {field_3} '.$v['attendeeTermCap'].' Credits {field_4} <br>,
+                                                                                                       Non-Members,                                                 FALSE,      rates_4,           naeuv',
+                'cutoff_date4'       => 'cutoff_date4,     date.0.720,                                 Final Cutoff Date,                                           FALSE,      cutoff_date4,      naeuv'
+            );
+            $reg_fields = array_merge ( $reg_fields, $rf2 );
+
+        } else {
+
+            $rf2 = array(
+                'b_2'                => ',                 break.<br><b>First Cutoff Date Settings</b><BR><hr>,    ,                                                FALSE,      ,                  nev',
+                'rates_1'            => 'rates_1,          multifield.4.#{line_numb}: Name {field_1} Base $ {field_2} Per '.$v['attendeeTermCap'].' $ {field_3} '.$v['attendeeTermCap'].' Credits {field_4} <br>,
+                                                                                                       Rate Options,                                                 FALSE,      rates_1,           naeuv',
+                'cutoff_date'        => 'cutoff_date,      date.0.720,                                 First Cutoff Date,                                           FALSE,       cutoff_date,       naeuv',
+                'b_3'                => ',                 break.<br><b>Second Cutoff Date Settings</b><BR><hr>,    ,                                               FALSE,      ,                  nev',
+                'rates_2'            => 'rates_2,          multifield.4.#{line_numb}: Name {field_1} Base $ {field_2} Per '.$v['attendeeTermCap'].' $ {field_3} '.$v['attendeeTermCap'].' Credits {field_4} <br>,
+                                                                                                       Rate Options,                                                 FALSE,      rates_2,           naeuv',
+                'cutoff_date2'       => 'cutoff_date2,     date.0.720,                                 Second Cutoff Date,                                          FALSE,      cutoff_date2,      naeuv',
+                'b_4'                => ',                 break.<br><b>Third Cutoff Date Settings</b><BR><hr>,    ,                                                FALSE,      ,                  nev',
+                'rates_3'            => 'rates_3,          multifield.4.#{line_numb}: Name {field_1} Base $ {field_2} Per '.$v['attendeeTermCap'].' $ {field_3} '.$v['attendeeTermCap'].' Credits {field_4} <br>,
+                                                                                                       Rate Options,                                                 FALSE,      rates_3,           naeuv',
+                'cutoff_date3'       => 'cutoff_date3,     date.0.720,                                 Third Cutoff Date,                                           FALSE,      cutoff_date3,      naeuv',
+                'b_5'                => ',                 break.<br><b>Fourth Cutoff Date Settings</b><BR><hr>,    ,                                               FALSE,      ,                  nev',
+                'rates_4'            => 'rates_4,          multifield.4.#{line_numb}: Name {field_1} Base $ {field_2} Per '.$v['attendeeTermCap'].' $ {field_3} '.$v['attendeeTermCap'].' Credits {field_4} <br>,
+                                                                                                       Rate Options,                                                 FALSE,      rates_4,           naeuv',
+                'cutoff_date4'       => 'cutoff_date4,     date.0.720,                                 Final Cutoff Date,                                           FALSE,      cutoff_date4,      naeuv'
+            );
+            $reg_fields = array_merge ( $reg_fields, $rf2 );
+
+        }
+        $rf3 = array(
+
+            'b_payment'          => ',                 break.<p>&nbsp;</p><span class="standout">Payment Options</span><br>
+                                                                                                  If these items are checked&#44; front-end users will be blocked from using these methods<br>
+                                                                                                       and payment by these methods will be restricted to admin users only&#46;,
+                                                                                                   ,                                                            FALSE,      ,                  nev',
+            'restrict_comp_code' => 'restrict_comp_code, checkbox,                                 Block payment type: Comp Code,    FALSE,      restrict_comp_code,    naeuv',
+            'restrict_check'     => 'restrict_check,   checkbox,                                   Block payment type: Check,    FALSE,      restrict_check,    naeuv',
+            'restrict_call_from_merchant'     => 'restrict_call_from_merchant,   checkbox,                                   Block payment type: Call from Merchant,    FALSE,      restrict_call_from_merchant,    naeuv',
+            'restrict_cash'      => 'restrict_cash,    checkbox,                                   Block payment type: Cash,    FALSE,      restrict_cash,    naeuv',
+               'restrict_credit_card' => 'restrict_credit_card, checkbox,                             Block payment type: Credit Card,    FALSE,      restrict_credit_card,    naeuv',
+               'mf_charges_by_attendee' => 'mf_charges_by_attendee, checkbox,                         Mutliply MagicForm checkbox/picklist values by attendees, FALSE, mf_charges_by_attendee, naeuv',
+            'b_attendees'             => ',                 break.<p>&nbsp;</p><span class="standout">'.$v['attendeeTermCap'].' Options</span>,
+                                                                                                   ,                                                            FALSE,      ,                  nev',
+            'need_attendees'     => 'need_attendees,   checkbox,                                   Ask for '.$v['attendeesTermCap'].',                                           FALSE,      need_attendees,    naeuv',
+            'attendee_limit'     => 'attendee_limit,   checkbox,                                   <nobr>Limited number of '.$v['attendeesTermCap'].' for this '.$v['eventTermCap'].'</nobr>,                           FALSE,      attendee_limit,    naeuv',
+            'attendee_max'       => 'attendee_max,     int,                                        <nobr>Maximum number of '.$v['attendeesTermCap'].' for this '.$v['eventTermCap'].'</nobr>,                           FALSE,      attendee_max,      naeuv',
+            'attendee_count'     => 'attendee_count,   int,                                        <nobr>Current No. of '.$v['attendeesTermCap'].' '.$v['registeredTermCap'].'</nobr>,                     FALSE,      attendee_count,    aeuv',
+               'attendee_max_per_sub' => 'attendee_max_per_sub, int,                                                                   <nobr>Maximum number of '.$v['attendeesTermCap'].' per '.$v['registrationTermCap'].'</nobr>,    FALSE, attendee_max_per_sub, naeuv',
+            'b_per_sub_comment'              => ',                 break.(Used if asking for '.$v['attendeesTermCap'].' - set to 0 for unlimited),
+                                                                                                   ,                                                            FALSE,      ,                  nev',
+            'require_registered_user' => 'require_registered_user,   checkbox,                     <nobr>'.$v['registrationTermCap'].' must be submitted by a  '.$v['memberTermCap'].'</nobr>, FALSE,      require_registered_user,    naeuv',
+               'b_misc'             => ',                 break.<p>&nbsp;</p><span class="standout">Terms and Conditions</span>,
+                                                                                                   ,                                                            FALSE,      ,                  nev',
+//            'pay_codes'          => 'pay_codes,        multifield.2.{line_numb}: {field_1}         Description: {field_2} <br>,
+//                                                                                                   Payment Codes,                                               FALSE,      pay_codes,         aeuv',
+            'terms'              => 'terms,            richtext.600.200.encoded,                           Terms and Conditions<br>Specific to this '.$v['eventTermCap'].',                                FALSE,      terms,             aeuv',
+            'sort'               => 'sort,             order,                                      Order,                                                       TRUE,      sort,              naeuvl',
+            'form_revision'      => 'form_revision,    int,                                        Form Revision,                                               TRUE,       form_revision,     av',
+        );
+        $reg_fields = array_merge ( $reg_fields, $rf3 );
+
+        // If members are not enabled remove member restriction option
+       if ($config->event_registration->have_members != 'Yes') {
+               unset($reg_fields['require_registered_user']);
+        }
+
+        // Check payment configuration and remove any methods that are turned off globally for this site
+        $remove_count = 0;
+        if ($config->event_registration->payment_methods->comp_code != 'Yes') {
+               unset($reg_fields['restrict_comp_code']);
+               $remove_count++;
+        }
+        if ($config->event_registration->payment_methods->check != 'Yes') {
+               unset($reg_fields['restrict_check']);
+               $remove_count++;
+        }
+        if ($config->event_registration->payment_methods->call_from_merchant != 'Yes') {
+               unset($reg_fields['restrict_call_from_merchant']);
+               $remove_count++;
+        }
+        if ($config->event_registration->payment_methods->cash != 'Yes') {
+               unset($reg_fields['restrict_cash']);
+               $remove_count++;
+        }
+        if ($config->event_registration->payment_methods->credit_card != 'Yes') {
+               unset($reg_fields['restrict_credit_card']);
+               $remove_count++;
+        }
+        // If there's none left then remove all traces of this section
+        if ($remove_count == 5) {
+               unset($reg_fields['b_payment']);
+        }
+
+
+        // If event is not date-specific, then drop the rates and cutoffs after the first set
+        if (in_array($Option,array('Edit','View','Update')) && ($id-0) > 0) {
+
+               $ds_data = db_auto_get_row( "SELECT date_specific FROM reg WHERE id = $id;", 0, CONN_STR, FALSE );
+
+               // If not date specific, drop all but the first;
+               if ($ds_data['date_specific'] == 'f') {
+                       unset($reg_fields['b_3']);
+                       unset($reg_fields['rates_2_memb']);
+                       unset($reg_fields['rates_2']);
+                       unset($reg_fields['cutoff_date2']);
+                       unset($reg_fields['b_4']);
+                       unset($reg_fields['rates_2_memb']);
+                       unset($reg_fields['rates_3']);
+                       unset($reg_fields['cutoff_date3']);
+                       unset($reg_fields['b_5']);
+                       unset($reg_fields['rates_4_memb']);
+                       unset($reg_fields['rates_4']);
+                       unset($reg_fields['cutoff_date4']);
+               }
+        }
+
+        $r = admin_process_records_r
+            (
+            "reg",                // Table
+            '',                   // Where
+            'sort',               // Order fields
+            CONN_STR,             // Connect String
+            $id,                  // Current ID
+            $reg_fields,          // Fields array
+            'view,edit,delete,duplicate,filter,strong,sortlinks',    // Options
+            20,                   // Rows
+            THIS_SCRIPT,          // URL
+            'Eve',                // Action
+            "",                   // Passed parameter
+            $v['eventsTermCap'],  // Base Title
+            array(),                   // View string
+            $Option,              // Option
+            $start,               // Starting row for lists
+            '',                   // Other Options
+            ''                    // Title View
+            );
+
+            // If successful delete, then delete all associated MagicForm fields
+
+        if( $Option == 'Confirm Delete' && $r['status'] = true )
+            reg_db_auto_exec( "DELETE FROM magicform WHERE form_id LIKE '$id.%'; DELETE FROM magicform WHERE form_id = '$id';", CONN_STR, FALSE );
+
+        // If a successful add, then reload page to display the newly added event.
+        if (($Option == 'Add New' || $Option == 'Update') && $r['status'] = true) {
+
+            if (isset($r['id'])) {
+                $id = $r['id'];
+            }
+
+            $url = THIS_SCRIPT.'?Action=Eve&Option=View&id='.$id;
+            echo '  <!DOCTYPE html>
+                    <html>
+                      <head>
+                        <title>Reloading to re-display page</title>
+                        <meta http-equiv="refresh" content="0; url='.$url.'">
+                      </head>
+                      <body>
+                        <center>
+                            <h2>Reloading to re-display page with updated information.</h2>
+                            <p>If you are not immediately redirected, please click below.</p>
+                            <a href="'.$url.'">Redisplay</a>
+                        </center>
+                      </body>
+                    </html>
+            ';
+            exit;
+
+        }
+
+
+        $v['body'] .= $r['text'];
+
+        break;
+
+    case "Eve_For_Edi":
+
+            // Get info on the selected form
+
+        if( !($reg_data = db_auto_get_row( "SELECT * FROM reg WHERE id = $id;", 0, CONN_STR, FALSE )) )
+            {
+            $r['text'] = '<center><font color="red">INTERNAL ERROR</font><P>Selected Form not found.</center>';
+            break;
+            }
+
+        $v['body'] .= $reg_data['name'].'<P>';
+
+        add_link_data( 'id', $id );
+        add_link_data( 'Action', 'Eve_For_Edi' );
+        add_form_data( 'id', $id );
+        add_form_data( 'Action', 'Eve_For_Edi' );
+
+        $r = magic_form_edit( $id, $mf_format );
+
+        if( $r['modified'] )
+            reg_db_auto_exec( "UPDATE reg SET form_revision = form_revision + 1 WHERE id = $id;" );
+
+        if( $r['success'] )
+            $v['body'] .= '<a href="'.THIS_SCRIPT."?Action=Eve_For_Edi_Tes&id=$id&session_code=$session_code".'" target="mf_sample">[Test this form]</a>'.$r['text'];
+        else
+            $v['body'] .= 'Something really wrong with MagicForms';
+
+        break;
+
+        // Test a form
+
+    case "Eve_For_Edi_Tes":
+
+            // Get info on the selected form
+
+        if( !($reg_data = db_auto_get_row( "SELECT * FROM reg WHERE id = $id;", 0, CONN_STR, FALSE )) )
+            {
+            $r['text'] = '<center><font color="red">INTERNAL ERROR</font><P>Selected Form not found.</center>';
+            break;
+            }
+
+        $v['reg_name'] .= $reg_data['name'].'<P>';
+        add_form_data( 'id', $id );
+
+            // Check for default data
+
+        if( !empty($_REQUEST['field_data']) )
+            $fd = unserialize( stripslashes($_REQUEST['field_data']) );
+        else
+            $fd = '';
+
+        $r = magic_form_display( $id, $mf_styles, null, $fd );
+        $v['magic_form'] .= $r['text'];
+        $v['required'] = ($r['required']?'Yes':'No');
+        $v['problem'] = stripslashes($problem);
+        $qs_viewfile = 'form_edit_test.html';
+        break;
+
+        // Test a form
+
+    case "Eve_For_Edi_Tes_Sub":
+
+            // Get info on the selected form
+
+        if( !($reg_data = db_auto_get_row( "SELECT * FROM reg WHERE id = $id;", 0, CONN_STR, FALSE )) )
+            {
+            $r['text'] = '<center><font color="red">INTERNAL ERROR</font><P>Selected Form not found.</center>';
+            break;
+            }
+
+        $v['reg_name'] .= $reg_data['name'];
+        add_form_data( 'id', $id );
+
+            // Get sumbitted data and use only a sub-set for sending back to display form.
+
+        $r = magic_form_submit( $id );
+        $d = array();
+        foreach( $r['data'] as $key=>$val )        // Build array that's a subset of the submitted data, just what's required for re-displaying form
+            {
+            $d[$key] = array( 'id' => $val['id'], 'opt_num' => $val['opt_num'], 'value' => $val['value'] );
+            }
+        $hs = get_html_translation_table( HTML_ENTITIES ) + array( '{' => '&#123;', ' ' => '&#32;', '#' => '&#35;', "\n" => '&#10;' );
+        $v['return_data'] = '<INPUT TYPE="hidden" NAME="Action" VALUE="Eve_For_Edi_Tes">
+                            <INPUT TYPE="hidden" NAME="id" VALUE="'.$id.'">
+                            <INPUT TYPE="hidden" NAME="field_data" VALUE="'.strtr( serialize( $d ), $hs ).'">
+                            <INPUT TYPE="hidden" NAME="problem" VALUE="'.strtr($r['problem'], $hs).'">';
+        $v['problem'] = $r['problem'];
+        $v['html'] = $r['html'];
+        $v['csv'] = $r['csv'];
+        $v['total_value'] = $r['total_value'];
+
+        $qs_viewfile = 'form_edit_test_result.html';
+        break;
+
+        // Event Dates
+
+    case 'Eve_Dat':
+
+        // Function to build empty year $ds[{month}][{day_of_month}]
+       function dsEmptyYear($year) {
+
+                       $ds = array();
+                       $days = 365;
+                       if (date('L', strtotime("1/1/$year"))) {
+                               $days = 366;
+                       }
+               for ($i=0; $i<$days; $i++) {
+                       $t = strtotime("01/01/$year +".($i)." days");
+                       $m = date('n', $t);
+                       $ds[$m][$t] = array(
+                               'time' => $t,
+                               'date' => date('m/d/Y', $t),
+                               'sel' => false
+                       );
+               }
+               return $ds;
+       }
+
+       // Create one date cell for output - if $d = 0, then it's not a real date
+       function dsDay($d, $set) {
+
+               $doy = date('z', $d);
+               $date = date('d',$d);
+               $monthClass = "dsMonth".date('M', $d);
+               $dayClass = $monthClass.date('D', $d);
+
+               if ($d > 0) {
+                       $day = '
+                               <div class="dsDateCell '.$monthClass.($set?" dsDateCellSel":"").' '.$dayClass.'" day="'.$doy.'">
+                                       <div class="dsDate">'.$date.'</div>
+                                       <input type="hidden" id="day_'.$doy.'" name="day['.$doy.']" value="'.($set?'1':'0').'">
+                               </div>
+                       ';
+               } else {
+                       $day = '<div class="dsNoDateCell">&nbsp;</div>
+                       ';
+               }
+               return $day;
+       }
+
+       // Build a month for output
+       function dsMonth($days) {
+
+               $x = current($days);
+               $firstDay = date('w', $x['time']);
+               $monthName = date('F', $x['time']);
+               $monthClass = "dsMonth".date('M', $x['time']);
+
+               $rows = 1;
+
+               $month = '
+                       <div class="dsMonth" month="'.$monthClass.'">
+                               <div class="dsMonthHead">
+                                       <div class="dsMonthName">'.$monthName.'</div>
+                                       <div class="dsMonthAll" month="'.$monthClass.'">All</div>
+                                               <div class="dsMonthNone" month="'.$monthClass.'">None</div>
+                               </div>
+                               <div class="dsCalHead">
+                                       <div class="dsHeadCell" day="'.$monthClass.'Sun">Sun</div>
+                                       <div class="dsHeadCell" day="'.$monthClass.'Mon">Mon</div>
+                                       <div class="dsHeadCell" day="'.$monthClass.'Tue">Tue</div>
+                                       <div class="dsHeadCell" day="'.$monthClass.'Wed">Wed</div>
+                                       <div class="dsHeadCell" day="'.$monthClass.'Thu">Thu</div>
+                                       <div class="dsHeadCell" day="'.$monthClass.'Fri">Fri</div>
+                                       <div class="dsHeadCell" day="'.$monthClass.'Sun">Sat</div>
+                               </div> <!-- dsHead -->
+                               <div class="dsWeek">
+               ';
+
+               // Check if there's leading days
+               if ($firstDay != 0) {
+                       for ($w=0 ; $w<$firstDay ; $w++) {
+                               $month .= dsDay(0,false);
+                       }
+               }
+
+               // Display days in the month
+               foreach($days as $day) {
+                       // Check for end of week
+                       if ($w++ == 7) {
+                               $month .= '
+                                       </div> <!-- dsWeek -->
+                                       <div class="dsWeek">
+                               ';
+                               $w = 1;
+                               $rows++;
+                       }
+                       $month .= dsDay($day['time'], $day['sel']);
+               }
+
+               // Check for trailing days
+               if ($w < 7) {
+                       for ( ; $w<7 ; $w++) {
+                               $month .= dsDay(0,false);
+                       }
+               }
+
+               $month .= '
+                               </div> <!-- dsWeek -->
+               ';
+
+               if ($rows < 6) {
+                       $month .= '
+                               <div class="dsWeek">&nbsp;</div>
+                       ';
+               }
+
+               $month .= '
+                       </div> <!-- dsMonth -->
+               ';
+
+               return $month;
+       }
+
+
+       // Get data from the event
+       $event_data = db_auto_get_row( "SELECT date_specific, use_calendar, date_select FROM reg WHERE id = $id;", 0, CONN_STR, FALSE );
+
+               // Not a valid operation if the event is date_specific
+       if ($event_data['date_specific'] == 't') {
+
+               $v['body'] .= '
+                       <h2>This '.ucfirst($config->event_registration->word->event).' is Date Specific.</h2>
+                       <p>No action required here.</p>
+               ';
+
+               break;
+       }
+
+       // Not selected for this event
+       if ($event_data['use_calendar'] != 't') {
+
+               $v['body'] .= '
+                       <h2>This '.ucfirst($config->event_registration->word->event).' is not set to use the Dates Calendar feature.</h2>
+                       <p>No action required here.</p>
+               ';
+
+               break;
+       }
+
+       // See if a year is supplied, if not, get current year
+       if (isset($_REQUEST['ds_year'])) {
+               $ds_year = ($_REQUEST['ds_year']-0);
+       } else {
+               $ds_year = date('Y');
+       }
+
+        // Try to break out any stored data
+        $ds_data = array();
+       if ($event_data['date_select'] != '') {
+               $ds_data = unserialize($event_data['date_select']);
+       }
+
+       // Check to see if a year delete has been requested
+       if ($Option == 'Delete Year') {
+
+               if ($_REQUEST['deleteYear'] == 'Delete') {
+                       unset($ds_data[$ds_year]);
+                       reg_db_auto_exec( "UPDATE reg SET date_select = '".serialize($ds_data)."' WHERE id = $id;", 0, CONN_STR, FALSE );
+                       $v['body'] .= '
+                                       <h2>All dates for '.$ds_year.' have been deleted.</h2>
+                               ';
+                       break;
+               }
+
+                       $v['body'] .= '
+                       <h2 style="color: red;">Note: To delete a year you must enter exactly "Delete".</h2>
+               ';
+       }
+
+       // Check to see if a year has just been submitted
+       $ds_in = $_REQUEST['day'];
+       if (is_array($ds_in)) {
+               // For each day supplied
+               while (list($key, $val) = each($ds_in)) {
+                       $t = strtotime("01/01/$ds_year +".($key)." days");
+                       $m = date('n', $t);
+
+                       // Add it to the data array
+                       $ds_data[$ds_year][$m][$t] = array(
+                               'time' => $t,
+                               'date' => date('m/d/Y', $t),
+                               'sel' => ($ds_in[$key] == 1)
+                       );
+               }
+
+               // Store the entire data array back to the event
+               reg_db_auto_exec( "UPDATE reg SET date_select = '".serialize($ds_data)."' WHERE id = $id;", 0, CONN_STR, FALSE );
+
+               // Check if a previous or next year was requested
+                       if ($Option == 'Previous Year') {
+                               $ds_year--;
+                       } elseif ($Option == 'Next Year') {
+                               $ds_year++;
+                       } elseif ($Option != 'Delete Year') {
+
+                               // This is just a submit, so say it's stored and be done with it.
+                       $v['body'] .= '
+                               <h2>'.ucfirst($config->event_registration->word->event).' Dates Submitted.</h2>
+                       ';
+                               break;
+                       }
+
+       }
+
+       // Check to see if we have the selected year yet - if not, then create a blank one.
+               if (!isset($ds_data[$ds_year])) {
+               $ds_data[$ds_year] = dsEmptyYear($ds_year);
+               }
+
+               $v['body'] .= '
+                       <script src="'.BASE_APP_URL.'libjs/jqueryui/1.8.13/js/jquery-1.5.1.min.js"></script>
+                       <style>
+                               .dsPage {
+                                       width: 100%;
+                                       clear: both;
+                               }
+                               .dsPageHead {
+                                       display: block;
+                                       margin-left: auto;
+                                       margin-right: auto;
+                                       white-space:nowrap;
+                               }
+                               .dsCalHead {
+                                       width:auto;
+                                       padding: 0px 0px 0px 0px;
+                                       margin: 0px 0px 0px 0px;
+                                       clear: both;
+                               }
+                               .dsMonths {
+                               }
+                               .dsMonth {
+                                       display:  table;
+                               background-color:#eee;
+                               border:2px solid  #000;
+                               border-spacing: 0px;
+                                       padding: 0px 0px 0px 0px;
+                                       margin: 15px 15px 15px 15px;
+                                       width: 294px;
+                                       float: left;
+                              /* border-collapse:separate;*/
+                               }
+                               .dsMonthHead {
+                                       display:table-row;
+                                       width:auto;
+                                       padding: 0px 0px 0px 0px;
+                                       margin: 0px 0px 0px 0px;
+                               }
+                               .dsMonthAll {
+                                       float: left;
+                                       height: 24px;
+                                       clear: none;
+                                       height: 18px;
+                               width: 40px;
+                               background-color: #eee;
+                                       text-align: center;
+                                       background-color: #fff;
+                                       border: 1px solid #666;
+                                       margin: 2px 2px 2px 2px;
+                                       cursor: hand;
+                                       cursor: pointer;
+                       }
+                               .dsMonthName {
+                                       font-size: 16px;
+                                       text-align: center;
+                               }
+                               .dsMonthNone {
+                                       float: right;
+                                       height: 24px;
+                                       clear: none;
+                                       height: 18px;
+                               width: 40px;
+                               background-color: #eee;
+                                       text-align: center;
+                                       background-color: #fff;
+                                       border: 1px solid #666;
+                                       margin: 2px 2px 2px 2px;
+                                       cursor: hand;
+                                       cursor: pointer;
+                       }
+                               .dsWeek {
+                                       display:table-row;
+                                       width:auto;
+                                       background-color: #ccc;
+                                       height: 18px;
+                                       padding: 0px 0px 0px 0px;
+                                       margin: 0px 0px 0px 0px;
+                               }
+                               .dsHeadCell {
+                                       float: left;
+                               display: table-column;
+                                       height: 20px;
+                               width: 40px;
+                               background-color: #888;
+                                       color: #fff;
+                                       border: 1px solid #666;
+                                       text-align: center;
+                                       cursor: hand;
+                                       cursor: pointer;
+                                       padding: 0px 0px 0px 0px;
+                                       margin: 0px 0px 0px 0px;
+                               }
+                               .dsDateCell {
+                                       float: left;
+                               display: table-column;
+                                       height: 16px;
+                               width: 40px;
+                               background-color: #fff;
+                                       border: 1px solid #666;
+                                       text-align: center;
+                                       cursor: hand;
+                                       cursor: pointer;
+                                       padding: 0px 0px 0px 0px;
+                                       margin: 0px 0px 0px 0px;
+                               }
+                               .dsDateCellSel {
+                               background-color: #9ff;
+                               }
+                               .dsNoDateCell {
+                                       float: left;
+                               display: table-column;
+                                       height: 16px;
+                               width: 40px;
+                               background-color: #ccc;
+                                       border: 1px solid  #666;
+                                       text-align: center;
+                                       padding: 0px 0px 0px 0px;
+                                       margin: 0px 0px 0px 0px;
+                               }
+                               .dsGlobalAction {
+                                       display: inline;
+                                       height: 16px;
+                               width: 80px;
+                               background-color: #eee;
+                                       border: 1px solid  #666;
+                                       text-align: center;
+                                       cursor: hand;
+                                       cursor: pointer;
+                                       padding: 4px 4px 4px 4px;
+                                       margin: 2px 2px 2px 2px;
+                               }
+                               .dsGlobalSubmit {
+                               width: 110px;
+                                       text-align: center;
+                                       cursor: hand;
+                                       cursor: pointer;
+                                       padding: 4px 4px 4px 4px;
+                                       margin: 2px 2px 22px 2px;
+                               }
+                       </style>
+                       <center>
+                               <h2>Dates '.ucfirst($config->event_registration->word->event).' Occurs: <span style="color: blue;">'.$ds_year.'</span></h2>
+                               <form action="'.THIS_SCRIPT.'">
+                                       <input type="hidden" name="Action" value="Eve_Dat">
+                                       <input type="hidden" name="id" value="'.$id.'">
+                                       <input type="hidden" name="ds_year" value="'.$ds_year.'">
+                               <div class="dsPage">
+                                       <div class="dsPageHead">
+                                               <input type="submit" name="Option" value="Previous Year" class="dsGlobalSubmit">
+                                               <input type="submit" name="Option" value="Submit" class="dsGlobalSubmit">
+                                               <input type="submit" name="Option" value="Next Year" class="dsGlobalSubmit">
+                                       </div>
+                                       <br clear="all">
+                                       <div class="dsPageHead">
+                                               <div class="dsGlobalAction" id="setAll">Set all dates for this year</div>
+                                               <div class="dsGlobalAction" id="clearAll">Clear all dates for this year</div>
+                                       </div>
+                                       <br clear="all">
+                                               Enter "Delete" to delete this entire year:<br>
+                                               <input type="text" name="deleteYear" value=""><br><input type="submit" name="Option" value="Delete Year" class="dsGlobalSubmit">
+                                       <div class="dsMonths">
+               ';
+
+               // Build year display - process months
+               foreach($ds_data[$ds_year] as $m) {
+                       $v['body'] .= dsMonth($m);
+               }
+
+               $v['body'] .= "
+                               </div> <!-- dsMonths -->
+                       </div> <!-- dsPage -->
+                       </form>
+                       <br clear=\"all\">
+                       </center>
+                       <script>
+                               $(document).ready(function() {
+
+                                       $('#setAll').click(function() {
+                                               $('.dsDateCell').each(function() {
+                                                       $(this).addClass('dsDateCellSel');
+                                               });
+                                       });
+
+                                       $('#clearAll').click(function() {
+                                               $('.dsDateCellSel').each(function() {
+                                                       $(this).removeClass('dsDateCellSel');
+                                               });
+                                       });
+
+                                       $('.dsMonthAll').click(function() {
+                                               m = $(this).attr('month');
+                                               $('.'+m).addClass('dsDateCellSel');
+                                       });
+
+                                       $('.dsMonthNone').click(function() {
+                                               m = $(this).attr('month');
+                                               $('.'+m).removeClass('dsDateCellSel');
+                                       });
+
+                                       $('.dsDateCell').click(function() {
+                                               $(this).toggleClass('dsDateCellSel');
+                                       });
+
+                                       $('.dsGlobalSubmit').click(function() {
+                                               $('.dsDateCell').each(function() {
+                                                       doy = $(this).attr('day');
+                                                       v = 0;
+                                                       if ($(this).is('.dsDateCellSel')) {
+                                                               v = 1;
+                                                       }
+                                                       $('#day_'+doy).attr('value', v);
+                                               });
+                                       });
+
+                       });
+                       </script>
+               ";
+
+       break;
+
+
+    case 'Mem':
+
+        // Check if a new password has been submitted
+        if (isset($_REQUEST['password_new']) && ($password = trim($_REQUEST['password_new'])) != '') {
+
+            $pw_md5 = md5($password);
+            $reg_id = ($_REQUEST['id'] - 0);
+            reg_db_auto_exec( "UPDATE members.member SET member_passwd = '$pw_md5' WHERE member_id = $reg_id;", CONN_STR, FALSE );
+
+        }
+
+        $member_fields = array
+        (
+                'member_id'     => 'member_id,      text.20,                    Memb ID,                                    FALSE,      member_id,      vlf',
+                'fname'         => 'fname,          text.40,                    First Name,                                 TRUE,       fname,          vlf',
+                'lname'         => 'lname,          text.40,                    Last Name,                                  TRUE,       lname,          vlf',
+                'member_id_e'   => 'member_id,      text.20,                    Memb ID,                                    DISPLAY,    member_id,      e',
+                'fname_e'       => 'fname,          text.40,                    First Name,                                 DISPLAY,    fname,          e',
+                'lname_e'       => 'lname,          text.40,                    Last Name,                                  DISPLAY,    lname,          e',
+                'city'          => 'city,           text.40,                    City,                                       FALSE,      city,           vlf',
+                'state'         => 'state,          text.5,                     State,                                      FALSE,      state,          vlf',
+                'zip'           => 'zip,            text.12,                    ZIP/Postal Code,                            FALSE,      zip,            vf',
+                'phone'         => 'phone,          text.15,                    Phone Number,                               FALSE,      phone,          vf',
+                'email'         => 'email,          text.40,                    E-Mail Address,                             TRUE,       email,          vf',
+                'member_login'  => 'member_login,   text.15,                    Login,                                      FALSE,      member_login,   vl',
+                'password'      => 'password_new,   text.15,                    Password (Enter to change),                 FALSE,      password_new,   e',
+        );
+
+        $r = admin_process_records_r
+        (
+                "members.member",     // Table
+                '',                   // Where
+                'lname, fname',       // Order fields
+                CONN_STR,             // Connect String
+                $id,                  // Current ID
+                $member_fields,       // Fields array
+                'new,view,edit,filter,sortlinks',    // Options
+                20,                   // Rows
+                THIS_SCRIPT,          // URL
+                'Mem',                // Action
+                '',                   // Passed parameter
+                'Member',    // Base Title
+                array(),                   // View string
+                $Option,              // Option
+                $start,               // Starting row for lists
+                '',                   // Other Options
+                '',                   // Title View
+                '',                   // Quick Tip
+                'member_id'           // ID Field
+        );
+
+        $v['body'] .= $r['text'];
+
+        // If displaying detail, create link to go directly to registrations front-end for this user
+        if ($Option == 'View') {
+
+            $v['body'] .= '
+                <center>
+                    <form action="'.BASE_SECURE_URL.'index.php?catid='.$config->event_registration->event_page.'" method="POST" target="registrations">
+                        <input type="hidden" name="preview" value="1">
+                        <input type="hidden" name="specified_member_id" value="'.$id.'">
+                        <input type="hidden" name="Action" value="Step1">
+                        <input type="hidden" name="AdminUser" value="YES">
+                        <input type="submit" name="submit" value="Enter new registration for this member">
+                    </form>
+                </center>
+            ';
+
+        }
+
+        break;
+
+    case 'Use':
+
+        // Check if a new password has been submitted
+        if (isset($_REQUEST['password_new']) && ($password = trim($_REQUEST['password_new'])) != '') {
+
+            $pw_md5 = md5($password);
+            $reg_id = ($_REQUEST['id'] - 0);
+            reg_db_auto_exec( "UPDATE registrant SET password = '$pw_md5' WHERE id = $reg_id;", CONN_STR, FALSE );
+
+        }
+
+        $user_fields = array
+            (
+            'id'            => 'id,             int,                        Registered User #,                          DISPLAY,    id,             ev',
+            'id_l'          => 'id,             int,                        User #,                                     DISPLAY,    id,             l',
+            'is_member'     => 'is_member,      checkbox,                   Member,                                     FALSE,      is_member,      vlf',
+            'member_id'     => 'member_id,      text.20,                    Memb ID,                                    FALSE,      member_id,      vlf',
+            'fname'         => 'fname,          text.40,                    First Name,                                 TRUE,       fname,          naeuvlf',
+            'lname'         => 'lname,          text.40,                    Last Name,                                  TRUE,       lname,          naeuvlf',
+            'addr1'         => 'addr1,          text.40,                    Address,                                    FALSE,      addr1,          naeuv',
+            'addr2'         => 'addr2,          text.40,                    Address,                                    FALSE,      addr2,          naeuv',
+            'city'          => 'city,           text.40,                    City,                                       FALSE,      city,           naeuvl',
+            'state'         => 'state,          text.5,                     State,                                      FALSE,      state,          naeuv',
+            'zip'           => 'zip,            text.12,                    ZIP/Postal Code,                            FALSE,      zip,            naeuv',
+            'zip_l'         => 'zip,            text.12,                    ZIP,                                        FALSE,      zip,            l',
+            'country'       => 'country,        text.10,                    Country,                                    FALSE,      country,        naeuv',
+            'winder_addr'   => 'winter_addr,    text.40,                    Winter Address,                             FALSE,      winter_addr,    naeuv',
+            'phone'         => 'phone,          text.15,                    Phone Number,                               FALSE,      phone,          naeuvlf',
+            'email'         => 'email,          text.40,                    E-Mail Address,                             TRUE,       email,          naeuvf',
+            'b2'            => ',               break.Note that the E-Mail address must be unique&#46;<br>
+                                                                                       There cannot be two registered users with the same E-Mail address&#46;,   ,        FALSE,      ,                ev',
+            'email_l'       => 'email,          text.40,                    E-Mail,                                     TRUE,       email,          l',
+            'password'      => 'password_new,   text.15,                    Password<br>Enter to change,                FALSE,      password_new,   e',
+            'email_ok'      => 'email_ok,       checkbox,                   OK to send E-Mail,                          FALSE,      email_ok,       naeuv',
+            'user_trace_info' => 'user_trace_info,  text,                   <nobr>User Tracking Info</nobr>,            FALSE,      user_trace_info,v'
+            );
+
+        if (!$config->event_registration->have_members) {
+            unset($user_fields['is_member']);
+            unset($user_fields['member_id']);
+        }
+
+        $r = admin_process_records_r
+            (
+            "registrant",         // Table
+            '',                   // Where
+            'lname, fname',       // Order fields
+            CONN_STR,             // Connect String
+            $id,                  // Current ID
+            $user_fields,         // Fields array
+            'new,view,edit,delete,strong,filter,sortlinks',    // Options
+            20,                   // Rows
+            THIS_SCRIPT,          // URL
+            'Use',                // Action
+            '',                   // Passed parameter
+            'Registered User',    // Base Title
+            array(),                   // View string
+            $Option,              // Option
+            $start                // Starting row for lists
+            );
+
+        $v['body'] .= $r['text'];
+
+        // If displaying detail, create link to go directly to registrations front-end for this user
+        if ($Option == 'View') {
+
+            // Get the needed user information
+            $sql = "
+                SELECT is_member, member_id
+                  FROM registrations.registrant
+                 WHERE id = $id
+            ;";
+            $user_data = db_auto_get_row($sql, 0, CONN_STR, FALSE);
+
+            // If the
+            $member_id = '';
+            if ($user_data['is_member'] == 't') {
+                $member_id = $user_data['member_id'];
+            }
+
+            $v['body'] .= '
+                <center>
+                    <form action="'.BASE_SECURE_URL.'index.php?catid='.$config->event_registration->event_page.'" method="POST" target="registrations">
+                        <input type="hidden" name="preview" value="1">
+                        <input type="hidden" name="specified_registrant" value="'.$id.'">
+                        <input type="hidden" name="specified_member_id" value="'.$member_id.'">
+                        <input type="hidden" name="Action" value="Step1">
+                        <input type="hidden" name="AdminUser" value="YES">
+                        <input type="submit" name="submit" value="Enter new registration for this user">
+                    </form>
+                </center>
+            ';
+
+        }
+
+        break;
+
+
+    case "Reg_Att":
+
+        $id = ($id-0);
+
+        if ($id == 0)
+            break;
+
+        $reason = array();
+
+        // Check if updated data is being submitted
+        if ($_REQUEST['Option'] == 'Update') {
+
+            $att_data = array();
+
+            // Scan submitted data
+            while (list($key, $val) = each($_REQUEST)) {
+
+                // If it's an attendee name field
+                if (substr($key, -5) == '_name') {
+
+                    // att_{cart_id}_{attendee_id}_name
+                    $a = explode("_", $key);
+
+                    // Sanitize input
+                    $s = 'att_'.$a[1].'_'.$a[2].'_';
+                    $name = filter_input(INPUT_POST, $s.'name', FILTER_SANITIZE_STRING);
+                    $dob = filter_input(INPUT_POST, $s.'dob', FILTER_SANITIZE_STRING);
+                    $guardian = filter_input(INPUT_POST, $s.'guardian', FILTER_SANITIZE_STRING);
+                    $emer_contact = filter_input(INPUT_POST, $s.'emer_contact', FILTER_SANITIZE_STRING);
+                    $emer_phone = filter_input(INPUT_POST, $s.'emer_phone', FILTER_SANITIZE_STRING);
+                    $med_history = filter_input(INPUT_POST, $s.'med_history', FILTER_SANITIZE_STRING);
+                    $allergy_med = filter_input(INPUT_POST, $s.'allergy_med', FILTER_SANITIZE_STRING);
+
+                    // If delete is not requested or there's a name - otherwise we just don't processes it.
+                    if ($_REQUEST['att_'.$a[1].'_'.$a[2].'_delete'] == '' && $name != '' ) {
+
+                        if ($_REQUEST[$s."med_required"] == 'true') {
+
+                            if (empty($dob)) {
+                                $reason[]['text'] = "DOB is required for $name.";
+                            }
+                            if (empty($emer_contact)) {
+                                $reason[]['text'] = "Emergency contact is required for $name.";
+                            }
+                            if (empty($emer_phone)) {
+                                $reason[]['text'] = "Emergency phone is required for $name.";
+                            }
+                        }
+
+                        $attendee_id = count($att_data[$a[1]]) + 1;
+                        $att_data[$a[1]][$attendee_id] = array(
+                                'attendee_id' => $attendee_id,
+                                'name' => $name,
+                                'dob' => $dob,
+                                'guardian' => $guardian,
+                                'emer_contact' => $emer_contact,
+                                'emer_phone' => $emer_phone,
+                                'med_history' => $med_history,
+                                'allergy_med' => $allergy_med
+                        );
+                    }
+                }
+            }
+
+            // Store the updated attendee information - Even if there's problems with the submission
+            while (list($key, $val) = each($att_data)) {
+
+                // Get the current number attending for this activity detail record
+                $detail_data = db_auto_get_row( "SELECT registration, numb_attending, R.attendee_limit FROM reg_detail D, reg R WHERE D.id = $key AND R.id = D.registration;", 0, SI_CONN_STR, FALSE );
+
+                // Serialize the new attendee data for storage
+                $numb_attending = count($val);
+                $attendees = serialize($val);
+                $sql = "
+                    UPDATE reg_detail
+                       SET numb_attending = $numb_attending,
+                           attendees = '".addslashes($attendees)."'
+                     WHERE id = $key;
+                ";
+                reg_db_auto_exec( $sql, CONN_STR, FALSE );
+
+                // Now update the reg attendee numbers accordingly, but only if the registrations are limited
+                if ($detail_data['attendee_limit'] == 't') {
+                    $diff = $numb_attending - $detail_data['numb_attending'];
+                    $sql = "
+                        UPDATE reg
+                           SET attendee_count = attendee_count + $diff
+                         WHERE id = ".$detail_data['registration'].";
+                    ";
+                    reg_db_auto_exec( $sql, CONN_STR, FALSE );
+                }
+            }
+
+        }
+
+        // If there's no submission problems or just displaying edit form for the first time
+        if ($_REQUEST['Option'] != 'Update' || count($reason) > 0) {
+
+            // Get data for this registration
+            $reg_data = db_auto_get_row( "SELECT lname, fname, date_entered, status FROM reg_req WHERE id = $id;", 0, SI_CONN_STR, FALSE );
+                    if ($config->event_registration->sub_categories) {
+                   $sql = "
+                       SELECT D.*, R.name as RegName, T.med_info
+                         FROM reg_detail D, reg R, category C, todo T
+                        WHERE D.reg_req = $id
+                          AND R.id = D.registration
+                          AND C.id = R.category
+                          AND T.id = C.todo
+                     ORDER BY R.name, D.id
+                   ;";
+            } else {
+               $sql = "
+                                       SELECT D.*, R.name as RegName, T.med_info
+                                         FROM reg_detail D, reg R, todo T
+                                        WHERE D.reg_req = $id
+                                          AND R.id = D.registration
+                                          AND T.id = R.category
+                                 ORDER BY R.name, D.id
+               ;";
+            }
+                       $reg_detail = reg_db_auto_get_data( $sql, SI_CONN_STR, FALSE );
+
+            // If we have some events listed
+            if (is_array($reg_detail) && count($reg_detail) > 0) {
+
+                $t['have_regs'] = 'YES';
+
+                // Build attendee arrays
+                while (list($key, $val) = each($reg_detail)) {
+
+                        // Try to unserialize the attendees (new style)
+                    $a = unserialize(stripslashes($val['attendees']));
+
+                        // If successful
+                    if ($a) {
+                        $reg_detail[$key]['attendee_array'] = $a;
+
+                    // Otherwise it's the old "," separated list
+                    } else {
+                       $a = explode(",", $val['attendees']);
+                            $reg_detail[$key]['attendee_array'] = array();
+                        $a_id = 0;
+                        foreach ($a as $att) {
+
+                            // Create a detail array entry for each attendes (id=0 means not stored yet)
+                            $reg_detail[$key]['attendee_array'][] = array(
+                            'attendee_id' => ++$a_id,
+                            'name' => $att,
+                            'dob' => $val['dob'],
+                            'guardian' => $val['guardian'],
+                            'emer_contact' => $val['emer_contact'],
+                            'emer_phone' => $val['emer_phone'],
+                            'med_history' => $val['med_history'],
+                            'allergy_med' => $val['allergy_med']
+                            );
+                        }
+                    }
+
+                    // Create a new detail array entry for a possible additional attendee
+                    $reg_detail[$key]['attendee_array'][] = array(
+                        'attendee_id' => count($reg_detail[$key]['attendee_array']) + 1,
+                        'name' => '',
+                        'dob' => '',
+                        'guardian' => '',
+                        'emer_contact' => '',
+                        'emer_phone' => '',
+                        'med_history' => '',
+                        'allergy_med' => ''
+                    );
+
+                    // Now drop the old contact/med info since we don't need it anymore and it interferes with the new view parameters
+                    unset($reg_detail[$key]['dob']);
+                    unset($reg_detail[$key]['guardian']);
+                    unset($reg_detail[$key]['emer_contact']);
+                    unset($reg_detail[$key]['emer_phone']);
+                    unset($reg_detail[$key]['med_history']);
+                    unset($reg_detail[$key]['allergy_med']);
+                }
+            } else {
+                $t['have_regs'] = 'NO';
+            }
+
+            // Display Attendee Edit Form
+            $tags = $view_tags;
+            $t =& $tags["global"];
+
+            $t['this_script'] = THIS_SCRIPT;
+
+            // Check for failure reason
+            if (count($reason) > 0) {
+                $tags['reason'] = $reason;
+                $t['have_reason'] = 'YES';
+            } else {
+                $t['have_reason'] = 'NO';
+            }
+
+            $t['reg_id'] = $id;
+            $t['lname'] = $reg_data['lname'];
+            $t['fname'] = $reg_data['fname'];
+            $t['date_entered'] = $reg_data['date_entered'];
+            $t['status'] = $si_reg_status_types[$reg_data['status']];
+            $tags['detail'] = $reg_detail;
+            $v['body'] .= parse_view_localcheck($config->event_registration->custom_view_files, "edit_attendees.html", $tags, 'FALSE' );
+            break;
+        }
+        // Falls through if there's a good attendee submission
+
+    case "Reg":
+
+       // If updating
+        if( $Option == 'Update' )
+            {
+            // Get needed registration data
+            $sql = "SELECT status
+                      FROM reg_req
+                     WHERE reg_req.id = $id
+            ;";
+            $reg_data = db_auto_get_row( $sql, 0, CONN_STR, FALSE );
+
+            // Get registration detail for all events (cart entries) in this request
+            $sql = "
+                SELECT D.*, R.need_attendees
+                  FROM reg_detail D, reg R
+                 WHERE D.reg_req = $id
+                   AND R.id = D.registration
+              ORDER BY D.id
+            ;";
+            $reg_detail = reg_db_auto_get_data( $sql, SI_CONN_STR, FALSE );
+
+            // If there's at least one event registered
+            if (count($reg_detail) > 0) {
+
+                // Check if canceling a registration that's not been canceled
+                if( $status == SI_REG_STATUS_CANCELED && $reg_data['status'] != SI_REG_STATUS_CANCELED) {
+
+                    $sql = '';
+                    reset($reg_detail);
+                    foreach ($reg_detail as $rd) {
+
+                        // If the event counts attendees
+                        if ($rd['need_attendees'] == 't') {
+
+                            // Decriment attendees by the number in this registration
+                            $sql .= "UPDATE reg SET attendee_count = attendee_count - ".$rd['numb_attending']." WHERE id = ".$rd['registration'].";\n";
+                        }
+                    }
+                    reg_db_auto_exec( $sql, CONN_STR, FALSE );
+
+                // check if un-canceling a registration
+                } elseif( $status != SI_REG_STATUS_CANCELED && $reg_data['status'] == SI_REG_STATUS_CANCELED) {
+
+                    $sql = '';
+                    reset($reg_detail);
+                    foreach ($reg_detail as $rd) {
+
+                        // If the event counts attendees
+                        if ($rd['need_attendees'] == 't') {
+
+                            // Incriment attendees by the number in this registration
+                            $sql .= "UPDATE reg SET attendee_count = attendee_count + ".$rd['numb_attending']." WHERE id = ".$rd['registration'].";\n";
+                        }
+                    }
+                    reg_db_auto_exec( $sql, CONN_STR, FALSE );
+
+                }
+
+            } // if there's at least one event registerred
+
+            // If confirming credit card paymnet
+            $send_conf = false;
+            if( $status == SI_REG_STATUS_CC_PAID && $reg_data['status'] == SI_REG_STATUS_CC_PEND )
+                {
+                if( empty($cc_conf) )
+                    {
+                    $v['body'] .= '<H3><FONT COLOR="red">Credit Card Confirmation # Required</FONT></H3>
+                            Please include a confirmation number when confirming a credit card paymnet.<P>
+                        ';
+                    $status = SI_REG_STATUS_CC_PEND;
+                    }
+                else
+                    {
+                    $_REQUEST['cc_numb'] = "....... ".substr(  $_REQUEST['cc_numb'], -4 );
+                                       $send_conf = true;
+
+                    }
+                } // If confirming credit card paymnet
+
+            if( $reg_data['attendee_count'] > $reg_data['attendee_max'] )
+                echo '<H3><FONT COLOR="red">Warning:</FONT> '.$v['attendeeTermCap'].' limit for this convention exceeded.</H3>
+                    ';
+            } // If updating
+
+        // If sort order hasn't been selected, check on default in config file.
+        if (!isset($GLOBALS['sortclicked']) && !isset($GLOBALS['sortclicked_new'])) {
+            if ($config->event_registration->admin_opt->Submissions->sort_field != '') {
+                $GLOBALS['sortclicked'] = $config->event_registration->admin_opt->Submissions->sort_field;
+            }
+            if ($config->event_registration->admin_opt->Submissions->sort_direction != '') {
+                $GLOBALS['list_sort_direction'] = $config->event_registration->admin_opt->Submissions->sort_direction;
+            }
+        }
+
+        // Check if status hasn't been defined and provide default
+        if (!isset($_REQUEST['status']) && $config->event_registration->admin_opt->Submissions->status != '') {
+            $x = explode(",", $config->event_registration->admin_opt->Submissions->status);
+            $_REQUEST['status'] = array();
+            foreach($x as $y) {
+                if (isset($si_reg_status_array[trim($y)])) {
+                    $status[] = $si_reg_status_array[trim($y)];
+                }
+            }
+                       $_REQUEST['status'] = $status;
+        }
+
+        $reg_fields = array
+            (
+            'id'               => 'id,                 int,                        Reg #,                                      DISPLAY,    id,                 evlf',
+            'user_trace_info'  => 'user_trace_info,    text,                           <nobr>User Tracking Info</nobr>,            FALSE,      user_trace_info,    v',
+            'date_entered'     => 'date_entered,       date,                       Date Submitted,                             FALSE,      date_entered,       f',
+            'date_entered_l'   => 'date_entered,       date,                       Submitted,                                  FALSE,      date_entered,       l',
+            'b0'               => ',                   break.<h3>Submitted By:</h3>,                 ,                                           FALSE,      ,                 ev',
+            'fname'             => 'fname,             text.40,                    First Name,                                 FALSE,      fname,              euvlf',
+            'lname'             => 'lname,             text.40,                    Last Name,                                  FALSE,      lname,              euvlf',
+            'org'              => 'org,                text.40,                    Company/Organization,                       FALSE,      org,                euvf',
+            'org_l'            => 'org,                text.40,                    Org,                                                        FALSE,      org,                l',
+            'title'            => 'title,              text.20,                    Title,                                      FALSE,      title,              euv',
+            'addr1'            => 'addr1,              text.40,                    Address,                                    FALSE,      addr1,              euv',
+            'addr2'            => 'addr2,              text.40,                    Address,                                    FALSE,      addr2,              euv',
+            'city'             => 'city,               text.40,                    City,                                       FALSE,      city,               euv',
+            'state'            => 'state,              text.5,                     State,                                      FALSE,      state,              euv',
+            'zip'              => 'zip,                text.12,                    ZIP/Postal Code,                            FALSE,      zip,                euv',
+            'country'          => 'country,            text.10,                    Country,                                    FALSE,      country,            euv',
+            'phone'            => 'phone,              text.15,                    Phone Number,                               FALSE,      phone,              euv',
+            'fax'              => 'fax,                text.15,                    FAX Number,                                 FALSE,      fax,                euv',
+            'b1'               => ',                   break.<h3>'.$config->event_registration->titles->contact_information.':</h3>,                 ,                                           FALSE,      ,                 ev',
+            'contact_fname'     => 'contact_fname,      text.40,                    '.$config->event_registration->prompt->contact_fname.',                         FALSE,      contact_fname,      euvf',
+            'contact_lname'     => 'contact_lname,      text.40,                    '.$config->event_registration->prompt->contact_lname.',                          FALSE,      contact_lname,      euvf',
+            'contact_addr1'     => 'contact_addr1,      text.40,                    '.$config->event_registration->prompt->contact_addr1.',                            FALSE,      contact_addr1,      euv',
+            'contact_addr2'     => 'contact_addr2,      text.40,                    '.$config->event_registration->prompt->contact_addr2.',                            FALSE,      contact_addr2,      euv',
+            'contact_city'      => 'contact_city,       text.40,                    '.$config->event_registration->prompt->contact_city.',                               FALSE,      contact_city,       euv',
+            'contact_state'     => 'contact_state,      text.5,                     '.$config->event_registration->prompt->contact_state.',                              FALSE,      contact_state,      euv',
+            'contact_zip'       => 'contact_zip,        text.12,                    '.$config->event_registration->prompt->contact_zip.',                    FALSE,      contact_zip,        euv',
+            'contact_country'   => 'contact_country,    text.10,                    '.$config->event_registration->prompt->contact_country.',                            FALSE,      contact_country,    euv',
+            'contact_phone'     => 'contact_phone,      text.15,                    '.$config->event_registration->prompt->contact_phone.',                       FALSE,      contact_phone,      euv',
+            'contact_fax'       => 'contact_fax,        text.15,                    '.$config->event_registration->prompt->contact_fax.',                         FALSE,      contact_fax,        euv',
+            'b11'              => ',                   break.<h3>Other Information:</h3>,                 ,                                           FALSE,      ,                    ev',
+            'email'            => 'email,              text.40,                    E-Mail Address,                             FALSE,      email,              euv',
+            'email_ok'         => 'email_ok,           checkbox,                   OK to send E-Mail,                          FALSE,      email_ok,           euv',
+            'b2'               => ',                   break.<h3>Member Information:</h3><BR>,                 ,                                           FALSE,      ,                       ev',
+            'is_member'         => 'is_member,         checkbox,                   Member,                                     FALSE,      is_member,          euvlf',
+            'member_id'         => 'member_id,         text.10,                    Memb ID,                                    FALSE,      member_id,          euvlf',
+            'b3'                => ',                  break.<h3>Charges and Payment:</h3><BR>,                 ,                                           FALSE,      ,                      ev',
+            'total'             => 'total,             money,                      Total charges,                              FALSE,      total,              euv',
+            'status'            => 'status,            list.'.$si_reg_status_list.',   Status,                                 FALSE,      status,             euvl',
+            'status_f'          => 'status,            list.'.$si_reg_status_list.'..multi~blank,    Status,                         FALSE,      status,               f',
+            'b4'                => ',                  break.Credit Card Conf # required when confirming credit card&#46;</B>, ,   FALSE,              ,                       e',
+            'b5'                => ',                  break.<h3>Credit Card Information</h3>,                   ,           FALSE,      ,                     ev',
+            'cc_name'           => 'cc_name,            text.40,                    Name on Credit Card,                        FALSE,      cc_name,            euv',
+            'cc_numb'           => 'cc_numb,            text.20,                    Credit Card Number,                         FALSE,      cc_numb,            euv',
+            'cc_exp'            => 'cc_exp,            text.10,                    Credit Card Expiration,                     FALSE,      cc_exp,             euv',
+            'cc_cvv'            => 'cc_cvv,            text.10,                    Credit Card CVV #,                          FALSE,      cc_cvv,             euv',
+            'cc_conf'           => 'cc_conf,           text.20,                    Credit Card Conf #,                         FALSE,      cc_conf,            euvf',
+            'b6'                => ',                  break.<BR>,                 ,                                           FALSE,      ,                   ev',
+            'notes'             => 'notes,             textbox.40.5,               Notes,                                      FALSE,      notes,              euv'
+//          'summary'                  => 'summary,            rawtext,                    <NOBR>Original Stored Summary</NOBR>,       FALSE,      summary,            v'
+            );
+
+
+        if (!$config->event_registration->show_contact_data) {
+               unset($reg_fields['b1']);
+        }
+        if (!$config->event_registration->show_contact_data || $config->event_registration->prompt->contact_fname == '') {
+               unset($reg_fields['contact_fname']);
+        }
+        if (!$config->event_registration->show_contact_data || $config->event_registration->prompt->contact_lname == '') {
+               unset($reg_fields['contact_lname']);
+        }
+        if (!$config->event_registration->show_contact_data || $config->event_registration->prompt->contact_addr1 == '') {
+               unset($reg_fields['contact_addr1']);
+        }
+        if (!$config->event_registration->show_contact_data || $config->event_registration->prompt->contact_addr2 == '') {
+               unset($reg_fields['contact_addr2']);
+        }
+        if (!$config->event_registration->show_contact_data || $config->event_registration->prompt->contact_city == '') {
+               unset($reg_fields['contact_city']);
+        }
+        if (!$config->event_registration->show_contact_data || $config->event_registration->prompt->contact_state == '') {
+               unset($reg_fields['contact_state']);
+        }
+        if (!$config->event_registration->show_contact_data || $config->event_registration->prompt->contact_zip == '') {
+               unset($reg_fields['contact_zip']);
+        }
+        if (!$config->event_registration->show_contact_data || $config->event_registration->prompt->contact_country == '') {
+               unset($reg_fields['contact_country']);
+        }
+        if (!$config->event_registration->show_contact_data || $config->event_registration->prompt->contact_phone == '') {
+               unset($reg_fields['contact_phone']);
+        }
+        if (!$config->event_registration->show_contact_data || $config->event_registration->prompt->contact_fax == '') {
+               unset($reg_fields['contact_fax']);
+        }
+
+        if (!$config->event_registration->have_members) {
+               unset($reg_fields['b2']);
+            unset($reg_fields['is_member']);
+            unset($reg_fields['member_id']);
+        }
+
+        $r = admin_process_records_r
+            (
+            "reg_req",    // Table
+            '',                    // Where
+            'date_entered, id',     // Order fields
+            CONN_STR,        // Connect String
+            $id,                 // Current ID
+            $reg_fields,        // Fields array
+            'view,edit,filter,sortlinks',    // Options
+            20,                     // Rows
+            THIS_SCRIPT,        // URL
+            'Reg',    // Action
+            '',                    // Passed parameter
+            'Submissions',    // Base Title
+            array(),                 // View string
+            $Option,            // Option
+            $start                // Starting row for lists
+            );
+
+               // If need to send confirmation to customer
+               if ($send_conf) {
+
+                       // Send confirmation to Customer
+
+                       $req_data = db_auto_get_row( "SELECT * FROM reg_req WHERE id = $id;", 0, CONN_STR, FALSE );
+
+                       $v['checkout_type']     = 'Confirmation';
+                       $v['request_numb']              = $req_data['id'];
+                       $v['fname']             = $req_data['fname'];
+                       $v['lname']             = $req_data['lname'];
+                       $v['org']               = $req_data['org'];
+                       $v['title']             = $req_data['title'];
+                       $v['addr1']             = $req_data['addr1'];
+                       $v['addr2']             = $req_data['addr2'];
+                       $v['city']              = $req_data['city'];
+                       $v['state']             = $req_data['state'];
+                       $v['zip']               = $req_data['zip'];
+                       $v['country']           = $req_data['country'];
+                       $v['phone']             = $req_data['phone'];
+                       $v['fax']               = $req_data['fax'];
+                       $v['email']             = $req_data['email'];
+                       $v['total']             = money($req_data['total']);
+                       $v['cc_type']           = $req_data['cc_type'];
+                       $v['cc_name']           = $req_data['cc_name'];
+                       $v['cc_numb']           = $req_data['cc_numb'];
+                       $v['cc_conf']           = $req_data['cc_conf'];
+                       $v['cc_exp']            = $req_data['cc_exp'];
+                       $v['html_summary']              = $req_data['summary'];
+
+                       $html_summary = parse_view_localcheck($config->event_registration->custom_view_files, "registrations_cc_confirmation.html", $view_tags );
+                       $email_content = "--ContentBoundry\n"
+                                       ."Content-Type: text/plain; charset=\"US-ASCII\"\n"
+                                       ."\n"
+                                       .( SI_CUST_EMAIL_MODE == 3 ?    $text_summary : "This message may only be read using an HTML enabled E-Mail client." )
+                                       ."\n"
+                                       ."--ContentBoundry\n"
+                                       ."Content-Type: text/html; charset=\"US-ASCII\"\n"
+                                       ."\n"
+                                       .$html_summary
+                                       ."\n"
+                                       ."--ContentBoundry--\n"
+                                       ."\n";
+                       if( !empty($req_data['email']) ) {
+                               debug_mail( $req_data['email'], $config->event_registration->organization." Payment Confirmation", "$email_content.", "From: ".$config->event_registration->organization." <".$config->event_registration->organization_from_email.">"
+                                       ."\nMime-Version: 1.0\nContent-Type: multipart/alternative; boundary=ContentBoundry\n");
+                       }
+               }
+
+        // If Option is View, then display current attendee and original summary information
+        if ($Option == 'View' || $Option == 'Update') {
+
+            // Get the summary
+            $reg_data = db_auto_get_row( "SELECT summary FROM reg_req WHERE reg_req.id = $id;", 0, CONN_STR, FALSE );
+
+            // Get the attendee information
+            if ($config->event_registration->sub_categories) {
+                   $sql = "
+                       SELECT D.*, R.name as RegName, T.med_info
+                         FROM reg_detail D, reg R, category C, todo T
+                        WHERE D.reg_req = $id
+                          AND R.id = D.registration
+                          AND C.id = R.category
+                          AND T.id = C.todo
+                     ORDER BY R.name, D.id
+                   ;";
+            } else {
+               $sql = "
+                                       SELECT D.*, R.name as RegName, T.med_info
+                                         FROM reg_detail D, reg R, todo T
+                                        WHERE D.reg_req = $id
+                                          AND R.id = D.registration
+                                          AND T.id = R.category
+                                 ORDER BY R.name, D.id
+               ;";
+            }
+            $reg_detail = reg_db_auto_get_data( $sql, SI_CONN_STR, FALSE );
+
+            // If we have some events listed
+            $t['have_regs'] = 'NO';
+
+            if (is_array($reg_detail) && count($reg_detail) > 0) {
+
+                $t['have_regs'] = 'YES';
+
+                // Build attendee arrays
+                while (list($key, $val) = each($reg_detail)) {
+
+                    // Try to unserialize the attendees (new style)
+                    $a = unserialize(stripslashes($val['attendees']));
+                    // If successful
+                    if ($a) {
+                        $reg_detail[$key]['attendee_array'] = $a;
+
+                        // Otherwise it's the old "," separated list
+                    } else {
+                        $a = explode(",", $val['attendees']);
+                        $reg_detail[$key]['attendee_array'] = array();
+                        $a_id = 0;
+                        foreach ($a as $att) {
+
+                            // Create a detail array entry for each attendes
+                            $reg_detail[$key]['attendee_array'][] = array(
+                                    'attendee_id' => ++$a_id,
+                                    'name' => $att,
+                                    'dob' => $val['dob'],
+                                    'guardian' => $val['guardian'],
+                                    'emer_contact' => $val['emer_contact'],
+                                    'emer_phone' => $val['emer_phone'],
+                                    'med_history' => $val['med_history'],
+                                    'allergy_med' => $val['allergy_med']
+                            );
+                        }
+                    }
+
+                    // Now drop the old contact/med info since we don't need it anymore and it interferes with the new view parameters
+                    unset($reg_detail[$key]['dob']);
+                    unset($reg_detail[$key]['guardian']);
+                    unset($reg_detail[$key]['emer_contact']);
+                    unset($reg_detail[$key]['emer_phone']);
+                    unset($reg_detail[$key]['med_history']);
+                    unset($reg_detail[$key]['allergy_med']);
+
+                    // Additional things we need to pass
+                    $reg_detail[$key]['date_specific'] = ($val['date_specific']=='t' ? 'YES' : 'NO');
+                }
+
+            }
+
+            // Display Attendee View
+            $tags = $view_tags;
+            $t =& $tags["global"];
+            $tags['detail'] = $reg_detail;
+
+            // Add original summary to view
+            $t['summary'] = stripslashes($reg_data['summary']);
+            $r['text'] .= parse_view_localcheck($config->event_registration->custom_view_files, "view_attendees.html", $tags, 'FALSE' );
+
+        }
+
+        $v['body'] .= $r['text'];
+
+        break;
+
+    case "Rep":
+
+        if ($Option == '') {
+            $Option = 'Select Report';
+        }
+
+        $tags = $view_tags;
+        $t =& $tags["global"];
+        $t['this_script'] = THIS_SCRIPT;
+        $t['PrintReport'] = ($_REQUEST['PrintReport'] == 'Yes' ? 'YES' : 'NO');
+        $t['members'] = ($config->event_registration->have_members ? 'YES' : 'NO');
+        $t['date_time'] = date('l m/d/Y g:i:s');
+        $t['med_info_on'] = ($config->event_registration->medical_info ? 'YES' : 'NO');
+
+        $by_activity_date = ($_REQUEST['by_activity_date'] == 'on');
+               $t['by_activity_date'] = ($by_activity_date ? 'CHECKED': '');
+               $by_registration_date = ($_REQUEST['by_registration_date'] == 'on');
+               $t['by_registration_date'] = ($by_registration_date ? 'CHECKED': '');
+               $by_desired_date = ($_REQUEST['by_desired_date'] == 'on');
+               $t['by_desired_date'] = ($by_desired_date ? 'CHECKED': '');
+
+        $reason = array();
+        $t['reason_text'] = '';
+
+        // This is for links to print reports
+        $t['print_params'] =
+            'Action=Rep&Option=Display+Report'
+            .'&event='.$_REQUEST['event']
+            .'&status='.$_REQUEST['status']
+            .'&output_by='.$_REQUEST['output_by']
+            .'&sort_by='.$_REQUEST['sort_by']
+            .'&output_type='.$_REQUEST['output_type']
+            .'&activity_start_date='.$_REQUEST['activity_start_date']
+            .'&activity_end_date='.$_REQUEST['activity_end_date']
+            .'&registration_start_date='.$_REQUEST['registration_start_date']
+            .'&registration_end_date='.$_REQUEST['registration_end_date']
+            .'&admin_user='.$_REQUEST['admin_user']
+            .'&is_member='.$_REQUEST['is_member']
+            .'&member_id='.$_REQUEST['member_id']
+            .'&dyn_data='.$_REQUEST['dyn_data']
+        ;
+
+        $act_start_date = '';
+        $act_end_date = '';
+        $reg_start_date = '';
+        $reg_end_date = '';
+        $desired_start_date = '';
+        $desired_end_date = '';
+
+        // Do some checks on Display Report
+        if ($Option == 'Display Report') {
+
+            // Check Activity Date range
+            $act_start_date = strtotime($_REQUEST['activity_start_date']);
+            $act_end_date = strtotime($_REQUEST['activity_end_date']);
+            if ($act_end_date < $act_start_date) {
+                $reason[] = 'Activity End Date cannot be earlier than Activity Start Date';
+            }
+
+            // Check registration date range
+            $reg_start_date = strtotime($_REQUEST['registration_start_date']);
+            $reg_end_date = strtotime($_REQUEST['registration_end_date']);
+            if ($reg_end_date < $reg_start_date) {
+                $reason[] = 'Registration End Date cannot be earlier than Registration Start Date';
+            }
+
+            // Check registration date range
+            $desired_start_date = strtotime($_REQUEST['desired_start_date']);
+            $desired_end_date = strtotime($_REQUEST['desired_end_date']);
+            if ($desired_end_date < $desired_start_date) {
+                $reason[] = 'Desired End Date cannot be earlier than Desired Start Date';
+            }
+
+            if (count($reason) > 0) {
+                $Option = 'Select Report';
+            }
+        }
+
+        // Report steps
+        switch( $Option ) {
+
+            case 'Select Report':
+
+                // Get registrations list - what we get depens on whether there's categories and sub-categories
+                // If there's both main and sub categories
+                if ($config->event_registration->main_categories && $config->event_registration->sub_categories) {
+                    $sql = "
+                        SELECT R.id AS reg_id, R.name AS reg_name, T.id AS cat_id, T.name AS cat_name, C.id AS subcat_id, C.name AS subcat_name
+                          FROM reg R, todo T, category C
+                         WHERE C.id = R.category
+                           AND T.id = C.todo
+                         ORDER BY T.name, C.name, R.name;
+                    ";
+                } elseif ($config->event_registration->main_categories && !$config->event_registration->sub_categories) {
+                    $sql = "
+                        SELECT R.id AS reg_id, R.name AS reg_name, T.id AS cat_id, T.name AS cat_name, '' AS subcat_name
+                          FROM reg R, todo T
+                         WHERE T.id = R.category
+                         ORDER BY T.name, R.name;
+                    ";
+                } else {
+                    $sql = "
+                        SELECT R.id AS reg_id, R.name AS reg_name, '' AS cat_name, '' AS subcat_name
+                          FROM reg R
+                         ORDER BY R.name;
+                    ";
+
+                }
+                $reg_data = reg_db_auto_get_data( $sql, SI_CONN_STR, FALSE );
+
+                if(!is_array($reg_data) || count($reg_data) < 1)
+                    {
+                    $v['body'] .= '
+                        Reports - Alpha by Registrant
+                        <P>
+                        <h3>No '.$v['registrationsTerm'].' currently in database.</h3>
+                     ';
+                    break;
+                    }
+
+                // Build activity selection data
+                $reg = '
+                    <select name="event" id="eventSelect" onChange="changeDynAvailable();">
+                        <option value="0">--- All Activities ---</option>
+                ';
+                $cur_cat = '';
+                $cur_subcat = '';
+                foreach( $reg_data as $r ) {
+
+                    if ($r['cat_name'] != $cur_cat) {
+                        $cur_cat = $r['cat_name'];
+                        $reg .= '<option value="cat_'.$r['cat_id'].'" class="selectCategory">&nbsp;&nbsp;'.$cur_cat.'</option>
+                        ';
+                    }
+                    if ($r['subcat_name'] != $cur_subcat) {
+                        $cur_subcat = $r['subcat_name'];
+                        $reg .= '<option value="subcat_'.$r['subcat_id'].'" class="selectSubCategory">&nbsp;&nbsp;&nbsp;&nbsp;'.$cur_subcat.'</option>
+                        ';
+                    }
+                    $reg .= '<option value="'.$r['reg_id'].'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$r['reg_name'].'</option>
+                    ';
+                }
+                $reg .= '</select>';
+
+
+                // Build status selection data
+                $status_types =
+                    array(
+                        101 => 'All Submitted',
+                        102 => 'All Paid',
+                        103 => 'All Unpaid'
+                    ) +
+                    $si_reg_status_types;
+
+                $reason_text = '';
+                if (count($reason) > 0) {
+                    $reason_text = '<p><div style="border: 1px solid black;"><h3 style="color: red;">You have been returned to this step because ...</h3><ul>';
+                    foreach ($reason as $r) {
+                        $reason_text .= "<li>$r</li>";
+                    }
+                    $reason_text .= '</ul></div>s';
+                }
+
+                $t['reason_text'] = $reason_text;
+                $t['THIS_SCRIPT'] = SI_THIS_SCRIPT;
+                $t['reg_select'] = $reg;
+                $t['status_select'] = reg_build_picklist( "status", $status_types, '101', '' );
+                $t['activity_start_date'] = calendar_date_select(
+                    '6/1/2011',               // Default value
+                    $act_start_date,               // Selected Date
+                    strtotime('6/1/2011'),           // Start Date
+                    strtotime(date('m/d/Y').' +2 year'),               // End Date
+                    'report_selection',   // Form Name
+                    'activity_start_date',         // Field Name
+                    'TEXT'               // Options - NO_PROMPT, TEXT, PICK, HIDE_YEAR
+                );
+                $t['activity_end_date'] = calendar_date_select(
+                    strtotime(date('m/d/Y').' +2 year'),               // Default value
+                    $act_end_date,               // Selected Date
+                    strtotime('6/1/2011'),           // Start Date
+                    strtotime(date('m/d/Y').' +2 year'),               // End Date
+                    'report_selection',   // Form Name
+                    'activity_end_date',         // Field Name
+                    'TEXT'               // Options - NO_PROMPT, TEXT, PICK, HIDE_YEAR
+                );
+                $t['reg_start_date'] = calendar_date_select(
+                    '6/1/2011',               // Default value
+                    $reg_start_date,               // Selected Date
+                    strtotime('6/1/2011'),           // Start Date
+                    time(),               // End Date
+                    'report_selection',   // Form Name
+                    'registration_start_date',         // Field Name
+                    'TEXT'               // Options - NO_PROMPT, TEXT, PICK, HIDE_YEAR
+                );
+                $t['reg_end_date'] = calendar_date_select(
+                    date('m/d/Y'),               // Default value
+                    $reg_end_date,               // Selected Date
+                    strtotime('6/1/2011'),           // Start Date
+                    time(),               // End Date
+                    'report_selection',   // Form Name
+                    'registration_end_date',         // Field Name
+                    'TEXT'               // Options - NO_PROMPT, TEXT, PICK, HIDE_YEAR
+                );
+                $t['desired_start_date'] = calendar_date_select(
+                               '6/1/2011',               // Default value
+                               $desired_start_date,               // Selected Date
+                               strtotime('6/1/2011'),           // Start Date
+                               time(),               // End Date
+                               'report_selection',   // Form Name
+                               'desired_start_date',         // Field Name
+                               'TEXT'               // Options - NO_PROMPT, TEXT, PICK, HIDE_YEAR
+                );
+                $t['desired_end_date'] = calendar_date_select(
+                               strtotime(date('m/d/Y').' +2 year'),               // Default value
+                               $desired_end_date,               // Selected Date
+                               strtotime('6/1/2011'),           // Start Date
+                               strtotime(date('m/d/Y').' +2 year'),               // End Date
+                               'report_selection',   // Form Name
+                               'desired_end_date',         // Field Name
+                               'TEXT'               // Options - NO_PROMPT, TEXT, PICK, HIDE_YEAR
+                );
+
+                $v['body'] .= parse_view_localcheck($config->event_registration->custom_view_files, 'report_request.html', $tags, 'FALSE' );
+                break;
+
+            case "Display Report":
+
+                $v['date_time'] = date('l m/d/Y g:i:s');
+                $v['med_info_on'] = ($config->event_registration->medical_info ? 'YES' : 'NO');
+
+                $reporting = array();
+                $out = '';
+
+                // Check for Dynamic Form Data display
+                $display_dyn_data = false;
+                if ($_REQUEST['dyn_data'] == 'on') {
+                    $display_dyn_data = true;
+                }
+                $display_ids = false;
+                if ($_REQUEST['show_id'] == 'on') {
+                    $display_ids = true;
+                }
+
+                // Separate possible "cat_" or "subcat_" from front of event id
+                $e = explode('_',$_REQUEST['event']);
+
+                // If a category was specified
+                if ($e[0] == 'cat') {
+                    $cat_id = ($e[1] - 0);
+                    if ($cat_id > 0) {
+                        $event_query = " AND T.id = $cat_id";
+                    }
+                    $display_dyn_data = false;    // only available with single events
+
+                // Otherwise if a sub-category was specified
+                } elseif ($e[0] == 'subcat') {
+                    $subcat_id = ($e[1] - 0);
+                    if ($subcat_id > 0) {
+                        $event_query = " AND C.id = $subcat_id";
+                    }
+                    $display_dyn_data = false;    // only available with single events
+
+                // Otherwise, it's just an event id
+                } else {
+                    $event_id = ($e[0] - 0);
+                    if ($event_id > 0) {
+                        $event_query = " AND D.registration = $event_id";
+                    }
+                }
+
+                // Get all form fields for selected event/activity
+                if ($display_dyn_data) {
+                    $dyn_form_field_titles = magic_form_get_fields($event_id);
+
+                    // If we got fields, build text field names for possible use in output
+                    if (count($dyn_form_field_titles) > 0) {
+                        while (list($key, $val) = each($dyn_form_field_titles)) {
+                            // If we're using ids rather than titles
+                            if ($display_ids) {
+                                $n = 'mf_'.$val['id'];
+                                if ($val['custom_id'] != null) {
+                                    $n = $val['custom_id'];
+                                }
+                                $dyn_form_field_titles[$key]['title'] = stripslashes($n);
+                            }
+                            // provide an empty value for output
+                            $dyn_form_field_titles[$key]['value'] = '';
+                        }
+                    }
+                }
+
+                // Selection of registration entries to report on
+                switch( $_REQUEST['status'] ) {
+
+                    // Undefined
+                    case SI_REG_STATUS_UNDEFINED:
+                        break;
+
+                       // All Submitted
+                    case 101:
+                        $status_query .= " AND (R.status != ".SI_REG_STATUS_FAILED." AND R.status != ".SI_REG_STATUS_CANCELED.")";
+                        $reporting[] = '<FONT COLOR="blue">All Submitted</FONT>';
+                        break;
+
+                    // All Paid
+                    case 102:
+                        $status_query .= " AND (R.status = ".SI_REG_STATUS_CC_PAID." OR R.status = ".SI_REG_STATUS_CHECK_PAID." OR R.status = ".SI_REG_STATUS_CALL_FROM_MERCHANT_PAID." OR R.status = ".SI_REG_STATUS_COMP.")";
+                        $reporting[] = '<FONT COLOR="blue">All Paid</FONT>';
+                        break;
+
+                    // All Unpaid
+                    case 103:
+                        $status_query .= " AND (R.status = ".SI_REG_STATUS_CC_PEND." OR R.status = ".SI_REG_STATUS_CHECK_PEND." OR R.status = ".SI_REG_STATUS_CALL_FROM_MERCHANT_PEND." OR R.status = ".SI_REG_STATUS_AT_EVENT.")";
+                        $reporting[] = '<FONT COLOR="blue">All Paid</FONT>';
+                        break;
+
+                    // CC Paid
+                    case SI_REG_STATUS_CC_PAID:
+                        $status_query .= " AND R.status = ".SI_REG_STATUS_CC_PAID;
+                        $reporting[] = '<FONT COLOR="blue">Credit Card Paid</FONT>';
+                        break;
+
+                    // Check Pending
+                    case SI_REG_STATUS_CHECK_PEND:
+                        $status_query .= " AND R.status = ".SI_REG_STATUS_CHECK_PEND;
+                        $reporting[] = '<FONT COLOR="blue">Check Pending</FONT>';
+                        break;
+
+                    // Check Paid
+                    case SI_REG_STATUS_CHECK_PAID:
+                        $status_query .= " AND R.status = ".SI_REG_STATUS_CHECK_PAID;
+                        $reporting[] = '<FONT COLOR="blue">Paid by Check</FONT>';
+                        break;
+
+                    // Call from Merchant Pending
+                    case SI_REG_STATUS_CALL_FROM_MERCHANT_PEND:
+                        $status_query .= " AND R.status = ".SI_REG_STATUS_CALL_FROM_MERCHANT_PEND;
+                        $reporting[] = '<FONT COLOR="blue">Call from Merchant Pending</FONT>';
+                        break;
+
+                    // Call from Merchant Paid
+                    case SI_REG_STATUS_CALL_FROM_MERCHANT_PAID:
+                        $status_query .= " AND R.status = ".SI_REG_STATUS_CALL_FROM_MERCHANT_PAID;
+                        $reporting[] = '<FONT COLOR="blue">Paid via Call from Merchant</FONT>';
+                        break;
+
+                    // Complementary
+                    case SI_REG_STATUS_COMP:
+                        $status_query = " AND R.status = ".SI_REG_STATUS_COMP;
+                        $reporting[] = '<FONT COLOR="blue">Complimentary</FONT>';
+                        break;
+
+                    // Pay at Event
+                    case SI_REG_STATUS_AT_EVENT:
+                        $status_query = " AND R.status = ".SI_REG_STATUS_AT_EVENT;
+                        $reporting[] = '<FONT COLOR="blue">Pay at Event</FONT>';
+                        break;
+
+                    // Canceled
+                    case SI_REG_STATUS_CANCELED:
+                        $status_query = " AND R.status = ".SI_REG_STATUS_CANCELED;
+                        $reporting[] = '<FONT COLOR="blue">Canceled</FONT>';
+                        break;
+
+                    default:
+                        echo "ERROR: Bad status field value from form submission.";
+                        exit;
+                        break;
+                }
+
+                               $date_query = '';
+
+                               // Selection by Activity date
+                               if ($by_activity_date) {
+                       $date_query .= "
+                           AND D.reg_end >= '".date('m/d/Y', $act_start_date)."'
+                           AND D.reg_start <= '".date('m/d/Y', $act_end_date)."'
+                       ";
+                               }
+
+                               // Selection by Registration date
+                               if ($by_registration_date) {
+                       $date_query .= "
+                               AND R.date_entered BETWEEN '".date('m/d/Y', $reg_start_date)."' AND '".date('m/d/Y', $reg_end_date)."'
+                       ";
+                               }
+
+                               // Selection by Desired date
+                               if ($by_desired_date) {
+                                       $date_query .= "
+                               AND D.desired_date BETWEEN '".date('m/d/Y', $desired_start_date)."' AND '".date('m/d/Y', $desired_end_date)."'
+                       ";
+                               }
+
+                               // Check for member related filters
+                $member_query = '';
+                if ($_REQUEST['is_member'] == 'yes') {
+                    $member_query .= " AND R.is_member = 't'";
+                } elseif ($_REQUEST['is_member'] == 'no') {
+                    $member_query .= " AND R.is_member = 'f'";
+                }
+                if ($_REQUEST['member_id'] != '') {
+                    $member_query .= " AND R.member_id LIKE '%".$_REQUEST['member_id']."%'";
+                }
+
+                // Check for submitted by admin filters
+                $admin_query = '';
+                if ($_REQUEST['admin_user'] == 'yes') {
+                    $admin_query .= " AND R.user_trace_info = 'Entered By Admin User'";
+                } elseif ($_REQUEST['admin_user'] == 'no') {
+                    $member_query .= " AND R.user_trace_info != 'Entered By Admin User'";
+                }
+
+                // Build needed registration data fields
+                $reg_data_fields = "R.id, R.user_trace_info, R.fname, R.lname, R.org, R.title, R.addr1, R.addr2,
+                    R.city, R.state, R.zip, R.country, R.phone, R.fax, R.email, R.email_ok, R.date_entered,
+                    R.pay_type, R.pay_code, R.status, R.cc_conf, R.total, R.cc_name, R.cc_type, R.cc_numb, R.cc_exp,
+                    R.is_member, R.member_id, R.contact_fname, R.contact_lname, R.contact_org, R.contact_title, R.contact_addr1,
+                       R.contact_addr2, R.contact_city, R.contact_state, R.contact_zip, R.contact_country, R.contact_phone, R.contact_fax
+                ";
+                $reg_detail_fields = "D.numb_attending, D.attendees, D.charges, D.registration, D.reg_start, D.reg_end,
+                    D.dob, D.guardian, D.emer_contact, D.emer_phone, D.med_history, D.allergy_med, D.rate_class, D.desired_date
+                ";
+                if ($display_dyn_data) {
+                    $reg_detail_fields .= ', D.mf_data';
+                }
+
+                // Get the data for this report - How depends on whether we have categories (todo) or sub_cateogories (category)
+                if ($config->event_registration->sub_categories) {
+                    $query = "
+                        SELECT R.id AS req_id, $reg_data_fields, D.id AS detail_id, $reg_detail_fields, A.name AS act_name, A.need_attendees,
+                               C.name AS cat_name, T.name AS todo_name, T.med_info
+                          FROM reg_req R, reg_detail D, reg A, todo T, category C
+                         WHERE R.id = D.reg_req
+                           AND A.id = D.registration
+                           AND T.id = C.todo
+                           AND C.id = A.category
+                               $event_query
+                               $member_query
+                               $admin_query
+                               $status_query
+                               $date_query;
+                    ";
+                } elseif ($config->event_registration->main_categories) {
+                    $query = "
+                        SELECT R.id AS req_id, $reg_data_fields, D.id AS detail_id, $reg_detail_fields, A.name AS act_name, A.need_attendees,
+                               T.name AS todo_name, T.med_info
+                          FROM reg_req R, reg_detail D, reg A, todo T
+                         WHERE R.id = D.reg_req
+                           AND A.id = D.registration
+                           AND T.id = A.category
+                               $event_query
+                               $member_query
+                               $admin_query
+                               $status_query
+                               $date_query;
+                    ";
+                } else {
+                    $query = "
+                        SELECT R.id AS req_id, $reg_data_fields, D.id AS detail_id, $reg_detail_fields, A.name AS act_name, A.need_attendees
+                          FROM reg_req R, reg_detail D, reg A
+                         WHERE R.id = D.reg_req
+                           AND A.id = D.registration
+                               $event_query
+                               $member_query
+                               $admin_query
+                               $status_query
+                               $date_query;
+                    ";
+                }
+
+                $reg_data = reg_db_auto_get_data($query, SI_CONN_STR, FALSE, 500000);
+                // echo "Memory - Raw Data Retrieved: ".memory_get_usage()."<br>";
+
+                // Check if we got something
+                if (!is_array($reg_data) || count($reg_data) == 0) {
+                    $v['body'] = '<h2>Sorry, no results found</h2>';
+                    break;
+                }
+
+                // If we're doing field data, also provide complete list
+                $v['have_mf_fields'] = 'NO';
+                if ($display_dyn_data) {
+
+                    // Strip &nbsp; from the field titles
+                    foreach ($dyn_form_field_titles as $dff) {
+                        $dyn_form_field_titles[$dff['id']]['title'] = str_replace("&nbsp;", "", $dff['title']);
+                    }
+
+                    $tags['mf_fields'] = $dyn_form_field_titles;
+                    $v['have_mf_fields'] = 'YES';
+
+                    // Check if we're going to be doing Med Info
+                    reset($reg_data);
+                    $x = current($reg_data);
+                    if (count($reg_data) > 0 && $x['med_info'] != 't') {
+                        $v['med_info_on'] = 'NO';
+                    }
+
+                }
+
+                // Produce output based on type of report requested
+                switch($_REQUEST['output_by']) {
+
+                    // Report by registration entry (billing record)
+                    case 'registration':
+
+                        // Assemble results by registration
+                        $data = array();
+                        $total_charges = 0;
+                        $total_registrations = 0;
+                        $total_attendees = 0;
+
+                        // For each registration
+                        while (list($key, $r) = each($reg_data)) {
+
+                            // Has this registration been added yet
+                            if (!isset($data[$r['req_id']])) {
+                                $data[$r['req_id']] = array(
+                                    'id' => $r['req_id'],
+                                    'admin_user' => ($r['user_trace_info'] == 'Entered By Admin User' ? 'YES' : 'NO' ),
+                                    'fname' => $r['fname'],
+                                    'lname' => $r['lname'],
+                                    'addr1' => $r['addr1'],
+                                    'addr2' => $r['addr2'],
+                                    'city' => $r['city'],
+                                    'state' => $r['state'],
+                                    'state_name' => $si_states_array[$r['state']],
+                                       'zip' => $r['zip'],
+                                    'country' => $r['country'],
+                                    'country_name' => $si_countries_array[$r['country']],
+                                    'phone' => $r['phone'],
+                                    'fax' => $r['fax'],
+                                    'email' => $r['email'],
+                                    'email_ok' => ($r['email_ok']=='t'?'Yes':'No'),
+                                    'contact_fname' => $r['contact_fname'],
+                                    'contact_lname' => $r['contact_lname'],
+                                    'contact_addr1' => $r['contact_addr1'],
+                                    'contact_addr2' => $r['contact_addr2'],
+                                    'contact_city' => $r['contact_city'],
+                                    'contact_state' => $r['contact_state'],
+                                    'contact_state_name' => $si_states_array[$r['contact_state']],
+                                    'contact_zip' => $r['contact_zip'],
+                                    'contact_country' => $r['contact_country'],
+                                    'contact_country_name' => $si_countries_array[$r['contact_country']],
+                                    'contact_phone' => $r['contact_phone'],
+                                    'contact_fax' => $r['contact_fax'],
+                                    'date' => $r['date_entered'],
+                                    'pay_type' => $r['pay_type'],
+                                    'pay_type_name' => $si_pay_codes[$r['pay_type']],
+                                    'pay_code' => ($r['pay_code'] == '0' ? '' : $r['pay_code']),
+                                    'status' => $r['status'],
+                                    'status_text' => $si_reg_status_types[$r['status']],
+                                    'cc_conf' => $r['cc_conf'],
+                                    'total' => $r['total'],
+                                    'total_money' => money($r['total']),
+//                                    'summary' => $r['summary'],
+                                    'cc_name' => $r['cc_name'],
+                                    'cc_type' => $r['cc_type'],
+                                    'cc_numb' => $r['cc_numb'],
+                                    'cc_exp' => $r['cc_exp'],
+//                                    'cc_cvv' => $r['cc_cvv'],
+                                    'numb_attending' => $r['numb_attending'],
+                                    'detail' => array()
+                                );
+
+                                // Add to totals
+                                $total_charges += $r['total'];
+                                $total_registrations++;
+
+                            }
+
+                            // If there's attendees, create array of names
+                            $attendees = array();
+                            if ($r['numb_attending'] > 0) {
+
+                                // Try to unserialize new style attendee data
+                                $att_array = unserialize($r['attendees']);
+
+                                // If that didn't work, try to stripslashes()
+                                if (!is_array($att_array)) {
+                                       $r['attendees'] = stripslashes($r['attendees']);
+                                       $att_array = unserialize($r['attendees']);
+                                }
+
+                                // If that wasn't successfull, then it must be an old style name list
+                                if (!$att_array) {
+
+                                    // Break name list into an array
+                                    $att = explode(',', $r['attendees']);
+
+                                    // For each name, create a new attendee data set
+                                    foreach ($att as $a) {
+                                        $att_array[] = array(
+                                            'name' => trim($a),
+                                            'dob' => $r['dob'],
+                                            'guardian' => $r['guardian'],
+                                            'emer_contact' => $r['emer_contact'],
+                                            'emer_phone' => $r['emer_phone'],
+                                            'med_history' => $r['med_history'],
+                                            'allergy_med' => $r['allergy_med']
+                                        );
+                                    }
+                                }
+
+                                // Dispense with serialized data that is consuming memory - Don't use unset() in that it may not free memory right away
+                                $r['attendees'] = null;
+
+                                $attendees = $att_array;
+                                $total_attendees += $r['numb_attending'];
+                            } else {
+                                // Otherwise there's only one attendee
+                                $total_attendees++;
+                            }
+
+                            // Add detail for this activity and provide any indents
+                            $mf = false;
+                            if ($display_dyn_data) {
+
+                                // Fix stated string lengths in serialized array in case there's errors.
+                                $r['mf_data'] = preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $r['mf_data'] );
+
+                                $mf = unserialize($r['mf_data']);
+
+                                // If it's a new, highly encoded version, decode it and then unserialize it
+                                if (!is_array($mf)) {
+                                    $md = html_entity_decode($r['mf_data']);
+                                    $mf = unserialize($md);
+                                }
+
+                                // Dispense with serialized data that is consuming memory
+                                $r['mf_data'] = null;
+
+                                // fix certain things for each field
+                                while (list($key2, $val) = each($mf)) {
+
+                                    // Indent specified level
+                                    $mf[$key2]['indent'] = '';
+                                    for ($i=0 ; $i<$val['level'] ; $i++) {
+                                        $mf[$key2]['indent'] .= '&nbsp;&nbsp;';
+                                    }
+
+                                    // Also strip slashes
+                                    $mf[$key2]['title'] = stripslashes($val['title']);
+                                    $mf[$key2]['value'] = stripslashes(($val['txt_val']!=''?$val['txt_val']:$val['value']));
+
+                                    // Check if we're using ids rather than titles
+                                    if ($display_ids) {
+                                        $n = $val['id'];
+                                        if ($dyn_form_field_titles[$key2]['custom_id'] != null) {
+                                            $n = $dyn_form_field_titles[$key2]['custom_id'];
+//                                            $n = $val['custom_id'];
+                                        }
+                                        $mf[$key2]['title'] = stripslashes($n);
+                                    }
+
+
+                                    // Also dump unneeded fields
+                                    unset($mf[$key2]['level']);
+                                    unset($mf[$key2]['type']);
+                                    unset($mf[$key2]['txt_typ']);
+                                    unset($mf[$key2]['txt_val']);
+                                    unset($mf[$key2]['opt_num']);
+                                    unset($mf[$key2]['valid']);
+                                    unset($mf[$key2]['required']);
+                                    unset($mf[$key2]['numb_val']);
+                                    unset($mf[$key2]['failure']);
+                                }
+                            }
+
+                            $data[$r['req_id']]['detail'][$r['detail_id']] = array(
+                                'id' => $r['detail_id'],
+                                'activity' => $r['act_name'],
+                               'desired_date' => $r['desired_date'],
+                               'have_desired_date' => ($r['desired_date'] != '' ? 'YES' : 'NO'),
+                                'numb_attending' => $r['numb_attending'],
+                                'have_attendees' => ($r['need_attendees'] == 't' ? 'YES' : 'NO'),
+                                'attendees' => $attendees,
+                                'have_mf_data' => (count($mf)>0?'YES':'NO'),
+                                'mf_data' => $mf,
+                                'have_med_info' => ($r['med_info'] == 't' ? 'YES' : 'NO')
+                            );
+                            $reg_data[$key] = null;
+
+                        } // Each registration
+
+                        // Drop source data to free memory
+                        $reg_data = null;
+                        unset($reg_data);
+
+                        $t['total_charges'] = money($total_charges);
+                        $t['total_registrations'] = $total_registrations;
+                        $t['total_attendees'] = $total_attendees;
+
+                        // Sort by registrant then activity
+                        function reg_cmp($a, $b)
+                        {
+
+                            // Check for sort order
+                            switch ($_REQUEST['sort_by']) {
+
+                                case "id":
+                                    if ($a['id'] == $b['id']) {
+                                            return 0;
+                                    }
+                                    return ($a['id'] < $b['id']) ? -1 : 1;
+                                    break;
+
+                                case "name":
+                                    if ($a['lname'] == $b['lname']) {
+                                        if ($a['fname'] == $b['fname']) {
+                                            return 0;
+                                        }
+                                        return ($a['fname'] < $b['fname']) ? -1 : 1;
+                                    }
+                                    return ($a['lname'] < $b['lname']) ? -1 : 1;
+                                    break;
+
+                                case "state_city":
+                                    if ($a['state'] == $b['state']) {
+                                        if ($a['city'] == $b['city']) {
+                                            return 0;
+                                        }
+                                        return ($a['city'] < $b['city']) ? -1 : 1;
+                                    }
+                                    return ($a['state'] < $b['state']) ? -1 : 1;
+                                    $order_by = "R.state, R.city";
+                                    break;
+                            }
+
+                        }
+                        usort($data, "reg_cmp");
+
+                        // Output type
+                        $v['report_body'] = '';
+                        $view_tags['data'] = array();
+                        switch($_REQUEST['output_type']) {
+
+                            case 'web':
+
+                                // Process each registration for output and add to report body.
+                                foreach ($data as $d) {
+                                    $view_tags['data'][0] = $d;
+                                    $data[$d['id']] = null;        // Dispense with source data for this registration
+                                    $v['report_body'] .= parse_view_localcheck($config->event_registration->custom_view_files, "report_by_registration_Body.html", $view_tags, 'FALSE' );
+                                }
+
+                                $viewfile = 'report_by_registration.html';
+                                break;
+
+                            case 'csv':
+
+                                // Process each registration for output and add to report body.
+                                foreach ($data as $d) {
+
+                                    // For each detail record
+                                    while (list($dkey, $dval) = each($d['detail'])) {
+
+                                        // If we have form data
+                                        if ($dval['mf_data'] != false) {
+
+                                            // Copy the list of all form fields
+                                            $new_mf_data = $dyn_form_field_titles;
+
+                                            // For each form field we have from the detail
+                                            while (list($mkey, $mval) = each($dval['mf_data'])) {
+                                                // Add the data to the fields list and need to strip new lines from values
+                                                $new_mf_data[$mkey]['value'] = trim(preg_replace( '/[\r\n]/', ' ', $mval['value']));
+                                            }
+
+                                            // Now replace the form_data with the new complete list
+                                            $d['detail'][$dkey]['mf_data'] = $new_mf_data;
+                                        }
+                                    }
+
+                                    $view_tags['data'][0] = $d;
+
+                                    $data[$d['id']] = null;        // Dispense with source data for this registration
+                                    $v['report_body'] .= preg_replace( "/(\\{\S*?\\})/", "", parse_view_localcheck($config->event_registration->custom_view_files, "report_by_registration_csv_Body.html", $view_tags, 'FALSE' ));
+                                }
+
+                                $viewfile = 'report_by_registration_csv.html';
+                                break;
+
+                        }
+
+                        // echo "Memory - Raw Data: ".memory_get_peak_usage()."<br>";
+                        break;
+
+                    case 'activity':      // By Event (activity)
+
+                        // Assemble results by activity
+                        $data = array();
+                        $total_activities = 0;
+                        $total_attendees = 0;
+
+                        // For each registration
+                        while (list($key, $r) = each($reg_data)) {
+
+                            // If there's attendees, create array of names
+                            $attendees = array();
+                            if ($r['numb_attending'] > 0) {
+
+                                // Try to unserialize new style attendee data
+                                $att_array = unserialize($r['attendees']);
+
+                                // If that wasn't successfull, then it must be an old style name list
+                                if (!$att_array) {
+
+                                    // Break name list into an array
+                                    $att = explode(',', $r['attendees']);
+
+                                    // For each name, create a new attendee data set
+                                    foreach ($att as $a) {
+                                        $att_array[] = array(
+                                                'name' => trim($a),
+                                                'dob' => $r['dob'],
+                                                'guardian' => $r['guardian'],
+                                                'emer_contact' => $r['emer_contact'],
+                                                'emer_phone' => $r['emer_phone'],
+                                                'med_history' => $r['med_history'],
+                                                'allergy_med' => $r['allergy_med']
+                                        );
+                                    }
+                                }
+
+                                // Dispense with serialized data that is consuming memory
+                                $r['attendees'] = null;
+
+                                $attendees = $att_array;
+                                $total_attendees += $r['numb_attending'];
+                            } else {
+                                // Otherwise there's only one attendee
+                                $total_attendees++;
+                            }
+
+                            // Check if this activity has been added
+                            if (!isset($data[$r['registration']])) {
+                                $data[$r['registration']] = array(
+                                    'id' => $r['registration'],
+                                       'activity' => $r['act_name'],
+                                    'start_date' => $r['reg_start'],
+                                    'end_date' => $r['reg_end'],
+                                    'numb_attending' => 0,
+                                    'attendees' => array()
+                                );
+                                $total_activities++;
+                            }
+
+                            // Build array of data to include with each attendee
+                            $x = array(
+                                'id' => $r['req_id'],
+                                'fname' => $r['fname'],
+                                'lname' => $r['lname'],
+                                'addr1' => $r['addr1'],
+                                'addr2' => $r['addr2'],
+                                'city' => $r['city'],
+                                'state' => $r['state'],
+                                'state_name' => $si_states_array[$r['state']],
+                                'zip' => $r['zip'],
+                                'country' => $r['country'],
+                                       'country_name' => $si_country_array[$r['state']],
+                                'phone' => $r['phone'],
+                                'fax' => $r['fax'],
+                                'email' => $r['email'],
+                                'email_ok' => $r['email_ok'],
+                                'contact_fname' => $r['contact_fname'],
+                                'contact_lname' => $r['contact_lname'],
+                                'contact_addr1' => $r['contact_addr1'],
+                                'contact_addr2' => $r['contact_addr2'],
+                                'contact_city' => $r['contact_city'],
+                                'contact_state' => $r['contact_state'],
+                                'contact_state_name' => $si_states_array[$r['contact_state']],
+                                'contact_zip' => $r['contact_zip'],
+                                'contact_country' => $r['contact_country'],
+                                'contact_country_name' => $si_country_array[$r['contact_country']],
+                                'contact_phone' => $r['contact_phone'],
+                                'contact_fax' => $r['contact_fax'],
+                               'date' => $r['date_entered'],
+                                       'desired_date' => $r['desired_date'],
+                                       'have_desired_date' => ($r['desired_date'] != '' ? 'YES' : 'NO'),
+                                       'pay_type' => $r['pay_type'],
+                                'pay_code' => $r['pay_code'],
+                                'status' => $r['status'],
+                                'status_text' => $si_reg_status_types[$r['status']],
+                                'cc_conf' => $r['cc_conf'],
+                                'total' => $r['total'],
+                                'total_money' => money($r['total']),
+                                'summary' => $r['summary'],
+                                'cc_name' => $r['cc_name'],
+                                'cc_type' => $r['cc_type'],
+                                'cc_numb' => $r['cc_numb'],
+                                'cc_exp' => $r['cc_exp'],
+                                'cc_cvv' => $r['cc_cvv'],
+                                'mf_data' => false,
+                                'have_mf_data' => 'NO'
+                            );
+
+                            // Add detail for this activity and provide any indents
+                            if ($display_dyn_data) {
+
+                                // Get mf_data and clear unneeded source data to free memory
+                                $r['mf_data'] = preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $r['mf_data'] );
+                                $mf_data_tmp = unserialize($r['mf_data']);
+
+                                // If it's a new, highly encoded version, decode it and then unserialize it
+                                if (!is_array($mf_data_tmp)) {
+                                    $md = html_entity_decode($r['mf_data']);
+                                    $mf_data_tmp = unserialize($md);
+                                }
+
+                                // If there's form data, add it to the attendee
+                                if (is_array($mf_data_tmp)) {
+
+                                    // Add the mf data
+                                    $x['have_mf_data'] = 'YES';
+                                    while (list($key2, $val) = each($mf_data_tmp)) {
+                                        $x['mf_data'][$key2]['id'] = $val['id'];
+                                        $x['mf_data'][$key2]['title'] = stripslashes($val['title']);
+                                        $x['mf_data'][$key2]['value'] = stripslashes(($val['txt_val']!=''?$val['txt_val']:$val['value']));
+                                        $x['mf_data'][$key2]['indent'] = '';
+                                        for ($i=0 ; $i<$val['level'] ; $i++) {
+                                            $x['mf_data'][$key2]['indent'] .= '&nbsp;&nbsp;';
+                                        }
+                                    }
+                                } // have mf_data array
+
+                            }
+//var_dump($x);exit;
+                            // Dump form data for this registration to free space
+                            $reg_data[$key]['mf_data'] = null;
+
+                            // Add attendee data
+                            if (count($attendees) > 0) {
+
+                                foreach($attendees as $a) {
+                                    $data[$r['registration']]['attendees'][] = array(
+                                        'attendee' => ($r['need_attendees'] == 't' ? $a['name'] : $r['fname'].' '.$r['lname'])
+                                    ) + $x + array(
+                                        'have_med_info' => ($a['dob'] != '' ? 'YES' : 'NO'),
+                                        'dob' => $a['dob'],
+                                        'guardian' => $a['guardian'],
+                                        'emer_contact' => $a['emer_contact'],
+                                        'emer_phone' => $a['emer_phone'],
+                                        'med_history' => $a['med_history'],
+                                        'allergy_med' => $a['allergy_med']
+                                    );
+                                    $data[$r['registration']]['numb_attending']++;
+                                }
+
+                            // Otherwise there's no attendee list, so use registrant
+                            } else {
+
+                                $data[$r['registration']]['attendees'][] = array(
+                                    'attendee' => $r['fname'].' '.$r['lname']
+                                ) + $x;
+                                $data[$r['registration']]['numb_attending']++;
+                            }
+
+                            // Dump this registation source data to free space
+                            $reg_data[$key] = null;
+                            unset($reg_data[$key]);
+
+                        } // Each registration
+
+                        // Drop source data to free memory
+                        $reg_data = null;
+                        unset($reg_data);
+
+                        // Attendee Sort Function
+                        function att_cmp($a, $b)
+                        {
+                            if ($a['attendee'] == $b['attendee']) {
+                                return 0;
+                            }
+                            return ($a['attendee'] < $b['attendee']) ? -1 : 1;
+                        }
+
+                        // Activity Sort Function
+                        function act_cmp($a, $b)
+                        {
+                            if ($a['activity'] == $b['activity']) {
+                                return 0;
+                            }
+                            return ($a['activity'] < $b['activity']) ? -1 : 1;
+                        }
+
+                        // Sort by Activity then Attendee
+                        while (list($key, $val) = each($data)) {
+                            $attendees = $val['attendees'];
+                            usort($attendees, "att_cmp");
+                            $data[$key]['attendees'] = $attendees;
+                        }
+                        usort($data, "act_cmp");
+
+                        $t['total_activities'] = $total_activities;
+                        $t['total_attendees'] = $total_attendees;
+                        $t['using_medical_info'] = ($using_medical_info ? 'YES' : 'NO');
+
+                        // Output type
+                        switch($_REQUEST['output_type']) {
+
+                            case 'web':
+
+                                // Process each registration for output and add to report body.
+                                $v['report_body'] = '';
+                                $view_tags['data'] = array();
+
+                                // For each event/activity
+                                foreach ($data as $d) {
+
+                                    // build activity header output for current activity
+                                    $view_tags['data'][0] = array(
+                                        'activity' => $d['activity'],
+                                        'start_date' => $d['start_date'],
+                                        'end_date' => $d['end_date'],
+                                        'numb_attending' => $d['numb_attending']
+                                    );
+                                    $v['report_body'] .= parse_view_localcheck($config->event_registration->custom_view_files, "report_by_activity_Body_Head.html", $view_tags, 'FALSE' );
+                                    $view_tags['data'] = false;
+
+                                    // Build attendee output for each attendee in this activity
+                                    foreach ($d['attendees'] as $a) {
+                                        $view_tags['attendees'][0] = $a;
+                                        $v['report_body'] .= parse_view_localcheck($config->event_registration->custom_view_files, "report_by_activity_Body_Attendee.html", $view_tags, 'FALSE' );
+                                    }
+
+                                    // Add in activity footer now (no parsing required)
+                                    if( !($f = file_get( GLM_APP_BASE.'Common/Registrations_V3/admin/Views/report_by_activity_Body_Foot.html' ) ) ) {
+                                        echo "ERROR: Unable to find ".GLM_APP_BASE.'Common/Registrations_V3/admin/Views/report_by_activity_Body_Foot.html';
+                                        exit;
+                                    }
+                                    $v['report_body'] .= $f;
+                                    $data[$d['id']] = null;        // Dispense with source data for this registration
+
+                                } // for each event
+
+                                // Dispense with all supplied data in preparation for the final view parse
+                                unset($view_tags['data']);
+                                unset($view_tags['attendees']);
+                                $data = null;
+                                unset($data);
+
+                                $viewfile = 'report_by_activity.html';
+                                break;
+
+                            case 'csv':
+
+                                // Process each registration for output and add to report body.
+                                $v['report_body'] = '';
+                                $view_tags['data'] = array();
+
+                                // For each event/activity
+                                foreach ($data as $d) {
+
+                                    // build activity header output for current activity
+                                    $view_tags['data'][0] = array(
+                                        'activity' => $d['activity'],
+                                        'start_date' => $d['start_date'],
+                                        'end_date' => $d['end_date'],
+                                        'numb_attending' => $d['numb_attending']
+                                    );
+                                    $v['report_body'] .= parse_view_localcheck($config->event_registration->custom_view_files, "report_by_activity_csv_Body_Head.html", $view_tags, 'FALSE' );
+                                    $view_tags['data'] = false;
+
+                                    // Build attendee output for each attendee in this activity
+                                    foreach ($d['attendees'] as $a) {
+
+                                        // If we have form data
+                                        if ($a['mf_data'] != false) {
+
+                                            // Copy the list of all form fields
+                                            $new_mf_data = $dyn_form_field_titles;
+
+                                            // For each form field we have from the detail
+                                            while (list($mkey, $mval) = each($a['mf_data'])) {
+                                                // Add the data to the fields list and need to strip new lines from values
+                                                $new_mf_data[$mkey]['value'] = trim(preg_replace( '/[\r\n]/', ' ', $mval['value']));
+                                            }
+
+                                            // Now replace the form_data with the new complete list
+                                            $a['mf_data'] = $new_mf_data;
+                                        }
+
+                                        $view_tags['attendees'][0] = $a;
+                                        $v['report_body'] .= preg_replace( "/(\\{\S*?\\})/", "", parse_view_localcheck($config->event_registration->custom_view_files, "report_by_activity_csv_Body_Attendee.html", $view_tags, 'FALSE' ));
+
+                                    }
+
+                                    $data[$d['id']] = null;        // Dispense with source data for this registration
+
+                                } // for each event
+
+                                // Dispense with all supplied data in preparation for the final view parse
+                                unset($view_tags['data']);
+                                unset($view_tags['attendees']);
+                                $data = null;
+                                unset($data);
+
+                                $viewfile = 'report_by_activity_csv.html';
+                                break;
+
+                        }
+
+                        break;
+
+                    case 'attendee':
+
+                        // Assemble results by activity
+                        $data = array();
+                        $total_attendees = 0;
+
+                        // For each registration
+                        while (list($key, $r) = each($reg_data)) {
+
+                            $have_mf_data = 'NO';
+                            $mf_data_temp = false;
+
+                            // Get mf_data and clear unneeded source data to free memory
+                            if ($display_dyn_data) {
+
+                                // Get mf_data and clear unneeded source data to free memory
+                                $r['mf_data'] = preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $r['mf_data'] );
+                                $mf = unserialize($r['mf_data']);
+
+                                // If it's a new, highly encoded version, decode it and then unserialize it
+                                if (!is_array($mf)) {
+                                    $md = html_entity_decode($r['mf_data']);
+                                    $mf = unserialize($md);
+                                }
+
+                                // If there's form data, add it to the attendee
+                                if (is_array($mf)) {
+
+                                    // Add the mf data
+                                    $have_mf_data = 'YES';
+                                    while (list($key2, $val) = each($mf)) {
+
+                                        $x = array(
+                                            'id' => $key2,
+                                            'mf_id' => $val['id'],
+                                            'title' => stripslashes($val['title']),
+                                            'value' => stripslashes(($val['txt_val']!=''?$val['txt_val']:$val['value'])),
+                                            'indent' => ''
+                                        );
+                                        for ($i=0 ; $i<$val['level'] ; $i++) {
+                                            $x['indent'] .= '&nbsp;&nbsp;';
+                                        }
+
+                                        $mf_data_temp[] = $x;
+                                    }
+                                } // have mf_data array
+
+/*
+                                $r['mf_data'] = preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $r['mf_data'] );
+                                $mf_data_temp = unserialize($r['mf_data']);
+
+                                // If it's a new, highly encoded version, decode it and then unserialize it
+                                if (!is_array($mf_data_temp)) {
+                                    $md = html_entity_decode($r['mf_data']);
+                                    $mf_data_temp = unserialize($md);
+                                }
+*/
+
+                            }
+
+                            $r['mf_data'] = null;
+
+                               // Add detail for this activity
+                            $data['detail'][$r['detail_id']] = array(
+                                'id' => $r['detail_id'],
+                                'activity' => $r['act_name'],
+                                'numb_attending' => $r['numb_attending'],
+                                'have_mf_data' => $have_mf_data,
+                                'mf_data' => $mf_data_temp,
+                                'dob' => $r['dob'],
+                                'guardian' => $r['guardian'],
+                                'emer_contact' => $r['emer_contact'],
+                                'emer_phone' => $r['emer_phone'],
+                                'have_med_info' => ($r['med_info'] == 't' ? 'YES' : 'NO'),
+                                'med_history' => $r['med_history'],
+                                'allergy_med' => $r['allergy_med'],
+                                'fname' => $r['fname'],
+                                'lname' => $r['lname'],
+                                'addr1' => $r['addr1'],
+                                'addr2' => $r['addr2'],
+                                'city' => $r['city'],
+                                'state' => $r['state'],
+                                'zip' => $r['zip'],
+                                'country' => $r['country'],
+                                'phone' => $r['phone'],
+                                'fax' => $r['fax'],
+                                'email' => $r['email'],
+                                'email_ok' => $r['email_ok'],
+                                'contact_fname' => $r['contact_fname'],
+                                'contact_lname' => $r['contact_lname'],
+                                'contact_addr1' => $r['contact_addr1'],
+                                'contact_addr2' => $r['contact_addr2'],
+                                'contact_city' => $r['contact_city'],
+                                'contact_state' => $r['contact_state'],
+                                'contact_state_name' => $si_states_array[$r['contact_state']],
+                                'contact_zip' => $r['contact_zip'],
+                                'contact_country' => $r['contact_country'],
+                                'contact_country_name' => $si_country_array[$r['contact_country']],
+                                'contact_phone' => $r['contact_phone'],
+                                'contact_fax' => $r['contact_fax'],
+                               'desired_date' => $r['desired_date'],
+                                       'have_desired_date' => ($r['desired_date'] != '' ? 'YES' : 'NO'),
+                                'date' => $r['date_entered'],
+                                'pay_type' => $r['pay_type'],
+                                'pay_code' => $r['pay_code'],
+                                'status' => $r['status'],
+                                'status_text' => $si_reg_status_types[$r['status']],
+                                'cc_conf' => $r['cc_conf'],
+                                'total' => $r['total'],
+                                'total_money' => money($r['total']),
+                                'cc_name' => $r['cc_name'],
+                                'cc_type' => $r['cc_type'],
+                                'cc_numb' => $r['cc_numb'],
+                                'cc_exp' => $r['cc_exp']
+                            );
+
+                            // If there's attendees, create array of names
+                            $attendees = array();
+                            if ($r['numb_attending'] > 0) {
+
+                                // Try to unserialize new style attendee data
+                                $att_array = unserialize($r['attendees']);
+
+                                // If that wasn't successfull, then it must be an old style name list
+                                if (!$att_array) {
+
+                                    // Break name list into an array
+                                    $att = explode(',', $r['attendees']);
+
+                                    // For each name, create a new attendee data set
+                                    foreach ($att as $a) {
+                                        $data['attendee'][] = array(
+                                            'detail_id' => $r['detail_id'],
+                                            'attendee' => ($r['need_attendees'] == 't' ? trim($a) : $r['fname'].' '.$r['lname']),
+                                            'dob' => $r['dob'],
+                                            'guardian' => $r['guardian'],
+                                            'emer_contact' => $r['emer_contact'],
+                                            'emer_phone' => $r['emer_phone'],
+                                            'med_history' => $r['med_history'],
+                                            'allergy_med' => $r['allergy_med']
+                                        );
+                                    }
+                                } else {
+                                    foreach ($att_array as $a) {
+                                        $data['attendee'][] = array(
+                                            'detail_id' => $r['detail_id'],
+                                            'attendee' => ($r['need_attendees'] == 't' ? trim($a['name']) : $r['fname'].' '.$r['lname']),
+                                            'dob' => $a['dob'],
+                                            'guardian' => $a['guardian'],
+                                            'emer_contact' => $a['emer_contact'],
+                                            'emer_phone' => $a['emer_phone'],
+                                            'med_history' => $a['med_history'],
+                                            'allergy_med' => $a['allergy_med']
+                                        );
+                                    }
+                                }
+//                                $data[] = $att_array + $x;
+                                $total_attendees += $r['numb_attending'];
+
+                                // Free attendee source data to free memory
+                                $r['attendees'] = null;
+
+                            } else {
+                                // Otherwise there's only one attendee
+                                $total_attendees++;
+                            }
+
+                            // Dump this registation source data to free space
+                            $reg_data[$key] = null;
+                            unset($reg_data[$key]);
+
+                        } // Each registration
+
+                        // Drop source data to free memory
+                        $reg_data = null;
+                        unset($reg_data);
+
+                        // Sort by attendee then activity
+                        function att_act_cmp($a, $b)
+                        {
+                            if ($a['attendee'] == $b['attendee']) {
+                                if ($a['activity'] == $b['activity']) {
+                                    return 0;
+                                }
+                                return ($a['activity'] < $b['activity']) ? -1 : 1;
+                            }
+                            return ($a['attendee'] < $b['attendee']) ? -1 : 1;
+                        }
+                        usort($data['attendee'], "att_act_cmp");
+
+                        $t['total_attendees'] = $total_attendees;
+                        $t['using_medical_info'] = ($using_medical_info ? 'YES' : 'NO');
+
+                        // Output type
+                        $v['report_body'] = '';
+                        $view_tags['data'] = array();
+
+                        switch($_REQUEST['output_type']) {
+
+                            case 'web':
+
+                                // For each attendee listed
+                                while (list($key, $d) = each($data['attendee'])) {
+
+                                    // Place the current data in the view along with the detail for that registration
+                                    $view_tags['data'][0] = $d + $data['detail'][$d['detail_id']];
+
+                                    // Dispense with source data for this attendee - need to keep detail in case there's another attendee
+                                    $data['attendee'][$key] = null;
+
+                                    $v['report_body'] .= parse_view_localcheck($config->event_registration->custom_view_files, "report_by_attendee_Body.html", $view_tags, 'FALSE' );
+                                }
+
+                                $data = null;
+                                unset($data);
+
+                                $viewfile = 'report_by_attendee.html';
+                                break;
+
+                            case 'csv':
+
+                                // For each attendee listed
+                                while (list($dkey, $dval) = each($data['attendee'])) {
+
+                                    // Need to strip new lines for csv file fields
+                                    $detail = $data['detail'][$dval['detail_id']];
+
+                                    // If we have form data
+                                    if ($dval['mf_data'] != false) {
+
+                                        // Copy the list of all form fields
+                                        $new_mf_data = $dyn_form_field_titles;
+
+                                        // For each form field we have from the detail
+                                        while (list($mkey, $mval) = each($dval['mf_data'])) {
+                                            // Add the data to the fields list and need to strip new lines from values
+                                            $new_mf_data[$mkey]['value'] = trim(preg_replace( '/[\r\n]/', ' ', $mval['value']));
+                                        }
+
+                                        // Now replace the form_data with the new complete list
+                                        $dval['mf_data'] = $new_mf_data;
+                                    }
+
+                                    // Place the current data in the view along with the detail for that registration
+                                    $view_tags['data'][0] = $dval + $detail;
+
+                                    // Dispense with source data for this attendee - need to keep detail in case there's another attendee
+                                    $data['attendee'][$dkey] = null;
+
+                                    $v['report_body'] .= preg_replace( "/(\\{\S*?\\})/", "", parse_view_localcheck($config->event_registration->custom_view_files, "report_by_attendee_csv_Body.html", $view_tags, 'FALSE' ));
+                                }
+
+                                $data = null;
+                                unset($data);
+
+                                $viewfile = 'report_by_attendee_csv.html';
+                                break;
+
+                        }
+
+                        //echo "Memory - Final: ".round(memory_get_usage()/1000000)."<br>";
+                        //echo "Memory - Peak: ".round(memory_get_peak_usage()/1000000)."<br>";
+
+                    break;
+
+                } // output by
+
+                $tags['data'] = $data;
+                $data = null;
+
+                $out .= parse_view_localcheck($config->event_registration->custom_view_files, $viewfile, $tags, 'FALSE' );
+
+                if ($_REQUEST['output_type'] == 'csv') {
+
+                    $len = strlen( $out );
+                    header( "Content-type: application/octet-stream" );
+                    header( "Content-Length: $len" );
+                    header( "Content-Disposition: attachment; filename=Registrations.csv" );
+                    echo $out;
+                    exit;
+
+                }
+
+                if( isset($_REQUEST['PrintReport']) && $_REQUEST['PrintReport'] == 'Yes' ) {
+                    echo $out;
+                    exit;
+                }
+
+                $email = filter_var($_REQUEST['email_to'], FILTER_VALIDATE_EMAIL);
+                if ($email != false) {
+
+                    $email_content = "--ContentBoundry\n"
+                        ."Content-Type: text/plain; charset=\"US-ASCII\"\n"
+                        ."\n"
+                        .'Your E-Mail client does not support HTML E-Mail.'
+                        ."\n"
+                        ."--ContentBoundry\n"
+                        ."Content-Type: text/html; charset=\"US-ASCII\"\n"
+                        ."\n"
+                        .$out
+                        ."</BODY></HTML>\n"
+                        ."\n"
+                        ."--ContentBoundry--\n"
+                        ."\n";
+
+                    debug_mail(
+                        $email,
+                        $config->event_registration->organization." Report",
+                        "$email_content.",
+                        "From: ".$server_config->email->owner."\nMime-Version: 1.0\nContent-Type: multipart/alternative; boundary=ContentBoundry\n",
+                        '-f'.$config->event_registration->organization_from_email
+                    );
+
+                    $out = '<h3>This report has been sent to: '.$email.'</h3>'.$out;
+                }
+
+                $v['body'] .= $out;
+
+                break;
+
+        } // switch report steps
+        break;
+
+/* May not be current
+    case 'FixForms':
+
+        // This is to fix internal links in forms that were corrupted by an early form copy process.
+        // There is no link to this, it must be entered manually on the URL to be run.
+
+        $v['body'] .= '</center><pre>Starting Sub-Form Field Fix Process:<br>';
+
+        // Get all form data
+        $fd = reg_db_auto_get_data( "SELECT id, form_id, data1 FROM magicform ORDER BY form_id;", SI_CONN_STR, FALSE, 5000 );
+        $v['body'] .= 'Retrieved all form data: '.count($fd).' entries found<br><div style="border: 3px solid #222; height: 200px; overflow: scroll;">';
+
+        $fids = array();
+
+        // Display what we got
+        foreach ($fd as $f) {
+            $v['body'] .= $f['form_id'].' - '.$f['data1'].'<br>';
+            $x = explode('.', $f['form_id']);
+            $fids[$x[0]] = $x[0];
+        }
+        $v['body'] .= '</div>';
+
+        $v['body'] .= 'Root Form IDs found: ';
+        $sep = '';
+        foreach ($fids as $f) {
+            $v['body'] .= $sep.$f;
+            $sep = ', ';
+        }
+        $v['body'] .= '<br>';
+
+        // Try to fix the data
+        reset($fd);
+        while (list($key, $val) = each($fd)) {
+
+            // Get the root ID for this field
+            $x = explode('.', $val['form_id']);
+            $field_id = $x[0];
+
+            // Look for other root form IDs that don't belong here.
+            reset($fids);
+            foreach ($fids as $wrong_id) {
+                // If it's any other ID than the current root
+                if ($field_id != $wrong_id) {
+                    $count = 0;
+                    $old_data1 = $val['data1'];
+                    $x = str_replace('~'.$wrong_id.'.', '~'.$field_id.'.', $val['data1'], $count);
+                    if ($count > 0) {
+                        $fd[$key]['old_data1'] = $old_data1;
+                        $fd[$key]['data1'] = $x;
+                        $fd[$key]['fixed'] = true;
+                    }
+                }
+            }
+        }
+
+        // Display what we have now
+        $v['body'] .= 'Fixed Fields:<br>';
+        $v['body'] .= '<div style="border: 3px solid #222; height: 200px; overflow: scroll;">';
+        reset($fd);
+
+        $transaction = array(
+            0 => 'set search_path = registrations;'
+        );
+        foreach ($fd as $f) {
+            if ($f['fixed'] == true) {
+
+                $transaction[$f['id']] = "UPDATE magicform SET data1 = '".addslashes($f['data1'])."' WHERE id = ".$f['id'].";";
+
+                $v['body'] .= 'ID: '.$f['id']."<br>";
+                $v['body'] .= '<span style="background: #999;">'.$f['form_id'].' - '.$f['old_data1'].'</span><br>';
+                $v['body'] .= $f['form_id'].' - '.$f['data1'].'<br>';
+                $v['body'] .= $transaction[$f[id]].'<p>';
+            }
+        }
+        $v['body'] .= '</div>';
+
+        // Create database connection
+        $db = Toolkit_Database::getInstance();
+
+        try {
+
+            $db->beginTransaction();
+            foreach ($transaction as $sql) {
+                @$db->exec($sql);
+            }
+            $db->commit();
+
+        } catch (Exception $e) {
+
+            $v['body'] .= 'Transaction execution problem.<br>'.$e->getMessage()."<br>Query:<br><pre>$sql</pre>";
+            $db->rollback();
+
+        }
+
+
+        // Get all form data again
+        $fd = reg_db_auto_get_data( "SELECT id, form_id, data1 FROM magicform ORDER BY form_id;", SI_CONN_STR, FALSE, 5000 );
+        $v['body'] .= 'Updated form data: '.count($fd).' entries found<br><div style="border: 3px solid #222; height: 200px; overflow: scroll;">';
+
+        // Display what we got
+        foreach ($fd as $f) {
+            $v['body'] .= $f['form_id'].' - '.$f['data1'].'<br>';
+        }
+        $v['body'] .= '</div>';
+        $v['body'] .= 'End of Sub-Form Field Fix Process:</pre><center>';
+
+        break;
+*/
+
+    case 'ReconcileAttendees':
+
+        // This is to fix current attendee counts for events that count attendees
+        // There is no link to this, it must be entered manually on the URL to be run.
+        // Call with "&fix=true to correct errors
+
+        // Get all events that count attendees
+        $sql = "SELECT id, name, attendee_max, attendee_count
+                  FROM reg
+                 WHERE need_attendees
+              ORDER BY id
+            ;";
+        $event_data = reg_db_auto_get_data( $sql, SI_CONN_STR, FALSE, 5000 );
+
+        echo "<h2>Attendee Count Reconciliation</h2>
+                <table>
+                    <tr><th>ID</th><th>Name</th><th>Max Attendees</th><th>Expected</th><th>Calculated</th><th>Difference</th></tr>
+        ";
+        // For each event
+        foreach ($event_data as $ed) {
+
+            // Get the sum of all the attendee counts from the registration detail records where those are not canceled
+            $sql = "SELECT sum(D.numb_attending)
+                      FROM reg_detail D, reg_req R
+                     WHERE D.registration = ".$ed['id']."
+                       AND R.id = D.reg_req
+                       AND R.status != ".SI_REG_STATUS_CANCELED."
+            ;";
+            $sum = db_auto_get_row( $sql, 0, CONN_STR, FALSE );
+
+            // If we found any registrations for this event
+            $attendees = ($sum['sum'] - 0);
+
+            $bgcolor = '#fff';
+            $diff = $ed['attendee_count'] - $attendees;
+            if ($diff != 0) {
+
+                $bgcolor = 'pink';
+
+                // Correct attendee count
+                if ($_REQUEST['fix'] == 'true') {
+                    $sql = "UPDATE reg SET attendee_count = $attendees WHERE id = ".$ed['id'].";";
+                    reg_db_auto_exec( $sql, 0, CONN_STR, FALSE );
+                }
+            }
+
+            echo "<tr><td>".$ed['id']."</td><td>".$ed['name']."</td><td>".$ed['attendee_max']."</td><td>".$ed['attendee_count']."</td><td>".$attendees."</td><td bgcolor=\"$bgcolor\">$diff</td></tr>";
+
+        }
+
+        echo "</table>";
+
+        if ($_REQUEST['fix'] == 'true') {
+            echo "<h3>All differernces corrected</h3>";
+        }
+
+        break;
+
+    default:
+        $welcome = parse_view_localcheck($config->event_registration->custom_view_files, "welcome.html", $view_tags, 'FALSE' );
+        $v['body'] .= $menu.$welcome;
+        break;
+
+    }
+
+    // Check for specified default field focus
+
+if( !empty($mf_field_id) )
+    $v['field_focus'] = 'mf_field_'.$mf_field_id;
+  else
+    $v['field_focus'] = 'default';
+
+
+echo parse_view_localcheck($config->event_registration->custom_view_files, $qs_viewfile, $view_tags, 'FALSE' );    // Don't show unused tags to avoid problems with hidden multi-field parameters
+
+?>
diff --git a/admin/java_functions.js b/admin/java_functions.js
new file mode 100644 (file)
index 0000000..83fdac9
--- /dev/null
@@ -0,0 +1,287 @@
+//
+// Java Functions
+//
+
+    // List all Java properties for the specified target - Used for testing
+
+function list_properties( target )
+    {
+    sep = '';
+    var names = '';
+    var c = 0;
+    
+    var names_a = new Array();
+    for( var i in target )
+        {
+        names_a[c++] = i;
+        }
+    names_a.sort();
+    
+    for( var i=0 ; i<c ; i++ )
+        {
+        names += sep + names_a[i];
+        sep = "\n";
+        }
+    alert( names );
+    }
+
+
+    // Pop-up a window with URL = u and target name = n
+
+function do_popup( u, n )
+    {
+    w = window.open( u, n, 'scrollbars=yes,toolbar=no,resizable=yes,width=750,height=550,screenx=10,screeny=10',1 );
+    w.focus();
+    }
+
+    // Set focus to first input field
+
+function defaultFieldFocus( n )
+    {
+    if( document.forms.length == 0 )
+        return;
+
+    for( var f=0 ; f<document.forms.length ; f++ )
+        {
+        e = document.forms[f].elements;
+
+        for( var i=0 ; i<e.length ; i++ )
+            {
+
+                // Check for specified field
+
+            if( n != 'default' )
+                {
+                if( e[i].id == n )
+                    {
+                    e[i].focus();                // Put field in focus
+                    window.scrollBy(0,400);        // Scroll it up a ways
+                    e[i].focus();                // Make sure it's back in focust (presumeably at the top)
+                    window.scrollBy(0,-40);        // Scroll it down a bit to make it more visible
+                    return;
+                    }
+                }
+            else
+                    // select first permitted field
+                switch( e[i].type )
+                    {
+                    case 'button':
+                    case 'checkbox':
+                    case 'radio':
+                    case 'text':
+                    case 'textarea':
+                    case 'password':
+                    case 'file':
+                    case 'select-one':
+                    case 'select-multiple':
+                        e[i].focus();
+                        return;
+                        break;
+                    default:
+                        break;
+                    }
+            }
+        }
+    }
+
+
+var last_t = '';
+
+function show_QuickTip(t,e)
+    {
+
+    if( last_t != '' )
+        hide_QuickTip(last_t);
+    last_t = t;
+    document.getElementById(t).style.visibility = 'visible';
+    }
+
+function hide_QuickTip(t)
+    {
+    document.getElementById(t).style.visibility = 'hidden';
+    }
+
+
+function toggle_visible(t)
+    {
+    if( document.getElementById(t).style.visibility == 'visible' )
+        document.getElementById(t).style.visibility = 'hidden';
+    else
+        document.getElementById(t).style.visibility = 'visible';
+    }
+
+function isInteger( i )
+    {
+    return /^[0-9]+$/i.test(i);
+    }
+
+
+function getElementIndex(obj)
+        {
+        var theform = obj.form;
+        for (var i=0; i<theform.elements.length; i++)
+                {
+                if (obj.name == theform.elements[i].name)
+                        {
+                        return i;
+                        }
+                }
+        return -1;
+        }
+
+
+    // MULTIFIELD: Check for all field lines in use and create additional line if required
+
+function multi_fields( fname, cur_field, width )
+    {
+    var lines = 0;
+    var unused = 0;
+    var saved = new Array();
+
+    ele = getElementIndex(cur_field);
+
+    while( document.getElementById( fname + '_' +  (lines+1) + '_1' ) )
+        {
+        lines++;
+
+            // Check if line is used
+        if( document.getElementById( fname + '_' + lines + '_1' ).value == '' )
+            unused++;
+
+            // Save all data in case we need to add a line
+        saved[lines] = new Array();
+        for( i=1 ; i<=width ; i++ )
+            {
+            saved[lines][i] = document.getElementById( fname + '_' +  lines + '_' + i ).value;
+            }
+        }
+
+        // If we need an additional field, rewrite everything
+
+    if( lines > 0 && unused == 0 )
+        {
+        new_num = lines + 1;                                                                // Add one to line count for new field
+
+        new_text = document.getElementById( fname + '_text' ).value;
+
+        t = new_text.replace( /\{line_numb\}/gi, new_num );                                            // Replace {n} parameters
+
+        for( i=1 ; i<=width ; i++ )
+            {
+            reg = new RegExp( '\{field_' + i + '\}', 'g' );
+            t = t.replace( reg, '<input type=\"text\" name=\"' + fname + '_' + new_num + '_' + i + '\" id=\"' + fname + '_' + new_num + '_' + i + '\" onChange=\"multi_fields(\'' + fname + '\', this, ' + width + ');\">' );
+            }
+
+        document.getElementById( fname + '_fields' ).innerHTML += t;                // Write out new line
+
+            // Fill values back in
+        for( i=1 ; i<=lines ; i++ )
+            for( j=1 ; j<=width ; j++ )
+                document.getElementById( fname + '_' + i + '_' + j ).value = saved[i][j];
+
+        }
+
+    // Focus on next field
+    setTimeout("setFocus('" + fname + '_' + 1 + '_' + 1 + "', " + ele + ")",100);
+        
+    }
+
+// Set focus to 
+function setFocus(f, ele) 
+       {
+       e = document.getElementById( f );
+       form = e.form;
+       ele++;
+       form.elements[ele].focus();
+       }
+
+    // Special Multi-fields that doesn't conflict with view parsing - Built specifically to support Attendee input in registrations step 2
+
+function multi_fields_2( fname, cur_field, width )
+    {
+    var lines = 0;
+    var unused = 0;
+    var saved = new Array();
+
+    ele = getElementIndex(cur_field);
+    
+    while( document.getElementById( fname + '_' +  (lines+1) + '_1' ) )
+        {
+        lines++;
+
+            // Check if line is used
+        if( document.getElementById( fname + '_' + lines + '_1' ).value == '' )
+            unused++;
+
+            // Save all data in case we need to add a line
+        saved[lines] = new Array();
+        for( i=1 ; i<=width ; i++ )
+            {
+            saved[lines][i] = document.getElementById( fname + '_' +  lines + '_' + i ).value;
+            }
+        }
+
+        // If we need an additional field, rewrite everything
+
+    if( lines > 0 && unused == 0 )
+        {
+        new_num = lines + 1;                                                                // Add one to line count for new field
+
+        new_text = document.getElementById( fname + '_text' ).value;
+
+        t = new_text.replace( /\[line_numb\]/gi, new_num );                                            // Replace {n} parameters
+        for( i=1 ; i<=width ; i++ )
+            {
+            reg = new RegExp( '\\[field_' + i + '\\]', 'g' );
+            t = t.replace( reg, '<input type=\"text\" name=\"' + fname + '_' + new_num + '_' + i + '\" id=\"' + fname + '_' + new_num + '_' + i + '\" size="40" onChange=\"multi_fields_2(\'' + fname + '\', this, ' + width + ');\">' );
+            }
+        document.getElementById( fname + '_fields' ).innerHTML += t;                // Write out new line
+
+            // Fill values back in
+        for( i=1 ; i<=lines ; i++ )
+            for( j=1 ; j<=width ; j++ )
+                {
+                document.getElementById( fname + '_' + i + '_' + j ).value = saved[i][j];
+                }
+        }
+
+    // Focus on next field
+    // Focus on next field
+    setTimeout("setFocus('" + fname + '_' + 1 + '_' + 1 + "', " + ele + ")",100);
+    
+    }
+
+
+
+//CKEditor Actions
+CKEDITOR.config.toolbar_EventManagement =
+[
+ ['Font','FontSize','Bold','Italic'],
+ ['Cut','Copy','PasteText','-','Undo','Redo'],
+ ['NewPage', 'Preview'],
+ '/',
+ ['NumberedList','BulletedList','-','Outdent','Indent'],
+ ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
+ ['TextColor'],
+ ['Link','Unlink'],
+ ['Table','Find','Replace','-','RemoveFormat','Source']
+] ;
+       
+
+function buildCkeditor(f)
+{
+       instance = CKEDITOR.instances[f];
+       if (instance) {
+               instance.destroy(true);
+               instance = null;
+       }
+       
+       //      Only try to replace the textarea if the
+       //      CKEditor is compatible w/ the browser.
+       if (CKEDITOR.env.isCompatible) {
+               CKEDITOR.replace(f, { 
+                       toolbar : 'EventManagement'
+               });
+       }
+
+}
diff --git a/admin/style.css b/admin/style.css
new file mode 100644 (file)
index 0000000..15f7514
--- /dev/null
@@ -0,0 +1,624 @@
+.pseudo_link
+       {
+    FONT-SIZE: 11px;
+    COLOR: #006bb7;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
+    TEXT-DECORATION: none
+       }
+A:link
+       {
+    FONT-SIZE: 11px;
+    COLOR: #006bb7;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
+    TEXT-DECORATION: none
+       }
+A:visited
+       {
+    FONT-SIZE: 11px;
+    COLOR: #666666;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
+       }
+A:active
+       {
+    FONT-SIZE: 11px;
+    COLOR: #ee3a42;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
+       }
+A:hover
+       {
+    FONT-SIZE: 11px;
+    COLOR: #006bb7;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
+       }
+P
+       {
+    FONT-SIZE: 11px;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
+       }
+.detailtitle
+       {
+    FONT-WEIGHT: bold;
+    FONT-SIZE: 13px;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
+       }
+.places
+       {
+    FONT-WEIGHT: bold;
+    FONT-SIZE: 13px;
+    COLOR: #969696;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
+       }       
+.featuretitle
+       {
+    FONT-WEIGHT: bold;
+    FONT-SIZE: 13px;
+    COLOR: #2e629b;
+    FONT-FAMILY: Verdana, Arial, Helvetica
+       }
+.headertitle
+       {
+    BORDER-RIGHT: medium none;
+    BORDER-TOP: medium none;
+    MARGIN-TOP: 0px;
+    FONT-WEIGHT: bolder;
+    FONT-SIZE: 16pt;
+    MARGIN-BOTTOM: 0px;
+    PADDING-BOTTOM: 0px;
+    TEXT-TRANSFORM: none;
+    BORDER-LEFT: medium none;
+    COLOR: #093250;
+    PADDING-TOP: 0px;
+    BORDER-BOTTOM: medium none;
+    FONT-STYLE: normal;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
+       }
+.subtitle
+       {
+    BORDER-RIGHT: medium none;
+    BORDER-TOP: medium none;
+    MARGIN-TOP: 0px;
+    FONT-WEIGHT: bolder;
+    FONT-SIZE: 12pt;
+    MARGIN-BOTTOM: 0px;
+    PADDING-BOTTOM: 0px;
+    TEXT-TRANSFORM: none;
+    BORDER-LEFT: medium none;
+    COLOR: #093250;
+    PADDING-TOP: 0px;
+    BORDER-BOTTOM: medium none;
+    FONT-STYLE: normal;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
+       }phpinfo();exit;
+echo $_PUT['Action'];
+
+
+.terttitle
+       {
+    BORDER-RIGHT: medium none;
+    BORDER-TOP: medium none;
+    MARGIN-TOP: 0px;
+    FONT-WEIGHT: lighter;
+    FONT-SIZE: 10pt;
+    MARGIN-BOTTOM: 0px;
+    PADDING-BOTTOM: 0px;
+    TEXT-TRANSFORM: none;
+    BORDER-LEFT: medium none;
+    COLOR: #093250;
+    PADDING-TOP: 0px;
+    BORDER-BOTTOM: medium none;
+    FONT-STYLE: normal;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
+       }
+H1
+       {
+    FONT-SIZE: 16pt;
+    FONT-FAMILY: 'Arial, Verdana, Helvetica'
+       }
+H2
+       {
+    FONT-SIZE: 15pt;
+    FONT-FAMILY: 'Arial, Verdana, Helvetica'
+       }
+H3
+       {
+    FONT-SIZE: 14pt;
+    PADDING-BOTTOM: 0px;
+    FONT-FAMILY: 'Arial, Verdana, Helvetica'
+       }
+H4
+       {
+    FONT-SIZE: 13pt;
+    PADDING-BOTTOM: 0px;
+    FONT-FAMILY: 'Arial, Verdana, Helvetica'
+       }
+B
+       {
+    FONT-WEIGHT: bold;
+    FONT-SIZE: 10pt;
+    FONT-FAMILY: Arial, Verdana, Helvetica
+       }
+A
+       {
+    FONT-FAMILY: Arial, Verdana, Helvetica;
+    TEXT-DECORATION: underline
+       }
+TH 
+       {
+    font-size: 12px; font-family:  Verdana, arial,helvetica; font-weight: bold; 
+       }
+TD
+       {
+    FONT-SIZE: 10px;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
+       }
+TD.small
+       {
+    FONT-SIZE: 9px;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
+       }
+.pos_rel
+       {
+    POSITION: relative;
+    HEIGHT: 20px
+       }
+.pos_abs
+       {
+    FONT-WEIGHT: bold;
+    FONT-SIZE: 8pt;
+    Z-INDEX: 90;
+    PADDING-TOP: 0px;
+    POSITION: absolute;
+    HEIGHT: 20px
+       }
+#dmenu1
+       {
+    Z-INDEX: 100
+       }
+#dmenu2
+       {
+    Z-INDEX: 100
+       }
+#dmenu3
+       {
+    Z-INDEX: 100
+       }
+#dmenu4
+       {
+    Z-INDEX: 100
+       }
+#dmenu5
+       {
+    Z-INDEX: 100
+       }
+#dmenu6
+       {
+    Z-INDEX: 100
+       }
+A.menu
+       {
+    FONT-WEIGHT: bold;
+    FONT-SIZE: 8pt;
+    COLOR: #000000;
+    FONT-FAMILY: Arial, Verdana, Helvetica;
+    TEXT-DECORATION: none
+       }
+A.menuitem
+       {
+    FONT-SIZE: 8pt;
+    COLOR: #000000;
+    TEXT-DECORATION: none
+       }
+A.menuitem:link
+       {
+    FONT-SIZE: 8pt;
+    COLOR: #000000;
+    TEXT-DECORATION: none
+       }
+A.menuitem
+       {
+    FONT-SIZE: 8pt;
+    TEXT-DECORATION: none
+       }
+.menutop
+       {
+    BORDER-RIGHT: black 1px solid;
+    BORDER-TOP: black 1px solid;
+    FONT-WEIGHT: bold;
+    FONT-SIZE: 8pt;
+    BORDER-LEFT: black 1px solid;
+    COLOR: #ffffff;
+    BORDER-BOTTOM: black 1px solid;
+    FONT-FAMILY: Arial, Verdana, Helvetica;
+    TEXT-DECORATION: none
+       }
+A.menutop:hover
+       {
+    BORDER-RIGHT: black 1px solid;
+    BORDER-TOP: black 1px solid;
+    FONT-WEIGHT: bold;
+    FONT-SIZE: 8pt;
+    BORDER-LEFT: black 1px solid;
+    COLOR: #ffffff;
+    BORDER-BOTTOM: black 1px solid;
+    FONT-FAMILY: Arial, Verdana, Helvetica;
+    TEXT-DECORATION: none
+       }
+.copyright
+       {
+    FONT-SIZE: 8pt;
+    FONT-FAMILY: Arial, Verdana, Helvetica
+       }
+.navlink 
+       {
+    FONT-SIZE: 11px;
+    COLOR: black;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
+       }
+A.subnav:active
+       {
+    FONT-WEIGHT: bolder;
+    FONT-SIZE: 10px;
+    COLOR: #ffffff;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
+    TEXT-DECORATION: none;
+       }
+A.subnav:link
+       {
+    FONT-WEIGHT: bolder;
+    FONT-SIZE: 10px;
+    COLOR: #ffffff;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
+    TEXT-DECORATION: none;
+       }
+A.subnav:visited
+       {
+    FONT-WEIGHT: bolder;
+    FONT-SIZE: 10px;
+    COLOR: #ffffff;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
+    TEXT-DECORATION: none;
+       }
+A.subnav:hover
+       {
+    FONT-SIZE: 10px;
+    COLOR: #0066cc;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
+    BACKGROUND-COLOR: #ffffff;
+    TEXT-DECORATION: underline;
+       }
+INPUT.btn
+       {
+    BORDER-RIGHT: black 1px groove;
+    BORDER-TOP: black 1px groove;
+    FONT-WEIGHT: bolder;
+    FONT-SIZE: 12px;
+    BORDER-LEFT: black 1px groove;
+    COLOR: #ffffff;
+    BORDER-BOTTOM: black 1px groove;
+    FONT-FAMILY: Arial;
+    BACKGROUND-COLOR: #999999;
+       }
+A.image:hover
+       {
+    FONT-SIZE: 11px;
+    COLOR: #0066cc;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
+    TEXT-DECORATION: underline
+       }
+.checkout
+       {
+    FONT-WEIGHT: bold;
+    FONT-SIZE: 13px;
+    COLOR: #e93244;
+    FONT-FAMILY: Verdana, Arial, Helvetica
+       }
+A.criteria:active
+       {
+    FONT-SIZE: 11px;
+    COLOR: #e3413c;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
+    TEXT-DECORATION: underline
+       }
+A.criteria:link
+       {
+    FONT-SIZE: 11px;
+    COLOR: #0067cd;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
+    TEXT-DECORATION: underline
+       }
+A.criteria:visited
+       {
+    FONT-SIZE: 11px;
+    COLOR: #76a4d3;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
+    TEXT-DECORATION: underline
+       }
+A.criteria:hover
+       {
+    FONT-SIZE: 11px;
+    COLOR: #0067cd;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
+    TEXT-DECORATION: underline
+       }phpinfo();exit;
+echo $_PUT['Action'];
+
+
+A.tab-nav-text:active
+       {
+    FONT-WEIGHT: bolder;
+    FONT-SIZE: 12px;
+    COLOR: #ffffff;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
+    TEXT-DECORATION: none
+       }
+A.tab-nav-text:link
+       {
+    FONT-WEIGHT: bolder;
+    FONT-SIZE: 12px;
+    COLOR: #ffffff;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
+    TEXT-DECORATION: none
+       }
+A.tab-nav-text:visited
+       {
+    FONT-WEIGHT: bolder;
+    FONT-SIZE: 12px;
+    COLOR: #ffffff;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
+    TEXT-DECORATION: none
+       }
+A.tab-nav-text:hover
+       {
+    FONT-SIZE: 12px;
+    COLOR: white;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
+    BACKGROUND-COLOR: transparent;
+    TEXT-DECORATION: underline
+       }
+.nonnav
+       {
+    FONT-SIZE: 11px;
+    COLOR: black;
+    FONT-FAMILY: Arial, Verdana
+       }
+LI
+       {
+    FONT-SIZE: 11px;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
+       }
+A.criteria2:link
+       {
+    FONT-SIZE: 11px;
+    COLOR: #0067cd;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
+    TEXT-DECORATION: underline
+       }
+DIV
+       {
+    FONT-SIZE: 11px;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
+       }
+INPUT
+       {
+    FONT-SIZE: 11px;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
+       }
+TEXTAREA
+       {
+    FONT-SIZE: 11px;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
+       }       
+SELECT
+       {
+    FONT-SIZE: 11px;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
+       }
+OPTION
+       {
+    FONT-SIZE: 11px;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
+       }
+.std_textphpinfo();exit;
+echo $_PUT['Action'];
+
+
+       {
+       padding-left: .25cm
+       }
+.bold_text
+       {
+       font-weight: bold; 
+       padding-left: .25cm
+       }
+.stepdescr
+       {
+       font-weight: bold
+       }
+.redtext
+       {
+       font-size: 12px; 
+       color: #CC0000;
+       font-family: Arial, Helvetica, sans-serif; 
+       font-weight: normal; 
+       }
+.redhead 
+       {
+       font-size: 12px; 
+       font-weight: bold; 
+       color: #CC0000; 
+       font-family: Arial, Helvetica, sans-serif; 
+       }
+A.link
+       {
+       font-size: 16px;
+       }
+A.link:visited
+       {
+       font-size: 16px;
+       }
+A.link:active
+       {
+       font-size: 16px; 
+       }
+A.link:hover
+       {
+       font-size: 16px;
+       }
+.standout
+       {
+       COLOR: #006bb7; 
+       font-size: 16px;
+       }
+.standout_small
+       {
+       COLOR: #006bb7; 
+       font-size: 11px;
+       }
+.theader
+       {
+       font-size: 120%; 
+       font-family: arial,helvetica; 
+       color: #FFFFFF; 
+       }
+.text
+       {
+       font-size: 100%; 
+       font-family: 
+       arial,helvetica; 
+       color: #000000;
+       }
+.small_text
+       {
+    FONT-SIZE: 8px;
+    FONT-FAMILY: Arial, Helvetica;
+       }
+.title1
+       {
+       font-size: 22px;
+       font-weight: bold; color: #006bb7;
+       font-family: Arial, Helvetica, sans-serif;
+       }
+.title2
+       {
+       font-size: 22px; 
+       font-weight: bold; 
+       color: black; 
+       font-family: Arial, Helvetica, sans-serif; 
+       }
+.report_title
+       {
+       font-size: 22px;
+       font-weight: bold; color: #006bb7;
+       font-family: Arial, Helvetica, sans-serif;
+       margin-bottom: 0.9em;
+       }
+.report_sub_title
+       {
+       width: 100%;
+       }
+.report_sub_title_left
+       {
+       clear: all;
+       float: left;
+       font-size: 14px;
+       font-weight: bold; color: #006bb7;
+       font-family: Arial, Helvetica, sans-serif;
+       margin-bottom: 0.5em;
+       }
+.report_sub_title_right
+       {
+       float: right;
+       font-size: 14px;
+       font-weight: bold; color: #006bb7;
+       font-family: Arial, Helvetica, sans-serif;
+       margin-bottom: 0.5em;
+       }
+.report_print_box
+       {
+       clear: both;
+       margin-bottom: 0.9em;
+       }
+.menu_normal 
+       {
+    FONT-SIZE: 11px;
+    COLOR: black;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
+    BACKGROUND-COLOR: $FFFFFF;
+       }
+.menu_title
+       {
+    FONT-SIZE: 11px;
+    COLOR: black;
+       font-weight: bold; 
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
+    BACKGROUND-COLOR: $FFFFFF;
+       }
+.menu_active
+       {
+    FONT-SIZE: 11px;
+    COLOR: white;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
+    BACKGROUND-COLOR: #3399EE;
+       }
+.menu_unavailable
+       {
+    FONT-SIZE: 11px;
+    COLOR: gray;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
+    BACKGROUND-COLOR: $FFFFFF;
+       }
+
+.hidden {visibility: hidden;}
+.welcome-text {
+       width: 100%; 
+       text-align: left; 
+}
+
+.quicktip-wide                 { text-align: left; position: absolute; width: 700px; visibility: hidden; z-index: 100;
+                         font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; border: 1px solid #000; margin-top: 20px; }
+
+.quicktip-notes                { text-align: left; position: absolute; width: 400px; visibility: hidden; z-index: 100;
+                         font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; border: 1px solid #000; margin-top: 20px; }
+
+.quicktip              { text-align: left; position: absolute; width: 410px; visibility: hidden; z-index: 100;
+                         font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; border: 1px solid #000; margin-top: 20px; }
+.quicktip-prompt       { cursor: help; }
+.quicktip-titlebar     { background-color: #87CEFA;    }
+.quicktip-title        { font-weight: bold; color: black; padding: 3px;        }
+.quicktip-close        { font-weight: bold; color: white;  text-decoration: none;      float: right; position: relative; display: block; padding: 3px;}
+.quicktip-body                 { background-color: #FDF5E6; color: black; padding: 8px; font-weight: normal;}
+.quicktip-fieldname    { font-weight: bold; margin-bottom: 0.5em; border-bottom: 1px solid #333;}
+.quicktip-prompt       { cursor: help; border-bottom: 1px dashed #ccc;} 
+.quicktip-prompt2      { cursor: help; } 
+
+.quickedit             { text-align: left; position: absolute; width: 550px; visibility: hidden; z-index: 100;
+                         font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; border: 1px solid #000; margin-top: 20px; }
+.quickedit-prompt      { cursor: help; }
+.quickedit-titlebar    { background-color: #87CEFA;    }
+.quickedit-title       { font-weight: bold; color: black; padding: 3px;        }
+.quickedit-close       { font-weight: bold; color: white;  text-decoration: none;      float: right; position: relative; display: block; padding: 3px;}
+.quickedit-body        { background-color: #FDF5E6; color: black; padding: 8px; font-weight: normal;}
+.quickedit-fieldname   { font-weight: bold; margin-bottom: 0.5em; border-bottom: 1px solid #333;}
+.quickedit-prompt      { cursor: help; border-bottom: 1px dashed #ccc;} 
+.quickedit-prompt2     { cursor: help; } 
+
+.pac_std_text{font-family: Arial, Helvetica, sans-serif; padding-left: .25cm}
+.pac_bold_text{font-family: Arial, Helvetica, sans-serif; font-weight: bold; padding-left: .25cm}
+.pac_stepdescr{font-family: Arial, Helvetica, sans-serif; font-weight: bold}
+.pac_redhead{color: #990000}
+A.pac_link { font-size: 16px; }
+A.pac_link:visited { font-size: 16px; }
+A.pac_link:active { font-size: 16px; }
+A.pac_link:hover { font-size: 16px; }
+
+.pac_standout { COLOR: #006bb7; font-size: 16px; }
+.pac_standout_small { COLOR: #006bb7; font-size: 12px; }
+
+.selectCategory {
+       background-color: #CCC;
+       color: black;
+}
+.selectSubCategory {
+    background-color: #EEE;
+    color: black;
+}
diff --git a/assets/add.png b/assets/add.png
new file mode 100644 (file)
index 0000000..6332fef
Binary files /dev/null and b/assets/add.png differ
diff --git a/assets/arrow_left.png b/assets/arrow_left.png
new file mode 100644 (file)
index 0000000..5dc6967
Binary files /dev/null and b/assets/arrow_left.png differ
diff --git a/assets/basket.png b/assets/basket.png
new file mode 100644 (file)
index 0000000..b0686d7
Binary files /dev/null and b/assets/basket.png differ
diff --git a/assets/calendar.png b/assets/calendar.png
new file mode 100644 (file)
index 0000000..6589138
Binary files /dev/null and b/assets/calendar.png differ
diff --git a/assets/cancel.png b/assets/cancel.png
new file mode 100644 (file)
index 0000000..c149c2b
Binary files /dev/null and b/assets/cancel.png differ
diff --git a/assets/down.gif b/assets/down.gif
new file mode 100644 (file)
index 0000000..a56f027
Binary files /dev/null and b/assets/down.gif differ
diff --git a/assets/down_small.png b/assets/down_small.png
new file mode 100644 (file)
index 0000000..b3d1a9c
Binary files /dev/null and b/assets/down_small.png differ
diff --git a/assets/logo.gif b/assets/logo.gif
new file mode 100644 (file)
index 0000000..3d9b055
Binary files /dev/null and b/assets/logo.gif differ
diff --git a/assets/tick.png b/assets/tick.png
new file mode 100644 (file)
index 0000000..a9925a0
Binary files /dev/null and b/assets/tick.png differ
diff --git a/assets/up.gif b/assets/up.gif
new file mode 100644 (file)
index 0000000..7df1212
Binary files /dev/null and b/assets/up.gif differ
diff --git a/assets/up_small.png b/assets/up_small.png
new file mode 100644 (file)
index 0000000..138fabb
Binary files /dev/null and b/assets/up_small.png differ
diff --git a/classes/EasyPassword.php b/classes/EasyPassword.php
new file mode 100644 (file)
index 0000000..0636cb8
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+/*
+ * EasyPasswordGenerator.class.php - v1.0.0.20060621
+ *
+ * Copyright (c) 2006 Shane Kretzmann <Shane@uberdragon.net>
+ * Released under the terms of the GNU General Public License
+ * Based in part on Script released by: Jochen Kupperschmidt
+ *
+ * This is a highly modified version of this password generator for this application only.
+ * For original code please refer to original author.
+ */
+
+
+class EasyPassword
+{
+
+    // Get a random dictionary word from a text file
+    function dictionaryWord() {
+        $path = GLM_APP_BASE.'Common/Registrations_V3/classes/EasyPassword.words';
+        $fileload = @file($path);
+        $i = count($fileload)-1;
+        $random = rtrim($fileload[rand(0,$i)]);
+        return $random;
+    }
+
+    // This is the function to produce the password
+    function generateEasyPassword()
+    {
+        $word1 = $this->dictionaryWord();
+        $numb = rand(1, 9);                                                  // Generate specified amount of numbers
+        $word2 = $this->dictionaryWord();
+
+        $keys = array ($word1,$numb,$word2);                    // Place password components in an array
+        $rand_keys = array_rand($keys,3);                                        // Randomize the 3 password components
+        return $keys[$rand_keys[0]].$keys[$rand_keys[1]].$keys[$rand_keys[2]];  // Return the resulting password
+    }
+
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/classes/EasyPassword.words b/classes/EasyPassword.words
new file mode 100644 (file)
index 0000000..f03284c
--- /dev/null
@@ -0,0 +1,828 @@
+able
+ABLE
+about
+account
+acid
+across
+act
+addition
+after
+again
+against
+agreement
+air
+all
+almost
+among
+amount
+amusement
+and
+angle
+angry
+animal
+answer
+ant
+any
+apparatus
+apple
+approval
+arch
+argument
+arm
+army
+art
+as
+at
+attack
+attempt
+attention
+authority
+automatic
+awake
+baby
+back
+bad
+bag
+balance
+ball
+band
+base
+basin
+basket
+bath
+be
+beautiful
+because
+bed
+bee
+before
+behaviour
+belief
+bell
+bent
+berry
+between
+bird
+birth
+bit
+black
+blade
+blood
+blow
+blue
+board
+boat
+body
+boiling
+book
+boot
+bottle
+box
+boy
+brain
+brake
+branch
+brass
+bread
+breath
+brick
+bridge
+bright
+broken
+brother
+brown
+brush
+bucket
+building
+bulb
+burn
+burst
+business
+butter
+button
+by
+cake
+camera
+canvas
+card
+care
+carriage
+cart
+cat
+cause
+certain
+chain
+chalk
+chance
+change
+cheap
+cheese
+chemical
+chest
+chief
+chin
+church
+circle
+clean
+clear
+clock
+cloth
+cloud
+coal
+coat
+cold
+collar
+colour
+comb
+come
+comfort
+committee
+common
+company
+comparison
+complete
+complex
+condition
+connection
+conscious
+control
+cook
+copper
+copy
+cord
+cork
+cotton
+cough
+country
+cover
+cow
+crack
+credit
+crime
+cruel
+crush
+cry
+cup
+cup
+current
+curtain
+curve
+cushion
+damage
+danger
+dark
+daughter
+day
+dead
+dear
+death
+debt
+decision
+deep
+degree
+delicate
+dependent
+design
+desire
+destruction
+detail
+development
+different
+digestion
+direction
+dirty
+discovery
+discussion
+disease
+disgust
+distance
+division
+do
+dog
+door
+doubt
+down
+drain
+drawer
+dress
+drink
+driving
+drop
+dry
+dust
+ear
+early
+earth
+east
+edge
+education
+effect
+egg
+elastic
+electric
+end
+engine
+enough
+equal
+error
+even
+event
+ever
+every
+example
+exchange
+existence
+expansion
+experience
+expert
+eye
+face
+fact
+fall
+false
+family
+far
+farm
+fat
+father
+fear
+feather
+feeble
+feeling
+female
+fertile
+fiction
+field
+fight
+finger
+fire
+first
+fish
+fixed
+flag
+flame
+flat
+flight
+floor
+flower
+fly
+fold
+food
+foolish
+foot
+for
+force
+fork
+form
+forward
+fowl
+frame
+free
+frequent
+friend
+from
+front
+fruit
+full
+future
+garden
+general
+get
+girl
+give
+glass
+glove
+go
+goat
+gold
+good
+government
+grain
+grass
+great
+green
+grey
+grip
+group
+growth
+guide
+gun
+hair
+hammer
+hand
+hanging
+happy
+harbour
+hard
+harmony
+hat
+hate
+have
+he
+healthy
+hear
+hearing
+heart
+heat
+help
+high
+history
+hole
+hollow
+hook
+hope
+horn
+horse
+hospital
+hour
+house
+how
+humour
+ice
+idea
+if
+ill
+important
+impulse
+in
+increase
+industry
+ink
+insect
+instrument
+insurance
+interest
+invention
+iron
+island
+jelly
+jewel
+join
+journey
+judge
+jump
+keep
+kettle
+key
+kick
+kind
+kiss
+knee
+knife
+knot
+knowledge
+land
+language
+last
+late
+laugh
+law
+lead
+leaf
+learning
+left
+leg
+let
+letter
+level
+library
+lift
+light
+like
+limit
+line
+linen
+lip
+liquid
+list
+little
+living
+lock
+long
+look
+loose
+loss
+loud
+love
+low
+machine
+make
+male
+man
+manager
+map
+mark
+market
+married
+mass
+match
+material
+may
+meal
+measure
+meat
+medical
+meeting
+memory
+metal
+middle
+military
+milk
+mind
+mine
+minute
+mist
+mixed
+money
+monkey
+month
+moon
+morning
+mother
+motion
+mountain
+mouth
+move
+much
+muscle
+music
+nail
+name
+narrow
+nation
+natural
+near
+necessary
+neck
+need
+needle
+nerve
+net
+new
+news
+night
+no
+noise
+normal
+north
+nose
+not
+note
+now
+number
+nut
+of
+off
+offer
+office
+oil
+old
+on
+only
+open
+operation
+opinion
+opposite
+or
+orange
+order
+ornament
+other
+out
+oven
+over
+owner
+page
+pain
+paint
+paper
+parallel
+parcel
+part
+past
+paste
+payment
+peace
+pen
+pencil
+person
+physical
+picture
+pig
+pin
+pipe
+place
+plane
+plant
+plate
+play
+please
+pleasure
+plough
+pocket
+point
+poison
+polish
+political
+poor
+porter
+position
+possible
+pot
+potato
+powder
+power
+present
+price
+print
+prison
+private
+probable
+process
+produce
+profit
+property
+prose
+protest
+public
+pull
+pump
+purpose
+push
+put
+quality
+question
+quick
+quiet
+quite
+rail
+rain
+range
+rat
+rate
+ray
+reaction
+reading
+ready
+reason
+receipt
+record
+red
+regret
+regular
+relation
+request
+respect
+rest
+reward
+rhythm
+rice
+right
+ring
+river
+road
+rod
+roll
+roof
+room
+root
+rough
+round
+rub
+rule
+run
+safe
+sail
+salt
+same
+sand
+say
+scale
+school
+science
+scissors
+screw
+sea
+seat
+second
+secret
+see
+seed
+seem
+self
+send
+sense
+separate
+serious
+servant
+sex
+shade
+shake
+shame
+sharp
+sheep
+shelf
+ship
+shirt
+shock
+shoe
+short
+shut
+side
+sign
+silk
+silver
+simple
+sister
+size
+skin
+skirt
+sky
+sleep
+slip
+slope
+slow
+small
+smash
+smell
+smile
+smoke
+smooth
+snake
+sneeze
+snow
+so
+soap
+society
+sock
+soft
+solid
+some
+
+son
+song
+sort
+sound
+soup
+south
+space
+spade
+special
+sponge
+spoon
+spring
+square
+stage
+stamp
+star
+start
+statement
+station
+steam
+steel
+stem
+step
+stick
+sticky
+stiff
+still
+stitch
+stocking
+stomach
+stone
+stop
+store
+story
+straight
+strange
+street
+stretch
+strong
+structure
+such
+sudden
+sugar
+summer
+sun
+support
+surprise
+sweet
+swim
+system
+table
+tail
+take
+talk
+tall
+taste
+tax
+teaching
+tendency
+test
+than
+that
+the
+then
+theory
+there
+thick
+thin
+thing
+this
+thought
+thread
+throat
+through
+through
+thumb
+thunder
+ticket
+tight
+till
+time
+tin
+tired
+to
+toe
+together
+tomorrow
+tongue
+tooth
+top
+touch
+town
+trade
+train
+transport
+tray
+tree
+trick
+trouble
+trousers
+true
+turn
+twist
+umbrella
+under
+unit
+up
+use
+value
+verse
+very
+vessel
+view
+violent
+voice
+waiting
+walk
+wall
+war
+warm
+wash
+waste
+watch
+water
+wave
+wax
+way
+weather
+week
+weight
+well
+west
+wet
+wheel
+when
+where
+while
+whip
+whistle
+white
+who
+why
+wide
+will
+wind
+window
+wine
+wing
+winter
+wire
+wise
+with
+woman
+wood
+wool
+word
+work
+worm
+wound
+writing
+wrong
+year
+yellow
+yes
+yesterday
+you
+young
diff --git a/classes/FileServer/AdapterAbstract.php b/classes/FileServer/AdapterAbstract.php
new file mode 100644 (file)
index 0000000..0c5ac4f
--- /dev/null
@@ -0,0 +1,405 @@
+<?php
+
+/**
+ * Adapter class for linking to the file server
+ *
+ * Base abstract class used to connect and talk with file server
+ * can be subclassed for Files, Images, Video, Audio, etc...
+ *
+ * PHP version 5
+ *
+ * The license text...
+ *
+ * @category  Toolkit
+ * @package   FileServer
+ * @author    Jamie Kahgee <jamie@gaslightmedia.com>
+ * @copyright 2010 Jamie Kahgee
+ * @license   http://www.gaslightmedia.com/ Gaslightmedia
+ * @version   CVS: $Id: AdapterAbstract.php,v 1.6 2010/06/04 11:33:54 jamie Exp $
+ * @link      <>
+ * @see       References to other sections (if any)...
+ */
+
+
+/**
+ * Validation Secret
+ */
+define('IS_VALIDATE_SECRET', 'Glm0IS1secreT');
+
+/**
+ * URL to file server, this is dynamic based on the server
+ * so can be setup for any sandbox
+ */
+define('IS_SUBMIT_URL', FILE_SERVER_URL . 'submit.phtml');
+
+/**
+ * Adapter class for linking to the file server
+ *
+ * @category  Toolkit
+ * @package   FileServer
+ * @author    Jamie Kahgee <jamie@gaslightmedia.com>
+ * @copyright 2010 Jamie Kahgee
+ * @license   http://www.gaslightmedia.com/ Gaslightmedia
+ * @version   Release: @package_version@
+ * @link      <>
+ * @see       References to other sections (if any)...
+ */
+abstract class Reg_Toolkit_FileServer_AdapterAbstract
+{
+       //      {{{     properties
+
+    /**
+     * ID of owner that was setup in the file server
+        *
+        * This is defined via the file server web interface
+     * @var    string
+     * @access protected
+     */
+    protected $ownerID;
+
+    /**
+     * Owners password that was setup for them
+        *
+        * This is defined via the file server web interface
+     * @var    string
+     * @access protected
+     */
+    protected $ownerPW;
+
+    /**
+     * XML to send to the file server
+     * @var    unknown
+     * @access protected
+     */
+    protected $xml;
+
+       //      }}}
+       //      {{{     __construct()
+
+    /**
+     * Constructor
+     *
+     * @param string $owner File Server owner
+     * @param string $pword File Server owner password
+     */
+    public function __construct($owner = IS_OWNER_ID, $pword = IS_OWNER_PW)
+    {
+        $this->ownerID = $owner;
+        $this->ownerPW = $pword;
+    }
+
+       //      }}}
+
+    //  {{{ buildFileServerXML()
+
+    /**
+     * buildFileServerXML
+     *
+     * Create the xml for the FileServerRequest
+     *
+     * @param string $fName File name to upload or delete
+     * @param string $type  Upload, Delete or URL
+     *
+     * @return string xml content
+     * @access protected
+     */
+    protected function buildFileServerXML($fName, $type)
+    {
+        $xml = new DOMDocument('1.0');
+        $xml->formatOutput = true;
+
+        $fileServerRequest = $xml->createElement('FileServerRequest');
+        $fileServerRequest->setAttribute('version', '1.0');
+
+        //  access request
+        $accessRequest = $xml->createElement('AccessRequest');
+        $owner         = $xml->createElement('Owner');
+        $ownerID       = $xml->createElement('OwnerID', $this->ownerID);
+        $ownerPW       = $xml->createElement('OwnerPW', $this->ownerPW);
+
+        $owner->appendChild($ownerID);
+        $owner->appendChild($ownerPW);
+
+        $accessRequest->appendChild($owner);
+
+        $fileServerRequest->appendChild($accessRequest);
+
+        $file = $this->getFileElement($xml, $type, $fName);
+
+        $fileServerRequest->appendChild($file);
+        $validStr = md5($this->ownerID . $this->ownerPW . IS_VALIDATE_SECRET);
+
+        $validation = $xml->createElement('Validation', $validStr);
+        $fileServerRequest->appendChild($validation);
+        $xml->appendChild($fileServerRequest);
+
+        return $xml->saveXML($xml);
+    }
+
+    // }}}
+
+       //      {{{     delete()
+
+    /**
+     * Delete a file from the file server
+     *
+     * @param string $name File name
+     *
+     * @return string file name
+     * @access public
+        * @throws Toolkit_FileServer_Exception
+     */
+    public function delete($name)
+    {
+        // don't do anything if on development server
+        if (defined('DEVELOPMENT') && DEVELOPMENT == true) {
+            return true;
+        }
+        $ch = curl_init();
+
+        $fileData = array(
+            'request' => $this->buildFileServerXML($name, 'Delete')
+        );
+        $curlOptions = array(
+            CURLOPT_URL            => IS_SUBMIT_URL,
+            CURLOPT_HEADER         => 0,
+            CURLOPT_RETURNTRANSFER => 1,
+            CURLOPT_POSTFIELDS     => $fileData
+        );
+        curl_setopt_array($ch, $curlOptions);
+
+        $response = curl_exec($ch);
+        curl_close($ch);
+
+        try {
+            $xmlDoc   = new DOMDocument;
+            $response = str_replace('<?xml version="1.0"?' . '>', '', $response);
+            $xmlDoc->loadXML($response);
+            $successCode = $this->xmlPathContent(
+                $xmlDoc,
+                '/FileServerResponse/ReplyStatus/SuccessCode'
+            );
+            $message     = $this->xmlPathContent(
+                $xmlDoc,
+                '/FileServerResponse/ReplyStatus/Message'
+            );
+
+            if ($successCode != 0) {
+                throw new RangeException(
+                                       "Invalid response `$response` - `$message`"
+                               );
+            }
+
+            return $message;
+        } catch (RangeException $e) {
+            Toolkit_Logger::logException('Image Server', $e);
+            throw new Toolkit_FileServer_Exception(
+                               'Invalid File Server Response'
+                       );
+        }
+    }
+
+       //      }}}
+
+       //      {{{     getFileElement()
+
+
+    /**
+     * Gets the file element used in the XML sent to the file server
+     *
+     * @param DOMDocument $xml   DOM object used to build the xml string
+     * @param string      $type  Type of manipulation (Upload, URL, Delete)
+     * @param string      $fName File name
+        *
+     * @return DOMElement $file File xml element
+     * @access protected
+     */
+    abstract protected function getFileElement(
+        DOMDocument $xml,
+        $type,
+        $fName
+    );
+
+       //      }}}
+       //      {{{     getErrorMessage()
+
+       /**
+        * Gets an appropriate error message for file upload errors
+        *
+        * @param integer Error code
+        *
+        * @return string Error message
+        * @access protected
+        */
+       protected function getErrorMessage($code)
+       {
+               switch ($code) {
+               case UPLOAD_ERR_INI_SIZE :
+                       $message = 'The Uploaded file exceeds the upload max filesize directive in php.ini';
+                       break;
+
+               case UPLOAD_ERR_FORM_SIZE :
+                       $message = 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form';
+                       break;
+
+               case UPLOAD_ERR_PARTIAL :
+                       $message = 'The uploaded file was only partially uploaded';
+                       break;
+
+               case UPLOAD_ERR_NO_FILE :
+                       $message = 'No file was uploaded';
+                       break;
+
+               case UPLOAD_ERR_NO_TMP_DIR :
+                       $message = 'Missing a temporary folder';
+                       break;
+
+               case UPLOAD_ERR_CANT_WRITE :
+                       $message = 'Failed to write file to disk';
+                       break;
+
+               case UPLOAD_ERR_EXTENSION :
+                       $message = 'A PHP extension stopped the file upload';
+                       break;
+
+               default :
+                       $message = 'Unknown error uploading file';
+                       break;
+               }
+
+               return $message;
+       }
+
+       //      }}}
+
+       //      {{{     upload()
+
+    /**
+     * Upload a file to the File Server
+     *
+     * @param string $name $_FILES index key that holds the file data
+     *
+     * @return array Uploaded file data
+     * @access public
+     * @throws Toolkit_FileServer_Exception
+     */
+    public function upload($name)
+    {
+        $fileType = null;
+        if (preg_match('/^http/', $name)) {
+            $fileType = 'URL';
+        } elseif (isset($_FILES[$name]) && is_array($_FILES[$name])) {
+            $fileType = 'Upload';
+        }
+
+               if ($_FILES[$name]['error'] != 0) {
+                       $message = $this->getErrorMessage($_FILES[$name]['error']);
+                       throw new Toolkit_FileServer_Exception(
+                               $message,
+                               $_FILES[$name]['error']
+                       );
+               }
+
+        if (is_null($fileType)) {
+            return false;
+        } else {
+            $request = $this->buildFileServerXML($name, $fileType);
+
+            $ch = curl_init();
+            if ($fileType == 'URL') {
+                $fileData = array(
+                    'request' => $request
+                );
+            } else {
+                $fileData = array(
+                    'request'          => $request,
+                    'file_upload'      => "@{$_FILES[$name]['tmp_name']}",
+                    'file_upload_name' => $_FILES[$name]['name']
+                );
+            }
+
+            $curlOptions = array(
+                CURLOPT_URL            => IS_SUBMIT_URL,
+                CURLOPT_HEADER         => 0,
+                CURLOPT_RETURNTRANSFER => 1,
+                CURLOPT_POSTFIELDS     => $fileData
+            );
+            curl_setopt_array($ch, $curlOptions);
+
+            $response = curl_exec($ch);
+            curl_close($ch);
+
+            try {
+                $xmlDoc = new DOMDocument();
+                $response = str_replace('<?xml version="1.0"?' . '>', '', $response);
+                $xmlDoc->loadXML($response);
+                $successCode = $this->xmlPathContent(
+                    $xmlDoc,
+                    '/FileServerResponse/ReplyStatus/SuccessCode'
+                );
+                $message     = $this->xmlPathContent(
+                    $xmlDoc,
+                    '/FileServerResponse/ReplyStatus/Message'
+                );
+                $storedName  = $this->xmlPathContent(
+                    $xmlDoc,
+                    '/FileServerResponse/File/StoredName'
+                );
+                $storedSize  = $this->xmlPathContent(
+                    $xmlDoc,
+                    '/FileServerResponse/File/StoredSize'
+                );
+                $mediaType   = $this->xmlPathContent(
+                    $xmlDoc,
+                    '/FileServerResponse/File/MediaType'
+                );
+
+                if ($successCode != 0) {
+                    throw new RangeException(
+                                               "Invalid response `$response` - `$message`"
+                                       );
+                }
+
+                               $extension = end(explode('.', $storedName));
+                return array(
+                    'name' => $storedName,
+                    'size' => $storedSize,
+                    'type' => $mediaType,
+                                       'extension' => $extension,
+                );
+            } catch (RangeException $e) {
+                Toolkit_Logger::logException('Image Server', $e);
+                throw new Toolkit_FileServer_Exception(
+                                       'Invalid File Server Response'
+                               );
+            }
+        }
+    }
+
+       //      }}}
+
+       //      {{{     xmlPathContent()
+
+    /**
+     * Extract a XML node value
+     *
+     * @param DOMDocument $dom     DOM object holding the XML
+     * @param string      $content Node name to extract content from
+        *
+     * @return mixed Node value on success, false if can't find the value
+     * @access protected
+     */
+    protected function xmlPathContent(DOMDocument $dom, $content)
+    {
+        $xPath = new DOMXPath($dom);
+        $nodeList = $xPath->query($content);
+        if ($nodeList->length > 0) {
+            $node = $nodeList->item(0);
+            return $node->nodeValue;
+        }
+
+        return false;
+    }
+
+       //      }}}
+}
diff --git a/classes/FileServer/FileAdapter.php b/classes/FileServer/FileAdapter.php
new file mode 100644 (file)
index 0000000..24180f2
--- /dev/null
@@ -0,0 +1,101 @@
+<?php
+
+/**
+ * File Adapter
+ *
+ * Link to the file server and allow file storage and deletion
+ *
+ * PHP version 5
+ *
+ * @category  Toolkit
+ * @package   FileServer
+ * @author    Jamie Kahgee <jamie@gaslightmedia.com>
+ * @copyright 2010 Jamie Kahgee
+ * @license   http://www.gaslightmedia.com/ Gaslightmedia
+ * @version   CVS: $Id: FileAdapter.php,v 1.4 2010/05/25 14:02:28 jamie Exp $
+ * @link      <>
+ * @see       References to other sections (if any)...
+ */
+
+/**
+ * File Adapter
+ *
+ * Used for linking to the file server for file uploading, storage and deletion
+ *
+ * @category  Toolkit
+ * @package   FileServer
+ * @author    Jamie Kahgee <jamie@gaslightmedia.com>
+ * @copyright 2010 Jamie Kahgee
+ * @license   http://www.gaslightmedia.com/ Gaslightmedia
+ * @version   Release: @package_version@
+ * @link      <>
+ * @see       References to other sections (if any)...
+ */
+class Reg_Toolkit_FileServer_FileAdapter extends Reg_Toolkit_FileServer_AdapterAbstract
+{
+       //      {{{     getFileElement()
+
+    /**
+     * Creates the file element for the XML string
+     *
+     * @param DOMDocument $xml   XML object used to build the string
+     * @param string      $type  Type of action to take on the file (Upload, Delete)
+     * @param string      $fName file name to delete
+     *
+     * @return DOMElement $file File xml element
+     * @access protected
+     * @throws RuntimeException
+     */
+    protected function getFileElement(DOMDocument $xml, $type, $fName)
+    {
+        $file = $xml->createElement('File');
+
+        switch ($type) {
+               case 'Upload' :
+                       $action    = $xml->createElement('FileAction', 'Submit');
+                       $delivery  = $xml->createElement('DeliveryMethod', 'Submit');
+                       $fieldName = $xml->createElement('FieldName', 'file_upload');
+
+                       $fileName = filter_var($_FILES[$fName]['name'], FILTER_SANITIZE_STRING);
+                       $nameParts = explode('.', $fileName);
+                       $extension = end($nameParts);
+                       $fieldName = $xml->createElement('Extension', end($nameParts));
+
+                       $file->appendChild($action);
+                       $file->appendChild($delivery);
+                       $file->appendChild($fieldName);
+                       break;
+
+               case 'URL':
+                       $action   = $xml->createElement('FileAction', 'Submit');
+                       $delivery = $xml->createElement('DeliveryMethod', 'URL');
+                       $src      = $xml->createElement('Src', $fName);
+
+                       $nameParts = explode('.', $fName);
+                       $extension = end($nameParts);
+                       $fieldName = $xml->createElement('Extension', end($nameParts));
+
+                       $file->appendChild($action);
+                       $file->appendChild($delivery);
+                       $file->appendChild($src);
+                       $file->appendChild($fieldName);
+                       break;
+
+               case 'Delete' :
+                       $action = $xml->createElement('FileAction', 'Delete');
+                       $file->appendChild($action);
+
+                       $fileName = $xml->createElement('FileName', $fName);
+                       $file->appendChild($fileName);
+                       break;
+
+               default :
+                       throw new RuntimeException("Invalid XML type - `$type`.");
+                       break;
+        }
+
+        return $file;
+    }
+
+       //      }}}
+}
diff --git a/classes/ImageServer/Server.php b/classes/ImageServer/Server.php
new file mode 100644 (file)
index 0000000..142d421
--- /dev/null
@@ -0,0 +1,373 @@
+<?php
+
+/**
+ * Server.php
+ *
+ * PHP version 5
+ *
+ * @category  Toolkit
+ * @package   Image
+ * @author    Steve Sutton <steve@gaslightmedia.com>
+ * @copyright 2008 Steve Sutton
+ * @license   Gaslight Media
+ * @version   CVS: $Id: Server.php,v 1.19 2010/05/25 14:02:45 jamie Exp $
+ * @link      http://demo.gaslightmedia.com
+ */
+
+/**
+ * Description for define
+ */
+define('IS_VALIDATE_SECRET', 'Glm0IS1secreT');
+
+/**
+ * Description for define
+ */
+define('IS_SUBMIT_URL', FILE_SERVER_URL . 'submit.phtml');
+
+/**
+ * Toolkit_Image_Server
+ *
+ * Class for implementation of the image server process Chuck has
+ * setup for is0.gaslightmedia.com
+ * Uses Curl PHP Library to upload images to the server
+ *
+ * @category  Toolkit
+ * @package   Image
+ * @author    Steve Sutton <steve@gaslightmedia.com>
+ * @copyright 2008 Steve Sutton
+ * @license   Gaslight Media
+ * @link      http://demo.gaslightmedia.com
+ */
+class Reg_Toolkit_Image_Server
+{
+    // {{{ properties
+
+    /**
+     * OwnerID for the Image Server User
+     * @var    string
+     * @access protected
+     */
+    protected $OwnerID;
+
+    /**
+     * Owner Password
+     * @var    string
+     * @access protected
+     */
+    protected $OwnerPW;
+
+    /**
+     * DOMDocument Object
+     * @var    unknown
+     * @access protected
+     */
+    protected $xml;
+
+    // }}}
+
+    //  {{{ __construct()
+
+    /**
+     * __construct
+     *
+     * @return void
+     * @access public
+     */
+    function __construct()
+    {
+        $this->OwnerID = IS_OWNER_ID;
+        $this->OwnerPW = IS_OWNER_PW;
+    }
+
+    // }}}
+
+    //  {{{ buildImageServerXML()
+
+    /**
+     * buildImageServerXML
+     *
+     * Create the xml for the FileServerRequest
+     *
+     * @param string  $fileName File to upload or delete
+     * @param unknown $type     Upload or Delete
+     *
+     * @return string xml content
+     * @access public
+     */
+    function buildImageServerXML($fileName, $type)
+    {
+        $xml               = new DOMDocument('1.0');
+        $xml->formatOutput = true;
+        $FileServerRequest = $xml->createElement('FileServerRequest');
+        $FileServerRequest->setAttribute('version', '1.0');
+        // AccessRequest part
+        $AccessRequest = $xml->createElement('AccessRequest');
+        $Owner         = $xml->createElement('Owner');
+        $OwnerID       = $xml->createElement('OwnerID', $this->OwnerID);
+        $OwnerPW       = $xml->createElement('OwnerPW', $this->OwnerPW);
+        $Owner->appendChild($OwnerID);
+        $Owner->appendChild($OwnerPW);
+        $AccessRequest->appendChild($Owner);
+        $FileServerRequest->appendChild($AccessRequest);
+        // file part
+        $File = $xml->createElement('File');
+        switch ($type) {
+        case "Upload":
+            $FileAction     = $xml->createElement('FileAction', 'Submit');
+            $DeliveryMethod = $xml->createElement('DeliveryMethod', 'Submit');
+            $FieldName      = $xml->createElement('FieldName', 'file_upload');
+            $File->appendChild($FileAction);
+            $File->appendChild($DeliveryMethod);
+            $File->appendChild($FieldName);
+            $FileServerRequest->appendChild($File);
+            $size     = filesize($_FILES[$fileName]['tmp_name']);
+            $validStr = md5($this->OwnerID.$this->OwnerPW.IS_VALIDATE_SECRET);
+            break;
+        case "URL":
+            $FileAction     = $xml->createElement('FileAction', 'Submit');
+            $DeliveryMethod = $xml->createElement('DeliveryMethod', 'URL');
+            $Src            = $xml->createElement('Src', $fileName);
+            $File->appendChild($FileAction);
+            $File->appendChild($DeliveryMethod);
+            $File->appendChild($Src);
+            $FileServerRequest->appendChild($File);
+            $size     = strlen($fileName);
+            $validStr = md5($this->OwnerID.$this->OwnerPW.IS_VALIDATE_SECRET);
+            break;
+        case "Delete":
+            $FileAction = $xml->createElement('FileAction', 'Delete');
+            $File->appendChild($FileAction);
+            $FileName = $xml->createElement('FileName', $fileName);
+            $File->appendChild($FileName);
+            $FileServerRequest->appendChild($File);
+            $validStr = md5($this->OwnerID.$this->OwnerPW.IS_VALIDATE_SECRET);
+            break;
+        }
+        // validation part
+        $Validation = $xml->createElement('Validation', $validStr);
+        $FileServerRequest->appendChild($Validation);
+        $xml->appendChild($FileServerRequest);
+        return $xml->saveXML($xml);
+    }
+
+    // }}}
+
+    //  {{{ imageDelete()
+
+    /**
+     * imageDelete
+     *
+     * Delete an image from the image server
+     *
+     * @param unknown $name Image name
+     *
+     * @return unknown image name
+     * @access public
+     */
+    function imageDelete($name)
+    {
+        // don't do anything if on development server
+        if (defined('DEVELOPMENT') && DEVELOPMENT == true) {
+            return "File deleted. File: " . $name;
+        }
+        if ($name) {
+            $request     = $this->buildImageServerXML($name, 'Delete');
+            $ch          = curl_init();
+            $fileData    = array(
+                'request' => $request
+                );
+            $curlOptions = array(
+                    CURLOPT_URL            => IS_SUBMIT_URL,
+                    CURLOPT_HEADER         => 0,
+                    CURLOPT_RETURNTRANSFER => 1,
+                    CURLOPT_POSTFIELDS     => $fileData
+                    );
+            curl_setopt_array($ch, $curlOptions);
+
+            $response = curl_exec($ch);
+            curl_close($ch);
+            $xmlDoc   = new DOMDocument;
+            $response = str_replace('<?xml version="1.0"?' . '>', '', $response);
+            $xmlDoc->loadXML($response);
+            $SuccessCode = $this->xmlPathContent(
+                $xmlDoc,
+                '/FileServerResponse/ReplyStatus/SuccessCode'
+            );
+            $Message     = $this->xmlPathContent(
+                $xmlDoc,
+                '/FileServerResponse/ReplyStatus/Message'
+            );
+            $Owner       = $this->xmlPathContent(
+                $xmlDoc,
+                '/FileServerResponse/File/Owner'
+            );
+            $StoredName  = $this->xmlPathContent(
+                $xmlDoc,
+                '/FileServerResponse/File/StoredName'
+            );
+            $StoredSize  = $this->xmlPathContent(
+                $xmlDoc,
+                '/FileServerResponse/File/StoredSize'
+            );
+            $MediaType   = $this->xmlPathContent(
+                $xmlDoc,
+                '/FileServerResponse/File/MediaType'
+            );
+            return $Message;
+        }
+    }
+
+    //  }}}
+    //  {{{ imageUpload()
+
+    /**
+     * imageUpload
+     *
+     * Upload image to server
+     *
+     * @param string $name Form field name of image
+     *
+     * @return string Image name
+     * @access public
+     */
+    function imageUpload($name)
+    {
+        $fileType = null;
+        if (preg_match("/^http/", $name)) {
+            $fileType = 'URL';
+        } elseif (is_array($_FILES[$name])) {
+            $fileType = 'Upload';
+        }
+        if ($fileType) {
+            $request = $this->buildImageServerXML($name, $fileType);
+            $ch      = curl_init();
+            if ($fileType == "URL") {
+                $fileData = array(
+                    'request' => $request
+                    );
+            } else {
+                $fileData = array(
+                    'request'          => $request,
+                    'file_upload'      => '@'.$_FILES[$name]['tmp_name'],
+                    'file_upload_name' => $_FILES[$name]['name']
+                    );
+            }
+            $curlOptions = array(
+                    CURLOPT_URL            => IS_SUBMIT_URL,
+                    CURLOPT_HEADER         => 0,
+                    CURLOPT_RETURNTRANSFER => 1,
+                    CURLOPT_POSTFIELDS     => $fileData
+                    );
+            curl_setopt_array($ch, $curlOptions);
+
+            $response = curl_exec($ch);
+            curl_close($ch);
+            $xmlDoc   = new DOMDocument;
+            $response = str_replace('<?xml version="1.0"?' . '>', '', $response);
+            $xmlDoc->loadXML($response);
+            $SuccessCode = $this->xmlPathContent(
+                $xmlDoc,
+                '/FileServerResponse/ReplyStatus/SuccessCode'
+            );
+            $Message     = $this->xmlPathContent(
+                $xmlDoc,
+                '/FileServerResponse/ReplyStatus/Message'
+            );
+            $Owner       = $this->xmlPathContent(
+                $xmlDoc,
+                '/FileServerResponse/File/Owner'
+            );
+            $StoredName  = $this->xmlPathContent(
+                $xmlDoc,
+                '/FileServerResponse/File/StoredName'
+            );
+            $StoredSize  = $this->xmlPathContent(
+                $xmlDoc,
+                '/FileServerResponse/File/StoredSize'
+            );
+            $MediaType   = $this->xmlPathContent(
+                $xmlDoc,
+                '/FileServerResponse/File/MediaType'
+            );
+            if ($SuccessCode != 0) {
+                //throw new Exception('Image Server Error said:'.$response);
+                throw new PEAR_Exception('Image Server Error said:'.$response);
+                exit;
+            }
+            return $StoredName;
+        }
+    }
+
+    // }}}
+
+    //  {{{ getImageSize()
+
+    /**
+     * getImageSize
+     *
+     * Return image data on an image from image server
+     *
+     * @param string $image Full URI to image
+     *                      http://is0/userId/imageStyle/imageName
+     *                      Must be a full URI including an authority.
+     *                      No relative URIs, the // are mandatory
+     *
+     * @return array Image data 0 => width, 1 => height, 2 => html
+     * @access public
+     * @throws PEAR Error
+     */
+    function getImageSize($image)
+    {
+        $options = array('allowed_schemes' => array('http','https'));
+        if (!Validate::uri($image, $options)) {
+            throw new PEAR_Exception('Invalid URI for the image');
+            exit;
+        }
+
+        $ch          = curl_init();
+        $curlOptions = array(
+            CURLOPT_URL            => "{$image}/info",
+            CURLOPT_HEADER         => 0,
+            CURLOPT_RETURNTRANSFER => 1,
+//            CURLOPT_POSTFIELDS     => $fileData
+        );
+        curl_setopt_array($ch, $curlOptions);
+
+        $response = curl_exec($ch);
+        curl_close($ch);
+        $wPattern = "/<width>(.*)<\/width>/";
+        preg_match($wPattern, $response, $matches);
+        $width    = $matches[1];
+        $hPattern = "/<height>(.*)<\/height>/";
+        preg_match($hPattern, $response, $matches);
+        $height = $matches[1];
+        $html   = "width=\"{$width}\" height=\"{$height}\"";
+        return array($width, $height, $html);
+    }
+
+    //  }}}
+
+    // {{{  xmlPathContent()
+
+    /**
+     * xmlPathContent
+     *
+     * Grab the content given XPath Query
+     *
+     * @param unknown $dom     DOMDocument nodelist
+     * @param unknown $content query for XPath
+     *
+     * @return object string of node
+     * @access public
+     */
+    function xmlPathContent($dom, $content)
+    {
+        $xPath    = new DOMXPath($dom);
+        $nodelist = $xPath->query($content);
+        foreach ($nodelist as $entry) {
+            return $entry->nodeValue;
+        }
+    }
+
+    // }}}
+}
diff --git a/classes/merchant_solutions.inc b/classes/merchant_solutions.inc
new file mode 100644 (file)
index 0000000..3e6f85d
--- /dev/null
@@ -0,0 +1,269 @@
+<?php
+/**
+ * Merchant Solutions Payment Gateway Integration
+ *
+ * PHP version 5
+ *
+ * @category Utilities
+ * @package  Utilities
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  SVN: $Id: merchant_solutions.php,v 1.0 2011/08/28 14:00:00 cscott Exp $
+ */
+
+define( "MS_WSDL", "https://trans.merchantsolution.com/Web/services/TransactionService?wsdl" );
+
+/**
+ * Merchant Solutions Payment Gateway class
+ *
+ * PHP version 5
+ */
+
+class MerchantSolutionsPaymentGateway
+{
+    /**
+     * Request Object
+     *
+     * @var    $request
+     * @access public
+     */
+    public $request = false;
+    /**
+     * Communications Success flag
+     *
+     * @var    $success
+     * @access public
+     */
+    public $success = false;
+    /**
+     * Transaction Result
+     *
+     * @var    $success
+     * @access public
+     */
+    public $result = false;
+    /**
+     * Description of transaction results
+     *
+     * @var    $resultDescription
+     * @access public
+     */
+     public $resultDescription = false;
+    /**
+     * Raw response data
+     *
+     * @var    $response
+     * @access public
+     */
+    public $response = false;
+    /**
+     * Detailed approval data
+     *
+     * @var    $approval
+     * @access public
+     */
+    public $approval = false;
+    /**
+     * Reason card was declined
+     *
+     * @var    $declineReason
+     * @access public
+     */
+    public $declineReason = '';
+    /**
+     * XML Soap Client Object
+     *
+     * @var    $client
+     * @access public
+     */
+    public $client;
+
+    /**
+     * Request Objects
+     *
+     * @access public
+     */
+    public $CCSaleRequest = array(
+        'acctid' => false,             // Merchant account, use TEST0 for testing
+        'merchantpin' => false,        // Merchant PIN for access to API, Login to Merchant center, then "FRISK(TM) Management" and "Configure Options"
+        'amount' => false,
+        'ccnum' => false,
+        'expmon' => false,
+        'expyear' => false,
+        'ccname' => false,
+        'cardpresent' => 0,
+        'cardreaderpresent' => 0,
+        'cvv2' => false,
+       'encryptedreadertype' => 0,     // Now seems to be required but is not in CCSale specification
+       'conveniencefeeflag' => 0,      // Now seems to be required but is not in CCSale specification
+       'contactlessflag' => 0, // Now seems to be required but is not in CCSale specification
+        'accttype' => 1,                // 1=CC
+        'profileactiontype' => 2,       // 2=run a Sale for the amount requested
+        'manualrecurring' => 0,         // 0=Not Recurring
+        'avs_override' => 0,            // 0=Don't override Address Verification
+        'cvv2_override' => 0,           // 0=Don't override CVV2
+        'loadbalance_override' => 0,    // 0=Don't override Subid load balance
+        'duplicate_override' => 0,      // 0=Don't override duplicate transaction
+        'accountlookupflag' => 0,       // 0=Don't perform account lookup
+        'ci_memo' => ''                 // something that should be sent in the confirmation E-Mail from Merchant Solutions
+    );
+
+    /**
+     * Constructor
+     *
+     * @param object $d database connection
+     *
+     * @return boolean    Returns value of $success parameter
+     * @access public
+     */
+    function __construct($request)
+    {
+
+        // Determine which type of request and setup data array
+        switch ($request) {
+
+        case 'processCCSale':
+            $this->request = (object) $this->CCSaleRequest;
+            break;
+
+        default:
+            return false;
+            break;
+
+        }
+
+        // Setup options related to doing the SOAP calls
+        ini_set('soap.wsdl_cache_enabled', 1);
+        use_soap_error_handler(false);
+        $soapOptions = array(
+            "exceptions" => 1,
+            'connection_timeout' => 10
+        );
+
+        $this->resultDescription = '';
+
+        // Setup SOAP client and get WSDL for gateway
+        try {
+
+            // XDebug prevents catching fatal errors with the Soap calls
+            if (function_exists('xdebug_disable')) {
+                xdebug_disable();
+            }
+
+//            $this->resultDescription .= 'preSOAP ';
+
+            $this->client = @new SoapClient(MS_WSDL, $soapOptions);
+
+
+            $this->resultDescription .= 'postSOAP ';
+
+            if (function_exists('xdebug_enable')) {
+                xdebug_enable();
+            }
+
+//            $this->resultDescription .= 'SOAPdone ';
+
+            // Indicate setup OK
+            $this->success = true;
+            $this->resultDescription = 'Setup Successful (WSDL)';
+
+        } catch (SoapFault $exception) {
+
+//            $this->resultDescription .= 'SOAPfail ';
+
+            // Indicate setup failure
+            $this->success = false;
+            $this->resultDescription .= 'Communications Failure (WSDL): '.$this->client->getMessage();
+        }
+
+//        $this->resultDescription .= 'SOAPsetup '.($this->success==true?'Y':'N');
+
+        return $this->success;
+    }
+
+    /**
+     * Process CC Sale
+     *
+     * @return boolean    Returns value of $success parameter
+     */
+    function merchantSolutionsCCSale()
+    {
+        // Determine if we have good data supplied
+        $a = ($this->request->amount - 0);
+        if ($a == 0 || $a > 99999.99 ) {
+            $this->result = 'Invalid';
+            $this->resultDescription = 'Invalid Amount';
+        }
+        if (trim($this->request->ccnum) == '') {
+            $this->result = 'Invalid';
+            $this->resultDescription = 'Missing Card Number';
+        }
+        $m = ($this->request->expmon - 0);
+        if (!is_int($m) || $m < 1 || $m > 12) {
+            $this->result = 'Invalid';
+            $this->resultDescription = 'Invalid Expiration Month';
+        }
+        $y = ($this->request->expyear - 0);
+        if (!is_int($y) || $y < 2000 || $y > 2100) {
+            $this->result = 'Invalid';
+            $this->resultDescription = 'Invalid Expiration Year';
+        }
+        if (trim($this->request->ccname) == '') {
+            $this->result = 'Invalid';
+            $this->resultDescription = 'Missing Name on Card';
+        }
+        if ($this->result == 'Invalid') {
+            return true;
+        }
+
+        // Try to process the transaction
+        try {
+
+            // Send Request
+            if (function_exists('xdebug_disable')) {
+                xdebug_disable();
+            }
+            $this->response = $this->client->processCCSale($this->request);
+            if (function_exists('xdebug_enable')) {
+                xdebug_enable();
+            }
+
+            // Get request result (Approved/Declined)
+            $this->success = true;
+            $this->result = $this->response->status;
+            $this->resultDescription = $this->response->result;
+
+            // If Declined, say why
+            if ($this->result == 'Declined') {
+
+                $x = explode(":", $this->response->result);
+                $this->declineReason = $x[2];
+
+            // Must be Approved, get approval data
+            } else {
+
+                $this->success = true;
+                $this->approval->auth = $this->response->authcode;
+                $this->approval->transTime = $this->response->transdate;
+                $this->approval->cardType = $this->response->paytype;
+
+                $this->resultDescription = $this->response->status;
+            }
+
+        // If there's a communications failure
+        } catch (SoapFault $exception) {
+
+// if ($this->request->ccnum == '5454545454545454') {
+//     echo "<pre>".print_r($exception,1)."</pre>";
+// }
+            $this->success = false;
+            $this->resultDescription = 'Communications Failure';
+
+        }
+
+        return $this->success;
+    }
+
+}
+
+?>
diff --git a/classes/merchant_solutions.inc.SAVE b/classes/merchant_solutions.inc.SAVE
new file mode 100644 (file)
index 0000000..8d022b3
--- /dev/null
@@ -0,0 +1,268 @@
+<?php
+/**
+ * Merchant Solutions Payment Gateway Integration
+ *
+ * PHP version 5
+ *
+ * @category Utilities
+ * @package  Utilities
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  SVN: $Id: merchant_solutions.php,v 1.0 2011/08/28 14:00:00 cscott Exp $
+ */
+
+define( "MS_WSDL", "https://trans.merchantsolution.com/Web/services/TransactionService?wsdl" );
+
+/**
+ * Merchant Solutions Payment Gateway class
+ *
+ * PHP version 5
+ */
+
+class MerchantSolutionsPaymentGateway
+{
+    /**
+     * Request Object
+     *
+     * @var    $request
+     * @access public
+     */
+    public $request = false;
+    /**
+     * Communications Success flag
+     *
+     * @var    $success
+     * @access public
+     */
+    public $success = false;
+    /**
+     * Transaction Result
+     *
+     * @var    $success
+     * @access public
+     */
+    public $result = false;
+    /**
+     * Description of transaction results
+     *
+     * @var    $resultDescription
+     * @access public
+     */
+     public $resultDescription = false;
+    /**
+     * Raw response data
+     *
+     * @var    $response
+     * @access public
+     */
+    public $response = false;
+    /**
+     * Detailed approval data
+     *
+     * @var    $approval
+     * @access public
+     */
+    public $approval = false;
+    /**
+     * Reason card was declined
+     *
+     * @var    $declineReason
+     * @access public
+     */
+    public $declineReason = '';
+    /**
+     * XML Soap Client Object
+     *
+     * @var    $client
+     * @access public
+     */
+    public $client;
+
+    /**
+     * Request Objects
+     *
+     * @access public
+     */
+    public $CCSaleRequest = array(
+        'acctid' => false,             // Merchant account, use TEST0 for testing
+        'merchantpin' => false,        // Merchant PIN for access to API, Login to Merchant center, then "FRISK(TM) Management" and "Configure Options"
+        'amount' => false,
+        'ccnum' => false,
+        'expmon' => false,
+        'expyear' => false,
+        'ccname' => false,
+        'cardpresent' => 0,
+        'cardreaderpresent' => 0,
+        'cvv2' => false,
+       'encryptedreadertype' => 0,     // Now seems to be required but is not in CCSale specification
+       'conveniencefeeflag' => 0,      // Now seems to be required but is not in CCSale specification
+        'accttype' => 1,                // 1=CC
+        'profileactiontype' => 2,       // 2=run a Sale for the amount requested
+        'manualrecurring' => 0,         // 0=Not Recurring
+        'avs_override' => 0,            // 0=Don't override Address Verification
+        'cvv2_override' => 0,           // 0=Don't override CVV2
+        'loadbalance_override' => 0,    // 0=Don't override Subid load balance
+        'duplicate_override' => 0,      // 0=Don't override duplicate transaction
+        'accountlookupflag' => 0,       // 0=Don't perform account lookup
+        'ci_memo' => ''                 // something that should be sent in the confirmation E-Mail from Merchant Solutions
+    );
+
+    /**
+     * Constructor
+     *
+     * @param object $d database connection
+     *
+     * @return boolean    Returns value of $success parameter
+     * @access public
+     */
+    function __construct($request)
+    {
+
+        // Determine which type of request and setup data array
+        switch ($request) {
+
+        case 'processCCSale':
+            $this->request = (object) $this->CCSaleRequest;
+            break;
+
+        default:
+            return false;
+            break;
+
+        }
+
+        // Setup options related to doing the SOAP calls
+        ini_set('soap.wsdl_cache_enabled', 1);
+        use_soap_error_handler(false);
+        $soapOptions = array(
+            "exceptions" => 1,
+            'connection_timeout' => 10
+        );
+
+        $this->resultDescription = '';
+
+        // Setup SOAP client and get WSDL for gateway
+        try {
+
+            // XDebug prevents catching fatal errors with the Soap calls
+            if (function_exists('xdebug_disable')) {
+                xdebug_disable();
+            }
+
+//            $this->resultDescription .= 'preSOAP ';
+
+            $this->client = @new SoapClient(MS_WSDL, $soapOptions);
+
+
+            $this->resultDescription .= 'postSOAP ';
+
+            if (function_exists('xdebug_enable')) {
+                xdebug_enable();
+            }
+
+//            $this->resultDescription .= 'SOAPdone ';
+
+            // Indicate setup OK
+            $this->success = true;
+            $this->resultDescription = 'Setup Successful (WSDL)';
+
+        } catch (SoapFault $exception) {
+
+//            $this->resultDescription .= 'SOAPfail ';
+
+            // Indicate setup failure
+            $this->success = false;
+            $this->resultDescription .= 'Communications Failure (WSDL): '.$this->client->getMessage();
+        }
+
+//        $this->resultDescription .= 'SOAPsetup '.($this->success==true?'Y':'N');
+
+        return $this->success;
+    }
+
+    /**
+     * Process CC Sale
+     *
+     * @return boolean    Returns value of $success parameter
+     */
+    function merchantSolutionsCCSale()
+    {
+        // Determine if we have good data supplied
+        $a = ($this->request->amount - 0);
+        if ($a == 0 || $a > 99999.99 ) {
+            $this->result = 'Invalid';
+            $this->resultDescription = 'Invalid Amount';
+        }
+        if (trim($this->request->ccnum) == '') {
+            $this->result = 'Invalid';
+            $this->resultDescription = 'Missing Card Number';
+        }
+        $m = ($this->request->expmon - 0);
+        if (!is_int($m) || $m < 1 || $m > 12) {
+            $this->result = 'Invalid';
+            $this->resultDescription = 'Invalid Expiration Month';
+        }
+        $y = ($this->request->expyear - 0);
+        if (!is_int($y) || $y < 2000 || $y > 2100) {
+            $this->result = 'Invalid';
+            $this->resultDescription = 'Invalid Expiration Year';
+        }
+        if (trim($this->request->ccname) == '') {
+            $this->result = 'Invalid';
+            $this->resultDescription = 'Missing Name on Card';
+        }
+        if ($this->result == 'Invalid') {
+            return true;
+        }
+
+        // Try to process the transaction
+        try {
+
+            // Send Request
+            if (function_exists('xdebug_disable')) {
+                xdebug_disable();
+            }
+            $this->response = $this->client->processCCSale($this->request);
+            if (function_exists('xdebug_enable')) {
+                xdebug_enable();
+            }
+
+            // Get request result (Approved/Declined)
+            $this->success = true;
+            $this->result = $this->response->status;
+            $this->resultDescription = $this->response->result;
+
+            // If Declined, say why
+            if ($this->result == 'Declined') {
+
+                $x = explode(":", $this->response->result);
+                $this->declineReason = $x[2];
+
+            // Must be Approved, get approval data
+            } else {
+
+                $this->success = true;
+                $this->approval->auth = $this->response->authcode;
+                $this->approval->transTime = $this->response->transdate;
+                $this->approval->cardType = $this->response->paytype;
+
+                $this->resultDescription = $this->response->status;
+            }
+
+        // If there's a communications failure
+        } catch (SoapFault $exception) {
+
+// if ($this->request->ccnum == '5454545454545454') {
+//     echo "<pre>".print_r($exception,1)."</pre>";
+// }
+            $this->success = false;
+            $this->resultDescription = 'Communications Failure';
+
+        }
+
+        return $this->success;
+    }
+
+}
+
+?>
diff --git a/documentation/Conversion_from_V2.53_to_V3.txt b/documentation/Conversion_from_V2.53_to_V3.txt
new file mode 100644 (file)
index 0000000..5f1ec34
--- /dev/null
@@ -0,0 +1,188 @@
+Conversion instructions from V2.53 to V3
+----------------------------------------
+
+
+* Add the following settings to config/application.ini if not already there.
+       Place in rational locations.
+
+event_registration.organization_internal_email = "owner_internal_email"
+event_registration.organization_from_email = "owner_from_email"
+
+event_registration.word.contact_fname => "First Name"
+event_registration.word.contact_lname => "Last Name"
+event_registration.word.contact_addr1 => "Address"
+event_registration.word.contact_addr2 => " " 
+event_registration.word.contact_city => "City"
+event_registration.word.contact_state => "State"
+event_registration.word.contact_zip => "ZIP/Postal Code"
+event_registration.word.contact_country => "Country"
+event_registration.word.contact_phone => "Phone"
+event_registration.word.contact_fax => "FAX"
+event_registration.default = Off
+event_registration.show_instructor_in_event_lists = Off
+event_registration.show_instructor_in_event_detail = Off
+event_registration.word.instructor = "instructor"
+event_registration.word.instructors = "instructors"
+event_registration.select_by_picklists = On
+event_registration.word.category = "Category"
+event_registration.word.categories = "Categories"
+event_registration.word.sub_category = "Sub Category"
+event_registration.word.sub_categories = "Sub Categories"
+event_registration.show_contact_data = Off
+event_registration.custom_stylesheet = On
+event_registration.titles.registration_button = "Book Tour"
+; Whether to show rates in lists of events - If on, specify type for displaying ("detail" = detailed, "from" = "From: {lowest cost}")
+event_registration.show_rates_in_event_lists = On
+event_registration.show_rates_type = "from"
+event_registration.word.attribute = "type"
+event_registration.word.attributes = "types"
+event_registration.attributes = On
+; -- Billing fields to ignore when no payment is required (free registration)
+event_registration.free_use_fname = On
+event_registration.free_use_lname = On
+event_registration.free_use_addr1 = On
+event_registration.free_use_addr2 = On
+event_registration.free_use_city_state = On
+event_registration.free_use_country = On
+event_registration.free_use_zip = On
+event_registration.free_use_phone = On
+event_registration.free_use_fax = On
+; -- Contact fields and terms - leave a term empty (no spaces) to not use that field in forms and reports
+; NOTE that city, state, zip, and country fields must either be all used or all off! No prompt will used for output for these fields.
+event_registration.show_contact_data = On
+event_registration.show_same_button = Off
+event_registration.titles.contact_information = "Contact"
+event_registration.prompt.contact_fname = "First Name"
+event_registration.required.contact_fname = On
+event_registration.prompt.contact_lname = "Last Name"
+event_registration.required.contact_lname = On
+event_registration.prompt.contact_addr1 = "Address"
+event_registration.required.contact_addr1 = On
+event_registration.prompt.contact_addr2 = "" 
+event_registration.required.contact_addr2 = Off
+event_registration.prompt.contact_city = "City"
+event_registration.required.contact_city = Off
+event_registration.prompt.contact_state = "State"
+event_registration.required.contact_state = Off
+event_registration.prompt.contact_zip = "ZIP"
+event_registration.required.contact_zip = Off
+event_registration.prompt.contact_country = "Country"
+event_registration.required.contact_country = Off
+event_registration.prompt.contact_phone = "Phone"
+event_registration.required.contact_phone = On
+event_registration.prompt.contact_fax = "FAX"
+event_registration.required.contact_fax = Off
+
+* Also check these
+
+; status is comma-separated list of (UNPAID, CC_PEND, CC_PAID, CC_DECL, CHECK_PEND, CHECK_PAID, COMP, AT_EVENT, CASH_PAID, NO_CHARGE, OTHER_ADMIN, FAILED, CANCELED)
+event_registration.admin_opt.Submissions.status = "UNPAID, CC_PEND, CC_PAID, CHECK_PEND, CHECK_PAID, AT_EVENT, COMP, CASH_PAID, NO_CHARGE, OTHER_ADMIN"
+
+
+* Check the following new fields and tables and add as required
+
+- misc
+       alter table misc add notify_subject text;
+               update misc set notify_subject = 'Instructor E-Mail Subject';
+       alter table misc add notify_text text;
+               update misc set notify_text = 'Instructor E-Mail Body';
+       alter table misc add req_ack_subject text;
+               update misc set req_ack_subject = 'Registration Acknowledgement E-Mail Subject';
+       alter table misc add req_ack_text text;
+               update misc set req_ack_text = 'Registration Acknowledgement E-Mail Body';
+
+- category
+       alter table category add column list_name text;
+       update category set list_name = '';
+       
+- todo
+    alter table todo add column restricted bool;
+       
+- reg
+       alter table reg add column require_registered_user boolean;
+               update reg set require_registered_user = false;
+       alter table reg add column duration text;
+               update reg set duration = '';
+    alter table reg add column category integer;
+       alter table reg add column todo integer;
+       alter table reg add column ask_date bool;
+               update reg set ask_date = 'f';
+       alter table reg add column attribute integer;
+       alter table reg add column use_calendar boolean;
+               update reg set use_calendar = 'f';
+       alter table reg add column date_select text;
+               update reg set date_select = '';
+       ALTER TABLE reg ADD COLUMN restrict_comp_code boolean;
+       ALTER TABLE reg ADD COLUMN restrict_check boolean;
+       ALTER TABLE reg ADD COLUMN restrict_cash boolean;
+       ALTER TABLE reg ADD COLUMN restrict_credit_card boolean;
+               UPDATE reg SET restrict_comp_code = 'f', restrict_check = 'f', restrict_cash = 'f', restrict_credit_card = 'f';
+       ALTER TABLE reg add column attendee_max_per_sub integer;
+               update reg set attendee_max_per_sub = 0;        
+       
+       Only do the following if there were no categoies or sub-categories
+       update reg set todo = 1;
+    update reg set category = 1;
+       update category set todo = 1;
+       
+       
+- reg_req
+       Alter table reg_req add column contact_same boolean;
+               update reg_req set contact_same = 'f';
+       Alter table reg_req add column contact_fname text;
+       Alter table reg_req add column contact_lname text;
+       Alter table reg_req add column contact_org text;
+       Alter table reg_req add column contact_title text;
+       Alter table reg_req add column contact_addr1 text;
+       Alter table reg_req add column contact_addr2 text;
+       Alter table reg_req add column contact_city text;
+       Alter table reg_req add column contact_state text;
+       Alter table reg_req add column contact_zip text;
+       Alter table reg_req add column contact_country text;
+       Alter table reg_req add column contact_phone text;
+       Alter table reg_req add column contact_fax text;
+       
+               
+- reg_detail
+       alter table reg_detail add column desired_date date;    
+       
+- attribute
+
+       CREATE TABLE registrations.attribute (
+           id SERIAL,
+           name text,
+           descr text,
+           sort integer
+       );
+       
+       ALTER TABLE registrations.attribute OWNER TO postgres;
+       ALTER TABLE registrations.attribute_id_seq OWNER TO postgres;
+       REVOKE ALL ON TABLE registrations.attribute FROM PUBLIC;
+       REVOKE ALL ON TABLE registrations.attribute FROM postgres;
+       GRANT ALL ON TABLE registrations.attribute TO postgres;
+       GRANT ALL ON TABLE registrations.attribute TO nobody;
+       REVOKE ALL ON TABLE registrations.attribute_id_seq FROM PUBLIC;
+       REVOKE ALL ON TABLE registrations.attribute_id_seq FROM postgres;
+       GRANT ALL ON TABLE registrations.attribute_id_seq TO postgres;
+       GRANT ALL ON TABLE registrations.attribute_id_seq TO nobody;    
+               
+- reg_attr
+       CREATE TABLE registrations.reg_attr (
+               id SERIAL,
+               reg integer,
+               attr integer
+       );
+       
+       ALTER TABLE registrations.reg_attr OWNER TO postgres;
+       ALTER TABLE registrations.reg_attr_id_seq OWNER TO postgres;
+       REVOKE ALL ON TABLE registrations.reg_attr FROM PUBLIC;
+       REVOKE ALL ON TABLE registrations.reg_attr FROM postgres;
+       GRANT ALL ON TABLE registrations.reg_attr TO postgres;
+       GRANT ALL ON TABLE registrations.reg_attr TO nobody;
+       REVOKE ALL ON TABLE registrations.reg_attr_id_seq FROM PUBLIC;
+       REVOKE ALL ON TABLE registrations.reg_attr_id_seq FROM postgres;
+       GRANT ALL ON TABLE registrations.reg_attr_id_seq TO postgres;
+       GRANT ALL ON TABLE registrations.reg_attr_id_seq TO nobody;
+       
+
+               
\ No newline at end of file
diff --git a/documentation/Feature_Requests_and_Pending_Fixes.txt b/documentation/Feature_Requests_and_Pending_Fixes.txt
new file mode 100644 (file)
index 0000000..f94b477
--- /dev/null
@@ -0,0 +1,108 @@
+Current Work
+------------
+
+Feature Requests
+----------------
+
+* Consider adding the ability to have custom forms that can be used for each attendee (could replace the medical info option). Would
+       need to be able to edit this information when doing the [Edit Registrant] option in the submissions. 
+
+* Add option to have reports print each attendee (student) on a separate page when using the "Report by:" "Registrants" option.
+
+* Send notices to registrants of events they have registered for comeing up in some amount of days.
+
+* search by keyword or text
+
+* Ability to prints attendee reports with one attendee per page including the form data.
+
+** Figure out how to determine if there's nothing to list (categories, sub-cats, events) and produce message on Step0 or 1
+
+* Look at adding ability to have Merchant Solutions transaction E-Mail messages include more information about the registration (person, event, etc) and more text.
+* When credit card is processed, store flag in session to prevent multiple submissions in case submission isn't successfully stored.
+* Consider moving form-data to database entries rather than serialized array.
+
+
+For UC
+* Fix problem where clicking column header in [Submissions] reverts status selection.
+* Request to have option for rates and prices to show up in lists of events.
+* Permit various text terms to be defined by category and possibly by event
+* Try to add costs for registrants of classes in reporting by Activity and Registrant. May be difficult due to base and per-attendee amounts.
+
+For myig.org
+
+* Customer request for admin section
+       1. On the submissions page.  Currently we can sort by registration number, submitted, First name, 
+       last name, company/organization, and status.  Since our registrants don't write info in the 
+       "company/organization" field we do not use this and it appears as empty.  What would be extremely 
+       useful is to be able to sort by "School or YMCA" instead.
+
+       2. On the reports page.  In the drop down box Report By: we'd like to have "School or YMCA" as one 
+       of the drop down options.
+               My comment
+       I won't be able to put "School or YMCA" into that pick list. What I'm thinking is that if you select 
+       a specific activity at the top for the report, that it will detect that and add an option in the 
+       "Report by:" pick list that would be "Sort by form field". It would then display another pick list 
+       that has the form fields (ones that can rationally be used for sorting) for you to select.
+       
+       3. Export to Excel.  When the report appears as an export into Excel we could use your help too.  
+       The fields appear on the top line for columns A thru X, but after column X  the fields create a 
+       double line appearing in each registrant's submitted information.  This means we can not sort our 
+       excel file after column X.  Could you fix this?  We'd like all the fields to be represented along 
+       the top line of the excel export, and only the registrant's submitted info to appear after their name.
+       
+       Consider only permitting form data when one event is selected for the report.
+       
+* Add ability for owner to edit text for confirmation E-Mail and check on doing the same for E-Mails
+  to users from the admin page.
+* Add ability to display all form fields in all sub-forms in reports, not just in selected sub-forms
+* Add ability to detect if a single form is being included in a report and to produce a common header for form data.
+* Look for anywhere that boolean values are output and make them standard so we don't have some 'Yes' and some 't'. 
+       Consider making that the yes/no values configurable to be what the customer wants them to be.
+
+General
+* Purge rest of references to Bay View or others.
+* Fix checkout E-Mails to site owner and to contact addresses in each event on checkout.
+* Don't show "Continue to Selecting Classes" when category or events are already showing on the page. 
+* Make it possible to use multi-select for the Status pick-list when reporting.
+       Default that to all except canceled or submission failed.
+* Add rate class information to reporting
+* Use customer configured term rather than "Activity" and "Registration" in report selection.
+* Add ability to enter a class code rather than using the select list in reports.
+* Add ability to return to the current report selection screen with same settings from a report.
+* Ability to delete registration requests in customer admin area
+       Requests must be canceled or failed submissions to be deleted.
+* Notices to customer and users. 
+       - Certain payment not received notices and warnings
+       - Event reminder notices to registrants
+       - E-Mail blasts to event registrants 
+               -- Possible attached or referenced file
+* How did you hear about us data collected during checkout
+       - Optionally required
+
+
+Pending Bug Fixes
+-----------------
+
+* See if there's a way to determine rate class on previous requests
+
+* Reported MagicForm field problems
+       Hi John,
+       We're testing the forms, and so far we have found a couple of issues on
+       the first two we've tried:
+       1. Existing System Evaluations (both forms): If you don't fill in a
+       field and you have to go back, the Are the Test Holes Dug and the Is
+       this Waterfront property questions come up with a duplicate field for
+       both the If no... and the What is the body of water questions.
+       2. Existing System Evaluations (both forms): If you don't fill in all
+       the fields and you have to go back, you get an error message telling you
+       to upload the site plan, even though you've already identified it on
+       your hard drive and it appears in the box.
+       Wendi Wright
+       Publishing Specialist
+       Health Department of Northwest Michigan
+       220 W. Garfield Ave.
+       Charlevoix, MI 49720
+       (231) 547-7610
+       www.nwhealth.org <http://www.nwhealth.org/>
+       
+
diff --git a/documentation/Install.txt b/documentation/Install.txt
new file mode 100644 (file)
index 0000000..6c5cd7c
--- /dev/null
@@ -0,0 +1,371 @@
+Installation Considerations
+---------------------------
+
+*** USE PROCEEDURES IN WIKI - UPDATE THEM AS NECESSARY ***
+
+
+View File Replacements
+       Create /Toolkit/Registrations/View/front-end directory in customer's Web site.
+       Place any view files that you want to replace in that directory and they will be used instead of the corresponding default view file.
+       DO NOT modify the View files in the common application directories.
+       
+CSS File Replacement
+       Create /Toolkit/Registrations/View/front-end directory in customer's Web site.
+       Place a copy of the style.css file from app.gaslightmedia.com/Common/Registrations_V3/front-end/Views in that directory.
+       Modify that copy of the style.css file as desired. 
+       DO NOT modify the css files in the common application directories.
+       
+CSS Style Override
+       Create /Toolkit/Registrations/View/front-end directory in customer's Web site.
+       Create a file called "override.css" in that directory.
+       Add any new style information there. 
+       You may specify a tag, class, or ID in the common app style.css file and include here any elements of it that you would like to override.
+       CSS specifications in the override.css file will replace those in the common app style.css file.  
+       
+       
+Installation instructions for this application
+----------------------------------------------
+
+*   Add a "Registrations" page to the toolbox somewhere.
+
+*   Copy static_page.phtml from documentation directory to Web site's static directory and name it with ID of Registrations page.
+
+*   Add to /config/application.ini - values are examples only
+
+; -- Common Registrations Application - V3 --
+; Turn the event registration application On or Off
+event_registration.application = On
+; Customer Information
+event_registration.organization = "France Tours and Guides "
+event_registration.organization_short = "France Journeys"
+event_registration.organization_address = "12381 Fenton Road"
+event_registration.organization_city = "Fenton"
+event_registration.organization_state = "MI"
+event_registration.organization_zip = "48430"
+event_registration.organization_phone = "810-714-3803"
+event_registration.organization_toll_free = ""
+event_registration.organization_internal_email = "reservations@francetoursandguides.com"
+event_registration.organization_from_email = "reservations@francetoursandguides.com"
+; General Setup
+event_registration.copyright_start = 2010
+event_registration.event_page = 12
+; Text used with catid in URLs
+event_registration.link_name = "registrations"
+event_registration.have_members = Off
+event_registration.registered_users = Off
+event_registration.medical_info = On
+event_registration.save_contacts = On
+; Event Selection Process - Default is standard selection process
+event_registration.default = On
+event_registration.select_by_month = Off
+event_registration.select_by_code = Off
+event_registration.select_by_picklists = Off
+event_registration.show_past_events = Off
+; If On causes all past events to be set to Active off when listing events in admin section
+event_registration.auto_inactive = Off
+event_registration.categories_on_intro_page = On
+; If main categories are off then sub_categories are not used
+event_registration.main_categories = On
+event_registration.show_empty_categories = Off
+event_registration.sub_categories = Off
+event_registration.show_empty_sub_categories = Off
+event_registration.attributes = On
+; Some output configuration items
+event_registration.show_search_result_as_title = On
+; Show event detail in search results?
+event_registration.show_event_detail_in_search_results = Off
+; Other items that we may or may not what to show
+event_registration.display_only_mode = Off
+event_registration.include_events_in_category_list = Off
+event_registration.show_event_codes = On
+event_registration.show_instructor_in_event_lists = Off
+event_registration.show_instructor_in_event_detail = Off
+event_registration.show_event_terms_in_event_detail = On
+event_registration.show_cutoff_dates = Off
+; Whether to show rates in lists of events - If on, specify type for displaying ("detail" = detailed, "from" = "From: {lowest cost}")
+event_registration.show_rates_in_event_lists = On
+event_registration.show_rates_type = "from"
+; Selection of View/Template locations - Custom view and css files located in virtual server at /Toolkit/Registrations/Views
+event_registration.custom_view_files = On
+event_registration.custom_stylesheet = On
+; Permitted methods of payment - Must be one of the following "Yes", "No", or "Restricted" (admin users only)
+event_registration.payment_methods.comp_code = "Restricted"
+event_registration.payment_methods.check = "Yes"
+event_registration.payment_methods.cash = "Restricted"
+event_registration.payment_methods.credit_card = "Yes"
+event_registration.payment_methods.call_from_merchant = "Yes"
+; Accepts Credit Cards bitmap (add up selected) where: Visa = 1, MasterCard = 2, American Express = 4, Discover = 8, Diners Club = 16
+event_registration.cc_accepts = 7
+; Credit Card Processing selection where: By merchant = 1, Authorize.net = 2, Merchant Solutions = 3
+event_registration.proc_method = 1
+; Authorize.net integration
+; test: LOCAL_TEST, LOCAL_FAIL, TRUE, FALSE (Must be FALSE for production)
+; conf: Set to TRUE to have Authorize.net send a confirmation E-Mail to the user.
+event_registration.authorize_net.login = ""
+event_registration.authorize_net.key = ""
+event_registration.authorize_net.test = "TRUE"
+event_registration.authorize_net.conf = "TRUE"
+event_registration.authorize_net.merchant_email = ""
+; Merchant Solutions integration
+event_registration.merchant_solutions.acctid = ""
+event_registration.merchant_solutions.merchantpin = ""
+; Items to show in E-Mail notification to instructors
+event_registration.instr_notification.billing_info = Off
+event_registration.instr_notification.email = On
+event_registration.instr_notification.phone = On
+event_registration.instr_notification.duration = On
+event_registration.instr_notification.short_descr = On
+event_registration.instr_notification.contact_fname = On
+event_registration.instr_notification.contact_lname = On
+event_registration.instr_notification.contact_addr1 = Off
+event_registration.instr_notification.contact_addr2 = On
+event_registration.instr_notification.contact_city = On
+event_registration.instr_notification.contact_phone = On
+event_registration.instr_notification.contact_fax = On
+; Text Configurations
+event_registration.title = "Event Registration"
+event_registration.word.category = "region"
+event_registration.word.categories = "regions"
+event_registration.word.sub_category = "city"
+event_registration.word.sub_categories = "cities"
+event_registration.word.attribute = "type"
+event_registration.word.attributes = "types"
+event_registration.word.event = "tour"
+event_registration.word.events = "tours"
+event_registration.word.registration = "registration"
+event_registration.word.registrations = "registrations"
+event_registration.word.register = "register"
+event_registration.word.registering = "registering"
+event_registration.word.registered = "registered"
+event_registration.word.attendee = "traveler"
+event_registration.word.attendees = "travelers"
+event_registration.word.attending = "traveling"
+event_registration.word.attended = "traveled"
+event_registration.word.member = "member"
+event_registration.word.members = "members"
+event_registration.word.user_id = "user ID"
+event_registration.word.password = "password"
+event_registration.word.instructor = "tour operator"
+event_registration.word.instructors = "tour operators"
+event_registration.titles.use_payment_comp_code = "Use Payment Comp Code"
+event_registration.titles.payment_comp_code = "Payment Comp Code"
+event_registration.titles.send_a_check = "Send a Check"
+event_registration.titles.call_from_merchant = "We will call you to complete your tour order."
+event_registration.titles.paid_cash = "Paid Cash"
+event_registration.titles.pay_by_credit_card = "Pay by Credit Card"
+event_registration.titles.registration_button = "Book Tour"
+; -- Billing fields required for each payment type
+; -- Use comma separated list using: "fname, lname, addr1, addr2, city, state, country, zip, phone, fax"
+event_registration.use_full_billing_info_at_top = Yes
+; if use_full_billing_info_at_top = No
+event_registration.bill_info_req.comp_code = "fname, lname, phone"
+event_registration.bill_info_req.check = "fname, lname, phone"
+event_registration.bill_info_req.cash = "fname, lname, phone"
+event_registration.bill_info_req.credit_card = "fname, lname, addr1, addr2, city, state, country, zip, phone, fax"  
+; -- Billing fields to ignore when no payment is required (free registration)
+event_registration.free_use_fname = On
+event_registration.free_use_lname = On
+event_registration.free_use_addr1 = On
+event_registration.free_use_addr2 = On
+event_registration.free_use_city = On
+event_registration.free_use_state = On
+event_registration.free_use_country = On
+event_registration.free_use_zip = On
+event_registration.free_use_phone = On
+event_registration.free_use_fax = On
+; Contact fields and terms - leave a term empty (no spaces) to not use that field in forms and reports
+; NOTE that city, state, zip, and country fields must either be all used or all off! No prompt will used for output for these fields.
+event_registration.show_contact_data = On
+event_registration.show_same_button = Off
+event_registration.titles.contact_information = "Lead Contact for this tour"
+event_registration.prompt.contact_fname = "First Name"
+event_registration.required.contact_fname = On
+event_registration.prompt.contact_lname = "Last Name"
+event_registration.required.contact_lname = On
+event_registration.prompt.contact_addr1 = "Email Address while traveling"
+event_registration.required.contact_addr1 = On
+event_registration.prompt.contact_addr2 = ""
+event_registration.required.contact_addr2 = Off
+event_registration.prompt.contact_city = ""
+event_registration.required.contact_city = Off
+event_registration.prompt.contact_state = ""
+event_registration.required.contact_state = Off
+event_registration.prompt.contact_zip = ""
+event_registration.required.contact_zip = Off
+event_registration.prompt.contact_country = ""
+event_registration.required.contact_country = Off
+event_registration.prompt.contact_phone = "Contact Phone while traveling"
+event_registration.required.contact_phone = On
+event_registration.prompt.contact_fax = ""
+event_registration.required.contact_fax = Off
+; Admin Defaults
+; sort_field is field name to sort, sort_direction is either "Forward" or "Backward"
+event_registration.admin_opt.Submissions.sort_field = ""
+event_registration.admin_opt.Submissions.sort_direction = ""
+; status is comma-separated list of (UNPAID, CC_PEND, CC_PAID, CC_DECL, CHECK_PEND, CHECK_PAID, COMP, AT_EVENT, CASH_PAID, NO_CHARGE, OTHER_ADMIN, FAILED, CANCELED)
+event_registration.admin_opt.Submissions.status = "UNPAID, CC_PEND, CC_PAID, CHECK_PEND, CHECK_PAID, AT_EVENT, COMP, CASH_PAID, NO_CHARGE, OTHER_ADMIN"
+;   Debug levels 0 to 3
+event_registration.debug = 0
+event_registration.debug_view = Off
+event_registration.debug_mail = Off
+event_registration.checkout_debug = Off
+
+    Add debug overrides to personal section of config file and adjust as needed
+    
+event_registration.debug = 0
+event_registration.debug_view = Off
+event_registration.debug_mail = Off
+event_registration.checkout_debug = Off
+
+*   Add to /setup.phtml
+
+        /**
+         *  Site has Event Registration?
+         */
+        define('EVENT_REGISTRATION', $applicationConfig->event_registration->application);
+        
+*   Create /admin/Registrations directory and copy Registrations.php from documentation directory into it. Rename to index.php
+
+*   Add to /admin/nav.phtml
+
+        if (defined('EVENT_REGISTRATION') && EVENT_REGISTRATION) {
+            $nav['Event Registration']         = 'admin/Registrations/';
+        }
+
+*   Add registration catid to "$securePagesArray = array({exisiting cat_id's},{registrations catid});" in setup.phtml
+
+*   Commit files to version control system
+
+        /static/??.phtml
+        /config/application.ini
+        /setup.phtml
+        /admin/Registrations
+        /admin/Registrations/index.php
+        /admin/nav.phtml
+
+*   Check that file/image server account is setup and configured
+
+    Look for file_server.owner_id in /config/server.ini
+    If no account is setup on is0 then add one and set configuration in server.ini
+    
+*   Update app.gaslightmedia.com/Common/Registrations_V3/documentation/Sites_Using.txt to include new site in list of
+    sites using this common application.
+    
+*      If you want to use local views or styles, create the following directories in the customer's virtual server.
+
+       /Toolkit/Registrations/    
+    /Toolkit/Registrations/admin               (for view files from app.gaslightmedia.com/Custom/Registrations_V3/admin/Views)
+    /Toolkit/Registrations/front-end   (for view files from app.gaslightmedia.com/Custom/Registrations_V3/front-end/Views)
+
+       Put copies of only the view files or style sheets you want to be custom into those directories. All others will use the default.
+       Turn on "event_registration.custom_view_files" in the config file. If off, it will ignore all custom views and styles.
+       YOU WILL BE RESPONSIBLE FOR KEEPING THE CUSTOM VIEW UPDATED!!!
+       
+    
+To Update a Version 0 Common/Registrations app to V2.53
+----------------------------------------------------
+
+Database updates for databases using Version 0 (original Common/Registrations)
+
+check if reg_detail table needs to be added - get from application.sql
+
+alter table misc add column cat_page_text text;
+alter table misc add column sub_cat_page_text text;
+alter table misc add column select_page_text text;
+alter table misc add column event_page_text text;
+alter table misc add column cart_page_text text;
+alter table misc add column checkout_page_text text;
+alter table misc add column summary_page_text text;
+update misc set 
+    cat_page_text = '',
+    sub_cat_page_text = '',
+    select_page_text = '',
+    event_page_text = '',
+    cart_page_text = '',
+    checkout_page_text = '',
+    summary_page_text = '';
+    
+Check if reg already has short_descr
+       alter table reg add column short_descr text;
+       update reg set short_descr = '';
+
+alter table registrant add column is_member boolean;
+alter table registrant add column member_id text;
+alter table registrant add column password text;
+alter table registrant add column winter_addr text;
+alter table registrant add column winter_phone text;
+update registrant set member_id = '' where member_id = '0';
+update registrant set is_member = 't';
+update registrant set is_member = 'f' where member_id is null or member_id = '';
+  
+alter table reg_req add column is_member boolean;
+alter table reg_req add column member_id text;
+update reg_req set is_member = 'f', member_id = '';
+
+alter table misc add column pay_codes text;
+update misc set pay_codes = '';
+
+alter table reg add column date_specific bool;
+update reg set date_specific = 'f';
+
+alter table registrant add column pw_reset_code text;
+
+alter table todo add column med_info boolean;
+update todo set med_info = 'f';
+
+alter table reg add column instructor text;
+      
+alter table reg add column reg_file text;
+alter table reg add column reg_file_title text;
+update reg set reg_file = '';
+update reg set reg_file_title = '';
+ Check if cart_serial has been added to reg_req
+       alter table reg_req add column cart_serial text;
+       
+alter table reg_req add column registrant integer;
+update reg_req R set registrant = (select max(T.id) from registrant T where T.email = R.email);
+
+alter table reg_detail add column cutoff_date date;
+alter table reg_detail add column rate_class text;
+alter table reg_detail add column charges_list text;
+
+alter table category add column sort integer;
+update category set sort = 999;
+alter table todo add column sort integer;
+update todo set sort = 999;
+
+If the database did not have a reg_detail table or entries and there were existing registrations, 
+do the following query to create the reg_detail entries.
+
+INSERT INTO reg_detail
+SELECT  nextval('reg_detail_id_seq'),
+        id AS reg_req,
+        numb_attending,
+        attendees,
+        total AS charges,
+        registration,
+        reg_start,
+        reg_end,
+        '' AS notes,
+        mf_data,
+        NULL AS dob,
+        '' AS guardian,
+        '' AS emer_contact,
+        '' AS emer_phone,
+        '' AS med_history,
+       '' AS allergy_med,
+        NULL AS cutoff_date,
+        '' AS rate_class,
+        '' AS charges_list
+   FROM reg_req
+  WHERE (
+                SELECT COUNT(id)
+                  FROM reg_detail
+                 WHERE reg_detail.reg_req = reg_req.id
+        ) = 0;
+
+May need to re-run permissions for tables and sequences.
+
+
diff --git a/documentation/Notes.txt b/documentation/Notes.txt
new file mode 100644 (file)
index 0000000..8ba6ce0
--- /dev/null
@@ -0,0 +1,61 @@
+Notes on structure and operation of this system
+
+Front End
+---------
+
+Session Data
+
+       GLM_EVENT_REG                                                   False if not setup.
+               User                                                            ID from registrant table for current user. False if none selected.
+               UserIsMember                                            Flag indicating whether user is a member.
+               UserData                                                        Record from registrant table for this user.
+               admin_user                                                      Flag indicating an admin user is using front-end
+               Cart                                                            Current Shopping Cart
+                       [cart_id]                                               A Cart entry.
+                               cart_id
+                               event_id
+                               event_name
+                               date_specific                           Indicates if event is date specific. "YES" or "NO"
+                               start_date
+                               end_date
+                               cutoff_date                                     Cutoff date when this entry was selected.
+                               rate_class                                      Rate Class name.
+                               charges                                         Array of Charges
+                                       [id]                                    A charge entry
+                                               charge_title            Title of this charge
+                                               charge                          Unit amount of this charge
+                                               extend                          Extended amount of this charge
+                               total_charges                           Numeric total charges
+                               totalCharges                            Money formatted total charges.
+                               need_attendees                          Indicates if event needs attendees. "YES" or "NO"
+                               have_attendees                          Indicates if there are > 0 attendees for this entry. "YES" or "NO"
+                               numb_attendees                          Current number of attendees for this entry.
+                               attendees                                       Array of attendees
+                                       [id]                                    An attendee entry id
+                                               name                            Name of attendee
+                                               have_dob                        Indicates if attendee has Date of Birth. "YES" or "NO"
+                                               dob                             
+                                               have_guardian           Indicates if attendee has guardian. "YES" or "NO"
+                                               guardian
+                                               have_emer_contact       Indicates if attendee has emergency contact. "YES" or "NO"
+                                               emer_contact
+                                               have_emer_phone         Indicates if attendee has emergency phone. "YES" or "NO"
+                                               emer_phone
+                                               have_med_history        Indicates if attendee has medical history. "YES" or "NO"
+                                               med_history
+                                               have_allergy_med        Indicates if attendee has allergy info. "YES" or "NO"
+                                               allergy_med
+                               med_info                                        Indicates if there's medical info. "YES" or "NO"
+                               have_mf_data                            Indicated if there's MagicForm data with this entry. "YES" or "NO"
+                               mf_data                                         Array of MagicForm data.
+                               haveTerms                                       Indicates if there's additional Terms/Conditions for event. "YES" or "NO"
+                               terms                                           Text of additional Terms/Conditions.
+               Cart_Serial_Number                                      Serial number for this cart. Stored in reg_req to prevent duplicates
+               Current_id                                                      Last cart entry ID. Incrimented when new entry is added.
+               Event                                                           Data on the currently selected event.
+                       id                                                              ID of current event
+                       name                                                    Name of current event
+                       code                                                    Event code for current event
+                       med_info                                                Flag indicating whether current event requires medical info.
+                       
+               
\ No newline at end of file
diff --git a/documentation/Payment Gateways/Merchant Solutions/Documentation/IVR_Payment_By_Phone_Guide.pdf b/documentation/Payment Gateways/Merchant Solutions/Documentation/IVR_Payment_By_Phone_Guide.pdf
new file mode 100644 (file)
index 0000000..3659c56
Binary files /dev/null and b/documentation/Payment Gateways/Merchant Solutions/Documentation/IVR_Payment_By_Phone_Guide.pdf differ
diff --git a/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_Batch_Processing_Guide.pdf b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_Batch_Processing_Guide.pdf
new file mode 100644 (file)
index 0000000..d11c946
Binary files /dev/null and b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_Batch_Processing_Guide.pdf differ
diff --git a/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_MMC_WAP_User_Guide.pdf b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_MMC_WAP_User_Guide.pdf
new file mode 100644 (file)
index 0000000..0bead38
Binary files /dev/null and b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_MMC_WAP_User_Guide.pdf differ
diff --git a/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_Membership_Guide.pdf b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_Membership_Guide.pdf
new file mode 100644 (file)
index 0000000..ab70331
Binary files /dev/null and b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_Membership_Guide.pdf differ
diff --git a/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_SOAP_Integration_Guide.pdf b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_SOAP_Integration_Guide.pdf
new file mode 100644 (file)
index 0000000..dd94489
Binary files /dev/null and b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_SOAP_Integration_Guide.pdf differ
diff --git a/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_Stored_Profile_Tokenization_Guide.pdf b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_Stored_Profile_Tokenization_Guide.pdf
new file mode 100644 (file)
index 0000000..eef81c7
Binary files /dev/null and b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_Stored_Profile_Tokenization_Guide.pdf differ
diff --git a/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_WebPay_Integration_Guide.pdf b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_WebPay_Integration_Guide.pdf
new file mode 100644 (file)
index 0000000..41cbb03
Binary files /dev/null and b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_WebPay_Integration_Guide.pdf differ
diff --git a/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_XML_Integration_Guide.pdf b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_XML_Integration_Guide.pdf
new file mode 100644 (file)
index 0000000..52a6974
Binary files /dev/null and b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_XML_Integration_Guide.pdf differ
diff --git a/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_card_present_transactions_guide.pdf b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_card_present_transactions_guide.pdf
new file mode 100644 (file)
index 0000000..8823422
Binary files /dev/null and b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_card_present_transactions_guide.pdf differ
diff --git a/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_first_mile_middleware_guide.pdf b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_first_mile_middleware_guide.pdf
new file mode 100644 (file)
index 0000000..f3ad634
Binary files /dev/null and b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_first_mile_middleware_guide.pdf differ
diff --git a/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_getting_started_guide.pdf b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_getting_started_guide.pdf
new file mode 100644 (file)
index 0000000..ac17d92
Binary files /dev/null and b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_getting_started_guide.pdf differ
diff --git a/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_integration_guide.pdf b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_integration_guide.pdf
new file mode 100644 (file)
index 0000000..d26b7f2
Binary files /dev/null and b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_integration_guide.pdf differ
diff --git a/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_soap_reporting_guide.pdf b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_soap_reporting_guide.pdf
new file mode 100644 (file)
index 0000000..3c58b0f
Binary files /dev/null and b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_soap_reporting_guide.pdf differ
diff --git a/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_web_cart_guide.pdf b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_web_cart_guide.pdf
new file mode 100644 (file)
index 0000000..5ff8028
Binary files /dev/null and b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_web_cart_guide.pdf differ
diff --git a/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_web_link_guide.pdf b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_web_link_guide.pdf
new file mode 100644 (file)
index 0000000..8a72a9e
Binary files /dev/null and b/documentation/Payment Gateways/Merchant Solutions/Documentation/MSII_web_link_guide.pdf differ
diff --git a/documentation/Payment Gateways/Merchant Solutions/Notes.txt b/documentation/Payment Gateways/Merchant Solutions/Notes.txt
new file mode 100644 (file)
index 0000000..c69b434
--- /dev/null
@@ -0,0 +1,23 @@
+
+Access to Documentation
+-----------------------
+URL:                   https://gateway.merchantsolution.com/docs/
+Email:                 merchantsolutions@n8dnx.org
+Password:              eC5^2SS9#c
+                                       mS2&Qe9V:t
+
+Merchant Center URL
+-------------------
+https://gateway.merchantsolution.com/admin/login.taf
+
+Test Merchant Account
+---------------------
+AcctID:                MSDMO
+Userid:                Cscott
+Password:              Sol#Glm3Merch
+MerchantPin:   rm2NcePTTc93VutRdguW2nRFQ2BiyLu9
+
+
+
+Test Cards             VISA - 5454545454545454
+
diff --git a/documentation/Payment Gateways/Merchant Solutions/merchant_solutions.wsdl b/documentation/Payment Gateways/Merchant Solutions/merchant_solutions.wsdl
new file mode 100644 (file)
index 0000000..bb62f58
--- /dev/null
@@ -0,0 +1,2435 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<wsdl:definitions targetNamespace="https://trans.merchantsolution.com/Web/services/TransactionService" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="https://trans.merchantsolution.com/Web/services/TransactionService" xmlns:intf="https://trans.merchantsolution.com/Web/services/TransactionService" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="urn:MPTransProcess" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+<!--WSDL created by Apache Axis version: 1.4
+Built on Apr 22, 2006 (06:55:48 PDT)-->
+ <wsdl:types>
+  <schema targetNamespace="urn:MPTransProcess" xmlns="http://www.w3.org/2001/XMLSchema">
+   <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
+   <complexType name="address">
+    <sequence>
+     <element name="addr1" nillable="true" type="xsd:string"/>
+     <element name="addr2" nillable="true" type="xsd:string"/>
+     <element name="addr3" nillable="true" type="xsd:string"/>
+     <element name="city" nillable="true" type="xsd:string"/>
+     <element name="state" nillable="true" type="xsd:string"/>
+     <element name="zip" nillable="true" type="xsd:string"/>
+     <element name="country" nillable="true" type="xsd:string"/>
+    </sequence>
+   </complexType>
+   <complexType name="customEmail">
+    <sequence>
+     <element name="emailto" nillable="true" type="xsd:string"/>
+     <element name="emailfrom" nillable="true" type="xsd:string"/>
+     <element name="emailsubject" nillable="true" type="xsd:string"/>
+     <element name="emailtext" nillable="true" type="xsd:string"/>
+    </sequence>
+   </complexType>
+   <complexType name="Recur">
+    <sequence>
+     <element name="create" type="xsd:int"/>
+     <element name="billingcycle" type="xsd:int"/>
+     <element name="billingmax" type="xsd:int"/>
+     <element name="start" type="xsd:int"/>
+     <element name="amount" type="xsd:float"/>
+    </sequence>
+   </complexType>
+   <complexType name="HotelLodging">
+    <sequence>
+     <element name="chargetypeamx" nillable="true" type="xsd:string"/>
+     <element name="roomrateamt" nillable="true" type="xsd:string"/>
+     <element name="checkindate" nillable="true" type="xsd:string"/>
+     <element name="checkoutdate" nillable="true" type="xsd:string"/>
+     <element name="purchaseid" nillable="true" type="xsd:string"/>
+     <element name="pproperty" nillable="true" type="xsd:string"/>
+     <element name="extracharges" nillable="true" type="xsd:string"/>
+    </sequence>
+   </complexType>
+   <complexType name="AutoRental">
+    <sequence>
+     <element name="rentalagreementnum" nillable="true" type="xsd:string"/>
+     <element name="rentalrate" nillable="true" type="xsd:string"/>
+     <element name="noshoworprogind" nillable="true" type="xsd:string"/>
+     <element name="extracharges" nillable="true" type="xsd:string"/>
+     <element name="rentaldate" nillable="true" type="xsd:string"/>
+     <element name="rentalreturndate" nillable="true" type="xsd:string"/>
+     <element name="rentername" nillable="true" type="xsd:string"/>
+     <element name="rentalreturncity" nillable="true" type="xsd:string"/>
+     <element name="rentalreturnstatecountry" nillable="true" type="xsd:string"/>
+     <element name="rentalreturnlocationid" nillable="true" type="xsd:string"/>
+    </sequence>
+   </complexType>
+   <complexType name="CustomFields">
+    <sequence>
+     <element name="custom1" nillable="true" type="xsd:string"/>
+     <element name="custom2" nillable="true" type="xsd:string"/>
+     <element name="custom3" nillable="true" type="xsd:string"/>
+     <element name="custom4" nillable="true" type="xsd:string"/>
+     <element name="custom5" nillable="true" type="xsd:string"/>
+     <element name="custom6" nillable="true" type="xsd:string"/>
+    </sequence>
+   </complexType>
+   <complexType name="AutoRepair">
+    <sequence>
+     <element name="vin" nillable="true" type="xsd:string"/>
+     <element name="odometer" nillable="true" type="xsd:string"/>
+     <element name="workorder" nillable="true" type="xsd:string"/>
+     <element name="unit" nillable="true" type="xsd:string"/>
+     <element name="repaircode" nillable="true" type="xsd:string"/>
+    </sequence>
+   </complexType>
+   <complexType name="FSA">
+    <sequence>
+     <element name="healthcareflag" type="xsd:int"/>
+     <element name="rxamount" type="xsd:float"/>
+     <element name="clinicamount" type="xsd:float"/>
+     <element name="visionamount" type="xsd:float"/>
+     <element name="dentalamount" type="xsd:float"/>
+    </sequence>
+   </complexType>
+   <complexType name="PurchaseCardLevel2">
+    <sequence>
+     <element name="pocustomerrefid" nillable="true" type="xsd:string"/>
+     <element name="taxamount" type="xsd:float"/>
+     <element name="taxexempt" type="xsd:int"/>
+    </sequence>
+   </complexType>
+   <complexType name="Restaurant">
+    <sequence>
+     <element name="gratuityamount" type="xsd:float"/>
+    </sequence>
+   </complexType>
+   <complexType name="PurchaseCardLevel3">
+    <sequence>
+     <element name="lineitems" nillable="true" type="xsd:string"/>
+    </sequence>
+   </complexType>
+   <complexType name="FleetCardData">
+    <sequence>
+     <element name="atpump" type="xsd:int"/>
+     <element name="idnumber" nillable="true" type="xsd:string"/>
+     <element name="vehicleid" nillable="true" type="xsd:string"/>
+     <element name="driverid" nillable="true" type="xsd:string"/>
+     <element name="odometerreading" nillable="true" type="xsd:string"/>
+     <element name="miscnumericdata" nillable="true" type="xsd:string"/>
+     <element name="jobnumber" nillable="true" type="xsd:string"/>
+     <element name="purchasedevsequencenumber" nillable="true" type="xsd:string"/>
+     <element name="departmentnumber" nillable="true" type="xsd:string"/>
+    </sequence>
+   </complexType>
+   <complexType name="CreditCardInfo">
+    <sequence>
+     <element name="acctid" nillable="true" type="xsd:string"/>
+     <element name="accountkey" nillable="true" type="xsd:string"/>
+     <element name="subid" nillable="true" type="xsd:string"/>
+     <element name="ccname" nillable="true" type="xsd:string"/>
+     <element name="swipedata" nillable="true" type="xsd:string"/>
+     <element name="cardpresent" type="xsd:int"/>
+     <element name="cardreaderpresent" type="xsd:int"/>
+     <element name="voiceauth" nillable="true" type="xsd:string"/>
+     <element name="track1" nillable="true" type="xsd:string"/>
+     <element name="track2" nillable="true" type="xsd:string"/>
+     <element name="ccnum" nillable="true" type="xsd:string"/>
+     <element name="cctype" nillable="true" type="xsd:string"/>
+     <element name="expmon" type="xsd:int"/>
+     <element name="expyear" type="xsd:int"/>
+     <element name="cvv2" type="xsd:int"/>
+     <element name="cvv2_cid" nillable="true" type="xsd:string"/>
+     <element name="amount" type="xsd:float"/>
+     <element name="merchantordernumber" nillable="true" type="xsd:string"/>
+     <element name="companyname" nillable="true" type="xsd:string"/>
+     <element name="billaddress" nillable="true" type="tns1:address"/>
+     <element name="shipaddress" nillable="true" type="tns1:address"/>
+     <element name="email" nillable="true" type="xsd:string"/>
+     <element name="dlnum" nillable="true" type="xsd:string"/>
+     <element name="ssnum" nillable="true" type="xsd:string"/>
+     <element name="phone" nillable="true" type="xsd:string"/>
+     <element name="dobday" nillable="true" type="xsd:string"/>
+     <element name="dobmonth" nillable="true" type="xsd:string"/>
+     <element name="dobyear" nillable="true" type="xsd:string"/>
+     <element name="memo" nillable="true" type="xsd:string"/>
+     <element name="customizedemail" nillable="true" type="tns1:customEmail"/>
+     <element name="recurring" nillable="true" type="tns1:Recur"/>
+     <element name="ipaddress" nillable="true" type="xsd:string"/>
+     <element name="accttype" type="xsd:int"/>
+     <element name="merchantpin" nillable="true" type="xsd:string"/>
+     <element name="currencycode" nillable="true" type="xsd:string"/>
+     <element name="industrycode" nillable="true" type="xsd:string"/>
+     <element name="dynamicdescriptor" nillable="true" type="xsd:string"/>
+     <element name="profileactiontype" type="xsd:int"/>
+     <element name="manualrecurring" type="xsd:int"/>
+     <element name="hotellodging" nillable="true" type="tns1:HotelLodging"/>
+     <element name="autorental" nillable="true" type="tns1:AutoRental"/>
+     <element name="customizedfields" nillable="true" type="tns1:CustomFields"/>
+     <element name="autorepair" nillable="true" type="tns1:AutoRepair"/>
+     <element name="fsa" nillable="true" type="tns1:FSA"/>
+     <element name="purchasecardlevel2" nillable="true" type="tns1:PurchaseCardLevel2"/>
+     <element name="restaurant" nillable="true" type="tns1:Restaurant"/>
+     <element name="purchasecardlevel3" nillable="true" type="tns1:PurchaseCardLevel3"/>
+     <element name="fleetcarddata" nillable="true" type="tns1:FleetCardData"/>
+     <element name="otp" nillable="true" type="xsd:string"/>
+     <element name="deviceid" nillable="true" type="xsd:string"/>
+     <element name="avs_override" type="xsd:int"/>
+     <element name="cvv2_override" type="xsd:int"/>
+     <element name="loadbalance_override" type="xsd:int"/>
+     <element name="duplicate_override" type="xsd:int"/>
+     <element name="ticketterms" nillable="true" type="xsd:string"/>
+     <element name="accountlookupflag" type="xsd:int"/>
+     <element name="signature" nillable="true" type="xsd:string"/>
+    </sequence>
+   </complexType>
+   <complexType name="ProcessResult">
+    <sequence>
+     <element name="status" nillable="true" type="xsd:string"/>
+     <element name="result" nillable="true" type="xsd:string"/>
+     <element name="historyid" nillable="true" type="xsd:string"/>
+     <element name="orderid" nillable="true" type="xsd:string"/>
+     <element name="refcode" nillable="true" type="xsd:string"/>
+     <element name="authcode" nillable="true" type="xsd:string"/>
+     <element name="total" type="xsd:float"/>
+     <element name="merchantordernumber" nillable="true" type="xsd:string"/>
+     <element name="acctid" nillable="true" type="xsd:string"/>
+     <element name="subid" nillable="true" type="xsd:string"/>
+     <element name="transdate" nillable="true" type="xsd:dateTime"/>
+     <element name="paytype" nillable="true" type="xsd:string"/>
+     <element name="duplicate" type="xsd:int"/>
+     <element name="avsresult" nillable="true" type="xsd:string"/>
+     <element name="cvv2result" nillable="true" type="xsd:string"/>
+     <element name="batchnumber" nillable="true" type="xsd:string"/>
+     <element name="last4digits" nillable="true" type="xsd:string"/>
+     <element name="entrymethod" nillable="true" type="xsd:string"/>
+     <element name="partialapproval" type="xsd:int"/>
+     <element name="actioncode" nillable="true" type="xsd:string"/>
+     <element name="balance" nillable="true" type="xsd:string"/>
+     <element name="recurbillingamount" nillable="true" type="xsd:string"/>
+     <element name="recurnextbillingdate" nillable="true" type="xsd:string"/>
+     <element name="recurbillingcycle" nillable="true" type="xsd:string"/>
+     <element name="recurbillingmax" nillable="true" type="xsd:string"/>
+     <element name="recurcanceldate" nillable="true" type="xsd:string"/>
+     <element name="recurlastattempted" nillable="true" type="xsd:string"/>
+     <element name="recurbillingstatus" nillable="true" type="xsd:string"/>
+     <element name="recurtotalaccept" nillable="true" type="xsd:string"/>
+     <element name="achrcode" nillable="true" type="xsd:string"/>
+     <element name="transactiontype" nillable="true" type="xsd:string"/>
+     <element name="additionaldata" nillable="true" type="xsd:string"/>
+    </sequence>
+   </complexType>
+   <complexType name="VoidCreditPost">
+    <sequence>
+     <element name="acctid" nillable="true" type="xsd:string"/>
+     <element name="accountkey" nillable="true" type="xsd:string"/>
+     <element name="subid" nillable="true" type="xsd:string"/>
+     <element name="amount" type="xsd:float"/>
+     <element name="orderid" nillable="true" type="xsd:string"/>
+     <element name="historyid" nillable="true" type="xsd:string"/>
+     <element name="ipaddress" nillable="true" type="xsd:string"/>
+     <element name="merchantpin" nillable="true" type="xsd:string"/>
+     <element name="merchantordernumber" nillable="true" type="xsd:string"/>
+     <element name="customizedfields" nillable="true" type="tns1:CustomFields"/>
+     <element name="purchasecardlevel2" nillable="true" type="tns1:PurchaseCardLevel2"/>
+     <element name="restaurant" nillable="true" type="tns1:Restaurant"/>
+     <element name="purchasecardlevel3" nillable="true" type="tns1:PurchaseCardLevel3"/>
+     <element name="fleetcarddata" nillable="true" type="tns1:FleetCardData"/>
+     <element name="swipedata" nillable="true" type="xsd:string"/>
+     <element name="cvv2_cid" nillable="true" type="xsd:string"/>
+    </sequence>
+   </complexType>
+   <complexType name="ACHInfo">
+    <sequence>
+     <element name="acctid" nillable="true" type="xsd:string"/>
+     <element name="accountkey" nillable="true" type="xsd:string"/>
+     <element name="subid" nillable="true" type="xsd:string"/>
+     <element name="firstname" nillable="true" type="xsd:string"/>
+     <element name="lastname" nillable="true" type="xsd:string"/>
+     <element name="ckname" nillable="true" type="xsd:string"/>
+     <element name="ckaba" nillable="true" type="xsd:string"/>
+     <element name="ckacct" nillable="true" type="xsd:string"/>
+     <element name="ckno" nillable="true" type="xsd:string"/>
+     <element name="cktype" nillable="true" type="xsd:string"/>
+     <element name="amount" type="xsd:float"/>
+     <element name="ckmicrdata" nillable="true" type="xsd:string"/>
+     <element name="ckterminalcity" nillable="true" type="xsd:string"/>
+     <element name="ckterminalstate" nillable="true" type="xsd:string"/>
+     <element name="ckaccttype" nillable="true" type="xsd:string"/>
+     <element name="ckimagefront" nillable="true" type="xsd:string"/>
+     <element name="ckimageback" nillable="true" type="xsd:string"/>
+     <element name="ckimagetype" nillable="true" type="xsd:string"/>
+     <element name="merchantordernumber" nillable="true" type="xsd:string"/>
+     <element name="ckaccttypedesc" nillable="true" type="xsd:string"/>
+     <element name="verificationflag" nillable="true" type="xsd:string"/>
+     <element name="companyname" nillable="true" type="xsd:string"/>
+     <element name="billaddress" nillable="true" type="tns1:address"/>
+     <element name="shipaddress" nillable="true" type="tns1:address"/>
+     <element name="email" nillable="true" type="xsd:string"/>
+     <element name="dlnum" nillable="true" type="xsd:string"/>
+     <element name="ssnum" nillable="true" type="xsd:string"/>
+     <element name="phone" nillable="true" type="xsd:string"/>
+     <element name="dobday" nillable="true" type="xsd:string"/>
+     <element name="dobmonth" nillable="true" type="xsd:string"/>
+     <element name="dobyear" nillable="true" type="xsd:string"/>
+     <element name="memo" nillable="true" type="xsd:string"/>
+     <element name="customizedemail" nillable="true" type="tns1:customEmail"/>
+     <element name="recurring" nillable="true" type="tns1:Recur"/>
+     <element name="ipaddress" nillable="true" type="xsd:string"/>
+     <element name="merchantpin" nillable="true" type="xsd:string"/>
+     <element name="currencycode" nillable="true" type="xsd:string"/>
+     <element name="industrycode" nillable="true" type="xsd:string"/>
+     <element name="profileactiontype" type="xsd:int"/>
+     <element name="hotellodging" nillable="true" type="tns1:HotelLodging"/>
+     <element name="autorental" nillable="true" type="tns1:AutoRental"/>
+     <element name="customizedfields" nillable="true" type="tns1:CustomFields"/>
+     <element name="loadbalance_override" type="xsd:int"/>
+     <element name="duplicate_override" type="xsd:int"/>
+     <element name="signature" nillable="true" type="xsd:string"/>
+    </sequence>
+   </complexType>
+   <complexType name="C21Info">
+    <sequence>
+     <element name="acctid" nillable="true" type="xsd:string"/>
+     <element name="accountkey" nillable="true" type="xsd:string"/>
+     <element name="subid" nillable="true" type="xsd:string"/>
+     <element name="ckname" nillable="true" type="xsd:string"/>
+     <element name="firstname" nillable="true" type="xsd:string"/>
+     <element name="lastname" nillable="true" type="xsd:string"/>
+     <element name="ckaba" nillable="true" type="xsd:string"/>
+     <element name="ckacct" nillable="true" type="xsd:string"/>
+     <element name="ckno" nillable="true" type="xsd:string"/>
+     <element name="cktype" nillable="true" type="xsd:string"/>
+     <element name="amount" type="xsd:float"/>
+     <element name="ckmicrdata" nillable="true" type="xsd:string"/>
+     <element name="ckterminalcity" nillable="true" type="xsd:string"/>
+     <element name="ckterminalstate" nillable="true" type="xsd:string"/>
+     <element name="ckaccttype" nillable="true" type="xsd:string"/>
+     <element name="ckimagefront" nillable="true" type="xsd:string"/>
+     <element name="ckimageback" nillable="true" type="xsd:string"/>
+     <element name="ckimagetype" nillable="true" type="xsd:string"/>
+     <element name="merchantordernumber" nillable="true" type="xsd:string"/>
+     <element name="companyname" nillable="true" type="xsd:string"/>
+     <element name="billaddress" nillable="true" type="tns1:address"/>
+     <element name="shipaddress" nillable="true" type="tns1:address"/>
+     <element name="email" nillable="true" type="xsd:string"/>
+     <element name="dlnum" nillable="true" type="xsd:string"/>
+     <element name="ssnum" nillable="true" type="xsd:string"/>
+     <element name="phone" nillable="true" type="xsd:string"/>
+     <element name="memo" nillable="true" type="xsd:string"/>
+     <element name="dobday" nillable="true" type="xsd:string"/>
+     <element name="dobmonth" nillable="true" type="xsd:string"/>
+     <element name="dobyear" nillable="true" type="xsd:string"/>
+     <element name="memoline1" nillable="true" type="xsd:string"/>
+     <element name="memoline2" nillable="true" type="xsd:string"/>
+     <element name="memoline3" nillable="true" type="xsd:string"/>
+     <element name="customizedemail" nillable="true" type="tns1:customEmail"/>
+     <element name="recurring" nillable="true" type="tns1:Recur"/>
+     <element name="ipaddress" nillable="true" type="xsd:string"/>
+     <element name="merchantpin" nillable="true" type="xsd:string"/>
+     <element name="currencycode" nillable="true" type="xsd:string"/>
+     <element name="industrycode" nillable="true" type="xsd:string"/>
+     <element name="billstreet" nillable="true" type="xsd:string"/>
+     <element name="housenumber" nillable="true" type="xsd:string"/>
+     <element name="zip4" nillable="true" type="xsd:string"/>
+     <element name="riskmodifier" nillable="true" type="xsd:string"/>
+     <element name="authenticationmodifier" nillable="true" type="xsd:string"/>
+     <element name="insurancemodifier" nillable="true" type="xsd:string"/>
+     <element name="profileactiontype" type="xsd:int"/>
+     <element name="hotellodging" nillable="true" type="tns1:HotelLodging"/>
+     <element name="autorental" nillable="true" type="tns1:AutoRental"/>
+     <element name="customizedfields" nillable="true" type="tns1:CustomFields"/>
+     <element name="loadbalance_override" type="xsd:int"/>
+     <element name="duplicate_override" type="xsd:int"/>
+     <element name="signature" nillable="true" type="xsd:string"/>
+    </sequence>
+   </complexType>
+   <complexType name="DebitInfo">
+    <sequence>
+     <element name="acctid" nillable="true" type="xsd:string"/>
+     <element name="accountkey" nillable="true" type="xsd:string"/>
+     <element name="subid" nillable="true" type="xsd:string"/>
+     <element name="ccname" nillable="true" type="xsd:string"/>
+     <element name="swipedata" nillable="true" type="xsd:string"/>
+     <element name="cardpresent" type="xsd:int"/>
+     <element name="cardreaderpresent" type="xsd:int"/>
+     <element name="customerid" nillable="true" type="xsd:string"/>
+     <element name="cashbackamount" type="xsd:float"/>
+     <element name="amount" type="xsd:float"/>
+     <element name="merchantordernumber" nillable="true" type="xsd:string"/>
+     <element name="companyname" nillable="true" type="xsd:string"/>
+     <element name="billaddress" nillable="true" type="tns1:address"/>
+     <element name="shipaddress" nillable="true" type="tns1:address"/>
+     <element name="email" nillable="true" type="xsd:string"/>
+     <element name="dlnum" nillable="true" type="xsd:string"/>
+     <element name="ssnum" nillable="true" type="xsd:string"/>
+     <element name="phone" nillable="true" type="xsd:string"/>
+     <element name="memo" nillable="true" type="xsd:string"/>
+     <element name="dobday" nillable="true" type="xsd:string"/>
+     <element name="dobmonth" nillable="true" type="xsd:string"/>
+     <element name="dobyear" nillable="true" type="xsd:string"/>
+     <element name="customizedemail" nillable="true" type="tns1:customEmail"/>
+     <element name="ipaddress" nillable="true" type="xsd:string"/>
+     <element name="merchantpin" nillable="true" type="xsd:string"/>
+     <element name="currencycode" nillable="true" type="xsd:string"/>
+     <element name="industrycode" nillable="true" type="xsd:string"/>
+     <element name="hotellodging" nillable="true" type="tns1:HotelLodging"/>
+     <element name="autorental" nillable="true" type="tns1:AutoRental"/>
+     <element name="customizedfields" nillable="true" type="tns1:CustomFields"/>
+     <element name="purchasecardlevel3" nillable="true" type="tns1:PurchaseCardLevel3"/>
+     <element name="fleetcarddata" nillable="true" type="tns1:FleetCardData"/>
+     <element name="loadbalance_override" type="xsd:int"/>
+     <element name="duplicate_override" type="xsd:int"/>
+     <element name="signature" nillable="true" type="xsd:string"/>
+    </sequence>
+   </complexType>
+   <complexType name="DebitReturn">
+    <sequence>
+     <element name="acctid" nillable="true" type="xsd:string"/>
+     <element name="accountkey" nillable="true" type="xsd:string"/>
+     <element name="subid" nillable="true" type="xsd:string"/>
+     <element name="amount" type="xsd:float"/>
+     <element name="orderid" nillable="true" type="xsd:string"/>
+     <element name="historyid" nillable="true" type="xsd:string"/>
+     <element name="swipedata" nillable="true" type="xsd:string"/>
+     <element name="customerid" nillable="true" type="xsd:string"/>
+     <element name="ipaddress" nillable="true" type="xsd:string"/>
+     <element name="merchantpin" nillable="true" type="xsd:string"/>
+     <element name="merchantordernumber" nillable="true" type="xsd:string"/>
+     <element name="email" nillable="true" type="xsd:string"/>
+     <element name="currencycode" nillable="true" type="xsd:string"/>
+     <element name="memo" nillable="true" type="xsd:string"/>
+     <element name="customizedemail" nillable="true" type="tns1:customEmail"/>
+     <element name="customizedfields" nillable="true" type="tns1:CustomFields"/>
+     <element name="purchasecardlevel3" nillable="true" type="tns1:PurchaseCardLevel3"/>
+     <element name="fleetcarddata" nillable="true" type="tns1:FleetCardData"/>
+     <element name="loadbalance_override" type="xsd:int"/>
+     <element name="duplicate_override" type="xsd:int"/>
+    </sequence>
+   </complexType>
+   <complexType name="ProcessProfileResult">
+    <sequence>
+     <element name="status" nillable="true" type="xsd:string"/>
+     <element name="result" nillable="true" type="xsd:string"/>
+     <element name="historyid" nillable="true" type="xsd:string"/>
+     <element name="orderid" nillable="true" type="xsd:string"/>
+     <element name="refcode" nillable="true" type="xsd:string"/>
+     <element name="authcode" nillable="true" type="xsd:string"/>
+     <element name="total" type="xsd:float"/>
+     <element name="merchantordernumber" nillable="true" type="xsd:string"/>
+     <element name="acctid" nillable="true" type="xsd:string"/>
+     <element name="subid" nillable="true" type="xsd:string"/>
+     <element name="transdate" nillable="true" type="xsd:dateTime"/>
+     <element name="paytype" nillable="true" type="xsd:string"/>
+     <element name="duplicate" type="xsd:int"/>
+     <element name="userprofileid" nillable="true" type="xsd:string"/>
+     <element name="paymentprofileid" nillable="true" type="xsd:string"/>
+     <element name="shippingprofileid" nillable="true" type="xsd:string"/>
+     <element name="avsresult" nillable="true" type="xsd:string"/>
+     <element name="cvv2result" nillable="true" type="xsd:string"/>
+     <element name="batchnumber" nillable="true" type="xsd:string"/>
+     <element name="last4digits" nillable="true" type="xsd:string"/>
+     <element name="entrymethod" nillable="true" type="xsd:string"/>
+     <element name="partialapproval" type="xsd:int"/>
+     <element name="actioncode" nillable="true" type="xsd:string"/>
+     <element name="ccnum_decrypt" nillable="true" type="xsd:string"/>
+     <element name="expdate_decrypt" nillable="true" type="xsd:string"/>
+     <element name="billaddr1" nillable="true" type="xsd:string"/>
+     <element name="billaddr2" nillable="true" type="xsd:string"/>
+     <element name="billcity" nillable="true" type="xsd:string"/>
+     <element name="billstate" nillable="true" type="xsd:string"/>
+     <element name="billzip" nillable="true" type="xsd:string"/>
+     <element name="shipaddr1" nillable="true" type="xsd:string"/>
+     <element name="shipaddr2" nillable="true" type="xsd:string"/>
+     <element name="shipcity" nillable="true" type="xsd:string"/>
+     <element name="shipstate" nillable="true" type="xsd:string"/>
+     <element name="shipzip" nillable="true" type="xsd:string"/>
+     <element name="additionaldata" nillable="true" type="xsd:string"/>
+    </sequence>
+   </complexType>
+   <complexType name="ProfileRetrieve">
+    <sequence>
+     <element name="acctid" nillable="true" type="xsd:string"/>
+     <element name="accountkey" nillable="true" type="xsd:string"/>
+     <element name="subid" nillable="true" type="xsd:string"/>
+     <element name="last4digits" nillable="true" type="xsd:string"/>
+     <element name="userprofileid" nillable="true" type="xsd:string"/>
+     <element name="paymentprofileid" nillable="true" type="xsd:string"/>
+     <element name="shippingprofileid" nillable="true" type="xsd:string"/>
+     <element name="merchantpin" nillable="true" type="xsd:string"/>
+     <element name="ipaddress" nillable="true" type="xsd:string"/>
+    </sequence>
+   </complexType>
+   <complexType name="ProfileDelete">
+    <sequence>
+     <element name="acctid" nillable="true" type="xsd:string"/>
+     <element name="accountkey" nillable="true" type="xsd:string"/>
+     <element name="subid" nillable="true" type="xsd:string"/>
+     <element name="last4digits" nillable="true" type="xsd:string"/>
+     <element name="userprofileid" nillable="true" type="xsd:string"/>
+     <element name="paymentprofileid" nillable="true" type="xsd:string"/>
+     <element name="shippingprofileid" nillable="true" type="xsd:string"/>
+     <element name="merchantpin" nillable="true" type="xsd:string"/>
+     <element name="ipaddress" nillable="true" type="xsd:string"/>
+    </sequence>
+   </complexType>
+   <complexType name="ProfileSale">
+    <sequence>
+     <element name="acctid" nillable="true" type="xsd:string"/>
+     <element name="accountkey" nillable="true" type="xsd:string"/>
+     <element name="subid" nillable="true" type="xsd:string"/>
+     <element name="amount" type="xsd:float"/>
+     <element name="last4digits" nillable="true" type="xsd:string"/>
+     <element name="userprofileid" nillable="true" type="xsd:string"/>
+     <element name="paymentprofileid" nillable="true" type="xsd:string"/>
+     <element name="shippingprofileid" nillable="true" type="xsd:string"/>
+     <element name="merchantpin" nillable="true" type="xsd:string"/>
+     <element name="ipaddress" nillable="true" type="xsd:string"/>
+     <element name="authonly" type="xsd:int"/>
+     <element name="cvv2" type="xsd:int"/>
+     <element name="cvv2_cid" nillable="true" type="xsd:string"/>
+     <element name="swipedata" nillable="true" type="xsd:string"/>
+     <element name="voiceauth" nillable="true" type="xsd:string"/>
+     <element name="merchantordernumber" nillable="true" type="xsd:string"/>
+     <element name="manualrecurring" type="xsd:int"/>
+     <element name="recurring" nillable="true" type="tns1:Recur"/>
+     <element name="currencycode" nillable="true" type="xsd:string"/>
+     <element name="industrycode" nillable="true" type="xsd:string"/>
+     <element name="hotellodging" nillable="true" type="tns1:HotelLodging"/>
+     <element name="autorental" nillable="true" type="tns1:AutoRental"/>
+     <element name="customizedemail" nillable="true" type="tns1:customEmail"/>
+     <element name="customizedfields" nillable="true" type="tns1:CustomFields"/>
+     <element name="fsa" nillable="true" type="tns1:FSA"/>
+     <element name="purchasecardlevel2" nillable="true" type="tns1:PurchaseCardLevel2"/>
+     <element name="otp" nillable="true" type="xsd:string"/>
+     <element name="deviceid" nillable="true" type="xsd:string"/>
+     <element name="cvv2_override" type="xsd:int"/>
+     <element name="avs_override" type="xsd:int"/>
+     <element name="loadbalance_override" type="xsd:int"/>
+     <element name="duplicate_override" type="xsd:int"/>
+     <element name="ticketterms" nillable="true" type="xsd:string"/>
+     <element name="accountlookupflag" type="xsd:int"/>
+     <element name="signature" nillable="true" type="xsd:string"/>
+    </sequence>
+   </complexType>
+   <complexType name="ProfileUpdate">
+    <sequence>
+     <element name="acctid" nillable="true" type="xsd:string"/>
+     <element name="accountkey" nillable="true" type="xsd:string"/>
+     <element name="subid" nillable="true" type="xsd:string"/>
+     <element name="last4digits" nillable="true" type="xsd:string"/>
+     <element name="userprofileid" nillable="true" type="xsd:string"/>
+     <element name="paymentprofileid" nillable="true" type="xsd:string"/>
+     <element name="shippingprofileid" nillable="true" type="xsd:string"/>
+     <element name="merchantpin" nillable="true" type="xsd:string"/>
+     <element name="ipaddress" nillable="true" type="xsd:string"/>
+     <element name="ckname" nillable="true" type="xsd:string"/>
+     <element name="ckaba" nillable="true" type="xsd:string"/>
+     <element name="ckacct" nillable="true" type="xsd:string"/>
+     <element name="ckno" nillable="true" type="xsd:string"/>
+     <element name="cktype" nillable="true" type="xsd:string"/>
+     <element name="ckaccttype" nillable="true" type="xsd:string"/>
+     <element name="ccname" nillable="true" type="xsd:string"/>
+     <element name="swipedata" nillable="true" type="xsd:string"/>
+     <element name="cardpresent" type="xsd:int"/>
+     <element name="cardreaderpresent" type="xsd:int"/>
+     <element name="track1" nillable="true" type="xsd:string"/>
+     <element name="track2" nillable="true" type="xsd:string"/>
+     <element name="ccnum" nillable="true" type="xsd:string"/>
+     <element name="cctype" nillable="true" type="xsd:string"/>
+     <element name="expmon" type="xsd:int"/>
+     <element name="expyear" type="xsd:int"/>
+     <element name="cvv2" type="xsd:int"/>
+     <element name="cvv2_cid" nillable="true" type="xsd:string"/>
+     <element name="merchantordernumber" nillable="true" type="xsd:string"/>
+     <element name="companyname" nillable="true" type="xsd:string"/>
+     <element name="billaddress" nillable="true" type="tns1:address"/>
+     <element name="shipaddress" nillable="true" type="tns1:address"/>
+     <element name="email" nillable="true" type="xsd:string"/>
+     <element name="dlnum" nillable="true" type="xsd:string"/>
+     <element name="ssnum" nillable="true" type="xsd:string"/>
+     <element name="phone" nillable="true" type="xsd:string"/>
+     <element name="memo" nillable="true" type="xsd:string"/>
+     <element name="currencycode" nillable="true" type="xsd:string"/>
+     <element name="customizedfields" nillable="true" type="tns1:CustomFields"/>
+     <element name="cvv2_override" type="xsd:int"/>
+     <element name="avs_override" type="xsd:int"/>
+     <element name="loadbalance_override" type="xsd:int"/>
+     <element name="accttype" type="xsd:int"/>
+     <element name="profilenobill" type="xsd:int"/>
+    </sequence>
+   </complexType>
+   <complexType name="ProfileCredit">
+    <sequence>
+     <element name="acctid" nillable="true" type="xsd:string"/>
+     <element name="accountkey" nillable="true" type="xsd:string"/>
+     <element name="subid" nillable="true" type="xsd:string"/>
+     <element name="amount" type="xsd:float"/>
+     <element name="last4digits" nillable="true" type="xsd:string"/>
+     <element name="userprofileid" nillable="true" type="xsd:string"/>
+     <element name="paymentprofileid" nillable="true" type="xsd:string"/>
+     <element name="shippingprofileid" nillable="true" type="xsd:string"/>
+     <element name="merchantpin" nillable="true" type="xsd:string"/>
+     <element name="ipaddress" nillable="true" type="xsd:string"/>
+     <element name="currencycode" nillable="true" type="xsd:string"/>
+     <element name="merchantordernumber" nillable="true" type="xsd:string"/>
+     <element name="customizedemail" nillable="true" type="tns1:customEmail"/>
+     <element name="customizedfields" nillable="true" type="tns1:CustomFields"/>
+     <element name="loadbalance_override" type="xsd:int"/>
+     <element name="duplicate_override" type="xsd:int"/>
+    </sequence>
+   </complexType>
+   <complexType name="VoidCreditC21">
+    <sequence>
+     <element name="acctid" nillable="true" type="xsd:string"/>
+     <element name="accountkey" nillable="true" type="xsd:string"/>
+     <element name="subid" nillable="true" type="xsd:string"/>
+     <element name="amount" type="xsd:float"/>
+     <element name="orderid" nillable="true" type="xsd:string"/>
+     <element name="historyid" nillable="true" type="xsd:string"/>
+     <element name="ipaddress" nillable="true" type="xsd:string"/>
+     <element name="merchantpin" nillable="true" type="xsd:string"/>
+     <element name="merchantordernumber" nillable="true" type="xsd:string"/>
+     <element name="senddate" nillable="true" type="xsd:string"/>
+     <element name="customizedfields" nillable="true" type="tns1:CustomFields"/>
+    </sequence>
+   </complexType>
+   <complexType name="TransRetrieve">
+    <sequence>
+     <element name="acctid" nillable="true" type="xsd:string"/>
+     <element name="accountkey" nillable="true" type="xsd:string"/>
+     <element name="subid" nillable="true" type="xsd:string"/>
+     <element name="merchantordernumber" nillable="true" type="xsd:string"/>
+     <element name="merchantpin" nillable="true" type="xsd:string"/>
+     <element name="ipaddress" nillable="true" type="xsd:string"/>
+    </sequence>
+   </complexType>
+   <complexType name="RecurRetrieve">
+    <sequence>
+     <element name="acctid" nillable="true" type="xsd:string"/>
+     <element name="accountkey" nillable="true" type="xsd:string"/>
+     <element name="subid" nillable="true" type="xsd:string"/>
+     <element name="orderid" nillable="true" type="xsd:string"/>
+     <element name="merchantpin" nillable="true" type="xsd:string"/>
+     <element name="ipaddress" nillable="true" type="xsd:string"/>
+    </sequence>
+   </complexType>
+   <complexType name="ProcessRecurRetrieveResult">
+    <sequence>
+     <element name="status" nillable="true" type="xsd:string"/>
+     <element name="result" nillable="true" type="xsd:string"/>
+     <element name="historyid" nillable="true" type="xsd:string"/>
+     <element name="orderid" nillable="true" type="xsd:string"/>
+     <element name="refcode" nillable="true" type="xsd:string"/>
+     <element name="authcode" nillable="true" type="xsd:string"/>
+     <element name="total" type="xsd:float"/>
+     <element name="merchantordernumber" nillable="true" type="xsd:string"/>
+     <element name="acctid" nillable="true" type="xsd:string"/>
+     <element name="subid" nillable="true" type="xsd:string"/>
+     <element name="transdate" nillable="true" type="xsd:dateTime"/>
+     <element name="paytype" nillable="true" type="xsd:string"/>
+     <element name="duplicate" type="xsd:int"/>
+     <element name="recurbillingamount" nillable="true" type="xsd:string"/>
+     <element name="recurnextbillingdate" nillable="true" type="xsd:string"/>
+     <element name="recurbillingcycle" nillable="true" type="xsd:string"/>
+     <element name="recurbillingmax" nillable="true" type="xsd:string"/>
+     <element name="recurcanceldate" nillable="true" type="xsd:string"/>
+     <element name="recurlastattempted" nillable="true" type="xsd:string"/>
+     <element name="recurbillingstatus" nillable="true" type="xsd:string"/>
+     <element name="recurtotalaccept" nillable="true" type="xsd:string"/>
+    </sequence>
+   </complexType>
+   <complexType name="ProcessResults">
+    <sequence>
+     <element name="status" nillable="true" type="xsd:string"/>
+     <element name="result" nillable="true" type="xsd:string"/>
+     <element name="historyid" nillable="true" type="xsd:string"/>
+     <element name="orderid" nillable="true" type="xsd:string"/>
+     <element name="refcode" nillable="true" type="xsd:string"/>
+     <element name="authcode" nillable="true" type="xsd:string"/>
+     <element name="total" type="xsd:float"/>
+     <element name="merchantordernumber" nillable="true" type="xsd:string"/>
+     <element name="transdate" nillable="true" type="xsd:dateTime"/>
+     <element name="paytype" nillable="true" type="xsd:string"/>
+     <element name="duplicate" type="xsd:int"/>
+     <element name="avsresult" nillable="true" type="xsd:string"/>
+     <element name="cvv2result" nillable="true" type="xsd:string"/>
+     <element name="batchnumber" nillable="true" type="xsd:string"/>
+     <element name="last4digits" nillable="true" type="xsd:string"/>
+     <element name="actioncode" nillable="true" type="xsd:string"/>
+     <element name="recurbillingamount" nillable="true" type="xsd:string"/>
+     <element name="recurnextbillingdate" nillable="true" type="xsd:string"/>
+     <element name="recurbillingcycle" nillable="true" type="xsd:string"/>
+     <element name="recurbillingmax" nillable="true" type="xsd:string"/>
+     <element name="recurcanceldate" nillable="true" type="xsd:string"/>
+     <element name="recurlastattempted" nillable="true" type="xsd:string"/>
+     <element name="recurbillingstatus" nillable="true" type="xsd:string"/>
+     <element name="recurtotalaccept" nillable="true" type="xsd:string"/>
+     <element name="achrcode" nillable="true" type="xsd:string"/>
+     <element name="transactiontype" nillable="true" type="xsd:string"/>
+     <element name="additionaldata" nillable="true" type="xsd:string"/>
+    </sequence>
+   </complexType>
+   <complexType name="AccountLookup">
+    <sequence>
+     <element name="acctid" nillable="true" type="xsd:string"/>
+     <element name="accountkey" nillable="true" type="xsd:string"/>
+     <element name="subid" nillable="true" type="xsd:string"/>
+     <element name="merchantordernumber" nillable="true" type="xsd:string"/>
+     <element name="merchantpin" nillable="true" type="xsd:string"/>
+     <element name="ipaddress" nillable="true" type="xsd:string"/>
+     <element name="billaddress" nillable="true" type="tns1:address"/>
+     <element name="ssnum" nillable="true" type="xsd:string"/>
+    </sequence>
+   </complexType>
+   <complexType name="ProcessAccountLookupResult">
+    <sequence>
+     <element name="status" nillable="true" type="xsd:string"/>
+     <element name="result" nillable="true" type="xsd:string"/>
+     <element name="historyid" nillable="true" type="xsd:string"/>
+     <element name="orderid" nillable="true" type="xsd:string"/>
+     <element name="refcode" nillable="true" type="xsd:string"/>
+     <element name="authcode" nillable="true" type="xsd:string"/>
+     <element name="paytype" nillable="true" type="xsd:string"/>
+     <element name="last4digits" nillable="true" type="xsd:string"/>
+     <element name="entrymethod" nillable="true" type="xsd:string"/>
+     <element name="firstname" nillable="true" type="xsd:string"/>
+     <element name="lastname" nillable="true" type="xsd:string"/>
+     <element name="phone" nillable="true" type="xsd:string"/>
+     <element name="addr1" nillable="true" type="xsd:string"/>
+     <element name="addr2" nillable="true" type="xsd:string"/>
+     <element name="city" nillable="true" type="xsd:string"/>
+     <element name="state" nillable="true" type="xsd:string"/>
+     <element name="zipcode" nillable="true" type="xsd:string"/>
+     <element name="country" nillable="true" type="xsd:string"/>
+     <element name="additionaldata" nillable="true" type="xsd:string"/>
+    </sequence>
+   </complexType>
+  </schema>
+ </wsdl:types>
+
+   <wsdl:message name="processAuthReverseRequest">
+
+      <wsdl:part name="miscprocess" type="tns1:VoidCreditPost"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processDebitPostRequest">
+
+      <wsdl:part name="debitpost" type="tns1:DebitReturn"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processCCAuthResponse">
+
+      <wsdl:part name="processCCAuthReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processAccountLookupRequest">
+
+      <wsdl:part name="miscprocess" type="tns1:AccountLookup"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processRecurRetrieveResponse">
+
+      <wsdl:part name="processRecurRetrieveReturn" type="tns1:ProcessRecurRetrieveResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processRecurRetrieveRequest">
+
+      <wsdl:part name="miscprocess" type="tns1:RecurRetrieve"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processC21ICLSaleRequest">
+
+      <wsdl:part name="ckinfo" type="tns1:C21Info"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processC21CreditRequest">
+
+      <wsdl:part name="miscprocess" type="tns1:VoidCreditC21"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processCCAuthenticationResponse">
+
+      <wsdl:part name="processCCAuthenticationReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processProfileRetrieveRequest">
+
+      <wsdl:part name="miscprocess" type="tns1:ProfileRetrieve"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processExtACHSaleRequest">
+
+      <wsdl:part name="ckinfo" type="tns1:ACHInfo"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processExtACHProfileAddResponse">
+
+      <wsdl:part name="processExtACHProfileAddReturn" type="tns1:ProcessProfileResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processCreditResponse">
+
+      <wsdl:part name="processCreditReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processACHSaleRequest">
+
+      <wsdl:part name="ckinfo" type="tns1:ACHInfo"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processDebitReturnRequest">
+
+      <wsdl:part name="debitreturn" type="tns1:DebitReturn"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processDebitReturnResponse">
+
+      <wsdl:part name="processDebitReturnReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processDebitPostResponse">
+
+      <wsdl:part name="processDebitPostReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processACHVerificationResponse">
+
+      <wsdl:part name="processACHVerificationReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processCCSaleRequest">
+
+      <wsdl:part name="ccinfo" type="tns1:CreditCardInfo"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processC21ICLSaleResponse">
+
+      <wsdl:part name="processC21ICLSaleReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processDebitVoidRequest">
+
+      <wsdl:part name="debitvoid" type="tns1:DebitReturn"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processDebitPinlessRequest">
+
+      <wsdl:part name="ccinfo" type="tns1:CreditCardInfo"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processDebitSalesResponse">
+
+      <wsdl:part name="processDebitSalesReturn" type="tns1:ProcessResults"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processProfileSaleResponse">
+
+      <wsdl:part name="processProfileSaleReturn" type="tns1:ProcessProfileResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processC21CreditResponse">
+
+      <wsdl:part name="processC21CreditReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processCCPostResponse">
+
+      <wsdl:part name="processCCPostReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processProfileDeleteRequest">
+
+      <wsdl:part name="miscprocess" type="tns1:ProfileDelete"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processCCPostRequest">
+
+      <wsdl:part name="miscprocess" type="tns1:VoidCreditPost"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processCCSalesRequest">
+
+      <wsdl:part name="ccinfo" type="tns1:CreditCardInfo"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processCCVoidRequest">
+
+      <wsdl:part name="miscprocess" type="tns1:VoidCreditPost"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processProfileUpdateResponse">
+
+      <wsdl:part name="processProfileUpdateReturn" type="tns1:ProcessProfileResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processC21ICLVoidResponse">
+
+      <wsdl:part name="processC21ICLVoidReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processACHCreditRequest">
+
+      <wsdl:part name="ckinfo" type="tns1:ACHInfo"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processDebitSaleRequest">
+
+      <wsdl:part name="debitinfo" type="tns1:DebitInfo"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processExtACHCreditResponse">
+
+      <wsdl:part name="processExtACHCreditReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processDebitAuthResponse">
+
+      <wsdl:part name="processDebitAuthReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processDebitAuthRequest">
+
+      <wsdl:part name="debitinfo" type="tns1:DebitInfo"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processExtACHSaleResponse">
+
+      <wsdl:part name="processExtACHSaleReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processDebitVoidResponse">
+
+      <wsdl:part name="processDebitVoidReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processCCCreditResponse">
+
+      <wsdl:part name="processCCCreditReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processProfileSaleRequest">
+
+      <wsdl:part name="miscprocess" type="tns1:ProfileSale"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processCCAuthsResponse">
+
+      <wsdl:part name="processCCAuthsReturn" type="tns1:ProcessResults"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processDebitPinlessResponse">
+
+      <wsdl:part name="processDebitPinlessReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processCCSaleResponse">
+
+      <wsdl:part name="processCCSaleReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processVoidResponse">
+
+      <wsdl:part name="processVoidReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processCCCreditsResponse">
+
+      <wsdl:part name="processCCCreditsReturn" type="tns1:ProcessResults"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processCreditRequest">
+
+      <wsdl:part name="miscprocess" type="tns1:VoidCreditPost"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processExtACHConsumerDisbursementRequest">
+
+      <wsdl:part name="ckinfo" type="tns1:ACHInfo"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processDebitReturnsResponse">
+
+      <wsdl:part name="processDebitReturnsReturn" type="tns1:ProcessResults"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processCCProfileAddRequest">
+
+      <wsdl:part name="ccinfo" type="tns1:CreditCardInfo"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processCCAuthRequest">
+
+      <wsdl:part name="ccinfo" type="tns1:CreditCardInfo"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processExtACHCreditRequest">
+
+      <wsdl:part name="miscprocess" type="tns1:VoidCreditPost"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processACHCreditResponse">
+
+      <wsdl:part name="processACHCreditReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processExtACHVoidRequest">
+
+      <wsdl:part name="miscprocess" type="tns1:VoidCreditPost"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processCCVoidResponse">
+
+      <wsdl:part name="processCCVoidReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processAuthReverseResponse">
+
+      <wsdl:part name="processAuthReverseReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processExtACHProfileAddRequest">
+
+      <wsdl:part name="achinfo" type="tns1:ACHInfo"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processCCAuthsRequest">
+
+      <wsdl:part name="ccinfo" type="tns1:CreditCardInfo"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processCCAuthenticationRequest">
+
+      <wsdl:part name="ccinfo" type="tns1:CreditCardInfo"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processAccountLookupResponse">
+
+      <wsdl:part name="processAccountLookupReturn" type="tns1:ProcessAccountLookupResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processVoidRequest">
+
+      <wsdl:part name="miscprocess" type="tns1:VoidCreditPost"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processC21SaleRequest">
+
+      <wsdl:part name="ckinfo" type="tns1:C21Info"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processTransRetrieveResponse">
+
+      <wsdl:part name="processTransRetrieveReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processCKProfileAddResponse">
+
+      <wsdl:part name="processCKProfileAddReturn" type="tns1:ProcessProfileResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processCCCreditRequest">
+
+      <wsdl:part name="ccinfo" type="tns1:CreditCardInfo"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processProfileRetrieveResponse">
+
+      <wsdl:part name="processProfileRetrieveReturn" type="tns1:ProcessProfileResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processExtACHVoidResponse">
+
+      <wsdl:part name="processExtACHVoidReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processExtACHConsumerDisbursementResponse">
+
+      <wsdl:part name="processExtACHConsumerDisbursementReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processCCCreditsRequest">
+
+      <wsdl:part name="ccinfo" type="tns1:CreditCardInfo"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processDebitReturnsRequest">
+
+      <wsdl:part name="debitreturn" type="tns1:DebitReturn"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processProfileCreditRequest">
+
+      <wsdl:part name="miscprocess" type="tns1:ProfileCredit"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processC21ICLVoidRequest">
+
+      <wsdl:part name="miscprocess" type="tns1:VoidCreditC21"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processACHVerificationRequest">
+
+      <wsdl:part name="ckinfo" type="tns1:ACHInfo"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processC21SaleResponse">
+
+      <wsdl:part name="processC21SaleReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processProfileCreditResponse">
+
+      <wsdl:part name="processProfileCreditReturn" type="tns1:ProcessProfileResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processCCProfileAddResponse">
+
+      <wsdl:part name="processCCProfileAddReturn" type="tns1:ProcessProfileResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processProfileUpdateRequest">
+
+      <wsdl:part name="miscprocess" type="tns1:ProfileUpdate"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processC21VoidRequest">
+
+      <wsdl:part name="miscprocess" type="tns1:VoidCreditC21"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processC21VoidResponse">
+
+      <wsdl:part name="processC21VoidReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processIncrementalAuthRequest">
+
+      <wsdl:part name="miscprocess" type="tns1:VoidCreditPost"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processACHSaleResponse">
+
+      <wsdl:part name="processACHSaleReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processC21ICLCreditResponse">
+
+      <wsdl:part name="processC21ICLCreditReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processProfileDeleteResponse">
+
+      <wsdl:part name="processProfileDeleteReturn" type="tns1:ProcessProfileResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processTransRetrieveRequest">
+
+      <wsdl:part name="miscprocess" type="tns1:TransRetrieve"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processCKProfileAddRequest">
+
+      <wsdl:part name="achinfo" type="tns1:ACHInfo"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processIncrementalAuthResponse">
+
+      <wsdl:part name="processIncrementalAuthReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processDebitSalesRequest">
+
+      <wsdl:part name="debitinfo" type="tns1:DebitInfo"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processDebitSaleResponse">
+
+      <wsdl:part name="processDebitSaleReturn" type="tns1:ProcessResult"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processC21ICLCreditRequest">
+
+      <wsdl:part name="miscprocess" type="tns1:VoidCreditC21"/>
+
+   </wsdl:message>
+
+   <wsdl:message name="processCCSalesResponse">
+
+      <wsdl:part name="processCCSalesReturn" type="tns1:ProcessResults"/>
+
+   </wsdl:message>
+
+   <wsdl:portType name="TransactionSOAPBindingImpl">
+
+      <wsdl:operation name="processCCSale" parameterOrder="ccinfo">
+
+         <wsdl:input message="impl:processCCSaleRequest" name="processCCSaleRequest"/>
+
+         <wsdl:output message="impl:processCCSaleResponse" name="processCCSaleResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processCCAuth" parameterOrder="ccinfo">
+
+         <wsdl:input message="impl:processCCAuthRequest" name="processCCAuthRequest"/>
+
+         <wsdl:output message="impl:processCCAuthResponse" name="processCCAuthResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processCCVoid" parameterOrder="miscprocess">
+
+         <wsdl:input message="impl:processCCVoidRequest" name="processCCVoidRequest"/>
+
+         <wsdl:output message="impl:processCCVoidResponse" name="processCCVoidResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processCCPost" parameterOrder="miscprocess">
+
+         <wsdl:input message="impl:processCCPostRequest" name="processCCPostRequest"/>
+
+         <wsdl:output message="impl:processCCPostResponse" name="processCCPostResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processACHSale" parameterOrder="ckinfo">
+
+         <wsdl:input message="impl:processACHSaleRequest" name="processACHSaleRequest"/>
+
+         <wsdl:output message="impl:processACHSaleResponse" name="processACHSaleResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processACHVerification" parameterOrder="ckinfo">
+
+         <wsdl:input message="impl:processACHVerificationRequest" name="processACHVerificationRequest"/>
+
+         <wsdl:output message="impl:processACHVerificationResponse" name="processACHVerificationResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processC21Sale" parameterOrder="ckinfo">
+
+         <wsdl:input message="impl:processC21SaleRequest" name="processC21SaleRequest"/>
+
+         <wsdl:output message="impl:processC21SaleResponse" name="processC21SaleResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processCCCredit" parameterOrder="ccinfo">
+
+         <wsdl:input message="impl:processCCCreditRequest" name="processCCCreditRequest"/>
+
+         <wsdl:output message="impl:processCCCreditResponse" name="processCCCreditResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processACHCredit" parameterOrder="ckinfo">
+
+         <wsdl:input message="impl:processACHCreditRequest" name="processACHCreditRequest"/>
+
+         <wsdl:output message="impl:processACHCreditResponse" name="processACHCreditResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processCredit" parameterOrder="miscprocess">
+
+         <wsdl:input message="impl:processCreditRequest" name="processCreditRequest"/>
+
+         <wsdl:output message="impl:processCreditResponse" name="processCreditResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processDebitSale" parameterOrder="debitinfo">
+
+         <wsdl:input message="impl:processDebitSaleRequest" name="processDebitSaleRequest"/>
+
+         <wsdl:output message="impl:processDebitSaleResponse" name="processDebitSaleResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processDebitReturn" parameterOrder="debitreturn">
+
+         <wsdl:input message="impl:processDebitReturnRequest" name="processDebitReturnRequest"/>
+
+         <wsdl:output message="impl:processDebitReturnResponse" name="processDebitReturnResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processCCProfileAdd" parameterOrder="ccinfo">
+
+         <wsdl:input message="impl:processCCProfileAddRequest" name="processCCProfileAddRequest"/>
+
+         <wsdl:output message="impl:processCCProfileAddResponse" name="processCCProfileAddResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processCKProfileAdd" parameterOrder="achinfo">
+
+         <wsdl:input message="impl:processCKProfileAddRequest" name="processCKProfileAddRequest"/>
+
+         <wsdl:output message="impl:processCKProfileAddResponse" name="processCKProfileAddResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processProfileRetrieve" parameterOrder="miscprocess">
+
+         <wsdl:input message="impl:processProfileRetrieveRequest" name="processProfileRetrieveRequest"/>
+
+         <wsdl:output message="impl:processProfileRetrieveResponse" name="processProfileRetrieveResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processProfileDelete" parameterOrder="miscprocess">
+
+         <wsdl:input message="impl:processProfileDeleteRequest" name="processProfileDeleteRequest"/>
+
+         <wsdl:output message="impl:processProfileDeleteResponse" name="processProfileDeleteResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processProfileSale" parameterOrder="miscprocess">
+
+         <wsdl:input message="impl:processProfileSaleRequest" name="processProfileSaleRequest"/>
+
+         <wsdl:output message="impl:processProfileSaleResponse" name="processProfileSaleResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processProfileUpdate" parameterOrder="miscprocess">
+
+         <wsdl:input message="impl:processProfileUpdateRequest" name="processProfileUpdateRequest"/>
+
+         <wsdl:output message="impl:processProfileUpdateResponse" name="processProfileUpdateResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processProfileCredit" parameterOrder="miscprocess">
+
+         <wsdl:input message="impl:processProfileCreditRequest" name="processProfileCreditRequest"/>
+
+         <wsdl:output message="impl:processProfileCreditResponse" name="processProfileCreditResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processC21Void" parameterOrder="miscprocess">
+
+         <wsdl:input message="impl:processC21VoidRequest" name="processC21VoidRequest"/>
+
+         <wsdl:output message="impl:processC21VoidResponse" name="processC21VoidResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processC21Credit" parameterOrder="miscprocess">
+
+         <wsdl:input message="impl:processC21CreditRequest" name="processC21CreditRequest"/>
+
+         <wsdl:output message="impl:processC21CreditResponse" name="processC21CreditResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processExtACHVoid" parameterOrder="miscprocess">
+
+         <wsdl:input message="impl:processExtACHVoidRequest" name="processExtACHVoidRequest"/>
+
+         <wsdl:output message="impl:processExtACHVoidResponse" name="processExtACHVoidResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processExtACHCredit" parameterOrder="miscprocess">
+
+         <wsdl:input message="impl:processExtACHCreditRequest" name="processExtACHCreditRequest"/>
+
+         <wsdl:output message="impl:processExtACHCreditResponse" name="processExtACHCreditResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processExtACHSale" parameterOrder="ckinfo">
+
+         <wsdl:input message="impl:processExtACHSaleRequest" name="processExtACHSaleRequest"/>
+
+         <wsdl:output message="impl:processExtACHSaleResponse" name="processExtACHSaleResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processExtACHConsumerDisbursement" parameterOrder="ckinfo">
+
+         <wsdl:input message="impl:processExtACHConsumerDisbursementRequest" name="processExtACHConsumerDisbursementRequest"/>
+
+         <wsdl:output message="impl:processExtACHConsumerDisbursementResponse" name="processExtACHConsumerDisbursementResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processTransRetrieve" parameterOrder="miscprocess">
+
+         <wsdl:input message="impl:processTransRetrieveRequest" name="processTransRetrieveRequest"/>
+
+         <wsdl:output message="impl:processTransRetrieveResponse" name="processTransRetrieveResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processRecurRetrieve" parameterOrder="miscprocess">
+
+         <wsdl:input message="impl:processRecurRetrieveRequest" name="processRecurRetrieveRequest"/>
+
+         <wsdl:output message="impl:processRecurRetrieveResponse" name="processRecurRetrieveResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processC21ICLSale" parameterOrder="ckinfo">
+
+         <wsdl:input message="impl:processC21ICLSaleRequest" name="processC21ICLSaleRequest"/>
+
+         <wsdl:output message="impl:processC21ICLSaleResponse" name="processC21ICLSaleResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processC21ICLVoid" parameterOrder="miscprocess">
+
+         <wsdl:input message="impl:processC21ICLVoidRequest" name="processC21ICLVoidRequest"/>
+
+         <wsdl:output message="impl:processC21ICLVoidResponse" name="processC21ICLVoidResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processC21ICLCredit" parameterOrder="miscprocess">
+
+         <wsdl:input message="impl:processC21ICLCreditRequest" name="processC21ICLCreditRequest"/>
+
+         <wsdl:output message="impl:processC21ICLCreditResponse" name="processC21ICLCreditResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processCCAuthentication" parameterOrder="ccinfo">
+
+         <wsdl:input message="impl:processCCAuthenticationRequest" name="processCCAuthenticationRequest"/>
+
+         <wsdl:output message="impl:processCCAuthenticationResponse" name="processCCAuthenticationResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processCCSales" parameterOrder="ccinfo">
+
+         <wsdl:input message="impl:processCCSalesRequest" name="processCCSalesRequest"/>
+
+         <wsdl:output message="impl:processCCSalesResponse" name="processCCSalesResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processCCAuths" parameterOrder="ccinfo">
+
+         <wsdl:input message="impl:processCCAuthsRequest" name="processCCAuthsRequest"/>
+
+         <wsdl:output message="impl:processCCAuthsResponse" name="processCCAuthsResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processCCCredits" parameterOrder="ccinfo">
+
+         <wsdl:input message="impl:processCCCreditsRequest" name="processCCCreditsRequest"/>
+
+         <wsdl:output message="impl:processCCCreditsResponse" name="processCCCreditsResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processDebitSales" parameterOrder="debitinfo">
+
+         <wsdl:input message="impl:processDebitSalesRequest" name="processDebitSalesRequest"/>
+
+         <wsdl:output message="impl:processDebitSalesResponse" name="processDebitSalesResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processDebitReturns" parameterOrder="debitreturn">
+
+         <wsdl:input message="impl:processDebitReturnsRequest" name="processDebitReturnsRequest"/>
+
+         <wsdl:output message="impl:processDebitReturnsResponse" name="processDebitReturnsResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processDebitAuth" parameterOrder="debitinfo">
+
+         <wsdl:input message="impl:processDebitAuthRequest" name="processDebitAuthRequest"/>
+
+         <wsdl:output message="impl:processDebitAuthResponse" name="processDebitAuthResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processDebitVoid" parameterOrder="debitvoid">
+
+         <wsdl:input message="impl:processDebitVoidRequest" name="processDebitVoidRequest"/>
+
+         <wsdl:output message="impl:processDebitVoidResponse" name="processDebitVoidResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processDebitPost" parameterOrder="debitpost">
+
+         <wsdl:input message="impl:processDebitPostRequest" name="processDebitPostRequest"/>
+
+         <wsdl:output message="impl:processDebitPostResponse" name="processDebitPostResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processVoid" parameterOrder="miscprocess">
+
+         <wsdl:input message="impl:processVoidRequest" name="processVoidRequest"/>
+
+         <wsdl:output message="impl:processVoidResponse" name="processVoidResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processDebitPinless" parameterOrder="ccinfo">
+
+         <wsdl:input message="impl:processDebitPinlessRequest" name="processDebitPinlessRequest"/>
+
+         <wsdl:output message="impl:processDebitPinlessResponse" name="processDebitPinlessResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processAccountLookup" parameterOrder="miscprocess">
+
+         <wsdl:input message="impl:processAccountLookupRequest" name="processAccountLookupRequest"/>
+
+         <wsdl:output message="impl:processAccountLookupResponse" name="processAccountLookupResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processAuthReverse" parameterOrder="miscprocess">
+
+         <wsdl:input message="impl:processAuthReverseRequest" name="processAuthReverseRequest"/>
+
+         <wsdl:output message="impl:processAuthReverseResponse" name="processAuthReverseResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processIncrementalAuth" parameterOrder="miscprocess">
+
+         <wsdl:input message="impl:processIncrementalAuthRequest" name="processIncrementalAuthRequest"/>
+
+         <wsdl:output message="impl:processIncrementalAuthResponse" name="processIncrementalAuthResponse"/>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processExtACHProfileAdd" parameterOrder="achinfo">
+
+         <wsdl:input message="impl:processExtACHProfileAddRequest" name="processExtACHProfileAddRequest"/>
+
+         <wsdl:output message="impl:processExtACHProfileAddResponse" name="processExtACHProfileAddResponse"/>
+
+      </wsdl:operation>
+
+   </wsdl:portType>
+
+   <wsdl:binding name="TransactionServiceSoapBinding" type="impl:TransactionSOAPBindingImpl">
+
+      <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+      <wsdl:operation name="processCCSale">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processCCSaleRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processCCSaleResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processCCAuth">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processCCAuthRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processCCAuthResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processCCVoid">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processCCVoidRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processCCVoidResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processCCPost">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processCCPostRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processCCPostResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processACHSale">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processACHSaleRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processACHSaleResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processACHVerification">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processACHVerificationRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processACHVerificationResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processC21Sale">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processC21SaleRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processC21SaleResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processCCCredit">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processCCCreditRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processCCCreditResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processACHCredit">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processACHCreditRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processACHCreditResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processCredit">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processCreditRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processCreditResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processDebitSale">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processDebitSaleRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processDebitSaleResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processDebitReturn">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processDebitReturnRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processDebitReturnResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processCCProfileAdd">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processCCProfileAddRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processCCProfileAddResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processCKProfileAdd">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processCKProfileAddRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processCKProfileAddResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processProfileRetrieve">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processProfileRetrieveRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processProfileRetrieveResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processProfileDelete">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processProfileDeleteRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processProfileDeleteResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processProfileSale">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processProfileSaleRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processProfileSaleResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processProfileUpdate">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processProfileUpdateRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processProfileUpdateResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processProfileCredit">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processProfileCreditRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processProfileCreditResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processC21Void">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processC21VoidRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processC21VoidResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processC21Credit">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processC21CreditRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processC21CreditResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processExtACHVoid">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processExtACHVoidRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processExtACHVoidResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processExtACHCredit">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processExtACHCreditRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processExtACHCreditResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processExtACHSale">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processExtACHSaleRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processExtACHSaleResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processExtACHConsumerDisbursement">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processExtACHConsumerDisbursementRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processExtACHConsumerDisbursementResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processTransRetrieve">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processTransRetrieveRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processTransRetrieveResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processRecurRetrieve">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processRecurRetrieveRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processRecurRetrieveResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processC21ICLSale">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processC21ICLSaleRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processC21ICLSaleResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processC21ICLVoid">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processC21ICLVoidRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processC21ICLVoidResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processC21ICLCredit">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processC21ICLCreditRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processC21ICLCreditResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processCCAuthentication">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processCCAuthenticationRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processCCAuthenticationResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processCCSales">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processCCSalesRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processCCSalesResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processCCAuths">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processCCAuthsRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processCCAuthsResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processCCCredits">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processCCCreditsRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processCCCreditsResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processDebitSales">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processDebitSalesRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processDebitSalesResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processDebitReturns">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processDebitReturnsRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processDebitReturnsResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processDebitAuth">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processDebitAuthRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processDebitAuthResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processDebitVoid">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processDebitVoidRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processDebitVoidResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processDebitPost">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processDebitPostRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processDebitPostResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processVoid">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processVoidRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processVoidResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processDebitPinless">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processDebitPinlessRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processDebitPinlessResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processAccountLookup">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processAccountLookupRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processAccountLookupResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processAuthReverse">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processAuthReverseRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processAuthReverseResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processIncrementalAuth">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processIncrementalAuthRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processIncrementalAuthResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+      <wsdl:operation name="processExtACHProfileAdd">
+
+         <wsdlsoap:operation soapAction=""/>
+
+         <wsdl:input name="processExtACHProfileAddRequest">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MPTransProcess" use="encoded"/>
+
+         </wsdl:input>
+
+         <wsdl:output name="processExtACHProfileAddResponse">
+
+            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://trans.merchantsolution.com/Web/services/TransactionService" use="encoded"/>
+
+         </wsdl:output>
+
+      </wsdl:operation>
+
+   </wsdl:binding>
+
+   <wsdl:service name="TransactionSOAPBindingImplService">
+
+      <wsdl:port binding="impl:TransactionServiceSoapBinding" name="TransactionService">
+
+         <wsdlsoap:address location="https://trans.merchantsolution.com/Web/services/TransactionService"/>
+
+      </wsdl:port>
+
+   </wsdl:service>
+
+</wsdl:definitions>
\ No newline at end of file
diff --git a/documentation/Registrations.php b/documentation/Registrations.php
new file mode 100644 (file)
index 0000000..64275e9
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+/**
+ * Registrations Application
+ * Admin Index
+ *
+ * PHP version 5
+ *
+ * @category Admin
+ * @package  Registrations
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  SVN: $Id: Registrations.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link     http://{site}/admin/Registrations
+ */
+
+// Get main site setup
+require_once '../../setup.phtml';
+
+// Call common Registrations application
+require_once GLM_APP_BASE.'Common/Registrations_V3/admin/index.phtml';
+
+?>
\ No newline at end of file
diff --git a/documentation/Sites_Using.txt b/documentation/Sites_Using.txt
new file mode 100644 (file)
index 0000000..020e9a5
--- /dev/null
@@ -0,0 +1,45 @@
+Sites using the Common Registrations Application
+------------------------------------------------
+
+Site                           Version Server  DB Server       Database                Status          Members Reg     Users   Sub-Cats        Select By Month CC Processor
+-------------------------------        ------- ------- -----------     -------------------     -----------     ------- -----------     -----------     --------------- ---------------------------
+www.ucgaylord.org              V3      ws0     ds3             ucgaylord               Production      No              Yes     No              No              Merchant Solutions
+www.dioceseofgaylord.org       V3      dev53   devdb           diocese                 Development     No              Yes     No              Yes             Manual
+www.francetoursandguides.com   V3      ws6     ds4             francetoursandguides    Development 
+www.harborcountry.org          V3      ws0     ds3             harborcountry           Development
+forms.nwhealth.org             V2.53   ws0     ds4             nwhealth                Production      No              No      No              No              Authorize.net
+www.myig.org                   V2.53   ws0     ds4             myig                    Production      No              No      No              No              Authorize.net                           
+www.miseniorcenters.org                V0      ws0
+www.warmemorialhospital.org    V3      ws6     devdb           warmemorialhospital     Development     NO              Yes     No              No                              
+
+#### Don't think this is in use anymore. www.bayviewassociation.org            V2.53   ws0             ds3                     bayviewassociation      Production      Yes             Yes                     Yes                     No                              Authorize.net
+
+Using Non-Common Version
+------------------------
+demo.gaslightmedia.com
+www.circlemichigan.com
+www.gaylordschools.com
+www.migcsa.org
+www.otsegocountymi.gov
+
+
+Merchant Account Information
+----------------------------
+
+Merchant Solutions
+
+       Test Merchant Account
+       AcctID:                 MSDMO
+       Userid:                 Cscott
+       Password:               Glm3Merch#Sol
+       MerchantPin:    BVR0V3462V5GmZK03MXtWE5u9HeUJX62
+       
+       
+       UC Gaylord 
+       Account ID:             MSHLG
+       User ID:                Admin
+       Password:               Password@55
+       MerchantPin:    xfuqfA0mVk85vim0aEuysgfubV3LBdpT
+       
+       
+
diff --git a/documentation/application.sql b/documentation/application.sql
new file mode 100644 (file)
index 0000000..d8a9bb0
--- /dev/null
@@ -0,0 +1,423 @@
+
+CREATE SCHEMA registrations;
+
+CREATE TABLE registrations.magicform (
+    id SERIAL,
+    form_id text,
+    custom_id text,
+    title text,
+    type smallint,
+    descr text,
+    active boolean,
+    required boolean,
+    data1 text,
+    sort smallint,
+    expanded boolean,
+    style text,
+    file text,
+    cols integer,
+    rows integer,
+    size text,
+    format text,
+    default_val text
+);
+
+ALTER TABLE registrations.magicform OWNER TO postgres;
+ALTER TABLE registrations.magicform_id_seq OWNER TO postgres;
+
+CREATE TABLE registrations.mf_data (
+    id SERIAL,
+    fiid integer,
+    form_id text,
+    field_id text,
+    level integer,
+    title text,
+    type integer,
+    txt_type text,
+    value text,
+    numb_value double precision,
+    txt_value text,
+    opt_num integer,
+    valid boolean,
+    required boolean,
+    failure text
+);
+
+ALTER TABLE registrations.mf_data OWNER TO postgres;
+ALTER TABLE registrations.mf_data_id_seq OWNER TO postgres;
+
+CREATE TABLE registrations.mf_temp_file (
+    id SERIAL,
+    file_name text,
+    upload_time date
+);
+
+ALTER TABLE registrations.mf_temp_file OWNER TO postgres;
+ALTER TABLE registrations.mf_temp_file_id_seq OWNER TO postgres;
+
+CREATE TABLE registrations.misc (
+    id SERIAL,
+    regbulletin text,
+    cat_page_text text,
+    sub_cat_page_text text,
+    select_page_text text,
+    event_page_text text,
+    cart_page_text text,
+    checkout_page_text text,
+    summary_page_text text,
+    regterms text,
+    pay_codes text,
+    notify_text text,
+    notify_subject text,
+    req_ack_text text,
+    req_ack_subject text
+);
+
+ALTER TABLE registrations.misc OWNER TO postgres;
+ALTER TABLE registrations.misc_id_seq OWNER TO postgres;
+
+CREATE TABLE registrations.todo (
+    id SERIAL,
+    name text,
+    restricted bool,
+    med_info bool,
+    image text,
+    descr text,
+    sort integer
+);
+
+ALTER TABLE registrations.todo OWNER TO postgres;
+ALTER TABLE registrations.todo_id_seq OWNER TO postgres;
+
+
+CREATE TABLE registrations.category (
+    id SERIAL,
+    todo integer,
+    name text,
+    list_name text,
+    image text,
+    descr text,
+    sort integer
+);
+
+ALTER TABLE registrations.category OWNER TO postgres;
+ALTER TABLE registrations.category_id_seq OWNER TO postgres;
+
+CREATE TABLE registrations.attribute (
+    id SERIAL,
+    name text,
+    descr text,
+    sort integer
+);
+
+ALTER TABLE registrations.attribute OWNER TO postgres;
+ALTER TABLE registrations.attribute_id_seq OWNER TO postgres;
+
+CREATE TABLE registrations.reg (
+    id SERIAL,
+    category integer,
+    todo integer,
+    attribute integer,
+    name text,
+    short_descr text,
+    descr text,
+    notify_email text,
+    active boolean,
+    image text,
+    date_specific boolean,
+    date_select text,
+       use_calendar boolean,
+    start_date date,
+    end_date date,
+    ask_date boolean,
+    dates text,
+    times text,
+    duration text,
+    location text,
+    instructor text,
+    cutoff_date date,
+    cutoff_date2 date,
+    cutoff_date3 date,
+    cutoff_date4 date,
+    rates_descr text,
+    rates_1_memb text,
+    rates_1 text,
+    rates_2 text,
+    rates_2_memb text,
+    rates_3 text,
+    rates_3_memb text,
+    rates_4 text,
+    rates_4_memb text,
+    attendee_limit boolean,
+    attendee_max integer,
+    attendee_max_per_sub integer,
+    attendee_count integer,
+    form_revision integer,
+    sort integer,
+    pay_codes text,
+    restrict_comp_code boolean,
+       restrict_check boolean,
+       restrict_cash boolean,
+       restrict_credit_card boolean,
+    terms text,
+    notes text,
+    need_attendees boolean,
+    require_registered_user boolean,
+    event_code text,
+    reg_file text,
+    reg_file_title text
+);
+
+
+ALTER TABLE registrations.reg OWNER TO postgres;
+ALTER TABLE registrations.reg_id_seq OWNER TO postgres;
+
+CREATE TABLE registrations.reg_attr (
+       id SERIAL,
+       reg integer,
+       attr integer
+);
+
+ALTER TABLE registrations.reg_attr OWNER TO postgres;
+ALTER TABLE registrations.reg_attr_id_seq OWNER TO postgres;
+
+CREATE TABLE registrations.reg_req (
+    id SERIAL,
+    user_trace_info text,
+    cart_serial text,
+    fname text,
+    lname text,
+    org text,
+    title text,
+    addr1 text,
+    addr2 text,
+    city text,
+    state text,
+    zip text,
+    country text,
+    phone text,
+    fax text,
+    email text,
+    email_ok boolean,
+    registrant integer,
+    is_member boolean,
+    member_id text,
+    contact_same boolean,
+    contact_fname text,
+    contact_lname text,
+    contact_org text,
+    contact_title text,
+    contact_addr1 text,
+    contact_addr2 text,
+    contact_city text,
+    contact_state text,
+    contact_zip text,
+    contact_country text,
+    contact_phone text,
+    contact_fax text,
+    contact_email text,
+    contact_email_ok boolean,
+    date_entered date,
+    pay_type text,
+    pay_code text,
+    status smallint,
+    cc_conf text,
+    total double precision,
+    notes text,
+    summary text,
+    cc_name text,
+    cc_type text,
+    cc_numb text,
+    cc_exp text,
+    cc_cvv text
+);
+
+ALTER TABLE registrations.reg_req OWNER TO postgres;
+ALTER TABLE registrations.reg_req_id_seq OWNER TO postgres;
+
+CREATE INDEX reg_req_id_index ON registrations.reg_req (id);
+CREATE INDEX reg_req_cart_serial_index ON registrations.reg_req (cart_serial);
+
+CREATE TABLE registrations.reg_detail (
+    id SERIAL,
+    reg_req integer,
+    numb_attending smallint,
+    attendees text,
+    charges float,
+    registration integer,
+    reg_start date,
+    reg_end date,
+    desired_date date,
+    notes text,
+    mf_data text,
+    dob date,
+    guardian text,
+    emer_contact text,
+    emer_phone text,
+    med_history text,
+    allergy_med text,
+    cutoff_date date,
+    rate_class text,
+    charges_list text
+);
+
+ALTER TABLE registrations.reg_detail OWNER TO postgres;
+ALTER TABLE registrations.reg_detail_id_seq OWNER TO postgres;
+
+REVOKE ALL ON TABLE registrations.reg_detail FROM PUBLIC;
+REVOKE ALL ON TABLE registrations.reg_detail FROM postgres;
+GRANT ALL ON TABLE registrations.reg_detail TO postgres;
+GRANT ALL ON TABLE registrations.reg_detail TO nobody;
+REVOKE ALL ON SEQUENCE registrations.reg_detail_id_seq FROM PUBLIC;
+REVOKE ALL ON SEQUENCE registrations.reg_detail_id_seq FROM postgres;
+GRANT ALL ON SEQUENCE registrations.reg_detail_id_seq TO postgres;
+GRANT ALL ON SEQUENCE registrations.reg_detail_id_seq TO nobody;
+
+
+CREATE INDEX reg_detail_id_index ON registrations.reg_detail (id);
+CREATE INDEX reg_detail_req_index ON registrations.reg_detail (reg_req);
+CREATE INDEX reg_detail_reg_index ON registrations.reg_detail (registration);
+
+CREATE TABLE registrations.registrant (
+    id SERIAL,
+    user_trace_info text,
+    fname text,
+    lname text,
+    addr1 text,
+    addr2 text,
+    city text,
+    state text,
+    zip text,
+    country text,
+    phone text,
+    email text,
+    email_ok boolean,
+    password text,
+    is_member boolean,
+    member_id text,
+    winter_addr text,
+    winter_phone text,
+    pw_reset_code text
+);
+
+ALTER TABLE registrations.registrant OWNER TO postgres;
+ALTER TABLE registrations.registrant_id_seq OWNER TO postgres;
+
+CREATE INDEX magicform_form_id_index ON registrations.magicform USING btree (form_id);
+CREATE INDEX mf_data_fiid_index ON registrations.mf_data USING btree (fiid);
+CREATE INDEX mf_form_id_index ON registrations.mf_data USING btree (form_id);
+CREATE INDEX registrant_id_index ON registrations.registrant USING btree (id);
+
+
+GRANT ALL ON SCHEMA registrations TO nobody;
+
+REVOKE ALL ON TABLE registrations.magicform FROM PUBLIC;
+REVOKE ALL ON TABLE registrations.magicform FROM postgres;
+GRANT ALL ON TABLE registrations.magicform TO postgres;
+GRANT ALL ON TABLE registrations.magicform TO nobody;
+
+REVOKE ALL ON SEQUENCE registrations.magicform_id_seq FROM PUBLIC;
+REVOKE ALL ON SEQUENCE registrations.magicform_id_seq FROM postgres;
+GRANT ALL ON SEQUENCE registrations.magicform_id_seq TO postgres;
+GRANT ALL ON SEQUENCE registrations.magicform_id_seq TO nobody;
+
+REVOKE ALL ON TABLE registrations.mf_data FROM PUBLIC;
+REVOKE ALL ON TABLE registrations.mf_data FROM postgres;
+GRANT ALL ON TABLE registrations.mf_data TO postgres;
+GRANT ALL ON TABLE registrations.mf_data TO nobody;
+
+REVOKE ALL ON SEQUENCE registrations.mf_data_id_seq FROM PUBLIC;
+REVOKE ALL ON SEQUENCE registrations.mf_data_id_seq FROM postgres;
+GRANT ALL ON SEQUENCE registrations.mf_data_id_seq TO postgres;
+GRANT ALL ON SEQUENCE registrations.mf_data_id_seq TO nobody;
+
+REVOKE ALL ON TABLE registrations.mf_temp_file FROM PUBLIC;
+REVOKE ALL ON TABLE registrations.mf_temp_file FROM postgres;
+GRANT ALL ON TABLE registrations.mf_temp_file TO postgres;
+GRANT ALL ON TABLE registrations.mf_temp_file TO nobody;
+
+REVOKE ALL ON SEQUENCE registrations.mf_temp_file_id_seq FROM PUBLIC;
+REVOKE ALL ON SEQUENCE registrations.mf_temp_file_id_seq FROM postgres;
+GRANT ALL ON SEQUENCE registrations.mf_temp_file_id_seq TO postgres;
+GRANT ALL ON SEQUENCE registrations.mf_temp_file_id_seq TO nobody;
+
+CREATE INDEX mf_temp_file_file_name_index ON registrations.mf_temp_file (file_name);
+CREATE INDEX mf_temp_file_upload_time_index ON registrations.mf_temp_file (upload_time);
+
+REVOKE ALL ON TABLE registrations.misc FROM PUBLIC;
+REVOKE ALL ON TABLE registrations.misc FROM postgres;
+GRANT ALL ON TABLE registrations.misc TO postgres;
+GRANT ALL ON TABLE registrations.misc TO nobody;
+
+REVOKE ALL ON SEQUENCE registrations.misc_id_seq FROM PUBLIC;
+REVOKE ALL ON SEQUENCE registrations.misc_id_seq FROM postgres;
+GRANT ALL ON SEQUENCE registrations.misc_id_seq TO postgres;
+GRANT ALL ON SEQUENCE registrations.misc_id_seq TO nobody;
+
+REVOKE ALL ON TABLE registrations.todo FROM PUBLIC;
+REVOKE ALL ON TABLE registrations.todo FROM postgres;
+GRANT ALL ON TABLE registrations.todo TO postgres;
+GRANT ALL ON TABLE registrations.todo TO nobody;
+
+REVOKE ALL ON TABLE registrations.todo_id_seq FROM PUBLIC;
+REVOKE ALL ON TABLE registrations.todo_id_seq FROM postgres;
+GRANT ALL ON TABLE registrations.todo_id_seq TO postgres;
+GRANT ALL ON TABLE registrations.todo_id_seq TO nobody;
+
+REVOKE ALL ON TABLE registrations.category FROM PUBLIC;
+REVOKE ALL ON TABLE registrations.category FROM postgres;
+GRANT ALL ON TABLE registrations.category TO postgres;
+GRANT ALL ON TABLE registrations.category TO nobody;
+
+REVOKE ALL ON TABLE registrations.category_id_seq FROM PUBLIC;
+REVOKE ALL ON TABLE registrations.category_id_seq FROM postgres;
+GRANT ALL ON TABLE registrations.category_id_seq TO postgres;
+GRANT ALL ON TABLE registrations.category_id_seq TO nobody;
+
+REVOKE ALL ON TABLE registrations.attribute FROM PUBLIC;
+REVOKE ALL ON TABLE registrations.attribute FROM postgres;
+GRANT ALL ON TABLE registrations.attribute TO postgres;
+GRANT ALL ON TABLE registrations.attribute TO nobody;
+
+REVOKE ALL ON TABLE registrations.reg_attr FROM PUBLIC;
+REVOKE ALL ON TABLE registrations.reg_attr FROM postgres;
+GRANT ALL ON TABLE registrations.reg_attr TO postgres;
+GRANT ALL ON TABLE registrations.reg_attr TO nobody;
+
+REVOKE ALL ON TABLE registrations.attribute_id_seq FROM PUBLIC;
+REVOKE ALL ON TABLE registrations.attribute_id_seq FROM postgres;
+GRANT ALL ON TABLE registrations.attribute_id_seq TO postgres;
+GRANT ALL ON TABLE registrations.attribute_id_seq TO nobody;
+
+REVOKE ALL ON TABLE registrations.reg FROM PUBLIC;
+REVOKE ALL ON TABLE registrations.reg FROM postgres;
+GRANT ALL ON TABLE registrations.reg TO postgres;
+GRANT ALL ON TABLE registrations.reg TO nobody;
+
+REVOKE ALL ON SEQUENCE registrations.reg_id_seq FROM PUBLIC;
+REVOKE ALL ON SEQUENCE registrations.reg_id_seq FROM postgres;
+GRANT ALL ON SEQUENCE registrations.reg_id_seq TO postgres;
+GRANT ALL ON SEQUENCE registrations.reg_id_seq TO nobody;
+
+REVOKE ALL ON TABLE registrations.reg_req FROM PUBLIC;
+REVOKE ALL ON TABLE registrations.reg_req FROM postgres;
+GRANT ALL ON TABLE registrations.reg_req TO postgres;
+GRANT ALL ON TABLE registrations.reg_req TO nobody;
+
+REVOKE ALL ON SEQUENCE registrations.reg_req_id_seq FROM PUBLIC;
+REVOKE ALL ON SEQUENCE registrations.reg_req_id_seq FROM postgres;
+GRANT ALL ON SEQUENCE registrations.reg_req_id_seq TO postgres;
+GRANT ALL ON SEQUENCE registrations.reg_req_id_seq TO nobody;
+
+REVOKE ALL ON TABLE registrations.registrant FROM PUBLIC;
+REVOKE ALL ON TABLE registrations.registrant FROM postgres;
+GRANT ALL ON TABLE registrations.registrant TO postgres;
+GRANT ALL ON TABLE registrations.registrant TO nobody;
+
+REVOKE ALL ON SEQUENCE registrations.registrant_id_seq FROM PUBLIC;
+REVOKE ALL ON SEQUENCE registrations.registrant_id_seq FROM postgres;
+GRANT ALL ON SEQUENCE registrations.registrant_id_seq TO postgres;
+GRANT ALL ON SEQUENCE registrations.registrant_id_seq TO nobody;
+
+INSERT INTO registrations.misc (regbulletin, regterms, notify_text, notify_subject, req_ack_text, req_ack_subject) VALUES ('Please select the desired event.', '', 'Instructor E-Mail Subject', 'Instructor E-Mail Body', 'Registration Acknowledgement E-Mail Subject', 'Registration Acknowledgement E-Mail Body');
\ No newline at end of file
diff --git a/documentation/functions_docs.txt b/documentation/functions_docs.txt
new file mode 100644 (file)
index 0000000..988dff1
--- /dev/null
@@ -0,0 +1,2991 @@
+$Id: functions_docs.txt,v 1.2 2009/10/28 18:12:30 cscott Exp $
+************************************************************************
+*                                                                      *
+*              Gaslight Media Standard Function Library                *
+*                                                                             *
+*      Copyright (c) 2000-2004 by Gaslight Media Inc.                     *
+*                                                                             *
+*      FILE:           functions_docs.txt                                     *
+*      VERSION:        1.3                                                    *
+*                                                                             *
+************************************************************************
+
+
+TO DO: 
+------
+
+
+                               
+INDEX
+-----
+
+       Debug Functions
+               bool                    debug_mail( string $to, string $subject, string $message [, string $headers [, string $parameters]] )
+
+       General Functions
+               bool                    CreditVal( string $Num, string $name, string $Accepted )
+               string                  credit_card_check( string $Num )
+               
+       Geographic Functions
+               float                   geo_distance( $lat, $lon, $units )
+               
+
+       Database Abstraction Functions
+
+               bool                    db_connect( string $conn_str, bool $fail_mode )
+               bool                    db_close( int $dbd )
+               bool                    db_pconnect( void )
+               int                     db_exec( int $dbd, string $qs )
+               array                   db_fetch_row( int $res, int $i, string $conn_str )
+               bool                    db_freeresult( int $res )
+               bool                    db_numrows( int $res )
+
+       Auto Functions
+
+               array                   db_auto_get_row( string $qs, int $i, string $conn_str, bool $fail_mode )
+               array[array]    db_auto_get_data( string $qs, string $conn_str, bool $fail_mode, int $rows, int $start )                
+               bool                    db_auto_exec( string $qs, string $conn_str, $fail_mode, $oid )
+               array                   db_data_fields( string $conn_str, string $table )
+               
+       File Functions
+       
+               string                  file_upload( string $form_field, string $file_name, string $destination_path )
+               string                  file_duplicte( string $file_name, string $base_path );
+               bool                    file_delete( string $file_name, string $base_path );
+               string                  file_get( string $file_name, int $max_size );
+               bool                    file_ouput_secure( string $file_name, string $md5, string $path );
+
+       Graphics Functions
+       
+               array                   img_info( $path2image )
+               bool                    graphic_thumb( string $img, string $timg, string $type )
+               bool                    graphic_resize( string $img, string $timg, string $type, int $w, int $h )
+               array                   img_resized( string $path2image, string $path2thumb, string $axis, int $size )
+               array                   img_upload( string $form_field, string $image_name, string $destination_path )
+               string                  process_image( string $image, string $image_name )
+               bool                    delete_image( string $image_name )
+               string                  duplicate_image( string $image_name )
+       
+       General Support Function/Classes
+       
+               class                   timestampfunc
+               float                   pos_value( float $value )       
+               string                  money( float $value )
+               array                   strtoarray( string $data )
+               string                  arraytostr( array $array )
+               string                  replace_tokens( string $s, array $tokens )
+               string                  cond_replace_tokens( string $s, array $tokens )
+               string                  replace_file_tokens( string $s )
+               string                  tableize_array( array $array )
+               string                  admin_field_select( array $fields, char $admin_function )
+               string                  admin_menu_std( string $action, string $a_title, int $id, string $opt, string $options, string $add_menu, string $params )
+               string                  admin_menu( string $action, string $option, string $a_title, int $id )
+               bool                    clean_input( string $var_name, string $type )
+               void                    data_to_url( array $names )
+               void                    url_to_data( array $names )
+               string                  data_to_url( array $data, string $prefix )
+               array                   url_to_data( array $data, string $url, string $start_key )
+               string                  build_nav( array $nav_table, string $menu_title, string $current_item = '', string $sub_menu = '', string $link_data = '' )             
+
+       Category Support Functions      
+
+               string                  category_path_func( string $table_name )
+               array                   cat_get_node( string $table, string $qs, string $order )
+               array                   cat_get_nodes( string $table, string $qs, string $order )
+               array                   cat_get_expanded_nodes( string $table, int $id )
+               bool                    cat_resequence_siblings( string $table, int $parent )
+               array                   cat_move_node( string $table, int $id, int ???????? ) PENDING
+                       
+       High Level Functions
+       
+               array                   get_us_counties( $fail_mode )
+               string                  build_picklist( string $fieldname, array $data, string $selected [, string $type] )
+               string                  build_numeric_picklist( string $fieldname, $starting, $ending )
+               string                  output_template( string $field )
+               string                  calendar_date_select( string $default_value, timestamp $start_date, timestamp $end_date,
+                                                       string $form_name, string $field_name )                                 
+               void                    calendar_display( int $month, int $year, array $date_data )
+               string                  parse_view( string $file_name, $tokens )
+
+       Magic Form Functions
+       
+               array                   magic_form_edit( int $mf_id, array $mf_format, in5 $mf_level )
+               array                   magic_form_display( int $mf_id, array $mf_format, int $mf_level )
+               array                   magic_form_submit( int $mf_id, int $mf_level )
+
+       High Level Functions for Admin Pages
+
+               array                   admin_process_records_r( string $table, string $where, string $order, string $conn_str, int $id, array $fields,
+                                                       string $options, int $rows, string $url, string $action, string $params, string $a_title, string $view
+                                                       string $Option ) 
+               void                    admin_process_records( string $table, string $where, string $order, string $conn_str, int $id, array $fields,
+                                                       string $options, int $rows, string $url, string $action, string $params, string $a_title, string $view
+                                                       string $Option ) 
+
+               array                   admin_list_records_r( string $table, sting $where, string $order, string $conn_str, string $fields, 
+                                                       string $options, int $rows, int $start, string $url, string $action, 
+                                                       string $params, string $filters, string $a_title )
+               void                    admin_list_records( string $table, sting $where, string $order, string $conn_str, string $fields, 
+                                                       string $options, int $rows, int $start, string $url, string $action, 
+                                                       string $params, string $filters, string $a_title )
+
+               array                   admin_new_record_r( string $table, string $conn_str, string $fields,  string $url, string $action, 
+                                                       string $params, string $a_title, string $view )
+               void                    admin_new_record( string $table, string $conn_str, string $fields,  string $url, string $action, 
+                                                       string $params, string $a_title, string $view )
+
+               array                   admin_add_new_record_r( string $table, string $conn_str, string $fields, string $url, 
+                                                       string $action, string $a_title )
+               void                    admin_add_new_record( string $table, string $conn_str, string $fields, string $url, 
+                                                       string $action, string $a_title )
+
+               array                   admin_edit_record_r( string $table, string $conn_str, int $id, string $fields, string $url, 
+                                                       string $action, string $a_title, string $view )
+               void                    admin_edit_record( string $table, string $conn_str, int $id, string $fields, string $url, 
+                                                       string $action, string $a_title, string $view )
+
+               array                   admin_update_record_r( string $table, string $conn_str, int $id, string $fields, string $url, 
+                                                       string $action, string $a_title, string $view )
+               void                    admin_update_record( string $table, string $conn_str, int $id, string $fields, string $url, 
+                                                       string $action, string $a_title, string $view )
+
+               array                   admin_delete_record_r( string $table, string $conn_str, int $id, string $fields, string $options, 
+                                                       string $url, string $action, string $a_title )
+               void                    admin_delete_record( string $table, string $conn_str, int $id, string $fields, string $options, 
+                                                       string $url, string $action, string $a_title )
+
+               array                   admin_confirm_delete_record_r( string $table, string $conn_str, int $id, string $fields, string $url, 
+                                                       string $action, string $a_title, string $view )
+               void                    admin_confirm_delete_record( string $table, string $conn_str, int $id, string $fields, string $url, 
+                                                       string $action, string $a_title, string $view )
+
+               array                   admin_view_record_r( string $table, sting $conn_str, string $id, string $fields, string $url,
+                                                       string $action, string $a_title, string $view, string $id_field )
+               void                    admin_view_record( string $table, sting $conn_str, string $id, string $fields, string $url,
+                                                       string $action, string $a_title, string $view, string $id_field )
+
+               void                    admin_user_login( string $operation, string $conn_str, string $sess_code
+                                                       string $table, string $id_field, string $pw_field,
+                                                       string $user_id, string $password )
+
+       Financial Transaction Functions
+       
+               array                   function authorize_net_aim( fload $amount, string $card_num, string $exp_date, string $card_code, string $currency = '',  
+                                                       string $fname = '', string $lname = '', string $company = '', string $address = '', string $city = '', string $state = '', string $zip = '', string $country = '', 
+                                                       string $phone = '', string $fax = '', string $id = '', string $ip = '', string $tax_id = '',
+                                                       string $email = '',
+                                                       string $invoice = '', string $descr ='',
+                                                       string $ship_fname = '', string $ship_lname = '', string $ship_company = '', string $ship_address = '', string $ship_city = '', string $ship_state = '', 
+                                                       string $ship_zip = '', string $ship_country = ''
+               )
+       
+
+
+       Note on SI_DEBUG levels
+
+       0 = No debug info
+       1 = Output debug for High level functions only
+       2 = Output debug for utilitiy function also
+       3 = Output debug for database abstraction calls and low level functions
+
+
+************************************************************************
+*                                                                      *
+*                       DEBUG FUNCTIONS                                *
+*                                                                      *
+************************************************************************
+
+------------------------------------------------------------------------
+       bool    debug_mail( string $to, string $subject, string $message [, string $headers [, string $parameters]] )
+------------------------------------------------------------------------
+
+If SI_DEBUG is = 0
+
+       Passes all parameters on to the standard PHP mail() function and sends
+       mail.
+       
+If SI_DEBUG is > 0
+
+       Outputs a table showing mail that would be sent by a mail() function
+       call and DOES NOT ACTUALLY SEND THE MAIL. Parameters are the same as 
+       for the PHP mail() function.
+       
+       
+       
+       Parameters
+               $to             Recipient(s)
+               $subject        Message Subject
+               $message        Message Content
+               $headers        Additional Headers
+               $parameters     Additional Parameters
+               
+       Return value:
+               True if debug level is high enough to display mail debug.
+               Otherwise, return value is that of the actual mail() function
+               call.
+               
+
+************************************************************************
+*                                                                      *
+*                       GENERAL FUNCTIONS                              *
+*                                                                             *
+************************************************************************
+
+------------------------------------------------------------------------
+       bool    CreditVal( string $Num, string $Name, string $Accepted )
+------------------------------------------------------------------------
+
+       checks for a valid credit card number doing Luhn check 
+       Parameters 
+               $Num = the credit card number 
+               $Name = the type of card
+                       $Name can be :
+                               mastercard,
+                               visa,
+                               americanexpress,
+                               discover,
+                               dinnercard
+               $Accepted = comma separated list of accepted cards. If not specified, all are accepted.
+       Return value:                                                   
+               returns 
+                       true if number and name are good values
+                       false if not             
+       Global references:                                                      
+               none
+------------------------------------------------------------------------
+       string          credit_card_check( string $Num )
+------------------------------------------------------------------------
+
+       Alternative strong credit card check function. This version
+       returns the type of the credit card if it's a good number. 
+
+       Will accept "0011-0011-0011-0011" as a good card and returns
+       "Test" for the card type.
+
+       Parameters 
+               $Num = the credit card number 
+
+       Return value:                                                   
+               $CardType       Type of card if number is good, otherwise FALSE 
+       Global references:                                                      
+               $tids_cc_array from siteinfo.inc is required
+
+************************************************************************
+*                                                                      *
+*                     GEOGRAPHIC FUNCTIONS                             *
+*                                                                             *
+************************************************************************
+
+------------------------------------------------------------------------
+       float           geo_distance( float $lat1, float $lon1, float $lat2, 
+                                                       float $lon2, string $units )
+------------------------------------------------------------------------
+
+       Calculates the distance between a pair of lat/lon coordinates.
+
+               Distance = 3963.0 * arccos[sin(lat1/57.2958) * sin(lat2/57.2958) + cos(lat1/57.2958) * cos(lat2/57.2958) *  cos(lon2/57.2958 -lon1/57.2958)]
+
+               Results are in Statue Miles
+
+       For future reference
+
+               Bearing = arccos[ ( sin(lat2/57.2958) - sin(lat1/57.2958)??cos(D) ) / ( cos(lat1/57.2958) - sin(D) ) ]
+                       if result is < 0 then Bearing is 360 - result
+  
+       Parameters 
+               $lat1           Latitude of point #1
+               $lon1           Longitude of point #1
+               $lat2           Latitude of point #2
+               $lon2           Longitude of point #2
+               $units          Units of results returned
+                                               Inches, Feet, Yards, Miles (default), Nautical Miles,
+                                               Meters, Kilometers
+
+       Return value:                                                   
+               float           Distance
+               
+       Global references:                                                      
+               
+
+***********************************************************************
+*                                                                      *
+*                DATABASE ABSTRACTION FUNCTIONS                        *
+*                                                                             *
+************************************************************************
+
+------------------------------------------------------------------------
+       index   db_connect( string $conn_str, bool $fail_mode )                                         
+------------------------------------------------------------------------
+
+       Creates a connection to database specified $conn_str, 
+       and returns a boolean for success.                      
+
+       Parameters:                                                             
+               $conn_str       Connect String                                          
+               $fail_mode      Failure Mode
+                                       TRUE    = Abort with HTML
+                                       FALSE   = Return with fail code
+                                                                       
+       Return value:                                                   
+               Returns an index or fails using html_error() function
+                                                                       
+       Global references:                                                      
+               SI_DB_TYPE                                                      
+
+------------------------------------------------------------------------
+       bool    db_close(int dbd)                                               
+------------------------------------------------------------------------
+
+       Closes the connection to database specified by the handle dbd   
+       returns a boolean for success                                   
+
+       Parameters:                                                             
+               dbd -- database connection handle                       
+
+       Return value:                                                   
+               Returns 1 on success 0 if dbd is not a valid connection 
+
+       Global references:                                                      
+               SI_DB_TYPE                                                      
+
+------------------------------------------------------------------------
+       bool    db_pconnect( string $conn_str )                                         
+------------------------------------------------------------------------
+
+Creates a persistant connection to database specified in $conn_str
+and returns a boolean for success.                     
+
+       Parameters:                                                             
+               $conn_str       Connection string
+
+       Return value:
+               Returns 1 on success 0 on failure                       
+
+       Global references:                                                      
+               SI_DB_TYPE                                                      
+               SI_CONN_STR                                             
+                                                                       
+
+------------------------------------------------------------------------
+       int             db_exec(int $dbd, string $qs)                                   
+------------------------------------------------------------------------
+
+Execute an SQL query, * returning a valid result index or zero(0) on   
+failure.                                                               
+
+       Parameters:                                                             
+               int $dbd -- valid database connection descriptor        
+               string $qs -- SQL query string                          
+
+       Return value:                                                   
+               Returns a valid result index on success 0 on failure    
+
+       Global references:                                                      
+               None                                                    
+
+------------------------------------------------------------------------
+       array   db_fetch_row(int $res, int $i )                 
+------------------------------------------------------------------------
+
+Stores the data in associative indices, using the field names as       
+keys.                                                          
+
+       Parameters:                                                             
+               int $res -- valid database result index                 
+               int $i -- row number                                    
+
+       Return value:                                                   
+               Returns an associative array of key-value pairs         
+
+       Global references:                                                      
+               None                                                    
+
+------------------------------------------------------------------------
+       bool    db_freeresult(int $res)                                         
+------------------------------------------------------------------------
+
+Free result memory.                                                    
+
+       Parameters:                                                             
+               int $res -- valid database result index                 
+
+       Return value:                                                   
+               Returns 1 for success 0 for failure                     
+
+       Global references:                                                      
+               None                                                    
+
+------------------------------------------------------------------------
+       bool    db_numrows(int $res)                                            
+------------------------------------------------------------------------
+
+Determine number of rows in a result index                             
+
+       Parameters:                                                             
+               int $res -- valid database result index                 
+
+       Return value:                                                   
+               Returns number of rows
+
+       Global references:                                                      
+               None                                                    
+
+************************************************************************
+*                                                                      *
+*                          AUTO FUNCTIONS                              *
+*                                                                             *
+************************************************************************
+
+------------------------------------------------------------------------
+       array   db_auto_get_row(string $qs, int $i, string $conn_str, bool $fail_mode)                  
+------------------------------------------------------------------------
+
+The auto function for retrieving an array based soley on a query       
+string. This function makes the connection, does the exec, fetches     
+the array, closes the connection, frees memory used by the result,     
+and then returns the array                                             
+
+       Parameters:                                                             
+               string $qs      SQL query string                                
+               int $i          row number                                      
+               $conn_str       Connect String                                          
+               $fail_mode      Failure Mode
+                                       TRUE    = Abort with HTML
+                                       FALSE   = Return with fail code
+
+       Return value:                                                   
+               Returns an associative array of key-value pairs         
+
+       Global references:                                                      
+               None                                                    
+
+
+------------------------------------------------------------------------
+       array[array] db_auto_get_data(string $qs, string $conn_str, bool $fail_mode, int $rows, int $start)
+------------------------------------------------------------------------
+
+The auto function for retrieving an array based soley on a query       
+string. This function makes the connection, does the exec, fetches     
+the array, closes the connection, frees memory used by the result,     
+and then returns the array.
+
+This function will by default retrieve a maximum of 100 results. That
+number may be increased by supplying the $rows value. You can also have
+it retrieve $rows rows starting at $start. This makes it simple to
+ask for the data for a single page of output when doing pagination without
+having to return all matched results.
+
+       Parameters:                                                             
+               string $qs      SQL query string                                
+               $conn_str       Connect String                                          
+       Optional Parameters
+               $fail_mode      Failure Mode
+                                       TRUE    = Abort with HTML
+                                       FALSE   = Return with fail code
+               $rows           Maximum number of rows that will be returned
+                                       Defaults to 100
+               $start          Start at this row and retrieve up to $rows rows
+
+       Return value:                                                   
+               Returns an associative array of key-value pairs         
+               Each key is a text value consisting of 2 numbers separated by "|"
+                       i.e. "10|1320" = 10th row out of 1320 total results
+                       (Note that the total is how many matches there are and may
+                        be more than $rows.) 
+
+       Global references:                                                      
+               None                                                    
+
+------------------------------------------------------------------------
+       bool    db_auto_exec(string $qs, string $conn_str, bool $fail_mode )                                    
+------------------------------------------------------------------------
+
+The auto function for executing a query.                               
+This function makes the connection, does the exec, fetches             
+the array, closes the connection, frees memory used by the result,     
+and then returns success (not a valid result index)                    
+
+       Parameters:                                                             
+               string $qs      SQL query string                                
+               $conn_str       Connect String                                          
+
+       Return value:                                                   
+               Returns 1 (or oid, if available) for success 0 for failure                      
+
+       Global references:                                                      
+               None                                                    
+
+------------------------------------------------------------------------
+       array   db_data_fields( string $conn_str, string $table )                                       
+------------------------------------------------------------------------
+
+       Parameters:                                                             
+               $conn_str       Connect String                                          
+               $table          Database Table Name
+
+       Return value:                                                   
+               Array of field information
+
+               $fields[{name}]['size'] = Storage size of fields {name}
+               $fields[{name}]['type'] = Field type of field {name}
+
+       Global references:                                                      
+               None                                                    
+
+************************************************************************
+*                                                                      *
+*                          FILE FUNCTIONS                              *
+*                                                                             *
+************************************************************************
+
+
+------------------------------------------------------------------------
+       string  file_upload(string $temp_file, string $file_name, string $base_path)                                  
+------------------------------------------------------------------------
+
+Store away an uploaded file    
+
+       Parameters:                                                             
+               $temp_file      -- Temporary name of uploaded file
+               $file_name      -- $form_field of file with _name               
+               $base_path      -- Optional base path for location of files - Defaults to SI_BASE_PATH
+
+       Return value:                                                   
+               string $new_file_name,
+
+       Global references:                                                      
+
+
+------------------------------------------------------------------------
+       string  file_duplicate( string $file_name, string $base_path )                  
+------------------------------------------------------------------------
+
+Duplicate a stored File and give copy the same name with a "c{n}_" preceeding it.
+The {n} is a serialized number to distinguish the file from any other existing file.
+This function will try serial numbers up to 1000 before giving up.
+
+       Parameters:                                                             
+               $file_name      -- Name of the file to duplicate
+               $base_path      -- Optional base path for location of files - Defaults to SI_BASE_PATH
+
+       Return value:                                                   
+               Returns         Name of duplicate file or '' if failure.
+
+       Global references:                                                      
+
+
+------------------------------------------------------------------------
+       bool    file_delete( string $file_name, string $base_path )                     
+------------------------------------------------------------------------
+
+Delete a stored File                                   
+
+       Parameters:                                                             
+               $file_name -- Name of the file to delete
+               $base_path      -- Optional base path for location of files - Defaults to SI_BASE_PATH
+
+       Return value:                                                   
+               Returns TRUE if all is OK or FALSE if file wasn't there
+
+       Global references:                                                      
+
+
+------------------------------------------------------------------------
+       string  file_get( string $file_name [, int $max_size], string $base_path )
+------------------------------------------------------------------------
+
+Read the specified file and return the results
+
+       Parameters:                                                             
+               $file_name      -- $form_field of image with _name
+               $max_size       -- Optional maximum size of file to read (0=all - default)              
+               $base_path      -- Optional base path for location of files - Defaults to SI_BASE_PATH
+
+       Return value:                                                   
+               string $file_contents   -- Contents of the file or FALSE if error
+
+       Global references:                                                      
+       
+
+------------------------------------------------------------------------
+       bool  file_ouput_secure( string $file_name, string $md5, string $path );
+------------------------------------------------------------------------
+
+Output the specified file from the specified path using secure method to protect directory. 
+
+The directory or file specified should be unreachable via the web server, usually as a result
+of using a .htaccess rule to block access to the directory. The directory must be under SI_BASE_PATH.
+The file is output by actually reading the file and writing out to the browser. Only known mime types
+will work since the mime type needs to be specified when the file is output. This function will attempt
+to determine the mime type and if it can't will use a default type that may not result in desired action
+by the user's browser.
+
+The md5 string is required and must match an md5 string generated by this function. The md5 string is
+created from the file name with SI_FILE_SECRET appended to it. Since the user doesn't know the secret
+string, any messing with the file name will result in a failure. This protects other files in the
+directory when the user attempts to guess their names.
+
+If SI_FILE_SECRET doesn't exist or is empty this function will output an error message and exit.
+
+This function is required for ouput when using the "secure" option for the "file" type field in the
+admin functions.
+
+       Parameters:                                                             
+               $file_name      -- Name of the file to output
+               $md5            -- MD5 String created using file name and SI_FILE_SECRET parameter
+               $base_path      -- Optional base path for location of files - Defaults to SI_BASE_FILE_PATH
+                                       If supplied it is appended to SI_BASE_PATH to come up with
+                                       complete path.
+
+       Return value:                                                   
+               bool            -- True if successful, false if file is not found or md5 doesn't match.
+
+       Global references:                                                      
+               SI_BASE_FILE_PATH
+               SI_BASE_PATH
+               SI_FILE_SECRET
+                       
+
+************************************************************************
+*                                                                      *
+*                        GRAPHICS FUNCTIONS                            *
+*                                                                             *
+************************************************************************
+
+------------------------------------------------------------------------
+       array   img_info( string $path2image )                                   
+------------------------------------------------------------------------
+
+Returns information about an image                     
+
+       Parameters:                                                             
+               $path2image --  path to image
+
+       Return value:                                                   
+               Returns $img_data = Array
+                       ['width']               = Width
+                       ['height']              = Height
+                       ['type_num']    = Type Number
+                       ['type']                = Type name 
+                       ['size']                = 'height="yyy" width="xxx"' string for use in HTML tags
+                       ['bits']                = Bits
+                       ['channels']    = Channels
+
+       Global references:                                                      
+
+
+------------------------------------------------------------------------
+       bool    graphic_thumb(string $img, string $timg, string $type)
+------------------------------------------------------------------------
+
+Creates a thumbnail image based on a full scale jpeg or gif            
+
+       NOTES:                                                          
+               This function expects "good" parameters. Make sure you  
+               ereg_replace any bad escape characters (or even spaces) that
+               are part of $img and $timg before passing them to       
+               graphic_thumb(). You may want to look at escapeshellcmd() or
+               EscapeShellArg() once we upgrade to php4.03     ./muk   
+
+       Parameters:                                                             
+               $img -- path to image which needs to be thumbed         
+               $timg -- path where thumbnail will live                 
+               $type -- mime type of image e.g. "image/jpeg"           
+
+       Return value:                                                   
+               Returns 1 on success 0 on failure                       
+
+       Global references:                                                      
+               DJPEG                                                   
+               CJPEG                                                   
+               PNMSCALE                                                
+               GIFTOPNM                                                
+               PPMTOGIF                                                
+               PPMQUANT                                                
+
+
+------------------------------------------------------------------------
+       bool    graphic_resize(string $img, string $timg, string $type, int $w, int $h)
+------------------------------------------------------------------------
+
+Creates a thumbnail image based on a full scale jpeg or gif            
+
+       NOTES:                                                          
+               This function expects "good" parameters. Make sure you  
+               ereg_replace any bad escape characters (or even spaces) that
+               are part of $img and $timg before passing them to       
+               graphic_thumb(). You may want to look at escapeshellcmd() or
+               EscapeShellArg() once we upgrade to php4.03     ./muk   
+
+       Parameters:                                                             
+               $img -- path to image which needs to be resized         
+               $timg -- path where resized image will live             
+               $type -- mime type of image e.g. "image/jpeg"           
+               $w -- width of new image                                
+               $h -- height of new image                               
+
+       Return value:                                                   
+               Returns 1 on success 0 on failure                       
+
+       Global references:                                                      
+               DJPEG                                                   
+               CJPEG                                                   
+               PNMSCALE                                                
+               GIFTOPNM                                                
+               PPMTOGIF                                                
+               PPMQUANT                                                
+       
+------------------------------------------------------------------------
+       array   img_resized(string $path2image, string $path2thumb, string $axis, int $size)                                   
+------------------------------------------------------------------------
+
+       Resizes an image based on a full scale jpeg or gif                      
+
+
+       Parameters:                                                             
+               $path2image --  path to image which needs to be resized 
+               $path2thumb -- path where resized image will live       
+               $axis -- 'h' for height , 'w' for width , or 'a' for both
+               $size -- using axis size of new image                   
+
+       Return value:                                                   
+               Returns $img_resized_array                              
+
+       Global references:                                                      
+
+
+------------------------------------------------------------------------
+       array   img_upload(string $form_field, string $image_name, string $destination_path)                                  
+------------------------------------------------------------------------
+
+Creates a thumbnail image based on a full scale jpeg or gif            
+
+       NOTES:                                                          
+               This function expects "good" parameters. Make sure you  
+               ereg_replace any bad escape characters (or even spaces) that
+               are part of $img and $timg before passing them to       
+               graphic_thumb(). You may want to look at escapeshellcmd() or
+               EscapeShellArg() once we upgrade to php4.03     ./muk   
+
+        Parameters:                                                            
+               $form_field --  $form_field of image                    
+               $image_name -- $form_field of image with _name          
+               $destination_path -- path to store uploaded image       
+               $w -- width of new image                                
+               $h -- height of new image                               
+
+       Return value:                                                   
+               Returns $img_upload_array                               
+
+       Global references:                                                      
+
+
+------------------------------------------------------------------------
+       string  process_image(string $image, string $image_name)                        
+------------------------------------------------------------------------
+
+Main function for image processing                                     
+
+       NOTES:                                                          
+               This function does the following:                       
+               1) places image into original folder                    
+               2) makes three images from original size and places them
+                  into the RESIZED, MIDSIZED, and THUMB folders        
+
+       Parameters:                                                             
+               $image  -- The variable of the image being post from the form
+               $image_name -- The variable_name of the image being post        
+
+       Return value:                                                   
+               Returns $image_name                                     
+
+       Global references:                                                      
+
+
+------------------------------------------------------------------------
+       bool    delete_image( string $image_name )                      
+------------------------------------------------------------------------
+
+Main function for image processing                                     
+
+       NOTES:                                                          
+               This function does the following:                       
+               1) deletes images in all sizes for a particular name    
+
+       Parameters:                                                             
+               $image -- The variable of the image being post from the form
+               $image -- The variable_name of the image being deleted  
+
+       Return value:                                                   
+               Returns TRUE if all is OK or FALSE if images weren't there
+
+       Global references:                                                      
+
+
+------------------------------------------------------------------------
+       string  duplicate_image( string $image_name )                   
+------------------------------------------------------------------------
+
+Main function for image processing                                     
+
+       NOTES:                                                          
+               This function does the following:                       
+               1) creates a duplicate of each size of an image in each
+                  image directory using a new filename.
+
+       Parameters:                                                             
+               $image_name     Name of the existing image to duplicate
+
+       Return value:                                                   
+               Returns the name of the image copy or an empty string
+
+       Global references:                                                      
+
+
+************************************************************************
+*                                                                      *
+*               GENERAL SUPPORT FUNCTIONS / CLASSES                    *
+*                                                                             *
+************************************************************************
+
+
+
+------------------------------------------------------------------------
+       Class Name: timestampfunc
+------------------------------------------------------------------------
+
+Class Functions
+
+array newdate($timestamp)                               
+    This function is used internally by the class to    
+    handle the dirty work of getting the month and year  
+    out of the time stamp.  Used mostly to cut down on   
+    the number of lines of code in the class             
+                                                         
+string first_of_month($timestamp)                       
+    This function takes a unix timestamp, and returns a  
+    unix timestamp of the first day of the month of the  
+    timestamp passed to it.                              
+                                                         
+ string first_last_month($timestamp)                     
+    This functin takes a unix timestamp, and returns a   
+    unix timestamp of the first day month previous to    
+    the timestamp passed to it.                         
+                                                         
+ string first_next_month($timestamp)                     
+    This function takes a unix timestamp and returns a   
+    time stamp for the first of the next month           
+                                                         
+ string first_of_Xmonth($timestamp,$x)                   
+    This function takes a unix timestamp, and the number 
+    of months to calculate for ($x).  $x can be positive 
+    or negative.  The function returns a time stamp for  
+    the first day of whatever the return month is.       
+
+
+
+------------------------------------------------------------------------
+       float   pos_value( float $value )
+------------------------------------------------------------------------
+
+This function the value only if it's positive, otherwise return 0
+
+       Parameters:                                                             
+               $value  Value to check
+
+       Return value:                                                   
+               float value if > 0      
+
+       Global references:                                                      
+               None                                                    
+
+
+------------------------------------------------------------------------
+       string  money( string $value, string $option)
+------------------------------------------------------------------------
+
+This function returns a string formatted for US Dollars
+
+       Parameters:                                                             
+               $value  Value in dollars to format
+               $option Optional control parameter
+                       "NOPREFIX" - Do not display $ in front of number
+
+       Return value:                                                   
+               String containing money formatted string with "$"
+
+       Global references:                                                      
+               None                                                    
+
+
+------------------------------------------------------------------------
+       array   strtoarray( string $s )
+------------------------------------------------------------------------
+
+This function converts a standard data string to an array
+
+       Parameters:                                                             
+               $s              Standard data string
+                                 key^value~key^value^...
+
+       Return value:                                                   
+               Array containing data from string or FALSE
+
+       Global references:                                                      
+               None                                                    
+
+
+------------------------------------------------------------------------
+       string  arraytostring( array $a, string $type )
+------------------------------------------------------------------------
+
+This function converts an array into a standard data string
+
+       Parameters:                                                             
+               $a              An array containing data for the string
+
+       Return value:                                                   
+               Standard data string in the form of 
+                       key^value~key^value^...
+               or FALSE if there's an error.
+
+       Global references:                                                      
+               None                                                    
+
+
+------------------------------------------------------------------------
+       string  replace_tokens( string $s, array $tokens )                                      
+------------------------------------------------------------------------
+
+This function replaces all occurances of the tokens listed in $tokens
+with the string associated with each token where each token is found
+in the string surrounded by curly braces ( "{" and "}" )
+
+       Parameters:                                                             
+               $s                      String to be modified
+               $tokens         Array of tokens to use for replacement
+                                               Key is name of token
+                                               Value is string that replaces token
+
+       Return value:                                                   
+               Modified string
+
+       Global references:                                                      
+               None                                                    
+       
+
+------------------------------------------------------------------------
+       string  cond_replace_tokens( string $s, array $tokens )                                 
+------------------------------------------------------------------------
+
+This function checks for "<!--{if:...}--> ... <!--{else} ... {/if}-->"
+syntax. With this syntax, one sting is used when the if condition is
+true and the other when it isn't. 
+
+       There are two forms of the {if:...} syntax:
+
+               <!--{if:t}-->
+
+                       In this form, the condition is true if the token named "t" is
+                       not empty ( = "" ).
+
+               <!--{if:t=v}-->
+
+                       In this form, the condition is true if the value of the token
+                       named "t" is equal to the string "v".
+                                                                       
+       Parameters:                                                             
+               $s                      String to be modified
+               $tokens         Array of tokens to use for tests and replacement
+                                               Key is name of token
+                                               Value is string that replaces token
+
+       Return value:                                                   
+               Modified string
+
+       Global references:                                                      
+               None                                                    
+       
+
+------------------------------------------------------------------------
+       string  replace_file_tokens( string $s )                                        
+------------------------------------------------------------------------
+
+This function checks for the "file" token and replaces the token and 
+all contents of it with the contents of the file. The second form 
+permits text between the start and end of the token that would be 
+displayed when directly viewing the file.
+
+       The syntax is:
+
+               <!--{file:f}-->
+    or
+               <!--{file:f}--> any_text <!--{/file}-->
+
+                       Where f is the name of a file to insert
+
+
+                       In this form, the condition is true if the value of the token
+                       named "t" is equal to the string "v".
+                                                                       
+       Parameters:                                                             
+               $s                      String to be modified
+
+       Return value:                                                   
+               Modified string
+
+       Global references:                                                      
+               None                                                    
+
+
+------------------------------------------------------------------------
+       string  tableize_array( array $a )                                      
+------------------------------------------------------------------------
+
+Produce HTML table describing contents of an array
+
+       Parameters:                                                             
+               $a                      Array to be described
+
+       Return value:                                                   
+               String with HTML code to display array
+
+       Global references:                                                      
+               None                                                    
+
+
+------------------------------------------------------------------------
+       string  admin_field_select( array $fields, char $filter )                                       
+------------------------------------------------------------------------
+
+Select field data from an array based on which function it will be used for
+
+       Parameters:                                                             
+               $fields         Complete standard admin_..._record() format field data
+                                       with the addition of a set of characters. These
+                                       characters indicate which function the line applies to.
+                                       (n)ew, (a)dd, (e)dit, (u)pdate, (d)elete, (c)confirm, 
+                                       (v)iew, (l)ist, (f)ilter
+               $filter         Filter character indicating which type of admin function
+                                       filter to use (n, a, e, u, d, c, v, l, or f)
+
+       Return value:                                                   
+               String ready to be fed into $fields parameter of admin function
+
+       Global references:                                                      
+               none
+
+------------------------------------------------------------------------
+       string  admin_menu_std( string $action, string $a_title, int $id, 
+                                               string $opt, string $options, string $add_menu, string $params );                                       
+       string  admin_menu( string $action, string $a_title, int $id, 
+                                               string $opt, string $options, string $add_menu, string $params );                                       
+------------------------------------------------------------------------
+
+Generate standard admin low-level menu. admin_menu() generates older HTML while
+admin_menu_std() generates newer standard GLM HTML for admin areas (<div>'s).
+
+       Parameters:                                                             
+               $action         Action this menu is associated with
+               $a_title                Title to display at left of menu
+               $id                     ID of current record
+               $opt            Current Option being executed (Normally $Option)
+               $options        String of characters indicating which options are
+                                       to be provided
+                                               l=list, v=view, e=edit, d=delete, a=add 
+               $add_menu       Additional Menu items to be included at end.
+               $params         Additional link Parameters that need to be passed in the form
+                                               of typlical link data ( x=x1&y=y1&... )
+
+       Return value:                                                   
+               String ready to be displayed. Does not include trailing <BR>
+
+       Global references:                                                      
+               none
+
+
+------------------------------------------------------------------------
+       string  clean_input( string $var_name, string $type, bool $required ) 
+------------------------------------------------------------------------
+
+Cleanup input parameters and test them for proper type of data then
+place cleaned up input values back into the parameter referenced.
+
+       Parameters:
+               $var_name       Name of the input variable to clean up (not the parameter itself
+               $type           Expected type of the parameter - Optional, defaults to 'text'
+                                               int                     Integer number
+                                               float           Floating point number (accepts integer also)
+                                                                               Also trims "$" if included
+                                               phone           Phone number (any legal style)
+                                               zip                     ZIP/Postal Codes (Any legal style)
+                                               text            General Text input
+                                               state           Checks against state list in siteinfo.inc
+                                               country         Checks against country list in siteinfo.inc
+                                               email           Checks for legal E-Mail address
+                                               creditcard      Checks for legal Credit Card number
+                                               date            Checks for legal Date/time
+                                               inet            Checks for legal Internet Address or Netmask (IP)
+               $required       Field is require (true/false)
+                                               
+       Return value:
+               string          Returns an empty string if all is OK, or an error message
+                                       if not.
+                                               
+       Global References       
+               References the specified parameter as a global
+               $si_states_array for type 'state'                               
+               $si_countries_array for type 'country'
+               
+               
+------------------------------------------------------------------------
+       string  data_to_url( array $data, string $prefix ) 
+------------------------------------------------------------------------
+
+Build the parameter list of a search engine friendly URL using the supplied
+parameters. The url will include only the parameters, properly encoded, in
+the sequence they appear in the array and separated by /'s.
+
+       Parameters:
+               $data           Array of data to include. Key is name of parameter
+                                       and array values are the values to be passed in the URL. 
+                                       Note that the keys are for caller reference only and
+                                       are not really used in this funtion.
+               $prefix         Any desired URL prefix to include.
+               
+       Returned Value:
+               string          The search engine friendly URL
+               
+       Global References:
+               (none)
+
+------------------------------------------------------------------------
+       array   url_to_data( array $data, string $url, string $start_key ) 
+------------------------------------------------------------------------
+
+Read a list of parameters from a search engine friendly URL and stuff the
+results in the returned array.
+
+       Parameters
+               $data           Array similar to that used in data_to_url() function
+                                       except that the array values are not used. Keys are
+                                       the names of the parameters. Note that the keys are
+                                       for caller reference only and are not really used in
+                                       this function. URL parameters are assumed to be in
+                                       the same order as the array.
+               $url            URL to parse as source of parameter data.
+               $start_key      String used to identify postion in the URL where the
+                                       parameter values start. The function will search for
+                                       this string plus a following / and will use anything
+                                       following as the parameter list.
+
+       Returned Value:
+               array           Array of data similar to that passed to data_to_url()
+                                       function containing parameter names as the keys and
+                                       parameter values as the array values.
+                                       
+       Global References:
+               (none)
+
+
+------------------------------------------------------------------------
+string                 build_nav( array $nav_table, string $menu_title, string $current_item = '', 
+                                                       string $sub_menu = '', string $link_data = '' )         
+------------------------------------------------------------------------
+
+Builds standard navigation code.
+
+       Parameters:
+               $nav_table              Array of menu items - Contains:
+                                                       key             Name of menu item
+                                                       'title' Text to display for Menu item
+                                                       'url'   URL for link from menu to selected item
+               $menu_title             Title for top of menu
+               $current_item   Name of the current menu item as listed in $menu
+               $sub_menu               Sub-Menu text to be included at point of current_item
+               $link_data              Additional link data to be appended to URL
+       
+       Returned Value:
+               string                  HTML of menu
+       
+       Global References:
+               (none)
+
+
+
+************************************************************************
+*                                                                      *
+*                    CATEGORY SUPPORT FUNCTIONS                        *
+*                                                                             *
+************************************************************************
+
+       Note that category functions assume the following fields in tables
+       
+       Field   Key Req         Description
+       ------- -----------     --------------------------------------
+       id              Yes                     Unique ID for the category node
+       parent  Yes                     Parent node id
+       name                            Category Name field
+       sort                            Sort order field for (sub)category
+                
+------------------------------------------------------------------------
+       string  category_path_func( string $table_name )
+------------------------------------------------------------------------
+
+Returns PL/pgSQL category_path support function for specified data table
+                                                                       
+Before running these functions on any database the language must be
+loaded into the database using the following command line.
+
+       createlang -h {server} -U {user} plpgsql {database_name}
+
+       Parameters:                                                             
+               string $table_name              Name of category table
+
+       Return value:                                                   
+
+               string          String containing function definition. Must load this by
+                                       including it in a query. Best to do that as part of a 
+                                       transaction to make sure the function doesn't change by
+                                       another process.
+
+       Global references:                                                      
+               None                                                    
+
+------------------------------------------------------------------------
+       array   cat_get_node( string $table, string $qs, string $order )
+       array   cat_get_nodes( string $table, string $qs, string $order )
+------------------------------------------------------------------------
+
+This function returns an array of results from a category table using
+the supplied query string. 
+
+The results are sorted by category hierarchy.
+                                       
+cat_get_node() is for getting a single node                            
+cat_get_nodes() is for getting a list of nodes
+  ( results are similar to db_auto_get_row() and db_auto_get_data() )                          
+
+       Parameters:                                                             
+               $table  Table name to query
+               $qs             Query string used to select category nodes
+                                       Defaults to nothing
+               $order  ORDER BY string for ordering results other than by category path
+
+       Return value:                                                   
+               array   Array of nodes data containing all fields for each record
+                               in the category table
+
+       Also included with each node array is an array element called 'parent_data'
+       that provides the following...
+               ['cat_names']           An array of parent node names from top level down
+               ['cat_id_path']         A "|" delimited string of the cat ID path 
+                                                               (all parents in sequence followed by the current id)
+               ['cat_ids']                     An array of the cat ID from top level down
+                                                               (all parents in sequence followed by the current id)
+               ['cat_level']           A number indicating the category level of current node
+                                                               0 = Top level
+
+               or FALSE if none
+
+       Global references:                                                      
+               None                                                    
+
+------------------------------------------------------------------------
+       array   cat_get_expanded_nodes( string $table, int $id )
+------------------------------------------------------------------------
+
+This function returns an array of results from a category table suitable
+for use with a contracted menu of categories. Categories that are returned
+are the target and all siblings of all parents.
+
+The results are sorted by category hierarchy.
+
+Parameters:                                                            
+               $table  Table name to query
+               $id             ID of target category node
+
+       Return value:                                                   
+               array   Array of nodes data containing all fields for each record
+                               in the category table
+                               
+       Also included with each node array is an array element called 'parent_data'
+       that provides the following...
+               ['cat_names']           An array of parent node names from top level down
+               ['cat_ids']                     An array of parent id's from top level down
+               ['cat_level']           A number indicating the category level of current node
+                                                               0 = Top level
+
+       Global references:                                                      
+               None                                                    
+
+
+------------------------------------------------------------------------
+       array   cat_get_tree( string $table, int $id )
+------------------------------------------------------------------------
+
+  ***** NOT IMPLEMENTED *****
+
+This function returns an array of results from a category table that 
+includes the entire tree of a target category and every category subordinate
+to it.
+
+The results are sorted by category hierarchy.
+
+Parameters:                                                            
+               $table  Table name to query
+               $id             ID of target category node
+
+       Return value:                                                   
+               array   Array of nodes data containing all fields for each record
+                               in the category table
+                               
+       Also included with each node array is an array element called 'parent_data'
+       that provides the following...
+               ['cat_names']           An array of parent node names from top level down
+               ['cat_ids']                     An array of parent id's from top level down
+               ['cat_level']           A number indicating the category level of current node
+                                                               0 = Top level
+
+       Global references:                                                      
+               None                                                    
+
+
+------------------------------------------------------------------------
+       bool    cat_resequence_siblings( string $table, int $parent )
+------------------------------------------------------------------------
+
+This function resequences the "order" field of a group of siblings
+to normalize the numbering. It renumbers by 10's starting at 10 to 
+permit insertion of new nodes at any point or to move a node to any 
+point.
+
+       Parameters:                                                             
+               $table  Table name to query
+               $parent Parent ID
+
+       Return value:                                                   
+               bool    TRUE or FALSE (if some error)
+
+       Global references:                                                      
+               None                                                    
+
+
+------------------------------------------------------------------------
+       array   cat_move_node( string $table, int $id, int $new_parent )
+------------------------------------------------------------------------
+
+       **** PENDING ****
+
+This function resequences the "order" field of a group of siblings
+to normalize the numbering. It renumbers by 10's starting at 10 to 
+permit insertion of new nodes at any point or to move a node to any 
+point.
+
+       Parameters:                                                             
+               $table  Table name to query
+               $parent Parent ID
+
+       Return value:                                                   
+               bool    TRUE or FALSE (if some error)
+
+       Global references:                                                      
+               None                                                    
+
+
+------------------------------------------------------------------------
+       bool    cat_delete_node( string $table, int $id, string $method )
+------------------------------------------------------------------------
+
+       **** PENDING ****
+
+This function deletes a target node. Depending on $method, it will either
+delete all children or assign them to the deleted node's parent.
+
+       Parameters:                                                             
+               $table  Table name to query
+               $parent Parent ID
+               $method Method of deletion
+                               "node"  - Delete the node only and assign children to parent
+                                                       DEFAULT
+                               "tree"  - Delete all children as well as the target node
+
+       Return value:                                                   
+               bool    TRUE or FALSE (if some error)
+
+       Global references:                                                      
+               None                                                    
+
+
+************************************************************************
+*                                                                      *
+*                       HIGH-LEVEL FUNCTIONS                           *
+*                                                                             *
+************************************************************************
+
+
+
+------------------------------------------------------------------------
+       string  build_numeric_picklist( string $fieldname, int $starting, int $ending,
+                                 int $selected )
+------------------------------------------------------------------------
+
+This function returns a string containing the HTML code for a picklist
+with the specified name and containing sequential numeric OPTIONS.
+
+       Parameters:                                                             
+               $fieldname      Field name
+               $starting       Lowest number in list
+               $ending         Highest number in list
+               $selected       Start with this number selected (optional)
+
+       Return value:                                                   
+               String containing HTML code for picklist
+
+       Global references:                                                      
+               None                                                    
+
+       
+       
+------------------------------------------------------------------------
+       string  build_picklist( string $fieldname, array $data, string $selected [, string $type]
+                                       [, string $options] )                                   
+------------------------------------------------------------------------
+
+This function returns an HTML string that provides picklist input
+
+       Parameters:                                                             
+               $fieldname      Field name
+               $data           Array of pick list options
+               $selected       Index to match for "SELECTED" option
+                                       (or "" if none)
+               $type           (optional) Type of source array
+                                       "standard" - Array element Index is OPTION value and element value is text to display
+                                       "simple"   - Array element value is both text and OPTION value
+               $options        Optional list of options - {option1}~{option2}~...
+                               Options are:    
+                                       blank           Include blank option 
+                                       numeric         Order numeric by value
+                                       alpha           Order alphanumeric by value
+                                       ascending       Order ascending
+                                       descending      Order Descending
+                                       multi           Multiple selection permitted
+
+       Return value:                                                   
+               String containing HTML code for picklist
+                                                                       
+       Global references:                                                      
+               None                                                    
+
+       
+------------------------------------------------------------------------
+       string  build_radio_buttons( string $fieldname, array $data, string $selected
+                               [, string $separator] [, string $type] [, string $options] )                                    
+------------------------------------------------------------------------
+
+This function returns an HTML string that provides Radio Button input
+
+       Parameters:                                                             
+               $fieldname      Field name
+               $data           Array or standard data string of radio button options
+               $selected       Index to match for "SELECTED" option
+                                       (or "" if none)
+               $type           (optional) Type of source array
+                                       "standard" - Array index is button value, array data is displayed text
+                                       "simple"   - Array element data is both button value and text
+               $options        Optional list of options - {option1}~{option2}~...
+                               Options are:    
+                                       numeric         Order numeric by value
+                                       alpha           Order alphanumeric by value
+                                       ascending       Order ascending
+                                       descending      Order Descending
+                                       before          Text before button (default)
+                                       after           Text after button
+               $separator      String to be used as separator for radio button options
+
+       Return value:                                                   
+               String containing HTML code for radio button input
+
+       Global references:                                                      
+               None                                                    
+       
+
+------------------------------------------------------------------------
+       string calendar_date_select( string $default_value, timestamp $start_date, timestamp $end_date,
+                               string $form_name, string $field_name, string $options, string $no_earlier )
+------------------------------------------------------------------------
+
+       This function creates a date input form with a link to a pop-up calendar                                                
+
+       Parameters:                             
+               $default_value  Text to use as default value for input field
+               $selected_date  Timestamp of date that should be selected by default
+                                       in pop-up calendar                              
+               $start_date     Timestamp of first date to allow in pop-up calendar
+               $stop_date      Timestamp of last date to allow in pop-up calendar
+               $form_name      Name of submission form
+               $field_name     Base name of target field in Form
+                                       Saves results into:
+                                               {$field_name}_date
+                                               {$field_name}_month (includes year)
+               $options        Optional controls - comma separated
+                                       NO_PROMPT       No (month/day/year) prompt
+                                       TEXT            Single text input field (default)
+                                       PICK            Month, Day, Year picklists
+                                       HIDE_YEAR       Hide year picklist
+               $no_earlier     Optional name of form field that may contain a date
+                                       that should be used as the earliest date to
+                                       set as the default date. If $selected_date is
+                                       earlier than this, set $selected_date to this date. 
+
+       Return value: String containing complete form
+                                                                       
+       Global references:                                                      
+               None                                                    
+
+
+------------------------------------------------------------------------
+       string  calendar_display( int $month, int $year, array $date_data 
+                                               [, string $headerinfo] [, string Rmonthinfo] )
+------------------------------------------------------------------------
+
+Build an HTML calendar with data from the array in each date
+
+       Parameters: 
+               $month                  Numeric month value 1-12
+               $year                   Numeric year value e.g. 2002
+        $date_data             array, index must be number of day,
+                               ["text"] is displayed inside calendar
+                               ["link"] is link target
+        $headerinfo            String to place under the Month and Year
+               $monthinfo              String to replace Month/Year title line
+
+       Return value: calendar as string
+
+       Global references:
+               None
+
+
+
+------------------------------------------------------------------------
+       array   get_us_counties( string $state, bool $fail_mode, $include_any )                                 
+------------------------------------------------------------------------
+
+This function returns an array containing the names of counties in the
+state specified.       
+
+       Parameters:                                                             
+               $state          2 letter code of state                  
+               $fail_mode      Failure Mode
+                                       TRUE    = Abort with HTML
+                                       FALSE   = Return with fail code
+               #include_any    Include an option "(any)", which = ""
+
+       Return value:                                                   
+               Array of counties
+
+       Global references:                                                      
+               None                                                    
+       
+
+------------------------------------------------------------------------
+       string  parse_view( string $file_name, array $tokens, bool $show_unused )                                       
+------------------------------------------------------------------------
+
+This function loads a "view" file, replaces all occurances of 
+the specified tokens. The view file may also designate areas to
+exclude from the file (discard), may specify header, body, and footer
+regions, and may specify a set of body designs that are to be used in
+rotation for sets of body tokens.
+
+       Parameters:                                                             
+               $file_name      Full path and name of view file                 
+               $tokens         A multi-dimentional array of sets of tokens
+
+       The view file may include the following designators:
+
+       **** NEED TO REWRITE THIS DOCUMENTATION ****
+       **** ALSO CHANGE REPLACEMENTS T%O NOT USE REGEX ****
+
+       <!--{include:filenmae}-->
+       
+               Replace all occurances with contents of filename. The file name
+               is relative to the root of the web site. i.e. ...
+                       
+                       <!--{include:sales/policy.inc}-->
+                       
+               ... will include the file SI_BASE_PATH."/sales/policy.inc".
+
+       <!--{exclude}--> and <!--{/exclude}-->
+
+               All text between EXCLUDE and /EXCLUDE comments will be deleted.
+               This permits the inclusion of areas in the view file that allow
+               for more a more complete perspective when laying out the view
+               file such that it can be directly viewed on a browser or in an
+               HTML layout package.
+
+               Both start and end EXCLUDE tags must be used or the area will not
+               be excluded from the results.
+
+       <!--{list:name}--> and <!--{/list}-->
+
+               The {BODY} and {/BODY} comment tags designate the start and end
+               of a "body" section of the view file file. Text before the 
+               {BODY} tag is considered the "header" and text after the {/BODY}
+               tag is considered the "footer".
+
+               The body section is parsed and added to the result multiple
+               times, once for each set of "body" tokens.
+
+               Both {BODY} and {/BODY} tags must be used together or not at all.
+               There can be only one set of such tags in a view file. If they
+               do not exist, the whole file is parsed as a unit using the 
+               "global" tokens only.
+
+       <!--{sep}--> and <!--{/sep}-->
+
+               The body of a view file may be separated into "sections" by
+               including the {SECTION} comment tags. When there are multiple
+               sections of the body, these sections are used in rotation as
+               each set of "body" tokens is applied. There may be any number of
+               {SECTION} comment tags or none at all. These tags may not appear
+               in the header or footer of the view file.
+
+       $tokens array as the following structure
+
+               
+               "global" => array
+                       (
+                       token   =>      string,
+                       token   =>      string,
+                       ...
+                               tokey key/value sets used in header, footer or for the 
+                               whole file if the file is not separated by comment tags.
+                       )
+               "body" => array
+                       (
+                       0       => array
+                               (
+                               token   => string,
+                               token   => string,
+                               ...
+                                       token key/value sets used for a body section 
+                               )
+                       1       => array
+                               (
+                               token   => string,
+                               token   => string,
+                               ...
+                                       token key/value sets used for a body section 
+                               )
+                       ...
+                               The "body" array contains as many sets of data as
+                               there are to be copies of the body section. 
+                       )
+
+       Return value:                                                   
+               String representing modified view file contents.
+
+       Global references:                                                      
+               None                                                    
+
+************************************************************************
+*                                                                      *
+*                       MAGIC FORM FUNCTIONS                           *
+*                                                                             *
+************************************************************************
+
+****WARNING: NEED TO UPDATE MAGIC FORM DOCUMENTATION TO INCLUDE FIELD FORMATS AND DEFAULT SELECTIONS/VALUES. ****
+
+
+Magic Forms are forms that are built by the user and that can contain a 
+number of different field types and optional sub-forms.
+
+There are 3 functions associated with Magic Forms. They are...
+
+       magic_form_edit()               Create/Edit a Form
+       magic_form_display()    Display a form
+       magic_form_submit()             Process a submitted form
+
+Magic Forms uses a single database table to store all form data. The name
+of this table is specified using the MF_TABLE defined parameter.
+
+Database Table Schema
+
+       CREATE TABLE magicform
+               (
+               id                      SERIAL,
+               form_id         text,
+               custom_id       text,
+               title           text,
+               type            smallint,
+               descr           text,
+               active          bool,
+               required        bool,
+               data1           text,
+               sort            smallint,
+               expanded        bool,
+               style           text,
+               image           text,
+               cols            int,
+               rows            int
+               );
+
+After creating this table, create an index for the id field.
+       CREATE INDEX magicform_form_id_index ON magicform( form_id );
+
+Magic Forms also use a "format" array that contains information on what output
+formats are available and how to display them. These can include anything from
+simple one line formats for each field, to complex multi-column formats. These
+format specifications use the View Tags capability to permit complex and
+conditional use of form components. The following is an example.
+
+$mf_format = array
+       (
+       
+       'Default' =>    array
+                               (
+                               'types'         => ' 1 2 3 4 5 6 20 21 23 30 31 ',                                                                                                                                                                      // Field types - MUST HAVE SPACE EACH SIDE OF VALUES 
+                               'short_name' => 'Default',                                                                                                                                                                                                                      // A short name used in form edit
+                               'cols'          => 1,                                                                                                                                                                                                                                   // Number of columns per row
+                               'start'         => '',                                                                                                                                                                                                                                  // Text when starting this style
+                               'row_start'     => '',                                                                                                                                                                                                                                  // Text when starting a row
+                               'body'          => '<ul>
+                                                                       <!--{if:required}--><font color="red">{title}</font><!--{else:required}<b>{title}</b>{/if:required}--><br>
+                                                                       <!--{if:descr}-->{descr}<br><!--{/if:descr}-->
+                                                                       <!--{if:image}-->{image}<br><!--{/if:image}-->
+                                                                       {input}
+                                                                       <!--{if:sub_forms}--><br><ol>{sub_forms}</ol><!--{/if:sub_forms}-->
+                                                               </ul>',                                                                                                                                                                                                                         // Text for each column
+                               'col_empty'     => '',                                                                                                                                                                                                                                  // Text for empty columns
+                               'row_end'       => '',                                                                                                                                                                                                                                  // Text for end of each row
+                               'end'           => '',                                                                                                                                                                                                                                  // Text when switching to different style
+                               'sub_form'      => '<ul>{sub_form}</ul>'                                                                                                                                                                                                // Text for each sub-form (yes, there could be multiples)
+                               ),
+                               
+       'Prompt/Input on single line' =>        array
+                               (
+                               'types'         => ' 1 2 3 4 5 6', 
+                               'short_name' => 'Single Line',
+                               'cols'          => 1,                           
+                               'start'         => '',                          
+                               'row_start'     => '',          
+                               'body'          => '<!--{if:required}--><font color="red">{title}</font><!--{else:required}<b>{title}</b>{/if:required}-->
+                                                                       <!--{if:image}-->{image}<!--{/if:image}-->
+                                                                       {input}
+                                                                       <!--{if:sub_forms}--><br><ol>{sub_forms}</ol><!--{/if:sub_forms}-->
+                                                               ',      
+                               'col_empty'     => '',          
+                               'row_end'       => '',  
+                               'end'           => '',  
+                               'sub_form'      => '<ul>{sub_form}</ul>'        
+                               ),
+                               
+       '2 Column Table' =>     array
+                               (
+                               'types'         => ' 1 2 3 4 5 6 ', 
+                               'short_name' => '2 Column',
+                               'cols'          => 2,
+                               'start'         => '<center><table border="0" cellspacing="0" cellpadding="2" width="90%">',
+                               'row_start'     => '<tr>',
+                               'body'          => '<td align="left" valign="top" width="50%">
+                                                                       <b><!--{if:required}--><font color="red">{title}</font><!--{else:required}{title}{/if:required}--></b><br>
+                                                                       <!--{if:descr}-->{descr}<!--{/if:descr}--><br>
+                                                                       {input}
+                                                                       <!--{if:sub_forms}--><p>{sub_forms}<!--{/if:sub_forms}-->
+                                                               ',
+                               'col_empty'     => '<td>&nbsp;</td>',
+                               'row_end'       => '</tr>',
+                               'end'           => '</table></center><p>',
+                               'sub_form'      => '{sub_form}<br>'
+                               ),
+                               
+Note that each format element has a list of field "types" with which it can
+be used. The magic_form_edit() function will read the list of "types" for 
+each format specification and select the first format found for a particular
+field type as the default for that type. Only those formats that have a
+particular field type will be available for that type. The field types are...
+
+               1       Checkbox
+               2       Number
+               3       Text
+               4       Text Box
+               5       Picklist
+               6       Radio Buttons
+               20      Section Title
+               21      Misc. Text
+               22      Horizontal Line
+               23      Blank Line
+               24      Image
+               31      Calculated Field  (not implimented)
+
+
+------------------------------------------------------------------------
+       array   magic_form_edit( int $mf_id, array $mf_format, in5 $mf_level )
+------------------------------------------------------------------------
+
+This function is a complete user interface for building a form. Simply call
+this function with a unique form id. Each time a change is requested by the
+user, the page will be submitted. When submitted, call this function again.
+The user requests will be passed back to it with global submitted parameters.
+
+       Parameters:                                                             
+               $mf_id          A unique int ID for this form
+               $mf_format      Format array
+               $mf_level       A sub-form level counter - Do not use!
+                                       This parameter is used internally to keep track of 
+                                       recursion into sub-forms.
+                                       
+
+       Return value:                           
+               Array containing the following elements
+               
+                       'success'       Boolean true, or false if there is a problem
+                       'modified'      Form has been modified in a way that old end-user
+                                               data may not be valid anymore.
+                       'text'          The full text of the form management ouput.
+                                               Send this text to the user's browser to display
+                                               form management interface.
+               
+       Global references:                                                      
+               MF_TABLE        SQL database table name to use
+               (various)       Various other user submitted form parameters. These
+                                       parameters all begin with 'mf_'.
+
+------------------------------------------------------------------------
+       array   magic_form_display( int $mf_id, array $mf_format, int $mf_fiid, 
+                                                               array $mf_def_data, int $mf_level )
+------------------------------------------------------------------------
+
+This function provides the HTML code to display a Magic Form to a user.
+
+       Parameters:
+               $mf_id                  A unique int ID for this form
+               $mf_format              Format array
+               $mf_fiid                ID of user data for this instance of the form. This is 
+                                               used when the user data is to be called from the database. 
+                                               Otherwise the $mf_def_data paramter can be used to 
+                                               provide data received by the magic_form_submit() function.
+               $mf_def_data    Array of default data. There is an element for each
+                                               field that should be populated with the provided
+                                               data, checked, or selected. The 'data' array returned
+                                               by the magic_form_submit() function can be used to 
+                                               supply this default data. The elements actually used
+                                               are the element index (id of the field) and 'value'.
+                                               This value is used either when this function is calling
+                                               it'self for a sub-form or when the data is being passed
+                                               by the application from a prior submission using the
+                                               magic_form_submit() function.
+               $mf_level               A sub-form level counter - Do not use!
+                                               This parameter is used internally to keep track of 
+                                               recursion into sub-forms.
+
+       Return value:
+               Array containing the following elements
+               
+                       'success'       Boolean true, or false if there is a problem
+                       'text'          The full text of the form management ouput.
+                                               Send this text to the user's browser to display
+                                               the final form.
+                       'required'      Boolean flag indicating if there are any "required"
+                                               fields. This can be used to determine if some text
+                                               should be displayed to the user about required fields.
+                                               
+       Global references:                                                      
+               MF_TABLE                SQL database table name to use
+               (various)               Various other user submitted form parameters. These
+                                               parameters all begin with 'mf_' and then the numeric 
+                                               record id of the form element from the MF_TABLE.
+
+
+
+------------------------------------------------------------------------
+       array   magic_form_submit( int $mf_id, int $mf_fiid, array $mf_def_data, int $mf_level )
+------------------------------------------------------------------------
+
+This function is used to process a user submitted form that was created by
+the magic_form_display() function. It can optionally accept an array of data
+to be used as the default values for each field.
+
+       Parameters:
+               $mf_id                  A unique int ID for this form
+               $mf_fiid                A unique ID used as a key to store submitted data.
+                                               If this parameter is "null" then data is not stored.
+               $mf_def_data    An array of user data from a prior use of this function.
+                                               When this parameter is supplied, this data is used rather
+                                               than checking for form submission data. This permits 
+                                               reprocessing of sumbitted data for the purpose of storing
+                                               the data or generating the HTML, CSV, or other results.
+               $mf_level               A sub-form level counter - Do not use!
+                                               This parameter is used internally to keep track of 
+                                               recursion into sub-forms.
+
+       Return value:
+               Array containing the following elements
+               
+                       'success'       Boolean true, or false if there is a problem
+                       'data'          Array of data results. Each element is a field result.
+                                               This array can be supplied back to magic_form_display() as the
+                                               $mf_def_data array to supply default values for fields.
+                                               The index of each field result is the record id of that
+                                               field in MF_TABLE. Each field result is an array containing...
+                                               
+                                                       'id'            Field id
+                                                       'title'         Field title
+                                                       'type'          Field type number
+                                                       'txt_typ'       Field type name
+                                                       'value'         Submitted value
+                                                       'txt_val'       Text version of result (for things like
+                                                                               boolean true/false results)
+                                                       'opt_num'       Option number for checkbox, picklist, & radio buttons
+                                                       'valid'         Boolean flag indicating whether the field
+                                                                               data is valid
+                                                       'required'      Boolean flag indicating if field is required
+                                                       'failure'       Text string indicating any submission problem
+                       
+                       'html'          HTML code to display a table of the results
+                       'csv'           Results prepaired as .csv (quoted, comma separated)
+                       'problem'       Text listing any submission problems, such as 
+                                               required fields that weren't completed
+                                               
+       Global references:                                                      
+               MF_TABLE        SQL database table name to use
+               (various)       Various other user submitted form parameters. These
+                                       parameters all begin with 'mf_' and then the numeric 
+                                       record id of the form element from the MF_TABLE.
+       
+------------------------------------------------------------------------
+       bool    magic_form_store_data( int $mf_id, int $mf_fiid, array $mf_def_data )
+------------------------------------------------------------------------
+
+This function simply stores the data supplied in the $mf_def_data array (generated
+by a previous call to magic_form_submit(). The data is stored with the unique $mf_fiid
+to specify this particular instance of the submitted form data. Any information that
+had been previously stored for the speficied $mf_fiid is deleted before storing the
+new data.
+
+       Parameters:
+               $mf_id                  A unique int ID for this form
+               $mf_fiid                A unique ID used as a key to store this instance of
+                                               the submitted data.
+               $mf_def_data    An array of user data from a prior call to magic_form_submitt().
+
+       Return value:
+               bool                    Success (true) of Failure (false)
+               
+       Global references:
+               (none)
+               
+
+************************************************************************
+*                                                                      *
+*            SUPPORT FOR HIGH-LEVEL ADMIN FUNCTIONS                    *
+*                                                                             *
+************************************************************************
+
+------------------------------------------------------------------------
+       array   explode_trim( string $separator, string $string )
+------------------------------------------------------------------------
+
+Explodes a string into pieces and trims whitespace from ends of each piece. 
+
+       Parameters:                                                             
+               $separator      Delimiter character
+               $string         String to explode
+
+       Return value:                           
+               Array containing exploded, trimmed strings
+
+       Global references:                                                      
+               None                                                    
+
+
+************************************************************************
+*                                                                      *
+*                   HIGH-LEVEL ADMIN FUNCTIONS                         *
+*                                                                             *
+************************************************************************
+
+
+------------------------------------------------------------------------
+       array   admin_process_records_r( string $table, string $where, string $order, 
+                                               string $conn_str, int $id, array $fields, string $options, 
+                                               int $rows, string $url, string $action, 
+                                               string $params, string $a_title, string $view 
+                                               string $Option, string $other_opt ) 
+       void    admin_process_records( string $table, string $where, string $order, 
+                                               string $conn_str, int $id, array $fields, string $options, 
+                                               int $rows, string $url, string $action, 
+                                               string $params, string $a_title, string $view 
+                                               string $Option, string $other_opt ) 
+------------------------------------------------------------------------
+
+This is the whole kitten-kabootle. Call this to fully process a table
+including add, edit, delete, view, and list.
+
+See various functions for full description of parameters
+
+       Parameters:                                                             
+               $table          Name of dabase table
+               $where          Any additional "WHERE" clause for query
+               $order          Any additional "ORDER BY" clause for query
+               $conn_str       Connect String                          
+               $id                     ID of current record
+               $fields         Array of fields as used by admin_field_select()
+               $options        Comma separated list of options
+               $rows           Maximum number of rows per page
+               $url            URL of next processing page
+               $action         Action to be passed to next processing page (says what we're working on)
+               $params         A "|" separated list of Additional parameters to be passed on links
+               $a_title        Page title to display
+               $view           Optional View to replace standard output for each Option type
+                                               This is an array where there is an element for each Option
+                                               where the indicies are 'Add', 'Add New', 'Edit', 'Update', ...
+               $Option         Current Option (Add, Edit, ... )
+               $start          Starting record for lists
+               $other_opt      Other options to pass to subsequent admin functions
+               $title_view     Optional View to replace normal title output.
+
+       Return value:                           
+               admin_process_records_r()               returns array( 'text' => {text to display}, 'status' => {return status} );
+               admin_process_records()                 (none)                  
+
+       Global references:                                                      
+               None
+
+
+------------------------------------------------------------------------
+       array   admin_list_records_r( string $table, sting $where, string $oder,
+                               string $conn_str, string $fields, 
+                               string $options, int $rows, int $start,
+                               string $url, string $action, 
+                               string $params, string $filters, 
+                               string $a_title )
+       void    admin_list_records( string $table, sting $where, string $oder,
+                               string $conn_str, string $fields, 
+                               string $options, int $rows, int $start,
+                               string $url, string $action, 
+                               string $params, string $filters, 
+                               string $a_title )
+------------------------------------------------------------------------
+
+The auto function retrieves the desired data using the query string,
+then builds a table of the results and displays it along with paging.  
+
+The displayed table can optionally have edit, and delete funtions for
+each result.
+
+If options are specified, then links are placed at the end of each
+data record for each of the specified options. An additional parameter
+(Option) is passed to the page to indicate the options that was selected
+by the user. It will be "New", "Add New", "Display", "Edit" or "Delete".
+
+If option "new" is selected, then a link to add a new entry is placed
+at the top of the page.
+
+If option "filter" is selected, then a filter form is placed at the
+top. 
+
+       Parameters:                                                             
+               $table          Name of dabase table
+               $where          Any additional "WHERE" clause for query
+               $order          Any additional "ORDER BY" clause for query
+                                       {field}.{nav_option}.{nav_option}|{field}|{field}|
+                                       Where: {nav_option} 
+                                               "order_descending" - Use Descending order for this field
+               $conn_str       Connect String                          
+               $fields         List of fields to display (see below)
+               $options        Comma separated list of options
+                                       new                     = Provide new option
+                                       view            = Profide display option
+                                       edit            = Provide edit option
+                                       delete          = Provide delete option
+                                       filter          = Provide search fields
+                                       sortlinks       = Make column headers clickable to resort by that column
+                                       nopageing       = Don't display paging links
+                                       noborder        = Don't display table borders
+                                       opview.v        = View text for Operation Column
+                                                                       v = View text, can use {n}, {encode:n}, {link_params}, {form_params}
+                                                                               Can also user predefined links {op_view}, {op_edit}, {op_delete}, {op_duplicate},
+                                                                                       {op_url} <- base url, {op_id} <- id of current record
+               $fail_mode      Failure Mode
+                                       TRUE    = Abort with HTML
+                                       FALSE   = Return with fail code
+               $rows           Maximum number of rows per page
+               $start          Start at this row and retrieve up to $rows rows
+               $url            URL of next processing page
+               $action         Action to be passed to next processing page (says what we're working on)
+               $params         A "|" separated list of Additional parameters to be passed on links
+                                       {name}.{value}|{name}.{value}|...
+               $filters        A "|" separated list of fields to provide search
+                                       capability for. Each field is specified as
+                                                       {field},{type},{title},[ignore],{value}                         // SOMEDAY WE HAVE TO USE A DIFFERENT DELIMITER THAN ","
+                                       Where:  {field} = Field to filter on
+                                                       {type}.....{option}     = Type of field - Option specified in filter sub-field [5]
+                                                                                       Otherwise type uses normal type sub-fields
+                                                               Where: {option} = 
+                                                                       any    - Match the text in any case anywhere in the field - case insensitive
+                                                                                       (This is the default type option)
+                                                                       exact  - Exact match (default for type pointer)
+                                                               like   - Match the text anywhere in the field - case sensitive
+                                                                       begin  - Match the text at the beginning only - case insensitive
+                                                       {title} = Title for input field
+                                                       {value} = Parameter with Supplied value 
+                                       Only required is option "filter" is selected
+                                       Special field type "daterange" permits filtering by range of dates
+               $a_title                Page title to display
+               $view           Optional View to replace standard output - May contain
+                                       {n}             - Replace with value of parameter n
+                                       {encode:n}      - Replace with urlencoded() value of paramter n
+                                       {filter}        - Filter input form
+                                       {link_params}   - Additional Parameters in Link format
+                                       {form_params}   - Additional parameters in form format (hidden fields)
+                                       {new}           - Create new record link
+                                       {nav}           - Pagenation nav links
+                                       {body}          - Designates start of body
+                                       {section}       - Designates a separation between sections
+                                               Sections are used round-robin fasion for record output.
+                                       {/body}         - Designates end of body
+
+                               Output is built as...
+                                       1) $a_title
+                                       2) Content before {body}
+                                       3) Records displayed round-robin with sections
+                                       4) Content after {/body}
+
+       $fields parameter is a string with mulitple field declarations.
+
+               "{name},{type}`{format},{title}|{name},{type},{title}|..."
+
+       Where:  {name}  = Name of the data field in the database
+               {type}  = Type - how it should be displayed
+                               int     - Integer value
+                               fixed.n - Fixed precision, "n" digits after "."
+                               float   - Floating value
+                               money   - Money (outputs as $xxx,xxx.xx)
+                               text    - Simple text field
+                               password - Same as text except that output is displayed as *'s
+                               textbox - Same as text
+                               url             - Web page link
+                               date    - Date field (currently same as text)
+                               image.s - Image of size "s"
+                                               o = Original
+                                               r = Resized
+                                               m = Midsized
+                                               t = Thumb
+                               file.d.{options} - File (displays file name as a link)  
+                                               d = Directory under base path for site
+                                               {options} include 
+                                                       secure = display using secure output to protect directory (need to protect directory using .htaccess)
+                                                               Use display_secure_file() function to output file
+                               list.{list}.{default}.{picklist_options} - List of options from picklist
+                               state.{default} - Special case of list
+                               country.{default}       - Special case of list
+                               pointer - Pointer to data in anohter table (see below)
+                               multipointer - Pointer to data in another table where multiples can be selected
+                               checkbox - Yes/No boolian field
+                               lat.n   - Latitude (stored as deg, + = N) (n = precision)
+                               lon.n   - Longitude (stored as deg, + = E) (n = precision)
+                               order   - Output order spec
+               {title} = Title for table header
+               {format} = Optional format spec for output, use {field_name} style tags to include 
+                                       any other raw field data from another field in the list. Only used when 
+                                       $view is not specified.
+
+       Type "pointer" has a sub-structure for the "{type}" field
+               {type}.{other_table}.{disp_field}.{value_field}.{where}
+                       {disp_field} can specify multiple fields separated by "~"
+
+       Type "multipointer" has a sub-structure for the "{type}" field
+               {type}.{other_table}.{disp_field}.{value_field}.{where}.{link_table}.{this_table_pointer_field}.{other_table_pointer_field}
+               
+       Where:  {type}          = "pointer"
+               {other_table}   = Table used to get data
+               {disp_field}    = Field in {other_table} to output to user for each <OPTOIN..>
+               {value_field}   = When specified, is the field the value must match rather than "id"
+                                       (for now, this field must be an integer)
+               {where}         = WHERE field of query to use for selecting data from {other_table}
+                                       (optional - defaults to none)
+
+       Return value:                           
+               admin_list_records_r()          returns array( 'text' => {text to display}, 'status' => {return status} );
+               admin_list_records()            (none)                  
+
+       Global references:                                                      
+               None
+
+
+
+------------------------------------------------------------------------
+       array   admin_new_record_r( string $table,
+                               string $conn_str, string $fields, 
+                               string $url, string $action, string $params
+                               string $params, string $a_title, string $view, 
+                               string $options )
+       void    admin_new_record( string $table,
+                               string $conn_str, string $fields, 
+                               string $url, string $action, string $params
+                               string $params, string $a_title, string $view, 
+                               string $options )
+------------------------------------------------------------------------
+
+This function builds a new entry input form with the specified fields.                                                                 
+
+       Parameters:                                                             
+               $table          Name of dabase table
+               $conn_str       Connect String                          
+               $fields         List of fields to display (see below)
+               $url            URL to page for submitting this form
+               $action         Value of "Action" parameter for program at $url
+               $params         A "|" separated list of Additional parameters to be passed on links
+                                       {name}.{value}|{name}.{value}|...
+               $a_title                Title of page
+               $view           Optional View to replace standard output - May contain
+                                       {n}             - Replace with value of parameter n
+                                       {encode:n}      - Replace with urlencoded() value of paramter n
+                                       {submit}        - submit button
+                                       {link_params}   - Additional parameters in link format
+                                       {form_params}   - Additional parameters in form format (hidden fields)
+               $options        Optional control options - comma separated
+                                               "borders" = Turn on borders in table
+
+       $fields parameter is a string with mulitple field declarations.
+
+               "{name},{type},{title},{required},{value}|{name},{type},{title},{required},{value}|..."
+
+       Where:  {name}  = Name of the data field in the database
+               {type}  = Type - how it should be displayed
+                               int.w           - Integer value
+                               fixed.n         - Fixed precision
+                               float.w         - Floating value
+                               money           - Formats as $xx.xx
+                               text.w          - Simple text field
+                               password.w      - Same as text field except that input is displayed as *'s
+                               url.w           - Web link
+                               date.d1.d2.o.ne - Date field (currently same as text)
+                               textbox.w.h     - Textbox
+                               richtext.w.h.filter     - Textbox with enhanced editing - w & h in pixels
+                                                                       use w > 550 and h > 100
+                                                                       filter is either blank or "encoded" to have text html encoded.
+                               file.e          - File (file type (e) is optional)
+                               image           - Image 
+                               pointer.t.f.v.q.p.s - Pointer to data in another table (see below)
+                               checkbox        - True/False field, Presented as Checkbox
+                               lat.n           - Latitude (stored as deg, + = N) (n = precision)
+                               lon.n           - Longitude (stored as deg, + = E) (n = precision)
+                               bitmap.b        - Bitmapped check boxes, Names for each bit listed in 
+                                                       sequence in b
+                               list.{list}.{default}.p - List of options for picklist/display (see below)
+                               state.{default}.p       - Special form of list, uses state table from siteinfo.inc
+                               break.{text}    - Break in list - Displays {text} in value field
+                               order           - Output order value (automatically normalized)
+                                                       
+                       where:  w = Width, h = height, n = # of digits, 
+                               t = table, b = "~" separated list
+                               f = Field in other table from which to get displayed text
+                               v = Field in other table from which to get value (if other than "id")
+                               q = Optional WHERE clause
+                               e = Optional File type required (extension)
+                               p = Pick list build options - {option1}~{option2}~...
+                                       (see build_picklist() for options)
+                               s = Field in other table used to sort results retrieved from that table
+                               d1 = Number of days before current date to permit selection
+                               d2 = Number of days after current date to permit selection
+                               o  = Date selection options - see calendar_date_select() function
+                               ne = Name of other field that this date field should default to no earlier than
+
+               {title} = Title for table header
+               {required} = Required field (TRUE/FALSE/UNIQUE/SUPPLIED/DISPLAY/HIDDEN)
+               {value} = Name of variable containing supplied/hidden/displayed value
+                               For checkboxes use "CHECKED"
+
+       {required} value descriptions
+               TRUE            = Normal input field, must be filled in
+               FALSE           = Normal input field, optionally filled in
+               UNIQUE          = Normal Input field, must be filled in, must be unique (type "text" only)
+               SUPPLIED        = Value for input field is supplied, may be changed by user
+               DISPLAY         = Value for field is supplied in variable who's name is listed and displayed, but can't be changed
+               HIDDEN          = Value for field is supplied in variable who's name is listed, passed on in "hidden" input field
+
+       Type "pointer" has a sub-structure for the "{type}" field
+               {type}.{other_table}.{disp_field}.{value_field}.{where}
+
+       Where:  {type}          = "pointer"
+               {other_table}   = Table used to get data
+               {disp_field}    = Field in {other_table} to output to user for each <OPTOIN..>
+               {value_field}   = Use the field specified here for the OPTION VALUE rather than "id"
+                                                       (optional - defaults to "id")
+               {where}                 = WHERE field of query to use for selecting data from {other_table}
+                                                       (optional - defaults to none)
+               {pick_opt}              = Picklist options separated by '~' ( see build_picklist() ) 
+
+       Type "list" builds a pick list using the "~" separated list {list}
+               {value}^{option}~{value}^{option}~...
+                       Where   {value}         = Value provided when option selected
+                               {option}        = Text displayed for picklist entry
+
+               This will use the indicated table and fields as source for a pick list
+
+       Return value:                           
+               admin_new_record_r()            returns array( 'text' => {text to display}, 'status' => {return status} );
+               admin_new_record()                      (none)                  
+
+       Global references:                                                      
+               None                                                    
+
+
+------------------------------------------------------------------------
+       array   admin_add_new_record_r( string $table,
+                               string $conn_str, string $fields, 
+                               string $url, string $action, string $params, string $a_title )
+       int             admin_add_new_record( string $table,
+                               string $conn_str, string $fields, 
+                               string $url, string $action, string $params, string $a_title )
+------------------------------------------------------------------------
+
+This function adds a record submitted from a form produced by the
+admin_new_record() function.                                                                   
+
+       Parameters:                                                             
+               $table          Name of dabase table
+               $conn_str       Connect String                          
+               $fields         List of fields to submit (see below)
+               $url            URL to page for submitting this form
+               $action         Value of "Action" parameter for program at $url
+               $params         A "|" separated list of Additional parameters to be passed on links
+                                       {name}.{value}|{name}.{value}|...
+               $a_title                Title of page
+               $view           Optional View to replace standard output - May contain
+                                       {n}             - Replace with value of parameter n
+                                       {encode:n}      - Replace with urlencoded() value of paramter n
+                                       {link_params}   - Additional parameters in Link format
+                                       {form_params}   - Additional parameters in Form format (hidden fields)
+                                       {result}        - Results of submission
+                                                       
+       $fields parameter is a string with mulitple field declarations.
+
+               "{name},{type},{required},{value}|{name},{type},{title},{required},{value}|..."
+
+       Where:  {name}  = Name of the data field in the database
+               {type}  = Type - how it should be displayed
+                               int             - Integer value
+                               fixed           - Fixed precision
+                               float           - Floating value
+                               money           - Money formatted
+                               text            - Simple text field
+                               password        - Same as text
+                               state           - Same as text
+                               textbox         - Same as text
+                               date            - Date
+                               url                     - Web link
+                               image           - Image 
+                               pointer         - Pointer value (expects integer value ID of other record)
+                               file            - File
+                               lat.n           - Latitude (stored as deg, + = N) (n = precision)
+                               lon.n           - Longitude (stored as deg, + = E) (n = precision)
+                               order           - Ouput order field - (future - normalized by this function to 10's after insert)
+               {title} = Title of field for error output if not supplied
+               {required} = Required field (TRUE/FALSE/UNIQUE/SUPPLIED)
+               {value} = Parameter name of supplied data
+                       (for SUPPLIED assign the value to a variable
+                        and pass the variable name)
+
+       Return value:                           
+               admin_add_new_record_r()                returns array( 'text' => {text to display}, 'status' => {return status} );
+               admin_add_new_record()                  oid - If successfull, otherwise 0
+
+       Global references:                                                      
+               $HTTP_POST_VARS, $HTTP_POST_FILES       
+
+------------------------------------------------------------------------
+       array   admin_edit_record_r( string $table, string $conn_str, 
+                               int $id, string $fields, 
+                               string $url, string $action, string $params, string $a_title,
+                               string $view, string $options )
+       void    admin_edit_record( string $table, string $conn_str, 
+                               int $id, string $fields, 
+                               string $url, string $action, string $params, string $a_title,
+                               string $view, string $options )
+------------------------------------------------------------------------
+
+This function builds an edit entry input form with the specified fields.                                                                       
+
+       Parameters:                                                             
+               $table          Name of dabase table
+               $conn_str       Connect String                          
+               $id             Unique value of "id" field of record to edit
+               $fields         List of fields to display (see below)
+               $url            URL to page for submitting this form
+               $action         Value of "Action" parameter for program at $url
+               $params         A "|" separated list of Additional parameters to be passed on links
+                                       {name}.{value}|{name}.{value}|...
+               $a_title                Title of page
+               $view           Optional View to replace standard output - May contain
+                                       {n}             - Replace with value of parameter n
+                                       {encode:n}      - Replace with urlencoded() value of paramter n
+                                       {link_params}   - Additional parameters in Link format
+                                       {form_params}   - Additional parameters in Form format (hidden fields)
+                                       {submit} is submit button
+               $options        Optional control options - comma separated
+                                               "borders" = Turn on borders in table
+                                                       
+       $fields parameter is a string with mulitple field declarations.
+
+               "{name},{type},{title},{required},{value}|{name},{type},{title},{required},{value}|..."
+
+       Where:  {name}  = Name of the data field in the database
+               {type}  = Type - how it should be displayed
+                               int.w                   - Integer value
+                               fixed.n                 - Fixed precision
+                               float.w                 - Floating value
+                               money.w                 - Money formatted
+                               text.w                  - Simple text field
+                               password.w              - Same as text except that input is displayed as *'s
+                               text.w                  - Web link
+                               textbox.w.h     - Textboxd
+                               richtext.w.h    - Textbox with enhanced editing - w & h in pixels
+                                                                       use w > 550 and h > 100
+                               date.d1.d2.o.ne - Date field
+                               image                   - Image 
+                               pointer.t.f.v.q.p.s     - Pointer to data in anohter table (see below)
+                               list.{list}.{default}.p - List of options for picklist/display (see below)
+                               state.{default}.p       - Special form of list - uses states table from siteinfo.inc
+                               country.{default}.p     - Special form of list - uses countries table from siteinfo.inc
+                               break.{text}    - Break in list - Displays {text} in value field
+                               lat.n                   - Latitude (stored as deg, + = N) (n = precision)
+                               lon.n                   - Longitude (stored as deg, + = E) (n = precision)
+                               order                   - Output order field
+
+                       where:  w = Width, h = height, n = # of digits, 
+                               t = table, f = field, q = Optional WHERE clause
+                               v = Field in other table from which to get value (other than "id")
+                               p = Pick list build options - {option1}~{option2}~...
+                                       (see build_picklist() for options)
+                               s = Field in other table used to sort query resuts
+                               d1 = Number of days before current date to permit selection
+                               d2 = Number of days after current date to permit selection
+                               o  = Date selection options - see calendar_date_select() function
+                               ne = Name of other field that this date field should default to no earlier than
+
+               {title} = Title for table header
+               {required} = Required field (TRUE/FALSE/UNIQUE/SUPPLIED/DISPLAY/HIDDEN)
+               {value} = Parameter name of supplied data
+                       (for SUPPLIED/DISPLAY/HIDDEN assign the value to a variable 
+                        and pass the variable name)
+                       Also, if this value is used for type pointer, it will use it to match
+                               the "SELECTED" option in the pick list
+
+       Type "pointer" has a sub-structure for the "{type}" field
+               {type}.{other_table}.{disp_field}.{value_field}.{where}
+       
+       Where:  {type}          = "pointer"
+               {other_table}   = Table used to get data
+               {disp_field}    = Field in {other_table} to output to user for each <OPTOIN..>
+               {value_field}   = Use the field specified here for the OPTION VALUE rather than "id"
+                                       (optional - defaults to "id")
+               {where}         = WHERE field of query to use for selecting data from {other_table}
+                                       (optional - defaults to none)
+
+       Type "list" builds a pick list using the "~" separated list {list}
+               {value}^{option}~{value}^{option}~...
+                       Where {option}  = Text displayed for picklist entry
+
+               This will use the indicated table and field as source for a pick list
+
+       Return value:                           
+               admin_edit_record_r()           returns array( 'text' => {text to display}, 'status' => {return status} );
+               admin_edit_record()                     (none)
+
+       Global references:                                                      
+               None                                                    
+
+
+------------------------------------------------------------------------
+       array   admin_update_record_r( string $table, string $conn_str, int $id,
+                               string $fields, string $url, string $action, string $params
+                               string $a_title, string $view )
+       void    admin_update_record( string $table, string $conn_str, int $id,
+                               string $fields, string $url, string $action, string $params
+                               string $a_title, string $view )
+------------------------------------------------------------------------
+
+This function updates a record submitted from a form produced by the
+admin_edit_record() function.
+
+       Parameters:                                                             
+               $table          Name of dabase table
+               $conn_str       Connect String
+               $id             Unique value of the "id" field of the record to update
+               $fields         List of fields to update (see below)
+               $url            URL to page for submitting this form
+               $action         Value of "Action" parameter for program at $url
+               $params         A "|" separated list of Additional parameters to be passed on links
+                                       {name}.{value}|{name}.{value}|...
+               $a_title                Title of Page
+               $view           Optional View to replace standard output - May contain
+                                       {n}             - Replace with value of parameter n
+                                       {encode:n}      - Replace with urlencoded() value of paramter n
+                                       {link_params}   - Additional parameters in Link format
+                                       {form_params}   - Additional parameters in Form format (hidden fields)
+                                       {result}        - Result of submission
+                                                       
+       $fields parameter is a string with mulitple field declarations.
+
+               "{name},{type},{required},{value}|{name},{type},{title},{required},{value}|..."
+
+       Where:  {name}  = Name of the data field in the database
+               {type}  = Type - how it should be displayed
+                               int             - Integer value
+                               fixed           - Fixed precision
+                               float           - Floating value
+                               money           - Money formatted
+                               text            - Simple text field
+                               text            - Same as text
+                               state           - Same as text
+                               textbox         - Same as text
+                               date            - Date
+                               url                     - Web link
+                               image           - Image 
+                               pointer         - Pointer (expects integer value ID of other record)
+                               lat.n           - Latitude (stored as deg, + = N) (n = precision)
+                               lon.n           - Longitude (stored as deg, + = E) (n = precision)
+                               order           - Ouput order spec - (future - normalize to every 10 after update)
+               {title} = Title of field for error output if not supplied
+               {required} = Required field (TRUE/UNIQUE/FALSE/SUPPLIED)
+               {formfield} = Name of form field with supplied data
+                       (for SUPPLIED assign the value to a variable 
+                        and pass the variable name)
+
+       Return value:                           
+               admin_update_record_r()                 returns array( 'text' => {text to display}, 'status' => {return status} );
+               admin_update_record()                   (none)
+
+       Global references:                                                      
+               $HTTP_POST_VARS, $HTTP_POST_FILES       
+
+
+------------------------------------------------------------------------
+       array   admin_delete_record_r( string $table, string $conn_str, $id,
+                               string $fields, string $options, 
+                               string $url, string $action, string $params, string $a_title )
+       void    admin_delete_record( string $table, string $conn_str, $id,
+                               string $fields, string $options, 
+                               string $url, string $action, string $params, string $a_title )
+------------------------------------------------------------------------
+
+This function retrieves data for the specified record, displays it
+then askes the user to acknowledge if they want the record deleted.
+
+Display of the record data is handled similar to the admin_list_records()
+function.
+
+       Parameters:                                                             
+               $table          Name of dabase table
+               $conn_str       Connect String                          
+               $id             Unique of the "id" field of the record to delete
+               $fields         List of fields to display (see below)
+               $options        Comma separated list of options
+                                       strong = Strong confirmation,
+                                                requires user to type "Confirm"
+               $action         Value of "Action" parameter when calling program from links
+               $params         A "|" separated list of Additional parameters to be passed on links
+                                       {name}.{value}|{name}.{value}|...
+               $a_title                Title of Page - May contain {n} replacements
+               $view           Optional View to replace standard output - May contain
+                                       {n}             - Replace with value of parameter n
+                                       {encode:n}      - Replace with urlencoded() value of paramter n
+                                       {link_params}   - Additional parameters in Link format
+                                       {form_params}   - Additional parameters in Form format (hidden fields)
+                                       {submit} is submit button
+                                                       
+       $fields parameter is a string with mulitple field declarations.
+
+               "{name},{type},{title}|{name},{type},{title}|..."
+
+       Where:  {name}  = Name of the data field in the database
+               {type}  = Type - how it should be displayed
+                               int     - Integer value
+                               fixed:n - Fixed precision, "n" digits after "."
+                               float   - Floating value
+                               money   - Money formatted
+                               text    - Simple text field
+                               password - Same as text except that output is displayed as *'s
+                               state   - Same as text
+                               textbox - Same as text
+                               url             - Web link
+                               date    - Date field (currently same as text)
+                               image:s - Image of size "s"
+                                               o = Original
+                                               r = Resized
+                                               m = Midsized
+                                               t = Thumb
+                               pointer - Pointer to data in anohter table (see below)
+                               check.t.f = Check a field in other table for references to this record
+                                                       Do not delete if entries exist.
+                                                       t = name of other table
+                                                       f = field in other table that points to the ID of this record
+               {title} = Title for table header
+               {control} = Required field (SUPPLIED/DISPLAY/HIDDEN)
+               {formfield} = Name of form field with supplied data
+                       (for SUPPLIED assign the value to a variable 
+                        and pass the variable name - SUPPLIED is not displayed)
+
+       Type "pointer" has a sub-structure for the "{type}" field
+               {type}.{other_table}.{disp_field}.{value_field}.{where}
+       
+       Where:  {type}          = "pointer"
+               {other_table}   = Table used to get data
+               {disp_field}    = Field in {other_table} to output to user for each <OPTOIN..>
+               {value_field}   = When specified, is the field the value must match rather than "id"
+                                       (for now, this field must be an integer)
+               {where}         = WHERE field of query to use for selecting data from {other_table}
+                                       (optional - defaults to none)
+
+       Return value:                           
+               admin_delete_record_r()                 returns array( 'text' => {text to display}, 'status' => {return status} );
+               admin_delete_record()                   (none)
+
+       Global references:                                                      
+
+------------------------------------------------------------------------
+       array   admin_confirm_delete_record_r( string $table, string $conn_str, int $id,
+                               string $fields, string $url, string $action,
+                               string $params, string $a_title, string $view )
+       bool    admin_confirm_delete_record( string $table, string $conn_str, int $id,
+                               string $fields, string $url, string $action,
+                               string $params, string $a_title, string $view )
+------------------------------------------------------------------------
+
+This function receives a form submission from a delete request produced
+by admin_delete_record(). It does a number of things in sequence.
+
+1) Check to make sure the field "Delete" contains exactly "Confirm"
+2) Check fields for "reference"s that need to be protected. If there are any
+   check the "id" field in the specified table to see if any point
+   toward this record. If there are, don't delete the record. 
+3) Check to see if there are any "image" fields specified. If so it
+   deletes those images.
+4) Delete the record
+
+       Parameters:                                                             
+               $table          Name of dabase table
+               $conn_str       Connect String
+               $id             Unique value of the "id" field of the record to update
+               $fields         List of fields to check for certain things such as images to delete
+                                       and subordinate table entries (references)
+               $url            URL to page for submitting this form
+               $action         Value of "Action" parameter for program at $url
+               $params         A "|" separated list of Additional parameters to be passed on links
+                                       {name}.{value}|{name}.{value}|...
+               $a_title                Title of Page
+               $view           Optional View to replace standard output - May contain
+                                       {n}             - Replace with value of parameter n
+                                       {encode:n}      - Replace with urlencoded() value of paramter n
+                                       {link_params}   - Additional parameters in Link format
+                                       {form_params}   - Additional parameters in Form format (hidden fields)
+                                       {result}        - Result of submitssion, success or failure
+                                                       
+       $fields parameter is a string with mulitple field declarations.
+
+               "{name},{type},{title}|{name},{type},{title}|..."
+
+       Where:  {name}  = Name of the data field in the database
+               {type}  = Type - how it should be displayed
+                               reference       - Reference to check (see below)
+                               image           - Image to delete
+               {title} = Title of field for error output if not supplied
+
+       If {type} = reference, then has following format
+               reference.{table}.{field}
+       Where:  {table} = Table to check for reference
+               {field} = Field in that table (to see if = id of current record)
+
+       Return value:                           
+               admin_confirm_delete_record_r()                 returns array( 'text' => {text to display}, 'status' => {return status} );
+               admin_confirm_delete_record()                   TRUE or FALSE (if not deleted)
+
+       Global references:                                                      
+               $HTTP_POST_VARS
+
+
+------------------------------------------------------------------------
+       array   admin_view_record_r( string $table, sting $conn_str, string $id, 
+                               string $fields, string $url, string $action, 
+                               string $params, string $a_title, string $view, string $options, string $quick_tip, string $id_field )
+       void    admin_view_record( string $table, sting $conn_str, string $id, 
+                               string $fields, string $url, string $action, 
+                               string $params, string $a_title, string $view, string $options, string $quick_tip, string $id_field )
+------------------------------------------------------------------------
+
+The auto function retrieves the record specified by $id and displays
+the result.    
+
+       Parameters:                                                             
+               $table          Name of dabase table
+               $id             Numeric value of "id" field for desired record
+               $conn_str       Connect String                          
+               $fields         List of fields to display (see below)
+               $url            URL of next processing page
+               $action         Action to be passed to next processing page (says what we're working on)
+               $params         A "|" separated list of Additional parameters to be passed on links
+                                       {name}.{value}|{name}.{value}|...
+               $a_title                Title of this table for use in headers
+               $view           View to use for display of this record (see view discription)
+                                       {n}             - Replace with value of parameter n
+                                       {encode:n}      - Replace with urlencoded() value of paramter n
+                                       {link_params}   - Additional parameters in Link format
+                                       {form_params}   - Additional parameters in Form format (hidden fields)
+               $options        Optional control options - comma separated
+                                               "borders" = Turn on borders in table
+               $quick_tip      Optional Pop-up Quick tip message for page
+               $id_field       Name of id field if not "id"
+                                                       
+       $fields parameter is a string with mulitple field declarations.
+
+               "{name},{type},{title}|{name},{type},{title}|..."
+
+       Where:  {name}  = Name of the data field in the database
+               {type}  = Type - how it should be displayed
+                               int     - Integer value
+                               fixed.n - Fixed precision, "n" digits after "."
+                               float   - Floating value
+                               money   - Money formatted
+                               text    - Simple text field
+                               password - Same as text except that output is displayed as *'s
+                               rawtext - Same as text but doesn't parse hard breaks to <BR>
+                               textbox - Same as text 
+                               url             - Web link
+                               date    - Date field (currently same as text)
+                               image.s - Image of size "s"
+                                               o = Original
+                                               r = Resized
+                                               m = Midsized
+                                               t = Thumb
+                               file    - File (displays file as a link to a popup window)
+                               pointer - Pointer to data in anohter table (see below)
+                               list.{list}     - List of options for picklist/display (see below)
+                               state   - Special form of list
+                               lat.n   - Latitude (stored as deg, + = N) (n = precision)
+                               lon.n   - Longitude (stored as deg, + = E) (n = precision)
+                               break.{text}    - Break in list - Displays {text} in value field
+                                                       Breaks must have unique dummy field name
+                               order           - Output order spec
+               {title} = Title for table header
+
+       Type "pointer" has a sub-structure for the "{type}" field
+               {type}.{other_table}.{disp_field}.{value_field}.{where}
+                       {disp_field} can specify multiple fields separated by "~"
+
+       Any type can be followed with ".hidden" to prevent it from being included with default output
+               (does not affect values specified in $view)
+       
+       Where:  {type}          = "pointer"
+               {other_table}   = Table used to get data
+               {disp_field}    = Field in {other_table} to output to user for each <OPTOIN..>
+               {value_field}   = (bugus field, not used in this function since this function displays only)
+               {where}         = WHERE field of query to use for selecting data from {other_table}
+                                       (optional - defaults to none)
+
+       Description of $view: The $view parameter is an optional layout for
+       outputing the record. If the $view parameter isn't supplied, the 
+       data is displayed in sequential format down the page, as is the default
+       for the admin_edit_record() function. If the $view parameter is supplied,
+       it is used as the HTML for displaying the page. Fields to be displayed
+       are designated by "{x}" where x is the database field name.
+
+       Return value:                           
+               admin_view_record_r()           returns array( 'text' => {text to display}, 'status' => {return status} );
+               admin_view_record()                     (none)
+
+       Global references:                                                      
+               None                                                    
+
+
+
+------------------------------------------------------------------------
+       void    admin_user_login( string $operation, string $conn_str, string $sess_code
+                       string $table, string $id_field, string $pw_field,
+                       string $user_id, string $password, string $where, string $cookie,
+                       int $timeout )
+------------------------------------------------------------------------
+
+This function does one of two things...
+
+       1) Compare User ID and password to see if it's OK for someone to log in
+               If User ID and password match, then session data is created for 
+               this user and that includes a timestamp of the last activity
+       2) Check to see if a session is currently valid
+               This breaks up the session code into 3 segments. One is the 
+               MD5 stiring of the user E-Mail and last timestamp, and the next
+               is the timestamp from the last activity. If the last timestamp
+               and user user ID & password don't combine to match the MD5 string, then the
+               user session is invalid. If it does match, then the timestamp
+               is checked to see if it has been longer than the allowed
+               timeout period since the user's last activity. The last segment
+               is the unique numeric "id" of the user's record.
+
+       Parameters:                                                             
+               $operation        The desired operation to perform
+               $conn_str         Standard database connection string
+               $sess_code        Session code (blank for operation login, record id for create )
+               $table            Database table where user data is stored
+               $id_field         Field in $table where user's ID is stored
+               $pw_field         Field in $table where user's password is stored
+               $user_id          User's ID (blank for operation verify) OPTIONAL
+               $password         User's password (blank for operation verify) OPTIONAL
+               $where            Optional additional query clause to be ANDed to ID/Password check
+               $cookie       Optional name of cookie used to track login, if not set uses passed parameters instead
+               $sess_timeout Optional session timeout value in seconds, if not provided uses SI_SES_TIMEOUT
+
+               SI_SES_TIMEOUT  Global define that specifies timeout period in seconds
+
+       Operations:
+
+               login           This operation attempts to log in a new user
+
+               verify          This operation verifies an active login
+                                       session.
+                                       
+               create          This operation creates a new user session and links it
+                                       to a user record without doing an id/password check. The 
+                                       user record id is passed in $sess_code field.
+                                       
+       Return value:                           
+               login           Returns false if login failure otherwise session data
+               verify          Returns false if login failure otterwise session data
+
+
+       Session data is an array containing all the fields in the user data record
+       and the following special array indexes...
+
+               session_code    The MD5 string, timestamp and record number combined
+               session_link    The session code in URL link format
+               session_form    The session code in hidden form field format    
+
+       session_code is built as follows
+               {md5}-{timestamp}-{record id}
+
+               WHERE:  {md5}   MD5 string derived from 
+                                       user's ID + timestamp + id field + secret
+
+       Global references:                                                      
+               SI_SES_TIMEOUT  Global define that specifies timeout period in seconds
+               
+               
+               
+************************************************************************
+*                                                                      *
+*                       FINANCIAL FUNCTIONS                            *
+*                                                                             *
+************************************************************************
+
+------------------------------------------------------------------------
+       array   function authorize_net_aim( 
+                               string $login, string $key, string $test, string $conf, string $merch_email,
+                               float $amount, string $card_num, string $exp_date, string $card_code, 
+                         Following parameters may be optional
+                               string $currency,  
+                               string $fname, string $lname, string $company, string $address, string $city, string $state, string $zip, string $country, 
+                               string $phone, string $fax, string $id, string $ip, string $tax_id,
+                               string $email,
+                               string $invoice, string $descr, string $header, string $footer,
+                               string $ship_fname, string $ship_lname, string $ship_company, string $ship_address, string $ship_city, string $ship_state, 
+                               string $ship_zip, string $ship_country )
+------------------------------------------------------------------------
+       
+This function submits a transaction request to Authorize.Net and returns a transaction result.
+
+Submission parameters
+
+       string $login           Authorize.net Merchant Login
+       string $key                     Authorize.net Merchant Key
+       string $test            Test Mode ( FALSE - Production mode, TRUE - Test Mode, LOCAL TEST - Local only-don't send to Authorize.net )
+       string $conf            Send confirmation to customer E-Mail (TRUE - FALSE)
+       string $merch_email     Send confirmation to merchant E-Mail (TRUE - FALSE)
+       
+       (Need to write rest of this part)
+
+               Authorize.net processing
+       
+               Test card #
+               
+                 TEST CARD               CARD TYPE
+                 NUMBER
+                 370000000000002         American Express
+                 6011000000000012        Discover
+                 5424000000000015        MasterCard
+                 4007000000027           Visa
+
+
+Return 
+
+       The result is an array containing result data or FALSE if it's unable to submit to 
+       or get a response from Authorize.Net.
+
+       [0]                     Response Code - 1 = Approved, 2 = Declined, 3 = Error, 4 = Held for review, 
+                                       ( GLM Added Codes: 100 = System Exec call failed, 101 = No data returned from Exec Call, 102 = No data returned from Authorize.net,
+                                         103 = MD5 Hash verification failure )
+       [1]                     Response Sub-Code (?)
+       [2]                     Response Reason Code - See documentation
+       [3]                     Response Reason Text
+       [4]                     Approval Code - 6 character authorization code
+       [5]                     AVS Result Code - Address Verification result
+       [6]                     Transaction ID - Unique identifier for transaction with Authorize.Net - Used for updates to the transaction
+               These fields are echoed from supplied data if they were submitted
+       [7]                     Invoice Number
+       [8]                     Description
+       [9]                     Amount
+       [10]            Method
+       [11]            Transaction Type
+       [12]            Customer ID
+       [13]            First Name
+       [14]            Last Name
+       [15]            Company
+       [16]            Billing Address
+       [17]            City
+       [18]            State
+       [19]            Zip
+       [20]            Country
+       [21]            Phone
+       [22]            Fax
+       [23]            E-Mail
+       [24]            Ship First Name
+       [25]            Ship Last Name
+       [26]            Ship Company
+       [27]            Ship Address
+       [28]            Ship City
+       [29]            Ship State
+       [30]            Ship Zip
+       [31]            Ship Country
+       [32]            Tax
+       [33]            Duty
+       [34]            Freight
+       [35]            Tax Exempt Flag
+       [36]            P.O. #
+               These fields are generated by Authorize.Net
+       [37]            MD5 Hash to authenticate response from Authorize.Net
+       [38]            Card Code (CVV) verification - M = Match, N - No Match, P = Not Processed, S = Should have been present, U = Issuer unable to process request
+       [39]            Cardholder CAVV Authentication Verification
+                                       Blank   Not validated
+                                       0               Erroneous data submitted
+                                       1               Failed validation
+                                       2               Passed validation
+                                       3-4             Validation could not be performed
+                                       5-6             (reserved)
+                                       7               Failed validation
+                                       8               Passed validation
+                                       9               Failed validation
+                                       A               Passed validation
+                                       B               Passed validation
+       [40]-[67]       Reserved
+       [68]            Echo of merchant defined fields
+       
+
diff --git a/documentation/static_page.phtml b/documentation/static_page.phtml
new file mode 100644 (file)
index 0000000..dc494bd
--- /dev/null
@@ -0,0 +1,11 @@
+<?php
+// Default entry into registrations application
+if (!isset($_REQUEST['Action'])) {
+    $_REQUEST['Action'] = '';     // Action step
+    $_REQUEST['todo'] = 0;        // Category
+    $_REQUEST['subcat'] = 0;      // Sub-Category
+    $_REQUEST['event'] = 0;       // Event ID
+}
+
+include_once( GLM_APP_BASE."Common/Registrations_V3/front-end/registrations.inc");
+?>
diff --git a/documentation/work_in_progress.txt b/documentation/work_in_progress.txt
new file mode 100644 (file)
index 0000000..4f9cc9c
--- /dev/null
@@ -0,0 +1,18 @@
+Work in Progress
+----------------
+
+Updates to database
+
+    alter table reg add column restrict_call_from_merchant boolean;
+    update reg set restrict_call_from_merchant = false;
+    
+
+
+
+---- OLD STUFF ----
+
+Adding option for requiring registered user for an event
+       alter table reg add column require_registered_user boolean;
+       update reg set require_registered_user = false;
+       
+       Check on member option not enabling this checkbox in admin/index.phtml
\ No newline at end of file
diff --git a/front-end/Views/Files_Explanation.txt b/front-end/Views/Files_Explanation.txt
new file mode 100644 (file)
index 0000000..2149b33
--- /dev/null
@@ -0,0 +1,22 @@
+View Files Descriptions
+-----------------------
+
+create_account.html                                    Create a new account page - Used only with Registered Users on
+forgot_password.html                           Forgot Password Page - Used only with Registered Users on
+new_password.html                                      Set a new Password Page - Used only with Registered Users on
+notify_event_contacts.html                     E-Mail sent to contacts for a specific event when someone registers
+password_reset.html                                    Password Reset Page - Used only with Registered Users on
+registration_price_guide.html          NOT CURRENTLY IN USE
+registrations_confirmation.html                E-Mail sent to users when their registration is confirmed
+registrations_step0.html                       Registrations Intro Page - If enabled
+registrations_step1.html                       Main category selection page - Also has search fields and registered user log-in
+registrations_step2.html                       List available events page
+registrations_step3.html                       Event detail and registration page
+registrations_step4.html                       Shopping Cart Page
+registrations_step5.html                       Checkout Page
+registrations_step6.html                       Checkout complete page and registration summary
+registrations_store.html                       Summary of registration for storing into database
+registrations_summary.html                     Summary of registration page
+style.css                                                      Default styles for pages 
+                                                                       May be overridden by /Toolkit/Registrations/front-end/Views/override.css in customer server directory                                                                   
+                                                                        
diff --git a/front-end/Views/create_account.html b/front-end/Views/create_account.html
new file mode 100644 (file)
index 0000000..b83ec8b
--- /dev/null
@@ -0,0 +1,112 @@
+<!--{if:haveCustomStylesheet=YES}-->
+       <LINK REL="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/style.css">
+<!--{else:haveCustomStylesheet}
+       <LINK REL="stylesheet" HREF="{base_app_secure_url}Common/Registrations_V3/front-end/Views/style.css">
+{/if:haveCustomStylesheet}-->
+<!--{if:haveStylesheetOverride=YES}-->
+       <link type="text/css" rel="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/override.css">
+<!--{/if:haveStylesheetOverride}-->
+
+<div id="registrations">
+
+ <!--{if:have_reason=YES}-->
+       <div class="regWarning">
+               <h3>Your request was not submitted. Please check the following items.</h3>
+               <ul>
+<!--{list:reason}-->
+                       <li>{text}</li>
+<!--{/list:reason}-->
+               </ul>
+       </div>
+ <!--{/if:have_reason}-->
+
+<!--{if:showMemberLogin=YES}-->
+       <form action="{base_secure_url}index.php?catid={category_id}" method="POST">
+               <input type="hidden" name="Action" value="Step0">
+               <input type="hidden" name="Option" value="get_account_from_member">
+               <h3>If you are a {customer_long_name} member and know your member "Username" and "Password", please enter that here.</h3>
+               <p>Fields in red are required.</p>
+             <table border="0">
+                               <TR><TD class="regRequired">Username:</TD><TD class="textInput"><INPUT TYPE="text" NAME="member_username" VALUE="{member_username}"></TD></TR>
+                               <TR><TD class="regRequired">Password:</TD><TD class="textInput"><INPUT TYPE="password" NAME="member_password" VALUE="{member_password}"></TD></TR>
+                       <tr><td>&nbsp;</td><td><button name="create_account" value="YES">Create Account From Member Information</button>
+               </table>
+               <p>
+               A registered member account is required to receive member rates. If you are a member and do not 
+               know your Username and Password, please call {customer_long_name} to have them create those for you.
+               </p>  
+       </form>
+<!--{/if:showMemberLogin}-->
+       
+       <p>&nbsp;</p>
+
+<!--{if:userIsMember=YES}-->
+       <h3>We found your member information. Please complete the form below to setup your account.</h3>
+       <p>If the information below if for another member, it means that you do not get your correct Username and Password. 
+       Please contact {customer_long_name} for assistance in correcting this situation.</p>   
+       <form action="{base_secure_url}index.php" method="POST">
+               <input type="hidden" name="catid" value="{category_id}">
+               <input type="hidden" name="Action" value="Step0">
+               <button>This is not me</button>
+       </form>
+       
+<!--{else:userIsMember}
+       <h3>If you are not a {customer_long_name} member and would like to create a registered user account, please enter the following data to create your account.</h3>
+{/if:userIsMember}-->
+
+<!--{if:alreadyRegistered=YES}-->
+       <div class="regWarning">Note:</div>
+       <p>
+               We already have a registered user in our database with the E-Mail address you supplied. Please check the E-Mail address below. If this is your correct
+               E-Mail address, we can send you an E-Mail message containing with a link to a page where you may reset the password for this account.
+       </p>
+       <a href="{base_secure_url}index.php?catid={category_id}&Action=Step0&reset_password=yes&reg={registeredUserID}">Please send me E-Mail to reset my password.</a> 
+<!--{/if:alreadyRegistered}--> 
+       
+       <form action="{base_secure_url}index.php?catid={category_id}" method="POST">
+               <input type="hidden" name="Action" value="Step0">
+               <input type="hidden" name="Option" value="submit_create_account">
+               <input type="hidden" name="member" value="{userIsMember}">
+               <input type="hidden" name="member_id" value="{member_id}">
+               <input type="hidden" name="member_id_md5" value="{member_id_md5}">
+               
+               <p>Fields in red are required.</p>
+             <table border="0">
+                               <TR><TD class="regRequired">First Name:</TD><TD class="textInput"><INPUT TYPE="text" NAME="fname" VALUE="{fname}"></TD></TR>
+                               <TR><TD class="regRequired">Last Name:</TD><TD class="textInput"><INPUT TYPE="text" NAME="lname" VALUE="{lname}"></TD></TR>
+                               <TR><TD class="regRequired">Address:</TD><TD class="textInput"><INPUT TYPE="text" NAME="addr1" VALUE="{addr1}"></TD></TR>
+                               <TR><TD class="regFieldName">&nbsp;</TD><TD class="textInput"><INPUT TYPE="text" NAME="addr2" VALUE="{addr2}"></TD></TR>
+                               <TR><TD class="regRequired">City:</TD><TD class="textInput"><INPUT TYPE="text" NAME="city" VALUE="{city}"></TD></TR>
+                               <TR><TD class="regRequired">State/Prov.:</TD><TD>{state}</TD></TR>
+                               <TR><TD class="regRequired">Country:</TD><TD>{country}</TD></TR>
+                               <TR><TD class="regRequired">ZIP/Postal Code:</TD><TD class="textInput"><INPUT TYPE="text" NAME="zip" SIZE="10" VALUE="{zip}"></TD></TR>
+                               <TR><TD class="regRequired">Phone:</TD><TD class="textInput"><INPUT TYPE="text" NAME="phone" VALUE="{phone}"></TD></TR>
+                               <TR><TD class="regFieldName">FAX:</TD><TD class="textInput"><INPUT TYPE="text" NAME="fax" VALUE="{fax}"></TD></TR>
+                               <tr><td class="regRequired" valign="top">E-Mail Address: </td><td><input type="text" name="email" value="{email}"></td></tr>
+                               <tr><td class="regRequired" valign="top">Verify E-Mail Address: </td><td><input type="text" name="email2" value="{email2}"></td></tr>
+                               <tr>
+                                       <td class="regRequired" valign="top"><nobr>{word_event_cap} {word_registeration_cap} Password:</nobr> </td>
+                                       <td>
+                                               <input type="password" name="password"><br>
+                                               This password is only for use with {registrations_title}. 
+                                               If you have a {customer_long_name} member area password, it will remain the same.
+                                       </td>
+                               </tr>
+                               <tr><td colspan="2">&nbsp;</td></tr>
+                               <tr><td colspan="2"><input type="checkbox" name="email_ok" value="on" {email_ok}> Please send me updates regarding {customer_long_name}</td></tr>
+                               <tr><td colspan="2">&nbsp;</td></tr>
+                       <tr><td>&nbsp;</td><td><button name="create_account" value="YES">Create Registered User Account</button>
+               </table>
+       </form>
+
+       <p>&nbsp;</p>
+       <form action="{base_secure_url}index.php" method="POST">
+               <input type="hidden" name="catid" value="{category_id}">
+               <input type="hidden" name="Action" value="Step0">
+               <h3>Otherwise...</h3>
+               <button>No, I'll create my account later</button>
+       </form>
+       
+</div>
+<br clear="all">
+<hr>
diff --git a/front-end/Views/forgot_password.html b/front-end/Views/forgot_password.html
new file mode 100644 (file)
index 0000000..e960243
--- /dev/null
@@ -0,0 +1,107 @@
+<!--{if:haveCustomStylesheet=YES}-->
+       <LINK REL="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/style.css">
+<!--{else:haveCustomStylesheet}
+       <LINK REL="stylesheet" HREF="{base_app_secure_url}Common/Registrations_V3/front-end/Views/style.css">
+{/if:haveCustomStylesheet}-->
+<!--{if:haveStylesheetOverride=YES}-->
+       <link type="text/css" rel="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/override.css">
+<!--{/if:haveStylesheetOverride}-->
+
+<div id="registrations">
+
+    <h3>Forgotten Password</h3>
+
+       <!--{if:have_reason=YES}-->
+       <div class="regWarning">
+               Please Note:<br>
+               <ul>
+                       <!--{list:reason}-->
+                       <li>{text}</li>
+                       <!--{/list:reason}-->
+               </ul>
+       </div>
+       <!--{/if:have_reason}-->
+
+       <div>
+
+
+               <!--{if:ForgotPasswordType=Member}-->
+               <br clear="all">
+               <hr>
+               <div id="introMembers">
+                       <form
+                               action="{base_secure_url}index.php?catid={category_id}{preview}"
+                               method="POST">
+                               <input type="hidden" name="Action" value="ResetPassword"> 
+                               <input type="hidden" name="Type" value="Member">
+                               <table border="0">
+                                       <tr>
+                                               <td valign="top">
+                                                       <h3>{customer_long_name} {word_Members}</h3>
+                                                       <p>
+                                                               Pleased enter your {customer_long_name} member {word_user_id}.
+                                                               If you do not know your {word_user_id}, please call {customer_long_name}
+                                                               at {customer_phone} for assistance.
+                                                       </p>
+                                                       <p>
+                                                               We will send an E-Mail message with information on how to reset
+                                                               your password to the E-Mail address of record for your {customer_long_name}
+                                                               {word_member} account.
+                                                       </p>
+                                               </td>
+                                               <td valign="top">
+                                                       <table border="0">
+                                                               <tr>
+                                                                       <td class="required">{word_User_id}:</td>
+                                                                       <td><input type="text" name="memberID"
+                                                                               value="{member_username}"></td>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td colspan="2"><input type="submit" value="Please Reset My Password"></td>
+                                                               </tr>
+                                                       </table>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </form>
+               </div>
+       <!--{/if:ForgotPasswordType}-->
+               
+       <!--{if:ForgotPasswordType=NonMember}-->
+               <br clear="all">
+               <hr>
+               <div id="introMembers">
+                       <form
+                               action="{base_secure_url}index.php?catid={category_id}{preview}"
+                               method="POST">
+                               <input type="hidden" name="Action" value="ResetPassword"> 
+                               <input type="hidden" name="Type" value="NonMember">
+                               <table border="0">
+                                       <tr>
+                                               <td valign="top">
+                                                       <h3><!--{if:have_members=YES}-->Non-{word_Members}<!--{else:have_members}Registrant{/if:have_members}--></h3>
+                                                       <p>Please enter the E-Mail address you used when you {word_registered} here before.</p>
+                                                       <p>
+                                                               We will send an E-Mail message with information on how to reset
+                                                               your password to this E-Mail address.
+                                                       </p>
+                                               </td>
+                                               <td valign="top">
+                                                       <table border="0">
+                                                               <tr>
+                                                                       <td class="required">E-Mail&nbsp;Address:</td>
+                                                                       <td><input type="text" name="email" value="{member_username}"></td>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td colspan="2"><input type="submit" value="Please Reset My Password"></td>
+                                                               </tr>
+                                                       </table>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </form>
+               </div>
+       <!--{/if:ForgotPasswordType}-->
+               <a href="{base_secure_url}index.php?catid={category_id}{preview}" class="pseudoButton">Return to {word_Events}</a>
+       </div>
+<div>
diff --git a/front-end/Views/new_password.html b/front-end/Views/new_password.html
new file mode 100644 (file)
index 0000000..50fd59f
--- /dev/null
@@ -0,0 +1,66 @@
+<!--{if:haveCustomStylesheet=YES}-->
+       <LINK REL="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/style.css">
+<!--{else:haveCustomStylesheet}
+       <LINK REL="stylesheet" HREF="{base_app_secure_url}Common/Registrations_V3/front-end/Views/style.css">
+{/if:haveCustomStylesheet}-->
+<!--{if:haveStylesheetOverride=YES}-->
+       <link type="text/css" rel="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/override.css">
+<!--{/if:haveStylesheetOverride}-->
+
+<div id="registrations">
+
+       <!--{if:have_reason=YES}-->
+       <div class="regWarning">
+               Please Note:<br>
+               <ul>
+                       <!--{list:reason}-->
+                       <li>{text}</li>
+                       <!--{/list:reason}-->
+               </ul>
+       </div>
+       <!--{/if:have_reason}-->
+
+       <div>
+
+        <h3>New Password Entry</h3>
+
+               <br clear="all">
+               <hr>
+               <div id="introMembers">
+                       <form
+                               action="{base_secure_url}index.php?catid={category_id}{preview}"
+                               method="POST">
+                               <input type="hidden" name="Action" value="ResetPassword"> 
+                               <input type="hidden" name="ResetID" value="{ResetID}">
+                               <table border="0">
+                                       <tr>
+                                               <td valign="top">
+                                                       <p>Please enter the Password Reset Code provided earlier and a new password for you to use.</p>
+                                                       <p>You will need to enter the new password twice to verify the exact password you are requesting.</p>
+                                               </td>
+                                               <td valign="top">
+                                                       <table border="0">
+                                                               <tr>
+                                                                       <td class="required">Password&nbsp;Reset&nbsp;Code:</td>
+                                                                       <td><input type="text" name="ResetCode" value=""></td>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td class="required">New Password:</td>
+                                                                       <td><input type="text" name="passwd" value=""></td>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td class="required">New Password Again:</td>
+                                                                       <td><input type="text" name="passwd2" value=""></td>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td colspan="2"><input type="submit" value="Please Set My New Password"></td>
+                                                               </tr>
+                                                       </table>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </form>
+               </div>
+               <a href="{base_secure_url}index.php?catid={category_id}{preview}" class="pseudoButton">Return to {word_Events}</a>
+       </div>
+<div>
diff --git a/front-end/Views/notify_event_contacts.html b/front-end/Views/notify_event_contacts.html
new file mode 100644 (file)
index 0000000..6abe3c8
--- /dev/null
@@ -0,0 +1,143 @@
+<html>
+       <head>
+       </head>
+       <body>
+       {notify_intro}
+       <p>&nbsp;</p>
+       <table border="1" width="650">
+       
+       <!--{if:notification_billing_info=YES}-->
+               <tr><th colspan="2" align="left" bgcolor="#eee">{word_Registration} Submitted By:</th></tr>
+               <tr>
+                       <td>
+                               <table>
+                                       <tr><th align="left">Name:</th><td>{fname} {lname}</td></tr>
+                                       <tr><th align="left">Address</th><td>{addr1}</td></tr>
+                                       <tr><th align="left">&nbsp;</th><td>{addr2}</td></tr>
+                                       <tr><th align="left">&nbsp;</th><td>{city}, {state} {zip} {country}</td></tr>
+               <!--{if:notification_phone=YES}-->
+                                       <tr><th align="left">Phone:</th><td>{phone}</td></tr>
+               <!--{/if:notification_phone}-->
+               <!--{if:notification_email=YES}-->
+                                       <tr><th align="left">E-Mail Address:</th><td>{email}</td></tr>
+               <!--{/if:notification_email}-->
+                               </table>
+                       </td>
+               </tr>
+       <!--{/if:notification_billing_info}-->
+       
+  <!--{if:show_contact_data=YES}-->
+                               <tr><th colspan="2" align="left" bgcolor="#eee"><NOBR>{contact_information_title}:</NOBR></TH></tr>
+                               <tr>
+                                       <TD valign="top" colspan="2"">
+                                               <table border="0" cellspacing="0" cellpadding="0">
+                          <!--{if:use_contact_fname=YES}-->
+                                       <!--{if:notification_contact_fname=YES}-->
+                                               <TR><TH ALIGN="left">{prompt_contact_fname}:&nbsp;</TH><TD>{contact_fname}</TD></TR>
+                               <!--{/if:notification_contact_fname}-->
+                          <!--{/if:use_contact_fname}-->
+                              <!--{if:use_contact_lname=YES}-->
+                                       <!--{if:notification_contact_lname=YES}-->
+                                               <TR><TH ALIGN="left">{prompt_contact_lname}:&nbsp;</TH><TD>{contact_lname}</TD></TR>
+                               <!--{/if:notification_contact_lname}-->
+                          <!--{/if:use_contact_lname}-->
+                              <!--{if:use_contact_addr1=YES}-->
+                                       <!--{if:notification_contact_addr1=YES}-->
+                                               <TR><TH ALIGN="left">{prompt_contact_addr1}:&nbsp;</TH><TD>{contact_addr1}</TD></TR>
+                               <!--{/if:notification_contact_addr1}-->
+                          <!--{/if:use_contact_addr1}-->
+                              <!--{if:use_contact_addr2=YES}-->
+                                       <!--{if:notification_contact_addr2=YES}-->
+                                           <!--{if:addr2}--><TR><TH ALIGN="left">{prompt_contact_addr2}:&nbsp;</TH><TD>{contact_addr2}</TD></TR><!--{/if:addr2}-->
+                               <!--{/if:notification_contact_addr2}-->
+                          <!--{/if:use_contact_addr2}-->
+                              <!--{if:use_contact_city=YES}-->
+                                       <!--{if:notification_contact_city=YES}-->
+                                                   <TR><TH ALIGN="left">&nbsp;</TH><TD>{contact_city}, {contact_state} {contact_zip} {contact_country}</TD></TR>
+                                       <!--{/if:notification_contact_city}-->
+                          <!--{/if:use_contact_city}-->
+                              <!--{if:use_contact_phone=YES}-->
+                                       <!--{if:notification_contact_phone=YES}-->
+                                               <TR><TH ALIGN="left">Phone:&nbsp;</TH><TD>{contact_phone}</TD></TR>
+                                               <!--{/if:notification_contact_phone}-->
+                          <!--{/if:use_contact_phone}-->
+                          <!--{if:use_contact_fax=YES}-->
+                                       <!--{if:notification_contact_phone=YES}-->
+                                               <TR><TH ALIGN="left">FAX:&nbsp;</TH><TD>{contact_fax}</TD></TR>
+                                               <!--{/if:notification_contact_phone}-->
+                          <!--{/if:use_contact_fax}-->
+                                               </table>
+                                       </td>
+                               </TR>
+  <!--{/if:show_contact_data}-->
+       <!--{list:notify}-->
+               <tr><th colspan="2" align="left" bgcolor="#eee">{word_Registering} For:</th></tr>
+               <tr>
+                       <td>
+                               <table>
+                                       <tr><th align="left">{word_Event} Name:</th><td>{event_name}</td></tr>
+               <!--{if:notification_short_descr=YES}-->
+                                       <tr><th align="left" valign="top">Description:</th><td>{short_descr}</td></tr>
+               <!--{/if:notification_short_descr}-->
+               <!--{if:date_specific=YES}-->
+                                       <tr><th align="left">Dates:</th><td>{start_date} through {end_date}</td></tr>
+                                       <tr><th align="left">Days:</th><td>{days}</td></tr>
+               <!--{/if:date_specific}-->
+               <!--{if:notification_duration=YES}-->
+                                       <tr><th align="left">Duration:</th><td>{duration}</td></tr>
+               <!--{/if:notification_duration}-->
+               <!--{if:ask_date=YES}-->
+                                       <tr><th align="left">Desired Date:</th><td>{desired_date_int}</td></tr>
+               <!--{else:ask_date}
+                                       <tr><th align="left">Start Date:</th><td>{start_date_int}</td></tr>
+                                       <tr><th align="left">End Date:</th><td>{end_date_int}</td></tr>
+               {/if:ask_date}-->
+                                       <tr><th align="left">Location:</th><td>{location}</td></tr>
+                                       <tr><th align="left">{word_Registration} Selected:</th><td>{rate_class}</td></tr>
+                       <!--{if:need_attendees=YES}-->
+                                       <tr><th align="left">Number of {word_Attendees}:</th><td>{numb_attendees}</td></tr>
+                       <!--{/if:need_attendees}-->
+                               </table>
+                       </td>
+               </tr>
+               <tr><th colspan="2" align="left" bgcolor="#eee">Additional Information:</th></tr>
+               <tr>
+                       <td>
+                               <table>
+               <!--{if:have_attendees=YES}-->
+                       <!--{list:attendees}-->
+                                       <tr>
+                                               <td>
+                                                       <table>
+                                                               <tr><th colspan="2">{name}</th></tr>
+                               <!--{if:med_info=YES}-->
+                                                               <tr><th align="left">Date of Birth:</th><td>{dob}</td></tr>
+                                                               <tr><th align="left">Guardian:</th><td>{guardian}</td></tr>
+                                                               <tr><th align="left">Emergency Contact:</th><td>{emer_contact}</td></tr>
+                                                               <tr><th align="left">Emergency Phone:</th><td>{emer_phone}</td></tr>
+                                                               <tr><th align="left">Medical History:</th><td>{med_history}</td></tr>
+                                                               <tr><th align="left">Allergy Medications:</th><td>{allergy_med}</td></tr>
+                               <!--{/if:med_info}-->
+                                                       </table>        
+                                               </td>
+                                       </tr>
+                       <!--{/list:attendees}-->
+                                       <tr><td>&nbsp;</td></tr>
+               <!--{/if:have_attendees}-->
+                                       <!--{if:have_mf_data=YES}-->
+                                                                       <tr>
+                                                                               <th class="left" colspan="3">&nbsp;</th>
+                                                                       </tr>
+                                         <!--{list:mf_data}-->
+                                                                       <tr>
+                                                                               <th class="left" align="left">{indent}{title}:&nbsp;&nbsp;</th><td align="left" colspan="2" width="60%">{value}</td>
+                                                                       </tr>
+                                         <!--{/list:mf_data}-->      
+                                       <!--{/if:have_mf_data}-->
+                               </table>
+                       </td>
+               </tr>
+       <!--{/list:notify}-->
+       </table>
+       </body>
+</html>
\ No newline at end of file
diff --git a/front-end/Views/notify_site_owner.html b/front-end/Views/notify_site_owner.html
new file mode 100644 (file)
index 0000000..e24936b
--- /dev/null
@@ -0,0 +1,250 @@
+<HTML>
+  <HEAD>
+<!--{if:haveCustomStylesheet=YES}-->
+       <LINK REL="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/style.css">
+<!--{else:haveCustomStylesheet}
+       <LINK REL="stylesheet" HREF="{base_app_secure_url}Common/Registrations_V3/front-end/Views/style.css">
+{/if:haveCustomStylesheet}-->
+<!--{if:haveStylesheetOverride=YES}-->
+       <link type="text/css" rel="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/override.css">
+<!--{/if:haveStylesheetOverride}-->
+    
+  </head>
+  <body bgcolor="FFFFFF">
+       <p>A {word_Event} request has been submitted.</p>
+       <p><b>Request #:</b> {reg_req_id}</p>
+         
+
+       <p>&nbsp;</p>
+    <table width="750" border="0" cellspacing="0" cellpadding="0">
+      <tr>
+        <td align="center">
+            <table border="0" width="100%" cellspacing="0" cellpadding="5">
+                         <TR><TD COLSPAN="2">
+               
+                           <table border="1" cellspacing="0" cellpadding="5">
+                    <!--{if:free_reg=YES}-->
+                               <tr>
+                                       <TH ALIGN="center" colspan="2"><NOBR>Submitted by:</NOBR></TH>
+                               </tr>
+                    <!--{else:free_reg}
+                               <tr>
+                                       <TH ALIGN="center" colspan="2"><NOBR>Bill to:</NOBR></TH>
+                               </tr>
+                    {/if:free_reg}-->
+                               <tr>
+                                       <TD valign="top" width="50%">
+                                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                               <TR><TH ALIGN="left">Name:&nbsp;</TH><TD><!--{if:show_free_fname=YES}-->{fname} <!--{/if:show_free_fname}--><!--{if:show_free_lname=YES}-->{lname}<!--{/if:show_free_lname}--></TD></TR>
+                                               <!--{if:show_free_addr1=YES}--><TR><TH ALIGN="left">Address:&nbsp;</TH><TD>{addr1}</TD></TR><!--{/if:show_free_addr1}-->
+                                           <!--{if:show_free_addr2=YES}--><!--{if:addr2}--><TR><TH ALIGN="left">&nbsp;</TH><TD>{addr2}</TD></TR><!--{/if:addr2}--><!--{/if:show_free_addr2}-->
+                                                   <!--{if:show_free_cityzip=YES}--><TR><TH ALIGN="left">&nbsp;</TH><TD><!--{if:show_free_city=YES}-->{city}, <!--{/if:show_free_city}--><!--{if:show_free_state=YES}-->{state} <!--{/if:show_free_state}--><!--{if:show_free_zip=YES}-->{zip} <!--{/if:show_free_zip}--><!--{if:show_free_country=YES}-->{country}<!--{/if:show_free_country}--></TD></TR><!--{/if:show_free_cityzip}-->
+                                               <!--{if:show_free_phone=YES}--><TR><TH ALIGN="left">Phone:&nbsp;</TH><TD>{phone}</TD></TR><!--{/if:show_free_phone}-->
+                                       <!--{if:show_free_fax=YES}--><!--{if:fax}--><TR><TH ALIGN="left">FAX:&nbsp;</TH><TD>{fax}</TD></TR><!--{/if:fax}--><!--{/if:show_free_fax}-->
+                                               </table>
+                                       </td>
+                                       <TD valign="top" width="50%">
+                                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                    <!--{if:free_reg=NO}-->
+                                                               <TR>
+                                                                       <TH class="left">Total Charges:&nbsp;</TH>
+                                                                       <TD class="left">{grandTotal}</TD>
+                                                               </TR>
+                                               <TR>
+                                                       <TH class="left">Payment Type:&nbsp;</TH>
+                                                       <TD class="left">{payment_type_text}</TD>
+                                               </TR>
+                               <!--{if:payment_type=comp_code_DO_NOT_USE_NOW}-->
+                                               <TR>
+                                                       <TH class="left">Payment Code:&nbsp;</TH>
+                                                       <TD class="left">{pay_code}</TD>
+                                               </TR>
+                               <!--{/if:payment_type}-->
+                               <!--{if:payment_type=credit_card}-->
+                                                   <TR>
+                                                       <TH class="left" valign="top">Credit Card:&nbsp;</TH>
+                                                       <TD class="left">{cctype_store} {ccnum_trunc}<br>exp: {ccmonth_store}/{ccyear_store}</TD>
+                                               </TR>
+                                               <TR>
+                                                       <TH class="left">Name on Card:&nbsp;</TH><TD>{ccname}</TD>
+                                               </TR>
+                                               <TR>
+                                                       <TH class="left">Auth Code:&nbsp;</TH><TD>{auth_code}</TD>
+                                               </TR>
+                               <!--{/if:payment_type}-->
+                                   <!--{else:free_reg}
+                                                               <tr><td colspan="2">&nbsp;</td></tr>
+                                   {/if:free_reg}-->
+                                               </table>
+                                       </TD>
+                               </tr>
+  <!--{if:show_contact_data=YES}-->
+                               <tr><TH ALIGN="center" colspan="2"><NOBR>{contact_information_title}:</NOBR></TH></tr>
+                               <tr>
+                                       <TD valign="top" colspan="2"">
+                                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                          <!--{if:use_contact_fname=YES}-->
+                                               <TR><TH ALIGN="left">{prompt_contact_fname}:&nbsp;</TH><TD>{contact_fname}</TD></TR>
+                          <!--{/if:use_contact_fname}-->
+                              <!--{if:use_contact_lname=YES}-->
+                                               <TR><TH ALIGN="left">{prompt_contact_lname}:&nbsp;</TH><TD>{contact_lname}</TD></TR>
+                          <!--{/if:use_contact_lname}-->
+                              <!--{if:use_contact_addr1=YES}-->
+                                               <TR><TH ALIGN="left">{prompt_contact_addr1}:&nbsp;</TH><TD>{contact_addr1}</TD></TR>
+                          <!--{/if:use_contact_addr1}-->
+                              <!--{if:use_contact_addr2=YES}-->
+                                           <!--{if:addr2}--><TR><TH ALIGN="left">{prompt_contact_addr2}:&nbsp;</TH><TD>{contact_addr2}</TD></TR><!--{/if:addr2}-->
+                          <!--{/if:use_contact_addr2}-->
+                              <!--{if:use_contact_city=YES}-->
+                                                   <TR><TH ALIGN="left">&nbsp;</TH><TD>{contact_city}, {contact_state} {contact_zip} {contact_country}</TD></TR>
+                          <!--{/if:use_contact_city}-->
+                              <!--{if:use_contact_phone=YES}-->
+                                               <TR><TH ALIGN="left">Phone:&nbsp;</TH><TD>{contact_phone}</TD></TR>
+                          <!--{/if:use_contact_phone}-->
+                              <!--{if:use_contact_fax=YES}-->
+                                               <TR><TH ALIGN="left">FAX:&nbsp;</TH><TD>{contact_fax}</TD></TR>
+                          <!--{/if:use_contact_fax}-->
+                                               </table>
+                                       </td>
+                               </TR>
+  <!--{/if:show_contact_data}-->
+                               <TR><td colspan="2"><table border="0" cellspacing="0" cellpadding="0"><tr><th><TH ALIGN="left">E-Mail:&nbsp;</TH><TD>{email}</TD></TR></table></td></TR>
+                       <!--{list:shoppingCart}-->
+                               <tr>
+                                       <TD valign="top" colspan="2"">
+                                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                                                       <tr>
+                                                                               <th align="left">{word_Event}: </th>
+                                                                               <td align="left" colspan="3">{event_name}</td>
+                                                                       </tr>
+                                                       <!--{if:have_location=YES}-->
+                                                                       <tr>
+                                                                               <th align="left">Location: </th>
+                                                                               <td align="left" colspan="3">{location}</td>
+                                                                       </tr>
+                                                       <!--{/if:have_location}-->
+                                                       <!--{if:date_specific=YES}-->                                   
+                                                                       <tr>
+                                                                               <th align="left">Dates: </th>
+                                                                               <td align="left" colspan="3">{start_date} through {end_date}</td>
+                                                                       </tr>
+                                                       <!--{/if:date_specific}-->                                      
+                                                       <!--{if:ask_date=YES}-->                                        
+                                                                       <tr>
+                                                                               <th align="left">Desired Date: </th>
+                                                                               <td align="left" colspan="3">{desired_date}</td>
+                                                                       </tr>
+                                                       <!--{else:ask_date}
+                                                               <!--{if:have_days=YES}-->
+                                                                       <tr>
+                                                                               <th align="left">Days: </th>
+                                                                               <td align="left" colspan="3">{days}</td>
+                                                                       </tr>
+                                                               <!--{/if:have_days}-->
+                                                       {/if:ask_date}-->
+                                                                       <tr>
+                                                                               <th align="left">Selected: </th>
+                                                                               <td align="left" colspan="3">{rate_class}</td>
+                                                                       </tr>
+                                                                       <tr><td colspan="4">&nbsp;</td></tr>
+                                                           <tr>
+                                                               <th align="left" colspan="2">Charges</th>
+                                                               <th align="left">Per {word_Attendee}</th>
+                                                               <th align="left">Total</th>
+                                                       </tr>
+                                         <!--{list:charges}-->
+                                                           <tr>
+                                                               <td align="left" colspan="2">{charge_title}</td>
+                                                               <td align="left">{charge}</td>
+                                                               <td align="left">{extend}</td>
+                                                       </tr>
+                                         <!--{sep:charges}-->
+                                         <!--{/sep:charges}-->
+                                                           <tr>
+                                                               <td align="left" colspan="2">{charge_title}</td>
+                                                               <td align="left">{charge}</td>
+                                                               <td align="left">{extend}</td>
+                                                       </tr>
+                                         <!--{/list:charges}-->
+                                                           <tr>
+                                                               <th align="left">Total</th>
+                                                               <td colspan="2"></td>
+                                                               <td align="left">{totalCharges}</td>
+                                                       </tr>
+                                                           <tr><td colspan="4">&nbsp;</td></tr>                            
+                         <!--{if:need_attendees=YES}--> 
+                                       <!--{if:have_attendees=YES}-->
+                            <!--{if:med_info=YES}-->
+                                                   <tr>
+                                                       <th align="left" colspan="4">{word_Attendees}:</th>
+                                               </tr>      
+                             <!--{list:attendees}-->
+                                                   <tr>
+                                                       <td align="left" colspan="4">&nbsp;&nbsp;&nbsp;{name}</td>
+                                               </tr>
+                                                   <tr>
+                                                       <td colspan="4">
+                                                           <table border="0">
+                                                 <!--{if:have_dob=YES}-->
+                                                               <tr><td width="20">&nbsp;</td><th align="left">Date of Birth: </th><td>{dob}</td></tr>
+                                                 <!--{/if:have_dob}-->
+                                                 <!--{if:have_guardian=YES}-->
+                                                               <tr><td width="20">&nbsp;</td><th align="left">Parent/Guardian: </th><td>{guardian}</td></tr>
+                                                 <!--{/if:have_guardian}-->
+                                                 <!--{if:have_emer_contact=YES}-->
+                                                               <tr><td width="20">&nbsp;</td><th align="left">Emergency Contact: </th><td>{emer_contact}</td></tr>
+                                                 <!--{/if:have_emer_contact}-->
+                                                 <!--{if:have_emer_phone=YES}-->
+                                                               <tr><td width="20">&nbsp;</td><th align="left">Emergency Phone: </th><td>{emer_phone}</td></tr>
+                                                 <!--{/if:have_emer_phone}-->
+                                                 <!--{if:have_med_history=YES}-->
+                                                               <tr><td width="20">&nbsp;</td><th align="left">Brief Medical History: </th><td>{med_history}</td></tr>
+                                                 <!--{/if:have_med_history}-->
+                                                 <!--{if:have_allergy_med=YES}-->
+                                                               <tr><td width="20">&nbsp;</td><th align="left">Alergies/Medications: </th><td>{allergy_med}</td></tr>
+                                                 <!--{/if:have_allergy_med}-->
+                                                           </table>
+                                                       </td>
+                                                   </tr>
+                             <!--{/list:attendees}-->
+                            <!--{else:med_info}
+                                                   <tr>
+                                                       <th align="left">Attendees:</th>
+                                                       <td align="left" colspan="3">
+                             <!--{list:attendees}-->{name}<!--{sep:attendees}-->, <!--{/sep:attendees}-->{name}<!--{/list:attendees}-->
+                                                       </td>
+                                               </tr>      
+                            {/if:med_info}-->
+                               <!--{/if:have_attendees}-->
+                         <!--{/if:need_attendees}-->
+                                       
+                                       <!--{if:have_mf_data=YES}-->
+                                                                       <tr>
+                                                                               <th align="left" colspan="4">&nbsp;</th>
+                                                                       </tr>
+                                                                       <tr>
+                                                                               <th align="left" colspan="4">Additional Data:</th>
+                                                                       </tr>
+                                         <!--{list:mf_data}-->
+                                                                       <tr>
+                                                                               <th align="left" colspan="2">{indent}{title}:&nbsp;&nbsp;</th><td align="left" colspan="2" width="60%">{value}</td>
+                                                                       </tr>
+                                         <!--{/list:mf_data}-->      
+                                       <!--{/if:have_mf_data}-->
+                                                       
+                                                         </table>
+                                                         </TD>
+                                               </tr>
+                       <!--{/list:shoppingCart}-->
+                             
+                         </TABLE>
+                               </TD></TR>
+
+            </TABLE>
+        </TD>
+      </TR>
+    </table>
+  </BODY>
+</HTML>
+
+
diff --git a/front-end/Views/password_reset.html b/front-end/Views/password_reset.html
new file mode 100644 (file)
index 0000000..f897195
--- /dev/null
@@ -0,0 +1,44 @@
+<!--{if:haveCustomStylesheet=YES}-->
+       <LINK REL="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/style.css">
+<!--{else:haveCustomStylesheet}
+       <LINK REL="stylesheet" HREF="{base_app_secure_url}Common/Registrations_V3/front-end/Views/style.css">
+{/if:haveCustomStylesheet}-->
+<!--{if:haveStylesheetOverride=YES}-->
+       <link type="text/css" rel="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/override.css">
+<!--{/if:haveStylesheetOverride}-->
+
+<div id="registrations">
+
+       <!--{if:have_reason=YES}-->
+       <div class="regWarning">
+               Please Note:<br>
+               <ul>
+                       <!--{list:reason}-->
+                       <li>{text}</li>
+                       <!--{/list:reason}-->
+               </ul>
+       </div>
+       <!--{/if:have_reason}-->
+
+       <div>
+
+        <h3>Password Reset</h3>
+
+               <br clear="all">
+               <hr>
+               <div id="introMembers">
+                       <p>An E-Mail message has been sent to the address on record for your user account.</p>
+                       <p>
+                               The E-Mail message contains a link to a Web page where you will be able to enter a new password for your account. 
+                               You will also need to enter the <b>Password Reset Code</b> below. 
+                       </p>
+                       <p>&nbsp;</p>
+                       <h3>Password Reset Code: <span style="color: red;">{reset_password}</span></h3>
+                       <p>&nbsp;</p>
+                       <p style="color: red;">
+                               Please write this code down. You will need it to reset your account password.
+                       </p>
+               </div>
+       </div>
+       <a href="{base_secure_url}index.php?catid={category_id}{preview}" class="pseudoButton">Return to {word_Events}</a>
+<div>
diff --git a/front-end/Views/registration_price_guide.html b/front-end/Views/registration_price_guide.html
new file mode 100644 (file)
index 0000000..874e1a7
--- /dev/null
@@ -0,0 +1,123 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+"http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<title>Price Guide</title>
+<meta http-equiv="content-type" content="text/html;charset=utf-8">
+<meta http-equiv="imagetoolbar" content="no">
+<meta http-equiv="imagetoolbar" content="false">
+<style type="text/css">
+      .section {color: blue; FONT-FAMILY: Arial, Helvetica, sans-serif;}
+      .title { FONT-SIZE: 12pt; PADDING-BOTTOM: 0px; FONT-FAMILY: Arial, Helvetica, sans-serif; font-weight: bold; color: black; }
+      .name { FONT-SIZE: 14pt; PADDING-BOTTOM: 0px; FONT-FAMILY:  Arial, Helvetica, sans-serif; font-weight: bold; color: black; }
+      .dates { FONT-SIZE: 10pt; PADDING-BOTTOM: 0px; FONT-FAMILY: Arial, Helvetica, sans-serif; font-weight: bold; color: black; }
+      th {font-size: 8pt;FONT-FAMILY: Arial, Helvetica, sans-serif; }
+      td {font-size: 8pt; FONT-FAMILY: Arial, Helvetica, sans-serif;}
+      a:link { FONT-SIZE: 11px; COLOR: #006bb7; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none }
+      a:visited { FONT-SIZE: 11px; COLOR: #006bb7; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none }
+      a:active { FONT-SIZE: 11px; COLOR: #006bb7; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none }
+      a:hover { FONT-SIZE: 11px; COLOR: #006bb7; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: underline }
+</style>
+
+<script type="text/javascript">
+<!--
+function close_popup()
+       {
+       self.close();
+       }
+-->
+</script>    
+</head>
+
+
+  <body bgcolor="#FFFFFF" text="#000000" link="#FF9966" vlink="#FF9966" alink="#FFCC99">
+    <center>
+
+  <span class="title">Date and Price Guide</span><br>
+  <span class="name">{convention_name}</span><br>
+  <span class="dates">{start_date} through {end_date}</span>
+  <p>
+  <A HREF="javascript:void close_popup();">[Close Window]</A>
+  <p>
+  <!--{if:reason}-->
+    <h2>Unable to display price guide</h2>
+    {reason}
+  <!--{else:reason}
+   <!--{if:cutoff_date}-->
+      <p>
+      <span class="section">If before {cutoff_date}</span>
+<table width="100%">
+<tr>
+<td>  
+        <table border="1" cellpadding="2" cellspacing="0" width="95%" bgcolor="#EEFFFF">
+        <!--{if:have_rates_1}-->
+          <tr><th align="left">&nbsp;</th><th align="right">Base Rate</th><th align="center">{word_Attendees} Included</th><th align="right">Per additional {word_Attendee}</th></tr>
+          <!--{list:rate_list_1}-->
+            <tr><td align="left">{rate_class}</td><td align="right">{base_rate}&nbsp;</td><td align="center">{attendee_credits}&nbsp;</td><td align="right">{attendee_rate}&nbsp;</td></tr>
+          <!--{/list:rate_list_1}-->
+        <!--{else:have_rates_1}
+          <!-- <tr><th align="center">No charge for registration. Other charges may apply.</th></tr> -->
+        {/if:have_rates_1}-->
+        </table>
+      </td></tr>
+        
+    <!--{if:cutoff_date2}-->
+      <p>
+      <span class="section">If on or after {cutoff_date} and before {cutoff_date2}</span>
+      <tr><td>
+        <table border="1" cellpadding="2" cellspacing="0" width="95%" bgcolor="#EEFFFF">
+        <!--{if:have_rates_2}-->
+          <tr><th align="left">&nbsp;</th><th align="right">Base Rate</th><th align="center">{word_Attendees} Included</th><th align="right">Per additional {word_Attendee}</th></tr>
+          <!--{list:rate_list_2}-->
+            <tr><td align="left">{rate_class}</td><td align="right">{base_rate}&nbsp;</td><td align="center">{attendee_credits}&nbsp;</td><td align="right">{attendee_rate}&nbsp;</td></tr>
+          <!--{/list:rate_list_2}-->
+        <!--{else:have_rates_2}
+          <!-- <tr><th align="center">No charge for registration. Other charges may apply.</th></tr> -->
+        {/if:have_rates_2}-->
+        </table>
+      </td></tr>
+    
+     <!--{if:cutoff_date3}-->
+      <p>
+      <span class="section">If on or after {cutoff_date2} and before {cutoff_date3}</span>
+      <tr><td>
+        <table border="1" cellpadding="2" cellspacing="0" width="95%" bgcolor="#EEFFFF">
+        <!--{if:have_rates_3}-->
+          <tr><th align="left">&nbsp;</th><th align="right">Base Rate</th><th align="center">{word_Attendees} Included</th><th align="right">Per additional {word_Attendee}</th></tr>
+          <!--{list:rate_list_3}-->
+            <tr><td align="left">{rate_class}</td><td align="right">{base_rate}&nbsp;</td><td align="center">{attendee_credits}&nbsp;</td><td align="right">{attendee_rate}&nbsp;</td></tr>
+          <!--{/list:rate_list_3}-->
+        <!--{else:have_rates_3}
+          <!-- <tr><th align="center">No charge for registration. Other charges may apply.</th></tr> -->
+        {/if:have_rates_3}-->
+        </table>
+      </td></tr>
+    
+       <!--{if:cutoff_date4}-->
+      <p>
+      <span class="section">If on or after {cutoff_date3} and before {cutoff_date4}</span>
+      <tr><td>
+        <table border="1" cellpadding="2" cellspacing="0" width="95%" bgcolor="#EEFFFF">
+        <!--{if:have_rates_4}-->
+          <tr><th align="left">&nbsp;</th><th align="right">Base Rate</th><th align="center">{word_Attendees} Included</th><th align="right">Per additional {word_Attendee}</th></tr>
+          <!--{list:rate_list_4}-->
+            <tr><td align="left">{rate_class}</td><td align="right">{base_rate}&nbsp;</td><td align="center">{attendee_credits}&nbsp;</td><td align="right">{attendee_rate}&nbsp;</td></tr>
+          <!--{/list:rate_list_4}-->
+        <!--{else:have_rates_4}
+          <!-- <tr><th align="center">No charge for registration. Other charges may apply.</th></tr> -->
+        {/if:have_rates_4}-->
+        </table>
+      </td></tr></table>
+    
+       <!--{/if:cutoff_date4}-->
+     <!--{/if:cutoff_date3}-->
+    <!--{/if:cutoff_date2}-->
+   <!--{/if:cutoff_date}-->
+  
+  <p><span class="dates">
+  No submissions accepted after last date above.</span>
+  </center>
+  {/if:reason}-->
+
+  </body>
+</html>
diff --git a/front-end/Views/registrations_confirmation.html b/front-end/Views/registrations_confirmation.html
new file mode 100644 (file)
index 0000000..0becae2
--- /dev/null
@@ -0,0 +1,247 @@
+<HTML>
+  <HEAD>
+<!--{if:haveCustomStylesheet=YES}-->
+       <LINK REL="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/style.css">
+<!--{else:haveCustomStylesheet}
+       <LINK REL="stylesheet" HREF="{base_app_secure_url}Common/Registrations_V3/front-end/Views/style.css">
+{/if:haveCustomStylesheet}-->
+<!--{if:haveStylesheetOverride=YES}-->
+       <link type="text/css" rel="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/override.css">
+<!--{/if:haveStylesheetOverride}-->
+    
+  </head>
+  <body bgcolor="FFFFFF">
+       {ack_intro}
+       <p>&nbsp;</p>
+    <table width="750" border="0" cellspacing="0" cellpadding="0">
+      <tr>
+        <td align="center">
+            <table border="0" width="100%" cellspacing="0" cellpadding="5">
+                         <TR><TD COLSPAN="2">
+               
+                           <table border="1" cellspacing="0" cellpadding="5">
+                    <!--{if:free_reg=YES}-->
+                               <tr>
+                                       <TH ALIGN="center" colspan="2"><NOBR>Submitted by:</NOBR></TH>
+                               </tr>
+                    <!--{else:free_reg}
+                               <tr>
+                                       <TH ALIGN="center" colspan="2"><NOBR>Bill to:</NOBR></TH>
+                               </tr>
+                    {/if:free_reg}-->
+                               <tr>
+                                       <TD valign="top" width="50%">
+                                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                               <TR><TH ALIGN="left">Name:&nbsp;</TH><TD><!--{if:show_free_fname=YES}-->{fname} <!--{/if:show_free_fname}--><!--{if:show_free_lname=YES}-->{lname}<!--{/if:show_free_lname}--></TD></TR>
+                                               <!--{if:show_free_addr1=YES}--><TR><TH ALIGN="left">Address:&nbsp;</TH><TD>{addr1}</TD></TR><!--{/if:show_free_addr1}-->
+                                           <!--{if:show_free_addr2=YES}--><!--{if:addr2}--><TR><TH ALIGN="left">&nbsp;</TH><TD>{addr2}</TD></TR><!--{/if:addr2}--><!--{/if:show_free_addr2}-->
+                                                   <!--{if:show_free_cityzip=YES}--><TR><TH ALIGN="left">&nbsp;</TH><TD><!--{if:show_free_city=YES}-->{city}, <!--{/if:show_free_city}--><!--{if:show_free_state=YES}-->{state} <!--{/if:show_free_state}--><!--{if:show_free_zip=YES}-->{zip} <!--{/if:show_free_zip}--><!--{if:show_free_country=YES}-->{country}<!--{/if:show_free_country}--></TD></TR><!--{/if:show_free_cityzip}-->
+                                               <!--{if:show_free_phone=YES}--><TR><TH ALIGN="left">Phone:&nbsp;</TH><TD>{phone}</TD></TR><!--{/if:show_free_phone}-->
+                                       <!--{if:show_free_fax=YES}--><!--{if:fax}--><TR><TH ALIGN="left">FAX:&nbsp;</TH><TD>{fax}</TD></TR><!--{/if:fax}--><!--{/if:show_free_fax}-->
+                                               </table>
+                                       </td>
+                                       <TD valign="top" width="50%">
+                                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                    <!--{if:free_reg=NO}-->
+                                                               <TR>
+                                                                       <TH class="left">Total Charges:&nbsp;</TH>
+                                                                       <TD class="left">{grandTotal}</TD>
+                                                               </TR>
+                                               <TR>
+                                                       <TH class="left">Payment Type:&nbsp;</TH>
+                                                       <TD class="left">{payment_type_text}</TD>
+                                               </TR>
+                               <!--{if:payment_type=comp_code_DO_NOT_USE_NOW}-->
+                                               <TR>
+                                                       <TH class="left">Payment Code:&nbsp;</TH>
+                                                       <TD class="left">{pay_code}</TD>
+                                               </TR>
+                               <!--{/if:payment_type}-->
+                               <!--{if:payment_type=credit_card}-->
+                                                   <TR>
+                                                       <TH class="left" valign="top">Credit Card:&nbsp;</TH>
+                                                       <TD class="left">{cctype_store} {ccnum_trunc}<br>exp: {ccmonth_store}/{ccyear_store}</TD>
+                                               </TR>
+                                               <TR>
+                                                       <TH class="left">Name on Card:&nbsp;</TH><TD>{ccname}</TD>
+                                               </TR>
+                                               <TR>
+                                                       <TH class="left">Auth Code:&nbsp;</TH><TD>{auth_code}</TD>
+                                               </TR>
+                               <!--{/if:payment_type}-->
+                                   <!--{else:free_reg}
+                                                               <tr><td colspan="2">&nbsp;</td></tr>
+                                   {/if:free_reg}-->
+                                               </table>
+                                       </TD>
+                               </tr>
+  <!--{if:show_contact_data=YES}-->
+                               <tr><TH ALIGN="center" colspan="2"><NOBR>{contact_information_title}:</NOBR></TH></tr>
+                               <tr>
+                                       <TD valign="top" colspan="2"">
+                                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                          <!--{if:use_contact_fname=YES}-->
+                                               <TR><TH ALIGN="left">{prompt_contact_fname}:&nbsp;</TH><TD>{contact_fname}</TD></TR>
+                          <!--{/if:use_contact_fname}-->
+                              <!--{if:use_contact_lname=YES}-->
+                                               <TR><TH ALIGN="left">{prompt_contact_lname}:&nbsp;</TH><TD>{contact_lname}</TD></TR>
+                          <!--{/if:use_contact_lname}-->
+                              <!--{if:use_contact_addr1=YES}-->
+                                               <TR><TH ALIGN="left">{prompt_contact_addr1}:&nbsp;</TH><TD>{contact_addr1}</TD></TR>
+                          <!--{/if:use_contact_addr1}-->
+                              <!--{if:use_contact_addr2=YES}-->
+                                           <!--{if:addr2}--><TR><TH ALIGN="left">{prompt_contact_addr2}:&nbsp;</TH><TD>{contact_addr2}</TD></TR><!--{/if:addr2}-->
+                          <!--{/if:use_contact_addr2}-->
+                              <!--{if:use_contact_city=YES}-->
+                                                   <TR><TH ALIGN="left">&nbsp;</TH><TD>{contact_city}, {contact_state} {contact_zip} {contact_country}</TD></TR>
+                          <!--{/if:use_contact_city}-->
+                              <!--{if:use_contact_phone=YES}-->
+                                               <TR><TH ALIGN="left">Phone:&nbsp;</TH><TD>{contact_phone}</TD></TR>
+                          <!--{/if:use_contact_phone}-->
+                              <!--{if:use_contact_fax=YES}-->
+                                               <TR><TH ALIGN="left">FAX:&nbsp;</TH><TD>{contact_fax}</TD></TR>
+                          <!--{/if:use_contact_fax}-->
+                                               </table>
+                                       </td>
+                               </TR>
+  <!--{/if:show_contact_data}-->
+                               <TR><td colspan="2"><table border="0" cellspacing="0" cellpadding="0"><tr><th><TH ALIGN="left">E-Mail:&nbsp;</TH><TD>{email}</TD></TR></table></td></TR>
+                       <!--{list:shoppingCart}-->
+                               <tr>
+                                       <TD valign="top" colspan="2"">
+                                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                                                       <tr>
+                                                                               <th align="left">{word_Event}: </th>
+                                                                               <td align="left" colspan="3">{event_name}</td>
+                                                                       </tr>
+                                                       <!--{if:have_location=YES}-->
+                                                                       <tr>
+                                                                               <th align="left">Location: </th>
+                                                                               <td align="left" colspan="3">{location}</td>
+                                                                       </tr>
+                                                       <!--{/if:have_location}-->
+                                                       <!--{if:date_specific=YES}-->                                   
+                                                                       <tr>
+                                                                               <th align="left">Dates: </th>
+                                                                               <td align="left" colspan="3">{start_date} through {end_date}</td>
+                                                                       </tr>
+                                                       <!--{/if:date_specific}-->                                      
+                                                       <!--{if:ask_date=YES}-->                                        
+                                                                       <tr>
+                                                                               <th align="left">Desired Date: </th>
+                                                                               <td align="left" colspan="3">{desired_date}</td>
+                                                                       </tr>
+                                                       <!--{else:ask_date}
+                                                               <!--{if:have_days=YES}-->
+                                                                       <tr>
+                                                                               <th align="left">Days: </th>
+                                                                               <td align="left" colspan="3">{days}</td>
+                                                                       </tr>
+                                                               <!--{/if:have_days}-->
+                                                       {/if:ask_date}-->
+                                                                       <tr>
+                                                                               <th align="left">Selected: </th>
+                                                                               <td align="left" colspan="3">{rate_class}</td>
+                                                                       </tr>
+                                                                       <tr><td colspan="4">&nbsp;</td></tr>
+                                                           <tr>
+                                                               <th align="left" colspan="2">Charges</th>
+                                                               <th align="left">Per {word_Attendee}</th>
+                                                               <th align="left">Total</th>
+                                                       </tr>
+                                         <!--{list:charges}-->
+                                                           <tr>
+                                                               <td align="left" colspan="2">{charge_title}</td>
+                                                               <td align="left">{charge}</td>
+                                                               <td align="left">{extend}</td>
+                                                       </tr>
+                                         <!--{sep:charges}-->
+                                         <!--{/sep:charges}-->
+                                                           <tr>
+                                                               <td align="left" colspan="2">{charge_title}</td>
+                                                               <td align="left">{charge}</td>
+                                                               <td align="left">{extend}</td>
+                                                       </tr>
+                                         <!--{/list:charges}-->
+                                                           <tr>
+                                                               <th align="left">Total</th>
+                                                               <td colspan="2"></td>
+                                                               <td align="left">{totalCharges}</td>
+                                                       </tr>
+                                                           <tr><td colspan="4">&nbsp;</td></tr>                            
+                         <!--{if:need_attendees=YES}--> 
+                                       <!--{if:have_attendees=YES}-->
+                            <!--{if:med_info=YES}-->
+                                                   <tr>
+                                                       <th align="left" colspan="4">{word_Attendees}:</th>
+                                               </tr>      
+                             <!--{list:attendees}-->
+                                                   <tr>
+                                                       <td align="left" colspan="4">&nbsp;&nbsp;&nbsp;{name}</td>
+                                               </tr>
+                                                   <tr>
+                                                       <td colspan="4">
+                                                           <table border="0">
+                                                 <!--{if:have_dob=YES}-->
+                                                               <tr><td width="20">&nbsp;</td><th align="left">Date of Birth: </th><td>{dob}</td></tr>
+                                                 <!--{/if:have_dob}-->
+                                                 <!--{if:have_guardian=YES}-->
+                                                               <tr><td width="20">&nbsp;</td><th align="left">Parent/Guardian: </th><td>{guardian}</td></tr>
+                                                 <!--{/if:have_guardian}-->
+                                                 <!--{if:have_emer_contact=YES}-->
+                                                               <tr><td width="20">&nbsp;</td><th align="left">Emergency Contact: </th><td>{emer_contact}</td></tr>
+                                                 <!--{/if:have_emer_contact}-->
+                                                 <!--{if:have_emer_phone=YES}-->
+                                                               <tr><td width="20">&nbsp;</td><th align="left">Emergency Phone: </th><td>{emer_phone}</td></tr>
+                                                 <!--{/if:have_emer_phone}-->
+                                                 <!--{if:have_med_history=YES}-->
+                                                               <tr><td width="20">&nbsp;</td><th align="left">Brief Medical History: </th><td>{med_history}</td></tr>
+                                                 <!--{/if:have_med_history}-->
+                                                 <!--{if:have_allergy_med=YES}-->
+                                                               <tr><td width="20">&nbsp;</td><th align="left">Alergies/Medications: </th><td>{allergy_med}</td></tr>
+                                                 <!--{/if:have_allergy_med}-->
+                                                           </table>
+                                                       </td>
+                                                   </tr>
+                             <!--{/list:attendees}-->
+                            <!--{else:med_info}
+                                                   <tr>
+                                                       <th align="left">Attendees:</th>
+                                                       <td align="left" colspan="3">
+                             <!--{list:attendees}-->{name}<!--{sep:attendees}-->, <!--{/sep:attendees}-->{name}<!--{/list:attendees}-->
+                                                       </td>
+                                               </tr>      
+                            {/if:med_info}-->
+                               <!--{/if:have_attendees}-->
+                         <!--{/if:need_attendees}-->
+                                       
+                                       <!--{if:have_mf_data=YES}-->
+                                                                       <tr>
+                                                                               <th align="left" colspan="4">&nbsp;</th>
+                                                                       </tr>
+                                                                       <tr>
+                                                                               <th align="left" colspan="4">Additional Data:</th>
+                                                                       </tr>
+                                         <!--{list:mf_data}-->
+                                                                       <tr>
+                                                                               <th align="left" colspan="2">{indent}{title}:&nbsp;&nbsp;</th><td align="left" colspan="2" width="60%">{value}</td>
+                                                                       </tr>
+                                         <!--{/list:mf_data}-->      
+                                       <!--{/if:have_mf_data}-->
+                                                       
+                                                         </table>
+                                                         </TD>
+                                               </tr>
+                       <!--{/list:shoppingCart}-->
+                             
+                         </TABLE>
+                               </TD></TR>
+
+            </TABLE>
+        </TD>
+      </TR>
+    </table>
+  </BODY>
+</HTML>
+
+
diff --git a/front-end/Views/registrations_step0.html b/front-end/Views/registrations_step0.html
new file mode 100644 (file)
index 0000000..15bbc1b
--- /dev/null
@@ -0,0 +1,127 @@
+
+<!--{if:haveCustomStylesheet=YES}-->
+       <LINK REL="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/style.css">
+<!--{else:haveCustomStylesheet}
+       <LINK REL="stylesheet" HREF="{base_app_secure_url}Common/Registrations_V3/front-end/Views/style.css">
+{/if:haveCustomStylesheet}-->
+<!--{if:haveStylesheetOverride=YES}-->
+       <link type="text/css" rel="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/override.css">
+<!--{/if:haveStylesheetOverride}-->
+
+<div id="registrations">
+
+       <!--{if:admin_user=YES}-->
+       <div class="adminUser">
+               <b>{word_Registration} being entered by Admin User</b>
+       </div>
+       <!--{/if:admin_user}-->
+
+<!--{if:have_reason=YES}-->
+       <div class="regWarning">
+               Please Note:<br>
+               <ul>
+                       <!--{list:reason}-->
+                       <li>{text}</li>
+                       <!--{/list:reason}-->
+               </ul>
+       </div>
+<!--{else:have_reason}
+    <div id="regPageTopText">
+        {regbulletin}
+    </div>
+{/if:have_reason}-->
+
+       <div>
+               <!--{if:have_members=YES}-->
+               <hr class="regItemHR">
+               <div id="introMembers">
+                       <div style="float: right; width: 300px;">
+                               <form action="{base_secure_url}index.php?catid={category_id}{preview}" method="POST">
+                                       <input type="hidden" name="Action" value="Step0"> <input type="hidden" name="Option" value="MemberLogin">
+                                       <center>
+                                               <h3>{word_Member} Login</h3>
+                                       </center>
+                                       <table border="0">
+                                               <tr>
+                                                       <td class="required" style="width: 150px;">{word_User_id}:</td>
+                                                       <td><input type="text" name="memberID"
+                                                               value="{member_username}"></td>
+                                               </tr>
+                                               <tr>
+                                                       <td class="required">{word_Password}:</td>
+                                                       <td><input type="password" name="memberPasswd"
+                                                               value="{member_password}"></td>
+                                               </tr>
+                                               <tr>
+                                                       <td><input type="submit" value="Sign In" class="pseudoButton"></td>
+                                                       <td><a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=ForgotPassword&Type=Member">Forgot my {word_Password}</a></td>
+                                               </tr>
+                                       </table>
+                               </form>
+                       </div>
+                       <div style="float: left; width: 250px;">
+                               <h3>{customer_name} {word_Members}</h3>
+                               <p>
+                               Please log in using your member {word_user_id} and
+                               {word_password}. This is required to receive member rates and features.
+                               </p>
+                       </div>
+               </div>
+               <!--{/if:have_members}-->
+               <br clear="all">
+               <hr class="regItemHR">
+               <div id="introRegisterdUsers">
+       <!--{if:have_registered_users=YES}-->
+                       <div style="float: right; width: 300px;">
+                               <center>
+                                       <h3><!--{if:have_members=YES}-->Guest<!--{else:have_members}Registrant{/if:have_members}--> Login</h3>
+                               </center>
+                               <form
+                                       action="{base_secure_url}index.php?catid={category_id}{preview}"
+                                       method="POST">
+                                       <input type="hidden" name="Action" value="Step0"> 
+                                       <input type="hidden" name="count" value="{login_count}"> 
+                                       <input type="hidden" name="Option" value="NonMemberLogin">
+                                       <table border="0">
+                                               <tr>
+                                                       <td class="required" style="width: 150px;">E-Mail Address:</td>
+                                                       <td><input type="text" name="registrantEMail"
+                                                               value="{nonmember_email}"></td>
+                                               </tr>
+                                               <tr>
+                                                       <td class="required">Registrant Password:</td>
+                                                       <td><input type="password" name="registrantPasswd"
+                                                               value="{nonmember_password}"></td>
+                                               </tr>
+                                               <tr>
+                                                       <td><input type="submit" value="Sign In"></td>
+                                                       <td><a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=ForgotPassword&Type=NonMember">Forgot my {word_Password}</a></td>
+                                               </tr>
+                                       </table>
+                               </form>
+                       </div>
+       <!--{/if:have_registered_users}-->
+                       <div style="float: left; width: 250px;">
+               <!--{if:have_members=YES}-->
+                               <h3>Returning Guest</h3>
+                               <p>
+                               Returning Guests may log in using your E-mail address and
+                               the {word_password} you selected earlier. 
+                               </p>
+               <!--{else:have_members}
+                               <h3>Registrant</h3>
+                               <p>
+                               Previous registrants may log in using your E-Mail address and
+                               the {word_password} you selected earlier.
+                               </p>
+               {/if:have_members}-->
+                       </div>
+<br style="clear: both;">
+                       <hr class="regItemHR">
+       <!--{if:categories_on_intro_page=NO}-->
+                       <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step1" class="button wide"><span>Select {word_Events}</span></a>
+       <!--{/if:categories_on_intro_page}-->
+               </div>
+       </div>
+</div>
+<br clear="all">
\ No newline at end of file
diff --git a/front-end/Views/registrations_step1.html b/front-end/Views/registrations_step1.html
new file mode 100644 (file)
index 0000000..2125cdd
--- /dev/null
@@ -0,0 +1,447 @@
+<div id="registrations">
+
+<!--{if:extending_step0=NO}-->
+
+<!--{if:haveCustomStylesheet=YES}-->
+       <LINK REL="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/style.css">
+<!--{else:haveCustomStylesheet}
+       <LINK REL="stylesheet" HREF="{base_app_secure_url}Common/Registrations_V3/front-end/Views/style.css">
+{/if:haveCustomStylesheet}-->
+<!--{if:haveStylesheetOverride=YES}-->
+       <link type="text/css" rel="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/override.css">
+<!--{/if:haveStylesheetOverride}-->
+
+       
+<!--{if:categories_on_intro_page=NO}-->
+  <!--{if:admin_user=YES}-->
+    <div class="adminUser">
+        <b>{word_Registration} being entered by Admin User</b>
+    </div>
+  <!--{/if:admin_user}-->
+<!--{/if:categories_on_intro_page}-->  
+    <div id="regPageTopText">
+<!--{if:doingCategorySelection=YES}-->
+          <p>{regCatPageText}</p>
+<!--{else:doingCategorySelection}
+       <p>{regSubCatPageText}</p>
+{/if:doingCategorySelection}-->
+       </div>
+
+  <!--{if:have_reason=YES}-->
+        <div class="regWarning">
+            <h3>Your request was not submitted. Please check the following items.</h3>
+            <ul>
+    <!--{list:reason}-->
+                <li>{text}</li>
+    <!--{/list:reason}-->
+            </ul>
+        </div>
+  <!--{/if:have_reason}-->
+       
+  <!--{if:have_registered_users=YES}-->
+       <!--{if:haveUser=YES}-->
+               <hr>
+               <p>
+                       <b>Current Registered User:&nbsp;&nbsp;</b>{userFname}&nbsp;{userLname}&nbsp;&nbsp;&nbsp;&nbsp;<a href="{base_secure_url}index.php?catid={category_id}{preview}&logout=YES">(not me or log me out)</a>  
+                       <!--{if:userIsMember=YES}--><br>(A {customer_long_name} member)<!--{/if:userIsMember}-->        
+               </p>
+       <!--{/if:haveUser}-->
+  <!--{else:have_registered_users}
+    <!--{if:have_members=YES}-->
+       <!--{if:haveUser=YES}-->
+            <b>{customer_long_name} Member logged in</b><br> - <a href="{base_secure_url}index.php?catid={category_id}{preview}&logout=YES">Log Out</a>
+       <!--{/if:haveUser}-->
+    <!--{/if:have_members}-->
+  {/if:have_registered_users}-->
+  
+<!--{/if:extending_step0}-->
+  
+<!--{if:select_by_code=YES}-->
+            <form action="{base_secure_url}index.php?catid={category_id}{preview}" method="POST">
+                <input type="hidden" name="Action" value="Step2">
+                               <input type="hidden" name="todo" value="0">
+                <p>
+                    If you know your {word_Event} code: 
+                    <input type="text" name="requested_event_code">
+                    <input type="submit" value="Find {word_Event} by Code">
+                </p>
+            </form>
+<!--{/if:select_by_code}-->
+
+<!--{if:selection=SUB_CATEGORY}-->
+    <form action="{base_secure_url}index.php?catid={category_id}{preview}" method="POST">
+        <button name="Action" value="Step1">Select a Different {word_Category}</button>
+    </form>
+<!--{/if:selection}-->
+
+  <!--{if:haveMonths=YES}-->
+         <!--{if:select_by_month=YES}-->
+        <div class="regItem">
+            <form action="{base_secure_url}index.php?catid={category_id}{preview}" method="POST">
+                <input type="hidden" name="Action" value="Step2">
+                <h3>Select {word_category} of {word_Event} or search by month.</h3>
+                <p>
+                    Select Month: 
+                    <select name="event_month">
+        <!--{list:Months}-->
+                        <option value="{start_of_month}">{name_of_month}</option>
+        <!--{/list:Months}-->                               
+                    </select>
+                    <button name="todo" value="0">Find {word_Event} For Selected Month</button>
+                </p>
+            </form>
+        </div>
+         <!--{/if:select_by_month}-->
+  <!--{/if:haveMonths}-->
+  
+  <!--{if:have_picklists=YES}-->
+        <div class="regItem">
+            <form action="{base_secure_url}index.php?catid={category_id}{preview}" method="POST">
+                <input type="hidden" name="Action" value="Step2">
+                <h3>Select from the following</h3>
+                <p>
+       <!--{if:doing_main_categories=YES}-->
+                                       {word_Category}: 
+                    <select id="todo" name="todo" onChange="buildSub();">
+                       <option value="0">(select a {word_category})</option>
+               <!--{list:picklists}-->
+                                               <option value="{todo_id}">{todo_name}</option>
+               <!--{/list:picklists}-->
+                    </select>
+       <!--{/if:doing_main_categories}-->
+       <!--{if:doing_sub_categories=YES}-->    
+                                       <br>
+                                       {word_SubCategory}:
+                                       <select id="subcat" name="subcat"></select>
+       <!--{/if:doing_sub_categories}-->
+                               </p>
+                               <input id="continue" type="submit" value="Continue">
+                       </form>
+               </div>
+
+       <!--{if:doing_sub_categories=YES}-->    
+                                       <script>
+                                               var catData = {
+               <!--{list:picklists}-->
+                                                       {todo_id}: { 
+                       <!--{list:subcats}-->
+                                                               {cat_id}: {
+                                                                       'cat_id': '{cat_id}', 
+                                                                       'cat_name': '{cat_name}'
+                                                               },
+                       <!--{/list:subcats}-->
+                                                       },
+               <!--{/list:picklists}-->
+                                               };
+
+                                               function buildSub() {
+                                                       var c = document.getElementById("todo");
+                                                       var v = c.options[c.selectedIndex].value;
+                                                       var s = document.getElementById("subcat");
+
+                                                       s.options.length = 0;
+                                                       
+                                                       for (var key in catData[v]) 
+                                                       {
+                                                           var d = catData[v][key];
+                                                               s.options.add(new Option(d['cat_name'], d['cat_id']));
+                                                       }                                       
+                                               }
+                               </script>
+       <!--{/if:doing_sub_categories}-->
+  <!--{/if:have_picklists}-->
+
+       <div>
+<!--{if:display_only_mode=NO}-->
+  <!--{if:haveCart=YES}-->
+               <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step4" class="button showcart"><span>View Cart</span></a>
+               <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step5" class="button checkout"><span>Check Out</span></a>
+  <!--{/if:haveCart}-->
+<!--{/if:display_only_mode}-->
+       </div>
+        <hr style="clear: both;">
+          
+  <!--{if:select_by_default=YES}-->
+      <!--{if:selection=CATEGORY}-->        
+               <!--{list:catlist}-->
+                       <div class="regItem">
+                  <!--{if:doing_sub_categories=YES}-->
+                               <h2 style="float: left;"><a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step1&todo={id}">{name}</a></h2>
+                               <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step1&todo={id}" class="button booknow"><span>Select {word_Category}</span></a>
+              <!--{else:doing_sub_categories}
+                   <h2 style="float: left;"><a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step2&todo={id}" style="margin: 0px;">{name}</a></h2>
+                <!--{if:events_in_cat_list=NO}-->
+                               <a href="float: left;"><a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step2&todo={id}" class="button booknow"><span>Select {word_Category}</span></a>
+                        <!--{/if:events_in_cat_list}-->
+              {/if:doing_sub_categories}-->
+                       <br clear="all">
+               <!--{if:have_image=YES}-->
+                               <img src="{image_midsized}{image}" alt="" class="regImage">
+               <!--{/if:have_image}-->
+                               {descr}<br clear="all">
+       
+                       <!--{if:have_events=YES}-->
+                               <!--{list:events}-->
+                                       <div class="regListItem">               
+                                 <!--{if:show_event_button=YES}-->
+                                               <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step3&event_id={reg_id}" class="button booknow" style="float: right;"><span>{title_select_event_button}</span></a>                                              
+                                 <!--{/if:show_event_button}-->
+                                               <h3><a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step3&event_id={reg_id}">{reg_name}</a><br></h3>
+                                               <!--{if:reg_have_image=YES}--><tr><td colspan="2"><img src="{image_thumb}{reg_image}" alt="" class="regImage"></td></tr><!--{/if:reg_have_image}-->
+                                               <p>{reg_short_descr}</p>
+                                               <table border="0" cellspacing="0" cellpadding="0">
+                                                       <!--{if:show_event_codes=YES}--><tr><th align="left" valign="top">{word_Event} Code:&nbsp;&nbsp;</th><td>{reg_code}</td></tr><!--{/if:show_event_codes}-->
+                                                       <!--{if:reg_have_attr=YES}-->
+                                                               <tr>
+                                                                       <th align="left" valign="top">{word_Attribute}:&nbsp;&nbsp;</th>
+                                                                       <td>
+                                                               <!--{list:attr}-->
+                                                                               {attr_name}<!--{sep:attr}-->, <!--{/sep:attr}-->{attr_name}
+                                                               <!--{/list:attr}-->
+                                                                       </td>
+                                                               </tr>
+                                                       <!--{/if:reg_have_attr}-->
+                                                       <!--{if:reg_date_specific=YES}--><tr><th align="left" valign="top">When:&nbsp;&nbsp;</th><td>From {reg_start_date} through {reg_end_date}</td></tr><!--{/if:reg_date_specific}-->
+                                                       <!--{if:reg_have_days=YES}--><tr><th align="left" valign="top">Days:&nbsp;&nbsp;</th><td>{reg_days}</td></tr><!--{/if:reg_have_days}-->
+                                                       <!--{if:reg_have_times=YES}--><tr><th align="left" valign="top">Times:&nbsp;&nbsp;</th><td>{reg_times}</td></tr><!--{/if:reg_have_times}-->
+                                                       <!--{if:reg_have_duration=YES}--><tr><th align="left" valign="top">Duration:&nbsp;&nbsp;</th><td>{reg_duration}</td></tr><!--{/if:reg_have_duration}-->
+                                                       <!--{if:show_instructor_in_event_lists=YES}--><!--{if:reg_have_instructor=YES}--><tr><th align="left" valign="top">{word_Instructor}:&nbsp;&nbsp;</th><td>{reg_instructor}</td></tr><!--{/if:reg_have_instructor}--><!--{/if:show_instructor_in_event_lists}-->
+                                                       <!--{if:reg_have_location=YES}--><tr><th align="left" valign="top">Location:&nbsp;&nbsp;</th><td>{reg_location}</td></tr><!--{/if:reg_have_location}-->
+                               <!--{if:show_rates_in_event_lists=YES}-->
+                                               <!--{if:reg_have_rates=IGNORE}--> <!-- set to ignore -->
+                                                               <tr>
+                                                                       <th align="left" valign="top">Cost:&nbsp;&nbsp;</th>
+                                                                       <td>
+                                                                       
+                                                <!--{if:free=YES}-->
+                                                                               No Charge
+                                                <!--{else:free}
+                                                 <!--{if:show_rates_type=detail}-->
+                                                       <!--{list:reg_rates}-->
+                                                                               {reg_rate} <!--{if:reg_have_base=YES}-->{reg_base}<!--{/if:reg_have_base}-->
+                                                               <!--{if:reg_have_per_attendee=YES}-->
+                                                                               <!--{if:reg_have_base=YES}-->plus <!--{/if:reg_have_base}--> {reg_per_attendee}<!--{if:reg_have_included=YES}-->, {reg_included} included<!--{/if:reg_have_included}--><!--{/if:reg_have_per_attendee}--><!--{if:show_cutoff_dates=YES}-->,
+                                                                               by {reg_submit_by}
+                                                                       <!--{/if:show_cutoff_dates}-->
+                                                                               <br>
+                                                       <!--{/list:reg_rates}-->
+                                                 <!--{/if:show_rates_type}-->
+                                                 
+                                                 <!--{if:show_rates_type=from}-->
+                                                                               Starting at: {from_rate}
+                                                 <!--{/if:show_rates_type}-->
+                                                {/if:free}-->
+                                                                       </td>
+                                                               </tr>
+                                               <!--{/if:reg_have_rates}-->
+                               <!--{/if:show_rates_in_event_lists}-->
+                                               </table>
+                                       </div>
+                               <!--{sep:events}-->
+                                       <hr class="shortHR">
+                               <!--{/sep:events}-->
+                                       <div class="regListItem">
+                                 <!--{if:show_event_button=YES}-->
+                                               <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step3&event_id={reg_id}" class="button booknow" style="float: right;"><span>{title_select_event_button}</span></a>                                              
+                                 <!--{/if:show_event_button}-->
+                                               <h3><a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step3&event_id={reg_id}">{reg_name}</a><br></h3>
+                                               <!--{if:reg_have_image=YES}--><tr><td colspan="2"><img src="{image_thumb}{reg_image}" alt="" class="regImage"></td></tr><!--{/if:reg_have_image}-->
+                                               <p>{reg_short_descr}</p>
+                                               <table border="0" cellspacing="0" cellpadding="0">
+                                                       <!--{if:show_event_codes=YES}--><tr><th align="left" valign="top">{word_Event} Code:&nbsp;&nbsp;</th><td>{reg_code}</td></tr><!--{/if:show_event_codes}-->
+                                                       <!--{if:reg_have_attr=YES}-->
+                                                               <tr>
+                                                                       <th align="left" valign="top">{word_Attribute}:&nbsp;&nbsp;</th>
+                                                                       <td>
+                                                               <!--{list:attr}-->
+                                                                               {attr_name}<!--{sep:attr}-->, <!--{/sep:attr}-->{attr_name}
+                                                               <!--{/list:attr}-->
+                                                                       </td>
+                                                               </tr>
+                                                       <!--{/if:reg_have_attr}-->
+                                                       <!--{if:reg_date_specific=YES}--><tr><th align="left" valign="top">When:&nbsp;&nbsp;</th><td>From {reg_start_date} through {reg_end_date}</td></tr><!--{/if:reg_date_specific}-->
+                                                       <!--{if:reg_have_days=YES}--><tr><th align="left" valign="top">Days:&nbsp;&nbsp;</th><td>{reg_days}</td></tr><!--{/if:reg_have_days}-->
+                                                       <!--{if:reg_have_times=YES}--><tr><th align="left" valign="top">Times:&nbsp;&nbsp;</th><td>{reg_times}</td></tr><!--{/if:reg_have_times}-->
+                                                       <!--{if:reg_have_duration=YES}--><tr><th align="left" valign="top">Duration:&nbsp;&nbsp;</th><td>{reg_duration}</td></tr><!--{/if:reg_have_duration}-->
+                                                       <!--{if:show_instructor_in_event_lists=YES}--><!--{if:reg_have_instructor=YES}--><tr><th align="left" valign="top">{word_Instructor}:&nbsp;&nbsp;</th><td>{reg_instructor}</td></tr><!--{/if:reg_have_instructor}--><!--{/if:show_instructor_in_event_lists}-->
+                                                       <!--{if:reg_have_location=YES}--><tr><th align="left" valign="top">Location:&nbsp;&nbsp;</th><td>{reg_location}</td></tr><!--{/if:reg_have_location}-->
+                               <!--{if:show_rates_in_event_lists=YES}-->
+                                               <!--{if:reg_have_rates=IGNORE}--> <!-- set to ignore -->
+                                                               <tr>
+                                                                       <th align="left" valign="top">Cost:&nbsp;&nbsp;</th>
+                                                                       <td>
+                                                <!--{if:free=YES}-->
+                                                                               No Charge
+                                                <!--{else:free}
+                                                 <!--{if:show_rates_type=detail}-->
+                                                       <!--{list:reg_rates}-->
+                                                                               {reg_rate} <!--{if:reg_have_base=YES}-->{reg_base}<!--{/if:reg_have_base}-->
+                                                               <!--{if:reg_have_per_attendee=YES}-->
+                                                                               <!--{if:reg_have_base=YES}-->plus <!--{/if:reg_have_base}--> {reg_per_attendee}<!--{if:reg_have_included=YES}-->, {reg_included} included<!--{/if:reg_have_included}--><!--{/if:reg_have_per_attendee}--><!--{if:show_cutoff_dates=YES}-->,
+                                                                               by {reg_submit_by}
+                                                                       <!--{/if:show_cutoff_dates}-->
+                                                                               <br>
+                                                       <!--{/list:reg_rates}-->
+                                                 <!--{/if:show_rates_type}-->
+                                                 
+                                                 <!--{if:show_rates_type=from}-->
+                                                                               Starting at: {from_rate}
+                                                 <!--{/if:show_rates_type}-->
+                                                {/if:free}-->
+                                                 
+                                                                       </td>
+                                                               </tr>
+                                               <!--{/if:reg_have_rates}-->
+                               <!--{/if:show_rates_in_event_lists}-->
+                                               </table>
+                                       </div>
+                               <!--{/list:events}-->
+                       <!--{/if:have_events}-->
+                                                       
+                       </div>
+                       <hr class="regItemHR">
+               <!--{/list:catlist}-->
+
+         <!--{else:selection}          
+
+               <!--{list:catlist}-->
+                       <div class="regItem">
+               <!--{if:have_image=YES}-->
+                               <img src="{image_midsized}{image}" alt="" class="regImage">
+               <!--{/if:have_image}-->
+                               <h2><a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step2&subcat={id}">{name}</a></h2>
+                               {descr}<br clear="all">
+                       <!--{if:have_events=YES}-->
+                               <!--{list:events}-->
+                                       <div class="regListItem">
+                                               <h3><a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step3&event_id={reg_id}">{reg_name}</a><br></h3>
+                                               <!--{if:reg_have_image=YES}--><tr><td colspan="2"><img src="{image_thumb}{reg_image}" alt="" class="regImage"></td></tr><!--{/if:reg_have_image}-->
+                                               <p>{reg_short_descr}</p>
+                                               <table border="0" cellspacing="0" cellpadding="0">
+                                                       <!--{if:show_event_codes=YES}--><tr><th align="left" valign="top">{word_Event} Code:&nbsp;&nbsp;</th><td>{reg_code}</td></tr><!--{/if:show_event_codes}-->
+                                                       <!--{if:reg_have_attr=YES}-->
+                                                               <tr>
+                                                                       <th align="left" valign="top">{word_Attribute}:&nbsp;&nbsp;</th>
+                                                                       <td>
+                                                               <!--{list:attr}-->
+                                                                               {attr_name}<!--{sep:attr}-->, <!--{/sep:attr}-->{attr_name}
+                                                               <!--{/list:attr}-->
+                                                                       </td>
+                                                               </tr>
+                                                       <!--{/if:reg_have_attr}-->
+                                                       <!--{if:reg_date_specific=YES}--><tr><th align="left" valign="top">When:&nbsp;&nbsp;</th><td>From {reg_start_date} through {reg_end_date}</td></tr><!--{/if:reg_date_specific}-->
+                                                       <!--{if:reg_have_days=YES}--><tr><th align="left" valign="top">Days:&nbsp;&nbsp;</th><td>{reg_days}</td></tr><!--{/if:reg_have_days}-->
+                                                       <!--{if:reg_have_times=YES}--><tr><th align="left" valign="top">Times:&nbsp;&nbsp;</th><td>{reg_times}</td></tr><!--{/if:reg_have_times}-->
+                                                       <!--{if:reg_have_duration=YES}--><tr><th align="left" valign="top">Duration:&nbsp;&nbsp;</th><td>{reg_duration}</td></tr><!--{/if:reg_have_duration}-->
+                                                       <!--{if:show_instructor_in_event_lists=YES}--><!--{if:reg_have_instructor=YES}--><tr><th align="left" valign="top">{word_Instructor}:&nbsp;&nbsp;</th><td>{reg_instructor}</td></tr><!--{/if:reg_have_instructor}--><!--{/if:show_instructor_in_event_lists}-->
+                                                       <!--{if:reg_have_location=YES}--><tr><th align="left" valign="top">Location:&nbsp;&nbsp;</th><td>{reg_location}</td></tr><!--{/if:reg_have_location}-->
+                               <!--{if:show_rates_in_event_lists=YES}-->
+                                               <!--{if:reg_have_rates=IGNORE}--> <!-- set to ignore -->
+                                                               <tr>
+                                                                       <th align="left" valign="top">Cost:&nbsp;&nbsp;</th>
+                                                                       <td>
+                                                       
+                                                       
+                                                <!--{if:free=YES}-->
+                                                                               No Charge
+                                                <!--{else:free}
+                                                 <!--{if:show_rates_type=detail}-->
+                                                       <!--{list:reg_rates}-->
+                                                                               {reg_rate} <!--{if:reg_have_base=YES}-->{reg_base}<!--{/if:reg_have_base}-->
+                                                               <!--{if:reg_have_per_attendee=YES}-->
+                                                                               <!--{if:reg_have_base=YES}-->plus <!--{/if:reg_have_base}--> {reg_per_attendee}<!--{if:reg_have_included=YES}-->, {reg_included} included<!--{/if:reg_have_included}--><!--{/if:reg_have_per_attendee}--><!--{if:show_cutoff_dates=YES}-->,
+                                                                               by {reg_submit_by}
+                                                                       <!--{/if:show_cutoff_dates}-->
+                                                                               <br>
+                                                       <!--{/list:reg_rates}-->
+                                                 <!--{/if:show_rates_type}-->
+                                                 
+                                                 <!--{if:show_rates_type=from}-->
+                                                                               Starting at: {from_rate}
+                                                 <!--{/if:show_rates_type}-->
+                                                {/if:free}-->
+                                                 
+                                                                       </td>
+                                                               </tr>
+                                               <!--{/if:reg_have_rates}-->
+                               <!--{/if:show_rates_in_event_lists}-->
+                                               </table>
+                                       </div>
+                               <!--{sep:events}-->
+                                       <hr class="shortHR">
+                               <!--{/sep:events}-->
+                                       <div class="regListItem">
+                                               <h3><a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step3&event_id={reg_id}">{reg_name}</a><br></h3>
+                                               <!--{if:reg_have_image=YES}--><tr><td colspan="2"><img src="{image_thumb}{reg_image}" alt="" class="regImage"></td></tr><!--{/if:reg_have_image}-->
+                                               <p>{reg_short_descr}</p>
+                                               <table border="0" cellspacing="0" cellpadding="0">
+                                                       <!--{if:show_event_codes=YES}--><tr><th align="left" valign="top">{word_Event} Code:&nbsp;&nbsp;</th><td>{reg_code}</td></tr><!--{/if:show_event_codes}-->
+                                                       <!--{if:reg_have_attr=YES}-->
+                                                               <tr>
+                                                                       <th align="left" valign="top">{word_Attribute}:&nbsp;&nbsp;</th>
+                                                                       <td>
+                                                               <!--{list:attr}-->
+                                                                               {attr_name}<!--{sep:attr}-->, <!--{/sep:attr}-->{attr_name}
+                                                               <!--{/list:attr}-->
+                                                                       </td>
+                                                               </tr>
+                                                       <!--{/if:reg_have_attr}-->
+                                                       <!--{if:reg_date_specific=YES}--><tr><th align="left" valign="top">When:&nbsp;&nbsp;</th><td>From {reg_start_date} through {reg_end_date}</td></tr><!--{/if:reg_date_specific}-->
+                                                       <!--{if:reg_have_days=YES}--><tr><th align="left" valign="top">Days:&nbsp;&nbsp;</th><td>{reg_days}</td></tr><!--{/if:reg_have_days}-->
+                                                       <!--{if:reg_have_times=YES}--><tr><th align="left" valign="top">Times:&nbsp;&nbsp;</th><td>{reg_times}</td></tr><!--{/if:reg_have_times}-->
+                                                       <!--{if:reg_have_duration=YES}--><tr><th align="left" valign="top">Duration:&nbsp;&nbsp;</th><td>{reg_duration}</td></tr><!--{/if:reg_have_duration}-->
+                                                       <!--{if:show_instructor_in_event_lists=YES}--><!--{if:reg_have_instructor=YES}--><tr><th align="left" valign="top">{word_Instructor}:&nbsp;&nbsp;</th><td>{reg_instructor}</td></tr><!--{/if:reg_have_instructor}--><!--{/if:show_instructor_in_event_lists}-->
+                                                       <!--{if:reg_have_location=YES}--><tr><th align="left" valign="top">Location:&nbsp;&nbsp;</th><td>{reg_location}</td></tr><!--{/if:reg_have_location}-->
+                               <!--{if:show_rates_in_event_lists=YES}-->
+                                               <!--{if:reg_have_rates=IGNORE}--> <!-- set to ignore -->
+                                                               <tr>
+                                                                       <th align="left" valign="top">Cost:&nbsp;&nbsp;</th>
+                                                                       <td>
+                                                                       
+                                                <!--{if:free=YES}-->
+                                                                               No Charge
+                                                <!--{else:free}
+                                                 <!--{if:show_rates_type=detail}-->
+                                                       <!--{list:reg_rates}-->
+                                                                               {reg_rate} <!--{if:reg_have_base=YES}-->{reg_base}<!--{/if:reg_have_base}-->
+                                                               <!--{if:reg_have_per_attendee=YES}-->
+                                                                               <!--{if:reg_have_base=YES}-->plus <!--{/if:reg_have_base}--> {reg_per_attendee}<!--{if:reg_have_included=YES}-->, {reg_included} included<!--{/if:reg_have_included}--><!--{/if:reg_have_per_attendee}--><!--{if:show_cutoff_dates=YES}-->,
+                                                                               by {reg_submit_by}
+                                                                       <!--{/if:show_cutoff_dates}-->
+                                                                               <br>
+                                                       <!--{/list:reg_rates}-->
+                                                 <!--{/if:show_rates_type}-->
+                                                 
+                                                 <!--{if:show_rates_type=from}-->
+                                                                               Starting at: {from_rate}
+                                                 <!--{/if:show_rates_type}-->
+                                                {/if:free}-->
+                                                 
+                                                                       </td>
+                                                               </tr>
+                                               <!--{/if:reg_have_rates}-->
+                               <!--{/if:show_rates_in_event_lists}-->
+                                               </table>
+                                       </div>
+                               <!--{/list:events}-->
+                       <!--{/if:have_events}-->
+                                                       
+                       </div>
+                       <hr class="regItemHR">
+               <!--{/list:catlist}-->
+         
+         {/if:selection}-->
+         
+       <!--{/if:select_by_default}-->
+       
+<!--           <h3>Sorry, there are no {word_events} currently listed.</h3>  -->
+                               
+               
+<!--{if:haveRegTerms=YES}-->
+<p>&nbsp;</p>
+<h3>Terms and Conditions</h3>          
+{regTerms}
+<!--{/if:haveRegTerms}-->
+</div>
+
+
diff --git a/front-end/Views/registrations_step2.html b/front-end/Views/registrations_step2.html
new file mode 100644 (file)
index 0000000..b967910
--- /dev/null
@@ -0,0 +1,280 @@
+<!--{if:haveCustomStylesheet=YES}-->
+       <LINK REL="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/style.css">
+<!--{else:haveCustomStylesheet}
+       <LINK REL="stylesheet" HREF="{base_app_secure_url}Common/Registrations_V3/front-end/Views/style.css">
+{/if:haveCustomStylesheet}-->
+<!--{if:haveStylesheetOverride=YES}-->
+       <link type="text/css" rel="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/override.css">
+<!--{/if:haveStylesheetOverride}-->
+
+    <!--{if:static_page=NO}-->
+        <!--{if:have_search_request=YES}-->
+          <!--{if:show_search_result_as_title=YES}-->
+        <h2>{search_request}</h2>
+        <!--{/if:show_search_result_as_title}-->
+        <!--{/if:have_search_request}-->
+    <!--{/if:static_page}-->
+
+
+<div id="registrations">
+
+  <!--{if:admin_user=YES}-->
+    <div class="adminUser">
+        <b>{word_Registration} being entered by Admin User</b>
+    </div>
+  <!--{/if:admin_user}-->
+
+    <div id="regPageTopText">
+       <p>{regSelectPageText}</p>
+    </div>
+    
+    <!--{if:haveUser=YES}-->
+        <hr>
+        <p>
+                       <b>Current Registered User:&nbsp;&nbsp;</b>{userFname}&nbsp;{userLname}&nbsp;&nbsp;&nbsp;&nbsp;<a href="{base_secure_url}index.php?catid={category_id}{preview}&logout=YES">(not me or log me out)</a>  
+            <!--{if:userIsMember=YES}--><br>(A {customer_long_name} member)<!--{/if:userIsMember}--> 
+        </p>
+    <!--{/if:haveUser}-->
+
+    <!--{if:static_page=NO}-->
+      <!--{if:have_search_request=YES}-->
+        <!--{if:show_search_result_as_title=YES}-->
+        <!--{else:show_search_result_as_title}
+               <h2>Search results for {search_type}: {search_request}</h2>
+        {/if:show_search_result_as_title}-->
+      <!--{/if:have_search_request}-->
+    <!--{/if:static_page}-->
+    <!--{if:doing_main_categories=YES}-->
+               <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step1" class="button selectmore"><span>Select More</span></a>
+    <!--{/if:doing_main_categories}-->
+<!--{if:display_only_mode=NO}-->       
+       <!--{if:haveCart=YES}-->
+               <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step4" class="button showcart"><span>View Cart</span></a>
+               <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step5" class="button checkout"><span>Check Out</span></a>
+       <!--{/if:haveCart}-->
+<!--{/if:display_only_mode}-->
+
+<!--{if:searchMonth=YES}-->
+       <h3>Showing {word_events} for {month}</h3>
+
+<!--{/if:searchMonth}-->
+
+  <!--{if:special_bulletin}-->
+       <p>{special_bulletin}</p>
+  <!--{/if:special_bulletin}-->
+       
+       <hr>
+
+<!--{if:have_registrations=TRUE}-->
+
+       <!--{list:RegistrationList}-->
+       
+       <!--{if:too_late}-->
+           <h2>{name}</h2>
+           <p>Too late for on-line {word_registration}. - Please call.</p>
+       <!--{else:too_late}
+         <!--{if:limited=YES}--> 
+           <!--{if:full=YES}-->
+            <h2>{name}</h2>
+            <p>Sorry, currently sold out.</p>                
+           <!--{else:full}
+                         <!--{if:show_event_button=YES}-->
+                       <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step3&event_id={id}&page_title={page_title_enc}" class="button booknow"><span>{title_select_event_button}</span></a>
+                         <!--{/if:show_event_button}-->
+            <h2><a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step3&event_id={id}&page_title={page_title_enc}">{name}</a></h2>
+            {/if:full}-->
+         <!--{else:limited}
+                         <!--{if:show_event_button=YES}-->
+                       <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step3&event_id={id}&page_title={page_title_enc}" class="button booknow"><span>{title_select_event_button}</span></a>
+                         <!--{/if:show_event_button}-->
+                       <h2><a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step3&event_id={id}&page_title={page_title_enc}">{name}</a></h2>
+                {/if:limited}-->
+       {/if:too_late}-->
+
+        <!--{if:image}--><tr><td colspan="2"><img src="{image_midsized}{image}" alt="" class="regImage"></td></tr><!--{/if:image}-->
+
+                <!--{if:reg_descr}--><p>{reg_short_descr}</p><!--{/if:reg_descr}-->
+                               <table border="0" cellspacing="0" cellpadding="0">
+        <!--{if:show_event_detail=YES}-->               
+                                               <!--{if:show_event_codes=YES}--><tr><th align="left" valign="top">{word_Event} Code:&nbsp;&nbsp;</th><td>{reg_code}</td></tr><!--{/if:show_event_codes}-->
+                                               <!--{if:reg_have_attr=YES}-->
+                                                       <tr>
+                                                               <th align="left" valign="top">{word_Attribute}:&nbsp;&nbsp;</th>
+                                                               <td>
+                                                       <!--{list:attr}-->
+                                                                       {attr_name}<!--{sep:attr}-->, <!--{/sep:attr}-->{attr_name}
+                                                       <!--{/list:attr}-->
+                                                               </td>
+                                                       </tr>
+                                               <!--{/if:reg_have_attr}-->
+                                               <!--{if:date_specific=YES}--><tr><th align="left" valign="top">When:&nbsp;&nbsp;</th><td>From {start_date} through {end_date}</td></tr><!--{/if:date_specific}-->
+                                               <!--{if:reg_days}--><tr><th align="left" valign="top">Days:&nbsp;&nbsp;</th><td>{reg_days}</td></tr><!--{/if:reg_days}-->
+                                               <!--{if:reg_times}--><tr><th align="left" valign="top">Times:&nbsp;&nbsp;</th><td>{reg_times}</td></tr><!--{/if:reg_times}-->
+                                               <!--{if:reg_duration}--><tr><th align="left" valign="top">Duration:&nbsp;&nbsp;</th><td>{reg_duration}</td></tr><!--{/if:reg_duration}-->
+                                               <!--{if:show_instructor_in_event_lists=YES}--><!--{if:reg_instructor}--><tr><th align="left" valign="top">{word_Instructor}:&nbsp;&nbsp;</th><td>{reg_instructor}</td></tr><!--{/if:reg_instructor}--><!--{/if:show_instructor_in_event_lists}-->
+                                               <!--{if:reg_location}--><tr><th align="left" valign="top">Location:&nbsp;&nbsp;</th><td>{reg_location}</td></tr><!--{/if:reg_location}-->
+                                   <!--{if:show_rates_in_event_lists=YES}-->
+                                               <!--{if:reg_have_rates=IGNORE}--> <!-- set to ignore -->
+                                                               <tr>
+                                                                       <th align="left" valign="top">Cost:&nbsp;&nbsp;</th>
+                                                                       <td>
+                                                                       
+                                                 <!--{if:show_rates_type=detail}-->
+                                                       <!--{list:reg_rates}-->
+                                                                               {reg_rate} <!--{if:reg_have_base=YES}-->{reg_base}<!--{/if:reg_have_base}-->
+                                                               <!--{if:reg_have_per_attendee=YES}-->
+                                                                               <!--{if:reg_have_base=YES}-->plus <!--{/if:reg_have_base}--> {reg_per_attendee}<!--{if:reg_have_included=YES}-->, {reg_included} included<!--{/if:reg_have_included}--><!--{/if:reg_have_per_attendee}--><!--{if:show_cutoff_dates=YES}-->,
+                                                                               by {reg_submit_by}
+                                                                       <!--{/if:show_cutoff_dates}-->
+                                                                               <br>
+                                                       <!--{/list:reg_rates}-->
+                                                 <!--{/if:show_rates_type}-->
+                                                 
+                                                 <!--{if:show_rates_type=from}-->
+                                                                               Starting at: {from_rate}
+                                                 <!--{/if:show_rates_type}-->
+                                                 
+                                                                       </td>
+                                                               </tr>
+                                               <!--{/if:reg_have_rates}-->
+                                   <!--{/if:show_rates_in_event_lists}-->
+        <!--{/if:show_event_detail}-->               
+              <!--{if:limited}-->
+                               <!--{if:full=YES}-->
+                                       <tr><th valign="top"><nobr>{word_Attendees}:</nobr>&nbsp;&nbsp;</th><td>{attendee_max} {word_attendees}. Currently sold out.</td></tr>
+                               <!--{else:full}
+                                       <tr>
+                                               <th valign="top"><nobr>{word_Attendees}:</nobr>&nbsp;&nbsp; </th>
+                                               <td>
+                                                       Maximum {attendee_max} {word_attendees}. {attendee_left} may still {word_register}.
+                                               </td>
+                                               </tr>
+                               {/if:full}-->
+              <!--{/if:limited}-->
+                    <!--{if:reg_file}-->
+                       <tr>
+                               <th align="left" valign="top">File:&nbsp;&nbsp;</th>
+                               <td>
+                                       <a href="{reg_file}" target="file_page">
+                         <!--{if:reg_file_title}-->
+                                                       {reg_file_title}
+                         <!--{else:reg_file_title}
+                                                       Download File
+                         {/if:reg_file_title}-->
+                                               </a>
+                               </td>
+                       </tr>
+                       <!--{/if:reg_file}-->
+                </table>
+               <!--{sep:RegistrationList}-->
+                       <hr class="shortHR">
+               <!--{/sep:RegistrationList}-->
+
+       <!--{if:too_late}-->
+           <h2>{name}</h2>
+           <p>Too late for on-line {word_registration}. - Please call.</p>
+       <!--{else:too_late}
+         <!--{if:limited=YES}--> 
+           <!--{if:full=YES}-->
+            <h2>{name}</h2>
+            <p>Sorry, currently sold out.</p>                
+           <!--{else:full}
+                         <!--{if:show_event_button=YES}-->
+                       <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step3&event_id={id}&page_title={page_title_enc}" class="button booknow"><span>{title_select_event_button}</span></a>
+                         <!--{/if:show_event_button}-->
+            <h2><a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step3&event_id={id}&page_title={page_title_enc}">{name}</a></h2>
+            {/if:full}-->
+         <!--{else:limited}
+                         <!--{if:show_event_button=YES}-->
+                       <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step3&event_id={id}&page_title={page_title_enc}" class="button booknow"><span>{title_select_event_button}</span></a>
+                         <!--{/if:show_event_button}-->
+                       <h2><a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step3&event_id={id}&page_title={page_title_enc}">{name}</a></h2>
+                {/if:limited}-->
+       {/if:too_late}-->
+
+        <!--{if:image}--><tr><td colspan="2"><img src="{image_midsized}{image}" alt="" class="regImage"></td></tr><!--{/if:image}-->
+
+                <!--{if:reg_descr}--><p>{reg_short_descr}</p><!--{/if:reg_descr}-->
+                               <table border="0" cellspacing="0" cellpadding="0">
+        <!--{if:show_event_detail=YES}-->                               
+                                               <!--{if:show_event_codes=YES}--><tr><th align="left" valign="top">{word_Event} Code:&nbsp;&nbsp;</th><td>{reg_code}</td></tr><!--{/if:show_event_codes}-->
+                                               <!--{if:reg_have_attr=YES}-->
+                                                       <tr>
+                                                               <th align="left" valign="top">{word_Attribute}:&nbsp;&nbsp;</th>
+                                                               <td>
+                                                       <!--{list:attr}-->
+                                                                       {attr_name}<!--{sep:attr}-->, <!--{/sep:attr}-->{attr_name}
+                                                       <!--{/list:attr}-->
+                                                               </td>
+                                                       </tr>
+                                               <!--{/if:reg_have_attr}-->
+                                               <!--{if:date_specific=YES}--><tr><th align="left" valign="top">When:&nbsp;&nbsp;</th><td>From {start_date} through {end_date}</td></tr><!--{/if:date_specific}-->
+                                               <!--{if:reg_days}--><tr><th align="left" valign="top">Days:&nbsp;&nbsp;</th><td>{reg_days}</td></tr><!--{/if:reg_days}-->
+                                               <!--{if:reg_times}--><tr><th align="left" valign="top">Times:&nbsp;&nbsp;</th><td>{reg_times}</td></tr><!--{/if:reg_times}-->
+                                               <!--{if:reg_duration}--><tr><th align="left" valign="top">Duration:&nbsp;&nbsp;</th><td>{reg_duration}</td></tr><!--{/if:reg_duration}-->
+                                               <!--{if:show_instructor_in_event_lists=YES}--><!--{if:reg_instructor}--><tr><th align="left" valign="top">{word_Instructor}:&nbsp;&nbsp;</th><td>{reg_instructor}</td></tr><!--{/if:reg_instructor}--><!--{/if:show_instructor_in_event_lists}-->
+                                               <!--{if:reg_location}--><tr><th align="left" valign="top">Location:&nbsp;&nbsp;</th><td>{reg_location}</td></tr><!--{/if:reg_location}-->
+                               <!--{if:show_rates_in_event_lists=YES}-->
+                                               <!--{if:reg_have_rates=IGNORE}--> <!-- set to ignore -->
+                                                               <tr>
+                                                                       <th align="left" valign="top">Cost:&nbsp;&nbsp;</th>
+                                                                       <td>
+                                                                       
+                                                 <!--{if:show_rates_type=detail}-->
+                                                       <!--{list:reg_rates}-->
+                                                                               {reg_rate} <!--{if:reg_have_base=YES}-->{reg_base}<!--{/if:reg_have_base}-->
+                                                               <!--{if:reg_have_per_attendee=YES}-->
+                                                                               <!--{if:reg_have_base=YES}-->plus <!--{/if:reg_have_base}--> {reg_per_attendee}<!--{if:reg_have_included=YES}-->, {reg_included} included<!--{/if:reg_have_included}--><!--{/if:reg_have_per_attendee}--><!--{if:show_cutoff_dates=YES}-->,
+                                                                               by {reg_submit_by}
+                                                                       <!--{/if:show_cutoff_dates}-->
+                                                                               <br>
+                                                       <!--{/list:reg_rates}-->
+                                                 <!--{/if:show_rates_type}-->
+                                                 
+                                                 <!--{if:show_rates_type=from}-->
+                                                                               Starting at: {from_rate}
+                                                 <!--{/if:show_rates_type}-->
+                                                 
+                                                                       </td>
+                                                               </tr>
+                                               <!--{/if:reg_have_rates}-->
+                               <!--{/if:show_rates_in_event_lists}-->
+        <!--{/if:show_event_detail}-->                                                                 
+       <!--{if:limited}-->
+                               <!--{if:full=YES}-->
+                                       <tr><th valign="top"><nobr>{word_Attendees}:</nobr>&nbsp;&nbsp;</th><td>{attendee_max} {word_attendees}. Currently sold out.</td></tr>
+                               <!--{else:full}
+                                       <tr>
+                                               <th valign="top"><nobr>{word_Attendees}:</nobr>&nbsp;&nbsp; </th>
+                                               <td>
+                                                       Maximum {attendee_max} {word_attendees}. {attendee_left} may still {word_register}.
+                                               </td>
+                                               </tr>
+                               {/if:full}-->
+       <!--{/if:limited}-->
+                    <!--{if:reg_file}-->
+                       <tr>
+                               <th align="left" valign="top">File:&nbsp;&nbsp;</th>
+                               <td>
+                                       <a href="{reg_file}" target="file_page">
+                         <!--{if:reg_file_title}-->
+                                                       {reg_file_title}
+                         <!--{else:reg_file_title}
+                                                       Download File
+                         {/if:reg_file_title}-->
+                                               </a>
+                               </td>
+                       </tr>
+                       <!--{/if:reg_file}-->
+                </table>
+       <!--{/list:RegistrationList}-->
+               <hr class="regItemHR">
+               
+<!--{else:have_registrations}
+    <h3>Sorry, no {word_Events} are currently available in this {word_category}.</h3> 
+{/if:have_registrations}-->
+       <p>{regTerms}</p>
+</div> 
+<br clear="all">
+       
diff --git a/front-end/Views/registrations_step3.html b/front-end/Views/registrations_step3.html
new file mode 100644 (file)
index 0000000..1e1293c
--- /dev/null
@@ -0,0 +1,270 @@
+<!--{if:haveCustomStylesheet=YES}-->
+       <LINK REL="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/style.css">
+<!--{else:haveCustomStylesheet}
+       <LINK REL="stylesheet" HREF="{base_app_secure_url}Common/Registrations_V3/front-end/Views/style.css">
+{/if:haveCustomStylesheet}-->
+<!--{if:haveStylesheetOverride=YES}-->
+       <link type="text/css" rel="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/override.css">
+<!--{/if:haveStylesheetOverride}-->
+
+
+<script>    
+function show( d )
+    {
+    // Show the selected area
+    document.getElementById(d).style.visibility = 'visible';
+    document.getElementById(d).style.display = 'block';
+    }
+
+function hide( d )
+       {
+         // Hide the selected area
+       document.getElementById(d).style.visibility = 'hidden';
+       document.getElementById(d).style.display = 'none';
+       }
+
+function do_wait()
+       {
+       hide('continueButton'); 
+       show('pleaseWait','inline'); 
+       }
+</script>
+
+<script type="text/javascript" src="{base_app_secure_url}Common/Registrations_V3/front-end/Registrations/java_functions.js"></script>
+
+<!--{if:static_page=NO}-->
+    <h2>{page_title}</h2>
+<!--{/if:static_page}-->
+
+<div id="registrations">
+       
+  <!--{if:admin_user=YES}-->
+    <div class="adminUser">
+        <b>{word_Registration} being entered by Admin User</b>
+    </div>
+  <!--{/if:admin_user}-->
+
+<div id="regPageTopText">
+   <p>{regEventPageText}</p>
+</div>
+
+    
+    <!--{if:haveUser=YES}-->
+    <hr>
+    <p>
+               <b>Current Registered User:&nbsp;&nbsp;</b>{userFname}&nbsp;{userLname}&nbsp;&nbsp;&nbsp;&nbsp;<a href="{base_secure_url}index.php?catid={category_id}{preview}&logout=YES">(not me or log me out)</a>  
+        <!--{if:userIsMember=YES}--><br>(A {customer_long_name} member)<!--{/if:userIsMember}--> 
+    </p>
+    <!--{/if:haveUser}-->
+       
+               <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step1" class="button selectmore"><span>Select More</span></a>
+<!--{if:display_only_mode=NO}-->
+    <!--{if:haveCart=YES}-->
+               <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step4" class="button showcart"><span>View Cart</span></a>
+               <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step5" class="button checkout"><span>Check Out</span></a>
+       <!--{/if:haveCart}-->
+<!--{/if:display_only_mode}--> 
+<!--{if:display_only_mode=YES}-->      
+       <h3>Please call to {title_select_event_button}</h3>
+<!--{/if:display_only_mode}--> 
+
+       <hr>
+    <form action="{base_secure_url}index.php?catid={category_id}{preview}" name="step3" method="post" enctype="multipart/form-data">
+        <input type="hidden" name="Action" value="{next_step}">
+        <input type="hidden" name="event_id" value="{event_id}">
+        <input type="hidden" name="select_event" value="YES">
+
+         <!--{if:have_reason=YES}-->
+               <div class="regWarning">
+                               Your request was not processed because:<br>
+                       <ul>
+               <!--{list:reason}-->
+                               <li>{text}</li>
+               <!--{/list:reason}-->
+                       </ul>
+               </div>  
+         <!--{/if:have_reason}-->
+               <div>
+        <!--{if:image}--><img src="{image_midsized}{image}" alt="" class="regImage"><!--{/if:image}-->
+               {form_data}    
+               <h2>{reg_name}</h2>
+               <!--{if:reg_descr}-->
+                       <p>{reg_descr}</p>
+               <!--{/if:reg_descr}-->
+            <table border="0" cellspacing="0" cellpadding="0">
+                    <!--{if:show_event_codes=YES}--><tr><th align="left" valign="top">{word_Event} Code:&nbsp;&nbsp;</th><td>{reg_code}</td></tr><!--{/if:show_event_codes}-->
+                                       <!--{if:reg_have_attr=YES}-->
+                                               <tr>
+                                                       <th align="left" valign="top">{word_Attribute}:&nbsp;&nbsp;</th>
+                                                       <td>
+                                               <!--{list:attr}-->
+                                                               {attr_name}<!--{sep:attr}-->, <!--{/sep:attr}-->{attr_name}
+                                               <!--{/list:attr}-->
+                                                       </td>
+                                               </tr>
+                                       <!--{/if:reg_have_attr}-->
+                                       <!--{if:date_specific=YES}--><tr><th align="left" valign="top">When:&nbsp;&nbsp;</th><td>From {start_date} through {end_date}</td></tr><!--{/if:date_specific}-->
+                    <!--{if:reg_days}--><tr><th align="left" valign="top">Days:&nbsp;&nbsp;</th><td>{reg_days}</td></tr><!--{/if:reg_days}-->
+                    <!--{if:reg_times}--><tr><th align="left" valign="top">Times:&nbsp;&nbsp;</th><td>{reg_times}</td></tr><!--{/if:reg_times}-->
+                    <!--{if:reg_duration}--><tr><th align="left" valign="top">Duration:&nbsp;&nbsp;</th><td>{reg_duration}</td></tr><!--{/if:reg_duration}-->
+                    <!--{if:show_instructor_in_event_detail=YES}--><!--{if:reg_instructor}--><tr><th align="left" valign="top">{word_Instructor}:&nbsp;&nbsp;</th><td>{reg_instructor}</td></tr><!--{/if:reg_instructor}--><!--{/if:show_instructor_in_event_detail}-->
+                    <!--{if:reg_location}--><tr><th align="left" valign="top">Location:&nbsp;&nbsp;</th><td>{reg_location}</td></tr><!--{/if:reg_location}-->
+       <!--{if:limited=YES}-->
+                               <!--{if:full=YES}-->
+                                       <tr><th valign="top"><nobr>{word_Attendees}:</nobr>&nbsp;&nbsp;</th><td>{attendee_max} {word_attendees}. Currently sold out.</td></tr>
+                               <!--{else:full}
+                                       <tr>
+                                               <th valign="top"><nobr>{word_Attendees}:</nobr>&nbsp;&nbsp; </th>
+                                               <td>
+                                                       Maximum {attendee_max} {word_attendees}. {attendee_left} may still {word_register}.
+                                               </td>
+                                               </tr>
+                               {/if:full}-->
+        <!--{/if:limited}-->
+                   <!--{if:reg_file}-->
+                       <tr>
+                               <th align="left" valign="top">File:&nbsp;&nbsp;</th>
+                               <td>
+                                       <a href="{reg_file}" target="file_page">
+                         <!--{if:reg_file_title}-->
+                                                       {reg_file_title}
+                         <!--{else:reg_file_title}
+                                                       Download File
+                         {/if:reg_file_title}-->
+                                               </a>
+                               </td>
+                       </tr>
+                       <!--{/if:reg_file}-->
+                       
+                <!--{if:show_event_terms_in_event_detail=YES}-->
+                  <!--{if:have_reg_terms=YES}-->
+                    <tr><td colspan="2">&nbsp;</td></tr>
+                    <tr><th colspan="2">Additional terms and conditions for this {word_Event}:</th></tr>
+                       <tr><td colspan="2">{reg_terms}</td></tr>
+                  <!--{/if:have_reg_terms}-->
+                <!--{/if:show_event_terms_in_event_detail}-->
+                    <tr><td colspan="2">&nbsp;</td></tr>
+            </table>
+               </div>
+<!--{if:display_only_mode=NO}-->               
+        <p><hr><p>
+<!--{if:full=NO}-->
+       <!--{if:too_late=YES}-->
+               <p>Too late for on-line {word_registration}. - Please call.</p>
+       <!--{else:too_late}
+        
+           <!--{if:rate_classes}-->
+             <!--{if:single_rate_class=NO}-->
+                  <span class="regRequired">Please select the desired rate:</span>
+                 <!--{/if:single_rate_class}-->
+                   <!--{if:rates_descr}-->
+                               <p>{rates_descr}</p>
+                       <!--{/if:rates_descr}-->
+                       <!--{list:rate_class_list}-->
+                               <div class="regRate">
+                     <!--{if:single_rate_class=NO}-->
+                                       <input type="radio" name="rate_class" value="{rate_class}" {rate_class_selected}> 
+                     <!--{else:single_rate_class}
+                               <input type="hidden" name="rate_class" value="{rate_class}">
+                     {/if:single_rate_class}-->
+                                       {rate_class_name} &nbsp;&nbsp;&nbsp;<!--{if:rate_class_base}-->{rate_class_base}<!--{/if:rate_class_base}-->
+                       <!--{if:rate_class_rate}-->
+                       <!--{if:attendee_credits>0}-->&nbsp;&nbsp;&nbsp; includes {attendee_credits} {word_attendees}, {rate_class_rate}/additional {word_attendee}<!--{else:attendee_credits}&nbsp;&nbsp; {rate_class_rate}/{word_attendee}{/if:attendee_credits}-->
+                       <!--{/if:rate_class_rate}--> 
+                       </div>  
+                       <!--{/list:rate_class_list}-->
+                       
+           <!--{else:rate_classes}
+                               <input type="hidden" name="rate_class" value="-1">
+               {/if:rate_classes}-->
+       
+               <!--{if:haveRateNote=YES}-->
+                               ({rateNote})
+               <!--{/if:haveRateNote}-->
+
+               <!--{if:reg_ask_date=YES}-->
+                               <link rel="stylesheet" href="{base_app_secure_url}libjs/jqueryui/1.8.13/css/smoothness/jquery-ui-1.8.13.custom.css">
+                               <script src="{base_app_secure_url}libjs/jqueryui/1.8.13/js/jquery-1.5.1.min.js"></script>
+                               <script src="{base_app_secure_url}libjs/jqueryui/1.8.13/js/jquery-ui-1.8.13.custom.min.js"></script>
+                  <p>
+                       <span class="regRequired">Please enter your desired date:</span><input type="text" id="desiredDate" name="desired_date" value="{desired_date}" size="10">
+                          </p>
+                          <!--{if:ask_date=YES}-->
+                               <script>
+                                       $(document).ready(function() {
+                                               
+                       <!--{if:reg_use_calendar=YES}-->
+                                               
+                                               var availDates = ["0000"<!--{list:datesAvail}-->,"{dateAvail}"<!--{/list:datesAvail}-->];
+                                               function avail(date) {
+                                                       m = (date.getMonth()+1);
+                                                               if (m < 10) {
+                                                                       m = '0' + m;
+                                                               }
+                                                       d = date.getDate();
+                                                               if (d < 10) {
+                                                                       d = '0' + d;
+                                                               }
+                                                       y = date.getFullYear();
+                                                       mdy = m + '/' + d + '/' + y;
+                                                       if ($.inArray(mdy, availDates)!=-1) {
+                                                       return [true,"","Available"];
+                                                       } else {
+                                                           return [false,"","Not Available"];
+                                                       }
+                                               }
+                                               $("#desiredDate").datepicker({ beforeShowDay: avail });
+                                               $("#desiredDate").datepicker('option', 'minDate', '{minDate}');
+                                               $("#desiredDate").datepicker('option', 'maxDate', '{maxDate}');
+                                                                                               
+                       <!--{else:reg_use_calendar}                                             
+                                               $("#desiredDate").datepicker();
+                       {/if:reg_use_calendar}-->                                               
+
+                                       });
+                               </script>
+               <!--{else:reg_ask_date}
+                               <input type="hidden" name="desired_date" value="">      
+               {/if:reg_ask_date}-->
+               
+               <!--{if:ask_attendees=Yes}-->
+                       <script type="text/javascript" src="{base_app_secure_url}Common/Registrations_V3/front-end/Registrations/java_functions.js"></script>
+                       <h3>{word_Attendees}</h3>
+                       <p>
+                       Please enter all {word_attendee} names, using one box per {word_attendee}. Additional boxes will be created as needed.
+                       All {word_attendees} will be {word_registered} at the level selected above.  Each {word_attendee} must have a first and last name.
+                       Please use your tab key to create a new {word_attendee} field.
+                       </p>
+                       <h4 class="regRequired">{word_Attendee} Names:</h4>     
+                 <!--{if:have_max_per_sub=YES}-->
+                       Enter a maximum of {max_per_sub} {word_attendees}.
+                 <!--{/if:have_max_per_sub}-->
+                       <p>{attendees}</p>
+               <!--{/if:ask_attendees}-->
+       
+               <!--{if:haveMagicForm=YES}-->
+                       <h4>Please provide the following additional information...
+                 <!--{if:required=Yes}-->
+                       <br><span class="regRequired" style="font-weight: bold;">Fields in red are required.</span>
+                 <!--{/if:required}-->
+                       </h4>
+                       
+                       <div id="magicForm">
+                         {magic_form}
+                       </div>
+               <!--{/if:haveMagicForm}-->
+               
+                   <center>
+                   <INPUT id="continueButton" type="submit" name="continue" value="Continue" onClick="do_wait();">
+                       <div id="pleaseWait">
+                         Please wait while we add this to your cart.
+                       </div>
+               </center>
+               
+       {/if:too_late}-->
+<!--{/if:full}-->
+<!--{/if:display_only_mode}-->         
+    </form>
+</div>
+<br clear="all">
diff --git a/front-end/Views/registrations_step4.html b/front-end/Views/registrations_step4.html
new file mode 100644 (file)
index 0000000..508a1d4
--- /dev/null
@@ -0,0 +1,147 @@
+<!--{if:haveCustomStylesheet=YES}-->
+       <LINK REL="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/style.css">
+<!--{else:haveCustomStylesheet}
+       <LINK REL="stylesheet" HREF="{base_app_secure_url}Common/Registrations_V3/front-end/Views/style.css">
+{/if:haveCustomStylesheet}-->
+<!--{if:haveStylesheetOverride=YES}-->
+       <link type="text/css" rel="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/override.css">
+<!--{/if:haveStylesheetOverride}-->
+
+
+
+<div id="registrations">
+
+  <!--{if:admin_user=YES}-->
+    <div class="adminUser">
+        <b>{word_Registration} being entered by Admin User</b>
+    </div>
+  <!--{/if:admin_user}-->
+    
+    <div id="regPageTopText">
+       <p>{regCartPageText}</p>
+    </div>
+
+    <!--{if:have_members=YES}-->
+       <!--{if:haveUser=YES}-->
+            <b>{customer_long_name} Member logged in</b> - <a href="{base_secure_url}index.php?catid={category_id}{preview}&logout=YES">Log Out</a>
+       <!--{/if:haveUser}-->
+    <!--{/if:have_members}-->       
+
+       <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step1" class="button selectmore"><span>Select More</span></a>
+<!--{if:haveCart=YES}-->
+       <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step5" class="button checkout"><span>Check Out</span></a>
+<!--{/if:haveCart}-->
+
+       <!--{if:haveUser=YES}-->
+               <p>
+                       <b>Current Registered User:&nbsp;&nbsp;</b>{userFname}&nbsp;{userLname}&nbsp;&nbsp;&nbsp;&nbsp;<a href="{base_secure_url}index.php?catid={category_id}{preview}&logout=YES">(not me or log me out)</a>  
+                       <!--{if:userIsMember=YES}--><br>(A {customer_long_name} member)<!--{/if:userIsMember}-->                
+               </p>
+               <hr>
+       <!--{/if:haveUser}-->
+
+       
+       <h2>Your selected {word_events}</h2>
+
+<!--{if:haveCart=YES}-->
+
+       <hr>
+       <!--{list:shoppingCart}-->
+               <div class="regItem">
+                       <div class="regCharges">
+                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <tr style="background-color: #eee;">
+                                               <td class="tdCartLeft" colspan="4" style="padding: 0 10px 0 10px;">
+                                                       <h3>{event_name}</h3>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td colspan="4">
+                                                       <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                                               <tr>
+                                                                       <td colspan="3">
+                                                                               <table border="0 cellspacing="0" cellpadding="0" width="100%">
+                                                                       <!--{if:date_specific=YES}-->                                   
+                                                                                       <tr>
+                                                                                               <th class="thCartLeft">Dates: </th>
+                                                                                               <td class="tdCartLeft" colspan="3">{start_date} through {end_date}</td>
+                                                                                       </tr>
+                                                                       <!--{/if:date_specific}-->                                      
+                                                                       <!--{if:ask_date=YES}-->                                        
+                                                                                       <tr>
+                                                                                               <th class="thCartLeft">Desired Date: </th>
+                                                                                               <td class="tdCartLeft" colspan="3">{desired_date}</td>
+                                                                                       </tr>
+                                                                       <!--{/if:ask_date}-->
+                                                                       <!--{if:days}-->
+                                                                                       <tr>
+                                                                                               <th class="thCartLeft">Days: </th>
+                                                                                               <td class="tdCartLeft" colspan="3">{days}</td>
+                                                                                       </tr>
+                                                                       <!--{/if:days}-->
+                                                                                       <tr>
+                                                                                               <th class="thCartLeft">Selected: </th>
+                                                                                               <td class="tdCartLeft" colspan="3">{rate_class}</td>
+                                                                                       </tr>
+                                                                   </table>
+                                                                       </td>
+                                                                       <td valign="top" width="120px">
+                                                                               <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step2.5&delete_cart_id={cart_id}" class="button remove"><span>Remove</span></a>
+                                                                       </td>
+                                                               </tr>
+                                                       </table>                                            
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td colspan="4">&nbsp;</td>
+                                       </tr>
+                           <tr>
+                               <th class="thCartLeft">Charges</th>
+                               <th class="thCartRight" colspan="2" style="width: 100px;"><!--{if:need_attendees=YES}-->Per {word_Attendee}<!--{else:need_attendees}&nbsp;{/if:need_attendees}--></th>
+                               <th class="tdCartRight">Total</th>
+                       </tr>
+                         <!--{list:charges}-->
+                           <tr>
+                               <td class="thCartLeft" colspan="2">{charge_title}</td>
+                               <td class="tdCartRight">{charge}</td>
+                               <td class="tdCartRight">{extend}</td>
+                       </tr>
+                         <!--{sep:charges}-->
+                         <!--{/sep:charges}-->
+                           <tr>
+                               <td class="thCartLeft" colspan="2">{charge_title}</td>
+                               <td class="tdCartRight">{charge}</td>
+                               <td class="tdCartRight">{extend}</td>
+                       </tr>
+                         <!--{/list:charges}-->
+                           <tr>
+                               <th class="thCartLeft">&nbsp;</th>
+                               <th class="thCartRight" colspan="2">Sub-Total</td>
+                               <td class="tdCartRight" style="width: 80px;">{totalCharges}</td>
+                       </tr>
+                           <tr>
+                               <td colspan="4">&nbsp;</td>
+                       </tr>
+       <!--{/list:shoppingCart}-->
+                                       <tr>
+                                               <th class="thCartRight" colspan="3">Grand Total:</th>
+                                               <th class="thCartRight" width="80px">{grandTotal}</th>
+                                       </tr>
+                               </table>
+                       </div> <!-- regCharges -->
+               </div> <!-- regItem -->
+       <hr class="regItemHR">
+       
+<!--{else:haveCart}
+
+       <h3>You do not have any {word_events} in your cart.</h3>
+{/if:haveCart}-->      
+
+       <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step1" class="button selectmore"><span>Select More</span></a>
+<!--{if:haveCart=YES}-->
+       <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step5" class="button checkout"><span>Check Out</span></a>
+<!--{/if:haveCart}-->
+       
+       
+</div><!-- /#registrations -->                                                         
+<br clear="all">
diff --git a/front-end/Views/registrations_step5.SAVE2 b/front-end/Views/registrations_step5.SAVE2
new file mode 100644 (file)
index 0000000..0339105
--- /dev/null
@@ -0,0 +1,905 @@
+<!--{if:haveCustomStylesheet=YES}-->
+       <LINK REL="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/style.css">
+<!--{else:haveCustomStylesheet}
+       <LINK REL="stylesheet" HREF="{base_app_secure_url}Common/Registrations_V3/front-end/Views/style.css">
+{/if:haveCustomStylesheet}-->
+<!--{if:haveStylesheetOverride=YES}-->
+       <link type="text/css" rel="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/override.css">
+<!--{/if:haveStylesheetOverride}-->
+
+<script>    
+
+       function show( d, disp )
+       {
+               x = document.getElementById(d);
+               if (x) {
+                       // Show the selected area
+                   x.style.visibility = 'visible';
+                   x.style.display = disp;
+               }
+       }
+       
+       function hide( d )
+       {
+               x = document.getElementById(d);
+               if (x) {
+               // Hide the selected area
+               x.style.visibility = 'hidden';
+               x.style.display = 'none';
+               }
+       }
+       
+       function inputDisable(d)
+       {
+               var myDiv = document.getElementById(d);
+               var inputArr = myDiv.getElementsByTagName( "input" );
+               for (var i = 0; i < inputArr.length; i++) {
+                       inputArr[i].disabled = true;
+               }
+               var inputArr = myDiv.getElementsByTagName( "select" );
+               for (var i = 0; i < inputArr.length; i++) {
+                       inputArr[i].disabled = true;
+               }
+       }
+       
+       function inputEnable(d)
+       {
+               var myDiv = document.getElementById(d);
+               var inputArr = myDiv.getElementsByTagName( "input" );
+               for (var i = 0; i < inputArr.length; i++) {
+                       inputArr[i].disabled = false;
+               }
+               var inputArr = myDiv.getElementsByTagName( "select" );
+               for (var i = 0; i < inputArr.length; i++) {
+                       inputArr[i].disabled = false;
+               }
+       }       
+       
+       function reset_hide()
+       {
+
+       <!--{if:pay_by_comp_code!No}-->
+           hide('comp_code_input');
+           inputDisable('comp_code_input');
+       <!--{/if:pay_by_comp_code}-->
+       <!--{if:pay_by_check!No}-->
+               hide('check_input');
+               inputDisable('check_input');
+       <!--{/if:pay_by_check}-->
+    <!--{if:call_from_merchant!No}-->
+        hide('call_from_merchant_input');
+        inputDisable('call_from_merchant_input');
+    <!--{/if:call_from_merchant}-->
+       <!--{if:pay_by_cash!No}-->
+               hide('cash_input');
+               inputDisable('cash_input');
+       <!--{/if:pay_by_cash}-->
+       <!--{if:pay_by_credit_card!No}-->
+               hide('credit_card_input');
+               inputDisable('credit_card_input');
+       <!--{/if:pay_by_credit_card}-->
+       
+       <!--{if:pay_by_comp_code!No}-->
+           x = document.getElementById('comp_code_button');
+           if (x) {
+                   if( x.checked ) {
+                       show('comp_code_input', 'inline');
+                           inputEnable('comp_code_input');
+                   }
+           }
+       <!--{/if:pay_by_comp_code}-->
+       <!--{if:pay_by_check!No}-->
+           x = document.getElementById('check_button');
+           if (x) {
+                   if( x.checked ) {
+                       show('check_input', 'inline');
+                           inputEnable('check_input');
+                   }
+               }
+       <!--{/if:pay_by_check}-->
+    <!--{if:call_from_merchant!No}-->
+        x = document.getElementById('call_from_merchant_button');
+        if (x) {
+            if( x.checked ) {
+                show('call_from_merchant_input', 'inline');
+                inputEnable('call_from_merchant_input');
+            }
+        }
+    <!--{/if:call_from_merchant}-->
+       <!--{if:pay_by_cash!No}-->
+           x = document.getElementById('cash_button');
+           if (x) {
+                   if( x.checked ) {
+                       show('cash_input', 'inline');
+                           inputEnable('cash_input');
+                   }
+           }
+       <!--{/if:pay_by_cash}-->
+       <!--{if:pay_by_credit_card!No}-->
+           x = document.getElementById('credit_card_button');
+           if (x) {
+                   if( x.checked ) {
+                       show('credit_card_input', 'inline');
+                       inputEnable('credit_card_input');
+                   }
+           }
+       <!--{/if:pay_by_credit_card}-->
+           
+       }    
+       
+       function clickContactSame() 
+       {
+               x = document.getElementById('contact_same');
+               if (x) {
+                       if( x.checked ) {
+                       hide('contactForm');
+                   } else {
+                       show('contactForm', 'table-row');
+                   }
+               }       
+       }
+
+       function copyContact() 
+       {
+               x = document.getElementById('contact_same');
+               if (x && x.checked) {
+               document.getElementById('contact_fname').value = document.getElementById('fname').value;
+               document.getElementById('contact_lname').value = document.getElementById('lname').value;
+               document.getElementById('contact_addr1').value = document.getElementById('addr1').value;
+               document.getElementById('contact_addr2').value = document.getElementById('addr2').value;
+               document.getElementById('contact_city').value = document.getElementById('city').value;
+               document.getElementById('contact_state').value = document.getElementById('state').value;
+               document.getElementById('contact_country').value = document.getElementById('country').value;
+               document.getElementById('contact_zip').value = document.getElementById('zip').value;
+               document.getElementById('contact_phone').value = document.getElementById('phone').value;
+               document.getElementById('contact_fax').value = document.getElementById('fax').value;
+               }
+       }
+
+       function do_wait()
+       {
+               
+               hide('continueButton'); 
+               show('pleaseWait','inline'); 
+               copyContact();          
+               
+       }
+       
+</script>
+
+<div id="registrations">
+
+  <!--{if:admin_user=YES}-->
+    <div class="adminUser">
+        <b>{word_Registration} being entered by Admin User</b>
+    </div>
+  <!--{/if:admin_user}-->
+    
+    <div id="regPageTopText">
+       <p>{regCheckoutPageText}</p>
+    </div>
+
+    <!--{if:have_members=YES}-->
+       <!--{if:haveUser=YES}-->
+            <b>{customer_long_name} Member logged in</b> - <a href="{base_secure_url}index.php?catid={category_id}{preview}&logout=YES">Log Out</a>
+       <!--{/if:haveUser}-->
+    <!--{/if:have_members}-->       
+
+  <!--{if:have_reason=YES}-->
+        <div class="regWarning">
+            <h3>Your request was not submitted. Please check the following items.</h3>
+            <ul>
+    <!--{list:reason}-->
+                <li>{text}</li>
+    <!--{/list:reason}-->
+            </ul>
+        </div>
+  <!--{/if:have_reason}-->
+
+       <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step1" class="button selectmore"><span>Select More</span></a>
+<!--{if:display_only_mode=NO}-->
+  <!--{if:haveCart=YES}-->
+       <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step4" class="button showcart"><span>View Cart</span></a>
+  <!--{/if:haveCart}-->
+<!--{/if:display_only_mode}-->  
+
+    <form action="{base_secure_url}index.php?catid={category_id}{preview}" name="step3" method="post">
+        <input type="hidden" name="Action" value="{next_step}">
+        <input type="hidden" name="checkoutPage" value="YES">
+        {form_data}
+
+       <!--{if:haveUser=YES}-->
+               <hr>
+               <p>
+                       <b>Current Registered User:&nbsp;&nbsp;</b>{userFname}&nbsp;{userLname}&nbsp;&nbsp;&nbsp;&nbsp;<a href="{base_secure_url}index.php?catid={category_id}{preview}&logout=YES">(not me or log me out)</a>  
+                       <!--{if:userIsMember=YES}--><br>(A {customer_long_name} member)<!--{/if:userIsMember}-->                
+               </p>
+       <!--{/if:haveUser}-->
+
+               <div class="regItem">
+                       <div class="regCharges">
+                               <h3>{word_Event} Summary</h3>
+                               <hr>
+                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+       <!--{list:shoppingCart}-->
+                                       <tr style="background-color: #eee;">
+                                               <td class="tdCartLeft" colspan="3" style="padding: 0 10px 0 10px;">
+               <!--{if:date_specific=YES}-->
+                                                       <p style="float: right;">{start_date} through {end_date}</p>
+               <!--{else:date_specific}
+                       <!--{if:ask_date=YES}-->                                        
+                                                       <p style="float: right;" >Desired Date: {desired_date}</p>
+                       <!--{/if:ask_date}-->
+               {/if:date_specific}-->
+                                                       <h3 >{event_name}</h3>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <th class="thCartLeft">Charges</th>
+                                               <th class="thCartRight" style="width: 100px;"><!--{if:need_attendees=YES}-->Per {word_Attendee}<!--{else:need_attendees}&nbsp;{/if:need_attendees}--></th>
+                                               <th class="thCartRight" style="width: 80px;">Total</th>
+                                       </tr>
+                         <!--{list:charges}-->
+                           <tr>
+                               <td class="tdCartLeft">{charge_title}</td>
+                               <td class="tdCartRight">{charge}</td>
+                               <td class="thCartRight">{extend}</td>
+                       </tr>
+                         <!--{sep:charges}-->
+                         <!--{/sep:charges}-->
+                           <tr>
+                               <td class="tdCartLeft">{charge_title}</td>
+                               <td class="tdCartRight">{charge}</td>
+                               <td class="thCartRight">{extend}</td>
+                       </tr>
+                         <!--{/list:charges}-->
+                           <tr>
+                               <th class="thCartRight" colspan="2">Sub Total</th>
+                               <td class="thCartRight">{totalCharges}</td>
+                       </tr>
+      <!--{if:have_attendees=YES}-->
+                           <tr>
+                           <tr><td class="tdCartLeft" colspan="3">&nbsp;</td></tr>
+                             <td colspan="3">
+                                 <table border="0" cellspacing="0" cellpadding="0" width="100%">
+        <!--{if:med_info=YES}-->
+                                   <tr>
+                                     <td width="20px">&nbsp;</td><th>{word_Attendee}</th>
+                              <th colspan="4">Required emergency contact and medical information.</th>
+                            </tr>                
+          <!--{list:attendees}-->
+                            <tr>
+                                <td>&nbsp;</td><td colspan="5">{name}</td>    
+                            </tr>
+                            <tr>                  
+                                <td colspan="2">&nbsp;</td>
+                                <td class="regRequired">Date of Birth: </td><td><input type="text" name="att_{cart_id}_{attendee_id}_dob" value="{dob}"></td>
+                                <td>Parent/Guardian: </td><td><input type="text" name="att_{cart_id}_{attendee_id}_guardian" value="{guardian}"></td>
+                            </tr>
+                            <tr>
+                                <td colspan="2">&nbsp;</td>
+                                <td class="regRequired">Emergency Contact: </td><td><input type="text" name="att_{cart_id}_{attendee_id}_emer_contact" value="{emer_contact}"></td>
+                                <td class="regRequired">Emergency Phone: </td><td><input type="text" name="att_{cart_id}_{attendee_id}_emer_phone" value="{emer_phone}"></td>
+                            </tr>
+                                <td colspan="2">&nbsp;</td>
+                                <td>Brief Medical History: </td><td colspan="3"><input type="text" name="att_{cart_id}_{attendee_id}_med_history" value="{med_history}" style="width: 400px;"></td>
+                            </tr>
+                                <td colspan="2">&nbsp;</td>
+                                <td>Alergies/Medications: </td><td colspan="3"><input type="text" name="att_{cart_id}_{attendee_id}_allergy_med" value="{allergy_med}" style="width: 400px;"></td>
+                            </tr>               
+          <!--{/list:attendees}-->                               
+        <!--{else:med_info}
+          <!--{if:need_attendees=YES}-->
+                            <tr>
+                              <td width="20px">&nbsp;</td><th>{word_Attendees}: </th>
+                              <td align="left">
+               <!--{list:attendees}-->
+                                {name}<!--{sep:attendees}-->, <!--{/sep:attendees}-->
+                                {name}
+               <!--{/list:attendees}-->
+                              </td>
+                            </tr>
+          <!--{/if:need_attendees}-->
+        {/if:med_info}-->
+                                 </table>
+                             </td>
+                           </tr>
+      <!--{/if:have_attendees}-->
+      <!--{if:haveTerms=YES}-->
+                    <tr>
+                       <td class="tdCartLeft" colspan="3">&nbsp;</td>
+                       </tr>
+                           <tr>
+                               <td class="tdCartLeft" colspan="3"><b>Additional terms/conditions:</b> {terms}</td>
+                       </tr>
+      <!--{/if:haveTerms}--> 
+                               <tr><td colspan="2">&nbsp;</td></tr>                   
+       <!--{/list:shoppingCart}-->
+                                       <tr>
+                                               <th class="thCartRight" colspan="2">Grand Total:</th>
+                                               <th class="thCartRight">{grandTotal}</th>
+                                       </tr>
+                               </table>
+                       </div>
+               </div>
+               <hr>
+               <p class="regRequired">Fields in red are required.</p>
+
+                 <table border="0" cellspacing="0" cellpadding="0" width="100%">
+       <!--{if:use_full_billing_at_top=YES}-->                                 
+                                       <tr>
+                                               <td colspan="2">
+                               <!--{if:noCharges=YES}-->
+                                                       <h3>Contact Information:</h3>
+                               <!--{else:noCharges}
+                                                       <h3>Billing Information:</h3>
+                               {/if:noCharges}--> 
+                                               </td>
+                                       </tr>
+                    <tr>
+                       <td valign="top">
+                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                               <!--{if:show_free_fname=YES}-->
+                                           <TR><TD class="regRequired" width="110px">First Name:</TD><TD class="textInput"><INPUT id="fname" TYPE="text" NAME="fname" VALUE="{fname}" class="inputMedium"></TD></TR>
+                               <!--{/if:show_free_fname}-->
+                               <!--{if:show_free_lname=YES}-->
+                                           <TR><TD class="regRequired">Last Name:</TD><TD class="textInput"><INPUT id="lname" TYPE="text" NAME="lname" VALUE="{lname}" class="inputMedium"></TD></TR>
+                               <!--{/if:show_free_lname}-->
+                               <!--{if:show_free_addr1=YES}-->
+                                           <TR><TD class="regRequired">Address:</TD><TD class="textInput"><INPUT id="addr1" TYPE="text" NAME="addr1" VALUE="{addr1}" class="inputMedium"></TD></TR>
+                               <!--{/if:show_free_addr1}-->
+                               <!--{if:show_free_addr2=YES}-->
+                                           <TR><TD class="regFieldName">&nbsp;</TD><TD class="textInput"><INPUT id="addr2" TYPE="text" NAME="addr2" VALUE="{addr2}" class="inputMedium"></TD></TR>
+                               <!--{/if:show_free_addr2}-->
+                               <!--{if:show_free_city=YES}-->
+                                           <TR><TD class="regRequired">City:</TD><TD class="textInput"><INPUT id="city" TYPE="text" NAME="city" VALUE="{city}" class="inputMedium"></TD></TR>
+                               <!--{/if:show_free_city}-->
+                               <!--{if:show_free_state=YES}-->
+                                           <TR><TD class="regRequired">State/Prov.:</TD><TD>{state}</TD></TR>
+                               <!--{/if:show_free_state}-->
+                               <!--{if:show_free_country=YES}-->
+                                           <TR><TD class="regRequired">Country:</TD><TD>{country}</TD></TR>
+                               <!--{/if:show_free_country}-->
+                               <!--{if:show_free_zip=YES}-->
+                                           <TR><TD class="regRequired">ZIP/Postal Code:</TD><TD class="textInput"><INPUT id="zip" TYPE="text" NAME="zip" SIZE="10" VALUE="{zip}"></TD></TR>
+                               <!--{/if:show_free_zip}-->
+                                       </table>
+                               </td>
+                               <td valign="top">
+                                       <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                               <!--{if:show_free_phone=YES}-->
+                                       <TR><TD class="regRequired">Phone:</TD><TD class="textInput"><INPUT id="phone" TYPE="text" NAME="phone" VALUE="{phone}"></TD></TR>
+                               <!--{/if:show_free_phone}-->
+                               <!--{if:show_free_fax=YES}-->
+                                       <TR><TD class="regFieldName">FAX:</TD><TD class="textInput"><INPUT id="fax" TYPE="text" NAME="fax" VALUE="{fax}"></TD></TR>
+                               <!--{/if:show_free_fax}-->
+                                   </table>
+                           </td>
+                    </tr>
+  <!--{/if:use_full_billing_at_top}-->                                 
+  <!--{if:show_contact_data=YES}-->
+                                       <tr>                                    
+                                               <td colspan="2">
+                                                       <h3>{contact_information_title}:<h3>
+                                               </td>
+                                       </tr>
+       <!--{if:show_same_button=YES}-->
+                                       <tr>
+                                               <td>
+                                                       <h3>Same as above:</h3> <input type="checkbox" name="contact_same" id="contact_same" onClick="clickContactSame();" {contact_same}> Same as billing information
+                                               </td>
+                                       </tr>
+       <!--{/if:show_same_button}-->
+                    <tr id="contactForm">
+                       <td valign="top">
+                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                           <!--{if:use_contact_fname=YES}-->
+                                               <tr>
+                                                       <!--{if:required_contact_fname=YES}--><TD class="regRequired .nowrap" width="110px"><!--{else:required_contact_fname}<TD class="regFieldName .nowrap">{/if:required_contact_fname}-->
+                                                               {prompt_contact_fname}:
+                                                       </TD>
+                                                       <TD class="textInput" align="left"><INPUT id="contact_fname" TYPE="text" NAME="contact_fname" VALUE="{contact_fname}" class="inputMedium"></TD>
+                                               </TR>
+                                           <!--{/if:use_contact_fname}-->
+                                           <!--{if:use_contact_lname=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_lname=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_lname}<TD class="regFieldName .nowrap">{/if:required_contact_lname}-->
+                                                               {prompt_contact_lname}:
+                                                       </TD>
+                                                       <TD class="textInput"><INPUT id="contact_lname" TYPE="text" NAME="contact_lname" VALUE="{contact_lname}" class="inputMedium"></TD>
+                                               </TR>
+                                           <!--{/if:use_contact_lname}-->
+                                           <!--{if:use_contact_addr1=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_addr1=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_addr1}<TD class="regFieldName .nowrap">{/if:required_contact_addr1}-->
+                                                               {prompt_contact_addr1}:
+                                                       </TD>
+                                                       <TD class="textInput"><INPUT id="contact_addr1" TYPE="text" NAME="contact_addr1" VALUE="{contact_addr1}" class="inputMedium"></TD>
+                                               </TR>
+                                           <!--{/if:use_contact_addr1}-->
+                                           <!--{if:use_contact_addr2=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_addr2=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_addr2}<TD class="regFieldName .nowrap">{/if:required_contact_addr2}-->
+                                                               {prompt_contact_addr2}:
+                                                       </TD>
+                                                       <TD class="textInput"><INPUT id="contact_addr2" TYPE="text" NAME="contact_addr2" VALUE="{contact_addr2}" class="inputMedium"></TD>
+                                               </TR>
+                                           <!--{/if:use_contact_addr2}-->
+                                           <!--{if:use_contact_city=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_city=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_city}<TD class="regFieldName .nowrap">{/if:required_contact_city}-->
+                                                               {prompt_contact_city}:
+                                                       </TD>
+                                                       <TD class="textInput"><INPUT id="contact_city" TYPE="text" NAME="contact_city" VALUE="{contact_city}" class="inputMedium"></TD>
+                                               </TR>
+                                           <!--{/if:use_contact_city}-->
+                                           <!--{if:use_contact_state=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_state=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_state}<TD class="regFieldName .nowrap">{/if:required_contact_state}-->
+                                                               {prompt_contact_state}:
+                                                       </TD>
+                                                       <TD>{contact_state}</TD>
+                                               </TR>
+                                           <!--{/if:use_contact_state}-->
+                                           <!--{if:use_contact_zip=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_zip=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_zip}<TD class="regFieldName .nowrap">{/if:required_contact_zip}-->
+                                                               {prompt_contact_zip}:
+                                                       </TD>
+                                                       <TD class="textInput"><INPUT id="contact_zip" TYPE="text" NAME="contact_zip" SIZE="10" VALUE="{contact_zip}"></TD>
+                                               </TR>
+                                           <!--{/if:use_contact_zip}-->
+                                           <!--{if:use_contact_country=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_country=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_country}<TD class="regFieldName .nowrap">{/if:required_contact_country}-->
+                                                               {prompt_contact_country}:
+                                                       </TD>
+                                                       <TD>{contact_country}</TD>
+                                               </TR>
+                                           <!--{/if:use_contact_country}-->
+                                           <!--{if:use_contact_phone=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_phone=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_phone}<TD class="regFieldName .nowrap">{/if:required_contact_phone}-->
+                                                               {prompt_contact_phone}:
+                                                       </TD>
+                                                       <TD class="textInput"><INPUT id="contact_phone" TYPE="text" NAME="contact_phone" VALUE="{contact_phone}"></TD>
+                                               </TR>
+                                                   <!--{/if:use_contact_phone}-->
+                                                   <!--{if:use_contact_fax=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_fax=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_fax}<TD class="regFieldName .nowrap">{/if:required_contact_fax}-->
+                                                               {prompt_contact_fax}:</TD>
+                                                       <TD class="textInput"><INPUT id="contact_fax" TYPE="text" NAME="contact_fax" VALUE="{contact_fax}"></TD>
+                                               </TR>
+                                           <!--{/if:use_contact_fax}-->
+                                   </table>
+                           </td>
+                                       </tr>
+  <!--{/if:show_contact_data}-->
+                       <!--{if:haveUser=NO}-->
+                                       <tr>
+                                               <td class="regFieldName" valign="top" colspan="2">
+                       <!--{if:have_registered_users=YES}-->
+                                                       <h3>Returning User Login Information:</h3>
+                       <!--{else:have_registered_users}
+                                                       <h3>E-Mail Address:</h3>
+                       {/if:have_registered_users}-->                          
+                                                       <p>
+                                                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                                                       <tr><td class="regRequired" valign="top" width="110px">E-Mail Address: </td><td><input id="email" type="text" name="email" value="{email}" class="inputLarge"></td></tr>
+                       <!--{if:have_registered_users=YES}-->
+                                                                       <tr><td class="regRequired" valign="top">{word_Password}:</td><td><input type="text" name="login_password" value="{login_password}" class="inputStandard"></td></tr>
+                                                                       <tr><td colspan="2">Retain this {word_password} for future {word_registrations}. {password_msg}</td></tr>
+                       <!--{else:have_registered_users}
+                                                                       <tr><td><input type="hidden" name="login_password" value="{login_password}"> </td></tr>
+                       {/if:have_registered_users}-->
+                       
+                                                                                               
+                                                               </table>
+                                                       </p>
+                                               </td>
+                                       </tr>
+                       <!--{/if:haveUser}-->
+                 </table>
+
+               <p><hr></p>
+              
+     <!--{if:noCharges=NO}-->
+
+
+     <!--{if:one_payment_type_available=No}-->
+               <h3 style="color: red;">Select payment method:</h3>
+     <!--{/if:one_payment_type_available}-->
+     
+
+       <!--{if:pay_by_comp_code=No}--> 
+       <!--{else:pay_by_comp_code}
+         <!--{if:pay_by_comp_code_restrict=YES}-->
+               <div class="lightBorder">
+            For Admin Users Only:
+         <!--{else:pay_by_comp_code_restrict}
+               <div>
+         {/if:pay_by_comp_code_restrict}-->
+                       <h3>                
+            <!--{if:one_payment_type_available=Yes}-->
+                <input type="radio" name="payment_type" value="comp_code" onClick="reset_hide();" id="comp_code_button" CHECKED>
+            <!--{else:one_payment_type_available}
+                       <!--{if:payment_type=comp_code}--> 
+                               <input type="radio" name="payment_type" value="comp_code" onClick="reset_hide();" id="comp_code_button" CHECKED>
+                       <!--{else:payment_type} 
+                               <input type="radio" name="payment_type" value="comp_code" onClick="reset_hide();" id="comp_code_button">
+                       {/if:payment_type}--> 
+            {/if:one_payment_type_available}--> 
+                       {title_use_payment_comp_code}
+                       </h3>
+                       <div id="comp_code_input">
+               <!--{if:comp_code_fields_used=YES}-->
+                               <p>Please provide the following information:</p>
+                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                           <tr>
+                               <td valign="top">
+                                       <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <!--{if:comp_code_field_fname=YES}-->
+                                                   <TR><TD class="regRequired" width="110px">First Name:</TD><TD class="textInput"><INPUT id="fname" TYPE="text" NAME="fname" VALUE="{fname}" class="inputMedium"></TD></TR>
+                                       <!--{/if:comp_code_field_fname}-->
+                                       <!--{if:comp_code_field_lname=YES}-->
+                                                   <TR><TD class="regRequired">Last Name:</TD><TD class="textInput"><INPUT id="lname" TYPE="text" NAME="lname" VALUE="{lname}" class="inputMedium"></TD></TR>
+                                       <!--{/if:comp_code_field_lname}-->
+                                       <!--{if:comp_code_field_addr1=YES}-->
+                                                   <TR><TD class="regRequired">Address:</TD><TD class="textInput"><INPUT id="addr1" TYPE="text" NAME="addr1" VALUE="{addr1}" class="inputMedium"></TD></TR>
+                                       <!--{/if:comp_code_field_addr1}-->
+                                       <!--{if:comp_code_field_addr2=YES}-->
+                                                   <TR><TD class="regFieldName">&nbsp;</TD><TD class="textInput"><INPUT id="addr2" TYPE="text" NAME="addr2" VALUE="{addr2}" class="inputMedium"></TD></TR>
+                                       <!--{/if:comp_code_field_addr2}-->
+                                       <!--{if:comp_code_field_city=YES}-->
+                                                   <TR><TD class="regRequired">City:</TD><TD class="textInput"><INPUT id="city" TYPE="text" NAME="city" VALUE="{city}" class="inputMedium"></TD></TR>
+                                       <!--{/if:comp_code_field_city}-->
+                                       <!--{if:comp_code_field_state=YES}-->
+                                                   <TR><TD class="regRequired">State/Prov.:</TD><TD>{state}</TD></TR>
+                                       <!--{/if:comp_code_field_state}-->
+                                       <!--{if:comp_code_field_country=YES}-->
+                                                   <TR><TD class="regRequired">Country:</TD><TD>{country}</TD></TR>
+                                       <!--{/if:comp_code_field_country}-->
+                                       <!--{if:comp_code_field_zip=YES}-->
+                                                   <TR><TD class="regRequired">ZIP/Postal Code:</TD><TD class="textInput"><INPUT id="zip" TYPE="text" NAME="zip" SIZE="10" VALUE="{zip}"></TD></TR>
+                                       <!--{/if:comp_code_field_zip}-->
+                                               </table>
+                                       </td>
+                                       <td valign="top">
+                                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <!--{if:comp_code_field_phone=YES}-->
+                                               <TR><TD class="regRequired">Phone:</TD><TD class="textInput"><INPUT id="phone" TYPE="text" NAME="phone" VALUE="{phone}"></TD></TR>
+                                       <!--{/if:comp_code_field_phone}-->
+                                       <!--{if:comp_code_field_fax=YES}-->
+                                               <TR><TD class="regFieldName">FAX:</TD><TD class="textInput"><INPUT id="fax" TYPE="text" NAME="fax" VALUE="{fax}"></TD></TR>
+                                       <!--{/if:comp_code_field_fax}-->
+                                           </table>
+                                   </td>
+                           </tr>
+                               </table>
+               <!--{/if:comp_code_fields_used}-->
+                               <p class="regFieldName">{title_payment_comp_code}: <INPUT TYPE="text" NAME="pay_code" VALUE="{pay_code}" style="width: 50px;"></p>
+                       </div>
+               </div>
+       {/if:pay_by_comp_code}-->
+
+       <!--{if:pay_by_check=No}-->
+       <!--{else:pay_by_check}
+         <!--{if:pay_by_check_restrict=YES}-->
+               <div class="lightBorder">
+            For Admin Users Only:
+         <!--{else:pay_by_check_restrict}
+               <div>
+         {/if:pay_by_check_restrict}-->
+               <h3>
+            <!--{if:one_payment_type_available=Yes}-->
+                <input type="radio" name="payment_type" value="by_check" onClick="reset_hide();" id="check_button" CHECKED>
+            <!--{else:one_payment_type_available}
+                       <!--{if:payment_type=by_check}-->
+                               <input type="radio" name="payment_type" value="by_check" onClick="reset_hide();" id="check_button" CHECKED>
+                   <!--{else:payment_type}
+                               <input type="radio" name="payment_type" value="by_check" onClick="reset_hide();" id="check_button">
+                   {/if:payment_type}-->
+            <!--{/if:one_payment_type_available}-->
+            
+                   {title_send_a_check}
+                       </h3>
+            <div id="check_input">
+               <!--{if:check_fields_used=YES}-->
+                               <p>Please provide the following information:</p>
+                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                           <tr>
+                               <td valign="top">
+                                       <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <!--{if:check_field_fname=YES}-->
+                                                   <TR><TD class="regRequired" width="110px">First Name:</TD><TD class="textInput"><INPUT id="fname" TYPE="text" NAME="fname" VALUE="{fname}" class="inputMedium"></TD></TR>
+                                       <!--{/if:check_field_fname}-->
+                                       <!--{if:check_field_lname=YES}-->
+                                                   <TR><TD class="regRequired">Last Name:</TD><TD class="textInput"><INPUT id="lname" TYPE="text" NAME="lname" VALUE="{lname}" class="inputMedium"></TD></TR>
+                                       <!--{/if:check_field_lname}-->
+                                       <!--{if:check_field_addr1=YES}-->
+                                                   <TR><TD class="regRequired">Address:</TD><TD class="textInput"><INPUT id="addr1" TYPE="text" NAME="addr1" VALUE="{addr1}" class="inputMedium"></TD></TR>
+                                       <!--{/if:check_field_addr1}-->
+                                       <!--{if:check_field_addr2=YES}-->
+                                                   <TR><TD class="regFieldName">&nbsp;</TD><TD class="textInput"><INPUT id="addr2" TYPE="text" NAME="addr2" VALUE="{addr2}" class="inputMedium"></TD></TR>
+                                       <!--{/if:check_field_addr2}-->
+                                       <!--{if:check_field_city=YES}-->
+                                                   <TR><TD class="regRequired">City:</TD><TD class="textInput"><INPUT id="city" TYPE="text" NAME="city" VALUE="{city}" class="inputMedium"></TD></TR>
+                                       <!--{/if:check_field_city}-->
+                                       <!--{if:check_field_state=YES}-->
+                                                   <TR><TD class="regRequired">State/Prov.:</TD><TD>{state}</TD></TR>
+                                       <!--{/if:check_field_state}-->
+                                       <!--{if:check_field_country=YES}-->
+                                                   <TR><TD class="regRequired">Country:</TD><TD>{country}</TD></TR>
+                                       <!--{/if:check_field_country}-->
+                                       <!--{if:check_field_zip=YES}-->
+                                                   <TR><TD class="regRequired">ZIP/Postal Code:</TD><TD class="textInput"><INPUT id="zip" TYPE="text" NAME="zip" SIZE="10" VALUE="{zip}"></TD></TR>
+                                       <!--{/if:check_field_zip}-->
+                                               </table>
+                                       </td>
+                                       <td valign="top">
+                                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <!--{if:check_field_phone=YES}-->
+                                               <TR><TD class="regRequired">Phone:</TD><TD class="textInput"><INPUT id="phone" TYPE="text" NAME="phone" VALUE="{phone}"></TD></TR>
+                                       <!--{/if:check_field_phone}-->
+                                       <!--{if:check_field_fax=YES}-->
+                                               <TR><TD class="regFieldName">FAX:</TD><TD class="textInput"><INPUT id="fax" TYPE="text" NAME="fax" VALUE="{fax}"></TD></TR>
+                                       <!--{/if:check_field_fax}-->
+                                           </table>
+                                   </td>
+                           </tr>
+                               </table>
+               <!--{/if:check_fields_used}-->
+            </div>
+               </div>
+       {/if:pay_by_check}-->
+
+    <!--{if:pay_by_call_from_merchant=No}-->
+    <!--{else:pay_by_call_from_merchant}
+      <!--{if:pay_by_call_from_merchant_restrict=YES}-->
+        <div class="lightBorder">
+            For Admin Users Only:
+      <!--{else:pay_by_call_from_merchant_restrict}
+        <div>
+      {/if:pay_by_call_from_merchant_restrict}-->
+            <h3>
+            <!--{if:one_payment_type_available=Yes}-->
+                <input type="radio" name="payment_type" value="call_from_merchant" onClick="reset_hide();" id="call_from_merchant_button" CHECKED>
+            <!--{else:one_payment_type_available}
+              <!--{if:payment_type=call_from_merchant}-->
+                <input type="radio" name="payment_type" value="call_from_merchant" onClick="reset_hide();" id="call_from_merchant_button" CHECKED>
+              <!--{else:payment_type}
+                <input type="radio" name="payment_type" value="call_from_merchant" onClick="reset_hide();" id="call_from_merchant_button">
+              {/if:payment_type}-->
+            {/if:one_payment_type_available}-->
+            {title_call_from_merchant}
+            </h3>
+            <div id="call_from_merchant_input">
+        <!--{if:call_from_merchant_fields_used=YES}-->
+                <p>Please provide the following information:</p>
+                <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                        <tr>
+                            <td valign="top">
+                                <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                <!--{if:call_from_merchant_field_fname=YES}-->
+                                    <TR><TD class="regRequired" width="110px">First Name:</TD><TD class="textInput"><INPUT id="fname" TYPE="text" NAME="fname" VALUE="{fname}" class="inputMedium"></TD></TR>
+                                <!--{/if:call_from_merchant_field_fname}-->
+                                <!--{if:call_from_merchant_field_lname=YES}-->
+                                    <TR><TD class="regRequired">Last Name:</TD><TD class="textInput"><INPUT id="lname" TYPE="text" NAME="lname" VALUE="{lname}" class="inputMedium"></TD></TR>
+                                <!--{/if:call_from_merchant_field_lname}-->
+                                <!--{if:call_from_merchant_field_addr1=YES}-->
+                                    <TR><TD class="regRequired">Address:</TD><TD class="textInput"><INPUT id="addr1" TYPE="text" NAME="addr1" VALUE="{addr1}" class="inputMedium"></TD></TR>
+                                <!--{/if:call_from_merchant_field_addr1}-->
+                                <!--{if:call_from_merchant_field_addr2=YES}-->
+                                    <TR><TD class="regFieldName">&nbsp;</TD><TD class="textInput"><INPUT id="addr2" TYPE="text" NAME="addr2" VALUE="{addr2}" class="inputMedium"></TD></TR>
+                                <!--{/if:call_from_merchant_field_addr2}-->
+                                <!--{if:call_from_merchant_field_city=YES}-->
+                                    <TR><TD class="regRequired">City:</TD><TD class="textInput"><INPUT id="city" TYPE="text" NAME="city" VALUE="{city}" class="inputMedium"></TD></TR>
+                                <!--{/if:call_from_merchant_field_city}-->
+                                <!--{if:call_from_merchant_field_state=YES}-->
+                                    <TR><TD class="regRequired">State/Prov.:</TD><TD>{state}</TD></TR>
+                                <!--{/if:call_from_merchant_field_state}-->
+                                <!--{if:call_from_merchant_field_country=YES}-->
+                                    <TR><TD class="regRequired">Country:</TD><TD>{country}</TD></TR>
+                                <!--{/if:call_from_merchant_field_country}-->
+                                <!--{if:call_from_merchant_field_zip=YES}-->
+                                    <TR><TD class="regRequired">ZIP/Postal Code:</TD><TD class="textInput"><INPUT id="zip" TYPE="text" NAME="zip" SIZE="10" VALUE="{zip}"></TD></TR>
+                                <!--{/if:call_from_merchant_field_zip}-->
+                                </table>
+                            </td>
+                            <td valign="top">
+                                <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                <!--{if:call_from_merchant_field_phone=YES}-->
+                                    <TR><TD class="regRequired">Phone:</TD><TD class="textInput"><INPUT id="phone" TYPE="text" NAME="phone" VALUE="{phone}"></TD></TR>
+                                <!--{/if:call_from_merchant_field_phone}-->
+                                <!--{if:call_from_merchant_field_fax=YES}-->
+                                    <TR><TD class="regFieldName">FAX:</TD><TD class="textInput"><INPUT id="fax" TYPE="text" NAME="fax" VALUE="{fax}"></TD></TR>
+                                <!--{/if:call_from_merchant_field_fax}-->
+                                </table>
+                            </td>
+                        </tr>
+                </table>
+        <!--{/if:call_from_merchant_fields_used}-->
+            </div>
+        </div>
+
+    {/if:pay_by_call_from_merchant}-->
+
+
+       <!--{if:pay_by_cash=No}-->
+       <!--{else:pay_by_cash}
+         <!--{if:pay_by_cash_restrict=YES}-->
+               <div class="lightBorder">
+            For Admin Users Only:
+         <!--{else:pay_by_cash_restrict}
+               <div>
+         {/if:pay_by_cash_restrict}-->
+               <h3>
+            <!--{if:one_payment_type_available=Yes}-->
+                <input type="radio" name="payment_type" value="cash" onClick="reset_hide();" id="cash_button" CHECKED>
+            <!--{else:one_payment_type_available=Yes}
+            <!--{if:payment_type=cash}--> 
+                <input type="radio" name="payment_type" value="cash" onClick="reset_hide();" id="cash_button" CHECKED>
+            <!--{else:payment_type} 
+                <input type="radio" name="payment_type" value="cash" onClick="reset_hide();" id="cash_button">
+            {/if:payment_type}--> 
+            {/if:one_payment_type_available}--> 
+                {title_paid_cash}
+            </h3>
+            <div id="cash_input">
+               <!--{if:cash_fields_used=YES}-->
+                               <p>Please provide the following information:</p>
+                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                           <tr>
+                               <td valign="top">
+                                       <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <!--{if:cash_field_fname=YES}-->
+                                                   <TR><TD class="regRequired" width="110px">First Name:</TD><TD class="textInput"><INPUT id="fname" TYPE="text" NAME="fname" VALUE="{fname}" class="inputMedium"></TD></TR>
+                                       <!--{/if:cash_field_fname}-->
+                                       <!--{if:cash_field_lname=YES}-->
+                                                   <TR><TD class="regRequired">Last Name:</TD><TD class="textInput"><INPUT id="lname" TYPE="text" NAME="lname" VALUE="{lname}" class="inputMedium"></TD></TR>
+                                       <!--{/if:cash_field_lname}-->
+                                       <!--{if:cash_field_addr1=YES}-->
+                                                   <TR><TD class="regRequired">Address:</TD><TD class="textInput"><INPUT id="addr1" TYPE="text" NAME="addr1" VALUE="{addr1}" class="inputMedium"></TD></TR>
+                                       <!--{/if:cash_field_addr1}-->
+                                       <!--{if:cash_field_addr2=YES}-->
+                                                   <TR><TD class="regFieldName">&nbsp;</TD><TD class="textInput"><INPUT id="addr2" TYPE="text" NAME="addr2" VALUE="{addr2}" class="inputMedium"></TD></TR>
+                                       <!--{/if:cash_field_addr2}-->
+                                       <!--{if:cash_field_city=YES}-->
+                                                   <TR><TD class="regRequired">City:</TD><TD class="textInput"><INPUT id="city" TYPE="text" NAME="city" VALUE="{city}" class="inputMedium"></TD></TR>
+                                       <!--{/if:cash_field_city}-->
+                                       <!--{if:cash_field_state=YES}-->
+                                                   <TR><TD class="regRequired">State/Prov.:</TD><TD>{state}</TD></TR>
+                                       <!--{/if:cash_field_state}-->
+                                       <!--{if:cash_field_country=YES}-->
+                                                   <TR><TD class="regRequired">Country:</TD><TD>{country}</TD></TR>
+                                       <!--{/if:cash_field_country}-->
+                                       <!--{if:cash_field_zip=YES}-->
+                                                   <TR><TD class="regRequired">ZIP/Postal Code:</TD><TD class="textInput"><INPUT id="zip" TYPE="text" NAME="zip" SIZE="10" VALUE="{zip}"></TD></TR>
+                                       <!--{/if:cash_field_zip}-->
+                                               </table>
+                                       </td>
+                                       <td valign="top">
+                                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <!--{if:cash_field_phone=YES}-->
+                                               <TR><TD class="regRequired">Phone:</TD><TD class="textInput"><INPUT id="phone" TYPE="text" NAME="phone" VALUE="{phone}"></TD></TR>
+                                       <!--{/if:cash_field_phone}-->
+                                       <!--{if:cash_field_fax=YES}-->
+                                               <TR><TD class="regFieldName">FAX:</TD><TD class="textInput"><INPUT id="fax" TYPE="text" NAME="fax" VALUE="{fax}"></TD></TR>
+                                       <!--{/if:cash_field_fax}-->
+                                           </table>
+                                   </td>
+                           </tr>
+                               </table>
+               <!--{/if:cash_fields_used}-->
+            </div>
+               </div>
+       {/if:pay_by_cash}-->
+       
+       <!--{if:pay_by_credit_card=No}-->
+       <!--{else:pay_by_credit_card}
+         <!--{if:pay_by_credit_card_restrict=YES}-->
+               <div class="lightBorder">
+            For Admin Users Only:
+         <!--{else:pay_by_credit_card_restrict}
+               <div>
+         {/if:pay_by_credit_card_restrict}-->
+               <h3>
+               <!--{if:one_payment_type_available=Yes}-->
+                <input type="radio" name="payment_type" value="credit_card" onClick="reset_hide();" id="credit_card_button" CHECKED>
+            <!--{else:one_payment_type_available}
+               <!--{if:payment_type=credit_card}--> 
+                   <input type="radio" name="payment_type" value="credit_card" onClick="reset_hide();" id="credit_card_button" CHECKED>
+               <!--{else:payment_type} 
+                   <input type="radio" name="payment_type" value="credit_card" onClick="reset_hide();" id="credit_card_button">
+               {/if:payment_type}--> 
+            {/if:one_payment_type_available}--> 
+                   {title_pay_by_credit_card}
+               </h3>
+                       <div id="credit_card_input">
+               <!--{if:credit_card_fields_used=YES}-->
+                               <p>Please provide the following information:</p>
+                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                           <tr>
+                               <td valign="top">
+                                       <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <!--{if:credit_card_field_fname=YES}-->
+                                                   <TR><TD class="regRequired" width="110px">First Name:</TD><TD class="textInput"><INPUT id="fname" TYPE="text" NAME="fname" VALUE="{fname}" class="inputMedium"></TD></TR>
+                                       <!--{/if:credit_card_field_fname}-->
+                                       <!--{if:credit_card_field_lname=YES}-->
+                                                   <TR><TD class="regRequired">Last Name:</TD><TD class="textInput"><INPUT id="lname" TYPE="text" NAME="lname" VALUE="{lname}" class="inputMedium"></TD></TR>
+                                       <!--{/if:credit_card_field_lname}-->
+                                       <!--{if:credit_card_field_addr1=YES}-->
+                                                   <TR><TD class="regRequired">Address:</TD><TD class="textInput"><INPUT id="addr1" TYPE="text" NAME="addr1" VALUE="{addr1}" class="inputMedium"></TD></TR>
+                                       <!--{/if:credit_card_field_addr1}-->
+                                       <!--{if:credit_card_field_addr2=YES}-->
+                                                   <TR><TD class="regFieldName">&nbsp;</TD><TD class="textInput"><INPUT id="addr2" TYPE="text" NAME="addr2" VALUE="{addr2}" class="inputMedium"></TD></TR>
+                                       <!--{/if:credit_card_field_addr2}-->
+                                       <!--{if:credit_card_field_city=YES}-->
+                                                   <TR><TD class="regRequired">City:</TD><TD class="textInput"><INPUT id="city" TYPE="text" NAME="city" VALUE="{city}" class="inputMedium"></TD></TR>
+                                       <!--{/if:credit_card_field_city}-->
+                                       <!--{if:credit_card_field_state=YES}-->
+                                                   <TR><TD class="regRequired">State/Prov.:</TD><TD>{state}</TD></TR>
+                                       <!--{/if:credit_card_field_state}-->
+                                       <!--{if:credit_card_field_country=YES}-->
+                                                   <TR><TD class="regRequired">Country:</TD><TD>{country}</TD></TR>
+                                       <!--{/if:credit_card_field_country}-->
+                                       <!--{if:credit_card_field_zip=YES}-->
+                                                   <TR><TD class="regRequired">ZIP/Postal Code:</TD><TD class="textInput"><INPUT id="zip" TYPE="text" NAME="zip" SIZE="10" VALUE="{zip}"></TD></TR>
+                                       <!--{/if:credit_card_field_zip}-->
+                                               </table>
+                                       </td>
+                                       <td valign="top">
+                                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <!--{if:credit_card_field_phone=YES}-->
+                                               <TR><TD class="regRequired">Phone:</TD><TD class="textInput"><INPUT id="phone" TYPE="text" NAME="phone" VALUE="{phone}"></TD></TR>
+                                       <!--{/if:credit_card_field_phone}-->
+                                       <!--{if:credit_card_field_fax=YES}-->
+                                               <TR><TD class="regFieldName">FAX:</TD><TD class="textInput"><INPUT id="fax" TYPE="text" NAME="fax" VALUE="{fax}"></TD></TR>
+                                       <!--{/if:credit_card_field_fax}-->
+                                           </table>
+                                   </td>
+                           </tr>
+                               </table>
+               <!--{/if:credit_card_fields_used}-->
+                               <p>The fees totaled above will be charged to your credit card once this form is submitted</p>                                                                                                   
+                               <table border="0" cellspacing="0" cellpadding="0">
+                                       <TR><TD class="regRequired" width="110px">Card Type:</TD><TD>{cctype}</TD></TR>
+                                       <TR><TD class="regRequired">Name on Card:</TD><TD class="textInput"><INPUT TYPE="text" NAME="ccname" VALUE="{ccname}" id="ccname" style="inputMedium"></TD></TR>
+                                       <TR><TD class="regRequired">Card #:</TD><TD class="textInput"><INPUT TYPE="text" NAME="ccnum" VALUE="{ccnum}" id="ccnum"></TD></TR>
+                                       <TR><TD class="regRequired">Expiration Date:</TD><TD>Month {ccmonth} Year {ccyear}</TD></TR>
+                                       <TR><TD class="regFieldName">CVV #:</TD><TD class="textInput"><INPUT TYPE="text" NAME="cccode" VALUE="{cccode}" id="cccode" style="width: 50px;"></TD></TR>
+                                       <TR><TD COLSPAN="2">CVV is the three digit number on the<BR>signature side of your credit card.</TD></TR>
+                               </table>
+                       </div>
+               </div>
+       {/if:pay_by_credit_card}-->        
+
+   <!--{/if:noCharges}-->
+               <p class="regFieldName">
+                       <nobr>Please send me future information by email:<input type="checkbox" NAME="email_ok" {email_ok}></nobr>
+               </p>
+               <center>
+                       <INPUT id="continueButton" type="submit" name="continue" value="Complete {word_Registration}" onClick="do_wait();">
+                       <div id="pleaseWait">
+                         Please wait while we process your {word_registration}
+                       </div>
+               </center>               
+               
+               
+<!--{if:haveRegTerms=YES}-->
+<p>&nbsp;</p>
+<h3>Terms and Conditions</h3>          
+{regTerms}
+<!--{/if:haveRegTerms}-->
+       </form>
+</div><!-- /#registrations -->                                                         
+
+<!-- Hide all payment detail till a type is selected.  -->
+  <script>   
+  reset_hide();
+<!--{if:show_same_button=YES}-->  
+  clickContactSame();
+<!--{/if:show_same_button}-->  
+  </script>
+<br clear="all">
diff --git a/front-end/Views/registrations_step5.html b/front-end/Views/registrations_step5.html
new file mode 100644 (file)
index 0000000..b7faa70
--- /dev/null
@@ -0,0 +1,904 @@
+<!--{if:haveCustomStylesheet=YES}-->
+       <LINK REL="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/style.css">
+<!--{else:haveCustomStylesheet}
+       <LINK REL="stylesheet" HREF="{base_app_secure_url}Common/Registrations_V3/front-end/Views/style.css">
+{/if:haveCustomStylesheet}-->
+<!--{if:haveStylesheetOverride=YES}-->
+       <link type="text/css" rel="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/override.css">
+<!--{/if:haveStylesheetOverride}-->
+
+<script>    
+
+       function show( d, disp )
+       {
+               x = document.getElementById(d);
+               if (x) {
+                       // Show the selected area
+                   x.style.visibility = 'visible';
+                   x.style.display = disp;
+               }
+       }
+       
+       function hide( d )
+       {
+               x = document.getElementById(d);
+               if (x) {
+               // Hide the selected area
+               x.style.visibility = 'hidden';
+               x.style.display = 'none';
+               }
+       }
+       
+       function inputDisable(d)
+       {
+               var myDiv = document.getElementById(d);
+               var inputArr = myDiv.getElementsByTagName( "input" );
+               for (var i = 0; i < inputArr.length; i++) {
+                       inputArr[i].disabled = true;
+               }
+               var inputArr = myDiv.getElementsByTagName( "select" );
+               for (var i = 0; i < inputArr.length; i++) {
+                       inputArr[i].disabled = true;
+               }
+       }
+       
+       function inputEnable(d)
+       {
+               var myDiv = document.getElementById(d);
+               var inputArr = myDiv.getElementsByTagName( "input" );
+               for (var i = 0; i < inputArr.length; i++) {
+                       inputArr[i].disabled = false;
+               }
+               var inputArr = myDiv.getElementsByTagName( "select" );
+               for (var i = 0; i < inputArr.length; i++) {
+                       inputArr[i].disabled = false;
+               }
+       }       
+       
+       function reset_hide()
+       {
+
+       <!--{if:pay_by_comp_code!No}-->
+           hide('comp_code_input');
+           inputDisable('comp_code_input');
+       <!--{/if:pay_by_comp_code}-->
+       <!--{if:pay_by_check!No}-->
+               hide('check_input');
+               inputDisable('check_input');
+       <!--{/if:pay_by_check}-->
+       <!--{if:call_from_merchant!No}-->
+               hide('call_from_merchant_input');
+        //     inputDisable('call_from_merchant_input');
+       <!--{/if:call_from_merchant}-->
+       <!--{if:pay_by_cash!No}-->
+               hide('cash_input');
+               inputDisable('cash_input');
+       <!--{/if:pay_by_cash}-->
+       <!--{if:pay_by_credit_card!No}-->
+               hide('credit_card_input');
+               inputDisable('credit_card_input');
+       <!--{/if:pay_by_credit_card}-->
+       
+       <!--{if:pay_by_comp_code!No}-->
+           x = document.getElementById('comp_code_button');
+           if (x) {
+                   if( x.checked ) {
+                       show('comp_code_input', 'inline');
+                           inputEnable('comp_code_input');
+                   }
+           }
+       <!--{/if:pay_by_comp_code}-->
+       <!--{if:pay_by_check!No}-->
+           x = document.getElementById('check_button');
+           if (x) {
+                   if( x.checked ) {
+                       show('check_input', 'inline');
+                           inputEnable('check_input');
+                   }
+               }
+       <!--{/if:pay_by_check}-->
+    <!--{if:call_from_merchant!No}-->
+        x = document.getElementById('call_from_merchant_button');
+        if (x) {
+            if( x.checked ) {
+                show('call_from_merchant_input', 'inline');
+                inputEnable('call_from_merchant_input');
+            }
+        }
+    <!--{/if:call_from_merchant}-->
+       <!--{if:pay_by_cash!No}-->
+           x = document.getElementById('cash_button');
+           if (x) {
+                   if( x.checked ) {
+                       show('cash_input', 'inline');
+                           inputEnable('cash_input');
+                   }
+           }
+       <!--{/if:pay_by_cash}-->
+       <!--{if:pay_by_credit_card!No}-->
+           x = document.getElementById('credit_card_button');
+           if (x) {
+                   if( x.checked ) {
+                       show('credit_card_input', 'inline');
+                       inputEnable('credit_card_input');
+                   }
+           }
+       <!--{/if:pay_by_credit_card}-->
+           
+       }    
+       
+       function clickContactSame() 
+       {
+               x = document.getElementById('contact_same');
+               if (x) {
+                       if( x.checked ) {
+                       hide('contactForm');
+                   } else {
+                       show('contactForm', 'table-row');
+                   }
+               }       
+       }
+
+       function copyContact() 
+       {
+               x = document.getElementById('contact_same');
+               if (x && x.checked) {
+               document.getElementById('contact_fname').value = document.getElementById('fname').value;
+               document.getElementById('contact_lname').value = document.getElementById('lname').value;
+               document.getElementById('contact_addr1').value = document.getElementById('addr1').value;
+               document.getElementById('contact_addr2').value = document.getElementById('addr2').value;
+               document.getElementById('contact_city').value = document.getElementById('city').value;
+               document.getElementById('contact_state').value = document.getElementById('state').value;
+               document.getElementById('contact_country').value = document.getElementById('country').value;
+               document.getElementById('contact_zip').value = document.getElementById('zip').value;
+               document.getElementById('contact_phone').value = document.getElementById('phone').value;
+               document.getElementById('contact_fax').value = document.getElementById('fax').value;
+               }
+       }
+
+       function do_wait()
+       {
+               
+               hide('continueButton'); 
+               show('pleaseWait','inline'); 
+               copyContact();          
+               
+       }
+       
+</script>
+
+<div id="registrations">
+
+  <!--{if:admin_user=YES}-->
+    <div class="adminUser">
+        <b>{word_Registration} being entered by Admin User</b>
+    </div>
+  <!--{/if:admin_user}-->
+    
+    <div id="regPageTopText">
+       <p>{regCheckoutPageText}</p>
+    </div>
+
+    <!--{if:have_members=YES}-->
+       <!--{if:haveUser=YES}-->
+            <b>{customer_long_name} Member logged in</b> - <a href="{base_secure_url}index.php?catid={category_id}{preview}&logout=YES">Log Out</a>
+       <!--{/if:haveUser}-->
+    <!--{/if:have_members}-->       
+
+  <!--{if:have_reason=YES}-->
+        <div class="regWarning">
+            <h3>Your request was not submitted. Please check the following items.</h3>
+            <ul>
+    <!--{list:reason}-->
+                <li>{text}</li>
+    <!--{/list:reason}-->
+            </ul>
+        </div>
+  <!--{/if:have_reason}-->
+
+       <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step1" class="button selectmore"><span>Select More</span></a>
+<!--{if:display_only_mode=NO}-->
+  <!--{if:haveCart=YES}-->
+       <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step4" class="button showcart"><span>View Cart</span></a>
+  <!--{/if:haveCart}-->
+<!--{/if:display_only_mode}-->  
+
+    <form action="{base_secure_url}index.php?catid={category_id}{preview}" name="step3" method="post">
+        <input type="hidden" name="Action" value="{next_step}">
+        <input type="hidden" name="checkoutPage" value="YES">
+        {form_data}
+
+       <!--{if:haveUser=YES}-->
+               <hr>
+               <p>
+                       <b>Current Registered User:&nbsp;&nbsp;</b>{userFname}&nbsp;{userLname}&nbsp;&nbsp;&nbsp;&nbsp;<a href="{base_secure_url}index.php?catid={category_id}{preview}&logout=YES">(not me or log me out)</a>  
+                       <!--{if:userIsMember=YES}--><br>(A {customer_long_name} member)<!--{/if:userIsMember}-->                
+               </p>
+       <!--{/if:haveUser}-->
+
+               <div class="regItem">
+                       <div class="regCharges">
+                               <h3>{word_Event} Summary</h3>
+                               <hr>
+                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+       <!--{list:shoppingCart}-->
+                                       <tr style="background-color: #eee;">
+                                               <td class="tdCartLeft" colspan="3" style="padding: 0 10px 0 10px;">
+               <!--{if:date_specific=YES}-->
+                                                       <p style="float: right;">{start_date} through {end_date}</p>
+               <!--{else:date_specific}
+                       <!--{if:ask_date=YES}-->                                        
+                                                       <p style="float: right;" >Desired Date: {desired_date}</p>
+                       <!--{/if:ask_date}-->
+               {/if:date_specific}-->
+                                                       <h3 >{event_name}</h3>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <th class="thCartLeft">Charges</th>
+                                               <th class="thCartRight" style="width: 100px;"><!--{if:need_attendees=YES}-->Per {word_Attendee}<!--{else:need_attendees}&nbsp;{/if:need_attendees}--></th>
+                                               <th class="thCartRight" style="width: 80px;">Total</th>
+                                       </tr>
+                         <!--{list:charges}-->
+                           <tr>
+                               <td class="tdCartLeft">{charge_title}</td>
+                               <td class="tdCartRight">{charge}</td>
+                               <td class="thCartRight">{extend}</td>
+                       </tr>
+                         <!--{sep:charges}-->
+                         <!--{/sep:charges}-->
+                           <tr>
+                               <td class="tdCartLeft">{charge_title}</td>
+                               <td class="tdCartRight">{charge}</td>
+                               <td class="thCartRight">{extend}</td>
+                       </tr>
+                         <!--{/list:charges}-->
+                           <tr>
+                               <th class="thCartRight" colspan="2">Sub Total</th>
+                               <td class="thCartRight">{totalCharges}</td>
+                       </tr>
+      <!--{if:have_attendees=YES}-->
+                           <tr>
+                           <tr><td class="tdCartLeft" colspan="3">&nbsp;</td></tr>
+                             <td colspan="3">
+                                 <table border="0" cellspacing="0" cellpadding="0" width="100%">
+        <!--{if:med_info=YES}-->
+                                   <tr>
+                                     <td width="20px">&nbsp;</td><th>{word_Attendee}</th>
+                              <th colspan="4">Required emergency contact and medical information.</th>
+                            </tr>                
+          <!--{list:attendees}-->
+                            <tr>
+                                <td>&nbsp;</td><td colspan="5">{name}</td>    
+                            </tr>
+                            <tr>                  
+                                <td colspan="2">&nbsp;</td>
+                                <td class="regRequired">Date of Birth: </td><td><input type="text" name="att_{cart_id}_{attendee_id}_dob" value="{dob}"></td>
+                                <td>Parent/Guardian: </td><td><input type="text" name="att_{cart_id}_{attendee_id}_guardian" value="{guardian}"></td>
+                            </tr>
+                            <tr>
+                                <td colspan="2">&nbsp;</td>
+                                <td class="regRequired">Emergency Contact: </td><td><input type="text" name="att_{cart_id}_{attendee_id}_emer_contact" value="{emer_contact}"></td>
+                                <td class="regRequired">Emergency Phone: </td><td><input type="text" name="att_{cart_id}_{attendee_id}_emer_phone" value="{emer_phone}"></td>
+                            </tr>
+                                <td colspan="2">&nbsp;</td>
+                                <td>Brief Medical History: </td><td colspan="3"><input type="text" name="att_{cart_id}_{attendee_id}_med_history" value="{med_history}" style="width: 400px;"></td>
+                            </tr>
+                                <td colspan="2">&nbsp;</td>
+                                <td>Alergies/Medications: </td><td colspan="3"><input type="text" name="att_{cart_id}_{attendee_id}_allergy_med" value="{allergy_med}" style="width: 400px;"></td>
+                            </tr>               
+          <!--{/list:attendees}-->                               
+        <!--{else:med_info}
+          <!--{if:need_attendees=YES}-->
+                            <tr>
+                              <td width="20px">&nbsp;</td><th>{word_Attendees}: </th>
+                              <td align="left">
+               <!--{list:attendees}-->
+                                {name}<!--{sep:attendees}-->, <!--{/sep:attendees}-->
+                                {name}
+               <!--{/list:attendees}-->
+                              </td>
+                            </tr>
+          <!--{/if:need_attendees}-->
+        {/if:med_info}-->
+                                 </table>
+                             </td>
+                           </tr>
+      <!--{/if:have_attendees}-->
+      <!--{if:haveTerms=YES}-->
+                    <tr>
+                       <td class="tdCartLeft" colspan="3">&nbsp;</td>
+                       </tr>
+                           <tr>
+                               <td class="tdCartLeft" colspan="3"><b>Additional terms/conditions:</b> {terms}</td>
+                       </tr>
+      <!--{/if:haveTerms}--> 
+                               <tr><td colspan="2">&nbsp;</td></tr>                   
+       <!--{/list:shoppingCart}-->
+                                       <tr>
+                                               <th class="thCartRight" colspan="2">Grand Total:</th>
+                                               <th class="thCartRight">{grandTotal}</th>
+                                       </tr>
+                               </table>
+                       </div>
+               </div>
+               <hr>
+               <p class="regRequired">Fields in red are required.</p>
+
+                 <table border="0" cellspacing="0" cellpadding="0" width="100%">
+       <!--{if:use_full_billing_at_top=YES}-->                                 
+                                       <tr>
+                                               <td colspan="2">
+                               <!--{if:noCharges=YES}-->
+                                                       <h3>Contact Information:</h3>
+                               <!--{else:noCharges}
+                                                       <h3>Billing Information:</h3>
+                               {/if:noCharges}--> 
+                                               </td>
+                                       </tr>
+                    <tr>
+                       <td valign="top">
+                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                               <!--{if:show_free_fname=YES}-->
+                                           <TR><TD class="regRequired" width="110px">First Name:</TD><TD class="textInput"><INPUT id="fname" TYPE="text" NAME="fname" VALUE="{fname}" class="inputMedium"></TD></TR>
+                               <!--{/if:show_free_fname}-->
+                               <!--{if:show_free_lname=YES}-->
+                                           <TR><TD class="regRequired">Last Name:</TD><TD class="textInput"><INPUT id="lname" TYPE="text" NAME="lname" VALUE="{lname}" class="inputMedium"></TD></TR>
+                               <!--{/if:show_free_lname}-->
+                               <!--{if:show_free_addr1=YES}-->
+                                           <TR><TD class="regRequired">Address:</TD><TD class="textInput"><INPUT id="addr1" TYPE="text" NAME="addr1" VALUE="{addr1}" class="inputMedium"></TD></TR>
+                               <!--{/if:show_free_addr1}-->
+                               <!--{if:show_free_addr2=YES}-->
+                                           <TR><TD class="regFieldName">&nbsp;</TD><TD class="textInput"><INPUT id="addr2" TYPE="text" NAME="addr2" VALUE="{addr2}" class="inputMedium"></TD></TR>
+                               <!--{/if:show_free_addr2}-->
+                               <!--{if:show_free_city=YES}-->
+                                           <TR><TD class="regRequired">City:</TD><TD class="textInput"><INPUT id="city" TYPE="text" NAME="city" VALUE="{city}" class="inputMedium"></TD></TR>
+                               <!--{/if:show_free_city}-->
+                               <!--{if:show_free_state=YES}-->
+                                           <TR><TD class="regRequired">State/Prov.:</TD><TD>{state}</TD></TR>
+                               <!--{/if:show_free_state}-->
+                               <!--{if:show_free_country=YES}-->
+                                           <TR><TD class="regRequired">Country:</TD><TD>{country}</TD></TR>
+                               <!--{/if:show_free_country}-->
+                               <!--{if:show_free_zip=YES}-->
+                                           <TR><TD class="regRequired">ZIP/Postal Code:</TD><TD class="textInput"><INPUT id="zip" TYPE="text" NAME="zip" SIZE="10" VALUE="{zip}"></TD></TR>
+                               <!--{/if:show_free_zip}-->
+                                       </table>
+                               </td>
+                               <td valign="top">
+                                       <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                               <!--{if:show_free_phone=YES}-->
+                                       <TR><TD class="regRequired">Phone:</TD><TD class="textInput"><INPUT id="phone" TYPE="text" NAME="phone" VALUE="{phone}"></TD></TR>
+                               <!--{/if:show_free_phone}-->
+                               <!--{if:show_free_fax=YES}-->
+                                       <TR><TD class="regFieldName">FAX:</TD><TD class="textInput"><INPUT id="fax" TYPE="text" NAME="fax" VALUE="{fax}"></TD></TR>
+                               <!--{/if:show_free_fax}-->
+                                   </table>
+                           </td>
+                    </tr>
+  <!--{/if:use_full_billing_at_top}-->                                 
+  <!--{if:show_contact_data=YES}-->
+                                       <tr>                                    
+                                               <td colspan="2">
+                                                       <h3>{contact_information_title}:<h3>
+                                               </td>
+                                       </tr>
+       <!--{if:show_same_button=YES}-->
+                                       <tr>
+                                               <td>
+                                                       <h3>Same as above:</h3> <input type="checkbox" name="contact_same" id="contact_same" onClick="clickContactSame();" {contact_same}> Same as billing information
+                                               </td>
+                                       </tr>
+       <!--{/if:show_same_button}-->
+                    <tr id="contactForm">
+                       <td valign="top">
+                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                           <!--{if:use_contact_fname=YES}-->
+                                               <tr>
+                                                       <!--{if:required_contact_fname=YES}--><TD class="regRequired .nowrap" width="110px"><!--{else:required_contact_fname}<TD class="regFieldName .nowrap">{/if:required_contact_fname}-->
+                                                               {prompt_contact_fname}:
+                                                       </TD>
+                                                       <TD class="textInput" align="left"><INPUT id="contact_fname" TYPE="text" NAME="contact_fname" VALUE="{contact_fname}" class="inputMedium"></TD>
+                                               </TR>
+                                           <!--{/if:use_contact_fname}-->
+                                           <!--{if:use_contact_lname=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_lname=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_lname}<TD class="regFieldName .nowrap">{/if:required_contact_lname}-->
+                                                               {prompt_contact_lname}:
+                                                       </TD>
+                                                       <TD class="textInput"><INPUT id="contact_lname" TYPE="text" NAME="contact_lname" VALUE="{contact_lname}" class="inputMedium"></TD>
+                                               </TR>
+                                           <!--{/if:use_contact_lname}-->
+                                           <!--{if:use_contact_addr1=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_addr1=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_addr1}<TD class="regFieldName .nowrap">{/if:required_contact_addr1}-->
+                                                               {prompt_contact_addr1}:
+                                                       </TD>
+                                                       <TD class="textInput"><INPUT id="contact_addr1" TYPE="text" NAME="contact_addr1" VALUE="{contact_addr1}" class="inputMedium"></TD>
+                                               </TR>
+                                           <!--{/if:use_contact_addr1}-->
+                                           <!--{if:use_contact_addr2=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_addr2=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_addr2}<TD class="regFieldName .nowrap">{/if:required_contact_addr2}-->
+                                                               {prompt_contact_addr2}:
+                                                       </TD>
+                                                       <TD class="textInput"><INPUT id="contact_addr2" TYPE="text" NAME="contact_addr2" VALUE="{contact_addr2}" class="inputMedium"></TD>
+                                               </TR>
+                                           <!--{/if:use_contact_addr2}-->
+                                           <!--{if:use_contact_city=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_city=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_city}<TD class="regFieldName .nowrap">{/if:required_contact_city}-->
+                                                               {prompt_contact_city}:
+                                                       </TD>
+                                                       <TD class="textInput"><INPUT id="contact_city" TYPE="text" NAME="contact_city" VALUE="{contact_city}" class="inputMedium"></TD>
+                                               </TR>
+                                           <!--{/if:use_contact_city}-->
+                                           <!--{if:use_contact_state=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_state=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_state}<TD class="regFieldName .nowrap">{/if:required_contact_state}-->
+                                                               {prompt_contact_state}:
+                                                       </TD>
+                                                       <TD>{contact_state}</TD>
+                                               </TR>
+                                           <!--{/if:use_contact_state}-->
+                                           <!--{if:use_contact_zip=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_zip=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_zip}<TD class="regFieldName .nowrap">{/if:required_contact_zip}-->
+                                                               {prompt_contact_zip}:
+                                                       </TD>
+                                                       <TD class="textInput"><INPUT id="contact_zip" TYPE="text" NAME="contact_zip" SIZE="10" VALUE="{contact_zip}"></TD>
+                                               </TR>
+                                           <!--{/if:use_contact_zip}-->
+                                           <!--{if:use_contact_country=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_country=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_country}<TD class="regFieldName .nowrap">{/if:required_contact_country}-->
+                                                               {prompt_contact_country}:
+                                                       </TD>
+                                                       <TD>{contact_country}</TD>
+                                               </TR>
+                                           <!--{/if:use_contact_country}-->
+                                           <!--{if:use_contact_phone=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_phone=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_phone}<TD class="regFieldName .nowrap">{/if:required_contact_phone}-->
+                                                               {prompt_contact_phone}:
+                                                       </TD>
+                                                       <TD class="textInput"><INPUT id="contact_phone" TYPE="text" NAME="contact_phone" VALUE="{contact_phone}"></TD>
+                                               </TR>
+                                                   <!--{/if:use_contact_phone}-->
+                                                   <!--{if:use_contact_fax=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_fax=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_fax}<TD class="regFieldName .nowrap">{/if:required_contact_fax}-->
+                                                               {prompt_contact_fax}:</TD>
+                                                       <TD class="textInput"><INPUT id="contact_fax" TYPE="text" NAME="contact_fax" VALUE="{contact_fax}"></TD>
+                                               </TR>
+                                           <!--{/if:use_contact_fax}-->
+                                   </table>
+                           </td>
+                                       </tr>
+  <!--{/if:show_contact_data}-->
+                       <!--{if:haveUser=NO}-->
+                                       <tr>
+                                               <td class="regFieldName" valign="top" colspan="2">
+                       <!--{if:have_registered_users=YES}-->
+                                                       <h3>Returning User Login Information:</h3>
+                       <!--{else:have_registered_users}
+                                                       <h3>E-Mail Address:</h3>
+                       {/if:have_registered_users}-->                          
+                                                       <p>
+                                                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                                                       <tr><td class="regRequired" valign="top" width="110px">E-Mail Address: </td><td><input id="email" type="text" name="email" value="{email}" class="inputLarge"></td></tr>
+                       <!--{if:have_registered_users=YES}-->
+                                                                       <tr><td class="regRequired" valign="top">{word_Password}:</td><td><input type="text" name="login_password" value="{login_password}" class="inputStandard"></td></tr>
+                                                                       <tr><td colspan="2">Retain this {word_password} for future {word_registrations}. {password_msg}</td></tr>
+                       <!--{else:have_registered_users}
+                                                                       <tr><td><input type="hidden" name="login_password" value="{login_password}"> </td></tr>
+                       {/if:have_registered_users}-->
+                       
+                                                                                               
+                                                               </table>
+                                                       </p>
+                                               </td>
+                                       </tr>
+                       <!--{/if:haveUser}-->
+                 </table>
+
+               <p><hr></p>
+              
+     <!--{if:noCharges=NO}-->
+
+     <!--{if:one_payment_type_available=No}-->
+               <h3 style="color: red;">Select payment method:</h3>
+     <!--{/if:one_payment_type_available}-->
+     
+
+       <!--{if:pay_by_comp_code=No}--> 
+       <!--{else:pay_by_comp_code}
+         <!--{if:pay_by_comp_code_restrict=YES}-->
+               <div class="lightBorder">
+            For Admin Users Only:
+         <!--{else:pay_by_comp_code_restrict}
+               <div>
+         {/if:pay_by_comp_code_restrict}-->
+                       <h3>                
+            <!--{if:one_payment_type_available=Yes}-->
+                <input type="radio" name="payment_type" value="comp_code" onClick="reset_hide();" id="comp_code_button" CHECKED>
+            <!--{else:one_payment_type_available}
+                       <!--{if:payment_type=comp_code}--> 
+                               <input type="radio" name="payment_type" value="comp_code" onClick="reset_hide();" id="comp_code_button" CHECKED>
+                       <!--{else:payment_type} 
+                               <input type="radio" name="payment_type" value="comp_code" onClick="reset_hide();" id="comp_code_button">
+                       {/if:payment_type}--> 
+            {/if:one_payment_type_available}-->
+                       {title_use_payment_comp_code}
+                       </h3>
+                       <div id="comp_code_input">
+               <!--{if:comp_code_fields_used=YES}-->
+                               <p>Please provide the following information:</p>
+                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                           <tr>
+                               <td valign="top">
+                                       <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <!--{if:comp_code_field_fname=YES}-->
+                                                   <TR><TD class="regRequired" width="110px">First Name:</TD><TD class="textInput"><INPUT id="fname" TYPE="text" NAME="fname" VALUE="{fname}" class="inputMedium"></TD></TR>
+                                       <!--{/if:comp_code_field_fname}-->
+                                       <!--{if:comp_code_field_lname=YES}-->
+                                                   <TR><TD class="regRequired">Last Name:</TD><TD class="textInput"><INPUT id="lname" TYPE="text" NAME="lname" VALUE="{lname}" class="inputMedium"></TD></TR>
+                                       <!--{/if:comp_code_field_lname}-->
+                                       <!--{if:comp_code_field_addr1=YES}-->
+                                                   <TR><TD class="regRequired">Address:</TD><TD class="textInput"><INPUT id="addr1" TYPE="text" NAME="addr1" VALUE="{addr1}" class="inputMedium"></TD></TR>
+                                       <!--{/if:comp_code_field_addr1}-->
+                                       <!--{if:comp_code_field_addr2=YES}-->
+                                                   <TR><TD class="regFieldName">&nbsp;</TD><TD class="textInput"><INPUT id="addr2" TYPE="text" NAME="addr2" VALUE="{addr2}" class="inputMedium"></TD></TR>
+                                       <!--{/if:comp_code_field_addr2}-->
+                                       <!--{if:comp_code_field_city=YES}-->
+                                                   <TR><TD class="regRequired">City:</TD><TD class="textInput"><INPUT id="city" TYPE="text" NAME="city" VALUE="{city}" class="inputMedium"></TD></TR>
+                                       <!--{/if:comp_code_field_city}-->
+                                       <!--{if:comp_code_field_state=YES}-->
+                                                   <TR><TD class="regRequired">State/Prov.:</TD><TD>{state}</TD></TR>
+                                       <!--{/if:comp_code_field_state}-->
+                                       <!--{if:comp_code_field_country=YES}-->
+                                                   <TR><TD class="regRequired">Country:</TD><TD>{country}</TD></TR>
+                                       <!--{/if:comp_code_field_country}-->
+                                       <!--{if:comp_code_field_zip=YES}-->
+                                                   <TR><TD class="regRequired">ZIP/Postal Code:</TD><TD class="textInput"><INPUT id="zip" TYPE="text" NAME="zip" SIZE="10" VALUE="{zip}"></TD></TR>
+                                       <!--{/if:comp_code_field_zip}-->
+                                               </table>
+                                       </td>
+                                       <td valign="top">
+                                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <!--{if:comp_code_field_phone=YES}-->
+                                               <TR><TD class="regRequired">Phone:</TD><TD class="textInput"><INPUT id="phone" TYPE="text" NAME="phone" VALUE="{phone}"></TD></TR>
+                                       <!--{/if:comp_code_field_phone}-->
+                                       <!--{if:comp_code_field_fax=YES}-->
+                                               <TR><TD class="regFieldName">FAX:</TD><TD class="textInput"><INPUT id="fax" TYPE="text" NAME="fax" VALUE="{fax}"></TD></TR>
+                                       <!--{/if:comp_code_field_fax}-->
+                                           </table>
+                                   </td>
+                           </tr>
+                               </table>
+               <!--{/if:comp_code_fields_used}-->
+                               <p class="regFieldName">{title_payment_comp_code}: <INPUT TYPE="text" NAME="pay_code" VALUE="{pay_code}" style="width: 50px;"></p>
+                       </div>
+               </div>
+       {/if:pay_by_comp_code}-->
+
+       <!--{if:pay_by_check=No}-->
+       <!--{else:pay_by_check}
+         <!--{if:pay_by_check_restrict=YES}-->
+               <div class="lightBorder">
+            For Admin Users Only:
+         <!--{else:pay_by_check_restrict}
+               <div>
+         {/if:pay_by_check_restrict}-->
+               <h3>
+            <!--{if:one_payment_type_available=Yes}-->
+                <input type="radio" name="payment_type" value="by_check" onClick="reset_hide();" id="check_button" CHECKED>
+            <!--{else:one_payment_type_available}
+                       <!--{if:payment_type=by_check}-->
+                               <input type="radio" name="payment_type" value="by_check" onClick="reset_hide();" id="check_button" CHECKED>
+                   <!--{else:payment_type}
+                               <input type="radio" name="payment_type" value="by_check" onClick="reset_hide();" id="check_button">
+                   {/if:payment_type}-->
+            {/if:one_payment_type_available}-->
+            
+                   {title_send_a_check}
+                       </h3> 
+            <div id="check_input">
+               <!--{if:check_fields_used=YES}-->
+                               <p>Please provide the following information:</p>
+                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                           <tr>
+                               <td valign="top">
+                                       <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <!--{if:check_field_fname=YES}-->
+                                                   <TR><TD class="regRequired" width="110px">First Name:</TD><TD class="textInput"><INPUT id="fname" TYPE="text" NAME="fname" VALUE="{fname}" class="inputMedium"></TD></TR>
+                                       <!--{/if:check_field_fname}-->
+                                       <!--{if:check_field_lname=YES}-->
+                                                   <TR><TD class="regRequired">Last Name:</TD><TD class="textInput"><INPUT id="lname" TYPE="text" NAME="lname" VALUE="{lname}" class="inputMedium"></TD></TR>
+                                       <!--{/if:check_field_lname}-->
+                                       <!--{if:check_field_addr1=YES}-->
+                                                   <TR><TD class="regRequired">Address:</TD><TD class="textInput"><INPUT id="addr1" TYPE="text" NAME="addr1" VALUE="{addr1}" class="inputMedium"></TD></TR>
+                                       <!--{/if:check_field_addr1}-->
+                                       <!--{if:check_field_addr2=YES}-->
+                                                   <TR><TD class="regFieldName">&nbsp;</TD><TD class="textInput"><INPUT id="addr2" TYPE="text" NAME="addr2" VALUE="{addr2}" class="inputMedium"></TD></TR>
+                                       <!--{/if:check_field_addr2}-->
+                                       <!--{if:check_field_city=YES}-->
+                                                   <TR><TD class="regRequired">City:</TD><TD class="textInput"><INPUT id="city" TYPE="text" NAME="city" VALUE="{city}" class="inputMedium"></TD></TR>
+                                       <!--{/if:check_field_city}-->
+                                       <!--{if:check_field_state=YES}-->
+                                                   <TR><TD class="regRequired">State/Prov.:</TD><TD>{state}</TD></TR>
+                                       <!--{/if:check_field_state}-->
+                                       <!--{if:check_field_country=YES}-->
+                                                   <TR><TD class="regRequired">Country:</TD><TD>{country}</TD></TR>
+                                       <!--{/if:check_field_country}-->
+                                       <!--{if:check_field_zip=YES}-->
+                                                   <TR><TD class="regRequired">ZIP/Postal Code:</TD><TD class="textInput"><INPUT id="zip" TYPE="text" NAME="zip" SIZE="10" VALUE="{zip}"></TD></TR>
+                                       <!--{/if:check_field_zip}-->
+                                               </table>
+                                       </td>
+                                       <td valign="top">
+                                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <!--{if:check_field_phone=YES}-->
+                                               <TR><TD class="regRequired">Phone:</TD><TD class="textInput"><INPUT id="phone" TYPE="text" NAME="phone" VALUE="{phone}"></TD></TR>
+                                       <!--{/if:check_field_phone}-->
+                                       <!--{if:check_field_fax=YES}-->
+                                               <TR><TD class="regFieldName">FAX:</TD><TD class="textInput"><INPUT id="fax" TYPE="text" NAME="fax" VALUE="{fax}"></TD></TR>
+                                       <!--{/if:check_field_fax}-->
+                                           </table>
+                                   </td>
+                           </tr>
+                               </table>
+               <!--{/if:check_fields_used}-->
+            </div>
+               </div>
+       {/if:pay_by_check}-->
+
+    <!--{if:pay_by_call_from_merchant=No}-->
+    <!--{else:pay_by_call_from_merchant}
+      <!--{if:pay_by_call_from_merchant_restrict=YES}-->
+        <div class="lightBorder">
+            For Admin Users Only:
+      <!--{else:pay_by_call_from_merchant_restrict}
+        <div>
+      {/if:pay_by_call_from_merchant_restrict}-->
+            <h3>
+            <!--{if:one_payment_type_available=Yes}-->
+                <input type="radio" name="payment_type" value="call_from_merchant" onClick="reset_hide();" id="call_from_merchant_button" CHECKED>
+            <!--{else:one_payment_type_available}
+              <!--{if:payment_type=call_from_merchant}-->
+                <input type="radio" name="payment_type" value="call_from_merchant" onClick="reset_hide();" id="call_from_merchant_button" CHECKED>
+              <!--{else:payment_type}
+                <input type="radio" name="payment_type" value="call_from_merchant" onClick="reset_hide();" id="call_from_merchant_button">
+              {/if:payment_type}-->
+            {/if:one_payment_type_available}-->
+            {title_call_from_merchant}
+            </h3>
+            <div id="call_from_merchant_input">
+        <!--{if:call_from_merchant_fields_used=YES}-->
+                <p>Please provide the following information:</p>
+                <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                        <tr>
+                            <td valign="top">
+                                <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                <!--{if:call_from_merchant_field_fname=YES}-->
+                                    <TR><TD class="regRequired" width="110px">First Name:</TD><TD class="textInput"><INPUT id="fname" TYPE="text" NAME="fname" VALUE="{fname}" class="inputMedium"></TD></TR>
+                                <!--{/if:call_from_merchant_field_fname}-->
+                                <!--{if:call_from_merchant_field_lname=YES}-->
+                                    <TR><TD class="regRequired">Last Name:</TD><TD class="textInput"><INPUT id="lname" TYPE="text" NAME="lname" VALUE="{lname}" class="inputMedium"></TD></TR>
+                                <!--{/if:call_from_merchant_field_lname}-->
+                                <!--{if:call_from_merchant_field_addr1=YES}-->
+                                    <TR><TD class="regRequired">Address:</TD><TD class="textInput"><INPUT id="addr1" TYPE="text" NAME="addr1" VALUE="{addr1}" class="inputMedium"></TD></TR>
+                                <!--{/if:call_from_merchant_field_addr1}-->
+                                <!--{if:call_from_merchant_field_addr2=YES}-->
+                                    <TR><TD class="regFieldName">&nbsp;</TD><TD class="textInput"><INPUT id="addr2" TYPE="text" NAME="addr2" VALUE="{addr2}" class="inputMedium"></TD></TR>
+                                <!--{/if:call_from_merchant_field_addr2}-->
+                                <!--{if:call_from_merchant_field_city=YES}-->
+                                    <TR><TD class="regRequired">City:</TD><TD class="textInput"><INPUT id="city" TYPE="text" NAME="city" VALUE="{city}" class="inputMedium"></TD></TR>
+                                <!--{/if:call_from_merchant_field_city}-->
+                                <!--{if:call_from_merchant_field_state=YES}-->
+                                    <TR><TD class="regRequired">State/Prov.:</TD><TD>{state}</TD></TR>
+                                <!--{/if:call_from_merchant_field_state}-->
+                                <!--{if:call_from_merchant_field_country=YES}-->
+                                    <TR><TD class="regRequired">Country:</TD><TD>{country}</TD></TR>
+                                <!--{/if:call_from_merchant_field_country}-->
+                                <!--{if:call_from_merchant_field_zip=YES}-->
+                                    <TR><TD class="regRequired">ZIP/Postal Code:</TD><TD class="textInput"><INPUT id="zip" TYPE="text" NAME="zip" SIZE="10" VALUE="{zip}"></TD></TR>
+                                <!--{/if:call_from_merchant_field_zip}-->
+                                </table>
+                            </td>
+                            <td valign="top">
+                                <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                <!--{if:call_from_merchant_field_phone=YES}-->
+                                    <TR><TD class="regRequired">Phone:</TD><TD class="textInput"><INPUT id="phone" TYPE="text" NAME="phone" VALUE="{phone}"></TD></TR>
+                                <!--{/if:call_from_merchant_field_phone}-->
+                                <!--{if:call_from_merchant_field_fax=YES}-->
+                                    <TR><TD class="regFieldName">FAX:</TD><TD class="textInput"><INPUT id="fax" TYPE="text" NAME="fax" VALUE="{fax}"></TD></TR>
+                                <!--{/if:call_from_merchant_field_fax}-->
+                                </table>
+                            </td>
+                        </tr>
+                </table>
+        <!--{/if:call_from_merchant_fields_used}-->
+            </div>
+        </div>
+
+    {/if:pay_by_call_from_merchant}-->
+
+
+       <!--{if:pay_by_cash=No}-->
+       <!--{else:pay_by_cash}
+         <!--{if:pay_by_cash_restrict=YES}-->
+               <div class="lightBorder">
+            For Admin Users Only:
+         <!--{else:pay_by_cash_restrict}
+               <div>
+         {/if:pay_by_cash_restrict}-->
+               <h3>
+            <!--{if:one_payment_type_available=Yes}--> 
+                <input type="radio" name="payment_type" value="cash" onClick="reset_hide();" id="cash_button" CHECKED>
+            <!--{else:one_payment_type_available}
+            <!--{if:payment_type=cash}-->
+                <input type="radio" name="payment_type" value="cash" onClick="reset_hide();" id="cash_button" CHECKED>
+            <!--{else:payment_type} 
+                <input type="radio" name="payment_type" value="cash" onClick="reset_hide();" id="cash_button">
+            {/if:payment_type}--> 
+            {/if:one_payment_type_available}--> 
+                {title_paid_cash}
+            </h3>
+            <div id="cash_input">
+               <!--{if:cash_fields_used=YES}-->
+                               <p>Please provide the following information:</p>
+                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                           <tr>
+                               <td valign="top">
+                                       <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <!--{if:cash_field_fname=YES}-->
+                                                   <TR><TD class="regRequired" width="110px">First Name:</TD><TD class="textInput"><INPUT id="fname" TYPE="text" NAME="fname" VALUE="{fname}" class="inputMedium"></TD></TR>
+                                       <!--{/if:cash_field_fname}-->
+                                       <!--{if:cash_field_lname=YES}-->
+                                                   <TR><TD class="regRequired">Last Name:</TD><TD class="textInput"><INPUT id="lname" TYPE="text" NAME="lname" VALUE="{lname}" class="inputMedium"></TD></TR>
+                                       <!--{/if:cash_field_lname}-->
+                                       <!--{if:cash_field_addr1=YES}-->
+                                                   <TR><TD class="regRequired">Address:</TD><TD class="textInput"><INPUT id="addr1" TYPE="text" NAME="addr1" VALUE="{addr1}" class="inputMedium"></TD></TR>
+                                       <!--{/if:cash_field_addr1}-->
+                                       <!--{if:cash_field_addr2=YES}-->
+                                                   <TR><TD class="regFieldName">&nbsp;</TD><TD class="textInput"><INPUT id="addr2" TYPE="text" NAME="addr2" VALUE="{addr2}" class="inputMedium"></TD></TR>
+                                       <!--{/if:cash_field_addr2}-->
+                                       <!--{if:cash_field_city=YES}-->
+                                                   <TR><TD class="regRequired">City:</TD><TD class="textInput"><INPUT id="city" TYPE="text" NAME="city" VALUE="{city}" class="inputMedium"></TD></TR>
+                                       <!--{/if:cash_field_city}-->
+                                       <!--{if:cash_field_state=YES}-->
+                                                   <TR><TD class="regRequired">State/Prov.:</TD><TD>{state}</TD></TR>
+                                       <!--{/if:cash_field_state}-->
+                                       <!--{if:cash_field_country=YES}-->
+                                                   <TR><TD class="regRequired">Country:</TD><TD>{country}</TD></TR>
+                                       <!--{/if:cash_field_country}-->
+                                       <!--{if:cash_field_zip=YES}-->
+                                                   <TR><TD class="regRequired">ZIP/Postal Code:</TD><TD class="textInput"><INPUT id="zip" TYPE="text" NAME="zip" SIZE="10" VALUE="{zip}"></TD></TR>
+                                       <!--{/if:cash_field_zip}-->
+                                               </table>
+                                       </td>
+                                       <td valign="top">
+                                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <!--{if:cash_field_phone=YES}-->
+                                               <TR><TD class="regRequired">Phone:</TD><TD class="textInput"><INPUT id="phone" TYPE="text" NAME="phone" VALUE="{phone}"></TD></TR>
+                                       <!--{/if:cash_field_phone}-->
+                                       <!--{if:cash_field_fax=YES}-->
+                                               <TR><TD class="regFieldName">FAX:</TD><TD class="textInput"><INPUT id="fax" TYPE="text" NAME="fax" VALUE="{fax}"></TD></TR>
+                                       <!--{/if:cash_field_fax}-->
+                                           </table>
+                                   </td>
+                           </tr>
+                               </table>
+               <!--{/if:cash_fields_used}-->
+            </div>
+               </div>
+       {/if:pay_by_cash}-->
+       
+       <!--{if:pay_by_credit_card=No}-->
+       <!--{else:pay_by_credit_card}
+         <!--{if:pay_by_credit_card_restrict=YES}-->
+               <div class="lightBorder">
+            For Admin Users Only:
+         <!--{else:pay_by_credit_card_restrict}
+               <div>
+         {/if:pay_by_credit_card_restrict}-->
+               <h3>
+               <!--{if:one_payment_type_available=Yes}-->
+                <input type="radio" name="payment_type" value="credit_card" onClick="reset_hide();" id="credit_card_button" CHECKED>
+            <!--{else:one_payment_type_available}
+               <!--{if:payment_type=credit_card}--> 
+                   <input type="radio" name="payment_type" value="credit_card" onClick="reset_hide();" id="credit_card_button" CHECKED>
+               <!--{else:payment_type} 
+                   <input type="radio" name="payment_type" value="credit_card" onClick="reset_hide();" id="credit_card_button">
+               {/if:payment_type}--> 
+            {/if:one_payment_type_available}--> 
+                   {title_pay_by_credit_card}
+               </h3>
+                       <div id="credit_card_input">
+               <!--{if:credit_card_fields_used=YES}-->
+                               <p>Please provide the following information:</p>
+                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                           <tr>
+                               <td valign="top">
+                                       <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <!--{if:credit_card_field_fname=YES}-->
+                                                   <TR><TD class="regRequired" width="110px">First Name:</TD><TD class="textInput"><INPUT id="fname" TYPE="text" NAME="fname" VALUE="{fname}" class="inputMedium"></TD></TR>
+                                       <!--{/if:credit_card_field_fname}-->
+                                       <!--{if:credit_card_field_lname=YES}-->
+                                                   <TR><TD class="regRequired">Last Name:</TD><TD class="textInput"><INPUT id="lname" TYPE="text" NAME="lname" VALUE="{lname}" class="inputMedium"></TD></TR>
+                                       <!--{/if:credit_card_field_lname}-->
+                                       <!--{if:credit_card_field_addr1=YES}-->
+                                                   <TR><TD class="regRequired">Address:</TD><TD class="textInput"><INPUT id="addr1" TYPE="text" NAME="addr1" VALUE="{addr1}" class="inputMedium"></TD></TR>
+                                       <!--{/if:credit_card_field_addr1}-->
+                                       <!--{if:credit_card_field_addr2=YES}-->
+                                                   <TR><TD class="regFieldName">&nbsp;</TD><TD class="textInput"><INPUT id="addr2" TYPE="text" NAME="addr2" VALUE="{addr2}" class="inputMedium"></TD></TR>
+                                       <!--{/if:credit_card_field_addr2}-->
+                                       <!--{if:credit_card_field_city=YES}-->
+                                                   <TR><TD class="regRequired">City:</TD><TD class="textInput"><INPUT id="city" TYPE="text" NAME="city" VALUE="{city}" class="inputMedium"></TD></TR>
+                                       <!--{/if:credit_card_field_city}-->
+                                       <!--{if:credit_card_field_state=YES}-->
+                                                   <TR><TD class="regRequired">State/Prov.:</TD><TD>{state}</TD></TR>
+                                       <!--{/if:credit_card_field_state}-->
+                                       <!--{if:credit_card_field_country=YES}-->
+                                                   <TR><TD class="regRequired">Country:</TD><TD>{country}</TD></TR>
+                                       <!--{/if:credit_card_field_country}-->
+                                       <!--{if:credit_card_field_zip=YES}-->
+                                                   <TR><TD class="regRequired">ZIP/Postal Code:</TD><TD class="textInput"><INPUT id="zip" TYPE="text" NAME="zip" SIZE="10" VALUE="{zip}"></TD></TR>
+                                       <!--{/if:credit_card_field_zip}-->
+                                               </table>
+                                       </td>
+                                       <td valign="top">
+                                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <!--{if:credit_card_field_phone=YES}-->
+                                               <TR><TD class="regRequired">Phone:</TD><TD class="textInput"><INPUT id="phone" TYPE="text" NAME="phone" VALUE="{phone}"></TD></TR>
+                                       <!--{/if:credit_card_field_phone}-->
+                                       <!--{if:credit_card_field_fax=YES}-->
+                                               <TR><TD class="regFieldName">FAX:</TD><TD class="textInput"><INPUT id="fax" TYPE="text" NAME="fax" VALUE="{fax}"></TD></TR>
+                                       <!--{/if:credit_card_field_fax}-->
+                                           </table>
+                                   </td>
+                           </tr>
+                               </table>
+               <!--{/if:credit_card_fields_used}-->
+                               <p>The fees totaled above will be charged to your credit card once this form is submitted</p>                                                                                                   
+                               <table border="0" cellspacing="0" cellpadding="0">
+                                       <TR><TD class="regRequired" width="110px">Card Type:</TD><TD>{cctype}</TD></TR>
+                                       <TR><TD class="regRequired">Name on Card:</TD><TD class="textInput"><INPUT TYPE="text" NAME="ccname" VALUE="{ccname}" id="ccname" style="inputMedium"></TD></TR>
+                                       <TR><TD class="regRequired">Card #:</TD><TD class="textInput"><INPUT TYPE="text" NAME="ccnum" VALUE="{ccnum}" id="ccnum"></TD></TR>
+                                       <TR><TD class="regRequired">Expiration Date:</TD><TD>Month {ccmonth} Year {ccyear}</TD></TR>
+                                       <TR><TD class="regFieldName">CVV #:</TD><TD class="textInput"><INPUT TYPE="text" NAME="cccode" VALUE="{cccode}" id="cccode" style="width: 50px;"></TD></TR>
+                                       <TR><TD COLSPAN="2">CVV is the three digit number on the<BR>signature side of your credit card.</TD></TR>
+                               </table>
+                       </div>
+               </div>
+       {/if:pay_by_credit_card}-->        
+
+   <!--{/if:noCharges}-->
+               <p class="regFieldName">
+                       <nobr>Please send me future information by email:<input type="checkbox" NAME="email_ok" {email_ok}></nobr>
+               </p>
+               <center>
+                       <INPUT id="continueButton" type="submit" name="continue" value="Complete {word_Registration}" onClick="do_wait();">
+                       <div id="pleaseWait">
+                         Please wait while we process your {word_registration}
+                       </div>
+               </center>               
+               
+               
+<!--{if:haveRegTerms=YES}-->
+<p>&nbsp;</p>
+<h3>Terms and Conditions</h3>          
+{regTerms}
+<!--{/if:haveRegTerms}-->
+       </form>
+</div><!-- /#registrations -->                                                         
+
+<!-- Hide all payment detail till a type is selected.  -->
+  <script>   
+  reset_hide();
+<!--{if:show_same_button=YES}-->  
+  clickContactSame();
+<!--{/if:show_same_button}-->  
+  </script>
+<br clear="all">
diff --git a/front-end/Views/registrations_step5.html.SAVE b/front-end/Views/registrations_step5.html.SAVE
new file mode 100644 (file)
index 0000000..c461431
--- /dev/null
@@ -0,0 +1,799 @@
+<!--{if:haveCustomStylesheet=YES}-->
+       <LINK REL="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/style.css">
+<!--{else:haveCustomStylesheet}
+       <LINK REL="stylesheet" HREF="{base_app_secure_url}Common/Registrations_V3/front-end/Views/style.css">
+{/if:haveCustomStylesheet}-->
+<!--{if:haveStylesheetOverride=YES}-->
+       <link type="text/css" rel="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/override.css">
+<!--{/if:haveStylesheetOverride}-->
+
+<script>    
+
+       function show( d, disp )
+       {
+               x = document.getElementById(d);
+               if (x) {
+                       // Show the selected area
+                   x.style.visibility = 'visible';
+                   x.style.display = disp;
+               }
+       }
+       
+       function hide( d )
+       {
+               x = document.getElementById(d);
+               if (x) {
+               // Hide the selected area
+               x.style.visibility = 'hidden';
+               x.style.display = 'none';
+               }
+       }
+       
+       function inputDisable(d)
+       {
+               var myDiv = document.getElementById(d);
+               var inputArr = myDiv.getElementsByTagName( "input" );
+               for (var i = 0; i < inputArr.length; i++) {
+                       inputArr[i].disabled = true;
+               }
+               var inputArr = myDiv.getElementsByTagName( "select" );
+               for (var i = 0; i < inputArr.length; i++) {
+                       inputArr[i].disabled = true;
+               }
+       }
+       
+       function inputEnable(d)
+       {
+               var myDiv = document.getElementById(d);
+               var inputArr = myDiv.getElementsByTagName( "input" );
+               for (var i = 0; i < inputArr.length; i++) {
+                       inputArr[i].disabled = false;
+               }
+               var inputArr = myDiv.getElementsByTagName( "select" );
+               for (var i = 0; i < inputArr.length; i++) {
+                       inputArr[i].disabled = false;
+               }
+       }       
+       
+       function reset_hide()
+       {
+
+       <!--{if:pay_by_comp_code!No}-->
+           hide('comp_code_input');
+           inputDisable('comp_code_input');
+       <!--{/if:pay_by_comp_code}-->
+       <!--{if:pay_by_check!No}-->
+               hide('check_input')
+               inputDisable('check_input');
+       <!--{/if:pay_by_check}-->
+       <!--{if:pay_by_cash!No}-->
+               hide('cash_input');
+               inputDisable('cash_input');
+       <!--{/if:pay_by_cash}-->
+       <!--{if:pay_by_credit_card!No}-->
+               hide('credit_card_input');
+               inputDisable('credit_card_input');
+       <!--{/if:pay_by_credit_card}-->
+       
+       <!--{if:pay_by_comp_code!No}-->
+           x = document.getElementById('comp_code_button');
+           if (x) {
+                   if( x.checked ) {
+                       show('comp_code_input', 'inline');
+                           inputEnable('comp_code_input');
+                   }
+           }
+       <!--{/if:pay_by_comp_code}-->
+       <!--{if:pay_by_check!No}-->
+           x = document.getElementById('check_button');
+           if (x) {
+                   if( x.checked ) {
+                       show('check_input', 'inline');
+                           inputEnable('check_input');
+                   }
+               }
+       <!--{/if:pay_by_check}-->
+       <!--{if:pay_by_cash!No}-->
+           x = document.getElementById('cash_button');
+           if (x) {
+                   if( x.checked ) {
+                       show('cash_input', 'inline');
+                           inputEnable('cash_input');
+                   }
+           }
+       <!--{/if:pay_by_cash}-->
+       <!--{if:pay_by_credit_card!No}-->
+           x = document.getElementById('credit_card_button');
+           if (x) {
+                   if( x.checked ) {
+                       show('credit_card_input', 'inline');
+                       inputEnable('credit_card_input');
+                   }
+           }
+       <!--{/if:pay_by_credit_card}-->
+           
+       }    
+       
+       function clickContactSame() 
+       {
+               x = document.getElementById('contact_same');
+               if (x) {
+                       if( x.checked ) {
+                       hide('contactForm');
+                   } else {
+                       show('contactForm', 'table-row');
+                   }
+               }       
+       }
+
+       function copyContact() 
+       {
+               x = document.getElementById('contact_same');
+               if (x && x.checked) {
+               document.getElementById('contact_fname').value = document.getElementById('fname').value;
+               document.getElementById('contact_lname').value = document.getElementById('lname').value;
+               document.getElementById('contact_addr1').value = document.getElementById('addr1').value;
+               document.getElementById('contact_addr2').value = document.getElementById('addr2').value;
+               document.getElementById('contact_city').value = document.getElementById('city').value;
+               document.getElementById('contact_state').value = document.getElementById('state').value;
+               document.getElementById('contact_country').value = document.getElementById('country').value;
+               document.getElementById('contact_zip').value = document.getElementById('zip').value;
+               document.getElementById('contact_phone').value = document.getElementById('phone').value;
+               document.getElementById('contact_fax').value = document.getElementById('fax').value;
+               }
+       }
+
+       function do_wait()
+       {
+               
+               hide('continueButton'); 
+               show('pleaseWait','inline'); 
+               copyContact();          
+               
+       }
+       
+</script>
+
+<div id="registrations">
+
+  <!--{if:admin_user=YES}-->
+    <div class="adminUser">
+        <b>{word_Registration} being entered by Admin User</b>
+    </div>
+  <!--{/if:admin_user}-->
+    
+    <div id="regPageTopText">
+       <p>{regCheckoutPageText}</p>
+    </div>
+
+    <!--{if:have_members=YES}-->
+       <!--{if:haveUser=YES}-->
+            <b>{customer_long_name} Member logged in</b> - <a href="{base_secure_url}index.php?catid={category_id}{preview}&logout=YES">Log Out</a>
+       <!--{/if:haveUser}-->
+    <!--{/if:have_members}-->       
+
+  <!--{if:have_reason=YES}-->
+        <div class="regWarning">
+            <h3>Your request was not submitted. Please check the following items.</h3>
+            <ul>
+    <!--{list:reason}-->
+                <li>{text}</li>
+    <!--{/list:reason}-->
+            </ul>
+        </div>
+  <!--{/if:have_reason}-->
+
+       <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step1" class="button selectmore"><span>Select More</span></a>
+<!--{if:display_only_mode=NO}-->
+  <!--{if:haveCart=YES}-->
+       <a href="{base_secure_url}index.php?catid={category_id}{preview}&Action=Step4" class="button showcart"><span>View Cart</span></a>
+  <!--{/if:haveCart}-->
+<!--{/if:display_only_mode}-->  
+
+    <form action="{base_secure_url}index.php?catid={category_id}{preview}" name="step3" method="post">
+        <input type="hidden" name="Action" value="{next_step}">
+        <input type="hidden" name="checkoutPage" value="YES">
+        {form_data}
+
+       <!--{if:haveUser=YES}-->
+               <hr>
+               <p>
+                       <b>Current Registered User:&nbsp;&nbsp;</b>{userFname}&nbsp;{userLname}&nbsp;&nbsp;&nbsp;&nbsp;<a href="{base_secure_url}index.php?catid={category_id}{preview}&logout=YES">(not me or log me out)</a>  
+                       <!--{if:userIsMember=YES}--><br>(A {customer_long_name} member)<!--{/if:userIsMember}-->                
+               </p>
+       <!--{/if:haveUser}-->
+
+               <div class="regItem">
+                       <div class="regCharges">
+                               <h3>{word_Event} Summary</h3>
+                               <hr>
+                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+       <!--{list:shoppingCart}-->
+                                       <tr style="background-color: #eee;">
+                                               <td class="tdCartLeft" colspan="3" style="padding: 0 10px 0 10px;">
+               <!--{if:date_specific=YES}-->
+                                                       <p style="float: right;">{start_date} through {end_date}</p>
+               <!--{else:date_specific}
+                       <!--{if:ask_date=YES}-->                                        
+                                                       <p style="float: right;" >Desired Date: {desired_date}</p>
+                       <!--{/if:ask_date}-->
+               {/if:date_specific}-->
+                                                       <h3 >{event_name}</h3>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <th class="thCartLeft">Charges</th>
+                                               <th class="thCartRight" style="width: 100px;"><!--{if:need_attendees=YES}-->Per {word_Attendee}<!--{else:need_attendees}&nbsp;{/if:need_attendees}--></th>
+                                               <th class="thCartRight" style="width: 80px;">Total</th>
+                                       </tr>
+                         <!--{list:charges}-->
+                           <tr>
+                               <td class="tdCartLeft">{charge_title}</td>
+                               <td class="tdCartRight">{charge}</td>
+                               <td class="thCartRight">{extend}</td>
+                       </tr>
+                         <!--{sep:charges}-->
+                         <!--{/sep:charges}-->
+                           <tr>
+                               <td class="tdCartLeft">{charge_title}</td>
+                               <td class="tdCartRight">{charge}</td>
+                               <td class="thCartRight">{extend}</td>
+                       </tr>
+                         <!--{/list:charges}-->
+                           <tr>
+                               <th class="thCartRight" colspan="2">Sub Total</th>
+                               <td class="thCartRight">{totalCharges}</td>
+                       </tr>
+      <!--{if:have_attendees=YES}-->
+                           <tr>
+                           <tr><td class="tdCartLeft" colspan="3">&nbsp;</td></tr>
+                             <td colspan="3">
+                                 <table border="0" cellspacing="0" cellpadding="0" width="100%">
+        <!--{if:med_info=YES}-->
+                                   <tr>
+                                     <td width="20px">&nbsp;</td><th>{word_Attendee}</th>
+                              <th colspan="4">Required emergency contact and medical information.</th>
+                            </tr>                
+          <!--{list:attendees}-->
+                            <tr>
+                                <td>&nbsp;</td><td colspan="5">{name}</td>    
+                            </tr>
+                            <tr>                  
+                                <td colspan="2">&nbsp;</td>
+                                <td class="regRequired">Date of Birth: </td><td><input type="text" name="att_{cart_id}_{attendee_id}_dob" value="{dob}"></td>
+                                <td>Parent/Guardian: </td><td><input type="text" name="att_{cart_id}_{attendee_id}_guardian" value="{guardian}"></td>
+                            </tr>
+                            <tr>
+                                <td colspan="2">&nbsp;</td>
+                                <td class="regRequired">Emergency Contact: </td><td><input type="text" name="att_{cart_id}_{attendee_id}_emer_contact" value="{emer_contact}"></td>
+                                <td class="regRequired">Emergency Phone: </td><td><input type="text" name="att_{cart_id}_{attendee_id}_emer_phone" value="{emer_phone}"></td>
+                            </tr>
+                                <td colspan="2">&nbsp;</td>
+                                <td>Brief Medical History: </td><td colspan="3"><input type="text" name="att_{cart_id}_{attendee_id}_med_history" value="{med_history}" style="width: 400px;"></td>
+                            </tr>
+                                <td colspan="2">&nbsp;</td>
+                                <td>Alergies/Medications: </td><td colspan="3"><input type="text" name="att_{cart_id}_{attendee_id}_allergy_med" value="{allergy_med}" style="width: 400px;"></td>
+                            </tr>               
+          <!--{/list:attendees}-->                               
+        <!--{else:med_info}
+          <!--{if:need_attendees=YES}-->
+                            <tr>
+                              <td width="20px">&nbsp;</td><th>{word_Attendees}: </th>
+                              <td align="left">
+               <!--{list:attendees}-->
+                                {name}<!--{sep:attendees}-->, <!--{/sep:attendees}-->
+                                {name}
+               <!--{/list:attendees}-->
+                              </td>
+                            </tr>
+          <!--{/if:need_attendees}-->
+        {/if:med_info}-->
+                                 </table>
+                             </td>
+                           </tr>
+      <!--{/if:have_attendees}-->
+      <!--{if:haveTerms=YES}-->
+                    <tr>
+                       <td class="tdCartLeft" colspan="3">&nbsp;</td>
+                       </tr>
+                           <tr>
+                               <td class="tdCartLeft" colspan="3"><b>Additional terms/conditions:</b> {terms}</td>
+                       </tr>
+      <!--{/if:haveTerms}--> 
+                               <tr><td colspan="2">&nbsp;</td></tr>                   
+       <!--{/list:shoppingCart}-->
+                                       <tr>
+                                               <th class="thCartRight" colspan="2">Grand Total:</th>
+                                               <th class="thCartRight">{grandTotal}</th>
+                                       </tr>
+                               </table>
+                       </div>
+               </div>
+               <hr>
+               <p class="regRequired">Fields in red are required.</p>
+
+                 <table border="0" cellspacing="0" cellpadding="0" width="100%">
+       <!--{if:use_full_billing_at_top=YES}-->                                 
+                                       <tr>
+                                               <td colspan="2">
+                               <!--{if:noCharges=YES}-->
+                                                       <h3>Contact Information:</h3>
+                               <!--{else:noCharges}
+                                                       <h3>Billing Information:</h3>
+                               {/if:noCharges}--> 
+                                               </td>
+                                       </tr>
+                    <tr>
+                       <td valign="top">
+                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                               <!--{if:show_free_fname=YES}-->
+                                           <TR><TD class="regRequired" width="110px">First Name:</TD><TD class="textInput"><INPUT id="fname" TYPE="text" NAME="fname" VALUE="{fname}" class="inputMedium"></TD></TR>
+                               <!--{/if:show_free_fname}-->
+                               <!--{if:show_free_lname=YES}-->
+                                           <TR><TD class="regRequired">Last Name:</TD><TD class="textInput"><INPUT id="lname" TYPE="text" NAME="lname" VALUE="{lname}" class="inputMedium"></TD></TR>
+                               <!--{/if:show_free_lname}-->
+                               <!--{if:show_free_addr1=YES}-->
+                                           <TR><TD class="regRequired">Address:</TD><TD class="textInput"><INPUT id="addr1" TYPE="text" NAME="addr1" VALUE="{addr1}" class="inputMedium"></TD></TR>
+                               <!--{/if:show_free_addr1}-->
+                               <!--{if:show_free_addr2=YES}-->
+                                           <TR><TD class="regFieldName">&nbsp;</TD><TD class="textInput"><INPUT id="addr2" TYPE="text" NAME="addr2" VALUE="{addr2}" class="inputMedium"></TD></TR>
+                               <!--{/if:show_free_addr2}-->
+                               <!--{if:show_free_city=YES}-->
+                                           <TR><TD class="regRequired">City:</TD><TD class="textInput"><INPUT id="city" TYPE="text" NAME="city" VALUE="{city}" class="inputMedium"></TD></TR>
+                               <!--{/if:show_free_city}-->
+                               <!--{if:show_free_state=YES}-->
+                                           <TR><TD class="regRequired">State/Prov.:</TD><TD>{state}</TD></TR>
+                               <!--{/if:show_free_state}-->
+                               <!--{if:show_free_country=YES}-->
+                                           <TR><TD class="regRequired">Country:</TD><TD>{country}</TD></TR>
+                               <!--{/if:show_free_country}-->
+                               <!--{if:show_free_zip=YES}-->
+                                           <TR><TD class="regRequired">ZIP/Postal Code:</TD><TD class="textInput"><INPUT id="zip" TYPE="text" NAME="zip" SIZE="10" VALUE="{zip}"></TD></TR>
+                               <!--{/if:show_free_zip}-->
+                                       </table>
+                               </td>
+                               <td valign="top">
+                                       <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                               <!--{if:show_free_phone=YES}-->
+                                       <TR><TD class="regRequired">Phone:</TD><TD class="textInput"><INPUT id="phone" TYPE="text" NAME="phone" VALUE="{phone}"></TD></TR>
+                               <!--{/if:show_free_phone}-->
+                               <!--{if:show_free_fax=YES}-->
+                                       <TR><TD class="regFieldName">FAX:</TD><TD class="textInput"><INPUT id="fax" TYPE="text" NAME="fax" VALUE="{fax}"></TD></TR>
+                               <!--{/if:show_free_fax}-->
+                                   </table>
+                           </td>
+                    </tr>
+  <!--{/if:use_full_billing_at_top}-->                                 
+  <!--{if:show_contact_data=YES}-->
+                                       <tr>                                    
+                                               <td colspan="2">
+                                                       <h3>{contact_information_title}:<h3>
+                                               </td>
+                                       </tr>
+       <!--{if:show_same_button=YES}-->
+                                       <tr>
+                                               <td>
+                                                       <h3>Same as above:</h3> <input type="checkbox" name="contact_same" id="contact_same" onClick="clickContactSame();" {contact_same}> Same as billing information
+                                               </td>
+                                       </tr>
+       <!--{/if:show_same_button}-->
+                    <tr id="contactForm">
+                       <td valign="top">
+                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                           <!--{if:use_contact_fname=YES}-->
+                                               <tr>
+                                                       <!--{if:required_contact_fname=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_fname}<TD class="regFieldName .nowrap">{/if:required_contact_fname}-->
+                                                               {prompt_contact_fname}:
+                                                       </TD>
+                                                       <TD class="textInput" width="110px"><INPUT id="contact_fname" TYPE="text" NAME="contact_fname" VALUE="{contact_fname}" class="inputMedium"></TD>
+                                               </TR>
+                                           <!--{/if:use_contact_fname}-->
+                                           <!--{if:use_contact_lname=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_lname=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_lname}<TD class="regFieldName .nowrap">{/if:required_contact_lname}-->
+                                                               {prompt_contact_lname}:
+                                                       </TD>
+                                                       <TD class="textInput" width="110px"><INPUT id="contact_lname" TYPE="text" NAME="contact_lname" VALUE="{contact_lname}" class="inputMedium"></TD>
+                                               </TR>
+                                           <!--{/if:use_contact_lname}-->
+                                           <!--{if:use_contact_addr1=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_addr1=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_addr1}<TD class="regFieldName .nowrap">{/if:required_contact_addr1}-->
+                                                               {prompt_contact_addr1}:
+                                                       </TD>
+                                                       <TD class="textInput" width="110px"><INPUT id="contact_addr1" TYPE="text" NAME="contact_addr1" VALUE="{contact_addr1}" class="inputMedium"></TD>
+                                               </TR>
+                                           <!--{/if:use_contact_addr1}-->
+                                           <!--{if:use_contact_addr2=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_addr2=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_addr2}<TD class="regFieldName .nowrap">{/if:required_contact_addr2}-->
+                                                               {prompt_contact_addr2}:
+                                                       </TD>
+                                                       <TD class="textInput" width="110px"><INPUT id="contact_addr2" TYPE="text" NAME="contact_addr2" VALUE="{contact_addr2}" class="inputMedium"></TD>
+                                               </TR>
+                                           <!--{/if:use_contact_addr2}-->
+                                           <!--{if:use_contact_city=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_city=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_city}<TD class="regFieldName .nowrap">{/if:required_contact_city}-->
+                                                               {prompt_contact_city}:
+                                                       </TD>
+                                                       <TD class="textInput" width="110px"><INPUT id="contact_city" TYPE="text" NAME="contact_city" VALUE="{contact_city}" class="inputMedium"></TD>
+                                               </TR>
+                                           <!--{/if:use_contact_city}-->
+                                           <!--{if:use_contact_state=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_state=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_state}<TD class="regFieldName .nowrap">{/if:required_contact_state}-->
+                                                               {prompt_contact_state}:
+                                                       </TD>
+                                                       <TD>{contact_state}</TD>
+                                               </TR>
+                                           <!--{/if:use_contact_state}-->
+                                           <!--{if:use_contact_zip=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_zip=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_zip}<TD class="regFieldName .nowrap">{/if:required_contact_zip}-->
+                                                               {prompt_contact_zip}:
+                                                       </TD>
+                                                       <TD class="textInput"><INPUT id="contact_zip" TYPE="text" NAME="contact_zip" SIZE="10" VALUE="{contact_zip}"></TD>
+                                               </TR>
+                                           <!--{/if:use_contact_zip}-->
+                                           <!--{if:use_contact_country=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_country=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_country}<TD class="regFieldName .nowrap">{/if:required_contact_country}-->
+                                                               {prompt_contact_country}:
+                                                       </TD>
+                                                       <TD>{contact_country}</TD>
+                                               </TR>
+                                           <!--{/if:use_contact_country}-->
+                                           <!--{if:use_contact_phone=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_phone=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_phone}<TD class="regFieldName .nowrap">{/if:required_contact_phone}-->
+                                                               {prompt_contact_phone}:
+                                                       </TD>
+                                                       <TD class="textInput"><INPUT id="contact_phone" TYPE="text" NAME="contact_phone" VALUE="{contact_phone}"></TD>
+                                               </TR>
+                                                   <!--{/if:use_contact_phone}-->
+                                                   <!--{if:use_contact_fax=YES}-->
+                                               <TR>
+                                                       <!--{if:required_contact_fax=YES}--><TD class="regRequired .nowrap"><!--{else:required_contact_fax}<TD class="regFieldName .nowrap">{/if:required_contact_fax}-->
+                                                               {prompt_contact_fax}:</TD>
+                                                       <TD class="textInput"><INPUT id="contact_fax" TYPE="text" NAME="contact_fax" VALUE="{contact_fax}"></TD>
+                                               </TR>
+                                           <!--{/if:use_contact_fax}-->
+                                   </table>
+                           </td>
+                                       </tr>
+  <!--{/if:show_contact_data}-->
+                       <!--{if:haveUser=NO}-->
+                                       <tr>
+                                               <td class="regFieldName" valign="top" colspan="2">
+                       <!--{if:have_registered_users=YES}-->
+                                                       <h3>Returning User Login Information:</h3>
+                       <!--{else:have_registered_users}
+                                                       <h3>E-Mail Address:</h3>
+                       {/if:have_registered_users}-->                          
+                                                       <p>
+                                                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                                                       <tr><td class="regRequired" valign="top">E-Mail Address: </td><td><input id="email" type="text" name="email" value="{email}" class="inputLarge"></td></tr>
+                       <!--{if:have_registered_users=YES}-->
+                                                                       <tr><td class="regRequired" valign="top">{word_Password}:</td><td><input type="text" name="login_password" value="{login_password}" class="inputStandard"></td></tr>
+                                                                       <tr><td colspan="2">Retain this {word_password} for future {word_registrations}. {password_msg}</td></tr>
+                       <!--{else:have_registered_users}
+                                                                       <tr><td><input type="hidden" name="login_password" value="{login_password}"> </td></tr>
+                       {/if:have_registered_users}-->
+                       
+                                                                                               
+                                                               </table>
+                                                       </p>
+                                               </td>
+                                       </tr>
+                       <!--{/if:haveUser}-->
+                 </table>
+
+               <p><hr></p>
+              
+     <!--{if:noCharges=NO}-->
+
+               <h3 style="color: red;">Select payment method:</h3>
+
+       <!--{if:pay_by_comp_code=No}--> 
+       <!--{else:pay_by_comp_code}
+         <!--{if:pay_by_comp_code_restrict=YES}-->
+               <div class="lightBorder">
+            For Admin Users Only:
+         <!--{else:pay_by_comp_code_restrict}
+               <div>
+         {/if:pay_by_comp_code_restrict}-->
+                       <h3>                
+                       <!--{if:payment_type=comp_code}--> 
+                               <input type="radio" name="payment_type" value="comp_code" onClick="reset_hide();" id="comp_code_button" CHECKED>
+                       <!--{else:payment_type} 
+                               <input type="radio" name="payment_type" value="comp_code" onClick="reset_hide();" id="comp_code_button">
+                       {/if:payment_type}--> 
+                       {title_use_payment_comp_code}
+                       </h3>
+                       <div id="comp_code_input">
+               <!--{if:comp_code_fields_used=YES}-->
+                               <p>Please provide the following information:</p>
+                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                           <tr>
+                               <td valign="top">
+                                       <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <!--{if:comp_code_field_fname=YES}-->
+                                                   <TR><TD class="regRequired" width="110px">First Name:</TD><TD class="textInput"><INPUT id="fname" TYPE="text" NAME="fname" VALUE="{fname}" class="inputMedium"></TD></TR>
+                                       <!--{/if:comp_code_field_fname}-->
+                                       <!--{if:comp_code_field_lname=YES}-->
+                                                   <TR><TD class="regRequired">Last Name:</TD><TD class="textInput"><INPUT id="lname" TYPE="text" NAME="lname" VALUE="{lname}" class="inputMedium"></TD></TR>
+                                       <!--{/if:comp_code_field_lname}-->
+                                       <!--{if:comp_code_field_addr1=YES}-->
+                                                   <TR><TD class="regRequired">Address:</TD><TD class="textInput"><INPUT id="addr1" TYPE="text" NAME="addr1" VALUE="{addr1}" class="inputMedium"></TD></TR>
+                                       <!--{/if:comp_code_field_addr1}-->
+                                       <!--{if:comp_code_field_addr2=YES}-->
+                                                   <TR><TD class="regFieldName">&nbsp;</TD><TD class="textInput"><INPUT id="addr2" TYPE="text" NAME="addr2" VALUE="{addr2}" class="inputMedium"></TD></TR>
+                                       <!--{/if:comp_code_field_addr2}-->
+                                       <!--{if:comp_code_field_city=YES}-->
+                                                   <TR><TD class="regRequired">City:</TD><TD class="textInput"><INPUT id="city" TYPE="text" NAME="city" VALUE="{city}" class="inputMedium"></TD></TR>
+                                       <!--{/if:comp_code_field_city}-->
+                                       <!--{if:comp_code_field_state=YES}-->
+                                                   <TR><TD class="regRequired">State/Prov.:</TD><TD>{state}</TD></TR>
+                                       <!--{/if:comp_code_field_state}-->
+                                       <!--{if:comp_code_field_country=YES}-->
+                                                   <TR><TD class="regRequired">Country:</TD><TD>{country}</TD></TR>
+                                       <!--{/if:comp_code_field_country}-->
+                                       <!--{if:comp_code_field_zip=YES}-->
+                                                   <TR><TD class="regRequired">ZIP/Postal Code:</TD><TD class="textInput"><INPUT id="zip" TYPE="text" NAME="zip" SIZE="10" VALUE="{zip}"></TD></TR>
+                                       <!--{/if:comp_code_field_zip}-->
+                                               </table>
+                                       </td>
+                                       <td valign="top">
+                                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <!--{if:comp_code_field_phone=YES}-->
+                                               <TR><TD class="regRequired">Phone:</TD><TD class="textInput"><INPUT id="phone" TYPE="text" NAME="phone" VALUE="{phone}"></TD></TR>
+                                       <!--{/if:comp_code_field_phone}-->
+                                       <!--{if:comp_code_field_fax=YES}-->
+                                               <TR><TD class="regFieldName">FAX:</TD><TD class="textInput"><INPUT id="fax" TYPE="text" NAME="fax" VALUE="{fax}"></TD></TR>
+                                       <!--{/if:comp_code_field_fax}-->
+                                           </table>
+                                   </td>
+                           </tr>
+                               </table>
+               <!--{/if:comp_code_fields_used}-->
+                               <p class="regFieldName">{title_payment_comp_code}: <INPUT TYPE="text" NAME="pay_code" VALUE="{pay_code}" style="width: 50px;"></p>
+                       </div>
+               </div>
+       {/if:pay_by_comp_code}-->
+
+       <!--{if:pay_by_check=No}-->
+       <!--{else:pay_by_check}
+         <!--{if:pay_by_check_restrict=YES}-->
+               <div class="lightBorder">
+            For Admin Users Only:
+         <!--{else:pay_by_check_restrict}
+               <div>
+         {/if:pay_by_check_restrict}-->
+               <h3>
+                       <!--{if:payment_type=by_check}-->
+                               <input type="radio" name="payment_type" value="by_check" onClick="reset_hide();" id="check_button" CHECKED>
+                   <!--{else:payment_type}
+                               <input type="radio" name="payment_type" value="by_check" onClick="reset_hide();" id="check_button">
+                   {/if:payment_type}-->
+                   {title_send_a_check}
+                       </h3>
+            <div id="check_input">
+               <!--{if:check_fields_used=YES}-->
+                               <p>Please provide the following information:</p>
+                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                           <tr>
+                               <td valign="top">
+                                       <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <!--{if:check_field_fname=YES}-->
+                                                   <TR><TD class="regRequired" width="110px">First Name:</TD><TD class="textInput"><INPUT id="fname" TYPE="text" NAME="fname" VALUE="{fname}" class="inputMedium"></TD></TR>
+                                       <!--{/if:check_field_fname}-->
+                                       <!--{if:check_field_lname=YES}-->
+                                                   <TR><TD class="regRequired">Last Name:</TD><TD class="textInput"><INPUT id="lname" TYPE="text" NAME="lname" VALUE="{lname}" class="inputMedium"></TD></TR>
+                                       <!--{/if:check_field_lname}-->
+                                       <!--{if:check_field_addr1=YES}-->
+                                                   <TR><TD class="regRequired">Address:</TD><TD class="textInput"><INPUT id="addr1" TYPE="text" NAME="addr1" VALUE="{addr1}" class="inputMedium"></TD></TR>
+                                       <!--{/if:check_field_addr1}-->
+                                       <!--{if:check_field_addr2=YES}-->
+                                                   <TR><TD class="regFieldName">&nbsp;</TD><TD class="textInput"><INPUT id="addr2" TYPE="text" NAME="addr2" VALUE="{addr2}" class="inputMedium"></TD></TR>
+                                       <!--{/if:check_field_addr2}-->
+                                       <!--{if:check_field_city=YES}-->
+                                                   <TR><TD class="regRequired">City:</TD><TD class="textInput"><INPUT id="city" TYPE="text" NAME="city" VALUE="{city}" class="inputMedium"></TD></TR>
+                                       <!--{/if:check_field_city}-->
+                                       <!--{if:check_field_state=YES}-->
+                                                   <TR><TD class="regRequired">State/Prov.:</TD><TD>{state}</TD></TR>
+                                       <!--{/if:check_field_state}-->
+                                       <!--{if:check_field_country=YES}-->
+                                                   <TR><TD class="regRequired">Country:</TD><TD>{country}</TD></TR>
+                                       <!--{/if:check_field_country}-->
+                                       <!--{if:check_field_zip=YES}-->
+                                                   <TR><TD class="regRequired">ZIP/Postal Code:</TD><TD class="textInput"><INPUT id="zip" TYPE="text" NAME="zip" SIZE="10" VALUE="{zip}"></TD></TR>
+                                       <!--{/if:check_field_zip}-->
+                                               </table>
+                                       </td>
+                                       <td valign="top">
+                                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <!--{if:check_field_phone=YES}-->
+                                               <TR><TD class="regRequired">Phone:</TD><TD class="textInput"><INPUT id="phone" TYPE="text" NAME="phone" VALUE="{phone}"></TD></TR>
+                                       <!--{/if:check_field_phone}-->
+                                       <!--{if:check_field_fax=YES}-->
+                                               <TR><TD class="regFieldName">FAX:</TD><TD class="textInput"><INPUT id="fax" TYPE="text" NAME="fax" VALUE="{fax}"></TD></TR>
+                                       <!--{/if:check_field_fax}-->
+                                           </table>
+                                   </td>
+                           </tr>
+                               </table>
+               <!--{/if:check_fields_used}-->
+            </div>
+               </div>
+       {/if:pay_by_check}-->
+
+       <!--{if:pay_by_cash=No}-->
+       <!--{else:pay_by_cash}
+         <!--{if:pay_by_cash_restrict=YES}-->
+               <div class="lightBorder">
+            For Admin Users Only:
+         <!--{else:pay_by_cash_restrict}
+               <div>
+         {/if:pay_by_cash_restrict}-->
+               <h3>
+            <!--{if:payment_type=cash}--> 
+                <input type="radio" name="payment_type" value="cash" onClick="reset_hide();" id="cash_button" CHECKED>
+            <!--{else:payment_type} 
+                <input type="radio" name="payment_type" value="cash" onClick="reset_hide();" id="cash_button">
+            {/if:payment_type}--> 
+                {title_paid_cash}
+            </h3>
+            <div id="cash_input">
+               <!--{if:cash_fields_used=YES}-->
+                               <p>Please provide the following information:</p>
+                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                           <tr>
+                               <td valign="top">
+                                       <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <!--{if:cash_field_fname=YES}-->
+                                                   <TR><TD class="regRequired" width="110px">First Name:</TD><TD class="textInput"><INPUT id="fname" TYPE="text" NAME="fname" VALUE="{fname}" class="inputMedium"></TD></TR>
+                                       <!--{/if:cash_field_fname}-->
+                                       <!--{if:cash_field_lname=YES}-->
+                                                   <TR><TD class="regRequired">Last Name:</TD><TD class="textInput"><INPUT id="lname" TYPE="text" NAME="lname" VALUE="{lname}" class="inputMedium"></TD></TR>
+                                       <!--{/if:cash_field_lname}-->
+                                       <!--{if:cash_field_addr1=YES}-->
+                                                   <TR><TD class="regRequired">Address:</TD><TD class="textInput"><INPUT id="addr1" TYPE="text" NAME="addr1" VALUE="{addr1}" class="inputMedium"></TD></TR>
+                                       <!--{/if:cash_field_addr1}-->
+                                       <!--{if:cash_field_addr2=YES}-->
+                                                   <TR><TD class="regFieldName">&nbsp;</TD><TD class="textInput"><INPUT id="addr2" TYPE="text" NAME="addr2" VALUE="{addr2}" class="inputMedium"></TD></TR>
+                                       <!--{/if:cash_field_addr2}-->
+                                       <!--{if:cash_field_city=YES}-->
+                                                   <TR><TD class="regRequired">City:</TD><TD class="textInput"><INPUT id="city" TYPE="text" NAME="city" VALUE="{city}" class="inputMedium"></TD></TR>
+                                       <!--{/if:cash_field_city}-->
+                                       <!--{if:cash_field_state=YES}-->
+                                                   <TR><TD class="regRequired">State/Prov.:</TD><TD>{state}</TD></TR>
+                                       <!--{/if:cash_field_state}-->
+                                       <!--{if:cash_field_country=YES}-->
+                                                   <TR><TD class="regRequired">Country:</TD><TD>{country}</TD></TR>
+                                       <!--{/if:cash_field_country}-->
+                                       <!--{if:cash_field_zip=YES}-->
+                                                   <TR><TD class="regRequired">ZIP/Postal Code:</TD><TD class="textInput"><INPUT id="zip" TYPE="text" NAME="zip" SIZE="10" VALUE="{zip}"></TD></TR>
+                                       <!--{/if:cash_field_zip}-->
+                                               </table>
+                                       </td>
+                                       <td valign="top">
+                                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <!--{if:cash_field_phone=YES}-->
+                                               <TR><TD class="regRequired">Phone:</TD><TD class="textInput"><INPUT id="phone" TYPE="text" NAME="phone" VALUE="{phone}"></TD></TR>
+                                       <!--{/if:cash_field_phone}-->
+                                       <!--{if:cash_field_fax=YES}-->
+                                               <TR><TD class="regFieldName">FAX:</TD><TD class="textInput"><INPUT id="fax" TYPE="text" NAME="fax" VALUE="{fax}"></TD></TR>
+                                       <!--{/if:cash_field_fax}-->
+                                           </table>
+                                   </td>
+                           </tr>
+                               </table>
+               <!--{/if:cash_fields_used}-->
+            </div>
+               </div>
+       {/if:pay_by_cash}-->
+       
+       <!--{if:pay_by_credit_card=No}-->
+       <!--{else:pay_by_credit_card}
+         <!--{if:pay_by_credit_card_restrict=YES}-->
+               <div class="lightBorder">
+            For Admin Users Only:
+         <!--{else:pay_by_credit_card_restrict}
+               <div>
+         {/if:pay_by_credit_card_restrict}-->
+               <h3>
+               <!--{if:payment_type=credit_card}--> 
+                   <input type="radio" name="payment_type" value="credit_card" onClick="reset_hide();" id="credit_card_button" CHECKED>
+               <!--{else:payment_type} 
+                   <input type="radio" name="payment_type" value="credit_card" onClick="reset_hide();" id="credit_card_button">
+               {/if:payment_type}--> 
+                   {title_pay_by_credit_card}
+               </h3>
+                       <div id="credit_card_input">
+               <!--{if:credit_card_fields_used=YES}-->
+                               <p>Please provide the following information:</p>
+                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                           <tr>
+                               <td valign="top">
+                                       <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <!--{if:credit_card_field_fname=YES}-->
+                                                   <TR><TD class="regRequired" width="110px">First Name:</TD><TD class="textInput"><INPUT id="fname" TYPE="text" NAME="fname" VALUE="{fname}" class="inputMedium"></TD></TR>
+                                       <!--{/if:credit_card_field_fname}-->
+                                       <!--{if:credit_card_field_lname=YES}-->
+                                                   <TR><TD class="regRequired">Last Name:</TD><TD class="textInput"><INPUT id="lname" TYPE="text" NAME="lname" VALUE="{lname}" class="inputMedium"></TD></TR>
+                                       <!--{/if:credit_card_field_lname}-->
+                                       <!--{if:credit_card_field_addr1=YES}-->
+                                                   <TR><TD class="regRequired">Address:</TD><TD class="textInput"><INPUT id="addr1" TYPE="text" NAME="addr1" VALUE="{addr1}" class="inputMedium"></TD></TR>
+                                       <!--{/if:credit_card_field_addr1}-->
+                                       <!--{if:credit_card_field_addr2=YES}-->
+                                                   <TR><TD class="regFieldName">&nbsp;</TD><TD class="textInput"><INPUT id="addr2" TYPE="text" NAME="addr2" VALUE="{addr2}" class="inputMedium"></TD></TR>
+                                       <!--{/if:credit_card_field_addr2}-->
+                                       <!--{if:credit_card_field_city=YES}-->
+                                                   <TR><TD class="regRequired">City:</TD><TD class="textInput"><INPUT id="city" TYPE="text" NAME="city" VALUE="{city}" class="inputMedium"></TD></TR>
+                                       <!--{/if:credit_card_field_city}-->
+                                       <!--{if:credit_card_field_state=YES}-->
+                                                   <TR><TD class="regRequired">State/Prov.:</TD><TD>{state}</TD></TR>
+                                       <!--{/if:credit_card_field_state}-->
+                                       <!--{if:credit_card_field_country=YES}-->
+                                                   <TR><TD class="regRequired">Country:</TD><TD>{country}</TD></TR>
+                                       <!--{/if:credit_card_field_country}-->
+                                       <!--{if:credit_card_field_zip=YES}-->
+                                                   <TR><TD class="regRequired">ZIP/Postal Code:</TD><TD class="textInput"><INPUT id="zip" TYPE="text" NAME="zip" SIZE="10" VALUE="{zip}"></TD></TR>
+                                       <!--{/if:credit_card_field_zip}-->
+                                               </table>
+                                       </td>
+                                       <td valign="top">
+                                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <!--{if:credit_card_field_phone=YES}-->
+                                               <TR><TD class="regRequired">Phone:</TD><TD class="textInput"><INPUT id="phone" TYPE="text" NAME="phone" VALUE="{phone}"></TD></TR>
+                                       <!--{/if:credit_card_field_phone}-->
+                                       <!--{if:credit_card_field_fax=YES}-->
+                                               <TR><TD class="regFieldName">FAX:</TD><TD class="textInput"><INPUT id="fax" TYPE="text" NAME="fax" VALUE="{fax}"></TD></TR>
+                                       <!--{/if:credit_card_field_fax}-->
+                                           </table>
+                                   </td>
+                           </tr>
+                               </table>
+               <!--{/if:credit_card_fields_used}-->
+                               <p>The fees totaled above will be charged to your credit card once this form is submitted</p>                                                                                                   
+                               <table border="0" cellspacing="0" cellpadding="0">
+                                       <TR><TD class="regRequired" width="110px">Card Type:</TD><TD>{cctype}</TD></TR>
+                                       <TR><TD class="regRequired">Name on Card:</TD><TD class="textInput"><INPUT TYPE="text" NAME="ccname" VALUE="{ccname}" id="ccname" style="inputMedium"></TD></TR>
+                                       <TR><TD class="regRequired">Card #:</TD><TD class="textInput"><INPUT TYPE="text" NAME="ccnum" VALUE="{ccnum}" id="ccnum"></TD></TR>
+                                       <TR><TD class="regRequired">Expiration Date:</TD><TD>Month {ccmonth} Year {ccyear}</TD></TR>
+                                       <TR><TD class="regFieldName">CVV #:</TD><TD class="textInput"><INPUT TYPE="text" NAME="cccode" VALUE="{cccode}" id="cccode" style="width: 50px;"></TD></TR>
+                                       <TR><TD COLSPAN="2">CVV is the three digit number on the<BR>signature side of your credit card.</TD></TR>
+                               </table>
+                       </div>
+               </div>
+       {/if:pay_by_credit_card}-->        
+
+   <!--{/if:noCharges}-->
+               <p class="regFieldName">
+                       <nobr>Please send me future information by email:<input type="checkbox" NAME="email_ok" {email_ok}></nobr>
+               </p>
+               <center>
+                       <INPUT id="continueButton" type="submit" name="continue" value="Complete {word_Registration}" onClick="do_wait();">
+                       <div id="pleaseWait">
+                         Please wait while we process your {word_registration}
+                       </div>
+               </center>               
+               
+               
+<!--{if:haveRegTerms=YES}-->
+<p>&nbsp;</p>
+<h3>Terms and Conditions</h3>          
+{regTerms}
+<!--{/if:haveRegTerms}-->
+       </form>
+</div><!-- /#registrations -->                                                         
+
+<!-- Hide all payment detail till a type is selected.  -->
+  <script>   
+  reset_hide();
+<!--{if:show_same_button=YES}-->  
+  clickContactSame();
+<!--{/if:show_same_button}-->  
+  </script>
+<br clear="all">
diff --git a/front-end/Views/registrations_step6.html b/front-end/Views/registrations_step6.html
new file mode 100644 (file)
index 0000000..9457f19
--- /dev/null
@@ -0,0 +1,141 @@
+<HTML>
+  <HEAD>
+<!--{if:haveCustomStylesheet=YES}-->
+       <LINK REL="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/style.css">
+<!--{else:haveCustomStylesheet}
+       <LINK REL="stylesheet" HREF="{base_app_secure_url}Common/Registrations_V3/front-end/Views/style.css">
+{/if:haveCustomStylesheet}-->
+<!--{if:haveStylesheetOverride=YES}-->
+       <link type="text/css" rel="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/override.css">
+<!--{/if:haveStylesheetOverride}-->
+    
+  </head>
+  <body bgcolor="FFFFFF">
+    <table width="750" border="0" cellspacing="0" cellpadding="0">
+      <tr>
+        <td align="center">
+                 <table width="100%" border="0" cellspacing="0" cellpadding="0">
+                   <tr> 
+              <td><font class="headertitle">{word_Registration}: {checkout_type}</font></td>
+                       </tr>
+                 </table>      
+            <table border="0" width="100%" cellspacing="0" cellpadding="5">
+              <tr><td colspan="2" align="center"><h3>{word_Registering} for: <font color="blue">{reg_name}</font></h3></td></tr>
+              <TR><TD COLSPAN="2" ALIGN="center">{word_Registration} Tracking #:&nbsp;&nbsp;{request_numb}</TD></TR>
+              <tr>
+                <td colspan="2" align="center">
+                  Thank you for your {word_registering}.<br>
+                  Please print this page.
+               </td>
+              </tr>
+
+  <!--{if:admin_user=YES}-->
+             <tr><td colspan="2" align="center"><b class="adminUser">Entered by Admin User</b></td></tr>
+  <!--{/if:admin_user}-->
+                  
+        <!--{if:checkout_type=Request}-->
+              <tr>
+                <td colspan="2" align="center">
+                  <FONT COLOR="blue">
+                    This is a REQUEST only.<br>
+                    You will be contacted shortly to confirm that your payment has been processed.<br>
+                    Please contact us if you do not receive a confirmation within 48 hours.
+                  </FONT>
+               </td>
+       <!--{/if:checkout_type}-->
+              </tr>
+              <TR><TD COLSPAN="2">&nbsp;<P></TD></TR>
+              <tr>
+                <td align="center" width="50%" valign="top">
+                  <table border="0">
+                    <TR>
+     <!--{if:free_reg=Yes}-->
+                      <TH ALIGN="right" valign="top"><NOBR>Contact Information:&nbsp;</NOBR></TH>
+     <!--{else:free_reg}
+                      <TH ALIGN="right" valign="top"><NOBR>Bill to:&nbsp;</NOBR></TH>
+     {/if:free_reg}-->
+                      <TD>
+                        {fname} {lname}
+                        <br>{addr1}
+                        <!--{if:addr2}--><br>{addr2}<!--{/if:addr2}-->
+                        <br>{city}, {state} {zip} {country}
+                      </TD>
+                    </TR>
+                  </table>
+                </td>
+                <td valign="top" width="50%" valign="top">
+                  <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                    <TR><TH ALIGN="right">Phone:&nbsp;</TH><TD>{phone}</TD></TR>
+                    <TR><TH ALIGN="right">FAX:&nbsp;</TH><TD>{fax}</TD></TR>
+                    <TR><TH ALIGN="right">E-Mail:&nbsp;</TH><TD>{email}</TD></TR>
+                    <TR><TD colspan="2">&nbsp;</TD></TR>
+     <!--{if:free_reg=No}-->
+                <!--{if:pay_type=comp_code}-->
+                    <TR><TD ALIGN="center" COLSPAN="2"><FONT COLOR="blue">Comp Code accepted - No payment required. </TD></TR>
+                <!--{/if:pay_type}-->            
+                <!--{if:pay_type=at_event}-->
+                    <TR><TD ALIGN="center" COLSPAN="2"><FONT COLOR="blue">You will be paying when you arrive at {word_event}. </TD></TR>
+                <!--{/if:pay_type}-->
+                <!--{if:pay_type=credit_card}-->
+                    <TR><TH ALIGN="right">Credit Card:&nbsp;</TH><TD>{cctype_store} {ccnum} exp: {ccmonth_store}/{ccyear_store}</TD></TR>
+                    <TR><TH ALIGN="right">Name on Card:&nbsp;</TH><TD>{ccname}</TD></TR>
+                    <TR><TH ALIGN="right">Authorization Code:&nbsp;</TH><TD>{auth_code}</TD></TR>
+                <!--{/if:pay_type}-->
+     <!--{/if:free_reg}-->
+                  </table>
+                </TD>
+              </TR>
+              <TR><TD COLSPAN="2">&nbsp;<P></TD></TR>
+              <tr>
+                <td colspan="2" align="center">
+                  <table border="0" cellspacing="0" cellpadding="0" valign="top">
+  <!--{if:rate_classes}-->
+                    <tr><th align="center" colspan="2">{word_Registration} Level:&nbsp;<font color="blue">{rate_name}</font></td></tr>
+  <!--{/if:rate_classes}-->
+  <!--{if:ask_attendees=Yes}-->
+
+                    <tr><th align="right">Number of {word_Attendees}:&nbsp;</th><td><font color="blue">{numb_attendees}</font> at <font color="blue">{rate}</font> each</font></td></tr>
+                    <TR><TD ALIGN="center" valign="top" COLSPAN="2">{attendees}</TD></TR>
+  <!--{/if:ask_attendees}-->
+                  </table>
+                  <P>&nbsp;<P>
+                  <table border="0" cellspacing="0" cellpadding="3" valign="top">
+                    <tr><th align="left">Charges</th><th align="right"><!--{if:need_attendees=YES}-->Per {word_Attendee}<!--{else:need_attendees}&nbsp;{/if:need_attendees}--></th><th align="right">Total</th></tr>
+                  <!--{list:charges}-->
+                    <tr><td align="left">{charge_title}&nbsp;&nbsp;</td><td align="right">{charge}</td><td align="right">&nbsp;&nbsp;{extend}</td></tr>
+                  <!--{sep:charges}-->
+                  <!--{/sep:charges}-->
+                    <tr><td align="left">{charge_title}&nbsp;&nbsp;</td><td align="right">{charge}</td><td align="right">&nbsp;&nbsp;{extend}</td></tr>
+                  <!--{/list:charges}-->
+                    <tr><th align="right">Total</th><td>&nbsp;</td><td align="right"><font color="blue">{total_charges}</font></td></tr>
+                  </table>
+                </td>
+              </tr>
+             <TR><TD COLSPAN="3">&nbsp;</TD></TR>
+             <TR> 
+               <TD COLSPAN="3"> 
+                 <table width="95%" border="1" cellspacing="1" cellpadding="6" class="tblblck" align="center">
+                   <tr class="termstd"> 
+                     <td> <a name="terms"></a><span class="termshead"><CENTER><B>{word_Registration} Terms and Conditions</B></CENTER></span><br>
+                       <span class="termsingress"> 
+                       <P>{regTerms}
+                       </span>
+                     </td>
+                   </tr>
+                 </table>
+               </TD>
+             </TR>
+             <TR><TD COLSPAN="3">&nbsp;</TD></TR>
+             <TR><TD COLSPAN="3"><hr width="90%"></TD></TR>
+             <tr><td colspan="3" align="center"><a href="{base_url}">{customer_long_name}</a></td></tr>
+             <tr><td colspan="3" align="center">{customer_address}</td></tr>
+             <tr><td colspan="3" align="center">{customer_city}, {customer_state} {customer_zip}</td></tr>
+             <tr><td colspan="3" align="center">{customer_phone}</td></tr>
+            </TABLE>
+        </TD>
+      </TR>
+      <a href="{base_secure_url}index.php?catid={category_id}{preview}" class="pseudoButton">Return to {word_Events}</a>
+    </table>
+  </BODY>
+</HTML>
+
diff --git a/front-end/Views/registrations_store.html b/front-end/Views/registrations_store.html
new file mode 100644 (file)
index 0000000..8b1f879
--- /dev/null
@@ -0,0 +1,160 @@
+            <table border="1" cellspacing="0" cellpadding="5">
+  <!--{if:admin_user=YES}-->
+             <tr><td colspan="2" align="center"><b>Entered by Admin User</b></td></tr>
+  <!--{/if:admin_user}-->
+     <!--{if:free_reg=YES}-->
+              <tr><TH ALIGN="center" colspan="2" style="white-space: nowrap;">Submitted by:</TH></tr>
+     <!--{else:free_reg}
+              <tr><TH ALIGN="center" colspan="2" style="white-space: nowrap;">Bill to:</TH></tr>
+     {/if:free_reg}-->
+              <tr>
+               <TD valign="top">
+                  <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                    <TR><TH ALIGN="right">Name:&nbsp;</TH><TD><!--{if:show_free_fname=YES}-->{fname} <!--{/if:show_free_fname}--><!--{if:show_free_lname=YES}-->{lname}<!--{/if:show_free_lname}--></TD></TR>
+                   <!--{if:show_free_addr1=YES}--><TR><TH ALIGN="right">Address:&nbsp;</TH><TD>{addr1}</TD></TR><!--{/if:show_free_addr1}-->
+                   <!--{if:show_free_addr2=YES}--><!--{if:addr2}--><TR><TH ALIGN="right">&nbsp;</TH><TD>{addr2}</TD></TR><!--{/if:addr2}--><!--{/if:show_free_addr2}-->
+                   <!--{if:show_free_cityzip=YES}--><TR><TH ALIGN="right">&nbsp;</TH><TD><!--{if:show_free_city=YES}-->{city}, <!--{/if:show_free_city}--><!--{if:show_free_state=YES}-->{state} <!--{/if:show_free_state}--><!--{if:show_free_zip=YES}-->{zip} <!--{/if:show_free_zip}--><!--{if:show_free_country=YES}-->{country}<!--{/if:show_free_country}--></TD></TR><!--{/if:show_free_cityzip}-->
+                    <!--{if:show_free_phone=YES}--><TR><TH ALIGN="right">Phone:&nbsp;</TH><TD>{phone}</TD></TR><!--{/if:show_free_phone}-->
+                    <!--{if:show_free_fax=YES}--><!--{if:fax}--><TR><TH ALIGN="right">FAX:&nbsp;</TH><TD>{fax}</TD></TR><!--{/if:fax}--><!--{/if:show_free_fax}-->
+                    <TR><TH ALIGN="right">E-Mail:&nbsp;</TH><TD>{email}</TD></TR>
+                  </table>
+                </td>
+                <TD valign="top">
+                  <table border="0" cellspacing="0" cellpadding="0" width="100%">
+     <!--{if:free_reg=NO}-->
+                               <TR><TH ALIGN="right">Total Charges:&nbsp;</TH><TD>{grandTotal}</TD></TR>
+                    <TR><TH ALIGN="right">Payment Type:&nbsp;</TH><TD>{payment_type_text}</TD></TR>
+                <!--{if:payment_type=comp_code}-->
+                    <TR><TH ALIGN="right">Payment Code:&nbsp;</TH><TD>{pay_code}</TD></TR>
+                <!--{/if:payment_type}-->
+                <!--{if:payment_type=credit_card}-->
+                    <TR><TH ALIGN="right" valign="top">Credit Card:&nbsp;</TH><TD>{cctype_store} {ccnum_trunc}<br>exp: {ccmonth_store}/{ccyear_store}</TD></TR>
+                    <TR><TH ALIGN="right">Name on Card:&nbsp;</TH><TD>{ccname}</TD></TR>
+                    <TR><TH ALIGN="right">Auth Code:&nbsp;</TH><TD>{auth_code}</TD></TR>
+                <!--{/if:payment_type}-->
+    <!--{else:free_reg}
+                               <tr><td colspan="2">&nbsp;</td></tr>
+    {/if:free_reg}-->
+                  </table>
+                </TD>
+              </tr>
+  <!--{if:show_contact_data=YES}-->
+                               <tr><TH ALIGN="center" colspan="2"><NOBR>{contact_information_title}:</NOBR></TH></tr>
+                               <tr>
+                                       <TD valign="top" width="50%">
+                                               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                          <!--{if:use_contact_fname=YES}-->
+                                               <TR><TH ALIGN="right">{prompt_contact_fname}:&nbsp;</TH><TD>{contact_fname}</TD></TR>
+                          <!--{/if:use_contact_fname}-->
+                              <!--{if:use_contact_lname=YES}-->
+                                               <TR><TH ALIGN="right">{prompt_contact_lname}:&nbsp;</TH><TD>{contact_lname}</TD></TR>
+                          <!--{/if:use_contact_lname}-->
+                              <!--{if:use_contact_addr1=YES}-->
+                                               <TR><TH ALIGN="right">{prompt_contact_addr1}:&nbsp;</TH><TD>{contact_addr1}</TD></TR>
+                          <!--{/if:use_contact_addr1}-->
+                              <!--{if:use_contact_addr2=YES}-->
+                                           <!--{if:addr2}--><TR><TH ALIGN="right">{prompt_contact_addr2}:&nbsp;</TH><TD>{contact_addr2}</TD></TR><!--{/if:addr2}-->
+                          <!--{/if:use_contact_addr2}-->
+                              <!--{if:use_contact_city=YES}-->
+                                                   <TR><TH ALIGN="right">&nbsp;</TH><TD>{contact_city}, {contact_state} {contact_zip} {contact_country}</TD></TR>
+                          <!--{/if:use_contact_city}-->
+                              <!--{if:use_contact_phone=YES}-->
+                                               <TR><TH ALIGN="right">Phone:&nbsp;</TH><TD>{contact_phone}</TD></TR>
+                          <!--{/if:use_contact_phone}-->
+                              <!--{if:use_contact_fax=YES}-->
+                                               <TR><TH ALIGN="right">FAX:&nbsp;</TH><TD>{contact_fax}</TD></TR>
+                          <!--{/if:use_contact_fax}-->
+                                               </table>
+                                       </td>
+                                       <td width="50%">&nbsp;</td>
+                               </TR>
+  <!--{/if:show_contact_data}-->
+                     <tr><TH ALIGN="right">E-Mail:&nbsp;</TH><TD>{email}</TD></TR>
+       <!--{list:shoppingCart}-->
+              <tr>
+               <TD valign="top" colspan="2">
+                  <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <tr><th align="left">{word_Event}: </th><td colspan="2" align="left">{event_name}</td></tr>
+               <!--{if:have_location=YES}-->
+                                       <tr><th align="left">Location: </th><td colspan="2" align="left">{location}</td></tr>
+               <!--{/if:have_location}-->
+               <!--{if:date_specific=YES}-->
+                                       <tr><th align="left">Dates: </th><td colspan="2" align="left">{start_date} through {end_date}</td></tr>
+               <!--{/if:date_specific}-->
+               <!--{if:ask_date=YES}-->                                        
+                                       <tr>
+                                               <th align="left">Desired Date: </th>
+                                               <td colspan="2" align="left">{desired_date}</td>
+                                       </tr>
+               <!--{else:ask_date}
+                                       <tr>
+                                               <th align="left">Days: </th>
+                                               <td colspan="2" align="left">{days}</td>
+                                       </tr>
+               {/if:ask_date}-->
+                                       <tr><th align="left">Selected: </th><td colspan="2" align="left">{rate_class}</td></tr>
+                                       <tr><td colspan="3">&nbsp;</td></tr>
+                           <tr><th align="left">Charges</th><th align="right"><!--{if:need_attendees=YES}-->Per {word_Attendee}<!--{else:need_attendees}&nbsp;{/if:need_attendees}--></th><th align="right">Total</th></tr>
+                         <!--{list:charges}-->
+                           <tr><td align="left">{charge_title}</td><td align="right">{charge}</td><td align="right">{extend}</td></tr>
+                         <!--{sep:charges}-->
+                         <!--{/sep:charges}-->
+                           <tr><td align="left">{charge_title}</td><td align="right">{charge}</td><td align="right">{extend}</td></tr>
+                         <!--{/list:charges}-->
+                           <tr><th align="left">Total</th><td></td><td align="right">{totalCharges}</td></tr>
+                           <tr><td colspan="3">&nbsp;</td></tr>                            
+                 <!--{if:need_attendees=YES}-->
+            <!--{if:have_attendees=YES}-->
+             <!--{if:med_info=YES}-->
+                    <tr><th align="left" colspan="3">{word_Attendees}:&nbsp;&nbsp;</th></tr>      
+              <!--{list:attendees}-->
+                    <tr><td colspan="3" align="left">&nbsp;&nbsp;&nbsp;{name}</td></tr>
+                    <tr>
+                        <td colspan="3">
+                            <table border="0">
+                  <!--{if:have_dob=YES}-->
+                                <tr><td width="20">&nbsp;</td><th align="left">Date of Birth: </th><td>{dob}</tr>
+                  <!--{/if:have_dob}-->
+                  <!--{if:have_guardian=YES}-->
+                                <tr><td width="20">&nbsp;</td><th align="left">Parent/Guardian: </th><td>{guardian}</td></tr>
+                  <!--{/if:have_guardian}-->
+                  <!--{if:have_emer_contact=YES}-->
+                                <tr><td width="20">&nbsp;</td><th align="left">Emergency Contact: </th><td>{emer_contact}</td></tr>
+                  <!--{/if:have_emer_contact}-->
+                  <!--{if:have_emer_phone=YES}-->
+                                <tr><td width="20">&nbsp;</td><th align="left">Emergency Phone: </th><td>{emer_phone}</td></tr>
+                  <!--{/if:have_emer_phone}-->
+                  <!--{if:have_med_history=YES}-->
+                                <tr><td width="20">&nbsp;</td><th align="left">Brief Medical History: </th><td>{med_history}</td></tr>
+                  <!--{/if:have_med_history}-->
+                  <!--{if:have_allergy_med=YES}-->
+                                <tr><td width="20">&nbsp;</td><th align="left">Alergies/Medications: </th><td>{allergy_med}</td></tr>
+                  <!--{/if:have_allergy_med}-->
+                            </table>
+                        </td>
+                    </tr>
+              <!--{/list:attendees}-->
+             <!--{else:med_info}
+                    <tr><th align="left">{word_Attendees}:</th><td align="left" colspan="2">
+              <!--{list:attendees}-->
+                    {name}<!--{sep:attendees}-->, <!--{/sep:attendees}-->
+                    {name}      
+              <!--{/list:attendees}-->
+                    </td></tr>      
+             {/if:med_info}-->
+            <!--{/if:have_attendees}-->
+                 <!--{/if:need_attendees}-->
+                       <!--{if:have_mf_data=YES}-->
+                                       <tr><th align="left" colspan="3">&nbsp;</th></tr>
+                                       <tr><th align="center" colspan="3">Additional Data:</th></tr>
+                         <!--{list:mf_data}-->
+                                       <tr><th align="left" style="white-space: nowrap;">{indent}{title}:&nbsp;&nbsp;</th><td align="left" colspan="2">{txt_val}</td></tr>
+                         <!--{/list:mf_data}-->      
+                       <!--{/if:have_mf_data}-->
+                       
+                         </table>
+                         </TD>
+                       </tr>
+       <!--{/list:shoppingCart}-->
+              
+          </TABLE>
diff --git a/front-end/Views/registrations_summary.html b/front-end/Views/registrations_summary.html
new file mode 100644 (file)
index 0000000..e04bc25
--- /dev/null
@@ -0,0 +1,224 @@
+<!--{if:haveCustomStylesheet=YES}-->
+       <LINK REL="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/style.css">
+<!--{else:haveCustomStylesheet}
+       <LINK REL="stylesheet" HREF="{base_app_secure_url}Common/Registrations_V3/front-end/Views/style.css">
+{/if:haveCustomStylesheet}-->
+<!--{if:haveStylesheetOverride=YES}-->
+       <link type="text/css" rel="stylesheet" HREF="{base_secure_url}Toolkit/Registrations/front-end/Views/override.css">
+<!--{/if:haveStylesheetOverride}-->
+
+<div id="registrations">
+
+
+        <div id="regPageTopText">
+           <p>{regSummaryPageText}</p>
+        </div>
+
+    <p>Thank you for your request. Please print this page.</p>
+
+            <table border="1" cellspacing="0" cellpadding="5">
+     <!--{if:free_reg=YES}-->
+              <tr><TH ALIGN="center" colspan="2"><NOBR>Submitted by:</NOBR></TH></tr>
+     <!--{else:free_reg}
+              <tr><TH ALIGN="center" colspan="2"><NOBR>Bill to:</NOBR></TH></tr>
+     {/if:free_reg}-->
+              <tr>
+               <TD valign="top">
+                  <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                    <TR><TH align="left">Name:&nbsp;</TH><TD><!--{if:show_free_fname=YES}-->{fname} <!--{/if:show_free_fname}--><!--{if:show_free_lname=YES}-->{lname}<!--{/if:show_free_lname}--></TD></TR>
+                   <!--{if:show_free_addr1=YES}--><TR><TH align="left">Address:&nbsp;</TH><TD>{addr1}</TD></TR><!--{/if:show_free_addr1}-->
+                   <!--{if:show_free_addr2=YES}--><!--{if:addr2}--><TR><TH align="left">&nbsp;</TH><TD>{addr2}</TD></TR><!--{/if:addr2}--><!--{/if:show_free_addr2}-->
+                   <!--{if:show_free_cityzip=YES}--><TR><TH align="left">&nbsp;</TH><TD><!--{if:show_free_city=YES}-->{city}, <!--{/if:show_free_city}--><!--{if:show_free_state=YES}-->{state} <!--{/if:show_free_state}--><!--{if:show_free_zip=YES}-->{zip} <!--{/if:show_free_zip}--><!--{if:show_free_country=YES}-->{country}<!--{/if:show_free_country}--></TD></TR><!--{/if:show_free_cityzip}-->
+                    <!--{if:show_free_phone=YES}--><TR><TH align="left">Phone:&nbsp;</TH><TD>{phone}</TD></TR><!--{/if:show_free_phone}-->
+                    <!--{if:show_free_fax=YES}--><!--{if:fax}--><TR><TH align="left">FAX:&nbsp;</TH><TD>{fax}</TD></TR><!--{/if:fax}--><!--{/if:show_free_fax}-->
+                  </table>
+                </td>
+                <TD valign="top">
+                  <table border="0" cellspacing="0" cellpadding="0" width="100%">
+     <!--{if:free_reg=NO}-->
+                               <TR><TH align="left">Total Charges:&nbsp;</TH><TD>{grandTotal}</TD></TR>
+                    <TR><TH align="left">Payment Type:&nbsp;</TH><TD>{payment_type_text}</TD></TR>
+                <!--{if:payment_type=comp_code_DO_NOT_USE_NOW}-->
+                    <TR><TH align="left">Payment Code:&nbsp;</TH><TD>{pay_code}</TD></TR>
+                <!--{/if:payment_type}-->
+                <!--{if:payment_type=credit_card}-->
+                    <TR><TH align="left" valign="top">Credit Card:&nbsp;</TH><TD>{cctype_store} {ccnum_trunc}<br>exp: {ccmonth_store}/{ccyear_store}</TD></TR>
+                    <TR><TH align="left">Name on Card:&nbsp;</TH><TD>{ccname}</TD></TR>
+                    <TR><TH align="left">Auth Code:&nbsp;</TH><TD>{auth_code}</TD></TR>
+                <!--{/if:payment_type}-->
+    <!--{else:free_reg}
+                               <tr><td colspan="2">&nbsp;</td></tr>
+    {/if:free_reg}-->
+                  </table>
+                </TD>
+              </TR>
+  <!--{if:show_contact_data=YES}-->
+               <tr><TH ALIGN="center" colspan="2"><NOBR>{contact_information_title}:</NOBR></TH></tr>
+               <tr>
+                       <TD valign="top" width="50%" colspan="2">
+                               <table border="0" cellspacing="0" cellpadding="0">
+          <!--{if:use_contact_fname=YES}-->
+                               <TR><TH align="left">{prompt_contact_fname}:&nbsp;</TH><TD>{contact_fname}</TD></TR>
+          <!--{/if:use_contact_fname}-->
+       <!--{if:use_contact_lname=YES}-->
+                               <TR><TH align="left">{prompt_contact_lname}:&nbsp;</TH><TD>{contact_lname}</TD></TR>
+          <!--{/if:use_contact_lname}-->
+       <!--{if:use_contact_addr1=YES}-->
+                               <TR><TH align="left">{prompt_contact_addr1}:&nbsp;</TH><TD>{contact_addr1}</TD></TR>
+          <!--{/if:use_contact_addr1}-->
+       <!--{if:use_contact_addr2=YES}-->
+                           <!--{if:addr2}--><TR><TH align="left">{prompt_contact_addr2}:&nbsp;</TH><TD>{contact_addr2}</TD></TR><!--{/if:addr2}-->
+          <!--{/if:use_contact_addr2}-->
+       <!--{if:use_contact_city=YES}-->
+                           <TR><TH align="left">&nbsp;</TH><TD>{contact_city}, {contact_state} {contact_zip} {contact_country}</TD></TR>
+          <!--{/if:use_contact_city}-->
+       <!--{if:use_contact_phone=YES}-->
+                               <TR><TH align="left">Phone:&nbsp;</TH><TD>{contact_phone}</TD></TR>
+          <!--{/if:use_contact_phone}-->
+       <!--{if:use_contact_fax=YES}-->
+                               <TR><TH align="left">FAX:&nbsp;</TH><TD>{contact_fax}</TD></TR>
+          <!--{/if:use_contact_fax}-->
+                               </table>
+                       </td>
+               </TR>
+  <!--{/if:show_contact_data}-->
+                               <tr><TH ALIGN="center" colspan="2"><NOBR>Additional Information:</NOBR></TH></tr>
+               <tr>
+                       <TD valign="top" width="50%" colspan="2">
+                               <table border="0" cellspacing="0" cellpadding="0">
+                                       <TH align="left" width="10px">E-Mail:&nbsp;</TH><TD>{email}</TD></TR>
+                               </table>
+                               </td>
+                       </tr>
+       <!--{list:shoppingCart}-->
+              <tr>
+               <TD valign="top" colspan="2">
+                  <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                       <tr>
+                                               <th class="thCartLeft">{word_Event}: </th>
+                                               <td class="tdCartLeft" colspan="2">{event_name}</td>
+                                       </tr>
+               <!--{if:have_location=YES}-->
+                                       <tr>
+                                               <th class="thCartLeft">Location: </th>
+                                               <td class="tdCartLeft" colspan="2">{location}</td>
+                                       </tr>
+               <!--{/if:have_location}-->
+               <!--{if:date_specific=YES}-->
+                                       <tr>
+                                               <th class="thCartLeft">Dates: </th>
+                                               <td class="tdCartLeft" colspan="2">{start_date} through {end_date}</td>
+                                       </tr>
+               <!--{/if:date_specific}-->
+               <!--{if:ask_date=YES}-->                                        
+                                       <tr>
+                                               <th align="left">Desired Date: </th>
+                                               <td colspan="2" align="left">{desired_date}</td>
+                                       </tr>
+               <!--{else:ask_date}
+                                       <tr>
+                                               <th align="left">Days: </th>
+                                               <td colspan="2" align="left">{days}</td>
+                                       </tr>
+               {/if:ask_date}-->
+                                       <tr>
+                                               <th class="thCartLeft">Selected: </th>
+                                               <td class="tdCartLeft" colspan="2">{rate_class}</td>
+                                       </tr>
+                                       <tr><td colspan="3">&nbsp;</td></tr>
+                           <tr>
+                               <th class="thCartLeft">Charges</th>
+                               <th class="thCartRight"><!--{if:need_attendees=YES}-->Per {word_Attendee}<!--{else:need_attendees}&nbsp;{/if:need_attendees}--></th>
+                               <th class="thCartRight">Total</th>
+                       </tr>
+                         <!--{list:charges}-->
+                           <tr>
+                               <td class="tdCartLeft">{charge_title}</td>
+                               <td class="tdCartRight">{charge}</td>
+                               <td class="tdCartRight">{extend}</td>
+                       </tr>
+                         <!--{sep:charges}-->
+                         <!--{/sep:charges}-->
+                           <tr>
+                               <td class="tdCartLeft">{charge_title}</td>
+                               <td class="tdCartRight">{charge}</td>
+                               <td class="tdCartRight">{extend}</td>
+                       </tr>
+                         <!--{/list:charges}-->
+                           <tr>
+                               <th class="thCartLeft">Total</th>
+                               <td></td>
+                               <td class="tdCartRight">{totalCharges}</td>
+                       </tr>
+                           <tr><td colspan="3">&nbsp;</td></tr>        
+                 <!--{if:need_attendees=YES}-->
+                       <!--{if:have_attendees=YES}-->
+                        <!--{if:med_info=YES}-->
+                    <tr>
+                       <th class="thCartLeft" colspan="3">{word_Attendees}:</th>
+                       </tr>      
+              <!--{list:attendees}-->
+                    <tr>
+                       <td class="tdCartLeft" colspan="3">&nbsp;&nbsp;&nbsp;{name}</td>
+                       </tr>
+                    <tr>
+                        <td colspan="3">
+                            <table border="0">
+                  <!--{if:have_dob=YES}-->
+                                <tr><td width="20">&nbsp;</td><th align="left">Date of Birth: </th><td>{dob}</td></tr>
+                  <!--{/if:have_dob}-->
+                  <!--{if:have_guardian=YES}-->
+                                <tr><td width="20">&nbsp;</td><th align="left">Parent/Guardian: </th><td>{guardian}</td></tr>
+                  <!--{/if:have_guardian}-->
+                  <!--{if:have_emer_contact=YES}-->
+                                <tr><td width="20">&nbsp;</td><th align="left">Emergency Contact: </th><td>{emer_contact}</td></tr>
+                  <!--{/if:have_emer_contact}-->
+                  <!--{if:have_emer_phone=YES}-->
+                                <tr><td width="20">&nbsp;</td><th align="left">Emergency Phone: </th><td>{emer_phone}</td></tr>
+                  <!--{/if:have_emer_phone}-->
+                  <!--{if:have_med_history=YES}-->
+                                <tr><td width="20">&nbsp;</td><th align="left">Brief Medical History: </th><td>{med_history}</td></tr>
+                  <!--{/if:have_med_history}-->
+                  <!--{if:have_allergy_med=YES}-->
+                                <tr><td width="20">&nbsp;</td><th align="left">Alergies/Medications: </th><td>{allergy_med}</td></tr>
+                  <!--{/if:have_allergy_med}-->
+                            </table>
+                        </td>
+                    </tr>
+              <!--{/list:attendees}-->
+             <!--{else:med_info}
+                    <tr>
+                       <th class="thCartLeft">{word_Attendee}:</th>
+                       <td class="tdCartLeft" colspan="2">
+              <!--{list:attendees}-->
+                               {name}<!--{sep:attendees}-->, <!--{/sep:attendees}-->
+                               {name}      
+              <!--{/list:attendees}-->
+                       </td>
+                       </tr>      
+             {/if:med_info}-->
+                       <!--{/if:have_attendees}-->
+                 <!--{/if:need_attendees}-->
+                       
+                       <!--{if:have_mf_data=YES}-->
+                                       <tr><th align="left" colspan="3">&nbsp;</th></tr>
+                                       <tr>
+                                               <th align="center" colspan="3">Additional Data:</th>
+                                       </tr>
+                         <!--{list:mf_data}-->
+                                       <tr>
+                                               <th class="thCartLeft"><nobr>{indent}{title}:&nbsp;&nbsp;</nobr></th>
+                                               <td class="tdCartLeft" colspan="2">{txt_val}</td>
+                                       </tr>
+                         <!--{/list:mf_data}-->      
+                       <!--{/if:have_mf_data}-->
+                       
+                         </table>
+                         </TD>
+                       </tr>
+       <!--{/list:shoppingCart}-->
+              
+          </TABLE>
+
+
+</div><!-- /#registrations -->
diff --git a/front-end/Views/style.css b/front-end/Views/style.css
new file mode 100644 (file)
index 0000000..efa4e60
--- /dev/null
@@ -0,0 +1,188 @@
+/* All buttons */
+a.button {
+       display: inline-block;
+       border: 1px solid rgba(128, 128, 128, .2);
+       border-radius: 5px;
+       color: white;
+       text-decoration: none;
+       font-weight: bold;
+       }
+.button span {
+       padding: 3px 3px 3px 8px;
+       margin-left: 27px;
+       display: inline-block;
+       background: rgba(128, 128, 128, .0);
+       border-left: 1px solid rgba(255, 255, 255, .4);
+       }
+/* Shopping Cart */
+.showcart {
+       background: #808080 url(../../assets/basket.png) no-repeat 5px 2px;
+       background: rgba(128, 128, 128, .5) url(../../assets/basket.png) no-repeat 5px 2px;
+       width: 120px;
+       margin: 10px 10px 10px 0px;
+}
+a.showcart:hover {
+       border: 1px solid rgba(128, 128, 128, 1);
+       background-color: rgba(128, 128, 128, 1);
+       }
+a.showcart:hover span {
+       border-left: 1px solid rgba(128, 128, 128, 0);
+       background: rgba(128, 128, 128, 0);
+       }
+/* Book Now Button */
+.booknow {
+       background: #808080 url(../../assets/add.png) no-repeat 5px 2px;
+       background: rgba(128, 128, 128, .5) url(../../assets/add.png) no-repeat 5px 5px;
+       width: 150px;
+       margin: 10px 10px 10px 0px;
+       float:right;
+}
+a.booknow:hover {
+       border: 1px solid rgba(128, 128, 128, 1);
+       background-color: rgba(128, 128, 128, 1);
+       }
+a.booknow:hover span {
+       border-left: 1px solid rgba(128, 128, 128, 0);
+       background: rgba(128, 128, 128, 0);
+       }
+/* Select More Button */
+.selectmore {
+       background: #808080 url(../../assets/arrow_left.png) no-repeat 5px 5px;
+       background: rgba(128, 128, 128, .5) url(../../assets/arrow_left.png) no-repeat 5px 5px;
+       width: 120px;
+       margin: 10px 10px 10px 0px;
+}
+a.selectmore:hover {
+       border: 1px solid rgba(128, 128, 128, 1);
+       background-color: rgba(128, 128, 128, 1);
+       }
+a.selectmore:hover span {
+       border-left: 1px solid rgba(128, 128, 128, 0);
+       background: rgba(128, 128, 128, 0);
+       }
+/* Remove Button */
+.remove {
+       background: #808080 url(../../assets/cancel.png) no-repeat 5px 5px;
+       background: rgba(128, 128, 128, .5) url(../../assets/cancel.png) no-repeat 5px 5px;
+       width: 120px;
+       margin: 5px 0px 0px 0px;
+}
+a.remove:hover {
+       border: 1px solid rgba(128, 128, 128, 1);
+       background-color: rgba(128, 128, 128, 1);
+       }
+a.remove:hover span {
+       border-left: 1px solid rgba(128, 128, 128, 0);
+       background: rgba(128, 128, 128, 0);
+       }
+/* Checkout Button */
+.checkout {
+       background: #808080 url(../../assets/tick.png) no-repeat 5px 3px;
+       background: rgba(128, 128, 128, .5) url(../../assets/tick.png) no-repeat 5px 3px;
+       width: 120px;
+       margin: 10px 10px 10px 0px;
+       }
+a.checkout:hover {
+       border: 1px solid rgba(128, 128, 128, 1);
+       background-color: rgba(128, 128, 128, 1);
+       }
+a.checkout:hover span {
+       border-left: 1px solid rgba(128, 128, 128, 0);
+       background: rgba(128, 128, 128, 0);
+       }
+/* Misc Wide Button */
+.wide {
+       background: rgba(128, 128, 128, .5);
+       /*width: 220px;*/
+       margin: 10px 10px 10px 0px;
+       }
+a.wide:hover {
+       border: 1px solid rgba(128, 128, 128, 1);
+       background-color: rgba(128, 128, 128, 1);
+       }
+a.wide:hover span {
+       border-left: 1px solid rgba(128, 128, 128, 0);
+       background: rgba(128, 128, 128, 0);
+       }
+
+       /* Images */
+.regImage {
+       float: right;
+       margin: 0 0 20px 20px;
+       }
+
+
+.thCartRight {
+       text-align: right;
+}
+
+.thCartLeft {
+       text-align: left;
+}
+
+.tdCartRight {
+       text-align: right;
+}
+
+.tdCartLeft {
+       text-align: left;
+}
+
+.regWarning {
+    color: red;
+}
+.regRequired {
+       color: red;
+       padding-right: 5px;
+}
+.regFieldName {
+       padding-right: 5px;
+}
+.regItem {
+       clear: both;
+    margin-bottom: 10px;
+}
+.regImage {
+       float: right;
+    margin-bottom: 5px;
+    margin-left: 10px;
+}
+.regListItem {
+       margin-left: 10px;
+    margin-bottom: 5px;
+}
+.required {
+       color: red;
+}
+.inputStandard {
+}
+.inputMedium {
+       width: 240px;
+}
+.inputLarge {
+       width: 420px;
+}
+.adminUser {
+       font-size: 14px;
+       color: red;
+       padding: 10px;
+    border-style: solid;
+    border-width: 1px;
+    border-color: black;
+}
+#pleaseWait {
+        visibility: hidden; 
+        display: none; 
+        font-weight: bold;
+     background-color: rgba(128, 128, 128, .5);
+     color: white;
+        padding: 8px;
+        border: 1px solid black;
+}
+.lightBorder {
+       font-size: 14px;
+       padding: 10px;
+    border-style: solid;
+    border-width: 1px;
+    border-color: black;
+}
\ No newline at end of file
diff --git a/front-end/calendar.phtml b/front-end/calendar.phtml
new file mode 100644 (file)
index 0000000..af131bc
--- /dev/null
@@ -0,0 +1,297 @@
+<?
+
+/********************************************************************************
+ *
+ *    FILE: calendar.phtml
+ *
+ *    Copyright (C) 2002 - Gaslight Media - All Rights Reserved
+ *
+ *
+ *    Displays a Java enabled calendar with a selected range of dates that can
+ *    be clicked to stuff that date value into a form field in the calling window.
+ *
+ *    Parameters supplied:
+ *        $cur_month    Month to display (if empty use selected_date)
+ *        $cur_year    Year to display (if empty use selected_date)
+ *        $selected_date    Timestamp of date to have selected by default
+ *        $start_date    Timestamp of first selectable date
+ *        $end_date    Timestamp of last selectable date
+ *        $form_name    Name of calling form
+ *        $field_name    Base name of field where selected values are inserted
+ *        $no_earlier    Optional date (supplied as text) the selected_date should be no earlier than
+ *        $out_style    Optional Output setup style
+ *                  "text" = Single text field (default)
+ *                  "pick" = Month, Day, Year pick-lists
+ *
+ *
+ ********************************************************************************/
+
+require_once "reg_setup.php";
+require_once "reg_functions.inc";
+
+define( 'THIS_SCRIPT', BASE_URL."admin/Registrations/index.php");
+
+$MonthNames = array(1=>'January','February','March','April','May','June','July','August','September','October','November','December');
+
+$error = "";
+
+$start_date = filter_request('start_date', FILTER_SANITIZE_STRING);
+$end_date   = filter_request('end_date', FILTER_SANITIZE_STRING);
+$form_name  = filter_request('form_name', FILTER_SANITIZE_STRING);
+$field_name = filter_request('field_name', FILTER_SANITIZE_STRING);
+$cur_month  = filter_request('cur_month', FILTER_SANITIZE_STRING);
+$cur_year   = filter_request('cur_year', FILTER_SANITIZE_STRING);
+$selected_date  = filter_request('selected_date', FILTER_SANITIZE_STRING);
+$start_date  = filter_request('start_date', FILTER_SANITIZE_STRING);
+$end_date  = filter_request('end_date', FILTER_SANITIZE_STRING);
+$form_name  = filter_request('form_name', FILTER_SANITIZE_STRING);
+
+if( empty($start_date) )
+    $error .= "Missing Start Date<BR>";
+if( empty($end_date) )
+    $error .= "Missing End Date<BR>";
+if( empty($form_name) )
+    $error .= "Missing Form Name<BR>";
+if( empty($field_name) )
+    $error .= "Missing Field Name<BR>";
+
+if( !empty( $error ) )
+    {
+    echo "ERROR:<BR>".$error;
+    exit;
+    }
+
+if( trim($selected_date) == '' )
+    $selected_date = $start_date;
+  else
+    $selected_date = strtotime( $selected_date );
+
+if( $selected_date < $start_date )
+    $selected_date = $start_date;
+if( $selected_date > $end_date )
+    $selected_date = $end_date;
+
+    // If there is a no_ealier date - check it against supplied selected date
+
+if( !empty($no_earlier) )
+    {
+    $no_earlier_timestamp = strtotime( $no_earlier );
+    if( $no_earlier_timestamp > $selected_date )
+        $selected_date = $no_earlier_timestamp;
+    }
+
+$selected     = getdate( $selected_date );
+$start        = getdate( $start_date );
+$end        = getdate( $end_date );
+
+    // If this is the first time we're called, then the currently selected month is
+    // the same as that of the selected date.
+
+if( empty($cur_month) )
+    $cur_month = $selected["mon"];
+if( empty($cur_year) )
+    $cur_year = $selected["year"];
+
+// $YearToShow     = $selected["year"];
+// $MonthToShow     = $selected["mon"];
+// $DayToShow     = $selected["mday"];
+
+
+    // Display calendar header and days
+
+echo '<HTML>
+        <HEAD>
+            <TITLE>Calendar</TITLE>
+            <SCRIPT LANGUAGE="javascript1.1">
+                <!--
+                function datejump(form)
+                    {
+                    var myindex=form.dateselect.selectedIndex;
+                    if( form.dateselect.options[myindex].value != \'0\' )
+                        {
+                        location = form.dateselect.options[myindex].value;
+                        }
+                    }
+                function changeloc(url)
+                    {
+                    location = url;
+                    }
+                function senddate( month, day, year)
+                    {
+                    if( window.opener.document.'.$form_name.'.'.$field_name.'_month )
+                        window.opener.document.'.$form_name.'.'.$field_name.'_month.value=month;
+                    if( window.opener.document.'.$form_name.'.'.$field_name.'_day )
+                        window.opener.document.'.$form_name.'.'.$field_name.'_day.value=day;
+                    if( window.opener.document.'.$form_name.'.'.$field_name.'_year )
+                        window.opener.document.'.$form_name.'.'.$field_name.'_year.value=year;
+                    if( window.opener.document.'.$form_name.'.'.$field_name.' )
+                        window.opener.document.'.$form_name.'.'.$field_name.'.value=month+"/"+day+"/"+year;
+                    self.close()
+                    }
+                -->
+            </SCRIPT>
+            <STYLE TYPE="text/css">
+                <!--
+                th {   font-size: 10px; background-color: '. SI_CAL_DATE.'; font-weight: bold; }
+                td.h { font-size: 10px; background-color: '. SI_CAL_HEAD.'; }
+                td.n { font-size: 10px; background-color: '. SI_CAL_NODATE.'; }
+                td.d { font-size: 10px; background-color: '. SI_CAL_TODAY.'; }
+                td.t { font-size: 10px; background-color: '. SI_CAL_DATE .'; }
+                td.z { font-size: 16px; background-color: '. SI_CAL_TABLE .'; }
+                td.f {}
+                select { font-size: 12px; font-family: monospace; }
+                option { font-size: 12px; font-family: monospace; }
+                //-->
+            </STYLE>
+        </HEAD>
+    <BODY BGCOLOR="'.$color_bkgd.'">
+    <form name="jumpdate">
+    <TABLE BORDER="1" CELLPADDING="1" CELLSPACING="0" ALIGN="center" BGCOLOR="'.$color_table.'">
+        <TR>
+            <TD CLASS="z" COLSPAN="7" ALIGN="center">
+                    <select name="dateselect" onchange="datejump(this.form)">
+    ';
+
+$m = $start["mon"];
+$y = $start["year"];
+while( $m/100+$y <= $end["mon"]/100+$end["year"] )
+    {
+    $newURL = THIS_SCRIPT."?route_app=calendar_popup&cur_month=$m&cur_year=$y&selected_date=$selected_date&start_date=$start_date&end_date=$end_date&form_name=$form_name&field_name=$field_name";
+    echo '<option value="'.$newURL.'" '.($m==$cur_month&&$y==$cur_year?'SELECTED':'').'>'.str_pad($month_array[$m],10,'.',STR_PAD_RIGHT).$y.'</option>
+        ';
+    if( ++$m == 13 )
+        {
+        $m = 1;
+        $y++;
+        }
+    }
+
+echo '                </select>
+    ';
+echo prevnext($cur_month,$cur_year,$selected_date,$form_name,$field_name,$start_date,$end_date,$start,$end);
+echo '</TD>
+
+        </TR>
+        <TR ALIGN="center">
+            <TH CLASS="h">Sun</TH>
+            <TH CLASS="h">Mon</TH>
+            <TH CLASS="h">Tue</TH>
+            <TH CLASS="h">Wed</TH>
+            <TH CLASS="h">Thu</TH>
+            <TH CLASS="h">Fri</TH>
+            <TH CLASS="h">Sat</TH>
+        </TR>
+        <TR ALIGN="center">
+     ';
+
+    // Display blanks up to first day of the month
+
+$offset = date( "w", mktime( 0, 0, 0, $cur_month, 1, $cur_year )  );
+if( $offset > 0 )
+    echo str_repeat( "<TD CLASS=\"n\">&nbsp;</TD>\n",$offset );
+
+    // For each day of the month
+
+$NumberOfDays = date( "t", mktime( 0, 0, 0, $cur_month, 1, $cur_year ) );
+for( $i=1 ; $i<=$NumberOfDays ; $i++ )
+    {
+    $this_date = mktime( 0, 0, 0, $cur_month, $i, $cur_year );
+    $DayOfWeek = date( "w", $this_date );
+
+        // Start a new row each Sunday, unless it's the 1st of the month
+
+    if( $DayOfWeek == 0 && $i != 1 )
+        {
+        print "</TR><TR ALIGN=\"center\">\n";
+        }
+
+        // If we're not at the default selected date, display date normally
+
+    if( $i != $selected["mday"] || $cur_month != $selected["mon"] || $cur_year != $selected["year"] )
+        $this_date_style = "t";
+        else
+            $this_date_style = "d";
+
+        // If the date we're displaying is within the start/end range
+
+    if( ($this_date > $start_date-86400) && ($this_date < $end_date) )
+            echo "<TD CLASS=\"".$this_date_style."\"><A HREF=\"javascript:senddate('".$cur_month."','".$i."','".$cur_year."')\">$i</A></TD>\n";
+        else
+            print "<TD CLASS=\"n\">$i</TD>\n";
+
+    }
+
+
+if( ( ($offset == 5) && ($NumberOfDays > 30) ) || ( ($offset == 6) && ($NumberOfDays > 29) ) )
+    {
+    if( 42-$NumberOfDays-$offset > 0 )
+        {
+        echo str_repeat( "<TD CLASS=\"n\">&nbsp;</TD>\n",42-$NumberOfDays-$offset );
+        }
+    print "</TR>\n";
+    }
+    elseif( ($NumberOfDays != 28) || ($offset > 0) )
+        {
+    if (35-$NumberOfDays-$offset > 0)
+        {
+        echo str_repeat("<TD CLASS=\"n\">&nbsp;</TD>\n",35-$NumberOfDays-$offset);
+        print "</TR>\n";
+        }
+    }
+
+echo '            </TABLE>
+            </FORM>
+        </BODY>
+    </HTML>
+    ';
+
+function prevnext($cur_month,$cur_year,$selected_date,$form_name,$field_name,$start_date,$end_date,$start,$end)
+    {
+        // If there's prior month(s)
+
+    if( mktime( 0, 0, 0, $cur_month, 1, $cur_year ) > mktime( 0, 0, 0, $start["mon"], 1, $start["year"] ) )
+        {
+        $prev_month = $cur_month -1;
+        $prev_year = $cur_year;
+        if( $prev_month == 0 )
+            {
+            $prev_month = 12;
+            $prev_year--;
+            }
+
+        $newURL = THIS_SCRIPT."?route_app=calendar_popup&cur_month=$prev_month&cur_year=$prev_year&selected_date=$selected_date&start_date=$start_date&end_date=$end_date&form_name=$form_name&field_name=$field_name";
+
+        $back = "<A HREF=\"javascript:changeloc('".$newURL."')\"><< Back</A>";
+        }
+      else
+        $back = "<< Back";
+
+
+        // If there's a next month
+
+    if( mktime( 0, 0, 0, $cur_month, 1, $cur_year ) < mktime( 0, 0, 0, $end["mon"], 1, $end["year"] ) )
+        {
+        $next_month = $cur_month +1;
+        $next_year = $cur_year;
+        if( $next_month == 13 )
+            {
+            $next_month = 1;
+            $next_year++;
+            }
+        $newURL = THIS_SCRIPT."?route_app=calendar_popup&cur_month=$next_month&cur_year=$next_year&selected_date=$selected_date&start_date=$start_date&end_date=$end_date&form_name=$form_name&field_name=$field_name";
+        $next = "<A HREF=\"javascript:changeloc('".$newURL."')\">Next >></A>";
+        }
+      else
+        $next = "Next >>";
+
+    $output = '<Table width="100%" border="0">
+                <tr>
+                    <td CLASS="h" align="left">'.$back.'</td>
+                    <td CLASS="h" align="right">'.$next.'</td>
+                </tr>
+            </table>';
+    // $output .= "<!-- Debug: CurMnth=".$cur_month." CurYr=".$cur_year." -->\n";
+    return $output;
+    }
+
+?>
diff --git a/front-end/category_select_popup.phtml b/front-end/category_select_popup.phtml
new file mode 100644 (file)
index 0000000..df527b0
--- /dev/null
@@ -0,0 +1,414 @@
+<?
+/**
+ * Gaslight Media - Category Selection Pop-Up
+ * 
+ * Copyright (c) 2000-2004 by Gaslight Media Inc.
+ * 
+ * Call this application as a pop-up to display category selection in the
+ * form of a set up links that when clicked updates a specified form field in
+ * the parent window. 
+ * 
+ * Supplied Parameters:
+ * 
+ *             $table                  Name of category table in database
+ *             $field_name             Name of the target field in the parent window
+ *                                                     Populates {field_name}_ID with ID of node
+ *                                                     Populates {field_name}_NAME with Name of node
+ *             $check_tables   Table/field names that need to be checked before deleting a category
+ *                                                     format: t~f|t~f|t~f|...
+ *                                                     where:  t = name of a table and f is the field in that table that needs to be checked
+ *             $options                Set of control options (see below)
+ *             $id                             ID of currently selected category
+ *             $title                  Title to display at top of page
+ *             $pop_width              Pop-up Width
+ *             $pop_height             Pop-up Height
+ *             $edit_width             Edit Width
+ *             $edit_height    Edit Height
+ *             $ref_id                 Reference ID to use when noselfref option is enabled
+ * 
+ * Options:                            A "~" separated list of options
+ * 
+ *             limited                 Explode only siblings, parents and siblings of
+ *                                             parents
+ *             add                             Let user add a new category
+ *             edit                    Let user edit categories
+ *     delete                  Let user delete category
+ *             fullpath                Display full category path
+ *             noselfref               Don't let user select the current category or any under it
+ *                                                     Prevents circular category references that screw things up
+ *             
+ *             
+ */
+
+       // Get Siteinfo Data
+
+include( "../siteinfo.inc" );
+include( SI_BASE_PATH."/functions.inc" ); 
+
+echo '<html>
+                 <head>
+                   <meta http-equiv="Content-Language" content="en" />
+                   <meta name="GENERATOR" content="PHPEclipse 1.0" />
+                   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+                   <title>Gaslight Media - Category Selection</title>
+<style>
+A:link
+       {
+    FONT-SIZE: 11px;
+    COLOR: #006bb7;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
+    TEXT-DECORATION: underline
+       }
+A:visited
+       {
+    FONT-SIZE: 11px;
+    COLOR: #666666;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
+       }
+A:active
+       {
+    FONT-SIZE: 11px;
+    COLOR: #ee3a42;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
+       }
+A:hover
+       {
+    FONT-SIZE: 11px;
+    COLOR: #006bb7;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
+       }
+P
+       {
+    FONT-SIZE: 11px;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
+       }
+TD
+       {
+    FONT-SIZE: 10px;
+    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
+       }
+</style>
+                       <SCRIPT LANGUAGE="javascript1.1">
+                               <!--
+                               function set_selected_node( cat_id, cat_name )
+                                       {
+                                       if( window.opener.document.getElementById(\''.$field_name.'_NAME\') )
+                                               window.opener.document.getElementById(\''.$field_name.'_NAME\').value = cat_name;
+//                                     if( window.opener.document.getElementById(\''.$field_name.'\') )
+                                               window.opener.document.getElementById(\''.$field_name.'\').value = cat_id;
+                                       self.close()
+                                       }
+                               -->
+                       </SCRIPT>
+                 </head>
+                 <body bgcolor="#FFFFFF" text="#000000" link="#FF9966" vlink="#FF9966" alink="#FFCC99">
+               ';
+
+
+
+       // If no ID was supplied assume id=0 (mythical root), otherwise get data
+
+if( empty($id) )
+       {
+       $id = 0;
+       $def_cat_data = false;
+       }
+  else
+       $def_cat_data = cat_get_node( $table, $qs = "id = $id" );
+
+       // If no reference ID was supplied assume 0 (mythical root), otherwise get data
+
+if( empty($ref_id) )
+       {
+       $ref_id = 0;
+       $def_ref_data = false;
+       }
+  else
+       $def_ref_data = cat_get_node( $table, $qs = "id = $ref_id" );
+
+
+       // Build link data to pass on
+
+       
+$link_data = "table=$table&field_name=$field_name&options=$options&selected=&title=".urlencode($title)."&edit_width=$edit_width&edit_height=$edit_height&pop_width=$pop_width&pop_height=$pop_height&ref_id=$ref_id";
+$func_data = "table.$table|field_name.$field_name|options.$options|selected.|title.".urlencode($title)."|edit_width.$edit_width|edit_height.$edit_height|pop_width.$pop_width|pop_height.$pop_height|ref_id.$ref_id";
+$form_data = '<INPUT TYPE="hidden" NAME="table" VALUE="'.$table.'">
+                         <INPUT TYPE="hidden" NAME="field_name" VALUE="'.$field_name.'">
+                         <INPUT TYPE="hidden" NAME="options" VALUE="'.$options.'">
+                         <INPUT TYPE="hidden" NAME="selected" VALUE="'.$selected.'">
+                         <INPUT TYPE="hidden" NAME="title" VALUE="'.$title.'">
+                         <INPUT TYPE="hidden" NAME="edit_width" VALUE="'.$cat_edit_width.'">
+                         <INPUT TYPE="hidden" NAME="edit_height" VALUE="'.$cat_edit_height.'">
+                         <INPUT TYPE="hidden" NAME="pop_width" VALUE="'.$pop_width.'">
+                         <INPUT TYPE="hidden" NAME="pop_height" VALUE="'.$pop_height.'">
+                         <INPUT TYPE="hidden" NAME="ref_id" VALUE="'.$ref_id.'">
+                        ';
+
+       // Determine Options Selected
+       
+$opt_limited = $opt_add = $opt_edit = $opt_delete = $opt_fullpath = $opt_selfullpath = $opt_noselfref = $FALSE;
+
+if( trim($options) != '' )
+       {
+       $opts = explode( "~", $options );
+       if( is_array($opts) )
+               {
+               foreach( $opts as $opt )
+                       {
+                       switch( $opt )
+                               {               
+               
+                               case "limited":         $opt_limited = TRUE;            break;          // Display minimally expanded category list with "+" expansion links
+                               case "add":                     $opt_add = TRUE;                        break;          // Enable ability for user to add additional categories
+                               case "edit":            $opt_edit = TRUE;                       break;          // Enable ability for user to edit categories
+                               case "delete":          $opt_delete = TRUE;                     break;          // Enable ability for user to delete categories
+                               case "fullpath":        $opt_fullpath = TRUE;           break;          // Return full category path and name into displayed field                      
+                               case "selfullpath":     $opt_selfullpath = TRUE;        break;          // Display category path and name rather than indented for selection
+                               case "noselfref":       $opt_noselfref = TRUE;          break;          // Don't permit selection of self or below
+                                                       
+                               default:
+                                       echo "ERROR: Option \"$opt\" is not known!";
+                                       exit;
+                                       break;
+                               }
+                       }
+               }
+       }               
+
+
+switch( $Action )
+       {
+       
+       case "Edit":
+               echo "<script language=\"JavaScript1.2\">
+                               <!--
+                                       this.window.resizeTo( $edit_width, $edit_height );
+                               -->
+                         </script>
+                        ";
+               break;
+               
+       default:
+               echo "<script language=\"JavaScript1.2\">
+                               <!--
+                                       this.window.resizeTo( $pop_width, $pop_height );
+                               -->
+                         </script>
+                        ";
+               break;
+       };
+
+switch( $Action )
+       {
+       
+       case "Edit":
+       
+               echo '<A HREF="'.SI_THIS_SCRIPT.'?id='.$id.'&'.$link_data.'" NAME="test" STYLE="TEXT-DECORATION: none;">[Return to category selection]</A><P>';
+
+               if( $Option == "Add" )
+                       $parent = $id;
+                       
+               if( $Option == "Add" || $Option == "Edit" )
+                       {
+                       if( ($cat_data = cat_get_node( $table, $qs = "id = $parent" ) ) )
+                               echo '<B>Sub Category of:</B> <FONT COLOR="blue">'.$cat_data['cat_fullpath'].'</FONT><P>';
+                         else
+                               echo '<B>Top Level Category</B><P>';
+                       }
+                               
+               if( $Option == 'Delete' )
+                       {
+                       if( ($children = cat_get_nodes( $table, "parent = $id" )) )
+                               {
+                               echo '<TABLE BORDER="1" CELLSPACING="0" CELLPADDING="4">
+                                               <TR>
+                                                       <TD ALIGN="center">
+                                                               <FONT COLOR="red">Unable to Delete Category:</FONT><BR>
+                                                               This category has child category entries. You must delete all children first.
+                                                       </TD>
+                                               </TR>
+                                         </TABLE><P>';
+                               break;
+                               }
+                       
+                               // Check any other specified tables for reference to this category
+                       
+                       if( trim($check_tables) != '' )
+                               {
+                               if( is_array($tables = explode( "|", $check_tables )) )
+                                       {
+                                       foreach( $tables as $t )
+                                               {
+                                               if( is_array($x = explode( "~", $t )) )
+                                                       {
+                                                       if( db_auto_get_row( "SELECT COUNT(id) FROM ".$x[0]." WHERE ".$x[1]." = $id;", 0, SI_CONN_STR, FALSE ) )
+                                                                       {
+                                                                       echo '<TABLE BORDER="1" CELLSPACING="0" CELLPADDING="4">
+                                                                                       <TR>
+                                                                                               <TD ALIGN="center">
+                                                                                                       <FONT COLOR="red">Unable to Delete Category:</FONT><BR>
+                                                                                                       This category is in use by the application.
+                                                                                               </TD>
+                                                                                       </TR>
+                                                                                 </TABLE><P>';
+                                                                       break;                                                                          
+                                                                       }
+                                                       }
+                                               }
+                                       }
+                                       
+                               }
+                       }
+         
+               admin_process_records
+                       ( 
+                       $table,                                                         // Table
+                       '',                                                                     // Where
+                       '',                                                                     // Order fields
+                       SI_CONN_STR,                                            // Connect String
+                       $id,                                                            // Current ID
+                       ${'si_category_'.$table},                       // Fields array
+                       'add,edit,delete,strong',                                       // Options
+                       20,                                                             // Rows
+                       SI_THIS_SCRIPT,                                         // URL
+                       'Edit',                                                         // Action
+                       $func_data."|id.$id",                           // Passed parameter
+                       'Category',                                             // Base Title
+                       '',                                                             // View string 
+                       $Option,                                                        // Option
+                       $start                                                          // Starting row for lists 
+                       );
+                       
+               break;                  
+               
+               // Display available nodes
+
+       default:
+               
+                       // Get Nodes
+                       
+               if( $opt_limited )      
+                       $r = cat_get_expanded_nodes( $table, $id );
+                 else
+                       $r = cat_get_nodes( $table );
+                       
+                       // Display list of nodes
+
+               $self_ref_notice = false;
+               
+               echo '<TABLE BORDER="0" WIDTH="100%" CELLPADDING="0" CELLSPACING="0">
+                        ';
+                               
+               if( is_array($r) )
+                       {
+                       reset($r);
+                       $numb = count($r);
+
+                       while( list($key, $val) = each($r) ) 
+                               {
+                                       
+                               echo '<TR><TD>';
+                               
+                                       // Break out node information
+                                       
+                               $info = explode( '~', $key );
+
+                                       // Build full path and name if requested
+                                       
+                               if( $opt_fullpath )
+                                       $cat_name = $info[1];
+                                 else
+                                       $cat_name = $val['name'];
+                       
+                               
+                                       // Check to see if we need to prevent a self reference
+
+                               if( !$def_ref_data || !$opt_noselfref || strncmp( $def_ref_data['cat_id_path'], $val['cat_id_path'], 1000 ) != 0 )
+                                       {
+
+                                               // Display expand/contract link
+                               
+                                       if( $info[4] > 0 )
+                                               {
+                                               if( $val['expanded'] == FALSE )
+                                                       echo '<A HREF="'.SI_THIS_SCRIPT.'?id='.$val['id'].'&'.$link_data.'" NAME="test" STYLE="text-decoration: none;">+</A>';
+                                                 else
+                                                       echo '<A HREF="'.SI_THIS_SCRIPT.'?id='.$val['parent'].'&'.$link_data.'" NAME="test" STYLE="text-decoration: none;">-</A>';
+                                               }
+                                         else
+                                               echo ' ';
+                               
+                                       echo '</TD><TD><NOBR>';
+                                                                               
+                                               // if use select full path
+                                       
+                                       if( $opt_selfullpath )
+                                               {
+                                               echo '&nbsp;&nbsp;<A HREF="" OnClick="set_selected_node( '.$val['id'].', \''.$cat_name.'\' );" STYLE="TEXT-DECORATION: none; font-weight: normal;">'.$info[1].'</A>
+                                                         </NOBR></TD><TD ALIGN="right"><NOBR>';
+                                               }
+                                         else
+                                               { // otherwise use indented
+                                                               
+                                                       // Add appropriate indent
+                                               
+                                               for( $i=0 ; $i<$val['cat_level'] ; $i++ )
+                                                       echo "&nbsp;&nbsp;&nbsp;&nbsp;";
+                                               
+                                               echo '&nbsp;&nbsp;<A HREF="" OnClick="set_selected_node( '.$val['id'].', \''.$cat_name.'\' );" STYLE="TEXT-DECORATION: none; font-weight: normal;">'.$val['name'].'</A>
+                                                         </NOBR></TD><TD ALIGN="right"><NOBR>';
+                                               }                                       
+       
+                                       }
+                                 else
+                                       {
+                                       echo '</TD><TD><NOBR>';
+                                       for( $i=0 ; $i<$val['cat_level'] ; $i++ )
+                                               echo "&nbsp;&nbsp;&nbsp;&nbsp;";
+                                       
+                                       echo '&nbsp;&nbsp;'.$val['name'].' <font color="red">*</font>
+                                                 </NOBR></TD><TD ALIGN="right"><NOBR>';
+                                       $self_ref_notice = true;
+                                       }                               
+
+                               if( $opt_edit )
+                                       echo '<A HREF="'.SI_THIS_SCRIPT.'?id='.$val['id'].'&parent='.$val['parent'].'&Action=Edit&Option=Edit&'.$link_data.'">[Edit]&nbsp;</A>';
+                               if( $opt_add )
+                                       echo '<A HREF="'.SI_THIS_SCRIPT.'?id='.$val['id'].'&parent='.$val['parent'].'&Action=Edit&Option=Add&'.$link_data.'">[Add Sub]&nbsp;</A>';
+                               if( $opt_delete )
+                                       echo '<A HREF="'.SI_THIS_SCRIPT.'?id='.$val['id'].'&parent='.$val['parent'].'&Action=Edit&Option=Delete&'.$link_data.'">[Delete]&nbsp;</A>';
+
+                                       
+                               echo '</NOBR></TD></TR>
+                                        ';
+                               }
+                               
+                       }
+                 else
+                       echo '<TR><TD ALIGN="center">No Categories Listed</TD></TR>';
+                       
+               if( $opt_add )
+                       {
+                       echo '  <TR><TD COLSPAN="3">&nbsp;</TD></TR>
+                                       <TR><TD COLSPAN="3" ALIGN="center"><A HREF="'.SI_THIS_SCRIPT.'?id=0&parent=0&Action=Edit&Option=Add&'.$link_data.'">[Add New Top-Level Category]</A></TD></TR>
+                                ';     
+                       }
+
+               echo '</TABLE>
+                        ';
+
+               if( $self_ref_notice )
+                       echo '<hr>
+                                       <table><tr>
+                                               <Td valign="top"><font color="red">*</font></td>
+                                               <td valign="top">You may not select this category or any underneath it as it would cause a circular reference.</td>
+                                       </tr></table>';
+               break;
+               
+       }
+
+echo '  </body>
+         </html>
+        ';
+
+?>
diff --git a/front-end/index.html b/front-end/index.html
new file mode 100644 (file)
index 0000000..d134b6e
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title></title>
+</head>
+<body>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/front-end/java_functions.js b/front-end/java_functions.js
new file mode 100644 (file)
index 0000000..0a8d034
--- /dev/null
@@ -0,0 +1,289 @@
+//
+// Java Functions
+//
+
+    // List all Java properties for the specified target - Used for testing
+
+function list_properties( target )
+    {
+    sep = '';
+    var names = '';
+    var c = 0;
+    
+    var names_a = new Array();
+    for( var i in target )
+        {
+        names_a[c++] = i;
+        }
+    names_a.sort();
+    
+    for( var i=0 ; i<c ; i++ )
+        {
+        names += sep + names_a[i];
+        sep = "\n";
+        }
+    alert( names );
+    }
+
+
+    // Pop-up a window with URL = u and target name = n
+
+function do_popup( u, n )
+    {
+    w = window.open( u, n, 'scrollbars=yes,toolbar=no,resizable=yes,width=750,height=550,screenx=10,screeny=10',1 );
+    w.focus();
+    }
+
+    // Set focus to first input field
+
+function defaultFieldFocus( n )
+    {
+    if( document.forms.length == 0 )
+        return;
+
+    for( var f=0 ; f<document.forms.length ; f++ )
+        {
+        e = document.forms[f].elements;
+
+        for( var i=0 ; i<e.length ; i++ )
+            {
+
+                // Check for specified field
+
+            if( n != 'default' )
+                {
+                if( e[i].id == n )
+                    {
+                    e[i].focus();                // Put field in focus
+                    window.scrollBy(0,400);        // Scroll it up a ways
+                    e[i].focus();                // Make sure it's back in focust (presumeably at the top)
+                    window.scrollBy(0,-40);        // Scroll it down a bit to make it more visible
+                    return;
+                    }
+                }
+            else
+                    // select first permitted field
+                switch( e[i].type )
+                    {
+                    case 'button':
+                    case 'checkbox':
+                    case 'radio':
+                    case 'text':
+                    case 'textarea':
+                    case 'password':
+                    case 'file':
+                    case 'select-one':
+                    case 'select-multiple':
+                        e[i].focus();
+                        return;
+                        break;
+                    default:
+                        break;
+                    }
+            }
+        }
+    }
+
+
+var last_t = '';
+
+function show_QuickTip(t,e)
+    {
+
+    if( last_t != '' )
+        hide_QuickTip(last_t);
+    last_t = t;
+    document.getElementById(t).style.visibility = 'visible';
+    }
+
+function hide_QuickTip(t)
+    {
+    document.getElementById(t).style.visibility = 'hidden';
+    }
+
+
+function toggle_visible(t)
+    {
+    if( document.getElementById(t).style.visibility == 'visible' )
+        document.getElementById(t).style.visibility = 'hidden';
+    else
+        document.getElementById(t).style.visibility = 'visible';
+    }
+
+function isInteger( i )
+    {
+    return /^[0-9]+$/i.test(i);
+    }
+
+
+function getElementIndex(obj)
+        {
+        var theform = obj.form;
+        for (var i=0; i<theform.elements.length; i++)
+                {
+                if (obj.name == theform.elements[i].name)
+                        {
+                        return i;
+                        }
+                }
+        return -1;
+        }
+
+
+    // MULTIFIELD: Check for all field lines in use and create additional line if required
+
+function multi_fields( fname, cur_field, width )
+    {
+    var lines = 0;
+    var unused = 0;
+    var saved = new Array();
+
+    ele = getElementIndex(cur_field);
+
+    while( document.getElementById( fname + '_' +  (lines+1) + '_1' ) )
+        {
+        lines++;
+
+            // Check if line is used
+        if( document.getElementById( fname + '_' + lines + '_1' ).value == '' )
+            unused++;
+
+            // Save all data in case we need to add a line
+        saved[lines] = new Array();
+        for( i=1 ; i<=width ; i++ )
+            {
+            saved[lines][i] = document.getElementById( fname + '_' +  lines + '_' + i ).value;
+            }
+        }
+
+        // If we need an additional field, rewrite everything
+
+    if( lines > 0 && unused == 0 )
+        {
+        new_num = lines + 1;                                                                // Add one to line count for new field
+
+        new_text = document.getElementById( fname + '_text' ).value;
+
+        t = new_text.replace( /\{line_numb\}/gi, new_num );                                            // Replace {n} parameters
+
+        for( i=1 ; i<=width ; i++ )
+            {
+            reg = new RegExp( '\{field_' + i + '\}', 'g' );
+            t = t.replace( reg, '<input type=\"text\" name=\"' + fname + '_' + new_num + '_' + i + '\" id=\"' + fname + '_' + new_num + '_' + i + '\" onChange=\"multi_fields(\'' + fname + '\', this, ' + width + ');\">' );
+            }
+
+        document.getElementById( fname + '_fields' ).innerHTML += t;                // Write out new line
+
+            // Fill values back in
+        for( i=1 ; i<=lines ; i++ )
+            for( j=1 ; j<=width ; j++ )
+                document.getElementById( fname + '_' + i + '_' + j ).value = saved[i][j];
+
+        }
+
+    // Focus on next field
+    setTimeout("setFocus('" + fname + '_' + 1 + '_' + 1 + "', " + ele + ")",100);
+        
+    }
+
+// Set focus to 
+function setFocus(f, ele) 
+       {
+       e = document.getElementById( f );
+       form = e.form;
+       ele++;
+       form.elements[ele].focus();
+       }
+
+    // Special Multi-fields that doesn't conflict with view parsing - Built specifically to support Attendee input in registrations step 2
+
+function multi_fields_2( fname, cur_field, width )
+    {
+    var lines = 0;
+    var unused = 0;
+    var saved = new Array();
+
+    ele = getElementIndex(cur_field);
+    
+    while( document.getElementById( fname + '_' +  (lines+1) + '_1' ) )
+        {
+        lines++;
+
+            // Check if line is used
+        if( document.getElementById( fname + '_' + lines + '_1' ).value == '' )
+            unused++;
+
+            // Save all data in case we need to add a line
+        saved[lines] = new Array();
+        for( i=1 ; i<=width ; i++ )
+            {
+            saved[lines][i] = document.getElementById( fname + '_' +  lines + '_' + i ).value;
+            }
+        }
+
+        // If we need an additional field, rewrite everything
+
+    if( lines > 0 && unused == 0 )
+        {
+        new_num = lines + 1;                                                                // Add one to line count for new field
+
+        new_text = document.getElementById( fname + '_text' ).value;
+
+        t = new_text.replace( /\[line_numb\]/gi, new_num );                                            // Replace {n} parameters
+        for( i=1 ; i<=width ; i++ )
+            {
+            reg = new RegExp( '\\[field_' + i + '\\]', 'g' );
+            t = t.replace( reg, '<input type=\"text\" name=\"' + fname + '_' + new_num + '_' + i + '\" id=\"' + fname + '_' + new_num + '_' + i + '\" size="40" onChange=\"multi_fields_2(\'' + fname + '\', this, ' + width + ');\">' );
+            }
+        document.getElementById( fname + '_fields' ).innerHTML += t;                // Write out new line
+
+            // Fill values back in
+        for( i=1 ; i<=lines ; i++ )
+            for( j=1 ; j<=width ; j++ )
+                {
+                document.getElementById( fname + '_' + i + '_' + j ).value = saved[i][j];
+                }
+        }
+
+    // Focus on next field
+    // Focus on next field
+    setTimeout("setFocus('" + fname + '_' + 1 + '_' + 1 + "', " + ele + ")",100);
+    
+    }
+
+
+
+//CKEditor Actions
+CKEDITOR.config.toolbar_EventManagement =
+[
+ ['Font','FontSize','Bold','Italic'],
+ ['Cut','Copy','PasteText','-','Undo','Redo'],
+ ['NewPage', 'Preview'],
+ '/',
+ ['NumberedList','BulletedList','-','Outdent','Indent'],
+ ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
+ ['TextColor'],
+ ['Link','Unlink'],
+ ['Table','Find','Replace','-','RemoveFormat','Source']
+] ;
+       
+
+function buildCkeditor(f)
+{
+       instance = CKEDITOR.instances[f];
+       if (instance) {
+               instance.destroy(true);
+               instance = null;
+       }
+       
+       //      Only try to replace the textarea if the
+       //      CKEditor is compatible w/ the browser.
+       if (CKEDITOR.env.isCompatible) {
+               CKEDITOR.replace(f, { 
+                       toolbar : 'EventManagement',
+//                             width : 570,
+//                             height : 400
+               });
+       }
+
+}
diff --git a/front-end/magic_forms_function.inc b/front-end/magic_forms_function.inc
new file mode 100644 (file)
index 0000000..0150d55
--- /dev/null
@@ -0,0 +1,2686 @@
+<?php
+
+/**
+ * MagicForm Functions
+ */
+
+
+
+// Safely Evaluate an expression supplied by a user
+// May include {variable_name} parameters supplied in $variables array
+
+function do_math( $exp, $vars = '' )
+{
+    // Permitted math functions
+    $functions = 'abs|acos|asin|atan|ceil|deg2rad|exp|floor|log10|log|pi|pow|rand|round|sin|sqrt|tan';
+
+    // If no formula, then return
+    if (trim($exp) == '') {
+        return 'NOTE: No formula entered for this field';
+    }
+
+    // Clean input to ensure security
+    // Permit for equations any sequence of: a-z A-Z 0-9 (space) + - . * ( )
+    // Permit for variables { and } with only these characters between them: a-z A-Z 0-9 _ - .
+    if( !preg_match( '/^([0-9 +-\.\/\*\(\)]|\{[a-zA-Z0-9_\-\. ]*\}|'.$functions.')+$/', $exp ) ) {
+        return( 'ERROR: Illegal character or sequence in "'.$exp.'"' );
+    }
+
+    // Check matching ()'s - $p is paren count and must end at 0 or there's a mismatch
+    $p = 0;
+    for ($i=0 ; $i<strlen($exp) ; $i++) {
+        switch( $exp{$i} ) {
+            case '(':
+                $p++;
+                break;
+            case ')':
+                $p--;
+                if( $p < 0 )            // Check if extra ) found
+                    return( 'ERROR: Found unmatched ")" in "'.$exp.'"' );
+                break;
+            default:
+                break;
+        }
+    }
+    // Check if extra ( found
+    if( $p > 0 ) {
+        return( 'ERROR: Found unmatched "(" in "'.$exp.'"' );
+    }
+
+    // If variables are supplied - Replace variables with values
+    if( is_array( $vars ) ) {
+
+        // First scan to make sure all have numeric values (remember, we're doing math here) and clean them up
+        $non_numeric = false;
+        while( list($k, $v) = each($vars) ) {
+            if( !is_numeric(trim($v)) )
+            {
+                $vars[$k] = '{'.$k.'='.$v.'}';
+                $non_numeric = true;
+            } else {
+                $vars[$k] = (float) ($v + 0);            // Clean up input
+            }
+        }
+
+        $exp = replace_tokens( $exp, $vars );
+
+        // now get rid of any parameters that didn't get replaced (such as from unused sub-forms)
+        $pattern = '/\{[^\}]*}/i';
+        $exp = preg_replace($pattern, '0', $exp);
+
+        //        if( $non_numeric )
+        //            return( 'ERROR: Bad value in "'.$exp.'"' );
+
+        if( strstr($exp, '{') ) {
+                return( 'ERROR: "'.$exp.'"' );
+        }
+    }
+
+    // Check for tokens that don't match a valid variable
+    if( preg_match( '(\{|\})', $exp ) ) {
+        return( 'ERROR: Unmatched variables in "'.$exp.'"' );
+    }
+
+    // Recheck expression after variable replacement
+    if( !preg_match( '/^([0-9 ^+-\.\/\*\(\)]|'.$functions.')+$/', $exp ) ) {
+        return( 'ERROR: Illegal character or sequence in "'.$exp.'"' );
+    }
+
+    // Evaluate expression
+    $r = 'ERROR: Unable to evaluate expression "'.$exp.'"';        // Pre-load error message
+    @eval( '$r = ('.$exp.');' );                                // If successful replaces error with result
+    if( $r{0} == 'E' ) {
+        return( $r );
+    }
+
+    // Check for valid result
+    if( !is_float($r) && !is_int($r) ) {
+        return( 'ERROR: Bad result "'.$r.'" is not a number from expression "'.$exp.'"' );
+    }
+
+    // Insure that result is only a floating point number
+    $r = (float) $r;
+    return( $r );
+}
+
+// Get all numeric fields for use in formulas
+function get_all_numeric_vars( $mf_id )
+{
+
+    $mf_fields = array();
+
+    $mf_fields = reg_db_auto_get_data( "
+        SELECT *
+          FROM ".MF_TABLE."
+         WHERE form_id = '$mf_id'
+                OR form_id LIKE '$mf_id.%'
+         ORDER BY sort;
+    ", SI_CONN_STR, FALSE );
+
+    if( $mf_fields ) {
+        foreach( $mf_fields as $mf ) {
+
+            switch( $mf['type'] ) {
+                case 1:        // Check`ox
+                case 2:        // Number
+                case 5:        // Picklist (will be checked for numeric values)
+                case 6:        // Radio Buttons (will be checked for numeric values)
+                case 31:    // Calculated field (will be processed in order)
+                    $fid = ( $mf['custom_id'] == '' ? 'mf_'.$mf['id'] : $mf['custom_id'] );
+                    $field_list[$mf['id']] = array( 'fid' => $fid, 'title' => $mf['title'] );
+                    break;
+                default:
+                    break;
+            }
+
+        }
+    }
+
+    return $field_list;
+}
+
+
+// Support function to get all numeric variable ID's for a sub-form
+function get_sub_vars( $form_id )
+{
+    $vars = array();
+
+    // If there's a sub-form, get a list of fields with numeric values that can be used to return a value for this option
+    if( $form_id != '' && ($sub_fields = reg_db_auto_get_data("
+        SELECT id, title, custom_id
+          FROM ".MF_TABLE."
+         WHERE form_id = '$form_id'
+           AND ( type = 1 OR type = 2 OR type = 5 OR type = 6 OR type = 31 )
+         ORDER BY sort
+    ;", SI_CONN_STR, FALSE )) ) {
+        foreach( $sub_fields as $sf ) {
+
+            // Add this field ID and
+            $fid = ( empty($sf['custom_id']) ? 'mf_'.$sf['id'] : $sf['custom_id'] );
+            $vars[$fid] .= $fid.' - '.$sf['title'];
+
+        }
+    }
+
+    return( $vars );
+}
+
+
+// MagicForm - Edit Form
+
+function magic_form_edit( $mf_id, $mf_format, $mf_level = 0 )
+{
+    //
+    // Needed Enhancements
+    //
+    // Calculated fields - based on results from other fields
+    //
+
+    /*    data1 field description
+     *
+     *     {title}~{subform_id}~{misc_data}|{title}~{subform_id}~{misc_data}|...
+     *
+     */
+
+    global $mf_formats, $mf_styles;
+
+    // Clean up all input
+    $mf_action_id             = filter_request('mf_action_id');
+    $mf_action                 = filter_request('mf_action');
+
+    $mf_field_id             = filter_request('mf_field_id');
+    $mf_position             = filter_request('mf_position');
+    $mf_field_option         = filter_request('mf_field_option');
+    $mf_option_id             = filter_request('mf_option_id');
+    $mf_option_name         = filter_request('mf_option_name');
+    $mf_option_value         = filter_request('mf_option_value');
+    $mf_option_value_type     = filter_request('mf_option_value_type');
+    $mf_option_value_src     = filter_request('mf_option_value_src');
+    $mf_position             = filter_request('mf_position');
+    $mf_position_num         = filter_request('mf_position_num');
+    $mf_field_text            = filter_request('mf_field_text');
+    $mf_field_imagesize     = filter_request('mf_field_imagesize');
+    $mf_field_title         = filter_request('mf_field_title');
+    $mf_field_descr         = filter_request('mf_field_descr');
+    $form_data                 = filter_request('form_data');
+    $link_data                 = filter_request('link_data');
+    $mf_type                 = filter_request('mf_type');
+    $mf_style                 = filter_request('mf_style');
+    $mf_field_cols             = filter_request('mf_field_cols');
+    $mf_field_rows             = filter_request('mf_field_rows');
+    $mf_custom_id             = filter_request('mf_custom_id');
+    $mf_field_file             = filter_request('mf_field_file');                    // ???? FILE
+    $mf_field_file_name     = filter_request('mf_field_file_name');            // ????
+    $mf_field_file_delete    = filter_request('mf_field_file_delete');
+    $mf_format_type         = filter_request('mf_format_type');
+    $mf_format_char         = filter_request('mf_format_char');
+    $mf_format_dec             = filter_request('mf_format_dec');
+    $mf_format_min             = filter_request('mf_format_min');
+    $mf_format_max             = filter_request('mf_format_max');
+    $mf_def_val = filter_request('mf_def_val');
+
+    // If first entry to edit form, get all numeric fields for formulas
+    if ($mf_level == 0) {
+        $field_list = get_all_numeric_vars( $mf_id );
+    }
+
+        // Always pass along the current form/sub-form with any action requests
+
+    $mf_form_data = '<input type="hidden" name="mf_action_id" value="'.$mf_id.'">';
+    $mf_link_data = '&mf_action_id='.$mf_id;
+
+    $r['success'] = false;        // Assume a failed return
+    $r['modified'] = false;        // Assume we're not modifying the form - This is set to true for anything that changes the form in a way that old form results can't be used anymore.
+    $r['text'] = '';            // With no text
+
+    // If we have a field ID then get data for that too
+    if( !empty($mf_field_id) && ($mf_field_data = db_auto_get_row( "SELECT * FROM ".MF_TABLE." WHERE id = $mf_field_id;", 0, CONN_STR, FALSE )) ) {
+        $mf_field_data1 = $mf_field_data['data1'];
+    } else {
+        $mf_field_data1 = '';
+    }
+
+    $mf_normalize = false;
+    $mf_custom_id_update_message = '';
+
+        //
+        // Process Actions
+        //
+
+      if( $mf_action_id == $mf_id ) {
+        switch( $mf_action ) {
+
+            case "Add Field":
+
+                // Add new field with default data
+                $f = db_auto_get_row( "INSERT INTO ".MF_TABLE." ( form_id, title, type, active, required, sort, expanded, style, format, file, cols, rows )
+                                            VALUES ( '$mf_id', '', 0, 't', 'f', $mf_position, 't', 'Default', '', '', 20, 4 );
+                                        SELECT currval('".MF_TABLE."_id_seq') AS id;", 0, CONN_STR, FALSE );            // Get new field ID
+                $mf_field_id = $f['id'];
+                $mf_normalize = true;
+                break;
+
+            case "Set Type":
+
+                // Is there a request to place a duplicate of an existing field here
+
+                if( trim($mf_dupe_id) != '' ) {
+
+                    // Try to find the field by custom id
+                    if( !($md = db_auto_get_row( "SELECT * FROM ".MF_TABLE." WHERE custom_id = '$mf_dupe_id';", 0, CONN_STR, FALSE )) ) {
+
+                        // Can't find custom ID so should be numeric field ID
+                        $mf_dupe_id = substr( $mf_dupe_id, 3 );
+                        if( !is_numeric( $mf_dupe_id ) || ($mf_dupe_id = $mf_dupe_id+0) == 0 ) {
+                            break;    // Not numeric so quit here
+                        }
+
+                            // Now try to get it by numeric ID
+                        if( !($md = db_auto_get_row( "SELECT * FROM ".MF_TABLE." WHERE id = $mf_dupe_id;", 0, CONN_STR, FALSE )) ) {
+                            break;    // Not found quit here
+                        }
+                    }
+
+                    $md_temp = $md['form_id'].'.'.$mf_dupe_id;
+
+                    // Copy dupe target to current field
+                    $md['data1'] = str_replace( $md_temp.'.', $mf_field_data['form_id'].'.'.$mf_field_id.'.', $md['data1'] );
+                    $md['form_id'] = $mf_field_data['form_id'];
+
+                    reg_db_auto_exec( "UPDATE ".MF_TABLE." SET title = '".$md['title']."', type = ".$md['type'].", descr = '".$md['descr']."', active = '".$md['active']."', data1 = '".$md['data1']."', sort = 9990,
+                                                    form_id = '".$md['form_id']."', expanded = 't', style = '".$md['style']."', file = '', cols = ".$md['cols'].", rows = ".$md['rows'].", custom_id = '', size = '".$md['size']."',
+                                                    format = '".$md['format']."', default_val = '".$md['default_val']."', required = '".$md['required']."' WHERE id = $mf_field_id;", CONN_STR, FALSE );
+
+                        // Start and array with the dupe field and then add any sub-form data
+                    if( ($mf_dupe_subs = reg_db_auto_get_data( "SELECT * FROM ".MF_TABLE." WHERE form_id like '".$md_temp.'.'."%';", CONN_STR, FALSE, 999 )) && is_array($mf_dupe_subs) ) {
+
+                        $qs = '';
+
+                        // Copy all sub-form - Temporarily stuff $mf_field_id into 'file' to be able to find all of these and also the original ID for each in the custom_id field
+                        foreach( $mf_dupe_subs as $ds ) {
+                            $qs .= "INSERT INTO ".MF_TABLE." (title, type, descr, active, data1, sort, form_id, expanded, style, file, cols, rows, custom_id, size, format, default_val, required )
+                                                    VALUES ( '".$ds['title']."', ".$ds['type'].", '".$ds['descr']."', '".$ds['active']."', '".$ds['data1']."', ".$ds['sort'].",
+                                                            '".$ds['form_id']."', 'f', '".$ds['style']."', '$mf_field_id', ".$ds['cols'].", ".$ds['rows'].", '".$ds['id']."', '".$ds['size']."',
+                                                            '".$ds['format']."', '".$ds['default_val']."', '".$ds['required']."' );\n";
+                        }
+                        $mf_dupe_subs = reg_db_auto_get_data( $qs."SELECT * FROM ".MF_TABLE." WHERE file = '$mf_field_id';", CONN_STR, FALSE, 999 );
+
+                            // Build array for translating old ID's to new
+                        $mf_trans = array( $mf_dupe_id => $mf_field_id );
+                        foreach( $mf_dupe_subs as $ds ) {
+                            $mf_trans[$ds['custom_id']] = $ds['id'];
+                        }
+
+                        // Now use translation array to translate form ID's as needed
+                        $qs = '';
+                        reset( $mf_dupe_subs );
+                        foreach( $mf_dupe_subs as $ds ) {
+                            reset( $mf_trans );
+                            $data1_temp = $ds['data1'];
+                            $form_id_temp = $ds['form_id'];
+                            while( list($key, $val) = each($mf_trans) ) {
+                                $data1_temp = str_replace( '.'.$key.'.', '.'.$val.'.', $data1_temp );
+                                $form_id_temp = str_replace( '.'.$key.'.', '.'.$val.'.', $form_id_temp );
+                            }
+                                // Update each sub and clear the temp values in file and custom_id
+                            $qs .= "UPDATE ".MF_TABLE." SET data1 = '".$data1_temp."', form_id = '".$form_id_temp."', file = '', custom_id = '' WHERE id = ".$ds['id'].";\n";
+                        }
+
+                        reg_db_auto_exec( $qs, CONN_STR, FALSE );
+                    }
+
+                } else {
+
+                    // Determine default style format for this type - First format that can be used for this type
+                    reset( $mf_styles );
+                    while( list($key, $val) = each($mf_styles) ) {
+                        if( strstr( $val['types'], ' '.$mf_type.' ' ) ) {
+                            $mf_style .= $key;
+                            break;
+                        }
+                    }
+                    reg_db_auto_exec( "UPDATE ".MF_TABLE." SET type = $mf_type, style = '$mf_style' WHERE id = $mf_field_id;", CONN_STR, FALSE );
+                    if( $mf_type == 1 ) {   // IF checkbox
+                        reg_db_auto_exec( "UPDATE ".MF_TABLE." SET data1 = 'Yes~~~|No~~~' WHERE id = $mf_field_id;", CONN_STR, FALSE );
+                    }
+                }
+                break;
+
+            case "Set Style":
+
+                reg_db_auto_exec( "UPDATE ".MF_TABLE." SET style = '$mf_style' WHERE id = $mf_field_id;", CONN_STR, FALSE );
+                break;
+
+            case "Set Field Format":
+
+                $x = $mf_format_type.'~'.$mf_format_char.'~'.$mf_format_dec.'~'.$mf_format_min.'~'.$mf_format_max;
+                reg_db_auto_exec( "UPDATE ".MF_TABLE." SET format = '$x' WHERE id = $mf_field_id;", CONN_STR, FALSE );
+                break;
+
+            case "Add Option":
+
+                if( trim($mf_field_option) == '' ) {
+                        break;
+                }
+
+                if( !empty($mf_field_data1) ) {
+                        $x = $mf_field_data1."|".$mf_field_option."~~";
+                } else {
+                    $x = $mf_field_option."~~";
+                }
+
+                reg_db_auto_exec( "UPDATE ".MF_TABLE." SET data1 = '".addslashes($x)."' WHERE id = $mf_field_id;", CONN_STR, FALSE );
+                break;
+
+            case "Add Subform":
+
+                /*
+                 *     Subform ID's are created as follows...
+                 *
+                 *     {parent_id}.{new_id}.{timestamp}
+                 */
+
+                $x = explode( "|", $mf_field_data1 );                                                // Separate data into options
+                $y = explode( "~", $x[$mf_option_id-1] );                                                // Separate specified option parameters
+                $x[$mf_option_id-1] = $y[0]."~$mf_id.$mf_field_id.".time().'~'.$y[2].'~'.$y[3];
+                $mf_field_data1 = implode( "|", $x );
+                reg_db_auto_exec( "UPDATE ".MF_TABLE." SET data1 = '".addslashes($mf_field_data1)."' WHERE id = $mf_field_id;", CONN_STR, FALSE );
+                break;
+
+            case "Delete Subform":
+
+                // $r['modified'] = true;
+                $x = explode( "|", $mf_field_data1 );
+                $y = explode( "~", $x[$mf_option_id-1] );
+                $x[$mf_option_id-1] = $y[0].'~~'.$y[2].'~'.$y[3];
+                $mf_field_data1 = implode( "|", $x );
+
+                    // Delete any Images or Files associated with these fields
+
+                if( ($del_fields = reg_db_auto_get_data( "SELECT * FROM ".MF_TABLE." WHERE form_id LIKE '".$y[1]."%';" )) ) {
+                    foreach( $del_fields as $d ) {
+                        switch( $d['type'] ) {
+                            case 24:    // Image
+                                reg_delete_image( $d['file'] );
+                                break;
+                            case 25:    // File
+                                reg_file_delete( $d['file'] );
+                                break;
+                            default:
+                                break;
+                        }
+                    }
+                }
+
+                reg_db_auto_exec( "DELETE FROM ".MF_TABLE." WHERE form_id LIKE '".$y[1]."%'; UPDATE ".MF_TABLE." SET data1 = '".addslashes($mf_field_data1)."' WHERE id = $mf_field_id;", CONN_STR, FALSE );
+                break;
+
+            case "Edit Option Name":
+
+                // $r['modified'] = true;
+                $x = explode( "|", $mf_field_data1 );
+                $y = explode( "~", $x[$mf_option_id-1] );
+                $x[$mf_option_id-1] = $mf_option_name.'~'.$y[1].'~'.$y[2].'~'.$y[3];
+                $mf_field_data1 = implode( "|", $x );
+                reg_db_auto_exec( "UPDATE ".MF_TABLE." SET data1 = '".addslashes($mf_field_data1)."' WHERE id = $mf_field_id;", CONN_STR, FALSE );
+                break;
+
+            case "Edit Option Value":
+
+                // $r['modified'] = true;
+                if ((clean_input( 'mf_option_value', 'float', false )) == '') {           // Validate input value as floating point
+                    $x = explode( "|", $mf_field_data1 );
+                    $y = explode( "~", $x[$mf_option_id-1] );
+                    $x[$mf_option_id-1] = $y[0].'~'.$y[1].'~'.$mf_option_value.'~'.$mf_option_value_type.'~'.$mf_option_value_src;
+                    $mf_field_data1 = implode( "|", $x );
+                    reg_db_auto_exec( "UPDATE ".MF_TABLE." SET data1 = '".addslashes($mf_field_data1)."' WHERE id = $mf_field_id;", CONN_STR, FALSE );
+
+                }
+
+                break;
+
+            case "Delete Option":
+
+                $r['modified'] = true;
+                $x = explode( "|", $mf_field_data1 );
+                $y = explode( "~", $x[$mf_option_id-1] );
+                array_splice( $x, $mf_option_id-1, 1 );
+                $mf_field_data1 = implode( "|", $x );
+
+                    // Delete any Images or Files associated with these fields
+
+                if( ($del_fields = reg_db_auto_get_data( "SELECT * FROM ".MF_TABLE." WHERE form_id LIKE '".$y[1].".%';" )) ) {
+                    foreach( $del_fields as $d )
+                        {
+                        switch( $d['type'] ) {
+                            case 24:    // Image
+                                reg_delete_image( $d['file'] );
+                                break;
+                            case 25:    // File
+                                reg_file_delete( $d['file'] );
+                                break;
+                            default:
+                                break;
+                        }
+                    }
+                }
+
+                    // Delete any sub-forms and update this field data
+                    // Make sure we have a form ID before we try this or we could wipe out all MF field data
+                if( trim($y[1]) != '' ) {
+                    reg_db_auto_exec( "DELETE FROM ".MF_TABLE." WHERE form_id LIKE '".$y[1].".%'; UPDATE ".MF_TABLE." SET data1 = '".addslashes($mf_field_data1)."' WHERE id = $mf_field_id;", CONN_STR, FALSE );
+                }
+                break;
+
+            case "Reposition":
+
+                if( !empty( $mf_position_num ) ) {
+                    if (clean_input( 'mf_position_num', 'integer', true ) == '') {
+                        if ($mf_position_num > 999) {
+                            $mf_position_num = 999;
+                        }
+                        $mf_position = $mf_position_num * 10;
+                        if( $mf_position > $mf_field_data['sort'] ) {
+                            $mf_position += 1;
+                        } else {
+                            $mf_position -= 1;
+                        }
+                    } else {
+                        break;
+                    }
+                }
+
+                // $r['modified'] = true;
+                if (($mf_position-0) > 0) {
+                    reg_db_auto_exec( "UPDATE ".MF_TABLE." SET sort = $mf_position WHERE id = $mf_field_id;", CONN_STR, FALSE );
+                }
+                $mf_normalize = true;
+                break;
+
+            case "Toggle Active":
+
+                // $r['modified'] = true;
+                reg_db_auto_exec( "UPDATE ".MF_TABLE." SET active = '".($mf_field_data['active']=='t'?'f':'t')."' WHERE id = $mf_field_id;", CONN_STR, FALSE );
+                break;
+
+            case "Toggle Required":
+
+                // $r['modified'] = true;
+                reg_db_auto_exec( "UPDATE ".MF_TABLE." SET required = '".($mf_field_data['required']=='t'?'f':'t')."' WHERE id = $mf_field_id;", CONN_STR, FALSE );
+                break;
+
+            case "Toggle Expanded":
+
+                reg_db_auto_exec( "UPDATE ".MF_TABLE." SET expanded = '".($mf_field_data['expanded']=='t'?'f':'t')."' WHERE id = $mf_field_id;", CONN_STR, FALSE );
+                break;
+
+            case "Expand All":
+
+                reg_db_auto_exec( "UPDATE ".MF_TABLE." SET expanded = 't' WHERE form_id = '$mf_id';", CONN_STR, FALSE );
+                break;
+
+            case "Contract All":
+
+                reg_db_auto_exec( "UPDATE ".MF_TABLE." SET expanded = 'f' WHERE form_id = '$mf_id';", CONN_STR, FALSE );
+                break;
+
+            case "Update Text":
+
+                // $r['modified'] = true;
+                reg_db_auto_exec( "UPDATE ".MF_TABLE." SET data1 = '".addslashes($mf_field_text)."' WHERE id = $mf_field_id;", CONN_STR, FALSE );
+                break;
+
+            case "Update Field":
+
+                // $r['modified'] = true;
+                $other_fields = '';
+                if( $mf_field_data['type'] >= 2 && $mf_field_data['type'] <= 4 ) {
+                    $other_fields .= ', cols = '.$mf_field_cols;
+                }
+                if( $mf_field_data['type'] == 4 ) {
+                    $other_fields .= ', rows = '.$mf_field_rows;
+                }
+                if( $mf_field_data['type'] == 2 || $mf_field_data['type'] == 3 ) {
+                    $other_fields .= ", default_val = '$mf_def_val'";
+                }
+                if( $mf_field_data['type'] == 31 ) {
+                    $other_fields .= ", data1 = '$mf_field_text'";
+                }
+                reg_db_auto_exec( "UPDATE ".MF_TABLE." SET title = '".addslashes($mf_field_title)."', descr = '".addslashes($mf_field_descr)."'$other_fields WHERE id = $mf_field_id;", CONN_STR, FALSE );
+                break;
+
+            case "Update Image":
+
+                // $r['modified'] = true;
+                $new_image = '';
+                $image_update = false;
+
+                $mfFile = $_FILES['mf_field_image'];
+                $mf_field_image_delete     = filter_request('mf_field_image_delete');
+                $mf_field_image_size     = filter_request('mf_field_image_size');
+
+                // if there's an existing image and we're either deleting or replacing it
+                if( $mf_field_data['file'] != '' && ( $mf_field_image_delete == 'on' || $mfFile['name'] != '' ) ) {
+                    reg_delete_image( $mf_field_data['file'] );
+                    $image_update = true;
+                }
+
+                // If there's an image supplied
+                if( $mfFile['name'] != '' ) {
+                    $new_image = reg_process_image('mf_field_image');
+                    $image_update = true;
+                }
+
+                if( $image_update ) {
+                    reg_db_auto_exec( "UPDATE ".MF_TABLE." SET file = '".addslashes($new_image)."', size = '$mf_field_imagesize' WHERE id = $mf_field_id;", CONN_STR, FALSE );
+                } else {
+                    reg_db_auto_exec( "UPDATE ".MF_TABLE." SET size = '$mf_field_imagesize' WHERE id = $mf_field_id;", CONN_STR, FALSE );
+                }
+
+                break;
+
+            case "Update File":
+
+                $existing_filename = $mf_field_data['file'];
+
+                $mfFile = $_FILES['mf_field_file'];
+                $mf_field_image_delete     = filter_request('mf_field_image_delete');
+
+                $new_filename = trim($mfFile['name']);
+
+                    // If delete is requested or there's a new file upload AND there's an existing file, then delete the old one
+
+                if( ( $mf_field_file_delete == 'on' || $mfFile['name'] != '' ) && $existing_filename != '' ) {
+                    reg_file_delete( $existing_filename );
+                    $existing_filename ='';
+                }
+
+                if( $mfFile['name'] != '' ) {
+                    if( !($new_filename = reg_file_upload('mf_field_file')) )
+                        $new_filename = '';
+                } else {
+                    $new_filename = $existing_filename;
+                }
+
+                reg_db_auto_exec( "UPDATE ".MF_TABLE." SET file = '".addslashes($new_filename)."' WHERE id= $mf_field_id;" );
+
+                break;
+
+            case "Set Custom ID":
+
+                // $r['modified'] = true;
+                $mf_custom_id = trim($mf_custom_id);
+
+                if( $mf_custom_id != '' && db_auto_get_row( "SELECT id FROM ".MF_TABLE." WHERE form_id = '$mf_id' AND custom_id = '$mf_custom_id';" ) ) {
+                    $mf_custom_id_update_message = 'ID in Use.';
+                } else {
+                    reg_db_auto_exec( "UPDATE ".MF_TABLE." SET custom_id = '".trim($mf_custom_id)."' WHERE id = $mf_field_id;" );
+                }
+
+                break;
+
+            case "Clear Default":
+
+                reg_db_auto_exec( "UPDATE ".MF_TABLE." SET default_val = '' WHERE id = $mf_field_id;" );
+
+                break;
+
+            case "Set Default":
+
+                reg_db_auto_exec( "UPDATE ".MF_TABLE." SET default_val = '".$mf_def_val."' WHERE id = $mf_field_id;" );
+
+                break;
+
+            case "Delete":
+
+                // $r['modified'] = true;
+
+                    // Delete any Images or Files associated with these fields
+
+                if( ($del_fields = reg_db_auto_get_data( "SELECT * FROM ".MF_TABLE." WHERE form_id LIKE '$mf_id.%' OR id = $mf_field_id;" )) ) {
+                    foreach( $del_fields as $d ) {
+                        switch( $d['type'] ) {
+                            case 24:    // Image
+                                reg_delete_image( $d['file'] );
+                                break;
+                            case 25:    // File
+                                reg_file_delete( $d['file'] );
+                                break;
+                            default:
+                                break;
+                        }
+                    }
+                }
+
+                if( trim($mf_id.$mf_field_id) != '' ) {
+                    reg_db_auto_exec( "DELETE FROM ".MF_TABLE." WHERE form_id LIKE '$mf_id.$mf_field_id.%' OR id = $mf_field_id;", CONN_STR, FALSE );
+                }
+                break;
+
+            default:
+                break;
+
+        } // switch $mf_action
+
+    } // if $mf_action_id
+
+    // If we need to normalize the sort numbers
+    if( $mf_normalize ) {
+        $mf_data = reg_db_auto_get_data( "SELECT id, sort FROM ".MF_TABLE." WHERE form_id = '$mf_id' ORDER BY sort;", CONN_STR, FALSE );
+        $qs = 'BEGIN;'.$nl;
+        $i = 10;
+        foreach( $mf_data as $mf ) {
+            $qs .= "UPDATE ".MF_TABLE." SET sort = ".$i." WHERE ID = ".$mf['id'].";\n";
+            $i += 10;
+        }
+        reg_db_auto_exec( $qs."COMMIT;", CONN_STR, FALSE );
+    }
+
+        //
+        // Display current form status
+        //
+
+    $font_size = '100%';        // Font size percentage to use for form elements
+
+    $mf_bgcolor = ($mf_level % 2);
+
+    $r['text'] .= '<TABLE BORDER="4" RULES="GROUPS" CELLPADDING="2" CELLSPACING="0" width="95%" BGCOLOR="'.($mf_bgcolor == 1?'#D1F1F1':'#ffffff').'">'.$nl;
+
+    // Get the MagicForm data
+    if( ($mf_fields = reg_db_auto_get_data( "SELECT * FROM ".MF_TABLE." WHERE form_id = '$mf_id' ORDER BY sort;", CONN_STR, FALSE )) ) {
+
+        foreach( $mf_fields as $mf ) {
+
+            $base_form_data = '<FORM ACTION="'.THIS_SCRIPT.'"  ENCTYPE="multipart/form-data" METHOD="post" >
+                    '.$form_data.$mf_form_data.'
+                    <INPUT TYPE="hidden" NAME="mf_field_id" VALUE="'.$mf['id'].'">
+                    ';
+
+            $mf_field_values = $mf_field_content = $mf_text = $mf_type_text = $mf_field_prompt = $mf_field_params = '';
+
+            $mf_title_req = $mf_required = false;
+
+                    /*
+                        $mf_title_req            Field needs title data
+                        $mf_field_content        sub-form area
+                        $mf_type_text            Name for type of field
+                        $mf_field_prompt        Additional text for prompt in title area of a field
+                        $mf_field_params        Additional field parameters to request in pop-up edit box in title area of a field
+                    */
+
+            switch( $mf['type'] ) {
+
+
+                // Checkbox
+
+                case 1:
+
+                    $mf_title_req = true;
+                    $mf_field_content .= '<BR>';
+                    $mf_type_text = 'Checkbox';
+
+                    $mf_field_prompt = '<BR><SPAN CLASS="standout_small">Descr: '.$mf['descr'].'</span>';
+                    $mf_field_params = $base_form_data.'
+                            <TABLE BORDER="0">
+                                <TR>
+                                    <TD>&nbsp;</TD>
+                                    <TD ALIGN="right" VALIGN="top">Title:</TD>
+                                    <TD ALIGN="left" COLSPAN="3" VALIGN="top"><INPUT TYPE="text" NAME="mf_field_title" VALUE="'.$mf['title'].'" STYLE="font-size: '.$font_size.';" SIZE="60"></TD>
+                                </TR>
+                                <TR>
+                                    <TD>&nbsp;</TD>
+                                    <TD ALIGN="right" VALIGN="top">Descr:</TD>
+                                    <TD ALIGN="left" COLSPAN="3" VALIGN="top"><TEXTAREA NAME="mf_field_descr" STYLE="font-size: '.$font_size.';" COLS="60" ROWS="3">'.$mf['descr'].'</TEXTAREA></TD>
+                                </TR>
+                            </TABLE>
+                            <CENTER><INPUT TYPE="submit" NAME="mf_action" VALUE="Update Field" STYLE="font-size: '.$font_size.';"></CENTER>
+                        </FORM>
+                    ';
+
+                    $mf_field_content .= '<TABLE BORDER="0" WIDTH="100%" CELLPADDING="2" CELLSPACING="0" RULES="GROUPS">';
+
+                    if( !empty($mf['data1']) ) {
+
+                        $mf_data1 = explode("|", $mf['data1']);
+                        for ($i=1 ; $i<=count($mf_data1) ; $i++) {
+
+                            $x = explode("~", $mf_data1[$i-1]);
+
+                            // Process Sub-Forms before this field in case we need the data
+                            if ($x[1] != '') {
+                                $rs = magic_form_edit($x[1], $mf_format, $mf_level+1);
+                            }
+
+                            // Build list of variables from sub-forms to optionally use as value
+                            $sub_vars = array();
+                            $vars = '';
+                            if ($x[1] != '') {
+                                $sub_vars = get_sub_vars($x[1]);
+                            }
+                            while (list($key, $val) = each($sub_vars)) {
+                                $vars .= '<option value="'.$key.'" '.($key==$x[4]?' SELECTED':'').'>'.$val.'</option>';
+                            }
+
+                                // Set option value output format
+
+                            if (trim($x[4]) != '' && isset($sub_vars[$x[4]])) {
+                                $xv = $sub_vars[$x[4]];
+                            } elseif (trim($x[2]) != '') {
+                                switch($x[3]) {
+                                    case 1:
+                                        $xv = money($x[2]);
+                                        break;
+                                    default:
+                                        $xv = $x[2];
+                                        break;
+                                }
+                            } else {
+                                $xv = '(no value)';
+                            }
+
+                            $mf_field_content .= '
+                                <TR>
+                                    <TD ALIGN="left" VALIGN="top" CLASS="standout_small"><b>Option</b>: '.stripslashes($x[0]).'<br>'
+                                        .quick_edit( $mf['id'].'.'.$i, 'Value: '.$xv,
+                                        '<CENTER>'.$base_form_data.'
+                                            <INPUT TYPE="hidden" NAME="mf_option_id" VALUE="'.$i.'">
+                                            <table border="0">
+                                                <tr>
+                                                    <td align="right">Source of Value: </td>
+                                                    <td align="left">
+                                                        <SELECT NAME="mf_option_value_src">
+                                                            <OPTION VALUE="0"'.($x[5]==0?' SELECTED':'').'>(use Specified Value Below)</OPTION>
+                                                            '.$vars.'
+                                                        </SELECT>
+                                                    </td>
+                                                </tr>
+                                                <tr><td align="right">Specified value: </td><td align="left"><INPUT TYPE="text" NAME="mf_option_value" STYLE="font-size: '.$font_size.';" VALUE="'.$x[2].'" SIZE="10"></td><tr>
+                                                <tr>
+                                                    <td align="right">Value Type: </td>
+                                                    <td align="left">
+                                                        <SELECT NAME="mf_option_value_type">
+                                                            <OPTION VALUE="0"'.($x[3]==0?' SELECTED':'').'>Number</OPTION>
+                                                            <OPTION VALUE="1"'.($x[3]==1?' SELECTED':'').'>Money</OPTION>
+                                                        </SELECT>
+                                                    </td>
+                                                </tr>
+                                            </table>
+                                            <INPUT TYPE="submit" NAME="mf_action" VALUE="Edit Option Value" STYLE="font-size: '.$font_size.';">
+                                        </FORM></CENTER>' )
+                                    .'</TD>
+                                    <TD ALIGN="right">
+                                        '.( $x[1] == '' ?
+                                                '<A HREF="'.THIS_SCRIPT.'?Action=Ref_Edi&'.$link_data.$mf_link_data.'&mf_action=Add+Subform&mf_field_id='.$mf['id'].'&mf_option_id='.$i.'">[Sub-Form]</A>'
+                                                :
+                                                '<A HREF="'.THIS_SCRIPT.'?Action=Ref_Edi&'.$link_data.$mf_link_data.'&mf_action=Delete+Subform&mf_field_id='.$mf['id'].'&mf_option_id='.$i.'">[Delete Sub-Form]</A>'
+                                                ).'
+                                        <A HREF="'.THIS_SCRIPT.'?Action=Ref_Edi&'.$link_data.$mf_link_data.'&mf_action=Move+Option+Up&mf_field_id='.$mf['id'].'&mf_option_id='.$i.'" ><b>&uarr;</b></A>
+                                        <A HREF="'.THIS_SCRIPT.'?Action=Ref_Edi&'.$link_data.$mf_link_data.'&mf_action=Move+Option+Down&mf_field_id='.$mf['id'].'&mf_option_id='.$i.'"><b>&darr;</b></A>
+                            ';
+
+                            $mf_field_content .= '</TD>
+                                        </TR>';
+                            if ($i == $mf['default_val']) {
+                                $mf_field_content .= '<TR><TD ALIGN="left" VALIGN="top" CLASS="standout_small" COLSPAN="3">Default Selection</TD></TR>';
+                            } else {
+                                $mf_field_content .= '<TR><TD ALIGN="left" VALIGN="top" CLASS="standout_small" COLSPAN="3"><A HREF="'.THIS_SCRIPT.'?Action=Ref_Edi&'.$link_data.$mf_link_data.'&mf_action=Set+Default&mf_field_id='.$mf['id'].'&mf_def_val='.$i.'">Set as default selection</A></TD></TR>';
+                            }
+
+                            // Check if sub-form displayed
+                            if( $x[1] != '' ) {
+                                if( $rs['success'] ) {
+                                    $mf_field_content .= '<TR><TD COLSPAN="3" ALIGN="right">'.$rs['text'].'</TD></TR>';
+                                }
+                                if( $rs['modified'] ) {
+                                    $r['modified'] = true;
+                                }
+                            }
+                            $mf_field_content .= ''.$nl;
+                        }
+                    }
+                    $mf_field_content .= '</TABLE>';
+                    break;
+
+                    // Number
+
+                case 2:
+                    $mf_type_text = 'Number';
+                    $mf_title_req = true;
+
+                    $mf_field_prompt = '<BR><SPAN CLASS="standout_small">Descr: '.$mf['descr'].'<br>
+                                            Columns: '.$mf['cols'].'<br>Default Value: '.$mf['default_val'].'</span>';
+                    $mf_field_params = $base_form_data.'
+                        <TABLE BORDER="0">
+                            <TR>
+                                <TD>&nbsp;</TD>
+                                <TD ALIGN="right" VALIGN="top">Title:</TD>
+                                <TD ALIGN="left" COLSPAN="3" VALIGN="top"><INPUT TYPE="text" NAME="mf_field_title" VALUE="'.$mf['title'].'" STYLE="font-size: '.$font_size.';" SIZE="60"></TD>
+                            </TR>
+                            <TR>
+                                <TD>&nbsp;</TD>
+                                <TD ALIGN="right" VALIGN="top">Descr:</TD>
+                                <TD ALIGN="left" COLSPAN="3" VALIGN="top"><TEXTAREA NAME="mf_field_descr" STYLE="font-size: '.$font_size.';" COLS="60" ROWS="3">'.$mf['descr'].'</TEXTAREA></TD>
+                            </TR>
+                            <TR>
+                                <TD>&nbsp;</TD>
+                                <TD ALIGN="right" VALIGN="top">Columns:</TD>
+                                <TD ALIGN="left" COLSPAN="3" VALIGN="top"><INPUT TYPE="text" NAME="mf_field_cols" VALUE="'.$mf['cols'].'" STYLE="font-size: '.$font_size.';" SIZE="6"> </TD>
+                            </TR>
+                            <TR>
+                                <TD>&nbsp;</TD>
+                                <TD ALIGN="right" VALIGN="top">Default Value:</TD>
+                                <TD ALIGN="left" COLSPAN="3" VALIGN="top"><INPUT TYPE="text" NAME="mf_def_val" VALUE="'.$mf['default_val'].'" STYLE="font-size: '.$font_size.';" SIZE="30"> </TD>
+                            </TR>
+                        </TABLE>
+                        <CENTER><INPUT TYPE="submit" NAME="mf_action" VALUE="Update Field" STYLE="font-size: '.$font_size.';"></CENTER>
+                        </FORM>
+                    ';
+
+                    $mf_field_content .= '<TABLE BORDER="0" WIDTH="100%" CELLPADDING="2" CELLSPACING="0" RULES="GROUPS">';
+
+                    $mf_data1 = explode( "|", $mf['data1'] );
+                    for( $i=1 ; $i<=2 ; $i++ ) {
+                        $x = explode( "~", $mf_data1[$i-1] );
+                        $mf_field_content .= '
+                            <TR>
+                                <TD ALIGN="left" VALIGN="top" CLASS="standout_small"><B>Option</b>: '.($i==1?'No Response':'Response Provided').'</TD>
+                                <TD ALIGN="left">'.($x[2]>0?money($x[2]):'').'</TD>
+                                <TD ALIGN="right">'.( $x[1] == '' ?
+                                    '<A HREF="'.THIS_SCRIPT.'?Action=Ref_Edi&amp;'.$link_data.$mf_link_data.'&amp;mf_action=Add+Subform&amp;mf_field_id='.$mf['id'].'&amp;mf_option_id='.$i.'">[Sub-Form]</A>'
+                                        :
+                                    '<A HREF="'.THIS_SCRIPT.'?Action=Ref_Edi&amp;'.$link_data.$mf_link_data.'&amp;mf_action=Delete+Subform&amp;mf_field_id='.$mf['id'].'&amp;mf_option_id='.$i.'">[Delete Sub-Form]</A>'
+                                    ).'
+                        ';
+
+                        $mf_field_content .= '
+                                </TD>
+                            </TR>';
+                        if( $x[1] != '' ) {
+                            $rs = magic_form_edit( $x[1], $mf_format, $mf_level+1 );
+                            if( $rs['success'] ) {
+                                $mf_field_content .= '<TR><TD COLSPAN="3" ALIGN="right">'.$rs['text'].'</TD></TR>';
+                            }
+                            if( $rs['modified'] ) {
+                                $r['modified'] = true;
+                            }
+                        }
+                        $mf_field_content .= ''.$nl;
+                    }
+
+                    $mf_field_content .= '</TABLE>';
+
+                    break;
+
+                    // Text field
+
+                case 3:
+                    $mf_type_text = 'Text';
+                    $mf_title_req = true;
+                    $mf_type_text = 'Text';
+                    $mf_required = true;        // Can be a required field
+
+                    $mf_field_prompt = '<BR><SPAN CLASS="standout_small">Descr: '.$mf['descr'].'<br>
+                                            Columns: '.$mf['cols'].'<br>Default Value: '.$mf['default_val'].'</span>';
+                    $mf_field_params = $base_form_data.'
+                        <TABLE BORDER="0">
+                            <TR>
+                                <TD>&nbsp;</TD>
+                                <TD ALIGN="right" VALIGN="top">Title:</TD>
+                                <TD ALIGN="left" COLSPAN="3" VALIGN="top"><INPUT TYPE="text" NAME="mf_field_title" VALUE="'.$mf['title'].'" STYLE="font-size: '.$font_size.';" SIZE="60"></TD>
+                            </TR>
+                            <TR>
+                                <TD>&nbsp;</TD>
+                                <TD ALIGN="right" VALIGN="top">Descr:</TD>
+                                <TD ALIGN="left" COLSPAN="3" VALIGN="top"><TEXTAREA NAME="mf_field_descr" STYLE="font-size: '.$font_size.';" COLS="60" ROWS="3">'.$mf['descr'].'</TEXTAREA></TD>
+                            </TR>
+                            <TR>
+                                <TD>&nbsp;</TD>
+                                <TD ALIGN="right" VALIGN="top">Columns:</TD>
+                                <TD ALIGN="left" COLSPAN="3" VALIGN="top"><INPUT TYPE="text" NAME="mf_field_cols" VALUE="'.$mf['cols'].'" STYLE="font-size: '.$font_size.';" SIZE="6"> </TD>
+                            </TR>
+                            <TR>
+                                <TD>&nbsp;</TD>
+                                <TD ALIGN="right" VALIGN="top">Default Value:</TD>
+                                <TD ALIGN="left" COLSPAN="3" VALIGN="top"><INPUT TYPE="text" NAME="mf_def_val" VALUE="'.$mf['default_val'].'" STYLE="font-size: '.$font_size.';" SIZE="30"> </TD>
+                            </TR>
+                        </TABLE>
+                        <CENTER><INPUT TYPE="submit" NAME="mf_action" VALUE="Update Field" STYLE="font-size: '.$font_size.';"></CENTER>
+                        </FORM>
+                    ';
+
+                    $mf_field_content .= '<TABLE BORDER="0" WIDTH="100%" CELLPADDING="2" CELLSPACING="0" RULES="GROUPS">';
+                    $mf_data1 = explode( "|", $mf['data1'] );
+                    for( $i=1 ; $i<=2 ; $i++ ) {
+                        $x = explode( "~", $mf_data1[$i-1] );
+                        $mf_field_content .= '
+                            <TR>
+                                <TD ALIGN="left" VALIGN="top" CLASS="standout_small"><b>Option</b>: '.($i==1?'No Response':'Response Provided').'</TD>
+                                <TD ALIGN="left">'.($x[2]>0?money($x[2]):'').'</TD>
+                                <TD ALIGN="right">'.( $x[1] == '' ?
+                                    '<A HREF="'.THIS_SCRIPT.'?Action=Ref_Edi&amp;'.$link_data.$mf_link_data.'&amp;mf_action=Add+Subform&amp;mf_field_id='.$mf['id'].'&amp;mf_option_id='.$i.'">[Sub-Form]</A>'
+                                    :
+                                    '<A HREF="'.THIS_SCRIPT.'?Action=Ref_Edi&amp;'.$link_data.$mf_link_data.'&amp;mf_action=Delete+Subform&amp;mf_field_id='.$mf['id'].'&amp;mf_option_id='.$i.'">[Delete Sub-Form]</A>'
+                                    ).'
+                        ';
+
+                        $mf_field_content .= '
+                                </TD>
+                            </TR>
+                        ';
+                        if( $x[1] != '' ) {
+                            $rs = magic_form_edit( $x[1], $mf_format, $mf_level+1 );
+                            if( $rs['success'] ) {
+                                $mf_field_content .= '<TR><TD COLSPAN="3" ALIGN="right">'.$rs['text'].'</TD></TR>';
+                            }
+                            if( $rs['modified'] ) {
+                                $r['modified'] = true;
+                            }
+                        }
+                        $mf_field_content .= ''.$nl;
+                    }
+
+                    $mf_field_content .= '</TABLE>';
+
+                    break;
+
+                    // Text Box
+
+                case 4:
+                    $mf_type_text = 'Text Box';
+                    $mf_title_req = true;
+                    $mf_type_text = 'Text Box';
+                    $mf_required = true;        // Can be a required field
+
+                    $mf_field_prompt = '<BR><SPAN CLASS="standout_small">Descr: '.$mf['descr'].'<br>Columns: '.$mf['cols'].'<br>Rows: '.$mf['rows'].'</span>';
+                    $mf_field_params = $base_form_data.'
+                        <TABLE BORDER="0">
+                            <TR>
+                                <TD>&nbsp;</TD>
+                                <TD ALIGN="right" VALIGN="top">Title:</TD>
+                                <TD ALIGN="left" COLSPAN="3" VALIGN="top"><INPUT TYPE="text" NAME="mf_field_title" VALUE="'.$mf['title'].'" STYLE="font-size: '.$font_size.';" SIZE="60"></TD>
+                            </TR>
+                            <TR>
+                                <TD>&nbsp;</TD>
+                                <TD ALIGN="right" VALIGN="top">Descr:</TD>
+                                <TD ALIGN="left" COLSPAN="3" VALIGN="top"><TEXTAREA NAME="mf_field_descr" STYLE="font-size: '.$font_size.';" COLS="60" ROWS="3">'.$mf['descr'].'</TEXTAREA></TD>
+                            </TR>
+                            <TR>
+                                <TD>&nbsp;</TD>
+                                <TD ALIGN="right" VALIGN="top">Columns:</TD>
+                                <TD ALIGN="left" COLSPAN="3" VALIGN="top"><INPUT TYPE="text" NAME="mf_field_cols" VALUE="'.$mf['cols'].'" STYLE="font-size: '.$font_size.';" SIZE="6"> </TD>
+                            </TR>
+                            <TR>
+                                <TD>&nbsp;</TD>
+                                <TD ALIGN="right" VALIGN="top">Rows:</TD>
+                                <TD ALIGN="left" COLSPAN="3" VALIGN="top"><INPUT TYPE="text" NAME="mf_field_rows" VALUE="'.$mf['rows'].'" STYLE="font-size: '.$font_size.';" SIZE="6"> </TD>
+                            </TR>
+                        </TABLE>
+                        <CENTER><INPUT TYPE="submit" NAME="mf_action" VALUE="Update Field" STYLE="font-size: '.$font_size.';"></CENTER>
+                        </FORM>
+                    ';
+
+                    $mf_field_content .= '<TABLE BORDER="0" WIDTH="100%" CELLPADDING="2" CELLSPACING="0" RULES="GROUPS">';
+                    $mf_data1 = explode( "|", $mf['data1'] );
+                    for( $i=1 ; $i<=2 ; $i++ ) {
+                        $x = explode( "~", $mf_data1[$i-1] );
+                        $mf_field_content .= '
+                            <TR>
+                                <TD ALIGN="left" VALIGN="top" CLASS="standout_small"><b>Option</b>: '.($i==1?'No Response':'Response Provided').'</TD>
+                                <TD ALIGN="left">'.($x[2]>0?money($x[2]):'').'</TD>
+                                <TD ALIGN="right">'.( $x[1] == '' ?
+                                '<A HREF="'.THIS_SCRIPT.'?Action=Ref_Edi&amp;'.$link_data.$mf_link_data.'&amp;mf_action=Add+Subform&amp;mf_field_id='.$mf['id'].'&amp;mf_option_id='.$i.'">[Sub-Form]</A>'
+                                :
+                                '<A HREF="'.THIS_SCRIPT.'?Action=Ref_Edi&amp;'.$link_data.$mf_link_data.'&amp;mf_action=Delete+Subform&amp;mf_field_id='.$mf['id'].'&amp;mf_option_id='.$i.'">[Delete Sub-Form]</A>'
+                            ).'
+                        ';
+
+                        $mf_field_content .= '
+                                </TD>
+                            </TR>
+                        ';
+                        if( $x[1] != '' ) {
+                            $rs = magic_form_edit( $x[1], $mf_format, $mf_level+1 );
+                            if( $rs['success'] ) {
+                                $mf_field_content .= '<TR><TD COLSPAN="3" ALIGN="right">'.$rs['text'].'</TD></TR>';
+                            }
+                            if( $rs['modified'] ) {
+                                $r['modified'] = true;
+                            }
+                        }
+                        $mf_field_content .= ''.$nl;
+                    }
+
+                    $mf_field_content .= '</TABLE>';
+                    break;
+
+                    // Picklist
+
+                case 5:
+
+                    // Radio Buttons
+
+                case 6:
+                    $mf_title_req = true;
+                    $mf_required = true;        // Can be a required field
+
+                    switch( $mf['type'] ) {
+                        case 5:
+                            $mf_type_text = 'Picklist';
+                            break;
+                        case 6:
+                            $mf_type_text = 'Radio Buttons';
+                            break;
+                    }
+
+                    $mf_field_prompt = '<BR><SPAN CLASS="standout_small">Descr: '.$mf['descr'].'</span>';
+                    $mf_field_params = $base_form_data.'
+                               <TABLE BORDER="0">
+                                <TR>
+                                    <TD>&nbsp;</TD>
+                                    <TD ALIGN="right" VALIGN="top">Title:</TD>
+                                    <TD ALIGN="left" COLSPAN="3" VALIGN="top"><INPUT TYPE="text" NAME="mf_field_title" VALUE="'.$mf['title'].'" STYLE="font-size: '.$font_size.';" SIZE="60"></TD>
+                                </TR>
+                                <TR>
+                                    <TD>&nbsp;</TD>
+                                    <TD ALIGN="right" VALIGN="top">Descr:</TD>
+                                    <TD ALIGN="left" COLSPAN="3" VALIGN="top"><TEXTAREA NAME="mf_field_descr" STYLE="font-size: '.$font_size.';" COLS="60" ROWS="3">'.$mf['descr'].'</TEXTAREA></TD>
+                                </TR>
+                            </TABLE>
+                            <CENTER><INPUT TYPE="submit" NAME="mf_action" VALUE="Update Field" STYLE="font-size: '.$font_size.';"></CENTER>
+                        </FORM>
+                    ';
+
+                    $mf_field_content .= '<TABLE BORDER="0" WIDTH="100%" CELLPADDING="2" CELLSPACING="0" RULES="GROUPS">';
+                    if( !empty($mf['data1']) ) {
+                        $mf_data1 = explode( "|", $mf['data1'] );
+                        for( $i=1 ; $i<=count($mf_data1) ; $i++ ) {
+                            $x = explode( "~", $mf_data1[$i-1] );
+
+                            // Process Sub-Forms before this field in case we need the data
+                            if( $x[1] != '' ) {
+                                $rs = magic_form_edit( $x[1], $mf_format, $mf_level+1 );
+                            }
+
+                            // Build list of variables from sub-forms to optionally use as value
+                            $sub_vars = array();
+                            $vars = '';
+                            if( $x[1] != '' ) {
+                                $sub_vars = get_sub_vars( $x[1] );
+                            }
+                            while( list($key, $val) = each($sub_vars) ) {
+                                $vars .= '<option value="'.$key.'" '.($key==$x[4]?' SELECTED':'').'>'.$val.'</option>';
+                            }
+
+                            // Set option value output format
+                            if( trim($x[4]) != '' && isset($sub_vars[$x[4]]) ) {
+                                $xv = $sub_vars[$x[4]];
+                            } elseif( trim($x[2]) != '' ) {
+                                switch( $x[3] ) {
+                                    case 1:
+                                        $xv = money($x[2]);
+                                        break;
+                                    default:
+                                        $xv = $x[2];
+                                        break;
+                                }
+                            } else {
+                                $xv = '(no value)';
+                            }
+
+                            $mf_field_content .= '
+                                <TR>
+                                    <TD ALIGN="left" VALIGN="top" CLASS="standout_small">'
+                                        .quick_edit( $mf['id'].'.'.$i, '<b>Option</b>: '.stripslashes($x[0]),
+                                        '<CENTER>
+                                            '.$base_form_data.'
+                                                <INPUT TYPE="hidden" NAME="mf_option_id" VALUE="'.$i.'">
+                                                <INPUT TYPE="text" NAME="mf_option_name" STYLE="font-size: '.$font_size.';" VALUE="'.stripslashes($x[0]).'" SIZE="50"><BR>
+                                                <INPUT TYPE="submit" NAME="mf_action" VALUE="Edit Option Name" STYLE="font-size: '.$font_size.';">
+                                            </FORM>
+                                        </CENTER>' )
+                                        .'<br>'
+                                        .quick_edit( $mf['id'].'.'.$i."_value", 'Value: '.$xv,
+                                        '<CENTER>'.$base_form_data.'
+                                            <INPUT TYPE="hidden" NAME="mf_option_id" VALUE="'.$i.'">
+                                             NOTE: Option value must be a number. Do not include a $ for monetary values.<br>
+                                                Leave blank for no value.<p>
+                                            <table border="0">
+                                                <tr>
+                                                    <td align="right">Source of Value: </td>
+                                                    <td align="left">
+                                                        <SELECT NAME="mf_option_value_src">
+                                                            <OPTION VALUE="0"'.($x[5]==0?' SELECTED':'').'>(use Specified Value Below)</OPTION>
+                                                            '.$vars.'
+                                                        </SELECT>
+                                                    </td>
+                                                </tr>
+                                                <tr><td align="right">Specified value: </td><td align="left"><INPUT TYPE="text" NAME="mf_option_value" STYLE="font-size: '.$font_size.';" VALUE="'.$x[2].'" SIZE="10"></td><tr>
+                                                <tr>
+                                                    <td align="right">Value Type: </td>
+                                                    <td align="left">
+                                                        <SELECT NAME="mf_option_value_type">
+                                                            <OPTION VALUE="0"'.($x[3]==0?' SELECTED':'').'>Number</OPTION>
+                                                            <OPTION VALUE="1"'.($x[3]==1?' SELECTED':'').'>Money</OPTION>
+                                                        </SELECT>
+                                                    </td>
+                                                </tr>
+                                            </table>
+                                            <INPUT TYPE="submit" NAME="mf_action" VALUE="Edit Option Value" STYLE="font-size: '.$font_size.';">
+                                        </FORM></CENTER>' )
+                                    .'</TD>
+                                    <TD ALIGN="right">
+                                        '.( $x[1] == '' ?
+                                                '<A HREF="'.THIS_SCRIPT.'?Action=Ref_Edi&'.$link_data.$mf_link_data.'&mf_action=Add+Subform&mf_field_id='.$mf['id'].'&mf_option_id='.$i.'">[Sub-Form]</A>'
+                                                :
+                                                '<A HREF="'.THIS_SCRIPT.'?Action=Ref_Edi&'.$link_data.$mf_link_data.'&mf_action=Delete+Subform&mf_field_id='.$mf['id'].'&mf_option_id='.$i.'">[Delete Sub-Form]</A>'
+                                                ).'
+                                        <A HREF="'.THIS_SCRIPT.'?Action=Ref_Edi&'.$link_data.$mf_link_data.'&mf_action=Delete+Option&mf_field_id='.$mf['id'].'&mf_option_id='.$i.'">[delete]</A>
+                                        <A HREF="'.THIS_SCRIPT.'?Action=Ref_Edi&'.$link_data.$mf_link_data.'&mf_action=Move+Option+Up&mf_field_id='.$mf['id'].'&mf_option_id='.$i.'" ><b>&uarr;</b></A>
+                                        <A HREF="'.THIS_SCRIPT.'?Action=Ref_Edi&'.$link_data.$mf_link_data.'&mf_action=Move+Option+Down&mf_field_id='.$mf['id'].'&mf_option_id='.$i.'"><b>&darr;</b></A>
+                            ';
+
+                            $mf_field_content .= '
+                                    </TD>
+                                </TR>
+                            ';
+
+                            if( $i == $mf['default_val'] ) {
+                                $mf_field_content .= '<TR><TD ALIGN="left" VALIGN="top" CLASS="standout_small" COLSPAN="3"><A HREF="'.THIS_SCRIPT.'?Action=Ref_Edi&'.$link_data.$mf_link_data.'&mf_action=Clear+Default&mf_field_id='.$mf['id'].'&mf_def_val='.$i.'">DEFAULT: Click to clear default selection</A></TD></TR>';
+                            } else {
+                                $mf_field_content .= '<TR><TD ALIGN="left" VALIGN="top" CLASS="standout_small" COLSPAN="3"><A HREF="'.THIS_SCRIPT.'?Action=Ref_Edi&'.$link_data.$mf_link_data.'&mf_action=Set+Default&mf_field_id='.$mf['id'].'&mf_def_val='.$i.'">Set as default selection</A></TD></TR>';
+                            }
+
+                            if( $x[1] != '' ) {
+                                if( $rs['success'] ) {
+                                    $mf_field_content .= '<TR><TD COLSPAN="3" ALIGN="right">'.$rs['text'].'</TD></TR>';
+                                }
+                                if( $rs['modified'] ) {
+                                    $r['modified'] = true;
+                                }
+                            }
+                            $mf_field_content .= ''.$nl;
+                        }
+                    } else {
+                        $mf_field_content .= '<TR><TD COLSPAN="3" ALIGN="left"><FONT COLOR="red">No options selected yet.</FONT></TD></TR>'.$nl;
+                    }
+
+                    $mf_field_content .= '
+                            <TR>
+                                <TD COLSPAN="3" ALIGN="right">'
+                                    .quick_edit( '_add_option_'.$mf['id'],
+                                    '<span class="pseudo_link">[Add Option]</span>',
+                                    '<CENTER>
+                                        '.$base_form_data.'
+                                            Option Name: <INPUT TYPE="text" NAME="mf_field_option" STYLE="font-size: '.$font_size.';">
+                                            <INPUT TYPE="submit" NAME="mf_action" VALUE="Add Option" STYLE="font-size: '.$font_size.';">
+                                        </FORM>
+                                    </CENTER>' )
+                                .'</TD>
+                            <TR>
+                        </TABLE>
+                    ';
+                    $mf_title_req = true;
+                    break;
+
+                    // File Upload
+
+                case 7:
+                    $mf_type_text = 'File Upload';
+                    $mf_title_req = true;
+                    $mf_required = true;        // Can be a required field
+
+                    $mf_field_prompt = '<BR><SPAN CLASS="standout_small">Descr: '.$mf['descr'].'</span>';
+                    $mf_field_params = $base_form_data.'
+                            <TABLE BORDER="0">
+                                <TR>
+                                    <TD>&nbsp;</TD>
+                                    <TD ALIGN="right" VALIGN="top">Title:</TD>
+                                    <TD ALIGN="left" COLSPAN="3" VALIGN="top"><INPUT TYPE="text" NAME="mf_field_title" VALUE="'.$mf['title'].'" STYLE="font-size: '.$font_size.';" SIZE="60"></TD>
+                                </TR>
+                                <TR>
+                                    <TD>&nbsp;</TD>
+                                    <TD ALIGN="right" VALIGN="top">Descr:</TD>
+                                    <TD ALIGN="left" COLSPAN="3" VALIGN="top"><TEXTAREA NAME="mf_field_descr" STYLE="font-size: '.$font_size.';" COLS="60" ROWS="3">'.$mf['descr'].'</TEXTAREA></TD>
+                                </TR>
+                            </TABLE>
+                            <CENTER><INPUT TYPE="submit" NAME="mf_action" VALUE="Update Field" STYLE="font-size: '.$font_size.';"></CENTER>
+                        </FORM>
+                    ';
+
+                    $mf_field_content .= '<TABLE BORDER="0" WIDTH="100%" CELLPADDING="2" CELLSPACING="0" RULES="GROUPS">';
+                    $mf_data1 = explode( "|", $mf['data1'] );
+                    for( $i=1 ; $i<=2 ; $i++ ) {
+                        $x = explode( "~", $mf_data1[$i-1] );
+                        $mf_field_content .= '
+                            <TR>
+                                <TD ALIGN="left" VALIGN="top" CLASS="standout_small"><b>Option</b>: '.($i==1?'No Response':'Response Provided').'</TD>
+                                <TD ALIGN="left">'.($x[2]>0?money($x[2]):'').'</TD>
+                                <TD ALIGN="right">'.( $x[1] == '' ?
+                                    '<A HREF="'.SI_THIS_SCRIPT.'?Action=Ref_Edi&amp;'.$link_data.$mf_link_data.'&amp;mf_action=Add+Subform&amp;mf_field_id='.$mf['id'].'&amp;mf_option_id='.$i.'">[Sub-Form]</A>'
+                                    :
+                                    '<A HREF="'.SI_THIS_SCRIPT.'?Action=Ref_Edi&amp;'.$link_data.$mf_link_data.'&amp;mf_action=Delete+Subform&amp;mf_field_id='.$mf['id'].'&amp;mf_option_id='.$i.'">[Delete Sub-Form]</A>'
+                                ).'
+                            ';
+
+                            $mf_field_content .= '
+                                    </TD>
+                                </TR>
+                            ';
+                            if( $x[1] != '' ) {
+                                $rs = magic_form_edit( $x[1], $mf_format, $mf_level+1 );
+                                if( $rs['success'] ) {
+                                    $mf_field_content .= '<TR><TD COLSPAN="3" ALIGN="right">'.$rs['text'].'</TD></TR>';
+                                }
+                                if( $rs['modified'] ) {
+                                    $r['modified'] = true;
+                                }
+                            }
+                        $mf_field_content .= ''.$nl;
+                    }
+
+                    $mf_field_content .= '</TABLE>';
+
+                    break;
+
+
+                    // Section Title
+
+                case 20:
+                    $mf_type_text = 'Section Title';
+                    $mf_title_req = true;
+                    $mf_field_prompt = '<SPAN CLASS="standout">'.($mf['data1']!='' ? stripslashes($mf['data1']) : '(Section title not set)').'</span>';
+                    $mf_field_params =
+                        $base_form_data.'
+                            <TABLE BORDER="0">
+                                <TR>
+                                    <TD>&nbsp;</TD>
+                                    <TD ALIGN="right" VALIGN="top">Title:</TD>
+                                    <TD ALIGN="left" COLSPAN="3" VALIGN="top"><INPUT TYPE="text" NAME="mf_field_text" VALUE="'.$mf['data1'].'" STYLE="font-size: '.$font_size.';" SIZE="80"></TD>
+                                </TR>
+                            </TABLE>
+                            <CENTER><INPUT TYPE="submit" NAME="mf_action" VALUE="Update Text" STYLE="font-size: '.$font_size.';"></CENTER>
+                        </FORM>
+                    ' ;
+
+                    break;
+
+                    // Misc. Text
+
+                case 21:
+                    $mf_type_text = 'Misc. Text';
+                    $mf_text .= $mf['expanded'] != 't' ? '<SPAN CLASS="standout_small">Misc Text</span>' : '<SPAN CLASS="standout_small"><b>Misc Text</b></span>';
+                    $mf_field_content .= quick_edit( $mf['id'], (
+                           $mf['data1'] != '' ? ( $mf['expanded'] == 't' ?
+                            stripslashes($mf['data1'])
+                            :
+                            substr( stripslashes($mf['data1']), 0, 225 ).' ...'
+                        )
+                        :
+                        '<SPAN CLASS="standout_small">(Misc. text not set)</SPAN>'
+                        ),
+                        $base_form_data.'
+                                <TABLE BORDER="0">
+                                    <TR>
+                                        <TD>&nbsp;</TD>
+                                        <TD ALIGN="right" VALIGN="top">Misc. Text:</TD>
+                                        <TD ALIGN="left" COLSPAN="3" VALIGN="top"><TEXTAREA NAME="mf_field_text" STYLE="font-size: '.$font_size.';" COLS="60" ROWS="4">'.$mf['data1'].'</TEXTAREA></TD>
+                                    </TR>
+                                </TABLE>
+                                <CENTER><INPUT TYPE="submit" NAME="mf_action" VALUE="Update Text" STYLE="font-size: '.$font_size.';"></CENTER>
+                            </FORM>
+                        '
+                    );
+
+                    $mf_field_prompt = '';
+                    $mf_field_params = '';
+
+                    break;
+
+                    // Horizontal Line
+
+                case 22:
+                    $mf_type_text = 'Horiz Line';
+                    $mf_text = '<hr>';
+                    break;
+
+                    // Blank Line
+
+                case 23:
+                    $mf_type_text = 'Blank Line';
+                    $mf_text .= '<SPAN CLASS="standout_small">(a blank line)</span>';
+                    break;
+
+                    // Display Image
+
+                case 24:
+                    $mf_title_req = true;
+                    $mf_type_text = 'Image';
+
+                    $mf_field_prompt = '<BR><SPAN CLASS="standout_small">Descr: '.$mf['descr'].'</span>';
+                    $mf_field_params = $base_form_data.'
+                            <TABLE BORDER="0">
+                                <TR>
+                                    <TD>&nbsp;</TD>
+                                    <TD ALIGN="right" VALIGN="top">Title:</TD>
+                                    <TD ALIGN="left" COLSPAN="3" VALIGN="top"><INPUT TYPE="text" NAME="mf_field_title" VALUE="'.$mf['title'].'" STYLE="font-size: '.$font_size.';" SIZE="60"></TD>
+                                </TR>
+                                <TR>
+                                    <TD>&nbsp;</TD>
+                                    <TD ALIGN="right" VALIGN="top">Descr:</TD>
+                                    <TD ALIGN="left" COLSPAN="3" VALIGN="top"><TEXTAREA NAME="mf_field_descr" STYLE="font-size: '.$font_size.';" COLS="60" ROWS="3">'.$mf['descr'].'</TEXTAREA></TD>
+                                </TR>
+                            </TABLE>
+                            <CENTER><INPUT TYPE="submit" NAME="mf_action" VALUE="Update Field" STYLE="font-size: '.$font_size.';"></CENTER>
+                        </FORM>
+                    ';
+
+                    switch( $mf['size'] ) {
+                        case 'original':
+                            $image_size_url = ORIGINAL;
+                            break;
+                        case 'resized':
+                            $image_size_url = RESIZED;
+                            break;
+                        case 'midsized':
+                            $image_size_url = MIDSIZED;
+                            break;
+                        default:
+                        case 'thumb':
+                            $image_size_url = THUMB;
+                            break;
+                    }
+
+                    $mf_field_content .= quick_edit(
+                        $mf['id'].'_image',
+                        ( $mf['file'] != '' ? '<img src="'.$image_size_url.'/'.$mf['file'].'">' : '<SPAN CLASS="standout_small">(Image not set)</SPAN>' ),
+                        $base_form_data.'
+                            <TABLE BORDER="0" width="100%">
+                                <TR>
+                                    <TD COLSPAN="2" align="center">'.( $mf['file'] != '' ? '<img src="'.THUMB.'/'.$mf['file'].'">':'(no image)').'</TD>
+                                </TR>
+                                <TR>
+                                    <TD ALIGN="right">Delete existing Image:</TD>
+                                    <TD ALIGN="left"><INPUT TYPE="checkbox" NAME="mf_field_image_delete"></TD>
+                                </TR>
+                                <TR>
+                                    <TD ALIGN="right">Image Size:</TD>
+                                    <TD ALIGN="left">
+                                        <SELECT NAME="mf_field_imagesize">
+                                            <OPTION VALUE="original"'.($mf['size']=='original'?' SELECTED':'').'>Original</OPTION>
+                                            <OPTION VALUE="resized"'.($mf['size']=='resized'?' SELECTED':'').'>Resized</OPTION>
+                                            <OPTION VALUE="midsized"'.($mf['size']=='midsized'?' SELECTED':'').'>Midsized</OPTION>
+                                            <OPTION VALUE="thumb"'.($mf['size']=='thumb'?' SELECTED':'').'>Thumbnail</OPTION>
+                                        </SELECT>
+                                    </TD>
+                                </TR>
+                                  <TR>
+                                    <TD ALIGN="right">Select Image:</TD>
+                                    <TD ALIGN="left"><INPUT TYPE="file" NAME="mf_field_image"></TD>
+                                </TR>
+                               </TABLE>
+                            <CENTER><INPUT TYPE="submit" NAME="mf_action" VALUE="Update Image" STYLE="font-size: '.$font_size.';"></CENTER>
+                        </FORM>
+                    ' );
+                    break;
+
+                // File Download
+                case 25:
+                    $mf_title_req = true;
+                    $mf_type_text = 'File Download';
+
+                    $mf_field_prompt = '<BR><SPAN CLASS="standout_small">Descr: '.$mf['descr'].'</span>';
+                    $mf_field_params = $base_form_data.'
+                            <TABLE BORDER="0">
+                                <TR>
+                                    <TD>&nbsp;</TD>
+                                    <TD ALIGN="right" VALIGN="top">Title:</TD>
+                                    <TD ALIGN="left" COLSPAN="3" VALIGN="top"><INPUT TYPE="text" NAME="mf_field_title" VALUE="'.$mf['title'].'" STYLE="font-size: '.$font_size.';" SIZE="60"></TD>
+                                </TR>
+                                <TR>
+                                    <TD>&nbsp;</TD>
+                                    <TD ALIGN="right" VALIGN="top">Descr:</TD>
+                                    <TD ALIGN="left" COLSPAN="3" VALIGN="top"><TEXTAREA NAME="mf_field_descr" STYLE="font-size: '.$font_size.';" COLS="60" ROWS="3">'.$mf['descr'].'</TEXTAREA></TD>
+                                </TR>
+                             </TABLE>
+                             <CENTER><INPUT TYPE="submit" NAME="mf_action" VALUE="Update Field" STYLE="font-size: '.$font_size.';"></CENTER>
+                         </FORM>
+                    ';
+
+                    $mf_field_content .= quick_edit(
+                        $mf['id']."_file",
+                        ( $mf['file'] != '' ? '<SPAN CLASS="standout">File: '.$mf['file'].'</SPAN>' : '<SPAN CLASS="standout">(File not provided)</SPAN>' ),
+                        $base_form_data.'
+                                <TABLE BORDER="0" width="100%">'.( $mf['file'] != '' ? '
+                                    <TR>
+                                           <TD ALIGN="right" VALIGN="top">Current File:</TD>
+                                        <TD ALIGN="left" COLSPAN="2">
+                                            <a href="'.FILE_SERVER_URL.IS_OWNER_ID.'/_ORIGINAL_/'.$mf['file'].'" target="file_page">'.$mf['file'].'</a>
+                                            <INPUT TYPE="checkbox" NAME="mf_field_file_delete"> Delete this file
+                                        </TD>
+                                    </TR>
+                                    <TR><TD COLSPAN="2">&nbsp;</TD></TR>
+                                    ' : '' ).'
+                                    <TR>
+                                        <TD ALIGN="right" VALIGN="top">Upload/Replace File:</TD>
+                                        <TD ALIGN="left" COLSPAN="2" VALIGN="top"><INPUT TYPE="file" NAME="mf_field_file"></TD>
+                                    </TR>
+                                </TABLE>
+                                <CENTER><INPUT TYPE="submit" NAME="mf_action" VALUE="Update File" STYLE="font-size: '.$font_size.';"></CENTER>
+                            </FORM>
+                        ');
+
+                    break;
+
+                    // Calculated field
+
+                case 31:
+
+                       // Do we need a title line?
+                    $mf_title_req = true;
+                    $mf_type_text = 'Calculated';
+                    $mf_required = true;        // Can be a required field
+
+                    $mf_field_prompt = '<BR><SPAN CLASS="standout_small">Descr: '.$mf['descr'].'<br>Formula: '.($mf['data1']!=''?stripslashes($mf['data1']):'(Formula not set)').'</span>';
+
+                    // Build html for list of fields that can be used as numeric parameter source
+                    $field_list_html = '';
+
+                    // Display available fields that may be referenced in a formumla, if we have any
+                    $haveFieldsForFormulas = false;
+                    if (is_array($field_list) && count($field_list) > 0) {
+                        while (list($fkey, $f) = each($field_list)) {
+                            if ($fkey != $mf['id']) {
+                                $field_list_html .= '<tr><td><button type="text" onClick="var e = document.getElementById(\'mf_field_text_'.$mf['id'].'\');var t = e.value;var p = e.selectionStart;var s = \'['.$f['fid'].']\';var r = t.substring(0, p) + s + t.substring(p);e.value = r;e.focus();e.selectionStart = p;e.selectionEnd = ( p + s.length )">['.$f['fid'].']</button></td><td>'.$f['title'].'</td></tr>';
+                                $haveFieldsForFormulas = true;
+                            }
+                        }
+                    }
+
+                    // If we have no fields available for formulas, note that in the table
+                    if (!$haveFieldsForFormulas) {
+                        $field_list_html .= '<tr><td colspan="2" align="center">(no fields currently available for caluculations)</td></tr>';
+                    }
+
+                    $mf_field_params = $base_form_data.'
+                            <TABLE BORDER="0">
+                                <TR>
+                                    <TD>&nbsp;</TD>
+                                    <TD ALIGN="right" VALIGN="top">Title:</TD>
+                                    <TD ALIGN="left" COLSPAN="3" VALIGN="top"><INPUT TYPE="text" NAME="mf_field_title" VALUE="'.$mf['title'].'" STYLE="font-size: '.$font_size.';" SIZE="60"></TD>
+                                </TR>
+                                <TR>
+                                    <TD>&nbsp;</TD>
+                                    <TD ALIGN="right" VALIGN="top">Descr:</TD>
+                                    <TD ALIGN="left" COLSPAN="3" VALIGN="top"><TEXTAREA NAME="mf_field_descr" STYLE="font-size: '.$font_size.';" COLS="60" ROWS="3">'.$mf['descr'].'</TEXTAREA></TD>
+                                </TR>
+                                <TR>
+                                    <TD>&nbsp;</TD>
+                                    <TD ALIGN="right" VALIGN="top">Formula:</TD>
+                                    <TD ALIGN="left" COLSPAN="3" VALIGN="top"><INPUT TYPE="text" NAME="mf_field_text" ID="mf_field_text_'.$mf['id'].'" VALUE="'.$mf['data1'].'" STYLE="font-size: '.$font_size.';" SIZE="60"></TD>
+                                </TR>
+                            </TABLE>
+                            <CENTER><INPUT TYPE="submit" NAME="mf_action" VALUE="Update Field" STYLE="font-size: '.$font_size.';"></CENTER>
+                        </FORM>
+                        <p>&nbsp;</p>
+                        <center>
+                            <span class="standout_small">Fields that may be referenced in the forumula.<br>Click field below to insert into formula.</span><br>
+                            <table border="1" width="90%">
+                                <TR><th>Field ID</th><th>Title</th></TR>
+                                    '.$field_list_html.'
+                            </table>
+                        </center>
+                        <ul>
+                           <li>Only fields that can have a numeric value are listed and may be used in a formula.</li>
+                           <li>Only fields preceeding this calculated field are available for this formula.</li>
+                           <li>Formula may have any of the following operators:  + - . * ( )</li>
+                           <li>
+                               Formula may include any of the following functions:<br>
+                               &nbsp;&nbsp;abs, acos, asin, atan, ceil, deg2rad, exp, floor,<br>
+                               &nbsp;&nbsp;log10, log, pi, pow, rand, round, sin, sqrt, tan<br>
+                               &nbsp;&nbsp;For usage see <a href="http://www.w3schools.com/php/php_ref_math.asp" target="usage">http://www.w3schools.com/php/php_ref_math.asp</a>
+                        </ul>
+                    ';
+
+                    $mf_field_content .= '<TABLE BORDER="0" WIDTH="100%" CELLPADDING="2" CELLSPACING="0" RULES="GROUPS">';
+                    $mf_data1 = explode( "|", $mf['data1'] );
+                    for( $i=1 ; $i<=2 ; $i++ ) {
+                        $x = explode( "~", $mf_data1[$i-1] );
+                        $mf_field_content .= '';
+                        if( $x[1] != '' ) {
+                            $rs = magic_form_edit( $x[1], $mf_format, $mf_level+1 );
+                            if( $rs['success'] ) {
+                                $mf_field_content .= '<TR><TD COLSPAN="3" ALIGN="right">'.$rs['text'].'</TD></TR>';
+                            }
+                            if( $rs['modified'] ) {
+                                $r['modified'] = true;
+                            }
+                        }
+                           $mf_field_content .= ''.$nl;
+                    }
+                    $mf_field_content .= '</TABLE>';
+                    break;
+
+                case 0:
+                default:
+                    $mf_field_content = '&nbsp;';
+                    break;
+            }
+
+                // Build list of available styles for this field
+
+            $mf_style_list = '';
+            reset( $mf_styles );
+            while( list($key, $val) = each($mf_styles) )
+                if( strstr( $val['types'], ' '.$mf['type'].' ' ) )
+                    $mf_style_list .= '<option value="'.$key.'"'.($mf['style']==$key?' SELECTED':'').'>'.$val['title'].'</option>';
+
+                // Extract current format info and build list of possible formats for this field
+
+            $mf_cf = explode( '~', $mf['format'] );
+            $mf_format_list = '';
+            reset( $mf_formats );
+            while (list($key, $val) = each($mf_formats)) {
+                if( strstr( $val['types'], ' '.$mf['type'].' ' ) )
+                    $mf_format_list .= '<option value="'.$key.'"'.($mf_cf[0]==$key?' SELECTED':'').'>'.$key.'</option>';
+            }
+
+            // Display Title, descr, and optionally size with QuickEdit pop-up
+            if( $mf_title_req || $mf_field_params != '' ) {
+                if( $mf['expanded'] == 't' ) {
+                    $mf_text .= quick_edit( $mf['id'],
+                        ($mf_title_req?'<SPAN CLASS="standout_small"><b>Title</b>: '.$mf['title'].'</SPAN>':'')
+                        .( $mf['expanded'] == 't' ? $mf_field_prompt : '' ),
+                        $mf_field_params );
+                } else {
+                    $mf_text .= '<table border="0"><tr><td width="150px">'.$id_form.'</td><td>'.($mf_title_req?'<SPAN CLASS="standout_small"><b>Title</b>: '.$mf['title'].'</SPAN>':'').'</td></tr></table>';
+                }
+            }
+
+            $r['text'] .= '<TBODY>
+                                <TR>
+                                    <TD VALIGN="top" WIDTH="100" ROWSPAN="2">'
+                                        .'<form action="'.THIS_SCRIPT.'"'.$form_data.$mf_form_data.'
+                                            <input type="hidden" name="mf_action" value="Reposition">
+                                            <input type="hidden" name="mf_field_id" value="'.$mf['id'].'">
+                                            <INPUT TYPE="text" NAME="mf_position_num" ID="mf_field_'.$mf['id'].'" VALUE="'.($mf['sort']/10).'" SIZE="5" onChange="submit();" >&nbsp;'
+                                            .'<A HREF="'.THIS_SCRIPT.'?'.$link_data.$mf_link_data.'&mf_action=Reposition&mf_field_id='.$mf['id'].'&mf_position='.( $mf['sort'] - 15 ).'">&uarr;</A>&nbsp;'
+                                            .'<A HREF="'.THIS_SCRIPT.'?'.$link_data.$mf_link_data.'&mf_action=Reposition&mf_field_id='.$mf['id'].'&mf_position='.( $mf['sort'] + 15 ).'">&darr;</A>&nbsp;
+                        ';
+            if( $mf['expanded'] == 't' )
+                {
+                $r['text'] .= '        <BR>
+                                        <span class="standout_small">'
+                                .( $mf_type_text != '' ?
+                                            $mf_type_text
+                                        .'</span><BR>
+                                        <span class="standout_small">'
+                                            .quick_edit( $mf['id']."_style",
+                                            $mf_styles[$mf['style']]['short_name'],
+                                            '<CENTER>
+                                                <FORM NAME="set_style" ACTION="'.THIS_SCRIPT.'">
+                                                    '.$form_data.$mf_form_data.'
+                                                    Set style For this field:
+                                                    <input type="hidden" name="mf_field_id" value="'.$mf['id'].'">
+                                                    <SELECT NAME="mf_style">
+                                                        '.$mf_style_list.'
+                                                    </SELECT>
+                                                    <INPUT TYPE="submit" NAME="mf_action" VALUE="Set Style">
+                                                    </form>
+                                            </CENTER>' ).'
+                                        </span><BR>
+                                    '.( $mf_format_list != '' ? '
+                                        <span class="standout_small">'
+                                            .quick_edit( $mf['id']."_format",
+                                            ( $mf_cf[0] != '' ? $mf_formats[$mf_cf[0]]['short_name'] : 'Default Format' ),
+                                            '<CENTER>
+                                                <FORM NAME="set_format" ACTION="'.THIS_SCRIPT.'">
+                                                    '.$form_data.$mf_form_data.'
+                                                    <table border="0">
+                                                    <tr>
+                                                        <td align="right">Format Type: </td>
+                                                        <td align="left"><input type="hidden" name="mf_field_id" value="'.$mf['id'].'">
+                                                            <SELECT NAME="mf_format_type">
+                                                                '.$mf_format_list.'
+                                                            </SELECT>
+                                                        </td>
+                                                    </tr>
+                                                    <tr>
+                                                        <td align="right">Maximum Characters/Digits to left of decimal point: </td>
+                                                        <td align="left"><INPUT TYPE="text" NAME="mf_format_char" VALUE="'.$mf_cf[1].'" SIZE="6"></td>
+                                                    </tr>
+                                                    <tr>
+                                                        <td align="right">Digits after Decimal Point: </td>
+                                                        <td align="left"><INPUT TYPE="text" NAME="mf_format_dec" VALUE="'.$mf_cf[2].'" SIZE="6"></td>
+                                                    </tr>
+                                                    <tr>
+                                                        <td align="right">Number Range: </td>
+                                                        <td align="left"><INPUT TYPE="text" NAME="mf_format_min" VALUE="'.$mf_cf[3].'" SIZE="6"> Min <INPUT TYPE="text" NAME="mf_format_max" VALUE="'.$mf_cf[4].'" SIZE="6"> Max</td>
+                                                    </tr>
+                                                    <tr><td colspan="2" align="center">(Note: Not all fields used for all format types.)</td></tr>
+                                                    <tr><td colspan="2" align="center"><INPUT TYPE="submit" NAME="mf_action" VALUE="Set Field Format"></td></tr>
+                                                    </table>
+                                                    </form>
+                                            </CENTER>' ).'
+                                        </span><BR>
+                                    ' : '' ).'
+                                        <span class="standout_small"><nobr>ID: '
+                                            .quick_edit( $mf['id']."_id",
+                                            ( $mf['custom_id'] != '' ? $mf['custom_id'] : 'mf_'.$mf['id'] ),
+                                            '<CENTER>
+                                                <FORM NAME="set_style" ACTION="'.THIS_SCRIPT.'">
+                                                    '.$form_data.$mf_form_data.'
+                                                    Custom ID:
+                                                    <input type="hidden" name="mf_field_id" value="'.$mf['id'].'">
+                                                    <input type="text" name="mf_custom_id" value="'.$mf['custom_id'].'" size="15"><br>
+                                                    Clear to reset to default ID.<P>
+                                                    <INPUT TYPE="submit" NAME="mf_action" VALUE="Set Custom ID">
+                                                    </form>
+                                            </CENTER>' ).'
+                                        </nobr></span><BR>'.( $mf_custom_id_update_message != '' ? '<font color="red">'.$mf_custom_id_update_message.'</font><br>' : '' ).'
+                                ' :
+                                            quick_edit( $mf['id'],
+                                            '<font color="red">Type Not Set</font>',
+                                            '<CENTER>
+                                                <FORM NAME="add_field" ACTION="'.THIS_SCRIPT.'">
+                                                    '.$form_data.$mf_form_data.'
+                                                    <font color="red">Set field type: </font>
+                                                    <input type="hidden" name="mf_field_id" value="'.$mf['id'].'">
+                                                    <SELECT NAME="mf_type">
+                                                        <OPTION VALUE="1">Checkbox</option>
+                                                        <OPTION VALUE="2">Number</option>
+                                                        <OPTION VALUE="3">Text</option>
+                                                        <OPTION VALUE="4">Text Box</option>
+                                                        <OPTION VALUE="5">Picklist</option>
+                                                        <OPTION VALUE="6">Radio Buttons</option>
+                                                        <OPTION VALUE="7">File Upload</option>
+                                                        <OPTION VALUE="20">Section Title</option>
+                                                        <OPTION VALUE="21">Misc. Text</option>
+                                                        <OPTION VALUE="22">Horizontal Line</option>
+                                                        <OPTION VALUE="23">Blank Line</option>
+                                                        <OPTION VALUE="24">Display Image</option>
+                                                        <OPTION VALUE="25">Download File</option>
+                                                        <OPTION VALUE="31">Calculated Field</option>
+                                                    </SELECT>
+                                                    <INPUT TYPE="submit" NAME="mf_action" VALUE="Set Type">
+                                                    </form>
+                                            </CENTER>' ).'<br>
+                                    <font color="red">Field Style Not Set</font>'
+                                ).'<br>
+
+                                        <A HREF="'.THIS_SCRIPT.'?'.$link_data.$mf_link_data.'&mf_action=Toggle+Active&mf_field_id='.$mf['id'].'">'.( $mf['active'] == 't' ? 'Active' : '<FONT COLOR="#c0c0c0">Active</FONT>' ).'&nbsp;&nbsp;</A><br>
+                                        '.( $mf['type'] > 1 && $mf['type'] < 20 ? '<A HREF="'.THIS_SCRIPT.'?'.$link_data.$mf_link_data.'&mf_action=Toggle+Required&mf_field_id='.$mf['id'].'">'.($mf['required']=='t'?'Required':'<FONT COLOR="#c0c0c0">Required</FONT>').'</A>&nbsp;&nbsp;':'&nbsp;').'
+
+                            ';
+                }
+
+            $r['text'] .= '</TD>
+                            ';
+
+            if( !empty($mf_text) )
+                $r['text'] .= '    <TD ALIGN="left" VALIGN="top">'.$mf_text.'</TD>';
+            else
+                $r['text'] .= '    <TD>&nbsp;</TD>';
+
+            $r['text'] .= '        <TD VALIGN="top" ALIGN="right">
+                                '.( $mf['expanded'] == 't' ?
+                                    '<A HREF="'.THIS_SCRIPT.'?'.$link_data.$mf_link_data.'&mf_action=Toggle+Expanded&mf_field_id='.$mf['id'].'">[Contract]</A><BR>
+                                    <A HREF="'.THIS_SCRIPT.'?'.$link_data.$mf_link_data.'&mf_action=Delete&mf_field_id='.$mf['id'].'">[Delete]</A>&nbsp;<BR>
+                                    <A HREF="'.THIS_SCRIPT.'?'.$link_data.$mf_link_data.'&mf_action=Add+Field&mf_position='.( $mf['sort'] - 5 ).'"><nobr>[Add Above]</nobr></A>&nbsp;'
+                                :
+                                    '<A HREF="'.THIS_SCRIPT.'?'.$link_data.$mf_link_data.'&mf_action=Toggle+Expanded&mf_field_id='.$mf['id'].'">[Expand]</A>'
+                                ).'
+                            </TD>
+                            </TR>
+                            '.( $mf['expanded'] == 't' ? '<TR><TD VALIGN="top" COLSPAN="3">'.$mf_field_content.'</TD></TR>' : '<TR><TD COLSPAN="3"></TD></TR>' ).'
+                            </TBODY>
+                        ';
+            }
+        }
+
+
+    $r['text'] .= '<TR><TD COLSPAN="3" ALIGN="right">
+                    <A HREF="'.THIS_SCRIPT.'?'.$link_data.$mf_link_data.'&mf_action=Add+Field&mf_position=9999">[Add New Field]</A>
+                    <A HREF="'.THIS_SCRIPT.'?'.$link_data.$mf_link_data.'&mf_action=Expand+All">[Expand All]</A>
+                    <A HREF="'.THIS_SCRIPT.'?'.$link_data.$mf_link_data.'&mf_action=Contract+All">[Contract All]</A>
+                </TD></TR></TABLE>
+                ';
+    $r['success'] = true;
+
+    return( $r );
+
+
+}
+
+    // MagicForm - Display Form
+
+function magic_form_display( $mf_id, $mf_styles, $mf_fiid = null,  $mf_def_data = array(), $mf_level = 0 )
+    {
+
+    global $mf_formats;
+
+        // Get the fields specifications for the specified form
+    $mf_fields = reg_db_auto_get_data( "SELECT * FROM ".MF_TABLE." WHERE form_id = '$mf_id' ORDER BY sort;", CONN_STR, FALSE );
+
+    // If this is level 0, get any data supplied from earlier form submissions, if level > 0 then use data we already have
+    if ($mf_fiid != null) {
+        $mf_data = reg_db_auto_get_data( "SELECT * FROM ".MF_DATA_TABLE." WHERE fiid = '$mf_fiid' ORDER BY sort;", CONN_STR, FALSE );
+    } else {
+        $mf_data = &$mf_def_data;
+    }
+
+    // Initialize results array
+    $r = array( 'success' => true, 'text' => '', 'required' => false );
+    $r_scriptInit = "<script type=\"text/javascript\">\n";
+
+    $mf_level++;        // Incriment MagicForm recurse level (not shure why we're doing this though)
+    $problem = '';
+    $current_style = '';
+    $current_collumn = 1;
+
+    if( is_array($mf_fields) ) {
+
+        reset( $mf_fields );
+        foreach( $mf_fields as $mf ) {
+
+            if( $mf['active'] == 't' ) {
+
+                //
+                // Style/Layout Stuff
+                //
+
+                // Determine format spec
+                $f = $mf_styles[$mf['style']];        // just use default for now and assume 1 col/row
+
+                // Check if we're switching styles and handle accordingly
+                if( $current_style != $mf['style'] ) {
+                        // If this is not the first style
+                    if( $current_style != '' ) {
+
+                        // If not at the last column, fill with blank cells
+                        if( $current_column < $mf_styles[$current_style]['cols'] ) {
+                            for( $i=$current_column ; $i<=$mf_styles[$current_style]['cols'] ; $i++ ) {
+                                $r['text'] .= $mf_styles[$current_style]['col_empty'];
+                            }
+                        }
+                        $r['text'] .= $mf_styles[$current_style]['row_end'].$mf_styles[$current_style]['end'];
+                    }
+
+                        // Set new style and output start and row headder
+                    $current_style = $mf['style'];
+                    $r['text'] .= $f['start'].$f['row_start'];
+                    $current_collumn = 1;
+                }
+
+                // Check if we need to start a new row
+                if( $current_collumn++ > $f['cols'] ) {
+                    $r['text'] .= $f['row_end'].$f['row_start'];
+                    $current_collumn = 1;
+                }
+
+                //
+                // End of Style/Layout stuff
+                //
+
+                $view_tags = array ( "global"    => array() );
+                $v = &$view_tags["global"];
+
+                $field_name = 'mf_'.$mf['id'];                                                        // Name we're going to use for this field
+                $v['title']    = stripslashes($mf['title']);
+                $v['descr']    = stripslashes($mf['descr']);
+                $v['required'] = '';
+                if( $mf['type'] > 1 && $mf['type'] < 20 && $mf['required'] == 't' ) {                 // if field is required, display in red
+                    $v['required'] = 'Yes';
+                    $r['required'] = true;
+                }
+                $v['image'] = $v['file'] = $v['input'] = '';
+
+                $GLOBALS['mf_'.$mf['id']] = stripslashes($GLOBALS['mf_'.$mf['id']]);                // get current field input data
+
+                $v['sub_forms'] = '';                                                                // Start with no sub-forms
+
+                // Check for default data for this field and use either opt_num or value depending on type
+                if( is_array($x=$mf_def_data[$mf['id']]) ) {
+                    switch( $mf['type'] ) {
+                        case 1:        // Checkbox
+                        case 5:        // Picklist
+                        case 6:        // Radio Buttons
+                            $inp = $x['opt_num'];
+                            break;
+                        default:
+                            $inp = $x['value'];
+                            break;
+                    }
+                } else {
+                    $inp = $mf['default_val'];        // Otherwise use defaut data
+                }
+
+                // Extract field format specs and replace occurances of {chars} and {prec}
+                $mf_cf = explode( '~', $mf['format'] );
+                $mf_cf_size = $mf_cf[1] + ($mf_cf[2]>0?1:0) + $mf_cf[2];
+                $mf_cf_out = str_replace( '{chars}', $mf_cf[1], $mf_formats[$mf_cf[0]]['format'] );
+                $mf_cf_out = str_replace( '{prec}', $mf_cf[2], $mf_cf_out );
+
+                if( $mf_cf_out == '' ) {    // If nothing specified, default to simple string out
+                    $mf_cf_out = '%s';
+                }
+
+                switch( $mf['type'] ) {
+
+                    case 1:        // Checkbox
+
+                        // Build most of checkbox input tag but leave open for rest of JAVAscript onChange text
+
+                        $v['input'] = '<INPUT TYPE="checkbox" NAME="'.$field_name.'" id="'.$field_name.'" '.($inp=='1'?' CHECKED':'').' onClick="';
+                        $ans = explode( "|", $mf['data1'] );                    // Separate answers
+
+                        if( $inp == '' ) {
+                            $inp = 0;    // Default to false
+                        }
+                        $xv = '';
+
+                        // Check response for subform ($i=1 - Yes, $i=2 - No)
+                        for( $i=1 ; $i<=2 ; $i++ ) {
+                            $an = explode( '~', $ans[$i-1] );
+
+                            // Check for a sub-form
+                            if( !empty($an[1]) ) {
+                                $sub = magic_form_display( $an[1], $mf_styles, null, $mf_def_data, $mf_level );
+                                if( $sub['success'] ) {
+                                    $v['sub_forms'] .= '<div id="'.$field_name.'_'.$i.'" style="display: '.($inp==$i?'block':'none').';"> '.str_replace( "{sub_form}", $f['sub_form'], $sub['text'] ).'</div>';
+                                    $v['input'] .= "document.getElementById('".$field_name."_$i').style.display = document.getElementById('".$field_name."').checked == ".($i==1?'true':'false')." ? 'block' : 'none'; ";
+                                    $r_scriptInit .= "document.getElementById('".$field_name."_$i').style.display = document.getElementById('".$field_name."').checked == ".($i==1?'true':'false')." ? 'block' : 'none';\n";
+                                } else {
+                                    $v['sub_forms'] .= '<p><font color="red">FORM ERROR</font>: Unable to process sub-form for checkbox: '.$mf['title'].'<p>';
+                                }
+                            }
+
+                            // Optionally set value if this is the "Yes" option
+                            if( $i==0 && $an[2] != '' ) {
+                                switch( $an[3] ) {
+                                    case 1:
+                                        $xv .= " ".money($an[2]);
+                                        break;
+                                    default:
+                                        $xv .= " ".$an[2];
+                                        break;
+                                }
+                            }
+
+                        }
+                        $v['input'] .= '"> '.$xv;        // Close onChange string
+
+                        break;
+
+                    case 2:        // Number
+                    case 3:        // Text
+                        $inp = trim( str_replace( array( '|', '~' ), '', $inp ) );
+                        $v['input'] = '<INPUT TYPE="text" NAME="mf_'.$mf['id'].'" ID="mf_'.$mf['id'].'" VALUE="'.trim(sprintf( $mf_cf_out, $inp )).'" SIZE="'.$mf['cols'].'" '.($mf_cf_size>0?' maxlength="'.$mf_cf_size.'"':'').' onChange="';
+                        $ans = explode( "|", $mf['data1'] );                    // Separate answers
+
+                        $an = explode( '~', $ans[0] );
+                        if( !empty($an[1]) ) {
+                            $sub = magic_form_display( $an[1], $mf_styles, null, $mf_def_data, $mf_level );
+                            if( $sub['success'] ) {
+                                $v['sub_forms'] .= '<div id="'.$field_name.'_1" style="display: '.(trim($inp)==''?'block':'none').';"> '.str_replace( "{sub_form}", $f['sub_form'], $sub['text'] ).'</div>';
+                                $v['input'] .= "document.getElementById('".$field_name."_1').style.display = document.getElementById('".$field_name."').value == '' ? 'block' : 'none'; ";
+                            } else {
+                                $v['sub_forms'] .= '<p><font color="red">FORM ERROR</font>: Unable to process sub-form for checkbox: '.$mf['title'].'<p>';
+                            }
+                        }
+
+                        $an = explode( '~', $ans[1] );
+                        if( !empty($an[1]) ) {
+                            $sub = magic_form_display( $an[1], $mf_styles, null, $mf_def_data, $mf_level );
+                            if( $sub['success'] ) {
+                                $v['sub_forms'] .= '<div id="'.$field_name.'_2" style="display: '.(trim($inp)!=''?'block':'none').';"> '.str_replace( "{sub_form}", $f['sub_form'], $sub['text'] ).'</div>';
+                                $v['input'] .= "document.getElementById('".$field_name."_2').style.display = document.getElementById('".$field_name."').value != '' ? 'block' : 'none'; ";
+                            } else {
+                                $v['sub_forms'] .= '<p><font color="red">FORM ERROR</font>: Unable to process sub-form for checkbox: '.$mf['title'].'<p>';
+                            }
+                        }
+
+                        $v['input'] .= '">';        // Close onChange string
+                        break;
+
+                    case 4:        // Text Box
+                        $inp = trim( str_replace( array( '|', '~' ), '', $inp ) );
+                        $v['input'] = '<TEXTAREA NAME="mf_'.$mf['id'].'" ID="mf_'.$mf['id'].'" COLS="'.$mf['cols'].'" rows="'.$mf['rows'].'"  onChange="';
+                        $ans = explode( "|", $mf['data1'] );                    // Separate answers
+
+                        $an = explode( '~', $ans[0] );
+                        if( !empty($an[1]) ) {
+                            $sub = magic_form_display( $an[1], $mf_styles, null, $mf_def_data, $mf_level );
+                            if( $sub['success'] ) {
+                                $v['sub_forms'] .= '<div id="'.$field_name.'_1" style="display: '.(trim($inp)==''?'block':'none').';"> '.str_replace( "{sub_form}", $f['sub_form'], $sub['text'] ).'</div>';
+                                $v['input'] .= "document.getElementById('".$field_name."_1').style.display = document.getElementById('".$field_name."').value == '' ? 'block' : 'none'; ";
+                            } else {
+                                $v['sub_forms'] .= '<p><font color="red">FORM ERROR</font>: Unable to process sub-form for checkbox: '.$mf['title'].'<p>';
+                            }
+                        }
+
+                        $an = explode( '~', $ans[1] );
+                        if( !empty($an[1]) ) {
+                            $sub = magic_form_display( $an[1], $mf_styles, null, $mf_def_data, $mf_level );
+                            if( $sub['success'] ) {
+                                $v['sub_forms'] .= '<div id="'.$field_name.'_2" style="display: '.(trim($inp)!=''?'block':'none').';"> '.str_replace( "{sub_form}", $f['sub_form'], $sub['text'] ).'</div>';
+                                $v['input'] .= "document.getElementById('".$field_name."_2').style.display = document.getElementById('".$field_name."').value != '' ? 'block' : 'none'; ";
+                            } else {
+                                $v['sub_forms'] .= '<p><font color="red">FORM ERROR</font>: Unable to process sub-form for checkbox: '.$mf['title'].'<p>';
+                            }
+                        }
+
+                        $v['input'] .= '">'.trim($inp).'</TEXTAREA>';
+                        break;
+
+                    case 5:        // Picklist
+                        $opts = explode( "|", $mf['data1'] );
+                        $sel = '<SELECT NAME="mf_'.$mf['id'].'" id="'.$field_name.'" onChange="';
+                        $sel_opts = '<OPTION VALUE="" '.($inp==''?'SELECTED':'').'> </option>';
+                        $n = 1;
+                        foreach( $opts as $opt ) {
+                            $an = explode( "~", $opt );
+
+                            $sel_opts .= '<OPTION VALUE="'.$n.'"';
+                            if( $inp == $n ) {
+                                $sel_opts .= ' SELECTED';
+                            }
+
+                            if( !empty($an[1]) ) {
+                                $sub = magic_form_display( $an[1], $mf_styles, null, $mf_def_data, $mf_level );
+                                if( $sub['success'] ) {
+                                    $v['sub_forms'] .= '<div id="'.$field_name.'_'.$n.'" style="display: '.($n==$inp?'block':'none').';"> '.str_replace( "{sub_form}", $f['sub_form'], $sub['text'] ).'</div>';
+                                    $sel .= "document.getElementById('".$field_name."_$n').style.display = document.getElementById('".$field_name."').value == '".$n."' ? 'block' : 'none'; ";
+                                    $r_scriptInit .= "document.getElementById('".$field_name."_$n').style.display = document.getElementById('".$field_name."').value == '".$n."' ? 'block' : 'none';\n";
+                                } else {
+                                    $v['sub_forms'] .= '<p><font color="red">FORM ERROR</font>: Unable to process sub-form for picklist: '.$mf['title'].'<p>';
+                                }
+                            }
+                            $n++;
+                            $sel_opts .= '> '.$an[0].'</option>';
+
+                            // Optionally set value if this is the "Yes" option
+
+                            if( $an[2] != '' ) {
+                                switch( $an[3] ) {
+                                    case 1:
+                                        $sel_opts .= " - ".money($an[2]);
+                                        break;
+                                    default:
+                                        $sel_opts .= " - ".$an[2];
+                                        break;
+                                }
+                            }
+                        }
+
+                        $v['input'] .= $sel.'">'.$sel_opts.'</SELECT>';
+                        break;
+
+                    case 6:        // Radio Buttons
+                        $opts = explode( "|", $mf['data1'] );
+                        $sel  = '';
+                        $n = 1;
+                        $sub_func = ' <script language="JavaScript1.2"> function f_'.$field_name.'(v){ ';
+                        foreach( $opts as $opt ) {
+                            $an = explode( "~", $opt );
+                            $sel .= '<NOBR><INPUT TYPE="radio" NAME="mf_'.$mf['id'].'" VALUE="'.$n.'"';
+                            if( $inp == $n ) {
+                                $sel .= ' CHECKED';
+                            }
+                            $sel .= ' onClick="f_'.$field_name."('".$n."'); \"";
+                            if( !empty($an[1]) ) {
+                                $sub_func .= " document.getElementById('".$field_name.'_'.$n."').style.display = v == '".$n."' ? 'block': 'none'; ";
+                                $r_scriptInit .= " document.getElementById('".$field_name.'_'.$n."').style.display = v == '".$n."' ? 'block': 'none';\n";
+                                $sub = magic_form_display( $an[1], $mf_styles, null, $mf_def_data, $mf_level );
+                                if( $sub['success'] ) {
+                                    $v['sub_forms'] .= '<div id="'.$field_name.'_'.$n.'" style="display: '.($n==$inp?'block':'none').';"> '.str_replace( "{sub_form}", $f['sub_form'], $sub['text'] ).'</div>';
+                                } else {
+                                    $v['sub_forms'] .= '<p><font color="red">FORM ERROR</font>: Unable to process sub-form for radio buttons: '.$mf['title'].'<p>';
+                                }
+                            }
+                            $n++;
+                            $sel .= '>'.$an[0];
+
+                            // Optionally set value if this is the "Yes" option
+                            if( $an[2] != '' ) {
+                                switch( $an[3] ) {
+                                    case 1:
+                                        $sel .= " - ".money($an[2]);
+                                        break;
+                                    default:
+                                        $sel .= " - ".$an[2];
+                                        break;
+                                }
+                            }
+
+                            $sel .= '</nobr>';
+
+                        }
+                        $sub_func .= ' } </script>';
+                        $v['input'] = $sub_func.$sel;
+                        break;
+
+                    case 7:        // File Upload
+                        $inp = trim( str_replace( array( '|', '~' ), '', $inp ) );
+                        $v['input'] = '<INPUT TYPE="hidden" NAME="exist_mf_'.$mf['id'].'" value="'.$inp.'">
+                                        <table border="1">
+                                    ';
+                        if( $inp != '' ) {
+                            $v['input'] .= '<tr><td><a href="'.FILE_SERVER_URL.IS_OWNER_ID.'/_ORIGINAL_/'.$inp.'" target="file_page">'.$inp.'</a></td><td><input type="checkbox" name="delete_mf_'.$mf['id'].'"> Delete</td></tr>';
+                        }
+                        $v['input'] .= '<tr><td colspan="2"><INPUT TYPE="file" NAME="mf_'.$mf['id'].'" VALUE="'.$inp.'" SIZE="'.$mf['cols'].'"></td></tr></table>';
+
+                        $ans = explode( "|", $mf['data1'] );                    // Separate answers
+
+                        $an = explode( '~', $ans[0] );
+                        if( !empty($an[1]) ) {
+                            $sub = magic_form_display( $an[1], $mf_styles, null, $mf_def_data, $mf_level );
+                            if( $sub['success'] ) {
+                                $v['sub_forms'] .= '<div id="'.$field_name.'_1" style="display: '.(trim($inp)==''?'block':'none').';"> '.str_replace( "{sub_form}", $f['sub_form'], $sub['text'] ).'</div>';
+                            } else {
+                                $v['sub_forms'] .= '<p><font color="red">FORM ERROR</font>: Unable to process sub-form for checkbox: '.$mf['title'].'<p>';
+                            }
+                        }
+                        $an = explode( '~', $ans[1] );
+                        if( !empty($an[1]) ) {
+                            $sub = magic_form_display( $an[1], $mf_styles, null, $mf_def_data, $mf_level );
+                            if( $sub['success'] ) {
+                                $v['sub_forms'] .= '<div id="'.$field_name.'_2" style="display: '.(trim($inp)!=''?'block':'none').';"> '.str_replace( "{sub_form}", $f['sub_form'], $sub['text'] ).'</div>';
+                            } else {
+                                $v['sub_forms'] .= '<p><font color="red">FORM ERROR</font>: Unable to process sub-form for checkbox: '.$mf['title'].'<p>';
+                            }
+                        }
+                        break;
+
+                    case 20:    // Section Title
+                        $v['title'] = stripslashes($mf['data1']);
+                        $v['input'] = '';
+                        break;
+
+                    case 21:    // Misc. Text
+                        $v['title'] = '';
+                        $v['input'] = stripslashes($mf['data1']);
+                        break;
+
+                    case 24:    // Image
+                        switch ($mf['size']) {
+                            case 'original':
+                                $image_size_url = ORIGINAL;
+                                break;
+                            case 'resized':
+                                $image_size_url = RESIZED;
+                                break;
+                            case 'midsized':
+                                $image_size_url = MIDSIZED;
+                                break;
+                            default:
+                            case 'thumb':
+                                $image_size_url = THUMB;
+                                break;
+                        }
+
+                        $v['image'] = '<u><img src="'.$image_size_url.'/'.$mf['file'].'"></u>';
+                           break;
+
+                    case 25:    // File
+                        $v['title'] = '<a href="'.ORIGINAL.'/'.$mf['file'].'" target="file_page">'.(trim($mf['title'])!=''?$mf['title']:$mf['file']).'</a>';
+                        break;
+
+                    case 22:    // Horizontal Line
+                    case 23:    // Blank Line (space)
+                    default:
+                        $v['title'] = '';
+                        $v['input'] = '';
+                        break;
+
+                }    // Type
+
+                $r['text'] .= parse_string_view( $f['body'], $view_tags );
+
+            }    // Active
+        }    // Each field
+
+        // If not at the last column, fill with blank cells before closing
+        if( $current_column < $mf_styles[$current_style]['cols'] ) {
+            for( $i=$current_column ; $i<=$mf_styles[$current_style]['cols'] ; $i++ ) {
+                $r['text'] .= $mf_styles[$current_style]['col_empty'];
+            }
+        }
+        $r['text'] .= $mf_styles[$current_style]['row_end'].$mf_styles[$current_style]['end'];
+        $r['text'] .= $r_scriptInit."</script>\n";
+
+    }
+
+    if( !empty($problem) ) {
+        echo "Problems processing this form.<p>$problem<p>";
+    }
+
+    return( $r );
+
+    }
+
+
+/* MagicForm - Get Fields
+ *
+ * returns fields as array where index is field 'id' containing
+ *     integer     id           Record ID of form field
+ *     text        form_id      Raw ID of form field
+ *     text        custom_id    Custom ID of form field
+ *     text        title        Title
+ *     integer     type         Type of field
+ *     text        active       Always 't' since only active fields are returned
+ *     integer     level        Sub-form level, 1 = top level
+ *     integer     field_order  Sequential display order, sub-form fields fall in just after parent
+ */
+
+function magic_form_get_fields( $mf_id, $mf_level = 0 )
+{
+
+    static $mf_fields;
+    static $field_numb;
+
+    // If this is the first entry, clear $mf
+    if ($mf_level == 0) {
+        $mf_fields = array();
+        $field_numb = 0;
+    }
+
+    $mf_level++;
+
+    // Get the fields specifications for the specified form
+    $mf_data = reg_db_auto_get_data( "SELECT id, form_id, custom_id, title, type, active, data1 FROM ".MF_TABLE." WHERE form_id ~ '^$mf_id$' ORDER BY sort;", CONN_STR, FALSE );
+
+    if (is_array($mf_data)) {
+        foreach ($mf_data as $mf) {
+            if( $mf['active'] == 't' && $mf['type'] > 0 && $mf['type'] < 20) {
+
+                // Add this field to the list
+                $mf['level'] = $mf_level;
+                $mf['field_order'] = ++$field_numb;
+                $mf_fields[$mf[id]] = $mf;
+
+                // Look for any sub-fields
+                $opts = explode( "|", $mf['data1']);
+                foreach( $opts as $opt ) {
+                    $x = explode( "~", $opt );
+                    if ($x[1] != '') {
+                        magic_form_get_fields( $x[1], $mf_level );
+                    }
+                }
+            }    // Active
+        }    // Each field
+    }
+
+    // If this is not level 0 then don't bother returning results
+    if ($mf_level > 1) {
+        return;
+    }
+
+    //echo "<pre>".print_r($mf_fields,1)."</pre>";exit;
+    return $mf_fields;
+}
+
+
+    // MagicForm - Submit Form
+
+function magic_form_submit($mf_id, $mf_fiid = null, $mf_def_data = null, $mf_level = 0, $v2 = false)
+{
+
+    global $mf_formats;
+
+    static $values = array();
+    if ($v2 != false) {
+        $values = $v2;
+    }
+
+    $mf_level++;        // Incriment MagicForm recurse level (not shure why we're doing this though)
+
+        // Get form field specifications
+
+    $mf_fields = reg_db_auto_get_data( "SELECT * FROM ".MF_TABLE." WHERE form_id = '$mf_id' ORDER BY sort;", CONN_STR, FALSE );
+
+        // Initialize result array
+
+    $mf_results = array( 'success' => true, 'data' => array(), 'total_value' => 0, 'html' => '', 'csv' => ($mf_level==1?'"ID","Sub Form Level","Title","Type","Data","Value","Valid","Required","Notes"'."\n":''), 'problem' => '' );
+
+    $problem = '';
+    $current_collumn = 1;
+
+   $mf_total_value = 0;        // Accumulates a total of the optional value data for checkboxes, picklists, and radio buttons
+
+    if (is_array($mf_fields)) {
+
+        reset( $mf_fields );
+        foreach( $mf_fields as $mf ) {
+
+            // If it's a supplied data field and it's active (type 0 is "not set" so don't use it)
+            if (($mf['type'] > 0 && $mf['type'] < 20 || $mf['type'] == 31) && $mf['active'] == 't') {
+
+                    // Determine Field ID
+
+                $mf_field_id = ( $mf['custom_id'] != '' ? $mf['custom_id'] : 'mf_'.$mf['id'] );
+
+                $res = array(
+                    'id'        => $mf_field_id,
+                    'level'        => $mf_level,
+                    'title'        => $mf['title'],
+                    'type'        => $mf['type'],
+                    'txt_typ'    => '',
+                    'value'        => '',
+                    'txt_val'    => '',
+                    'opt_num'    => '',
+                    'valid'        => true,
+                    'required'    => false,
+                    'numb_val'    => '',
+                    'failure'    => ''
+                );
+
+                    // Set text for field type
+
+                switch ($mf['type']) {
+                    case 1:
+                        $res['txt_typ'] = 'Checkbox';
+                        $inData = filter_request('mf_'.$mf['id']);
+                        break;
+                    case 2:
+                        $res['txt_typ'] = 'Number';
+                        $inData = filter_request('mf_'.$mf['id'], FILTER_SANITIZE_NUMBER_FLOAT, 0);
+                        break;
+                    case 3:
+                        $res['txt_typ'] = 'Text';
+                        $inData = filter_request('mf_'.$mf['id']);
+                        break;
+                    case 4:
+                        $res['txt_typ'] = 'Text Box';
+                        $inData = filter_request('mf_'.$mf['id']);
+                        break;
+                    case 5:
+                        $res['txt_typ'] = 'Pick List';
+                        $inData = filter_request('mf_'.$mf['id'], FILTER_SANITIZE_NUMBER_INT, 0);
+                        break;
+                    case 6:
+                        $res['txt_typ'] = 'Radio Buttons';
+                        $inData = filter_request('mf_'.$mf['id'], FILTER_SANITIZE_NUMBER_INT, 0);
+                        break;
+                    case 7:
+                        $res['txt_typ'] = 'File Upload';
+                        break;
+                    case 31:
+                        $res['txt_typ'] = 'Calculated';
+                        $input = false;
+                        break;
+                    default:
+                        break;
+                }
+
+
+                // If we didn't get previously submitted data
+                if ($mf_def_data == null) {
+                    $inp = $inData;        // Get form input value
+                } else {
+                    $inp = $mf_def_data[$mf_field_id];            // Get value from supplied array
+                }
+
+
+                $sub = '';                                                                    // Assume no sub-form
+
+                // Check if a required field is not populated - don't check type 1, > type 20, or file uploads (7) and only if required.
+                if ($mf['type'] > 1 && $mf['type'] < 20 && $mf['type'] != 7 && $mf['required'] == 't') {
+                    $res['required'] = true;
+                    if ($inp == '' || ($mf_type['type']==7 && $inp=='none')) {   // if field is required and not provided
+                        $res['valid'] = false;
+                        $res['failure'] = 'Required response not provided.';
+                        $mf_results['problem'] .= '<li>"'.$mf['title'].'" requires a response that was not provided.</li>'."\n";
+                    }
+                }
+
+                // Get id or custom id for use with $variables array
+                $fid = ( $mf['custom_id'] == '' ? 'mf_'.$mf['id'] : $mf['custom_id'] );
+
+                $res['num_val'] = ' ';
+                switch ($mf['type']) {
+
+                    case 1:        // Checkbox
+
+                        $ans = explode( "|", $mf['data1'] );                    // Separate possible answers
+
+                        $sub_id = '';
+
+                        if ($inp == 'on') {
+                            $res['value'] = 't';
+                            $res['txt_val'] = 'Yes';
+                            $res['opt_num'] = '1';
+                            $an = explode( '~', $ans[0] );
+                            $sub_id = $an[1];
+                            if ($an[2] != '') {
+                                $res['numb_val'] = $an[2];
+                            }
+                        } else {
+                            $res['value'] = 'f';
+                            $res['txt_val'] = 'No';
+                            $res['opt_num'] = '2';
+                            $an = explode( '~', $ans[1] );
+                            $sub_id = $an[1];
+                            if ($an[2] != '') {
+                                $res['numb_val'] = $an[2];
+                            }
+                        }
+
+                        if ($sub_id != '') {
+                            $sub = magic_form_submit( $sub_id, $mf_fiid, $mf_def_data, $mf_level );
+                            if (!$sub['success']) {
+                                $mf_results['problem'] .= $sub['problem'];
+                            } else {
+                                $mf_total_value += $sub['total_value'];
+                            }
+                        }
+
+                        if ($an[4] != '' && isset($values[$an[4]])) {
+                            $values[$fid] = $values[$an[4]];
+                            $res['failure'] = 'Value from '.$an[4];
+                        } else {
+                            $values[$fid] = $an[2];            // Save option numeric value for calculated fields
+                        }
+
+                        $res['num_val'] = $values[$fid];
+
+                        break;
+
+                    case 2:        // Number
+
+                        $inp = preg_replace( "/[\$,]/", "", $inp );
+                        $values[$fid] = $inp;
+                        $inp = filter_var($inp, FILTER_SANITIZE_NUMBER_FLOAT );
+
+                    case 3:        // Text
+                    case 4:        // Text Box
+
+                            // Extract field format specs
+
+                        $mf_cf = explode( '~', $mf['format'] );
+                        $mf_cf_size = $mf_cf[1] + ($mf_cf[2]>0?1:0) + $mf_cf[2];
+                        $mf_cf_out = str_replace( '{chars}', $mf_cf[1], $mf_formats[$mf_cf[0]]['format'] );
+                        $mf_cf_out = str_replace( '{prec}', $mf_cf[2], $mf_cf_out );
+
+                        if (trim($inp) != '') {
+
+                            // Clean input string and block high-bit characters
+                            $inp = filter_var($inp, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH );
+
+                            if ($mf_cf[3] != '' && $inp < $mf_cf[3]) {
+                                $res['valid'] = false;
+                                $res['failure'] .= 'Value not in range';
+                                $mf_results['problem'] .= '<li>"'.$mf['title'].'" requires a value greater than or equal to '.$mf_cf[3].'.</li>'."\n";
+                            }
+
+                            if ($mf_cf[4] != '' && $inp > $mf_cf[4]) {
+                                $res['valid'] = false;
+                                $res['failure'] .= 'Value not in range';
+                                $mf_results['problem'] .= '<li>"'.$mf['title'].'" requires a value less than or equal to '.$mf_cf[4].'.</li>'."\n";
+                            }
+
+                            if ($mf_formats[$mf_cf[0]]['regex'] != '' && preg_match( '/^'.$mf_formats[$mf_cf[0]]['regex'].'$/', $inp ) == 0) {
+                                $res['valid'] = false;
+                                $res['failure'] .= 'Input format not valid';
+                                $mf_results['problem'] .= '<li>"Value supplied to '.$mf['title'].'" was not valid. Must be '.$mf_cf['0'].' (i.e. '.$mf_formats[$mf_cf[0]]['sample'].').</li>'."\n";
+                            }
+                          }
+
+                        $res['value'] = ( $mf_cf_out != '' ? sprintf( $mf_cf_out, $inp ) : $inp );
+                        $res['txt_val'] = $res['value'];
+
+                        break;
+
+                    case 5:        // Picklist
+
+                        $res['opt_num'] = $inp;
+                        $opts = explode( "|", $mf['data1'] );        // Separate Options
+                        if ($inp != '') {                            // If an options is selected
+                            $x = explode( "~", $opts[$inp-1] );        // Separate data for selected option
+                            $res['value'] = $x[0];                    // Use option name
+                            if ($x[2] != '') {
+                                $res['numb_val'] = $x[2];
+                            }
+                        } else {
+                            $res['value'] = '';
+                        }
+
+                        // Check selected option for Sub-Form
+                        $n = 1;
+                        foreach ($opts as $opt) {
+                            $an = explode( "~", $opt );
+                            if ($inp == $n && !empty($an[1])) {
+                                $sub = magic_form_submit( $an[1], $mf_fiid, $mf_def_data, $mf_level );
+
+                                if (!$sub['success']) {
+                                    $mf_results['problem'] .= $sub['problem'];
+                                }
+
+                                // Save any option value for calculated fields
+                                if ($an[4] != '' && isset($values[$an[4]])) {
+                                    $values[$fid] = $values[$an[4]];
+                                } else {
+                                    $values[$fid] = $an[2];
+                                }
+                                $res['num_val'] = $values[$fid];
+
+                                $mf_total_value += $sub['total_value']; // ??? CPS
+                            }
+                            $n++;
+                        }
+
+                        $res['txt_val'] = $res['value'];
+                        break;
+
+                    case 6:        // Radio Buttons
+
+                        $res['opt_num'] = $inp;
+                        $opts = explode( "|", $mf['data1'] );        // Separate Options
+                        if ($inp != '') {                           // If an options is selected
+                            $x = explode( "~", $opts[$inp-1] );        // Separate data for selected option
+                            $res['value'] = $x[0];                    // Use option name
+                            if ($x[2] != '') {
+                                $res['numb_val'] = $x[2];
+                            }
+                        } else {
+                            $res['value'] = '';
+                        }
+                        $opts = explode( "|", $mf['data1'] );
+
+                        // Check selected button for Sub-Form
+                        $n = 1;
+                        foreach ($opts as $opt) {
+                            $an = explode( "~", $opt );
+                            if ($inp == $n && !empty($an[1])) {
+
+                                $sub = magic_form_submit( $an[1], $mf_fiid, $mf_def_data, $mf_level );
+
+                                if (!$sub['success']) {
+                                    $mf_results['problem'] .= $sub['problem'];
+                                } else {
+                                    $mf_total_value += $sub['total_value'];
+                                }
+                                    // Save any option value for calculated fields
+                                $values[$fid] = $an[2];
+                                $res['num_val'] = $values[$fid];
+                            }
+                            $n++;
+                        }
+
+                        $res['txt_val'] = $res['value'];
+                        break;
+
+                    case 7:        // File Upload - Converted to using File Server
+
+                        $new_filename = '';
+
+                        $existing_file = trim(filter_request('exist_mf_'.$mf['id']));
+                        $new_file = filter_request('mf_'.$mf['id']);
+                        $delete_file_request = filter_request('delete_mf_'.$mf['id']);
+
+                        // If there's a new file uploaded
+                        if ($new_file['name'] != '') {
+
+                            $existing_file = '';
+
+                            // If we can't get the uploaded file
+                            if (!($new_filename = reg_file_upload( 'mf_'.$mf['id'] ))) {
+                                    $mf_results['problem'] .= '<li>Unable to upload file for "'.$mf['title'].'".</li>'."\n";
+                                    $new_filename = '';
+
+                            // File upload successful
+                            } else {
+
+                                // Get current saved uploaded files that are older than 2 days
+                                $expire = date('m/d/Y', strtotime('-2 days'));
+                                $qs = "select * from mf_temp_file where upload_time < '$expire';";
+                                $del = reg_db_auto_get_data( $qs, CONN_STR, FALSE );
+
+                                // If there are any old unused files that need to be deleted
+                                if (is_array($del) && count($del) > 0) {
+
+                                    // Delete each expired file
+                                    foreach ($del as $d_file) {
+                                        reg_file_delete($d_file['file_name']);
+                                    }
+
+                                    // And delete it from mf_temp_file
+                                    $qs = "DELETE FROM mf_temp_file WHERE file_name = '".$d_file['file_name']."' AND upload_time = '".$d_file['upload_time']."';";
+                                    reg_db_auto_exec( $qs, CONN_STR, FALSE );
+                                }
+
+                                // Now add the new file to mf_temp_file to keep track of it till it's used or timed out
+                                $qs = "INSERT INTO mf_temp_file (file_name, upload_time) VALUES ('$new_filename', 'now' );";
+                                reg_db_auto_exec( $qs, CONN_STR, FALSE );
+                            }
+
+                        // Or if we're deleting an existing file
+                        } elseif ($delete_file_request == 'on') {
+
+                            $existing_file = '';    // We'll let the code above delete the file from the server when it times out.
+
+                        // Or if we have an existing file
+                        } elseif ($existing_file != '') {
+
+                            $new_filename = $existing_file;
+
+                        }
+
+                        // if field is required and not provided
+                        if ($mf['required'] == 't' && $new_filename == '' ) {
+                            $res['valid'] = false;
+                            $res['failure'] = 'Required response not provided.';
+                            $mf_results['problem'] .= '<li>"'.$mf['title'].'" requires a response that was not provided. SS</li>'."\n";
+                        }
+
+                        $res['value'] = $new_filename;
+                        $res['txt_val'] = '<a href="'.FILE_SERVER_URL.IS_OWNER_ID.'/_ORIGINAL_/'.$new_filename.'" target="file_page">'.$new_filename.'</a>';
+
+                        break;
+
+
+                        // Calculated field
+
+                    case 31:
+
+                            // Replace view_tag friendly [] characters with {} for use with standard token replacement function
+                        $f = str_replace( '[', '{', str_replace( ']', '}', $mf['data1'] ) );
+
+                            // Perform calculation
+                        $inp = do_math( $f, $values );
+
+                        $inp = str_replace( '{', '[', str_replace( '}', ']', $inp ) );
+
+                            // Check for an error message returned
+                        if( $inp{0} == 'E' )
+                            {
+                            $res['failure'] = $inp;
+                            $res['valid'] = false;
+                            $inp = '';
+                            }
+
+                        $res['value'] = $inp;
+                        $values[$fid] = $inp;
+                        $res['num_val'] = $inp;
+
+                        // If this is a Grand_Total field, then report this value as the value result of the form submission
+                        if( $mf['custom_id'] == 'Form_Value')
+                            {
+                            $form_value = $inp;
+                            }
+
+                        break;
+
+
+
+                    default:
+                        break;
+
+                }    // Type
+
+                // Push the current result and any sub-form results onto the end of the result array.
+                if ($mf['type'] > 0)
+                $mf_results['data'][$mf['id']] = $res;
+                $mf_results['csv'] .= '"'.$res['id'].'","'.$res['level'].'","'.$res['title'].'","'.$res['txt_typ'].'","'.$res['value'].'","'.$res['numb_val'].'","'.($res['valid']?'t':'f').'","'.($res['required']?'t':'f').'","'.$res['failure'].'"'."\n";
+                $x = ''; for( $i=0 ; $i<$mf_level ; $i++ ) $x .= '&nbsp;&nbsp;';
+                $mf_results['html'] .= '<tr><td align="left">'.$res['id'].'</td><td align="left">'.$x.$res['title'].'&nbsp;</td><td align="left">'.$res['txt_typ'].'&nbsp;</td><td align="left">'.( $res['txt_val'] != '' ? $res['txt_val'] : $res['value'] ).'&nbsp;</td><td align="left">'.$res['numb_val'].'&nbsp;</td><td align="left">'.($res['valid']?'Yes':'No').'</td><td align="left">'.($res['required']?'Yes':'No').'</td><td align="left">'.$res['failure'].'&nbsp;</td></tr>'."\n";
+
+                    // If there's a sub-form
+
+                if (is_array($sub)) {
+
+                    // Add data from sub-form
+                    $mf_results['html'] .= $sub['html'];
+                    $mf_results['csv'] .= $sub['csv'];
+                    while (list($key, $val) = each($sub['data'])) {
+                        $mf_results['data'][$key] = $val;
+                    }
+                }
+
+            }    // Active
+
+        }    // Each field
+
+    }
+
+    if ($mf_level == 1) {
+        $mf_results['html'] = '<table border="1" cellpadding="2" cellspacing="0"><tr><th align="left">Field ID</th><th align="left">Title</th><th align="left">Type</th><th align="left">Data</th><th align="left">Value</th><th align="left">Data Valid</th><th align="left">Required</th><th align="left">Failure</th></tr>'."\n".$mf_results['html']."</table>\n";
+    }
+    if ($mf_results['problem'] != '') {
+        $mf_results['success'] = false;
+    }
+
+    $mf_results['total_value'] = $mf_total_value;
+    return( $mf_results );
+
+}
+
+    // MagicForm - Store Data
+
+function magic_form_store_data( $mf_id, $mf_fiid, $mf_def_data )
+{
+
+        // Delete previous entries using the supplied form instance id ($mf_fiid)
+
+    $qs = "BEGIN;\nDELETE FROM ".MF_DATA_TABLE." WHERE fiid = $mf_fiid;\n";
+
+        // Store new data
+
+    foreach ($mf_def_data as $mf) {
+        $qs .= "INSERT INTO ".MF_DATA_TABLE." ( fiid, form_id, field_id, level, title, type, txt_type, value, numb_value, txt_value, opt_num, valid, required, failure )
+                        VALUES ( $mf_fiid, $mf_id, '".addslashes($mf['id'])."', ".(empty($mf['level'])?'NULL':$mf['level']).", '".addslashes($mf['title'])."',
+                                ".(empty($mf['type'])?'NULL':$mf['type']).", '".addslashes($mf['txt_type'])."', '".addslashes($mf['value'])."',
+                                ".($mf['numb_val']!=''?$mf['numb_val']:'NULL').", '".addslashes($mf['txt_value'])."', ".($mf['opt_num']>0?$mf['opt_num']:'NULL').",
+                                '".($mf['valid']?'t':'f')."', '".($mf['required']?'t':'f')."', '".addslashes($mf['failure'])."' );\n";
+    }
+    $qs .= "COMMIT;\n";
+
+    if ( !reg_db_auto_exec($qs)) {
+        return( false );
+    } else {
+        return( true );
+    }
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/front-end/reg_functions.inc b/front-end/reg_functions.inc
new file mode 100644 (file)
index 0000000..bb9d5ac
--- /dev/null
@@ -0,0 +1,8112 @@
+<?
+
+// $no_filter tells function not to try to filter the input parameter, only find it. Needed for array input and such
+function filter_request($field, $filter = FILTER_SANITIZE_STRING, $option = FILTER_FLAG_STRIP_HIGH, $no_filter = false)
+    {
+        global ${$field};
+
+        // If the request was to not do any filtering, just return the parameter
+        if ($no_filter) {
+            $r = $_REQUEST[$field];
+
+        // Otherwise try to filter input from submission
+        } else {
+
+            $r = filter_var($_REQUEST[$field], $filter, $option);
+        }
+
+        // If value is exactly 0 then return that to prevent next test from replacing it
+        if ($r == '0') {
+            return $r;
+        }
+
+        // Also check for uploaded files
+        if ($r === false || $r === null || empty($r)) {
+            $r = $_FILES[$field];
+
+            if (is_array($r)) {
+                $r['name'] = filter_var($r['name'], FILTER_SANITIZE_STRING);
+            }
+        }
+
+        // If nothing provided, check for override parameter
+        if ($r === false || $r === null || empty($r)) {
+            $r = ${$field};
+        }
+
+        return $r;
+    }
+
+/************************************************************************
+    Functions from old functions.inc needed to support this application.
+************************************************************************/
+
+define( "DB_SET_DATE_STYLE_STRING",        "SET DATESTYLE TO 'SQL';\n" );
+define( "DB_TYPE", "postgres");
+define( 'DB_STATIC', TRUE);
+
+$link_data = '';
+
+function reg_link_data( $data_field_name )
+    {
+    global $link_data;
+    $x = urlencode(trim(str_replace( array( '|', '~' ), '', stripslashes($GLOBALS[$data_field_name]))));
+    if( $x != '' )
+        $link_data .= '&'.$data_field_name.'='.$x;
+    }
+
+$form_data = '';
+
+function reg_pass_data( $data_field_name, $value = '' )
+    {
+    global $link_data, $form_data ;
+    $x = stripslashes(trim(str_replace( array( '|', '~' ), '', $GLOBALS[$data_field_name])));
+    if( $value != '' )
+        $x = $value;
+    reg_link_data( $data_field_name );
+    $form_data .= '<INPUT TYPE="hidden" NAME="'.$data_field_name.'" VALUE="'.$x.'">
+                ';
+    }
+
+// Display E-Mail if debug level > 0
+
+function debug_mail( $to, $subject, $message, $headers = '', $parameters = '' )
+{
+
+    if( $GLOBALS['reg_config']['debug_mail'] )
+    {
+        echo '<p>
+                <table border="1">
+                    <tr><th align="center">MAIL DEBUG</th></tr>
+                    <tr><td align="left"> Recipient(s): '.$to.'</td></tr>
+                    <tr><td align="left"> Subject: '.$subject.'</td></tr>
+                    <tr><td align="left"> Headers:<br><pre>'.$headers.'</pre></td></tr>
+                    <tr><td align="left"> Parameters:<br><pre>'.$parameters.'</pre></td></tr>
+                    <tr><td align="left"> <pre>'.$message.'</pre></td></tr>
+                </table>
+            <p>
+            ';
+        return( true );
+    }
+    else
+    return( mail( $to, $subject, $message, $headers, $parameters ) );
+
+}
+
+
+// Clean up input parameters and test them for proper type of data
+
+function clean_input( $var_name, $type = 'text', $required = false )
+{
+
+    $reason     = '';            // If problems, indicates reason here
+
+    // Trim whitespace, slashes, and stupid characters
+
+    $in = stripslashes( trim( $_REQUEST[$var_name] ) );
+
+    if( $in != '' )
+    {
+        switch( $type )
+        {
+
+            case 'int':
+                if (!is_numeric($in)) {
+                    $reason = 'not an integer';
+                } else {
+                    $in = intval($in);
+                }
+                break;
+
+            case 'float':
+                $in = preg_replace("/^(\\$)?(.*)$/i", "\\2", $in);
+                if (!is_numeric($in)) {
+                    $reason = 'not a valid number';
+                } else {
+                    $in = (float) $in;
+                }
+                break;
+
+            case 'phone':
+                if (preg_match("/^((\([0-9]{3}\))[ ]*|([0-9]{3}) *-* *)?[0-9]{3} *-* *[0-9]{4} *.{0,10}$/i", $in) == 0) {
+                    $reason = 'not a valid phone number';
+                } else {    // Reformat as we want it
+                    $in = preg_replace("/^((\(([0-9]{3})\))[ ]*|(([0-9]{3}))[ -]*)?([0-9]{3}) *-* *([0-9]{4}) *(.{0,10})$/i", "\\3\\4-\\6-\\7 \\8", $in);
+                }
+                break;
+
+            case 'zip':
+                // Check if it's a US ZIP
+                if (preg_match("/^(([0-9]{5})([ -+]?([0-9]{4}))?)$/i", $in) != 0) {
+                    $in = preg_replace("/^([0-9]{5})[ -+]?([0-9]{4})$/i", "\\1-\\2", $in);
+                    if (strlen($in) < 8) {
+                        $in = preg_replace("/^([0-9]{5}).*/i", "\\1", $in);
+                    }
+                } elseif (preg_match("/^[a-zA-Z]\d[a-zA-Z][ -]?\d[a-zA-Z]\d$/i", $in ) != 0) {
+                    $in = preg_replace("/^([a-zA-Z]\d[a-zA-Z])[ -]?(\d[a-zA-Z]\d)$/i", "\\1 \\2", $in);
+                }
+                else
+                $reason = 'not a valid ZIP or Postal Code';
+                break;
+
+            case 'state':
+                global $si_states_array;
+                if (!isset($si_states_array[$in])) {
+                    $reason = 'not a valid state code';
+                }
+                break;
+
+            case 'country':
+                global $si_countries_array;
+                if (!isset($si_countries_array[$in])) {
+                    $reason = 'not a valid country code';
+                }
+                break;
+
+            case 'email':
+                if (preg_match("/^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$/i", $in) == 0) {
+                    $reason = 'not a valid E-Mail address';
+                }
+                break;
+
+            case 'creditcard':
+                global $si_cc_verify;
+                $match = FALSE;
+                reset($si_cc_verify);
+                while (list($k, $v) = each($si_cc_verify)) {
+                    if (preg_match("/".$v."/i", $in) != 0) {
+                        $match = TRUE;
+                        break;
+                    }
+                }
+                if (!$match) {
+                    $reason = 'not a valid credit card number';
+                }
+                break;
+
+            case 'date':
+                if (($t = strtotime($in)) === -1) {
+                    $reason = 'not a valid date';
+                } else {
+                    $in = date('n/j/Y', $t);
+                }
+                break;
+
+            case 'text':
+                break;
+
+            case 'inet':
+                if (preg_match("/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/i", $in) == 0) {
+                    $reason = 'not a valid IP address or netmask';
+                }
+                break;
+
+            default:
+                break;
+
+        }
+    }
+
+    // Check for a required field
+
+    if ($required && $in == '')
+    $reason .= ($reason != '' ? ' and is ':'').'required';
+
+    $GLOBALS[$var_name] = $in;
+    return $reason;
+
+}
+
+// Alternative strong credit card check function.
+// NOTE: The $si_cc_verify stuff SHOULD be passed rather than use a global to avoid issues with changes in the global values
+
+function credit_card_check( $Num, $si_cc_verify, $accepted = 0 )
+{
+
+    $Num = preg_replace("/[^[:digit:]]/", "", $Num);
+
+    // Check for Accepted Card List
+    $cc_accepted = ($accepted - 0);
+    if( $cc_accepted == 0 )
+    {
+        echo "<P>ERROR: credit_card_check() requires bitmap for accepted cards<P>";
+        exit;
+    }
+
+    // Permit secret test code
+    if( $Num == "0011001100110011" || $Num == "5454545454545454" ) {
+        return( "Test" );
+    } else {
+        // Check each selected card type for a pattern match
+        $Name = "";
+        reset( $si_cc_verify );
+        $i = 0;
+        while( list($k, $v) = each($si_cc_verify) )
+        if( ( $cc_accepted & pow(2,$i++) ) && preg_match( $v, $Num ) )
+        {
+            $Name = $k;
+            break;
+        }
+    }
+
+    // Fail if nothing matched
+
+    if( $Name == "" )
+    return( FALSE );
+
+    // Now do strong test
+
+    $Num = strrev($Num);
+
+    $Total = 0;
+
+    for ($x=0; $x<strlen($Num); $x++)
+    {
+        $digit = substr($Num,$x,1);
+        if ($x/2 != floor($x/2))
+        {
+            $digit *= 2;
+            if (strlen($digit) == 2)
+            $digit = substr($digit,0,1) + substr($digit,1,1);
+        }
+        $Total += $digit;
+    }
+
+    if( $Total % 10 == 0 )
+    return( $Name );
+    else
+    return( FALSE );
+
+}
+
+// Returns Title text with QuickTip Pop-Up support
+
+function quick_tip( $title, $message )
+{
+
+    if( trim($title) == '' || trim($message) == '' )
+    return( false );
+
+    $t = strip_tags( $title );        // Get rid of any HTML tags in title
+
+    $key = md5($title);    // Used as the ID of this QuickTip
+
+    return( '<div id="QuickTip_'.$key.'" class="quicktip">
+            <div class="quicktip-titlebar">
+                <a href="javascript:hide_QuickTip(\'QuickTip_'.$key.'\')"><span class="quicktip-close">Close</span></a>
+                <div class="quicktip-title">QuickTip</div>
+            </div>
+            <div class="quicktip-body">
+                <div class="quicktip-fieldname">'.$t.'</div>
+                '.$message.'
+            </div>
+            </div>
+            <iframe id="Shim_QuickTip_'.$key.'" src="javascript:false;" scrolling="no" frameborder="0" style="position:absolute; top:0px; left:0px; display:none;"></iframe>
+            <span onClick="show_QuickTip(\'QuickTip_'.$key.'\',event);" class="quicktip-prompt2">'.$title.'</span>' );
+
+}
+
+// Returns Title text with QuickEdit Pop-Up support - Uses QuickTip Java functions
+
+function quick_edit( $key, $prompt, $form )
+{
+    if( trim($prompt) == '' || trim($form) == '' )
+    return( false );
+
+    $t = strip_tags( $prompt );        // Get rid of any HTML tags in title
+
+    return( '<div id="QuickEdit_'.$key.'" class="quickedit">
+            <div class="quicktip-titlebar">
+                <a href="javascript:hide_QuickTip(\'QuickEdit_'.$key.'\')"><span class="quickedit-close">Close</span></a>
+                <div class="quickedit-title">QuickEdit</div>
+            </div>
+            <div class="quickedit-body">
+                '.$form.'
+            </div>
+            </div>
+            <iframe id="Shim_QuickEdit_'.$key.'" src="javascript:false;" scrolling="no" frameborder="0" style="position:absolute; top:0px; left:0px; display:none;"></iframe>
+            <span onClick="show_QuickTip(\'QuickEdit_'.$key.'\',event);" class="quickedit-prompt2">'.$prompt.'</span>' );
+
+}
+
+
+
+
+
+
+/***********************************************************************
+ *                                                                      *
+ *                DATABASE ABSTRACTION FUNCTIONS                        *
+ *                                                                       *
+ ***********************************************************************/
+
+
+// Create a connection to database specified $conn_str,
+
+ function reg_db_connect( $conn_str, $fail_mode )
+ {
+    static $last_connect = '';
+    static $ret = 0;
+
+    // forcing static data connection
+    if( $ret != 0 ) {
+        if( $GLOBALS['reg_config']['debug'] >= 3 ) echo "<PRE>reg_db_connect() - Using existing connection - \$conn_str = ".$conn_str."</PRE><BR>";
+        return($ret);
+    }
+
+    // If we're using static connections, check to see if this is trying to open the same connection again
+
+    if( DB_STATIC )
+        {
+
+        // Check to see if this is trying to open the same connection again
+
+        if( $last_connect == $conn_str )
+            {
+            // If so just use the current connection
+
+            if( $GLOBALS['reg_config']['debug'] >= 3 ) echo "<PRE>reg_db_connect() - Using existing connection - \$conn_str = ".$conn_str."</PRE><BR>";
+            return( $ret );
+            }
+
+        // If we need to open a different connection, close the current one first
+
+        if( $ret != 0 )
+            if( $GLOBALS['reg_config']['debug'] >= 3 ) echo "<PRE>reg_db_connect() - Closing current database connection</PRE><BR>";
+            reg_db_close( $ret );
+
+        $last_connect = $conn_str;
+
+        }
+
+    if( $GLOBALS['reg_config']['debug'] >= 3 ) echo "<PRE>reg_db_connect()[".__LINE__."]: \$conn_str = ".$conn_str."</PRE><BR>";
+
+    switch( DB_TYPE )
+        {
+        case "postgres":
+            $ret = pg_connect( $conn_str );
+            pg_query($ret, 'set search_path to registrations,public;');
+            break;
+        default:
+            return( 0 );
+        }
+
+    if( !$ret && $fail_mode )
+        html_error( DB_ERROR_MSG, 1 );
+
+    return( $ret );
+
+ }
+
+// Close the connection to database specified by the handle dbd
+
+ function reg_db_close( $dbd )
+ {
+     if( $GLOBALS['reg_config']['debug'] >= 3 ) echo "<PRE>reg_db_close() - Not set to close connections current in this code</PRE><BR>";
+/* - We're  not closing anything now.
+    // IF we're using static connections, don't actually close it
+
+    if( DB_STATIC == TRUE )
+        return( TRUE );
+
+    switch( DB_TYPE )
+        {
+        case "postgres":
+            $ret = pg_close( $dbd );
+            break;
+        default:
+            return( 0 );
+        }
+
+ return( $ret );
+*/
+ }
+
+// Execute an SQL query
+
+ function reg_db_exec( $dbd, $qs )
+ {
+
+    if( $GLOBALS['reg_config']['debug'] >= 3 ) echo "<PRE>reg_db_exec()[".__LINE__."]: \$qs = ".$qs."</PRE><BR>";
+
+    switch( DB_TYPE )
+        {
+        case "postgres":
+            $ret = pg_query( $dbd, $qs );
+            break;
+
+        default:
+            return( 0 );
+        }
+
+    return( $ret );
+ }
+
+// Get data and store in associative indices, using the field names as keys.
+
+ function reg_db_fetch_row( $res, $i )
+ {
+
+    if( $GLOBALS['reg_config']['debug'] >= 3 ) echo "<PRE>db_fetch()[".__LINE__."]: Row = ".$i."</PRE><BR>";
+
+    if( reg_db_numrows($res) == 0 )
+    return( FALSE );
+
+    switch( DB_TYPE )
+        {
+        case "postgres":
+            $row = pg_fetch_array( $res, $i, PGSQL_ASSOC );
+            break;
+
+        default:
+            return( FALSE );
+        }
+
+    return( $row );
+
+ }
+
+// Free result memory.
+
+ function reg_db_freeresult( $res )
+ {
+
+    switch( DB_TYPE )
+        {
+        case "postgres":
+            $ret = pg_freeresult( $res );
+            break;
+
+        default:
+            return( 0 );
+        }
+
+    return( $ret );
+ }
+
+// Determine number of rows in a result index
+
+ function reg_db_numrows( $res )
+ {
+
+    switch( DB_TYPE )
+        {
+        case "postgres":
+            $ret = pg_numrows( $res );
+            break;
+
+        default:
+            return( -1 );
+        }
+
+    return( $ret );
+ }
+
+
+/***********************************************************************
+ *
+ * BEGIN Auto functions
+ *
+ ***********************************************************************/
+
+// Retrieve a result as an array based soley on a query
+
+function db_auto_get_row( $qs, $i = 0, $conn_str = CONN_STR, $fail_mode = 'FALSE' )
+{
+
+    if( $GLOBALS['reg_config']['debug'] >= 2 ) echo "<PRE>db_auto_get_row()[".__LINE__."]: \$qs = $qs, Row = $i</PRE><BR>";
+
+    if( !($dbd = reg_db_connect( $conn_str, $fail_mode )) )
+        return( FALSE );
+
+    if( ($res = reg_db_exec($dbd, DB_SET_DATE_STYLE_STRING.$qs)) )
+        {
+        $row = reg_db_fetch_row( $res, $i );
+        reg_db_freeresult( $res );
+        }
+
+    reg_db_close( $dbd );
+    return( $row );
+}
+
+    // Retrieve a set of results based soley on a query
+
+function reg_db_auto_get_data( $qs, $conn_str = SI_CONN_STR, $fail_mode = FALSE, $rows = 500, $start = 0 )
+{
+
+    if( $GLOBALS['reg_config']['debug'] >= 2 ) echo "<PRE>reg_db_auto_get_data()[".__LINE__."]: \$qs = $qs, \$rows = $rows, \$start = $start</PRE><BR>";
+
+    if( !($dbd = reg_db_connect( $conn_str, $fail_mode)) )
+        return( FALSE );
+
+    if( ($res = reg_db_exec($dbd, SI_DB_SET_DATE_STYLE_STRING.$qs)) )
+        {
+        $totalrows = pg_NumRows( $res );
+        $stop = $start + $rows;
+        if( $stop > $totalrows )
+            $stop = $totalrows;
+
+        for( $i=$start ; $i<$stop ; $i++ )
+            {
+            $data["$i|$totalrows"] = reg_db_fetch_row( $res, $i );
+            }
+        }
+    reg_db_close( $dbd );
+
+    return( $data );
+}
+
+    // Execute a query.
+
+function reg_db_auto_exec( $qs, $conn_str = SI_CONN_STR, $fail_mode = 'FALSE' )
+{
+
+    if( $GLOBALS['reg_config']['debug'] >= 2 ) echo "<PRE>reg_db_auto_exec()[".__LINE__."]: \$qs = $qs, \$conn_str = $conn_str</PRE><BR>";
+
+    $dbd = reg_db_connect( $conn_str, $fail_mode );
+    if( !$dbd )
+        return( 0 );
+
+
+    if( !( $result = reg_db_exec($dbd, $qs)) )
+        {
+        reg_db_close( $dbd );
+        return( 0 );
+        }
+    else
+        {
+        $oid = pg_last_oid( $result );
+        reg_db_close( $dbd );
+        if( empty($oid) || $oid == -1 )
+            return( 1 );
+        else
+            return( $oid );
+        }
+}
+
+
+
+/***********************************************************************
+*                                                                      *
+*                    IMAGE/FILE FUNCTIONS                              *
+*                                                                      *
+***********************************************************************/
+
+function reg_load_imageServer()
+{
+    if (!class_exists('Reg_Toolkit_Image_Server')) {
+        include_once GLM_APP_BASE.'Common/Registrations_V3/classes/ImageServer/Server.php';
+    }
+}
+
+function reg_process_image($image)
+{
+    reg_load_imageServer();
+    $is = new Reg_Toolkit_Image_Server();
+    return $is->imageUpload($image);
+}
+
+function reg_delete_image($image)
+{
+    reg_load_imageServer();
+    $is = new Reg_Toolkit_Image_Server();
+    $message = $is->imageDelete($image);
+}
+
+
+function reg_load_fileServer()
+{
+    if (!class_exists('Reg_Toolkit_FileServer_AdapterAbstract')) {
+        include_once GLM_APP_BASE.'Common/Registrations_V3/classes/FileServer/AdapterAbstract.php';
+    }
+    if (!class_exists('Reg_Toolkit_FileServer_FileAdapter')) {
+        include_once GLM_APP_BASE.'Common/Registrations_V3/classes/FileServer/FileAdapter.php';
+    }
+}
+
+// Store away an uploaded file
+
+/*
+ * Save an uploaded file to the image/file server
+ *
+ * $form_field is the "name" of the field in the submitted form.
+ *
+ * This function returns the name of the file as assigned by the image/file server
+ */
+function reg_file_upload( $form_field )
+{
+    reg_load_fileServer();
+    $fs = new Reg_Toolkit_FileServer_FileAdapter();
+    $res = $fs->upload($form_field);
+    return $res['name'];
+}
+
+/*
+ * Delete a file from the file/image server
+ *
+ * $file_name is the name of the file as assigned by the file/image server on upload
+ */
+function reg_file_delete( $file_name )
+{
+    reg_load_fileServer();
+    $fs = new Reg_Toolkit_FileServer_FileAdapter();
+    $res = $fs->delete($file_name);
+    return $res;
+}
+
+// Read the specified file from the local virtual server and return the results
+function file_get( $file_name, $max_size = 0, $base_path = '' )
+{
+    if( !is_readable ( $base_path."/".$file_name ) )
+        return( FALSE );
+
+    $f = fopen( $base_path."/".$file_name, "r" );
+    $s = filesize($base_path."/".$file_name);
+    if( $max_size == 0 || $s <= $max_size )
+        $file_contents = fread( $f, $s );
+    else
+        return( FALSE );
+
+    return( $file_contents );
+}
+
+
+/**
+ *    GENERAL SUPPORT FUNCTIONS / CLASSES
+ **/
+
+class timestampfunc
+{
+
+    function newdate( $timestamp )
+        {
+        $z = date( "m:Y", $timestamp );
+        $z = explode( ":", $z );
+        return $z;
+        }
+
+    function first_of_month( $timestamp )
+        {
+        $z = $this->newdate( $timestamp );
+        $first_of_month = $z[0]."/1/".$z[1];
+        return strtotime( $first_of_month );
+        }
+
+    function first_last_month( $timestamp )
+        {
+        $z = $this->newdate( $timestamp );
+        $z[0]--;
+        if( $z[0] <= 0 )
+            {
+            $z[0] = 12;
+            $z[1]--;
+            }
+        $first_of_month = ($z[0])."/1/".$z[1];
+        return strtotime( $first_of_month );
+        }
+
+    function first_next_month( $timestamp )
+        {
+        $z = $this->newdate( $timestamp );
+        $z[0]++;
+        if( $z[0] > 12 )
+            {
+            $z[0] = 1;
+            $z[1]++;
+            }
+        $first_of_month = ($z[0])."/1/".$z[1];
+        return strtotime( $first_of_month );
+        }
+
+    function first_of_Xmonth( $timestamp, $x )
+        {
+        $z = $this->newdate( $timestamp );
+        $r = mktime( 0,0,0, ($z[0]+$x), 1, $z[1] );
+        return $r;
+        }
+
+}
+
+
+    // Return Positive values only, otherwise 0
+
+function pos_value( $value )
+{
+
+    if( $value > 0 )
+        return( $value );
+    return( 0 );
+}
+
+
+    // Format a number as US Dollars
+
+function money( $value, $option = "" )
+{
+
+    if( $option == "NOPREFIX" )
+        $prefix = "";
+    else
+        $prefix = "$";
+
+        // Do value sanity check
+
+    if( !is_numeric( $value ) )
+        return( $prefix."0.00" );
+
+    return( $prefix.number_format($value, 2, ".", "," ) );
+}
+
+
+    // Convert "key^value~key^value" string to an array
+
+function strtoarray( $s )
+{
+
+    $a = array();
+
+        // Create array of entries - If there's less than 2 entries, fail
+
+    if( count($ea = explode( '~', $s )) < 2 )
+        return( FALSE );
+
+    foreach( $ea as $e )
+        {
+            // Each entry must have exactly 2 parts
+
+        if( count($d = explode( "^", $e )) != 2 )
+            return( FALSE );
+
+        $a[trim($d[0])] = trim($d[1]);
+        }
+
+    return( $a );
+}
+
+
+    // Convert array to a "key^value~key^value" string
+
+function arraytostr( $a )
+{
+
+    $s = '';
+
+        // Supplied value must be array of 2 or more entries
+
+    if( !is_array($a) || count($a) < 2 )
+        return( FALSE );
+
+    $sep = "";
+
+    while( list($k,$v) = each($a) )
+        {
+        $s .= $sep."$k^$v";
+        $sep = '~';
+        }
+
+    return( $s );
+}
+
+
+    // Replace {tokens}
+
+function replace_tokens( $s, $tokens )
+{
+
+    if( !is_array($tokens) )
+        {
+        echo '<P>ERROR: replace_tokens() - Parameter 2 ($tokens) is not an array<P>';
+        exit;
+        }
+
+    while( list($k,$v) = each($tokens) )
+        {
+        $s = str_replace( "{".$k."}", $v, $s );
+        }
+
+    return( $s );
+
+}
+
+
+    // Conditionally replace tokens
+
+function cond_replace_tokens( $s, $tokens, $x="cond" )
+{
+
+    if( !is_array($tokens) )
+        {
+        echo '<P>ERROR: cond_replace_tokens() - Parameter 2 ($tokens) is not an array<P>';
+        exit;
+        }
+
+    while( list($k,$v) = each($tokens) )
+        {
+        $p0 = 0;    // Reset starting pointer position
+
+        while( ($start = strpos( $s, "<!--{if:".$k, $p0 )) !== false )
+            {
+
+            if( strcspn( substr($s,$start+8+strlen($k)), "=!><}" ) == 0 )     // Check to make sure it's not a substring of another token
+                {
+
+                if( !($if_end = strpos( $s, "}-->", $start )) )                            // Find end of {if:} tag
+                    return( "ERROR: cond_replace_tokens() - Can't find end of {if:} tag at $start.<P><PRE>\n\n".htmlentities(substr($s,$start,500))."</PRE>" );
+
+                $p = $start + 8 + strlen($k);                                            // Set position where "=" should be if it's used
+                $cond = substr($s,$p,1);
+                switch( $cond )
+                    {
+                    case "=":
+                    case "!":
+                    case ">":
+                    case "<":
+                        $if_val_test = TRUE;                                            // If valid comparison character?
+                        $if_val = substr( $s, $p+1, $if_end-$p-1 );
+                        break;
+                    default:
+                        $if_val_test = FALSE;
+                        break;
+                    }
+
+                    // Separate out strings for both yes and no conditions
+
+                $yes_start = $if_end + 4;                                                // Point past tag
+                $ci = "";                                                                // Closed {/if} take intro only if there's no {else}
+                $else_if = strpos( $s, "<!--{else:$k}", $yes_start );
+                $slash_if = strpos( $s, "<!--{/if:$k}-->", $yes_start );
+                if( $else_if && ( !$slash_if || ($else_if < $slash_if) )  )                // If there's an {else}
+                    {
+                    $yes_string = substr( $s, $yes_start, $else_if-$yes_start );
+                    $no_start = $else_if + 11 + strlen($k);                                                // Point past tag
+                    if( !($no_end = strpos( $s, "{/if:$k}-->", $no_start )) )                    // If there's no --> end of cond tag
+                        return( "ERROR: cond_replace_tokens() - Matching {/if:} tag not found after {else:} at $start for \"$k\".<P><PRE>\n\n".htmlentities(substr($s,$start,500))."</PRE>" );
+
+                    $end = $no_end + 9 + strlen($k);
+
+                    $no_string = substr( $s, $no_start, $no_end-$no_start );
+                    }
+                else
+                    {
+                    $no_string = "";
+                    if( !($slash_if = strpos( $s, "<!--{/if:$k}-->", $yes_start )) )                    // If there's no end of cond tag
+                        return( "ERROR: cond_replace_tokens() - Matching {/if} tag not found at $start for \"$k\".<P><PRE>\n\n".htmlentities(substr($s,$start,500))."</PRE>" );
+                    $end = $slash_if + 13 + strlen($k);
+                    $yes_string = substr( $s, $yes_start, $slash_if-$yes_start );
+                    }
+
+                if( $if_val_test != FALSE )                                                // If there's a compare value, test with that
+                    switch( $cond )
+                        {
+                        case "=":
+                            $t = ( trim($v) == trim($if_val) );
+                            break;
+                        case "!":
+                            $t = ( trim($v) != trim($if_val) );
+                            break;
+                        case ">":
+                            $t = ( trim($v) > trim($if_val) );
+                            break;
+                        case "<":
+                            $t = ( trim($v) < trim($if_val) );
+                            break;
+                        default:
+                            return( "ERROR: cond_replace_tokens() - Internal unknown conditional operator error ($cond)- Code Bad, fix code!" );
+                        }
+                else                                                                    // otherwise just use token value
+                    $t = ( trim($v) != "" );                                            //   if it's not empty use yes_string
+
+                if( $t )                                                                // Replace with appropriate string
+                    $s = substr_replace( $s, $yes_string, $start, $end-$start );
+                else
+                    $s = substr_replace( $s, $no_string, $start, $end-$start );
+                }
+            else
+                $p0 = $start + 1;
+            }
+            $p0 = $start;
+        }
+
+    return( $s );
+
+}
+
+    // Replace {file:xxx} token with a file
+
+function replace_file_tokens( $s )
+{
+
+    $p0 = 0;    // Reset starting pointer position
+
+    while( $p0 < strlen($s) && ($start = strpos( $s, "<!--{file:", $p0 )) )
+        {
+        if( !($file_end = strpos( $s, "}-->", $start )) )                        // Find end of {file:} tag
+            return( "ERROR: replace_file_tokens() - Can't find end of {file:} tag at $start.<P><PRE>\n\n".htmlentities(substr($s,$start,500))."</PRE>" );
+
+        $filename = substr( $s, $start+10, $file_end-$start-10 );                // Get file name
+            // Check for a matching <!--{/file}--> tag
+
+        if( ($slash_file = strpos( $s, "<!--{/file}-->", $file_end))             // If there's a {/file} tag
+            && !($next_file = strpos( $s, "<!--{file:", $file_end))             // and there's not another {file:} tag
+            || ( $next_file && $slash_file < $next_file ) )                        // or it's beyond our {/file} tag
+            {
+            $file_end = $slash_file + 10;                                // Point to "}-->"
+            }
+
+        $end = $file_end + 4;
+
+            // Check if file name is valid
+
+        if( ($file_contents = file_get( $filename )) == FALSE )
+            return( "ERROR: replace_file_tokens() - Can't load specified file '$filename' for {file:} tag.<P><PRE>\n\n".htmlentities(substr($s,$start,500))."</PRE>" );
+
+        $s = substr_replace( $s, $file_contents, $start, $end-$start );
+
+        $p0 = $end;
+        }
+
+    return( $s );
+
+}
+
+
+    // Convert an array of data to an HTML table
+
+function tableize_array($arr, $len=100 )
+{
+        // Verify that parameter is actually an array
+
+    if( !is_array($arr) )
+        {
+        $return = "Error: Variable not an array";
+        return $return;
+        }
+
+        // If everything's going fine so far, build out the table
+
+    $return = '<P><table width="100%" bordercolor="black" border="1">';
+
+    foreach( $arr as $key=>$val )
+        {
+        $return .= '<tr><td align="left" valign="top" width="10%" nowrap>'.$key.'</td> <td align="left" valign="top" width="90%">';
+        if( is_array($val) )
+            $return .= tableize_array( $val );
+        else
+            {
+            if( strlen($val) > $len )
+                $x = substr( $val, 0, $len ).".......";
+            else
+                $x = $val;
+            $return .= "<PRE>".htmlentities( $x )."</PRE>";
+            }
+
+        $return .= "</td></tr>\n";
+        }
+
+    $return .= "</table>";
+
+    return  $return;
+}
+
+
+
+
+
+/**
+ * View Processing Functions
+ */
+
+    // Parse a "view" file to merge in supplied data
+
+function parse_view( $file_name, $tokens, $show_unused = TRUE )
+    {
+    if( !($f = file_get( $file_name ) ) )
+        {
+        if( trim($file_name) == '' )
+            return( "ERROR: No view file name supplied." );
+        else
+            return( "ERROR: View file '$file_name' not found or unreadable." );
+        }
+    $out = parse_string_view( $f, $tokens, $show_unsued );
+    return( $out );
+    }
+
+    // Process Lists
+
+function process_view_lists( $f, $tokens, $pvl_level = 0, $pvl_require_list_data = false )
+    {
+
+        // Process list sections
+
+    $out = "";
+
+    $p = 0;
+    while( !(($p2 = strpos( $f, "<!--{list:", $p )) === FALSE ))            // While there are still lists
+        {
+            // Start of a list has been found
+
+        $out .= substr( $f, $p, $p2-$p );                                        // Add portion up to start of list to output
+        $p = $p2 + 10;                                                            // Get past list token
+        if( !($p2 = strpos( $f, "}-->", $p )) || $p2 == $p )                    // If there's no }--> following it, then something's wrong
+            return( "ERROR: parse_view() - Missing name of {list:name} tag at $p.<P><PRE>".htmlentities(substr($f,$p,500))."</PRE>" );
+        $listname = substr( $f, $p, $p2-$p );                                    // Get name of this list
+
+            // If list data is required (no empty lists) and we don't have any
+
+        if( $pvl_require_list_data && ( !isset($tokens[$listname]) || !is_array($tokens[$listname]) ) )
+            {
+            $out = "ERROR: parse_view() - No data supplied for list name \"$listname\".";
+            if( $GLOBALS['reg_config']['debug_view'] )
+                $out .= "<P>&nbsp;<P><HR><P>Tags supplied to parse_view() function<P>".tableize_array( $tokens );
+            return( $out );
+            }
+
+        $p = $p2 + 4;                                                            // Move pointer to start of list
+        if( !($end = strpos( $f, "<!--{/list:".$listname."}-->", $p )) )                        // Find end of this list section
+            return( "ERROR: parse_view() - Matching {/list} tag not found at $p.<P><PRE>".htmlentities(substr($f,$p,500))."</PRE>" );
+
+            // Break up list
+
+        unset( $list );
+        $sections = 0;
+        $sep = "";
+        while( ($p2 = strpos( $f, "<!--{sep:".$listname."}-->", $p )) && $p2 < $end )            // While there's still separators in this list
+            {
+            $list[$sections] = substr( $f, $p, $p2-$p );                        // Save this segment
+            $p = $p2 + 13 + strlen($listname);                                    // Point past start of separator
+            if( !($p2 = strpos( $f, "<!--{/sep:".$listname."}-->", $p )) || $p2 > $end )        // Find matching {/sep} tag
+                return( "ERROR: parse_view() - Matching {/sep} tag not found at $p.<P><PRE>".htmlentities(substr($f,$p,500))."</PRE>" );
+            if( empty($sep) )                                                    // Only use the first separator
+                $sep = substr( $f, $p, $p2-$p );
+            $p = $p2 + 14 + strlen($listname);                                    // Point past end of {/sep} tag
+            $sections++;                                                        // Bump section count
+            }
+
+        $list[$sections] = substr( $f, $p, $end-$p );                            // Store last section of list
+        $p = $end + 15 + strlen($listname);                                        // Point past this list
+        $sections++;                                                            // Bump section count
+
+            // For each token expected in this list - Compile output
+
+        if( !empty( $tokens[$listname] ) )        // That is if there's any data for the list
+            {
+            $t = count($tokens[$listname]);                                        // Get number of blocks of data
+            $j = 0;
+            foreach( $tokens[$listname] as $to )                                // For each block of data supplied
+                {
+                if( !is_array($to) || count($to) == 0 )
+                    {
+                    $out = "ERROR: parse_view() - List data contains an empty token array for list $listname.";
+                    if( $GLOBALS['reg_config']['debug_view'] )
+                        $out .= "<P>&nbsp;<P><HR><P>Tags supplied to parse_view() function<P>".tableize_array( $tokens );
+                    return( $out );
+                    }
+                $x = replace_tokens( $list[$j%$sections], $to );                // Replace tokens in appropriate section
+                $x = process_view_lists( $x, $to, $pvl_level+1, $pvl_require_list_data );                // Process any sub-lists
+                $out .= cond_replace_tokens( $x, $to );                            // Do conditional replacements also
+
+                if( ++$j < $t )                                                    // If there's more data, output sep
+                    $out .= $sep;
+                }
+            }
+        }
+
+    $out .= substr( $f, $p );            // Now add remainder of page
+    return( $out );
+    }
+
+
+    // Parse a "view" string to merge in supplied data
+
+function parse_string_view( $f, $tokens, $show_unused = TRUE )
+    {
+
+    if( empty($f) )
+        return( "ERROR: View string not provided." );
+
+        // Replace all {include:filename}
+
+    while( !( ($p2 = strpos( $f, '<!--{include:' )) == FALSE ) )        // While there's file includes
+        {
+
+        $p = $p2 + 13;        // Save the position of the start of the filename
+
+            // Look for the end of this tag
+
+        if( !( $p2 = strpos($f, "}-->", $p)) || $p2 == $p ) // If there's no }--> following it, then something's wrong
+            return ("ERROR: parse_view() - Missing name of {include:filename} tag at $p.<P><PRE>".htmlentities(substr($f, $p, 500))."</PRE>");
+
+            // Read in the specified file
+
+        $filename = substr($f, $p, $p2 - $p); // Get name of the specified file
+        if( !($inc_file = file_get( BASE_PATH.'/'.$filename)) )
+            return ("ERROR: parse_view() - Target of {include:filename} tag does not exist or is unreadable at $p.<P><PRE>".htmlentities(substr($f, $p-13, 500))."</PRE>");
+
+            // Replace the tag with the file contents
+
+        $f = str_replace( '<!--{include:'.$filename.'}-->', $inc_file, $f );
+
+        }
+
+        // Tear out {exclude} ... {/exclude} regions
+
+    $f = preg_replace( "/<!--\\{exclude\\}-->.*?<!--\\{\/exclude\\}-->/s", "", $f );
+
+        // Remove comments from around any {INCLUDE ... /INCLUDE} regions
+
+    $f = str_replace( "<!--{include}", "", $f );
+    $f = str_replace( "{/include}-->", "", $f );
+
+        // Insert any specified files
+    $f = replace_file_tokens( $f );
+
+        // Replace all global tokens
+    $f = replace_tokens( $f, $tokens["global"] );
+
+        // Do conditional replacements for global tokens
+
+    $f = cond_replace_tokens( $f, $tokens["global"] );
+
+    $out = process_view_lists( $f, $tokens );
+
+    if( $show_unused )
+        $out = preg_replace( "/(\\{\S*?\\})/", "<FONT COLOR=\"red\"><BLINK>\\1</BLINK></FONT>", $out );
+
+    if( $GLOBALS['reg_config']['debug_view'] )
+        $out .= "<P>&nbsp;<P><HR><P>Tags supplied to parse_view() function<P>".tableize_array( $tokens );
+
+    return( $out );
+
+}
+
+
+/**
+ * MagicForms and do_math support in separate file
+ */
+include_once (GLM_APP_BASE.'Common/Registrations_V3/front-end/magic_forms_function.inc');
+
+/**
+ * Other Misc output functions
+ */
+
+/*=======================================================================
+
+HIGH LEVEL FUNCTIONS
+
+=======================================================================*/
+
+// Build a numeric picklist
+
+function build_numeric_picklist( $fieldname, $starting, $ending, $selected="", $option="" )
+{
+    if( $starting > $ending )
+    return( "*** Picklist generation error: build_numeric_piclist() ***" );
+
+    $r = '<SELECT id="'.$fieldname.'" NAME="'.$fieldname.'">
+        ';
+
+    if( strstr( $option, 'blank') )
+    $r .= '<OPTION VALUE=""'.(trim($selected)==''?" SELECTED":"").'> </option>';
+
+    for( $i=$starting ; $i<=$ending ; $i++ ) {
+        $r .= '<OPTION VALUE="'.$i.'"'
+        .( $i==$selected ? " selected" : "" )
+        .'> '.$i.'</OPTION>
+        ';
+    }
+
+    $r .= '</SELECT>';
+
+    return( $r );
+
+}
+
+// Build a picklist
+
+function reg_build_picklist( $fieldname, $data, $selected, $type = "standard", $options = "" )
+{
+
+    if( !is_array($data) )
+    return( "<FONT COLOR=\"red\">ERROR: reg_build_picklist() data supplied is not an array for field $fieldname.</FONT>\n" );
+
+    // Set default option status
+
+    $option_blank = $option_order = $option_numeric = $option_descending = $option_multi = FALSE;
+
+    // Scan for supplied options
+
+    if( !empty($options) )
+    {
+        $opt_array = explode_trim( "~", $options );
+        foreach( $opt_array as $opt )
+        {
+            switch( $opt )
+            {
+                case "blank":
+                    $option_blank = TRUE;
+                    break;
+
+                case "numeric":
+                    $option_numeric = TRUE;
+                    $option_order = TRUE;
+                    break;
+
+                case "alpha":
+                    $option_numeric = FALSE;    // If it's not numeric, it's alpha
+                    $option_order = TRUE;
+                    break;
+
+                case "descending":
+                    $option_descending = TRUE;
+                    break;
+
+                case "ascending":
+                    $option_descending = FALSE;    // If it's not descending, it's ascending
+                    break;
+
+                case "multi":
+                    $option_multi = TRUE;    // Permit multiple select with CTRL or SHIFT
+                    break;
+
+                default:
+                    return( "<FONT COLOR=\"red\">Illegal reg_build_picklist() option</FONT>\n" );
+                    break;
+            }
+        }
+    }
+
+    if( $option_order )
+    {
+        if( $option_descending )
+        {            // Sort Descending
+            if( $option_numeric )
+            arsort( $data, SORT_NUMERIC );
+            else
+            arsort( $data, SORT_STRING );
+        }
+        else
+        {            // Sort Ascending
+            if( $option_numeric )
+            asort( $data, SORT_NUMERIC );
+            else
+            asort( $data, SORT_STRING );
+        }
+    }
+
+    if( $option_multi ) {
+        $str = '<SELECT id="'.$fieldname.'" NAME="'.$fieldname.'[]" MULTIPLE SIZE="4">';
+    } else {
+        $str = '<SELECT id="'.$fieldname.'" NAME="'.$fieldname.'">';
+    }
+
+    if( $option_blank ) {
+
+        // Check if blank is selected
+        $sel = false;
+        if( is_array($selected) )
+        {
+            reset( $selected );
+            foreach( $selected as $s ) {
+                if( $s == '' ) {
+                    $sel = TRUE;
+                }
+            }
+        }
+        $str .= "    <OPTION VALUE=\"\"".($sel?" SELECTED ":"").">&nbsp;</option>\n";
+    }
+
+    switch( $type )
+    {
+        case "simple":
+            for( $i=0 ; $i<count($data) ; $i++ )
+            {
+                if( $option_multi )
+                {
+                    $sel = FALSE;
+                    if( is_array($selected) )
+                    {
+                        reset( $selected );
+                        foreach( $selected as $s ) {
+                            if( $s != '' && $s === $data[$i] ) {
+                                $sel = TRUE;
+                            }
+                        }
+                    }
+                    $str .= "    <OPTION VALUE=\"".$data[$i]."\"".($sel?" SELECTED ":"").">".$data[$i]."</option>\n";
+                } else {
+                    $str .= "    <OPTION VALUE=\"".$data[$i]."\"".($data[$i]==$selected?" SELECTED ":"").">".$data[$i]."</option>\n";
+                }
+            }
+            break;
+
+        case "standard":
+        default:
+            while( list($key, $val) = each($data) ) {
+                   if( $option_multi ) {
+                    $sel = FALSE;
+
+                    if( is_array($selected) ) {
+                        reset( $selected );
+                        foreach( $selected as $s ) {
+                            if( $s != '' && $s == $key ) {
+                                $sel = TRUE;
+                            }
+                        }
+                    }
+                    $str .= "    <OPTION VALUE=\"$key\"".($sel?" SELECTED ":"").">$val</option>\n";
+                } else {
+                    $str .= "    <OPTION VALUE=\"$key\"".($key==$selected?" SELECTED ":"").">$val</option>\n";
+                }
+            }
+            break;
+    }
+    $str .= "</SELECT>";
+
+    return( $str );
+
+}
+
+// Build Radio Buttons
+
+function build_radio_buttons( $fieldname, $data, $selected, $separator = "&nbsp;&nbsp;", $type = "standard", $options = "" )
+{
+
+    // if $data is neither proper array or data string
+
+    if( !is_array($data) )
+    if( ($data = strtoarray($data)) == FALSE )
+    return( "<FONT COLOR=\"red\">ERROR: build_radio_buttons() Improper data supplied for field \"$fieldname\".</FONT>\n" );
+
+    // Set default option status
+
+    $option_blank = $option_order = $option_numeric = $option_descending = $option_after = FALSE;
+
+    // Scan for supplied options
+
+    if( !empty($options) )
+    {
+        $opt_array = explode_trim( "~", $options );
+        foreach( $opt_array as $opt )
+        {
+            switch( $opt )
+            {
+                case 'numeric':
+                    $option_numeric = TRUE;
+                    $option_order = TRUE;
+                    break;
+
+                case 'alpha':
+                    $option_numeric = FALSE;    // If it's not numeric, it's alpha
+                    $option_order = TRUE;
+                    break;
+
+                case 'descending':
+                    $option_descending = TRUE;
+                    break;
+
+                case 'ascending':
+                    $option_descending = FALSE;    // If it's not descending, it's ascending
+                    break;
+
+                case 'after':
+                    $option_after = TRUE;
+                    break;
+
+                default:
+                    //                    return( "<FONT COLOR=\"red\">ERROR: build_radio_buttons() Illegal option \"$opt\".</FONT>\n" );
+                    break;
+            }
+        }
+    }
+
+    if( $option_order )
+    {
+        if( $option_descending )
+        {            // Sort Descending
+            if( $option_numeric )
+            arsort( $data, SORT_NUMERIC );
+            else
+            arsort( $data, SORT_STRING );
+        }
+        else
+        {            // Sort Ascending
+            if( $option_numeric )
+            asort( $data, SORT_NUMERIC );
+            else
+            asort( $data, SORT_STRING );
+        }
+    }
+
+    $str = $sep = '';
+    while( list($key, $val) = each($data) )
+    {
+        $str .= $sep;
+
+        if( !$after )
+        $str .= $val.' ';
+
+        switch( $type )
+        {
+            case "simple":
+                $str .= '<INPUT TYPE="radio" NAME="'.$fieldname.'" VALUE="'.$val.'" '.($val==$selected?" CHECKED ":"").'>';
+                break;
+            case "standard":
+                $str .= '<INPUT TYPE="radio" NAME="'.$fieldname.'" VALUE="'.$key.'" '.($key==$selected?" CHECKED ":"").'>';
+                break;
+            default:
+                break;
+        }
+
+        if( $after )
+        $str .= ' '.$val;
+
+        $sep = $separator;
+    }
+    return( $str );
+}
+
+
+    // Create a date input form with a link to a pop-up calendar
+
+function calendar_date_select( $default_value, $selected_date, $start_date,
+$end_date, $form_name, $field_name, $options = "",
+$no_earlier = "" )
+{
+
+    GLOBAL    $si_month_array;
+
+    $months = array( 1=>"Jan",2=>"Feb",3=>"Mar",4=>"Apr",5=>"May",6=>"Jun",7=>"Jul",8=>"Aug",9=>"Sep",10=>"Oct",11=>"Nov",12=>"Dec" );
+
+    $start = getdate( $start_date );
+    $end   = getdate( $end_date );
+
+    $form = "<script language=\"JavaScript1.2\">
+            <!--
+                // Detect if the browser is IE or not.
+                // If it is not IE, we assume that the browser is NS.
+
+            var IE = document.all?true:false
+
+                // If NS -- that is, !IE -- then set up for mouse capture
+
+//            if (!IE) document.captureEvents(Event.MOUSEMOVE)
+
+                // Set-up to use getMouseXY function onMouseMove
+
+//            document.onmousemove = getMouseXY;
+
+                // Temporary variables to hold mouse x-y pos.s
+
+            var tempX = 0
+            var tempY = 0
+
+                // Main function to retrieve mouse x-y pos.s
+
+            function getMouseXY(e)
+                {
+                if (IE)
+                    { // grab the x-y pos.s if browser is IE
+                    tempX = event.clientX //+ document.body.scrollLeft
+                    tempY = event.clientY //+ document.body.scrollTop
+                    }
+                    else
+                        {  // grab the x-y pos.s if browser is NS
+                    tempX = e.pageX
+                    tempY = e.pageY
+                        }
+
+                    // catch possible negative values in NS4
+
+                if (tempX < 0){tempX = 0}
+                if (tempY < 0){tempY = 0}
+
+                    // show the position values in the form named Show
+                    // in the text fields named MouseX and MouseY
+                    //  document.Show.MouseX.value = tempX
+                    //  document.Show.MouseY.value = tempY
+
+                    return true;
+                }
+
+            function calWin_".$field_name."()
+                {
+                    // Pass values to the calendar
+
+                tempX = 400
+                tempY = 300
+        ";
+    if( preg_match( "/PICK/", $options ) )
+    $form .= "    sd = this.document.$form_name.".$field_name."_month.value + '/' + this.document.$form_name.".$field_name."_day.value + '/' + this.document.$form_name.".$field_name."_year.value;
+                ";
+    else
+    $form .= "  sd = this.document.$form_name.$field_name.value;
+                ";
+
+//    $form .= "    var theUrl='".BASE_APP_URL."Common/Registrations_V3/front-end/calendar.phtml?selected_date=' + sd + '&start_date=$start_date&end_date=$end_date&form_name=$form_name&field_name=$field_name';
+//        ";
+    $form .= "    var theUrl='".BASE_URL."admin/Registrations/index.php?route_app=calendar_popup&selected_date=' + sd + '&start_date=$start_date&end_date=$end_date&form_name=$form_name&field_name=$field_name';
+    ";
+
+    // If a "no_earlier" field is specified, have the script check for a date from other specified field and pass it in the URL
+
+    if( $no_earlier != "" )
+    $form .= "
+                theUrl = theUrl + '&no_earlier=' + this.document.$form_name.$no_earlier.value
+            ";
+    $form .= "
+                        tempX = tempX - 90;
+                        //tempY = tempY - 170;
+
+                        if (navigator.appName == 'Netscape')
+                    {
+                            calWind = window.open (theUrl, 'Calendar','scrollbars=no,toolbar=no,resizable=no,width=170,height=180,screenx=' + tempX +',screeny=' + tempY,1);
+                            }
+                    else
+                        {
+                            calWind = window.open (theUrl, 'Calendar','scrollbars=no,toolbar=no,resizable=no,width=170,height=180, top=' + tempY +', left=' + tempX,1);
+                            }
+
+                calWind.focus();
+                }
+            -->
+        </script>
+        ";
+
+    // Handle default date whether it's a string date or a timestamp
+
+    if( is_numeric($default_value) )
+    {
+        $default_timestamp = $default_value;
+        $default_value = date( 'n/j/Y', $default_value );
+    }
+    else
+    $default_timestamp = strtotime( $default_value );
+
+    $default_month = date( "n", $default_timestamp );
+    $default_day = date( "j", $default_timestamp );
+    $default_year = date( "Y", $default_timestamp );
+
+    if( preg_match( "/PICK/", $options ) )
+    {
+        $form .= reg_build_picklist( $field_name."_month", $months, $default_month );
+        $form .= build_numeric_picklist( $field_name."_day", 1, 31, $default_day );
+        if( preg_match( "/HIDE_YEAR/", $options ) )
+        $form .= '<INPUT TYPE="hidden" NAME="'.$field_name.'_year" VALUE="'.$default_year.'">';
+        else
+        $form .= build_numeric_picklist( $field_name."_year", date("Y"), date("Y",$end_date), $default_year );
+        $form .= '<INPUT TYPE="hidden" NAME="'.$field_name.'">';
+    }
+    else
+    $form .= '<INPUT TYPE="text" NAME="'.$field_name.'" SIZE="10" VALUE="'.$default_value.'">';
+
+    if( !preg_match( "/NO_PROMPT/", $options ) )
+    $form .= " (month/day/year) ";
+    $form .= '<SCRIPT LANGUAGE="javascript">
+                <!--
+                document.write(\'<a href="javascript:calWin_'.$field_name.'()\"><IMG SRC="'.BASE_APP_URL.'Common/Registrations_V3/assets/calendar.png" BORDER="0" ALT="Calendar"></A>\');
+                -->
+            </SCRIPT>
+        ';
+
+    return($form);
+}
+
+// Build an HTML calendar with data from the array in each date
+
+function calendar_display( $month, $year, $date_data, $headerinfo='', $monthinfo='' )
+{
+    $MonthNames = array(1=>'January','February','March','April','May','June','July','August','September','October','November','December');
+
+    /* This seems to be unnecessary
+
+    $calendar ='<script language="javascript">
+    <!--
+    function winMsger(msg)
+    {
+    calWind = window.open (\'\', \'Calendar\',\'scrollbars=no,toolbar=no,resizable=no,width=230,height=230\',1);
+    calWind.document.write("<HTML><TITLE>Calendar</TITLE></HTML>")
+    calWind.document.write("<body bgcolor=\'#FFFFFF\' leftmargin=\'0\' topmargin=\'0\' marginwidth=\'0\' marginheight=\'0\'>")
+    calWind.document.write(msg)
+    calWind.document.write("</BODY></HTML>")
+
+    calWind.focus()
+    }
+    -->
+    </script>
+    */
+
+    $calendar = '
+        <STYLE TYPE="text/css">
+            <!--
+            th {   font-size: 12px; background-color: '. SI_CAL_DATE.'; font-weight: bold; }
+            td.h { font-size: 12px; background-color: '. SI_CAL_HEAD.'; }
+            td.n { font-size: 12px; background-color: '. SI_CAL_NODATE.'; }
+            td.d { font-size: 12px; background-color: '. SI_CAL_TODAY.'; }
+//            td.t { font-size: 12px; background-color: '. SI_CAL_DATE .'; }
+            td.t { font-size: 12px; }
+                td.z { font-size: 16px; background-color: '. SI_CAL_TABLE .'; }
+            td.f {}
+            //-->
+        </STYLE>
+
+        <TABLE BORDER="1" CELLPADDING="1" CELLSPACING="0" ALIGN="center" BGCOLOR="'. SI_CAL_TABLE.'" WIDTH="98%" HEIGHT="40%">
+            <TR HEIGHT="20">
+                <TD CLASS="z" COLSPAN="7" ALIGN="center"><B>'.(empty($monthinfo)?$MonthNames[$month].' '.$year:$monthinfo).'</B><br>
+                    </TD>
+            </TR>
+            ';
+
+    if( !empty($headerinfo) )
+    {
+        $calendar.= '<TR><TD COLSPAN="7">'.$headerinfo.'
+                </TD></TR>
+                ';
+    }
+
+    $calendar.='<TR ALIGN="center" HEIGHT="15">
+            <TH CLASS="h" width="14%">Sun</TH>
+            <TH CLASS="h" width="14%">Mon</TH>
+            <TH CLASS="h" width="14%">Tue</TH>
+            <TH CLASS="h" width="14%">Wed</TH>
+            <TH CLASS="h" width="14%">Thu</TH>
+            <TH CLASS="h" width="14%">Fri</TH>
+            <TH CLASS="h" width="14%">Sat</TH>
+        </TR>
+        <TR ALIGN="left">
+            ';
+
+    // Display blanks up to first day of the month
+
+    $offset = date( "w", mktime( 0, 0, 0, $month, 1, $year )  );
+    if( $offset > 0 )
+    $calendar .= str_repeat( "<TD CLASS=\"n\">&nbsp;</TD>\n",$offset );
+
+    // For each day of the month
+
+    $NumberOfDays = date( "t", mktime( 0, 0, 0, $month, 1, $year ) );
+    for( $i=1 ; $i<=$NumberOfDays ; $i++ )
+    {
+        $this_date = mktime( 0, 0, 0, $month, $i, $year );
+        $DayOfWeek = date( "w", $this_date );
+
+        // Start a new row each Sunday, unless it's the 1st of the month
+
+        if( $DayOfWeek == 0 && $i != 1 )
+        {
+            $calendar .= '</TR><TR>';
+        }
+
+        if( !empty($date_data[$i]["color"]) )
+        $color = $date_data[$i]["color"];
+        else
+        $color = SI_CAL_DATE;
+
+        $calendar .= '<TD CLASS="t" ALIGN="left" VALIGN="top" BGCOLOR="'.$color.'">';
+
+        if( !empty($date_data[$i]["link"]) )
+        $calendar .= '<A HREF="'.$date_data[$i]["link"].'">'.$i.'</A>';
+        else
+        $calendar .= $i;
+
+        $calendar .= '<BR>';
+
+        if( !empty($date_data[$i]["cell"]) )
+        $calendar .= $date_data[$i]["cell"];
+
+        $calendar .= "</TD>\n";
+    }
+
+
+    if( ( ($offset == 5) && ($NumberOfDays > 30) ) || ( ($offset == 6) && ($NumberOfDays > 29) ) )
+    {
+        if( 42-$NumberOfDays-$offset > 0 )
+        {
+            $calendar .= str_repeat( "<TD CLASS=\"n\">&nbsp;</TD>\n",42-$NumberOfDays-$offset );
+        }
+        $calendar .= "</TR>\n";
+    }
+    elseif( ($NumberOfDays != 28) || ($offset > 0) )
+    {
+        if (35-$NumberOfDays-$offset > 0)
+        {
+            $calendar .= str_repeat("<TD CLASS=\"n\">&nbsp;</TD>\n",35-$NumberOfDays-$offset);
+            $calendar .= "</TR>\n";
+        }
+    }
+
+    $calendar .= "</TABLE>\n";
+    return $calendar;
+}
+
+
+
+
+/**
+ * Admin Menus
+ */
+
+// Select field data from an array based on which function it will be used for
+// returning a string suitable for the admin_ functions
+
+function admin_field_select( $fields, $filter )
+{
+
+    $r = '';
+    $sep = '';
+
+    if( ! is_array($fields) || trim($filter) == '' )
+    {
+        echo "<P>ERROR: admin_field_select() - No Field or Filter data supplied!<P>";
+        return( FALSE );
+    }
+
+    foreach( $fields as $f )
+    {
+        $x = explode( ',', $f );
+        if( strstr( $x[5], $filter ) ) {
+            if( $filter == 'f' ) {   // List filters require slight difference in fields
+                $r .= $sep.$x[0].','.$x[1].','.$x[2].','.$x[4];
+            } else {
+                $r .= $sep.$x[0].','.$x[1].','.$x[2].','.$x[3].','.$x[4];
+            }
+            $sep = '|';
+        }
+    }
+
+    return( $r );
+}
+
+// Select field data from an array based on which function it will be used for
+// returning an array of arrays of data.
+
+function admin_fields_select_array( $fields, $filter )
+{
+
+    $r = array();
+
+    if( ! is_array($fields) || trim($filter) == '' )
+    {
+        echo "<P>ERROR: admin_field_select_array() - No Field or Filter data supplied!<P>";
+        return( FALSE );
+    }
+
+    while( list($key, $val) = each($fields) )
+    {
+        $x = explode( ',', $val );
+        if( strstr( $x[5], $filter ) )
+        {
+            $r[$key]['name'] = trim($x[0]);
+            $y = explode( '.', trim($x[1]) );
+            foreach( $y as $z )
+            $r[$key]['type'][] = trim($z);
+            $r[$key]['title'] = trim($x[2]);
+            $r[$key]['required'] = trim($x[3]);
+            $r[$key]['variable'] = trim($x[4]);
+            $r[$key]['sample'] = trim($x[6]);
+        }
+    }
+
+    return( $r );
+}
+
+// Generate standard admin low-level menu
+
+// New version using standard HTML (<div>'s) for admin sections
+function admin_menu_std( $action, $a_title, $id, $opt, $options = 'lveda', $add_menu = '', $params = '' )
+{
+
+    $m = '';
+    $nl = "\n";
+
+    //    if( $a_title != '' )
+    //        $m .= '<span class="submenu_title">'.$a_title.':</span>';
+
+    $link = THIS_SCRIPT.'?Action='.urlencode($action);
+    if( trim($params) != '' )
+    $link .= '&'.$params;
+
+    if( strstr($options,'l') )
+    {
+        if( $opt == "List" )
+        $m .= '<li class="active">[List]</li>'.$nl;
+        else
+        $m .= '<li class="inactive" id="current"><a href="'.$link.'&Option=List">[List]</A></li>'.$nl;
+    }
+
+    if( strstr($options,'v') )
+    {
+        if( $opt == "View" )
+        $m .= '<li class="active">[View]</li>'.$nl;
+        elseif( empty($id) )
+        $m .= '<li class="unavailable">[View]</li>'.$nl;
+        else
+        $m .= '<li class="inactive"><a href="'.$link.'&Option=View&id='.$id.'">[View]</a></li>'.$nl;
+    }
+
+    if( strstr($options,'e') )
+    {
+        if( $opt == "Edit" )
+        $m .= '<li class="active">[Edit]</li>'.$nl;
+        elseif( empty($id) )
+        $m .= '<li class="unavailable">[Edit]</li>'.$nl;
+        else
+        $m .= '<li class="inactive"><a href="'.$link.'&Option=Edit&id='.$id.'">[Edit]</A></li>'.$nl;
+    }
+
+    if( strstr($options,'d') )
+    {
+        if( $opt == "Delete" )
+        $m .= '<li class="active">[Delete]<</li>'.$nl;
+        elseif( empty($id) )
+        $m .= '<li class="unavailable">[Delete]</li>'.$nl;
+        else
+        $m .= '<li class="inactive"><a href="'.$link.'&Option=Delete&id='.$id.'">[Delete]</a></li>'.$nl;
+    }
+
+    if( strstr($options,'a') )
+    {
+        if( $opt == "Add" )
+        $m .= '<li class="active">[Add]</li>'.$nl;
+        else
+        $m .= '<li class="inactive"><a href="'.$link.'&Option=Add">[Add]</A></li>'.$nl;
+    }
+
+    if( $add_menu != '' )
+    $m .= " - $add_menu".$nl;
+
+    return( $m );
+}
+// Standard version
+function admin_menu( $action, $a_title, $id, $opt, $options = 'lveda', $add_menu = '', $params = '' )
+{
+
+    $m = '<SPAN CLASS="menu_title">'.$a_title.':</SPAN>&nbsp;</B>';
+
+    $link = THIS_SCRIPT.'?Action='.urlencode($action);
+    if( trim($params) != '' )
+    $link .= '&'.$params;
+
+    if( strstr($options,'l') )
+    {
+        if( $opt == "List" )
+        $m .= '<SPAN CLASS="menu_active">[List]</SPAN>&nbsp;';
+        else
+        $m .= '<A HREF="'.$link.'&Option=List">[List]</A>&nbsp;';
+    }
+
+    if( strstr($options,'v') )
+    {
+        if( $opt == "View" )
+        $m .= '<SPAN CLASS="menu_active">[View]</SPAN>&nbsp;';
+        elseif( empty($id) )
+        $m .= '[View]&nbsp;';
+        else
+        $m .= '<A HREF="'.$link.'&Option=View&id='.$id.'">[View]</A>&nbsp;';
+    }
+
+    if( strstr($options,'e') )
+    {
+        if( $opt == "Edit" )
+        $m .= '<SPAN CLASS="menu_active">[Edit]</SPAN>&nbsp;';
+        elseif( empty($id) )
+        $m .= '[Edit]&nbsp;';
+        else
+        $m .= '<A HREF="'.$link.'&Option=Edit&id='.$id.'">[Edit]</A>&nbsp;';
+    }
+
+    if( strstr($options,'d') )
+    {
+        if( $opt == "Delete" )
+        $m .= '<SPAN CLASS="menu_active">[Delete]</SPAN>&nbsp;';
+        elseif( empty($id) )
+        $m .= '[Delete]&nbsp;';
+        else
+        $m .= '<A HREF="'.$link.'&Option=Delete&id='.$id.'">[Delete]</A>&nbsp;';
+    }
+
+    if( strstr($options,'a') )
+    {
+        if( $opt == "Add" )
+        $m .= '<SPAN CLASS="menu_active">[Add]</SPAN>&nbsp;';
+        else
+        $m .= '<A HREF="'.$link.'&Option=Add">[Add]</A>&nbsp;';
+    }
+
+    if( $add_menu != '' )
+    $m .= " - $add_menu";
+
+    return( $m );
+}
+
+
+/***********************************************************************
+ *                                                                      *
+ *      Support funtions for High Level Admin Functions                 *
+ *                                                                       *
+ ***********************************************************************/
+
+
+// Explode a string into pieces and trims whitespace from ends of each piece.
+
+function explode_trim( $separator, $string )
+{
+
+    $a = explode( $separator, $string );
+
+    foreach( $a as $key => $data )
+    $a[$key] = trim($data);
+
+    return( $a );
+
+}
+
+
+/***********************************************************************
+ *                                                                      *
+ *                   High Level Admin Functions                         *
+ *                                                                       *
+ ***********************************************************************/
+
+// The "JFDI" function - Fully process a data table
+
+function admin_process_records_r( $table, $where, $order, $conn_str, $id, $fields,
+$options, $rows, $url, $action, $params, $a_title, $view, $Option, $start, $other_options = '', $a_title_view = '', $quick_tip = '', $id_field = '' )
+{
+    $a_title_view = preg_replace( "/\\{action\\}/", $Option, $a_title_view );
+
+    switch( $Option )
+    {
+
+        case "Add":
+
+            return( admin_new_record_r
+            (
+            $table,
+            $conn_str,
+            admin_field_select( $fields, 'n' ),
+            $url,
+            $action,
+            $params,
+            (empty($a_title_view)?"<P><SPAN CLASS=\"title1\">New $a_title</SPAN><P>":$a_title_view),
+            $view['Add'],
+            $other_options,
+            $quick_tip,
+            $id_field
+            )
+            );
+
+            break;
+
+        case "Add New":
+
+            $r = admin_add_new_record_r
+            (
+            $table,
+            $conn_str,
+            admin_field_select( $fields, 'a' ),
+            $url,
+            $action,
+            $params,
+            (empty($a_title_view)?"<P><SPAN CLASS=\"title1\">Add New $a_title</SPAN><P>":$a_title_view),
+            $view['Add New'],
+            $quick_tip,
+            $id_field
+            );
+
+            // If successfull see if we can get the new record ID and view it
+            /* Don't do this right now...
+            *
+            if( $r['status'] )
+            {
+            // On success Add New returns the OID of the new record - get ID for next call
+
+            if( ($d = db_auto_get_row( "SELECT id FROM $table WHERE oid = ".$r['status'].";" )) )
+            $id = $d['id'];
+            else
+            return( $r );        // If we can't get ID then just give up and return
+
+            // If all is OK, then call again to do a View
+
+            $r = admin_process_records_r( $table, $where, $order, $conn_str, $id, $fields, $options, $rows, $url, $action, $params, $a_title, $view, 'View', $start, $other_options, $a_title_view, $quick_tip );
+            }
+            */
+
+            return( $r );
+
+            break;
+
+        case "Edit":
+
+            return( admin_edit_record_r
+            (
+            $table,
+            $conn_str,
+            $id,
+            admin_field_select( $fields, 'e' ),
+            $url,
+            $action,
+            $params,
+            (empty($a_title_view)?"<P><SPAN CLASS=\"title1\">Edit $a_title</SPAN><P>":$a_title_view),
+            $view['Edit'],
+            $other_options,
+            $quick_tip,
+            $id_field
+            )
+            );
+
+            break;
+
+        case "Update":
+
+            $r = admin_update_record_r
+            (
+            $table,
+            $conn_str,
+            $id,
+            admin_field_select( $fields, 'u' ),
+            $url,
+            $action,
+            $params,
+            (empty($a_title_view)?"<P><SPAN CLASS=\"title1\">Update $a_title</SPAN><P>":$a_title_view),
+            $view['Update'],
+            $quick_tip,
+            $id_field
+            );
+
+            // If successful update then call again to do a View of the updated record
+
+            if( $r['status'] )
+            return( admin_process_records_r( $table, $where, $order, $conn_str, $id, $fields, $options, $rows, $url, $action, $params, $a_title, $view, 'View', $start, $other_options, $a_title_view, $quick_tip, $id_field ) );
+
+            return( $r );
+
+            break;
+
+        case "Delete":
+
+            return( admin_delete_record_r
+            (
+            $table,
+            $conn_str,
+            $id,
+            admin_field_select( $fields, 'd' ),
+            $options,
+            $url,
+            $action,
+            $params,
+            (empty($a_title_view)?"<P><SPAN CLASS=\"title1\">Delete $a_title</SPAN><P>":$a_title_view),
+            $view['Delete'],
+            $quick_tip,
+            $id_field
+            )
+            );
+
+            break;
+
+        case "Confirm Delete":
+
+            $r = admin_confirm_delete_record_r
+            (
+            $table,
+            $conn_str,
+            $id,
+            admin_field_select( $fields, 'c' ),
+            $url,
+            $action,
+            $params,
+            (empty($a_title_view)?"<P><SPAN CLASS=\"title1\">Confirm Delete $a_title</SPAN><P>":$a_title_view),
+            $view['Confirm Delete'],
+            $quick_tip,
+            $id_field
+            );
+
+            // If successful delete then call again to do a List
+
+            if( $r['status'] )
+            return( admin_process_records_r( $table, $where, $order, $conn_str, $id, $fields, $options, $rows, $url, $action, $params, $a_title, $view, 'List', $start, $other_options, $a_title_view, $quick_tip ) );
+
+            return( $r );
+
+            break;
+
+        case "View":
+
+            return( admin_view_record_r
+            (
+            $table,
+            $conn_str,
+            $id,
+            admin_field_select( $fields, 'v' ),
+            $url,
+            $action,
+            $params,
+            (empty($a_title_view)?"<P><SPAN CLASS=\"title1\">View $a_title</SPAN><P>":$a_title_view),
+            $view['View'],
+            $other_options,
+            $quick_tip,
+            $id_field
+            )
+            );
+
+            break;
+
+        default:
+
+            return( admin_list_records_r
+            (
+            $table,
+            $where,
+            $order,
+            $conn_str,
+            admin_field_select( $fields, 'l' ),
+            $options,
+            FALSE,
+            $rows,
+            $start,
+            $url,
+            $action,
+            $params,
+            admin_field_select( $fields, 'f' ),
+            (empty($a_title_view)?"<P><SPAN CLASS=\"title1\">List $a_title</SPAN><P>":$a_title_view),
+            $view['List'],
+            $id_field,
+            $quick_tip
+            )
+            );
+
+            break;
+
+    } // switch( $Option )
+
+}
+
+function admin_process_records( $table, $where, $order, $conn_str, $id, $fields,
+$options, $rows, $url, $action, $params, $a_title, $view, $Option, $start, $other_options = '', $a_title_view = '', $quick_tip = '' )
+{
+    $r = admin_process_records_r( $table, $where, $order, $conn_str, $id, $fields,
+    $options, $rows, $url, $action, $params, $a_title, $view, $Option, $start, $other_options, $a_title_view, $quick_tip );
+    echo $r['text'];
+    return( $r['status'] );
+}
+
+
+// List records from a table
+
+function admin_list_records_r( $table, $where, $order, $conn_str, $fields,
+$options, $fail_mode, $rows = 20, $start = 0,
+$url, $action, $params, $filters, $a_title, $view = "", $id_field = "", $quick_tip = '' )
+{
+
+    $ret = '';
+
+    // Make all submitted parameters available
+
+    //    extract($GLOBALS[HTTP_GET_VARS]);
+    //    extract($GLOBALS[HTTP_POST_VARS]);
+
+    // Make sure we have something rational for rows and start
+
+    if( $rows == '' ) $rows = 20;
+    if( $start == '' ) $start = 0;
+
+    // Break out configuration data
+
+    $field_table = explode_trim( "|", $fields );
+
+    // Don't be surprised if last field is blank
+
+    if( trim($field_table[count($field_table)-1]) == "" )
+    array_pop( $field_table );
+
+    foreach( $field_table as $key => $r )
+    {
+        $field_table[$key] = explode_trim( ",", $r );
+        $hidden[$key] = preg_match( "/HIDDEN/", $field_table[$key][3] );
+    }
+
+    $operation_column = $option_new = $option_view = $option_edit = $option_delete = $option_duplicate = $option_filter = $option_nopaging = $option_noborder = $option_sortlinks = FALSE;
+
+    if( ! empty($options) )
+    {
+        $option_table = explode_trim( ",", $options );
+        foreach( $option_table as $option )
+        {
+            switch( $option )
+            {
+                case "new":
+                    $option_new = TRUE;
+                    break;
+
+                case "view":
+                    $option_view = TRUE;
+                    $operation_column = TRUE;
+                    break;
+
+                case "edit":
+                    $option_edit = TRUE;
+                    $operation_column = TRUE;
+                    break;
+
+                case "delete":
+                    $option_delete = TRUE;
+                    $operation_column = TRUE;
+                    break;
+
+                case "duplicate":
+                    $option_duplicate = TRUE;
+                    $operation_column = TRUE;
+                    break;
+
+                case "filter":
+                    $option_filter = TRUE;
+                    break;
+
+                case "sortlinks":
+                    $option_sortlinks = TRUE;
+                    break;
+
+                case "nopaging":
+                    $option_nopaging = TRUE;
+                    break;
+
+                case "noborder":
+                    $option_noborder = TRUE;
+                    break;
+
+                default:
+                    //                    $ret .=  '<H2><FONT COLOR="red">ERROR: Illegal Option Specified: -'.$option.'-</FONT></H2>';
+                    break;
+            }
+        }
+    }
+
+    // Check for additional parameters that are passed
+
+    $link_params = $form_params = "";
+    if( !empty($params) ) {
+        $param = explode_trim( "|", $params );    // Separate parameters
+        foreach( $param as $p ) {
+            $x = explode_trim( ".", $p );    // Separate Names from Values
+            $link_params .= "&".$x[0]."=".urlencode($x[1]);
+            $form_params .= '<INPUT TYPE="hidden" NAME="'.$x[0].'" VALUE="'.$x[1].'">';
+        }
+    }
+
+    // Check if a column label has been clicked to cause a sort of that column
+    $sortclicked_new = filter_request('sortclicked_new');
+    $list_sort_direction = filter_request('list_sort_direction');
+    $sortclicked = filter_request('sortclicked');
+
+    if( !empty($sortclicked_new) ) {
+        // Clicking the same column title toggles between ascending and descending sort
+        if( $list_sort_direction == 'Forward'  ) {
+            $list_sort_direction = "Backward";
+        } else {
+            $list_sort_direction = 'Forward';
+        }
+
+        $sortclicked = $sortclicked_new;
+        $link_params .= '&sortclicked='.$sortclicked."&list_sort_direction=$list_sort_direction";
+        $form_params .= '<INPUT TYPE="hidden" NAME="sortclicked" VALUE="'.$sortclicked.'">';
+        $form_params .= '<INPUT TYPE="hidden" NAME="list_sort_direction" VALUE="'.$list_sort_direction.'">';
+    } elseif( !empty($sortclicked) ) {
+        $sortclicked = $sortclicked;
+        $list_sort_direction = $list_sort_direction;
+        $link_params .= '&sortclicked='.$sortclicked."&list_sort_direction=$list_sort_direction";
+        $form_params .= '<INPUT TYPE="hidden" NAME="sortclicked" VALUE="'.$sortclicked.'">';
+        $form_params .= '<INPUT TYPE="hidden" NAME="list_sort_direction" VALUE="'.$list_sort_direction.'">';
+    }
+
+    // Display optional filter search fields and build query string
+
+    $qs = empty($where) ? "WHERE TRUE " : "WHERE ".$where ;
+
+    if ($option_filter) {
+        $filter_out = '
+            <FORM ACTION="'.$url.'">
+                <INPUT TYPE="hidden" NAME="Option" VALUE="List">
+                <B>Select items to list</B><BR>
+                <TABLE BORDER="0">
+            ';
+
+        $filter_link = "";                    // Added to link to pass on filter data
+        $filter = explode_trim( "|", $filters );
+        foreach( $filter as $filter_field )
+        {
+            $f = explode_trim( ",", $filter_field );    // Split field specs
+            $ft = explode_trim( "~", $f[2] );            // Separate QuickTips from titles
+            $w = explode_trim( "`", $f[1] );            // Separate out any format spec
+            $x = explode_trim( ".", $w[0] );            // Split type specs
+            $option = $x[1]!="" ? $x[1] : "none" ;
+            $filter_value = filter_request($f[3]);
+
+            // Display Filter Title - With QuickTip if specified
+
+            if (count($ft) > 1) {
+                $filter_out .= '<TR><TH ALIGN="right" VALIGN="top">'.quick_tip( $ft[0], $ft[1] ).'</TH><TD ALIGN="left">';
+            } else {
+                $filter_out .= '<TR><TH ALIGN="right" VALIGN="top">'.$ft[0].'</TH><TD ALIGN="left">';
+            }
+
+            // Add any filter value to $filter_link
+            $fvc = 0;
+            if (is_array($_REQUEST[$f[3]]) || !empty($filter_value)) {
+                if( is_array($_REQUEST[$f[3]]) )
+                {
+                    $req = $_REQUEST[$f[3]];
+                    foreach( $req as $fv ) {
+                        $filter_link .= "&".$f[0]."[$fvc]=".$fv;
+                        $fvc++;
+                    }
+                } else {
+                    $filter_link .= "&".$f[0]."=".$filter_value;
+                }
+            }
+
+            // Display filter field
+
+            switch( $x[0] )                // Handle different field types
+            {
+                case "url":
+                case "text":
+                case "textbox":
+                case "inet":
+                    $filter_out .= '<INPUT TYPE="text" NAME="'.$f[0].'" VALUE="'.$filter_value.'">';
+                    if( !empty($filter_value) )        // If a value is passed, add to query
+                    switch( $option )
+                    {
+                        case "like":
+                            $qs .= " AND ".$f[0]." LIKE '%".$filter_value."%'";
+                            break;
+                        case "begin":
+                            $qs .= " AND ".$f[0]." ~* '^".$filter_value."'";
+                            break;
+                        case "any":
+                        default:
+                            $qs .= " AND ".$f[0]." ~* '".$filter_value."'";
+                            break;
+                    }
+                    break;
+
+                case "state":
+                    $filter_out .= reg_build_picklist( $f[0], $GLOBALS['si_states_array'], $filter_value, 'standard', 'blank' );
+                    if( $filter_value != '' )
+                    $qs .= ' AND '.$f[0]." = '".$filter_value."'";
+                    break;
+
+                case "country":
+                    $filter_out .= reg_build_picklist( $f[0], $GLOBALS['si_countries_array'], $filter_value, 'standard', 'blank' );
+                    if( $filter_value != '' )
+                    $qs .= ' AND '.$f[0]." = '".$filter_value."'";
+                    break;
+
+                case "date":
+                    $filter_out .= '<INPUT TYPE="text" NAME="'.$f[0].'" VALUE="'.$filter_value.'">';
+                    if( !empty($filter_value) )        // If a value is passed, add to query
+                    switch( $option )
+                    {
+                        default:        // Options are not used for date at this time
+                            $qs .= " AND ".$f[0]." = '".$filter_value."'";
+                            break;
+                    }
+                    break;
+
+                case "daterange":
+                    // Clean up dates
+                    $filter_date_from = trim(filter_request($f[3].'_FROM'));
+                    $filter_date_to = trim(filter_request($f[3].'_TO'));
+                    if ($filter_date_from != '') {
+                        $filter_date_from = date('m/d/Y', strtotime($filter_date_from));
+                    }
+                    if ($filter_date_to != '') {
+                        $filter_date_to = date('m/d/Y', strtotime($filter_date_to));
+                    }
+
+                    $filter_out .= 'From <INPUT TYPE="text" NAME="'.$f[0].'_FROM" VALUE="'.$filter_date_from.'"> To <INPUT TYPE="text" NAME="'.$f[0].'_TO" VALUE="'.$filter_date_to.'">';
+                    // If Dates are not valid
+                    if (($filter_date_from != '' && strtotime($filter_date_from) === -1)  ||
+                        ($filter_date_to != '' && strtotime($filter_date_to) === -1 ) ) {
+                        $filter_out .= '<BR>(<FONT COLOR="red">Note:</FONT> Invalid date specified)';
+                        break;
+                    }
+                    else
+                    {
+                        // If we have both dates of a range
+                        if( !empty($filter_date_from) && !empty($filter_date_to) ) {
+                            $qs .= " AND ".$f[0]." BETWEEN '".$filter_date_from."' AND '".$filter_date_to."'";
+                        // Otherwise check if there's only one date submitted
+                        } elseif( !empty($filter_date_from) || !empty($filter_date_to) ) {
+                            $filter_out .= '<BR>(<FONT COLOR="red">Note:</FONT> both From and To required to specify date range)';
+                        }
+                    }
+                    break;
+
+                case "order":
+                case "int":
+                case "float":
+                case "fixed":
+                    $filter_out .= '<INPUT TYPE="text" NAME="'.$f[0].'" VALUE="'.$filter_value.'">
+                        ';
+                    if( !empty($filter_value) )    // Note: No filter options on type "int"
+                    $qs .= " AND ".$f[0]." = ".$filter_value."";
+                    break;
+
+                case "checkbox":
+                    if( empty($filter_value) )
+                    $x = 1;
+                    else
+                    $x = $filter_value;
+                    $filter_out .= '
+                            <SELECT NAME="'.$f[0].'">
+                                <OPTION VALUE="1" '.($x==1?"SELECTED":"").'>Don\'t care</option>
+                                <OPTION VALUE="2" '.($x==2?"SELECTED":"").'>Yes</option>
+                                <OPTION VALUE="3" '.($x==3?"SELECTED":"").'>No</option>
+                            </SELECT>
+                            ';
+                    switch( $x )
+                    {
+                        case "2":
+                            $qs .= " AND ".$f[0]." = 't'";
+                            break;
+                        case "3":
+                            $qs .= " AND ".$f[0]." = 'f'";
+                            break;
+                        case "1":
+                        default:
+                            break;
+                    }
+                    break;
+
+                case "list" :
+
+                    // If there's picklist options, sparate them into an array
+                    $opts_table = array ();
+                    $opts = explode_trim("~", $x[1]);
+
+                    foreach ($opts as $opt)
+                    {
+                        $z = explode_trim("^", $opt); // Separate value from displayed text
+                        $opts_table[$z[0]] = $z[1];
+                    }
+
+                    $opts_def = ($filter_value == '' ? '-1' : $filter_value);
+
+                    // If select doesn't contain anything, also check request
+                    if (!is_array($opts_def)) {
+                        $opts_def = $_REQUEST[$f[0]];
+                    }
+
+                    // Build new picklist
+                    $filter_out .= reg_build_picklist($f[0], $opts_table, $opts_def, 'standard', $x[3]);
+
+                    // If there's a list of selected options - multi-select
+                    if( is_array($opts_def) ) {
+
+                        $qss .= ' AND ( ';
+                        $sep = '';
+                        foreach( $opts_def as $v )        // For each option specified
+                        {
+                            if( trim($v) != '' )                // If the option is something other than ''
+                            {
+                                $qss .= $sep.$f[0]." = ".$v."";
+                                $sep = ' OR ';
+                            }
+                        }
+
+                        if( $sep != '' ) {                       // If there were options selected other than ''
+                            $qs .= $qss.' )';                    // add to the query
+                        }
+
+                    // Otherwise it's a single value
+                    } else {
+                        if( $filter_value != '' ) {
+                            $qs .= ' AND '.$f[3].' = '.$filter_value;
+                        }
+                    }
+
+                    break;
+
+
+                case "category":
+
+                    // If picklist is selected - use that for selection
+
+                    if (strstr($x[3],'picklist')) {
+                        if (($nodes = cat_get_nodes($x[1]))) {
+
+                            $filter_out .= '<SELECT NAME="'.$f[0].'"><OPTION VALUE=""> </option>';
+
+                            reset($nodes);
+                            while (list($key, $val) = each($nodes)) {
+                                $filter_out .= '<OPTION VALUE="'.$val['id'].'">';
+                                if( strstr($x[3],'fullpath') )
+                                $filter_out .= $val['cat_fullpath'];
+                                else
+                                {
+                                    for( $i=0 ; $i<$val['cat_level'] ; $i++ )
+                                    $filter_out .= "&nbsp;&nbsp;&nbsp;&nbsp;";
+                                    $filter_out .= $val['name'];
+                                }
+                                $filter_out .= '</option>';
+                            }
+                            $filter_out .= '</SELECT>';
+                        }
+                        else
+                        $filter_out .= 'No categories listed.';
+
+                    } else {    // Otherwise use pop-up
+
+                        // Check if a value for this field is supplied
+                        if (!empty($filter_value)) {
+                            if (($cval = cat_get_node( $x[1], "id = ".$filter_value ) )) {
+                                $cat_id = $filter_value;
+                                if( strstr($x[3],'fullpath') )
+                                $cat_name = $cval['cat_fullpath'];
+                                else
+                                $cat_name = $cval['cat_name'];
+                            }
+                        } else {
+                            $cat_id = 0;
+                            $cat_name = "&nbsp;&nbsp;&nbsp;";
+                        }
+
+                        $pop_width = !empty($x[4]) ? $x[4] : 200 ;
+                        $pop_height = !empty($x[5]) ? $x[5] : 300 ;
+                        $edit_width = !empty($x[6]) ? $x[6] : 400 ;
+                        $edit_height = !empty($x[7]) ? $x[7] : 500 ;
+
+                        $filter_out .= "
+                            <script language=\"JavaScript1.2\">
+                                <!--
+                                    function category_select_popup_".$f[0]."( target )
+                                        {
+                                            // Pass values to the calendar
+
+                                        tempX = 400;
+                                        tempY = 300;
+
+                                        node_id = this.document.getElementById( target ).value;
+                                        var theUrl='".BASE_APP_URL."Common/Registrations_V3/front-end/category_select_popup.phtml?id=' + node_id + '&field_name=".$f[0]."&table=".$x[1]."&options=".urlencode($x[3])."&edit_width=".$edit_width."&edit_height=".$edit_height."&pop_width=".$pop_width."&pop_height=".$pop_height."';
+
+                                        tempX = tempX - 90;
+                                        //tempY = tempY - 170;
+
+                                        if (navigator.appName == 'Netscape')
+                                            {
+                                            CategoryWind = window.open( theUrl, 'Calendar','scrollbars=yes,toolbar=no,resizable=yes,width=".$pop_width.",height=".$pop_height.",screenx=' + tempX + ',screeny=' + tempY,1 );
+                                            }
+                                        else
+                                            {
+                                            CategoryWind = window.open( theUrl, 'Calendar','scrollbars=no,toolbar=no,resizable=no,width=".$pop_width.",height=".$pop_height.", top=' + tempY + ', left=' + tempX,1 );
+                                            }
+
+                                        CategoryWind.focus();
+                                        }
+                                -->
+                            </script>
+                            ";
+
+                        $filter_out .= '<INPUT TYPE="text" NAME="'.$f[0].'_NAME" ID="'.$f[0].'_NAME" VALUE="'.$cat_name.'" SIZE="'.$x[2].'" READONLY="readonly" STYLE="background-color: #eeeeee;">
+                                                    <INPUT TYPE="hidden" NAME="'.$f[0].'" ID="'.$f[0].'" VALUE="'.$cat_id.'">
+                                                    <A HREF="javascript:category_select_popup_'.$f[0].'(\''.$f[0].'\')">[Change]</A>
+                                                    ';
+                    }
+
+                    if( $filter_value != '' )
+                    $qs .= ' AND '.$f[0]." = '".$filter_value."'";
+
+                    break;
+
+                case "pointer":
+
+                    // Get values from other table
+
+                    $w = !empty($x[4]) ? " WHERE ".$x[4] : "" ;
+                    $d = reg_db_auto_get_data( "SELECT * FROM  ".$x[1].$w." ORDER BY ".$x[2].";", $conn_str, FALSE, 500 );
+
+                    $p_id_field = !empty($x[3]) ? $x[3] : 'id';        // If no id field supplied, assume "id"
+
+                    // Build picklist data
+
+                    unset( $da );
+                    if (!empty($d)) {
+                        while (list($key, $val) = each($d)) {
+                            $da[$val[$p_id_field]] = $val[$x[2]];
+                        }
+                        $filter_out .= reg_build_picklist( $f[0], $da, $filter_value, "standard", "blank" );
+                    } else {
+                        $filter_out .= '<FONT COLOR="red">No records from which to build picklist.</FONT>';
+                    }
+
+                    // If value supplied, add to query WHERE clause
+
+                    if (!empty($filter_value)) {
+                        switch ($option) {
+                            case "like":
+                            case "begin":
+                            case "any":
+                                $filter_out .= '<FONT COLOR="red">Filter option for type "pointer" not valid. Must use "exact" for type pointer.</FONT>';
+                                break;
+                            case "exact":
+                            default:
+                                $qs .= " AND ".$f[0]." = '".$filter_value."'";
+                                break;
+                        }
+                    }
+                    break;
+
+                case 'multipointer':
+
+                    echo "multipointer is not available for Filter functions yet.";
+                    exit;
+                    break;
+
+                default:
+                    $filter_out .= '<FONT COLOR="red">UNKNOWN FILTER FIELD TYPE</FONT>';
+                    break;
+
+            }
+            $filter_out .= '</TR>
+                ';
+        }
+        $filter_out .= '</TABLE>
+                <INPUT TYPE="hidden" NAME="Action" VALUE="'.$action.'">
+                <INPUT TYPE="submit" VALUE="Show Selected Results">
+                '.$form_params.'
+            </FORM>
+            <br>&nbsp;<br>
+            ';
+    }
+
+    // If "new" option selected display link
+
+    if( $option_new )
+    $new_out = '<A HREF="'.$url.'?Action='.urlencode($action).$link_params.'&Option=Add">[Add New Entry]</A><BR>
+            ';
+    else
+    $new_out = "";
+
+
+    // Add in any ORDER BY clause (ignore anything after ".", which are nav options)
+
+    if( !empty($sortclicked) )                    // Check if user clicked a column title
+    {
+        $qs .= ' ORDER BY '.$sortclicked;
+        if( $list_sort_direction == 'Backward' )
+            $qs .= " DESC";
+    }
+    else
+    if( !empty($order) )
+    {
+        $qs .= " ORDER BY ";
+        $ob_comma = "";
+        $order_array = explode_trim( ",", $order );    // Break out multiple order by field names
+        foreach( $order_array as $of )
+        {
+            $x = explode_trim( ".", $of );        // Break out field name from options
+            $qs .= $ob_comma.$x[0];            // Add field name to ORDER BY
+            if( preg_match("/order_descending/", $of) )    // If order_descending use DESC order in ORDER BY for this field
+            $qs .= " DESC";
+            $ob_comma = ", ";            // Next order by field will have a comma in front of it
+        }
+    }
+
+    // Get the data
+
+    $what_fields = "*";
+    if( $id_field != "" )
+    $what_fields = "*, ".$id_field." AS id";
+
+    $query_string = "SELECT ".$what_fields." FROM ".$table." ".$qs.";";
+
+    if( $GLOBALS['reg_config']['debug'] >= 1 ) $ret .=  "<PRE>admin_list_records()[".__LINE__."]: Query String = $query_string</PRE><BR>";
+
+    $data = reg_db_auto_get_data( $query_string, $conn_str, $fail_mode, $rows, $start );
+
+    if( $data )
+    {
+
+        // Determine how much data we got back
+
+        reset( $data );
+        $return_counts = explode( "|", key($data) );
+        $num = $return_counts[1];
+
+        // Calculate last entry on page
+
+        $end_list = $num>($start+$rows) ? $start+$rows : $num;
+
+
+        // Display page navigation
+
+        $nav_out = "";
+        if( $num > 0 && $option_nopaging == FALSE )
+        {
+            if( $start > 0 )
+            $nav_out .= '<A HREF="'.$url.'?Action='.urlencode($action).$link_params.$filter_link.'&start='.($start-$rows).'">previous</A>
+                    ';
+            else
+            $nav_out .= "<I>previous</I> \n";
+
+            $nav_out .= ' <- <B>Results '.($start+1).' to '.($end_list).' of '.$num.'</B> ->
+                ';
+
+            if( $num > $end_list )
+            $nav_out .= '<A HREF="'.$url.'?Action='.urlencode($action).$link_params.$filter_link.'&start='.$end_list.'">next</A>
+                    ';
+            else
+            $nav_out .= " <I>next</I>\n";
+        }
+
+
+        // Build field titles
+
+        $fieldcount = 0;
+        $down_img = '<img src="'.BASE_APP_URL.'Common/Registrations_V3/assets/'.'down_small.png" style="position: relative; top: 2px;">';
+        $up_img = '<img src="'.BASE_APP_URL.'Common/Registrations_V3/assets/'.'up_small.png" style="position: relative; top: 2px;">';
+        foreach( $field_table as $field )
+        {
+            $f2 = explode_trim( "~", $field[2] );    // Only use name, don't include QuickTip text.
+            $f2_name = $f2[0];
+            switch( $field[1] )
+            {
+                default:
+                    if( $option_sortlinks )
+                    {
+                        $scd = '';
+
+                        // Check if a column title has been clicked to cause a sort
+                        if( $sortclicked == $field[0] )
+                        {
+                            // Indicate sort direction
+
+                            if( $list_sort_direction == 'Forward' )
+                                $scd = $down_img;
+                              else
+                                $scd = $up_img;
+                        }
+                        $outnames[$fieldcount++] = $scd.'<A HREF="'.$url.'?Action='.urlencode($action).'&Option=List'.$link_params.$filter_link.'&sortclicked_new='.$field[0]
+                        .'"><nobr>'.$f2_name.'</nobr></A>';
+
+                    }
+                    else
+                        $outnames[$fieldcount++] = $f2_name;
+                    break;
+            }
+        }
+
+        $sort_prompt = '';
+        if( $option_sortlinks ) {
+            $sort_prompt .= "<br>(click table headers to sort column $down_img ascending or $up_img descending)";
+        }
+
+        if( $operation_column )
+        $outnames[$fieldcount++] = 'Operation';
+
+
+        // For each result we're going to display
+
+        $reccount = 0;
+        foreach( $data as $key => $r )
+        {
+
+            // For each field in the result
+
+            $fieldcount = 0;
+            foreach( $field_table as $field )
+            {
+                $w = explode_trim( "`", $field[1] );        // Separate out any format spec
+                $f = explode_trim( ".", $w[0] );            // break out the field type specs
+
+                // If there's any field format spec, save that in our $outvals array
+
+                if( isset($w[1]) && trim($w[1]) != '' )
+                {
+                    // Replace each {field_name} tag with {#} as needed to reference the correct $outvals[$reccount][#] entry
+
+                    for( $i=0 ; $i<count($field_table) ; $i++ )
+                    $w[1] = str_replace( '{'.$field_table[$i][0].'}', '{'.$i.'}', $w[1] );
+
+                    // Save the new format spec
+                    $outvals[$reccount][$fieldcount]['format'] = $w[1];
+                }
+
+                switch( $f[0] )
+                {
+
+                    case "lat":
+                        $fw = 2;
+                        if( $f[1] > 0 )
+                        $fw = $f[1];
+                        $ns = 'N';
+                        if( $r[$field[0]] < 0 )
+                        {
+                            $ns = 'S';
+                            $r[$field[0]] = -1 * $r[$field[0]];
+                        }
+                        $dv = (int) $r[$field[0]];
+                        $mv = ( $r[$field[0]] - $dv ) * 60;
+                        $outvals[$reccount][$fieldcount]['data'] = sprintf( "<NOBR>%s %d&deg; %01.".$fw."f'</NOBR>", $ns, $dv, $mv );
+                        break;
+
+                    case "lon":
+                        $fw = 2;
+                        if( $f[1] > 0 )
+                        $fw = $f[1];
+                        $ns = 'E';
+                        if( $r[$field[0]] < 0 )
+                        {
+                            $ns = 'W';
+                            $r[$field[0]] = -1 * $r[$field[0]];
+                        }
+                        $dv = (int) $r[$field[0]];
+                        $mv = ( $r[$field[0]] - $dv ) * 60;
+                        $outvals[$reccount][$fieldcount]['data'] = sprintf( "<NOBR>%s %d&deg; %01.".$fw."f'</NOBR>", $ns, $dv, $mv );
+                        break;
+
+                    case "order":
+                    case "int":
+                    case "float":
+                        $outvals[$reccount][$fieldcount]['data'] = $r[$field[0]];
+                        break;
+
+                    case "money":
+                        $outvals[$reccount][$fieldcount]['data'] = "$".sprintf( "%01.2f", $r[$field[0]] );
+                        break;
+
+                    case "fixed":
+                        $outvals[$reccount][$fieldcount]['data'] = sprintf( "%01.".$f[1]."f", $r[$field[0]] );
+                        break;
+
+                    case "date":
+                    case "text":
+                    case "textbox":
+                    case "richtext":
+                    case "inet":
+                        $outvals[$reccount][$fieldcount]['data'] = $r[$field[0]];
+                        break;
+
+                    case "state":
+                        $outvals[$reccount][$fieldcount]['data'] = $GLOBALS['si_states_array'][$r[$field[0]]];
+                        break;
+
+                    case "country":
+                        $outvals[$reccount][$fieldcount]['data'] = $GLOBALS['si_countries_array'][$r[$field[0]]];
+                        break;
+
+                    case "url":
+                        $outvals[$reccount][$fieldcount]['data'] = '<A HREF="'.$r[$field[0]].'">'.$r[$field[0]].'</A>';
+                        break;
+
+                    case "category":
+                        // Get the category name for this field is supplied
+                        if( !empty($r[$field[0]]) )
+                        {
+                            if( $cval = db_auto_get_row( "SELECT * FROM ".$f[1]." WHERE id = ".$r[$field[0]].";", 0, $conn_str, FALSE ) )
+                            $outvals[$reccount][$fieldcount]['data'] = $cval['name'];
+                            else
+                            $outvals[$reccount][$fieldcount]['data'] = '<FONT COLOR="red">Unknown Category</FONT>';
+                        }
+                        else
+                        {
+                            $outvals[$reccount][$fieldcount]['data'] = "&nbsp;";
+                        }
+                        break;
+
+                    case "pointer":
+                        // If {value_field} supplied use that, otherwise use id of record as value to match
+                        $value_field = !empty($f[3]) ? $f[3] : "id" ;
+
+                        // If {where} supplied use that, otherwise match {value_field} or "id" field
+                        $w = '';
+                        if( !empty($f[4]) )
+                        $w = " WHERE ".$f[4];
+                        elseif( trim($r[$field[0]]) != '' )
+                        $w = " WHERE ".$value_field." = ".$r[$field[0]];
+
+                        if( $w != '' )
+                        {
+                            $pval = db_auto_get_row( "SELECT * FROM ".$f[1].$w.";", 0, $conn_str, $fail_mode );
+                            $outvals[$reccount][$fieldcount]['data'] = $pval[$f[2]];
+                        }
+                        else
+                        $outvals[$reccount][$fieldcount]['data'] = '';
+                        break;
+
+                    case 'multipointer':
+
+                        echo "multipointer is not available for List functions yet.";
+                        exit;
+                        break;
+
+                    case "checkbox":
+                        $outvals[$reccount][$fieldcount]['data'] = $r[$field[0]] == "t" ? "Yes" : "No" ;
+                        break;
+
+                    case "image":
+                        if( !empty($r[$field[0]]) )
+                        {
+                            switch( $f[1] )
+                            {
+                                case "o":    $img_url = ORIGINAL;    break;
+                                case "r":    $img_url = RESIZED;        break;
+                                case "m":    $img_url = MIDSIZED;    break;
+                                case "t":    $img_url = THUMB;        break;
+                                default:     $img_url = "none";         break;
+                            }
+                            if( $img_url != "none" )
+                            $outvals[$reccount][$fieldcount]['data'] = '<IMG SRC="'.$img_url."/".$r[$field[0]].'">';
+                            else
+                            $outvals[$reccount][$fieldcount]['data'] = '<FONT COLOR="RED">Invalid Image Size</FONT>';
+                        }
+                        else
+                        $outvals[$reccount][$fieldcount]['data'] = '(no image)';
+                        break;
+
+                    case "file":
+                        if( !empty($r[$field[0]]) )
+                            $outvals[$reccount][$fieldcount]['data'] = '<a href="'.FILE_SERVER_URL.IS_OWNER_ID.'/_ORIGINAL_/'.$r[$field[0]].'" target="file_page">'.$r[$field[0]].'</a>';
+                        else
+                            $outvals[$reccount][$fieldcount]['data'] = '(no file)';
+                        break;
+
+                    case "list":
+                        $opts_table = array ();
+                        $opts = explode_trim( "~", $f[1] );    // Separate list options
+                        foreach( $opts as $opt )
+                        {
+                            $z = explode_trim("^", $opt); // Separate value from displayed text
+                            $opts_table[$z[0]] = $z[1];
+                        }
+
+                        // In case there's multiple selected options, display results of all selected options with comma separators
+
+                        $x = explode( '~', $r[$field[0]] );
+                        $outvals[$reccount][$fieldcount]['data'] = $sep = '';
+                        if( is_array($x) )
+                        foreach( $x as $y )
+                        {
+                            $outvals[$reccount][$fieldcount]['data'] .= $sep.$opts_table[$y];
+                            $sep = ', ';
+                        }
+
+                        break;
+
+                    default:
+                        $outvals[$reccount][$fieldcount]['data'] = '<FONT COLOR="red">UNKNOWN FIELD TYPE: '.$f[0].' for '.$field[0].'</FONT>';
+                        break;
+
+                } // switch( field )
+                $fieldcount++;
+            } // foreach( field )
+
+            if( $operation_column )
+            {
+                $outvals[$reccount][$fieldcount]['data'] = "";
+                if( $option_view )
+                $outvals[$reccount][$fieldcount]['data'] .= '<A HREF="'.$url.'?Action='.urlencode($action).'&Option=View'.$link_params.'&id='.$r["id"].'">[view] </A>';
+                if( $option_edit )
+                $outvals[$reccount][$fieldcount]['data'] .= '<A HREF="'.$url.'?Action='.urlencode($action).'&Option=Edit'.$link_params.'&id='.$r["id"].'">[edit] </A>';
+                if( $option_delete )
+                $outvals[$reccount][$fieldcount]['data'] .= '<A HREF="'.$url.'?Action='.urlencode($action).'&Option=Delete'.$link_params.'&id='.$r["id"].'">[delete] </A>';
+                if( $option_duplicate )
+                $outvals[$reccount][$fieldcount]['data'] .= '<A HREF="'.$url.'?Action='.urlencode($action).'&Option=Duplicate'.$link_params.'&id='.$r["id"].'">[duplicate] </A>';
+                $fieldcount++;
+            }
+
+            $reccount++;
+        } // foreach( record )
+
+        // Replace parameters in Title - {n} represents the field names in the page title
+
+    } // if( $data )
+
+    for( $i=0 ; $i<$fieldcount ; $i++ )
+    {
+        $a_title = preg_replace( "/\\{".$i."\\}/", $outnames[$i], $a_title );
+        $a_title = preg_replace( "/\\{encode:".$i."\\}/", urlencode($outnames[$i]), $a_title );
+    }
+    $a_title = preg_replace( "/\\{filter\}/", $filter_out, $a_title );
+    $a_title = preg_replace( "/\\{link_params\}/", $link_params, $a_title );
+    $a_title = preg_replace( "/\\{form_params\}/", $form_params, $a_title );
+    $a_title = preg_replace( "/\\{new\}/", $new_out, $a_title );
+    $a_title = preg_replace( "/\\{nav\}/", $nav_out, $a_title );
+
+    $ret .=  "<CENTER>\n";
+
+    if( empty($view) )    // If $view is not supplied
+    {
+
+        if( trim($quick_tip) != '' )
+        $a_title = quick_tip( $a_title, $quick_tip );
+
+        // Display title, filter, and optional "new" link
+
+        $ret .=  $a_title.'
+            '.$filter_out.'
+            '.$new_out;
+
+        // If there were results listed, display the results
+
+        if( $data && ($fields != "") )
+        {
+            $ret .=  $nav_out.$sort_prompt.$nav_initials.'
+                <TABLE BORDER="'.($option_noborder==FALSE?'1':'0').'">
+                    <TR>
+                    ';
+
+            // Display the titles for all columns
+
+            for( $i=0 ; $i<$fieldcount ; $i++ )
+            {
+                if( !$hidden[$i] )
+                $ret .=  "<TH>".$outnames[$i]."&nbsp;</TH>";
+            }
+
+            // Display the data for each result
+
+            for( $i=0 ; $i<$reccount ; $i++ )
+            {
+                $ret .=  "<TR>";
+
+                for( $j=0 ; $j<$fieldcount ; $j++ )
+                {
+                    // If the field is supposed to be seen
+
+                    if( !$hidden[$j] )
+                    {
+                        // If there's a format spec, use that
+                        if( $outvals[$i][$j]['format'] != '' )
+                        {
+                            $out = $outvals[$i][$j]['format'];
+                            for( $k=0 ; $k<$fieldcount ; $k++ )
+                            $out = str_replace( '{'.$k.'}', $outvals[$i][$k]['data'] , $out );
+                            $ret .=  "<td>$out</td>";
+                        }
+                        else    // Otherwise just output the value
+                        $ret .=  "<TD>".$outvals[$i][$j]['data']."&nbsp;</TD>";
+                    }
+                }
+                $ret .=  "</TR>\n";
+
+            }
+            $ret .=  '    </TABLE>
+                '.$nav_out;
+        }
+        else
+        $ret .=  '    <CENTER>(No results found)</CENTER>
+                ';
+
+    }
+    else        // IF$view is supplied
+    {
+
+        // Replace any reference to {filter}, {new}, and {nav} in $view
+
+        $view = preg_replace( "/\\{filter\\}/", $filter_out, $view );
+        $view = preg_replace( "/\\{link_params\\}/", $link_params, $view );
+        $view = preg_replace( "/\\{form_params\\}/", $form_params, $view );
+        $view = preg_replace( "/\\{new\\}/", $new_out, $view );
+        $view = preg_replace( "/\\{nav\\}/", $nav_out, $view );
+
+        // Separate the header, body, and footer
+
+        $head = $body = $foot = "";
+        $x = explode( "{body}", $view );
+        if( count($x) == 2 )    // if {body} found then we have the head and the rest
+        {
+            $head = $x[0];
+            $view = $x[1];
+        }
+        $x = explode( "{/body}", $view );
+        if( count($x) == 2 )    // If {/body} found then we have the body and the foot
+        {
+            $body = $x[0];
+            $foot = $x[1];
+        }
+        else
+        $body = $view;
+
+        // Replace the values $head & $foot - {n} in Header and footer get names of fields
+
+        for( $i=0 ; $i<$fieldcount ; $i++ )
+        {
+            $head = preg_replace( "/\\{".$i."\\}/", $outnames[$i], $head );
+            $foot = preg_replace( "/\\{".$i."\\}/", $outnames[$i], $foot );
+            $head = preg_replace( "/\\{encode:".$i."\\}/", urlencode($outnames[$i]), $head );
+            $foot = preg_replace( "/\\{encode:".$i."\\}/", urlencode($outnames[$i]), $foot );
+        }
+
+        $ret .=  $a_title.$head;    // Output title & head sections
+
+        if( $data )
+        {
+            // Break up body into sections
+
+            $body_parts = explode( "{section}", $body );    // Did I really write it that way???
+
+            // For each body_part
+
+            $bp = 0;
+
+            for( $i=0 ; $i<$reccount ; $i++ )        // For each Record
+            {
+                $b = $body_parts[$bp++];        // Get body section and point to next
+                if( $bp == count($body_parts) )        // if last available body section, start back at first
+                $bp = 0;
+
+                for( $j=0 ; $j<$fieldcount ; $j++ )        // For each field
+                {
+                    $b = preg_replace( "/\\{".$j."\\}/", $outvals[$i][$j]['data'], $b );    // Replace value for that field
+                    $b = preg_replace( "/\\{encode:".$j."\\}/", urlencode($outvals[$i][$j]['data']), $b );    // Replace value for that field
+                }
+
+                $ret .=  $b;    // Output this body section
+            }
+        }
+        else
+        $ret .=  "(No results found)\n";
+
+        // Output foot
+
+        $ret .=  $foot;
+
+    }
+
+    $ret .=  "</CENTER>\n";
+
+    return( array( 'text' => $ret, 'status' => true ) );
+
+}
+
+function admin_list_records( $table, $where, $order, $conn_str, $fields,
+$options, $fail_mode, $rows = 20, $start = 0,
+$url, $action, $params, $filters, $a_title, $view = "", $id_field = "", $quick_tip = "", $id_field = "" )
+{
+    $r = admin_list_records_r( $table, $where, $order, $conn_str, $fields,
+    $options, $fail_mode, $rows, $start,
+    $url, $action, $params, $filters, $a_title, $view, $id_field, $quick_tip );
+
+    echo $r['text'];
+    return( $r['status'] );
+}
+
+
+
+
+// Ask for a new record for a table
+
+function admin_new_record_r( $table, $conn_str, $fields, $url, $action, $params, $a_title,
+$view = "", $options = "", $quick_tip = "", $id_field = "" )
+{
+
+    $ret = '';
+
+    $form_name = "edit";
+    $richtext_used = FALSE;        // Indicates whether richtext field type has been specified
+    $category_used = FALSE;        // Indicates whether categroy field type has been specified
+
+    // Make all submitted parameters available
+
+    //    extract($GLOBALS[HTTP_GET_VARS]);
+    //    extract($GLOBALS[HTTP_POST_VARS]);
+
+    // Check for any options
+
+    $borders = strstr( $options, "borders" ) == FALSE ? 0 : 1;
+
+    // Break out configuration data
+
+    $field_table = explode_trim( "|", $fields );
+
+    // Don't be surprised if last field is blank
+
+    if( trim($field_table[count($field_table)-1]) == "" )
+    array_pop( $field_table );
+
+    foreach( $field_table as $key => $r )
+    $field_table[$key] = explode_trim( ",", $r );
+
+    // Check for additional parameters that are passed
+
+    if( !empty($params) )
+    {
+        $param = explode_trim( "|", $params );    // Separate parameters
+        $link_params = $form_params = "";
+        foreach( $param as $p )
+        {
+            $x = explode_trim( ".", $p );    // Separate Names from Values
+            $link_params .= "&".$x[0]."=".urlencode($x[1]);
+            $form_params .= '<INPUT TYPE="hidden" NAME="'.$x[0].'" VALUE="'.$x[1].'">';
+        }
+    }
+
+
+    // For each field in the result
+
+    $outcount = 0;
+    foreach( $field_table as $field )
+    {
+
+        // Get supplied field value
+        $field_val = ${$field[4]};
+
+
+        $f = explode_trim( ".", $field[1] );
+
+        $out[$outcount]["display"] = TRUE;
+        $out[$outcount]["field"] = $field[0];
+
+        // Display title fields
+
+        $n = explode_trim( '~', $field[2] );            // Separate QuickTip from title
+        $field_name_color = 'black';
+        switch( $field[3] )
+        {
+            case "TRUE":
+            case "UNIQUE":
+                $field_name_color = 'red';
+            case "FALSE":
+            case "SUPPLIED":
+            case "DISPLAY":
+            case "UNIQUE_NOT_REQ":
+
+                // setup tip display - requires show_QuickTip() and hide_QuickTip() functions from java_functions.js
+
+                if( count($n) > 1 ) {
+                    $out[$outcount]["name"] = quick_tip( '<font color="'.$field_name_color.'">'.$n[0].'</font>', $n[1] );
+                } else {
+                    $out[$outcount]["name"] = '<FONT COLOR="'.$field_name_color.'">'.$field[2].'</FONT>';
+                }
+
+                break;
+
+            case "HIDDEN":
+                $out[$outcount]["name"] = '';
+                break;
+
+            default:
+                $out[$outcount]["name"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                break;
+        }
+
+        // Display input fields
+
+        switch( $f[0] )
+        {
+            case "money":
+            case "int":
+            case "order":
+            case "url":
+            case "text":
+            case "inet":
+            case "float":
+            case "fixed":
+                $v = "";
+                $prefix = "";
+                $s = $f[1];        // Field Input Size
+
+                if( $f[0] == "int" ) {   // If it's an integer, default to 0
+                    $v = 0;
+                } elseif( $f[0] == "order" ) {    // If it's an "order" field, default to 9999 - last in list
+                    $v = 9999;
+                } elseif( $f[0] == "money" ) {   // If it's money, default to 0.00
+                        $prefix = "$";
+                        $v = "0.00";
+                } elseif( $f[0] == "fixed" ) {   // If it's fixed, default to specified precision
+
+                    $prefix = "";
+                    $v = "0";
+                    if( $f[1] > 0 )
+                    {
+                        $v .= '.';
+                        for( $i=0 ; $i<$f[1] ; $i++ )
+                        $v .= '0';
+                        $s = $f[1] + 4;
+                    }
+                } else {
+                    $v = $field_val;
+                }
+
+
+                switch( $field[3] )    // {required} setting
+                {
+                    case "TRUE":
+                    case "UNIQUE":
+                    case "UNIQUE_NOT_REQ":
+                    case "FALSE":
+                        $out[$outcount]["value"] = $prefix.'<INPUT TYPE="text" NAME="'.$field[0].'" VALUE="'.$v.'" SIZE="'.$s.'">';
+                        break;
+                    case "SUPPLIED":
+                        $out[$outcount]["value"] = $prefix.'<INPUT TYPE="text" NAME="'.$field[0].'" SIZE="'.$s.'" VALUE="'.$v.'">';
+                        break;
+                    case "DISPLAY":
+                        $out[$outcount]["value"] = $prefix.'<INPUT TYPE="hidden" NAME="'.$field[0].'" VALUE="'.$v.'">'.$v;
+                        break;
+                    case "HIDDEN":
+                        $out[$outcount]["value"] = '<INPUT TYPE="hidden" NAME="'.$field[0].'" VALUE="'.$v.'">';
+                        break;
+                    default:
+                        $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                        break;
+                }
+                break;
+
+            case "lat":
+
+                $fw = 2;
+                if( $f[1] > 0 )
+                $fw = $f[1];
+
+                switch( $field[3] )    // {required} setting
+                {
+                    case "TRUE":
+                    case "UNIQUE":
+                    case "UNIQUE_NOT_REQ":
+                    case "FALSE":
+                        $out[$outcount]["value"] = '<SELECT NAME="'.$field[0].'_NS"><OPTION VALUE="N" SELECTED>North</option><OPTION VALUE="S">South</option></SELECT>
+                                <INPUT TYPE="text" NAME="'.$field[0].'_DEG" VALUE="0" SIZE="4" MAXLENGTH="2" ALIGN="right">&deg;
+                                <INPUT TYPE="text" NAME="'.$field[0].'_MIN" VALUE="'.sprintf( "%01.".$fw."f", 0 ).'" SIZE="'.(3+$fw).'" ALIGN="right">\'';
+                        break;
+                    case "SUPPLIED":
+                    case "DISPLAY":
+                        $ns = 'N';
+                        $lat = $field_val;
+                        if( $lat < 0 )
+                        {
+                            $ns = 'S';
+                            $lat = -1 * $lat;
+                        }
+                        $dv = (int) $lat;
+                        $mv = ( $lat - $dv ) * 60;
+                        if( $field[3] == "SUPPLIED" )
+                        $out[$outcount]["value"] = '<SELECT NAME="'.$field[0].'_NS"><OPTION VALUE="N" '.($ns=='N'?'SELECTED':'').'>North</option><OPTION VALUE="S" '.($ns=='S'?'SELECTED':'').'>South</option></SELECT>
+                                <INPUT TYPE="text" NAME="'.$field[0].'_DEG" VALUE="'.$dv.'" SIZE="4"  MAXLENGTH="2" ALIGN="right">&deg;
+                                <INPUT TYPE="text" NAME="'.$field[0].'_MIN" VALUE="'.sprintf( "%01.".$fw."f", $mv ).'" SIZE="'.(3+$fw).'" ALIGN="right">\'';
+                        else
+                        $out[$outcount]["value"] = '<INPUT TYPE="hidden" NAME="'.$field[0].'" VALUE="'.$lat.'">'
+                        .sprintf( "<NOBR>%s %d&deg; %01.".$fw."f'</NOBR>", $ns, $dv, $mv );
+                        break;
+                    case "HIDDEN":
+                        $out[$outcount]["value"] = '<INPUT TYPE="hidden" NAME="'.$field[0].'" VALUE="'.$lat.'">';
+                        break;
+                    default:
+                        $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                        break;
+                }
+                break;
+
+            case "lon":
+
+                $fw = 2;
+                if( $f[1] > 0 )
+                $fw = $f[1];
+
+                switch( $field[3] )    // {required} setting
+                {
+                    case "TRUE":
+                    case "UNIQUE":
+                    case "UNIQUE_NOT_REQ":
+                    case "FALSE":
+                        $out[$outcount]["value"] = '<SELECT NAME="'.$field[0].'_NS"><OPTION VALUE="W" SELECTED>West<OPTION VALUE="E">East</option></SELECT>
+                                <INPUT TYPE="text" NAME="'.$field[0].'_DEG" VALUE="0" SIZE="4"  MAXLENGTH="3" ALIGN="right">&deg;
+                                <INPUT TYPE="text" NAME="'.$field[0].'_MIN" VALUE="'.sprintf( "%01.".$fw."f", 0 ).'" SIZE="'.(3+$fw).'" ALIGN="right">\'';
+                        break;
+                    case "SUPPLIED":
+                    case "DISPLAY":
+                        $ns = 'E';
+                        $lon = $field_val;
+                        if( $lon < 0 )
+                        {
+                            $ns = 'W';
+                            $lon = -1 * $lon;
+                        }
+                        $dv = (int) $lon;
+                        $mv = ( $lon - $dv ) * 60;
+                        if( $field[3] == "SUPPLIED" )
+                        $out[$outcount]["value"] = '<SELECT NAME="'.$field[0].'_NS"><OPTION VALUE="W" '.($ns=='W'?'SELECTED':'').'>West</option><OPTION VALUE="E" '.($ns=='E'?'SELECTED':'').'>East</option></SELECT>
+                                <INPUT TYPE="text" NAME="'.$field[0].'_DEG" VALUE="'.$dv.'" SIZE="4"  MAXLENGTH="3" ALIGN="right">&deg;
+                                <INPUT TYPE="text" NAME="'.$field[0].'_MIN" VALUE="'.sprintf( "%01.".$fw."f", $mv ).'" SIZE="'.(3+$fw).'" ALIGN="right">\'';
+                        else
+                        $out[$outcount]["value"] = '<INPUT TYPE="hidden" NAME="'.$field[0].'" VALUE="'.$lon.'">'
+                        .sprintf( "<NOBR>%s %d&deg; %01.".$fw."f'</NOBR>", $ns, $dv, $mv );
+                        break;
+                    case "HIDDEN":
+                        $out[$outcount]["value"] = '<INPUT TYPE="hidden" NAME="'.$field[0].'" VALUE="'.$lon.'">';
+                        break;
+                    default:
+                        $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                        break;
+                }
+                break;
+
+            case "date":
+
+                $date_f = !empty( $f[1] ) ? time()-$f[1]*86400 : time() ;    // Set datestamp of first day to allow
+                $date_t = !empty( $f[2] ) ? time()+$f[2]*86400 : time() ;    // Set datestamp of last day to allow
+
+                switch( $field[3] )    // {required} setting
+                {
+                    case "TRUE":
+                    case "FALSE":
+                        $out[$outcount]["value"] = calendar_date_select( "", time(), $date_f, $date_t, $form_name, $field[0], $f[3], $f[4] );
+                        break;
+                    case "SUPPLIED":
+                        $out[$outcount]["value"] = calendar_date_select( $field_val, time(), $date_f, $date_t, $form_name, $field[0], $f[3], $f[4] );
+                        break;
+                    case "DISPLAY":
+                        $out[$outcount]["value"] = $prefix.'<INPUT TYPE="hidden" NAME="'.$field[0].'" VALUE="'.$field_val.'">'.$field_val;
+                        break;
+                    case "HIDDEN":
+                        $out[$outcount]["value"] = '<INPUT TYPE="hidden" NAME="'.$field[0].'" VALUE="'.$field_val.'">';
+                        break;
+                    default:
+                        $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                        break;
+                }
+                break;
+
+            case "textbox":
+                switch( $field[3] )    // {required} setting
+                {
+                    case "TRUE";
+                    case "FALSE";
+                    $out[$outcount]["value"] = '<TEXTAREA NAME="'.$field[0].'" COLS="'.$f[1].'" ROWS="'.$f[2].'"></TEXTAREA>';
+                    break;
+                    case "SUPPLIED":
+                        $out[$outcount]["value"] = '<TEXTAREA NAME="'.$field[0].'" COLS="'.$f[1].'" ROWS="'.$f[2].'">'
+                        .$field_val.'</TEXTAREA>';
+                        break;
+                    case "DISPLAY":
+                        $out[$outcount]["value"] = '<INPUT TYPE="hidden" NAME="'.$field[0].'" VALUE="'.$field_val.'">'.filter_request($field[4]);
+                        break;
+                    case "HIDDEN":
+                        $out[$outcount]["value"] = '<INPUT TYPE="hidden" NAME="'.$field[0].'" VALUE="'.$field_val.'">';
+                        break;
+                    default:
+                        $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                        break;
+                }
+                break;
+
+            case "richtext":
+                $def_text = '';
+                switch( $field[3] )    // {required} setting
+                {
+                    case "SUPPLIED":
+                        $def_text = $field_val;
+                        // no break, dropps through
+                    case "TRUE";
+                    case "FALSE";
+                    if( SI_RICHTEXT_TYPE_ENABLED )
+                    {
+
+                if( !$richtext_used  )
+                {
+                    $richtext_used = TRUE;
+                }
+                $out[$outcount]["value"] = '
+                <TABLE BORDER="1" WIDTH="'.$ew.'">
+                    <TR>
+                        <TD>
+                            <TEXTAREA ID="'.$field[0].'" NAME="'.$field[0].'" COLS="60" ROWS="5">'.$def_text.'</TEXTAREA>
+                        </TD>
+                    </TR>
+                </TABLE>
+                <script language="JavaScript1.2">
+                    <!--
+                    buildCkeditor(\''.$field[0].'\');
+                    -->
+                </script>
+                ';
+
+                    }
+                    else
+                    $out[$outcount]["value"] = '<TEXTAREA ID="'.$field[0].'" NAME="'.$field[0].'" COLS="60" ROWS="5">'.$def_text.'</TEXTAREA>';
+                    break;
+                    case "DISPLAY":
+                        $out[$outcount]["value"] = '<INPUT TYPE="hidden" NAME="'.$field[0].'" VALUE="'.$field_val.'">'.$field_val;
+                        break;
+                    case "HIDDEN":
+                        $out[$outcount]["value"] = '<INPUT TYPE="hidden" NAME="'.$field[0].'" VALUE="'.$field_val.'">';
+                        break;
+                    default:
+                        $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                        break;
+                }
+                break;
+
+            case "multifield":        // multitext.numb_fields.new_line_string
+
+                // THIS FIELD TYPE REQUIRES java_functions.js
+
+                switch( $field[3] )
+                {
+                    case "TRUE":
+                    case "FALSE":
+                        $out[$outcount]["value"] = '<input type="hidden" name="'.$field[0].'_text" id="'.$field[0].'_text" value="'.$f[2].'">
+                                                    <span id="'.$field[0].'_fields">';
+
+                        // If there's data, then build existing input lines with data
+                        if( ( $x = trim($data[$field[0]]) ) != '' )
+                        {
+                            $field_data = unserialize( $data[$field[0]] );
+
+                            if( $field_data != false && is_array( $field_data ) )
+                            {
+                                // For each line of inputs
+                                for( $i=1 ; $i<=count($field_data) ; $i++ )
+                                {
+                                    $f_line = str_replace( '{line_numb}', $i, $f[2] );        // Set line number in output text
+                                    // For each input field on the line
+                                    for( $j=1 ; $j<=$f[1] ; $j++ )
+                                    $f_line = str_replace( '{field_'.$j.'}', '<input type="text" name="'.$field[0].'_'.$i.'_'.$j.'" id="'.$field[0].'_'.$i.'_'.$j.'" value="'.$field_data[$i-1][$j-1].'" onChange="multi_fields(\''.$field[0].'\',this,'.$f[1].');">', $f_line );
+
+                                    $out[$outcount]["value"] .= $f_line."\n";
+                                }
+                            }
+
+                        }
+                        else
+                        $i = 1;        // If no data blank line is #1
+
+                        // Build 1 spare input line
+                        $f_line = str_replace( '{line_numb}', $i, $f[2] );        // Set line number in output text
+                        for( $j=1 ; $j<=$f[1] ; $j++ )
+                        $f_line = str_replace( '{field_'.$j.'}', '<input type="text" name="'.$field[0].'_'.$i.'_'.$j.'" id="'.$field[0].'_'.$i.'_'.$j.'" value="" onChange="multi_fields(\''.$field[0].'\',this,'.$f[1].');">', $f_line );
+                        $out[$outcount]["value"] .= $f_line."\n</span>";
+
+                        break;
+
+                    case "HIDDEN":
+                    case "DISLPLAY":
+                    case "SUPPLIED":
+                    default:
+                        $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                        break;
+
+                }
+                break;
+
+            case "image":
+                switch( $field[3] )    // {required} setting
+                {
+                    case "TRUE":
+                    case "FALSE":
+                        $out[$outcount]["value"] = '<INPUT TYPE="file" NAME="'.$field[0].'">';
+                        break;
+                    case "SUPPLIED":
+                    case "DISPLAY":
+                    case "HIDDEN":
+                        $out[$outcount]["value"] = '<FONT COLOR="red">SUPPLIED/DISPLAY/HIDDEN not allowed here for image</FONT>';
+                        break;
+                    default:
+                        $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                        break;
+                }
+                break;
+
+            case "images":
+
+                switch( $field[3] )
+                {
+                    case "TRUE":
+                    case "FALSE":
+                        $out[$outcount]["value"] = '';
+                        $im_num = 0;
+
+                        if( empty($f[1]) )
+                        $spare = 2;
+                        else
+                        $spare = $f[1];
+
+                        // Check for options
+
+                        $im_des = strstr( $f[2], 'descr' );
+                        $im_align = strstr( $f[2], 'align' );
+                        $im_size = strstr( $f[2], 'size' );
+                        if( !empty( $f[3] ) )
+                        $im_des_s = $f[3];
+                        else
+                        $im_des_s = 40;
+                        if( !empty( $f[4] ) )
+                        $im_des_t = $f[4];
+                        else
+                        $im_des_t = "Text";
+
+                        for( $i=0 ; $i<$spare ; $i++ )
+                        {
+                            $out[$outcount]["value"] .= '
+                                Image #'.($im_num+1).'<BR>
+                                <TABLE BORDER="1">
+                                    <TR>
+                                        <TD COLSPAN="2" VALIGN="middle"><INPUT TYPE="file" NAME="'.$field[0].'['.$im_num.']">
+                                            '.( $im_align ? '
+                                                Align image <SELECT NAME="'.$field[0].'_ALIGN['.$im_num.']">
+                                                    <OPTION VALUE="Left"'.($im_data[$im_num]['align']=="Left"?" SELECTED":"").'>Left</option>
+                                                    <OPTION VALUE="Right"'.($im_data[$im_num]['align']=="Right"?" SELECTED":"").'>Right</option>
+                                                    <OPTION VALUE="Top"'.($im_data[$im_num]['align']=="Top"?" SELECTED":"").'>Top</option>
+                                                    <OPTION VALUE="Middle"'.($im_data[$im_num]['align']=="Middle"?" SELECTED":"").'>Middle</option>
+                                                    <OPTION VALUE="Bottom"'.($im_data[$im_num]['align']=="Bottom"?" SELECTED":"").'>Bottom</option>
+                                                </SELECT>
+                                                ' : '<INPUT TYPE="hidden" NAME="align" VALUE="">' ).'
+                                            '.( $im_size ? '
+                                                Size
+                                                <SELECT NAME="'.$field[0].'_SIZE['.$im_num.']">
+                                                    <OPTION VALUE="Original"'.($im_data[$im_num]['size']=="Original"?" SELECTED":"").'>Original</option>
+                                                    <OPTION VALUE="Resized"'.($im_data[$im_num]['size']=="Resized"?" SELECTED":"").'>Resized (width='.SI_RESIZED_SIZE.')</option>
+                                                    <OPTION VALUE="Midsized"'.($im_data[$im_num]['size']=="Midsized"?" SELECTED":"").'>Midsized (width='.SI_MIDSIZED_SIZE.')</option>
+                                                    <OPTION VALUE="Thumb"'.($im_data[$im_num]['size']=="Thumb"?" SELECTED":"").'>Thumb (width='.SI_THUMB_SIZE.')</option>
+                                                </SELECT>
+                                                ' : '<INPUT TYPE="hidden" NAME="size" VALUE="">' ).'
+                                            </TD>
+                                    </TR>
+                                    '.( $im_des ? '<TR><TD COLSPAN="2">'.$im_des_t.' <INPUT TYPE="text" NAME="'.$field[0].'_DESCR['.$im_num.']" SIZE="'.$im_des_s.'"></TD>' : '' ).'
+                                </TABLE>
+                                <BR>';
+                            $im_num++;
+                        }
+                        break;
+
+                    case "HIDDEN":
+                    case "DISLPLAY":
+                    case "SUPPLIED":
+                    default:
+                        $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                        break;
+
+                }
+                break;
+
+
+            case "file":
+                switch( $field[3] )    // {required} setting
+                {
+                    case "TRUE":
+                    case "FALSE":
+                        $out[$outcount]["value"] = '<INPUT TYPE="file" NAME="'.$field[0].'">';
+                        break;
+                    case "SUPPLIED":
+                    case "DISPLAY":
+                    case "HIDDEN":
+                        $out[$outcount]["value"] = '<FONT COLOR="red">SUPPLIED/DISPLAY/HIDDEN not allowed here for file</FONT>';
+                        break;
+                    default:
+                        $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                        break;
+                }
+                break;
+
+            case "category":
+
+                // If picklist is selected - use that for selection
+
+                if( strstr($f[3],'picklist') )
+                {
+                    if( ($nodes = cat_get_nodes($f[1])) )
+                    {
+                        $out[$outcount]["value"] .= '<SELECT NAME="'.$field[0].'"><OPTION VALUE=""> </option>';
+
+                        reset($nodes);
+                        while( list($key, $val) = each($nodes) )
+                        {
+                            $out[$outcount]["value"] .= '<OPTION VALUE="'.$val['id'].'">';
+                            if( strstr($f[3],'fullpath') )
+                            $out[$outcount]["value"] .= $val['cat_fullpath'];
+                            else
+                            {
+                                for( $i=0 ; $i<$val['cat_level'] ; $i++ )
+                                $out[$outcount]["value"] .= "&nbsp;&nbsp;&nbsp;&nbsp;";
+                                $out[$outcount]["value"] .= $val['name'];
+                            }
+                            $out[$outcount]["value"] .= '</option>';
+                        }
+                        $out[$outcount]["value"] .= '</SELECT>';
+                    }
+                    else
+                    $out[$outcount]["value"] .= 'No categories listed.';
+                }
+                else    // Otherwise use pop-up
+                {
+
+                    // Check if a value for this field is supplied
+                    if( !empty($field_val) )
+                    {
+                        if( ($cval = cat_get_node( $f[1], "id = ".$field_val ) ) )
+                        {
+                            $cat_id = $field_val;
+                            if( strstr($f[3],'fullpath') )
+                            $cat_name = $cval['cat_fullpath'];
+                            else
+                            $cat_name = $cval['cat_name'];
+                        }
+                    }
+                    else
+                    {
+                        $cat_id = 0;
+                        $cat_name = "&nbsp;&nbsp;&nbsp;";
+                    }
+
+                    $pop_width = !empty($f[4]) ? $f[4] : 200 ;
+                    $pop_height = !empty($f[5]) ? $f[5] : 300 ;
+                    $edit_width = !empty($f[6]) ? $f[6] : 400 ;
+                    $edit_height = !empty($f[7]) ? $f[7] : 500 ;
+
+                    $out[$outcount]["value"] .= "
+                        <script language=\"JavaScript1.2\">
+                            <!--
+                                function category_select_popup_".$field[0]."( target )
+                                    {
+                                        // Pass values to the calendar
+
+                                    tempX = 400;
+                                    tempY = 300;
+
+                                    node_id = this.document.getElementById( target ).value;
+                                    var theUrl='".BASE_APP_URL."Common/Registrations_V3/front-end/category_select_popup.phtml?id=' + node_id + '&field_name=".$field[0]."&table=".$f[1]."&options=".urlencode($f[3])."&edit_width=".$edit_width."&edit_height=".$edit_height."&pop_width=".$pop_width."&pop_height=".$pop_height."';
+
+                                    tempX = tempX - 90;
+                                    tempY = tempY - 170;
+
+                                    if (navigator.appName == 'Netscape')
+                                        {
+                                        CategoryWind = window.open( theUrl, 'Calendar','scrollbars=yes,toolbar=no,resizable=yes,width=".$pop_width.",height=".$pop_height.",screenx=' + tempX + ',screeny=' + tempY,1 );
+                                        }
+                                    else
+                                        {
+                                        CategoryWind = window.open( theUrl, 'Calendar','scrollbars=no,toolbar=no,resizable=yes,width=".$pop_width.",height=".$pop_height.", top=' + tempY + ', left=' + tempX,1 );
+                                        }
+
+                                    CategoryWind.focus();
+                                    }
+                            -->
+                        </script>
+                        ";
+
+                    $out[$outcount]["value"] .= '<INPUT TYPE="text" NAME="'.$field[0].'_NAME" ID="'.$field[0].'_NAME" VALUE="'.$cat_name.'" SIZE="'.$f[2].'" READONLY="readonly" STYLE="background-color: #eeeeee;">
+                                                <INPUT TYPE="hidden" NAME="'.$field[0].'" ID="'.$field[0].'" VALUE="'.$cat_id.'">
+                                                <A HREF="javascript:category_select_popup_'.$field[0].'(\''.$field[0].'\')">[Change]</A>
+                                                ';
+                }
+                break;
+
+            case "pointer":
+
+                // If {value_field} type option supplied use that, otherwise use id of record as VALUE
+                $value_field = !empty($f[3]) ? $f[3] : "id" ;
+
+                // If {where} type option supplied use that, otherwise get all possibilities from other table
+                $w = !empty($f[4]) ? " WHERE ".$f[4] : "" ;
+
+                // If picklist options
+                $p = !empty($f[5]) ? $f[5] : "" ;
+
+                // Sort field for query
+                $s = !empty($f[6]) ? $f[6] : "id" ;
+
+                // Pointer options
+
+                $pointer_option_add_field = FALSE;
+                if( ! empty($f[7]) )
+                {
+                    $option_table = explode_trim( ",", $f[7] );
+                    foreach( $option_table as $option )
+                    {
+                        switch( $option )
+                        {
+                            case "add_field":                        // Option to display a field for entering a new target
+                                $pointer_option_add_field = TRUE;
+                                break;
+
+                            default:
+                                break;
+                        }
+                    }
+                }
+
+                // ID field name
+                $s = !empty($f[6]) ? $f[6] : "id" ;
+
+                // Check if a value for this field is supplied
+                if( !empty($field_val) ) {
+                    $supplied = $field_val;
+                } else {
+                    $supplied = "";
+                }
+
+                switch( $field[3] )
+                {
+                    // These require us to build a pick list
+                    case "TRUE":
+                    case "FALSE":
+                    case "SUPPLIED":
+
+                        $d = reg_db_auto_get_data( "SELECT * FROM  ".$f[1].$w." ORDER BY ".$s.";", $conn_str, FALSE, 500 );
+
+                        if( !$d )
+                        {
+                            $out[$outcount]["value"] = '<FONT COLOR="red">No records from which to build picklist</FONT>';
+                        }
+                        else
+                        {
+                            // Create table of possibilities for pick list
+
+                            unset( $da );
+                            while( list($key, $val) = each($d) )
+                            {
+                                $da[$val[$value_field]] = $val[$f[2]];
+
+                                // If {required} setting is "SUPPLIED"
+                                if( $field[3] == "SUPPLIED" &&  $val[$value_field] == $field_val )
+                                $dkey = $val[$value_field];    // Get id of record we're refering to
+                            }
+
+                            $out[$outcount]["value"] = reg_build_picklist( $field[0], $da, $dkey, "standard", $p );
+                        }
+
+                        // Provide an additional input field to permit adding a new target value
+
+                        if( $pointer_option_add_field )
+                        $out[$outcount]["value"] .= '<NOBR> or add new value <INPUT TYPE="text" NAME="'.$field[0].'_add_field"></NOBR>';
+
+                        break;
+
+                        // These require us to just get the data for the specific index
+
+                    case "DISPLAY":
+                    case "HIDDEN":
+                        if( empty($field_val) )
+                        {
+                            $out[$outcount]["value"] = '<FONT COLOR="red">Missing value for DISPLAY & HIDDEN</FONT>';
+                            break;
+                        }
+                        $d = db_auto_get_row( "SELECT * FROM ".$f[1]." WHERE ".$value_field." = ".$field_val." ORDER BY ".$s.";", 0, $conn_str, $fail_mode  );
+                        if( !$d )
+                        {
+                            $out[$outcount]["value"] = '<FONT COLOR="red">Specified value for DISPLAY/HIDDEN not found in table</FONT>';
+                            break;
+                        }
+                        else
+                        $out[$outcount]["value"] = '<INPUT TYPE="hidden" NAME="'.$field[0].'" VALUE="'.$d[$value_field].'">';
+
+                        if( $field[3] == "DISPLAY" )    // If DISPLAY add the visible data after the hidden field
+                        {
+                            if( $f[5] == "checkbox" )
+                            $out[$outcount]["value"] .= ($d[$f[2]]=='t'?"Yes":"No");
+                            else
+                            $out[$outcount]["value"] .= $d[$f[2]];
+                        }
+
+                        break;
+
+                    default:
+                        $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                        break;
+                }
+                break;
+
+            case 'multipointer':
+
+                // If {value_field} type option supplied use that, otherwise use id of record as VALUE
+                $value_field = !empty($f[3]) ? $f[3] : "id" ;
+
+                // If {where} type option supplied use that, otherwise get all possibilities from other table
+                $w = !empty($f[4]) ? " WHERE ".$f[4] : "" ;
+
+                // If picklist options
+                $p = !empty($f[5]) ? $f[5] : "" ;
+
+                // Sort field for query
+                $s = !empty($f[6]) ? $f[6] : "id" ;
+
+                // ID field name
+                $s = !empty($f[6]) ? $f[6] : "id" ;
+
+                switch( $field[3] ) {
+
+                    // These require us to build a pick list
+                    case "TRUE":
+                    case "FALSE":
+                    case "SUPPLIED":
+
+                        $d = reg_db_auto_get_data( "SELECT * FROM  ".$f[1].$w." ORDER BY ".$s.";", $conn_str, FALSE, 500 );
+
+                        if( !$d ) {
+                            $out[$outcount]["value"] = '<FONT COLOR="red">No records from which to build picklist</FONT>';
+                        } else {
+
+                            // Create table of possibilities for pick list
+                            unset( $da );
+                            while( list($key, $val) = each($d) ) {
+                                $da[$val[$value_field]] = $val[$f[2]];
+
+                                // If {required} setting is "SUPPLIED"
+                                if( $field[3] == "SUPPLIED" &&  $val[$value_field] == $field_val )
+                                    $dkey = $val[$value_field];    // Get id of record we're refering to
+                            }
+
+                            $out[$outcount]["value"] = reg_build_picklist( $field[0], $da, $dkey, "standard", $p." multi" );
+                        }
+
+                        break;
+
+                       // These require us to just get the data for the specific index
+                       case "DISPLAY":
+                       case "HIDDEN":
+echo "multipointer DISPLAY/HIDDEN not available yet."; exit;
+                           if( empty($field_val) ) {
+                                $out[$outcount]["value"] = '<FONT COLOR="red">Missing value for DISPLAY & HIDDEN</FONT>';
+                                break;
+                        }
+                        $d = db_auto_get_row( "SELECT * FROM ".$f[1]." WHERE ".$value_field." = ".$field_val." ORDER BY ".$s.";", 0, $conn_str, $fail_mode  );
+                        if( !$d ) {
+                                $out[$outcount]["value"] = '<FONT COLOR="red">Specified value for DISPLAY/HIDDEN not found in table</FONT>';
+                                break;
+                        } else {
+                                $out[$outcount]["value"] = '<INPUT TYPE="hidden" NAME="'.$field[0].'" VALUE="'.$d[$value_field].'">';
+                        }
+                        if( $field[3] == "DISPLAY" ) {    // If DISPLAY add the visible data after the hidden field
+                               if( $f[5] == "checkbox" ) {
+                                   $out[$outcount]["value"] .= ($d[$f[2]]=='t'?"Yes":"No");
+                               } else {
+                                   $out[$outcount]["value"] .= $d[$f[2]];
+                               }
+                           }
+
+                        break;
+
+                    default:
+                        $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                        break;
+                   }
+
+                break;
+
+            case "list":
+                // If picklist options
+                $p = !empty($f[3]) ? $f[3] : "" ;
+
+                $option_table = "";
+                $opts = explode_trim( "~", $f[1] );    // Separate list options
+                $def_value = !empty($f[2]) ? $f[2] : "" ;
+                foreach( $opts as $opt )
+                {
+                    $os = explode_trim( "^", $opt );    // Separate value from displayed text
+                    $option_table[$os[0]] = $os[1];
+                }
+                $out[$outcount]["value"] = reg_build_picklist( $field[0], $option_table, $def_value, "standard", $p );
+                if( $out[$outcount]["value"] == '' )
+                $out[$outcount]["value"] = '(no options listed)';
+                break;
+
+            case "state":        // Special case of list
+
+                $out[$outcount]["value"] = reg_build_picklist( $field[0], $GLOBALS['si_states_array'], $f[1], "standard", $f[2] );
+                break;
+
+            case "country":        // Special case of list
+
+                $out[$outcount]["value"] = reg_build_picklist( $field[0], $GLOBALS['si_countries_array'], $f[1], "standard", $f[2] );
+                break;
+
+            case "checkbox":
+                switch( $field[3] )    // {required} setting
+                {
+                    case "TRUE":
+                    case "FALSE":
+                        $out[$outcount]["value"] =  '<INPUT TYPE="checkbox" NAME="'.$field[0].'">';
+                        break;
+
+                    case "SUPPLIED":
+                        $out[$outcount]["value"] = '<INPUT TYPE="checkbox" NAME="'.$field[0].'" '.($field_val=="t"?"CHECKED":"").'>';
+                        break;
+
+                    case "HIDDEN":
+                        $out[$outcount]["value"] = '<INPUT TYPE="hidden" NAME="'.$field[0].'" VALUE="'.$field_val.'">';
+                        break;
+
+                    case "DISPLAY":
+                        $out[$outcount]["value"] = '<FONT COLOR="red">DISPLAY/HIDDEN not available for type checkbox at this time</FONT>';
+                        break;
+
+                    default:
+                        $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                        break;
+                }
+                break;
+
+            case "bitmap":
+
+                $bmap = explode_trim( "~", $f[1] );
+                $out[$outcount]["value"] = "";
+
+                switch( $field[3] )    // {required} setting
+                {
+                    case "TRUE":
+                    case "FALSE":
+                        for( $i=0 ; $i<count($bmap) ; $i++ )
+                        if( $bmap[$i] != '' )
+                        $out[$outcount]["value"] .= '<INPUT TYPE="checkbox" NAME="'.$field[0]."[$i]".'">'.$bmap[$i].'<BR>';
+                        break;
+
+                    case "SUPPLIED":
+                    case "DISPLAY":
+                    case "HIDDEN":
+                        for( $i=0 ; $i<count($bmap) ; $i++ )
+                        if( $bmap[$i] != '' )
+                        {
+                            $x = $field_val & pow( 2, $i ) ? " CHECKED" : "";        // Check if this bit set in supplied value
+                            $out[$outcount]["value"] .= '<INPUT TYPE="checkbox" NAME="'.$field[0]."[$i]".'"'.$x.'>'.$bmap[$i].'<BR>';
+                        }
+                        break;
+
+                    default:
+                        $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                        break;
+                }
+                if( $out[$outcount]["value"] == '' )
+                $out[$outcount]["value"] = '(no options listed)';
+                break;
+
+            case "break":
+                if( !empty($f[1]) )    // if {t1} is supplied
+                $out[$outcount]["value"] = $f[1];
+                else
+                $out[$outcount]["value"] = '<FONT COLOR="red">No {text} supplied for type "break"</FONT>';
+                break;
+
+            default:
+                $out[$outcount]["value"] = '<FONT COLOR="red">UNKNOWN FIELD TYPE: '.$f[0].' for '.$field[0].'</FONT>';
+                break;
+
+        } // switch( field )
+
+        $outcount++;
+    } // foreach( field )
+
+    // Build submit button and hidden action and put in {submit}
+
+    $submit = '
+            <INPUT TYPE="hidden" NAME="Action" VALUE="'.$action.'">
+            '.$form_params.'
+            <INPUT TYPE="submit" NAME="Option" VALUE="Add New">
+        ';
+
+    // Replace parameters in Title
+
+    for( $i=0 ; $i<$outcount ; $i++ )
+    {
+        $a_title = preg_replace( "/\\{".$i."\\}/", $out[$i]["value"], $a_title );
+        $a_title = preg_replace( "/\\{encode:".$i."\\}/", urlencode($out[$i]["value"]), $a_title );
+    }
+
+    $a_title = preg_replace( "/\\{link_params\\}/", $link_params, $a_title );
+    $a_title = preg_replace( "/\\{form_params\\}/", $form_params, $a_title );
+
+    // Add QuickTip if provided
+
+    if( trim($quick_tip) != '' )
+    $a_title = quick_tip( $a_title, $quick_tip );
+
+    // Output results
+
+    // Display top of page and open form
+
+    $ret .=  '<CENTER>
+        <FORM ENCTYPE="multipart/form-data" ACTION="'.$url.'" METHOD="post" ID="'.$form_name.'" NAME="'.$form_name.'">
+        ';
+
+    $hidden_data = '';
+    if( empty($view) )    // If there's no format spec in $view
+    {
+
+        $ret .=  $a_title.'
+            <FONT COLOR="red">(Required fields in red)</FONT><BR>
+            <TABLE BORDER="'.$borders.'" '.($borders>0?' CELLPADDING="5"':"").'>
+            ';
+
+        for( $i=0 ; $i<$outcount ; $i++ )
+        {
+            if( $out[$i]["name"] != '' )
+            $ret .=  '<TR><TH ALIGN="right" VALIGN="top">'.$out[$i]["name"]
+            .'&nbsp;</TH><TD ALIGN="left">'.$out[$i]["value"].'&nbsp;</TD></TR>
+                    ';
+            else
+            $hidden_data .= $out[$i]["value"];
+        }
+
+        $ret .=  '    <P>
+            </TABLE>'.$hidden_data.$submit;    // Output the Confirm field and submit button
+
+    }
+    else    // Otherwise use $view to output data
+    {
+        reset( $out );
+        while( list ($k, $v) = each($out) )
+        {
+            $a_title = preg_replace( "/\\{".$v['field']."\\}/", $v["value"], $a_title );
+            $view = preg_replace( "/\\{".$v['field']."\\}/", $v["value"], $view );
+            $a_title = preg_replace( "/\\{encode:".$v['field']."\\}/", urlencode($v["value"]), $a_title );
+            $view = preg_replace( "/\\{encode:".$v['field']."\\}/", urlencode($v["value"]), $view );
+        }
+
+        for( $i=0 ; $i<$outcount ; $i++ )
+        {
+            $view = preg_replace( "/\\{".$i."\\}/", $out[$i]["value"], $view );
+            $view = preg_replace( "/\\{encode:".$i."\\}/", urlencode($out[$i]["value"]), $view );
+        }
+        $view = preg_replace( "/\\{submit\\}/", $submit, $view );
+        $view = preg_replace( "/\\{link_params\\}/", $link_params, $view );
+        $view = preg_replace( "/\\{form_params\\}/", $form_params, $view );
+        $ret .=  $a_title.$view;
+    }
+
+    // Display bottom of page and close form
+    $ret .=  '    </FORM>
+        </CENTER>
+        ';
+
+    return( array( 'text' => $ret, 'status' => true ) );
+}
+
+function admin_new_record( $table, $conn_str, $fields, $url, $action, $params, $a_title, $view = "", $options = "", $quick_tip = "", $id_field = "" )
+{
+    $r = admin_new_record_r( $table, $conn_str, $fields, $url, $action, $params, $a_title, $view, $options, $quick_tip );
+
+    echo $r['text'];
+    return( $r['status'] );
+
+}
+
+
+
+
+// Add new record to a table
+
+function admin_add_new_record_r( $table, $conn_str, $fields, $url, $action, $params, $a_title, $view = "", $quick_tip = "", $id_field = "" )
+{
+
+    $ret = '';
+
+    if( $GLOBALS['reg_config']['debug'] >= 1 ) $ret .=  "<PRE>admin_add_new_record()[".__LINE__."]: Table = $table, Action = $action</PRE><BR>";
+
+    // Break out configuration data
+
+    $field_table = explode_trim( "|", $fields );
+
+    // Don't be surprised if last field is blank
+
+    if( trim($field_table[count($field_table)-1]) == "" )
+        array_pop( $field_table );
+
+    foreach( $field_table as $key => $r )
+        $field_table[$key] = explode_trim( ",", $r );
+
+    // Check for additional parameters that are passed
+    if( !empty($params) )
+    {
+        if( $GLOBALS['reg_config']['debug'] >= 2 ) $ret .=  "<PRE>admin_add_new_record()[".__LINE__."]: Additional Passed Parameters = $params</PRE><BR>";
+
+        $param = explode_trim( "|", $params );    // Separate parameters
+        $link_params = $form_params = "";
+        foreach( $param as $p )
+        {
+            $x = explode_trim( ".", $p );    // Separate Names from Values
+            $link_params .= "&".$x[0]."=".urlencode($x[1]);
+            $form_params .= '<INPUT TYPE="hidden" NAME="'.$x[0].'" VALUE="'.$x[1].'">';
+        }
+    }
+
+    $names = $values = $not_supplied = $problem = $mp_qs = "";
+
+    // For each field in the result
+
+    $comma = "";    // first parameter doesn't need a comma in front of it
+    $outcount = 0;
+    foreach( $field_table as $field )
+    {
+
+        $f = explode_trim( ".", $field[1] );    // Break out optional parameters from field type
+        // Don't add any multipointer fields to field list since it's stored in a separate table.
+        if ($f[0] != 'multipointer') {
+            $names .= $comma.$field[0];        // Add field name to $names for INSERT
+        }
+        $out[$outcount]["name"] = $field[0];    // Make name available to view
+        $fta = explode_trim( "~", $field[2] );
+        $field_title_only = $fta[0];
+
+
+        // Get submitted value
+        if ($f[0] == 'richtext' && $f[3] != '') {
+            switch ($f[3]) {
+                case 'encoded':
+                    $filter = FILTER_SANITIZE_ENCODED;
+                    break;
+                default:
+                    $filter = FILTER_SANITIZE_STRING;
+            }
+            $field_val = filter_request($field[4],$filter);
+        } else {
+            $field_val = filter_request($field[4]);
+        }
+
+        if( $GLOBALS['reg_config']['debug'] >= 2 ) $ret .=  "<PRE>        Field = ".$field[0].", value = ".$field_val."</PRE><BR>";
+
+        switch( $f[0] )
+        {
+            case "money":
+            case "order":
+            case "int":
+            case "float":
+            case "fixed":
+            case "pointer":
+            case "category":
+
+                // Handle special cases in this group of types
+                switch( $f[0] )
+                {
+
+                    case "money":
+
+                        // Get rid of "$" and "," from silly users
+
+                        $field_val = preg_replace( "/[\$,]/", "", $field_val );
+                        break;
+
+                    case "pointer":
+
+                        // Check for add_field values - Add new value to pointer target record
+
+                        if( ($add_value = trim(filter_request($field[4].'_add_field'))) != '' )
+                        {
+                            // If value already exists warn user.
+
+                            if( db_auto_get_row( "SELECT * FROM ".$f[1]." WHERE ".$f[2]." = '".trim(filter_request($field[4].'_add_field'))."';", 0, $conn_str, $fail_mode ) )
+                            $not_supplied .= $field_title_only.": Value already exists in pick list, don't try to add it again.<BR>";
+                            else
+                            {
+                                // Otherwise, add new value and use pointer to that
+
+                                $add_result = db_auto_get_row( "INSERT INTO ".$f[1]." ( ".$f[2]." ) VALUES ( '".trim(filter_request($field[4].'_add_field'))."' );
+                                                                SELECT currval( '".$f[1]."_id_seq' ) AS id;", 0, $conn_str, $fail_mode );
+                                $field_val = $add_result['id'];
+                            }
+                        }
+
+                        break;
+
+                    default:
+                        break;
+                }
+
+
+                $out[$outcount]["value"] = $field_val;
+                if( !empty($field_val) && !is_numeric($field_val) )
+                $not_supplied .= $field_title_only.': "'.$field_val.'" Is not an Integer Number<BR>';
+
+                switch( $field[3] )
+                {
+                    case "SUPPLIED":
+                        $values .= $comma.$field_val;
+                        break;
+
+                    case "TRUE":
+                        if( !is_numeric($field_val) ) {
+                              $not_supplied .= $field_title_only.": Not Supplied<BR>";
+                        } else {
+                            $values .= $comma.$field_val;
+                        }
+                        break;
+
+                    case "FALSE":
+                        if( is_numeric($field_val) ) {
+                            $values .= $comma.$field_val;
+                        } else {
+                            $values .= $comma."0";    // Default to 0
+                        }
+                        break;
+
+                    case "UNIQUE":
+                        if( empty($field_val) && $field_val != 0 ) {
+                            $not_supplied .= $field_title_only.": Not Supplied<BR>";
+                        } else {
+                            $values .= $comma.$field_val;
+                        }
+
+                        if( db_auto_get_row( "SELECT * FROM $table WHERE ".$field[0]." = ".trim($field_val).";", 0, $conn_str, $fail_mode ) ) {
+                            $not_supplied .= $field_title_only.": Already exists, must be unique<BR>";
+                        }
+                        break;
+
+                    case "UNIQUE_NOT_REQ":
+                        if( is_numeric($field_val) ) {
+                            $values .= $comma.$field_val;
+                        } else {
+                            $values .= $comma."0";    // Default to 0
+                        }
+
+                        if( !empty($field_val) && $field_val != 0 &&
+                                db_auto_get_row( "SELECT * FROM $table WHERE ".$field[0]." = ".trim($field_val).";", 0, $conn_str, $fail_mode ) ) {
+                            $not_supplied .= $field_title_only.": Already exists, must be unique<BR>";
+                        }
+
+                        break;
+
+                    default:
+                        $problem .=  '<FONT COLOR="red">ERROR: Invalid "Required" field name "'.$field[3].'" in function call</FONT><BR>';
+                        break;
+                }
+                break;
+
+            case "multipointer":
+
+                   // Insert any new selections
+                   if (is_array($_REQUEST[$field[0]]) && count($_REQUEST[$field[0]]) > 0) {
+                       foreach ($_REQUEST[$field[0]] as $mps) {
+                           $mp_qs .= "INSERT INTO ".$f[7]." (".$f[8].",".$f[9].") VALUES ({mp_rec_id},".($mps-0).");\n";
+                       }
+
+                   }
+
+                   $out[$outcount]["value"] = $field_val;
+/*** NOT DOING REQUIRED for multipointer yet
+                   if( !empty($field_val) && !is_numeric($field_val) )
+                       $not_supplied .= $field_title_only.': "'.$field_val.'" Is not an Integer Number<BR>';
+*/
+
+                   break;
+
+
+            case "lat":
+                // If we've been passed a decimal degree value
+                $v = $field_val;
+                if( empty($v) ) {
+                    if( filter_request($field[4].'_DEG') > 90 || filter_request($field[4].'_DEG') < 0 || filter_request($field[4].'_MIN') >= 60 || filter_request($field[4].'_MIN') < 0 )
+                    {
+                        $not_supplied .= $field_title_only.": Invalid entry. Degrees must be 0 to 90 and Minutes must be 0 to less than 60<BR>";
+                        break;
+                    }
+                    $v = ( filter_request($field[4].'_NS') == "N" ? 1 : -1 ) * ( filter_request($field[4].'_DEG') + ( filter_request($field[4].'_MIN') / 60 ) );
+                }
+                $fw = 2;
+                // Rebuild value for display
+                if( $f[1] > 0 ) {
+                    $fw = $f[1];
+                }
+                $ns = 'N';
+                if( ($v2=$v) < 0 ) {
+                    $ns = 'S';
+                    $v2 = -1 * $v2;
+                }
+                $dv = (int) $v2;
+                $mv = ( $v2 - $dv ) * 60;
+                $out[$outcount]["value"] = sprintf( "%s %d&deg; %01.".$fw."f'", $ns, $dv, $mv );
+                switch( $field[3] )
+                {
+                    case "SUPPLIED":
+                        $values .= $comma.$v;
+                        break;
+
+                    case "TRUE":
+                        if( empty($v) )
+                        $not_supplied .= $field_title_only.": Not Supplied<BR>";
+                        else
+                        $values .= $comma.$v;
+                        break;
+
+                    case "FALSE":
+                        $values .= $comma.$v;
+                        break;
+
+                    case "UNIQUE":
+                        if( db_auto_get_row( "SELECT * FROM $table WHERE ".$field[0]." = $v;", 0, $conn_str, $fail_mode ) )
+                        $not_supplied .= $field_title_only.": Already exists, must be unique<BR>";
+                        $values .= $comma.$v;
+                        break;
+
+                    case "UNIQUE_NOT_REQ":
+                        if( !empty($field_val) && $field_val != 0 &&
+                            db_auto_get_row( "SELECT * FROM $table WHERE ".$field[0]." = $v;", 0, $conn_str, $fail_mode ) ) {
+                            $not_supplied .= $field_title_only.": Already exists, must be unique<BR>";
+                        }
+                        $values .= $comma.$v;
+                        break;
+
+                    default:
+                        $problem .=  '<FONT COLOR="red">ERROR: Invalid "Required" field  name "'.$field[3].'" in function call</FONT><BR>';
+                        break;
+                }
+                break;
+
+            case "lon":
+                // If we've been passed a decimal degree value
+                $v = $field_val;
+                if( empty($v) ) {
+                    if( filter_request($field[4].'_DEG') > 180 || filter_request($field[4].'_DEG') < 0 || filter_request($field[4].'_MIN') >= 60 || filter_request($field[4].'_MIN') < 0 )
+                    {
+                        $not_supplied .= $field_title_only.": Invalid entry. Degrees must be 0 to 180 and Minutes must be 0 to less than 60<BR>";
+                        break;
+                    }
+                    $v = ( filter_request($field[4].'_NS') == "E" ? 1 : -1 ) * ( filter_request($field[4].'_DEG') + ( filter_request($field[4].'_MIN') / 60 ) );
+                }
+                $fw = 2;
+                // Rebuild value for display
+                if( $f[1] > 0 ) {
+                    $fw = $f[1];
+                }
+                $ns = 'E';
+                if( ($v2=$v) < 0 ) {
+                    $ns = 'W';
+                    $v2 = -1 * $v2;
+                }
+                $dv = (int) $v2;
+                $mv = ( $v2 - $dv ) * 60;
+                $out[$outcount]["value"] = sprintf( "%s %d&deg; %01.".$fw."f'", $ns, $dv, $mv );
+                switch( $field[3] )
+                {
+                    case "SUPPLIED":
+                        $values .= $comma.$v;
+                        break;
+
+                    case "TRUE":
+                        if( empty($v) ) {
+                            $not_supplied .= $field_title_only.": Not Supplied<BR>";
+                        } else {
+                            $values .= $comma.$v;
+                        }
+                        break;
+
+                    case "FALSE":
+                        $values .= $comma.$v;
+                        break;
+
+                    case "UNIQUE":
+                        if( db_auto_get_row( "SELECT * FROM $table WHERE ".$field[0]." = $v;", 0, $conn_str, $fail_mode ) ) {
+                            $not_supplied .= $field_title_only.": Already exists, must be unique<BR>";
+                        }
+                        $values .= $comma.$v;
+                        break;
+
+                    case "UNIQUE_NOT_REQ":
+                        if( !empty($field_val) && $field_val != 0
+                            && db_auto_get_row( "SELECT * FROM $table WHERE ".$field[0]." = $v;", 0, $conn_str, $fail_mode ) ) {
+                            $not_supplied .= $field_title_only.": Already exists, must be unique<BR>";
+                        }
+                        $values .= $comma.$v;
+                        break;
+
+                    default:
+                        $problem .=  '<FONT COLOR="red">ERROR: Invalid "Required" field  name "'.$field[3].'" in function call</FONT><BR>';
+                        break;
+                }
+
+                break;
+
+
+            case "list":
+            case "text":
+            case "inet":
+            case "state":
+            case "country":
+            case "url":
+            case "richtext":
+            case "textbox":
+
+                // Check for special cases
+                switch( $f[0] )
+                {
+                    case "inet":
+                        if( ($r = clean_input( $field_val, 'inet' )) != '' ) {
+                            $problem .= '<FONT COLOR="red">'.$field_title_only.': Not a valid IP address or netmask.</FONT><BR>';
+                        }
+                        break;
+
+                    case "list":
+                        // If 'multi' is selected for picklist option, then compile results from array
+                        if( strstr( $f[3], 'multi' ) )
+                        {
+                            $m_val = $sep = '';
+
+                            // Place results in '~' separated string for storage. - Use unfiltered input
+                            $field_val2 = $_REQUEST[$field[4]];
+                            if( is_array($field_val2) ) {
+                                foreach( $field_val2 as $m )
+                                {
+                                    $m_val .= $sep.$m;
+                                    $sep = '~';
+                                }
+                            }
+                            $cv = $m_val;
+                        }
+
+                        break;
+
+                    default:
+                        break;
+                }
+
+                $v = str_replace( "%27", "\'", $field_val );
+                if( trim(strip_tags($v)) == '' ) {
+                    $v = '';
+                }
+                $out[$outcount]["value"] = $v;
+                switch( $field[3] )
+                {
+                    case "SUPPLIED":
+                        $values .= $comma."'".rawurldecode( $v )."'";
+                        break;
+
+                    case "TRUE":
+                        if( empty($v) ) {
+                            $not_supplied .= $field_title_only.": Not Supplied<BR>";
+                        } else {
+                            $values .= $comma."'".rawurldecode( $v )."'";
+                        }
+                        break;
+
+                    case "FALSE":
+                        $values .= $comma."'".rawurldecode( $v )."'";
+                        break;
+
+                    case "UNIQUE":
+                        if( empty($v) )
+                        $not_supplied .= $field_title_only.": Not Supplied<BR>";
+                        else
+                        {
+                            if( db_auto_get_row( "SELECT * FROM $table WHERE ".$field[0]." = '".trim($v)."';", 0, $conn_str, $fail_mode ) )
+                            $not_supplied .= $field_title_only.": Already exists, must be unique<BR>";
+                        }
+                        $values .= $comma."'".rawurldecode( $v )."'";
+                        break;
+
+                    case "UNIQUE_NOT_REQ":
+                        if( !empty($v) )
+                        {
+                            if( db_auto_get_row( "SELECT * FROM $table WHERE ".$field[0]." = '".trim($v)."';", 0, $conn_str, $fail_mode ) )
+                            $not_supplied .= $field_title_only.": Already exists, must be unique<BR>";
+                        }
+                        $values .= $comma."'".$v."'";
+                        break;
+
+                    default:
+                        $problem .=  '<FONT COLOR="red">ERROR: Invalid "Required" field  name "'.$field[3].'" in function call</FONT><BR>';
+                        break;
+                }
+                break;
+
+            case "date":
+
+                // If a date is supplied, correct any date errors
+                if ($field_val != '') {
+                    $field_val = date('m/d/Y', strtotime($field_val));
+                }
+
+                $out[$outcount]["value"] = $field_val;
+
+                if( trim($field_val) == "" ) {               // Blank dates must be "NULL"
+                    $dval = "NULL";
+                } else {
+                    $dval = "'".$field_val."'";
+                }
+
+                switch( $field[3] )
+                {
+                    case "SUPPLIED":
+                        $values .= $comma.$dval;
+                        break;
+
+                    case "TRUE":
+                        if( empty($field_val) ) {
+                            $not_supplied .= $field_title_only.": Not Supplied<BR>";
+                        } else {
+                            $values .= $comma.$dval;
+                        }
+                        break;
+
+                    case "FALSE":
+                        $values .= $comma.$dval;
+                        break;
+
+                    case "UNIQUE":
+                        if( db_auto_get_row( "SELECT * FROM $table WHERE ".$field[0]." = '".trim($field_val)."';", 0, $conn_str, $fail_mode ) ) {
+                            $not_supplied .= $field_title_only.": Already exists, must be unique<BR>";
+                        }
+                        $values .= $comma.$dval;
+                        break;
+
+                    case "UNIQUE_NOT_REQ":
+                        if( !empty($field_val) && db_auto_get_row( "SELECT * FROM $table WHERE ".$field[0]." = '".trim($field_val)."';", 0, $conn_str, $fail_mode ) ) {
+                            $not_supplied .= $field_title_only.": Already exists, must be unique<BR>";
+                        }
+                        $values .= $comma.$dval;
+                        break;
+
+                    default:
+                        $problem .=  '<FONT COLOR="red">ERROR: Invalid "Required" field  name "'.$field[3].'" in function call</FONT><BR>';
+                        break;
+                }
+                break;
+
+            case "multifield":
+
+                $line = 0;
+                $empty = TRUE;
+                $m_data = array();
+
+                // Build array of data to store
+                while( isset($_REQUEST[$field[4].'_'.($line+1).'_1']) )
+                {
+                    $line++;
+                    $cv2 = filter_request($field[4].'_'.$line.'_1');
+                    if( trim($cv2) != '' )
+                    {
+                        $a = array();
+                        for( $i=1 ; $i<=$f[1] ; $i++ )
+                        {
+                            $a[$i-1] = trim( stripslashes(str_replace("%27", "\'", filter_request($field[4].'_'.($line).'_'.$i) ) ));
+                            if( $a[$i-1] != '' )
+                            $empty = FALSE;
+                        }
+                        array_push( $m_data, $a );
+                    }
+                }
+
+                if( !$empty ) {
+                    $v = serialize( $m_data );
+                } else {
+                    $v = '';
+                }
+
+                $out[$outcount]["value"] = $v;
+
+                switch ($field[3])
+                {
+                    case "TRUE" :
+                        if( $empty ) {
+                            $not_supplied .= $field_title_only.": Not Supplied<BR>";
+                        } else {
+                            $values .= $comma."'".$v."'";
+                        }
+                        break;
+
+                    case "FALSE" :
+                        $values .= $comma."'".$v."'";
+                        break;
+
+                    default :
+                        $problem .=  '<FONT COLOR="red">ERROR: Invalid "Required" field  name "'.$field[3].'" in function call</FONT><BR>';
+                        break;
+                }
+
+                break;
+
+            case "image":
+
+                $out[$outcount]["value"] = "IMAGES Not Available for View at this time";
+                $img = filter_request($field[4]);
+
+                switch( $field[3] )
+                {
+                    case "SUPPLIED":
+                        $problem .=  '<FONT COLOR="red">ERROR: "SUPPLIED" not permitted as option for image input</FONT><BR>';
+                        break;
+
+                    case "TRUE":
+                        if ($img['name'] != '') {
+                            $not_supplied .= $field_title_only.": Not Supplied<BR>";
+                        }
+                        // no break; here - falls through to FALSE
+
+                    case "FALSE":
+                        if ($img['name'] != '') {
+                            $values .= $comma."'".reg_process_image( $field[4] )."'";
+                        } else {
+                            $values .= $comma."''";
+                        }
+                        break;
+
+                    default:
+                        $problem .=  '<FONT COLOR="red">ERROR: Invalid "Required" field  name "'.$field[3].'" in function call</FONT><BR>';
+                        break;
+                }
+                break;
+
+            case "images":
+/* NOT CONFIGURED FOR ImageServer
+                // Note that the image field is only updated when required so field name is set below along with value
+
+                $out[$outcount]["value"] = "IMAGES Not Available for View at this time";
+                switch( $field[3] )
+                {
+                    case "FALSE":
+                        if( is_array( ($im_data = filter_request($field[4])) ) )
+                        {
+                            $im_cur = unserialize( $data[$field[0]] );        // Convert existing data to an array
+                            $im_new = array();
+                            $im_new_num = 0;
+                            for( $im_num=0 ; $im_num<count(filter_request($field[0]."_name")) ; $im_num++ )
+                            {
+                                // If new image is supplied, store it
+                                if( filter_request($field[0]."_name")[$im_num] != "" )
+                                {
+                                    //                                    if( $im_cur[$im_num]['filename'] )        // If there's already an image, delete it before storing the new one
+                                    //                                        reg_delete_image( $im_cur[$im_num]['filename'] );
+                                    $im_new[$im_new_num]['filename'] = reg_process_image( filter_request($field[0])[$im_num] );
+                                    $im_new[$im_new_num]['descr'] = filter_request($field[0].'_DESCR')[$im_num];
+                                    $im_new[$im_new_num]['align'] = filter_request($field[0].'_ALIGN')[$im_num];
+                                    $im_new[$im_new_num]['size'] = filter_request($field[0].'_SIZE')[$im_num];
+                                    $im_new_num++;
+                                }
+
+
+                                //                                        // Else, if there's an image in the database and we're deleting
+                                //                                  elseif( $im_cur[$im_num]['filename'] != "" && isset( filter_request($field[0]."_DELETE")[$im_num] )  )
+                                //                                    reg_delete_image( $im_cur[$im_num]['filename'] );
+                                //                                  elseif( $im_cur[$im_num]['filename'] != "" )
+                                //                                      {
+                                //                                    $im_new[$im_new_num]['filename'] = $im_cur[$im_num]['filename'];
+                                //                                    $im_new[$im_new_num]['descr'] = filter_request($field[0].'_DESCR')[$im_num];
+                                //                                    $im_new[$im_new_num]['align'] = filter_request($field[0].'_ALIGN')[$im_num];
+                                //                                    $im_new[$im_new_num]['size'] = filter_request($field[0].'_SIZE')[$im_num];
+                                //                                    $im_new_num++;
+                                //                                      }
+
+
+                            }
+                            $values .= $comma."'".serialize( $im_new )."'";
+                        }
+
+                        break;
+
+                    case "TRUE":
+                    case "SUPPLIED":
+                    default:
+                        $problem .=  '<FONT COLOR="red">ERROR: Invalid "Required" field  name "'.$field[3].'" in function call</FONT><BR>';
+                        break;
+                }
+*/
+                break;
+
+            case "file":
+
+                $out[$outcount]["value"] = "FILES Not Available for View at this time";
+                switch( $field[3] )
+                {
+                    case "SUPPLIED":
+                        $problem .=  '<FONT COLOR="red">ERROR: "SUPPLIED" not permitted as option for file input</FONT><BR>';
+                        break;
+
+                    case "TRUE":
+                        if( filter_request($field[4]."_name") == "" ) {
+                            $not_supplied .= $field_title_only.": Not Supplied<BR>";
+                        }
+                        // no break; here - falls through to FALSE
+
+                    case "FALSE":
+                        if( filter_request($field[4]."_name") != "" ) {
+                            if( isset( $f[1] ) && $f[1] != "" && !preg_match( "/.".$f[1]."$/i",filter_request($field[4]."_name")) ) {
+                                $not_supplied .= $field_title_only.': "'.filter_request($field[4]."_name").'" is not correct file type. Must be:  '.$f[1]."<BR>";
+                            } else {
+                                $values .= $comma."'". reg_file_upload($field[4])."'";
+                            }
+                        } else {
+                            $values .= $comma."''";
+                        }
+                        break;
+
+                    default:
+                        $problem .=  '<FONT COLOR="red">ERROR: Invalid "Required" field  name "'.$field[3].'" in function call</FONT><BR>';
+                        break;
+                }
+                break;
+
+            case "checkbox":
+                if( $field_val == "on" )
+                {
+                    $out[$outcount]["value"] = "Yes";
+                    $values .= $comma."'t'";
+                }
+                else
+                {
+                    $out[$outcount]["value"] = "No";
+                    $values .= $comma."'f'";
+                }
+                break;
+
+            case "bitmap":
+                $out[$outcount]["value"] = "Bitmaps not available for view at this time";
+                $bm = $field_val;
+                $b = 0;        // Start with clear bitmap
+                for( $i=0 ; $i<SI_INT_SIZE ; $i++ )        // Bitmaps are based on the size of an integer
+                {
+                    if( isset($bm[$i]) && $bm[$i] == "on" )    // If checked
+                    $b = $b + pow(2,$i);            // Set bit
+                }
+
+                $values .= $comma.$b;
+                break;
+
+            default:
+                $ret .=  '<FONT COLOR="red">UNKNOWN FIELD TYPE: '.$field[1].' for '.$field[0].'</FONT><BR>';
+                break;
+
+        } // switch( field )
+
+        $comma = ", ";    // All subsequent names/values must have a preceeding comma
+
+        $outcount++;
+    } // foreach( field )
+
+    // Replace parameters in Title
+
+    for( $i=0 ; $i<$outcount ; $i++ )
+    {
+        $a_title = preg_replace( "/\\{".$i."\\}/", $out[$i]["value"], $a_title );
+        $a_title = preg_replace( "/\\{encode:".$i."\\}/", urlencode($out[$i]["value"]), $a_title );
+    }
+
+    $a_title = preg_replace( "/\\{link_params\\}/", $link_params, $a_title );
+    $a_title = preg_replace( "/\\{form_params\\}/", $form_params, $a_title );
+
+    // Add QuickTip if provided
+
+    if( trim($quick_tip) != '' )
+    $a_title = quick_tip( $a_title, $quick_tip );
+
+    $oid = 0;    // Assume we don't get anything
+
+    $ok_to_save = true;
+
+    if( !empty($not_supplied) )
+    {
+        $results .= '
+            <H2>Required fields not supplied</H2><P>
+            <FONT COLOR="red">'.$not_supplied.'</FONT><P>
+            Use "BACK" button on browser, add missing data and resubmit.<P>
+            ';
+        $ok_to_save = false;
+    }
+
+    if( !empty($problem) )
+    {
+        $results .= $problem.'<P>
+            Use "BACK" button on browser, correct problem field, and resubmit.<P>
+            ';
+        $ok_to_save = false;
+    }
+
+    if( $ok_to_save )
+    {
+        $results = '&nbsp<P><H2>New data saved.</H2><P>';
+        $qs = "INSERT INTO $table ($names) VALUES ($values) returning id;";
+        if( $GLOBALS['reg_config']['debug'] >= 1 ) {
+            $ret .=  "<PRE>admin_add_new_record()[".__LINE__."]: Query String = $qs</PRE><BR>";
+        }
+        $d = db_auto_get_row( $qs, 0, $conn_str, FALSE );
+        $id = $d['id'];
+
+        // If needed, add multipointer data
+        if ($mp_qs != '') {
+            $mp_qs = str_replace("{mp_rec_id}", $id, $mp_qs);
+            reg_db_auto_exec( $mp_qs, $conn_str, FALSE );
+        }
+    }
+
+    // Display top of page
+
+    $ret .=  '<CENTER>
+        '.$a_title.'
+            ';
+
+    if( empty($view) )    // If there's no spec in $view
+    $ret .=  $results;
+    else
+    {
+        for( $i=0 ; $i<$outcount ; $i++ )
+        {
+            $view = preg_replace( "/\\{".$i."\\}/", $out[$i]["value"], $view );
+            $view = preg_replace( "/\\{encode:".$i."\\}/", urlencode($out[$i]["value"]), $view );
+        }
+        $view = preg_replace( "/\\{results\\}/", $results, $view );
+        $view = preg_replace( "/\\{link_params\\}/", $link_params, $view );
+        $view = preg_replace( "/\\{form_params\\}/", $form_params, $view );
+        $ret .=  $view;
+    }
+
+    $ret .=  '
+        </CENTER>
+        ';
+
+    return( array( 'text' => $ret, 'status' => $oid, 'id' => $id ) );
+}
+
+function admin_add_new_record( $table, $conn_str, $fields, $url, $action, $params, $a_title, $view = "", $quick_tip = "", $id_field = "" )
+{
+    $r = admin_add_new_record_r( $table, $conn_str, $fields, $url, $action, $params, $a_title, $view, $quick_tip );
+    echo $r['text'];
+    return( $r['status'] );
+}
+
+
+
+
+// Edit a record
+
+function admin_edit_record_r( $table, $conn_str, $id, $fields, $url, $action,
+$params, $a_title, $view = "", $options = "", $quick_tip = "", $id_field = "" )
+{
+
+    $ret = '';
+
+    if( empty($id_field) )
+        $id_field = 'id';
+
+    $form_name = "admin_new_form";
+    $richtext_used = FALSE;
+
+    // Check for any options
+
+    $borders = strstr( $options, "borders" ) == FALSE ? 0 : 1;
+
+    // Check for additional parameters that are passed
+
+    if( !empty($params) )
+    {
+        $param = explode_trim( "|", $params );    // Separate parameters
+        $link_params = $form_params = "";
+        foreach( $param as $p )
+        {
+            $x = explode_trim( ".", $p );    // Separate Names from Values
+            $link_params .= "&".$x[0]."=".urlencode($x[1]);
+            $form_params .= '<INPUT TYPE="hidden" NAME="'.$x[0].'" VALUE="'.$x[1].'">';
+        }
+    }
+
+
+    // Get the data
+
+    $query_string = "SELECT * FROM ".$table." WHERE ".$id_field." = ".$id.";";
+    if( $GLOBALS['reg_config']['debug'] >= 1 ) $ret .=  "<PRE>admin_edit_record()[".__LINE__."]: Query String = $query_string</PRE><BR>";
+    $data = db_auto_get_row( $query_string, 0, $conn_str, $fail_mode );
+
+    if( $data )
+    {
+
+        // Break out configuration data
+
+        $field_table = explode_trim( "|", $fields );
+
+        // Don't be surprised if last field is blank
+
+        if( trim($field_table[count($field_table)-1]) == "" )
+        array_pop( $field_table );
+
+        foreach( $field_table as $key => $r )
+        $field_table[$key] = explode_trim( ",", $r );
+
+        // For each field in the result
+
+        $outcount = 0;
+        foreach( $field_table as $field )
+        {
+
+            $field_val = filter_request($field[4]);
+
+            // Display title fields
+            $out[$outcount]["hidden"] = FALSE;
+
+            // Check for pop-up-tips
+
+            $n = explode_trim( '~', $field[2] );
+
+            $field_name_color = 'black';
+
+            switch( $field[3] )
+            {
+                case "TRUE":
+                case "UNIQUE":
+                    $field_name_color = 'red';
+                case "FALSE":
+                case "DISPLAY":
+                case "UNIQUE_NOT_REQ":
+
+                    // setup tip display - requires show_QuickTip() and hide_QuickTip() functions from java_functions.js
+
+                    if( count($n) > 1 ) {
+                        $out[$outcount]["name"] = quick_tip( '<font color="'.$field_name_color.'">'.$n[0].'</font>', $n[1] );
+                    } else {
+                        $out[$outcount]["name"] = '<FONT COLOR="'.$field_name_color.'">'.$field[2].'</FONT>';
+                    }
+
+                    break;
+                case "SUPPLIED":
+                    $out[$outcount]["name"] = '<INPUT TYPE="hidden" NAME="'.$field[0].'" VALUE="'.$field_val.'">';
+                    break;
+                case "HIDDEN":
+                    $out[$outcount]["name"] = '';
+                    $out[$outcount]["hidden"] = TRUE;
+                    break;
+                default:
+                    $out[$outcount]["name"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                    break;
+            }
+
+            // Display input fields
+            $f = explode_trim( ".", $field[1] );
+            switch( $f[0] )
+            {
+                case "money":
+                case "int":
+                case "text":
+                case "inet":
+                case "url":
+                case "order":
+                case "float":
+                case "fixed":
+                    $prefix = "";
+                    $s = $f[1];
+                    $v = $data[$field[0]];
+                    $prefix = "";
+
+                    if( $f[0] == "money" ) {    // If it's money, default to 0.00
+                        $v = sprintf( "%01.2f", $data[$field[0]] );
+                        $prefix = "$";
+                    }
+
+                    if( $f[0] == "fixed" ) {   // If it's fixed, set precision
+                        $v = sprintf( "%01.".$f[1]."f", $data[$field[0]] );
+                        $s = $f[1] + 4;
+                    }
+
+                    switch( $field[3] )
+                    {
+                        case "TRUE":
+                        case "FALSE":
+                        case "UNIQUE":
+                        case "UNIQUE_NOT_REQ":
+                            $out[$outcount]["value"] = $prefix.'<INPUT TYPE="text" NAME="'.$field[0].'" SIZE="'.$s.'" VALUE="'.$v.'">';
+                            break;
+
+                        case "HIDDEN":
+                        case "DISPLAY":
+                            $out[$outcount]["value"] = $prefix.$v;
+                            break;
+
+                        case "SUPPLIED":
+                            $out[$outcount]["value"] = "";
+                            break;
+
+                        default:
+                            $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                            break;
+
+                    }
+                    break;
+
+                case "lat":
+                    $fw = 2;
+                    if( $f[1] > 0 ) {
+                        $fw = $f[1];
+                    }
+
+                    switch( $field[3] )    // {required} setting
+                    {
+                        case "TRUE":
+                        case "UNIQUE":
+                        case "UNIQUE_NOT_REQ":
+                        case "FALSE":
+                        case "DISPLAY":
+                            $ns = 'N';
+                            if( $data[$field[0]] < 0 ) {
+                                $ns = 'S';
+                                $data[$field[0]] = -1 * $data[$field[0]];
+                            }
+                            $dv = (int) $data[$field[0]];
+                            $mv = ( $data[$field[0]] - $dv ) * 60;
+                            if( $field[3] != "DISPLAY" ) {
+                                $out[$outcount]["value"] = '<SELECT NAME="'.$field[0].'_NS"><OPTION VALUE="N" '.($ns=='N'?'SELECTED':'').'>North</option><OPTION VALUE="S" '.($ns=='S'?'SELECTED':'').'>South</option></SELECT>
+                                        <INPUT TYPE="text" NAME="'.$field[0].'_DEG" VALUE="'.$dv.'" SIZE="4" MAXLENGTH="2" ALIGN="right">&deg;
+                                        <INPUT TYPE="text" NAME="'.$field[0].'_MIN" VALUE="'.sprintf( "%01.".$fw."f", $mv ).'" SIZE="'.(3+$fw).'" ALIGN="right">\'';
+                            } else {
+                                $out[$outcount]["value"] = '<INPUT TYPE="hidden" NAME="'.$field[0].'" VALUE="'.$data[$field[0]].'">'
+                                .sprintf( "<NOBR>%s %d&deg; %01.".$fw."f'</NOBR>", $ns, $dv, $mv );
+                            }
+                            break;
+
+                        case "HIDDEN":
+                            $out[$outcount]["value"] = '<INPUT TYPE="hidden" NAME="'.$field[0].'" VALUE="'.$data[$field[0]].'">';
+                            break;
+
+                        case "SUPPLIED":
+                        default:
+                            $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                            break;
+                    }
+                    break;
+
+                case "lon":
+                    $fw = 2;
+                    if( $f[1] > 0 ) {
+                        $fw = $f[1];
+                    }
+
+                    switch( $field[3] )    // {required} setting
+                    {
+                        case "TRUE":
+                        case "UNIQUE":
+                        case "UNIQUE_NOT_REQ":
+                        case "FALSE":
+                        case "DISPLAY":
+                            $ns = 'E';
+                            if( $data[$field[0]] < 0 )
+                            {
+                                $ns = 'W';
+                                $data[$field[0]] = -1 * $data[$field[0]];
+                            }
+                            $dv = (int) $data[$field[0]];
+                            $mv = ( $data[$field[0]] - $dv ) * 60;
+                            if( $field[3] != "DISPLAY" )
+                            $out[$outcount]["value"] = '<SELECT NAME="'.$field[0].'_NS"><OPTION VALUE="W" '.($ns=='W'?'SELECTED':'').'>West</option><OPTION VALUE="E" '.($ns=='E'?'SELECTED':'').'>East</option></SELECT>
+                                    <INPUT TYPE="text" NAME="'.$field[0].'_DEG" VALUE="'.$dv.'" SIZE="4" MAXLENGTH="3" ALIGN="right">&deg;
+                                    <INPUT TYPE="text" NAME="'.$field[0].'_MIN" VALUE="'.sprintf( "%01.".$fw."f", $mv ).'" SIZE="'.(3+$fw).'" ALIGN="right">\'';
+                            else
+                            $out[$outcount]["value"] = '<INPUT TYPE="hidden" NAME="'.$field[0].'" VALUE="'.$data[$field[0]].'">'
+                            .sprintf( "<NOBR>%s %d&deg; %01.".$fw."f'</NOBR>", $ns, $dv, $mv );
+                            break;
+
+                        case "HIDDEN":
+                            $out[$outcount]["value"] = '<INPUT TYPE="hidden" NAME="'.$field[0].'" VALUE="'.$data[$field[0]].'">';
+                            break;
+
+                        case "SUPPLIED":
+                        default:
+                            $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                            break;
+                    }
+                    break;
+
+                case "date":
+
+                    $date_f = !empty( $f[1] ) ? time()-$f[1]*86400 : time() ;    // Set datestamp of first day to allow
+                    $date_t = !empty( $f[2] ) ? time()+$f[2]*86400 : time() ;    // Set datestamp of last day to allow
+
+                    switch( $field[3] )
+                    {
+                        case "TRUE":
+                        case "FALSE":
+                            $out[$outcount]["value"] = calendar_date_select( $data[$field[0]], strtotime($data[$field[0]]), $date_f, $date_t, $form_name, $field[0], $f[3], $f[4] );
+                            break;
+
+                        case "HIDDEN":
+                        case "DISPLAY":
+                            $out[$outcount]["value"] = $data[$field[0]];
+                            break;
+
+                        case "SUPPLIED":
+                            $out[$outcount]["value"] = "";
+                            break;
+
+                        default:
+                            $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                            break;
+                    }
+                    break;
+
+                case "richtext":
+                    switch( $field[3] )
+                    {
+                        case "TRUE":
+                        case "FALSE":
+                            if( SI_RICHTEXT_TYPE_ENABLED )
+                            {
+
+                if( !$richtext_used  )
+                {
+                    $richtext_used = TRUE;
+                }
+                $out[$outcount]["value"] = '
+                <TABLE BORDER="1" WIDTH="'.$ew.'">
+                    <TR>
+                        <TD>
+                            <TEXTAREA ID="'.$field[0].'" NAME="'.$field[0].'" COLS="60" ROWS="5">'.rawurldecode( $data[$field[0]] ).'</TEXTAREA>
+                        </TD>
+                    </TR>
+                </TABLE>
+                <script language="JavaScript1.2">
+                    <!--
+                    buildCkeditor(\''.$field[0].'\');
+                    -->
+                </script>
+                ';
+
+                            }
+                            else
+                            $out[$outcount]["value"] = '<TEXTAREA ID="'.$field[0].'" NAME="'.$field[0].'" COLS="60" ROWS="5">'.rawurldecode( $data[$field[0]] ).'</TEXTAREA>';
+                            break;
+
+                        case "HIDDEN":
+                        case "DISPLAY":
+                            $out[$outcount]["value"] = $data[$field[0]];
+                            break;
+
+                        case "SUPPLIED":
+                            $out[$outcount]["value"] = "";
+                            break;
+
+                        default:
+                            $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                            break;
+                    }
+                    break;
+
+                case "textbox":
+                    switch( $field[3] )
+                    {
+                        case "TRUE":
+                        case "FALSE":
+                            if( isset($f[1]) )
+                            {
+                                $cols = $f[1];
+                                $rows = $f[2];
+                            }
+                            else
+                            {
+                                $cols = SI_DEFAULT_TEXTBOX_COLS;
+                                $rows = SI_DEFAULT_TEXTBOX_ROWS;
+                            }
+                            $out[$outcount]["value"] = '<TEXTAREA NAME="'.$field[0].'" COLS="'.$cols.'" ROWS="'.$rows.'">'.$data[$field[0]].'</TEXTAREA>';
+                            break;
+
+                        case "HIDDEN":
+                        case "DISPLAY":
+                            $out[$outcount]["value"] = rawurldecode( $data[$field[0]] );
+                            break;
+
+                        case "SUPPLIED":
+                            $out[$outcount]["value"] = "";
+                            break;
+
+                        default:
+                            $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                            break;
+                    }
+                    break;
+
+                case "multifield":        // NOT TESTED  multitext.numb_fields.new_line_string
+
+                    // THIS FIELD TYPE REQUIRES java_functions.js
+
+                    switch( $field[3] )
+                    {
+                        case "TRUE":
+                        case "FALSE":
+                            $out[$outcount]["value"] = '<input type="hidden" name="'.$field[0].'_text" id="'.$field[0].'_text" value="'.$f[2].'">
+                                                        <span id="'.$field[0].'_fields">';
+
+                            // If there's data, then build existing input lines with data
+                            if( ( $x = trim($data[$field[0]]) ) != '' )
+                            {
+                                $field_data = unserialize( $data[$field[0]] );
+
+                                if( $field_data != false && is_array( $field_data ) )
+                                {
+                                    // For each line of inputs
+                                    for( $i=1 ; $i<=count($field_data) ; $i++ )
+                                    {
+                                        $f_line = str_replace( '{line_numb}', $i, $f[2] );        // Set line number in output text
+                                        // For each input field on the line
+                                        for( $j=1 ; $j<=$f[1] ; $j++ )
+                                        $f_line = str_replace( '{field_'.($j).'}', '<input type="text" name="'.$field[0].'_'.$i.'_'.$j.'" id="'.$field[0].'_'.$i.'_'.$j.'" value="'.$field_data[$i-1][$j-1].'" onChange="multi_fields(\''.$field[0].'\',this,'.$f[1].');">', $f_line );
+
+                                        $out[$outcount]["value"] .= $f_line."\n";
+                                    }
+                                }
+
+                            }
+                            else
+                            $i = 1;        // If no data blank line is #1
+
+                            // Build 1 spare input line
+                            $f_line = str_replace( '{line_numb}', $i, $f[2] );        // Set line number in output text
+                            for( $j=1 ; $j<=$f[1] ; $j++ )
+                            $f_line = str_replace( '{field_'.$j.'}', '<input type="text" name="'.$field[0].'_'.$i.'_'.$j.'" id="'.$field[0].'_'.$i.'_'.$j.'" value="" onChange="multi_fields(\''.$field[0].'\',this,'.$f[1].');">', $f_line );
+                            $out[$outcount]["value"] .= $f_line."\n</span>";
+
+                            break;
+
+                        case "HIDDEN":
+                        case "DISLPLAY":
+                        case "SUPPLIED":
+                        default:
+                            $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                            break;
+
+                    }
+                    break;
+
+                case "image":
+                    switch( $field[3] )
+                    {
+                        case "TRUE":
+                        case "FALSE":
+                            $out[$outcount]["value"] = '<TABLE BORDER="1">';
+
+                            if( $data[$field[0]] != "" )    // If an image already exists
+                            {
+                                $out[$outcount]["value"] .= '    <TR>
+                                        <TD VALIGN="middle"><IMG SRC="'.THUMB."/".$data[$field[0]].'"></TD>
+                                        <TD VALIGN="middle">';
+
+                                if( $field[3] == "TRUE" )    // If this field is required
+                                $out[$outcount]["value"] .= 'This image may be replaced using the input field below.';
+                                else
+                                $out[$outcount]["value"] .= '<INPUT TYPE="checkbox" NAME="'.$field[0].'_DELETE"> Delete this image';
+
+                                $out[$outcount]["value"] .= '        </TD></TR>';
+                            }
+
+                            $out[$outcount]["value"] .= '        <TR>
+                                        <TD COLSPAN="2" VALIGN="middle"><INPUT TYPE="file" NAME="'.$field[0].'"></TD>
+                                    </TR>
+                                </TABLE>';
+                            break;
+
+                        case "HIDDEN":
+                        case "DISLPLAY":
+                            $out[$outcount]["value"] = '<IMG SRC="'.THUMB."/".$data[$field[0]].'">';
+                            break;
+
+                        case "SUPPLIED":
+                            $out[$outcount]["value"] = "";
+                            break;
+
+                        default:
+                            $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                            break;
+
+                    }
+                    break;
+
+                case "multitext":        // NOT TESTED  multitext.{size}.{spares}
+
+                    switch( $field[3] )
+                    {
+                        case "TRUE":
+                        case "FALSE":
+                            $out[$outcount]["value"] = '';
+                            $txt_num = 0;
+
+                            if( ( $x = trim($data[$field[0]]) ) != '' )
+                            {
+                                $txt_data = unserialize( $data[$field[0]] );
+
+                                // Do existing images
+
+                                foreach( $txt_data as $txt )
+                                {
+                                    $out[$outcount]["value"] .= '#'.($txt_num+1).'&nbsp;<INPUT TYPE="text" NAME="'.$field[0].'_DESCR['.$im_num.']" SIZE="'.$f[1].'" VALUE="'.$txt_data[$txt_num].'"><BR>';
+                                    $im_num++;
+                                }
+                            }
+
+                            if( empty($f[1]) )
+                            $spare = 2;
+                            else
+                            $spare = $f[2];
+                            for( $i=0 ; $i<$spare ; $i++ )
+                            {
+                                $out[$outcount]["value"] .= '#'.($txt_num+1).'&nbsp;<INPUT TYPE="text" NAME="'.$field[0].'_DESCR['.$im_num.']" SIZE="'.$f[1].'" VALUE="'.$txt_data[$txt_num].'"><BR>';
+                                $im_num++;
+                            }
+                            break;
+
+                        case "HIDDEN":
+                        case "DISLPLAY":
+                        case "SUPPLIED":
+                        default:
+                            $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                            break;
+
+                    }
+                    break;
+
+                case "images":
+/* NOT FOR Image Server
+                    switch( $field[3] )
+                    {
+                        case "TRUE":
+                        case "FALSE":
+                            $out[$outcount]["value"] = '';
+                            $im_num = 0;
+
+                            if( ( $x = trim($data[$field[0]]) ) != '' )
+                            {
+                                $im_data = unserialize( $data[$field[0]] );
+                                $im_des = strstr( $f[2], 'descr' );
+                                $im_align = strstr( $f[2], 'align' );
+                                $im_size = strstr( $f[2], 'size' );
+                                if( !empty( $f[3] ) )
+                                $im_des_s = $f[3];
+                                else
+                                $im_des_s = 40;
+                                if( !empty( $f[4] ) )
+                                $im_des_t = $f[4];
+                                else
+                                $im_des_t = "Text";
+
+                                // Do existing images
+
+                                foreach( $im_data as $im )
+                                {
+                                    $out[$outcount]["value"] .= '
+                                        Image #'.($im_num+1).'<BR>
+                                        <TABLE BORDER="1">
+                                            <TR>
+                                                <TD VALIGN="middle"><IMG SRC="'.SI_IMG_THUMB_URL."/".$im_data[$im_num]['filename'].'"></TD>
+                                                <TD VALIGN="middle">
+                                                    This image may be replaced using the input field below.<BR>
+                                                    Or you may <INPUT TYPE="checkbox" NAME="'.$field[0].'_DELETE['.$im_num.']"> Delete this image.
+                                                    <P>
+                                                '.( $im_align ? '
+                                                    Align image
+                                                    <SELECT NAME="'.$field[0].'_ALIGN['.$im_num.']">
+                                                        <OPTION VALUE="Left"'.($im_data[$im_num]['align']=="Left"?" SELECTED":"").'>Left</option>
+                                                        <OPTION VALUE="Right"'.($im_data[$im_num]['align']=="Right"?" SELECTED":"").'>Right</option>
+                                                        <OPTION VALUE="Top"'.($im_data[$im_num]['align']=="Top"?" SELECTED":"").'>Top</option>
+                                                        <OPTION VALUE="Middle"'.($im_data[$im_num]['align']=="Middle"?" SELECTED":"").'>Middle</option>
+                                                        <OPTION VALUE="Bottom"'.($im_data[$im_num]['align']=="Bottom"?" SELECTED":"").'>Bottom</option>
+                                                    </SELECT>
+                                                    ' : '<INPUT TYPE="hidden" NAME="align" VALUE="">' ).'
+                                                '.( $im_size ? '
+                                                    Size
+                                                    <SELECT NAME="'.$field[0].'_SIZE['.$im_num.']">
+                                                        <OPTION VALUE="Original"'.($im_data[$im_num]['size']=="Original"?" SELECTED":"").'>Original</option>
+                                                        <OPTION VALUE="Resized"'.($im_data[$im_num]['size']=="Resized"?" SELECTED":"").'>Resized (width='.SI_RESIZED_SIZE.')</option>
+                                                        <OPTION VALUE="Midsized"'.($im_data[$im_num]['size']=="Midsized"?" SELECTED":"").'>Midsized (width='.SI_MIDSIZED_SIZE.')</option>
+                                                        <OPTION VALUE="Thumb"'.($im_data[$im_num]['size']=="Thumb"?" SELECTED":"").'>Thumb (width='.SI_THUMB_SIZE.')</option>
+                                                    </SELECT>
+                                                    ' : '<INPUT TYPE="hidden" NAME="size" VALUE="">' ).'
+                                                </TD>
+                                            </TR>
+                                            <TR>
+                                                <TD COLSPAN="2" VALIGN="middle">Select Image <INPUT TYPE="file" NAME="'.$field[0].'['.$im_num.']"></TD>
+                                            </TR>
+                                            '.( $im_des ? '<TR><TD COLSPAN="2">'.$im_des_t.' <INPUT TYPE="text" NAME="'.$field[0].'_DESCR['.$im_num.']" SIZE="'.$im_des_s.'" VALUE="'.$im_data[$im_num]['descr'].'"></TD>' : '' ).'
+                                        </TABLE>
+                                        <BR>';
+                                    $im_num++;
+                                }
+                            }
+
+                            if( empty($f[1]) )
+                            $spare = 2;
+                            else
+                            $spare = $f[1];
+                            for( $i=0 ; $i<$spare ; $i++ )
+                            {
+                                $out[$outcount]["value"] .= '
+                                    Image #'.($im_num+1).'<BR>
+                                    <TABLE BORDER="1">
+                                        <TR>
+                                            <TD COLSPAN="2" VALIGN="middle"><INPUT TYPE="file" NAME="'.$field[0].'['.$im_num.']">
+                                                '.( $im_align ? '
+                                                    Align image <SELECT NAME="'.$field[0].'_ALIGN['.$im_num.']">
+                                                        <OPTION VALUE="Left"'.($im_data[$im_num]['align']=="Left"?" SELECTED":"").'>Left</option>
+                                                        <OPTION VALUE="Right"'.($im_data[$im_num]['align']=="Right"?" SELECTED":"").'>Right</option>
+                                                        <OPTION VALUE="Top"'.($im_data[$im_num]['align']=="Top"?" SELECTED":"").'>Top</option>
+                                                        <OPTION VALUE="Middle"'.($im_data[$im_num]['align']=="Middle"?" SELECTED":"").'>Middle</option>
+                                                        <OPTION VALUE="Bottom"'.($im_data[$im_num]['align']=="Bottom"?" SELECTED":"").'>Bottom</option>
+                                                    </SELECT>
+                                                    ' : '<INPUT TYPE="hidden" NAME="align" VALUE="">' ).'
+                                                '.( $im_align ? '
+                                                    Size
+                                                    <SELECT NAME="'.$field[0].'_SIZE['.$im_num.']">
+                                                        <OPTION VALUE="Original"'.($im_data[$im_num]['size']=="Original"?" SELECTED":"").'>Original</option>
+                                                        <OPTION VALUE="Resized"'.($im_data[$im_num]['size']=="Resized"?" SELECTED":"").'>Resized (width='.SI_RESIZED_SIZE.')</option>
+                                                        <OPTION VALUE="Midsized"'.($im_data[$im_num]['size']=="Midsized"?" SELECTED":"").'>Midsized (width='.SI_MIDSIZED_SIZE.')</option>
+                                                        <OPTION VALUE="Thumb"'.($im_data[$im_num]['size']=="Thumb"?" SELECTED":"").'>Thumb (width='.SI_THUMB_SIZE.')</option>
+                                                    </SELECT>
+                                                    ' : '<INPUT TYPE="hidden" NAME="size" VALUE="">' ).'
+                                                </TD>
+                                        </TR>
+                                        '.( $im_des ? '<TR><TD COLSPAN="2">'.$im_des_t.' <INPUT TYPE="text" NAME="'.$field[0].'_DESCR['.$im_num.']" SIZE="'.$im_des_s.'"></TD>' : '' ).'
+                                    </TABLE>
+                                    <BR>';
+                                $im_num++;
+                            }
+
+                            break;
+
+                        case "HIDDEN":
+                        case "DISLPLAY":
+                        case "SUPPLIED":
+                        default:
+                            $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                            break;
+
+                    }
+*/
+                    break;
+
+                case "file":
+
+                    switch( $field[3] )
+                    {
+                        case "TRUE":
+                        case "FALSE":
+                            $out[$outcount]["value"] = '<TABLE BORDER="1">';
+
+                            if( $data[$field[0]] != "" )    // If a file already exists
+                            {
+                                $out[$outcount]["value"] .= '    <TR>
+                                        <TD VALIGN="middle">
+                                        <A HREF="'.FILE_SERVER_URL.IS_OWNER_ID.'/_ORIGINAL_/'.$data[$field[0]].'" target="file_page">'.$data[$field[0]].'</A>
+                                        </TD>
+                                        <TD VALIGN="middle">';
+
+                                if( $field[3] == "TRUE" )    // If this field is required
+                                $out[$outcount]["value"] .= 'This file may be replaced using the input field below.';
+                                else
+                                $out[$outcount]["value"] .= '<INPUT TYPE="checkbox" NAME="'.$field[0].'_DELETE"> Delete this file';
+
+                                $out[$outcount]["value"] .= '        </TD></TR>';
+                            }
+
+                            $out[$outcount]["value"] .= '        <TR>
+                                        <TD COLSPAN="2" VALIGN="middle"><INPUT TYPE="file" NAME="'.$field[0].'"></TD>
+                                    </TR>
+                                </TABLE>';
+                            break;
+
+                        case "HIDDEN":
+                        case "DISLPLAY":
+                            $out[$outcount]["value"] = '<a href="'.FILE_SERVER_URL.IS_OWNER_ID.'/_ORIGINAL_/'.$data[$field[0]].'" target="file_page">'.$data[$field[0]].'</a>';
+                            break;
+
+                        case "SUPPLIED":
+                            $out[$outcount]["value"] = "";
+                            break;
+
+                        default:
+                            $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                            break;
+
+                    }
+                    break;
+
+                case "category":
+
+                    // If picklist is selected - use that for selection
+
+                    if( strstr($f[3],'picklist') )
+                    {
+                        if( ($nodes = cat_get_nodes($f[1])) )
+                        {
+                            $out[$outcount]["value"] .= '<SELECT NAME="'.$field[0].'"><OPTION VALUE=""> </option>';
+
+                            reset($nodes);
+                            while( list($key, $val) = each($nodes) )
+                            {
+                                $out[$outcount]["value"] .= '<OPTION VALUE="'.$val['id'].'"'.($data[$field[0]]==$val['id']?' SELECTED':'').'>';
+                                if( strstr($f[3],'fullpath') )
+                                $out[$outcount]["value"] .= $val['cat_fullpath'];
+                                else
+                                {
+                                    for( $i=0 ; $i<$val['cat_level'] ; $i++ )
+                                    $out[$outcount]["value"] .= "&nbsp;&nbsp;&nbsp;&nbsp;";
+                                    $out[$outcount]["value"] .= $val['name'];
+                                }
+                                $out[$outcount]["value"] .= '</option>';
+                            }
+                            $out[$outcount]["value"] .= '</SELECT>';
+                        }
+                        else
+                        $out[$outcount]["value"] .= 'No categories listed.';
+                    }
+                    else    // Otherwise use pop-up
+                    {
+
+                        // Get the category name for this field is supplied
+                        if( !empty($data[$field[0]]) )
+                        {
+                            if( ($cval = cat_get_node( $f[1], "id = ".$data[$field[0]] ) ) )
+                            {
+                                $cat_id = $data[$field[0]];
+                                if( strstr($f[3],'fullpath') )
+                                $cat_name = $cval['cat_fullpath'];
+                                else
+                                $cat_name = $cval['cat_name'];
+                            }
+                        }
+                        else
+                        {
+                            $cat_id = 0;
+                            $cat_name = "&nbsp;&nbsp;&nbsp;";
+                        }
+
+                        $pop_width = !empty($f[4]) ? $f[4] : 200 ;
+                        $pop_height = !empty($f[5]) ? $f[5] : 300 ;
+                        $edit_width = !empty($f[6]) ? $f[6] : 400 ;
+                        $edit_height = !empty($f[7]) ? $f[7] : 500 ;
+
+                        $out[$outcount]["value"] .= "
+                            <script language=\"JavaScript1.2\">
+                                <!--
+                                    function category_select_popup_".$field[0]."( target )
+                                        {
+                                            // Pass values to the calendar
+
+                                        tempX = 400;
+                                        tempY = 300;
+
+                                        node_id = this.document.getElementById( target ).value;
+                                        var theUrl='".BASE_APP_URL."Common/Registrations_V3/front-end/category_select_popup.phtml?id=' + node_id + '&field_name=".$field[0]."&table=".$f[1]."&options=".urlencode($f[3])."&edit_width=".$edit_width."&edit_height=".$edit_height."&pop_width=".$pop_width."&pop_height=".$pop_height."&ref_id=".$id."';
+
+                                        tempX = tempX - 90;
+                                        //tempY = tempY - 170;
+
+                                        if (navigator.appName == 'Netscape')
+                                            {
+                                            CategoryWind = window.open( theUrl, 'Calendar','scrollbars=yes,toolbar=no,resizable=yes,width=".$pop_width.",height=".$pop_height.",screenx=' + tempX + ',screeny=' + tempY,1 );
+                                            }
+                                        else
+                                            {
+                                            CategoryWind = window.open( theUrl, 'Calendar','scrollbars=no,toolbar=no,resizable=no,width=".$pop_width.",height=".$pop_height.", top=' + tempY + ', left=' + tempX,1 );
+                                            }
+
+                                        CategoryWind.focus();
+                                        }
+                                -->
+                            </script>
+                            ";
+
+                        $out[$outcount]["value"] .= '<INPUT TYPE="text" NAME="'.$field[0].'_NAME" ID="'.$field[0].'_NAME" VALUE="'.$cat_name.'" READONLY="readonly" SIZE="'.$f[2].'" STYLE="background-color: #eeeeee;">
+                                                    <INPUT TYPE="hidden" NAME="'.$field[0].'" ID="'.$field[0].'" VALUE="'.$cat_id.'">
+                                                    <A HREF="javascript:category_select_popup_'.$field[0].'(\''.$field[0].'\')">[Change]</A>
+                                                    ';
+                    }
+
+                    break;
+
+
+                case "pointer":
+
+                    // If {value_field} supplied use that, otherwise use id of record as VALUE
+                    $value_field = !empty($f[3]) ? $f[3] : "id" ;
+
+                    // If {where} supplied use that, otherwise get all possibilities from other table
+                    $w = !empty($f[4]) ? " WHERE ".$f[4] : "" ;
+
+                    // If picklist options
+                    $p = !empty($f[5]) ? $f[5] : "" ;
+
+                    // Sort order
+                    $s = !empty($f[6]) ? $f[6] : "id" ;
+
+                    // Pointer options
+                    $pointer_option_add_field = FALSE;
+                    if( ! empty($f[7]) )
+                    {
+                        $option_table = explode_trim( ",", $f[7] );
+                        foreach( $option_table as $option )
+                        {
+                            switch( $option )
+                            {
+                                case "add_field":                        // Option to display a field for entering a new target
+                                    $pointer_option_add_field = TRUE;
+                                    break;
+
+                                default:
+                                    break;
+                            }
+                        }
+                    }
+
+                    switch( $field[3] )
+                    {
+
+                        case "TRUE":
+                        case "FALSE":
+
+                            $d = reg_db_auto_get_data( "SELECT * FROM  ".$f[1].$w." ORDER BY ".$s.";", $conn_str, FALSE, 500 );
+
+                            if( is_array( $d ) )
+                            {
+                                unset( $da );
+                                while( list($key, $val) = each($d) )
+                                $da[$val[$value_field]] = $val[$f[2]];
+
+                                // If there's a supplied value, use that to match for selected
+
+                                if( !empty($field_val) ) {
+                                    $z = $field_val;
+                                } else {
+                                    $z = $data[$field[0]];
+                                }
+
+                                $out[$outcount]["value"] = reg_build_picklist( $field[0], $da, $data[$field[0]], "standard", $p );
+                            }
+                            else
+                            $out[$outcount]["value"] = '(no values available)';
+
+                            // Provide an additional input field to permit adding a new target value
+
+                            if( $pointer_option_add_field )
+                            $out[$outcount]["value"] .= '<NOBR> or add new value <INPUT TYPE="text" NAME="'.$field[0].'_add_field"></NOBR>';
+
+                            break;
+
+                        case "HIDDEN":
+                        case "DISPLAY":
+
+                            // Get specific data requested
+                            if( ($d = db_auto_get_row( "SELECT * FROM ".$f[1]." WHERE id = ".$data[$field[0]]." ORDER BY ".$s.";", 0, $conn_str, $fail_mode  )) );
+
+                            $out[$outcount]["value"] = $d[$f[2]];
+
+                            break;
+
+                        case "SUPPLIED":
+                            $out[$outcount]["value"] = "";
+                            break;
+
+                        default:
+                            $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                            break;
+
+
+                    }
+                    break;
+
+
+                case "multipointer":
+
+                    // If {value_field} supplied use that, otherwise use id of record as VALUE
+                    $value_field = !empty($f[3]) ? $f[3] : "id" ;
+
+                    // If {where} supplied use that, otherwise get all possibilities from other table
+                    $w = !empty($f[4]) ? " WHERE ".$f[4] : "" ;
+
+                    // If picklist options
+                    $p = !empty($f[5]) ? $f[5] : "" ;
+
+                    // Sort order
+                    $s = !empty($f[6]) ? $f[6] : "id" ;
+
+                    // Get currently selected fields
+                    $mp_selected = reg_db_auto_get_data( "SELECT * FROM  ".$f[7]." WHERE ".$f[8]." = ".$id." ORDER BY ".$s.";", $conn_str, FALSE, 500 );
+                    $mp_sel = array();
+                    if (is_array($mp_selected) && count($mp_selected) > 0) {
+                        foreach ($mp_selected as $mp) {
+                            $mp_sel[] = $mp[$f[9]];
+                        }
+                    }
+
+                    switch( $field[3] )
+                    {
+
+                        case "TRUE":
+                        case "FALSE":
+
+                            $d = reg_db_auto_get_data( "SELECT * FROM  ".$f[1].$w." ORDER BY ".$s.";", $conn_str, FALSE, 500 );
+
+                            if( is_array( $d ) ) {
+                                unset( $da );
+                                while( list($key, $val) = each($d) ) {
+                                    $da[$val[$value_field]] = $val[$f[2]];
+                                }
+
+                                // If there's a supplied value, use that to match for selected
+
+                                if( !empty($field_val) ) {
+                                    $z = $field_val;
+                                } else {
+                                    $z = $data[$field[0]];
+                                }
+
+                                $out[$outcount]["value"] = reg_build_picklist( $field[0], $da, $mp_sel, "standard", $p." multi" );
+                            } else {
+                                $out[$outcount]["value"] = '(no values available)';
+                            }
+
+                            // Provide an additional input field to permit adding a new target value
+                            if( $pointer_option_add_field ) {
+                                $out[$outcount]["value"] .= '<NOBR> or add new value <INPUT TYPE="text" NAME="'.$field[0].'_add_field"></NOBR>';
+                            }
+
+                            break;
+
+                        case "HIDDEN":
+                        case "DISPLAY":
+echo "multipointer DISPLAY HIDDEN not available yet."; exit;
+
+                            // Get specific data requested
+                            if( ($d = db_auto_get_row( "SELECT * FROM ".$f[1]." WHERE id = ".$data[$field[0]]." ORDER BY ".$s.";", 0, $conn_str, $fail_mode  )) );
+
+                            $out[$outcount]["value"] = $d[$f[2]];
+
+                            break;
+
+                        case "SUPPLIED":
+echo "multipointer SUPPLIED not available yet."; exit;
+
+                            $out[$outcount]["value"] = "";
+                            break;
+
+                        default:
+                            $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                            break;
+
+
+                    }
+
+                    break;
+
+                case "checkbox":
+
+                    // Check for null value
+
+                    if( empty($data[$field[0]]) )
+                    $data[$field[0]] = "f";
+
+                    switch( $field[3] )    // {required} setting
+                    {
+
+                        case "TRUE":
+                        case "FALSE":
+                            $x = $data[$field[0]] == "t" ? " CHECKED" : "";
+                            $out[$outcount]["value"] = '<INPUT TYPE="checkbox" NAME="'.$field[0].'"'.$x.'>';
+                            break;
+
+                        case "HIDDEN":
+                        case "DISPLAY":
+                            $x = $data[$field[0]] == "t" ? "Yes" : "No";
+                            $out[$outcount]["value"] = $x;
+                            break;
+
+                        case "SUPPLIED":
+                            $out[$outcount]["value"] = "";
+                            break;
+
+                        default:
+                            $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                            break;
+                    }
+                    break;
+
+                case "bitmap":
+                    $bmap = explode_trim( "~", $f[1] );
+                    $out[$outcount]["value"] = "";
+                    switch( $field[3] )    // {required} setting
+                    {
+                        case "TRUE":
+                        case "FALSE":
+                            for( $i=0 ; $i<count($bmap) ; $i++ )
+                            if( $bmap[$i] != '' )
+                            {
+                                $x = $data[$field[0]] & pow( 2, $i ) ? " CHECKED" : "";        // Check if this bit set
+                                $out[$outcount]["value"] .= '<INPUT TYPE="checkbox" NAME="'.$field[0]."[$i]".'"'.$x.'>'.$bmap[$i].'<BR>';
+                            }
+                            break;
+
+                        case "HIDDEN":
+                        case "DISPLAY":
+                            for( $i=0 ; $i<count($bmap) ; $i++ )
+                            if( $bmap[$i] != ' ' )
+                            {
+                                $x = $data[$field[0]] & pow( 2, $i ) ? "Yes" : "No";        // Check if this bit set
+                                $out[$outcount]["value"] .= $x.": ".$bmap[$i].'<BR>';
+                            }
+                            break;
+
+                        case "SUPPLIED":
+                            $out[$outcount]["value"] = "";
+                            break;
+
+                        default:
+                            $out[$outcount]["value"] = '<FONT COLOR="red">Invalid {required} field specification</FONT>';
+                            break;
+                    }
+                    if( $out[$outcount]["value"] == '' )
+                    $out[$outcount]["value"] = '(no options listed)';
+                    break;
+
+                case "list":
+
+                    // If picklist options
+                    $p = !empty($f[3]) ? $f[3] : "" ;
+
+                    $option_table = "";
+                    $opts = explode_trim( "~", $f[1] );    // Separate list options
+                    $def_value = !empty($f[2]) ? $f[2] : "" ;
+
+                    // If there's no current value, use default for current picklist option
+
+                    if( trim($data[$field[0]]) == "" )
+                    $current_value = $f[2];
+                    else
+                    $current_value = $data[$field[0]];
+
+                    foreach( $opts as $opt )
+                    {
+                        $os = explode_trim( "^", $opt );    // Separate value from displayed text
+                        $option_table[$os[0]] = $os[1];
+                    }
+
+                    switch( $field[3] )    // {required} setting
+                    {
+                        case "DISPLAY":
+                            $out[$outcount]['value'] = $option_table[$data[$field[0]]];
+                            break;
+                        default:
+                            if( strstr( 'multi', $f[3] ) )
+                            $data[$field[0]] = explode( '~', $data[$field[0]] );
+                            $out[$outcount]["value"] = reg_build_picklist( $field[0], $option_table, $data[$field[0]], "standard", $p );
+                            break;
+                    }
+                    break;
+
+                case "state":
+                    switch( $field[3] )    // {required} setting
+                    {
+                        case "DISPLAY":
+                            $out[$outcount]['value'] = $GLOBALS['si_states_array'][$data[$field[0]]];
+                            break;
+                        default:
+                            $out[$outcount]["value"] = reg_build_picklist( $field[0], $GLOBALS['si_states_array'], $data[$field[0]], "standard", $f[2] );
+                    }
+                    break;
+
+                case "country":
+                    switch( $field[3] )    // {required} setting
+                    {
+                        case "DISPLAY":
+                            $out[$outcount]['value'] = $GLOBALS['si_states_array'][$data[$field[0]]];
+                            break;
+                        default:
+                            $out[$outcount]["value"] = reg_build_picklist( $field[0], $GLOBALS['si_countries_array'], $data[$field[0]], "standard", $f[2] );
+                    }
+                    break;
+
+                case "break":
+                    if( !empty($f[1]) )    // if {t1} is supplied
+                    $out[$outcount]["value"] = $f[1];
+                    else
+                    $out[$outcount]["value"] = '<FONT COLOR="red">No {text} supplied for type "break"</FONT>';
+                    break;
+
+                default:
+                    $out[$outcount]["value"] = '<FONT COLOR="red">UNKNOWN FIELD TYPE: '.$f[0].' for '.$field[0].'</FONT>';
+                    break;
+
+            } // switch( field )
+
+            $outcount++;
+        } // foreach( field )
+
+    }
+    else
+    {
+        $ret .=  '    <CENTER>(No results found)</CENTER>
+            <P>
+            ';
+        return;
+    }
+
+    $submit = '
+            <INPUT TYPE="hidden" NAME="Action" VALUE="'.$action.'">
+            <INPUT TYPE="submit" NAME="Option" VALUE="Update">
+            ';
+
+    // Replace parameters in Title
+
+    for( $i=0 ; $i<$outcount ; $i++ )
+    {
+        $a_title = preg_replace( "/\\{".$i."\\}/", $out[$i]["value"], $a_title );
+        $a_title = preg_replace( "/\\{encode:".$i."\\}/", urlencode($out[$i]["value"]), $a_title );
+    }
+
+    $a_title = preg_replace( "/\\{link_params\\}/", $link_params, $a_title );
+    $a_title = preg_replace( "/\\{form_params\\}/", $form_params, $a_title );
+
+    // Add QuickTip if provided
+
+    if( trim($quick_tip) != '' )
+    $a_title = quick_tip( $a_title, $quick_tip );
+
+    // Output Results
+
+    // Display top of page
+
+    $ret .=  '<CENTER>
+        <FORM ENCTYPE="multipart/form-data" ACTION="'.$url.'" METHOD="post" NAME="'.$form_name.'">
+            <INPUT TYPE="hidden" NAME="id" VALUE="'.$id.'">
+        ';
+
+    if( empty($view) )    // If there's no format spec in $view
+    {
+        $ret .=  '<CENTER>'.$a_title.'
+            <FONT COLOR="red">(Required fields in red)</FONT><BR>
+            <TABLE BORDER="'.$borders.'"'.($borders>0?' CELLPADDING="5"':'').'>
+                ';
+
+        for( $i=0 ; $i<$outcount ; $i++ )
+        {
+            if( !$out[$i]["hidden"] )
+            $ret .=  '<TR><TH ALIGN="right" VALIGN="top">'.$out[$i]["name"]
+            .'&nbsp;</TH><TD ALIGN="left">'.$out[$i]["value"].'&nbsp;</TD></TR>
+                    ';
+        }
+        $ret .=  '    <P>
+            </TABLE>'.$form_params.$submit;    // Output the Update submit button
+
+    }
+    else    // Otherwise use $view to output data
+    {
+        for( $i=0 ; $i<$outcount ; $i++ )
+        {
+            $view = preg_replace( "/\\{".$i."\\}/", $out[$i]["value"], $view );
+            $view = preg_replace( "/\\{encode:".$i."\\}/", urlencode($out[$i]["value"]), $view );
+        }
+        $view = preg_replace( "/\\{submit\\}/", $submit, $view );
+        $view = preg_replace( "/\\{link_params\\}/", $link_params, $view );
+        $view = preg_replace( "/\\{form_params\\}/", $form_params, $view );
+        $ret .=  '<CENTER>'.$a_title.$view;
+    }
+
+   $ret .=  '
+        </FORM>
+        </CENTER>
+        ';
+
+    return( array( 'text' => $ret, 'status' => true ) );
+
+}
+
+
+function admin_edit_record( $table, $conn_str, $id, $fields, $url, $action,
+$params, $a_title, $view = "", $options = "", $quick_tip = "", $id_field = "" )
+{
+
+    $r = admin_edit_record_r( $table, $conn_str, $id, $fields, $url, $action,
+    $params, $a_title, $view, $options, $quick_tip );
+    echo $r['text'];
+    return( $f['status'] );
+}
+
+
+
+
+// Update an edited record
+
+function admin_update_record_r( $table, $conn_str, $id, $fields, $url, $action, $params, $a_title, $view = "", $quick_tip = "", $id_field = "" )
+{
+
+    $ret = '';
+
+    if( empty($id_field) )
+        $id_field = 'id';
+
+
+    // Make all submitted parameters available
+
+    //    extract($GLOBALS[HTTP_POST_VARS]);
+    //    extract($GLOBALS[HTTP_GET_VARS]);
+    //    extract($GLOBALS[HTTP_POST_FILES]);
+
+    // Check for additional parameters that are passed
+
+    if( !empty($params) )
+    {
+        $param = explode_trim( "|", $params );    // Separate parameters
+        $link_params = $form_params = "";
+        foreach( $param as $p )
+        {
+            $x = explode_trim( ".", $p );    // Separate Names from Values
+            $link_params .= "&".$x[0]."=".urlencode($x[1]);
+            $form_params .= '<INPUT TYPE="hidden" NAME="'.$x[0].'" VALUE="'.$x[1].'">';
+        }
+    }
+
+    // Get the current data for reference and to make sure it exists
+    $query_string = "SELECT * FROM ".$table." WHERE ".$id_field." = ".$id.";";
+    if( $GLOBALS['reg_config']['debug'] >= 1 ) $ret .= "<PRE>admin_update_record()[".__LINE__."]: Get old record = $query_string</PRE><BR>";
+    $data = db_auto_get_row( $query_string, 0, $conn_str, $fail_mode );
+
+    $update_record = true;    // Assume update is going to succeed.
+
+    if( $data )
+    {
+
+        // Break out configuration data
+
+        $field_table = explode_trim( "|", $fields );
+
+        // Don't be surprised if last field is blank
+
+        if( trim($field_table[count($field_table)-1]) == "" )
+        array_pop( $field_table );
+
+        foreach( $field_table as $key => $r )
+        $field_table[$key] = explode_trim( ",", $r );
+
+        $result = $problem = $not_supplied = "";
+        $qs = '';
+
+        // For each field in the result
+
+        $comma = "";    // first parameter doesn't need a comma in front of it
+
+        $outcount = 0;
+        foreach( $field_table as $field )
+        {
+
+            $f = explode_trim( ".", $field[1] );
+            $fta = explode_trim( "~", $field[2] );
+            $field_title_only = $fta[0];
+
+            if ($f[0] == 'richtext' && $f[3] != '') {
+                switch ($f[3]) {
+                    case 'encoded':
+                        $filter = FILTER_SANITIZE_ENCODED;
+                        break;
+                    default:
+                        $filter = FILTER_SANITIZE_STRING;
+                }
+                $field_val = filter_request($field[4],$filter);
+            } else {
+                $field_val = filter_request($field[4]);
+            }
+
+            if( $field[3] != 'DISPLAY' )        // Don't even try to process a DISPLAY only field. No point to it!
+            switch( $f[0] )
+            {
+
+                case "order":
+                case "int":
+                case "float":
+                case "fixed":
+                case "money":
+                case "pointer":
+                case "category":
+
+                    // Handle special cases
+                    switch( $f[0] )
+                    {
+                        case "money":
+                            $field_val = preg_replace( "/[\$,]/", "", $field_val );    // Get rid of "$" and "," from silly users
+                            break;
+
+                        case "pointer":
+
+                            // Check for add_field values - Add new value to pointer target record
+
+                            if( ($add_value = trim(filter_request($field[4].'_add_field'))) != '' )
+                            {
+                                // If value already exists warn user.
+
+                                if( db_auto_get_row( "SELECT * FROM ".$f[1]." WHERE ".$f[2]." = '".trim(filter_request($field[4].'_add_field'))."';", 0, $conn_str, $fail_mode ) )
+                                $not_supplied .= $field_title_only.": Value already exists in pick list, don't try to add it again.<BR>";
+                                else
+                                {
+                                    // Otherwise, add new value and use pointer to that
+
+                                    $add_result = db_auto_get_row( "INSERT INTO ".$f[1]." ( ".$f[2]." ) VALUES ( '".trim(filter_request($field[4].'_add_field'))."' );
+                                                                        SELECT currval( '".$f[1]."_id_seq' ) AS id;", 0, $conn_str, $fail_mode );
+                                    $cv = $add_result['id'];
+                                }
+                            }
+
+                            break;
+                    }
+
+                    $qs .= $comma." ".$field[0]." = ";        // Add field name to update to query string
+                    $comma = ",";
+                    $out[$outcount]["value"] = $field_val;
+                    switch( $field[3] )
+                    {
+                        case "SUPPLIED":
+                            $qs .= $field_val;
+                            break;
+
+                        case "TRUE":
+                            if( !is_numeric($field_val) ) {
+                                $not_supplied .= $field_title_only.": Not Supplied<BR>";
+                            } else {
+                                $qs .= $field_val;
+                            }
+                            break;
+
+                        case "FALSE":
+                            if( is_numeric($field_val) ) {
+                                $qs .= $field_val;
+                            } else {
+                                $qs .= "0";    // Default to 0
+                            }
+                            break;
+
+                        default:
+                            $problem .= '<FONT COLOR="red">ERROR: Invalid "Required" field name "'.$field[3].'" in function call</FONT><BR>';
+                            break;
+                    }
+                    break;
+
+                case "lat":
+                    $qs .= $comma." ".$field[0]." = ";
+                    $comma = ",";
+
+                    // If we've been passed a decimal degree value
+                    if( empty($field_val) ) {
+                        if( filter_request($field[4].'_DEG') > 90 || filter_request($field[4].'_DEG') < 0 || filter_request($field[4].'_MIN') >= 60 || filter_request($field[4].'_MIN') < 0 )
+                        {
+                            $not_supplied .= $field_title_only.": Invalid entry. Degrees must be 0 to 90 and Minutes must be 0 to less than 60<BR>";
+                            break;
+                        }
+                        $v = ( filter_request($field[4].'_NS') == "N" ? 1 : -1 ) * ( filter_request($field[4].'_DEG') + ( filter_request($field[4].'_MIN') / 60 ) );
+                    }
+                    $fw = 2;
+                    // Rebuild value for display
+                    if( $f[1] > 0 ) {
+                        $fw = $f[1];
+                    }
+                    $ns = 'N';
+                    if( ($v2=$field_val) < 0 ) {
+                        $ns = 'S';
+                        $v2 = -1 * $v2;
+                    }
+                    $dv = (int) $v2;
+                    $mv = ( $v2 - $dv ) * 60;
+                    $out[$outcount]["value"] = sprintf( "%s %d&deg; %01.".$fw."f'", $ns, $dv, $mv );
+                    switch( $field[3] )
+                    {
+                        case "SUPPLIED":
+                        case "FALSE":
+                            $qs .= $field_val;
+                            break;
+
+                        case "TRUE":
+                            if( empty($field_val) ) {
+                                $not_supplied .= $field_title_only.": Not Supplied<BR>";
+                            } else {
+                                $qs .= $field_val;
+                            }
+                            break;
+
+                        case "UNIQUE":
+                            if( db_auto_get_row( "SELECT * FROM $table WHERE ".$field[0]." = $field_val;", 0, $conn_str, $fail_mode ) ) {
+                                $not_supplied .= $field_title_only.": Already exists, must be unique<BR>";
+                            }
+                            $qs .= $field_val;
+                            break;
+
+                        case "UNIQUE_NOT_REQ":
+                            if( !empty($field_val) && db_auto_get_row( "SELECT * FROM $table WHERE ".$field[0]." = $v;", 0, $conn_str, $fail_mode ) ) {
+                                $not_supplied .= $field_title_only.": Already exists, must be unique<BR>";
+                            }
+                            $qs .= $field_val;
+                            break;
+
+                        default:
+                            $problem .= '<FONT COLOR="red">ERROR: Invalid "Required" field  name "'.$field[3].'" in function call</FONT><BR>';
+                            break;
+                    }
+                    break;
+
+                case "lon":
+                    $qs .= $comma." ".$field[0]." = ";
+                    $comma = ",";
+
+                    // If we've been passed a decimal degree value
+                    if( empty($field_val) ) {
+                        if( filter_request($field[4].'_DEG') > 180 || filter_request($field[4].'_DEG') < 0 || filter_request($field[4].'_MIN') >= 60 || filter_request($field[4].'_MIN') < 0 )
+                        {
+                            $not_supplied .= $field_title_only.": Invalid entry. Degrees must be 0 to 180 and Minutes must be 0 to less than 60<BR>";
+                            break;
+                        }
+                        $v = ( filter_request($field[4].'_NS') == "N" ? 1 : -1 ) * ( filter_request($field[4].'_DEG') + ( filter_request($field[4].'_MIN') / 60 ) );
+                    }
+                    $fw = 2;
+                    // Rebuild value for display
+                    if( $f[1] > 0 ) {
+                        $fw = $f[1];
+                    }
+                    $ns = 'E';
+                    if( ($v2=$field_val) < 0 ) {
+                        $ns = 'W';
+                        $v2 = -1 * $v2;
+                    }
+                    $dv = (int) $v2;
+                    $mv = ( $v2 - $dv ) * 60;
+                    $out[$outcount]["value"] = sprintf( "%s %d&deg; %01.".$fw."f'", $ns, $dv, $mv );
+                    switch( $field[3] )
+                    {
+                        case "SUPPLIED":
+                        case "FALSE":
+                            $qs .= $field_val;
+                            break;
+
+                        case "TRUE":
+                            if( empty($field_val) ) {
+                                $not_supplied .= $field_title_only.": Not Supplied<BR>";
+                            } else {
+                                $qs .= $field_val;
+                            }
+                            break;
+
+                        case "UNIQUE":
+                            if( db_auto_get_row( "SELECT * FROM $table WHERE ".$field[0]." = $field_val;", 0, $conn_str, $fail_mode ) ) {
+                                $not_supplied .= $field_title_only.": Already exists, must be unique<BR>";
+                            }
+                            $qs .= $field_val;
+                            break;
+
+                        case "UNIQUE_NOT_REQ":
+                            if( !empty($field_val) && db_auto_get_row( "SELECT * FROM $table WHERE ".$field[0]." = $v;", 0, $conn_str, $fail_mode ) ) {
+                                $not_supplied .= $field_title_only.": Already exists, must be unique<BR>";
+                            }
+                            $qs .= $field_val;
+                            break;
+
+                        default:
+                            $problem .= '<FONT COLOR="red">ERROR: Invalid "Required" field  name "'.$field[3].'" in function call</FONT><BR>';
+                            break;
+                    }
+
+                    break;
+
+                case "text":
+                case "inet":
+                case "list":
+                case "state":
+                case "country":
+                case "url":
+                case "textbox":
+                case "richtext":
+
+                    // Check for special cases
+                    switch( $f[0] )
+                    {
+                        case "inet":
+                            if( ($r = clean_input( $field[0], 'inet' )) != '' ) {
+                                $problem .= '<FONT COLOR="red">'.$field_title_only.': Not a valid IP address or netmask.</FONT><BR>';
+                            }
+                            break;
+
+                        case "list":
+                            // If 'multi' is selected for picklist option, then compile results from array
+                            if( strstr( $f[3], 'multi' ) )
+                            {
+                                $m_val = $sep = '';
+
+                                // Place results in '~' separated string for storage.
+
+                                $cv = $_REQUEST[$field[4]];
+                                if( is_array($cv) )
+                                foreach( $cv as $m )
+                                {
+                                    $m_val .= $sep.$m;
+                                    $sep = '~';
+                                }
+                                $field_val = $m_val;
+                            }
+
+                            break;
+
+                        default:
+                            break;
+                    }
+
+                    $v = str_replace( "%27", "\'", $field_val );
+                    if( trim(strip_tags($v)) == '' ) {
+                        $v = '';
+                    }
+                    $qs .= $comma." ".$field[0]." = ";        // Add field name to update to query string
+                    $comma = ",";
+                    $out[$outcount]["value"] = $v;
+
+                    switch( $field[3] )
+                    {
+                        case "SUPPLIED":
+                            $qs .= "'".rawurldecode( $v )."'";
+                            break;
+
+                        case "TRUE":
+                            if( empty($v) ) {
+                                $not_supplied .= $field_title_only.": Not Supplied<BR>";
+                            } else {
+                                $qs .= "'".rawurldecode( $v )."'";
+                            }
+                            break;
+
+
+                        case "UNIQUE":
+                            if( $f[0] != text ) {
+                                $problem .= '<FONT COLOR="red">ERROR: UNIQUE only available for type "text"</FONT><BR>';
+                                break;
+                            }
+
+                            if( empty($field_val) ) {
+                                $not_supplied .= $field_title_only.": Not Supplied<BR>";
+                            } else {
+                                $qs .= "'".rawurldecode($field_val)."'";
+                            }
+
+                            // Check if value is used anywhere other than current record
+
+                            if( db_auto_get_row( "SELECT * FROM $table WHERE ".$field[0]." = '".rawurldecode( trim($v) )."' AND ".$id_field." != ".$id.";", 0, $conn_str, $fail_mode ) ) {
+                                $not_supplied .= $field_title_only.": Already exists, must be unique<BR>";
+                            }
+
+                            break;
+
+                        case "UNIQUE_NOT_REQ":
+                            if( $f[0] != text ) {
+                                $problem .= '<FONT COLOR="red">ERROR: UNIQUE only available for type "text"</FONT><BR>';
+                                break;
+                            }
+
+                            if( !empty($field_val) ) {
+                                $qs .= "'".rawurldecode($field_val)."'";
+
+                                // Check if value is used anywhere other than current record
+
+                                if( db_auto_get_row( "SELECT * FROM $table WHERE ".$field[0]." = '".rawurldecode( trim($v) )."' AND ".$id_field." != ".$id.";", 0, $conn_str, $fail_mode ) ) {
+                                    $not_supplied .= $field_title_only.": Already exists, must be unique<BR>";
+                                }
+                            } else {
+                                $qs .= "''";
+                            }
+
+                            break;
+
+
+                        case "FALSE":
+                            $qs .= "'".rawurldecode( $v )."'";
+                            break;
+
+                        default:
+                            $problem .= '<FONT COLOR="red">ERROR: Invalid "Required" field  name "'.$field[3].'" in function call</FONT><BR>';
+                            break;
+                    }
+
+                    break;
+
+                case "date":
+
+                    // If a date is supplied, correct any date errors
+                    if ($field_val != '') {
+                        $field_val = date('m/d/Y', strtotime($field_val));
+                    }
+
+                    $qs .= $comma." ".$field[0]." = ";        // Add field name to update to query string
+                    $comma = ",";
+                    $out[$outcount]["value"] = $field_val;
+
+                    if( trim($field_val) == "" ) {            // Empty dates must be "NULL"
+                        $dval = "NULL";
+                    } else {
+                        $dval = "'".$field_val."'";
+                    }
+
+                    switch( $field[3] )
+                    {
+                        case "SUPPLIED":
+                            $qs .= $dval;
+                            break;
+
+                        case "TRUE":
+                            if( empty($field_val) ) {
+                                $not_supplied .= $field_title_only.": Not Supplied<BR>";
+                            } else {
+                                $qs .= $dval;
+                            }
+                            break;
+
+
+                        case "UNIQUE":
+                            if( $field[1] != text ) {
+                                $problem .= '<FONT COLOR="red">ERROR: UNIQUE only available for type "text"</FONT><BR>';
+                                break;
+                            }
+
+                            if( empty($field_val) ) {
+                                $not_supplied .= $field_title_only.": Not Supplied<BR>";
+                            } else {
+                                $qs .= $dval;
+
+                                // Check if value is used anywhere other than current reccord
+
+                                if( db_auto_get_row( "SELECT * FROM $table WHERE ".$field[0]." = '".trim($field_val)."' AND ".$id_field." <> ".$id.";", 0, $conn_str, $fail_mode ) ) {
+                                    $not_supplied .= $field_title_only.": Already exists, must be unique<BR>";
+                                }
+                            }
+
+                            break;
+
+                        case "UNIQUE_NOT_REQ":
+                            if( $field[1] != text ) {
+                                $problem .= '<FONT COLOR="red">ERROR: UNIQUE only available for type "text"</FONT><BR>';
+                                break;
+                            }
+
+                            if( !empty($field_val) )
+                            {
+                                $qs .= $dval;
+
+                                // Check if value is used anywhere other than current reccord
+
+                                if( db_auto_get_row( "SELECT * FROM $table WHERE ".$field[0]." = '".trim(filter_request($field[4]))."' AND ".$id_field." <> ".$id.";", 0, $conn_str, $fail_mode ) ) {
+                                    $not_supplied .= $field_title_only.": Already exists, must be unique<BR>";
+                                }
+                            } else {
+                                $qs .= $dval;
+                            }
+
+                            break;
+
+
+                        case "FALSE":
+                            $qs .= $dval;
+                            break;
+
+                        default:
+                            $problem .= '<FONT COLOR="red">ERROR: Invalid "Required" field  name "'.$field[3].'" in function call</FONT><BR>';
+                            break;
+                    }
+                    break;
+
+                case "multifield":
+
+                    $line = 0;
+                    $empty = TRUE;
+                    $m_data = array();
+
+                    // Build array of data to store
+                    while( isset( $_REQUEST[$field[4].'_'.($line+1).'_1'] ) ) {
+                        $line++;
+                        if( trim(filter_request($field[4].'_'.$line.'_1')) != '' ) {
+                            $a = array();
+                            for( $i=1 ; $i<=$f[1] ; $i++ ) {
+                                $a[$i-1] = stripslashes(trim( str_replace("%27", "\'", filter_request($field[4].'_'.($line).'_'.$i) ) ));
+                                if( $a[$i-1] != '' )
+                                $empty = FALSE;
+                            }
+                            array_push( $m_data, $a );
+                        }
+                    }
+
+                    if( !$empty ) {
+                        $v = serialize( $m_data );
+                    } else {
+                        $v = '';
+                    }
+
+                    $qs .= $comma." ".$field[0]." = "; // Add field name to update to query string
+                    $comma = ",";
+                    $out[$outcount]["value"] = $v;
+
+                    switch ($field[3])
+                    {
+                        case "TRUE" :
+                            if (empty ($v))
+                            $not_supplied .= $field_title_only.": Not Supplied<BR>";
+                            else
+                            $qs .= "'".rawurldecode($v)."'";
+                            break;
+
+                        case "FALSE" :
+                            $qs .= "'".rawurldecode($v)."'";
+                            break;
+
+                        default :
+                            $problem .= '<FONT COLOR="red">ERROR: Invalid "Required" field  name "'.$field[3].'" in function call</FONT><BR>';
+                            break;
+                    }
+
+                    break;
+
+                case "image":
+                    // Note that the image field is only updated when required so field name is set below along with value
+                    $out[$outcount]["value"] = "IMAGES Not Available for View at this time";
+                    $img = filter_request($field[4]);
+
+                    switch( $field[3] )
+                    {
+                        case "SUPPLIED":
+                            $problem .= '<FONT COLOR="red">ERROR: "SUPPLIED" not permitted as option for image input</FONT>';
+                            break;
+
+                        case "TRUE":
+
+                            // If no image is supplied and there's no image in the database
+                            if( !is_array($img) && $data[$field[0]] == "" ) {
+                                $not_supplied .= $field_title_only.": Not Supplied<BR>";
+                                break;
+                            }
+
+                            // If new image is supplied, replace old one
+                            if( $img['name'] != '' ) {
+                                if( $data[$field[0]] != "" ) {
+                                    reg_delete_image( $data[$field[0]] );
+                                }
+                                $qs .= $comma." ".$field[0]." = '".reg_process_image($field[4])."'";
+                                $comma = ",";
+                            }
+                            break;
+
+                        case "FALSE":
+
+                            // If new image is supplied, store it
+                            if( $img['name'] != '' ) {
+                                if( $data[$field[0]] ) {       // If there's already an image, delete it before storing the new one
+                                    reg_delete_image( $data[$field[0]] );
+                                }
+                                $qs .= $comma." ".$field[0]." = '".reg_process_image($field[4])."'";
+                                $comma = ",";
+
+                            // Else, if there's an image in the database and we're deleting
+                            } elseif( $data[$field[0]] != "" && isset($_REQUEST[$field[0]."_DELETE"])  ) {
+                                reg_delete_image( $data[$field[0]] );
+                                $qs .= $comma." ".$field[0]." = ''";    // Clear image name in database
+                                $comma = ",";
+                            }
+
+                            break;
+
+                        default:
+                            $problem .= '<FONT COLOR="red">ERROR: Invalid "Required" field  name "'.$field[3].'" in function call</FONT><BR>';
+                            break;
+                    }
+                    break;
+
+                case "images":
+/* NOT CONFIGURED FOR Image Server
+                    // Note that the image field is only updated when required so field name is set below along with value
+
+                    $out[$outcount]["value"] = "IMAGES Not Available for View at this time";
+                    switch( $field[3] )
+                    {
+                        case "FALSE":
+                            if( is_array( ($im_data = filter_request($field[4])) ) )
+                            {
+                                $im_cur = unserialize( $data[$field[0]] );        // Convert existing data to an array
+                                $im_new = array();
+                                $im_new_num = 0;
+                                for( $im_num=0 ; $im_num<count($GLOBALS[$field[0]."_name"]) ; $im_num++ )
+                                {
+                                    // If new image is supplied, store it
+                                    if( $GLOBALS[$field[0]."_name"][$im_num] != "" )
+                                    {
+                                        if( $im_cur[$im_num]['filename'] )        // If there's already an image, delete it before storing the new one
+                                        reg_delete_image( $im_cur[$im_num]['filename'] );
+                                        $im_new[$im_new_num]['filename'] = reg_process_image( $GLOBALS[$field[0]][$im_num] );
+                                        $im_new[$im_new_num]['descr'] = $GLOBALS[$field[0].'_DESCR'][$im_num];
+                                        $im_new[$im_new_num]['align'] = $GLOBALS[$field[0].'_ALIGN'][$im_num];
+                                        $im_new[$im_new_num]['size'] = $GLOBALS[$field[0].'_SIZE'][$im_num];
+                                        $im_new_num++;
+                                    }
+                                    // Else, if there's an image in the database and we're deleting
+                                    elseif( $im_cur[$im_num]['filename'] != "" && isset( $GLOBALS[$field[0]."_DELETE"][$im_num] )  )
+                                    reg_delete_image( $im_cur[$im_num]['filename'] );
+                                    elseif( $im_cur[$im_num]['filename'] != "" )
+                                    {
+                                        $im_new[$im_new_num]['filename'] = $im_cur[$im_num]['filename'];
+                                        $im_new[$im_new_num]['descr'] = $GLOBALS[$field[0].'_DESCR'][$im_num];
+                                        $im_new[$im_new_num]['align'] = $GLOBALS[$field[0].'_ALIGN'][$im_num];
+                                        $im_new[$im_new_num]['size'] = $GLOBALS[$field[0].'_SIZE'][$im_num];
+                                        $im_new_num++;
+                                    }
+                                }
+                                $qs .= $comma." ".$field[0]." = '".serialize( $im_new )."'";
+                                $comma = ",";
+                            }
+
+                            break;
+
+                        case "TRUE":
+                        case "SUPPLIED":
+                        default:
+                            $problem .= '<FONT COLOR="red">ERROR: Invalid "Required" field  name "'.$field[3].'" in function call</FONT><BR>';
+                            break;
+                    }
+*/
+                    break;
+
+                case "file":
+
+                    // Note that the file field is only updated when required so field name is set below along with value
+
+                    $out[$outcount]["value"] = "FILES Not Available for View at this time";
+
+                    // Check if file type is specified and if so does it match
+
+                    if( isset($f[1]) && (filter_request($field[4]."_name") != "") && !preg_match( "/.".$f[1]."$/i",filter_request($field[4]."_name")) ) {
+                        $not_supplied .= $field_title_only.': "'.filter_request($field[4]."_name").'" is not correct file type. Must be:  '.$f[1]."<BR>";
+                        break;
+                    }
+
+                    switch( $field[3] )
+                    {
+                        case "SUPPLIED":
+                            $problem .= '<FONT COLOR="red">ERROR: "SUPPLIED" not permitted as option for file input</FONT>';
+                            break;
+
+                        case "TRUE":
+
+                            // If no file is supplied and there's no file in the database
+
+                            if( filter_request($field[4]."_name") == "" && $data[$field[0]] == "" ) {
+                                $not_supplied .= $field_title_only.": Not Supplied<BR>";
+                                break;
+                            }
+
+                            // If new file is supplied, replace old one
+                            if( filter_request($field[4]."_name") != "" ) {
+                                if( $data[$field[0]] != "" ) {
+                                    reg_file_delete( $data[$field[0]] );
+                                }
+                                $qs .= $comma." ".$field[0]." = '".reg_file_upload($field[4])."'";
+                                $comma = ",";
+                            }
+                            break;
+
+                        case "FALSE":
+
+                            // If new file is supplied, store it
+
+                            if( filter_request($field[4]."_name") != "" ) {
+                                if( $data[$field[0]] ) {       // If there's already a file, delete it before storing the new one
+                                    reg_file_delete( $data[$field[0]] );
+                                }
+                                $qs .= $comma." ".$field[0]." = '".reg_file_upload($field[4])."'";
+                                $comma = ",";
+                            // Else, if there's a file in the database and we're deleting
+                            } elseif( $data[$field[0]] != "" && isset($GLOBALS[$field[0]."_DELETE"]) ) {
+                                reg_file_delete( $data[$field[0]] );
+                                $qs .= $comma." ".$field[0]." = ''";    // Clear file name in database
+                                $comma = ",";
+                            }
+
+                            break;
+
+                        default:
+                            $problem .= '<FONT COLOR="red">ERROR: Invalid "Required" field  name "'.$field[3].'" in function call</FONT><BR>';
+                            break;
+                    }
+                    break;
+
+
+                case "checkbox":
+                    // Doesn't matter whether it's required or not, or whatever
+                    $qs .= $comma." ".$field[0]." = ";        // Add field name to update to query string
+                    $comma = ",";
+                    if( filter_request($field[4]) == "on" ) {
+                        $out[$outcount]["value"] = "Yes";
+                        $qs .= "TRUE";
+                    } else {
+                        $out[$outcount]["value"] = "No";
+                        $qs .= "FALSE";
+                    }
+                    break;
+
+
+                case "bitmap":
+                    $out[$outcount]["value"] = "Bitmaps not available for view at this time";
+                    $qs .= $comma." ".$field[0]." = ";        // Add field name to update to query string
+                    $comma = ",";
+                    $bm = $field_val;
+                    $b = 0;        // Start with clear bitmap
+                    for( $i=0 ; $i<SI_INT_SIZE ; $i++ ) {      // Bitmaps are based on the size of an integer
+                        if( isset($bm[$i]) && $bm[$i] == "on" )    // If checked
+                        $b = $b + pow(2,$i);            // Set bit
+                    }
+
+                    $qs .= $b;
+                    break;
+
+                case "multipointer":
+
+                    // Delete all previously selection options
+                    $m_qs = "DELETE FROM ".$f[7]." WHERE ".$f[8]." = ".$id.";\n";
+
+                    // Insert any new selections
+                    if (is_array($_REQUEST[$field[0]]) && count($_REQUEST[$field[0]]) > 0) {
+                        foreach ($_REQUEST[$field[0]] as $mps) {
+                            $m_qs .= "INSERT INTO ".$f[7]." (".$f[8].",".$f[9].") VALUES (".$id.",".($mps-0).");\n";
+                        }
+
+                    }
+                    reg_db_auto_exec( $m_qs, $conn_str, FALSE );
+
+                    break;
+
+                default:
+                    $problem .= '<FONT COLOR="red">UNKNOWN FIELD TYPE: '.$field[1].' for '.$field[0].'</FONT><BR>';
+                    break;
+
+            } // switch( field )
+
+            $outcount++;
+        } // foreach( field )
+
+    } else {
+        $ret .= '    <CENTER>(Record not found)</CENTER>
+            <P>
+            ';
+        return( array( 'text' => $ret, 'status' => false ) );
+    }
+
+    if( !empty($not_supplied) ) {
+        $result .= '    <H2>Required fields not supplied</H2><P>
+            <FONT COLOR="red">'.$not_supplied.'</FONT><P>
+            Use "BACK" button on browser, add missing data and resubmit.<P>
+            ';
+        $update_record = false;
+    }
+
+    if( !empty($problem) ) {
+        $result .= $problem.'<P>
+            Use "BACK" button on browser, correct problem field, and resubmit.<P>
+            ';
+        $update_record = false;
+    }
+
+    if( $update_record && $qs != '' ) {
+        $qs = "UPDATE $table SET $qs WHERE ".$id_field." = $id;";
+        if ($GLOBALS['reg_config']['debug'] >= 1 ) $ret .= "<PRE>admin_update_record()[".__LINE__."]: Update record = $qs</PRE><BR>";
+        reg_db_auto_exec( $qs, $conn_str, FALSE );
+        $result .= '<P><H2>Data updated.</H2><P>';
+    }
+
+    // Replace parameters in Title
+
+    for( $i=0 ; $i<$outcount ; $i++ ) {
+        $a_title = preg_replace( "/\\{".$i."\\}/", $out[$i]["value"], $a_title );
+        $a_title = preg_replace( "/\\{encode:".$i."\\}/", urlencode($out[$i]["value"]), $a_title );
+    }
+
+    $a_title = preg_replace( "/\\{link_params\\}/", $link_params, $a_title );
+    $a_title = preg_replace( "/\\{form_params\\}/", $form_params, $a_title );
+    $a_title = preg_replace( "/\\{result\\}/", $result, $a_title );
+
+    // Add QuickTip if provided
+
+    if( trim($quick_tip) != '' )
+    $a_title = quick_tip( $a_title, $quick_tip );
+
+    // Display top of page
+
+    $ret .= '<CENTER>
+        '.$a_title."\n";
+
+    if( empty($view) ) {   // If there's no spec in $view
+        $ret .= $result;
+    } else {
+        for( $i=0 ; $i<$outcount ; $i++ )
+        {
+            $view = preg_replace( "/\\{".$i."\\}/", $out[$i]["value"], $view );
+            $view = preg_replace( "/\\{encode:".$i."\\}/", urlencode($out[$i]["value"]), $view );
+        }
+        $view = preg_replace( "/\\{999\\}/", $out[999]["value"], $view );
+        $view = preg_replace( "/\\{link_params\\}/", $link_params, $view );
+        $view = preg_replace( "/\\{form_params\\}/", $form_params, $view );
+        $view = preg_replace( "/\\{result\\}/", $result, $view );
+        $ret .= $view;
+    }
+
+    $ret .= '
+        </CENTER>
+        ';
+
+    return( array( 'id' => $id, 'text' => $ret, 'status' => $update_record ) );
+
+}
+
+function admin_update_record( $table, $conn_str, $id, $fields, $url, $action, $params, $a_title, $view = "", $quick_tip = "", $id_field = "" )
+{
+    $r = admin_update_record_r( $table, $conn_str, $id, $fields, $url, $action, $params, $a_title, $view, $quick_tip );
+    echo $r['text'];
+    return( $r['status'] );
+}
+
+
+
+
+// Ask for the deletion of a record
+
+function admin_delete_record_r( $table, $conn_str, $id, $fields,
+$options, $url, $action, $params, $a_title, $view="", $quick_tip="" )
+{
+
+    $ret = '';
+
+    // Break out configuration data
+
+    $field_table = explode_trim( "|", $fields );
+
+    // Don't be surprised if last field is blank
+
+    if( trim($field_table[count($field_table)-1]) == "" ) {
+        array_pop( $field_table );
+    }
+
+    foreach( $field_table as $key => $r ) {
+        $field_table[$key] = explode_trim( ",", $r );
+    }
+
+    // Check for additional parameters that are passed
+
+    if( !empty($params) ) {
+        $param = explode_trim( "|", $params );    // Separate parameters
+        $link_params = $form_params = "";
+        foreach( $param as $p ) {
+            $x = explode_trim( ".", $p );    // Separate Names from Values
+            $link_params .= "&".$x[0]."=".urlencode($x[1]);
+            $form_params .= '<INPUT TYPE="hidden" NAME="'.$x[0].'" VALUE="'.$x[1].'">';
+        }
+    }
+
+    // Scan options
+
+    $option_strong = FALSE;
+    if( !empty($options) ) {
+        $option_table = explode_trim( ",", $options );
+        foreach( $option_table as $option ) {
+            switch( $option ) {
+                case "strong":
+                    $option_strong = TRUE;
+                    break;
+
+                default:
+                    //                    $ret .=  '<H2><FONT COLOR="red">ERROR: Illegal Option Specified</FONT></H2>';
+                    break;
+            }
+        }
+    }
+
+
+    // Get the data
+
+    $query_string = "SELECT * FROM ".$table." WHERE id = $id;";
+    if( $GLOBALS['reg_config']['debug'] >= 1 ) $ret .=  "<PRE>admin_delete_record()[".__LINE__."]: Record to delete = $query_string</PRE><BR>";
+    $data = db_auto_get_row( $query_string, 0, $conn_str, $fail_mode );
+    $problem = '';
+
+    if( $data )
+    {
+
+        // For each field in the result
+
+        $outcount = 0;    // replaceable field data table pointer
+        foreach( $field_table as $field )
+        {
+            $f2 = explode_trim( "~", $field[2] );
+            $out[$outcount]["name"] = $f2[0];
+            $out[$outcount]["display"] = $field[3] != "HIDDEN" ? TRUE : FALSE;
+            $f = explode_trim( ".", $field[1] );        // Extract type options
+            switch( $f[0] )
+            {
+                // Check other tables for references to this record
+
+                case "check":
+                    if( $f[1] == '' || $f[2] == '' )
+                    {
+                        $problem .= '<FONT COLOR="red">'.$field[0].': Table or Field name not supplied for reference check.</FONT><BR>';
+                        break;
+                    }
+                    if( ($c = db_auto_get_row( "SELECT count(".$f[2].") FROM ".$f[1]." WHERE ".$f[2]." = $id;" )) && $c['count'] > 0 )
+                    {
+                        $problem .= '<FONT COLOR="red">This reccord is referenced '.$c['count'].' time(s) by "'.$f2[0].'". Delete References first.</FONT><BR>';
+                        break;
+                    }
+
+                    break;
+
+                case "money":
+                    $out[$outcount]["value"] = "$".sprintf( "%01.2f", $data[$field[0]] );
+                    break;
+
+                case "order":
+                case "int":
+                case "float":
+                case "fixed":
+                    $out[$outcount]["value"] = $data[$field[0]];
+                    break;
+
+                case "checkbox":
+                    $out[$outcount]["value"] = $data[$field[0]] == 't' ? 'Yes' : 'No';
+                    break;
+
+                case "text":
+                case "inet":
+                case "state":
+                case "country":
+                case "textbox":
+                case "richtext":
+                case "date":
+                    $out[$outcount]["value"] = $data[$field[0]];
+                    break;
+
+                case "checkbox":
+                    $out[$outcount]["value"] = $data[$field[0]] == "t" ? "Yes" : "No" ;
+                    break;
+                case "url":
+                    $out[$outcount]["value"] = '<A HREF="'.$data[$field[0]].'">'.$data[$field[0]].'</A>';
+                    break;
+
+                case "category":
+                    // Get the category name for this field if supplied
+                    if( !empty($data[$field[0]]) )
+                    {
+                        if( $cval = db_auto_get_row( "SELECT * FROM ".$f[1]." WHERE id = ".$data[$field[0]].";", 0, $conn_str, FALSE ) )
+                        $out[$outcount]["value"] = $cval['name'];
+                        else
+                        $out[$outcount]["value"] = '<FONT COLOR="red">Unknown Category</FONT>';
+                    }
+                    else
+                    {
+                        $out[$outcount]["value"] = "&nbsp;";
+                    }
+                    break;
+
+                case "pointer":
+                    // If {value_field} supplied use that, otherwise use id of record as value to match
+                    $value_field = !empty($f[3]) ? $f[3] : "id" ;
+
+                    // If {where} supplied use that, otherwise get all possibilities from other table
+                    $w = !empty($f[4]) ? " WHERE ".$f[4] : " WHERE ".$value_field." = ".$data[$field[0]] ;
+
+                    $pval = db_auto_get_row(
+                        "SELECT * FROM ".$f[1].$w.";",
+                    0, $conn_str, $fail_mode );
+                    $out[$outcount]["value"] = $pval[$f[2]];
+                    break;
+
+                default:
+                    $out[$outcount]["value"] = '<FONT COLOR="red">UNKNOWN FIELD TYPE: '.$f[0].' for '.$field[0].'</FONT>';
+                    break;
+
+            } // switch( field )
+            $outcount++;
+        } // foreach( field )
+
+        // Confirm field and Submit button go into {submit}
+
+        if( $option_strong )
+        $submit = '<BR>
+                To confirm, type "Delete" below.<BR>
+                <FORM ACTION="'.$url.'" METHOD="post">
+                    <INPUT TYPE="hidden" NAME="id" VALUE="'.$id.'">
+                    <INPUT TYPE="hidden" NAME="Action" VALUE="'.$action.'">
+                    <INPUT TYPE="text" NAME="Confirm"><BR>
+                    <INPUT TYPE="hidden" NAME="Option" VALUE="Confirm Delete">
+                    <INPUT TYPE="submit" NAME="usingHiddenOption" VALUE="Confirm Delete">
+                    '.$form_params.'
+                </FORM>
+                ';
+        else
+        $submit = '
+                <FORM ACTION="'.$url.'" METHOD="post">
+                    <INPUT TYPE="hidden" NAME="id" VALUE="'.$id.'">
+                    <INPUT TYPE="hidden" NAME="Action" VALUE="'.$action.'">
+                    <INPUT TYPE="hidden" NAME="Confirm" VALUE="Delete"><BR>
+                    <INPUT TYPE="hidden" NAME="Option" VALUE="Confirm Delete">
+                    <INPUT TYPE="submit" NAME="usingHiddenOption" VALUE="Confirm Delete">
+                    '.$form_params.'
+                </FORM>
+                ';
+
+        // Replace parameters in Title
+
+        for( $i=0 ; $i<$outcount ; $i++ )
+        {
+            $a_title = preg_replace( "/\\{".$i."\\}/", $out[$i]["value"], $a_title );
+            $a_title = preg_replace( "/\\{encode:".$i."\\}/", urlencode($out[$i]["value"]), $a_title );
+        }
+
+        $a_title = preg_replace( "/\\{link_params\\}/", $link_params, $a_title );
+        $a_title = preg_replace( "/\\{form_params\\}/", $form_params, $a_title );
+        $a_title = preg_replace( "/\\{submit\\}/", $submit, $a_title );
+        $a_title = preg_replace( "/\\{result\\}/", $result, $a_title );
+
+
+        // Add QuickTip if provided
+
+        if( trim($quick_tip) != '' )
+        $a_title = quick_tip( $a_title, $quick_tip );
+
+
+        // Output results
+
+        if( empty($view) )    // If there's no format spec in $view
+        {
+            $ret .=  '<CENTER>'.$a_title.'
+                <P>
+                <H2>Are you sure you want to delete this information?</H2>
+                <TABLE BORDER="1">
+                ';
+            for( $i=0 ; $i<$outcount ; $i++ )
+            {
+                if( $out[$i]["display"] )
+                $ret .=  '<TR><TH ALIGN="right" VALIGN="top">'.$out[$i]["name"]
+                .'&nbsp;</TH><TD ALIGN="left">'.$out[$i]["value"].'&nbsp;</TD></TR>
+                        ';
+            }
+            $ret .=  '    <P>
+                </TABLE>'.$submit;    // Output the Confirm field and submit button
+
+        }
+        else    // Otherwise use $view to output data
+        {
+            for( $i=0 ; $i<$i ; $i++ )
+            {
+                $view = preg_replace( "/\\{".$i."\\}/", $out[$i]["value"], $view );
+                $view = preg_replace( "/\\{encode:".$i."\\}/", urlencode($out[$i]["value"]), $view );
+            }
+            $view = preg_replace( "/\\{link_params\\}/", $link_params, $view );
+            $view = preg_replace( "/\\{form_params\\}/", $form_params, $view );
+            $view = preg_replace( "/\\{submit\\}/", $submit, $view );
+            $view = preg_replace( "/\\{result\\}/", $result, $view );
+            $ret .=  '<CENTER>'.$a_title.$view;
+        }
+
+        if( $problem != '' )
+        {
+            $ret = '<CENTER>'.$a_title.$problem.'</CENTER>';
+            return( array( 'text' => $ret, 'status' => false ) );
+        }
+
+    } // if( $data )
+    else
+    $ret .=  '    <CENTER>(No results found)</CENTER>
+            <P>
+            ';
+
+
+
+    $ret .=  '</CENTER>
+        ';
+
+    return( array( 'text' => $ret, 'status' => true ) );
+
+}
+
+function admin_delete_record( $table, $conn_str, $id, $fields,
+$options, $url, $action, $params, $a_title, $view="", $quick_tip="" )
+{
+    $r = admin_delete_record_r( $table, $conn_str, $id, $fields,
+    $options, $url, $action, $params, $a_title, $view, $quick_tip );
+    echo $r['text'];
+    return( $r['status'] );
+}
+
+
+// Delete a record if confirmed
+
+function admin_confirm_delete_record_r( $table, $conn_str, $id, $fields, $url,
+$action, $params, $a_title, $view = "", $quick_tip = "", $id_field = "" )
+{
+
+    $ret = '';
+
+    // Make all submitted parameters available
+
+    //    extract($GLOBALS[HTTP_POST_VARS]);
+    //    extract($GLOBALS[HTTP_GET_VARS]);
+
+    // Check for additional parameters that are passed
+    if( !empty($params) ) {
+        $param = explode_trim( "|", $params );    // Separate parameters
+        $link_params = $form_params = "";
+        foreach( $param as $p ) {
+            $x = explode_trim( ".", $p );    // Separate Names from Values
+            $link_params .= "&".$x[0]."=".urlencode($x[1]);
+            $form_params .= '<INPUT TYPE="hidden" NAME="'.$x[0].'" VALUE="'.$x[1].'">';
+        }
+    }
+
+    // Check "Confirm" field for correct text
+
+    $result = "";
+    $delete_record = TRUE;        // Assume that we're going to delete this record
+    if( $_REQUEST['Confirm'] == "Delete" )
+    {
+
+        // Get the current data for reference and to make sure it exists
+
+        $query_string = "SELECT * FROM $table WHERE id = $id;";
+        if( $GLOBALS['reg_config']['debug'] >= 1 ) $ret .=  "<PRE>admin_confirm_delete_record()[".__LINE__."]: Record to delete = $query_string</PRE><BR>";
+        $data = db_auto_get_row( $query_string, 0, $conn_str, $fail_mode );
+
+        // Separate field title from QuickTip in case we need it
+        $fta = explode_trim( "~", $field[2] );
+        $field_title_only = $fta[0];
+
+
+        if( $data ) {
+
+            $not_delete_message = "";
+
+            if( trim($fields) != "" ) {   // If there's any check fields
+
+                // Break out configuration data
+
+                $field_table = explode_trim( "|", $fields );
+
+                // Don't be surprised if last field is blank
+
+                if( trim($field_table[count($field_table)-1]) == "" ) {
+                    array_pop( $field_table );
+                }
+
+                foreach( $field_table as $key => $r ) {
+                    $field_table[$key] = explode_trim( ",", $r );
+                }
+
+                // For each check field specified
+
+                foreach( $field_table as $field ) {
+                    $f = explode_trim( ".", $field[1] );
+                    switch( $f[0] )
+                    {
+                        case "reference":    // Check to see if this record is referenced
+                            if( db_auto_get_row( "SELECT id FROM ".$f[1]." WHERE ".$f[2]." = $id;", 0, $conn_str, $fail_mode ) )
+                            {
+                                $result .= '<FONT COLOR="red">Can\'t delete this information. You must delete '.$field[2].' first.</FONT><BR>';
+                                $delete_record = FALSE;
+                            }
+                            break;
+
+                        case "image":
+                            reg_delete_image( $data[$field[0]] );
+                            break;
+
+                        default:
+                            $result .= '<FONT COLOR="red">UNKNOWN FIELD TYPE: '.$f[0].' for '.$field[0].'</FONT><BR>';
+                            $delete_record = FALSE;
+                            break;
+
+                    } // switch( field )
+
+                } // foreach( field )
+            }
+        } // if data
+        else
+        {
+            $result .= '<H2><FONT COLOR="red">Record not found</FONT></H2><BR>';
+            $delete_record = FALSE;
+        }
+
+
+    } // if Confirm
+    else
+    {
+        $result .= '<H2>Delete <FONT COLOR="red">NOT</FONT> Confirmed.</H2>';
+        $delete_record = FALSE;
+    }
+
+
+    if( $delete_record )
+    {
+        $qs = "DELETE FROM ".$table." WHERE id = ".$id.";";
+        if( $GLOBALS['reg_config']['debug'] >= 1 ) $ret .=  "<PRE>admin_confirm_delete_record()[".__LINE__."]: Delete Record = $qs</PRE><BR>";
+        reg_db_auto_exec( $qs, $conn_str, FALSE );
+        $result .= '<P><H2>Record Deleted.</H2>';
+    }
+    else
+    $result .= '<P><H2>Not deleting this record</H2><P>
+            <FONT COLOR="red" SIZE="4">'.$not_delete_message.'</FONT><P>
+            ';
+
+    // Make replacements in $a_title
+
+    $a_title = preg_replace( "/\\{result\\}/", $result, $a_title );
+    $a_title = preg_replace( "/\\{link_params\\}/", $link_params, $a_title );
+    $a_title = preg_replace( "/\\{form_params\\}/", $form_params, $a_title );
+
+    // Add QuickTip if provided
+
+    if( trim($quick_tip) != '' )
+    $a_title = quick_tip( $a_title, $quick_tip );
+
+    // Display top of page
+
+    $ret .=  '<CENTER>
+        '.$a_title.'
+            ';
+
+    if( empty($view) )
+    $ret .=  $result;
+    else
+    {
+        $view = preg_replace( "/\\{result\\}/", $result, $view );
+        $view = preg_replace( "/\\{link_params\\}/", $link_params, $view );
+        $view = preg_replace( "/\\{form_params\\}/", $form_params, $view );
+        $ret .=  $view;
+    }
+
+    $ret .=  '
+        </CENTER>
+        ';
+
+
+    return( array( 'text' => $ret, 'status' => $delete_record ) );
+
+
+}
+
+function admin_confirm_delete_record( $table, $conn_str, $id, $fields, $url,
+$action, $params, $a_title, $view = "", $quick_tip = "", $id_field = "" )
+{
+    $r = admin_confirm_delete_record_r( $table, $conn_str, $id, $fields, $url,
+    $action, $params, $a_title, $view, $quick_tip );
+    echo $r['text'];
+    return( $r['status'] );
+}
+
+
+
+
+// View the data in a record
+
+function admin_view_record_r( $table, $conn_str, $id, $fields,
+$url, $action, $params, $a_title, $view="", $options = "", $quick_tip = "", $id_field = '' )
+{
+
+    $ret = '';
+
+    if( empty($id_field) )
+        $id_field = 'id';
+
+    // Check for any options
+
+    $borders = strstr( $options, "borders" ) ? 1 : 0;        // Show table borders
+    $nocenter = strstr( $options, "nocenter" ) ? 1 : 0;        // Don't output <center></center> tags around content
+
+    // Break out configuration data
+
+    $field_table = explode_trim( "|", $fields );
+
+    // Don't be surprised if last field is blank
+
+    if( trim($field_table[count($field_table)-1]) == "" )
+    array_pop( $field_table );
+
+    // Check for additional parameters that are passed
+
+    if( !empty($params) )
+    {
+        $param = explode_trim( "|", $params );    // Separate parameters
+        $link_params = $form_params = "";
+        foreach( $param as $p )
+        {
+            $x = explode_trim( ".", $p );    // Separate Names from Values
+            $link_params .= "&".$x[0]."=".urlencode($x[1]);
+            $form_params .= '<INPUT TYPE="hidden" NAME="'.$x[0].'" VALUE="'.$x[1].'">';
+        }
+    }
+
+    // Get the data
+
+    $qs = "SELECT * FROM $table WHERE ".$id_field." = $id;";
+    if( $GLOBALS['reg_config']['debug'] >= 1 ) $ret .=  "<PRE>admin_view_record()[".__LINE__."]: View Record = $qs</PRE><BR>";
+    $data = db_auto_get_row( $qs, 0, $conn_str, $fail_mode );
+
+    if( $data )
+    {
+        // For each field in the result
+
+        for( $res_field=0 ; $res_field<count($field_table) ; $res_field++ )
+        {
+            $field = explode_trim( ",", $field_table[$res_field] );
+            $f = explode_trim( ".", $field[1] );
+            $out[$res_field]["hidden"] = preg_match( "/hidden/", $field_table[$res_field] );    // Check for .hidden
+
+            // Check for pop-up-tips
+
+            $n = explode_trim( '~', $field[2] );
+            if( count($n) > 1 ) {
+                // setup tip display - requires show_QuickTip() and hide_QuickTip() functions from java_functions.js
+
+                $out[$res_field]["name"]  = quick_tip( '<font color="'.$field_name_color.'">'.$n[0].'</font>', $n[1] );
+            } else {
+                $out[$res_field]["name"] = $field[2];
+            }
+
+            $out[$res_field]['field'] = $field[0];
+
+            switch( $f[0] )
+            {
+
+                case "lat":
+                    $fw = 2;
+                    if( $f[1] > 0 ) {
+                        $fw = $f[1];
+                    }
+                    $ns = 'N';
+                    if( $data[$field[0]] < 0 ) {
+                        $ns = 'S';
+                        $data[$field[0]] = -1 * $data[$field[0]];
+                    }
+                    $dv = (int) $data[$field[0]];
+                    $mv = ( $data[$field[0]] - $dv ) * 60;
+                    $out[$res_field]["value"] = sprintf( "%s %d&deg; %01.".$fw."f'", $ns, $dv, $mv );
+                    break;
+
+                case "lon":
+                    $fw = 2;
+                    if( $f[1] > 0 ) {
+                        $fw = $f[1];
+                    }
+                    $ns = 'E';
+                    if( $data[$field[0]] < 0 ) {
+                        $ns = 'W';
+                        $data[$field[0]] = -1 * $data[$field[0]];
+                    }
+                    $dv = (int) $data[$field[0]];
+                    $mv = ( $data[$field[0]] - $dv ) * 60;
+                    $out[$res_field]["value"] = sprintf( "%s %d&deg; %01.".$fw."f'", $ns, $dv, $mv );
+                    break;
+
+                case "money":
+                    $out[$res_field]["value"] = "$".sprintf( "%01.2f", $data[$field[0]] );
+                    break;
+
+                case "fixed":
+                    $fw = 2;
+                    if( $f[1] > 0 ) {
+                        $fw = $f[1];
+                    }
+                    $out[$res_field]["value"] = sprintf( "%01.".$fw."f", $data[$field[0]] );
+                    break;
+
+                case "text":
+                case "inet":
+                case "textbox":
+                    $out[$res_field]["value"] = $data[$field[0]];
+                    break;
+
+                case "richtext":
+                    if (trim($data[$field[0]]) != '') {
+                        $out[$res_field]["value"] = '<div style="border: 1px solid gray; width: 95%; min-height: 20px; padding: 0 5px 0;">'.$data[$field[0]].'</div>';
+                    } else {
+                        $out[$res_field]["value"] = '( no text supplied )';
+                    }
+                    break;
+
+                case "rawtext":
+                    $out[$res_field]["value"] = $data[$field[0]];
+                    break;
+
+                case "order":
+                case "int":
+                case "date":
+                case "float":
+                    $out[$res_field]["value"] = $data[$field[0]];
+                    break;
+
+                case "url":
+                    $out[$res_field]["value"] = '<A HREF="'.$data[$field[0]].'">'.$data[$field[0]].'</A>';
+                    break;
+
+                case "category":
+                    // Get the category name for this field is supplied
+                    if( !empty($data[$field[0]]) ) {
+                        if( $cval = db_auto_get_row( "SELECT * FROM ".$f[1]." WHERE id = ".$data[$field[0]].";", 0, $conn_str, FALSE ) ) {
+                            $out[$res_field]["value"] = $cval['name'];
+                        } else {
+                            $out[$res_field]["value"] = '<FONT COLOR="red">Unknown Category</FONT>';
+                        }
+                    } else {
+                        $out[$res_field]["value"] = "&nbsp;";
+                    }
+                    break;
+
+                case "pointer":
+
+                    if( !empty($data[$field[0]]) ) {
+                        // If {where} supplied use that, otherwise match "id" field
+                        $w = !empty($f[4]) ? " WHERE ".$f[4] : " WHERE id = ".$data[$field[0]] ;
+                        $comma = '';
+                        if( ($pvals = reg_db_auto_get_data( "SELECT * FROM ".$f[1].$w.";", $conn_str, $fail_mode )) ) {
+                            foreach( $pvals as $pval ) {
+                                $out[$res_field]["value"] .= $comma.$pval[$f[2]];
+                                $comma = ', ';
+                            }
+                        } else {
+                            $out[$res_field]["value"] = '';
+                        }
+                    } else {
+                        $out[$res_field]["value"] = '';
+                    }
+
+                    break;
+
+                case "multipointer":
+
+                    $qs = "SELECT ".$f[2]." FROM ".$f[1]." WHERE id IN (SELECT ".$f[9]." FROM ".$f[7]." WHERE ".$f[8]." = $id) ORDER BY ".$f[2].";";
+                    $mp_data = reg_db_auto_get_data( $qs, $conn_str, FALSE, 500 );
+
+                    $out[$res_field]["value"] = '';
+                    $sep = '';
+                    if (is_array($mp_data)) {
+                        foreach ($mp_data as $mp) {
+                            $out[$res_field]["value"] .= $sep.$mp[$f[2]];
+                            $sep = '<br>';
+                        }
+                    }
+
+                    break;
+
+                case "multifield":        // NOT TESTED  multitext.numb_fields.new_line_string
+
+                    if( trim($f[2]) == '' ) {
+                        $out[$res_field]["value"] = '<FONT COLOR="RED">Missing multifield line specification</FONT>';
+                        break;
+                    }
+
+                    $v = '';
+
+
+                    // If there's data, then build existing input lines with data
+                    if( ( $x = trim($data[$field[0]]) ) != '' ) {
+                        $field_data = unserialize( $data[$field[0]] );
+
+                        if( $field_data != false && is_array( $field_data ) ) {
+
+                            // For each line of inputs
+                            for( $i=1 ; $i<=count($field_data) ; $i++ ) {
+                                $f_line = str_replace( '{line_numb}', ($i), $f[2] );        // Set line number in output text
+                                // For each input field on the line
+
+                                for( $j=1 ; $j<=$f[1] ; $j++ ) {
+                                    $f_line = str_replace( '{field_'.($j).'}', $field_data[$i-1][$j-1], $f_line );
+                                }
+
+                                $v .= $f_line;
+
+                            }
+                        }
+                    }
+
+                    $out[$res_field]["value"] = $v;
+
+                    break;
+
+
+                case "image":
+                    if( !empty($data[$field[0]]) ) {
+                        switch( $f[1] )
+                        {
+                            case "o":    $img_url = ORIGINAL;    break;
+                            case "r":    $img_url = RESIZED;        break;
+                            case "m":    $img_url = MIDSIZED;    break;
+                            case "t":    $img_url = THUMB;        break;
+                            default:     $img_url = "none";         break;
+                        }
+                        if( $img_url != "none" ) {
+                            $out[$res_field]["value"] = '<IMG SRC="'.$img_url."/".$data[$field[0]].'">';
+                        } else {
+                            $out[$res_field]["value"] = '<FONT COLOR="RED">Invalid Image Size</FONT>';
+                        }
+                    } else {
+                        $out[$res_field]["value"] = '(no image)';
+                    }
+                    break;
+
+                case "images":
+/* NOT CONFIGURED FOR Image Server
+                    if( !empty($data[$field[0]]) )
+                    {
+                        if( $img_url != "none" )
+                        {
+                            $images = unserialize( $data[$field[0]] );
+                            foreach( $images as $im )
+                            {
+                                switch( !empty($im['size']) ? $im['size'] : $f[1] )
+                                {
+                                    case "o":    $img_url = SI_IMG_ORIGINAL_URL;    break;
+                                    case "r":    $img_url = SI_IMG_RESIZED_URL;    break;
+                                    case "m":    $img_url = SI_IMG_MIDSIZED_URL;    break;
+                                    case "t":    $img_url = SI_IMG_THUMB_URL;    break;
+                                    default:     $img_url = "none";         break;
+                                }
+                                $out[$res_field]["value"] = '<IMG SRC="'.$img_url."/".$im['filename'].'"><BR>'.$im['descr'];
+                            }
+                        }
+                        else
+                        $out[$res_field]["value"] = '<FONT COLOR="RED">Invalid Image Size</FONT>';
+                    }
+                    else
+                    $out[$res_field]["value"] = '(no image)';
+*/
+                    break;
+
+                case "file":
+                    $out[$res_field]["value"] = '<a href="'.FILE_SERVER_URL.IS_OWNER_ID.'/_ORIGINAL_/'.$data[$field[0]].'" target="file_page">'.$data[$field[0]].'</a>';
+                    break;
+
+
+                case "checkbox":
+                    $x = $data[$field[0]] == "t" ? "Yes" : "No";
+                    $out[$res_field]["value"] = $x;
+                    break;
+
+                case "bitmap":
+                    $bmap = explode_trim( "~", $f[1] );
+                    $out[$res_field]["value"] = '<TABLE BORDER="0">';
+                    for( $j=0 ; $j<count($bmap) ; $j++ ) {
+                        if( $bmap[$j] != ' ' ) {
+                            $d = $data[$field[0]] & pow( 2, $j ) ? "Yes" : "No";        // Check if this bit set
+                            $out[$res_field]["value"] .= '<TR><TD>'.$bmap[$j].'</TD><TD>'.$d.'</TD></TR>';
+                        }
+                    }
+                    $out[$res_field]["value"] .= '</TABLE>';
+                    break;
+
+                case "list":
+                    $option_table = "";
+                    $opts = explode_trim( "~", $f[1] );    // Separate list options
+                    $def_value = !empty($f[2]) ? $f[2] : "" ;
+                    foreach( $opts as $opt ) {
+                        $os = explode_trim( "^", $opt );    // Separate value from displayed text
+                        $option_table[$os[0]] = $os[1];
+                    }
+                    // In case there's multiple options, display results of all selected options with comma separators
+                    $x = explode( '~', $data[$field[0]] );
+                    $out[$res_field]["value"] = $sep = '';
+                    if( is_array($x) ) {
+                        foreach( $x as $y ) {
+                            $out[$res_field]["value"] .= $sep.$option_table[$y];
+                            $sep = ', ';
+                        }
+                    }
+                    break;
+
+                case "state":
+                    $out[$res_field]["value"] = $GLOBALS['si_states_array'][$data[$field[0]]];
+                    break;
+
+                case "country":
+                    $out[$res_field]["value"] = $GLOBALS['si_countries_array'][$data[$field[0]]];
+                    break;
+
+                case "break":
+                    if( !empty($f[1]) ) {   // if {t1} is supplied
+                        $out[$res_field]["value"] = $f[1];
+                    } else {
+                        $out[$res_field]["value"] = '<FONT COLOR="red">No break name or {text} supplied for type "break"</FONT>';
+                    }
+                    break;
+
+                default:
+                    $out[$res_field]["value"] = '<FONT COLOR="red">UNKNOWN FIELD TYPE: '.$x[0].' for '.$f[0].'</FONT>';
+                    break;
+
+            } // switch( field type )
+        } // foreach( field )
+
+    // if( $data )
+    } else {
+        return( array( 'text' => 'No Data Found', 'status' => false ) );
+    }
+
+    // Replace parameters in title and view
+
+    reset( $out );
+    while( list ($k, $v) = each($out) ) {
+        $a_title = preg_replace( "/\\{".$v['field']."\\}/", $v["value"], $a_title );
+        $view = preg_replace( "/\\{".$v['field']."\\}/", $v["value"], $view );
+        $a_title = preg_replace( "/\\{encode:".$v['field']."\\}/", urlencode($v["value"]), $a_title );
+        $view = preg_replace( "/\\{encode:".$v['field']."\\}/", urlencode($v["value"]), $view );
+    }
+
+    $a_title = preg_replace( "/\\{link_params\\}/", $link_params, $a_title );
+    $a_title = preg_replace( "/\\{form_params\\}/", $form_params, $a_title );
+    $view = preg_replace( "/\\{link_params\\}/", $link_params, $view );
+    $view = preg_replace( "/\\{form_params\\}/", $form_params, $view );
+
+    // Add QuickTip if provided
+
+    if( trim($quick_tip) != '' )
+    $a_title = quick_tip( $a_title, $quick_tip );
+
+    // Display top of page
+
+    if( !$nocenter )
+    $ret .=  '<CENTER>';
+
+    $ret .=  "$a_title\n";
+
+    if( $data )
+    {
+        // Output results
+
+        if( empty($view) )    // If there's no format spec in $view
+        {
+            $ret .=  '<TABLE BORDER="'.$borders.'"'.($borders>0?' CELLPADDING="5"':'').'>
+                ';
+            reset( $out );
+            while( list( $k, $v ) = each($out) )
+            if( !$v["hidden"] )
+            $ret .=  '<TR><TH ALIGN="right" VALIGN="top">'.$v["name"].'&nbsp;</TH><TD ALIGN="left">'.$v["value"].'</TD></TR>
+                                        ';
+
+            $ret .=  '</TABLE>
+                ';
+        }
+        else    // Otherwise use $view to output data
+        $ret .=  $view;
+    }
+    else
+    $ret .=  '    <CENTER>(No results found)</CENTER>
+            <P>
+            ';
+
+    if( !$nocenter )
+    $ret .=  "</CENTER>\n";
+
+    return( array( 'text' => $ret, 'status' => true ) );
+
+}
+
+function admin_view_record( $table, $conn_str, $id, $fields,
+$url, $action, $params, $a_title, $view="", $options = "", $quick_tip = "", $id_field = '' )
+{
+
+    $r = admin_view_record_r( $table, $conn_str, $id, $fields,
+            $url, $action, $params, $a_title, $view, $options, $quick_tip, $id_field );
+    echo $r['text'];
+    return( $r['status'] );
+}
+
+
+
+
+// User login management
+
+function admin_user_login( $operation, $conn_str, $sess_code, $table, $id_field, $pw_field, $user_id = "", $password = "", $where = "" )
+{
+
+    $secret_code = "ApplesANDOranges";    // Secret code used to md5 encrypt everything
+
+    switch( $operation )
+    {
+
+        case "create":
+
+            // Get user information and create a session
+
+            $d = db_auto_get_row( "SELECT * FROM $table WHERE id = '$sess_code';", 0, $conn_str, FALSE );
+            if( !$d )
+            return( FALSE );
+
+            // Build MD5 string from User ID, timestamp, "id" field value and secret
+
+            $t = time();
+            $md5_string = md5( $d[$id_field].$t.$d["id"].$secret_code );
+
+            // Build output data
+
+            $d["session_code"] = $md5_string."-".$t."-".$d["id"];        // Session Code
+            $d["session_link"] = "&session_code=".$d["session_code"];    // Link format
+            $d["session_form"] = '<INPUT TYPE="hidden" NAME="session_code" VALUE="'.$d["session_code"].'">';    // Form format
+
+            return $d;
+
+
+            break;
+
+        case "login":
+
+            // Do sanity check
+
+            if( empty($user_id) || empty($password) || preg_match("/[,*']/", $user_id) || preg_match("/[,*']/", $password) )
+            return( FALSE );
+
+            // Check ID and Password against specified table
+
+            $d = db_auto_get_row( "SELECT * FROM $table WHERE $id_field = '$user_id' AND $pw_field = '$password'".($where!=''?' AND '.$where:'').";",
+            0, $conn_str, FALSE );
+            if( !$d )
+            return( FALSE );
+
+            // Build MD5 string from User ID, timestamp, "id" field value and secret
+
+            $t = time();
+            $md5_string = md5( $d[$id_field].$t.$d["id"].$secret_code );
+
+            // Build output data
+
+            $d["session_code"] = $md5_string."-".$t."-".$d["id"];        // Session Code
+            $d["session_link"] = "&session_code=".$d["session_code"];    // Link format
+            $d["session_form"] = '<INPUT TYPE="hidden" NAME="session_code" VALUE="'.$d["session_code"].'">';    // Form format
+
+            return $d;
+
+            break;
+
+        case "verify":
+
+            // Break apart session code - [0] = md5, [1] = timestamp, [2] = record id
+
+            $ses = explode_trim( "-", $sess_code );
+            if( count($ses) != 3 || !is_numeric($ses[2]) )            // If there's not 3 parts, or the id isn't numeric, then it's not a valid code
+            return( FALSE );
+
+            // Retrieve data record
+
+            $d = db_auto_get_row( "SELECT * FROM $table WHERE id = ".$ses[2].($where!=''?' AND '.$where:'').";", 0, $conn_str, FALSE );
+
+            if( !$d )                // If no results, then not a valid record id
+            return( FALSE );
+
+            // Check MD5 string for valid session
+
+            if( md5($d[$id_field].$ses[1].$d["id"].$secret_code) != $ses[0] )
+            return( FALSE );
+
+            // Check to see if session has timed out
+
+            if( $ses[1] + SI_SES_TIMEOUT < time() )
+            return( FALSE );
+
+            // Update Timestamp and MD5 string
+
+            $t = time();
+            $md5_string = md5( $d[$id_field].$t.$d["id"].$secret_code );
+
+            // Build output data
+
+            $d["session_code"] = $md5_string."-".$t."-".$d["id"];        // Session Code
+            $d["session_link"] = "&session_code=".$d["session_code"];    // Link format
+            $d["session_form"]  = '<INPUT TYPE="hidden" NAME="session_code" VALUE="'.$d["session_code"].'">';    // Form format
+
+            return( $d );
+
+            break;
+
+        default:
+            echo '<FONT COLOR="red">UNKNOWN user login operation</FONT>';
+            return( FALSE );
+            break;
+    }
+
+}
+
+
+
+function authorize_net_aim
+(
+$login, $key, $test, $conf_email, $merch_email,
+$amount, $card_num, $exp_date, $card_code, $currency = '',
+$fname = '', $lname = '', $company = '', $address = '', $city = '', $state = '', $zip = '', $country = '', $phone = '', $fax = '', $id = '', $ip = '', $tax_id = '',
+$email = '',
+$invoice = '', $descr ='', $header = '', $footer = '',
+$ship_fname = '', $ship_lname = '', $ship_company = '', $ship_address = '', $ship_city = '', $ship_state = '', $ship_zip = '', $ship_country = ''
+)
+{
+
+    /*
+        Authorize.net processing
+
+        Test card #
+
+        TEST CARD               CARD TYPE
+        NUMBER
+        370000000000002         American Express
+        6011000000000012        Discover
+        5424000000000015        MasterCard
+        4007000000027           Visa
+
+        */
+
+    // Make sure test is exactly 'FALSE' before conducting an actual transaction
+
+    switch( $test )
+    {
+        case 'LOCAL_TEST':
+        case 'LOCAL_FAIL':
+        case 'TRUE':
+        case 'FALSE':
+            break;
+
+        default:
+            echo 'APPLICATION ERROR: Authorize.Net test mode not properly defined.';
+            exit;
+            break;
+    }
+
+    // Compile submitted data
+
+    $submit_data = array
+    (
+    // Base required information                    Required
+
+        'x_version'                => '3.1',
+        'x_delim_data'            => 'TRUE',                    //    Yes
+        'x_delim_char'            => '|',
+        'x_encap_char'            => '',
+        'x_relay_response'        => 'FALSE',                    //    Yes
+        'x_test_request'        => $test,
+
+    // Merchant Account Information
+
+        'x_login'                => $login,                    //    Yes
+        'x_tran_key'            => $key,                    //    Yes
+
+    // Transaction parameters
+
+        'x_currency_code'        => '',
+        'x_method'                => 'CC',                    //    Yes        Options: CC, ( ECHECK not implemented )
+        'x_type'                => 'AUTH_CAPTURE',            //    Yes        Options: AUTH_CAPTURE, AUTH_ONLY, CAPTURE_ONLY, CREDIT, VOID, PRIOR_AUTH_CAPTURE
+        'x_amount'                => $amount,                    //    Yes
+
+    // If x_method = 'CC'
+
+        'x_card_num'            => $card_num,                    //    Yes
+        'x_exp_date'            => $exp_date,                //    Yes
+        'x_card_code'            => $card_code,
+
+    // Additional Customer information
+
+        'x_first_name'            => $fname,
+        'x_last_name'            => $lname,
+        'x_company'                => $company,
+        'x_address'                => $address,
+        'x_city'                => $city,
+        'x_state'                => $state,                    //            Verified if supplied
+        'x_zip'                    => $zip,
+        'x_country'                => $country,                //            Verified if supplied
+        'x_phone'                => $phone,
+        'x_fax'                    => $fax,
+        'x_cust_id'                => $id,
+        'x_customer_ip'            => $ip,
+        'x_customer_tax_id'        => $tax_id,
+
+    // E-Mail info for confirmation
+
+        'x_email'                => $email,                    //            Customer E-Mail
+        'x_email_customer'        => $conf_email,                //            IF TRUE customer will receive conf via E-Mail from Authorize.Net
+        'x_header_email_receipt'    => $header,                    //                Header to be included in conf E-Mail
+        'x_footer_email_receipt'    => $footer,                    //                Footer to be included in conf E-Mail
+        'x_merchant_email'        => $merch_email,                //            If supplied, merchant will receive conf via E-Mail
+
+    // Invoice
+
+        'x_invoice_num'            => $invoice,
+        'x_description'            => $descr,
+
+    // Shipping information
+
+        'x_ship_to_first_name'    => $ship_fname,
+        'x_ship_to_last_name'    => $ship_lname,
+        'x_ship_to_company'        => $ship_company,
+        'x_ship_to_address'        => $ship_address,
+        'x_ship_to_city'        => $ship_city,
+        'x_ship_to_state'        => $ship_state,
+        'x_ship_to_zip'            => $ship_zip,
+        'x_ship_to_country'        => $ship_country,
+
+
+    );
+
+    if( $GLOBALS['reg_config']['debug'] > 2 )
+    {
+        echo "<P>DEBUG: Authorize.Net Submit Array<BR><PRE>\n";
+        print_r($submit_data);
+        echo "\n</PRE><P>";
+    }
+
+    // Assemble above data into a string for posting
+
+    if( $GLOBALS['reg_config']['debug'] > 0 )
+    echo "<P>DEBUG: Authorize.Net Submit Array<BR><PRE><table><tr><th align=\"left\">Parameter</th><th align=\"left\">Value</th></tr>\n";
+
+    $postdata = $sep = '';
+    foreach($submit_data AS $key => $val)
+    {
+        $postdata .= $sep.urlencode( $key ).'='.urlencode( $val );
+        $sep = '&';
+        if( $GLOBALS['reg_config']['debug'] > 0 )
+        echo "<tr><td>$key</td><td>$val</td></tr>\n";
+    }
+
+    if( $GLOBALS['reg_config']['debug'] > 0 )
+    echo "</table></PRE><P>";
+
+    if( $GLOBALS['reg_config']['debug'] > 0 )
+    echo "<P>DEBUG: Authorize.Net Post String = $postdata<P>";
+
+    // If this is a local test, just return data, don't send to Authorize.Net
+
+    if( $test == 'LOCAL_TEST' || $card_num == '0011001100110011' )
+    {
+        return
+        (
+        array
+        (
+        0 => 1,                // Success
+        4 => 'Local Test',    // Approval Code
+        )
+        );
+    }
+
+    if( $test == 'LOCAL_FAIL' )
+    {
+        return
+        (
+        array
+        (
+        0 => 2,                // Decline
+        4 => 'Local Fail',    // Approval Code
+        )
+        );
+    }
+
+    // Submit Request
+
+    exec( AUTH_CURL.' -k -d '.escapeshellarg($postdata)." -P 443 --url ".escapeshellarg(AUTH_URL), $results, $return );
+
+    // Check for failures
+
+    if( $return == 1 )                // Exec failed - Code 100
+    return( array(0=>100) );
+
+    if( trim($results[0]) == '' )    // No data returned - Code 101
+    return( array(0=>101) );
+
+    // Break results up into an array
+
+    $res = explode( "|", $results[0] );
+    if( $GLOBALS['reg_config']['debug'] > 0 )
+    {
+        echo "<P>DEBUG: Authorize.Net Response Array<BR><PRE><table><tr><th align=\"left\">Parameter</th><th align=\"left\">Value</th></tr>\n";
+        reset( $res );
+        foreach($res AS $key => $val)
+        echo "<tr><td>$key</td><td>$val</td></tr>\n";
+        echo "</table></PRE><P>";
+    }
+
+    if( !is_array($res) )            // No good data from Authorize.net - Code 102
+    {
+        return( array(0=>102) );
+    }
+
+    // If MD5 Hash secret is provided, authenticate response from Authorize.Net
+
+    if( $config->event_registration->authorize_net->secret != '' )
+    {
+        $hash = md5( $config->event_registration->authorize_net->secret.$login.$key.round($amount, 2) );
+        if( $res[37] != $hash )
+        $res[0] = 103;            // Indicate MD5 Hash verification failure
+    }
+
+    // Return results
+
+    return( $res );
+
+}
+
+
+?>
diff --git a/front-end/reg_setup.php b/front-end/reg_setup.php
new file mode 100644 (file)
index 0000000..603e222
--- /dev/null
@@ -0,0 +1,1159 @@
+<?php
+
+switch ($_ENV['GLM_HOST_ID']) {
+case 'CHUCK' :
+    define('BASE_APP_URL', GLM_APP_BASE_URL);
+    define('BASE_APP_SECURE_URL', 'http://192.168.44.6/app.gaslightmedia.com/');
+    break;
+case 'DEVELOPMENT' : //    {{{
+    $glmAppBase = '/var/www/server/app.gaslightmedia.com/';
+    define('BASE_APP_URL', 'http://dev53.gaslightmedia.com/app.gaslightmedia.com/');
+    define('BASE_APP_SECURE_URL', 'https://dev53.gaslightmedia.com/app.gaslightmedia.com/');
+    break; //  }}}
+default :
+    define('BASE_APP_URL', 'http://app.gaslightmedia.com/');
+    define('BASE_APP_SECURE_URL', 'https://app.gaslightmedia.com/');
+    break;
+}
+
+// Check if we don't have BASE_URL from a site setup file already - Could be an app calendar request
+if (!isset($BASE_URL)) {
+    // Assume request from app
+    $BASE_URL = BASE_APP_URL;
+}
+
+/*
+ * Stuff required to make all the registration and MagicForm stuff work in Steve's world
+ */
+
+define( 'SI_DB_TYPE',            DB_TYPE );
+define( 'SI_BASE_PATH',          BASE_PATH );
+define( "SI_BASE_URL",           $BASE_URL );                        // URL to root of Web site
+define( "SI_BASE_FILE_URL",      SI_BASE_URL."/files" );
+define( "SI_BASE_FILE_PATH",     SI_BASE_PATH."files/" );
+
+define( "SI_THIS_SCRIPT",        BASE_URL.substr($CALLED_FROM_DIR,1)."/".$calling_script_name );            // The name of the calling script
+
+define( "SI_CONN_STR",           CONN_STR );
+define( "SI_DB_DATE_STYLE",      "SQL" );
+        // ISO         - use ISO 8601-style dates and times,                     "1997-12-17 07:37:16-08"
+        // SQL         - use Oracle/Ingres-style dates and times,                 "12/17/1997 07:37:16.00 PST"
+        // Postgres     - use traditional Postgres format,                     "Wed Dec 17 07:37:16 1997 PST"
+        // European     - use dd/mm/yyyy for numeric date representations., "17/12/1997 15:37:16.00 MET"
+        // US         - use mm/dd/yyyy for numeric date representations.,     "12/17/1997 07:37:16.00 PST"
+        // German     - use dd.mm.yyyy for numeric date representations.,     "17.12.1997 07:37:16.00 PST"
+define( 'SI_DB_STATIC',                       TRUE );                // If true database functions don't automatically close a connection and will re-use if possible
+define( "SI_DB_SET_DATE_STYLE_STRING",        "SET DATESTYLE TO '".SI_DB_DATE_STYLE."';\n" );
+define("SI_BASE_URL", BASE_URL );
+    // Graphics support
+
+define( "SI_GRPH_CONVERT",                  "/usr/bin/convert" );
+define( "SI_GRPH_DJPEG",                    "/usr/bin/djpeg ");
+define( "SI_GRPH_CJPEG",                    "/usr/bin/cjpeg ");
+define( "SI_GRPH_PNMSCALE",                 "/usr/bin/pnmscale ");
+define( "SI_GRPH_GIFTOPNM",                 "/usr/bin/giftopnm ");
+define( "SI_GRPH_PPMTOGIF",                 "/usr/bin/ppmtogif ");
+define( "SI_GRPH_PPMQUANT",                 "/usr/bin/ppmquant ");
+
+define( "SI_IMAGE_DIR",                     "images" );
+define( "SI_BASE_IMAGE_URL",                BASE_URL.SI_IMAGE_DIR );
+define( "SI_BASE_IMAGE_PATH",               BASE_PATH.SI_IMAGE_DIR );
+
+define( "SI_IMG_ORIGINAL_URL",              SI_BASE_IMAGE_URL."/original" );
+define( "SI_IMG_RESIZED_URL",               SI_BASE_IMAGE_URL."/resized" );
+define( "SI_IMG_MIDSIZED_URL",              SI_BASE_IMAGE_URL."/midsized" );
+define( "SI_IMG_THUMB_URL",                 SI_BASE_IMAGE_URL."/thumb" );
+
+define( "SI_IMG_ORIGINAL_PATH",             SI_BASE_IMAGE_PATH."/original" );
+define( "SI_IMG_RESIZED_PATH",              SI_BASE_IMAGE_PATH."/resized" );
+define( "SI_IMG_MIDSIZED_PATH",             SI_BASE_IMAGE_PATH."/midsized" );
+define( "SI_IMG_THUMB_PATH",                SI_BASE_IMAGE_PATH."/thumb" );
+define( "SI_POSTCARD_URL",                  SI_BASE_URL."/index.phtml" );
+
+define( "SI_RESIZED_SIZE",                  ITEM_RESIZED );
+define( "SI_MIDSIZED_SIZE",                 ITEM_MIDSIZED );
+define( "SI_THUMB_SIZE",                    ITEM_THUMB );
+
+    // Status Codes
+
+define( "SI_REG_STATUS_UNDEFINED",          0 );               // Undefined
+define( "SI_REG_STATUS_UNPAID",             1 );            // Unknown or unpaid
+define( "SI_REG_STATUS_CC_PEND",            2 );            // Paying by Credit Card - Card not run yet
+define( "SI_REG_STATUS_CC_PAID",            3 );            // Paid by Credit Card
+define( "SI_REG_STATUS_CC_DECL",            4 );            // Credit Card Declined
+define( "SI_REG_STATUS_CHECK_PEND",         5 );            // Pending Check
+define( "SI_REG_STATUS_CHECK_PAID",         6 );            // Paid by Check
+define( "SI_REG_STATUS_COMP",               7 );            // Comp or no payment
+define( "SI_REG_STATUS_AT_EVENT",           8 );            // Pay at event
+define( "SI_REG_STATUS_CASH_PAID",          9 );            // Paid Cash
+define( "SI_REG_STATUS_OTHER_ADMIN",        10 );           // Other payment method per admin user
+define( "SI_REG_STATUS_NO_CHARGE",                     11 );                   // No charges
+define( "SI_REG_STATUS_CALL_FROM_MERCHANT_PEND",         12 );            // Call from Merchant Pending
+define( "SI_REG_STATUS_CALL_FROM_MERCHANT_PAID",         13 );            // Call from Merchant Paid
+define( "SI_REG_STATUS_FAILED",             98 );           // Failed to store all of registration data or failed trying to process CC, process not completed
+define( "SI_REG_STATUS_CANCELED",           99 );           // Canceled
+
+$si_reg_status_array = array(
+       "UNDEFINED"                      => 0,
+    "UNPAID"             => 1,
+    "CC_PEND"            => 2,
+    "CC_PAID"            => 3,
+    "CC_DECL"            => 4,
+    "CHECK_PEND"         => 5,
+    "CHECK_PAID"         => 6,
+    "COMP"               => 7,
+    "AT_EVENT"           => 8,
+    "CASH_PAID"          => 9,
+    "OTHER_ADMIN"        => 10,
+       "NO_CHARGE"                      => 11,
+    "CALL_FROM_MERCHANT_PEND"         => 12,
+    "CALL_FROM_MERCHANT_PAID"         => 13,
+    "FAILED"             => 98,
+    "CANCELED"           => 99
+    );
+
+$si_reg_status_types = array
+    (
+    SI_REG_STATUS_UNDEFINED            => 'Not Specified',
+    SI_REG_STATUS_UNPAID               => 'Not Paid',
+    SI_REG_STATUS_CC_PEND              => 'Credit Card Pending',
+    SI_REG_STATUS_CC_PAID              => 'Paid by Credit Card',
+    SI_REG_STATUS_CC_DECL              => 'Credit Card Declined',
+    SI_REG_STATUS_CHECK_PEND           => 'Check Pending',
+    SI_REG_STATUS_CHECK_PAID           => 'Paid by Check',
+    SI_REG_STATUS_CASH_PAID            => 'Paid Cash',
+    SI_REG_STATUS_COMP                 => 'Complimentary',
+    SI_REG_STATUS_OTHER_ADMIN          => 'Other Payment Per Admin',
+    SI_REG_STATUS_NO_CHARGE                            => 'No Charge',
+    SI_REG_STATUS_CALL_FROM_MERCHANT_PEND              => 'Call from Merhant Pending',
+    SI_REG_STATUS_CALL_FROM_MERCHANT_PAID              => 'Paid via Call from Merchant',
+    SI_REG_STATUS_AT_EVENT             => 'Pay on arrival',
+    SI_REG_STATUS_FAILED                       => 'Submission Failed',
+    SI_REG_STATUS_CANCELED             => 'Canceled',
+    );
+$si_reg_status_list = $s = "";
+while( list($k, $v) = each($si_reg_status_types) )
+    {
+    $si_reg_status_list .= "$s$k^$v";
+    $s = "~";
+    }
+
+$si_pay_codes = array
+    (
+    'credit_card' => 'Credit Card',
+    'at_event' => 'At Event',
+    'by_check' => 'Check',
+    'cash' => 'Cash',
+    'paid_by_credit_card' => 'Pay by Credit Card',
+    'comp_code' => 'Comp Code',
+    'call_from_merchant' => 'Call from Merchant'
+    );
+
+$si_reg_field_types = array
+    (
+    1    => 'Checkbox',
+    2    => 'Number',
+    3    => 'Text',
+    4    => 'Text Box',
+    5    => 'Picklist',
+    6    => 'Radio Buttons',
+    20    => 'Section Title',
+    21    => 'Misc. Text'
+    );
+
+
+$si_cc_verify = array                // Values are regex test strings for card type
+    ( // *** Don't forget to correct the commas ***
+    "Visa"                => "/^4.{15}$|^4.{12}$/",                // 1 for cc_accepts bitmap
+    "MasterCard"        => "/^5[1-5].{14}$/",                      // 2
+    "American Express"    => "/^3[47].{13}$/",                     // 4
+    "Discover"            => "/^6011.{12}$/",                      // 8
+    "Diners Club"        => "/^30[0-5].{11}$|^3[68].{12}$/"        // 16
+    );
+
+    // $si_credit_cards string and $si_cc_array array are built from above
+    // Select and deselect cards used from above array.
+
+$si_credit_cards = $s = "";
+$si_cc_array = array();
+$i = 0;
+while( list($k, $v) = each($si_cc_verify) )
+    {
+    $si_credit_cards .= "$s$k";
+    array_push( $si_cc_array, $k );
+    $s = "~";
+    }
+
+$si_pay_by_types =
+    "
+    1^Credit Card~
+    2^Check~
+    3^Direct payment~
+    4^Call from Merchant
+    ";
+
+$si_conf_methods =
+    "
+    1^US Mail~
+    2^E-Mail
+    ";
+
+//  -----------------------------------------
+//    Authorize.Net Configuration
+//    -----------------------------------------
+
+define( 'AUTH_CURL',                 '/usr/bin/curl' );                        // Curl executable
+define( 'AUTH_URL',                    'https://secure.authorize.net/gateway/transact.dll' );        // Authorization URL
+
+//    ----------
+//    MagicForms
+//    ----------
+
+/*    field types
+        1    Checkbox
+        2    Number
+        3    Text
+        4    Text Box
+        5    Picklist
+        6    Radio Buttons
+        7    File Upload
+        20    Section Title
+        21    Misc. Text
+        22    Horizontal Line
+        23    Blank Line
+        24    Display Image
+        25    Download File
+        31    Calculated Field
+ */
+
+define( 'MF_TABLE',                        'registrations.magicform' );        // Table name for MagicForm fields
+define( 'MF_DATA_TABLE',                'registrations.mf_data' );            // Table name for MagicForm fields
+define( 'MF_SUBFORMS',                    true );                // Enable/disable Sub-Forms
+
+    // Field Format Definitions
+    // Note that {chars} gets replaced with # of characters or # of digits to the left of the decimal point and {prec} gets replaced with # of digits to the right of decimal point
+
+$mf_formats = array
+    (
+    'Default Format'        =>    array
+        (
+        'short_name'    => 'Default Format',                // Short name for this validation type
+        'types'            => ' 2 3 ',                    // Field types this validation type applies to
+        'format'        => '%s',                        // Output format for this field - printf() style format string
+        'regex'            => '',                        // Regular expression to validate this field
+        'sample'        => ''
+        ),
+    'Integer Number'    => array
+        (
+        'short_name'    => 'Integer',
+        'types'            => ' 2 ',
+        'format'        => '%{chars}d',
+        'regex'            => '[0-9]*',
+        'sample'        => '123'
+        ),
+    'Floating Point Number'    => array
+        (
+        'short_name'    => 'Float',
+        'types'            => ' 2 ',
+        'format'        => '%{chars}.{prec}f',
+        'regex'            => '[0-9]*\.[0-9]*',
+        'sample'        => '123.4'
+        ),
+    'Money'        => array
+        (
+        'short_name'    => 'Money',
+        'types'            => ' 2 ',
+        'format'        => '%{chars}.{prec}f',
+        'regex'            => '[0-9]*\.[0-9]*',
+        'sample'        => '$123.45'
+        ),
+    'E-Mail Address'        => array
+        (
+        'short_name'    => 'E-Mail',
+        'types'            => ' 3 ',
+        'format'        => '%s',
+        'regex'            => '[A-Za-z0-9._%-]+@[A-Za-z0-9._%-]+\.[A-Za-z]{2,4}',
+        'sample'        => 'userid@domain.dom'
+        ),
+    'Phone Number'        => array
+        (
+        'short_name'    => 'Phone',
+        'types'            => ' 3 ',
+        'format'        => '%s',
+        'regex'            => '\d{3}[-.]{1}\d{3}[-.]{1}\d{4}[^\d]*\d*',
+        'sample'        => '123-456-7890 X123'
+        )
+    );
+
+    // Style definitions
+
+$mf_styles = array
+    (
+
+    'Default' =>    array
+                (
+                'title'         => 'Default',                                                                                                            // Style name displayed in pick list
+                'short_name'    => 'Default',                                                                                                            // A short name used in form edit
+                'types'         => ' 1 2 3 4 5 6 7 20 21 23 24 25 30 31 ',                                                                               // Field types - MUST HAVE SPACE EACH SIDE OF VALUES
+                'cols'          => 1,                                                                                                                    // Number of columns per row
+                'start'         => '',                                                                                                                   // Text when starting this style
+                'row_start'     => '',                                                                                                                   // Text when starting a row
+                'body'          => '
+                                    <!--{if:required}--><span style="color: red;">{title}</span><!--{else:required}<b>{title}</b>{/if:required}--><br>
+                                    <!--{if:descr}-->{descr}<br><!--{/if:descr}-->
+                                    <!--{if:image}-->{image}<br><!--{/if:image}-->
+                                    <!--{if:file}-->{file}<br><!--{/if:file}-->
+                                    {input}
+                                    <!--{if:sub_forms}--><br><ol>{sub_forms}</ol><!--{/if:sub_forms}-->
+                                <br>',                                                                                                                  // Text for each column
+                'col_empty'     => '',                                                                                                                  // Text for empty columns
+                'row_end'       => '',                                                                                                                  // Text for end of each row
+                'end'           => '',                                                                                                                  // Text when switching to different style
+                'sub_form'      => '<div style="margin-left: 30px;">{sub_form}</div>'                                                                                                    // Text for each sub-form (yes, there could be multiples)
+                ),
+
+    'Title without following break' =>    array
+                (
+                'title'         => 'Prompt and input on single line without following break',
+                'short_name'    => 'No Break',
+                'types'         => ' 20 21',
+                'cols'          => 1,
+                'start'         => '',
+                'row_start'     => '',
+                'body'          => '<b>{title}</b>
+                                ',
+                'col_empty'     => '',
+                'row_end'       => '',
+                'end'           => '',
+                'sub_form'      => ''
+                ),
+
+    'Prompt and Input on single line without following break' =>    array
+                (
+                'title'         => 'Prompt and input on single line without following break',
+                'short_name'    => '1 Line',
+                'types'         => ' 1 2 3 4 5 6 7',
+                'cols'          => 1,
+                'start'         => '',
+                'row_start'     => '',
+                'body'          => '<!--{if:required}--><span style="color: red;">{title}</span><!--{else:required}<b>{title}</b>{/if:required}-->
+                                    <!--{if:image}-->{image}<!--{/if:image}-->
+                                    <!--{if:file}-->{file}<br><!--{/if:file}-->
+                                    {input}
+                                    <!--{if:sub_forms}--><br><ol>{sub_forms}</ol><!--{/if:sub_forms}-->
+                                ',
+                'col_empty'     => '',
+                'row_end'       => '',
+                'end'           => '',
+                'sub_form'      => '<ul>{sub_form}</ul>'
+                ),
+
+    'Prompt and Input on single line with following break' =>    array
+                (
+                'title'         => 'Prompt and input on single line with following break',
+                'short_name'    => '1 Line w/break',
+                'types'         => ' 1 2 3 4 5 6 7',
+                'cols'          => 1,
+                'start'         => '',
+                'row_start'     => '',
+                'body'          => '<!--{if:required}--><span style="color: red;">{title}</span><!--{else:required}<b>{title}</b>{/if:required}-->
+                                    <!--{if:image}-->{image}<!--{/if:image}-->
+                                    <!--{if:file}-->{file}<br><!--{/if:file}-->
+                                    {input}
+                                    <!--{if:sub_forms}--><br><ol>{sub_forms}</ol><!--{/if:sub_forms}--><br>
+                                ',
+                'col_empty'     => '',
+                'row_end'       => '',
+                'end'           => '',
+                'sub_form'      => '<ul>{sub_form}</ul>'
+                ),
+
+    'Prompt and Input Aligned' =>    array
+                (
+                'title'         => 'Prompt and input aligned',
+                'short_name'    => 'Prompt Aligned',
+                'types'         => ' 1 2 3 4 5 6 20 21 24 25 ',
+                'cols'          => 1,
+                'start'         => '<table border="0" cellspacing="0" cellpadding="2">',
+                'row_start'     => '',
+                'body'          => '<tr>
+                                    <td align="right" valign="top">
+                                        <b><!--{if:required}--><span style="color: red;">{title}</span><!--{else:required}{title}{/if:required}--></b><br>
+                                        <!--{if:image}-->{image}<br><!--{/if:image}-->
+                                        <!--{if:file}-->{file}<br><!--{/if:file}-->
+                                    </td><td align="left">{input}<!--{if:sub_forms}--><p>{sub_forms}<!--{/if:sub_forms}--></td>
+                                </tr>
+                                <!--{if:descr}--><tr><td>&nbsp;</td><td align="left">{descr}</td></tr><!--{/if:descr}-->
+                                <!--{if:sub_forms}--><p><tr><td>&nbsp;</td><td align="left">{sub_forms}</td></tr><!--{/if:sub_forms}-->
+                                ',
+                'col_empty'     => '',
+                'row_end'       => '',
+                'end'           => '</table><p>',
+                'sub_form'      => '{sub_form}<br>'
+                ),
+
+    '2 Column Table' =>    array
+                (
+                'title'         => '2 column table',
+                'short_name'    => '2 Column',
+                'types'         => ' 1 2 3 4 5 6 20 21 24 25 ',
+                'cols'          => 2,
+                'start'         => '<table border="0" cellspacing="0" cellpadding="2" width="90%">',
+                'row_start'     => '<tr>',
+                'body'          => '<td align="left" valign="top" width="50%">
+                                    <b><!--{if:required}--><span style="color: red;">{title}</span><!--{else:required}{title}{/if:required}--></b><br>
+                                    <!--{if:descr}-->{descr}<!--{/if:descr}--><br>
+                                    <!--{if:image}-->{image}<br><!--{/if:image}-->
+                                    <!--{if:file}-->{file}<br><!--{/if:file}-->
+                                    {input}
+                                    <!--{if:sub_forms}--><p>{sub_forms}<!--{/if:sub_forms}-->
+                                ',
+                'col_empty'     => '<td>&nbsp;</td>',
+                'row_end'       => '</tr>',
+                'end'           => '</table><p>',
+                'sub_form'      => '{sub_form}<br>'
+                ),
+
+    '3 Column Table' =>    array
+                (
+                'title'         => '3 column table',
+                'short_name'    => '3 Column',
+                'types'         => ' 1 2 3 4 5 6 20 21 24 25 ',
+                'cols'          => 3,
+                'start'         => '<table border="0" cellspacing="0" cellpadding="2" width="90%">',
+                'row_start'     => '<tr>',
+                'body'          => '<td align="left" valign="top" width="33%">
+                                    <b><!--{if:required}--><span style="color: red;">{title}</span><!--{else:required}{title}{/if:required}--></b><br>
+                                    <!--{if:descr}-->{descr}<!--{/if:descr}--><br>
+                                    <!--{if:image}-->{image}<br><!--{/if:image}-->
+                                    <!--{if:file}-->{file}<br><!--{/if:file}-->
+                                    {input}
+                                    <!--{if:sub_forms}--><p>{sub_forms}<!--{/if:sub_forms}-->
+                                ',
+                'col_empty'     => '<td>&nbsp;</td>',
+                'row_end'       => '</tr>',
+                'end'           => '</table><p>',
+                'sub_form'      => '{sub_form}<br>'
+                ),
+
+    '4 Column Table' =>    array
+                (
+                'title'         => '4 column table',
+                'short_name'    => '4 Column',
+                'types'         => ' 1 2 3 4 5 6 7 20 21 24 25 ',
+                'cols'          => 4,
+                'start'         => '<table border="0" cellspacing="0" cellpadding="2" width="90%">',
+                'row_start'     => '<tr>',
+                'body'          => '<td align="left" valign="top" width="25%">
+                                    <b><!--{if:required}--><span style="color: red;">{title}</span><!--{else:required}{title}{/if:required}--></b><br>
+                                    <!--{if:descr}-->{descr}<!--{/if:descr}--><br>
+                                    <!--{if:image}-->{image}<br><!--{/if:image}-->
+                                    <!--{if:file}-->{file}<br><!--{/if:file}-->
+                                    {input}
+                                    <!--{if:sub_forms}--><p>{sub_forms}<!--{/if:sub_forms}-->
+                                ',
+                'col_empty'     => '<td>&nbsp;</td>',
+                'row_end'       => '</tr>',
+                'end'           => '</table><p>',
+                'sub_form'      => '{sub_form}<br>'
+                ),
+
+    '5 Column Table' =>    array
+                (
+                'title'         => '5 column table',
+                'short_name'    => '5 Column',
+                'types'         => ' 1 2 3 4 5 6 7 20 21 24 25',
+                'cols'          => 5,
+                'start'         => '<table border="0" cellspacing="0" cellpadding="2" width="90%">',
+                'row_start'     => '<tr>',
+                'body'          => '<td align="left" valign="top" width="20%">
+                                    <b><!--{if:required}--><span style="color: red;">{title}</span><!--{else:required}{title}{/if:required}--></b><br>
+                                    <!--{if:descr}-->{descr}<!--{/if:descr}--><br>
+                                    <!--{if:image}-->{image}<br><!--{/if:image}-->
+                                    <!--{if:file}-->{file}<br><!--{/if:file}-->
+                                    {input}
+                                    <!--{if:sub_forms}--><p>{sub_forms}<!--{/if:sub_forms}-->
+                                ',
+                'col_empty'     => '<td>&nbsp;</td>',
+                'row_end'       => '</tr>',
+                'end'           => '</table><p>',
+                'sub_form'      => '{sub_form}<br>'
+                ),
+
+    '6 Column Table' =>    array
+                (
+                'title'         => '6 column table',
+                'short_name'    => '6 Column',
+                'types'         => ' 1 2 3 4 5 6 7 20 21 24 25',
+                'cols'          => 6,
+                'start'         => '<table border="0" cellspacing="0" cellpadding="2" width="90%">',
+                'row_start'     => '<tr>',
+                'body'          => '<td align="left" valign="top" width="16.3%">
+                                    <b><!--{if:required}--><span style="color: red;">{title}</span><!--{else:required}{title}{/if:required}--></b><br>
+                                    <!--{if:descr}-->{descr}<!--{/if:descr}--><br>
+                                    <!--{if:image}-->{image}<br><!--{/if:image}-->
+                                    <!--{if:file}-->{file}<br><!--{/if:file}-->
+                                    {input}
+                                    <!--{if:sub_forms}--><p>{sub_forms}<!--{/if:sub_forms}-->
+                                ',
+                'col_empty'     => '<td>&nbsp;</td>',
+                'row_end'       => '</tr>',
+                'end'           => '</table><p>',
+                'sub_form'      => '{sub_form}<br>'
+                ),
+
+    '7 Column Table' =>    array
+                (
+                'title'         => '7 column table',
+                'short_name'    => '7 Column',
+                'types'         => ' 1 2 3 4 5 6 7 20 21 24 25',
+                'cols'          => 7,
+                'start'         => '<table border="0" cellspacing="0" cellpadding="2" width="90%">',
+                'row_start'     => '<tr>',
+                'body'          => '<td align="left" valign="top" width="14.2%">
+                                    <b><!--{if:required}--><span style="color: red;">{title}</span><!--{else:required}{title}{/if:required}--></b><br>
+                                    <!--{if:descr}-->{descr}<!--{/if:descr}--><br>
+                                    <!--{if:image}-->{image}<br><!--{/if:image}-->
+                                    <!--{if:file}-->{file}<br><!--{/if:file}-->
+                                    {input}
+                                    <!--{if:sub_forms}--><p>{sub_forms}<!--{/if:sub_forms}-->
+                                ',
+                'col_empty'     => '<td>&nbsp;</td>',
+                'row_end'       => '</tr>',
+                'end'           => '</table><p>',
+                'sub_form'      => '{sub_form}<br>'
+                ),
+
+    '8 Column Table' =>    array
+                (
+                'title'         => '8 column table',
+                'short_name'    => '8 Column',
+                'types'         => ' 1 2 3 4 5 6 7 20 21 24 25',
+                'cols'          => 8,
+                'start'         => '<table border="0" cellspacing="0" cellpadding="2" width="90%">',
+                'row_start'     => '<tr>',
+                'body'          => '<td align="left" valign="top" width="12.5%">
+                                    <b><!--{if:required}--><span style="color: red;">{title}</span><!--{else:required}{title}{/if:required}--></b><br>
+                                    <!--{if:descr}-->{descr}<!--{/if:descr}--><br>
+                                    <!--{if:image}-->{image}<br><!--{/if:image}-->
+                                    <!--{if:file}-->{file}<br><!--{/if:file}-->
+                                    {input}
+                                    <!--{if:sub_forms}--><p>{sub_forms}<!--{/if:sub_forms}-->
+                                ',
+                'col_empty'     => '<td>&nbsp;</td>',
+                'row_end'       => '</tr>',
+                'end'           => '</table><p>',
+                'sub_form'      => '{sub_form}<br>'
+                ),
+
+    '9 Column Table' =>    array
+                (
+                'title'         => '9 column table',
+                'short_name'    => '9 Column',
+                'types'         => ' 1 2 3 4 5 6 7 20 21 24 25',
+                'cols'          => 9,
+                'start'         => '<table border="0" cellspacing="0" cellpadding="2" width="90%">',
+                'row_start'     => '<tr>',
+                'body'          => '<td align="left" valign="top" width="">
+                                    <b><!--{if:required}--><span style="color: red;">{title}</span><!--{else:required}{title}{/if:required}--></b><br>
+                                    <!--{if:descr}-->{descr}<!--{/if:descr}--><br>
+                                    <!--{if:image}-->{image}<br><!--{/if:image}-->
+                                    <!--{if:file}-->{file}<br><!--{/if:file}-->
+                                    {input}
+                                    <!--{if:sub_forms}--><p>{sub_forms}<!--{/if:sub_forms}-->
+                                ',
+                'col_empty'     => '<td>&nbsp;</td>',
+                'row_end'       => '</tr>',
+                'end'           => '</table><p>',
+                'sub_form'      => '{sub_form}<br>'
+                ),
+
+    '2CTNB' =>    array
+                (
+                'title'         => '2 column table - no break',
+                'short_name'    => '2 Col no break',
+                'types'         => ' 1 2 3 4 5 6 20 21 24 25 ',
+                'cols'          => 2,
+                'start'         => '<table border="0" cellspacing="0" cellpadding="2" width="">',
+                'row_start'     => '<tr>',
+                'body'          => '<td align="left" valign="top" width="">
+                                    <b><!--{if:required}--><span style="color: red;">{title}</span><!--{else:required}{title}{/if:required}--></b>
+                                    <!--{if:descr}-->{descr}<!--{/if:descr}-->
+                                    <!--{if:image}-->{image}<!--{/if:image}-->
+                                    <!--{if:file}-->{file}<!--{/if:file}-->
+                                    {input}
+                                    <!--{if:sub_forms}--><p>{sub_forms}<!--{/if:sub_forms}-->
+                                ',
+                'col_empty'     => '<td>&nbsp;</td>',
+                'row_end'       => '</tr>',
+                'end'           => '</table><p>',
+                'sub_form'      => '{sub_form}<br>'
+                ),
+
+    '3CTNB' =>    array
+                (
+                'title'         => '3 column table - no break',
+                'short_name'    => '3 Col no break',
+                'types'         => ' 1 2 3 4 5 6 20 21 24 25 ',
+                'cols'          => 3,
+                'start'         => '<table border="0" cellspacing="0" cellpadding="2" width="">',
+                'row_start'     => '<tr>',
+                'body'          => '<td align="left" valign="top" width="">
+                                    <b><!--{if:required}--><span style="color: red;">{title}</span><!--{else:required}{title}{/if:required}--></b>
+                                    <!--{if:descr}-->{descr}<!--{/if:descr}-->
+                                    <!--{if:image}-->{image}<!--{/if:image}-->
+                                    <!--{if:file}-->{file}<!--{/if:file}-->
+                                    {input}
+                                    <!--{if:sub_forms}--><p>{sub_forms}<!--{/if:sub_forms}-->
+                                ',
+                'col_empty'     => '<td>&nbsp;</td>',
+                'row_end'       => '</tr>',
+                'end'           => '</table><p>',
+                'sub_form'      => '{sub_form}<br>'
+                ),
+
+    '4CTNB' =>    array
+                (
+                'title'         => '4 column table - no break',
+                'short_name'    => '4 Col no break',
+                'types'         => ' 1 2 3 4 5 6 7 20 21 24 25 ',
+                'cols'          => 4,
+                'start'         => '<table border="0" cellspacing="0" cellpadding="2" width="">',
+                'row_start'     => '<tr>',
+                'body'          => '<td align="left" valign="top" width="">
+                                    <b><!--{if:required}--><span style="color: red;">{title}</span><!--{else:required}{title}{/if:required}--></b>
+                                    <!--{if:descr}-->{descr}<!--{/if:descr}-->
+                                    <!--{if:image}-->{image}<!--{/if:image}-->
+                                    <!--{if:file}-->{file}<!--{/if:file}-->
+                                    {input}
+                                    <!--{if:sub_forms}--><p>{sub_forms}<!--{/if:sub_forms}-->
+                                ',
+                'col_empty'     => '<td>&nbsp;</td>',
+                'row_end'       => '</tr>',
+                'end'           => '</table><p>',
+                'sub_form'      => '{sub_form}<br>'
+                ),
+
+    '5CTNB' =>    array
+                (
+                'title'         => '5 column table - no break',
+                'short_name'    => '5 Col no break',
+                'types'         => ' 1 2 3 4 5 6 7 20 21 24 25',
+                'cols'          => 5,
+                'start'         => '<table border="0" cellspacing="0" cellpadding="2" width="">',
+                'row_start'     => '<tr>',
+                'body'          => '<td align="left" valign="top" width="">
+                                    <b><!--{if:required}--><span style="color: red;">{title}</span><!--{else:required}{title}{/if:required}--></b>
+                                    <!--{if:descr}-->{descr}<!--{/if:descr}-->
+                                    <!--{if:image}-->{image}<!--{/if:image}-->
+                                    <!--{if:file}-->{file}<!--{/if:file}-->
+                                    {input}
+                                    <!--{if:sub_forms}--><p>{sub_forms}<!--{/if:sub_forms}-->
+                                ',
+                'col_empty'     => '<td>&nbsp;</td>',
+                'row_end'       => '</tr>',
+                'end'           => '</table><p>',
+                'sub_form'      => '{sub_form}<br>'
+                ),
+
+    '6CTNB' =>    array
+                (
+                'title'         => '6 column table - no break',
+                'short_name'    => '6 Col no break',
+                'types'         => ' 1 2 3 4 5 6 7 20 21 24 25',
+                'cols'          => 6,
+                'start'         => '<table border="0" cellspacing="0" cellpadding="2" width="">',
+                'row_start'     => '<tr>',
+                'body'          => '<td align="left" valign="top" width="">
+                                    <b><!--{if:required}--><span style="color: red;">{title}</span><!--{else:required}{title}{/if:required}--></b>
+                                    <!--{if:descr}-->{descr}<!--{/if:descr}-->
+                                    <!--{if:image}-->{image}<!--{/if:image}-->
+                                    <!--{if:file}-->{file}<!--{/if:file}-->
+                                    {input}
+                                    <!--{if:sub_forms}--><p>{sub_forms}<!--{/if:sub_forms}-->
+                                ',
+                'col_empty'     => '<td>&nbsp;</td>',
+                'row_end'       => '</tr>',
+                'end'           => '</table><p>',
+                'sub_form'      => '{sub_form}<br>'
+                ),
+
+    '7CTNB' =>    array
+                (
+                'title'         => '7 column table - no break',
+                'short_name'    => '7 Col no break',
+                'types'         => ' 1 2 3 4 5 6 7 20 21 24 25',
+                'cols'          => 7,
+                'start'         => '<table border="0" cellspacing="0" cellpadding="2" width="">',
+                'row_start'     => '<tr>',
+                'body'          => '<td align="left" valign="top" width="">
+                                    <b><!--{if:required}--><span style="color: red;">{title}</span><!--{else:required}{title}{/if:required}--></b>
+                                    <!--{if:descr}-->{descr}<!--{/if:descr}-->
+                                    <!--{if:image}-->{image}<!--{/if:image}-->
+                                    <!--{if:file}-->{file}<!--{/if:file}-->
+                                    {input}
+                                    <!--{if:sub_forms}--><p>{sub_forms}<!--{/if:sub_forms}-->
+                                ',
+                'col_empty'     => '<td>&nbsp;</td>',
+                'row_end'       => '</tr>',
+                'end'           => '</table><p>',
+                'sub_form'      => '{sub_form}<br>'
+                ),
+
+    '8CTNB' =>    array
+                (
+                'title'         => '8 column table - no break',
+                'short_name'    => '8 Col no break',
+                'types'         => ' 1 2 3 4 5 6 7 20 21 24 25',
+                'cols'          => 8,
+                'start'         => '<table border="0" cellspacing="0" cellpadding="2" width="">',
+                'row_start'     => '<tr>',
+                'body'          => '<td align="left" valign="top" width="">
+                                    <b><!--{if:required}--><span style="color: red;">{title}</span><!--{else:required}{title}{/if:required}--></b>
+                                    <!--{if:descr}-->{descr}<!--{/if:descr}-->
+                                    <!--{if:image}-->{image}<!--{/if:image}-->
+                                    <!--{if:file}-->{file}<!--{/if:file}-->
+                                    {input}
+                                    <!--{if:sub_forms}--><p>{sub_forms}<!--{/if:sub_forms}-->
+                                ',
+                'col_empty'     => '<td>&nbsp;</td>',
+                'row_end'       => '</tr>',
+                'end'           => '</table><p>',
+                'sub_form'      => '{sub_form}<br>'
+                ),
+
+    '9CTNB' =>    array
+                (
+                'title'         => '9 column table - no break',
+                'short_name'    => '9 Col no break',
+                'types'         => ' 1 2 3 4 5 6 7 20 21 24 25',
+                'cols'          => 9,
+                'start'         => '<table border="0" cellspacing="0" cellpadding="2" width="">',
+                'row_start'     => '<tr>',
+                'body'          => '<td align="left" valign="top" width="">
+                                    <b><!--{if:required}--><span style="color: red;">{title}</span><!--{else:required}{title}{/if:required}--></b>
+                                    <!--{if:descr}-->{descr}<!--{/if:descr}-->
+                                    <!--{if:image}-->{image}<!--{/if:image}-->
+                                    <!--{if:file}-->{file}<!--{/if:file}-->
+                                    {input}
+                                    <!--{if:sub_forms}--><p>{sub_forms}<!--{/if:sub_forms}-->
+                                ',
+                'col_empty'     => '<td>&nbsp;</td>',
+                'row_end'       => '</tr>',
+                'end'           => '</table><p>',
+                'sub_form'      => '{sub_form}<br>'
+                ),
+
+    'Big Title' =>    array
+                (
+                'title'         => 'Big title',
+                'short_name'    => 'Big title',
+                'types'         => ' 20 ',
+                'cols'          => 1,
+                'start'         => '',
+                'row_start'     => '',
+                'body'          => '<font size="5">{title}</font><br><hr>',
+                'col_empty'     =>'',
+                'row_end'       => '',
+                'end'           => '',
+                'sub_form'      => ''
+                ),
+
+    'Sub Title' =>    array
+                (
+                'title'         => 'Sub title',
+                'short_name'    => 'Sub title',
+                'types'         => ' 20 ',
+                'cols'          => 1,
+                'start'         => '',
+                'row_start'     => '',
+                'body'          => '<p><font size="4">{title}</font><br>',
+                'col_empty'     =>'',
+                'row_end'       => '',
+                'end'           => '',
+                'sub_form'      => ''
+                ),
+
+    'Full Width Rule' =>    array
+                (
+                'title'         => 'Full width rule',
+                'short_name'    => 'Wide Rule',
+                'types'         => ' 22 ',
+                'cols'          => 1,
+                'start'         => '',
+                'row_start'     => '',
+                'body'          => '<br><hr width="100%"><br>',
+                'col_empty'     =>'',
+                'row_end'       => '',
+                'end'           => '',
+                'sub_form'      => ''
+                ),
+
+    'Half Width Rule' =>    array
+                (
+                'title'         => 'Half width rule',
+                'short_name'    => 'Short Rule',
+                'types'         => ' 22 ',
+                'cols'          => 1,
+                'start'         => '',
+                'row_start'     => '',
+                'body'          => '<br><hr width="50%"><br>',
+                'col_empty'     =>'',
+                'row_end'       => '',
+                'end'           => '',
+                'sub_form'      => ''
+                )
+    );
+
+$month_array = array
+    (
+    1    => "January",
+    2    => "February",
+    3    => "March",
+    4    => "April",
+    5    => "May",
+    6    => "June",
+    7    => "July",
+    8    => "August",
+    9    => "September",
+    10    => "October",
+    11    => "November",
+    12    => "December"
+    );
+
+$si_states_array = array
+    (
+    "AL" => "Alabama",
+    "AK" => "Alaska",
+    "AB" => "Alberta",
+    "AZ" => "Arizona",
+    "AR" => "Arkansas",
+    "BC" => "British Columbia",
+    "CA" => "California",
+    "CO" => "Colorado",
+    "CT" => "Connecticut",
+    "DE" => "Delaware",
+    "DC" => "District of Columbia",
+    "FL" => "Florida",
+    "GA" => "Georgia",
+    "GU" => "Guam",
+    "HI" => "Hawaii",
+    "ID" => "Idaho",
+    "IL" => "Illinois",
+    "IN" => "Indiana",
+    "IA" => "Iowa",
+    "KS" => "Kansas",
+    "KY" => "Kentucky",
+    "LA" => "Louisiana",
+    "ME" => "Maine",
+    "MB" => "Manitoba",
+    "MD" => "Maryland",
+    "MA" => "Massachusetts",
+    "MI" => "Michigan",
+    "MN" => "Minnesota",
+    "MS" => "Mississppi",
+    "MO" => "Missouri",
+    "MT" => "Montana",
+    "NE" => "Nebraska",
+    "NV" => "Nevada",
+    "NB" => "New Brunswick",
+    "NF" => "Newfoundland",
+    "NH" => "New Hampshire",
+    "NJ" => "New Jersey",
+    "NM" => "New Mexico",
+    "NY" => "New York",
+    "NC" => "North Carolina",
+    "ND" => "North Dakota",
+    "NT" => "Northwest Territories",
+    "NS" => "Nova Scotia",
+    "OH" => "Ohio",
+    "OK" => "Oklahoma",
+    "ON" => "Ontario",
+    "OR" => "Oregon",
+    "PA" => "Pennsylvania",
+    "PE" => "Prince Edward Island",
+    "PR" => "Puerto Rico",
+    "QC" => "Quebec",
+    "RI" => "Rhode Island",
+    "SK" => "Saskatchewan",
+    "SC" => "South Carolina",
+    "SD" => "South Dakota",
+    "TN" => "Tennessee",
+    "TX" => "Texas",
+    "UT" => "Utah",
+    "VT" => "Vermont",
+    "VI" => "Virgin Islands",
+    "VA" => "Virginia",
+    "WA" => "Washington",
+    "WV" => "West Virginia",
+    "WI" => "Wisconsin",
+    "WY" => "Wyoming",
+    "YT" => "Yukon"
+    );
+
+$si_states_list = $s = "";
+while( list($k, $v) = each($si_states_array) )
+    {
+    $si_states_list .= "$s$k^$v";
+    $s = "~";
+    }
+
+
+$si_countries_array = array
+    (
+        // Out of sequence for convenience
+    'US' => 'United States',
+    'CA' => 'Canada',
+
+    "AF" => "Afghanistan",
+    "AX" => "Land Islands",
+    "AL" => "Albania",
+    "DZ" => "Algeria",
+    "AS" => "American Samoa",
+    "AD" => "Andorra",
+    "AO" => "Angola",
+    "AI" => "Anguilla",
+    "AQ" => "Antarctica",
+    "AG" => "Antigua and Barbuda",
+    "AR" => "Argentina",
+    "AM" => "Armenia",
+    "AW" => "Aruba",
+    "AU" => "Australia",
+    "AT" => "Austria",
+    "AZ" => "Azerbaijan",
+    "BS" => "Bahamas",
+    "BH" => "Bahrain",
+    "BD" => "Bangladesh",
+    "BB" => "Barbados",
+    "BY" => "Belarus",
+    "BE" => "Belgium",
+    "BZ" => "Belize",
+    "BJ" => "Benin",
+    "BM" => "Bermuda",
+    "BT" => "Bhutan",
+    "BO" => "Bolivia",
+    "BA" => "Bosnia and Herzegovina",
+    "BW" => "Botswana",
+    "BV" => "Bouvet Island",
+    "BR" => "Brazil",
+    "IO" => "British Indian Ocean Territory",
+    "BN" => "Brunei Darussalam",
+    "BG" => "Bulgaria",
+    "BF" => "Burkina Faso",
+    "BI" => "Burundi",
+    "KH" => "Cambodia",
+    "CM" => "Cameroon",
+    "CA" => "Canada",
+    "CV" => "Cape Verde",
+    "KY" => "Cayman Islands",
+    "CF" => "Central African Republic",
+    "TD" => "Chad",
+    "CL" => "Chile",
+    "CN" => "China",
+    "CX" => "Christmas Island",
+    "CC" => "Cocos (Keeling) Islands",
+    "CO" => "Colombia",
+    "KM" => "Comoros",
+    "CG" => "Congo",
+    "CD" => "Congo&#44; the Democratic Rep&#46; of",
+    "CK" => "Cook Islands",
+    "CR" => "Costa Rica",
+    "CI" => "Cote D'Ivoire",
+    "HR" => "Croatia",
+    "CU" => "Cuba",
+    "CY" => "Cyprus",
+    "CZ" => "Czech Republic",
+    "DK" => "Denmark",
+    "DJ" => "Djibouti",
+    "DM" => "Dominica",
+    "DO" => "Dominican Republic",
+    "EC" => "Ecuador",
+    "EG" => "Egypt",
+    "SV" => "El Salvador",
+    "GQ" => "Equatorial Guinea",
+    "ER" => "Eritrea",
+    "EE" => "Estonia",
+    "ET" => "Ethiopia",
+    "FK" => "Falkland Islands (Malvinas)",
+    "FO" => "Faroe Islands",
+    "FJ" => "Fiji",
+    "FI" => "Finland",
+    "FR" => "France",
+    "GF" => "French Guiana",
+    "PF" => "French Polynesia",
+    "TF" => "French Southern Territories",
+    "GA" => "Gabon",
+    "GM" => "Gambia",
+    "GE" => "Georgia",
+    "DE" => "Germany",
+    "GH" => "Ghana",
+    "GI" => "Gibraltar",
+    "GR" => "Greece",
+    "GL" => "Greenland",
+    "GD" => "Grenada",
+    "GP" => "Guadeloupe",
+    "GU" => "Guam",
+    "GT" => "Guatemala",
+    "GN" => "Guinea",
+    "GW" => "Guinea-Bissau",
+    "GY" => "Guyana",
+    "HT" => "Haiti",
+    "HM" => "Heard Island&#44; McDonald Islands",
+    "VA" => "Holy see (Vatican City State)",
+    "HN" => "Honduras",
+    "HK" => "Hong Kong",
+    "HU" => "Hungary",
+    "IS" => "Iceland",
+    "IN" => "India",
+    "ID" => "Indonesia",
+    "IR" => "Iran&#44; Islamic Republic of",
+    "IQ" => "Iraq",
+    "IE" => "Ireland",
+    "IL" => "Israel",
+    "IT" => "Italy",
+    "JM" => "Jamaica",
+    "JP" => "Japan",
+    "JO" => "Jordan",
+    "KZ" => "Kazakhstan",
+    "KE" => "Kenya",
+    "KI" => "Kiribati",
+    "KP" => "Korea&#44; Democratic People's Rep&#46; of",
+    "KR" => "Korea&#44; Republic of",
+    "KW" => "Kuwait",
+    "KG" => "Kyrgyzstan",
+    "LA" => "Lao People's Democratic Republic",
+    "LV" => "Latvia",
+    "LB" => "Lebanon",
+    "LS" => "Lesotho",
+    "LR" => "Liberia",
+    "LY" => "Libyan Arab Jamahiriya",
+    "LI" => "Liechtenstein",
+    "LT" => "Lithuania",
+    "LU" => "Luxembourg",
+    "MO" => "Macao",
+    "MK" => "Macedonia&#44; the Former Yugoslav Rep&#46;",
+    "MG" => "Madagascar",
+    "MW" => "Malawi",
+    "MY" => "Malaysia",
+    "MV" => "Maldives",
+    "ML" => "Mali",
+    "MT" => "Malta",
+    "MH" => "Marshall Islands",
+    "MQ" => "Martinique",
+    "MR" => "Mauritania",
+    "MU" => "Mauritius",
+    "YT" => "Mayotte",
+    "MX" => "Mexico",
+    "FM" => "Micronesia&#44; Federated States of",
+    "MD" => "Moldova&#44; Republic of",
+    "MC" => "Monaco",
+    "MN" => "Mongolia",
+    "MS" => "Montserrat",
+    "MA" => "Morocco",
+    "MZ" => "Mozambique",
+    "MM" => "Myanmar",
+    "NA" => "Namibia",
+    "NR" => "Nauru",
+    "NP" => "Nepal",
+    "NL" => "Netherlands",
+    "AN" => "Netherlands Antilles",
+    "NC" => "New Caledonia",
+    "NZ" => "New Zealand",
+    "NI" => "Nicaragua",
+    "NE" => "Niger",
+    "NG" => "Nigeria",
+    "NU" => "Niue",
+    "NF" => "Norfolk Island",
+    "MP" => "Northern Mariana Islands",
+    "NO" => "Norway",
+    "OM" => "Oman",
+    "PK" => "Pakistan",
+    "PW" => "Palau",
+    "PS" => "Palestinian Territory&#44; Occupied",
+    "PA" => "Panama",
+    "PG" => "Papua New Guinea",
+    "PY" => "Paraguay",
+    "PE" => "Peru",
+    "PH" => "Philippines",
+    "PN" => "Pitcairn",
+    "PL" => "Poland",
+    "PT" => "Portugal",
+    "PR" => "Puerto Rico",
+    "QA" => "Qatar",
+    "RE" => "Reunion",
+    "RO" => "Romania",
+    "RU" => "Russian Federation",
+    "RW" => "Rwanda",
+    "SH" => "Saint Helena",
+    "KN" => "Saint Kitts and Nevis",
+    "LC" => "Saint Lucia",
+    "PM" => "Saint Pierre and Miquelon",
+    "VC" => "Saint Vincent and the Grenadines",
+    "WS" => "Samoa",
+    "SM" => "San Marino",
+    "ST" => "Sao Tome and Principe",
+    "SA" => "Saudi Arabia",
+    "SN" => "Senegal",
+    "CS" => "Serbia and Montenegro",
+    "SC" => "Seychelles",
+    "SL" => "Sierra Leone",
+    "SG" => "Singapore",
+    "SK" => "Slovakia",
+    "SI" => "Slovenia",
+    "SB" => "Solomon Islands",
+    "SO" => "Somalia",
+    "ZA" => "South Africa",
+    "GS" => "South Georgia&#44; South Sandwich Islands",
+    "ES" => "Spain",
+    "LK" => "Sri Lanka",
+    "SD" => "Sudan",
+    "SR" => "Suriname",
+    "SJ" => "Svalbard and Jan Mayen",
+    "SZ" => "Swaziland",
+    "SE" => "Sweden",
+    "CH" => "Switzerland",
+    "SY" => "Syrian Arab Republic",
+    "TW" => "Taiwan&#44; Province of China",
+    "TJ" => "Tajikistan",
+    "TZ" => "Tanzania&#44; United Republic of",
+    "TH" => "Thailand",
+    "TL" => "Timor-Leste",
+    "TG" => "Togo",
+    "TK" => "Tokelau",
+    "TO" => "Tonga",
+    "TT" => "Trinidad and Tobago",
+    "TN" => "Tunisia",
+    "TR" => "Turkey",
+    "TM" => "Turkmenistan",
+    "TC" => "Turks and Caicos Islands",
+    "TV" => "Tuvalu",
+    "UG" => "Uganda",
+    "UA" => "Ukraine",
+    "AE" => "United Arab Emirates",
+    "GB" => "United Kingdom",
+    "US" => "United States",
+    "UM" => "United States minor outlying islands",
+    "UY" => "Uruguay",
+    "UZ" => "Uzbekistan",
+    "VU" => "Vanuatu",
+    "VE" => "Venezuela",
+    "VN" => "Viet Nam",
+    "VG" => "Virgin Islands&#44; British",
+    "VI" => "Virgin Islands&#44; U&#46;S&#46;",
+    "WF" => "Wallis and Futuna",
+    "EH" => "Western Sahara",
+    "YE" => "Yemen",
+    "ZM" => "Zambia",
+    "ZW" => "Zimbabwe"
+    );
+
+$si_countries_list = $s = "";
+while( list($k, $v) = each($si_countries_array) )
+    {
+    $si_countries_list .= "$s$k^$v";
+    $s = "~";
+    }
+
+
+
+?>
diff --git a/front-end/registrations.inc b/front-end/registrations.inc
new file mode 100644 (file)
index 0000000..f9c42c6
--- /dev/null
@@ -0,0 +1,4496 @@
+<?
+/*****************************************************
+ *
+ *  Gaslight Media - Travel Industry Data System
+ *
+ *  Event Registrations User Interface
+ *
+ *  Copyright (c) 2002, 2004 - All rights reserved
+ *
+ ******************************************************/
+require_once "reg_setup.php";
+require_once "reg_functions.inc";
+
+define('THIS_SCRIPT', BASE_APP_URL."/Common/Registrations_V3/front-end/index.phtml");
+// define('DEBUG_VIEW', true);
+
+// Create user trace info. If this is an Admin user, just say Admin.
+$user_trace_info = $_SERVER['REMOTE_ADDR']." - ".date("m/d/Y H:i:s");
+
+$config = new Zend_Config_Ini('config/application.ini', strtolower($_ENV['GLM_HOST_ID']));
+
+/*****************************************************
+ *
+ *  Generic data and misc setup
+ *
+ ******************************************************/
+
+// Build global tag data for view fields
+
+$view_tags = array("global" => array());
+$v =& $view_tags["global"];
+
+// Debug Configuration
+$GLOBALS['reg_config']['debug'] = $config->event_registration->debug;
+$GLOBALS['reg_config']['debug_mail'] = $config->event_registration->debug_mail;
+$GLOBALS['reg_config']['debug_view'] = $config->event_registration->debug_view;
+
+// If there's a catid specified, assume that we should use that
+if (($_REQUEST['catid']-0) > 0) {
+    $v['category_id'] = ($_REQUEST['catid']-0);
+// Otherwise, use the catid from the config file.
+} else {
+    $v['category_id'] = $config->event_registration->event_page;
+}
+
+// Setup Base URLs
+$v['base_secure_url'] = BASE_SECURE_URL;
+if (defined(BASE_APP_SECURE_URL)) {                                                            // check for the various secure app urls.
+       $v['base_app_secure_url'] = BASE_APP_SECURE_URL;
+} else {
+       $v['base_app_secure_url'] = GLM_APP_BASE_SECURE_URL;
+}
+$v['base_url'] = $v['base_secure_url'];
+
+// General Configuration
+$v['reglinkname'] = $config->event_registration->link_name;
+$v['image_original'] = ORIGINAL;
+$v['image_resized'] = RESIZED;
+$v['image_midsized'] = MIDSIZED;
+$v['image_thumb'] = THUMB;
+$v['debug'] = '';
+$v['have_members'] = ($config->event_registration->have_members ? 'YES' : 'NO');
+$v['have_registered_users'] = ($config->event_registration->registered_users ? 'YES' : 'NO');
+$v['doing_main_categories'] = ($config->event_registration->main_categories ? 'YES' : 'NO');
+$v['doing_sub_categories'] = ($config->event_registration->sub_categories ? 'YES' : 'NO');
+$v['doing_attributes'] = ($config->event_registration->attributes ? 'YES' : 'NO');
+$v['pay_by_comp_code'] = $config->event_registration->payment_methods->comp_code;
+$v['pay_by_comp_code_restrict'] = ($config->event_registration->payment_methods->comp_code == "Restricted" ? 'YES' : 'NO');
+$v['pay_by_check'] = $config->event_registration->payment_methods->check;
+$v['pay_by_check_restrict'] = ($config->event_registration->payment_methods->check == "Restricted" ? 'YES' : 'NO');
+$v['pay_by_cash'] = $config->event_registration->payment_methods->cash;
+$v['pay_by_cash_restrict'] = ($config->event_registration->payment_methods->cash == "Restricted" ? 'YES' : 'NO');
+$v['pay_by_credit_card'] = $config->event_registration->payment_methods->credit_card;
+$v['pay_by_credit_card_restrict'] = ($config->event_registration->payment_methods->credit_card == "Restricted" ? 'YES' : 'NO');
+$v['pay_by_call_from_merchant'] = $config->event_registration->payment_methods->call_from_merchant;
+$v['pay_by_call_from_merchant_restrict'] = ($config->event_registration->payment_methods->call_from_merchant == "Restricted" ? 'YES' : 'NO');
+$v['select_by_default'] = ($config->event_registration->default ? 'YES' : 'NO');
+$v['select_by_month'] = ($config->event_registration->select_by_month ? 'YES' : 'NO');
+$v['select_by_code'] = ($config->event_registration->select_by_code ? 'YES' : 'NO');
+$v['select_by_picklists'] = ($config->event_registration->select_by_picklists ? 'YES' : 'NO');
+$v['show_event_codes'] = ($config->event_registration->show_event_codes ? 'YES' : 'NO');
+$v['show_event_button'] = ($config->event_registration->show_event_button ? 'YES' : 'NO');
+$v['show_rates_in_event_lists'] = ($config->event_registration->show_rates_in_event_lists ? 'YES' : 'NO');
+$v['show_rates_type'] = $config->event_registration->show_rates_type;
+$v['show_instructor_in_event_lists'] = ($config->event_registration->show_instructor_in_event_lists ? 'YES' : 'NO');
+$v['show_instructor_in_event_detail'] = ($config->event_registration->show_instructor_in_event_detail ? 'YES' : 'NO');
+$v['show_event_terms_in_event_detail'] = ($config->event_registration->show_event_terms_in_event_detail ? 'YES' : 'NO');
+$v['show_cutoff_dates'] = ($config->event_registration->show_cutoff_dates ? 'YES' : 'NO');
+$v['display_only_mode'] = ($config->event_registration->display_only_mode ? 'YES' : 'NO');
+$v['events_in_cat_list'] = ($config->event_registration->include_events_in_category_list ? 'YES' : 'NO');
+$v['notification_billing_info'] = ($config->event_registration->instr_notification->billing_info ? 'YES' : 'NO');
+$v['notification_email'] = ($config->event_registration->instr_notification->email ? 'YES' : 'NO');
+$v['notification_phone'] = ($config->event_registration->instr_notification->phone ? 'YES' : 'NO');
+$v['notification_duration'] = ($config->event_registration->instr_notification->duration ? 'YES' : 'NO');
+$v['notification_short_descr'] = ($config->event_registration->instr_notification->short_descr ? 'YES' : 'NO');
+$v['notification_contact_fname'] = ($config->event_registration->instr_notification->contact_fname ? 'YES' : 'NO');
+$v['notification_contact_lname'] = ($config->event_registration->instr_notification->contact_lname ? 'YES' : 'NO');
+$v['notification_contact_addr1'] = ($config->event_registration->instr_notification->contact_addr1 ? 'YES' : 'NO');
+$v['notification_contact_addr2'] = ($config->event_registration->instr_notification->contact_addr2 ? 'YES' : 'NO');
+$v['notification_contact_city'] = ($config->event_registration->instr_notification->contact_city ? 'YES' : 'NO');
+$v['notification_contact_phone'] = ($config->event_registration->instr_notification->contact_phone ? 'YES' : 'NO');
+$v['notification_contact_fax'] = ($config->event_registration->instr_notification->contact_fax ? 'YES' : 'NO');
+$v['show_search_result_as_title'] = ($config->event_registration->show_search_result_as_title ? 'YES' : 'NO');
+
+// Customer Information
+$v["customer_name"] = $config->event_registration->organization_short;
+$v["customer_long_name"] = $config->event_registration->organization;
+$v['customer_address'] = $config->event_registration->organization_address;
+$v['customer_city'] = $config->event_registration->organization_city;
+$v['customer_state'] = $config->event_registration->organization_state;
+$v['customer_zip'] = $config->event_registration->organization_zip;
+$v["customer_phone"] = $config->event_registration->organization_phone;
+$v["customer_tollfree"] = $config->event_registration->organization_toll_free;
+$v["registrations_title"] = $config->event_registration->title;
+
+// Standard Words
+$v['word_category'] = $config->event_registration->word->category;
+$v['word_categories'] = $config->event_registration->word->categories;
+$v['word_subcategory'] = $config->event_registration->word->sub_category;
+$v['word_subcategories'] = $config->event_registration->word->sub_categories;
+$v['word_attribute'] = $config->event_registration->word->attribute;
+$v['word_attributes'] = $config->event_registration->word->attributes;
+$v['word_event'] = $config->event_registration->word->event;
+$v['word_events'] = $config->event_registration->word->events;
+$v['word_registration'] = $config->event_registration->word->registration;
+$v['word_register'] = $config->event_registration->word->register;
+$v['word_registering'] = $config->event_registration->word->registering;
+$v['word_registered'] = $config->event_registration->word->registered;
+$v['word_registrations'] = $config->event_registration->word->registrations;
+$v['word_member'] = $config->event_registration->word->member;
+$v['word_members'] = $config->event_registration->word->members;
+$v['word_user_id'] = $config->event_registration->word->user_id;
+$v['word_password'] = $config->event_registration->word->password;
+$v['word_instructor'] = $config->event_registration->word->instructor;
+$v['word_instructors'] = $config->event_registration->word->instructors;
+$v['word_attendee'] = $config->event_registration->word->attendee;
+$v['word_attendees'] = $config->event_registration->word->attendees;
+$v['word_attending'] = $config->event_registration->word->attending;
+$v['word_attended'] = $config->event_registration->word->attended;
+$v['word_restrictedUser'] = $config->event_registration->word->restricted_user;
+$v['word_restrictedUsers'] = $config->event_registration->word->restricted_users;
+
+// Standard Words capitalized
+$v['word_Category'] = ucfirst($config->event_registration->word->category);
+$v['word_Categories'] = ucfirst($config->event_registration->word->categories);
+$v['word_SubCategory'] = ucfirst($config->event_registration->word->sub_category);
+$v['word_SubCategories'] = ucfirst($config->event_registration->word->sub_categories);
+$v['word_Attribute'] = ucfirst($config->event_registration->word->attribute);
+$v['word_Attributes'] = ucfirst($config->event_registration->word->attributes);
+$v['word_Event'] = ucfirst($config->event_registration->word->event);
+$v['word_Events'] = ucfirst($config->event_registration->word->events);
+$v['word_Registration'] = ucfirst($config->event_registration->word->registration);
+$v['word_Register'] = ucfirst($config->event_registration->word->register);
+$v['word_Registering'] = ucfirst($config->event_registration->word->registering);
+$v['word_Registered'] = ucfirst($config->event_registration->word->registered);
+$v['word_Registrations'] = ucfirst($config->event_registration->word->registrations);
+$v['word_Member'] = ucfirst($config->event_registration->word->member);
+$v['word_Members'] = ucfirst($config->event_registration->word->members);
+$v['word_User_id'] = ucfirst($config->event_registration->word->user_id);
+$v['word_Password'] = ucfirst($config->event_registration->word->password);
+$v['word_Password'] = ucfirst($config->event_registration->word->password);
+$v['word_Instructor'] = ucfirst($config->event_registration->word->instructor);
+$v['word_Instructors'] = ucfirst($config->event_registration->word->instructors);
+$v['word_Attendee']  = ucfirst($config->event_registration->word->attendee);
+$v['word_Attendees'] = ucfirst($config->event_registration->word->attendees);
+$v['word_Attending'] = ucfirst($config->event_registration->word->attending);
+$v['word_Attended']  = ucfirst($config->event_registration->word->attended);
+$v['word_RestrictedUser'] = ucfirst($config->event_registration->word->restricted_user);
+$v['word_RestrictedUsers'] = ucfirst($config->event_registration->word->restricted_users);
+
+// Optional billing fields if no-charges - Default all to on
+$v['show_free_fname'] = 'YES';
+$v['show_free_lname'] = 'YES';
+$v['show_free_addr1'] = 'YES';
+$v['show_free_addr2'] = 'YES';
+$v['show_free_city'] = 'YES';
+$v['show_free_state'] = 'YES';
+$v['show_free_country'] = 'YES';
+$v['show_free_zip'] = 'YES';
+$v['show_free_phone'] = 'YES';
+$v['show_free_fax'] = 'YES';
+$v['show_free_cityzip'] = 'YES';
+
+// Optional contact data
+$v['show_contact_data'] = ($config->event_registration->show_contact_data ? 'YES' : 'NO');
+$v['show_same_button'] = ($config->event_registration->show_same_button ? 'YES' : 'NO');
+$v['contact_information_title'] = $config->event_registration->titles->contact_information;
+$v['use_contact_fname'] = ($config->event_registration->prompt->contact_fname != '' ? 'YES' : 'NO');
+$v['required_contact_fname'] = ($config->event_registration->required->contact_fname ? 'YES' : 'NO');
+$v['prompt_contact_fname'] = $config->event_registration->prompt->contact_fname;
+$v['use_contact_lname'] = ($config->event_registration->prompt->contact_lname != '' ? 'YES' : 'NO');
+$v['required_contact_lname'] = ($config->event_registration->required->contact_lname ? 'YES' : 'NO');
+$v['prompt_contact_lname'] = $config->event_registration->prompt->contact_lname;
+$v['use_contact_addr1'] = ($config->event_registration->prompt->contact_addr1 != '' ? 'YES' : 'NO');
+$v['required_contact_addr1'] = ($config->event_registration->required->contact_addr1 ? 'YES' : 'NO');
+$v['prompt_contact_addr1'] = $config->event_registration->prompt->contact_addr1;
+$v['use_contact_addr2'] = ($config->event_registration->prompt->contact_addr2 != '' ? 'YES' : 'NO');
+$v['required_contact_addr2'] = ($config->event_registration->required->contact_addr2  ? 'YES' : 'NO');
+$v['prompt_contact_addr2'] = $config->event_registration->prompt->contact_addr2;
+$v['use_contact_city'] = ($config->event_registration->prompt->contact_city != '' ? 'YES' : 'NO');
+$v['required_contact_city'] = ($config->event_registration->required->contact_city ? 'YES' : 'NO');
+$v['prompt_contact_city'] = $config->event_registration->prompt->contact_city;
+$v['use_contact_state'] = ($config->event_registration->prompt->contact_state != '' ? 'YES' : 'NO');
+$v['required_contact_state'] = ($config->event_registration->required->contact_state ? 'YES' : 'NO');
+$v['prompt_contact_state'] = $config->event_registration->prompt->contact_state;
+$v['use_contact_zip'] = ($config->event_registration->prompt->contact_zip != '' ? 'YES' : 'NO');
+$v['required_contact_zip'] = ($config->event_registration->required->contact_zip ? 'YES' : 'NO');
+$v['prompt_contact_zip'] = $config->event_registration->prompt->contact_zip;
+$v['use_contact_country'] = ($config->event_registration->prompt->contact_country != '' ? 'YES' : 'NO');
+$v['required_contact_country'] = ($config->event_registration->required->contact_country ? 'YES' : 'NO');
+$v['prompt_contact_country'] = $config->event_registration->prompt->contact_country;
+$v['use_contact_phone'] = ($config->event_registration->prompt->contact_phone != '' ? 'YES' : 'NO');
+$v['required_contact_phone'] = ($config->event_registration->required->contact_phone ? 'YES' : 'NO');
+$v['prompt_contact_phone'] = $config->event_registration->prompt->contact_phone;
+$v['use_contact_fax'] = ($config->event_registration->prompt->contact_fax != '' ? 'YES' : 'NO');
+$v['required_contact_fax'] = ($config->event_registration->required->contact_fax ? 'YES' : 'NO');
+$v['prompt_contact_fax'] = $config->event_registration->prompt->contact_fax;
+
+// Various titles and statments
+$v['title_use_payment_comp_code'] = $config->event_registration->titles->use_payment_comp_code;
+$v['title_payment_comp_code'] = $config->event_registration->titles->payment_comp_code;
+$v['title_send_a_check'] = $config->event_registration->titles->send_a_check;
+$v['title_call_from_merchant'] = $config->event_registration->titles->call_from_merchant;
+$v['title_paid_cash'] = $config->event_registration->titles->paid_cash;
+$v['title_pay_by_cash'] = $config->event_registration->titles->pay_by_cash;
+$v['title_pay_by_credit_card'] = $config->event_registration->titles->pay_by_credit_card;
+$v['title_select_event_button'] = $config->event_registration->titles->registration_button;
+
+// Get bulletin and terms/conditions
+
+$misc = db_auto_get_row("SELECT * FROM registrations.misc;", 0, CONN_STR, FALSE);
+$v['regbulletin'] = $misc['regbulletin'];
+$v['haveRegTerms'] = (trim($misc['regterms']) != '' ? 'YES' : 'NO');
+$v['regTerms'] = $misc['regterms'];
+$v['regCatPageText'] = $misc['cat_page_text'];
+$v['regSubCatPageText'] = $misc['sub_cat_page_text'];
+$v['regSelectPageText'] = $misc['select_page_text'];
+$v['regEventPageText'] = $misc['event_page_text'];
+$v['regCartPageText'] = $misc['cart_page_text'];
+$v['regCheckoutPageText'] = $misc['checkout_page_text'];
+$v['regSummaryPageText'] = $misc['summary_page_text'];
+
+// Set default view and style locations
+$qs_viewpath = GLM_APP_BASE.'Common/Registrations_V3/front-end/Views';
+$v['stylesheet'] = BASE_APP_SECURE_URL.'Common/Registrations_V3/front-end/Views/style.css';
+$v['haveStylesheetOverride'] = 'NO';
+$v['haveCustomStylesheet'] = 'NO';
+$v['payment_type'] = '';
+
+// Check for local/custom stylesheet
+if ($config->event_registration->custom_stylesheet && file_exists(SI_BASE_PATH.'Toolkit/Registrations/front-end/Views/override.css')) {
+    $v['haveStylesheetOverride'] = 'YES';
+} elseif ($config->event_registration->custom_stylesheet && file_exists(SI_BASE_PATH.'Toolkit/Registrations/front-end/Views/style.css')) {
+    $v['haveCustomStylesheet'] = 'YES';
+}
+
+// Function to check if a local/custom views are on and directory exists for front-end - replaces the normal parse_view() function
+function parse_view_localcheck($use_local, $file_name, $tokens, $show_unused = true)
+{
+    global $config;
+
+    $viewpath = GLM_APP_BASE.'Common/Registrations_V3/front-end/Views/'.$file_name;
+
+    if ($use_local && file_exists(SI_BASE_PATH.'Toolkit/Registrations/Views/front-end/'.$file_name)) {
+        $viewpath = SI_BASE_PATH.'Toolkit/Registrations/Views/front-end/'.$file_name;
+    }
+
+    // Oops! May have used this path also
+    if ($use_local && file_exists(SI_BASE_PATH.'Toolkit/Registrations/front-end/Views/'.$file_name)) {
+        $viewpath = SI_BASE_PATH.'Toolkit/Registrations/front-end/Views/'.$file_name;
+    }
+
+    return parse_view($viewpath, $tokens, $show_unused);
+}
+
+/*
+ * Function to build event rates for a specific event $reg.
+ *
+ * Returns an array with the event rate data
+ *     $rates('reg_rates' => {rates string}, 'cutoff_date' => {cutoff_date})
+*/
+function getRegRates($r, $is_member, $config)
+{
+
+       $cutoff = false;
+       $regRates = array();
+       $from_rate = -1;
+       $free = 'YES';
+
+       // If the event isn't date specific then there's only one set of rates and no cutoff dates are needed.
+       $fields = 4;
+       if ($r['date_specific'] == 'f') {
+               $fields = 1;
+       }
+
+       for($i=1 ; $i<=$fields ; $i++) {
+
+               if ($i == 1) {
+                       $cutoff_date = $r['cutoff_date'];
+               } else {
+                       $cutoff_date = $r['cutoff_date'.$i];
+               }
+
+               // Check for last cutoff date
+               $cutoff_time = strtotime($cutoff_date);
+               if ($cutoff == false || strtotime($cutoff) < $cutoff_time) {
+                       $cutoff = $cutoff_date;
+               }
+
+               if (trim($cutoff_date) != '' || $r['date_specific'] == 'f') {
+
+                       if ($is_member) {
+                               $rates = unserialize($r['rates_'.$i.'_memb']);
+                       } else {
+                               $rates = unserialize($r['rates_'.$i]);
+                       }
+
+                       $rate_min = $rate_max = -1;
+                       $base_min = $base_max = -1;
+                       $credit_min = $credit_max = -1;
+                       $f_rate = -1;
+
+                       if (is_array($rates)) {
+                               foreach ($rates as $rate) {
+                                       if ($rate[1] < $base_min || $base_min == - 1)
+                                               $base_min = $rate[1];
+                                       if ($rate[1] > $base_min && $rate[1] > $base_max)
+                                               $base_max = $rate[1];
+                                       if ($rate[2] < $rate_min || $rate_min == - 1)
+                                               $rate_min = $rate[2];
+                                       if ($rate[2] > $rate_min && $rate[2] > $rate_max)
+                                               $rate_max = $rate[2];
+                                       if ($rate[3] < $credit_min || $credit_min == - 1)
+                                               $credit_min = $rate[3];
+                                       if ($rate[3] > $credit_min && $rate[3] > $credit_max)
+                                               $credit_max = $rate[3];
+
+                                       // Check for min rate
+                                       $fr = $base_min;
+                                       if ($base_min == 0) {
+                                               $fr = $rate_min;
+                                       }
+                                       if (($f_rate == -1 && $fr > 0) || ( $fr > 0 && $fr < $f_rate )) {
+                                               $f_rate = $fr;
+                                       }
+                               }
+                       }
+
+                       $rr = array();
+                       $rr['reg_submit_by'] = $cutoff_date;
+                       $rr['reg_rate'] = ($base_min + $rate_min > 0 ? '' : ' No Charge ');
+                       if ($base_min + $rate_min > 0) {
+                               $free = 'NO';
+                       }
+
+                       $rr['reg_have_base'] = 'NO';
+                       if ($base_min > 0) {
+                               $rr['reg_have_base'] = 'YES';
+                               $rr['reg_base'] .= money($base_min).($base_max > $base_min ? ' to '.money($base_max) : '');
+                       }
+                       $rr['reg_have_per_attendee'] = 'NO';
+                       if ($rate_min > 0) {
+                               $rr['reg_have_per_attendee'] = 'YES';
+                               $rr['reg_per_attendee'] = money($rate_min).($rate_max > $rate_min ? ' to '.money($rate_max) : '').' per '.$config->event_registration->word->attendee;
+                       }
+                       $rr['reg_have_included'] = 'NO';
+                       if ($credit_min > 0) {
+                               $rr['reg_have_included'] = 'YES';
+                               $attTerm = ($credit_min > 1 || $credit_max > 1 ? $config->event_registration->word->attendees : $config->event_registration->word->attendee);
+                               $rr['reg_included'] = $credit_min.($credit_max > $credit_min ? ' to '.$credit_max : '');
+                       }
+
+                       $regRates[] = $rr;
+
+                       // Check min rate
+                       if ($from_rate == -1 || ($min_rate != 0 && $f_rate > 0 && $f_rate < $from_rate)) {
+                               $from_rate = $f_rate;
+                       }
+               }
+
+       }
+
+       if ($from_rate < 0) {
+               $from_rate = 0;
+       }
+
+       $result = array('regRates' => $regRates, 'cutoffDate' => $cutoff, 'fromRate' => money($from_rate), 'free' => $free);
+       return $result;
+}
+
+// Start Session
+session_start();
+
+// Function to reset session data
+function reset_session() {
+    $_SESSION['GLM_EVENT_REG'] = array(
+            'User' => false,
+            'admin_user' => false,
+            'card_processed' => false
+    );
+}
+
+// If we're doing attributes then build an array of them
+$attr_list = array();
+if ($config->event_registration->attributes) {
+       if (($attrs = reg_db_auto_get_data("SELECT id, name, descr FROM registrations.attribute order by sort, name;", CONN_STR, FALSE)) &&
+               is_array($attrs) && count($attrs) > 0
+       ) {
+               foreach ($attrs as $a) {
+                       $attr_list[$a['id']] = array('id' => $a['id'], 'name' => $a['name'], 'descr' => $a['descr']);
+               }
+       }
+}
+
+// Check to see if Action has been specified
+if (!empty($_REQUEST['Action'])) {
+    $Action = trim($_REQUEST['Action']);
+} else {
+    reset_session();
+    $Action = "Step0";
+}
+
+// If requested, or not yet set, create a clean session array
+if (!isset($_SESSION['GLM_EVENT_REG'])) {
+    // create GLM_HOUSING session with all parameters false
+    reset_session();
+}
+
+// Check if this is new entry by an admin user
+$v['preview'] = '';
+if ($_REQUEST['AdminUser'] == 'YES') {
+    reset_session();
+    $_SESSION['GLM_EVENT_REG']['admin_user'] = true;
+       $v['preview'] = '&preview=1';
+}
+
+// If Admin user is entering registration, then say so
+$v['admin_user'] = 'NO';
+if ($_SESSION['GLM_EVENT_REG']['admin_user']) {
+    $v['admin_user'] = 'YES';
+    $user_trace_info = 'Entered By Admin User';
+       $v['preview'] = '&preview=1';
+
+}
+
+// If there's no cart array in the session, create one now
+if (!isset($_SESSION['GLM_EVENT_REG']['Cart'])) {
+
+    $_SESSION['GLM_EVENT_REG']['Cart'] = array();
+    $_SESSION['GLM_EVENT_REG']['Cart_Serial_Number'] = $_SERVER['REMOTE_ADDR'].'_'.microtime(true);
+    $_SESSION['GLM_EVENT_REG']['Current_id'] = 0; // A counter used to create cart entry ids
+
+}
+
+// Setup problem reason array and define function for adding reasons
+$reason = array();
+if (isset($cc_reason)) {
+    $reason[]['text'] = ($cc_reason);
+}
+
+// Clean up all input data
+/*
+ while (list($key, $value) = each($_REQUEST))
+ global ${$key};
+ global $reason;
+ global $form_data;
+ global $registrant;
+ */
+
+/*
+ * Check category selection
+ *
+ */
+// If we're doing categories at all - Don't check if there's a month search request
+if ($Action == 'Step2' && $config->event_registration->main_categories && !isset($_REQUEST['event_month']) && !isset($_REQUEST['attribute'])) {
+
+    // If we're doing sub-categories, wait till we have that
+    if ($config->event_registration->sub_categories) {
+
+       $selected_sub_category = (filter_request('subcat', FILTER_SANITIZE_NUMBER_INT) - 0);
+
+        if ($selected_sub_category == 0) {
+            $Action = 'Step1';
+        }
+
+    } else {
+
+       $selected_category = (filter_request('todo', FILTER_SANITIZE_NUMBER_INT) - 0);
+
+        if ($selected_category == 0) {
+            $Action = 'Step1';
+        }
+
+    }
+}
+
+/*
+ * Event Code / Registration selection
+ */
+
+// If Step2 then clear current event selection
+if ($Action <= 'Step2') {
+    $_SESSION['GLM_EVENT_REG']['Event'] = false;
+}
+
+// Check to see what kind of categories we're doing
+$cat_select = '';
+$cat_from = '';
+$cat_where = '';
+if ($config->event_registration->main_categories) {
+    if ($config->event_registration->sub_categories) {
+        $cat_select = ', T.med_info';
+        $cat_from = ', registrations.todo T, registrations.category C';
+        $cat_where = 'AND C.id = R.category AND T.id = C.todo';
+    } else {
+        $cat_select = ', T.med_info';
+        $cat_from = ", registrations.todo T";
+        $cat_where = "AND R.category = T.id";
+    }
+}
+$reg_data = false;
+
+// Check if a single event selected by "Event Code"
+$requested_event_code = filter_request('requested_event_code');
+if ($requested_event_code != '') {
+
+    // Try to get event information from event code
+    $reg_data_list = reg_db_auto_get_data("
+            SELECT R.*
+            FROM registrations.reg R
+            WHERE R.event_code = '$requested_event_code'
+              AND R.active = 't';
+            ", CONN_STR, FALSE, 100, 0);
+
+    // If nothing was found
+    if (!$reg_data_list) {
+
+        $reason[]['text'] = ' No '.$v['word_events'].' were found using the provided '.$v['word_event'].' code.';
+        $Action = 'Step1';
+        unset($reg_data_list);
+
+    // If we only got one event back, then that's the selected event
+    } elseif (count($reg_data_list) == 1) {
+
+        $reg_data = $reg_data_list['0|1'];
+        $Action = 'Step3';
+
+    // If instead we have mulitples, then lists those for selection
+    } elseif (count($reg_data_list) > 1) {
+
+        $Action = 'Step2';
+
+    }
+
+// Next check if there's a specific event record ID provided
+} elseif (isset($_REQUEST['event_id']) && (($event_id = ($_REQUEST['event_id'] - 0)) > 0)) {
+
+    // Try to get event information from registration ID
+    $reg_data = db_auto_get_row("
+        SELECT R.* $cat_select
+         FROM registrations.reg R $cat_from
+        WHERE R.id = $event_id
+                $cat_where
+          ".($_SESSION['GLM_EVENT_REG']['admin_user']?'':"AND R.active = 't'").";
+    ", 0, CONN_STR, FALSE);
+       if (is_array($reg_data) && count($reg_data) > 0) {
+       $Action = 'Step3';
+       } else {
+               $Action = 'Step1';
+       }
+
+    // Otherwise, check if we already have an event in the session
+} elseif ($_SESSION['GLM_EVENT_REG']['Event'] && ($event_id = ($_SESSION['GLM_EVENT_REG']['Event']['id'] - 0) > 0)) {
+
+    // Try to get the event information from the session
+    $reg_data = db_auto_get_row("
+        SELECT R.* $cat_select
+         FROM registrations.reg R $cat_from
+        WHERE R.id = $event_id
+                $cat_where
+          AND R.active = 't';
+    ", 0, CONN_STR, FALSE);
+
+}
+
+// If we have reg_data, update event information in the session and get any other needed information
+$event_id = false;
+if ($reg_data) {
+
+    $event_id = $reg_data['id'];
+
+    // Save the "event" in the session
+    $_SESSION['GLM_EVENT_REG']['Event'] = array(
+        'id'       => $reg_data['id'],
+        'name'     => $reg_data['name'],
+        'code'     => $reg_data['event_code'],
+        'med_info' => $reg_data['med_info']
+    );
+
+    // If we're doing attributes - check for attributes information
+    if ($config->event_registration->attributes) {
+           $qs = "SELECT A.name AS attr_name FROM registrations.attribute A, registrations.reg_attr R WHERE R.reg = $event_id AND A.id = R.attr ORDER BY A.sort, A.name;";
+           $reg_data['attr'] = reg_db_auto_get_data($qs, CONN_STR, FALSE);
+           $reg_data['have_attr'] = false;
+           if (is_array($reg_data['attr']) && count($reg_data['attr']) > 0) {
+               $reg_data['have_attr'] = true;
+           }
+    }
+
+    $v['reg_category'] = $reg_data['category'];
+}
+
+
+// Check if we should initialize certain parameters
+if ($Action == 'Step3') {
+       $v['desired_date'] = '';
+}
+
+// Determine if we got here from a static page - If so, we don't want to repeat a heeader
+$v['static_page'] = 'NO';
+if (isset($_REQUEST['static_page']) && $_REQUEST['static_page'] == 'TRUE') {
+    $v['static_page'] = 'YES';
+}
+
+/*****************************************************
+ *
+ *  Login Processing
+ *
+ ******************************************************/
+
+/*
+ * User is logged in when ...
+ * 1) A valid member ID and Password submitted using the Member login form that matches an entry in the member table.
+ * 2) A valid E-Mail address and password submitted using the Returning Guests login form that mathes an entry in the registrant table.
+ * 3) There is an existing logged in user session
+ */
+$user_data = false;
+$is_member = false;
+$v['member_username'] = '';
+$v['member_password'] = '';
+$v['nonmember_email'] = '';
+$v['nonmember_password'] = '';
+$v['haveUser'] = 'NO';
+$v['userIsMember'] = 'NO';
+
+/*
+ * Check for a logout request
+ */
+if ($_REQUEST['logout'] == 'YES') {
+
+    // Clear user
+    reset_session();
+    $Action = 'Step0';
+
+/*
+ * Check for a direct link to a registered user from the admin area
+ */
+} elseif (isset($_REQUEST['specified_registrant'])) {
+
+    $user = filter_request('specified_registrant');
+
+    // Check to see if there's a user match
+    $sql = "
+        SELECT *
+          FROM registrations.registrant
+         WHERE id = $user
+    ;";
+    $user_data = db_auto_get_row($sql, 0, CONN_STR, FALSE);
+    if ($user_data) {
+
+        // We have a new user session, so save that user
+        $_SESSION['GLM_EVENT_REG']['User'] = $user_data['id'];
+        $_SESSION['GLM_EVENT_REG']['UserIsMember'] = ($user_data['is_member'] == 't');
+        $_SESSION['GLM_EVENT_REG']['UserData'] = $user_data;
+
+        // Otherwise the login was not succcessful
+    } else {
+        $reason[]['text'] = ' Direct link from administration section did not contain a valid registered user ID.';
+    }
+
+/*
+ * Check for a member login
+ */
+} elseif ($config->event_registration->have_members && ( isset($_REQUEST['specified_member_id']) || $_REQUEST['Option'] == 'MemberLogin') ) {
+
+    // Validate and sanitize input
+    $v['member_username'] = filter_request('memberID');
+    $v['member_password'] = filter_request('memberPasswd');
+
+    // Check if we have both ID and Password
+    if (!isset($_REQUEST['specified_member_id']) && ($v['member_username'] == '' || $v['member_password'] == '')) {
+        $reason[]['text'] = ' Your did not supply both a '.$v['word_User_id'].' and '.$v['word_Password'].' for '.$v['word_Members'].' login.';
+    } else {
+
+        // Check to see if this is coming from a link in the admin area.
+        $specified_member_id = filter_request('specified_member_id', FILTER_SANITIZE_NUMBER_INT);
+        if ($specified_member_id != '') {
+
+            // Get the member record using the specified_member_id
+            $query = "
+                SELECT *
+                  FROM members.member
+                 WHERE member_id = $specified_member_id
+            ;";
+
+        } else {
+            // Get the member record using the username and password supplied
+            $query = "
+                SELECT *
+                FROM members.member
+                WHERE member_login = '".$v['member_username']."'
+                AND member_passwd = '".md5($v['member_password'])."'
+            ;";
+        }
+        $member_data = db_auto_get_row($query, 0, CONN_STR, FALSE, 50, 0);
+
+        if ($member_data) {
+
+            // Check if there's an existing entry in the registrant table
+            $query = "
+                SELECT *
+                  FROM registrations.registrant
+                 WHERE member_id = '".$member_data['member_id']."'
+            ;";
+            $user_data = db_auto_get_row($query, 0, CONN_STR, FALSE, 50, 0);
+
+            // If there's no existing user record, create one.
+            if (!$user_data) {
+
+                $query = "
+                    INSERT INTO registrations.registrant
+                        (
+                        user_trace_info,
+                        fname,
+                        lname,
+                        addr1,
+                        addr2,
+                        city,
+                        state,
+                        zip,
+                        country,
+                        phone,
+                        email,
+                        email_ok,
+                        password,
+                        is_member,
+                        member_id,
+                        winter_addr,
+                        winter_phone
+                        )
+                    VALUES
+                        (
+                        '".$user_trace_info."',
+                        '".addslashes($member_data['fname'])."',
+                        '".addslashes($member_data['lname'])."',
+                        '".addslashes($member_data['street'])."',
+                        '',
+                        '".addslashes($member_data['city'])."',
+                        '".$member_data['state']."',
+                        '".$member_data['zip']."',
+                        '".($member_data['country']==''?'US':$member_data['country'])."',
+                        '".$member_data['phone']."',
+                        '".$member_data['process_email']."',
+                        't',
+                        '',
+                        't',
+                        '".$member_data['member_id']."',
+                        '".addslashes($member_data['secondary_address'].", ".$member_data['secondary_city'].", ".$member_data['secondary_state'].", ".$member_data['secondary_zip'])."',
+                        ".$member_data['phone2']."
+                        )
+                    RETURNING *
+                ;";
+                $user_data = db_auto_get_row($query, 0, CONN_STR, FALSE, 50, 0);
+
+            }
+
+            $Action = 'Step1';
+            $_SESSION['GLM_EVENT_REG']['User'] = $user_data['member_id'];
+            $_SESSION['GLM_EVENT_REG']['UserIsMember'] = true;
+            $_SESSION['GLM_EVENT_REG']['UserData'] = $user_data;
+
+        } else {
+            $reason[]['text'] = ' The '.$v['word_User_id'].' and '.$v['word_Password'].' you supplied do not match a known '.$v['word_Member'].'.';
+        }
+    }
+
+/*
+ * Check for a returning non-member login
+ */
+} elseif ($_REQUEST['Option'] == 'NonMemberLogin') {
+
+    // Validate and sanitize input
+    $v['nonmember_email'] = filter_request('registrantEMail');
+    $v['nonmember_password'] = filter_request('registrantPasswd');
+
+    // Check if we have both E-Mail and Password
+    if ($v['nonmember_email'] == '' || $v['nonmember_password'] == '' ) {
+        $reason[]['text'] = ' Your did not supply both an E-Mail address and '.$v['word_Password'].' for returning guest login.';
+    } else {
+
+        // Check to see if there's a user match
+        $sql = "
+            SELECT *
+              FROM registrations.registrant
+             WHERE email = '".$v['nonmember_email']."'
+               AND password = '".md5($v['nonmember_password'])."'
+        ;";
+        $user_data = db_auto_get_row($sql, 0, CONN_STR, FALSE);
+        if ($user_data) {
+
+            // We have a new user session, so save that user
+            $_SESSION['GLM_EVENT_REG']['User'] = $user_data['id'];
+            $_SESSION['GLM_EVENT_REG']['UserIsMember'] = false;
+            $_SESSION['GLM_EVENT_REG']['UserData'] = $user_data;
+
+            // Otherwise the login was not succcessful
+        } else {
+            $reason[]['text'] = ' Your E-Mail address and password do not match a returning guest in our database.';
+        }
+
+    }
+
+}
+
+/*
+ * Check for login session
+ */
+if (isset($_SESSION['GLM_EVENT_REG']['User']) && ($user_id = ($_SESSION['GLM_EVENT_REG']['User'] - 0)) > 0) {
+
+    $user_data = $_SESSION['GLM_EVENT_REG']['UserData'];
+
+    // Have login so populate data for view files
+    $v['userID'] = $user_data['id'];
+    $v['userIsMember'] = ($_SESSION['GLM_EVENT_REG']['UserIsMember'] ? 'YES' : 'NO');
+    $v['userFname'] = $user_data['fname'];
+    $v['userLname'] = $user_data['lname'];
+    $v['userAddr1'] = $user_data['addr1'];
+    $v['userAddr2'] = $user_data['addr2'];
+    $v['userCity'] = $user_data['city'];
+    $v['userState'] = $user_data['state'];
+    $v['userZip'] = $user_data['zip'];
+    $v['userCountry'] = $user_data['country'];
+    $v['userPhone'] = $user_data['phone'];
+    $v['userEmail'] = $user_data['email'];
+    $v['userEmail_ok'] = ($user_data['email_ok'] = 't' ? 'YES' : 'NO');
+    $v['userContactFname'] = $user_data['contact_fname'];
+    $v['userContactLname'] = $user_data['contact_lname'];
+    $v['userContactAddr1'] = $user_data['contact_addr1'];
+    $v['userContactAddr2'] = $user_data['contact_addr2'];
+    $v['userContactCity'] = $user_data['contact_city'];
+    $v['userContactState'] = $user_data['contact_state'];
+    $v['userContactZip'] = $user_data['contact_zip'];
+    $v['userContactCountry'] = $user_data['contact_country'];
+    $v['userContactPhone'] = $user_data['contact_phone'];
+    $v['userMember_id'] = $user_data['member_id'];
+    $v['userWinterAddr'] = $user_data['winter_addr'];
+    $v['userWinterPhone'] = $user_data['winter_phone'];
+
+    $v['haveUser'] = 'YES';
+
+    $is_member = $_SESSION['GLM_EVENT_REG']['UserIsMember'];
+
+}
+
+/* -------------  END OF LOGIN PROCESSING ----------------- */
+
+/*****************************************************
+ *
+ *    Currently selected Event general setup
+ *
+ ******************************************************/
+
+// If we have event data, setup all the basic stuff
+if ($event_id) {
+
+    $rate = 0;
+    $cutoff = '';
+
+    $v['event_id'] = $event_id;
+    $v['reg_code'] = $reg_data['event_code'];
+    $v['reg_category'] = $reg_data['category'];
+    $v['reg_name'] = $reg_data['name'];
+    $v['reg_image'] = $reg_data['image'];
+    $v['reg_descr'] = $reg_data['descr'];
+    $v['reg_short_descr'] = $reg_data['short_descr'];
+    $v['reg_days'] = $reg_data['dates'];
+    $v['reg_instructor'] = $reg_data['instructor'];
+    $v['reg_location'] = $reg_data['location'];
+    $v['reg_med_info'] = ($config->event_registration->medical_info && $reg_data['med_info'] == 't' ? 'YES' : 'NO');
+
+    $v['ask_attendees'] = $reg_data['need_attendees'] == 't' ? 'Yes' : 'No';
+
+    $v['reg_have_attr'] = 'NO';
+    if ($config->event_registration->attributes) {
+       $view_tags['attr'] = $reg_data['attr'];
+           $v['reg_have_attr'] = ($reg_data['have_attr'] ? 'YES' : 'NO');
+    }
+
+       // Determine if we need to ask for a desired date
+    $v['reg_ask_date'] = 'NO';
+    $ask_date = false;
+    $v['reg_use_calendar'] = 'NO';
+    $use_calendar = false;
+    if ($reg_data['ask_date'] == 't') {
+       $ask_date = true;
+       $v['reg_ask_date'] = 'YES';
+       if ($reg_data['use_calendar'] == 't') {
+
+               // Get calendar dates permitted
+               $ds_data = array();
+               $view_tags['datesAvail'] = array();
+               $minTime = 0;
+               $maxTime = 0;
+               $v['minDate'] = '';
+               $v['maxDate'] = '';
+               if ($reg_data['date_select'] != '') {
+                       $ds_data = unserialize($reg_data['date_select']);
+
+                       // If we have some available dates
+                       if (is_array($ds_data) && count($ds_data) > 0) {
+                               $use_calendar = true;
+                               $v['reg_use_calendar'] = 'YES';
+
+                               foreach($ds_data as $y) {
+                                       foreach($y as $m) {
+                                               foreach($m as $d) {
+                                                       if ($d['sel']) {
+                                                               $view_tags['datesAvail'][] = array('dateAvail' => $d['date']);
+                                                               // check for min and max dates
+                                                               if ($minTime == 0 || $d['time'] < $minTime) {
+                                                                       $minTime = $d['time'];
+                                                               }
+                                                               if ($maxTime == 0 || $d['time'] > $maxTime) {
+                                                                       $maxTime = $d['time'];
+                                                               }
+                                                       }
+                                               }
+                                       }
+                               }
+
+                               $v['minDate'] = date('m/d/Y', $minTime);
+                               $v['maxDate'] = date('m/d/Y', $maxTime);
+                       }
+               }
+
+       }
+    }
+
+
+    // Determine if the event is date specific
+    $v['date_specific'] = 'NO';
+    $date_specific = false;
+    if ($reg_data['date_specific'] =='t') {
+       $date_specific = true;
+       $v['date_specific'] = 'YES';
+    }
+
+    // Determine if location information has been provided
+    $v['have_location'] = 'NO';
+    if (trim($reg_data['location']) != '') {
+        $v['have_location'] = 'YES';
+    }
+
+    // Determine if registration is full
+    $v['limited'] = 'NO';
+    $v['full'] = 'NO';
+    if ($reg_data['attendee_limit'] == 't') {
+        $v['limited'] = 'YES';
+        if ($reg_data['attendee_count'] >= $reg_data['attendee_max'])
+            $v['full'] = 'YES';
+
+        $v['attendee_max'] = $reg_data['attendee_max'];
+        $v['attendee_count'] = $reg_data['attendee_count'];
+        $v['attendee_left'] = $reg_data['attendee_max'] - $reg_data['attendee_count'];
+    }
+
+    // Determine registration rate
+    $rate_data = '';
+    if (!$date_specific ||                                                                                                     // If not date specific, use these rates
+       (time() <= strtotime($reg_data['cutoff_date']) + 86500) ||
+        ($_SESSION['GLM_EVENT_REG']['admin_user'] && empty($reg_data['cutoff_date2']))) {
+
+        $memb_rate_data = unserialize($reg_data['rates_1_memb']);
+        $nonmemb_rate_data = unserialize($reg_data['rates_1']);
+        $rate_from_date = '';
+        $cutoff_date = $reg_data['cutoff_date'];
+
+        // If this event is not date specific, use next week as a cutoff date placeholder
+        if (!$date_specific) {
+               $cutoff_date = date('m/d/Y', strtotime('next week'));
+        }
+
+    } elseif ((!empty($reg_data['cutoff_date2']) && time() <= strtotime($reg_data['cutoff_date2']) + 86500) ||
+        ($_SESSION['GLM_EVENT_REG']['admin_user'] && empty($reg_data['cutoff_date3']))) {
+
+        $memb_rate_data = unserialize($reg_data['rates_2_memb']);
+        $nonmemb_rate_data = unserialize($reg_data['rates_2']);
+        $rate_from_date = $reg_data['cutoff_date'];
+        $cutoff_date = $reg_data['cutoff_date2'];
+
+    } elseif ((!empty($reg_data['cutoff_date3']) && time() <= strtotime($reg_data['cutoff_date3']) + 86500) ||
+        ($_SESSION['GLM_EVENT_REG']['admin_user'] && empty($reg_data['cutoff_date4']))) {
+
+        $memb_rate_data = unserialize($reg_data['rates_3_memb']);
+        $nonmemb_rate_data = unserialize($reg_data['rates_3']);
+        $rate_from_date = $reg_data['cutoff_date2'];
+        $cutoff_date = $reg_data['cutoff_date3'];
+
+    } elseif ((!empty($reg_data['cutoff_date4']) && time() <= strtotime($reg_data['cutoff_date4']) + 86500) ||
+        $_SESSION['GLM_EVENT_REG']['admin_user']) {
+
+        $memb_rate_data = unserialize($reg_data['rates_4_memb']);
+        $nonmemb_rate_data = unserialize($reg_data['rates_4']);
+        $rate_from_date = $reg_data['cutoff_date3'];
+        $cutoff_date = $reg_data['cutoff_date4'];
+
+    }
+
+    // If the user is a member and there's member rates
+    $v['haveRateNote'] = 'NO';
+    $v['rateNote'] = '';
+    if ($is_member && is_array($memb_rate_data)) {
+
+        // Use member rates
+        $rate_data = $memb_rate_data;
+        $v['rateNote'] = 'Showing member rates.';
+
+    // Otherwise if user is a member and there's non-member rates
+    } elseif ($is_member && is_array($nonmemb_rate_data)) {
+
+        // Use non-member rates for member
+        $rate_data = $nonmemb_rate_data;
+        $v['rateNote'] = 'No member rates are available. Displaying non-member rates for this activity.';
+
+    // Otherwise user is a non-member, so are there non-member rates?
+    } elseif (is_array($nonmemb_rate_data)) {
+
+        // Use non-member rates for non-member
+        $rate_data = $nonmemb_rate_data;
+
+    // Otherwise there must not be any rate data for this activity
+    } else {
+
+        // Must be a free activity
+        $rate_data = array();
+        $v['rateNote'] = 'There are no charges for this activity.';
+
+    }
+
+    if (is_array($rate_data)) {
+        $rate_classes = 'TRUE';
+
+        if (isset($_REQUEST['rate_class']) && $_REQUEST['rate_class'] != '') {
+            $rate_class = ($_REQUEST['rate_class'] - 0);
+        } else {
+            $rate_class = -1;
+        }
+
+        // If there's only one rate class
+        if (count($rate_data) == 1) {
+            $rate_class = 0;
+            $rate_class_name = $rate_data[0][0];
+            $base_rate = (!empty($rate_data[0][1]) ? $rate_data[0][1] : 0);
+            $rate = $rate_data[0][2];
+            $attendee_credit = (!empty($rate_data[0][3]) ? $rate_data[0][3] : 0);
+
+        // If a rate class has been selected
+        } elseif ($rate_class > -1) {
+            $rate_class_name = $rate_data[$rate_class][0];
+            $base_rate = (!empty($rate_data[$rate_class][1]) ? $rate_data[$rate_class][1] : 0);
+            $rate = $rate_data[$rate_class][2];
+            $attendee_credit = (!empty($rate_data[$rate_class][3]) ? $rate_data[$rate_class][3] : 0);
+
+        // Otherwise no rate class is selecetd {
+        } else {
+            $rate_class_name = '';
+            $rate_class = -1;
+            $base_rate = 0;
+            $rate = 0;
+            $attendee_credit = 0;
+        }
+        // If no rate data, then it must be free
+        } else {
+
+        $rate_class_name = '';
+        $rate_class = -1;
+        $rate_classes = '';
+        $rate = 0;
+    }
+
+}
+
+/*****************************************************
+ *
+ *    Add/Delete Cart contents
+ *
+ ******************************************************/
+
+// Check for selected event data submission to add to cart
+if (isset($_REQUEST['select_event']) && $_REQUEST['select_event'] == 'YES') {
+
+    // Start a new cart entry array
+    $cart_entry = array();
+
+    // Check rate classes and check for required selection
+    if ($rate_classes == 'TRUE') {
+        $cart_entry['rate_class'] = $rate_class_name;
+        $cart_entry['cutoff_date'] = $cutoff_date;
+        if ($rate_class == - 1)
+            $reason[]['text'] = 'You must select a Rate Category';
+    }
+
+    // $charges is array of fees. Each element is array( 'charge_title', 'charge', 'extend' ) to use for summaries and totals
+
+    $free_registration = true; // Assume that this registration is free unless we determine otherwise
+    $charges = $field_data = $field_values = array();
+    $total_charges = 0;
+
+    // If activity needs a desired date
+    $desired_date = '';
+    $cart_entry['ask_date'] = 'NO';
+    if ($ask_date) {
+               $desired_date = filter_request('desired_date');
+       $desired_date_time = strtotime($desired_date);          // Test conversion to time stamp - false if not valid date
+
+       // If we didn't get a valid desired date
+               if ($desired_date_time == false) {
+                       $reason[]['text'] = 'You must enter a valid date for your desired date.';
+                       $v['desired_date'] = $desired_date;
+               } else {
+                       $desired_date = date('m/d/Y', strtotime($desired_date));
+
+                       // If desired date is not tomorrow or later
+                       if ($desired_date_time < strtotime('tomorrow')) {
+                               $reason[]['text'] = 'Your desired date must be in the future.';
+                       }
+
+                       // Check if specific dates are permitted
+                       if ($reg_data['ask_date'] == 't' && $reg_data['use_calendar'] == 't') {
+                               $ds_data = unserialize($reg_data['date_select']);
+                               $y = date('Y', $desired_date_time);
+                               $m = date('n', $desired_date_time);
+                               if (!isset($ds_data[$y][$m][$desired_date_time]) || !$ds_data[$y][$m][$desired_date_time]['sel']) {
+                                       $reason[]['text'] = 'Your desired date is not available. Please select from the pop-up calendar.';
+                               }
+                       }
+
+               }
+
+               $v['desired_date'] = $desired_date;
+               $cart_entry['ask_date'] = 'YES';
+    }
+       $cart_entry['desired_date'] = $desired_date;
+
+    // If activity needs attendees, build list of Attendees
+    $numb_attendees = 0;
+    if ($reg_data['need_attendees'] == 't') {
+
+        $cart_entry['need_attendees'] = 'YES';
+        $attendee_found = FALSE;
+        $attendees = array();
+        $sep = '';
+        $i = 1;
+
+        // For each submitted attendee
+        while (isset($_REQUEST['attendee_'.$i.'_1'])) {
+
+               // Get cleaned up attendee name
+               $a = filter_request('attendee_'.$i.'_1');
+
+               // Note that extra _1 is a result of the java function used for this, deal with it.
+               if ($a != '') {
+
+                $attendee_found = TRUE;
+                $attendees[$i] = array(
+                    'attendee_id' => $i,
+                    'name' => $a,
+                    'dob' => false,
+                    'guardian' => '',
+                    'emer_contact' => '',
+                    'emer_phone' => '',
+                    'med_history' => '',
+                    'allergy_med' => ''
+                );
+                $sep = ', ';
+                $numb_attendees++;
+            }
+
+            $i++;
+        }
+
+        $cart_entry['numb_attendees'] = $numb_attendees;
+        $cart_entry['attendees'] = $attendees;
+
+    } else {
+        $cart_entry['need_attendees'] = 'NO';
+        $numb_attendees = 1; // Needed as multiplier for all form based charges.
+        $cart_entry['numb_attendees'] = $numb_attendees;
+    }
+
+    // If all of the attendees are covered by attendee credits
+    if ($numb_attendees < $attendee_credit) {
+        $attendee_credit = $numb_attendees;
+    }
+
+    // If this event needs attendees
+    if ($reg_data['need_attendees'] == 't') {
+
+        // Check for at least 1 Attendee name
+        if (!$attendee_found)
+            $reason[]['text'] = "There must be at least one ".$config->event_registration->word->attendee;
+
+        // Check if this exceeds the number of attendees for the event
+        if ($reg_data['attendee_limit'] == 't' && $numb_attendees > ($reg_data['attendee_max'] - $reg_data['attendee_count']))
+            $reason[]['text'] = "You have more ".$config->event_registration->word->attendees." than can be registered at this time. Only ".($reg_data['attendee_max'] - $reg_data['attendee_count'])." more available.";
+
+    }
+
+    // Process MagicForm Submission
+
+    if (($r = magic_form_submit($event_id))) {
+        $mf_reasons = explode("\n", $r['problem']);
+        foreach ($mf_reasons as $mf_r) {
+            if (trim($mf_r) != '')
+                $reason[]['text'] = substr($mf_r, 4, -5);
+        }
+        $fd = $r['data'];
+
+        // Add indents to form data for used in display
+        while (list($key, $val) = each($fd)) {
+            $fd[$key]['indent'] = '';
+            for ($i=0 ; $i<$val['level'] ; $i++) {
+                $fd[$key]['indent'] .= '&nbsp;&nbsp;';
+            }
+        }
+
+        // Add MagicForm data to cart array
+        $cart_entry['mf_data'] = $fd;
+
+    } else {
+        $reason[]['text'] = 'ERROR: Unable to process MagicForm at this time.';
+        break;
+    }
+
+    // If there are any charges
+    if ($base_rate > 0 || $rate > 0) {
+
+        if ($base_rate > 0) // Base Charges
+        {
+            $total_charges += $base_rate;
+            array_push($charges, array('charge_title' => $cart_entry['rate_class'], 'charge' => '', 'extend' => money($base_rate)));
+        }
+
+        if ($reg_data['need_attendees'] == 't') {
+            $charge = $rate * $numb_attendees;
+            $total_charges += $charge;
+
+            if ($charge > 0) {
+                array_push($charges, array('charge_title' => $numb_attendees.' '.ucfirst($config->event_registration->word->attendees), 'charge' => money($rate), 'extend' => money($charge)));
+            }
+
+            // Attendee Credits
+            if ($attendee_credit > 0) {
+                $credit = $rate * $attendee_credit * -1;
+                if ($credit > 0) {
+                       $total_charges += $credit;
+                       array_push($charges, array('charge_title' => $attendee_credit.' '.ucfirst($config->event_registration->word->attendee).' Credits ', 'charge' => money($rate * -1), 'extend' => money($credit)));
+                }
+            }
+        }
+        $free_registration = false; // Yep, there's some kind of charges involved with this reg
+        } else
+        array_push($charges, array('charge_title' => '(no base or per/'.$config->event_registration->word->attendee.' charges)', 'charge' => '', 'extend' => ''));
+
+    // Re-process MagicForm data to see if there's any additional charges and to get reports
+    reset($fd);
+    foreach ($fd as $m)
+        if ($m['numb_val'] != '') {
+            switch ($m['type']) {
+            case 1: // Checkbox - Use title
+                $t = $m['title'].': Yes';
+                break;
+            case 5: // Picklist - Use data
+                case 6: // Radio Button - Use data
+                $t = $m['value'];
+                break;
+            default:
+                $t = '';
+                break;
+            }
+            if ($reg_data['mf_charges_by_attendee'] == 't') {
+                $mf_charges = $m['numb_val'] * $numb_attendees;
+            } else {
+                $mf_charges = $m['numb_val'];
+            }
+            $total_charges += $mf_charges;
+            array_push($charges, array('charge_title' => $t, 'charge' => money($m['numb_val']), 'extend' => money($mf_charges)));
+        }
+
+    // Add charges to cart array
+    $cart_entry['charges'] = $charges; // Array of charges
+    $cart_entry['total_charges'] = $total_charges; // Total of those charges
+
+    // If this event needs med info
+    $cart_entry['med_info'] = ($config->event_registration->medical_info && $reg_data['med_info'] == 't' ? true : false);
+
+    // Check if there's additional terms/conditions
+    $cart_entry['haveTerms'] = 'NO';
+    if (trim($reg_data['terms']) != '') {
+        $cart_entry['haveTerms'] = 'YES';
+    }
+
+    // If there's any problems change step back to 3 - Get activity registration detail
+    if (count($reason) > 0)
+        $Action = "Step3";
+    else {
+
+        // There's no problems, so add this to the shopping cart
+        $cart_entry['free_reg'] = $free_registration ? 'Yes' : 'No';
+        $cart_entry = array_merge($cart_entry, $reg_data);
+
+        // Add this cart entry to cart
+        $cart_id = $_SESSION['GLM_EVENT_REG']['Current_id'] + 1;
+        $_SESSION['GLM_EVENT_REG']['Current_id'] = $cart_id;
+        $cart_entry['cart_id'] = $cart_id;
+
+        $_SESSION['GLM_EVENT_REG']['Cart'][$cart_id] = serialize($cart_entry);
+
+        $Action = "Step4";
+
+    }
+
+}
+
+// Check for deletion of a cart entry
+if (isset($_REQUEST['delete_cart_id']) && ($cart_id = ($_REQUEST['delete_cart_id'] - 0))) {
+
+    // Remove the selected cart entry
+    unset($_SESSION['GLM_EVENT_REG']['Cart'][$cart_id]);
+    $Action = 'Step4';
+
+}
+
+// If we have something in the cart, then say so and build output
+$v['haveCart'] = 'NO';
+$v['grandTotal'] = '$0.00';
+if (count($_SESSION['GLM_EVENT_REG']['Cart']) > 0) {
+    $v['haveCart'] = 'YES';
+
+    $cart = array();
+    $grand_total = 0;
+    $v['cart_med_info'] = 'NO';
+
+    // For each entry in the cart
+    foreach ($_SESSION['GLM_EVENT_REG']['Cart'] as $c) {
+
+        // Extract cart
+        $c_data = unserialize($c);
+        $entry = array(
+            'cart_id'      => $c_data['cart_id'],
+            'event_id'     => $c_data['id'],
+            'event_name'   => $c_data['name'],
+            'have_location'    => (trim($c_data['location']) != '' ? 'YES' : 'NO'),
+            'location'     => $c_data['location'],
+            'date_specific'    => ($c_data['date_specific'] == 't' ? 'YES' : 'NO'),
+            'start_date'   => $c_data['start_date'],
+            'end_date'     => $c_data['end_date'],
+               'ask_date'         => ($c_data['ask_date'] == 't' ? 'YES' : 'NO'),
+               'desired_date' => $c_data['desired_date'],
+            'have_days'    => ($c_data['dates'] != '' ? 'YES' : 'NO'),
+            'days'         => $c_data['dates'],
+            'cutoff_date'  => $c_data['cutoff_date'],
+            'rate_class'   => $c_data['rate_class'],
+            'charges'      => $c_data['charges'],
+            'total_charges' => $c_data['total_charges'],
+            'totalCharges' => money($c_data['total_charges']),
+            'need_attendees' => ($c_data['need_attendees'] == 't' ? 'YES' : 'NO'),
+            'have_attendees' => (($c_data['numb_attendees']-0) > 0 ? 'YES' : 'NO'),
+            'numb_attendees' => ($c_data['numb_attendees'] - 0),
+            'attendees'    => $c_data['attendees'],
+            'med_info'     => ($config->event_registration->medical_info && $c_data['med_info'] == 't' ? 'YES' : 'NO'),
+            'have_mf_data' => (count($c_data['mf_data']) > 0 ? 'YES' : 'NO'),
+            'mf_data'      => $c_data['mf_data'],
+            'haveTerms'    => $c_data['haveTerms'],
+            'terms'        => $c_data['terms']
+        );
+
+        $grand_total += $c_data['total_charges'];
+
+        // Check for medical information request
+        if ($config->event_registration->medical_info && $c_data['med_info'] == 't') {
+            $v['cart_med_info'] = 'YES';
+        }
+
+        // Check for payment method override
+        if ($c_data['restrict_comp_code'] == 't') {
+               $v['pay_by_comp_code'] = 'Restricted';
+        }
+        if ($c_data['restrict_check'] == 't') {
+               $v['pay_by_check'] = 'Restricted';
+        }
+        if ($c_data['restrict_call_from_merchant'] == 't') {
+               $v['pay_by_call_from_merchant'] = 'Restricted';
+        }
+        if ($c_data['restrict_cash'] == 't') {
+               $v['pay_by_cash'] = 'Restricted';
+        }
+        if ($c_data['restrict_credit_card'] == 't') {
+               $v['pay_by_credit_card'] = 'Restricted';
+        }
+
+        $cart[$c_data['cart_id']] = $entry;
+
+    }
+
+    // If not admin user, then be sure to kill any restricted payment methods.
+    if (!$_SESSION['GLM_EVENT_REG']['admin_user']) {
+
+       if ($v['pay_by_comp_code'] == "Restricted") {
+               $v['pay_by_comp_code'] = 'No';
+       }
+       if ($v['pay_by_check'] == "Restricted") {
+               $v['pay_by_check'] = 'No';
+       }
+       if ($v['pay_by_call_from_merchant'] == "Restricted") {
+               $v['pay_by_call_from_merchant'] = 'No';
+       }
+       if ($v['pay_by_cash'] == "Restricted") {
+               $v['pay_by_cash'] = 'No';
+       }
+       if ($v['pay_by_credit_card'] == "Restricted") {
+               $v['pay_by_credit_card'] = 'No';
+       }
+
+    }
+
+    // Count how many payment methods we have available
+    $v['one_payment_type_available'] = 'No';
+    $pmc = 0;
+    if ($v['pay_by_comp_code'] != 'No') { $pmc++; }
+    if ($v['pay_by_check'] != 'No') { $pmc++; }
+    if ($v['pay_by_call_from_merchant'] != 'No') { $pmc++; }
+    if ($v['pay_by_cash'] != 'No') { $pmc++; }
+    if ($v['pay_by_credit_card'] != 'No') { $pmc++; }
+    if ($pmc == 1) {
+        $v['one_payment_type_available'] = 'Yes';
+    }
+
+    $v['noCharges'] = 'NO';
+    $noCharges = false;
+    if ($grand_total == 0) {
+
+       $v['noCharges'] = 'YES';
+        $noCharges = true;
+
+        // Set checkout billing fields required for free registrations
+        $v['show_free_fname'] = ($config->event_registration->free_use_fname?'YES':'NO');
+        $v['show_free_lname'] = ($config->event_registration->free_use_lname?'YES':'NO');
+        $v['show_free_addr1'] = ($config->event_registration->free_use_addr1?'YES':'NO');
+        $v['show_free_addr2'] = ($config->event_registration->free_use_addr2?'YES':'NO');
+        $v['show_free_city'] = ($config->event_registration->free_use_city?'YES':'NO');
+        $v['show_free_state'] = ($config->event_registration->free_use_state?'YES':'NO');
+        $v['show_free_country'] = ($config->event_registration->free_use_country?'YES':'NO');
+        $v['show_free_zip'] = ($config->event_registration->free_use_zip?'YES':'NO');
+        $v['show_free_phone'] = ($config->event_registration->free_use_phone?'YES':'NO');
+        $v['show_free_fax'] = ($config->event_registration->free_use_fax?'YES':'NO');
+
+        if (!$config->event_registration->free_use_city && !$config->event_registration->free_use_state && !$config->event_registration->free_use_country && !$config->event_registration->free_use_zip) {
+               $v['show_free_cityzip'] = 'NO';
+        }
+
+    }
+
+    $v['grandTotal'] = money($grand_total);
+    $view_tags['shoppingCart'] = $cart;
+
+}
+
+
+/****************************************************
+ *
+ *  Certain steps require data to be checked and the
+ *  user sent back to the previous step if something
+ *  is wrong or certain default values to be set.
+ *
+ *****************************************************/
+
+// If Step5 or Step6 - Setup required billing info fields for various payment types.
+if ($Action == "Step5" || $Action == "Step6") {
+
+       // Default to billing information fields under payment types dissabled
+       $v['comp_code_fields_used'] = 'NO';
+       $v['check_fields_used'] = 'NO';
+       $v['call_from_merchant_fields_used'] = 'NO';
+       $v['cash_fields_used'] = 'NO';
+       $v['credit_card_fields_used'] = 'NO';
+
+       // Are we just using full billing information at the top of checkout page - Do so if free checkout
+       if ($config->event_registration->use_full_billing_info_at_top || $v['noCharges'] == 'YES') {
+               $v['use_full_billing_at_top'] = 'YES';
+               $ufbt = true;
+       } else {
+               $v['use_full_billing_at_top'] = 'NO';
+               $ufbt = false;
+       }
+
+       // Default billing field check to setting of use_full_billing_info_at_top config item
+       $field_req_check = array(
+               'fname' => $ufbt,
+               'lname' => $ufbt,
+               'addr1' => $ufbt,
+               'addr2' => $ufbt,
+               'city' => $ufbt,
+               'state' => $ufbt,
+               'country' => $ufbt,
+               'zip' => $ufbt,
+               'phone' => $ufbt,
+               'fax' => $ufbt
+       );
+
+       // If we're not going to use the full billing info at the top
+       if (!$ufbt) {
+
+               // Check for selected payment type
+               $p_type = filter_request('payment_type');
+
+               // We're not using the standard full billing information so we need to determine which fields for each payment type
+
+               // Pay by - Comp Code
+               $v['comp_code_field_fname'] = 'NO';
+               $v['comp_code_field_lname'] = 'NO';
+               $v['comp_code_field_addr1'] = 'NO';
+               $v['comp_code_field_addr2'] = 'NO';
+               $v['comp_code_field_city'] = 'NO';
+               $v['comp_code_field_state'] = 'NO';
+               $v['comp_code_field_country'] = 'NO';
+               $v['comp_code_field_zip'] = 'NO';
+               $v['comp_code_field_phone'] = 'NO';
+               $v['comp_code_field_fax'] = 'NO';
+
+               // Get required fields for this pay type - check each
+               $fields_comp_code = explode(',', $config->event_registration->bill_info_req->comp_code);
+               if (preg_match('/,/', $config->event_registration->bill_info_req->comp_code) && count($fields_comp_code) > 0) {
+                       foreach($fields_comp_code as $f) {
+                               $v['comp_code_field_'.trim($f)] = 'YES';
+                               $v['comp_code_fields_used'] = 'YES';
+
+                               // Also check if this pay type has been selected. If so set field to required.
+                               if ($p_type == 'comp_code') {
+                                       $field_req_check[trim($f)] = true;
+                               }
+                       }
+               }
+
+               // Pay by - Check
+               $v['check_field_fname'] = 'NO';
+               $v['check_field_lname'] = 'NO';
+               $v['check_field_addr1'] = 'NO';
+               $v['check_field_addr2'] = 'NO';
+               $v['check_field_city'] = 'NO';
+               $v['check_field_state'] = 'NO';
+               $v['check_field_country'] = 'NO';
+               $v['check_field_zip'] = 'NO';
+               $v['check_field_phone'] = 'NO';
+               $v['check_field_fax'] = 'NO';
+
+               // Get required fields for this pay type - check each
+               $fields_check = explode(',', $config->event_registration->bill_info_req->check);
+               if (preg_match('/,/', $config->event_registration->bill_info_req->check) && count($fields_check) > 0) {
+                       foreach($fields_check as $f) {
+                               $v['check_field_'.trim($f)] = 'YES';
+                               $v['check_fields_used'] = 'YES';
+
+                               // Also check if this pay type has been selected. If so set field to required.
+                               if ($p_type == 'by_check') {
+                                       $field_req_check[trim($f)] = true;
+                               }
+                       }
+               }
+
+               // Pay by - Call from Merchant
+               $v['call_from_merchant_field_fname'] = 'NO';
+               $v['call_from_merchant_field_lname'] = 'NO';
+               $v['call_from_merchant_field_addr1'] = 'NO';
+               $v['call_from_merchant_field_addr2'] = 'NO';
+               $v['call_from_merchant_field_city'] = 'NO';
+               $v['call_from_merchant_field_state'] = 'NO';
+               $v['call_from_merchant_field_country'] = 'NO';
+               $v['call_from_merchant_field_zip'] = 'NO';
+               $v['call_from_merchant_field_phone'] = 'NO';
+               $v['call_from_merchant_field_fax'] = 'NO';
+
+               // Get required fields for this pay type - check each
+               $fields_call_from_merchant = explode(',', $config->event_registration->bill_info_req->call_from_merchant);
+               if (preg_match('/,/', $config->event_registration->bill_info_req->call_from_merchant) && count($fields_call_from_merchant) > 0) {
+                       foreach($fields_call_from_merchant as $f) {
+                               $v['call_from_merchant_field_'.trim($f)] = 'YES';
+                               $v['call_from_merchant_fields_used'] = 'YES';
+
+                               // Also check if this pay type has been selected. If so set field to required.
+                               if ($p_type == 'call_from_merchant') {
+                                       $field_req_check[trim($f)] = true;
+                               }
+                       }
+               }
+
+               // Pay by - Cash
+               $v['cash_field_fname'] = 'NO';
+               $v['cash_field_lname'] = 'NO';
+               $v['cash_field_addr1'] = 'NO';
+               $v['cash_field_addr2'] = 'NO';
+               $v['cash_field_city'] = 'NO';
+               $v['cash_field_state'] = 'NO';
+               $v['cash_field_country'] = 'NO';
+               $v['cash_field_zip'] = 'NO';
+               $v['cash_field_phone'] = 'NO';
+               $v['cash_field_fax'] = 'NO';
+
+               // Get required fields for this pay type - check each
+               $fields_cash = explode(',', $config->event_registration->bill_info_req->cash);
+               if (preg_match('/,/', $config->event_registration->bill_info_req->cash) && count($fields_cash) > 0) {
+                       foreach($fields_cash as $f) {
+                               $v['cash_field_'.trim($f)] = 'YES';
+                               $v['cash_fields_used'] = 'YES';
+
+                               // Also check if this pay type has been selected. If so set field to required.
+                               if ($p_type == 'cash') {
+                                       $field_req_check[trim($f)] = true;
+                               }
+                       }
+               }
+
+               // Pay by - Credit Card
+               $v['credit_card_field_fname'] = 'NO';
+               $v['credit_card_field_lname'] = 'NO';
+               $v['credit_card_field_addr1'] = 'NO';
+               $v['credit_card_field_addr2'] = 'NO';
+               $v['credit_card_field_city'] = 'NO';
+               $v['credit_card_field_state'] = 'NO';
+               $v['credit_card_field_country'] = 'NO';
+               $v['credit_card_field_zip'] = 'NO';
+               $v['credit_card_field_phone'] = 'NO';
+               $v['credit_card_field_fax'] = 'NO';
+
+               // Get required fields for this pay type - check each
+               $fields_credit_card = explode(',', $config->event_registration->bill_info_req->credit_card);
+               if (preg_match('/,/', $config->event_registration->bill_info_req->credit_card) && count($fields_credit_card) > 0) {
+                       foreach($fields_credit_card as $f) {
+                               $v['credit_card_field_'.trim($f)] = 'YES';
+                               $v['credit_card_fields_used'] = 'YES';
+
+                               // Also check if this pay type has been selected. If so set field to required.
+                               if ($p_type == 'credit_card') {
+                                       $field_req_check[trim($f)] = true;
+                               }
+                       }
+               }
+
+       }
+
+} // If Step5 or Step6
+
+// If Step5 then init parameters
+if ($Action == "Step5") {
+
+    // Check that we actually have a cart
+    if (!is_array($view_tags['shoppingCart']) || count($view_tags['shoppingCart']) == 0) {
+
+        if ($config->event_registration->debug) {
+            $v['debug'] .= "Checkout Debug: Cart missing or cart empty - aborting<br>";
+        }
+
+        $reason[]['text'] = "You do not currently have anything selected. Please select activities first.";
+        $Action = 'Step0';
+
+    } else {
+
+        // Check if this is the first time to this checkout page
+        if (!isset($_REQUEST['checkoutPage'])) {
+
+            // Do we have a registered user?
+            if ($user_data) {
+
+                // Yes, so get the data from their record
+                $v['fname'] = $user_data['fname'];
+                $v['lname'] = $user_data['lname'];
+                $v['addr1'] = $user_data['addr1'];
+                $v['addr2'] = $user_data['addr2'];
+                $v['city'] = $user_data['city'];
+                $v['state'] = reg_build_picklist("state", $si_states_array, (!empty($user_data['state']) ? $user_data['state'] : 'MI'), "standard", "blank");
+                $v['country'] = reg_build_picklist("country", $si_countries_array, (!empty($user_data['country']) ? $user_data['country'] : "US"), "standard", "blank");
+                $v['zip'] = $user_data['zip'];
+                $v['phone'] = $user_data['phone'];
+                $v['fax'] = $user_data['fax'];
+                $v['email'] = $user_data['email'];
+                $v['contact_fname'] = $user_data['contact_fname'];
+                $v['contact_lname'] = $user_data['contact_lname'];
+                $v['contact_addr1'] = $user_data['contact_addr1'];
+                $v['contact_addr2'] = $user_data['contact_addr2'];
+                $v['contact_city'] = $user_data['contact_city'];
+                $v['contact_state'] = reg_build_picklist("contact_state", $si_states_array, (!empty($user_data['state']) ? $user_data['contact_state'] : 'MI'), "standard", "blank");
+                $v['contact_country'] = reg_build_picklist("contact_country", $si_countries_array, (!empty($user_data['contact_country']) ? $user_data['country'] : "US"), "standard", "blank");
+                $v['contact_zip'] = $user_data['contact_zip'];
+                $v['contact_phone'] = $user_data['contact_phone'];
+                $v['contact_fax'] = $user_data['contact_fax'];
+                $v['login_password'] = '';
+                $v['password_msg'] = '';
+
+            } else {
+
+                // Apparently not, so start with blank fields
+                $v['fname'] = '';
+                $v['lname'] = '';
+                $v['addr1'] = '';
+                $v['addr2'] = '';
+                $v['city'] = '';
+                $v['state'] = reg_build_picklist("state", $si_states_array, 'MI', "standard", "blank");
+                $v['country'] = reg_build_picklist("country", $si_countries_array, "US", "standard", "blank");
+                $v['zip'] = '';
+                $v['phone'] = '';
+                $v['fax'] = '';
+                $v['email'] = '';
+                $v['contact_fname'] = '';
+                $v['contact_lname'] = '';
+                $v['contact_addr1'] = '';
+                $v['contact_addr2'] = '';
+                $v['contact_city'] = '';
+                $v['contact_state'] = reg_build_picklist("contact_state", $si_states_array, 'MI', "standard", "blank");
+                $v['contact_country'] = reg_build_picklist("contact_country", $si_countries_array, "US", "standard", "blank");
+                $v['contact_zip'] = '';
+                $v['contact_phone'] = '';
+                $v['contact_fax'] = '';
+
+                // Generate a random access code for the new team
+                require GLM_APP_BASE.'Common/Registrations_V3/classes/EasyPassword.php';
+                $ep = new EasyPassword();
+                $new_passwd = $ep->generateEasyPassword();
+                $v['login_password'] = $new_passwd;
+                $v['password_msg'] = 'A suggested '.$v['word_password'].' has been provided.';
+
+            }
+
+            $v['fax'] = '';
+            $v['pay_code'] = '';
+            $v['ccname'] = '';
+            $v['cctype'] = '';
+            $v['ccnum'] = '';
+            $v['cccode'] = '';
+            $v['ccmonth'] = '';
+            $v['ccyear'] = '';
+            $v['password'] = '';
+            $v['dob'] = '';
+/* now with each attendee
+            $v['guardian'] = '';
+            $v['emer_contact'] = '';
+            $v['emer_phone'] = '';
+            $v['med_history'] = '';
+            $v['allergy_med'] = '';
+*/
+        }
+    }
+}
+
+// If Step6 then process checkout
+if ($Action == "Step6") {
+
+    $force_Action = '';
+    $v['password_msg'] = '';
+    $existing_registrant = false;
+
+    if ($config->event_registration->debug) {
+        $v['debug'] .= "Checkout Processing Debug Enabled<br>";
+        $v['debug'] .= "Checkout Debug: Checkout Pre-processing started<br>";
+    }
+
+    if ($config->event_registration->debug) {
+        $v['debug'] .= "Checkout Debug: Checkout main processing started<br>";
+    }
+
+    // Check that we actually have a cart
+    if (!is_array($view_tags['shoppingCart']) || count($view_tags['shoppingCart']) == 0) {
+
+        if ($config->event_registration->debug) {
+            $v['debug'] .= "Checkout Debug: Cart missing or cart empty - aborting<br>";
+        }
+
+        $reason[]['text'] = "You do not currently have anything selected. Please select activities first.";
+        $Action = 'Step0';
+
+    }
+
+    // If there's no problems so far - continue with checkout
+    if (count($reason) == 0) {
+
+        // Validate and sanitize input and clear any unused input fields
+        if ($field_req_check['fname']) {
+               $v['fname']                             = filter_request('fname');
+        } else {
+               $v['fname']                     = '';
+        }
+        if ($field_req_check['fname']) {
+               $v['lname']                             = filter_request('lname');
+                } else {
+               $v['lname']                     = '';
+        }
+        if ($field_req_check['fname']) {
+               $v['addr1']                             = filter_request('addr1');
+                } else {
+               $v['addr1']                     = '';
+        }
+        if ($field_req_check['fname']) {
+               $v['addr2']                             = filter_request('addr2');
+                } else {
+               $v['addr2']                     = '';
+        }
+        if ($field_req_check['fname']) {
+               $v['city']                              = filter_request('city');
+                } else {
+               $v['city']                              = '';
+        }
+        if ($field_req_check['fname']) {
+               $v['state']                             = filter_request('state');
+                } else {
+               $v['state']                     = '';
+        }
+        if ($field_req_check['fname']) {
+               $v['country']                   = filter_request('country');
+                } else {
+               $v['country']                   = '';
+        }
+        if ($field_req_check['fname']) {
+               $v['zip']                               = filter_request('zip');
+                } else {
+               $v['zip']                               = '';
+        }
+        if ($field_req_check['fname']) {
+               $v['phone']                             = filter_request('phone');
+                } else {
+               $v['phone']                     = '';
+        }
+        if ($field_req_check['fname']) {
+               $v['fax']                               = filter_request('fax');
+                } else {
+               $v['fax']                               = '';
+        }
+        $v['email']                            = filter_request('email');
+        $v['contact_fname']            = filter_request('contact_fname');
+        $v['contact_lname']            = filter_request('contact_lname');
+        $v['contact_addr1']            = filter_request('contact_addr1');
+        $v['contact_addr2']            = filter_request('contact_addr2');
+        $v['contact_city']             = filter_request('contact_city');
+        $v['contact_state']            = filter_request('contact_state');
+        $v['contact_country']  = filter_request('contact_country');
+        $v['contact_zip']              = filter_request('contact_zip');
+        $v['contact_phone']            = filter_request('contact_phone');
+        $v['contact_fax']              = filter_request('contact_fax');
+        $v['login_password']   = filter_request('login_password');
+        $v['payment_type']             = filter_request('payment_type');
+        $v['pay_code']                 = filter_request('pay_code');
+        $v['ccname']                   = filter_request('ccname');
+        $cctype                                        = filter_request('cctype');
+        $v['cctype_store']             = $cctype;
+        $v['ccnum']                            = filter_request('ccnum');
+        $v['cccode']                   = filter_request('cccode', FILTER_SANITIZE_NUMBER_INT);
+        $ccmonth                               = filter_request('ccmonth', FILTER_SANITIZE_NUMBER_INT);
+        $v['ccmonth_store']            = $ccmonth;
+        $ccyear                                        = filter_request('ccyear', FILTER_SANITIZE_NUMBER_INT);
+        $v['ccyear_store']             = $ccyear;
+
+               // Check for required fields
+        if ((!$noCharges || $config->event_registration->free_use_fname) && empty($v['fname']) && $field_req_check['fname']) {
+            $reason[]['text'] = "First Name is required";
+        }
+        if ((!$noCharges || $config->event_registration->free_use_lname) && empty($v['lname']) && $field_req_check['lname']) {
+            $reason[]['text'] = "Last Name is required";
+        }
+        if ((!$noCharges || $config->event_registration->free_use_addr1) && empty($v['addr1']) && $field_req_check['addr1']) {
+            $reason[]['text'] = "Address is required";
+        }
+        if ((!$noCharges || $config->event_registration->free_use_city) && empty($v['city']) && $field_req_check['city']) {
+            $reason[]['text'] = "City is required";
+        }
+        if ((!$noCharges || $config->event_registration->free_use_state) && empty($v['state']) && $field_req_check['state']) {
+            $reason[]['text'] = "State is required";
+        }
+        if ((!$noCharges || $config->event_registration->free_use_zip) && empty($v['zip']) && $field_req_check['zip']) {
+            $reason[]['text'] = "ZIP Code is required";
+        }
+        if ((!$noCharges || $config->event_registration->free_use_country) && empty($v['country']) && $field_req_check['country']) {
+            $reason[]['text'] = "Country is required";
+        }
+        if ((!$noCharges || $config->event_registration->free_use_phone) && empty($v['phone']) && $field_req_check['phone']) {
+            $reason[]['text'] = "Phone number is required";
+        }
+        if (empty($v['email'])) {
+            $reason[]['text'] = "A valid E-Mail address is required";
+        }
+
+        // Check contact data
+        if ($config->event_registration->show_contact_data) {
+               if ($config->event_registration->required->contact_fname && empty($v['contact_fname'])) {
+                       $reason[]['text'] = $config->event_registration->titles->contact_information.": ".$config->event_registration->prompt->contact_fname." is required";
+               }
+               if ($config->event_registration->required->contact_lname && empty($v['contact_lname'])) {
+                       $reason[]['text'] = $config->event_registration->titles->contact_information.": ".$config->event_registration->prompt->contact_lname." is required";
+               }
+               if ($config->event_registration->required->contact_addr1 && empty($v['contact_addr1'])) {
+                       $reason[]['text'] = $config->event_registration->titles->contact_information.": ".$config->event_registration->prompt->contact_addr1." is required";
+               }
+               if ($config->event_registration->required->contact_addr2 && empty($v['contact_addr2'])) {
+                       $reason[]['text'] = $config->event_registration->titles->contact_information.": ".$config->event_registration->prompt->contact_addr2." is required";
+               }
+               if ($config->event_registration->required->contact_city && empty($v['contact_city'])) {
+                       $reason[]['text'] = $config->event_registration->titles->contact_information.": ".$config->event_registration->prompt->contact_city." is required";
+               }
+               if ($config->event_registration->required->contact_state && empty($v['contact_state'])) {
+                       $reason[]['text'] = $config->event_registration->titles->contact_information.": ".$config->event_registration->prompt->contact_state." is required";
+               }
+               if ($config->event_registration->required->contact_zip && empty($v['contact_zip'])) {
+                       $reason[]['text'] = $config->event_registration->titles->contact_information.": ".$config->event_registration->prompt->contact_zip."Contact ZIP Code is required";
+               }
+               if ($config->event_registration->required->contact_country && empty($v['contact_country'])) {
+                       $reason[]['text'] = $config->event_registration->titles->contact_information.": ".$config->event_registration->prompt->contact_country." is required";
+               }
+               if ($config->event_registration->required->contact_phone && empty($v['contact_phone'])) {
+                       $reason[]['text'] = $config->event_registration->titles->contact_information.": ".$config->event_registration->prompt->contact_phone." is required";
+               }
+               if ($config->event_registration->required->contact_fax && empty($v['contact_fax'])) {
+                       $reason[]['text'] = $config->event_registration->titles->contact_information.": ".$config->event_registration->prompt->contact_fax." is required";
+               }
+        }
+
+        $v['contact_same'] = $_REQUEST['contact_same'] == 'on' ? 'CHECKED' : '';
+        $v['email_ok'] = $_REQUEST['email_ok'] == 'on' ? 'CHECKED' : '';
+
+        // If not logged in, check for existing registrant
+
+
+
+        if ($config->event_registration->debug && count($reason) > 0) {
+            $v['debug'] .= "Checkout Debug: Initial input field validation and required check failed<br>";
+        }
+
+        // For each cart entry, check the following
+        reset($view_tags['shoppingCart']);
+        while (list($key, $val) = each($view_tags['shoppingCart'])) {
+
+            $med_reason = false;
+
+            // If cart entry needs med info, add that
+            if ($config->event_registration->medical_info && $val['med_info'] == 'YES') {
+
+                // Scan each of the cart entries to see which ones need med info
+                while (list($ka, $va) = each($val['attendees'])) {
+
+                    $dob = filter_request('att_'.$key.'_'.$ka.'_dob');
+                    $guardian = filter_request('att_'.$key.'_'.$ka.'_guardian');
+                    $emer_contact = filter_request('att_'.$key.'_'.$ka.'_emer_contact');
+                    $emer_phone = filter_request('att_'.$key.'_'.$ka.'_emer_phone');
+                    $med_history = filter_request('att_'.$key.'_'.$ka.'_med_history');
+                    $allergy_med = filter_request('att_'.$key.'_'.$ka.'_allergy_med');
+
+                    if (empty($dob)) {
+                        $reason[]['text'] = "Date of Birth is required for ".$config->event_registration->word->attendee." ".$va['name'];
+                        $med_reason = true;
+                    }
+                    if (empty($emer_contact)) {
+                        $reason[]['text'] = "Emergency Contact is required for ".$config->event_registration->word->attendee." ".$va['name'];
+                        $med_reason = true;
+                    }
+
+                    if (empty($emer_phone) || !preg_match("/^[ ]*([0-9]{0,3}-)?[\(]*[0-9]{3}[\)]*[ -.]*[0-9]{3}[ -.]*[0-9]{4}[ ]*$/i", $emer_phone)) {
+                        $reason[]['text'] = "A valid Emergency Phone is required for ".$config->event_registration->word->attendee." ".$va['name'];
+                        $med_reason = true;
+                    }
+
+                    $dob_time = strtotime($dob);
+                    if ($dob_time == 0) {
+                        $reason[]['text'] = "Date of Birth is not a valid date for ".$config->event_registration->word->attendee." ".$va['name'];
+                    } else {
+                        $dob = date('m/d/Y', $dob_time);
+                    }
+
+                    // Put updated info back in cart
+                    $attendee = array(
+                        'attendee_id' => $va['attendee_id'],
+                        'name' => $va['name'],
+                        'dob' => $dob,
+                        'guardian' => $guardian,
+                        'emer_contact' => $emer_contact,
+                        'emer_phone' => $emer_phone,
+                        'med_history' => $med_history,
+                        'allergy_med' => $allergy_med
+                    );
+                    $c = unserialize($_SESSION['GLM_EVENT_REG']['Cart'][$key]);
+                    $c['attendees'][$ka] = $attendee;
+                    $_SESSION['GLM_EVENT_REG']['Cart'][$key] = serialize($c);
+
+                    // Update view data with the sumbitted info
+                    $view_tags['shoppingCart'][$key]['attendees'][$ka]['dob'] = $dob;
+                    $view_tags['shoppingCart'][$key]['attendees'][$ka]['have_dob'] = (trim($dob) != '' ? 'YES' : 'NO');
+                    $view_tags['shoppingCart'][$key]['attendees'][$ka]['guardian'] = $guardian;
+                    $view_tags['shoppingCart'][$key]['attendees'][$ka]['emer_contact'] = $emer_contact;
+                    $view_tags['shoppingCart'][$key]['attendees'][$ka]['emer_phone'] = $emer_phone;
+                    $view_tags['shoppingCart'][$key]['attendees'][$ka]['med_history'] = $med_history;
+                    $view_tags['shoppingCart'][$key]['attendees'][$ka]['allergy_med'] = $allergy_med;
+
+                    $view_tags['shoppingCart'][$key]['attendees'][$ka]['have_dob'] = (trim($dob) != '' ? 'YES' : 'NO');
+                    $view_tags['shoppingCart'][$key]['attendees'][$ka]['have_guardian'] = (trim($guardian) != '' ? 'YES' : 'NO');
+                    $view_tags['shoppingCart'][$key]['attendees'][$ka]['have_emer_contact'] = (trim($emer_contact) != '' ? 'YES' : 'NO');
+                    $view_tags['shoppingCart'][$key]['attendees'][$ka]['have_emer_phone'] = (trim($emer_phone) != '' ? 'YES' : 'NO');
+                    $view_tags['shoppingCart'][$key]['attendees'][$ka]['have_med_history'] = (trim($med_history) != '' ? 'YES' : 'NO');
+                    $view_tags['shoppingCart'][$key]['attendees'][$ka]['have_allergy_med'] = (trim($allergy_med) != '' ? 'YES' : 'NO');
+
+                } // For each Attendee
+
+            } // If Med info required
+
+        } // For each cart entry
+
+        $v['payment_type_text'] = '(unknown)';
+        $pay_type = '';
+
+        if (!$noCharges) {
+
+            if ($config->event_registration->debug) {
+                $v['debug'] .= "Checkout Debug: Not free registration<br>";
+            }
+
+            $status = SI_REG_STATUS_UNPAID;
+
+            // Check for good payment code
+            if ($v['payment_type'] == 'comp_code') {
+                $pay_type = 'comp_code';
+                $v['payment_type_text'] = 'Comp Code';
+
+                if ($config->event_registration->debug) {
+                    $v['debug'] .= "Checkout Debug: Pay by Comp Code selected<br>";
+                }
+
+                if (!empty($v['pay_code'])) {
+
+                    if ($config->event_registration->debug) {
+                       $v['debug'] .= "Checkout Debug: User supplied non-null comp code - ".$v['pay_code']."<br>";
+                    }
+
+                    $codes = unserialize($misc['pay_codes']);
+                    $pay_code_match = FALSE;
+
+                    // Try to match with paycodes for this registration setup
+
+                    if (is_array($codes))
+                        foreach ($codes as $code)
+
+                            if (trim($v['pay_code']) == trim($code[0])) {
+
+                                if ($config->event_registration->debug) {
+                                    $v['debug'] .= "Checkout Debug: Comp Code matched<br>";
+                                }
+
+                                // Code found.
+                                $pay_code_match = TRUE;
+                                $status = SI_REG_STATUS_COMP;
+                            }
+
+                    if (!$pay_code_match) {
+
+                        if ($config->event_registration->debug) {
+                            $v['debug'] .= "Checkout Debug: Comp Code did not match<br>";
+                        }
+
+                        $reason[]['text'] = "Payment code is not valid";
+
+                    } else {
+                        // make all charges 0
+
+                        for ($i = 0; $i < count($charges); $i++)
+                            $charges[$i]['charge'] = $charges[$i]['extend'] = '$0.00';
+
+                        for ($i = 0; $i < count($field_data); $i++)
+                            $field_data[$i]['charge'] = 0;
+
+                        for ($i = 0; $i < count($field_values); $i++)
+                            $field_values[$i]['field_charge'] = '$0.00';
+
+                        $total_charges = 0;
+
+                        if ($config->event_registration->debug) {
+                            $v['debug'] .= "Checkout Debug: All charges set to $0<br>";
+                        }
+
+                    }
+                } else {
+
+                    if ($config->event_registration->debug) {
+                        $v['debug'] .= "Checkout Debug: No Comp Code provided<br>";
+                    }
+
+                    $reason[]['text'] = "You selected to enter a Comp Code but did not supply one.";
+                }
+
+            } elseif ($v['payment_type'] == 'credit_card') {
+
+                if ($config->event_registration->debug) {
+                    $v['debug'] .= "Checkout Debug: Pay by Credit Card selected<br>";
+                }
+
+                // No pay code, try CC processing
+                $v['payment_type_text'] = 'Credit Card';
+                $pay_type = 'credit_card';
+
+                if (empty($v['ccnum'])) {
+
+                    if ($config->event_registration->debug) {
+                        $v['debug'] .= "Checkout Debug: Credit Card number not provided<br>";
+                    }
+
+                    $reason[]['text'] = "Credit Card number is required";
+
+                } else {
+
+                    if ($config->event_registration->debug) {
+                        $v['debug'] .= "Checkout Debug: Got Credit Card number - ".$v['ccnum']."<br>";
+                    }
+
+                    if (($cct = credit_card_check($v['ccnum'], $si_cc_verify, $config->event_registration->cc_accepts)) == FALSE) {
+
+                        if ($config->event_registration->debug) {
+                            $v['debug'] .= "Checkout Debug: Credit Card number does not verify<br>";
+                        }
+
+                        $reason[]['text'] = "Your Credit Card number does not appear to be correct.";
+
+                    } elseif ($cct != $cctype && $cct != "Test") {
+
+                        if ($config->event_registration->debug) {
+                            $v['debug'] .= "Checkout Debug: Credit Card number does not appear to be selected type - $cctype<br>";
+                        }
+
+                        $reason[]['text'] = "Your card does not appear to be a $cctype.";
+
+                    }
+                }
+
+                if (strtotime("$ccmonth/1/$ccyear") < strtotime(date('m/1/Y'))) {
+
+                    if ($config->event_registration->debug) {
+                        $v['debug'] .= "Checkout Debug: Credit Card date indicates it's expired<br>";
+                    }
+
+                    $reason[]['text'] = "Credit Card has expired.";
+
+                }
+
+                if (empty($v['ccname'])) {
+
+                    if ($config->event_registration->debug) {
+                        $v['debug'] .= "Checkout Debug: Credit Card number not supplied<br>";
+                    }
+
+                    $reason[]['text'] = "Name on Card is required";
+
+                }
+
+                $status = SI_REG_STATUS_CC_PEND; // It's OK to set this here since we're not going to process anything unless there's no failure "$reason".
+
+                if ($config->event_registration->debug) {
+                    $v['debug'] .= "Checkout Debug: Checkout status set to CC Pending<br>";
+                }
+
+            // Pay at Event Option
+            } elseif ($v['payment_type'] == 'at_event') {
+
+                if ($config->event_registration->debug) {
+                    $v['debug'] .= "Checkout Debug: Pay at Event selected<br>";
+                }
+
+                $v['payment_type_text'] = 'Pay at Event';
+                $pay_type = 'at_event';
+                $status = SI_REG_STATUS_AT_EVENT;
+
+            // Pay by Check Option
+            } elseif ($v['payment_type'] == 'by_check') {
+
+                if ($config->event_registration->debug) {
+                    $v['debug'] .= "Checkout Debug: Pay by Check selected<br>";
+                }
+
+                $v['payment_type_text'] = 'Pay by Check';
+                $pay_type = 'by_check';
+                $status = SI_REG_STATUS_CHECK_PEND;
+
+            // Pay via Call from Merchant Option
+            } elseif ($v['payment_type'] == 'call_from_merchant') {
+
+                if ($config->event_registration->debug) {
+                    $v['debug'] .= "Checkout Debug: Pay via Call from Merchant selected<br>";
+                }
+
+                $v['payment_type_text'] = 'Pay via Call from Merchant';
+                $pay_type = 'call_from_merchant';
+                $status = SI_REG_STATUS_CALL_FROM_MERCHANT_PEND;
+
+            // Pay Cash Option - Should only be entered by Admin User
+            } elseif ($v['payment_type'] == 'cash') {
+
+                if ($config->event_registration->debug) {
+                    $v['debug'] .= "Checkout Debug: Paid Cash<br>";
+                }
+
+                $v['payment_type_text'] = 'Paid Cash';
+                $pay_type = 'cash';
+                $status = SI_REG_STATUS_CASH_PAID;
+
+            // Paid by Credit Card - Should only be entered by Admin User
+            } elseif ($v['payment_type'] == 'paid_by_credit_card') {
+
+                if ($config->event_registration->debug) {
+                    $v['debug'] .= "Checkout Debug: Paid by Credit Card<br>";
+                }
+
+                $v['payment_type_text'] = 'Paid by Credit Card';
+                $pay_type = 'paid_by_credit_card';
+                $status = SI_REG_STATUS_CC_PAID;
+
+            }
+
+
+            $v['pay_type'] = $pay_type;
+            $v['free_reg'] = 'NO';
+
+        } else {
+
+               // No charges
+               if ($config->event_registration->debug) {
+                       $v['debug'] .= "Checkout Debug: Checkout does not require payment<br>";
+               }
+
+               $cc_conf = '(free registration)';
+               $v['payment_type_text'] = '(no charge)';
+               $pay_type = 'no charge';
+            $v['free_reg'] = 'YES';
+               $status = SI_REG_STATUS_NO_CHARGE;
+
+        }
+
+        if ($pay_type == '') {
+
+            if ($config->event_registration->debug) {
+                $v['debug'] .= "Checkout Debug: User did not select a payment type<br>";
+            }
+
+            $status = SI_REG_STATUS_COMP;
+            $reason[]['text'] = "You did not select a way to pay.";
+        }
+
+        // If there's any problems change step back to 5 - Checkout Form
+
+        if (isset($cc_reason) && $cc_reason != '') {
+
+            if ($config->event_registration->debug) {
+                $v['debug'] .= "Checkout Debug: Checkout problem reason - $cc_reason<br>";
+            }
+
+            $reason[]['text'] = $cc_reason;
+        }
+
+        // Check if credit card has already been submitted. Should only happen if something went seriously wrong.
+        if ($_SESSION['GLM_EVENT_REG']['card_processed'] == true) {
+
+            // Check for customer phone number
+            $cust_phone = '';
+            if (trim($v['customer_tollfree']) != '') {
+                $cust_phone = $v['customer_tollfree'];
+            } elseif (trim($v['customer_phone']) != '') {
+                $cust_phone = $v['customer_phone'];
+            }
+
+            // Notify user of this problem
+            $reason[]['text'] = "You are attempting to re-submit this request but it appears your credit card has already been charged.<br>
+                The system may have had problems storing and completing your request.<br>
+                Please contact ".$v["customer_name"]
+                .( $cust_phone != '' ? " at ".$v["customer_phone"] : '' )
+                ." regarding this problem.";
+
+            // Also kill session to prevent any further actions by user
+            $_SESSION['GLM_EVENT_REG'] = false;
+
+        }
+
+        // If there's no problems so far - continue with checkout
+        if (count($reason) == 0) {
+
+            $v['request_numb'] = '';
+
+            // If 'DO NOT CLEAR' hasn't been requested, don't check for duplicate submission so we can simply resubmit
+            if ($v['addr2'] != 'DO NOT CLEAR') {
+
+                // Check if submission is a duplicate
+                $query = "
+                    SELECT id
+                      FROM registrations.reg_req
+                     WHERE cart_serial = '".$_SESSION['GLM_EVENT_REG']['Cart_Serial_Number']."'
+                ;";
+                if (($rr = db_auto_get_row($query, 0, CONN_STR, FALSE))) {
+
+                    if ($config->event_registration->debug) {
+                        $v['debug'] .= "Checkout Debug: Found cart serial number already in reg_req - Duplicate<br>";
+                    }
+
+                    $reason[]['text'] = "It appears that you have already submitted this request. Please check your E-Mail for a confirmation.";
+
+                    // Kill session
+                    $_SESSION['GLM_EVENT_REG'] = false;
+
+                } else {
+
+                    if ($config->event_registration->debug) {
+                        $v['debug'] .= "Checkout Debug: Cart serial number not found in reg_req - Not a duplicate<br>";
+                    }
+
+                }
+            } else {
+
+                if ($config->event_registration->debug) {
+                    $v['debug'] .= "Checkout Debug: Not checking for duplicates - DO NOT CLEAR was submitted<br>";
+                }
+
+            }
+
+        }
+
+        // If there's no problems so far - continue with checkout
+        if (count($reason) == 0) {
+
+
+            // Prepair transaction to save request and decriment inventory
+            if ($config->event_registration->debug) {
+                $v['debug'] .= "Checkout Debug: Starting checkout SQL transaction<br>";
+            }
+            $transaction = array();
+
+            // Add queries to remove any files being submitted from the mf_temp_file table so they're not deleted.
+            reset($view_tags['shoppingCart']);
+            while (list($key, $val) = each($view_tags['shoppingCart'])) {
+
+                // If there's any form data submitted for this cart entry
+                if (isset($val['mf_data']) && count($val['mf_data']) > 0) {
+
+                    // For each field of the form
+                    foreach ($val['mf_data'] as $mfd) {
+
+                        // If the data field is an upload file
+                        if ($mfd['type'] == 7 && $mfd['value'] != '') {
+                            $transaction[] = "DELETE FROM registrations.mf_temp_file WHERE file_name = '".$mfd['value']."';";
+                        }
+                    }
+                }
+            }
+
+            // If credit card transaction is pending, send it to Card Processor Gatway
+            if (!$noCharges) {
+
+                if ($config->event_registration->debug) {
+                    $v['debug'] .= "Checkout Debug: Checkout requires payment<br>";
+                }
+
+                $v['ccnum_trunc'] = "....... ".substr($v['ccnum'], -4);
+
+            }
+
+            // If we need to process a credit cart
+            $cc_expire = '';
+            if ($status == SI_REG_STATUS_CC_PEND) {
+
+                $cc_expire = sprintf('%02d/%d', $ccmonth, $ccyear);
+
+                switch ($config->event_registration->proc_method) {
+
+                    case 1:    // Processed by Merchant
+
+                        if ($config->event_registration->debug) {
+                            $v['debug'] .= "Checkout Debug: Credit Card Processing - Merchant will process<br>";
+                        }
+
+                        $status = SI_REG_STATUS_CC_PEND; // Card not yet run
+                        $v['checkout_type'] = 'Request'; // This is a request only, not a confirmation
+                        $v['auth_code'] = '(Pending)'; // No authorization code available yet
+
+                        break;
+
+                    case 2:    // Processed by Authorize.Net
+
+                        $conf_header = ''; // Header for E-Mail from Authorize.Net
+                        $conf_footer = ''; // Footer for E-Mail from Authorize.Net
+
+                        if ($config->event_registration->debug) {
+                            $v['debug'] .= "Checkout Debug: Credit Card Processing - Processing by Authorize.net<br>";
+                        }
+
+                        if (isset($reg_data['id'])) {
+                            $cust_id = $reg_data['id'];
+                        } else {
+                            $cust_id = '(pend)';
+                        }
+
+                        $cc_reason = $failure_mode = $cc_conf = '';
+
+                        // If GLM test number
+                        if ($v['ccnum'] == '0011001100110011') {
+
+                            // Say that card was successfully charged
+
+                            if ($config->event_registration->debug) {
+                                $v['debug'] .= "Checkout Debug: GLM Test Card Approved - Authorize.net <br>";
+                            }
+
+                            $status = SI_REG_STATUS_CC_PAID;
+                            $cc_conf = 'GLM TEST CARD';
+                            $v['ccnum'] = $v['ccnum_trunc'];    // Truncate card number
+                            $v['cccode'] = '';
+
+                            $v['checkout_type'] = 'Confirmation';
+                            $v['auth_code'] = $cc_conf;
+
+                        } else {
+
+                            $r = authorize_net_aim(
+                                $config->event_registration->authorize_net->login,
+                                $config->event_registration->authorize_net->key,
+                                $config->event_registration->authorize_net->test,
+                                $config->event_registration->authorize_net->conf,
+                                $config->event_registration->authorize_net->merchant_email,
+                                $grand_total, $v['ccnum'], $cc_expire, $v['cccode'], '',
+                                $v['fname'], $v['lname'], '', $v['addr1'], $v['city'], $v['state'], $v['zip'], $v['country'],
+                                $v['phone'], $v['fax'], $cust_id, $REMOTE_ADDR, '',
+                                $email,
+                                '(pend)', 'Registration', $conf_header, $conf_footer);
+
+                            switch ($r[0]) {
+
+                                case 1: // Approved
+
+                                    if ($config->event_registration->debug) {
+                                        $v['debug'] .= "Checkout Debug: Credit Card Approved<br>";
+                                    }
+
+                                    $status = SI_REG_STATUS_CC_PAID;
+                                    $cc_conf = trim($r[4]);
+                                    $v['ccnum'] = $v['ccnum_trunc'];    // Truncate card number
+                                    $v['cccode'] = '';
+
+                                    break;
+
+                                case 2: // Declined
+
+                                    if ($config->event_registration->debug) {
+                                        $v['debug'] .= "Checkout Debug: Credit Card Declined<br>";
+                                    }
+
+                                    $status = SI_REG_STATUS_CC_DECL;
+                                    $cc_reason .= "Credit Card was declined. Please check the information below to make sure it is correct.";
+                                    $failure_mode = "*** Card Declined ***";
+
+                                    break;
+
+                                case 3: // Error
+                                case 4: // Held for review
+
+                                    if ($config->event_registration->debug) {
+                                        $v['debug'] .= "Checkout Debug: Credit Card Error or Held for review<br>";
+                                    }
+
+                                    $status = SI_REG_STATUS_FAILED;
+                                    $cc_reason .= "Credit Card was not approved".(trim($r[3]) != '' ? ' - '.$r[3] : '');
+                                    $failure_mode = "*** Card Processing Failure (".$r[0].") ".$r[3]." ***";
+
+                                    break;
+
+                                case 100: // Exec call error
+                                case 101: // No data returned from exec call
+                                case 102: // No data returned from Authorize.Net
+                                case 103: // MD5 Hash verification failure - Did we talk to the correct server???
+                                default: // Unknown response code
+
+                                    if ($config->event_registration->debug) {
+                                        $v['debug'] .= "Checkout Debug: Credit Card processing failure or unknown response<br>";
+                                    }
+
+                                    $status = SI_REG_STATUS_FAILED;
+                                    $cc_reason .= "Processing Failure - Unable to store information. Please try later or call to submit.";
+                                    $failure_mode = "*** Card Processing Failure (".$r[0].") ***";
+
+                                    break;
+                            }
+
+                            // If transaction failed for some reason
+
+                            if ($cc_reason != '') {
+
+                                // Mark request with failure mode and delete any dynamic field data from database
+                                $reason[]['text'] = " There is a problem processing your credit card:<br>$cc_reason.";
+                            }
+
+                            $v['checkout_type'] = 'Confirmation';
+                            $v['auth_code'] = $r[4];
+
+                        } // No GLM test card
+
+                        break;
+
+                    case 3:    // Processed by Merchant Solutions
+
+                        $cc_reason = $failure_mode = $cc_conf = '';
+
+                        if ($config->event_registration->debug) {
+                            $v['debug'] .= "Checkout Debug: Credit Card Processing - Processing by Merchant Solutions<br>";
+                        }
+
+                        // If GLM test number
+                        if ($v['ccnum'] == '0011001100110011') {
+
+                            // Say that card was successfully charged
+
+                            if ($config->event_registration->debug) {
+                                $v['debug'] .= "Checkout Debug: GLM Test Card Approved - Merchant Solutions<br>";
+                            }
+
+                            $status = SI_REG_STATUS_CC_PAID;
+                            $cc_conf = 'GLM TEST CARD';
+                            $v['ccnum'] = $v['ccnum_trunc'];    // Truncate card number
+                            $v['cccode'] = '';
+
+                            $v['checkout_type'] = 'Confirmation';
+                            $v['auth_code'] = $cc_conf;
+
+                        } else {
+
+                            // Get Merchant Solutions class
+                            require GLM_APP_BASE.'Common/Registrations_V3/classes/merchant_solutions.inc';
+
+                            // Create gateway object and get WDSL
+                            $ms = new MerchantSolutionsPaymentGateway('processCCSale');
+
+                            // Was there a failure getting the gateway object or WSDL
+                            if (!$ms->success) {
+
+                                $status = SI_REG_STATUS_FAILED;
+                                $cc_reason .= "Processing Failure - Unable to process your credit card at this time. Please try later or call to submit. (GW Object)";
+                                $failure_mode = "*** Card Processing Failure (".$ms->resultDescription.") ***";
+                                $cc_reason .= "<br>*** Card Processing Failure (".$ms->resultDescription.") ***";
+                            } else {
+
+                                // Set Merchant Data
+                                $ms->request->acctid = $config->event_registration->merchant_solutions->acctid;
+                                $ms->request->merchantpin = $config->event_registration->merchant_solutions->merchantpin;
+
+                                // Set Request Data
+                                $ms->request->amount = $grand_total;
+                                $ms->request->ccnum = $v['ccnum'];
+                                $ms->request->expmon = $v['ccmonth_store'];
+                                $ms->request->expyear = $v['ccyear_store'];
+                                $ms->request->ccname = $v['ccname'];
+                                $ms->request->cvv2 = $v['cccode'];
+                                $ms->request->ci_memo = '';
+
+
+                                // Send the transaction to Merchant Solutions
+                                $ms->merchantSolutionsCCSale();
+
+                                // Did we have a communications failure?
+                                if (!$ms->success) {
+                                    $status = SI_REG_STATUS_FAILED;
+                                    $cc_reason .= "Processing Failure - Unable to process your credit card at this time. Please try later or call to submit. (Comm Failure)";
+                                    $failure_mode = "*** Card Processing Failure (".$ms->resultDescription.") ***";
+                                } else {
+
+                                    switch ($ms->result) {
+
+                                        case 'Approved': // Approved
+
+                                            if ($config->event_registration->debug) {
+                                                $v['debug'] .= "Checkout Debug: Credit Card Approved<br>";
+                                            }
+
+                                            $status = SI_REG_STATUS_CC_PAID;
+                                            $cc_conf = $ms->approval->auth;
+                                            $v['ccnum'] = $v['ccnum_trunc'];    // Truncate card number
+                                            $v['cccode'] = '';
+
+                                            break;
+
+                                        case 'Declined': // Declined
+
+                                            if ($config->event_registration->debug) {
+                                                $v['debug'] .= "Checkout Debug: Credit Card Declined - ".$ms->declineReason."<br>";
+                                            }
+
+                                            $status = SI_REG_STATUS_CC_DECL;
+                                            $cc_reason .= "Credit Card was declined: ".$ms->declineReason;
+                                            $failure_mode = "*** Card Declined (".$ms->declineReason.") ***";
+
+                                            break;
+
+                                        case 'Invalid':
+
+                                            if ($config->event_registration->debug) {
+                                                $v['debug'] .= "Checkout Debug: Credit Card Invalid - ".$ms->resultDescription."<br>";
+                                            }
+
+                                            $status = SI_REG_STATUS_CC_DECL;
+                                            $cc_reason .= "Credit Card Invalid: ".$ms->resultDescription;
+                                            $failure_mode = "*** Card Invalid (".$ms->resultDescription.") ***";
+
+                                            break;
+
+
+                                        default: // Unknown response code
+
+                                            if ($config->event_registration->debug) {
+                                                $v['debug'] .= "Checkout Debug: Credit Card processing failure or unknown response<br>";
+                                            }
+
+                                            $status = SI_REG_STATUS_FAILED;
+                                            $cc_reason .= "Processing Failure - Unable to process your credit card at this time. Please try later or call to submit. (Unknown Resp)";
+                                            $failure_mode = "*** Card Processing Failure (".$ms->result.") ***";
+
+                                            break;
+
+                                    } // switch()
+
+                                } // no communications failure
+                            } // no failure getting gateway object/WSDL
+
+                            // If transaction failed for some reason
+
+                            if ($cc_reason != '') {
+
+                                // Mark request with failure mode and delete any dynamic field data from database
+                                $reason[]['text'] = " There is a problem processing your credit card:<br>$cc_reason.";
+                            }
+
+                            $v['checkout_type'] = 'Confirmation';
+                            $v['auth_code'] = $cc_conf;
+
+                        } // No GLM test card
+
+                        break;
+
+                    default:
+                        echo "OOPS! Payment Processing Method has not been set in application.ini.<P>";
+                        exit;
+                        break;
+
+                } // Processing Method
+
+                // Check if credit card has been run and if so save in session to prevent duplicate charges.
+                if ($status == SI_REG_STATUS_CC_PAID) {
+                    $_SESSION['GLM_EVENT_REG']['card_processed'] = true;
+
+                    if ($config->event_registration->debug) {
+                        $v['debug'] .= "Checkout Debug: Credit Card Processed - noted in session<br>";
+                    }
+                }
+
+            } else {
+
+                $v['checkout_type'] = 'Confirmation';
+
+            }
+
+        }// problems so far
+
+        // If there's no problems so far - continue with checkout
+        if (count($reason) == 0) {
+
+            // Build HTML summary
+            $v['grandTotal'] = money($grand_total);
+            $html_store = parse_view_localcheck($config->event_registration->custom_view_files, "registrations_store.html", $view_tags);
+
+            // Save Event Registration request
+            $transaction[] = "INSERT INTO registrations.reg_req
+                                (
+                                    fname,
+                                    lname,
+                                    addr1,
+                                    addr2,
+                                    city,
+                                    state,
+                                    zip,
+                                    country,
+                                    phone,
+                                    fax,
+                                    email,
+                                    email_ok,
+                                    contact_fname,
+                                    contact_lname,
+                                    contact_addr1,
+                                    contact_addr2,
+                                    contact_city,
+                                    contact_state,
+                                    contact_zip,
+                                    contact_country,
+                                    contact_phone,
+                                    contact_fax,
+                                                       is_member,
+                                    member_id,
+                                    date_entered,
+                                    pay_type,
+                                    pay_code,
+                                    status,
+                                    total,
+                                    cc_name,
+                                    cc_type,
+                                    cc_numb,
+                                    cc_exp,
+                                    cc_cvv,
+                                    cc_conf,
+                                    notes,
+                                    summary,
+                                    cart_serial,
+                                    user_trace_info
+                                )
+                            VALUES
+                                (
+                                    '".addslashes($v['fname'])."',
+                                    '".addslashes($v['lname'])."',
+                                    '".addslashes($v['addr1'])."',
+                                    '".addslashes($v['addr2'])."',
+                                    '".addslashes($v['city'])."',
+                                    '".addslashes($v['state'])."',
+                                    '".addslashes($v['zip'])."',
+                                    '".addslashes($v['country'])."',
+                                    '".addslashes($v['phone'])."',
+                                    '".addslashes($v['fax'])."',
+                                    '".addslashes($v['email'])."',
+                                                                       ".($v['email_ok'] == 'CHECKED' ? 'true' : 'false').",
+                                    '".addslashes($v['contact_fname'])."',
+                                    '".addslashes($v['contact_lname'])."',
+                                    '".addslashes($v['contact_addr1'])."',
+                                    '".addslashes($v['contact_addr2'])."',
+                                    '".addslashes($v['contact_city'])."',
+                                    '".addslashes($v['contact_state'])."',
+                                    '".addslashes($v['contact_zip'])."',
+                                    '".addslashes($v['contact_country'])."',
+                                    '".addslashes($v['contact_phone'])."',
+                                    '".addslashes($v['contact_fax'])."',
+                                    '".($is_member ? 't' : 'f')."',
+                                    '".($is_member ? $user_data['member_id'] : '')."',
+                                    '".date('m/d/Y')."',
+                                    '".addslashes($v['payment_type_text'])."',
+                                    '".addslashes($v['pay_code'])."',
+                                    $status,
+                                    $grand_total,
+                                    '".addslashes($v['ccname'])."',
+                                    '".addslashes($cctype)."',
+                                    '".addslashes($v['ccnum'])."',
+                                    '".addslashes($cc_expire)."',
+                                    '".addslashes($v['cccode'])."',
+                                    '".addslashes($cc_conf)."',
+                                    '',
+                                    '".addslashes($html_store)."',
+                                    '".$_SESSION['GLM_EVENT_REG']['Cart_Serial_Number']."',
+                                    '$user_trace_info'
+                                );";
+
+            if ($config->event_registration->debug) {
+                $v['debug'] .= "Checkout Debug: Built reg_req store query<br>";
+            }
+
+            // Do some things for each cart entry (activity)
+            reset($view_tags['shoppingCart']);
+            $notify = array();
+            foreach ($view_tags['shoppingCart'] as $c_data) {
+
+                // Check event for attendees and limited registrations
+                $sql = "
+                    SELECT short_descr, duration, location,
+                                  need_attendees, attendee_count, attendee_max, attendee_limit
+                      FROM registrations.reg
+                     WHERE id = ".$c_data['event_id']."
+                ;";
+                $r_data = db_auto_get_row($sql, 0, CONN_STR, FALSE);
+
+                // Add some of that to the cart data for use in View tags for output
+                $c_data['short_descr'] = $r_data['short_descr'];
+                $c_data['duration'] = $r_data['duration'];
+                $c_data['location'] = $r_data['location'];
+
+                // If event needs attendees, then update attendee count
+                if ($r_data['need_attendees'] == 't') {
+
+                    if ($config->event_registration->debug) {
+                        $v['debug'] .= "Checkout Debug: Updating ".$config->event_registration->word->attendee." count for activity ".$c_data['event_id']."<br>";
+                    }
+
+                    // If event has an attendee limit, check to make sure there's enough available attendees
+                    if ($r_data['attendee_limit'] == 't' && $r_data['attendee_count'] + $c_data['numb_attendees'] > $r_data['attendee_max']) {
+                        $left = $r_data['attendee_max'] - $r_data['attendee_count'];
+                        $reason[]['text'] = "I'm sorry, a last-minute check indicates that there is only room left for $left ".$config->event_registration->word->attendee."(s) for ".$c_data['event_name'].".";
+                    } else {
+                        $transaction[] = "
+                            UPDATE registrations.reg SET attendee_count = attendee_count + ".($c_data['numb_attendees']-0)." WHERE id = ".$c_data['event_id']."
+                        ;";
+                    }
+                }
+
+                $hs = get_html_translation_table( HTML_ENTITIES ) + array( '{' => '&#123;', ' ' => '&#32;', '#' => '&#35;', "\n" => '&#10;' );
+
+                // add to reg_detail table - note that we can't store empty date strings, so checking for that and doing null
+                $transaction[] = "
+                    INSERT INTO registrations.reg_detail
+                        (
+                        reg_req,
+                        numb_attending,
+                        attendees,
+                        charges,
+                        charges_list,
+                        registration,
+                        reg_start,
+                        reg_end,
+                        cutoff_date,
+                        rate_class,
+                               desired_date,
+                        notes,
+                        mf_data
+                        )
+                    VALUES
+                        (
+                        currval('registrations.reg_req_id_seq'),
+                        ".($c_data['numb_attendees']-0).",
+                        '".addslashes(serialize($c_data['attendees']))."',
+                        ".$c_data['total_charges'].",
+                        '".addslashes(serialize($c_data['charges']))."',
+                        ".$c_data['event_id'].",
+                        ".($c_data['start_date']!='' ? "'".$c_data['start_date']."'" : 'null').",
+                        ".($c_data['end_date']!='' ? "'".$c_data['end_date']."'" : 'null').",
+                        ".($c_data['cutoff_date']!='' ? "'".$c_data['cutoff_date']."'" : 'null').",
+                        '".$c_data['rate_class']."',
+                        ".($c_data['desired_date']!='' ? "'".$c_data['desired_date']."'" : 'null').",
+                        '',
+                        '".addslashes(strtr( serialize($c_data['mf_data'] ), $hs ))."'
+                        )
+                ;";
+
+                if ($config->event_registration->debug) {
+                    $v['debug'] .= "Checkout Debug: Added activity to reg_detail table<br>";
+                }
+
+                // Get event contacts and build E-Mail notification
+                $notify_data = db_auto_get_row("SELECT notify_email, instructor FROM reg WHERE id = ".$c_data['event_id'].";", 0, CONN_STR, FALSE, 50, 0);
+                $notify_addresses = unserialize($notify_data['notify_email']);
+               $notify_string = '';
+                $sep = '';
+                if (is_array($notify_addresses) && count($notify_addresses) > 0) {
+                    foreach ($notify_addresses AS $a) {
+                        $notify_string .= $sep.$a[0];
+                        $sep = ',';
+                    }
+
+                                       // Get and parse the notification text from the misc table
+                                       $v['recipient'] = $notify_data['instructor'];
+                                       $v['notify_intro'] = parse_string_view( urldecode($misc['notify_text']), $view_tags );
+
+                                       // Make desired date more obvious to international contacts
+                                       if ($c_data['ask_date'] == 'YES') {
+                                               $c_data['desired_date_int'] = date('F j, Y', strtotime($c_data['desired_date']));
+
+                                       // Otherwise do the same with the Start and End Dates
+                                       } else {
+                                               $c_data['start_date_int'] = date('F j, Y', strtotime($c_data['start_date']));
+                                               $c_data['end_date_int'] = date('F j, Y', strtotime($c_data['end_date']));
+                                       }
+
+                    // Assemble notification E-Mail
+                    $view_tags['notify'][0] = $c_data;
+                    $notify_html = parse_view_localcheck($config->event_registration->custom_view_files, "notify_event_contacts.html", $view_tags);
+
+                    // Do subject line also
+                    $notify_subject = parse_string_view( urldecode($misc['notify_subject']), $view_tags );
+
+                    $notify[] = array(
+                       'subject' => $notify_subject,
+                        'addresses' => $notify_string,
+                        'message' => $notify_html
+                    );
+                }
+
+            } // For each cart entry
+
+            // If there's no logged in user
+            if ($v['haveUser'] = 'NO') {
+
+                // Check if there's not an existing user with this E-Mail address
+                if (!($existing_registrants = reg_db_auto_get_data("SELECT id FROM registrations.registrant WHERE email = '".trim($v['email'])."';", CONN_STR, FALSE))
+                    || !is_array($existing_registrants)
+                    || count($existing_registrants) == 0
+                ) {
+
+                    if ($config->event_registration->debug) {
+                        $v['debug'] .= "Checkout Debug: No existing user with this E-Mail. Creaating account.<br>";
+                    }
+
+                    // Aparently no registered user for this E-Mail address, so create one
+                    $transaction[] = "
+                        INSERT INTO registrations.registrant
+                                    (
+                                        user_trace_info,
+                                        fname,
+                                        lname,
+                                        addr1,
+                                        addr2,
+                                        city,
+                                        state,
+                                        zip,
+                                        country,
+                                        phone,
+                                        email,
+                                        email_ok,
+                                        password,
+                                        is_member,
+                                        member_id,
+                                        winter_addr,
+                                        winter_phone
+                                    )
+                                VALUES
+                                    (
+                                        '$user_trace_info',
+                                        '".addslashes($v['fname'])."',
+                                        '".addslashes($v['lname'])."',
+                                        '".addslashes($v['addr1'])."',
+                                        '".addslashes($v['addr2'])."',
+                                        '".addslashes($v['city'])."',
+                                        '".addslashes($v['state'])."',
+                                        '".addslashes($v['zip'])."',
+                                        '".addslashes($v['country'])."',
+                                        '".addslashes($v['phone'])."',
+                                        '".addslashes($v['email'])."',
+                                        ".($v['email_ok'] == 'CHECKED' ? 'true' : 'false').",
+                                        '".md5($v['login_password'])."',
+                                        'f',
+                                        '',
+                                        '',
+                                        ''
+                                    )
+                    ;";
+
+                // Otherwise, there's a matching E-Mail address for this user (not logged in)
+                } else {
+
+                    // Save the registrant we found. - Use last if multiple are found.
+                    $existing_registrant = end($existing_registrants);
+
+                }
+
+            }
+
+
+            // Enter into Contact table
+            if ($config->event_registration->save_contacts) {
+
+                // if there's no contact with this E-Mail address, create new contact
+                if (!($ccheck = reg_db_auto_get_data("SELECT id FROM contacts.contact WHERE email = '".trim($v['email'])."';", CONN_STR, FALSE))
+                    || !is_array($ccheck)
+                    || count($ccheck) == 0
+                ) {
+
+                    if ($config->event_registration->debug) {
+                        $v['debug'] .= "Checkout Debug: Billing contact is not in contact table - adding<br>";
+                    }
+
+                    $transaction[] = "
+                        INSERT INTO contacts.contact
+                            (
+                            fname,                lname,              address,            address2,
+                            city,                state,                zip,                country,
+                            phone,                fax,                email,                mail_ok,
+                               create_date,
+                            interest
+                            )
+                        VALUES
+                            (
+                            '".addslashes($v['contact_fname'])."',
+                            '".addslashes($v['contact_lname'])."',
+                            '".addslashes($v['contact_addr1'])."',
+                            '".addslashes($v['contact_addr2'])."',
+                            '".addslashes($v['contact_city'])."',
+                            '".addslashes($v['contact_state'])."',
+                            '".addslashes($v['contact_zip'])."',
+                            '".addslashes($v['contact_country'])."',
+                            '".addslashes($v['contact_phone'])."',
+                            '".addslashes($v['contact_fax'])."',
+                            '".addslashes($v['email'])."',
+                            ".($v['email_ok'] == 'CHECKED' ? 'true' : 'false').",
+                            '".date("m/d/Y")."',
+                            ''
+                            );
+                    ";
+
+                    // Check if site uses GLM Communicator
+                    if ($config->contactdb->streamsend->application) {
+
+                        if ($config->event_registration->debug) {
+                            $v['debug'] .= "Checkout Debug: GLM Communicator enabled for this customer - Adding contact<br>";
+                        }
+
+                        $ssData = array(
+                            'email'        => $v['email'],
+                            'fname'        => $v['contact_fname'],
+                            'lname'        => $v['contact_lname'],
+                            'address'      => $v['contact_addr1'],
+                            'address2'     => $v['contact_addr2'],
+                            'city'         => $v['contact_city'],
+                            'state'        => $v['contact_state'],
+                            'zip'          => $v['contact_zip'],
+                            'phone'        => $v['contact_phone'],
+                            'interest'     => '',
+                            'contact_type' => ''
+                        );
+
+                        $streamSend = new Toolkit_Contacts_StreamSend();
+                        $streamSend->addContact($ssData);
+
+                    }
+
+                } else {
+
+                        if ($config->event_registration->debug) {
+                            $v['debug'] .= "Checkout Debug: Billing contact is already in contact table<br>";
+                        }
+
+                }
+
+            }
+        }// problems so far
+
+        // If there's no problems so far, try to store all this stuff
+        // *** If Address2 field is exactly "TEST MODE", nothing will be stored. ***
+        if (count($reason) == 0 && $v['addr2'] != 'TEST MODE') {
+
+            // An SQL entry to create a transaction failure for testing.
+            // $transaction[] = 'SELECT * FROM a_nonexistant_table;';
+
+            // Create database connection
+            $db = Toolkit_Database::getInstance();
+
+            try {
+
+                $db->beginTransaction();
+                foreach ($transaction as $sql) {
+                    @$db->exec($sql);
+                }
+                $db->commit();
+
+            } catch (Exception $e) {
+
+                $err = $e->getMessage();
+                $db->rollback();
+
+                $reason[]['text'] = 'There was a problem storing your request. Please try again later or call for assistance.<br>';
+
+                if ($config->event_registration->debug) {
+                    $v['debug'] .= "Transaction execution problem.<br>$err<br>Query:<br><pre>$sql</pre>";
+                }
+
+                debug_mail(
+                    'cscott@gaslightmedia.com',
+                    'Event Registration Error',
+                    "Errors displayed to User:\n".print_r($reason,1)."\n\nTransaction Error:\n$err\n\nQueries:\n".print_r($transaction,1)."\n\n",
+                    "From: ".$config->event_registration->organization." <".$config->event_registration->organization_internal_email.">\n"
+                );
+
+                // If the user's credit card has been charged, notify customer of this problem
+                if ($_SESSION['GLM_EVENT_REG']['card_processed'] == true) {
+
+                    debug_mail(
+                        $config->event_registration->organization_internal_email,
+                        $v['word_Event'].' Registration Error',
+                        $v["customer_name"].":\n\n"
+                            ."The Gaslight Media ".$v['word_Event']." registration system detected that a user had a problem\n"
+                            ."while trying to check out. It is also likely that their credit card was charged.\n\n"
+                            ."This is the information we have on the user attempting to check out.\n\n"
+                            ."First Name:       ".$v['fname']."\n"
+                            ."Last Name:        ".$v['lname']."\n"
+                            ."Address:          ".$v['addr1']."\n"
+                            ."                  ".$v['addr2']."\n"
+                            ."City:             ".$v['city']."\n"
+                            ."State/Province:   ".$v['state']."\n"
+                            ."ZIP/Postal Code:  ".$v['zip']."\n"
+                            ."Country:          ".$v['country']."\n"
+                            ."Phone:            ".$v['phone']."\n"
+                            ."FAX:              ".$v['fax']."\n"
+                            ."Total Charge:     ".money($grand_total)."\n"
+                            ."Name on Card:     ".$v['ccname']."\n"
+                            ."Credit Card:      ".$v['ccnum_trunc']."\n\n"
+                            ."Contact First Name:       ".$v['contact_fname']."\n"
+                            ."Contact Last Name:        ".$v['contact_lname']."\n"
+                            ."Contact Address:          ".$v['contact_addr1']."\n"
+                            ."                                         ".$v['contact_addr2']."\n"
+                            ."Contact City:             ".$v['contact_city']."\n"
+                            ."Contact State/Province:   ".$v['contact_state']."\n"
+                            ."Contact ZIP/Postal Code:  ".$v['contact_zip']."\n"
+                            ."Contact Country:          ".$v['contact_country']."\n"
+                            ."Contact Phone:            ".$v['contact_phone']."\n"
+                            ."Contact FAX:              ".$v['contact_fax']."\n"
+                            ."E-Mail:           ".$v['email']."\n\n"
+                            ."Please check receint registrations to determine if this user was able to properly submit\n"
+                            ."the request. You should also check your credit card transactions to determine if there was\n"
+                            ."in fact a charge that is not associated with a successful submission.\n\n"
+                            ."Gaslight Media has also received a notice regarding this problem. Please contact us at\n"
+                            ."231-487-0692 if you have additional questions.\n\nGaslight Media",
+                        "From: Gaslight Media ".$v['word_Event']." Registration System <info@gaslightmedia.com>\n"
+                    );
+                }
+
+                $reason[]['text'] = "The system was unable to store your request but it appears your credit card has already been charged.<br>
+                Please contact ".$v["customer_name"]
+                                .( $cust_phone != '' ? " at ".$v["customer_phone"] : '' )
+                                ." regarding this problem.";
+
+            }
+
+        }
+
+        if ($config->event_registration->debug) {
+            echo "<P>Checkout Debug Results<P><pre>".$v['debug']."</pre>";
+            echo "<pre>".print_r($transaction,1)."</pre>";
+        }
+
+
+        // If there's any final problems with checkout, return to Step5
+        if (count($reason) > 0) {
+
+            if ($config->event_registration->debug) {
+                $v['debug'] .= "Checkout Debug: Sending user back to checkout page (Step5)<br>";
+                $Action = "Step5";
+            } else {
+                $Action = "Step5";
+            }
+
+        // Otherwise, if we're not in "TEST MODE" - Find and set the current registrant then kill the session.
+        } elseif ($v['addr2'] != 'TEST MODE') {
+
+            // Find current registrant ID
+            if ($user_data != false) {
+                // Logged in user
+                $registrant_id = $user_data['id'];
+            } elseif ($existing_registrant != false) {
+                // Last registrant using request E-Mail address
+                $registrant_id = $existing_registrant['id'];
+            } else {
+                // Newly created registrant record
+                // Note, need to use $db so same SQL session
+                $sql = "SELECT currval('registrations.registrant_id_seq');";
+                $stmt = $db->prepare($sql);
+                $stmt->execute();
+                $new_registrant = $stmt->fetch(PDO::FETCH_ASSOC);
+                $registrant_id = $new_registrant['currval'];
+            }
+
+            // Save the registrant ID in the current request
+            $sql = "SELECT currval('registrations.reg_req_id_seq');";
+            $stmt = $db->prepare($sql);
+            $stmt->execute();
+            $this_request = $stmt->fetch(PDO::FETCH_ASSOC);
+            reg_db_auto_exec( "UPDATE registrations.reg_req SET registrant = $registrant_id WHERE id = ".$this_request['currval'].";", 0, CONN_STR, FALSE );
+
+            // Provide request ID to view
+            $v['reg_req_id'] = $this_request['currval'];
+
+            // Kill session - If addr2 is exactly 'DO NOT CLEAR' then leave the session alone so that we can submit again.
+            if ($v['addr2'] != 'DO NOT CLEAR') {
+                $_SESSION['GLM_EVENT_REG'] = false;
+            }
+
+        }
+
+    } // If there's no cart
+}
+
+// If it's a password reset attempt
+if ($Action == 'ResetPassword') {
+
+    $Option = '';
+    $v['reset_complete'] == 'NO';
+    $v['ResetID'] = ($_REQUEST['ResetID'] - 0);
+
+    // Is this a reset action from an E-Mail message?
+    if ($v['ResetID'] > 0) {
+
+        // Get user information
+        $query = "
+            SELECT *
+              FROM registrations.registrant
+             WHERE id = '".$v['ResetID']."'
+        ;";
+
+        $user_data = db_auto_get_row($query, 0, CONN_STR, FALSE, 50, 0);
+
+        // If we didn't find the user data
+        if ($user_data == false || count($user_data) == 0 ) {
+            $reason[]['text'] = 'We are not able to find your user data at this time. Please call '.$config->event_registration->organization_phone.' for assistance.';
+
+        // Otherwise we have user data
+        } else {
+
+            // If we have the reset code submitted then try to process the request
+            $reset_code = filter_request('ResetCode');
+            $passwd = trim(filter_request('passwd'));
+            $passwd2 = trim(filter_request('passwd2'));
+
+            if ($reset_code != '' ) {
+
+               // Check if reset code doesn't match
+                if ($reset_code != $user_data['pw_reset_code']) {
+                    $reason[]['text'] = 'You did not enter the correct Password Reset Code provided earlier.';
+                }
+
+                // Check if Password is too short
+                if (strlen($passwd) < 6) {
+                    $reason[]['text'] = 'Your new password must be at least 6 characters long.';
+                }
+
+                // Check if the passwords don't match
+                if ($passwd != $passwd2) {
+                    $reason[]['text'] = 'You did not enter the same password into both password fields.';
+                }
+
+                // If there's any problem
+                if (count($reason) > 0) {
+                    $Option = 'Display Form';
+
+                // Otherwise we're good, so reset the password
+                } else {
+
+                    $pw_md5 = md5($passwd);
+
+                    if ($user_data['is_member'] == 't') {
+                        $query = "
+                            UPDATE members.member
+                               SET member_passwd = '$pw_md5'
+                             WHERE member_id = ".$user_data['member_id']."
+                        ;";
+                        reg_db_auto_exec( $query, 0, CONN_STR, FALSE );
+
+                        $query = "
+                            UPDATE registrations.registrant
+                            SET pw_reset_code = ''
+                            WHERE id = ".$user_data['id']."
+                        ;";
+                        reg_db_auto_exec( $query, 0, CONN_STR, FALSE );
+
+                    } else {
+                        $query = "
+                            UPDATE registrations.registrant
+                               SET password = '$pw_md5',
+                                   pw_reset_code = ''
+                             WHERE id = ".$user_data['id']."
+                        ;";
+                        reg_db_auto_exec( $query, 0, CONN_STR, FALSE );
+
+                    }
+
+                    $reason[]['text'] = 'Your password has been changed to the new password you just supplied.';
+                    $Action = 'Step0';
+                }
+
+            // Otherwise, display the new password form
+            } else {
+                $Option = 'Display Form';
+            }
+
+        }
+
+    // Otherwise it's an initial request
+    } else {
+
+        $user_data = '';
+        $reset_status = '';
+        $user_email_addr = '';
+
+        switch ($_REQUEST['Type']) {
+
+            case 'Member':
+
+                $member_login = filter_request('memberID');
+
+                // Look up member acccount
+                $query = "
+                    SELECT *
+                      FROM members.member
+                     WHERE member_login = '$member_login'
+                ;";
+                $members = reg_db_auto_get_data($query, CONN_STR, FALSE, 50, 0);
+
+                // If we only got one member record
+                if (count($members) == 1) {
+
+                    $member_data = $members['0|1'];
+
+                    // Check if there's no processing E-mail for this member
+                    if (trim($member_data['process_email']) == '') {
+
+                        $reset_status = 'Call';
+
+                    } else {
+
+                        // Check for registrant entry for this member
+                        $query = "
+                            SELECT *
+                              FROM registrations.registrant
+                             WHERE member_id = '".$member_data['member_id']."'
+                        ;";
+                        $user_data = db_auto_get_row($query, 0, CONN_STR, FALSE, 50, 0);
+
+                        // If we didn't find a matching registrant entry, create that now.
+                        if ($user_data == false || count($user_data) == 0 ) {
+
+                            $query = "
+                                INSERT INTO registrations.registrant
+                                    (
+                                    user_trace_info,
+                                    fname,
+                                    lname,
+                                    addr1,
+                                    addr2,
+                                    city,
+                                    state,
+                                    zip,
+                                    country,
+                                    phone,
+                                    email,
+                                    email_ok,
+                                    password,
+                                    is_member,
+                                    member_id,
+                                    winter_addr,
+                                    winter_phone
+                                    )
+                                VALUES
+                                    (
+                                    '".$user_trace_info."',
+                                    '".addslashes($member_data['fname'])."',
+                                    '".addslashes($member_data['lname'])."',
+                                    '".addslashes($member_data['street'])."',
+                                    '',
+                                    '".addslashes($member_data['city'])."',
+                                    '".$member_data['state']."',
+                                    '".$member_data['zip']."',
+                                    '".($member_data['country']==''?'US':$member_data['country'])."',
+                                    '".$member_data['phone']."',
+                                    '".$member_data['process_email']."',
+                                    't',
+                                    '',
+                                    't',
+                                    '".$member_data['member_id']."',
+                                    '".addslashes($member_data['secondary_address'].", ".$member_data['secondary_city'].", ".$member_data['secondary_state'].", ".$member_data['secondary_zip'])."',
+                                    ".$member_data['phone2']."
+                                    )
+                                RETURNING *
+                            ;";
+                            $user_data = db_auto_get_row($query, 0, CONN_STR, FALSE, 50, 0);
+
+                        }
+
+                        // If we still don't have user data then there's a problem and they have to call
+                        if (count($user_data) == 0) {
+                            $reset_status = 'Call';
+
+                        // Otherwise, we have the user data so we can enter the reset code
+                        } else {
+
+                            // Generate a reset password
+                            require GLM_APP_BASE.'Common/Registrations_V3/classes/EasyPassword.php';
+                            $ep = new EasyPassword();
+                            $new_passwd = $ep->generateEasyPassword();
+                            $v['reset_password'] = $new_passwd;
+
+                            $query = "
+                                UPDATE registrations.registrant
+                                   SET pw_reset_code = '$new_passwd'
+                                 WHERE id = ".$user_data['id']."
+                            ;";
+                            reg_db_auto_exec( $query, 0, CONN_STR, FALSE );
+
+                            // Set E-Mail address for reset message
+                            $user_email_addr = $member_data['process_email'];
+
+                        }
+
+                    } // have processing E-Mail
+
+                // If we got more than one member, we can't sort out which so they have to call
+                } elseif (count($members) > 1) {
+                    $reset_status = 'Call';
+                // Otherwise, we didn't find any matching accounts
+                } else {
+                    $reset_status = 'Not Found';
+                }
+
+                break;
+
+            case 'NonMember':
+
+                // Look up non-member E-Mail address
+                $email = filter_request('email');
+                $user_data = false;
+                if (trim($email) != '') {
+                    $query = "
+                        SELECT *
+                          FROM registrations.registrant
+                         WHERE email = '$email'
+                    ;";
+                    $user_data = db_auto_get_row($query, 0, CONN_STR, FALSE, 50, 0);
+                }
+
+                // If we don't have user data then there wasn't a match
+                if (!$user_data) {
+                    $reset_status = 'Not Found';
+
+                    // Otherwise, we have the user data so we can enter the reset code
+                } else {
+
+                    // Generate a reset password
+                    require GLM_APP_BASE.'Common/Registrations_V3/classes/EasyPassword.php';
+                    $ep = new EasyPassword();
+                    $new_passwd = $ep->generateEasyPassword();
+                    $v['reset_password'] = $new_passwd;
+
+                    $query = "
+                        UPDATE registrations.registrant
+                           SET pw_reset_code = '$new_passwd'
+                         WHERE id = ".$user_data['id']."
+                    ;";
+                    reg_db_auto_exec( $query, 0, CONN_STR, FALSE );
+
+                    // Set E-Mail address for reset message
+                    $user_email_addr = $user_data['email'];
+                }
+
+                break;
+
+            // Can't be anything else unless there's tampering, so just quit
+            default:
+                exit;
+                break;
+        }
+
+        // Check if we have an E-Mail address
+        if ($reset_status == '' && $user_email_addr == '') {
+            $reset_status = 'No Email';
+        }
+
+        // If there's no problem yet, try to send user an e-mail
+        if ($reset_status == '') {
+
+            $mail_result = debug_mail(
+                $user_email_addr,
+                $config->event_registration->organization." Password Reset",
+                "\nPlease click on the link below to reset the password for your ".$config->event_registration->organization." account.\n\n"
+                ."You will need to enter the reset code provided when you requested us to reset your account password.\n\n"
+                .BASE_SECURE_URL.'index.php?catid='.$config->event_registration->event_page.'&Action=ResetPassword&ResetID='.$user_data['id']
+                ."\n\nPlease call ".$config->event_registration->organization." at ".$config->event_registration->organization_phone." if you need further assistance.\n\n"
+                ."Sincerely,\n".$config->event_registration->organization."\n\n",
+                "From: ".$config->event_registration->organization." <".$config->event_registration->organization_from_email.">\n"
+            );
+            if (!$mail_result) {
+                $reset_status = 'Mail Failure';
+            }
+
+        }
+
+        // If there's some kind of problem
+        if ($reset_status != '') {
+
+            switch ($reset_status) {
+
+                case 'Call':
+                    $reason[]['text'] = 'We are unable to reset your password at this time. Please call '.$config->event_registration->organization_phone.' for assistance.';
+                    break;
+
+                case 'Not Found':
+                    $reason[]['text'] = 'We were unable to find an account with the E-Mail address you entered. Please try again.';
+                    break;
+
+                case 'No Email':
+                    $reason[]['text'] = 'We do not have an E-Mail address for you at this time. Please call '.$config->event_registration->organization_phone.' for assistance.';
+                    break;
+
+                case 'Mail Failure':
+                    $reason[]['text'] = 'We are not able to send you an E-Mail at this time. Please call '.$config->event_registration->organization_phone.' for assistance.';
+                    break;
+
+                default:
+                    break;
+            }
+
+            $Action = 'ForgotPassword';
+
+        }
+
+    } // Initial request
+
+} // ResetPassword
+
+// Check if we should use Step0
+if ($Action == 'Step0' && ($is_member || !($config->event_registration->have_members || $config->event_registration->registered_users))) {
+    if ($config->event_registration->main_categories) {
+        // Use Step1 if we have categories
+        $Action = 'Step1';
+    } else {
+        // Otherwise just go to step 2
+        $Action = 'Step2';
+    }
+}
+
+// Check if we should use Step1
+if ($Action == 'Step1' && !$config->event_registration->main_categories) {
+    $Action = 'Step2';
+}
+
+// Check Step0
+if ($Action == 'Step0') {
+
+    $v['showMemberLogin'] = 'YES';
+    $v['alreadyRegistered'] = 'NO';
+    $v['member_id'] = '';
+    $v['member_id_md5'] = '';
+
+}
+
+/*****************************************************
+ *
+ * Registration step navigation
+ *
+ ******************************************************/
+
+$nav = "&nbsp;";
+if (isset($Action) && $Action > "Step2" && $Action < "Step6") {
+
+    switch ($Action) {
+        case "Step5":
+            $Step3 = TRUE;
+        case "Step3":
+            $Step2 = TRUE;
+    }
+
+    if ($Step2)
+        $nav .= '<A HREF="'.THIS_SCRIPT.'?Action=Step2'.$link_data.'">Select</A> > ';
+    else
+        $nav .= 'Select > ';
+    if ($Step3)
+        $nav .= '<A HREF="'.THIS_SCRIPT.'?Action=Step3'.$link_data.'">Registration Info</A> > ';
+    else
+        $nav .= 'Registration Info > ';
+    if ($Step5)
+        $nav .= '<A HREF="'.THIS_SCRIPT.'?Action=Step5'.$link_data.'">Payment</A> > ';
+    else
+        $nav .= 'Payment  ';
+}
+
+/*****************************************************
+ *
+ * More specific data we need for things that have been selected already
+ *
+ * Note that for each step further we get into the process, we need
+ * to process a bit more data. This code below ensures that we have
+ * processed everything we need for the current step.
+ *
+ ******************************************************/
+
+if (count($charges) > 0)
+    $view_tags['charges'] = $charges;
+
+$date_array = getdate();
+
+if (empty($Action))
+    $Action = "Step1";
+
+$next_step = substr($Action, 4) + 1;
+
+//$v["this_script"]        = BASE_SECURE_URL.SI_CALLED_FROM_DIR.'/'.$si_calling_script_name;
+$v["this_script"] = THIS_SCRIPT;
+$v["this_year"] = $date_array["year"];
+$v["this_month"] = $date_array["month"];
+$v["this_short_month"] = substr($date_array["month"], 0, 3);
+$v["this_weekday"] = $date_array["weekday"];
+$v["this_day_of_month"] = $date_array["mday"];
+$v["navigation"] = $nav;
+$v["form_data"] = $form_data;
+$v["link_data"] = $link_data;
+$view_tags["reason"] = $reason;
+$v['have_reason'] = (count($reason) > 0 ? 'YES' : 'NO');
+$v["problem"] = "";
+$v["price_debug"] = "";
+$v["next_step"] = "Step$next_step";
+$v['nav'] = $nav;
+$v['attendees'] = $attendees;
+$v['numb_attendees'] = $numb_attendees;
+$v['total_charges'] = money($total_charges);
+$v['rate_classes'] = $rate_classes;
+$v['rate_name'] = $rate_class_name;
+$v['extending_step0'] = 'NO';
+
+// ************* SPECIAL PROCESSING FOR SPECIFIC REGISTRATIONS *******************
+
+if ($regcode == 'NTA')
+    $v['special_bulletin'] = '<center><a href="form.pdf">Click here to print off the Tour Operator Fam Tour Registration Form.</a><BR>
+                                    (Print only if you are NOT going to submit on line)</center>';
+else
+    $v['special_bulletin'] = '';
+
+
+/*****************************************************
+ *
+ * Main Processing
+ *
+ * Where Action is:
+ *    ForgotPassword = Request Password Page
+ *    Step0 = Login Page
+ *    Step1 = Intro Page (Optional)
+ *    Step2 = Event Selection
+ *    Step3 = Registration Information
+ *    Step4 = Cart
+ *    Step5 = Checkout
+ *    Step6 = Confirmation
+ *
+ ******************************************************/
+
+switch ($Action) {
+
+    // Default entry is either Step1 (intro) or if that is not selected or available Step2
+
+
+    /*****************************************************
+     *
+     *    Process password reset request
+     *
+     *****************************************************/
+    case 'ResetPassword';
+
+        if ($Option == 'Display Form') {
+            echo parse_view_localcheck($config->event_registration->custom_view_files, "new_password.html", $view_tags);
+        } else {
+            echo parse_view_localcheck($config->event_registration->custom_view_files, "password_reset.html", $view_tags);
+        }
+
+        break;
+
+    /*****************************************************
+     *
+     *    ForgotPassword
+     *
+     *****************************************************/
+    case 'ForgotPassword';
+
+        switch ($_REQUEST['Type']) {
+
+            case 'Member':
+
+                $v['ForgotPasswordType'] = 'Member';
+
+                break;
+
+            case 'NonMember':
+            default:
+
+                $v['ForgotPasswordType'] = 'NonMember';
+                break;
+        }
+
+        echo parse_view_localcheck($config->event_registration->custom_view_files, "forgot_password.html", $view_tags);
+
+        break;
+
+    /*****************************************************
+     *
+     *    Step0 = Login Page
+     *
+     ******************************************************/
+    case 'Step0';
+    default:
+
+       $v['categories_on_intro_page'] = ($config->event_registration->categories_on_intro_page ? 'YES' : 'NO');
+
+        // If not logged in, use the intro page
+        if ($_SESSION['GLM_EVENT_REG']['User'] == false) {
+
+            echo parse_view_localcheck($config->event_registration->custom_view_files, "registrations_step0.html", $view_tags);
+            if (!$config->event_registration->categories_on_intro_page) {
+                break;
+            }
+        }
+        $v['extending_step0'] = 'YES';
+
+        // Will get here and drop through to Step1 if the person already signed in
+
+
+    /*****************************************************
+     *
+     *    Step1 = Intro Page (Optional)
+     *
+     ******************************************************/
+    case "Step1":
+
+       $v['categories_on_intro_page'] = ($config->event_registration->categories_on_intro_page ? 'YES' : 'NO');
+        $view_tags["ToDo"] = array();
+        $v['doingCategorySelection'] = 'NO';
+        $v['doingSubCategorySelection'] = 'NO';
+        $v['displayingEventsInCategories'] = 'NO';
+        $events_array = false;
+        $cat_where = '';
+        $v['search_request'] = '';
+
+        // Check if we should be looking for attributes
+        $attr_where = '';
+        if ($config->event_registration->attributes) {
+               $attr = ($_REQUEST['attribute']-0);
+               if ($attr > 0 && !(($_REQUEST['todo']-0) > 0)) {
+                       $attr_where = "AND R.id IN (SELECT reg FROM registrations.reg_attr WHERE attr = $attr)";
+                       $v['search_type'] = $v['word_attribute'];
+                       $v['search_request'] = $attr_list[$attr]['name'];
+               }
+        }
+
+        // Check if we're doing restricted pages and if so if this is not a restricted page
+        // (don't show restricted page categories on a page that's not restricted)
+        $restricted_where = '';
+        if ($config->event_registration->restricted_area_catid > 0 && $v['category_id'] != $config->event_registration->restricted_area_catid) {
+               $restricted_where = "AND T.restricted = false";
+        }
+       // If this is a restricted area and we're only supposed to show restricted events rather than all included restricted events
+        if ($config->event_registration->restricted_area_catid > 0 && $v['category_id'] == $config->event_registration->restricted_area_catid
+           && $config->event_registration->restricted_area_restricted_events_only ) {
+               $restricted_where = "AND t.restricted = true";
+       }
+
+        // If no main category is specified, then we're listing main categories
+        $v['have_picklists'] = 'NO';
+        if (!isset($_REQUEST['todo']) || ($_REQUEST['todo'] - 0) == 0 ) {
+
+               // If selecting by picklists, then collect all category and optionally sub-category data for the lists
+               $view_tags['picklists'] = array();
+               if ($config->event_registration->select_by_picklists) {
+
+                       // Check if we're showing empty sub-cateogies
+                       $show_query = '';
+                       if (!$config->event_registration->show_empty_sub_categories) {
+                               $show_query = "
+                                       AND C.id IN
+                                               (
+                                               SELECT DISTINCT(R.category)
+                                               FROM registrations.reg R
+                                               WHERE R.active
+                                                       $attr_where
+                                               AND (NOT R.date_specific OR (R.end_date >= 'today'))
+                                               )
+                                       ";
+                       }
+
+                       //If doing sub-categories
+                       if ($config->event_registration->sub_categories) {
+                               $query = "
+                               SELECT T.id AS todo_id, T.name AS todo_name,
+                                          C.id AS cat_id, C.name AS cat_name
+                                 FROM todo T, category C
+                                WHERE T.id = C.todo
+                                               $show_query
+                                               $restricted_where
+                                ORDER BY T.sort, C.sort;
+                       ";
+
+                       // Otherwise not-doing sub-categories
+               } else {
+
+                               // Check if we're showing empty cateogies
+                               $show_query = '';
+                               if (!$config->event_registration->show_empty_categories) {
+                                       $show_query = "
+                                       AND T.id IN
+                               (
+                           SELECT DISTINCT(R.category)
+                             FROM registrations.reg R
+                            WHERE R.active
+                                                               $attr_where
+                              AND (NOT R.date_specific OR (R.end_date >= 'today'))
+                               )
+                                       ";
+                               }
+
+                               $query = "
+                               SELECT T.id AS todo_id, T.name AS todo_name
+                                 FROM todo T
+                                WHERE true
+                                               $show_query
+                                               $restricted_where
+                               ORDER BY T.sort;
+                       ";
+                       }
+
+                       // If there's any results
+                       if (($cat_picks = reg_db_auto_get_data($query, CONN_STR, FALSE, 10000, 0)) && is_array($cat_picks)) {
+
+                               $v['have_picklists'] = 'YES';
+                               foreach ($cat_picks as $cp) {
+
+                                       // If we haven't added the main category (todo) yet, do that
+                                       if (!isset($view_tags['picklists'][$cp['todo_id']])) {
+                                               $view_tags['picklists'][$cp['todo_id']] = array(
+                                                       'todo_id' => $cp['todo_id'],
+                                                       'todo_name' => $cp['todo_name'],
+                                                       'subcats' => array()
+                                               );
+                                       }
+
+                                       // If we're doing sub-cateogories, then add that also
+                                       if ($config->event_registration->sub_categories) {
+                                                       $view_tags['picklists'][$cp['todo_id']]['subcats'][$cp['cat_id']] = array(
+                                                               'cat_id' => $cp['cat_id'],
+                                                               'cat_name' => $cp['cat_name']
+                                                       );
+
+                                       }
+
+                               } // each $cat_picks
+
+                       } // have results
+
+               } // select_by_picklists
+
+            // Determine if we're only displaying categories with active events
+            if (!$config->event_registration->show_empty_categories) {
+
+                // If no sub-categories are used
+                if (!$config->event_registration->sub_categories) {
+                    $cat_where = " AND
+                       (
+                            SELECT COUNT(R.id)
+                              FROM registrations.reg R
+                             WHERE R.category = T.id
+                               AND R.active
+                                               $attr_where
+                               AND (NOT R.date_specific OR (R.end_date >= 'today'))
+                        ) > 0
+                    ";
+
+                // Otherwise we're using sub-cateogories
+                } else {
+                    $cat_where = " AND
+                       (
+                            SELECT COUNT(R.id)
+                              FROM registrations.reg R, registrations.category C
+                             WHERE R.category = C.id
+                               AND C.todo = T.id
+                               AND R.active
+                                               $attr_where
+                                               $restricted_where
+                               AND (NOT R.date_specific OR (R.end_date >= 'today'))
+                        ) > 0
+                    ";
+                }
+            } // displaying only with active events
+
+            // Need to select main categories (todo)
+            $v['selection'] = 'CATEGORY';
+            $query = "SELECT T.* FROM registrations.todo T WHERE true $cat_where $restricted_where ORDER BY T.sort, T.name;";
+            $v['doingCategorySelection'] = 'YES';
+
+            // If we don't have sub-categories and we're including events in lists then get the list of events
+            if ($config->event_registration->include_events_in_category_list && !$config->event_registration->sub_categories) {
+                $e_query = "
+                    SELECT *
+                      FROM registrations.reg R
+                     WHERE R.active = 't'
+                       AND (NOT R.date_specific OR (R.end_date >= 'today'))
+                                       $attr_where
+                     ORDER BY R.sort, R.name;
+                ";
+                $events_array = reg_db_auto_get_data($e_query, CONN_STR, FALSE, 200, 0);
+            }
+
+        // Otherwise, we're listing sub-categories
+        } else {
+
+            // Need to select sub categories
+            $v['selection'] = 'SUB_CATEGORY';
+            $main_cat = ($_REQUEST['todo'] - 0);
+            $v['doingSubCategorySelection'] = 'YES';
+
+            // Get search type data for display
+            $sql = "SELECT T.name FROM todo T WHERE T.id = $main_cat $restricted_where;";
+            $cdata = db_auto_get_row($sql, 0, CONN_STR, FALSE);
+            $v['search_type'] = $v['word_category'];
+            $v['search_request'] = $cdata['name'];
+
+            // Determine if we're only displaying categories with active events
+            if (!$config->event_registration->show_empty_categories) {
+                $cat_where = "
+                    AND (
+                        SELECT COUNT(R.id)
+                          FROM registrations.reg R
+                         WHERE C.todo = $main_cat
+                           AND C.id = R.category
+                           AND R.active
+                                       $attr_where
+                           AND (NOT date_specific OR (end_date >= 'today'))
+                    ) > 0
+                ";
+            }
+            $query = "SELECT C.* FROM registrations.category C WHERE C.todo = $main_cat $cat_where ORDER BY C.sort, C.name;";
+
+            // If we're including events in lists
+            if ($config->event_registration->include_events_in_category_list) {
+                $e_query = "
+                   SELECT R.*
+                     FROM registrations.reg R
+                    WHERE R.active = 't'
+                      AND R.category in (
+                            SELECT C.id FROM registrations.category C WHERE C.todo = $main_cat
+                          )
+                      AND (NOT R.date_specific OR (R.end_date >= 'today'))
+                               $attr_where
+                    ORDER BY R.sort, R.name;
+                ";
+                $events_array = reg_db_auto_get_data($e_query, CONN_STR, FALSE, 200, 0);
+            }
+
+        }
+
+        // Get registration categories
+        if (($todo = reg_db_auto_get_data($query, CONN_STR, FALSE, 50, 0)) && is_array($todo)) {
+
+            foreach ($todo as $t) {
+
+                $have_image = 'NO';
+                if (trim($t['image'] != '')) {
+                    $have_image = 'YES';
+                }
+                $view_tags['catlist'][$t['id']] = array(
+                    'id'         => $t['id'],
+                    'name'       => $t['name'],
+                    'have_image' => $have_image,
+                    'image'      => $t['image'],
+                    'descr'      => $t['descr'],
+                    'have_events' => 'NO',
+                    'events'     => array()
+                );
+
+            }
+
+            // Get list of months with events
+            $query = "SELECT start_date, end_date FROM registrations.reg WHERE end_date >= 'now' AND active;";
+            $v['haveMonths'] = 'NO';
+            if (($dates = reg_db_auto_get_data($query, CONN_STR, FALSE, 50, 0)) && is_array($todo)) {
+
+                $v['haveMonths'] = 'YES';
+
+                // Build list of months
+                $view_tags['Months'] = array();
+                foreach ($dates as $d) {
+
+                       // For each month the event exists
+                       $s_time = strtotime(date('m/1/Y',strtotime($d['start_date'])));
+                       $e_time = strtotime(date('m/1/Y',strtotime($d['end_date'])));
+                       for ($t = $s_time; $t <= $e_time; $t = strtotime(date('m/1/Y',$t).' +1 month')) {
+                                               // Add this month to the months list
+                           $view_tags['Months'][$t] = array(
+                               'start_of_month' => strtotime(date('m/1/Y', $t)),
+                               'name_of_month'  => date('Y F', $t)
+                           );
+                       }
+
+                }
+
+            }
+        }
+
+        // Add in any events
+        if ($events_array != false && is_array($events_array) && count($events_array) > 0) {
+
+            // For each event retrieved
+            foreach ($events_array as $e) {
+
+                if (isset($view_tags['catlist'][$e['category']])) {
+                    $view_tags['catlist'][$e['category']]['have_events'] = 'YES';
+                    $view_tags['catlist'][$e['category']]['events'][$e['id']] = array(
+                        'reg_id' => $e['id'],
+                        'reg_code' => $e['event_code'],
+                        'reg_name' => $e['name'],
+                        'reg_have_image' => (trim($e['image']) != '' ? 'YES' : 'NO'),
+                        'reg_image' => $e['image'],
+                        'reg_short_descr' => strip_tags($e['short_descr']),
+                        'reg_descr' => $e['descr'],
+                        'reg_date_specific' => ($e['date_specific'] == 't' ? 'YES' : 'NO'),
+                        'reg_start_date' => $e['start_date'],
+                        'reg_end_date' => $e['end_date'],
+                        'reg_have_days' => (trim($e['dates']) != '' ? 'YES' : 'NO'),
+                        'reg_days' => $e['dates'],
+                        'reg_have_location' => (trim($e['location']) != '' ? 'YES' : 'NO'),
+                        'reg_location' => $e['location'],
+                        'reg_have_instructor' => (trim($e['instructor']) != '' ? 'YES' : 'NO'),
+                        'reg_instructor' => $e['instructor'],
+                        'reg_have_times' => (trim($e['times']) != '' ? 'YES' : 'NO'),
+                        'reg_have_duration' => (trim($e['duration']) != '' ? 'YES' : 'NO'),
+                       'reg_times' => $e['times'],
+                       'reg_duration' => $e['duration']
+                    );
+
+                    // Check for attributes
+                       $view_tags['catlist'][$e['category']]['events'][$e['id']]['reg_have_attr'] = 'NO';
+                    if ($config->event_registration->attributes) {
+                           $qs = "SELECT A.name AS attr_name FROM registrations.attribute A, registrations.reg_attr R WHERE R.reg = ".$e['id']." AND A.id = R.attr ORDER BY A.sort, A.name;";
+                           $attrs = reg_db_auto_get_data($qs, CONN_STR, FALSE);
+                           if (is_array($attrs) && count($attrs) > 0) {
+                               $view_tags['catlist'][$e['category']]['events'][$e['id']]['reg_have_attr'] = 'YES';
+                               $view_tags['catlist'][$e['category']]['events'][$e['id']]['attr'] = $attrs;
+                           }
+                    }
+
+                    $result = getRegRates($e, $is_member, $config);
+                    $view_tags['catlist'][$e['category']]['events'][$e['id']]['free'] = $result['free'];
+                    $view_tags['catlist'][$e['category']]['events'][$e['id']]['reg_have_rates'] = (count($result['regRates']) > 0 ? 'YES' : 'NO');
+                    $view_tags['catlist'][$e['category']]['events'][$e['id']]['reg_rates'] = $result['regRates'];
+                    $view_tags['catlist'][$e['category']]['events'][$e['id']]['cutoff_date'] = $result['cutoffDate'];
+                    $view_tags['catlist'][$e['category']]['events'][$e['id']]['from_rate'] = $result['fromRate'];
+
+                }
+
+            }
+        }
+
+        echo parse_view_localcheck($config->event_registration->custom_view_files, "registrations_step1.html", $view_tags);
+
+        break;
+
+    /*****************************************************
+     *
+     *    Step2 = Event Selection
+     *
+     ******************************************************/
+    case "Step2":
+
+        $view_tags["RegistrationList"] = $events = array();
+        $v['have_registrations'] = 'FALSE';
+        $v['search_request'] = '';
+        $v['select_from_listing'] = 'FALSE';
+
+        $where = '';
+        $month = filter_request('event_month', FILTER_SANITIZE_NUMBER_INT);
+        $v['searchMonth'] = 'NO';
+
+        // Check if we should show event detail
+        $v['show_event_detail'] = "NO";
+        if ($config->event_registration->show_event_detail_in_search_results) {
+            $v['show_event_detail'] = "YES";
+        }
+
+        // Check if we should be looking for attributes
+           $attr_where = '';
+        if ($config->event_registration->attributes) {
+               $attr = ($_REQUEST['attribute']-0);
+               if ($attr > 0 && !(($_REQUEST['todo']-0) > 0)) {
+                       $attr_where = "AND R.id IN (SELECT reg FROM registrations.reg_attr WHERE attr = $attr)";
+                       $v['search_type'] = $v['word_attribute'];
+                       $v['search_request'] = $attr_list[$attr]['name'];
+               }
+        }
+
+        if ($requested_event_code != '' ) {
+               $v['search_type'] = $v['word_event']." code";
+           $v['search_request'] = $requested_event_code;
+        }
+
+        $v['search_descr'] = '';
+        // Check if an event code was supplied
+        if ($code != '') {
+
+            $where .= "AND R.event_code = '$code'";
+            $v['search_type'] = $v['word_event']." code";
+            $v['search_request'] = $code;
+
+        // If not then check if a month was supplied
+        } elseif ($month != '') {
+
+            $month_string = date('m/d/Y', $month);
+            $end_of_month = date('m/d/Y', strtotime($month_string.' +1 month -1 day'));
+            $where .= " AND (NOT R.date_specific OR (R.start_date BETWEEN '$month_string' AND '$end_of_month'))";
+
+            $v['searchMonth'] = 'YES';
+            $v['month'] = date('F Y', $month);
+
+            $v['search_type'] = 'month';
+            $v['search_request'] = $v['month'];
+
+        // Otherwise, see if we are doing sub-categories
+        } elseif ($config->event_registration->sub_categories && ($selected_sub_category-0) > 0) {
+
+            $where .= " AND R.category = $selected_sub_category ";
+
+            $sql = "SELECT name FROM category WHERE id = $selected_sub_category;";
+            $cdata = db_auto_get_row($sql, 0, CONN_STR, FALSE);
+            $v['search_type'] = $v['word_subcategory'];
+            $v['search_request'] = $cdata['name'];
+
+        // And lastly if we're not doing sub-categories, then are we doing categories?
+        } elseif ($config->event_registration->main_categories && ($_REQUEST['todo']-0) > 0) {
+
+            $selected_category = ($_REQUEST['todo']-0);
+            $where .= " AND R.category = $selected_category ";
+
+            $sql = "SELECT name, image, descr FROM todo WHERE id = $selected_category;";
+            $cdata = db_auto_get_row($sql, 0, CONN_STR, FALSE);
+            $v['search_type'] = $v['word_category'];
+            $v['search_request'] = $cdata['name'];
+            $v['search_image'] = $cdata['image'];
+            $v['search_descr'] = $cdata['descr'];
+
+        }
+
+        // Check if we're not supposed to show past events that are date specific
+        if (!$config->event_registration->show_past_events) {
+            $where .= " AND (NOT R.date_specific OR R.end_date >= 'today') ";
+        }
+
+        // Use reg_data_list of multiple events selected by event_code from above is available.
+        if (is_array($reg_data_list) && count($reg_data_list) > 0) {
+            $registrations = $reg_data_list;
+        } else {
+            // Otherwise get matching events
+            $query = "SELECT * FROM registrations.reg R WHERE active = 't' $where $attr_where ORDER BY sort, name;";
+            $registrations = reg_db_auto_get_data($query, CONN_STR, FALSE, 50, 0);
+        }
+
+        // Determine if we got here from a static page - If so, we don't want to repeat a heeader
+        $v['page_title_enc'] = '';
+        if ($v['static_page'] == 'NO') {
+            $v['page_title_enc'] = urlencode($v['search_request']);
+        }
+
+        if (is_array($registrations)) {
+            $v['have_registrations'] = 'TRUE';
+
+            $i = 0;
+            foreach ($registrations as $r) {
+
+                $cutoff_date = '';
+
+                if ($r['active'] == 't') {
+                    $view_tags["RegistrationList"][$i]["image"] = (trim($r["image"]) != "" ? $r["image"] : "");
+                    $view_tags["RegistrationList"][$i]["reg_file"] = (trim($r["reg_file"]) != "" ? FILE_SERVER_URL.IS_OWNER_ID.'/_ORIGINAL_/'.$r["reg_file"] : "");
+                    $view_tags["RegistrationList"][$i]["reg_file_title"] = (trim($r["reg_file_title"]) != "" ? $r["reg_file_title"] : "");
+                    $view_tags["RegistrationList"][$i]["name"] = $r["name"];
+                    $view_tags["RegistrationList"][$i]["id"] = $r["id"];
+                    $view_tags["RegistrationList"][$i]["reg_code"] = $r["event_code"];
+                    $view_tags["RegistrationList"][$i]["reg_short_descr"] = $r["short_descr"];
+                    $view_tags["RegistrationList"][$i]["reg_descr"] = $r["descr"];
+                    $view_tags["RegistrationList"][$i]["rates_descr"] = $r["rates_descr"];
+                    $view_tags["RegistrationList"][$i]["reg_instructor"] = $r["instructor"];
+                    $view_tags["RegistrationList"][$i]["reg_days"] = $r["dates"];
+                    $view_tags["RegistrationList"][$i]["reg_times"] = $r["times"];
+                    $view_tags["RegistrationList"][$i]["reg_duration"] = $r["duration"];
+                    $view_tags["RegistrationList"][$i]["reg_location"] = $r["location"];
+
+                    // Check for attributes
+                    if ($config->event_registration->attributes) {
+                       $qs = "SELECT A.name AS attr_name FROM registrations.attribute A, registrations.reg_attr R WHERE R.reg = ".$r['id']." AND A.id = R.attr ORDER BY A.sort, A.name;";
+                       $attrs = reg_db_auto_get_data($qs, CONN_STR, FALSE);
+                       $view_tags["RegistrationList"][$i]['reg_have_attr'] = 'NO';
+                       if (is_array($attrs) && count($attrs) > 0) {
+                               $view_tags["RegistrationList"][$i]['reg_have_attr'] = 'YES';
+                               $view_tags["RegistrationList"][$i]['attr'] = $attrs;
+                       }
+                    }
+
+                    // Get rates and dates
+                    $result = getRegRates($r, $is_member, $config);
+                    $view_tags["RegistrationList"][$i]['free'] = $result['free'];
+                    $view_tags["RegistrationList"][$i]['reg_have_rates'] = (count($result['regRates']) > 0 ? 'YES' : 'NO');
+                    $view_tags["RegistrationList"][$i]['reg_rates'] = $result['regRates'];
+                    $view_tags["RegistrationList"][$i]['cutoff_date'] = $result['cutoffDate'];
+                    $view_tags["RegistrationList"][$i]['from_rate'] = $result['fromRate'];
+
+                    $view_tags["RegistrationList"][$i]["date_specific"] = ($r['date_specific'] == 't' ? 'YES' : 'NO');
+                    $view_tags["RegistrationList"][$i]["start_date"] = $r["start_date"];
+                    $view_tags["RegistrationList"][$i]["end_date"] = $r["end_date"];
+
+                    // If the event it past cutoff time - Admin users can still register
+                    if ($result['date_specific'] == 't' && strtotime($result['cutoffDate']) < time()&& !$_SESSION['GLM_EVENT_REG']['admin_user']) {
+                        $view_tags["RegistrationList"][$i]['too_late'] = 'Yes';
+                    } else {
+                        $view_tags["RegistrationList"][$i]['too_late'] = '';
+                    }
+
+                    // Determine if registration is full
+
+                    if ($r['attendee_limit'] == 't') {
+                        $view_tags["RegistrationList"][$i]['limited'] = 'YES';
+                        if ($r['attendee_count'] >= $r['attendee_max'])
+                            $view_tags["RegistrationList"][$i]['full'] = 'YES';
+                        else
+                            $view_tags["RegistrationList"][$i]['full'] = '';
+
+                        $view_tags["RegistrationList"][$i]['attendee_max'] = $r['attendee_max'];
+                        $view_tags["RegistrationList"][$i]['attendee_count'] = $r['attendee_count'];
+                        $view_tags["RegistrationList"][$i]['attendee_left'] = $r['attendee_max'] - $r['attendee_count'];
+                    } else
+                        $view_tags["RegistrationList"][$i]['limited'] = '';
+
+                    $i++;
+                }
+
+                $events[$r['id']] = $r['name'];
+            }
+            $v['RegPicklist'] = reg_build_picklist('registration', $events, '', 'standard');
+        }
+
+        // Check if we have a search request - Not sure why we wouldn't
+        $have_search_request = 'NO';
+        if ($v['search_request'] != '') {
+               $v['have_search_request'] = 'YES';
+        }
+        echo parse_view_localcheck($config->event_registration->custom_view_files, "registrations_step2.html", $view_tags);
+
+        break;
+
+    /*****************************************************
+     *
+     *    Step3 = Registration Information
+     *
+     ******************************************************/
+    case "Step3":
+
+        $v['image'] = (trim($reg_data["image"]) != "" ? $reg_data["image"] : "");
+        $v['reg_file'] = (trim($reg_data["reg_file"]) != "" ? FILE_SERVER_URL.IS_OWNER_ID.'/_ORIGINAL_/'.$reg_data["reg_file"] : "");
+        $v['reg_file_title'] = (trim($reg_data["reg_file_title"]) != "" ? $reg_data["reg_file_title"] : "");
+        $v['descr'] = $reg_data['descr'];
+        $v['rates_descr'] = $reg_data['rates_descr'];
+        $v["date_specific"] = ($reg_data['date_specific'] == 't' ? 'YES' : 'NO');
+        $v['start_date'] = $reg_data['start_date'];
+        $v['end_date'] = $reg_data['end_date'];
+        $v['rate'] = money($rate);
+
+        $v["reg_instructor"] = $reg_data["instructor"];
+        $v["reg_days"] = $reg_data["dates"];
+        $v["reg_times"] = $reg_data["times"];
+        $v["reg_duration"] = $reg_data["duration"];
+        $v["reg_dates"] = $reg_data["dates"];
+        $v["reg_location"] = $reg_data["location"];
+        $v["reg_terms"] = $reg_data['terms'];
+        $v['have_reg_terms'] = (trim($reg_data['terms']) != '' ? 'YES' : 'NO');
+
+        if (isset($_REQUEST['static_page']) && $_REQUEST['static_page']=='YES') {
+            $v['static_page'] = 'YES';
+        } else {
+            $v['static_page'] = 'NO';
+            $v['page_title'] = $_REQUEST['page_title'];
+        }
+
+        // Check if it's too late to register - Comments in if() statement indicate what is permitted
+        $v['too_late'] = 'YES';                // Assume it's too late
+               if ($_SESSION['GLM_EVENT_REG']['admin_user'] ||                                                                                 // Admin user
+                       ($date_specific && $cutoff_date != '' && time() < strtotime($cutoff_date)) ||           // Date specific, have cutoff date, and not past cutoff date
+                       (!$date_specific) ) {                                                                                                                           // Not date specific and there's no cutoff date
+
+                       $v['too_late'] = 'NO';
+
+            // Build Rate Class Selection
+            $view_tags['rate_class_list'] = array();
+            $v['single_rate_class'] = 'NO';
+            if ($rate_classes == 'TRUE') {
+                for ($i = 0; $i < count($rate_data); $i++) {
+                    $ra = array(
+                        'rate_class'          => $i,
+                        'rate_class_name'     => $rate_data[$i][0],
+                        'rate_class_base'     => ($rate_data[$i][1] > 0 ? money($rate_data[$i][1]) : ''),
+                        'rate_class_rate'     => ($rate_data[$i][2] > 0 ? money($rate_data[$i][2]) : ''),
+                        'rate_class_selected' => '',
+                        'attendee_credits'    => $rate_data[$i][3]
+                    );
+
+                    if ($i == $rate_class)
+                        $ra['rate_class_selected'] = 'CHECKED';
+                    array_push($view_tags['rate_class_list'], $ra);
+                    $rate_classes = 'TRUE';
+                }
+            }
+            $v['rate_classes'] = $rate_classes;
+
+            // If there's only one Rate class, then tell the template that.
+            if (count($view_tags['rate_class_list']) == 1) {
+                               $v['single_rate_class'] = 'YES';
+            }
+
+            // If this event requires attendee names
+            if ($reg_data['need_attendees'] == 't') {
+
+                // Build Attendee's list
+                $v['attendees'] = '';
+                $style_setting = 'style="visibility: hidden; display: none;"';
+
+                // If there's data, then build existing input lines with data
+                $i = 1;
+                if ($numb_attendees > 0) {
+
+                       // For each line of inputs
+                    for ($i = 1; $i <= $numb_attendees; $i++) {
+                        // For each input field on the line
+
+                        $f_line = '<nobr> #'.$i.': <input type="text" name="attendee_'.$i.'_1" id="attendee_'.$i.'_1" value="'.$attendees[$i]['name'].'" size="40"></nobr>';
+
+                        $v['attendees'] .= $f_line."\n";
+                    }
+                } else
+                    $i = 1; // If no data blank line is #1
+
+                // Build 30 spare input lines or as limited by event
+                               $at_max = 30;
+                               $v['have_max_per_sub'] = 'NO';
+                               if ($reg_data['attendee_max_per_sub'] > 0) {
+                                       $at_max = $reg_data['attendee_max_per_sub'];
+                                       $v['have_max_per_sub'] = 'YES';
+                                       $v['max_per_sub'] = $at_max;
+                               }
+                for ($j = $i; $j < ($i + $at_max); $j++) {
+
+                    if ($j == $i)
+                        $f_line = '<nobr> #'.$j.': <input type="text" name="attendee_'.$j.'_1" id="attendee_'.$j.'_1" value="'.$attendees[$j]['name'].'" size="40"
+                            onKeyUp="show(\'attendee_'.($j + 1).'_1\');"
+                            onClick="show(\'attendee_'.($j + 1).'_1\');"
+                            ></nobr>';
+                    else
+                        $f_line = '<nobr '.$style_setting.' id="attendee_'.$j.'_1"> #'.$j.': <input type="text" name="attendee_'.$j.'_1" id="attendee_'.$j.'_1" value="'.$attendees[$j]['name'].'" size="40"
+                            onKeyUp="show(\'attendee_'.($j + 1).'_1\');"
+                            onClick="show(\'attendee_'.($j + 1).'_1\');"
+                            ></nobr>';
+
+                    $v['attendees'] .= $f_line."\n";
+                }
+
+            } // if( $reg_data['need_attendees'] == 't' )
+
+            // MagicForm Display
+            $mf = magic_form_display($event_id, $mf_styles, null, $fd);
+            $v['haveMagicForm'] = 'NO';
+            if ($mf['success'] && $mf['text'] != '') {
+                $v['haveMagicForm'] = 'YES';
+                $v['magic_form'] = $mf['text'];
+                $v['required'] = ($mf['required'] ? 'Yes' : 'No');
+            }
+
+        } // not too late to register
+
+        echo parse_view_localcheck($config->event_registration->custom_view_files, "registrations_step3.html", $view_tags);
+
+        break;
+
+    /*****************************************************
+     *
+     *    Step4 = Cart
+     *
+     ******************************************************/
+    case "Step4":
+
+        echo parse_view_localcheck($config->event_registration->custom_view_files, "registrations_step4.html", $view_tags);
+
+        break;
+
+    /*****************************************************
+     *
+     *    Step5 = Checkout
+     *
+     ******************************************************/
+    case "Step5":
+
+        if (strlen($v['state'])<10) {
+            $v['state'] = reg_build_picklist("state", $si_states_array, (!empty($v['state']) ? $v['state'] : "MI"), "standard", "blank");
+        }
+        if (strlen($v['country'])<10) {
+            $v['country'] = reg_build_picklist("country", $si_countries_array, (!empty($v['country']) ? $v['country'] : "US"), "standard", "blank");
+        }
+        if (strlen($v['contact_state'])<10) {
+               $v['contact_state'] = reg_build_picklist("contact_state", $si_states_array, (!empty($v['contact_state']) ? $v['contact_state'] : "MI"), "standard", "blank");
+        }
+        if (strlen($v['contact_country'])<10) {
+               $v['contact_country'] = reg_build_picklist("contact_country", $si_countries_array, (!empty($v['contact_country']) ? $v['contact_country'] : "US"), "standard", "blank");
+        }
+
+        $cc_array = array();
+        for ($i = 0; $i < count($si_cc_array); $i++)
+            if ($config->event_registration->cc_accepts & pow(2, $i))
+                array_push($cc_array, $si_cc_array[$i]);
+        $v["cctype"] = reg_build_picklist("cctype", $cc_array, $cctype, "simple");
+
+        $v["ccmonth"] = build_numeric_picklist("ccmonth", 1, 12, $ccmonth);
+        $v["ccyear"] = build_numeric_picklist('ccyear', date("Y"), date("Y") + 10, $ccyear);
+        $v["conf"] = build_radio_buttons("conf", $si_conf_methods, $conf);
+
+        echo parse_view_localcheck($config->event_registration->custom_view_files, "registrations_step5.html", $view_tags);
+
+        break;
+
+    /*****************************************************
+     *
+     *    Step6 = Confirmation
+     *
+     ******************************************************/
+    case "Step6":
+
+        // Send acknowledgement to Customer
+
+       // Get and parse the acknowledgement text from the misc table
+       $v['ack_intro'] = parse_string_view( urldecode($misc['req_ack_text']), $view_tags );
+       $html_summary = parse_view_localcheck($config->event_registration->custom_view_files, "registrations_confirmation.html", $view_tags);
+
+        $email_content = "--ContentBoundry\n"
+            ."Content-Type: text/plain; charset=\"US-ASCII\"\n"
+            ."\n"
+            ."This message may only be read using an HTML enabled E-Mail client."
+            ."\n"
+            ."--ContentBoundry\n"
+            ."Content-Type: text/html; charset=\"US-ASCII\"\n"
+            ."\n"
+            .$html_summary
+            ."\n"
+            ."--ContentBoundry--\n"
+            ."\n";
+
+        if (!empty($v['email'])) {
+            debug_mail(
+                               $v['email'],
+                $misc['req_ack_subject'],
+                       $email_content,
+                               "From: ".$config->event_registration->organization." <".$config->event_registration->organization_from_email.">"
+                       ."\nMime-Version: 1.0\nContent-Type: multipart/alternative; boundary=ContentBoundry\n"
+               );
+        }
+
+        // Mail to Site owner
+        $html_to_site_owner = parse_view_localcheck($config->event_registration->custom_view_files, "notify_site_owner.html", $view_tags);
+        $email_content = "--ContentBoundry\n"
+            ."Content-Type: text/plain; charset=\"US-ASCII\"\n"
+            ."\n"
+            ."This message may only be read using an HTML enabled E-Mail client."
+            ."\n"
+            ."--ContentBoundry\n"
+            ."Content-Type: text/html; charset=\"US-ASCII\"\n"
+            ."\n"
+            .$html_to_site_owner
+            ."\n"
+            ."--ContentBoundry--\n"
+            ."\n";
+        if ($config->event_registration->organization_internal_email != '') {
+            debug_mail(
+                               $config->event_registration->organization_internal_email,
+                               $config->event_registration->organization_short." Registration",
+                               $email_content,
+                               "From: ".$config->event_registration->organization_short." <".$config->event_registration->organization_internal_email.">"
+                                       ."\nMime-Version: 1.0\nContent-Type: multipart/alternative; boundary=ContentBoundry\n"
+                   );
+        }
+
+        // Mail to event notification addresses
+        foreach ($notify as $n) {
+
+            $email_content = "--ContentBoundry\n"
+                ."Content-Type: text/plain; charset=\"US-ASCII\"\n"
+                ."\n"
+                ."This message may only be read using an HTML enabled E-Mail client."
+                ."\n"
+                ."--ContentBoundry\n"
+                ."Content-Type: text/html; charset=\"US-ASCII\"\n"
+                ."\n"
+                .$n['message']
+                ."\n"
+                ."--ContentBoundry--\n"
+                ."\n";
+
+            debug_mail(
+                $n['addresses'],
+                $n['subject'],
+                $email_content,
+                "From: ".$config->event_registration->organization." <".$config->event_registration->organization_from_email.">"
+                       ."\nMime-Version: 1.0\nContent-Type: multipart/alternative; boundary=ContentBoundry\n"
+            );
+
+        }
+
+        // Display output to Customer
+
+        echo parse_view_localcheck($config->event_registration->custom_view_files, "registrations_summary.html", $view_tags);
+
+        break;
+
+}
+
+?>
diff --git a/front-end/registrations_support.php b/front-end/registrations_support.php
new file mode 100644 (file)
index 0000000..e69de29