diff -ruN 4.0K-4b/add_ons/README.txt 5.0.000/add_ons/README.txt
--- 4.0K-4b/add_ons/README.txt	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/add_ons/README.txt	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,29 @@
+Readme for Custom Code Directory for AgoraCart
+-----------------------------------
+April 21, 2000
+Revised June 15, 2000
+Revised August 22, 2000
+Revised September 15, 2000
+Revised May 7, 2003
+
+This directory is for installation of custom libraries.  The only thing
+that will be delivered in this directory are ".txt" files that might be
+useful to setting up custom perl libraries. 
+
+AgoraCart will automatically load the custom libraries if they are found
+in this directory.  You may place whatever code you like in such a
+library, including custom shipping logic or support routines for use with
+agorascript and code to load other libraries.  Only files ending in .pl
+are loaded, in fact all such files are loaded, so do not make anything
+other than a legitimate perl library have the .pl ending! 
+
+You should chmod .pl files in this dir 644.
+
+If you are using "secondary" (aka multiple) payment gateways, place them in this
+directory so they will be available at checkout time!   For example, zOffline will be
+your primary gateway set in main settings.  Then you wanted to use Authorize.Net and
+Offline as two gateways that you wish to offer.  Place copies of the the
+Offline-order_lib.pl as well as the AuthorizeNet-order_lib.pl files in this directory.  This will
+load those order libraries so that they are avialable for your order processing.
+
+
diff -ruN 4.0K-4b/add_ons/index.html 5.0.000/add_ons/index.html
--- 4.0K-4b/add_ons/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/add_ons/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,8 @@
+br><br><center>forwarding to the store ....</center>
+<script><!--
+
+setTimeout("window.location.href='../agora.cgi'",0)
+
+// -->
+
+		</script>
\ No newline at end of file
diff -ruN 4.0K-4b/add_ons/shipping-order-instructions-sort.pl 5.0.000/add_ons/shipping-order-instructions-sort.pl
--- 4.0K-4b/add_ons/shipping-order-instructions-sort.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/add_ons/shipping-order-instructions-sort.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,107 @@
+#!perl
+#######################################################################
+#
+# Shipping Instructions Compiled for Alternate Origins ... if enabled
+#
+# Author: Mister Ed for AgoraScript.com, a division of K-Factor Technologies, Inc
+# Copyright 2002-Present K-Factor Technologies, Inc.  All Rights Reserved.
+#
+# This is NOT FREE AND/OR GPL SOFTWARE!  This library is a cost item.
+# This software is a separate add-on to an ecommerce shopping cart and 
+# is the confidential and proprietary information of K-Factor Technologies, Inc.  You may
+# not disclose such Confidential Information and shall use it only in
+# conjunction with the AgoraCart (aka agora.cgi) shopping cart.
+#
+# Requires AgoraCart version 5.0.0 or above.  Just place this file in the add-on directory.
+#
+# K-Factor Technologies, Inc. BytePipe, AgoraScript nor any of their employees and/or representatives
+# MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT
+# THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESSED OR IMPLIED,
+# INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+# OR NON-INFRINGEMENT.
+#
+# K-Factor Technologies, Inc., BytePipe, AgoraScript nor any of their employees and/or representatives
+# SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY
+# LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS
+# SOFTWARE OR ITS DERIVATIVES.
+#
+# You may not give this script/add-on away or distribute it an any way outside of a copy of
+# AgoraCart without written permission from K-Factor Technologies, Inc.  K-Factor Technologies, Inc.
+# reserves any and all rights to distributions, add-ons, and other works based on this
+# piece of software as well as any and all rights to profit sharing and/or to charge for
+# such works and/or derivatves.
+#######################################################################
+$versions{'shipping-order-instructions-sort.pl'} = "5.0.000";
+&add_codehook("process-cart-item","alt_origin_ship_instructions");
+&add_codehook("process-cart-item","alt_stevo_ship_thing_names");
+&add_codehook("orderlib-ship-instructions","alt_origin_process_ship_instructions");
+&add_codehook("orderlib-ship-instructions","alt_run_stevo_ship_thingy_names");
+$stevo_shipping_names_secondary = "";
+
+sub alt_origin_ship_instructions {
+    my $product_temp = $product;
+    if ($sc_ship_thingy_p_id_indicator_enabled =~ /yes/i) {
+         $product_temp = "$cart_fields[1]" . " " . "$product";
+    }
+	if ($sc_alt_origin_enabled =~ /yes/i) {
+        $alt_origin = $cart_fields[11];
+		if ($alt_origin ne "") {
+			if ($zip_list{$alt_origin} eq "") {
+				$zip_list{$alt_origin} = "$quantity\*$weight";
+				$zip_names_list{$alt_origin} = "$product_temp\($options\)";
+			} else {
+				$temp_zip_thingy = "$zip_list{$alt_origin}";
+				$temp_zip_thingy .= "|" . "$quantity\*$weight";
+				$zip_list{$alt_origin} = "$temp_zip_thingy";
+				$temp_zip_thingy = "$zip_names_list{$alt_origin}";
+                $temp_zip_thingy .= "|" . "$product_temp\($options\)";
+				$zip_names_list{$alt_origin} = "$temp_zip_thingy";
+			}
+		} else {
+			if ($zip_list{$sc_verify_Origin_ZIP} eq "") {
+				$zip_list{$sc_verify_Origin_ZIP} = "$quantity\*$weight";
+				$zip_names_list{$sc_verify_Origin_ZIP} = "$product_temp\($options\)";
+			} else {
+				$temp_zip_thingy = "$zip_list{$sc_verify_Origin_ZIP}";
+				$temp_zip_thingy .= "|" . "$quantity\*$weight";
+				$zip_list{$sc_verify_Origin_ZIP} = "$temp_zip_thingy";
+				$temp_zip_thingy = "$zip_names_list{$sc_verify_Origin_ZIP}";
+                $temp_zip_thingy .= "|" . "$product_temp\($options\)";
+				$zip_names_list{$sc_verify_Origin_ZIP} = "$temp_zip_thingy";
+			}
+		}
+	}
+} 
+
+sub alt_origin_process_ship_instructions {
+	if ($sc_alt_origin_enabled =~ /yes/i) {
+		my ($origin_product_list_form, $ship_instructions2) = "";
+        $ship_instructions = "";
+		foreach $origin_product_list_form (sort (keys %zip_list)) {
+			$stevo_shipping_thing = "$zip_list{$origin_product_list_form}";
+			$stevo_shipping_names = "$zip_names_list{$origin_product_list_form}";
+ 			($ship_thing_too,$ship_instructions2) = 
+			&ship_put_in_boxes($stevo_shipping_thing,$stevo_shipping_names,$origin_product_list_form,$sc_verify_boxes_max_wt);
+			$ship_instructions .= "$ship_instructions2";
+		}
+		$sc_orderlib_use_SBW_for_ship_ins = "no";
+	}
+}
+
+sub alt_stevo_ship_thing_names {
+    if ($sc_ship_thingy_p_id_indicator_enabled =~ /yes/i) {
+        my $product_temp = "$cart_fields[1]" . " " . "$product";
+        $stevo_shipping_names_secondary .="|$product_temp\($options\)";
+    }
+}
+
+sub alt_run_stevo_ship_thingy_names {
+	if (($sc_alt_origin_enabled =~ /no/i) && ($stevo_shipping_names_secondary ne '')) {
+		$stevo_shipping_names = $stevo_shipping_names_secondary;
+		($ship_thing_too,$ship_instructions) = 
+		&ship_put_in_boxes($stevo_shipping_thing,$stevo_shipping_names_secondary,$sc_verify_Origin_ZIP,$sc_verify_boxes_max_wt);
+		$sc_orderlib_use_SBW_for_ship_ins = "no";
+	}
+}
+1; #we are a library
\ No newline at end of file
diff -ruN 4.0K-4b/admin_files/2checkout-user_lib.pl 5.0.000/admin_files/2checkout-user_lib.pl
--- 4.0K-4b/admin_files/2checkout-user_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/admin_files/2checkout-user_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,19 +1,27 @@
-$sc_gateway_username = 'agoracart';
-$sc_order_script_url = "https://www.2checkout.com/cgi-bin/Abuyers/purchase.2c";
+$sc_gateway_username = 'need ID here';
+$sc_order_script_url = "https://www.2checkout.com/2co/buyer/purchase";
 $x_Logo_URL = "";
 $x_Color_Background = "#FFFFFF";
 $x_Color_Link = "#0000FF";
 $x_Color_Text = "#000000";
 $x_Description = "Online Order at www.mydomain.com";
 $x_Header_Html_Payment_Form = "<!--agorascript-pre
-  return \$anet_cart_table;
+  return \$checkout2_cart_table;
 -->";
 $x_Footer_Html_Payment_Form = "Bottom of the orderform text goes here";
 $x_Header_Html_Receipt = "Top of the receipt text goes here";
 $x_Footer_Html_Receipt = "";
 $x_Header_Email_Receipt = "top of e-mail";
 $x_Footer_Email_Receipt = "<!--agorascript-pre
- return \$anet_prod_in_cart;
+ return \$checkout2_prod_in_cart;
 -->";
 $merchant_live_mode = "no";
+$sc_2CO_submit = 'agora.cgi?secpicserve=submit_order.gif';
+$sc_2CO_change = 'agora.cgi?secpicserve=make_changes.gif';
+$sc_2CO_verify_message = "Please verify the information below.  When you are confident it is correct, click on the \'Submit Order For Processing\' button to go to the 2Checkout site where you will enter your payment information.";
+$sc_display_checkout_tos = "no";
+$sc_tos_display_address = qq'AgoraCart<br>
+123 Main<br>
+Salt Lick City, UT 88888<br>
+123-456-7890';
 1;
diff -ruN 4.0K-4b/admin_files/AgoraPay-user_lib.pl 5.0.000/admin_files/AgoraPay-user_lib.pl
--- 4.0K-4b/admin_files/AgoraPay-user_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/admin_files/AgoraPay-user_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,12 +1,35 @@
-$sc_gateway_username = "18180";
+$sc_gateway_username = "AgoraPay ID here";
 $sc_order_script_url = "https://secure.paymentclearing.com/cgi-bin/mas/split.cgi";
 $mername = "My Company Name";
+$merchant_live_mode = "yes";
+$sc_agorapay_submit = 'agora.cgi?secpicserve=submit_order.gif';
+$sc_agorapay_change = 'agora.cgi?secpicserve=make_changes.gif';
+$sc_agorapay_verify_message = "Please verify the information below.  When you are confident it is correct, click on the \'Submit Order For Processing\' button to go to the secure AgoraPay site where you will enter the remainder of your payment information.";
+$sc_agorapay_order_desc = "AgoraPay - AgoraCart Online Order";
+$sc_display_checkout_tos = "no";
+$sc_tos_display_address = qq'AgoraCart<br>
+123 Main<br>
+Salt Lick City, UT 88888<br>
+123-456-7890';
+$sc_agorapay_top_message = "top message";
+$AgoraPay_order_ok_final_msg_tbl = "";
+$AgoraPay_merch_message = "<br> Thank you for using AgoraCart";
+$AgoraPay_enablebodytags = "1";
+$AgoraPay_bodyback = "white";
+$AgoraPay_fontcolor = "black";
+$AgoraPay_linkcolor = "\#0000FF";
+$AgoraPay_backimage_URL = "";
+$AgoraPay_Logo_URL = "";
 $acceptcards = "1";
-$acceptchecks = "1";
+$acceptvisa = "1";
+$acceptmastercard = "1";
+$acceptdiscover = "1";
+$acceptamex = "0";
+$acceptdiners = "0";
+$acceptchecks = "0";
 $accepteft = "0";
-$altaddr = "1";
+$altaddr = "0";
 $email_text = "<!--agorascript-pre
   return \$AgoraPay_prod_in_cart;
 -->";
-$merchant_live_mode = "no";
 1;
diff -ruN 4.0K-4b/admin_files/AuthorizeNet-user_lib.pl 5.0.000/admin_files/AuthorizeNet-user_lib.pl
--- 4.0K-4b/admin_files/AuthorizeNet-user_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/admin_files/AuthorizeNet-user_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,33 +1,30 @@
-$sc_auth_top_message = qq'put something here or leave blank';
 $sc_gateway_username = 'your_ID_here';
 $txnkey = "Your_Key_Here";
 $tstamp = time;
 $tstamp3 = "time";
 $sc_order_script_url = "https://secure.authorize.net/gateway/transact.dll";
-$sc_auth_upsgroundres = "yes";
-$sc_auth_upsgroundcomm = "yes";
-$sc_auth_ups2da = "yes";
-$sc_auth_ups1da = "yes";
-$sc_auth_fedexprioiryovernight = "yes";
-$sc_auth_fedexexpress = "yes";
-$sc_auth_fedexground = "yes";
-$sc_auth_fedexhome = "yes";
-$sc_auth_uspsparcelpost = "yes";
-$sc_auth_uspsprioritymail = "yes";
-$sc_auth_uspsexpressmail = "yes";
-$x_Logo_URL = "";
-$x_Color_Background = "#FFFFFF";
-$x_Color_Link = "#0000FF";
-$x_Color_Text = "#000000";
-$x_Description = "Online Order at www.mydomain.com";
-$x_Header_Html_Payment_Form = "<!--agorascript-pre
+$sc_auth_submit = 'agora.cgi?secpicserve=submit_order.gif';
+$sc_auth_change = 'agora.cgi?secpicserve=make_changes.gif';
+$sc_auth_verify_message = "Please verify the information below.  When you are confident it is correct, click on the \'Submit Order For Processing\' button to go to the Authorize.Net site where you will enter your payment information.";
+$sc_auth_order_desc = "Authorize.net - AgoraCart Online Order";
+$sc_display_checkout_tos = "no";
+$sc_tos_display_address = qq'AgoraCart<br>
+123 Main<br>
+Salt Lick City, UT 88888<br>
+123-456-7890';
+$x_logo_url = "";
+$x_color_background = "#FFFFFF";
+$x_color_link = "#0000FF";
+$x_color_text = "#000000";
+$x_description = "Online Order at www.mydomain.com";
+$x_header_html_payment_form = "<!--agorascript-pre
   return \$anet_cart_table;
 -->";
-$x_Footer_Html_Payment_Form = "Bottom of the orderform text goes here";
-$x_Header_Html_Receipt = "Top of the receipt text goes here";
-$x_Footer_Html_Receipt = "";
-$x_Header_Email_Receipt = "top of e-mail";
-$x_Footer_Email_Receipt = "<!--agorascript-pre
+$x_footer_html_payment_form = "Bottom of the orderform text goes here";
+$x_header_html_receipt = "Top of the receipt text goes here";
+$x_footer_html_receipt = "";
+$x_header_email_receipt = "top of e-mail";
+$x_footer_email_receipt = "<!--agorascript-pre
  return \$anet_prod_in_cart;
 -->";
 $merchant_live_mode = "no";
diff -ruN 4.0K-4b/admin_files/LinkpointConnect-user_lib.pl 5.0.000/admin_files/LinkpointConnect-user_lib.pl
--- 4.0K-4b/admin_files/LinkpointConnect-user_lib.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/admin_files/LinkpointConnect-user_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,16 @@
+$sc_gateway_username = '123456';
+$sc_gateway_storename = '1234567890';
+$sc_order_script_url = "https://www.linkpointcentral.com/lpc/servlet/lppay";
+$sc_linkpoint_submit = 'agora.cgi?secpicserve=submit_order.gif';
+$sc_linkpoint_change = 'agora.cgi?secpicserve=make_changes.gif';
+$sc_linkpoint_verify_message = "Please verify the information below.  When you are confident it is correct, click on the \'Submit Order For Processing\' button to go to the linkpoint Link site where you will enter your payment information.";
+$sc_linkpoint_order_desc = 'Linkpoint Connect - AgoraCart Online Order';
+$sc_display_checkout_tos = "no";
+$sc_tos_display_address = qq'AgoraCart<br>
+123 Main<br>
+Salt Lick City, UT 88888<br>
+123-456-7890';
+$sc_linkpoint_top_message = "top message";
+$order_ok_final_msg_tbl = "";
+#
+1;# We are a Library
diff -ruN 4.0K-4b/admin_files/LinkpointHTML-user_lib.pl 5.0.000/admin_files/LinkpointHTML-user_lib.pl
--- 4.0K-4b/admin_files/LinkpointHTML-user_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/admin_files/LinkpointHTML-user_lib.pl	1969-12-31 18:00:00.000000000 -0600
@@ -1,4 +0,0 @@
-$sc_gateway_username = 'xxxxxx';
-$sc_order_script_url = "https://www.linkpointcentral.com/lpc/servlet/lppay";
-#
-1;# We are a Library
diff -ruN 4.0K-4b/admin_files/NiftyPay-user_lib.pl 5.0.000/admin_files/NiftyPay-user_lib.pl
--- 4.0K-4b/admin_files/NiftyPay-user_lib.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/admin_files/NiftyPay-user_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,35 @@
+$sc_gateway_username = "NiftyPay ID here";
+$sc_order_script_url = "https://secure.paymentclearing.com/cgi-bin/mas/split.cgi";
+$mername = "My Company Name";
+$merchant_live_mode = "yes";
+$sc_niftypay_submit = 'agora.cgi?secpicserve=submit_order.gif';
+$sc_niftypay_change = 'agora.cgi?secpicserve=make_changes.gif';
+$sc_niftypay_verify_message = "Please verify the information below.  When you are confident it is correct, click on the \'Submit Order For Processing\' button to go to the secure NiftyPay site where you will enter the remainder of your payment information.";
+$sc_niftypay_order_desc = "NiftyPay - AgoraCart Online Order";
+$sc_display_checkout_tos = "no";
+$sc_tos_display_address = qq'AgoraCart<br>
+123 Main<br>
+Salt Lick City, UT 88888<br>
+123-456-7890';
+$sc_niftypay_top_message = "top message";
+$NiftyPay_order_ok_final_msg_tbl = "";
+$NiftyPay_merch_message = "<br> Thank you for using AgoraCart";
+$NiftyPay_enablebodytags = "1";
+$NiftyPay_bodyback = "white";
+$NiftyPay_fontcolor = "black";
+$NiftyPay_linkcolor = "\#0000FF";
+$NiftyPay_backimage_URL = "";
+$NiftyPay_Logo_URL = "";
+$acceptcards = "1";
+$acceptvisa = "1";
+$acceptmastercard = "1";
+$acceptdiscover = "1";
+$acceptamex = "0";
+$acceptdiners = "0";
+$acceptchecks = "0";
+$accepteft = "0";
+$altaddr = "0";
+$email_text = "<!--agorascript-pre
+  return \$NiftyPay_prod_in_cart;
+-->";
+1;
diff -ruN 4.0K-4b/admin_files/Offline-user_lib.pl 5.0.000/admin_files/Offline-user_lib.pl
--- 4.0K-4b/admin_files/Offline-user_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/admin_files/Offline-user_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,22 +1,21 @@
-$sc_order_script_url = "http://www.agoracart.com/cgi-bin/store/agora.cgi";
-$sc_Offline_CC_validation = "yes";
-$sc_allow_pay_by_check = "yes";
+$sc_order_script_url = "https://secure.somesitename.net/~username/storepro5rc1/agora.cgi";
+$sc_Offline_CC_validation = "no";
+$sc_allow_pay_by_check = "no";
+$sc_allow_pay_by_mailedcheck = "yes";
 $sc_allow_pay_by_PO = "yes";
-$sc_allow_pay_by_CC = "";
-$sc_take_discover = "no";
+$sc_allow_pay_by_CC = "no";
+$sc_take_discover = "yes";
 $sc_take_amex = "no";
 $sc_Offline_show_table = "yes";
-$sc_upsgroundres = "yes";
-$sc_upsgroundcomm = "yes";
-$sc_ups2da = "yes";
-$sc_ups1da = "yes";
-$sc_fedexprioiryovernight = "yes";
-$sc_fedexexpress = "yes";
-$sc_fedexground = "yes";
-$sc_fedexhome = "yes";
-$sc_uspsparcelpost = "yes";
-$sc_uspsprioritymail = "yes";
-$sc_uspsexpressmail = "yes";
+$sc_tos_display_address = qq'K-Factor Tech<br>
+1234 N. YukaTan<br>
+Blahblah, NV, 1234<br>
+USA';
+$sc_mailedfunds_address = qq'Mail your payment to:<br>
+K-Factor Tech<br>
+1234 N. YukaTan<br>
+Blahblah, NV, 1234<br>
+USA';
 $sc_offline_top_message = qq'';
 $sc_offline_shipping_message = qq'';
 $sc_offline_special_message = qq'';
diff -ruN 4.0K-4b/admin_files/PayPal-user_lib.pl 5.0.000/admin_files/PayPal-user_lib.pl
--- 4.0K-4b/admin_files/PayPal-user_lib.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/admin_files/PayPal-user_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,22 @@
+$sc_gateway_username = 'user@domain.com';
+$sc_button_image_URL = "http://images.paypal.com/images/x-click-but6.gif";
+$sc_paypal_change = "agora.cgi?secpicserve=make_changes.gif";
+$sc_order_script_url = "https://www.paypal.com/xclick/business";
+$sc_paypal_order_name = 'PayPal AgoraCart Purchase, INV# ';
+$sc_paypal_order_number = '$sc_verify_inv_no';
+$sc_currency_id = "USD";
+$sc_paypal_address_override = '1';
+$sc_paypal_top_message = qq'';
+$sc_paypal_shipping_message = qq'';
+$sc_paypal_special_message = qq'';
+$sc_use_custom_paypal_url_logic = qq'no';
+$sc_custom_paypal_url_logic = qq``;
+$sc_paypal_verify_message = qq'Please verify the information below.  When you are confident it is correct, click on the \'Submit Order For Processing\' button to go to the Paypal site where you will enter your payment information.';
+$sc_display_checkout_tos = qq'no';
+$sc_tos_display_address = qq'AgoraCart<br>
+123 Main<br>
+Salt Lake City, UT 88888<br>
+123-456-7890';
+$order_ok_final_msg_tbl = qq'';
+#
+1;# We are a Library
diff -ruN 4.0K-4b/admin_files/PlugnPay-user_lib.pl 5.0.000/admin_files/PlugnPay-user_lib.pl
--- 4.0K-4b/admin_files/PlugnPay-user_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/admin_files/PlugnPay-user_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,14 +1,24 @@
-$sc_gateway_username = '';
+$sc_gateway_username = 'pnptest';
 $sc_gateway_card_allowed = 'visa,mastercard';
 $sc_gateway_paymethod = 'credit';
 $sc_gateway_avs_level = '';
 $sc_gateway_comments = 'no';
 $sc_gateway_easycart = 'yes';
-$sc_gateway_shipinfo = '';
-$sc_gateway_send_weight = '';
-$sc_gateway_email = 'webmaster@agoracart.com';
+$sc_gateway_shipinfo = 'no';
+$sc_gateway_send_weight = 'no';
+$sc_plugnpay_submit = 'agora.cgi?secpicserve=submit_order.gif';
+$sc_plugnpay_change = 'agora.cgi?secpicserve=make_changes.gif';
+$sc_plugnpay_verify_message = qq'Please verify the information below.  When you are confident it is correct, click on the \'Submit Order For Processing\' button to go to the PlugnPay site where you will enter your payment information.';
+$sc_display_checkout_tos = 'no';
+$sc_tos_display_address = qq'AgoraCart<br>
+123 Main<br>
+Salt Lick City, UT 88888<br>
+123-456-7890';
+;
+$sc_gateway_email = 'webmaster@yourname.com';
 $sc_gateway_cc_mail = '';
 $sc_gateway_subject = '';
+$sc_plugnpay_order_desc = 'PlugnPay AgoraCart Order';
 $sc_gateway_message = '';
 $sc_gateway_subject_email = '';
 $sc_gateway_dontsendmail = 'yes';
@@ -18,7 +28,7 @@
 $sc_gateway_success_link = '';
 $sc_gateway_badcard_link = '';
 $sc_gateway_problem_link = '';
-$sc_gateway_use_shipping_calculator = '';
+$sc_gateway_use_shipping_calculator = 'no';
 $sc_gateway_shipmethod = '';
 $sc_gateway_merchant_zip = '';
 $sc_gateway_usps_container = '';
diff -ruN 4.0K-4b/admin_files/USAepay-user_lib.pl 5.0.000/admin_files/USAepay-user_lib.pl
--- 4.0K-4b/admin_files/USAepay-user_lib.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/admin_files/USAepay-user_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,21 @@
+$sc_gateway_userkey = "Enter your Key Here";
+$sc_order_script_url = "https://www.usaepay.com/gate.php";
+$merchant_live_mode = "yes";
+$sc_USAepay_submit = 'agora.cgi?secpicserve=submit_order.gif';
+$sc_USAepay_change = 'agora.cgi?secpicserve=make_changes.gif';
+$sc_USAepay_verify_message = "Please verify the information below.  When you are confident it is correct, click on the \'Submit Order For Processing\' button to go to complete your order";
+$sc_USAepay_order_desc = "USAepay - AgoraCart Online Order";
+$sc_display_checkout_tos = "yes";
+$sc_tos_display_address = qq'AgoraCart<br>
+123 Main<br>
+Salt Lake City, UT 88888<br>
+123-456-7890';
+$sc_USAepay_top_message = "top message<br>";
+$USAepay_order_ok_final_msg_tbl = "top of confirm page<br>";
+$messages{'USAepay_declined'} = qq~<br>Declined Payment Message Here. Cart Still exists.   Try Again.~;
+$messages{'USAepay_errror'} = qq~<br>Error Message Here. Cart Still exists.  Try Again.~;
+$acceptvisa = "yes";
+$acceptmastercard = "yes";
+$acceptdiscover = "no";
+$acceptamex = "no";
+1;
diff -ruN 4.0K-4b/admin_files/YourPayConnect-user_lib.pl 5.0.000/admin_files/YourPayConnect-user_lib.pl
--- 4.0K-4b/admin_files/YourPayConnect-user_lib.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/admin_files/YourPayConnect-user_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,16 @@
+$sc_gateway_username = '123456';
+$sc_gateway_storename = '1234567890';
+$sc_order_script_url = "https://www.yourpay.com/lpcentral/servlet/lppay";
+$sc_yourpay_submit = 'agora.cgi?secpicserve=submit_order.gif';
+$sc_yourpay_change = 'agora.cgi?secpicserve=make_changes.gif';
+$sc_yourpay_verify_message = "Please verify the information below.  When you are confident it is correct, click on the \'Submit Order For Processing\' button to go to the YourPay site where you will enter your payment information.";
+$sc_yourpay_order_desc = 'YourPay Connect - AgoraCart Online Order';
+$sc_display_checkout_tos = "no";
+$sc_tos_display_address = qq'AgoraCart<br>
+123 Main<br>
+Salt Lick City, UT 88888<br>
+123-456-7890';
+$sc_yourpay_top_message = "top message";
+$order_ok_final_msg_tbl = "";
+#
+1;# We are a Library
diff -ruN 4.0K-4b/admin_files/agora_user_lib.pl 5.0.000/admin_files/agora_user_lib.pl
--- 4.0K-4b/admin_files/agora_user_lib.pl	2005-12-01 10:26:40.000000000 -0600
+++ 5.0.000/admin_files/agora_user_lib.pl	2006-10-31 09:51:14.000000000 -0600
@@ -3,13 +3,13 @@
 
 #:#:#: start CART settings
 sub init_cart_settings {
-@sc_cart_index_for_display = (
-    $cart{"quantity"}
-    ,$cart{"db_user1"}
-    ,$cart{"name"}
-    ,$cart{"web_options"}
-    ,$cart{"shipping"}
-    ,$cart{"price_after_options"}
+@sc_cart_index_for_display = ( 
+    $cart{"quantity"} 
+    ,$cart{"db_user1"} 
+    ,$cart{"name"} 
+    ,$cart{"web_options"} 
+    ,$cart{"shipping"} 
+    ,$cart{"price_after_options"} 
     );
 $sc_cart_display_str = 'Qty|Picture|Product|Options|Shipping Wt.<br>(lbs)|Cost';
 @sc_cart_display_fields = split(/\|/,$sc_cart_display_str);
@@ -19,12 +19,12 @@
 @sc_cart_display_factor = split(/\|/,$sc_cart_display_fact);
 $sc_cart_display_form = 'no|no|no|no|yes|yes';
 @sc_cart_display_format = split(/\|/,$sc_cart_display_form);
-@sc_textcart_index_for_display = (
-    $cart{"email_options"}
-    ,$cart{"price_after_options"}
-    ,$cart{"price_after_options"}
-    ,$cart{"shipping"}
-    ,$cart{"shipping"}
+@sc_textcart_index_for_display = ( 
+    $cart{"email_options"} 
+    ,$cart{"price_after_options"} 
+    ,$cart{"price_after_options"} 
+    ,$cart{"shipping"} 
+    ,$cart{"shipping"} 
     );
 $sc_textcart_display_str = 'Options|Cost (each)|Item Subtotal|Wt. each|Total Wt.';
 @sc_textcart_display_fields = split(/\|/,$sc_textcart_display_str);
@@ -37,38 +37,42 @@
 }
 if ($main_program_running =~ /yes/i) {
 &add_codehook("after_loading_setup_db","init_cart_settings");
-} else {
+} else { 
 &init_cart_settings;
 }
 #:#:#: end CART settings
+#:#:#: start CSSDESIGN settings
+$sc_standard_head_info = qq~<link rel="stylesheet" type="text/css" href="agorastyles.css" media="screen">
+<link rel="stylesheet" type="text/css" href="html/html-templates/templates/TheAgora/TheAgora_BluGreen/agoratemplate.css" media="screen">
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+~;
+$sc_secure_standard_head_info = qq!
+!;
+$sc_doctype =  qq~<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">~;
+#:#:#: end CSSDESIGN settings
+#:#:#: start DISCOUNT settings
+@sc_discount_logic = ("");
+#:#:#: end DISCOUNT settings
+#:#:#: start FEATUREDPRODUCT settings
+$sc_featuredProduct = qq~<div align=center><a class=ac_left_links href="agora.cgi?cart_id=%%cart_id%%&amp;p_id=00001&amp;xm=on">
+                         <img class="template_image_no_border" src="%%URLofImages%%/sm_0009.gif" alt="featured product" /></a><br /><br />
+<a class=ac_left_links href="agora.cgi?cart_id=%%cart_id%%&amp;p_id=00001&amp;xm=on"><b>Perl for Newbies</b></a><br />
+This is the short description.  In fact this description is really short.<br />
+<font class=ac_product_price>%%sc_money_symbol%% 5.00</font></div>
+~;
+$sc_featuredProduct_secure = qq|<div align=center><a class=ac_left_links href="agora.cgi?cart_id=%%cart_id%%&amp;p_id=00001&amp;xm=on">
+     <img class="template_image_no_border" src=%%URLofImages%%/sm_0009.gif" alt="featured product" /></a><br /><br />
+<a class=ac_left_links href="agora.cgi?cart_id=%%cart_id%%&amp;p_id=00001&amp;xm=on"><b>Perl for Newbies</b></a><br />
+This is the short description.  In fact this description is really short.<br />
+<font class=ac_product_price>%%sc_money_symbol%% 5.00</font></div>
+|;
+$sc_displayFeaturedProducts = "yes";
+#:#:#: end FEATUREDPRODUCT settings
 #:#:#: start FREEFORMLOGIC settings
 $mc_free_form_logic_row_count = "25";
-$sc_free_form_logic = "
-# This gets executed after the agora.setup.db file is loaded
-# by agora.cgi ... You can set 'html thingies', load libraries, etc.
-#
-# auto-load the database library ... need to do this for flexdbm
-#&require_supporting_libraries(__FILE__,__LINE__,\"\$sc_db_lib_path\");
-
-# Turn discount logic on for our 'form' variable
-\$sc_calculate_discount_at_display_form = 1;
-\$sc_calculate_discount_at_process_form = 1;
-\@sc_order_form_discount_related_fields =
- ('cinfo_discount');
-
-# define relationship of code to discount percentage
-\@sc_discount_logic =
- (\"0||||0%\",
-  \"1||||10%\",
-  \"2||||20%\",
-  \"3||||30%\",
-  \"4||||40%\");
-
-# define the minimum order amounts for codes 0,1,2,3,4
-\@sc_dcode_min_amt = ('',50,100,175,250);
-
-# Allow for master logon for the customer information
-\$sc_master_cinfo_password = 'wonderful';
+$sc_free_form_logic = "\# This gets executed after the agora.setup.db file is loaded
+\# by agora.cgi ... You can set \'html thingies\', load libraries, etc.
+\#
 ";
 #
 $sc_free_form_logic_too = "";
@@ -78,12 +82,12 @@
   &add_codehook("pre_header_navigation","run_freeform_logic");
   &add_codehook("open_for_business","run_freeform_logic_too");
  }
-$sc_free_form_logic_done = 0;
-sub run_freeform_logic {
+$sc_free_form_logic_done = 0; 
+sub run_freeform_logic { 
   local($f)=__FILE__;
   local($l)=__LINE__;
   if ($sc_free_form_logic_done) {return '';}
-  $sc_free_form_logic_done = 1;
+  $sc_free_form_logic_done = 1; 
   eval($sc_free_form_logic);
   if ($@ ne "") {
     &update_error_log("Free Form Logic err: $@",$f,$l);
@@ -93,7 +97,7 @@
     &call_exit;
    }
  }
-sub run_freeform_logic_too {
+sub run_freeform_logic_too { 
   local($f)=__FILE__;
   local($l)=__LINE__;
   eval($sc_free_form_logic_too);
@@ -107,123 +111,162 @@
  }
 #:#:#: end FREEFORMLOGIC settings
 #:#:#: start LAYOUT settings
-$layout_store_page_font_color = "#000000";
-$layout_store_page_linkfont_color = "#0000FF";
-$layout_store_page_vlinkfont_color = "#0000FF";
-$layout_store_page_bgcolor = "#FFFFFF";
-$layout_store_page_bgimage = "";
-$sc_standard_body_info = 'BORDER=#000000 Link=#0000FF vlink=#0000FF BGCOLOR="#FFFFFF"';
-$layout_store_productpage_width = "550";
-$sc_product_display_header = qq!<CENTER><TABLE BORDER=0 WIDTH=550>!;
-$layout_store_productpage_thanks_size = "2";
-$layout_store_productpage_thanks_color = "#FF0000";
-$layout_store_productpage_thanks_font = "";
-$layout_store_productpage_thanks_mess = "Thank you, your selection has been added to your order.";
-$sc_item_ordered_message = '<TR><TD COLSPAN=3><CENTER><FONT FACE="Arial" SIZE=2 COLOR=#FF0000>Thank you, your selection has been added to your order.</FONT></CENTER></TD></TR>';
-$layout_store_cart_table_border = "1";
-$layout_store_cart_table_cellpadding = "4";
-$layout_store_cart_table_cellspacing = "0";
-$layout_store_cart_table_bgcolor = "#E8FFF8";
-$cart_table_def = 'BORDER=1 CELLPADDING=4 CELLSPACING=0 BGCOLOR="#E8FFF8"';
-$layout_store_cart_table_header_bgcolor = "#FFE0E0";
-$cart_heading_def = 'BGCOLOR="#FFE0E0"';
-$layout_store_order_table_border = "0";
-$layout_store_order_table_cellpadding = "2";
-$layout_store_order_table_cellspacing = "0";
-$layout_store_order_table_bgcolor = "#F0F5FF";
-$order_table_def = 'BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR="#F0F5FF"';
-$layout_store_order_table_header_bgcolor = "#E0E5FF";
-$order_heading_def = 'align=center colspan=2 BGCOLOR="#E0E5FF"';
-$sc_totals_table_ship_label = " Shipping";
-$sc_totals_table_disc_label = "Discount";
-$sc_totals_table_stax_label = "Sales Tax";
-$sc_totals_table_gtot_label = "Grand Total";
+$sc_use_html_product_pages = "maybe";
+$sc_use_category_name_as_header = "yes";
+$sc_use_category_name_as_ppinc_root = "yes";
+$sc_should_i_display_cart_after_purchase = "no";
+$sc_should_i_display_cart_after_purchase_real = "no";
+$sc_db_max_rows_returned = "6";
+$sc_money_symbol = qq`\$`;
+$sc_money_symbol_placement = "front";
+$layout_store_productpage_thanks_mess = qq~Thank you, your selection has been added to your order.~;
+$sc_item_ordered_message = '<tr><td class="ac_add_message">Thank you, your selection has been added to your order.</td></tr>';
+$sc_show_shipping_label_box = "yes";
+$sc_totals_table_ship_label = "Shipping:";
+$sc_totals_table_disc_label = "Discount:";
+$sc_totals_table_stax_label = "Sales Tax (statehere) :";
+$sc_totals_table_gtot_label = "Grand Total:";
 $sc_totals_table_itot_label = "Item Cost Subtotal";
 $sc_totals_table_thdr_label = "Order Totals";
-$layout_store_font_style = "Arial";
-$layout_store_font_size = "2";
-$layout_store_font_color = "#000000";
-$cart_font_style = '<FONT FACE="Arial" SIZE=2 color="#000000">';
-$layout_store_font_style2 = "arial";
-$layout_store_font_size2 = "2";
-$layout_store_font_color2 = "#000000";
-$cartnum_font_style = '<FONT FACE="arial" SIZE=2 color="#000000">';
+$sc_display_cartlinksite = "yes";
+$sc_display_cartlinksite_url = "www.domainnamehere.com";
+$sc_display_cartlinksite_name = "Home: domainnamehere.com";
+$sc_display_cartlinkhome = "yes";
+$sc_display_cartlinkhome_name = "Main Store Page";
 #:#:#: end LAYOUT settings
 #:#:#: start MAIN settings
 $sc_set_0077_umask = 'no';
-$original_umask = umask;
+$original_umask = umask 0077;
 $sc_allow_ofn_choice = "no";
 $sc_gateway_name = "Offline";
+$sc_replace_orderform_form_tags = "yes";
 $sc_database_lib = "agora_db_lib.pl";
 $sc_prod_db_pad_length = "5";
-$sc_money_symbol = '$';
-$sc_money_symbol_placement = "front";
-$sc_http_affilliate_call = 'http';
-$sc_affiliate_image_call = '';
+$sc_minimum_order_amount = "2.00";
+$sc_minimum_order_text = "US Dollars";
+$sc_prevent_zero_total_orders = "No";
+$sc_need_short_cart_id = "No";
+$sc_use_database_subcats = "Yes";
+$sc_subcat_index_field = "user4";
+$sc_count_database_cats = "No";
+$sc_http_affiliate_call = qq!!;
+$sc_temp_affiliate_call = "";
 $sc_send_order_to_email = "yes";
 $sc_second_send_order_to_email = "no";
-$sc_order_log_name = "your_order.log";
-$sc_send_order_to_log = "yes";
-$sc_order_email = '[% email %]';
-$sc_first_order_email = '[% email %]';
-$sc_second_order_email = 'sales2@yourdomain.com';
+$sc_order_email = "[% email %]";
+$sc_first_order_email = "[% email %]";
+$sc_second_order_email = "sales\@yourdomain.com";
+$sc_use_dynamic_email_subjects = "no";
 $sc_store_url = "[% url_to_install %]agora.cgi";
-$sc_ssl_location_url2 = "";
-$sc_stepone_order_script_url = "";
-$sc_admin_email = '[% email %]';
+$sc_ssl_location_url2 = "https://secure.domainnamehere.net/store5/agora.cgi";
+$sc_stepone_order_script_url = "https://secure.domainnamehere.net/store5/agora.cgi";
+$sc_admin_email = "[% email %]";
 $sc_domain_name_for_cookie = "[% installed_on_domain %]";
 $sc_path_for_cookie = "/[% installpath %]";
-$sc_self_serve_images = "Yes";
-$URL_of_images_directory = "picserve.cgi?picserve=";
+$sc_self_serve_images = "No";
+$URL_of_images_directory = "html/images";
 $sc_path_of_images_directory =  "html/images";
-$sc_db_max_rows_returned = "10";
+$sc_number_days_keep_old_carts = 1;
+$sc_shall_i_log_accesses = "no";
 $sc_order_check_db = "yes";
-$sc_use_html_product_pages = "maybe";
-$sc_should_i_display_cart_after_purchase = "no";
+$sc_negative_priced_options = "yes";
+$sc_use_verified_opt_values = "yes";
+$sc_disable_variable_options = "no";
 $sc_scramble_cc_info = "yes";
+$sc_running_an_SSI_store = 'no';
+$sc_use_meta_cookies = 'no';
+$sc_debug_mode = "no";
+##############################################################
+$sc_domain_name_for_cookie = "$ENV{'SERVER_NAME'}";
+$sc_my_script_name = "$ENV{'SCRIPT_NAME'}";
+#
+# Cute little trick to get manager to display correct "guess" at a path
+if ($sc_my_script_name eq "") {
+  $sc_my_script_name = "/store/agora.cgi";
+ }
+if ($sc_my_script_name =~ "/protected/manager") {
+  $sc_my_script_name =~ s/protected\/manager/agora/;
+ }
+$sc_store_url = "http://${sc_domain_name_for_cookie}$sc_my_script_name";
+$sc_order_email = "orders\@$sc_domain_name_for_cookie";
+$sc_admin_email = "sales\@$sc_domain_name_for_cookie";
+($sc_path_for_cookie,$junk) = split(/\/ragora.cgi/,$sc_my_script_name,2);
+($sc_path_for_cookie,$junk) = split(/\/agora.cgi/,$sc_path_for_cookie,2);
+# # # # display special message at manager welcome screen # # # #
+{ local ($msg)='';
+if ($mc_first_time_user_to_agora_check eq '') {
+  $mc_first_time_user_to_agora_check = '1';
+  $msg .= "The store setup has 'guessed' at some values, please go ";
+  $msg .= 'to the main store settings under "Program Settings" and ';
+  $msg .= 'set and SAVE values for this store.   ';
+  $other_welcome_message .= "<BR><BR><FONT COLOR=RED>$msg</FONT>";
+  $other_welcome_message .= "&nbsp;&nbsp;";
+  $other_welcome_message .= "<a href='manager.cgi?main_settings_screen=1'>";
+  $other_welcome_message .= "Main Settings";
+  $other_welcome_message .= "</a>";
+ }
+}
+##############################################################
 #:#:#: end MAIN settings
+#:#:#: start NEWPRODUCTS settings
+$sc_tenNewProducts = qq~~;
+#:#:#: end NEWPRODUCTS settings
+#:#:#: start ORDERMANAGER settings
+$sc_order_log_name = "your_order.log";
+$sc_send_order_to_log = "yes";
+$sc_write_individual_order_logs = "yes";
+$sc_write_monthly_master_order_logs = "yes";
+$sc_write_monthly_short_order_logs = "yes";
+$sc_write_product_sales_logs = "yes";
+$sc_defaultProductStatus = "in Stock";
+$sc_order_status_default = "in Progress";
+$sc_item_Total_Weight = "item Total Weight";
+#:#:#: end ORDERMANAGER settings
 #:#:#: start PGP settings
 $sc_use_pgp = "[% use_pgp %]";
 $sc_pgp_change_newline = "";
 $sc_pgp_or_gpg = "PGP";
 $sc_pgp_or_gpg_path = "[% pgp_path %]";
-$sc_pgp_order_email = '[% email %]';
+$sc_pgp_order_email = "[% email %]";
 #:#:#: end PGP settings
 #:#:#: start SHIPPING settings
 $sc_calculate_shipping_loop = "3";
-$sc_handling_charge = "2.00";
-$sc_add_handling_cost_if_shipping_is_zero = 'no';
-$sc_use_custom_shipping_logic = "no";
-$sc_custom_shipping_logic = qq`# In this example Shipping Cost is based on the total order.
-# \$1-\$29.99 is 10%, \$30-\$59.99 is 7.5%, etc. (TURN OFF UPS!)
-# Code does not force exit, so handling charge will be added!
-\@sc_shipping_logic = ( \"|1-29.99|||10.0%\",
-                       \"|30-59.99|||7.5%\",
-                       \"|60-89.99|||5.0%\",
-                       \"|90-119.99|||2.5%\",
-                       \"|120-|||0.00\");
-#
-\$shipping_price = &calculate_shipping(\$temp_total,
+$sc_handling_charge = "0";
+$sc_handling_charge_type = "Flat Rate";
+$sc_add_handling_cost_if_shipping_is_zero = "no";
+$sc_alt_origin_enabled = "yes";
+$sc_alt_origin_db_counter = "11";
+$sc_use_custom_shipping_logic = "yes";
+$sc_location_custom_shipping_logic = "before";
+$sc_use_SBW2 = "no";
+$sc_custom_shipping_logic = qq`\# In this example Shipping Cost is based on the total order.
+\# \$1-\$29.99 is 10\%, \$30-\$59.99 is 7.5\%, etc. (TURN OFF UPS!)
+\# Code does not force exit, so handling charge will be added!
+\@sc_shipping_logic = ( \"Electronic Delivery|1-|||2.00\",
+                       \"Local Delivery|1-|||100.00\",
+                       \"Pickup|1-|||0\"); 
+\#
+\$shipping_price = \&calculate_shipping(\$temp_total, 
                   \$total_quantity, \$total_measured_quantity);`;
-#
-$sc_use_SBW = "no"; # "yes";
-$sc_use_FEDEX = "yes";
+$sc_use_SBW = "yes";
+$sc_use_socket = "http-lib";
 $sc_use_UPS = "yes";
+$sc_UPS_max_wt = "15";
+$sc_ups_unitofmeasure = "LBS";
+$sc_Origin_City = "Provo";
+$sc_shipper_insurance_override = "no";
 $sc_use_USPS = "yes";
-$sc_use_socket = "http-lib";
-$sc_FEDEX_max_wt = "49";
-$sc_FEDEX_Origin_ZIP = "19022";
-$sc_UPS_max_wt = "0";
-$sc_UPS_Origin_ZIP = "19022";
-$sc_UPS_RateChart = "Regular Daily Pickup";
-$sc_USPS_max_wt = "49";
-$sc_USPS_Origin_ZIP = "19022";
+$sc_USPS_max_wt = "15";
+$sc_USPS_Origin_ZIP = "84606";
 $sc_USPS_use_API = "";
-$sc_USPS_userid = "uspsuserid";
-$sc_USPS_password = "uspspass";
+$sc_USPS_userid = "";
+$sc_USPS_password = "";
 $sc_USPS_host_URL = "http://production.shippingapis.com/ShippingAPI.dll";
 #:#:#: end SHIPPING settings
 #:#:#: start TAX settings
+$sc_non_taxables_enabled = "yes";
+$sc_non_taxables_db_counter = "";
+$sc_non_taxables_db_counter2 = "";
 $mc_tax_logic_rows = "3";
 $sc_sales_tax = ".043";
 $sc_sales_tax_state = "CO";
@@ -235,11 +278,24 @@
 $sc_extra_tax3_name = "";
 $sc_extra_tax1_logic = qq`\$sc_city_tax_variable = \"Ecom_ShipTo_Postal_City\";
 \$city_variable = \$form_data{\$sc_city_tax_variable};
-if (\$city_variable =~ /Louisville/i) { # replace city name with yours
-\$city_tax = (\$subtotal *0.14525);  # replace decimal values with your tax amount
+if (\$city_variable =~ /Louisville/i) { \# replace city name with yours
+\$city_tax = (\$subtotal *0.14525);  \# replace decimal values with your tax amount
                  }`;
 $sc_extra_tax2_logic = qq``;
 $sc_extra_tax3_logic = qq``;
 #:#:#: end TAX settings
+#:#:#: start TEMPLATE settings
+$sc_headerTemplateName = "TheAgora/TheAgora_BluGreen";
+$sc_headerTemplateRoot = "TheAgora";
+$sc_buttonSetName = "TheAgora_BluGreen";
+$sc_buttonSetURL = "html/images/buttonsets/TheAgora_BluGreen";
+$sc_displayDynamicCategories = "yes";
+$sc_headerStoreTitle = "Powered by AgoraCart version 5.0.000";
+$sc_headerStoreTagLine = "Thanks for Visiting our Store!";
+$sc_store_header_file = "./html/html-templates/templates/TheAgora/store_header.html";
+$sc_store_footer_file = "./html/html-templates/templates/TheAgora/store_footer.html";
+$sc_secure_store_header_file = "./html/html-templates/templates/TheAgora/secure_store_header.html";
+$sc_secure_store_footer_file = "./html/html-templates/templates/TheAgora/secure_store_footer.html";
+#:#:#: end TEMPLATE settings
 #
 1;
diff -ruN 4.0K-4b/admin_files/agora_userlog_lib.pl 5.0.000/admin_files/agora_userlog_lib.pl
--- 4.0K-4b/admin_files/agora_userlog_lib.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/admin_files/agora_userlog_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+$sc_shall_i_log_accesses = "no";
diff -ruN 4.0K-4b/admin_files/iTransact-user_lib.pl 5.0.000/admin_files/iTransact-user_lib.pl
--- 4.0K-4b/admin_files/iTransact-user_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/admin_files/iTransact-user_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,12 +1,35 @@
-$sc_gateway_username = "18180";
-$sc_order_script_url = "https://secure.itransact.com/cgi-bin/mas/split.cgi";
+$sc_gateway_username = "iTransact ID here";
+$sc_order_script_url = "https://secure.paymentclearing.com/cgi-bin/mas/split.cgi";
 $mername = "My Company Name";
+$merchant_live_mode = "yes";
+$sc_itransact_submit = 'agora.cgi?secpicserve=submit_order.gif';
+$sc_itransact_change = 'agora.cgi?secpicserve=make_changes.gif';
+$sc_itransact_verify_message = "Please verify the information below.  When you are confident it is correct, click on the \'Submit Order For Processing\' button to go to the secure iTransact site where you will enter the remainder of your payment information.";
+$sc_itransact_order_desc = "iTransact - AgoraCart Online Order";
+$sc_display_checkout_tos = "no";
+$sc_tos_display_address = qq'AgoraCart<br>
+123 Main<br>
+Salt Lick City, UT 88888<br>
+123-456-7890';
+$sc_itransact_top_message = "top message";
+$iTransact_order_ok_final_msg_tbl = "";
+$iTransact_merch_message = "<br> Thank you for using AgoraCart";
+$iTransact_enablebodytags = "1";
+$iTransact_bodyback = "white";
+$iTransact_fontcolor = "black";
+$iTransact_linkcolor = "\#0000FF";
+$iTransact_backimage_URL = "";
+$iTransact_Logo_URL = "";
 $acceptcards = "1";
-$acceptchecks = "1";
+$acceptvisa = "1";
+$acceptmastercard = "1";
+$acceptdiscover = "1";
+$acceptamex = "0";
+$acceptdiners = "0";
+$acceptchecks = "0";
 $accepteft = "0";
-$altaddr = "1";
+$altaddr = "0";
 $email_text = "<!--agorascript-pre
   return \$iTransact_prod_in_cart;
 -->";
-$merchant_live_mode = "no";
 1;
diff -ruN 4.0K-4b/admin_files/mgrinvoiceTemplate.html 5.0.000/admin_files/mgrinvoiceTemplate.html
--- 4.0K-4b/admin_files/mgrinvoiceTemplate.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/admin_files/mgrinvoiceTemplate.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,157 @@
+<HTML>
+<head>
+<TITLE> %%month%% %%year%% Invoice: %%invoiceNumber%% - %%customerNumber%%</TITLE>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta name="copyright" content="%%year%%">
+<meta name="author" content="AgoraCart">
+<meta name="publisher" content="K-Factor Technologies,Inc.">
+</head>
+<BODY bgcolor="#FFFFFF" text="#000000" alink="#FF0000" vlink="#FF00FF" link="#0000FF">
+<!--
+Available Tokens:
+%%year%%
+%%day%%
+%%month%%
+%%invoiceNumber%%
+%%customerNumber%%
+%%orderStatus%%
+%%shiptrackingID%%
+%%firstName%%
+%%lastName%%
+%%fullName%%
+%%companyName%%
+%%customerPhone%%
+%%faxNumber%%
+%%emailAddress%%
+%%orderFromAddress%%
+%%customerAddress2%%
+%%customerAddress3%%
+%%orderFromCity%%
+%%orderFromState%%
+%%orderFromPostal%%
+%%orderFromCountry%%
+%%shipToName%%
+%%shipToAddress%%
+%%shipToAddress2%%
+%%shipToAddress3%%
+%%shipToCity%%
+%%shipToState%%
+%%shipToPostal%%
+%%shipToCountry%%
+%%shipMethod%%
+%%shippingTotal%%
+%%shipToInsured%%
+%%shipToResidential%%
+%%salesTax%%
+%%tax1%%
+%%tax2%%
+%%tax3%%
+%%discounts%%
+%%subTotal%%
+%%orderTotal%%
+%%user1%%
+%%user2%%
+%%user3%%
+%%user4%%
+%%user5%%
+%%adminMessages%%
+%%GatewayUsed%%
+%%cartContents%%
+%%money_symbol%%
+%%shippingMessages%%
+%%xcomments%%
+%%termsOfService%%
+-->
+<table width=100% border=0 cellpadding=0 cellspacing=0><tr><td>
+<center><font face=arial size=+3 color=red><b>Invoice&nbsp;&nbsp;&nbsp;</b> </font></center>
+<font face=arial size=+2 color=red>AgoraCart.com</font><br>
+<font face=arial size=1>your company address<br>City, State, Postalcode<br>Phone: 800-123-4567<br>Email_address@SomeDomainNameHere.com</font><br>
+<br>
+<table width=98% border=1 cellpadding=10 cellspacing=0>
+<tr bgcolor=#99CC99>
+<td valign=top width=50%>
+<font face=arial size=1>
+<b>Bill To:</b>
+</font>
+</td>
+<td valign=top width=50%>
+<font face=arial size=1>
+<b>Ship To:</b>
+</font>
+</td></tr>
+<tr>
+<td valign=top width=50%>
+<font face=arial size=1><b>
+%%fullName%%<br>
+%%orderFromAddress%%<br>
+<!--%%companyName%%<br>-->
+%%orderFromCity%%, %%orderFromState%%<br>
+%%orderFromPostal%%<br>
+%%orderFromCountry%%<br><br>
+%%customerPhone%%<br>
+%%emailAddress%%<br>
+</b>
+</font>
+</td>
+<td valign=top>
+<font face=arial size=1><b>
+%%shipToName%%<br>
+%%shipToAddress%%<br>
+%%shipToCity%%, %%shipToState%%<br>
+%%shipToPostal%%<br>
+%%shipToCountry%%<br><br>
+</b>
+</font>
+</td></tr>
+<tr bgcolor=#99CC99>
+<td colspan=2 valign=top width=100%>
+<font face=arial size=2>
+<b>Order: %%invoiceNumber%% - %%customerNumber%%</b>
+</font>
+</td></tr>
+<tr>
+<td valign=top width=50%>
+<font face=arial size=1>
+<b>Date of Order:</b> %%month%% %%day%%, %%year%%<br>
+<b>Status of Order:</b> %%orderStatus%%<br><br>
+<b>Invoice Number:</b> %%invoiceNumber%%<br>
+<b>Customer ID:</b> %%customerNumber%%<br>
+<b>Processed Via:</b> %%GatewayUsed%%<br><br>
+<b>Ship via:</b> %%shipMethod%%<br>
+<b>Residential?</b> %%shipToResidential%%<br>
+<b>Insure?</b> %%shipToInsured%%<br>
+<b>Tracking ID (if any):</b> %%shiptrackingID%%<br>
+</font>
+</td>
+<td valign=top width=50%>
+<table width=80% border=0 cellpadding=0>
+<tr><td align=right><font face=arial size=1>Order Subtotal:</font></td><td align=right><font face=arial size=1>%%money_symbol%% %%subTotal%%</font></td></tr>
+<tr><td align=right><font face=arial size=1>Discounts Given:</font></td><td align=right><font face=arial size=1>%%money_symbol%% %%discounts%%</font></td></tr>
+<tr><td align=right><font face=arial size=1>Sales Tax:</font></td><td align=right><font face=arial size=1>%%money_symbol%% %%salesTax%%</font></td></tr>
+<tr><td align=right><font face=arial size=1>Tax 1:</font></td><td align=right><font face=arial size=1>%%money_symbol%% %%tax1%%</font></td></tr>
+<tr><td align=right><font face=arial size=1>Tax 2:</font></td><td align=right><font face=arial size=1>%%money_symbol%% %%tax2%%</font></td></tr>
+<tr><td align=right><font face=arial size=1>Tax 3:</font></td><td align=right><font face=arial size=1>%%money_symbol%% %%tax3%%</font></td></tr>
+<tr><td align=right><font face=arial size=1>Shipping:</font></td><td align=right><font face=arial size=1>%%money_symbol%% %%shippingTotal%%</font></td></tr>
+<tr><td align=right><font face=arial size=2><b>Grand Total:</b></font></td><td align=right><font face=arial size=2><b>%%money_symbol%% %%orderTotal%%</b></font></td></tr>
+</table>
+</td></tr>
+<tr bgcolor=#99CC99>
+<td colspan=2 valign=top><center><font face=arial size=2><b>Product Information</b></font></center></td></tr>
+<tr>
+<td colspan=2 valign=top>
+<table width=100% border=0 cellpadding=0 cellspacing=0>
+<td valign=top width=75%><font face=arial size=1><br><b>Product Name</b></font></td>
+<td valign=top width=10%><font face=arial size=1><br><b>Quantity</b></font></td>
+<td valign=top width=15%><font face=arial size=1><br><b>Total Price Each</b></font></td></tr>
+%%cartContents%%
+</table>
+</td></tr>
+<tr bgcolor=#99CC99>
+<td colspan=2 valign=top><center><font face=arial size=2><b>Messages</b></font></center></td></tr>
+<tr>
+<td colspan=2 valign=top><center><font face=arial size=1>%%xcomments%%</font></center></td></tr>
+</table>
+</td></tr>
+</table>
+</BODY>
+</HTML>
\ No newline at end of file
diff -ruN 4.0K-4b/admin_files/mgrpackingslipTemplate.html 5.0.000/admin_files/mgrpackingslipTemplate.html
--- 4.0K-4b/admin_files/mgrpackingslipTemplate.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/admin_files/mgrpackingslipTemplate.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,152 @@
+<HTML>
+<head>
+<TITLE> %%month%% %%year%% Packing Slip for Order: %%invoiceNumber%% - %%customerNumber%%</TITLE>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta name="copyright" content="%%year%%">
+<meta name="author" content="AgoraCart">
+<meta name="publisher" content="K-Factor Technologies,Inc.">
+</head>
+<BODY bgcolor="#FFFFFF" text="#000000" alink="#FF0000" vlink="#FF00FF" link="#0000FF">
+<!--
+Available Tokens:
+%%year%%
+%%day%%
+%%month%%
+%%invoiceNumber%%
+%%customerNumber%%
+%%orderStatus%%
+%%shiptrackingID%%
+%%firstName%%
+%%lastName%%
+%%fullName%%
+%%companyName%%
+%%customerPhone%%
+%%faxNumber%%
+%%emailAddress%%
+%%orderFromAddress%%
+%%customerAddress2%%
+%%customerAddress3%%
+%%orderFromCity%%
+%%orderFromState%%
+%%orderFromPostal%%
+%%orderFromCountry%%
+%%shipToName%%
+%%shipToAddress%%
+%%shipToAddress2%%
+%%shipToAddress3%%
+%%shipToCity%%
+%%shipToState%%
+%%shipToPostal%%
+%%shipToCountry%%
+%%shipMethod%%
+%%shippingTotal%%
+%%shipToInsured%%
+%%shipToResidential%%
+%%salesTax%%
+%%tax1%%
+%%tax2%%
+%%tax3%%
+%%discounts%%
+%%subTotal%%
+%%orderTotal%%
+%%user1%%
+%%user2%%
+%%user3%%
+%%user4%%
+%%user5%%
+%%adminMessages%%
+%%GatewayUsed%%
+%%cartContents%%
+%%money_symbol%%
+%%shippingMessages%%
+%%xcomments%%
+%%termsOfService%%
+-->
+<table width=100% border=0 cellpadding=0 cellspacing=0><tr><td>
+<center><font face=arial size=+3 color=red><b>Packing Slip&nbsp;&nbsp;&nbsp;</b> </font></center>
+<font face=arial size=+2 color=red>AgoraCart.com</font><br>
+<font face=arial size=1>your company address<br>City, State, Postalcode<br>Phone: 800-123-4567<br>Email_address@SomeDomainNameHere.com</font><br>
+<br>
+<table width=98% border=1 cellpadding=10 cellspacing=0>
+<tr bgcolor=#99CC99>
+<td valign=top width=50%>
+<font face=arial size=2>
+<b>Bill To:</b>
+</font>
+</td>
+<td valign=top width=50%>
+<font face=arial size=2>
+<b>Ship To:</b>
+</font>
+</td></tr>
+<tr>
+<td valign=top width=50%>
+<font face=arial size=2><b>
+%%fullName%%<br>
+<!--%%companyName%%<br>-->
+%%orderFromAddress%%<br>
+%%orderFromCity%%, %%orderFromState%%<br>
+%%orderFromPostal%%<br>
+%%orderFromCountry%%<br><br>
+%%customerPhone%%<br>
+%%emailAddress%%<br>
+</b>
+</font>
+</td>
+<td valign=top>
+<font face=arial size=2><b>
+%%shipToName%%<br>
+%%shipToAddress%%<br>
+%%shipToCity%%, %%shipToState%%<br>
+%%shipToPostal%%<br>
+%%shipToCountry%%<br><br>
+</b>
+</font>
+</td></tr>
+<tr bgcolor=#99CC99>
+<td colspan=2 valign=top width=100%>
+<font face=arial size=2>
+<b>Order: %%invoiceNumber%% - %%customerNumber%%</b>
+</font>
+</td></tr>
+<tr>
+<td valign=top width=50%>
+<font face=arial size=1>
+<b>Date of Order:</b> %%month%% %%day%%, %%year%%<br>
+<b>Invoice Number:</b> %%invoiceNumber%%<br>
+<b>Customer ID:</b> %%customerNumber%%<br>
+</font>
+</td>
+<td valign=top width=50%>
+<font face=arial size=1>
+<b>Status of Order:</b> %%orderStatus%%<br><br>
+<b>Ship via:</b> %%shipMethod%%<br>
+<b>Residential?</b> %%shipToResidential%%<br>
+<b>Insure?</b> %%shipToInsured%%<br>
+<b>Tracking ID (if any):</b> %%shiptrackingID%%<br>
+</font>
+</td></tr>
+<tr bgcolor=#99CC99>
+<td colspan=2 valign=top><center><font face=arial size=2><b>Product Information</b></font></center></td></tr>
+<tr>
+<td colspan=2 valign=top>
+<table width=100% border=0 cellpadding=0 cellspacing=0>
+<td valign=top width=75%><font face=arial size=1><br><b>Product Name</b></font></td>
+<td valign=top width=10%><font face=arial size=1><br><b>Quantity</b></font></td>
+<td valign=top width=15%><font face=arial size=1><br><b>Total Price Each</b></font></td></tr>
+%%cartContents%%
+</table>
+</td></tr>
+<tr bgcolor=#99CC99>
+<td colspan=2 valign=top><center><font face=arial size=2><b>Messages</b></font></center></td></tr>
+<tr>
+<td colspan=2 valign=top><center><font face=arial size=1>%%xcomments%%</font></center></td></tr>
+<tr bgcolor=#99CC99>
+<td colspan=2 valign=top><center><font face=arial size=2><b>Packing Instructions / Messages</b></font></center></td></tr>
+<tr>
+<td colspan=2 valign=top><font face=arial size=1>%%shippingMessages%%</font></td></tr>
+</table>
+</td></tr>
+</table>
+</BODY>
+</HTML>
\ No newline at end of file
diff -ruN 4.0K-4b/admin_files/zOffline-user_lib.pl 5.0.000/admin_files/zOffline-user_lib.pl
--- 4.0K-4b/admin_files/zOffline-user_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/admin_files/zOffline-user_lib.pl	1969-12-31 18:00:00.000000000 -0600
@@ -1,7 +0,0 @@
-$sc_order_script_url = "http://www.agoracart.com/cgi-bin/store/agora.cgi";
-$sc_zOffline_CC_validation = "yes";
-$sc_allow_pay_by_check = "yes";
-$sc_allow_pay_by_PO = "yes";
-$sc_allow_pay_by_CC = "yes";
-$sc_zOffline_show_table = "yes";
-1;
diff -ruN 4.0K-4b/agora.cgi 5.0.000/agora.cgi
--- 4.0K-4b/agora.cgi	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/agora.cgi	2006-10-31 09:40:27.000000000 -0600
@@ -1,9 +1,6 @@
 #!/usr/bin/perl -T
 
-$versions{'agora.cgi'} = "4.0K-4b Standard" . $ENV{"AGORAWRAP"};
-$versions{'perl'} = "$]";
-$versions{'OSNAME'} = "$^O";
-$versions{'server'} = $ENV{'SERVER_SOFTWARE'} if $ENV{'SERVER_SOFTWARE'};
+$versions{'agora.cgi'} = "5.0.000";
 
 # Version history is available at... 
 # http://www.agoracart.com/
@@ -11,8 +8,9 @@
 # AgoraCart is based on Selena Sol's freeware 'Web Store' 
 # available at http://www.extropia.com with many modifications 
 # made independently by Carey Internet Services before splitting 
-# off and becoming this package known as AgoraCart (aka agora.cgi).
-# The package distributed here is Copyright 2002-2003 by K-Factor
+# off and becoming this package known as Agora.cgi, now known as
+# AgoraCart since August 2002.
+# The package distributed here is Copyright 2001 to Present by K-Factor
 # Technologies, Inc. at AgoraCart.com with additional Copyrights 1999-2001
 # by Steven P. Kneizys and is distributed free of charge
 # consistent with the GNU General Public License Version 2
@@ -35,12 +33,12 @@
 # removed or altered in any way.
 #
 
+BEGIN { use lib "library/additions"; push(@INC,"library/additions"); }
 $| = 1;
 $ENV{"PATH"} = "/bin:/usr/bin";
 $test=`whoami`;
 $versions{'whoami'} = $test if $test;
 $versions{'id'} = `id`;
-
 if ((-f "./wrap_agc.o") && (!($ARGV[0] =~ /nowrap/i))) { # use wrapper
   $ENV{"AGORAWRAP"}="*";
   print `./wrap_agc.o`;
@@ -49,82 +47,55 @@
 
 $time = time;
 $main_program_running = "yes";
-push(@INC,"./library/additions");
 &require_supporting_libraries (__FILE__, __LINE__,
-		"./admin_files/agora_user_lib.pl",
-		"./library/cgi-lib.pl");
-
+    "./admin_files/agora_user_lib.pl",
+    "./library/MD5.pl",
+    "./library/cgi-lib.pl",
+    "./library/agora_html_lib.pl");  # added by Mister Ed for mySQL testing.  fixes other thingies too.
 &read_and_parse_form_data;
-
 &require_supporting_libraries (__FILE__, __LINE__,
-		"./library/agora.setup.db");
+    "./library/agora.setup.db");
 &codehook("after_loading_setup_db");
-
 &require_supporting_libraries (__FILE__, __LINE__,
-		"./admin_files/$sc_gateway_name-user_lib.pl",
-		"$sc_html_setup_file_path", 
-		"$sc_cookie_lib");
-
+    "./admin_files/$sc_gateway_name-user_lib.pl",
+    "$sc_html_setup_file_path", 
+    "$sc_cookie_lib");
 $sc_loading_primary_gateway = "yes";
 &require_supporting_libraries(__FILE__,__LINE__,"$sc_process_order_lib_path");
 $sc_loading_primary_gateway = "no";
 
+# added by Mister Ed July 11, 2006
+$sc_special_checkout_variable1 = ''; # reserved, do not use if using random key generation
+$sc_special_checkout_variable2 = '';
+$sc_special_checkout_variable3 = '';
+$sc_special_misc_variable1 = '';
+$sc_special_misc_variable2 = '';
+$sc_special_misc_variable3 = '';
 &codehook("before_loading_custom_libs");
-opendir (USER_LIBS, "./custom") || &codehook("cannot-open-custom-dir");
+opendir (USER_LIBS, "./add_ons") || &codehook("cannot-open-custom-dir");
 @mylibs = sort(readdir(USER_LIBS));
 closedir (USER_LIBS);
-
 foreach $zlib (@mylibs) {
   $lib = $zlib;
   $lib =~ /([\w\-\=\+]+)(\.pl)/i;
   $zfile = "$1$2";
   $zlib =~ /([^\n|;]+)/;
   $lib = $1;
-  if ((-f "./custom/$lib") && ($lib eq $zfile)) {
-    &require_supporting_libraries(__FILE__, __LINE__,"./custom/$lib");
+  if ((-f "./add_ons/$lib") && ($lib eq $zfile)) {
+    &require_supporting_libraries(__FILE__, __LINE__,"./add_ons/$lib");
    }
  }
 &codehook("after_loading_custom_libs");
-
-&get_cookie;
-&alias_and_override;
-&error_check_form_data;
-$cart_id = $form_data{'cart_id'};
-
-if ($cookie{'cart_id'} eq "" && $form_data{'cart_id'} eq "") {
-  &delete_old_carts;
-  &assign_a_unique_shopping_cart_id;
-  $cart_id_history .= "set new cart value "; 
-  &codehook("got_a_new_cart");
- } else {
-  if ($form_data{'cart_id'} eq "") {
-    $cart_id = $cookie{'cart_id'};
-    $cart_id_history .= "from cookie "; 
-    &set_sc_cart_path;
-   } else {
-    $cart_id = $form_data{'cart_id'};
-    $cart_id_history .= "set from form data "; 
-    &set_sc_cart_path;
-   }
- }
-
-&codehook("pre_header_navigation");
-print $sc_browser_header;
-$sc_header_printed = 1;
-
-#print "cart_id: $cart_id $cart_id_for_html $cart_id_history<br>\n";
-$are_any_query_fields_filled_in = "no";
+&agora_starter_section;
 &codehook("open_for_business");
 foreach $query_field (@sc_db_query_criteria)
 {
 @criteria = split(/\|/, $query_field);
-
-	if ($form_data{$criteria[0]} ne "")
-	{
-	$are_any_query_fields_filled_in = "yes";
-	}
+  if ($form_data{$criteria[0]} ne "")
+  {
+  $are_any_query_fields_filled_in = "yes";
+  }
 }
-
 if (($search_request ne "") && ($are_any_query_fields_filled_in eq "no")) {
   $page = "searchpage.html"; 
   $search_request = "";
@@ -136,76 +107,53 @@
     $form_data{'page'} = $page; 
    }
  }
-
 &codehook("special_navigation");
-
 if (&form_check('display_cart')) 
 {
 &load_order_lib;
 &display_cart_contents;
 &call_exit;
 }
-
 if (&form_check('add_to_cart_button'))
 {
 &load_order_lib;
 &add_to_the_cart;
 &call_exit;
 }
-
 elsif (&form_check('modify_cart_button'))
 {
 &load_order_lib;
 &display_cart_contents;
 &call_exit;
 }
-
 elsif (&form_check('change_quantity_button'))
 {
 &load_order_lib;
 &output_modify_quantity_form;
 &call_exit;
-}
-
-elsif (&form_check('submit_change_quantity_button'))
-{
+} elsif (&form_check('submit_change_quantity_button')) {
 &load_order_lib;
 &modify_quantity_of_items_in_cart;
 &call_exit;
-}
-
-elsif (&form_check('delete_item_button'))
-{
+} elsif (&form_check('delete_item_button')) {
 &load_order_lib;
 &output_delete_item_form;
 &call_exit;
-}
-
-elsif (&form_check('submit_deletion_button'))
-{   
+} elsif (&form_check('submit_deletion_button')) {   
 &load_order_lib;
 &delete_from_cart;
 &call_exit;
-}
-
-elsif (&form_check('order_form_button'))
-{
+} elsif (&form_check('order_form_button')) {
 &load_order_lib;
 &display_order_form;
 &call_exit;
-}
-
-elsif (&form_check('clear_order_form_button'))
-{
+} elsif (&form_check('clear_order_form_button')) {
 &load_order_lib;
 &clear_verify_file;
 &codehook("display_cleared_order_form");
 &display_order_form;
 &call_exit;
-}
-
-elsif (&form_check('submit_order_form_button')) 
-{
+} elsif (&form_check('submit_order_form_button')) {
 &load_order_lib;
 if ($sc_test_repeat) {
   &display_order_form;
@@ -213,32 +161,22 @@
   &process_order_form;
  }
 &call_exit;
-}
-
-elsif (($page ne "" || $search_request ne ""
-		    || &form_check('continue_shopping_button')
-		    || $are_any_query_fields_filled_in =~ /yes/i) &&
-	($form_data{'return_to_frontpage_button'} eq "")) 
-
-{
+} elsif (($page ne "" || $search_request ne ""
+        || &form_check('continue_shopping_button')
+        || $are_any_query_fields_filled_in =~ /yes/i) &&
+  ($form_data{'return_to_frontpage_button'} eq "")) {
 &display_products_for_sale;
 &call_exit;
 }
-
-$sc_processing_order="yes"; 
+$sc_processing_order="yes";
 &codehook("gateway_response");
 $sc_processing_order="no"; 
-
 &output_frontpage;
 &call_exit;
-
 #########################################################################
 sub load_order_lib{
   &codehook("load_order_lib_before");
-  &require_supporting_libraries (
-	__FILE__, 
-	__LINE__, 
-	"$sc_order_lib_path"); 
+&require_supporting_libraries(__FILE__,__LINE__,"$sc_order_lib_path");
   &codehook("load_order_lib_after");
  }
 #########################################################################
@@ -253,8 +191,28 @@
    } 
  }
 #######################################################################
+    # require_supporting_libraries is used to read in some of
+    # the supporting files that this script will take
+    # advantage of.
+    #
+    # require_supporting_libraries takes a list of arguments
+    # beginning with the current filename, the current line
+    # number and continuing with the list of files which must
+    # be required using the following syntax:
+    #
+    # &require_supporting_libraries (__FILE__, __LINE__,
+    #                               "file1", "file2",
+    #                               "file3"...);
+    #
+    # Note: __FILE__ and __LINE__ are special Perl variables
+    # which contain the current filename and line number
+    # respectively.  We'll continually use these two variables
+    # throughout the rest of this script in order to generate
+    # useful error messages.
+
 sub require_supporting_libraries
 {
+    # The libraries are required by us,so exit if loading error
 local ($file, $line, @require_files) = @_;
 local ($require_file);
 &request_supporting_libraries("warn exit",$file, $line, @require_files);
@@ -262,14 +220,12 @@
 
 sub request_supporting_libraries
 {
-
 local ($what_to_do_on_error, $file, $line, @require_files) = @_;
 local ($require_file);
-
 foreach $require_file (@require_files)
 {
 if (-e "$require_file" && -r "$require_file")
-{ 
+{ # file is there, now try to require it
 $result = eval('require "$require_file"'); 
 if ($@ ne "") {
  if($what_to_do_on_error =~ /warn/i) {
@@ -287,11 +243,7 @@
    &call_exit;
   }
  }
-}
-
-else
-{
-
+} else {
  if($what_to_do_on_error =~ /warn/i) {
   if ($error_header_done ne "yes") {
      $error_header_done = "yes";
@@ -302,23 +254,29 @@
 path correct and that the permissions are set so that I have
 read access?  Thank you.&nbsp; \($ENV{'SERVER_ADMIN'}\)<br>\n";
   }
-
  if($what_to_do_on_error =~ /exit/i) {
    &call_exit;
   }
 }
-
 } 
 } 
-
 #######################################################################
-sub read_and_parse_form_data
+    # read_and_parse_form_data is a short subroutine 
+    # responsible for calling the ReadParse subroutine in
+    # cgi-lib.pl to parse the incoming form data.  The script 
+    # also tells cgi-lib to prepare that information in the
+    # associative array named %form_data which we will be able
+    # to use for the rest of this script.
+    #
+    # read_and_parse_form_data takes no arguments and is
+    # called with the following syntax:
+    #
+    # &read_and_parse_form_data;
 
+sub read_and_parse_form_data
 {
 local ($junk);
-
 &ReadParse(*form_data);
-
 if ($form_data{'picserve'} ne "") {
   &serve_picture($form_data{'picserve'},$sc_path_of_images_directory);
   &call_exit;
@@ -327,33 +285,33 @@
   &serve_picture($form_data{'secpicserve'},"./protected/images/");
   &call_exit;
  }
-
 }
 #########################################################################
+#
 # Writen by Steve K to serve images 04-FEB-2000
+# HTML usage examples:
+# <IMG SRC="xxx.cgi?picserve=/images/store.jpg" BORDER=0>
+# <IMG SRC="xxx.cgi?picserve=http://www.site.com/images/store.jpg" BORDER=0>
+#
 # Note: using the http:// format is less efficient
 # converted to taint-mode sub 2/5/2000
 
 sub serve_picture {
-
  local ($qstr,$sc_path_of_images_directory) = @_;
  local ($test, $test2, $my_path_to_image);
-
  $qstr =~ /([\w\-\=\+\/\.\:]+)/;
  $qstr = "$1";
-
  $my_path_to_image = $sc_path_of_images_directory . $qstr ;
  $test = substr($my_path_to_image,0,6);
  $test2 = substr($my_path_to_image,(length($my_path_to_image)-3),3);
-
  if ($test2=~ /jpg/i || $test2 =~ /gif/i || $test2 =~ /png/i) {
   if ($test2=~ /jpg/i) {# .jpg is jpeg file
     $test2 = "jpeg";
    }
   if ($test=~ /http:\//i || $test =~ /https:/i) { 
-   } else { 
+   } else { # is a filename we can load up directly
     print "Content-type: image/$test2\n\n";
-    if (!(-f $my_path_to_image)) {
+    if (!(-f $my_path_to_image)) {# try adding another slash!
       $my_path_to_image = $sc_path_of_images_directory ."/" . $qstr ;
      }
     open (MYPIC,$my_path_to_image);
@@ -368,20 +326,99 @@
  }
 }
 #######################################################################
+sub pre_header_navigation {
+ local($temp,$inx,@things_to_delete,@form_keys,$form_name,$count);
+ local(@temp,$request,$actual);
+  if ($cart_id eq $my_cookie_cart_id) { 
+    &set_agora("BROWSER_COOKIES_ON","yes");
+   }
+  if ($sc_running_an_SSI_store =~ /yes/i) {
+    $test_for_forced_redirect = &get_agora("SSI_FORCE_REDIRECT");
+    &set_agora("SSI_FORCE_REDIRECT",'');
+    @form_keys = grep(/SSI_FORM_DATA/,&get_agora_names);
+    if ($sc_unique_cart_modifier eq '') {
+      $sc_unique_cart_modifier = &make_random_chars;
+     }
+    @form_keys = grep(/$sc_unique_cart_modifier/,@form_keys);
+    $form_name = $form_keys[0];
+    $temp = &get_agora("$form_name");
+    if ($temp ne '') {
+      %form_data = split(/\x01/,$temp);
+      &alias_and_override;
+      &error_check_form_data;
+     } else {
+      $count = &get_agora("SSI_FORM_COUNT");
+      $count = $count+1;
+      if ($count < 10 || $count > 99) {$count = "10";}
+      &set_agora("SSI_FORM_COUNT",$count);
+      @things_to_delete = grep(/SSI_FORM_DATA_${count}_/,&get_agora_names);
+      foreach $inx (@things_to_delete) {&set_agora($inx,'');}
+      ($request,$junk) = split(/\?/,$ENV{'REQUEST_URI'},2);
+      @temp = split(/\//,$request);
+      $request = pop(@temp);
+      ($request,$junk) = split(/\?/,$request,2);
+      @temp = split(/\//,$sc_store_url);
+      $actual = pop(@temp);
+      if ($request ne $actual && (!($sc_allow_forced_SSI_redirect =~ /no/))) {
+        if ($test_for_forced_redirect eq '') {
+          $form_data{'SSI'} = 1;
+          &set_agora("SSI_FORCE_REDIRECT",'1');
+         }
+       }
+      if (defined($form_data{'SSI'})) { 
+        $temp = '';
+        delete($form_data{'SSI'}); 
+        $sc_unique_cart_modifier = &make_random_chars; 
+        foreach $inx (keys %form_data) {
+          $temp .= "$inx\x01$form_data{$inx}\x01";
+         }
+        &set_agora("SSI_FORM_DATA_${count}_$sc_unique_cart_modifier",$temp);
+        $href = "$sc_store_url?cart_id=$cart_id";
+        $href .= "&crtmod=$sc_unique_cart_modifier";
+        $temp = $ENV{'SCRIPT_NAME'};
+        if ($temp =~ /nph-agora.cgi$/i) {
+          $SSI_redirect_message =  "HTTP/1.0 302 Found\n";
+          $SSI_redirect_message .= "$sc_cookie_information";
+          $SSI_redirect_message .= "Location: $href\n";
+         } else {
+$SSI_redirect_message = qq~$sc_doctype
+<html><head><title></title>
+<META HTTP-EQUIV=\"refresh\"CONTENT=\"0;url='$href'\">
+</head><BODY $standard_body_tag>&nbsp;</BODY></html>~;
+         }
+        &set_agora("SSI_REDIRECT_OK",'yes');
+        &add_codehook("cleanup_before_exit","print_SSI_redirect");
+        &call_exit;
+       }
+     }
+   }
+  &codehook("pre_header_navigation");
+ }
+#######################################################################
+sub print_SSI_redirect {
+  print $SSI_redirect_message,"\n";
+ }
+#######################################################################
+#                         Alias and Override
+#
+# This routine allows the use of aliases for switches, such as
+# using xm= instead of exact_match=
+#
+# Also, override certain setup variables under certain conditions
+#
+####################################################################### 
 sub alias_and_override { 
  local($item,$xx);
  local ($junk,$raw_text)="";
  local (@mylibs,$lib);
  local ($testval,$testval2,$found_response);
-
  &codehook("alias_and_override_top");
-
 &special_security_f3_01172004;
 
-if (($sc_gateway_name ne "iTransact") && ($sc_gateway_name ne "AgoraPay")) {
+if (($sc_gateway_name ne "iTransact") && ($sc_gateway_name ne "AgoraPay") && ($sc_gateway_name ne "NiftyPay")) {
  &special_security_f1_01242002;}
-
- if (defined($form_data{'versions'}) && ($sc_debug_mode ne "no")) {
+ 
+ if (defined($form_data{'versions'})) {
   print "Content-type: text/html\n\n";
   print "<HTML>\n<TITLE>VERSIONS</TITLE>\n<BODY BGCOLOR=WHITE>\n";
   print "<br><br>Info and Versions of loaded libraries:<br>\n";
@@ -391,8 +428,8 @@
     print "<tr><td>$junk </td><td>$versions{$junk}</td></tr>\n";
    }
   print "</table>\n";
-  $junk .= `$sc_grep -h "versions{'" ./custom/* |$sc_grep "}="`;
-  $junk .= `$sc_grep -h "versions{'" ./custom/* |$sc_grep "} ="`;
+  $junk .= `$sc_grep -h "versions{'" ./add_ons/* |$sc_grep "}="`;
+  $junk .= `$sc_grep -h "versions{'" ./add_ons/* |$sc_grep "} ="`;
   $junk .= `$sc_grep -h "versions{'" ./protected/* |$sc_grep "}="`;
   $junk .= `$sc_grep -h "versions{'" ./protected/* |$sc_grep "} ="`;
   $junk .= `$sc_grep -h "versions{'" ./protected/custom/* |$sc_grep "}="`;
@@ -402,7 +439,6 @@
   $junk =~s/\n/ /g;
   $junk =~ /([\w\-\=\+\/\;\{\}\'\ \.\"\$]+)/;
   $junk = $1;
-
   while ($junk ne "") {
     $result = $lib;
     ($junk1,$key,$junk) = split(/\'/,$junk,3);
@@ -412,8 +448,6 @@
      }
     ($junk1,$junk) = split(/versions/,$junk,2);
    }
-
-#  if ($@ eq "") {
     print "<br><br>info and Versions of loaded and unloaded libraries:<br>\n";
     print "<table border=1 cellpadding=2 cellspacing=2>\n";
     foreach $junk (sort(keys(%versions)))
@@ -421,17 +455,14 @@
       print "<tr><td>$junk </td><td>$versions{$junk}</td></tr>\n";
      }
     print "</table>\n";
-#   }
   print "</BODY>\n</HTML>\n";
   &call_exit;
  }
-
   if (defined($form_data{'cart_id'})) {
     ($form_data{'cart_id'},$junk) = split(/\*/,$form_data{'cart_id'},2);
     $sc_unique_cart_modifier_orig = $junk;
     $sc_unique_cart_modifier = substr($sc_unique_cart_modifier_orig,0,6);
    }
-
   $found_response = "";
   foreach $testval (keys %sc_order_response_vars) {
    $testval2 = $sc_order_response_vars{$testval};
@@ -448,7 +479,7 @@
       ($form_data{'submit_order_form_button.x'} eq "" ) &&
       ($form_data{'submit_order_form_button'} eq "" ) &&
       ($form_data{'order_form_button.x'} eq "" ) &&
-      ($form_data{'order_form_button'} eq "" )){ 
+      ($form_data{'order_form_button'} eq "" )){ #redrect them to standard URL
     if ($cookie{'cart_id'} ne "") {
       $cart_id = $cookie{'cart_id'};
      }
@@ -457,7 +488,7 @@
       ($cart_id,$junk) = split(/\*/,$cart_id,2);
      }
     $sc_cart_path = "$sc_user_carts_directory_path/${cart_id}_cart";
-    if (!(-f $sc_cart_path)){ 
+    if (!(-f $sc_cart_path)){ #no cart, forget the number
       $cart_id = "";
      }
     $href = "$sc_store_url";
@@ -467,10 +498,8 @@
     print "Location: $href\n\n";
     &call_exit;
    }
-
   $search_request = ($form_data{'search_request_button'} || 
                      $form_data{'search_request_button.x'});
-
   if (($form_data{'maxp'} > 0) && ($form_data{'maxp'} < 301)) {
     $sc_db_max_rows_returned = $form_data{'maxp'};
    }
@@ -512,18 +541,15 @@
   if (defined($form_data{'kovr'})) {
     $form_data{'keywords'} =  $form_data{'kovr'};
    }
-
  if (($form_data{'add_to_cart_button'} eq "") &&
      ($form_data{'add_to_cart_button.x'} ne "")) {
     $form_data{'add_to_cart_button'} = "1";
   }
-
  if ($form_data{'viewOrder'} eq "yes") {
   $sc_should_i_display_cart_after_purchase = "yes";
- } # else {
-#  $sc_should_i_display_cart_after_purchase = "no";
-# }
-
+ } else {
+  $sc_should_i_display_cart_after_purchase = "no";
+ }
 if (($sc_debug_mode =~ /yes/i) && ($sc_debug_track_cartid =~ /yes/i)) {
   if (($cookie{'cart_id'} ne "") && ($form_data{'cart_id'} ne "")) {
     $cart_id = $form_data{'cart_id'};
@@ -540,46 +566,61 @@
      }
    }
  }
-
  &special_security_f2_01242002;
-
  &codehook("alias_and_override_end");
-
 }
 #######################################################################
-sub error_check_form_data
-{
-
+    # error_check_form_data is responsible for checking to
+    # make sure that only authorized pages are viewable using
+    # this application. It takes no arguments and is called
+    # with the following syntax:
+    #
+    # &error_check_form_data;
+    #
+    # The routine simply checks to make sure that if
+    # the page variable extension is not one that is defined
+    # in the setup file as an appropriate extension like .html
+    # or .htm, or there is no page being requestd (ie: the
+    # store front is being displayed) it will send a warning
+    # to the user, append the error log, and exit.
+    #
+    # @acceptable_file_extensions_to_display is an array of
+    # acceptable file extensions defined in the setup file.
+    # To be more or less restrictive, just modify this list.
+    #
+    # Specifically, for each extension defined in the setup
+    # file, if the value of the page variable coming in from
+    # the form ($page) is like the extension (/$file_extension/) 
+    # or there is no value for page (eq ""), we will set
+    # $valid_extension equal to yes.  
+    
+sub error_check_form_data {
 $page = $form_data{'page'};
 $page =~ /([\w\-\=\+\/]+)\.(\w+)/;
 $page = "$1.$2";
 $page_extension = ".$2";
 $page = "" if ($page eq ".");
-$page =~ s/^\/+//; # Get rid of any residual / prefix
-$form_data{'page'} = $page; 
-
+$page =~ s/^\/+//; 
+$form_data{'page'} = $page;
 foreach $file_extension (@acceptable_file_extensions_to_display)
 {
-	if ($page_extension eq $file_extension || $page eq "")
-	{
-	$valid_extension = "yes";
-	}
+  if ($page_extension eq $file_extension || $page eq "")
+  {
+  $valid_extension = "yes";
+  }
 }
  if ($valid_extension ne "yes") {
   print "Content-type: text/html\n\n$sc_page_load_security_warning\n";
   &update_error_log("PAGE LOAD WARNING", __FILE__, __LINE__);
   &call_exit;
  }        
-
 $form_data{'page'} = $page; 
-
 if ($form_data{'page'} =~ /\.\.\//) {
   print "Content-type: text/html\n\nNo, you cannot go navigating";
   print " outside the html directory for pages, that is a security ";
   print " risk. Sorry!\n ";
   &call_exit;
  }
-
 if ($form_data{'cartlink'} ne "") {
 $cartlink = $form_data{'cartlink'};
 $cartlink =~ /([\w\-\=\+\/]+)\.(\w+)/;
@@ -588,22 +629,19 @@
 $cartlink = "" if ($cartlink eq ".");
 $cartlink =~ s/^\/+//; 
 $form_data{'cartlink'} = $cartlink;
-
 foreach $file_extension (@acceptable_file_extensions_to_display)
 {
-	if ($page_extension eq $file_extension || $cartlink eq "")
-	{
-	$valid_extension = "yes";
-	}
+  if ($page_extension eq $file_extension || $cartlink eq "")
+  {
+  $valid_extension = "yes";
+  }
 }
  if ($valid_extension ne "yes") {
   print "Content-type: text/html\n\n$sc_page_load_security_warning\n";
   &update_error_log("PAGE LOAD WARNING", __FILE__, __LINE__);
   &call_exit;
  }        
-
-$form_data{'cartlink'} = $cartlink;
-
+$form_data{'cartlink'} = $cartlink; 
 if ($form_data{'cartlink'} =~ /\.\.\//) {
   print "Content-type: text/html\n\nNo, you cannot go navigating";
   print " outside the html directory for pages, that is a security ";
@@ -611,7 +649,6 @@
   &call_exit;
  }
 }
-
 if ($form_data{'cart_id'} ne "") {
   if ($form_data{'cart_id'} =~ /^([\w\-\=\+\/]+)\.(\w+)/) {
     $temp = "$1.$2";
@@ -624,7 +661,6 @@
     $form_data{'cart_id'} = "";
    }
  }
-
 if ($cookie{'cart_id'} ne "") {
   if ($cookie{'cart_id'} =~ /(^[\w\-\=\+\/]+)\.(\w+)/) {
     $cookie{'cart_id'} = "$1.$2";
@@ -635,16 +671,30 @@
     $cookie{'cart_id'} = "";
    }
  }
-
 }
 #######################################################################
 sub special_security_f1_01242002 {
+
+# international latin enabled by Mister Ed June 27, 2006
+# ǌ؊ݟ
+#                                                                 
+
+# defaults for English: USA, Canada, Australia, Canada
+my $patternString = '[^ \$\w\-=\+\.\/,@#!_\\[\]\^\{\}\:&;|~\*\x00\(\)]+';
+my $patternString2 = '[ \$\w\-=\+\.\/,@#!_\\[\]\^\{\}\:&;|~\*\x00\(\)]+';
+
+if ($sc_use_international_latin_characters =~ /yes/i) {
+    $patternString = '[^ \$\w\-=\+\.\/,ǌ؊ݟ@#!_\\[\]\^\{\}\:&;|~\*\x00\(\)]+';
+    $patternString2 = '[ \$\w\-=\+\.\/,ǌ؊ݟ@#!_\\[\]\^\{\}\:&;|~\*\x00\(\)]+';
+}
+
+# prefilter everything for meta characters
  if (!($sc_debug_mode =~ /yes/i)) { delete($form_data{'versions'});}
  $form_data{'cart_id'} =~ s/</&lt;/g;
  $form_data{'cart_id'} =~ s/>/&gt;/g;
  for $xx (keys %form_data) { 
-   $form_data{$xx}=~s/([^ \$\w\-=\+\.\/,@#!_\\[\]\^\{\}\:&;|~\*\x00\(\)]+)//g;
-   if ($form_data{$xx}=~/([ \$\w\-=\+\.\/,@#!_\\[\]\^\{\}\:&;|~\*\x00\(\)]+)/){
+   $form_data{$xx}=~s/($patternString)//g;
+   if ($form_data{$xx}=~/($patternString2)/){
       $form_data{$xx} = $1;
     } else {
       $form_data{$xx} = '';
@@ -659,6 +709,7 @@
    }
  }
 
+# disallows submitting items in browser address bar
 sub special_security_f3_01172004 {
 if ($form_data{'option'} ne '') {
 $form_data{'add_to_cart_button'} = '';
@@ -668,67 +719,34 @@
 }
 }
 #######################################################################
-sub parse_options_to_verify{
-  local($orig_str) = @_;
-  local($str) = $orig_str;
-  local($name) = "";
-  local($nextname,$stuff,$parta,$partb,$val,@items);
-
-  while ($str =~ /(name)([ \n\r]*)(=)([ \n\r]*)([\"\'])([^\"\']*)([\"\'])/i) {
-    $nextname = $6;
-    $str =~ s/(name)([ \n\r]*)(=)([ \n\r]*)([\"\'])([^\"\']*)([\"\'])/%##%/i;
-    ($stuff,$str) = split(/%##%/,$str,2);
-    if ($name ne "") {
-     $items{$name} = $stuff;
-     }
-    $name = $nextname;
-   } 
-
-  if ($name ne "") {
-    $items{$name} = $str;
-   }
-
-  foreach $name (keys %items) {
-    $str = $items{$name};
-    while ($str =~ /(value)([ \n\r]*)(=)([ \n\r]*)([\"\'])([^\"\']*)([\"\'])/i) {
-      $val = $6;
-      ($parta,$partb) = split(/\|/,$val,2);
-      $item_opt_verify{$name . "|" . $parta} = $partb;
-      $str =~ s/(value)([ \n\r]*)(=)([ \n\r]*)([\"\'])([^\"\']*)([\"\'])//i;
-     }
-   }
-
- return $orig_str;
-
- }
-#######################################################################
 sub option_prep {
 local ($field,$option_location,$product_id)= @_;
 local ($very_first_part,$junk);
 local ($arg,$arg1,$arg2);
-
 $field = &agorascript($field,"optpre","$option_location",__FILE__,__LINE__);
-
 $field =~ s/%%PRODUCT_ID%%/$product_id/ig;
 $field =~ s/%%PRODUCTID%%/$product_id/ig;
 $field =~ s/%%prodID%%/$product_id/ig;
-
 $field = &agorascript($field,"optpost","$option_location",__FILE__,__LINE__);
-# if ($chop =~ /yes/i) {
    ($very_first_part,$field,$junk) =  
-	split(/<h3>--cut here--<\/h3>/i,$field,3);
+  split(/<h3>--cut here--<\/h3>/i,$field,3);
    if ($field eq "") {
      $field = $very_first_part;
     }
    if ($field eq "") {
      $field = "(file $option_location not found)";
     }
-#  }
-
  return $field;
-
 }
 #######################################################################
+    # delete_old_carts is a subroutine which is used to prune
+    # the carts directory, cleaning out all the old carts
+    # after some time interval defined in the setup file.  It
+    # takes no argumnetes and is called with the following
+    # syntax:
+    #
+    # &delete_old_carts;
+
 sub check_cart_expiry {
   &check_cart_type_file_expiry("$sc_cart_path");
   &check_cart_type_file_expiry("$sc_verify_order_path");
@@ -751,95 +769,112 @@
 sub delete_old_carts
 {
 
+    # The subroutine begins by grabbing a listing of all of
+    # the client created shoppping carts in the User_carts
+    # directory.
+    #
+    # It then opens the directory and reads the contents using
+    # grep to grab every file with the extension _cart. Then
+    # it closes the directory.  
+    #
+    # If the script has any trouble opening the directory,
+    # it will output an error message using the
+    # file_open_error subroutine discussed later.  To the
+    # subroutine, it will pass the name of the file which had
+    # trouble, as well as the current routine in the script
+    # having trouble , the filename and the current line
+    # number.
+
 opendir (USER_CARTS, "$sc_user_carts_directory_path") || &file_open_error("$sc_user_carts_directory_path", "Delete Old Carts", __FILE__, __LINE__);
-@carts = grep(/\.[0-9]/,readdir(USER_CARTS));
+@carts = grep(/\.[0-9]/,readdir(USER_CARTS)); # must have . followed by digits
 closedir (USER_CARTS);
-
 foreach $cart (@carts)
 {
 $sc_cart_path = "$sc_user_carts_directory_path/$cart";
 $sc_cart_path =~ /([\w\-\=\+\/\.]+)/;
 $sc_cart_path = "$1";
 $sc_cart_path = "" if ($sc_cart_path eq ".");
-$sc_cart_path =~ s/^\/+//; 
+$sc_cart_path =~ s/^\/+//; # Get rid of any residual / prefix
 &check_cart_type_file_expiry("$sc_cart_path");
 }
-
 }
-
 #######################################################################
-sub assign_a_unique_shopping_cart_id
-{
-srand (time|$$);
+    # assign_a_unique_shopping_cart_id is a subroutine used to
+    # assign a unique cart id to every new clinet.  It takes
+    # no argumnets and is called with the following syntax:
+    #
+    # &assign_a_unique_shopping_cart_id;
 
-$cart_id = int(rand(10000000));
+sub assign_a_unique_shopping_cart_id {
+srand (time|$$);
+if ($sc_need_short_cart_id =~ /yes/i) {
+	$cart_id = int(rand(1000));
+} else {
+	$cart_id = int(rand(10000000));
+}
 $cart_id .= ".$$";
 $cart_id =~ s/-//g;
 &codehook("assign-cart_id-modifier");
-
 $sc_cart_path = "$sc_user_carts_directory_path/${cart_id}_cart";
 $cart_count = 0;
-
 while (-e "$sc_cart_path")
 {
-	if ($cart_count == 4)
-	{
-	print "$sc_randomizer_error_message";
-	&update_error_log("COULD NOT CREATE UNIQUE CART ID", __FILE__, __LINE__);
-	&call_exit;
-	}
-
+  if ($cart_count == 4)
+  {
+  print "$sc_randomizer_error_message";
+  &update_error_log("COULD NOT CREATE UNIQUE CART ID", __FILE__, __LINE__);
+  &call_exit;
+  }
 $cart_id = int(rand(10000000));
 $cart_id .= "_$$";    
 $cart_id =~ s/-//g;
 &codehook("assign-cart_id-modifier");
 $sc_cart_path = "$sc_user_carts_directory_path/${cart_id}_cart";
 $cart_count++;
-
 } 
-
 &set_sc_cart_path; 
 &codehook("assign-cart_id");
 &SetCookies;
-
 }
-
 #######################################################################   
 sub log_access_to_store {
   $date = &get_date;
   &get_file_lock("$sc_access_log_path.lockfile");
   open (ACCESS_LOG, ">>$sc_access_log_path");
-
   $remote_addr = $ENV{'REMOTE_ADDR'};
   $request_uri = $ENV{'REQUEST_URI'};
   $http_user_agent = $ENV{'HTTP_USER_AGENT'};
-
   if ($ENV{'HTTP_REFERER'} ne "") {
     $http_referer = $ENV{'HTTP_REFERER'};
    } else {
     $http_referer = "possible bookmarks";
    }
-
   $remote_host = $ENV{'REMOTE_HOST'};
-
-  #$shortdate = `date +"%T"`; # time
-  #$shortdate = `date +"%D %T"`; # date and time
   $shortdate = &get_date_short;
   chomp ($shortdate);
   $unixdate = time;
-
   $new_access = "$form_data{'url'}\|$shortdate\|$request_uri" .
-	"\|$cookie{'visit'}\|$remote_addr\|$http_user_agent" .
-	"\|$http_referer\|$unixdate\|";
-
+  "\|$cookie{'visit'}\|$remote_addr\|$http_user_agent" .
+  "\|$http_referer\|$unixdate\|";
   chop $new_access;
   print ACCESS_LOG "$new_access\n";
   close (ACCESS_LOG);
-
   &release_file_lock("$sc_access_log_path.lockfile");
-
  }
 #######################################################################   
+    # output_frontpage is used to display the frontpage of the
+    # store.  It takes no argumnets and is accessed with the
+    # following syntax:
+    #
+    # &output_frontpage;
+    #
+    # The subroutine simply utilizes the display_page
+    # subroutine which is discussed later to output the
+    # frontpage file, the location of which, is defined
+    # in agora.setup.db.  display_page takes four arguments:
+    # the cart path, the routine calling it, the current
+    # filename and the current line number.
+
 sub output_frontpage {
   &codehook("output_frontpage");
   &display_page("$sc_store_front_path", "Output Frontpage", __FILE__,__LINE__);
@@ -847,43 +882,51 @@
 ############################################################
 sub finish_add_to_the_cart {
 &codehook("finish_add_to_the_cart");
-if (($sc_use_html_product_pages eq "yes") || 
-   (($sc_use_html_product_pages eq "maybe") && ($page ne "")))
-{
-	if ($sc_should_i_display_cart_after_purchase eq "yes")
-	{
-	&display_cart_contents;
-	}
-	else
-	{
-	&display_page("$sc_html_product_directory_path/$page",  
-		"Display Products for Sale");
-	}
-}
-else
-{
-	if ($sc_should_i_display_cart_after_purchase eq "yes")
-	{
-	&display_cart_contents;
-	}
-
-	elsif ($are_any_query_fields_filled_in =~ /yes/i)
-	{
-	$page = "";
-	&display_products_for_sale;
-	}
-
-	else
-	{
-	&create_html_page_from_db;
-	}
+if ($sc_should_i_display_cart_after_purchase_real =~ /yes/i) {
+    $sc_should_i_display_cart_after_purchase = "yes";
 }
-
+if (($sc_use_html_product_pages =~ /yes/i) || 
+   (($sc_use_html_product_pages =~ /maybe/i) && ($page ne ""))) {
+  if ($sc_should_i_display_cart_after_purchase =~ /yes/i)  {
+      &display_cart_contents;
+  } else {
+      &display_page("$sc_html_product_directory_path/$page",  
+         "Display Products for Sale");
+  } 
+} else {
+  if ($sc_should_i_display_cart_after_purchase =~ /yes/i)  {
+     &display_cart_contents;
+  } elsif ($are_any_query_fields_filled_in =~ /yes/i)  {
+    $page = "";
+    &display_products_for_sale;
+  } else {
+     &create_html_page_from_db;
+  } 
+} 
 }
 #######################################################################
+    # display_products_for_sale is used to generate
+    # dynamically the "product pages" that the client will
+    # want to browse through.  There are two cases within it
+    # however.  
+    #
+    # Firstly, if the store is an HTML-based store, this
+    # routine will either display the requested page
+    # or, in the case of a search, perform a search on all the
+    # pages in the store for the submitted keyowrd.
+    #
+    # Secondly, if this is a database-based store, the script
+    # will use the create_html_page_from_db to output the
+    # product page requested or to perform the search on the
+    # database.
+    #
+    # The subroutine takes no arguments and is called with the
+    # following syntax:
+    #
+    # &display_products_for_sale;
+
 sub display_products_for_sale
 {
-
 if (($sc_use_html_product_pages eq "yes") || 
   (($sc_use_html_product_pages eq "maybe") && ($page ne "")))
 {
@@ -895,38 +938,36 @@
 &html_search_page_footer;
 &call_exit;
 }
-
 &display_page("$sc_html_product_directory_path/$page", "Display Products for Sale", __FILE__, __LINE__);
-}
-
-else
-{
+} else {
 &create_html_page_from_db;
 }
-
 }
 #######################################################################   
+    # create_html_page_from_db is used to genererate the
+    # navigational interface for database-base stores.  It is
+    # used to create both product pages and "list of products"
+    # pages.  The subroutine takes no arguments and is called
+    # with the following syntax:
+    #
+    # &create_html_page_from_db;
+
 sub create_html_page_from_db
 {
 local ($body_html,$prod_message,$status,$total_row_count);
- #if ($page ne "" && $search_request eq "" && 
- #    $form_data{'continue_shopping_button'} eq "")
-
 if (($page ne "" ) && (!($sc_use_html_product_pages eq "no"))) 
 {
 &display_page("$sc_html_product_directory_path/$form_data{'page'}", 
               "Display Products for Sale", __FILE__, __LINE__);
 &call_exit;
 }
-
 ($body_html,$prod_message,$status,$total_row_count) = 
-	&create_html_page_from_db_body;
+  &create_html_page_from_db_body;
 &product_page_header($sc_product_display_title,$prod_message);
 print $body_html;
 &product_page_footer($prod_message);
 &call_exit;
 }
-
 #######################################################################   
 sub create_html_page_from_db_body
 {
@@ -934,76 +975,55 @@
 local (@database_rows, @database_fields, @item_ids, @display_fields);
 local ($total_row_count, $id_index, $display_index, $found, $product_id);
 local ($row, $field, $empty, $option_tag, $option_location, $output);
-
 if (!($sc_db_lib_was_loaded =~ /yes/i)) {
   &require_supporting_libraries (__FILE__, __LINE__, "$sc_db_lib_path"); 
  }
-
 ($status,$total_row_count) = &submit_query(*database_rows);
-
 if (($form_data{'next'}+$sc_db_max_rows_returned) < 1) {
   $form_data{'next'} = 0;
  }
-
 $nextCount = $form_data{'next'}+$sc_db_max_rows_returned;
 $prevCount = $form_data{'next'}-$sc_db_max_rows_returned;
-
 $minCount = $form_data{'next'};
 $maxCount = $form_data{'next'}+$sc_db_max_rows_returned;
-
 if ($maxCount < @database_rows) {
   $my_max_count = $maxCount; 
  } else {
   $my_max_count = @database_rows;
  }
-
 $num_returned = @database_rows;
 $nextHits = $sc_db_max_rows_returned;
-
 $prod_message = &product_message($status,$num_returned,$nextHits);
-
 if ($form_data{'add_to_cart_button.x'} ne "" && 
     $sc_shall_i_let_client_know_item_added eq "yes") {
   $my_output .= "$sc_item_ordered_message";
  }
-
 $last_product_displayed = "no";
-
 foreach $row (@database_rows)
 {
 $rowCount++;
-
 $prevHits = $sc_db_max_rows_returned;
 $nextHits = $sc_db_max_rows_returned;
-
 if ($rowCount > $minCount && $rowCount <= $maxCount)
 {
-
-#@database_fields = split (/\|/, $row);
 $product_id = $row;
 $found = &check_db_with_product_id($product_id,*database_fields);
 &codehook("create_html_page_read_db_item");
 foreach $field (@database_fields)
-
 {
 if ($field =~ /^%%IMG%%/i)
 {
 ($empty, $image_tag, $image_location) = split (/%%/, $field);
-$field = '<IMG SRC="' . "$URL_of_images_directory/$image_location" . 
-	 '" BORDER=0>';
+$field = '<img src="' . "$URL_of_images_directory/$image_location" . 
+  '" alt="' . "$image_location" . '"/>';
 }
-
 if ($field =~ /^%%OPTION%%/i)
 {
 ($empty, $option_tag, $option_location, $junk) = split (/%%/, $field, 4);
 $field = "";
-
 $field = &load_opt_file($option_location);
-
 $field = &option_prep($field,$option_location,$product_id);
-
 }
-
 if ($field =~ /^%%FILE%%/i)
 {
 ($empty, $option_tag, $option_location) = split (/%%/, $field);
@@ -1015,28 +1035,22 @@
 close (OPTION_FILE);
 }
 $field = &agorascript($field,"pre","$option_location",__FILE__,__LINE__);
-
 $cart_id_for_html = &cart_id_for_html;
 $field =~ s/%%PRODUCT_ID%%/$database_fields[$sc_db_index_of_product_id]/g;
 $field =~ s/%%PRODUCTID%%/$database_fields[$sc_db_index_of_product_id]/g;
 $field =~ s/%%URLofImages%%/$URL_of_images_directory/g;
 $field =~ s/%%cart_id%%/$cart_id_for_html/g;
-
 $field = &agorascript($field,"post","$option_location",__FILE__,__LINE__);
-
 ($very_first_part,$field,$junk) = 
-	split(/<h3>--cut here--<\/h3>/i,$field,3);
+  split(/<h3>--cut here--<\/h3>/i,$field,3);
 if ($field eq "") {
   $field = $very_first_part;
  }
 if ($field eq "") {
   $field = "(file $option_location not found)";
  }
-
 }
-
 }
-
 if ($rowCount == (1 + $minCount)) {
   $first_product_displayed = "yes";
  } else {
@@ -1045,59 +1059,79 @@
     $last_product_displayed = "yes";
     }
  }
-
 &create_display_fields(@database_fields);
-
 $my_output .= &prep_displayProductPage(&get_sc_ppinc_info);
-
 }
-
 }
-
 return ($my_output,$prod_message,$status,$total_row_count);
-
 }
-
 #######################################################################
-sub file_open_error
-{
+    # If there is a problem opening a file or a directory, it
+    # is useful for the script to output some information
+    # pertaining to what problem has occurred.  This
+    # subroutine is used to generate those error messages.
+    # 
+    # file_open_error takes four arguments: the file or
+    # directory which failed, the section in the code in which
+    # the call was made, the current file name and
+    # line number, and is called with the following syntax:
+    #
+    # &file_open_error("file.name", "ROUTINE", __FILE__,
+    #                  __LINE__);
 
-local ($bad_file, $script_section, $this_file, $line_number) = @_;
+sub file_open_error {
+local ($bad_file,$script_section,$this_file,$line_number) = @_;
 &update_error_log("FILE OPEN ERROR-$bad_file", $this_file, $line_number);
-
 open(ERROR, $error_page);
-
 while (<ERROR>)
-
 {  
 print $_;
 }
-  
-close (ERROR);
-
+ close (ERROR);
 }
 #######################################################################
-sub display_page
-{
+    # display_page is used to filter HTML pages through the
+    # script and display them to the browser window. 
+    #
+    # display_page takes  four arguments: the file or      
+    # directory which failed, the section in the code in which
+    # the erroneous call was made, the current file name and
+    # line number, and is called with the following syntax:
+    #
+    # &file_open_error("file.name", "ROUTINE", __FILE__,
+    #                  __LINE__);
+    #
+    # (notice the two special Perl variables __FILE__, which
+    # equals the current filename, and __LINE__ which equals
+    # the current line number).
+
+sub display_page {
 local ($page, $routine, $file, $line) = @_;
 local($the_file)="";
+local($meta_tags_thing) = '%x%Meta Tags Go Here%x%';
 local($href_fields,$hidden_fields);
-
 $href_fields = &make_href_fields;
 $hidden_fields = &make_hidden_fields;
 $cart_id_for_html = "%%ZZZ%%";
-
    if ($form_data{'cartlink'} ne "")
    {
       open (PAGE, "<./html/$cartlink") || &file_open_error("$category", "$routine", $file, $line);
    } else {
-
 open (PAGE, "<$page") || &file_open_error("$page", "$routine", $file, $line);
 }
-
 while (<PAGE>)
-
+######################################################################################
+###### This needs to be verified.... might be easier to put the meta stuff into 
+###### the css manager as there is already space for meta tags there... 
+###### then some of this code could be elimineted.... if not it'll have to be 
+###### updated so that the pages are valid by w3c standards
+######################################################################################
 {  
+    # Check to see if the add_to_cart_button button
+    # has been clicked.  if so, it means that we have just
+    # added an item and are returning to the display of the
+    # product page.  In this case, we will sneak in an addition
+    # confirmation message right after the <FORM> tag line.
 
 if (($form_data{'add_to_cart_button'} ne "") &&
     ($sc_allow_sneak_in_message =~ /yes/i)  &&
@@ -1105,35 +1139,39 @@
   if ($_ =~ /<FORM/) {
     $the_file .= "$_";
     $the_file .= "$sc_item_ordered_message";
-    $_ = ""; 
+    $_ = ""; #do not write it twice
    }
  }
-
+    # If it is any other line, simply print it out to the
+    # browser window.  Once we have gone through all of the
+    # lines in the file, the HTML will be complete and
+    # filtered.
 $the_file .= $_;
+if ($_ =~ /<head>/i) {
+  $the_file .= $meta_tags_thing;
+  $meta_tags_thing = '';
+ }
 }
   
 close (PAGE);
 $the_file = &script_and_substitute($the_file,$page);
+$the_file = $meta_tags_thing . $the_file; # safety net
+$the_file =~ s/%x%Meta Tags Go Here%x%/$sc_special_page_meta_tags/gi;
 print $the_file;
-
 }
 #################################################################
 sub script_and_substitute {
  local ($the_file,$page)=@_;
  local($href_fields,$hidden_fields,$item_ordered_message,$my_text)="";
  local($arg,$myans);
-
 $href_fields = &make_href_fields;
 $hidden_fields = &make_hidden_fields;
 $cart_id_for_html = "%%ZZZ%%";
-
 if (($form_data{'add_to_cart_button'} ne "" )&&
     ($sc_shall_i_let_client_know_item_added =~ /yes/i)) {
   $item_ordered_message = $sc_item_ordered_msg_token;
  }
-
 $the_file = &agorascript($the_file,"pre","$page",__FILE__,__LINE__);
-
 $the_file =~ s/%%item_ordered_msg%%/$item_ordered_message/ig;
 $the_file =~ s/%%CartID%%/%%cart_id%%/g;
 $the_file =~ s/%%cartID%%/%%cart_id%%/ig;
@@ -1143,12 +1181,11 @@
 $the_file =~ s/%%page%%/$form_data{'page'}/ig;
 $the_file =~ s/%%cartlink%%/$form_data{'cartlink'}/ig;
 $the_file =~ s/%%date%%/$date/ig;
-$the_file =~ s/%%agoracgi_ver%%/$versions{'agora.cgi'}/ig;
+$the_file =~ s/%%agoracgi_ver%%/$versions{'agoracart'}/ig;
 $the_file =~ s/%%URLofImages%%/$URL_of_images_directory/ig;
-$the_file =~ s/%%ScriptURL%%/$sc_main_script_url/ig;
-$the_file =~ s/%%ScriptPostURL%%/$sc_main_script_url/ig;
+$the_file =~ s/%%scriptURL%%/$sc_main_script_url/ig;
+$the_file =~ s/%%ScriptPostURL%%/$sc_main_script_post_url/ig;
 $the_file =~ s/%%sc_order_script_url%%/$sc_order_script_url/ig;
-$the_file =~ s/%%storeURL%%/$sc_store_url/ig;
 $the_file =~ s/%%StepOneURL%%/$sc_stepone_order_script_url/ig;
 $the_file =~ s/%%href_fields%%/$href_fields/ig;
 $the_file =~ s/%%make_hidden_fields%%/$hidden_fields/ig;
@@ -1159,23 +1196,23 @@
 $the_file =~ s/%%keywords%%/$keywords/ig;
 $the_file =~ s/%%next%%/$form_data{'next'}/ig;
 $the_file =~ s/%%exact_match%%/$form_data{'exact_match'}/ig;
-$the_file =~ s/%%exact_case%%/$form_data{'exact_case'}/ig;
-
+$the_file =~ s/%%member%%/$form_data{'member'}/ig;
+$the_file =~ s/%%affiliate%%/$form_data{'affiliate'}/ig;
+$the_file =~ s/%%TemplateName%%/$sc_headerTemplateName/ig;
+$the_file =~ s/%%ButtonSetURL%%/$sc_buttonSetURL/ig;
+$the_file =~ s/%%head_info%%/$sc_standard_head_info/ig;
 while ($the_file =~ /(%%eval)([^%]+)(%%)/i) {
   $arg = $2;
   $myans = eval($arg);
   if ($@ ne ""){ $myans = "%% Eval Error on: $arg %%";}
   $the_file =~ s/(%%eval)([^%]+)(%%)/$myans/i;
 }
-
 while ($the_file =~ /%%ZZZ%%/) {
   $cart_id_for_html = &cart_id_for_html;
   $the_file =~ s/%%ZZZ%%/$cart_id_for_html/;
 }
-
 $the_file = &agorascript($the_file,"post","$page",__FILE__,__LINE__);
 $the_file = &agorascript($the_file,"","$page",__FILE__,__LINE__);
-
 while ($the_file =~ /%%StoreHeader%%/i) {
   $my_text = &GetStoreHeader;
   $the_file =~ s/%%StoreHeader%%/$my_text/i;
@@ -1184,18 +1221,14 @@
   $my_text = &GetStoreFooter;
   $the_file =~ s/%%StoreFooter%%/$my_text/i;
 }
-
 return $the_file;
-
 }
 #################################################################
 sub update_error_log {
 local ($type_of_error, $file_name, $line_number) = @_;
 local ($log_entry, $email_body, $variable, @env_vars);
-
 @env_vars = sort(keys(%ENV));
 $date = &get_date;
-
 if ($sc_debug_mode eq "yes")
 {
 if ($sc_header_printed ne 1) {
@@ -1204,118 +1237,125 @@
    }
   print $sc_browser_header;
  }
-
 local($browser_text) = $type_of_error;
 $browser_text =~ s/\|/\<br\>\n/g;
-
 print '<DIV ALIGN=LEFT><TABLE WIDTH=500><TR><TD>' . "\n<PRE>";
 print "ERROR:$browser_text<br>",
       "FILE: $file_name<br>",
       "LINE: $line_number<BR>\n";
 print '</PRE></TD></TR></TABLE></DIV>' . "\n";
-
 }
-
 if ($sc_shall_i_log_errors eq "yes")
 {
-
 $log_entry = "$type_of_error\|FILE=$file_name\|LINE=$line_number\|";
 $log_entry .= "DATE=$date\|";
-
 &get_file_lock("$sc_error_log_path.lockfile");
 open (ERROR_LOG, ">>$sc_error_log_path") || &CgiDie ("The Error Log could not be opened");
-
 foreach $variable (@env_vars)
-
 {
 $log_entry .= "$variable: $ENV{$variable}\|";
 }  
-
-$log_entry =~ s/\n/<br>/g; #
+$log_entry =~ s/\n/<br>/g; 
 print ERROR_LOG "$log_entry\n";
 close (ERROR_LOG);  
-
 &release_file_lock("$sc_error_log_path.lockfile");
-
 }
-
 if ($sc_shall_i_email_if_error eq "yes")
-
 {
 $email_body = "$type_of_error\n\n";
 $email_body .= "FILE = $file_name\n";
 $email_body .= "LINE = $line_number\n";
 $email_body .= "DATE=$date\|"; 
-
 foreach $variable (@env_vars)
 {
 $email_body .= "$variable = $ENV{$variable}\n";
 }  
-
 &send_mail("$sc_admin_email", "$sc_admin_email", "Web Store Error", "$email_body");
-
 }
-
-
 }
 #################################################################
 sub get_date {
 local (@days, @months); 
 local ($connector) = ' at ';
 @days = ('Sunday','Monday','Tuesday','Wednesday','Thursday', 'Friday',
-	'Saturday');
+  'Saturday');
 @months = ('January','February','March','April','May','June','July',
-	   'August','September','October','November','December');
+     'August','September','October','November','December');
 return &get_date_engine;
 }
-
 sub get_date_short {
 local (@days, @months); 
 local ($connector) = ' ';
 @days = ('Sun','Mon','Tue','Wed','Thu', 'Fri', 'Sat');
 @months = ('Jan','Feb','Mar','Apr','May','Jun',
-	'Jul','Aug','Sep','Oct','Nov','Dec');
+  'Jul','Aug','Sep','Oct','Nov','Dec');
 return &get_date_engine;
 }
 
+sub get_month_year {
+local (@days, @months); 
+local ($connector) = ' at ';
+@days = ('Sunday','Monday','Tuesday','Wednesday','Thursday', 'Friday',
+  'Saturday');
+@months = ('January','February','March','April','May','June','July',
+     'August','September','October','November','December');
+return &get_monthyear_engine;
+}
+
 sub get_date_engine
 {
-
 local ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst,$date);
-
 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
-
 if ($hour < 10) 
-
 { 
 $hour = "0$hour"; 
 }
-
 if ($min < 10) 
-
 { 
 $min = "0$min"; 
 }
-
 if ($sec < 10) 
-
 {
 $sec = "0$sec"; 
 }
-
 $year += 1900;
 $date = "$days[$wday], $months[$mon] $mday, $year" .
-	$connector . "$hour\:$min\:$sec";
-
+  $connector . "$hour\:$min\:$sec";
 return $date;
+}
 
-}       
-
+sub get_monthyear_engine {
+my ($sec,$min,$hour,$mday,$mon,$wday,$yday,$isdst);
+my ($month,$year);
+($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
+$year += 1900;
+$month = "$months[$mon]";
+return ($mday,$month,$year);
+}         
 #################################################################
+    # display_price is used to format the price string so that
+    # the store can take into account differing methods for
+    # displaying prices. For example, some countries use
+    # "$xxx.yyy".  Others may use "xx.yy UNIT".  This
+    # subroutine will  use the $sc_money_symbol_placement and
+    # the $sc_money_symbol variables defined in
+    # agora.setup.db to format the entire price string for
+    # display.  The subroutine takes one argument, the price
+    # to be formatted, and is called with the following
+    # syntax:
+    #
+    # $price = &display_price(xx.yy);
+    #
+    # Where xx.yy is some number like 23.99.
+    #
+    # Note that the main routine calling this subroutine must
+    # prepare a variable for the returned formatted price to
+    # be assigned to.
+
 sub display_price {
  local ($price) = @_;
  local ($format_price);
-	
+  
 # set to 2 decimal places ... SPK 1/26/2000
 $price = &format_price($price);
 
@@ -1337,137 +1377,153 @@
 }
 
 #######################################################################
-sub get_file_lock 
-
-{
+    # get_file_lock is a subroutine used to create a lockfile.
+    # Lockfiles are used to make sure that no more than one
+    # instance of the script can modify a file at one time.  A
+    # lock file is vital to the integrity of your data.
+    # Imagine what would happen if two or three people
+    # were using the same script to modify a shared file (like
+    # the error log) and each accessed the file at the same
+    # time.  At best, the data entered by some of the users
+    # would be lost.  Worse, the conflicting demands could
+    # possibly result in the corruption of the file.
+    #
+    # Thus, it is crucial to provide a way to monitor and
+    # control access to the file.  This is the goal of the
+    # lock file routines.  When an instance of this script
+    # tries to  access a shared file, it must first check for
+    # the existence of a lock file by using the file lock
+    # checks in get_file_lock.
+    #
+    # If get_file_lock determines that there is an existing
+    # lock file, it instructs the instance that called it to
+    # wait until the lock file disappears.  The script then
+    # waits and checks back after some time interval.  If the
+    # lock file still remains, it continues to wait until some 
+    # point at which the admin has given it permissios to just
+    # overwrite the file because some other error must have
+    # occurred.
+    #
+    # If, on the other hand, the lock file has dissappeared,
+    # the script asks get_file_lock to create a new lock file
+    # and then goes ahead and edits the file.
+    #
+    # The subroutine takes one argumnet, the name to use for
+    # the lock file and is called with the following syntax:
+    #
+    # &get_file_lock("file.name");
 
+sub get_file_lock {
 local ($lock_file) = @_;
 local ($endtime);
 local ($exit_get_file_lock)="";
 &codehook("get_file_lock");
 if ($exit_get_file_lock ne "") {return;}
-
 $endtime = 55; # was 20 originally
 $endtime = time + $endtime;
-    
-while (-e $lock_file && time < $endtime) 
-{
+while (-e $lock_file && time < $endtime) {
 sleep(1);
 }
-
 open(LOCK_FILE, ">$lock_file") || 
     &CgiDie ("I could not open the lockfile - check your permission " .
-	     "settings ($lock_file)");
-# flock(LOCK_FILE, 2); # 2 exclusively locks the file
-
+       "settings ($lock_file)");
 } 
 #######################################################################
-sub release_file_lock 
-{
+sub release_file_lock {
 local ($lock_file) = @_;
 local ($exit_release_file_lock)="";
 &codehook("release_file_lock");
 if ($exit_release_file_lock ne "") {return;}
-
-# flock(LOCK_FILE, 8); # 8 unlocks the file
-
 close(LOCK_FILE);
 unlink($lock_file);
-
 } 
 #######################################################################
-sub format_price
-{
-
+    # format_price is used to format prices to two decimal
+    # places. It takes one argumnet, the price to be formatted
+    # and is called with the following syntax:
+    #
+    # $price =&format_price(xxx.yyyyy);
+    #
+    # Notice that the main calling routine must assign the
+    # returned formatted price to some variable for its own
+    # use.
+    #
+    # Also notice that this routine takes a value even if it
+    # is longer than two decimal places and formats it with
+    # rounding.  Thus, you can utilize price calculations such
+    # as 12.99 * 7.985 (where 7.985 might be some tax value.
+  
+sub format_price {
 local ($unformatted_price) = @_;
 local ($formatted_price);
 $formatted_price = sprintf ("%.2f", $unformatted_price);
 return $formatted_price;
-
 }
-############################################################
-sub format_text_field 
-
-{
 
+############################################################
+#
+# subroutine: format_text_field
+#   Usage:
+#       $formatted_value =
+#         &format_text_field($value, [$width]);
+#
+#   Parameters:
+#     $value = text value to format.
+#     $width = optional field width. Defaults to 25.
+#
+#     This routine takes the value and appends enough
+#     spaces so that the field width is 25 spaces.
+#     in order to justify the fields that are stored
+#     eventually in the $text_of_cart.
+#
+sub format_text_field {
 local($value, $width) = @_;
 $width = 25 if (!$width);
-
 return ($value . (" " x ($width - length($value))));
-
 }
 ###########################################################################################
 sub SetCookies
 {
-local(@test);
-$cookie{'cart_id'} = "$cart_id";
+local(@test,$junk);
+($cookie{'cart_id'},$junk) = split(/\*/,$cart_id,2);
+# Set the domain to be correct for your domain
 $domain = $sc_domain_name_for_cookie;
+# now, if there is only a two-parter domain name, add a leading period.
 @test = split(/\./,$domain);
 #if ($test[2] eq '') { $domain = '.' . $domain;}
 $secureDomain = $sc_secure_domain_name_for_cookie;
 @test = split(/\./,$secureDomain);
 #if ($test[2] eq '') { $secureDomain = '.' . $secureDomain;}
+# The path to your 'store' directory
 $path = $sc_path_for_cookie;
 $securePath = $sc_secure_path_for_cookie;
+# Leave this as is.
 $secure = "";
+# Cookie will expire in 24 hours times the number of cookie days
 $now = time;
+# Second in twenty four hours
 $twenty_four_hours = "86400";
 $cookie_hours = $sc_cookie_days * $twenty_four_hours;
-$expiration = $now+$cookie_hours;
+$expiration = $now+$cookie_hours;#number of days until cookie expires
 &codehook("about_to_set_cookie");
 if(!$form_data{'secure'}){
-  &set_cookie($expiration,$domain,$path,$secure);
+  &set_agora_cookies($expiration,$domain,$path,$secure);
  } else {
-  &set_cookie($expiration,$secureDomain,$securePath,$secure);
+  &set_agora_cookies($expiration,$secureDomain,$securePath,$secure);
  }
-
 } 
+
 ############################################################
-sub checkReferrer
-{
-local ($referringDomain, $acceptedDomain);
-local ($alt_domain)='';
+sub checkReferrer {
 local ($test_repeat,$raw_text);
-
-$referringDomain = $ENV{'HTTP_REFERER'};
-$acceptedDomain = $sc_domain_name_for_cookie;
-
-if ($sc_disable_refer_domain_check =~ /yes/i) {
-  $referringDomain = $acceptedDomain;
- }
-
-if ($referringDomain eq "") {
-  $referringDomain = $acceptedDomain;
-}
-
-if (!($sc_accept_only_full_domain)) {
-  $alt_domain = $sc_domain_name_for_cookie;
-  $alt_domain =~ s/\w*\.//;
- }
-
-$referringDomain =~ s/\?.*//g;
-$referringDomain =~ s/http:\/\///g;
-$referringDomain =~ s/https:\/\///g;
-$referringDomain =~ s/\/.*//g;
-$referringDomain =~ s/\/agora.cgi//g;
-
-if ($referringDomain =~ "^w*\.")
-{
-$referringDomain =~ s/^w*\.//i;
-}
-
-if ($acceptedDomain =~ "^w*\.")
-{
-$acceptedDomain =~ s/^w*\.//i;
-}
- 
 $test_repeat = 0;
 if ($sc_test_for_store_cart_change_repeats) {
   $test_repeat = $sc_test_repeat;
  }
-
-if ((($referringDomain ne $acceptedDomain) && 
-     ($referringDomain ne $sc_domain_name_for_cookie)) || ($test_repeat)) {
+if (&get_agora("SSI_REDIRECT_OK") ne '') {
+  &set_agora("SSI_REDIRECT_OK",'');
+  $referringDomain = $acceptedDomain;
+ }
   if ($test_repeat) {
     if ($sc_repeat_fake_it =~ /yes/i) { 
       &repeat_fake_it;
@@ -1476,16 +1532,6 @@
       &display_cart_contents;
      }
    }
-  elsif ($cart_id == $cookie{'cart_id'}) { 
-    $special_message = $messages{'chkref_02'};
-    &display_cart_contents;
-   } else {
-    print "$acceptedDomain is the accepted referrer.<br>";
-    print "$referringDomain is not a valid referrer<br>";
-    print $messages{'chkref_03'};
-   }
-  &call_exit;   
- }
 }
 ############################################################
 sub repeat_fake_it {
@@ -1513,18 +1559,14 @@
  $cart_id =~ /([\w\-\=\+\/]+)\.(\w+)/;
  $cart_id = "$1.$2";
  $form_data{'cart_id'} = $cart_id;
-
- $base			= "$sc_user_carts_directory_path/";
- $sc_cart_path		= "$base${cart_id}_cart";
- $sc_capture_path	= "$base${cart_id}_CAPTURE";
+ $base      = "$sc_user_carts_directory_path/";
+ $sc_cart_path    = "$base${cart_id}_cart";
+ $sc_capture_path = "$base${cart_id}_CAPTURE";
  $sc_server_cookie_path = "$base${cart_id}_COOKIES";
- $sc_verify_order_path	= "$base${cart_id}_VERIFY";
- $cart_id_for_html	= "$cart_id*" . &make_random_chars; 
-
+ $sc_verify_order_path  = "$base${cart_id}_VERIFY";
+ $cart_id_for_html  = "$cart_id*" . &make_random_chars; 
  &check_cart_expiry;
-
  &load_server_side_cookies;
-
  $sc_test_repeat = 0;
  $raw_text = &get_agora('TRANSACTIONS');
  if ($sc_unique_cart_modifier ne '') {
@@ -1534,14 +1576,39 @@
      $sc_test_repeat = 1;
     }
   }
-
  &codehook("set_sc_cart_path_bot");
-
  return;
 }
 #######################################################################
-sub cart_id_for_html{ 
- return "$cart_id*" . &make_random_chars;
+# added by Mister Ed Aug 2005 to check server side cookies to determine if cart ID in link matches up
+sub check_server_cookies_first {
+ my($base)="";
+$cart_id =  $form_data{'cart_id'};
+ $cart_id =~ /([\w\-\=\+\/]+)\.(\w+)/;
+ $cart_id = "$1.$2";
+  undef(%agora); 
+  undef(%agora_original_values);
+ $base      = "$sc_user_carts_directory_path/";
+ $sc_server_cookie_path = "$base${cart_id}_COOKIES";
+  if (-e "$sc_server_cookie_path" && -r "$sc_server_cookie_path"){ 
+    eval('require "$sc_server_cookie_path"'); 
+   }
+    eval q~
+     use HTTP::BrowserDetect;
+     my $browser = new HTTP::BrowserDetect($ENV{"HTTP_USER_AGENT"});
+     ~;
+  if ($agora{'HTTP_USER_AGENT'} ne $ENV{'HTTP_USER_AGENT'})  { 
+&assign_a_unique_shopping_cart_id;
+  }
+ return;
+}
+#######################################################################
+sub cart_id_for_html{ # nice and simple ... append random chars as tag
+ if ($sc_running_an_SSI_store =~ /yes/i) {
+   return "$cart_id";
+  } else {
+   return "$cart_id*" . &make_random_chars;
+  }
 }
 #######################################################################
 sub zcode_error {
@@ -1562,7 +1629,7 @@
     foreach $codehook (@hooklist) {
       eval("&$codehook;");
       $err_code = $@;
-      if ($err_code ne "") { #script died, error of some kind
+      if ($err_code ne "") { 
         &update_error_log("code-hook $hookname $codehook $err_code","","");
        }
      }
@@ -1591,6 +1658,59 @@
   $codehooks{$hookname} = $sub_name;
  }
 #######################################################################
+sub agora_starter_section {
+&get_cookie;
+&alias_and_override;
+&error_check_form_data;
+$cart_id = $form_data{'cart_id'};
+
+# help with robots hitting site. Beta and may not work. Added by Mister Ed August 16, 2006
+    eval q~
+     use HTTP::BrowserDetect;
+     my $browser = new HTTP::BrowserDetect($ENV{"HTTP_USER_AGENT"});
+     if ($browser->robot()) {
+         &set_agora("BOT",1);
+         $cart_id = "9999999.99999";
+         $form_data{'cart_id'} = "9999999.99999";
+         $cookie{'cart_id'} = "9999999.99999";
+         &set_agora("BOT",1);
+         &set_agora("BROWSER",$browser->browser_string().'/'.$browser->version());
+     }
+     ~;
+
+#updated by Mister Ed Aug 2005
+#reduces inheritances in sharing URLs with Cart IDs
+#resolves 95% or so of the problems.  IF same exact browser and configs, then can be seen/shared possibly
+
+if ($cookie{'cart_id'} eq "" && $form_data{'cart_id'} eq "") {
+# new visitor
+  &delete_old_carts;
+  &assign_a_unique_shopping_cart_id;
+  $cart_id_history .= "set new cart value "; #for debugging of course
+  &codehook("got_a_new_cart");
+ } elsif (($form_data{'cart_id'} eq "" && $cookie{'cart_id'} ne "")||($cookie{'cart_id'} eq $form_data{'cart_id'})) {
+# returning visitor without Cart ID in link or both match
+  $cart_id = $cookie{'cart_id'};
+  $cart_id_history .= "from cookie "; #for debugging of course
+  &set_sc_cart_path;
+  &codehook("got_a_old_cart_from_cookie");
+ } else {
+   if (($form_data{'cart_id'} ne "") && ($cookie{'cart_id'} ne $form_data{'cart_id'})  && (!$ENV{'HTTPS'})) { 
+# both are Cart ID in link and Cookie exists. Not SSL, allowance for shared SSL
+    &check_server_cookies_first;
+   } else { # fail safe
+    $cart_id = $form_data{'cart_id'};
+    $cart_id_history .= "set from form data ";
+    &set_sc_cart_path;
+   }
+ }
+&pre_header_navigation;
+print $sc_cookie_information;
+print $sc_browser_header;
+$sc_header_printed = 1;
+$are_any_query_fields_filled_in = "no";
+}
+#######################################################################
 sub my_die {
   local ($msg) = @_;
   if ($sc_in_throes_of_death eq "yes") {die $msg;}
@@ -1598,34 +1718,69 @@
   &call_exit;
   die $msg;
 }
+
 #######################################################################
+# Cart Links Sub Routine
+#
+# cartlinks added by Mister Ed of AgoraCart.com 09/2002
+#
+# cart link routine reads all thew .htm and .html files in the store's html sub directory.
+# Agora Script is then placed on files such as static pages, headers, footers, etc that
+# will place the links built within the $cartlinks variable.  scripting can also be used to change
+# the layout of the links built below.  the cartlinks token %%cartlinks%% can also be used
+# to place the links into a page in the format they are built below.
+#
+# will not build links for pages called: index, frontpage, or error.
+#######################################################################
+# Completely overhauled the html and links formation in this sub. 
+#   Added the title attribute to the links for SEO.
+
+my (@clinknames);
+my ($page2_extension, $clinkname);
+
 sub cartlinks
 {
-   $cartlinks = "<a href=\"$sc_store_url?cart_id=$cart_id\" style=\"text-decoration: none\">Home</a>\n";
-   opendir(PAGES,"./html")||die("Cannot open Directory!");
-   @clinknames = readdir(PAGES);
-   for $clinknames(@clinknames)
-   {
-      $clinkname = (split (/\./, $clinknames))[0];
-      $page2_extension = (split (/\./, $clinknames))[1];
-      $clinkname =~ s/_/ /ig;
-      $clinkname =~ s/-/ /ig;
-      if ($page2_extension eq "htm" or $page2_extension eq "html")
-      {
-      if ($clinkname && $clinkname ne "" && $clinkname ne "index" && $clinkname ne "error" && $clinkname ne "frontpage")
-      {
-         $cartlinks .= "<br><a href=\"$sc_store_url?cartlink=$clinknames&cart_id=$cart_id\"  style=\"text-decoration: none\">$clinkname</a>\n";
+  $cartlinks = "<ul>\n";
+  
+  # do we want to display a link to the Site's page?
+  if ($sc_display_cartlinksite =~ /yes/i) {
+    $cartlinks .= "<li><a class=\"ac_cart_info_links\" href=\"";
+    if ($sc_display_cartlinksite_url =~ /http/i) {
+      $cartlinks .= "$sc_display_cartlinksite_url";
+    } else {
+      $cartlinks .= "http://$sc_display_cartlinksite_url";
+    }
+    $cartlinks .= "\" title=\"$sc_display_cartlinksite_name\">$sc_display_cartlinksite_name</a></li>\n";
+  }
+    # do we want to display a link to the main store page?
+  if ($sc_display_cartlinkhome =~ /yes/i) {
+    $cartlinks .= "<li><a class=\"ac_cart_info_links\" href=\"$sc_store_url?cart_id=$cart_id\" title=\"$sc_display_cartlinkhome_name\">$sc_display_cartlinkhome_name</a></li>\n";
+  }
+  opendir(PAGES,"./html")||die("Cannot open Directory!");
+  @clinknames = readdir(PAGES);
+  for $clinknames(@clinknames) {
+    $clinkname = (split (/\./, $clinknames))[0];
+    $page2_extension = (split (/\./, $clinknames))[1];
+    $clinkname =~ s/_/ /ig;
+    $clinkname =~ s/-/ /ig;
+    if ($page2_extension eq "htm" or $page2_extension eq "html") {
+      if ($clinkname && $clinkname ne "" && $clinkname ne "index" && $clinkname ne "error" && $clinkname ne "frontpage") {
+        $cartlinks .= "<li><a class=\"ac_cart_info_links\" href=\"$sc_store_url?cartlink=$clinknames&amp;cart_id=$cart_id\" title=\"$clinkname\">$clinkname</a></li>\n";
       }
-}
-   }
-   close (PAGES)
-}
+    }
+  }
+  &codehook("cartlinks_bottom");
+  $cartlinks .= "</ul>";
+  close (PAGES);
 
+}
 #######################################################################
 sub call_exit {
+&require_supporting_libraries(__FILE__,__LINE__,"./library/agora_html_lib.pl");
   &agora_cookie_save;
   codehook("cleanup_before_exit");
   if ($sc_in_throes_of_death ne "yes") {
     exit;
    }
  }
+# End of agora.cgi
diff -ruN 4.0K-4b/agorastyles.css 5.0.000/agorastyles.css
--- 4.0K-4b/agorastyles.css	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/agorastyles.css	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,388 @@
+body{
+  background : #FFFFFF;
+  color: #000000;
+  margin: 0px;
+  padding: 0px;
+  font-size : 10pt;
+  font-family: Arial, Helvetica, sans-serif;
+  min-width: 770px; 
+  /* Internet Explorer doesn't accept min-width therefore we 
+   use the following Dynamic Expression to set the width */
+  width:expression(document.body.clientWidth < 850 ? "770px" : "100%" );
+}
+/* ~~~~~~~~~ default hyper links ~~~~~~~~~*/
+/* See Template CSS files */
+/* ~~~~ Header  and Footer File ~~~~ */
+.ac_header, .ac_mainbody{
+  width :100%;
+  font-size : 10pt;
+}
+.ac_header{
+  background-color : #680098;
+  padding: 0px;
+  text-align: center;
+  font-family : Verdana, Arial;
+  color: #FFFFFF;
+}
+h1#ac_h1 {
+  font-size : 15pt;
+  font-weight : bold;
+  margin: 0px;
+  color: #FFFFFF;
+}
+h2#ac_h2 {
+  font-style : italic;
+  margin: 0px;
+  font-size: 12pt;
+  color: #FFFFFF;
+}
+.ac_left_nav h3 {
+  color : #FF0000;
+  font-weight : bold;
+  text-align: center;
+  margin: 0px;
+  padding: 5px 0px 0px 5px;
+  font-size: 10pt;
+}
+.ac_left_nav hr{
+  padding:0px;
+  margin: 25px 0px 25px 0px;
+  width : 95%;
+}
+.ac_header_search{
+  text-align: right;
+  vertical-align : middle;
+}
+.ac_mainbody, .ac_cart_summary{
+  background-image : url(agora.cgi?secpicserve=steelgrey.jpg);
+  background-color : #cccccc;
+}
+.ac_mainbody{
+  padding: 0px;
+  margin: 0px;
+}
+.ac_left_nav{
+  width: 155px;
+  vertical-align : top;
+  padding: 0px;
+  padding-top: 15px;
+}
+a.ac_left_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 10px;
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : underline;
+}
+a.ac_left_sub_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 18px;
+  font-size: 9pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+.ac_cart_summary{
+  font-size: 12pt;
+  width:100%;
+  color: #000000;
+  text-align: center;
+  padding: 0px;
+  padding-top:10px;
+  padding-bottom:10px;
+}
+.ac_copyright{
+  text-align: center;
+  font-size: 10pt;
+  background-color: #FFFFFF;
+  padding: 0px;
+  padding-top:10px;
+  padding-bottom:10px;
+} 
+div#ac_html_validator{
+  text-align: center;
+  padding-top : 100px;
+  vertical-align : bottom;
+}
+/* Cart Links Variations */
+  /* standard vertical list no padding no indicator */    
+.ac_left_nav ul{
+  margin-left: 0px;
+  margin-top: 0px;
+  padding-left: 0px;
+  list-style: none;
+}
+/* horizontal links with a link vertical between each pair
+First listed item must be of class first */
+.ac_bottom_links{
+  text-align: center;
+  padding: 5px 0px 5px 0px;
+}
+.ac_bottom_links ul{
+  margin-left: 0px;
+  padding-left: 0px;
+  display: inline;
+  text-align: center;
+}
+.ac_bottom_links ul li{
+  font-size:10pt;
+  padding: 5px 10px 5px 10px;
+  list-style: none;
+  display: inline;
+  border-left: 1px solid #000000;
+}
+.ac_bottom_links ul li.first{
+  border-left: 0px;
+}
+/*Vertical Links with no indicator but are centered*/
+.ac_vertical_links{
+  text-align:center;
+}
+.ac_vertical_links ul{
+  margin-left: 0px;
+  padding-left: 0px;
+  display: inline;
+  text-align: center;
+}
+.ac_vertical_links ul li{
+  font-size: 10pt;
+  padding: 0px 10px;
+  list-style: none;
+  display: inline;
+}
+
+/* ~~~~~ Error Message ~~~~~ */
+/* This is the formating for the error message a user recieves */
+p.ac_error{
+  width: 500px;
+  text-align: center;
+  color: #FF0000;
+  font-size:12pt;
+  padding: 10px 0px 10px 0px;
+  margin: auto;
+}
+
+/* ~~~ Product listings ~~~ */
+.ac_content{
+  background-color: #FFFFFF;
+  vertical-align : top;
+  padding: 0px; 
+  padding-bottom: 25px;
+}
+.ac_product_table{
+  width: 90%;
+  vertical-align : top;
+  margin: 10px auto;
+  text-align: center;
+}
+
+
+/*~~~~~~ Product Pages ~~~~~~~  */
+/* This is the formatting message the user sees when an item is added to the cart*/
+td.ac_add_message{
+  color: #FF0000;
+  text-align: center;
+}
+/* ~~~ Search Results ~~~ */
+.ac_seach_results{
+  margin: 0px auto;
+  background-color:#f0f0f0;
+  width:500px;
+  font-size:12pt;
+  text-align:center;
+}
+p.ac_search_no_results{
+  text-align:center;
+  margin: 50px auto;
+  font-size:12pt;
+}
+h3.ac_product_name{
+  font-size:10pt;
+  color:#000000;
+  margin:5px 5px 2px 5px;
+  font-weight : bold;
+  text-align:left;
+}
+.ac_product_desc{
+  text-align : justify;
+  font-size:9pt;
+  margin: 0px 5px 10px 5px;
+}
+.ac_product_price{
+  color: #FF0000;
+  font-size:10pt;
+  white-space : nowrap;
+  font-weight : bold;
+}
+.ac_product_outofstock{
+  color: #FF0000;
+  font-size:10pt;
+  white-space : nowrap;
+  font-weight : bold;
+}
+.ac_product_available{
+  color: #FF0000;
+  font-size:9pt;
+  white-space : nowrap;
+  font-weight : normal;
+}
+.ac_product_opt-add{
+  text-align:center;
+  font-size:10pt;
+}
+.ac_product_image{
+  text-align:center;
+  width:auto;
+}
+.ac_add-quantity{
+  margin: 0px auto;
+  text-align: center;
+}
+/*~~~ Options ~~~~*/
+.opt_border{
+  font-size: 10pt;
+  text-align: center;
+  border: 1px solid #CCCCCC;
+  margin: 0px auto; 
+}
+th.opt_border{
+  padding:0px 2px;
+}
+.no_border{
+  font-size: 10pt;
+  border: none;
+  margin: 0px auto;
+}
+th.no_border{
+  padding:0px 2px;
+}
+
+.opt_center{
+  font-size: 10pt;
+  text-align:center;
+  margin: 0px auto  
+}
+th.opt_center{
+  padding:0px 2px;
+}
+
+select.opt_select{
+  width:125px;
+  text-align:left;
+}
+/* ~~~~~~ View Cart Table ~~~~~~*/
+table.ac_cart_table{
+  background-color: #AAAAAA;  /* this color ends up being the border color for the table */
+  width: 90%;
+  margin:0px;
+  margin-left: auto;
+  margin-right: auto;
+  margin-top: 20px;
+  margin-bottom: 20px;
+  color: #000000;
+  font-family: Arial, Helvetica, sans-serif;
+  font-size : 10pt;
+  text-align: center;
+}
+table.ac_cart_table th{
+  font-size : 11pt;
+  background-color: #FFE0E0;
+  margin:0px;
+  width: auto;
+  vertical-align : top;
+}
+table.ac_cart_table td{
+  background-color: #E8FFF8;
+  border: 0px;
+  width: auto;
+}
+/* ~~~~~ Order Totals Table from View Cart Page ~~~ */
+table.ac_totals_table{
+  background-color: #F0F5FF;
+  font-size: 12pt;
+  color: #000000;
+  margin-top: 20px;
+  margin-bottom: 20px;
+  margin-left: auto;
+  margin-right: auto;
+}
+table.ac_totals_table th{
+  text-align:center;
+  background-color: #E0E5FF;
+  width:auto;
+}
+table.ac_totals_table td{
+  width:auto;
+  text-align: right;
+}
+/* ~~~~~~ Check Out Pages ~~~~~~ */
+.ac_checkout{
+  margin: 10px auto;
+  width: 550px;
+  font-size : 10pt;
+}
+td.ac_checkout_top_col{
+  background-color : #C0EFFF;
+  font-size : 13pt;
+  font-weight: bold;
+  border-top : 1px solid #000000;
+  border-bottom : 1px solid #000000;
+  text-align : left;
+  padding: 5px 7px;
+}
+td.ac_checkout_left_col{
+  text-align: left;
+  width: 15%;
+  white-space : nowrap;
+}
+td.ac_checkout_right_col{
+  text-align: left;
+  width: 85%;
+}
+.ac_missing_field{
+  width: 500px;
+  text-align:center;
+  color: #FF0000;
+  font-size:12pt;
+  padding: 0px;
+  padding-top:10px;
+  border-top:1px solid #000000;
+}
+.ac_checkout_top_msg{
+  background-color: #E8E0E0;
+  width: 500px;
+  text-align:left;
+  padding: 3px;
+  margin: 0px auto;
+}
+.ac_checkout_review{
+  background-color: #F8F8C8;
+  font-size: 10pt;
+  border: 1pt solid #AAAAAA;
+  margin: 0px auto;
+  width: 500px;
+}
+th.ac_checkout_review, 
+td.ac_checkout_review, 
+td.ac_checkout_review_col1, 
+td.ac_checkout_review_col2 {
+  border: 1pt solid #AAAAAA;
+  padding: 3px;
+}
+.ac_checkout_review_col1{
+  width: 150px;
+}
+.ac_checkout_review_col2{
+  width: 350px;
+}
+
+.center{
+  text-align:center;
+}
+img{
+  border:0px;
+  margin: 0px;
+}
diff -ruN 4.0K-4b/agoratemplate.css 5.0.000/agoratemplate.css
--- 4.0K-4b/agoratemplate.css	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/agoratemplate.css	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,128 @@
+<style type="text/css">
+.style6 {
+	font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #2A6D60;
+}
+a:link {
+	color: #2A6D60;
+	text-decoration: none;
+}
+a:visited {
+	text-decoration: none;
+	color: #1B433A;
+}
+a:hover {
+	text-decoration: none;
+	color: #1B433A;
+}
+a:active {
+	text-decoration: none;
+	color: #1B433A;
+}
+.style11 {color: #2A6D60; font-family: Geneva, Arial, Helvetica, sans-serif; font-weight: bold; }
+.style7 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style12 {color: #2A6D60}
+.style8 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style14 {font-size: 12px}
+.ac_ppinc_content{
+  background-color: #FFFFFF;
+  vertical-align : top;
+  height : 100%;
+  padding: 0px; 
+  padding-bottom: 25px;
+}
+.template_mainbackground{
+  background-color : #2A6D60;
+  border-color : #2A6D60;
+}
+.style14 {font-size: 12px}
+.template_image_no_border{
+  border : none;
+}
+.template_table_image_background{
+  background-image : url(backgroundbanner.gif);
+}
+.template_copyright{
+  background-color : #2A6D60;
+  text-align: center;
+  font-size: 10pt;
+  color: #FFFFFF;
+}
+a.copyright_link {
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+  color: #FFFF00;
+}
+.template_cartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 9pt;
+  color: #000000;
+}
+.template_checkoutcartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 11pt;
+  color: #000000;
+}
+.template_fonth1{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 17pt;
+  font-weight: bold;
+  color: #FFFFFF;
+}
+.template_fonth2{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 14pt;
+  font-weight: normal;
+  font-style : italic;
+  color: #FFFFFF;
+}
+a.ac_cart_info_links {
+  padding: 0px;
+  padding-right: 5px; 
+  padding-left: 5px;
+  font-size: 11pt;
+  font-weight: bold;
+  text-decoration : none;
+}
+.ac_left_nav{
+  width: 155px;
+  vertical-align : top;
+  padding: 0px;
+  padding-top: 15px;
+}
+a.ac_left_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 10px;
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+a.ac_left_sub_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 18px;
+  font-size: 9pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+-->
+</style>
diff -ruN 4.0K-4b/custom/README.txt 5.0.000/custom/README.txt
--- 4.0K-4b/custom/README.txt	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/custom/README.txt	1969-12-31 18:00:00.000000000 -0600
@@ -1,29 +0,0 @@
-Readme for Custom Code Directory for AgoraCart
------------------------------------
-April 21, 2000
-Revised June 15, 2000
-Revised August 22, 2000
-Revised September 15, 2000
-Revised May 7, 2003
-
-This directory is for installation of custom libraries.  The only thing
-that will be delivered in this directory are ".txt" files that might be
-useful to setting up custom perl libraries. 
-
-AgoraCart will automatically load the custom libraries if they are found
-in this directory.  You may place whatever code you like in such a
-library, including custom shipping logic or support routines for use with
-agorascript and code to load other libraries.  Only files ending in .pl
-are loaded, in fact all such files are loaded, so do not make anything
-other than a legitimate perl library have the .pl ending! 
-
-You should chmod .pl files in this dir 644.
-
-If you are using "secondary" (aka multiple) payment gateways, place them in this
-directory so they will be available at checkout time!   For example, zOffline will be
-your primary gateway set in main settings.  Then you wanted to use Authorize.Net and
-Offline as two gateways that you wish to offer.  Place copies of the the
-Offline-order_lib.pl as well as the AuthorizeNet-order_lib.pl files in this directory.  This will
-load those order libraries so that they are avialable for your order processing.
-
-
diff -ruN 4.0K-4b/custom/index.html 5.0.000/custom/index.html
--- 4.0K-4b/custom/index.html	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/custom/index.html	1969-12-31 18:00:00.000000000 -0600
@@ -1,8 +0,0 @@
-br><br><center>forwarding to the store ....</center>
-<script><!--
-
-setTimeout("window.location.href='../agora.cgi'",0)
-
-// -->
-
-		</script>
\ No newline at end of file
diff -ruN 4.0K-4b/data_files/data.file 5.0.000/data_files/data.file
--- 4.0K-4b/data_files/data.file	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/data_files/data.file	2006-10-31 09:40:27.000000000 -0600
@@ -1,10 +1,25 @@
-0001|PERL|23.96|Learning Perl|<IMG SRC="%%URLofImages%%/0001.gif" BORDER=0>|In this smooth, carefully paced course, a leading Perl trainer teaches you to program in the language that threatens to make C, sed, awk, and the Unix shell obsolete for many tasks. This book is the "official" guide for both formal (classroom) and informal learning. It is fully accessible to the novice programmer. <a href="http://www.amazon.com/exec/obidos/ASIN/1565922840/dial411com">Learn More</a>|4.95|||%%IMG%%sm_0001.gif|||%%OPTION%%var_opt.html
-0002|PERL|35.96|Programming Perl (2nd Edition)|<IMG SRC="%%URLofImages%%/0002.gif" BORDER=0>|Programming Perl, 2nd Edition, is the authoritative guide to Perl version 5, the scripting utility that has established itself as the programming tool of choice for the World Wide Web, UNIX system administration, and a vast range of other applications. Version 5 of Perl includes object oriented  programming facilities. The book is coauthored by Larry Wall, the creator of Perl. <a href="http://www.amazon.com/exec/obidos/ASIN/1565921496/dial411com">Learn More</a>|4.95|||%%IMG%%sm_0002.gif|||%%OPTION%%gift_option.html
-0003|PERL|31.96|Perl Cookbook|<IMG SRC="%%URLofImages%%/0003.gif" BORDER=0>|The Perl Cookbook is a comprehensive collection of problems, solutions, and practical examples for anyone programming in Perl. Topics range from beginner questions to techniques that even the most experienced Perl programmers can learn from. More than just a collection of tips and tricks, the Perl Cookbook is the long-awaited companion volume to Programming Perl, filled with previously unpublished Perl arcana. <a href="http://www.amazon.com/exec/obidos/ASIN/1565922433/dial411com">Learn More</a>|4.95|||%%IMG%%sm_0003.gif|||%%OPTION%%gift_option.html
-0004|PERL|15.19|Perl and CGI for the World Wide Web|<IMG SRC="%%URLofImages%%/0004.gif" BORDER=0>|Included on most UNIX platforms and available free of charge for Windows and Macintosh, Perl lets you place forms on your Web site   that collect and process user input such as product orders and comments, enable visitors to conduct keyword searches for information on your site, and integrate a database into your site, among many other capabilities. Perl and CGI for the... <a href="http://www.amazon.com/exec/obidos/ASIN/020135358X/dial411com">Learn More</a>|4.95|||%%IMG%%sm_0004.gif|||%%OPTION%%gift_option.html
-0005|PERL|27.96|Mastering Regular Expressions|<IMG SRC="%%URLofImages%%/0005.gif" BORDER=0>|Regular expressions is a powerful tool for manipulating text and data. In this book, the author leads you through the steps of crafting a regular expression that gets the job done. He examines a variety of tools and uses them in an extensive array of examples, dedicating an entire chapter to Perl. <a href="http://www.amazon.com/exec/obidos/ASIN/1565922573/dial411com">Learn More</a>|4.95|||%%IMG%%sm_0005.gif|||%%OPTION%%gift_option.html
-0006|HTML|27.96|HTML: The Definitive Guide|<IMG SRC="%%URLofImages%%/0006.gif" BORDER=0>|HTML is changing so fast it's almost impossible to keep up with developments. How do you know what's real, and how do you use it? The third edition of HTML: The Definitive Guide brings it all  together for you. It covers HTML, JavaScript, Style sheets, Layers, and all of the features supported by the popular Web browsers. <a  href="http://www.amazon.com/exec/obidos/ASIN/1565924924/dial411com">Learn More</a>|4.95|%%IMG%%sm_0006.gif|||||%%OPTION%%var_opt.html
-0007|HTML|31.96|Dynamic HTML: The Definitive Guide|<IMG SRC="%%URLofImages%%/0007.gif" BORDER=0>|Danny Goodman felt that he couldn't trust any of the documentation on Dynamic HTML (DHTML) that he read (too many contradictions), so he wrote this book as a reference for working with his own clients.  After testing tags and techniques on multiple releases of the main browsers, Goodman came up with very practical information--some of   which you may not find in any other resource.   <a href="http://www.amazon.com/exec/obidos/ASIN/1565924940/dial411com">Learn More</a>|4.95|%%img%%sm_0007.gif|||||%%OPTION%%gift_option.html
-0008|HTML|31.99|Dreamweaver 2 Bible|<IMG SRC="%%URLofImages%%/0008.gif" BORDER=0>|Dreamweaver 2 brings  you more control and more flexiblity than ever before. Whether you're creating heavy-action sites packed with sound effects, Shockwave movies, sophisticated animations, or data-driven, interactive sites for e-commerce, you'll find all the information you need to speed construction, smooth maintenance, and power up...<a href="http://www.amazon.com/exec/obidos/ASIN/0764533223/dial411com">Learn More</a>|4.95|%%img%%sm_0008.gif|||||%%OPTION%%gift_option.html
-0009|HTML|39.99|XML Bible|<IMG SRC="%%URLofImages%%/0009.gif" BORDER=0>|XML is revolutionizing Web-site development by making difficult tasks easier and many tasks possible. This thorough tutorial-plus-reference takes you step by step through everything you need to know to put XML to work, from the fundamentals of the XML language to document construction and simple XML-based solutions for specialized markup problems. <a href="http://www.amazon.com/exec/obidos/ASIN/0764532367/dial411com">Learn More</a>|4.95|%%img%%sm_0009.gif|||||%%OPTION%%gift_option.html
-0010|HTML|15.99|HTML Goodies|<IMG SRC="%%URLofImages%%/0010.gif" BORDER=0>|Joe Burns' fast and friendly approach to building a Web site keeps over 300,000 people coming back to his HTML Goodies Web site every month. Now Joe has gone way beyond the Web site with HTML Goodies, the book! Let Joe show you how easy HTML can be. After you've   mastered text formatting, creating links, and inserting graphics, HTML Goodies takes you far beyond HTML basics. <a href="http://www.amazon.com/exec/obidos/ASIN/0789718235/dial411com">Learn More</a>|4.95|%%img%%sm_0010.gif|||||%%OPTION%%gift_option.html
+00001|Programming|23.96|Learning Perl|<img src="%%URLofImages%%/0001.gif" alt="0001.gif">|In this smooth, carefully paced course, a leading Perl trainer teaches you to program in the language that threatens to make C, sed, awk, and the Unix shell obsolete for many tasks. This book is the "official" guide for both formal (classroom) and informal learning. It is fully accessible to the novice programmer. <a href="http://www.amazon.com/exec/obidos/ASIN/1565922840/dial411com">Learn More</a>|4.95|%%IMG%%sm_0001.gif||0|||%%OPTION%%blank.html
+00002|Hands Free|.03|Hands Free Cell Phone Attachment|<img src="%%URLofImages%%/handsfreecell_med.jpg" alt="handsfreecell_med.jpg">|This amazing and revolutionary hands free device turns any cell phone into instant brain implant, allowing you to become more efficient.  It allows you to go anywhere, even jogging. PLUS, it is the least expensive solution on the market... at an amazing 3 cents!  Order yours today! Better yet, order a hundred for all your friends too.<br /><br /><font color="red">Warning:</font> Side effects include: reduced blood circulation, lopsidedness, feelings of dizziness after long periods of use, blurred vision if you turn your head too quickly, mockery from the masses, one ear becoming flatter than the other, and lingering ringtones in the ears|1|%%IMG%%handsfreecell_sml.jpg|||||%%OPTION%%blank.html
+00006|HT2ML Books|27.96|HTML: The Definitive Guide|<img src="%%URLofImages%%/0006.gif" alt="0006.gif">|HTML is changing so fast it's almost impossible to keep up with developments. How do you know what's real, and how do you use it? The third edition of HTML: The Definitive Guide brings it all  together for you. It covers HTML, JavaScript, Style sheets, Layers, and all of the features supported by the popular Web browsers.|4.95|%%IMG%%sm_0006.gif|test.gif|20||84567|%%OPTION%%blank.html
+00007|Books|31.96|Dynamic HTML: The Definitive Guide|<img src="%%URLofImages%%/0007.gif" alt="0007.gif">|Danny Goodman felt that he couldn't trust any of the documentation on Dynamic HTML (DHTML) that he read (too many contradictions), so he wrote this book as a reference for working with his own clients. After testing tags and techniques on multiple releases of the main browsers, Goodman came up with very practical information--some of which you may not find in any other resource.  Test some meta characters $ @ # " ? +  ' & *|4.95|%%img%%sm_0007.gif||77|DHTML|92345|%%OPTION%%var_opt.html
+00008|Books|31.99|Dreamweaver 2 Bible|<img src="%%URLofImages%%/0008.gif" alt="0008.gif">|Dreamweaver 2 brings you more control and more flexiblity than ever before. Whether you're creating heavy-action sites packed with sound effects, Shockwave movies, sophisticated animations, or data-driven, interactive sites for e-commerce, you'll find all the information you need to speed construction, smooth maintenance, and power up.|4.95|%%IMG%%sm_0008.gif|||HTML::Adobe|92345|%%OPTION%%gift_option.html
+00009|Books|39.99|XML Bible|<img src="%%URLofImages%%/0009.gif" alt="0009.gif">|XML is revolutionizing Web-site development by making difficult tasks easier and many tasks possible. This thorough tutorial-plus-reference takes you step by step through everything you need to know to put XML to work, from the fundamentals of the XML language to document construction and simple XML-based solutions for specialized markup problems.|4.95|%%IMG%%sm_0009.gif||9|HTML||%%OPTION%%blank.html
+00010|Books|15.99|HTML Goodies|<img src="%%URLofImages%%/0010.gif" BORDER=0>|Joe Burns' fast and friendly approach to building a Web site keeps over 300,000 people coming back to his HTML Goodies Web site every month. Now Joe has gone way beyond the Web site with HTML Goodies, the book! Let Joe show you how easy HTML can be. After you've   mastered text formatting, creating links, and inserting graphics, HTML Goodies takes you far beyond HTML basics.|4.95|%%img%%sm_0010.gif|||||||||||||HTML||%%OPTION%%gift_option.html
+00011|Books|13.29|Flash 4 for Windows and Macintosh|<img src="%%URLofImages%%/0011.gif" alt="0011.gif">|This easy, visual approach to learning Flash takes the reader through the basics of vector drawing to the creation of animated multimedia files for the Web. Using this clear guide, professional Web designers, as well as hobbyists, can find out how to add sophisticated multimedia effects to their Web pages, without having to learn complicated scripting.|4.95|%%IMG%%sm_0011.gif||34|Multimedia::Flash||%%OPTION%%blank.html
+00012|Books|31.99|Flash 4! Creative Web Animation|<img src="%%URLofImages%%/0012.gif" alt="0012.gif">|All features and tools of Flash 4 covered in great detail, including an introduction to the authoring environment, drawing tools, working with text and sound, using bitmap images, working with symbols and instances, using and managing the libraries, working with layers, animation and interactivity, testing and publishing movies, and project planning and preparation.|4.95|%%IMG%%sm_0012.gif||0|Multimedia::Flash||%%OPTION%%blank.html
+00015|Books|27.99|Animation on the Web|<img src="%%URLofImages%%/0015.gif" BORDER=0>|As the Web evolves from a static publishing medium to one based more on active media and interactivity, animation is becoming a critical component of Web site design. The demand for animation on Web sites is skyrocketing. That's where Animation on the Web comes in: a thorough guide to everything having to do with Web animation.|4.95|%%IMG%%sm_0015.gif"|||||||||||||Multimedia||%%OPTION%%gift_option.html
+00016|Books|19.96|Unix in a Nutshell|<img src="%%URLofImages%%/0016.gif" alt="0016.gif">|You may have seen UNIX quick reference guides, but you've never seen anything like UNIX in a Nutshell. Not a scaled-down quick reference of common commands, UNIX in a Nutshell is a complete reference containing all commands and options, along with generous descriptions and examples that put the commands in context.|4.95|%%IMG%%sm_0016.gif||53|UNIX||%%OPTION%%blank.html
+00017|Books|47.96|Unix Power Tools|<img src="%%URLofImages%%/0017.gif" alt="0017.gif">|Loaded with even more practical advice about almost every aspect of UNIX, this new second edition of "UNIX Power Tools" addresses the technology that UNIX users face today. You'll find increased coverage of POSIX utilities, including GNU versions, greater "bash" and "tcsh" shell coverage, more emphasis on Perl, and a CD-ROM that contains some of the best freeware available.|4.95|%%IMG%%sm_0017.gif|||UNIX||%%OPTION%%var_opt_wild2.html
+00019|Books|15.99|Linux Complete|<img src="%%URLofImages%%/0019.gif" alt="0019.gif">|Everything you ever wanted to know about making Linux jump through hoops but felt too intimidated to ask. Coverage includes installation, device configuration, local area networking, dial-up networking with PPP, IP masquerading, DHCP setup, and IP chains.|4.95|%%IMG%%sm_0019.gif||40|UNIX||%%OPTION%%blank.html
+00020|Books|27.99|Red Hat Linux 6 Unleashed|<img src="%%URLofImages%%/0020.gif" alt="0020.gif">|Red Hat Linux 6 Unleashed shows you how to install, configure, and manage version 6.0, the latest version of Red Hat operating system. Version 6.0 boasts the latest Linux kernel, a new and improved installation program, updated libraries and a host of other improvements.|4.95|%%IMG%%sm_0020.gif||0|UNIX::Linux||%%OPTION%%blank.html
+00021|Machine Tooling|60.00|Kwik-Switch 200 Acura-Flex Collet Chuck|<img src="%%URLofImages%%/Pic1a.jpg" alt="Pic1a.jpg">|Excellent condition 3/4" capacity Kwik-Switch 200 Acura-Flex Collet Chuck, Universal Engineering #80237 body and #9400005 Nut. The nose bearing is free and smooth. It uses Acura-Flex collets which are readily available in sizes from 9/64" to 25/32". This unit will also accept 3/4" capacity Acura-Grip (#90750) and 3/4" capacity Acura-Mill collets with a #90751 nut. <br /><br /><ul><li> <a href="http://www.tools-n-gizmos.com/part_pics/10013Pics.html">More pictures</a></li><li> <a href="http://www.tools-n-gizmos.com/specs/AF_Collet.html#075">Acura-Flex Collet specs</a></li><li> <a href="http://www.tools-n-gizmos.com/specs/KS_AF_Collet_Chuck.html">Acura-Flex Chuck specs</a></li><li> <a href="http://www.tools-n-gizmos.com/specs/Tapers.html#KS">Kwik-Switch Shank specs</a></li><li> <a href="http://www.tools-n-gizmos.com/store/agora.cgi?&user2=yes&user4=Spnr&description=55139&ppinc=MT">Collet Nut Spanner</a></li></ul><br />Sample item Provided by:<br /><a href="http://www.tools-n-gizmos.com/store/agora.cgi?&p_id=10013&ppinc=1a">Tools-n-Gizmos.com</a><br /><br />|1|%%IMG%%Pic1b.jpg|||||%%OPTION%%blank.html
+00022|Machine Tooling|8.00|Acura-Flex Collets, 3/4" max capacity|<img src="%%URLofImages%%/Pic2a.jpg" alt="Pic2a.jpg">|Excellent condition Universal Acura-Flex collets. These collets cover the range from 1/8" (AF-95) to 25/32" (AF-140) and 3.5mm to 20mm. They fit 3/4" capacity Acura-Flex collet chucks.(80237, 80350, 80416 and many others). There are several manufacturers of AF collets (Universal Eng., Smith Tool, Collis, Centaur and others). Most of my AF collets are made by Universal (but the one you get my not be). <br /><br /><ul><li> <a href="http://www.tools-n-gizmos.com/part_pics/AF75EXPics.html">More pictures</a></li><li> <a href="http://www.tools-n-gizmos.com/specs/AF_Collet.html#075">AF Collet specs</a></li><li> <a href="http://www.tools-n-gizmos.com/specs/KS_AF_Collet_Chuck.html">Kwik-Switch AF Chuck specs</a></li></ul><br />Sample item Provided by:<br /><a href="http://www.tools-n-gizmos.com/store/agora.cgi?user2=yes&user4=CollAF75&titttle=Acura-Flex_0.75_inch_capacity_Collets_for_sale&ppinc=MT">Tools-n-Gizmos.com</a><br /><br />|1|%%IMG%%Pic2b.jpg|||||%%OPTION%%blank.html
+00023|Machine Tooling|60.00|Kwik-Switch 200 Acura-Flex Collet Chuck|<img src="%%URLofImages%%/Pic3a.jpg" alt="Pic3a.jpg">|Excellent condition 1/2" capacity Kwik-Switch 200 "Y" Collet Chuck, Universal Engineering # 80220 body and #551084 nut. It uses size Y #55097 (3/16" to 1/2") double taper collets which are readily available. <br /><br /><ul><li> <a href="http://www.tools-n-gizmos.com/part_pics/10098Pics.html">More pictures</a></li><li> <a href="http://www.tools-n-gizmos.com/specs/DT_Collet.html">DT Collet specs</a></li><li> <a href="http://www.tools-n-gizmos.com/specs/KS_DT_Collet_Chuck.html">DT Chuck specs</a></li><li> <a href="http://www.tools-n-gizmos.com/specs/Tapers.html#KS">Kwik-Switch Shank specs</a></li></ul><br />Sample item Provided by:<br /><a href="http://www.tools-n-gizmos.com/store/agora.cgi?&user2=yes&description=80220&user4=KS200,ColChk&titttle=0.5_in._capacity_Kwik-Switch_DT_Collet_Chucks&ppinc=MT">Tools-n-Gizmos.com</a><br /><br />|1|%%IMG%%Pic3b.jpg|||||%%OPTION%%blank.html
+00026|Art|999.99|Underachievement Poster|<img src="%%URLofImages%%/motivation_01m.jpg" alt="motivation_01m.jpg">|The Tallest Blade of Grass is the First to be Cut by the Lawnmower|1|%%IMG%%motivation_01s.jpg|motivation_01l.jpg||||%%OPTION%%blank.html
+00027|Art|999.99|Ambition Poster|<img src="%%URLofImages%%/motivation_02m.jpg" alt="motivation_02m.jpg">|The Journey of a Thousand Miles Sometimes Ends Very, Very Badly|1|%%IMG%%motivation_02s.jpg|motivation_02l.jpg||||%%OPTION%%blank.html
+00028|Art|999.99|Arrogance Poster|<img src="%%URLofImages%%/motivation_04m.jpg" alt="motivation_04m.jpg">|The Best Leaders Inspire by Example. When That's Not an Option, Brute Intimidation Works Well, Too.|1|%%IMG%%motivation_04s.jpg|motivation_04l.jpg||||%%OPTION%%blank.html
+00029|Art|999.99|Conformity Poster|<img src="%%URLofImages%%/motivation_05m.jpg" alt="motivation_05m.jpg">|When People are Free to do as They Please, They Usually Imitate Each Other.|1|%%IMG%%motivation_05s.jpg|motivation_05l.jpg||||%%OPTION%%blank.html
+00030|Art|999.99|Dysfunction Poster|<img src="%%URLofImages%%/motivation_06m.jpg" alt="motivation_06m.jpg">|The Only Consistent Feature of All of Your Dissatisfying Relationships is You|1|%%IMG%%motivation_06s.jpg|motivation_06l.jpg||||%%OPTION%%blank.html
+00031|Art|999.99|Individuality Poster|<img src="%%URLofImages%%/motivation_08m.jpg" alt="motivation_08m.jpg">|Always Remember That You Are Unique. Just Like Everybody Else.|1|%%IMG%%motivation_08s.jpg|motivation_08l.jpg||||%%OPTION%%blank.html
+00032|Art|999.99|Ignorance Poster|<img src="%%URLofImages%%/motivation_07m.jpg" alt="motivation_07m.jpg">|It's Amazing How Much Easier it is for a Team to Work Together When No One Has any Idea Where They're Going.|1|%%IMG%%motivation_07s.jpg|motivation_07l.jpg||||%%OPTION%%blank.html
+00033|Art|999.99|Teamwork Poster|<img src="%%URLofImages%%/motivation_10m.jpg" alt="motivation_10m.jpg">|A Few Harmless Flakes Working Together Can Unleash an Avalanche of Destruction|1|%%IMG%%motivation_10s.jpg|motivation_10l.jpg||||%%OPTION%%blank.html
\ No newline at end of file
diff -ruN 4.0K-4b/downloads/.htaccess 5.0.000/downloads/.htaccess
--- 4.0K-4b/downloads/.htaccess	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/downloads/.htaccess	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,8 @@
+AuthType "Basic"
+AuthName "Access Denied"
+
+AuthUserFile /dev/null
+
+<Limit GET>
+require valid-user
+</Limit>
\ No newline at end of file
diff -ruN 4.0K-4b/downloads/index.html 5.0.000/downloads/index.html
--- 4.0K-4b/downloads/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/downloads/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,8 @@
+br><br><center>forwarding to the store ....</center>
+<script><!--
+
+setTimeout("window.location.href='../agora.cgi'",0)
+
+// -->
+
+		</script>
\ No newline at end of file
diff -ruN 4.0K-4b/html/About_Us.htm 5.0.000/html/About_Us.htm
--- 4.0K-4b/html/About_Us.htm	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/About_Us.htm	2006-10-31 09:40:27.000000000 -0600
@@ -1,33 +1,28 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
-<title>AgoraCart %%agoracgi_ver%%</title>
-<style TYPE="text/css">
-<!--
-A.mainNav {font: 12pt Arial, Helvetica,Geneva;  color: #000000;  text-decoration: none}
-A.mainNav, A.mainNav:visited {font: 12pt Arial, Helvetica,Geneva;  color: #000000; text-decoration: none}
-A.mainNav:hover {font: 12pt Arial, Helvetica,Geneva;  color: #0000FF; text-decoration: none}
--->
-</style>
+<title>
+	AgoraCart %%agoracgi_ver%%
+</title>
+%%head_info%%
 </head>
 
-<body BGCOLOR="#ffffff">
+<body>
 %%StoreHeader%%
-<center><!--agorascript-pre 
-&capture_STDOUT; 
-&cartlinks;
-  print "<font face=\"Arial\" size=\"3\">";
-# take make links underlined
-# $cartlinks =~ s/style=\"text-decoration: none\"//ig;
-# to layout horizontally with 3 spaces
-# $cartlinks =~ s/<br>/&nbsp;&nbsp;&nbsp;/ig;
-# to layout horizontally with | dividers spaces
-$cartlinks =~ s/<br>/&nbsp;&nbsp;|&nbsp;&nbsp;/ig;
-print $cartlinks;
-  print "</font>";
-&uncapture_STDOUT;  --></center>
-<blockquote><br><br>
-information about your company..</blockquote>
+<div align="center" style="text-align:justify; padding: 20px 20px 20px 20px;">
 
+	<p>This page would contain information about your company. If you do not wish to
+		include this page then just delete it from the /html directory.
+	</p>
+	<p>
+		If you want to add other pages to the navigation list just upload
+		them to the pages directory and the script will list them here.
+	</p>
+	<p>
+		Just make sure that you name the file in proper case and include underscores,
+		"_", for spaces. Everything will show up exactly as how you save it.
+	</p>
+</div>
 %%StoreFooter%%
 </body>
 </html>
diff -ruN 4.0K-4b/html/Contact_Us.htm 5.0.000/html/Contact_Us.htm
--- 4.0K-4b/html/Contact_Us.htm	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/Contact_Us.htm	2006-10-31 09:40:27.000000000 -0600
@@ -1,33 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
-<title>AgoraCart %%agoracgi_ver%%</title>
-<style TYPE="text/css">
-<!--
-A.mainNav {font: 12pt Arial, Helvetica,Geneva;  color: #000000;  text-decoration: none}
-A.mainNav, A.mainNav:visited {font: 12pt Arial, Helvetica,Geneva;  color: #000000; text-decoration: none}
-A.mainNav:hover {font: 12pt Arial, Helvetica,Geneva;  color: #0000FF; text-decoration: none}
--->
-</style>
+<title>
+	AgoraCart %%agoracgi_ver%%
+</title>
+%%head_info%%
 </head>
 
-<body BGCOLOR="#ffffff">
+<body>
 %%StoreHeader%%
-<center>
-<!--agorascript-pre 
-&capture_STDOUT; 
-&cartlinks;
-  print "<font face=\"Arial\" size=\"3\">";
-# take make links underlined
-# $cartlinks =~ s/style=\"text-decoration: none\"//ig;
-# to layout horizontally with 3 spaces
-# $cartlinks =~ s/<br>/&nbsp;&nbsp;&nbsp;/ig;
-# to layout horizontally with | dividers spaces
-$cartlinks =~ s/<br>/&nbsp;&nbsp;|&nbsp;&nbsp;/ig;
-print $cartlinks;
-  print "</font>";
-&uncapture_STDOUT;  --></center>
-<blockquote><br><br>
-Your contact information</blockquote>
+<div align="center" style="text-align:justify; padding: 20px 20px 20px 20px;">
+
+	<p>This page would contain your contact information. If you do not wish to
+		include this page then just delete it from the /html directory.
+	</p>
+	<p>
+		If you want to add other pages to the navigation list just upload
+		them to the pages directory and the script will list them here.
+	</p>
+	<p>
+		Just make sure that you name the file in proper case and include underscores,
+		"_", for spaces. Everything will show up exactly as how you save it.
+	</p>
+</div>
 %%StoreFooter%%
 </body>
 </html>
+
diff -ruN 4.0K-4b/html/Return_Policy.htm 5.0.000/html/Return_Policy.htm
--- 4.0K-4b/html/Return_Policy.htm	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/Return_Policy.htm	2006-10-31 09:40:27.000000000 -0600
@@ -1,40 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
-<title>AgoraCart %%agoracgi_ver%%</title>
-<style TYPE="text/css">
-<!--
-A.mainNav {font: 12pt Arial, Helvetica,Geneva;  color: #000000;  text-decoration: none}
-A.mainNav, A.mainNav:visited {font: 12pt Arial, Helvetica,Geneva;  color: #000000; text-decoration: none}
-A.mainNav:hover {font: 12pt Arial, Helvetica,Geneva;  color: #0000FF; text-decoration: none}
--->
-</style>
+<title>
+	AgoraCart %%agoracgi_ver%%
+</title>
+%%head_info%%
 </head>
 
-<body BGCOLOR="#ffffff">
+<body>
 %%StoreHeader%%
+<div align="center" style="text-align:justify; padding: 20px 20px 20px 20px;">
 
-<center>
-<!--agorascript-pre 
-&capture_STDOUT; 
-&cartlinks;
-  print "<font face=\"Arial\" size=\"3\">";
-# take make links underlined
-# $cartlinks =~ s/style=\"text-decoration: none\"//ig;
-# to layout horizontally with 3 spaces
-# $cartlinks =~ s/<br>/&nbsp;&nbsp;&nbsp;/ig;
-# to layout horizontally with | dividers spaces
-$cartlinks =~ s/<br>/&nbsp;&nbsp;|&nbsp;&nbsp;/ig;
-print $cartlinks;
-  print "</font>";
-&uncapture_STDOUT;  --></center>
+	<p>
+		This page would contain your return policy. If you do not wish to
+		include this page then just delete it from the /html directory.
+	</p>
+	<p>
+		If you want to add other pages to the navigation list just upload
+		them to the pages directory and the script will list them here.
+	</p>
+	<p>
+		Just make sure that you name the file in proper case and include underscores,
+		"_", for spaces. Everything will show up exactly as how you save it.
+	</p>
 
-<blockquote><br><br>
-This page would contain your return policy. If you do not wish to include this page then just delete it from the pages directory.
-<br><br>
-If you want to add other pages to the navigation list just upload them to the pages directory and the script will list them here.
-<br><br>
-Just make sure that you name the file in proper case and include spaces, because it will show up exactly as how you save it.
-</blockquote>
+</div>
 %%StoreFooter%%
 </body>
 </html>
diff -ruN 4.0K-4b/html/error.html 5.0.000/html/error.html
--- 4.0K-4b/html/error.html	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/error.html	2006-10-31 09:40:27.000000000 -0600
@@ -1,48 +1,33 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
-<title>AgoraCart ERROR Page</TITLE>
-
+<title>AgoraCart %%agoracgi_ver%% ERROR Page</title>
+%%head_info%%
 </head>
 
-<body bgcolor="#ffffff" text="#000000">
-<DIV ALIGN="CENTER">
-<!--agorascript-post 
-&capture_STDOUT; 
-&StoreHeader;
-return &uncapture_STDOUT;  --><br>
-<center>
-<!--agorascript-pre 
-&capture_STDOUT; 
-&cartlinks;
-  print "<font face=\"Arial\" size=\"3\">";
-# take make links underlined
-# $cartlinks =~ s/style=\"text-decoration: none\"//ig;
-# to layout horizontally with 3 spaces
-# $cartlinks =~ s/<br>/&nbsp;&nbsp;&nbsp;/ig;
-# to layout horizontally with | dividers spaces
-$cartlinks =~ s/<br>/&nbsp;&nbsp;|&nbsp;&nbsp;/ig;
-print $cartlinks;
-  print "</font>";
-&uncapture_STDOUT;  --></center>
-<br><br>
+<body>
+%%StoreHeader%%
+<div align="center" style="text-align:center; padding: 20px 20px 20px 20px;">
 
-<table WIDTH="530" BGCOLOR="#FFFFFF" BORDER="0" CELLPADDING="0"
-CELLSPACING="0">
-<tr><td>
-<br><br><br>
-We're sorry, an error has occured.  Please hit the browser back
-button, change what was done in error, and try again.
-</td></tr>
-</table>
-</div>
+	<div class="ac_vertical_links">
+		<!--agorascript-pre
+		# TO ADJUST THE LOOK OF THESE LINKS
+		# EDIT THE CREATE A NEW CLASS OR
+		# ADJUST THIS ONE
+		&capture_STDOUT;
+		&cartlinks;
+		print $cartlinks;
+		&uncapture_STDOUT;  -->
+	</div>
 
-<br><br><br>
-<hr width=550>
-<center>
-<!--agorascript-post 
-&capture_STDOUT; 
-&StoreFooter;
-return &uncapture_STDOUT;  -->
-</center>
+	<hr/>
+	<p>
+		We're sorry, an error has occured.<br/>
+		Please hit the browser back button, change what was done in error, and try again.
+	</p>
+	<hr/>
+
+</div>
+%%StoreFooter%%
 </body>
-</html>
+</html>
\ No newline at end of file
diff -ruN 4.0K-4b/html/forms/2checkout-orderform.html 5.0.000/html/forms/2checkout-orderform.html
--- 4.0K-4b/html/forms/2checkout-orderform.html	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/forms/2checkout-orderform.html	2006-10-31 09:40:27.000000000 -0600
@@ -1,17 +1,23 @@
-<HTML>
-<HEAD>
-<TITLE>Step One</TITLE>
-</HEAD>
-<!--2check-orderform
- &Authnet_check_and_load;
+<html>
+<head>
+<title>Step One</title>
+</head>
+<!--agorascript-orderform
+ &checkout_order_form_prep;
 -->
-<BODY BGCOLOR="#ffffff">
+<body>
 
-<H2>CART CONTENTS HERE</H2>
+<h2>CART CONTENTS HERE</h2>
 
-<CENTER>
-
-<TABLE WIDTH="550" BORDER="0">
+<div align="center">
+<table class="ac_checkout">
+<!--agorascript-pre
+if ("$sc_2checkout_top_message" ne "") { return 
+q~<TR>
+<TD COLSPAN="2"><br><blockquote>$sc_2checkout_top_message</blockquote></TD>
+</TR>~
+;}
+-->
 
 <TR>
 <TD COLSPAN="2">
@@ -19,47 +25,54 @@
 </TD>
 </TR>
 
-<TR BGCOLOR="#C0FFFF">
+<TR>
 <TD>
 
-<TABLE WIDTH="550" BORDER="1">
-<TR BGCOLOR="#C0FFFF">
-<TD ALIGN="CENTER" colspan=3><FONT FACE="ARIAL" SIZE="2"
-COLOR="#000000">Please select where your order will be shipped and 
-click 'Next'</FONT></TD>
-</tr>
-<tr>
-   <td colspan=3>Method:&nbsp;&nbsp;&nbsp;
-<SELECT NAME="Ecom_ShipTo_Method">
-<OPTION VALUE="UPS Ground (GNDRES)" CHECKED>
-UPS Ground</OPTION>
-<OPTION VALUE="UPS 2nd Day (2DA)">
-UPS 2nd Day</OPTION>
-<OPTION VALUE="UPS Next Day (1DA)">
-UPS Next Day</OPTION>
-<OPTION VALUE="FEDEX Priority Overnight (Express,Priority Overnight)">
-FedEx Priority Overnight</OPTION>
-<OPTION VALUE="FEDEX Express (Express,Express Saver)">
-FedEx Express Saver</OPTION>
-<OPTION VALUE="FEDEX Ground (Ground,Ground)">
-FedEx Ground</OPTION>
-<OPTION VALUE="FEDEX Home Delivery (Home,Home)">
-FedEx Home Delivery</OPTION>
-<OPTION VALUE="USPS Parcel Post (Parcel)">
-USPS Parcel Post</OPTION>
-<OPTION VALUE="USPS Priority Mail (Priority)">
-USPS Priority Mail</OPTION>
-<OPTION VALUE="USPS Express Mail (Express)">
-USPS Express Mail</OPTION>
-</SELECT></TD>
- </tr>
-      
-<TR BGCOLOR="#C0FFFF">
-<TD ALIGN="CENTER" colspan=1>Zip/Postal Code
-<INPUT TYPE=TEXT NAME="Ecom_ShipTo_Postal_PostalCode" size=5></td>
-<TD ALIGN="CENTER" colspan=1>
-<SELECT NAME="Ecom_ShipTo_Postal_StateProv">
-<OPTION VALUE="">Select State</OPTION>
+<TABLE>
+<TR>
+<td colspan=2 class="ac_checkout_top_col">
+Please enter initial info needed to compute your shipping</td>
+</tr>
+<tr>
+<td class="ac_checkout_left_col">Method:</td>
+<td class="ac_checkout_right_col">
+<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER BELOW THIS-->
+
+<select name="Ecom_ShipTo_Method">
+<option value="$vform_Ecom_ShipTo_Method"><!--agorascript-pre
+ if ("$vform_Ecom_ShipTo_Method" eq "") {
+   return " Select Shipping Method ";
+  } else {
+   return "$vform_Ecom_ShipTo_Method";
+  }
+--></option>
+<option value="Electronic Delivery">Electronic Delivery</option>
+<option value="Local Delivery">	Local Delivery</option>
+<option value="Pickup">Pickup</option>
+<option value="USPS Parcel Post (Parcel)">USPS Parcel Post (5-14 days)</option>
+<option value="USPS Priority Mail (Priority)">USPS Priority Mail (3-7 days)</option>
+<option value="USPS Express Mail (Express)">USPS Express Mail (1-3 days)</option>
+<option value="USPS (Economy (Surface) Parcel Post)">Economy (Surface) Parcel Post (4-6 weeks - international)</option>
+<option value="USPS (Airmail Parcel Post)">Airmail Parcel Post (4-10 days - international)</option>
+<option value="USPS (Global Express Mail)">Global Express Mail (3-5 days - international)</option>
+<option value="USPS (Global Express Guaranteed Document Service)">Global Express Guaranteed - Non-Document (2-3 days - international)</option>
+<option value="UPS 3 Day Select (3DS)">UPS 3 Day Select (3-4 days)</option>
+<option value="UPS 2nd Day Air (2DA)">UPS 2nd Day Air</option>
+<option value="UPS Next Day Air (1DA)">UPS Next Day Air</option>
+<OPTION VALUE="UPS Ground Residential(GNDRES)">UPS Ground Residential</OPTION>
+<OPTION VALUE="UPS Ground Commercial (GNDCOM)">UPS Ground Commercial</OPTION>
+</select>
+
+
+<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER ABOVE THIS-->
+</td>
+</TR>
+<tr>
+<td class="ac_checkout_left_col">State/Province:</td>
+<td class="ac_checkout_right_col">
+<select name="Ecom_ShipTo_Postal_StateProv">
+<option value="$vform_Ecom_ShipTo_Postal_StateProv">$vform_Ecom_ShipTo_Postal_StateProv &nbsp;</option>
+<OPTION value="">---USA---</OPTION>
 <OPTION>AK</OPTION>
 <OPTION>AL</OPTION> 
 <OPTION>AR</OPTION>
@@ -113,28 +126,237 @@
 <OPTION>WA</OPTION> 
 <OPTION>WI</OPTION>
 <OPTION>WV</OPTION> 
-<OPTION>WY</OPTION> 
+<OPTION>WY</OPTION>
+<OPTION value=""></OPTION>
+<OPTION value="">--AUSTRALIA--</OPTION>
+<OPTION value="ACT">ACT</OPTION>
+<OPTION value="NSW">NSW</OPTION>
+<OPTION value="NT">NT</OPTION>
+<OPTION value="QLD">QLD</OPTION>
+<OPTION value="SA">SA</OPTION>
+<OPTION value="TAS">TAS</OPTION>
+<OPTION value="VIC">VIC</OPTION>
+<OPTION value="WA">WA</OPTION>
+<OPTION value=""></OPTION>
+<OPTION value="">--CANADA--</OPTION>
+<OPTION value="AB">AB</OPTION>
+<OPTION value="BC">BC</OPTION>
+<OPTION value="MB">MB</OPTION>
+<OPTION value="NB">NB</OPTION>
+<OPTION value="NFLD">NFLD</OPTION>
+<OPTION value="NWT">NWT</OPTION>
+<OPTION value="NS">NS</OPTION>
+<OPTION value="ON">ON</OPTION>
+<OPTION value="PEI">PEI</OPTION>
+<OPTION value="PQ">PQ</OPTION>
+<OPTION value="SK">SK</OPTION>
+<OPTION value="YK">YK</OPTION>
+<OPTION value="">--UK / England--</OPTION>
+<OPTION value="Aberdeen City">Aberdeen City</OPTION>
+<OPTION value="Aberdeenshire">Aberdeenshire</OPTION>
+<OPTION value="Angus">Angus</OPTION>
+<OPTION value="Argyll & Bute">Argyll & Bute</OPTION>
+<OPTION value="Bath & North East Somerset">Bath & North East Somerset</OPTION>
+<OPTION value="Bedfordshire">Bedfordshire</OPTION>
+<OPTION value="Berkshire">Berkshire</OPTION>
+<OPTION value="Blaenau Gwent">Blaenau Gwent</OPTION>
+<OPTION value="Bridgend">Bridgend</OPTION>
+<OPTION value="Bristol">Bristol</OPTION>
+<OPTION value="Buckinghamshire">Buckinghamshire</OPTION>
+<OPTION value="Caerphilly ">Caerphilly </OPTION>
+<OPTION value="Cambridgeshire">Cambridgeshire</OPTION>
+<OPTION value="Cardiff">Cardiff</OPTION>
+<OPTION value="Carmarthenshire">Carmarthenshire</OPTION>
+<OPTION value="Ceredidgion">Ceredidgion</OPTION>
+<OPTION value="Cheshire">Cheshire</OPTION>
+<OPTION value="ClackMannanshire">ClackMannanshire</OPTION>
+<OPTION value="Conwy">Conwy</OPTION>
+<OPTION value="Cornwall">Cornwall</OPTION>
+<OPTION value="Cumbria">Cumbria</OPTION>
+<OPTION value="Denbighshire">Denbighshire</OPTION>
+<OPTION value="Derbyshire">Derbyshire</OPTION>
+<OPTION value="Devon">Devon</OPTION>
+<OPTION value="Dorset">Dorset</OPTION>
+<OPTION value="Dumfries & Galloway">Dumfries & Galloway</OPTION>
+<OPTION value="Dundee City">Dundee City</OPTION>
+<OPTION value="Durham">Durham</OPTION>
+<OPTION value="East Ayrshire">East Ayrshire</OPTION>
+<OPTION value="East Dunbartonshire">East Dunbartonshire</OPTION>
+<OPTION value="East Lothian">East Lothian</OPTION>
+<OPTION value="East Renfrewshire">East Renfrewshire</OPTION>
+<OPTION value="East Riding of Yorkshire">East Riding of Yorkshire</OPTION>
+<OPTION value="East Sussex">East Sussex</OPTION>
+<OPTION value="Edinburgh">Edinburgh</OPTION>
+<OPTION value="Essex">Essex</OPTION>
+<OPTION value="Falkirk">Falkirk</OPTION>
+<OPTION value="Fife">Fife</OPTION>
+<OPTION value="Flintshire">Flintshire</OPTION>
+<OPTION value="Glasgow">Glasgow</OPTION>
+<OPTION value="Gloucestershire">Gloucestershire</OPTION>
+<OPTION value="Greater Manchester">Greater Manchester</OPTION>
+<OPTION value="Gwynedd">Gwynedd</OPTION>
+<OPTION value="Hampshire">Hampshire</OPTION>
+<OPTION value="Herefordshire">Herefordshire</OPTION>
+<OPTION value="Hertfordshire">Hertfordshire</OPTION>
+<OPTION value="Highlands">Highlands</OPTION>
+<OPTION value="Inverclyde">Inverclyde</OPTION>
+<OPTION value="Isle of Anglesey">Isle of Anglesey</OPTION>
+<OPTION value="Kent">Kent</OPTION>
+<OPTION value="Lancashire">Lancashire</OPTION>
+<OPTION value="Leicestershire">Leicestershire</OPTION>
+<OPTION value="Lincolnshire">Lincolnshire</OPTION>
+<OPTION value="London">London</OPTION>
+<OPTION value="Merseyside">Merseyside</OPTION>
+<OPTION value="Merthyr Tydfil">Merthyr Tydfil</OPTION>
+<OPTION value="Midlothian">Midlothian</OPTION>
+<OPTION value="Monmouthshire">Monmouthshire</OPTION>
+<OPTION value="Moray">Moray</OPTION>
+<OPTION value="Neath Port Talbot">Neath Port Talbot</OPTION>
+<OPTION value="Newport">Newport</OPTION>
+<OPTION value="Norfolk">Norfolk</OPTION>
+<OPTION value="North Ayrshire">North Ayrshire</OPTION>
+<OPTION value="North Lanarkshire">North Lanarkshire</OPTION>
+<OPTION value="North Somerset">North Somerset</OPTION>
+<OPTION value="North Yorkshire">North Yorkshire</OPTION>
+<OPTION value="Northamptonshire">Northamptonshire</OPTION>
+<OPTION value="Northumberland">Northumberland</OPTION>
+<OPTION value="Nottinghamshire">Nottinghamshire</OPTION>
+<OPTION value="Orkney">Orkney</OPTION>
+<OPTION value="Oxfordshire">Oxfordshire</OPTION>
+<OPTION value="Pembrokeshire">Pembrokeshire</OPTION>
+<OPTION value="Perth & Kinross">Perth & Kinross</OPTION>
+<OPTION value="Powys">Powys</OPTION>
+<OPTION value="Renfrewshire">Renfrewshire</OPTION>
+<OPTION value="Rhondda Cynon Taff">Rhondda Cynon Taff</OPTION>
+<OPTION value="Rutland">Rutland</OPTION>
+<OPTION value="Scottish Borders">Scottish Borders</OPTION>
+<OPTION value="Shetland">Shetland</OPTION>
+<OPTION value="Shropshire">Shropshire</OPTION>
+<OPTION value="Somerset">Somerset</OPTION>
+<OPTION value="South Lanarkshire">South Lanarkshire</OPTION>
+<OPTION value="South Yorkshire">South Yorkshire</OPTION>
+<OPTION value="Staffordshire">Staffordshire</OPTION>
+<OPTION value="Stirling">Stirling</OPTION>
+<OPTION value="Suffolk">Suffolk</OPTION>
+<OPTION value="Surrey">Surrey</OPTION>
+<OPTION value="Swansea">Swansea</OPTION>
+<OPTION value="Teesside">Teesside</OPTION>
+<OPTION value="Torfaen">Torfaen</OPTION>
+<OPTION value="Tyne & Wear">Tyne & Wear</OPTION>
+<OPTION value="Vale of Glamorgan">Vale of Glamorgan</OPTION>
+<OPTION value="Warwickshire">Warwickshire</OPTION>
+<OPTION value="West Dunbartonshire">West Dunbartonshire</OPTION>
+<OPTION value="West Lothian">West Lothian</OPTION>
+<OPTION value="West Midlands">West Midlands</OPTION>
+<OPTION value="West Sussex">West Sussex</OPTION>
+<OPTION value="West Yorkshire">West Yorkshire</OPTION>
+<OPTION value="Western Isles">Western Isles</OPTION>
+<OPTION value="Wiltshire">Wiltshire</OPTION>
+<OPTION value="Worcestershire">Worcestershire</OPTION>
+<OPTION value="Wrexham">Wrexham</OPTION>
+</select>
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">Zip/Postal Code:</td>
+<td class="ac_checkout_right_col">
+  <input type="text" name="Ecom_ShipTo_Postal_PostalCode"
+    value="$eform_Ecom_ShipTo_Postal_PostalCode" size="11" maxlength="11">
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">Country:</td>
+<td class="ac_checkout_right_col">
+  <SELECT NAME="Ecom_ShipTo_Postal_CountryCode">
+<OPTION VALUE="$vform_Ecom_ShipTo_Postal_CountryCode">$vform_Ecom_ShipTo_Postal_CountryCode
+<OPTION>United States
+<OPTION>Australia
+<OPTION>Canada
+<OPTION>Ireland
+<OPTION>Puerto Rico
+<OPTION>Scotland
+<OPTION>United Kingdom
+<OPTION>Wales
+<OPTION></option>
+<OPTION>American Samoa
+<OPTION>Argentina
+<OPTION>Austria
+<OPTION>Belgium
+<OPTION>Belize
+<OPTION>Brazil
+<OPTION>Chile
+<OPTION>Costa Rica
+<OPTION>Denmark
+<OPTION>Dominican Republic
+<OPTION>Finland
+<OPTION>France
+<OPTION>Germany
+<OPTION>Greece
+<OPTION>Guatemala
+<OPTION>Hong Kong
+<OPTION>Israel
+<OPTION>Italy
+<OPTION>Jamaica
+<OPTION>Mexico
+<OPTION>Netherlands
+<OPTION>New Zealand
+<OPTION>Norway
+<OPTION>Panama
+<OPTION>Portugal
+<OPTION>Spain
+<OPTION>Sweden
+<OPTION>Switzerland
+<OPTION>Taiwan
+<OPTION>Tonga
+<OPTION>Virgin Islands (US)
 </SELECT>
-</TD>
-<TD ALIGN="CENTER" colspan=1><INPUT
-TYPE=HIDDEN NAME="gateway" VALUE="2checkout">
-<INPUT TYPE=submit NAME ="submit_order_form_button" VALUE = "Next"></TD>
+</td>
+</tr>
+<tr>
+<td class="ac_checkout_left_col" colspan=2><input type="checkbox" name="Ecom_is_Residential" value="Ship to Residential Address">  Is this a Residential Address?
+</td>
+</tr>
+<!--agorascript-pre
+# inspired from solutions submitted from Dan at CartSoutions.net
+if ("$sc_display_checkout_tos" =~ /yes/i) { return
+q~
+<td colspan=2 class="ac_checkout_top_col">
+Terms of Service & Our Contact Information</td>
+</tr>
+<tr>
+<td colspan=2 class="ac_checkout_right_col">
+$sc_tos_display_address<br><br>
+You must read the following link before you can continue:  <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="agora.cgi?page=terms_of_service.html" TARGET="_blank"><b>Sales/Terms of Service and Refund Policy</b></A>.<br>
+Then put a tick in the box below. By selecting &quot;I Agree&quot; you are acknowledging that you have read and agree to our policies contained within that page.
+<br><br>
+<input type="checkbox" name="Ecom_tos" value="I Agree">&nbsp;&nbsp;&nbsp; I Agree and have read the Terms of Service listed above (required to continue)<br><br></td>
+</tr>
+~;} -->
+
+<tr>
+<td class="ac_checkout_left_col">Special Notes:</td>
+<td class="ac_checkout_right_col">
+  <textarea name="Ecom_XCOMMENT_Special_Notes" cols="50" rows="5">$eform_Ecom_XCOMMENT_Special_Notes</textarea>
+</td>
+</tr>
+<TR>
+<TD COLSPAN="2" ALIGN="CENTER"><INPUT 
+TYPE=HIDDEN NAME="gateway" VALUE="2checkout"><INPUT 
+TYPE=submit NAME = "submit_order_form_button"  
+VALUE = "next"></TD>
 </TR>
 </TABLE>
 
 </TD>
 </TR>
 </TABLE>
-
 </CENTER>
-
 </FONT>
-
 </CENTER>
-
+</div>
 </FORM>
-
 </BODY>
-
 </HTML>
 
diff -ruN 4.0K-4b/html/forms/AgoraPay-orderform.html 5.0.000/html/forms/AgoraPay-orderform.html
--- 4.0K-4b/html/forms/AgoraPay-orderform.html	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/forms/AgoraPay-orderform.html	2006-10-31 09:40:27.000000000 -0600
@@ -12,7 +12,14 @@
 
 <CENTER>
 
-<TABLE WIDTH="530" BORDER="0">
+<TABLE class="ac_checkout">
+<!--agorascript-pre
+if ("$sc_agorapay_top_message" ne "") { return 
+q~<TR>
+<TD COLSPAN="2"><br><blockquote>$sc_agorapay_top_message</blockquote></TD>
+</TR>~
+;}
+-->
 
 <TR>
 <TD COLSPAN="2">
@@ -20,20 +27,22 @@
 </TD>
 </TR>
 
-<TR BGCOLOR="#C0FFFF">
+<TR>
 <TD>
 
-<TABLE WIDTH="550" BORDER="1">
-<TR BGCOLOR="#C0FFFF">
-<TD ALIGN="CENTER" colspan=3><FONT FACE="ARIAL" SIZE="2"
-COLOR="#000000">Please select where your order will be shipped/billed and 
-click 'Next'</FONT></TD>
+<TABLE>
+<TR>
+<TD colspan=2 class="ac_checkout_top_col">
+Please select where your order will be shipped/billed
 </tr>
 <tr>
 
-<TR BGCOLOR="#C0FFFF">
-<TD ALIGN="RIGHT" colspan=1>Shipping Method:</TD>
-<TD ALIGN="LEFT" COLSPAN=1>
+<TR>
+<TD class="ac_checkout_left_col">Shipping Method:</TD>
+<TD class="ac_checkout_right_col">
+
+<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER BELOW THIS-->
+
 <SELECT NAME="Ecom_ShipTo_Method">
 <!--agorascript-pre 
  if ("$vform_Ecom_ShipTo_Method" ne "") {
@@ -44,33 +53,34 @@
    return '<OPTION VALUE="UPS Ground (GNDRES)" CHECKED>UPS Ground';
   }
 --></OPTION>
-<OPTION VALUE="UPS 2nd Day (2DA)">
-UPS 2nd Day</OPTION>
-<OPTION VALUE="UPS Next Day (1DA)">
-UPS Next Day</OPTION>
-<OPTION VALUE="FEDEX Priority Overnight (Express,Priority Overnight)">
-FedEx Priority Overnight</OPTION>
-<OPTION VALUE="FEDEX Express (Express,Express Saver)">
-FedEx Express Saver</OPTION>
-<OPTION VALUE="FEDEX Ground (Ground,Ground)">
-FedEx Ground</OPTION>
-<OPTION VALUE="FEDEX Home Delivery (Home,Home)">
-FedEx Home Delivery</OPTION>
-<OPTION VALUE="USPS Parcel Post (Parcel)">
-USPS Parcel Post</OPTION>
-<OPTION VALUE="USPS Priority Mail (Priority)">
-USPS Priority Mail</OPTION>
-<OPTION VALUE="USPS Express Mail (Express)">
-USPS Express Mail</OPTION>
-</SELECT>
+<option value="Electronic Delivery">Electronic Delivery</option>
+<option value="Local Delivery">	Local Delivery</option>
+<option value="Pickup">Pickup</option>
+<option value="USPS Parcel Post (Parcel)">USPS Parcel Post (5-14 days)</option>
+<option value="USPS Priority Mail (Priority)">USPS Priority Mail (3-7 days)</option>
+<option value="USPS Express Mail (Express)">USPS Express Mail (1-3 days)</option>
+<option value="USPS (Economy (Surface) Parcel Post)">Economy (Surface) Parcel Post (4-6 weeks - international)</option>
+<option value="USPS (Airmail Parcel Post)">Airmail Parcel Post (4-10 days - international)</option>
+<option value="USPS (Global Express Mail)">Global Express Mail (3-5 days - international)</option>
+<option value="USPS (Global Express Guaranteed Document Service)">Global Express Guaranteed - Non-Document (2-3 days - international)</option>
+<option value="UPS 3 Day Select (3DS)">UPS 3 Day Select (3-4 days)</option>
+<option value="UPS 2nd Day Air (2DA)">UPS 2nd Day Air</option>
+<option value="UPS Next Day Air (1DA)">UPS Next Day Air</option>
+<OPTION VALUE="UPS Ground Residential(GNDRES)">UPS Ground Residential</OPTION>
+<OPTION VALUE="UPS Ground Commercial (GNDCOM)">UPS Ground Commercial</OPTION>
+</select>
+
+<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER ABOVE THIS-->
+
 </td>
 </TR>
-<TR BGCOLOR="#C0FFFF">
-<TD ALIGN="RIGHT" colspan=1>State:</TD>
-<TD ALIGN="LEFT" colspan=1>
-<SELECT NAME="Ecom_ShipTo_Postal_StateProv">
-<OPTION VALUE="$eform_Ecom_ShipTo_Postal_StateProv"
->$eform_Ecom_ShipTo_Postal_StateProv &nbsp;</OPTION>
+
+<tr>
+<td class="ac_checkout_left_col">State/Province:</td>
+<td class="ac_checkout_right_col">
+<select name="Ecom_ShipTo_Postal_StateProv">
+<option value="$eform_Ecom_ShipTo_Postal_StateProv">$eform_Ecom_ShipTo_Postal_StateProv &nbsp;</option>
+<OPTION>---USA---</OPTION>
 <OPTION>AK</OPTION>
 <OPTION>AL</OPTION> 
 <OPTION>AR</OPTION>
@@ -124,16 +134,226 @@
 <OPTION>WA</OPTION> 
 <OPTION>WI</OPTION>
 <OPTION>WV</OPTION> 
-<OPTION>WY</OPTION> 
+<OPTION>WY</OPTION>
+<OPTION value=""></OPTION>
+<OPTION value="">--AUSTRALIA--</OPTION>
+<OPTION value="ACT">ACT</OPTION>
+<OPTION value="NSW">NSW</OPTION>
+<OPTION value="NT">NT</OPTION>
+<OPTION value="QLD">QLD</OPTION>
+<OPTION value="SA">SA</OPTION>
+<OPTION value="TAS">TAS</OPTION>
+<OPTION value="VIC">VIC</OPTION>
+<OPTION value="WA">WA</OPTION>
+<OPTION value=""></OPTION>
+<OPTION value="">--CANADA--</OPTION>
+<OPTION value="AB">AB</OPTION>
+<OPTION value="BC">BC</OPTION>
+<OPTION value="MB">MB</OPTION>
+<OPTION value="NB">NB</OPTION>
+<OPTION value="NFLD">NFLD</OPTION>
+<OPTION value="NWT">NWT</OPTION>
+<OPTION value="NS">NS</OPTION>
+<OPTION value="ON">ON</OPTION>
+<OPTION value="PEI">PEI</OPTION>
+<OPTION value="PQ">PQ</OPTION>
+<OPTION value="SK">SK</OPTION>
+<OPTION value="YK">YK</OPTION>
+<OPTION value="">--UK / England--</OPTION>
+<OPTION value="Aberdeen City">Aberdeen City</OPTION>
+<OPTION value="Aberdeenshire">Aberdeenshire</OPTION>
+<OPTION value="Angus">Angus</OPTION>
+<OPTION value="Argyll & Bute">Argyll & Bute</OPTION>
+<OPTION value="Bath & North East Somerset">Bath & North East Somerset</OPTION>
+<OPTION value="Bedfordshire">Bedfordshire</OPTION>
+<OPTION value="Berkshire">Berkshire</OPTION>
+<OPTION value="Blaenau Gwent">Blaenau Gwent</OPTION>
+<OPTION value="Bridgend">Bridgend</OPTION>
+<OPTION value="Bristol">Bristol</OPTION>
+<OPTION value="Buckinghamshire">Buckinghamshire</OPTION>
+<OPTION value="Caerphilly ">Caerphilly </OPTION>
+<OPTION value="Cambridgeshire">Cambridgeshire</OPTION>
+<OPTION value="Cardiff">Cardiff</OPTION>
+<OPTION value="Carmarthenshire">Carmarthenshire</OPTION>
+<OPTION value="Ceredidgion">Ceredidgion</OPTION>
+<OPTION value="Cheshire">Cheshire</OPTION>
+<OPTION value="ClackMannanshire">ClackMannanshire</OPTION>
+<OPTION value="Conwy">Conwy</OPTION>
+<OPTION value="Cornwall">Cornwall</OPTION>
+<OPTION value="Cumbria">Cumbria</OPTION>
+<OPTION value="Denbighshire">Denbighshire</OPTION>
+<OPTION value="Derbyshire">Derbyshire</OPTION>
+<OPTION value="Devon">Devon</OPTION>
+<OPTION value="Dorset">Dorset</OPTION>
+<OPTION value="Dumfries & Galloway">Dumfries & Galloway</OPTION>
+<OPTION value="Dundee City">Dundee City</OPTION>
+<OPTION value="Durham">Durham</OPTION>
+<OPTION value="East Ayrshire">East Ayrshire</OPTION>
+<OPTION value="East Dunbartonshire">East Dunbartonshire</OPTION>
+<OPTION value="East Lothian">East Lothian</OPTION>
+<OPTION value="East Renfrewshire">East Renfrewshire</OPTION>
+<OPTION value="East Riding of Yorkshire">East Riding of Yorkshire</OPTION>
+<OPTION value="East Sussex">East Sussex</OPTION>
+<OPTION value="Edinburgh">Edinburgh</OPTION>
+<OPTION value="Essex">Essex</OPTION>
+<OPTION value="Falkirk">Falkirk</OPTION>
+<OPTION value="Fife">Fife</OPTION>
+<OPTION value="Flintshire">Flintshire</OPTION>
+<OPTION value="Glasgow">Glasgow</OPTION>
+<OPTION value="Gloucestershire">Gloucestershire</OPTION>
+<OPTION value="Greater Manchester">Greater Manchester</OPTION>
+<OPTION value="Gwynedd">Gwynedd</OPTION>
+<OPTION value="Hampshire">Hampshire</OPTION>
+<OPTION value="Herefordshire">Herefordshire</OPTION>
+<OPTION value="Hertfordshire">Hertfordshire</OPTION>
+<OPTION value="Highlands">Highlands</OPTION>
+<OPTION value="Inverclyde">Inverclyde</OPTION>
+<OPTION value="Isle of Anglesey">Isle of Anglesey</OPTION>
+<OPTION value="Kent">Kent</OPTION>
+<OPTION value="Lancashire">Lancashire</OPTION>
+<OPTION value="Leicestershire">Leicestershire</OPTION>
+<OPTION value="Lincolnshire">Lincolnshire</OPTION>
+<OPTION value="London">London</OPTION>
+<OPTION value="Merseyside">Merseyside</OPTION>
+<OPTION value="Merthyr Tydfil">Merthyr Tydfil</OPTION>
+<OPTION value="Midlothian">Midlothian</OPTION>
+<OPTION value="Monmouthshire">Monmouthshire</OPTION>
+<OPTION value="Moray">Moray</OPTION>
+<OPTION value="Neath Port Talbot">Neath Port Talbot</OPTION>
+<OPTION value="Newport">Newport</OPTION>
+<OPTION value="Norfolk">Norfolk</OPTION>
+<OPTION value="North Ayrshire">North Ayrshire</OPTION>
+<OPTION value="North Lanarkshire">North Lanarkshire</OPTION>
+<OPTION value="North Somerset">North Somerset</OPTION>
+<OPTION value="North Yorkshire">North Yorkshire</OPTION>
+<OPTION value="Northamptonshire">Northamptonshire</OPTION>
+<OPTION value="Northumberland">Northumberland</OPTION>
+<OPTION value="Nottinghamshire">Nottinghamshire</OPTION>
+<OPTION value="Orkney">Orkney</OPTION>
+<OPTION value="Oxfordshire">Oxfordshire</OPTION>
+<OPTION value="Pembrokeshire">Pembrokeshire</OPTION>
+<OPTION value="Perth & Kinross">Perth & Kinross</OPTION>
+<OPTION value="Powys">Powys</OPTION>
+<OPTION value="Renfrewshire">Renfrewshire</OPTION>
+<OPTION value="Rhondda Cynon Taff">Rhondda Cynon Taff</OPTION>
+<OPTION value="Rutland">Rutland</OPTION>
+<OPTION value="Scottish Borders">Scottish Borders</OPTION>
+<OPTION value="Shetland">Shetland</OPTION>
+<OPTION value="Shropshire">Shropshire</OPTION>
+<OPTION value="Somerset">Somerset</OPTION>
+<OPTION value="South Lanarkshire">South Lanarkshire</OPTION>
+<OPTION value="South Yorkshire">South Yorkshire</OPTION>
+<OPTION value="Staffordshire">Staffordshire</OPTION>
+<OPTION value="Stirling">Stirling</OPTION>
+<OPTION value="Suffolk">Suffolk</OPTION>
+<OPTION value="Surrey">Surrey</OPTION>
+<OPTION value="Swansea">Swansea</OPTION>
+<OPTION value="Teesside">Teesside</OPTION>
+<OPTION value="Torfaen">Torfaen</OPTION>
+<OPTION value="Tyne & Wear">Tyne & Wear</OPTION>
+<OPTION value="Vale of Glamorgan">Vale of Glamorgan</OPTION>
+<OPTION value="Warwickshire">Warwickshire</OPTION>
+<OPTION value="West Dunbartonshire">West Dunbartonshire</OPTION>
+<OPTION value="West Lothian">West Lothian</OPTION>
+<OPTION value="West Midlands">West Midlands</OPTION>
+<OPTION value="West Sussex">West Sussex</OPTION>
+<OPTION value="West Yorkshire">West Yorkshire</OPTION>
+<OPTION value="Western Isles">Western Isles</OPTION>
+<OPTION value="Wiltshire">Wiltshire</OPTION>
+<OPTION value="Worcestershire">Worcestershire</OPTION>
+<OPTION value="Wrexham">Wrexham</OPTION>
+</select>
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">Zip/Postal Code:</td>
+<td class="ac_checkout_right_col">
+  <input type="text" name="Ecom_ShipTo_Postal_PostalCode"
+    value="$eform_Ecom_ShipTo_Postal_PostalCode" size="11" maxlength="11">
+</td>
+</tr>
+
+
+<tr>
+<td class="ac_checkout_left_col">Country:</td>
+<td class="ac_checkout_right_col">
+  <SELECT NAME="Ecom_ShipTo_Postal_CountryCode">
+<OPTION VALUE="$vform_Ecom_ShipTo_Postal_CountryCode">$vform_Ecom_ShipTo_Postal_CountryCode
+<OPTION>United States
+<OPTION>Australia
+<OPTION>Canada
+<OPTION>Ireland
+<OPTION>Puerto Rico
+<OPTION>Scotland
+<OPTION>United Kingdom
+<OPTION>Wales
+<OPTION></option>
+<OPTION>American Samoa
+<OPTION>Argentina
+<OPTION>Austria
+<OPTION>Belgium
+<OPTION>Belize
+<OPTION>Brazil
+<OPTION>Chile
+<OPTION>Costa Rica
+<OPTION>Denmark
+<OPTION>Dominican Republic
+<OPTION>Finland
+<OPTION>France
+<OPTION>Germany
+<OPTION>Greece
+<OPTION>Guatemala
+<OPTION>Hong Kong
+<OPTION>Israel
+<OPTION>Italy
+<OPTION>Jamaica
+<OPTION>Mexico
+<OPTION>Netherlands
+<OPTION>New Zealand
+<OPTION>Norway
+<OPTION>Panama
+<OPTION>Portugal
+<OPTION>Spain
+<OPTION>Sweden
+<OPTION>Switzerland
+<OPTION>Taiwan
+<OPTION>Tonga
+<OPTION>Virgin Islands (US)
+
 </SELECT>
-</TD>
-</TR>
-<TR BGCOLOR="#C0FFFF">
-<TD ALIGN="RIGHT" colspan=1>Zip/Postal Code</TD>
-<TD ALIGN="LEFT" colspan=1>
-<INPUT TYPE=TEXT NAME="Ecom_ShipTo_Postal_PostalCode" 
-VALUE="$eform_Ecom_ShipTo_Postal_PostalCode" size=5></td>
-</TR>
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col" colspan=2><input type="checkbox" name="Ecom_is_Residential" value="Ship to Residential Address">  Is this a Residential Address?
+</td>
+</tr>
+
+<!--agorascript-pre
+# inspired from solutions submitted from Dan at CartSoutions.net
+if ("$sc_display_checkout_tos" =~ /yes/i) { return
+q~
+<td colspan=2 class="ac_checkout_top_col">
+Terms of Service & Our Contact Information</td>
+</tr>
+<tr>
+<td colspan=2>
+$sc_tos_display_address<br><br>
+You must read the following link before you can continue:  <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="agora.cgi?page=terms_of_service.html" TARGET="_blank"><b>Sales/Terms of Service and Refund Policy</b></A>.<br>
+Then put a tick in the box below. By selecting &quot;I Agree&quot; you are acknowledging that you have read and agree to our policies contained within that page.
+<br><br>
+<input type="checkbox" name="Ecom_tos" value="I Agree">&nbsp;&nbsp;&nbsp; I Agree and have read the Terms of Service listed above (required to continue)<br><br></td>
+</tr>
+~;} -->
+
+<tr>
+<td class="ac_checkout_left_col">Special Notes:</td>
+<td class="ac_checkout_right_col">
+  <textarea name="Ecom_XCOMMENT_Special_Notes" cols="50" rows="5">$eform_Ecom_XCOMMENT_Special_Notes</textarea>
+</td>
+</tr>
+
 <TR>
 <TD COLSPAN="2" ALIGN="CENTER"><INPUT 
 TYPE=HIDDEN NAME="gateway" VALUE="AgoraPay"><INPUT 
diff -ruN 4.0K-4b/html/forms/AuthorizeNet-orderform.html 5.0.000/html/forms/AuthorizeNet-orderform.html
--- 4.0K-4b/html/forms/AuthorizeNet-orderform.html	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/forms/AuthorizeNet-orderform.html	2006-10-31 09:40:27.000000000 -0600
@@ -2,14 +2,17 @@
 <HEAD>
 <TITLE>Step One</TITLE>
 </HEAD>
+<!--agorascript-orderform
+ &AuthorizeNet_order_form_prep;
+-->
 
-<BODY BGCOLOR="#ffffff">
+<BODY>
 
 <H2>CART CONTENTS HERE</H2>
 
 <CENTER>
 
-<TABLE WIDTH="550" BORDER="0">
+<TABLE class="ac_checkout">
 <!--agorascript-pre
 if ("$sc_auth_top_message" ne "") { return 
 q~<TR>
@@ -24,94 +27,55 @@
 </TD>
 </TR>
 
-<TR BGCOLOR="#C0FFFF">
+<TR>
 <TD>
 
-<TABLE WIDTH="550" BORDER="1">
-<TR BGCOLOR="#C0FFFF">
-<TD ALIGN="CENTER" colspan=3><FONT FACE="ARIAL" SIZE="2"
-COLOR="#000000">Please select where your order will be shipped and 
-click 'Next'</FONT></TD>
+<TABLE>
+<TR>
+<TD colspan=2 class="ac_checkout_top_col">
+Please select where your order will be shipped and 
+click 'Next'</TD>
 </tr>
-<tr>
-   <td colspan=3>Method:&nbsp;&nbsp;&nbsp;
-<SELECT NAME="Ecom_ShipTo_Method">
 
+<td class="ac_checkout_left_col">Method:</td>
+<td class="ac_checkout_right_col">
+<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER BELOW THIS-->
+
+<select name="Ecom_ShipTo_Method">
+<option value="$vform_Ecom_ShipTo_Method"><!--agorascript-pre
+ if ("$vform_Ecom_ShipTo_Method" eq "") {
+   return " Select Shipping Method ";
+  } else {
+   return "$vform_Ecom_ShipTo_Method";
+  }
+--></option>
+<option value="Electronic Delivery">Electronic Delivery</option>
+<option value="Local Delivery">	Local Delivery</option>
+<option value="Pickup">Pickup</option>
+<option value="USPS Parcel Post (Parcel)">USPS Parcel Post (5-14 days)</option>
+<option value="USPS Priority Mail (Priority)">USPS Priority Mail (3-7 days)</option>
+<option value="USPS Express Mail (Express)">USPS Express Mail (1-3 days)</option>
+<option value="USPS (Economy (Surface) Parcel Post)">Economy (Surface) Parcel Post (4-6 weeks - international)</option>
+<option value="USPS (Airmail Parcel Post)">Airmail Parcel Post (4-10 days - international)</option>
+<option value="USPS (Global Express Mail)">Global Express Mail (3-5 days - international)</option>
+<option value="USPS (Global Express Guaranteed Document Service)">Global Express Guaranteed - Non-Document (2-3 days - international)</option>
+<option value="UPS 3 Day Select (3DS)">UPS 3 Day Select (3-4 days)</option>
+<option value="UPS 2nd Day Air (2DA)">UPS 2nd Day Air</option>
+<option value="UPS Next Day Air (1DA)">UPS Next Day Air</option>
+<OPTION VALUE="UPS Ground Residential(GNDRES)">UPS Ground Residential</OPTION>
+<OPTION VALUE="UPS Ground Commercial (GNDCOM)">UPS Ground Commercial</OPTION>
+</select>
 
-<!--agorascript-pre
-if ("$sc_auth_upsgroundres" =~ /yes/i) { return 
-q~<OPTION VALUE="UPS Ground Residential(GNDRES)">UPS Ground Residential</OPTION>~
-;}
--->
-<!--agorascript-pre
-if ("$sc_auth_upsgroundcomm" =~ /yes/i) { return 
-q~<OPTION VALUE="UPS Ground Commercial (GNDCOM)">
-UPS Ground Commercial</OPTION>~;
-} else {return '';}
--->
-<!--agorascript-pre
-if ("$sc_auth_ups2da" =~ /yes/i) { return 
-q~<OPTION VALUE="UPS 2nd Day (2DA)">
-UPS 2nd Day</OPTION>~;
-} else {return '';}
--->
-<!--agorascript-pre
-if ("$sc_auth_ups1da" =~ /yes/i) { return 
-q~<OPTION VALUE="UPS Next Day (1DA)">
-UPS Next Day</OPTION>~;
-} else {return '';}
--->
-<!--agorascript-pre
-if ("$sc_auth_fedexprioiryovernight" =~ /yes/i) { return 
-q~<OPTION VALUE="FEDEX Priority Overnight (Express,Priority Overnight)">
-FedEx Priority Overnight</OPTION>~;
-}
--->
-<!--agorascript-pre
-if ("$sc_auth_fedexexpress" =~ /yes/i) { return 
-q~<OPTION VALUE="FEDEX Express (Express,Express Saver)">
-FedEx Express Saver</OPTION>~;
-}
--->
-<!--agorascript-pre
-if ("$sc_auth_fedexground" =~ /yes/i) { return 
-q~<OPTION VALUE="FEDEX Ground (Ground,Ground)">
-FedEx Ground</OPTION>~;
-}
--->
-<!--agorascript-pre
-if ("$sc_auth_fedexhome" =~ /yes/i) { return 
-q~<OPTION VALUE="FEDEX Home Delivery (Home,Home)">
-FedEx Home Delivery</OPTION>~;
-} else {return '';}
--->
-<!--agorascript-pre
-if ("$sc_auth_uspsparcelpost" =~ /yes/i) { return 
-q~<OPTION VALUE="USPS Parcel Post (Parcel)">
-USPS Parcel Post</OPTION>~;
-} else {return '';}
--->
-<!--agorascript-pre
-if ("$sc_auth_uspsprioritymail" =~ /yes/i) { return 
-q~<OPTION VALUE="USPS Priority Mail (Priority)">
-USPS Priority Mail</OPTION>~;
-} else {return '';}
--->
-<!--agorascript-pre
-if ("$sc_auth_uspsexpressmail" =~ /yes/i) { return 
-q~<OPTION VALUE="USPS Express Mail (Express)">
-USPS Express Mail</OPTION>~;
-} else {return '';}
--->
-</SELECT></TD>
- </tr>
-      
-<TR BGCOLOR="#C0FFFF">
-<TD ALIGN="CENTER" colspan=1>Zip/Postal Code
-<INPUT TYPE=TEXT NAME="Ecom_ShipTo_Postal_PostalCode" size=5></td>
-<TD ALIGN="CENTER" colspan=1>
-<SELECT NAME="Ecom_ShipTo_Postal_StateProv">
-<OPTION VALUE="">Select State</OPTION>
+<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER ABOVE THIS-->
+</td>
+</TR>
+
+<tr>
+<td class="ac_checkout_left_col">State/Province:</td>
+<td class="ac_checkout_right_col">
+<select name="Ecom_ShipTo_Postal_StateProv">
+<option value="$vform_Ecom_ShipTo_Postal_StateProv">$vform_Ecom_ShipTo_Postal_StateProv &nbsp;</option>
+<OPTION value="">---USA---</OPTION>
 <OPTION>AK</OPTION>
 <OPTION>AL</OPTION> 
 <OPTION>AR</OPTION>
@@ -165,10 +129,223 @@
 <OPTION>WA</OPTION> 
 <OPTION>WI</OPTION>
 <OPTION>WV</OPTION> 
-<OPTION>WY</OPTION> 
+<OPTION>WY</OPTION>
+<OPTION value=""></OPTION>
+<OPTION value="">--AUSTRALIA--</OPTION>
+<OPTION value="ACT">ACT</OPTION>
+<OPTION value="NSW">NSW</OPTION>
+<OPTION value="NT">NT</OPTION>
+<OPTION value="QLD">QLD</OPTION>
+<OPTION value="SA">SA</OPTION>
+<OPTION value="TAS">TAS</OPTION>
+<OPTION value="VIC">VIC</OPTION>
+<OPTION value="WA">WA</OPTION>
+<OPTION value=""></OPTION>
+<OPTION value="">--CANADA--</OPTION>
+<OPTION value="AB">AB</OPTION>
+<OPTION value="BC">BC</OPTION>
+<OPTION value="MB">MB</OPTION>
+<OPTION value="NB">NB</OPTION>
+<OPTION value="NFLD">NFLD</OPTION>
+<OPTION value="NWT">NWT</OPTION>
+<OPTION value="NS">NS</OPTION>
+<OPTION value="ON">ON</OPTION>
+<OPTION value="PEI">PEI</OPTION>
+<OPTION value="PQ">PQ</OPTION>
+<OPTION value="SK">SK</OPTION>
+<OPTION value="YK">YK</OPTION>
+<OPTION value="">--UK / England--</OPTION>
+<OPTION value="Aberdeen City">Aberdeen City</OPTION>
+<OPTION value="Aberdeenshire">Aberdeenshire</OPTION>
+<OPTION value="Angus">Angus</OPTION>
+<OPTION value="Argyll & Bute">Argyll & Bute</OPTION>
+<OPTION value="Bath & North East Somerset">Bath & North East Somerset</OPTION>
+<OPTION value="Bedfordshire">Bedfordshire</OPTION>
+<OPTION value="Berkshire">Berkshire</OPTION>
+<OPTION value="Blaenau Gwent">Blaenau Gwent</OPTION>
+<OPTION value="Bridgend">Bridgend</OPTION>
+<OPTION value="Bristol">Bristol</OPTION>
+<OPTION value="Buckinghamshire">Buckinghamshire</OPTION>
+<OPTION value="Caerphilly ">Caerphilly </OPTION>
+<OPTION value="Cambridgeshire">Cambridgeshire</OPTION>
+<OPTION value="Cardiff">Cardiff</OPTION>
+<OPTION value="Carmarthenshire">Carmarthenshire</OPTION>
+<OPTION value="Ceredidgion">Ceredidgion</OPTION>
+<OPTION value="Cheshire">Cheshire</OPTION>
+<OPTION value="ClackMannanshire">ClackMannanshire</OPTION>
+<OPTION value="Conwy">Conwy</OPTION>
+<OPTION value="Cornwall">Cornwall</OPTION>
+<OPTION value="Cumbria">Cumbria</OPTION>
+<OPTION value="Denbighshire">Denbighshire</OPTION>
+<OPTION value="Derbyshire">Derbyshire</OPTION>
+<OPTION value="Devon">Devon</OPTION>
+<OPTION value="Dorset">Dorset</OPTION>
+<OPTION value="Dumfries & Galloway">Dumfries & Galloway</OPTION>
+<OPTION value="Dundee City">Dundee City</OPTION>
+<OPTION value="Durham">Durham</OPTION>
+<OPTION value="East Ayrshire">East Ayrshire</OPTION>
+<OPTION value="East Dunbartonshire">East Dunbartonshire</OPTION>
+<OPTION value="East Lothian">East Lothian</OPTION>
+<OPTION value="East Renfrewshire">East Renfrewshire</OPTION>
+<OPTION value="East Riding of Yorkshire">East Riding of Yorkshire</OPTION>
+<OPTION value="East Sussex">East Sussex</OPTION>
+<OPTION value="Edinburgh">Edinburgh</OPTION>
+<OPTION value="Essex">Essex</OPTION>
+<OPTION value="Falkirk">Falkirk</OPTION>
+<OPTION value="Fife">Fife</OPTION>
+<OPTION value="Flintshire">Flintshire</OPTION>
+<OPTION value="Glasgow">Glasgow</OPTION>
+<OPTION value="Gloucestershire">Gloucestershire</OPTION>
+<OPTION value="Greater Manchester">Greater Manchester</OPTION>
+<OPTION value="Gwynedd">Gwynedd</OPTION>
+<OPTION value="Hampshire">Hampshire</OPTION>
+<OPTION value="Herefordshire">Herefordshire</OPTION>
+<OPTION value="Hertfordshire">Hertfordshire</OPTION>
+<OPTION value="Highlands">Highlands</OPTION>
+<OPTION value="Inverclyde">Inverclyde</OPTION>
+<OPTION value="Isle of Anglesey">Isle of Anglesey</OPTION>
+<OPTION value="Kent">Kent</OPTION>
+<OPTION value="Lancashire">Lancashire</OPTION>
+<OPTION value="Leicestershire">Leicestershire</OPTION>
+<OPTION value="Lincolnshire">Lincolnshire</OPTION>
+<OPTION value="London">London</OPTION>
+<OPTION value="Merseyside">Merseyside</OPTION>
+<OPTION value="Merthyr Tydfil">Merthyr Tydfil</OPTION>
+<OPTION value="Midlothian">Midlothian</OPTION>
+<OPTION value="Monmouthshire">Monmouthshire</OPTION>
+<OPTION value="Moray">Moray</OPTION>
+<OPTION value="Neath Port Talbot">Neath Port Talbot</OPTION>
+<OPTION value="Newport">Newport</OPTION>
+<OPTION value="Norfolk">Norfolk</OPTION>
+<OPTION value="North Ayrshire">North Ayrshire</OPTION>
+<OPTION value="North Lanarkshire">North Lanarkshire</OPTION>
+<OPTION value="North Somerset">North Somerset</OPTION>
+<OPTION value="North Yorkshire">North Yorkshire</OPTION>
+<OPTION value="Northamptonshire">Northamptonshire</OPTION>
+<OPTION value="Northumberland">Northumberland</OPTION>
+<OPTION value="Nottinghamshire">Nottinghamshire</OPTION>
+<OPTION value="Orkney">Orkney</OPTION>
+<OPTION value="Oxfordshire">Oxfordshire</OPTION>
+<OPTION value="Pembrokeshire">Pembrokeshire</OPTION>
+<OPTION value="Perth & Kinross">Perth & Kinross</OPTION>
+<OPTION value="Powys">Powys</OPTION>
+<OPTION value="Renfrewshire">Renfrewshire</OPTION>
+<OPTION value="Rhondda Cynon Taff">Rhondda Cynon Taff</OPTION>
+<OPTION value="Rutland">Rutland</OPTION>
+<OPTION value="Scottish Borders">Scottish Borders</OPTION>
+<OPTION value="Shetland">Shetland</OPTION>
+<OPTION value="Shropshire">Shropshire</OPTION>
+<OPTION value="Somerset">Somerset</OPTION>
+<OPTION value="South Lanarkshire">South Lanarkshire</OPTION>
+<OPTION value="South Yorkshire">South Yorkshire</OPTION>
+<OPTION value="Staffordshire">Staffordshire</OPTION>
+<OPTION value="Stirling">Stirling</OPTION>
+<OPTION value="Suffolk">Suffolk</OPTION>
+<OPTION value="Surrey">Surrey</OPTION>
+<OPTION value="Swansea">Swansea</OPTION>
+<OPTION value="Teesside">Teesside</OPTION>
+<OPTION value="Torfaen">Torfaen</OPTION>
+<OPTION value="Tyne & Wear">Tyne & Wear</OPTION>
+<OPTION value="Vale of Glamorgan">Vale of Glamorgan</OPTION>
+<OPTION value="Warwickshire">Warwickshire</OPTION>
+<OPTION value="West Dunbartonshire">West Dunbartonshire</OPTION>
+<OPTION value="West Lothian">West Lothian</OPTION>
+<OPTION value="West Midlands">West Midlands</OPTION>
+<OPTION value="West Sussex">West Sussex</OPTION>
+<OPTION value="West Yorkshire">West Yorkshire</OPTION>
+<OPTION value="Western Isles">Western Isles</OPTION>
+<OPTION value="Wiltshire">Wiltshire</OPTION>
+<OPTION value="Worcestershire">Worcestershire</OPTION>
+<OPTION value="Wrexham">Wrexham</OPTION>
+</select>
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">Zip/Postal Code:</td>
+<td class="ac_checkout_right_col">
+  <input type="text" name="Ecom_ShipTo_Postal_PostalCode"
+    value="$eform_Ecom_ShipTo_Postal_PostalCode" size="11" maxlength="11">
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">Country:</td>
+<td class="ac_checkout_right_col">
+  <SELECT NAME="Ecom_ShipTo_Postal_CountryCode">
+<OPTION VALUE="$vform_Ecom_ShipTo_Postal_CountryCode">$vform_Ecom_ShipTo_Postal_CountryCode
+<OPTION>United States
+<OPTION>Australia
+<OPTION>Canada
+<OPTION>Ireland
+<OPTION>Puerto Rico
+<OPTION>Scotland
+<OPTION>United Kingdom
+<OPTION>Wales
+<OPTION></option>
+<OPTION>American Samoa
+<OPTION>Argentina
+<OPTION>Austria
+<OPTION>Belgium
+<OPTION>Belize
+<OPTION>Brazil
+<OPTION>Chile
+<OPTION>Costa Rica
+<OPTION>Denmark
+<OPTION>Dominican Republic
+<OPTION>Finland
+<OPTION>France
+<OPTION>Germany
+<OPTION>Greece
+<OPTION>Guatemala
+<OPTION>Hong Kong
+<OPTION>Israel
+<OPTION>Italy
+<OPTION>Jamaica
+<OPTION>Mexico
+<OPTION>Netherlands
+<OPTION>New Zealand
+<OPTION>Norway
+<OPTION>Panama
+<OPTION>Portugal
+<OPTION>Spain
+<OPTION>Sweden
+<OPTION>Switzerland
+<OPTION>Taiwan
+<OPTION>Tonga
+<OPTION>Virgin Islands (US)
 </SELECT>
-</TD>
-<TD ALIGN="CENTER" colspan=1><INPUT
+</td>
+</tr>
+<tr>
+<td class="ac_checkout_left_col" colspan=2><input type="checkbox" name="Ecom_is_Residential" value="Ship to Residential Address">  Is this a Residential Address?
+</td>
+</tr>
+<!--agorascript-pre
+# inspired from solutions submitted from Dan at CartSoutions.net
+if ("$sc_display_checkout_tos" =~ /yes/i) { return
+q~
+<td colspan=2 class="ac_checkout_top_col">
+Terms of Service & Our Contact Information</td>
+</tr>
+<tr>
+<td colspan=2>
+$sc_tos_display_address<br><br>
+You must read the following link before you can continue:  <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="agora.cgi?page=terms_of_service.html" TARGET="_blank"><b>Sales/Terms of Service and Refund Policy</b></A>.<br>
+Then put a tick in the box below. By selecting &quot;I Agree&quot; you are acknowledging that you have read and agree to our policies contained within that page.
+<br><br>
+<input type="checkbox" name="Ecom_tos" value="I Agree">&nbsp;&nbsp;&nbsp; I Agree and have read the Terms of Service listed above (required to continue)<br><br></td>
+</tr>
+~;} -->
+<tr>
+<td class="ac_checkout_left_col">Special Notes:</td>
+<td class="ac_checkout_right_col">
+  <textarea name="Ecom_XCOMMENT_Special_Notes" cols="50" rows="5">$eform_Ecom_XCOMMENT_Special_Notes</textarea>
+</td>
+</tr>
+
+<tr>
+<TD ALIGN="CENTER" colspan=2><INPUT
 TYPE=HIDDEN NAME="gateway" VALUE="AuthorizeNet">
 <INPUT TYPE=submit NAME ="submit_order_form_button" VALUE = "Next"></TD>
 </TR>
diff -ruN 4.0K-4b/html/forms/LinkpointConnect-orderform.html 5.0.000/html/forms/LinkpointConnect-orderform.html
--- 4.0K-4b/html/forms/LinkpointConnect-orderform.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/forms/LinkpointConnect-orderform.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,384 @@
+<HTML>
+<HEAD>
+<TITLE>Step One</TITLE>
+</HEAD>
+<!--agorascript-orderform
+ &LinkpointConnect_order_form_prep;
+-->
+
+<BODY BGCOLOR="#ffffff">
+
+<H2>CART CONTENTS HERE</H2>
+
+<CENTER>
+
+<TABLE class="ac_checkout">
+
+<!--agorascript-pre
+if ("$sc_linkpoint_top_message" ne "") { return 
+q~<TR>
+<TD COLSPAN="2"><br><blockquote>$sc_linkpoint_top_message</blockquote></TD>
+</TR>~
+;}
+-->
+
+<TR>
+<TD COLSPAN="2">
+<P>&nbsp;</P>
+</TD>
+</TR>
+
+<TR>
+<TD>
+
+<TABLE>
+<tr>
+<td colspan=2 class="ac_checkout_top_col">	
+Please select where your order will be shipped/billed
+</tr>
+<tr>
+
+<TD class="ac_checkout_left_col">Shipping Method:</TD>
+<TD class="ac_checkout_right_col">
+
+<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER BELOW THIS-->
+
+<select name="Ecom_ShipTo_Method">
+<option value="$vform_Ecom_ShipTo_Method"><!--agorascript-pre
+ if ("$vform_Ecom_ShipTo_Method" eq "") {
+   return " Select Shipping Method ";
+  } else {
+   return "$vform_Ecom_ShipTo_Method";
+  }
+--></option>
+<option value="Electronic Delivery">Electronic Delivery</option>
+<option value="Local Delivery">	Local Delivery</option>
+<option value="Pickup">Pickup</option>
+<option value="USPS Parcel Post (Parcel)">USPS Parcel Post (5-14 days)</option>
+<option value="USPS Priority Mail (Priority)">USPS Priority Mail (3-7 days)</option>
+<option value="USPS Express Mail (Express)">USPS Express Mail (1-3 days)</option>
+<option value="USPS (Economy (Surface) Parcel Post)">Economy (Surface) Parcel Post (4-6 weeks - international)</option>
+<option value="USPS (Airmail Parcel Post)">Airmail Parcel Post (4-10 days - international)</option>
+<option value="USPS (Global Express Mail)">Global Express Mail (3-5 days - international)</option>
+<option value="USPS (Global Express Guaranteed Document Service)">Global Express Guaranteed - Non-Document (2-3 days - international)</option>
+<option value="UPS 3 Day Select (3DS)">UPS 3 Day Select (3-4 days)</option>
+<option value="UPS 2nd Day Air (2DA)">UPS 2nd Day Air</option>
+<option value="UPS Next Day Air (1DA)">UPS Next Day Air</option>
+<OPTION VALUE="UPS Ground Residential(GNDRES)">UPS Ground Residential</OPTION>
+<OPTION VALUE="UPS Ground Commercial (GNDCOM)">UPS Ground Commercial</OPTION>
+</select>
+
+<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER ABOVE THIS-->
+
+</td>
+</TR>
+<TR>
+<TD class="ac_checkout_left_col">Email Address:</TD>
+<TD class="ac_checkout_right_col">
+<INPUT TYPE=TEXT NAME="Ecom_BillTo_Online_Email" 
+VALUE="$eform_Ecom_BillTo_Online_Email" size=35></td>
+</TR>
+<TD class="ac_checkout_left_col">Name:</TD>
+<TD class="ac_checkout_right_col">
+<INPUT TYPE=TEXT NAME="Ecom_ShipTo_Postal_Name"
+VALUE="$eform_Ecom_ShipTo_Postal_Name" size=35></td>
+</TR>
+<TD class="ac_checkout_left_col">Street:</TD>
+<TD class="ac_checkout_right_col">
+<INPUT TYPE=TEXT NAME="Ecom_ShipTo_Postal_Street_Line1"
+VALUE="$eform_Ecom_ShipTo_Postal_Street_Line1" size=35></td>
+</TR>
+<TD class="ac_checkout_left_col">City:</TD>
+<TD class="ac_checkout_right_col">
+<INPUT TYPE=TEXT NAME="Ecom_ShipTo_Postal_City" 
+VALUE="$eform_Ecom_ShipTo_Postal_City" size=25></td>
+</TR>
+<tr>
+  <td class="ac_checkout_left_col">State/Province:</td>
+  <td class="ac_checkout_right_col">
+    <select name="Ecom_ShipTo_Postal_StateProv">
+      <option value="$eform_Ecom_ShipTo_Postal_StateProv">$eform_Ecom_ShipTo_Postal_StateProv &nbsp;</option>
+      <option>---USA---</option>
+      <option>AK</option>
+      <option>AL</option> 
+      <option>AR</option>
+      <option>AZ</option> 
+      <option>CA</option> 
+      <option>CO</option> 
+      <option>CT</option> 
+      <option>DC</option>
+      <option>DE</option> 
+      <option>FL</option> 
+      <option>GA</option> 
+      <option>GU</option> 
+      <option>HI</option> 
+      <option>IA</option>
+      <option>ID</option> 
+      <option>IL</option> 
+      <option>IN</option> 
+      <option>KS</option> 
+      <option>KY</option> 
+      <option>LA</option> 
+      <option>MA</option> 
+      <option>MD</option>
+      <option>ME</option> 
+      <option>MI</option> 
+      <option>MN</option> 
+      <option>MO</option>
+      <option>MS</option> 
+      <option>MT</option> 
+      <option>NC</option> 
+      <option>ND</option> 
+      <option>NE</option> 
+      <option>NH</option> 
+      <option>NJ</option> 
+      <option>NM</option> 
+      <option>NV</option> 
+      <option>NY</option> 
+      <option>OH</option> 
+      <option>OK</option> 
+      <option>OR</option> 
+      <option>PA</option> 
+      <option>PR</option> 
+      <option>RI</option> 
+      <option>SC</option> 
+      <option>SD</option> 
+      <option>TN</option> 
+      <option>TX</option> 
+      <option>UT</option> 
+      <option>VA</option>
+      <option>VI</option> 
+      <option>VT</option> 
+      <option>WA</option> 
+      <option>WI</option>
+      <option>WV</option> 
+      <option>WY</option>
+      <option value=""></option>
+      <option value="">--AUSTRALIA--</option>
+      <option value="ACT">ACT</option>
+      <option value="NSW">NSW</option>
+      <option value="NT">NT</option>
+      <option value="QLD">QLD</option>
+      <option value="SA">SA</option>
+      <option value="TAS">TAS</option>
+      <option value="VIC">VIC</option>
+      <option value="WA">WA</option>
+      <option value=""></option>
+      <option value="">--CANADA--</option>
+      <option value="AB">AB</option>
+      <option value="BC">BC</option>
+      <option value="MB">MB</option>
+      <option value="NB">NB</option>
+      <option value="NFLD">NFLD</option>
+      <option value="NWT">NWT</option>
+      <option value="NS">NS</option>
+      <option value="ON">ON</option>
+      <option value="PEI">PEI</option>
+      <option value="PQ">PQ</option>
+      <option value="SK">SK</option>
+      <option value="YK">YK</option>
+      <option value="">--UK / England--</option>
+      <option value="Aberdeen City">Aberdeen City</option>
+      <option value="Aberdeenshire">Aberdeenshire</option>
+      <option value="Angus">Angus</option>
+      <option value="Argyll & Bute">Argyll & Bute</option>
+      <option value="Bath & North East Somerset">Bath & North East Somerset</option>
+      <option value="Bedfordshire">Bedfordshire</option>
+      <option value="Berkshire">Berkshire</option>
+      <option value="Blaenau Gwent">Blaenau Gwent</option>
+      <option value="Bridgend">Bridgend</option>
+      <option value="Bristol">Bristol</option>
+      <option value="Buckinghamshire">Buckinghamshire</option>
+      <option value="Caerphilly ">Caerphilly </option>
+      <option value="Cambridgeshire">Cambridgeshire</option>
+      <option value="Cardiff">Cardiff</option>
+      <option value="Carmarthenshire">Carmarthenshire</option>
+      <option value="Ceredidgion">Ceredidgion</option>
+      <option value="Cheshire">Cheshire</option>
+      <option value="ClackMannanshire">ClackMannanshire</option>
+      <option value="Conwy">Conwy</option>
+      <option value="Cornwall">Cornwall</option>
+      <option value="Cumbria">Cumbria</option>
+      <option value="Denbighshire">Denbighshire</option>
+      <option value="Derbyshire">Derbyshire</option>
+      <option value="Devon">Devon</option>
+      <option value="Dorset">Dorset</option>
+      <option value="Dumfries & Galloway">Dumfries & Galloway</option>
+      <option value="Dundee City">Dundee City</option>
+      <option value="Durham">Durham</option>
+      <option value="East Ayrshire">East Ayrshire</option>
+      <option value="East Dunbartonshire">East Dunbartonshire</option>
+      <option value="East Lothian">East Lothian</option>
+      <option value="East Renfrewshire">East Renfrewshire</option>
+      <option value="East Riding of Yorkshire">East Riding of Yorkshire</option>
+      <option value="East Sussex">East Sussex</option>
+      <option value="Edinburgh">Edinburgh</option>
+      <option value="Essex">Essex</option>
+      <option value="Falkirk">Falkirk</option>
+      <option value="Fife">Fife</option>
+      <option value="Flintshire">Flintshire</option>
+      <option value="Glasgow">Glasgow</option>
+      <option value="Gloucestershire">Gloucestershire</option>
+      <option value="Greater Manchester">Greater Manchester</option>
+      <option value="Gwynedd">Gwynedd</option>
+      <option value="Hampshire">Hampshire</option>
+      <option value="Herefordshire">Herefordshire</option>
+      <option value="Hertfordshire">Hertfordshire</option>
+      <option value="Highlands">Highlands</option>
+      <option value="Inverclyde">Inverclyde</option>
+      <option value="Isle of Anglesey">Isle of Anglesey</option>
+      <option value="Kent">Kent</option>
+      <option value="Lancashire">Lancashire</option>
+      <option value="Leicestershire">Leicestershire</option>
+      <option value="Lincolnshire">Lincolnshire</option>
+      <option value="London">London</option>
+      <option value="Merseyside">Merseyside</option>
+      <option value="Merthyr Tydfil">Merthyr Tydfil</option>
+      <option value="Midlothian">Midlothian</option>
+      <option value="Monmouthshire">Monmouthshire</option>
+      <option value="Moray">Moray</option>
+      <option value="Neath Port Talbot">Neath Port Talbot</option>
+      <option value="Newport">Newport</option>
+      <option value="Norfolk">Norfolk</option>
+      <option value="North Ayrshire">North Ayrshire</option>
+      <option value="North Lanarkshire">North Lanarkshire</option>
+      <option value="North Somerset">North Somerset</option>
+      <option value="North Yorkshire">North Yorkshire</option>
+      <option value="Northamptonshire">Northamptonshire</option>
+      <option value="Northumberland">Northumberland</option>
+      <option value="Nottinghamshire">Nottinghamshire</option>
+      <option value="Orkney">Orkney</option>
+      <option value="Oxfordshire">Oxfordshire</option>
+      <option value="Pembrokeshire">Pembrokeshire</option>
+      <option value="Perth & Kinross">Perth & Kinross</option>
+      <option value="Powys">Powys</option>
+      <option value="Renfrewshire">Renfrewshire</option>
+      <option value="Rhondda Cynon Taff">Rhondda Cynon Taff</option>
+      <option value="Rutland">Rutland</option>
+      <option value="Scottish Borders">Scottish Borders</option>
+      <option value="Shetland">Shetland</option>
+      <option value="Shropshire">Shropshire</option>
+      <option value="Somerset">Somerset</option>
+      <option value="South Lanarkshire">South Lanarkshire</option>
+      <option value="South Yorkshire">South Yorkshire</option>
+      <option value="Staffordshire">Staffordshire</option>
+      <option value="Stirling">Stirling</option>
+      <option value="Suffolk">Suffolk</option>
+      <option value="Surrey">Surrey</option>
+      <option value="Swansea">Swansea</option>
+      <option value="Teesside">Teesside</option>
+      <option value="Torfaen">Torfaen</option>
+      <option value="Tyne & Wear">Tyne & Wear</option>
+      <option value="Vale of Glamorgan">Vale of Glamorgan</option>
+      <option value="Warwickshire">Warwickshire</option>
+      <option value="West Dunbartonshire">West Dunbartonshire</option>
+      <option value="West Lothian">West Lothian</option>
+      <option value="West Midlands">West Midlands</option>
+      <option value="West Sussex">West Sussex</option>
+      <option value="West Yorkshire">West Yorkshire</option>
+      <option value="Western Isles">Western Isles</option>
+      <option value="Wiltshire">Wiltshire</option>
+      <option value="Worcestershire">Worcestershire</option>
+      <option value="Wrexham">Wrexham</option>
+    </select>
+  </td>
+</tr>
+<tr>
+  <td class="ac_checkout_left_col">Zip/Postal Code:</td>
+  <td class="ac_checkout_right_col">
+    <input type="text" name="Ecom_ShipTo_Postal_PostalCode"
+		value="$eform_Ecom_ShipTo_Postal_PostalCode" size="11" maxlength="11">
+  </td>
+</tr>
+<tr>
+  <td class="ac_checkout_left_col">Country:</td>
+  <td class="ac_checkout_right_col">
+    <select name="Ecom_ShipTo_Postal_CountryCode">
+      <option value="$vform_Ecom_ShipTo_Postal_CountryCode">$vform_Ecom_ShipTo_Postal_CountryCode</option>
+      <option>United States</option>
+      <option>Australia</option>
+      <option>Canada</option>
+      <option>Ireland</option>
+      <option>Puerto Rico</option>
+      <option>Scotland</option>
+      <option>United Kingdom</option>
+      <option>Wales</option>
+      <option></option>
+      <option>American Samoa</option>
+      <option>Argentina</option>
+      <option>Austria</option>
+      <option>Belgium</option>
+      <option>Belize</option>
+      <option>Brazil</option>
+      <option>Chile</option>
+      <option>Costa Rica</option>
+      <option>Denmark</option>
+      <option>Dominican Republic</option>
+      <option>Finland</option>
+      <option>France</option>
+      <option>Germany</option>
+      <option>Greece</option>
+      <option>Guatemala</option>
+      <option>Hong Kong</option>
+      <option>Israel</option>
+      <option>Italy</option>
+      <option>Jamaica</option>
+      <option>Mexico</option>
+      <option>Netherlands</option>
+      <option>New Zealand</option>
+      <option>Norway</option>
+      <option>Panama</option>
+      <option>Portugal</option>
+      <option>Spain</option>
+      <option>Sweden</option>
+      <option>Switzerland</option>
+      <option>Taiwan</option>
+      <option>Tonga</option>
+      <option>Virgin Islands (US)</option>
+    </select>
+  </td>
+</tr>
+<tr>
+<td class="ac_checkout_left_col" colspan=2><input type="checkbox" name="Ecom_is_Residential" value="Ship to Residential Address">  Is this a Residential Address?
+</td>
+</tr>
+<!--agorascript-pre
+# inspired from solutions submitted from Dan at CartSoutions.net
+if ("$sc_display_checkout_tos" =~ /yes/i) { return
+q~
+<td colspan=2 class="ac_checkout_top_col">
+Terms of Service & Our Contact Information</td>
+</tr>
+<tr>
+<td colspan=2>
+$sc_tos_display_address<br><br>
+You must read the following link before you can continue:  <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="agora.cgi?page=terms_of_service.html" TARGET="_blank"><b>Sales/Terms of Service and Refund Policy</b></A>.<br>
+Then put a tick in the box below. By selecting &quot;I Agree&quot; you are acknowledging that you have read and agree to our policies contained within that page.
+<br><br>
+<input type="checkbox" name="Ecom_tos" value="I Agree">&nbsp;&nbsp;&nbsp; I Agree and have read the Terms of Service listed above (required to continue)<br><br></td>
+</tr>
+~;} -->
+
+<tr>
+<td class="ac_checkout_left_col">Special Notes:</td>
+<td class="ac_checkout_right_col">
+  <textarea name="Ecom_XCOMMENT_Special_Notes" cols="50" rows="5">$eform_Ecom_XCOMMENT_Special_Notes</textarea>
+</td>
+</tr>
+<TR>
+<TD COLSPAN="2" ALIGN="CENTER"><INPUT 
+TYPE=HIDDEN NAME="gateway" VALUE="LinkpointConnect"><INPUT 
+TYPE=submit NAME = "submit_order_form_button"  
+VALUE = "Please Click Here To Continue"></TD>
+</TR>
+</TABLE>
+
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+</FONT>
+</CENTER>
+</FORM>
+</BODY>
+</HTML>
diff -ruN 4.0K-4b/html/forms/LinkpointHTML-orderform.html 5.0.000/html/forms/LinkpointHTML-orderform.html
--- 4.0K-4b/html/forms/LinkpointHTML-orderform.html	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/forms/LinkpointHTML-orderform.html	1969-12-31 18:00:00.000000000 -0600
@@ -1,177 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>Step One</TITLE>
-</HEAD>
-<!--agorascript-orderform
- &LinkpointHTML_order_form_prep;
--->
-
-<BODY BGCOLOR="#ffffff">
-
-<H2>CART CONTENTS HERE</H2>
-
-<CENTER>
-
-<TABLE WIDTH="530" BORDER="0">
-
-<TR>
-<TD COLSPAN="2">
-<P>&nbsp;</P>
-</TD>
-</TR>
-
-<TR BGCOLOR="#C0FFFF">
-<TD>
-
-<TABLE WIDTH="550" BORDER="1">
-<TR BGCOLOR="#C0FFFF">
-<TD ALIGN="CENTER" colspan=3><FONT FACE="ARIAL" SIZE="2"
-COLOR="#000000">Please select where your order will be shipped/billed and 
-click 'Next'</FONT></TD>
-</tr>
-<tr>
-
-<TR BGCOLOR="#C0FFFF">
-<TD ALIGN="RIGHT" colspan=1>Shipping Method:</TD>
-<TD ALIGN="LEFT" COLSPAN=1>
-<SELECT NAME="Ecom_ShipTo_Method">
-<!--agorascript-pre 
- if ("$vform_Ecom_ShipTo_Method" ne "") {
-   return '<OPTION value="$vform_Ecom_ShipTo_Method">' . 
-	'$vform_Ecom_ShipTo_Method &nbsp;</OPTION>' . 
-	'<OPTION VALUE="UPS Ground (GNDRES)">UPS Ground';
-  } else {
-   return '<OPTION VALUE="UPS Ground (GNDRES)" CHECKED>UPS Ground';
-  }
---></OPTION>
-<OPTION VALUE="UPS 2nd Day (2DA)">
-UPS 2nd Day</OPTION>
-<OPTION VALUE="UPS Next Day (1DA)">
-UPS Next Day</OPTION>
-<OPTION VALUE="FEDEX Priority Overnight (Express,Priority Overnight)">
-FedEx Priority Overnight</OPTION>
-<OPTION VALUE="FEDEX Express (Express,Express Saver)">
-FedEx Express Saver</OPTION>
-<OPTION VALUE="FEDEX Ground (Ground,Ground)">
-FedEx Ground</OPTION>
-<OPTION VALUE="FEDEX Home Delivery (Home,Home)">
-FedEx Home Delivery</OPTION>
-<OPTION VALUE="USPS Parcel Post (Parcel)">
-USPS Parcel Post</OPTION>
-<OPTION VALUE="USPS Priority Mail (Priority)">
-USPS Priority Mail</OPTION>
-<OPTION VALUE="USPS Express Mail (Express)">
-USPS Express Mail</OPTION>
-</SELECT>
-</td>
-</TR>
-<TR BGCOLOR="#C0FFFF">
-<TD ALIGN="RIGHT" colspan=1>Email Address:</TD>
-<TD ALIGN="LEFT" COLSPAN=1>
-<INPUT TYPE=TEXT NAME="Ecom_BillTo_Online_Email" 
-VALUE="$eform_Ecom_BillTo_Online_Email" size=35></td>
-</TR>
-<TR BGCOLOR="#C0FFFF">
-<TD ALIGN="RIGHT" colspan=1>Name:</TD>
-<TD ALIGN="LEFT" COLSPAN=1>
-<INPUT TYPE=TEXT NAME="Ecom_ShipTo_Postal_Name"
-VALUE="$eform_Ecom_ShipTo_Postal_Name" size=35></td>
-</TR>
-<TR BGCOLOR="#C0FFFF">
-<TD ALIGN="RIGHT" colspan=1>Street:</TD>
-<TD ALIGN="LEFT" COLSPAN=1>
-<INPUT TYPE=TEXT NAME="Ecom_ShipTo_Postal_Street_Line1"
-VALUE="$eform_Ecom_ShipTo_Postal_Street_Line1" size=35></td>
-</TR>
-<TR BGCOLOR="#C0FFFF">
-<TD ALIGN="RIGHT" colspan=1>City:</TD>
-<TD ALIGN="LEFT" COLSPAN=1>
-<INPUT TYPE=TEXT NAME="Ecom_ShipTo_Postal_City" 
-VALUE="$eform_Ecom_ShipTo_Postal_City" size=25></td>
-</TR>
-<TR BGCOLOR="#C0FFFF">
-<TD ALIGN="RIGHT" colspan=1>State:</TD>
-<TD ALIGN="LEFT" colspan=1>
-<SELECT NAME="Ecom_ShipTo_Postal_StateProv">
-<OPTION VALUE="$eform_Ecom_ShipTo_Postal_StateProv"
->$eform_Ecom_ShipTo_Postal_StateProv &nbsp;</OPTION>
-<OPTION>AK</OPTION>
-<OPTION>AL</OPTION> 
-<OPTION>AR</OPTION>
-<OPTION>AZ</OPTION> 
-<OPTION>CA</OPTION> 
-<OPTION>CO</OPTION> 
-<OPTION>CT</OPTION> 
-<OPTION>DC</OPTION>
-<OPTION>DE</OPTION> 
-<OPTION>FL</OPTION> 
-<OPTION>GA</OPTION> 
-<OPTION>GU</OPTION> 
-<OPTION>HI</OPTION> 
-<OPTION>IA</OPTION>
-<OPTION>ID</OPTION> 
-<OPTION>IL</OPTION> 
-<OPTION>IN</OPTION> 
-<OPTION>KS</OPTION> 
-<OPTION>KY</OPTION> 
-<OPTION>LA</OPTION> 
-<OPTION>MA</OPTION> 
-<OPTION>MD</OPTION>
-<OPTION>ME</OPTION> 
-<OPTION>MI</OPTION> 
-<OPTION>MN</OPTION> 
-<OPTION>MO</OPTION>
-<OPTION>MS</OPTION> 
-<OPTION>MT</OPTION> 
-<OPTION>NC</OPTION> 
-<OPTION>ND</OPTION> 
-<OPTION>NE</OPTION> 
-<OPTION>NH</OPTION> 
-<OPTION>NJ</OPTION> 
-<OPTION>NM</OPTION> 
-<OPTION>NV</OPTION> 
-<OPTION>NY</OPTION> 
-<OPTION>OH</OPTION> 
-<OPTION>OK</OPTION> 
-<OPTION>OR</OPTION> 
-<OPTION>PA</OPTION> 
-<OPTION>PR</OPTION> 
-<OPTION>RI</OPTION> 
-<OPTION>SC</OPTION> 
-<OPTION>SD</OPTION> 
-<OPTION>TN</OPTION> 
-<OPTION>TX</OPTION> 
-<OPTION>UT</OPTION> 
-<OPTION>VA</OPTION>
-<OPTION>VI</OPTION> 
-<OPTION>VT</OPTION> 
-<OPTION>WA</OPTION> 
-<OPTION>WI</OPTION>
-<OPTION>WV</OPTION> 
-<OPTION>WY</OPTION> 
-</SELECT>
-</TD>
-</TR>
-<TR BGCOLOR="#C0FFFF">
-<TD ALIGN="RIGHT" colspan=1>Zip/Postal Code</TD>
-<TD ALIGN="LEFT" colspan=1>
-<INPUT TYPE=TEXT NAME="Ecom_ShipTo_Postal_PostalCode" 
-VALUE="$eform_Ecom_ShipTo_Postal_PostalCode" size=5></td>
-</TR>
-<TR>
-<TD COLSPAN="2" ALIGN="CENTER"><INPUT 
-TYPE=HIDDEN NAME="gateway" VALUE="LinkpointHTML"><INPUT 
-TYPE=submit NAME = "submit_order_form_button"  
-VALUE = "Please Click Here To Continue"></TD>
-</TR>
-</TABLE>
-
-</TD>
-</TR>
-</TABLE>
-</CENTER>
-</FONT>
-</CENTER>
-</FORM>
-</BODY>
-</HTML>
diff -ruN 4.0K-4b/html/forms/NiftyPay-orderform.html 5.0.000/html/forms/NiftyPay-orderform.html
--- 4.0K-4b/html/forms/NiftyPay-orderform.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/forms/NiftyPay-orderform.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,373 @@
+<HTML>
+<HEAD>
+<TITLE>Step One</TITLE>
+</HEAD>
+<!--agorascript-orderform
+ &NiftyPay_order_form_prep;
+-->
+
+<BODY BGCOLOR="#ffffff">
+
+<H2>CART CONTENTS HERE</H2>
+
+<CENTER>
+
+<TABLE class="ac_checkout">
+<!--agorascript-pre
+if ("$sc_niftypay_top_message" ne "") { return 
+q~<TR>
+<TD COLSPAN="2"><br><blockquote>$sc_niftypay_top_message</blockquote></TD>
+</TR>~
+;}
+-->
+
+<TR>
+<TD COLSPAN="2">
+<P>&nbsp;</P>
+</TD>
+</TR>
+
+<TR>
+<TD>
+
+<TABLE>
+<TR>
+<TD colspan=2 class="ac_checkout_top_col">
+Please select where your order will be shipped/billed
+</tr>
+<tr>
+
+<TR>
+<TD class="ac_checkout_left_col">Shipping Method:</TD>
+<TD class="ac_checkout_right_col">
+
+<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER BELOW THIS-->
+
+<SELECT NAME="Ecom_ShipTo_Method">
+<!--agorascript-pre 
+ if ("$vform_Ecom_ShipTo_Method" ne "") {
+   return '<OPTION value="$vform_Ecom_ShipTo_Method">' . 
+	'$vform_Ecom_ShipTo_Method &nbsp;</OPTION>' . 
+	'<OPTION VALUE="UPS Ground (GNDRES)">UPS Ground';
+  } else {
+   return '<OPTION VALUE="UPS Ground (GNDRES)" CHECKED>UPS Ground';
+  }
+--></OPTION>
+<option value="Electronic Delivery">Electronic Delivery</option>
+<option value="Local Delivery">	Local Delivery</option>
+<option value="Pickup">Pickup</option>
+<option value="USPS Parcel Post (Parcel)">USPS Parcel Post (5-14 days)</option>
+<option value="USPS Priority Mail (Priority)">USPS Priority Mail (3-7 days)</option>
+<option value="USPS Express Mail (Express)">USPS Express Mail (1-3 days)</option>
+<option value="USPS (Economy (Surface) Parcel Post)">Economy (Surface) Parcel Post (4-6 weeks - international)</option>
+<option value="USPS (Airmail Parcel Post)">Airmail Parcel Post (4-10 days - international)</option>
+<option value="USPS (Global Express Mail)">Global Express Mail (3-5 days - international)</option>
+<option value="USPS (Global Express Guaranteed Document Service)">Global Express Guaranteed - Non-Document (2-3 days - international)</option>
+<option value="UPS 3 Day Select (3DS)">UPS 3 Day Select (3-4 days)</option>
+<option value="UPS 2nd Day Air (2DA)">UPS 2nd Day Air</option>
+<option value="UPS Next Day Air (1DA)">UPS Next Day Air</option>
+<OPTION VALUE="UPS Ground Residential(GNDRES)">UPS Ground Residential</OPTION>
+<OPTION VALUE="UPS Ground Commercial (GNDCOM)">UPS Ground Commercial</OPTION>
+</select>
+
+<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER ABOVE THIS-->
+
+</td>
+</TR>
+
+<tr>
+<td class="ac_checkout_left_col">State/Province:</td>
+<td class="ac_checkout_right_col">
+<select name="Ecom_ShipTo_Postal_StateProv">
+<option value="$eform_Ecom_ShipTo_Postal_StateProv">$eform_Ecom_ShipTo_Postal_StateProv &nbsp;</option>
+<OPTION>---USA---</OPTION>
+<OPTION>AK</OPTION>
+<OPTION>AL</OPTION> 
+<OPTION>AR</OPTION>
+<OPTION>AZ</OPTION> 
+<OPTION>CA</OPTION> 
+<OPTION>CO</OPTION> 
+<OPTION>CT</OPTION> 
+<OPTION>DC</OPTION>
+<OPTION>DE</OPTION> 
+<OPTION>FL</OPTION> 
+<OPTION>GA</OPTION> 
+<OPTION>GU</OPTION> 
+<OPTION>HI</OPTION> 
+<OPTION>IA</OPTION>
+<OPTION>ID</OPTION> 
+<OPTION>IL</OPTION> 
+<OPTION>IN</OPTION> 
+<OPTION>KS</OPTION> 
+<OPTION>KY</OPTION> 
+<OPTION>LA</OPTION> 
+<OPTION>MA</OPTION> 
+<OPTION>MD</OPTION>
+<OPTION>ME</OPTION> 
+<OPTION>MI</OPTION> 
+<OPTION>MN</OPTION> 
+<OPTION>MO</OPTION>
+<OPTION>MS</OPTION> 
+<OPTION>MT</OPTION> 
+<OPTION>NC</OPTION> 
+<OPTION>ND</OPTION> 
+<OPTION>NE</OPTION> 
+<OPTION>NH</OPTION> 
+<OPTION>NJ</OPTION> 
+<OPTION>NM</OPTION> 
+<OPTION>NV</OPTION> 
+<OPTION>NY</OPTION> 
+<OPTION>OH</OPTION> 
+<OPTION>OK</OPTION> 
+<OPTION>OR</OPTION> 
+<OPTION>PA</OPTION> 
+<OPTION>PR</OPTION> 
+<OPTION>RI</OPTION> 
+<OPTION>SC</OPTION> 
+<OPTION>SD</OPTION> 
+<OPTION>TN</OPTION> 
+<OPTION>TX</OPTION> 
+<OPTION>UT</OPTION> 
+<OPTION>VA</OPTION>
+<OPTION>VI</OPTION> 
+<OPTION>VT</OPTION> 
+<OPTION>WA</OPTION> 
+<OPTION>WI</OPTION>
+<OPTION>WV</OPTION> 
+<OPTION>WY</OPTION>
+<OPTION value=""></OPTION>
+<OPTION value="">--AUSTRALIA--</OPTION>
+<OPTION value="ACT">ACT</OPTION>
+<OPTION value="NSW">NSW</OPTION>
+<OPTION value="NT">NT</OPTION>
+<OPTION value="QLD">QLD</OPTION>
+<OPTION value="SA">SA</OPTION>
+<OPTION value="TAS">TAS</OPTION>
+<OPTION value="VIC">VIC</OPTION>
+<OPTION value="WA">WA</OPTION>
+<OPTION value=""></OPTION>
+<OPTION value="">--CANADA--</OPTION>
+<OPTION value="AB">AB</OPTION>
+<OPTION value="BC">BC</OPTION>
+<OPTION value="MB">MB</OPTION>
+<OPTION value="NB">NB</OPTION>
+<OPTION value="NFLD">NFLD</OPTION>
+<OPTION value="NWT">NWT</OPTION>
+<OPTION value="NS">NS</OPTION>
+<OPTION value="ON">ON</OPTION>
+<OPTION value="PEI">PEI</OPTION>
+<OPTION value="PQ">PQ</OPTION>
+<OPTION value="SK">SK</OPTION>
+<OPTION value="YK">YK</OPTION>
+<OPTION value="">--UK / England--</OPTION>
+<OPTION value="Aberdeen City">Aberdeen City</OPTION>
+<OPTION value="Aberdeenshire">Aberdeenshire</OPTION>
+<OPTION value="Angus">Angus</OPTION>
+<OPTION value="Argyll & Bute">Argyll & Bute</OPTION>
+<OPTION value="Bath & North East Somerset">Bath & North East Somerset</OPTION>
+<OPTION value="Bedfordshire">Bedfordshire</OPTION>
+<OPTION value="Berkshire">Berkshire</OPTION>
+<OPTION value="Blaenau Gwent">Blaenau Gwent</OPTION>
+<OPTION value="Bridgend">Bridgend</OPTION>
+<OPTION value="Bristol">Bristol</OPTION>
+<OPTION value="Buckinghamshire">Buckinghamshire</OPTION>
+<OPTION value="Caerphilly ">Caerphilly </OPTION>
+<OPTION value="Cambridgeshire">Cambridgeshire</OPTION>
+<OPTION value="Cardiff">Cardiff</OPTION>
+<OPTION value="Carmarthenshire">Carmarthenshire</OPTION>
+<OPTION value="Ceredidgion">Ceredidgion</OPTION>
+<OPTION value="Cheshire">Cheshire</OPTION>
+<OPTION value="ClackMannanshire">ClackMannanshire</OPTION>
+<OPTION value="Conwy">Conwy</OPTION>
+<OPTION value="Cornwall">Cornwall</OPTION>
+<OPTION value="Cumbria">Cumbria</OPTION>
+<OPTION value="Denbighshire">Denbighshire</OPTION>
+<OPTION value="Derbyshire">Derbyshire</OPTION>
+<OPTION value="Devon">Devon</OPTION>
+<OPTION value="Dorset">Dorset</OPTION>
+<OPTION value="Dumfries & Galloway">Dumfries & Galloway</OPTION>
+<OPTION value="Dundee City">Dundee City</OPTION>
+<OPTION value="Durham">Durham</OPTION>
+<OPTION value="East Ayrshire">East Ayrshire</OPTION>
+<OPTION value="East Dunbartonshire">East Dunbartonshire</OPTION>
+<OPTION value="East Lothian">East Lothian</OPTION>
+<OPTION value="East Renfrewshire">East Renfrewshire</OPTION>
+<OPTION value="East Riding of Yorkshire">East Riding of Yorkshire</OPTION>
+<OPTION value="East Sussex">East Sussex</OPTION>
+<OPTION value="Edinburgh">Edinburgh</OPTION>
+<OPTION value="Essex">Essex</OPTION>
+<OPTION value="Falkirk">Falkirk</OPTION>
+<OPTION value="Fife">Fife</OPTION>
+<OPTION value="Flintshire">Flintshire</OPTION>
+<OPTION value="Glasgow">Glasgow</OPTION>
+<OPTION value="Gloucestershire">Gloucestershire</OPTION>
+<OPTION value="Greater Manchester">Greater Manchester</OPTION>
+<OPTION value="Gwynedd">Gwynedd</OPTION>
+<OPTION value="Hampshire">Hampshire</OPTION>
+<OPTION value="Herefordshire">Herefordshire</OPTION>
+<OPTION value="Hertfordshire">Hertfordshire</OPTION>
+<OPTION value="Highlands">Highlands</OPTION>
+<OPTION value="Inverclyde">Inverclyde</OPTION>
+<OPTION value="Isle of Anglesey">Isle of Anglesey</OPTION>
+<OPTION value="Kent">Kent</OPTION>
+<OPTION value="Lancashire">Lancashire</OPTION>
+<OPTION value="Leicestershire">Leicestershire</OPTION>
+<OPTION value="Lincolnshire">Lincolnshire</OPTION>
+<OPTION value="London">London</OPTION>
+<OPTION value="Merseyside">Merseyside</OPTION>
+<OPTION value="Merthyr Tydfil">Merthyr Tydfil</OPTION>
+<OPTION value="Midlothian">Midlothian</OPTION>
+<OPTION value="Monmouthshire">Monmouthshire</OPTION>
+<OPTION value="Moray">Moray</OPTION>
+<OPTION value="Neath Port Talbot">Neath Port Talbot</OPTION>
+<OPTION value="Newport">Newport</OPTION>
+<OPTION value="Norfolk">Norfolk</OPTION>
+<OPTION value="North Ayrshire">North Ayrshire</OPTION>
+<OPTION value="North Lanarkshire">North Lanarkshire</OPTION>
+<OPTION value="North Somerset">North Somerset</OPTION>
+<OPTION value="North Yorkshire">North Yorkshire</OPTION>
+<OPTION value="Northamptonshire">Northamptonshire</OPTION>
+<OPTION value="Northumberland">Northumberland</OPTION>
+<OPTION value="Nottinghamshire">Nottinghamshire</OPTION>
+<OPTION value="Orkney">Orkney</OPTION>
+<OPTION value="Oxfordshire">Oxfordshire</OPTION>
+<OPTION value="Pembrokeshire">Pembrokeshire</OPTION>
+<OPTION value="Perth & Kinross">Perth & Kinross</OPTION>
+<OPTION value="Powys">Powys</OPTION>
+<OPTION value="Renfrewshire">Renfrewshire</OPTION>
+<OPTION value="Rhondda Cynon Taff">Rhondda Cynon Taff</OPTION>
+<OPTION value="Rutland">Rutland</OPTION>
+<OPTION value="Scottish Borders">Scottish Borders</OPTION>
+<OPTION value="Shetland">Shetland</OPTION>
+<OPTION value="Shropshire">Shropshire</OPTION>
+<OPTION value="Somerset">Somerset</OPTION>
+<OPTION value="South Lanarkshire">South Lanarkshire</OPTION>
+<OPTION value="South Yorkshire">South Yorkshire</OPTION>
+<OPTION value="Staffordshire">Staffordshire</OPTION>
+<OPTION value="Stirling">Stirling</OPTION>
+<OPTION value="Suffolk">Suffolk</OPTION>
+<OPTION value="Surrey">Surrey</OPTION>
+<OPTION value="Swansea">Swansea</OPTION>
+<OPTION value="Teesside">Teesside</OPTION>
+<OPTION value="Torfaen">Torfaen</OPTION>
+<OPTION value="Tyne & Wear">Tyne & Wear</OPTION>
+<OPTION value="Vale of Glamorgan">Vale of Glamorgan</OPTION>
+<OPTION value="Warwickshire">Warwickshire</OPTION>
+<OPTION value="West Dunbartonshire">West Dunbartonshire</OPTION>
+<OPTION value="West Lothian">West Lothian</OPTION>
+<OPTION value="West Midlands">West Midlands</OPTION>
+<OPTION value="West Sussex">West Sussex</OPTION>
+<OPTION value="West Yorkshire">West Yorkshire</OPTION>
+<OPTION value="Western Isles">Western Isles</OPTION>
+<OPTION value="Wiltshire">Wiltshire</OPTION>
+<OPTION value="Worcestershire">Worcestershire</OPTION>
+<OPTION value="Wrexham">Wrexham</OPTION>
+</select>
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">Zip/Postal Code:</td>
+<td class="ac_checkout_right_col">
+  <input type="text" name="Ecom_ShipTo_Postal_PostalCode"
+    value="$eform_Ecom_ShipTo_Postal_PostalCode" size="11" maxlength="11">
+</td>
+</tr>
+
+
+<tr>
+<td class="ac_checkout_left_col">Country:</td>
+<td class="ac_checkout_right_col">
+  <SELECT NAME="Ecom_ShipTo_Postal_CountryCode">
+<OPTION VALUE="$vform_Ecom_ShipTo_Postal_CountryCode">$vform_Ecom_ShipTo_Postal_CountryCode
+<OPTION>United States
+<OPTION>Australia
+<OPTION>Canada
+<OPTION>Ireland
+<OPTION>Puerto Rico
+<OPTION>Scotland
+<OPTION>United Kingdom
+<OPTION>Wales
+<OPTION></option>
+<OPTION>American Samoa
+<OPTION>Argentina
+<OPTION>Austria
+<OPTION>Belgium
+<OPTION>Belize
+<OPTION>Brazil
+<OPTION>Chile
+<OPTION>Costa Rica
+<OPTION>Denmark
+<OPTION>Dominican Republic
+<OPTION>Finland
+<OPTION>France
+<OPTION>Germany
+<OPTION>Greece
+<OPTION>Guatemala
+<OPTION>Hong Kong
+<OPTION>Israel
+<OPTION>Italy
+<OPTION>Jamaica
+<OPTION>Mexico
+<OPTION>Netherlands
+<OPTION>New Zealand
+<OPTION>Norway
+<OPTION>Panama
+<OPTION>Portugal
+<OPTION>Spain
+<OPTION>Sweden
+<OPTION>Switzerland
+<OPTION>Taiwan
+<OPTION>Tonga
+<OPTION>Virgin Islands (US)
+
+</SELECT>
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col" colspan=2><input type="checkbox" name="Ecom_is_Residential" value="Ship to Residential Address">  Is this a Residential Address?
+</td>
+</tr>
+
+<!--agorascript-pre
+# inspired from solutions submitted from Dan at CartSoutions.net
+if ("$sc_display_checkout_tos" =~ /yes/i) { return
+q~
+<td colspan=2 class="ac_checkout_top_col">
+Terms of Service & Our Contact Information</td>
+</tr>
+<tr>
+<td colspan=2>
+$sc_tos_display_address<br><br>
+You must read the following link before you can continue:  <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="agora.cgi?page=terms_of_service.html" TARGET="_blank"><b>Sales/Terms of Service and Refund Policy</b></A>.<br>
+Then put a tick in the box below. By selecting &quot;I Agree&quot; you are acknowledging that you have read and agree to our policies contained within that page.
+<br><br>
+<input type="checkbox" name="Ecom_tos" value="I Agree">&nbsp;&nbsp;&nbsp; I Agree and have read the Terms of Service listed above (required to continue)<br><br></td>
+</tr>
+~;} -->
+
+<tr>
+<td class="ac_checkout_left_col">Special Notes:</td>
+<td class="ac_checkout_right_col">
+  <textarea name="Ecom_XCOMMENT_Special_Notes" cols="50" rows="5">$eform_Ecom_XCOMMENT_Special_Notes</textarea>
+</td>
+</tr>
+
+<TR>
+<TD COLSPAN="2" ALIGN="CENTER"><INPUT 
+TYPE=HIDDEN NAME="gateway" VALUE="NiftyPay"><INPUT 
+TYPE=submit NAME = "submit_order_form_button"  
+VALUE = "Please Click Here To Continue"></TD>
+</TR>
+</TABLE>
+
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+</FONT>
+</CENTER>
+</FORM>
+</BODY>
+</HTML>
diff -ruN 4.0K-4b/html/forms/Offline-orderform.html 5.0.000/html/forms/Offline-orderform.html
--- 4.0K-4b/html/forms/Offline-orderform.html	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/forms/Offline-orderform.html	2006-10-31 09:40:27.000000000 -0600
@@ -1,718 +1,959 @@
-<HTML>
-<HEAD>
-<TITLE>Step One</TITLE>
-</HEAD>
+<html>
+<head>
+<title>Step One - Checkout Process</title>
+</head>
 <!--agorascript-orderform
  &Offline_order_form_prep;
 -->
-<BODY>
+<body>
 
-<FORM METHOD="POST" ACTION="agora.cgi">
+<h2>CART CONTENTS HERE</h2>
 
-<H2>CART CONTENTS HERE</H2>
+<form method="post" action="agora.cgi">
 
-<CENTER>
-
-<TABLE WIDTH="550" BORDER="0" CELLPADDING="0">
+<div align="center">
+<table class="ac_checkout">
 <!--agorascript-pre
-if ("$sc_offline_top_message" ne "") { return 
-q~<TR>
-<TD COLSPAN="2"><br><blockquote>$sc_offline_top_message</blockquote><br></TD>
-</TR>~
+if ("$sc_offline_top_message" ne "") { return
+q~<tr>
+<td colspan="2"><br><blockquote>$sc_offline_top_message</blockquote><br></td>
+</tr>~
 ;}
 -->
 
-<TR>
-<TD COLSPAN="2"><FONT SIZE="-1"><hr></FONT></TD>
-</TR>
-
-<TR BGCOLOR="#C0EFFF">
-<TD COLSPAN="2"><FONT SIZE="+1" COLOR=BLACK>
-    &nbsp;Payment Information (Name, Address, and
-Payment Method):</FONT></TD>
-</TR>
-
-<TR>
-<TD COLSPAN="2"><FONT SIZE="-1"><HR></FONT></TD>
-</TR>
-
-<TR>
-<TD WIDTH=100>First Name</TD>
-<TD WIDTH=450><INPUT TYPE="text" 
-NAME="Ecom_BillTo_Postal_Name_First" 
-VALUE="$eform_Ecom_BillTo_Postal_Name_First" 
-SIZE="30" MAXLENGTH="30"></TD>
-</TR>
-      
-<TR>
-<TD>Last Name</TD>
-<TD><INPUT TYPE="text" 
-NAME="Ecom_BillTo_Postal_Name_Last" 
-VALUE="$eform_Ecom_BillTo_Postal_Name_Last" 
-SIZE="30" MAXLENGTH="30"></TD>
-</TR>
-
-<TR>
-<TD WIDTH=100>Street:</TD>
-<TD WIDTH=450><INPUT TYPE="text" 
-NAME="Ecom_BillTo_Postal_Street_Line1" 
-VALUE="$eform_Ecom_BillTo_Postal_Street_Line1" 
-SIZE="30"></TD>
-</TR>
-      
-<TR>
-<TD WIDTH=100>City:</TD>
-<TD WIDTH=450><INPUT TYPE="text" 
-NAME="Ecom_BillTo_Postal_City" 
-VALUE="$eform_Ecom_BillTo_Postal_City" 
-SIZE="30"> 
-</TR>
-
-<TR>
-<TD WIDTH=100>State:</TD>
-<TD WIDTH=450>
-<SELECT NAME="Ecom_BillTo_Postal_StateProv">
-<OPTION VALUE="$eform_Ecom_BillTo_Postal_StateProv"
->$eform_Ecom_BillTo_Postal_StateProv &nbsp;</OPTION>
-<OPTION>---USA---</OPTION>
-<OPTION>AK</OPTION>
-<OPTION>AL</OPTION> 
-<OPTION>AR</OPTION>
-<OPTION>AZ</OPTION> 
-<OPTION>CA</OPTION> 
-<OPTION>CO</OPTION> 
-<OPTION>CT</OPTION> 
-<OPTION>DC</OPTION>
-<OPTION>DE</OPTION> 
-<OPTION>FL</OPTION> 
-<OPTION>GA</OPTION> 
-<OPTION>GU</OPTION> 
-<OPTION>HI</OPTION> 
-<OPTION>IA</OPTION>
-<OPTION>ID</OPTION> 
-<OPTION>IL</OPTION> 
-<OPTION>IN</OPTION> 
-<OPTION>KS</OPTION> 
-<OPTION>KY</OPTION> 
-<OPTION>LA</OPTION> 
-<OPTION>MA</OPTION> 
-<OPTION>MD</OPTION>
-<OPTION>ME</OPTION> 
-<OPTION>MI</OPTION> 
-<OPTION>MN</OPTION> 
-<OPTION>MO</OPTION>
-<OPTION>MS</OPTION> 
-<OPTION>MT</OPTION> 
-<OPTION>NC</OPTION> 
-<OPTION>ND</OPTION> 
-<OPTION>NE</OPTION> 
-<OPTION>NH</OPTION> 
-<OPTION>NJ</OPTION> 
-<OPTION>NM</OPTION> 
-<OPTION>NV</OPTION> 
-<OPTION>NY</OPTION> 
-<OPTION>OH</OPTION> 
-<OPTION>OK</OPTION> 
-<OPTION>OR</OPTION> 
-<OPTION>PA</OPTION> 
-<OPTION>PR</OPTION> 
-<OPTION>RI</OPTION> 
-<OPTION>SC</OPTION> 
-<OPTION>SD</OPTION> 
-<OPTION>TN</OPTION> 
-<OPTION>TX</OPTION> 
-<OPTION>UT</OPTION> 
-<OPTION>VA</OPTION>
-<OPTION>VI</OPTION> 
-<OPTION>VT</OPTION> 
-<OPTION>WA</OPTION> 
-<OPTION>WI</OPTION>
-<OPTION>WV</OPTION> 
-<OPTION>WY</OPTION>
-<OPTION value=""></OPTION>
-<OPTION value="">--AUSTRALIA--</OPTION>
-<OPTION value="ACT">ACT</OPTION>
-<OPTION value="NSW">NSW</OPTION>
-<OPTION value="NT">NT</OPTION>
-<OPTION value="QLD">QLD</OPTION>
-<OPTION value="SA">SA</OPTION>
-<OPTION value="TAS">TAS</OPTION>
-<OPTION value="VIC">VIC</OPTION>
-<OPTION value="WA">WA</OPTION>
-<OPTION value=""></OPTION>
-<OPTION value="">--CANADA--</OPTION>
-<OPTION value="AB">AB</OPTION>
-<OPTION value="BC">BC</OPTION>
-<OPTION value="MB">MB</OPTION>
-<OPTION value="NB">NB</OPTION>
-<OPTION value="NFLD">NFLD</OPTION>
-<OPTION value="NWT">NWT</OPTION>
-<OPTION value="NS">NS</OPTION>
-<OPTION value="ON">ON</OPTION>
-<OPTION value="PEI">PEI</OPTION>
-<OPTION value="PQ">PQ</OPTION>
-<OPTION value="SK">SK</OPTION>
-<OPTION value="YK">YK</OPTION>
-</SELECT>
-</TR>
-
-<TR>
-<TD WIDTH=100>Zip:</TD>
-<TD WIDTH=450><INPUT TYPE="text" 
-NAME="Ecom_BillTo_PostalCode" 
-VALUE="$eform_Ecom_BillTo_PostalCode" 
-SIZE="11" MAXLENGTH="11"></TD>
-</TR>
-
-
-<TR>
-<TD WIDTH=100>Country:</TD>
-<TD WIDTH=450><INPUT TYPE="text" 
-NAME="Ecom_BillTo_Postal_CountryCode"
-VALUE="$eform_Ecom_BillTo_Postal_CountryCode"
- SIZE="11" MAXLENGTH="11"></TD>
-</TR>
- 
-<TR>
-<TD COLSPAN="2"><FONT SIZE="-1"><hr></FONT></TD>
-</TR>
+<tr>
+  <td colspan="2" class="ac_checkout_top_col">
+    Purchase & Billing Information:
+  </td>
+</tr>
 
-<!--agorascript-pre 
-if ("$sc_allow_pay_by_PO" =~ /yes/i) {
-return q~
-<TR>
-<TD COLSPAN="2">Puchase Order:<INPUT TYPE="radio" 
-NAME="Ecom_Payment_Card_Type" ~ .
+<tr>
+  <td class="ac_checkout_left_col">First name</td>
+  <td class="ac_checkout_right_col">
+    <input type="text" name="Ecom_BillTo_Postal_Name_First"
+      value="$eform_Ecom_BillTo_Postal_Name_First" size="30" maxlength="30">
+  </td>
+</tr>
 
-&vform_check("Ecom_Payment_Pay_Type","PO","Checked") .
+<tr>
+  <td class="ac_checkout_left_col">Last name</td>
+  <td class="ac_checkout_right_col">
+    <input type="text" name="Ecom_BillTo_Postal_Name_Last"
+      value="$eform_Ecom_BillTo_Postal_Name_Last" size="30" maxlength="30">
+  </td>
+</tr>
+
+<tr>
+  <td class="ac_checkout_left_col">Street:</td>
+  <td class="ac_checkout_right_col">
+    <input type="text" name="Ecom_BillTo_Postal_Street_Line1"
+      value="$eform_Ecom_BillTo_Postal_Street_Line1" size="30">
+  </td>
+</tr>
+
+<tr>
+  <td class="ac_checkout_left_col">City:</td>
+  <td class="ac_checkout_right_col">
+    <input type="text" name="Ecom_BillTo_Postal_City"
+      value="$eform_Ecom_BillTo_Postal_City" size="30">
+  </td>
+</tr>
+
+<tr>
+  <td class="ac_checkout_left_col">State/Province:</td>
+  <td class="ac_checkout_right_col">
+    <select name="Ecom_BillTo_Postal_StateProv">
+      <option value="$eform_Ecom_BillTo_Postal_StateProv">$eform_Ecom_BillTo_Postal_StateProv &nbsp;</option>
+      <option value="">---USA---</option>
+      <option>AK</option>
+      <option>AL</option> 
+      <option>AR</option>
+      <option>AZ</option> 
+      <option>CA</option> 
+      <option>CO</option> 
+      <option>CT</option> 
+      <option>DC</option>
+      <option>DE</option> 
+      <option>FL</option> 
+      <option>GA</option> 
+      <option>GU</option> 
+      <option>HI</option> 
+      <option>IA</option>
+      <option>ID</option> 
+      <option>IL</option> 
+      <option>IN</option> 
+      <option>KS</option> 
+      <option>KY</option> 
+      <option>LA</option> 
+      <option>MA</option> 
+      <option>MD</option>
+      <option>ME</option> 
+      <option>MI</option> 
+      <option>MN</option> 
+      <option>MO</option>
+      <option>MS</option> 
+      <option>MT</option> 
+      <option>NC</option> 
+      <option>ND</option> 
+      <option>NE</option> 
+      <option>NH</option> 
+      <option>NJ</option> 
+      <option>NM</option> 
+      <option>NV</option> 
+      <option>NY</option> 
+      <option>OH</option> 
+      <option>OK</option> 
+      <option>OR</option> 
+      <option>PA</option> 
+      <option>PR</option> 
+      <option>RI</option> 
+      <option>SC</option> 
+      <option>SD</option> 
+      <option>TN</option> 
+      <option>TX</option> 
+      <option>UT</option> 
+      <option>VA</option>
+      <option>VI</option> 
+      <option>VT</option> 
+      <option>WA</option> 
+      <option>WI</option>
+      <option>WV</option> 
+      <option>WY</option>
+      <option value=""></option>
+      <option value="">--AUSTRALIA--</option>
+      <option value="ACT">ACT</option>
+      <option value="NSW">NSW</option>
+      <option value="NT">NT</option>
+      <option value="QLD">QLD</option>
+      <option value="SA">SA</option>
+      <option value="TAS">TAS</option>
+      <option value="VIC">VIC</option>
+      <option value="WA">WA</option>
+      <option value=""></option>
+      <option value="">--CANADA--</option>
+      <option value="AB">AB</option>
+      <option value="BC">BC</option>
+      <option value="MB">MB</option>
+      <option value="NB">NB</option>
+      <option value="NFLD">NFLD</option>
+      <option value="NWT">NWT</option>
+      <option value="NS">NS</option>
+      <option value="ON">ON</option>
+      <option value="PEI">PEI</option>
+      <option value="PQ">PQ</option>
+      <option value="SK">SK</option>
+      <option value="YK">YK</option>
+      <option value="">--UK / England--</option>
+      <option value="Aberdeen City">Aberdeen City</option>
+      <option value="Aberdeenshire">Aberdeenshire</option>
+      <option value="Angus">Angus</option>
+      <option value="Argyll & Bute">Argyll & Bute</option>
+      <option value="Bath & North East Somerset">Bath & North East Somerset</option>
+      <option value="Bedfordshire">Bedfordshire</option>
+      <option value="Berkshire">Berkshire</option>
+      <option value="Blaenau Gwent">Blaenau Gwent</option>
+      <option value="Bridgend">Bridgend</option>
+      <option value="Bristol">Bristol</option>
+      <option value="Buckinghamshire">Buckinghamshire</option>
+      <option value="Caerphilly ">Caerphilly </option>
+      <option value="Cambridgeshire">Cambridgeshire</option>
+      <option value="Cardiff">Cardiff</option>
+      <option value="Carmarthenshire">Carmarthenshire</option>
+      <option value="Ceredidgion">Ceredidgion</option>
+      <option value="Cheshire">Cheshire</option>
+      <option value="ClackMannanshire">ClackMannanshire</option>
+      <option value="Conwy">Conwy</option>
+      <option value="Cornwall">Cornwall</option>
+      <option value="Cumbria">Cumbria</option>
+      <option value="Denbighshire">Denbighshire</option>
+      <option value="Derbyshire">Derbyshire</option>
+      <option value="Devon">Devon</option>
+      <option value="Dorset">Dorset</option>
+      <option value="Dumfries & Galloway">Dumfries & Galloway</option>
+      <option value="Dundee City">Dundee City</option>
+      <option value="Durham">Durham</option>
+      <option value="East Ayrshire">East Ayrshire</option>
+      <option value="East Dunbartonshire">East Dunbartonshire</option>
+      <option value="East Lothian">East Lothian</option>
+      <option value="East Renfrewshire">East Renfrewshire</option>
+      <option value="East Riding of Yorkshire">East Riding of Yorkshire</option>
+      <option value="East Sussex">East Sussex</option>
+      <option value="Edinburgh">Edinburgh</option>
+      <option value="Essex">Essex</option>
+      <option value="Falkirk">Falkirk</option>
+      <option value="Fife">Fife</option>
+      <option value="Flintshire">Flintshire</option>
+      <option value="Glasgow">Glasgow</option>
+      <option value="Gloucestershire">Gloucestershire</option>
+      <option value="Greater Manchester">Greater Manchester</option>
+      <option value="Gwynedd">Gwynedd</option>
+      <option value="Hampshire">Hampshire</option>
+      <option value="Herefordshire">Herefordshire</option>
+      <option value="Hertfordshire">Hertfordshire</option>
+      <option value="Highlands">Highlands</option>
+      <option value="Inverclyde">Inverclyde</option>
+      <option value="Isle of Anglesey">Isle of Anglesey</option>
+      <option value="Kent">Kent</option>
+      <option value="Lancashire">Lancashire</option>
+      <option value="Leicestershire">Leicestershire</option>
+      <option value="Lincolnshire">Lincolnshire</option>
+      <option value="London">London</option>
+      <option value="Merseyside">Merseyside</option>
+      <option value="Merthyr Tydfil">Merthyr Tydfil</option>
+      <option value="Midlothian">Midlothian</option>
+      <option value="Monmouthshire">Monmouthshire</option>
+      <option value="Moray">Moray</option>
+      <option value="Neath Port Talbot">Neath Port Talbot</option>
+      <option value="Newport">Newport</option>
+      <option value="Norfolk">Norfolk</option>
+      <option value="North Ayrshire">North Ayrshire</option>
+      <option value="North Lanarkshire">North Lanarkshire</option>
+      <option value="North Somerset">North Somerset</option>
+      <option value="North Yorkshire">North Yorkshire</option>
+      <option value="Northamptonshire">Northamptonshire</option>
+      <option value="Northumberland">Northumberland</option>
+      <option value="Nottinghamshire">Nottinghamshire</option>
+      <option value="Orkney">Orkney</option>
+      <option value="Oxfordshire">Oxfordshire</option>
+      <option value="Pembrokeshire">Pembrokeshire</option>
+      <option value="Perth & Kinross">Perth & Kinross</option>
+      <option value="Powys">Powys</option>
+      <option value="Renfrewshire">Renfrewshire</option>
+      <option value="Rhondda Cynon Taff">Rhondda Cynon Taff</option>
+      <option value="Rutland">Rutland</option>
+      <option value="Scottish Borders">Scottish Borders</option>
+      <option value="Shetland">Shetland</option>
+      <option value="Shropshire">Shropshire</option>
+      <option value="Somerset">Somerset</option>
+      <option value="South Lanarkshire">South Lanarkshire</option>
+      <option value="South Yorkshire">South Yorkshire</option>
+      <option value="Staffordshire">Staffordshire</option>
+      <option value="Stirling">Stirling</option>
+      <option value="Suffolk">Suffolk</option>
+      <option value="Surrey">Surrey</option>
+      <option value="Swansea">Swansea</option>
+      <option value="Teesside">Teesside</option>
+      <option value="Torfaen">Torfaen</option>
+      <option value="Tyne & Wear">Tyne & Wear</option>
+      <option value="Vale of Glamorgan">Vale of Glamorgan</option>
+      <option value="Warwickshire">Warwickshire</option>
+      <option value="West Dunbartonshire">West Dunbartonshire</option>
+      <option value="West Lothian">West Lothian</option>
+      <option value="West Midlands">West Midlands</option>
+      <option value="West Sussex">West Sussex</option>
+      <option value="West Yorkshire">West Yorkshire</option>
+      <option value="Western Isles">Western Isles</option>
+      <option value="Wiltshire">Wiltshire</option>
+      <option value="Worcestershire">Worcestershire</option>
+      <option value="Wrexham">Wrexham</option>
+    </select>
+  </td>
+</tr>
+
+<tr>
+  <td class="ac_checkout_left_col">Zip/Postal Code:</td>
+  <td class="ac_checkout_right_col">
+    <input type="text" name="Ecom_BillTo_PostalCode"
+      value="$eform_Ecom_BillTo_PostalCode" size="11" maxlength="11">
+  </td>
+</tr>
+
+
+<tr>
+  <td class="ac_checkout_left_col">Country:</td>
+  <td class="ac_checkout_right_col">
+    <select name="Ecom_BillTo_Postal_CountryCode">
+      <option value="$vform_Ecom_BillTo_Postal_CountryCode">$vform_Ecom_BillTo_Postal_CountryCode</option>
+      <option>United States</option>
+      <option>Australia</option>
+      <option>Canada</option>
+      <option>Ireland</option>
+      <option>Puerto Rico</option>
+      <option>Scotland</option>
+      <option>United Kingdom</option>
+      <option>Wales</option>
+      <option></option>
+      <option>American Samoa</option>
+      <option>Argentina</option>
+      <option>Austria</option>
+      <option>Belgium</option>
+      <option>Belize</option>
+      <option>Brazil</option>
+      <option>Chile</option>
+      <option>Costa Rica</option>
+      <option>Denmark</option>
+      <option>Dominican Republic</option>
+      <option>Finland</option>
+      <option>France</option>
+      <option>Germany</option>
+      <option>Greece</option>
+      <option>Guatemala</option>
+      <option>Hong Kong</option>
+      <option>Israel</option>
+      <option>Italy</option>
+      <option>Jamaica</option>
+      <option>Mexico</option>
+      <option>Netherlands</option>
+      <option>New Zealand</option>
+      <option>Norway</option>
+      <option>Panama</option>
+      <option>Portugal</option>
+      <option>Spain</option>
+      <option>Sweden</option>
+      <option>Switzerland</option>
+      <option>Taiwan</option>
+      <option>Tonga</option>
+      <option>Virgin Islands (US)</option>
+    </select>
+  </td>
+</tr>
+
+<tr>
+  <td colspan="2"><hr/></td>
+</tr>
 
-q~ VALUE="PO">
-&nbsp;&nbsp;&nbsp; PO Number:<INPUT TYPE="text" 
-NAME="Ecom_Payment_PO_Number"  
-VALUE="$vform_Ecom_Payment_PO_Number"  
-size="40" MAXLENGTH="40"></TD>
-</TR>
-
-<TR>
-<TD COLSPAN="2"><FONT SIZE="-1"><hr></FONT></TD>
-</TR>~;
+<!--agorascript-pre
+if ("$sc_allow_pay_by_mailedcheck" =~ /yes/i) {
+return q~
+<tr>
+<td colspan="2">
+<b>Do You Wish To Mail Your Payment</b> (check, money order):<input type="radio" name="Ecom_Payment_Card_Type"
+~ .
+&vform_check("Ecom_Payment_Pay_Type","MailedFunds","Checked") .
+q~ value="MailedFunds">
+</td>
+</tr>
+<tr>
+  <td colspan="2"><hr width=80% /></td>
+</tr>
+~;
 } else {return '';}
 -->
 
 <!--agorascript-pre
+if ("$sc_allow_pay_by_PO" =~ /yes/i) {
+return q~
+<td colspan="2">
+<b>Purchase Order:</b> <input type="radio" name="Ecom_Payment_Card_Type"
+~ .
+&vform_check("Ecom_Payment_Pay_Type","PO","Checked") .
+q~ value="PO">
+&nbsp;&nbsp;&nbsp; PO Number:<input type="text" name="Ecom_Payment_PO_Number"
+  value="$vform_Ecom_Payment_PO_Number" size="40" maxlength="40">
+</td>
+</tr>
+<tr>
+  <td colspan="2"><hr width=80% /></td>
+</tr>
+~;
+} else {return '';}
+-->
 
+<!--agorascript-pre
 if ("$sc_allow_pay_by_check" =~ /yes/i) {
 return q~
-<TR>
-<TD COLSPAN="2">Check:<INPUT TYPE="radio" 
-NAME="Ecom_Payment_Card_Type" ~ .
-
+<tr>
+<td colspan="2">
+<b>Check:</b> <input type="radio" name="Ecom_Payment_Card_type"
+~ .
 &vform_check("Ecom_Payment_Pay_Type","CHECK","Checked") .
+q~ value="Check">
+&nbsp;&nbsp;&nbsp; Bank name:<input type="text" name="Ecom_Payment_Bank_name"
+value="$vform_Ecom_Payment_Bank_name" size="40" maxlength="40">
+</td>
+</tr>
 
-q~ VALUE="Check">
-&nbsp;&nbsp;&nbsp; Bank Name:<INPUT TYPE="text" 
-NAME="Ecom_Payment_Bank_Name"  
-VALUE="$vform_Ecom_Payment_Bank_Name"  
-size="40" MAXLENGTH="40"></TD>
-</tr>
-
-<TR>
-<TD COLSPAN="2"><TABLE WIDTH="100%" BORDER="0">
-<TR>
-<TD>Bank Routing Number<br>
-<INPUT TYPE="text" 
-NAME="Ecom_Payment_BankRoute_Number" 
-VALUE="$vform_Ecom_Payment_BankRoute_Number" 
-MAXLENGTH="20" SIZE=18>
-</TD>
-<TD>Account Number<BR>
-<INPUT TYPE="text" 
-NAME="Ecom_Payment_BankAcct_Number" 
-VALUE="$vform_Ecom_Payment_BankAcct_Number" 
-MAXLENGTH="20" SIZE=18>
-</TD>
-<TD>Check Number<BR>
-<INPUT TYPE="text" 
-NAME="Ecom_Payment_BankCheck_Number" 
-VALUE="$vform_Ecom_Payment_BankCheck_Number" 
-MAXLENGTH="20" SIZE=18>
-</TD>
-</TR></TABLE>
-</TD>
-</TR>
-
-<TR>
-<TD COLSPAN="2"><FONT SIZE="-1"><hr></FONT></TD>
-</TR>~; 
+<tr>
+<td colspan="2">
+<table width="100%" border="0">
+<tr>
+<td>
+  Bank Routing Number<br/>
+  <input type="text" name="Ecom_Payment_BankRoute_Number"
+    value="$vform_Ecom_Payment_BankRoute_Number" maxlength="20" size="18">
+</td>
+<td>
+  Account Number<br/>
+  <input type="text" name="Ecom_Payment_BankAcct_Number"
+    value="$vform_Ecom_Payment_BankAcct_Number" maxlength="20" size="18">
+</td>
+<td>
+  Check Number<br/>
+  <input type="text" name="Ecom_Payment_BankCheck_Number"
+    value="$vform_Ecom_Payment_BankCheck_Number" maxlength="20" size="18">
+</td>
+</tr>
+</table>
+</td>
+</tr>
+<tr>
+  <td colspan="2"><hr width=80% /></td>
+</tr>
+~;
 } else {return '';}
 -->
 
-<TR>
-<TD COLSPAN="2">Credit Card:
-<INPUT TYPE="radio" NAME="Ecom_Payment_Card_Type" 
-<!--agorascript-pre 
-&vform_check("Ecom_Payment_Card_Type","Visa","Checked");
---> VALUE="Visa">Visa
-<INPUT TYPE="radio" NAME="Ecom_Payment_Card_Type" 
-<!--agorascript-pre 
-&vform_check("Ecom_Payment_Card_Type","MasterCard","Checked");
---> VALUE="MasterCard">Mastercard
-<!--agorascript-pre 
-if ("$sc_take_discover" =~ /yes/i) { 
-return q~<INPUT TYPE="radio" NAME="Ecom_Payment_Card_Type" ~ .
-&vform_check("Ecom_Payment_Card_Type","Discover","Checked") . 
-q~  VALUE="Discover">Discover ~;
-} 
--->
-<!--agorascript-pre 
-if ("$sc_take_amex" =~ /yes/i) { 
-return q~<INPUT TYPE="radio" NAME="Ecom_Payment_Card_Type" ~ .
-&vform_check("Ecom_Payment_Card_Type","American Express","Checked") . 
-q~ VALUE="American Express">American Express ~;
-}
+<!--agorascript-pre
+if ("$sc_allow_pay_by_CC" =~ /yes/i) {
+ return q~
+<tr>
+<td colspan="2"><b>Credit Card</b>: 
+<input type="radio" name="Ecom_Payment_Card_Type"
+~;}
 -->
 
+<!--agorascript-pre
+if ("$sc_allow_pay_by_CC" =~ /yes/i) {
+&vform_check("Ecom_Payment_Card_Type","Visa","Checked");}
+-->
+<!--agorascript-pre
+if ("$sc_allow_pay_by_CC" =~ /yes/i) {
+ return q~ value="Visa">Visa
 
-</TD>
-</TR>
-
-<TR>
-<TD COLSPAN="2"><FONT SIZE="-1">&nbsp;</FONT></TD>
-</TR>
+<input type="radio" name="Ecom_Payment_Card_Type"
+~;}
+-->
+<!--agorascript-pre
+if ("$sc_allow_pay_by_CC" =~ /yes/i) {
+&vform_check("Ecom_Payment_Card_Type","MasterCard","Checked");}
+--> 
+<!--agorascript-pre
+if ("$sc_allow_pay_by_CC" =~ /yes/i) {
+ return q~value="MasterCard">Mastercard
+~;}
+-->
+<!--agorascript-pre
+if (("$sc_take_discover" =~ /yes/i) && ("$sc_allow_pay_by_CC" =~ /yes/i)) {
+return q~<input type="radio" name="Ecom_Payment_Card_Type" ~ .
+&vform_check("Ecom_Payment_Card_Type","Discover","Checked") .
+q~  value="Discover">Discover ~;
+}
+-->
+<!--agorascript-pre
+if (("$sc_take_amex" =~ /yes/i) && ("$sc_allow_pay_by_CC" =~ /yes/i)) {
+return q~<input type="radio" name="Ecom_Payment_Card_Type" ~ .
+&vform_check("Ecom_Payment_Card_Type","American Express","Checked") .
+q~ value="American Express">American Express ~;
+}
+-->
+<!--agorascript-pre
+if ("$sc_allow_pay_by_CC" =~ /yes/i) {
+return q~
+</td>
+</tr>
 
+<tr>
+<td colspan="2">&nbsp;</td>
+</tr>
+~};
+-->
 <!--agorascript-orderform
-if ($vform_Ecom_Payment_Pay_Type eq 'CC') {
+if (($vform_Ecom_Payment_Pay_type eq 'CC') && ("$sc_allow_pay_by_CC" =~ /yes/i)) {
   $ags_Ecom_Payment_Card_Number=$vform_Ecom_Payment_Card_Number;
  } else {
   $ags_Ecom_Payment_Card_Number='';
  }
 return '';
 -->
-<TR>
-<TD WIDTH=100>Number:</TD>
-<TD WIDTH=450><INPUT TYPE="text" 
-NAME="Ecom_Payment_Card_Number"
-VALUE="$ags_Ecom_Payment_Card_Number"
-MAXLENGTH="20"></TD>
-</TR>
- 
-<TR>
-<TD WIDTH=100>Exp. Date:</TD>
-<TD WIDTH=450>
-
-<SELECT NAME="Ecom_Payment_Card_ExpDate_Month">
-<OPTION value="$vform_Ecom_Payment_Card_ExpDate_Month"><!--agorascript-pre 
- if ("$vform_Ecom_Payment_Card_ExpDate_Month" eq "") {
-   return "Month";
-  } else {
-   return "$vform_Ecom_Payment_Card_ExpDate_Month";
-  }
---></OPTION>
-<OPTION>1</OPTION>
-<OPTION>2</OPTION>
-<OPTION>3</OPTION>
-<OPTION>4</OPTION>
-<OPTION>5</OPTION>
-<OPTION>6</OPTION>
-<OPTION>7</OPTION>
-<OPTION>8</OPTION>
-<OPTION>9</OPTION>
-<OPTION>10</OPTION>
-<OPTION>11</OPTION>
-<OPTION>12</OPTION>
-</SELECT>
-
-<SELECT NAME="Ecom_Payment_Card_ExpDate_Day">
-<OPTION value="$vform_Ecom_Payment_Card_ExpDate_Day"><!--agorascript-pre 
- if ("$vform_Ecom_Payment_Card_ExpDate_Day" eq "") {
-   return " Day ";
-  } else {
-   return "$vform_Ecom_Payment_Card_ExpDate_Day";
-  }
---></OPTION>
-<OPTION> 1 </OPTION>
-<OPTION> 2 </OPTION>
-<OPTION> 3 </OPTION>
-<OPTION> 4 </OPTION>
-<OPTION> 5 </OPTION>
-<OPTION> 6 </OPTION>
-<OPTION> 7 </OPTION>
-<OPTION> 8 </OPTION>
-<OPTION> 9 </OPTION>
-<OPTION> 10 </OPTION>
-<OPTION> 11 </OPTION>
-<OPTION> 12 </OPTION>
-<OPTION> 13 </OPTION>
-<OPTION> 14 </OPTION>
-<OPTION> 15 </OPTION>
-<OPTION> 16 </OPTION>
-<OPTION> 17 </OPTION>
-<OPTION> 18 </OPTION>
-<OPTION> 19 </OPTION>
-<OPTION> 20 </OPTION>
-<OPTION> 21 </OPTION>
-<OPTION> 22 </OPTION>
-<OPTION> 23 </OPTION>
-<OPTION> 24 </OPTION>
-<OPTION> 25 </OPTION>
-<OPTION> 26 </OPTION>
-<OPTION> 27 </OPTION>
-<OPTION> 28 </OPTION>
-<OPTION> 29 </OPTION>
-<OPTION> 30 </OPTION>
-<OPTION> 31 </OPTION>
-</SELECT>
-
-<SELECT NAME="Ecom_Payment_Card_ExpDate_Year">
-<OPTION value="$vform_Ecom_Payment_Card_ExpDate_Year"><!--agorascript-pre 
- if ("$vform_Ecom_Payment_Card_ExpDate_Year" eq "") {
-   return " Year ";
-  } else {
-   return "$vform_Ecom_Payment_Card_ExpDate_Year";
-  }
---></OPTION>
-<OPTION> 2003</OPTION>
-<OPTION> 2004</OPTION>
-<OPTION> 2005</OPTION>
-<OPTION> 2006</OPTION>
-<OPTION> 2007</OPTION>
-<OPTION> 2008</OPTION>
-<OPTION> 2009</OPTION>
-<OPTION> 2010</OPTION>
-<OPTION> 2011</OPTION>
-<OPTION> 2012</OPTION>
-</SELECT>
-
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=100>CVV2:</TD>
-<TD WIDTH=450><INPUT TYPE="text" 
-NAME="Ecom_Payment_Card_CVV" 
-VALUE="$eform_Ecom_Payment_Card_CVV" 
-MAXLENGTH="5"> &nbsp;&nbsp; <a href="#" 
-onClick="MyWindow=window.open('agora.cgi?page=cvv2.html','MyWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=275,height=290'); return false;" target="_new"><font size=-1>what is this?</font></a>
-</TD>
-</TR>
-
-<TR>
-<TD COLSPAN="2"><FONT SIZE="-1"><hr></FONT></TD>
-</TR>
-
-<TR BGCOLOR="#C0EFFF">
-<TD COLSPAN=2><FONT SIZE="+1" COLOR=BLACK>
-    &nbsp;Shipping Information: (if different from above)</FONT></TD>
-</TR>
-
-<TR>
-<TD COLSPAN="2"><FONT SIZE="-1"><hr></FONT></TD>
-</TR>
-<!--agorascript-pre
-if ("$sc_offline_shipping_message" ne "") { return 
-q~<TR>
-<TD COLSPAN="2"><blockquote>$sc_offline_shipping_message</blockquote></TD>
-</TR>~
-;}
--->
+<!--agorascript-pre
+if ("$sc_allow_pay_by_CC" =~ /yes/i) {
+return q~
 <tr>
-   <td WIDTH="100">Method:</td>
-   <td width="450">
-<SELECT NAME="Ecom_ShipTo_Method">
-
+<td class="ac_checkout_left_col">Number:</td>
+<td class="ac_checkout_rught_col">
+  <input type="text" name="Ecom_Payment_Card_Number"
+    value="$ags_Ecom_Payment_Card_Number" maxlength="20">
+</td>
+</tr>
 
-<!--agorascript-pre
-if ("$sc_upsgroundres" =~ /yes/i) { return 
-q~<OPTION VALUE="UPS Ground Residential(GNDRES)">UPS Ground Residential</OPTION>~
-;}
--->
-<!--agorascript-pre
-if ("$sc_upsgroundcomm" =~ /yes/i) { return 
-q~<OPTION VALUE="UPS Ground Commercial (GNDCOM)">
-UPS Ground Commercial</OPTION>~;
-} else {return '';}
+<tr>
+<td class="ac_checkout_left_col">Exp. Date:</td>
+<td class="ac_checkout_right_col">
+<select name="Ecom_Payment_Card_ExpDate_Month">
+<option value="$vform_Ecom_Payment_Card_ExpDate_Month">
+~};
 -->
 <!--agorascript-pre
-if ("$sc_ups2da" =~ /yes/i) { return 
-q~<OPTION VALUE="UPS 2nd Day (2DA)">
-UPS 2nd Day</OPTION>~;
-} else {return '';}
+ if (("$vform_Ecom_Payment_Card_ExpDate_Month" eq "") && ("$sc_allow_pay_by_CC" =~ /yes/i)) {
+   return "Month";
+  } else {
+   return "$vform_Ecom_Payment_Card_ExpDate_Month";
+  }
 -->
 <!--agorascript-pre
-if ("$sc_ups1da" =~ /yes/i) { return 
-q~<OPTION VALUE="UPS Next Day (1DA)">
-UPS Next Day</OPTION>~;
-} else {return '';}
+if ("$sc_allow_pay_by_CC" =~ /yes/i) {
+return q~
+</option>
+<option>1 - Jan</option>
+<option>2 - Feb</option>
+<option>3 - Mar</option>
+<option>4 - Apr</option>
+<option>5 - May</option>
+<option>6 - Jun</option>
+<option>7 - Jul</option>
+<option>8 - Aug</option>
+<option>9 - Sep</option>
+<option>10 - Oct</option>
+<option>11 - Nov</option>
+<option>12 - Dec</option>
+</select>
+
+<select name="Ecom_Payment_Card_ExpDate_Year">
+<option value="$vform_Ecom_Payment_Card_ExpDate_Year">
+~};
 -->
 <!--agorascript-pre
-if ("$sc_fedexprioiryovernight" =~ /yes/i) { return 
-q~<OPTION VALUE="FEDEX Priority Overnight (Express,Priority Overnight)">
-FedEx Priority Overnight</OPTION>~;
-}
+ if (("$vform_Ecom_Payment_Card_ExpDate_Year" eq "") && ("$sc_allow_pay_by_CC" =~ /yes/i)) {
+   return " Year ";
+  } else {
+   return "$vform_Ecom_Payment_Card_ExpDate_Year";
+  }
 -->
 <!--agorascript-pre
-if ("$sc_fedexexpress" =~ /yes/i) { return 
-q~<OPTION VALUE="FEDEX Express (Express,Express Saver)">
-FedEx Express Saver</OPTION>~;
+if ("$sc_allow_pay_by_CC" =~ /yes/i) {
+return q~
+</option>
+<option> 2006</option>
+<option> 2007</option>
+<option> 2008</option>
+<option> 2009</option>
+<option> 2010</option>
+<option> 2011</option>
+<option> 2012</option>
+</select>
+</td>
+</tr>
+~;
 }
 -->
 <!--agorascript-pre
-if ("$sc_fedexground" =~ /yes/i) { return 
-q~<OPTION VALUE="FEDEX Ground (Ground,Ground)">
-FedEx Ground</OPTION>~;
+if ("$sc_offline_enable_cvv" =~ /yes/i) { return
+q~
+<tr>
+  <td class="ac_checkout_left_col">CVV2:</td>
+  <td class="ac_checkout_right_col">
+    <input type="text" NAME="Ecom_Payment_Card_CVV" value="$eform_Ecom_Payment_Card_CVV">
+    &nbsp;&nbsp; <a href="#" onClick="MyWindow=window.open('$sc_store_url?page=cvv2.html','MyWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=275,height=290'); return false;" target="_new"><font size=-1>what is this?</font></a>
+  </td>
+</tr>
+~;
 }
 -->
+<tr>
+<td colspan=2 class="ac_checkout_top_col">Shipping Information: (if different from billing information)</td>
+</tr>
+
 <!--agorascript-pre
-if ("$sc_fedexhome" =~ /yes/i) { return 
-q~<OPTION VALUE="FEDEX Home Delivery (Home,Home)">
-FedEx Home Delivery</OPTION>~;
-} else {return '';}
--->
-<!--agorascript-pre
-if ("$sc_uspsparcelpost" =~ /yes/i) { return 
-q~<OPTION VALUE="USPS Parcel Post (Parcel)">
-USPS Parcel Post</OPTION>~;
-} else {return '';}
+if ("$sc_offline_shipping_message" ne "") { return
+q~<tr>
+<td colspan="2"><blockquote>$sc_offline_shipping_message</blockquote></td>
+</tr>~
+;}
 -->
+<tr>
+<td class="ac_checkout_left_col">Method:</td>
+<td class="ac_checkout_right_col">
+
+
+<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER BELOW THIS-->
+
+<select name="Ecom_ShipTo_Method">
+<option value="$vform_Ecom_ShipTo_Method"><!--agorascript-pre
+ if ("$vform_Ecom_ShipTo_Method" eq "") {
+   return " Select Shipping Method ";
+  } else {
+   return "$vform_Ecom_ShipTo_Method";
+  }
+--></option>
+<option value="Electronic Delivery">Electronic Delivery</option>
+<option value="Local Delivery">	Local Delivery</option>
+<option value="Pickup">Pickup</option>
+<option value="USPS Parcel Post (Parcel)">USPS Parcel Post (5-14 days)</option>
+<option value="USPS Priority Mail (Priority)">USPS Priority Mail (3-7 days)</option>
+<option value="USPS Express Mail (Express)">USPS Express Mail (1-3 days)</option>
+<option value="USPS (Economy (Surface) Parcel Post)">Economy (Surface) Parcel Post (4-6 weeks - international)</option>
+<option value="USPS (Airmail Parcel Post)">Airmail Parcel Post (4-10 days - international)</option>
+<option value="USPS (Global Express Mail)">Global Express Mail (3-5 days - international)</option>
+<option value="USPS (Global Express Guaranteed Document Service)">Global Express Guaranteed - Non-Document (2-3 days - international)</option>
+<option value="UPS 3 Day Select (3DS)">UPS 3 Day Select (3-4 days)</option>
+<option value="UPS 2nd Day Air (2DA)">UPS 2nd Day Air</option>
+<option value="UPS Next Day Air (1DA)">UPS Next Day Air</option>
+<OPTION VALUE="UPS Ground Residential(GNDRES)">UPS Ground Residential</OPTION>
+<OPTION VALUE="UPS Ground Commercial (GNDCOM)">UPS Ground Commercial</OPTION>
+</select>
+
+
+<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER ABOVE THIS-->
+
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">First name</td>
+<td class="ac_checkout_right_col">
+  <input type="text" name="Ecom_ShipTo_Postal_Name_First"
+    value="$eform_Ecom_ShipTo_Postal_Name_First" size="30" maxlength="30">
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">Last name</td>
+<td class="ac_checkout_right_col">
+  <input type="text" name="Ecom_ShipTo_Postal_Name_Last"
+    value="$eform_Ecom_ShipTo_Postal_Name_Last" size="30" maxlength="30">
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">Street:</td>
+<td class="ac_checkout_right_col">
+  <input type="text" name="Ecom_ShipTo_Postal_Street_Line1"
+    value="$eform_Ecom_ShipTo_Postal_Street_Line1" size="30">
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">City:</td>
+<td class="ac_checkout_right_col">
+  <input type="text" name="Ecom_ShipTo_Postal_City"
+    value="$eform_Ecom_ShipTo_Postal_City" size="30">
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">State/Province:</td>
+<td class="ac_checkout_right_col">
+<select name="Ecom_ShipTo_Postal_StateProv">
+<option value="$vform_Ecom_ShipTo_Postal_StateProv">$vform_Ecom_ShipTo_Postal_StateProv &nbsp;</option>
+<option>---USA---</option>
+<option>AK</option>
+<option>AL</option> 
+<option>AR</option>
+<option>AZ</option> 
+<option>CA</option> 
+<option>CO</option> 
+<option>CT</option> 
+<option>DC</option>
+<option>DE</option> 
+<option>FL</option> 
+<option>GA</option> 
+<option>GU</option> 
+<option>HI</option> 
+<option>IA</option>
+<option>ID</option> 
+<option>IL</option> 
+<option>IN</option> 
+<option>KS</option> 
+<option>KY</option> 
+<option>LA</option> 
+<option>MA</option> 
+<option>MD</option>
+<option>ME</option> 
+<option>MI</option> 
+<option>MN</option> 
+<option>MO</option>
+<option>MS</option> 
+<option>MT</option> 
+<option>NC</option> 
+<option>ND</option> 
+<option>NE</option> 
+<option>NH</option> 
+<option>NJ</option> 
+<option>NM</option> 
+<option>NV</option> 
+<option>NY</option> 
+<option>OH</option> 
+<option>OK</option> 
+<option>OR</option> 
+<option>PA</option> 
+<option>PR</option> 
+<option>RI</option> 
+<option>SC</option> 
+<option>SD</option> 
+<option>TN</option> 
+<option>TX</option> 
+<option>UT</option> 
+<option>VA</option>
+<option>VI</option> 
+<option>VT</option> 
+<option>WA</option> 
+<option>WI</option>
+<option>WV</option> 
+<option>WY</option>
+<option value=""></option>
+<option value="">--AUSTRALIA--</option>
+<option value="ACT">ACT</option>
+<option value="NSW">NSW</option>
+<option value="NT">NT</option>
+<option value="QLD">QLD</option>
+<option value="SA">SA</option>
+<option value="TAS">TAS</option>
+<option value="VIC">VIC</option>
+<option value="WA">WA</option>
+<option value=""></option>
+<option value="">--CANADA--</option>
+<option value="AB">AB</option>
+<option value="BC">BC</option>
+<option value="MB">MB</option>
+<option value="NB">NB</option>
+<option value="NFLD">NFLD</option>
+<option value="NWT">NWT</option>
+<option value="NS">NS</option>
+<option value="ON">ON</option>
+<option value="PEI">PEI</option>
+<option value="PQ">PQ</option>
+<option value="SK">SK</option>
+<option value="YK">YK</option>
+<option value="">--UK / England--</option>
+<option value="Aberdeen City">Aberdeen City</option>
+<option value="Aberdeenshire">Aberdeenshire</option>
+<option value="Angus">Angus</option>
+<option value="Argyll & Bute">Argyll & Bute</option>
+<option value="Bath & North East Somerset">Bath & North East Somerset</option>
+<option value="Bedfordshire">Bedfordshire</option>
+<option value="Berkshire">Berkshire</option>
+<option value="Blaenau Gwent">Blaenau Gwent</option>
+<option value="Bridgend">Bridgend</option>
+<option value="Bristol">Bristol</option>
+<option value="Buckinghamshire">Buckinghamshire</option>
+<option value="Caerphilly ">Caerphilly </option>
+<option value="Cambridgeshire">Cambridgeshire</option>
+<option value="Cardiff">Cardiff</option>
+<option value="Carmarthenshire">Carmarthenshire</option>
+<option value="Ceredidgion">Ceredidgion</option>
+<option value="Cheshire">Cheshire</option>
+<option value="ClackMannanshire">ClackMannanshire</option>
+<option value="Conwy">Conwy</option>
+<option value="Cornwall">Cornwall</option>
+<option value="Cumbria">Cumbria</option>
+<option value="Denbighshire">Denbighshire</option>
+<option value="Derbyshire">Derbyshire</option>
+<option value="Devon">Devon</option>
+<option value="Dorset">Dorset</option>
+<option value="Dumfries & Galloway">Dumfries & Galloway</option>
+<option value="Dundee City">Dundee City</option>
+<option value="Durham">Durham</option>
+<option value="East Ayrshire">East Ayrshire</option>
+<option value="East Dunbartonshire">East Dunbartonshire</option>
+<option value="East Lothian">East Lothian</option>
+<option value="East Renfrewshire">East Renfrewshire</option>
+<option value="East Riding of Yorkshire">East Riding of Yorkshire</option>
+<option value="East Sussex">East Sussex</option>
+<option value="Edinburgh">Edinburgh</option>
+<option value="Essex">Essex</option>
+<option value="Falkirk">Falkirk</option>
+<option value="Fife">Fife</option>
+<option value="Flintshire">Flintshire</option>
+<option value="Glasgow">Glasgow</option>
+<option value="Gloucestershire">Gloucestershire</option>
+<option value="Greater Manchester">Greater Manchester</option>
+<option value="Gwynedd">Gwynedd</option>
+<option value="Hampshire">Hampshire</option>
+<option value="Herefordshire">Herefordshire</option>
+<option value="Hertfordshire">Hertfordshire</option>
+<option value="Highlands">Highlands</option>
+<option value="Inverclyde">Inverclyde</option>
+<option value="Isle of Anglesey">Isle of Anglesey</option>
+<option value="Kent">Kent</option>
+<option value="Lancashire">Lancashire</option>
+<option value="Leicestershire">Leicestershire</option>
+<option value="Lincolnshire">Lincolnshire</option>
+<option value="London">London</option>
+<option value="Merseyside">Merseyside</option>
+<option value="Merthyr Tydfil">Merthyr Tydfil</option>
+<option value="Midlothian">Midlothian</option>
+<option value="Monmouthshire">Monmouthshire</option>
+<option value="Moray">Moray</option>
+<option value="Neath Port Talbot">Neath Port Talbot</option>
+<option value="Newport">Newport</option>
+<option value="Norfolk">Norfolk</option>
+<option value="North Ayrshire">North Ayrshire</option>
+<option value="North Lanarkshire">North Lanarkshire</option>
+<option value="North Somerset">North Somerset</option>
+<option value="North Yorkshire">North Yorkshire</option>
+<option value="Northamptonshire">Northamptonshire</option>
+<option value="Northumberland">Northumberland</option>
+<option value="Nottinghamshire">Nottinghamshire</option>
+<option value="Orkney">Orkney</option>
+<option value="Oxfordshire">Oxfordshire</option>
+<option value="Pembrokeshire">Pembrokeshire</option>
+<option value="Perth & Kinross">Perth & Kinross</option>
+<option value="Powys">Powys</option>
+<option value="Renfrewshire">Renfrewshire</option>
+<option value="Rhondda Cynon Taff">Rhondda Cynon Taff</option>
+<option value="Rutland">Rutland</option>
+<option value="Scottish Borders">Scottish Borders</option>
+<option value="Shetland">Shetland</option>
+<option value="Shropshire">Shropshire</option>
+<option value="Somerset">Somerset</option>
+<option value="South Lanarkshire">South Lanarkshire</option>
+<option value="South Yorkshire">South Yorkshire</option>
+<option value="Staffordshire">Staffordshire</option>
+<option value="Stirling">Stirling</option>
+<option value="Suffolk">Suffolk</option>
+<option value="Surrey">Surrey</option>
+<option value="Swansea">Swansea</option>
+<option value="Teesside">Teesside</option>
+<option value="Torfaen">Torfaen</option>
+<option value="Tyne & Wear">Tyne & Wear</option>
+<option value="Vale of Glamorgan">Vale of Glamorgan</option>
+<option value="Warwickshire">Warwickshire</option>
+<option value="West Dunbartonshire">West Dunbartonshire</option>
+<option value="West Lothian">West Lothian</option>
+<option value="West Midlands">West Midlands</option>
+<option value="West Sussex">West Sussex</option>
+<option value="West Yorkshire">West Yorkshire</option>
+<option value="Western Isles">Western Isles</option>
+<option value="Wiltshire">Wiltshire</option>
+<option value="Worcestershire">Worcestershire</option>
+<option value="Wrexham">Wrexham</option>
+</select>
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">Zip/Postal Code:</td>
+<td class="ac_checkout_right_col">
+  <input type="text" name="Ecom_ShipTo_Postal_PostalCode"
+    value="$eform_Ecom_ShipTo_Postal_PostalCode" size="11" maxlength="11">
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">Country:</td>
+<td class="ac_checkout_right_col">
+  <select name="Ecom_ShipTo_Postal_CountryCode">
+<option value="$vform_Ecom_ShipTo_Postal_CountryCode">$vform_Ecom_ShipTo_Postal_CountryCode</option>
+<option>United States</option>
+<option>Australia</option>
+<option>Canada</option>
+<option>Ireland</option>
+<option>Puerto Rico</option>
+<option>Scotland</option>
+<option>United Kingdom</option>
+<option>Wales</option>
+<option></option>
+<option>American Samoa</option>
+<option>Argentina</option>
+<option>Austria</option>
+<option>Belgium</option>
+<option>Belize</option>
+<option>Brazil</option>
+<option>Chile</option>
+<option>Costa Rica</option>
+<option>Denmark</option>
+<option>Dominican Republic</option>
+<option>Finland</option>
+<option>France</option>
+<option>Germany</option>
+<option>Greece</option>
+<option>Guatemala</option>
+<option>Hong Kong</option>
+<option>Israel</option>
+<option>Italy</option>
+<option>Jamaica</option>
+<option>Mexico</option>
+<option>Netherlands</option>
+<option>New Zealand</option>
+<option>Norway</option>
+<option>Panama</option>
+<option>Portugal</option>
+<option>Spain</option>
+<option>Sweden</option>
+<option>Switzerland</option>
+<option>Taiwan</option>
+<option>Tonga</option>
+<option>Virgin Islands (US)</option>
+
+</select>
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col" colspan=2><input type="checkbox" name="Ecom_is_Residential" value="Ship to Residential Address">  Is this a Residential Address?
+</td>
+</tr>
+
+<tr>
+<td colspan="2" class="ac_checkout_top_col">Phone/Email:</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">Phone:</td>
+<td class="ac_checkout_right_col">
+  <input type="text" name="Ecom_BillTo_Telecom_Phone_Number"
+    value="$eform_Ecom_BillTo_Telecom_Phone_Number" size="15" maxlength="15">
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">E-Mail:</td>
+<td class="ac_checkout_right_col">
+  <input type="text" name="Ecom_BillTo_Online_Email"
+    value="$eform_Ecom_BillTo_Online_Email" maxlength="30">
+</td>
+</tr>
+
+<tr>
+<td colspan="2"><hr/></td>
+</tr>
+
 <!--agorascript-pre
-if ("$sc_uspsprioritymail" =~ /yes/i) { return 
-q~<OPTION VALUE="USPS Priority Mail (Priority)">
-USPS Priority Mail</OPTION>~;
-} else {return '';}
+if ("$sc_offline_special_message" ne "") { return
+q~<tr>
+<td colspan="2"><blockquote>$sc_offline_special_message</blockquote></td>
+</tr>~
+;}
 -->
+
+<tr>
+<td class="ac_checkout_left_col">Special Notes:</td>
+<td class="ac_checkout_right_col">
+  <textarea name="Ecom_XCOMMENT_Special_Notes" cols="50" rows="5">$eform_Ecom_XCOMMENT_Special_Notes</textarea>
+</td>
+</tr>
+
 <!--agorascript-pre
-if ("$sc_uspsexpressmail" =~ /yes/i) { return 
-q~<OPTION VALUE="USPS Express Mail (Express)">
-USPS Express Mail</OPTION>~;
-} else {return '';}
--->
-</SELECT>
-</TD>
+# inspired from solutions submitted from Dan at CartSoutions.net
+if ("$sc_display_checkout_tos" =~ /yes/i) { return
+q~
+<tr>
+<td colspan="2"><hr/></td>
 </tr>
-      
-<TR>
-<TD WIDTH=100>First Name</TD>
-<TD WIDTH=450><INPUT TYPE="text" 
-NAME="Ecom_ShipTo_Postal_Name_First" 
-VALUE="$eform_Ecom_ShipTo_Postal_Name_First" 
-SIZE="30" MAXLENGTH="30"></TD>
-</TR>
-      
-<TR>
-<TD>Last Name</TD>
-<TD><INPUT TYPE="text" 
-NAME="Ecom_ShipTo_Postal_Name_Last" 
-VALUE="$eform_Ecom_ShipTo_Postal_Name_Last" 
-SIZE="30" MAXLENGTH="30"></TD>
-</TR>
-
-<TR>
-<TD WIDTH=100>Street:</TD>
-<TD WIDTH=450><INPUT TYPE="text" 
-NAME="Ecom_ShipTo_Postal_Street_Line1" 
-VALUE="$eform_Ecom_ShipTo_Postal_Street_Line1" 
-SIZE="30"></TD>
-</TR>
-      
-<TR>
-<TD WIDTH=100>City:</TD> 
-<TD WIDTH=450><INPUT TYPE="text" 
-NAME="Ecom_ShipTo_Postal_City" 
-VALUE="$eform_Ecom_ShipTo_Postal_City" 
-SIZE="30"></TD>
-</TR>
-
-<TR>
-<TD WIDTH=100>State:</TD>
-<TD WIDTH=450>
-<SELECT NAME="Ecom_ShipTo_Postal_StateProv">
-<OPTION VALUE="$vform_Ecom_ShipTo_Postal_StateProv"
->$vform_Ecom_ShipTo_Postal_StateProv &nbsp;</OPTION>
-<OPTION>---USA---</OPTION>
-<OPTION>AK</OPTION>
-<OPTION>AL</OPTION> 
-<OPTION>AR</OPTION>
-<OPTION>AZ</OPTION> 
-<OPTION>CA</OPTION> 
-<OPTION>CO</OPTION> 
-<OPTION>CT</OPTION> 
-<OPTION>DC</OPTION>
-<OPTION>DE</OPTION> 
-<OPTION>FL</OPTION> 
-<OPTION>GA</OPTION> 
-<OPTION>GU</OPTION> 
-<OPTION>HI</OPTION> 
-<OPTION>IA</OPTION>
-<OPTION>ID</OPTION> 
-<OPTION>IL</OPTION> 
-<OPTION>IN</OPTION> 
-<OPTION>KS</OPTION> 
-<OPTION>KY</OPTION> 
-<OPTION>LA</OPTION> 
-<OPTION>MA</OPTION> 
-<OPTION>MD</OPTION>
-<OPTION>ME</OPTION> 
-<OPTION>MI</OPTION> 
-<OPTION>MN</OPTION> 
-<OPTION>MO</OPTION>
-<OPTION>MS</OPTION> 
-<OPTION>MT</OPTION> 
-<OPTION>NC</OPTION> 
-<OPTION>ND</OPTION> 
-<OPTION>NE</OPTION> 
-<OPTION>NH</OPTION> 
-<OPTION>NJ</OPTION> 
-<OPTION>NM</OPTION> 
-<OPTION>NV</OPTION> 
-<OPTION>NY</OPTION> 
-<OPTION>OH</OPTION> 
-<OPTION>OK</OPTION> 
-<OPTION>OR</OPTION> 
-<OPTION>PA</OPTION> 
-<OPTION>PR</OPTION> 
-<OPTION>RI</OPTION> 
-<OPTION>SC</OPTION> 
-<OPTION>SD</OPTION> 
-<OPTION>TN</OPTION> 
-<OPTION>TX</OPTION> 
-<OPTION>UT</OPTION> 
-<OPTION>VA</OPTION>
-<OPTION>VI</OPTION> 
-<OPTION>VT</OPTION> 
-<OPTION>WA</OPTION> 
-<OPTION>WI</OPTION>
-<OPTION>WV</OPTION> 
-<OPTION>WY</OPTION>
-<OPTION value=""></OPTION>
-<OPTION value="">--AUSTRALIA--</OPTION>
-<OPTION value="ACT">ACT</OPTION>
-<OPTION value="NSW">NSW</OPTION>
-<OPTION value="NT">NT</OPTION>
-<OPTION value="QLD">QLD</OPTION>
-<OPTION value="SA">SA</OPTION>
-<OPTION value="TAS">TAS</OPTION>
-<OPTION value="VIC">VIC</OPTION>
-<OPTION value="WA">WA</OPTION>
-<OPTION value=""></OPTION>
-<OPTION value="">--CANADA--</OPTION>
-<OPTION value="AB">AB</OPTION>
-<OPTION value="BC">BC</OPTION>
-<OPTION value="MB">MB</OPTION>
-<OPTION value="NB">NB</OPTION>
-<OPTION value="NFLD">NFLD</OPTION>
-<OPTION value="NWT">NWT</OPTION>
-<OPTION value="NS">NS</OPTION>
-<OPTION value="ON">ON</OPTION>
-<OPTION value="PEI">PEI</OPTION>
-<OPTION value="PQ">PQ</OPTION>
-<OPTION value="SK">SK</OPTION>
-<OPTION value="YK">YK</OPTION>
-</SELECT></TD>
-</TR>
-
-<TR>
-<TD WIDTH=100>Zip:</TD>
-<TD WIDTH=450><INPUT TYPE="text" 
-NAME="Ecom_ShipTo_Postal_PostalCode" 
-VALUE="$eform_Ecom_ShipTo_Postal_PostalCode" 
-SIZE="11" MAXLENGTH="11"></TD>
-</TR>
-
-<TR>
-<TD WIDTH=100>Country:</TD>
-<TD WIDTH=450><INPUT TYPE="text" 
-NAME="Ecom_ShipTo_Postal_CountryCode" 
-VALUE="$eform_Ecom_ShipTo_Postal_CountryCode" 
-SIZE="11" MAXLENGTH="11"></TD>
-</TR>
-
-<TR>
-<TD COLSPAN="2"><FONT SIZE="-1"><hr></FONT></TD>
-</TR>
-
-<TR BGCOLOR="#C0EFFF">
-<TD COLSPAN="2"><FONT SIZE="+1" COLOR=BLACK>
-       &nbsp;Phone/Email</FONT></TD>
-</TR>
-
-<TR>
-<TD COLSPAN="2"><FONT SIZE="-1"><hr></FONT></TD>
-</TR>
-
-
-<TR>
-<TD WIDTH=100>Phone:</TD> 
-<TD WIDTH=450><INPUT TYPE="text" 
-NAME="Ecom_BillTo_Telecom_Phone_Number" 
-VALUE="$eform_Ecom_BillTo_Telecom_Phone_Number" 
-SIZE="15" MAXLENGTH="15"></TD>
-</TR> 
-
-<TR>
-<TD WIDTH=100>E-Mail:</TD>
-<TD WIDTH=450><INPUT TYPE="text" 
-NAME="Ecom_BillTo_Online_Email" 
-VALUE="$eform_Ecom_BillTo_Online_Email" 
-MAXLENGTH="30"></TD>
-</TR>
-
-<TR>
-<TD COLSPAN="2"><FONT SIZE="-1"><hr></FONT></TD>
-</TR>
-<TR>
-
-<!--agorascript-pre
-if ("$sc_offline_special_message" ne "") { return 
-q~<TR>
-<TD COLSPAN="2"><blockquote>$sc_offline_special_message</blockquote></TD>
-</TR>~
-;}
--->
+<tr>
+<td colspan=2 class="ac_checkout_right_col">
+$sc_tos_display_address<br><br>
+You must read the following link before you can continue:  <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="agora.cgi?page=terms_of_service.html" TARGET="_blank"><b>Sales/Terms of Service and Refund Policy</b></A>.<br>
+Then put a tick in the box below. By selecting &quot;I Agree&quot; you are acknowledging that you have read and agree to our policies contained within that page.
+<br><br>
+<input type="checkbox" name="Ecom_tos" value="I Agree">&nbsp;&nbsp;&nbsp; I Agree and have read the Terms of Service listed above (required to continue)</td>
+</tr>
+~;} -->
+
+
+<tr>
+<td colspan="2"><hr/></td>
+</tr>
+
+<tr>
+<td colspan="2"><br>
+<blockquote>
+Only one more step! Please click the <strong>Verify Order</strong>
+button below. This will give you the chance to examine your order
+one last time before you actually submit it to be processed.
+</blockquote>
+</td>
+</tr>
+</table>
 
-<TR>
-<TD WIDTH=100>Special Notes:</TD>
-<TD WIDTH=450><TEXTAREA 
-NAME="Ecom_XCOMMENT_Special_Notes" 
-COLS="50" ROWS="5" 
-WRAP="SOFT">$eform_Ecom_XCOMMENT_Special_Notes</TEXTAREA></TD>
-</TR>
-
-<TR>
-<TD COLSPAN="2"><FONT SIZE="-1"><hr></FONT></TD>
-</TR>
-
-</TABLE>
-</CENTER>
-<CENTER>
-<P>
-<P>
-<FONT FACE=ARIAL SIZE=2>
-<CENTER>
-<TABLE WIDTH=400>
-<TR>
-<TD WIDTH=400>
-<FONT FACE=ARIAL SIZE=2>
-Only one more step! Please click the <strong>Verify Order</strong> 
-button below. This will give you the chance to examine your order one last time 
-before you actually submit it to be processed.
-</FONT>
-</TD>
-</TR>
-</TABLE>
-</CENTER>
-</font>
-<P>
-
-<INPUT TYPE=HIDDEN NAME="gateway" VALUE="Offline">
-<INPUT TYPE=HIDDEN NAME="order_form" VALUE="Offline">
-<INPUT TYPE=reset NAME= "  &nbsp; Undo Edits &nbsp;  " 
-value = "  &nbsp; Undo Edits &nbsp;  ">&nbsp; 
-<INPUT TYPE=submit 
-NAME = "clear_order_form_button"  
-VALUE = " Clear Order Form "> &nbsp; <INPUT TYPE=submit 
-NAME = "submit_order_form_button"  VALUE = " Verify Order ">
-<BR>
-</CENTER>
-</FORM>
-</BODY>
-</HTML>
+<input type="hidden" name="gateway" value="Offline">
+<input type="hidden" name="order_form" value="Offline"><br/>
+<input type="reset" name="Undo Edits" value="Undo Edits">&nbsp;
+<input type="submit" name="clear_order_form_button" value="Clear Order Form">&nbsp;
+<input type="submit" name="submit_order_form_button" value="Verify Order">
+
+</div>
+
+</form>
+</body>
+</html>
diff -ruN 4.0K-4b/html/forms/PayPal-orderform.html 5.0.000/html/forms/PayPal-orderform.html
--- 4.0K-4b/html/forms/PayPal-orderform.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/forms/PayPal-orderform.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,406 @@
+<HTML>
+<HEAD>
+<TITLE>Step One</TITLE>
+</HEAD>
+
+<!--agorascript-orderform
+#  $sc_use_secure_header_at_checkout = 'yes';
+  &PayPal_order_form_prep;
+  return '';
+-->
+<BODY BGCOLOR="#ffffff">
+
+<H2>CART CONTENTS HERE</H2>
+
+<CENTER>
+
+<TABLE class="ac_checkout">
+<!--agorascript-pre
+if ("$sc_paypal_top_message" ne "") { return 
+q~<TR>
+<TD COLSPAN="2"><br><blockquote>$sc_paypal_top_message</blockquote></TD>
+</TR>~
+;}
+-->
+<TR>
+<TD COLSPAN="2">
+<P>&nbsp;</P>
+</TD>
+</TR>
+
+<TR>
+<TD>
+
+<TABLE>
+<TR>
+<td colspan=2 class="ac_checkout_top_col">
+Please enter initial info needed to compute your shipping</td>
+</tr>
+<tr>
+<td class="ac_checkout_left_col">Method:</td>
+<td class="ac_checkout_right_col">
+<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER BELOW THIS-->
+
+<select name="Ecom_ShipTo_Method">
+<option value="$vform_Ecom_ShipTo_Method"><!--agorascript-pre
+ if ("$vform_Ecom_ShipTo_Method" eq "") {
+   return " Select Shipping Method ";
+  } else {
+   return "$vform_Ecom_ShipTo_Method";
+  }
+--></option>
+<option value="Electronic Delivery">Electronic Delivery</option>
+<option value="Local Delivery">	Local Delivery</option>
+<option value="Pickup">Pickup</option>
+<option value="USPS Parcel Post (Parcel)">USPS Parcel Post (5-14 days)</option>
+<option value="USPS Priority Mail (Priority)">USPS Priority Mail (3-7 days)</option>
+<option value="USPS Express Mail (Express)">USPS Express Mail (1-3 days)</option>
+<option value="USPS (Economy (Surface) Parcel Post)">Economy (Surface) Parcel Post (4-6 weeks - international)</option>
+<option value="USPS (Airmail Parcel Post)">Airmail Parcel Post (4-10 days - international)</option>
+<option value="USPS (Global Express Mail)">Global Express Mail (3-5 days - international)</option>
+<option value="USPS (Global Express Guaranteed Document Service)">Global Express Guaranteed - Non-Document (2-3 days - international)</option>
+<option value="UPS 3 Day Select (3DS)">UPS 3 Day Select (3-4 days)</option>
+<option value="UPS 2nd Day Air (2DA)">UPS 2nd Day Air</option>
+<option value="UPS Next Day Air (1DA)">UPS Next Day Air</option>
+<OPTION VALUE="UPS Ground Residential(GNDRES)">UPS Ground Residential</OPTION>
+<OPTION VALUE="UPS Ground Commercial (GNDCOM)">UPS Ground Commercial</OPTION>
+</select>
+
+
+<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER ABOVE THIS-->
+</td>
+</TR>
+
+<tr>
+<td class="ac_checkout_left_col">First name</td>
+<td class="ac_checkout_right_col">
+  <input type="text" name="Ecom_ShipTo_Postal_Name_First"
+    value="$vform_Ecom_ShipTo_Postal_Name_First" size="30" maxlength="30">
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">Last name</td>
+<td class="ac_checkout_right_col">
+  <input type="text" name="Ecom_ShipTo_Postal_Name_Last"
+    value="$vform_Ecom_ShipTo_Postal_Name_Last" size="30" maxlength="30">
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">Street:</td>
+<td class="ac_checkout_right_col">
+  <input type="text" name="Ecom_ShipTo_Postal_Street_Line1"
+    value="$vform_Ecom_ShipTo_Postal_Street_Line1" size="30">
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">City:</td>
+<td class="ac_checkout_right_col">
+  <input type="text" name="Ecom_ShipTo_Postal_City"
+    value="$vform_Ecom_ShipTo_Postal_City" size="30">
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">State/Province:</td>
+<td class="ac_checkout_right_col">
+<select name="Ecom_ShipTo_Postal_StateProv">
+<option value="$vform_Ecom_ShipTo_Postal_StateProv">$vform_Ecom_ShipTo_Postal_StateProv &nbsp;</option>
+<OPTION value="">---USA---</OPTION>
+<OPTION>AK</OPTION>
+<OPTION>AL</OPTION> 
+<OPTION>AR</OPTION>
+<OPTION>AZ</OPTION> 
+<OPTION>CA</OPTION> 
+<OPTION>CO</OPTION> 
+<OPTION>CT</OPTION> 
+<OPTION>DC</OPTION>
+<OPTION>DE</OPTION> 
+<OPTION>FL</OPTION> 
+<OPTION>GA</OPTION> 
+<OPTION>GU</OPTION> 
+<OPTION>HI</OPTION> 
+<OPTION>IA</OPTION>
+<OPTION>ID</OPTION> 
+<OPTION>IL</OPTION> 
+<OPTION>IN</OPTION> 
+<OPTION>KS</OPTION> 
+<OPTION>KY</OPTION> 
+<OPTION>LA</OPTION> 
+<OPTION>MA</OPTION> 
+<OPTION>MD</OPTION>
+<OPTION>ME</OPTION> 
+<OPTION>MI</OPTION> 
+<OPTION>MN</OPTION> 
+<OPTION>MO</OPTION>
+<OPTION>MS</OPTION> 
+<OPTION>MT</OPTION> 
+<OPTION>NC</OPTION> 
+<OPTION>ND</OPTION> 
+<OPTION>NE</OPTION> 
+<OPTION>NH</OPTION> 
+<OPTION>NJ</OPTION> 
+<OPTION>NM</OPTION> 
+<OPTION>NV</OPTION> 
+<OPTION>NY</OPTION> 
+<OPTION>OH</OPTION> 
+<OPTION>OK</OPTION> 
+<OPTION>OR</OPTION> 
+<OPTION>PA</OPTION> 
+<OPTION>PR</OPTION> 
+<OPTION>RI</OPTION> 
+<OPTION>SC</OPTION> 
+<OPTION>SD</OPTION> 
+<OPTION>TN</OPTION> 
+<OPTION>TX</OPTION> 
+<OPTION>UT</OPTION> 
+<OPTION>VA</OPTION>
+<OPTION>VI</OPTION> 
+<OPTION>VT</OPTION> 
+<OPTION>WA</OPTION> 
+<OPTION>WI</OPTION>
+<OPTION>WV</OPTION> 
+<OPTION>WY</OPTION>
+<OPTION value=""></OPTION>
+<OPTION value="">--AUSTRALIA--</OPTION>
+<OPTION value="ACT">ACT</OPTION>
+<OPTION value="NSW">NSW</OPTION>
+<OPTION value="NT">NT</OPTION>
+<OPTION value="QLD">QLD</OPTION>
+<OPTION value="SA">SA</OPTION>
+<OPTION value="TAS">TAS</OPTION>
+<OPTION value="VIC">VIC</OPTION>
+<OPTION value="WA">WA</OPTION>
+<OPTION value=""></OPTION>
+<OPTION value="">--CANADA--</OPTION>
+<OPTION value="AB">AB</OPTION>
+<OPTION value="BC">BC</OPTION>
+<OPTION value="MB">MB</OPTION>
+<OPTION value="NB">NB</OPTION>
+<OPTION value="NFLD">NFLD</OPTION>
+<OPTION value="NWT">NWT</OPTION>
+<OPTION value="NS">NS</OPTION>
+<OPTION value="ON">ON</OPTION>
+<OPTION value="PEI">PEI</OPTION>
+<OPTION value="PQ">PQ</OPTION>
+<OPTION value="SK">SK</OPTION>
+<OPTION value="YK">YK</OPTION>
+<OPTION value="">--UK / England--</OPTION>
+<OPTION value="Aberdeen City">Aberdeen City</OPTION>
+<OPTION value="Aberdeenshire">Aberdeenshire</OPTION>
+<OPTION value="Angus">Angus</OPTION>
+<OPTION value="Argyll & Bute">Argyll & Bute</OPTION>
+<OPTION value="Bath & North East Somerset">Bath & North East Somerset</OPTION>
+<OPTION value="Bedfordshire">Bedfordshire</OPTION>
+<OPTION value="Berkshire">Berkshire</OPTION>
+<OPTION value="Blaenau Gwent">Blaenau Gwent</OPTION>
+<OPTION value="Bridgend">Bridgend</OPTION>
+<OPTION value="Bristol">Bristol</OPTION>
+<OPTION value="Buckinghamshire">Buckinghamshire</OPTION>
+<OPTION value="Caerphilly ">Caerphilly </OPTION>
+<OPTION value="Cambridgeshire">Cambridgeshire</OPTION>
+<OPTION value="Cardiff">Cardiff</OPTION>
+<OPTION value="Carmarthenshire">Carmarthenshire</OPTION>
+<OPTION value="Ceredidgion">Ceredidgion</OPTION>
+<OPTION value="Cheshire">Cheshire</OPTION>
+<OPTION value="ClackMannanshire">ClackMannanshire</OPTION>
+<OPTION value="Conwy">Conwy</OPTION>
+<OPTION value="Cornwall">Cornwall</OPTION>
+<OPTION value="Cumbria">Cumbria</OPTION>
+<OPTION value="Denbighshire">Denbighshire</OPTION>
+<OPTION value="Derbyshire">Derbyshire</OPTION>
+<OPTION value="Devon">Devon</OPTION>
+<OPTION value="Dorset">Dorset</OPTION>
+<OPTION value="Dumfries & Galloway">Dumfries & Galloway</OPTION>
+<OPTION value="Dundee City">Dundee City</OPTION>
+<OPTION value="Durham">Durham</OPTION>
+<OPTION value="East Ayrshire">East Ayrshire</OPTION>
+<OPTION value="East Dunbartonshire">East Dunbartonshire</OPTION>
+<OPTION value="East Lothian">East Lothian</OPTION>
+<OPTION value="East Renfrewshire">East Renfrewshire</OPTION>
+<OPTION value="East Riding of Yorkshire">East Riding of Yorkshire</OPTION>
+<OPTION value="East Sussex">East Sussex</OPTION>
+<OPTION value="Edinburgh">Edinburgh</OPTION>
+<OPTION value="Essex">Essex</OPTION>
+<OPTION value="Falkirk">Falkirk</OPTION>
+<OPTION value="Fife">Fife</OPTION>
+<OPTION value="Flintshire">Flintshire</OPTION>
+<OPTION value="Glasgow">Glasgow</OPTION>
+<OPTION value="Gloucestershire">Gloucestershire</OPTION>
+<OPTION value="Greater Manchester">Greater Manchester</OPTION>
+<OPTION value="Gwynedd">Gwynedd</OPTION>
+<OPTION value="Hampshire">Hampshire</OPTION>
+<OPTION value="Herefordshire">Herefordshire</OPTION>
+<OPTION value="Hertfordshire">Hertfordshire</OPTION>
+<OPTION value="Highlands">Highlands</OPTION>
+<OPTION value="Inverclyde">Inverclyde</OPTION>
+<OPTION value="Isle of Anglesey">Isle of Anglesey</OPTION>
+<OPTION value="Kent">Kent</OPTION>
+<OPTION value="Lancashire">Lancashire</OPTION>
+<OPTION value="Leicestershire">Leicestershire</OPTION>
+<OPTION value="Lincolnshire">Lincolnshire</OPTION>
+<OPTION value="London">London</OPTION>
+<OPTION value="Merseyside">Merseyside</OPTION>
+<OPTION value="Merthyr Tydfil">Merthyr Tydfil</OPTION>
+<OPTION value="Midlothian">Midlothian</OPTION>
+<OPTION value="Monmouthshire">Monmouthshire</OPTION>
+<OPTION value="Moray">Moray</OPTION>
+<OPTION value="Neath Port Talbot">Neath Port Talbot</OPTION>
+<OPTION value="Newport">Newport</OPTION>
+<OPTION value="Norfolk">Norfolk</OPTION>
+<OPTION value="North Ayrshire">North Ayrshire</OPTION>
+<OPTION value="North Lanarkshire">North Lanarkshire</OPTION>
+<OPTION value="North Somerset">North Somerset</OPTION>
+<OPTION value="North Yorkshire">North Yorkshire</OPTION>
+<OPTION value="Northamptonshire">Northamptonshire</OPTION>
+<OPTION value="Northumberland">Northumberland</OPTION>
+<OPTION value="Nottinghamshire">Nottinghamshire</OPTION>
+<OPTION value="Orkney">Orkney</OPTION>
+<OPTION value="Oxfordshire">Oxfordshire</OPTION>
+<OPTION value="Pembrokeshire">Pembrokeshire</OPTION>
+<OPTION value="Perth & Kinross">Perth & Kinross</OPTION>
+<OPTION value="Powys">Powys</OPTION>
+<OPTION value="Renfrewshire">Renfrewshire</OPTION>
+<OPTION value="Rhondda Cynon Taff">Rhondda Cynon Taff</OPTION>
+<OPTION value="Rutland">Rutland</OPTION>
+<OPTION value="Scottish Borders">Scottish Borders</OPTION>
+<OPTION value="Shetland">Shetland</OPTION>
+<OPTION value="Shropshire">Shropshire</OPTION>
+<OPTION value="Somerset">Somerset</OPTION>
+<OPTION value="South Lanarkshire">South Lanarkshire</OPTION>
+<OPTION value="South Yorkshire">South Yorkshire</OPTION>
+<OPTION value="Staffordshire">Staffordshire</OPTION>
+<OPTION value="Stirling">Stirling</OPTION>
+<OPTION value="Suffolk">Suffolk</OPTION>
+<OPTION value="Surrey">Surrey</OPTION>
+<OPTION value="Swansea">Swansea</OPTION>
+<OPTION value="Teesside">Teesside</OPTION>
+<OPTION value="Torfaen">Torfaen</OPTION>
+<OPTION value="Tyne & Wear">Tyne & Wear</OPTION>
+<OPTION value="Vale of Glamorgan">Vale of Glamorgan</OPTION>
+<OPTION value="Warwickshire">Warwickshire</OPTION>
+<OPTION value="West Dunbartonshire">West Dunbartonshire</OPTION>
+<OPTION value="West Lothian">West Lothian</OPTION>
+<OPTION value="West Midlands">West Midlands</OPTION>
+<OPTION value="West Sussex">West Sussex</OPTION>
+<OPTION value="West Yorkshire">West Yorkshire</OPTION>
+<OPTION value="Western Isles">Western Isles</OPTION>
+<OPTION value="Wiltshire">Wiltshire</OPTION>
+<OPTION value="Worcestershire">Worcestershire</OPTION>
+<OPTION value="Wrexham">Wrexham</OPTION>
+</select>
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">Zip/Postal Code:</td>
+<td class="ac_checkout_right_col">
+  <input type="text" name="Ecom_ShipTo_Postal_PostalCode"
+    value="$vform_Ecom_ShipTo_Postal_PostalCode" size="11" maxlength="11">
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">Country:</td>
+<td class="ac_checkout_right_col">
+  <SELECT NAME="Ecom_ShipTo_Postal_CountryCode">
+<OPTION VALUE="$vform_Ecom_ShipTo_Postal_CountryCode">$vform_Ecom_ShipTo_Postal_CountryCode
+<OPTION>United States
+<OPTION>Australia
+<OPTION>Canada
+<OPTION>Ireland
+<OPTION>Puerto Rico
+<OPTION>Scotland
+<OPTION>United Kingdom
+<OPTION>Wales
+<OPTION></option>
+<OPTION>American Samoa
+<OPTION>Argentina
+<OPTION>Austria
+<OPTION>Belgium
+<OPTION>Belize
+<OPTION>Brazil
+<OPTION>Chile
+<OPTION>Costa Rica
+<OPTION>Denmark
+<OPTION>Dominican Republic
+<OPTION>Finland
+<OPTION>France
+<OPTION>Germany
+<OPTION>Greece
+<OPTION>Guatemala
+<OPTION>Hong Kong
+<OPTION>Israel
+<OPTION>Italy
+<OPTION>Jamaica
+<OPTION>Mexico
+<OPTION>Netherlands
+<OPTION>New Zealand
+<OPTION>Norway
+<OPTION>Panama
+<OPTION>Portugal
+<OPTION>Spain
+<OPTION>Sweden
+<OPTION>Switzerland
+<OPTION>Taiwan
+<OPTION>Tonga
+<OPTION>Virgin Islands (US)
+</SELECT>
+</td>
+</tr>
+<tr>
+<td class="ac_checkout_left_col" colspan=2><input type="checkbox" name="Ecom_is_Residential" value="Ship to Residential Address">  Is this a Residential Address?
+</td>
+</tr>
+<!--agorascript-pre
+# inspired from solutions submitted from Dan at CartSoutions.net
+if ("$sc_display_checkout_tos" =~ /yes/i) { return
+q~
+<td colspan=2 class="ac_checkout_top_col">
+Terms of Service & Our Contact Information</td>
+</tr>
+<tr>
+<td colspan=2>
+$sc_tos_display_address<br><br>
+You must read the following link before you can continue:  <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="agora.cgi?page=terms_of_service.html" TARGET="_blank"><b>Sales/Terms of Service and Refund Policy</b></A>.<br>
+Then put a tick in the box below. By selecting &quot;I Agree&quot; you are acknowledging that you have read and agree to our policies contained within that page.
+<br><br>
+<input type="checkbox" name="Ecom_tos" value="I Agree">&nbsp;&nbsp;&nbsp; I Agree and have read the Terms of Service listed above (required to continue)<br><br></td>
+</tr>
+~;} -->
+<td colspan=2 class="ac_checkout_top_col">
+Misc Info</td>
+
+<tr>
+<td class="ac_checkout_left_col">E-Mail:</td>
+<td class="ac_checkout_right_col">
+  <input type="text" name="Ecom_BillTo_Online_Email"
+    value="$vform_Ecom_BillTo_Online_Email" maxlength="30">
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">Special Notes:</td>
+<td class="ac_checkout_right_col">
+  <textarea name="Ecom_XCOMMENT_Special_Notes" cols="50" rows="5">$vform_Ecom_XCOMMENT_Special_Notes</textarea>
+</td>
+</tr>
+<TR>
+<TD COLSPAN="2" ALIGN="CENTER"><INPUT 
+TYPE=HIDDEN NAME="gateway" VALUE="PayPal"><INPUT 
+TYPE=submit NAME = "submit_order_form_button"  
+VALUE = "Please Click Here To Continue"></TD>
+</TR>
+</TABLE>
+
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+</FONT>
+</CENTER>
+</FORM>
+</BODY>
+</HTML>
diff -ruN 4.0K-4b/html/forms/PlugnPay-orderform.html 5.0.000/html/forms/PlugnPay-orderform.html
--- 4.0K-4b/html/forms/PlugnPay-orderform.html	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/forms/PlugnPay-orderform.html	2006-10-31 09:40:27.000000000 -0600
@@ -2,113 +2,361 @@
 <HEAD>
 <TITLE>Step One</TITLE>
 </HEAD>
+<!--agorascript-orderform
+ &PlugnPay_order_form_prep;
+-->
 
 <BODY BGCOLOR="#ffffff">
 
 <H2>CART CONTENTS HERE</H2>
+
 <CENTER>
 
-<TABLE WIDTH="550" BORDER="0">
-  <TR>
-    <TD COLSPAN="2">
-      <P>&nbsp;</P>
-    </TD>
-  </TR>
-
-  <TR BGCOLOR="#C0FFFF">
-    <TD>
-
-<TABLE WIDTH="550" BORDER="1">
-  <TR BGCOLOR="#C0FFFF">
-    <TD ALIGN="CENTER" colspan=3><FONT FACE="ARIAL" SIZE="2" COLOR="#000000">Please select where your order will be shipped and click 'Next'</FONT></TD>
-  </tr>
-<tr>
-   <td colspan=3 align="center">Shipping Method: &nbsp;&nbsp;&nbsp;
-     <SELECT NAME="Ecom_ShipTo_Method">
-       <OPTION VALUE="UPS Ground (GNDRES)" CHECKED>UPS Ground</OPTION>
-       <OPTION VALUE="UPS 2nd Day (2DA)">UPS 2nd Day</OPTION>
-       <OPTION VALUE="UPS Next Day (1DA)">UPS Next Day</OPTION>
-       <OPTION VALUE="FEDEX Priority Overnight (Express,Priority Overnight)">FedEx Priority Overnight</OPTION>
-       <OPTION VALUE="FEDEX Express (Express,Express Saver)">FedEx Express Saver</OPTION>
-       <OPTION VALUE="FEDEX Ground (Ground,Ground)">FedEx Ground</OPTION>
-       <OPTION VALUE="FEDEX Home Delivery (Home,Home)">FedEx Home Delivery</OPTION>
-       <OPTION VALUE="USPS Parcel Post (Parcel)">USPS Parcel Post</OPTION>
-       <OPTION VALUE="USPS Priority Mail (Priority)">USPS Priority Mail</OPTION>
-       <OPTION VALUE="USPS Express Mail (Express)">USPS Express Mail</OPTION>
-       </SELECT></TD>
-  </tr>
-      
-  <TR BGCOLOR="#C0FFFF">
-    <TD ALIGN="CENTER" colspan=1>Zip/Postal Code <INPUT TYPE=TEXT NAME="Ecom_ShipTo_Postal_PostalCode" size=5></td>
-    <TD ALIGN="CENTER" colspan=1><SELECT NAME="Ecom_ShipTo_Postal_StateProv">
-      <OPTION VALUE="">Select State</OPTION>
-      <OPTION>AK</OPTION>
-       <OPTION>AL</OPTION> 
-       <OPTION>AR</OPTION>
-       <OPTION>AZ</OPTION> 
-       <OPTION>CA</OPTION> 
-       <OPTION>CO</OPTION> 
-       <OPTION>CT</OPTION> 
-       <OPTION>DC</OPTION>
-       <OPTION>DE</OPTION> 
-       <OPTION>FL</OPTION> 
-       <OPTION>GA</OPTION> 
-       <OPTION>GU</OPTION> 
-       <OPTION>HI</OPTION> 
-       <OPTION>IA</OPTION>
-       <OPTION>ID</OPTION> 
-       <OPTION>IL</OPTION> 
-       <OPTION>IN</OPTION> 
-       <OPTION>KS</OPTION> 
-       <OPTION>KY</OPTION> 
-       <OPTION>LA</OPTION> 
-       <OPTION>MA</OPTION> 
-       <OPTION>MD</OPTION>
-       <OPTION>ME</OPTION> 
-       <OPTION>MI</OPTION> 
-       <OPTION>MN</OPTION> 
-       <OPTION>MO</OPTION>
-       <OPTION>MS</OPTION> 
-       <OPTION>MT</OPTION> 
-       <OPTION>NC</OPTION> 
-       <OPTION>ND</OPTION> 
-       <OPTION>NE</OPTION> 
-       <OPTION>NH</OPTION> 
-       <OPTION>NJ</OPTION> 
-       <OPTION>NM</OPTION> 
-       <OPTION>NV</OPTION> 
-       <OPTION>NY</OPTION> 
-       <OPTION>OH</OPTION> 
-       <OPTION>OK</OPTION> 
-       <OPTION>OR</OPTION> 
-       <OPTION>PA</OPTION> 
-       <OPTION>PR</OPTION> 
-       <OPTION>RI</OPTION> 
-       <OPTION>SC</OPTION> 
-       <OPTION>SD</OPTION> 
-       <OPTION>TN</OPTION> 
-       <OPTION>TX</OPTION> 
-       <OPTION>UT</OPTION> 
-       <OPTION>VA</OPTION>
-       <OPTION>VI</OPTION> 
-       <OPTION>VT</OPTION> 
-       <OPTION>WA</OPTION> 
-       <OPTION>WI</OPTION>
-       <OPTION>WV</OPTION> 
-       <OPTION>WY</OPTION> 
-       </SELECT></TD>
-    <TD ALIGN="CENTER" colspan=1><INPUT TYPE=HIDDEN NAME="gateway" VALUE="PlugnPay">
-      <INPUT TYPE=submit NAME ="submit_order_form_button" VALUE = "Next"></TD>
-  </TR>
-</TABLE>
+<TABLE class="ac_checkout">
+<!--agorascript-pre
+if ("$sc_plugnpay_top_message" ne "") { return 
+q~<TR>
+<TD COLSPAN="2"><br><blockquote>$sc_plugnpay_top_message</blockquote></TD>
+</TR>~
+;}
+-->
+<TR>
+<TD COLSPAN="2">
+<P>&nbsp;</P>
+</TD>
+</TR>
+
+<TR>
+<TD>
+
+<TABLE>
+<TR>
+<td colspan=2 class="ac_checkout_top_col">
+Please enter initial info needed to compute your shipping</td>
+</tr>
+<tr>
+<td class="ac_checkout_left_col">Method:</td>
+<td class="ac_checkout_right_col">
+
+<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER BELOW THIS-->
+
+<select name="Ecom_ShipTo_Method">
+<option value="$vform_Ecom_ShipTo_Method"><!--agorascript-pre
+ if ("$vform_Ecom_ShipTo_Method" eq "") {
+   return " Select Shipping Method ";
+  } else {
+   return "$vform_Ecom_ShipTo_Method";
+  }
+--></option>
+<option value="Electronic Delivery">Electronic Delivery</option>
+<option value="Local Delivery">	Local Delivery</option>
+<option value="Pickup">Pickup</option>
+<option value="USPS Parcel Post (Parcel)">USPS Parcel Post (5-14 days)</option>
+<option value="USPS Priority Mail (Priority)">USPS Priority Mail (3-7 days)</option>
+<option value="USPS Express Mail (Express)">USPS Express Mail (1-3 days)</option>
+<option value="USPS (Economy (Surface) Parcel Post)">Economy (Surface) Parcel Post (4-6 weeks - international)</option>
+<option value="USPS (Airmail Parcel Post)">Airmail Parcel Post (4-10 days - international)</option>
+<option value="USPS (Global Express Mail)">Global Express Mail (3-5 days - international)</option>
+<option value="USPS (Global Express Guaranteed Document Service)">Global Express Guaranteed - Non-Document (2-3 days - international)</option>
+<option value="UPS 3 Day Select (3DS)">UPS 3 Day Select (3-4 days)</option>
+<option value="UPS 2nd Day Air (2DA)">UPS 2nd Day Air</option>
+<option value="UPS Next Day Air (1DA)">UPS Next Day Air</option>
+<OPTION VALUE="UPS Ground Residential(GNDRES)">UPS Ground Residential</OPTION>
+<OPTION VALUE="UPS Ground Commercial (GNDCOM)">UPS Ground Commercial</OPTION>
+</select>
+
+<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER ABOVE THIS-->
+
+</td>
+</TR>
+<tr>
+<td class="ac_checkout_left_col">State/Province:</td>
+<td class="ac_checkout_right_col">
+<select name="Ecom_ShipTo_Postal_StateProv">
+<option value="$vform_Ecom_ShipTo_Postal_StateProv">$vform_Ecom_ShipTo_Postal_StateProv &nbsp;</option>
+<OPTION value="">---USA---</OPTION>
+<OPTION>AK</OPTION>
+<OPTION>AL</OPTION> 
+<OPTION>AR</OPTION>
+<OPTION>AZ</OPTION> 
+<OPTION>CA</OPTION> 
+<OPTION>CO</OPTION> 
+<OPTION>CT</OPTION> 
+<OPTION>DC</OPTION>
+<OPTION>DE</OPTION> 
+<OPTION>FL</OPTION> 
+<OPTION>GA</OPTION> 
+<OPTION>GU</OPTION> 
+<OPTION>HI</OPTION> 
+<OPTION>IA</OPTION>
+<OPTION>ID</OPTION> 
+<OPTION>IL</OPTION> 
+<OPTION>IN</OPTION> 
+<OPTION>KS</OPTION> 
+<OPTION>KY</OPTION> 
+<OPTION>LA</OPTION> 
+<OPTION>MA</OPTION> 
+<OPTION>MD</OPTION>
+<OPTION>ME</OPTION> 
+<OPTION>MI</OPTION> 
+<OPTION>MN</OPTION> 
+<OPTION>MO</OPTION>
+<OPTION>MS</OPTION> 
+<OPTION>MT</OPTION> 
+<OPTION>NC</OPTION> 
+<OPTION>ND</OPTION> 
+<OPTION>NE</OPTION> 
+<OPTION>NH</OPTION> 
+<OPTION>NJ</OPTION> 
+<OPTION>NM</OPTION> 
+<OPTION>NV</OPTION> 
+<OPTION>NY</OPTION> 
+<OPTION>OH</OPTION> 
+<OPTION>OK</OPTION> 
+<OPTION>OR</OPTION> 
+<OPTION>PA</OPTION> 
+<OPTION>PR</OPTION> 
+<OPTION>RI</OPTION> 
+<OPTION>SC</OPTION> 
+<OPTION>SD</OPTION> 
+<OPTION>TN</OPTION> 
+<OPTION>TX</OPTION> 
+<OPTION>UT</OPTION> 
+<OPTION>VA</OPTION>
+<OPTION>VI</OPTION> 
+<OPTION>VT</OPTION> 
+<OPTION>WA</OPTION> 
+<OPTION>WI</OPTION>
+<OPTION>WV</OPTION> 
+<OPTION>WY</OPTION>
+<OPTION value=""></OPTION>
+<OPTION value="">--AUSTRALIA--</OPTION>
+<OPTION value="ACT">ACT</OPTION>
+<OPTION value="NSW">NSW</OPTION>
+<OPTION value="NT">NT</OPTION>
+<OPTION value="QLD">QLD</OPTION>
+<OPTION value="SA">SA</OPTION>
+<OPTION value="TAS">TAS</OPTION>
+<OPTION value="VIC">VIC</OPTION>
+<OPTION value="WA">WA</OPTION>
+<OPTION value=""></OPTION>
+<OPTION value="">--CANADA--</OPTION>
+<OPTION value="AB">AB</OPTION>
+<OPTION value="BC">BC</OPTION>
+<OPTION value="MB">MB</OPTION>
+<OPTION value="NB">NB</OPTION>
+<OPTION value="NFLD">NFLD</OPTION>
+<OPTION value="NWT">NWT</OPTION>
+<OPTION value="NS">NS</OPTION>
+<OPTION value="ON">ON</OPTION>
+<OPTION value="PEI">PEI</OPTION>
+<OPTION value="PQ">PQ</OPTION>
+<OPTION value="SK">SK</OPTION>
+<OPTION value="YK">YK</OPTION>
+<OPTION value="">--UK / England--</OPTION>
+<OPTION value="Aberdeen City">Aberdeen City</OPTION>
+<OPTION value="Aberdeenshire">Aberdeenshire</OPTION>
+<OPTION value="Angus">Angus</OPTION>
+<OPTION value="Argyll & Bute">Argyll & Bute</OPTION>
+<OPTION value="Bath & North East Somerset">Bath & North East Somerset</OPTION>
+<OPTION value="Bedfordshire">Bedfordshire</OPTION>
+<OPTION value="Berkshire">Berkshire</OPTION>
+<OPTION value="Blaenau Gwent">Blaenau Gwent</OPTION>
+<OPTION value="Bridgend">Bridgend</OPTION>
+<OPTION value="Bristol">Bristol</OPTION>
+<OPTION value="Buckinghamshire">Buckinghamshire</OPTION>
+<OPTION value="Caerphilly ">Caerphilly </OPTION>
+<OPTION value="Cambridgeshire">Cambridgeshire</OPTION>
+<OPTION value="Cardiff">Cardiff</OPTION>
+<OPTION value="Carmarthenshire">Carmarthenshire</OPTION>
+<OPTION value="Ceredidgion">Ceredidgion</OPTION>
+<OPTION value="Cheshire">Cheshire</OPTION>
+<OPTION value="ClackMannanshire">ClackMannanshire</OPTION>
+<OPTION value="Conwy">Conwy</OPTION>
+<OPTION value="Cornwall">Cornwall</OPTION>
+<OPTION value="Cumbria">Cumbria</OPTION>
+<OPTION value="Denbighshire">Denbighshire</OPTION>
+<OPTION value="Derbyshire">Derbyshire</OPTION>
+<OPTION value="Devon">Devon</OPTION>
+<OPTION value="Dorset">Dorset</OPTION>
+<OPTION value="Dumfries & Galloway">Dumfries & Galloway</OPTION>
+<OPTION value="Dundee City">Dundee City</OPTION>
+<OPTION value="Durham">Durham</OPTION>
+<OPTION value="East Ayrshire">East Ayrshire</OPTION>
+<OPTION value="East Dunbartonshire">East Dunbartonshire</OPTION>
+<OPTION value="East Lothian">East Lothian</OPTION>
+<OPTION value="East Renfrewshire">East Renfrewshire</OPTION>
+<OPTION value="East Riding of Yorkshire">East Riding of Yorkshire</OPTION>
+<OPTION value="East Sussex">East Sussex</OPTION>
+<OPTION value="Edinburgh">Edinburgh</OPTION>
+<OPTION value="Essex">Essex</OPTION>
+<OPTION value="Falkirk">Falkirk</OPTION>
+<OPTION value="Fife">Fife</OPTION>
+<OPTION value="Flintshire">Flintshire</OPTION>
+<OPTION value="Glasgow">Glasgow</OPTION>
+<OPTION value="Gloucestershire">Gloucestershire</OPTION>
+<OPTION value="Greater Manchester">Greater Manchester</OPTION>
+<OPTION value="Gwynedd">Gwynedd</OPTION>
+<OPTION value="Hampshire">Hampshire</OPTION>
+<OPTION value="Herefordshire">Herefordshire</OPTION>
+<OPTION value="Hertfordshire">Hertfordshire</OPTION>
+<OPTION value="Highlands">Highlands</OPTION>
+<OPTION value="Inverclyde">Inverclyde</OPTION>
+<OPTION value="Isle of Anglesey">Isle of Anglesey</OPTION>
+<OPTION value="Kent">Kent</OPTION>
+<OPTION value="Lancashire">Lancashire</OPTION>
+<OPTION value="Leicestershire">Leicestershire</OPTION>
+<OPTION value="Lincolnshire">Lincolnshire</OPTION>
+<OPTION value="London">London</OPTION>
+<OPTION value="Merseyside">Merseyside</OPTION>
+<OPTION value="Merthyr Tydfil">Merthyr Tydfil</OPTION>
+<OPTION value="Midlothian">Midlothian</OPTION>
+<OPTION value="Monmouthshire">Monmouthshire</OPTION>
+<OPTION value="Moray">Moray</OPTION>
+<OPTION value="Neath Port Talbot">Neath Port Talbot</OPTION>
+<OPTION value="Newport">Newport</OPTION>
+<OPTION value="Norfolk">Norfolk</OPTION>
+<OPTION value="North Ayrshire">North Ayrshire</OPTION>
+<OPTION value="North Lanarkshire">North Lanarkshire</OPTION>
+<OPTION value="North Somerset">North Somerset</OPTION>
+<OPTION value="North Yorkshire">North Yorkshire</OPTION>
+<OPTION value="Northamptonshire">Northamptonshire</OPTION>
+<OPTION value="Northumberland">Northumberland</OPTION>
+<OPTION value="Nottinghamshire">Nottinghamshire</OPTION>
+<OPTION value="Orkney">Orkney</OPTION>
+<OPTION value="Oxfordshire">Oxfordshire</OPTION>
+<OPTION value="Pembrokeshire">Pembrokeshire</OPTION>
+<OPTION value="Perth & Kinross">Perth & Kinross</OPTION>
+<OPTION value="Powys">Powys</OPTION>
+<OPTION value="Renfrewshire">Renfrewshire</OPTION>
+<OPTION value="Rhondda Cynon Taff">Rhondda Cynon Taff</OPTION>
+<OPTION value="Rutland">Rutland</OPTION>
+<OPTION value="Scottish Borders">Scottish Borders</OPTION>
+<OPTION value="Shetland">Shetland</OPTION>
+<OPTION value="Shropshire">Shropshire</OPTION>
+<OPTION value="Somerset">Somerset</OPTION>
+<OPTION value="South Lanarkshire">South Lanarkshire</OPTION>
+<OPTION value="South Yorkshire">South Yorkshire</OPTION>
+<OPTION value="Staffordshire">Staffordshire</OPTION>
+<OPTION value="Stirling">Stirling</OPTION>
+<OPTION value="Suffolk">Suffolk</OPTION>
+<OPTION value="Surrey">Surrey</OPTION>
+<OPTION value="Swansea">Swansea</OPTION>
+<OPTION value="Teesside">Teesside</OPTION>
+<OPTION value="Torfaen">Torfaen</OPTION>
+<OPTION value="Tyne & Wear">Tyne & Wear</OPTION>
+<OPTION value="Vale of Glamorgan">Vale of Glamorgan</OPTION>
+<OPTION value="Warwickshire">Warwickshire</OPTION>
+<OPTION value="West Dunbartonshire">West Dunbartonshire</OPTION>
+<OPTION value="West Lothian">West Lothian</OPTION>
+<OPTION value="West Midlands">West Midlands</OPTION>
+<OPTION value="West Sussex">West Sussex</OPTION>
+<OPTION value="West Yorkshire">West Yorkshire</OPTION>
+<OPTION value="Western Isles">Western Isles</OPTION>
+<OPTION value="Wiltshire">Wiltshire</OPTION>
+<OPTION value="Worcestershire">Worcestershire</OPTION>
+<OPTION value="Wrexham">Wrexham</OPTION>
+</select>
+</td>
+</tr>
 
-    </TD>
-  </TR>
+<tr>
+<td class="ac_checkout_left_col">Zip/Postal Code:</td>
+<td class="ac_checkout_right_col">
+  <input type="text" name="Ecom_ShipTo_Postal_PostalCode"
+    value="$eform_Ecom_ShipTo_Postal_PostalCode" size="11" maxlength="11">
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">Country:</td>
+<td class="ac_checkout_right_col">
+  <SELECT NAME="Ecom_ShipTo_Postal_CountryCode">
+<OPTION VALUE="$vform_Ecom_ShipTo_Postal_CountryCode">$vform_Ecom_ShipTo_Postal_CountryCode
+<OPTION>United States
+<OPTION>Australia
+<OPTION>Canada
+<OPTION>Ireland
+<OPTION>Puerto Rico
+<OPTION>Scotland
+<OPTION>United Kingdom
+<OPTION>Wales
+<OPTION></option>
+<OPTION>American Samoa
+<OPTION>Argentina
+<OPTION>Austria
+<OPTION>Belgium
+<OPTION>Belize
+<OPTION>Brazil
+<OPTION>Chile
+<OPTION>Costa Rica
+<OPTION>Denmark
+<OPTION>Dominican Republic
+<OPTION>Finland
+<OPTION>France
+<OPTION>Germany
+<OPTION>Greece
+<OPTION>Guatemala
+<OPTION>Hong Kong
+<OPTION>Israel
+<OPTION>Italy
+<OPTION>Jamaica
+<OPTION>Mexico
+<OPTION>Netherlands
+<OPTION>New Zealand
+<OPTION>Norway
+<OPTION>Panama
+<OPTION>Portugal
+<OPTION>Spain
+<OPTION>Sweden
+<OPTION>Switzerland
+<OPTION>Taiwan
+<OPTION>Tonga
+<OPTION>Virgin Islands (US)
+</SELECT>
+</td>
+</tr>
+<tr>
+<td class="ac_checkout_left_col" colspan=2><input type="checkbox" name="Ecom_is_Residential" value="Ship to Residential Address">  Is this a Residential Address?
+</td>
+</tr>
+<!--agorascript-pre
+# inspired from solutions submitted from Dan at CartSoutions.net
+if ("$sc_display_checkout_tos" =~ /yes/i) { return
+q~
+<td colspan=2 class="ac_checkout_top_col">
+Terms of Service & Our Contact Information</td>
+</tr>
+<tr>
+<td colspan=2>
+$sc_tos_display_address<br><br>
+You must read the following link before you can continue:  <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="agora.cgi?page=terms_of_service.html" TARGET="_blank"><b>Sales/Terms of Service and Refund Policy</b></A>.<br>
+Then put a tick in the box below. By selecting &quot;I Agree&quot; you are acknowledging that you have read and agree to our policies contained within that page.
+<br><br>
+<input type="checkbox" name="Ecom_tos" value="I Agree">&nbsp;&nbsp;&nbsp; I Agree and have read the Terms of Service listed above (required to continue)<br><br></td>
+</tr>
+~;} -->
+
+<tr>
+<td class="ac_checkout_left_col">Special Notes:</td>
+<td class="ac_checkout_right_col">
+  <textarea name="Ecom_XCOMMENT_Special_Notes" cols="50" rows="5">$eform_Ecom_XCOMMENT_Special_Notes</textarea>
+</td>
+</tr>
+<TR>
+<TD COLSPAN="2" ALIGN="CENTER"><INPUT 
+TYPE=HIDDEN NAME="gateway" VALUE="PlugnPay"><INPUT 
+TYPE=submit NAME = "submit_order_form_button"  
+VALUE = "Please Click Here To Continue"></TD>
+</TR>
 </TABLE>
 
+</TD>
+</TR>
+</TABLE>
+</CENTER>
 </FONT>
 </CENTER>
 </FORM>
-
 </BODY>
 </HTML>
diff -ruN 4.0K-4b/html/forms/USAepay-orderform.html 5.0.000/html/forms/USAepay-orderform.html
--- 4.0K-4b/html/forms/USAepay-orderform.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/forms/USAepay-orderform.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,836 @@
+<html>
+<head>
+<title>Step One - Checkout Process</title>
+</head>
+<!--agorascript-orderform
+ &USAepay_order_form_prep;
+-->
+<body>
+
+<h2>CART CONTENTS HERE</h2>
+
+
+
+<div align="center">
+<table class="ac_checkout">
+<!--agorascript-pre
+if ("$sc_USAepay_top_message" ne "") { return
+q~<tr>
+<td colspan="2"><br><blockquote>$sc_USAepay_top_message</blockquote><br></td>
+</tr>~
+;}
+-->
+
+<tr>
+  <td colspan="2" class="ac_checkout_top_col">
+    Purchase & Billing Information:
+  </td>
+</tr>
+
+<tr>
+  <td class="ac_checkout_left_col">First name</td>
+  <td class="ac_checkout_right_col">
+    <input type="text" name="Ecom_BillTo_Postal_Name_First"
+      value="$eform_Ecom_BillTo_Postal_Name_First" size="30" maxlength="30">
+  </td>
+</tr>
+
+<tr>
+  <td class="ac_checkout_left_col">Last name</td>
+  <td class="ac_checkout_right_col">
+    <input type="text" name="Ecom_BillTo_Postal_Name_Last"
+      value="$eform_Ecom_BillTo_Postal_Name_Last" size="30" maxlength="30">
+  </td>
+</tr>
+
+<tr>
+  <td class="ac_checkout_left_col">Street:</td>
+  <td class="ac_checkout_right_col">
+    <input type="text" name="Ecom_BillTo_Postal_Street_Line1"
+      value="$eform_Ecom_BillTo_Postal_Street_Line1" size="30">
+  </td>
+</tr>
+
+<tr>
+  <td class="ac_checkout_left_col">City:</td>
+  <td class="ac_checkout_right_col">
+    <input type="text" name="Ecom_BillTo_Postal_City"
+      value="$eform_Ecom_BillTo_Postal_City" size="30">
+  </td>
+</tr>
+
+<tr>
+  <td class="ac_checkout_left_col">State/Province:</td>
+  <td class="ac_checkout_right_col">
+    <select name="Ecom_BillTo_Postal_StateProv">
+      <option value="$eform_Ecom_BillTo_Postal_StateProv">$eform_Ecom_BillTo_Postal_StateProv &nbsp;</option>
+      <option value="">---USA---</option>
+      <option>AK</option>
+      <option>AL</option> 
+      <option>AR</option>
+      <option>AZ</option> 
+      <option>CA</option> 
+      <option>CO</option> 
+      <option>CT</option> 
+      <option>DC</option>
+      <option>DE</option> 
+      <option>FL</option> 
+      <option>GA</option> 
+      <option>GU</option> 
+      <option>HI</option> 
+      <option>IA</option>
+      <option>ID</option> 
+      <option>IL</option> 
+      <option>IN</option> 
+      <option>KS</option> 
+      <option>KY</option> 
+      <option>LA</option> 
+      <option>MA</option> 
+      <option>MD</option>
+      <option>ME</option> 
+      <option>MI</option> 
+      <option>MN</option> 
+      <option>MO</option>
+      <option>MS</option> 
+      <option>MT</option> 
+      <option>NC</option> 
+      <option>ND</option> 
+      <option>NE</option> 
+      <option>NH</option> 
+      <option>NJ</option> 
+      <option>NM</option> 
+      <option>NV</option> 
+      <option>NY</option> 
+      <option>OH</option> 
+      <option>OK</option> 
+      <option>OR</option> 
+      <option>PA</option> 
+      <option>PR</option> 
+      <option>RI</option> 
+      <option>SC</option> 
+      <option>SD</option> 
+      <option>TN</option> 
+      <option>TX</option> 
+      <option>UT</option> 
+      <option>VA</option>
+      <option>VI</option> 
+      <option>VT</option> 
+      <option>WA</option> 
+      <option>WI</option>
+      <option>WV</option> 
+      <option>WY</option>
+      <option value=""></option>
+      <option value="">--AUSTRALIA--</option>
+      <option value="ACT">ACT</option>
+      <option value="NSW">NSW</option>
+      <option value="NT">NT</option>
+      <option value="QLD">QLD</option>
+      <option value="SA">SA</option>
+      <option value="TAS">TAS</option>
+      <option value="VIC">VIC</option>
+      <option value="WA">WA</option>
+      <option value=""></option>
+      <option value="">--CANADA--</option>
+      <option value="AB">AB</option>
+      <option value="BC">BC</option>
+      <option value="MB">MB</option>
+      <option value="NB">NB</option>
+      <option value="NFLD">NFLD</option>
+      <option value="NWT">NWT</option>
+      <option value="NS">NS</option>
+      <option value="ON">ON</option>
+      <option value="PEI">PEI</option>
+      <option value="PQ">PQ</option>
+      <option value="SK">SK</option>
+      <option value="YK">YK</option>
+      <option value="">--UK / England--</option>
+      <option value="Aberdeen City">Aberdeen City</option>
+      <option value="Aberdeenshire">Aberdeenshire</option>
+      <option value="Angus">Angus</option>
+      <option value="Argyll & Bute">Argyll & Bute</option>
+      <option value="Bath & North East Somerset">Bath & North East Somerset</option>
+      <option value="Bedfordshire">Bedfordshire</option>
+      <option value="Berkshire">Berkshire</option>
+      <option value="Blaenau Gwent">Blaenau Gwent</option>
+      <option value="Bridgend">Bridgend</option>
+      <option value="Bristol">Bristol</option>
+      <option value="Buckinghamshire">Buckinghamshire</option>
+      <option value="Caerphilly ">Caerphilly </option>
+      <option value="Cambridgeshire">Cambridgeshire</option>
+      <option value="Cardiff">Cardiff</option>
+      <option value="Carmarthenshire">Carmarthenshire</option>
+      <option value="Ceredidgion">Ceredidgion</option>
+      <option value="Cheshire">Cheshire</option>
+      <option value="ClackMannanshire">ClackMannanshire</option>
+      <option value="Conwy">Conwy</option>
+      <option value="Cornwall">Cornwall</option>
+      <option value="Cumbria">Cumbria</option>
+      <option value="Denbighshire">Denbighshire</option>
+      <option value="Derbyshire">Derbyshire</option>
+      <option value="Devon">Devon</option>
+      <option value="Dorset">Dorset</option>
+      <option value="Dumfries & Galloway">Dumfries & Galloway</option>
+      <option value="Dundee City">Dundee City</option>
+      <option value="Durham">Durham</option>
+      <option value="East Ayrshire">East Ayrshire</option>
+      <option value="East Dunbartonshire">East Dunbartonshire</option>
+      <option value="East Lothian">East Lothian</option>
+      <option value="East Renfrewshire">East Renfrewshire</option>
+      <option value="East Riding of Yorkshire">East Riding of Yorkshire</option>
+      <option value="East Sussex">East Sussex</option>
+      <option value="Edinburgh">Edinburgh</option>
+      <option value="Essex">Essex</option>
+      <option value="Falkirk">Falkirk</option>
+      <option value="Fife">Fife</option>
+      <option value="Flintshire">Flintshire</option>
+      <option value="Glasgow">Glasgow</option>
+      <option value="Gloucestershire">Gloucestershire</option>
+      <option value="Greater Manchester">Greater Manchester</option>
+      <option value="Gwynedd">Gwynedd</option>
+      <option value="Hampshire">Hampshire</option>
+      <option value="Herefordshire">Herefordshire</option>
+      <option value="Hertfordshire">Hertfordshire</option>
+      <option value="Highlands">Highlands</option>
+      <option value="Inverclyde">Inverclyde</option>
+      <option value="Isle of Anglesey">Isle of Anglesey</option>
+      <option value="Kent">Kent</option>
+      <option value="Lancashire">Lancashire</option>
+      <option value="Leicestershire">Leicestershire</option>
+      <option value="Lincolnshire">Lincolnshire</option>
+      <option value="London">London</option>
+      <option value="Merseyside">Merseyside</option>
+      <option value="Merthyr Tydfil">Merthyr Tydfil</option>
+      <option value="Midlothian">Midlothian</option>
+      <option value="Monmouthshire">Monmouthshire</option>
+      <option value="Moray">Moray</option>
+      <option value="Neath Port Talbot">Neath Port Talbot</option>
+      <option value="Newport">Newport</option>
+      <option value="Norfolk">Norfolk</option>
+      <option value="North Ayrshire">North Ayrshire</option>
+      <option value="North Lanarkshire">North Lanarkshire</option>
+      <option value="North Somerset">North Somerset</option>
+      <option value="North Yorkshire">North Yorkshire</option>
+      <option value="Northamptonshire">Northamptonshire</option>
+      <option value="Northumberland">Northumberland</option>
+      <option value="Nottinghamshire">Nottinghamshire</option>
+      <option value="Orkney">Orkney</option>
+      <option value="Oxfordshire">Oxfordshire</option>
+      <option value="Pembrokeshire">Pembrokeshire</option>
+      <option value="Perth & Kinross">Perth & Kinross</option>
+      <option value="Powys">Powys</option>
+      <option value="Renfrewshire">Renfrewshire</option>
+      <option value="Rhondda Cynon Taff">Rhondda Cynon Taff</option>
+      <option value="Rutland">Rutland</option>
+      <option value="Scottish Borders">Scottish Borders</option>
+      <option value="Shetland">Shetland</option>
+      <option value="Shropshire">Shropshire</option>
+      <option value="Somerset">Somerset</option>
+      <option value="South Lanarkshire">South Lanarkshire</option>
+      <option value="South Yorkshire">South Yorkshire</option>
+      <option value="Staffordshire">Staffordshire</option>
+      <option value="Stirling">Stirling</option>
+      <option value="Suffolk">Suffolk</option>
+      <option value="Surrey">Surrey</option>
+      <option value="Swansea">Swansea</option>
+      <option value="Teesside">Teesside</option>
+      <option value="Torfaen">Torfaen</option>
+      <option value="Tyne & Wear">Tyne & Wear</option>
+      <option value="Vale of Glamorgan">Vale of Glamorgan</option>
+      <option value="Warwickshire">Warwickshire</option>
+      <option value="West Dunbartonshire">West Dunbartonshire</option>
+      <option value="West Lothian">West Lothian</option>
+      <option value="West Midlands">West Midlands</option>
+      <option value="West Sussex">West Sussex</option>
+      <option value="West Yorkshire">West Yorkshire</option>
+      <option value="Western Isles">Western Isles</option>
+      <option value="Wiltshire">Wiltshire</option>
+      <option value="Worcestershire">Worcestershire</option>
+      <option value="Wrexham">Wrexham</option>
+    </select>
+  </td>
+</tr>
+
+<tr>
+  <td class="ac_checkout_left_col">Zip/Postal Code:</td>
+  <td class="ac_checkout_right_col">
+    <input type="text" name="Ecom_BillTo_PostalCode"
+      value="$eform_Ecom_BillTo_PostalCode" size="11" maxlength="11">
+  </td>
+</tr>
+
+
+<tr>
+  <td class="ac_checkout_left_col">Country:</td>
+  <td class="ac_checkout_right_col">
+    <select name="Ecom_BillTo_Postal_CountryCode">
+      <option value="$vform_Ecom_BillTo_Postal_CountryCode">$vform_Ecom_BillTo_Postal_CountryCode</option>
+      <option>United States</option>
+      <option>Australia</option>
+      <option>Canada</option>
+      <option>Ireland</option>
+      <option>Puerto Rico</option>
+      <option>Scotland</option>
+      <option>United Kingdom</option>
+      <option>Wales</option>
+      <option></option>
+      <option>American Samoa</option>
+      <option>Argentina</option>
+      <option>Austria</option>
+      <option>Belgium</option>
+      <option>Belize</option>
+      <option>Brazil</option>
+      <option>Chile</option>
+      <option>Costa Rica</option>
+      <option>Denmark</option>
+      <option>Dominican Republic</option>
+      <option>Finland</option>
+      <option>France</option>
+      <option>Germany</option>
+      <option>Greece</option>
+      <option>Guatemala</option>
+      <option>Hong Kong</option>
+      <option>Israel</option>
+      <option>Italy</option>
+      <option>Jamaica</option>
+      <option>Mexico</option>
+      <option>Netherlands</option>
+      <option>New Zealand</option>
+      <option>Norway</option>
+      <option>Panama</option>
+      <option>Portugal</option>
+      <option>Spain</option>
+      <option>Sweden</option>
+      <option>Switzerland</option>
+      <option>Taiwan</option>
+      <option>Tonga</option>
+      <option>Virgin Islands (US)</option>
+    </select>
+  </td>
+</tr>
+
+<tr>
+  <td colspan="2"><hr/></td>
+</tr>
+
+
+<tr>
+<td colspan="2"><b>Credit Card</b>: 
+Card Type:  <select name=Ecom_Payment_Card_Type>
+<option>$eform_Ecom_Payment_Card_Type</option>
+<option>Visa</option>
+<option>Mastercard</option>
+<!--agorascript-pre
+if ("$acceptdiscover" =~ /yes/i) {
+return q~<option>Discover</option>~;
+}
+-->
+<!--agorascript-pre
+if ("$acceptamex" =~ /yes/i) {
+return q~<option>American Express</option>~;
+}
+-->
+</select><br/>
+</td>
+</tr>
+
+
+<!-- <input type="hidden" name="Ecom_Payment2_Pay_type" value="CC">-->
+<!--agorascript-orderform
+  $ags_Ecom_Payment_Card_Number=$vform_Ecom_Payment2_Card_Number;
+return '';
+-->
+
+<tr>
+<td class="ac_checkout_left_col">Number:</td>
+<td class="ac_checkout_rught_col">
+  <input type="text" name="Ecom_Payment2_Card_Number"
+    value="$ags_Ecom_Payment_Card_Number" maxlength="20">
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">Exp. Date:</td>
+<td class="ac_checkout_right_col">
+<select name="Ecom_Payment_Card_ExpDate_Month">
+<option value="$vform_Ecom_Payment_Card_ExpDate_Month">
+
+<!--agorascript-pre
+ if ("$vform_Ecom_Payment_Card_ExpDate_Month" eq "") {
+   return "Month";
+  } else {
+   return "$vform_Ecom_Payment_Card_ExpDate_Month";
+  }
+-->
+
+</option>
+<option value="01">1 - Jan</option>
+<option value="02">2 - Feb</option>
+<option value="03">3 - Mar</option>
+<option value="04">4 - Apr</option>
+<option value="05">5 - May</option>
+<option value="06">6 - Jun</option>
+<option value="07">7 - Jul</option>
+<option value="08">8 - Aug</option>
+<option value="09">9 - Sep</option>
+<option value="10">10 - Oct</option>
+<option value="11">11 - Nov</option>
+<option value="12">12 - Dec</option>
+</select>
+
+<select name="Ecom_Payment_Card_ExpDate_Year">
+<option value="$vform_Ecom_Payment_Card_ExpDate_Year">
+
+<!--agorascript-pre
+ if ("$vform_Ecom_Payment_Card_ExpDate_Year" eq "") {
+   return " Year ";
+  } else {
+   return "$vform_Ecom_Payment_Card_ExpDate_Year";
+  }
+-->
+
+</option>
+<option value="06"> 2006</option>
+<option value="07"> 2007</option>
+<option value="08"> 2008</option>
+<option value="09"> 2009</option>
+<option value="10"> 2010</option>
+<option value="11"> 2011</option>
+<option value="12"> 2012</option>
+<option value="13"> 2013</option>
+<option value="14"> 2014</option>
+<option value="15"> 2015</option>
+<option value="16"> 2016</option>
+</select>
+</td>
+</tr>
+
+<!--agorascript-pre
+if ("$sc_USAepay_enable_cvv" =~ /yes/i) { return
+q~
+<tr>
+  <td class="ac_checkout_left_col">CVV2:</td>
+  <td class="ac_checkout_right_col">
+    <input type="text" NAME="Ecom_Payment_Card_CVV" value="$eform_Ecom_Payment_Card_CVV">
+    &nbsp;&nbsp; <a href="#" onClick="MyWindow=window.open('$sc_store_url?page=cvv2.html','MyWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=275,height=290'); return false;" target="_new"><font size=-1>what is this?</font></a>
+  </td>
+</tr>
+~;
+}
+-->
+<tr>
+<td colspan=2 class="ac_checkout_top_col">Shipping Information: (if different from billing information)</td>
+</tr>
+
+<!--agorascript-pre
+if ("$sc_USAepay_shipping_message" ne "") { return
+q~<tr>
+<td colspan="2"><blockquote>$sc_USAepay_shipping_message</blockquote></td>
+</tr>~
+;}
+-->
+<tr>
+<td class="ac_checkout_left_col">Method:</td>
+<td class="ac_checkout_right_col">
+
+
+<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER BELOW THIS-->
+
+<select name="Ecom_ShipTo_Method">
+<option value="$vform_Ecom_ShipTo_Method"><!--agorascript-pre
+ if ("$vform_Ecom_ShipTo_Method" eq "") {
+   return " Select Shipping Method ";
+  } else {
+   return "$vform_Ecom_ShipTo_Method";
+  }
+--></option>
+<option value="Electronic Delivery">Electronic Delivery</option>
+<option value="Local Delivery">	Local Delivery</option>
+<option value="Pickup">Pickup</option>
+<option value="USPS Parcel Post (Parcel)">USPS Parcel Post (5-14 days)</option>
+<option value="USPS Priority Mail (Priority)">USPS Priority Mail (3-7 days)</option>
+<option value="USPS Express Mail (Express)">USPS Express Mail (1-3 days)</option>
+<option value="USPS (Economy (Surface) Parcel Post)">Economy (Surface) Parcel Post (4-6 weeks - international)</option>
+<option value="USPS (Airmail Parcel Post)">Airmail Parcel Post (4-10 days - international)</option>
+<option value="USPS (Global Express Mail)">Global Express Mail (3-5 days - international)</option>
+<option value="USPS (Global Express Guaranteed Document Service)">Global Express Guaranteed - Non-Document (2-3 days - international)</option>
+<option value="UPS 3 Day Select (3DS)">UPS 3 Day Select (3-4 days)</option>
+<option value="UPS 2nd Day Air (2DA)">UPS 2nd Day Air</option>
+<option value="UPS Next Day Air (1DA)">UPS Next Day Air</option>
+<OPTION VALUE="UPS Ground Residential(GNDRES)">UPS Ground Residential</OPTION>
+<OPTION VALUE="UPS Ground Commercial (GNDCOM)">UPS Ground Commercial</OPTION>
+</select>
+
+
+<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER ABOVE THIS-->
+
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">First name</td>
+<td class="ac_checkout_right_col">
+  <input type="text" name="Ecom_ShipTo_Postal_Name_First"
+    value="$eform_Ecom_ShipTo_Postal_Name_First" size="30" maxlength="30">
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">Last name</td>
+<td class="ac_checkout_right_col">
+  <input type="text" name="Ecom_ShipTo_Postal_Name_Last"
+    value="$eform_Ecom_ShipTo_Postal_Name_Last" size="30" maxlength="30">
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">Street:</td>
+<td class="ac_checkout_right_col">
+  <input type="text" name="Ecom_ShipTo_Postal_Street_Line1"
+    value="$eform_Ecom_ShipTo_Postal_Street_Line1" size="30">
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">City:</td>
+<td class="ac_checkout_right_col">
+  <input type="text" name="Ecom_ShipTo_Postal_City"
+    value="$eform_Ecom_ShipTo_Postal_City" size="30">
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">State/Province:</td>
+<td class="ac_checkout_right_col">
+<select name="Ecom_ShipTo_Postal_StateProv">
+<option value="$vform_Ecom_ShipTo_Postal_StateProv">$vform_Ecom_ShipTo_Postal_StateProv &nbsp;</option>
+<option>---USA---</option>
+<option>AK</option>
+<option>AL</option> 
+<option>AR</option>
+<option>AZ</option> 
+<option>CA</option> 
+<option>CO</option> 
+<option>CT</option> 
+<option>DC</option>
+<option>DE</option> 
+<option>FL</option> 
+<option>GA</option> 
+<option>GU</option> 
+<option>HI</option> 
+<option>IA</option>
+<option>ID</option> 
+<option>IL</option> 
+<option>IN</option> 
+<option>KS</option> 
+<option>KY</option> 
+<option>LA</option> 
+<option>MA</option> 
+<option>MD</option>
+<option>ME</option> 
+<option>MI</option> 
+<option>MN</option> 
+<option>MO</option>
+<option>MS</option> 
+<option>MT</option> 
+<option>NC</option> 
+<option>ND</option> 
+<option>NE</option> 
+<option>NH</option> 
+<option>NJ</option> 
+<option>NM</option> 
+<option>NV</option> 
+<option>NY</option> 
+<option>OH</option> 
+<option>OK</option> 
+<option>OR</option> 
+<option>PA</option> 
+<option>PR</option> 
+<option>RI</option> 
+<option>SC</option> 
+<option>SD</option> 
+<option>TN</option> 
+<option>TX</option> 
+<option>UT</option> 
+<option>VA</option>
+<option>VI</option> 
+<option>VT</option> 
+<option>WA</option> 
+<option>WI</option>
+<option>WV</option> 
+<option>WY</option>
+<option value=""></option>
+<option value="">--AUSTRALIA--</option>
+<option value="ACT">ACT</option>
+<option value="NSW">NSW</option>
+<option value="NT">NT</option>
+<option value="QLD">QLD</option>
+<option value="SA">SA</option>
+<option value="TAS">TAS</option>
+<option value="VIC">VIC</option>
+<option value="WA">WA</option>
+<option value=""></option>
+<option value="">--CANADA--</option>
+<option value="AB">AB</option>
+<option value="BC">BC</option>
+<option value="MB">MB</option>
+<option value="NB">NB</option>
+<option value="NFLD">NFLD</option>
+<option value="NWT">NWT</option>
+<option value="NS">NS</option>
+<option value="ON">ON</option>
+<option value="PEI">PEI</option>
+<option value="PQ">PQ</option>
+<option value="SK">SK</option>
+<option value="YK">YK</option>
+<option value="">--UK / England--</option>
+<option value="Aberdeen City">Aberdeen City</option>
+<option value="Aberdeenshire">Aberdeenshire</option>
+<option value="Angus">Angus</option>
+<option value="Argyll & Bute">Argyll & Bute</option>
+<option value="Bath & North East Somerset">Bath & North East Somerset</option>
+<option value="Bedfordshire">Bedfordshire</option>
+<option value="Berkshire">Berkshire</option>
+<option value="Blaenau Gwent">Blaenau Gwent</option>
+<option value="Bridgend">Bridgend</option>
+<option value="Bristol">Bristol</option>
+<option value="Buckinghamshire">Buckinghamshire</option>
+<option value="Caerphilly ">Caerphilly </option>
+<option value="Cambridgeshire">Cambridgeshire</option>
+<option value="Cardiff">Cardiff</option>
+<option value="Carmarthenshire">Carmarthenshire</option>
+<option value="Ceredidgion">Ceredidgion</option>
+<option value="Cheshire">Cheshire</option>
+<option value="ClackMannanshire">ClackMannanshire</option>
+<option value="Conwy">Conwy</option>
+<option value="Cornwall">Cornwall</option>
+<option value="Cumbria">Cumbria</option>
+<option value="Denbighshire">Denbighshire</option>
+<option value="Derbyshire">Derbyshire</option>
+<option value="Devon">Devon</option>
+<option value="Dorset">Dorset</option>
+<option value="Dumfries & Galloway">Dumfries & Galloway</option>
+<option value="Dundee City">Dundee City</option>
+<option value="Durham">Durham</option>
+<option value="East Ayrshire">East Ayrshire</option>
+<option value="East Dunbartonshire">East Dunbartonshire</option>
+<option value="East Lothian">East Lothian</option>
+<option value="East Renfrewshire">East Renfrewshire</option>
+<option value="East Riding of Yorkshire">East Riding of Yorkshire</option>
+<option value="East Sussex">East Sussex</option>
+<option value="Edinburgh">Edinburgh</option>
+<option value="Essex">Essex</option>
+<option value="Falkirk">Falkirk</option>
+<option value="Fife">Fife</option>
+<option value="Flintshire">Flintshire</option>
+<option value="Glasgow">Glasgow</option>
+<option value="Gloucestershire">Gloucestershire</option>
+<option value="Greater Manchester">Greater Manchester</option>
+<option value="Gwynedd">Gwynedd</option>
+<option value="Hampshire">Hampshire</option>
+<option value="Herefordshire">Herefordshire</option>
+<option value="Hertfordshire">Hertfordshire</option>
+<option value="Highlands">Highlands</option>
+<option value="Inverclyde">Inverclyde</option>
+<option value="Isle of Anglesey">Isle of Anglesey</option>
+<option value="Kent">Kent</option>
+<option value="Lancashire">Lancashire</option>
+<option value="Leicestershire">Leicestershire</option>
+<option value="Lincolnshire">Lincolnshire</option>
+<option value="London">London</option>
+<option value="Merseyside">Merseyside</option>
+<option value="Merthyr Tydfil">Merthyr Tydfil</option>
+<option value="Midlothian">Midlothian</option>
+<option value="Monmouthshire">Monmouthshire</option>
+<option value="Moray">Moray</option>
+<option value="Neath Port Talbot">Neath Port Talbot</option>
+<option value="Newport">Newport</option>
+<option value="Norfolk">Norfolk</option>
+<option value="North Ayrshire">North Ayrshire</option>
+<option value="North Lanarkshire">North Lanarkshire</option>
+<option value="North Somerset">North Somerset</option>
+<option value="North Yorkshire">North Yorkshire</option>
+<option value="Northamptonshire">Northamptonshire</option>
+<option value="Northumberland">Northumberland</option>
+<option value="Nottinghamshire">Nottinghamshire</option>
+<option value="Orkney">Orkney</option>
+<option value="Oxfordshire">Oxfordshire</option>
+<option value="Pembrokeshire">Pembrokeshire</option>
+<option value="Perth & Kinross">Perth & Kinross</option>
+<option value="Powys">Powys</option>
+<option value="Renfrewshire">Renfrewshire</option>
+<option value="Rhondda Cynon Taff">Rhondda Cynon Taff</option>
+<option value="Rutland">Rutland</option>
+<option value="Scottish Borders">Scottish Borders</option>
+<option value="Shetland">Shetland</option>
+<option value="Shropshire">Shropshire</option>
+<option value="Somerset">Somerset</option>
+<option value="South Lanarkshire">South Lanarkshire</option>
+<option value="South Yorkshire">South Yorkshire</option>
+<option value="Staffordshire">Staffordshire</option>
+<option value="Stirling">Stirling</option>
+<option value="Suffolk">Suffolk</option>
+<option value="Surrey">Surrey</option>
+<option value="Swansea">Swansea</option>
+<option value="Teesside">Teesside</option>
+<option value="Torfaen">Torfaen</option>
+<option value="Tyne & Wear">Tyne & Wear</option>
+<option value="Vale of Glamorgan">Vale of Glamorgan</option>
+<option value="Warwickshire">Warwickshire</option>
+<option value="West Dunbartonshire">West Dunbartonshire</option>
+<option value="West Lothian">West Lothian</option>
+<option value="West Midlands">West Midlands</option>
+<option value="West Sussex">West Sussex</option>
+<option value="West Yorkshire">West Yorkshire</option>
+<option value="Western Isles">Western Isles</option>
+<option value="Wiltshire">Wiltshire</option>
+<option value="Worcestershire">Worcestershire</option>
+<option value="Wrexham">Wrexham</option>
+</select>
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">Zip/Postal Code:</td>
+<td class="ac_checkout_right_col">
+  <input type="text" name="Ecom_ShipTo_Postal_PostalCode"
+    value="$eform_Ecom_ShipTo_Postal_PostalCode" size="11" maxlength="11">
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">Country:</td>
+<td class="ac_checkout_right_col">
+  <select name="Ecom_ShipTo_Postal_CountryCode">
+<option value="$vform_Ecom_ShipTo_Postal_CountryCode">$vform_Ecom_ShipTo_Postal_CountryCode</option>
+<option>United States</option>
+<option>Australia</option>
+<option>Canada</option>
+<option>Ireland</option>
+<option>Puerto Rico</option>
+<option>Scotland</option>
+<option>United Kingdom</option>
+<option>Wales</option>
+<option></option>
+<option>American Samoa</option>
+<option>Argentina</option>
+<option>Austria</option>
+<option>Belgium</option>
+<option>Belize</option>
+<option>Brazil</option>
+<option>Chile</option>
+<option>Costa Rica</option>
+<option>Denmark</option>
+<option>Dominican Republic</option>
+<option>Finland</option>
+<option>France</option>
+<option>Germany</option>
+<option>Greece</option>
+<option>Guatemala</option>
+<option>Hong Kong</option>
+<option>Israel</option>
+<option>Italy</option>
+<option>Jamaica</option>
+<option>Mexico</option>
+<option>Netherlands</option>
+<option>New Zealand</option>
+<option>Norway</option>
+<option>Panama</option>
+<option>Portugal</option>
+<option>Spain</option>
+<option>Sweden</option>
+<option>Switzerland</option>
+<option>Taiwan</option>
+<option>Tonga</option>
+<option>Virgin Islands (US)</option>
+
+</select>
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col" colspan=2><input type="checkbox" name="Ecom_is_Residential" value="Ship to Residential Address">  Is this a Residential Address?
+</td>
+</tr>
+
+<tr>
+<td colspan="2" class="ac_checkout_top_col">Phone/Email:</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">Phone:</td>
+<td class="ac_checkout_right_col">
+  <input type="text" name="Ecom_BillTo_Telecom_Phone_Number"
+    value="$eform_Ecom_BillTo_Telecom_Phone_Number" size="15" maxlength="15">
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">E-Mail:</td>
+<td class="ac_checkout_right_col">
+  <input type="text" name="Ecom_BillTo_Online_Email"
+    value="$eform_Ecom_BillTo_Online_Email" maxlength="30">
+</td>
+</tr>
+
+<tr>
+<td colspan="2"><hr/></td>
+</tr>
+
+<!--agorascript-pre
+if ("$sc_USAepay_special_message" ne "") { return
+q~<tr>
+<td colspan="2"><blockquote>$sc_USAepay_special_message</blockquote></td>
+</tr>~
+;}
+-->
+
+<tr>
+<td class="ac_checkout_left_col">Special Notes:</td>
+<td class="ac_checkout_right_col">
+  <textarea name="Ecom_XCOMMENT_Special_Notes" cols="50" rows="5">$eform_Ecom_XCOMMENT_Special_Notes</textarea>
+</td>
+</tr>
+
+<!--agorascript-pre
+# inspired from solutions submitted from Dan at CartSoutions.net
+if ("$sc_display_checkout_tos" =~ /yes/i) { return
+q~
+<tr>
+<td colspan="2"><hr/></td>
+</tr>
+<tr>
+<td colspan=2 class="ac_checkout_right_col">
+$sc_tos_display_address<br><br>
+You must read the following link before you can continue:  <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="agora.cgi?page=terms_of_service.html" TARGET="_blank"><b>Sales/Terms of Service and Refund Policy</b></A>.<br>
+Then put a tick in the box below. By selecting &quot;I Agree&quot; you are acknowledging that you have read and agree to our policies contained within that page.
+<br><br>
+<input type="checkbox" name="Ecom_tos" value="I Agree">&nbsp;&nbsp;&nbsp; I Agree and have read the Terms of Service listed above (required to continue)</td>
+</tr>
+~;} -->
+
+
+<tr>
+<td colspan="2"><hr/></td>
+</tr>
+
+<tr>
+<td colspan="2"><br>
+<blockquote>
+Only one more step! Please click the <strong>Verify Order</strong>
+button below. This will give you the chance to examine your order
+one last time before you actually submit it to be processed.
+</blockquote>
+</td>
+</tr>
+</table>
+
+<input type="hidden" name="gateway" value="USAepay">
+<input type="reset" name="Undo Edits" value="Undo Edits">&nbsp;
+<input type="submit" name="clear_order_form_button" value="Clear Order Form">&nbsp;
+<input type="submit" name="submit_order_form_button" value="Verify Order">
+
+</div>
+
+</form>
+</body>
+</html>
diff -ruN 4.0K-4b/html/forms/YourPayConnect-orderform.html 5.0.000/html/forms/YourPayConnect-orderform.html
--- 4.0K-4b/html/forms/YourPayConnect-orderform.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/forms/YourPayConnect-orderform.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,384 @@
+<HTML>
+<HEAD>
+<TITLE>Step One</TITLE>
+</HEAD>
+<!--agorascript-orderform
+ &YourPayConnect_order_form_prep;
+-->
+
+<BODY BGCOLOR="#ffffff">
+
+<H2>CART CONTENTS HERE</H2>
+
+<CENTER>
+
+<TABLE class="ac_checkout">
+
+<!--agorascript-pre
+if ("$sc_yourpay_top_message" ne "") { return 
+q~<TR>
+<TD COLSPAN="2"><br><blockquote>$sc_yourpay_top_message</blockquote></TD>
+</TR>~
+;}
+-->
+
+<TR>
+<TD COLSPAN="2">
+<P>&nbsp;</P>
+</TD>
+</TR>
+
+<TR>
+<TD>
+
+<TABLE>
+<tr>
+<td colspan=2 class="ac_checkout_top_col">	
+Please select where your order will be shipped/billed
+</tr>
+<tr>
+
+<TD class="ac_checkout_left_col">Shipping Method:</TD>
+<TD class="ac_checkout_right_col">
+
+<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER BELOW THIS-->
+
+<select name="Ecom_ShipTo_Method">
+<option value="$vform_Ecom_ShipTo_Method"><!--agorascript-pre
+ if ("$vform_Ecom_ShipTo_Method" eq "") {
+   return " Select Shipping Method ";
+  } else {
+   return "$vform_Ecom_ShipTo_Method";
+  }
+--></option>
+<option value="Electronic Delivery">Electronic Delivery</option>
+<option value="Local Delivery">	Local Delivery</option>
+<option value="Pickup">Pickup</option>
+<option value="USPS Parcel Post (Parcel)">USPS Parcel Post (5-14 days)</option>
+<option value="USPS Priority Mail (Priority)">USPS Priority Mail (3-7 days)</option>
+<option value="USPS Express Mail (Express)">USPS Express Mail (1-3 days)</option>
+<option value="USPS (Economy (Surface) Parcel Post)">Economy (Surface) Parcel Post (4-6 weeks - international)</option>
+<option value="USPS (Airmail Parcel Post)">Airmail Parcel Post (4-10 days - international)</option>
+<option value="USPS (Global Express Mail)">Global Express Mail (3-5 days - international)</option>
+<option value="USPS (Global Express Guaranteed Document Service)">Global Express Guaranteed - Non-Document (2-3 days - international)</option>
+<option value="UPS 3 Day Select (3DS)">UPS 3 Day Select (3-4 days)</option>
+<option value="UPS 2nd Day Air (2DA)">UPS 2nd Day Air</option>
+<option value="UPS Next Day Air (1DA)">UPS Next Day Air</option>
+<OPTION VALUE="UPS Ground Residential(GNDRES)">UPS Ground Residential</OPTION>
+<OPTION VALUE="UPS Ground Commercial (GNDCOM)">UPS Ground Commercial</OPTION>
+</select>
+
+<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER ABOVE THIS-->
+
+</td>
+</TR>
+<TR>
+<TD class="ac_checkout_left_col">Email Address:</TD>
+<TD class="ac_checkout_right_col">
+<INPUT TYPE=TEXT NAME="Ecom_BillTo_Online_Email" 
+VALUE="$eform_Ecom_BillTo_Online_Email" size=35></td>
+</TR>
+<TD class="ac_checkout_left_col">Name:</TD>
+<TD class="ac_checkout_right_col">
+<INPUT TYPE=TEXT NAME="Ecom_ShipTo_Postal_Name"
+VALUE="$eform_Ecom_ShipTo_Postal_Name" size=35></td>
+</TR>
+<TD class="ac_checkout_left_col">Street:</TD>
+<TD class="ac_checkout_right_col">
+<INPUT TYPE=TEXT NAME="Ecom_ShipTo_Postal_Street_Line1"
+VALUE="$eform_Ecom_ShipTo_Postal_Street_Line1" size=35></td>
+</TR>
+<TD class="ac_checkout_left_col">City:</TD>
+<TD class="ac_checkout_right_col">
+<INPUT TYPE=TEXT NAME="Ecom_ShipTo_Postal_City" 
+VALUE="$eform_Ecom_ShipTo_Postal_City" size=25></td>
+</TR>
+<tr>
+  <td class="ac_checkout_left_col">State/Province:</td>
+  <td class="ac_checkout_right_col">
+    <select name="Ecom_ShipTo_Postal_StateProv">
+      <option value="$eform_Ecom_ShipTo_Postal_StateProv">$eform_Ecom_ShipTo_Postal_StateProv &nbsp;</option>
+      <option>---USA---</option>
+      <option>AK</option>
+      <option>AL</option> 
+      <option>AR</option>
+      <option>AZ</option> 
+      <option>CA</option> 
+      <option>CO</option> 
+      <option>CT</option> 
+      <option>DC</option>
+      <option>DE</option> 
+      <option>FL</option> 
+      <option>GA</option> 
+      <option>GU</option> 
+      <option>HI</option> 
+      <option>IA</option>
+      <option>ID</option> 
+      <option>IL</option> 
+      <option>IN</option> 
+      <option>KS</option> 
+      <option>KY</option> 
+      <option>LA</option> 
+      <option>MA</option> 
+      <option>MD</option>
+      <option>ME</option> 
+      <option>MI</option> 
+      <option>MN</option> 
+      <option>MO</option>
+      <option>MS</option> 
+      <option>MT</option> 
+      <option>NC</option> 
+      <option>ND</option> 
+      <option>NE</option> 
+      <option>NH</option> 
+      <option>NJ</option> 
+      <option>NM</option> 
+      <option>NV</option> 
+      <option>NY</option> 
+      <option>OH</option> 
+      <option>OK</option> 
+      <option>OR</option> 
+      <option>PA</option> 
+      <option>PR</option> 
+      <option>RI</option> 
+      <option>SC</option> 
+      <option>SD</option> 
+      <option>TN</option> 
+      <option>TX</option> 
+      <option>UT</option> 
+      <option>VA</option>
+      <option>VI</option> 
+      <option>VT</option> 
+      <option>WA</option> 
+      <option>WI</option>
+      <option>WV</option> 
+      <option>WY</option>
+      <option value=""></option>
+      <option value="">--AUSTRALIA--</option>
+      <option value="ACT">ACT</option>
+      <option value="NSW">NSW</option>
+      <option value="NT">NT</option>
+      <option value="QLD">QLD</option>
+      <option value="SA">SA</option>
+      <option value="TAS">TAS</option>
+      <option value="VIC">VIC</option>
+      <option value="WA">WA</option>
+      <option value=""></option>
+      <option value="">--CANADA--</option>
+      <option value="AB">AB</option>
+      <option value="BC">BC</option>
+      <option value="MB">MB</option>
+      <option value="NB">NB</option>
+      <option value="NFLD">NFLD</option>
+      <option value="NWT">NWT</option>
+      <option value="NS">NS</option>
+      <option value="ON">ON</option>
+      <option value="PEI">PEI</option>
+      <option value="PQ">PQ</option>
+      <option value="SK">SK</option>
+      <option value="YK">YK</option>
+      <option value="">--UK / England--</option>
+      <option value="Aberdeen City">Aberdeen City</option>
+      <option value="Aberdeenshire">Aberdeenshire</option>
+      <option value="Angus">Angus</option>
+      <option value="Argyll & Bute">Argyll & Bute</option>
+      <option value="Bath & North East Somerset">Bath & North East Somerset</option>
+      <option value="Bedfordshire">Bedfordshire</option>
+      <option value="Berkshire">Berkshire</option>
+      <option value="Blaenau Gwent">Blaenau Gwent</option>
+      <option value="Bridgend">Bridgend</option>
+      <option value="Bristol">Bristol</option>
+      <option value="Buckinghamshire">Buckinghamshire</option>
+      <option value="Caerphilly ">Caerphilly </option>
+      <option value="Cambridgeshire">Cambridgeshire</option>
+      <option value="Cardiff">Cardiff</option>
+      <option value="Carmarthenshire">Carmarthenshire</option>
+      <option value="Ceredidgion">Ceredidgion</option>
+      <option value="Cheshire">Cheshire</option>
+      <option value="ClackMannanshire">ClackMannanshire</option>
+      <option value="Conwy">Conwy</option>
+      <option value="Cornwall">Cornwall</option>
+      <option value="Cumbria">Cumbria</option>
+      <option value="Denbighshire">Denbighshire</option>
+      <option value="Derbyshire">Derbyshire</option>
+      <option value="Devon">Devon</option>
+      <option value="Dorset">Dorset</option>
+      <option value="Dumfries & Galloway">Dumfries & Galloway</option>
+      <option value="Dundee City">Dundee City</option>
+      <option value="Durham">Durham</option>
+      <option value="East Ayrshire">East Ayrshire</option>
+      <option value="East Dunbartonshire">East Dunbartonshire</option>
+      <option value="East Lothian">East Lothian</option>
+      <option value="East Renfrewshire">East Renfrewshire</option>
+      <option value="East Riding of Yorkshire">East Riding of Yorkshire</option>
+      <option value="East Sussex">East Sussex</option>
+      <option value="Edinburgh">Edinburgh</option>
+      <option value="Essex">Essex</option>
+      <option value="Falkirk">Falkirk</option>
+      <option value="Fife">Fife</option>
+      <option value="Flintshire">Flintshire</option>
+      <option value="Glasgow">Glasgow</option>
+      <option value="Gloucestershire">Gloucestershire</option>
+      <option value="Greater Manchester">Greater Manchester</option>
+      <option value="Gwynedd">Gwynedd</option>
+      <option value="Hampshire">Hampshire</option>
+      <option value="Herefordshire">Herefordshire</option>
+      <option value="Hertfordshire">Hertfordshire</option>
+      <option value="Highlands">Highlands</option>
+      <option value="Inverclyde">Inverclyde</option>
+      <option value="Isle of Anglesey">Isle of Anglesey</option>
+      <option value="Kent">Kent</option>
+      <option value="Lancashire">Lancashire</option>
+      <option value="Leicestershire">Leicestershire</option>
+      <option value="Lincolnshire">Lincolnshire</option>
+      <option value="London">London</option>
+      <option value="Merseyside">Merseyside</option>
+      <option value="Merthyr Tydfil">Merthyr Tydfil</option>
+      <option value="Midlothian">Midlothian</option>
+      <option value="Monmouthshire">Monmouthshire</option>
+      <option value="Moray">Moray</option>
+      <option value="Neath Port Talbot">Neath Port Talbot</option>
+      <option value="Newport">Newport</option>
+      <option value="Norfolk">Norfolk</option>
+      <option value="North Ayrshire">North Ayrshire</option>
+      <option value="North Lanarkshire">North Lanarkshire</option>
+      <option value="North Somerset">North Somerset</option>
+      <option value="North Yorkshire">North Yorkshire</option>
+      <option value="Northamptonshire">Northamptonshire</option>
+      <option value="Northumberland">Northumberland</option>
+      <option value="Nottinghamshire">Nottinghamshire</option>
+      <option value="Orkney">Orkney</option>
+      <option value="Oxfordshire">Oxfordshire</option>
+      <option value="Pembrokeshire">Pembrokeshire</option>
+      <option value="Perth & Kinross">Perth & Kinross</option>
+      <option value="Powys">Powys</option>
+      <option value="Renfrewshire">Renfrewshire</option>
+      <option value="Rhondda Cynon Taff">Rhondda Cynon Taff</option>
+      <option value="Rutland">Rutland</option>
+      <option value="Scottish Borders">Scottish Borders</option>
+      <option value="Shetland">Shetland</option>
+      <option value="Shropshire">Shropshire</option>
+      <option value="Somerset">Somerset</option>
+      <option value="South Lanarkshire">South Lanarkshire</option>
+      <option value="South Yorkshire">South Yorkshire</option>
+      <option value="Staffordshire">Staffordshire</option>
+      <option value="Stirling">Stirling</option>
+      <option value="Suffolk">Suffolk</option>
+      <option value="Surrey">Surrey</option>
+      <option value="Swansea">Swansea</option>
+      <option value="Teesside">Teesside</option>
+      <option value="Torfaen">Torfaen</option>
+      <option value="Tyne & Wear">Tyne & Wear</option>
+      <option value="Vale of Glamorgan">Vale of Glamorgan</option>
+      <option value="Warwickshire">Warwickshire</option>
+      <option value="West Dunbartonshire">West Dunbartonshire</option>
+      <option value="West Lothian">West Lothian</option>
+      <option value="West Midlands">West Midlands</option>
+      <option value="West Sussex">West Sussex</option>
+      <option value="West Yorkshire">West Yorkshire</option>
+      <option value="Western Isles">Western Isles</option>
+      <option value="Wiltshire">Wiltshire</option>
+      <option value="Worcestershire">Worcestershire</option>
+      <option value="Wrexham">Wrexham</option>
+    </select>
+  </td>
+</tr>
+<tr>
+  <td class="ac_checkout_left_col">Zip/Postal Code:</td>
+  <td class="ac_checkout_right_col">
+    <input type="text" name="Ecom_ShipTo_Postal_PostalCode"
+		value="$eform_Ecom_ShipTo_Postal_PostalCode" size="11" maxlength="11">
+  </td>
+</tr>
+<tr>
+  <td class="ac_checkout_left_col">Country:</td>
+  <td class="ac_checkout_right_col">
+    <select name="Ecom_ShipTo_Postal_CountryCode">
+      <option value="$vform_Ecom_ShipTo_Postal_CountryCode">$vform_Ecom_ShipTo_Postal_CountryCode</option>
+      <option>United States</option>
+      <option>Australia</option>
+      <option>Canada</option>
+      <option>Ireland</option>
+      <option>Puerto Rico</option>
+      <option>Scotland</option>
+      <option>United Kingdom</option>
+      <option>Wales</option>
+      <option></option>
+      <option>American Samoa</option>
+      <option>Argentina</option>
+      <option>Austria</option>
+      <option>Belgium</option>
+      <option>Belize</option>
+      <option>Brazil</option>
+      <option>Chile</option>
+      <option>Costa Rica</option>
+      <option>Denmark</option>
+      <option>Dominican Republic</option>
+      <option>Finland</option>
+      <option>France</option>
+      <option>Germany</option>
+      <option>Greece</option>
+      <option>Guatemala</option>
+      <option>Hong Kong</option>
+      <option>Israel</option>
+      <option>Italy</option>
+      <option>Jamaica</option>
+      <option>Mexico</option>
+      <option>Netherlands</option>
+      <option>New Zealand</option>
+      <option>Norway</option>
+      <option>Panama</option>
+      <option>Portugal</option>
+      <option>Spain</option>
+      <option>Sweden</option>
+      <option>Switzerland</option>
+      <option>Taiwan</option>
+      <option>Tonga</option>
+      <option>Virgin Islands (US)</option>
+    </select>
+  </td>
+</tr>
+<tr>
+<td class="ac_checkout_left_col" colspan=2><input type="checkbox" name="Ecom_is_Residential" value="Ship to Residential Address">  Is this a Residential Address?
+</td>
+</tr>
+<!--agorascript-pre
+# inspired from solutions submitted from Dan at CartSoutions.net
+if ("$sc_display_checkout_tos" =~ /yes/i) { return
+q~
+<td colspan=2 class="ac_checkout_top_col">
+Terms of Service & Our Contact Information</td>
+</tr>
+<tr>
+<td colspan=2>
+$sc_tos_display_address<br><br>
+You must read the following link before you can continue:  <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="agora.cgi?page=terms_of_service.html" TARGET="_blank"><b>Sales/Terms of Service and Refund Policy</b></A>.<br>
+Then put a tick in the box below. By selecting &quot;I Agree&quot; you are acknowledging that you have read and agree to our policies contained within that page.
+<br><br>
+<input type="checkbox" name="Ecom_tos" value="I Agree">&nbsp;&nbsp;&nbsp; I Agree and have read the Terms of Service listed above (required to continue)<br><br></td>
+</tr>
+~;} -->
+
+<tr>
+<td class="ac_checkout_left_col">Special Notes:</td>
+<td class="ac_checkout_right_col">
+  <textarea name="Ecom_XCOMMENT_Special_Notes" cols="50" rows="5">$eform_Ecom_XCOMMENT_Special_Notes</textarea>
+</td>
+</tr>
+<TR>
+<TD COLSPAN="2" ALIGN="CENTER"><INPUT 
+TYPE=HIDDEN NAME="gateway" VALUE="YourPayConnect"><INPUT 
+TYPE=submit NAME = "submit_order_form_button"  
+VALUE = "Please Click Here To Continue"></TD>
+</TR>
+</TABLE>
+
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+</FONT>
+</CENTER>
+</FORM>
+</BODY>
+</HTML>
diff -ruN 4.0K-4b/html/forms/choose-orderform.html 5.0.000/html/forms/choose-orderform.html
--- 4.0K-4b/html/forms/choose-orderform.html	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/forms/choose-orderform.html	1969-12-31 18:00:00.000000000 -0600
@@ -1,41 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>Secure Order Form</TITLE>
-</HEAD>
-<BODY>
-
-<FORM action="agora.cgi" method="POST">
-<H2>CART CONTENTS HERE</H2>
-</FORM>
-
-<CENTER>
-<TABLE WIDTH="550" BORDER="0" CELLPADDING="0">
-<TR>
-<TD COLSPAN="2" ALIGN="CENTER"><FONT SIZE="-1"><hr></FONT></TD>
-</TR>
-<TR>
-<TD COLSPAN="2" ALIGN="CENTER"><FONT SIZE="-1">What method 
-would you like to use to pay for the order?</FONT></TD>
-</TR>
-<TR>
-<TD width="50%" align="right">
-<FORM action="agora.cgi" method="POST">
-<INPUT TYPE=HIDDEN NAME = "ofn" VALUE = "PayPal">
-<INPUT TYPE=HIDDEN NAME = "submit" VALUE = "1">
-<INPUT TYPE=HIDDEN NAME="order_form_button" VALUE="1">
-<INPUT TYPE="IMAGE" NAME="Pay By Credit Card" VALUE="1"
-ALT="Bubba"
-SRC="agora.cgi?secpicserve=by_ccard.gif" border=0></FORM></TD>
-<TD width="50%" align="left">
-<FORM action="agora.cgi" method="POST">
-<INPUT TYPE=HIDDEN NAME = "ofn" VALUE = "Qdebit">
-<INPUT TYPE=HIDDEN NAME = "submit" VALUE = "1">
-<INPUT TYPE=HIDDEN NAME="order_form_button" VALUE="1">
-<INPUT TYPE="IMAGE" NAME="Pay By Check" VALUE="1"
-SRC="agora.cgi?secpicserve=by_check.gif" border=0></FORM></TD>
-</TR>
-</TABLE>
-</CENTER>
-</FORM>
-</BODY>
-</HTML>
diff -ruN 4.0K-4b/html/forms/combo-orderform.html 5.0.000/html/forms/combo-orderform.html
--- 4.0K-4b/html/forms/combo-orderform.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/forms/combo-orderform.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,40 @@
+<HTML>
+<HEAD>
+<TITLE>Secure Order Form</TITLE>
+</HEAD>
+<BODY>
+
+<FORM action="agora.cgi" method="POST">
+<H2>CART CONTENTS HERE</H2>
+</FORM>
+
+<CENTER>
+<TABLE WIDTH="550" BORDER="0" CELLPADDING="0">
+<TR>
+<TD COLSPAN="2" ALIGN="CENTER"><FONT SIZE="-1"><hr></FONT></TD>
+</TR>
+<TR>
+<TD COLSPAN="2" ALIGN="CENTER"><FONT face=arial SIZE="2"><B>What method 
+would you like to use to pay for your order?</B></FONT></TD>
+</TR>
+<TR>
+<TD width="50%" align="center">
+<FORM action="agora.cgi" method="POST">
+<INPUT TYPE=HIDDEN NAME = "ofn" VALUE = "NiftyPay">
+<INPUT TYPE=HIDDEN NAME = "submit" VALUE = "Next">
+<INPUT TYPE=HIDDEN NAME="order_form_button" VALUE="1">
+<INPUT TYPE="IMAGE" NAME="Pay By Credit Card" VALUE="1"
+SRC="agora.cgi?secpicserve=visamas1.gif" border=0></FORM><BR><font face=arial size=2>Pay with Your Visa or MasterCard<BR><BR></font></TD>
+<TD width="50%" align="center">
+<FORM action="agora.cgi" method="POST">
+<INPUT TYPE=HIDDEN NAME = "ofn" VALUE = "PayPal">
+<INPUT TYPE=HIDDEN NAME = "submit" VALUE = "Next">
+<INPUT TYPE=HIDDEN NAME="order_form_button" VALUE="1">
+<INPUT TYPE="IMAGE" NAME="Pay By Check" VALUE="1"
+SRC="agora.cgi?secpicserve=logo-xclick.gif" border=0></FORM><BR><BR><font face=arial size=2>Use the secure PayPal system for Visa, MasterCard, American Express, Discover and Check Payments</font></TD>
+</TR>
+</TABLE>
+</CENTER>
+</FORM>
+</BODY>
+</HTML>
diff -ruN 4.0K-4b/html/forms/combosample-orderform.html 5.0.000/html/forms/combosample-orderform.html
--- 4.0K-4b/html/forms/combosample-orderform.html	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/forms/combosample-orderform.html	1969-12-31 18:00:00.000000000 -0600
@@ -1,136 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>Step One</TITLE>
-</HEAD>
-
-<BODY BGCOLOR="#ffffff">
-
-<FORM action="agora.cgi" method="POST">
-
-<H2>CART CONTENTS HERE</H2>
-
-<CENTER>
-
-<TABLE WIDTH="550" BORDER="0">
-
-<TR>
-<TD COLSPAN="2">
-<P>&nbsp;</P>
-</TD>
-</TR>
-
-<TR BGCOLOR="#C0FFFF">
-<TD>
-
-<TABLE WIDTH="550" BORDER="1">
-<TR BGCOLOR="#C0FFFF">
-<TD ALIGN="CENTER" colspan=3><FONT FACE="ARIAL" SIZE="2"
-COLOR="#000000">Please select where your order will be shipped and 
-click 'Next'</FONT></TD>
-</tr>
-<tr>
-   <td colspan=3>Method:&nbsp;&nbsp;&nbsp;
-<SELECT NAME="Ecom_ShipTo_Method">
-<OPTION VALUE="UPS Ground (GNDRES)" CHECKED>
-UPS Ground</OPTION>
-<OPTION VALUE="UPS 2nd Day (2DA)">
-UPS 2nd Day</OPTION>
-<OPTION VALUE="UPS Next Day (1DA)">
-UPS Next Day</OPTION>
-<OPTION VALUE="FEDEX Priority Overnight (Express,Priority Overnight)">
-FedEx Priority Overnight</OPTION>
-<OPTION VALUE="FEDEX Express (Express,Express Saver)">
-FedEx Express Saver</OPTION>
-<OPTION VALUE="FEDEX Ground (Ground,Ground)">
-FedEx Ground</OPTION>
-<OPTION VALUE="FEDEX Home Delivery (Home,Home)">
-FedEx Home Delivery</OPTION>
-<OPTION VALUE="USPS Parcel Post (Parcel)">
-USPS Parcel Post</OPTION>
-<OPTION VALUE="USPS Priority Mail (Priority)">
-USPS Priority Mail</OPTION>
-<OPTION VALUE="USPS Express Mail (Express)">
-USPS Express Mail</OPTION>
-</SELECT></TD>
- </tr>
-      
-<TR BGCOLOR="#C0FFFF">
-<TD ALIGN="CENTER" colspan=1>Zip/Postal Code
-<INPUT TYPE=TEXT NAME="Ecom_ShipTo_Postal_PostalCode" size=5></td>
-<TD ALIGN="CENTER" colspan=1>
-<SELECT NAME="Ecom_ShipTo_Postal_StateProv">
-<OPTION VALUE="">Select State</OPTION>
-<OPTION>AK</OPTION>
-<OPTION>AL</OPTION> 
-<OPTION>AR</OPTION>
-<OPTION>AZ</OPTION> 
-<OPTION>CA</OPTION> 
-<OPTION>CO</OPTION> 
-<OPTION>CT</OPTION> 
-<OPTION>DC</OPTION>
-<OPTION>DE</OPTION> 
-<OPTION>FL</OPTION> 
-<OPTION>GA</OPTION> 
-<OPTION>GU</OPTION> 
-<OPTION>HI</OPTION> 
-<OPTION>IA</OPTION>
-<OPTION>ID</OPTION> 
-<OPTION>IL</OPTION> 
-<OPTION>IN</OPTION> 
-<OPTION>KS</OPTION> 
-<OPTION>KY</OPTION> 
-<OPTION>LA</OPTION> 
-<OPTION>MA</OPTION> 
-<OPTION>MD</OPTION>
-<OPTION>ME</OPTION> 
-<OPTION>MI</OPTION> 
-<OPTION>MN</OPTION> 
-<OPTION>MO</OPTION>
-<OPTION>MS</OPTION> 
-<OPTION>MT</OPTION> 
-<OPTION>NC</OPTION> 
-<OPTION>ND</OPTION> 
-<OPTION>NE</OPTION> 
-<OPTION>NH</OPTION> 
-<OPTION>NJ</OPTION> 
-<OPTION>NM</OPTION> 
-<OPTION>NV</OPTION> 
-<OPTION>NY</OPTION> 
-<OPTION>OH</OPTION> 
-<OPTION>OK</OPTION> 
-<OPTION>OR</OPTION> 
-<OPTION>PA</OPTION> 
-<OPTION>PR</OPTION> 
-<OPTION>RI</OPTION> 
-<OPTION>SC</OPTION> 
-<OPTION>SD</OPTION> 
-<OPTION>TN</OPTION> 
-<OPTION>TX</OPTION> 
-<OPTION>UT</OPTION> 
-<OPTION>VA</OPTION>
-<OPTION>VI</OPTION> 
-<OPTION>VT</OPTION> 
-<OPTION>WA</OPTION> 
-<OPTION>WI</OPTION>
-<OPTION>WV</OPTION> 
-<OPTION>WY</OPTION> 
-</SELECT>
-</TD>
-<TD ALIGN="CENTER" colspan=1><INPUT
-TYPE=SUBMIT NAME="gateway" VALUE="AuthorizeNet"><br><INPUT
-TYPE=SUBMIT NAME="gateway" VALUE="iTransact"><BR>
-<INPUT TYPE=SUBMIT NAME="gateway" VALUE="Linkpoint"><INPUT 
-TYPE=HIDDEN NAME ="submit_order_form_button" VALUE = "Next"></TD>
-</TR>
-</TABLE>
-</TD>
-</TR>
-</TABLE>
-</CENTER>
-</FONT>
-</CENTER>
-</FORM>
-
-</BODY>
-</HTML>
-
diff -ruN 4.0K-4b/html/forms/iTransact-orderform.html 5.0.000/html/forms/iTransact-orderform.html
--- 4.0K-4b/html/forms/iTransact-orderform.html	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/forms/iTransact-orderform.html	2006-10-31 09:40:27.000000000 -0600
@@ -12,7 +12,14 @@
 
 <CENTER>
 
-<TABLE WIDTH="530" BORDER="0">
+<TABLE class="ac_checkout">
+<!--agorascript-pre
+if ("$sc_itransact_top_message" ne "") { return 
+q~<TR>
+<TD COLSPAN="2"><br><blockquote>$sc_itransact_top_message</blockquote></TD>
+</TR>~
+;}
+-->
 
 <TR>
 <TD COLSPAN="2">
@@ -20,20 +27,22 @@
 </TD>
 </TR>
 
-<TR BGCOLOR="#C0FFFF">
+<TR>
 <TD>
 
-<TABLE WIDTH="550" BORDER="1">
-<TR BGCOLOR="#C0FFFF">
-<TD ALIGN="CENTER" colspan=3><FONT FACE="ARIAL" SIZE="2"
-COLOR="#000000">Please select where your order will be shipped/billed and 
-click 'Next'</FONT></TD>
+<TABLE>
+<TR>
+<TD colspan=2 class="ac_checkout_top_col">
+Please select where your order will be shipped/billed
 </tr>
 <tr>
 
-<TR BGCOLOR="#C0FFFF">
-<TD ALIGN="RIGHT" colspan=1>Shipping Method:</TD>
-<TD ALIGN="LEFT" COLSPAN=1>
+<TR>
+<TD class="ac_checkout_left_col">Shipping Method:</TD>
+<TD class="ac_checkout_right_col">
+
+<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER BELOW THIS-->
+
 <SELECT NAME="Ecom_ShipTo_Method">
 <!--agorascript-pre 
  if ("$vform_Ecom_ShipTo_Method" ne "") {
@@ -44,33 +53,34 @@
    return '<OPTION VALUE="UPS Ground (GNDRES)" CHECKED>UPS Ground';
   }
 --></OPTION>
-<OPTION VALUE="UPS 2nd Day (2DA)">
-UPS 2nd Day</OPTION>
-<OPTION VALUE="UPS Next Day (1DA)">
-UPS Next Day</OPTION>
-<OPTION VALUE="FEDEX Priority Overnight (Express,Priority Overnight)">
-FedEx Priority Overnight</OPTION>
-<OPTION VALUE="FEDEX Express (Express,Express Saver)">
-FedEx Express Saver</OPTION>
-<OPTION VALUE="FEDEX Ground (Ground,Ground)">
-FedEx Ground</OPTION>
-<OPTION VALUE="FEDEX Home Delivery (Home,Home)">
-FedEx Home Delivery</OPTION>
-<OPTION VALUE="USPS Parcel Post (Parcel)">
-USPS Parcel Post</OPTION>
-<OPTION VALUE="USPS Priority Mail (Priority)">
-USPS Priority Mail</OPTION>
-<OPTION VALUE="USPS Express Mail (Express)">
-USPS Express Mail</OPTION>
-</SELECT>
+<option value="Electronic Delivery">Electronic Delivery</option>
+<option value="Local Delivery">	Local Delivery</option>
+<option value="Pickup">Pickup</option>
+<option value="USPS Parcel Post (Parcel)">USPS Parcel Post (5-14 days)</option>
+<option value="USPS Priority Mail (Priority)">USPS Priority Mail (3-7 days)</option>
+<option value="USPS Express Mail (Express)">USPS Express Mail (1-3 days)</option>
+<option value="USPS (Economy (Surface) Parcel Post)">Economy (Surface) Parcel Post (4-6 weeks - international)</option>
+<option value="USPS (Airmail Parcel Post)">Airmail Parcel Post (4-10 days - international)</option>
+<option value="USPS (Global Express Mail)">Global Express Mail (3-5 days - international)</option>
+<option value="USPS (Global Express Guaranteed Document Service)">Global Express Guaranteed - Non-Document (2-3 days - international)</option>
+<option value="UPS 3 Day Select (3DS)">UPS 3 Day Select (3-4 days)</option>
+<option value="UPS 2nd Day Air (2DA)">UPS 2nd Day Air</option>
+<option value="UPS Next Day Air (1DA)">UPS Next Day Air</option>
+<OPTION VALUE="UPS Ground Residential(GNDRES)">UPS Ground Residential</OPTION>
+<OPTION VALUE="UPS Ground Commercial (GNDCOM)">UPS Ground Commercial</OPTION>
+</select>
+
+<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER ABOVE THIS-->
+
 </td>
 </TR>
-<TR BGCOLOR="#C0FFFF">
-<TD ALIGN="RIGHT" colspan=1>State:</TD>
-<TD ALIGN="LEFT" colspan=1>
-<SELECT NAME="Ecom_ShipTo_Postal_StateProv">
-<OPTION VALUE="$eform_Ecom_ShipTo_Postal_StateProv"
->$eform_Ecom_ShipTo_Postal_StateProv &nbsp;</OPTION>
+
+<tr>
+<td class="ac_checkout_left_col">State/Province:</td>
+<td class="ac_checkout_right_col">
+<select name="Ecom_ShipTo_Postal_StateProv">
+<option value="$eform_Ecom_ShipTo_Postal_StateProv">$eform_Ecom_ShipTo_Postal_StateProv &nbsp;</option>
+<OPTION>---USA---</OPTION>
 <OPTION>AK</OPTION>
 <OPTION>AL</OPTION> 
 <OPTION>AR</OPTION>
@@ -124,16 +134,226 @@
 <OPTION>WA</OPTION> 
 <OPTION>WI</OPTION>
 <OPTION>WV</OPTION> 
-<OPTION>WY</OPTION> 
+<OPTION>WY</OPTION>
+<OPTION value=""></OPTION>
+<OPTION value="">--AUSTRALIA--</OPTION>
+<OPTION value="ACT">ACT</OPTION>
+<OPTION value="NSW">NSW</OPTION>
+<OPTION value="NT">NT</OPTION>
+<OPTION value="QLD">QLD</OPTION>
+<OPTION value="SA">SA</OPTION>
+<OPTION value="TAS">TAS</OPTION>
+<OPTION value="VIC">VIC</OPTION>
+<OPTION value="WA">WA</OPTION>
+<OPTION value=""></OPTION>
+<OPTION value="">--CANADA--</OPTION>
+<OPTION value="AB">AB</OPTION>
+<OPTION value="BC">BC</OPTION>
+<OPTION value="MB">MB</OPTION>
+<OPTION value="NB">NB</OPTION>
+<OPTION value="NFLD">NFLD</OPTION>
+<OPTION value="NWT">NWT</OPTION>
+<OPTION value="NS">NS</OPTION>
+<OPTION value="ON">ON</OPTION>
+<OPTION value="PEI">PEI</OPTION>
+<OPTION value="PQ">PQ</OPTION>
+<OPTION value="SK">SK</OPTION>
+<OPTION value="YK">YK</OPTION>
+<OPTION value="">--UK / England--</OPTION>
+<OPTION value="Aberdeen City">Aberdeen City</OPTION>
+<OPTION value="Aberdeenshire">Aberdeenshire</OPTION>
+<OPTION value="Angus">Angus</OPTION>
+<OPTION value="Argyll & Bute">Argyll & Bute</OPTION>
+<OPTION value="Bath & North East Somerset">Bath & North East Somerset</OPTION>
+<OPTION value="Bedfordshire">Bedfordshire</OPTION>
+<OPTION value="Berkshire">Berkshire</OPTION>
+<OPTION value="Blaenau Gwent">Blaenau Gwent</OPTION>
+<OPTION value="Bridgend">Bridgend</OPTION>
+<OPTION value="Bristol">Bristol</OPTION>
+<OPTION value="Buckinghamshire">Buckinghamshire</OPTION>
+<OPTION value="Caerphilly ">Caerphilly </OPTION>
+<OPTION value="Cambridgeshire">Cambridgeshire</OPTION>
+<OPTION value="Cardiff">Cardiff</OPTION>
+<OPTION value="Carmarthenshire">Carmarthenshire</OPTION>
+<OPTION value="Ceredidgion">Ceredidgion</OPTION>
+<OPTION value="Cheshire">Cheshire</OPTION>
+<OPTION value="ClackMannanshire">ClackMannanshire</OPTION>
+<OPTION value="Conwy">Conwy</OPTION>
+<OPTION value="Cornwall">Cornwall</OPTION>
+<OPTION value="Cumbria">Cumbria</OPTION>
+<OPTION value="Denbighshire">Denbighshire</OPTION>
+<OPTION value="Derbyshire">Derbyshire</OPTION>
+<OPTION value="Devon">Devon</OPTION>
+<OPTION value="Dorset">Dorset</OPTION>
+<OPTION value="Dumfries & Galloway">Dumfries & Galloway</OPTION>
+<OPTION value="Dundee City">Dundee City</OPTION>
+<OPTION value="Durham">Durham</OPTION>
+<OPTION value="East Ayrshire">East Ayrshire</OPTION>
+<OPTION value="East Dunbartonshire">East Dunbartonshire</OPTION>
+<OPTION value="East Lothian">East Lothian</OPTION>
+<OPTION value="East Renfrewshire">East Renfrewshire</OPTION>
+<OPTION value="East Riding of Yorkshire">East Riding of Yorkshire</OPTION>
+<OPTION value="East Sussex">East Sussex</OPTION>
+<OPTION value="Edinburgh">Edinburgh</OPTION>
+<OPTION value="Essex">Essex</OPTION>
+<OPTION value="Falkirk">Falkirk</OPTION>
+<OPTION value="Fife">Fife</OPTION>
+<OPTION value="Flintshire">Flintshire</OPTION>
+<OPTION value="Glasgow">Glasgow</OPTION>
+<OPTION value="Gloucestershire">Gloucestershire</OPTION>
+<OPTION value="Greater Manchester">Greater Manchester</OPTION>
+<OPTION value="Gwynedd">Gwynedd</OPTION>
+<OPTION value="Hampshire">Hampshire</OPTION>
+<OPTION value="Herefordshire">Herefordshire</OPTION>
+<OPTION value="Hertfordshire">Hertfordshire</OPTION>
+<OPTION value="Highlands">Highlands</OPTION>
+<OPTION value="Inverclyde">Inverclyde</OPTION>
+<OPTION value="Isle of Anglesey">Isle of Anglesey</OPTION>
+<OPTION value="Kent">Kent</OPTION>
+<OPTION value="Lancashire">Lancashire</OPTION>
+<OPTION value="Leicestershire">Leicestershire</OPTION>
+<OPTION value="Lincolnshire">Lincolnshire</OPTION>
+<OPTION value="London">London</OPTION>
+<OPTION value="Merseyside">Merseyside</OPTION>
+<OPTION value="Merthyr Tydfil">Merthyr Tydfil</OPTION>
+<OPTION value="Midlothian">Midlothian</OPTION>
+<OPTION value="Monmouthshire">Monmouthshire</OPTION>
+<OPTION value="Moray">Moray</OPTION>
+<OPTION value="Neath Port Talbot">Neath Port Talbot</OPTION>
+<OPTION value="Newport">Newport</OPTION>
+<OPTION value="Norfolk">Norfolk</OPTION>
+<OPTION value="North Ayrshire">North Ayrshire</OPTION>
+<OPTION value="North Lanarkshire">North Lanarkshire</OPTION>
+<OPTION value="North Somerset">North Somerset</OPTION>
+<OPTION value="North Yorkshire">North Yorkshire</OPTION>
+<OPTION value="Northamptonshire">Northamptonshire</OPTION>
+<OPTION value="Northumberland">Northumberland</OPTION>
+<OPTION value="Nottinghamshire">Nottinghamshire</OPTION>
+<OPTION value="Orkney">Orkney</OPTION>
+<OPTION value="Oxfordshire">Oxfordshire</OPTION>
+<OPTION value="Pembrokeshire">Pembrokeshire</OPTION>
+<OPTION value="Perth & Kinross">Perth & Kinross</OPTION>
+<OPTION value="Powys">Powys</OPTION>
+<OPTION value="Renfrewshire">Renfrewshire</OPTION>
+<OPTION value="Rhondda Cynon Taff">Rhondda Cynon Taff</OPTION>
+<OPTION value="Rutland">Rutland</OPTION>
+<OPTION value="Scottish Borders">Scottish Borders</OPTION>
+<OPTION value="Shetland">Shetland</OPTION>
+<OPTION value="Shropshire">Shropshire</OPTION>
+<OPTION value="Somerset">Somerset</OPTION>
+<OPTION value="South Lanarkshire">South Lanarkshire</OPTION>
+<OPTION value="South Yorkshire">South Yorkshire</OPTION>
+<OPTION value="Staffordshire">Staffordshire</OPTION>
+<OPTION value="Stirling">Stirling</OPTION>
+<OPTION value="Suffolk">Suffolk</OPTION>
+<OPTION value="Surrey">Surrey</OPTION>
+<OPTION value="Swansea">Swansea</OPTION>
+<OPTION value="Teesside">Teesside</OPTION>
+<OPTION value="Torfaen">Torfaen</OPTION>
+<OPTION value="Tyne & Wear">Tyne & Wear</OPTION>
+<OPTION value="Vale of Glamorgan">Vale of Glamorgan</OPTION>
+<OPTION value="Warwickshire">Warwickshire</OPTION>
+<OPTION value="West Dunbartonshire">West Dunbartonshire</OPTION>
+<OPTION value="West Lothian">West Lothian</OPTION>
+<OPTION value="West Midlands">West Midlands</OPTION>
+<OPTION value="West Sussex">West Sussex</OPTION>
+<OPTION value="West Yorkshire">West Yorkshire</OPTION>
+<OPTION value="Western Isles">Western Isles</OPTION>
+<OPTION value="Wiltshire">Wiltshire</OPTION>
+<OPTION value="Worcestershire">Worcestershire</OPTION>
+<OPTION value="Wrexham">Wrexham</OPTION>
+</select>
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col">Zip/Postal Code:</td>
+<td class="ac_checkout_right_col">
+  <input type="text" name="Ecom_ShipTo_Postal_PostalCode"
+    value="$eform_Ecom_ShipTo_Postal_PostalCode" size="11" maxlength="11">
+</td>
+</tr>
+
+
+<tr>
+<td class="ac_checkout_left_col">Country:</td>
+<td class="ac_checkout_right_col">
+  <SELECT NAME="Ecom_ShipTo_Postal_CountryCode">
+<OPTION VALUE="$vform_Ecom_ShipTo_Postal_CountryCode">$vform_Ecom_ShipTo_Postal_CountryCode
+<OPTION>United States
+<OPTION>Australia
+<OPTION>Canada
+<OPTION>Ireland
+<OPTION>Puerto Rico
+<OPTION>Scotland
+<OPTION>United Kingdom
+<OPTION>Wales
+<OPTION></option>
+<OPTION>American Samoa
+<OPTION>Argentina
+<OPTION>Austria
+<OPTION>Belgium
+<OPTION>Belize
+<OPTION>Brazil
+<OPTION>Chile
+<OPTION>Costa Rica
+<OPTION>Denmark
+<OPTION>Dominican Republic
+<OPTION>Finland
+<OPTION>France
+<OPTION>Germany
+<OPTION>Greece
+<OPTION>Guatemala
+<OPTION>Hong Kong
+<OPTION>Israel
+<OPTION>Italy
+<OPTION>Jamaica
+<OPTION>Mexico
+<OPTION>Netherlands
+<OPTION>New Zealand
+<OPTION>Norway
+<OPTION>Panama
+<OPTION>Portugal
+<OPTION>Spain
+<OPTION>Sweden
+<OPTION>Switzerland
+<OPTION>Taiwan
+<OPTION>Tonga
+<OPTION>Virgin Islands (US)
+
 </SELECT>
-</TD>
-</TR>
-<TR BGCOLOR="#C0FFFF">
-<TD ALIGN="RIGHT" colspan=1>Zip/Postal Code</TD>
-<TD ALIGN="LEFT" colspan=1>
-<INPUT TYPE=TEXT NAME="Ecom_ShipTo_Postal_PostalCode" 
-VALUE="$eform_Ecom_ShipTo_Postal_PostalCode" size=5></td>
-</TR>
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_left_col" colspan=2><input type="checkbox" name="Ecom_is_Residential" value="Ship to Residential Address">  Is this a Residential Address?
+</td>
+</tr>
+
+<!--agorascript-pre
+# inspired from solutions submitted from Dan at CartSoutions.net
+if ("$sc_display_checkout_tos" =~ /yes/i) { return
+q~
+<td colspan=2 class="ac_checkout_top_col">
+Terms of Service & Our Contact Information</td>
+</tr>
+<tr>
+<td colspan=2>
+$sc_tos_display_address<br><br>
+You must read the following link before you can continue:  <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="agora.cgi?page=terms_of_service.html" TARGET="_blank"><b>Sales/Terms of Service and Refund Policy</b></A>.<br>
+Then put a tick in the box below. By selecting &quot;I Agree&quot; you are acknowledging that you have read and agree to our policies contained within that page.
+<br><br>
+<input type="checkbox" name="Ecom_tos" value="I Agree">&nbsp;&nbsp;&nbsp; I Agree and have read the Terms of Service listed above (required to continue)<br><br></td>
+</tr>
+~;} -->
+
+<tr>
+<td class="ac_checkout_left_col">Special Notes:</td>
+<td class="ac_checkout_right_col">
+  <textarea name="Ecom_XCOMMENT_Special_Notes" cols="50" rows="5">$eform_Ecom_XCOMMENT_Special_Notes</textarea>
+</td>
+</tr>
+
 <TR>
 <TD COLSPAN="2" ALIGN="CENTER"><INPUT 
 TYPE=HIDDEN NAME="gateway" VALUE="iTransact"><INPUT 
diff -ruN 4.0K-4b/html/forms/zOffline-orderform.html 5.0.000/html/forms/zOffline-orderform.html
--- 4.0K-4b/html/forms/zOffline-orderform.html	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/forms/zOffline-orderform.html	1969-12-31 18:00:00.000000000 -0600
@@ -1,40 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>Secure Order Form</TITLE>
-</HEAD>
-<BODY>
-
-<FORM action="agora.cgi" method="POST">
-<H2>CART CONTENTS HERE</H2>
-</FORM>
-
-<CENTER>
-<TABLE WIDTH="550" BORDER="0" CELLPADDING="0">
-<TR>
-<TD COLSPAN="2" ALIGN="CENTER"><FONT SIZE="-1"><hr></FONT></TD>
-</TR>
-<TR>
-<TD COLSPAN="2" ALIGN="CENTER"><FONT face=arial SIZE="2"><B>What method 
-would you like to use to pay for your order?</B></FONT></TD>
-</TR>
-<TR>
-<TD width="50%" align="center">
-<FORM action="agora.cgi" method="POST">
-<INPUT TYPE=HIDDEN NAME = "ofn" VALUE = "Offline">
-<INPUT TYPE=HIDDEN NAME = "submit" VALUE = "Next">
-<INPUT TYPE=HIDDEN NAME="order_form_button" VALUE="1">
-<INPUT TYPE="IMAGE" NAME="Pay By Credit Card" VALUE="1"
-SRC="agora.cgi?secpicserve=visamas1.gif" border=0></FORM><BR><font face=arial size=2>Pay with Your Visa or MasterCard<BR><BR></font></TD>
-<TD width="50%" align="center">
-<FORM action="agora.cgi" method="POST">
-<INPUT TYPE=HIDDEN NAME = "ofn" VALUE = "PayPal">
-<INPUT TYPE=HIDDEN NAME = "submit" VALUE = "Next">
-<INPUT TYPE=HIDDEN NAME="order_form_button" VALUE="1">
-<INPUT TYPE="IMAGE" NAME="Pay By Check" VALUE="1"
-SRC="agora.cgi?secpicserve=logo-xclick.gif" border=0></FORM><BR><BR><font face=arial size=2>Use the secure PayPal system for Visa, MasterCard, American Express, Discover and Check Payments</font></TD>
-</TR>
-</TABLE>
-</CENTER>
-</FORM>
-</BODY>
-</HTML>
diff -ruN 4.0K-4b/html/html-templates/AgoraPay.inc 5.0.000/html/html-templates/AgoraPay.inc
--- 4.0K-4b/html/html-templates/AgoraPay.inc	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/AgoraPay.inc	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,9 @@
+<!--begin gateway .inc file-->
+
+<div align="center">
+<p class="ac_error">
+AgoraPay.inc in html-templates directory. Place any text here<BR>
+</p>
+</div>
+
+<!--end gateway .inc file-->
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/Art.inc 5.0.000/html/html-templates/Art.inc
--- 4.0K-4b/html/html-templates/Art.inc	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/Art.inc	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,43 @@
+<tr> 
+	<td colspan="3"><hr/</td>
+</tr>
+<tr> 
+	<td class="ac_product_opt-add">
+		<form method="post" action="%%scriptURL%%">
+			%%make_hidden_fields%%
+			%%optionFile%%
+			<!--BEGIN SELECT QUANTITY BUTTON-->
+			<table class="ac_add-quantity">
+				<tr>
+					<td class="ac_add-quantity">
+						%%QtyBox%%
+					</td>
+					<td class="ac_add-quantity">
+						<input type="image" name="add_to_cart_button" value="Add To Cart"
+							src="%%ButtonSetURL%%/add_to_cart.gif">
+					</td>
+				</tr>
+			</table>
+			<!--END SELECT QUANTITY BUTTON-->
+		</form>
+	</td>
+	<td class="ac_product_image"><a href='%%URLofImages%%/%%userFieldTwo%%' target="_new">%%image%%</a></td>
+	<td>
+		<h3 class="ac_product_name">%%name%%</h3>
+		<p class="ac_product_desc">%%description%% <br /><br /> <a href='%%URLofImages%%/%%userFieldTwo%%' target="_new">Click Here to see a larger image</a></p>
+		<br/>
+			<table width='100%' border=0 cellpadding=0 cellspacing=0 class="ac_product_desc">
+				<tr>
+					<td width='33%' align=center>
+						<span class="ac_product_price">%%price%%</span>
+					</td>
+					<td width='33%' align=center>
+						<a href="%%scripturl%%?dc=1&amp;%%href_fields%%">View Cart</a>
+					</td>
+					<td width = '33%' align=center>
+						<a href='%%StepOneURL%%?order_form_button.x=1&amp;%%href_fields%%'>Check Out</a>
+					</td>
+				</tr>
+			</table>
+	</td>
+</tr>
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/cart_footer.inc 5.0.000/html/html-templates/cart_footer.inc
--- 4.0K-4b/html/html-templates/cart_footer.inc	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/html-templates/cart_footer.inc	2006-10-31 09:40:27.000000000 -0600
@@ -1,42 +1,26 @@
-<TABLE>
-<TR>
-<TD>
-&nbsp;
-</TD>
-</TR>
-</TABLE>
-
-<TABLE>
-<TR>
-<TD>
+<div align="center">
 <!--agorascript-pre
 if ($sc_qty_box_on_cart_display =~ /yes/i) {
-  return '<INPUT TYPE="IMAGE" NAME="submit_change_quantity_button" VALUE="Change Quantity" SRC="%%URLofImages%%/edit_items.gif" BORDER="0">';
+  return '<input type="image" name="submit_change_quantity_button" 
+  	value="Change Quantity" src="%%ButtonSetURL%%/edit_items.gif">';
  } else {
-  return '<INPUT TYPE="IMAGE" NAME="change_quantity_button" VALUE="Change Quantity" SRC="%%URLofImages%%/edit_items.gif" BORDER="0">';
+  return '<input type="image" name="change_quantity_button" 
+  	value="Change Quantity" src="%%ButtonSetURL%%/edit_items.gif">';
  }
 -->
-<INPUT TYPE="IMAGE" NAME="delete_item_button" VALUE="Delete Items" SRC="%%URLofImages%%/remove_items.gif" BORDER="0">
-<INPUT TYPE="IMAGE" NAME="continue_shopping_button" VALUE="Continue Shopping" SRC="%%URLofImages%%/continue_shopping.gif" BORDER="0">
-</TD>
-</TR>
-</TABLE>
+<input type="image" name="delete_item_button" 
+	value="Delete Items" src="%%ButtonSetURL%%/remove_items.gif">
+<input type="image" name="continue_shopping_button" 
+	value="Continue Shopping" src="%%ButtonSetURL%%/continue_shopping.gif">
+
+<br/>
 
 <!--DO NOT DELETE THIS NEXT LINE-->
 %%offlineSecureURL%%
 <!--END DO NOT DELETE THIS NEXT LINE-->
 
-<TABLE>
-<TR>
-
-<TD>
-<INPUT TYPE="IMAGE" NAME="order_form_button" VALUE="Complete Secure Order" SRC="%%URLofImages%%/complete_order.gif" BORDER="0">
-
-</TD>
-
-</TR>
-</TABLE>
-
-</FORM>
+<input type="image" name="order_form_button" 
+	value="Complete Secure Order" src="%%ButtonSetURL%%/complete_order.gif">
+</form>
+</div>
 
-</CENTER>
diff -ruN 4.0K-4b/html/html-templates/cart_options_security_add_error.inc 5.0.000/html/html-templates/cart_options_security_add_error.inc
--- 4.0K-4b/html/html-templates/cart_options_security_add_error.inc	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/cart_options_security_add_error.inc	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,9 @@
+<!--begin options add error .inc file-->
+
+<div align="center">
+<p class="ac_error">
+I'm sorry, it appears that you tried to add an invalid option to the product.  Please contact the Store Owner to report the error. Thanks.<BR>
+</p>
+</div>
+
+<!--end options add error .inc file-->
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/change_quantity_footer.inc 5.0.000/html/html-templates/change_quantity_footer.inc
--- 4.0K-4b/html/html-templates/change_quantity_footer.inc	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/html-templates/change_quantity_footer.inc	2006-10-31 09:40:27.000000000 -0600
@@ -1,6 +1,7 @@
-<P>           
-<INPUT TYPE="IMAGE" NAME="submit_change_quantity_button" VALUE="Submit Change" SRC="%%URLofImages%%/edit_items.gif" BORDER="0">
-<INPUT TYPE="IMAGE" NAME="continue_shopping_button" VALUE="Continue Shopping" SRC="%%URLofImages%%/continue_shopping.gif" BORDER="0">
-
-</FORM>
-</CENTER>
+<div align="center">           
+<input type="image" name="submit_change_quantity_button" 
+	value="Submit Change" src="%%ButtonSetURL%%/edit_items.gif">
+<input type="image" name="continue_shopping_button" 
+	value="Continue Shopping" src="%%ButtonSetURL%%/continue_shopping.gif">
+</div>
+</form>
diff -ruN 4.0K-4b/html/html-templates/delete_items_footer.inc 5.0.000/html/html-templates/delete_items_footer.inc
--- 4.0K-4b/html/html-templates/delete_items_footer.inc	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/html-templates/delete_items_footer.inc	2006-10-31 09:40:27.000000000 -0600
@@ -1,6 +1,7 @@
-<P>
-<INPUT TYPE="IMAGE" NAME="submit_deletion_button" VALUE="Submit Deletion" SRC="%%URLofImages%%/remove_items.gif" BORDER="0">
-<INPUT TYPE="IMAGE" NAME="continue_shopping_button" VALUE="Continue Shopping" SRC="%%URLofImages%%/continue_shopping.gif" BORDER="0">
-
-</FORM>
-</CENTER>
+<div align="center">
+	<input type="image" name="submit_deletion_button" 
+		value="Submit Deletion" src="%%ButtonSetURL%%/remove_items.gif">
+	<input type="image" name="continue_shopping_button" 
+		value="Continue Shopping" src="%%ButtonSetURL%%/continue_shopping.gif">
+</div>
+</form>
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/empty_cart_footer.inc 5.0.000/html/html-templates/empty_cart_footer.inc
--- 4.0K-4b/html/html-templates/empty_cart_footer.inc	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/html-templates/empty_cart_footer.inc	2006-10-31 09:40:27.000000000 -0600
@@ -1,22 +1,13 @@
-<TABLE>
-<TR>
-<TD>
-&nbsp;
-</TD>
-</TR>
-</TABLE>
-
-<TABLE>
-<TR>
-<TD>
-<INPUT TYPE="HIDDEN" NAME="return_to_frontpage_button" 
-VALUE="<!--agorascript "$sc_return_to_frontpage_after_empty_cart"; -->">
-<INPUT TYPE="IMAGE" NAME="continue_shopping_button" VALUE="Continue Shopping" 
-SRC="%%URLofImages%%/continue_shopping.gif" BORDER="0">
-</TD>
-</TR>
-</TABLE>
-
-</FORM>
-
-</CENTER>
+<div align="center">
+<table>
+	<tr>
+		<td>
+			<input type="hidden" name="return_to_frontpage_button" value="
+			  <!--agorascript "$sc_return_to_frontpage_after_empty_cart"; -->">
+			<input type="image" name="continue_shopping_button" value="Continue Shopping" 
+				src="%%ButtonSetURL%%/continue_shopping.gif">
+		</td>
+	</tr>
+</table>
+</div>
+</form>
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/footer-HT2ML Books.inc 5.0.000/html/html-templates/footer-HT2ML Books.inc
--- 4.0K-4b/html/html-templates/footer-HT2ML Books.inc	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/footer-HT2ML Books.inc	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,16 @@
+<!-- Begin Footer -->
+	</td>
+</tr>
+<tr>
+	<td>&nbsp;</td><td class="ac_bottom_links">
+
+Custom Footer for HT2ML Books named: "footer-HT2ML Books.inc"
+
+	</td>
+</tr>
+<tr>
+<td colspan="2" class="ac_copyright">
+	Copyright 1999 to Present by K-Factor Technologies Inc. at <a href="http://www.agoracart.com">AgoraCart.com</a>
+</td>
+</tr>
+</table>
diff -ruN 4.0K-4b/html/html-templates/footer-Machine Tooling.inc 5.0.000/html/html-templates/footer-Machine Tooling.inc
--- 4.0K-4b/html/html-templates/footer-Machine Tooling.inc	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/footer-Machine Tooling.inc	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,44 @@
+		</TD>
+	</TR>
+</TABLE>
+		</TD>
+	</TR>
+</TABLE>
+
+<TABLE WIDTH="100%" BORDER="1" CELLSPACING="0" CELLPADDING="0">
+	<TR>
+		<TD ALIGN="LEFT" bgcolor="#cccccc">
+			<B>Note:</B>  We have thousands of <B>New and Used Surplus Machine Tools</B> in stock and ready to ship. Besides Kwik-Switch 200, 300 & 400 tooling systems and tools, we have CAT, BT, CT, Straight Shank, Morse Taper, Acme threaded shank, etc.<BR>Bilz tap adapters, shell mill adapters, stub arbors, MT & JT adapters, boring heads, drill chucks, and much more.
+<BR>
+			<IMG SRC="http://www.tools-n-gizmos.com/spacer370.gif" ALT="370 pixel space">
+				Steve (aka Griz)
+  		</TD>
+	</TR>
+</TABLE>
+
+<TABLE WIDTH="100%" BORDER="1" CELLSPACING="0" CELLPADDING="2">
+	<TR BGCOLOR="#CCCCCC">
+		<TD ALIGN="CENTER" VALIGN="MIDDLE">
+			<B><FONT FACE="Arial" SIZE="-1">
+			<A HREF="agora.cgi?cart_id=%%cart_id%%">Home</A>
+				<IMG SRC="http://www.tools-n-gizmos.com/VertLine12x29.gif" ALT="Vertical Line"> 
+			<A HREF="http://www.tools-n-gizmos.com/store/agora.cgi">Inventory Index</A>
+				<IMG SRC="http://www.tools-n-gizmos.com/VertLine12x29.gif" ALT="Vertical Line"> 
+			<A HREF="http://www.tools-n-gizmos.com/specs.html">Specifications</A>
+				<IMG SRC="http://www.tools-n-gizmos.com/VertLine12x29.gif" ALT="Vertical Line">
+			<A HREF="http://www.tools-n-gizmos.com/contact.html">Contact Us</A>
+				<IMG SRC="http://www.tools-n-gizmos.com/VertLine12x29.gif" ALT="Vertical Line"> 
+			<A HREF="http://www.tools-n-gizmos.com/about.html">About Us</A>
+				<IMG SRC="http://www.tools-n-gizmos.com/VertLine12x29.gif" ALT="Vertical Line"> 
+			<A HREF="http://www.tools-n-gizmos.com/policy.html">Policies</A>
+			</FONT></B>
+		</TD>
+	</TR>
+	<TR>
+		<TD ALIGN="CENTER" VALIGN="MIDDLE">
+			<B><FONT FACE="Arial" SIZE="-2">Copyright &copy; 2001-2007 Tools-n-Gizmos</FONT></B>
+		</TD>
+	</TR>		
+</TABLE>
+
+
diff -ruN 4.0K-4b/html/html-templates/header-HT2ML Books.inc 5.0.000/html/html-templates/header-HT2ML Books.inc
--- 4.0K-4b/html/html-templates/header-HT2ML Books.inc	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/header-HT2ML Books.inc	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,146 @@
+<!--BEGIN HEADER TABLE-->
+<STYLE TYPE="text/css">
+<!--
+.templatehead_mainbackground{
+  background-color : #680098;
+  width :100%;
+  padding: 0px;
+  text-align: center;
+  font-family : Verdana, Arial;
+  color: #FFFFFF;
+}
+-->
+</STYLE>
+<table class="templatehead_mainbackground">
+<tr>
+  <td>
+<!--agorascript-pre 
+&capture_STDOUT; 
+print qq~<font class="template_fonth1"><b>Another HTML Bookstore</b></font>~;
+print qq~<font class="template_fonth2"><br>A Custom Header for HT2ML Books</font>~;
+&uncapture_STDOUT;  -->
+  </td>
+  <td class="ac_header_search">
+    <form method="post" action="agora.cgi">
+      <input type="hidden" name="cart_id" value="%%cart_id%%">
+      <input type="text" name="keywords" size="20" maxlength="40">
+      <input type="hidden" name="ppinc" value="search">
+      <input type="submit" name="search_request_button" value="Search"> 
+    </form>
+  </td>
+</tr>
+</table>
+<table class="ac_mainbody" cellpadding=0 cellspacing=0>
+<tr>
+  <td class="ac_left_nav">
+  <h3>Shopping Categories:</h3>
+<!--agorascript-pre { # code to list categories and/or sub categories
+# updated for AgoraCart 5.x by Mister Ed Jan 11, 2005
+# updated to fit CSS mods by Eric Welin Feb 02, 2005
+local($sku,$category,$subcategory);
+my ($catnumber,$catnumber2)= '';
+local(%db_ele,%subcatarray)= ();
+if (!($sc_db_lib_was_loaded =~ /yes/i)){ 
+  &require_supporting_libraries (__FILE__, __LINE__, "$sc_db_lib_path"); 
+}
+&capture_STDOUT;
+print "  <ul>";
+if ($sc_use_database_subcats =~ /yes/i) {
+  &get_prod_db_element($db{"product"},*db_ele);
+  foreach $sku (sort (keys %db_ele)) {
+    $catnumber = "";
+    $category = $db_ele{$sku};
+    %subcatarray = %{$db_ele{$category}};
+    $category2 = $category;
+    $category2=~s/ /%20/g;
+    if ($sc_count_database_cats =~ /yes/i) {
+      $catnumber = "(" . $db_ele2{$category} . ")";
+    }
+    print qq~\n    <li><a href="agora.cgi?cart_id=%%cart_id%%&amp;product=$category2" class="ac_left_links" title="$category">$category</a> $catnumber</li>~;
+    foreach $subcategoryarray (sort(keys %subcatarray)) {
+      $category3 = $subcategoryarray;
+#      $category3=~s/ /%20/g;
+      if ($sc_count_database_cats =~ /yes/i) {
+        $catnumber2 = "(" . $db_ele{$category}->{$subcategoryarray} . ")";
+      }
+      print qq~\n    <li><a href="agora.cgi?cart_id=%%cart_id%%&amp;product=$category2&amp;user4=$category3" class="ac_left_sub_links" title="$category3">$category3</a> $catnumber2</li>~;
+    }
+  }
+} else { 
+  &get_prod_db_element($db{"product"},*db_ele);
+  foreach $sku (keys %db_ele) {
+    $category = $db_ele{$sku};
+    $category_list{$category}++;
+  }
+  foreach $category (sort(keys %category_list)) {
+    $category2 = $category;
+    $category2=~s/_/ /g;
+    print qq~\n    <li><a href="agora.cgi?cart_id=%%cart_id%%&amp;product=$category" class="ac_left_links" title="$category2">$category2</a></li>~;
+  }
+}
+print "\n  </ul>";
+&uncapture_STDOUT; }
+-->
+    <hr/>
+    <form method="post" action="agora.cgi">
+      <h3>
+        Look For Gifts<br/>
+        under this Price:<br/>
+        <input type="hidden" name="cart_id" value="%%cart_id%%">
+        $ <input type="text" name="query_price_high_range" size="6" maxlength="10"><br/>
+        <input type="hidden" name="ppinc" value="search">
+        <input type="submit" name="search_request_button" value=" Search ">
+      </h3>
+    </form>
+    <hr/>
+    <h3>Company Info:</h3>
+<!--agorascript-pre 
+&capture_STDOUT; 
+&cartlinks;
+print $cartlinks;
+&uncapture_STDOUT;  -->
+    
+    <div id="ac_html_validator">
+      <a href="http://validator.w3.org/check?uri=referer" target="_new">
+        <img src="%%URLofImages%%/valid-html401.png"
+          alt="Valid HTML 4.01!" height="31" width="88"></a>
+    </div>
+    
+  </td>
+  <td class="ac_content">
+<!--agorascript-pre {
+local (@my_cart_fields,$my_cart_row_number,$result);
+local ($count,$price,$product_id,$quantity,$total_cost,$total_qty)=0;
+if ((!(-f "$sc_cart_path"))||($sc_processing_order =~ /yes/i)) {return ""}
+open (CART, "$sc_cart_path") || &file_open_error("$sc_cart_path",
+ "display_cart_contents_in_header", __FILE__, __LINE__);
+ while (<CART>)
+  {
+   $count++;
+   chop;    
+   @my_cart_fields = split (/\|/, $_);
+   $my_cart_row_number = pop(@my_cart_fields);
+   push (@my_cart_fields, $my_cart_row_number);
+   $quantity = $my_cart_fields[0];
+   $product_id = $my_cart_fields[1];
+   $price = $my_cart_fields[$sc_cart_index_of_price_after_options]; 
+   $total_cost = $total_cost + $quantity * $price;
+   $total_qty = $total_qty + $quantity;
+  } # End of while (<CART>)
+close (CART);
+if ($count > 0) {
+  $result = '<div align="center"><table class="ac_cart_summary"><tr>' .
+      '<td><a href="agora.cgi?dc=1&amp;%%href_fields%%' . 
+      '">View Cart</a></td>' .
+      "<td> Items in shopping cart: $total_qty\n" . 
+      "<br/> Item cost subtotal:&nbsp; " . &display_price($total_cost) . 
+      "</td>\n" .
+      '<td><a href="%%StepOneURL%%?order_form_button.x=1&amp;%%href_fields%%' . 
+      '">Check Out</a></td>' .
+      "</tr></table></div>";
+ } else {
+  $result = "";
+ }
+ return $result;
+}-->
+<!--END HEADER TABLE-->
diff -ruN 4.0K-4b/html/html-templates/header-Machine Tooling.inc 5.0.000/html/html-templates/header-Machine Tooling.inc
--- 4.0K-4b/html/html-templates/header-Machine Tooling.inc	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/header-Machine Tooling.inc	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,146 @@
+<!--BEGIN HEADER TABLE-->
+<STYLE TYPE="text/css">
+<!--
+.templatehead_mainbackground{
+  background-color : #0000FF;
+  width :100%;
+  padding: 0px;
+  text-align: center;
+  font-family : Verdana, Arial;
+  color: #FFFFFF;
+}
+-->
+</STYLE>
+<table class="templatehead_mainbackground">
+<tr>
+  <td>
+<!--agorascript-pre 
+&capture_STDOUT; 
+print qq~<font class="template_fonth1"><b>Tools-n-Gizmos.com</b></font>~;
+print qq~<font class="template_fonth2"><br>A Custom Header for sample products</font>~;
+&uncapture_STDOUT;  -->
+  </td>
+  <td class="ac_header_search">
+    <form method="post" action="agora.cgi">
+      <input type="hidden" name="cart_id" value="%%cart_id%%">
+      <input type="text" name="keywords" size="20" maxlength="40">
+      <input type="hidden" name="ppinc" value="search">
+      <input type="submit" name="search_request_button" value="Search"> 
+    </form>
+  </td>
+</tr>
+</table>
+<table class="ac_mainbody" cellpadding=0 cellspacing=0>
+<tr>
+  <td class="ac_left_nav">
+  <h3>Shopping Categories:</h3>
+<!--agorascript-pre { # code to list categories and/or sub categories
+# updated for AgoraCart 5.x by Mister Ed Jan 11, 2005
+# updated to fit CSS mods by Eric Welin Feb 02, 2005
+local($sku,$category,$subcategory);
+my ($catnumber,$catnumber2)= '';
+local(%db_ele,%subcatarray)= ();
+if (!($sc_db_lib_was_loaded =~ /yes/i)){ 
+  &require_supporting_libraries (__FILE__, __LINE__, "$sc_db_lib_path"); 
+}
+&capture_STDOUT;
+print "  <ul>";
+if ($sc_use_database_subcats =~ /yes/i) {
+  &get_prod_db_element($db{"product"},*db_ele);
+  foreach $sku (sort (keys %db_ele)) {
+    $catnumber = "";
+    $category = $db_ele{$sku};
+    %subcatarray = %{$db_ele{$category}};
+    $category2 = $category;
+    $category2=~s/ /%20/g;
+    if ($sc_count_database_cats =~ /yes/i) {
+      $catnumber = "(" . $db_ele2{$category} . ")";
+    }
+    print qq~\n    <li><a href="agora.cgi?cart_id=%%cart_id%%&amp;product=$category2" class="ac_left_links" title="$category">$category</a> $catnumber</li>~;
+    foreach $subcategoryarray (sort(keys %subcatarray)) {
+      $category3 = $subcategoryarray;
+#      $category3=~s/ /%20/g;
+      if ($sc_count_database_cats =~ /yes/i) {
+        $catnumber2 = "(" . $db_ele{$category}->{$subcategoryarray} . ")";
+      }
+      print qq~\n    <li><a href="agora.cgi?cart_id=%%cart_id%%&amp;product=$category2&amp;user4=$category3" class="ac_left_sub_links" title="$category3">$category3</a> $catnumber2</li>~;
+    }
+  }
+} else { 
+  &get_prod_db_element($db{"product"},*db_ele);
+  foreach $sku (keys %db_ele) {
+    $category = $db_ele{$sku};
+    $category_list{$category}++;
+  }
+  foreach $category (sort(keys %category_list)) {
+    $category2 = $category;
+    $category2=~s/_/ /g;
+    print qq~\n    <li><a href="agora.cgi?cart_id=%%cart_id%%&amp;product=$category" class="ac_left_links" title="$category2">$category2</a></li>~;
+  }
+}
+print "\n  </ul>";
+&uncapture_STDOUT; }
+-->
+    <hr/>
+    <form method="post" action="agora.cgi">
+      <h3>
+        Look For Gifts<br/>
+        under this Price:<br/>
+        <input type="hidden" name="cart_id" value="%%cart_id%%">
+        $ <input type="text" name="query_price_high_range" size="6" maxlength="10"><br/>
+        <input type="hidden" name="ppinc" value="search">
+        <input type="submit" name="search_request_button" value=" Search ">
+      </h3>
+    </form>
+    <hr/>
+    <h3>Company Info:</h3>
+<!--agorascript-pre 
+&capture_STDOUT; 
+&cartlinks;
+print $cartlinks;
+&uncapture_STDOUT;  -->
+    
+    <div id="ac_html_validator">
+      <a href="http://validator.w3.org/check?uri=referer" target="_new">
+        <img src="%%URLofImages%%/valid-html401.png"
+          alt="Valid HTML 4.01!" height="31" width="88"></a>
+    </div>
+    
+  </td>
+  <td class="ac_content">
+<!--agorascript-pre {
+local (@my_cart_fields,$my_cart_row_number,$result);
+local ($count,$price,$product_id,$quantity,$total_cost,$total_qty)=0;
+if ((!(-f "$sc_cart_path"))||($sc_processing_order =~ /yes/i)) {return ""}
+open (CART, "$sc_cart_path") || &file_open_error("$sc_cart_path",
+ "display_cart_contents_in_header", __FILE__, __LINE__);
+ while (<CART>)
+  {
+   $count++;
+   chop;    
+   @my_cart_fields = split (/\|/, $_);
+   $my_cart_row_number = pop(@my_cart_fields);
+   push (@my_cart_fields, $my_cart_row_number);
+   $quantity = $my_cart_fields[0];
+   $product_id = $my_cart_fields[1];
+   $price = $my_cart_fields[$sc_cart_index_of_price_after_options]; 
+   $total_cost = $total_cost + $quantity * $price;
+   $total_qty = $total_qty + $quantity;
+  } # End of while (<CART>)
+close (CART);
+if ($count > 0) {
+  $result = '<div align="center"><table class="ac_cart_summary"><tr>' .
+      '<td><a href="agora.cgi?dc=1&amp;%%href_fields%%' . 
+      '">View Cart</a></td>' .
+      "<td> Items in shopping cart: $total_qty\n" . 
+      "<br/> Item cost subtotal:&nbsp; " . &display_price($total_cost) . 
+      "</td>\n" .
+      '<td><a href="%%StepOneURL%%?order_form_button.x=1&amp;%%href_fields%%' . 
+      '">Check Out</a></td>' .
+      "</tr></table></div>";
+ } else {
+  $result = "";
+ }
+ return $result;
+}-->
+<!--END HEADER TABLE-->
diff -ruN 4.0K-4b/html/html-templates/productPage-1a.inc 5.0.000/html/html-templates/productPage-1a.inc
--- 4.0K-4b/html/html-templates/productPage-1a.inc	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/html-templates/productPage-1a.inc	2006-10-31 09:40:27.000000000 -0600
@@ -1,68 +1,17 @@
-<TR> 
-<TD COLSPAN = "3"><HR></TD>
-</TR>
-
-<TR WIDTH="550"> 
-  
-<TD ALIGN="CENTER" WIDTH="160" VALIGN="MIDDLE">
-
-<FONT FACE="ARIAL" SIZE="2">
-<FORM METHOD = "post" ACTION = "%%scriptURL%%">
-%%make_hidden_fields%%
-<BR>
-%%optionFile%%
-<BR>
-
-<P>
-
+<tr><td class="ac_product_desc" width=170>
+<form method="post" action="%%scriptURL%%">
+%%make_hidden_fields%%<br/>
+%%optionFile%%<br/><p>
 <!--BEGIN SELECT QUANTITY BUTTON-->
-<TABLE>
-<TR ALIGN="CENTER">
- <TD VALIGN="MIDDLE">%%QtyBox%%</TD>
- <TD VALIGN="MIDDLE"><INPUT TYPE="IMAGE"
- NAME="add_to_cart_button" VALUE="Add To Cart"
- SRC="%%URLofImages%%/add_to_cart.gif" BORDER="0">
- </TD>
-</TR>
-</TABLE>
+<table class="ac_add-quantity"><tr><td class="ac_add-quantity">%%QtyBox%%</td>
+<td class="ac_add-quantity"><input type="image" name="add_to_cart_button" value="Add To Cart" src="%%ButtonSetURL%%/add_to_cart.gif">
+</p></td></tr></table>
 <!--END SELECT QUANTITY BUTTON-->
-
-</TD>
-
-<TD ALIGN="CENTER" WIDTH="150">%%image%%</TD>
-  
-<TD WIDTH="265">
-
-<FONT FACE="ARIAL" SIZE="2">
-
-<b>%%name%%</b>
-
-<br>
-
-%%description%%
-
-<br>
-
-<font color="#FF0000">%%price%%</font>
-
-<br>
-
-</FONT>
-
-</TD>
-
-</FORM>
-
-</TR>
-
-<TR> 
-<td>&nbsp;</td>
-<td>&nbsp;</td>
-<td align="right">
-
-<A HREF="%%scripturl%%?dc=1&%%href_fields%%">
-<FONT FACE=ARIAL>Check Out</FONT>
-</A>
-
-</TD>
-</TR>
+</td><td class="ac_product_image">%%image%%</td>
+<td class="ac_product_desc">
+<b>%%name%%</b><br/>
+%%description%%<br><br/>
+<span class="ac_product_price">%%price%%</span><br>
+</td></form></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td class="ac_product_desc">
+<a href="%%scripturl%%?dc=1&%%href_fields%%">Check Out</a></td></tr>
+<tr><td colspan=3><hr/></td></tr>
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/productPage-1b.inc 5.0.000/html/html-templates/productPage-1b.inc
--- 4.0K-4b/html/html-templates/productPage-1b.inc	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/html-templates/productPage-1b.inc	2006-10-31 09:40:27.000000000 -0600
@@ -1,46 +1,14 @@
-<TR> 
-<TD COLSPAN = "3"><HR></TD>
-</TR>
-
-<TR WIDTH="550"> 
-<TD WIDTH="365">
-
-<FONT FACE="ARIAL" SIZE="2">
-<FORM METHOD = "post" ACTION = "%%scriptURL%%">
+<tr><td class="ac_product_desc"><form method="post" action="%%scriptURL%%">
 %%make_hidden_fields%%
-<b>%%name%%</b>
-
-<br>
-
-%%description%%
-
-<br>
-
-</FONT>
-
-</TD>
-<TD ALIGN="CENTER" WIDTH="100"><font color="#FF0000"><B>%%price%%</B></font></TD>
-  
-<TD ALIGN="CENTER" WIDTH="160" VALIGN="MIDDLE">
-
-<FONT FACE="ARIAL" SIZE="2">
-
+<b>%%name%%</b><br/>
+%%description%%<br/></TD>
+<td width="100"><span class="ac_product_price">%%price%%</span></td>
+<td width="160">
 <!--BEGIN SELECT QUANTITY BUTTON-->
-<TABLE>
-<TR ALIGN="CENTER">
- <TD VALIGN="MIDDLE"><INPUT TYPE="TEXT" NAME="%%itemID%%" SIZE="3"
- MAXLENGTH="3" VALUE="1"></TD><TD VALIGN="MIDDLE"><INPUT TYPE="IMAGE"
- NAME="add_to_cart_button" VALUE="Add To Cart"
- SRC="%%URLofImages%%/add_to_cart.gif" BORDER="0">
- </TD>
-</TR>
-</TABLE>
+<table class="ac_add-quantity"><tr><td class="ac_add-quantity">%%QtyBox%%</td>
+<td class="ac_add-quantity"><input type="image" name="add_to_cart_button" value="Add To Cart" src="%%ButtonSetURL%%/add_to_cart.gif">
+</td></tr></table>
 <!--END SELECT QUANTITY BUTTON-->
-<A HREF="agora.cgi?dc=1&%%href_fields%%">
-<FONT FACE=ARIAL size="2"><B>Check Out</B></FONT>
-</A>
-</TD>
-
-</FORM>
-
-</TR>
+<a href="agora.cgi?dc=1&%%href_fields%%"><b>Check Out</b></a>
+</td></form></tr>
+<tr><td><hr/></td></tr>
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/productPage-1b1.inc 5.0.000/html/html-templates/productPage-1b1.inc
--- 4.0K-4b/html/html-templates/productPage-1b1.inc	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/html-templates/productPage-1b1.inc	2006-10-31 09:40:27.000000000 -0600
@@ -1,48 +1,15 @@
-<TR> 
-<TD COLSPAN = "3"><HR></TD>
-</TR>
-
-<TR WIDTH="550"> 
-<TD WIDTH="365">
-
-<FONT FACE="ARIAL" SIZE="2">
-<FORM METHOD = "post" ACTION = "%%scriptURL%%">
+<tr><td class="ac_product_desc">
+<form method="post" action="%%scriptURL%%">
 %%make_hidden_fields%%
-<b>%%name%%</b>
-
-<br>
-
-%%description%%
-
-<br>
-%%optionFile%%
-<br>
-
-</FONT>
-
-</TD>
-<TD ALIGN="CENTER" WIDTH="100"><font color="#FF0000"><B>%%price%%</B></font></TD>
-  
-<TD ALIGN="CENTER" WIDTH="160" VALIGN="MIDDLE">
-
-<FONT FACE="ARIAL" SIZE="2">
-
+<b>%%name%%</b><br>
+%%description%%<br/>
+%%optionFile%%<br/></TD>
+<td width="100"><span class="ac_product_price">%%price%%</span></td>
+  <td width="160">
 <!--BEGIN SELECT QUANTITY BUTTON-->
-<TABLE>
-<TR ALIGN="CENTER">
- <TD VALIGN="MIDDLE"><INPUT TYPE="TEXT" NAME="%%itemID%%" SIZE="3"
- MAXLENGTH="3" VALUE="1"></TD><TD VALIGN="MIDDLE"><INPUT TYPE="IMAGE"
- NAME="add_to_cart_button" VALUE="Add To Cart"
- SRC="%%URLofImages%%/add_to_cart.gif" BORDER="0">
- </TD>
-</TR>
-</TABLE>
+<table class="ac_add-quantity"><tr><td class="ac_add-quantity">%%QtyBox%%</td>
+<td class="ac_add-quantity"><input type="image" name="add_to_cart_button" value="Add To Cart" src="%%ButtonSetURL%%/add_to_cart.gif">
+</td></tr></table>
 <!--END SELECT QUANTITY BUTTON-->
-<A HREF="agora.cgi?dc=1&%%href_fields%%">
-<FONT FACE=ARIAL size="2"><B>Check Out</B></FONT>
-</A>
-</TD>
-
-</FORM>
-
-</TR>
+<a href="agora.cgi?dc=1&%%href_fields%%"><b>Check Out</b></a></td></form></tr>
+<tr><td><hr/></td></tr>
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/productPage-1c.inc 5.0.000/html/html-templates/productPage-1c.inc
--- 4.0K-4b/html/html-templates/productPage-1c.inc	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/html-templates/productPage-1c.inc	2006-10-31 09:40:27.000000000 -0600
@@ -1,42 +1,13 @@
-<TR> 
-<TD COLSPAN = "3"><HR></TD>
-</TR>
-
-<TR WIDTH="550"> 
-<TD WIDTH="365">
-
-<FONT FACE="ARIAL" SIZE="2">
-<FORM METHOD = "post" ACTION = "%%scriptURL%%">
+<tr><td class="ac_product_desc"><form method="post" action="%%scriptURL%%">
 %%make_hidden_fields%%
-<b>%%name%%</b>
-<br>
-Product ID: %%ProductID%%<br>
-<A HREF="%%scripturl%%?cart_id=&p_id=%%ProductID%%&xm=on&ppinc=search2">Click Here for More Information</a>
-</FONT>
-
-</TD>
-<TD ALIGN="CENTER" WIDTH="100"><font color="#FF0000"><B>%%price%%</B></font></TD>
-  
-<TD ALIGN="CENTER" WIDTH="160" VALIGN="MIDDLE">
-
-<FONT FACE="ARIAL" SIZE="2">
-
+<b>%%name%%</b><br/>Product ID: %%ProductID%%<br/>
+<a href="%%scripturl%%?cart_id=%%cart_id%%&amp;p_id=%%ProductID%%&amp;product=%%product%%&amp;xm=on&ppinc=search2">Click Here for More Information</a></td>
+<td width="100"><span class="ac_product_price">%%price%%</span><br/></td>
+<td width="160">
 <!--BEGIN SELECT QUANTITY BUTTON-->
-<TABLE>
-<TR ALIGN="CENTER">
- <TD VALIGN="MIDDLE"><INPUT TYPE="TEXT" NAME="%%itemID%%" SIZE="3"
- MAXLENGTH="3" VALUE="1"></TD><TD VALIGN="MIDDLE"><INPUT TYPE="IMAGE"
- NAME="add_to_cart_button" VALUE="Add To Cart"
- SRC="%%URLofImages%%/add_to_cart.gif" BORDER="0">
- </TD>
-</TR>
-</TABLE>
+<table class="ac_add-quantity"><tr><td class="ac_add-quantity">%%QtyBox%%</td>
+<td class="ac_add-quantity"><input type="image" name="add_to_cart_button" value="Add To Cart" src="%%ButtonSetURL%%/add_to_cart.gif">
+</td></tr></table>
 <!--END SELECT QUANTITY BUTTON-->
-<A HREF="agora.cgi?dc=1&%%href_fields%%">
-<FONT FACE=ARIAL size="2"><B>Check Out</B></FONT>
-</A>
-</TD>
-
-</FORM>
-
-</TR>
+<a href="%%scripturl%%?dc=1&%%href_fields%%">Check Out</a></td></tr>
+<tr><td colspan=3><hr/></td></tr>
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/productPage-1d.inc 5.0.000/html/html-templates/productPage-1d.inc
--- 4.0K-4b/html/html-templates/productPage-1d.inc	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/html-templates/productPage-1d.inc	2006-10-31 09:40:27.000000000 -0600
@@ -1,5 +1,5 @@
 <TR> 
-<TD COLSPAN = "3"><HR></TD>
+<TD><HR></TD>
 </TR>
 
 <TR WIDTH="550"> 
diff -ruN 4.0K-4b/html/html-templates/productPage-2a.inc 5.0.000/html/html-templates/productPage-2a.inc
--- 4.0K-4b/html/html-templates/productPage-2a.inc	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/html-templates/productPage-2a.inc	2006-10-31 09:40:27.000000000 -0600
@@ -1,86 +1,87 @@
+<!-- start of product page -->
 <!--agorascript-pre
-{
+{ #Start of controller code, probably should leave this alone ;-)
 local ($myans)="";
 if ($rowCount == (1+$minCount)) { #first one
   $ags_row_item=0;
   $ags_tot_item=0;
-  $myans .= '<tr><td colspan=3><table width="100%" border=1>'."\n";
+  $myans .= '<tr><td colspan="3"><table width="100%" border="1">'."\n";
  }
 $ags_row_item++;
 $ags_tot_item++;
 if (($rowCount == ($maxCount)) || ($rowCount == ($num_returned)))
  { # very last one, need to join these two cells, no border
   if ($ags_row_item == 1) { # first and only one
-    $myans .= '<td width="100%" colspan=2><table width=100% border=0>'."\n";
-    $myans .= '<tr>'."\n";
+    $myans .= '<tr><td width="100%" colspan="2">'."\n";
+    $myans .= '<table width="100%" border="0">'."\n";
    }
  }
 if ($ags_row_item == 2) { # second one
   $ags_row_item=0; #reset counter
-  $myans .= '<td width="50%"><table width=100% border=0>'."\n";
+  $myans .= '<td width="50%"><table width="100%" border="0">'."\n";
  } else { #first one
-  $myans .= '<tr><td width="50%"><table width=100% border=0>'."\n";
+  $myans .= '<tr><td width="50%"><table width="100%" border="0">'."\n";
  }
 return $myans;
-}
+} # end of controller code
 -->
-<TR WIDTH="100%"> 
-<TD ALIGN="CENTER" WIDTH="160" VALIGN="MIDDLE">
-<FONT FACE="ARIAL" SIZE="2">
-<FORM METHOD = "post" ACTION = "%%scriptURL%%">
-%%make_hidden_fields%%
-<BR>
-%%optionFile%%
-<BR>
-<P>
-<!--BEGIN SELECT QUANTITY BUTTON-->
-<TABLE>
-<TR ALIGN="CENTER">
- <TD VALIGN="MIDDLE">%%QtyBox%%</TD>
-<TD VALIGN="MIDDLE"><INPUT TYPE="IMAGE"
- NAME="add_to_cart_button" VALUE="Add To Cart"
- SRC="%%URLofImages%%/add_to_cart.gif" BORDER="0">
- </TD>
-</TR>
-</TABLE>
-<!--END SELECT QUANTITY BUTTON-->
-</TD>
-<TD ALIGN="CENTER" WIDTH="150">%%image%%</TD>
+<tr> 
+	<td class="ac_product_opt-add">
+		<form method="post" action="%%scriptURL%%">
+			%%make_hidden_fields%%
+			%%optionFile%%
+			<!--BEGIN SELECT QUANTITY BUTTON-->
+			<table class="ac_add-quantity">
+				<tr>
+					<td class="ac_add-quantity">
+						%%QtyBox%%
+					</td>
+					<td class="ac_add-quantity">
+						<input type="image" name="add_to_cart_button" value="Add To Cart"
+							src="%%URLofImages%%/add_to_cart.gif">
+					</td>
+				</tr>
+			</table>
+			<!--END SELECT QUANTITY BUTTON-->
+		</form>
+	</td>
+	<td class="ac_product_image">%%image%%</td>
 </tr>
 <!--agorascript-pre
-{
+{ # more controller code
 local ($myans)="";
 if (($rowCount == ($maxCount)) || ($rowCount == ($num_returned)))
  { # very last one
   if ($ags_row_item == 1) { # first and only one
     $myans .= '</table></td>'."\n";
-    $myans .= '<td width="50%"><table width=100%>'."\n";
+    $myans .= '<td width="50%"><table width="100%">'."\n";
    }
  }
 return $myans;
-}
+} # end controller code
 -->
-<tr><TD colspan=2>
-<FONT FACE="ARIAL" SIZE="2">
-<b>%%name%%</b>
-<br>
-%%description%%
-</FONT>
-</TD>
-</FORM>
-</TR>
-<TR> 
-<td>
-<FONT FACE="ARIAL" SIZE="2" color="#FF0000">%%price%%</font>
-</td>
-<td align="right">
-<A HREF="%%scripturl%%?dc=1&%%href_fields%%">
-<FONT FACE=ARIAL>Check Out</FONT>
-</A>
-</TD>
-</TR>
+<tr>
+	<td colspan=2>
+		<h3 class="ac_product_name">%%name%%</h3>
+		<p class="ac_product_desc">%%description%%</p>	
+	</td>
+</tr>
+<tr> 
+	<td colspan=2>
+		<table width='100%' border=0 cellpadding=0 cellspacing=0 class="ac_product_desc">
+			<tr>
+				<td width='50%' align=center>
+					<span class="ac_product_price">%%price%%</span>
+				</td>
+				<td width = '50%' align=center>
+					<a href='%%StepOneURL%%?order_form_button.x=1&amp;%%href_fields%%'>Check Out</a>
+				</td>
+			</tr>
+		</table>
+	</td>
+</tr>
 <!--agorascript-pre
-{
+{ # more controller code
 local ($myans)="";
 if ($ags_row_item == 1) { # first one
   $myans .= '</table></td>'."\n";
@@ -102,5 +103,7 @@
   $myans .= '</table></td></tr>'."\n";
  }
 return $myans;
-}
+} # end controller code
 -->
+
+<!-- end of product page-->
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/productPage-2a0.inc 5.0.000/html/html-templates/productPage-2a0.inc
--- 4.0K-4b/html/html-templates/productPage-2a0.inc	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/html-templates/productPage-2a0.inc	2006-10-31 09:40:27.000000000 -0600
@@ -17,49 +17,51 @@
 return $myans;
 }
 -->
-<TR WIDTH="100%"> 
-<TD ALIGN="CENTER" WIDTH="160" VALIGN="MIDDLE">
-<FONT FACE="ARIAL" SIZE="2">
-<FORM METHOD = "post" ACTION = "%%scriptURL%%">
-%%make_hidden_fields%%
-<BR>
-%%optionFile%%
-<BR>
-<P>
-<!--BEGIN SELECT manually specified QUANTITY BUTTON-->
-<TABLE>
-<TR ALIGN="CENTER">
- <TD VALIGN="MIDDLE"><INPUT TYPE="TEXT" NAME="%%itemID%%" SIZE="3"
- MAXLENGTH="3" VALUE="1"></TD><TD VALIGN="MIDDLE"><INPUT TYPE="IMAGE"
- NAME="add_to_cart_button" VALUE="Add To Cart"
- SRC="%%URLofImages%%/add_to_cart.gif" BORDER="0">
- </TD>
-</TR>
-</TABLE>
-<!--END SELECT QUANTITY BUTTON-->
-</TD>
-<TD ALIGN="CENTER" WIDTH="150">%%image%%</TD>
+<tr> 
+	<td class="ac_product_opt-add">
+		<form method="post" action="%%scriptURL%%">
+			%%make_hidden_fields%%
+			%%optionFile%%
+			<!--BEGIN SELECT QUANTITY BUTTON-->
+			<table class="ac_add-quantity">
+				<tr>
+					<td class="ac_add-quantity">
+						%%QtyBox%%
+					</td>
+					<td class="ac_add-quantity">
+						<input type="image" name="add_to_cart_button" value="Add To Cart"
+							src="%%URLofImages%%/add_to_cart.gif">
+					</td>
+				</tr>
+			</table>
+			<!--END SELECT QUANTITY BUTTON-->
+		</form>
+	</td>
+	<td class="ac_product_image">%%image%%</td>
+</tr>
+<tr>
+	<td colspan=2>
+		<h3 class="ac_product_name">%%name%%</h3>
+		<p class="ac_product_desc">%%description%%</p>	
+	</td>
+</tr>
+<tr> 
+	<td colspan=2>
+		<table width='100%' border=0 cellpadding=0 cellspacing=0 class="ac_product_desc">
+			<tr>
+				<td width='33%' align=center>
+					<span class="ac_product_price">%%price%%</span>
+				</td>
+				<td width='33%' align=center>
+					<a href="%%scripturl%%?dc=1&amp;%%href_fields%%">View Cart</a>
+				</td>
+				<td width = '33%' align=center>
+					<a href='%%StepOneURL%%?order_form_button.x=1&amp;%%href_fields%%'>Check Out</a>
+				</td>
+			</tr>
+		</table>
+	</td>
 </tr>
-<tr><TD colspan=2>
-<FONT FACE="ARIAL" SIZE="2">
-<b>%%name%%</b>
-<br>
-%%description%%
-<br>
-<font color="#FF0000">%%price%%</font>
-<br>
-</FONT>
-</TD>
-</FORM>
-</TR>
-<TR> 
-<td>&nbsp;</td>
-<td align="right">
-<A HREF="%%scripturl%%?dc=1&%%href_fields%%">
-<FONT FACE=ARIAL>Check Out</FONT>
-</A>
-</TD>
-</TR>
 <!--agorascript-pre
 {
 local ($myans)="";
diff -ruN 4.0K-4b/html/html-templates/productPage-2a1.inc 5.0.000/html/html-templates/productPage-2a1.inc
--- 4.0K-4b/html/html-templates/productPage-2a1.inc	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/html-templates/productPage-2a1.inc	2006-10-31 09:40:27.000000000 -0600
@@ -1,79 +1,90 @@
+<!-- start of product page -->
 <!--agorascript-pre
-{
+{ #Start of controller code, probably should leave this alone ;-)
 local ($myans)="";
 if ($rowCount == (1+$minCount)) { #first one
   $ags_row_item=0;
   $ags_tot_item=0;
-  $myans .= '<tr><td colspan=3><table width="100%" border=1>'."\n";
+  $myans .= '<tr><td colspan="3"><table width="100%" border="1">'."\n";
  }
 $ags_row_item++;
 $ags_tot_item++;
 if (($rowCount == ($maxCount)) || ($rowCount == ($num_returned)))
  { # very last one, need to join these two cells, no border
   if ($ags_row_item == 1) { # first and only one
-    $myans .= '<td width="100%" colspan=2><table width=100% border=0>'."\n";
-    $myans .= '<tr>'."\n";
+    $myans .= '<tr><td width="100%" colspan="2">'."\n";
+    $myans .= '<table width="100%" border="0">'."\n";
    }
  }
 if ($ags_row_item == 2) { # second one
   $ags_row_item=0; #reset counter
-  $myans .= '<td width="50%"><table width=100% border=0>'."\n";
+  $myans .= '<td width="50%"><table width="100%" border="0">'."\n";
  } else { #first one
-  $myans .= '<tr><td width="50%"><table width=100% border=0>'."\n";
+  $myans .= '<tr><td width="50%"><table width="100%" border="0">'."\n";
  }
 return $myans;
-}
+} # end of controller code
 -->
-<TR WIDTH="100%"> 
-<TD ALIGN="CENTER" WIDTH="160" VALIGN="MIDDLE">
-<FONT FACE="ARIAL" SIZE="2">
-<FORM METHOD = "post" ACTION = "%%scriptURL%%">
-%%make_hidden_fields%%
-<BR>
-%%optionFile%%
-<BR>
-<P>
-<!--BEGIN SELECT manually specified QUANTITY BUTTON-->
-<TABLE>
-<TR ALIGN="CENTER">
- <TD VALIGN="MIDDLE"><INPUT TYPE="TEXT" NAME="%%itemID%%" SIZE="3"
- MAXLENGTH="3" VALUE="1"></TD><TD VALIGN="MIDDLE"><INPUT TYPE="IMAGE"
- NAME="add_to_cart_button" VALUE="Add To Cart"
- SRC="%%URLofImages%%/add_to_cart.gif" BORDER="0">
- </TD>
-</TR>
-</TABLE>
-<!--END SELECT QUANTITY BUTTON-->
-</TD>
-<TD ALIGN="CENTER" WIDTH="150">%%image%%</TD>
+<tr> 
+	<td class="ac_product_opt-add">
+		<form method="post" action="%%scriptURL%%">
+			%%make_hidden_fields%%
+			%%optionFile%%
+			<!--BEGIN SELECT QUANTITY BUTTON-->
+			<table class="ac_add-quantity">
+				<tr>
+					<td class="ac_add-quantity">
+						%%QtyBox%%
+					</td>
+					<td class="ac_add-quantity">
+						<input type="image" name="add_to_cart_button" value="Add To Cart"
+							src="%%URLofImages%%/add_to_cart.gif">
+					</td>
+				</tr>
+			</table>
+			<!--END SELECT QUANTITY BUTTON-->
+		</form>
+	</td>
+	<td class="ac_product_image">%%image%%</td>
 </tr>
 <!--agorascript-pre
-{
+{ # more controller code
 local ($myans)="";
 if (($rowCount == ($maxCount)) || ($rowCount == ($num_returned)))
  { # very last one
   if ($ags_row_item == 1) { # first and only one
     $myans .= '</table></td>'."\n";
-    $myans .= '<td width="50%"><table width=100%>'."\n";
+    $myans .= '<td width="50%"><table width="100%">'."\n";
    }
  }
 return $myans;
-}
+} # end controller code
 -->
-<tr><TD colspan=2>
-<FONT FACE="ARIAL" SIZE="2">
-<b>%%name%%</b>
-<br>
-%%description%%
-<br>
-<font color="#FF0000">%%price%%</font>
-<br>
-</FONT>
-</TD>
-</FORM>
-</TR>
+<tr>
+	<td colspan=2>
+		<h3 class="ac_product_name">%%name%%</h3>
+		<p class="ac_product_desc">%%description%%</p>	
+	</td>
+</tr>
+<tr> 
+	<td colspan=2>
+		<table width='100%' border=0 cellpadding=0 cellspacing=0 class="ac_product_desc">
+			<tr>
+				<td width='33%' align=center>
+					<span class="ac_product_price">%%price%%</span>
+				</td>
+				<td width='33%' align=center>
+					<a href="%%scripturl%%?dc=1&amp;%%href_fields%%">View Cart</a>
+				</td>
+				<td width = '33%' align=center>
+					<a href='%%StepOneURL%%?order_form_button.x=1&amp;%%href_fields%%'>Check Out</a>
+				</td>
+			</tr>
+		</table>
+	</td>
+</tr>
 <!--agorascript-pre
-{
+{ # more controller code
 local ($myans)="";
 if ($ags_row_item == 1) { # first one
   $myans .= '</table></td>'."\n";
@@ -95,6 +106,7 @@
   $myans .= '</table></td></tr>'."\n";
  }
 return $myans;
-}
+} # end controller code
 -->
 
+<!-- end of product page-->
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/productPage-4a.inc 5.0.000/html/html-templates/productPage-4a.inc
--- 4.0K-4b/html/html-templates/productPage-4a.inc	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/html-templates/productPage-4a.inc	2006-10-31 09:40:27.000000000 -0600
@@ -1,13 +1,16 @@
 <!--agorascript-pre
 {
+#	This file allows you to have any number of 
+# rows by setting the following variable
 $ags_across = 4; # Number in a row
+
 $ags_row_wd=int(100.0/$ags_across);
 local ($myans)="";
 if ($rowCount == (1+$minCount)) { #first one
   $ags_row_item=0;
   $ags_row_nmbr=0;
   $ags_tot_item=0;
-  $myans .= '<tr><td colspan=3><table width="100%" border=1>'."\n";
+  $myans .= '<tr><td colspan="3"><table width="100%" border="1">'."\n";
  }
 $ags_row_item++;
 $ags_tot_item++;
@@ -20,39 +23,26 @@
  } else { #first one
   $myans .= '<tr><td width="'.$ags_row_wd.'%" valign="top">';
  }
-$myans.=qq~<FORM METHOD = "post" ACTION = "%%scriptURL%%">
+$myans.=qq~<form method="post" action="%%scriptURL%%">
 %%make_hidden_fields%%
-<table width=100%>
+<table width="100%">
 ~;
 return $myans;
 }
 -->
-<TR WIDTH="100%"> 
-<TD ALIGN="CENTER" WIDTH="100%">%%image%%</TD>
-</tr>
-<tr><TD>
-<FONT FACE="ARIAL" SIZE="2">
-<b>Product: %%ProductID%%</b>
-<br>
-<font color="#FF0000">%%price%%</font>
-<br>
-</FONT>
-</TD>
-</TR>
-<TR> 
-<td align="left">
-<A HREF="%%scripturl%%?cart_id=&p_id=%%ProductID%%&xm=on&ppinc=search2">
-<FONT FACE=ARIAL>More Info</FONT></A>
-<br>
-</TD>
-</TR>
+<tr><td class="ac_product_image">%%image%%</td></tr>
+<tr><td>
+		<h3 class="ac_product_name">Product: %%ProductID%%</h3>
+		<p class="ac_product_desc"><span class="ac_product_price">%%price%%</span><br/>
+			<a href="%%scripturl%%?cart_id=&amp;p_id=%%ProductID%%&amp;xm=on&amp;ppinc=search2">More Info</a></p>
+	</td></tr>
 <!--agorascript-pre
 {
 local ($myans)="";
 if ($ags_row_item == 0) { # last one
-  $myans .= '</table></FORM></td></tr>'."\n";
+  $myans .= '</table></form></td></tr>'."\n";
  } else { # first one
-  $myans .= '</table></FORM></td>'."\n";
+  $myans .= '</table></form></td>'."\n";
  }
 if (($rowCount == ($maxCount)) || ($rowCount == ($num_returned)))
  { # very last one
diff -ruN 4.0K-4b/html/html-templates/productPage-search.inc 5.0.000/html/html-templates/productPage-search.inc
--- 4.0K-4b/html/html-templates/productPage-search.inc	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/html-templates/productPage-search.inc	2006-10-31 09:40:27.000000000 -0600
@@ -1,18 +1,5 @@
-<TR> 
-<TD COLSPAN = "3"><HR></TD>
-</TR>
-<TR WIDTH="550"> 
-<td>
- <table width=100% cellpadding=0 cellspacing=0 border=0>
- <tr>  
-  <TD COLSPAN=1 align=rleft>
-  <b>%%name%%</b> <font color="#FF0000">(%%price%%)</font></td>
-  <TD COLSPAN=2 align=right>
-  <A HREF="%%scripturl%%?cart_id=&p_id=%%ProductID%%&xm=on&ppinc=search2">
-  <FONT FACE=ARIAL>Display</FONT></A>
-  &nbsp;&nbsp;&nbsp;
-  <A HREF="%%scripturl%%?cart_id=&p=%%CategoryID%%&xm=on">
-  <FONT FACE=ARIAL>Show Similar</FONT></A></TD>
- </tr>
- </table></td>
-</TR>
+<tr><td colspan="2"><hr/></td></tr>
+<tr><td align="left"><b>%%name%%</b><span class="ac_product_price">(%%price%%)</span>
+</td><td align=right>
+<a href="%%scripturl%%?cart_id=&amp;p_id=%%ProductID%%&amp;xm=on">Display</a>&nbsp;&nbsp;&nbsp;
+<a href="%%scripturl%%?cart_id=&amp;p=%%CategoryID%%&amp;xm=on">Show Similar</a></td></tr>
diff -ruN 4.0K-4b/html/html-templates/productPage-search2.inc 5.0.000/html/html-templates/productPage-search2.inc
--- 4.0K-4b/html/html-templates/productPage-search2.inc	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/html-templates/productPage-search2.inc	2006-10-31 09:40:27.000000000 -0600
@@ -1,75 +1,22 @@
-<TR> 
-<TD COLSPAN = "3"><HR></TD>
-</TR>
-
-<TR WIDTH="550"> 
-  
-<TD ALIGN="CENTER" WIDTH="160" VALIGN="MIDDLE">
-
-<FONT FACE="ARIAL" SIZE="2">
-<FORM METHOD = "post" ACTION = "%%scriptURL%%">
-%%make_hidden_fields%%
-<BR>
-%%optionFile%%
-<BR>
-
-<P>
-
-<!--BEGIN SELECT QUANTITY BUTTON-->
-<TABLE>
-<TR ALIGN="CENTER">
- <TD VALIGN="MIDDLE"><INPUT TYPE="TEXT" NAME="%%itemID%%" SIZE="3"
- MAXLENGTH="3" VALUE="1"></TD><TD VALIGN="MIDDLE"><INPUT TYPE="IMAGE"
- NAME="add_to_cart_button" VALUE="Add To Cart"
- SRC="%%URLofImages%%/add_to_cart.gif" BORDER="0">
- </TD>
-</TR>
-</TABLE>
-<!--END SELECT QUANTITY BUTTON-->
-</TD>
-
-<TD ALIGN="CENTER" WIDTH="150">%%image%%</TD>
-  
-<TD WIDTH="265">
-
-<FONT FACE="ARIAL" SIZE="2">
-
-<b>%%name%%</b>
-
-<br>
-
-%%description%%
-
-<br>
-
-<font color="#FF0000">%%price%%</font>
-
-<br>
-
-</FONT>
-
-</TD>
-
-</FORM>
-
-</TR>
-
-<TR> 
-<td colspan=3>
-<table width=100% border=0>
- <tr>
-  <td align=right colspan=1>&nbsp;</td>
-  <td align=right colspan=1>
-<A HREF="%%scripturl%%?cart_id=&p=%%CategoryID%%">
-<FONT FACE=ARIAL>Show This Category</FONT></A>
-  </td>
-  <td align="right" colspan=1>
-
-<A HREF="%%scripturl%%?dc=1&%%href_fields%%">
-<FONT FACE=ARIAL>Check Out</FONT>
-</A>
-  </td>
-</tr>
-</table>
-</TD>
-</TR>
+<tr><td class="ac_product_opt-add">
+		<form method="post" action="%%scriptURL%%">
+			%%make_hidden_fields%%
+			%%optionFile%%
+			<!--BEGIN SELECT QUANTITY BUTTON-->
+			<table class="ac_add-quantity"><tr><td class="ac_add-quantity">%%QtyBox%%
+					</td><td class="ac_add-quantity">
+						<input type="image" name="add_to_cart_button" value="Add To Cart" src="%%ButtonSetURL%%/add_to_cart.gif">
+					</td></tr></table>
+			<!--END SELECT QUANTITY BUTTON-->
+		</form></td><td class="ac_product_image">%%image%%</td>
+	<td><h3 class="ac_product_name">%%name%%</h3>
+		<p class="ac_product_desc">%%description%%</p><br/>
+			<table width='100%' border=0 cellpadding=0 cellspacing=0 class="ac_product_desc">
+				<tr><td width='33%' align=center>
+						<span class="ac_product_price">%%price%%</span>
+					</td><td width='33%' align=center>
+						<a href="%%scripturl%%?dc=1&amp;%%href_fields%%">View Cart</a>
+					</td><td width = '33%' align=center>
+						<a href='%%StepOneURL%%?order_form_button.x=1&amp;%%href_fields%%'>Check Out</a>
+					</td></tr></table></td>
+</tr><tr><td colspan="3"><hr/></td></tr>
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/productPage.inc 5.0.000/html/html-templates/productPage.inc
--- 4.0K-4b/html/html-templates/productPage.inc	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/html-templates/productPage.inc	2006-10-31 09:40:27.000000000 -0600
@@ -1,51 +1,51 @@
+<!-- start of product page -->
 <!--agorascript-pre
 { #Start of controller code, probably should leave this alone ;-)
 local ($myans)="";
 if ($rowCount == (1+$minCount)) { #first one
   $ags_row_item=0;
   $ags_tot_item=0;
-  $myans .= '<tr><td colspan=3><table width="100%" border=1>'."\n";
+  $myans .= '<tr><td colspan="3"><table width="100%" border="1">'."\n";
  }
 $ags_row_item++;
 $ags_tot_item++;
 if (($rowCount == ($maxCount)) || ($rowCount == ($num_returned)))
  { # very last one, need to join these two cells, no border
   if ($ags_row_item == 1) { # first and only one
-    $myans .= '<td width="100%" colspan=2><table width=100% border=0>'."\n";
-    $myans .= '<tr>'."\n";
+    $myans .= '<tr><td width="100%" colspan="2">'."\n";
+    $myans .= '<table width="100%" border="0">'."\n";
    }
  }
 if ($ags_row_item == 2) { # second one
   $ags_row_item=0; #reset counter
-  $myans .= '<td width="50%"><table width=100% border=0>'."\n";
+  $myans .= '<td width="50%"><table width="100%" border="0">'."\n";
  } else { #first one
-  $myans .= '<tr><td width="50%"><table width=100% border=0>'."\n";
+  $myans .= '<tr><td width="50%"><table width="100%" border="0">'."\n";
  }
 return $myans;
 } # end of controller code
 -->
-<TR WIDTH="100%"> 
-<TD ALIGN="CENTER" WIDTH="160" VALIGN="MIDDLE">
-<FONT FACE="ARIAL" SIZE="2">
-<FORM METHOD = "post" ACTION = "%%scriptURL%%">
-%%make_hidden_fields%%
-<BR>
-%%optionFile%%
-<BR>
-<P>
-<!--BEGIN SELECT QUANTITY BUTTON-->
-<TABLE>
-<TR ALIGN="CENTER">
- <TD VALIGN="MIDDLE">%%QtyBox%%</TD>
- <TD VALIGN="MIDDLE"><INPUT TYPE="IMAGE"
- NAME="add_to_cart_button" VALUE="Add To Cart"
- SRC="%%URLofImages%%/add_to_cart.gif" BORDER="0">
- </TD>
-</TR>
-</TABLE>
-<!--END SELECT QUANTITY BUTTON-->
-</TD>
-<TD ALIGN="CENTER" WIDTH="150">%%image%%</TD>
+<tr> 
+	<td class="ac_product_opt-add">
+		<form method="post" action="%%scriptURL%%">
+			%%make_hidden_fields%%
+			%%optionFile%%
+			<!--BEGIN SELECT QUANTITY BUTTON-->
+			<table class="ac_add-quantity">
+				<tr>
+					<td class="ac_add-quantity">
+						%%QtyBox%%
+					</td>
+					<td class="ac_add-quantity">
+						<input type="image" name="add_to_cart_button" value="Add To Cart"
+							src="%%ButtonSetURL%%/add_to_cart.gif">
+					</td>
+				</tr>
+			</table>
+			<!--END SELECT QUANTITY BUTTON-->
+		</form>
+	</td>
+	<td class="ac_product_image">%%image%%</td>
 </tr>
 <!--agorascript-pre
 { # more controller code
@@ -54,38 +54,35 @@
  { # very last one
   if ($ags_row_item == 1) { # first and only one
     $myans .= '</table></td>'."\n";
-    $myans .= '<td width="50%"><table width=100%>'."\n";
+    $myans .= '<td width="50%"><table width="100%">'."\n";
    }
  }
 return $myans;
 } # end controller code
 -->
-<tr><TD colspan=2>
-<FONT FACE="ARIAL" SIZE="2">
-<b>%%name%%</b>
-<br>
-%%description%%
-</FONT>
-</TD>
-</FORM>
-</TR>
-<TR> 
-<td colspan=2><table width='100%' border=0 cellpadding=0 cellspacing=0>
-<tr><td width='33%' align=center>
-<FONT FACE="ARIAL" SIZE="2" color="#FF0000">%%price%%</font>
-</td>
-<td width='33%' align=center>
-<A HREF="%%scripturl%%?dc=1&%%href_fields%%"><FONT FACE=ARIAL>View Cart</FONT>
-</A>
-</td>
-<td width = '33%' align=center>
-<A HREF='%%StepOneURL%%?order_form_button.x=1&%%href_fields%%'><FONT 
-FACE=ARIAL>Check Out</FONT>
-</A>
-</TD>
-</tr></table>
-</TD>
-</TR>
+<tr>
+	<td colspan=2>
+		<h3 class="ac_product_name">%%name%%</h3>
+		<p class="ac_product_desc">%%description%%</p>	
+	</td>
+</tr>
+<tr> 
+	<td colspan=2>
+		<table width='100%' border=0 cellpadding=0 cellspacing=0 class="ac_product_desc">
+			<tr>
+				<td width='33%' align=center>
+					<span class="ac_product_price">%%price%%</span>
+				</td>
+				<td width='33%' align=center>
+					<a href="%%scripturl%%?dc=1&amp;%%href_fields%%">View Cart</a>
+				</td>
+				<td width = '33%' align=center>
+					<a href='%%StepOneURL%%?order_form_button.x=1&amp;%%href_fields%%'>Check Out</a>
+				</td>
+			</tr>
+		</table>
+	</td>
+</tr>
 <!--agorascript-pre
 { # more controller code
 local ($myans)="";
@@ -111,3 +108,5 @@
 return $myans;
 } # end controller code
 -->
+
+<!-- end of product page-->
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/productPage.inc.2.per.line.if.not.using.options.at.all.rename.this.file.for.speed 5.0.000/html/html-templates/productPage.inc.2.per.line.if.not.using.options.at.all.rename.this.file.for.speed
--- 4.0K-4b/html/html-templates/productPage.inc.2.per.line.if.not.using.options.at.all.rename.this.file.for.speed	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/html-templates/productPage.inc.2.per.line.if.not.using.options.at.all.rename.this.file.for.speed	1969-12-31 18:00:00.000000000 -0600
@@ -1 +0,0 @@
-<!--agorascript-pre &std_two_across; -->
diff -ruN 4.0K-4b/html/html-templates/secure_store_footer.inc 5.0.000/html/html-templates/secure_store_footer.inc
--- 4.0K-4b/html/html-templates/secure_store_footer.inc	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/html-templates/secure_store_footer.inc	1969-12-31 18:00:00.000000000 -0600
@@ -1,12 +0,0 @@
-<br></form>
-</TD></TR><tr><td colspan=3 valign=top>
-<TABLE WIDTH=100% BORDER=0  cellspacing=0 cellpadding=0 background="agora.cgi?secpicserve=steelgrey.jpg" align=top><TR valign=top>
-<TD>
-<CENTER>
-<small>Copyright 1999-2002 K-Factor Technologies Inc. at <a href="http://www.agoracart.com">AgoraCart.com</a></small>
-</CENTER></TD></TR></TABLE>
-</td></tr></TABLE>
-</td></tr>
-</TABLE>
-</td></tr>
-</table>
diff -ruN 4.0K-4b/html/html-templates/secure_store_header.inc 5.0.000/html/html-templates/secure_store_header.inc
--- 4.0K-4b/html/html-templates/secure_store_header.inc	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/html-templates/secure_store_header.inc	1969-12-31 18:00:00.000000000 -0600
@@ -1,67 +0,0 @@
-
-<!--BEGIN HEADER TABLE-->
-<table WIDTH=765 HEIGHT=28 BGCOLOR="#680098" BORDER=0 CELLPADDING=0 CELLSPACING=0>
-<tr>
-<td HEIGHT=40 ALIGN=CENTER>
-<font face="Verdana, Arial" size=+1 color="#FFFFFF"><b>Powered by AgoraCart - AgoraCart.com
-</b><br></font><font face="Verdana, Arial" size=2 color="white"><i>Thanks for Visiting our Store!</i></font>
-</td><td HEIGHT=40 ALIGN=right><font face="Verdana, Arial" color="#ffffff" size=2><form METHOD="POST" ACTION="
-<!--agorascript-post { &capture_STDOUT;
-print "$sc_store_url";
-&uncapture_STDOUT;
-} -->">
-<input TYPE="hidden" NAME="cart_id" VALUE="%%cart_id%%"><input TYPE="text" NAME="keywords" SIZE=20 MAXLENGTH=40>
-<input TYPE="hidden" NAME="ppinc" VALUE="search">
-  <input TYPE="submit" NAME="search_request_button" VALUE=" Search "> </form></font>
-</td></tr></TABLE>
-<TABLE WIDTH=765 BORDER=0 CELLSPACING=0 CELLPADDING=0 align=top>
-<TR><TD WIDTH=145 valign=top background="agora.cgi?secpicserve=steelgrey.jpg" height=100%><br>
-<b><font face="Arial,Helvetica" color="#FF0000" size=2><CENTER>Shopping Categories:</CENTER></font><font face="Arial,Helvetica" color="#FF0000" size=1>
-<!--agorascript-pre { # code to count up the CART contents
-local(%db_ele,$sku,$category,%category_list);
-if (!($sc_db_lib_was_loaded =~ /yes/i))
- { &require_supporting_libraries (__FILE__, __LINE__, "$sc_db_lib_path"); }
-&capture_STDOUT;
-&get_prod_db_element($db{"product"},*db_ele);
-foreach $sku (keys %db_ele) {
-  $category = $db_ele{$sku};
-  $category_list{$category}++;
-}
-foreach $category (sort(keys %category_list)) {
-   $category2 = $category;
-  $category2=~s/_/ /g;
-  print "&nbsp;&nbsp;<a href=\"$sc_store_url?cart_id=%%cart_id%%&product=",
-    "$category\"> $category2 </a><br>\n";
-}
-&uncapture_STDOUT; }
---></font></b>
-<BR><HR><BR>
-<CENTER><font face="Arial,Helvetica" color=red size=2><B>Look For Gifts under this Price:</B></font>
-<form METHOD="POST" ACTION="<!--agorascript-post { &capture_STDOUT;
-print "$sc_store_url";
-&uncapture_STDOUT;
-} -->"><input 
-TYPE="hidden" NAME="cart_id" VALUE="%%cart_id%%">$ <input TYPE="text" NAME="query_price_high_range" SIZE=7 MAXLENGTH=10><BR>
-<input TYPE="hidden" NAME="ppinc=search" VALUE="search">
-  <input TYPE="submit" NAME="search_request_button" VALUE=" Search "></form></CENTER><br><br>
-<font face="Arial,Helvetica" color="#FF0000" size=2><CENTER><b>Company Info:</b></CENTER></font>
-<!--agorascript-pre 
-&capture_STDOUT; 
-&cartlinks;
-  print "<font face=\"Arial\" size=\"2\">";
-$cartlinks =~ s/<br>/<br>&nbsp;&nbsp;/ig;
-# take make links underlined
-$cartlinks =~ s/style=\"text-decoration: none\"//ig;
-# to layout horizontally with 3 spaces
-# $cartlinks =~ s/<br>/&nbsp;&nbsp;&nbsp;/ig;
-# to layout horizontally with | dividers spaces
-# $cartlinks =~ s/<br>/&nbsp;&nbsp;|&nbsp;&nbsp;/ig;
-print "&nbsp;&nbsp;";
-print $cartlinks;
-  print "</font>";
-&uncapture_STDOUT;  -->
-<br>
-<br>
-</TD><TD WIDTH="620" valign=top>
-
-<!--END HEADER TABLE-->
diff -ruN 4.0K-4b/html/html-templates/store_footer.inc 5.0.000/html/html-templates/store_footer.inc
--- 4.0K-4b/html/html-templates/store_footer.inc	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/html-templates/store_footer.inc	1969-12-31 18:00:00.000000000 -0600
@@ -1,26 +0,0 @@
-</form>
-</TD></TR><tr><td colspan=3 valign=top>
-<TABLE WIDTH=100% BORDER=0 cellspacing=0 cellpadding=0 bgcolor="#cccccc" background="agora.cgi?secpicserve=steelgrey.jpg" align=top><TR valign=top>
-<TD>
-<CENTER>
-<!--agorascript-pre 
-&capture_STDOUT; 
-&cartlinks;
-  print "<font face=\"Arial\" size=\"2\">";
-# take make links underlined
-# $cartlinks =~ s/style=\"text-decoration: none\"//ig;
-# to layout horizontally with 3 spaces
-# $cartlinks =~ s/<br>/&nbsp;&nbsp;&nbsp;/ig;
-# to layout horizontally with | dividers spaces
-$cartlinks =~ s/<br>/&nbsp;&nbsp;|&nbsp;&nbsp;/ig;
-print $cartlinks;
-  print "</font>";
-&uncapture_STDOUT;  --></CENTER></TD></TR></TABLE>
-</td></tr></TABLE>
-</td></tr>
-</TABLE>
-</td></tr>
-</table><CENTER>
-<TABLE WIDTH=550 BORDER=0><TR WIDTH=500 BORDER=0>
-<TD WIDTH=550 BORDER=0 ALIGN=CENTER><CENTER><BR>
-<small>Copyright 1999-2003 K-Factor Technologies Inc. at <a href="http://www.agoracart.com">AgoraCart.com</a></small></CENTER></TD></TR></TABLE></CENTER>
diff -ruN 4.0K-4b/html/html-templates/store_header.inc 5.0.000/html/html-templates/store_header.inc
--- 4.0K-4b/html/html-templates/store_header.inc	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/html-templates/store_header.inc	1969-12-31 18:00:00.000000000 -0600
@@ -1,99 +0,0 @@
-
-<!--BEGIN HEADER TABLE-->
-<table WIDTH=765 HEIGHT=28 BGCOLOR="#680098" BORDER=0 CELLPADDING=0 CELLSPACING=0>
-<tr>
-<td HEIGHT=40 ALIGN=CENTER>
-<font face="Verdana, Arial" size=+1 color="#FFFFFF"><b>Powered by AgoraCart - AgoraCart.com
-</b><br></font><font face="Verdana, Arial" size=2 color="white"><i>Thanks for Visiting our Store!</i></font>
-</td><td HEIGHT=40 ALIGN=right><font face="Verdana, Arial" color="#ffffff" size=2><form METHOD="POST" ACTION="agora.cgi">
-<input TYPE="hidden" NAME="cart_id" VALUE="%%cart_id%%"><input TYPE="text" NAME="keywords" SIZE=20 MAXLENGTH=40>
-<input TYPE="hidden" NAME="ppinc=search" VALUE="search">
-  <input TYPE="submit" NAME="search_request_button" VALUE=" Search "> </form></font>
-</td></tr></TABLE>
-<TABLE WIDTH=765 BORDER=0 CELLSPACING=0 CELLPADDING=0 align=top>
-<TR><TD WIDTH=145 valign=top background="agora.cgi?secpicserve=steelgrey.jpg" bgcolor="#cccccc" height=100%>
-<b><font face="Arial,Helvetica" color="#FF0000" size=2><CENTER>Shopping Categories:</CENTER></font><font face="Arial,Helvetica" color="#FF0000" size=1>
-<!--agorascript-pre { # code to count up the CART contents
-local(%db_ele,$sku,$category,%category_list);
-if (!($sc_db_lib_was_loaded =~ /yes/i))
- { &require_supporting_libraries (__FILE__, __LINE__, "$sc_db_lib_path"); }
-&capture_STDOUT;
-&get_prod_db_element($db{"product"},*db_ele);
-foreach $sku (keys %db_ele) {
-  $category = $db_ele{$sku};
-  $category_list{$category}++;
-}
-foreach $category (sort(keys %category_list)) {
-   $category2 = $category;
-  $category2=~s/_/ /g;
-  print "&nbsp;&nbsp;<a href=\"agora.cgi?cart_id=%%cart_id%%&product=",
-    "$category\"> $category2 </a><br>\n";
-}
-&uncapture_STDOUT; }
---></font></b>
-<BR><HR><BR>
-<CENTER><font face="Arial,Helvetica" color=red size=2><B>Look For Gifts under this Price:</B></font>
-<form METHOD="POST" ACTION="agora.cgi"><input 
-TYPE="hidden" NAME="cart_id" VALUE="%%cart_id%%">$ <input TYPE="text" NAME="query_price_high_range" SIZE=7 MAXLENGTH=10><BR>
-<input TYPE="hidden" NAME="ppinc" VALUE="search">
-  <input TYPE="submit" NAME="search_request_button" VALUE=" Search "></form></CENTER><br><br>
-<font face="Arial,Helvetica" color="#FF0000" size=2><CENTER><b>Company Info:</b></CENTER></font>
-<!--agorascript-pre 
-&capture_STDOUT; 
-&cartlinks;
-  print "<font face=\"Arial\" size=\"2\">";
-$cartlinks =~ s/<br>/<br>&nbsp;&nbsp;/ig;
-# take make links underlined
-$cartlinks =~ s/style=\"text-decoration: none\"//ig;
-# to layout horizontally with 3 spaces
-# $cartlinks =~ s/<br>/&nbsp;&nbsp;&nbsp;/ig;
-# to layout horizontally with | dividers spaces
-# $cartlinks =~ s/<br>/&nbsp;&nbsp;|&nbsp;&nbsp;/ig;
-print "&nbsp;&nbsp;";
-print $cartlinks;
-  print "</font>";
-&uncapture_STDOUT;  -->
-<br>
-<br>
-</TD><TD WIDTH="620" valign=top>
-<!--agorascript-pre {
-local (@my_cart_fields,$my_cart_row_number,$result);
-local ($count,$price,$product_id,$quantity,$total_cost,$total_qty)=0;
-if ((!(-f "$sc_cart_path"))||($sc_processing_order =~ /yes/i)) {return ""}
-open (CART, "$sc_cart_path") || &file_open_error("$sc_cart_path",
- "display_cart_contents_in_header", __FILE__, __LINE__);
- while (<CART>)
-  {
-   $count++;
-   chop;    
-   @my_cart_fields = split (/\|/, $_);
-   $my_cart_row_number = pop(@my_cart_fields);
-   push (@my_cart_fields, $my_cart_row_number);
-   $quantity = $my_cart_fields[0];
-   $product_id = $my_cart_fields[1];
-   $price = $my_cart_fields[$sc_cart_index_of_price_after_options]; 
-   $total_cost = $total_cost + $quantity * $price;
-   $total_qty = $total_qty + $quantity;
-  } # End of while (<CART>)
-close (CART);
-if ($count > 0) {
-  $result = '<div align="center">' .
-      '<center><table border=0 width=100% cellspacing=0  bgcolor="#cccccc" background="agora.cgi?secpicserve=steelgrey.jpg"><tr>' .
-      '<td width="25%" align=left>&nbsp;&nbsp;' .
-      '<a href="agora.cgi?dc=1&%%href_fields%%' . 
-      '"><font color="#0000ff">View Cart</font></a></td>' .
-     '<td width="50%" align=center><font color="#000000">' .
-     "Items in shopping cart: $total_qty &nbsp;\n&nbsp; " . 
-      "<br>Item cost subtotal:&nbsp; " . &display_price($total_cost) . 
-      "</font></td>\n" .
-      '<td width="25%" align=right>' .
-      '<a href="%%StepOneURL%%?order_form_button.x=1&%%href_fields%%' . 
-      '"><font color="#0000ff">Check Out</font></a>&nbsp;&nbsp;</td>' .
-      "</tr></table></center></div>";
- } else {
-  $result = "";
- }
- return $result;
-}-->
-
-<!--END HEADER TABLE-->
diff -ruN 4.0K-4b/html/html-templates/templates/Custom/CustomOne/agoratemplate.css 5.0.000/html/html-templates/templates/Custom/CustomOne/agoratemplate.css
--- 4.0K-4b/html/html-templates/templates/Custom/CustomOne/agoratemplate.css	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/Custom/CustomOne/agoratemplate.css	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,148 @@
+a:link {
+  color: #0000FF;
+}
+a:visited {
+  color: #0000FF;
+}
+a:hover {
+  color: #00AAFF;
+}
+a:active{
+  color: #0000FF;
+}
+.style7 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style8 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.template_fonth1{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 17pt;
+  font-weight: bold;
+  color: #FFFFFF;
+}
+.template_fonth2{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 14pt;
+  font-weight: normal;
+  font-style : italic;
+  color: #FFFFFF;
+}
+.template_mainbackground{
+  background-color : #680098;
+  border-color : #680098;
+}
+.template_image_no_border{
+  border : none;
+}
+.ac_header, .ac_mainbody{
+  width :100%;
+  font-size : 10pt;
+}
+.ac_header{
+  background-color : #680098;
+  padding: 0px;
+  text-align: center;
+  font-family : Verdana, Arial;
+  color: #FFFFFF;
+}
+h1#ac_h1 {
+  font-size : 15pt;
+  font-weight : bold;
+  margin: 0px;
+  color: #FFFFFF;
+}
+h2#ac_h2 {
+  font-style : italic;
+  margin: 0px;
+  font-size: 12pt;
+  color: #FFFFFF;
+}
+.ac_left_nav h3 {
+  color : #FF0000;
+  font-weight : bold;
+  text-align: center;
+  margin: 0px;
+  padding: 5px 0px 0px 5px;
+  font-size: 10pt;
+}
+.ac_left_nav hr{
+  padding:0px;
+  margin: 25px 0px 25px 0px;
+  width : 95%;
+}
+.ac_header_search{
+  text-align: right;
+  vertical-align : middle;
+}
+.ac_mainbody, .ac_cart_summary{
+  background-image : url(agora.cgi?secpicserve=steelgrey.jpg);
+  background-color : #cccccc;
+}
+.ac_mainbody{
+  padding: 0px;
+  margin: 0px;
+}
+.ac_left_nav{
+  width: 155px;
+  vertical-align : top;
+  padding: 0px;
+  padding-top: 15px;
+}
+a.ac_cart_info_links {
+  padding: px;
+  padding-right: 5px; 
+  padding-left: 10px;
+  font-size: 10pt;
+  font-weight: bold;
+  text-decoration : none;
+}
+a.ac_left_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 10px;
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : underline;
+}
+a.ac_left_sub_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 18px;
+  font-size: 9pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+.ac_cart_summary{
+  font-size: 12pt;
+  width:100%;
+  color: #000000;
+  text-align: center;
+  padding: 0px;
+  padding-top:10px;
+  padding-bottom:10px;
+}
+.ac_copyright{
+  text-align: center;
+  font-size: 10pt;
+  background-color: #FFFFFF;
+  padding: 0px;
+  padding-top:10px;
+  padding-bottom:10px;
+} 
+div#ac_html_validator{
+  text-align: center;
+  padding-top : 100px;
+  vertical-align : bottom;
+}
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/templates/Custom/CustomOne/index.html 5.0.000/html/html-templates/templates/Custom/CustomOne/index.html
--- 4.0K-4b/html/html-templates/templates/Custom/CustomOne/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/Custom/CustomOne/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/templates/Custom/index.html 5.0.000/html/html-templates/templates/Custom/index.html
--- 4.0K-4b/html/html-templates/templates/Custom/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/Custom/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_BluGreen/agoratemplate.css 5.0.000/html/html-templates/templates/TheAgora/TheAgora_BluGreen/agoratemplate.css
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_BluGreen/agoratemplate.css	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_BluGreen/agoratemplate.css	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,128 @@
+<style type="text/css">
+.style6 {
+	font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #2A6D60;
+}
+a:link {
+	color: #2A6D60;
+	text-decoration: none;
+}
+a:visited {
+	text-decoration: none;
+	color: #1B433A;
+}
+a:hover {
+	text-decoration: none;
+	color: #1B433A;
+}
+a:active {
+	text-decoration: none;
+	color: #1B433A;
+}
+.style11 {color: #2A6D60; font-family: Geneva, Arial, Helvetica, sans-serif; font-weight: bold; }
+.style7 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style12 {color: #2A6D60}
+.style8 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style14 {font-size: 12px}
+.ac_ppinc_content{
+  background-color: #FFFFFF;
+  vertical-align : top;
+  height : 100%;
+  padding: 0px; 
+  padding-bottom: 25px;
+}
+.template_mainbackground{
+  background-color : #2A6D60;
+  border-color : #2A6D60;
+}
+.style14 {font-size: 12px}
+.template_image_no_border{
+  border : none;
+}
+.template_table_image_background{
+  background-image : url(backgroundbanner.gif);
+}
+.template_copyright{
+  background-color : #2A6D60;
+  text-align: center;
+  font-size: 10pt;
+  color: #FFFFFF;
+}
+a.copyright_link {
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+  color: #FFFF00;
+}
+.template_cartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 9pt;
+  color: #000000;
+}
+.template_checkoutcartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 11pt;
+  color: #000000;
+}
+.template_fonth1{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 17pt;
+  font-weight: bold;
+  color: #FFFFFF;
+}
+.template_fonth2{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 14pt;
+  font-weight: normal;
+  font-style : italic;
+  color: #FFFFFF;
+}
+a.ac_cart_info_links {
+  padding: 0px;
+  padding-right: 5px; 
+  padding-left: 5px;
+  font-size: 11pt;
+  font-weight: bold;
+  text-decoration : none;
+}
+.ac_left_nav{
+  width: 155px;
+  vertical-align : top;
+  padding: 0px;
+  padding-top: 15px;
+}
+a.ac_left_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 10px;
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+a.ac_left_sub_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 18px;
+  font-size: 9pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+-->
+</style>
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_BluGreen/backgroundbanner.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_BluGreen/backgroundbanner.gif differ
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_BluGreen/header.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_BluGreen/header.gif differ
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_BluGreen/index.html 5.0.000/html/html-templates/templates/TheAgora/TheAgora_BluGreen/index.html
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_BluGreen/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_BluGreen/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_BlueRoyal/agoratemplate.css 5.0.000/html/html-templates/templates/TheAgora/TheAgora_BlueRoyal/agoratemplate.css
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_BlueRoyal/agoratemplate.css	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_BlueRoyal/agoratemplate.css	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,128 @@
+<style type="text/css">
+.style6 {
+	font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #4E26CC;
+}
+a:link {
+	color: #4E26CC;
+	text-decoration: none;
+}
+a:visited {
+	text-decoration: none;
+	color: #4A21C8;
+}
+a:hover {
+	text-decoration: none;
+	color: #5C34DA;
+}
+a:active {
+	text-decoration: none;
+	color: #542CD3;
+}
+.style11 {color: #4E26CC; font-family: Geneva, Arial, Helvetica, sans-serif; font-weight: bold; }
+.style7 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style12 {color: #4E26CC}
+.style8 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style14 {font-size: 12px}
+.ac_ppinc_content{
+  background-color: #FFFFFF;
+  vertical-align : top;
+  height : 100%;
+  padding: 0px; 
+  padding-bottom: 25px;
+}
+.template_mainbackground{
+  background-color : #4E26CC;
+  border-color : #4E26CC;
+}
+.style14 {font-size: 12px}
+.template_image_no_border{
+  border : none;
+}
+.template_table_image_background{
+  background-image : url(backgroundbanner.gif);
+}
+.template_copyright{
+  background-color : #4E26CC;
+  text-align: center;
+  font-size: 10pt;
+  color: #FFFFFF;
+}
+a.copyright_link {
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+  color: #FFFF00;
+}
+.template_cartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 9pt;
+  color: #000000;
+}
+.template_checkoutcartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 11pt;
+  color: #000000;
+}
+.template_fonth1{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 17pt;
+  font-weight: bold;
+  color: #FFFFFF;
+}
+.template_fonth2{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 14pt;
+  font-weight: normal;
+  font-style : italic;
+  color: #FFFFFF;
+}
+a.ac_cart_info_links {
+  padding: 0px;
+  padding-right: 5px; 
+  padding-left: 5px;
+  font-size: 11pt;
+  font-weight: bold;
+  text-decoration : none;
+}
+.ac_left_nav{
+  width: 155px;
+  vertical-align : top;
+  padding: 0px;
+  padding-top: 15px;
+}
+a.ac_left_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 10px;
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+a.ac_left_sub_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 18px;
+  font-size: 9pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+-->
+</style>
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_BlueRoyal/backgroundbanner.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_BlueRoyal/backgroundbanner.gif differ
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_BlueRoyal/header.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_BlueRoyal/header.gif differ
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_BlueRoyal/index.html 5.0.000/html/html-templates/templates/TheAgora/TheAgora_BlueRoyal/index.html
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_BlueRoyal/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_BlueRoyal/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Caramel/agoratemplate.css 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Caramel/agoratemplate.css
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Caramel/agoratemplate.css	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Caramel/agoratemplate.css	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,128 @@
+<style type="text/css">
+<!--
+.style6 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #947F3C;
+}
+a:link {
+	text-decoration: none;
+	color: #947F3C;
+}
+a:visited {
+	text-decoration: none;
+	color: #957F3C;
+}
+a:hover {
+	text-decoration: none;
+	color: #846300;
+}
+a:active {
+	text-decoration: none;
+	color: #000000;
+}
+.style11 {color: #96803E; font-family: Geneva, Arial, Helvetica, sans-serif; font-weight: bold; }
+.style7 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style12 {color: #947F3C}
+.style8 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style14 {font-size: 12px}
+.ac_ppinc_content{
+  background-color: #FFFFFF;
+  vertical-align : top;
+  height : 100%;
+  padding: 0px; 
+  padding-bottom: 25px;
+}
+.template_mainbackground{
+  background-color : #947F3C;
+  border-color : #947F3C;
+}
+.style14 {font-size: 12px}
+.template_image_no_border{
+  border : none;
+}
+.template_table_image_background{
+  background-image : url(backgroundbanner.gif);
+}
+.template_copyright{
+  background-color : #947F3C;
+  text-align: center;
+  font-size: 10pt;
+  color: #FFFFFF;
+}
+a.copyright_link {
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+  color: #FFFF00;
+}
+.template_cartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 9pt;
+  color: #000000;
+}
+.template_checkoutcartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 11pt;
+  color: #000000;
+}
+.template_fonth1{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 17pt;
+  font-weight: bold;
+  color: #FFFFFF;
+}
+.template_fonth2{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 14pt;
+  font-weight: normal;
+  font-style : italic;
+  color: #FFFFFF;
+}
+a.ac_cart_info_links {
+  padding: 0px;
+  padding-right: 5px; 
+  padding-left: 5px;
+  font-size: 11pt;
+  font-weight: bold;
+  text-decoration : none;
+}
+.ac_left_nav{
+  width: 155px;
+  vertical-align : top;
+  padding: 0px;
+  padding-top: 15px;
+}
+a.ac_left_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 10px;
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+a.ac_left_sub_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 18px;
+  font-size: 9pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+-->
+</style>
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Caramel/backgroundbanner.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Caramel/backgroundbanner.gif differ
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Caramel/header.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Caramel/header.gif differ
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Caramel/index.html 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Caramel/index.html
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Caramel/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Caramel/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Fuscha/agoratemplate.css 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Fuscha/agoratemplate.css
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Fuscha/agoratemplate.css	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Fuscha/agoratemplate.css	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,128 @@
+<style type="text/css">
+<!--
+.style6 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #BA4EA9;
+}
+a:link {
+	text-decoration: none;
+	color: #BA4EA9;
+}
+a:visited {
+	text-decoration: none;
+	color: #A121A1;
+}
+a:hover {
+	text-decoration: none;
+	color: #A121A1;
+}
+a:active {
+	text-decoration: none;
+	color: #000000;
+}
+.style11 {color: #BA4EA9; font-family: Geneva, Arial, Helvetica, sans-serif; font-weight: bold; }
+.style7 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style12 {color: #BA4EA90}
+.style8 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style14 {font-size: 12px}
+.ac_ppinc_content{
+  background-color: #FFFFFF;
+  vertical-align : top;
+  height : 100%;
+  padding: 0px; 
+  padding-bottom: 25px;
+}
+.template_mainbackground{
+  background-color : #BA4EA9;
+  border-color : #BA4EA9;
+}
+.style14 {font-size: 12px}
+.template_image_no_border{
+  border : none;
+}
+.template_table_image_background{
+  background-image : url(backgroundbanner.gif);
+}
+.template_copyright{
+  background-color : #BA4EA9;
+  text-align: center;
+  font-size: 10pt;
+  color: #FFFFFF;
+}
+a.copyright_link {
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+  color: #FFFF00;
+}
+.template_cartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 9pt;
+  color: #000000;
+}
+.template_checkoutcartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 11pt;
+  color: #000000;
+}
+.template_fonth1{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 17pt;
+  font-weight: bold;
+  color: #FFFFFF;
+}
+.template_fonth2{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 14pt;
+  font-weight: normal;
+  font-style : italic;
+  color: #FFFFFF;
+}
+a.ac_cart_info_links {
+  padding: 0px;
+  padding-right: 5px; 
+  padding-left: 5px;
+  font-size: 11pt;
+  font-weight: bold;
+  text-decoration : none;
+}
+.ac_left_nav{
+  width: 155px;
+  vertical-align : top;
+  padding: 0px;
+  padding-top: 15px;
+}
+a.ac_left_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 10px;
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+a.ac_left_sub_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 18px;
+  font-size: 9pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+-->
+</style>
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Fuscha/backgroundbanner.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Fuscha/backgroundbanner.gif differ
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Fuscha/header.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Fuscha/header.gif differ
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Fuscha/index.html 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Fuscha/index.html
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Fuscha/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Fuscha/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Grayish/agoratemplate.css 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Grayish/agoratemplate.css
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Grayish/agoratemplate.css	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Grayish/agoratemplate.css	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,128 @@
+<style type="text/css">
+<!--
+.style6 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #716D60;
+}
+a:link {
+	text-decoration: none;
+	color: #716D60;
+}
+a:visited {
+	text-decoration: none;
+	color: #000000;
+}
+a:hover {
+	text-decoration: none;
+	color: #000000;
+}
+a:active {
+	text-decoration: none;
+	color: #000000;
+}
+.style11 {color: #716D60; font-family: Geneva, Arial, Helvetica, sans-serif; font-weight: bold; }
+.style7 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style12 {color: #716D60}
+.style8 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style14 {font-size: 12px}
+.ac_ppinc_content{
+  background-color: #FFFFFF;
+  vertical-align : top;
+  height : 100%;
+  padding: 0px; 
+  padding-bottom: 25px;
+}
+.template_mainbackground{
+  background-color : #716D60;
+  border-color : #716D60;
+}
+.style14 {font-size: 12px}
+.template_image_no_border{
+  border : none;
+}
+.template_table_image_background{
+  background-image : url(backgroundbanner.gif);
+}
+.template_copyright{
+  background-color : #716D60;
+  text-align: center;
+  font-size: 10pt;
+  color: #FFFFFF;
+}
+a.copyright_link {
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+  color: #FFFF00;
+}
+.template_cartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 9pt;
+  color: #000000;
+}
+.template_checkoutcartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 11pt;
+  color: #000000;
+}
+.template_fonth1{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 17pt;
+  font-weight: bold;
+  color: #FFFFFF;
+}
+.template_fonth2{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 14pt;
+  font-weight: normal;
+  font-style : italic;
+  color: #FFFFFF;
+}
+a.ac_cart_info_links {
+  padding: 0px;
+  padding-right: 5px; 
+  padding-left: 5px;
+  font-size: 11pt;
+  font-weight: bold;
+  text-decoration : none;
+}
+.ac_left_nav{
+  width: 155px;
+  vertical-align : top;
+  padding: 0px;
+  padding-top: 15px;
+}
+a.ac_left_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 10px;
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+a.ac_left_sub_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 18px;
+  font-size: 9pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+-->
+</style>
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Grayish/backgroundbanner.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Grayish/backgroundbanner.gif differ
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Grayish/header.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Grayish/header.gif differ
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Grayish/index.html 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Grayish/index.html
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Grayish/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Grayish/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Green1/agoratemplate.css 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Green1/agoratemplate.css
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Green1/agoratemplate.css	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Green1/agoratemplate.css	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,128 @@
+<style type="text/css">
+.style6 {
+	font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #299060;
+}
+a:link {
+	color: #299060;
+	text-decoration: none;
+}
+a:visited {
+	text-decoration: none;
+	color: #228959;
+}
+a:hover {
+	text-decoration: none;
+	color: #41A877;
+}
+a:active {
+	text-decoration: none;
+	color: #2E9565;
+}
+.style11 {color: #299060; font-family: Geneva, Arial, Helvetica, sans-serif; font-weight: bold; }
+.style7 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style12 {color: #299060}
+.style8 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style14 {font-size: 12px}
+.ac_ppinc_content{
+  background-color: #FFFFFF;
+  vertical-align : top;
+  height : 100%;
+  padding: 0px; 
+  padding-bottom: 25px;
+}
+.template_mainbackground{
+  background-color : #299060;
+  border-color : #299060;
+}
+.style14 {font-size: 12px}
+.template_image_no_border{
+  border : none;
+}
+.template_table_image_background{
+  background-image : url(backgroundbanner.gif);
+}
+.template_copyright{
+  background-color : #299060;
+  text-align: center;
+  font-size: 10pt;
+  color: #FFFFFF;
+}
+a.copyright_link {
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+  color: #FFFF00;
+}
+.template_cartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 9pt;
+  color: #000000;
+}
+.template_checkoutcartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 11pt;
+  color: #000000;
+}
+.template_fonth1{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 17pt;
+  font-weight: bold;
+  color: #FFFFFF;
+}
+.template_fonth2{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 14pt;
+  font-weight: normal;
+  font-style : italic;
+  color: #FFFFFF;
+}
+a.ac_cart_info_links {
+  padding: 0px;
+  padding-right: 5px; 
+  padding-left: 5px;
+  font-size: 11pt;
+  font-weight: bold;
+  text-decoration : none;
+}
+.ac_left_nav{
+  width: 155px;
+  vertical-align : top;
+  padding: 0px;
+  padding-top: 15px;
+}
+a.ac_left_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 10px;
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+a.ac_left_sub_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 18px;
+  font-size: 9pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+-->
+</style>
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Green1/backgroundbanner.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Green1/backgroundbanner.gif differ
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Green1/header.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Green1/header.gif differ
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Green1/index.html 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Green1/index.html
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Green1/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Green1/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Green2/agoratemplate.css 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Green2/agoratemplate.css
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Green2/agoratemplate.css	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Green2/agoratemplate.css	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,128 @@
+<style type="text/css">
+.style6 {
+	font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #296C18;
+}
+a:link {
+	color: #296C18;
+	text-decoration: none;
+}
+a:visited {
+	text-decoration: none;
+	color: #1A420F;
+}
+a:hover {
+	text-decoration: none;
+	color: #1A420F;
+}
+a:active {
+	text-decoration: none;
+	color: #1A420F;
+}
+.style11 {color: #296C18; font-family: Geneva, Arial, Helvetica, sans-serif; font-weight: bold; }
+.style7 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style12 {color: #296C18}
+.style8 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style14 {font-size: 12px}
+.ac_ppinc_content{
+  background-color: #FFFFFF;
+  vertical-align : top;
+  height : 100%;
+  padding: 0px; 
+  padding-bottom: 25px;
+}
+.template_mainbackground{
+  background-color : #296C18;
+  border-color : #296C18;
+}
+.style14 {font-size: 12px}
+.template_image_no_border{
+  border : none;
+}
+.template_table_image_background{
+  background-image : url(backgroundbanner.gif);
+}
+.template_copyright{
+  background-color : #296C18;
+  text-align: center;
+  font-size: 10pt;
+  color: #FFFFFF;
+}
+a.copyright_link {
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+  color: #FFFF00;
+}
+.template_cartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 9pt;
+  color: #000000;
+}
+.template_checkoutcartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 11pt;
+  color: #000000;
+}
+.template_fonth1{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 17pt;
+  font-weight: bold;
+  color: #FFFFFF;
+}
+.template_fonth2{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 14pt;
+  font-weight: normal;
+  font-style : italic;
+  color: #FFFFFF;
+}
+a.ac_cart_info_links {
+  padding: 0px;
+  padding-right: 5px; 
+  padding-left: 5px;
+  font-size: 11pt;
+  font-weight: bold;
+  text-decoration : none;
+}
+.ac_left_nav{
+  width: 155px;
+  vertical-align : top;
+  padding: 0px;
+  padding-top: 15px;
+}
+a.ac_left_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 10px;
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+a.ac_left_sub_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 18px;
+  font-size: 9pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+-->
+</style>
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Green2/backgroundbanner.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Green2/backgroundbanner.gif differ
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Green2/header.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Green2/header.gif differ
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Green2/index.html 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Green2/index.html
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Green2/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Green2/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_GreenMoney/agoratemplate.css 5.0.000/html/html-templates/templates/TheAgora/TheAgora_GreenMoney/agoratemplate.css
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_GreenMoney/agoratemplate.css	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_GreenMoney/agoratemplate.css	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,128 @@
+<style type="text/css">
+.style6 {
+	font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #4D8B6E;
+}
+a:link {
+	color: #4D8B6E;
+	text-decoration: none;
+}
+a:visited {
+	text-decoration: none;
+	color: #3C7B5D;
+}
+a:hover {
+	text-decoration: none;
+	color: #6DAB8E;
+}
+a:active {
+	text-decoration: none;
+	color: #3C7B5D;
+}
+.style11 {color: #4D8B6E; font-family: Geneva, Arial, Helvetica, sans-serif; font-weight: bold; }
+.style7 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style12 {color: #4D8B6E}
+.style8 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style14 {font-size: 12px}
+.ac_ppinc_content{
+  background-color: #FFFFFF;
+  vertical-align : top;
+  height : 100%;
+  padding: 0px; 
+  padding-bottom: 25px;
+}
+.template_mainbackground{
+  background-color : #4D8B6E;
+  border-color : #4D8B6E;
+}
+.style14 {font-size: 12px}
+.template_image_no_border{
+  border : none;
+}
+.template_table_image_background{
+  background-image : url(backgroundbanner.gif);
+}
+.template_copyright{
+  background-color : #4D8B6E;
+  text-align: center;
+  font-size: 10pt;
+  color: #FFFFFF;
+}
+a.copyright_link {
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+  color: #FFFF00;
+}
+.template_cartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 9pt;
+  color: #000000;
+}
+.template_checkoutcartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 11pt;
+  color: #000000;
+}
+.template_fonth1{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 17pt;
+  font-weight: bold;
+  color: #FFFFFF;
+}
+.template_fonth2{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 14pt;
+  font-weight: normal;
+  font-style : italic;
+  color: #FFFFFF;
+}
+a.ac_cart_info_links {
+  padding: 0px;
+  padding-right: 5px; 
+  padding-left: 5px;
+  font-size: 11pt;
+  font-weight: bold;
+  text-decoration : none;
+}
+.ac_left_nav{
+  width: 155px;
+  vertical-align : top;
+  padding: 0px;
+  padding-top: 15px;
+}
+a.ac_left_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 10px;
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+a.ac_left_sub_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 18px;
+  font-size: 9pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+-->
+</style>
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_GreenMoney/backgroundbanner.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_GreenMoney/backgroundbanner.gif differ
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_GreenMoney/header.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_GreenMoney/header.gif differ
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_GreenMoney/index.html 5.0.000/html/html-templates/templates/TheAgora/TheAgora_GreenMoney/index.html
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_GreenMoney/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_GreenMoney/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_GreenMoss/669900.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_GreenMoss/669900.gif differ
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_GreenMoss/agoratemplate.css 5.0.000/html/html-templates/templates/TheAgora/TheAgora_GreenMoss/agoratemplate.css
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_GreenMoss/agoratemplate.css	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_GreenMoss/agoratemplate.css	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,128 @@
+<style type="text/css">
+.style6 {
+	font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #709018;
+}
+a:link {
+	color: #709018;
+	text-decoration: none;
+}
+a:visited {
+	text-decoration: none;
+	color: #688810;
+}
+a:hover {
+	text-decoration: none;
+	color: #87A62E;
+}
+a:active {
+	text-decoration: none;
+	color: #6A8A12;
+}
+.style11 {color: #709018; font-family: Geneva, Arial, Helvetica, sans-serif; font-weight: bold; }
+.style7 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style12 {color: #709018}
+.style8 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style14 {font-size: 12px}
+.ac_ppinc_content{
+  background-color: #FFFFFF;
+  vertical-align : top;
+  height : 100%;
+  padding: 0px; 
+  padding-bottom: 25px;
+}
+.template_mainbackground{
+  background-color : #709018;
+  border-color : #709018;
+}
+.style14 {font-size: 12px}
+.template_image_no_border{
+  border : none;
+}
+.template_table_image_background{
+  background-image : url(backgroundbanner.gif);
+}
+.template_copyright{
+  background-color : #709018;
+  text-align: center;
+  font-size: 10pt;
+  color: #FFFFFF;
+}
+a.copyright_link {
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+  color: #FFFF00;
+}
+.template_cartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 9pt;
+  color: #000000;
+}
+.template_checkoutcartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 11pt;
+  color: #000000;
+}
+.template_fonth1{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 17pt;
+  font-weight: bold;
+  color: #FFFFFF;
+}
+.template_fonth2{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 14pt;
+  font-weight: normal;
+  font-style : italic;
+  color: #FFFFFF;
+}
+a.ac_cart_info_links {
+  padding: 0px;
+  padding-right: 5px; 
+  padding-left: 5px;
+  font-size: 11pt;
+  font-weight: bold;
+  text-decoration : none;
+}
+.ac_left_nav{
+  width: 155px;
+  vertical-align : top;
+  padding: 0px;
+  padding-top: 15px;
+}
+a.ac_left_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 10px;
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+a.ac_left_sub_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 18px;
+  font-size: 9pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+-->
+</style>
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_GreenMoss/backgroundbanner.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_GreenMoss/backgroundbanner.gif differ
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_GreenMoss/header.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_GreenMoss/header.gif differ
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_GreenMoss/index.html 5.0.000/html/html-templates/templates/TheAgora/TheAgora_GreenMoss/index.html
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_GreenMoss/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_GreenMoss/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Mustard/agoratemplate.css 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Mustard/agoratemplate.css
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Mustard/agoratemplate.css	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Mustard/agoratemplate.css	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,128 @@
+<style type="text/css">
+.style6 {
+	font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #8B7B08;
+}
+a:link {
+	color: #8B7B08;
+	text-decoration: none;
+}
+a:visited {
+	text-decoration: none;
+	color: #C0AE2C;
+}
+a:hover {
+	text-decoration: none;
+	color: #C0AE2C;
+}
+a:active {
+	text-decoration: none;
+	color: #F7DA0C;
+}
+.style11 {color: #C0AE2C; font-family: Geneva, Arial, Helvetica, sans-serif; font-weight: bold; }
+.style7 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style12 {color: #C0AE2C}
+.style8 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style14 {font-size: 12px}
+.ac_ppinc_content{
+  background-color: #FFFFFF;
+  vertical-align : top;
+  height : 100%;
+  padding: 0px; 
+  padding-bottom: 25px;
+}
+.template_mainbackground{
+  background-color : #C0AE2C;
+  border-color : #C0AE2C;
+}
+.style14 {font-size: 12px}
+.template_image_no_border{
+  border : none;
+}
+.template_table_image_background{
+  background-image : url(backgroundbanner.gif);
+}
+.template_copyright{
+  background-color : #C0AE2C;
+  text-align: center;
+  font-size: 10pt;
+  color: #FFFFFF;
+}
+a.copyright_link {
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+  color: #FFFF00;
+}
+.template_cartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 9pt;
+  color: #000000;
+}
+.template_checkoutcartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 11pt;
+  color: #000000;
+}
+.template_fonth1{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 17pt;
+  font-weight: bold;
+  color: #FFFFFF;
+}
+.template_fonth2{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 14pt;
+  font-weight: normal;
+  font-style : italic;
+  color: #FFFFFF;
+}
+a.ac_cart_info_links {
+  padding: 0px;
+  padding-right: 5px; 
+  padding-left: 5px;
+  font-size: 11pt;
+  font-weight: bold;
+  text-decoration : none;
+}
+.ac_left_nav{
+  width: 155px;
+  vertical-align : top;
+  padding: 0px;
+  padding-top: 15px;
+}
+a.ac_left_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 10px;
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+a.ac_left_sub_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 18px;
+  font-size: 9pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+-->
+</style>
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Mustard/backgroundbanner.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Mustard/backgroundbanner.gif differ
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Mustard/header.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Mustard/header.gif differ
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Mustard/index.html 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Mustard/index.html
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Mustard/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Mustard/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Orange2/agoratemplate.css 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Orange2/agoratemplate.css
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Orange2/agoratemplate.css	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Orange2/agoratemplate.css	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,128 @@
+<style type="text/css">
+.style6 {
+	font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #9e491d;
+}
+a:link {
+	color: #9e491d;
+	text-decoration: none;
+}
+a:visited {
+	text-decoration: none;
+	color: #974115;
+}
+a:hover {
+	text-decoration: none;
+	color: #AB552A;
+}
+a:active {
+	text-decoration: none;
+	color: #A65125;
+}
+.style11 {color: #9e491d; font-family: Geneva, Arial, Helvetica, sans-serif; font-weight: bold; }
+.style7 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style12 {color: #9e491d}
+.style8 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style14 {font-size: 12px}
+.ac_ppinc_content{
+  background-color: #FFFFFF;
+  vertical-align : top;
+  height : 100%;
+  padding: 0px; 
+  padding-bottom: 25px;
+}
+.template_mainbackground{
+  background-color : #9e491d;
+  border-color : #9e491d;
+}
+.style14 {font-size: 12px}
+.template_image_no_border{
+  border : none;
+}
+.template_table_image_background{
+  background-image : url(backgroundbanner.gif);
+}
+.template_copyright{
+  background-color : #9e491d;
+  text-align: center;
+  font-size: 10pt;
+  color: #FFFFFF;
+}
+a.copyright_link {
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+  color: #FFFF00;
+}
+.template_cartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 9pt;
+  color: #000000;
+}
+.template_checkoutcartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 11pt;
+  color: #000000;
+}
+.template_fonth1{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 17pt;
+  font-weight: bold;
+  color: #FFFFFF;
+}
+.template_fonth2{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 14pt;
+  font-weight: normal;
+  font-style : italic;
+  color: #FFFFFF;
+}
+a.ac_cart_info_links {
+  padding: 0px;
+  padding-right: 5px; 
+  padding-left: 5px;
+  font-size: 11pt;
+  font-weight: bold;
+  text-decoration : none;
+}
+.ac_left_nav{
+  width: 155px;
+  vertical-align : top;
+  padding: 0px;
+  padding-top: 15px;
+}
+a.ac_left_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 10px;
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+a.ac_left_sub_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 18px;
+  font-size: 9pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+-->
+</style>
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Orange2/backgroundbanner.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Orange2/backgroundbanner.gif differ
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Orange2/header.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Orange2/header.gif differ
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Orange2/index.html 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Orange2/index.html
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Orange2/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Orange2/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_ProBlue/agoratemplate.css 5.0.000/html/html-templates/templates/TheAgora/TheAgora_ProBlue/agoratemplate.css
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_ProBlue/agoratemplate.css	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_ProBlue/agoratemplate.css	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,129 @@
+<style type="text/css">
+<!--
+.style6 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #336699;
+}
+a:link {
+	text-decoration: none;
+	color: #4D6D84;
+	text-decoration: none;
+}
+a:visited {
+	text-decoration: none;
+	color: 113961;
+}
+a:hover {
+	text-decoration: none;
+	color: 113961;
+}
+a:active {
+	text-decoration: none;
+	color: #000000;
+}
+.style11 {color: #4D6D84; font-family: Geneva, Arial, Helvetica, sans-serif; font-weight: bold; }
+.style7 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style12 {color: #4D6D84}
+.style8 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #716D60;
+}
+.style14 {font-size: 12px}
+.ac_ppinc_content{
+  background-color: #FFFFFF;
+  vertical-align : top;
+  height : 100%;
+  padding: 0px; 
+  padding-bottom: 25px;
+}
+.template_mainbackground{
+  background-color : #4D6D84;
+  border-color : #4D6D84;
+}
+.style14 {font-size: 12px}
+.template_image_no_border{
+  border : none;
+}
+.template_table_image_background{
+  background-image : url(backgroundbanner.gif);
+}
+.template_copyright{
+  background-color : #4D6D84;
+  text-align: center;
+  font-size: 10pt;
+  color: #FFFFFF;
+}
+a.copyright_link {
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+  color: #FFFF00;
+}
+.template_cartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 9pt;
+  color: #000000;
+}
+.template_checkoutcartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 11pt;
+  color: #000000;
+}
+.template_fonth1{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 17pt;
+  font-weight: bold;
+  color: #FFFFFF;
+}
+.template_fonth2{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 14pt;
+  font-weight: normal;
+  font-style : italic;
+  color: #FFFFFF;
+}
+a.ac_cart_info_links {
+  padding: 0px;
+  padding-right: 5px; 
+  padding-left: 5px;
+  font-size: 11pt;
+  font-weight: bold;
+  text-decoration : none;
+}
+.ac_left_nav{
+  width: 155px;
+  vertical-align : top;
+  padding: 0px;
+  padding-top: 15px;
+}
+a.ac_left_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 10px;
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+a.ac_left_sub_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 18px;
+  font-size: 9pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+-->
+</style>
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_ProBlue/backgroundbanner.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_ProBlue/backgroundbanner.gif differ
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_ProBlue/header.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_ProBlue/header.gif differ
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_ProBlue/index.html 5.0.000/html/html-templates/templates/TheAgora/TheAgora_ProBlue/index.html
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_ProBlue/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_ProBlue/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Purple1/agoratemplate.css 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Purple1/agoratemplate.css
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Purple1/agoratemplate.css	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Purple1/agoratemplate.css	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,128 @@
+<style type="text/css">
+<!--
+.style6 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #6a1b8d;
+}
+a:link {
+	text-decoration: none;
+	color: #8729B1;
+}
+a:visited {
+	text-decoration: none;
+	color: #6A1B8D;
+}
+a:hover {
+	text-decoration: none;
+	color: #6A1B8D;
+}
+a:active {
+	text-decoration: none;
+	color: #000000;
+}
+.style11 {color: #8729B1; font-family: Geneva, Arial, Helvetica, sans-serif; font-weight: bold; }
+.style7 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style12 {color: #8729B1}
+.style8 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style14 {font-size: 12px}
+.ac_ppinc_content{
+  background-color: #FFFFFF;
+  vertical-align : top;
+  height : 100%;
+  padding: 0px; 
+  padding-bottom: 25px;
+}
+.template_mainbackground{
+  background-color : #8729B1;
+  border-color : #8729B1;
+}
+.style14 {font-size: 12px}
+.template_image_no_border{
+  border : none;
+}
+.template_table_image_background{
+  background-image : url(backgroundbanner.gif);
+}
+.template_copyright{
+  background-color : #8729B1;
+  text-align: center;
+  font-size: 10pt;
+  color: #FFFFFF;
+}
+a.copyright_link {
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+  color: #FFFF00;
+}
+.template_cartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 9pt;
+  color: #000000;
+}
+.template_checkoutcartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 11pt;
+  color: #000000;
+}
+.template_fonth1{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 17pt;
+  font-weight: bold;
+  color: #FFFFFF;
+}
+.template_fonth2{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 14pt;
+  font-weight: normal;
+  font-style : italic;
+  color: #FFFFFF;
+}
+a.ac_cart_info_links {
+  padding: 0px;
+  padding-right: 5px; 
+  padding-left: 5px;
+  font-size: 11pt;
+  font-weight: bold;
+  text-decoration : none;
+}
+.ac_left_nav{
+  width: 155px;
+  vertical-align : top;
+  padding: 0px;
+  padding-top: 15px;
+}
+a.ac_left_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 10px;
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+a.ac_left_sub_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 18px;
+  font-size: 9pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+-->
+</style>
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Purple1/backgroundbanner.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Purple1/backgroundbanner.gif differ
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Purple1/header.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Purple1/header.gif differ
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Purple1/index.html 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Purple1/index.html
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Purple1/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Purple1/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Red2/agoratemplate.css 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Red2/agoratemplate.css
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Red2/agoratemplate.css	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Red2/agoratemplate.css	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,128 @@
+<style type="text/css">
+.style6 {
+	font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #882316;
+}
+a:link {
+	color: #882316;
+	text-decoration: none;
+}
+a:visited {
+	text-decoration: none;
+	color: #974115;
+}
+a:hover {
+	text-decoration: none;
+	color: #AB552A;
+}
+a:active {
+	text-decoration: none;
+	color: #A65125;
+}
+.style11 {color: #882316; font-family: Geneva, Arial, Helvetica, sans-serif; font-weight: bold; }
+.style7 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style12 {color: #882316}
+.style8 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style14 {font-size: 12px}
+.ac_ppinc_content{
+  background-color: #FFFFFF;
+  vertical-align : top;
+  height : 100%;
+  padding: 0px; 
+  padding-bottom: 25px;
+}
+.template_mainbackground{
+  background-color : #882316;
+  border-color : #882316;
+}
+.style14 {font-size: 12px}
+.template_image_no_border{
+  border : none;
+}
+.template_table_image_background{
+  background-image : url(backgroundbanner.gif);
+}
+.template_copyright{
+  background-color : #882316;
+  text-align: center;
+  font-size: 10pt;
+  color: #FFFFFF;
+}
+a.copyright_link {
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+  color: #FFFF00;
+}
+.template_cartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 9pt;
+  color: #000000;
+}
+.template_checkoutcartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 11pt;
+  color: #000000;
+}
+.template_fonth1{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 17pt;
+  font-weight: bold;
+  color: #FFFFFF;
+}
+.template_fonth2{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 14pt;
+  font-weight: normal;
+  font-style : italic;
+  color: #FFFFFF;
+}
+a.ac_cart_info_links {
+  padding: 0px;
+  padding-right: 5px; 
+  padding-left: 5px;
+  font-size: 11pt;
+  font-weight: bold;
+  text-decoration : none;
+}
+.ac_left_nav{
+  width: 155px;
+  vertical-align : top;
+  padding: 0px;
+  padding-top: 15px;
+}
+a.ac_left_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 10px;
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+a.ac_left_sub_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 18px;
+  font-size: 9pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+-->
+</style>
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Red2/backgroundbanner.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Red2/backgroundbanner.gif differ
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Red2/header.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Red2/header.gif differ
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Red2/index.html 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Red2/index.html
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_Red2/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_Red2/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_RedDark/agoratemplate.css 5.0.000/html/html-templates/templates/TheAgora/TheAgora_RedDark/agoratemplate.css
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_RedDark/agoratemplate.css	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_RedDark/agoratemplate.css	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,128 @@
+<style type="text/css">
+.style6 {
+	font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #712518;
+}
+a:link {
+	color: #712518;
+	text-decoration: none;
+}
+a:visited {
+	text-decoration: none;
+	color: #5B1E13;
+}
+a:hover {
+	text-decoration: none;
+	color: #5B1E13;
+}
+a:active {
+	text-decoration: none;
+	color: #5B1E13;
+}
+.style11 {color: #712518; font-family: Geneva, Arial, Helvetica, sans-serif; font-weight: bold; }
+.style7 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style12 {color: #712518}
+.style8 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style14 {font-size: 12px}
+.ac_ppinc_content{
+  background-color: #FFFFFF;
+  vertical-align : top;
+  height : 100%;
+  padding: 0px; 
+  padding-bottom: 25px;
+}
+.template_mainbackground{
+  background-color : #712518;
+  border-color : #712518;
+}
+.style14 {font-size: 12px}
+.template_image_no_border{
+  border : none;
+}
+.template_table_image_background{
+  background-image : url(backgroundbanner.gif);
+}
+.template_copyright{
+  background-color : #712518;
+  text-align: center;
+  font-size: 10pt;
+  color: #FFFFFF;
+}
+a.copyright_link {
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+  color: #FFFF00;
+}
+.template_cartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 9pt;
+  color: #000000;
+}
+.template_checkoutcartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 11pt;
+  color: #000000;
+}
+.template_fonth1{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 17pt;
+  font-weight: bold;
+  color: #FFFFFF;
+}
+.template_fonth2{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 14pt;
+  font-weight: normal;
+  font-style : italic;
+  color: #FFFFFF;
+}
+a.ac_cart_info_links {
+  padding: 0px;
+  padding-right: 5px; 
+  padding-left: 5px;
+  font-size: 11pt;
+  font-weight: bold;
+  text-decoration : none;
+}
+.ac_left_nav{
+  width: 155px;
+  vertical-align : top;
+  padding: 0px;
+  padding-top: 15px;
+}
+a.ac_left_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 10px;
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+a.ac_left_sub_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 18px;
+  font-size: 9pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+-->
+</style>
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_RedDark/backgroundbanner.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_RedDark/backgroundbanner.gif differ
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_RedDark/header.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_RedDark/header.gif differ
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_RedDark/index.html 5.0.000/html/html-templates/templates/TheAgora/TheAgora_RedDark/index.html
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_RedDark/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_RedDark/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_TurquoiseLight/agoratemplate.css 5.0.000/html/html-templates/templates/TheAgora/TheAgora_TurquoiseLight/agoratemplate.css
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_TurquoiseLight/agoratemplate.css	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_TurquoiseLight/agoratemplate.css	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,128 @@
+<style type="text/css">
+.style6 {
+	font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #336258;
+}
+a:link {
+	color: #336258;
+	text-decoration: none;
+}
+a:visited {
+	text-decoration: none;
+	color: #70B4A7;
+}
+a:hover {
+	text-decoration: none;
+	color: #70B4A7;
+}
+a:active {
+	text-decoration: none;
+	color: #70B4A7;
+}
+.style11 {color: #336258; font-family: Geneva, Arial, Helvetica, sans-serif; font-weight: bold; }
+.style7 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style12 {color: #70B4A7}
+.style8 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style14 {font-size: 12px}
+.ac_ppinc_content{
+  background-color: #FFFFFF;
+  vertical-align : top;
+  height : 100%;
+  padding: 0px; 
+  padding-bottom: 25px;
+}
+.template_mainbackground{
+  background-color : #70B4A7;
+  border-color : #70B4A7;
+}
+.style14 {font-size: 12px}
+.template_image_no_border{
+  border : none;
+}
+.template_table_image_background{
+  background-image : url(backgroundbanner.gif);
+}
+.template_copyright{
+  background-color : #70B4A7;
+  text-align: center;
+  font-size: 10pt;
+  color: #FFFFFF;
+}
+a.copyright_link {
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+  color: #FFFF00;
+}
+.template_cartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 9pt;
+  color: #000000;
+}
+.template_checkoutcartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 11pt;
+  color: #000000;
+}
+.template_fonth1{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 17pt;
+  font-weight: bold;
+  color: #FFFFFF;
+}
+.template_fonth2{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 14pt;
+  font-weight: normal;
+  font-style : italic;
+  color: #FFFFFF;
+}
+a.ac_cart_info_links {
+  padding: 0px;
+  padding-right: 5px; 
+  padding-left: 5px;
+  font-size: 11pt;
+  font-weight: bold;
+  text-decoration : none;
+}
+.ac_left_nav{
+  width: 155px;
+  vertical-align : top;
+  padding: 0px;
+  padding-top: 15px;
+}
+a.ac_left_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 10px;
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+a.ac_left_sub_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 18px;
+  font-size: 9pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+-->
+</style>
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_TurquoiseLight/backgroundbanner.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_TurquoiseLight/backgroundbanner.gif differ
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_TurquoiseLight/header.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_TurquoiseLight/header.gif differ
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_TurquoiseLight/index.html 5.0.000/html/html-templates/templates/TheAgora/TheAgora_TurquoiseLight/index.html
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_TurquoiseLight/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_TurquoiseLight/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_VioletLight/agoratemplate.css 5.0.000/html/html-templates/templates/TheAgora/TheAgora_VioletLight/agoratemplate.css
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_VioletLight/agoratemplate.css	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_VioletLight/agoratemplate.css	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,128 @@
+<style type="text/css">
+.style6 {
+	font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #9590CB;
+}
+a:link {
+	color: #9590CB;
+	text-decoration: none;
+}
+a:visited {
+	text-decoration: none;
+	color: #6761B4;
+}
+a:hover {
+	text-decoration: none;
+	color: #6761B4;
+}
+a:active {
+	text-decoration: none;
+	color: #9590CB;
+}
+.style11 {color: #9590CB; font-family: Geneva, Arial, Helvetica, sans-serif; font-weight: bold; }
+.style7 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style12 {color: #9590CB}
+.style8 {font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	color: #FFFFFF;
+}
+.style14 {font-size: 12px}
+.ac_ppinc_content{
+  background-color: #FFFFFF;
+  vertical-align : top;
+  height : 100%;
+  padding: 0px; 
+  padding-bottom: 25px;
+}
+.template_mainbackground{
+  background-color : #9590CB;
+  border-color : #9590CB;
+}
+.style14 {font-size: 12px}
+.template_image_no_border{
+  border : none;
+}
+.template_table_image_background{
+  background-image : url(backgroundbanner.gif);
+}
+.template_copyright{
+  background-color : #9590CB;
+  text-align: center;
+  font-size: 10pt;
+  color: #FFFFFF;
+}
+a.copyright_link {
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+  color: #FFFF00;
+}
+.template_cartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 9pt;
+  color: #000000;
+}
+.template_checkoutcartcontents{
+  background-color : #FFFFFF;
+  text-align: center;
+  font-size: 11pt;
+  color: #000000;
+}
+.template_fonth1{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 17pt;
+  font-weight: bold;
+  color: #FFFFFF;
+}
+.template_fonth2{
+  padding: 0px;
+  padding-right: 0px; 
+  padding-left: 0px;
+  font-family: Geneva, Arial, Helvetica, sans-serif;
+  font-size: 14pt;
+  font-weight: normal;
+  font-style : italic;
+  color: #FFFFFF;
+}
+a.ac_cart_info_links {
+  padding: 0px;
+  padding-right: 5px; 
+  padding-left: 5px;
+  font-size: 11pt;
+  font-weight: bold;
+  text-decoration : none;
+}
+.ac_left_nav{
+  width: 155px;
+  vertical-align : top;
+  padding: 0px;
+  padding-top: 15px;
+}
+a.ac_left_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 10px;
+  font-size: 10pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+a.ac_left_sub_links {
+  text-align: left;
+  padding: 0px;
+  padding-right: 3px; 
+  padding-left: 18px;
+  font-size: 9pt;
+  font-weight: normal;
+  text-decoration : none;
+}
+-->
+</style>
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_VioletLight/backgroundbanner.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_VioletLight/backgroundbanner.gif differ
Binary files 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_VioletLight/header.gif and 5.0.000/html/html-templates/templates/TheAgora/TheAgora_VioletLight/header.gif differ
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_VioletLight/index.html 5.0.000/html/html-templates/templates/TheAgora/TheAgora_VioletLight/index.html
--- 4.0K-4b/html/html-templates/templates/TheAgora/TheAgora_VioletLight/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/TheAgora_VioletLight/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/index.html 5.0.000/html/html-templates/templates/TheAgora/index.html
--- 4.0K-4b/html/html-templates/templates/TheAgora/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/secure_store_footer.html 5.0.000/html/html-templates/templates/TheAgora/secure_store_footer.html
--- 4.0K-4b/html/html-templates/templates/TheAgora/secure_store_footer.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/secure_store_footer.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,128 @@
+
+
+
+<!-- Begin Footer -->
+</td>
+          </tr>
+        </table></td>
+		<td width="175" valign="top" bgcolor="#FFFFFF">			
+		  <br>
+<table width="160" border="0" align="center" cellpadding="3" cellspacing="1" class="template_mainbackground">
+          <tr>
+            <td  class="template_mainbackground"><span class="style7">Your Cart</span></td>
+          </tr>
+          <tr>
+            <td class="template_cartcontents"><div align="center"><span class="style6"> </span>   <!--agorascript-pre {
+local (@my_cart_fields,$my_cart_row_number,$result);
+local ($count,$price,$product_id,$quantity,$total_cost,$total_qty)=0;
+if ((!(-f "$sc_cart_path"))||($sc_processing_order =~ /yes/i)) {return "<br>Items in your cart: 0<br><br>"}
+open (CART, "$sc_cart_path") || &file_open_error("$sc_cart_path",
+ "display_cart_contents_in_header", __FILE__, __LINE__);
+ while (<CART>)
+  {
+   $count++;
+   chop;    
+   @my_cart_fields = split (/\|/, $_);
+   $my_cart_row_number = pop(@my_cart_fields);
+   push (@my_cart_fields, $my_cart_row_number);
+   $quantity = $my_cart_fields[0];
+   $product_id = $my_cart_fields[1];
+   $price = $my_cart_fields[$sc_cart_index_of_price_after_options]; 
+   $total_cost = $total_cost + $quantity * $price;
+   $total_qty = $total_qty + $quantity;
+  } # End of while (<CART>)
+close (CART);
+if ($count > 0) {
+  $result = '<table><tr><td class="template_cartcontents">' .
+      "Items in your cart: <font color=red>$total_qty</font>\n" . 
+      "<br/>Subtotal:&nbsp;<font color=red>" . &display_price($total_cost) . 
+      '</font><br><br></td></tr><tr><td class="template_checkoutcartcontents">' .
+      "<a href=\"$sc_store_url?dc=1&amp;%%href_fields%%" . 
+      '">View Cart Details</a><br>' .
+      '<a href="%%StepOneURL%%?order_form_button.x=1&amp;%%href_fields%%' . 
+      '">Check Out</a></td>' .
+      "</tr></table>";
+ } else {
+  $result = "";
+ }
+ return $result;
+}--></div></td>
+
+
+
+
+
+
+          </tr>
+        </table>
+		<p></p>
+
+<!--agorascript-pre {
+&capture_STDOUT;
+
+# start display New Products
+if ($sc_displayNewProducts =~ /yes/i){ 
+print qq~
+<table width="160" border="0" align="center" cellpadding="3" cellspacing="1" class="template_mainbackground">
+          <tr>
+            <td  class="template_mainbackground"><span class="style7">New Products</span></td>
+          </tr>
+          <tr>
+            <td class="template_cartcontents"><div align="left"><span class="style6"> </span>   
+<br>$sc_tenNewProducts<br><br>
+</div></td>
+
+          </tr>
+        </table><br>
+~;
+}
+# end display New Products
+
+# start display Featured Product
+if ($sc_displayFeaturedProducts =~ /yes/i){ 
+print qq~
+<table width="160" border="0" align="center" cellpadding="3" cellspacing="1" class="template_mainbackground">
+          <tr>
+            <td  class="template_mainbackground"><span class="style7">Featured Product</span></td>
+          </tr>
+          <tr>
+            <td class="template_cartcontents"><div align="left"><span class="style6"> </span>   
+<br>$sc_featuredProduct_secure<br><br>
+</div></td>
+
+          </tr>
+        </table><br>
+~;
+}
+# end display Featured Product
+
+#display Top Sellers
+if ($sc_displayTopSellers =~ /yes/i){ 
+print qq~
+<table width="160" border="0" align="center" cellpadding="3" cellspacing="1" class="template_mainbackground">
+          <tr>
+            <td  class="template_mainbackground"><span class="style7">Best Sellers</span></td>
+          </tr>
+          <tr>
+            <td class="template_cartcontents"><div align="left"><span class="style6"> </span>   
+<br>$sc_tenBestSellers<br><br>
+</div></td>
+
+          </tr>
+        </table>
+~;
+}
+&uncapture_STDOUT;
+}
+# end of display Top Sellers
+-->
+<br/>
+      </td>
+	</tr>
+	<tr class="template_copyright">
+	  <td height="24" colspan="3" class="template_copyright"><center>
+	Copyright 1999 to Present by K-Factor Technologies Inc. at <a href="http://www.agoracart.com" class="copyright_link">AgoraCart.com</a> and <a href="http://www.K-Factor.net" class="copyright_link">K-Factor.net</a></center>
+ 	</td>
+  </tr>
+</table>
+<!-- Footer Ends -->
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/secure_store_header.html 5.0.000/html/html-templates/templates/TheAgora/secure_store_header.html
--- 4.0K-4b/html/html-templates/templates/TheAgora/secure_store_header.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/secure_store_header.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,176 @@
+<!--BEGIN HEADER TABLE-->
+
+<table id="Table_01" width="100%" border="0" cellpadding="0" cellspacing="1" class=template_mainbackground>
+		<tr>
+		  <td height="73" colspan="3">
+<!--<table width="100%" border="0" cellpadding="0" cellspacing="0" class="template_table_image_background"><tr><td width=390 height="73">-->
+<table width="100%" border="0" cellpadding="0" cellspacing="0" class="template_mainbackground"><tr><td width=390 height="73">
+<!--agorascript-pre 
+&capture_STDOUT;
+if ($sc_self_serve_images =~ /yes/i) {
+    print qq~<img src="%%URLofImages%%../html-templates/templates/$sc_headerTemplateName/header.gif" height="73" alt="Agora Cart" width=390>~;
+} else {
+    my $temp_SSL = $sc_ssl_location_url2;
+    $temp_SSL =~ s/agora\.cgi//i;
+    print qq~<img src="$temp_SSL/html/html-templates/templates/$sc_headerTemplateName/header.gif" height="73" alt="Agora Cart" width=390>~;
+}
+&uncapture_STDOUT;  -->
+		  </td>
+		  <td align=center>
+
+<!--agorascript-pre 
+&capture_STDOUT; 
+print qq~<font class="template_fonth1"><b>$sc_headerStoreTitle</b></font>~;
+print qq~<font class="template_fonth2"><br>$sc_headerStoreTagLine</font>~;
+&uncapture_STDOUT;  -->
+
+</td>
+</tr></table></td>
+  </tr>
+	<tr>
+	  <td height="35" colspan="3" bgcolor="#FFFFFF">
+		<span class="style6">&nbsp;&nbsp;&nbsp;&nbsp;
+
+<!--START Dynamic Links - cartlinks-->
+<!-- .html and .htm pages in the html directory of your store, compiled in real time.  Add/Remove/Rename pages in your store's html directory to alter these links-->
+<!--agorascript-pre 
+
+&capture_STDOUT; 
+&cartlinks;
+$cartlinks =~ s/<ul>\n//ig;
+$cartlinks =~ s/<li>//i;
+$cartlinks =~ s/<li>/ \| /ig;
+$cartlinks =~ s/<\/li>\n//ig;
+$cartlinks =~ s/<\/ul>//ig;
+print $cartlinks;
+&uncapture_STDOUT;  -->
+
+<!--START Dynamic Links - cartlinks-->
+
+
+
+
+		</span>	  </td>
+	</tr>
+	<tr>
+	  <td width="175" valign="top" bgcolor="#FFFFFF">
+
+
+
+<!--START Search Box-->
+    <form method="post" action="$sc_store_url">
+        <div align="center"><span class="style14"><br>
+    Search: </span>
+      <input type="hidden" name="cart_id" value="%%cart_id%%">
+      <input type="text" name="keywords" size="10" maxlength="40">
+      <input type="hidden" name="ppinc" value="search">
+      <input type="submit" name="search_request_button" value="Go">
+            <br><br>
+	    </div>
+	    </form>
+<!--END Search Box-->
+
+
+
+<!--START Category Listings-->
+
+<!--agorascript-pre { # code to list categories and/or sub categories
+# updated for AgoraCart 5.x by Mister Ed Jan 11, 2005
+# updated to fit CSS mods by Eric Welin Feb 02, 2005
+if ($sc_displayDynamicCategories =~ /yes/i) {
+local($sku,$category,$subcategory);
+my ($catnumber,$catnumber2)= '';
+local(%db_ele,%subcatarray)= ();
+if (!($sc_db_lib_was_loaded =~ /yes/i)){ 
+  &require_supporting_libraries (__FILE__, __LINE__, "$sc_db_lib_path"); 
+}
+&capture_STDOUT;
+	    print qq~<table width="160" border="0" align="center" cellpadding="3" cellspacing="1" class="template_mainbackground">
+        <tr>
+          <td class="template_mainbackground"><span class="style6"><span class="style7">Categories</span></span></td>
+        </tr>
+        <tr>
+          <td bgcolor="#FFFFFF"><div align="left"><span class="style6"> </span><br>
+~;
+if ($sc_use_database_subcats =~ /yes/i) {
+  &get_prod_db_element($db{"product"},*db_ele);
+  foreach $sku (sort (keys %db_ele)) {
+    $catnumber = "";
+    $category = $db_ele{$sku};
+    %subcatarray = %{$db_ele{$category}};
+    $category2 = $category;
+    $category2=~s/ /%20/g;
+    if ($sc_count_database_cats =~ /yes/i) {
+      $catnumber = "(" . $db_ele2{$category} . ")";
+    }
+    print qq~\n&bull;<a href="$sc_store_url?cart_id=%%cart_id%%&amp;product=$category2" class="ac_left_links" title="$category">$category</a> $catnumber<br>~;
+    foreach $subcategoryarray (sort(keys %subcatarray)) {
+      $category3 = $subcategoryarray;
+#      $category3=~s/ /%20/g;
+      if ($sc_count_database_cats =~ /yes/i) {
+        $catnumber2 = "(" . $db_ele{$category}->{$subcategoryarray} . ")";
+      }
+      print qq~\n&nbsp;&nbsp;<a href="$sc_store_url?cart_id=%%cart_id%%&amp;product=$category2&amp;$sc_subcat_index_field=$category3" class="ac_left_sub_links" title="$category3">$category3</a> $catnumber2<br>~;
+    }
+  }
+} else { 
+  &get_prod_db_element($db{"product"},*db_ele);
+  foreach $sku (keys %db_ele) {
+    $category = $db_ele{$sku};
+    $category_list{$category}++;
+  }
+  foreach $category (sort(keys %category_list)) {
+    $category2 = $category;
+    $category2=~s/_/ /g;
+    print qq~\n&bull; <a href="$sc_store_url?cart_id=%%cart_id%%&amp;product=$category" class="ac_left_links" title="$category2">$category2</a><br>~;
+  }
+}
+print "\n";
+	    print qq~
+</div><br></td>
+        </tr>
+      </table>
+	    <br>
+~;
+&uncapture_STDOUT; }
+}
+-->
+
+<!--END Category Listings-->
+
+
+
+
+
+<!--START Price Search-->
+        <table width="160" border="0" align="center" cellpadding="3" cellspacing="1" class="template_mainbackground">
+          <tr>
+            <td  class="template_mainbackground"><span class="style6"><span class="style7">Search by Price</span></span></td>
+          </tr>
+          <tr>
+            <td bgcolor="#FFFFFF"><div align="center"><br><form method="post" action="$sc_store_url">
+<span class="style6">Search Between:<br/><br/> <input type="hidden" name="cart_id" value="%%cart_id%%">
+%%sc_money_symbol%% <input type="text" name="query_price_low_range" size="5" maxlength="10">
+<small> & </small>
+<input type="text" name="query_price_high_range" size="5" maxlength="10"><br><br>
+        <input type="hidden" name="ppinc" value="search">
+        <input type="submit" name="search_request_button" value=" Search ">
+    </span></form>
+<br><br></div></td>
+          </tr>
+        </table>
+        <br>
+<!--END Price Search-->
+
+      <p></p></td>
+		<td valign="top" class="ac_ppinc_content"><table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
+          <tr>
+ 
+  <td class="ac_content">
+
+<!--END HEADER TABLE-->
+
+
+
+
+
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/store_footer.html 5.0.000/html/html-templates/templates/TheAgora/store_footer.html
--- 4.0K-4b/html/html-templates/templates/TheAgora/store_footer.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/store_footer.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,132 @@
+
+
+
+<!-- Begin Footer -->
+</td>
+          </tr>
+        </table></td>
+		<td width="175" valign="top" bgcolor="#FFFFFF">			
+		  <br>
+<table width="160" border="0" align="center" cellpadding="3" cellspacing="1" class="template_mainbackground">
+          <tr>
+            <td  class="template_mainbackground"><span class="style7">Your Cart</span></td>
+          </tr>
+          <tr>
+            <td class="template_cartcontents"><div align="center"><span class="style6"> </span>   <!--agorascript-pre {
+local (@my_cart_fields,$my_cart_row_number,$result);
+local ($count,$price,$product_id,$quantity,$total_cost,$total_qty)=0;
+if ((!(-f "$sc_cart_path"))||($sc_processing_order =~ /yes/i)) {return "<br>Items in your cart: 0<br><br>"}
+open (CART, "$sc_cart_path") || &file_open_error("$sc_cart_path",
+ "display_cart_contents_in_header", __FILE__, __LINE__);
+ while (<CART>)
+  {
+   $count++;
+   chop;    
+   @my_cart_fields = split (/\|/, $_);
+   $my_cart_row_number = pop(@my_cart_fields);
+   push (@my_cart_fields, $my_cart_row_number);
+   $quantity = $my_cart_fields[0];
+   $product_id = $my_cart_fields[1];
+   $price = $my_cart_fields[$sc_cart_index_of_price_after_options]; 
+   $total_cost = $total_cost + $quantity * $price;
+   $total_qty = $total_qty + $quantity;
+  } # End of while (<CART>)
+close (CART);
+if ($count > 0) {
+  $result = '<table><tr><td class="template_cartcontents">' .
+      "Items in your cart: <font color=red>$total_qty</font>\n" . 
+      "<br/>Subtotal:&nbsp;<font color=red>" . &display_price($total_cost) . 
+      '</font><br><br></td></tr><tr><td class="template_checkoutcartcontents">' .
+      "<a href=\"$sc_store_url?dc=1&amp;%%href_fields%%" . 
+      '">View Cart Details</a><br>' .
+      '<a href="%%StepOneURL%%?order_form_button.x=1&amp;%%href_fields%%' . 
+      '">Check Out</a></td>' .
+      "</tr></table>";
+ } else {
+  $result = '<table><tr><td class="template_cartcontents">' .
+      "Items in your cart: <font color=red>0</font>\n" . 
+      "<br/>Subtotal:&nbsp;<font color=red>" . &display_price("0.00") . 
+      '</font><br></td>' .
+      "</tr></table>";
+ }
+ return $result;
+}--></div></td>
+
+
+
+
+
+
+          </tr>
+        </table>
+		<p></p>
+
+<!--agorascript-pre {
+&capture_STDOUT;
+
+# start display New Products
+if ($sc_displayNewProducts =~ /yes/i){ 
+print qq~
+<table width="160" border="0" align="center" cellpadding="3" cellspacing="1" class="template_mainbackground">
+          <tr>
+            <td  class="template_mainbackground"><span class="style7">New Products</span></td>
+          </tr>
+          <tr>
+            <td class="template_cartcontents"><div align="left"><span class="style6"> </span>   
+<br>$sc_tenNewProducts<br><br>
+</div></td>
+
+          </tr>
+        </table><br>
+~;
+}
+# end display New Products
+
+# start display Featured Product
+if ($sc_displayFeaturedProducts =~ /yes/i){ 
+print qq~
+<table width="160" border="0" align="center" cellpadding="3" cellspacing="1" class="template_mainbackground">
+          <tr>
+            <td  class="template_mainbackground"><span class="style7">Featured Product</span></td>
+          </tr>
+          <tr>
+            <td class="template_cartcontents"><div align="left"><span class="style6"> </span>   
+<br>$sc_featuredProduct<br><br>
+</div></td>
+
+          </tr>
+        </table><br>
+~;
+}
+# end display Featured Product
+
+#display Top Sellers
+if ($sc_displayTopSellers =~ /yes/i){ 
+print qq~
+<table width="160" border="0" align="center" cellpadding="3" cellspacing="1" class="template_mainbackground">
+          <tr>
+            <td  class="template_mainbackground"><span class="style7">Best Sellers</span></td>
+          </tr>
+          <tr>
+            <td class="template_cartcontents"><div align="left"><span class="style6"> </span>   
+<br>$sc_tenBestSellers<br><br>
+</div></td>
+
+          </tr>
+        </table>
+~;
+}
+&uncapture_STDOUT;
+}
+# end of display Top Sellers
+-->
+<br/>
+      </td>
+	</tr>
+	<tr class="template_copyright">
+	  <td height="24" colspan="3" class="template_copyright"><center>
+	Copyright 1999 to Present by K-Factor Technologies Inc. at <a href="http://www.agoracart.com" class="copyright_link">AgoraCart.com</a> and <a href="http://www.K-Factor.net" class="copyright_link">K-Factor.net</a></center>
+ 	</td>
+  </tr>
+</table>
+<!-- Footer Ends -->
diff -ruN 4.0K-4b/html/html-templates/templates/TheAgora/store_header.html 5.0.000/html/html-templates/templates/TheAgora/store_header.html
--- 4.0K-4b/html/html-templates/templates/TheAgora/store_header.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/TheAgora/store_header.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,179 @@
+<!--BEGIN HEADER TABLE-->
+
+<table id="Table_01" width="100%" border="0" cellpadding="0" cellspacing="1" class=template_mainbackground>
+		<tr>
+		  <td height="73" colspan="3">
+<!--<table width="100%" border="0" cellpadding="0" cellspacing="0" class="template_table_image_background"><tr><td width=390 height="73">-->
+<table width="100%" border="0" cellpadding="0" cellspacing="0" class="template_mainbackground"><tr><td width=390 height="73">
+<!--agorascript-pre 
+&capture_STDOUT;
+if ($sc_self_serve_images =~ /yes/i) {
+    print qq~<img src="%%URLofImages%%../html-templates/templates/$sc_headerTemplateName/header.gif" height="73" alt="Agora Cart" width=390>~;
+} else {
+    print qq~<img src="html/html-templates/templates/$sc_headerTemplateName/header.gif" height="73" alt="Agora Cart" width=390>~;
+}
+&uncapture_STDOUT;  -->
+		  </td>
+		  <td align=center>
+
+<!--agorascript-pre 
+&capture_STDOUT; 
+print qq~<font class="template_fonth1"><b>$sc_headerStoreTitle</b></font>~;
+print qq~<font class="template_fonth2"><br>$sc_headerStoreTagLine</font>~;
+&uncapture_STDOUT;  -->
+
+</td>
+</tr></table></td>
+  </tr>
+	<tr>
+	  <td height="35" colspan="3" bgcolor="#FFFFFF">
+		<span class="style6">&nbsp;&nbsp;&nbsp;&nbsp;
+
+<!--START Dynamic Links - cartlinks-->
+<!-- .html and .htm pages in the html directory of your store, compiled in real time.  Add/Remove/Rename pages in your store's html directory to alter these links-->
+<!--agorascript-pre 
+
+&capture_STDOUT; 
+&cartlinks;
+$cartlinks =~ s/<ul>\n//ig;
+$cartlinks =~ s/<li>//i;
+$cartlinks =~ s/<li>/ \| /ig;
+$cartlinks =~ s/<\/li>\n//ig;
+$cartlinks =~ s/<\/ul>//ig;
+print $cartlinks;
+&uncapture_STDOUT;  -->
+
+<!--START Dynamic Links - cartlinks-->
+
+
+
+
+		</span>	  </td>
+	</tr>
+	<tr>
+	  <td width="175" valign="top" bgcolor="#FFFFFF">
+
+
+
+<!--START Search Box-->
+    <form method="post" action="agora.cgi">
+        <div align="center"><span class="style14"><br>
+    Search: </span>
+      <input type="hidden" name="cart_id" value="%%cart_id%%">
+      <input type="text" name="keywords" size="10" maxlength="40">
+      <input type="hidden" name="ppinc" value="search">
+      <input type="submit" name="search_request_button" value="Go">
+            <br><br>
+	    </div>
+	    </form>
+<!--END Search Box-->
+
+
+
+<!--START Category Listings-->
+
+<!--agorascript-pre { # code to list categories and/or sub categories
+# updated for AgoraCart 5.x by Mister Ed Jan 11, 2005
+# updated to fit CSS mods by Eric Welin Feb 02, 2005
+if ($sc_displayDynamicCategories =~ /yes/i) {
+local($sku,$category,$subcategory);
+my ($catnumber,$catnumber2)= '';
+local(%db_ele,%subcatarray)= ();
+if (!($sc_db_lib_was_loaded =~ /yes/i)){ 
+  &require_supporting_libraries (__FILE__, __LINE__, "$sc_db_lib_path"); 
+}
+&capture_STDOUT;
+	    print qq~<table width="160" border="0" align="center" cellpadding="3" cellspacing="1" class="template_mainbackground">
+        <tr>
+          <td class="template_mainbackground"><span class="style6"><span class="style7">Categories</span></span></td>
+        </tr>
+        <tr>
+          <td bgcolor="#FFFFFF"><div align="left"><span class="style6"> </span><br>
+~;
+if ($sc_use_database_subcats =~ /yes/i) {
+  &get_prod_db_element($db{"product"},*db_ele);
+  foreach $sku (sort (keys %db_ele)) {
+    $catnumber = "";
+    $category = $db_ele{$sku};
+    %subcatarray = %{$db_ele{$category}};
+    $category2 = $category;
+    $category2=~s/ /%20/g;
+    if ($sc_count_database_cats =~ /yes/i) {
+      $catnumber = "(" . $db_ele2{$category} . ")";
+    }
+    print qq~\n&bull;<a href="agora.cgi?cart_id=%%cart_id%%&amp;product=$category2" class="ac_left_links" title="$category">$category</a> $catnumber<br>~;
+    foreach $subcategoryarray (sort(keys %subcatarray)) {
+      $category3 = $subcategoryarray;
+#      $category3=~s/ /%20/g;
+      if ($sc_count_database_cats =~ /yes/i) {
+        $catnumber2 = "(" . $db_ele{$category}->{$subcategoryarray} . ")";
+      }
+      print qq~\n&nbsp;&nbsp;<a href="agora.cgi?cart_id=%%cart_id%%&amp;product=$category2&amp;$sc_subcat_index_field=$category3" class="ac_left_sub_links" title="$category3">$category3</a> $catnumber2<br>~;
+    }
+  }
+} else { 
+  &get_prod_db_element($db{"product"},*db_ele);
+  foreach $sku (keys %db_ele) {
+    $category = $db_ele{$sku};
+    $category_list{$category}++;
+  }
+  foreach $category (sort(keys %category_list)) {
+    $category2 = $category;
+    $category2=~s/_/ /g;
+    print qq~\n&bull; <a href="agora.cgi?cart_id=%%cart_id%%&amp;product=$category" class="ac_left_links" title="$category2">$category2</a><br>~;
+  }
+}
+print "\n";
+	    print qq~
+</div><br></td>
+        </tr>
+      </table>
+	    <br>
+~;
+&uncapture_STDOUT; }
+}
+-->
+
+<!--END Category Listings-->
+
+
+
+
+
+<!--START Price Search-->
+        <table width="160" border="0" align="center" cellpadding="3" cellspacing="1" class="template_mainbackground">
+          <tr>
+            <td  class="template_mainbackground"><span class="style6"><span class="style7">Search by Price</span></span></td>
+          </tr>
+          <tr>
+            <td bgcolor="#FFFFFF"><div align="center"><br><form method="post" action="agora.cgi">
+<span class="style6">Search Between:<br/><br/> <input type="hidden" name="cart_id" value="%%cart_id%%">
+%%sc_money_symbol%% <input type="text" name="query_price_low_range" size="5" maxlength="10">
+<small> & </small>
+<input type="text" name="query_price_high_range" size="5" maxlength="10"><br><br>
+        <input type="hidden" name="ppinc" value="search">
+        <input type="submit" name="search_request_button" value=" Search ">
+    </span></form>
+<br><br></div></td>
+          </tr>
+        </table>
+        <br>
+<!--END Price Search-->
+
+   <div id="ac_html_validator">
+      <a href="http://validator.w3.org/check?uri=referer" target="_new">
+        <img src="%%URLofImages%%/valid-html401.png"
+          alt="Valid HTML 4.01!" height="31" width="88"></a><br><br>
+    </div>
+      <p></p></td>
+		<td valign="top" class="ac_ppinc_content"><table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
+          <tr>
+ 
+  <td class="ac_content">
+
+<!--END HEADER TABLE-->
+
+
+
+
+
diff -ruN 4.0K-4b/html/html-templates/templates/index.html 5.0.000/html/html-templates/templates/index.html
--- 4.0K-4b/html/html-templates/templates/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/html-templates/templates/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/0002.gif and 5.0.000/html/images/0002.gif differ
Binary files 4.0K-4b/html/images/0003.gif and 5.0.000/html/images/0003.gif differ
Binary files 4.0K-4b/html/images/0004.gif and 5.0.000/html/images/0004.gif differ
Binary files 4.0K-4b/html/images/0005.gif and 5.0.000/html/images/0005.gif differ
Binary files 4.0K-4b/html/images/0011.gif and 5.0.000/html/images/0011.gif differ
Binary files 4.0K-4b/html/images/0012.gif and 5.0.000/html/images/0012.gif differ
Binary files 4.0K-4b/html/images/0015.gif and 5.0.000/html/images/0015.gif differ
Binary files 4.0K-4b/html/images/0016.gif and 5.0.000/html/images/0016.gif differ
Binary files 4.0K-4b/html/images/0017.gif and 5.0.000/html/images/0017.gif differ
Binary files 4.0K-4b/html/images/0019.gif and 5.0.000/html/images/0019.gif differ
Binary files 4.0K-4b/html/images/0020.gif and 5.0.000/html/images/0020.gif differ
Binary files 4.0K-4b/html/images/Pic1a.jpg and 5.0.000/html/images/Pic1a.jpg differ
Binary files 4.0K-4b/html/images/Pic1b.jpg and 5.0.000/html/images/Pic1b.jpg differ
Binary files 4.0K-4b/html/images/Pic2a.jpg and 5.0.000/html/images/Pic2a.jpg differ
Binary files 4.0K-4b/html/images/Pic2b.jpg and 5.0.000/html/images/Pic2b.jpg differ
Binary files 4.0K-4b/html/images/Pic3a.jpg and 5.0.000/html/images/Pic3a.jpg differ
Binary files 4.0K-4b/html/images/Pic3b.jpg and 5.0.000/html/images/Pic3b.jpg differ
Binary files 4.0K-4b/html/images/add_to_cart.gif and 5.0.000/html/images/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/agora468.gif and 5.0.000/html/images/agora468.gif differ
Binary files 4.0K-4b/html/images/blank.gif and 5.0.000/html/images/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/AgoraBlue_original/add_to_cart.gif and 5.0.000/html/images/buttonsets/AgoraBlue_original/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/AgoraBlue_original/blank.gif and 5.0.000/html/images/buttonsets/AgoraBlue_original/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/AgoraBlue_original/complete_order.gif and 5.0.000/html/images/buttonsets/AgoraBlue_original/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/AgoraBlue_original/continue_shopping.gif and 5.0.000/html/images/buttonsets/AgoraBlue_original/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/AgoraBlue_original/delete_items.gif and 5.0.000/html/images/buttonsets/AgoraBlue_original/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/AgoraBlue_original/edit_items.gif and 5.0.000/html/images/buttonsets/AgoraBlue_original/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/AgoraBlue_original/editcart.gif and 5.0.000/html/images/buttonsets/AgoraBlue_original/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/AgoraBlue_original/index.html 5.0.000/html/images/buttonsets/AgoraBlue_original/index.html
--- 4.0K-4b/html/images/buttonsets/AgoraBlue_original/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/AgoraBlue_original/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/AgoraBlue_original/logoff.gif and 5.0.000/html/images/buttonsets/AgoraBlue_original/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/AgoraBlue_original/make_changes.gif and 5.0.000/html/images/buttonsets/AgoraBlue_original/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/AgoraBlue_original/notavailable.gif and 5.0.000/html/images/buttonsets/AgoraBlue_original/notavailable.gif differ
Binary files 4.0K-4b/html/images/buttonsets/AgoraBlue_original/remove_items.gif and 5.0.000/html/images/buttonsets/AgoraBlue_original/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/AgoraBlue_original/submit_order.gif and 5.0.000/html/images/buttonsets/AgoraBlue_original/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/AgoraBlue_original/viewcart.gif and 5.0.000/html/images/buttonsets/AgoraBlue_original/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Army001/add_to_cart.gif and 5.0.000/html/images/buttonsets/Army001/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Army001/blank.gif and 5.0.000/html/images/buttonsets/Army001/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Army001/complete_order.gif and 5.0.000/html/images/buttonsets/Army001/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Army001/continue_shopping.gif and 5.0.000/html/images/buttonsets/Army001/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Army001/delete_items.gif and 5.0.000/html/images/buttonsets/Army001/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Army001/edit_items.gif and 5.0.000/html/images/buttonsets/Army001/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Army001/editcart.gif and 5.0.000/html/images/buttonsets/Army001/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/Army001/index.html 5.0.000/html/images/buttonsets/Army001/index.html
--- 4.0K-4b/html/images/buttonsets/Army001/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/Army001/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/Army001/logoff.gif and 5.0.000/html/images/buttonsets/Army001/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Army001/make_changes.gif and 5.0.000/html/images/buttonsets/Army001/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Army001/remove_items.gif and 5.0.000/html/images/buttonsets/Army001/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Army001/submit_order.gif and 5.0.000/html/images/buttonsets/Army001/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Army001/viewcart.gif and 5.0.000/html/images/buttonsets/Army001/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlackWhite001/add_to_cart.gif and 5.0.000/html/images/buttonsets/BlackWhite001/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlackWhite001/blank.gif and 5.0.000/html/images/buttonsets/BlackWhite001/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlackWhite001/complete_order.gif and 5.0.000/html/images/buttonsets/BlackWhite001/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlackWhite001/continue_shopping.gif and 5.0.000/html/images/buttonsets/BlackWhite001/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlackWhite001/delete_items.gif and 5.0.000/html/images/buttonsets/BlackWhite001/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlackWhite001/edit_items.gif and 5.0.000/html/images/buttonsets/BlackWhite001/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlackWhite001/editcart.gif and 5.0.000/html/images/buttonsets/BlackWhite001/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/BlackWhite001/index.html 5.0.000/html/images/buttonsets/BlackWhite001/index.html
--- 4.0K-4b/html/images/buttonsets/BlackWhite001/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/BlackWhite001/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/BlackWhite001/logoff.gif and 5.0.000/html/images/buttonsets/BlackWhite001/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlackWhite001/make_changes.gif and 5.0.000/html/images/buttonsets/BlackWhite001/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlackWhite001/remove_items.gif and 5.0.000/html/images/buttonsets/BlackWhite001/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlackWhite001/submit_order.gif and 5.0.000/html/images/buttonsets/BlackWhite001/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlackWhite001/viewcart.gif and 5.0.000/html/images/buttonsets/BlackWhite001/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlackWhite002/add_to_cart.gif and 5.0.000/html/images/buttonsets/BlackWhite002/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlackWhite002/blank.gif and 5.0.000/html/images/buttonsets/BlackWhite002/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlackWhite002/complete_order.gif and 5.0.000/html/images/buttonsets/BlackWhite002/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlackWhite002/continue_shopping.gif and 5.0.000/html/images/buttonsets/BlackWhite002/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlackWhite002/delete_items.gif and 5.0.000/html/images/buttonsets/BlackWhite002/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlackWhite002/edit_items.gif and 5.0.000/html/images/buttonsets/BlackWhite002/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlackWhite002/editcart.gif and 5.0.000/html/images/buttonsets/BlackWhite002/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/BlackWhite002/index.html 5.0.000/html/images/buttonsets/BlackWhite002/index.html
--- 4.0K-4b/html/images/buttonsets/BlackWhite002/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/BlackWhite002/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/BlackWhite002/logoff.gif and 5.0.000/html/images/buttonsets/BlackWhite002/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlackWhite002/make_changes.gif and 5.0.000/html/images/buttonsets/BlackWhite002/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlackWhite002/remove_items.gif and 5.0.000/html/images/buttonsets/BlackWhite002/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlackWhite002/submit_order.gif and 5.0.000/html/images/buttonsets/BlackWhite002/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlackWhite002/viewcart.gif and 5.0.000/html/images/buttonsets/BlackWhite002/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlueButton001/add_to_cart.gif and 5.0.000/html/images/buttonsets/BlueButton001/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlueButton001/blank.gif and 5.0.000/html/images/buttonsets/BlueButton001/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlueButton001/complete_order.gif and 5.0.000/html/images/buttonsets/BlueButton001/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlueButton001/continue_shopping.gif and 5.0.000/html/images/buttonsets/BlueButton001/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlueButton001/delete_items.gif and 5.0.000/html/images/buttonsets/BlueButton001/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlueButton001/edit_items.gif and 5.0.000/html/images/buttonsets/BlueButton001/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlueButton001/editcart.gif and 5.0.000/html/images/buttonsets/BlueButton001/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/BlueButton001/index.html 5.0.000/html/images/buttonsets/BlueButton001/index.html
--- 4.0K-4b/html/images/buttonsets/BlueButton001/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/BlueButton001/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/BlueButton001/logoff.gif and 5.0.000/html/images/buttonsets/BlueButton001/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlueButton001/make_changes.gif and 5.0.000/html/images/buttonsets/BlueButton001/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlueButton001/remove_items.gif and 5.0.000/html/images/buttonsets/BlueButton001/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlueButton001/submit_order.gif and 5.0.000/html/images/buttonsets/BlueButton001/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/BlueButton001/viewcart.gif and 5.0.000/html/images/buttonsets/BlueButton001/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/CustomOne/add_to_cart.gif and 5.0.000/html/images/buttonsets/CustomOne/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/CustomOne/blank.gif and 5.0.000/html/images/buttonsets/CustomOne/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/CustomOne/complete_order.gif and 5.0.000/html/images/buttonsets/CustomOne/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/CustomOne/continue_shopping.gif and 5.0.000/html/images/buttonsets/CustomOne/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/CustomOne/delete_items.gif and 5.0.000/html/images/buttonsets/CustomOne/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/CustomOne/edit_items.gif and 5.0.000/html/images/buttonsets/CustomOne/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/CustomOne/editcart.gif and 5.0.000/html/images/buttonsets/CustomOne/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/CustomOne/index.html 5.0.000/html/images/buttonsets/CustomOne/index.html
--- 4.0K-4b/html/images/buttonsets/CustomOne/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/CustomOne/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/CustomOne/make_changes.gif and 5.0.000/html/images/buttonsets/CustomOne/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/CustomOne/remove_items.gif and 5.0.000/html/images/buttonsets/CustomOne/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/CustomOne/submit_order.gif and 5.0.000/html/images/buttonsets/CustomOne/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/CustomOne/viewcart.gif and 5.0.000/html/images/buttonsets/CustomOne/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Green010/add_to_cart.gif and 5.0.000/html/images/buttonsets/Green010/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Green010/blank.gif and 5.0.000/html/images/buttonsets/Green010/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Green010/complete_order.gif and 5.0.000/html/images/buttonsets/Green010/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Green010/continue_shopping.gif and 5.0.000/html/images/buttonsets/Green010/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Green010/delete_items.gif and 5.0.000/html/images/buttonsets/Green010/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Green010/edit_items.gif and 5.0.000/html/images/buttonsets/Green010/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Green010/editcart.gif and 5.0.000/html/images/buttonsets/Green010/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/Green010/index.html 5.0.000/html/images/buttonsets/Green010/index.html
--- 4.0K-4b/html/images/buttonsets/Green010/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/Green010/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/Green010/logoff.gif and 5.0.000/html/images/buttonsets/Green010/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Green010/make_changes.gif and 5.0.000/html/images/buttonsets/Green010/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Green010/remove_items.gif and 5.0.000/html/images/buttonsets/Green010/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Green010/submit_order.gif and 5.0.000/html/images/buttonsets/Green010/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Green010/viewcart.gif and 5.0.000/html/images/buttonsets/Green010/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/OldWest001/add_to_cart.gif and 5.0.000/html/images/buttonsets/OldWest001/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/OldWest001/blank.gif and 5.0.000/html/images/buttonsets/OldWest001/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/OldWest001/complete_order.gif and 5.0.000/html/images/buttonsets/OldWest001/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/OldWest001/continue_shopping.gif and 5.0.000/html/images/buttonsets/OldWest001/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/OldWest001/delete_items.gif and 5.0.000/html/images/buttonsets/OldWest001/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/OldWest001/edit_items.gif and 5.0.000/html/images/buttonsets/OldWest001/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/OldWest001/editcart.gif and 5.0.000/html/images/buttonsets/OldWest001/editcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/OldWest001/logoff.gif and 5.0.000/html/images/buttonsets/OldWest001/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/OldWest001/make_changes.gif and 5.0.000/html/images/buttonsets/OldWest001/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/OldWest001/remove_items.gif and 5.0.000/html/images/buttonsets/OldWest001/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/OldWest001/submit_order.gif and 5.0.000/html/images/buttonsets/OldWest001/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/OldWest001/viewcart.gif and 5.0.000/html/images/buttonsets/OldWest001/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/ProBlueRounded001/add_to_cart.gif and 5.0.000/html/images/buttonsets/ProBlueRounded001/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/ProBlueRounded001/blank.gif and 5.0.000/html/images/buttonsets/ProBlueRounded001/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/ProBlueRounded001/complete_order.gif and 5.0.000/html/images/buttonsets/ProBlueRounded001/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/ProBlueRounded001/continue_shopping.gif and 5.0.000/html/images/buttonsets/ProBlueRounded001/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/ProBlueRounded001/delete_items.gif and 5.0.000/html/images/buttonsets/ProBlueRounded001/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/ProBlueRounded001/edit_items.gif and 5.0.000/html/images/buttonsets/ProBlueRounded001/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/ProBlueRounded001/editcart.gif and 5.0.000/html/images/buttonsets/ProBlueRounded001/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/ProBlueRounded001/index.html 5.0.000/html/images/buttonsets/ProBlueRounded001/index.html
--- 4.0K-4b/html/images/buttonsets/ProBlueRounded001/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/ProBlueRounded001/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/ProBlueRounded001/logoff.gif and 5.0.000/html/images/buttonsets/ProBlueRounded001/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/ProBlueRounded001/make_changes.gif and 5.0.000/html/images/buttonsets/ProBlueRounded001/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/ProBlueRounded001/remove_items.gif and 5.0.000/html/images/buttonsets/ProBlueRounded001/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/ProBlueRounded001/submit_order.gif and 5.0.000/html/images/buttonsets/ProBlueRounded001/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/ProBlueRounded001/viewcart.gif and 5.0.000/html/images/buttonsets/ProBlueRounded001/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/RedButton001/add_to_cart.gif and 5.0.000/html/images/buttonsets/RedButton001/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/RedButton001/blank.gif and 5.0.000/html/images/buttonsets/RedButton001/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/RedButton001/complete_order.gif and 5.0.000/html/images/buttonsets/RedButton001/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/RedButton001/continue_shopping.gif and 5.0.000/html/images/buttonsets/RedButton001/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/RedButton001/delete_items.gif and 5.0.000/html/images/buttonsets/RedButton001/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/RedButton001/edit_items.gif and 5.0.000/html/images/buttonsets/RedButton001/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/RedButton001/editcart.gif and 5.0.000/html/images/buttonsets/RedButton001/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/RedButton001/index.html 5.0.000/html/images/buttonsets/RedButton001/index.html
--- 4.0K-4b/html/images/buttonsets/RedButton001/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/RedButton001/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/RedButton001/logoff.gif and 5.0.000/html/images/buttonsets/RedButton001/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/RedButton001/make_changes.gif and 5.0.000/html/images/buttonsets/RedButton001/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/RedButton001/remove_items.gif and 5.0.000/html/images/buttonsets/RedButton001/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/RedButton001/submit_order.gif and 5.0.000/html/images/buttonsets/RedButton001/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/RedButton001/viewcart.gif and 5.0.000/html/images/buttonsets/RedButton001/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Silver001/add_to_cart.gif and 5.0.000/html/images/buttonsets/Silver001/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Silver001/blank.gif and 5.0.000/html/images/buttonsets/Silver001/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Silver001/complete_order.gif and 5.0.000/html/images/buttonsets/Silver001/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Silver001/continue_shopping.gif and 5.0.000/html/images/buttonsets/Silver001/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Silver001/delete_items.gif and 5.0.000/html/images/buttonsets/Silver001/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Silver001/edit_items.gif and 5.0.000/html/images/buttonsets/Silver001/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Silver001/editcart.gif and 5.0.000/html/images/buttonsets/Silver001/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/Silver001/index.html 5.0.000/html/images/buttonsets/Silver001/index.html
--- 4.0K-4b/html/images/buttonsets/Silver001/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/Silver001/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/Silver001/logoff.gif and 5.0.000/html/images/buttonsets/Silver001/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Silver001/make_changes.gif and 5.0.000/html/images/buttonsets/Silver001/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Silver001/remove_items.gif and 5.0.000/html/images/buttonsets/Silver001/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Silver001/submit_order.gif and 5.0.000/html/images/buttonsets/Silver001/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/Silver001/viewcart.gif and 5.0.000/html/images/buttonsets/Silver001/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_BluGreen/add_to_cart.gif and 5.0.000/html/images/buttonsets/TheAgora_BluGreen/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_BluGreen/blank.gif and 5.0.000/html/images/buttonsets/TheAgora_BluGreen/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_BluGreen/complete_order.gif and 5.0.000/html/images/buttonsets/TheAgora_BluGreen/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_BluGreen/continue_shopping.gif and 5.0.000/html/images/buttonsets/TheAgora_BluGreen/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_BluGreen/delete_items.gif and 5.0.000/html/images/buttonsets/TheAgora_BluGreen/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_BluGreen/edit_items.gif and 5.0.000/html/images/buttonsets/TheAgora_BluGreen/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_BluGreen/editcart.gif and 5.0.000/html/images/buttonsets/TheAgora_BluGreen/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/TheAgora_BluGreen/index.html 5.0.000/html/images/buttonsets/TheAgora_BluGreen/index.html
--- 4.0K-4b/html/images/buttonsets/TheAgora_BluGreen/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/TheAgora_BluGreen/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_BluGreen/logoff.gif and 5.0.000/html/images/buttonsets/TheAgora_BluGreen/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_BluGreen/make_changes.gif and 5.0.000/html/images/buttonsets/TheAgora_BluGreen/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_BluGreen/remove_items.gif and 5.0.000/html/images/buttonsets/TheAgora_BluGreen/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_BluGreen/submit_order.gif and 5.0.000/html/images/buttonsets/TheAgora_BluGreen/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_BluGreen/viewcart.gif and 5.0.000/html/images/buttonsets/TheAgora_BluGreen/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_BlueRoyal/add_to_cart.gif and 5.0.000/html/images/buttonsets/TheAgora_BlueRoyal/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_BlueRoyal/blank.gif and 5.0.000/html/images/buttonsets/TheAgora_BlueRoyal/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_BlueRoyal/complete_order.gif and 5.0.000/html/images/buttonsets/TheAgora_BlueRoyal/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_BlueRoyal/continue_shopping.gif and 5.0.000/html/images/buttonsets/TheAgora_BlueRoyal/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_BlueRoyal/delete_items.gif and 5.0.000/html/images/buttonsets/TheAgora_BlueRoyal/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_BlueRoyal/edit_items.gif and 5.0.000/html/images/buttonsets/TheAgora_BlueRoyal/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_BlueRoyal/editcart.gif and 5.0.000/html/images/buttonsets/TheAgora_BlueRoyal/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/TheAgora_BlueRoyal/index.html 5.0.000/html/images/buttonsets/TheAgora_BlueRoyal/index.html
--- 4.0K-4b/html/images/buttonsets/TheAgora_BlueRoyal/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/TheAgora_BlueRoyal/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_BlueRoyal/logoff.gif and 5.0.000/html/images/buttonsets/TheAgora_BlueRoyal/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_BlueRoyal/make_changes.gif and 5.0.000/html/images/buttonsets/TheAgora_BlueRoyal/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_BlueRoyal/remove_items.gif and 5.0.000/html/images/buttonsets/TheAgora_BlueRoyal/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_BlueRoyal/submit_order.gif and 5.0.000/html/images/buttonsets/TheAgora_BlueRoyal/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_BlueRoyal/viewcart.gif and 5.0.000/html/images/buttonsets/TheAgora_BlueRoyal/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Caramel/add_to_cart.gif and 5.0.000/html/images/buttonsets/TheAgora_Caramel/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Caramel/blank.gif and 5.0.000/html/images/buttonsets/TheAgora_Caramel/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Caramel/complete_order.gif and 5.0.000/html/images/buttonsets/TheAgora_Caramel/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Caramel/continue_shopping.gif and 5.0.000/html/images/buttonsets/TheAgora_Caramel/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Caramel/delete_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Caramel/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Caramel/edit_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Caramel/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Caramel/editcart.gif and 5.0.000/html/images/buttonsets/TheAgora_Caramel/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/TheAgora_Caramel/index.html 5.0.000/html/images/buttonsets/TheAgora_Caramel/index.html
--- 4.0K-4b/html/images/buttonsets/TheAgora_Caramel/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/TheAgora_Caramel/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Caramel/logoff.gif and 5.0.000/html/images/buttonsets/TheAgora_Caramel/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Caramel/make_changes.gif and 5.0.000/html/images/buttonsets/TheAgora_Caramel/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Caramel/remove_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Caramel/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Caramel/submit_order.gif and 5.0.000/html/images/buttonsets/TheAgora_Caramel/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Caramel/viewcart.gif and 5.0.000/html/images/buttonsets/TheAgora_Caramel/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Fuscha/add_to_cart.gif and 5.0.000/html/images/buttonsets/TheAgora_Fuscha/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Fuscha/blank.gif and 5.0.000/html/images/buttonsets/TheAgora_Fuscha/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Fuscha/complete_order.gif and 5.0.000/html/images/buttonsets/TheAgora_Fuscha/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Fuscha/continue_shopping.gif and 5.0.000/html/images/buttonsets/TheAgora_Fuscha/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Fuscha/delete_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Fuscha/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Fuscha/edit_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Fuscha/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Fuscha/editcart.gif and 5.0.000/html/images/buttonsets/TheAgora_Fuscha/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/TheAgora_Fuscha/index.html 5.0.000/html/images/buttonsets/TheAgora_Fuscha/index.html
--- 4.0K-4b/html/images/buttonsets/TheAgora_Fuscha/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/TheAgora_Fuscha/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Fuscha/logoff.gif and 5.0.000/html/images/buttonsets/TheAgora_Fuscha/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Fuscha/make_changes.gif and 5.0.000/html/images/buttonsets/TheAgora_Fuscha/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Fuscha/remove_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Fuscha/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Fuscha/submit_order.gif and 5.0.000/html/images/buttonsets/TheAgora_Fuscha/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Fuscha/viewcart.gif and 5.0.000/html/images/buttonsets/TheAgora_Fuscha/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Grayish/add_to_cart.gif and 5.0.000/html/images/buttonsets/TheAgora_Grayish/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Grayish/blank.gif and 5.0.000/html/images/buttonsets/TheAgora_Grayish/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Grayish/complete_order.gif and 5.0.000/html/images/buttonsets/TheAgora_Grayish/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Grayish/continue_shopping.gif and 5.0.000/html/images/buttonsets/TheAgora_Grayish/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Grayish/delete_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Grayish/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Grayish/edit_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Grayish/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Grayish/editcart.gif and 5.0.000/html/images/buttonsets/TheAgora_Grayish/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/TheAgora_Grayish/index.html 5.0.000/html/images/buttonsets/TheAgora_Grayish/index.html
--- 4.0K-4b/html/images/buttonsets/TheAgora_Grayish/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/TheAgora_Grayish/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Grayish/logoff.gif and 5.0.000/html/images/buttonsets/TheAgora_Grayish/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Grayish/make_changes.gif and 5.0.000/html/images/buttonsets/TheAgora_Grayish/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Grayish/remove_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Grayish/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Grayish/submit_order.gif and 5.0.000/html/images/buttonsets/TheAgora_Grayish/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Grayish/viewcart.gif and 5.0.000/html/images/buttonsets/TheAgora_Grayish/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Green1/add_to_cart.gif and 5.0.000/html/images/buttonsets/TheAgora_Green1/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Green1/blank.gif and 5.0.000/html/images/buttonsets/TheAgora_Green1/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Green1/complete_order.gif and 5.0.000/html/images/buttonsets/TheAgora_Green1/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Green1/contine_shopping.gif and 5.0.000/html/images/buttonsets/TheAgora_Green1/contine_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Green1/continue_shopping.gif and 5.0.000/html/images/buttonsets/TheAgora_Green1/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Green1/delete_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Green1/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Green1/edit_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Green1/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Green1/editcart.gif and 5.0.000/html/images/buttonsets/TheAgora_Green1/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/TheAgora_Green1/index.html 5.0.000/html/images/buttonsets/TheAgora_Green1/index.html
--- 4.0K-4b/html/images/buttonsets/TheAgora_Green1/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/TheAgora_Green1/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Green1/logoff.gif and 5.0.000/html/images/buttonsets/TheAgora_Green1/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Green1/make_changes.gif and 5.0.000/html/images/buttonsets/TheAgora_Green1/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Green1/remove_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Green1/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Green1/submit_order.gif and 5.0.000/html/images/buttonsets/TheAgora_Green1/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Green1/viewcart.gif and 5.0.000/html/images/buttonsets/TheAgora_Green1/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Green2/add_to_cart.gif and 5.0.000/html/images/buttonsets/TheAgora_Green2/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Green2/blank.gif and 5.0.000/html/images/buttonsets/TheAgora_Green2/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Green2/complete_order.gif and 5.0.000/html/images/buttonsets/TheAgora_Green2/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Green2/continue_shopping.gif and 5.0.000/html/images/buttonsets/TheAgora_Green2/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Green2/delete_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Green2/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Green2/edit_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Green2/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Green2/editcart.gif and 5.0.000/html/images/buttonsets/TheAgora_Green2/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/TheAgora_Green2/index.html 5.0.000/html/images/buttonsets/TheAgora_Green2/index.html
--- 4.0K-4b/html/images/buttonsets/TheAgora_Green2/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/TheAgora_Green2/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Green2/logoff.gif and 5.0.000/html/images/buttonsets/TheAgora_Green2/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Green2/make_changes.gif and 5.0.000/html/images/buttonsets/TheAgora_Green2/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Green2/remove_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Green2/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Green2/submit_order.gif and 5.0.000/html/images/buttonsets/TheAgora_Green2/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Green2/viewcart.gif and 5.0.000/html/images/buttonsets/TheAgora_Green2/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenDarkOlive/add_to_cart.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenDarkOlive/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenDarkOlive/blank.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenDarkOlive/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenDarkOlive/complete_order.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenDarkOlive/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenDarkOlive/continue_shopping.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenDarkOlive/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenDarkOlive/delete_items.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenDarkOlive/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenDarkOlive/edit_items.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenDarkOlive/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenDarkOlive/editcart.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenDarkOlive/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/TheAgora_GreenDarkOlive/index.html 5.0.000/html/images/buttonsets/TheAgora_GreenDarkOlive/index.html
--- 4.0K-4b/html/images/buttonsets/TheAgora_GreenDarkOlive/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/TheAgora_GreenDarkOlive/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenDarkOlive/logoff.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenDarkOlive/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenDarkOlive/make_changes.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenDarkOlive/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenDarkOlive/remove_items.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenDarkOlive/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenDarkOlive/submit_order.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenDarkOlive/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenDarkOlive/viewcart.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenDarkOlive/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoney/add_to_cart.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenMoney/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoney/blank.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenMoney/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoney/complete_order.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenMoney/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoney/continue_shopping.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenMoney/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoney/delete_items.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenMoney/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoney/edit_items.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenMoney/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoney/editcart.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenMoney/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoney/index.html 5.0.000/html/images/buttonsets/TheAgora_GreenMoney/index.html
--- 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoney/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/TheAgora_GreenMoney/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoney/logoff.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenMoney/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoney/make_changes.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenMoney/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoney/remove_items.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenMoney/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoney/submit_order.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenMoney/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoney/viewcart.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenMoney/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoss/add_to_cart.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenMoss/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoss/blank.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenMoss/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoss/complete_order.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenMoss/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoss/continue_shopping.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenMoss/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoss/delete_items.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenMoss/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoss/edit_items.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenMoss/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoss/editcart.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenMoss/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoss/index.html 5.0.000/html/images/buttonsets/TheAgora_GreenMoss/index.html
--- 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoss/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/TheAgora_GreenMoss/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoss/logoff.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenMoss/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoss/make_changes.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenMoss/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoss/remove_items.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenMoss/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoss/submit_order.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenMoss/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_GreenMoss/viewcart.gif and 5.0.000/html/images/buttonsets/TheAgora_GreenMoss/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Mustard/add_to_cart.gif and 5.0.000/html/images/buttonsets/TheAgora_Mustard/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Mustard/blank.gif and 5.0.000/html/images/buttonsets/TheAgora_Mustard/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Mustard/complete_order.gif and 5.0.000/html/images/buttonsets/TheAgora_Mustard/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Mustard/contine_shopping.gif and 5.0.000/html/images/buttonsets/TheAgora_Mustard/contine_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Mustard/delete_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Mustard/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Mustard/edit_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Mustard/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Mustard/editcart.gif and 5.0.000/html/images/buttonsets/TheAgora_Mustard/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/TheAgora_Mustard/index.html 5.0.000/html/images/buttonsets/TheAgora_Mustard/index.html
--- 4.0K-4b/html/images/buttonsets/TheAgora_Mustard/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/TheAgora_Mustard/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Mustard/logoff.gif and 5.0.000/html/images/buttonsets/TheAgora_Mustard/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Mustard/make_changes.gif and 5.0.000/html/images/buttonsets/TheAgora_Mustard/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Mustard/remove_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Mustard/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Mustard/submit_order.gif and 5.0.000/html/images/buttonsets/TheAgora_Mustard/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Mustard/viewcart.gif and 5.0.000/html/images/buttonsets/TheAgora_Mustard/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Orange2/add_to_cart.gif and 5.0.000/html/images/buttonsets/TheAgora_Orange2/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Orange2/blank.gif and 5.0.000/html/images/buttonsets/TheAgora_Orange2/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Orange2/complete_order.gif and 5.0.000/html/images/buttonsets/TheAgora_Orange2/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Orange2/continue_shopping.gif and 5.0.000/html/images/buttonsets/TheAgora_Orange2/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Orange2/delete_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Orange2/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Orange2/edit_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Orange2/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Orange2/editcart.gif and 5.0.000/html/images/buttonsets/TheAgora_Orange2/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/TheAgora_Orange2/index.html 5.0.000/html/images/buttonsets/TheAgora_Orange2/index.html
--- 4.0K-4b/html/images/buttonsets/TheAgora_Orange2/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/TheAgora_Orange2/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Orange2/logoff.gif and 5.0.000/html/images/buttonsets/TheAgora_Orange2/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Orange2/make_changes.gif and 5.0.000/html/images/buttonsets/TheAgora_Orange2/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Orange2/remove_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Orange2/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Orange2/submit_order.gif and 5.0.000/html/images/buttonsets/TheAgora_Orange2/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Orange2/viewcart.gif and 5.0.000/html/images/buttonsets/TheAgora_Orange2/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_ProBlue/add_to_cart.gif and 5.0.000/html/images/buttonsets/TheAgora_ProBlue/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_ProBlue/blank.gif and 5.0.000/html/images/buttonsets/TheAgora_ProBlue/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_ProBlue/complete_order.gif and 5.0.000/html/images/buttonsets/TheAgora_ProBlue/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_ProBlue/continue_shopping.gif and 5.0.000/html/images/buttonsets/TheAgora_ProBlue/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_ProBlue/delete_items.gif and 5.0.000/html/images/buttonsets/TheAgora_ProBlue/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_ProBlue/edit_items.gif and 5.0.000/html/images/buttonsets/TheAgora_ProBlue/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_ProBlue/editcart.gif and 5.0.000/html/images/buttonsets/TheAgora_ProBlue/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/TheAgora_ProBlue/index.html 5.0.000/html/images/buttonsets/TheAgora_ProBlue/index.html
--- 4.0K-4b/html/images/buttonsets/TheAgora_ProBlue/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/TheAgora_ProBlue/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_ProBlue/logoff.gif and 5.0.000/html/images/buttonsets/TheAgora_ProBlue/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_ProBlue/make_changes.gif and 5.0.000/html/images/buttonsets/TheAgora_ProBlue/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_ProBlue/remove_items.gif and 5.0.000/html/images/buttonsets/TheAgora_ProBlue/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_ProBlue/submit_order.gif and 5.0.000/html/images/buttonsets/TheAgora_ProBlue/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_ProBlue/viewcart.gif and 5.0.000/html/images/buttonsets/TheAgora_ProBlue/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Purple1/add_to_cart.gif and 5.0.000/html/images/buttonsets/TheAgora_Purple1/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Purple1/blank.gif and 5.0.000/html/images/buttonsets/TheAgora_Purple1/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Purple1/complete_order.gif and 5.0.000/html/images/buttonsets/TheAgora_Purple1/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Purple1/continue_shopping.gif and 5.0.000/html/images/buttonsets/TheAgora_Purple1/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Purple1/delete_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Purple1/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Purple1/edit_cart.gif and 5.0.000/html/images/buttonsets/TheAgora_Purple1/edit_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Purple1/edit_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Purple1/edit_items.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/TheAgora_Purple1/index.html 5.0.000/html/images/buttonsets/TheAgora_Purple1/index.html
--- 4.0K-4b/html/images/buttonsets/TheAgora_Purple1/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/TheAgora_Purple1/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Purple1/logoff.gif and 5.0.000/html/images/buttonsets/TheAgora_Purple1/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Purple1/make_changes.gif and 5.0.000/html/images/buttonsets/TheAgora_Purple1/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Purple1/remove_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Purple1/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Purple1/submit_order.gif and 5.0.000/html/images/buttonsets/TheAgora_Purple1/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Purple1/viewcart.gif and 5.0.000/html/images/buttonsets/TheAgora_Purple1/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_PurpleBlue/blank.gif and 5.0.000/html/images/buttonsets/TheAgora_PurpleBlue/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_PurpleBlue/complete_order.gif and 5.0.000/html/images/buttonsets/TheAgora_PurpleBlue/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_PurpleBlue/continue_shopping.gif and 5.0.000/html/images/buttonsets/TheAgora_PurpleBlue/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_PurpleBlue/delete_items.gif and 5.0.000/html/images/buttonsets/TheAgora_PurpleBlue/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_PurpleBlue/edit_items.gif and 5.0.000/html/images/buttonsets/TheAgora_PurpleBlue/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_PurpleBlue/editcart.gif and 5.0.000/html/images/buttonsets/TheAgora_PurpleBlue/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/TheAgora_PurpleBlue/index.html 5.0.000/html/images/buttonsets/TheAgora_PurpleBlue/index.html
--- 4.0K-4b/html/images/buttonsets/TheAgora_PurpleBlue/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/TheAgora_PurpleBlue/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_PurpleBlue/logoff.gif and 5.0.000/html/images/buttonsets/TheAgora_PurpleBlue/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_PurpleBlue/make_changes.gif and 5.0.000/html/images/buttonsets/TheAgora_PurpleBlue/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_PurpleBlue/remove_items.gif and 5.0.000/html/images/buttonsets/TheAgora_PurpleBlue/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_PurpleBlue/submit_order.gif and 5.0.000/html/images/buttonsets/TheAgora_PurpleBlue/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_PurpleBlue/viewcart.gif and 5.0.000/html/images/buttonsets/TheAgora_PurpleBlue/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Red2/add_to_cart.gif and 5.0.000/html/images/buttonsets/TheAgora_Red2/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Red2/blank.gif and 5.0.000/html/images/buttonsets/TheAgora_Red2/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Red2/complete_order.gif and 5.0.000/html/images/buttonsets/TheAgora_Red2/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Red2/continue_shopping.gif and 5.0.000/html/images/buttonsets/TheAgora_Red2/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Red2/delete_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Red2/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Red2/edit_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Red2/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Red2/editcart.gif and 5.0.000/html/images/buttonsets/TheAgora_Red2/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/TheAgora_Red2/index.html 5.0.000/html/images/buttonsets/TheAgora_Red2/index.html
--- 4.0K-4b/html/images/buttonsets/TheAgora_Red2/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/TheAgora_Red2/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Red2/logoff.gif and 5.0.000/html/images/buttonsets/TheAgora_Red2/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Red2/make_changes.gif and 5.0.000/html/images/buttonsets/TheAgora_Red2/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Red2/remove_items.gif and 5.0.000/html/images/buttonsets/TheAgora_Red2/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Red2/submit_order.gif and 5.0.000/html/images/buttonsets/TheAgora_Red2/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_Red2/viewcart.gif and 5.0.000/html/images/buttonsets/TheAgora_Red2/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_RedDark/add_to_cart.gif and 5.0.000/html/images/buttonsets/TheAgora_RedDark/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_RedDark/blank.gif and 5.0.000/html/images/buttonsets/TheAgora_RedDark/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_RedDark/complete_order.gif and 5.0.000/html/images/buttonsets/TheAgora_RedDark/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_RedDark/continue_shopping.gif and 5.0.000/html/images/buttonsets/TheAgora_RedDark/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_RedDark/delete_items.gif and 5.0.000/html/images/buttonsets/TheAgora_RedDark/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_RedDark/edit_items.gif and 5.0.000/html/images/buttonsets/TheAgora_RedDark/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_RedDark/editcart.gif and 5.0.000/html/images/buttonsets/TheAgora_RedDark/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/TheAgora_RedDark/index.html 5.0.000/html/images/buttonsets/TheAgora_RedDark/index.html
--- 4.0K-4b/html/images/buttonsets/TheAgora_RedDark/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/TheAgora_RedDark/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_RedDark/logoff.gif and 5.0.000/html/images/buttonsets/TheAgora_RedDark/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_RedDark/make_changes.gif and 5.0.000/html/images/buttonsets/TheAgora_RedDark/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_RedDark/remove_items.gif and 5.0.000/html/images/buttonsets/TheAgora_RedDark/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_RedDark/submit_order.gif and 5.0.000/html/images/buttonsets/TheAgora_RedDark/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_RedDark/viewcart.gif and 5.0.000/html/images/buttonsets/TheAgora_RedDark/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_TurquoiseLight/add_to_cart.gif and 5.0.000/html/images/buttonsets/TheAgora_TurquoiseLight/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_TurquoiseLight/blank.gif and 5.0.000/html/images/buttonsets/TheAgora_TurquoiseLight/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_TurquoiseLight/complete_order.gif and 5.0.000/html/images/buttonsets/TheAgora_TurquoiseLight/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_TurquoiseLight/continue_shopping.gif and 5.0.000/html/images/buttonsets/TheAgora_TurquoiseLight/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_TurquoiseLight/delete_items.gif and 5.0.000/html/images/buttonsets/TheAgora_TurquoiseLight/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_TurquoiseLight/edit_items.gif and 5.0.000/html/images/buttonsets/TheAgora_TurquoiseLight/edit_items.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/TheAgora_TurquoiseLight/index.html 5.0.000/html/images/buttonsets/TheAgora_TurquoiseLight/index.html
--- 4.0K-4b/html/images/buttonsets/TheAgora_TurquoiseLight/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/TheAgora_TurquoiseLight/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_TurquoiseLight/logoff.gif and 5.0.000/html/images/buttonsets/TheAgora_TurquoiseLight/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_TurquoiseLight/make_changes.gif and 5.0.000/html/images/buttonsets/TheAgora_TurquoiseLight/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_TurquoiseLight/remove_items.gif and 5.0.000/html/images/buttonsets/TheAgora_TurquoiseLight/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_TurquoiseLight/submit_order.gif and 5.0.000/html/images/buttonsets/TheAgora_TurquoiseLight/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_TurquoiseLight/viewcart.gif and 5.0.000/html/images/buttonsets/TheAgora_TurquoiseLight/viewcart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_VioletLight/add_to_cart.gif and 5.0.000/html/images/buttonsets/TheAgora_VioletLight/add_to_cart.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_VioletLight/blank.gif and 5.0.000/html/images/buttonsets/TheAgora_VioletLight/blank.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_VioletLight/complete_order.gif and 5.0.000/html/images/buttonsets/TheAgora_VioletLight/complete_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_VioletLight/continue_shopping.gif and 5.0.000/html/images/buttonsets/TheAgora_VioletLight/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_VioletLight/delete_items.gif and 5.0.000/html/images/buttonsets/TheAgora_VioletLight/delete_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_VioletLight/edit_items.gif and 5.0.000/html/images/buttonsets/TheAgora_VioletLight/edit_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_VioletLight/editcart.gif and 5.0.000/html/images/buttonsets/TheAgora_VioletLight/editcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/TheAgora_VioletLight/index.html 5.0.000/html/images/buttonsets/TheAgora_VioletLight/index.html
--- 4.0K-4b/html/images/buttonsets/TheAgora_VioletLight/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/TheAgora_VioletLight/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_VioletLight/logoff.gif and 5.0.000/html/images/buttonsets/TheAgora_VioletLight/logoff.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_VioletLight/make_changes.gif and 5.0.000/html/images/buttonsets/TheAgora_VioletLight/make_changes.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_VioletLight/remove_items.gif and 5.0.000/html/images/buttonsets/TheAgora_VioletLight/remove_items.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_VioletLight/submit_order.gif and 5.0.000/html/images/buttonsets/TheAgora_VioletLight/submit_order.gif differ
Binary files 4.0K-4b/html/images/buttonsets/TheAgora_VioletLight/viewcart.gif and 5.0.000/html/images/buttonsets/TheAgora_VioletLight/viewcart.gif differ
diff -ruN 4.0K-4b/html/images/buttonsets/index.html 5.0.000/html/images/buttonsets/index.html
--- 4.0K-4b/html/images/buttonsets/index.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/images/buttonsets/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+Restricted Area
\ No newline at end of file
Binary files 4.0K-4b/html/images/complete_order.gif and 5.0.000/html/images/complete_order.gif differ
Binary files 4.0K-4b/html/images/continue_shopping.gif and 5.0.000/html/images/continue_shopping.gif differ
Binary files 4.0K-4b/html/images/delete_items.gif and 5.0.000/html/images/delete_items.gif differ
Binary files 4.0K-4b/html/images/edit_items.gif and 5.0.000/html/images/edit_items.gif differ
Binary files 4.0K-4b/html/images/editcart.gif and 5.0.000/html/images/editcart.gif differ
Binary files 4.0K-4b/html/images/handsfreecell_lar.jpg and 5.0.000/html/images/handsfreecell_lar.jpg differ
Binary files 4.0K-4b/html/images/handsfreecell_med.jpg and 5.0.000/html/images/handsfreecell_med.jpg differ
Binary files 4.0K-4b/html/images/handsfreecell_sml.jpg and 5.0.000/html/images/handsfreecell_sml.jpg differ
Binary files 4.0K-4b/html/images/logoff.gif and 5.0.000/html/images/logoff.gif differ
Binary files 4.0K-4b/html/images/make_changes.gif and 5.0.000/html/images/make_changes.gif differ
Binary files 4.0K-4b/html/images/motivation_01l.jpg and 5.0.000/html/images/motivation_01l.jpg differ
Binary files 4.0K-4b/html/images/motivation_01m.jpg and 5.0.000/html/images/motivation_01m.jpg differ
Binary files 4.0K-4b/html/images/motivation_01s.jpg and 5.0.000/html/images/motivation_01s.jpg differ
Binary files 4.0K-4b/html/images/motivation_02l.jpg and 5.0.000/html/images/motivation_02l.jpg differ
Binary files 4.0K-4b/html/images/motivation_02m.jpg and 5.0.000/html/images/motivation_02m.jpg differ
Binary files 4.0K-4b/html/images/motivation_02s.jpg and 5.0.000/html/images/motivation_02s.jpg differ
Binary files 4.0K-4b/html/images/motivation_04l.jpg and 5.0.000/html/images/motivation_04l.jpg differ
Binary files 4.0K-4b/html/images/motivation_04m.jpg and 5.0.000/html/images/motivation_04m.jpg differ
Binary files 4.0K-4b/html/images/motivation_04s.jpg and 5.0.000/html/images/motivation_04s.jpg differ
Binary files 4.0K-4b/html/images/motivation_05l.jpg and 5.0.000/html/images/motivation_05l.jpg differ
Binary files 4.0K-4b/html/images/motivation_05m.jpg and 5.0.000/html/images/motivation_05m.jpg differ
Binary files 4.0K-4b/html/images/motivation_05s.jpg and 5.0.000/html/images/motivation_05s.jpg differ
Binary files 4.0K-4b/html/images/motivation_06l.jpg and 5.0.000/html/images/motivation_06l.jpg differ
Binary files 4.0K-4b/html/images/motivation_06m.jpg and 5.0.000/html/images/motivation_06m.jpg differ
Binary files 4.0K-4b/html/images/motivation_06s.jpg and 5.0.000/html/images/motivation_06s.jpg differ
Binary files 4.0K-4b/html/images/motivation_07l.jpg and 5.0.000/html/images/motivation_07l.jpg differ
Binary files 4.0K-4b/html/images/motivation_07m.jpg and 5.0.000/html/images/motivation_07m.jpg differ
Binary files 4.0K-4b/html/images/motivation_07s.jpg and 5.0.000/html/images/motivation_07s.jpg differ
Binary files 4.0K-4b/html/images/motivation_08l.jpg and 5.0.000/html/images/motivation_08l.jpg differ
Binary files 4.0K-4b/html/images/motivation_08m.jpg and 5.0.000/html/images/motivation_08m.jpg differ
Binary files 4.0K-4b/html/images/motivation_08s.jpg and 5.0.000/html/images/motivation_08s.jpg differ
Binary files 4.0K-4b/html/images/motivation_10l.jpg and 5.0.000/html/images/motivation_10l.jpg differ
Binary files 4.0K-4b/html/images/motivation_10m.jpg and 5.0.000/html/images/motivation_10m.jpg differ
Binary files 4.0K-4b/html/images/motivation_10s.jpg and 5.0.000/html/images/motivation_10s.jpg differ
Binary files 4.0K-4b/html/images/remove_items.gif and 5.0.000/html/images/remove_items.gif differ
Binary files 4.0K-4b/html/images/sm_0002.gif and 5.0.000/html/images/sm_0002.gif differ
Binary files 4.0K-4b/html/images/sm_0003.gif and 5.0.000/html/images/sm_0003.gif differ
Binary files 4.0K-4b/html/images/sm_0004.gif and 5.0.000/html/images/sm_0004.gif differ
Binary files 4.0K-4b/html/images/sm_0005.gif and 5.0.000/html/images/sm_0005.gif differ
Binary files 4.0K-4b/html/images/sm_0011.gif and 5.0.000/html/images/sm_0011.gif differ
Binary files 4.0K-4b/html/images/sm_0012.gif and 5.0.000/html/images/sm_0012.gif differ
Binary files 4.0K-4b/html/images/sm_0015.gif and 5.0.000/html/images/sm_0015.gif differ
Binary files 4.0K-4b/html/images/sm_0016.gif and 5.0.000/html/images/sm_0016.gif differ
Binary files 4.0K-4b/html/images/sm_0017.gif and 5.0.000/html/images/sm_0017.gif differ
Binary files 4.0K-4b/html/images/sm_0019.gif and 5.0.000/html/images/sm_0019.gif differ
Binary files 4.0K-4b/html/images/sm_0020.gif and 5.0.000/html/images/sm_0020.gif differ
Binary files 4.0K-4b/html/images/submit_order.gif and 5.0.000/html/images/submit_order.gif differ
Binary files 4.0K-4b/html/images/valid-html401.png and 5.0.000/html/images/valid-html401.png differ
Binary files 4.0K-4b/html/images/viewcart.gif and 5.0.000/html/images/viewcart.gif differ
diff -ruN 4.0K-4b/html/index.html 5.0.000/html/index.html
--- 4.0K-4b/html/index.html	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -1,159 +1,232 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
 <title>AgoraCart %%agoracgi_ver%%</title>
+%%head_info%%
 </head>
 
-<body BGCOLOR="#ffffff">
+<body>
 %%StoreHeader%%
 
-<div align="center"><center>
-<table WIDTH="630" BGCOLOR="#FFFFFF" BORDER="0" CELLPADDING="0" CELLSPACING="0">
-  <tr>
-   <td><br><br>
-    <p align="center">&nbsp;<big><big><big><strong>Open Source FREE Shopping Cart System</strong></big></big></big></p>
-    <div align="center"><center><table border="0" cellpadding="0" cellspacing="0" width="600"
-    align="center">
-      <tr>
-        <td><font face="Arial" size="2"><center>
-<a href="http://www.AgoraPay.com/">AgoraPay Payment Gateway</a> | 
-<a href="http://groups.yahoo.com/group/agora2/">Free Support Forum</a> | 
-<a href="http://www.agoracartpro.com/">Pro Members</a> | 
-<a href="http://www.agoracart.com/download.htm">Downloads</a> | 
-<a href="http://www.agoracart.com/coolhacks.htm">Cool Hacks</a><br>
-<a href="http://www.agoracart.com/store/agora.cgi">Add-ons Store</a> | 
-<a href="http://www.agoracart.com/help/">Online Manual</a> | 
-<a href="http://www.agoracart.com/installguide.htm">Install Guide</a> | 
-<a href="http://www.agoracart.com/pages/Authorized_Solutions_Providers/">Authorized Solutions Providers</a> | 
-<a href="http://www.agoracart.com/paidsupport.htm">Paid Tech Support</a><br>
-<a href="http://www.agoracart.com/dbwizz/">DBwizz Database Manager</a> | 
-<a href="http://www.agoracart.com/pages/Shopping/">Shop other AgoraCart Stores</a> | 
-<a href="http://www.agoracart.com/">the Official AgoraCart Web Site</a><br></center><br>
+<div align="center" style="text-align:justify; font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 13px; padding: 20px 10px 20px 10px;">
 
+	<h1 style="text-align:center;" class="style6">Open Source FREE Shopping Cart System</h1>
 <br>
-Features include: Web-based administration, UPS or
-        fixed-rate shipping, Spreadsheet/Database import of store catalog, PGP/GnuPG ready,
-        Feature-Packed online Store Manager, and much more! </font></td>
-      </tr>
-    </table>
-    </center></div><div align="center"><center><table border="0" cellpadding="0"
-    cellspacing="0" width="610">
-      <tr>
-          <td width="610"><div align="center"><center><table WIDTH="570" ALIGN="CENTER" BORDER="0">
+
+<!--agorascript-pre
+# this is an AgoraCart members only AgoraScript Snippet.  You must be a current member at:
+# http://www.AgoraCartPro.com .  Sign up or renew at AgoraCart.com
+# Copyright &copy; 2000 - Present by K-Factor Technologies Inc., AgoraScript, and BytePipe.
+&capture_STDOUT; open (DATAFILE, "<./data_files/data.file") || die print "Could not open data.file";  @line=<DATAFILE>;
+ close (DATAFILE);
+ srand;
+ $array1 = $line[int rand(@line)];
+ $array2 = $line[int rand(@line)];
+ $array3 = $line[int rand(@line)];
+ $array4 = $line[int rand(@line)];
+ @special1 = split (/\|/, $array1);
+ @special2 = split (/\|/, $array2);
+ @special3 = split (/\|/, $array3);
+ @special4 = split (/\|/, $array4);
+ $image1 = $special1[7];
+ $image2 = $special2[7];
+ $image3 = $special3[7];
+ $image4 = $special4[7];
+   $image1 =~ s/%%IMG%%//ig;
+   $image2 =~ s/%%IMG%%//ig;
+   $image3 =~ s/%%IMG%%//ig;
+   $image4 =~ s/%%IMG%%//ig;
+
+print qq~
+<!--this is an AgoraCart members only AgoraScript Snippet.  You must be a current member at:
+ http://www.AgoraCartPro.com .  Sign up or renew at AgoraCart.com
+ Copyright &copy; 2000 - Present by K-Factor Technologies Inc., AgoraScript, and BytePipe.--\>
+
+
+<table width="96%" border="0" align="center" cellpadding="0" cellspacing="1" class="template_mainbackground">
           <tr>
-            <td WIDTH="570" BGCOLOR="#FFFFFF"><font FACE="TAHOMA,VERDANA,HELVETICA,ARIAL" SIZE="2"
-            COLOR="#000000"><!--BEGIN--> <table WIDTH="570" ALIGN="CENTER" BORDER="0">
-              <tr>
-                <td WIDTH="570" BGCOLOR="#680098"><font FACE="TAHOMA,VERDANA,HELVETICA,ARIAL" SIZE="2"
-                COLOR="#FFFFFF"><strong>Demo Store - Choose A Category Below</strong> </font></td>
-              </tr>
-            </table>
-            <p align="center"><font FACE="ARIAL,TAHOMA,VERDANA,HELVETICA" SIZE="3" COLOR="#FFFFFF">&nbsp;
-<!--agorascript-pre { 
-# Agora ver 3.1 or higher required!
-# list all database categories
-local(%db_ele,$sku,$category,%category_list);
-if (!($sc_db_lib_was_loaded =~ /yes/i))
- { &require_supporting_libraries (__FILE__, __LINE__, "$sc_db_lib_path"); }
-&capture_STDOUT;
-@category_list = &get_prod_db_category_list;
-foreach $category (sort(@category_list)) {
-  print "<a href=\"$sc_store_url?cart_id=&xm=on&product=",
-    "$category\">$category</a>&nbsp;&nbsp;&nbsp;\n";
-}
-&uncapture_STDOUT; }
---></font></p>
-            <div><table width="100%" border="0" cellspacing="3" cellpadding="3">
-              <tr>
-                <td width="50%" valign="top"><font face="arial" size="2" color="#000000">The page you are
-                currently viewing is called <strong>index.html</strong> and resides in the <strong>/html</strong>
-                sub directory. You should ONLY be viewing this page by accessing <strong>agora.cgi</strong>,
-                NOT by linking directly to this page. By default, <strong>AgoraCart</strong> loads this
-                page as the homepage. <p>Download the source and view the source code for this page (Don't
-                just view the source code through the web browser or this part won't make sense). Notice
-                the code for the category links above and to the left. For example, <strong>agora.cgi?product=java&cart_id=</strong>
-                displays all of the products from the database that are in the <strong>java</strong>
-                category. The 'cart id=' tells the script to add in the numeric cart id when the page is
-                parsed through the script. In other words, the cart id IS NOT hardcoded into the source
-                code of the page, but is added dynamically to the page when it is displayed. This makes
-                the script more accessible to users that do not accept cookies. </p>
-                <p><strong>Linking to Your Store</strong> </p>
-               <p>linking to your store is fairly easy and you can link from jsut about anywhere.  Here are the most common way to link to your store:<br><br>
-Link to a category:<br>
-http://www.yourname.com/store/agora.cgi?product=java<br>
-This will show all the products in the java category.  to limit this to java and java only add this to the end of the URL: &xm=on
-<br><br>
-
-Link to a category with specific page layout:<br>
-http://www.yourname.com/store/agora.cgi?product=java&ppinc=4a<br>
-This will show all the products in the java category using the productPage-4a.inc file which shows products 4 across with minimal information with additional links
-<br><br>
-
-Link to a specific product (number is exact database number for product):<br>
-http://www.yourname.com/store/agora.cgi?p_id=00125<br>
-This will show a single product with the database number 00125
-<br><br>
-
-Link to a specific page (product page):<br>
-http://www.yourname.com/store/agora.cgi?page=java.html<br>
-if you wish to have static pages, design and upload to the html/pages sub directory and use the linking method to access that page directly.
-<br><br>
-
-</p>
-                <p><strong>Store Manager</strong> </p>
-                <p>Store Manager can be accessed <a href="protected/manager.cgi" target="_TOP">here</a>.
-                Please note, on similar scripts you need to use this syntax <strong>manager.cgi?welcome_screen=yes</strong></p>
-                <p>If you use only <strong>manager.cgi</strong>, this script automatically loads the
-                welcome screen!&nbsp; Error-detection/recovery has also been enhanced.</p>
-                <p>Bookmark your Store Manager link, and make sure to remove the link displayed above when
-                you re-design this page.</p>
-                <p><strong>Editing the Look of Your Store</strong> </p>
-<p>
-To edit the look of the store, you may download the basic header footer manager at <a href="http://www.agoracart.com/download/basicheader.zip">http://www.agoracart.com/download.htm</a> which will edit the store look using this same look.  If you wish to edit the look yourself, you must manually edit the store_header.inc, store_footer.inc, secure_store_header.inc, and secure_store_footer.inc files found in the html/html-templates sub directory of your store, as well as edit the index.html file found in the html sub directory of your store.  An options editor to add simple options to your database products is also available at <a href="http://www.agoracart.com/download/simple.zip">http://www.agoracart.com/download.htm</a></p>
-                <p><strong>IMPORTANT - Please Note:</strong></p>
-                <p></font><font FACE="TAHOMA,VERDANA,HELVETICA,ARIAL" SIZE="2" COLOR="#000000"><strong>AgoraCart</strong>
-                is based on Selena Sol's 'Web Store' program, available at <a
-                href="http://www.extropia.com/">Extropia.com</a></font><font face="arial" size="2"
-                color="#000000">, as well as the Commerce.cgi program from <a
-                href="http://www.careyinternet.com/">Carey Internet Services</a>.&nbsp; The software has
-                split off from the commerce.cgi source tree (2.0beta1) and begun adding significant
-                enhancements suggested by users as well as many found as &quot;cool hacks&quot; available
-                for the 'Web Store' program.&nbsp;&nbsp; The
-                <strong>AgoraCart, AgoraCartPro, AgoracgiPro, Agora.cgi, Agora,</strong> and
-                <strong>Agoracgi</strong>
-                names and software package are copyright 1999-2003  K-Factor Technologies, Inc. at <a
-		href="http://www.agoracart.com/">AgoraCart.com</a>.
-                <br><br>
-                This is <strong>AgoraCart %%agoracgi_ver%%</strong> 
-                and is distributed according to the GNU General
-                Public License Version 2. Basically, you use this software at your own risk. <strong>It is
-                offered without support or warranty of any kind.</strong> <a
-                href="%%storeURL%%?page=license.html">Click here</a> to 
-                view the license.<br>
-                <br>
-                Agora.cgi is open source freeware and is distributed <strong>without support</strong>.
-                &nbsp; AgoraCart.com does maintain a <a href="http://www.agoracart.com">Pro Member Area and Mailing
-                List</a>, it is only a $59.95 for Lifetime or $29.95 per year.  We rely heavily on the 
-                AgoraCart/Agora.cgi community to support itself. If you find this
-                product useful to you, we hope that you will subscribe to
-                the the list and perhaps even help someone else on
-                the Mailing List. Thanks! <font FACE="TAHOMA,VERDANA,HELVETICA,ARIAL" SIZE="2"
-                COLOR="#000000"><!--END--></font></font></font></td>
-              </tr>
-            </table>
-            </div></td>
+            <td  class="template_mainbackground"><span class="style6"><span class="style7">See What's inside our Store:</span></span></td>
           </tr>
-        </table>
-        </center></div></td>
-      </tr>
-      <tr>
-        <td></td>
-        <td></td>
-      </tr>
-    </table>
-    </center></div></td>
-  </tr>
+  <tr>
+	<td>
+<table width="100%" border="0" align="center" cellpadding="3" bgcolor="#FFFFFF">
+  <tr>
+	<td valign=top width="25%"><center><font face=arial size="2">In $special1[1]:<br><br></font>
+    <a href="agora.cgi?cart_id=&amp;p_id=$special1[0]&amp;xm=on">
+	<img class="template_image_no_border" src="%%URLofImages%%/$image1" alt="$image1"></a></center></td>
+
+	<td valign=top width="25%"><center><font face=arial size="2">In $special2[1]:<br><br></font>
+    <a href="agora.cgi?cart_id=&amp;p_id=$special2[0]&amp;xm=on">
+	<img class="template_image_no_border"  src="%%URLofImages%%/$image2" alt="$image2"></a></center></td>
+
+	<td valign=top width="25%"><center><font face=arial size="2">In $special3[1]:<br><br></font>
+    <a href="agora.cgi?cart_id=&amp;p_id=$special3[0]&amp;xm=on">
+	<img class="template_image_no_border" src="%%URLofImages%%/$image3" alt="$image3"></a></center></td>
+
+	<td valign=top width="25%"><center><font face=arial size="2">In $special4[1]:<br><br></font>
+    <a href="agora.cgi?cart_id=&amp;p_id=$special4[0]&amp;xm=on">
+	<img class="template_image_no_border" src="%%URLofImages%%/$image4" alt="$image4"></a></center></td>
+
+	</tr><tr>
+
+	<td valign=top width="25%"><center><font face=arial size="2">
+	<a href="agora.cgi?cart_id=&amp;p_id=$special1[0]&amp;xm=on">$special1[3]</a></font></center></td>
+
+	<td valign=top width="25%"><center><font face=arial size="2">
+	<a href="agora.cgi?cart_id=&amp;p_id=$special2[0]&amp;xm=on">$special2[3]</a></font></center></td>
+
+	<td valign=top width="25%"><center><font face=arial size="2">
+	<a href="agora.cgi?cart_id=&amp;p_id=$special3[0]&amp;xm=on">$special3[3]</a></font></center></td>
+
+	<td valign=top width="25%"><center><font face=arial size="2">
+	<a href="agora.cgi?cart_id=&amp;p_id=$special4[0]&amp;xm=on">$special4[3]</a></font></center></td>
+
+	</tr><tr>
+
+	<td valign=top width="25%"><center><font face=arial size="2">
+		<b><font color="FF0000">Only $sc_money_symbol $special1[2]<\/font></b></font></center></td>
+
+	<td valign=top width="25%"><center><font face=arial size="2">
+		<b><font color="FF0000">Only $sc_money_symbol $special2[2]</font></b></font></center></td>
+
+	<td valign=top width="25%"><center><font face=arial size="2">
+		<b><font color=\"FF0000\">Only $sc_money_symbol $special3[2]<\/font><\/b><\/font></center><\/td>
+
+	<td valign=top width="25%"><center><font face=arial size="2">
+		<b><font color="FF0000">Only $sc_money_symbol $special4[2]</font></b></font></center></td>
+
+	</tr>
+</table></td>
+	</tr>
 </table>
-</center></div>
+~; &uncapture_STDOUT;
+-->
+<br>
+	<div class="ac_vertical_links">
+		<ul>
+			<li><a href="http://www.Agoraguide.com/faq/">Free User Forum</a></li>
+			<li><a href="http://www.agoracartpro.com/">AgoraCartPro.com</a></li>
+			<li><a href="http://www.agoracart.com/download/">Downloads</a></li>
+			<li><a href="http://www.agoracart.com/agorawiki/">User Manuals &amp; Guides</a></li>
+			<li><a href="http://www.agoracart.com/pages/Authorized_Solutions_Providers/">Authorized Solutions Providers (ASPP)</a></li>
+			<li><a href="http://www.AgoraXChange.com/">Hire Freelancers at AgoraXchange.com</a></li>
+			<li><a href="http://www.agoracart.com/pages/Shopping/">Shop other AgoraCart Stores</a></li>
+			<li><a href="http://www.agoracart.com/">the Official AgoraCart Web Site</a></li>
+		</ul>
+	</div>
+
+	<p>Features include: Web-based administration, UPS or fixed-rate shipping, Spreadsheet/Database import of store catalog, PGP/GnuPG ready, Feature-Packed online Store Manager, and much more!</p>
+
+<br>
+
+	<p>
+		The page you are currently viewing is called <strong>index.html</strong> and resides in the <strong>/html</strong>
+		sub directory. You should ONLY be viewing this page by accessing <strong>agora.cgi</strong>, NOT by linking
+		directly to this page. By default, <strong>AgoraCart</strong> loads this page as the homepage.
+	</p>
+	<p>
+		Download the source and view the source code for this page (Don't just view the source code through the web browser
+		or this part won't make sense). Notice the code for the category links above and to the left. For example,
+		<strong>agora.cgi?product=java&amp;cart_id=</strong> displays all of the products from the database that are in the
+		<strong>java</strong> category. The 'cart id=' tells the script to add in the numeric cart id when the page is
+		parsed through the script. In other words, the cart id IS NOT hardcoded into the source code of the page, but is
+		added dynamically to the page when it is displayed. This makes the script more accessible to users that do not
+		accept cookies.
+	</p>
+
+
+	<h3>Linking to Your Store</h3>
+
+	<p>
+		Linking to your store is fairly easy and you can link from jsut about anywhere.  Here are the most common way
+		to link to your store:
+	</p>
+	<p>
+		Link to a category:<br>
+		http://www.yourname.com/store/agora.cgi?product=java<br>
+		This will show all the products in the java category.  to limit this to java and java only add this to the
+		end of the URL: &amp;xm=on
+	</p>
+
+	<p>
+		Link to a category with specific page layout:<br>
+		http://www.yourname.com/store/agora.cgi?product=java&amp;ppinc=4a<br>
+		This will show all the products in the java category using the productPage-4a.inc file which shows products
+		4 across with minimal information with additional links
+	</p>
+
+	<p>
+		Link to a specific product (number is exact database number for product):<br>
+		http://www.yourname.com/store/agora.cgi?p_id=00125<br>
+		This will show a single product with the database number 00125
+	</p>
+
+	<p>
+		Link to a specific page (product page):<br>
+		http://www.yourname.com/store/agora.cgi?page=java.html<br>
+		if you wish to have static pages, design and upload to the html/pages sub directory and use the linking method
+		to access that page directly.
+	</p>
+
+
+
+	<h3>Store Manager</h3>
+
+	<p>
+		Store Manager can be accessed <a href="protected/manager.cgi" target="_TOP">here</a>. Please note, on similar
+		scripts you need to use this syntax <strong>manager.cgi?welcome_screen=yes</strong>
+	</p>
+	<p>
+		If you use only <strong>manager.cgi</strong>, this script automatically loads the welcome screen!
+		Error-detection/recovery has also been enhanced.
+	</p>
+	<p>
+		Bookmark your Store Manager link, and make sure to remove the link displayed above when you re-design this page.
+	</p>
+
+
+
+	<h3>Editing the Look of Your Store</h3>
+
+	<p>
+		To edit the look of the store, you may download the basic header footer manager at
+		<a href="http://www.agoracart.com/download/basicheader.zip">http://www.agoracart.com/download.htm</a>
+		which will edit the store look using this same look.  If you wish to edit the look yourself, you must manually
+		edit the store_header.inc, store_footer.inc, secure_store_header.inc, and secure_store_footer.inc files found in
+		the html/html-templates sub directory of your store, as well as edit the index.html file found in the html sub
+		directory of your store.  An options editor to add simple options to your database products is also available at
+		<a href="http://www.agoracart.com/download/simple.zip">http://www.agoracart.com/download.htm</a>
+	</p>
+
+
+
+	<h3>IMPORTANT - Please Note:</h3>
+
+	<p>
+		<strong>AgoraCart</strong> is based on Selena Sol's 'Web Store' program, available at
+		<a href="http://www.extropia.com/">Extropia.com</a>, as well as the Commerce.cgi program from
+		<a href="http://www.careyinternet.com/">Carey Internet Services</a>. The software has split off from the
+		commerce.cgi source tree (2.0beta1) and begun adding significant enhancements suggested by users as well as many
+		found as &quot;cool hacks&quot; available for the 'Web Store' program. The <strong>AgoraCart, AgoraCartPro,
+		AgoracgiPro, Agora.cgi, Agora,</strong> and <strong>Agoracgi</strong> names and software package are copyright
+		1999-2004 K-Factor Technologies, Inc. at <a href="http://www.agoracart.com/">AgoraCart.com</a>.
+	</p>
+
+	<p>
+		This is <strong>AgoraCart %%agoracgi_ver%%</strong> and is distributed according to the
+		<a href="agora.cgi?page=license.html">GNU General Public License Version 2</a>. Basically, you use this software
+		at your own risk. <strong>It is offered without support or warranty of
+		any kind.</strong>
+	</p>
+
+	<p>
+		Agora.cgi is open source freeware and is distributed <strong>without support</strong>. AgoraCart.com does maintain
+		a <a href="http://www.agoracart.com">Pro Member Area and Mailing List</a>, it is only a $59.95 for Lifetime or
+		$29.95 per year. We rely heavily on the AgoraCart/Agora.cgi community to support itself. If you find this product
+		useful to you, we hope that you will subscribe to the the list and perhaps even help someone else on the Mailing
+		List. Thanks!
+	<p></div>
+
 %%StoreFooter%%
 </body>
 </html>
diff -ruN 4.0K-4b/html/options/backpack.html 5.0.000/html/options/backpack.html
--- 4.0K-4b/html/options/backpack.html	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/options/backpack.html	2006-10-31 09:40:27.000000000 -0600
@@ -1,16 +1,21 @@
 <HTML>
 <TITLE>Backpack Option</TITLE>
 <BODY>
- <h3>--cut here--</h3>
- <TABLE CELLPADDING="0" CELLSPACING="0">
-   <TR ALIGN="CENTER"><TD><SELECT
-	NAME = "option|002|%%PRODUCT_ID%%">
-    <OPTION VALUE = "|">Accessories
-    <OPTION VALUE = "Book Bag|4.95">Book Bag (+$4.95)
-    <OPTION VALUE = "Backpack|9.95">Backpack (+$9.95)
-    <OPTION VALUE = "Bookcase|9.95">Bookcase (+$9.95)
-    </SELECT></TD></TR>
-  </TABLE>
-<h3>--cut here--</h3>
+
+	<h3>--cut here--</h3>
+	<table cellpadding="0" cellspacing="0">
+  	<tr>
+  		<td>
+  			<select name="option|002|%%PRODUCT_ID%%" class="opt_select">
+					<option value="|">Accessories</option>
+					<option value="Book Bag|4.95">Book Bag (+$4.95)</option>
+					<option value="Backpack|9.95">Backpack (+$9.95)</option>
+					<option value="Bookcase|9.95">Bookcase (+$9.95)</option>
+    		</select>
+    	</td>
+    </tr>
+  </table>
+	<h3>--cut here--</h3>
+
 </BODY>
 </HTML>
diff -ruN 4.0K-4b/html/options/ewerqwr.html 5.0.000/html/options/ewerqwr.html
--- 4.0K-4b/html/options/ewerqwr.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/options/ewerqwr.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,2 @@
+<table border="0"><tr><td><p align="right"><font size="2" face="Arial">
+</font></td></tr></table>
diff -ruN 4.0K-4b/html/options/ext_warranty.html 5.0.000/html/options/ext_warranty.html
--- 4.0K-4b/html/options/ext_warranty.html	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/options/ext_warranty.html	1969-12-31 18:00:00.000000000 -0600
@@ -1,44 +0,0 @@
-<HTML>
-<TITLE>Extended Warranty Option</TITLE>
-<BODY>
- <pre>
-this part never gets displayed, it is above the cut here tag.
-This allows the software to be more easily edited by
-html editors or commented well. :)
-
-This example of an option file sets the price of the extended warranty 
-as a percentage of the original price using the %%eval()%% mechanism. 
- </pre>
-
- <h3>--cut here--</h3>
-<!--agorascript-post &parse_options_to_verify(q^ AGSC-->
- <TABLE CELLPADDING="0" CELLSPACING="0">
-  <TR ALIGN="CENTER"><TD><FONT FACE=ARIAL SIZE="2">
-   <B>Choose your Warranty %%cost%%</B>
-   <br>
-   </FONT></TD></TR>
-  <TR ALIGN="CENTER"><TD>
-  <SELECT NAME = "option|003|%%PRODUCT_ID%%">
-    <OPTION VALUE = "90 Day Warr.|0">90 Day Warranty
-    <OPTION 
-VALUE = "1 Yr Ext. Warr.|%%eval(&format_price(0.1*%%cost%%))%%"
->1 Year (+%%eval(&display_price_nospaces($myans))%%)
-    <OPTION 
-VALUE = "3 Yr Ext. Warr.|%%eval(&format_price(0.25*%%cost%%))%%"
->3 Years (+%%eval(&display_price_nospaces($myans))%%)
-  </SELECT></TD></TR>
-  </TABLE>
-<!--AGSC ^); -->
-<!--agorascript-post {
- my $inx,$out;
- $out="<table border=1 width=150><tr><td>opt
-key</td><td>value</td></tr>\n";
- foreach $inx (keys %item_opt_verify) {
-  $out .= "<tr><td>$inx</td><td>$item_opt_verify{$inx}</td></tr>\n";
- }
- return $out . "</table>\n";}  -->
-  <h3>--cut here--</h3>
-  more junk here that is discarded.
-</BODY>
-</HTML>
-
diff -ruN 4.0K-4b/html/options/gift_option.html 5.0.000/html/options/gift_option.html
--- 4.0K-4b/html/options/gift_option.html	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/options/gift_option.html	2006-10-31 09:40:27.000000000 -0600
@@ -2,15 +2,24 @@
 <TITLE>Gift Option</TITLE>
 <BODY>
 load two option files and frames them in a table
+
 <h3>--cut here--</h3>
-<TABLE CELLPADDING="0" CELLSPACING="0">
-<TR ALIGN="CENTER">
-<TD><FONT FACE=ARIAL SIZE="2">
-<B>Select Accessories</B>
-</FONT></TD></TR>
-<tr><td>%%Load_Option_file giftboxwrap.html%%</td></tr>
-<tr><td>%%Load_Option_file backpack.html%%</td></tr>
-</TABLE>
+	<table cellpadding="0" cellspacing="0" class="opt_center">
+		<tr>
+			<th>Select Accessories</th>
+		</tr>
+		<tr>
+			<td>
+				%%Load_Option_file giftboxwrap.html%%
+			</td>
+		</tr>
+		<tr>
+			<td>
+				%%Load_Option_file backpack.html%%
+			</td>
+		</tr>
+	</table>
 <h3>--cut here--</h3>
+
 </BODY>
 </HTML>
diff -ruN 4.0K-4b/html/options/giftboxwrap.html 5.0.000/html/options/giftboxwrap.html
--- 4.0K-4b/html/options/giftboxwrap.html	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/options/giftboxwrap.html	2006-10-31 09:40:27.000000000 -0600
@@ -1,16 +1,21 @@
 <HTML>
 <TITLE>Gift Wrap and Box Option</TITLE>
 <BODY>
- <h3>--cut here--</h3>
- <TABLE CELLPADDING="0" CELLSPACING="0">
-  <TR ALIGN="CENTER"><TD><SELECT 
-	NAME = "option|001|%%PRODUCT_ID%%">
-    <OPTION VALUE = "|">Gift Options
-    <OPTION VALUE = "Gift Card|1.00"> Gift Card (+$1.00)
-    <OPTION VALUE = "Gift Wrap|2.50"> Gift Wrap (+$2.50)
-    <OPTION VALUE = "Gift Box|3.50"> Gift Box (+$3.50)
-    </SELECT></TD></TR>
-  </TABLE>
-<h3>--cut here--</h3>
+
+	<h3>--cut here--</h3>
+	<table cellpadding="0" cellspacing="0">
+ 		<tr>
+  		<td>
+  		<select name="option|001|%%PRODUCT_ID%%" class="opt_select">
+  			<option value="|">Gift Options</option>
+				<option value="Gift Card|1.00|10"> Gift Card (+$1.00)</option>
+				<option value="Gift Wrap|2.50"> Gift Wrap (+$2.50)</option>
+				<option value="Gift Box|3.50"> Gift Box (+$3.50)</option>
+    	</select>
+   		</td>
+  	</tr>
+  </table>
+  <h3>--cut here--</h3>
+
 </BODY>
 </HTML>
diff -ruN 4.0K-4b/html/options/sizes_opt.html 5.0.000/html/options/sizes_opt.html
--- 4.0K-4b/html/options/sizes_opt.html	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/options/sizes_opt.html	2006-10-31 09:40:27.000000000 -0600
@@ -7,7 +7,7 @@
 
 The all have the same option number, but the are associated with
 'different' products, the thing in quotes (sm,md or lg) is tacked
-on to product id number in the browser text (putting the contents of 
+on to product id number in the browser text (putting the contents of
 the global variable $sc_web_pid_sep_char in between.)
 </PRE>
 
@@ -16,19 +16,35 @@
 $suppress_qty_box = "yes"; # we make our own boxes
 return "";
 -->
-
-<table width='100%' cellspacing=0 cellpadding=0><tr>
-<td colspan=2>Available sizes:</td>
-</tr><tr>
-<td align=left><INPUT TYPE=HIDDEN NAME = "option|005|%%prodID-sm%%" 
-VALUE='Small|0.00'>%%QtyBox-sm,%%</td><td>Small (No extra charge)</td>
-</tr><tr>
-<td align=left><INPUT TYPE=HIDDEN NAME = "option|005|%%prodID-md%%" 
-VALUE='Medium|1.00'>%%QtyBox-md,%%</td><td>Medium $ 1.00</td>
-</tr><tr>
-<td align=left><INPUT TYPE=HIDDEN NAME = "option|005|%%prodID-lg%%" 
-VALUE='Large|2.00'>%%QtyBox-lg,%%</td><td>Large $ 2.00</td>
-</tr></table>
+	<table cellspacing=0 cellpadding=0 class="no_border">
+		<tr>
+			<th colspan=2 class="no_border">Available Sizes</th>
+		</tr>
+		<tr>
+			<td class="no_border">
+				<input type="hidden" name="option|005|%%prodID-sm%%" value="Small|0.00">%%QtyBox-sm,%%
+			</td>
+			<td class="no_border">
+				Small (No extra charge)
+			</td>
+		</tr>
+		<tr>
+			<td class="no_border">
+				<input type="hidden" name="option|005|%%prodID-md%%" value="Medium|1.00">%%QtyBox-md,%%
+			</td>
+			<td class="no_border">
+				Medium $ 1.00
+			</td>
+		</tr>
+		<tr>
+			<td class="no_border">
+				<input type="hidden" name="option|005|%%prodID-lg%%" value="Large|2.00">%%QtyBox-lg,%%
+			</td>
+			<td class="no_border">
+				Large $ 2.00
+			</td>
+		</tr>
+	</table>
 <h3>--cut here--</h3>
 
 </BODY>
diff -ruN 4.0K-4b/html/options/var_opt.html 5.0.000/html/options/var_opt.html
--- 4.0K-4b/html/options/var_opt.html	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/options/var_opt.html	2006-10-31 09:40:27.000000000 -0600
@@ -1,32 +1,49 @@
-<HTML><TITLE>Variable Option - QTY Disc.</TITLE><BODY>
+<HTML>
+<TITLE>Variable Option - QTY Disc.</TITLE><BODY>
 <PRE>
-Example of a 'variable option' that depends on a quantity of 
-things with a single product id number regardless of the 
-options selected with it.  
+Example of a 'variable option' that depends on a quantity of
+things with a single product id number regardless of the
+options selected with it.
 
-The token %%prodID-*%% is a wildcard, the modifier * means match 
-all product ids no matter what the modifier.  If combined with 
+The token %%prodID-*%% is a wildcard, the modifier * means match
+all product ids no matter what the modifier.  If combined with
 the modifier style variable options then it will match up with
-all of them when added to the cart.  
+all of them when added to the cart.
 
 Similar to the 004_var_opt.html file.
 
 </PRE>
 <h3>--cut here--</h3>
-<!--agorascript-add-to-cart-opt-005 { 
+<!--agorascript-add-to-cart-opt-005 {
 # enable variable option code unconditionally
 # first thing is this option file name, next is the agorascript to run
 $item_user1 .= "var_opt_wild.html,variable-option-005;";}
 -->
 
-<INPUT TYPE=HIDDEN NAME = "option|005|%%prodID-*%%" VALUE='Var005'>
-<TABLE WIDTH=45 CELLSPACING=0 CELLPADDING=0 BORDER=1>
-<TR><TH>Quantity</TH><TH>Discount</TH></TR>
-<TR><TD>100+</TD>  <TD>20%</TD></TR>
-<TR><TD>50-99</TD> <TD>15%</TD></TR>
-<TR><TD>25-49</TD> <TD>10%</TD></TR>
-<TR><TD>10-24</TD> <TD>5%</TD></TR>
-</TABLE>
+<input type="hidden" name="option|005|%%prodID-*%%" value="Var005">
+<table cellspacing="0" cellpadding="0" class="opt_border">
+	<tr>
+		<th class="opt_border">Quantity</th>
+		<th class="opt_border">Discount</th>
+	</tr>
+	<tr>
+		<td class="opt_border">100+</td>
+		<td class="opt_border">20%</td>
+	</tr>
+	<tr>
+		<td class="opt_border">50-99</td>
+		<td class="opt_border">15%</td>
+	</tr>
+	<tr>
+		<td class="opt_border">25-49</td>
+		<td class="opt_border">10%</td>
+	</tr>
+	<tr>
+		<td class="opt_border">10-24</td>
+		<td class="opt_border">5%</td>
+	</tr>
+</table>
+
 <h3>--cut here--</h3>
 <!--agorascript-variable-option-005 {
 local ($qty) = $cart_row[$cart{'quantity'}];
@@ -54,5 +71,5 @@
 if ($myopt ne '') {$cart_row_options{'005'} = $myopt;}
 } -->
 
-</BODY>
-</HTML>
+</body>
+</html>
diff -ruN 4.0K-4b/html/options/var_opt_wild.html 5.0.000/html/options/var_opt_wild.html
--- 4.0K-4b/html/options/var_opt_wild.html	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/options/var_opt_wild.html	2006-10-31 09:40:27.000000000 -0600
@@ -1,32 +1,47 @@
-<HTML><TITLE>Variable Option - QTY Disc.</TITLE><BODY>
+<HTML>
+<TITLE>Variable Option - QTY Disc.</TITLE><BODY>
 <PRE>
-Example of a 'variable option' that depends on a quantity of 
-things with a single product id number regardless of the 
-options selected with it.  
+Example of a 'variable option' that depends on a quantity of
+things with a single product id number regardless of the
+options selected with it.
 
-The token %%prodID-*%% is a wildcard, the modifier * means match 
-all product ids no matter what the modifier.  If combined with 
+The token %%prodID-*%% is a wildcard, the modifier * means match
+all product ids no matter what the modifier.  If combined with
 the modifier style variable options then it will match up with
-all of them when added to the cart.  
-
-Similar to the 004_var_opt.html file.
+all of them when added to the cart.
 
 </PRE>
 <h3>--cut here--</h3>
-<!--agorascript-add-to-cart-opt-005 { 
+<!--agorascript-add-to-cart-opt-005 {
 # enable variable option code unconditionally
 # first thing is this option file name, next is the agorascript to run
 $item_user1 .= "var_opt_wild.html,variable-option-005;";}
 -->
 
-<INPUT TYPE=HIDDEN NAME = "option|005|%%prodID-*%%" VALUE='Var005'>
-<TABLE WIDTH=45 CELLSPACING=0 CELLPADDING=0 BORDER=1>
-<TR><TH>Quantity</TH><TH>Discount</TH></TR>
-<TR><TD>100+</TD>  <TD>20%</TD></TR>
-<TR><TD>50-99</TD> <TD>15%</TD></TR>
-<TR><TD>25-49</TD> <TD>10%</TD></TR>
-<TR><TD>10-24</TD> <TD>5%</TD></TR>
-</TABLE>
+<input type="hidden" name="option|005|%%prodID-*%%" value="Var005">
+<table cellspacing="0" cellpadding="0" class"opt_border">
+	<tr>
+		<th class="opt_border">Quantity</th>
+		<th class="opt_border">Discount</th>
+	</tr>
+	<tr>
+		<td class="opt_border">100+</td>
+		<td class="opt_border">20%</td>
+	</tr>
+	<tr>
+		<td class="opt_border">50-99</td>
+		<td class="opt_border">15%</td>
+	</tr>
+	<tr>
+		<td class="opt_border">25-49</td>
+		<td class="opt_border">10%</td>
+	</tr>
+	<tr>
+		<td class="opt_border">10-24</td>
+		<td class="opt_border">5%</td>
+	</tr>
+</table>
+
 <h3>--cut here--</h3>
 <!--agorascript-variable-option-005 {
 local ($qty) = $cart_row[$cart{'quantity'}];
@@ -46,13 +61,12 @@
   ($xqty,$xpid,$junk) = split(/\|/,$cart_copy{$inx},3);
   if ($xpid == $cart_row[$cart{'product_id'}]) {$qty = $qty + $xqty;}
  }
-   if ($qty > 99) {$myopt = '20% Qty Disc.|' . ((-0.20)*$price);}
-elsif ($qty > 49) {$myopt = '15% Qty Disc.|' . ((-0.15)*$price);}
-elsif ($qty > 24) {$myopt = '10% Qty Disc.|' . ((-0.10)*$price);}
-elsif ($qty > 9)  {$myopt = ' 5% Qty Disc.|' . ((-0.05)*$price);}
+   if ($qty > 99) {$myopt = '20% Qty Disc.|' . &format_price((-0.20)*$price);}
+elsif ($qty > 49) {$myopt = '15% Qty Disc.|' . &format_price((-0.15)*$price);}
+elsif ($qty > 24) {$myopt = '10% Qty Disc.|' . &format_price((-0.10)*$price);}
+elsif ($qty > 9)  {$myopt = ' 5% Qty Disc.|' . &format_price((-0.05)*$price);}
 }
 if ($myopt ne '') {$cart_row_options{'005'} = $myopt;}
 } -->
-
-</BODY>
-</HTML>
+</body>
+</html>
diff -ruN 4.0K-4b/html/options/var_opt_wild2.html 5.0.000/html/options/var_opt_wild2.html
--- 4.0K-4b/html/options/var_opt_wild2.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/options/var_opt_wild2.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,135 @@
+<HTML><TITLE>Variable Option - QTY Disc.</TITLE><BODY> 
+<PRE> 
+
+
+</PRE> 
+<h3>--cut here--</h3> 
+<!--agorascript-add-to-cart-opt-005 { 
+# enable variable option code unconditionally 
+# first thing is this option file name, next is the agorascript to run 
+$item_user1 .= "var_opt_wild2.html,variable-option-005;";} 
+--> 
+<!--agorascript-add-to-cart-opt-006 { 
+# enable variable option code unconditionally 
+# first thing is this option file name, next is the agorascript to run 
+$item_user1 .= "var_opt_wild2.html,variable-option-006;";} 
+--> 
+<!--agorascript-add-to-cart-opt-007 { 
+# enable variable option code unconditionally 
+# first thing is this option file name, next is the agorascript to run 
+$item_user1 .= "var_opt_wild2.html,variable-option-007;";} 
+--> 
+
+<INPUT TYPE=HIDDEN NAME = "option|005|%%prodID-sm%%" VALUE='Var005'> 
+<INPUT TYPE=HIDDEN NAME = "option|006|%%prodID-md%%" VALUE='Var006'> 
+<INPUT TYPE=HIDDEN NAME = "option|007|%%prodID-lg%%" VALUE='Var007'> 
+
+<TABLE WIDTH=45 CELLSPACING=0 CELLPADDING=0 BORDER=1> 
+<TR><TH>Quantity</TH><TH>Discount</TH></TR> 
+<TR><TD>100+</TD>  <TD>20%</TD></TR> 
+<TR><TD>50-99</TD> <TD>15%</TD></TR> 
+<TR><TD>25-49</TD> <TD>10%</TD></TR> 
+<TR><TD>10-24</TD> <TD>5%</TD></TR> 
+</TABLE> 
+
+<!--agorascript-pre # needs to be inside the cut-here tags to be run! 
+$suppress_qty_box = "yes"; # we make our own boxes 
+return ""; 
+-->
+
+<table width='100%' cellspacing=0 cellpadding=0><tr> 
+<td colspan=2>Available sizes:</td> 
+</tr><tr> 
+<td align=left><INPUT TYPE=HIDDEN NAME = "option|001|%%prodID-sm%%" 
+VALUE='Small|10.00'>%%QtyBox-sm%%</td><td>Small $10.00</td> 
+</tr><tr> 
+<td align=left><INPUT TYPE=HIDDEN NAME = "option|002|%%prodID-md%%" 
+VALUE='Medium|11.00'>%%QtyBox-md%%</td><td>Medium $ 11.00</td> 
+</tr><tr> 
+<td align=left><INPUT TYPE=HIDDEN NAME = "option|003|%%prodID-lg%%" 
+VALUE='Large|12.00'>%%QtyBox-lg%%</td><td>Large $ 12.00</td> 
+</tr></table> 
+<h3>--cut here--</h3> 
+
+<!--agorascript-variable-option-005 { 
+local ($qty) = $cart_row[$cart{'quantity'}]; 
+local ($price) = $cart_row[$cart{'price'}]; 
+local ($myopt) = '';undef($cart_row_options{'005'}); 
+if ($var_opt_action eq 'reset') { 
+  # So that cart sorting can take place, reset the name 
+  # MUST BE exactly the same name as the hidden var above 
+  $myopt = 'Var005'; 
+ } else { 
+# For the calc function, we have the cart copy loaded, find qty 
+# for all products with same id, not just those of this opt # 
+# or those with the same options (sort of a mix n match). 
+$qty = 0; 
+local ($xqty,$xpid,$xproduct,$xprice,$xname,$ximage,$xshipping,$xshipping_calc_flag,$xoptions_ids,$xuser1,$xuser2,$xuser3,$xuser4,$xuser5,$xuser6,$xoptions,$junk); 
+foreach $inx (keys(%cart_copy)) { 
+#  ($xqty,$xpid,$junk) = split(/\|/,$cart_copy{$inx},3); #original style
+  ($xqty,$xpid,$xproduct,$xprice,$xname,$ximage,$xshipping,$xshipping_calc_flag,$xoptions_ids,$junk) = split(/\|/,$cart_copy{$inx},10); 
+  if (($xpid == $cart_row[$cart{'product_id'}]) && ($xoptions_ids =~ /001/)) {$qty = $qty + $xqty;} 
+ } 
+   if ($qty > 99) {$myopt = '20% Qty Disc.|' . &format_price((-0.20)*$price);} 
+elsif ($qty > 49) {$myopt = '15% Qty Disc.|' . &format_price((-0.15)*$price);} 
+elsif ($qty > 24) {$myopt = '10% Qty Disc.|' . &format_price((-0.10)*$price);} 
+elsif ($qty > 9)  {$myopt = ' 5% Qty Disc.|' . &format_price((-0.05)*$price);} 
+} 
+if ($myopt ne '') {$cart_row_options{'005'} = $myopt;} 
+} --> 
+
+<!--agorascript-variable-option-006 { 
+local ($qty) = $cart_row[$cart{'quantity'}]; 
+local ($price) = $cart_row[$cart{'price'}]; 
+local ($myopt) = '';undef($cart_row_options{'006'}); 
+if ($var_opt_action eq 'reset') { 
+  # So that cart sorting can take place, reset the name 
+  # MUST BE exactly the same name as the hidden var above 
+  $myopt = 'Var006'; 
+ } else { 
+# For the calc function, we have the cart copy loaded, find qty 
+# for all products with same id, not just those of this opt # 
+# or those with the same options (sort of a mix n match). 
+$qty = 0; 
+local ($xqty,$xpid,$junk); 
+foreach $inx (keys(%cart_copy)) { 
+#  ($xqty,$xpid,$junk) = split(/\|/,$cart_copy{$inx},3); #original style
+  ($xqty,$xpid,$xproduct,$xprice,$xname,$ximage,$xshipping,$xshipping_calc_flag,$xoptions_ids,$junk) = split(/\|/,$cart_copy{$inx},10); 
+  if (($xpid == $cart_row[$cart{'product_id'}]) && ($xoptions_ids =~ /002/)) {$qty = $qty + $xqty;} 
+ } 
+   if ($qty > 99) {$myopt = '20% Qty Disc.|' . &format_price((-0.20)*$price);} 
+elsif ($qty > 49) {$myopt = '15% Qty Disc.|' . &format_price((-0.15)*$price);} 
+elsif ($qty > 24) {$myopt = '10% Qty Disc.|' . &format_price((-0.10)*$price);} 
+elsif ($qty > 9)  {$myopt = ' 5% Qty Disc.|' . &format_price((-0.05)*$price);} 
+} 
+if ($myopt ne '') {$cart_row_options{'006'} = $myopt;} 
+} --> 
+
+<!--agorascript-variable-option-007 { 
+local ($qty) = $cart_row[$cart{'quantity'}]; 
+local ($price) = $cart_row[$cart{'price'}]; 
+local ($myopt) = '';undef($cart_row_options{'007'}); 
+if ($var_opt_action eq 'reset') { 
+  # So that cart sorting can take place, reset the name 
+  # MUST BE exactly the same name as the hidden var above 
+  $myopt = 'Var007'; 
+ } else { 
+# For the calc function, we have the cart copy loaded, find qty 
+# for all products with same id, not just those of this opt # 
+# or those with the same options (sort of a mix n match). 
+$qty = 0; 
+local ($xqty,$xpid,$junk); 
+foreach $inx (keys(%cart_copy)) { 
+#  ($xqty,$xpid,$junk) = split(/\|/,$cart_copy{$inx},3); #original style
+  ($xqty,$xpid,$xproduct,$xprice,$xname,$ximage,$xshipping,$xshipping_calc_flag,$xoptions_ids,$junk) = split(/\|/,$cart_copy{$inx},10); 
+  if (($xpid == $cart_row[$cart{'product_id'}]) && ($xoptions_ids =~ /003/)) {$qty = $qty + $xqty;} 
+ } 
+   if ($qty > 99) {$myopt = '20% Qty Disc.|' . &format_price((-0.20)*$price);} 
+elsif ($qty > 49) {$myopt = '15% Qty Disc.|' . &format_price((-0.15)*$price);} 
+elsif ($qty > 24) {$myopt = '10% Qty Disc.|' . &format_price((-0.10)*$price);} 
+elsif ($qty > 9)  {$myopt = ' 5% Qty Disc.|' . &format_price((-0.05)*$price);} 
+} 
+if ($myopt ne '') {$cart_row_options{'007'} = $myopt;} 
+} --> 
+</BODY> 
+</HTML>
\ No newline at end of file
diff -ruN 4.0K-4b/html/pages/CancelPayment.html 5.0.000/html/pages/CancelPayment.html
--- 4.0K-4b/html/pages/CancelPayment.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/pages/CancelPayment.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>
+	AgoraCart %%agoracgi_ver%%
+</title>
+%%head_info%%
+</head>
+
+<body>
+%%StoreHeader%%
+<div align="center" style="text-align:justify; padding: 20px 20px 20px 20px;">
+
+	<p>
+		We are sorry you are having problems, please contact us to make other arrangements.
+	</p>
+	<p>
+
+<!--insert contact information here ... or use the code below and make sure the TOS address is correct for your main/primary payment gateway-->
+
+        <!--agorascript-pre
+             &capture_STDOUT; 
+print qq~ $sc_tos_display_address
+~;
+             &uncapture_STDOUT;
+         -->
+	</p>
+
+
+</div>
+%%StoreFooter%%
+</body>
+</html>
+
diff -ruN 4.0K-4b/html/pages/discountdirections.html 5.0.000/html/pages/discountdirections.html
--- 4.0K-4b/html/pages/discountdirections.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/pages/discountdirections.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,50 @@
+<HTML>
+<HEAD>
+<TITLE>Notes on Adding a new Discount Code(s)</TITLE>
+</HEAD>
+<body onLoad="setTimeout('window.close()',55000)">
+<font face="Arial,Helvetica" size=2>
+<CENTER>
+<table border=1 CELLPADDING=1 CELLSPACING=0 WIDTH=580>
+<tr>
+<td colspan=2 align=center><b>Notes on Adding a new Discount Code</b></td>
+</tr>
+<tr>
+<td width=100><b>Discount Code:</b></td>
+<td width=480>The Discount Code can be any alpha numeric string. Is NOT case sensitive.</td>
+</tr>
+<tr>
+<td><b>Subtotal Range:</b></td>
+<td>The discount will be applied only if the subtotal falls
+	in the range entered.<br><small>Examples (10.99-25.99, 10-, -100) The first applies the discount
+	if it is between 10.99 and 25.99. The second applies it if the subtotal greater than 10 and the
+	third applies it if the subtotal is less than 100.</small></td>
+</tr>
+<tr>
+<td><b>Quantity Range:</b></td>
+<td>The discount will be applied only if the quantity ordered falls
+	in the range entered.<br><small>Examples (10-25, 10-, -100)</small></td>
+</tr>
+<tr>
+<td><b>Measured Value Range:</b></td>
+<td>The discount will be applied only if the weight or the items ordered falls
+	in the range entered.<br><small>Examples (10-25, 10-, -100)</small></td>
+</tr>
+<tr>
+<td><b>Discount:</b></td>
+<td>The Discount can be any amount in percentages or hard dollar amounts.<br>
+	<small>Examples (5%, 15.00, 20)</small></td>
+</tr>
+<tr>
+<td><b>Discount Date:</b></td>
+<td>Enter the dates the discount is valid using the date form MM/DD/YYYY.<br>
+<small>Examples (05/17/2003-05/17/2006, -01/01/2007, 12/31/2003-)</small></td>
+</tr>
+<tr>
+<td><b>Comments:</b></td>
+<td>Enter comments to remind you of the discount or promtion. Use only alpha numeric characters.</td>
+</tr>
+</table>
+</center>
+</BODY>
+</HTML>
\ No newline at end of file
diff -ruN 4.0K-4b/html/pages/license.html 5.0.000/html/pages/license.html
--- 4.0K-4b/html/pages/license.html	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/pages/license.html	2006-10-31 09:40:27.000000000 -0600
@@ -1,309 +1,383 @@
-<HTML>
-<HEAD>
-<TITLE>AgoraCart - License</TITLE>
-
-<META NAME="description" CONTENT="FREE shopping cart software - AgoraCart"> 
-<META NAME="keywords" CONTENT="free, shopping cart, e-commerce, software, perl, 
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>
+	AgoraCart - License
+</title>
+%%head_info%%
+<meta name="description" content="FREE shopping cart software - AgoraCart">
+<meta name="keywords" content="free, shopping cart, e-commerce, software, perl,
 database, easy, secure, store, dynamic, web based, c, c++, javascript, html">
+</head>
 
-</HEAD>
+<body>
+%%StoreHeader%%
 
-<BODY BGCOLOR="WHITE">
+<div align="center" style="text-align:justify; padding: 20px 20px 20px 20px;">
+	<p>
+		GNU GENERAL PUBLIC LICENSE<br/>
+		Version 2, June 1991<br/>
+		Copyright (C) 1989, 1991 Free Software Foundation, Inc.<br/>
+		675 Mass Ave, Cambridge, MA 02139, USA
+	</p>
 
+	<p>
+		Everyone is permitted to copy and distribute verbatim copies of this license
+		document, but changing it is not allowed.
+	</p>
 
-%%StoreHeader%%
-<DIV ALIGN="CENTER">
 
-<CENTER>
-<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH="400">
-<TR>
-<TD WIDTH=400>
-<FONT FACE=ARIAL SIZE=2><br><br>
-GNU GENERAL PUBLIC LICENSE<br>
-Version 2, June 1991<br>
-Copyright (C) 1989, 1991 Free Software Foundation, Inc.<br>
-675 Mass Ave, Cambridge, MA 02139, USA<br>
-<p>
-Everyone is permitted to copy and distribute verbatim copies
-of this license document, but changing it is not allowed.
-<p>
-Preamble<br>
-<p>
-The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
-your programs, too.
-<p>
-When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-<p>
-To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-<p>
-For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-<p>
-We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-<p>
-Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-<p>
-Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-<p>
-The precise terms and conditions for copying, distribution and
-modification follow.
-<p>GNU GENERAL PUBLIC LICENSE<br>
-TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-<p>
-0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-<p>
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-<p>
-1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-<p>
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-<p>
-2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-<p>
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-<p>
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-<p>
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-<p>
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-<p>
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-<p>
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-<p>
-3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-<p>
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-<p>
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-<p>
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-<p>
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-<p>
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-<p>
-4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-<p>
-5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-<p>
-6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-<p>
-7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-<p>
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-<p>
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-<p>
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-<p>
-8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-<p>
-9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-<p>
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-<p>
-10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-<p>
-NO WARRANTY
-<p>
-11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-<p>
-12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.<br>
-<p>
-</FONT>
-</TD>
-</TR>
-</TABLE>
-</CENTER>
+	<p>
+		Preamble
+	</p>
+	<p>
+		The licenses for most software are designed to take away your
+		freedom to share and change it.  By contrast, the GNU General Public
+		License is intended to guarantee your freedom to share and change free
+		software--to make sure the software is free for all its users.  This
+		General Public License applies to most of the Free Software
+		Foundation's software and to any other program whose authors commit to
+		using it.  (Some other Free Software Foundation software is covered by
+		the GNU Library General Public License instead.)  You can apply it to
+		your programs, too.
+	</p>
+	<p>
+		When we speak of free software, we are referring to freedom, not
+		price.  Our General Public Licenses are designed to make sure that you
+		have the freedom to distribute copies of free software (and charge for
+		this service if you wish), that you receive source code or can get it
+		if you want it, that you can change the software or use pieces of it
+		in new free programs; and that you know you can do these things.
+	</p>
+	<p>
+		To protect your rights, we need to make restrictions that forbid
+		anyone to deny you these rights or to ask you to surrender the rights.
+		These restrictions translate to certain responsibilities for you if you
+		distribute copies of the software, or if you modify it.
+	</p>
+
+	<p>
+		For example, if you distribute copies of such a program, whether
+		gratis or for a fee, you must give the recipients all the rights that
+		you have.  You must make sure that they, too, receive or can get the
+		source code.  And you must show them these terms so they know their
+		rights.
+	</p>
+
+	<p>
+		We protect your rights with two steps: (1) copyright the software, and
+		(2) offer you this license which gives you legal permission to copy,
+		distribute and/or modify the software.
+	</p>
+
+	<p>
+		Also, for each author's protection and ours, we want to make certain
+		that everyone understands that there is no warranty for this free
+		software.  If the software is modified by someone else and passed on, we
+		want its recipients to know that what they have is not the original, so
+		that any problems introduced by others will not reflect on the original
+		authors' reputations.
+	</p>
+
+	<p>
+		Finally, any free program is threatened constantly by software
+		patents.  We wish to avoid the danger that redistributors of a free
+		program will individually obtain patent licenses, in effect making the
+		program proprietary.  To prevent this, we have made it clear that any
+		patent must be licensed for everyone's free use or not licensed at all.
+	</p>
+
+	<p>
+		The precise terms and conditions for copying, distribution and
+		modification follow.
+	</p>
+
+	<p>GNU GENERAL PUBLIC LICENSE<br>
+		TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+	</p>
+
+	<p>
+		0. This License applies to any program or other work which contains
+		a notice placed by the copyright holder saying it may be distributed
+		under the terms of this General Public License.  The "Program", below,
+		refers to any such program or work, and a "work based on the Program"
+		means either the Program or any derivative work under copyright law:
+		that is to say, a work containing the Program or a portion of it,
+		either verbatim or with modifications and/or translated into another
+		language.  (Hereinafter, translation is included without limitation in
+		the term "modification".)  Each licensee is addressed as "you".
+	</p>
+
+	<p>
+		Activities other than copying, distribution and modification are not
+		covered by this License; they are outside its scope.  The act of
+		running the Program is not restricted, and the output from the Program
+		is covered only if its contents constitute a work based on the
+		Program (independent of having been made by running the Program).
+		Whether that is true depends on what the Program does.
+	</p>
+
+	<p>
+		1. You may copy and distribute verbatim copies of the Program's
+		source code as you receive it, in any medium, provided that you
+		conspicuously and appropriately publish on each copy an appropriate
+		copyright notice and disclaimer of warranty; keep intact all the
+		notices that refer to this License and to the absence of any warranty;
+		and give any other recipients of the Program a copy of this License
+		along with the Program.
+	</p>
+
+	<p>
+		You may charge a fee for the physical act of transferring a copy, and
+		you may at your option offer warranty protection in exchange for a fee.
+	</p>
+
+	<p>
+		2. You may modify your copy or copies of the Program or any portion
+		of it, thus forming a work based on the Program, and copy and
+		distribute such modifications or work under the terms of Section 1
+		above, provided that you also meet all of these conditions:
+	</p>
+
+	<p>
+				a) You must cause the modified files to carry prominent notices
+				stating that you changed the files and the date of any change.
+	</p>
+
+	<p>
+				b) You must cause any work that you distribute or publish, that in
+				whole or in part contains or is derived from the Program or any
+				part thereof, to be licensed as a whole at no charge to all third
+				parties under the terms of this License.
+	</p>
+
+	<p>
+				c) If the modified program normally reads commands interactively
+				when run, you must cause it, when started running for such
+				interactive use in the most ordinary way, to print or display an
+				announcement including an appropriate copyright notice and a
+				notice that there is no warranty (or else, saying that you provide
+				a warranty) and that users may redistribute the program under
+				these conditions, and telling the user how to view a copy of this
+				License.  (Exception: if the Program itself is interactive but
+				does not normally print such an announcement, your work based on
+				the Program is not required to print an announcement.)
+	</p>
+
+	<p>
+		These requirements apply to the modified work as a whole.  If
+		identifiable sections of that work are not derived from the Program,
+		and can be reasonably considered independent and separate works in
+		themselves, then this License, and its terms, do not apply to those
+		sections when you distribute them as separate works.  But when you
+		distribute the same sections as part of a whole which is a work based
+		on the Program, the distribution of the whole must be on the terms of
+		this License, whose permissions for other licensees extend to the
+		entire whole, and thus to each and every part regardless of who wrote it.
+	</p>
+
+	<p>
+		Thus, it is not the intent of this section to claim rights or contest
+		your rights to work written entirely by you; rather, the intent is to
+		exercise the right to control the distribution of derivative or
+		collective works based on the Program.
+	</p>
+
+	<p>
+		In addition, mere aggregation of another work not based on the Program
+		with the Program (or with a work based on the Program) on a volume of
+		a storage or distribution medium does not bring the other work under
+		the scope of this License.
+	</p>
+
+	<p>
+		3. You may copy and distribute the Program (or a work based on it,
+		under Section 2) in object code or executable form under the terms of
+		Sections 1 and 2 above provided that you also do one of the following:
+	</p>
+
+	<p>
+				a) Accompany it with the complete corresponding machine-readable
+				source code, which must be distributed under the terms of Sections
+				1 and 2 above on a medium customarily used for software interchange; or,
+	</p>
+
+	<p>
+				b) Accompany it with a written offer, valid for at least three
+				years, to give any third party, for a charge no more than your
+				cost of physically performing source distribution, a complete
+				machine-readable copy of the corresponding source code, to be
+				distributed under the terms of Sections 1 and 2 above on a medium
+				customarily used for software interchange; or,
+	</p>
+
+	<p>
+				c) Accompany it with the information you received as to the offer
+				to distribute corresponding source code.  (This alternative is
+				allowed only for noncommercial distribution and only if you
+				received the program in object code or executable form with such
+				an offer, in accord with Subsection b above.)
+	</p>
+
+	<p>
+		The source code for a work means the preferred form of the work for
+		making modifications to it.  For an executable work, complete source
+		code means all the source code for all modules it contains, plus any
+		associated interface definition files, plus the scripts used to
+		control compilation and installation of the executable.  However, as a
+		special exception, the source code distributed need not include
+		anything that is normally distributed (in either source or binary
+		form) with the major components (compiler, kernel, and so on) of the
+		operating system on which the executable runs, unless that component
+		itself accompanies the executable.
+	</p>
+
+	<p>
+		If distribution of executable or object code is made by offering
+		access to copy from a designated place, then offering equivalent
+		access to copy the source code from the same place counts as
+		distribution of the source code, even though third parties are not
+		compelled to copy the source along with the object code.
+	</p>
+
+	<p>
+		4. You may not copy, modify, sublicense, or distribute the Program
+		except as expressly provided under this License.  Any attempt
+		otherwise to copy, modify, sublicense or distribute the Program is
+		void, and will automatically terminate your rights under this License.
+		However, parties who have received copies, or rights, from you under
+		this License will not have their licenses terminated so long as such
+		parties remain in full compliance.
+	</p>
+
+	<p>
+		5. You are not required to accept this License, since you have not
+		signed it.  However, nothing else grants you permission to modify or
+		distribute the Program or its derivative works.  These actions are
+		prohibited by law if you do not accept this License.  Therefore, by
+		modifying or distributing the Program (or any work based on the
+		Program), you indicate your acceptance of this License to do so, and
+		all its terms and conditions for copying, distributing or modifying
+		the Program or works based on it.
+	</p>
+
+	<p>
+		6. Each time you redistribute the Program (or any work based on the
+		Program), the recipient automatically receives a license from the
+		original licensor to copy, distribute or modify the Program subject to
+		these terms and conditions.  You may not impose any further
+		restrictions on the recipients' exercise of the rights granted herein.
+		You are not responsible for enforcing compliance by third parties to
+		this License.
+	</p>
+
+	<p>
+		7. If, as a consequence of a court judgment or allegation of patent
+		infringement or for any other reason (not limited to patent issues),
+		conditions are imposed on you (whether by court order, agreement or
+		otherwise) that contradict the conditions of this License, they do not
+		excuse you from the conditions of this License.  If you cannot
+		distribute so as to satisfy simultaneously your obligations under this
+		License and any other pertinent obligations, then as a consequence you
+		may not distribute the Program at all.  For example, if a patent
+		license would not permit royalty-free redistribution of the Program by
+		all those who receive copies directly or indirectly through you, then
+		the only way you could satisfy both it and this License would be to
+		refrain entirely from distribution of the Program.
+	</p>
+
+	<p>
+		If any portion of this section is held invalid or unenforceable under
+		any particular circumstance, the balance of the section is intended to
+		apply and the section as a whole is intended to apply in other
+		circumstances.
+	</p>
+
+	<p>
+		It is not the purpose of this section to induce you to infringe any
+		patents or other property right claims or to contest validity of any
+		such claims; this section has the sole purpose of protecting the
+		integrity of the free software distribution system, which is
+		implemented by public license practices.  Many people have made
+		generous contributions to the wide range of software distributed
+		through that system in reliance on consistent application of that
+		system; it is up to the author/donor to decide if he or she is willing
+		to distribute software through any other system and a licensee cannot
+		impose that choice.
+	</p>
+
+	<p>
+		This section is intended to make thoroughly clear what is believed to
+		be a consequence of the rest of this License.
+	</p>
+
+	<p>
+		8. If the distribution and/or use of the Program is restricted in
+		certain countries either by patents or by copyrighted interfaces, the
+		original copyright holder who places the Program under this License
+		may add an explicit geographical distribution limitation excluding
+		those countries, so that distribution is permitted only in or among
+		countries not thus excluded.  In such case, this License incorporates
+		the limitation as if written in the body of this License.
+	</p>
+
+	<p>
+		9. The Free Software Foundation may publish revised and/or new versions
+		of the General Public License from time to time.  Such new versions will
+		be similar in spirit to the present version, but may differ in detail to
+		address new problems or concerns.
+	</p>
+
+	<p>
+		Each version is given a distinguishing version number.  If the Program
+		specifies a version number of this License which applies to it and "any
+		later version", you have the option of following the terms and conditions
+		either of that version or of any later version published by the Free
+		Software Foundation.  If the Program does not specify a version number of
+		this License, you may choose any version ever published by the Free Software
+		Foundation.
+	</p>
+
+	<p>
+		10. If you wish to incorporate parts of the Program into other free
+		programs whose distribution conditions are different, write to the author
+		to ask for permission.  For software which is copyrighted by the Free
+		Software Foundation, write to the Free Software Foundation; we sometimes
+		make exceptions for this.  Our decision will be guided by the two goals
+		of preserving the free status of all derivatives of our free software and
+		of promoting the sharing and reuse of software generally.
+	</p>
+
+	<p>
+		NO WARRANTY
+	</p>
+
+	<p>
+		11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+		FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+		OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+		PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+		OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+		MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+		TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+		PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+		REPAIR OR CORRECTION.
+	</p>
+
+	<p>
+		12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+		WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+		REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+		INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+		OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+		TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+		YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+		PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+		POSSIBILITY OF SUCH DAMAGES.
+	</p>
 
-</DIV>
+	<p>
+</div>
 %%StoreFooter%%
-</BODY>
-</HTML>
+</body>
+</html>
diff -ruN 4.0K-4b/html/pages/mgrinvoiceTemplate.html 5.0.000/html/pages/mgrinvoiceTemplate.html
--- 4.0K-4b/html/pages/mgrinvoiceTemplate.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/pages/mgrinvoiceTemplate.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,157 @@
+<HTML>
+<head>
+<TITLE> %%month%% %%year%% Invoice: %%invoiceNumber%% - %%customerNumber%%</TITLE>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta name="copyright" content="%%year%%">
+<meta name="author" content="AgoraCart">
+<meta name="publisher" content="K-Factor Technologies,Inc.">
+</head>
+<BODY bgcolor="#FFFFFF" text="#000000" alink="#FF0000" vlink="#FF00FF" link="#0000FF">
+<!--
+Available Tokens:
+%%year%%
+%%day%%
+%%month%%
+%%invoiceNumber%%
+%%customerNumber%%
+%%orderStatus%%
+%%shiptrackingID%%
+%%firstName%%
+%%lastName%%
+%%fullName%%
+%%companyName%%
+%%customerPhone%%
+%%faxNumber%%
+%%emailAddress%%
+%%orderFromAddress%%
+%%customerAddress2%%
+%%customerAddress3%%
+%%orderFromCity%%
+%%orderFromState%%
+%%orderFromPostal%%
+%%orderFromCountry%%
+%%shipToName%%
+%%shipToAddress%%
+%%shipToAddress2%%
+%%shipToAddress3%%
+%%shipToCity%%
+%%shipToState%%
+%%shipToPostal%%
+%%shipToCountry%%
+%%shipMethod%%
+%%shippingTotal%%
+%%shipToInsured%%
+%%shipToResidential%%
+%%salesTax%%
+%%tax1%%
+%%tax2%%
+%%tax3%%
+%%discounts%%
+%%subTotal%%
+%%orderTotal%%
+%%user1%%
+%%user2%%
+%%user3%%
+%%user4%%
+%%user5%%
+%%adminMessages%%
+%%GatewayUsed%%
+%%cartContents%%
+%%money_symbol%%
+%%shippingMessages%%
+%%xcomments%%
+%%termsOfService%%
+-->
+<table width=100% border=0 cellpadding=0 cellspacing=0><tr><td>
+<center><font face=arial size=+3 color=red><b>Invoice&nbsp;&nbsp;&nbsp;</b> </font></center>
+<font face=arial size=+2 color=red>AgoraCart.com</font><br>
+<font face=arial size=1>your company address<br>City, State, Postalcode<br>Phone: 800-123-4567<br>Email_address@SomeDomainNameHere.com</font><br>
+<br>
+<table width=98% border=1 cellpadding=10 cellspacing=0>
+<tr bgcolor=#99CC99>
+<td valign=top width=50%>
+<font face=arial size=1>
+<b>Bill To:</b>
+</font>
+</td>
+<td valign=top width=50%>
+<font face=arial size=1>
+<b>Ship To:</b>
+</font>
+</td></tr>
+<tr>
+<td valign=top width=50%>
+<font face=arial size=1><b>
+%%fullName%%<br>
+%%orderFromAddress%%<br>
+<!--%%companyName%%<br>-->
+%%orderFromCity%%, %%orderFromState%%<br>
+%%orderFromPostal%%<br>
+%%orderFromCountry%%<br><br>
+%%customerPhone%%<br>
+%%emailAddress%%<br>
+</b>
+</font>
+</td>
+<td valign=top>
+<font face=arial size=1><b>
+%%shipToName%%<br>
+%%shipToAddress%%<br>
+%%shipToCity%%, %%shipToState%%<br>
+%%shipToPostal%%<br>
+%%shipToCountry%%<br><br>
+</b>
+</font>
+</td></tr>
+<tr bgcolor=#99CC99>
+<td colspan=2 valign=top width=100%>
+<font face=arial size=2>
+<b>Order: %%invoiceNumber%% - %%customerNumber%%</b>
+</font>
+</td></tr>
+<tr>
+<td valign=top width=50%>
+<font face=arial size=1>
+<b>Date of Order:</b> %%month%% %%day%%, %%year%%<br>
+<b>Status of Order:</b> %%orderStatus%%<br><br>
+<b>Invoice Number:</b> %%invoiceNumber%%<br>
+<b>Customer ID:</b> %%customerNumber%%<br>
+<b>Processed Via:</b> %%GatewayUsed%%<br><br>
+<b>Ship via:</b> %%shipMethod%%<br>
+<b>Residential?</b> %%shipToResidential%%<br>
+<b>Insure?</b> %%shipToInsured%%<br>
+<b>Tracking ID (if any):</b> %%shiptrackingID%%<br>
+</font>
+</td>
+<td valign=top width=50%>
+<table width=80% border=0 cellpadding=0>
+<tr><td align=right><font face=arial size=1>Order Subtotal:</font></td><td align=right><font face=arial size=1>%%money_symbol%% %%subTotal%%</font></td></tr>
+<tr><td align=right><font face=arial size=1>Discounts Given:</font></td><td align=right><font face=arial size=1>%%money_symbol%% %%discounts%%</font></td></tr>
+<tr><td align=right><font face=arial size=1>Sales Tax:</font></td><td align=right><font face=arial size=1>%%money_symbol%% %%salesTax%%</font></td></tr>
+<tr><td align=right><font face=arial size=1>Tax 1:</font></td><td align=right><font face=arial size=1>%%money_symbol%% %%tax1%%</font></td></tr>
+<tr><td align=right><font face=arial size=1>Tax 2:</font></td><td align=right><font face=arial size=1>%%money_symbol%% %%tax2%%</font></td></tr>
+<tr><td align=right><font face=arial size=1>Tax 3:</font></td><td align=right><font face=arial size=1>%%money_symbol%% %%tax3%%</font></td></tr>
+<tr><td align=right><font face=arial size=1>Shipping:</font></td><td align=right><font face=arial size=1>%%money_symbol%% %%shippingTotal%%</font></td></tr>
+<tr><td align=right><font face=arial size=2><b>Grand Total:</b></font></td><td align=right><font face=arial size=2><b>%%money_symbol%% %%orderTotal%%</b></font></td></tr>
+</table>
+</td></tr>
+<tr bgcolor=#99CC99>
+<td colspan=2 valign=top><center><font face=arial size=2><b>Product Information</b></font></center></td></tr>
+<tr>
+<td colspan=2 valign=top>
+<table width=100% border=0 cellpadding=0 cellspacing=0>
+<td valign=top width=75%><font face=arial size=1><br><b>Product Name</b></font></td>
+<td valign=top width=10%><font face=arial size=1><br><b>Quantity</b></font></td>
+<td valign=top width=15%><font face=arial size=1><br><b>Total Price Each</b></font></td></tr>
+%%cartContents%%
+</table>
+</td></tr>
+<tr bgcolor=#99CC99>
+<td colspan=2 valign=top><center><font face=arial size=2><b>Messages</b></font></center></td></tr>
+<tr>
+<td colspan=2 valign=top><center><font face=arial size=1>%%xcomments%%</font></center></td></tr>
+</table>
+</td></tr>
+</table>
+</BODY>
+</HTML>
\ No newline at end of file
diff -ruN 4.0K-4b/html/pages/mgrpackingslipTemplate.html 5.0.000/html/pages/mgrpackingslipTemplate.html
--- 4.0K-4b/html/pages/mgrpackingslipTemplate.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/pages/mgrpackingslipTemplate.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,152 @@
+<HTML>
+<head>
+<TITLE> %%month%% %%year%% Packing Slip for Order: %%invoiceNumber%% - %%customerNumber%%</TITLE>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta name="copyright" content="%%year%%">
+<meta name="author" content="AgoraCart">
+<meta name="publisher" content="K-Factor Technologies,Inc.">
+</head>
+<BODY bgcolor="#FFFFFF" text="#000000" alink="#FF0000" vlink="#FF00FF" link="#0000FF">
+<!--
+Available Tokens:
+%%year%%
+%%day%%
+%%month%%
+%%invoiceNumber%%
+%%customerNumber%%
+%%orderStatus%%
+%%shiptrackingID%%
+%%firstName%%
+%%lastName%%
+%%fullName%%
+%%companyName%%
+%%customerPhone%%
+%%faxNumber%%
+%%emailAddress%%
+%%orderFromAddress%%
+%%customerAddress2%%
+%%customerAddress3%%
+%%orderFromCity%%
+%%orderFromState%%
+%%orderFromPostal%%
+%%orderFromCountry%%
+%%shipToName%%
+%%shipToAddress%%
+%%shipToAddress2%%
+%%shipToAddress3%%
+%%shipToCity%%
+%%shipToState%%
+%%shipToPostal%%
+%%shipToCountry%%
+%%shipMethod%%
+%%shippingTotal%%
+%%shipToInsured%%
+%%shipToResidential%%
+%%salesTax%%
+%%tax1%%
+%%tax2%%
+%%tax3%%
+%%discounts%%
+%%subTotal%%
+%%orderTotal%%
+%%user1%%
+%%user2%%
+%%user3%%
+%%user4%%
+%%user5%%
+%%adminMessages%%
+%%GatewayUsed%%
+%%cartContents%%
+%%money_symbol%%
+%%shippingMessages%%
+%%xcomments%%
+%%termsOfService%%
+-->
+<table width=100% border=0 cellpadding=0 cellspacing=0><tr><td>
+<center><font face=arial size=+3 color=red><b>Packing Slip&nbsp;&nbsp;&nbsp;</b> </font></center>
+<font face=arial size=+2 color=red>AgoraCart.com</font><br>
+<font face=arial size=1>your company address<br>City, State, Postalcode<br>Phone: 800-123-4567<br>Email_address@SomeDomainNameHere.com</font><br>
+<br>
+<table width=98% border=1 cellpadding=10 cellspacing=0>
+<tr bgcolor=#99CC99>
+<td valign=top width=50%>
+<font face=arial size=2>
+<b>Bill To:</b>
+</font>
+</td>
+<td valign=top width=50%>
+<font face=arial size=2>
+<b>Ship To:</b>
+</font>
+</td></tr>
+<tr>
+<td valign=top width=50%>
+<font face=arial size=2><b>
+%%fullName%%<br>
+<!--%%companyName%%<br>-->
+%%orderFromAddress%%<br>
+%%orderFromCity%%, %%orderFromState%%<br>
+%%orderFromPostal%%<br>
+%%orderFromCountry%%<br><br>
+%%customerPhone%%<br>
+%%emailAddress%%<br>
+</b>
+</font>
+</td>
+<td valign=top>
+<font face=arial size=2><b>
+%%shipToName%%<br>
+%%shipToAddress%%<br>
+%%shipToCity%%, %%shipToState%%<br>
+%%shipToPostal%%<br>
+%%shipToCountry%%<br><br>
+</b>
+</font>
+</td></tr>
+<tr bgcolor=#99CC99>
+<td colspan=2 valign=top width=100%>
+<font face=arial size=2>
+<b>Order: %%invoiceNumber%% - %%customerNumber%%</b>
+</font>
+</td></tr>
+<tr>
+<td valign=top width=50%>
+<font face=arial size=1>
+<b>Date of Order:</b> %%month%% %%day%%, %%year%%<br>
+<b>Invoice Number:</b> %%invoiceNumber%%<br>
+<b>Customer ID:</b> %%customerNumber%%<br>
+</font>
+</td>
+<td valign=top width=50%>
+<font face=arial size=1>
+<b>Status of Order:</b> %%orderStatus%%<br><br>
+<b>Ship via:</b> %%shipMethod%%<br>
+<b>Residential?</b> %%shipToResidential%%<br>
+<b>Insure?</b> %%shipToInsured%%<br>
+<b>Tracking ID (if any):</b> %%shiptrackingID%%<br>
+</font>
+</td></tr>
+<tr bgcolor=#99CC99>
+<td colspan=2 valign=top><center><font face=arial size=2><b>Product Information</b></font></center></td></tr>
+<tr>
+<td colspan=2 valign=top>
+<table width=100% border=0 cellpadding=0 cellspacing=0>
+<td valign=top width=75%><font face=arial size=1><br><b>Product Name</b></font></td>
+<td valign=top width=10%><font face=arial size=1><br><b>Quantity</b></font></td>
+<td valign=top width=15%><font face=arial size=1><br><b>Total Price Each</b></font></td></tr>
+%%cartContents%%
+</table>
+</td></tr>
+<tr bgcolor=#99CC99>
+<td colspan=2 valign=top><center><font face=arial size=2><b>Messages</b></font></center></td></tr>
+<tr>
+<td colspan=2 valign=top><center><font face=arial size=1>%%xcomments%%</font></center></td></tr>
+<tr bgcolor=#99CC99>
+<td colspan=2 valign=top><center><font face=arial size=2><b>Packing Instructions / Messages</b></font></center></td></tr>
+<tr>
+<td colspan=2 valign=top><font face=arial size=1>%%shippingMessages%%</font></td></tr>
+</table>
+</td></tr>
+</table>
+</BODY>
+</HTML>
\ No newline at end of file
diff -ruN 4.0K-4b/html/pages/test.html 5.0.000/html/pages/test.html
--- 4.0K-4b/html/pages/test.html	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/html/pages/test.html	2006-10-31 09:40:27.000000000 -0600
@@ -1,93 +1,38 @@
-<HTML>
-<HEAD>
-<TITLE>Product Listing - PERL</TITLE>
-</HEAD>
-<BODY bgcolor="#ffffff" text="#000000">
-<DIV ALIGN="CENTER">
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>AgoraCart %%agoracgi_ver%% ERROR Page</title>
+%%head_info%%
+</head>
 
+<body>
 %%StoreHeader%%
+<div align="center" style="text-align:center; padding: 20px 20px 20px 20px;">
 
-<CENTER><TABLE BORDER="0" WIDTH="550"><tr><td 
-colspan=3>%%item_ordered_msg%%<table width="100%" border=1>
-<td width="100%" colspan=2><table width=100% border=0>
-<tr>
-<tr><td width="50%"><table width=100% border=0>
-
-<TR WIDTH="100%">
-<TD ALIGN="CENTER" WIDTH="160" VALIGN="MIDDLE">
-<FONT FACE="ARIAL" SIZE="2">
-<FORM METHOD = "post" ACTION = "agora.cgi">
-%%make_hidden_fields%%
-<BR>
-
- <TABLE CELLPADDING="0" CELLSPACING="0">
-  <TR ALIGN="CENTER"><TD><FONT FACE=ARIAL SIZE="2">
-   <B>Select Accessories</B>
-   <br>
-   </FONT></TD></TR>
-  <TR ALIGN="CENTER"><TD><SELECT NAME = "option|1|0001">
-    <OPTION VALUE = "|">Gift Options
-    <OPTION VALUE = "Gift Card|1.00"> Gift Card (+$1.00)
-    <OPTION VALUE = "Gift Wrap|2.50"> Gift Wrap (+$2.50)
-    <OPTION VALUE = "Gift Box|3.50"> Gift Box (+$3.50)
-    </SELECT></TD></TR>
-   <TR ALIGN="CENTER"><TD><SELECT NAME = "option|2|0001">
-    <OPTION VALUE = "|">Accessories
-    <OPTION VALUE = "Book Bag|4.95">Book Bag (+$4.95)
-    <OPTION VALUE = "Backpack|9.95">Backpack (+$9.95)
-    <OPTION VALUE = "Bookcase|9.95">Bookcase (+$9.95)
-    </SELECT></TD></TR>
-  </TABLE>
-
-<BR>
-<P>
-<!--BEGIN SELECT QUANTITY BUTTON-->
-<TABLE>
-<TR ALIGN="CENTER">
- <TD VALIGN="MIDDLE"><INPUT TYPE="TEXT" 
-NAME="item-0001|PERL|23.96|Learning Perl|~lt~IMG SRC=~qq~%%URLofImages%%/0001.gif~qq~ BORDER=0~gt~|4.95" 
-SIZE="3" MAXLENGTH="3" VALUE="1"></TD><TD VALIGN="MIDDLE"><INPUT 
- TYPE="IMAGE" NAME="add_to_cart_button" VALUE="Add To Cart"
- SRC="agora.cgi?picserve=/add_to_cart.gif" BORDER="0">
- </TD>
-</TR>
-</TABLE>
-<!--END SELECT QUANTITY BUTTON-->
-</TD>
-<TD ALIGN="CENTER" WIDTH="150"><IMG SRC="agora.cgi?picserve=/0001.gif" BORDER=0></TD>
-</tr>
-</table></td>
-<td width="50%"><table width=100%>
-
-<tr><TD colspan=2>
-<FONT FACE="ARIAL" SIZE="2">
-<b>Learning Perl</b>
-<br>
-In this smooth, carefully paced course, a leading Perl trainer teaches you to program in the language that
-threatens to make C, sed, awk, and the Unix shell obsolete for many tasks. This book is the "official" guide for
-both formal (classroom) and informal learning. It is fully accessible to the novice programmer. <a
-href="http://www.amazon.com/exec/obidos/ASIN/1565922840/dial411com">Learn More</a>
-</FONT>
-</TD>
-</FORM>
-</TR>
-<TR>
-<td>
-<FONT FACE="ARIAL" SIZE="2" color="#FF0000">$ 23.96</font>
-</td>
-<td align="right">
-<A HREF="agora.cgi?dc=1&%%href_fields%%"><FONT FACE=ARIAL>Check Out</FONT>
-</A>
-</TD>
-</TR>
-</table></td>
-</tr></table></td>
-</table></td></tr>
-
-<tr><td colspan=3><hr></td></tr>
-</TABLE></CENTER>
+	<div class="ac_vertical_links">
+		<!--agorascript-pre
+		# TO ADJUST THE LOOK OF THESE LINKS
+		# EDIT THE CREATE A NEW CLASS OR
+		# ADJUST THIS ONE
+		&capture_STDOUT;
+		&cartlinks;
+		print $cartlinks;
+		&uncapture_STDOUT;  -->
+	</div>
+
+	<hr/>
+	<p>
+		Testing headers on static pages.<br/>
+		Please hit the browser back button, change what was done in error, and try again.
+	</p>
+	<hr/>
 
+</div>
 %%StoreFooter%%
-
-</BODY>
-</HTML>
+</body>
+</html>  <!-- agora.cgi shopping cart 4.99.0 Pro Member Version RC-1 -->
+  <!-- sc_special_page_meta_tags in agora.setup.db -->
+  <meta http-equiv="Expires" content="Wed, 4 October 2005 00:00:00 GMT">
+  <meta http-equiv="Cache-Control" content="no-cache">
+  <meta http-equiv="Pragma" content="no-cache">
+  <!-- sc_browser_meta_tags in agora.setup.db -->
diff -ruN 4.0K-4b/html/terms_of_service.html 5.0.000/html/terms_of_service.html
--- 4.0K-4b/html/terms_of_service.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/html/terms_of_service.html	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>
+	AgoraCart %%agoracgi_ver%%
+</title>
+%%head_info%%
+</head>
+
+<body>
+%%StoreHeader%%
+<div align="center" style="text-align:justify; padding: 20px 20px 20px 20px;">
+
+	<p>
+		This page would contain your terms of service policy used on checkout forms. If you do not wish to
+		include this page then just delete it from the /html directory.
+	</p>
+	<p>
+		If you want to add other pages to the navigation list just upload
+		them to the pages directory and the script will list them here.
+	</p>
+	<p>
+		Just make sure that you name the file in proper case and include underscores,
+		"_", for spaces. Everything will show up exactly as how you save it.
+	</p>
+
+</div>
+%%StoreFooter%%
+</body>
+</html>
+
diff -ruN 4.0K-4b/index.html 5.0.000/index.html
--- 4.0K-4b/index.html	2005-11-30 17:12:17.000000000 -0600
+++ 5.0.000/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -11,4 +11,4 @@
 // end hide -->
 </script>
 
-</HTML>
+</HTML>
\ No newline at end of file
diff -ruN 4.0K-4b/library/2checkout-mgr_lib.pl 5.0.000/library/2checkout-mgr_lib.pl
--- 4.0K-4b/library/2checkout-mgr_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/2checkout-mgr_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,10 +1,10 @@
 #
 # For the Credit Card Processing Gateway 2checkout
 #
-# Copyright 2001 Steve Kneizys.  All Rights Reserved.
-# June 30, 2001
+# Copyright 2003 to present K-Factor Technologies, Inc..  All Rights Reserved.
 
-$versions{'2checkout-mgr_lib.pl'} = "20010630";
+
+$versions{'2checkout-mgr_lib.pl'} = "5.0.000";
 &add_codehook("gateway_admin_screen","checkout_mgr_check");
 &add_codehook("gateway_admin_settings","checkout_settings");
 $mc_gateways .= "|2checkout";
@@ -19,6 +19,9 @@
   $x_Footer_Html_Receipt = &my_escape($in{'x_Footer_Html_Receipt'});
   $x_Header_Email_Receipt = &my_escape($in{'x_Header_Email_Receipt'});
   $x_Footer_Email_Receipt = &my_escape($in{'x_Footer_Email_Receipt'});
+  $sc_2CO_verify_message = &my_escape($in{'sc_2CO_verify_message'});
+  $sc_2CO_order_desc = &my_escape($in{'sc_2CO_order_desc'});
+  $sc_tos_display_address = &my_escape($in{'sc_tos_display_address'});
 
   open (GW, "> $gateway_settings") || &my_die("Can't Open $gateway_settings");
   print (GW "\$sc_gateway_username = '$in{'sc_gateway_username'}';\n");
@@ -35,7 +38,14 @@
   print (GW "\$x_Header_Email_Receipt = \"$x_Header_Email_Receipt\";\n");
   print (GW "\$x_Footer_Email_Receipt = \"$x_Footer_Email_Receipt\";\n");
   print (GW "\$merchant_live_mode = \"$in{'live_mode'}\";\n");
-  print (GW  "1\;\n");
+  print (GW "\$sc_2CO_submit = '$in{'sc_2CO_submit'}';\n");
+  print (GW "\$sc_2CO_change = '$in{'sc_2CO_change'}';\n");
+  print (GW "\$sc_2CO_verify_message = \"$sc_2CO_verify_message\";\n");
+  print (GW "\$sc_2CO_order_desc = \"$sc_2CO_order_desc\";\n");
+  print (GW "\$sc_display_checkout_tos = \"$in{'sc_display_checkout_tos'}\";\n");
+  print (GW "\$sc_tos_display_address = qq'$sc_tos_display_address';\n");
+ 
+  print (GW  "#\n1\;\n");
   close(GW);
 
  }
@@ -49,25 +59,23 @@
 }
 ##############################################################################
 sub print_2checkout_mgr_form {
-	
-##
-## AUTHORIZE.NET
-##
 
 print &$manager_page_header("2checkout Gateway","","","","");
 
 print <<ENDOFTEXT;
 <CENTER>
-<TABLE WIDTH=580>
+<TABLE width="90%">
 
 <TR>
 <TD COLSPAN=2><HR></TD>
 </TR>
 
 <TR>
-<TD WIDTH=580>
+<TD>
 <FONT FACE=ARIAL>
-$sc_gateway_name Settings
+<center><b>2checkout (2CO) Settings</b></center><br /></font>
+<FONT FACE=ARIAL size=2>
+Note: When setting up your settings at 2Checkout.com, make sure to enter the secure cart URL (shared hosting SSL: https://secure.server.net/~username/path/to/agora.cgi  If you purchased your own SSL: https://www.your-name.com/path/to/agora.cgi) as your return URL to ensure proper order logging.  If you do not have a secure SSL path to your shopping cart, you can use the regular cart URL one (http://www.your-name.com/path/to/agora.cgi), but this is not recommended.
 $msg</FONT>
 </TD>
 </TR>
@@ -80,10 +88,10 @@
 {
 print <<ENDOFTEXT;
 <CENTER>
-<TABLE>
+<TABLE width="90%">
 <TR>
 <TD>
-<FONT FACE=ARIAL SIZE=2 COLOR=RED>Gateway settings have been successfully updated</FONT>
+<center><FONT FACE=ARIAL SIZE=2 COLOR=RED>Gateway settings have been successfully updated</FONT></center>
 </TD>
 </TR>
 </TABLE>
@@ -96,14 +104,14 @@
 <FONT FACE=ARIAL SIZE=2>
 <FORM METHOD="POST" ACTION="manager.cgi">
 <CENTER>
-<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
+<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0 width="90%">
 
 <TR>
 <TD COLSPAN=2><HR></TD>
 </TR>
 
 <TR>
-<TD width=80%>
+<TD><br>
 Are you ready to go live?  (Answer "no" to run in 
 test mode.)</TD>
 <TD>
@@ -119,10 +127,8 @@
 <TD COLSPAN=2><HR></TD>
 </TR>
 
-</table><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
-
 <TR>
-<TD width="80%">
+<TD><br>
 Gateway Username</td>
 <TD width="20%">
 <INPUT NAME="sc_gateway_username" TYPE="TEXT" SIZE=30 
@@ -130,16 +136,14 @@
 </TD>
 </TR>
 
-</table><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
 
 <TR>
 <TD COLSPAN=2><HR></TD>
 </TR>
 
-</table><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
 
 <TR>
-<TD COLSPAN=2>
+<TD COLSPAN=2><br>
 Secure URL to your Gateway's server
 </TD>
 </TR>
@@ -156,7 +160,7 @@
 </TR>
 
 <TR>
-<TD COLSPAN=2>
+<TD COLSPAN=2><br>
 Complete URL to the logo you'd like to display on your orderform.
 This <b>MUST</b> be a secure https URL. You can also leave this 
 blank if you prefer.
@@ -173,10 +177,10 @@
 <TD COLSPAN=2><HR></TD>
 </TR>
 
-</table><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
+</table><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0 width="90%">
 
 <TR>
-<TD width="80%">
+<TD>
 Background color of your orderform.
 </TD>
 <TD width="20%">
@@ -264,14 +268,90 @@
 </TD>
 </TR>
 
-</table><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
 
 <TR>
 <TD COLSPAN=2><HR></TD>
 </TR>
 
 <TR>
-<TD COLSPAN="2">
+<TD COLSPAN=2><br>
+URL of 'Submit to 2Checkout' button:
+<br>
+<INPUT NAME="sc_2CO_submit" TYPE="TEXT" SIZE=60 
+VALUE='$sc_2CO_submit'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><br>
+URL of 'Make Changes' button:
+<br>
+<INPUT NAME="sc_2CO_change" TYPE="TEXT" SIZE=60 
+VALUE='$sc_2CO_change'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><br>
+Order Description:
+<br>
+<INPUT NAME="sc_2CO_order_desc" TYPE="TEXT" SIZE=60 
+VALUE='$sc_2CO_order_desc'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><br>
+Message at the top of the Verify Order table:
+<br>
+<TEXTAREA NAME="sc_2CO_verify_message"
+ROWS=4 COLS=65 wrap=soft>$sc_2CO_verify_message</TEXTAREA>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><br><HR><br></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><TABLE WIDTH="100%"><TR>
+<TD>Display Terms of Service and Refund Policy checkbox and set as required?</TD>
+<TD>
+<SELECT NAME="sc_display_checkout_tos">
+<OPTION>$sc_display_checkout_tos</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT>
+</TD>
+</TR></TABLE></TD>
+</TR>
+<TR><TD COLSPAN=2><br>
+Business address and phone number (contact information) for your business.  Should be legal address for the business location for full disclosure and other privacy requirements mandated by credit card companies as well as government enitities that require such notices:<br>
+<TEXTAREA NAME="sc_tos_display_address" 
+cols="68" rows=5 
+wrap=off>$sc_tos_display_address</TEXTAREA><br>
+
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN="2"><br>
 Enter the text that you'd like displayed at the <b>top
 of your orderform</b>.
 </TD>
@@ -288,7 +368,7 @@
 </TR>
 
 <TR>
-<TD COLSPAN="2">
+<TD COLSPAN="2"><br>
 Enter the text that you'd like displayed at the <b>bottom
 of your orderform</b>.
 </TD>
@@ -305,7 +385,7 @@
 </TR>
 
 <TR>
-<TD COLSPAN="2">
+<TD COLSPAN="2"><br>
 Enter the text that you'd like displayed at the <b>top
 of your receipt page</b>.
 </TD>
@@ -322,7 +402,7 @@
 </TR>
 
 <TR>
-<TD COLSPAN="2">
+<TD COLSPAN="2"><br>
 Enter the text that you'd like displayed at the <b>bottom
 of your receipt page</b>.
 </TD>
@@ -339,7 +419,7 @@
 </TR>
 
 <TR>
-<TD COLSPAN="2">
+<TD COLSPAN="2"><br>
 Enter the text that you'd like displayed at the <b>top
 of your customer's e-mail receipt</b>.
 </TD>
@@ -352,7 +432,7 @@
 </TR>
 
 <TR>
-<TD COLSPAN="2">
+<TD COLSPAN="2"><br>
 Enter the text that you'd like displayed at the <b>bottom
 of your customer's e-mail receipt</b>.
 </TD>
@@ -369,8 +449,8 @@
 </TR>
 
 <TR>
-<TD COLSPAN=2>
-What description do you want to use for the order?
+<TD COLSPAN=2><br>
+What order title/description (for the admin order confirmation email tiltle) do you want to use?
 </TD>
 </TR>
 
@@ -385,7 +465,7 @@
 <TD COLSPAN=2>
 <CENTER>
 <INPUT TYPE="HIDDEN" NAME="system_edit_success" VALUE="yes">
-<INPUT TYPE="HIDDEN" NAME="gateway" VALUE="$sc_gateway_name">
+<INPUT TYPE="HIDDEN" NAME="gateway" VALUE="2checkout">
 <INPUT NAME="GatewaySettings" TYPE="SUBMIT" VALUE="Submit">
 &nbsp;&nbsp;
 <INPUT TYPE="RESET" VALUE="Reset">
diff -ruN 4.0K-4b/library/2checkout-order_lib.pl 5.0.000/library/2checkout-order_lib.pl
--- 4.0K-4b/library/2checkout-order_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/2checkout-order_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -2,11 +2,13 @@
 #                    Order Form Definition Variables                  #
 #######################################################################
 
-# 4/24/00 SPK ADDED THESE TAGS:
-#<INPUT TYPE=HIDDEN NAME=x_ADC_URL VALUE=\"$sc_store_url\">
-#<INPUT TYPE=HIDDEN NAME=x_ADC_Relay_Response VALUE=\"true\">
-
-$versions{'2checkout-order_lib.pl'} = "20020312";
+$versions{'2checkout-order_lib.pl'} = "5.0.000";
+$sc_use_secure_header_at_checkout = 'yes';
+$sc_use_secure_footer_for_order_form = 'yes';
+
+# discount mods applied June 17 2005
+# updated for v5 2006 April 13 by jfindlay
+# fixes applied April 15, 2006 by Mister Ed
 
 &add_codehook("printSubmitPage","print_2checkout_SubmitPage");
 &add_codehook("set_form_required_fields","checkout_fields");
@@ -41,46 +43,97 @@
 
 if (!($form_data{'gateway'} eq $myname)) { return;} 
 
-%sc_order_form_array =('Ecom_BillTo_Postal_Name_First', 'First Name',
-                       'Ecom_BillTo_Postal_Name_Last', 'Last Name',
-                       'Ecom_BillTo_Postal_Street_Line1', 'Billing Address Street',
-                       'Ecom_BillTo_Postal_City', 'Billing Address City',
-                       'Ecom_BillTo_Postal_StateProv', 'Billing Address State',
-                       'Ecom_BillTo_PostalCode', 'Billing Address Zip',
-                       'Ecom_BillTo_Postal_CountryCode', 'Billing Address Country',
-                       'Ecom_ShipTo_Postal_Street_Line1', 'Shipping Address Street',
-                       'Ecom_ShipTo_Postal_City', 'Shipping Address City',
-                       'Ecom_ShipTo_Postal_StateProv', 'Shipping Address State',
-                       'Ecom_ShipTo_Postal_PostalCode', 'Shipping Address Zip',
-                       'Ecom_ShipTo_Postal_CountryCode', 'Shipping Address Country',
-                       'Ecom_BillTo_Telecom_Phone_Number', 'Phone Number',
-                       'Ecom_BillTo_Online_Email', 'Email',
-                       'Ecom_Payment_Card_Type', 'Type of Card',
-                       'Ecom_Payment_Card_Number', 'Card Number',
-                       'Ecom_Payment_Card_ExpDate_Month', 'Card Expiration Month',
-                       'Ecom_Payment_Card_ExpDate_Day', 'Card Expiration Day',
-                       'Ecom_Payment_Card_ExpDate_Year', 'Card Expiration Year');
+%sc_order_form_array =(
+	'Ecom_BillTo_Postal_Name_First', 'First Name',
+	'Ecom_BillTo_Postal_Name_Last', 'Last Name',
+	'Ecom_BillTo_Postal_Street_Line1', 'Billing Address Street',
+	'Ecom_BillTo_Postal_City', 'Billing Address City',
+	'Ecom_BillTo_Postal_StateProv', 'Billing Address State',
+	'Ecom_BillTo_PostalCode', 'Billing Address Zip',
+	'Ecom_BillTo_Postal_CountryCode', 'Billing Address Country',
+	'Ecom_ShipTo_Postal_Street_Line1', 'Shipping Address Street',
+	'Ecom_ShipTo_Postal_City', 'Shipping Address City',
+	'Ecom_ShipTo_Postal_StateProv', 'Shipping Address State',
+	'Ecom_ShipTo_Postal_PostalCode', 'Shipping Address Zip',
+	'Ecom_ShipTo_Postal_CountryCode', 'Shipping Address Country',
+	'Ecom_BillTo_Telecom_Phone_Number', 'Phone Number',
+	'Ecom_BillTo_Online_Email', 'Email',
+	'Ecom_Payment_Card_Type', 'Type of Card',
+	'Ecom_Payment_Card_Number', 'Card Number',
+	'Ecom_Payment_Card_ExpDate_Month', 'Card Expiration Month',
+	'Ecom_Payment_Card_ExpDate_Day', 'Card Expiration Day',
+	'Ecom_Payment_Card_ExpDate_Year', 'Card Expiration Year',
+	'Ecom_is_Residential', 'Shipping to Residential Address',
+	'Ecom_ShipTo_Insurance', 'Insure this Shipment', # not implemented yet, for the future
+	'Ecom_tos', 'Sales-Terms of Service');
                         
 
 @sc_order_form_required_fields = (
-	"Ecom_ShipTo_Postal_StateProv",
-	"Ecom_ShipTo_Postal_PostalCode");
+  "Ecom_ShipTo_Postal_StateProv",
+  "Ecom_ShipTo_Postal_PostalCode");
 
+# lines for tos added 2006 April 13 jfindlay
+# if ($sc_display_checkout_tos =~ /yes/i) {
+    push(@sc_order_form_required_fields,"Ecom_tos");
+# }
 }
 ###############################################################################
 sub checkout_verification_table {
   local ($rslt)="";
-  $rslt = "<table border=0 width=100%>\n<tr>\n";
-  $rslt.= "<td width=\"50%\" align=right>State:</td>\n";
-  $rslt.= '<td width = "50%" align=left>' .
-	$form_data{'Ecom_ShipTo_Postal_StateProv'} . "&nbsp;</td>\n";
-  $rslt.= "</tr>\n";
-  $rslt.= "<tr>\n";
-  $rslt.= "<td width=\"50%\" align=right>Zip:</td>\n";
-  $rslt.= '<td width = "50%" align=left>' .
-	$form_data{'Ecom_ShipTo_Postal_PostalCode'} . "&nbsp;</td>\n";
-  $rslt.= "</tr>\n";
-  $rslt.= "</table>\n";
+  $rslt = <<ENDOFTEXT;
+  
+<div align="center">
+<table cellpadding="0" cellspacing="0" class="ac_checkout_review">
+<tr>
+<th colspan="2" class="ac_checkout_review">Customer Information</th>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Customer Number</td>
+<td class="ac_checkout_review_col2">$cart_id</td>
+</tr>
+
+<tr>
+<th colspan="2" class="ac_checkout_review">Shipping Information</th>
+</tr>
+
+ENDOFTEXT
+
+if ($form_data{'Ecom_ShipTo_Method'} ne ""){
+$answer.= <<ENDOFTEXT;
+<tr>
+<td class="ac_checkout_review_col1">Ship via</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Method'}&nbsp;</td>
+</tr>
+ENDOFTEXT
+}
+
+$rslt.= <<ENDOFTEXT;
+
+<tr>
+<td class="ac_checkout_review_col1">State</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_StateProv'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Zip</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_PostalCode'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Country</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_CountryCode'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Residential Address</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_is_Residential'}&nbsp;</td>
+</tr>
+
+</table>
+</div>
+ENDOFTEXT
+
   return $rslt;
  }
 ###############################################################################
@@ -88,23 +141,23 @@
 #
 # To use this, put this in the x_Header_Html in the manager:
 #
-#	<!--agorascript-pre
-#	  return $anet_cart_table;
-#	-->
+# <!--agorascript-pre
+#   return $checkout2_cart_table;
+# -->
 #
 # and in the email footer you can use:
 #
-#	<!--agorascript-pre
-#	  return $anet_prod_in_cart;
-#	-->
+# <!--agorascript-pre
+#   return $checkout2_prod_in_cart;
+# -->
 # 
 
 local (@my_cart_fields,$my_cart_row_number,$result);
 local ($count,$price,$product_id,$quantity,$total_cost,$total_qty)=0;
 local ($name,$cost);
 
- $anet_prod_in_cart = '';
- $anet_cart_table = '';
+ $checkout2_prod_in_cart = '';
+ $checkout2_cart_table = '';
  $result='';
  open (CART, "$sc_cart_path") || &file_open_error("$sc_cart_path", 
             "display_cart_contents_in_header", __FILE__, __LINE__);
@@ -131,18 +184,18 @@
      $result .= "<TABLE CELLPADDING=3 CELLSPACING=0 BORDER=1 WIDTH='100%'>\n";
      $result .= "<TR><TH>QTY</TH><TH>ID #</TH><TH>Description</TH>";
      $result .= "<TH>Cost</TH></TR>\n";
-     $anet_prod_in_cart .= "  --PRODUCT INFORMATION--\n\n";
+     $checkout2_prod_in_cart .= "  --PRODUCT INFORMATION--\n\n";
     }
    $result .= "<TR><TD>$quantity</TD><TD>$product_id</TD>\n";
    $result .= "<TD>$name</TD><TD>$cost</TD>";
    $result .= "</TR>\n";
-   $anet_prod_in_cart .= &cart_textinfo(*my_cart_fields);
+   $checkout2_prod_in_cart .= &cart_textinfo(*my_cart_fields);
   } # End of while (<CART>)
  close (CART);
  if ($result ne '') {
    $result .= "</TABLE></TD></TR></TABLE>\n";
   }
- $anet_cart_table = $result;
+ $checkout2_cart_table = $result;
 }
 
 ###############################################################################
@@ -166,7 +219,7 @@
 if ($merchant_live_mode =~ /yes/i){
   $test_mode = "";
  } else {
-  $test_mode = "<INPUT TYPE=HIDDEN NAME=x_Test_Request VALUE=\"TRUE\">";
+  $test_mode = qq~<input type="hidden" name="demo" value="Y">~;
  }
 
 $invoice_number = $current_verify_inv_no;
@@ -176,91 +229,77 @@
 
 &anet_table_setup;
 $xx_Header_Html_Payment_Form =
-	&script_and_substitute($x_Header_Html_Payment_Form,"Anet");
+  &script_and_substitute($x_Header_Html_Payment_Form,"checkout2");
 $xx_Footer_Html_Payment_Form =
-	&script_and_substitute($x_Footer_Html_Payment_Form,"Anet");
+  &script_and_substitute($x_Footer_Html_Payment_Form,"checkout2");
 $xx_Header_Html_Receipt =
-	&script_and_substitute($x_Header_Html_Receipt,"Anet");
+  &script_and_substitute($x_Header_Html_Receipt,"checkout2");
 $xx_Footer_Html_Receipt =
-	&script_and_substitute($x_Footer_Html_Receipt,"Anet");
+  &script_and_substitute($x_Footer_Html_Receipt,"checkout2");
 $xx_Header_Email_Receipt =
-	&script_and_substitute($x_Header_Email_Receipt,"Anet");
+  &script_and_substitute($x_Header_Email_Receipt,"checkout2");
 $xx_Footer_Email_Receipt =
-	&script_and_substitute($x_Footer_Email_Receipt,"Anet");
+  &script_and_substitute($x_Footer_Email_Receipt,"checkout2");
 if ($x_Description eq '') {
   $x_Description = "Online Order"; # default value
 }
 $xx_Description =
-	&script_and_substitute($x_Description,"Anet");
+  &script_and_substitute($x_Description,"checkout2");
 
 &codehook("checkout-SubmitPage-print");
 
 print <<ENDOFTEXT;
-
-<FORM METHOD=POST ACTION=\"$sc_order_script_url\">
-<INPUT TYPE=HIDDEN NAME=x_Amount VALUE=\"$sc_money_symbol$authPrice\">
-<INPUT TYPE=HIDDEN NAME=x_Freight VALUE=\"$zfinal_shipping\">
-<INPUT TYPE=HIDDEN NAME=ud_Discount VALUE=\"$zfinal_discount\">
-<INPUT TYPE=HIDDEN NAME=x_Tax VALUE=\"$zfinal_sales_tax\">
-
-<INPUT TYPE=HIDDEN NAME=x_Login VALUE=\"$sc_gateway_username\">
-<INPUT TYPE=HIDDEN NAME=x_Invoice_Num VALUE=\"$invoice_number\">
-<INPUT TYPE=HIDDEN NAME=x_Description VALUE=\"$xx_Description\">
-<INPUT TYPE=HIDDEN NAME=x_Cust_ID VALUE=\"$customer_number\">
-<INPUT TYPE=HIDDEN NAME=x_Show_Form VALUE=\"PAYMENT_FORM\">
-
-<INPUT TYPE=HIDDEN NAME=x_Receipt_Link_Method VALUE=\"POST\">
-<INPUT TYPE=HIDDEN NAME=x_Receipt_Link_Text VALUE=\"YOU MUST CLICK HERE TO FINALIZE YOUR ORDER!\">
-<INPUT TYPE=HIDDEN NAME=x_Receipt_Link_URL VALUE=\"$sc_store_url\">
+<div align="center">
+<table width="500" cellpadding="5" cellspacing="0" border="0">
+<tr>
+<td>
+<p class="ac_checkout_top_msg">$sc_2CO_verify_message</p>
+<div align="center">
+<form method="post" action="$sc_order_script_url">
+
+<input type="hidden" name="x_amount" value="$authPrice">
+<input type="hidden" name="x_Freight" value="$zfinal_shipping">
+<input type="hidden" name="ud_Discount" value="$zfinal_discount">
+<input type="hidden" name="x_Tax" value="$zfinal_sales_tax">
+
+<input type="hidden" name="x_login" value="$sc_gateway_username">
+<input type="hidden" name="x_invoice_num" value="$invoice_number">
+<input type="hidden" name="x_Description" value="$xx_Description">
+<input type="hidden" name="x_Cust_ID" value="$customer_number">
+<input type="hidden" name="x_Show_Form" value="PAYMENT_FORM">
+
+<input type="hidden" name="x_Receipt_Link_Method" value="POST">
+<input type="hidden" name="x_Receipt_Link_Text" value="YOU MUST CLICK HERE TO FINALIZE YOUR ORDER!">
+<input type="hidden" name="x_Receipt_Link_URL" value="$sc_ssl_location_url2">
 $test_mode
-<INPUT TYPE=HIDDEN NAME=x_ADC_URL VALUE=\"$sc_store_url\">
-<INPUT TYPE=HIDDEN NAME=x_ADC_Relay_Response VALUE=\"true\">
-<INPUT TYPE=HIDDEN NAME=x_Version VALUE=\"3.0\">
-
-<INPUT TYPE=HIDDEN NAME=x_Logo_URL VALUE=\"$x_Logo_URL\">
-<INPUT TYPE=HIDDEN NAME=x_Color_Background VALUE=\"$x_Color_Background\">
-<INPUT TYPE=HIDDEN NAME=x_Color_Link VALUE=\"$x_Color_Link\">
-<INPUT TYPE=HIDDEN NAME=x_Color_Text VALUE=\"$x_Color_Text\">
-<INPUT TYPE=HIDDEN NAME=x_Header_Html_Payment_Form VALUE=\"$xx_Header_Html_Payment_Form\">
-<INPUT TYPE=HIDDEN NAME=x_Footer_Html_Payment_Form VALUE=\"$xx_Footer_Html_Payment_Form\">
-<INPUT TYPE=HIDDEN NAME=x_Header_Html_Receipt VALUE=\"$xx_Header_Html_Receipt\">
-<INPUT TYPE=HIDDEN NAME=x_Footer_Html_Receipt VALUE=\"$xx_Footer_Html_Receipt\">
-<INPUT TYPE=HIDDEN NAME=x_Header_Email_Receipt VALUE=\"$xx_Header_Email_Receipt\">
-<INPUT TYPE=HIDDEN NAME=x_Footer_Email_Receipt VALUE=\"$xx_Footer_Email_Receipt\">
-<INPUT TYPE=HIDDEN NAME=Ecom_ShipTo_Method VALUE=\"$form_data{'Ecom_ShipTo_Method'}\">
-<INPUT TYPE=HIDDEN NAME=X_Ship_To_State VALUE=\"$form_data{'Ecom_ShipTo_Postal_StateProv'}\">
-<INPUT TYPE=HIDDEN NAME=X_Ship_To_Zip VALUE=\"$form_data{'Ecom_ShipTo_Postal_PostalCode'}\">
+<input type="hidden" name="x_ADC_URL" value="$sc_ssl_location_url2">
+<input type="hidden" name="x_ADC_Relay_Response" value="true">
+<input type="hidden" name="x_Version" value="3.0">
+
+<input type="hidden" name="x_Logo_URL" value="$x_Logo_URL">
+<input type="hidden" name="x_Color_Background" value="$x_Color_Background">
+<input type="hidden" name="x_Color_Link" value="$x_Color_Link">
+<input type="hidden" name="x_Color_Text" value="$x_Color_Text">
+<input type="hidden" name="x_Header_Html_Payment_Form" value="$xx_Header_Html_Payment_Form">
+<input type="hidden" name="x_Footer_Html_Payment_Form" value="$xx_Footer_Html_Payment_Form">
+<input type="hidden" name="x_Header_Html_Receipt" value="$xx_Header_Html_Receipt">
+<input type="hidden" name="x_Footer_Html_Receipt" value="$xx_Footer_Html_Receipt">
+<input type="hidden" name="x_Header_Email_Receipt" value="$xx_Header_Email_Receipt">
+<input type="hidden" name="x_Footer_Email_Receipt" value="$xx_Footer_Email_Receipt">
+<input type="hidden" name="Ecom_ShipTo_Method" value="$form_data{'Ecom_ShipTo_Method'}">
+<input type="hidden" name="x_Ship_To_State" value="$form_data{'Ecom_ShipTo_Postal_StateProv'}">
+<input type="hidden" name="x_Ship_To_Zip" value="$form_data{'Ecom_ShipTo_Postal_PostalCode'}">
+<input type="hidden" name="x_Ship_To_Country" value="$form_data{'Ecom_ShipTo_Postal_CountryCode'}">
 
-<TABLE WIDTH="500" BGCOLOR="#C0FFFF" CELLPADDING="0" CELLSPACING="0">
-<TR>
-<TD>
-
-<TABLE WIDTH="500" BGCOLOR="#000080" CELLPADDING="0" CELLSPACING="0">
-<TR BGCOLOR="#C0FFFF">
-<TD BGCOLOR="#C0FFFF"><FONT FACE="ARIAL" SIZE="2" COLOR="#000000">
-$messages{'ordcnf_06'}</FONT></TD>
-<TD  BGCOLOR="#C0FFFF">
-</TR>
-<TR BGCOLOR="#C0FFFF">
-<TD BGCOLOR="#C0FFFF"><FONT FACE="ARIAL" SIZE="2" COLOR="#000000">
 $mytable
-</TD></TR>
-<TR BGCOLOR="#C0FFFF">
-<TD>
-<CENTER>
-<INPUT TYPE=SUBMIT VALUE="Secure Orderform">
-</CENTER>
-</TD>
-</TR>
-</TABLE>
-
-</TD>
-</TR>
-</TABLE>
-
-</FORM>
-</CENTER>
-
+<br/>
+<input type="image" name="Submit" value="Submit Order For Processing" src="$sc_2CO_submit">
+</div>
+</form>
+</td>
+</tr>
+</table>
+</div>
 ENDOFTEXT
 
 }
@@ -275,6 +314,47 @@
 local($stevo_shipping_names) = "";
 local($mytext) = "";
 local($ship_thing_too,$ship_instructions);
+local(%orderLoggingHash);
+
+#alt origination stuff added by Mister Ed Feb 17, 2005
+if ($sc_alt_origin_enabled =~ /yes/i) {
+  local(%zip_list);
+  local(%zip_names_list);
+}
+
+# Now let's check the _VERIFY file, just to be sure ...
+# Added 2006 April 13 by jfindlay
+if (!(-f "$sc_verify_order_path")){
+print <<ENDOFTEXT;
+<CENTER>
+<TABLE WIDTH=500>
+<TR>
+<TD WIDTH=500>
+<FONT FACE=ARIAL>
+$messages{'ordcnf_03'}
+$messages{'ordcnf_02'}
+</FONT>
+</TD>
+</TR>
+</TABLE>
+<CENTER>
+ 
+ENDOFTEXT
+ 
+# and the footer is printed
+ 
+&SecureStoreFooter;
+ 
+print qq!
+</BODY>
+</HTML>
+!;
+ 
+&file_open_error("$sc_verify_order_path", 
+	"2checkout Check for Verify file", __FILE__, __LINE__);
+&call_exit;
+ 
+ }
 
 #
 # Need to process this info someday ...
@@ -300,6 +380,9 @@
 
 $orderDate = &get_date;
 
+# NEW CODEHOOK
+&codehook("process-order-routine-top");
+
 print qq!
 <HTML>
 $sc_special_page_meta_tags
@@ -342,11 +425,69 @@
 
 # All went well at 2checkout, proceed with processing
 
+# initialize hash variables in case they are empty later
+# added by jfindlay 2006 April 13
+
+$orderLoggingHash{'firstName'} = "";
+$orderLoggingHash{'lastName'} = "";
+$orderLoggingHash{'fullName'} = "";
+$orderLoggingHash{'orderFromAddress'} = "";
+$orderLoggingHash{'customerAddress2'} = "";
+$orderLoggingHash{'customerAddress3'} = "";
+$orderLoggingHash{'orderFromCity'} = "";
+$orderLoggingHash{'orderFromPostal'} = "";
+$orderLoggingHash{'customerPhone'} = "";
+$orderLoggingHash{'faxNumber'} = "";
+$orderLoggingHash{'companyName'} = "";
+$orderLoggingHash{'emailAddress'} = "";
+
+$orderLoggingHash{'shipToName'} = "";
+$orderLoggingHash{'shipToAddress'} = "";
+$orderLoggingHash{'shipToAddress2'} = "";
+$orderLoggingHash{'shipToAddress3'} = "";
+$orderLoggingHash{'shipToCity'} = "";
+$orderLoggingHash{'shipToState'} = "";
+$orderLoggingHash{'shipToPostal'} = "";
+$orderLoggingHash{'shipToCountry'} = "";
+$orderLoggingHash{'shiptoResidential'} = "$eform_Ecom_is_Residential";
+$orderLoggingHash{'insureShipment'} = "$eform_Ecom_ShipTo_Insurance"; # not implemented yet, for the future
+
+$orderLoggingHash{'invoiceNumber'} = "";
+$orderLoggingHash{'customerNumber'} = "";
+$orderLoggingHash{'orderStatus'} = "$sc_order_status_default";
+$orderLoggingHash{'user1'} = "";
+$orderLoggingHash{'user2'} = "";
+$orderLoggingHash{'user3'} = "";
+$orderLoggingHash{'user4'} = "";
+$orderLoggingHash{'user5'} = "";
+$orderLoggingHash{'itemsordered'} = "";
+$orderLoggingHash{'shiptrackingID'} = "";
+$orderLoggingHash{'shipMethod'} = "";
+$orderLoggingHash{'orderFromState'} = "";
+$orderLoggingHash{'orderFromCountry'} = "";
+$orderLoggingHash{'shippingTotal'} = "";
+$orderLoggingHash{'salesTax'} = "";
+$orderLoggingHash{'tax1'} = "";
+$orderLoggingHash{'tax2'} = "";
+$orderLoggingHash{'tax3'} = "";
+$orderLoggingHash{'discounts'} = "";
+$orderLoggingHash{'netProfit'} = "";
+$orderLoggingHash{'affiliateTotal'} = "";
+$orderLoggingHash{'affiliateID'} = "";
+$orderLoggingHash{'affiliateMisc'} = "";
+$orderLoggingHash{'subTotal'} = "";
+$orderLoggingHash{'orderTotal'} = "";
+$orderLoggingHash{'adminMessages'} = "";
+$orderLoggingHash{'shippingMessages'} = "";
+$orderLoggingHash{'xcomments'} = "";
+$orderLoggingHash{'termsOfService'} = "$vform_Ecom_tos";
+
 print $mytext;
 
 $text_of_cart .= "${mytext}";
 $text_of_cart .= "Order Date:    $orderDate\n";
 $text_of_cart .= "Gateway:       2checkout\n\n";
+$orderLoggingHash{'GatewayUsed'} = "2checkout";
 
 $text_of_cart .= "  --PRODUCT INFORMATION--\n\n";
 
@@ -354,20 +495,20 @@
 &file_open_error("$sc_cart_path", "display_cart_contents", __FILE__, __LINE__);
 
 while (<CART>)
-	{
-	$cartData++;
-	@cart_fields = split (/\|/, $_);
-	$quantity = $cart_fields[0];
-	$product_price = $cart_fields[3];
-	$product = $cart_fields[4];
-	$weight = $cart_fields[6];
-	$options = $cart_fields[$cart{"options"}];
-	$options =~ s/<br>/ /g;
+  {
+  $cartData++;
+  @cart_fields = split (/\|/, $_);
+  $quantity = $cart_fields[0];
+  $product_price = $cart_fields[3];
+  $product = $cart_fields[4];
+  $weight = $cart_fields[6];
+  $options = $cart_fields[$cart{"options"}];
+  $options =~ s/<br>/ /g;
         $text_of_cart .= &cart_textinfo(*cart_fields);
         $stevo_shipping_thing .="|$quantity\*$weight";
         $stevo_shipping_names .="|$product\($options\)";
         &codehook("process-cart-item");
-	}
+  }
 close(CART);
 
 $sc_orderlib_use_SBW_for_ship_ins = $sc_use_SBW;
@@ -377,110 +518,184 @@
    &ship_put_in_boxes($stevo_shipping_thing,$stevo_shipping_names,
    $sc_verify_Origin_ZIP,$sc_verify_boxes_max_wt); 
  }
+$orderLoggingHash{'shippingMessages'} = "$ship_instructions";
+$orderLoggingHash{'shippingMessages'} =~ s/\n/<br>/g;
 
-	$text_of_confirm_email .= $messages{'ordcnf_07'};
+  $text_of_confirm_email .= $messages{'ordcnf_07'};
 
-	$text_of_confirm_email .= $text_of_cart;
-	$text_of_confirm_email .= "\n";
+  $text_of_confirm_email .= $text_of_cart;
+  $text_of_confirm_email .= "\n";
 
-	$text_of_cart .= "  --ORDER INFORMATION--\n\n";
+  $text_of_cart .= "  --ORDER INFORMATION--\n\n";
+
+  $text_of_cart .= "CUSTID:        $form_data{'x_Cust_ID'}\n";
+  $text_of_confirm_email .= "CUSTID:        $form_data{'x_Cust_ID'}\n";
+  $orderLoggingHash{'customerNumber'} = "$form_data{'x_Cust_ID'}";
+
+
+  $text_of_cart .= "INVOICE:       $form_data{'x_invoice_num'}\n";
+  $text_of_confirm_email .= "INVOICE:       $form_data{'x_invoice_num'}\n";
+  $orderLoggingHash{'invoiceNumber'} = "$form_data{'x_invoice_num'}";
+
+  # subtotal added 2006 April 13 by jfindlay
+  $temp = &display_price($sc_verify_subtotal);
+  &add_text_of_both("SUBTOTAL",$temp);
+  $orderLoggingHash{'subTotal'} = "$sc_verify_subtotal";
+  $orderLoggingHash{'shipMethod'} = "$vform_Ecom_ShipTo_Method";
+
+  if ($form_data{'x_freight'}) {
+    $text_of_cart .= "SHIPPING:      $form_data{'x_Freight'}\n";
+    $text_of_confirm_email .= "SHIPPING:      $form_data{'x_Freight'}\n";
+    $orderLoggingHash{'shippingTotal'} = "$form_data{'x_Freight'}";
+      if (($sc_use_SBW =~ /yes/i) || ($form_data{'x_Freight'} > .009)) {
+          $text_of_confirm_email .= "SHIP VIA:      $vform_Ecom_ShipTo_Method\n";
+          $text_of_cart .= "SHIP VIA:      $vform_Ecom_ShipTo_Method\n";
+      }
+  }
+
+  if ($form_data{'ud_Discount'})
+  {
+  $text_of_cart .= "DISCOUNT:      $form_data{'ud_Discount'}\n";
+  $text_of_confirm_email .= "DISCOUNT:      $form_data{'ud_Discount'}\n";
+  $orderLoggingHash{'discounts'} = "$form_data{'ud_Discount'}";
+  # start of adjustment for discount addon
+    $text_of_cart .= "DISCOUNT CODE: $eform_Ecom_Discount\n";
+    $text_of_confirm_email .= "DISCOUNT CODE: $eform_Ecom_Discount\n";
+  # end of adjustment for discount addon
+  }
 
-	$text_of_cart .= "CUSTID:        $form_data{'x_cust_id'}\n";
-	$text_of_confirm_email .= "CUSTID:        $form_data{'x_cust_id'}\n";
-
-	$text_of_cart .= "INVOICE:       $form_data{'x_invoice_num'}\n";
-	$text_of_confirm_email .= "INVOICE:       $form_data{'x_invoice_num'}\n";
-
-	if ($form_data{'x_freight'})
-	{
-	$text_of_cart .= "SHIPPING:      $form_data{'x_freight'}\n";
-	$text_of_confirm_email .= "SHIPPING:      $form_data{'x_freight'}\n";
-        if ($sc_use_SBW =~ /yes/i)
-         {
-           $text_of_confirm_email .= 
-                        "SHIP VIA:      $form_data{'HW2SHIP'}\n";
-         }
-	}
-
-	if ($form_data{'ud_Discount'})
-	{
-	$text_of_cart .= "DISCOUNT:      $form_data{'ud_Discount'}\n";
-	$text_of_confirm_email .= "DISCOUNT:      $form_data{'ud_Discount'}\n";
-	}
-
-	if ($form_data{'x_tax'})
-	{
-	$text_of_cart .=          "TOT SALES TAX: $form_data{'x_tax'}\n";
-	$text_of_confirm_email .= "TOT SALES TAX: $form_data{'x_tax'}\n";
-	}
+  if ($form_data{'x_tax'})
+  {
+  $text_of_cart .=          "TOT SALES TAX: $form_data{'x_tax'}\n";
+  $text_of_confirm_email .= "TOT SALES TAX: $form_data{'x_tax'}\n";
+  }
 
 if ($sc_verify_tax > 0)
 {
 $temp = substr(substr("SALES TAX",0,13).":               ",0,15);
 $text_of_cart .= "$temp$sc_verify_tax\n";
 $text_of_confirm_email .= "$temp$sc_verify_tax\n";
+$orderLoggingHash{'salesTax'} = "$form_data{$sc_verify_tax}";
 }
 if ($sc_verify_etax1 > 0)
 {
 $temp = substr(substr($sc_extra_tax1_name,0,13).":               ",0,15);
 $text_of_cart .= "$temp$sc_verify_etax1\n";
 $text_of_confirm_email .= "$temp$sc_verify_etax1\n";
+$orderLoggingHash{'tax1'} = "$sc_verify_etax1";
 }
 if ($sc_verify_etax2 > 0)
 {
 $temp = substr(substr($sc_extra_tax2_name,0,13).":               ",0,15);
 $text_of_cart .= "$temp$sc_verify_etax2\n";
 $text_of_confirm_email .= "$temp$sc_verify_etax2\n";
+$orderLoggingHash{'tax2'} = "$sc_verify_etax2";
 }
 if ($sc_verify_etax3 > 0)
 {
 $temp = substr(substr($sc_extra_tax3_name,0,13).":               ",0,15);
 $text_of_cart .= "$temp$sc_verify_etax3\n";
 $text_of_confirm_email .= "$temp$sc_verify_etax3\n";
+$orderLoggingHash{'tax3'} = "$sc_verify_etax3";
 }
 
-	$text_of_cart .= "TOTAL:         $form_data{'x_amount'}\n";
-	$text_of_confirm_email .= "TOTAL:         $form_data{'x_amount'}\n";
+  $text_of_cart .= "TOTAL:         $form_data{'x_amount'}\n";
+  $text_of_confirm_email .= "TOTAL:         $form_data{'x_amount'}\n";
+  $orderLoggingHash{'orderTotal'} = "$form_data{'x_amount'}";
+
+  $text_of_cart .= "METHOD:        $form_data{'x_method'}\n";
+  $text_of_cart .= "TYPE:          $form_data{'x_type'}\n";
+  $text_of_cart .= "DESCRIPTION:   $form_data{'x_description'}\n\n";
+  
+  $text_of_cart .= "RESP CODE:     $form_data{'x_response_code'}\n";
+  $text_of_cart .= "RESP SUBCODE:  $form_data{'x_response_subcode'}\n";
+  $text_of_cart .= "REASON CODE:   $form_data{'x_response_reason_code'}\n";
+  $text_of_cart .= "REASON TEXT:   $form_data{'x_response_reason_text'}\n";
+  $text_of_cart .= "AUTH CODE:     $form_data{'x_auth_code'}\n";
+  $text_of_cart .= "AVS CODE:      $form_data{'x_avs_code'}\n";
+  $text_of_cart .= "TRANS ID:      $form_data{'x_trans_id'}\n\n";
+	$orderLoggingHash{'adminMessages'} .= "<br>AUTHORIZATION INFORMATION --------------<br>RESP CODE: $form_data{'x_response_code'}<br>RESP SUBCODE: $form_data{'x_response_subcode'}<br>REASON CODE: $form_data{'x_response_reason_code'}<br>REASON TEXT: $form_data{'x_response_reason_text'}<br>AUTH CODE: $form_data{'x_auth_code'}<br>AVS CODE: $form_data{'x_avs_code'}<br>TRANS ID: $form_data{'x_trans_id'}<br>---------------------------------------------------------------<br>";
+  
+  $text_of_cart .= "BILLING INFORMATION --------------\n\n";
+	#$text_of_cart .= "NAME:          $form_data{'x_first_name'} $form_data{'x_last_name'}\n";
+  #$orderLoggingHash{'fullName'} = "$form_data{'x_first_name'} $form_data{'x_last_name'}";
+  $text_of_cart .= "NAME:          $form_data{'cardholder_name'}\n";
+  $orderLoggingHash{'fullName'} = "$form_data{'cardholder_name'}";
+
+  $text_of_cart .= "COMPANY:       $form_data{'x_company'}\n";
+  $orderLoggingHash{'companyName'} = "$form_data{'x_company'}";
+
+  $text_of_cart .= "ADDRESS:       $form_data{'x_Address'}\n";
+  $orderLoggingHash{'orderFromAddress'} = "$form_data{'x_Address'}";
+
+  $text_of_cart .= "CITY:          $form_data{'x_City'}\n";
+  $orderLoggingHash{'orderFromCity'} = "$form_data{'x_City'}";
+
+  $text_of_cart .= "STATE:         $form_data{'x_State'}\n";
+  $orderLoggingHash{'orderFromState'} = "$form_data{'x_State'}";
+
+  $text_of_cart .= "ZIP:           $form_data{'x_Zip'}\n";
+  $orderLoggingHash{'orderFromPostal'} = "$form_data{'x_Zip'}";
+
+  $text_of_cart .= "COUNTRY:       $form_data{'x_Country'}\n";
+  $orderLoggingHash{'orderFromCountry'} = "$form_data{'x_Country'}";
+
+  $text_of_cart .= "PHONE:         $form_data{'x_Phone'}\n";
+  $orderLoggingHash{'customerPhone'} = "$form_data{'x_Phone'}";
+
+  $text_of_cart .= "FAX:           $form_data{'x_Fax'}\n";
+  $orderLoggingHash{'faxNumber'} = "$form_data{'x_Fax'}";
+
+  $text_of_cart .= "EMAIL:         $form_data{'x_Email'}\n\n";
+  $orderLoggingHash{'emailAddress'} = "$form_data{'x_Email'}";
+
+  $text_of_cart .= "SHIPPING INFORMATION --------------\n\n";
 
-	$text_of_cart .= "METHOD:        $form_data{'x_method'}\n";
-	$text_of_cart .= "TYPE:          $form_data{'x_type'}\n";
-	$text_of_cart .= "DESCRIPTION:   $form_data{'x_description'}\n\n";
-	
-	$text_of_cart .= "RESP CODE:     $form_data{'x_response_code'}\n";
-	$text_of_cart .= "RESP SUBCODE:  $form_data{'x_response_subcode'}\n";
-	$text_of_cart .= "REASON CODE:   $form_data{'x_response_reason_code'}\n";
-	$text_of_cart .= "REASON TEXT:   $form_data{'x_response_reason_text'}\n";
-	$text_of_cart .= "AUTH CODE:     $form_data{'x_auth_code'}\n";
-	$text_of_cart .= "AVS CODE:      $form_data{'x_avs_code'}\n";
-	$text_of_cart .= "TRANS ID:      $form_data{'x_trans_id'}\n\n";
-	
-	$text_of_cart .= "BILLING INFORMATION --------------\n\n";
-	$text_of_cart .= "NAME:          $form_data{'x_first_name'} $form_data{'x_last_name'}\n";
-	$text_of_cart .= "COMPANY:       $form_data{'x_company'}\n";
-	$text_of_cart .= "ADDRESS:       $form_data{'x_address'}\n";
-	$text_of_cart .= "CITY:          $form_data{'x_city'}\n";
-	$text_of_cart .= "STATE:         $form_data{'x_state'}\n";
-	$text_of_cart .= "ZIP:           $form_data{'x_zip'}\n";
-	$text_of_cart .= "COUNTRY:       $form_data{'x_country'}\n";
-	$text_of_cart .= "PHONE:         $form_data{'x_phone'}\n";
-	$text_of_cart .= "FAX:           $form_data{'x_fax'}\n";
-	$text_of_cart .= "EMAIL:         $form_data{'x_email'}\n\n";
-	$text_of_cart .= "SHIPPING INFORMATION --------------\n\n";
-	$text_of_cart .= "SHIP VIA:      $form_data{'Ecom_ShipTo_Method'}\n";
-	$text_of_cart .= "NAME:          $form_data{'x_ship_to_first_name'} $form_data{'x_ship_to_last_name'}\n";
-	$text_of_cart .= "COMPANY:       $form_data{'x_ship_to_company'}\n";
-	$text_of_cart .= "ADDRESS:       $form_data{'x_ship_to_address'}\n";
-	$text_of_cart .= "CITY:          $form_data{'x_ship_to_city'}\n";
-	$text_of_cart .= "STATE:         $form_data{'x_ship_to_state'}\n";
-	$text_of_cart .= "ZIP:           $form_data{'x_ship_to_zip'}\n";
-	$text_of_cart .= "COUNTRY:       $form_data{'x_ship_to_country'}\n\n";
+  $text_of_cart .= "SHIP VIA:      $form_data{'Ecom_ShipTo_Method'}\n";
+  $orderLoggingHash{'shipToName'} = "$form_data{'Ecom_ShipTo_Method'}";
 
+	# since 2CO doesn't allow for filling in shipping info, the billing
+	# info is cloned
+  $text_of_cart .= "NAME:          $form_data{'cardholder_name'}\n";
+  $orderLoggingHash{'shipToName'} = "$form_data{'cardholder_name'}";
+
+  $text_of_cart .= "COMPANY:       $form_data{'x_Company'}\n";
+	# don't overwrite billto company
+	#$orderLoggingHash{'companyName'} = "$form_data{'x_ship_to_company'}"
+
+  $text_of_cart .= "ADDRESS:       $form_data{'x_Address'}\n";
+  $orderLoggingHash{'shipToAddress'} = "$form_data{'x_Address'}";
+
+  $text_of_cart .= "CITY:          $form_data{'x_City'}\n";
+  $orderLoggingHash{'shipToCity'} = "$form_data{'x_City'}";
+
+  $text_of_cart .= "STATE:         $form_data{'x_Ship_To_State'}\n";
+  $orderLoggingHash{'shipToState'} = "$form_data{'x_Ship_To_State'}";
+
+  $text_of_cart .= "ZIP:           $form_data{'x_Ship_To_Zip'}\n";
+  $orderLoggingHash{'shipToPostal'} = "$form_data{'x_Ship_To_Zip'}";
+
+  $text_of_cart .= "COUNTRY:       $form_data{'x_Ship_To_Country'}\n\n";
+  $orderLoggingHash{'shipToCountry'} = "$form_data{'x_Ship_To_Country'}";
+
+# NEW CODEHOOK
+&codehook("process-order-pre-ship-instructions");
+ 
   if ($ship_instructions ne "") {
-	$text_of_cart .= "Shipping Instructions: \n$ship_instructions\n\n";
+  $text_of_cart .= "Shipping Instructions: \n$ship_instructions\n\n";
   }
 
+# NEW CODEHOOK
+&codehook("process-order-pre-xcomments");
+
 $text_of_cart .= $XCOMMENTS_ADMIN;
+$orderLoggingHash{'xcomments'} = "$XCOMMENTS";
+$orderLoggingHash{'xcomments'} =~ s/\n/<br>/g;
+$orderLoggingHash{'adminMessages'} =~ s/\t/ /g;
 $text_of_confirm_email .= $XCOMMENTS;
+$orderLoggingHash{'adminMessages'} .= "$XCOMMENTS_ADMIN";
+$orderLoggingHash{'adminMessages'} =~ s/\n/<br>/g;
+$orderLoggingHash{'adminMessages'} =~ s/\t/ /g;
 
 # 'Init' the emails ...
 $text_of_cart = &init_shop_keep_email . $text_of_cart;
@@ -499,18 +714,24 @@
 
 if ($sc_send_order_to_email =~ /yes/i)
 {
-&send_mail($sc_admin_email, $sc_order_email, "Agora.cgi Order",$text_of_cart);
+&send_mail($sc_admin_email, $sc_order_email, $x_Description, $text_of_cart);
 }
 
 &log_order($text_of_cart,$form_data{'x_invoice_num'},$form_data{'x_cust_id'});
 
-if (($cartData) && ($form_data{'x_email'} ne ""))
+if (($cartData) && ($form_data{'x_Email'} ne ""))
 {
-&send_mail($sc_admin_email, $form_data{'x_email'}, $messages{'ordcnf_08'},
+&send_mail($sc_admin_email, $form_data{'x_Email'}, $messages{'ordcnf_08'},
            "$text_of_confirm_email");
 }
 $sc_affiliate_order_unique = $form_data{'x_invoice_num'};
 $sc_affiliate_order_total = $form_data{'x_amount'};
+
+$sc_affiliate_image_call =~ s/AMOUNT/$sc_affiliate_order_total/g;
+$sc_affiliate_image_call =~ s/UNIQUE/$sc_affiliate_order_unique/g;
+
+# NEW CODEHOOK
+&codehook("process-order-display-thankyou-page");
   
 print <<ENDOFTEXT;
 <CENTER>
diff -ruN 4.0K-4b/library/AgoraPay-mgr_lib.pl 5.0.000/library/AgoraPay-mgr_lib.pl
--- 4.0K-4b/library/AgoraPay-mgr_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/AgoraPay-mgr_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -4,11 +4,11 @@
 # For more signup for AgoraPay or to become an AgoraPay authorized reseller
 # Please visit AgoraPay.com for more details.
 #
-# Copyright K-Factor Technologies, inc.  
+# Copyright K-Factor Technologies, Inc.  & AgoraScript
 # All Rights Reserved.
-# November 10, 2001
+# November 10, 2001 to Present
 
-$versions{'AgoraPay-mgr_lib.pl'} = "20011110";
+$versions{'AgoraPay-mgr_lib.pl'} = "5.0.000";
 &add_codehook("gateway_admin_screen","AgoraPay_mgr_check");
 &add_codehook("gateway_admin_settings","AgoraPay_settings");
 $mc_gateways .= "|AgoraPay";
@@ -21,13 +21,47 @@
    print (GW "\$sc_gateway_username = \"$in{'sc_gateway_username'}\";\n");
    print (GW "\$sc_order_script_url = \"$in{'order_url'}\";\n");
    print (GW "\$mername = \"$in{'mername'}\";\n");
+   print (GW "\$merchant_live_mode = \"$in{'live_mode'}\";\n");
+   print (GW "\$sc_agorapay_submit = '$in{'sc_agorapay_submit'}';\n");
+   print (GW "\$sc_agorapay_change = '$in{'sc_agorapay_change'}';\n");
+   print (GW "\$sc_agorapay_verify_message = \"" . 
+         &my_escape($in{'sc_agorapay_verify_message'}) . "\";\n");
+   print (GW "\$sc_agorapay_order_desc = \"" . 
+         &my_escape($in{'sc_agorapay_order_desc'}) . "\";\n");
+   print (GW "\$sc_display_checkout_tos = \"$in{'sc_display_checkout_tos'}\";\n");
+   $sc_tos_display_address_temp = &my_escape($in{'sc_tos_display_address'});
+   print (GW "\$sc_tos_display_address = qq'$sc_tos_display_address_temp';\n");
+   print (GW "\$sc_agorapay_top_message = \"" . 
+         &my_escape($in{'sc_agorapay_top_message'}) . "\";\n");
+   print (GW "\$AgoraPay_order_ok_final_msg_tbl = \"" . 
+         &my_escape($in{'AgoraPay_order_ok_final_msg_tbl'}) . "\";\n");
+   print (GW "\$AgoraPay_merch_message = \"" . 
+         &my_escape($in{'AgoraPay_merch_message'}) . "\";\n");
+   print (GW "\$AgoraPay_bodyback = \"" . 
+         &my_escape($in{'AgoraPay_bodyback'}) . "\";\n");
+   print (GW "\$AgoraPay_fontcolor = \"" . 
+         &my_escape($in{'AgoraPay_fontcolor'}) . "\";\n");
+   print (GW "\$AgoraPay_linkcolor = \"" . 
+         &my_escape($in{'AgoraPay_linkcolor'}) . "\";\n");
+   print (GW "\$AgoraPay_enablebodytags = \"$in{'AgoraPay_enablebodytags'}\";\n");
+   print (GW "\$AgoraPay_Logo_URL = \"$in{'AgoraPay_Logo_URL'}\";\n");
+   print (GW "\$AgoraPay_backimage_URL = \"$in{'AgoraPay_backimage_URL'}\";\n");
+
+  
    print (GW "\$acceptcards = \"$in{'acceptcards'}\";\n");
+if ($in{'acceptcards'} eq 1) {
+   print (GW "\$acceptvisa = \"$in{'acceptvisa'}\";\n");
+   print (GW "\$acceptmastercard = \"$in{'acceptmastercard'}\";\n");
+   print (GW "\$acceptdiscover = \"$in{'acceptdiscover'}\";\n");
+   print (GW "\$acceptamex = \"$in{'acceptamex'}\";\n");
+   print (GW "\$acceptdiners = \"$in{'acceptdiners'}\";\n");
+}
+
    print (GW "\$acceptchecks = \"$in{'acceptchecks'}\";\n");
    print (GW "\$accepteft = \"$in{'accepteft'}\";\n");
    print (GW "\$altaddr = \"$in{'altaddr'}\";\n");
    print (GW "\$email_text = \"$email_text\";\n");
-   print (GW "\$merchant_live_mode = \"$in{'live_mode'}\";\n");
-   print (GW "1\;\n");
+   print (GW "#\n1\;\n");
    close(GW);
   }
  }
@@ -40,16 +74,20 @@
 }
 ##############################################################################
 sub print_AgoraPay_mgr_form {
-	
+  
 ##
 ## AgoraPay
 ##
 
+if ($sc_display_checkout_tos eq '') { # default it in
+  $sc_display_checkout_tos = "yes";
+ }
+
 print &$manager_page_header("AgoraPay Gateway","","","","");
 
 print <<ENDOFTEXT;
 <CENTER>
-<TABLE WIDTH=580>
+<TABLE width=96%>
 
 <TR>
 <TD COLSPAN=2><HR></TD>
@@ -58,15 +96,18 @@
 <TR>
 <TD COLSPAN="2">
 <FONT FACE=ARIAL>
-AgoraPay Settings<br>$msg<br>
-Don't forget that AgoraPay uses PGP signatures to validate
+<b>AgoraPay Settings</b><br>$msg<br>
+
+Find out more about ths gateway at: <a href="http://www.AgoraPay.com/">
+http://www.AgoraPay.com</a><br><br>
+<!--Don't forget that AgoraPay uses PGP signatures to validate
 every transaction.  To take full advantage of this, you should
 install PGP or RSA-enabled GPG on your server and set it up properly 
 on the PGP/GPG page.  You will need to import the
 AgoraPay public key as well, see the instructions at:<br><br>
 &nbsp;&nbsp;&nbsp;&nbsp;
 <a href="http://www.AgoraPay.com/support/pgp.html">
-http://www.AgoraPay.com/support/pgp.html</a><br>
+http://www.AgoraPay.com/support/pgp.html</a><br>-->
 </FONT>
 
 </TD>
@@ -97,7 +138,7 @@
 <FONT FACE=ARIAL SIZE=2>
 <FORM METHOD="POST" ACTION="manager.cgi">
 <CENTER>
-<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
+<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0 width=96%>
 
 <TR>
 <TD COLSPAN=2><HR></TD>
@@ -114,7 +155,10 @@
 </TD>
 </TR>
 
-</TABLE><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
+</CENTER>
+</TABLE>
+
+<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0 width=96%>
 
 <TR>
 <TD COLSPAN=2><HR></TD>
@@ -147,7 +191,7 @@
 </TD>
 </TR>
 
-</TABLE><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
+</TABLE><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0>
 
 <TR>
 <TD COLSPAN=2><HR></TD>
@@ -172,7 +216,7 @@
 <TR>
 <TD>
 Are setup to accept credit cards through AgoraPay? 
-Select '0' for no, '1' for yes.
+Select '0' for no, '1' for yes.  (applies to card types below as well)
 </TD>
 <TD>
 <SELECT NAME="acceptcards">
@@ -184,13 +228,45 @@
 </TR>
 
 <TR>
+<TD COLSPAN=2><table>
+	<tr>
+		<td><font size=2 face =arial>Accept Visa?<br><SELECT NAME="acceptvisa">
+<OPTION>$acceptvisa</OPTION>
+<OPTION VALUE="0">0</OPTION>
+<OPTION VALUE="1">1</OPTION>
+</SELECT></font></td>
+		<td><font size=2 face =arial>Accept MasterCard?<br><SELECT NAME="acceptmastercard">
+<OPTION>$acceptmastercard</OPTION>
+<OPTION VALUE="0">0</OPTION>
+<OPTION VALUE="1">1</OPTION>
+</SELECT></font></td>
+		<td><font size=2 face =arial>Accept AMEX?<br><SELECT NAME="acceptamex">
+<OPTION>$acceptamex</OPTION>
+<OPTION VALUE="0">0</OPTION>
+<OPTION VALUE="1">1</OPTION>
+</SELECT></font></td>
+		<td><font size=2 face =arial>Accept Discover?<br><SELECT NAME="acceptdiscover">
+<OPTION>$acceptdiscover</OPTION>
+<OPTION VALUE="0">0</OPTION>
+<OPTION VALUE="1">1</OPTION>
+</SELECT></font></td>
+		<td><font size=2 face =arial>Accept Diners?<br><SELECT NAME="acceptdiners">
+<OPTION>$acceptdiners</OPTION>
+<OPTION VALUE="0">0</OPTION>
+<OPTION VALUE="1">1</OPTION>
+</SELECT></font></td>
+	</tr>
+</table></TD>
+</TR>
+
+<TR>
 <TD COLSPAN=2><HR></TD>
 </TR>
 
 <TR>
 <TD>
 Are you setup to accept checks through AgoraPay?
-Select '0' for no, '1' for yes.
+Select '0' for no, '1' for yes
 </TD>
 <TD>
 <SELECT NAME="acceptchecks">
@@ -242,7 +318,7 @@
 <TD COLSPAN=2><HR></TD>
 </TR>
 
-</TABLE><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
+</TABLE><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0>
 
 
 <TR>
@@ -265,6 +341,162 @@
 
 <TR>
 <TD COLSPAN=2>
+URL of 'Submit to AgoraPay' button:
+<br>
+<INPUT NAME="sc_agorapay_submit" TYPE="TEXT" SIZE=60 
+VALUE='$sc_agorapay_submit'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+URL of 'Make Changes' button:
+<br>
+<INPUT NAME="sc_agorapay_change" TYPE="TEXT" SIZE=60 
+VALUE='$sc_agorapay_change'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+Order Description:
+<br>
+<INPUT NAME="sc_agorapay_order_desc" TYPE="TEXT" SIZE=60 
+VALUE='$sc_agorapay_order_desc'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+Message at the top of the Verify Order table:
+<br>
+<TEXTAREA NAME="sc_agorapay_verify_message"
+ROWS=4 COLS=65 wrap=soft>$sc_agorapay_verify_message</TEXTAREA>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><br><HR><br></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><TABLE WIDTH="100%"><TR>
+<TD>Display Terms of Service and Refund Policy checkbox and set as required?</TD>
+<TD>
+<SELECT NAME="sc_display_checkout_tos">
+<OPTION>$sc_display_checkout_tos</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT>
+</TD>
+</TR></TABLE></TD>
+</TR>
+<TR><TD COLSPAN=2><br>
+Business address and phone number (contact information) for your business.  Should be legal address for the business location for full disclosure and other privacy requirements mandated by credit card companies as well as government enitities that require such notices:<br>
+<TEXTAREA NAME="sc_tos_display_address" 
+cols="68" rows=5 
+wrap=off>$sc_tos_display_address</TEXTAREA><br>
+
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR><TD COLSPAN=2>
+Top message for Order form.  Allows you to place a message above the Payment Information area and just below the cart total boxes.  HTML formatting (for text color, font, spacing, etc) is accepted.  Leave blank if not needed:<br>
+<TEXTAREA NAME="sc_agorapay_top_message" 
+cols="68" rows=8 
+wrap=off>$sc_agorapay_top_message</TEXTAREA> <br><br>
+</TD>
+</TR>
+
+<TR><TD COLSPAN=2>
+Top message for confirmation page, the page just before going to the gateway.  This allows you to place a message above the Payment Information area and just below the cart total boxes.  HTML formatting (for text color, font, spacing, etc) is accepted.  Leave blank if not needed:<br>
+<TEXTAREA NAME="AgoraPay_order_ok_final_msg_tbl" 
+cols="68" rows=8 
+wrap=off>$AgoraPay_order_ok_final_msg_tbl</TEXTAREA> <br><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><font size=2 face =arial><br>
+Complete URL to the logo you'd like to display on your payment information page at AgoraPay.
+This <b>MUST</b> be a secure https URL. You can also leave this blank if you prefer.<br>
+<INPUT NAME="AgoraPay_Logo_URL" TYPE="TEXT" SIZE=60 VALUE="$AgoraPay_Logo_URL"><br>
+</font></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><font size=2 face =arial><br>
+Set and define the body tag attributes at the AgoraPay payment page?  Select Attributes below.  If not desired, set the enable body tags variable to "0" to disable all body tags.  Fields that you do not wish to use, leave blank or select 0.  Enter color names or RGB values (for example, enter either: red or #FF0000) for colors.
+</font></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><table>
+	<tr>
+		<td><font size=2 face =arial>Enable Body Tags?<br><SELECT NAME="AgoraPay_enablebodytags">
+<OPTION>$AgoraPay_enablebodytags</OPTION>
+<OPTION VALUE="0">0</OPTION>
+<OPTION VALUE="1">1</OPTION>
+</SELECT></font></td>
+		<td><font size=2 face =arial>Body Background Color:<br>
+<INPUT NAME="AgoraPay_bodyback" TYPE="TEXT" SIZE=10 VALUE="$AgoraPay_bodyback">
+</font></td>
+		<td><font size=2 face =arial>Font Color:<br>
+<INPUT NAME="AgoraPay_fontcolor" TYPE="TEXT" SIZE=10 VALUE="$AgoraPay_fontcolor">
+</font></td>
+		<td><font size=2 face =arial>Link Color:<br>
+<INPUT NAME="AgoraPay_linkcolor" TYPE="TEXT" SIZE=10 VALUE="$AgoraPay_linkcolor">
+</font></td>
+</table>
+<br>
+<font size=2 face =arial><br>
+Complete URL to the background image you'd like to display on your payment information page at AgoraPay.
+This <b>MUST</b> be a secure https URL. You can also leave this blank if you prefer.  Body Tag attributes must be enabled above to use this featured<br>
+<INPUT NAME="AgoraPay_backimage_URL" TYPE="TEXT" SIZE=60 VALUE="$AgoraPay_backimage_URL"><br>
+</font>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><font size=2 face =arial><br>
+Enter a text message to be shwon on the payment information page at AgoraPay.
+This mesage will be shown in the text box immediately above the submit button. Use a &lt;br> for line breaks/spacing.  You can also leave this blank if you prefer.<br>
+<TEXTAREA NAME="AgoraPay_merch_message" 
+cols="68" rows=8 
+wrap=off>$AgoraPay_merch_message</TEXTAREA><br>
+</font></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><br><br>
 <CENTER>
 <INPUT TYPE="HIDDEN" NAME="system_edit_success" VALUE="yes">
 <INPUT TYPE="HIDDEN" NAME="gateway" VALUE="AgoraPay">
diff -ruN 4.0K-4b/library/AgoraPay-order_lib.pl 5.0.000/library/AgoraPay-order_lib.pl
--- 4.0K-4b/library/AgoraPay-order_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/AgoraPay-order_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -2,7 +2,11 @@
 #                    Order Form Definition Variables                  #
 #######################################################################
 
-$versions{'AgoraPay-order_lib.pl'} = "20020312";
+$versions{'AgoraPay-order_lib.pl'} = "5.0.000";
+$sc_use_secure_header_at_checkout = 'yes';
+$sc_use_secure_footer_for_order_form = 'yes';
+
+# discount mods applied June 17 2005
 
 $sc_order_response_vars{"AgoraPay"}="AgoraPay";
 $sc_use_secure_header_at_checkout = 'yes';
@@ -10,6 +14,15 @@
 &add_codehook("set_form_required_fields","AgoraPay_fields");
 &add_codehook("gateway_response","check_for_AgoraPay_response");
 ###############################################################################
+sub AgoraPay_check_and_load {
+local($myname)="AgoraPay";
+if ($myname ne $sc_gateway_name) { # we are a secondary gateway, load settings
+  &require_supporting_libraries(__FILE__,__LINE__,
+     "./admin_files/$myname-user_lib.pl");
+ }
+
+}
+###############################################################################
 sub check_for_AgoraPay_response {
   if ($form_data{'AgoraPay'} eq 'AgoraPay') {
     $cart_id = $form_data{'p4'};
@@ -21,40 +34,50 @@
    }
  }
 ###############################################################################
-sub AgoraPay_fields{
+sub AgoraPay_fields {
 local($myname)="AgoraPay";
 
 if (!($form_data{'gateway'} eq $myname)) { return;} 
 
-%sc_order_form_array =('Ecom_BillTo_Postal_Name_First', 'First Name',
-                       'Ecom_BillTo_Postal_Name_Last', 'Last Name',
-                       'Ecom_BillTo_Postal_Street_Line1', 'Billing Address Street',
-                       'Ecom_BillTo_Postal_City', 'Billing Address City',
-                       'Ecom_BillTo_Postal_StateProv', 'Billing Address State',
-                       'Ecom_BillTo_PostalCode', 'Billing Address Zip',
-                       'Ecom_BillTo_Postal_CountryCode', 'Billing Address Country',
-                       'Ecom_ShipTo_Postal_Street_Line1', 'Shipping Address Street',
-                       'Ecom_ShipTo_Postal_City', 'Shipping Address City',
-                       'Ecom_ShipTo_Postal_StateProv', 'Shipping Address State',
-                       'Ecom_ShipTo_Postal_PostalCode', 'Shipping Address Zip',
-                       'Ecom_ShipTo_Postal_CountryCode', 'Shipping Address Country',
-                       'Ecom_BillTo_Telecom_Phone_Number', 'Phone Number',
-                       'Ecom_BillTo_Online_Email', 'Email',
-                       'Ecom_Payment_Card_Type', 'Type of Card',
-                       'Ecom_Payment_Card_Number', 'Card Number',
-                       'Ecom_Payment_Card_ExpDate_Month', 'Card Expiration Month',
-                       'Ecom_Payment_Card_ExpDate_Day', 'Card Expiration Day',
-                       'Ecom_Payment_Card_ExpDate_Year', 'Card Expiration Year');
+%sc_order_form_array =(
+	'Ecom_BillTo_Postal_Name_First', 'First Name',
+  'Ecom_BillTo_Postal_Name_Last', 'Last Name',
+  'Ecom_BillTo_Postal_Street_Line1', 'Billing Address Street',
+  'Ecom_BillTo_Postal_City', 'Billing Address City',
+  'Ecom_BillTo_Postal_StateProv', 'Billing Address State',
+  'Ecom_BillTo_PostalCode', 'Billing Address Zip',
+  'Ecom_BillTo_Postal_CountryCode', 'Billing Address Country',
+  'Ecom_ShipTo_Postal_Street_Line1', 'Shipping Address Street',
+  'Ecom_ShipTo_Postal_City', 'Shipping Address City',
+  'Ecom_ShipTo_Postal_StateProv', 'Shipping Address State',
+  'Ecom_ShipTo_Postal_PostalCode', 'Shipping Address Zip',
+  'Ecom_ShipTo_Postal_CountryCode', 'Shipping Address Country',
+  'Ecom_BillTo_Telecom_Phone_Number', 'Phone Number',
+  'Ecom_BillTo_Online_Email', 'Email',
+  'Ecom_is_Residential', 'Shipping to Residential Address',
+  'Ecom_ShipTo_Insurance', 'Insure this Shipment', # not implemented yet, for the future
+  'Ecom_tos', 'Sales-Terms of Service',
+  'Ecom_Payment_Card_Type', 'Type of Card',
+  'Ecom_Payment_Card_Number', 'Card Number',
+  'Ecom_Payment_Card_ExpDate_Month', 'Card Expiration Month',
+  'Ecom_Payment_Card_ExpDate_Day', 'Card Expiration Day',
+  'Ecom_Payment_Card_ExpDate_Year', 'Card Expiration Year');
                         
 
 @sc_order_form_required_fields = (
 	"Ecom_ShipTo_Postal_StateProv",
 	"Ecom_ShipTo_Postal_PostalCode");
 
+# lines for tos added April 5 2006 by Mister Ed
+ if ($sc_display_checkout_tos =~ /yes/i) {
+    push(@sc_order_form_required_fields,"Ecom_tos");
+ }
+
 }
 
 ###############################################################################
 sub AgoraPay_order_form_prep{ # load the customer info ...
+&AgoraPay_check_and_load;
   if ($sc_AgoraPay_form_prep == 0) {
     if (-f "$sc_verify_order_path"){
       &read_verify_file;  
@@ -135,6 +158,8 @@
 local($invoice_number, $customer_number, $displayTotal);
 local($test_mode,$zemail_text);
 local($myname)="AgoraPay";
+local($my_change,$my_submit,$my_message,$my_desc);
+my ($tempbodytags) = '';
 
 if (!($form_data{'gateway'} eq $myname)) { return;} 
 if ($myname ne $sc_gateway_name) { # secondary gateway, load settings
@@ -147,6 +172,10 @@
 $invoice_number = $current_verify_inv_no;
 $customer_number = $cart_id;
 $customer_number =~ s/_/./g;
+$my_submit=&script_and_substitute($sc_agorapay_submit);
+$my_change=&script_and_substitute($sc_agorapay_change);
+$my_message=&script_and_substitute($sc_agorapay_verify_message);
+$my_desc=&script_and_substitute($sc_agorapay_order_desc);
 &AgoraPay_table_setup;
 $zemail_text = &script_and_substitute($email_text,"AgoraPay");
 
@@ -156,41 +185,57 @@
   $test_mode = "<INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"test_mode\">";
  }
 
-print <<ENDOFTEXT;
-
-<FORM METHOD=POST ACTION=\"$sc_order_script_url\">
 
-<INPUT TYPE=HIDDEN NAME=\"1-cost\" VALUE=\"$authPrice\">
-
-<INPUT type=\"HIDDEN\" name=\"passback\" value=\"p1\">
-<INPUT TYPE=\"HIDDEN\" NAME=\"p1\" VALUE=\"$zfinal_shipping\">
+if ($AgoraPay_enablebodytags eq "1"){
+$tempbodytags = qq~<input type="hidden" name="bodytags" value="$AgoraPay_enablebodytags">
+<INPUT type="hidden" name="background" value="$AgoraPay_backimage_URL">
+<INPUT type="hidden" name="bgcolor" value="$AgoraPay_bodyback">
+<INPUT type="hidden" name="fontcolor" value="$AgoraPay_fontcolor">
+<INPUT type="hidden" name="link" value="$AgoraPay_linkcolor">
+~;
+}
 
-<INPUT type=\"HIDDEN\" name=\"passback\" value=\"Ecom_ShipTo_Method\">
-<INPUT TYPE=\"HIDDEN\" NAME=\"Ecom_ShipTo_Method\" VALUE=\"$form_data{'Ecom_ShipTo_Method'}\">
+if ($AgoraPay_Logo_URL ne ""){
+$tempbodytags .= qq~
+<INPUT type="hidden" name="mastimage" value="1">
+<INPUT type="hidden" name="mast" value="$AgoraPay_Logo_URL">
+~;
+}
 
-<INPUT type=\"HIDDEN\" name=\"passback\" value=\"p2\">
-<INPUT TYPE=HIDDEN NAME=\"p2\" VALUE=\"$zfinal_discount\">
+print <<ENDOFTEXT;
 
-<INPUT type=\"HIDDEN\" name=\"passback\" value=\"p3\">
-<INPUT TYPE=HIDDEN NAME=\"p3\" VALUE=\"$zfinal_sales_tax\">
+<FORM METHOD=POST ACTION=\"$sc_order_script_url\" AUTOCOMPLETE = 'off'>
 
 <INPUT TYPE=\"HIDDEN\" NAME=\"vendor_id\" VALUE=\"$sc_gateway_username\">
+
+<input type=\"hidden\" name=\"formtype\" value=\"1\">
 <INPUT TYPE=\"HIDDEN\" NAME=\"home_page\" VALUE=\"$sc_store_url\">
 <INPUT TYPE=\"HIDDEN\" NAME=\"ret_addr\" VALUE=\"$sc_store_url\">
+<input type=\"hidden\" name=\"ret_mode\" value=\"post\">
 <INPUT TYPE=\"HIDDEN\" NAME=\"email_text\" VALUE=\"$zemail_text\">
 
+<INPUT TYPE=\"HIDDEN\" NAME=\"1-cost\" VALUE=\"$authPrice\">
 <INPUT TYPE=\"HIDDEN\" NAME=\"1-desc\" VALUE=\"Online Order\">
 <INPUT TYPE=\"HIDDEN\" NAME=\"1-qty\" VALUE=\"1\">
 
+$tempbodytags
+<input type="hidden" name="mertext" value="$AgoraPay_merch_message">
+
+<INPUT type=\"HIDDEN\" name=\"passback\" value=\"p1\">
+<INPUT TYPE=\"HIDDEN\" NAME=\"p1\" VALUE=\"$zfinal_shipping\">
+
+<INPUT type=\"HIDDEN\" name=\"passback\" value=\"p2\">
+<INPUT TYPE=HIDDEN NAME=\"p2\" VALUE=\"$zfinal_discount\">
+
+<INPUT type=\"HIDDEN\" name=\"passback\" value=\"p3\">
+<INPUT TYPE=HIDDEN NAME=\"p3\" VALUE=\"$zfinal_sales_tax\">
+
 <INPUT type=\"HIDDEN\" name=\"passback\" value=\"p4\">
 <INPUT TYPE=\"HIDDEN\" NAME=\"p4\" VALUE=\"$customer_number\">
 
 <INPUT type=\"HIDDEN\" name=\"passback\" value=\"p5\">
 <INPUT TYPE=\"HIDDEN\" NAME=\"p5\" VALUE=\"$invoice_number\">
 
-<INPUT type=\"HIDDEN\" name=\"passback\" value=\"p6\">
-<INPUT TYPE=\"HIDDEN\" NAME=\"p6\" VALUE=\"$displayTotal\">
-
 <INPUT type=\"HIDDEN\" name=\"passback\" value=\"AgoraPay\">
 <INPUT TYPE=\"HIDDEN\" NAME=\"AgoraPay\" VALUE=\"AgoraPay\">
 
@@ -202,6 +247,11 @@
 <INPUT TYPE=HIDDEN NAME=\"acceptchecks\" VALUE=\"$acceptchecks\">
 <INPUT TYPE=HIDDEN NAME=\"accepteft\" VALUE=\"$accepteft\">
 <INPUT TYPE=HIDDEN NAME=\"altaddr\" VALUE=\"$altaddr\">
+<input type=hidden name="visaimage" value="$acceptvisa">
+<input type=hidden name="mcimage" value="$acceptmastercard">
+<input type=hidden name="discimage" value="$acceptdiscover">
+<INPUT type="hidden" name="ameximage" value="$acceptamex">
+<INPUT type="hidden" name="dinerimage" value="$acceptdiners">
 
 <INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"first_name\">
 <INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"last_name\">
@@ -227,44 +277,64 @@
 <INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"when\">
 <INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"xid\">
 
-<TABLE WIDTH="500" BGCOLOR="#C0FFFF" CELLPADDING="0" CELLSPACING="0">
-<TR>
-<TD>
+<div align="center">
 
-<TABLE WIDTH="500" BGCOLOR="#000080" CELLPADDING="0" CELLSPACING="0">
-<TR BGCOLOR="#C0FFFF">
-<TD BGCOLOR="#C0FFFF"><FONT FACE="ARIAL" SIZE="2" COLOR="#000000">
-Please verify the following information. When you are confident 
-that it is correct, click the 'Secure Orderform' button to enter 
-your payment information, or
-<a href="${sc_stepone_order_script_url}?order_form_button.x=1">
-click here</a> to make corrections:
-</FONT></TD>
-<TD  BGCOLOR="#C0FFFF">
-</TR>
-<TR BGCOLOR="#C0FFFF">
-<td>
-Ship To $form_data{'Ecom_ShipTo_Postal_PostalCode'}
-$form_data{'Ecom_ShipTo_Postal_StateProv'}
-via $form_data{'Ecom_ShipTo_Method'}<br>
-</td>
+<p class="ac_checkout_top_msg">$AgoraPay_order_ok_final_msg_tbl</p>
+  <p class="ac_checkout_top_msg">$my_message</p>
+
+
+<table cellpadding="0" cellspacing="0" class="ac_checkout_review">
+<tr>
+<th colspan="2" class="ac_checkout_review">Customer Information</th>
 </tr>
-<TR BGCOLOR="#C0FFFF">
-<TD>
+ENDOFTEXT
+
+if ($form_data{'Ecom_ShipTo_Method'} ne ""){
+print <<ENDOFTEXT;
+  <tr>
+    <td class="ac_checkout_review_col1">Ship via:</td>
+    <td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Method'}</td>
+  </tr>
+ENDOFTEXT
+}
+ 
+print <<ENDOFTEXT;
+  <tr>
+    <td class="ac_checkout_review_col1">State </td>
+    <td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_StateProv'}
+    &nbsp;</td>
+  </tr>
+  <tr>
+    <td class="ac_checkout_review_col1">Postal Code </td>
+    <td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_PostalCode'}
+    &nbsp; </td>
+  </tr>
+  <tr>
+    <td class="ac_checkout_review_col1">Country</td>
+    <td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_CountryCode'}</td>
+  </tr>
+  <tr>
+    <td class="ac_checkout_review_col1">Residential Address</td>
+    <td class="ac_checkout_review_col2">$form_data{'Ecom_is_Residential'}&nbsp;</td>
+  </tr>
+</TABLE>
+ 
+<TABLE WIDTH="500" BGCOLOR="#FFFFFF" CELLPADDING="2" CELLSPACING="0" BORDER=0>
+<TR>
+<TD COLSPAN=2>
 <CENTER>
-<INPUT TYPE=SUBMIT VALUE="Secure Orderform">
+<INPUT TYPE="IMAGE" NAME="Submit" VALUE="Submit Order For Processing"
+SRC="$my_submit" border=0>
+&nbsp;&nbsp;&nbsp;&nbsp;
+<a href="agora.cgi?order_form_button.x=1&cart_id=${cart_id}">
+<IMG SRC="$my_change" BORDER=0></a>
+</FORM>
 </CENTER>
 </TD>
 </TR>
-</TABLE>
-
-</TD>
-</TR>
-</TABLE>
-
-</FORM>
+</table>
+</FONT>
 </CENTER>
-
 ENDOFTEXT
 
 }
@@ -277,6 +347,13 @@
 local($stevo_shipping_thing) = "";
 local($stevo_shipping_names) = "";
 local($ship_thing_too,$ship_instructions);
+local(%orderLoggingHash);
+
+#alt origination stuff added by Mister Ed Feb 17, 2005
+if ($sc_alt_origin_enabled =~ /yes/i) {
+	local(%zip_list);
+	local(%zip_names_list);
+}
 
 &load_verify_file;
 
@@ -347,21 +424,25 @@
   $verification .= "\nWARNING! CART ID DOES NOT MATCH EXPECTED VALUE!!\n\n";
  }
 
+# NEW CODEHOOK
+&codehook("process-order-routine-top");
+
 $orderDate = &get_date;
 
 print qq!
-<HTML>
+<html>
 $sc_special_page_meta_tags
 <HEAD>
-<TITLE>$messages{'ordcnf_08'}</TITLE>
-$sc_standard_head_info</HEAD>
-<BODY $sc_standard_body_info>
+<title>$messages{'ordcnf_08'}</title>
+$sc_secure_standard_head_info</head>
+<body>
 !;
 
-&StoreHeader;
+&SecureStoreHeader;
 
 $text_of_cart .= "Order Date:    $orderDate\n";
 $text_of_cart .= "Gateway:       AgoraPay\n\n";
+$orderLoggingHash{'GatewayUsed'} = "AgoraPay";
 
 $text_of_cart .= "  --PRODUCT INFORMATION--\n\n";
 
@@ -385,6 +466,62 @@
 }
 close(CART);
 
+# initialize hash variables in case they are empty later
+# added by jfindlay 2006 February
+
+$orderLoggingHash{'firstName'} = "";
+$orderLoggingHash{'lastName'} = "";
+$orderLoggingHash{'fullName'} = "";
+$orderLoggingHash{'orderFromAddress'} = "";
+$orderLoggingHash{'customerAddress2'} = "";
+$orderLoggingHash{'customerAddress3'} = "";
+$orderLoggingHash{'orderFromCity'} = "";
+$orderLoggingHash{'orderFromPostal'} = "";
+$orderLoggingHash{'customerPhone'} = "";
+$orderLoggingHash{'companyName'} = "";
+$orderLoggingHash{'emailAddress'} = "";
+
+$orderLoggingHash{'shipToName'} = "";
+$orderLoggingHash{'shipToAddress'} = "";
+$orderLoggingHash{'shipToAddress2'} = "";
+$orderLoggingHash{'shipToAddress3'} = "";
+$orderLoggingHash{'shipToCity'} = "";
+$orderLoggingHash{'shipToState'} = "";
+$orderLoggingHash{'shipToPostal'} = "";
+$orderLoggingHash{'shipToCountry'} = "";
+$orderLoggingHash{'shiptoResidential'} = $eform_Ecom_is_Residential;
+$orderLoggingHash{'insureShipment'} = $eform_Ecom_ShipTo_Insurance; # not implemented yet, for the future
+
+$orderLoggingHash{'invoiceNumber'} = "";
+$orderLoggingHash{'customerNumber'} = "";
+$orderLoggingHash{'orderStatus'} = "$sc_order_status_default";
+$orderLoggingHash{'user1'} = "";
+$orderLoggingHash{'user2'} = "";
+$orderLoggingHash{'user3'} = "";
+$orderLoggingHash{'user4'} = "";
+$orderLoggingHash{'user5'} = "";
+$orderLoggingHash{'itemsordered'} = "";
+$orderLoggingHash{'shiptrackingID'} = "";
+$orderLoggingHash{'shipMethod'} = "";
+$orderLoggingHash{'orderFromState'} = "";
+$orderLoggingHash{'orderFromCountry'} = "";
+$orderLoggingHash{'shippingTotal'} = "";
+$orderLoggingHash{'salesTax'} = "";
+$orderLoggingHash{'tax1'} = "";
+$orderLoggingHash{'tax2'} = "";
+$orderLoggingHash{'tax3'} = "";
+$orderLoggingHash{'discounts'} = "";
+$orderLoggingHash{'netProfit'} = "";
+$orderLoggingHash{'affiliateTotal'} = "";
+$orderLoggingHash{'affiliateID'} = "";
+$orderLoggingHash{'affiliateMisc'} = "";
+$orderLoggingHash{'subTotal'} = "";
+$orderLoggingHash{'orderTotal'} = "";
+$orderLoggingHash{'adminMessages'} = "";
+$orderLoggingHash{'shippingMessages'} = "";
+$orderLoggingHash{'xcomments'} = "";
+$orderLoggingHash{'termsOfService'} = "$vform_Ecom_tos";
+
 $sc_orderlib_use_SBW_for_ship_ins = $sc_use_SBW;
 &codehook("orderlib-ship-instructions");
 if ($sc_orderlib_use_SBW_for_ship_ins =~ /yes/i) {
@@ -392,6 +529,8 @@
    &ship_put_in_boxes($stevo_shipping_thing,$stevo_shipping_names,
    $sc_verify_Origin_ZIP,$sc_verify_boxes_max_wt); 
  }
+$orderLoggingHash{'shippingMessages'} = "$ship_instructions";
+$orderLoggingHash{'shippingMessages'} =~ s/\n/<br>/g;
 
 $text_of_confirm_email .= $messages{'ordcnf_07'};
 
@@ -402,24 +541,38 @@
 # $text_of_cart .= "VERIFICATION:  $verification\n";
 $text_of_cart .= "CUST ID:       $itrans{'p4'}\n";
 $text_of_confirm_email .= "CUST ID:       $itrans{'p4'}\n";
+$orderLoggingHash{'customerNumber'} = "$itrans{'p4'}";
 
 $text_of_cart .= "ORDER ID:      $itrans{'p5'}\n";
 $text_of_confirm_email .= "ORDER ID:      $itrans{'p5'}\n";
+$orderLoggingHash{'invoiceNumber'} = "$itrans{'p5'}";
 
 if ($itrans{'p1'})
 {
-$text_of_cart .= "SHIPPING:      $itrans{'p1'}\n";
-$text_of_confirm_email .= "SHIPPING:      $itrans{'p1'}\n";
-}
-if ($sc_use_SBW =~ /yes/i)
-{
- $text_of_confirm_email .= "SHIP VIA:      $itrans{'Ecom_ShipTo_Method'}\n";
-}
-
-if ($itrans{'p2'})
-{
-$text_of_cart .= "DISCOUNT:      $itrans{'p2'}\n";
-$text_of_confirm_email .= "DISCOUNT:      $itrans{'p2'}\n";
+$text_of_cart .= "SHIPPING:      " . &format_price($sc_verify_shipping) . "\n";
+$text_of_confirm_email .= "SHIPPING:      " . &format_price($sc_verify_shipping) . "\n";
+$orderLoggingHash{'shippingTotal'} = &format_price($sc_verify_shipping);
+}
+
+# if ($sc_use_SBW =~ /yes/i)
+if (($sc_use_SBW =~ /yes/i) || ($sc_verify_shipping > .009)) {
+ $text_of_confirm_email .= "SHIP VIA:      $eform_Ecom_ShipTo_Method\n";
+}
+
+ $orderLoggingHash{'shipMethod'} = $eform_Ecom_ShipTo_Method;
+
+  $temp = &format_price($sc_verify_subtotal);
+  &add_text_of_both("SUBTOTAL",$temp);
+  $orderLoggingHash{'subTotal'} = &format_price($sc_verify_subtotal);
+
+if ($sc_verify_discount) {
+  $temp = &format_price($sc_verify_discount);
+  &add_text_of_both("DISCOUNT",$tempt);
+  $orderLoggingHash{'discounts'} = &format_price($sc_verify_discount);
+  # start of adjustments for discount addon
+  $text_of_cart .= "DISCOUNT CODE: $eform_Ecom_Discount\n";
+  $text_of_confirm_email .= "DISCOUNT CODE: $eform_Ecom_Discount\n";
+  # end of adjustments for discount addon
 }
 
 if ($itrans{'p3'})
@@ -433,57 +586,138 @@
 $temp = substr(substr("SALES TAX",0,13).":               ",0,15);
 $text_of_cart .= "$temp$sc_verify_tax\n";
 $text_of_confirm_email .= "$temp$sc_verify_tax\n";
+$orderLoggingHash{'salesTax'} = "$sc_verify_tax";
 }
 if ($sc_verify_etax1 > 0)
 {
 $temp = substr(substr($sc_extra_tax1_name,0,13).":               ",0,15);
 $text_of_cart .= "$temp$sc_verify_etax1\n";
 $text_of_confirm_email .= "$temp$sc_verify_etax1\n";
+$orderLoggingHash{'tax1'} = "$sc_verify_etax1";
 }
 if ($sc_verify_etax2 > 0)
 {
 $temp = substr(substr($sc_extra_tax2_name,0,13).":               ",0,15);
 $text_of_cart .= "$temp$sc_verify_etax2\n";
 $text_of_confirm_email .= "$temp$sc_verify_etax2\n";
+$orderLoggingHash{'tax2'} = "$sc_verify_etax2";
 }
 if ($sc_verify_etax3 > 0)
 {
 $temp = substr(substr($sc_extra_tax3_name,0,13).":               ",0,15);
 $text_of_cart .= "$temp$sc_verify_etax3\n";
 $text_of_confirm_email .= "$temp$sc_verify_etax3\n";
+$orderLoggingHash{'tax3'} = "$sc_verify_etax3";
 }
 
-$text_of_cart .= "TOTAL:         $itrans{'p6'}\n\n";
-$text_of_confirm_email .= "TOTAL:         $itrans{'p6'}\n\n";
+$text_of_cart .= "TOTAL:         $itrans{'total'}\n\n";
+$text_of_confirm_email .= "TOTAL:         $itrans{'total'}\n\n";
+$orderLoggingHash{'orderTotal'} = "$itrans{'total'}"; #$sc_verify_grand_total";
 
 $text_of_cart .= "AUTH CODE      $itrans{'authcode'}\n";
 $text_of_cart .= "TIME:          $itrans{'when'}\n";
 $text_of_cart .= "TRANS ID:      $itrans{'xid'}\n\n";
 $text_of_cart .= "BILLING INFORMATION --------------\n\n";
+
 $text_of_cart .= "NAME:          $itrans{'first_name'} $itrans{'last_name'}\n";
+$orderLoggingHash{'fullName'} = "$itrans{'first_name'} $itrans{'last_name'}";
+$orderLoggingHash{'firstName'} = "$itrans{'first_name'}";
+$orderLoggingHash{'lastName'} = "$itrans{'last_name'}";
+
 $text_of_cart .= "ADDRESS:       $itrans{'address'}\n";
+$orderLoggingHash{'orderFromAddress'} = "$itrans{'address'}";
+
 $text_of_cart .= "CITY:          $itrans{'city'}\n";
+$orderLoggingHash{'orderFromCity'} = "$itrans{'city'}";
+
 $text_of_cart .= "STATE:         $itrans{'state'}\n";
+$orderLoggingHash{'orderFromState'} = "$itrans{'state'}";
+
 $text_of_cart .= "ZIP:           $itrans{'zip'}\n";
+$orderLoggingHash{'orderFromPostal'} = "$itrans{'zip'}";
+
 $text_of_cart .= "COUNTRY:       $itrans{'country'}\n";
+$orderLoggingHash{'orderFromCountry'} = "$itrans{'country'}";
+
 $text_of_cart .= "PHONE:         $itrans{'phone'}\n";
+$orderLoggingHash{'customerPhone'} = "$itrans{'phone'}";
+
 $text_of_cart .= "EMAIL:         $itrans{'email'}\n\n";
+$orderLoggingHash{'emailAddress'} = "$itrans{'email'}";
+
 $text_of_cart .= "SHIPPING INFORMATION --------------\n\n";
+
+if ($itrans{'slname'} ne'') {
 $text_of_cart .= "NAME:          $itrans{'sfname'} $itrans{'slname'}\n";
+$orderLoggingHash{'shipToName'} = "$itrans{'sfname'} $itrans{'slname'}";
+} else {
+$text_of_cart .= "NAME:          $itrans{'first_name'} $itrans{'last_name'}\n";
+$orderLoggingHash{'shipToName'} = "$itrans{'first_name'} $itrans{'last_name'}";
+}
+
+if ($itrans{'saddr'} ne'') {
 $text_of_cart .= "ADDRESS:       $itrans{'saddr'}\n";
+$orderLoggingHash{'shipToAddress'} = "$itrans{'saddr'}";
+} else {
+$text_of_cart .= "ADDRESS:       $itrans{'address'}\n";
+$orderLoggingHash{'shipToAddress'} = "$itrans{'address'}";
+}
+
+if ($itrans{'scity'} ne'') {
 $text_of_cart .= "CITY:          $itrans{'scity'}\n";
+$orderLoggingHash{'shipToCity'} = "$itrans{'scity'}";
+} else {
+$text_of_cart .= "CITY:          $itrans{'city'}\n";
+$orderLoggingHash{'shipToCity'} = "$itrans{'city'}";
+}
+
+if ($itrans{'sstate'} ne'') {
 $text_of_cart .= "STATE:         $itrans{'sstate'}\n";
+$orderLoggingHash{'shipToState'} = "$itrans{'sstate'}";
+} else {
+$text_of_cart .= "CITY:          $eform_Ecom_ShipTo_Postal_StateProv\n";
+$orderLoggingHash{'shipToState'} = "$eform_Ecom_ShipTo_Postal_StateProv";
+}
+
+if ($itrans{'szip'} ne'') {
 $text_of_cart .= "ZIP:           $itrans{'szip'}\n";
+$orderLoggingHash{'shipToPostal'} = "$itrans{'szip'}";
+} else {
+$text_of_cart .= "ZIP:           $eform_Ecom_ShipTo_Postal_PostalCode\n";
+$orderLoggingHash{'shipToPostal'} = "$eform_Ecom_ShipTo_Postal_PostalCode";
+}
+
+if ($itrans{'sctry'} ne '') {
 $text_of_cart .= "COUNTRY:       $itrans{'sctry'}\n\n";
+$orderLoggingHash{'shipToCountry'} = "$itrans{'sctry'}";
+} else {
+$text_of_cart .= "COUNTRY:       $vform_Ecom_ShipTo_Postal_CountryCode\n";
+$orderLoggingHash{'shipToCountry'} = "$vform_Ecom_ShipTo_Postal_CountryCode";
+}
+
 if ($sc_use_SBW =~ /yes/i) {
   $text_of_cart .= "SHIP VIA:      $itrans{'Ecom_ShipTo_Method'}\n";
  }
+
+# NEW CODEHOOK
+&codehook("process-order-pre-ship-instructions");
+
 if ($ship_instructions ne "") {
   $text_of_cart .= "Shipping Instructions: \n$ship_instructions\n\n";
  }
 
+# NEW CODEHOOK
+&codehook("process-order-pre-xcomments");
+
 $text_of_cart .= $XCOMMENTS_ADMIN;
+$orderLoggingHash{'adminMessages'} = "$XCOMMENTS_ADMIN";
+$orderLoggingHash{'adminMessages'} =~ s/\n/<br>/g;
+$orderLoggingHash{'adminMessages'} =~ s/\t/ /g;
+$orderLoggingHash{'adminMessages'} .= "<br>AUTHORIZATION INFORMATION --------------<br>AUTH CODE:  $itrans{'authcode'}<br>TIME:  $itrans{'when'}<br>TRANS ID:  $itrans{'xid'}<br>---------------------------------------------------------------<br>";
 $text_of_confirm_email .= $XCOMMENTS;
+$orderLoggingHash{'xcomments'} = "$XCOMMENTS";
+$orderLoggingHash{'xcomments'} =~ s/\n/<br>/g;
+$orderLoggingHash{'adminMessages'} =~ s/\t/ /g;
 
 # 'Init' the emails ...
 $text_of_cart = &init_shop_keep_email . $text_of_cart;
@@ -499,8 +733,10 @@
   $text_of_cart = "\n" . $text_of_cart . "\n";
  }
 
+$sc_agorapay_order_desc .= " - " . $itrans{'p5'};
+
 if ($sc_send_order_to_email =~ /yes/i) {
-  &send_mail($sc_admin_email, $sc_order_email, "Agora.cgi Order",$text_of_cart);
+  &send_mail($sc_admin_email, $sc_order_email, $sc_agorapay_order_desc, $text_of_cart);
  }
 
 &log_order($text_of_cart,$itrans{'p5'},$itrans{'p4'});
@@ -510,7 +746,13 @@
            "$text_of_confirm_email");
  }
 $sc_affiliate_order_unique = $itrans{'p5'};
-$sc_affiliate_order_total = $itrans{'p6'};
+$sc_affiliate_order_total = $itrans{'total'};
+
+$sc_affiliate_image_call =~ s/AMOUNT/$sc_affiliate_order_total/g;
+$sc_affiliate_image_call =~ s/UNIQUE/$sc_affiliate_order_unique/g;
+
+# NEW CODEHOOK
+&codehook("process-order-display-thankyou-page");
   
 print <<ENDOFTEXT;
 <CENTER>
@@ -535,7 +777,7 @@
 
 # and the footer is printed
 
-&StoreFooter;
+&SecureStoreFooter;
 
 print qq!
 </BODY>
diff -ruN 4.0K-4b/library/AuthorizeNet-mgr_lib.pl 5.0.000/library/AuthorizeNet-mgr_lib.pl
--- 4.0K-4b/library/AuthorizeNet-mgr_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/AuthorizeNet-mgr_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -3,10 +3,14 @@
 # SIM version
 #
 # Copyright 2001 Steve Kneizys.
-# Copyright 2002, 2003 K-Factor Technologies, Inc.  All Rights Reserved.
+# Copyright 2002 to Present K-Factor Technologies, Inc.  All Rights Reserved.
 # March 6, 2003 SIM integration version
+# discount mods applied June 17, 2005 by Eric Welin at K-Factor Technologies, Inc.
+# April 2006 conversion to version 5 by Justin Findlay at K-Factor Technologies, Inc.
+# May 3, 2006 Adjustments and misc edits for final v5 version by Mister Ed at K-Factor Technologies, Inc.
+# May 5, 2006 final edits for final v5 version by Mister Ed at K-Factor Technologies, Inc.
 
-$versions{'AuthorizeNet-mgr_lib.pl'} = "20030306";
+$versions{'AuthorizeNet-mgr_lib.pl'} = "5.0.000";
 &add_codehook("gateway_admin_screen","AuthorizeNet_mgr_check");
 &add_codehook("gateway_admin_settings","AuthorizeNet_settings");
 $mc_gateways .= "|AuthorizeNet";
@@ -15,46 +19,43 @@
 sub AuthorizeNet_settings {
 if ($sc_gateway_name eq "AuthorizeNet") {
 
-  $x_Description = &my_escape($in{'x_Description'});
-  $x_Header_Html_Payment_Form = &my_escape($in{'x_Header_Html_Payment_Form'});
-  $x_Footer_Html_Payment_Form = &my_escape($in{'x_Footer_Html_Payment_Form'});
-  $x_Header_Html_Receipt = &my_escape($in{'x_Header_Html_Receipt'});
-  $x_Footer_Html_Receipt = &my_escape($in{'x_Footer_Html_Receipt'});
-  $x_Header_Email_Receipt = &my_escape($in{'x_Header_Email_Receipt'});
-  $x_Footer_Email_Receipt = &my_escape($in{'x_Footer_Email_Receipt'});
+  $x_description = &my_escape($in{'x_description'});
+  $x_header_html_payment_form = &my_escape($in{'x_header_html_payment_form'});
+  $x_footer_html_payment_form = &my_escape($in{'x_footer_html_payment_form'});
+  $x_header_html_receipt = &my_escape($in{'x_header_html_receipt'});
+  $x_footer_html_receipt = &my_escape($in{'x_footer_html_receipt'});
+  $x_header_email_receipt = &my_escape($in{'x_header_email_receipt'});
+  $x_footer_email_receipt = &my_escape($in{'x_footer_email_receipt'});
+  $sc_auth_verify_message = &my_escape($in{'sc_auth_verify_message'});
+  $sc_auth_order_desc = &my_escape($in{'sc_auth_order_desc'});
+  $sc_tos_display_address = &my_escape($in{'sc_tos_display_address'});
 
   open (GW, "> $gateway_settings") || &my_die("Can't Open $gateway_settings");
-$sc_auth_top_message_temp = &my_escape($in{'sc_auth_top_message'});
-  print (GW "\$sc_auth_top_message = qq'$sc_auth_top_message_temp';\n");
   print (GW "\$sc_gateway_username = '$in{'sc_gateway_username'}';\n");
   print (GW "\$txnkey = \"$in{'txnkey'}\";\n");
   print (GW "\$sc_tstamp2 = \"$in{'sc_tstamp2'}\";\n");
   print (GW "\$sc_tstamp3 = \"$in{'sc_tstamp3'}\";\n");
   print (GW "\$sc_order_script_url = \"$in{'order_url'}\";\n");
-  print (GW "\$sc_auth_upsgroundres = \"$in{'sc_auth_upsgroundres'}\";\n");
-  print (GW "\$sc_auth_upsgroundcomm = \"$in{'sc_auth_upsgroundcomm'}\";\n");
-  print (GW "\$sc_auth_ups2da = \"$in{'sc_auth_ups2da'}\";\n");
-  print (GW "\$sc_auth_ups1da = \"$in{'sc_auth_ups1da'}\";\n");
-  print (GW "\$sc_auth_fedexprioiryovernight = \"$in{'sc_auth_fedexprioiryovernight'}\";\n");
-  print (GW "\$sc_auth_fedexexpress = \"$in{'sc_auth_fedexexpress'}\";\n");
-  print (GW "\$sc_auth_fedexground = \"$in{'sc_auth_fedexground'}\";\n");
-  print (GW "\$sc_auth_fedexhome = \"$in{'sc_auth_fedexhome'}\";\n");
-  print (GW "\$sc_auth_uspsparcelpost = \"$in{'sc_auth_uspsparcelpost'}\";\n");
-  print (GW "\$sc_auth_uspsprioritymail = \"$in{'sc_auth_uspsprioritymail'}\";\n");
-  print (GW "\$sc_auth_uspsexpressmail = \"$in{'sc_auth_uspsexpressmail'}\";\n");
-  print (GW "\$x_Logo_URL = \"$in{'x_Logo_URL'}\";\n");
-  print (GW "\$x_Color_Background = \"$in{'x_Color_Background'}\";\n");
-  print (GW "\$x_Color_Link = \"$in{'x_Color_Link'}\";\n");
-  print (GW "\$x_Color_Text = \"$in{'x_Color_Text'}\";\n");
-  print (GW "\$x_Description = \"$x_Description\";\n");
-  print (GW "\$x_Header_Html_Payment_Form = \"$x_Header_Html_Payment_Form\";\n");
-  print (GW "\$x_Footer_Html_Payment_Form = \"$x_Footer_Html_Payment_Form\";\n");
-  print (GW "\$x_Header_Html_Receipt = \"$x_Header_Html_Receipt\";\n");
-  print (GW "\$x_Footer_Html_Receipt = \"$x_Footer_Html_Receipt\";\n");
-  print (GW "\$x_Header_Email_Receipt = \"$x_Header_Email_Receipt\";\n");
-  print (GW "\$x_Footer_Email_Receipt = \"$x_Footer_Email_Receipt\";\n");
+  print (GW "\$x_logo_url = \"$in{'x_logo_url'}\";\n");
+  print (GW "\$x_color_background = \"$in{'x_color_background'}\";\n");
+  print (GW "\$x_color_link = \"$in{'x_color_link'}\";\n");
+  print (GW "\$x_color_text = \"$in{'x_color_text'}\";\n");
+  print (GW "\$x_description = \"$x_description\";\n");
+  print (GW "\$x_header_html_payment_form = \"$x_header_html_payment_form\";\n");
+  print (GW "\$x_footer_html_payment_form = \"$x_footer_html_payment_form\";\n");
+  print (GW "\$x_header_html_receipt = \"$x_header_html_receipt\";\n");
+  print (GW "\$x_footer_html_receipt = \"$x_footer_html_receipt\";\n");
+  print (GW "\$x_header_email_receipt = \"$x_header_email_receipt\";\n");
+  print (GW "\$x_footer_email_receipt = \"$x_footer_email_receipt\";\n");
   print (GW "\$merchant_live_mode = \"$in{'live_mode'}\";\n");
-  print (GW  "1\;\n");
+  print (GW  "\$sc_auth_submit = '$in{'sc_auth_submit'}';\n");
+  print (GW  "\$sc_auth_change = '$in{'sc_auth_change'}';\n");
+  print (GW  "\$sc_auth_verify_message = \"$sc_auth_verify_message\";\n");
+  print (GW  "\$sc_auth_order_desc = \"$sc_auth_order_desc\";\n");
+  print (GW  "\$sc_display_checkout_tos = \"$in{'sc_display_checkout_tos'}\";\n");
+  print (GW  "\$sc_tos_display_address = qq'$sc_tos_display_address';\n");
+ 
+  print (GW  "#\n1\;\n");
   close(GW);
 
  }
@@ -68,7 +69,7 @@
 }
 ##############################################################################
 sub print_AuthorizeNet_mgr_form {
-	
+  
 ##
 ## AUTHORIZE.NET
 ##
@@ -77,16 +78,16 @@
 
 print <<ENDOFTEXT;
 <CENTER>
-<TABLE WIDTH=580>
+<TABLE>
 
 <TR>
 <TD COLSPAN=2><HR></TD>
 </TR>
 
 <TR>
-<TD WIDTH=580>
+<TD>
 <FONT FACE=ARIAL>
-$sc_gateway_name Settings
+<b>AuthorizeNet Settings</b><br>
 $msg</FONT>
 </TD>
 </TR>
@@ -115,11 +116,7 @@
 <FONT FACE=ARIAL SIZE=2>
 <FORM METHOD="POST" ACTION="manager.cgi">
 <CENTER>
-<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
-
-<TR>
-<TD COLSPAN=2>Note: if you are wishing to use this gateway with zOffline (as part of multiple gateways), you will need to download the version or the add-on available only to pro members.  See AgoraCart.com for more information about becoming a Pro member for only \$29.95 per year or \$59.95 for Life.<br><br><HR></TD>
-</TR>
+<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0>
 
 <TR>
 <TD width=80%>
@@ -138,11 +135,11 @@
 <TD COLSPAN=2><HR></TD>
 </TR>
 
-</table><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
+</table><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0>
 
 <TR>
 <TD width="80%">
-<b>Gateway Username</b></td>
+<b>API Loin ID</b></td>
 <TD width="20%">
 <INPUT NAME="sc_gateway_username" TYPE="TEXT" SIZE=30 
 VALUE='$sc_gateway_username'><br>
@@ -193,138 +190,8 @@
 VALUE='$sc_tstamp2'><br>
 </TD>
 </TR>
-<TR>
-<TD COLSPAN=2><HR></TD>
-</TR>
-<TR>
-<TD>Do you offer UPS Ground Residential</TD>
-<TD>
-<SELECT NAME="sc_auth_upsgroundres">
-<OPTION>$sc_auth_upsgroundres</OPTION>
-<OPTION>yes</OPTION>
-<OPTION>no</OPTION>
-</SELECT>
-</TD>
-</TR>
-<TR>
-<TD>Do you offer UPS Ground Commercial</TD>
-<TD>
-<SELECT NAME="sc_auth_upsgroundcomm">
-<OPTION>$sc_auth_upsgroundcomm</OPTION>
-<OPTION>yes</OPTION>
-<OPTION>no</OPTION>
-</SELECT>
-</TD>
-</TR>
-<TR>
-<TD>Do you offer UPS 2nd Day</TD>
-<TD>
-<SELECT NAME="sc_auth_ups2da">
-<OPTION>$sc_auth_ups2da</OPTION>
-<OPTION>yes</OPTION>
-<OPTION>no</OPTION>
-</SELECT>
-</TD>
-</TR>
-<TR>
-<TD>Do you offer UPS Next Day</TD>
-<TD>
-<SELECT NAME="sc_auth_ups1da">
-<OPTION>$sc_auth_ups1da</OPTION>
-<OPTION>yes</OPTION>
-<OPTION>no</OPTION>
-</SELECT>
-</TD>
-</TR>
-<TR>
-<TD>Do you offer FedEx Priority Overnight</TD>
-<TD>
-<SELECT NAME="sc_auth_fedexprioiryovernight">
-<OPTION>$sc_auth_fedexprioiryovernight</OPTION>
-<OPTION>yes</OPTION>
-<OPTION>no</OPTION>
-</SELECT>
-</TD>
-</TR>
-<TR>
-<TD>Do you offer FedEx Express Saver</TD>
-<TD>
-<SELECT NAME="sc_auth_fedexexpress">
-<OPTION>$sc_auth_fedexexpress</OPTION>
-<OPTION>yes</OPTION>
-<OPTION>no</OPTION>
-</SELECT>
-</TD>
-</TR>
-<TR>
-<TD>Do you offer FedEx Ground</TD>
-<TD>
-<SELECT NAME="sc_auth_fedexground">
-<OPTION>$sc_auth_fedexground</OPTION>
-<OPTION>yes</OPTION>
-<OPTION>no</OPTION>
-</SELECT>
-</TD>
-</TR>
-<TR>
-<TD>Do you offer FedEx Home Delivery</TD>
-<TD>
-<SELECT NAME="sc_auth_fedexhome">
-<OPTION>$sc_auth_fedexhome</OPTION>
-<OPTION>yes</OPTION>
-<OPTION>no</OPTION>
-</SELECT>
-</TD>
-</TR>
-<TR>
-<TD>Do you offer USPS Parcel Post</TD>
-<TD>
-<SELECT NAME="sc_auth_uspsparcelpost">
-<OPTION>$sc_auth_uspsparcelpost</OPTION>
-<OPTION>yes</OPTION>
-<OPTION>no</OPTION>
-</SELECT>
-</TD>
-</TR>
-<TR>
-<TD>Do you offer USPS Priority Mail</TD>
-<TD>
-<SELECT NAME="sc_auth_uspsprioritymail">
-<OPTION>$sc_auth_uspsprioritymail</OPTION>
-<OPTION>yes</OPTION>
-<OPTION>no</OPTION>
-</SELECT>
-</TD>
-</TR>
-<TR>
-<TD>Do you offer USPS Express Mail</TD>
-<TD>
-<SELECT NAME="sc_auth_uspsexpressmail">
-<OPTION>$sc_auth_uspsexpressmail</OPTION>
-<OPTION>yes</OPTION>
-<OPTION>no</OPTION>
-</SELECT>
-</TD>
-</TR>
 
-<TR>
-<TD COLSPAN=2><HR></TD>
-</TR>
-
-<TR><TD COLSPAN=2>
-Top message for Order form.  Allows you to place a message above the Payment Information area and just below the cart total boxes.  HTML formatting (for text color, font, spacing, etc) is accepted.  Leave blank if not needed:<br>
-<TEXTAREA NAME="sc_auth_top_message" 
-cols="68" rows=8 
-wrap=off>$sc_auth_top_message</TEXTAREA> <br><br>
-</TD>
-</TR>
-</table><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
-
-<TR>
-<TD COLSPAN=2><HR></TD>
-</TR>
-
-</table><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
+</table><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0>
 
 <TR>
 <TD COLSPAN=2>
@@ -353,7 +220,7 @@
 
 <TR>
 <TD COLSPAN=2>
-<INPUT NAME="x_Logo_URL" TYPE="TEXT" SIZE=60 VALUE="$x_Logo_URL"><br>
+<INPUT NAME="x_logo_url" TYPE="TEXT" SIZE=60 VALUE="$x_logo_url"><br>
 </TD>
 </TR>
 
@@ -361,15 +228,15 @@
 <TD COLSPAN=2><HR></TD>
 </TR>
 
-</table><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
+</table><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0>
 
 <TR>
 <TD width="80%">
 Background color of your orderform.
 </TD>
 <TD width="20%">
-<SELECT NAME="x_Color_Background">
-<OPTION>$x_Color_Background</OPTION>
+<SELECT NAME="x_color_background">
+<OPTION>$x_color_background</OPTION>
 <OPTION VALUE="#00FFFF">AQUA</OPTION>
 <OPTION VALUE="#000000">BLACK</OPTION>
 <OPTION VALUE="#0000FF">BLUE</OPTION>
@@ -399,8 +266,8 @@
 Text Color
 </TD>
 <TD>
-<SELECT NAME="x_Color_Text">
-<OPTION>$x_Color_Text</OPTION>
+<SELECT NAME="x_color_text">
+<OPTION>$x_color_text</OPTION>
 <OPTION VALUE="#00FFFF">AQUA</OPTION>
 <OPTION VALUE="#000000">BLACK</OPTION>
 <OPTION VALUE="#0000FF">BLUE</OPTION>
@@ -430,8 +297,8 @@
 Link Color
 </TD>
 <TD>
-<SELECT NAME="x_Color_Link">
-<OPTION>$x_Color_Link</OPTION>
+<SELECT NAME="x_color_link">
+<OPTION>$x_color_link</OPTION>
 <OPTION VALUE="#00FFFF">AQUA</OPTION>
 <OPTION VALUE="#000000">BLACK</OPTION>
 <OPTION VALUE="#0000FF">BLUE</OPTION>
@@ -452,22 +319,22 @@
 </TD>
 </TR>
 
-</table><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
+</table><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0>
 
 <TR>
 <TD COLSPAN=2><HR></TD>
 </TR>
 
 <TR>
-<TD COLSPAN="2">
-Enter the text that you'd like displayed at the <b>top
-of your orderform</b>.
+<TD COLSPAN=2>
+What description do you want to use for the order? (no longer used in SIM)
 </TD>
 </TR>
+
 <TR>
-<TD COLSPAN="2">
-<TEXTAREA NAME="x_Header_Html_Payment_Form" ROWS=6 COLS=60 
-wrap=soft>$x_Header_Html_Payment_Form</TEXTAREA>
+<TD COLSPAN=2>
+<INPUT NAME="x_description" TYPE="TEXT" SIZE=60 
+VALUE="$x_description"><br>
 </TD>
 </TR>
 
@@ -476,32 +343,94 @@
 </TR>
 
 <TR>
-<TD COLSPAN="2">
-Enter the text that you'd like displayed at the <b>bottom
-of your orderform</b>.
+<TD COLSPAN=2>
+URL of 'Submit to Authorize.net' button:
+<br>
+<INPUT NAME="sc_auth_submit" TYPE="TEXT" SIZE=60 
+VALUE='$sc_auth_submit'><br>
 </TD>
 </TR>
+
 <TR>
-<TD COLSPAN="2">
-<TEXTAREA NAME="x_Footer_Html_Payment_Form" ROWS=6 COLS=60 
-wrap=soft>$x_Footer_Html_Payment_Form</TEXTAREA>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+URL of 'Make Changes' button:
+<br>
+<INPUT NAME="sc_auth_change" TYPE="TEXT" SIZE=60 
+VALUE='$sc_auth_change'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+Order Description:
+<br>
+<INPUT NAME="sc_auth_order_desc" TYPE="TEXT" SIZE=60 
+VALUE='$sc_auth_order_desc'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+Message at the top of the Verify Order table:
+<br>
+<TEXTAREA NAME="sc_auth_verify_message"
+ROWS=4 COLS=65 wrap=soft>$sc_auth_verify_message</TEXTAREA>
 </TD>
 </TR>
 
 <TR>
+<TD COLSPAN=2><br><HR><br></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><TABLE WIDTH="100%"><TR>
+<TD>Display Terms of Service and Refund Policy checkbox and set as required?</TD>
+<TD>
+<SELECT NAME="sc_display_checkout_tos">
+<OPTION>$sc_display_checkout_tos</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT>
+</TD>
+</TR></TABLE></TD>
+</TR>
+<TR><TD COLSPAN=2><br>
+Business address and phone number (contact information) for your business.  Should be legal address for the business location for full disclosure and other privacy requirements mandated by credit card companies as well as government enitities that require such notices:<br>
+<TEXTAREA NAME="sc_tos_display_address" 
+cols="68" rows=5 
+wrap=off>$sc_tos_display_address</TEXTAREA><br>
+
+</TD>
+</TR>
+
+</table><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0>
+
+<TR>
 <TD COLSPAN=2><HR></TD>
 </TR>
 
 <TR>
 <TD COLSPAN="2">
 Enter the text that you'd like displayed at the <b>top
-of your receipt page</b>.
+of your orderform</b>.
 </TD>
 </TR>
 <TR>
 <TD COLSPAN="2">
-<TEXTAREA NAME="x_Header_Html_Receipt" ROWS=6 COLS=60 
-wrap=soft>$x_Header_Html_Receipt</TEXTAREA>
+<TEXTAREA NAME="x_header_html_payment_form" ROWS=6 COLS=60 
+wrap=soft>$x_header_html_payment_form</TEXTAREA>
 </TD>
 </TR>
 
@@ -512,13 +441,13 @@
 <TR>
 <TD COLSPAN="2">
 Enter the text that you'd like displayed at the <b>bottom
-of your receipt page</b>.
+of your orderform</b>.
 </TD>
 </TR>
 <TR>
 <TD COLSPAN="2">
-<TEXTAREA NAME="x_Footer_Html_Receipt" ROWS=6 COLS=60 
-wrap=soft>$x_Footer_Html_Receipt</TEXTAREA>
+<TEXTAREA NAME="x_footer_html_payment_form" ROWS=6 COLS=60 
+wrap=soft>$x_footer_html_payment_form</TEXTAREA>
 </TD>
 </TR>
 
@@ -529,26 +458,30 @@
 <TR>
 <TD COLSPAN="2">
 Enter the text that you'd like displayed at the <b>top
-of your customer's e-mail receipt</b>.
+of your receipt page</b>.
 </TD>
 </TR>
 <TR>
 <TD COLSPAN="2">
-<TEXTAREA NAME="x_Header_Email_Receipt" ROWS=6 COLS=60 
-wrap=soft>$x_Header_Email_Receipt</TEXTAREA>
+<TEXTAREA NAME="x_header_html_receipt" ROWS=6 COLS=60 
+wrap=soft>$x_header_html_receipt</TEXTAREA>
 </TD>
 </TR>
 
 <TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
 <TD COLSPAN="2">
 Enter the text that you'd like displayed at the <b>bottom
-of your customer's e-mail receipt</b>.
+of your receipt page</b>.
 </TD>
 </TR>
 <TR>
 <TD COLSPAN="2">
-<TEXTAREA NAME="x_Footer_Email_Receipt" ROWS=6 COLS=60 
-wrap=soft>$x_Footer_Email_Receipt</TEXTAREA>
+<TEXTAREA NAME="x_footer_html_receipt" ROWS=6 COLS=60 
+wrap=soft>$x_footer_html_receipt</TEXTAREA>
 </TD>
 </TR>
 
@@ -557,15 +490,28 @@
 </TR>
 
 <TR>
-<TD COLSPAN=2>
-What description do you want to use for the order? (no longer used in SIM)
+<TD COLSPAN="2">
+Enter the text that you'd like displayed at the <b>top
+of your customer's e-mail receipt</b>.
+</TD>
+</TR>
+<TR>
+<TD COLSPAN="2">
+<TEXTAREA NAME="x_header_email_receipt" ROWS=6 COLS=60 
+wrap=soft>$x_header_email_receipt</TEXTAREA>
 </TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2>
-<INPUT NAME="x_Description" TYPE="TEXT" SIZE=60 
-VALUE="$x_Description"><br>
+<TD COLSPAN="2">
+Enter the text that you'd like displayed at the <b>bottom
+of your customer's e-mail receipt</b>.
+</TD>
+</TR>
+<TR>
+<TD COLSPAN="2">
+<TEXTAREA NAME="x_footer_email_receipt" ROWS=6 COLS=60 
+wrap=soft>$x_footer_email_receipt</TEXTAREA>
 </TD>
 </TR>
 
@@ -573,7 +519,7 @@
 <TD COLSPAN=2>
 <CENTER>
 <INPUT TYPE="HIDDEN" NAME="system_edit_success" VALUE="yes">
-<INPUT TYPE="HIDDEN" NAME="gateway" VALUE="$sc_gateway_name">
+<INPUT TYPE="HIDDEN" NAME="gateway" VALUE="AuthorizeNet">
 <INPUT NAME="GatewaySettings" TYPE="SUBMIT" VALUE="Submit">
 &nbsp;&nbsp;
 <INPUT TYPE="RESET" VALUE="Reset">
diff -ruN 4.0K-4b/library/AuthorizeNet-order_lib.pl 5.0.000/library/AuthorizeNet-order_lib.pl
--- 4.0K-4b/library/AuthorizeNet-order_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/AuthorizeNet-order_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -2,17 +2,34 @@
 #                    Order Form Definition Variables                  #
 #######################################################################
 
+$versions{'AuthorizeNet-order_lib.pl'} = "5.0.000";
+
+# Copyright 2000-2001 Steve Kneizys.
+# Copyright 2002 to Present K-Factor Technologies, Inc.  All Rights Reserved.
 # 4/24/00 SPK ADDED THESE TAGS:
-#<INPUT TYPE=HIDDEN NAME=x_ADC_URL VALUE=\"$sc_store_url\">
-#<INPUT TYPE=HIDDEN NAME=x_ADC_Relay_Response VALUE=\"true\">
+#<INPUT TYPE=HIDDEN NAME=x_adc_url VALUE=\"$sc_store_url\">
+#<INPUT TYPE=HIDDEN NAME=x_adc_relay_response VALUE=\"true\">
+# March 6, 2003 SIM integration version
+# discount mods applied June 17, 2005 by Eric Welin at K-Factor Technologies, Inc.
+# April 2006 conversion to version 5 by Justin Findlay at K-Factor Technologies, Inc.
+# May 3, 2006 Adjustments and misc edits for final v5 version by Mister Ed at K-Factor Technologies, Inc.
+# May 5, 2006 final edits for final v5 version by Mister Ed at K-Factor Technologies, Inc.
 
-$versions{'AuthorizeNet-order_lib.pl'} = "20030306";
 
 &add_codehook("printSubmitPage","print_AuthorizeNet_SubmitPage");
 &add_codehook("set_form_required_fields","AuthorizeNet_fields");
 $sc_order_response_vars{"AuthorizeNet"}="x_response_code";
 &add_codehook("gateway_response","check_for_AuthorizeNet_response");
 ###############################################################################
+sub AuthorizeNet_check_and_load {
+local($myname)="AuthorizeNet";
+if ($myname ne $sc_gateway_name) { # we are a secondary gateway, load settings
+  &require_supporting_libraries(__FILE__,__LINE__,
+     "./admin_files/$myname-user_lib.pl");
+ }
+
+}
+###############################################################################
 sub check_for_AuthorizeNet_response {
   if ($form_data{'x_response_code'}) {
     $cart_id = $form_data{'x_cust_id'};
@@ -24,7 +41,8 @@
    }
  }
 ###############################################################################
-sub AuthorizeNet_order_form_prep{ # load the customer info ...
+sub AuthorizeNet_order_form_prep { # load the customer info ...
+  &AuthorizeNet_check_and_load;
   if ($sc_AuthorizeNet_form_prep == 0) {
     if (-f "$sc_verify_order_path"){
       &read_verify_file;  
@@ -36,67 +54,113 @@
   return "";
  }
 ###############################################################################
-sub AuthorizeNet_fields{
+sub AuthorizeNet_fields {
 local($myname)="AuthorizeNet";
 
 if (!($form_data{'gateway'} eq $myname)) { return;} 
 
-%sc_order_form_array =('Ecom_BillTo_Postal_Name_First', 'First Name',
-                       'Ecom_BillTo_Postal_Name_Last', 'Last Name',
-                       'Ecom_BillTo_Postal_Street_Line1', 'Billing Address Street',
-                       'Ecom_BillTo_Postal_City', 'Billing Address City',
-                       'Ecom_BillTo_Postal_StateProv', 'Billing Address State',
-                       'Ecom_BillTo_PostalCode', 'Billing Address Zip',
-                       'Ecom_BillTo_Postal_CountryCode', 'Billing Address Country',
-                       'Ecom_ShipTo_Postal_Street_Line1', 'Shipping Address Street',
-                       'Ecom_ShipTo_Postal_City', 'Shipping Address City',
-                       'Ecom_ShipTo_Postal_StateProv', 'Shipping Address State',
-                       'Ecom_ShipTo_Postal_PostalCode', 'Shipping Address Zip',
-                       'Ecom_ShipTo_Postal_CountryCode', 'Shipping Address Country',
-                       'Ecom_BillTo_Telecom_Phone_Number', 'Phone Number',
-                       'Ecom_BillTo_Online_Email', 'Email',
-                       'Ecom_Payment_Card_Type', 'Type of Card',
-                       'Ecom_Payment_Card_Number', 'Card Number',
-                       'Ecom_Payment_Card_ExpDate_Month', 'Card Expiration Month',
-                       'Ecom_Payment_Card_ExpDate_Day', 'Card Expiration Day',
-                       'Ecom_Payment_Card_ExpDate_Year', 'Card Expiration Year');
+%sc_order_form_array =(
+	'Ecom_BillTo_Postal_Name_First', 'First Name',
+	'Ecom_BillTo_Postal_Name_Last', 'Last Name',
+	'Ecom_BillTo_Postal_Street_Line1', 'Billing Address Street',
+	'Ecom_BillTo_Postal_City', 'Billing Address City',
+	'Ecom_BillTo_Postal_StateProv', 'Billing Address State',
+	'Ecom_BillTo_PostalCode', 'Billing Address Zip',
+	'Ecom_BillTo_Postal_CountryCode', 'Billing Address Country',
+	'Ecom_ShipTo_Postal_Street_Line1', 'Shipping Address Street',
+	'Ecom_ShipTo_Postal_City', 'Shipping Address City',
+	'Ecom_ShipTo_Postal_StateProv', 'Shipping Address State',
+	'Ecom_ShipTo_Postal_PostalCode', 'Shipping Address Zip',
+	'Ecom_ShipTo_Postal_CountryCode', 'Shipping Address Country',
+	'Ecom_BillTo_Telecom_Phone_Number', 'Phone Number',
+	'Ecom_BillTo_Online_Email', 'Email',
+	'Ecom_Payment_Card_Type', 'Type of Card',
+	'Ecom_Payment_Card_Number', 'Card Number',
+	'Ecom_Payment_Card_ExpDate_Month', 'Card Expiration Month',
+	'Ecom_Payment_Card_ExpDate_Day', 'Card Expiration Day',
+	'Ecom_Payment_Card_ExpDate_Year', 'Card Expiration Year',
+	'Ecom_is_Residential', 'Shipping to Residential Address',
+	'Ecom_ShipTo_Insurance', 'Insure this Shipment', # not implemented yet, for the future
+	'Ecom_tos', 'Sales-Terms of Service');
                         
 
 @sc_order_form_required_fields = (
-	"Ecom_ShipTo_Postal_StateProv",
-	"Ecom_ShipTo_Postal_PostalCode");
+  "Ecom_ShipTo_Postal_StateProv",
+  "Ecom_ShipTo_Postal_PostalCode");
 
+# lines for tos added 2006 April 13 jfindlay
+ if ($sc_display_checkout_tos =~ /yes/i) {
+    push(@sc_order_form_required_fields,"Ecom_tos");
+ }
 }
 ###############################################################################
 sub AuthorizeNet_verification_table {
   local ($rslt)="";
-  $rslt = "<table border=0 width=100%>\n<tr>\n";
-  $rslt.= "<td width=\"50%\" align=right>State:</td>\n";
-  $rslt.= '<td width = "50%" align=left>' .
-	$form_data{'Ecom_ShipTo_Postal_StateProv'} . "&nbsp;</td>\n";
-  $rslt.= "</tr>\n";
-  $rslt.= "<tr>\n";
-  $rslt.= "<td width=\"50%\" align=right>Zip:</td>\n";
-  $rslt.= '<td width = "50%" align=left>' .
-	$form_data{'Ecom_ShipTo_Postal_PostalCode'} . "&nbsp;</td>\n";
-  $rslt.= "</tr>\n";
-  $rslt.= "</table>\n";
+  $rslt = <<ENDOFTEXT;
+  
+<div align="center">
+<table cellpadding="0" cellspacing="0" class="ac_checkout_review">
+<tr>
+<th colspan="2" class="ac_checkout_review">Customer Information</th>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Customer Number</td>
+<td class="ac_checkout_review_col2">$cart_id</td>
+</tr>
+
+<tr>
+<th colspan="2" class="ac_checkout_review">Shipping Information</th>
+</tr>
+
+ENDOFTEXT
+
+if ($form_data{'Ecom_ShipTo_Method'} ne ""){
+$rslt .= <<ENDOFTEXT;
+<tr>
+<td class="ac_checkout_review_col1">Ship via</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Method'}&nbsp;</td>
+</tr>
+ENDOFTEXT
+}
+
+$rslt .= <<ENDOFTEXT;
+
+<tr>
+<td class="ac_checkout_review_col1">State/Province</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_StateProv'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Zip</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_PostalCode'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Country</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_CountryCode'}&nbsp;</td>
+</tr>
+
+</table>
+</div>
+ENDOFTEXT
+
   return $rslt;
  }
 ###############################################################################
 sub anet_table_setup{
 #
-# To use this, put this in the x_Header_Html in the manager:
+# To use this, put this in the x_header_html in the manager:
 #
-#	<!--agorascript-pre
-#	  return $anet_cart_table;
-#	-->
+# <!--agorascript-pre
+#   return $anet_cart_table;
+# -->
 #
 # and in the email footer you can use:
 #
-#	<!--agorascript-pre
-#	  return $anet_prod_in_cart;
-#	-->
+# <!--agorascript-pre
+#   return $anet_prod_in_cart;
+# -->
 # 
 
 local (@my_cart_fields,$my_cart_row_number,$result);
@@ -166,8 +230,9 @@
 if ($merchant_live_mode =~ /yes/i){
   $test_mode = "";
  } else {
-  $test_mode = "<INPUT TYPE=HIDDEN NAME=x_Test_Request VALUE=\"TRUE\">";
+  $test_mode = qq~<input type="hidden" name="x_test_request" value="TRUE">~;
  }
+
 $tstamp = time;
 if ($sc_tstamp3 =~ /add/i){
   $tstamp = $tstamp + $sc_tstamp2;
@@ -187,93 +252,78 @@
 
 &anet_table_setup;
 $xx_Header_Html_Payment_Form =
-	&script_and_substitute($x_Header_Html_Payment_Form,"Anet");
+  &script_and_substitute($x_header_html_payment_form,"Anet");
 $xx_Footer_Html_Payment_Form =
-	&script_and_substitute($x_Footer_Html_Payment_Form,"Anet");
+  &script_and_substitute($x_footer_html_payment_form,"Anet");
 $xx_Header_Html_Receipt =
-	&script_and_substitute($x_Header_Html_Receipt,"Anet");
+  &script_and_substitute($x_header_html_receipt,"Anet");
 $xx_Footer_Html_Receipt =
-	&script_and_substitute($x_Footer_Html_Receipt,"Anet");
+  &script_and_substitute($x_footer_html_receipt,"Anet");
 $xx_Header_Email_Receipt =
-	&script_and_substitute($x_Header_Email_Receipt,"Anet");
+  &script_and_substitute($x_header_email_receipt,"Anet");
 $xx_Footer_Email_Receipt =
-	&script_and_substitute($x_Footer_Email_Receipt,"Anet");
-# if ($x_Description eq '') {
-#  $x_Description = "Online Order"; # default value
-# }
-# $xx_Description =
-#	&script_and_substitute($x_Description,"Anet");
+  &script_and_substitute($x_footer_email_receipt,"Anet");
+
 
 &codehook("AuthorizeNet-SubmitPage-print");
 
-# <INPUT TYPE=HIDDEN NAME=x_Description VALUE=\"$xx_Description\">
 print <<ENDOFTEXT;
-
-<FORM METHOD=POST ACTION=\"$sc_order_script_url\">
-<INPUT TYPE=HIDDEN NAME=x_amount VALUE=\"$authPrice\">
-<INPUT TYPE=HIDDEN NAME=x_Freight VALUE=\"$zfinal_shipping\">
-<INPUT TYPE=HIDDEN NAME=ud_Discount VALUE=\"$zfinal_discount\">
-<INPUT TYPE=HIDDEN NAME=x_Tax VALUE=\"$zfinal_sales_tax\">
-<INPUT TYPE=HIDDEN NAME=x_Login VALUE=\"$sc_gateway_username\">
-<INPUT TYPE=HIDDEN NAME=x_Invoice_Num VALUE=\"$invoice_number\">
-<INPUT TYPE=HIDDEN NAME=x_Description VALUE=\"$anet_desc\">
-<INPUT TYPE=HIDDEN NAME=x_Cust_ID VALUE=\"$customer_number\">
-<INPUT TYPE=HIDDEN NAME=x_Show_Form VALUE=\"PAYMENT_FORM\">
-<INPUT TYPE=HIDDEN NAME=x_Receipt_Link_Method VALUE=\"POST\">
-<INPUT TYPE=HIDDEN NAME=x_Receipt_Link_Text VALUE=\"YOU MUST CLICK HERE TO FINALIZE YOUR ORDER!\">
-<INPUT TYPE=HIDDEN NAME=x_Receipt_Link_URL VALUE=\"$sc_store_url\">
+<div align="center">
+<table width="500" cellpadding="5" cellspacing="0" border="0">
+<tr>
+<td align="center">
+
+<form method="post" action="$sc_order_script_url">
+
+<input type="hidden" name="x_amount" value="$authPrice">
+<input type="hidden" name="x_freight" value="$zfinal_shipping">
+<input type="hidden" name="ud_Discount" value="$zfinal_discount">
+<input type="hidden" name="x_tax" value="$zfinal_sales_tax">
+
+<input type="hidden" name="x_login" value="$sc_gateway_username">
+<input type="hidden" name="x_invoice_num" value="$invoice_number">
+<input type="hidden" name="x_description" value="$x_description">
+<input type="hidden" name="x_cust_id" value="$customer_number">
+<input type="hidden" name="x_show_form" value="PAYMENT_FORM">
+
+<input type="hidden" name="x_receipt_link_method" value="POST">
+<input type="hidden" name="x_receipt_link_text" value="YOU MUST CLICK HERE TO FINALIZE YOUR ORDER!">
+<input type="hidden" name="x_receipt_link_url" value="$sc_ssl_location_url2">
 $test_mode
-<INPUT TYPE=HIDDEN NAME=x_ADC_URL VALUE=\"$sc_store_url\">
-<INPUT TYPE=HIDDEN NAME=x_ADC_Relay_Response VALUE=\"true\">
-<INPUT TYPE=HIDDEN NAME=x_Version VALUE=\"3.1\">
-
-<INPUT TYPE=HIDDEN NAME=x_Logo_URL VALUE=\"$x_Logo_URL\">
-<INPUT TYPE=HIDDEN NAME=x_Color_Background VALUE=\"$x_Color_Background\">
-<INPUT TYPE=HIDDEN NAME=x_Color_Link VALUE=\"$x_Color_Link\">
-<INPUT TYPE=HIDDEN NAME=x_Color_Text VALUE=\"$x_Color_Text\">
-<INPUT TYPE=HIDDEN NAME=x_Header_Html_Payment_Form VALUE=\"$xx_Header_Html_Payment_Form\">
-<INPUT TYPE=HIDDEN NAME=x_Footer_Html_Payment_Form VALUE=\"$xx_Footer_Html_Payment_Form\">
-<INPUT TYPE=HIDDEN NAME=x_Header_Html_Receipt VALUE=\"$xx_Header_Html_Receipt\">
-<INPUT TYPE=HIDDEN NAME=x_Footer_Html_Receipt VALUE=\"$xx_Footer_Html_Receipt\">
-<INPUT TYPE=HIDDEN NAME=x_Header_Email_Receipt VALUE=\"$xx_Header_Email_Receipt\">
-<INPUT TYPE=HIDDEN NAME=x_Footer_Email_Receipt VALUE=\"$xx_Footer_Email_Receipt\">
-<INPUT TYPE=HIDDEN NAME=Ecom_ShipTo_Method VALUE=\"$form_data{'Ecom_ShipTo_Method'}\">
-<INPUT TYPE=HIDDEN NAME=X_Ship_To_State VALUE=\"$form_data{'Ecom_ShipTo_Postal_StateProv'}\">
-<INPUT TYPE=HIDDEN NAME=X_Ship_To_Zip VALUE=\"$form_data{'Ecom_ShipTo_Postal_PostalCode'}\">
-<INPUT TYPE="HIDDEN" NAME=x_fp_sequence VALUE=\"$sequence\">
-<INPUT TYPE="HIDDEN" NAME=x_fp_timestamp VALUE=\"$tstamp\">
-<INPUT TYPE="HIDDEN" NAME=x_fp_hash VALUE=\"$fp\">
+<input type="hidden" name="x_adc_url" value="$sc_ssl_location_url2">
+<input type="hidden" name="x_adc_relay_response" value="true">
+<input type="hidden" name="x_version" value="3.1">
+
+<input type="hidden" name="x_logo_url" value="$x_logo_url">
+<input type="hidden" name="x_color_background" value="$x_color_background">
+<input type="hidden" name="x_color_link" value="$x_color_link">
+<input type="hidden" name="x_color_text" value="$x_color_text">
+<input type="hidden" name="x_header_html_payment_form" value="$xx_Header_Html_Payment_Form">
+<input type="hidden" name="x_footer_html_payment_form" value="$xx_Footer_Html_Payment_Form">
+<input type="hidden" name="x_header_html_receipt" value="$xx_Header_Html_Receipt">
+<input type="hidden" name="x_footer_html_receipt" value="$xx_Footer_Html_Receipt">
+<input type="hidden" name="x_header_email_receipt" value="$xx_Header_Email_Receipt">
+<input type="hidden" name="x_footer_email_receipt" value="$xx_Footer_Email_Receipt">
+<input type="hidden" name="Ecom_ShipTo_Method" value="$form_data{'Ecom_ShipTo_Method'}">
+<input type="hidden" name="x_Ship_To_State" value="$form_data{'Ecom_ShipTo_Postal_StateProv'}">
+<input type="hidden" name="x_Ship_To_Zip" value="$form_data{'Ecom_ShipTo_Postal_PostalCode'}">
+<input type="hidden" name="x_Ship_To_Country" value="$form_data{'Ecom_ShipTo_Postal_CountryCode'}">
+<input type="hidden" name="x_fp_sequence" value="$sequence">
+<input type="hidden" name="x_fp_timestamp" value="$tstamp">
+<input type="hidden" name="x_fp_hash" value="$fp">
 
-<TABLE WIDTH="500" BGCOLOR="#C0FFFF" CELLPADDING="0" CELLSPACING="0">
-<TR>
-<TD>
 
-<TABLE WIDTH="500" BGCOLOR="#000080" CELLPADDING="0" CELLSPACING="0">
-<TR BGCOLOR="#C0FFFF">
-<TD BGCOLOR="#C0FFFF"><FONT FACE="ARIAL" SIZE="2" COLOR="#000000">
-$messages{'ordcnf_06'}</FONT></TD>
-<TD  BGCOLOR="#C0FFFF">
-</TR>
-<TR BGCOLOR="#C0FFFF">
-<TD BGCOLOR="#C0FFFF"><FONT FACE="ARIAL" SIZE="2" COLOR="#000000">
 $mytable
-</TD></TR>
-<TR BGCOLOR="#C0FFFF">
-<TD>
-<CENTER>
-<INPUT TYPE=SUBMIT VALUE="Secure Orderform">
-</CENTER>
-</TD>
-</TR>
-</TABLE>
-
-</TD>
-</TR>
-</TABLE>
+<p class="ac_checkout_top_msg">$messages{'ordcnf_06'}</p>
 
-</FORM>
-</CENTER>
+<br>
+<input type="submit" value="Secure Orderform">
 
+</form>
+</td>
+</tr>
+</table>
+</div>
 ENDOFTEXT
 
 }
@@ -288,6 +338,48 @@
 local($stevo_shipping_names) = "";
 local($mytext) = "";
 local($ship_thing_too,$ship_instructions);
+local(%orderLoggingHash);
+
+#alt origination stuff added by Mister Ed Feb 17, 2005
+if ($sc_alt_origin_enabled =~ /yes/i) {
+  local(%zip_list);
+  local(%zip_names_list);
+}
+
+# Now let's check the _VERIFY file, just to be sure ...
+# Added 2006 April 10 by jfindlay
+if (!(-f "$sc_verify_order_path")){
+&SecureStoreHeader;
+print <<ENDOFTEXT;
+<CENTER>
+<TABLE WIDTH=500>
+<TR>
+<TD WIDTH=500>
+<FONT FACE=ARIAL>
+$messages{'ordcnf_03'}
+$messages{'ordcnf_02'}
+</FONT>
+</TD>
+</TR>
+</TABLE>
+<CENTER>
+ 
+ENDOFTEXT
+ 
+# and the footer is printed
+ 
+&SecureStoreFooter;
+ 
+print qq!
+</BODY>
+</HTML>
+!;
+ 
+&file_open_error("$sc_verify_order_path", 
+	"Authorize.net Check for Verify file", __FILE__, __LINE__);
+exit;
+ 
+ }
 
 #
 # Need to process this info someday ...
@@ -313,12 +405,16 @@
 
 $orderDate = &get_date;
 
+# NEW CODEHOOK
+&codehook("process-order-routine-top");
+
 print qq!
-<HTML>
 $sc_special_page_meta_tags
+<HTML>
 <HEAD>
 <TITLE>$messages{'ordcnf_08'}</TITLE>
-$sc_standard_head_info</HEAD>
+<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+$sc_secure_standard_head_info</HEAD>
 <BODY $sc_standard_body_info>
 !;
 
@@ -355,11 +451,69 @@
 
 # All went well at AuthorizeNet, proceed with processing
 
+# initialize hash variables in case they are empty later
+# added by jfindlay 2006 April 10
+
+$orderLoggingHash{'firstName'} = "";
+$orderLoggingHash{'lastName'} = "";
+$orderLoggingHash{'fullName'} = "";
+$orderLoggingHash{'orderFromAddress'} = "";
+$orderLoggingHash{'customerAddress2'} = "";
+$orderLoggingHash{'customerAddress3'} = "";
+$orderLoggingHash{'orderFromCity'} = "";
+$orderLoggingHash{'orderFromPostal'} = "";
+$orderLoggingHash{'customerPhone'} = "";
+$orderLoggingHash{'faxNumber'} = "";
+$orderLoggingHash{'companyName'} = "";
+$orderLoggingHash{'emailAddress'} = "";
+
+$orderLoggingHash{'shipToName'} = "";
+$orderLoggingHash{'shipToAddress'} = "";
+$orderLoggingHash{'shipToAddress2'} = "";
+$orderLoggingHash{'shipToAddress3'} = "";
+$orderLoggingHash{'shipToCity'} = "";
+$orderLoggingHash{'shipToState'} = "";
+$orderLoggingHash{'shipToPostal'} = "";
+$orderLoggingHash{'shipToCountry'} = "";
+$orderLoggingHash{'shiptoResidential'} = $vform_Ecom_is_Residential;
+$orderLoggingHash{'insureShipment'} = $vform_Ecom_ShipTo_Insurance; # not implemented yet, for the future
+
+$orderLoggingHash{'invoiceNumber'} = "";
+$orderLoggingHash{'customerNumber'} = "";
+$orderLoggingHash{'orderStatus'} = "$sc_order_status_default";
+$orderLoggingHash{'user1'} = "";
+$orderLoggingHash{'user2'} = "";
+$orderLoggingHash{'user3'} = "";
+$orderLoggingHash{'user4'} = "";
+$orderLoggingHash{'user5'} = "";
+$orderLoggingHash{'itemsordered'} = "";
+$orderLoggingHash{'shiptrackingID'} = "";
+$orderLoggingHash{'shipMethod'} = "";
+$orderLoggingHash{'orderFromState'} = "";
+$orderLoggingHash{'orderFromCountry'} = "";
+$orderLoggingHash{'shippingTotal'} = "";
+$orderLoggingHash{'salesTax'} = "";
+$orderLoggingHash{'tax1'} = "";
+$orderLoggingHash{'tax2'} = "";
+$orderLoggingHash{'tax3'} = "";
+$orderLoggingHash{'discounts'} = "";
+$orderLoggingHash{'netProfit'} = "";
+$orderLoggingHash{'affiliateTotal'} = "";
+$orderLoggingHash{'affiliateID'} = "";
+$orderLoggingHash{'affiliateMisc'} = "";
+$orderLoggingHash{'subTotal'} = "";
+$orderLoggingHash{'orderTotal'} = "";
+$orderLoggingHash{'adminMessages'} = "";
+$orderLoggingHash{'shippingMessages'} = "";
+$orderLoggingHash{'xcomments'} = "";
+$orderLoggingHash{'termsOfService'} = "$vform_Ecom_tos";
+
 print $mytext;
 
 $text_of_cart .= "${mytext}";
 $text_of_cart .= "Order Date:    $orderDate\n";
 $text_of_cart .= "Gateway:       AuthorizeNet\n\n";
+$orderLoggingHash{'GatewayUsed'} = "AuthorizeNet";
 
 $text_of_cart .= "  --PRODUCT INFORMATION--\n\n";
 
@@ -367,20 +521,20 @@
 &file_open_error("$sc_cart_path", "display_cart_contents", __FILE__, __LINE__);
 
 while (<CART>)
-	{
-	$cartData++;
-	@cart_fields = split (/\|/, $_);
-	$quantity = $cart_fields[0];
-	$product_price = $cart_fields[3];
-	$product = $cart_fields[4];
-	$weight = $cart_fields[6];
-	$options = $cart_fields[$cart{"options"}];
-	$options =~ s/<br>/ /g;
+  {
+  $cartData++;
+  @cart_fields = split (/\|/, $_);
+  $quantity = $cart_fields[0];
+  $product_price = $cart_fields[3];
+  $product = $cart_fields[4];
+  $weight = $cart_fields[6];
+  $options = $cart_fields[$cart{"options"}];
+  $options =~ s/<br>/ /g;
         $text_of_cart .= &cart_textinfo(*cart_fields);
         $stevo_shipping_thing .="|$quantity\*$weight";
         $stevo_shipping_names .="|$product\($options\)";
         &codehook("process-cart-item");
-	}
+  }
 close(CART);
 
 $sc_orderlib_use_SBW_for_ship_ins = $sc_use_SBW;
@@ -390,110 +544,215 @@
    &ship_put_in_boxes($stevo_shipping_thing,$stevo_shipping_names,
    $sc_verify_Origin_ZIP,$sc_verify_boxes_max_wt); 
  }
+$orderLoggingHash{'shippingMessages'} = "$ship_instructions";
+$orderLoggingHash{'shippingMessages'} =~ s/\n/<br>/g;
+
+  $text_of_confirm_email .= $messages{'ordcnf_07'};
+
+  $text_of_confirm_email .= $text_of_cart;
+  $text_of_confirm_email .= "\n";
+
+  $text_of_cart .= "  --ORDER INFORMATION--\n\n";
 
-	$text_of_confirm_email .= $messages{'ordcnf_07'};
+  $text_of_cart .= "CUSTID:        $form_data{'x_cust_id'}\n";
+  $text_of_confirm_email .= "CUSTID:        $form_data{'x_cust_id'}\n";
+  $orderLoggingHash{'customerNumber'} = "$form_data{'x_cust_id'}";
 
-	$text_of_confirm_email .= $text_of_cart;
-	$text_of_confirm_email .= "\n";
+  $text_of_cart .= "INVOICE:       $form_data{'x_invoice_num'}\n";
+  $text_of_confirm_email .= "INVOICE:       $form_data{'x_invoice_num'}\n";
+  $orderLoggingHash{'invoiceNumber'} = "$form_data{'x_invoice_num'}";
 
-	$text_of_cart .= "  --ORDER INFORMATION--\n\n";
+	# added 2006 April 10 by jfindlay
+  $temp = &display_price($sc_verify_subtotal);
+  &add_text_of_both("SUBTOTAL",$temp);
+  $orderLoggingHash{'subTotal'} = "$sc_verify_subtotal";
 
-	$text_of_cart .= "CUSTID:        $form_data{'x_cust_id'}\n";
-	$text_of_confirm_email .= "CUSTID:        $form_data{'x_cust_id'}\n";
-
-	$text_of_cart .= "INVOICE:       $form_data{'x_invoice_num'}\n";
-	$text_of_confirm_email .= "INVOICE:       $form_data{'x_invoice_num'}\n";
-
-	if ($form_data{'x_freight'})
-	{
-	$text_of_cart .= "SHIPPING:      $form_data{'x_freight'}\n";
-	$text_of_confirm_email .= "SHIPPING:      $form_data{'x_freight'}\n";
-        if ($sc_use_SBW =~ /yes/i)
-         {
-           $text_of_confirm_email .= 
-                        "SHIP VIA:      $form_data{'HW2SHIP'}\n";
+  if ($form_data{'x_freight'})
+  {
+  $text_of_cart .= "SHIPPING:      $form_data{'x_freight'}\n";
+  $text_of_confirm_email .= "SHIPPING:      $form_data{'x_freight'}\n";
+  $orderLoggingHash{'shippingTotal'} = &format_price($sc_verify_shipping);
+  $orderLoggingHash{'shipMethod'} = "$vform_Ecom_ShipTo_Method";
+         if (($sc_use_SBW =~ /yes/i) || ($form_data{'x_Freight'} > .009)) {
+           $text_of_confirm_email .=  "SHIP VIA:      $vform_Ecom_ShipTo_Method\n";
          }
-	}
+  }
 
-	if ($form_data{'ud_Discount'})
-	{
-	$text_of_cart .= "DISCOUNT:      $form_data{'ud_Discount'}\n";
-	$text_of_confirm_email .= "DISCOUNT:      $form_data{'ud_Discount'}\n";
-	}
-
-	if ($form_data{'x_tax'})
-	{
-	$text_of_cart .=          "TOT SALES TAX: $form_data{'x_tax'}\n";
-	$text_of_confirm_email .= "TOT SALES TAX: $form_data{'x_tax'}\n";
-	}
+  if ($form_data{'ud_Discount'}) {
+      $text_of_cart .= "DISCOUNT:      $form_data{'ud_Discount'}\n";
+      $text_of_confirm_email .= "DISCOUNT:      $form_data{'ud_Discount'}\n";
+      $orderLoggingHash{'discounts'} = "$form_data{'ud_Discount'}";
+      $text_of_cart .= "DISCOUNT CODE: $eform_Ecom_Discount\n";
+      $text_of_confirm_email .= "DISCOUNT CODE: $eform_Ecom_Discount\n";
+      $orderLoggingHash{'discountCode'} = "$eform_Ecom_Discount";
+  }
 
-if ($sc_verify_tax > 0)
-{
-$temp = substr(substr("SALES TAX",0,13).":               ",0,15);
-$text_of_cart .= "$temp$sc_verify_tax\n";
-$text_of_confirm_email .= "$temp$sc_verify_tax\n";
+  if ($form_data{'x_tax'}) {
+      $text_of_cart .=          "TOT SALES TAX: $form_data{'x_tax'}\n";
+      $text_of_confirm_email .= "TOT SALES TAX: $form_data{'x_tax'}\n";
+	  #$orderLoggingHash{'totalSalesTax'} = $form_data{'x_tax'}; # not used
+  }
+
+if ($sc_verify_tax > 0) {
+    $temp = substr(substr("SALES TAX",0,13).":               ",0,15);
+    $text_of_cart .= "$temp$sc_verify_tax\n";
+    $text_of_confirm_email .= "$temp$sc_verify_tax\n";
+    $orderLoggingHash{'salesTax'} = "$sc_verify_tax";
 }
 if ($sc_verify_etax1 > 0)
 {
 $temp = substr(substr($sc_extra_tax1_name,0,13).":               ",0,15);
 $text_of_cart .= "$temp$sc_verify_etax1\n";
 $text_of_confirm_email .= "$temp$sc_verify_etax1\n";
+$orderLoggingHash{'tax1'} = "$sc_verify_etax1";
 }
 if ($sc_verify_etax2 > 0)
 {
 $temp = substr(substr($sc_extra_tax2_name,0,13).":               ",0,15);
 $text_of_cart .= "$temp$sc_verify_etax2\n";
 $text_of_confirm_email .= "$temp$sc_verify_etax2\n";
+$orderLoggingHash{'tax2'} = "$sc_verify_etax2";
 }
 if ($sc_verify_etax3 > 0)
 {
 $temp = substr(substr($sc_extra_tax3_name,0,13).":               ",0,15);
 $text_of_cart .= "$temp$sc_verify_etax3\n";
 $text_of_confirm_email .= "$temp$sc_verify_etax3\n";
+$orderLoggingHash{'tax3'} = "$sc_verify_etax3";
 }
 
-	$text_of_cart .= "TOTAL:         $form_data{'x_amount'}\n";
-	$text_of_confirm_email .= "TOTAL:         $form_data{'x_amount'}\n";
+  $text_of_cart .= "TOTAL:         $form_data{'x_amount'}\n";
+  $text_of_confirm_email .= "TOTAL:         $form_data{'x_amount'}\n";
+  $orderLoggingHash{'orderTotal'} = "$form_data{'x_amount'}";
+
+  $text_of_cart .= "METHOD:        $form_data{'x_method'}\n";
+  $text_of_cart .= "TYPE:          $form_data{'x_type'}\n";
+  $text_of_cart .= "DESCRIPTION:   $form_data{'x_description'}\n\n";
+  
+  $text_of_cart .= "RESP CODE:     $form_data{'x_response_code'}\n";
+  $text_of_cart .= "RESP SUBCODE:  $form_data{'x_response_subcode'}\n";
+  $text_of_cart .= "REASON CODE:   $form_data{'x_response_reason_code'}\n";
+  $text_of_cart .= "REASON TEXT:   $form_data{'x_response_reason_text'}\n";
+  $text_of_cart .= "AUTH CODE:     $form_data{'x_auth_code'}\n";
+  $text_of_cart .= "AVS CODE:      $form_data{'x_avs_code'}\n";
+  $text_of_cart .= "TRANS ID:      $form_data{'x_trans_id'}\n\n";
+	$orderLoggingHash{'adminMessages'} .= "<br>AUTHORIZATION INFORMATION --------------<br>RESP CODE: $form_data{'x_response_code'}<br>RESP SUBCODE: $form_data{'x_response_subcode'}<br>REASON CODE: $form_data{'x_response_reason_code'}<br>REASON TEXT: $form_data{'x_response_reason_text'}<br>AUTH CODE: $form_data{'x_auth_code'}<br>AVS CODE: $form_data{'x_avs_code'}<br>TRANS ID: $form_data{'x_trans_id'}<br>---------------------------------------------------------------<br>";
+  
+  $text_of_cart .= "BILLING INFORMATION --------------\n\n";
+
+  $text_of_cart .= "NAME:          $form_data{'x_first_name'} $form_data{'x_last_name'}\n";
+  $orderLoggingHash{'fullName'} = "$form_data{'x_first_name'} $form_data{'x_last_name'}";
+  $orderLoggingHash{'firstName'} = "$form_data{'x_first_name'}";
+  $orderLoggingHash{'lastName'} = "$form_data{'x_last_name'}";
+  $orderLoggingHash{'companyName'} = "$form_data{'x_company'}";
+
+  $text_of_cart .= "COMPANY:       $form_data{'x_company'}\n";
+  $orderLoggingHash{'companyName'} = "$form_data{'x_company'}";
+
+  $text_of_cart .= "ADDRESS:       $form_data{'x_address'}\n";
+  $orderLoggingHash{'orderFromAddress'} = "$form_data{'x_address'}";
+
+  $text_of_cart .= "CITY:          $form_data{'x_city'}\n";
+  $orderLoggingHash{'orderFromCity'} = "$form_data{'x_city'}";
+
+  $text_of_cart .= "STATE:         $form_data{'x_state'}\n";
+  $orderLoggingHash{'orderFromState'} = "$form_data{'x_state'}";
 
-	$text_of_cart .= "METHOD:        $form_data{'x_method'}\n";
-	$text_of_cart .= "TYPE:          $form_data{'x_type'}\n";
-	$text_of_cart .= "DESCRIPTION:   $form_data{'x_description'}\n\n";
-	
-	$text_of_cart .= "RESP CODE:     $form_data{'x_response_code'}\n";
-	$text_of_cart .= "RESP SUBCODE:  $form_data{'x_response_subcode'}\n";
-	$text_of_cart .= "REASON CODE:   $form_data{'x_response_reason_code'}\n";
-	$text_of_cart .= "REASON TEXT:   $form_data{'x_response_reason_text'}\n";
-	$text_of_cart .= "AUTH CODE:     $form_data{'x_auth_code'}\n";
-	$text_of_cart .= "AVS CODE:      $form_data{'x_avs_code'}\n";
-	$text_of_cart .= "TRANS ID:      $form_data{'x_trans_id'}\n\n";
-	
-	$text_of_cart .= "BILLING INFORMATION --------------\n\n";
-	$text_of_cart .= "NAME:          $form_data{'x_first_name'} $form_data{'x_last_name'}\n";
-	$text_of_cart .= "COMPANY:       $form_data{'x_company'}\n";
-	$text_of_cart .= "ADDRESS:       $form_data{'x_address'}\n";
-	$text_of_cart .= "CITY:          $form_data{'x_city'}\n";
-	$text_of_cart .= "STATE:         $form_data{'x_state'}\n";
-	$text_of_cart .= "ZIP:           $form_data{'x_zip'}\n";
-	$text_of_cart .= "COUNTRY:       $form_data{'x_country'}\n";
-	$text_of_cart .= "PHONE:         $form_data{'x_phone'}\n";
-	$text_of_cart .= "FAX:           $form_data{'x_fax'}\n";
-	$text_of_cart .= "EMAIL:         $form_data{'x_email'}\n\n";
-	$text_of_cart .= "SHIPPING INFORMATION --------------\n\n";
-	$text_of_cart .= "SHIP VIA:      $form_data{'Ecom_ShipTo_Method'}\n";
-	$text_of_cart .= "NAME:          $form_data{'x_ship_to_first_name'} $form_data{'x_ship_to_last_name'}\n";
-	$text_of_cart .= "COMPANY:       $form_data{'x_ship_to_company'}\n";
-	$text_of_cart .= "ADDRESS:       $form_data{'x_ship_to_address'}\n";
-	$text_of_cart .= "CITY:          $form_data{'x_ship_to_city'}\n";
-	$text_of_cart .= "STATE:         $form_data{'x_ship_to_state'}\n";
-	$text_of_cart .= "ZIP:           $form_data{'x_ship_to_zip'}\n";
-	$text_of_cart .= "COUNTRY:       $form_data{'x_ship_to_country'}\n\n";
+  $text_of_cart .= "ZIP:           $form_data{'x_zip'}\n";
+  $orderLoggingHash{'orderFromPostal'} = "$form_data{'x_zip'}";
 
+  $text_of_cart .= "COUNTRY:       $form_data{'x_country'}\n";
+  $orderLoggingHash{'orderFromCountry'} = "$form_data{'x_country'}";
+
+  $text_of_cart .= "PHONE:         $form_data{'x_phone'}\n";
+  $orderLoggingHash{'customerPhone'} = "$form_data{'x_phone'}";
+
+  $text_of_cart .= "FAX:           $form_data{'x_fax'}\n";
+  $orderLoggingHash{'faxNumber'} = "$form_data{'x_fax'}";
+
+  $text_of_cart .= "EMAIL:         $form_data{'x_email'}\n\n";
+  $orderLoggingHash{'emailAddress'} = "$form_data{'x_email'}";
+
+  $text_of_cart .= "SHIPPING INFORMATION --------------\n\n";
+
+  $text_of_cart .= "SHIP VIA:      $form_data{'Ecom_ShipTo_Method'}\n";
+  $orderLoggingHash{'shipToName'} = "$form_data{'Ecom_ShipTo_Method'}";
+
+
+if ($form_data{'x_ship_to_first_name'}) {
+  $text_of_cart .= "NAME:          $form_data{'x_ship_to_first_name'} $form_data{'x_ship_to_last_name'}\n";
+  $orderLoggingHash{'shipToName'} = "$form_data{'x_ship_to_first_name'} $form_data{'x_ship_to_last_name'}";
+} else {
+  $text_of_cart .= "NAME:          $form_data{'x_first_name'} $form_data{'x_last_name'}\n";
+  $orderLoggingHash{'shipToName'} = "$form_data{'x_first_name'} $form_data{'x_last_name'}";
+}
+
+if ($form_data{'x_ship_to_company'}) {
+  $text_of_cart .= "COMPANY:       $form_data{'x_ship_to_company'}\n";
+	# don't overwrite billto company
+	#$orderLoggingHash{'companyName'} = "$form_data{'x_ship_to_company'}"
+} else {
+  $text_of_cart .= "COMPANY:       $form_data{'x_company'}\n";
+}
+
+if ($form_data{'x_ship_to_address'}) {
+  $text_of_cart .= "ADDRESS:       $form_data{'x_ship_to_address'}\n";
+  $orderLoggingHash{'shipToAddress'} = "$form_data{'x_ship_to_address'}";
+} else {
+  $text_of_cart .= "ADDRESS:       $form_data{'x_address'}\n";
+  $orderLoggingHash{'shipToAddress'} = "$form_data{'x_address'}";
+}
+
+if ($form_data{'x_ship_to_city'}) {
+  $text_of_cart .= "CITY:          $form_data{'x_ship_to_city'}\n";
+  $orderLoggingHash{'shipToCity'} = "$form_data{'x_ship_to_city'}";
+} else {
+  $text_of_cart .= "CITY:          $form_data{'x_city'}\n";
+  $orderLoggingHash{'shipToCity'} = "$form_data{'x_city'}";
+}
+
+if ($form_data{'x_ship_to_state'}) {
+  $text_of_cart .= "STATE:         $form_data{'x_ship_to_state'}\n";
+  $orderLoggingHash{'shipToState'} = "$form_data{'x_ship_to_state'}";
+} else {
+  $text_of_cart .= "STATE:         $form_data{'x_state'}\n";
+  $orderLoggingHash{'shipToState'} = "$form_data{'x_sstate'}";
+}
+
+if ($form_data{'x_ship_to_zip'}) {
+  $text_of_cart .= "ZIP:           $form_data{'x_ship_to_zip'}\n";
+  $orderLoggingHash{'shipToPostal'} = "$form_data{'x_ship_to_zip'}";
+} else {
+  $text_of_cart .= "ZIP:           $form_data{'x_zip'}\n";
+  $orderLoggingHash{'shipToPostal'} = "$form_data{'x_zip'}";
+}
+
+if ($form_data{'x_ship_to_country'}) {
+  $text_of_cart .= "COUNTRY:       $form_data{'x_ship_to_country'}\n\n";
+  $orderLoggingHash{'shipToCountry'} = "$form_data{'x_ship_to_country'}";
+} else {
+  $text_of_cart .= "COUNTRY:       $form_data{'x_country'}\n\n";
+  $orderLoggingHash{'shipToCountry'} = "$form_data{'x_country'}";
+}
+
+# NEW CODEHOOK
+&codehook("process-order-pre-ship-instructions");
+ 
   if ($ship_instructions ne "") {
-	$text_of_cart .= "Shipping Instructions: \n$ship_instructions\n\n";
+  $text_of_cart .= "Shipping Instructions: \n$ship_instructions\n\n";
   }
 
+# NEW CODEHOOK
+&codehook("process-order-pre-xcomments");
+
 $text_of_cart .= $XCOMMENTS_ADMIN;
+$orderLoggingHash{'xcomments'} = "$XCOMMENTS";
+$orderLoggingHash{'xcomments'} =~ s/\n/<br>/g;
+$orderLoggingHash{'adminMessages'} =~ s/\t/ /g;
 $text_of_confirm_email .= $XCOMMENTS;
+$orderLoggingHash{'adminMessages'} .= "$XCOMMENTS_ADMIN";
+$orderLoggingHash{'adminMessages'} =~ s/\n/<br>/g;
+$orderLoggingHash{'adminMessages'} =~ s/\t/ /g;
 
 # 'Init' the emails ...
 $text_of_cart = &init_shop_keep_email . $text_of_cart;
@@ -512,7 +771,7 @@
 
 if ($sc_send_order_to_email =~ /yes/i)
 {
-&send_mail($sc_admin_email, $sc_order_email, "Agora.cgi Order",$text_of_cart);
+&send_mail($sc_admin_email, $sc_order_email, "$x_description - $form_data{'x_invoice_num'}", $text_of_cart);
 }
 
 &log_order($text_of_cart,$form_data{'x_invoice_num'},$form_data{'x_cust_id'});
@@ -522,8 +781,15 @@
 &send_mail($sc_admin_email, $form_data{'x_email'}, $messages{'ordcnf_08'},
            "$text_of_confirm_email");
 }
+  
 $sc_affiliate_order_unique = $form_data{'x_invoice_num'};
 $sc_affiliate_order_total = $form_data{'x_amount'};
+
+$sc_affiliate_image_call =~ s/AMOUNT/$sc_affiliate_order_total/g;
+$sc_affiliate_image_call =~ s/UNIQUE/$sc_affiliate_order_unique/g;
+
+# NEW CODEHOOK
+&codehook("process-order-display-thankyou-page");
   
 print <<ENDOFTEXT;
 <CENTER>
@@ -548,7 +814,7 @@
 
 # and the footer is printed
 
-&StoreFooter;
+&SecureStoreFooter;
 
 print qq!
 </BODY>
diff -ruN 4.0K-4b/library/LinkpointConnect-mgr_lib.pl 5.0.000/library/LinkpointConnect-mgr_lib.pl
--- 4.0K-4b/library/LinkpointConnect-mgr_lib.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/library/LinkpointConnect-mgr_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,288 @@
+#
+# For the CC and Check Processing Gateway Linkpoint Connect, included
+# in the base package of agoracart, a GPL-ed program.
+#
+# Copyright 2000 to date K-Factor Technologies, Inc. 
+
+$versions{'LinkpointConnect-mgr_lib.pl'} = "5.0.000";
+&add_codehook("gateway_admin_screen","LinkpointConnect_mgr_check");
+&add_codehook("gateway_admin_settings","LinkpointConnect_settings");
+$mc_gateways .= "|LinkpointConnect";
+##############################################################################
+sub LinkpointConnect_settings {
+local($custom_logic);
+if ($sc_gateway_name eq "LinkpointConnect") {
+
+ open (GATEWAY, "> $gateway_settings") || 
+	&my_die("Can't Open $gateway_settings");
+ print (GATEWAY  "\$sc_gateway_username = \'$in{'sc_gateway_username'}\';\n");
+ print (GATEWAY  "\$sc_gateway_storename = \'$in{'sc_gateway_storename'}\';\n");
+ print (GATEWAY  "\$sc_order_script_url = \"$in{'order_url'}\";\n");
+ print (GATEWAY  "\$sc_linkpoint_auth_only = \"$in{'sc_linkpoint_auth_only'}\";\n");
+ print (GATEWAY  "\$sc_linkpoint_submit = '$in{'sc_linkpoint_submit'}';\n");
+ print (GATEWAY  "\$sc_linkpoint_change = '$in{'sc_linkpoint_change'}';\n");
+ print (GATEWAY  "\$sc_linkpoint_verify_message = \"" . 
+       &my_escape($in{'sc_linkpoint_verify_message'}) . "\";\n");
+ print (GATEWAY  "\$sc_linkpoint_order_desc = \"" . 
+       &my_escape($in{'sc_linkpoint_order_desc'}) . "\";\n");
+  print (GATEWAY  "\$sc_display_checkout_tos = \"$in{'sc_display_checkout_tos'}\";\n");
+$sc_tos_display_address_temp = &my_escape($in{'sc_tos_display_address'});
+  print (GATEWAY  "\$sc_tos_display_address = qq'$sc_tos_display_address_temp';\n");
+ print (GATEWAY  "\$sc_linkpoint_top_message = \"" . 
+       &my_escape($in{'sc_linkpoint_top_message'}) . "\";\n");
+ print (GATEWAY  "\$order_ok_final_msg_tbl = \"" . 
+       &my_escape($in{'order_ok_final_msg_tbl'}) . "\";\n");
+
+ print (GATEWAY  "#\n1\;\n");
+ close(GATEWAY);
+ }
+}
+##############################################################################
+sub LinkpointConnect_mgr_check {
+if ($sc_gateway_name eq "LinkpointConnect") {
+  &print_LinkpointConnect_mgr_form;
+  &call_exit;
+ }
+}
+##############################################################################
+sub print_LinkpointConnect_mgr_form {
+	
+#
+# Linkpoint Connect Gateway
+#
+
+print &$manager_page_header("Linkpoint Gateway","","","","");
+
+if ($sc_linkpoint_auth_only eq '') { # default value needed
+     $sc_linkpoint_auth_only = "no";
+}
+
+print <<ENDOFTEXT;
+<CENTER>
+<TABLE WIDTH=580 CELLPADDING=0 CELLSPACING=0 BORDER=0>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD WIDTH=580>
+<FONT FACE=ARIAL>
+Linkpoint Connect Settings
+$msg<br><br>
+For more information on how to setup Linkpoint Connect, such as testing orders or logging into your linkpoint control panel, refer to the online manual at:<br><a href="http://www.agoracart.com/agorawiki/index.php?title=LinkPoint_Connect_-_the_basics">http://www.agoracart.com/agorawiki/index.php?title=LinkPoint_Connect_-_the_basics</a>
+</FONT>
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+
+ENDOFTEXT
+
+if($in{'system_edit_success'} ne "")
+{
+print <<ENDOFTEXT;
+<CENTER>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL SIZE=2 COLOR=RED>Gateway settings have been successfully
+updated</FONT>
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+ENDOFTEXT
+}
+
+print <<ENDOFTEXT;
+
+<FONT FACE=ARIAL SIZE=2>
+<FORM METHOD="POST" ACTION="manager.cgi">
+<CENTER>
+<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=580 BORDER=0>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD WIDTH="55%">
+User ID as registered with Linkpoint Connect.
+</TD>
+<TD WIDTH="45%">
+<INPUT NAME="sc_gateway_username" TYPE="TEXT" SIZE=30
+VALUE='$sc_gateway_username'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD WIDTH="55%">
+Store ID as registered with Linkpoint Connect.
+</TD>
+<TD WIDTH="45%">
+<INPUT NAME="sc_gateway_storename" TYPE="TEXT" SIZE=30
+VALUE='$sc_gateway_storename'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+URL to the Linkpoint Connect server
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+<INPUT NAME="order_url" TYPE="TEXT" SIZE=70
+VALUE="$sc_order_script_url"><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+Send transactions as Pre-Authorize only?<br><small>set to no, unless you wish to manually approve each order at Linkpoint<small>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+<SELECT NAME="sc_linkpoint_auth_only">
+<OPTION>$sc_linkpoint_auth_only</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+URL of 'Submit' button:
+<br>
+<INPUT NAME="sc_linkpoint_submit" TYPE="TEXT" SIZE=60 
+VALUE='$sc_linkpoint_submit'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+URL of 'Make Changes' button:
+<br>
+<INPUT NAME="sc_linkpoint_change" TYPE="TEXT" SIZE=60 
+VALUE='$sc_linkpoint_change'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+Order Description:
+<br>
+<INPUT NAME="sc_linkpoint_order_desc" TYPE="TEXT" SIZE=60 
+VALUE='$sc_linkpoint_order_desc'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+Message at the top of the Verify Order table:
+<br>
+<TEXTAREA NAME="sc_linkpoint_verify_message"
+ROWS=4 COLS=65 wrap=soft>$sc_linkpoint_verify_message</TEXTAREA>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><br><HR><br></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><TABLE WIDTH="100%"><TR>
+<TD>Display Terms of Service and Refund Policy checkbox and set as required?</TD>
+<TD>
+<SELECT NAME="sc_display_checkout_tos">
+<OPTION>$sc_display_checkout_tos</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT>
+</TD>
+</TR></TABLE></TD>
+</TR>
+<TR><TD COLSPAN=2><br>
+Business address and phone number (contact information) for your business.  Should be legal address for the business location for full disclosure and other privacy requirements mandated by credit card companies as well as government enitities that require such notices:<br>
+<TEXTAREA NAME="sc_tos_display_address" 
+cols="68" rows=5 
+wrap=off>$sc_tos_display_address</TEXTAREA><br>
+
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR><TD COLSPAN=2>
+Top message for Order form.  Allows you to place a message above the Payment Information area and just below the cart total boxes.  HTML formatting (for text color, font, spacing, etc) is accepted.  Leave blank if not needed:<br>
+<TEXTAREA NAME="sc_linkpoint_top_message" 
+cols="68" rows=8 
+wrap=off>$sc_linkpoint_top_message</TEXTAREA> <br><br>
+</TD>
+</TR>
+
+<TR><TD COLSPAN=2>
+Top message for confirmation page, the page just before going to the gateway.  This allows you to place a message above the Payment Information area and just below the cart total boxes.  HTML formatting (for text color, font, spacing, etc) is accepted.  Note: By default one exists, message 10 in the agora.setup.db file. Leave blank if not needed:<br>
+<TEXTAREA NAME="order_ok_final_msg_tbl" 
+cols="68" rows=8 
+wrap=off>$order_ok_final_msg_tbl</TEXTAREA> <br><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+<CENTER>
+<INPUT TYPE="HIDDEN" NAME="system_edit_success" VALUE="yes">
+<INPUT TYPE="HIDDEN" NAME="gateway" VALUE="LinkpointConnect">
+<INPUT NAME="GatewaySettings" TYPE="SUBMIT" VALUE="Submit">
+&nbsp;&nbsp;
+<INPUT TYPE="RESET" VALUE="Reset">
+</CENTER>
+</TD>
+</TR>
+
+</TABLE>
+
+</CENTER>
+</FORM>
+ENDOFTEXT
+print &$manager_page_footer;
+	
+}
+##############################################################################
+1; #Library
diff -ruN 4.0K-4b/library/LinkpointConnect-order_lib.pl 5.0.000/library/LinkpointConnect-order_lib.pl
--- 4.0K-4b/library/LinkpointConnect-order_lib.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/library/LinkpointConnect-order_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,663 @@
+##############################################################################
+#                       Order Form Definition Variables                      #
+##############################################################################
+$versions{'LinkpointConnect-order_lib.pl'} = "5.0.000";
+$sc_use_secure_header_at_checkout = 'yes';
+$sc_use_secure_footer_for_order_form = 'yes';
+$sc_LinkpointConnect_form_prep = 0;
+&add_codehook("printSubmitPage","print_LinkpointConnect_SubmitPage");
+&add_codehook("set_form_required_fields","LinkpointConnect_fields");
+$sc_order_response_vars{"LinkpointConnect"}="oid";
+&add_codehook("gateway_response","check_for_LinkpointConnect_response");
+###############################################################################
+sub LinkpointConnect_check_and_load {
+local($myname)="LinkpointConnect";
+if ($myname ne $sc_gateway_name) { # we are a secondary gateway, load settings
+  &require_supporting_libraries(__FILE__,__LINE__,
+     "./admin_files/$myname-user_lib.pl");
+ }
+
+}
+###############################################################################
+sub check_for_LinkpointConnect_response {
+  if ($form_data{'oid'}) {
+    ($cart_id,$lp_inv) = split(/\|/,$form_data{'oid'},2);
+    &set_sc_cart_path;
+    &load_order_lib;
+    &codehook("LinkpointConnect_order");
+    &process_LinkpointConnect_order;
+    &call_exit;
+   }
+ }
+###############################################################################
+sub LinkpointConnect_order_form_prep { # load the customer info ...
+  &LinkpointConnect_check_and_load;
+  if ($sc_LinkpointConnect_form_prep == 0) {
+    if (-f "$sc_verify_order_path"){
+      &read_verify_file;  
+     } else {
+      &codehook("load_customer_info");
+     }
+    $sc_LinkpointConnect_form_prep = 1;
+   }
+  return "";
+ }
+
+###############################################################################
+sub LinkpointConnect_fields{
+local($myname)="LinkpointConnect";
+
+if (!($form_data{'gateway'} eq $myname)) { return;} 
+
+%sc_order_form_array =(
+	'Ecom_ShipTo_Postal_Name', 'Billing/Shipping Name',
+	'Ecom_BillTo_Postal_Name_First', 'First Name',
+	'Ecom_BillTo_Postal_Name_Last', 'Last Name',
+	'Ecom_BillTo_Postal_Street_Line1', 'Billing Address Street',
+	'Ecom_BillTo_Postal_City', 'Billing Address City',
+	'Ecom_BillTo_Postal_StateProv', 'Billing Address State',
+	'Ecom_BillTo_PostalCode', 'Billing Address Zip',
+	'Ecom_BillTo_Postal_CountryCode', 'Billing Address Country',
+	'Ecom_ShipTo_Postal_Street_Line1', 'Shipping Address Street',
+	'Ecom_ShipTo_Postal_City', 'Shipping Address City',
+	'Ecom_ShipTo_Postal_StateProv', 'Shipping Address State',
+	'Ecom_ShipTo_Postal_PostalCode', 'Shipping Address Zip',
+	'Ecom_ShipTo_Postal_CountryCode', 'Shipping Address Country',
+	'Ecom_BillTo_Telecom_Phone_Number', 'Phone Number',
+	'Ecom_BillTo_Online_Email', 'Email',
+	'Ecom_Payment_Card_Type', 'Type of Card',
+	'Ecom_Payment_Card_Number', 'Card Number',
+	'Ecom_Payment_Card_ExpDate_Month', 'Card Expiration Month',
+	'Ecom_Payment_Card_ExpDate_Day', 'Card Expiration Day',
+	'Ecom_Payment_Card_ExpDate_Year', 'Card Expiration Year',
+  'Ecom_is_Residential', 'Shipping to Residential Address',
+  'Ecom_ShipTo_Insurance', 'Insure this Shipment', # not implemented yet, for the future
+  'Ecom_tos', 'Sales-Terms of Service');
+
+@sc_order_form_required_fields = (
+	'Ecom_BillTo_Online_Email',
+	'Ecom_ShipTo_Postal_Name',
+	'Ecom_ShipTo_Postal_Street_Line1', 
+	'Ecom_ShipTo_Postal_City', 
+	"Ecom_ShipTo_Postal_StateProv",
+	"Ecom_ShipTo_Postal_PostalCode");
+
+# propagated from offline gateway 2006-4-5
+ if ($sc_display_checkout_tos =~ /yes/i) {
+    push(@sc_order_form_required_fields,"Ecom_tos");
+ }
+
+}
+
+###############################################################################
+sub LinkpointConnect_verification_table {
+  local ($rslt)="";
+  $rslt = "<table border=0 width=100%>\n<tr>\n";
+  $rslt.= "<td width=\"50%\" align=right>Shipping Method:</td>\n";
+  $rslt.= '<td width = "50%" align=left>' .
+	$form_data{'Ecom_ShipTo_Method'} . "&nbsp;</td>\n";
+  $rslt.= "</tr>\n";
+  $rslt.= "<td width=\"50%\" align=right>Email:</td>\n";
+  $rslt.= '<td width = "50%" align=left>' .
+	$form_data{'Ecom_BillTo_Online_Email'} . "&nbsp;</td>\n";
+  $rslt.= "</tr>\n";
+  $rslt.= "<td width=\"50%\" align=right>Name:</td>\n";
+  $rslt.= '<td width = "50%" align=left>' .
+	$form_data{'Ecom_ShipTo_Postal_Name'} . "&nbsp;</td>\n";
+  $rslt.= "</tr>\n";
+  $rslt.= "<tr>\n";
+  $rslt.= "<td width=\"50%\" align=right>Street:</td>\n";
+  $rslt.= '<td width = "50%" align=left>' .
+	$form_data{'Ecom_ShipTo_Postal_Street_Line1'} . "&nbsp;</td>\n";
+  $rslt.= "</tr>\n";
+  $rslt.= "<tr>\n";
+  $rslt.= "<td width=\"50%\" align=right>City:</td>\n";
+  $rslt.= '<td width = "50%" align=left>' .
+	$form_data{'Ecom_ShipTo_Postal_City'} . "&nbsp;</td>\n";
+  $rslt.= "</tr>\n";
+  $rslt.= "<tr>\n";
+  $rslt.= "<td width=\"50%\" align=right>State:</td>\n";
+  $rslt.= '<td width = "50%" align=left>' .
+	$form_data{'Ecom_ShipTo_Postal_StateProv'} . "&nbsp;</td>\n";
+  $rslt.= "</tr>\n";
+  $rslt.= "<tr>\n";
+  $rslt.= "<td width=\"50%\" align=right>Zip:</td>\n";
+  $rslt.= '<td width = "50%" align=left>' .
+	$form_data{'Ecom_ShipTo_Postal_PostalCode'} . "&nbsp;</td>\n";
+  $rslt.= "</tr>\n";
+  $rslt.= "<tr>\n";
+  $rslt.= "<td width=\"50%\" align=right>Country:</td>\n";
+  $rslt.= '<td width = "50%" align=left>' .
+	$form_data{'Ecom_ShipTo_Postal_CountryCode'} . "&nbsp;</td>\n";
+  $rslt.= "</tr>\n";
+  $rslt.= "</table>\n";
+  return $rslt;
+ }
+###############################################################################
+
+sub print_LinkpointConnect_SubmitPage
+
+{
+local($invoice_number, $customer_number);
+local($myname)="LinkpointConnect";
+local($my_change,$my_submit,$my_message,$my_desc);
+
+if (!($form_data{'gateway'} eq $myname)) { return;} 
+if ($myname ne $sc_gateway_name) { # secondary gateway, load settings
+  &require_supporting_libraries(__FILE__,__LINE__,
+	"./admin_files/$myname-user_lib.pl");
+ }
+
+$invoice_number = $current_verify_inv_no;
+$customer_number = $cart_id;
+$customer_number =~ s/_/./g;
+$my_submit=&script_and_substitute($sc_linkpoint_submit);
+$my_change=&script_and_substitute($sc_linkpoint_change);
+$my_message=&script_and_substitute($sc_linkpoint_verify_message);
+$my_desc=&script_and_substitute($sc_linkpoint_order_desc);
+
+$my_oid = $cart_id . "|" . $invoice_number;
+$mytable = &LinkpointConnect_verification_table;
+&read_verify_file;
+
+if ($order_ok_final_msg_tbl eq '') {
+ # Default so something is there, use $messages{'ordcnf_10'} though 
+ # to customize, set it in the Free Form Logic (either location.)
+  $order_ok_final_msg_tbl = "<b>Order Confirmation</b><br/><br/>" . &get_date;
+ }
+
+my $temp_total_thingy = ($zsubtotal - $zfinal_discount);
+
+print <<ENDOFTEXT;
+<FORM METHOD=POST ACTION="$sc_order_script_url">
+<INPUT TYPE=HIDDEN NAME='mode' value="payplus">
+<INPUT TYPE=HIDDEN NAME='txnorg' value="eci">
+ENDOFTEXT
+
+if ($sc_linkpoint_auth_only =~ /yes/i) {
+print <<ENDOFTEXT;
+<INPUT TYPE=HIDDEN NAME='txntype' value="preauth">
+ENDOFTEXT
+} else {
+print <<ENDOFTEXT;
+<INPUT TYPE=HIDDEN NAME='txntype' value="sale">
+ENDOFTEXT
+}
+
+print <<ENDOFTEXT;
+<INPUT TYPE=HIDDEN NAME='tax' value="$zfinal_sales_tax">
+<INPUT TYPE=HIDDEN NAME='shipping' VALUE="$zfinal_shipping">
+<INPUT TYPE=HIDDEN NAME='subtotal' VALUE="$temp_total_thingy">
+<INPUT TYPE=HIDDEN NAME='chargetotal' VALUE="$authPrice">
+<INPUT TYPE=HIDDEN NAME='username' VALUE="$sc_gateway_username">
+<INPUT TYPE=HIDDEN NAME='storename' VALUE="$sc_gateway_storename">
+<INPUT TYPE=HIDDEN NAME='oid' VALUE="$my_oid">
+<INPUT TYPE=HIDDEN NAME='email' VALUE="$eform_Ecom_BillTo_Online_Email">
+<INPUT TYPE=HIDDEN NAME='bname' VALUE="$eform_Ecom_ShipTo_Postal_Name">
+<INPUT TYPE=HIDDEN NAME='baddr1' VALUE="$eform_Ecom_ShipTo_Postal_Street_Line1"> 
+<INPUT TYPE=HIDDEN NAME='bcity' VALUE="$eform_Ecom_ShipTo_Postal_City"> 
+<INPUT TYPE=HIDDEN NAME='bstate' VALUE="$eform_Ecom_ShipTo_Postal_StateProv">
+<INPUT TYPE=HIDDEN NAME='bzip' VALUE="$eform_Ecom_ShipTo_Postal_PostalCode">
+
+<div align="center">
+  <p class="ac_checkout_top_msg">$order_ok_final_msg_tbl</p>
+  <p class="ac_checkout_top_msg">$my_message</p>
+
+
+<table cellpadding="0" cellspacing="0" class="ac_checkout_review">
+<tr>
+<th colspan="2" class="ac_checkout_review">Customer Information</th>
+</tr>
+ENDOFTEXT
+
+if ($form_data{'Ecom_ShipTo_Method'} ne ""){
+print <<ENDOFTEXT;
+  <tr>
+    <td class="ac_checkout_review_col1">Ship via:</td>
+    <td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Method'}</td>
+  </tr>
+ENDOFTEXT
+}
+ 
+print <<ENDOFTEXT;
+  <tr>
+    <td class="ac_checkout_review_col1">State </td>
+    <td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_StateProv'}
+    &nbsp;</td>
+  </tr>
+  <tr>
+    <td class="ac_checkout_review_col1">Postal Code </td>
+    <td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_PostalCode'}
+    &nbsp; </td>
+  </tr>
+  <tr>
+    <td class="ac_checkout_review_col1">Country</td>
+    <td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_CountryCode'}</td>
+  </tr>
+</TABLE>
+ 
+<TABLE WIDTH="500" BGCOLOR="#FFFFFF" CELLPADDING="2" CELLSPACING="0" BORDER=0>
+<TR>
+<TD COLSPAN=2>
+<CENTER>
+<INPUT TYPE="IMAGE" NAME="Submit" VALUE="Submit Order For Processing"
+SRC="$my_submit" border=0>
+&nbsp;&nbsp;&nbsp;&nbsp;
+<a href="agora.cgi?order_form_button.x=1&cart_id=${cart_id}">
+<IMG SRC="$my_change" BORDER=0></a>
+</FORM>
+</CENTER>
+</TD>
+</TR>
+</table>
+</FONT>
+</CENTER>
+
+ENDOFTEXT
+
+}
+###############################################################################
+
+sub process_LinkpointConnect_order {
+
+local($subtotal, $total_quantity,
+      $total_measured_quantity,
+      $text_of_cart,
+      $required_fields_filled_in, $product, $quantity, $options);
+local($stevo_shipping_thing) = "";
+local($stevo_shipping_names) = "";
+local($ship_thing_too,$ship_instructions);
+local(%orderLoggingHash);
+
+&load_verify_file;
+
+$orderDate = &get_date;
+
+# NEW CODEHOOK
+&codehook("process-order-routine-top");
+
+print qq!
+<Connect>
+$sc_special_page_meta_tags
+<HEAD>
+<TITLE>$messages{'ordcnf_08'}</TITLE>
+<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+$sc_secure_standard_head_info</HEAD>
+<BODY $sc_standard_body_info>
+!;
+
+&SecureStoreHeader;
+
+$text_of_cart .= "Order Date:    $orderDate\n";
+$text_of_cart .= "Gateway:       LinkpointConnect\n\n";
+$orderLoggingHash{'GatewayUsed'} = "LinkpointConnect";
+
+$text_of_cart .= "  --PRODUCT INFORMATION--\n\n";
+
+open (CART, "$sc_cart_path") ||
+&file_open_error("$sc_cart_path", "display_cart_contents", __FILE__, __LINE__);
+
+while (<CART>) {
+  $cartData++;
+  @cart_fields = split (/\|/, $_);
+  $quantity = $cart_fields[0];
+  $product_price = $cart_fields[3];
+  $product = $cart_fields[4];
+  $weight = $cart_fields[6];
+  $options = $cart_fields[$cart{"options"}];
+  $options =~ s/<br>//g;
+  $text_of_cart .= &cart_textinfo(*cart_fields);
+  $stevo_shipping_thing .= "|quantity\*$weight";
+  $stevo_shipping_names .= "|$product\($options\)";
+  &codehook("process-cart-item");
+ }
+close(CART);
+
+# initialize hash variables in case they are empty later
+# added by Mister Ed October 2005
+
+$orderLoggingHash{'firstName'} = "";
+$orderLoggingHash{'lastName'} = "";
+$orderLoggingHash{'fullName'} = "";
+$orderLoggingHash{'orderFromAddress'} = "";
+$orderLoggingHash{'customerAddress2'} = "";
+$orderLoggingHash{'customerAddress3'} = "";
+$orderLoggingHash{'orderFromCity'} = "";
+$orderLoggingHash{'orderFromPostal'} = "";
+$orderLoggingHash{'customerPhone'} = "";
+$orderLoggingHash{'companyName'} = "";
+$orderLoggingHash{'emailAddress'} = "";
+
+$orderLoggingHash{'shipToName'} = "";
+$orderLoggingHash{'shipToAddress'} = "";
+$orderLoggingHash{'shipToAddress2'} = "";
+$orderLoggingHash{'shipToAddress3'} = "";
+$orderLoggingHash{'shipToCity'} = "";
+$orderLoggingHash{'shipToState'} = "";
+$orderLoggingHash{'shipToPostal'} = "";
+$orderLoggingHash{'shipToCountry'} = "";
+$orderLoggingHash{'shiptoResidential'} = $vform_Ecom_is_Residential;
+$orderLoggingHash{'insureShipment'} = $vform_Ecom_ShipTo_Insurance; # not implemented yet, for the future
+
+$orderLoggingHash{'invoiceNumber'} = "";
+$orderLoggingHash{'customerNumber'} = "";
+$orderLoggingHash{'orderStatus'} = "$sc_order_status_default";
+$orderLoggingHash{'user1'} = "";
+$orderLoggingHash{'user2'} = "";
+$orderLoggingHash{'user3'} = "";
+$orderLoggingHash{'user4'} = "";
+$orderLoggingHash{'user5'} = "";
+$orderLoggingHash{'itemsordered'} = "";
+$orderLoggingHash{'shiptrackingID'} = "";
+$orderLoggingHash{'shipMethod'} = "";
+$orderLoggingHash{'orderFromState'} = "";
+$orderLoggingHash{'orderFromCountry'} = "";
+$orderLoggingHash{'shippingTotal'} = "";
+$orderLoggingHash{'salesTax'} = "";
+$orderLoggingHash{'tax1'} = "";
+$orderLoggingHash{'tax2'} = "";
+$orderLoggingHash{'tax3'} = "";
+$orderLoggingHash{'discounts'} = "";
+$orderLoggingHash{'netProfit'} = "";
+$orderLoggingHash{'affiliateTotal'} = "";
+$orderLoggingHash{'affiliateID'} = "";
+$orderLoggingHash{'affiliateMisc'} = "";
+$orderLoggingHash{'subTotal'} = "";
+$orderLoggingHash{'orderTotal'} = "";
+$orderLoggingHash{'adminMessages'} = "";
+$orderLoggingHash{'shippingMessages'} = "";
+$orderLoggingHash{'xcomments'} = "";
+$orderLoggingHash{'termsOfService'} = "$vform_Ecom_tos";
+
+
+
+$sc_orderlib_use_SBW_for_ship_ins = $sc_use_SBW;
+&codehook("orderlib-ship-instructions");
+if ($sc_orderlib_use_SBW_for_ship_ins =~ /yes/i) {
+  ($ship_thing_too,$ship_instructions) = 
+   &ship_put_in_boxes($stevo_shipping_thing,$stevo_shipping_names,
+   $sc_verify_Origin_ZIP,$sc_verify_boxes_max_wt); 
+ }
+$orderLoggingHash{'shippingMessages'} = "$ship_instructions";
+$orderLoggingHash{'shippingMessages'} =~ s/\n/<br>/g;
+
+$text_of_confirm_email .= $messages{'ordcnf_07'};
+
+$text_of_confirm_email .= $text_of_cart;
+$text_of_confirm_email .= "\n";
+$text_of_cart .= "  --ORDER INFORMATION--\n\n";
+
+&add_text_of_both("Order ID",$form_data{'oid'});
+&add_text_of_cart("STATUS",$form_data{'status'});
+&add_text_of_cart("APPROVAL CODE",$form_data{'approval_code'});
+&add_text_of_cart("Charge Total",$form_data{'chargetotal'});
+&add_text_of_cart("CC Type",$form_data{"cctype"});
+&add_text_of_cart("Card #",$form_data{"cardnumber"});
+&add_text_of_cart("Exp Month",$form_data{"expmonth"});
+&add_text_of_cart("Exp Year",$form_data{"expyear"});
+$text_of_cart .= "\n";
+
+$orderLoggingHash{'customerNumber'} = "$cart_id";
+$orderLoggingHash{'invoiceNumber'} = "$lp_inv";
+$orderLoggingHash{'subTotal'} = &format_price($sc_verify_subtotal);
+
+&add_text_of_both("SUBTOTAL",$sc_verify_subtotal);
+$sc_verify_subtotal3 = $sc_verify_subtotal;
+
+if ($sc_verify_discount) {
+  $temp = &format_price($sc_verify_discount);
+  &add_text_of_both("DISCOUNT",$temp);
+  $orderLoggingHash{'discounts'} = &format_price($sc_verify_discount);
+  # start of adjustments for discount addon
+  $text_of_cart .= "DISCOUNT CODE: $eform_Ecom_Discount\n";
+  $text_of_confirm_email .= "DISCOUNT CODE: $eform_Ecom_Discount\n";
+  # end of adjustments for discount addon
+}
+
+if ($sc_verify_shipping){
+  &add_text_of_both("SHIPPING",$sc_verify_shipping);
+$orderLoggingHash{'shippingTotal'} = &format_price($sc_verify_shipping);
+ }
+
+$orderLoggingHash{'shipMethod'} = "$eform_Ecom_ShipTo_Method";
+
+if (($sc_use_SBW =~ /yes/i) || ($form_data{'x_Freight'} > .009)) {
+          $text_of_confirm_email .= "SHIP VIA:      $eform_Ecom_ShipTo_Method\n";
+  }
+
+if ($sc_verify_tax > 0)
+{
+$temp = substr(substr("SALES TAX",0,13).":               ",0,15);
+$text_of_cart .= "$temp$sc_verify_tax\n";
+$text_of_confirm_email .= "$temp$sc_verify_tax\n";
+$orderLoggingHash{'salesTax'} = "$sc_verify_tax";
+}
+if ($sc_verify_etax1 > 0)
+{
+$temp = substr(substr($sc_extra_tax1_name,0,13).":               ",0,15);
+$text_of_cart .= "$temp$sc_verify_etax1\n";
+$text_of_confirm_email .= "$temp$sc_verify_etax1\n";
+$orderLoggingHash{'tax1'} = "$sc_verify_etax1";
+}
+if ($sc_verify_etax2 > 0)
+{
+$temp = substr(substr($sc_extra_tax2_name,0,13).":               ",0,15);
+$text_of_cart .= "$temp$sc_verify_etax2\n";
+$text_of_confirm_email .= "$temp$sc_verify_etax2\n";
+$orderLoggingHash{'tax2'} = "$sc_verify_etax2";
+}
+if ($sc_verify_etax3 > 0)
+{
+$temp = substr(substr($sc_extra_tax3_name,0,13).":               ",0,15);
+$text_of_cart .= "$temp$sc_verify_etax3\n";
+$text_of_confirm_email .= "$temp$sc_verify_etax3\n";
+$orderLoggingHash{'tax3'} = "$sc_verify_etax3";
+}
+
+if ($form_data{'tax'}){
+  &add_text_of_both("TOTAL TAXES",$form_data{'tax'});
+  $orderLoggingHash{'salesTax'} = "$form_data{'tax'}";
+ }
+
+
+$text_of_cart .= "GRAND TOTAL:         $form_data{'chargetotal'}\n\n";
+$text_of_confirm_email .= "GRAND TOTAL:         $form_data{'chargetotal'}\n\n";
+$orderLoggingHash{'orderTotal'} = "$form_data{'chargetotal'}";
+
+$text_of_cart .= "BILLING INFORMATION --------------\n\n";
+
+$text_of_cart .= "NAME:          $form_data{'bname'}\n";
+$orderLoggingHash{'fullName'} = "$form_data{'bname'}";
+
+if ($form_data{'baddr1'} ne "") {
+  $text_of_cart .= "ADDRESS1:      $form_data{'baddr1'}\n";
+  $orderLoggingHash{'orderFromAddress'} = "$form_data{'baddr1'}";
+}
+
+if ($form_data{'baddr2'} ne "") {
+  $text_of_cart .= "ADDRESS2:      $form_data{'baddr2'}\n";
+  $orderLoggingHash{'customerAddress2'} = "$form_data{'baddr2'}";
+}
+
+$text_of_cart .= "CITY:          $form_data{'bcity'}\n";
+$orderLoggingHash{'orderFromCity'} = "$form_data{'bcity'}";
+
+$text_of_cart .= "STATE:         $form_data{'bstate'}\n";
+$orderLoggingHash{'orderFromState'} = "$form_data{'bstate'}";
+
+$text_of_cart .= "ZIP:           $form_data{'bzip'}\n";
+$orderLoggingHash{'orderFromPostal'} = "$form_data{'bzip'}";
+
+$text_of_cart .= "COUNTRY:       $form_data{'bcountry'}\n";
+$orderLoggingHash{'orderFromCountry'} = "$form_data{'bcountry'}";
+
+$text_of_cart .= "PHONE:         $form_data{'phone'}\n";
+$orderLoggingHash{'customerPhone'} = "$form_data{'bphone'}";
+
+$text_of_cart .= "FAX:           $form_data{'fax'}\n";
+
+$text_of_cart .= "EMAIL:         $form_data{'email'}\n\n";
+$orderLoggingHash{'emailAddress'} = "$form_data{'email'}";
+
+$text_of_cart .= "SHIPPING INFORMATION --------------\n\n";
+
+if ($eform_Ecom_ShipTo_Postal_Name ne "") {
+  $text_of_cart .= "NAME:          $eform_Ecom_ShipTo_Postal_Name\n";
+  $orderLoggingHash{'shipToName'} = "$eform_Ecom_ShipTo_Postal_Name";
+} else {
+  $text_of_cart .= "NAME:          $form_data{'sname'}\n";
+  $orderLoggingHash{'shipToName'} = "$form_data{'sname'}";
+}
+
+if ($eform_Ecom_ShipTo_Postal_Street_Line1 ne "") {
+  $text_of_cart .= "ADDRESS1:      $eform_Ecom_ShipTo_Postal_Street_Line1\n";
+  $orderLoggingHash{'shipToAddress'} = "$eform_Ecom_ShipTo_Postal_Street_Line1";
+} else {
+  $text_of_cart .= "ADDRESS1:      $form_data{'saddr1'}\n";
+  $orderLoggingHash{'shipToAddress'} = "$form_data{'saddr1'}";
+}
+
+if ($form_data{'saddr2'} ne "") {
+  $text_of_cart .= "ADDRESS2:      $form_data{'saddr2'}\n";
+  $orderLoggingHash{'shipToAddress2'} = "$form_data{'saddr2'}";
+} elsif ($form_data{'baddr2'} ne "") {
+  $text_of_cart .= "ADDRESS2:      $form_data{'baddr2'}\n";
+  $orderLoggingHash{'shipToAddress2'} = "$form_data{'baddr2'}";
+}
+
+if ($eform_Ecom_ShipTo_Postal_City ne "") {
+  $text_of_cart .= "CITY:          $eform_Ecom_ShipTo_Postal_City\n";
+  $orderLoggingHash{'shipToCity'} = "$eform_Ecom_ShipTo_Postal_City";
+} else {
+  $text_of_cart .= "CITY:          $form_data{'scity'}\n";
+  $orderLoggingHash{'shipToCity'} = "$form_data{'scity'}";
+}
+
+if ($eform_Ecom_ShipTo_Postal_StateProv ne "") {
+  $text_of_cart .= "STATE:         $eform_Ecom_ShipTo_Postal_StateProv\n";
+  $orderLoggingHash{'shipToState'} = "$eform_Ecom_ShipTo_Postal_StateProv";
+} else {
+  $text_of_cart .= "STATE:         $form_data{'sstate'}\n";
+  $orderLoggingHash{'shipToState'} = "$form_data{'sstate'}";
+}
+
+if ($sc_verify_shipping_zip ne "") {
+   $text_of_cart .= "ZIP:           $sc_verify_shipping_zip\n";
+  $orderLoggingHash{'shipToPostal'} = "$sc_verify_shipping_zip";
+} else {
+  $text_of_cart .= "ZIP:           $form_data{'szip'}\n";
+  $orderLoggingHash{'shipToPostal'} = "$form_data{'szip'}";
+}
+
+if ($vform_Ecom_ShipTo_Postal_CountryCode ne "") {
+  $text_of_cart .= "COUNTRY:       $vform_Ecom_ShipTo_Postal_CountryCode\n\n";
+  $orderLoggingHash{'shipToCountry'} = "$vform_Ecom_ShipTo_Postal_CountryCode";
+} else {
+  $text_of_cart .= "COUNTRY:       $form_data{'scountry'}\n\n";
+  $orderLoggingHash{'shipToCountry'} = "$form_data{'scountry'}";
+}
+
+ $orderLoggingHash{'shipMethod'} = $eform_Ecom_ShipTo_Method;
+
+# NEW CODEHOOK
+&codehook("process-order-pre-ship-instructions");
+
+if ($sc_use_SBW =~ /yes/i) {
+  &add_text_of_cart("SHIP VIA",$vform_Ecom_ShipTo_Method);
+ }
+
+if ($sc_verify_discount) {
+  &add_text_of_both("DISCOUNT",$sc_verify_discount);
+  $orderLoggingHash{'discounts'} = "$sc_verify_discount";
+ }
+ 
+if ($ship_instructions ne "") {
+  $text_of_cart .= "Shipping Instructions: \n$ship_instructions\n\n";
+ }
+
+# NEW CODEHOOK
+&codehook("process-order-pre-xcomments");
+
+$text_of_cart .= $XCOMMENTS;
+$orderLoggingHash{'xcomments'} = "$XCOMMENTS";
+$orderLoggingHash{'xcomments'} =~ s/\n/<br>/g;
+$orderLoggingHash{'adminMessages'} =~ s/\t/ /g;
+$text_of_admin_email .= $XCOMMENTS_ADMIN;
+$orderLoggingHash{'adminMessages'} .= "$XCOMMENTS_ADMIN";
+$orderLoggingHash{'adminMessages'} =~ s/\n/<br>/g;
+$orderLoggingHash{'adminMessages'} =~ s/\t/ /g;
+$text_of_confirm_email .= $XCOMMENTS;
+
+# 'Init' the emails ...
+$text_of_cart = &init_shop_keep_email . $text_of_cart;
+$text_of_confirm_email = &init_customer_email . $text_of_confirm_email;
+
+# and add the rest ...
+$text_of_admin_email .= &addto_shop_keep_email;
+$text_of_confirm_email .= &addto_customer_email;
+
+if ($sc_use_pgp =~ /yes/i)
+{
+&require_supporting_libraries(__FILE__, __LINE__, "$sc_pgp_lib_path");
+$text_of_cart = &make_pgp_file($text_of_cart, "$sc_pgp_temp_file_path/$$.pgp");
+$text_of_cart = "\n" . $text_of_cart . "\n";
+}
+
+if ($sc_send_order_to_email =~ /yes/i) {
+  &send_mail($sc_order_email, $sc_order_email, "AgoraCart - LinkpointConnect Order - $lp_inv",$text_of_cart);
+ }
+
+# NEW CODEHOOK
+&codehook("process-order-pre-logOrder");
+
+# write order log
+&log_order($text_of_cart,$lp_inv,$cart_id);
+
+if (($cartData) && ($form_data{'email'} ne "")){
+  &send_mail($sc_admin_email, $form_data{'email'}, $messages{'ordcnf_08'}, 
+           "$text_of_confirm_email");
+ }
+$sc_affiliate_order_unique = $form_data{'oid'};
+$sc_affiliate_order_total = $sc_verify_subtotal3 - $sc_verify_discount;
+
+$sc_affiliate_image_call =~ s/AMOUNT/$sc_affiliate_order_total/g;
+$sc_affiliate_image_call =~ s/UNIQUE/$sc_affiliate_order_unique/g;
+
+# NEW CODEHOOK
+&codehook("process-order-display-thankyou-page");
+
+print <<ENDOFTEXT;
+<CENTER>
+<TABLE WIDTH=500>
+<TR>
+<TD WIDTH=500>
+<BR>
+<FONT FACE=ARIAL>
+$messages{'ordcnf_01'}
+$messages{'ordcnf_02'}
+<br>
+$sc_affiliate_image_call
+</FONT>
+</TD>
+</TR>
+</TABLE>
+<CENTER>  
+
+ENDOFTEXT
+
+# This empties the cart after the order is successful
+&empty_cart;
+
+# and the footer is printed
+
+&SecureStoreFooter;
+
+print qq!
+</BODY>
+</Connect>
+!;
+
+} # End of process_LinkpointConnect_order
+
+#################################################################
+1; # Library
diff -ruN 4.0K-4b/library/LinkpointHTML-mgr_lib.pl 5.0.000/library/LinkpointHTML-mgr_lib.pl
--- 4.0K-4b/library/LinkpointHTML-mgr_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/LinkpointHTML-mgr_lib.pl	1969-12-31 18:00:00.000000000 -0600
@@ -1,145 +0,0 @@
-#
-# For the CC and Check Processing Gateway Linkpoint HTML, included
-# in the base package of agora.cgi, a GPL-ed program.
-#
-# Copyright 2000,2001 Steve Kneizys. 
-
-$versions{'LinkpointHTML-mgr_lib.pl'} = "20010630";
-&add_codehook("gateway_admin_screen","LinkpointHTML_mgr_check");
-&add_codehook("gateway_admin_settings","LinkpointHTML_settings");
-$mc_gateways .= "|LinkpointHTML";
-##############################################################################
-sub LinkpointHTML_settings {
-local($custom_logic);
-if ($sc_gateway_name eq "LinkpointHTML") {
-
- open (GATEWAY, "> $gateway_settings") || 
-	&my_die("Can't Open $gateway_settings");
- print (GATEWAY  "\$sc_gateway_username = \'$in{'sc_gateway_username'}\';\n");
- print (GATEWAY  "\$sc_order_script_url = \"$in{'order_url'}\";\n");
- print (GATEWAY  "#\n1\;# We are a Library\n");
- close(GATEWAY);
- }
-}
-##############################################################################
-sub LinkpointHTML_mgr_check {
-if ($sc_gateway_name eq "LinkpointHTML") {
-  &print_LinkpointHTML_mgr_form;
-  &call_exit;
- }
-}
-##############################################################################
-sub print_LinkpointHTML_mgr_form {
-	
-#
-# Linkpoint HTML Gateway
-#
-
-print &$manager_page_header("Linkpoint Gateway","","","","");
-
-print <<ENDOFTEXT;
-<CENTER>
-<TABLE WIDTH=580 CELLPADDING=0 CELLSPACING=0 BORDER=0>
-
-<TR>
-<TD COLSPAN=2><HR></TD>
-</TR>
-
-<TR>
-<TD WIDTH=580>
-<FONT FACE=ARIAL>
-Linkpoint HTML Settings
-$msg</FONT>
-</TD>
-</TR>
-</TABLE>
-</CENTER>
-
-ENDOFTEXT
-
-if($in{'system_edit_success'} ne "")
-{
-print <<ENDOFTEXT;
-<CENTER>
-<TABLE>
-<TR>
-<TD>
-<FONT FACE=ARIAL SIZE=2 COLOR=RED>Gateway settings have been successfully
-updated</FONT>
-</TD>
-</TR>
-</TABLE>
-</CENTER>
-ENDOFTEXT
-}
-
-print <<ENDOFTEXT;
-
-<FONT FACE=ARIAL SIZE=2>
-<FORM METHOD="POST" ACTION="manager.cgi">
-<CENTER>
-<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=580 BORDER=0>
-
-<TR>
-<TD COLSPAN=2><HR></TD>
-</TR>
-
-<TR>
-<TD WIDTH="55%">
-ID as registered with Linkpoint.
-</TD>
-<TD WIDTH="45%">
-<INPUT NAME="sc_gateway_username" TYPE="TEXT" SIZE=30
-VALUE='$sc_gateway_username'><br>
-</TD>
-</TR>
-
-<TR>
-<TD COLSPAN=2><HR></TD>
-</TR>
-
-<TR>
-<TD COLSPAN=2>
-URL to the Linkpoint HTML server
-</TD>
-</TR>
-
-<TR>
-<TD COLSPAN=2>
-<INPUT NAME="order_url" TYPE="TEXT" SIZE=70
-VALUE="$sc_order_script_url"><br>
-</TD>
-</TR>
-
-<TR>
-<TD COLSPAN=2><HR></TD>
-</TR>
-
-<TR>
-<TD COLSPAN=2>
-<CENTER>
-<INPUT TYPE="HIDDEN" NAME="system_edit_success" VALUE="yes">
-<INPUT TYPE="HIDDEN" NAME="gateway" VALUE="LinkpointHTML">
-<INPUT NAME="GatewaySettings" TYPE="SUBMIT" VALUE="Submit">
-&nbsp;&nbsp;
-<INPUT TYPE="RESET" VALUE="Reset">
-</CENTER>
-</TD>
-</TR>
-
-<TR>
-<TD COLSPAN=2>
-<HR>
-</TD>
-</TR>
-
-</TABLE>
-
-</CENTER>
-</FORM>
-ENDOFTEXT
-print &$manager_page_footer;
-	
-}
-##############################################################################
-1; #Library
diff -ruN 4.0K-4b/library/LinkpointHTML-order_lib.pl 5.0.000/library/LinkpointHTML-order_lib.pl
--- 4.0K-4b/library/LinkpointHTML-order_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/LinkpointHTML-order_lib.pl	1969-12-31 18:00:00.000000000 -0600
@@ -1,374 +0,0 @@
-##############################################################################
-#                       Order Form Definition Variables                      #
-##############################################################################
-$versions{'Linkpoint-order_lib.pl'} = "20020312";
-$sc_use_secure_header_at_checkout = 'yes';
-$sc_LinkpointHTML_form_prep = 0;
-&add_codehook("printSubmitPage","print_LinkpointHTML_SubmitPage");
-&add_codehook("set_form_required_fields","LinkpointHTML_fields");
-$sc_order_response_vars{"LinkpointHTML"}="oid";
-&add_codehook("gateway_response","check_for_LinkpointHTML_response");
-###############################################################################
-sub check_for_LinkpointHTML_response {
-  if ($form_data{'oid'}) {
-    ($cart_id,$lp_inv) = split(/\|/,$form_data{'oid'},2);
-    &set_sc_cart_path;
-    &load_order_lib;
-    &codehook("LinkpointHTML_order");
-    &process_LinkpointHTML_order;
-    &call_exit;
-   }
- }
-###############################################################################
-sub LinkpointHTML_order_form_prep{ # load the customer info ...
-  if ($sc_LinkpointHTML_form_prep == 0) {
-    if (-f "$sc_verify_order_path"){
-      &read_verify_file;  
-     } else {
-      &codehook("load_customer_info");
-     }
-    $sc_LinkpointHTML_form_prep = 1;
-   }
-  return "";
- }
-
-###############################################################################
-sub LinkpointHTML_fields{
-local($myname)="LinkpointHTML";
-
-if (!($form_data{'gateway'} eq $myname)) { return;} 
-
-%sc_order_form_array =(
-	'Ecom_ShipTo_Postal_Name', 'Billing/Shipping Name',
-	'Ecom_BillTo_Postal_Name_First', 'First Name',
-	'Ecom_BillTo_Postal_Name_Last', 'Last Name',
-	'Ecom_BillTo_Postal_Street_Line1', 'Billing Address Street',
-	'Ecom_BillTo_Postal_City', 'Billing Address City',
-	'Ecom_BillTo_Postal_StateProv', 'Billing Address State',
-	'Ecom_BillTo_PostalCode', 'Billing Address Zip',
-	'Ecom_BillTo_Postal_CountryCode', 'Billing Address Country',
-	'Ecom_ShipTo_Postal_Street_Line1', 'Shipping Address Street',
-	'Ecom_ShipTo_Postal_City', 'Shipping Address City',
-	'Ecom_ShipTo_Postal_StateProv', 'Shipping Address State',
-	'Ecom_ShipTo_Postal_PostalCode', 'Shipping Address Zip',
-	'Ecom_ShipTo_Postal_CountryCode', 'Shipping Address Country',
-	'Ecom_BillTo_Telecom_Phone_Number', 'Phone Number',
-	'Ecom_BillTo_Online_Email', 'Email',
-	'Ecom_Payment_Card_Type', 'Type of Card',
-	'Ecom_Payment_Card_Number', 'Card Number',
-	'Ecom_Payment_Card_ExpDate_Month', 'Card Expiration Month',
-	'Ecom_Payment_Card_ExpDate_Day', 'Card Expiration Day',
-	'Ecom_Payment_Card_ExpDate_Year', 'Card Expiration Year');
-
-@sc_order_form_required_fields = (
-	'Ecom_BillTo_Online_Email',
-	'Ecom_ShipTo_Postal_Name',
-	'Ecom_ShipTo_Postal_Street_Line1', 
-	'Ecom_ShipTo_Postal_City', 
-	"Ecom_ShipTo_Postal_StateProv",
-	"Ecom_ShipTo_Postal_PostalCode");
-}
-
-###############################################################################
-sub LinkpointHTML_verification_table {
-  local ($rslt)="";
-  $rslt = "<table border=0 width=100%>\n<tr>\n";
-  $rslt.= "<td width=\"50%\" align=right>Shipping Method:</td>\n";
-  $rslt.= '<td width = "50%" align=left>' .
-	$form_data{'Ecom_ShipTo_Method'} . "&nbsp;</td>\n";
-  $rslt.= "</tr>\n";
-  $rslt.= "<td width=\"50%\" align=right>Email:</td>\n";
-  $rslt.= '<td width = "50%" align=left>' .
-	$form_data{'Ecom_BillTo_Online_Email'} . "&nbsp;</td>\n";
-  $rslt.= "</tr>\n";
-  $rslt.= "<td width=\"50%\" align=right>Name:</td>\n";
-  $rslt.= '<td width = "50%" align=left>' .
-	$form_data{'Ecom_ShipTo_Postal_Name'} . "&nbsp;</td>\n";
-  $rslt.= "</tr>\n";
-  $rslt.= "<tr>\n";
-  $rslt.= "<td width=\"50%\" align=right>Street:</td>\n";
-  $rslt.= '<td width = "50%" align=left>' .
-	$form_data{'Ecom_ShipTo_Postal_Street_Line1'} . "&nbsp;</td>\n";
-  $rslt.= "</tr>\n";
-  $rslt.= "<tr>\n";
-  $rslt.= "<td width=\"50%\" align=right>City:</td>\n";
-  $rslt.= '<td width = "50%" align=left>' .
-	$form_data{'Ecom_ShipTo_Postal_City'} . "&nbsp;</td>\n";
-  $rslt.= "</tr>\n";
-  $rslt.= "<tr>\n";
-  $rslt.= "<td width=\"50%\" align=right>State:</td>\n";
-  $rslt.= '<td width = "50%" align=left>' .
-	$form_data{'Ecom_ShipTo_Postal_StateProv'} . "&nbsp;</td>\n";
-  $rslt.= "</tr>\n";
-  $rslt.= "<tr>\n";
-  $rslt.= "<td width=\"50%\" align=right>Zip:</td>\n";
-  $rslt.= '<td width = "50%" align=left>' .
-	$form_data{'Ecom_ShipTo_Postal_PostalCode'} . "&nbsp;</td>\n";
-  $rslt.= "</tr>\n";
-  $rslt.= "</table>\n";
-  return $rslt;
- }
-###############################################################################
-
-sub print_LinkpointHTML_SubmitPage
-
-{
-local($invoice_number, $customer_number);
-local($myname)="LinkpointHTML";
-
-if (!($form_data{'gateway'} eq $myname)) { return;} 
-if ($myname ne $sc_gateway_name) { # secondary gateway, load settings
-  &require_supporting_libraries(__FILE__,__LINE__,
-	"./admin_files/$myname-user_lib.pl");
- }
-
-$invoice_number = $current_verify_inv_no;
-$customer_number = $cart_id;
-$customer_number =~ s/_/./g;
-
-$my_oid = $cart_id . "|" . $invoice_number;
-$mytable = &LinkpointHTML_verification_table;
-&read_verify_file;
-
-print <<ENDOFTEXT;
-
-<FORM METHOD=POST ACTION=\"$sc_order_script_url\">
-<INPUT TYPE=HIDDEN NAME='mode' value="payplus">
-<INPUT TYPE=HIDDEN NAME='shippingamount' VALUE=\"$zfinal_shipping\">
-<INPUT TYPE=HIDDEN NAME='salestaxamount' VALUE=\"$zfinal_sales_tax\">
-<INPUT TYPE=HIDDEN NAME='shipping' VALUE=\"$zfinal_shipping\">
-<INPUT TYPE=HIDDEN NAME='tax' VALUE=\"$zfinal_sales_tax\">
-<INPUT TYPE=HIDDEN NAME='subtotal' VALUE=\"$zsubtotal\">
-<INPUT TYPE=HIDDEN NAME='chargetotal' VALUE=\"$authPrice\">
-<INPUT TYPE=HIDDEN NAME='subtotalamount' VALUE=\"$zsubtotal\">
-<INPUT TYPE=HIDDEN NAME='storename' VALUE=\"$sc_gateway_username\">
-<INPUT TYPE=HIDDEN NAME='oid' VALUE=\"$my_oid\">
-<INPUT TYPE=HIDDEN NAME='email' VALUE=\"$eform_Ecom_BillTo_Online_Email\">
-<INPUT TYPE=HIDDEN NAME='bname' VALUE=\"$eform_Ecom_ShipTo_Postal_Name\">
-<INPUT TYPE=HIDDEN NAME='baddr1' VALUE='$eform_Ecom_ShipTo_Postal_Street_Line1'> 
-<INPUT TYPE=HIDDEN NAME='bcity' VALUE=\"$eform_Ecom_ShipTo_Postal_City\"> 
-<INPUT TYPE=HIDDEN NAME='bstate' VALUE=\"$eform_Ecom_ShipTo_Postal_StateProv\">
-<INPUT TYPE=HIDDEN NAME='bzip' VALUE=\"$eform_Ecom_ShipTo_Postal_PostalCode\">
-<TABLE WIDTH="500" BGCOLOR="#C0FFFF" CELLPADDING="0" CELLSPACING="0">
-<TR>
-<TD>
-<CENTER>
-<TABLE WIDTH="480" BGCOLOR="#000080" CELLPADDING="0" CELLSPACING="0">
-<TR BGCOLOR="#C0FFFF">
-<TD BGCOLOR="#C0FFFF"><FONT FACE="ARIAL" SIZE="2" COLOR="#000000">
-<b>Please verify the following information. When you are confident 
-that it is correct, click the 'Secure Orderform' button to enter 
-your payment information, or
-<a href="${sc_stepone_order_script_url}?order_form_button.x=1">
-click here</a> to make corrections:
-</b></FONT></TD>
-<TD  BGCOLOR="#C0FFFF">
-</TR>
-<TR BGCOLOR="#C0FFFF">
-<TD BGCOLOR="#C0FFFF"><FONT FACE="ARIAL" SIZE="2" COLOR="#000000">
-$mytable
-</TD></TR>
-<TR BGCOLOR="#C0FFFF">
-<TD>
-<CENTER>
-<INPUT TYPE=SUBMIT VALUE="Secure Orderform">
-</CENTER>
-</TD>
-</TR>
-</TABLE>
-</CENTER>
-
-</TD>
-</TR>
-</TABLE>
-
-</FORM>
-</CENTER>
-
-ENDOFTEXT
-
-}
-###############################################################################
-
-sub process_LinkpointHTML_order {
-
-local($subtotal, $total_quantity,
-      $total_measured_quantity,
-      $text_of_cart,
-      $required_fields_filled_in, $product, $quantity, $options);
-local($stevo_shipping_thing) = "";
-local($stevo_shipping_names) = "";
-local($ship_thing_too,$ship_instructions);
-
-&load_verify_file;
-
-$orderDate = &get_date;
-
-print qq!
-<HTML>
-$sc_special_page_meta_tags
-<HEAD>
-<TITLE>$messages{'ordcnf_08'}</TITLE>
-<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
-$sc_standard_head_info</HEAD>
-<BODY $sc_standard_body_info>
-!;
-
-&StoreHeader;
-
-$text_of_cart .= "Order Date:    $orderDate\n";
-$text_of_cart .= "Gateway:       LinkpointHTML\n\n";
-
-$text_of_cart .= "  --PRODUCT INFORMATION--\n\n";
-
-open (CART, "$sc_cart_path") ||
-&file_open_error("$sc_cart_path", "display_cart_contents", __FILE__, __LINE__);
-
-while (<CART>) {
-  $cartData++;
-  @cart_fields = split (/\|/, $_);
-  $quantity = $cart_fields[0];
-  $product_price = $cart_fields[3];
-  $product = $cart_fields[4];
-  $options = $cart_fields[$cart{"options"}];
-  $options =~ s/<br>//g;
-  $text_of_cart .= &cart_textinfo(*cart_fields);
-  $stevo_shipping_thing .= "|quantity\*$weight";
-  $stevo_shipping_names .= "|$product\($options\)";
-  &codehook("process-cart-item");
- }
-close(CART);
-
-$sc_orderlib_use_SBW_for_ship_ins = $sc_use_SBW;
-&codehook("orderlib-ship-instructions");
-if ($sc_orderlib_use_SBW_for_ship_ins =~ /yes/i) {
-  ($ship_thing_too,$ship_instructions) = 
-   &ship_put_in_boxes($stevo_shipping_thing,$stevo_shipping_names,
-   $sc_verify_Origin_ZIP,$sc_verify_boxes_max_wt); 
- }
-
-$text_of_confirm_email .= $messages{'ordcnf_07'};
-
-$text_of_confirm_email .= $text_of_cart;
-$text_of_confirm_email .= "\n";
-$text_of_cart .= "  --ORDER INFORMATION--\n\n";
-
-&add_text_of_both("Order ID",$form_data{'oid'});
-&add_text_of_cart("STATUS",$form_data{'status'});
-&add_text_of_cart("APPROVAL CODE",$form_data{'approval_code'});
-&add_text_of_cart("Charge Total",$form_data{'chargetotal'});
-&add_text_of_cart("CC Type",$form_data{"cctype"});
-&add_text_of_cart("Card #",$form_data{"cardnumber"});
-&add_text_of_cart("Exp Month",$form_data{"expmonth"});
-&add_text_of_cart("Exp Year",$form_data{"expyear"});
-$text_of_cart .= "\n";
-
-&add_text_of_both("SUBTOTAL",$sc_verify_subtotal);
-$sc_verify_subtotal3 = $sc_verify_subtotal;
-
-if ($form_data{'shippingamount'}){
-  &add_text_of_both("SHIPPING",$sc_verify_shipping);
- }
-
-if ($form_data{'salestaxamount'}){
-  &add_text_of_both("SALES TAX",$sc_verify_tax);
- }
-
-$text_of_cart .= "TOTAL:         $form_data{'chargetotal'}\n\n";
-$text_of_confirm_email .= "TOTAL:         $form_data{'chargetotal'}\n\n";
-$text_of_cart .= "BILLING INFORMATION --------------\n\n";
-$text_of_cart .= "NAME:          $form_data{'bname'}\n";
-$text_of_cart .= "ADDRESS1:      $form_data{'baddr1'}\n";
-$text_of_cart .= "ADDRESS2:      $form_data{'baddr2'}\n";
-$text_of_cart .= "CITY:          $form_data{'bcity'}\n";
-$text_of_cart .= "STATE:         $form_data{'bstate'}\n";
-$text_of_cart .= "PROVINCE       $form_data{'bstate2'}\n";
-$text_of_cart .= "ZIP:           $form_data{'bzip'}\n";
-$text_of_cart .= "COUNTRY:       $form_data{'bcountry'}\n";
-$text_of_cart .= "PHONE:         $form_data{'phone'}\n";
-$text_of_cart .= "FAX:           $form_data{'fax'}\n";
-$text_of_cart .= "EMAIL:         $form_data{'email'}\n\n";
-$text_of_cart .= "SHIPPING INFORMATION --------------\n\n";
-$text_of_cart .= "NAME:          $form_data{'sname'}\n";
-$text_of_cart .= "ADDRESS1:      $form_data{'saddr1'}\n";
-$text_of_cart .= "ADDRESS2:      $form_data{'saddr2'}\n";
-$text_of_cart .= "CITY:          $form_data{'scity'}\n";
-$text_of_cart .= "STATE:         $form_data{'sstate'}\n";
-$text_of_cart .= "PROVINCE       $form_data{'sstate2'}\n";
-$text_of_cart .= "ZIP:           $form_data{'szip'}\n";
-$text_of_cart .= "COUNTRY:       $form_data{'scountry'}\n\n";
-
-if ($sc_use_SBW =~ /yes/i) {
-  &add_text_of_cart("SHIP VIA",$vform_Ecom_ShipTo_Method);
- }
-
-if ($ship_instructions ne "") {
-  $text_of_cart .= "Shipping Instructions: \n$ship_instructions\n\n";
- }
-
-$text_of_cart .= $XCOMMENTS_ADMIN;
-$text_of_confirm_email .= $XCOMMENTS;
-
-# 'Init' the emails ...
-$text_of_cart = &init_shop_keep_email . $text_of_cart;
-$text_of_confirm_email = &init_customer_email . $text_of_confirm_email;
-
-# and add the rest ...
-$text_of_admin_email .= &addto_shop_keep_email;
-$text_of_confirm_email .= &addto_customer_email;
-
-if ($sc_use_pgp =~ /yes/i)
-{
-&require_supporting_libraries(__FILE__, __LINE__, "$sc_pgp_lib_path");
-$text_of_cart = &make_pgp_file($text_of_cart, "$sc_pgp_temp_file_path/$$.pgp");
-$text_of_cart = "\n" . $text_of_cart . "\n";
-}
-
-if ($sc_send_order_to_email =~ /yes/i) {
-  &send_mail($sc_order_email, $sc_order_email, "AgoraCart Order",$text_of_cart);
- }
-
-&log_order($text_of_cart,$lp_inv,$cart_id);
-
-if (($cartData) && ($form_data{'email'} ne "")){
-  &send_mail($sc_admin_email, $form_data{'email'}, $messages{'ordcnf_08'}, 
-           "$text_of_confirm_email");
- }
-$sc_affiliate_order_unique = $form_data{'oid'};
-$sc_affiliate_order_total = $sc_verify_subtotal3;
-  
-print <<ENDOFTEXT;
-<CENTER>
-<TABLE WIDTH=500>
-<TR>
-<TD WIDTH=500>
-<BR>
-<FONT FACE=ARIAL>
-$messages{'ordcnf_01'}
-$messages{'ordcnf_02'}
-<br>
-$sc_affiliate_image_call
-</FONT>
-</TD>
-</TR>
-</TABLE>
-<CENTER>  
-
-ENDOFTEXT
-
-# This empties the cart after the order is successful
-&empty_cart;
-
-# and the footer is printed
-
-&StoreFooter;
-
-print qq!
-</BODY>
-</HTML>
-!;
-
-} # End of process_LinkpointHTML_order
-
-#################################################################
-1; # Library
diff -ruN 4.0K-4b/library/NiftyPay-mgr_lib.pl 5.0.000/library/NiftyPay-mgr_lib.pl
--- 4.0K-4b/library/NiftyPay-mgr_lib.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/library/NiftyPay-mgr_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,524 @@
+#
+# For the Credit Card Processing Gateway NiftyPay
+#
+# For more signup for NiftyPay or to become an NiftyPay authorized reseller
+# Please visit NiftyPay.com for more details.
+#
+# Copyright May 7, 2005 to Present K-Factor Technologies, Inc.  & AgoraScript
+# All Rights Reserved.
+
+$versions{'NiftyPay-mgr_lib.pl'} = "5.0.000";
+&add_codehook("gateway_admin_screen","NiftyPay_mgr_check");
+&add_codehook("gateway_admin_settings","NiftyPay_settings");
+$mc_gateways .= "|NiftyPay";
+##############################################################################
+sub NiftyPay_settings {
+ local ($email_text);
+ $email_text = &my_escape($in{'email_text'});
+ if ($sc_gateway_name eq "NiftyPay") {
+   open (GW,"> $gateway_settings") || &my_die("Can't Open $gateway_settings");
+   print (GW "\$sc_gateway_username = \"$in{'sc_gateway_username'}\";\n");
+   print (GW "\$sc_order_script_url = \"$in{'order_url'}\";\n");
+   print (GW "\$mername = \"$in{'mername'}\";\n");
+   print (GW "\$merchant_live_mode = \"$in{'live_mode'}\";\n");
+   print (GW "\$sc_niftypay_submit = '$in{'sc_niftypay_submit'}';\n");
+   print (GW "\$sc_niftypay_change = '$in{'sc_niftypay_change'}';\n");
+   print (GW "\$sc_niftypay_verify_message = \"" . 
+         &my_escape($in{'sc_niftypay_verify_message'}) . "\";\n");
+   print (GW "\$sc_niftypay_order_desc = \"" . 
+         &my_escape($in{'sc_niftypay_order_desc'}) . "\";\n");
+   print (GW "\$sc_display_checkout_tos = \"$in{'sc_display_checkout_tos'}\";\n");
+   $sc_tos_display_address_temp = &my_escape($in{'sc_tos_display_address'});
+   print (GW "\$sc_tos_display_address = qq'$sc_tos_display_address_temp';\n");
+   print (GW "\$sc_niftypay_top_message = \"" . 
+         &my_escape($in{'sc_niftypay_top_message'}) . "\";\n");
+   print (GW "\$NiftyPay_order_ok_final_msg_tbl = \"" . 
+         &my_escape($in{'NiftyPay_order_ok_final_msg_tbl'}) . "\";\n");
+   print (GW "\$NiftyPay_merch_message = \"" . 
+         &my_escape($in{'NiftyPay_merch_message'}) . "\";\n");
+   print (GW "\$NiftyPay_bodyback = \"" . 
+         &my_escape($in{'NiftyPay_bodyback'}) . "\";\n");
+   print (GW "\$NiftyPay_fontcolor = \"" . 
+         &my_escape($in{'NiftyPay_fontcolor'}) . "\";\n");
+   print (GW "\$NiftyPay_linkcolor = \"" . 
+         &my_escape($in{'NiftyPay_linkcolor'}) . "\";\n");
+   print (GW "\$NiftyPay_enablebodytags = \"$in{'NiftyPay_enablebodytags'}\";\n");
+   print (GW "\$NiftyPay_Logo_URL = \"$in{'NiftyPay_Logo_URL'}\";\n");
+   print (GW "\$NiftyPay_backimage_URL = \"$in{'NiftyPay_backimage_URL'}\";\n");
+
+  
+   print (GW "\$acceptcards = \"$in{'acceptcards'}\";\n");
+if ($in{'acceptcards'} eq 1) {
+   print (GW "\$acceptvisa = \"$in{'acceptvisa'}\";\n");
+   print (GW "\$acceptmastercard = \"$in{'acceptmastercard'}\";\n");
+   print (GW "\$acceptdiscover = \"$in{'acceptdiscover'}\";\n");
+   print (GW "\$acceptamex = \"$in{'acceptamex'}\";\n");
+   print (GW "\$acceptdiners = \"$in{'acceptdiners'}\";\n");
+}
+
+   print (GW "\$acceptchecks = \"$in{'acceptchecks'}\";\n");
+   print (GW "\$accepteft = \"$in{'accepteft'}\";\n");
+   print (GW "\$altaddr = \"$in{'altaddr'}\";\n");
+   print (GW "\$email_text = \"$email_text\";\n");
+   print (GW "#\n1\;\n");
+   close(GW);
+  }
+ }
+##############################################################################
+sub NiftyPay_mgr_check {
+if ($sc_gateway_name eq "NiftyPay") {
+  &print_NiftyPay_mgr_form;
+  &call_exit;
+ }
+}
+##############################################################################
+sub print_NiftyPay_mgr_form {
+  
+##
+## NiftyPay
+##
+
+if ($sc_display_checkout_tos eq '') { # default it in
+  $sc_display_checkout_tos = "yes";
+ }
+
+print &$manager_page_header("NiftyPay Gateway","","","","");
+
+print <<ENDOFTEXT;
+<CENTER>
+<TABLE width=96%>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN="2">
+<FONT FACE=ARIAL>
+<b>NiftyPay Settings</b><br>$msg<br><br>
+NiftyPay is an excellent alternative to PayPal or 2checkout (3rd party processing solutions).  With NiftyPay, you are provided with a real credit card merchant account and a payment processing solution that builds a better image for your company, yet it is a mainstream gateway that allows you to "Pay as you Play", meaning that your overhead each month is according to your volume of business.  In otherwords, the less business you do, the lower your payment processing costs are, which is ideal for smaller merchants and retailers.   Plus, it's very inexpensive with no long term commitments or contracts. <br><br><br>
+Find out more about ths gateway at: <a href="http://www.NiftyPay.com/">
+http://www.NiftyPay.com</a><br><br>
+<!--Don't forget that NiftyPay uses PGP signatures to validate
+every transaction.  To take full advantage of this, you should
+install PGP or RSA-enabled GPG on your server and set it up properly 
+on the PGP/GPG page.  You will need to import the
+NiftyPay public key as well, see the instructions at:<br><br>
+&nbsp;&nbsp;&nbsp;&nbsp;
+<a href="http://www.NiftyPay.com/support/pgp.html">
+http://www.NiftyPay.com/support/pgp.html</a><br>-->
+</FONT>
+
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+
+ENDOFTEXT
+
+if($in{'system_edit_success'} ne "")
+{
+print <<ENDOFTEXT;
+<CENTER>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL SIZE=2 COLOR=RED>Gateway settings 
+have been successfully updated</FONT>
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+ENDOFTEXT
+}
+
+print <<ENDOFTEXT;
+
+<FONT FACE=ARIAL SIZE=2>
+<FORM METHOD="POST" ACTION="manager.cgi">
+<CENTER>
+<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0 width=96%>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD>Are you ready to go live?  (Answer "no" to run in test mode.)</TD>
+<TD>
+<SELECT NAME="live_mode">
+<OPTION>$merchant_live_mode</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT>
+</TD>
+</TR>
+
+</CENTER>
+</TABLE>
+
+<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0 width=96%>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD WIDTH="200">
+Gateway Username
+</TD>
+<TD WIDTH="350">
+<INPUT NAME="sc_gateway_username" TYPE="TEXT" SIZE=30 
+VALUE='$sc_gateway_username'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+Secure URL to your Gateway's server
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+<INPUT NAME="order_url" TYPE="TEXT" SIZE=60
+VALUE="$sc_order_script_url"><br>
+</TD>
+</TR>
+
+</TABLE><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+Enter the name of your business here.
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+<INPUT NAME="mername" TYPE="TEXT" SIZE=60 VALUE="$mername"><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD>
+Are setup to accept credit cards through NiftyPay? 
+Select '0' for no, '1' for yes.  (applies to card types below as well)
+</TD>
+<TD>
+<SELECT NAME="acceptcards">
+<OPTION>$acceptcards</OPTION>
+<OPTION VALUE="0">0</OPTION>
+<OPTION VALUE="1">1</OPTION>
+</SELECT>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><table>
+	<tr>
+		<td><font size=2 face =arial>Accept Visa?<br><SELECT NAME="acceptvisa">
+<OPTION>$acceptvisa</OPTION>
+<OPTION VALUE="0">0</OPTION>
+<OPTION VALUE="1">1</OPTION>
+</SELECT></font></td>
+		<td><font size=2 face =arial>Accept MasterCard?<br><SELECT NAME="acceptmastercard">
+<OPTION>$acceptmastercard</OPTION>
+<OPTION VALUE="0">0</OPTION>
+<OPTION VALUE="1">1</OPTION>
+</SELECT></font></td>
+		<td><font size=2 face =arial>Accept AMEX?<br><SELECT NAME="acceptamex">
+<OPTION>$acceptamex</OPTION>
+<OPTION VALUE="0">0</OPTION>
+<OPTION VALUE="1">1</OPTION>
+</SELECT></font></td>
+		<td><font size=2 face =arial>Accept Discover?<br><SELECT NAME="acceptdiscover">
+<OPTION>$acceptdiscover</OPTION>
+<OPTION VALUE="0">0</OPTION>
+<OPTION VALUE="1">1</OPTION>
+</SELECT></font></td>
+		<td><font size=2 face =arial>Accept Diners?<br><SELECT NAME="acceptdiners">
+<OPTION>$acceptdiners</OPTION>
+<OPTION VALUE="0">0</OPTION>
+<OPTION VALUE="1">1</OPTION>
+</SELECT></font></td>
+	</tr>
+</table></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD>
+Are you setup to accept checks through NiftyPay?
+Select '0' for no, '1' for yes
+</TD>
+<TD>
+<SELECT NAME="acceptchecks">
+<OPTION>$acceptchecks</OPTION>
+<OPTION VALUE="0">0</OPTION>
+<OPTION VALUE="1">1</OPTION>
+</SELECT>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD>
+Are you setup to accept EFT through NiftyPay?
+Select '0' for no, '1' for yes.
+</TD>
+<TD>
+<SELECT NAME="accepteft">
+<OPTION>$accepteft</OPTION>
+<OPTION VALUE="0">0</OPTION>
+<OPTION VALUE="1">1</OPTION>
+</SELECT>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD>
+Do you want to allow customers to 
+enter an alternate shipping address?
+Select '0' for no, '1' for yes.
+</TD>
+<TD>
+<SELECT NAME="altaddr">
+<OPTION>$altaddr</OPTION>
+<OPTION VALUE="0">0</OPTION>
+<OPTION VALUE="1">1</OPTION>
+</SELECT>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+</TABLE><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0>
+
+
+<TR>
+<TD COLSPAN="2">
+Enter the text that you'd like to appear
+in the body of the confirmation e-mail
+sent to the customer.
+</TD>
+</TR>
+<TR>
+<TD COLSPAN="2">
+<TEXTAREA NAME="email_text" ROWS=6 COLS=60 
+wrap=soft>$email_text</TEXTAREA>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+URL of 'Submit to NiftyPay' button:
+<br>
+<INPUT NAME="sc_niftypay_submit" TYPE="TEXT" SIZE=60 
+VALUE='$sc_niftypay_submit'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+URL of 'Make Changes' button:
+<br>
+<INPUT NAME="sc_niftypay_change" TYPE="TEXT" SIZE=60 
+VALUE='$sc_niftypay_change'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+Order Description:
+<br>
+<INPUT NAME="sc_niftypay_order_desc" TYPE="TEXT" SIZE=60 
+VALUE='$sc_niftypay_order_desc'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+Message at the top of the Verify Order table:
+<br>
+<TEXTAREA NAME="sc_niftypay_verify_message"
+ROWS=4 COLS=65 wrap=soft>$sc_niftypay_verify_message</TEXTAREA>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><br><HR><br></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><TABLE WIDTH="100%"><TR>
+<TD>Display Terms of Service and Refund Policy checkbox and set as required?</TD>
+<TD>
+<SELECT NAME="sc_display_checkout_tos">
+<OPTION>$sc_display_checkout_tos</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT>
+</TD>
+</TR></TABLE></TD>
+</TR>
+<TR><TD COLSPAN=2><br>
+Business address and phone number (contact information) for your business.  Should be legal address for the business location for full disclosure and other privacy requirements mandated by credit card companies as well as government enitities that require such notices:<br>
+<TEXTAREA NAME="sc_tos_display_address" 
+cols="68" rows=5 
+wrap=off>$sc_tos_display_address</TEXTAREA><br>
+
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR><TD COLSPAN=2>
+Top message for Order form.  Allows you to place a message above the Payment Information area and just below the cart total boxes.  HTML formatting (for text color, font, spacing, etc) is accepted.  Leave blank if not needed:<br>
+<TEXTAREA NAME="sc_niftypay_top_message" 
+cols="68" rows=8 
+wrap=off>$sc_niftypay_top_message</TEXTAREA> <br><br>
+</TD>
+</TR>
+
+<TR><TD COLSPAN=2>
+Top message for confirmation page, the page just before going to the gateway.  This allows you to place a message above the Payment Information area and just below the cart total boxes.  HTML formatting (for text color, font, spacing, etc) is accepted.  Leave blank if not needed:<br>
+<TEXTAREA NAME="NiftyPay_order_ok_final_msg_tbl" 
+cols="68" rows=8 
+wrap=off>$NiftyPay_order_ok_final_msg_tbl</TEXTAREA> <br><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><font size=2 face =arial><br>
+Complete URL to the logo you'd like to display on your payment information page at NiftyPay.
+This <b>MUST</b> be a secure https URL. You can also leave this blank if you prefer.<br>
+<INPUT NAME="NiftyPay_Logo_URL" TYPE="TEXT" SIZE=60 VALUE="$NiftyPay_Logo_URL"><br>
+</font></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><font size=2 face =arial><br>
+Set and define the body tag attributes at the NiftyPay payment page?  Select Attributes below.  If not desired, set the enable body tags variable to "0" to disable all body tags.  Fields that you do not wish to use, leave blank or select 0.  Enter color names or RGB values (for example, enter either: red or #FF0000) for colors.
+</font></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><table>
+	<tr>
+		<td><font size=2 face =arial>Enable Body Tags?<br><SELECT NAME="NiftyPay_enablebodytags">
+<OPTION>$NiftyPay_enablebodytags</OPTION>
+<OPTION VALUE="0">0</OPTION>
+<OPTION VALUE="1">1</OPTION>
+</SELECT></font></td>
+		<td><font size=2 face =arial>Body Background Color:<br>
+<INPUT NAME="NiftyPay_bodyback" TYPE="TEXT" SIZE=10 VALUE="$NiftyPay_bodyback">
+</font></td>
+		<td><font size=2 face =arial>Font Color:<br>
+<INPUT NAME="NiftyPay_fontcolor" TYPE="TEXT" SIZE=10 VALUE="$NiftyPay_fontcolor">
+</font></td>
+		<td><font size=2 face =arial>Link Color:<br>
+<INPUT NAME="NiftyPay_linkcolor" TYPE="TEXT" SIZE=10 VALUE="$NiftyPay_linkcolor">
+</font></td>
+</table>
+<br>
+<font size=2 face =arial><br>
+Complete URL to the background image you'd like to display on your payment information page at NiftyPay.
+This <b>MUST</b> be a secure https URL. You can also leave this blank if you prefer.  Body Tag attributes must be enabled above to use this featured<br>
+<INPUT NAME="NiftyPay_backimage_URL" TYPE="TEXT" SIZE=60 VALUE="$NiftyPay_backimage_URL"><br>
+</font>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><font size=2 face =arial><br>
+Enter a text message to be shwon on the payment information page at NiftyPay.
+This mesage will be shown in the text box immediately above the submit button. Use a &lt;br> for line breaks/spacing.  You can also leave this blank if you prefer.<br>
+<TEXTAREA NAME="NiftyPay_merch_message" 
+cols="68" rows=8 
+wrap=off>$NiftyPay_merch_message</TEXTAREA><br>
+</font></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><br><br>
+<CENTER>
+<INPUT TYPE="HIDDEN" NAME="system_edit_success" VALUE="yes">
+<INPUT TYPE="HIDDEN" NAME="gateway" VALUE="NiftyPay">
+<INPUT NAME="GatewaySettings" TYPE="SUBMIT" VALUE="Submit">
+&nbsp;&nbsp;
+<INPUT TYPE="RESET" VALUE="Reset">
+</CENTER>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+<HR>
+</TD>
+</TR>
+
+</TABLE>
+
+</CENTER>
+</FORM>
+ENDOFTEXT
+print &$manager_page_footer;
+
+}
+##############################################################################
+1; #Library
diff -ruN 4.0K-4b/library/NiftyPay-order_lib.pl 5.0.000/library/NiftyPay-order_lib.pl
--- 4.0K-4b/library/NiftyPay-order_lib.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/library/NiftyPay-order_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,793 @@
+#######################################################################
+#                    Order Form Definition Variables                  #
+#######################################################################
+
+$versions{'NiftyPay-order_lib.pl'} = "5.0.000";
+$sc_use_secure_header_at_checkout = 'yes';
+$sc_use_secure_footer_for_order_form = 'yes';
+
+# discount mods applied June 17 2005
+
+$sc_order_response_vars{"NiftyPay"}="NiftyPay";
+$sc_use_secure_header_at_checkout = 'yes';
+&add_codehook("printSubmitPage","print_NiftyPay_SubmitPage");
+&add_codehook("set_form_required_fields","NiftyPay_fields");
+&add_codehook("gateway_response","check_for_NiftyPay_response");
+###############################################################################
+sub NiftyPay_check_and_load {
+local($myname)="NiftyPay";
+if ($myname ne $sc_gateway_name) { # we are a secondary gateway, load settings
+  &require_supporting_libraries(__FILE__,__LINE__,
+     "./admin_files/$myname-user_lib.pl");
+ }
+
+}
+###############################################################################
+sub check_for_NiftyPay_response {
+  if ($form_data{'NiftyPay'} eq 'NiftyPay') {
+    $cart_id = $form_data{'p4'};
+    &set_sc_cart_path;
+    &load_order_lib;
+    &codehook("NiftyPay_order");
+    &process_NiftyPay_Order;
+    &call_exit;
+   }
+ }
+###############################################################################
+sub NiftyPay_fields{
+local($myname)="NiftyPay";
+
+if (!($form_data{'gateway'} eq $myname)) { return;} 
+
+%sc_order_form_array =(
+	'Ecom_BillTo_Postal_Name_First', 'First Name',
+  'Ecom_BillTo_Postal_Name_Last', 'Last Name',
+  'Ecom_BillTo_Postal_Street_Line1', 'Billing Address Street',
+  'Ecom_BillTo_Postal_City', 'Billing Address City',
+  'Ecom_BillTo_Postal_StateProv', 'Billing Address State',
+  'Ecom_BillTo_PostalCode', 'Billing Address Zip',
+  'Ecom_BillTo_Postal_CountryCode', 'Billing Address Country',
+  'Ecom_ShipTo_Postal_Street_Line1', 'Shipping Address Street',
+  'Ecom_ShipTo_Postal_City', 'Shipping Address City',
+  'Ecom_ShipTo_Postal_StateProv', 'Shipping Address State',
+  'Ecom_ShipTo_Postal_PostalCode', 'Shipping Address Zip',
+  'Ecom_ShipTo_Postal_CountryCode', 'Shipping Address Country',
+  'Ecom_BillTo_Telecom_Phone_Number', 'Phone Number',
+  'Ecom_BillTo_Online_Email', 'Email',
+  'Ecom_is_Residential', 'Shipping to Residential Address',
+  'Ecom_ShipTo_Insurance', 'Insure this Shipment', # not implemented yet, for the future
+  'Ecom_tos', 'Sales-Terms of Service',
+  'Ecom_Payment_Card_Type', 'Type of Card',
+  'Ecom_Payment_Card_Number', 'Card Number',
+  'Ecom_Payment_Card_ExpDate_Month', 'Card Expiration Month',
+  'Ecom_Payment_Card_ExpDate_Day', 'Card Expiration Day',
+  'Ecom_Payment_Card_ExpDate_Year', 'Card Expiration Year');
+                        
+
+@sc_order_form_required_fields = (
+	"Ecom_ShipTo_Postal_StateProv",
+	"Ecom_ShipTo_Postal_PostalCode");
+
+# lines for tos added April 5 2006 by Mister Ed
+ if ($sc_display_checkout_tos =~ /yes/i) {
+    push(@sc_order_form_required_fields,"Ecom_tos");
+ }
+
+}
+
+###############################################################################
+sub NiftyPay_order_form_prep { # load the customer info ...
+  &NiftyPay_check_and_load;
+  if ($sc_NiftyPay_form_prep == 0) {
+    if (-f "$sc_verify_order_path"){
+      &read_verify_file;  
+     } else {
+      &codehook("load_customer_info");
+     }
+    $sc_NiftyPay_form_prep = 1;
+   }
+  return "";
+ }
+###############################################################################
+sub NiftyPay_table_setup {
+#
+# To use this, put this in the email_text in the manager for HTML:
+#
+#	<!--agorascript-pre
+#	  return $NiftyPay_cart_table;
+#	-->
+#
+# or for text in an email:
+#
+#	<!--agorascript-pre
+#	  return $NiftyPay_prod_in_cart;
+#	-->
+# 
+
+local (@my_cart_fields,$my_cart_row_number,$result);
+local ($count,$price,$product_id,$quantity,$total_cost,$total_qty)=0;
+local ($name,$cost);
+
+ $NiftyPay_prod_in_cart = '';
+ $NiftyPay_cart_table = '';
+ $result='';
+ open (CART, "$sc_cart_path") || &file_open_error("$sc_cart_path", 
+            "display_cart_contents_in_header", __FILE__, __LINE__);
+ while (<CART>)
+  {
+   $count++;
+   chop;    
+   @my_cart_fields = split (/\|/, $_);
+   $my_cart_row_number = pop(@my_cart_fields);
+   push (@my_cart_fields, $my_cart_row_number);
+   $quantity = $my_cart_fields[0];
+   $product_id = $my_cart_fields[1];
+   $price = $my_cart_fields[$sc_cart_index_of_price_after_options]; 
+   $name = $my_cart_fields[$cart{"name"}];
+   $name = substr($name,0,35);
+   $cost = &format_price($quantity * $price);
+   $total_cost = $total_cost + $quantity * $price;
+   $total_qty = $total_qty + $quantity;
+   $options = $my_cart_fields[$cart{"options"}];
+   $options =~ s/<br>/ /g;
+   if ($result eq '') {
+     $result .= '<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=425>';
+     $result .= "<TR><TD>Items Ordered:</TD></TR><TR><TD>\n";
+     $result .= "<TABLE CELLPADDING=3 CELLSPACING=0 BORDER=1 WIDTH='100%'>\n";
+     $result .= "<TR><TH>QTY</TH><TH>ID #</TH><TH>Description</TH>";
+     $result .= "<TH>Cost</TH></TR>\n";
+     $NiftyPay_prod_in_cart .= "  --PRODUCT INFORMATION--\n\n";
+    }
+   $result .= "<TR><TD>$quantity</TD><TD>$product_id</TD>\n";
+   $result .= "<TD>$name</TD><TD>$cost</TD>";
+   $result .= "</TR>\n";
+   $NiftyPay_prod_in_cart .= &cart_textinfo(*my_cart_fields);
+  } # End of while (<CART>)
+ close (CART);
+ if ($result ne '') {
+   $result .= "</TABLE></TD></TR></TABLE>\n";
+  }
+ $NiftyPay_cart_table = $result;
+}
+
+###############################################################################
+
+sub print_NiftyPay_SubmitPage
+
+{
+local($invoice_number, $customer_number, $displayTotal);
+local($test_mode,$zemail_text);
+local($myname)="NiftyPay";
+local($my_change,$my_submit,$my_message,$my_desc);
+my ($tempbodytags) = '';
+
+if (!($form_data{'gateway'} eq $myname)) { return;} 
+if ($myname ne $sc_gateway_name) { # secondary gateway, load settings
+  &require_supporting_libraries(__FILE__,__LINE__,
+     "./admin_files/$myname-user_lib.pl");
+ }
+
+$displayTotal = &display_price($authPrice);
+
+$invoice_number = $current_verify_inv_no;
+$customer_number = $cart_id;
+$customer_number =~ s/_/./g;
+$my_submit=&script_and_substitute($sc_niftypay_submit);
+$my_change=&script_and_substitute($sc_niftypay_change);
+$my_message=&script_and_substitute($sc_niftypay_verify_message);
+$my_desc=&script_and_substitute($sc_niftypay_order_desc);
+&NiftyPay_table_setup;
+$zemail_text = &script_and_substitute($email_text,"NiftyPay");
+
+if ($merchant_live_mode =~ /yes/i){
+  $test_mode = "";
+ } else {
+  $test_mode = "<INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"test_mode\">";
+ }
+
+
+if ($NiftyPay_enablebodytags eq "1"){
+$tempbodytags = qq~<input type="hidden" name="bodytags" value="$NiftyPay_enablebodytags">
+<INPUT type="hidden" name="background" value="$NiftyPay_backimage_URL">
+<INPUT type="hidden" name="bgcolor" value="$NiftyPay_bodyback">
+<INPUT type="hidden" name="fontcolor" value="$NiftyPay_fontcolor">
+<INPUT type="hidden" name="link" value="$NiftyPay_linkcolor">
+~;
+}
+
+if ($NiftyPay_Logo_URL ne ""){
+$tempbodytags .= qq~
+<INPUT type="hidden" name="mastimage" value="1">
+<INPUT type="hidden" name="mast" value="$NiftyPay_Logo_URL">
+~;
+}
+
+print <<ENDOFTEXT;
+
+<FORM METHOD=POST ACTION=\"$sc_order_script_url\" AUTOCOMPLETE = 'off'>
+
+<INPUT TYPE=\"HIDDEN\" NAME=\"vendor_id\" VALUE=\"$sc_gateway_username\">
+
+<input type=\"hidden\" name=\"formtype\" value=\"1\">
+<INPUT TYPE=\"HIDDEN\" NAME=\"home_page\" VALUE=\"$sc_store_url\">
+<INPUT TYPE=\"HIDDEN\" NAME=\"ret_addr\" VALUE=\"$sc_store_url\">
+<input type=\"hidden\" name=\"ret_mode\" value=\"post\">
+<INPUT TYPE=\"HIDDEN\" NAME=\"email_text\" VALUE=\"$zemail_text\">
+
+<INPUT TYPE=\"HIDDEN\" NAME=\"1-cost\" VALUE=\"$authPrice\">
+<INPUT TYPE=\"HIDDEN\" NAME=\"1-desc\" VALUE=\"Online Order\">
+<INPUT TYPE=\"HIDDEN\" NAME=\"1-qty\" VALUE=\"1\">
+
+$tempbodytags
+<input type="hidden" name="mertext" value="$NiftyPay_merch_message">
+
+<INPUT type=\"HIDDEN\" name=\"passback\" value=\"p1\">
+<INPUT TYPE=\"HIDDEN\" NAME=\"p1\" VALUE=\"$zfinal_shipping\">
+
+<INPUT type=\"HIDDEN\" name=\"passback\" value=\"p2\">
+<INPUT TYPE=HIDDEN NAME=\"p2\" VALUE=\"$zfinal_discount\">
+
+<INPUT type=\"HIDDEN\" name=\"passback\" value=\"p3\">
+<INPUT TYPE=HIDDEN NAME=\"p3\" VALUE=\"$zfinal_sales_tax\">
+
+<INPUT type=\"HIDDEN\" name=\"passback\" value=\"p4\">
+<INPUT TYPE=\"HIDDEN\" NAME=\"p4\" VALUE=\"$customer_number\">
+
+<INPUT type=\"HIDDEN\" name=\"passback\" value=\"p5\">
+<INPUT TYPE=\"HIDDEN\" NAME=\"p5\" VALUE=\"$invoice_number\">
+
+<INPUT type=\"HIDDEN\" name=\"passback\" value=\"NiftyPay\">
+<INPUT TYPE=\"HIDDEN\" NAME=\"NiftyPay\" VALUE=\"NiftyPay\">
+
+<INPUT TYPE=HIDDEN NAME=\"showaddr\" VALUE=\"1\">
+<INPUT TYPE=HIDDEN NAME=\"nonum\" VALUE=\"0\">
+
+<INPUT TYPE=HIDDEN NAME=\"mername\" VALUE=\"$mername\">
+<INPUT TYPE=HIDDEN NAME=\"acceptcards\" VALUE=\"$acceptcards\">
+<INPUT TYPE=HIDDEN NAME=\"acceptchecks\" VALUE=\"$acceptchecks\">
+<INPUT TYPE=HIDDEN NAME=\"accepteft\" VALUE=\"$accepteft\">
+<INPUT TYPE=HIDDEN NAME=\"altaddr\" VALUE=\"$altaddr\">
+<input type=hidden name="visaimage" value="$acceptvisa">
+<input type=hidden name="mcimage" value="$acceptmastercard">
+<input type=hidden name="discimage" value="$acceptdiscover">
+<INPUT type="hidden" name="ameximage" value="$acceptamex">
+<INPUT type="hidden" name="dinerimage" value="$acceptdiners">
+
+<INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"first_name\">
+<INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"last_name\">
+<INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"address\">
+<INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"city\">
+<INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"state\">
+<INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"zip\">
+<INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"country\">
+<INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"phone\">
+<INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"email\">
+
+<INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"sfname\">
+<INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"slname\">
+<INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"saddr\">
+<INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"scity\">
+<INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"sstate\">
+<INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"szip\">
+<INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"sctry\">
+
+<INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"total\">
+<INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"authcode\">
+$test_mode
+<INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"when\">
+<INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"xid\">
+
+ENDOFTEXT
+
+print <<ENDOFTEXT;
+
+<div align="center">
+
+<p class="ac_checkout_top_msg">$NiftyPay_order_ok_final_msg_tbl</p>
+  <p class="ac_checkout_top_msg">$my_message</p>
+
+
+<table cellpadding="0" cellspacing="0" class="ac_checkout_review">
+<tr>
+<th colspan="2" class="ac_checkout_review">Customer Information</th>
+</tr>
+ENDOFTEXT
+
+if ($form_data{'Ecom_ShipTo_Method'} ne ""){
+print <<ENDOFTEXT;
+  <tr>
+    <td class="ac_checkout_review_col1">Ship via:</td>
+    <td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Method'}</td>
+  </tr>
+ENDOFTEXT
+}
+ 
+print <<ENDOFTEXT;
+  <tr>
+    <td class="ac_checkout_review_col1">State </td>
+    <td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_StateProv'}
+    &nbsp;</td>
+  </tr>
+  <tr>
+    <td class="ac_checkout_review_col1">Postal Code </td>
+    <td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_PostalCode'}
+    &nbsp; </td>
+  </tr>
+  <tr>
+    <td class="ac_checkout_review_col1">Country</td>
+    <td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_CountryCode'}</td>
+  </tr>
+  <tr>
+    <td class="ac_checkout_review_col1">Residential Address</td>
+    <td class="ac_checkout_review_col2">$form_data{'Ecom_is_Residential'}&nbsp;</td>
+  </tr>
+</TABLE>
+ 
+<TABLE WIDTH="500" BGCOLOR="#FFFFFF" CELLPADDING="2" CELLSPACING="0" BORDER=0>
+<TR>
+<TD COLSPAN=2>
+<CENTER>
+<INPUT TYPE="IMAGE" NAME="Submit" VALUE="Submit Order For Processing"
+SRC="$my_submit" border=0>
+&nbsp;&nbsp;&nbsp;&nbsp;
+<a href="agora.cgi?order_form_button.x=1&cart_id=${cart_id}">
+<IMG SRC="$my_change" BORDER=0></a>
+</FORM>
+</CENTER>
+</TD>
+</TR>
+</table>
+</FONT>
+</CENTER>
+ENDOFTEXT
+
+}
+############################################################################################
+sub process_NiftyPay_Order {
+local($subtotal, $total_quantity,
+      $total_measured_quantity,
+      $text_of_cart, $weight,
+      $required_fields_filled_in, $product, $quantity, $options);
+local($stevo_shipping_thing) = "";
+local($stevo_shipping_names) = "";
+local($ship_thing_too,$ship_instructions);
+local(%orderLoggingHash);
+
+#alt origination stuff added by Mister Ed Feb 17, 2005
+if ($sc_alt_origin_enabled =~ /yes/i) {
+	local(%zip_list);
+	local(%zip_names_list);
+}
+
+&load_verify_file;
+
+$mySIG= "./admin_files/sig_ver_$$.SIG";
+
+open(SIGV,">$mySIG");
+print SIGV $form_data{'signature'};
+close(SIGV);
+
+($junk,$my_str) = split(/http:\/\//,$form_data{'signature'},2);
+($junk,$my_str) = split(/\?/,$my_str,2);
+($my_str,$junk) = split(/\n/,$my_str,2);
+
+@itrans = split(/[&;]/,$my_str); 
+
+# parse the signed response, not what was on the command line ... 
+# code borrowed from cgi-lib.pl
+
+foreach $i (0 .. $#itrans) {
+   # Convert plus to space
+   $itrans[$i] =~ s/\+/ /g;
+
+   # Split into key and value.  
+   ($key, $val) = split(/=/,$itrans[$i],2); # splits on the first =.
+
+   # Convert %XX from hex numbers to alphanumeric
+   $key =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge;
+   $val =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge;
+
+   # Associate key and value
+   $itrans{$key} .= "\0" if (defined($itrans{$key})); #\0 = multiple separator
+   $itrans{$key} .= $val;
+ }
+
+if ($sc_pgp_or_gpg =~ /GPG/i) { # verify with GPG
+  $command =  "$sc_pgp_or_gpg_path ";
+  $command .= "--home ./pgpfiles --always-trust --verify ";
+  $ENV{'PATH'}="/bin:/usr/bin";
+  $result = `$command $mySIG 2>&1`;
+  if (($result =~ /Good Signature/i) &&
+      ($result =~ /NiftyPay/i)) {
+    $verification = "Passed GNU Privacy Guard signature verification.";
+   } else {
+    $verification = "$result\n";
+# Could not verify NiftyPay signature because:\n$result\n";
+   }
+ }
+
+if ($sc_pgp_or_gpg =~ /PGP/i) { # verify with Pretty Good Privacy
+  $command =  "$sc_pgp_or_gpg_path";
+  chop($command);
+  $command .= "v "; # verification 
+  $command .= "";
+  $ENV{'PATH'}="/bin:/usr/bin";
+  $ENV{'PGPPATH'}="./pgpfiles";
+  $result = `$command $mySIG 2>&1`;
+  if (($result =~ /Good Signature/i) &&
+      ($result =~ /NiftyPay/i)) {
+    $verification = "Passed PGP signature verification.";
+   } else {
+#    $verification = "\n$result\n";
+   }
+ }
+
+unlink("$mySIG");
+
+if ($cart_id ne $itrans{'p4'}) {
+  $verification .= "\nWARNING! CART ID DOES NOT MATCH EXPECTED VALUE!!\n\n";
+ }
+
+# NEW CODEHOOK
+&codehook("process-order-routine-top");
+
+$orderDate = &get_date;
+
+print qq!
+<html>
+$sc_special_page_meta_tags
+<HEAD>
+<title>$messages{'ordcnf_08'}</title>
+$sc_secure_standard_head_info</head>
+<body>
+!;
+
+&SecureStoreHeader;
+
+$text_of_cart .= "Order Date:    $orderDate\n";
+$text_of_cart .= "Gateway:       NiftyPay\n\n";
+$orderLoggingHash{'GatewayUsed'} = "NiftyPay";
+
+$text_of_cart .= "  --PRODUCT INFORMATION--\n\n";
+
+open (CART, "$sc_cart_path") ||
+&file_open_error("$sc_cart_path", "display_cart_contents", __FILE__, __LINE__);
+
+while (<CART>)
+{
+$cartData++;
+@cart_fields = split (/\|/, $_);
+$quantity = $cart_fields[0];
+$product_price = $cart_fields[3];
+$product = $cart_fields[4];
+$weight = $cart_fields[6];
+$options = $cart_fields[$cart{"options"}];
+$options =~ s/<br>/ /g;
+$text_of_cart .= &cart_textinfo(*cart_fields);
+$stevo_shipping_thing .="|$quantity\*$weight";
+$stevo_shipping_names .="|$product\($options\)";
+&codehook("process-cart-item");
+}
+close(CART);
+
+# initialize hash variables in case they are empty later
+# added by jfindlay 2006 February
+
+$orderLoggingHash{'firstName'} = "";
+$orderLoggingHash{'lastName'} = "";
+$orderLoggingHash{'fullName'} = "";
+$orderLoggingHash{'orderFromAddress'} = "";
+$orderLoggingHash{'customerAddress2'} = "";
+$orderLoggingHash{'customerAddress3'} = "";
+$orderLoggingHash{'orderFromCity'} = "";
+$orderLoggingHash{'orderFromPostal'} = "";
+$orderLoggingHash{'customerPhone'} = "";
+$orderLoggingHash{'companyName'} = "";
+$orderLoggingHash{'emailAddress'} = "";
+
+$orderLoggingHash{'shipToName'} = "";
+$orderLoggingHash{'shipToAddress'} = "";
+$orderLoggingHash{'shipToAddress2'} = "";
+$orderLoggingHash{'shipToAddress3'} = "";
+$orderLoggingHash{'shipToCity'} = "";
+$orderLoggingHash{'shipToState'} = "";
+$orderLoggingHash{'shipToPostal'} = "";
+$orderLoggingHash{'shipToCountry'} = "";
+$orderLoggingHash{'shiptoResidential'} = $eform_Ecom_is_Residential;
+$orderLoggingHash{'insureShipment'} = $eform_Ecom_ShipTo_Insurance; # not implemented yet, for the future
+
+$orderLoggingHash{'invoiceNumber'} = "";
+$orderLoggingHash{'customerNumber'} = "";
+$orderLoggingHash{'orderStatus'} = "$sc_order_status_default";
+$orderLoggingHash{'user1'} = "";
+$orderLoggingHash{'user2'} = "";
+$orderLoggingHash{'user3'} = "";
+$orderLoggingHash{'user4'} = "";
+$orderLoggingHash{'user5'} = "";
+$orderLoggingHash{'itemsordered'} = "";
+$orderLoggingHash{'shiptrackingID'} = "";
+$orderLoggingHash{'shipMethod'} = "";
+$orderLoggingHash{'orderFromState'} = "";
+$orderLoggingHash{'orderFromCountry'} = "";
+$orderLoggingHash{'shippingTotal'} = "";
+$orderLoggingHash{'salesTax'} = "";
+$orderLoggingHash{'tax1'} = "";
+$orderLoggingHash{'tax2'} = "";
+$orderLoggingHash{'tax3'} = "";
+$orderLoggingHash{'discounts'} = "";
+$orderLoggingHash{'netProfit'} = "";
+$orderLoggingHash{'affiliateTotal'} = "";
+$orderLoggingHash{'affiliateID'} = "";
+$orderLoggingHash{'affiliateMisc'} = "";
+$orderLoggingHash{'subTotal'} = "";
+$orderLoggingHash{'orderTotal'} = "";
+$orderLoggingHash{'adminMessages'} = "";
+$orderLoggingHash{'shippingMessages'} = "";
+$orderLoggingHash{'xcomments'} = "";
+$orderLoggingHash{'termsOfService'} = "$vform_Ecom_tos";
+
+$sc_orderlib_use_SBW_for_ship_ins = $sc_use_SBW;
+&codehook("orderlib-ship-instructions");
+if ($sc_orderlib_use_SBW_for_ship_ins =~ /yes/i) {
+  ($ship_thing_too,$ship_instructions) = 
+   &ship_put_in_boxes($stevo_shipping_thing,$stevo_shipping_names,
+   $sc_verify_Origin_ZIP,$sc_verify_boxes_max_wt); 
+ }
+$orderLoggingHash{'shippingMessages'} = "$ship_instructions";
+$orderLoggingHash{'shippingMessages'} =~ s/\n/<br>/g;
+
+$text_of_confirm_email .= $messages{'ordcnf_07'};
+
+$text_of_confirm_email .= "$text_of_cart\n";
+
+$text_of_cart .= "  --ORDER INFORMATION--\n\n";
+
+# $text_of_cart .= "VERIFICATION:  $verification\n";
+$text_of_cart .= "CUST ID:       $itrans{'p4'}\n";
+$text_of_confirm_email .= "CUST ID:       $itrans{'p4'}\n";
+$orderLoggingHash{'customerNumber'} = "$itrans{'p4'}";
+
+$text_of_cart .= "ORDER ID:      $itrans{'p5'}\n";
+$text_of_confirm_email .= "ORDER ID:      $itrans{'p5'}\n";
+$orderLoggingHash{'invoiceNumber'} = "$itrans{'p5'}";
+
+if ($itrans{'p1'})
+{
+$text_of_cart .= "SHIPPING:      " . &format_price($sc_verify_shipping) . "\n";
+$text_of_confirm_email .= "SHIPPING:      " . &format_price($sc_verify_shipping) . "\n";
+$orderLoggingHash{'shippingTotal'} = &format_price($sc_verify_shipping);
+}
+
+if (($sc_use_SBW =~ /yes/i) || ($form_data{'x_Freight'} > .009)) {
+ $text_of_confirm_email .= "SHIP VIA:      $eform_Ecom_ShipTo_Method\n";
+}
+
+ $orderLoggingHash{'shipMethod'} = $eform_Ecom_ShipTo_Method;
+
+  $temp = &format_price($sc_verify_subtotal);
+  &add_text_of_both("SUBTOTAL",$temp);
+  $orderLoggingHash{'subTotal'} = &format_price($sc_verify_subtotal);
+
+if ($sc_verify_discount) {
+  $temp = &format_price($sc_verify_discount);
+  &add_text_of_both("DISCOUNT",$temp);
+  $orderLoggingHash{'discounts'} = &format_price($sc_verify_discount);
+  # start of adjustments for discount addon
+  $text_of_cart .= "DISCOUNT CODE: $eform_Ecom_Discount\n";
+  $text_of_confirm_email .= "DISCOUNT CODE: $eform_Ecom_Discount\n";
+  # end of adjustments for discount addon
+}
+
+if ($itrans{'p3'})
+{
+$text_of_cart .=          "TOT. SALESTAX: $itrans{'p3'}\n";
+$text_of_confirm_email .= "TOT. SALESTAX: $itrans{'p3'}\n";
+}
+
+if ($sc_verify_tax > 0)
+{
+$temp = substr(substr("SALES TAX",0,13).":               ",0,15);
+$text_of_cart .= "$temp$sc_verify_tax\n";
+$text_of_confirm_email .= "$temp$sc_verify_tax\n";
+$orderLoggingHash{'salesTax'} = "$sc_verify_tax";
+}
+if ($sc_verify_etax1 > 0)
+{
+$temp = substr(substr($sc_extra_tax1_name,0,13).":               ",0,15);
+$text_of_cart .= "$temp$sc_verify_etax1\n";
+$text_of_confirm_email .= "$temp$sc_verify_etax1\n";
+$orderLoggingHash{'tax1'} = "$sc_verify_etax1";
+}
+if ($sc_verify_etax2 > 0)
+{
+$temp = substr(substr($sc_extra_tax2_name,0,13).":               ",0,15);
+$text_of_cart .= "$temp$sc_verify_etax2\n";
+$text_of_confirm_email .= "$temp$sc_verify_etax2\n";
+$orderLoggingHash{'tax2'} = "$sc_verify_etax2";
+}
+if ($sc_verify_etax3 > 0)
+{
+$temp = substr(substr($sc_extra_tax3_name,0,13).":               ",0,15);
+$text_of_cart .= "$temp$sc_verify_etax3\n";
+$text_of_confirm_email .= "$temp$sc_verify_etax3\n";
+$orderLoggingHash{'tax3'} = "$sc_verify_etax3";
+}
+
+$text_of_cart .= "TOTAL:         $itrans{'total'}\n\n";
+$text_of_confirm_email .= "TOTAL:         $itrans{'total'}\n\n";
+$orderLoggingHash{'orderTotal'} = "$itrans{'total'}"; #$sc_verify_grand_total";
+
+$text_of_cart .= "AUTH CODE      $itrans{'authcode'}\n";
+$text_of_cart .= "TIME:          $itrans{'when'}\n";
+$text_of_cart .= "TRANS ID:      $itrans{'xid'}\n\n";
+$text_of_cart .= "BILLING INFORMATION --------------\n\n";
+
+$text_of_cart .= "NAME:          $itrans{'first_name'} $itrans{'last_name'}\n";
+$orderLoggingHash{'fullName'} = "$itrans{'first_name'} $itrans{'last_name'}";
+$orderLoggingHash{'firstName'} = "$itrans{'first_name'}";
+$orderLoggingHash{'lastName'} = "$itrans{'last_name'}";
+
+$text_of_cart .= "ADDRESS:       $itrans{'address'}\n";
+$orderLoggingHash{'orderFromAddress'} = "$itrans{'address'}";
+
+$text_of_cart .= "CITY:          $itrans{'city'}\n";
+$orderLoggingHash{'orderFromCity'} = "$itrans{'city'}";
+
+$text_of_cart .= "STATE:         $itrans{'state'}\n";
+$orderLoggingHash{'orderFromState'} = "$itrans{'state'}";
+
+$text_of_cart .= "ZIP:           $itrans{'zip'}\n";
+$orderLoggingHash{'orderFromPostal'} = "$itrans{'zip'}";
+
+$text_of_cart .= "COUNTRY:       $itrans{'country'}\n";
+$orderLoggingHash{'orderFromCountry'} = "$itrans{'country'}";
+
+$text_of_cart .= "PHONE:         $itrans{'phone'}\n";
+$orderLoggingHash{'customerPhone'} = "$itrans{'phone'}";
+
+$text_of_cart .= "EMAIL:         $itrans{'email'}\n\n";
+$orderLoggingHash{'emailAddress'} = "$itrans{'email'}";
+
+$text_of_cart .= "SHIPPING INFORMATION --------------\n\n";
+
+if ($itrans{'slname'} ne'') {
+$text_of_cart .= "NAME:          $itrans{'sfname'} $itrans{'slname'}\n";
+$orderLoggingHash{'shipToName'} = "$itrans{'sfname'} $itrans{'slname'}";
+} else {
+$text_of_cart .= "NAME:          $itrans{'first_name'} $itrans{'last_name'}\n";
+$orderLoggingHash{'shipToName'} = "$itrans{'first_name'} $itrans{'last_name'}";
+}
+
+if ($itrans{'saddr'} ne'') {
+$text_of_cart .= "ADDRESS:       $itrans{'saddr'}\n";
+$orderLoggingHash{'shipToAddress'} = "$itrans{'saddr'}";
+} else {
+$text_of_cart .= "ADDRESS:       $itrans{'address'}\n";
+$orderLoggingHash{'shipToAddress'} = "$itrans{'address'}";
+}
+
+if ($itrans{'scity'} ne'') {
+$text_of_cart .= "CITY:          $itrans{'scity'}\n";
+$orderLoggingHash{'shipToCity'} = "$itrans{'scity'}";
+} else {
+$text_of_cart .= "CITY:          $itrans{'city'}\n";
+$orderLoggingHash{'shipToCity'} = "$itrans{'city'}";
+}
+
+if ($itrans{'sstate'} ne'') {
+$text_of_cart .= "STATE:         $itrans{'sstate'}\n";
+$orderLoggingHash{'shipToState'} = "$itrans{'sstate'}";
+} else {
+$text_of_cart .= "CITY:          $eform_Ecom_ShipTo_Postal_StateProv\n";
+$orderLoggingHash{'shipToState'} = "$eform_Ecom_ShipTo_Postal_StateProv";
+}
+
+if ($itrans{'szip'} ne'') {
+$text_of_cart .= "ZIP:           $itrans{'szip'}\n";
+$orderLoggingHash{'shipToPostal'} = "$itrans{'szip'}";
+} else {
+$text_of_cart .= "ZIP:           $eform_Ecom_ShipTo_Postal_PostalCode\n";
+$orderLoggingHash{'shipToPostal'} = "$eform_Ecom_ShipTo_Postal_PostalCode";
+}
+
+if ($itrans{'sctry'} ne'') {
+$text_of_cart .= "COUNTRY:       $itrans{'sctry'}\n\n";
+$orderLoggingHash{'shipToCountry'} = "$itrans{'sctry'}";
+} else {
+$text_of_cart .= "COUNTRY:       $vform_Ecom_ShipTo_Postal_CountryCode\n";
+$orderLoggingHash{'shipToCountry'} = "$vform_Ecom_ShipTo_Postal_CountryCode";
+}
+
+if ($sc_use_SBW =~ /yes/i) {
+  $text_of_cart .= "SHIP VIA:      $itrans{'Ecom_ShipTo_Method'}\n";
+ }
+
+# NEW CODEHOOK
+&codehook("process-order-pre-ship-instructions");
+
+if ($ship_instructions ne "") {
+  $text_of_cart .= "Shipping Instructions: \n$ship_instructions\n\n";
+ }
+
+# NEW CODEHOOK
+&codehook("process-order-pre-xcomments");
+
+$text_of_cart .= $XCOMMENTS_ADMIN;
+$orderLoggingHash{'adminMessages'} = "$XCOMMENTS_ADMIN";
+$orderLoggingHash{'adminMessages'} =~ s/\n/<br>/g;
+$orderLoggingHash{'adminMessages'} =~ s/\t/ /g;
+$orderLoggingHash{'adminMessages'} .= "<br>AUTHORIZATION INFORMATION --------------<br>AUTH CODE:  $itrans{'authcode'}<br>TIME:  $itrans{'when'}<br>TRANS ID:  $itrans{'xid'}<br>---------------------------------------------------------------<br>";
+$text_of_confirm_email .= $XCOMMENTS;
+$orderLoggingHash{'xcomments'} = "$XCOMMENTS";
+$orderLoggingHash{'xcomments'} =~ s/\n/<br>/g;
+$orderLoggingHash{'adminMessages'} =~ s/\t/ /g;
+
+# 'Init' the emails ...
+$text_of_cart = &init_shop_keep_email . $text_of_cart;
+$text_of_confirm_email = &init_customer_email . $text_of_confirm_email;
+
+# and add the rest ...
+$text_of_admin_email .= &addto_shop_keep_email;
+$text_of_confirm_email .= &addto_customer_email;
+
+if ($sc_use_pgp =~ /yes/i) {
+  &require_supporting_libraries(__FILE__, __LINE__, "$sc_pgp_lib_path");
+  $text_of_cart = &make_pgp_file($text_of_cart,"$sc_pgp_temp_file_path/$$.pgp");
+  $text_of_cart = "\n" . $text_of_cart . "\n";
+ }
+
+$sc_niftypay_order_desc .= " - " . $itrans{'p5'};
+
+if ($sc_send_order_to_email =~ /yes/i) {
+  &send_mail($sc_admin_email, $sc_order_email, $sc_niftypay_order_desc, $text_of_cart);
+ }
+
+&log_order($text_of_cart,$itrans{'p5'},$itrans{'p4'});
+
+if (($cartData) && ($itrans{'email'} ne "")) {
+  &send_mail($sc_admin_email, $itrans{'email'}, $messages{'ordcnf_08'},
+           "$text_of_confirm_email");
+ }
+$sc_affiliate_order_unique = $itrans{'p5'};
+$sc_affiliate_order_total = $itrans{'total'};
+
+$sc_affiliate_image_call =~ s/AMOUNT/$sc_affiliate_order_total/g;
+$sc_affiliate_image_call =~ s/UNIQUE/$sc_affiliate_order_unique/g;
+
+# NEW CODEHOOK
+&codehook("process-order-display-thankyou-page");
+  
+print <<ENDOFTEXT;
+<CENTER>
+<TABLE WIDTH=500>
+<TR>
+<TD WIDTH=500>
+<FONT FACE=ARIAL>
+$messages{'ordcnf_01'}
+$messages{'ordcnf_02'}
+<br>
+$sc_affiliate_image_call
+</FONT>
+</TD>
+</TR>
+</TABLE>
+<CENTER>  
+
+ENDOFTEXT
+
+# This empties the cart after the order is successful
+&empty_cart;
+
+# and the footer is printed
+
+&SecureStoreFooter;
+
+print qq!
+</BODY>
+</HTML>
+!;
+
+} # End of process_order_form
+
+#################################################################
+1; # Library
diff -ruN 4.0K-4b/library/Offline-mgr_lib.pl 5.0.000/library/Offline-mgr_lib.pl
--- 4.0K-4b/library/Offline-mgr_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/Offline-mgr_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,10 +1,10 @@
 #
 # For the 'Offline' CC and Check Processing Gateway
-# Requires atleast 4.0K non-SSI versions and above.
+# Requires atleast 5.0.0 versions and above.
 #
 # Copyright 2000,2001 Steve Kneizys.
-# Copyright 2002, 2003 K-Factor Technologies, Inc.  All Rights Reserved.
-$versions{'Offline-mgr_lib.pl'} = "20030306";
+# Copyright 2002-present K-Factor Technologies, Inc.  All Rights Reserved.
+$versions{'Offline-mgr_lib.pl'} = "5.0.000";
 &add_codehook("gateway_admin_screen","Offline_mgr_check");
 &add_codehook("gateway_admin_settings","Offline_settings");
 $mc_gateways .= "|Offline";
@@ -16,29 +16,28 @@
     &my_die("Can't Open $gateway_settings");
   print (GATEWAY  "\$sc_order_script_url = \"$in{'order_url'}\";\n");
   print (GATEWAY  "\$sc_Offline_CC_validation = \"$in{'CC_validation'}\";\n");
+  print (GATEWAY  "\$sc_display_checkout_tos = \"$in{'sc_display_checkout_tos'}\";\n");
   print (GATEWAY  "\$sc_allow_pay_by_check = \"$in{'pay_by_check'}\";\n");
+  print (GATEWAY  "\$sc_allow_pay_by_mailedcheck = \"$in{'pay_by_mailedcheck'}\";\n");
   print (GATEWAY  "\$sc_allow_pay_by_PO = \"$in{'pay_by_PO'}\";\n");
   print (GATEWAY  "\$sc_allow_pay_by_CC = \"$in{'pay_by_CC'}\";\n");
   print (GATEWAY  "\$sc_take_discover = \"$in{'sc_take_discover'}\";\n");
   print (GATEWAY  "\$sc_take_amex = \"$in{'sc_take_amex'}\";\n");
   print (GATEWAY  "\$sc_Offline_show_table = \"$in{'show_table'}\";\n");
-  print (GATEWAY  "\$sc_upsgroundres = \"$in{'sc_upsgroundres'}\";\n");
-  print (GATEWAY  "\$sc_upsgroundcomm = \"$in{'sc_upsgroundcomm'}\";\n");
-  print (GATEWAY  "\$sc_ups2da = \"$in{'sc_ups2da'}\";\n");
-  print (GATEWAY  "\$sc_ups1da = \"$in{'sc_ups1da'}\";\n");
-  print (GATEWAY  "\$sc_fedexprioiryovernight = \"$in{'sc_fedexprioiryovernight'}\";\n");
-  print (GATEWAY  "\$sc_fedexexpress = \"$in{'sc_fedexexpress'}\";\n");
-  print (GATEWAY  "\$sc_fedexground = \"$in{'sc_fedexground'}\";\n");
-  print (GATEWAY  "\$sc_fedexhome = \"$in{'sc_fedexhome'}\";\n");
-  print (GATEWAY  "\$sc_uspsparcelpost = \"$in{'sc_uspsparcelpost'}\";\n");
-  print (GATEWAY  "\$sc_uspsprioritymail = \"$in{'sc_uspsprioritymail'}\";\n");
-  print (GATEWAY  "\$sc_uspsexpressmail = \"$in{'sc_uspsexpressmail'}\";\n");
+$sc_tos_display_address_temp = &my_escape($in{'sc_tos_display_address'});
+  print (GATEWAY  "\$sc_tos_display_address = qq'$sc_tos_display_address_temp';\n");
+$sc_mailedfunds_address_temp = &my_escape($in{'sc_mailedfunds_address'});
+  print (GATEWAY  "\$sc_mailedfunds_address = qq'$sc_mailedfunds_address_temp';\n");
 $sc_offline_top_message_temp = &my_escape($in{'sc_offline_top_message'});
   print (GATEWAY  "\$sc_offline_top_message = qq'$sc_offline_top_message_temp';\n");
 $sc_offline_shipping_message_temp = &my_escape($in{'sc_offline_shipping_message'});
   print (GATEWAY  "\$sc_offline_shipping_message = qq'$sc_offline_shipping_message_temp';\n");
 $sc_offline_special_message_temp = &my_escape($in{'sc_offline_special_message'});
   print (GATEWAY  "\$sc_offline_special_message = qq'$sc_offline_special_message_temp';\n");
+$sc_offline_verifypage_message_temp = &my_escape($in{'sc_offline_verifypage_message'});
+  print (GATEWAY  "\$sc_offline_verifypage_message = qq'$sc_offline_verifypage_message_temp';\n");
+  print (GATEWAY  "\$sc_Offline_mailedfunds_order_button = \"$in{'sc_Offline_mailedfunds_order_button'}\";\n");
+  print (GATEWAY  "\$sc_offline_enable_cvv = \"$in{'sc_offline_enable_cvv'}\";\n");
   &codehook("manager_write_gateway_settings");
   &codehook("Offline_mgr_write_settings");
   print (GATEWAY  "1\;\n");
@@ -55,10 +54,6 @@
 ##############################################################################
 sub print_Offline_mgr_form {
 
-##
-## OFFLINE PROCESSING
-##
-
 print &$manager_page_header("$sc_gateway_name Gateway","","","","");
 
 print <<ENDOFTEXT;
@@ -99,18 +94,31 @@
 if ($sc_allow_pay_by_check eq '') { # default it in
   $sc_allow_pay_by_check = 'yes';
  }
+if ($sc_allow_pay_by_check eq '') { # default it in
+  $sc_allow_pay_by_mailedcheck = 'no';
+ }
 if ($sc_allow_pay_by_PO eq '') { # default it in
   $sc_allow_pay_by_PO = 'no';
  }
-#if ($sc_allow_pay_by_CC eq '') { # default it in
-#  $sc_allow_pay_by_CC = 'yes';
-# }
+if ($sc_allow_pay_by_CC eq '') { # default it in
+  $sc_allow_pay_by_CC = 'yes';
+ }
 if ($sc_Offline_show_table eq '') { # default it in
-  $sc_Offline_show_table = 'no';
+  $sc_Offline_show_table = 'yes';
  }
 if ($sc_Offline_CC_validation eq '') { # default it in
   $sc_Offline_CC_validation = $sc_CC_validation;
  }
+if ($sc_display_checkout_tos eq '') { # default it in
+  $sc_display_checkout_tos = "yes";
+ }
+if ($sc_offline_verifypage_message eq '') { # default it in
+  $sc_offline_verifypage_message = "$messages{'ordcnf_04'}";
+ }
+if ($sc_offline_enable_cvv eq '') { # do not show unless agreement to legals acknowledged
+  $sc_offline_enable_cvv = "no";
+ }
+
 print <<ENDOFTEXT;
 
 <FONT FACE=ARIAL SIZE=2>
@@ -137,14 +145,21 @@
 </TR>
 
 <TR>
-<TD COLSPAN=2><HR></TD>
+<TD COLSPAN=2><HR><br></TD>
 </TR>
 
 <TR>
 <TD COLSPAN=2><TABLE WIDTH="100%"><TR>
-<TD>Allowed Payment Methods (in addtion to Credit Cards):</TD>
+<TD>Allowed Payment Methods:<br>(<small>need aleast one selected)</small></TD>
 <TD>
-Check:<br>
+Credit Card:<br>
+<SELECT NAME="pay_by_CC">
+<OPTION>$sc_allow_pay_by_CC</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT>
+</TD>
+<TD>Check/Cheque:<br>
 <SELECT NAME="pay_by_check">
 <OPTION>$sc_allow_pay_by_check</OPTION>
 <OPTION>yes</OPTION>
@@ -152,6 +167,15 @@
 $mc_pay_by_check_special_option
 </SELECT>
 </TD>
+<TD>
+Mailed Check:<br>
+<SELECT NAME="pay_by_mailedcheck">
+<OPTION>$sc_allow_pay_by_mailedcheck</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+$mc_pay_by_mailedcheck_special_option
+</SELECT>
+</TD>
 <TD>Purchase Order:<BR>
 <SELECT NAME="pay_by_PO">
 <OPTION>$sc_allow_pay_by_PO</OPTION>
@@ -165,7 +189,7 @@
 
 
 <TR>
-<TD COLSPAN=2><HR></TD>
+<TD COLSPAN=2><br><HR><br></TD>
 </TR>
 
 <TR>
@@ -183,19 +207,19 @@
 </TR>
 
 <TR>
-<TD COLSPAN=2><HR></TD>
+<TD COLSPAN=2><br><HR><br></TD>
 </TR>
 
 <TR>
 <TD>Visa and Master Cards are accepted by default.  Please indicate if you accept Discover and American Express</TD>
-<TD><b>Discover:</b> 
+<TD><b>Discover:</b><br>
 <SELECT NAME="sc_take_discover">
 <OPTION>$sc_take_discover</OPTION>
 <OPTION>yes</OPTION>
 <OPTION>no</OPTION>
 </SELECT><br><br>
 
-<b>American Express:</b> 
+<b>American Express:</b><br> 
 <SELECT NAME="sc_take_amex">
 <OPTION>$sc_take_amex</OPTION>
 <OPTION>yes</OPTION>
@@ -205,160 +229,116 @@
 </TR>
 
 <TR>
-<TD COLSPAN=2><HR></TD>
+<TD COLSPAN=2><HR><br></TD>
 </TR>
 
 <TR>
 <TD COLSPAN=2>
-Please enter the Secure URL to your agora.cgi store.
+Please enter the Secure URL to your AgoraCart store<br>(complete location including the agora.cgi file)<br>
+<small>if you do not have SSL or shared SSL, enter the non-SSL URL to the store<br>(complete location to including agora.cgi file)</small>
 </TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2>
+<TD COLSPAN=2><br>
 <INPUT NAME="order_url" TYPE="TEXT" SIZE=60
 VALUE="$sc_order_script_url"><br>
 </TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2><HR></TD>
+<TD COLSPAN=2><br><HR><br></TD>
 </TR>
 
 <TR>
-<TD>Do you offer UPS Ground Residential</TD>
-<TD>
-<SELECT NAME="sc_upsgroundres">
-<OPTION>$sc_upsgroundres</OPTION>
-<OPTION>yes</OPTION>
-<OPTION>no</OPTION>
-</SELECT>
-</TD>
-</TR>
-<TR>
-<TD>Do you offer UPS Ground Commercial</TD>
-<TD>
-<SELECT NAME="sc_upsgroundcomm">
-<OPTION>$sc_upsgroundcomm</OPTION>
-<OPTION>yes</OPTION>
-<OPTION>no</OPTION>
-</SELECT>
-</TD>
-</TR>
-<TR>
-<TD>Do you offer UPS 2nd Day</TD>
-<TD>
-<SELECT NAME="sc_ups2da">
-<OPTION>$sc_ups2da</OPTION>
-<OPTION>yes</OPTION>
-<OPTION>no</OPTION>
-</SELECT>
-</TD>
-</TR>
-<TR>
-<TD>Do you offer UPS Next Day</TD>
+<TD COLSPAN=2><TABLE WIDTH="100%"><TR>
+<TD>Display Terms of Service and Refund Policy checkbox and set as required?</TD>
 <TD>
-<SELECT NAME="sc_ups1da">
-<OPTION>$sc_ups1da</OPTION>
+<SELECT NAME="sc_display_checkout_tos">
+<OPTION>$sc_display_checkout_tos</OPTION>
 <OPTION>yes</OPTION>
 <OPTION>no</OPTION>
 </SELECT>
 </TD>
+</TR></TABLE></TD>
 </TR>
-<TR>
-<TD>Do you offer FedEx Priority Overnight</TD>
-<TD>
-<SELECT NAME="sc_fedexprioiryovernight">
-<OPTION>$sc_fedexprioiryovernight</OPTION>
-<OPTION>yes</OPTION>
-<OPTION>no</OPTION>
-</SELECT>
+<TR><TD COLSPAN=2><br>
+Business address and phone number (contact information) for your business.  Should be legal address for the business location for full disclosure and other privacy requirements mandated by credit card companies as well as government enitities that require such notices:<br>
+<TEXTAREA NAME="sc_tos_display_address" 
+cols="68" rows=5 
+wrap=off>$sc_tos_display_address</TEXTAREA><br>
+
 </TD>
 </TR>
+
 <TR>
-<TD>Do you offer FedEx Express Saver</TD>
-<TD>
-<SELECT NAME="sc_fedexexpress">
-<OPTION>$sc_fedexexpress</OPTION>
-<OPTION>yes</OPTION>
-<OPTION>no</OPTION>
-</SELECT>
-</TD>
-</TR>
-<TR>
-<TD>Do you offer FedEx Ground</TD>
-<TD>
-<SELECT NAME="sc_fedexground">
-<OPTION>$sc_fedexground</OPTION>
-<OPTION>yes</OPTION>
-<OPTION>no</OPTION>
-</SELECT>
-</TD>
+<TD COLSPAN=2><br><HR><br></TD>
 </TR>
+
+<TR><TD COLSPAN=2>
+Mailing address message for Offline form.  Place the mailing address you would like checks/cheques, money orders, etc mailed to.  enter &lt;br> to start a new line.Leave blank if not needed:<br>
+<TEXTAREA NAME="sc_mailedfunds_address" 
+cols="68" rows=5 
+wrap=off>$sc_mailedfunds_address</TEXTAREA><br><br><br>
+
+
+Top message for Offline form.  Allows you to place a message above the Payment Information area and just below the cart total boxes.  HTML formatting (for text color, font, spacing, etc) is accepted.  Leave blank if not needed:<br>
+<TEXTAREA NAME="sc_offline_top_message" 
+cols="68" rows=8 
+wrap=off>$sc_offline_top_message</TEXTAREA><br><br><br>
+
+Shipping message for Offline form.  Allows you to place a message in the Shipping Information area of the Offline form.  HTML formatting (for text color, font, spacing, etc) is accepted.  Leave blank if not needed:<br>
+<TEXTAREA NAME="sc_offline_shipping_message" 
+cols="68" rows=8 
+wrap=off>$sc_offline_shipping_message</TEXTAREA><br><br><br>
+
+Message for Special Message area for Offline form.  Allows you to place a message just above the Special Message area of the Offline form.  HTML formatting (for text color, font, spacing, etc) is accepted.  Leave blank if not needed:<br>
+<TEXTAREA NAME="sc_offline_special_message" 
+cols="68" rows=8 
+wrap=off>$sc_offline_special_message</TEXTAREA><br><br>
+</TD></TR>
+
 <TR>
-<TD>Do you offer FedEx Home Delivery</TD>
-<TD>
-<SELECT NAME="sc_fedexhome">
-<OPTION>$sc_fedexhome</OPTION>
-<OPTION>yes</OPTION>
-<OPTION>no</OPTION>
-</SELECT>
-</TD>
+<TD COLSPAN=2><HR><br></TD>
 </TR>
+<TR><TD COLSPAN=2>
+Message for top of verify page for Offline step 2 checkout.  Allows you to place a message just above the information to verify on step 2 of the checkout process (after submitting the Offline form) - would also be located above the mailed funds address (if mailed funds option is used).  HTML formatting (for text color, font, spacing, etc) is accepted.  Leave blank if not needed:<br>
+<TEXTAREA NAME="sc_offline_verifypage_message" 
+cols="68" rows=8 
+wrap=off>$sc_offline_verifypage_message</TEXTAREA><br><br>
+
+</TD></TR>
+
 <TR>
-<TD>Do you offer USPS Parcel Post</TD>
+<TD>Show Submit Order Button if Mailed Funds is Selected for Payment?
+<small>if customer elects to mail funds, do you wish to show the submit order button?</small></TD>
 <TD>
-<SELECT NAME="sc_uspsparcelpost">
-<OPTION>$sc_uspsparcelpost</OPTION>
+<SELECT NAME="sc_Offline_mailedfunds_order_button">
+<OPTION>$sc_Offline_mailedfunds_order_button</OPTION>
 <OPTION>yes</OPTION>
 <OPTION>no</OPTION>
 </SELECT>
 </TD>
 </TR>
 <TR>
-<TD>Do you offer USPS Priority Mail</TD>
-<TD>
-<SELECT NAME="sc_uspsprioritymail">
-<OPTION>$sc_uspsprioritymail</OPTION>
-<OPTION>yes</OPTION>
-<OPTION>no</OPTION>
-</SELECT>
-</TD>
+<TD COLSPAN=2><br><HR><br></TD>
 </TR>
+
 <TR>
-<TD>Do you offer USPS Express Mail</TD>
+<TD COLSPAN=2><TABLE WIDTH="100%"><TR>
+<TD><b>Enable CCV n Offline order for?</b> (default is no, and for very good reasons)<br><font color=red>WARNING:</font> Do not enable this unless you have good reason, or have an approved server that meets lawful security requirements (according to your credit card merchant account agreement and governing laws in your country).  It could be against the law and subject you to criminal and civil liabilities of an extreme magnitude including but not limited to jail time, full discloseure if data or server is compromised or might have been, payment of very high fines and legal fees, embarrassment, and distrust from the public.  By enabling this feature, you willingly agree to the following: that you, your company, and all concerned/affiliated agents, companies, customers, officers, et al hold AgoraCart and all affiliated divisions, agents, companies, officers, et al harmless from any and all legal action as well as protect the above from all other liabilities or punitive damages arising from your misuse of client data. Furthermore you, of your own freewill and desire, knowingly endanger your customers and their personal data, and furthermore you are also acknowledging the fact that you are purposely, and of your own freewill and desire, ignoring the outlined laws and proceedures set forth by credit card companies and the laws of the USA and all governing localities and municipalities (should you be subject to the laws of the US).</TD>
 <TD>
-<SELECT NAME="sc_uspsexpressmail">
-<OPTION>$sc_uspsexpressmail</OPTION>
+<SELECT NAME="sc_offline_enable_cvv">
+<OPTION>$sc_offline_enable_cvv</OPTION>
 <OPTION>yes</OPTION>
 <OPTION>no</OPTION>
 </SELECT>
 </TD>
+</TR></TABLE></TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2><HR></TD>
-</TR>
-
-<TR><TD COLSPAN=2>
-Top message for Offline form.  Allows you to place a message above the Payment Information area and just below the cart total boxes.  HTML formatting (for text color, font, spacing, etc) is accepted.  Leave blank if not needed:<br>
-<TEXTAREA NAME="sc_offline_top_message" 
-cols="68" rows=8 
-wrap=off>$sc_offline_top_message</TEXTAREA> <br><br>
-
-Shipping message for Offline form.  Allows you to place a message in the Shipping Information area of the Offline form.  HTML formatting (for text color, font, spacing, etc) is accepted.  Leave blank if not needed:<br>
-<TEXTAREA NAME="sc_offline_shipping_message" 
-cols="68" rows=8 
-wrap=off>$sc_offline_shipping_message</TEXTAREA> <br><br>
-
-Message for Special Message area for Offline form.  Allows you to place a message just above the Special Message area of the Offline form.  HTML formatting (for text color, font, spacing, etc) is accepted.  Leave blank if not needed:<br>
-<TEXTAREA NAME="sc_offline_special_message" 
-cols="68" rows=8 
-wrap=off>$sc_offline_special_message</TEXTAREA> <br><br>
-</TD></TR>
-
-<TR>
-<TD COLSPAN=2><HR></TD>
+<TD COLSPAN=2><HR><br></TD>
 </TR>
 
 <TR>
diff -ruN 4.0K-4b/library/Offline-order_lib.pl 5.0.000/library/Offline-order_lib.pl
--- 4.0K-4b/library/Offline-order_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/Offline-order_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -2,7 +2,7 @@
 #                    Order Form Definition Variables                  #
 #######################################################################
 
-$versions{'Offline-order_lib.pl'} = "20021006";
+$versions{'Offline-order_lib.pl'} = "5.0.000";
 
 $order_lib_cc_validate = "yes";
 $sc_use_secure_header_at_checkout = 'yes';
@@ -48,7 +48,7 @@
 sub Offline_check_and_load {
 local($myname)="Offline";
 #
-if ($myname ne $sc_gateway_name) { 
+if ($myname ne $sc_gateway_name) { # we are a secondary gateway, load settings
   &require_supporting_libraries(__FILE__,__LINE__,
      "./admin_files/$myname-user_lib.pl");
  }
@@ -60,6 +60,7 @@
 ###############################################################################
 sub Offline_response_prep {
 &Offline_check_and_load;
+# We default the Shipto info to Billto if left blank
 if ($form_data{'Ecom_ShipTo_Postal_PostalCode'} eq "") {
   if ($form_data{'Ecom_BillTo_PostalCode'} ne "") {
   $form_data{'Ecom_ShipTo_Postal_PostalCode'} = 
@@ -106,14 +107,24 @@
    }
  }
 
+if ($form_data{'Ecom_ShipTo_Postal_CountryCode'} eq "") {
+  if ($form_data{'Ecom_BillTo_Postal_CountryCode'} ne "") {
+  $form_data{'Ecom_ShipTo_Postal_CountryCode'} = 
+       $form_data{'Ecom_BillTo_Postal_CountryCode'};
+   }
+ }
+
+
+# Need to do this here so it gets to the verify file
 $sc_paid_by_ccard = "";
 $form_data{"Ecom_Payment_Orig_Card_Type"} = 
-		$form_data{"Ecom_Payment_Card_Type"};
+    $form_data{"Ecom_Payment_Card_Type"};
 $form_data{"Ecom_Payment_Orig_Card_Number"} = 
-		$form_data{"Ecom_Payment_Card_Number"};
+    $form_data{"Ecom_Payment_Card_Number"};
 if ($form_data{"Ecom_Payment_Card_Type"} ne "" ) {
   if ((!($form_data{"Ecom_Payment_Card_Type"} =~ /check/i)) &&
     (!($form_data{"Ecom_Payment_Card_Type"} =~ /cheque/i)) &&
+    (!($form_data{"Ecom_Payment_Card_Type"} =~ /Mailed/i)) &&
     (!($form_data{"Ecom_Payment_Card_Type"} =~ /PO/i))) {
   # must be a Credit Card
     $sc_paid_by_ccard = "yes";
@@ -134,6 +145,10 @@
         $form_data{"Ecom_Payment_BankAcct_Number"} . " #:" .
         $form_data{"Ecom_Payment_BankCheck_Number"};  
       $form_data{"Ecom_Payment_Pay_Type"} = 'CHECK'; 
+    } elsif ($sc_allow_pay_by_mailedcheck =~ /yes/i ) {
+      $form_data{"Ecom_Payment_Card_Type"} = "MailedFunds";
+      $form_data{"Ecom_Payment_Card_Number"} = "Mailed Funds";
+      $form_data{"Ecom_Payment_Pay_Type"} = 'MailedFunds'; 
      } 
    } 
  }
@@ -153,13 +168,14 @@
  }
 ###############################################################################
 sub Offline_pre_header_processing {
+# May want to change the header for no-cache under certain circumstances
    if (($form_data{'order_form_button.x'} ne "") ||
        ($form_data{'submit_order_form_button'} ne "") ||
        ($form_data{'submit_order_form_button.x'} ne "") ||
        ($form_data{'order_form_button'} ne "")) {
      $sc_browser_header = 
-	"Content-type: text/html\nCache-Control: no-cache\n" .
-	"Pragma: no-cache\nExpires: Wed, 4 October 2000 00:00:00 GMT\n\n";
+  "Content-type: text/html\nCache-Control: no-cache\n" .
+  "Pragma: no-cache\nExpires: Wed, 4 October 2000 00:00:00 GMT\n\n";
    }
  }
 ###############################################################################
@@ -169,49 +185,63 @@
 if (!($form_data{'gateway'} eq $myname)) { return;} 
 
 %sc_order_form_array =('Ecom_BillTo_Postal_Name_First', 'First Name',
-		       'Ecom_BillTo_Postal_Name_Last', 'Last Name',
-		       'Ecom_BillTo_Postal_Street_Line1', 'Billing Address Street',
-		       'Ecom_BillTo_Postal_City', 'Billing Address City',
-		       'Ecom_BillTo_Postal_StateProv', 'Billing Address State',
-		       'Ecom_BillTo_PostalCode', 'Billing Address Zip',
-		       'Ecom_BillTo_Postal_CountryCode', 'Billing Address Country',
-		       'Ecom_ShipTo_Postal_Name_First', 'Ship To First Name',
-		       'Ecom_ShipTo_Postal_Name_Last', 'Ship To Last Name',
-		       'Ecom_ShipTo_Postal_Street_Line1', 'Shipping Address Street',
-		       'Ecom_ShipTo_Postal_City', 'Shipping Address City',
-		       'Ecom_ShipTo_Postal_StateProv', 'Shipping Address State',
-		       'Ecom_ShipTo_Postal_PostalCode', 'Shipping Address Zip',
-		       'Ecom_ShipTo_Postal_CountryCode', 'Shipping Address Country',
-		       'Ecom_BillTo_Telecom_Phone_Number', 'Phone Number',
-		       'Ecom_BillTo_Online_Email', 'Email',
-		       'Ecom_Payment_Card_Number', 'Card or Check Number',
-		       'Ecom_Payment_Card_ExpDate_Month', 'Card Expiration Month',
-		       'Ecom_Payment_Card_ExpDate_Day', 'Card Expiration Day',
-		       'Ecom_Payment_Card_ExpDate_Year', 'Card Expiration Year',
-		       'Ecom_Payment_Card_CVV', 'Card CVV Value');
-			
+           'Ecom_BillTo_Postal_Name_Last', 'Last Name',
+           'Ecom_BillTo_Postal_Street_Line1', 'Billing Address Street',
+           'Ecom_BillTo_Postal_City', 'Billing Address City',
+           'Ecom_BillTo_Postal_StateProv', 'Billing Address State',
+           'Ecom_BillTo_PostalCode', 'Billing Address Zip',
+           'Ecom_BillTo_Postal_CountryCode', 'Billing Address Country',
+           'Ecom_ShipTo_Postal_Name_First', 'Ship To First Name',
+           'Ecom_ShipTo_Postal_Name_Last', 'Ship To Last Name',
+           'Ecom_ShipTo_Postal_Street_Line1', 'Shipping Address Street',
+           'Ecom_ShipTo_Postal_City', 'Shipping Address City',
+           'Ecom_ShipTo_Postal_StateProv', 'Shipping Address State',
+           'Ecom_ShipTo_Postal_PostalCode', 'Shipping Address Zip',
+           'Ecom_ShipTo_Postal_CountryCode', 'Shipping Address Country',
+           'Ecom_BillTo_Telecom_Phone_Number', 'Phone Number',
+           'Ecom_BillTo_Online_Email', 'Email',
+           'Ecom_Payment_Card_Number', 'Card or Check Number',
+           'Ecom_Payment_Card_ExpDate_Month', 'Card Expiration Month',
+           'Ecom_Payment_Card_ExpDate_Year', 'Card Expiration Year',
+           'Ecom_is_Residential', 'Shipping to Residential Address',
+           'Ecom_ShipTo_Insurance', 'Insure this Shipment', # not implemented yet, for the future
+           'Ecom_Payment_Card_CVV', 'Card CVV Value',
+           'Ecom_tos', 'Sales-Terms of Service');
+     
 {
   local($mytypes)='credit card';
   if ($sc_allow_pay_by_check =~ /yes/i ) {$mytypes .= "/check";}
-  if ($sc_allow_pay_by_PO    =~ /yes/i ) {$mytypes .= "/PO";}
+  if ($sc_allow_pay_by_PO =~ /yes/i ) {$mytypes .= "/PO";}
+  if ($sc_allow_pay_by_mailedcheck =~ /yes/i ) {$mytypes .= "/MailedFunds";}
   $sc_order_form_array{'Ecom_Payment_Card_Type'} = "Payment type ($mytypes)";
  }
 
 @sc_order_form_required_fields = ("Ecom_BillTo_Postal_Name_First",
-				  "Ecom_BillTo_Postal_Name_Last",
-				  "Ecom_BillTo_Postal_Street_Line1",
-				  "Ecom_BillTo_Postal_City",
-				  "Ecom_BillTo_Postal_StateProv",
-				  "Ecom_BillTo_PostalCode",        
-				  "Ecom_BillTo_Telecom_Phone_Number",
-				  "Ecom_BillTo_Online_Email",
-				  "Ecom_Payment_Card_Type",
-				  "Ecom_Payment_Card_Number");
+          "Ecom_BillTo_Postal_Name_Last",
+          "Ecom_BillTo_Postal_Street_Line1",
+          "Ecom_BillTo_Postal_City",
+          "Ecom_BillTo_Postal_StateProv",
+          "Ecom_BillTo_PostalCode",
+          "Ecom_BillTo_Postal_CountryCode", 
+          "Ecom_BillTo_Telecom_Phone_Number",
+          "Ecom_BillTo_Online_Email",
+          "Ecom_Payment_Card_Type",
+          "Ecom_Payment_Card_Number");
 
 if ($sc_paid_by_ccard =~ /yes/i) { 
    push(@sc_order_form_required_fields,"Ecom_Payment_Card_ExpDate_Month");
    push(@sc_order_form_required_fields,"Ecom_Payment_Card_ExpDate_Year");
-   push(@sc_order_form_required_fields,"Ecom_Payment_Card_CVV");
+
+    # CVV optional per Mr. Ed's request.
+    # should not be used anymore. users enabling this do so at their own risk.
+    if ($sc_offline_enable_cvv =~ /yes/i) {
+       push(@sc_order_form_required_fields,"Ecom_Payment_Card_CVV");
+    }
+ }
+
+# lines for tos added March 18 2006 by Mister Ed
+ if ($sc_display_checkout_tos =~ /yes/i) {
+    push(@sc_order_form_required_fields,"Ecom_tos");
  }
 
 }
@@ -221,6 +251,7 @@
 local($invoice_number, $customer_number);
 local($myname)="Offline";
 local($HREF_FIELDS) = &make_hidden_fields;
+my $top_message = '';
 
 if (!($form_data{'gateway'} eq $myname)) { return;} 
 &Offline_check_and_load;
@@ -231,79 +262,97 @@
 $customer_number =~ s/_/./g;
 
 print &get_Offline_confirm_middle(*form_data,$invoice_number,
-  $customer_number,$offline_ver_tbldef,$messages{'ordcnf_04'},
+  $customer_number,$offline_ver_tbldef,$top_message,
   $offline_ver_tbldef2,$authPrice,$time);
 
 print <<ENDOFTEXT;
-<TABLE WIDTH="500" BGCOLOR="#FFFFFF" CELLPADDING="2" CELLSPACING="0" BORDER=0>
-<TR>
-<TD WIDTH="50%">
-<CENTER><BR>
-<FORM METHOD=POST ACTION=\"$sc_order_script_url\">
+<div align="center">
+<table width="500" cellpadding="5" cellspacing="0" border="0">
+<tr>
+<td width="50%" align="center">
+<form method="post" action="$sc_order_script_url">
 <!--Order Financial Data-->
-<INPUT TYPE=HIDDEN NAME=cart_id VALUE=\"$cart_id\">
-<INPUT TYPE=HIDDEN NAME=AMOUNT VALUE=\"$formatted_price\">
-<INPUT TYPE=HIDDEN NAME=PLAINAMOUNT VALUE=\"$authPrice\">
-<INPUT TYPE=HIDDEN NAME=SUBTOTALAMT VALUE=\"$subtotal\">
-<INPUT TYPE=HIDDEN NAME=SHIPPING VALUE=\"$zfinal_shipping\">
-<INPUT TYPE=HIDDEN NAME=DISCOUNT VALUE=\"$zfinal_discount\">
-<INPUT TYPE=HIDDEN NAME=SALESTAX VALUE=\"$zfinal_sales_tax\">
-<INPUT TYPE=HIDDEN NAME=EXTRATAX1 VALUE=\"$zfinal_extra_tax1\">
-<INPUT TYPE=HIDDEN NAME=EXTRATAX2 VALUE=\"$zfinal_extra_tax2\">
-<INPUT TYPE=HIDDEN NAME=EXTRATAX3 VALUE=\"$zfinal_extra_tax3\">
-<INPUT TYPE=HIDDEN NAME=CVV VALUE=\"$eform_data{'Ecom_Payment_Card_CVV'}\">
+<input type="hidden" name="cart_id" value="$cart_id">
+<input type="hidden" name="AMOUNT" value="$formatted_price">
+<input type="hidden" name="PLAINAMOUNT" value="$authPrice">
+<input type="hidden" name="SUBTOTALAMT" value="$subtotal">
+<input type="hidden" name="SHIPPING" value="$zfinal_shipping">
+<input type="hidden" name="DISCOUNT" value="$zfinal_discount">
+<input type="hidden" name="SALESTAX" value="$zfinal_sales_tax">
+<input type="hidden" name="EXTRATAX1" value="$zfinal_extra_tax1">
+<input type="hidden" name="EXTRATAX2" value="$zfinal_extra_tax2">
+<input type="hidden" name="EXTRATAX3" value="$zfinal_extra_tax3">
+ENDOFTEXT
+
+# CVV optional per Mr. Ed's request.
+# should not be used anymore. users enabling this do so at their own risk.
+if ($sc_offline_enable_cvv =~ /yes/i) {
+print <<ENDOFTEXT;
+<input type="hidden" name="CVV" value="$eform_data{'Ecom_Payment_Card_CVV'}">
+ENDOFTEXT
+}
+
+
+print <<ENDOFTEXT;
 <!--Customer/Order Data-->
-<INPUT TYPE=HIDDEN NAME=CUSTID VALUE=\"$customer_number\">
-<INPUT TYPE=HIDDEN NAME=INVOICE VALUE=\"$invoice_number\">
-<INPUT TYPE=HIDDEN NAME=DESCRIPTION VALUE=\"Online Order\">
+<input type="hidden" name="CUSTID" value="$customer_number">
+<input type="hidden" name="INVOICE" value="$invoice_number">
+<input type="hidden" name="DESCRIPTION" value="Online Order">
+<!-- tac added to customer order data -->
+<INPUT TYPE=HIDDEN NAME="Sales Terms and Refund Policy" VALUE="$eform_data{'Ecom_tos'} $form_data{'Ecom_tos'}">
+<!-- misc additions to customer order data -->
+<INPUT TYPE=HIDDEN NAME="Ship to Residential Address" VALUE="$eform_data{'Ecom_is_Residential'} $form_data{'Ecom_is_Residential'}">
+<INPUT TYPE=HIDDEN NAME="Insure Shipment" VALUE="$eform_data{'Ecom_ShipTo_Insurance'} $form_data{'Ecom_ShipTo_Insurance'}">
 <!--Billing Address-->
-<INPUT TYPE=HIDDEN NAME=NAME VALUE=\"$eform_data{'Ecom_BillTo_Postal_Name_First'} $form_data{'Ecom_BillTo_Postal_Name_Last'}\">
-<INPUT TYPE=HIDDEN NAME=ADDRESS VALUE=\"$eform_data{'Ecom_BillTo_Postal_Street_Line1'}\">
-<INPUT TYPE=HIDDEN NAME=ADDRESS2 VALUE=\"$eform_data{'Ecom_BillTo_Postal_Street_Line2'}\">
-<INPUT TYPE=HIDDEN NAME=ADDRESS3 VALUE=\"$eform_data{'Ecom_BillTo_Postal_Street_Line3'}\">
-<INPUT TYPE=HIDDEN NAME=CITY VALUE=\"$eform_data{'Ecom_BillTo_Postal_City'}\">
-<INPUT TYPE=HIDDEN NAME=STATE VALUE=\"$eform_data{'Ecom_BillTo_Postal_StateProv'}\">
-<INPUT TYPE=HIDDEN NAME=ZIP VALUE=\"$eform_data{'Ecom_BillTo_PostalCode'}\">
-<INPUT TYPE=HIDDEN NAME=COUNTRY VALUE=\"$eform_data{'Ecom_BillTo_Postal_CountryCode'}\">
-<INPUT TYPE=HIDDEN NAME=PHONE VALUE=\"$eform_data{'Ecom_BillTo_Telecom_Phone_Number'}\">
-<INPUT TYPE=HIDDEN NAME=EMAIL VALUE=\"$eform_data{'Ecom_BillTo_Online_Email'}\">
+<input type="hidden" name="NAME" value="$eform_data{'Ecom_BillTo_Postal_Name_First'} $form_data{'Ecom_BillTo_Postal_Name_Last'}">
+<input type="hidden" name="ADDRESS" value="$eform_data{'Ecom_BillTo_Postal_Street_Line1'}">
+<input type="hidden" name="ADDRESS2" value="$eform_data{'Ecom_BillTo_Postal_Street_Line2'}">
+<input type="hidden" name="ADDRESS3" value="$eform_data{'Ecom_BillTo_Postal_Street_Line3'}">
+<input type="hidden" name="CITY" value="$eform_data{'Ecom_BillTo_Postal_City'}">
+<input type="hidden" name="STATE" value="$eform_data{'Ecom_BillTo_Postal_StateProv'}">
+<input type="hidden" name="ZIP" value="$eform_data{'Ecom_BillTo_PostalCode'}">
+<input type="hidden" name="COUNTRY" value="$eform_data{'Ecom_BillTo_Postal_CountryCode'}">
+<input type="hidden" name="PHONE" value="$eform_data{'Ecom_BillTo_Telecom_Phone_Number'}">
+<input type="hidden" name="EMAIL" value="$eform_data{'Ecom_BillTo_Online_Email'}">
 <!--Shipping Address-->
-<INPUT TYPE=HIDDEN NAME=HW2SHIP VALUE=\"$eform_data{'Ecom_ShipTo_Method'}\">
-<INPUT TYPE=HIDDEN NAME=SHIPNAME VALUE=\"$eform_data{'Ecom_ShipTo_Postal_Name_First'} $eform_data{'Ecom_ShipTo_Postal_Name_Last'}\">
-<INPUT TYPE=HIDDEN NAME=SHIPTOSTREET VALUE=\"$eform_data{'Ecom_ShipTo_Postal_Street_Line1'}\">
-<INPUT TYPE=HIDDEN NAME=SHIPTOSTREET2 VALUE=\"$eform_data{'Ecom_ShipTo_Postal_Street_Line2'}\">
-<INPUT TYPE=HIDDEN NAME=SHIPTOSTREET3 VALUE=\"$eform_data{'Ecom_ShipTo_Postal_Street_Line3'}\">
-<INPUT TYPE=HIDDEN NAME=SHIPTOCITY VALUE=\"$eform_data{'Ecom_ShipTo_Postal_City'}\">
-<INPUT TYPE=HIDDEN NAME=SHIPTOSTATE VALUE=\"$eform_data{'Ecom_ShipTo_Postal_StateProv'}\">
-<INPUT TYPE=HIDDEN NAME=SHIPTOZIP VALUE=\"$eform_data{'Ecom_ShipTo_Postal_PostalCode'}\">
-<INPUT TYPE=HIDDEN NAME=SHIPTOCOUNTRY VALUE=\"$eform_data{'Ecom_ShipTo_Postal_CountryCode'}\">
+<input type="hidden" name="HW2SHIP" value="$eform_data{'Ecom_ShipTo_Method'}">
+<input type="hidden" name="SHIPNAME" value="$eform_data{'Ecom_ShipTo_Postal_Name_First'} $eform_data{'Ecom_ShipTo_Postal_Name_Last'}">
+<input type="hidden" name="SHIPTOSTREET" value="$eform_data{'Ecom_ShipTo_Postal_Street_Line1'}">
+<input type="hidden" name="SHIPTOSTREET2" value="$eform_data{'Ecom_ShipTo_Postal_Street_Line2'}">
+<input type="hidden" name="SHIPTOSTREET3" value="$eform_data{'Ecom_ShipTo_Postal_Street_Line3'}">
+<input type="hidden" name="SHIPTOCITY" value="$eform_data{'Ecom_ShipTo_Postal_City'}">
+<input type="hidden" name="SHIPTOSTATE" value="$eform_data{'Ecom_ShipTo_Postal_StateProv'}">
+<input type="hidden" name="SHIPTOZIP" value="$eform_data{'Ecom_ShipTo_Postal_PostalCode'}">
+<input type="hidden" name="SHIPTOCOUNTRY" value="$eform_data{'Ecom_ShipTo_Postal_CountryCode'}">
 <!--Billing Data-->
-<INPUT TYPE=HIDDEN NAME=HCODE VALUE=\"$sc_pass_used_to_scramble\">
-<INPUT TYPE="HIDDEN" NAME="process_order" VALUE="yes">
-<INPUT TYPE="IMAGE" NAME="Submit" VALUE="Submit Order For Processing"
-SRC="$offline_picserve?secpicserve=submit_order.gif" border=0>
-&nbsp;&nbsp;&nbsp;&nbsp;
-</FORM>
-</CENTER>
-</TD><TD WIDTH="50%">
-<CENTER><BR>
-<FORM METHOD=POST
-ACTION="$sc_stepone_order_script_url">
-<INPUT TYPE=HIDDEN NAME="order_form_button" VALUE="1">
-$HREF_FIELDS
-<INPUT TYPE=HIDDEN NAME="HCODE" VALUE="$sc_pass_used_to_scramble">
-<INPUT TYPE=HIDDEN NAME="gateway" VALUE="Offline"> 
-<INPUT TYPE=HIDDEN NAME="ofn" VALUE="Offline"> 
-<INPUT TYPE="IMAGE" NAME="Make Changes" VALUE="Make Changes" 
-SRC="$offline_picserve?secpicserve=make_changes.gif" BORDER=0>
-</FORM>
-</CENTER>
-</TD>
-</TR>
-</TABLE>
+<input type="hidden" name="HCODE" value="$sc_pass_used_to_scramble">
+ENDOFTEXT
+
+if (($form_data{'Ecom_Payment_Pay_Type'} ne "MailedFunds") || (($form_data{'Ecom_Payment_Pay_Type'} eq "MailedFunds") && ($sc_Offline_mailedfunds_order_button eq "yes"))) {
+print <<ENDOFTEXT;
+<input type="hidden" name="process_order" value="yes">
+<input type="image" name="Submit" value="Submit Order For Processing" 
+  src="$offline_picserve?secpicserve=submit_order.gif">
+ENDOFTEXT
+}
 
-</FONT>
-</CENTER>
+print <<ENDOFTEXT;
+</form>
+</td>
+<td width="50%" align="center">
+<form method="post" action="$sc_stepone_order_script_url">
+<input type="hidden" name="order_form_button" value="1">
+$HREF_FIELDS
+<input type="hidden" name="HCODE" VALUE="$sc_pass_used_to_scramble">
+<input type="hidden" name="gateway" VALUE="Offline"> 
+<input type="hidden" name="ofn" VALUE="Offline"> 
+<input type="image" name="Make Changes" value="Make Changes" 
+  src="$offline_picserve?secpicserve=make_changes.gif">
+</form>
+</td>
+</tr>
+</table>
+</div>
 ENDOFTEXT
 }
 
@@ -312,6 +361,10 @@
 local(*form_data,$invoice_number,$customer_number,
 $tbldef,$top_message,$tbldef2,$authPrice,$time) = @_;
 
+my $temp_variable_thingy_for_mailedfunds = "";
+
+&read_verify_file;
+
 local($my_ShipTo_Postal_Street,$my_BillTo_Postal_Street,$formatted_price);
 local($answer)='';
 
@@ -333,287 +386,165 @@
 
 $formatted_price = &format_price($authPrice);
 
+my $temp_variable_thingy_for_mailedfunds =  qq~~;
+
+if ($form_data{'Ecom_Payment_Pay_Type'} eq "MailedFunds") {
+$temp_variable_thingy_for_mailedfunds =  qq~<p class="ac_checkout_top_msg">$sc_mailedfunds_address</p>~;
+}
+
+if ($top_message eq "") {
+$top_message = "$sc_offline_verifypage_message";
+}
+
 $answer.= <<ENDOFTEXT;
 
-<TABLE $tbldef>
+<div align="center">
+  <p class="ac_checkout_top_msg">$top_message</p>
 
-<TR BGCOLOR="#FFFFFF">
-<TD>
-&nbsp;
-</TD>
-</TR>
-
-<TR>
-<TD>
-<FONT FACE="ARIAL" SIZE="2" COLOR="#000000">
-$top_message
-</FONT>
-</TD>
-</TR>
-</TABLE>
-
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-<CENTER>
-<TABLE $tbldef2>
-<TR>
-<TD COLSPAN=2>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-<B>Customer Information</B>
-</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=100>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-Customer Number
-</FONT>
-</TD>
-<TD WIDTH=400>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$cart_id
-</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-Order Number
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$sc_temp_invoice_number
-</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD COLSPAN=2>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-<B>Billing Address</B>
-</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-Name
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$form_data{'Ecom_BillTo_Postal_Name_First'} $form_data{'Ecom_BillTo_Postal_Name_Last'}
-&nbsp;</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-Street
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$my_BillTo_Postal_Street
-&nbsp;</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-City
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$form_data{'Ecom_BillTo_Postal_City'}
-&nbsp;</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-State
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$form_data{'Ecom_BillTo_Postal_StateProv'}
-&nbsp;</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-Zip
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$form_data{'Ecom_BillTo_PostalCode'}
-&nbsp;</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-Country
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK> 
-$form_data{'Ecom_BillTo_Postal_CountryCode'}
-&nbsp;</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-Phone
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$form_data{'Ecom_BillTo_Telecom_Phone_Number'}
-&nbsp;</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-E-Mail
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$form_data{'Ecom_BillTo_Online_Email'}
-&nbsp;</FONT>
-</TD>
-</TR>
+$temp_variable_thingy_for_mailedfunds
+
+<table cellpadding="0" cellspacing="0" class="ac_checkout_review">
+<tr>
+<th colspan="2" class="ac_checkout_review">Customer Information</th>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Customer Number</td>
+<td class="ac_checkout_review_col2">$cart_id</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Order Number</td>
+<td class="ac_checkout_review_col2">$sc_temp_invoice_number</td>
+</tr>
+
+<!-- begin add tos -->
+<tr>
+<td class="ac_checkout_review_col1">Sales Terms and Refund Policy</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_tos'}</td>
+</tr>
+<!-- end add tos -->
+
+<tr>
+<th colspan="2" class="ac_checkout_review">Billing Address</th>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Name</td>
+<td class="ac_checkout_review_col2">
+  $form_data{'Ecom_BillTo_Postal_Name_First'} $form_data{'Ecom_BillTo_Postal_Name_Last'}
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Street</td>
+<td class="ac_checkout_review_col2">$my_BillTo_Postal_Street&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">City</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_BillTo_Postal_City'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">State</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_BillTo_Postal_StateProv'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Zip</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_BillTo_PostalCode'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Country</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_BillTo_Postal_CountryCode'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Phone</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_BillTo_Telecom_Phone_Number'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">E-Mail</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_BillTo_Online_Email'}&nbsp;</td>
+</tr>
 
 <!--Shipping Address-->
 
-<TR>
-<TD COLSPAN=2>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-<B>Shipping Information</B>
-</FONT>
-</TD>
-</TR>
+<tr>
+<th colspan="2" class="ac_checkout_review">Shipping Information</th>
+</tr>
 
 ENDOFTEXT
 
 if ($form_data{'Ecom_ShipTo_Method'} ne ""){
 $answer.= <<ENDOFTEXT;
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-Ship via:
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$form_data{'Ecom_ShipTo_Method'}
-&nbsp;</FONT>
-</TD>
-</TR>
+<tr>
+<td class="ac_checkout_review_col1">Ship via</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Method'}&nbsp;</td>
+</tr>
 ENDOFTEXT
 }
 
 $answer.= <<ENDOFTEXT;
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-Name
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$form_data{'Ecom_ShipTo_Postal_Name_First'} $form_data{'Ecom_ShipTo_Postal_Name_Last'}
-&nbsp;</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-Street
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$my_ShipTo_Postal_Street
-&nbsp;</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-City
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$form_data{'Ecom_ShipTo_Postal_City'}
-&nbsp;</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-State
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$form_data{'Ecom_ShipTo_Postal_StateProv'}
-&nbsp;</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-Zip
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$form_data{'Ecom_ShipTo_Postal_PostalCode'}
-&nbsp;</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-Country
-</FONT>
-<TD>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$form_data{'Ecom_ShipTo_Postal_CountryCode'}
-&nbsp;</FONT>
-</TD>
-</TR>
+<tr>
+<td class="ac_checkout_review_col1">Name</td>
+<td class="ac_checkout_review_col2">
+  $form_data{'Ecom_ShipTo_Postal_Name_First'} $form_data{'Ecom_ShipTo_Postal_Name_Last'}&nbsp;
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Street</td>
+<td class="ac_checkout_review_col2">$my_ShipTo_Postal_Street&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">City</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_City'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">State</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_StateProv'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Zip</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_PostalCode'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Country</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_CountryCode'}&nbsp;</td>
+</tr>
+ENDOFTEXT
+
+
+if (($form_data{'Ecom_Payment_Pay_Type'} =~ /MailedFunds/) && ($XCOMMENTS ne '')) {
+$XCOMMENTS =~ s/\n/\<br\>/g;
+$answer.= <<ENDOFTEXT;
+<tr>
+<th colspan="2" class="ac_checkout_review">Misc Information </th>
+</tr>
+<tr>
+<td class="ac_checkout_review_col1" colspan="2">$XCOMMENTS</td>
+</tr>
+ENDOFTEXT
+}
+
 
-</TABLE>
+$answer.= <<ENDOFTEXT;
+</table>
+</div>
 ENDOFTEXT
 
 return $answer;
 }
 ###############################################################
+# CSS Changes NOT COMPLETE
 sub process_Offline_Order {
 local($subtotal, $total_quantity,
       $total_measured_quantity,
@@ -624,54 +555,31 @@
 local($stevo_shipping_names) = "";
 local($order_ok_final_msg,$order_ok_final_msg_tbl);
 local($ship_thing_too,$ship_instructions,$TEMP,$temp,$pass); 
+local(%orderLoggingHash);
 
-
-local ($referringDomain, $acceptedDomain);
-
-$acceptedDomain = $sc_order_script_url;
-$referringDomain = $ENV{'HTTP_REFERER'};
-
-$referringDomain =~ s/\?.*//g;
-$referringDomain =~ s/http:\/\///g;
-$referringDomain =~ s/\/.*//g;
-$referringDomain =~ s/\/agora.cgi//g;
-
-$acceptedDomain =~ s/\?.*//g;
-$acceptedDomain =~ s/http:\/\///g;
-$acceptedDomain =~ s/\/.*//g;
-$acceptedDomain =~ s/\/agora.cgi//g;
-
-if ($referringDomain =~ "^w*\.")
-{
-$referringDomain =~ s/^w*\.//i;
-}
-
-if ($acceptedDomain =~ "^w*\.")
-{
-$acceptedDomain =~ s/^w*\.//i;
-}
-
-if ($referringDomain ne $acceptedDomain)
-{
-print "$acceptedDomain is the accepted referrer.<br>";
-print "$referringDomain is not a valid referrer<br>";
-print "Refering Site Authentication Failed!";
-&call_exit;   
-}
-		
+# First, we output the header of
+# the processing of the order
+    
 $orderDate = &get_date;
 
+# NEW CODEHOOK
+&codehook("process-order-routine-top");
+
+print qq~$sc_doctype
+<html>
+<head>
+  <title>$messages{'ordcnf_08'}</title>
+~;
+  $sc_ssl_location_url2 ne '' ? print $sc_secure_standard_head_info : print $sc_standard_head_info;
 print qq~
-<HTML>
-$sc_special_page_meta_tags
-<HEAD>
-<TITLE>$messages{'ordcnf_08'}</TITLE>
-$sc_standard_head_info</HEAD>
-<BODY $sc_standard_body_info>
+  $sc_special_page_meta_tags
+</head>
+<body>
 ~;
 
 $text_of_cart .= "Order Date:    $orderDate\n";
 $text_of_cart .= "Gateway:       Offline\n\n";
+$orderLoggingHash{'GatewayUsed'} = "Offline";
 
 $text_of_cart .= "  --PRODUCT INFORMATION--\n\n";
 
@@ -679,38 +587,32 @@
 &file_open_error("$sc_cart_path", "display_cart_contents", __FILE__, __LINE__);
 
 while (<CART>)
-	{
-	$cartData++;
-	@cart_fields = split (/\|/, $_);
-	$quantity = $cart_fields[0];
-	$product_price = $cart_fields[3];
-	$product = $cart_fields[4];
-	$weight = $cart_fields[6];
-	$options = $cart_fields[$cart{"options"}];
-	$options =~ s/$sc_opt_sep_marker/, /g;
-	$text_of_cart .= &cart_textinfo(*cart_fields);
-	$stevo_shipping_thing .="|$quantity\*$weight";
-	$stevo_shipping_names .="|$product\($options\)";
+  {
+  $cartData++;
+  @cart_fields = split (/\|/, $_);
+  $quantity = $cart_fields[0];
+  $product_price = $cart_fields[3];
+  $product = $cart_fields[4];
+  $weight = $cart_fields[6];
+  $options = $cart_fields[$cart{"options"}];
+  $options =~ s/$sc_opt_sep_marker/, /g;
+  $text_of_cart .= &cart_textinfo(*cart_fields);
+  $stevo_shipping_thing .="|$quantity\*$weight";
+  $stevo_shipping_names .="|$product\($options\)";
         &codehook("process-cart-item");
-	}
+  }
 close(CART);
 
+# Now let's check the _VERIFY file, just to be sure ...
 if (!(-f "$sc_verify_order_path")){
 &SecureStoreHeader;
 print <<ENDOFTEXT;
-<CENTER>
-<TABLE WIDTH=500>
-<TR>
-<TD WIDTH=500>
-<FONT FACE=ARIAL>
-$messages{'ordcnf_03'}
-$messages{'ordcnf_02'}
-</FONT>
-</TD>
-</TR>
-</TABLE>
-<CENTER>  
-
+<div align="center">
+  <p class="ac_error">
+    $messages{'ordcnf_03'}
+  </p>
+  <p>$messages{'ordcnf_02'}</p>
+</div>
 ENDOFTEXT
 
 # and the footer is printed
@@ -718,8 +620,8 @@
 &SecureStoreFooter;
 
 print qq!
-</BODY>
-</HTML>
+</body>
+</html>
 !;
 
 &call_exit;
@@ -731,14 +633,14 @@
 if ($sc_Offline_show_table =~ /yes/i) {
   $order_ok_final_msg = $messages{'ordcnf_09'};
   if ($order_ok_final_msg eq '') {
+   # Default so something is there, use $messages{'ordcnf_09'} though 
+   # to customize, set it in the Free Form Logic (either location.)
     $order_ok_final_msg = $messages{'ordcnf_01'};
     $order_ok_final_msg .= "Print this page for your records.  You will ";
-    $order_ok_final_msg .= "receive an email receipt shortly.<br>\n";
-    $order_ok_final_msg =
-	"<TABLE WIDTH=500 $cart_table_def><TR><TD>" .
-	$order_ok_final_msg .
-	"</TD></TR></TABLE>\n";
+    $order_ok_final_msg .= "receive an email receipt shortly./n";
    }
+  $order_ok_final_msg = '<br><p align="center">' . $order_ok_final_msg . "</p>\n";
+  
   $special_message = $order_ok_final_msg;
   { local(%form_data) = %vform;
     local($sc_use_verify_values_for_display) = "yes";
@@ -748,6 +650,7 @@
   &SecureStoreHeader;
  }
 
+# All our answers are stored in the verify file now, so load them!
 if ($sc_scramble_cc_info =~ /yes/i ) {
   $vform{'Ecom_Payment_Orig_Card_Number'} = 
    $vform_Ecom_Payment_Orig_Card_Number;
@@ -763,15 +666,16 @@
 foreach $inx (keys %vform) {
   $form_data{$inx} = $vform{$inx};
  }
+# and do special processing as required
 &Offline_response_prep;
 
+# re-create the old-style order confirmation form variables
 $form_data{'METHOD'} = $form_data{'Ecom_Payment_Card_Type'};
 $form_data{'CARDNUM'} = $form_data{'Ecom_Payment_Card_Number'};
 $form_data{'CARDNUM'} =~ s/\ \ /\ /g; 
 $form_data{'CARDNUM'} =~ s/\ \ /\ /g; 
 $form_data{'EXPDATE'} = 
 "Month: $vform_Ecom_Payment_Card_ExpDate_Month " .
-"Day: $vform_Ecom_Payment_Card_ExpDate_Day " . 
 "Year: $vform_Ecom_Payment_Card_ExpDate_Year";
 $my_EXPDATE = $form_data{'EXPDATE'};
 
@@ -780,8 +684,13 @@
   $form_data{'CARDNUM'} = $vform_Ecom_Payment_PO_Number;
   $emailCCnum = $form_data{'CARDNUM'};
   $logCCnum = $form_data{'CARDNUM'};
+ } elsif ($vform_Ecom_Payment_Pay_Type eq 'MailedFunds') {
+  $emailMETHOD = $form_data{'METHOD'};
+  $form_data{'CARDNUM'} = $vform_Ecom_Payment_PO_Number;
+  $emailCCnum = $form_data{'CARDNUM'};
+  $logCCnum = $form_data{'CARDNUM'};
  } else { # Check or CC
-  if ($sc_use_pgp =~ /yes/i) { 
+  if ($sc_use_pgp =~ /yes/i) { #assume using secure access if using PGP
     $emailMETHOD = $form_data{'METHOD'};
     $emailCCnum = $form_data{'CARDNUM'};
     $logCCnum = $form_data{'CARDNUM'};
@@ -796,6 +705,62 @@
 
 $verify_error = "";
 
+# initialize hash variables in case they are empty later
+# added by Mister Ed October 2005
+
+$orderLoggingHash{'firstName'} = "";
+$orderLoggingHash{'lastName'} = "";
+$orderLoggingHash{'fullName'} = "";
+$orderLoggingHash{'orderFromAddress'} = "";
+$orderLoggingHash{'customerAddress2'} = "";
+$orderLoggingHash{'customerAddress3'} = "";
+$orderLoggingHash{'orderFromCity'} = "";
+$orderLoggingHash{'orderFromPostal'} = "";
+$orderLoggingHash{'customerPhone'} = "";
+$orderLoggingHash{'companyName'} = "";
+$orderLoggingHash{'emailAddress'} = "";
+
+$orderLoggingHash{'shipToName'} = "";
+$orderLoggingHash{'shipToAddress'} = "";
+$orderLoggingHash{'shipToAddress2'} = "";
+$orderLoggingHash{'shipToAddress3'} = "";
+$orderLoggingHash{'shipToCity'} = "";
+$orderLoggingHash{'shipToState'} = "";
+$orderLoggingHash{'shipToPostal'} = "";
+$orderLoggingHash{'shipToCountry'} = "";
+$orderLoggingHash{'shiptoResidential'} = $form_data{'Ecom_is_Residential'};
+$orderLoggingHash{'insureShipment'} = $form_data{'Ecom_ShipTo_Insurance'}; # not implemented yet, for the future
+
+$orderLoggingHash{'invoiceNumber'} = "";
+$orderLoggingHash{'customerNumber'} = "";
+$orderLoggingHash{'orderStatus'} = "$sc_order_status_default";
+$orderLoggingHash{'user1'} = "";
+$orderLoggingHash{'user2'} = "";
+$orderLoggingHash{'user3'} = "";
+$orderLoggingHash{'user4'} = "";
+$orderLoggingHash{'user5'} = "";
+$orderLoggingHash{'itemsordered'} = "";
+$orderLoggingHash{'shiptrackingID'} = "";
+$orderLoggingHash{'shipMethod'} = "";
+$orderLoggingHash{'orderFromState'} = "";
+$orderLoggingHash{'orderFromCountry'} = "";
+$orderLoggingHash{'shippingTotal'} = "";
+$orderLoggingHash{'salesTax'} = "";
+$orderLoggingHash{'tax1'} = "";
+$orderLoggingHash{'tax2'} = "";
+$orderLoggingHash{'tax3'} = "";
+$orderLoggingHash{'discounts'} = "";
+$orderLoggingHash{'netProfit'} = "";
+$orderLoggingHash{'affiliateTotal'} = "";
+$orderLoggingHash{'affiliateID'} = "";
+$orderLoggingHash{'affiliateMisc'} = "";
+$orderLoggingHash{'subTotal'} = "";
+$orderLoggingHash{'orderTotal'} = "";
+$orderLoggingHash{'adminMessages'} = "";
+$orderLoggingHash{'shippingMessages'} = "";
+$orderLoggingHash{'xcomments'} = "";
+$orderLoggingHash{'termsOfService'} = "";
+
 $sc_orderlib_use_SBW_for_ship_ins = $sc_use_SBW;
 &codehook("orderlib-ship-instructions");
 if ($sc_orderlib_use_SBW_for_ship_ins =~ /yes/i)
@@ -804,6 +769,8 @@
  &ship_put_in_boxes($stevo_shipping_thing,$stevo_shipping_names,
  $sc_verify_Origin_ZIP,$sc_verify_boxes_max_wt); 
 }
+$orderLoggingHash{'shippingMessages'} = "$ship_instructions";
+$orderLoggingHash{'shippingMessages'} =~ s/\n/<br>/g;
 
 $test_shipping = $form_data{'SHIPPING'};
 $test_shipping =~ s/[^0-9\.]//g;
@@ -835,6 +802,7 @@
   "was not possible:\n" . $verify_error . "\n";
  }
 
+# Compile confirmation emails to customer, admin and order logs
 $text_of_confirm_email .= $messages{'ordcnf_07'};
 $text_of_confirm_email .= $text_of_cart;
 $text_of_confirm_email .= "\n";
@@ -842,65 +810,85 @@
 
 $text_of_cart .= "CUSTID:        $form_data{'CUSTID'}\n";
 $text_of_admin_email .= "CUSTID:        $form_data{'CUSTID'}\n";
+$orderLoggingHash{'customerNumber'} = "$form_data{'CUSTID'}";
 
 $text_of_cart .= "INVOICE:       $form_data{'INVOICE'}\n";
 $text_of_confirm_email .= "INVOICE:       $form_data{'INVOICE'}\n";
 $sc_temp_invoice_number = $form_data{'INVOICE'};
+$orderLoggingHash{'invoiceNumber'} = "$form_data{'INVOICE'}";
+
+# lines for tos added March 18 2006 by Mister Ed
+if ($sc_display_checkout_tos =~ /yes/i) {
+$text_of_cart .= "SALES TERMS AND REFUND POLICY:       $form_data{'Ecom_tos'}\n";
+$text_of_confirm_email .= "Sales Terms and Refund Policy:       $form_data{'Ecom_tos'}\n";
+$orderLoggingHash{'termsOfService'} = "$form_data{'Ecom_tos'}";
+}
 
 $temp = &display_price($sc_verify_subtotal);
 $text_of_cart .= "SUBTOTAL:      $temp\n";
 $text_of_confirm_email .= "SUBTOTAL:      $temp\n";
 $sc_verify_subtotal_temp3 = $temp;
+$orderLoggingHash{'subTotal'} = &format_price($sc_verify_subtotal);
 
 if ($form_data{'SHIPPING'})
 {
 $temp = &display_price($form_data{'SHIPPING'});
 $text_of_cart .= "SHIPPING:      $temp\n";
 $text_of_confirm_email .= "SHIPPING:      $temp\n";
+$orderLoggingHash{'shippingTotal'} = &format_price($form_data{'SHIPPING'});
 }
 
-if ($sc_use_SBW =~ /yes/i)
-{
- $text_of_confirm_email .= "SHIP VIA:      $form_data{'HW2SHIP'}\n";
+$orderLoggingHash{'shipMethod'} = "$vform_Ecom_ShipTo_Method";
+
+if (($sc_use_SBW =~ /yes/i) || ($form_data{'x_Freight'} > .009)) {
+ $text_of_confirm_email .= "SHIP VIA:      $vform_Ecom_ShipTo_Method\n";
 }
 
 if ($form_data{'DISCOUNT'})
 {
-$text_of_cart .= "DISCOUNT:      $form_data{'DISCOUNT'}\n";
-$text_of_confirm_email .= "DISCOUNT:      $form_data{'DISCOUNT'}\n";
+  $temp = &display_price($form_data{'DISCOUNT'});
+  $text_of_cart .= "DISCOUNT:      $temp\n";
+  $text_of_confirm_email .= "DISCOUNT:      $temp\n";
+  $orderLoggingHash{'discounts'} = &format_price($form_data{'DISCOUNT'});
 }
 
 if ($form_data{'SALESTAX'})
 {
-$text_of_cart .= "SALES TAX:     $form_data{'SALESTAX'}\n";
-$text_of_confirm_email .= "SALES TAX:     $form_data{'SALESTAX'}\n";
+  $temp = &display_price($form_data{'SALESTAX'});
+  $text_of_cart .= "SALES TAX:     $temp\n";
+  $text_of_confirm_email .= "SALES TAX:     $temp\n";
+  $orderLoggingHash{'salesTax'} = &format_price($form_data{'SALESTAX'});
 }
 
 if ($form_data{'EXTRATAX1'})
 {
-$temp = substr(substr($sc_extra_tax1_name,0,13).":               ",0,15);
-$text_of_cart .= "$temp$form_data{'EXTRATAX1'}\n";
-$text_of_confirm_email .= "$temp$form_data{'EXTRATAX1'}\n";
+  $temp = substr(substr($sc_extra_tax1_name,0,13).":               ",0,15);
+  $text_of_cart .= "$temp$form_data{'EXTRATAX1'}\n";
+  $text_of_confirm_email .= "$temp$form_data{'EXTRATAX1'}\n";
+  $orderLoggingHash{'tax1'} = "$temp$form_data{'EXTRATAX1'}";
 }
 
 if ($form_data{'EXTRATAX2'})
 {
-$temp = substr(substr($sc_extra_tax2_name,0,13).":               ",0,15);
-$text_of_cart .= "$temp$form_data{'EXTRATAX2'}\n";
-$text_of_confirm_email .= "$temp$form_data{'EXTRATAX2'}\n";
+  $temp = substr(substr($sc_extra_tax2_name,0,13).":               ",0,15);
+  $text_of_cart .= "$temp$form_data{'EXTRATAX2'}\n";
+  $text_of_confirm_email .= "$temp$form_data{'EXTRATAX2'}\n";
+  $orderLoggingHash{'tax2'} = "$temp$form_data{'EXTRATAX2'}";
 }
 
 if ($form_data{'EXTRATAX3'})
 {
-$temp = substr(substr($sc_extra_tax3_name,0,13).":               ",0,15);
-$text_of_cart .= "$temp$form_data{'EXTRATAX3'}\n";
-$text_of_confirm_email .= "$temp$form_data{'EXTRATAX3'}\n";
+  $temp = substr(substr($sc_extra_tax3_name,0,13).":               ",0,15);
+  $text_of_cart .= "$temp$form_data{'EXTRATAX3'}\n";
+  $text_of_confirm_email .= "$temp$form_data{'EXTRATAX3'}\n";
+  $orderLoggingHash{'tax3'} = "$temp$form_data{'EXTRATAX3'}";
 }
 
 $temp = &display_price($sc_verify_grand_total);
 
 $text_of_cart .= "TOTAL:         $temp\n";
 $text_of_confirm_email .= "TOTAL:         $temp\n\n";
+$orderLoggingHash{'orderTotal'} = &format_price($sc_verify_grand_total);
 
 $text_of_admin_email = $text_of_cart;
 
@@ -911,15 +899,18 @@
 $text_of_admin_email .= "NUMBER:        $emailCCnum\n";
 
 if ($sc_verify_paid_by_ccard =~ /yes/i) {
-$text_of_cart .= "EXP:           $my_EXPDATE\n";
-$text_of_admin_email .= "EXP:           $form_data{'EXPDATE'}\n";
+    $text_of_cart .= "EXP:           $my_EXPDATE\n";
+    $text_of_admin_email .= "EXP:           $form_data{'EXPDATE'}\n";
 }
 
-if ($form_data{'Ecom_Payment_Card_CVV'} ne "") {
-$text_of_cart .= "CVV2:           $form_data{'Ecom_Payment_Card_CVV'}\n";
-$text_of_admin_email .= "CVV2:           $form_data{'Ecom_Payment_Card_CVV'}\n";
+# CVV optional per Mr. Ed's request.
+# should not be used anymore. users enabling this do so at their own risk.
+if (($sc_offline_enable_cvv =~ /yes/i) && ($form_data{'Ecom_Payment_Card_CVV'} ne "")) {
+    $text_of_cart .= "CVV2:           $form_data{'Ecom_Payment_Card_CVV'}\n";
+     $text_of_admin_email .= "CVV2:           $form_data{'Ecom_Payment_Card_CVV'}\n";
 }
 
+
 $text_of_cart .= "DESCRIPTION:   $form_data{'DESCRIPTION'}\n\n";
 $text_of_admin_email .= "DESCRIPTION:   $form_data{'DESCRIPTION'}\n\n";
 
@@ -928,37 +919,47 @@
 
 $text_of_cart .= "NAME:          $form_data{'NAME'}\n";
 $text_of_admin_email .= "NAME:          $form_data{'NAME'}\n";
+$orderLoggingHash{'fullName'} = "$form_data{'NAME'}";
 
 $text_of_cart .= "ADDRESS:       $form_data{'ADDRESS'}\n";
 $text_of_admin_email .= "ADDRESS:       $form_data{'ADDRESS'}\n";
+$orderLoggingHash{'orderFromAddress'} = "$form_data{'ADDRESS'}";
 
 if ($form_data{'ADDRESS2'} ne "") {
   $text_of_cart .= "               $form_data{'ADDRESS2'}\n";
   $text_of_admin_email .= "               $form_data{'ADDRESS2'}\n";
+$orderLoggingHash{'customerAddress2'} = "$form_data{'ADDRESS2'}";
  }
 
 if ($form_data{'ADDRESS3'} ne "") {
   $text_of_cart .= "               $form_data{'ADDRESS3'}\n";
   $text_of_admin_email .= "               $form_data{'ADDRESS3'}\n";
+$orderLoggingHash{'customerAddress3'} = "$form_data{'ADDRESS3'}";
  }
 
 $text_of_cart .= "CITY:          $form_data{'CITY'}\n";
 $text_of_admin_email .= "CITY:          $form_data{'CITY'}\n";
+$orderLoggingHash{'orderFromCity'} = "$form_data{'CITY'}";
 
 $text_of_cart .= "STATE:         $form_data{'STATE'}\n";
 $text_of_admin_email .= "STATE:         $form_data{'STATE'}\n";
+$orderLoggingHash{'orderFromState'} = "$form_data{'STATE'}";
 
 $text_of_cart .= "ZIP:           $form_data{'ZIP'}\n";
 $text_of_admin_email .= "ZIP:           $form_data{'ZIP'}\n";
+$orderLoggingHash{'orderFromPostal'} = "$form_data{'ZIP'}";
 
 $text_of_cart .= "COUNTRY:       $form_data{'COUNTRY'}\n";
 $text_of_admin_email .= "COUNTRY:       $form_data{'COUNTRY'}\n";
+$orderLoggingHash{'orderFromCountry'} = "$form_data{'COUNTRY'}";
 
 $text_of_cart .= "PHONE:         $form_data{'PHONE'}\n";
 $text_of_admin_email .= "PHONE:         $form_data{'PHONE'}\n";
+$orderLoggingHash{'customerPhone'} = "$form_data{'PHONE'}";
 
 $text_of_cart .= "EMAIL:         $form_data{'EMAIL'}\n\n";
 $text_of_admin_email .= "EMAIL:         $form_data{'EMAIL'}\n\n";
+$orderLoggingHash{'emailAddress'} = "$form_data{'EMAIL'}";
 
 $text_of_cart .= "SHIPPING INFORMATION --------------\n\n";
 $text_of_admin_email .= "SHIPPING INFORMATION --------------\n\n";
@@ -968,46 +969,68 @@
 
 $text_of_cart .= "NAME:          $form_data{'SHIPNAME'}\n";
 $text_of_admin_email .= "NAME:          $form_data{'SHIPNAME'}\n";
+$orderLoggingHash{'shipToName'} = "$form_data{'SHIPNAME'}";
 
 $text_of_cart .= "ADDRESS:       $form_data{'SHIPTOSTREET'}\n";
 $text_of_admin_email .= "ADDRESS:       $form_data{'SHIPTOSTREET'}\n";
+$orderLoggingHash{'shipToAddress'} = "$form_data{'SHIPTOSTREET'}";
 
 if ($form_data{'SHIPTOSTREET2'} ne "") {
   $text_of_cart .= "               $form_data{'SHIPTOSTREET2'}\n";
   $text_of_admin_email .= "               $form_data{'SHIPTOSTREET2'}\n";
+$orderLoggingHash{'shipToAddress2'} = "$form_data{'SHIPTOSTREET2'}";
  }
 
 if ($form_data{'SHIPTOSTREET3'} ne "") {
   $text_of_cart .= "               $form_data{'SHIPTOSTREET3'}\n";
   $text_of_admin_email .= "               $form_data{'SHIPTOSTREET3'}\n";
+$orderLoggingHash{'shipToAddress3'} = "$form_data{'SHIPTOSTREET3'}";
  }
 
 $text_of_cart .= "CITY:          $form_data{'SHIPTOCITY'}\n";
 $text_of_admin_email .= "CITY:          $form_data{'SHIPTOCITY'}\n";
+$orderLoggingHash{'shipToCity'} = "$form_data{'SHIPTOCITY'}";
 
 $text_of_cart .= "STATE:         $form_data{'SHIPTOSTATE'}\n";
 $text_of_admin_email .= "STATE:         $form_data{'SHIPTOSTATE'}\n";
+$orderLoggingHash{'shipToState'} = "$form_data{'SHIPTOSTATE'}";
 
 $text_of_cart .= "ZIP:           $form_data{'SHIPTOZIP'}\n";
 $text_of_admin_email .= "ZIP:           $form_data{'SHIPTOZIP'}\n";
+$orderLoggingHash{'shipToPostal'} = "$form_data{'SHIPTOZIP'}";
 
 $text_of_cart .= "COUNTRY:       $form_data{'SHIPTOCOUNTRY'}\n\n";
 $text_of_admin_email .= "COUNTRY:       $form_data{'SHIPTOCOUNTRY'}\n\n";
+$orderLoggingHash{'shipToCountry'} = "$form_data{'SHIPTOCOUNTRY'}";
+
+# NEW CODEHOOK
+&codehook("process-order-pre-ship-instructions");
 
 if ($ship_instructions ne "") {
   $text_of_cart .= "Shipping Instructions: \n$ship_instructions\n\n"; 
   $text_of_admin_email .= "Shipping Instructions:\n$ship_instructions\n\n"; 
  } 
 
+# NEW CODEHOOK
+&codehook("process-order-pre-xcomments");
+
 $text_of_cart .= $XCOMMENTS;
+$orderLoggingHash{'xcomments'} = "$XCOMMENTS";
+$orderLoggingHash{'xcomments'} =~ s/\n/<br>/g;
+$orderLoggingHash{'adminMessages'} =~ s/\t/ /g;
 $text_of_admin_email .= $XCOMMENTS_ADMIN;
+$orderLoggingHash{'adminMessages'} .= "$XCOMMENTS_ADMIN";
+$orderLoggingHash{'adminMessages'} =~ s/\n/<br>/g;
+$orderLoggingHash{'adminMessages'} =~ s/\t/ /g;
 $text_of_confirm_email .= $XCOMMENTS;
 
+# 'Init' the emails ...
 $temp = &init_shop_keep_email;
 $text_of_cart = $temp . $text_of_cart;
 $text_of_admin_email = $temp . $text_of_admin_email;
 $text_of_confirm_email = &init_customer_email . $text_of_confirm_email;
 
+# Add any other info ...
 $temp = &addto_shop_keep_email;
 $text_of_cart .= $temp;
 $text_of_admin_email .= $temp;
@@ -1023,25 +1046,33 @@
 $text_of_admin_email = "\n" . $text_of_admin_email . "\n";
 }
 
+# send email to admin or order email addy listed in main settings of manager
 if ($sc_send_order_to_email =~ /yes/i)
 {
-&send_mail($sc_admin_email, $sc_order_email, "Online Order",$text_of_admin_email);
+&send_mail($sc_admin_email, $sc_order_email, "AgoraCart - Online Order - $form_data{'INVOICE'}",$text_of_admin_email);
 }
 
+# NEW CODEHOOK
+&codehook("process-order-pre-logOrder");
+
+# write order log
 &log_order($text_of_cart,$form_data{'INVOICE'},$form_data{'CUSTID'});
 
+# send confirmation email to customer if they input email address
 if (($cartData) && ($form_data{'EMAIL'} ne ""))
 {
 &send_mail($sc_admin_email, $form_data{'EMAIL'},$messages{'ordcnf_08'},
            "$text_of_confirm_email");
 }
-  
+
+
+# show order receipt page if selected in offline settings
 if ($sc_Offline_show_table =~ /yes/i) {
   $order_ok_final_msg_tbl = $messages{'ordcnf_10'}; 
   if ($order_ok_final_msg_tbl eq '') {
    # Default so something is there, use $messages{'ordcnf_10'} though 
    # to customize, set it in the Free Form Logic (either location.)
-    $order_ok_final_msg_tbl = &get_date . "<br><br>Order Confirmation:";
+    $order_ok_final_msg_tbl = "<b>Order Confirmation</b><br/><br/>" . &get_date;
    }
   $temp = 
     &get_Offline_confirm_middle(*form_data,$invoice_number,
@@ -1050,50 +1081,41 @@
  } else {
   $temp = $messages{'ordcnf_01'};
  }
+
+# set affiliate program variables for such things as image calls
 $sc_affiliate_order_unique = $form_data{'INVOICE'};
-$sc_affiliate_order_total = $sc_verify_subtotal_temp3;
+$sc_affiliate_order_total = $sc_verify_subtotal - $sc_verify_discount;
 
-print <<ENDOFTEXT;
-<CENTER>
-<TABLE WIDTH=500>
-<TR>
-<TD WIDTH=500>
-<FONT FACE=ARIAL>
-$temp
-</FONT>
-</TD>
-</TR>
-</TABLE>
-</CENTER>  
-ENDOFTEXT
+$sc_affiliate_image_call =~ s/AMOUNT/$sc_affiliate_order_total/g;
+$sc_affiliate_image_call =~ s/UNIQUE/$sc_affiliate_order_unique/g;
 
-print <<ENDOFTEXT;
-<CENTER>
-<TABLE WIDTH=500>
-<TR>
-<TD WIDTH=500>
-<FONT FACE=ARIAL>
-$messages{'ordcnf_02'}
-<br>
-$sc_affiliate_image_call
-</FONT>
-</TD>
-</TR>
-</TABLE>
-</CENTER>  
+# NEW CODEHOOK
+&codehook("process-order-display-thankyou-page");
 
+print <<ENDOFTEXT;
+<div align="center">
+$temp 
+<p>
+  $messages{'ordcnf_02'}
+</p>
+<p>
+  $sc_affiliate_image_call
+</p>
+</div>
 ENDOFTEXT
 
+# This empties the cart after the order is successful
 &empty_cart;
 
+# and the footer is printed
 &SecureStoreFooter;
 
 print qq!
-</BODY>
-</HTML>
+</body>
+</html>
 !;
 
-} 
+}  # End of process_order_form
 
 #################################################################
 
diff -ruN 4.0K-4b/library/PayPal-mgr_lib.pl 5.0.000/library/PayPal-mgr_lib.pl
--- 4.0K-4b/library/PayPal-mgr_lib.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/library/PayPal-mgr_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,386 @@
+# PayPal Processing Gateway
+#
+# Copyright 2000,2001 Steve Kneizys.
+# Copyright 2002-Present K-Factor Technologies, Inc.  All Rights Reserved.
+#
+# Requires AgoraCart version 5.0.0 or above.  Just place this file in the library directory.
+#
+# This is NOT FREE AND/OR GPL SOFTWARE!  This library is a cost item.
+# This software is a separate add-on to an ecommerce shopping cart and 
+# is the confidential and proprietary information of K-Factor Technologies, Inc.  You may
+# not disclose such Confidential Information and shall use it only in
+# conjunction with the AgoraCart (aka agora.cgi) shopping cart.  It must be licensed for
+# Each use on EACH store it is used on.  License at AgoraCartPro.com
+#
+# To use it you must license it from http://www.agoracart.com/ or
+# http://www.agoracartpro.com/
+#
+# K-Factor Technologies, Inc. BytePipe, AgoraScript nor any of their employees and/or representatives
+# MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT
+# THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESSED OR IMPLIED,
+# INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+# OR NON-INFRINGEMENT.
+#
+# K-Factor Technologies, Inc., BytePipe, AgoraScript nor any of their employees and/or representatives
+# SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY
+# LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS
+# SOFTWARE OR ITS DERIVATIVES.
+#
+# You may not give this script/add-on away or distribute it an any way outside of a copy of
+# AgoraCart without written permission from K-Factor Technologies, Inc.  K-Factor Technologies, Inc.
+# reserves any and all rights to distributions, add-ons, and other works based on this
+# piece of software as well as any and all rights to profit sharing and/or to charge for
+# such works and/or derivatves.
+#
+##############################################################################
+$versions{'PayPal-mgr_lib.pl'} = "5.0.000";
+&add_codehook("gateway_admin_screen","PayPal_mgr_check");
+&add_codehook("gateway_admin_settings","PayPal_settings");
+$mc_gateways .= "|PayPal";
+##############################################################################
+sub PayPal_settings {
+local($custom_logic);
+if ($sc_gateway_name eq "PayPal") {
+
+  $sc_paypal_top_message_temp = &my_escape($in{'sc_paypal_top_message'});
+  $sc_paypal_shipping_message_temp = &my_escape($in{'sc_paypal_shipping_message'});
+ 	$use_custom_logic = &my_escape($in{'sc_use_custom_paypal_url_logic'});
+  $custom_logic = &my_escape($in{'sc_custom_paypal_url_logic'});
+  $sc_paypal_verify_message_temp = &my_escape($in{'sc_paypal_verify_message'});
+  $sc_tos_display_address_temp = &my_escape($in{'sc_tos_display_address'});
+  $sc_order_ok_tmp = &my_escape($in{'order_ok_final_msg_tbl'});
+
+  open (GATEWAY, "> $gateway_settings") || 
+ 	&my_die("Can't Open $gateway_settings");
+  print (GATEWAY  "\$sc_gateway_username = \'$in{'sc_gateway_username'}\';\n");
+  print (GATEWAY  "\$sc_button_image_URL = \"$in{'button_URL'}\";\n");
+  print (GATEWAY  "\$sc_paypal_change = \"$in{'sc_paypal_change'}\";\n");
+  print (GATEWAY  "\$sc_order_script_url = \"$in{'order_url'}\";\n");
+  print (GATEWAY  "\$sc_paypal_order_name = \'$in{'order_name'}\';\n");
+  print (GATEWAY  "\$sc_paypal_order_number = \'$in{'order_number'}\';\n");
+  print (GATEWAY  "\$sc_currency_id = \"$in{'sc_currency_id'}\";\n");
+  print (GATEWAY  "\$sc_paypal_address_override = \'$in{'sc_paypal_address_override'}\';\n");
+  print (GATEWAY  "\$sc_paypal_top_message = qq'$sc_paypal_top_message_temp';\n");
+  print (GATEWAY  "\$sc_paypal_shipping_message = qq'$sc_paypal_shipping_message_temp';\n");
+  print (GATEWAY  "\$sc_paypal_special_message = qq'$sc_paypal_special_message';\n");
+  print (GATEWAY  "\$sc_use_custom_paypal_url_logic = qq'$use_custom_logic';\n");
+  print (GATEWAY  "\$sc_custom_paypal_url_logic = qq`$custom_logic`;\n");
+  print (GATEWAY  "\$sc_paypal_verify_message = qq'$sc_paypal_verify_message_temp';\n");
+  print (GATEWAY  "\$sc_display_checkout_tos = \"$in{'sc_display_checkout_tos'}\";\n");
+  print (GATEWAY  "\$sc_tos_display_address = qq'$sc_tos_display_address_temp';\n");
+  print (GATEWAY  "\$order_ok_final_msg_tbl = qq'$sc_order_ok_tmp';\n");
+
+  print (GATEWAY  "#\n1\;# We are a Library\n");
+  close(GATEWAY);
+ }
+}
+##############################################################################
+sub PayPal_mgr_check {
+if ($sc_gateway_name eq "PayPal") {
+  &print_PayPal_mgr_form;
+  &call_exit;
+ }
+}
+##############################################################################
+sub print_PayPal_mgr_form {
+	
+#
+# PayPal Gateway
+#
+
+local ($my_paypal_order_name) = $sc_paypal_order_name;
+local ($my_paypal_order_number) = $sc_paypal_order_number;
+
+if ($sc_display_checkout_tos eq '') { # default it in
+  $sc_display_checkout_tos = "yes";
+ }
+
+print &$manager_page_header("PayPal v2 Gateway","","","","");
+print <<ENDOFTEXT;
+<HTML>
+<HEAD>
+<TITLE>PayPal (Standard/Basic) Gateway Manager</TITLE>
+</HEAD>
+<BODY BGCOLOR=WHITE>
+<FORM METHOD="POST" ACTION="manager.cgi">
+<CENTER>
+<TABLE WIDTH=95% CELLPADDING=0 CELLSPACING=0 BORDER=0>
+
+<TR>
+<TD><HR/></TD>
+</TR>
+
+<TR>
+<TD WIDTH=95% align=center><br/>
+<FONT FACE=ARIAL>
+<b>PayPal (Standard/Basic) Settings</b>  This is a very basic PayPal payment method.  It will not confirm that payment is made, so you will need to access your paypal account to verify the payment is There. You can use the invoice numbers to confirm as that is passed to PayPal for comparison.  This method will pass over a total amount from the cart and the invoice number.  When the info is sent to PayPal, it sends you and the customer a confirmation email before payment is made, so make note of that as there could be some order confirmations sent but with no payment made should the customer fail to complete the process at PayPal.  NOTE: If you need to use PayPal Instant Payment Notification (IPN) or PayPal Pro, then you will need to upgrade to AgoraCart Pro 5.1.000 or above <small>(<a href="http://www.AgoraCart.org/proforum.htm" target="_blank">Click Here for more information on AgoraCart Pro</a>)</small><br/><br/>
+$msg<br/><br/></FONT>
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+
+ENDOFTEXT
+
+if($in{'system_edit_success'} ne "")
+{
+print <<ENDOFTEXT;
+<CENTER>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL SIZE=2 COLOR=RED>Gateway settings have been successfully
+updated<br><br></FONT>
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+ENDOFTEXT
+}
+
+print <<ENDOFTEXT;
+
+<FONT FACE=ARIAL SIZE=2><br>
+<CENTER>
+<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=95% BORDER=0>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD WIDTH="55%">
+Business Name as registered with PayPal (email address).
+</TD>
+<TD WIDTH="45%">
+<INPUT NAME="sc_gateway_username" TYPE="TEXT" SIZE=30
+VALUE='$sc_gateway_username'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><br>
+Secure URL to your Gateway's server
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+<INPUT NAME="order_url" TYPE="TEXT" SIZE=70
+VALUE="$sc_order_script_url"><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><br>
+The name you want for the order on the PayPal site:
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+<INPUT NAME="order_name" TYPE="TEXT" SIZE=70
+VALUE="$my_paypal_order_name"><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><br>
+The order number/identification you want to list/display at the PayPal site:
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+<INPUT NAME="order_number" TYPE="TEXT" SIZE=70
+VALUE="$my_paypal_order_number"><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><br>
+URL to the button you'd like to display on your orderform.<br>
+<small><B>Examples:</B><br>
+<B>http://www.wherever.com/images/button.gif</B><br>
+<B>%%URLofImages%%/paypal_button.gif</B></small></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+<INPUT NAME="button_URL" TYPE="TEXT" SIZE=70
+VALUE="$sc_button_image_URL"><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><br>
+URL of 'Make Changes' button:
+<br>
+<INPUT NAME="sc_paypal_change" TYPE="TEXT" SIZE=60 
+VALUE='$sc_paypal_change'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><br>Define the currency in which the monetary variables (amount, shipping, shipping2, handling, tax) are denoted.<br>
+<SELECT NAME="sc_currency_id">
+<OPTION>$sc_currency_id</OPTION>
+<OPTION>USD</OPTION>
+<OPTION>AUS</OPTION>
+<OPTION>CAD</OPTION>
+<OPTION>GBP</OPTION>
+<OPTION>EUR</OPTION>
+<OPTION>JPY</OPTION>
+</SELECT>
+</TD>
+</TR>
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><br>
+Select '1' to prevent the customer from selecting a different shipping address on the paypal site.<BR>
+<SELECT NAME="sc_paypal_address_override">
+<OPTION>$sc_paypal_address_override</OPTION>
+<OPTION>1</OPTION>
+<OPTION>0</OPTION>
+</SELECT>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR><TD COLSPAN=2><br>
+Top message for PayPal form.  Allows you to place a message above the Payment Information area and just below the cart total boxes.  HTML formatting (for text color, font, spacing, etc) is accepted.  Leave blank if not needed:<br>
+<TEXTAREA NAME="sc_paypal_top_message" 
+cols="68" rows=8 
+wrap=off>$sc_paypal_top_message</TEXTAREA> <br><br>
+
+<b>Misc area message.</b>  <small>Allows you to place a message immediately above the special messages box of the order form.  HTML formatting (text color, font, spacing, etc) is accepted.  Leave blank if not needed:</small><br>
+<TEXTAREA NAME="sc_paypal_shipping_message" 
+cols="68" rows=8 
+wrap=off>$sc_paypal_shipping_message</TEXTAREA> <br><br>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN="2">
+<b>Custom PayPal URL Logic:</b>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN="2">
+<table width="100%" cellpadding=0 cellspacing=0>
+<tr>
+<td>
+Use the custom PayPal URL logic?  If yes, enter the custom
+logic below and set this option to 'yes'.
+</td>
+<TD>
+<SELECT NAME=sc_use_custom_paypal_url_logic>
+<OPTION>$sc_use_custom_paypal_url_logic</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT>
+</td></tr></table>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN="2">
+<TEXTAREA NAME="sc_custom_paypal_url_logic"
+cols="68" rows=7 wrap=off>$sc_custom_paypal_url_logic</TEXTAREA>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><br><HR><br></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><TABLE WIDTH="100%"><TR>
+<TD><b>Display Terms of Service and Refund Policy checkbox and set as required?</b></TD>
+<TD>
+<SELECT NAME="sc_display_checkout_tos">
+<OPTION>$sc_display_checkout_tos</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT>
+</TD>
+</TR></TABLE></TD>
+</TR>
+<TR><TD COLSPAN=2><br>
+<b>Business address and phone number (contact information) for your business.</b>  <small>Should be legal address for the business location for full disclosure and other privacy requirements mandated by credit card companies as well as government enitities that require such notices:</small><br>
+<TEXTAREA NAME="sc_tos_display_address" 
+cols="68" rows=5 
+wrap=off>$sc_tos_display_address</TEXTAREA><br>
+
+</TD>
+</TR>
+
+<TR><TD COLSPAN=2><br>
+<b>Top message for confirmation page</b>, the page just before going to the gateway.  <small>This allows you to place a message above the Payment Information area and just below the cart total boxes.  HTML formatting (for text color, font, spacing, etc) is accepted.  Note: By default one exists, message 10 in the agora.setup.db file. Leave blank if not needed:</small><br>
+<TEXTAREA NAME="order_ok_final_msg_tbl" 
+cols="68" rows=8 
+wrap=off>$order_ok_final_msg_tbl</TEXTAREA> <br><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+<CENTER>
+<INPUT TYPE="HIDDEN" NAME="system_edit_success" VALUE="yes">
+<INPUT TYPE="HIDDEN" NAME="gateway" VALUE="PayPal">
+<INPUT NAME="GatewaySettings" TYPE="SUBMIT" VALUE="Submit">
+&nbsp;&nbsp;
+<INPUT TYPE="RESET" VALUE="Reset">
+</CENTER>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+<HR>
+</TD>
+</TR>
+
+</TABLE>
+
+</CENTER>
+</FORM>
+
+</BODY>
+</HTML>
+
+ENDOFTEXT
+	
+}
+##############################################################################
+1; #Library
diff -ruN 4.0K-4b/library/PayPal-order_lib.pl 5.0.000/library/PayPal-order_lib.pl
--- 4.0K-4b/library/PayPal-order_lib.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/library/PayPal-order_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,666 @@
+# PayPal Processing Gateway
+#
+# Copyright 2000,2001 Steve Kneizys.
+# Copyright 2002-Present K-Factor Technologies, Inc.  All Rights Reserved.
+#
+# Requires AgoraCart version 5.0.0 or above.  Just place this file in the library directory.
+#
+# This is NOT FREE AND/OR GPL SOFTWARE!  This library is a cost item.
+# This software is a separate add-on to an ecommerce shopping cart and 
+# is the confidential and proprietary information of K-Factor Technologies, Inc.  You may
+# not disclose such Confidential Information and shall use it only in
+# conjunction with the AgoraCart (aka agora.cgi) shopping cart.  It must be licensed for
+# Each use on EACH store it is used on.  License at AgoraCartPro.com
+#
+# To use it you must license it from http://www.agoracart.com/ or
+# http://www.agoracartpro.com/
+#
+# K-Factor Technologies, Inc. BytePipe, AgoraScript nor any of their employees and/or representatives
+# MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT
+# THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESSED OR IMPLIED,
+# INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+# OR NON-INFRINGEMENT.
+#
+# K-Factor Technologies, Inc., BytePipe, AgoraScript nor any of their employees and/or representatives
+# SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY
+# LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS
+# SOFTWARE OR ITS DERIVATIVES.
+#
+# You may not give this script/add-on away or distribute it an any way outside of a copy of
+# AgoraCart without written permission from K-Factor Technologies, Inc.  K-Factor Technologies, Inc.
+# reserves any and all rights to distributions, add-ons, and other works based on this
+# piece of software as well as any and all rights to profit sharing and/or to charge for
+# such works and/or derivatves.
+#
+#######################################################################
+#                    Order Form Definition Variables                  #
+#######################################################################
+
+$versions{'PayPal-order_lib.pl'} = "5.0.000";
+
+#best to leave this option as it is, as PayPal return is NOT guaranteed!
+$sc_paypal_email_before = "yes"; # set to "no" if email upon return
+
+$sc_use_secure_header_at_checkout = 'yes';
+$sc_PayPal_form_prep = 0;
+
+&add_codehook("printSubmitPage","print_PayPal_SubmitPage");
+&add_codehook("set_form_required_fields","PayPal_fields");
+&add_codehook("pre_header_navigation","PayPal_pre_header_nav");
+&add_codehook("gateway_response","PayPal_gateway_response");
+$sc_order_response_vars{"PayPal"}="ppret";
+
+##############################################################################
+sub PayPal_URL_logic {
+  local($bn,$url,$return,$mylogic,$err_code);
+  if ($sc_use_custom_paypal_url_logic =~ /yes/i) {
+    $mylogic = "$sc_custom_paypal_url_logic";
+    eval($mylogic);
+    $err_code = $@;
+    if ($err_code ne "") { #script died, error of some kind
+      &update_error_log("custom-paypal-url-logic $err_code ","","");
+     }
+   } else {
+    $return = $sc_store_url;
+    $return =~ s/\:/\%3A/;
+    $bn = $sc_gateway_username;
+    $bn =~ s/\@/\%40/; 
+    $url = $sc_order_script_url . '=' . $bn .
+ 	         "&item_name=" . &my_paypal_order_name . &my_paypal_order_number .
+           "&item_number=" . &my_paypal_order_number .
+           "&amount=" . &format_price($authPrice) .
+           "&currency_code=$sc_currency_id" .
+           "&address_override=$sc_paypal_address_override" .
+           "&first_name=$vform_Ecom_ShipTo_Postal_Name_First" .
+           "&last_name=$vform_Ecom_ShipTo_Postal_Name_Last" .
+           "&address1=$vform_Ecom_ShipTo_Postal_Street_Line1" .
+           "&city=$vform_Ecom_ShipTo_Postal_City" .
+           "&state=$vform_Ecom_ShipTo_Postal_StateProv" .
+           "&zip=$vform_Ecom_ShipTo_Postal_PostalCode" .
+           "&return=$return" .
+           "%3Fppret%3D$cart_id";
+    $url =~ s/\ /+/g;
+    $url =~ s/\#/\%23/g;
+  } 
+ return $url;
+
+ }
+##############################################################################
+sub PayPal_order_form_prep {# load the customer info ...
+  local($myname)="PayPal";
+    if ($myname ne $sc_gateway_name) { # secondary gateway, load settings
+      &require_supporting_libraries(__FILE__,__LINE__,
+         "./admin_files/$myname-user_lib.pl");
+     } 
+  if ($sc_PayPal_form_prep == 0) {
+    if (-f "$sc_verify_order_path"){
+      &read_verify_file;
+     } else {
+      &codehook("load_customer_info");
+     }
+    $sc_PayPal_form_prep = 1;
+   }
+ }
+##############################################################################
+sub PayPal_gateway_response {
+  local($myname)="PayPal";
+  if ($form_data{'ppret'}) {
+    if ($myname ne $sc_gateway_name) { # secondary gateway, load settings
+      &require_supporting_libraries(__FILE__,__LINE__,
+         "./admin_files/$myname-user_lib.pl");
+     } 
+    &load_order_lib;
+    $cart_id = $form_data{'ppret'};
+    &set_sc_cart_path;
+    &codehook("PayPal_order_return");
+    &process_PayPal_Order("return");
+    &call_exit;
+   }
+ }
+##############################################################################
+sub PayPal_pre_header_nav {
+ local($myname)="PayPal";
+$sc_PayPal_form_prep = 0;
+ if ($form_data{'ppsnd'}) {
+   if ($myname ne $sc_gateway_name) { # secondary gateway, load settings
+     &require_supporting_libraries(__FILE__,__LINE__,
+        "./admin_files/$myname-user_lib.pl");
+    }
+   &load_order_lib;
+   $cart_id = $form_data{'ppsnd'};
+   &set_sc_cart_path;
+   &codehook("PayPal_order_send");
+   &process_PayPal_Order("send");
+   &call_exit;
+  }
+ }
+###############################################################################
+
+sub PayPal_fields{
+local($myname)="PayPal";
+
+if (!($form_data{'gateway'} eq $myname)) { return;} 
+
+%sc_order_form_array =(
+  'Ecom_BillTo_Postal_Name_First', 'First Name',
+  'Ecom_BillTo_Postal_Name_Last', 'Last Name',
+  'Ecom_BillTo_Postal_Street_Line1', 'Billing Address Street',
+  'Ecom_BillTo_Postal_City', 'Billing Address City',
+  'Ecom_BillTo_Postal_StateProv', 'Billing Address State',
+  'Ecom_BillTo_PostalCode', 'Billing Address Zip',
+  'Ecom_BillTo_Postal_CountryCode', 'Billing Address Country',
+  'Ecom_ShipTo_Postal_Street_Line1', 'Shipping Address Street',
+  'Ecom_ShipTo_Postal_City', 'Shipping Address City',
+  'Ecom_ShipTo_Postal_StateProv', 'Shipping Address State',
+  'Ecom_ShipTo_Postal_PostalCode', 'Shipping Address Zip',
+  'Ecom_ShipTo_Postal_CountryCode', 'Shipping Address Country',
+  'Ecom_BillTo_Telecom_Phone_Number', 'Phone Number',
+  'Ecom_BillTo_Online_Email', 'Email',
+  'Ecom_is_Residential', 'Shipping to Residential Address',
+  'Ecom_ShipTo_Insurance', 'Insure this Shipment', # not implemented yet, for the future
+  'Ecom_tos', 'Sales-Terms of Service');
+                        
+@sc_order_form_required_fields = (
+  "Ecom_BillTo_Online_Email",
+  "Ecom_ShipTo_Postal_Name_First",
+  "Ecom_ShipTo_Postal_Name_Last",
+  "Ecom_ShipTo_Postal_Street_Line1",
+  "Ecom_ShipTo_Postal_City",
+	"Ecom_ShipTo_Postal_StateProv",
+	"Ecom_ShipTo_Postal_PostalCode",
+  "Ecom_ShipTo_Postal_CountryCode");
+
+# lines for tos added 2006 April 18 by jfindlay
+ if ($sc_display_checkout_tos =~ /yes/i) {
+    push(@sc_order_form_required_fields,"Ecom_tos");
+ }
+
+}
+
+###############################################################################
+sub PayPal_verification_table {
+  # added by Justin Findlay April 18, 2006
+  local ($rslt)="";
+  $rslt = <<ENDOFTEXT;
+  
+<div align="center">
+<table cellpadding="0" cellspacing="0" class="ac_checkout_review">
+<tr>
+<th colspan="2" class="ac_checkout_review">Customer Information</th>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Customer Number</td>
+<td class="ac_checkout_review_col2">$cart_id</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">E-Mail</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_BillTo_Online_Email'}&nbsp;</td>
+</tr>
+
+<tr>
+<th colspan="2" class="ac_checkout_review">Shipping Information</th>
+</tr>
+
+ENDOFTEXT
+
+if ($form_data{'Ecom_ShipTo_Method'} ne ""){
+$answer.= <<ENDOFTEXT;
+<tr>
+<td class="ac_checkout_review_col1">Ship via</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Method'}&nbsp;</td>
+</tr>
+ENDOFTEXT
+}
+
+$rslt.= <<ENDOFTEXT;
+
+<tr>
+<td class="ac_checkout_review_col1">Street</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_Street_Line1'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">City</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_City'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">State/Province</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_StateProv'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Zip</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_PostalCode'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Country</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_CountryCode'}&nbsp;</td>
+</tr>
+
+</table>
+</div>
+ENDOFTEXT
+
+  return $rslt;
+ }
+###############################################################################
+sub my_paypal_order_name{
+  local($temp);
+  eval('$temp = "' . $sc_paypal_order_name . '";');
+  return $temp;
+ }
+###############################################################################
+sub my_paypal_order_number{
+  local($temp);
+  eval('$temp = "' . $sc_paypal_order_number . '";');
+  return $temp;
+ }
+###############################################################################
+
+sub print_PayPal_SubmitPage
+
+{
+local($invoice_number, $customer_number, $url, $return, $img, $bn);
+local($myname)="PayPal";
+local($my_change,$my_message,$my_desc);
+
+if (!($form_data{'gateway'} eq $myname)) { return;} 
+if ($myname ne $sc_gateway_name) { # secondary gateway, load settings
+  &require_supporting_libraries(__FILE__,__LINE__,
+     "./admin_files/$myname-user_lib.pl");
+ }
+
+$invoice_number = $current_verify_inv_no;
+$customer_number = $cart_id;
+$customer_number =~ s/_/./g;
+
+if (($sc_paypal_email_before =~ /yes/i) &&
+    ($authPrice > 0)) {
+  $url = $sc_store_url . "?ppsnd=$cart_id";
+ } else {
+  &read_verify_file;
+  $url = &PayPal_URL_logic;
+  
+ }
+
+$img = "$sc_button_image_URL"; 
+$img =~ s/%%URLofImages%%/$URL_of_images_directory/g;
+$verification_table = &PayPal_verification_table;
+$my_desc = &script_and_substitute($sc_paypal_order_desc);
+$my_change = &script_and_substitute($sc_paypal_change);
+$my_make_changes = $sc_stepone_order_script_url . "?" . &make_href_fields
+	. "&order_form_button=1&ofn=PayPal";
+$my_message = &script_and_substitute($sc_paypal_verify_message);
+
+if ($order_ok_final_msg_tbl eq '') {
+ # Default so something is there, use $messages{'ordcnf_10'} though 
+ # to customize, set it in the Free Form Logic (either location.)
+  $order_ok_final_msg_tbl = "<b>Order Confirmation</b><br/><br/>" . &get_date;
+ }
+ 
+print <<ENDOFTEXT;
+
+<div align="center">
+  <p class="ac_checkout_top_msg">$order_ok_final_msg_tbl $my_message</p>
+
+$verification_table
+
+<TABLE WIDTH="500" BGCOLOR="#FFFFFF" CELLPADDING="2" CELLSPACING="0" BORDER=0>
+<TR>
+<TD COLSPAN=2>
+<CENTER>
+<A HREF="$my_make_changes"><IMG SRC="$my_change" BORDER=0></a>
+<br>
+<!-- Begin PayPal Logo -->
+<A HREF="$url" target="_top">
+<IMG SRC="$img" 
+BORDER="0" ALT="Make payments with PayPal - it's fast, free and secure!"></A>
+<!-- End PayPal Logo -->
+</CENTER>
+</TD>
+</TR>
+</TABLE>
+
+</CENTER>
+
+ENDOFTEXT
+
+}
+############################################################################################
+sub process_PayPal_Order {
+
+local ($mode)=@_;
+local ($subtotal, $total_quantity,
+       $total_measured_quantity,
+       $text_of_cart,
+       $required_fields_filled_in, $product, $quantity, $options);
+local ($stevo_shipping_thing) = "";
+local ($stevo_shipping_names) = "";
+local ($ship_thing_too,$ship_instructions, $href, $return, $bn);
+
+# NEW CODEHOOK
+&codehook("process-order-routine-top");
+
+#more complicated than required .... simplify someday!
+if ((($sc_paypal_email_before =~ /yes/i) && ($mode eq "send")) ||
+   ((!($sc_paypal_email_before =~ /yes/i)) && (!($mode eq "send")))){
+  &send_PayPal_Email;
+ }
+
+if ($mode eq "send") { # Need to send them to PayPal
+  $authPrice = $sc_verify_grand_total;
+  &read_verify_file;
+  $url = &PayPal_URL_logic;
+
+  print "Location: $url\n\n";
+  &call_exit;
+ }
+  
+print qq!
+<HTML>
+<HEAD>
+<TITLE>$messages{'ordcnf_08'}</TITLE>
+<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+$sc_standard_head_info</HEAD>
+<BODY $sc_standard_body_info>
+!;
+
+&SecureStoreHeader;
+
+print <<ENDOFTEXT;
+<CENTER>
+<TABLE WIDTH=500>
+<TR>
+<TD WIDTH=500>
+<BR>
+<FONT FACE=ARIAL>
+$messages{'ordcnf_01'}
+$messages{'ordcnf_02'}
+</FONT>
+</TD>
+</TR>
+</TABLE>
+<CENTER>  
+
+ENDOFTEXT
+
+# and the footer is printed
+
+&SecureStoreFooter;
+
+print qq!
+</BODY>
+</HTML>
+!;
+
+} # End of process_order_form
+
+#################################################################
+sub send_PayPal_Email {
+local($weight,$myoptions,$options,$quantity,$product,$product_price);
+local(%orderLoggingHash);
+#
+# Need to process this info
+&load_verify_file;
+
+$orderDate = &get_date;
+$text_of_cart .= "Gateway:       PayPal Standard\n\n";
+$orderLoggingHash{'GatewayUsed'} = "PayPal standard";
+
+$text_of_cart .= "New Order: $orderDate\n\n";
+
+$text_of_cart .= "  --PRODUCT INFORMATION--\n\n";
+
+open (CART, "$sc_cart_path") || &file_open_error("$sc_cart_path", 
+	"PayPal_display_cart_contents", __FILE__, __LINE__);
+
+if ($sc_opt_sep_marker eq '') {
+  $sc_opt_sep_marker = '<br>';
+ }
+while (<CART>) {
+$cartData++;
+@cart_fields = split (/\|/, $_);
+$quantity = $cart_fields[0];
+$product_price = $cart_fields[3];
+$product = $cart_fields[4];
+$weight = $cart_fields[6];
+$options = $cart_fields[$cart{"options"}];
+$options =~ s/${sc_opt_sep_marker}$//i;
+$myoptions = $options;
+$options =~ s/$sc_opt_sep_marker/,/gi;
+$text_of_cart .= &cart_textinfo(*cart_fields,$quantity,$product,
+                                $options,$product_price);
+$myoptions =~ s/<br>/,\n         /g;
+if ($myoptions ne '') { $myoptions = "\n        \($myoptions\)";}
+$stevo_shipping_thing .= "|$quantity\*$weight";
+$stevo_shipping_names .= "|$product$myoptions";
+&codehook("process-cart-item");
+}
+close(CART);
+
+# initialize hash variables in case they are empty later
+# added by jfindlay 2006 April 21
+
+$orderLoggingHash{'firstName'} = "";
+$orderLoggingHash{'lastName'} = "";
+$orderLoggingHash{'fullName'} = "";
+$orderLoggingHash{'orderFromAddress'} = "";
+$orderLoggingHash{'customerAddress2'} = "";
+$orderLoggingHash{'customerAddress3'} = "";
+$orderLoggingHash{'orderFromCity'} = "";
+$orderLoggingHash{'orderFromPostal'} = "";
+$orderLoggingHash{'customerPhone'} = "";
+$orderLoggingHash{'faxNumber'} = "";
+$orderLoggingHash{'customerPhone'} = "$eform_Ecom_BillTo_Telecom_Phone_Number";
+$orderLoggingHash{'companyName'} = "";
+$orderLoggingHash{'emailAddress'} = "";
+
+$orderLoggingHash{'shipToName'} = "";
+$orderLoggingHash{'shipToAddress'} = "";
+$orderLoggingHash{'shipToAddress2'} = "";
+$orderLoggingHash{'shipToAddress3'} = "";
+$orderLoggingHash{'shipToCity'} = "";
+$orderLoggingHash{'shipToState'} = "";
+$orderLoggingHash{'shipToPostal'} = "";
+$orderLoggingHash{'shipToCountry'} = "";
+$orderLoggingHash{'shiptoResidential'} = $eform_Ecom_is_Residential;
+$orderLoggingHash{'insureShipment'} = $eform_Ecom_ShipTo_Insurance; # not implemented yet, for the future
+
+
+$orderLoggingHash{'invoiceNumber'} = "";
+$orderLoggingHash{'customerNumber'} = "";
+$orderLoggingHash{'orderStatus'} = "$sc_order_status_default";
+$orderLoggingHash{'user1'} = "";
+$orderLoggingHash{'user2'} = "";
+$orderLoggingHash{'user3'} = "";
+$orderLoggingHash{'user4'} = "";
+$orderLoggingHash{'user5'} = "";
+$orderLoggingHash{'itemsordered'} = "";
+$orderLoggingHash{'shiptrackingID'} = "";
+$orderLoggingHash{'shipMethod'} = "";
+$orderLoggingHash{'orderFromState'} = "";
+$orderLoggingHash{'orderFromCountry'} = "";
+$orderLoggingHash{'shippingTotal'} = "";
+$orderLoggingHash{'salesTax'} = "";
+$orderLoggingHash{'tax1'} = "";
+$orderLoggingHash{'tax2'} = "";
+$orderLoggingHash{'tax3'} = "";
+$orderLoggingHash{'discounts'} = "";
+$orderLoggingHash{'netProfit'} = "";
+$orderLoggingHash{'affiliateTotal'} = "";
+$orderLoggingHash{'affiliateID'} = "";
+$orderLoggingHash{'affiliateMisc'} = "";
+$orderLoggingHash{'subTotal'} = "";
+$orderLoggingHash{'orderTotal'} = "";
+$orderLoggingHash{'adminMessages'} = "";
+$orderLoggingHash{'shippingMessages'} = "";
+$orderLoggingHash{'xcomments'} = "";
+$orderLoggingHash{'termsOfService'} = "$eform_Ecom_tos";
+
+# NEW CODEHOOK
+&codehook("process-order-pre-ship-instructions");
+
+$sc_orderlib_use_SBW_for_ship_ins = $sc_use_SBW;
+&codehook("orderlib-ship-instructions");
+if ($sc_orderlib_use_SBW_for_ship_ins =~ /yes/i) {
+  ($ship_thing_too,$ship_instructions) = 
+   &ship_put_in_boxes($stevo_shipping_thing,$stevo_shipping_names,
+   $sc_verify_Origin_ZIP,$sc_verify_boxes_max_wt); 
+ }
+$orderLoggingHash{'shippingMessages'} = "$ship_instructions";
+$orderLoggingHash{'shippingMessages'} =~ s/\n/<br>/g;
+
+$text_of_confirm_email .= $messages{'ordcnf_07'};
+
+$text_of_confirm_email .= $text_of_cart;
+$text_of_confirm_email .= "\n";
+$text_of_cart .= "  --ORDER INFORMATION--\n\n";
+
+$text_of_cart .= "CUSTID:        $cart_id \n";
+$text_of_confirm_email .= "CUSTID:        $cart_id \n";
+$orderLoggingHash{'customerNumber'} = "$cart_id";
+
+$text_of_cart .= "INVOICE:       $sc_verify_inv_no \n\n";
+$text_of_confirm_email .= "INVOICE:       $sc_verify_inv_no \n\n";
+$orderLoggingHash{'invoiceNumber'} = "$sc_verify_inv_no";
+
+if ($sc_display_checkout_tos =~ /yes/i) {
+  &add_text_of_both('SALES TERMS AND REFUND POLICY',$vform_Ecom_tos);
+  $orderLoggingHash{'termsOfService'} = "$vform_Ecom_tos";
+}
+
+my $temp = &display_price($sc_verify_subtotal);
+&add_text_of_both('SUBTOTAL',$temp);
+$temp = &format_price($sc_verify_subtotal);
+$sc_verify_subtotal_temp3 = $temp;
+$orderLoggingHash{'subTotal'} = "$temp";
+
+if ($sc_verify_shipping > 0) {
+    $temp = &display_price($sc_verify_shipping);
+    &add_text_of_both('SHIPPING',$temp);
+    $orderLoggingHash{'shippingTotal'} = &format_price($sc_verify_shipping);
+}
+ 
+if ($sc_verify_discount) {
+   &add_text_of_both('DISCOUNT',&format_price($sc_verify_discount));
+   $orderLoggingHash{'discounts'} = &format_price($sc_verify_discount);
+   &add_text_of_both('DISCOUNT CODE:',$eform_Ecom_Discount);
+   $orderLoggingHash{'discountCode'} = "$eform_Ecom_Discount";
+}
+ 
+if ($sc_verify_tax > 0) {
+    my $temp = substr(substr("SALES TAX",0,13).":               ",0,15);
+    $text_of_cart .= "$temp$sc_verify_tax\n";
+    $text_of_confirm_email .= "$temp$sc_verify_tax\n";
+    $orderLoggingHash{'salesTax'} = &format_price($sc_verify_tax);
+}
+if ($sc_verify_etax1) {
+ &add_text_of_both($sc_extra_tax1_name,$sc_verify_etax1);
+ $orderLoggingHash{'tax1'} = &format_price($sc_verify_etax1);
+}
+if ($sc_verify_etax2) {
+ &add_text_of_both($sc_extra_tax2_name,$sc_verify_etax2);
+ $orderLoggingHash{'tax2'} = &format_price($sc_verify_etax2);
+}
+if ($sc_verify_etax3) {
+ &add_text_of_both($sc_extra_tax3_name,$sc_verify_etax3);
+ $orderLoggingHash{'tax3'} = &format_price($sc_verify_etax3);
+}
+ 
+$temp = &display_price($sc_verify_grand_total);
+
+&add_text_of_both("TOTAL",$temp);
+$orderLoggingHash{'orderTotal'} = &format_price($sc_verify_grand_total);
+
+&add_text_of_cart("Email",$vform_Ecom_BillTo_Online_Email);
+$orderLoggingHash{'emailAddress'} = "$vform_Ecom_BillTo_Online_Email";
+
+$text_of_cart .= "\nSHIPPING INFORMATION --------------\n\n";
+
+$shipToName = $vform_Ecom_ShipTo_Postal_Name_First . ' ' . $vform_Ecom_ShipTo_Postal_Name_Last;
+&add_text_of_both('NAME',$shipToName);
+$orderLoggingHash{'shipToName'} = "$shipToName";
+$orderLoggingHash{'fullName'} = "$shipToName";
+$orderLoggingHash{'firstName'} = "$vform_Ecom_ShipTo_Postal_Name_First";
+$orderLoggingHash{'lastName'} = "$vform_Ecom_ShipTo_Postal_Name_Last";
+
+&add_text_of_both('ADDRESS',$vform_Ecom_ShipTo_Postal_Street_Line1);
+$orderLoggingHash{'shipToAddress'} = "$vform_Ecom_ShipTo_Postal_Street_Line1";
+$orderLoggingHash{'orderFromAddress'} = "$vform_Ecom_ShipTo_Postal_Street_Line1";
+
+&add_text_of_both('CITY',$vform_Ecom_ShipTo_Postal_City);
+$orderLoggingHash{'shipToCity'} = "$vform_Ecom_ShipTo_Postal_City";
+$orderLoggingHash{'orderFromCity'} = "$vform_Ecom_ShipTo_Postal_City";
+
+&add_text_of_both('STATE',$vform_Ecom_ShipTo_Postal_StateProv);
+$orderLoggingHash{'shipToState'} = "$vform_Ecom_ShipTo_Postal_StateProv";
+$orderLoggingHash{'orderFromState'} = "$vform_Ecom_ShipTo_Postal_StateProv";
+
+&add_text_of_both('ZIP',$vform_Ecom_ShipTo_Postal_PostalCode);
+$orderLoggingHash{'shipToPostal'} = "$vform_Ecom_ShipTo_Postal_PostalCode";
+$orderLoggingHash{'orderFromPostal'} = "$vform_Ecom_ShipTo_Postal_PostalCode";
+
+&add_text_of_both('COUNTRY',$vform_Ecom_ShipTo_Postal_CountryCode);
+$orderLoggingHash{'shipToCountry'} = "$vform_Ecom_ShipTo_Postal_CountryCode";
+$orderLoggingHash{'orderFromCountry'} = "$vform_Ecom_ShipTo_Postal_CountryCode";
+
+$orderLoggingHash{'shipMethod'} = "$vform_Ecom_ShipTo_Method";
+if (($sc_use_SBW =~ /yes/i) || ($form_data{'x_Freight'} > .009)) {
+  &add_text_of_conf("SHIP VIA",$vform_Ecom_ShipTo_Method);
+}
+
+if ($ship_instructions ne "") {
+  $text_of_cart .= "\nShipping Instructions: \n$ship_instructions\n";
+ }
+
+# NEW CODEHOOK
+&codehook("process-order-pre-xcomments");
+
+$text_of_cart .= $XCOMMENTS_ADMIN;
+$orderLoggingHash{'xcomments'} = "$XCOMMENTS";
+$orderLoggingHash{'xcomments'} =~ s/\n/<br>/g;
+$orderLoggingHash{'adminMessages'} =~ s/\t/ /g;
+$text_of_confirm_email .= $XCOMMENTS;
+$orderLoggingHash{'adminMessages'} .= "$XCOMMENTS_ADMIN";
+$orderLoggingHash{'adminMessages'} =~ s/\n/<br>/g;
+$orderLoggingHash{'adminMessages'} =~ s/\t/ /g;
+
+$text_of_cart = "Go to PayPal.com to obtain Order information\n\n" .
+                $text_of_cart;
+
+if ($sc_use_pgp =~ /yes/i)
+{
+&require_supporting_libraries(__FILE__, __LINE__, "$sc_pgp_lib_path");
+$text_of_cart = &make_pgp_file($text_of_cart, "$sc_pgp_temp_file_path/$$.pgp");
+$text_of_cart = "\n" . $text_of_cart . "\n";
+}
+
+# NEW CODEHOOK
+&codehook("process-order-pre-logOrder");
+
+&log_order($text_of_cart,$sc_verify_inv_no,$cart_id);
+
+# This empties the cart after the order is "successful"
+&empty_cart;
+
+if (($sc_send_order_to_email =~ /yes/i) && 
+    ($sc_verify_inv_no ne "")){
+  $my_order_name = &my_paypal_order_name . &my_paypal_order_number;
+  &send_mail($sc_order_email, $sc_order_email, $my_order_name, $text_of_cart);
+}
+
+$zemail = $vform_Ecom_BillTo_Online_Email;
+if (($cartData) && ($zemail ne "")) {
+  &send_mail($sc_admin_email, $zemail, $messages{'ordcnf_08'}, 
+           "$text_of_confirm_email");
+ }
+
+}
+#################################################################
+
+1; # Library
diff -ruN 4.0K-4b/library/PlugnPay-mgr_lib.pl 5.0.000/library/PlugnPay-mgr_lib.pl
--- 4.0K-4b/library/PlugnPay-mgr_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/PlugnPay-mgr_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,19 +1,24 @@
 #
 # For the Credit Card Processing Gateway - Plug 'n Pay Technologies, Inc.
 #
-# Copyright 2002 Plug 'n Pay Technologies, Inc.  All Rights Reserved.
-# Last Updated: 02/13/02
+# Copyright 2002-2006  K-Factor Technologies, Inc. and AgoraScript  All Rights Reserved.
+# Donated by Plug 'n Pay Technologies, Inc. (based on previous modules)
+# Last Updated: May 5, 2006 by Mister Ed
 
 # Notes:
 # -- Includes Enhanced Color Selections
 
-$versions{'PlugnPay-mgr_lib.pl'} = "20020222";
+$versions{'PlugnPay-mgr_lib.pl'} = "5.0.000";
 &add_codehook("gateway_admin_screen","PlugnPay_mgr_check");
 &add_codehook("gateway_admin_settings","PlugnPay_settings");
 $mc_gateways .= "|PlugnPay";
 ##############################################################################
 sub PlugnPay_settings {
   if ($sc_gateway_name eq "PlugnPay") {
+
+    $sc_plugnpay_verify_message_temp = &my_escape($in{'sc_plugnpay_verify_message'});
+    $sc_tos_display_address_temp = &my_escape($in{'sc_tos_display_address'});
+
     open (GW, "> $gateway_settings") || &my_die("Can't Open $gateway_settings");
 
     # main settings
@@ -27,11 +32,18 @@
     print (GW "\$sc_gateway_easycart = '$in{'sc_gateway_easycart'}';\n");
     print (GW "\$sc_gateway_shipinfo = '$in{'sc_gateway_shipinfo'}';\n");
     print (GW "\$sc_gateway_send_weight = '$in{'sc_gateway_send_weight'}';\n");
+    print (GW "\$sc_plugnpay_submit = '$in{'sc_plugnpay_submit'}';\n");
+    print (GW "\$sc_plugnpay_change = '$in{'sc_plugnpay_change'}';\n");
+    print (GW "\$sc_plugnpay_verify_message = qq'$sc_plugnpay_verify_message_temp';\n");
+    print (GW "\$sc_display_checkout_tos = '$in{'sc_display_checkout_tos'}';\n");
+    print (GW "\$sc_tos_display_address = qq'$sc_tos_display_address_temp';\n");
+    print (GW ";\n");
 
     # email settings
     print (GW "\$sc_gateway_email = '$in{'sc_gateway_email'}';\n");
     print (GW "\$sc_gateway_cc_mail = '$in{'sc_gateway_cc_mail'}';\n");
     print (GW "\$sc_gateway_subject = '$in{'sc_gateway_subject'}';\n");
+    print (GW "\$sc_plugnpay_order_desc = '$in{'sc_plugnpay_order_desc'}';\n");
     print (GW "\$sc_gateway_message = '$in{'sc_gateway_message'}';\n");
     print (GW "\$sc_gateway_subject_email = '$in{'sc_gateway_subject_email'}';\n");
     print (GW "\$sc_gateway_dontsendmail = '$in{'sc_gateway_dontsendmail'}';\n");
@@ -113,7 +125,7 @@
   </TR>
 
   <TR>
-    <TD WIDTH=580><FONT FACE=ARIAL>$sc_gateway_name Settings $msg</FONT></TD>
+    <TD WIDTH=580><FONT FACE=ARIAL>PlugnPay Settings $msg</FONT></TD>
   </TR>
 </TABLE>
 </CENTER>
@@ -246,6 +258,11 @@
   </TR>
 
   <TR>
+    <TD width="80%">Subject line of AgoraCart email sent to merchant:</TD>
+    <TD width="20%"><INPUT NAME="sc_plugnpay_order_desc" TYPE="TEXT" SIZE=30 VALUE='$sc_plugnpay_order_desc'></TD>
+  </TR>
+
+  <TR>
     <TD COLSPAN=2 align=center><HR width=80%></TD>
   </TR>
 
@@ -355,6 +372,60 @@
   </TR>
 
   <TR>
+    <TD COLSPAN=2><HR width=80%></TD>
+  </TR>
+  
+  <TR>
+    <TD COLSPAN=2>URL of 'Submit to PlugnPay' button:<br></TD>
+  </TR>
+  <TR>
+    <TD COLSPAN=2 align="right"><INPUT NAME="sc_plugnpay_submit" TYPE="TEXT" SIZE=60 VALUE='$sc_plugnpay_submit'><br></TD>
+  </TR>
+  
+  <TR>
+    <TD COLSPAN=2>URL of 'Make Changes' button:<br></TD>
+  </TR>
+  <TR>
+    <TD COLSPAN=2 align="right"><INPUT NAME="sc_plugnpay_change" TYPE="TEXT" SIZE=60 VALUE='$sc_plugnpay_change'><br></TD>
+  </TR>
+
+  <TR>
+    <TD COLSPAN=2><HR width=80%></TD>
+  </TR>
+  
+  <TR>
+    <TD COLSPAN=2>Message at the top of the Verify Order table:<br></TD>
+  </TR>
+  <TR>
+    <TD COLSPAN=2 align="right"><TEXTAREA NAME="sc_plugnpay_verify_message" ROWS=4 COLS=65 wrap=soft>$sc_plugnpay_verify_message</TEXTAREA></TD>
+  </TR>
+  
+  <TR>
+    <TD COLSPAN=2><br><HR width=80%><br></TD>
+  </TR>
+  
+  <TR>
+    <TD>Display Terms of Service and Refund Policy checkbox and set as required?</TD>
+    <TD align="right">
+      <SELECT NAME="sc_display_checkout_tos">
+      <OPTION>$sc_display_checkout_tos</OPTION>
+      <OPTION>yes</OPTION>
+      <OPTION>no</OPTION>
+      </SELECT>
+    </TD>
+  </TR>
+  <TR>
+    <TD COLSPAN=2><br>Business address and phone number (contact information) for your business.  Should be legal address for the business location for full disclosure and other privacy requirements mandated by credit card companies as well as government enitities that require such notices:<br>
+    </TD>
+  <TR>
+    <TD COLSPAN=2 align="right"><TEXTAREA NAME="sc_tos_display_address" cols="68" rows=5 wrap=off>$sc_tos_display_address</TEXTAREA><br>
+  </TD>
+  </TR>
+
+
+</TD>
+</TR>
+  <TR>
     <TH COLSPAN=2 bgcolor=#cccccc><b>Shipping Options</b></TH>
   </TR>
 
@@ -576,7 +647,7 @@
   <TR>
     <TD COLSPAN=2><CENTER>
       <INPUT TYPE="HIDDEN" NAME="system_edit_success" VALUE="yes">
-      <INPUT TYPE="HIDDEN" NAME="gateway" VALUE="$sc_gateway_name">
+      <INPUT TYPE="HIDDEN" NAME="gateway" VALUE="PlugnPay">
       <INPUT NAME="GatewaySettings" TYPE="SUBMIT" VALUE="Submit">
       &nbsp;&nbsp;
       <INPUT TYPE="RESET" VALUE="Reset">
diff -ruN 4.0K-4b/library/PlugnPay-order_lib.pl 5.0.000/library/PlugnPay-order_lib.pl
--- 4.0K-4b/library/PlugnPay-order_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/PlugnPay-order_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -2,13 +2,18 @@
 #                    Order Form Definition Variables                  #
 #######################################################################
 
-# Module Last Updated: 02/21/02
+# Module Last Updated: May 2, 2006
+# mashed up by PNP technical staff
 # (SPK added $sc_special_page_meta_tags var on 03/12/2002)
+# updated for new PNP variables Feb 2006 by Michael Lehmann from PNP
+# v5 conversions by Justin Findlay from AgoraScript / K-Factor Technologies, Inc. April 2006
+# Misc updates and fixes by Mister Ed from AgoraScript / K-Factor Technologies, Inc., May 3, 2006
+# Major fixes by Mister Ed from AgoraScript / K-Factor Technologies, Inc., May 5, 2006
 
-$versions{'PlugnPay-order_lib.pl'} = "20020312";
+$versions{'PlugnPay-order_lib.pl'} = "5.0.000";
 
 $sc_order_response_vars{"PlugnPay"}="FinalStatus";
-#$sc_use_secure_header_at_checkout = 'yes';
+$sc_use_secure_header_at_checkout = 'yes';
 
 &add_codehook("printSubmitPage","print_PlugnPay_SubmitPage");
 &add_codehook("set_form_required_fields","PlugnPay_fields");
@@ -18,7 +23,7 @@
 ###############################################################################
 sub check_for_PlugnPay_response {
   if ($form_data{'FinalStatus'} eq "success") {
-    $cart_id = $form_data{'cart_id'};
+    $cart_id = $form_data{'customer_number'};
     &set_sc_cart_path;
     &load_order_lib;
     &codehook("PlugnPay_order");
@@ -27,7 +32,17 @@
   }
 }
 ###############################################################################
+sub PlugnPay_check_and_load {
+local($myname)="PlugnPay";
+if ($myname ne $sc_gateway_name) { # we are a secondary gateway, load settings
+  &require_supporting_libraries(__FILE__,__LINE__,
+     "./admin_files/$myname-user_lib.pl");
+ }
+
+}
+###############################################################################
 sub PlugnPay_order_form_prep { # load the customer info ...
+  &PlugnPay_check_and_load;
   if ($sc_PlugnPay_form_prep == 0) {
     if (-f "$sc_verify_order_path"){
       &read_verify_file;
@@ -65,7 +80,10 @@
     'Ecom_Payment_Card_Number',         'Card Number',
     'Ecom_Payment_Card_ExpDate_Month',  'Card Expiration Month',
     'Ecom_Payment_Card_ExpDate_Day',    'Card Expiration Day',
-    'Ecom_Payment_Card_ExpDate_Year',   'Card Expiration Year'
+    'Ecom_Payment_Card_ExpDate_Year',   'Card Expiration Year',
+    'Ecom_is_Residential',              'Shipping to Residential Address',
+    'Ecom_ShipTo_Insurance',            'Insure this Shipment', # not implemented yet, for the future
+    'Ecom_tos',                         'Sales-Terms of Service'
   );
 
   @sc_order_form_required_fields = (
@@ -73,17 +91,65 @@
     "Ecom_ShipTo_Postal_PostalCode"
   );
 
+ if ($sc_display_checkout_tos =~ /yes/i) {
+    push(@sc_order_form_required_fields,"Ecom_tos");
+ }
+
+
 }
 ###############################################################################
 sub PlugnPay_verification_table {
   local ($rslt) = "";
 
-  $rslt  = "<table border=0 width=100%>\n";
-  $rslt .= "  <tr>\n";
-  $rslt .= "    <td align=center>State: $form_data{'Ecom_ShipTo_Postal_StateProv'} </td>\n";
-  $rslt .= "    <td align=center>Zip: $form_data{'Ecom_ShipTo_Postal_PostalCode'} </td>\n";
-  $rslt .= "  </tr>\n";
-  $rslt .= "</table>\n";
+  $rslt = <<ENDOFTEXT;
+
+<div align="center">
+<table cellpadding="0" cellspacing="0" class="ac_checkout_review">
+<tr>
+<th colspan="2" class="ac_checkout_review">Customer Information</th>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Customer Number</td>
+<td class="ac_checkout_review_col2">$cart_id</td>
+</tr>
+
+<tr>
+<th colspan="2" class="ac_checkout_review">Shipping Information</th>
+</tr>
+
+ENDOFTEXT
+
+  if ($form_data{'Ecom_ShipTo_Method'} ne ""){
+  $rslt .= <<ENDOFTEXT;
+<tr>
+<td class="ac_checkout_review_col1">Ship via</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Method'}&nbsp;</td>
+</tr>
+ENDOFTEXT
+  }
+
+  $rslt .= <<ENDOFTEXT;
+
+<tr>
+<td class="ac_checkout_review_col1">State/Province</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_StateProv'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Zip</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_PostalCode'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Country</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_CountryCode'}&nbsp;</td>
+</tr>
+
+</table>
+</div>
+ENDOFTEXT
+
   return $rslt;
 }
 ###############################################################################
@@ -154,6 +220,9 @@
 local($invoice_number, $customer_number);
 local($test_mode,$mytable);
 local($myname) = "PlugnPay";
+local($my_change,$my_submit,$my_message,$my_desc);
+
+my ($countthingy);
 
 if (!($form_data{'gateway'} eq $myname)) { return; } 
 
@@ -163,6 +232,10 @@
 
 &codehook("PlugnPay-SubmitPage-top");
 
+$my_submit = &script_and_substitute($sc_plugnpay_submit);
+$my_change = &script_and_substitute($sc_plugnpay_change);
+$my_message = &script_and_substitute($sc_plugnpay_verify_message);
+$my_desc = &script_and_substitute($sc_plugnpay_order_desc);
 $mytable = &PlugnPay_verification_table;
 
 if ($merchant_live_mode =~ /yes/i){
@@ -197,17 +270,20 @@
 
 $invoice_number = $current_verify_inv_no;
 $customer_number = $form_data{'cart_id'};
-#$customer_number = $cart_id;
-$customer_number =~ s/_/./g;
+
+# created by PNP staff ... but taken back out as it kills the cart on return - by Mister Ed
+#$customer_number =~ s/_/./g;
 
 &pnp_table_setup;
 
+# my $pnp_temp_price = ($authPrice - $zfinal_discount);
+
 &codehook("PlugnPay-SubmitPage-print");
 
 # SHOW PNP FORM FIELDS HERE
 print <<ENDOFTEXT;
 
-<FORM METHOD=POST ACTION=\"https://pay1.plugnpay.com/payment/$sc_gateway_username\pay.cgi\">
+<FORM METHOD=POST ACTION=\"https://pay1.plugnpay.com/payment/pay.cgi\">
 <!-- Required Settings -->
 <INPUT TYPE=HIDDEN NAME=publisher-name VALUE=\"$sc_gateway_username\">
 <INPUT TYPE=HIDDEN NAME=publisher-email VALUE=\"$sc_gateway_email\">
@@ -399,13 +475,22 @@
   print "<INPUT TYPE=HIDDEN NAME=\"item$count\" VALUE=\"$my_cart_fields[1]\">\n";
   print "<INPUT TYPE=HIDDEN NAME=\"quantity$count\" VALUE=\"$my_cart_fields[0]\">\n";
   print "<INPUT TYPE=HIDDEN NAME=\"description$count\" VALUE=\"$my_cart_fields[4] $options\">\n";
-  print "<INPUT TYPE=HIDDEN NAME=\"cost$count\" VALUE=\"$my_cart_fields[13]\">\n";
+  print "<INPUT TYPE=HIDDEN NAME=\"cost$count\" VALUE=\"$my_cart_fields[16]\">\n";
   if ($sc_gateway_send_weight =~ /yes/i) {
     print "<INPUT TYPE=HIDDEN NAME=\"weight$count\" VALUE=\"$my_cart_fields[6]\">\n";
   }
+  $countthingy = $count;
 }
 close (CART);
 
+if ($zfinal_discount) {
+$countthingy++;
+  print "<INPUT TYPE=HIDDEN NAME=\"item$countthingy\" VALUE=\"Discount\">\n";
+  print "<INPUT TYPE=HIDDEN NAME=\"quantity$countthingy\" VALUE=\"1\">\n";
+  print "<INPUT TYPE=HIDDEN NAME=\"description$countthingy\" VALUE=\"Total Discount on Order\">\n";
+  print "<INPUT TYPE=HIDDEN NAME=\"cost$countthingy\" VALUE=\"-$zfinal_discount\">\n";
+}
+
 print "$test_mode";
 
 print "<!-- Agora Cart Name/Value Pairs--> \n";
@@ -437,34 +522,23 @@
 
 print <<ENDOFTEXT;
 
-<TABLE WIDTH="500" BGCOLOR="#C0FFFF" CELLPADDING="0" CELLSPACING="0">
+<div align="center">
+
+<p class="ac_checkout_top_msg">$my_message</p>
+
+$mytable
+
+<TABLE WIDTH="500" BGCOLOR="#FFFFFF" CELLPADDING="2" CELLSPACING="0" BORDER=0>
   <TR>
-    <TD><TABLE WIDTH="500" BGCOLOR="#000080" CELLPADDING="0" CELLSPACING="0">
-      <TR>
-        <TD BGCOLOR="#C0FFFF"><FONT FACE="ARIAL" SIZE="2" COLOR="#000000">$messages{'ordcnf_06'}</FONT></TD>
-        <TD BGCOLOR="#C0FFFF">
-      </TR>
-      <TR>
-        <TD BGCOLOR="#C0FFFF"><FONT FACE="ARIAL" SIZE="2" COLOR="#000000">$mytable</TD>
-      </TR>
-
-      <TR>
-        <TD BGCOLOR="#C0FFFF"><FONT FACE="ARIAL" SIZE="2" COLOR="#000000"><b>Please verify the following information. When you are confident that it is correct, click the 'Secure Orderform' button to enter your payment information, or <a href="$sc_stepone_order_script_url\?order_form_button.x=1">click here</a> to make corrections:</b></FONT></TD>
-      </TR>
-
-      <TR>
-        <TD BGCOLOR="#C0FFFF">&nbsp;</TD>
-      </TR>
-      <TR>
-        <TD ALIGN="CENTER" BGCOLOR="#C0FFFF"><INPUT TYPE=SUBMIT VALUE="Secure Orderform"></TD>
-      </TR>
-      <TR>
-        <TD BGCOLOR="#C0FFFF">&nbsp;</TD>
-      </TR>
-    </TABLE></TD>
+    <TD COLSPAN=2>
+      <CENTER>
+        <INPUT TYPE="IMAGE" NAME="Submit" VALUE="Submit Order For Processing" SRC="$my_submit" border=0>
+        &nbsp;&nbsp;&nbsp;&nbsp;
+        <a href="agora.cgi?order_form_button.x=1&cart_id=${cart_id}"><IMG SRC="$my_change" BORDER=0></a>
+      </CENTER>
+    </TD>
   </TR>
 </TABLE>
-
 </FORM>
 </CENTER>
 
@@ -483,24 +557,17 @@
 local($stevo_shipping_names) = "";
 local($mytext) = "";
 local($ship_thing_too,$ship_instructions);
+local(%orderLoggingHash);
+my ($temp_number);
 
 
 # Note: The below comments & code is left over from the script rewrite...  Don't know if it's needed, so I left it in.
 
 ## Need to process this info someday ... 
 &load_verify_file;
-##
-## Now verify the order total and the shipping cost
-##if ((!($sc_verify_shipping == $form_data{'shipping'})) || (!($sc_verify_grand_total == $form_data{'card-amount'}))) {
-##  $mytext =  "This order failed automatic verification, and has been \n";
-##  $mytext .= "marked for manual verification.  The reason is:\n";
-##  if (!($sc_verify_shipping == $form_data{'shipping'})) {
-##    $mytext .= "Shipping amount: $form_data{'shipping'}  " . " (expected $sc_verify_shipping).\n";
-##  }
-##  if (!($sc_verify_grand_total == $form_data{'card-amount'})) {
-##    $mytext .= "Order Total: $form_data{'card-amount'}  " . " (expected $sc_verify_grand_total).\n";
-##  }
-##}
+
+# NEW CODEHOOK
+&codehook("process-order-routine-top");
 
 # First, we output the header of the processing of the order
 
@@ -510,7 +577,7 @@
 print "$sc_special_page_meta_tags";
 print "<HEAD>\n";
 print "<TITLE>$messages{'ordcnf_08'}</TITLE>\n";
-print "$sc_standard_head_info\n";
+print "$sc_secure_standard_head_info\n";
 print "</HEAD>\n";
 print "<BODY $sc_standard_body_info>\n";
 
@@ -550,6 +617,7 @@
 $text_of_cart .= "$mytext";
 $text_of_cart .= "Order Date:    $orderDate\n";
 $text_of_cart .= "Gateway:       PlugnPay\n\n";
+$orderLoggingHash{'GatewayUsed'} = "PlugnPay";
 
 $text_of_cart .= "  --PRODUCT INFORMATION--\n\n";
 
@@ -573,6 +641,63 @@
 
 close(CART);
 
+# initialize hash variables in case they are empty later
+# jfindlay 2006 May 2
+
+$orderLoggingHash{'firstName'} = "";
+$orderLoggingHash{'lastName'} = "";
+$orderLoggingHash{'fullName'} = "";
+$orderLoggingHash{'orderFromAddress'} = "";
+$orderLoggingHash{'customerAddress2'} = "";
+$orderLoggingHash{'customerAddress3'} = "";
+$orderLoggingHash{'orderFromCity'} = "";
+$orderLoggingHash{'orderFromPostal'} = "";
+$orderLoggingHash{'customerPhone'} = "";
+$orderLoggingHash{'faxNumber'} = "";
+$orderLoggingHash{'companyName'} = "";
+$orderLoggingHash{'emailAddress'} = "";
+
+$orderLoggingHash{'shipToName'} = "";
+$orderLoggingHash{'shipToAddress'} = "";
+$orderLoggingHash{'shipToAddress2'} = "";
+$orderLoggingHash{'shipToAddress3'} = "";
+$orderLoggingHash{'shipToCity'} = "";
+$orderLoggingHash{'shipToState'} = "";
+$orderLoggingHash{'shipToPostal'} = "";
+$orderLoggingHash{'shipToCountry'} = "";
+$orderLoggingHash{'shiptoResidential'} = $vform_Ecom_is_Residential;
+$orderLoggingHash{'insureShipment'} = $vform_Ecom_ShipTo_Insurance; # not implemented yet, for the future
+
+$orderLoggingHash{'invoiceNumber'} = "";
+$orderLoggingHash{'customerNumber'} = "";
+$orderLoggingHash{'orderStatus'} = "$sc_order_status_default";
+$orderLoggingHash{'user1'} = "";
+$orderLoggingHash{'user2'} = "";
+$orderLoggingHash{'user3'} = "";
+$orderLoggingHash{'user4'} = "";
+$orderLoggingHash{'user5'} = "";
+$orderLoggingHash{'itemsordered'} = "";
+$orderLoggingHash{'shiptrackingID'} = "";
+$orderLoggingHash{'shipMethod'} = "";
+$orderLoggingHash{'orderFromState'} = "";
+$orderLoggingHash{'orderFromCountry'} = "";
+$orderLoggingHash{'shippingTotal'} = "";
+$orderLoggingHash{'salesTax'} = "";
+$orderLoggingHash{'tax1'} = "";
+$orderLoggingHash{'tax2'} = "";
+$orderLoggingHash{'tax3'} = "";
+$orderLoggingHash{'discounts'} = "";
+$orderLoggingHash{'netProfit'} = "";
+$orderLoggingHash{'affiliateTotal'} = "";
+$orderLoggingHash{'affiliateID'} = "";
+$orderLoggingHash{'affiliateMisc'} = "";
+$orderLoggingHash{'subTotal'} = "";
+$orderLoggingHash{'orderTotal'} = "";
+$orderLoggingHash{'adminMessages'} = "";
+$orderLoggingHash{'shippingMessages'} = "";
+$orderLoggingHash{'xcomments'} = "";
+$orderLoggingHash{'termsOfService'} = "$vform_Ecom_tos";
+
 $sc_orderlib_use_SBW_for_ship_ins = $sc_use_SBW;
 &codehook("orderlib-ship-instructions");
 
@@ -582,6 +707,9 @@
    $sc_verify_Origin_ZIP,$sc_verify_boxes_max_wt); 
 }
 
+$orderLoggingHash{'shippingMessages'} = "$ship_instructions";
+$orderLoggingHash{'shippingMessages'} =~ s/\n/<br>/g;
+
 $text_of_confirm_email .= $messages{'ordcnf_07'};
 
 $text_of_confirm_email .= $text_of_cart;
@@ -589,25 +717,38 @@
 
 $text_of_cart .= "  --ORDER INFORMATION--\n\n";
 
-$text_of_cart .= "CUSTID:        $form_data{'customer_id'}\n";
-$text_of_confirm_email .= "CUSTID:        $form_data{'customer_id'}\n";
+$text_of_cart .= "CUSTID:        $eform_cart_id\n";
+$text_of_confirm_email .= "CUSTID:        $eform_cart_id\n";
+$orderLoggingHash{'customerNumber'} = "$eform_cart_id";
 
 $text_of_cart .= "INVOICE:       $form_data{'order-id'}\n";
 $text_of_confirm_email .= "INVOICE:       $form_data{'order-id'}\n";
+$orderLoggingHash{'invoiceNumber'} = "$form_data{'order-id'}";
+
+$temp_number = &format_price($sc_verify_subtotal);
+&add_text_of_both("SUBTOTAL",$temp_number);
+$orderLoggingHash{'subTotal'} = "$temp_number";
+$orderLoggingHash{'shipMethod'} = "$sc_verify_shipto_method";
 
 if ($form_data{'shipping'}) {
   $text_of_cart .= "SHIPPING:      $form_data{'shipping'}\n";
   $text_of_confirm_email .= "SHIPPING:      $form_data{'shipping'}\n";
+  $orderLoggingHash{'shippingTotal'} = "$form_data{'shipping'}";
 
-  if ($sc_use_SBW =~ /yes/i) {
-    $text_of_confirm_email .= "SHIP VIA:      $form_data{'HW2SHIP'}\n";
+  if (($sc_use_SBW =~ /yes/i) || ($form_data{'x_Freight'} > .009)) {
+    $text_of_confirm_email .= "SHIP VIA:      $sc_verify_shipto_method\n";
   }
 }
 
-if ($form_data{'discount'}) {
-  $text_of_cart .= "DISCOUNT:      $form_data{'discount'}\n";
-  $text_of_confirm_email .= "DISCOUNT:      $form_data{'discount'}\n";
-}
+  if ($sc_verify_discount) {
+      $temp_number = &format_price($sc_verify_discount);
+      $text_of_cart .= "DISCOUNT:      $temp_number\n";
+      $text_of_confirm_email .= "DISCOUNT:      $temp_number\n";
+      $orderLoggingHash{'discounts'} = "$temp_number";
+      $text_of_cart .= "DISCOUNT CODE: $eform_Ecom_Discount\n";
+      $text_of_confirm_email .= "DISCOUNT CODE: $eform_Ecom_Discount\n";
+      $orderLoggingHash{'discountCode'} = "$eform_Ecom_Discount";
+  }
 
 if ($form_data{'tax'}) {
   $text_of_cart .= "TOT SALES TAX: $form_data{'tax'}\n";
@@ -618,28 +759,33 @@
   $temp = substr(substr("SALES TAX",0,13).":               ",0,15);
   $text_of_cart .= "$temp$sc_verify_tax\n";
   $text_of_confirm_email .= "$temp$sc_verify_tax\n";
+  $orderLoggingHash{'salesTax'} = "$sc_verify_tax";
 }
 
 if ($sc_verify_etax1 > 0) {
   $temp = substr(substr($sc_extra_tax1_name,0,13).":               ",0,15);
   $text_of_cart .= "$temp$sc_verify_etax1\n";
   $text_of_confirm_email .= "$temp$sc_verify_etax1\n";
+  $orderLoggingHash{'tax1'} = "$sc_verify_etax1";
 }
 
 if ($sc_verify_etax2 > 0) {
   $temp = substr(substr($sc_extra_tax2_name,0,13).":               ",0,15);
   $text_of_cart .= "$temp$sc_verify_etax2\n";
   $text_of_confirm_email .= "$temp$sc_verify_etax2\n";
+  $orderLoggingHash{'tax2'} = "$sc_verify_etax2";
 }
 
 if ($sc_verify_etax3 > 0) {
   $temp = substr(substr($sc_extra_tax3_name,0,13).":               ",0,15);
   $text_of_cart .= "$temp$sc_verify_etax3\n";
   $text_of_confirm_email .= "$temp$sc_verify_etax3\n";
+  $orderLoggingHash{'tax3'} = "$sc_verify_etax3";
 }
 
 $text_of_cart .= "TOTAL:         $form_data{'card-amount'}\n";
 $text_of_confirm_email .= "TOTAL:         $form_data{'card-amount'}\n";
+$orderLoggingHash{'orderTotal'} = "$form_data{'card-amount'}";
 
 $text_of_cart .= "METHOD:        $form_data{'paymethod'}\n";
 $text_of_cart .= "TYPE:          $form_data{'card_type'}\n";
@@ -649,34 +795,105 @@
 $text_of_cart .= "TRANS ID:      $form_data{'orderID'}\n\n";
 
 $text_of_cart .= "BILLING INFORMATION --------------\n\n";
+
 $text_of_cart .= "NAME:          $form_data{'card-name'}\n";
+$orderLoggingHash{'fullName'} = "$form_data{'card-name'}";
+
 $text_of_cart .= "COMPANY:       $form_data{'card-company'}\n";
+$orderLoggingHash{'companyName'} = "$form_data{'card-company'}";
+
 $text_of_cart .= "ADDRESS:       $form_data{'card-address1'}\n";
+$orderLoggingHash{'orderFromAddress'} = "$form_data{'card-address1'}";
+
+$text_of_cart .= "ADDRESS Line 2:       $form_data{'card-address2'}\n";
+$orderLoggingHash{'customerAddress2'} = "$form_data{'card-address2'}";
+
 $text_of_cart .= "CITY:          $form_data{'card-city'}\n";
+$orderLoggingHash{'orderFromCity'} = "$form_data{'card-city'}";
+
 $text_of_cart .= "STATE:         $form_data{'card-state'}\n";
+$orderLoggingHash{'orderFromState'} = "$form_data{'card-state'}";
+
 $text_of_cart .= "ZIP:           $form_data{'card-zip'}\n";
+$orderLoggingHash{'orderFromPostal'} = "$form_data{'card-zip'}";
+
 $text_of_cart .= "COUNTRY:       $form_data{'card-country'}\n";
+$orderLoggingHash{'orderFromCountry'} = "$form_data{'card-country'}";
+
 $text_of_cart .= "PHONE:         $form_data{'phone'}\n";
+$orderLoggingHash{'customerPhone'} = "$form_data{'phone'}";
+
 $text_of_cart .= "FAX:           $form_data{'fax'}\n";
+$orderLoggingHash{'faxNumber'} = "$form_data{'fax'}";
+
 $text_of_cart .= "EMAIL:         $form_data{'email'}\n\n";
+$orderLoggingHash{'emailAddress'} = "$form_data{'email'}";
+
 $text_of_cart .= "SHIPPING INFORMATION --------------\n\n";
+
 $text_of_cart .= "SHIP VIA:      $form_data{'Ecom_ShipTo_Method'}\n";
+
 $text_of_cart .= "NAME:          $form_data{'shipname'}\n";
+$orderLoggingHash{'shipToName'} = "$form_data{'shipname'}";
+
 $text_of_cart .= "COMPANY:       $form_data{'company'}\n";
+
 $text_of_cart .= "ADDRESS:       $form_data{'address1'}\n";
+$orderLoggingHash{'shipToAddress'} = "$form_data{'address1'}";
+
+$text_of_cart .= "ADDRESS Line 2:       $form_data{'address2'}\n";
+$orderLoggingHash{'shipToAddress2'} = "$form_data{'address2'}";
+
 $text_of_cart .= "CITY:          $form_data{'city'}\n";
-$text_of_cart .= "STATE:         $form_data{'state'}\n";
-$text_of_cart .= "ZIP:           $form_data{'zip'}\n";
-$text_of_cart .= "COUNTRY:       $form_data{'country'}\n\n";
+$orderLoggingHash{'shipToCity'} = "$form_data{'city'}";
+
+if ($eform_Ecom_ShipTo_Postal_StateProv ne "") {
+  $text_of_cart .= "STATE:         $eform_Ecom_ShipTo_Postal_StateProv\n";
+  $orderLoggingHash{'shipToState'} = "$eform_Ecom_ShipTo_Postal_StateProv";
+} else {
+  $text_of_cart .= "STATE:         $form_data{'state'}\n";
+  $orderLoggingHash{'shipToState'} = "$form_data{'state'}";
+}
+
+if ($sc_verify_shipping_zip ne "") {
+   $text_of_cart .= "ZIP:           $sc_verify_shipping_zip\n";
+  $orderLoggingHash{'shipToPostal'} = "$sc_verify_shipping_zip";
+} else {
+  $text_of_cart .= "ZIP:           $form_data{'zip'}\n";
+  $orderLoggingHash{'shipToPostal'} = "$form_data{'zip'}";
+}
+
+if ($vform_Ecom_ShipTo_Postal_CountryCode ne "") {
+  $text_of_cart .= "COUNTRY:       $vform_Ecom_ShipTo_Postal_CountryCode\n\n";
+  $orderLoggingHash{'shipToCountry'} = "$vform_Ecom_ShipTo_Postal_CountryCode";
+} else {
+  $text_of_cart .= "COUNTRY:       $form_data{'country'}\n\n";
+  $orderLoggingHash{'shipToCountry'} = "$form_data{'country'}";
+}
 
 if ($ship_instructions ne "") {
   $text_of_cart .= "Shipping Instructions: \n";
   $text_of_cart .= "$ship_instructions\n\n";
 }
 
-$text_of_cart .= $XCOMMENTS_ADMIN;
+$text_of_cart .= $XCOMMENTS;
+$orderLoggingHash{'xcomments'} = "$XCOMMENTS";
+$orderLoggingHash{'xcomments'} =~ s/\n/<br>/g;
+$orderLoggingHash{'adminMessages'} =~ s/\t/ /g;
+$text_of_admin_email .= $XCOMMENTS_ADMIN;
+$orderLoggingHash{'adminMessages'} .= "$XCOMMENTS_ADMIN";
+$orderLoggingHash{'adminMessages'} =~ s/\n/<br>/g;
+$orderLoggingHash{'adminMessages'} =~ s/\t/ /g;
 $text_of_confirm_email .= $XCOMMENTS;
 
+$orderLoggingHash{'adminMessages'} .= "<br>AUTHORIZATION INFORMATION --------------<br>";
+$orderLoggingHash{'adminMessages'} .= "METHOD: $form_data{'paymethod'}<br>";
+$orderLoggingHash{'adminMessages'} .= "TYPE: $form_data{'card_type'}<br>";
+$orderLoggingHash{'adminMessages'} .= "RESP CODE: $form_data{'success'}<br>";
+$orderLoggingHash{'adminMessages'} .= "AUTH CODE: $form_data{'auth-code'}<br>";
+$orderLoggingHash{'adminMessages'} .= "TRANS ID: $form_data{'orderID'}<br>";
+$orderLoggingHash{'adminMessages'} .= "--------------------------------------------<br>";
+
 # 'Init' the emails ...
 $text_of_cart = &init_shop_keep_email . $text_of_cart;
 $text_of_confirm_email = &init_customer_email . $text_of_confirm_email;
@@ -685,23 +902,29 @@
 $text_of_admin_email .= &addto_shop_keep_email;
 $text_of_confirm_email .= &addto_customer_email;
 
-if ($sc_use_pgp =~ /yes/i) {
-  &require_supporting_libraries(__FILE__, __LINE__, "$sc_pgp_lib_path");
-  $text_of_cart = &make_pgp_file($text_of_cart, "$sc_pgp_temp_file_path/$$.pgp");
-  $text_of_cart = "\n" . $text_of_cart . "\n";
-}
+#if ($sc_use_pgp =~ /yes/i) {
+#  &require_supporting_libraries(__FILE__, __LINE__, "$sc_pgp_lib_path");
+#  $text_of_cart = &make_pgp_file($text_of_cart, "$sc_pgp_temp_file_path/$$.pgp");
+#  $text_of_cart = "\n" . $text_of_cart . "\n";
+#}
 
 if ($sc_send_order_to_email =~ /yes/i) {
-  &send_mail($sc_admin_email, $sc_order_email, "Agora.cgi Order",$text_of_cart);
+  &send_mail($sc_admin_email, $sc_order_email, "$sc_plugnpay_order_desc - $eform_cart_id", $text_of_cart);
 }
 
-&log_order($text_of_cart,$form_data{'order-id'},$form_data{'cart_id'});
+&log_order($text_of_cart,$form_data{'order-id'},$form_data{'customer_number'});
 
 if (($cartData) && ($form_data{'email'} ne "")) {
-  &send_mail($sc_admin_email, $form_data{'email'}, $messages{'ordcnf_08'}, "$text_of_confirm_email");
+  &send_mail($sc_admin_email, $form_data{'email'}, "$messages{'ordcnf_08'} - $eform_cart_id", "$text_of_confirm_email");
 }
 $sc_affiliate_order_unique = $form_data{'order-id'};
-$sc_affiliate_order_total = $form_data{'card-amount'};
+$sc_affiliate_order_total = ($sc_verify_subtotal - $sc_verify_discount);
+
+$sc_affiliate_image_call =~ s/AMOUNT/$sc_affiliate_order_total/g;
+$sc_affiliate_image_call =~ s/UNIQUE/$sc_affiliate_order_unique/g;
+
+# NEW CODEHOOK
+&codehook("process-order-display-thankyou-page");
   
 print <<ENDOFTEXT;
 <CENTER>
diff -ruN 4.0K-4b/library/USAepay-mgr_lib.pl 5.0.000/library/USAepay-mgr_lib.pl
--- 4.0K-4b/library/USAepay-mgr_lib.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/library/USAepay-mgr_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,347 @@
+#
+# For the Credit Card Processing Gateway USAepay
+#
+# For more signup for USAepay or to become an USAepay authorized reseller
+# Please visit USAepay.com for more details.
+#
+# Copyright May 7, 2005 to Present K-Factor Technologies, Inc.  & AgoraScript
+# All Rights Reserved.
+
+$versions{'USAepay-mgr_lib.pl'} = "5.0.000";
+&add_codehook("gateway_admin_screen","USAepay_mgr_check");
+&add_codehook("gateway_admin_settings","USAepay_settings");
+$mc_gateways .= "|USAepay";
+##############################################################################
+sub USAepay_settings {
+ local ($email_text);
+ $email_text = &my_escape($in{'email_text'});
+ if ($sc_gateway_name eq "USAepay") {
+   open (GW,"> $gateway_settings") || &my_die("Can't Open $gateway_settings");
+   print (GW "\$sc_gateway_userkey = \"$in{'sc_gateway_userkey'}\";\n");
+   print (GW "\$sc_order_script_url = \"$in{'order_url'}\";\n");
+   print (GW "\$merchant_live_mode = \"$in{'live_mode'}\";\n");
+   print (GW "\$sc_USAepay_submit = '$in{'sc_USAepay_submit'}';\n");
+   print (GW "\$sc_USAepay_change = '$in{'sc_USAepay_change'}';\n");
+   print (GW "\$sc_USAepay_verify_message = \"" . 
+         &my_escape($in{'sc_USAepay_verify_message'}) . "\";\n");
+   print (GW "\$sc_USAepay_order_desc = \"" . 
+         &my_escape($in{'sc_USAepay_order_desc'}) . "\";\n");
+   print (GW "\$sc_display_checkout_tos = \"$in{'sc_display_checkout_tos'}\";\n");
+   $sc_tos_display_address_temp = &my_escape($in{'sc_tos_display_address'});
+   print (GW "\$sc_tos_display_address = qq'$sc_tos_display_address_temp';\n");
+   print (GW "\$sc_USAepay_top_message = \"" . 
+         &my_escape($in{'sc_USAepay_top_message'}) . "\";\n");
+   print (GW "\$USAepay_order_ok_final_msg_tbl = \"" . 
+         &my_escape($in{'USAepay_order_ok_final_msg_tbl'}) . "\";\n");
+
+   print (GW "\$messages{'USAepay_declined'} = qq~" . 
+         &my_escape($in{'USAepay_declined'}) . "~;\n");
+   print (GW "\$messages{'USAepay_errror'} = qq~" . 
+         &my_escape($in{'USAepay_errror'}) . "~;\n");
+
+   print (GW "\$acceptvisa = \"$in{'acceptvisa'}\";\n");
+   print (GW "\$acceptmastercard = \"$in{'acceptmastercard'}\";\n");
+   print (GW "\$acceptdiscover = \"$in{'acceptdiscover'}\";\n");
+   print (GW "\$acceptamex = \"$in{'acceptamex'}\";\n");
+   print (GW "1\;\n");
+   close(GW);
+  }
+ }
+##############################################################################
+sub USAepay_mgr_check {
+if ($sc_gateway_name eq "USAepay") {
+  &print_USAepay_mgr_form;
+  &call_exit;
+ }
+}
+##############################################################################
+sub print_USAepay_mgr_form {
+  
+##
+## USAepay
+##
+
+if ($sc_display_checkout_tos eq '') { # default it in
+  $sc_display_checkout_tos = "yes";
+ }
+
+print &$manager_page_header("USAepay Gateway","","","","");
+
+print <<ENDOFTEXT;
+<CENTER>
+<TABLE width=96%>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN="2">
+<FONT FACE=ARIAL>
+<b>USA ePay Settings</b><br>$msg<br><br>
+<br>
+Find out more about ths gateway at: <a href="http://www.USAepay.com/">
+http://www.USAepay.com</a><br><br>
+</FONT>
+
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+
+ENDOFTEXT
+
+if($in{'system_edit_success'} ne "")
+{
+print <<ENDOFTEXT;
+<CENTER>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL SIZE=2 COLOR=RED>Gateway settings 
+have been successfully updated</FONT>
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+ENDOFTEXT
+}
+
+print <<ENDOFTEXT;
+
+<FONT FACE=ARIAL SIZE=2>
+<FORM METHOD="POST" ACTION="manager.cgi">
+<CENTER>
+<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0 width=96%>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD>Are you ready to go live?  (Answer "no" to run in test mode.)</TD>
+<TD>
+<SELECT NAME="live_mode">
+<OPTION>$merchant_live_mode</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT>
+</TD>
+</TR>
+
+</CENTER>
+</TABLE>
+
+<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0 width=96%>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD WIDTH="200">
+USA ePay Gateway Key
+</TD>
+<TD WIDTH="350">
+<INPUT NAME="sc_gateway_userkey" TYPE="TEXT" SIZE=30 
+VALUE='$sc_gateway_userkey'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+Secure URL to your Gateway's server
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+<INPUT NAME="order_url" TYPE="TEXT" SIZE=60
+VALUE="$sc_order_script_url"><br>
+</TD>
+</TR>
+
+</TABLE><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><table>
+	<tr>
+		<td><font size=2 face =arial>Accept Visa?<br><SELECT NAME="acceptvisa">
+<OPTION>$acceptvisa</OPTION>
+<OPTION VALUE="yes">yes</OPTION>
+</SELECT></font></td>
+		<td><font size=2 face =arial>Accept MasterCard?<br><SELECT NAME="acceptmastercard">
+<OPTION>$acceptmastercard</OPTION>
+<OPTION VALUE="yes">yes</OPTION>
+</SELECT></font></td>
+		<td><font size=2 face =arial>Accept AMEX?<br><SELECT NAME="acceptamex">
+<OPTION>$acceptamex</OPTION>
+<OPTION VALUE="yes">yes</OPTION>
+<OPTION VALUE="no">no</OPTION>
+</SELECT></font></td>
+		<td><font size=2 face =arial>Accept Discover?<br><SELECT NAME="acceptdiscover">
+<OPTION>$acceptdiscover</OPTION>
+<OPTION VALUE="yes">yes</OPTION>
+<OPTION VALUE="no">no</OPTION>
+</SELECT></font></td>
+	</tr>
+</table></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+URL of 'Submit to USAepay' button:
+<br>
+<INPUT NAME="sc_USAepay_submit" TYPE="TEXT" SIZE=60 
+VALUE='$sc_USAepay_submit'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+URL of 'Make Changes' button:
+<br>
+<INPUT NAME="sc_USAepay_change" TYPE="TEXT" SIZE=60 
+VALUE='$sc_USAepay_change'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+Order Description:
+<br>
+<INPUT NAME="sc_USAepay_order_desc" TYPE="TEXT" SIZE=60 
+VALUE='$sc_USAepay_order_desc'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+Message at the top of the Verify Order table:
+<br>
+<TEXTAREA NAME="sc_USAepay_verify_message"
+ROWS=4 COLS=65 wrap=soft>$sc_USAepay_verify_message</TEXTAREA>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><br><HR><br></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><TABLE WIDTH="100%"><TR>
+<TD>Display Terms of Service and Refund Policy checkbox and set as required?</TD>
+<TD>
+<SELECT NAME="sc_display_checkout_tos">
+<OPTION>$sc_display_checkout_tos</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT>
+</TD>
+</TR></TABLE></TD>
+</TR>
+<TR><TD COLSPAN=2><br>
+Business address and phone number (contact information) for your business.  Should be legal address for the business location for full disclosure and other privacy requirements mandated by credit card companies as well as government enitities that require such notices:<br>
+<TEXTAREA NAME="sc_tos_display_address" 
+cols="68" rows=5 
+wrap=off>$sc_tos_display_address</TEXTAREA><br>
+
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR><TD COLSPAN=2>
+Top message for Order form.  Allows you to place a message above the Payment Information area and just below the cart total boxes.  HTML formatting (for text color, font, spacing, etc) is accepted.  Leave blank if not needed:<br>
+<TEXTAREA NAME="sc_USAepay_top_message" 
+cols="68" rows=8 
+wrap=off>$sc_USAepay_top_message</TEXTAREA> <br><br>
+</TD>
+</TR>
+
+<TR><TD COLSPAN=2>
+Top message for confirmation page, the page just before going to the gateway.  This allows you to place a message above the Payment Information area and just below the cart total boxes.  HTML formatting (for text color, font, spacing, etc) is accepted.  Leave blank if not needed:<br>
+<TEXTAREA NAME="USAepay_order_ok_final_msg_tbl" 
+cols="68" rows=8 
+wrap=off>$USAepay_order_ok_final_msg_tbl</TEXTAREA> <br><br>
+</TD>
+</TR>
+
+<TR><TD COLSPAN=2><br>
+Message displayed on return to cart for declined payments (This is a message displayed as a replacement to the thank you message):<br>
+<TEXTAREA NAME="USAepay_declined" 
+cols="68" rows=6 
+wrap=off>$messages{'USAepay_declined'}</TEXTAREA> <br><br>
+</TD>
+</TR>
+
+<TR><TD COLSPAN=2><br>
+Message displayed on return to cart for misc errors in payments (This is a message displayed as a replacement to the thank you message):<br>
+<TEXTAREA NAME="USAepay_errror" 
+cols="68" rows=6 
+wrap=off>$messages{'USAepay_errror'}</TEXTAREA> <br><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><br><br>
+<CENTER>
+<INPUT TYPE="HIDDEN" NAME="system_edit_success" VALUE="yes">
+<INPUT TYPE="HIDDEN" NAME="gateway" VALUE="USAepay">
+<INPUT NAME="GatewaySettings" TYPE="SUBMIT" VALUE="Submit">
+&nbsp;&nbsp;
+<INPUT TYPE="RESET" VALUE="Reset">
+</CENTER>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+<HR>
+</TD>
+</TR>
+
+</TABLE>
+
+</CENTER>
+</FORM>
+ENDOFTEXT
+print &$manager_page_footer;
+
+}
+##############################################################################
+1; #Library
diff -ruN 4.0K-4b/library/USAepay-order_lib.pl 5.0.000/library/USAepay-order_lib.pl
--- 4.0K-4b/library/USAepay-order_lib.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/library/USAepay-order_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,831 @@
+#######################################################################
+#                    Order Form Definition Variables                  #
+#######################################################################
+
+$versions{'USAepay-order_lib.pl'} = "5.0.000";
+$sc_use_secure_header_at_checkout = 'yes';
+$sc_use_secure_footer_for_order_form = 'yes';
+
+$sc_order_response_vars{"USAepay"}="USAepay";
+$sc_use_secure_header_at_checkout = 'yes';
+&add_codehook("open_for_business","USAepay_bill2ship_field_defaults");
+&add_codehook("printSubmitPage","print_USAepay_SubmitPage");
+&add_codehook("set_form_required_fields","USAepay_fields");
+&add_codehook("gateway_response","check_for_USAepay_response");
+###############################################################################
+sub USAepay_check_and_load {
+local($myname)="USAepay";
+if ($myname ne $sc_gateway_name) { # we are a secondary gateway, load settings
+  &require_supporting_libraries(__FILE__,__LINE__,
+     "./admin_files/$myname-user_lib.pl");
+ }
+
+}
+###############################################################################
+sub check_for_USAepay_response {
+  if (($form_data{'UMstatus'} eq 'Approved')||($form_data{'UMstatus'} eq 'Declined')||($form_data{'UMstatus'} eq 'Error')) {
+    $cart_id = $form_data{'cart_id'};
+    &set_sc_cart_path;
+    &load_order_lib;
+    &codehook("USAepay_order");
+    &process_USAepay_Order;
+    &call_exit;
+   }
+ }
+###############################################################################
+sub USAepay_bill2ship_field_defaults {
+# We default the Shipto info to Billto if left blank
+if ($form_data{'Ecom_ShipTo_Postal_PostalCode'} eq "") {
+  if ($form_data{'Ecom_BillTo_PostalCode'} ne "") {
+  $form_data{'Ecom_ShipTo_Postal_PostalCode'} = 
+       $form_data{'Ecom_BillTo_PostalCode'};
+   }
+ }
+
+if ($form_data{'Ecom_ShipTo_Postal_Name_Last'} eq "") {
+  if ($form_data{'Ecom_BillTo_Postal_Name_Last'} ne "") {
+  $form_data{'Ecom_ShipTo_Postal_Name_Last'} = 
+       $form_data{'Ecom_BillTo_Postal_Name_Last'};
+   }
+ }
+
+if ($form_data{'Ecom_ShipTo_Postal_Name_First'} eq "") {
+  if ($form_data{'Ecom_BillTo_Postal_Name_First'} ne "") {
+  $form_data{'Ecom_ShipTo_Postal_Name_First'} = 
+       $form_data{'Ecom_BillTo_Postal_Name_First'};
+   }
+ }
+
+if ($form_data{'Ecom_ShipTo_Postal_Street_Line1'} eq "") {
+  if ($form_data{'Ecom_BillTo_Postal_Street_Line1'} ne "") {
+    $form_data{'Ecom_ShipTo_Postal_Street_Line1'} = 
+       $form_data{'Ecom_BillTo_Postal_Street_Line1'};
+    $form_data{'Ecom_ShipTo_Postal_Street_Line2'} = 
+       $form_data{'Ecom_BillTo_Postal_Street_Line2'};
+    $form_data{'Ecom_ShipTo_Postal_Street_Line3'} = 
+       $form_data{'Ecom_BillTo_Postal_Street_Line3'};
+   }
+ }
+
+if ($form_data{'Ecom_ShipTo_Postal_City'} eq "") {
+  if ($form_data{'Ecom_BillTo_Postal_City'} ne "") {
+  $form_data{'Ecom_ShipTo_Postal_City'} = 
+       $form_data{'Ecom_BillTo_Postal_City'};
+   }
+ }
+
+if ($form_data{'Ecom_ShipTo_Postal_StateProv'} eq "") {
+  if ($form_data{'Ecom_BillTo_Postal_StateProv'} ne "") {
+  $form_data{'Ecom_ShipTo_Postal_StateProv'} = 
+       $form_data{'Ecom_BillTo_Postal_StateProv'};
+   }
+ }
+
+if ($form_data{'Ecom_ShipTo_Postal_CountryCode'} eq "") {
+  if ($form_data{'Ecom_BillTo_Postal_CountryCode'} ne "") {
+  $form_data{'Ecom_ShipTo_Postal_CountryCode'} = 
+       $form_data{'Ecom_BillTo_Postal_CountryCode'};
+   }
+ }
+}
+###############################################################################
+sub USAepay_fields {
+local($myname)="USAepay";
+
+if (!($form_data{'gateway'} eq $myname)) { return;} 
+
+%sc_order_form_array =(
+	'Ecom_BillTo_Postal_Name_First', 'First Name',
+  'Ecom_BillTo_Postal_Name_Last', 'Last Name',
+  'Ecom_BillTo_Postal_Street_Line1', 'Billing Address Street',
+  'Ecom_BillTo_Postal_City', 'Billing Address City',
+  'Ecom_BillTo_Postal_StateProv', 'Billing Address State',
+  'Ecom_BillTo_PostalCode', 'Billing Address Zip',
+  'Ecom_BillTo_Postal_CountryCode', 'Billing Address Country',
+  'Ecom_ShipTo_Postal_Street_Line1', 'Shipping Address Street',
+  'Ecom_ShipTo_Postal_City', 'Shipping Address City',
+  'Ecom_ShipTo_Postal_StateProv', 'Shipping Address State',
+  'Ecom_ShipTo_Postal_PostalCode', 'Shipping Address Zip',
+  'Ecom_ShipTo_Postal_CountryCode', 'Shipping Address Country',
+  'Ecom_BillTo_Telecom_Phone_Number', 'Phone Number',
+  'Ecom_BillTo_Online_Email', 'Email',
+  'Ecom_is_Residential', 'Shipping to Residential Address',
+  'Ecom_ShipTo_Insurance', 'Insure this Shipment', # not implemented yet, for the future
+  'Ecom_tos', 'Sales-Terms of Service',
+  'Ecom_Payment_Card_Type', 'Type of Card',
+  'Ecom_Payment2_Card_Number', 'Card Number',
+  'Ecom_Payment_Card_ExpDate_Month', 'Card Expiration Month',
+  'Ecom_Payment_Card_ExpDate_Year', 'Card Expiration Year');
+
+                     
+
+@sc_order_form_required_fields = ("Ecom_BillTo_Postal_Name_First",
+          "Ecom_BillTo_Postal_Name_Last",
+          "Ecom_BillTo_Postal_Street_Line1",
+          "Ecom_BillTo_Postal_City",
+          "Ecom_BillTo_Postal_StateProv",
+          "Ecom_BillTo_PostalCode",
+          "Ecom_BillTo_Postal_CountryCode", 
+          "Ecom_BillTo_Telecom_Phone_Number",
+          "Ecom_BillTo_Online_Email",
+          "Ecom_Payment_Card_Type",
+          "Ecom_Payment2_Card_Number",
+          "Ecom_Payment_Card_ExpDate_Month",
+          "Ecom_Payment_Card_ExpDate_Year");
+
+# lines for tos added April 5 2006 by Mister Ed
+ if ($sc_display_checkout_tos =~ /yes/i) {
+    push(@sc_order_form_required_fields,"Ecom_tos");
+ }
+
+}
+
+###############################################################################
+sub USAepay_order_form_prep { # load the customer info ...
+  &USAepay_check_and_load;
+  if ($sc_USAepay_form_prep == 0) {
+    if (-f "$sc_verify_order_path"){
+      &read_verify_file;  
+     } else {
+      &codehook("load_customer_info");
+     }
+    $sc_USAepay_form_prep = 1;
+   }
+  return "";
+ }
+###############################################################################
+sub USAepay_table_setup {
+#
+# To use this, put this in the email_text in the manager for HTML:
+#
+#	<!--agorascript-pre
+#	  return $USAepay_cart_table;
+#	-->
+#
+# or for text in an email:
+#
+#	<!--agorascript-pre
+#	  return $USAepay_prod_in_cart;
+#	-->
+# 
+
+local (@my_cart_fields,$my_cart_row_number,$result);
+local ($count,$price,$product_id,$quantity,$total_cost,$total_qty)=0;
+local ($name,$cost);
+
+ $USAepay_prod_in_cart = '';
+ $USAepay_cart_table = '';
+ $result='';
+ open (CART, "$sc_cart_path") || &file_open_error("$sc_cart_path", 
+            "display_cart_contents_in_header", __FILE__, __LINE__);
+ while (<CART>)
+  {
+   $count++;
+   chop;    
+   @my_cart_fields = split (/\|/, $_);
+   $my_cart_row_number = pop(@my_cart_fields);
+   push (@my_cart_fields, $my_cart_row_number);
+   $quantity = $my_cart_fields[0];
+   $product_id = $my_cart_fields[1];
+   $price = $my_cart_fields[$sc_cart_index_of_price_after_options]; 
+   $name = $my_cart_fields[$cart{"name"}];
+   $name = substr($name,0,35);
+   $cost = &format_price($quantity * $price);
+   $total_cost = $total_cost + $quantity * $price;
+   $total_qty = $total_qty + $quantity;
+   $options = $my_cart_fields[$cart{"options"}];
+   $options =~ s/<br>/ /g;
+   if ($result eq '') {
+     $result .= '<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=425>';
+     $result .= "<TR><TD>Items Ordered:</TD></TR><TR><TD>\n";
+     $result .= "<TABLE CELLPADDING=3 CELLSPACING=0 BORDER=1 WIDTH='100%'>\n";
+     $result .= "<TR><TH>QTY</TH><TH>ID #</TH><TH>Description</TH>";
+     $result .= "<TH>Cost</TH></TR>\n";
+     $USAepay_prod_in_cart .= "  --PRODUCT INFORMATION--\n\n";
+    }
+   $result .= "<TR><TD>$quantity</TD><TD>$product_id</TD>\n";
+   $result .= "<TD>$name</TD><TD>$cost</TD>";
+   $result .= "</TR>\n";
+   $USAepay_prod_in_cart .= &cart_textinfo(*my_cart_fields);
+  } # End of while (<CART>)
+ close (CART);
+ if ($result ne '') {
+   $result .= "</TABLE></TD></TR></TABLE>\n";
+  }
+ $USAepay_cart_table = $result;
+}
+
+###############################################################################
+
+sub print_USAepay_SubmitPage
+
+{
+local($invoice_number, $customer_number, $displayTotal);
+local($test_mode);
+local($myname)="USAepay";
+local($my_change,$my_submit,$my_message,$my_desc);
+
+if (!($form_data{'gateway'} eq $myname)) { return;} 
+if ($myname ne $sc_gateway_name) { # secondary gateway, load settings
+  &require_supporting_libraries(__FILE__,__LINE__,
+     "./admin_files/$myname-user_lib.pl");
+ }
+
+$displayTotal = &display_price($authPrice);
+
+$customer_number = $cart_id;
+$customer_number =~ s/_/./g;
+$my_submit=&script_and_substitute($sc_USAepay_submit);
+$my_change=&script_and_substitute($sc_USAepay_change);
+$my_message=&script_and_substitute($sc_USAepay_verify_message);
+$my_desc=&script_and_substitute($sc_USAepay_order_desc);
+&USAepay_table_setup;
+
+if ($merchant_live_mode =~ /yes/i){
+  $test_mode = "";
+ } else {
+  $test_mode = qq~<input type="hidden" name="UMtestmode" value="1">~;
+  $form_data{'Ecom_Payment2_Card_Number'} = "4787292258606353";
+  $form_data{'Ecom_Payment_Card_Type'} = "Visa";
+  $form_data{'Ecom_Payment_Card_ExpDate_Month'} = "09";
+  $form_data{'Ecom_Payment_Card_ExpDate_Year'} = "09";
+ }
+
+my $fullname = "$form_data{'Ecom_BillTo_Postal_Name_Last'}" . " $form_data{'Ecom_BillTo_Postal_Name_Last'}";
+my $expiredate = "$form_data{'Ecom_Payment_Card_ExpDate_Month'}" . " $form_data{'Ecom_Payment_Card_ExpDate_Year'}";
+
+print <<ENDOFTEXT;
+
+<FORM METHOD=POST ACTION=\"$sc_order_script_url\">
+
+<form action="https://www.usaepay.com/gate.php" method="POST">
+<input type="hidden" name="UMcommand" value="sale">
+<input type="hidden" name="UMkey" value="$sc_gateway_userkey">
+<input type="hidden" name="UMredir" value="$sc_ssl_location_url2">
+<INPUT TYPE="hidden" name="USAepay" VALUE="USAepay">
+<INPUT TYPE="hidden" name="cart_id" VALUE="$customer_number">
+<input type="hidden" name="UMcustid" value="$customer_number">
+<input type="hidden" name="UMamount" value="$authPrice">
+<input type="hidden" name="UMechofields" value="1">
+$test_mode
+<input type="hidden" name="UMstreet" value="$form_data{'Ecom_BillTo_Postal_Street_Line1'}">
+<input type="hidden" name="city" value="$form_data{'Ecom_BillTo_Postal_City'}">
+<input type="hidden" name="state" value="$form_data{'Ecom_BillTo_Postal_StateProv'}">
+<input type="hidden" name="UMzip" value="$form_data{'Ecom_BillTo_Postal_PostalCode'}">
+<input type="hidden" name="UMbillcountry" value="$form_data{'Ecom_BillTo_Postal_CountryCode'}">
+<input type="hidden" name="UMcustemail" value="$form_data{'Ecom_BillTo_Online_Email'}">
+<input type="hidden" name="UMbillphone" value="$form_data{'BillTo_Telecom_Phone_Number'}">
+<input type="hidden" name="cardtype" value="$form_data{'Ecom_Payment_Card_Type'}">
+<input type="hidden" name="UMcard" value="$form_data{'Ecom_Payment2_Card_Number'}">
+<input type="hidden" name="UMexpir" value="$expiredate">
+<input type="hidden" name="UMname" value="$fullname">
+
+ENDOFTEXT
+
+print <<ENDOFTEXT;
+
+<div align="center">
+
+<p class="ac_checkout_top_msg">$USAepay_order_ok_final_msg_tbl</p>
+  <p class="ac_checkout_top_msg">$my_message</p>
+
+
+<table cellpadding="0" cellspacing="0" class="ac_checkout_review">
+<tr>
+<th colspan="2" class="ac_checkout_review">Customer Information</th>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Customer Number</td>
+<td class="ac_checkout_review_col2">$customer_number</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Order Number</td>
+<td class="ac_checkout_review_col2">$sc_verify_inv_no</td>
+</tr>
+
+<!-- begin add tos -->
+<tr>
+<td class="ac_checkout_review_col1">Sales Terms and Refund Policy</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_tos'}</td>
+</tr>
+<!-- end add tos -->
+
+<tr>
+<th colspan="2" class="ac_checkout_review">Billing Address</th>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Name</td>
+<td class="ac_checkout_review_col2">
+  $form_data{'Ecom_BillTo_Postal_Name_First'} $form_data{'Ecom_BillTo_Postal_Name_Last'}
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Street</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_BillTo_Postal_Street_Line1'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">City</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_BillTo_Postal_City'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">State</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_BillTo_Postal_StateProv'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Zip</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_BillTo_PostalCode'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Country</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_BillTo_Postal_CountryCode'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Phone</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_BillTo_Telecom_Phone_Number'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">E-Mail</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_BillTo_Online_Email'}&nbsp;</td>
+</tr>
+
+<!--Shipping Address-->
+
+<tr>
+<th colspan="2" class="ac_checkout_review">Shipping Information</th>
+</tr>
+
+ENDOFTEXT
+
+if ($form_data{'Ecom_ShipTo_Method'} ne ""){
+print <<ENDOFTEXT;
+<tr>
+<td class="ac_checkout_review_col1">Ship via</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Method'}&nbsp;</td>
+</tr>
+ENDOFTEXT
+}
+
+print <<ENDOFTEXT;
+<tr>
+<td class="ac_checkout_review_col1">Name</td>
+<td class="ac_checkout_review_col2">
+  $form_data{'Ecom_ShipTo_Postal_Name_First'} $form_data{'Ecom_ShipTo_Postal_Name_Last'}&nbsp;
+</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Street</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_Street_Line1'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">City</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_City'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">State</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_StateProv'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Zip</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_PostalCode'}&nbsp;</td>
+</tr>
+
+<tr>
+<td class="ac_checkout_review_col1">Country</td>
+<td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_CountryCode'}&nbsp;</td>
+</tr>
+<!--<tr>
+<th colspan="2" class="ac_checkout_review">Misc Information </th>
+</tr>
+<tr>
+<td class="ac_checkout_review_col1" colspan="2">$XCOMMENTS</td>
+</tr>-->
+</TABLE>
+ 
+<TABLE WIDTH="500" BGCOLOR="#FFFFFF" CELLPADDING="2" CELLSPACING="0" BORDER=0>
+<TR>
+<TD COLSPAN=2>
+<CENTER>
+<INPUT TYPE="IMAGE" NAME="Submit" VALUE="Submit Order For Processing"
+SRC="$my_submit" border=0>
+&nbsp;&nbsp;&nbsp;&nbsp;
+<a href="agora.cgi?order_form_button.x=1&cart_id=${cart_id}">
+<IMG SRC="$my_change" BORDER=0></a>
+</FORM>
+</CENTER>
+</TD>
+</TR>
+</table>
+</FONT>
+</CENTER>
+ENDOFTEXT
+
+}
+############################################################################################
+sub process_USAepay_Order {
+local($subtotal, $total_quantity,
+      $total_measured_quantity,
+      $text_of_cart, $weight,
+      $required_fields_filled_in, $product, $quantity, $options);
+local($stevo_shipping_thing) = "";
+local($stevo_shipping_names) = "";
+local($ship_thing_too,$ship_instructions);
+local(%orderLoggingHash);
+
+#alt origination stuff added by Mister Ed Feb 17, 2005
+if ($sc_alt_origin_enabled =~ /yes/i) {
+	local(%zip_list);
+	local(%zip_names_list);
+}
+
+
+if (($form_data{'UMstatus'} eq 'Declined')||($form_data{'UMstatus'} eq 'Error')) {
+
+print qq!
+<html>
+$sc_special_page_meta_tags
+<HEAD>
+<title>$messages{'ordcnf_08'}</title>
+$sc_secure_standard_head_info</head>
+<body>
+!;
+
+&SecureStoreHeader;
+print <<ENDOFTEXT;
+<CENTER>
+<TABLE WIDTH=500>
+<TR>
+<TD WIDTH=500>
+<FONT FACE=ARIAL>
+ENDOFTEXT
+
+
+if ($form_data{'UMstatus'} eq 'Error') {
+print <<ENDOFTEXT;
+$messages{'USAepay_errror'}
+ENDOFTEXT
+# >
+} elsif ($form_data{'UMstatus'} eq 'Declined') {
+print <<ENDOFTEXT;
+$messages{'USAepay_declined'}
+ENDOFTEXT
+# >
+}
+
+print <<ENDOFTEXT;
+</FONT>
+</TD>
+</TR>
+</TABLE>
+<CENTER>
+
+ENDOFTEXT
+
+# and the footer is printed
+
+&SecureStoreFooter;
+
+print qq!
+</BODY>
+</HTML>
+!;
+
+&call_exit;
+}
+
+&load_verify_file;
+
+# NEW CODEHOOK
+&codehook("process-order-routine-top");
+
+$orderDate = &get_date;
+
+print qq!
+<html>
+$sc_special_page_meta_tags
+<HEAD>
+<title>$messages{'ordcnf_08'}</title>
+$sc_secure_standard_head_info</head>
+<body>
+!;
+
+&SecureStoreHeader;
+
+$text_of_cart .= "Order Date:    $orderDate\n";
+$text_of_cart .= "Gateway:       USAepay\n\n";
+$orderLoggingHash{'GatewayUsed'} = "USAepay";
+
+$text_of_cart .= "  --PRODUCT INFORMATION--\n\n";
+
+open (CART, "$sc_cart_path") ||
+&file_open_error("$sc_cart_path", "display_cart_contents", __FILE__, __LINE__);
+
+while (<CART>)
+{
+$cartData++;
+@cart_fields = split (/\|/, $_);
+$quantity = $cart_fields[0];
+$product_price = $cart_fields[3];
+$product = $cart_fields[4];
+$weight = $cart_fields[6];
+$options = $cart_fields[$cart{"options"}];
+$options =~ s/<br>/ /g;
+$text_of_cart .= &cart_textinfo(*cart_fields);
+$stevo_shipping_thing .="|$quantity\*$weight";
+$stevo_shipping_names .="|$product\($options\)";
+&codehook("process-cart-item");
+}
+close(CART);
+
+# initialize hash variables in case they are empty later
+# added by jfindlay 2006 February
+
+$orderLoggingHash{'firstName'} = "";
+$orderLoggingHash{'lastName'} = "";
+$orderLoggingHash{'fullName'} = "";
+$orderLoggingHash{'orderFromAddress'} = "";
+$orderLoggingHash{'customerAddress2'} = "";
+$orderLoggingHash{'customerAddress3'} = "";
+$orderLoggingHash{'orderFromCity'} = "";
+$orderLoggingHash{'orderFromPostal'} = "";
+$orderLoggingHash{'customerPhone'} = "";
+$orderLoggingHash{'companyName'} = "";
+$orderLoggingHash{'emailAddress'} = "";
+
+$orderLoggingHash{'shipToName'} = "";
+$orderLoggingHash{'shipToAddress'} = "";
+$orderLoggingHash{'shipToAddress2'} = "";
+$orderLoggingHash{'shipToAddress3'} = "";
+$orderLoggingHash{'shipToCity'} = "";
+$orderLoggingHash{'shipToState'} = "";
+$orderLoggingHash{'shipToPostal'} = "";
+$orderLoggingHash{'shipToCountry'} = "";
+$orderLoggingHash{'shiptoResidential'} = $eform_Ecom_is_Residential;
+$orderLoggingHash{'insureShipment'} = $eform_Ecom_ShipTo_Insurance; # not implemented yet, for the future
+
+$orderLoggingHash{'invoiceNumber'} = "";
+$orderLoggingHash{'customerNumber'} = "";
+$orderLoggingHash{'orderStatus'} = "$sc_order_status_default";
+$orderLoggingHash{'user1'} = "";
+$orderLoggingHash{'user2'} = "";
+$orderLoggingHash{'user3'} = "";
+$orderLoggingHash{'user4'} = "";
+$orderLoggingHash{'user5'} = "";
+$orderLoggingHash{'itemsordered'} = "";
+$orderLoggingHash{'shiptrackingID'} = "";
+$orderLoggingHash{'shipMethod'} = "";
+$orderLoggingHash{'orderFromState'} = "";
+$orderLoggingHash{'orderFromCountry'} = "";
+$orderLoggingHash{'shippingTotal'} = "";
+$orderLoggingHash{'salesTax'} = "";
+$orderLoggingHash{'tax1'} = "";
+$orderLoggingHash{'tax2'} = "";
+$orderLoggingHash{'tax3'} = "";
+$orderLoggingHash{'discounts'} = "";
+$orderLoggingHash{'netProfit'} = "";
+$orderLoggingHash{'affiliateTotal'} = "";
+$orderLoggingHash{'affiliateID'} = "";
+$orderLoggingHash{'affiliateMisc'} = "";
+$orderLoggingHash{'subTotal'} = "";
+$orderLoggingHash{'orderTotal'} = "";
+$orderLoggingHash{'adminMessages'} = "";
+$orderLoggingHash{'shippingMessages'} = "";
+$orderLoggingHash{'xcomments'} = "";
+$orderLoggingHash{'termsOfService'} = "$vform_Ecom_tos";
+
+$sc_orderlib_use_SBW_for_ship_ins = $sc_use_SBW;
+&codehook("orderlib-ship-instructions");
+if ($sc_orderlib_use_SBW_for_ship_ins =~ /yes/i) {
+  ($ship_thing_too,$ship_instructions) = 
+   &ship_put_in_boxes($stevo_shipping_thing,$stevo_shipping_names,
+   $sc_verify_Origin_ZIP,$sc_verify_boxes_max_wt); 
+ }
+$orderLoggingHash{'shippingMessages'} = "$ship_instructions";
+$orderLoggingHash{'shippingMessages'} =~ s/\n/<br>/g;
+
+$text_of_confirm_email .= $messages{'ordcnf_07'};
+
+$text_of_confirm_email .= "$text_of_cart\n";
+
+$text_of_cart .= "  --ORDER INFORMATION--\n\n";
+
+# $text_of_cart .= "VERIFICATION:  $verification\n";
+$text_of_cart .= "CUST ID:       $form_data{'cart_id'}\n";
+$text_of_confirm_email .= "CUST ID:       $form_data{'cart_id'}\n";
+$orderLoggingHash{'customerNumber'} = "$form_data{'cart_id'}";
+
+$text_of_cart .= "ORDER ID:      $sc_verify_inv_no\n";
+$text_of_confirm_email .= "ORDER ID:      $sc_verify_inv_no\n";
+$orderLoggingHash{'invoiceNumber'} = "$sc_verify_inv_no";
+
+if ($sc_verify_shipping)
+{
+$text_of_cart .= "SHIPPING:      " . &format_price($sc_verify_shipping) . "\n";
+$text_of_confirm_email .= "SHIPPING:      " . &format_price($sc_verify_shipping) . "\n";
+$orderLoggingHash{'shippingTotal'} = &format_price($sc_verify_shipping);
+}
+
+if (($sc_use_SBW =~ /yes/i) || ($sc_verify_shipping > .009)) {
+ $text_of_confirm_email .= "SHIP VIA:      $eform_Ecom_ShipTo_Method\n";
+}
+
+ $orderLoggingHash{'shipMethod'} = $eform_Ecom_ShipTo_Method;
+
+  $temp = &format_price($sc_verify_subtotal);
+  &add_text_of_both("SUBTOTAL",$temp);
+  $orderLoggingHash{'subTotal'} = &format_price($sc_verify_subtotal);
+
+if ($sc_verify_discount) {
+  $temp = &format_price($sc_verify_discount);
+  &add_text_of_both("DISCOUNT",$temp);
+  $orderLoggingHash{'discounts'} = &format_price($sc_verify_discount);
+  # start of adjustments for discount addon
+  $text_of_cart .= "DISCOUNT CODE: $eform_Ecom_Discount\n";
+  $text_of_confirm_email .= "DISCOUNT CODE: $eform_Ecom_Discount\n";
+  # end of adjustments for discount addon
+}
+
+if ($sc_verify_tax > 0)
+{
+$temp = substr(substr("SALES TAX",0,13).":               ",0,15);
+$text_of_cart .= "$temp$sc_verify_tax\n";
+$text_of_confirm_email .= "$temp$sc_verify_tax\n";
+$orderLoggingHash{'salesTax'} = "$sc_verify_tax";
+}
+if ($sc_verify_etax1 > 0)
+{
+$temp = substr(substr($sc_extra_tax1_name,0,13).":               ",0,15);
+$text_of_cart .= "$temp$sc_verify_etax1\n";
+$text_of_confirm_email .= "$temp$sc_verify_etax1\n";
+$orderLoggingHash{'tax1'} = "$sc_verify_etax1";
+}
+if ($sc_verify_etax2 > 0)
+{
+$temp = substr(substr($sc_extra_tax2_name,0,13).":               ",0,15);
+$text_of_cart .= "$temp$sc_verify_etax2\n";
+$text_of_confirm_email .= "$temp$sc_verify_etax2\n";
+$orderLoggingHash{'tax2'} = "$sc_verify_etax2";
+}
+if ($sc_verify_etax3 > 0)
+{
+$temp = substr(substr($sc_extra_tax3_name,0,13).":               ",0,15);
+$text_of_cart .= "$temp$sc_verify_etax3\n";
+$text_of_confirm_email .= "$temp$sc_verify_etax3\n";
+$orderLoggingHash{'tax3'} = "$sc_verify_etax3";
+}
+
+$text_of_cart .= "TOTAL:         $sc_verify_grand_total\n\n";
+$text_of_confirm_email .= "TOTAL:         $sc_verify_grand_total\n\n";
+$orderLoggingHash{'orderTotal'} = "$sc_verify_grand_total";
+
+$text_of_cart .= "TRANSACTION STATUS      $form_data{'UMstatus'}\n";
+$text_of_cart .= "AUTH CODE      $form_data{'UMauthCode'}\n";
+$text_of_cart .= "TRANS ID:      $form_data{'UMrefNum'}\n\n";
+$text_of_cart .= "BILLING INFORMATION --------------\n\n";
+
+$text_of_cart .= "NAME:          $eform_Ecom_BillTo_Postal_Name_First $eform_Ecom_BillTo_Postal_Name_Last\n";
+$orderLoggingHash{'fullName'} = "$eform_ $eform_Ecom_BillTo_Postal_Name_Last";
+$orderLoggingHash{'firstName'} = "$eform_Ecom_BillTo_Postal_Name_First";
+$orderLoggingHash{'lastName'} = "$eform_Ecom_BillTo_Postal_Name_Last";
+
+$text_of_cart .= "ADDRESS:       $eform_Ecom_BillTo_Postal_Street_Line1\n";
+$orderLoggingHash{'orderFromAddress'} = "$eform_Ecom_BillTo_Postal_Street_Line1";
+
+$text_of_cart .= "CITY:          $eform_Ecom_BillTo_Postal_City\n";
+$orderLoggingHash{'orderFromCity'} = "$eform_Ecom_BillTo_Postal_City";
+
+$text_of_cart .= "STATE:         $eform_Ecom_BillTo_Postal_StateProv\n";
+$orderLoggingHash{'orderFromState'} = "$eform_Ecom_BillTo_Postal_StateProv";
+
+$text_of_cart .= "ZIP:           $eform_Ecom_BillTo_PostalCode\n";
+$orderLoggingHash{'orderFromPostal'} = "$eform_Ecom_BillTo_PostalCode";
+
+$text_of_cart .= "COUNTRY:       $eform_Ecom_BillTo_Postal_CountryCode\n";
+$orderLoggingHash{'orderFromCountry'} = "$eform_Ecom_BillTo_Postal_CountryCode";
+
+$text_of_cart .= "PHONE:         $eform_BillTo_Telecom_Phone_Number\n";
+$orderLoggingHash{'customerPhone'} = "$eform_BillTo_Telecom_Phone_Number";
+
+$text_of_cart .= "EMAIL:         $eform_Ecom_BillTo_Online_Email\n\n";
+$orderLoggingHash{'emailAddress'} = "$eform_Ecom_BillTo_Online_Email";
+
+$text_of_cart .= "SHIPPING INFORMATION --------------\n\n";
+
+$text_of_cart .= "NAME:          $eform_Ecom_ShipTo_Postal_Name_First $eform_Ecom_ShipTo_Postal_Name_Last\n";
+$orderLoggingHash{'shipToName'} = "$eform_Ecom_ShipTo_Postal_Name_First $eform_Ecom_ShipTo_Postal_Name_Last";
+
+$text_of_cart .= "ADDRESS:       $eform_Ecom_ShipTo_Postal_Street_Line1\n";
+$orderLoggingHash{'shipToAddress'} = "$eform_Ecom_ShipTo_Postal_Street_Line1";
+
+$text_of_cart .= "CITY:          $eform_Ecom_ShipTo_Postal_City\n";
+$orderLoggingHash{'shipToCity'} = "$eform_Ecom_ShipTo_Postal_City";
+
+$text_of_cart .= "STATE:         $eform_Ecom_ShipTo_Postal_StateProv\n";
+$orderLoggingHash{'shipToState'} = "$eform_Ecom_ShipTo_Postal_StateProv";
+
+$text_of_cart .= "ZIP:           $eform_Ecom_ShipTo_Postal_PostalCode\n";
+$orderLoggingHash{'shipToPostal'} = "$eform_Ecom_ShipTo_Postal_PostalCode";
+
+$text_of_cart .= "COUNTRY:       $vform_Ecom_ShipTo_Postal_CountryCode\n";
+$orderLoggingHash{'shipToCountry'} = "$vform_Ecom_ShipTo_Postal_CountryCode";
+
+if ($sc_use_SBW =~ /yes/i) {
+  $text_of_cart .= "SHIP VIA:      $eform_eform_Ecom_ShipTo_Method\n";
+ }
+
+# NEW CODEHOOK
+&codehook("process-order-pre-ship-instructions");
+
+if ($ship_instructions ne "") {
+  $text_of_cart .= "Shipping Instructions: \n$ship_instructions\n\n";
+ }
+
+# NEW CODEHOOK
+&codehook("process-order-pre-xcomments");
+
+$text_of_cart .= $XCOMMENTS_ADMIN;
+$orderLoggingHash{'adminMessages'} = "$XCOMMENTS_ADMIN";
+$orderLoggingHash{'adminMessages'} =~ s/\n/<br>/g;
+$orderLoggingHash{'adminMessages'} =~ s/\t/ /g;
+$orderLoggingHash{'adminMessages'} .= "<br>AUTHORIZATION INFORMATION --------------<br>TRANSACTION STATUS: $form_data{'UMstatus'}<br>AUTH CODE:  $form_data{'UMauthCode'}<br>TRANS ID:  $form_data{'UMrefNum'}<br>---------------------------------------------------------------<br>";
+$text_of_confirm_email .= $XCOMMENTS;
+$orderLoggingHash{'xcomments'} = "$XCOMMENTS";
+$orderLoggingHash{'xcomments'} =~ s/\n/<br>/g;
+$orderLoggingHash{'adminMessages'} =~ s/\t/ /g;
+
+# 'Init' the emails ...
+$text_of_cart = &init_shop_keep_email . $text_of_cart;
+$text_of_confirm_email = &init_customer_email . $text_of_confirm_email;
+
+# and add the rest ...
+$text_of_admin_email .= &addto_shop_keep_email;
+$text_of_confirm_email .= &addto_customer_email;
+
+$sc_USAepay_order_desc .= " - " . $sc_verify_inv_no;
+
+if ($sc_send_order_to_email =~ /yes/i) {
+  &send_mail($sc_admin_email, $sc_order_email, $sc_USAepay_order_desc, $text_of_cart);
+ }
+
+&log_order($text_of_cart,$sc_verify_inv_no,$form_data{'cart_id'});
+
+if (($cartData) && ($eform_Ecom_BillTo_Online_Email ne "")) {
+  &send_mail($sc_admin_email, $eform_Ecom_BillTo_Online_Email, $messages{'ordcnf_08'},
+           "$text_of_confirm_email");
+ }
+$sc_affiliate_order_unique = $sc_verify_inv_no;
+$sc_affiliate_order_total = $sc_verify_subtotal;
+
+$sc_affiliate_image_call =~ s/AMOUNT/$sc_affiliate_order_total/g;
+$sc_affiliate_image_call =~ s/UNIQUE/$sc_affiliate_order_unique/g;
+
+# NEW CODEHOOK
+&codehook("process-order-display-thankyou-page");
+  
+print <<ENDOFTEXT;
+<CENTER>
+<TABLE WIDTH=500>
+<TR>
+<TD WIDTH=500>
+<FONT FACE=ARIAL>
+$messages{'ordcnf_01'}
+$messages{'ordcnf_02'}
+<br>
+$sc_affiliate_image_call
+</FONT>
+</TD>
+</TR>
+</TABLE>
+<CENTER>  
+
+ENDOFTEXT
+
+# This empties the cart after the order is successful
+&empty_cart;
+
+# and the footer is printed
+
+&SecureStoreFooter;
+
+print qq!
+</BODY>
+</HTML>
+!;
+
+} # End of process_order_form
+
+#################################################################
+1; # Library
diff -ruN 4.0K-4b/library/YourPayConnect-mgr_lib.pl 5.0.000/library/YourPayConnect-mgr_lib.pl
--- 4.0K-4b/library/YourPayConnect-mgr_lib.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/library/YourPayConnect-mgr_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,267 @@
+#
+# For the CC and Check Processing Gateway YourPay Connect, included
+# in the base package of agoracart, a GPL-ed program.
+#
+# Copyright 2000 to date K-Factor Technologies, Inc. 
+
+$versions{'YourPayConnect-mgr_lib.pl'} = "5.0.000";
+&add_codehook("gateway_admin_screen","YourPayConnect_mgr_check");
+&add_codehook("gateway_admin_settings","YourPayConnect_settings");
+$mc_gateways .= "|YourPayConnect";
+##############################################################################
+sub YourPayConnect_settings {
+local($custom_logic);
+if ($sc_gateway_name eq "YourPayConnect") {
+
+ open (GATEWAY, "> $gateway_settings") || 
+	&my_die("Can't Open $gateway_settings");
+ print (GATEWAY  "\$sc_gateway_username = \'$in{'sc_gateway_username'}\';\n");
+ print (GATEWAY  "\$sc_gateway_storename = \'$in{'sc_gateway_storename'}\';\n");
+ print (GATEWAY  "\$sc_order_script_url = \"$in{'order_url'}\";\n");
+ print (GATEWAY  "#\n1\;# We are a Library\n");
+ print (GATEWAY  "\$sc_yourpay_submit = '$in{'sc_yourpay_submit'}';\n");
+ print (GATEWAY  "\$sc_yourpay_change = '$in{'sc_yourpay_change'}';\n");
+ print (GATEWAY  "\$sc_yourpay_verify_message = \"" . 
+       &my_escape($in{'sc_yourpay_verify_message'}) . "\";\n");
+ print (GATEWAY  "\$sc_yourpay_order_desc = \"" . 
+       &my_escape($in{'sc_yourpay_order_desc'}) . "\";\n");
+  print (GATEWAY  "\$sc_display_checkout_tos = \"$in{'sc_display_checkout_tos'}\";\n");
+$sc_tos_display_address_temp = &my_escape($in{'sc_tos_display_address'});
+  print (GATEWAY  "\$sc_tos_display_address = qq'$sc_tos_display_address_temp';\n");
+ print (GATEWAY  "\$sc_yourpay_top_message = \"" . 
+       &my_escape($in{'sc_yourpay_top_message'}) . "\";\n");
+ print (GATEWAY  "\$order_ok_final_msg_tbl = \"" . 
+       &my_escape($in{'order_ok_final_msg_tbl'}) . "\";\n");
+
+ print (GATEWAY  "#\n1\;\n");
+ close(GATEWAY);
+ }
+}
+##############################################################################
+sub YourPayConnect_mgr_check {
+if ($sc_gateway_name eq "YourPayConnect") {
+  &print_YourPayConnect_mgr_form;
+  &call_exit;
+ }
+}
+##############################################################################
+sub print_YourPayConnect_mgr_form {
+	
+#
+# YourPay Connect Gateway
+#
+
+print &$manager_page_header("YourPay Gateway","","","","");
+
+print <<ENDOFTEXT;
+<CENTER>
+<TABLE WIDTH=580 CELLPADDING=0 CELLSPACING=0 BORDER=0>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD WIDTH=580>
+<FONT FACE=ARIAL>
+YourPay Connect Settings
+$msg<br><br>
+</FONT>
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+
+ENDOFTEXT
+
+if($in{'system_edit_success'} ne "")
+{
+print <<ENDOFTEXT;
+<CENTER>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL SIZE=2 COLOR=RED>Gateway settings have been successfully
+updated</FONT>
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+ENDOFTEXT
+}
+
+print <<ENDOFTEXT;
+
+<FONT FACE=ARIAL SIZE=2>
+<FORM METHOD="POST" ACTION="manager.cgi">
+<CENTER>
+<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=580 BORDER=0>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD WIDTH="55%">
+User ID as registered with YourPay Connect.
+</TD>
+<TD WIDTH="45%">
+<INPUT NAME="sc_gateway_username" TYPE="TEXT" SIZE=30
+VALUE='$sc_gateway_username'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD WIDTH="55%">
+Store ID as registered with YourPay Connect.
+</TD>
+<TD WIDTH="45%">
+<INPUT NAME="sc_gateway_storename" TYPE="TEXT" SIZE=30
+VALUE='$sc_gateway_storename'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+URL to the YourPay Connect server
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+<INPUT NAME="order_url" TYPE="TEXT" SIZE=70
+VALUE="$sc_order_script_url"><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+URL of 'Submit' button:
+<br>
+<INPUT NAME="sc_yourpay_submit" TYPE="TEXT" SIZE=60 
+VALUE='$sc_yourpay_submit'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+URL of 'Make Changes' button:
+<br>
+<INPUT NAME="sc_yourpay_change" TYPE="TEXT" SIZE=60 
+VALUE='$sc_yourpay_change'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+Order Description:
+<br>
+<INPUT NAME="sc_yourpay_order_desc" TYPE="TEXT" SIZE=60 
+VALUE='$sc_yourpay_order_desc'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+Message at the top of the Verify Order table:
+<br>
+<TEXTAREA NAME="sc_yourpay_verify_message"
+ROWS=4 COLS=65 wrap=soft>$sc_yourpay_verify_message</TEXTAREA>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><br><HR><br></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><TABLE WIDTH="100%"><TR>
+<TD>Display Terms of Service and Refund Policy checkbox and set as required?</TD>
+<TD>
+<SELECT NAME="sc_display_checkout_tos">
+<OPTION>$sc_display_checkout_tos</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT>
+</TD>
+</TR></TABLE></TD>
+</TR>
+<TR><TD COLSPAN=2><br>
+Business address and phone number (contact information) for your business.  Should be legal address for the business location for full disclosure and other privacy requirements mandated by credit card companies as well as government enitities that require such notices:<br>
+<TEXTAREA NAME="sc_tos_display_address" 
+cols="68" rows=5 
+wrap=off>$sc_tos_display_address</TEXTAREA><br>
+
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR><TD COLSPAN=2>
+Top message for Order form.  Allows you to place a message above the Payment Information area and just below the cart total boxes.  HTML formatting (for text color, font, spacing, etc) is accepted.  Leave blank if not needed:<br>
+<TEXTAREA NAME="sc_yourpay_top_message" 
+cols="68" rows=8 
+wrap=off>$sc_yourpay_top_message</TEXTAREA> <br><br>
+</TD>
+</TR>
+
+<TR><TD COLSPAN=2>
+Top message for confirmation page, the page just before going to the gateway.  This allows you to place a message above the Payment Information area and just below the cart total boxes.  HTML formatting (for text color, font, spacing, etc) is accepted.  Note: By default one exists, message 10 in the agora.setup.db file. Leave blank if not needed:<br>
+<TEXTAREA NAME="order_ok_final_msg_tbl" 
+cols="68" rows=8 
+wrap=off>$order_ok_final_msg_tbl</TEXTAREA> <br><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+<CENTER>
+<INPUT TYPE="HIDDEN" NAME="system_edit_success" VALUE="yes">
+<INPUT TYPE="HIDDEN" NAME="gateway" VALUE="YourPayConnect">
+<INPUT NAME="GatewaySettings" TYPE="SUBMIT" VALUE="Submit">
+&nbsp;&nbsp;
+<INPUT TYPE="RESET" VALUE="Reset">
+</CENTER>
+</TD>
+</TR>
+
+</TABLE>
+
+</CENTER>
+</FORM>
+ENDOFTEXT
+print &$manager_page_footer;
+	
+}
+##############################################################################
+1; #Library
diff -ruN 4.0K-4b/library/YourPayConnect-order_lib.pl 5.0.000/library/YourPayConnect-order_lib.pl
--- 4.0K-4b/library/YourPayConnect-order_lib.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/library/YourPayConnect-order_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,669 @@
+##############################################################################
+#                       Order Form Definition Variables                      #
+##############################################################################
+$versions{'YourPayConnect-order_lib.pl'} = "5.0.000";
+$sc_use_secure_header_at_checkout = 'yes';
+$sc_use_secure_footer_for_order_form = 'yes';
+$sc_YourPayConnect_form_prep = 0;
+&add_codehook("printSubmitPage","print_YourPayConnect_SubmitPage");
+&add_codehook("set_form_required_fields","YourPayConnect_fields");
+$sc_order_response_vars{"YourPayConnect"}="oid";
+&add_codehook("gateway_response","check_for_YourPayConnect_response");
+###############################################################################
+sub YourPayConnect_check_and_load {
+local($myname)="YourPayConnect";
+if ($myname ne $sc_gateway_name) { # we are a secondary gateway, load settings
+  &require_supporting_libraries(__FILE__,__LINE__,
+     "./admin_files/$myname-user_lib.pl");
+ }
+
+}
+###############################################################################
+sub check_for_YourPayConnect_response {
+  if ($form_data{'oid'}) {
+    ($cart_id,$yp_inv) = split(/\|/,$form_data{'oid'},2);
+    &set_sc_cart_path;
+    &load_order_lib;
+    &codehook("YourPayConnect_order");
+    &process_YourPayConnect_order;
+    &call_exit;
+   }
+ }
+###############################################################################
+sub YourPayConnect_order_form_prep { # load the customer info ...
+  &YourPayConnect_check_and_load;
+  if ($sc_YourPayConnect_form_prep == 0) {
+    if (-f "$sc_verify_order_path"){
+      &read_verify_file;  
+     } else {
+      &codehook("load_customer_info");
+     }
+    $sc_YourPayConnect_form_prep = 1;
+   }
+  return "";
+ }
+
+###############################################################################
+sub YourPayConnect_fields{
+local($myname)="YourPayConnect";
+
+if (!($form_data{'gateway'} eq $myname)) { return;} 
+
+%sc_order_form_array =(
+	'Ecom_ShipTo_Postal_Name', 'Billing/Shipping Name',
+	'Ecom_BillTo_Postal_Name_First', 'First Name',
+	'Ecom_BillTo_Postal_Name_Last', 'Last Name',
+	'Ecom_BillTo_Postal_Street_Line1', 'Billing Address Street',
+	'Ecom_BillTo_Postal_City', 'Billing Address City',
+	'Ecom_BillTo_Postal_StateProv', 'Billing Address State',
+	'Ecom_BillTo_PostalCode', 'Billing Address Zip',
+	'Ecom_BillTo_Postal_CountryCode', 'Billing Address Country',
+  'Ecom_ShipTo_Method', 'Shipping Method',
+	'Ecom_ShipTo_Postal_Street_Line1', 'Shipping Address Street',
+	'Ecom_ShipTo_Postal_City', 'Shipping Address City',
+	'Ecom_ShipTo_Postal_StateProv', 'Shipping Address State',
+	'Ecom_ShipTo_Postal_PostalCode', 'Shipping Address Zip',
+	'Ecom_ShipTo_Postal_CountryCode', 'Shipping Address Country',
+	'Ecom_BillTo_Telecom_Phone_Number', 'Phone Number',
+	'Ecom_BillTo_Online_Email', 'Email',
+	'Ecom_Payment_Card_Type', 'Type of Card',
+	'Ecom_Payment_Card_Number', 'Card Number',
+	'Ecom_Payment_Card_ExpDate_Month', 'Card Expiration Month',
+	'Ecom_Payment_Card_ExpDate_Day', 'Card Expiration Day',
+	'Ecom_Payment_Card_ExpDate_Year', 'Card Expiration Year',
+  'Ecom_is_Residential', 'Shipping to Residential Address',
+  'Ecom_ShipTo_Insurance', 'Insure this Shipment', # not implemented yet, for the future
+  'Ecom_tos', 'Sales-Terms of Service');
+
+@sc_order_form_required_fields = (
+  'Ecom_BillTo_Online_Email',
+  'Ecom_ShipTo_Method',
+  'Ecom_ShipTo_Postal_Name',
+  'Ecom_ShipTo_Postal_Street_Line1', 
+  'Ecom_ShipTo_Postal_City', 
+  'Ecom_ShipTo_Postal_StateProv',
+  'Ecom_ShipTo_Postal_PostalCode');
+
+ if ($sc_display_checkout_tos =~ /yes/i) {
+    push(@sc_order_form_required_fields,"Ecom_tos");
+ }
+
+}
+
+###############################################################################
+sub YourPayConnect_verification_table {
+  local ($rslt)="";
+  $rslt = "<table border=0 width=100%>\n<tr>\n";
+  $rslt.= "<td width=\"50%\" align=right>Shipping Method:</td>\n";
+  $rslt.= '<td width = "50%" align=left>' .
+	$form_data{'Ecom_ShipTo_Method'} . "&nbsp;</td>\n";
+  $rslt.= "</tr>\n";
+  $rslt.= "<td width=\"50%\" align=right>Email:</td>\n";
+  $rslt.= '<td width = "50%" align=left>' .
+	$form_data{'Ecom_BillTo_Online_Email'} . "&nbsp;</td>\n";
+  $rslt.= "</tr>\n";
+  $rslt.= "<td width=\"50%\" align=right>Name:</td>\n";
+  $rslt.= '<td width = "50%" align=left>' .
+	$form_data{'Ecom_ShipTo_Postal_Name'} . "&nbsp;</td>\n";
+  $rslt.= "</tr>\n";
+  $rslt.= "<tr>\n";
+  $rslt.= "<td width=\"50%\" align=right>Street:</td>\n";
+  $rslt.= '<td width = "50%" align=left>' .
+	$form_data{'Ecom_ShipTo_Postal_Street_Line1'} . "&nbsp;</td>\n";
+  $rslt.= "</tr>\n";
+  $rslt.= "<tr>\n";
+  $rslt.= "<td width=\"50%\" align=right>City:</td>\n";
+  $rslt.= '<td width = "50%" align=left>' .
+	$form_data{'Ecom_ShipTo_Postal_City'} . "&nbsp;</td>\n";
+  $rslt.= "</tr>\n";
+  $rslt.= "<tr>\n";
+  $rslt.= "<td width=\"50%\" align=right>State:</td>\n";
+  $rslt.= '<td width = "50%" align=left>' .
+	$form_data{'Ecom_ShipTo_Postal_StateProv'} . "&nbsp;</td>\n";
+  $rslt.= "</tr>\n";
+  $rslt.= "<tr>\n";
+  $rslt.= "<td width=\"50%\" align=right>Zip:</td>\n";
+  $rslt.= '<td width = "50%" align=left>' .
+	$form_data{'Ecom_ShipTo_Postal_PostalCode'} . "&nbsp;</td>\n";
+  $rslt.= "</tr>\n";
+  $rslt.= "<tr>\n";
+  $rslt.= "<td width=\"50%\" align=right>Country:</td>\n";
+  $rslt.= '<td width = "50%" align=left>' .
+	$form_data{'Ecom_ShipTo_Postal_CountryCode'} . "&nbsp;</td>\n";
+  $rslt.= "</tr>\n";
+  $rslt.= "</table>\n";
+  return $rslt;
+ }
+###############################################################################
+
+sub print_YourPayConnect_SubmitPage
+
+{
+local($invoice_number, $customer_number);
+local($myname)="YourPayConnect";
+local($my_change,$my_submit,$my_message,$my_desc);
+
+if (!($form_data{'gateway'} eq $myname)) { return;} 
+if ($myname ne $sc_gateway_name) { # secondary gateway, load settings
+  &require_supporting_libraries(__FILE__,__LINE__,
+	"./admin_files/$myname-user_lib.pl");
+ }
+
+$invoice_number = $current_verify_inv_no;
+$customer_number = $cart_id;
+$customer_number =~ s/_/./g;
+$my_submit=&script_and_substitute($sc_yourpay_submit);
+$my_change=&script_and_substitute($sc_yourpay_change);
+$my_message=&script_and_substitute($sc_yourpay_verify_message);
+$my_desc=&script_and_substitute($sc_yourpay_order_desc);
+
+$my_oid = $cart_id . "|" . $invoice_number;
+$mytable = &YourPayConnect_verification_table;
+&read_verify_file;
+
+if ($order_ok_final_msg_tbl eq '') {
+ # Default so something is there, use $messages{'ordcnf_10'} though 
+ # to customize, set it in the Free Form Logic (either location.)
+  $order_ok_final_msg_tbl = "<b>Order Confirmation</b><br/><br/>" . &get_date;
+ }
+
+my $temp_total_thingy = ($zsubtotal - $zfinal_discount);
+
+print <<ENDOFTEXT;
+
+<FORM METHOD=POST ACTION="$sc_order_script_url">
+<INPUT TYPE=HIDDEN NAME='mode' value="payplus">
+<INPUT TYPE=HIDDEN NAME='txnorg' value="eci">
+<INPUT TYPE=HIDDEN NAME='txntype' value="sale">
+<INPUT TYPE=HIDDEN NAME='tax' value="$zfinal_sales_tax">
+<INPUT TYPE=HIDDEN NAME='shipping' VALUE="$zfinal_shipping">
+<INPUT TYPE=HIDDEN NAME='subtotal' VALUE="$temp_total_thingy">
+<INPUT TYPE=HIDDEN NAME='chargetotal' VALUE="$authPrice">
+<INPUT TYPE=HIDDEN NAME='username' VALUE="$sc_gateway_username">
+<INPUT TYPE=HIDDEN NAME='storename' VALUE="$sc_gateway_storename">
+<INPUT TYPE=HIDDEN NAME='oid' VALUE="$my_oid">
+<INPUT TYPE=HIDDEN NAME='email' VALUE="$eform_Ecom_BillTo_Online_Email">
+<INPUT TYPE=HIDDEN NAME='bname' VALUE="$eform_Ecom_ShipTo_Postal_Name">
+<INPUT TYPE=HIDDEN NAME='baddr1' VALUE="$eform_Ecom_ShipTo_Postal_Street_Line1"> 
+<INPUT TYPE=HIDDEN NAME='bcity' VALUE="$eform_Ecom_ShipTo_Postal_City"> 
+<INPUT TYPE=HIDDEN NAME='bstate' VALUE="$eform_Ecom_ShipTo_Postal_StateProv">
+<INPUT TYPE=HIDDEN NAME='bzip' VALUE="$eform_Ecom_ShipTo_Postal_PostalCode">
+
+<div align="center">
+  <p class="ac_checkout_top_msg">$order_ok_final_msg_tbl</p>
+  <p class="ac_checkout_top_msg">$my_message</p>
+
+
+<table cellpadding="0" cellspacing="0" class="ac_checkout_review">
+<tr>
+<th colspan="2" class="ac_checkout_review">Customer Information</th>
+</tr>
+ENDOFTEXT
+
+if ($form_data{'Ecom_ShipTo_Method'} ne ""){
+print <<ENDOFTEXT;
+  <tr>
+    <td class="ac_checkout_review_col1">Ship via:</td>
+    <td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Method'}</td>
+  </tr>
+ENDOFTEXT
+}
+ 
+print <<ENDOFTEXT;
+  <tr>
+    <td class="ac_checkout_review_col1">Name</td>
+    <td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_Name'}&nbsp;</td>
+  </tr>
+
+  <tr>
+    <td class="ac_checkout_review_col1">Street</td>
+    <td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_Street_Line1'}&nbsp;</td>
+  </tr>
+
+  <tr>
+    <td class="ac_checkout_review_col1">City</td>
+    <td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_City'}&nbsp;</td>
+  </tr>
+
+  <tr>
+    <td class="ac_checkout_review_col1">State</td>
+    <td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_StateProv'}
+    &nbsp;</td>
+  </tr>
+  <tr>
+    <td class="ac_checkout_review_col1">Postal Code</td>
+    <td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_PostalCode'}
+    &nbsp; </td>
+  </tr>
+  <tr>
+    <td class="ac_checkout_review_col1">Country</td>
+    <td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_CountryCode'}</td>
+  </tr>
+</TABLE>
+
+<TABLE WIDTH="500" BGCOLOR="#FFFFFF" CELLPADDING="2" CELLSPACING="0" BORDER=0>
+  <TR>
+    <TD COLSPAN=2>
+      <CENTER>
+        <INPUT TYPE="IMAGE" NAME="Submit" VALUE="Submit Order For Processing"
+        SRC="$my_submit" border=0>&nbsp;&nbsp;&nbsp;&nbsp;
+
+        <a href="agora.cgi?order_form_button.x=1&cart_id=${cart_id}">
+        <IMG SRC="$my_change" BORDER=0></a>
+      </CENTER>
+    </TD>
+  </TR>
+</TABLE>
+</CENTER>
+</FORM>
+
+ENDOFTEXT
+
+}
+###############################################################################
+
+sub process_YourPayConnect_order {
+
+local($subtotal, $total_quantity,
+      $total_measured_quantity,
+      $text_of_cart,
+      $required_fields_filled_in, $product, $quantity, $options);
+local($stevo_shipping_thing) = "";
+local($stevo_shipping_names) = "";
+local($ship_thing_too,$ship_instructions);
+local(%orderLoggingHash);
+
+&load_verify_file;
+
+$orderDate = &get_date;
+
+# NEW CODEHOOK
+&codehook("process-order-routine-top");
+
+print qq!
+<Connect>
+$sc_special_page_meta_tags
+<HEAD>
+<TITLE>$messages{'ordcnf_08'}</TITLE>
+<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+$sc_secure_standard_head_info</HEAD>
+<BODY $sc_standard_body_info>
+!;
+
+&SecureStoreHeader;
+
+$text_of_cart .= "Order Date:    $orderDate\n";
+$text_of_cart .= "Gateway:       YourPayConnect\n\n";
+$orderLoggingHash{'GatewayUsed'} = "YourPayConnect";
+
+$text_of_cart .= "  --PRODUCT INFORMATION--\n\n";
+
+open (CART, "$sc_cart_path") ||
+&file_open_error("$sc_cart_path", "display_cart_contents", __FILE__, __LINE__);
+
+while (<CART>) {
+  $cartData++;
+  @cart_fields = split (/\|/, $_);
+  $quantity = $cart_fields[0];
+  $product_price = $cart_fields[3];
+  $product = $cart_fields[4];
+  $weight = $cart_fields[6];
+  $options = $cart_fields[$cart{"options"}];
+  $options =~ s/<br>//g;
+  $text_of_cart .= &cart_textinfo(*cart_fields);
+  $stevo_shipping_thing .= "|quantity\*$weight";
+  $stevo_shipping_names .= "|$product\($options\)";
+  &codehook("process-cart-item");
+ }
+close(CART);
+
+# initialize hash variables in case they are empty later
+# added by Mister Ed October 2005
+
+$orderLoggingHash{'firstName'} = "";
+$orderLoggingHash{'lastName'} = "";
+$orderLoggingHash{'fullName'} = "";
+$orderLoggingHash{'orderFromAddress'} = "";
+$orderLoggingHash{'customerAddress2'} = "";
+$orderLoggingHash{'customerAddress3'} = "";
+$orderLoggingHash{'orderFromCity'} = "";
+$orderLoggingHash{'orderFromPostal'} = "";
+$orderLoggingHash{'customerPhone'} = "";
+$orderLoggingHash{'companyName'} = "";
+$orderLoggingHash{'emailAddress'} = "";
+
+$orderLoggingHash{'shipToName'} = "";
+$orderLoggingHash{'shipToAddress'} = "";
+$orderLoggingHash{'shipToAddress2'} = "";
+$orderLoggingHash{'shipToAddress3'} = "";
+$orderLoggingHash{'shipToCity'} = "";
+$orderLoggingHash{'shipToState'} = "";
+$orderLoggingHash{'shipToPostal'} = "";
+$orderLoggingHash{'shipToCountry'} = "";
+$orderLoggingHash{'shiptoResidential'} = $vform_Ecom_is_Residential;
+$orderLoggingHash{'insureShipment'} = $vform_Ecom_ShipTo_Insurance; # not implemented yet, for the future
+
+$orderLoggingHash{'invoiceNumber'} = "";
+$orderLoggingHash{'customerNumber'} = "";
+$orderLoggingHash{'orderStatus'} = "$sc_order_status_default";
+$orderLoggingHash{'user1'} = "";
+$orderLoggingHash{'user2'} = "";
+$orderLoggingHash{'user3'} = "";
+$orderLoggingHash{'user4'} = "";
+$orderLoggingHash{'user5'} = "";
+$orderLoggingHash{'itemsordered'} = "";
+$orderLoggingHash{'shiptrackingID'} = "";
+$orderLoggingHash{'shipMethod'} = "";
+$orderLoggingHash{'orderFromState'} = "";
+$orderLoggingHash{'orderFromCountry'} = "";
+$orderLoggingHash{'shippingTotal'} = "";
+$orderLoggingHash{'salesTax'} = "";
+$orderLoggingHash{'tax1'} = "";
+$orderLoggingHash{'tax2'} = "";
+$orderLoggingHash{'tax3'} = "";
+$orderLoggingHash{'discounts'} = "";
+$orderLoggingHash{'netProfit'} = "";
+$orderLoggingHash{'affiliateTotal'} = "";
+$orderLoggingHash{'affiliateID'} = "";
+$orderLoggingHash{'affiliateMisc'} = "";
+$orderLoggingHash{'subTotal'} = "";
+$orderLoggingHash{'orderTotal'} = "";
+$orderLoggingHash{'adminMessages'} = "";
+$orderLoggingHash{'shippingMessages'} = "";
+$orderLoggingHash{'xcomments'} = "";
+$orderLoggingHash{'termsOfService'} = "$vform_Ecom_tos";
+
+$sc_orderlib_use_SBW_for_ship_ins = $sc_use_SBW;
+&codehook("orderlib-ship-instructions");
+if ($sc_orderlib_use_SBW_for_ship_ins =~ /yes/i) {
+  ($ship_thing_too,$ship_instructions) = 
+   &ship_put_in_boxes($stevo_shipping_thing,$stevo_shipping_names,
+   $sc_verify_Origin_ZIP,$sc_verify_boxes_max_wt); 
+ }
+$orderLoggingHash{'shippingMessages'} = "$ship_instructions";
+$orderLoggingHash{'shippingMessages'} =~ s/\n/<br>/g;
+
+$text_of_confirm_email .= $messages{'ordcnf_07'};
+
+$text_of_confirm_email .= $text_of_cart;
+$text_of_confirm_email .= "\n";
+$text_of_cart .= "  --ORDER INFORMATION--\n\n";
+
+&add_text_of_both('Order ID',$form_data{'oid'});
+&add_text_of_cart('STATUS',$form_data{'status'});
+&add_text_of_cart('APPROVAL CODE',$form_data{'approval_code'});
+&add_text_of_cart('Charge Total',$form_data{'chargetotal'});
+&add_text_of_cart('CC Type',$form_data{'cctype'});
+&add_text_of_cart('Card #',$form_data{'cardnumber'});
+&add_text_of_cart('Exp Month',$form_data{'expmonth'});
+&add_text_of_cart('Exp Year',$form_data{'expyear'});
+
+$orderLoggingHash{'customerNumber'} = "$cart_id";
+$orderLoggingHash{'invoiceNumber'} = "$yp_inv";
+$orderLoggingHash{'subTotal'} = &format_price($sc_verify_subtotal);
+
+&add_text_of_both("SUBTOTAL",$sc_verify_subtotal);
+$sc_verify_subtotal3 = $sc_verify_subtotal;
+
+if ($sc_verify_discount) {
+  $temp = &format_price($sc_verify_discount);
+  &add_text_of_both("DISCOUNT",$temp);
+  $orderLoggingHash{'discounts'} = &format_price($sc_verify_discount);
+  # start of adjustments for discount addon
+  $text_of_cart .= "DISCOUNT CODE: $eform_Ecom_Discount\n";
+  $text_of_confirm_email .= "DISCOUNT CODE: $eform_Ecom_Discount\n";
+  # end of adjustments for discount addon
+}
+
+if ($sc_verify_shipping){
+  &add_text_of_both("SHIPPING",$sc_verify_shipping);
+$orderLoggingHash{'shippingTotal'} = &format_price($sc_verify_shipping);
+ }
+
+if ($sc_verify_tax > 0)
+{
+$temp = substr(substr("SALES TAX",0,13).":               ",0,15);
+$text_of_cart .= "$temp$sc_verify_tax\n";
+$text_of_confirm_email .= "$temp$sc_verify_tax\n";
+$orderLoggingHash{'salesTax'} = "$sc_verify_tax";
+}
+if ($sc_verify_etax1 > 0)
+{
+$temp = substr(substr($sc_extra_tax1_name,0,13).":               ",0,15);
+$text_of_cart .= "$temp$sc_verify_etax1\n";
+$text_of_confirm_email .= "$temp$sc_verify_etax1\n";
+$orderLoggingHash{'tax1'} = "$sc_verify_etax1";
+}
+if ($sc_verify_etax2 > 0)
+{
+$temp = substr(substr($sc_extra_tax2_name,0,13).":               ",0,15);
+$text_of_cart .= "$temp$sc_verify_etax2\n";
+$text_of_confirm_email .= "$temp$sc_verify_etax2\n";
+$orderLoggingHash{'tax2'} = "$sc_verify_etax2";
+}
+if ($sc_verify_etax3 > 0)
+{
+$temp = substr(substr($sc_extra_tax3_name,0,13).":               ",0,15);
+$text_of_cart .= "$temp$sc_verify_etax3\n";
+$text_of_confirm_email .= "$temp$sc_verify_etax3\n";
+$orderLoggingHash{'tax3'} = "$sc_verify_etax3";
+}
+
+if ($form_data{'tax'}){
+  &add_text_of_both("TOTAL TAXES",$form_data{'tax'});
+  $orderLoggingHash{'salesTax'} = "$form_data{'tax'}";
+ }
+
+
+$text_of_cart .= "GRAND TOTAL:   $form_data{'chargetotal'}\n\n";
+$text_of_confirm_email .= "GRAND TOTAL:   $form_data{'chargetotal'}\n\n";
+$orderLoggingHash{'orderTotal'} = "$form_data{'chargetotal'}";
+
+$text_of_cart .= "BILLING INFORMATION --------------\n\n";
+
+$text_of_cart .= "NAME:          $form_data{'bname'}\n";
+$orderLoggingHash{'fullName'} = "$form_data{'bname'}";
+
+if ($form_data{'baddr1'} ne "") {
+  $text_of_cart .= "ADDRESS1:      $form_data{'baddr1'}\n";
+  $orderLoggingHash{'orderFromAddress'} = "$form_data{'baddr1'}";
+}
+
+if ($form_data{'baddr2'} ne "") {
+  $text_of_cart .= "ADDRESS2:      $form_data{'baddr2'}\n";
+  $orderLoggingHash{'customerAddress2'} = "$form_data{'baddr2'}";
+}
+
+$text_of_cart .= "CITY:          $form_data{'bcity'}\n";
+$orderLoggingHash{'orderFromCity'} = "$form_data{'bcity'}";
+
+$text_of_cart .= "STATE:         $form_data{'bstate'}\n";
+$orderLoggingHash{'orderFromState'} = "$form_data{'bstate'}";
+
+$text_of_cart .= "ZIP:           $form_data{'bzip'}\n";
+$orderLoggingHash{'orderFromPostal'} = "$form_data{'bzip'}";
+
+$text_of_cart .= "COUNTRY:       $form_data{'bcountry'}\n";
+$orderLoggingHash{'orderFromCountry'} = "$form_data{'bcountry'}";
+
+$text_of_cart .= "PHONE:         $form_data{'phone'}\n";
+$orderLoggingHash{'customerPhone'} = "$form_data{'bphone'}";
+
+$text_of_cart .= "FAX:           $form_data{'fax'}\n";
+
+$text_of_cart .= "EMAIL:         $form_data{'email'}\n\n";
+$orderLoggingHash{'emailAddress'} = "$form_data{'email'}";
+
+$text_of_cart .= "SHIPPING INFORMATION --------------\n\n";
+
+if ($eform_Ecom_ShipTo_Postal_Name ne "") {
+  $text_of_cart .= "NAME:          $eform_Ecom_ShipTo_Postal_Name\n";
+  $orderLoggingHash{'shipToName'} = "$eform_Ecom_ShipTo_Postal_Name";
+} else {
+  $text_of_cart .= "NAME:          $form_data{'sname'}\n";
+  $orderLoggingHash{'shipToName'} = "$form_data{'sname'}";
+}
+
+if ($eform_Ecom_ShipTo_Postal_Street_Line1 ne "") {
+  $text_of_cart .= "ADDRESS1:      $eform_Ecom_ShipTo_Postal_Street_Line1\n";
+  $orderLoggingHash{'shipToAddress'} = "$eform_Ecom_ShipTo_Postal_Street_Line1";
+} else {
+  $text_of_cart .= "ADDRESS1:      $form_data{'saddr1'}\n";
+  $orderLoggingHash{'shipToAddress'} = "$form_data{'saddr1'}";
+}
+
+if ($form_data{'saddr2'} ne "") {
+  $text_of_cart .= "ADDRESS2:      $form_data{'saddr2'}\n";
+  $orderLoggingHash{'shipToAddress2'} = "$form_data{'saddr2'}";
+} elsif ($form_data{'baddr2'} ne "") {
+  $text_of_cart .= "ADDRESS2:      $form_data{'baddr2'}\n";
+  $orderLoggingHash{'shipToAddress2'} = "$form_data{'baddr2'}";
+}
+
+if ($eform_Ecom_ShipTo_Postal_City ne "") {
+  $text_of_cart .= "CITY:          $eform_Ecom_ShipTo_Postal_City\n";
+  $orderLoggingHash{'shipToCity'} = "$eform_Ecom_ShipTo_Postal_City";
+} else {
+  $text_of_cart .= "CITY:          $form_data{'scity'}\n";
+  $orderLoggingHash{'shipToCity'} = "$form_data{'scity'}";
+}
+
+if ($eform_Ecom_ShipTo_Postal_StateProv ne "") {
+  $text_of_cart .= "STATE:         $eform_Ecom_ShipTo_Postal_StateProv\n";
+  $orderLoggingHash{'shipToState'} = "$eform_Ecom_ShipTo_Postal_StateProv";
+} else {
+  $text_of_cart .= "STATE:         $form_data{'sstate'}\n";
+  $orderLoggingHash{'shipToState'} = "$form_data{'sstate'}";
+}
+
+if ($sc_verify_shipping_zip ne "") {
+   $text_of_cart .= "ZIP:           $sc_verify_shipping_zip\n";
+  $orderLoggingHash{'shipToPostal'} = "$sc_verify_shipping_zip";
+} else {
+  $text_of_cart .= "ZIP:           $form_data{'szip'}\n";
+  $orderLoggingHash{'shipToPostal'} = "$form_data{'szip'}";
+}
+
+if ($vform_Ecom_ShipTo_Postal_CountryCode ne "") {
+  $text_of_cart .= "COUNTRY:       $vform_Ecom_ShipTo_Postal_CountryCode\n\n";
+  $orderLoggingHash{'shipToCountry'} = "$vform_Ecom_ShipTo_Postal_CountryCode";
+} else {
+  $text_of_cart .= "COUNTRY:       $form_data{'scountry'}\n\n";
+  $orderLoggingHash{'shipToCountry'} = "$form_data{'scountry'}";
+}
+
+ $orderLoggingHash{'shipMethod'} = $eform_Ecom_ShipTo_Method;
+
+# NEW CODEHOOK
+&codehook("process-order-pre-ship-instructions");
+
+if ($sc_use_SBW =~ /yes/i) {
+  &add_text_of_cart("SHIP VIA",$vform_Ecom_ShipTo_Method);
+ }
+
+if ($sc_verify_discount) {
+  &add_text_of_both("DISCOUNT",$sc_verify_discount);
+  $orderLoggingHash{'discounts'} = "$sc_verify_discount";
+ }
+ 
+if ($ship_instructions ne "") {
+  $text_of_cart .= "Shipping Instructions: \n$ship_instructions\n\n";
+ }
+
+# NEW CODEHOOK
+&codehook("process-order-pre-xcomments");
+
+$text_of_cart .= $XCOMMENTS;
+$orderLoggingHash{'xcomments'} = "$XCOMMENTS";
+$orderLoggingHash{'xcomments'} =~ s/\n/<br>/g;
+$orderLoggingHash{'adminMessages'} =~ s/\t/ /g;
+$text_of_admin_email .= $XCOMMENTS_ADMIN;
+$orderLoggingHash{'adminMessages'} .= "$XCOMMENTS_ADMIN";
+$orderLoggingHash{'adminMessages'} =~ s/\n/<br>/g;
+$orderLoggingHash{'adminMessages'} =~ s/\t/ /g;
+$text_of_confirm_email .= $XCOMMENTS;
+
+$orderLoggingHash{'adminMessages'} .= "<br>--ORDER INFORMATION--<br>";
+$orderLoggingHash{'adminMessages'} .= "Order ID:      $form_data{'oid'}<br>";
+$orderLoggingHash{'adminMessages'} .= "STATUS:        $form_data{'status'}<br>";
+$orderLoggingHash{'adminMessages'} .= "APPROVAL CODE: $form_data{'approval_code'}<br>";
+$orderLoggingHash{'adminMessages'} .= "Charge Total:  $form_data{'chargetotal'}<br>";
+$orderLoggingHash{'adminMessages'} .= "CC Type:       $form_data{'cctype'}<br>";
+$orderLoggingHash{'adminMessages'} .= "Card #:        $form_data{'cardnumber'}<br>";
+$orderLoggingHash{'adminMessages'} .= "Exp Month:     $form_data{'expmonth'}<br>";
+$orderLoggingHash{'adminMessages'} .= "Exp Year:      $form_data{'expyear'}<br>";
+$orderLoggingHash{'adminMessages'} .= "<br>---------------------<br>";
+
+# 'Init' the emails ...
+$text_of_cart = &init_shop_keep_email . $text_of_cart;
+$text_of_confirm_email = &init_customer_email . $text_of_confirm_email;
+
+# and add the rest ...
+$text_of_admin_email .= &addto_shop_keep_email;
+$text_of_confirm_email .= &addto_customer_email;
+
+if ($sc_use_pgp =~ /yes/i)
+{
+&require_supporting_libraries(__FILE__, __LINE__, "$sc_pgp_lib_path");
+$text_of_cart = &make_pgp_file($text_of_cart, "$sc_pgp_temp_file_path/$$.pgp");
+$text_of_cart = "\n" . $text_of_cart . "\n";
+}
+
+if ($sc_send_order_to_email =~ /yes/i) {
+  &send_mail($sc_order_email, $sc_order_email, "AgoraCart - YourPayConnect Order - $yp_inv",$text_of_cart);
+ }
+
+# NEW CODEHOOK
+&codehook("process-order-pre-logOrder");
+
+# write order log
+&log_order($text_of_cart,$yp_inv,$cart_id);
+
+if (($cartData) && ($form_data{'email'} ne "")){
+  &send_mail($sc_admin_email, $form_data{'email'}, $messages{'ordcnf_08'}, 
+           "$text_of_confirm_email");
+ }
+$sc_affiliate_order_unique = $form_data{'oid'};
+$sc_affiliate_order_total = $sc_verify_subtotal3 - $sc_verify_discount;
+
+$sc_affiliate_image_call =~ s/AMOUNT/$sc_affiliate_order_total/g;
+$sc_affiliate_image_call =~ s/UNIQUE/$sc_affiliate_order_unique/g;
+
+# NEW CODEHOOK
+&codehook("process-order-display-thankyou-page");
+
+print <<ENDOFTEXT;
+<CENTER>
+<TABLE WIDTH=500>
+<TR>
+<TD WIDTH=500>
+<BR>
+<FONT FACE=ARIAL>
+$messages{'ordcnf_01'}
+$messages{'ordcnf_02'}
+<br>
+$sc_affiliate_image_call
+</FONT>
+</TD>
+</TR>
+</TABLE>
+<CENTER>  
+
+ENDOFTEXT
+
+# This empties the cart after the order is successful
+&empty_cart;
+
+# and the footer is printed
+
+&SecureStoreFooter;
+
+print qq!
+</BODY>
+</Connect>
+!;
+
+} # End of process_YourPayConnect_order
+
+#################################################################
+1; # Library
diff -ruN 4.0K-4b/library/additions/BTree/BTree.pm 5.0.000/library/additions/BTree/BTree.pm
--- 4.0K-4b/library/additions/BTree/BTree.pm	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/library/additions/BTree/BTree.pm	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,353 @@
+# -*- mode: perl; perl-indent-level: 2 -*-
+#
+# Btree.pm
+#
+# B-Trees
+#
+# Copyright 1997 M-J. Dominus (mjd@pobox.com)
+#
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of any of:
+#       1. Version 2 of the GNU General Public License as published by
+#          the Free Software Foundation;
+#       2. Any later version of the GNU public license, or
+#       3. The Perl `Artistic License'
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the Artistic License with this
+#    Kit, in the file named "Artistic".  If not, I'll be glad to provide one.
+#
+#    You should also have received a copy of the GNU General Public License
+#    along with this program; if not, write to the Free Software
+#    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+
+
+
+package BTree::Node;
+use Carp;
+
+$KEYS = 0;
+$DATA = 1;
+$SUBNODES = 2;
+
+# Each node has k key-data pairs, with B <= k <= 2B, and 
+#     each has k+1 subnodes, which might be null.
+# The node is a blessed reference to a list
+# with three elements:
+#  ($keylist, $datalist, $subnodelist)
+# each is a reference to a list list.
+# The null node is represented by a blessed reference to an empty list.
+
+sub emptynode {
+  new($_[0]);			# Pass package name, but not anything else.
+}
+
+# undef is empty; so is a blessed empty list.
+sub is_empty {
+  my $self = shift;
+  !defined($self) || $#$self < 0;
+}
+
+sub key {
+  my ($self, $n) = @_;
+  $self->[$KEYS][$n];
+}
+
+sub data {
+  my ($self, $n) = @_;
+  $self->[$DATA][$n];
+}
+
+sub kdp {
+  my ($self, $n, $k => $d) = @_;
+  if (defined $k) {
+    $self->[$KEYS][$n] = $k;
+    $self->[$DATA][$n] = $d;
+  }
+  [$self->[$KEYS][$n], 
+   $self->[$DATA][$n]];
+}
+
+sub subnode {
+  my ($self, $n, $newnode) = @_;
+  $self->[$SUBNODES][$n] = $newnode if defined $newnode;
+  $self->[$SUBNODES][$n];
+}
+
+sub is_leaf {
+  my $self = shift;
+  ! defined $self->[$SUBNODES][0]; # undefined subnode means leaf node.
+}
+
+# Arguments: ($keylist, $datalist, $subnodelist)
+# Special case: empty arg list to create empty node
+sub new {
+  my $self = shift;
+  my $package = ref $self || $self;
+  croak "Internal error:  BTree::Node::new called with wrong number of arguments."
+      unless @_ == 3 || @_ == 0;
+  bless [@_] => $package;
+}
+
+# Returns (1, $index) if $key[$index] eq $key.
+# Returns (0, $index) if key could be found in $subnode[$index].
+# In scalar context, just returns 1 or 0.
+sub locate_key {
+  # Use linear search for testing, replace with binary search.
+  my $self = shift;
+  my $key = shift;
+  my $cmp = shift || \&BTree::default_cmp;
+  my $i;
+  my $cmp_result;
+  my $N = $self->size;
+  for ($i = 0; $i < $N; $i++) {
+    $cmp_result = &$cmp($key, $self->key($i));
+    last if $cmp_result <= 0;
+  }
+  
+  # $i is now the index of the first node-key greater than $key
+  # or $N if there is no such.  $cmp_result is 0 iff the key was found.
+  (!$cmp_result, $i);
+}
+
+# Number of KEYS in the node
+sub size {
+  my $self = shift;
+  return scalar(@{$self->[$KEYS]});
+}
+
+# No return value.
+sub insert_kdp {
+  my $self = shift;
+  my ($k => $d) = @_;
+  my ($there, $where) = $self->locate_key($k) unless $self->is_empty;
+
+  if ($there) { croak("Tried to insert `$k => $d' into node where `$k' was already present."); }
+  splice(@{$self->[$KEYS]}, $where, 0, $k);
+  splice(@{$self->[$DATA]}, $where, 0, $d);
+  splice(@{$self->[$SUBNODES]}, $where, 0, undef);
+}
+
+# Accept an index $n
+# Divide into two nodes so that keys 0 .. $n-1 are in one node
+# and keys $n+1 ... $size are in the other.
+sub halves {
+  my $self = shift;
+  my $n = shift;
+  my $s = $self->size;
+  my @right;
+  my @left;
+
+  $left[$KEYS] = [@{$self->[$KEYS]}[0 .. $n-1]];
+  $left[$DATA] = [@{$self->[$DATA]}[0 .. $n-1]];
+  $left[$SUBNODES] = [@{$self->[$SUBNODES]}[0 .. $n]];
+
+  $right[$KEYS] = [@{$self->[$KEYS]}[$n+1 .. $s-1]];
+  $right[$DATA] = [@{$self->[$DATA]}[$n+1 .. $s-1]];
+  $right[$SUBNODES] = [@{$self->[$SUBNODES]}[$n+1 .. $s]];
+
+  my @middle = ($self->[$KEYS][$n], $self->[$DATA][$n]);
+
+  ($self->new(@left), $self->new(@right), \@middle);
+}
+
+sub to_string {
+  my $self = shift;
+  my $indent = shift || 0;
+  my $I = ' ' x $indent;
+  return '' if $self->is_empty;
+  my ($k, $d, $s) = @$self;
+  my $result = '';
+  $result .= defined($s->[0]) ? $s->[0]->to_string($indent+2) : '';
+  my $N = $self->size;
+  my $i;
+  for ($i = 0; $i < $N; $i++) {
+    $result .= $I . "$k->[$i] => $d->[$i]\n";
+    $result .= defined($s->[$i+1]) ? $s->[$i+1]->to_string($indent+2) : '';
+  }
+  $result;
+}
+
+
+
+################################################################
+
+package BTree;
+
+use Exporter;
+@ISA = (Exporter);
+
+BEGIN { import BTree::Node };
+
+use Carp;
+
+
+# Semantics:
+#  If key not found, insert it iff `Insert' arg is present
+#  If key *is* found, replace existing data iff `Replace' arg is present.
+
+sub B_search {
+  my $self = shift;
+  my %args = @_;
+  my $cur_node = $self->root;
+  my $k = $args{Key};
+  my $d = $args{Data};
+  my @path;
+
+  if ($cur_node->is_empty) {	# Special case for empty root
+    if ($args{Insert}) {
+      $cur_node->insert_kdp($k => $d);
+      return $d;
+    } else {
+      return undef;
+    }
+  }
+
+  # Descend tree to leaf
+  for (;;) {
+
+    # Didn't hit bottom yet.
+
+    my($there, $where) = $cur_node->locate_key($k);
+    if ($there) {		# Found it!
+      if ($args{Replace}) {
+	$cur_node->kdp($where, $k => $d);
+      } 
+      return $cur_node->data($where);
+    }
+    
+    # Not here---must be in a subtree.
+    
+    if ($cur_node->is_leaf) {	# But there are no subtrees
+      return undef unless $args{Insert}; # Search failed
+      # Stuff it in
+      $cur_node->insert_kdp($k => $d);
+      if ($self->node_overfull($cur_node)) { # Oops--there was no room.
+	$self->split_and_promote($cur_node, @path);
+      } 
+      return $d;
+    }
+
+    # There are subtrees, and the key is in one of them.
+
+    push @path, [$cur_node, $where];	# Record path from root.
+
+    # Move down to search the subtree
+    $cur_node = $cur_node->subnode($where);
+
+    # and start over.
+  }				# for (;;) ...
+
+  croak ("How did I get here?");
+}
+
+
+
+sub split_and_promote_old {
+  my $self = shift;
+  my ($cur_node, @path) = @_;
+  
+  for (;;) {
+    my ($newleft, $newright, $kdp) = $cur_node->halves($self->B / 2);
+    my ($up, $where) = @{pop @path};
+    if ($up) {
+      $up->insert_kdp(@$kdp);
+      my ($tthere, $twhere) = $up->locate_key($kdp->[0]);
+      croak "Couldn't find key `$kdp->[0]' in node after just inserting it!"
+	  unless $tthere;
+      croak "`$kdp->[0]' went into node at `$twhere' instead of expected `$where'!"
+	  unless $twhere == $where;
+      $up->subnode($where,   $newleft);
+      $up->subnode($where+1, $newright);
+      return unless $self->node_overfull($up);
+      $cur_node = $up;
+    } else { # We're at the top; make a new root.
+      my $newroot = new BTree::Node ([$kdp->[0]], 
+				     [$kdp->[1]], 
+				     [$newleft, $newright]);
+      $self->root($newroot);
+      return;
+    }
+  }
+  
+}
+
+sub split_and_promote {
+  my $self = shift;
+  my ($cur_node, @path) = @_;
+  
+  for (;;) {
+    my ($newleft, $newright, $kdp) = $cur_node->halves($self->B / 2);
+    my ($up, $where) = @{pop @path};
+    if ($up) {
+      $up->insert_kdp(@$kdp);
+      if ($DEBUG) {
+        my ($tthere, $twhere) = $up->locate_key($kdp->[0]);
+        croak "Couldn't find key `$kdp->[0]' in node after just inserting it!"
+  	  unless $tthere;
+        croak "`$kdp->[0]' went into node at `$twhere' instead of expected `$where'!"
+	  unless $twhere == $where;
+      }
+      $up->subnode($where,   $newleft);
+      $up->subnode($where+1, $newright);
+      return unless $self->node_overfull($up);
+      $cur_node = $up;
+    } else { # We're at the top; make a new root.
+      my $newroot = new BTree::Node ([$kdp->[0]], 
+				     [$kdp->[1]], 
+				     [$newleft, $newright]);
+      $self->root($newroot);
+      return;
+    }
+  }
+}
+
+sub B {
+  $_[0]{B};
+}
+
+sub root {
+  my ($self, $newroot) = @_;
+  $self->{Root} = $newroot if defined $newroot;
+  $self->{Root};
+}
+
+sub node_overfull {
+  my $self = shift;
+  my $node = shift;
+  $node->size > $self->B;
+}
+
+
+# Data structure:
+# A B-Tree has a constant, B.  It has a root node, which may have child nodes.
+# The node is an object from BTree::Node;
+
+sub new {
+  my $package = shift;
+  my %ARGV = @_;
+  croak "Usage: {$package}::new(B => number [, Root => root node ])"
+      unless exists $ARGV{B};
+  if ($ARGV{B} % 2) {
+    my $B = $ARGV{B} + 1;
+    carp "B must be an even number.  Using $B instead.";
+    $ARGV{B} = $B;
+  }
+    
+  my $B = $ARGV{B};
+  my $Root = exists($ARGV{Root}) ? $ARGV{Root} : BTree::Node->emptynode;
+  bless { B => $B, Root => $Root } => $package;
+}
+
+sub to_string {
+  $_[0]->root->to_string;
+}
+
+sub default_cmp {
+  $_[0] cmp $_[1];
+}
diff -ruN 4.0K-4b/library/additions/CGI/Ajax.pm 5.0.000/library/additions/CGI/Ajax.pm
--- 4.0K-4b/library/additions/CGI/Ajax.pm	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/library/additions/CGI/Ajax.pm	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,1207 @@
+package CGI::Ajax;
+use strict;
+use Data::Dumper;
+#use base qw(Class::Accessor);
+use overload '""' => 'show_javascript'; # for building web pages, so
+                                        # you can just say: print $pjx
+BEGIN {
+	use vars qw ($VERSION @ISA @METHODS);
+	@METHODS = qw(url_list coderef_list DEBUG JSDEBUG html
+								js_encode_function cgi_header_extra);
+
+	CGI::Ajax->mk_accessors( @METHODS );
+
+	$VERSION     = .695;
+}
+
+########################################### main pod documentation begin ##
+
+=head1 NAME
+
+CGI::Ajax - a perl-specific system for writing Asynchronous web
+applications
+
+=head1 SYNOPSIS
+
+  use strict;
+  use CGI;      # or any other CGI:: form handler/decoder
+  use CGI::Ajax;
+
+  my $cgi = new CGI;
+  my $pjx = new CGI::Ajax( 'exported_func' => \&perl_func );
+
+  print $pjx->build_html( $cgi, \&Show_HTML);
+
+  sub perl_func {
+    my $input = shift;
+    # do something with $input
+    my $output = $input . " was the input!";
+    return( $output );
+  }
+
+  sub Show_HTML {
+    my $html = <<EOHTML;
+    <HTML>
+    <BODY>
+      Enter something: 
+        <input type="text" name="val1" id="val1"
+         onkeyup="exported_func( ['val1'], ['resultdiv'] );">
+      <br>
+      <div id="resultdiv"></div>
+    </BODY>
+    </HTML>
+  EOHTML
+    return $html;
+  }
+
+I<There are several fully-functional examples in the 'scripts/'
+directory of the distribution.>
+
+=head1 DESCRIPTION
+
+CGI::Ajax is an object-oriented module that provides a unique
+mechanism for using perl code asynchronously from javascript-
+enhanced HTML pages.  CGI::Ajax unburdens the user from having to
+write extensive javascript, except for associating an exported
+method with a document-defined event (such as onClick, onKeyUp,
+etc).  CGI::Ajax also mixes well with HTML containing more complex
+javascript.
+
+CGI::Ajax supports methods that return single results or multiple
+results to the web page, and supports returning values to multiple
+DIV elements on the HTML page.
+
+Using CGI::Ajax, the URL for the HTTP GET/POST request is
+automatically generated based on HTML layout and events, and the
+page is then dynamically updated with the output from the perl
+function.  Additionally, CGI::Ajax supports mapping URL's to a
+CGI::Ajax function name, so you can separate your code processing
+over multiple scripts.
+
+Other than using the Class::Accessor module to generate CGI::Ajax'
+accessor methods, CGI::Ajax is completely self-contained - it
+does not require you to install a larger package or a full Content
+Management System, etc.
+
+We have added I<support> for other CGI handler/decoder modules,
+like L<CGI::Simple> or L<CGI::Minimal>, but we can't test these
+since we run mod_perl2 only here.  CGI::Ajax checks to see if a
+header() method is available to the CGI object, and then uses it.
+If method() isn't available, it creates it's own minimal header.
+
+A primary goal of CGI::Ajax is to keep the module streamlined and
+maximally flexible.  We are trying to keep the generated javascript
+code to a minimum, but still provide users with a variety of
+methods for deploying CGI::Ajax. And VERY little user javascript.
+
+=head1 EXAMPLES
+
+The CGI::Ajax module allows a Perl subroutine to be called
+asynchronously, when triggered from a javascript event on the
+HTML page.  To do this, the subroutine must be I<registered>,
+usually done during:
+
+  my $pjx = new CGI::Ajax( 'JSFUNC' => \&PERLFUNC );
+
+This maps a perl subroutine (PERLFUNC) to an automatically
+generated Javascript function (JSFUNC).  Next you setup a trigger this
+function when an event occurs (e.g. "onClick"):
+
+  onClick="JSFUNC(['source1','source2'], ['dest1','dest2']);"
+
+where 'source1', 'dest1', 'source2', 'dest2' are the DIV ids of
+HTML elements in your page...
+
+  <input type=text id=source1>
+  <input type=text id=source2>
+  <div id=dest1></div>
+  <div id=dest2></div>
+
+L<CGI::Ajax> sends the values from source1 and source2 to your
+Perl subroutine and returns the results to dest1 and dest2.
+
+=head2 4 Usage Methods
+
+=over 4
+
+=item 1 Standard CGI::Ajax example
+
+Start by defining a perl subroutine that you want available from
+javascript.  In this case we'll define a subrouting that determines
+whether or not an input is odd, even, or not a number (NaN):
+
+  use strict;
+  use CGI::Ajax;
+  use CGI;
+
+
+  sub evenodd_func {
+    my $input = shift;
+
+    # see if input is defined
+    if ( not defined $input ) {
+      return("input not defined or NaN");
+    }
+
+    # see if value is a number (*thanks Randall!*)
+    if ( $input !~ /\A\d+\z/ ) {
+      return("input is NaN");
+    }
+
+    # got a number, so mod by 2
+    $input % 2 == 0 ? return("EVEN") : return("ODD");
+  }
+
+Alternatively, we could have used coderefs to associate an
+exported name...
+
+  my $evenodd_func = sub {
+    # exactly the same as in the above subroutine
+  };
+
+Next we define a function to generate the web page - this can
+be done many different ways, and can also be defined as an
+anonymous sub.  The only requirement is that the sub send back
+the html of the page.  You can do this via a string containing the
+html, or from a coderef that returns the html, or from a function
+(as shown here)...
+
+  sub Show_HTML {
+    my $html = <<EOT;
+  <HTML>
+  <HEAD><title>CGI::Ajax Example</title>
+  </HEAD>
+  <BODY>
+    Enter a number:&nbsp;
+    <input type="text" name="somename" id="val1" size="6"
+       OnKeyUp="evenodd( ['val1'], ['resultdiv'] );">
+    <br>
+    <hr>
+    <div id="resultdiv">
+    </div>
+  </BODY>
+  </HTML>
+EOT
+    return $html;
+  }
+
+The exported Perl subrouting is triggered using the C<OnKeyUp>
+event handler of the input HTML element.  The subroutine takes one
+value from the form, the input element B<'val1'>, and returns the
+the result to an HTML div element with an id of B<'resultdiv'>.
+Sending in the input id in an array format is required to support
+multiple inputs, and similarly, to output multiple the results,
+you can use an array for the output divs, but this isn't mandatory -
+as will be explained in the B<Advanced> usage.
+
+Now create a CGI object and a CGI::Ajax object, associating a reference
+to our subroutine with the name we want available to javascript.
+
+  my $cgi = new CGI();
+  my $pjx = new CGI::Ajax( 'evenodd' => \&evenodd_func );
+
+And if we used a coderef, it would look like this...
+
+  my $pjx = new CGI::Ajax( 'evenodd' => $evenodd_func );
+
+Now we're ready to print the output page; we send in the cgi
+object and the HTML-generating function.
+
+  print $pjx->build_html($cgi,\&Show_HTML);
+
+CGI::Ajax has support for passing in extra HTML header information
+to the CGI object.  This can be accomplished by adding a third
+argument to the build_html() call.  The argument needs to be a
+hashref containing Key=>value pairs that CGI objects understand:
+
+  print $pjx->build_html($cgi,\&Show_HTML,
+    {-charset=>'UTF-8, -expires=>'-1d'});
+
+See L<CGI> for more header() method options.
+
+That's it for the CGI::Ajax standard method.  Let's look at
+something more advanced.
+
+=item 2 Advanced CGI::Ajax example
+
+Let's say we wanted to have a perl subroutine process multiple
+values from the HTML page, and similarly return multiple values
+back to distinct divs on the page.  This is easy to do, and
+requires no changes to the perl code - you just create it as you
+would any perl subroutine that works with multiple input values
+and returns multiple values.  The significant change happens in
+the event handler javascript in the HTML...
+
+  onClick="exported_func(['input1','input2'],['result1','result2']);"
+
+Here we associate our javascript function ("exported_func") with
+two HTML element ids ('input1','input2'), and also send in two
+HTML element ids to place the results in ('result1','result2').
+
+=item 3 Sending Perl Subroutine Output to a Javascript function
+
+Occassionally, you might want to have a custom javascript function
+process the returned information from your Perl subroutine.
+This is possible, and the only requierment is that you change
+your event handler code...
+
+  onClick="exported_func(['input1'],[js_process_func]);"
+
+In this scenario, C<js_process_func> is a javascript function you
+write to take the returned value from your Perl subroutine and
+process the results.  I<Note that a javascript function is not
+quoted -- if it were, then CGI::Ajax would look for a HTML element
+with that id.>  Beware that with this usage, B<you are responsible
+for distributing the results to the appropriate place on the
+HTML page>.  If the exported Perl subroutine returns, e.g. 2
+values, then C<js_process_func> would need to process the input
+by working through an array, or using the javascript Function
+C<arguments> object.
+
+  function js_process_func() {
+    var input1 = arguments[0]
+    var input2 = arguments[1];
+    // do something and return results, or set HTML divs using
+    // innerHTML
+    document.getElementById('outputdiv').innerHTML = input1;
+  }
+
+=item 4 URL/Outside Script CGI::Ajax example
+
+There are times when you may want a different script to
+return content to your page.  This could be because you have
+an existing script already written to perform a particular
+task, or you want to distribute a part of your application to another
+script.  This can be accomplished in L<CGI::Ajax> by using a URL in
+place of a locally-defined Perl subroutine.  In this usage,
+you alter you creation of the L<CGI::Ajax> object to link an
+exported javascript function name to a local URL instead of
+a coderef or a subroutine.
+
+  my $url = 'scripts/other_script.pl';
+  my $pjx = new CGI::Ajax( 'external' => $url );
+
+This will work as before in terms of how it is called from you
+event handler:
+
+  onClick="external(['input1','input2'],['resultdiv']);"
+
+The other_script.pl will get the values via a CGI object and
+accessing the 'args' key.  The values of the B<'args'> key will
+be an array of everything that was sent into the script.
+
+  my @input = $cgi->params('args');
+  $input[0]; # contains first argument
+  $input[1]; # contains second argument, etc...
+
+This is good, but what if you need to send in arguments to the
+other script which are directly from the calling Perl script,
+i.e. you want a calling Perl script's variable to be sent, not
+the value from an HTML element on the page?  This is possible
+using the following syntax:
+
+  onClick="exported_func(['args__$input1','args__$input2'],
+                         ['resultdiv']);"
+
+Similary, if the external script required a constant as input
+(e.g.  C<script.pl?args=42>, you would use this syntax:
+
+  onClick="exported_func(['args__42'],['resultdiv']);"
+
+In both of the above examples, the result from the external
+script would get placed into the I<resultdiv> element on our
+(the calling script's) page.
+
+If you are sending more than one argument from an external perl
+script back to a javascript function, you will need to split the
+string (AJAX applications communicate in strings only) on something.
+Internally, we use '__pjx__', and this string is checked for.  If
+found, L<CGI::Ajax> will automatically split it.  However, if you
+don't want to use '__pjx__', you can do it yourself:
+
+For example, from your Perl script, you would...
+
+	return("A|B"); # join with "|"
+
+and then in the javascript function you would have something like...
+
+	process_func() {
+		var arr = arguments[0].split("|");
+		// arr[0] eq 'A'
+		// arr[1] eq 'B'
+	}
+
+In order to rename parameters, in case the outside script needs
+specifically-named parameters and not CGI::Ajax' I<'args'> default
+parameter name, change your event handler associated with an HTML
+event like this
+
+  onClick="exported_func(['myname__$input1','myparam__$input2'],
+                         ['resultdiv']);"
+
+The URL generated would look like this...
+
+C<script.pl?myname=input1&myparam=input2>
+
+You would then retrieve the input in the outside script with this...
+
+  my $p1 = $cgi->params('myname');
+  my $p1 = $cgi->params('myparam');
+
+Finally, what if we need to get a value from our HTML page and we
+want to send that value to an outside script but the outside script
+requires a named parameter different from I<'args'>?  You can
+accomplish this with L<CGI::Ajax> using the getVal() javascript
+method (which returns an array, thus the C<getVal()[0]> notation):
+
+  onClick="exported_func(['myparam__' + getVal('div_id')[0]],
+                         ['resultdiv']);"
+
+This will get the value of our HTML element with and
+I<id> of I<div_id>, and submit it to the url attached to
+I<myparam__>.  So if our exported handler referred to a URI
+called I<script/scr.pl>, and the element on our HTML page called
+I<div_id> contained the number '42', then the URL would look
+like this C<script/scr.pl?myparam=42>.  The result from this
+outside URL would get placed back into our HTML page in the
+element I<resultdiv>.  See the example script that comes with
+the distribution called I<pjx_url.pl> and its associated outside
+script I<convert_degrees.pl> for a working example.
+
+B<N.B.> These examples show the use of outside scripts which
+are other perl scripts - I<but you are not limited to Perl>!
+The outside script could just as easily have been PHP or any other
+CGI script, as long as the return from the other script is just
+the result, and not addition HTML code (like FORM elements, etc).
+
+=back
+
+=head2 GET versus POST
+
+Note that all the examples so far have used the following syntax:
+
+  onClick="exported_func(['input1'],['result1']);"
+
+There is an optional third argument to a L<CGI::Ajax> exported
+function that allows change the submit method.  The above event could
+also have been coded like this...
+
+  onClick="exported_func(['input1'],['result1'], 'GET');"
+
+By default, L<CGI::Ajax> sends a I<'GET'> request.  If you need it,
+for example your URL is getting way too long, you can easily switch
+to a I<'POST'> request with this syntax...
+
+  onClick="exported_func(['input1'],['result1'], 'POST');"
+
+I<('POST' and 'post' are supported)>
+
+=head2 Page Caching
+
+We have implemented a method to prevent page cacheing from undermining
+the AJAX methods in a page.  If you send in an input argument to a
+L<CGI::Ajax>-exported function called 'NO_CACHE', the a special
+parameter will get attached to the end or your url with a random
+number in it.  This will prevent a browser from caching your request.
+
+  onClick="exported_func(['input1','NO_CACHE'],['result1']);"
+
+The extra param is called pjxrand, and won't interfere with the order
+of processing for the rest of your parameters.
+
+=head1 METHODS
+
+=cut
+
+################################### main pod documentation end ##
+
+######################################################
+## METHODS - public                                 ##
+######################################################
+
+=over 4
+
+=item build_html()
+
+    Purpose: Associates a cgi obj ($cgi) with pjx object, inserts
+             javascript into <HEAD></HEAD> element and constructs
+             the page, or part of the page.  AJAX applications
+             are designed to update only the section of the
+             page that needs it - the whole page doesn't have
+             to be redrawn.  L<CGI::Ajax> applications use the
+             build_html() method to take care of this: if the CGI
+             parameter C<fname> exists, then the return from the
+             L<CGI::Ajax>-exported function is sent to the page.
+             Otherwise, the entire page is sent, since without
+             an C<fname> param, this has to be the first time
+             the page is being built.
+
+  Arguments: The CGI object, and either a coderef, or a string
+             containing html.  Optionally, you can send in a third
+             parameter containing information that will get passed
+             directly to the CGI object header() call.
+    Returns: html or updated html (including the header)
+  Called By: originating cgi script
+
+=cut
+sub build_html {
+  my ( $self, $cgi, $html_source, $cgi_header_extra ) = @_;
+
+  if ( ref( $cgi ) =~ /CGI.*/ ) {
+    if ( $self->DEBUG() ) {
+      print STDERR "CGI::Ajax->build_html: CGI* object was received\n";
+    }
+    $self->cgi( $cgi ); # associate the cgi obj with the CGI::Ajax object
+  }
+
+  if ( defined $cgi_header_extra ) {
+    if ( $self->DEBUG() ) {
+      print STDERR "CGI::Ajax->build_html: got extra cgi header info\n";
+      if ( ref($cgi_header_extra) eq "HASH" ) {
+        foreach my $k ( keys %$cgi_header_extra ) {
+          print STDERR "\t$k => ", $cgi_header_extra->{$k}, "\n";
+        }
+      } else {
+        print STDERR "\t$cgi_header_extra\n";
+      }
+    }
+    $self->cgi_header_extra( $cgi_header_extra ); 
+  }
+
+  #check if "fname" was defined in the CGI object
+  if ( defined $self->cgi()->param("fname") ) {
+    # it was, so just return the html from the handled request
+    return ( $self->handle_request() );
+  }
+  else {
+    # start with the minimum, a http header line and any extra cgi
+    # header params sent in
+    my $html = "";
+    if ( $self->cgi()->can('header') ) {
+      #$html .= $self->cgi()->header();
+      $html .= $self->cgi()->header( $self->cgi_header_extra() );
+    }
+    else {
+      # don't have an object with a "header()" method, so just create
+      # a mimimal one
+      $html .= "Content-Type: text/html;";
+      $html .= $self->cgi_header_extra();
+      $html .= "\n\n";
+    }
+
+    # check if the user sent in a coderef for generating the html,
+    # or the actual html
+    if ( ref($html_source) eq "CODE" ) {
+      if ( $self->DEBUG() ) {
+        print STDERR "CGI::Ajax->build_html: html_source is a CODEREF\n";
+      }
+      eval { $html .= &$html_source };
+      if ($@) {
+        # there was a problem evaluating the html-generating function
+        # that was sent in, so generate an error page
+        if ( $self->cgi()->can('header') ) {
+          $html = $self->cgi()->header( $self->cgi_header_extra() );
+        }
+        else {
+          # don't have an object with a "header()" method, so just create
+          # a mimimal one
+          $html = "Content-Type: text/html;";
+          $html .= $self->cgi_header_extra();
+          $html .= "\n\n";
+        }
+        $html .= qq!<html><head><title></title></head><body><h2>Problems</h2> with
+          the html-generating function sent to CGI::Ajax
+          object</body></html>!;
+        return $html;
+      }
+      $self->html($html);    # no problems, so set html
+    }
+    else {
+      # user must have sent in raw html, so add it
+      if ( $self->DEBUG() ) {
+        print STDERR "CGI::Ajax->build_html: html_source is HTML\n";
+      }
+      $self->html( $html . $html_source );
+    }
+
+    # now modify the html to insert the javascript
+    $self->insert_js_in_head();
+  }
+  return $self->html();
+}
+
+=item show_javascript()
+
+    Purpose: builds the text of all the javascript that needs to be
+             inserted into the calling scripts html <head> section
+  Arguments:
+    Returns: javascript text
+  Called By: originating web script
+       Note: This method is also overridden so when you just print
+             a CGI::Ajax object it will output all the javascript needed
+             for the web page.
+
+=cut
+
+sub show_javascript {
+  my ($self) = @_;
+  my $rv = $self->show_common_js();    # show the common js
+
+  # build the js for each perl function you want exported to js
+  foreach my $func ( keys %{ $self->coderef_list() }, keys %{ $self->url_list() } ) {
+    $rv .= $self->make_function($func);
+  }
+  # wrap up the return in a CDATA structure for XML compatibility
+  # (thanks Thos Davis)
+  $rv = "\n" . '//<![CDATA[' . "\n" . $rv . "\n" . '//]]>' . "\n";
+  $rv = '<script type="text/javascript">' . $rv . '</script>';
+  return $rv;
+}
+
+## new
+sub new {
+  my ($class) = shift;
+  my $self = bless ({}, ref ($class) || $class);
+#  $self->SUPER::new();
+  $self->JSDEBUG(0); # turn javascript debugging off (if on,
+                     # extra info will be added to the web page output
+                     # if set to 1, then the core js will get
+                     # compressed, but the user-defined functions will
+                     # not be compressed.  If set to 2 (or anything
+                     # greater than 1 or 0), then none of the
+                     # javascript will get compressed.
+                     #
+  $self->DEBUG(0);   # turn debugging off (if on, check web logs)
+
+  #accessorized attributes
+  $self->coderef_list({});
+  $self->url_list({});
+  #$self->html("");
+  #$self->cgi();
+  #$self->cgi_header_extra(""); # set cgi_header_extra to an empty string
+
+  # setup a default endcoding; if you need support for international
+	# charsets, use 'escape' instead of encodeURIComponent.  Due to the
+	# number of browser problems users report about scripts with a default of
+	# encodeURIComponent, we are setting the default to 'escape'
+  $self->js_encode_function('escape');
+
+  if ( @_ < 2 ) {
+    die "incorrect usage: must have fn=>code pairs in new\n";
+  }
+
+  while ( @_ ) {
+    my($function_name,$code) = splice( @_, 0, 2 );
+    if ( ref( $code ) eq "CODE" ) {
+      if ( $self->DEBUG() ) {
+        print STDERR "name = $function_name, code = $code\n";
+      }
+      # add the name/code to hash
+      $self->coderef_list()->{ $function_name } = $code;
+    } elsif ( ref($code) ) {
+      die "Unsuported code block/url\n";
+    } else {
+      if ( $self->DEBUG() ) {
+        print STDERR "Setting function $function_name to url $code\n";
+      }
+      # if it's a url, it is added here
+      $self->url_list()->{ $function_name } = $code;
+    }
+  }
+  return ($self);
+}
+
+######################################################
+## METHODS - private                                ##
+######################################################
+
+# sub cgiobj(), cgi()
+#
+#    Purpose: accessor method to associate a CGI object with our
+#             CGI::Ajax object
+#  Arguments: a CGI object
+#    Returns: CGI::Ajax objects cgi object
+#  Called By: originating cgi script, or build_html()
+#
+sub cgiobj {
+  my $self = shift;
+  # see if any values were sent in...
+  if ( @_ ) {
+    my $cgi = shift;
+    # add support for other CGI::* modules This requires that your web server
+    # be configured properly.  I can't test anything but a mod_perl2
+    # setup, so this prevents me from testing CGI::Lite,CGI::Simple, etc.
+    if ( ref($cgi) =~ /CGI.*/ ) {
+      if ( $self->DEBUG() ) {
+				print STDERR "cgiobj() received a CGI-like object ($cgi)\n";
+      }
+      $self->{'cgi'} = $cgi;
+    } else {
+      die "CGI::Ajax -- Can't set internal CGI object to a non-CGI object ($cgi)\n";
+    }
+  }
+  # return the object
+  return( $self->{'cgi'} );
+}
+
+sub cgi {
+  my $self = shift;
+  if ( @_ ) {
+    return( $self->cgiobj( @_ ) );
+  } else {
+    return( $self->cgiobj() );
+  }
+}
+
+## # sub cgi_header_extra
+## #
+## #    Purpose: accessor method to associate CGI header information
+## #             with the CGI::Ajax object
+## #  Arguments: a hashref with key=>value pairs that get handed off to
+## #             the CGI object's header() method
+## #    Returns: hashref of extra cgi header params
+## #  Called By: originating cgi script, or build_html()
+## 
+## sub cgi_header_extra {
+##   my $self = shift;
+##   if ( @_ ) {
+##     $self->{'cgi_header_extra'} = shift;
+##   }
+##   return( $self->{'cgi_header_extra'} );
+## }
+
+# sub create_js_setRequestHeader
+#
+#    Purpose: create text of the header for the javascript side,
+#             xmlhttprequest call
+#  Arguments: none
+#    Returns: text of header to pass to xmlhttpreq call so it will
+#             match whatever was setup for the main web-page
+#  Called By: originating cgi script, or build_html()
+#
+
+sub create_js_setRequestHeader {
+  my $self = shift;
+  my $cgi_header_extra = $self->cgi_header_extra();
+  my $js_header_string = q{r.setRequestHeader("};
+	#$js_header_string .= $self->cgi()->header( $cgi_header_extra );
+	$js_header_string .= $self->cgi()->header();
+  $js_header_string .= q{");};
+	#if ( ref $cgi_header_extra eq "HASH" ) {
+	#	foreach my $k ( keys(%$cgi_header_extra) ) {
+	#		$js_header_string .= $self->cgi()->header($cgi_headers) 
+	#	}
+	#} else {
+  #print STDERR  $self->cgi()->header($cgi_headers) ;
+  
+	if ( $self->DEBUG() ) {
+		print STDERR "js_header_string is (", $js_header_string, ")\n";
+	}
+
+  return($js_header_string);
+}
+
+# sub show_common_js()
+#
+#    Purpose: create text of the javascript needed to interface with
+#             the perl functions
+#  Arguments: none
+#    Returns: text of common javascript subroutine, 'do_http_request'
+#  Called By: originating cgi script, or build_html()
+#
+
+sub show_common_js {
+  my $self = shift;
+  my $encodefn = $self->js_encode_function();
+  my $decodefn = $encodefn;
+  $decodefn =~ s/^(en)/de/;
+  $decodefn =~ s/^(esc)/unesc/;
+  #my $request_header_str = $self->create_js_setRequestHeader();
+  my $request_header_str = "";
+  my $rv = <<EOT;
+var ajax = [];
+function pjx(args,fname,method) {
+  this.target=args[1];
+  this.args=args[0];
+  method=(method)?method:'GET';
+  if(method=='post'){method='POST';}
+  this.method = method;
+  this.r=ghr();
+  this.url = this.getURL(fname);
+}
+
+function formDump(){
+  var all = [];
+  var fL = document.forms.length;
+  for(var f = 0;f<fL;f++){
+    var els = document.forms[f].elements;
+    for(var e in els){
+      var tmp = els[e].id || els[e].name;
+      if(typeof tmp != 'string'){continue;}
+      if(tmp){ all[all.length]=tmp}
+    }
+  }
+  return all;
+}
+function getVal(id) {
+  if (id.constructor == Function ) { return id(); }
+  if (typeof(id)!= 'string') { return id; }
+  var element = document.getElementById(id) || document.forms[0].elements[id];
+  if(!element){
+     alert('ERROR: Cant find HTML element with id or name: ' +
+     id+'. Check that an element with name or id='+id+' exists');
+     return 0;
+  }
+   if(element.type == 'select-one') { return element[element.selectedIndex].value } 
+  if (element.type == 'select-multiple') {
+  var ans = [];
+  var k =0;
+    for (var i=0;i<element.length;i++) {
+      if (element[i].selected || element[i].checked ) {
+        ans[k++]=element[i].value;
+      }
+    }
+    return ans;
+  }
+    
+  if(element.type == 'radio' || element.type == 'checkbox'){
+    var ans =[];
+    var elms = document.getElementsByTagName('input');
+    var endk = elms.length;
+    var i =0;
+    for(var k=0;k<endk;k++){
+      if(elms[k].type== element.type && elms[k].checked && elms[k].id==id){
+        ans[i++]=elms[k].value;
+      }
+    }
+    return ans;
+  }
+  if( element.value == undefined ){
+    return element.innerHTML;
+  }else{
+    return element.value;
+  }
+}
+function fnsplit(arg) {
+  var url="";
+  if(arg=='NO_CACHE'){return '&pjxrand='+Math.random()}
+  if (arg.indexOf('__') != -1) {
+    arga = arg.split(/__/);
+    url += '&' + arga[0] +'='+ $encodefn(arga[1]);
+  } else {
+    var res = getVal(arg) || '';
+    if(res.constructor != Array){ res = [res] }
+    for(var i=0;i<res.length;i++) {
+      url += '&args=' + $encodefn(res[i]) + '&' + arg + '=' + $encodefn(res[i]);
+    }
+  }
+  return url;
+}
+
+pjx.prototype =  {
+  send2perl : function(){
+    var r = this.r;
+    var dt = this.target;
+    this.pjxInitialized(dt);
+    var url=this.url;
+    var postdata;
+    if(this.method=="POST"){
+      var idx=url.indexOf('?');
+      postdata = url.substr(idx+1);
+      url = url.substr(0,idx);
+    }
+    r.open(this.method,url,true);
+    $request_header_str;
+    if(this.method=="POST"){
+      r.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+      r.send(postdata);
+    }
+    if(this.method=="GET"){
+      r.send(null);
+    }
+    r.onreadystatechange = handleReturn;
+ },
+ pjxInitialized : function(){},
+ pjxCompleted : function(){},
+ readyState4 : function(){
+    var rsp = $decodefn(this.r.responseText);  /* the response from perl */
+    var splitval = '__pjx__';  /* to split text */
+    /* fix IE problems with undef values in an Array getting squashed*/
+    rsp = rsp.replace(splitval+splitval+'g',splitval+" "+splitval);
+    var data = rsp.split(splitval);  
+    dt = this.target;
+    if (dt.constructor != Array) { dt=[dt]; }
+    if (data.constructor != Array) { data=[data]; }
+    if (typeof(dt[0])!='function') {
+      for ( var i=0; i<dt.length; i++ ) {
+        var div = document.getElementById(dt[i]);
+        if (div.type =='text' || div.type=='textarea' || div.type=='hidden' ) {
+          div.value=data[i];
+        } else{
+          div.innerHTML = data[i];
+        }
+      }
+    } else if (typeof(dt[0])=='function') {
+       dt[0].apply(this,data);
+    }
+    this.pjxCompleted(dt);
+ },
+
+  getURL : function(fname) {
+      var args = this.args;
+      var url= 'fname=' + fname;
+      for (var i=0;i<args.length;i++) {
+        url=url + args[i];
+      }
+      return url;
+  }
+};
+
+handleReturn = function() {
+  for( var k=0; k<ajax.length; k++ ) {
+    if (ajax[k].r==null) { ajax.splice(k--,1); continue; }
+    if ( ajax[k].r.readyState== 4) { 
+      ajax[k].readyState4();
+      ajax.splice(k--,1);
+      continue;
+    }
+  }
+};
+
+var ghr=getghr();
+function getghr(){
+    if(typeof XMLHttpRequest != "undefined")
+    {
+        return function(){return new XMLHttpRequest();}
+    }
+    var msv= ["Msxml2.XMLHTTP.7.0", "Msxml2.XMLHTTP.6.0",
+    "Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0",
+    "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"];
+    for(var j=0;j<=msv.length;j++){
+        try
+        {
+            A = new ActiveXObject(msv[j]);
+            if(A){ 
+              return function(){return new ActiveXObject(msv[j]);}
+            }
+        }
+        catch(e) { }
+     }
+     return false;
+}
+
+
+function jsdebug(){
+    var tmp = document.getElementById('pjxdebugrequest').innerHTML = "<br><pre>";
+    for( var i=0; i < ajax.length; i++ ) {
+      tmp += '<a href= '+ ajax[i].url +' target=_blank>' +
+      decodeURI(ajax[i].url) + ' </a><br>';
+    }
+    document.getElementById('pjxdebugrequest').innerHTML = tmp + "</pre>";
+}
+
+EOT
+
+  if ( $self->JSDEBUG() <= 1 ) {
+    $rv = $self->compress_js($rv);
+  }
+
+  return($rv);
+}
+
+# sub compress_js()
+#
+#    Purpose: searches the javascript for newlines and spaces and
+#             removes them (if a newline) or shrinks them to a single (if
+#             space).
+#  Arguments: javascript to compress
+#    Returns: compressed js string
+#  Called By: show_common_js(),
+#
+
+sub compress_js {
+  my($self,$js) = @_;
+  return if not defined $js;
+  return if $js eq "";
+  $js =~ s/\n//g;   # drop newlines
+  $js =~ s/\s+/ /g; # replace 1+ spaces with just one space
+  return $js;
+}
+
+
+# sub insert_js_in_head()
+#
+#    Purpose: searches the html value in the CGI::Ajax object and inserts
+#             the ajax javascript code in the <script></script> section,
+#             or if no such section exists, then it creates it.  If
+#             JSDEBUG is set, then an extra div will be added and the
+#             url wil be desplayed as a link
+#  Arguments: none
+#    Returns: none
+#  Called By: build_html()
+#
+
+sub insert_js_in_head{
+  my $self = shift;
+  my $mhtml = $self->html();
+  my $newhtml;
+  my @shtml;
+  my $js = $self->show_javascript();
+
+  if ( $self->JSDEBUG() ) {
+    my $showurl=qq!<br/><div id='pjxdebugrequest'></div><br/>!;
+    # find the terminal </body> so we can insert just before it
+    my @splith = $mhtml =~ /(.*)(<\s*\/\s*body\s*>)(.*)/is;
+    $mhtml = $splith[0].$showurl.$splith[1].$splith[2];
+  }
+
+  # see if we can match on <head>
+  @shtml= $mhtml =~ /(.*)(<\s*head\s*>)(.*)/is;
+  if ( @shtml ) {
+    # yes, there's already a <head></head>, so let's insert inside it,
+    # at the beginning
+    $newhtml = $shtml[0].$shtml[1].$js.$shtml[2];
+  } elsif( @shtml= $mhtml =~ /(.*)(<\s*html.*?>)(.*)/is){
+    # there's no <head>, so look for the <html> tag, and insert out
+    # javascript inside that tag
+    $newhtml = $shtml[0].$shtml[1].$js.$shtml[2];
+  } else {
+    $newhtml .= "<html><head>";
+    $newhtml .= $js;
+    $newhtml .= "</head><body>";
+    $newhtml .= "No head/html tags, nowhere to insert.  Returning javascript anyway<br>";
+    $newhtml .= "</body></html>";
+  }
+  $self->html($newhtml);
+  return;
+}
+
+# sub handle_request()
+#
+#    Purpose: makes sure a fname function name was set in the CGI
+#             object, and then tries to eval the function with
+#             parameters sent in on args
+#  Arguments: none
+#    Returns: the result of the perl subroutine, as text; if multiple
+#             arguments are sent back from the defined, exported perl
+#             method, then join then with a connector (__pjx__).
+#  Called By: build_html()
+#
+
+sub handle_request {
+  my ($self) = shift;
+
+  my $result; # $result takes the output of the function, if it's an
+              # array split on __pjx__
+  my @other = (); # array for catching extra parameters
+
+  # we need to access "fname" in the form from the web page, so make
+  # sure there is a CGI object defined
+  return undef unless defined $self->cgi();
+
+  my $rv = "";
+  if ( $self->cgi()->can('header') ) {
+    $rv = $self->cgi()->header( $self->cgi_header_extra() );
+  } else {
+    # don't have an object with a "header()" method, so just create
+    # a mimimal one
+    $rv = "Content-Type: text/html;";
+    # TODO: 
+    $rv .= $self->cgi_header_extra();
+    $rv .= "\n\n";
+  }
+
+  # get the name of the function
+  my $func_name = $self->cgi()->param("fname");
+
+  # check if the function name was created
+  if ( defined $self->coderef_list()->{$func_name} ) {
+    my $code = $self->coderef_list()->{$func_name};
+
+    # eval the code from the coderef, and append the output to $rv
+    if ( ref($code) eq "CODE" ) {
+      eval { ($result, @other) = $code->( $self->cgi()->param("args") ) };
+
+      if ($@) {
+        # see if the eval caused and error and report it
+        # Should we be more severe and die?
+        if ( $self->DEBUG() ) {
+          print STDERR "Problem with code: $@\n";
+        }
+      }
+
+      if( @other ) {
+          $rv .= join( "__pjx__", ($result, @other) );
+          if ( $self->DEBUG() ) {
+            print STDERR "rv = $rv\n";
+          }
+      } else {
+        if ( defined $result ) {
+          $rv .= $result;
+        }
+      }
+
+    } # end if ref = CODE
+  } else {
+    # # problems with the URL, return a CGI rrror
+    print STDERR "POSSIBLE SECURITY INCIDENT! Browser from ", $self->cgi()->remote_addr();
+    print STDERR "\trequested URL: ", $self->cgi()->url();
+    print STDERR "\tfname request: ", $self->cgi()->param('fname');
+    print STDERR " -- returning Bad Request status 400\n";
+    if ( $self->cgi()->can('header') ) {
+      return($self->cgi()->header( -status=>'400' ));
+    } else {
+      # don't have an object with a "header()" method, so just create
+      # a mimimal one with 400 error
+      $rv = "Status: 400\nContent-Type: text/html;\n\n";
+    }
+  }
+  return $rv;
+}
+
+
+# sub make_function()
+#
+#    Purpose: creates the javascript wrapper for the underlying perl
+#             subroutine
+#  Arguments: CGI object from web form, and the name of the perl
+#             function to export to javascript, or a url if the
+#             function name refers to another cgi script
+#    Returns: text of the javascript-wrapped perl subroutine
+#  Called By: show_javascript; called once for each registered perl
+#             subroutine
+#
+
+sub make_function {
+  my ($self, $func_name ) = @_;
+  return("") if not defined $func_name;
+  return("") if $func_name eq "";
+  my $rv = "";
+  my $script = $0;
+  $script =~ s/.*[\/|\\](.+)$/$1/;
+  my $outside_url = $self->url_list()->{ $func_name };
+  my $url = defined $outside_url ? $outside_url : $script;
+  if ($url =~ /\?/) { $url.='&'; } else {$url.='?'}
+  $url = "'$url'";
+  my $jsdebug = "";
+  if ( $self->JSDEBUG()) {
+    $jsdebug = "jsdebug()";
+  }
+
+  #create the javascript text
+  $rv .= <<EOT;
+function $func_name() {
+  var args = $func_name.arguments;
+  for( var i=0; i<args[0].length;i++ ) {
+    args[0][i] = fnsplit(args[0][i]);
+  }
+  var l = ajax.length;
+  ajax[l]= new pjx(args,"$func_name",args[2]);
+  ajax[l].url = $url + ajax[l].url;
+  ajax[l].send2perl();
+  $jsdebug;
+}
+EOT
+
+  if ( not $self->JSDEBUG() ) {
+    $rv = $self->compress_js($rv);
+  }
+  return $rv;
+}
+
+=item register()
+
+    Purpose: adds a function name and a code ref to the global coderef
+             hash, after the original object was created
+  Arguments: function name, code reference
+    Returns: none
+  Called By: originating web script
+
+=cut
+
+sub register {
+  my ( $self, $fn, $coderef ) = @_;
+  # coderef_list() is a Class::Accessor function
+  # url_list() is a Class::Accessor function
+  if ( ref( $coderef ) eq "CODE" ) {
+    $self->coderef_list()->{$fn} = $coderef;
+  } elsif ( ref($coderef) ) {
+    die "Unsupported code/url type - error\n";
+  } else {
+    $self->url_list()->{$fn} = $coderef;
+  }
+}
+
+=item JSDEBUG()
+
+    Purpose: Show the AJAX URL that is being generated, and stop
+             compression of the generated javascript, both of which can aid
+             during debugging.  If set to 1, then the core js will get
+             compressed, but the user-defined functions will not be
+             compressed.  If set to 2 (or anything greater than 1 or 0), 
+             then none of the javascript will get compressed.
+
+  Arguments: JSDEBUG(0); # turn javascript debugging off
+             JSDEBUG(1); # turn javascript debugging on, some javascript compression
+             JSDEBUG(2); # turn javascript debugging on, no javascript compresstion
+    Returns: prints a link to the url that is being generated automatically by
+             the Ajax object. this is VERY useful for seeing what
+             CGI::Ajax is doing. Following the link, will show a page
+             with the output that the page is generating.
+             
+  Called By: $pjx->JSDEBUG(1) # where $pjx is a CGI::Ajax object;
+
+=item DEBUG()
+
+    Purpose: Show debugging information in web server logs
+  Arguments: DEBUG(0); # turn debugging off (default)
+             DEBUG(1); # turn debugging on
+    Returns: prints debugging information to the web server logs using
+             STDERR
+  Called By: $pjx->DEBUG(1) # where $pjx is a CGI::Ajax object;
+
+=back
+
+=head1 BUGS
+
+Follow any bugs at our homepage....
+
+  http://www.perljax.us
+
+=head1 SUPPORT
+
+Check out the news/discussion/bugs lists at our homepage:
+
+  http://www.perljax.us
+
+=head1 AUTHORS
+
+  Brian C. Thomas     Brent Pedersen
+  CPAN ID: BCT
+  bct.x42@gmail.com   bpederse@gmail.com
+
+=head1 A NOTE ABOUT THE MODULE NAME
+
+This module was initiated using the name "Perljax", but then
+registered with CPAN under the WWW group "CGI::", and so became
+"CGI::Perljax".  Upon further deliberation, we decided to change it's
+name to L<CGI::Ajax>.
+
+=head1 COPYRIGHT
+
+This program is free software; you can redistribute
+it and/or modify it under the same terms as Perl itself.
+
+The full text of the license can be found in the
+LICENSE file included with this module.
+
+=head1 SEE ALSO
+
+L<Data::Javascript>
+L<CGI>
+L<Class::Accessor>
+
+=cut
+
+1;
+__END__
diff -ruN 4.0K-4b/library/additions/HTTP/BrowserDetect.pm 5.0.000/library/additions/HTTP/BrowserDetect.pm
--- 4.0K-4b/library/additions/HTTP/BrowserDetect.pm	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/additions/HTTP/BrowserDetect.pm	2006-10-31 09:40:27.000000000 -0600
@@ -1,23 +1,22 @@
 package HTTP::BrowserDetect;
 
 use strict;
-use vars qw($VERSION $REVISION @ISA @EXPORT @EXPORT_OK @ALL_TESTS);
+use vars qw($VERSION @ISA @EXPORT @EXPORT_OK @ALL_TESTS);
 require Exporter;
 
 @ISA	   = qw(Exporter);
 @EXPORT	   = qw();
 @EXPORT_OK = qw();
-$REVISION  = '$Id: BrowserDetect.pm,v 1.4 2001/01/31 17:44:27 lsemel Exp $';
-$VERSION   = '0.97';
+$VERSION   = '0.98';
 
 # Operating Systems
-push @ALL_TESTS,(qw(win16 win3x win31 win95 win98 winnt windows win32 win2k winme mac mac68k macppc os2 unix sun sun4 sun5 suni86 irix irix5 irix6 hpux hpux9 hpux10 aix aix1 aix2 aix3 aix4 linux sco unixware mpras reliant dec sinix freebsd bsd vms x11 amiga));
+push @ALL_TESTS,(qw(win16 win3x win31 win95 win98 winnt windows win32 win2k winxp winme dotnet mac macosx mac68k macppc os2 unix sun sun4 sun5 suni86 irix irix5 irix6 hpux hpux9 hpux10 aix aix1 aix2 aix3 aix4 linux sco unixware mpras reliant dec sinix freebsd bsd vms x11 amiga));
 
 # Devices
-push @ALL_TESTS,(qw(palm audrey iopener wap));
+push @ALL_TESTS,(qw(palm audrey iopener wap blackberry));
 
 # Browsers
-push @ALL_TESTS,(qw(mosaic netscape nav2 nav3 nav4 nav4up nav45 nav45up nav6 nav6up navgold ie ie3 ie4 ie4up ie5 ie5up ie55 ie55up opera opera3 opera4 opera5 lynx aol aol3 aol4 aol5 aol6 neoplanet neoplanet2 avantgo emacs gecko));
+push @ALL_TESTS,(qw(mosaic netscape nav2 nav3 nav4 nav4up nav45 nav45up nav6 nav6up navgold firefox safari ie ie3 ie4 ie4up ie5 ie5up ie55 ie55up ie6 opera opera3 opera4 opera5 opera6 opera7 lynx links aol aol3 aol4 aol5 aol6 neoplanet neoplanet2 avantgo emacs mozilla gecko));
 
 # Robots
 push @ALL_TESTS,(qw(wget getright robot yahoo altavista lycos infoseek lwp webcrawler linkexchange slurp webtv staroffice lotusnotes konqueror icab google java));
@@ -83,7 +82,22 @@
                                           [\d\.]*		# Throw away remaining numbers and dots
                                           ( [^\s]* )		# Beta version string is up to next space
                                         /x);
-
+     
+  # Firefox version
+  
+  if ($ua =~ /(firefox|firebird|phoenix)/i) {
+      (undef,$major, $minor)    = ($ua =~ / 
+				    (firefox|firebird|phoenix)
+				    \/
+				    ( [^\.]* )			# Major version number is everything before first dot
+				    \.			    	# The first dot
+				    ( [\d]* )			# Minor version nnumber is digits after first dot
+				    /x);                    
+  }
+ 
+  
+  
+  # IE version                               
   if (index($ua,"compatible") !=-1) {
       ($major, $minor, $beta)    = ($ua =~ / 
 				    compatible;       
@@ -99,7 +113,6 @@
 				    ;
 				    /x);
 
-
   }
 
   $minor = 0+".$minor"; 
@@ -107,12 +120,53 @@
   $self->{tests} = {};
   my $tests = $self->{tests};
 
-  # Netscape browsers
+  # Mozilla browsers 
   
-  $tests->{NETSCAPE}  = (index($ua,"mozilla") != -1 && 
+  $tests->{GECKO}     = (index($ua,"gecko") != -1);
+  $tests->{FIREFOX}   = (index($ua,"firefox") != -1) ||
+                        (index($ua,"firebird") != -1) ||
+                        (index($ua,"phoenix") != -1);
+                        
+  $tests->{SAFARI}    = (index($ua,"safari") != -1) || (index($ua,"applewebkit") != -1);
+  
+  # Safari Version
+  if ($tests->{SAFARI}) {
+      my ($safari_build, $safari_minor);
+      ($safari_build,$safari_minor)    = ($ua =~ / 
+				    safari
+				    \/
+				    ( [^\.]* )			# Major version number is everything before first dot
+				    (?:			    	# The first dot
+				    ( [\d]* ))?			# Minor version nnumber is digits after first dot
+				    /x);                    
+    $major = int($safari_build / 100);
+    $minor = int($safari_build % 100) / 100;
+    $beta = $safari_minor;    
+    #print "major=$major minor=$minor beta=$beta\n";
+    
+  }
+  
+ # Gecko-powered Netscape (i.e. Mozilla) versions
+ $tests->{NETSCAPE}  = (!$tests->{FIREFOX} && !$tests->{SAFARI} && index($ua,"mozilla") != -1 && 
 			 index($ua,"spoofer") == -1 && index($ua,"compatible") == -1 &&
 			 index($ua,"opera") == -1 && index($ua,"webtv") == -1 && 
 			 index($ua,"hotjava") == -1);
+ 
+ 
+  if ($tests->{GECKO} && $tests->{NETSCAPE} && index($ua,"netscape")!=-1) {
+      ($major, $minor, $beta)    = ($ua =~ / 
+				    netscape\/  
+				    ( [^\.]* )			# Major version number is everything before first dot
+				    \.				# The first dot
+				    ( [\d]* )			# Minor version nnumber is digits after first dot
+                    ( [^\s]* )
+                   /x);
+     $minor = 0+".$minor"; 
+    #print "major=$major minor=$minor beta=$beta\n";
+  }
+
+  
+  # Netscape browsers
   $tests->{NAV2}      = ($tests->{NETSCAPE} && $major == 2);
   $tests->{NAV3}      = ($tests->{NETSCAPE} && $major == 3);
   $tests->{NAV4}      = ($tests->{NETSCAPE} && $major == 4);
@@ -122,8 +176,9 @@
   $tests->{NAVGOLD}   = (index($beta,"gold") != -1);
   $tests->{NAV6}      = ($tests->{NETSCAPE} && $major == 5); # go figure
   $tests->{NAV6UP}    = ($tests->{NETSCAPE} && $major >= 5);
-  $tests->{GECKO}     = (index($ua,"gecko") != -1);
   
+  $tests->{MOZILLA}   = ($tests->{NETSCAPE} && $tests->{GECKO});
+    
   # Internet Explorer browsers
 
   $tests->{IE}               = (index($ua,"msie") != -1 || index($ua,'microsoft internet explorer') != -1);  
@@ -134,6 +189,7 @@
   $tests->{IE5UP}            = ($tests->{IE} && $major >= 5);
   $tests->{IE55}             = ($tests->{IE} && $major == 5 && $minor >= .5);
   $tests->{IE55UP}           = ($tests->{IE5} && $minor >= .5) || ($tests->{IE} && $major >= 6);
+  $tests->{IE6}             =  ($tests->{IE} && $major == 6);
  
   # Neoplanet browsers
 
@@ -155,14 +211,18 @@
   $tests->{OPERA3}    = (index($ua,"opera 3") != -1) || (index($ua,"opera/3") != -1);
   $tests->{OPERA4}    = (index($ua,"opera 4") != -1) || (index($ua,"opera/4") != -1);
   $tests->{OPERA5}    = (index($ua,"opera 5") != -1) || (index($ua,"opera/5") != -1);
+  $tests->{OPERA6}    = (index($ua,"opera 6") != -1) || (index($ua,"opera/6") != -1);
+  $tests->{OPERA7}    = (index($ua,"opera 7") != -1) || (index($ua,"opera/7") != -1);
   
   # Other browsers
 
+  $tests->{CURL}           = (index($ua,"libcurl") != -1);
   $tests->{STAROFFICE}     = (index($ua,"staroffice") != -1);
   $tests->{ICAB}           = (index($ua,"icab") != -1);
   $tests->{LOTUSNOTES}     = (index($ua,"lotus-notes") != -1);
   $tests->{KONQUEROR}      = (index($ua,"konqueror") != -1);
   $tests->{LYNX}           = (index($ua,"lynx") != -1);
+  $tests->{LINKS}          = (index($ua,"links") != -1);
   $tests->{WEBTV}          = (index($ua,"webtv") != -1);
   $tests->{MOSAIC}         = (index($ua,"mosaic") != -1);
   $tests->{WGET}           = (index($ua,"wget") != -1);
@@ -202,10 +262,13 @@
 			      index($ua,"find") != -1 ||
 			      index($ua,"index") != -1 ||
 			      index($ua,"copy") != -1 ||
-			      index($ua,"fetch") != -1);
+			      index($ua,"fetch") != -1 ||
+                  index($ua,"ia_archive") != -1 ||
+                  index($ua,"zyborg") != -1);
 
   # Devices
 
+  $tests->{BLACKBERRY}        = (index($ua,"blackberry") != -1);
   $tests->{AUDREY}        = (index($ua,"audrey") != -1);
   $tests->{IOPENER}       = (index($ua,"i-opener") != -1);
   $tests->{AVANTGO}        = (index($ua,"avantgo") != -1);
@@ -239,22 +302,27 @@
 			index($ua,"windows nt") != -1 || 
 			index($ua,"nt4") != -1 || 
 			index($ua,"nt3") != -1);
-  $tests->{WIN2K}    = (index($ua,"nt 5") != -1 || index($ua,"nt5") != -1);
+  $tests->{WIN2K}    = (index($ua,"nt 5.0") != -1 || index($ua,"nt5") != -1);
+  $tests->{WINXP}    = (index($ua,"nt 5.1") != -1 );
+  $tests->{DOTNET}   = (index($ua,".net clr") != -1);
+  
   $tests->{WINME}    = (index($ua,"win 9x 4.90") != -1); # whatever
   $tests->{WIN32}    = (($tests->{WIN95} || $tests->{WIN98} || $tests->{WINME} || $tests->{WINNT} || 
-			 $tests->{WIN2K}) || index($ua,"win32") != -1);
+			 $tests->{WIN2K}) || $tests->{WINXP} || index($ua,"win32") != -1);
   $tests->{WINDOWS}  = (($tests->{WIN16} || $tests->{WIN31} || $tests->{WIN95} || $tests->{WIN98} ||
 			 $tests->{WINNT} || $tests->{WIN32} || $tests->{WIN2K} || $tests->{WINME}) || index($ua,"win") != -1);
   
   # Mac operating systems
   
   $tests->{MAC}      = (index($ua,"macintosh") != -1 || index($ua,"mac_") != -1);
+  $tests->{MACOSX}   = (index($ua,"macintosh") != -1 && index($ua,"mac os x") != -1);
   $tests->{MAC68K}   = (($tests->{MAC}) && (index($ua,"68k") != -1 || index($ua,"68000") != -1));
   $tests->{MACPPC}   = (($tests->{MAC}) && (index($ua,"ppc") != -1 || index($ua,"powerpc") != -1));
   
   # Others
   
   $tests->{AMIGA}   = (index($ua,'amiga') != -1);
+  
   $tests->{EMACS}   = (index($ua,'emacs') != -1);
   $tests->{OS2}     = (index($ua,'os/2') != -1);
   
@@ -298,6 +366,23 @@
 
   $tests->{VMS} = (index($ua,"vax") != -1 || index($ua,"openvms") != -1);
 
+  # A final try at browser version, if we haven't gotten it so far
+  if ($major eq '') {
+     if ($ua =~ /[A-Za-z]+\/(\d+)\;/) {
+          $major = $1;
+          $minor = 0;
+      }
+  }
+
+  
+  # Gecko version
+  $self->{gecko_version} = undef;
+  if ($tests->{GECKO}) {
+    if( $ua =~ /\([^)]*rv:([\w\.\d]*)/ ) {
+        $self->{gecko_version} = $1;
+    }
+  }
+  
   $self->{major} = $major;
   $self->{minor} = $minor;
   $self->{beta} = $beta;
@@ -309,6 +394,8 @@
     my $user_agent = $self->user_agent;
     if (defined $user_agent) {
         $browser_string = 'Netscape' if $self->netscape;
+        $browser_string = 'Firefox' if $self->firefox;
+        $browser_string = 'Safari' if $self->safari;
         $browser_string = 'MSIE' if $self->ie;  
         $browser_string = 'WebTV' if $self->webtv;
         $browser_string = 'AOL Browser' if $self->aol;
@@ -327,7 +414,10 @@
         $os_string = 'Win95' if $self->win95;
         $os_string = 'Win98' if $self->win98;
         $os_string = 'WinNT' if $self->winnt;
+        $os_string = 'Win2k' if $self->win2k;
+        $os_string = 'WinXP' if $self->winxp;
         $os_string = 'Mac' if $self->mac;
+        $os_string = 'Mac OS X' if $self->macosx;
         $os_string = 'Win3x' if $self->win3x;
         $os_string = 'OS2' if $self->os2;
         $os_string = 'Unix' if $self->unix && !$self->linux;
@@ -335,6 +425,18 @@
     }
     return $os_string;
 }
+
+sub gecko_version {
+  my ($self, $check) = _self_or_default(@_);
+  my $version;
+  $version = $self->{gecko_version};
+  if (defined $check) { 
+    return $check == $version;
+  } else {
+    return $version;
+  }
+}
+
     
 sub version {
   my ($self, $check) = _self_or_default(@_);
@@ -485,23 +587,38 @@
 Returns any the beta version, consisting of any non-numeric characters
 after the version number.  For instance, if the user agent string is
 'Mozilla/4.0 (compatible; MSIE 5.0b2; Windows NT)', returns 'b2'.  If
-passed a parameter, returns true if equal to the beta version.
+passed a parameter, returns true if equal to the beta version.  If the beta
+starts with a dot, it is thrown away.
 
 =back
 
 =head2 DETECTING OS PLATFORM AND VERSION
 
 The following methods are available, each returning a true or false
-value.  Some methods also test for the operating system version.
-
-  windows win16 win3x win31 win95 win98 winnt win32 win2k winme
-  mac mac68k macppc
+value.  Some methods also test for the operating system version.  
+The indentations below show the hierarchy of tests (for example, win2k 
+is considered a type of winnt, which is a type of win32)
+
+  windows 
+    win16 win3x win31  
+    win32 
+        winme win95 win98
+        winnt
+            win2k winxp
+  dotnet
+  
+  mac 
+    mac68k macppc macosx
+  
   os2
+  
   unix 
-  sun sun4 sun5 suni86 irix irix5 irix6 hpux hpux9 hpux10 
-  aix aix1 aix2 aix3 aix4 linux sco unixware mpras reliant 
-  dec sinix freebsd bsd
+    sun sun4 sun5 suni86 irix irix5 irix6 hpux hpux9 hpux10 
+    aix aix1 aix2 aix3 aix4 linux sco unixware mpras reliant 
+    dec sinix freebsd bsd
+  
   vms
+
   amiga
 
 It may not be possibile to detect Win98 in Netscape 4.x and earlier. 
@@ -514,7 +631,7 @@
 Returns one of the following strings, or undef.  This method exists solely for compatibility with the
 B<HTTP::Headers::UserAgent> module.
 
-  Win95, Win98, WinNT, Mac, Win3x, OS2, Unix, Linux
+  Win95, Win98, WinNT, Win2K, WinXP, Mac, Mac OS X, Win3x, OS2, Unix, Linux
 
 =back
 
@@ -524,34 +641,46 @@
 test for the browser version, saving you from checking the version separately.
 
   netscape nav2 nav3 nav4 nav4up nav45 nav45up navgold nav6 nav6up
-  gecko
-  ie ie3 ie4 ie4up ie5 ie55
+  gecko 
+  mozilla
+  firefox 
+  safari
+  ie ie3 ie4 ie4up ie5 ie55 ie6
   neoplanet neoplanet2 
   mosaic
   aol aol3 aol4 aol5 aol6
   webtv
-  opera
-  lynx
+  opera opera3 opera4 opera5 opera6 opera7
+  lynx links
   emacs
   staroffice
   lotusnotes
   icab
   konqueror
   java
-
+  curl
 
 Netscape 6, even though its called six, in the userAgent string has version number 5.  The nav6 and nav6up methods correctly handle this quirk.
+The firefox text correctly detects the older-named versions of the browser (Phoenix, Firebird)
 
 =over
 
+
 =item browser_string()
 
 Returns one of the following strings, or undef.
 
 Netscape, MSIE, WebTV, AOL Browser, Opera, Mosaic, Lynx
 
+=item gecko_version() 
+
+If a Gecko rendering engine is used (as in Mozilla or Firebird), returns the version of the renderer (e.g. 1.3a, 1.7, 1.8)
+This might be more useful than the particular browser name or version when correcting for quirks in different versions of this rendering engine.
+If no Gecko browser is being used, or the version number can't be detected, returns undef.
+
 =back
 
+
 =head2 DETECTING OTHER DEVICES
 
 The following methods are available, each returning a true or false value.
@@ -561,6 +690,7 @@
   iopener
   palm
   avantgo
+  blackberry
 
 =head2 DETECTING ROBOTS
 
@@ -589,16 +719,19 @@
 
 Lee Semel, lee@semel.net
 
+Thanks to Leonardo Herrera for additional contributions
 
 =head1 SEE ALSO
 
 "The Ultimate JavaScript Client Sniffer, Version 3.0", B<http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html>.
 
+"Browser ID (User-Agent) Strings" B<http://www.zytrax.com/tech/web/browser_ids.htm>
+
 perl(1), L<HTTP::Headers>, L<HTTP::Headers::UserAgent>.
 
 =head1 COPYRIGHT
 
-Copyright 1999-2001 Lee Semel.  All rights reserved.  This program is free software;
+Copyright 1999-2004 Lee Semel.  All rights reserved.  This program is free software;
 you can redistribute it and/or modify it under the same terms as Perl itself. 
 
 =cut
diff -ruN 4.0K-4b/library/additions/HTTP/BrowserDetect_097.pm 5.0.000/library/additions/HTTP/BrowserDetect_097.pm
--- 4.0K-4b/library/additions/HTTP/BrowserDetect_097.pm	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/library/additions/HTTP/BrowserDetect_097.pm	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,610 @@
+package HTTP::BrowserDetect;
+
+use strict;
+use vars qw($VERSION $REVISION @ISA @EXPORT @EXPORT_OK @ALL_TESTS);
+require Exporter;
+
+@ISA	   = qw(Exporter);
+@EXPORT	   = qw();
+@EXPORT_OK = qw();
+$REVISION  = '$Id: BrowserDetect.pm,v 1.4 2001/01/31 17:44:27 lsemel Exp $';
+$VERSION   = '0.97';
+
+# Operating Systems
+push @ALL_TESTS,(qw(win16 win3x win31 win95 win98 winnt windows win32 win2k winme mac mac68k macppc os2 unix sun sun4 sun5 suni86 irix irix5 irix6 hpux hpux9 hpux10 aix aix1 aix2 aix3 aix4 linux sco unixware mpras reliant dec sinix freebsd bsd vms x11 amiga));
+
+# Devices
+push @ALL_TESTS,(qw(palm audrey iopener wap));
+
+# Browsers
+push @ALL_TESTS,(qw(mosaic netscape nav2 nav3 nav4 nav4up nav45 nav45up nav6 nav6up navgold ie ie3 ie4 ie4up ie5 ie5up ie55 ie55up opera opera3 opera4 opera5 lynx aol aol3 aol4 aol5 aol6 neoplanet neoplanet2 avantgo emacs gecko));
+
+# Robots
+push @ALL_TESTS,(qw(wget getright robot yahoo altavista lycos infoseek lwp webcrawler linkexchange slurp webtv staroffice lotusnotes konqueror icab google java));
+
+#######################################################################################################
+# BROWSER OBJECT
+
+my $default = undef;
+
+sub new {
+   my ($class, $user_agent) = @_;
+   
+   my $self = {};
+   bless $self, $class;
+
+   unless (defined $user_agent) {
+     $user_agent = $ENV{'HTTP_USER_AGENT'};
+   }
+
+   $self->user_agent($user_agent);
+   return $self;
+}
+
+foreach my $test (@ALL_TESTS) {
+    no strict 'refs';
+    my $key = uc $test;
+    *{$test} = sub { my ($self) = _self_or_default(@_);
+		     return $self->{tests}->{$key} };
+}
+
+sub _self_or_default {
+   my ($self) = $_[0];
+   return @_ if (defined $self &&
+		 ref $self &&
+		 (ref $self eq 'HTTP::BrowserDetect') || UNIVERSAL::isa($self,'HTTP::BrowserDetect'));
+   $default ||= HTTP::BrowserDetect->new();
+   unshift (@_, $default);
+   return @_;
+}
+
+
+sub user_agent {
+  my ($self, $user_agent) = _self_or_default(@_);
+  if (defined $user_agent) {
+    $self->{user_agent} = $user_agent;
+    $self->_test();
+  }
+  return $self->{user_agent};
+}
+
+# Private method -- test the UA string
+sub _test {
+  my ($self) = @_;
+
+  my $ua = lc $self->{user_agent};
+
+  # Browser version
+  my ($major, $minor, $beta) = ($ua =~ / \/			# Version starts with a slash
+				          [A-Za-z]*		# Eat any letters before the major version
+                                          ( [^\.]* )		# Major version number is everything before the first dot
+                                          \.			# The first dot
+                                          ( [\d]* )		# Minor version number is every digit after the first dot
+                                          [\d\.]*		# Throw away remaining numbers and dots
+                                          ( [^\s]* )		# Beta version string is up to next space
+                                        /x);
+
+  if (index($ua,"compatible") !=-1) {
+      ($major, $minor, $beta)    = ($ua =~ / 
+				    compatible;       
+				    \s*
+				    \w*				# Browser name
+				    [\s|\/]
+				    [A-Za-z]*			# Eat any letters before the major version
+				    ( [^\.]* )			# Major version number is everything before first dot
+				    \.				# The first dot
+				    ( [\d]* )			# Minor version nnumber is digits after first dot
+				    [\d\.]*			# Throw away remaining dots and digits
+				    ( [^;]* )			# Beta version is up to the ;
+				    ;
+				    /x);
+
+
+  }
+
+  $minor = 0+".$minor"; 
+
+  $self->{tests} = {};
+  my $tests = $self->{tests};
+
+  # Netscape browsers
+  
+  $tests->{NETSCAPE}  = (index($ua,"mozilla") != -1 && 
+			 index($ua,"spoofer") == -1 && index($ua,"compatible") == -1 &&
+			 index($ua,"opera") == -1 && index($ua,"webtv") == -1 && 
+			 index($ua,"hotjava") == -1);
+  $tests->{NAV2}      = ($tests->{NETSCAPE} && $major == 2);
+  $tests->{NAV3}      = ($tests->{NETSCAPE} && $major == 3);
+  $tests->{NAV4}      = ($tests->{NETSCAPE} && $major == 4);
+  $tests->{NAV4UP}    = ($tests->{NETSCAPE} && $major >= 4); 
+  $tests->{NAV45}     = ($tests->{NETSCAPE} && $major == 4 && $minor == .5);
+  $tests->{NAV45UP}   = ($tests->{NAV4} && $minor >= .5) || ($tests->{NETSCAPE} && $major >= 5);
+  $tests->{NAVGOLD}   = (index($beta,"gold") != -1);
+  $tests->{NAV6}      = ($tests->{NETSCAPE} && $major == 5); # go figure
+  $tests->{NAV6UP}    = ($tests->{NETSCAPE} && $major >= 5);
+  $tests->{GECKO}     = (index($ua,"gecko") != -1);
+  
+  # Internet Explorer browsers
+
+  $tests->{IE}               = (index($ua,"msie") != -1 || index($ua,'microsoft internet explorer') != -1);  
+  $tests->{IE3}              = ($tests->{IE} && $major == 3);
+  $tests->{IE4}              = ($tests->{IE} && $major == 4);
+  $tests->{IE4UP}            = ($tests->{IE} && $major >= 4);
+  $tests->{IE5}              = ($tests->{IE} && $major == 5);
+  $tests->{IE5UP}            = ($tests->{IE} && $major >= 5);
+  $tests->{IE55}             = ($tests->{IE} && $major == 5 && $minor >= .5);
+  $tests->{IE55UP}           = ($tests->{IE5} && $minor >= .5) || ($tests->{IE} && $major >= 6);
+ 
+  # Neoplanet browsers
+
+  $tests->{NEOPLANET}      = (index($ua,"neoplanet") != -1);
+  $tests->{NEOPLANET2}     = ($tests->{NEOPLANET} && index($ua,"2.") != -1); 
+
+  # AOL Browsers
+
+  $tests->{AOL}       = (index($ua,"aol")     != -1);
+  $tests->{AOL3}      = (index($ua,"aol 3.0") != -1) || ($tests->{AOL} && $tests->{IE3});
+  $tests->{AOL4}      = (index($ua,"aol 4.0") != -1) || ($tests->{AOL} && $tests->{IE4});
+  $tests->{AOL5}      = (index($ua,"aol 5.0") != -1);
+  $tests->{AOL6}      = (index($ua,"aol 6.0") != -1);
+  $tests->{AOLTV}     = (index($ua,"navio") != -1) || (index($ua,"navio_aoltv") != -1);
+
+  # Opera browsers
+  
+  $tests->{OPERA}     = (index($ua,"opera")   != -1);
+  $tests->{OPERA3}    = (index($ua,"opera 3") != -1) || (index($ua,"opera/3") != -1);
+  $tests->{OPERA4}    = (index($ua,"opera 4") != -1) || (index($ua,"opera/4") != -1);
+  $tests->{OPERA5}    = (index($ua,"opera 5") != -1) || (index($ua,"opera/5") != -1);
+  
+  # Other browsers
+
+  $tests->{STAROFFICE}     = (index($ua,"staroffice") != -1);
+  $tests->{ICAB}           = (index($ua,"icab") != -1);
+  $tests->{LOTUSNOTES}     = (index($ua,"lotus-notes") != -1);
+  $tests->{KONQUEROR}      = (index($ua,"konqueror") != -1);
+  $tests->{LYNX}           = (index($ua,"lynx") != -1);
+  $tests->{WEBTV}          = (index($ua,"webtv") != -1);
+  $tests->{MOSAIC}         = (index($ua,"mosaic") != -1);
+  $tests->{WGET}           = (index($ua,"wget") != -1);
+  $tests->{GETRIGHT}       = (index($ua,"getright") != -1);
+  $tests->{LWP}            = (index($ua,"libwww-perl") != -1 ||
+			      index($ua,"lwp-") != -1);
+  $tests->{YAHOO}          = (index($ua,"yahoo") != -1);
+  $tests->{GOOGLE}         = (index($ua,"google") != -1);
+  $tests->{JAVA}           = (index($ua,"java") != -1 ||
+			      index($ua,"jdk") != -1);
+  $tests->{ALTAVISTA}      = (index($ua,"altavista") != -1);
+  $tests->{SCOOTER}        = (index($ua,"scooter") != -1);
+  $tests->{LYCOS}          = (index($ua,"lycos") != -1);
+  $tests->{INFOSEEK}       = (index($ua,"infoseek") != -1);
+  $tests->{WEBCRAWLER}     = (index($ua,"webcrawler") != -1); 
+  $tests->{LINKEXCHANGE}   = (index($ua,"lecodechecker") != -1); 
+  $tests->{SLURP}          = (index($ua,"slurp") != -1);
+  $tests->{ROBOT}          = (($tests->{WGET} ||
+			       $tests->{GETRIGHT} ||
+			       $tests->{LWP} ||
+			       $tests->{YAHOO} ||
+			       $tests->{ALTAVISTA} ||
+			       $tests->{LYCOS} ||
+			       $tests->{INFOSEEK} ||
+			       $tests->{WEBCRAWLER} ||
+			       $tests->{LINKEXCHANGE} ||
+			       $tests->{SLURP} ||
+			       $tests->{GOOGLE}) ||
+			      index($ua,"bot") != -1 ||
+			      index($ua,"spider") != -1 ||
+			      index($ua,"crawl") != -1 ||
+			      index($ua,"agent") != -1 ||
+			      index($ua,"seek") != -1 ||
+			      index($ua,"search") != -1 ||
+			      index($ua,"reap") != -1 ||
+			      index($ua,"worm") != -1 ||
+			      index($ua,"find") != -1 ||
+			      index($ua,"index") != -1 ||
+			      index($ua,"copy") != -1 ||
+			      index($ua,"fetch") != -1);
+
+  # Devices
+
+  $tests->{AUDREY}        = (index($ua,"audrey") != -1);
+  $tests->{IOPENER}       = (index($ua,"i-opener") != -1);
+  $tests->{AVANTGO}        = (index($ua,"avantgo") != -1);
+  $tests->{PALM}          = ($tests->{AVANTGO} || 
+			     index($ua,"palmos") != -1 );
+  $tests->{WAP}           = (index($ua,"up.browser") != -1 ||
+			     index($ua,"nokia") != -1 ||
+			     index($ua,"alcatel") != -1 ||
+			     index($ua,"ericsson") != -1 ||
+			     index($ua,"sie-") == 0 ||
+			     index($ua,"wmlib") != -1 ||
+			     index($ua," wap") != -1 ||
+			     index($ua,"wap ") != -1 ||
+			     index($ua,"wap/") != -1 ||
+			     index($ua,"-wap") != -1 ||
+			     index($ua,"wap-") != -1 ||
+			     index($ua,"wap") == 0 ||
+			     index($ua,"wapper") != -1 ||
+			     index($ua,"zetor") != -1);
+			     
+			     
+  # Operating System
+  
+  $tests->{WIN16}    = (index($ua,"win16") != -1 || index($ua,"16bit") != -1 || index($ua,"windows 3") != -1 ||
+			index($ua,"windows 16-bit") != -1);
+  $tests->{WIN3X}    = (index($ua,"win16") != -1 || index($ua,"windows 3") != -1 || index($ua,"windows 16-bit") != -1);
+  $tests->{WIN31}    = (index($ua,"win16") != -1 || index($ua,"windows 3.1") != -1 || index($ua,"windows 16-bit") != -1);
+  $tests->{WIN95}    = (index($ua,"win95") != -1 || index($ua,"windows 95") != -1);
+  $tests->{WIN98}    = (index($ua,"win98") != -1 || index($ua,"windows 98") != -1);
+  $tests->{WINNT}    = (index($ua,"winnt") != -1 || 
+			index($ua,"windows nt") != -1 || 
+			index($ua,"nt4") != -1 || 
+			index($ua,"nt3") != -1);
+  $tests->{WIN2K}    = (index($ua,"nt 5") != -1 || index($ua,"nt5") != -1);
+  $tests->{WINME}    = (index($ua,"win 9x 4.90") != -1); # whatever
+  $tests->{WIN32}    = (($tests->{WIN95} || $tests->{WIN98} || $tests->{WINME} || $tests->{WINNT} || 
+			 $tests->{WIN2K}) || index($ua,"win32") != -1);
+  $tests->{WINDOWS}  = (($tests->{WIN16} || $tests->{WIN31} || $tests->{WIN95} || $tests->{WIN98} ||
+			 $tests->{WINNT} || $tests->{WIN32} || $tests->{WIN2K} || $tests->{WINME}) || index($ua,"win") != -1);
+  
+  # Mac operating systems
+  
+  $tests->{MAC}      = (index($ua,"macintosh") != -1 || index($ua,"mac_") != -1);
+  $tests->{MAC68K}   = (($tests->{MAC}) && (index($ua,"68k") != -1 || index($ua,"68000") != -1));
+  $tests->{MACPPC}   = (($tests->{MAC}) && (index($ua,"ppc") != -1 || index($ua,"powerpc") != -1));
+  
+  # Others
+  
+  $tests->{AMIGA}   = (index($ua,'amiga') != -1);
+  $tests->{EMACS}   = (index($ua,'emacs') != -1);
+  $tests->{OS2}     = (index($ua,'os/2') != -1);
+  
+  $tests->{SUN}     = (index($ua,"sun") != -1);
+  $tests->{SUN4}    = (index($ua,"sunos 4") != -1);
+  $tests->{SUN5}    = (index($ua,"sunos 5") != -1);
+  $tests->{SUNI86}  = (($tests->{SUN}) && index($ua,"i86") != -1);
+  
+  $tests->{IRIX}    = (index($ua,"irix") != -1);
+  $tests->{IRIX5}   = (index($ua,"irix5") != -1);
+  $tests->{IRIX6}   = (index($ua,"irix6") != -1);
+  
+  $tests->{HPUX}    = (index($ua,"hp-ux") != -1);
+  $tests->{HPUX9}   = (($tests->{HPUX}) && index($ua,"09.") != -1);
+  $tests->{HPUX10}  = (($tests->{HPUX}) && index($ua,"10.") != -1);
+  
+  $tests->{AIX}   = (index($ua,"aix") != -1);
+  $tests->{AIX1}  = (index($ua,"aix 1") != -1);
+  $tests->{AIX2}  = (index($ua,"aix 2") != -1);
+  $tests->{AIX3}  = (index($ua,"aix 3") != -1);
+  $tests->{AIX4}  = (index($ua,"aix 4") != -1);
+  
+  $tests->{LINUX}     = (index($ua,"inux") != -1);
+  $tests->{SCO}       = (index($ua,"sco") != -1 || index($ua,"unix_sv") != -1);
+  $tests->{UNIXWARE}  = (index($ua,"unix_system_v") != -1);
+  $tests->{MPRAS}     = (index($ua,"ncr") != -1);
+  $tests->{RELIANT}   = (index($ua,"reliantunix") != -1);
+  
+  $tests->{DEC} = (index($ua,"dec") != -1 || index($ua,"osf1") != -1 || index($ua,"declpha") != -1 || 
+		   index($ua,"alphaserver") != -1 || index($ua,"ultrix") != -1 ||
+		   index($ua,"alphastation") != -1);
+  
+  $tests->{SINIX}    = (index($ua,"sinix") != -1);
+  $tests->{FREEBSD}  = (index($ua,"freebsd") != -1);
+  $tests->{BSD}      = (index($ua,"bsd") != -1);
+  $tests->{X11}      = (index($ua,"x11") != -1);
+  $tests->{UNIX}     = ($tests->{X11} || $tests->{SUN} || $tests->{IRIX} || $tests->{HPUX} ||
+			$tests->{SCO} || $tests->{UNIXWARE} || $tests->{MPRAS} ||
+			$tests->{RELIANT} || $tests->{DEC} || $tests->{LINUX} ||
+			$tests->{BSD}); 
+
+  $tests->{VMS} = (index($ua,"vax") != -1 || index($ua,"openvms") != -1);
+
+  $self->{major} = $major;
+  $self->{minor} = $minor;
+  $self->{beta} = $beta;
+}
+    
+sub browser_string {
+    my ($self) = _self_or_default(@_);
+    my $browser_string = undef;
+    my $user_agent = $self->user_agent;
+    if (defined $user_agent) {
+        $browser_string = 'Netscape' if $self->netscape;
+        $browser_string = 'MSIE' if $self->ie;  
+        $browser_string = 'WebTV' if $self->webtv;
+        $browser_string = 'AOL Browser' if $self->aol;
+        $browser_string = 'Opera' if $self->opera;
+        $browser_string = 'Mosaic' if $self->mosaic;
+        $browser_string = 'Lynx' if $self->lynx;
+    }
+    return $browser_string;
+}
+    
+sub os_string {
+    my ($self) = _self_or_default(@_);
+    my $os_string = undef;
+    my $user_agent = $self->user_agent;
+    if (defined $user_agent) {
+        $os_string = 'Win95' if $self->win95;
+        $os_string = 'Win98' if $self->win98;
+        $os_string = 'WinNT' if $self->winnt;
+        $os_string = 'Mac' if $self->mac;
+        $os_string = 'Win3x' if $self->win3x;
+        $os_string = 'OS2' if $self->os2;
+        $os_string = 'Unix' if $self->unix && !$self->linux;
+        $os_string = 'Linux' if $self->linux;
+    }
+    return $os_string;
+}
+    
+sub version {
+  my ($self, $check) = _self_or_default(@_);
+  my $version;
+  $version = $self->{major} + $self->{minor};
+  if (defined $check) { 
+    return $check == $version;
+  } else {
+    return $version;
+  }
+}
+    
+sub major {
+  my ($self, $check) = _self_or_default(@_);
+  my ($version) = $self->{major};
+  if (defined $check) { 
+    return $check == $version;
+  } else {
+    return $version;
+  }
+}
+    
+sub minor {
+  my ($self, $check) = _self_or_default(@_);
+  my ($version) = $self->{minor};
+  if (defined $check) { 
+      return ($check == $self->{minor});
+  } else {
+    return $version;
+  }
+}
+    
+sub beta {
+  my ($self, $check) = _self_or_default(@_);
+  my ($version) = $self->{beta};
+  if ($check) { 
+    return $check eq $version;
+  } else {
+    return $version;
+  }
+}
+
+1;
+    
+
+__END__
+
+=head1 NAME
+
+HTTP::BrowserDetect - Determine the Web browser, version, and platform from an HTTP user agent string
+
+=head1 SYNOPSIS
+
+    use HTTP::BrowserDetect;
+
+    my $browser = new HTTP::BrowserDetect($user_agent_string);
+
+    # Detect operating system
+    if ($browser->windows) {
+      if ($browser->winnt) ...
+      if ($brorwser->win95) ...
+    }
+    print $browser->mac;
+
+    # Detect browser vendor and version
+    print $browser->netscape;
+    print $browser->ie;
+    if (browser->major(4)) {
+	if ($browser->minor() > .5) {
+	    ...
+	}
+    }
+    if ($browser->version() > 4) {
+      ...;
+    }
+    
+    # Process a different user agent string
+    $browser->user_agent($another_user_agent_string);
+
+
+
+=head1 DESCRIPTION
+
+The HTTP::BrowserDetect object does a number of tests on an HTTP user
+agent string.  The results of these tests are available via methods of
+the object.
+
+This module is based upon the JavaScript browser detection code
+available at
+B<http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html>.
+
+=head2 CREATING A NEW BROWSER DETECT OBJECT AND SETTING THE USER AGENT STRING
+
+=over 4
+
+=item new HTTP::BrowserDetect($user_agent_string)
+
+The constructor may be called with a user agent string specified.
+Otherwise, it will use the value specified by $ENV{'HTTP_USER_AGENT'},
+which is set by the web server when calling a CGI script.
+
+You may also use a non-object-oriented interface.  For each method,
+you may call HTTP::BrowserDetect::method_name().  You will then be
+working with a default HTTP::BrowserDetect object that is created
+behind the scenes.
+
+=item user_agent($user_agent_string)
+
+Returns the value of the user agent string.  When called with a
+parameter, it resets the user agent and reperforms all tests on the
+string.  This way you can process a series of user agent strings (from
+a log file, perhaps) without creating a new HTTP::BrowserDetect object
+each time.
+
+=back
+
+=head2 DETECTING BROWSER VERSION
+
+=over 4
+
+=item major($major)
+
+Returns the integer portion of the browser version.
+If passed a parameter, returns true if it equals
+the browser major version.
+
+=item minor($minor)
+
+Returns the decimal portion of the browser version as a B<floating-point number> less than 1.  
+For example, if the version is 4.05, this method returns .05; if the version is 4.5, this method returns .5.  
+B<This is a change in behavior from previous versions of this module, which returned a 
+string>.
+
+If passed a parameter, returns true if equals the minor version.  
+
+On occasion a version may have more than one decimal point, such 
+as 'Wget/1.4.5'. The minor version does not include the second decimal point, 
+or any further digits or decimals.
+
+=item version($version)
+
+Returns the version as a floating-point number.  If passed a
+parameter, returns true if it is equal to the version
+specified by the user agent string.
+
+=item beta($beta)
+
+Returns any the beta version, consisting of any non-numeric characters
+after the version number.  For instance, if the user agent string is
+'Mozilla/4.0 (compatible; MSIE 5.0b2; Windows NT)', returns 'b2'.  If
+passed a parameter, returns true if equal to the beta version.
+
+=back
+
+=head2 DETECTING OS PLATFORM AND VERSION
+
+The following methods are available, each returning a true or false
+value.  Some methods also test for the operating system version.
+
+  windows win16 win3x win31 win95 win98 winnt win32 win2k winme
+  mac mac68k macppc
+  os2
+  unix 
+  sun sun4 sun5 suni86 irix irix5 irix6 hpux hpux9 hpux10 
+  aix aix1 aix2 aix3 aix4 linux sco unixware mpras reliant 
+  dec sinix freebsd bsd
+  vms
+  amiga
+
+It may not be possibile to detect Win98 in Netscape 4.x and earlier. 
+On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all Win32, so you can't distinguish between Win95 and WinNT.
+
+=over 
+
+=item os_string()
+
+Returns one of the following strings, or undef.  This method exists solely for compatibility with the
+B<HTTP::Headers::UserAgent> module.
+
+  Win95, Win98, WinNT, Mac, Win3x, OS2, Unix, Linux
+
+=back
+
+=head2 DETECTING BROWSER VENDOR
+
+The following methods are available, each returning a true or false value.  Some methods also
+test for the browser version, saving you from checking the version separately.
+
+  netscape nav2 nav3 nav4 nav4up nav45 nav45up navgold nav6 nav6up
+  gecko
+  ie ie3 ie4 ie4up ie5 ie55
+  neoplanet neoplanet2 
+  mosaic
+  aol aol3 aol4 aol5 aol6
+  webtv
+  opera
+  lynx
+  emacs
+  staroffice
+  lotusnotes
+  icab
+  konqueror
+  java
+
+
+Netscape 6, even though its called six, in the userAgent string has version number 5.  The nav6 and nav6up methods correctly handle this quirk.
+
+=over
+
+=item browser_string()
+
+Returns one of the following strings, or undef.
+
+Netscape, MSIE, WebTV, AOL Browser, Opera, Mosaic, Lynx
+
+=back
+
+=head2 DETECTING OTHER DEVICES
+
+The following methods are available, each returning a true or false value.
+
+  wap
+  audrey
+  iopener
+  palm
+  avantgo
+
+=head2 DETECTING ROBOTS
+
+=item robot()
+
+Returns true if the user agent appears to be a robot, spider,
+crawler, or other automated Web client.
+
+The following additional methods are available, each returning a true
+or false value.  This is by no means a complete list of robots that
+exist on the Web.
+
+  wget
+  getright
+  yahoo 
+  altavista 
+  lycos 
+  infoseek 
+  lwp
+  webcrawler 
+  linkexchange 
+  slurp 
+  google
+
+=head1 AUTHOR
+
+Lee Semel, lee@semel.net
+
+
+=head1 SEE ALSO
+
+"The Ultimate JavaScript Client Sniffer, Version 3.0", B<http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html>.
+
+perl(1), L<HTTP::Headers>, L<HTTP::Headers::UserAgent>.
+
+=head1 COPYRIGHT
+
+Copyright 1999-2001 Lee Semel.  All rights reserved.  This program is free software;
+you can redistribute it and/or modify it under the same terms as Perl itself. 
+
+=cut
+
+
+     
+
+
+
diff -ruN 4.0K-4b/library/additions/MIME/Base64.pm 5.0.000/library/additions/MIME/Base64.pm
--- 4.0K-4b/library/additions/MIME/Base64.pm	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/additions/MIME/Base64.pm	2006-10-31 09:40:27.000000000 -0600
@@ -1,8 +1,26 @@
-#
-# $Id: Base64.pm,v 2.16 2001/02/24 06:28:10 gisle Exp $
-
 package MIME::Base64;
 
+# $Id: Base64.pm,v 3.5 2004/09/20 09:23:23 gisle Exp $
+
+use strict;
+use vars qw(@ISA @EXPORT $VERSION);
+
+require Exporter;
+require DynaLoader;
+@ISA = qw(Exporter DynaLoader);
+@EXPORT = qw(encode_base64 decode_base64);
+
+$VERSION = '3.05';
+
+MIME::Base64->bootstrap($VERSION);
+
+*encode = \&encode_base64;
+*decode = \&decode_base64;
+
+1;
+
+__END__
+
 =head1 NAME
 
 MIME::Base64 - Encoding and decoding of base64 strings
@@ -16,9 +34,9 @@
 
 =head1 DESCRIPTION
 
-This module provides functions to encode and decode strings into the
-Base64 encoding specified in RFC 2045 - I<MIME (Multipurpose Internet
-Mail Extensions)>. The Base64 encoding is designed to represent
+This module provides functions to encode and decode strings into and from the
+base64 encoding specified in RFC 2045 - I<MIME (Multipurpose Internet
+Mail Extensions)>. The base64 encoding is designed to represent
 arbitrary sequences of octets in a form that need not be humanly
 readable. A 65-character subset ([A-Za-z0-9+/=]) of US-ASCII is used,
 enabling 6 bits to be represented per printable character.
@@ -27,15 +45,17 @@
 
 =over 4
 
-=item encode_base64($str, [$eol])
+=item encode_base64($str)
+
+=item encode_base64($str, $eol);
 
 Encode data by calling the encode_base64() function.  The first
-argument is the string to encode.  The second argument is the line
-ending sequence to use (it is optional and defaults to C<"\n">).  The
+argument is the string to encode.  The second argument is the
+line-ending sequence to use.  It is optional and defaults to "\n".  The
 returned encoded string is broken into lines of no more than 76
 characters each and it will end with $eol unless it is empty.  Pass an
 empty string as second argument if you do not want the encoded string
-broken into lines.
+to be broken into lines.
 
 =item decode_base64($str)
 
@@ -43,17 +63,17 @@
 function takes a single argument which is the string to decode and
 returns the decoded data.
 
-Any character not part of the 65-character base64 subset set is
-silently ignored.  Characters occuring after a '=' padding character
+Any character not part of the 65-character base64 subset is
+silently ignored.  Characters occurring after a '=' padding character
 are never decoded.
 
-If the length of the string to decode (after ignoring
-non-base64 chars) is not a multiple of 4 or padding occurs too ealy,
+If the length of the string to decode, after ignoring
+non-base64 chars, is not a multiple of 4 or if padding occurs too early,
 then a warning is generated if perl is running under C<-w>.
 
 =back
 
-If you prefer not to import these routines into your namespace you can
+If you prefer not to import these routines into your namespace, you can
 call them as:
 
     use MIME::Base64 ();
@@ -62,7 +82,7 @@
 
 =head1 DIAGNOSTICS
 
-The following warnings might be generated if perl is invoked with the
+The following warnings can be generated if perl is invoked with the
 C<-w> switch:
 
 =over 4
@@ -105,14 +125,14 @@
 
    perl -MMIME::Base64 -0777 -ne 'print encode_base64($_)' <file
 
-Decoding does not need slurp mode if all the lines contains a multiple
-of 4 base64 chars:
+Decoding does not need slurp mode if every line contains a multiple
+of four base64 chars:
 
    perl -MMIME::Base64 -ne 'print decode_base64($_)' <file
 
 =head1 COPYRIGHT
 
-Copyright 1995-1999, 2001 Gisle Aas.
+Copyright 1995-1999, 2001-2004 Gisle Aas.
 
 This library is free software; you can redistribute it and/or
 modify it under the same terms as Perl itself.
@@ -122,81 +142,11 @@
 code posted to comp.lang.perl <3pd2lp$6gf@wsinti07.win.tue.nl> by Hans
 Mulder <hansm@wsinti07.win.tue.nl>
 
-The XS implementation use code from metamail.  Copyright 1991 Bell
+The XS implementation uses code from metamail.  Copyright 1991 Bell
 Communications Research, Inc. (Bellcore)
 
-=cut
-
-use strict;
-use vars qw(@ISA @EXPORT $VERSION $OLD_CODE);
-
-require Exporter;
-require DynaLoader;
-@ISA = qw(Exporter DynaLoader);
-@EXPORT = qw(encode_base64 decode_base64);
-
-$VERSION = '2.12';
-
-eval { bootstrap MIME::Base64 $VERSION; };
-if ($@) {
-    # can't bootstrap XS implementation, use perl implementation
-    *encode_base64 = \&old_encode_base64;
-    *decode_base64 = \&old_decode_base64;
-
-    $OLD_CODE = $@;
-    #warn $@ if $^W;
-}
-
-# Historically this module has been implemented as pure perl code.
-# The XS implementation runs about 20 times faster, but the Perl
-# code might be more portable, so it is still here.
-
-use integer;
-
-sub old_encode_base64 ($;$)
-{
-    my $res = "";
-    my $eol = $_[1];
-    $eol = "\n" unless defined $eol;
-    pos($_[0]) = 0;                          # ensure start at the beginning
-
-    $res = join '', map( pack('u',$_)=~ /^.(\S*)/, ($_[0]=~/(.{1,45})/gs));
-
-    $res =~ tr|` -_|AA-Za-z0-9+/|;               # `# help emacs
-    # fix padding at the end
-    my $padding = (3 - length($_[0]) % 3) % 3;
-    $res =~ s/.{$padding}$/'=' x $padding/e if $padding;
-    # break encoded string into lines of no more than 76 characters each
-    if (length $eol) {
-	$res =~ s/(.{1,76})/$1$eol/g;
-    }
-    return $res;
-}
-
-
-sub old_decode_base64 ($)
-{
-    local($^W) = 0; # unpack("u",...) gives bogus warning in 5.00[123]
-
-    my $str = shift;
-    $str =~ tr|A-Za-z0-9+=/||cd;            # remove non-base64 chars
-    if (length($str) % 4) {
-	require Carp;
-	Carp::carp("Length of base64 data not a multiple of 4")
-    }
-    $str =~ s/=+$//;                        # remove padding
-    $str =~ tr|A-Za-z0-9+/| -_|;            # convert to uuencoded format
-
-    return join'', map( unpack("u", chr(32 + length($_)*3/4) . $_),
-	                $str =~ /(.{1,60})/gs);
-}
-
-# Set up aliases so that these functions also can be called as
-#
-#    MIME::Base64::encode();
-#    MIME::Base64::decode();
+=head1 SEE ALSO
 
-*encode = \&encode_base64;
-*decode = \&decode_base64;
+L<MIME::QuotedPrint>
 
-1;
+=cut
diff -ruN 4.0K-4b/library/additions/MIME/Base64_216.pm 5.0.000/library/additions/MIME/Base64_216.pm
--- 4.0K-4b/library/additions/MIME/Base64_216.pm	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/library/additions/MIME/Base64_216.pm	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,202 @@
+#
+# $Id: Base64.pm,v 2.16 2001/02/24 06:28:10 gisle Exp $
+
+package MIME::Base64;
+
+=head1 NAME
+
+MIME::Base64 - Encoding and decoding of base64 strings
+
+=head1 SYNOPSIS
+
+ use MIME::Base64;
+
+ $encoded = encode_base64('Aladdin:open sesame');
+ $decoded = decode_base64($encoded);
+
+=head1 DESCRIPTION
+
+This module provides functions to encode and decode strings into the
+Base64 encoding specified in RFC 2045 - I<MIME (Multipurpose Internet
+Mail Extensions)>. The Base64 encoding is designed to represent
+arbitrary sequences of octets in a form that need not be humanly
+readable. A 65-character subset ([A-Za-z0-9+/=]) of US-ASCII is used,
+enabling 6 bits to be represented per printable character.
+
+The following functions are provided:
+
+=over 4
+
+=item encode_base64($str, [$eol])
+
+Encode data by calling the encode_base64() function.  The first
+argument is the string to encode.  The second argument is the line
+ending sequence to use (it is optional and defaults to C<"\n">).  The
+returned encoded string is broken into lines of no more than 76
+characters each and it will end with $eol unless it is empty.  Pass an
+empty string as second argument if you do not want the encoded string
+broken into lines.
+
+=item decode_base64($str)
+
+Decode a base64 string by calling the decode_base64() function.  This
+function takes a single argument which is the string to decode and
+returns the decoded data.
+
+Any character not part of the 65-character base64 subset set is
+silently ignored.  Characters occuring after a '=' padding character
+are never decoded.
+
+If the length of the string to decode (after ignoring
+non-base64 chars) is not a multiple of 4 or padding occurs too ealy,
+then a warning is generated if perl is running under C<-w>.
+
+=back
+
+If you prefer not to import these routines into your namespace you can
+call them as:
+
+    use MIME::Base64 ();
+    $encoded = MIME::Base64::encode($decoded);
+    $decoded = MIME::Base64::decode($encoded);
+
+=head1 DIAGNOSTICS
+
+The following warnings might be generated if perl is invoked with the
+C<-w> switch:
+
+=over 4
+
+=item Premature end of base64 data
+
+The number of characters to decode is not a multiple of 4.  Legal
+base64 data should be padded with one or two "=" characters to make
+its length a multiple of 4.  The decoded result will anyway be as if
+the padding was there.
+
+=item Premature padding of base64 data
+
+The '=' padding character occurs as the first or second character
+in a base64 quartet.
+
+=back
+
+=head1 EXAMPLES
+
+If you want to encode a large file, you should encode it in chunks
+that are a multiple of 57 bytes.  This ensures that the base64 lines
+line up and that you do not end up with padding in the middle. 57
+bytes of data fills one complete base64 line (76 == 57*4/3):
+
+   use MIME::Base64 qw(encode_base64);
+
+   open(FILE, "/var/log/wtmp") or die "$!";
+   while (read(FILE, $buf, 60*57)) {
+       print encode_base64($buf);
+   }
+
+or if you know you have enough memory
+
+   use MIME::Base64 qw(encode_base64);
+   local($/) = undef;  # slurp
+   print encode_base64(<STDIN>);
+
+The same approach as a command line:
+
+   perl -MMIME::Base64 -0777 -ne 'print encode_base64($_)' <file
+
+Decoding does not need slurp mode if all the lines contains a multiple
+of 4 base64 chars:
+
+   perl -MMIME::Base64 -ne 'print decode_base64($_)' <file
+
+=head1 COPYRIGHT
+
+Copyright 1995-1999, 2001 Gisle Aas.
+
+This library is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+Distantly based on LWP::Base64 written by Martijn Koster
+<m.koster@nexor.co.uk> and Joerg Reichelt <j.reichelt@nexor.co.uk> and
+code posted to comp.lang.perl <3pd2lp$6gf@wsinti07.win.tue.nl> by Hans
+Mulder <hansm@wsinti07.win.tue.nl>
+
+The XS implementation use code from metamail.  Copyright 1991 Bell
+Communications Research, Inc. (Bellcore)
+
+=cut
+
+use strict;
+use vars qw(@ISA @EXPORT $VERSION $OLD_CODE);
+
+require Exporter;
+require DynaLoader;
+@ISA = qw(Exporter DynaLoader);
+@EXPORT = qw(encode_base64 decode_base64);
+
+$VERSION = '2.12';
+
+eval { bootstrap MIME::Base64 $VERSION; };
+if ($@) {
+    # can't bootstrap XS implementation, use perl implementation
+    *encode_base64 = \&old_encode_base64;
+    *decode_base64 = \&old_decode_base64;
+
+    $OLD_CODE = $@;
+    #warn $@ if $^W;
+}
+
+# Historically this module has been implemented as pure perl code.
+# The XS implementation runs about 20 times faster, but the Perl
+# code might be more portable, so it is still here.
+
+use integer;
+
+sub old_encode_base64 ($;$)
+{
+    my $res = "";
+    my $eol = $_[1];
+    $eol = "\n" unless defined $eol;
+    pos($_[0]) = 0;                          # ensure start at the beginning
+
+    $res = join '', map( pack('u',$_)=~ /^.(\S*)/, ($_[0]=~/(.{1,45})/gs));
+
+    $res =~ tr|` -_|AA-Za-z0-9+/|;               # `# help emacs
+    # fix padding at the end
+    my $padding = (3 - length($_[0]) % 3) % 3;
+    $res =~ s/.{$padding}$/'=' x $padding/e if $padding;
+    # break encoded string into lines of no more than 76 characters each
+    if (length $eol) {
+	$res =~ s/(.{1,76})/$1$eol/g;
+    }
+    return $res;
+}
+
+
+sub old_decode_base64 ($)
+{
+    local($^W) = 0; # unpack("u",...) gives bogus warning in 5.00[123]
+
+    my $str = shift;
+    $str =~ tr|A-Za-z0-9+=/||cd;            # remove non-base64 chars
+    if (length($str) % 4) {
+	require Carp;
+	Carp::carp("Length of base64 data not a multiple of 4")
+    }
+    $str =~ s/=+$//;                        # remove padding
+    $str =~ tr|A-Za-z0-9+/| -_|;            # convert to uuencoded format
+
+    return join'', map( unpack("u", chr(32 + length($_)*3/4) . $_),
+	                $str =~ /(.{1,60})/gs);
+}
+
+# Set up aliases so that these functions also can be called as
+#
+#    MIME::Base64::encode();
+#    MIME::Base64::decode();
+
+*encode = \&encode_base64;
+*decode = \&decode_base64;
+
+1;
diff -ruN 4.0K-4b/library/additions/Mail/Sendmail-078.pm 5.0.000/library/additions/Mail/Sendmail-078.pm
--- 4.0K-4b/library/additions/Mail/Sendmail-078.pm	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/library/additions/Mail/Sendmail-078.pm	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,752 @@
+package Mail::Sendmail;
+# Mail::Sendmail by Milivoj Ivkovic <mi@alma.ch>
+# see embedded POD documentation after __END__
+# or http://alma.ch/perl/mail.htm
+
+=head1 NAME
+
+Mail::Sendmail v. 0.78 - Simple platform independent mailer
+
+=cut
+
+$VERSION = '0.78';
+
+# *************** Configuration you may want to change *******************
+# You probably want to set your SMTP server here (unless you specify it in
+# every script), and leave the rest as is. See pod documentation for details
+
+%mailcfg = (
+    # List of SMTP servers:
+    'smtp'    => [ qw( localhost ) ],
+    #'smtp'    => [ qw( mail.mydomain.com ) ], # example
+
+    'from'    => '', # default sender e-mail, used when no From header in mail
+
+    'mime'    => 1, # use MIME encoding by default
+
+    'retries' => 1, # number of retries on smtp connect failure
+    'delay'   => 1, # delay in seconds between retries
+
+    'tz'      => '', # only to override automatic detection
+    'port'    => 25, # change it if you always use a non-standard port
+    'debug'   => 0 # prints stuff to STDERR
+);
+
+# *******************************************************************
+
+require Exporter;
+use strict;
+use vars qw(
+            $VERSION
+            @ISA
+            @EXPORT
+            @EXPORT_OK
+            %mailcfg
+            $default_smtp_server
+            $default_smtp_port
+            $default_sender
+            $TZ
+            $use_MIME
+            $address_rx
+            $debug
+            $log
+            $error
+            $retry_delay
+            $connect_retries
+           );
+
+use Socket;
+use Time::Local; # for automatic time zone detection
+
+# use MIME::QuotedPrint if available and configured in %mailcfg
+eval("use MIME::QuotedPrint");
+$mailcfg{'mime'} &&= (!$@);
+
+@ISA        = qw(Exporter);
+@EXPORT     = qw(&sendmail);
+@EXPORT_OK  = qw(
+                 %mailcfg
+                 time_to_date
+                 $default_smtp_server
+                 $default_smtp_port
+                 $default_sender
+                 $TZ
+                 $address_rx
+                 $debug
+                 $log
+                 $error
+                );
+
+# regex for e-mail addresses where full=$1, user=$2, domain=$3
+# see pod documentation about this regex
+
+my $word_rx = '[\x21\x23-\x27\x2A-\x2B\x2D\w\x3D\x3F]+';
+my $user_rx = $word_rx         # valid chars
+             .'(?:\.' . $word_rx . ')*' # possibly more words preceded by a dot
+             ;
+my $dom_rx = '\w[-\w]*(?:\.\w[-\w]*)*'; # less valid chars in domain names
+my $ip_rx = '\[\d{1,3}(?:\.\d{1,3}){3}\]';
+
+$address_rx = '((' . $user_rx . ')\@(' . $dom_rx . '|' . $ip_rx . '))';
+; # v. 0.6
+
+sub time_to_date {
+    # convert a time() value to a date-time string according to RFC 822
+
+    my $time = $_[0] || time(); # default to now if no argument
+
+    my @months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
+    my @wdays  = qw(Sun Mon Tue Wed Thu Fri Sat);
+
+    my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
+        = localtime($time);
+
+    $TZ ||= $mailcfg{'tz'};
+
+    if ( $TZ eq "" ) {
+        # offset in hours
+        my $offset  = sprintf "%.1f", (timegm(localtime) - time) / 3600;
+        my $minutes = sprintf "%02d", ( $offset - int($offset) ) * 60;
+        $TZ  = sprintf("%+03d", int($offset)) . $minutes;
+    }
+    return join(" ",
+                    ($wdays[$wday] . ','),
+                     $mday,
+                     $months[$mon],
+                     $year+1900,
+                     sprintf("%02d", $hour) . ":" . sprintf("%02d", $min),
+                     $TZ
+               );
+} # end sub time_to_date
+
+sub sendmail {
+    # original sendmail 1.21 by Christian Mallwitz.
+    # Modified and 'modulized' by mi@alma.ch
+
+    $error = '';
+    $log = "Mail::Sendmail v. $VERSION - "    . scalar(localtime()) . "\n";
+
+    local $_;
+    local $/ = "\015\012";
+
+    my (%mail, $k,
+        $smtp, $server, $port, $connected, $localhost,
+        $message, $fromaddr, $recip, @recipients, $to, $header,
+       );
+
+    sub fail {
+        # things to do before returning a sendmail failure
+        print STDERR @_ if $^W;
+        $error .= join(" ", @_) . "\n";
+        close S;
+        return 0;
+    }
+
+    # all config keys to lowercase, to prevent typo errors
+    foreach $k (keys %mailcfg) {
+        if ($k =~ /[A-Z]/) {
+            $mailcfg{lc($k)} = $mailcfg{$k};
+        }
+    }
+
+    # redo hash, arranging keys case etc...
+    while (@_) {
+        # arrange keys case
+        $k = ucfirst lc(shift @_);
+
+        if (!$k and $^W) {
+            warn "Received false mail hash key: \'$k\'. Did you forget to put it in quotes?\n";
+        }
+
+        $k =~ s/\s*:\s*$//o; # kill colon (and possible spaces) at end, we add it later.
+        $mail{$k} = shift @_;
+    }
+
+    $smtp = $mail{'Smtp'} || $mail{'Server'} || $default_smtp_server;
+    unshift @{$mailcfg{'smtp'}}, $smtp if ($smtp and $mailcfg{'smtp'}->[0] ne $smtp);
+
+    # delete non-header keys, so we don't send them later as mail headers
+    # I like this syntax, but it doesn't seem to work with AS port 5.003_07:
+    # delete @mail{'Smtp', 'Server'};
+    # so instead:
+    delete $mail{'Smtp'}; delete $mail{'Server'};
+
+    $mailcfg{'port'} = $mail{'Port'} || $default_smtp_port || $mailcfg{'port'} || 25;
+    delete $mail{'Port'};
+
+    # for backward compatibility only
+    $mailcfg{'retries'} = $connect_retries if defined($connect_retries);
+    $mailcfg{'delay'} = $retry_delay if defined($retry_delay);
+
+    {    # don't warn for undefined values below
+        local $^W = 0;
+        $message = join("", $mail{'Message'}, $mail{'Body'}, $mail{'Text'});
+    }
+
+    # delete @mail{'Message', 'Body', 'Text'};
+    delete $mail{'Message'}; delete $mail{'Body'}; delete $mail{'Text'};
+
+    # Extract 'From:' e-mail address
+
+    $fromaddr = $mail{'From'} || $default_sender || $mailcfg{'from'};
+    unless ($fromaddr =~ /$address_rx/) {
+        return fail("Bad or missing From address: \'$fromaddr\'");
+    }
+    $fromaddr = $1;
+
+    # add Date header if needed
+    $mail{Date} ||= time_to_date() ;
+    $log .= "Date: $mail{Date}\n";
+
+    # cleanup message, and encode if needed
+    $message =~ s/^\./\.\./gom;     # handle . as first character
+    $message =~ s/\r\n/\n/go;     # normalize line endings, step 1 of 2 (next step after MIME encoding)
+
+    $mail{'Mime-version'} ||= '1.0';
+    $mail{'Content-type'} ||= 'text/plain; charset="iso-8859-1"';
+
+    unless ( $mail{'Content-transfer-encoding'}
+          || $mail{'Content-type'} =~ /multipart/io )
+    {
+        if ($mailcfg{'mime'}) {
+            $mail{'Content-transfer-encoding'} = 'quoted-printable';
+            $message = encode_qp($message);
+        }
+        else {
+            $mail{'Content-transfer-encoding'} = '8bit';
+            if ($message =~ /[\x80-\xFF]/o) {
+                $error .= "MIME::QuotedPrint not present!\nSending 8bit characters, hoping it will come across OK.\n";
+                warn "MIME::QuotedPrint not present!\n",
+                     "Sending 8bit characters, hoping it will come across OK.\n"
+                     if $^W;
+            }
+        }
+    }
+
+    $message =~ s/\n/\015\012/go; # normalize line endings, step 2.
+
+    # Get recipients
+    {    # don't warn for undefined values below
+        local $^W = 0;
+        $recip = join(", ", $mail{To}, $mail{Cc}, $mail{Bcc});
+    }
+
+    delete $mail{'Bcc'};
+
+    @recipients = ();
+    while ($recip =~ /$address_rx/go) {
+        push @recipients, $1;
+    }
+    unless (@recipients) {
+        return fail("No recipient!")
+    }
+
+    # get local hostname for polite HELO
+    $localhost = (gethostbyname('localhost'))[0] || 'localhost';
+
+    foreach $server ( @{$mailcfg{'smtp'}} ) {
+        # open socket needs to be inside this foreach loop on Linux,
+        # otherwise all servers fail if 1st one fails !??! why?
+        unless ( socket S, AF_INET, SOCK_STREAM, (getprotobyname 'tcp')[2] ) {
+            return fail("socket failed ($!)")
+        }
+
+        print "- trying $server\n" if $mailcfg{'debug'} > 1;
+
+        $server =~ s/\s+//go; # remove spaces just in case of a typo
+        # extract port if server name like "mail.domain.com:2525"
+        ($server =~ s/:(.+)$//o) ? $port = $1    : $port = $mailcfg{'port'};
+        $smtp = $server; # save $server for use outside foreach loop
+
+        my $smtpaddr = inet_aton $server;
+        unless ($smtpaddr) {
+            $error .= "$server not found\n";
+            next; # next server
+        }
+
+        my $retried = 0; # reset retries for each server
+        while ( ( not $connected = connect S, pack_sockaddr_in($port, $smtpaddr) )
+            and ( $retried < $mailcfg{'retries'} )
+              ) {
+            $retried++;
+            $error .= "connect to $server failed ($!)\n";
+            print "- connect to $server failed ($!)\n" if $mailcfg{'debug'} > 1;
+            print "retrying in $mailcfg{'delay'} seconds...\n";
+            sleep $mailcfg{'delay'};
+        }
+
+        if ( $connected ) {
+            print "- connected to $server\n" if $mailcfg{'debug'} > 3;
+            last;
+        }
+        else {
+            $error .= "connect to $server failed\n";
+            print "- connect to $server failed, next server...\n" if $mailcfg{'debug'} > 1;
+            next; # next server
+        }
+    }
+
+    unless ( $connected ) {
+        return fail("connect to $smtp failed ($!) no (more) retries!")
+    };
+
+    {
+        local $^W = 0; # don't warn on undefined variables
+        # Add info to log variable
+        $log .= "Server: $smtp Port: $port\n"
+              . "From: $fromaddr\n"
+              . "Subject: $mail{Subject}\n"
+              . "To: ";
+    }
+
+    my($oldfh) = select(S); $| = 1; select($oldfh);
+
+    chomp($_ = <S>);
+    if (/^[45]/ or !$_) {
+        return fail("Connection error from $smtp on port $port ($_)")
+    }
+
+    print S "HELO $localhost\015\012";
+    chomp($_ = <S>);
+    if (/^[45]/ or !$_) {
+        return fail("HELO error ($_)")
+    }
+    
+    print S "mail from: <$fromaddr>\015\012";
+    chomp($_ = <S>);
+    if (/^[45]/ or !$_) {
+        return fail("mail From: error ($_)")
+    }
+
+    foreach $to (@recipients) {
+        if ($debug) { print STDERR "sending to: <$to>\n"; }
+        print S "rcpt to: <$to>\015\012";
+        chomp($_ = <S>);
+        if (/^[45]/ or !$_) {
+            $log .= "!Failed: $to\n    ";
+            return fail("Error sending to <$to> ($_)\n");
+        }
+        else {
+            $log .= "$to\n    ";
+        }
+    }
+
+    # start data part
+    print S "data\015\012";
+    chomp($_ = <S>);
+    if (/^[45]/ or !$_) {
+           return fail("Cannot send data ($_)");
+    }
+
+    # print headers
+    foreach $header (keys %mail) {
+        $mail{$header} =~ s/\s+$//o; # kill possible trailing garbage
+        print S "$header: ", $mail{$header}, "\015\012";
+    };
+
+    #- test diconnecting from network here, to see what happens
+    #- print STDERR "DISCONNECT NOW!\n";
+    #- sleep 4;
+    #- print STDERR "trying to continue, expecting an error... \n";
+
+    # send message body
+    print S "\015\012",
+            $message,
+            "\015\012.\015\012";
+
+    chomp($_ = <S>);
+    if (/^[45]/ or !$_) {
+           return fail("message transmission failed ($_)");
+    }
+
+    # finish
+    print S "quit\015\012";
+    $_ = <S>;
+    close S;
+
+    return 1;
+} # end sub sendmail
+
+1;
+__END__
+
+=head1 SYNOPSIS
+
+  use Mail::Sendmail;
+
+  %mail = ( To      => 'you@there.com',
+            From    => 'me@here.com',
+            Message => "This is a very short message"
+           );
+
+  sendmail(%mail) or die $Mail::Sendmail::error;
+
+  print "OK. Log says:\n", $Mail::Sendmail::log;
+
+=head1 DESCRIPTION
+
+Simple platform independent e-mail from your perl script. Only requires
+Perl 5 and a network connection.
+
+After struggling for some time with various command-line mailing programs
+which never did exactly what I wanted, I put together this Perl only
+solution.
+
+Mail::Sendmail contains mainly &sendmail, which takes a hash with the
+message to send and sends it. It is intended to be very easy to setup and
+use.
+
+=head1 INSTALLATION
+
+=over 4
+
+=item Best
+
+perl -MCPAN -e "install Mail::Sendmail"
+
+=item Traditional
+
+    perl Makefile.PL
+    make
+    make test
+    make install
+
+=item Manual
+
+Copy Sendmail.pm to Mail/ in your Perl lib directory.
+
+    (eg. c:\Perl\lib\Mail\, c:\Perl\site\lib\Mail\,
+     /usr/lib/perl5/site_perl/Mail/, ... or whatever it
+     is on your system)
+
+=item ActivePerl's PPM
+
+ppm install --location=http://alma.ch/perl/ppm Mail-Sendmail
+
+But this way you don't get a chance to have a look at other files (Changes, 
+Todo, test.pl, ...) and PPM doesn't run the test script (test.pl).
+
+=back
+
+At the top of Sendmail.pm, set your default SMTP server, unless you specify
+it with each message, or want to use the default.
+
+Install MIME::QuotedPrint. This is not required but strongly recommended.
+
+=head1 FEATURES
+
+Automatic time zone detection, Date: header, MIME quoted-printable encoding 
+(if MIME::QuotedPrint installed), all of which can be overridden.
+
+Internal Bcc: and Cc: support (even on broken servers)
+
+Allows real names in From: and To: fields
+
+Doesn't send unwanted headers, and allows you to send any header(s) you
+want
+
+Configurable retries and use of alternate servers if your mail server is
+down
+
+Good plain text error reporting
+
+=head1 LIMITATIONS
+
+Doesn't work on OpenVMS.
+
+Headers are not encoded, even if they have accented characters.
+
+Since the whole message is in memory (twice!), it's not suitable for 
+sending very big attached files.
+
+The SMTP server has to be set manually in Sendmail.pm or in your script,
+unless you have a mail server on localhost.
+
+=head1 CONFIGURATION
+
+=over 4
+
+=item Default SMTP server(s)
+
+This is probably all you want to configure. It is usually done through
+I<$mailcfg{smtp}>, which you can edit at the top of the Sendmail.pm file.
+This is a reference to a list of SMTP servers. You can also set it from
+your script:
+
+C<unshift @{$Mail::Sendmail::mailcfg{'smtp'}} , 'my.mail.server';>
+
+Alternatively, you can specify the server in the I<%mail> hash you send
+from your script, which will do the same thing:
+
+C<$mail{smtp} = 'my.mail.server';>
+
+A future version will try to set useful defaults for you during the
+Makefile.PL.
+
+=item Other configuration settings
+
+See I<%mailcfg> under L<"DETAILS"> below for other configuration options.
+
+=back
+
+=head1 DETAILS
+
+=head2 sendmail()
+
+sendmail is the only thing exported to your namespace by default
+
+C<sendmail(%mail) || print "Error sending mail: $Mail::Sendmail::error\n";>
+
+It takes a hash containing the full message, with keys for all headers,
+body, and optionally for another non-default SMTP server and/or port.
+
+It returns 1 on success or 0 on error, and rewrites
+C<$Mail::Sendmail::error> and C<$Mail::Sendmail::log>.
+
+Keys are NOT case-sensitive.
+
+The colon after headers is not necessary.
+
+The Body part key can be called 'Body', 'Message' or 'Text'. The SMTP
+server key can be called 'Smtp' or 'Server'.
+
+The following headers are added unless you specify them yourself:
+
+    Mime-version: 1.0
+    Content-type: 'text/plain; charset="iso-8859-1"'
+
+    Content-transfer-encoding: quoted-printable
+    or (if MIME::QuotedPrint not installed)
+    Content-transfer-encoding: 8bit
+
+    Date: [string returned by time_to_date()]
+
+The following are not exported by default, but you can still access them
+with their full name, or request their export on the use line like in:
+C<use Mail::Sendmail qw($address_rx time_to_date);>
+
+=head2 Mail::Sendmail::time_to_date()
+
+convert time ( as from C<time()> ) to an RFC 822 compliant string for the
+Date header. See also L<"%Mail::Sendmail::mailcfg">.
+
+=head2 $Mail::Sendmail::error
+
+When you don't run with the B<-w> flag, the module sends no errors to
+STDERR, but puts anything it has to complain about in here. You should
+probably always check if it says something.
+
+=head2 $Mail::Sendmail::log
+
+A summary that you could write to a log file after each send
+
+=head2 $Mail::Sendmail::address_rx
+
+A handy regex to recognize e-mail addresses.
+
+A correct regex for valid e-mail addresses was written by one of the judges
+in the obfuscated Perl contest... :-) It is quite big. This one is an
+attempt to a reasonable compromise, and should accept all real-world
+internet style addresses. The domain part is required and comments or
+characters that would need to be quoted are not supported.
+
+  Example:
+    $rx = $Mail::Sendmail::address_rx;
+    if (/$rx/) {
+      $address=$1;
+      $user=$2;
+      $domain=$3;
+    }
+
+=head2 %Mail::Sendmail::mailcfg
+
+This hash contains all configuration options. You normally edit it once (if
+ever) in Sendmail.pm and forget about it, but you could also access it from
+your scripts. For readability, I'll assume you have imported it.
+
+The keys are not case-sensitive: they are all converted to lowercase before
+use. Writing C<$mailcfg{Port} = 2525;> is OK: the default $mailcfg{port}
+(25) will be deleted and replaced with your new value of 2525.
+
+=over 4
+
+=item $mailcfg{smtp}
+
+C<$mailcfg{smtp} = [qw(localhost my.other.mail.server)];>
+
+This is a reference to a list of smtp servers, so if your main server is
+down, the module tries the next one. If one of your servers uses a special
+port, add it to the server name with a colon in front, to override the
+default port (like in my.special.server:2525).
+
+Default: localhost. (the previous version also had smtp.site1.csi.com which
+was an open relay, but it isn't anymore)
+
+=item $mailcfg{from}
+
+C<$mailcfg{from} = 'Mailing script me@mydomain.com';>
+
+From address used if you don't supply one in your script. Should not be of
+type 'user@localhost' since that may not be valid on the recipient's
+host.
+
+Default: undefined.
+
+=item $mailcfg{mime}
+
+C<$mailcfg{mime} = 1;>
+
+Set this to 0 if you don't want any automatic MIME encoding. You normally
+don't need this, the module should 'Do the right thing' anyway.
+
+Default: 1;
+
+=item $mailcfg{retries}
+
+C<$mailcfg{retries} = 1;>
+
+How many times should the connection to the same SMTP server be retried in
+case of a failure.
+
+Default: 1;
+
+=item $mailcfg{delay}
+
+C<$mailcfg{delay} = 1;>
+
+Number of seconds to wait between retries. This delay also happens before
+trying the next server in the list, if the retries for the current server
+have been exhausted. For CGI scripts, you want few retries and short delays
+to return with a results page before the http connection times out. For
+unattended scripts, you may want to use many retries and long delays to
+have a good chance of your mail being sent even with temporary failures on
+your network.
+
+Default: 1 (second);
+
+=item $mailcfg{tz}
+
+C<$mailcfg{tz} = '+0800';>
+
+Normally, your time zone is set automatically, from the difference between
+C<time()> and C<gmtime()>. This allows you to override automatic detection
+in cases where your system is confused (such as some Win32 systems in zones
+which do not use daylight savings time: see Microsoft KB article Q148681)
+
+Default: undefined (automatic detection at run-time).
+
+=item $mailcfg{port}
+
+C<$mailcfg{port} = 25;>
+
+Port used when none is specified in the server name.
+
+Default: 25.
+
+=item $mailcfg{debug}
+
+C<$mailcfg{debug} => 0;>
+
+Prints stuff to STDERR. Not used much, and what is printed may change
+without notice. Don't count on it.
+
+Default: 0;
+
+=back
+
+=head2 $Mail::Sendmail::VERSION
+
+The package version number (you can not import this one)
+
+=head2 Configuration variables from previous versions
+
+The following global variables were used in version 0.74 for configuration. 
+They should still work, but will not in a future version (unless you 
+complain loudly). Please use I<%mailcfg> if you need to access the 
+configuration from your scripts.
+
+=over 4
+
+=item $Mail::Sendmail::default_smtp_server
+
+=item $Mail::Sendmail::default_smtp_port
+
+=item $Mail::Sendmail::default_sender
+
+=item $Mail::Sendmail::TZ
+
+=item $Mail::Sendmail::connect_retries
+
+=item $Mail::Sendmail::retry_delay
+
+=item $Mail::Sendmail::use_MIME
+
+This one couldn't really be used in the previous version, so I just dropped it.
+It is replaced by I<$mailcfg{mime}> which works.
+
+=back
+
+=head1 ANOTHER EXAMPLE
+
+  use Mail::Sendmail;
+
+  print "Testing Mail::Sendmail version $Mail::Sendmail::VERSION\n";
+  print "Default server: $Mail::Sendmail::mailcfg{smtp}->[0]\n";
+  print "Default sender: $Mail::Sendmail::mailcfg{from}\n";
+
+  %mail = (
+      #To      => 'No to field this time, only Bcc and Cc',
+      #From    => 'not needed, use default',
+      Bcc     => 'Someone <him@there.com>, Someone else her@there.com',
+      # only addresses are extracted from Bcc, real names disregarded
+      Cc      => 'Yet someone else <xz@whatever.com>',
+      # Cc will appear in the header. (Bcc will not)
+      Subject => 'Test message',
+      'X-Mailer' => "Mail::Sendmail version $Mail::Sendmail::VERSION",
+  );
+
+
+  $mail{Smtp} = 'special_server.for-this-message-only.domain.com';
+  $mail{'X-custom'} = 'My custom additionnal header';
+  $mail{'mESSaGE : '} = "The message key looks terrible, but works.";
+  # cheat on the date:
+  $mail{Date} = Mail::Sendmail::time_to_date( time() - 86400 ),
+
+  if (sendmail %mail) { print "Mail sent OK.\n" }
+  else { print "Error sending mail: $Mail::Sendmail::error \n" }
+
+  print "\n\$Mail::Sendmail::log says:\n", $Mail::Sendmail::log;
+
+=head1 CHANGES
+
+Single-letter host names bug fixed since version 0.77. See the F<Changes> file for
+the full history.
+
+=head1 AUTHOR
+
+Milivoj Ivkovic mi@alma.ch or ivkovic@bluewin.ch
+
+=head1 NOTES
+
+MIME::QuotedPrint is used by default on every message if available. It 
+allows reliable sending of accented characters, and also takes care of 
+too long lines (which can happen in HTML mails). It is available in the 
+MIME-Base64 package at http://www.perl.com/CPAN/modules/by-module/MIME/ or 
+through PPM.
+
+Look at http://alma.ch/perl/Mail-Sendmail-FAQ.htm for additional info 
+(CGI, examples of sending attachments, HTML mail etc...)
+
+You can use it freely. (Someone complained this is too vague. So, more
+precisely: do whatever you want with it, but be warned that terrible things
+will happen to you if you use it badly, like for sending spam, claiming you
+wrote it alone, or ...?)
+
+I would appreciate a short (or long) e-mail note if you use this (and even
+if you don't, especially if you care to say why). And of course,
+bug-reports and/or suggestions are welcome.
+
+Last revision: 25.09.2000. Latest version should be available at
+http://alma.ch/perl/mail.htm , and a few days later on CPAN.
+
+=cut
diff -ruN 4.0K-4b/library/additions/Mail/Sendmail.pm 5.0.000/library/additions/Mail/Sendmail.pm
--- 4.0K-4b/library/additions/Mail/Sendmail.pm	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/additions/Mail/Sendmail.pm	2006-10-31 09:40:27.000000000 -0600
@@ -1,15 +1,15 @@
 package Mail::Sendmail;
-# Mail::Sendmail by Milivoj Ivkovic <mi@alma.ch>
+# Mail::Sendmail by Milivoj Ivkovic <mi\x40alma.ch>
 # see embedded POD documentation after __END__
-# or http://alma.ch/perl/mail.htm
+# or http://alma.ch/perl/mail.html
 
 =head1 NAME
 
-Mail::Sendmail v. 0.78 - Simple platform independent mailer
+Mail::Sendmail v. 0.79 - Simple platform independent mailer
 
 =cut
 
-$VERSION = '0.78';
+$VERSION = '0.79';
 
 # *************** Configuration you may want to change *******************
 # You probably want to set your SMTP server here (unless you specify it in
@@ -42,11 +42,6 @@
             @EXPORT
             @EXPORT_OK
             %mailcfg
-            $default_smtp_server
-            $default_smtp_port
-            $default_sender
-            $TZ
-            $use_MIME
             $address_rx
             $debug
             $log
@@ -57,6 +52,7 @@
 
 use Socket;
 use Time::Local; # for automatic time zone detection
+use Sys::Hostname; # for use of hostname in HELO
 
 # use MIME::QuotedPrint if available and configured in %mailcfg
 eval("use MIME::QuotedPrint");
@@ -67,10 +63,6 @@
 @EXPORT_OK  = qw(
                  %mailcfg
                  time_to_date
-                 $default_smtp_server
-                 $default_smtp_port
-                 $default_sender
-                 $TZ
                  $address_rx
                  $debug
                  $log
@@ -80,7 +72,7 @@
 # regex for e-mail addresses where full=$1, user=$2, domain=$3
 # see pod documentation about this regex
 
-my $word_rx = '[\x21\x23-\x27\x2A-\x2B\x2D\w\x3D\x3F]+';
+my $word_rx = '[\x21\x23-\x27\x2A-\x2B\x2D\x2F\w\x3D\x3F]+';
 my $user_rx = $word_rx         # valid chars
              .'(?:\.' . $word_rx . ')*' # possibly more words preceded by a dot
              ;
@@ -88,7 +80,7 @@
 my $ip_rx = '\[\d{1,3}(?:\.\d{1,3}){3}\]';
 
 $address_rx = '((' . $user_rx . ')\@(' . $dom_rx . '|' . $ip_rx . '))';
-; # v. 0.6
+; # v. 0.61
 
 sub time_to_date {
     # convert a time() value to a date-time string according to RFC 822
@@ -101,12 +93,11 @@
     my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
         = localtime($time);
 
-    $TZ ||= $mailcfg{'tz'};
-
+    my $TZ = $mailcfg{'tz'};
     if ( $TZ eq "" ) {
         # offset in hours
         my $offset  = sprintf "%.1f", (timegm(localtime) - time) / 3600;
-        my $minutes = sprintf "%02d", ( $offset - int($offset) ) * 60;
+        my $minutes = sprintf "%02d", abs( $offset - int($offset) ) * 60;
         $TZ  = sprintf("%+03d", int($offset)) . $minutes;
     }
     return join(" ",
@@ -114,26 +105,27 @@
                      $mday,
                      $months[$mon],
                      $year+1900,
-                     sprintf("%02d", $hour) . ":" . sprintf("%02d", $min),
+                     sprintf("%02d:%02d:%02d", $hour, $min, $sec),
                      $TZ
                );
 } # end sub time_to_date
 
 sub sendmail {
-    # original sendmail 1.21 by Christian Mallwitz.
-    # Modified and 'modulized' by mi@alma.ch
 
     $error = '';
     $log = "Mail::Sendmail v. $VERSION - "    . scalar(localtime()) . "\n";
 
+    my $CRLF = "\015\012";
+    local $/ = $CRLF;
+    local $\ = ''; # to protect us from outside settings
     local $_;
-    local $/ = "\015\012";
 
     my (%mail, $k,
         $smtp, $server, $port, $connected, $localhost,
-        $message, $fromaddr, $recip, @recipients, $to, $header,
+        $fromaddr, $recip, @recipients, $to, $header,
        );
 
+    # -------- a few internal subs ----------
     sub fail {
         # things to do before returning a sendmail failure
         print STDERR @_ if $^W;
@@ -142,6 +134,38 @@
         return 0;
     }
 
+    sub socket_write {
+        my $i;
+        for $i (0..$#_) {
+            # accept references, so we don't copy potentially big data
+            my $data = ref($_[$i]) ? $_[$i] : \$_[$i];
+            if ($mailcfg{'debug'} > 5) {
+                if (length($$data) < 500) {
+                    print ">", $$data;
+                }
+                else {
+                    print "> [...", length($$data), " bytes sent ...]\n";
+                }
+            }
+            print(S $$data) || return 0;
+        }
+        1;
+    }
+
+    sub socket_read {
+        my $response; # for multi-line server responses
+        do {
+            chomp($_ = <S>);
+            print "<$_\n" if $mailcfg{'debug'} > 5;
+            if (/^[45]/ or !$_) {
+                return; # return false
+            }
+            $response .= $_;
+         } while (/^[\d]+-/);
+         return $response;
+    }
+    # -------- end of internal subs ----------
+
     # all config keys to lowercase, to prevent typo errors
     foreach $k (keys %mailcfg) {
         if ($k =~ /[A-Z]/) {
@@ -149,20 +173,24 @@
         }
     }
 
-    # redo hash, arranging keys case etc...
+    # redo mail hash, arranging keys case etc...
     while (@_) {
-        # arrange keys case
-        $k = ucfirst lc(shift @_);
-
+        $k = shift @_;
         if (!$k and $^W) {
             warn "Received false mail hash key: \'$k\'. Did you forget to put it in quotes?\n";
         }
 
+        # arrange keys case
+        $k = ucfirst lc($k);
+
         $k =~ s/\s*:\s*$//o; # kill colon (and possible spaces) at end, we add it later.
+        # uppercase also after "-", so people don't complain that headers case is different
+        # than in Outlook.
+        $k =~ s/-(.)/"-" . uc($1)/ge;
         $mail{$k} = shift @_;
     }
 
-    $smtp = $mail{'Smtp'} || $mail{'Server'} || $default_smtp_server;
+    $smtp = $mail{'Smtp'} || $mail{'Server'};
     unshift @{$mailcfg{'smtp'}}, $smtp if ($smtp and $mailcfg{'smtp'}->[0] ne $smtp);
 
     # delete non-header keys, so we don't send them later as mail headers
@@ -171,24 +199,21 @@
     # so instead:
     delete $mail{'Smtp'}; delete $mail{'Server'};
 
-    $mailcfg{'port'} = $mail{'Port'} || $default_smtp_port || $mailcfg{'port'} || 25;
+    $mailcfg{'port'} = $mail{'Port'} || $mailcfg{'port'} || 25;
     delete $mail{'Port'};
 
-    # for backward compatibility only
-    $mailcfg{'retries'} = $connect_retries if defined($connect_retries);
-    $mailcfg{'delay'} = $retry_delay if defined($retry_delay);
-
     {    # don't warn for undefined values below
         local $^W = 0;
-        $message = join("", $mail{'Message'}, $mail{'Body'}, $mail{'Text'});
+        $mail{'Message'} = join("", $mail{'Message'}, $mail{'Body'}, $mail{'Text'});
     }
 
-    # delete @mail{'Message', 'Body', 'Text'};
-    delete $mail{'Message'}; delete $mail{'Body'}; delete $mail{'Text'};
+    # delete @mail{'Body', 'Text'};
+    delete $mail{'Body'}; delete $mail{'Text'};
 
-    # Extract 'From:' e-mail address
+    # Extract 'From:' e-mail address to use as envelope sender
 
-    $fromaddr = $mail{'From'} || $default_sender || $mailcfg{'from'};
+    $fromaddr = $mail{'Sender'} || $mail{'From'} || $mailcfg{'from'};
+    delete $mail{'Sender'};
     unless ($fromaddr =~ /$address_rx/) {
         return fail("Bad or missing From address: \'$fromaddr\'");
     }
@@ -199,31 +224,31 @@
     $log .= "Date: $mail{Date}\n";
 
     # cleanup message, and encode if needed
-    $message =~ s/^\./\.\./gom;     # handle . as first character
-    $message =~ s/\r\n/\n/go;     # normalize line endings, step 1 of 2 (next step after MIME encoding)
+    $mail{'Message'} =~ s/\r\n/\n/go;     # normalize line endings, step 1 of 2 (next step after MIME encoding)
 
-    $mail{'Mime-version'} ||= '1.0';
-    $mail{'Content-type'} ||= 'text/plain; charset="iso-8859-1"';
+    $mail{'Mime-Version'} ||= '1.0';
+    $mail{'Content-Type'} ||= 'text/plain; charset="iso-8859-1"';
 
-    unless ( $mail{'Content-transfer-encoding'}
-          || $mail{'Content-type'} =~ /multipart/io )
+    unless ( $mail{'Content-Transfer-Encoding'}
+          || $mail{'Content-Type'} =~ /multipart/io )
     {
         if ($mailcfg{'mime'}) {
-            $mail{'Content-transfer-encoding'} = 'quoted-printable';
-            $message = encode_qp($message);
+            $mail{'Content-Transfer-Encoding'} = 'quoted-printable';
+            $mail{'Message'} = encode_qp($mail{'Message'});
         }
         else {
-            $mail{'Content-transfer-encoding'} = '8bit';
-            if ($message =~ /[\x80-\xFF]/o) {
+            $mail{'Content-Transfer-Encoding'} = '8bit';
+            if ($mail{'Message'} =~ /[\x80-\xFF]/o) {
                 $error .= "MIME::QuotedPrint not present!\nSending 8bit characters, hoping it will come across OK.\n";
                 warn "MIME::QuotedPrint not present!\n",
-                     "Sending 8bit characters, hoping it will come across OK.\n"
+                     "Sending 8bit characters without encoding, hoping it will come across OK.\n"
                      if $^W;
             }
         }
     }
 
-    $message =~ s/\n/\015\012/go; # normalize line endings, step 2.
+    $mail{'Message'} =~ s/^\./\.\./gom;     # handle . as first character
+    $mail{'Message'} =~ s/\n/$CRLF/go; # normalize line endings, step 2.
 
     # Get recipients
     {    # don't warn for undefined values below
@@ -242,12 +267,12 @@
     }
 
     # get local hostname for polite HELO
-    $localhost = (gethostbyname('localhost'))[0] || 'localhost';
+    $localhost = hostname() || 'localhost';
 
     foreach $server ( @{$mailcfg{'smtp'}} ) {
         # open socket needs to be inside this foreach loop on Linux,
         # otherwise all servers fail if 1st one fails !??! why?
-        unless ( socket S, AF_INET, SOCK_STREAM, (getprotobyname 'tcp')[2] ) {
+        unless ( socket S, AF_INET, SOCK_STREAM, scalar(getprotobyname 'tcp') ) {
             return fail("socket failed ($!)")
         }
 
@@ -255,7 +280,7 @@
 
         $server =~ s/\s+//go; # remove spaces just in case of a typo
         # extract port if server name like "mail.domain.com:2525"
-        ($server =~ s/:(.+)$//o) ? $port = $1    : $port = $mailcfg{'port'};
+        $port = ($server =~ s/:(\d+)$//o) ? $1 : $mailcfg{'port'};
         $smtp = $server; # save $server for use outside foreach loop
 
         my $smtpaddr = inet_aton $server;
@@ -271,7 +296,7 @@
             $retried++;
             $error .= "connect to $server failed ($!)\n";
             print "- connect to $server failed ($!)\n" if $mailcfg{'debug'} > 1;
-            print "retrying in $mailcfg{'delay'} seconds...\n";
+            print "retrying in $mailcfg{'delay'} seconds...\n" if $mailcfg{'debug'} > 1;
             sleep $mailcfg{'delay'};
         }
 
@@ -301,47 +326,38 @@
 
     my($oldfh) = select(S); $| = 1; select($oldfh);
 
-    chomp($_ = <S>);
-    if (/^[45]/ or !$_) {
-        return fail("Connection error from $smtp on port $port ($_)")
-    }
-
-    print S "HELO $localhost\015\012";
-    chomp($_ = <S>);
-    if (/^[45]/ or !$_) {
-        return fail("HELO error ($_)")
-    }
-    
-    print S "mail from: <$fromaddr>\015\012";
-    chomp($_ = <S>);
-    if (/^[45]/ or !$_) {
-        return fail("mail From: error ($_)")
-    }
+    socket_read()
+        || return fail("Connection error from $smtp on port $port ($_)");
+    socket_write("HELO $localhost$CRLF")
+        || return fail("send HELO error");
+    socket_read()
+        || return fail("HELO error ($_)");
+    socket_write("MAIL FROM: <$fromaddr>$CRLF")
+        || return fail("send MAIL FROM: error");
+    socket_read()
+        || return fail("MAIL FROM: error ($_)");
 
     foreach $to (@recipients) {
-        if ($debug) { print STDERR "sending to: <$to>\n"; }
-        print S "rcpt to: <$to>\015\012";
-        chomp($_ = <S>);
-        if (/^[45]/ or !$_) {
-            $log .= "!Failed: $to\n    ";
-            return fail("Error sending to <$to> ($_)\n");
-        }
-        else {
-            $log .= "$to\n    ";
-        }
+        socket_write("RCPT TO: <$to>$CRLF")
+            || return fail("send RCPT TO: error");
+        socket_read()
+            || return fail("RCPT TO: error ($_)");
+        $log .= "$to\n    ";
     }
 
     # start data part
-    print S "data\015\012";
-    chomp($_ = <S>);
-    if (/^[45]/ or !$_) {
-           return fail("Cannot send data ($_)");
-    }
+
+    socket_write("DATA$CRLF")
+        || return fail("send DATA error");
+    socket_read()
+        || return fail("DATA error ($_)");
 
     # print headers
     foreach $header (keys %mail) {
+        next if $header eq "Message";
         $mail{$header} =~ s/\s+$//o; # kill possible trailing garbage
-        print S "$header: ", $mail{$header}, "\015\012";
+        socket_write("$header: $mail{$header}$CRLF")
+            || return fail("send $header: error");
     };
 
     #- test diconnecting from network here, to see what happens
@@ -349,19 +365,17 @@
     #- sleep 4;
     #- print STDERR "trying to continue, expecting an error... \n";
 
-    # send message body
-    print S "\015\012",
-            $message,
-            "\015\012.\015\012";
-
-    chomp($_ = <S>);
-    if (/^[45]/ or !$_) {
-           return fail("message transmission failed ($_)");
-    }
+    # send message body (passed as a reference, in case it's big)
+    socket_write($CRLF, \$mail{'Message'}, "$CRLF.$CRLF")
+           || return fail("send message error");
+    socket_read()
+        || return fail("message transmission error ($_)");
+    $log .= "\nResult: $_";
 
     # finish
-    print S "quit\015\012";
-    $_ = <S>;
+    socket_write("QUIT$CRLF")
+           || return fail("send QUIT error");
+    socket_read();
     close S;
 
     return 1;
@@ -388,13 +402,9 @@
 Simple platform independent e-mail from your perl script. Only requires
 Perl 5 and a network connection.
 
-After struggling for some time with various command-line mailing programs
-which never did exactly what I wanted, I put together this Perl only
-solution.
-
 Mail::Sendmail contains mainly &sendmail, which takes a hash with the
 message to send and sends it. It is intended to be very easy to setup and
-use.
+use. See also L<"FEATURES"> below.
 
 =head1 INSTALLATION
 
@@ -402,7 +412,7 @@
 
 =item Best
 
-perl -MCPAN -e "install Mail::Sendmail"
+C<perl -MCPAN -e "install Mail::Sendmail">
 
 =item Traditional
 
@@ -415,35 +425,36 @@
 
 Copy Sendmail.pm to Mail/ in your Perl lib directory.
 
-    (eg. c:\Perl\lib\Mail\, c:\Perl\site\lib\Mail\,
-     /usr/lib/perl5/site_perl/Mail/, ... or whatever it
-     is on your system)
+    (eg. c:\Perl\site\lib\Mail\
+     or  /usr/lib/perl5/site_perl/Mail/
+     or whatever it is on your system.
+     They are listed when you type C< perl -V >)
 
 =item ActivePerl's PPM
 
 ppm install --location=http://alma.ch/perl/ppm Mail-Sendmail
 
-But this way you don't get a chance to have a look at other files (Changes, 
-Todo, test.pl, ...) and PPM doesn't run the test script (test.pl).
+But this way you don't get a chance to have a look at other files (Changes,
+Todo, test.pl, ...).
 
 =back
 
-At the top of Sendmail.pm, set your default SMTP server, unless you specify
-it with each message, or want to use the default.
+At the top of Sendmail.pm, set your default SMTP server(s), unless you specify
+it with each message, or want to use the default (localhost).
 
 Install MIME::QuotedPrint. This is not required but strongly recommended.
 
 =head1 FEATURES
 
-Automatic time zone detection, Date: header, MIME quoted-printable encoding 
+Automatic time zone detection, Date: header, MIME quoted-printable encoding
 (if MIME::QuotedPrint installed), all of which can be overridden.
 
-Internal Bcc: and Cc: support (even on broken servers)
+Bcc: and Cc: support.
 
-Allows real names in From: and To: fields
+Allows real names in From:, To: and Cc: fields
 
-Doesn't send unwanted headers, and allows you to send any header(s) you
-want
+Doesn't send an X-Mailer: header (unless you do), and allows you to send any
+header(s) you want.
 
 Configurable retries and use of alternate servers if your mail server is
 down
@@ -452,16 +463,18 @@
 
 =head1 LIMITATIONS
 
-Doesn't work on OpenVMS.
-
 Headers are not encoded, even if they have accented characters.
 
-Since the whole message is in memory (twice!), it's not suitable for 
+No suport for the SMTP AUTH extension.
+
+Since the whole message is in memory, it's not suitable for
 sending very big attached files.
 
 The SMTP server has to be set manually in Sendmail.pm or in your script,
 unless you have a mail server on localhost.
 
+Doesn't work on OpenVMS, I was told. Cannot test this myself.
+
 =head1 CONFIGURATION
 
 =over 4
@@ -480,8 +493,8 @@
 
 C<$mail{smtp} = 'my.mail.server';>
 
-A future version will try to set useful defaults for you during the
-Makefile.PL.
+A future version will (hopefully) try to set useful defaults for you
+during the Makefile.PL.
 
 =item Other configuration settings
 
@@ -507,23 +520,28 @@
 
 The colon after headers is not necessary.
 
-The Body part key can be called 'Body', 'Message' or 'Text'. The SMTP
-server key can be called 'Smtp' or 'Server'.
+The Body part key can be called 'Body', 'Message' or 'Text'.
+
+The SMTP server key can be called 'Smtp' or 'Server'. If the connection to
+this one fails, the other ones in C<$mailcfg{smtp}> will still be tried.
 
 The following headers are added unless you specify them yourself:
 
-    Mime-version: 1.0
-    Content-type: 'text/plain; charset="iso-8859-1"'
+    Mime-Version: 1.0
+    Content-Type: 'text/plain; charset="iso-8859-1"'
 
-    Content-transfer-encoding: quoted-printable
+    Content-Transfer-Encoding: quoted-printable
     or (if MIME::QuotedPrint not installed)
-    Content-transfer-encoding: 8bit
+    Content-Transfer-Encoding: 8bit
 
     Date: [string returned by time_to_date()]
 
+If you wish to use an envelope sender address different than the
+From: address, set C<$mail{Sender}> in your %mail hash.
+
 The following are not exported by default, but you can still access them
 with their full name, or request their export on the use line like in:
-C<use Mail::Sendmail qw($address_rx time_to_date);>
+C<use Mail::Sendmail qw(sendmail $address_rx time_to_date);>
 
 =head2 Mail::Sendmail::time_to_date()
 
@@ -562,7 +580,8 @@
 
 This hash contains all configuration options. You normally edit it once (if
 ever) in Sendmail.pm and forget about it, but you could also access it from
-your scripts. For readability, I'll assume you have imported it.
+your scripts. For readability, I'll assume you have imported it
+(with something like C<use Mail::Sendmail qw(sendmail %mailcfg)>).
 
 The keys are not case-sensitive: they are all converted to lowercase before
 use. Writing C<$mailcfg{Port} = 2525;> is OK: the default $mailcfg{port}
@@ -579,8 +598,7 @@
 port, add it to the server name with a colon in front, to override the
 default port (like in my.special.server:2525).
 
-Default: localhost. (the previous version also had smtp.site1.csi.com which
-was an open relay, but it isn't anymore)
+Default: localhost.
 
 =item $mailcfg{from}
 
@@ -645,10 +663,10 @@
 
 =item $mailcfg{debug}
 
-C<$mailcfg{debug} => 0;>
+C<$mailcfg{debug} = 0;>
 
-Prints stuff to STDERR. Not used much, and what is printed may change
-without notice. Don't count on it.
+Prints stuff to STDERR. Current maximum is 6, which prints the whole SMTP
+session, except data exceeding 500 bytes.
 
 Default: 0;
 
@@ -660,10 +678,10 @@
 
 =head2 Configuration variables from previous versions
 
-The following global variables were used in version 0.74 for configuration. 
-They should still work, but will not in a future version (unless you 
-complain loudly). Please use I<%mailcfg> if you need to access the 
-configuration from your scripts.
+The following global variables were used in version 0.74 for configuration.
+As from version 0.78_1, they are not supported anymore.
+Use the I<%mailcfg> hash if you need to access the configuration
+from your scripts.
 
 =over 4
 
@@ -681,9 +699,6 @@
 
 =item $Mail::Sendmail::use_MIME
 
-This one couldn't really be used in the previous version, so I just dropped it.
-It is replaced by I<$mailcfg{mime}> which works.
-
 =back
 
 =head1 ANOTHER EXAMPLE
@@ -710,43 +725,78 @@
   $mail{'X-custom'} = 'My custom additionnal header';
   $mail{'mESSaGE : '} = "The message key looks terrible, but works.";
   # cheat on the date:
-  $mail{Date} = Mail::Sendmail::time_to_date( time() - 86400 ),
+  $mail{Date} = Mail::Sendmail::time_to_date( time() - 86400 );
 
   if (sendmail %mail) { print "Mail sent OK.\n" }
   else { print "Error sending mail: $Mail::Sendmail::error \n" }
 
   print "\n\$Mail::Sendmail::log says:\n", $Mail::Sendmail::log;
+ 
+Also see http://alma.ch/perl/Mail-Sendmail-FAQ.html for examples
+of HTML mail and sending attachments. 
 
 =head1 CHANGES
 
-Single-letter host names bug fixed since version 0.77. See the F<Changes> file for
-the full history.
+Main changes since version 0.78:
+
+Added "/" (\x2F) as a valid character in mailbox part.
+
+Removed old configuration variables which are not used anymore
+since version 0.74.
+
+Added support for different envelope sender (through C<$mail{Sender}>)
+
+Changed case of headers: first character after "-" also uppercased
+
+Support for multi-line server responses
+
+Localized $\ and $_
+
+Some internal rewrites and documentation updates
+
+Fixed old bug of dot as 76th character on line disappearing.
+
+Fixed very old bug where port number was not extracted from
+stuff like 'my.server:2525'.
+
+Fixed time_to_date bug with negative half-hour zones (only Newfoundland?)
+
+Added seconds to date string
+
+Now uses Sys::Hostname to get the hostname for HELO. (This may break the
+module on some very old Win32 Perls where Sys::Hostname was broken)
+
+Enable full session output for debugging
+
+See the F<Changes> file for the full history. If you don't have it
+because you installed through PPM, you can also find the latest
+one on F<http://alma.ch/perl/scripts/Sendmail/Changes>.
 
 =head1 AUTHOR
 
-Milivoj Ivkovic mi@alma.ch or ivkovic@bluewin.ch
+Milivoj Ivkovic <mi\x40alma.ch> ("\x40" is "@" of course)
 
 =head1 NOTES
 
-MIME::QuotedPrint is used by default on every message if available. It 
-allows reliable sending of accented characters, and also takes care of 
-too long lines (which can happen in HTML mails). It is available in the 
-MIME-Base64 package at http://www.perl.com/CPAN/modules/by-module/MIME/ or 
+MIME::QuotedPrint is used by default on every message if available. It
+allows reliable sending of accented characters, and also takes care of
+too long lines (which can happen in HTML mails). It is available in the
+MIME-Base64 package at http://www.perl.com/CPAN/modules/by-module/MIME/ or
 through PPM.
 
-Look at http://alma.ch/perl/Mail-Sendmail-FAQ.htm for additional info 
-(CGI, examples of sending attachments, HTML mail etc...)
+Look at http://alma.ch/perl/Mail-Sendmail-FAQ.html for additional
+info (CGI, examples of sending attachments, HTML mail etc...)
 
-You can use it freely. (Someone complained this is too vague. So, more
-precisely: do whatever you want with it, but be warned that terrible things
-will happen to you if you use it badly, like for sending spam, claiming you
-wrote it alone, or ...?)
-
-I would appreciate a short (or long) e-mail note if you use this (and even
-if you don't, especially if you care to say why). And of course,
-bug-reports and/or suggestions are welcome.
+You can use this module freely. (Someone complained this is too vague.
+So, more precisely: do whatever you want with it, but be warned that
+terrible things will happen to you if you use it badly, like for sending
+spam, or ...?)
+
+Thanks to the many users who sent me feedback, bug reports, suggestions, etc.
+And please excuse me if I forgot to answer your mail. I am not always reliabe
+in answering mail. I intend to set up a mailing list soon.
 
-Last revision: 25.09.2000. Latest version should be available at
-http://alma.ch/perl/mail.htm , and a few days later on CPAN.
+Last revision: 06.02.2003. Latest version should be available on
+CPAN: F<http://www.cpan.org/modules/by-authors/id/M/MI/MIVKOVIC/>.
 
 =cut
diff -ruN 4.0K-4b/library/additions/XML/Simple.pm 5.0.000/library/additions/XML/Simple.pm
--- 4.0K-4b/library/additions/XML/Simple.pm	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/library/additions/XML/Simple.pm	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,3041 @@
+# $Id: Simple.pm,v 1.23 2005/01/29 04:16:10 grantm Exp $
+
+package XML::Simple;
+
+=head1 NAME
+
+XML::Simple - Easy API to maintain XML (esp config files)
+
+=head1 SYNOPSIS
+
+    use XML::Simple;
+
+    my $ref = XMLin([<xml file or string>] [, <options>]);
+
+    my $xml = XMLout($hashref [, <options>]);
+
+Or the object oriented way:
+
+    require XML::Simple;
+
+    my $xs = new XML::Simple(options);
+
+    my $ref = $xs->XMLin([<xml file or string>] [, <options>]);
+
+    my $xml = $xs->XMLout($hashref [, <options>]);
+
+(or see L<"SAX SUPPORT"> for 'the SAX way').
+
+To catch common errors:
+
+    use XML::Simple qw(:strict);
+
+(see L<"STRICT MODE"> for more details).
+
+=cut
+
+# See after __END__ for more POD documentation
+
+
+# Load essentials here, other modules loaded on demand later
+
+use strict;
+use Carp;
+require Exporter;
+
+
+##############################################################################
+# Define some constants
+#
+
+use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $PREFERRED_PARSER);
+
+@ISA               = qw(Exporter);
+@EXPORT            = qw(XMLin XMLout);
+@EXPORT_OK         = qw(xml_in xml_out);
+$VERSION           = '2.14';
+$PREFERRED_PARSER  = undef;
+
+my $StrictMode     = 0;
+my %CacheScheme    = (
+                       storable => [ \&StorableSave, \&StorableRestore ],
+                       memshare => [ \&MemShareSave, \&MemShareRestore ],
+                       memcopy  => [ \&MemCopySave,  \&MemCopyRestore  ]
+                     );
+
+my @KnownOptIn     = qw(keyattr keeproot forcecontent contentkey noattr
+                        searchpath forcearray cache suppressempty parseropts
+                        grouptags nsexpand datahandler varattr variables
+                        normalisespace normalizespace valueattr);
+
+my @KnownOptOut    = qw(keyattr keeproot contentkey noattr
+                        rootname xmldecl outputfile noescape suppressempty
+                        grouptags nsexpand handler noindent attrindent nosort
+                        valueattr numericescape);
+
+my @DefKeyAttr     = qw(name key id);
+my $DefRootName    = qq(opt);
+my $DefContentKey  = qq(content);
+my $DefXmlDecl     = qq(<?xml version='1.0' standalone='yes'?>);
+
+my $xmlns_ns       = 'http://www.w3.org/2000/xmlns/';
+my $bad_def_ns_jcn = '{' . $xmlns_ns . '}';     # LibXML::SAX workaround
+
+
+##############################################################################
+# Globals for use by caching routines
+#
+
+my %MemShareCache  = ();
+my %MemCopyCache   = ();
+
+
+##############################################################################
+# Wrapper for Exporter - handles ':strict'
+#
+
+sub import {
+
+  # Handle the :strict tag
+  
+  $StrictMode = 1 if grep(/^:strict$/, @_);
+
+  # Pass everything else to Exporter.pm
+
+  __PACKAGE__->export_to_level(1, grep(!/^:strict$/, @_));
+}
+
+
+##############################################################################
+# Constructor for optional object interface.
+#
+
+sub new {
+  my $class = shift;
+
+  if(@_ % 2) {
+    croak "Default options must be name=>value pairs (odd number supplied)";
+  }
+
+  my %known_opt;
+  @known_opt{@KnownOptIn, @KnownOptOut} = (undef) x 100;
+
+  my %raw_opt = @_;
+  my %def_opt;
+  while(my($key, $val) = each %raw_opt) {
+    my $lkey = lc($key);
+    $lkey =~ s/_//g;
+    croak "Unrecognised option: $key" unless(exists($known_opt{$lkey}));
+    $def_opt{$lkey} = $val;
+  }
+  my $self = { def_opt => \%def_opt };
+
+  return(bless($self, $class));
+}
+
+
+##############################################################################
+# Sub/Method: XMLin()
+#
+# Exported routine for slurping XML into a hashref - see pod for info.
+#
+# May be called as object method or as a plain function.
+#
+# Expects one arg for the source XML, optionally followed by a number of
+# name => value option pairs.
+#
+
+sub XMLin {
+
+  # If this is not a method call, create an object
+
+  my $self;
+  if($_[0]  and  UNIVERSAL::isa($_[0], 'XML::Simple')) {
+    $self = shift;
+  }
+  else {
+    $self = new XML::Simple();
+  }
+
+
+  my $string = shift;
+
+  $self->handle_options('in', @_);
+
+
+  # If no XML or filename supplied, look for scriptname.xml in script directory
+
+  unless(defined($string))  {
+    
+    # Translate scriptname[.suffix] to scriptname.xml
+
+    require File::Basename;
+
+    my($ScriptName, $ScriptDir, $Extension) =
+      File::Basename::fileparse($0, '\.[^\.]+');
+
+    $string = $ScriptName . '.xml';
+
+
+    # Add script directory to searchpath
+    
+    if($ScriptDir) {
+      unshift(@{$self->{opt}->{searchpath}}, $ScriptDir);
+    }
+  }
+  
+
+  # Are we parsing from a file?  If so, is there a valid cache available?
+
+  my($filename, $scheme);
+  unless($string =~ m{<.*?>}s  or  ref($string)  or  $string eq '-') {
+
+    require File::Basename;
+    require File::Spec;
+
+    $filename = $self->find_xml_file($string, @{$self->{opt}->{searchpath}});
+
+    if($self->{opt}->{cache}) {
+      foreach $scheme (@{$self->{opt}->{cache}}) {
+        croak "Unsupported caching scheme: $scheme"
+          unless($CacheScheme{$scheme});
+
+        my $opt = $CacheScheme{$scheme}->[1]->($filename);
+        return($opt) if($opt);
+      }
+    }
+  }
+  else {
+    delete($self->{opt}->{cache});
+    if($string eq '-') {
+      # Read from standard input
+
+      local($/) = undef;
+      $string = <STDIN>;
+    }
+  }
+
+
+  # Parsing is required, so let's get on with it
+
+  my $tree =  $self->build_tree($filename, $string);
+
+
+  # Now work some magic on the resulting parse tree
+
+  my($ref);
+  if($self->{opt}->{keeproot}) {
+    $ref = $self->collapse({}, @$tree);
+  }
+  else {
+    $ref = $self->collapse(@{$tree->[1]});
+  }
+
+  if($self->{opt}->{cache}) {
+    $CacheScheme{$self->{opt}->{cache}->[0]}->[0]->($ref, $filename);
+  }
+
+  return($ref);
+}
+
+
+##############################################################################
+# Method: build_tree()
+#
+# This routine will be called if there is no suitable pre-parsed tree in a
+# cache.  It parses the XML and returns an XML::Parser 'Tree' style data
+# structure (summarised in the comments for the collapse() routine below).
+#
+# XML::Simple requires the services of another module that knows how to
+# parse XML.  If XML::SAX is installed, the default SAX parser will be used,
+# otherwise XML::Parser will be used.
+#
+# This routine expects to be passed a 'string' as argument 1 or a filename as
+# argument 2.  The 'string' might be a string of XML or it might be a 
+# reference to an IO::Handle.  (This non-intuitive mess results in part from
+# the way XML::Parser works but that's really no excuse).
+#
+
+sub build_tree {
+  my $self     = shift;
+  my $filename = shift;
+  my $string   = shift;
+
+
+  my $preferred_parser = $PREFERRED_PARSER;
+  unless(defined($preferred_parser)) {
+    $preferred_parser = $ENV{XML_SIMPLE_PREFERRED_PARSER} || '';
+  }
+  if($preferred_parser eq 'XML::Parser') {
+    return($self->build_tree_xml_parser($filename, $string));
+  }
+
+  eval { require XML::SAX; };      # We didn't need it until now
+  if($@) {                         # No XML::SAX - fall back to XML::Parser
+    if($preferred_parser) {        # unless a SAX parser was expressly requested
+      croak "XMLin() could not load XML::SAX";
+    }
+    return($self->build_tree_xml_parser($filename, $string));
+  }
+
+  $XML::SAX::ParserPackage = $preferred_parser if($preferred_parser);
+
+  my $sp = XML::SAX::ParserFactory->parser(Handler => $self);
+  
+  $self->{nocollapse} = 1;
+  my($tree);
+  if($filename) {
+    $tree = $sp->parse_uri($filename);
+  }
+  else {
+    if(ref($string)) {
+      $tree = $sp->parse_file($string);
+    }
+    else {
+      $tree = $sp->parse_string($string);
+    }
+  }
+
+  return($tree);
+}
+
+
+##############################################################################
+# Method: build_tree_xml_parser()
+#
+# This routine will be called if XML::SAX is not installed, or if XML::Parser
+# was specifically requested.  It takes the same arguments as build_tree() and
+# returns the same data structure (XML::Parser 'Tree' style).
+#
+
+sub build_tree_xml_parser {
+  my $self     = shift;
+  my $filename = shift;
+  my $string   = shift;
+
+
+  eval {
+    local($^W) = 0;      # Suppress warning from Expat.pm re File::Spec::load()
+    require XML::Parser; # We didn't need it until now
+  };
+  if($@) {
+    croak "XMLin() requires either XML::SAX or XML::Parser";
+  }
+
+  if($self->{opt}->{nsexpand}) {
+    carp "'nsexpand' option requires XML::SAX";
+  }
+
+  my $xp = new XML::Parser(Style => 'Tree', @{$self->{opt}->{parseropts}});
+  my($tree);
+  if($filename) {
+    # $tree = $xp->parsefile($filename);  # Changed due to prob w/mod_perl
+    local(*XML_FILE);
+    open(XML_FILE, '<', $filename) || croak qq($filename - $!);
+    $tree = $xp->parse(*XML_FILE);
+    close(XML_FILE);
+  }
+  else {
+    $tree = $xp->parse($string);
+  }
+
+  return($tree);
+}
+
+
+##############################################################################
+# Sub: StorableSave()
+#
+# Wrapper routine for invoking Storable::nstore() to cache a parsed data
+# structure.
+#
+
+sub StorableSave {
+  my($data, $filename) = @_;
+
+  my $cachefile = $filename;
+  $cachefile =~ s{(\.xml)?$}{.stor};
+
+  require Storable;           # We didn't need it until now
+
+  if ('VMS' eq $^O) {
+    Storable::nstore($data, $cachefile);
+  }
+  else {
+    # If the following line fails for you, your Storable.pm is old - upgrade
+    Storable::lock_nstore($data, $cachefile);
+  }
+  
+}
+
+
+##############################################################################
+# Sub: StorableRestore()
+#
+# Wrapper routine for invoking Storable::retrieve() to read a cached parsed
+# data structure.  Only returns cached data if the cache file exists and is
+# newer than the source XML file.
+#
+
+sub StorableRestore {
+  my($filename) = @_;
+  
+  my $cachefile = $filename;
+  $cachefile =~ s{(\.xml)?$}{.stor};
+
+  return unless(-r $cachefile);
+  return unless((stat($cachefile))[9] > (stat($filename))[9]);
+
+  require Storable;           # We didn't need it until now
+  
+  if ('VMS' eq $^O) {
+    return(Storable::retrieve($cachefile));
+  }
+  else {
+    return(Storable::lock_retrieve($cachefile));
+  }
+  
+}
+
+
+##############################################################################
+# Sub: MemShareSave()
+#
+# Takes the supplied data structure reference and stores it away in a global
+# hash structure.
+#
+
+sub MemShareSave {
+  my($data, $filename) = @_;
+
+  $MemShareCache{$filename} = [time(), $data];
+}
+
+
+##############################################################################
+# Sub: MemShareRestore()
+#
+# Takes a filename and looks in a global hash for a cached parsed version.
+#
+
+sub MemShareRestore {
+  my($filename) = @_;
+  
+  return unless($MemShareCache{$filename});
+  return unless($MemShareCache{$filename}->[0] > (stat($filename))[9]);
+
+  return($MemShareCache{$filename}->[1]);
+  
+}
+
+
+##############################################################################
+# Sub: MemCopySave()
+#
+# Takes the supplied data structure and stores a copy of it in a global hash
+# structure.
+#
+
+sub MemCopySave {
+  my($data, $filename) = @_;
+
+  require Storable;           # We didn't need it until now
+  
+  $MemCopyCache{$filename} = [time(), Storable::dclone($data)];
+}
+
+
+##############################################################################
+# Sub: MemCopyRestore()
+#
+# Takes a filename and looks in a global hash for a cached parsed version.
+# Returns a reference to a copy of that data structure.
+#
+
+sub MemCopyRestore {
+  my($filename) = @_;
+  
+  return unless($MemCopyCache{$filename});
+  return unless($MemCopyCache{$filename}->[0] > (stat($filename))[9]);
+
+  return(Storable::dclone($MemCopyCache{$filename}->[1]));
+  
+}
+
+
+##############################################################################
+# Sub/Method: XMLout()
+#
+# Exported routine for 'unslurping' a data structure out to XML.
+#
+# Expects a reference to a data structure and an optional list of option
+# name => value pairs.
+#
+
+sub XMLout {
+
+  # If this is not a method call, create an object
+
+  my $self;
+  if($_[0]  and  UNIVERSAL::isa($_[0], 'XML::Simple')) {
+    $self = shift;
+  }
+  else {
+    $self = new XML::Simple();
+  }
+
+  croak "XMLout() requires at least one argument" unless(@_);
+  my $ref = shift;
+
+  $self->handle_options('out', @_);
+
+
+  # If namespace expansion is set, XML::NamespaceSupport is required
+
+  if($self->{opt}->{nsexpand}) {
+    require XML::NamespaceSupport;
+    $self->{nsup} = XML::NamespaceSupport->new();
+    $self->{ns_prefix} = 'aaa';
+  }
+
+
+  # Wrap top level arrayref in a hash
+
+  if(UNIVERSAL::isa($ref, 'ARRAY')) {
+    $ref = { anon => $ref };
+  }
+
+
+  # Extract rootname from top level hash if keeproot enabled
+
+  if($self->{opt}->{keeproot}) {
+    my(@keys) = keys(%$ref);
+    if(@keys == 1) {
+      $ref = $ref->{$keys[0]};
+      $self->{opt}->{rootname} = $keys[0];
+    }
+  }
+  
+  # Ensure there are no top level attributes if we're not adding root elements
+
+  elsif($self->{opt}->{rootname} eq '') {
+    if(UNIVERSAL::isa($ref, 'HASH')) {
+      my $refsave = $ref;
+      $ref = {};
+      foreach (keys(%$refsave)) {
+        if(ref($refsave->{$_})) {
+          $ref->{$_} = $refsave->{$_};
+        }
+        else {
+          $ref->{$_} = [ $refsave->{$_} ];
+        }
+      }
+    }
+  }
+
+
+  # Encode the hashref and write to file if necessary
+
+  $self->{_ancestors} = [];
+  my $xml = $self->value_to_xml($ref, $self->{opt}->{rootname}, '');
+  delete $self->{_ancestors};
+
+  if($self->{opt}->{xmldecl}) {
+    $xml = $self->{opt}->{xmldecl} . "\n" . $xml;
+  }
+
+  if($self->{opt}->{outputfile}) {
+    if(ref($self->{opt}->{outputfile})) {
+      return($self->{opt}->{outputfile}->print($xml));
+    }
+    else {
+      local(*OUT);
+      open(OUT, '>', "$self->{opt}->{outputfile}") ||
+        croak "open($self->{opt}->{outputfile}): $!";
+      binmode(OUT, ':utf8') if($] >= 5.008);
+      print OUT $xml || croak "print: $!";
+      close(OUT);
+    }
+  }
+  elsif($self->{opt}->{handler}) {
+    require XML::SAX;
+    my $sp = XML::SAX::ParserFactory->parser(
+               Handler => $self->{opt}->{handler}
+             );
+    return($sp->parse_string($xml));
+  }
+  else {
+    return($xml);
+  }
+}
+
+
+##############################################################################
+# Method: handle_options()
+#
+# Helper routine for both XMLin() and XMLout().  Both routines handle their
+# first argument and assume all other args are options handled by this routine.
+# Saves a hash of options in $self->{opt}.
+#
+# If default options were passed to the constructor, they will be retrieved
+# here and merged with options supplied to the method call.
+#
+# First argument should be the string 'in' or the string 'out'.
+#
+# Remaining arguments should be name=>value pairs.  Sets up default values
+# for options not supplied.  Unrecognised options are a fatal error.
+#
+
+sub handle_options  {
+  my $self = shift;
+  my $dirn = shift;
+
+
+  # Determine valid options based on context
+
+  my %known_opt; 
+  if($dirn eq 'in') {
+    @known_opt{@KnownOptIn} = @KnownOptIn;
+  }
+  else {
+    @known_opt{@KnownOptOut} = @KnownOptOut;
+  }
+
+
+  # Store supplied options in hashref and weed out invalid ones
+
+  if(@_ % 2) {
+    croak "Options must be name=>value pairs (odd number supplied)";
+  }
+  my %raw_opt  = @_;
+  my $opt      = {};
+  $self->{opt} = $opt;
+
+  while(my($key, $val) = each %raw_opt) {
+    my $lkey = lc($key);
+    $lkey =~ s/_//g;
+    croak "Unrecognised option: $key" unless($known_opt{$lkey});
+    $opt->{$lkey} = $val;
+  }
+
+
+  # Merge in options passed to constructor
+
+  foreach (keys(%known_opt)) {
+    unless(exists($opt->{$_})) {
+      if(exists($self->{def_opt}->{$_})) {
+        $opt->{$_} = $self->{def_opt}->{$_};
+      }
+    }
+  }
+
+
+  # Set sensible defaults if not supplied
+  
+  if(exists($opt->{rootname})) {
+    unless(defined($opt->{rootname})) {
+      $opt->{rootname} = '';
+    }
+  }
+  else {
+    $opt->{rootname} = $DefRootName;
+  }
+  
+  if($opt->{xmldecl}  and  $opt->{xmldecl} eq '1') {
+    $opt->{xmldecl} = $DefXmlDecl;
+  }
+
+  if(exists($opt->{contentkey})) {
+    if($opt->{contentkey} =~ m{^-(.*)$}) {
+      $opt->{contentkey} = $1;
+      $opt->{collapseagain} = 1;
+    }
+  }
+  else {
+    $opt->{contentkey} = $DefContentKey;
+  }
+
+  unless(exists($opt->{normalisespace})) {
+    $opt->{normalisespace} = $opt->{normalizespace};
+  }
+  $opt->{normalisespace} = 0 unless(defined($opt->{normalisespace}));
+
+  # Cleanups for values assumed to be arrays later
+
+  if($opt->{searchpath}) {
+    unless(ref($opt->{searchpath})) {
+      $opt->{searchpath} = [ $opt->{searchpath} ];
+    }
+  }
+  else  {
+    $opt->{searchpath} = [ ];
+  }
+
+  if($opt->{cache}  and !ref($opt->{cache})) {
+    $opt->{cache} = [ $opt->{cache} ];
+  }
+  if($opt->{cache}) {
+    $_ = lc($_) foreach (@{$opt->{cache}});
+  }
+  
+  if(exists($opt->{parseropts})) {
+    if($^W) {
+      carp "Warning: " .
+           "'ParserOpts' is deprecated, contact the author if you need it";
+    }
+  }
+  else {
+    $opt->{parseropts} = [ ];
+  }
+
+  
+  # Special cleanup for {forcearray} which could be regex, arrayref or boolean
+  # or left to default to 0
+
+  if(exists($opt->{forcearray})) {
+    if(ref($opt->{forcearray}) eq 'Regexp') {
+      $opt->{forcearray} = [ $opt->{forcearray} ];
+    }
+
+    if(ref($opt->{forcearray}) eq 'ARRAY') {
+      my @force_list = @{$opt->{forcearray}};
+      if(@force_list) {
+        $opt->{forcearray} = {};
+        foreach my $tag (@force_list) {
+          if(ref($tag) eq 'Regexp') {
+            push @{$opt->{forcearray}->{_regex}}, $tag;
+          }
+          else {
+            $opt->{forcearray}->{$tag} = 1;
+          }
+        }
+      }
+      else {
+        $opt->{forcearray} = 0;
+      }
+    }
+    else {
+      $opt->{forcearray} = ( $opt->{forcearray} ? 1 : 0 );
+    }
+  }
+  else {
+    if($StrictMode  and  $dirn eq 'in') {
+      croak "No value specified for 'ForceArray' option in call to XML$dirn()";
+    }
+    $opt->{forcearray} = 0;
+  }
+
+
+  # Special cleanup for {keyattr} which could be arrayref or hashref or left
+  # to default to arrayref
+
+  if(exists($opt->{keyattr}))  {
+    if(ref($opt->{keyattr})) {
+      if(ref($opt->{keyattr}) eq 'HASH') {
+
+        # Make a copy so we can mess with it
+
+        $opt->{keyattr} = { %{$opt->{keyattr}} };
+
+        
+        # Convert keyattr => { elem => '+attr' }
+        # to keyattr => { elem => [ 'attr', '+' ] } 
+
+        foreach my $el (keys(%{$opt->{keyattr}})) {
+          if($opt->{keyattr}->{$el} =~ /^(\+|-)?(.*)$/) {
+            $opt->{keyattr}->{$el} = [ $2, ($1 ? $1 : '') ];
+            if($StrictMode  and  $dirn eq 'in') {
+              next if($opt->{forcearray} == 1);
+              next if(ref($opt->{forcearray}) eq 'HASH'
+                      and $opt->{forcearray}->{$el});
+              croak "<$el> set in KeyAttr but not in ForceArray";
+            }
+          }
+          else {
+            delete($opt->{keyattr}->{$el}); # Never reached (famous last words?)
+          }
+        }
+      }
+      else {
+        if(@{$opt->{keyattr}} == 0) {
+          delete($opt->{keyattr});
+        }
+      }
+    }
+    else {
+      $opt->{keyattr} = [ $opt->{keyattr} ];
+    }
+  }
+  else  {
+    if($StrictMode) {
+      croak "No value specified for 'KeyAttr' option in call to XML$dirn()";
+    }
+    $opt->{keyattr} = [ @DefKeyAttr ];
+  }
+
+
+  # Special cleanup for {valueattr} which could be arrayref or hashref
+
+  if(exists($opt->{valueattr})) {
+    if(ref($opt->{valueattr}) eq 'ARRAY') {
+      $opt->{valueattrlist} = {};
+      $opt->{valueattrlist}->{$_} = 1 foreach(@{ delete $opt->{valueattr} });
+    }
+  }
+
+  # make sure there's nothing weird in {grouptags}
+
+  if($opt->{grouptags} and !UNIVERSAL::isa($opt->{grouptags}, 'HASH')) {
+    croak "Illegal value for 'GroupTags' option - expected a hashref";
+  }
+
+
+  # Check the {variables} option is valid and initialise variables hash
+
+  if($opt->{variables} and !UNIVERSAL::isa($opt->{variables}, 'HASH')) {
+    croak "Illegal value for 'Variables' option - expected a hashref";
+  }
+
+  if($opt->{variables}) { 
+    $self->{_var_values} = { %{$opt->{variables}} };
+  }
+  elsif($opt->{varattr}) { 
+    $self->{_var_values} = {};
+  }
+
+}
+
+
+##############################################################################
+# Method: find_xml_file()
+#
+# Helper routine for XMLin().
+# Takes a filename, and a list of directories, attempts to locate the file in
+# the directories listed.
+# Returns a full pathname on success; croaks on failure.
+#
+
+sub find_xml_file  {
+  my $self = shift;
+  my $file = shift;
+  my @search_path = @_;
+
+
+  my($filename, $filedir) =
+    File::Basename::fileparse($file);
+
+  if($filename ne $file) {        # Ignore searchpath if dir component
+    return($file) if(-e $file);
+  }
+  else {
+    my($path);
+    foreach $path (@search_path)  {
+      my $fullpath = File::Spec->catfile($path, $file);
+      return($fullpath) if(-e $fullpath);
+    }
+  }
+
+  # If user did not supply a search path, default to current directory
+
+  if(!@search_path) {
+    return($file) if(-e $file);
+    croak "File does not exist: $file";
+  }
+
+  croak "Could not find $file in ", join(':', @search_path);
+}
+
+
+##############################################################################
+# Method: collapse()
+#
+# Helper routine for XMLin().  This routine really comprises the 'smarts' (or
+# value add) of this module.
+#
+# Takes the parse tree that XML::Parser produced from the supplied XML and
+# recurses through it 'collapsing' unnecessary levels of indirection (nested
+# arrays etc) to produce a data structure that is easier to work with.
+#
+# Elements in the original parser tree are represented as an element name
+# followed by an arrayref.  The first element of the array is a hashref
+# containing the attributes.  The rest of the array contains a list of any
+# nested elements as name+arrayref pairs:
+#
+#  <element name>, [ { <attribute hashref> }, <element name>, [ ... ], ... ]
+#
+# The special element name '0' (zero) flags text content.
+#
+# This routine cuts down the noise by discarding any text content consisting of
+# only whitespace and then moves the nested elements into the attribute hash
+# using the name of the nested element as the hash key and the collapsed
+# version of the nested element as the value.  Multiple nested elements with
+# the same name will initially be represented as an arrayref, but this may be
+# 'folded' into a hashref depending on the value of the keyattr option.
+#
+
+sub collapse {
+  my $self = shift;
+
+
+  # Start with the hash of attributes
+  
+  my $attr  = shift;
+  if($self->{opt}->{noattr}) {                    # Discard if 'noattr' set
+    $attr = {};
+  }
+  elsif($self->{opt}->{normalisespace} == 2) {
+    while(my($key, $value) = each %$attr) {
+      $attr->{$key} = $self->normalise_space($value)
+    }
+  }
+
+
+  # Do variable substitutions
+
+  if(my $var = $self->{_var_values}) {
+    while(my($key, $val) = each(%$attr)) {
+      $val =~ s{\$\{(\w+)\}}{ $self->get_var($1) }ge;
+      $attr->{$key} = $val;
+    }
+  }
+
+
+  # Roll up 'value' attributes (but only if no nested elements)
+
+  if(!@_  and  keys %$attr == 1) {
+    my($k) = keys %$attr;
+    if($self->{opt}->{valueattrlist}  and $self->{opt}->{valueattrlist}->{$k}) {
+      return $attr->{$k};
+    }
+  }
+
+
+  # Add any nested elements
+
+  my($key, $val);
+  while(@_) {
+    $key = shift;
+    $val = shift;
+
+    if(ref($val)) {
+      $val = $self->collapse(@$val);
+      next if(!defined($val)  and  $self->{opt}->{suppressempty});
+    }
+    elsif($key eq '0') {
+      next if($val =~ m{^\s*$}s);  # Skip all whitespace content
+
+      $val = $self->normalise_space($val)
+        if($self->{opt}->{normalisespace} == 2);
+
+      # do variable substitutions
+
+      if(my $var = $self->{_var_values}) { 
+        $val =~ s{\$\{(\w+)\}}{ $self->get_var($1) }ge;
+      }
+
+      
+      # look for variable definitions
+
+      if(my $var = $self->{opt}->{varattr}) { 
+        if(exists $attr->{$var}) {
+          $self->set_var($attr->{$var}, $val);
+        }
+      }
+
+
+      # Collapse text content in element with no attributes to a string
+
+      if(!%$attr  and  !@_) {
+        return($self->{opt}->{forcecontent} ? 
+          { $self->{opt}->{contentkey} => $val } : $val
+        );
+      }
+      $key = $self->{opt}->{contentkey};
+    }
+
+
+    # Combine duplicate attributes into arrayref if required
+
+    if(exists($attr->{$key})) {
+      if(UNIVERSAL::isa($attr->{$key}, 'ARRAY')) {
+        push(@{$attr->{$key}}, $val);
+      }
+      else {
+        $attr->{$key} = [ $attr->{$key}, $val ];
+      }
+    }
+    elsif(defined($val)  and  UNIVERSAL::isa($val, 'ARRAY')) {
+      $attr->{$key} = [ $val ];
+    }
+    else {
+      if( $key ne $self->{opt}->{contentkey} 
+          and (
+            ($self->{opt}->{forcearray} == 1)
+            or ( 
+              (ref($self->{opt}->{forcearray}) eq 'HASH')
+              and (
+                $self->{opt}->{forcearray}->{$key}
+                or (grep $key =~ $_, @{$self->{opt}->{forcearray}->{_regex}})
+              )
+            )
+          )
+        ) {
+        $attr->{$key} = [ $val ];
+      }
+      else {
+        $attr->{$key} = $val;
+      }
+    }
+
+  }
+
+
+  # Turn arrayrefs into hashrefs if key fields present
+
+  if($self->{opt}->{keyattr}) {
+    while(($key,$val) = each %$attr) {
+      if(defined($val)  and  UNIVERSAL::isa($val, 'ARRAY')) {
+        $attr->{$key} = $self->array_to_hash($key, $val);
+      }
+    }
+  }
+
+
+  # disintermediate grouped tags
+
+  if($self->{opt}->{grouptags}) {
+    while(my($key, $val) = each(%$attr)) {
+      next unless(UNIVERSAL::isa($val, 'HASH') and (keys %$val == 1));
+      next unless(exists($self->{opt}->{grouptags}->{$key}));
+
+      my($child_key, $child_val) =  %$val;
+
+      if($self->{opt}->{grouptags}->{$key} eq $child_key) {
+        $attr->{$key}= $child_val;
+      }
+    }
+  }
+
+
+  # Fold hashes containing a single anonymous array up into just the array
+
+  my $count = scalar keys %$attr;
+  if($count == 1 
+     and  exists $attr->{anon}  
+     and  UNIVERSAL::isa($attr->{anon}, 'ARRAY')
+  ) {
+    return($attr->{anon});
+  }
+
+
+  # Do the right thing if hash is empty, otherwise just return it
+
+  if(!%$attr  and  exists($self->{opt}->{suppressempty})) {
+    if(defined($self->{opt}->{suppressempty})  and
+       $self->{opt}->{suppressempty} eq '') {
+      return('');
+    }
+    return(undef);
+  }
+
+
+  # Roll up named elements with named nested 'value' attributes
+
+  if($self->{opt}->{valueattr}) {
+    while(my($key, $val) = each(%$attr)) {
+      next unless($self->{opt}->{valueattr}->{$key});
+      next unless(UNIVERSAL::isa($val, 'HASH') and (keys %$val == 1));
+      my($k) = keys %$val;
+      next unless($k eq $self->{opt}->{valueattr}->{$key});
+      $attr->{$key} = $val->{$k};
+    }
+  }
+
+  return($attr)
+
+}
+
+
+##############################################################################
+# Method: set_var()
+#
+# Called when a variable definition is encountered in the XML.  (A variable
+# definition looks like <element attrname="name">value</element> where attrname
+# matches the varattr setting).
+#
+
+sub set_var {
+  my($self, $name, $value) = @_;
+
+  $self->{_var_values}->{$name} = $value;
+}
+
+
+##############################################################################
+# Method: get_var()
+#
+# Called during variable substitution to get the value for the named variable.
+#
+
+sub get_var {
+  my($self, $name) = @_;
+
+  my $value = $self->{_var_values}->{$name};
+  return $value if(defined($value));
+
+  return '${' . $name . '}';
+}
+
+
+##############################################################################
+# Method: normalise_space()
+#
+# Strips leading and trailing whitespace and collapses sequences of whitespace
+# characters to a single space.
+#
+
+sub normalise_space {
+  my($self, $text) = @_;
+
+  $text =~ s/^\s+//s;
+  $text =~ s/\s+$//s;
+  $text =~ s/\s\s+/ /sg;
+
+  return $text;
+}
+
+
+##############################################################################
+# Method: array_to_hash()
+#
+# Helper routine for collapse().
+# Attempts to 'fold' an array of hashes into an hash of hashes.  Returns a
+# reference to the hash on success or the original array if folding is
+# not possible.  Behaviour is controlled by 'keyattr' option.
+#
+
+sub array_to_hash {
+  my $self     = shift;
+  my $name     = shift;
+  my $arrayref = shift;
+
+  my $hashref  = {};
+
+  my($i, $key, $val, $flag);
+
+
+  # Handle keyattr => { .... }
+
+  if(ref($self->{opt}->{keyattr}) eq 'HASH') {
+    return($arrayref) unless(exists($self->{opt}->{keyattr}->{$name}));
+    ($key, $flag) = @{$self->{opt}->{keyattr}->{$name}};
+    for($i = 0; $i < @$arrayref; $i++)  {
+      if(UNIVERSAL::isa($arrayref->[$i], 'HASH') and
+         exists($arrayref->[$i]->{$key})
+      ) {
+        $val = $arrayref->[$i]->{$key};
+        if(ref($val)) {
+          if($StrictMode) {
+            croak "<$name> element has non-scalar '$key' key attribute";
+          }
+          if($^W) {
+            carp "Warning: <$name> element has non-scalar '$key' key attribute";
+          }
+          return($arrayref);
+        }
+        $val = $self->normalise_space($val)
+          if($self->{opt}->{normalisespace} == 1);
+        $hashref->{$val} = { %{$arrayref->[$i]} };
+        $hashref->{$val}->{"-$key"} = $hashref->{$val}->{$key} if($flag eq '-');
+        delete $hashref->{$val}->{$key} unless($flag eq '+');
+      }
+      else {
+        croak "<$name> element has no '$key' key attribute" if($StrictMode);
+        carp "Warning: <$name> element has no '$key' key attribute" if($^W);
+        return($arrayref);
+      }
+    }
+  }
+
+
+  # Or assume keyattr => [ .... ]
+
+  else {
+    ELEMENT: for($i = 0; $i < @$arrayref; $i++)  {
+      return($arrayref) unless(UNIVERSAL::isa($arrayref->[$i], 'HASH'));
+
+      foreach $key (@{$self->{opt}->{keyattr}}) {
+        if(defined($arrayref->[$i]->{$key}))  {
+          $val = $arrayref->[$i]->{$key};
+          return($arrayref) if(ref($val));
+          $val = $self->normalise_space($val)
+            if($self->{opt}->{normalisespace} == 1);
+          $hashref->{$val} = { %{$arrayref->[$i]} };
+          delete $hashref->{$val}->{$key};
+          next ELEMENT;
+        }
+      }
+
+      return($arrayref);    # No keyfield matched
+    }
+  }
+  
+  # collapse any hashes which now only have a 'content' key
+
+  if($self->{opt}->{collapseagain}) {
+    $hashref = $self->collapse_content($hashref);
+  }
+ 
+  return($hashref);
+}
+
+
+##############################################################################
+# Method: collapse_content()
+#
+# Helper routine for array_to_hash
+# 
+# Arguments expected are:
+# - an XML::Simple object
+# - a hasref
+# the hashref is a former array, turned into a hash by array_to_hash because
+# of the presence of key attributes
+# at this point collapse_content avoids over-complicated structures like
+# dir => { libexecdir    => { content => '$exec_prefix/libexec' },
+#          localstatedir => { content => '$prefix' },
+#        }
+# into
+# dir => { libexecdir    => '$exec_prefix/libexec',
+#          localstatedir => '$prefix',
+#        }
+
+sub collapse_content {
+  my $self       = shift;
+  my $hashref    = shift; 
+
+  my $contentkey = $self->{opt}->{contentkey};
+
+  # first go through the values,checking that they are fit to collapse
+  foreach my $val (values %$hashref) {
+    return $hashref unless (     (ref($val) eq 'HASH')
+                             and (keys %$val == 1)
+                             and (exists $val->{$contentkey})
+                           );
+  }
+
+  # now collapse them
+  foreach my $key (keys %$hashref) {
+    $hashref->{$key}=  $hashref->{$key}->{$contentkey};
+  }
+
+  return $hashref;
+}
+  
+
+##############################################################################
+# Method: value_to_xml()
+#
+# Helper routine for XMLout() - recurses through a data structure building up
+# and returning an XML representation of that structure as a string.
+# 
+# Arguments expected are:
+# - the data structure to be encoded (usually a reference)
+# - the XML tag name to use for this item
+# - a string of spaces for use as the current indent level
+#
+
+sub value_to_xml {
+  my $self = shift;;
+
+
+  # Grab the other arguments
+
+  my($ref, $name, $indent) = @_;
+
+  my $named = (defined($name) and $name ne '' ? 1 : 0);
+
+  my $nl = "\n";
+
+  my $is_root = $indent eq '' ? 1 : 0;   # Warning, dirty hack!
+  if($self->{opt}->{noindent}) {
+    $indent = '';
+    $nl     = '';
+  }
+
+
+  # Convert to XML
+  
+  if(ref($ref)) {
+    croak "circular data structures not supported"
+      if(grep($_ == $ref, @{$self->{_ancestors}}));
+    push @{$self->{_ancestors}}, $ref;
+  }
+  else {
+    if($named) {
+      return(join('',
+              $indent, '<', $name, '>',
+              ($self->{opt}->{noescape} ? $ref : $self->escape_value($ref)),
+              '</', $name, ">", $nl
+            ));
+    }
+    else {
+      return("$ref$nl");
+    }
+  }
+
+
+  # Unfold hash to array if possible
+
+  if(UNIVERSAL::isa($ref, 'HASH')      # It is a hash
+     and keys %$ref                    # and it's not empty
+     and $self->{opt}->{keyattr}       # and folding is enabled
+     and !$is_root                     # and its not the root element
+  ) {
+    $ref = $self->hash_to_array($name, $ref);
+  }
+
+
+  my @result = ();
+  my($key, $value);
+
+
+  # Handle hashrefs
+
+  if(UNIVERSAL::isa($ref, 'HASH')) {
+
+    # Reintermediate grouped values if applicable
+
+    if($self->{opt}->{grouptags}) {
+      $ref = $self->copy_hash($ref);
+      while(my($key, $val) = each %$ref) {
+        if($self->{opt}->{grouptags}->{$key}) {
+          $ref->{$key} = { $self->{opt}->{grouptags}->{$key} => $val };
+        }
+      }
+    }
+
+
+    # Scan for namespace declaration attributes
+
+    my $nsdecls = '';
+    my $default_ns_uri;
+    if($self->{nsup}) {
+      $ref = $self->copy_hash($ref);
+      $self->{nsup}->push_context();
+
+      # Look for default namespace declaration first
+
+      if(exists($ref->{xmlns})) {
+        $self->{nsup}->declare_prefix('', $ref->{xmlns});
+        $nsdecls .= qq( xmlns="$ref->{xmlns}"); 
+        delete($ref->{xmlns});
+      }
+      $default_ns_uri = $self->{nsup}->get_uri('');
+
+
+      # Then check all the other keys
+
+      foreach my $qname (keys(%$ref)) {
+        my($uri, $lname) = $self->{nsup}->parse_jclark_notation($qname);
+        if($uri) {
+          if($uri eq $xmlns_ns) {
+            $self->{nsup}->declare_prefix($lname, $ref->{$qname});
+            $nsdecls .= qq( xmlns:$lname="$ref->{$qname}"); 
+            delete($ref->{$qname});
+          }
+        }
+      }
+
+      # Translate any remaining Clarkian names
+
+      foreach my $qname (keys(%$ref)) {
+        my($uri, $lname) = $self->{nsup}->parse_jclark_notation($qname);
+        if($uri) {
+          if($default_ns_uri  and  $uri eq $default_ns_uri) {
+            $ref->{$lname} = $ref->{$qname};
+            delete($ref->{$qname});
+          }
+          else {
+            my $prefix = $self->{nsup}->get_prefix($uri);
+            unless($prefix) {
+              # $self->{nsup}->declare_prefix(undef, $uri);
+              # $prefix = $self->{nsup}->get_prefix($uri);
+              $prefix = $self->{ns_prefix}++;
+              $self->{nsup}->declare_prefix($prefix, $uri);
+              $nsdecls .= qq( xmlns:$prefix="$uri"); 
+            }
+            $ref->{"$prefix:$lname"} = $ref->{$qname};
+            delete($ref->{$qname});
+          }
+        }
+      }
+    }
+
+
+    my @nested = ();
+    my $text_content = undef;
+    if($named) {
+      push @result, $indent, '<', $name, $nsdecls;
+    }
+
+    if(keys %$ref) {
+      my $first_arg = 1;
+      foreach my $key ($self->sorted_keys($name, $ref)) {
+        my $value = $ref->{$key};
+        next if(substr($key, 0, 1) eq '-');
+        if(!defined($value)) {
+          next if $self->{opt}->{suppressempty};
+          unless(exists($self->{opt}->{suppressempty})
+             and !defined($self->{opt}->{suppressempty})
+          ) {
+            carp 'Use of uninitialized value' if($^W);
+          }
+          if($key eq $self->{opt}->{contentkey}) {
+            $text_content = '';
+          }
+          else {
+            $value = exists($self->{opt}->{suppressempty}) ? {} : '';
+          }
+        }
+
+        if(!ref($value)  
+           and $self->{opt}->{valueattr}
+           and $self->{opt}->{valueattr}->{$key}
+        ) {
+          $value = { $self->{opt}->{valueattr}->{$key} => $value };
+        }
+
+        if(ref($value)  or  $self->{opt}->{noattr}) {
+          push @nested,
+            $self->value_to_xml($value, $key, "$indent  ");
+        }
+        else {
+          $value = $self->escape_value($value) unless($self->{opt}->{noescape});
+          if($key eq $self->{opt}->{contentkey}) {
+            $text_content = $value;
+          }
+          else {
+            push @result, "\n$indent " . ' ' x length($name)
+              if($self->{opt}->{attrindent}  and  !$first_arg);
+            push @result, ' ', $key, '="', $value , '"';
+            $first_arg = 0;
+          }
+        }
+      }
+    }
+    else {
+      $text_content = '';
+    }
+
+    if(@nested  or  defined($text_content)) {
+      if($named) {
+        push @result, ">";
+        if(defined($text_content)) {
+          push @result, $text_content;
+          $nested[0] =~ s/^\s+// if(@nested);
+        }
+        else {
+          push @result, $nl;
+        }
+        if(@nested) {
+          push @result, @nested, $indent;
+        }
+        push @result, '</', $name, ">", $nl;
+      }
+      else {
+        push @result, @nested;             # Special case if no root elements
+      }
+    }
+    else {
+      push @result, " />", $nl;
+    }
+    $self->{nsup}->pop_context() if($self->{nsup});
+  }
+
+
+  # Handle arrayrefs
+
+  elsif(UNIVERSAL::isa($ref, 'ARRAY')) {
+    foreach $value (@$ref) {
+      if(!ref($value)) {
+        push @result,
+             $indent, '<', $name, '>',
+             ($self->{opt}->{noescape} ? $value : $self->escape_value($value)),
+             '</', $name, ">$nl";
+      }
+      elsif(UNIVERSAL::isa($value, 'HASH')) {
+        push @result, $self->value_to_xml($value, $name, $indent);
+      }
+      else {
+        push @result,
+               $indent, '<', $name, ">$nl",
+               $self->value_to_xml($value, 'anon', "$indent  "),
+               $indent, '</', $name, ">$nl";
+      }
+    }
+  }
+
+  else {
+    croak "Can't encode a value of type: " . ref($ref);
+  }
+
+
+  pop @{$self->{_ancestors}} if(ref($ref));
+
+  return(join('', @result));
+}
+
+
+##############################################################################
+# Method: sorted_keys()
+#
+# Returns the keys of the referenced hash sorted into alphabetical order, but
+# with the 'key' key (as in KeyAttr) first, if there is one.
+#
+
+sub sorted_keys {
+  my($self, $name, $ref) = @_;
+
+  return keys %$ref if $self->{opt}->{nosort};
+
+  my %hash = %$ref;
+  my $keyattr = $self->{opt}->{keyattr};
+
+  my @key;
+
+  if(ref $keyattr eq 'HASH') {
+    if(exists $keyattr->{$name} and exists $hash{$keyattr->{$name}->[0]}) {
+      push @key, $keyattr->{$name}->[0];
+      delete $hash{$keyattr->{$name}->[0]};
+    }
+  }
+  elsif(ref $keyattr eq 'ARRAY') {
+    foreach (@{$keyattr}) {
+      if(exists $hash{$_}) {
+        push @key, $_;
+        delete $hash{$_};
+        last;
+      }
+    }
+  }
+
+  return(@key, sort keys %hash);
+}
+
+##############################################################################
+# Method: escape_value()
+#
+# Helper routine for automatically escaping values for XMLout().
+# Expects a scalar data value.  Returns escaped version.
+#
+
+sub escape_value {
+  my($self, $data) = @_;
+
+  return '' unless(defined($data));
+
+  $data =~ s/&/&amp;/sg;
+  $data =~ s/</&lt;/sg;
+  $data =~ s/>/&gt;/sg;
+  $data =~ s/"/&quot;/sg;
+
+  my $level = $self->{opt}->{numericescape} or return $data;
+
+  return $self->numeric_escape($data, $level);
+}
+
+sub numeric_escape {
+  my($self, $data, $level) = @_;
+
+  use utf8; # required for 5.6
+
+  if($self->{opt}->{numericescape} eq '2') {
+    $data =~ s/([^\x00-\x7F])/'&#' . ord($1) . ';'/gse;
+  }
+  else {
+    $data =~ s/([^\x00-\xFF])/'&#' . ord($1) . ';'/gse;
+  }
+
+  return $data;
+}
+
+
+##############################################################################
+# Method: hash_to_array()
+#
+# Helper routine for value_to_xml().
+# Attempts to 'unfold' a hash of hashes into an array of hashes.  Returns a
+# reference to the array on success or the original hash if unfolding is
+# not possible.
+#
+
+sub hash_to_array {
+  my $self    = shift;
+  my $parent  = shift;
+  my $hashref = shift;
+
+  my $arrayref = [];
+
+  my($key, $value);
+
+  my @keys = $self->{opt}->{nosort} ? keys %$hashref : sort keys %$hashref;
+  foreach $key (@keys) {
+    $value = $hashref->{$key};
+    return($hashref) unless(UNIVERSAL::isa($value, 'HASH'));
+
+    if(ref($self->{opt}->{keyattr}) eq 'HASH') {
+      return($hashref) unless(defined($self->{opt}->{keyattr}->{$parent}));
+      push @$arrayref, $self->copy_hash(
+        $value, $self->{opt}->{keyattr}->{$parent}->[0] => $key
+      );
+    }
+    else {
+      push(@$arrayref, { $self->{opt}->{keyattr}->[0] => $key, %$value });
+    }
+  }
+
+  return($arrayref);
+}
+
+
+##############################################################################
+# Method: copy_hash()
+#
+# Helper routine for hash_to_array().  When unfolding a hash of hashes into
+# an array of hashes, we need to copy the key from the outer hash into the
+# inner hash.  This routine makes a copy of the original hash so we don't
+# destroy the original data structure.  You might wish to override this
+# method if you're using tied hashes and don't want them to get untied.
+#
+
+sub copy_hash {
+  my($self, $orig, @extra) = @_;
+
+  return { @extra, %$orig };
+}
+
+##############################################################################
+# Methods required for building trees from SAX events
+##############################################################################
+
+sub start_document {
+  my $self = shift;
+
+  $self->handle_options('in') unless($self->{opt});
+
+  $self->{lists} = [];
+  $self->{curlist} = $self->{tree} = [];
+}
+
+
+sub start_element {
+  my $self    = shift;
+  my $element = shift;
+
+  my $name = $element->{Name};
+  if($self->{opt}->{nsexpand}) {
+    $name = $element->{LocalName} || '';
+    if($element->{NamespaceURI}) {
+      $name = '{' . $element->{NamespaceURI} . '}' . $name;
+    }
+  }
+  my $attributes = {};
+  if($element->{Attributes}) {  # Might be undef
+    foreach my $attr (values %{$element->{Attributes}}) {
+      if($self->{opt}->{nsexpand}) {
+        my $name = $attr->{LocalName} || '';
+        if($attr->{NamespaceURI}) {
+          $name = '{' . $attr->{NamespaceURI} . '}' . $name
+        }
+        $name = 'xmlns' if($name eq $bad_def_ns_jcn);
+        $attributes->{$name} = $attr->{Value};
+      }
+      else {
+        $attributes->{$attr->{Name}} = $attr->{Value};
+      }
+    }
+  }
+  my $newlist = [ $attributes ];
+  push @{ $self->{lists} }, $self->{curlist};
+  push @{ $self->{curlist} }, $name => $newlist;
+  $self->{curlist} = $newlist;
+}
+
+
+sub characters {
+  my $self  = shift;
+  my $chars = shift;
+
+  my $text  = $chars->{Data};
+  my $clist = $self->{curlist};
+  my $pos = $#$clist;
+  
+  if ($pos > 0 and $clist->[$pos - 1] eq '0') {
+    $clist->[$pos] .= $text;
+  }
+  else {
+    push @$clist, 0 => $text;
+  }
+}
+
+
+sub end_element {
+  my $self    = shift;
+
+  $self->{curlist} = pop @{ $self->{lists} };
+}
+
+
+sub end_document {
+  my $self = shift;
+
+  delete($self->{curlist});
+  delete($self->{lists});
+
+  my $tree = $self->{tree};
+  delete($self->{tree});
+
+
+  # Return tree as-is to XMLin()
+
+  return($tree) if($self->{nocollapse});
+
+
+  # Or collapse it before returning it to SAX parser class
+  
+  if($self->{opt}->{keeproot}) {
+    $tree = $self->collapse({}, @$tree);
+  }
+  else {
+    $tree = $self->collapse(@{$tree->[1]});
+  }
+
+  if($self->{opt}->{datahandler}) {
+    return($self->{opt}->{datahandler}->($self, $tree));
+  }
+
+  return($tree);
+}
+
+*xml_in  = \&XMLin;
+*xml_out = \&XMLout;
+
+1;
+
+__END__
+
+=head1 QUICK START
+
+Say you have a script called B<foo> and a file of configuration options
+called B<foo.xml> containing this:
+
+  <config logdir="/var/log/foo/" debugfile="/tmp/foo.debug">
+    <server name="sahara" osname="solaris" osversion="2.6">
+      <address>10.0.0.101</address>
+      <address>10.0.1.101</address>
+    </server>
+    <server name="gobi" osname="irix" osversion="6.5">
+      <address>10.0.0.102</address>
+    </server>
+    <server name="kalahari" osname="linux" osversion="2.0.34">
+      <address>10.0.0.103</address>
+      <address>10.0.1.103</address>
+    </server>
+  </config>
+
+The following lines of code in B<foo>:
+
+  use XML::Simple;
+
+  my $config = XMLin();
+
+will 'slurp' the configuration options into the hashref $config (because no
+arguments are passed to C<XMLin()> the name and location of the XML file will
+be inferred from name and location of the script).  You can dump out the
+contents of the hashref using Data::Dumper:
+
+  use Data::Dumper;
+
+  print Dumper($config);
+
+which will produce something like this (formatting has been adjusted for
+brevity):
+
+  {
+      'logdir'        => '/var/log/foo/',
+      'debugfile'     => '/tmp/foo.debug',
+      'server'        => {
+          'sahara'        => {
+              'osversion'     => '2.6',
+              'osname'        => 'solaris',
+              'address'       => [ '10.0.0.101', '10.0.1.101' ]
+          },
+          'gobi'          => {
+              'osversion'     => '6.5',
+              'osname'        => 'irix',
+              'address'       => '10.0.0.102'
+          },
+          'kalahari'      => {
+              'osversion'     => '2.0.34',
+              'osname'        => 'linux',
+              'address'       => [ '10.0.0.103', '10.0.1.103' ]
+          }
+      }
+  }
+
+Your script could then access the name of the log directory like this:
+
+  print $config->{logdir};
+
+similarly, the second address on the server 'kalahari' could be referenced as:
+
+  print $config->{server}->{kalahari}->{address}->[1];
+
+What could be simpler?  (Rhetorical).
+
+For simple requirements, that's really all there is to it.  If you want to
+store your XML in a different directory or file, or pass it in as a string or
+even pass it in via some derivative of an IO::Handle, you'll need to check out
+L<"OPTIONS">.  If you want to turn off or tweak the array folding feature (that
+neat little transformation that produced $config->{server}) you'll find options
+for that as well.
+
+If you want to generate XML (for example to write a modified version of
+$config back out as XML), check out C<XMLout()>.
+
+If your needs are not so simple, this may not be the module for you.  In that
+case, you might want to read L<"WHERE TO FROM HERE?">.
+
+=head1 DESCRIPTION
+
+The XML::Simple module provides a simple API layer on top of an underlying XML
+parsing module (either XML::Parser or one of the SAX2 parser modules).  Two
+functions are exported: C<XMLin()> and C<XMLout()>.  Note: you can explicity
+request the lower case versions of the function names: C<xml_in()> and
+C<xml_out()>.
+
+The simplest approach is to call these two functions directly, but an
+optional object oriented interface (see L<"OPTIONAL OO INTERFACE"> below)
+allows them to be called as methods of an B<XML::Simple> object.  The object
+interface can also be used at either end of a SAX pipeline.
+
+=head2 XMLin()
+
+Parses XML formatted data and returns a reference to a data structure which
+contains the same information in a more readily accessible form.  (Skip
+down to L<"EXAMPLES"> below, for more sample code).
+
+C<XMLin()> accepts an optional XML specifier followed by zero or more 'name =>
+value' option pairs.  The XML specifier can be one of the following:
+
+=over 4
+
+=item A filename
+
+If the filename contains no directory components C<XMLin()> will look for the
+file in each directory in the SearchPath (see L<"OPTIONS"> below) or in the
+current directory if the SearchPath option is not defined.  eg:
+
+  $ref = XMLin('/etc/params.xml');
+
+Note, the filename '-' can be used to parse from STDIN.
+
+=item undef
+
+If there is no XML specifier, C<XMLin()> will check the script directory and
+each of the SearchPath directories for a file with the same name as the script
+but with the extension '.xml'.  Note: if you wish to specify options, you
+must specify the value 'undef'.  eg:
+
+  $ref = XMLin(undef, ForceArray => 1);
+
+=item A string of XML
+
+A string containing XML (recognised by the presence of '<' and '>' characters)
+will be parsed directly.  eg:
+
+  $ref = XMLin('<opt username="bob" password="flurp" />');
+
+=item An IO::Handle object
+
+An IO::Handle object will be read to EOF and its contents parsed. eg:
+
+  $fh = new IO::File('/etc/params.xml');
+  $ref = XMLin($fh);
+
+=back
+
+=head2 XMLout()
+
+Takes a data structure (generally a hashref) and returns an XML encoding of
+that structure.  If the resulting XML is parsed using C<XMLin()>, it should
+return a data structure equivalent to the original (see caveats below). 
+
+The C<XMLout()> function can also be used to output the XML as SAX events
+see the C<Handler> option and L<"SAX SUPPORT"> for more details).
+
+When translating hashes to XML, hash keys which have a leading '-' will be
+silently skipped.  This is the approved method for marking elements of a
+data structure which should be ignored by C<XMLout>.  (Note: If these items
+were not skipped the key names would be emitted as element or attribute names
+with a leading '-' which would not be valid XML).
+
+=head2 Caveats
+
+Some care is required in creating data structures which will be passed to
+C<XMLout()>.  Hash keys from the data structure will be encoded as either XML
+element names or attribute names.  Therefore, you should use hash key names 
+which conform to the relatively strict XML naming rules:
+
+Names in XML must begin with a letter.  The remaining characters may be
+letters, digits, hyphens (-), underscores (_) or full stops (.).  It is also
+allowable to include one colon (:) in an element name but this should only be
+used when working with namespaces (B<XML::Simple> can only usefully work with
+namespaces when teamed with a SAX Parser).
+
+You can use other punctuation characters in hash values (just not in hash
+keys) however B<XML::Simple> does not support dumping binary data.
+
+If you break these rules, the current implementation of C<XMLout()> will 
+simply emit non-compliant XML which will be rejected if you try to read it
+back in.  (A later version of B<XML::Simple> might take a more proactive
+approach).
+
+Note also that although you can nest hashes and arrays to arbitrary levels,
+circular data structures are not supported and will cause C<XMLout()> to die.
+
+If you wish to 'round-trip' arbitrary data structures from Perl to XML and back 
+to Perl, then you should probably disable array folding (using the KeyAttr
+option) both with C<XMLout()> and with C<XMLin()>.  If you still don't get the 
+expected results, you may prefer to use L<XML::Dumper> which is designed for
+exactly that purpose.
+
+Refer to L<"WHERE TO FROM HERE?"> if C<XMLout()> is too simple for your needs.
+
+
+=head1 OPTIONS
+
+B<XML::Simple> supports a number of options (in fact as each release of
+B<XML::Simple> adds more options, the module's claim to the name 'Simple'
+becomes increasingly tenuous).  If you find yourself repeatedly having to
+specify the same options, you might like to investigate L<"OPTIONAL OO
+INTERFACE"> below.
+
+If you can't be bothered reading the documentation, refer to
+L<"STRICT MODE"> to automatically catch common mistakes.
+
+Because there are so many options, it's hard for new users to know which ones
+are important, so here are the two you really need to know about:
+
+=over 4
+
+=item *
+
+check out C<ForceArray> because you'll almost certainly want to turn it on
+
+=item *
+
+make sure you know what the C<KeyAttr> option does and what its default value is
+because it may surprise you otherwise (note in particular that 'KeyAttr'
+affects both C<XMLin> and C<XMLout>)
+
+=back
+
+The option name headings below have a trailing 'comment' - a hash followed by
+two pieces of metadata:
+
+=over 4
+
+=item *
+
+Options are marked with 'I<in>' if they are recognised by C<XMLin()> and
+'I<out>' if they are recognised by C<XMLout()>.
+
+=item *
+
+Each option is also flagged to indicate whether it is:
+
+ 'important'   - don't use the module until you understand this one
+ 'handy'       - you can skip this on the first time through
+ 'advanced'    - you can skip this on the second time through
+ 'SAX only'    - don't worry about this unless you're using SAX (or
+                 alternatively if you need this, you also need SAX)
+ 'seldom used' - you'll probably never use this unless you were the
+                 person that requested the feature
+
+=back
+
+The options are listed alphabetically:
+
+Note: option names are no longer case sensitive so you can use the mixed case
+versions shown here; all lower case as required by versions 2.03 and earlier;
+or you can add underscores between the words (eg: key_attr).
+
+
+=head2 AttrIndent => 1 I<# out - handy>
+
+When you are using C<XMLout()>, enable this option to have attributes printed
+one-per-line with sensible indentation rather than all on one line.
+
+=head2 Cache => [ cache schemes ] I<# in - advanced>
+
+Because loading the B<XML::Parser> module and parsing an XML file can consume a
+significant number of CPU cycles, it is often desirable to cache the output of
+C<XMLin()> for later reuse.
+
+When parsing from a named file, B<XML::Simple> supports a number of caching
+schemes.  The 'Cache' option may be used to specify one or more schemes (using
+an anonymous array).  Each scheme will be tried in turn in the hope of finding
+a cached pre-parsed representation of the XML file.  If no cached copy is
+found, the file will be parsed and the first cache scheme in the list will be
+used to save a copy of the results.  The following cache schemes have been
+implemented:
+
+=over 4
+
+=item storable
+
+Utilises B<Storable.pm> to read/write a cache file with the same name as the
+XML file but with the extension .stor
+
+=item memshare
+
+When a file is first parsed, a copy of the resulting data structure is retained
+in memory in the B<XML::Simple> module's namespace.  Subsequent calls to parse
+the same file will return a reference to this structure.  This cached version
+will persist only for the life of the Perl interpreter (which in the case of
+mod_perl for example, may be some significant time).
+
+Because each caller receives a reference to the same data structure, a change
+made by one caller will be visible to all.  For this reason, the reference
+returned should be treated as read-only.
+
+=item memcopy
+
+This scheme works identically to 'memshare' (above) except that each caller
+receives a reference to a new data structure which is a copy of the cached
+version.  Copying the data structure will add a little processing overhead,
+therefore this scheme should only be used where the caller intends to modify
+the data structure (or wishes to protect itself from others who might).  This
+scheme uses B<Storable.pm> to perform the copy.
+
+=back
+
+Warning! The memory-based caching schemes compare the timestamp on the file to
+the time when it was last parsed.  If the file is stored on an NFS filesystem
+(or other network share) and the clock on the file server is not exactly
+synchronised with the clock where your script is run, updates to the source XML
+file may appear to be ignored.
+
+=head2 ContentKey => 'keyname' I<# in+out - seldom used>
+
+When text content is parsed to a hash value, this option let's you specify a
+name for the hash key to override the default 'content'.  So for example:
+
+  XMLin('<opt one="1">Text</opt>', ContentKey => 'text')
+
+will parse to:
+
+  { 'one' => 1, 'text' => 'Text' }
+
+instead of:
+
+  { 'one' => 1, 'content' => 'Text' }
+
+C<XMLout()> will also honour the value of this option when converting a hashref
+to XML.
+
+You can also prefix your selected key name with a '-' character to have 
+C<XMLin()> try a little harder to eliminate unnecessary 'content' keys after
+array folding.  For example:
+
+  XMLin(
+    '<opt><item name="one">First</item><item name="two">Second</item></opt>', 
+    KeyAttr => {item => 'name'}, 
+    ForceArray => [ 'item' ],
+    ContentKey => '-content'
+  )
+
+will parse to:
+
+  {
+    'item' => {
+      'one' =>  'First'
+      'two' =>  'Second'
+    }
+  }
+
+rather than this (without the '-'):
+
+  {
+    'item' => {
+      'one' => { 'content' => 'First' }
+      'two' => { 'content' => 'Second' }
+    }
+  }
+
+=head2 DataHandler => code_ref I<# in - SAX only>
+
+When you use an B<XML::Simple> object as a SAX handler, it will return a
+'simple tree' data structure in the same format as C<XMLin()> would return.  If
+this option is set (to a subroutine reference), then when the tree is built the
+subroutine will be called and passed two arguments: a reference to the
+B<XML::Simple> object and a reference to the data tree.  The return value from
+the subroutine will be returned to the SAX driver.  (See L<"SAX SUPPORT"> for
+more details).
+
+=head2 ForceArray => 1 I<# in - important>
+
+This option should be set to '1' to force nested elements to be represented
+as arrays even when there is only one.  Eg, with ForceArray enabled, this
+XML:
+
+    <opt>
+      <name>value</name>
+    </opt>
+
+would parse to this:
+
+    {
+      'name' => [
+                  'value'
+                ]
+    }
+
+instead of this (the default):
+
+    {
+      'name' => 'value'
+    }
+
+This option is especially useful if the data structure is likely to be written
+back out as XML and the default behaviour of rolling single nested elements up
+into attributes is not desirable. 
+
+If you are using the array folding feature, you should almost certainly enable
+this option.  If you do not, single nested elements will not be parsed to
+arrays and therefore will not be candidates for folding to a hash.  (Given that
+the default value of 'KeyAttr' enables array folding, the default value of this
+option should probably also have been enabled too - sorry).
+
+=head2 ForceArray => [ names ] I<# in - important>
+
+This alternative (and preferred) form of the 'ForceArray' option allows you to
+specify a list of element names which should always be forced into an array
+representation, rather than the 'all or nothing' approach above.
+
+It is also possible (since version 2.05) to include compiled regular
+expressions in the list - any element names which match the pattern will be
+forced to arrays.  If the list contains only a single regex, then it is not
+necessary to enclose it in an arrayref.  Eg:
+
+  ForceArray => qr/_list$/
+
+=head2 ForceContent => 1 I<# in - seldom used>
+
+When C<XMLin()> parses elements which have text content as well as attributes,
+the text content must be represented as a hash value rather than a simple
+scalar.  This option allows you to force text content to always parse to
+a hash value even when there are no attributes.  So for example:
+
+  XMLin('<opt><x>text1</x><y a="2">text2</y></opt>', ForceContent => 1)
+
+will parse to:
+
+  {
+    'x' => {           'content' => 'text1' },
+    'y' => { 'a' => 2, 'content' => 'text2' }
+  }
+
+instead of:
+
+  {
+    'x' => 'text1',
+    'y' => { 'a' => 2, 'content' => 'text2' }
+  }
+
+=head2 GroupTags => { grouping tag => grouped tag } I<# in+out - handy>
+
+You can use this option to eliminate extra levels of indirection in your Perl
+data structure.  For example this XML:
+
+  <opt>
+   <searchpath>
+     <dir>/usr/bin</dir>
+     <dir>/usr/local/bin</dir>
+     <dir>/usr/X11/bin</dir>
+   </searchpath>
+ </opt>
+
+Would normally be read into a structure like this:
+
+  {
+    searchpath => {
+                    dir => [ '/usr/bin', '/usr/local/bin', '/usr/X11/bin' ]
+                  }
+  }
+
+But when read in with the appropriate value for 'GroupTags':
+
+  my $opt = XMLin($xml, GroupTags => { searchpath => 'dir' });
+
+It will return this simpler structure:
+
+  {
+    searchpath => [ '/usr/bin', '/usr/local/bin', '/usr/X11/bin' ]
+  }
+
+The grouping element (C<< <searchpath> >> in the example) must not contain any
+attributes or elements other than the grouped element.
+
+You can specify multiple 'grouping element' to 'grouped element' mappings in
+the same hashref.  If this option is combined with C<KeyAttr>, the array
+folding will occur first and then the grouped element names will be eliminated.
+
+C<XMLout> will also use the grouptag mappings to re-introduce the tags around
+the grouped elements.  Beware though that this will occur in all places that
+the 'grouping tag' name occurs - you probably don't want to use the same name
+for elements as well as attributes.
+
+=head2 Handler => object_ref I<# out - SAX only>
+
+Use the 'Handler' option to have C<XMLout()> generate SAX events rather than 
+returning a string of XML.  For more details see L<"SAX SUPPORT"> below.
+
+Note: the current implementation of this option generates a string of XML
+and uses a SAX parser to translate it into SAX events.  The normal encoding
+rules apply here - your data must be UTF8 encoded unless you specify an 
+alternative encoding via the 'XMLDecl' option; and by the time the data reaches
+the handler object, it will be in UTF8 form regardless of the encoding you
+supply.  A future implementation of this option may generate the events 
+directly.
+
+=head2 KeepRoot => 1 I<# in+out - handy>
+
+In its attempt to return a data structure free of superfluous detail and
+unnecessary levels of indirection, C<XMLin()> normally discards the root
+element name.  Setting the 'KeepRoot' option to '1' will cause the root element
+name to be retained.  So after executing this code:
+
+  $config = XMLin('<config tempdir="/tmp" />', KeepRoot => 1)
+
+You'll be able to reference the tempdir as
+C<$config-E<gt>{config}-E<gt>{tempdir}> instead of the default
+C<$config-E<gt>{tempdir}>.
+
+Similarly, setting the 'KeepRoot' option to '1' will tell C<XMLout()> that the
+data structure already contains a root element name and it is not necessary to
+add another.
+
+=head2 KeyAttr => [ list ] I<# in+out - important>
+
+This option controls the 'array folding' feature which translates nested
+elements from an array to a hash.  It also controls the 'unfolding' of hashes
+to arrays.
+
+For example, this XML:
+
+    <opt>
+      <user login="grep" fullname="Gary R Epstein" />
+      <user login="stty" fullname="Simon T Tyson" />
+    </opt>
+
+would, by default, parse to this:
+
+    {
+      'user' => [
+                  {
+                    'login' => 'grep',
+                    'fullname' => 'Gary R Epstein'
+                  },
+                  {
+                    'login' => 'stty',
+                    'fullname' => 'Simon T Tyson'
+                  }
+                ]
+    }
+
+If the option 'KeyAttr => "login"' were used to specify that the 'login'
+attribute is a key, the same XML would parse to:
+
+    {
+      'user' => {
+                  'stty' => {
+                              'fullname' => 'Simon T Tyson'
+                            },
+                  'grep' => {
+                              'fullname' => 'Gary R Epstein'
+                            }
+                }
+    }
+
+The key attribute names should be supplied in an arrayref if there is more
+than one.  C<XMLin()> will attempt to match attribute names in the order
+supplied.  C<XMLout()> will use the first attribute name supplied when
+'unfolding' a hash into an array.
+
+Note 1: The default value for 'KeyAttr' is ['name', 'key', 'id'].  If you do
+not want folding on input or unfolding on output you must setting this option
+to an empty list to disable the feature.
+
+Note 2: If you wish to use this option, you should also enable the
+C<ForceArray> option.  Without 'ForceArray', a single nested element will be
+rolled up into a scalar rather than an array and therefore will not be folded
+(since only arrays get folded).
+
+=head2 KeyAttr => { list } I<# in+out - important>
+
+This alternative (and preferred) method of specifiying the key attributes
+allows more fine grained control over which elements are folded and on which
+attributes.  For example the option 'KeyAttr => { package => 'id' } will cause
+any package elements to be folded on the 'id' attribute.  No other elements
+which have an 'id' attribute will be folded at all. 
+
+Note: C<XMLin()> will generate a warning (or a fatal error in L<"STRICT MODE">)
+if this syntax is used and an element which does not have the specified key
+attribute is encountered (eg: a 'package' element without an 'id' attribute, to
+use the example above).  Warnings will only be generated if B<-w> is in force.
+
+Two further variations are made possible by prefixing a '+' or a '-' character
+to the attribute name:
+
+The option 'KeyAttr => { user => "+login" }' will cause this XML:
+
+    <opt>
+      <user login="grep" fullname="Gary R Epstein" />
+      <user login="stty" fullname="Simon T Tyson" />
+    </opt>
+
+to parse to this data structure:
+
+    {
+      'user' => {
+                  'stty' => {
+                              'fullname' => 'Simon T Tyson',
+                              'login'    => 'stty'
+                            },
+                  'grep' => {
+                              'fullname' => 'Gary R Epstein',
+                              'login'    => 'grep'
+                            }
+                }
+    }
+
+The '+' indicates that the value of the key attribute should be copied rather
+than moved to the folded hash key.
+
+A '-' prefix would produce this result:
+
+    {
+      'user' => {
+                  'stty' => {
+                              'fullname' => 'Simon T Tyson',
+                              '-login'    => 'stty'
+                            },
+                  'grep' => {
+                              'fullname' => 'Gary R Epstein',
+                              '-login'    => 'grep'
+                            }
+                }
+    }
+
+As described earlier, C<XMLout> will ignore hash keys starting with a '-'.
+
+=head2 NoAttr => 1 I<# in+out - handy>
+
+When used with C<XMLout()>, the generated XML will contain no attributes.
+All hash key/values will be represented as nested elements instead.
+
+When used with C<XMLin()>, any attributes in the XML will be ignored.
+
+=head2 NoEscape => 1 I<# out - seldom used>
+
+By default, C<XMLout()> will translate the characters 'E<lt>', 'E<gt>', '&' and
+'"' to '&lt;', '&gt;', '&amp;' and '&quot' respectively.  Use this option to
+suppress escaping (presumably because you've already escaped the data in some
+more sophisticated manner).
+
+=head2 NoIndent => 1 I<# out - seldom used>
+
+Set this option to 1 to disable C<XMLout()>'s default 'pretty printing' mode.
+With this option enabled, the XML output will all be on one line (unless there
+are newlines in the data) - this may be easier for downstream processing.
+
+=head2 NoSort => 1 I<# out - seldom used>
+
+Newer versions of XML::Simple sort elements and attributes alphabetically (*),
+by default.  Enable this option to suppress the sorting - possibly for
+backwards compatibility.
+
+* Actually, sorting is alphabetical but 'key' attribute or element names (as in
+'KeyAttr') sort first.  Also, when a hash of hashes is 'unfolded', the elements
+are sorted alphabetically by the value of the key field.
+
+=head2 NormaliseSpace => 0 | 1 | 2 I<# in - handy>
+
+This option controls how whitespace in text content is handled.  Recognised
+values for the option are:
+
+=over 4
+
+=item *
+
+0 = (default) whitespace is passed through unaltered (except of course for the
+normalisation of whitespace in attribute values which is mandated by the XML
+recommendation)
+
+=item *
+
+1 = whitespace is normalised in any value used as a hash key (normalising means
+removing leading and trailing whitespace and collapsing sequences of whitespace
+characters to a single space)
+
+=item *
+
+2 = whitespace is normalised in all text content
+
+=back
+
+Note: you can spell this option with a 'z' if that is more natural for you.
+
+=head2 NSExpand => 1 I<# in+out handy - SAX only>
+
+This option controls namespace expansion - the translation of element and
+attribute names of the form 'prefix:name' to '{uri}name'.  For example the
+element name 'xsl:template' might be expanded to:
+'{http://www.w3.org/1999/XSL/Transform}template'.
+
+By default, C<XMLin()> will return element names and attribute names exactly as
+they appear in the XML.  Setting this option to 1 will cause all element and
+attribute names to be expanded to include their namespace prefix.
+
+I<Note: You must be using a SAX parser for this option to work (ie: it does not
+work with XML::Parser)>.
+
+This option also controls whether C<XMLout()> performs the reverse translation
+from '{uri}name' back to 'prefix:name'.  The default is no translation.  If
+your data contains expanded names, you should set this option to 1 otherwise
+C<XMLout> will emit XML which is not well formed.
+
+I<Note: You must have the XML::NamespaceSupport module installed if you want
+C<XMLout()> to translate URIs back to prefixes>.
+
+=head2 NumericEscape => 0 | 1 | 2 I<# out - handy>
+
+Use this option to have 'high' (non-ASCII) characters in your Perl data
+structure converted to numeric entities (eg: &#8364;) in the XML output.  Three
+levels are possible:
+
+0 - default: no numeric escaping (OK if you're writing out UTF8)
+
+1 - only characters above 0xFF are escaped (ie: characters in the 0x80-FF range are not escaped), possibly useful with ISO8859-1 output
+
+2 - all characters above 0x7F are escaped (good for plain ASCII output)
+
+=head2 OutputFile => <file specifier> I<# out - handy>
+
+The default behaviour of C<XMLout()> is to return the XML as a string.  If you
+wish to write the XML to a file, simply supply the filename using the
+'OutputFile' option.  
+
+This option also accepts an IO handle object - especially useful in Perl 5.8.0 
+and later for output using an encoding other than UTF-8, eg:
+
+  open my $fh, '>:encoding(iso-8859-1)', $path or die "open($path): $!";
+  XMLout($ref, OutputFile => $fh);
+
+=head2 ParserOpts => [ XML::Parser Options ] I<# in - don't use this>
+
+I<Note: This option is now officially deprecated.  If you find it useful, email
+the author with an example of what you use it for.  Do not use this option to
+set the ProtocolEncoding, that's just plain wrong - fix the XML>.
+
+This option allows you to pass parameters to the constructor of the underlying
+XML::Parser object (which of course assumes you're not using SAX).
+
+=head2 RootName => 'string' I<# out - handy>
+
+By default, when C<XMLout()> generates XML, the root element will be named
+'opt'.  This option allows you to specify an alternative name.
+
+Specifying either undef or the empty string for the RootName option will
+produce XML with no root elements.  In most cases the resulting XML fragment
+will not be 'well formed' and therefore could not be read back in by C<XMLin()>.
+Nevertheless, the option has been found to be useful in certain circumstances.
+
+=head2 SearchPath => [ list ] I<# in - handy>
+
+If you pass C<XMLin()> a filename, but the filename include no directory
+component, you can use this option to specify which directories should be
+searched to locate the file.  You might use this option to search first in the
+user's home directory, then in a global directory such as /etc.
+
+If a filename is provided to C<XMLin()> but SearchPath is not defined, the
+file is assumed to be in the current directory.
+
+If the first parameter to C<XMLin()> is undefined, the default SearchPath
+will contain only the directory in which the script itself is located.
+Otherwise the default SearchPath will be empty.  
+
+=head2 SuppressEmpty => 1 | '' | undef I<# in+out - handy>
+
+This option controls what C<XMLin()> should do with empty elements (no
+attributes and no content).  The default behaviour is to represent them as
+empty hashes.  Setting this option to a true value (eg: 1) will cause empty
+elements to be skipped altogether.  Setting the option to 'undef' or the empty
+string will cause empty elements to be represented as the undefined value or
+the empty string respectively.  The latter two alternatives are a little
+easier to test for in your code than a hash with no keys.
+
+The option also controls what C<XMLout()> does with undefined values.  Setting
+the option to undef causes undefined values to be output as empty elements
+(rather than empty attributes), it also suppresses the generation of warnings
+about undefined values.  Setting the option to a true value (eg: 1) causes
+undefined values to be skipped altogether on output.
+
+=head2 ValueAttr => [ names ] I<# in - handy>
+
+Use this option to deal elements which always have a single attribute and no
+content.  Eg:
+
+  <opt>
+    <colour value="red" />
+    <size   value="XXL" />
+  </opt>
+
+Setting C<< ValueAttr => [ 'value' ] >> will cause the above XML to parse to:
+
+  {
+    colour => 'red',
+    size   => 'XXL'
+  }
+
+instead of this (the default):
+
+  {
+    colour => { value => 'red' },
+    size   => { value => 'XXL' }
+  }
+
+Note: This form of the ValueAttr option is not compatible with C<XMLout()> -
+since the attribute name is discarded at parse time, the original XML cannot be
+reconstructed.
+
+=head2 ValueAttr => { element => attribute, ... } I<# in+out - handy>
+
+This (preferred) form of the ValueAttr option requires you to specify both
+the element and the attribute names.  This is not only safer, it also allows
+the original XML to be reconstructed by C<XMLout()>.
+
+Note: You probably don't want to use this option and the NoAttr option at the
+same time.
+
+=head2 Variables => { name => value } I<# in - handy>
+
+This option allows variables in the XML to be expanded when the file is read.
+(there is no facility for putting the variable names back if you regenerate
+XML using C<XMLout>).
+
+A 'variable' is any text of the form C<${name}> which occurs in an attribute
+value or in the text content of an element.  If 'name' matches a key in the
+supplied hashref, C<${name}> will be replaced with the corresponding value from
+the hashref.  If no matching key is found, the variable will not be replaced.
+
+=head2 VarAttr => 'attr_name' I<# in - handy>
+
+In addition to the variables defined using C<Variables>, this option allows
+variables to be defined in the XML.  A variable definition consists of an
+element with an attribute called 'attr_name' (the value of the C<VarAttr>
+option).  The value of the attribute will be used as the variable name and the
+text content of the element will be used as the value.  A variable defined in
+this way will override a variable defined using the C<Variables> option.  For
+example:
+
+  XMLin( '<opt>
+            <dir name="prefix">/usr/local/apache</dir>
+            <dir name="exec_prefix">${prefix}</dir>
+            <dir name="bindir">${exec_prefix}/bin</dir>
+          </opt>',
+         VarAttr => 'name', ContentKey => '-content'
+        );
+
+produces the following data structure:
+
+  {
+    dir => {
+             prefix      => '/usr/local/apache',
+             exec_prefix => '/usr/local/apache',
+             bindir      => '/usr/local/apache/bin',
+           }
+  }
+
+=head2 XMLDecl => 1  or  XMLDecl => 'string'  I<# out - handy>
+
+If you want the output from C<XMLout()> to start with the optional XML
+declaration, simply set the option to '1'.  The default XML declaration is:
+
+        <?xml version='1.0' standalone='yes'?>
+
+If you want some other string (for example to declare an encoding value), set
+the value of this option to the complete string you require.
+
+
+=head1 OPTIONAL OO INTERFACE
+
+The procedural interface is both simple and convenient however there are a
+couple of reasons why you might prefer to use the object oriented (OO)
+interface:
+
+=over 4
+
+=item *
+
+to define a set of default values which should be used on all subsequent calls
+to C<XMLin()> or C<XMLout()>
+
+=item *
+
+to override methods in B<XML::Simple> to provide customised behaviour
+
+=back
+
+The default values for the options described above are unlikely to suit
+everyone.  The OO interface allows you to effectively override B<XML::Simple>'s
+defaults with your preferred values.  It works like this:
+
+First create an XML::Simple parser object with your preferred defaults:
+
+  my $xs = new XML::Simple(ForceArray => 1, KeepRoot => 1);
+
+then call C<XMLin()> or C<XMLout()> as a method of that object:
+
+  my $ref = $xs->XMLin($xml);
+  my $xml = $xs->XMLout($ref);
+
+You can also specify options when you make the method calls and these values
+will be merged with the values specified when the object was created.  Values
+specified in a method call take precedence.
+
+Overriding methods is a more advanced topic but might be useful if for example
+you wished to provide an alternative routine for escaping character data (the
+escape_value method) or for building the initial parse tree (the build_tree
+method).
+
+Note: when called as methods, the C<XMLin()> and C<XMLout()> routines may be
+called as C<xml_in()> or C<xml_out()>.  The method names are aliased so the
+only difference is the aesthetics.
+
+=head1 STRICT MODE
+
+If you import the B<XML::Simple> routines like this:
+
+  use XML::Simple qw(:strict);
+
+the following common mistakes will be detected and treated as fatal errors
+
+=over 4
+
+=item *
+
+Failing to explicitly set the C<KeyAttr> option - if you can't be bothered
+reading about this option, turn it off with: KeyAttr => [ ]
+
+=item *
+
+Failing to explicitly set the C<ForceArray> option - if you can't be bothered
+reading about this option, set it to the safest mode with: ForceArray => 1
+
+=item *
+
+Setting ForceArray to an array, but failing to list all the elements from the
+KeyAttr hash.
+
+=item *
+
+Data error - KeyAttr is set to say { part => 'partnum' } but the XML contains
+one or more E<lt>partE<gt> elements without a 'partnum' attribute (or nested
+element).  Note: if strict mode is not set but -w is, this condition triggers a
+warning.
+
+=item * 
+
+Data error - as above, but value of key attribute (eg: partnum) is not a 
+scalar string (due to nested elements etc).  This will also trigger a warning
+if strict mode is not enabled.
+
+=back
+
+=head1 SAX SUPPORT
+
+From version 1.08_01, B<XML::Simple> includes support for SAX (the Simple API
+for XML) - specifically SAX2. 
+
+In a typical SAX application, an XML parser (or SAX 'driver') module generates
+SAX events (start of element, character data, end of element, etc) as it parses
+an XML document and a 'handler' module processes the events to extract the
+required data.  This simple model allows for some interesting and powerful
+possibilities:
+
+=over 4
+
+=item *
+
+Applications written to the SAX API can extract data from huge XML documents
+without the memory overheads of a DOM or tree API.
+
+=item *
+
+The SAX API allows for plug and play interchange of parser modules without
+having to change your code to fit a new module's API.  A number of SAX parsers
+are available with capabilities ranging from extreme portability to blazing
+performance.
+
+=item *
+
+A SAX 'filter' module can implement both a handler interface for receiving
+data and a generator interface for passing modified data on to a downstream
+handler.  Filters can be chained together in 'pipelines'.
+
+=item *
+
+One filter module might split a data stream to direct data to two or more
+downstream handlers.
+
+=item *
+
+Generating SAX events is not the exclusive preserve of XML parsing modules.
+For example, a module might extract data from a relational database using DBI
+and pass it on to a SAX pipeline for filtering and formatting.
+
+=back
+
+B<XML::Simple> can operate at either end of a SAX pipeline.  For example,
+you can take a data structure in the form of a hashref and pass it into a
+SAX pipeline using the 'Handler' option on C<XMLout()>:
+
+  use XML::Simple;
+  use Some::SAX::Filter;
+  use XML::SAX::Writer;
+
+  my $ref = {
+               ....   # your data here
+            };
+
+  my $writer = XML::SAX::Writer->new();
+  my $filter = Some::SAX::Filter->new(Handler => $writer);
+  my $simple = XML::Simple->new(Handler => $filter);
+  $simple->XMLout($ref);
+
+You can also put B<XML::Simple> at the opposite end of the pipeline to take
+advantage of the simple 'tree' data structure once the relevant data has been
+isolated through filtering:
+
+  use XML::SAX;
+  use Some::SAX::Filter;
+  use XML::Simple;
+
+  my $simple = XML::Simple->new(ForceArray => 1, KeyAttr => ['partnum']);
+  my $filter = Some::SAX::Filter->new(Handler => $simple);
+  my $parser = XML::SAX::ParserFactory->parser(Handler => $filter);
+
+  my $ref = $parser->parse_uri('some_huge_file.xml');
+
+  print $ref->{part}->{'555-1234'};
+
+You can build a filter by using an XML::Simple object as a handler and setting
+its DataHandler option to point to a routine which takes the resulting tree,
+modifies it and sends it off as SAX events to a downstream handler:
+
+  my $writer = XML::SAX::Writer->new();
+  my $filter = XML::Simple->new(
+                 DataHandler => sub {
+                                  my $simple = shift;
+                                  my $data = shift;
+
+                                  # Modify $data here
+
+                                  $simple->XMLout($data, Handler => $writer);
+                                }
+               );
+  my $parser = XML::SAX::ParserFactory->parser(Handler => $filter);
+
+  $parser->parse_uri($filename);
+
+I<Note: In this last example, the 'Handler' option was specified in the call to
+C<XMLout()> but it could also have been specified in the constructor>.
+
+=head1 ENVIRONMENT
+
+If you don't care which parser module B<XML::Simple> uses then skip this
+section entirely (it looks more complicated than it really is).
+
+B<XML::Simple> will default to using a B<SAX> parser if one is available or
+B<XML::Parser> if SAX is not available.
+
+You can dictate which parser module is used by setting either the environment
+variable 'XML_SIMPLE_PREFERRED_PARSER' or the package variable
+$XML::Simple::PREFERRED_PARSER to contain the module name.  The following rules
+are used:
+
+=over 4
+
+=item *
+
+The package variable takes precedence over the environment variable if both are defined.  To force B<XML::Simple> to ignore the environment settings and use
+its default rules, you can set the package variable to an empty string.
+
+=item *
+
+If the 'preferred parser' is set to the string 'XML::Parser', then
+L<XML::Parser> will be used (or C<XMLin()> will die if L<XML::Parser> is not
+installed).
+
+=item * 
+
+If the 'preferred parser' is set to some other value, then it is assumed to be
+the name of a SAX parser module and is passed to L<XML::SAX::ParserFactory.>
+If L<XML::SAX> is not installed, or the requested parser module is not
+installed, then C<XMLin()> will die.
+
+=item *
+
+If the 'preferred parser' is not defined at all (the normal default
+state), an attempt will be made to load L<XML::SAX>.  If L<XML::SAX> is
+installed, then a parser module will be selected according to
+L<XML::SAX::ParserFactory>'s normal rules (which typically means the last SAX
+parser installed).
+
+=item *
+
+if the 'preferred parser' is not defined and B<XML::SAX> is not
+installed, then B<XML::Parser> will be used.  C<XMLin()> will die if
+L<XML::Parser> is not installed.
+
+=back
+
+Note: The B<XML::SAX> distribution includes an XML parser written entirely in
+Perl.  It is very portable but it is not very fast.  You should consider
+installing L<XML::LibXML> or L<XML::SAX::Expat> if they are available for your
+platform.
+
+=head1 ERROR HANDLING
+
+The XML standard is very clear on the issue of non-compliant documents.  An
+error in parsing any single element (for example a missing end tag) must cause
+the whole document to be rejected.  B<XML::Simple> will die with an appropriate
+message if it encounters a parsing error.
+
+If dying is not appropriate for your application, you should arrange to call
+C<XMLin()> in an eval block and look for errors in $@.  eg:
+
+    my $config = eval { XMLin() };
+    PopUpMessage($@) if($@);
+
+Note, there is a common misconception that use of B<eval> will significantly
+slow down a script.  While that may be true when the code being eval'd is in a
+string, it is not true of code like the sample above.
+
+=head1 EXAMPLES
+
+When C<XMLin()> reads the following very simple piece of XML:
+
+    <opt username="testuser" password="frodo"></opt>
+
+it returns the following data structure:
+
+    {
+      'username' => 'testuser',
+      'password' => 'frodo'
+    }
+
+The identical result could have been produced with this alternative XML:
+
+    <opt username="testuser" password="frodo" />
+
+Or this (although see 'ForceArray' option for variations):
+
+    <opt>
+      <username>testuser</username>
+      <password>frodo</password>
+    </opt>
+
+Repeated nested elements are represented as anonymous arrays:
+
+    <opt>
+      <person firstname="Joe" lastname="Smith">
+        <email>joe@smith.com</email>
+        <email>jsmith@yahoo.com</email>
+      </person>
+      <person firstname="Bob" lastname="Smith">
+        <email>bob@smith.com</email>
+      </person>
+    </opt>
+
+    {
+      'person' => [
+                    {
+                      'email' => [
+                                   'joe@smith.com',
+                                   'jsmith@yahoo.com'
+                                 ],
+                      'firstname' => 'Joe',
+                      'lastname' => 'Smith'
+                    },
+                    {
+                      'email' => 'bob@smith.com',
+                      'firstname' => 'Bob',
+                      'lastname' => 'Smith'
+                    }
+                  ]
+    }
+
+Nested elements with a recognised key attribute are transformed (folded) from
+an array into a hash keyed on the value of that attribute (see the C<KeyAttr>
+option):
+
+    <opt>
+      <person key="jsmith" firstname="Joe" lastname="Smith" />
+      <person key="tsmith" firstname="Tom" lastname="Smith" />
+      <person key="jbloggs" firstname="Joe" lastname="Bloggs" />
+    </opt>
+
+    {
+      'person' => {
+                    'jbloggs' => {
+                                   'firstname' => 'Joe',
+                                   'lastname' => 'Bloggs'
+                                 },
+                    'tsmith' => {
+                                  'firstname' => 'Tom',
+                                  'lastname' => 'Smith'
+                                },
+                    'jsmith' => {
+                                  'firstname' => 'Joe',
+                                  'lastname' => 'Smith'
+                                }
+                  }
+    }
+
+
+The <anon> tag can be used to form anonymous arrays:
+
+    <opt>
+      <head><anon>Col 1</anon><anon>Col 2</anon><anon>Col 3</anon></head>
+      <data><anon>R1C1</anon><anon>R1C2</anon><anon>R1C3</anon></data>
+      <data><anon>R2C1</anon><anon>R2C2</anon><anon>R2C3</anon></data>
+      <data><anon>R3C1</anon><anon>R3C2</anon><anon>R3C3</anon></data>
+    </opt>
+
+    {
+      'head' => [
+                  [ 'Col 1', 'Col 2', 'Col 3' ]
+                ],
+      'data' => [
+                  [ 'R1C1', 'R1C2', 'R1C3' ],
+                  [ 'R2C1', 'R2C2', 'R2C3' ],
+                  [ 'R3C1', 'R3C2', 'R3C3' ]
+                ]
+    }
+
+Anonymous arrays can be nested to arbirtrary levels and as a special case, if
+the surrounding tags for an XML document contain only an anonymous array the
+arrayref will be returned directly rather than the usual hashref:
+
+    <opt>
+      <anon><anon>Col 1</anon><anon>Col 2</anon></anon>
+      <anon><anon>R1C1</anon><anon>R1C2</anon></anon>
+      <anon><anon>R2C1</anon><anon>R2C2</anon></anon>
+    </opt>
+
+    [
+      [ 'Col 1', 'Col 2' ],
+      [ 'R1C1', 'R1C2' ],
+      [ 'R2C1', 'R2C2' ]
+    ]
+
+Elements which only contain text content will simply be represented as a
+scalar.  Where an element has both attributes and text content, the element
+will be represented as a hashref with the text content in the 'content' key
+(see the C<ContentKey> option):
+
+  <opt>
+    <one>first</one>
+    <two attr="value">second</two>
+  </opt>
+
+  {
+    'one' => 'first',
+    'two' => { 'attr' => 'value', 'content' => 'second' }
+  }
+
+Mixed content (elements which contain both text content and nested elements)
+will be not be represented in a useful way - element order and significant
+whitespace will be lost.  If you need to work with mixed content, then
+XML::Simple is not the right tool for your job - check out the next section.
+
+=head1 WHERE TO FROM HERE?
+
+B<XML::Simple> is able to present a simple API because it makes some
+assumptions on your behalf.  These include:
+
+=over 4
+
+=item *
+
+You're not interested in text content consisting only of whitespace
+
+=item * 
+
+You don't mind that when things get slurped into a hash the order is lost
+
+=item *
+
+You don't want fine-grained control of the formatting of generated XML
+
+=item *
+
+You would never use a hash key that was not a legal XML element name
+
+=item *
+
+You don't need help converting between different encodings
+
+=back
+
+In a serious XML project, you'll probably outgrow these assumptions fairly
+quickly.  This section of the document used to offer some advice on chosing a
+more powerful option.  That advice has now grown into the 'Perl-XML FAQ'
+document which you can find at: L<http://perl-xml.sourceforge.net/faq/>
+
+The advice in the FAQ boils down to a quick explanation of tree versus
+event based parsers and then recommends:
+
+For event based parsing, use SAX (do not set out to write any new code for 
+XML::Parser's handler API - it is obselete).
+
+For tree-based parsing, you could choose between the 'Perlish' approach of
+L<XML::Twig> and more standards based DOM implementations - preferably one with
+XPath support.
+
+
+=head1 SEE ALSO
+
+B<XML::Simple> requires either L<XML::Parser> or L<XML::SAX>.
+
+To generate documents with namespaces, L<XML::NamespaceSupport> is required.
+
+The optional caching functions require L<Storable>.
+
+Answers to Frequently Asked Questions about XML::Simple are bundled with this
+distribution as: L<XML::Simple::FAQ>
+
+=head1 COPYRIGHT 
+
+Copyright 1999-2004 Grant McLean E<lt>grantm@cpan.orgE<gt>
+
+This library is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself. 
+
+=cut
+
+
diff -ruN 4.0K-4b/library/agora.setup.db 5.0.000/library/agora.setup.db
--- 4.0K-4b/library/agora.setup.db	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/agora.setup.db	2006-10-31 09:40:27.000000000 -0600
@@ -1,31 +1,36 @@
-#######################################################################
-$versions{'agora.setup.db'} = "20021020";
-
+$versions{'agora.setup.db 5 user'} = "5.0.000";
+# set this to "" to always calculate the tax
 $sc_sales_tax_form_variable = "Ecom_ShipTo_Postal_StateProv";
-# Use a line like this to set a custom library search path 
-# to look for things like the LWP library (you must uncomment 
-# it and set the path for your server!)
-#unshift(@INC,"/usr/local/perl5/site_perl");
+$sc_userfields_available = "5";
+$sc_database_version = "5 User";
+
+# added by Mister Ed April 2006.
+# limits the chracters accepted from order forms.
+# silently truncates at the max size
+$sc_max_char_length = 2400;
+
 $sc_browser_header = "Content-type: text/html\n\n";
-$sc_store_url2b = "?cart_id=";
-$sc_store_url2a = $sc_store_url . $sc_store_url2b;
 $sc_qty_box_on_cart_display = "yes";
 $sc_default_qty_to_display = 1; # becomes %%qty%% in html below
 $sc_default_qty_box_html = 
-'<INPUT TYPE=TEXT NAME="%%itemID%%" SIZE=3 MAXLENGTH=3 VALUE="%%qty%%">';
+'<input type=text name="%%itemID%%" size="3" maxlength="4" value="%%qty%%">';
+
+$sc_product_display_header = qq~<div align=center><table class="ac_product_table">~;
+
 # add javascript or other items for header tags here
-$sc_standard_head_info = '';
-$cart_item_def = 'ALIGN="CENTER"';
-$order_item_def = 'ALIGN="RIGHT"';
-$offline_ver_tbldef = 'width="500" bgcolor="#E8E0E0" cellpadding="2" ' .
-    'cellspacing="0" border="0" ';
-$offline_ver_tbldef2 = 'width="500" bgcolor="#F8F8C8" cellpadding="2" ' .
-    'cellspacing="0" border="1" ';
-$sc_search_nav_font = "COLOR=\"#000000\"";
-$sc_search_nav_bgcolor = "\"#f0f0f0\"";
-$sc_search_nav_width = "526";
-$sc_replace_orderform_form_tags = "yes";
-$sc_image_string_template =  '<IMG SRC="%%URLofImages%%/%%image%%" BORDER=0>';
+$sc_image_string_template = '<img src="%%URLofImages%%/%%image%%" alt="%%image%%">';
+$sc_special_page_meta_tags = qq~  <!-- agora.cgi shopping cart $versions{'agora.cgi'} -->
+  <!-- sc_special_page_meta_tags in agora.setup.db -->
+~;
+$sc_browser_meta_tags = qq~  <meta http-equiv="Expires" content="Wed, 4 October 2005 00:00:00 GMT">
+  <meta http-equiv="Cache-Control" content="no-cache">
+  <meta http-equiv="Pragma" content="no-cache">
+  <!-- sc_browser_meta_tags in agora.setup.db -->
+~;
+$sc_robot_meta_tags = qq~  <!-- sc_robot_meta_tags in agora.setup.db -->
+~;
+
+# Setup the directory definitions first
 $sc_admin_dir = "./admin_files";
 $sc_data_file_dir = "./data_files";
 $sc_html_dir = "./html";
@@ -33,48 +38,56 @@
 $sc_logs_dir = "./log_files";
 $sc_templates_dir = "$sc_html_dir/html-templates"; # removed / at end 4.0c
 $sc_user_carts_directory_path = "./shopping_carts";
+
 $sc_cgi_lib_path = "$sc_lib_dir/cgi-lib.pl";
 $sc_mail_lib_path = "$sc_lib_dir/mail-lib.pl";
 $sc_ship_lib_path = "$sc_lib_dir/shipping_lib.pl";
+
 $sc_html_setup_file_path = "$sc_lib_dir/agora_html_lib.pl";
 $sc_process_order_lib_path = "$sc_lib_dir/$sc_gateway_name-order_lib.pl";
 $sc_cookie_lib = "$sc_lib_dir/cookie-lib.pl";
-$sc_store_header_file = "$sc_templates_dir/store_header.inc";
-$sc_store_footer_file = "$sc_templates_dir/store_footer.inc";
-$sc_secure_store_header_file = "$sc_templates_dir/secure_store_header.inc";
-$sc_secure_store_footer_file = "$sc_templates_dir/secure_store_footer.inc";
+
 if ($sc_database_lib eq "") {
   $sc_database_lib="agora_db_lib.pl";
  }
 $sc_db_lib_path = "$sc_lib_dir/$sc_database_lib";
 $sc_order_lib_path = "$sc_lib_dir/agora_order_lib.pl";
 $sc_pgp_lib_path = "$sc_lib_dir/pgp-lib.pl";
+
 $sc_data_file_path = "$sc_data_file_dir/data.file";
+
 $sc_options_directory_path = "$sc_html_dir/options";
 $sc_generic_directory_path = "$sc_html_dir/files";
 $sc_html_product_directory_path = "$sc_html_dir/pages";
 $sc_form_dir_path = "$sc_html_dir/forms";
 $sc_html_order_form_path = "$sc_form_dir_path/$sc_gateway_name-orderform.html";
 $sc_store_front_path = "$sc_html_dir/index.html";
+
 $sc_counter_file_path = "$sc_admin_dir/counter.file";
 $sc_cart_user_lib_path = "$sc_admin_dir/cart_user_lib.pl";
+
 $sc_error_log_path = "$sc_logs_dir/error.log";
 $sc_access_log_path = "$sc_logs_dir/access.log";
 $sc_order_log_directory_path = "$sc_logs_dir/orders";
-$sc_use_category_name_as_ppinc_root = "yes";
+
 $error_page = "$sc_html_dir/error.html";
 $sc_grep = "grep";
 $sc_main_script_url = "agora.cgi";
 $sc_secpicserver_url = "agora.cgi";
-if ($sc_stepone_order_script_url eq "") { 
+
+if ($sc_stepone_order_script_url eq "") { #set default value
   $sc_stepone_order_script_url = $sc_store_url;
  }
 $sc_debug_mode = "no";
 $sc_debug_track_cartid = 'no';
-$sc_cookie_days = 90; # cookie lifetime, not cart lifetime
-$sc_number_days_keep_old_carts = 0.5; # cart lifetime in days
+$sc_cookie_days = 30; # browser cookie lifetime, not cart lifetime.  set to -1 if you wish cookies to expire when browser is closed.
 $sc_allow_location_redirect = "yes"; # helpful for cookies
 $sc_test_for_store_cart_change_repeats = 1; # test for reloaded pages
+
+# As of 3.1 taken out of manager, should be left on unless
+# a good reason for disabling is found (like security concerns 
+# on your particular server.)  Agorascript is now used in much
+# of the store!
 $sc_use_agorascript = "yes";
 
 # if this var is "" then it won't convert the underlines
@@ -83,7 +96,9 @@
 # if this var is "" then it won't process multiple instances of the
 # same product id number on a single web page.
 $sc_web_pid_sep_char = "~~"; 
-$mc_allow_multiple_options = 'yes';
+
+# special manager control variables
+$mc_allow_multiple_options = 'yes'; 
 
 #######################################################################
 #                Database Definition Variables                        #
@@ -92,6 +107,9 @@
 $sc_db_flatfile_caching_ok = "yes"; 
 $VF_DEF{"PRODUCT"} = "db";
 
+# If you need more fields, put them before 'options' field,
+# options must be last!
+
 $db[ 0]="product_id";
 $db[ 1]="product";
 $db[ 2]="price";
@@ -142,7 +160,7 @@
 # These two can be changed if need be, they are used to get the db price
 # for verification when adding to the cart.
 # could use a virtual field
-$sc_db_price_field_name	   = "price";
+$sc_db_price_field_name    = "price";
 $sc_db_index_of_price      = $db{$sc_db_price_field_name};
 
 @sc_db_query_criteria = ("product_id|0|=|string",
@@ -162,6 +180,29 @@
 #######################################################################
 #                    Cart Definition Variables                        #
 #######################################################################
+# The cart associative array is defined via the following steps:
+#                
+# 1. The 0th field is ALWAYS the quantity of the purchased item
+#
+# 2. The subsequent fields are the same fields defined
+#    in the @sc_db_index_for_defining_item_id variable.
+#    This is done because whatever is defined in this array,
+#    becomes the part of the product defined in the user's cart.
+#
+#       
+# 3. The field before the next to last field is ALWAYS the   
+#    "options" that have been selected by the user.  If you are    
+#     not using options, this field still needs to be here. It will
+#     just be used as an empty place marker.
+#       
+# 4. The next to last field is ALWAYS the price
+#    after options have been calculated in with the normal price.
+#       
+# 5. The last field is ALWAYS a computer generated
+#    unique identifier to distinguish cart line items from
+#    each other.
+
+
 $sc_opt_sep_marker = '{';
 $VF_DEF{"CART"} = "cart";
 
@@ -177,9 +218,12 @@
 $cart[ 9]="user1";
 $cart[10]="user2";
 $cart[11]="user3";
-$cart[12]="options";
-$cart[13]="price_after_options";
-$cart[14]="unique_cart_line_id";
+$cart[12]="user4";
+$cart[13]="user5";
+$cart[14]="user6";
+$cart[15]="options";
+$cart[16]="price_after_options";
+$cart[17]="unique_cart_line_id";
 #
 { my $inx=-1; 
   my $txt;
@@ -189,6 +233,8 @@
    }
 }
 
+# old-style vitual fields ...
+# Virtual Cart Fields are all the negated value of position in data.file
 $cart{"db_description"}      = -5;
 $cart{"db_price"}            = -2;
 $cart{"db_shipping"}         = -6;
@@ -203,17 +249,28 @@
 
 $sc_opt_web_strip_part_number = "yes";
 $sc_opt_email_leading_spaces = 15;
-#########
+
 $sc_cart_index_of_price = $cart{"price"};
 $sc_cart_index_of_image = $cart{"image"};
 $sc_cart_index_of_price_after_options = $cart{"price_after_options"};
+
+# this will show the index of another column of our choice
+# to measure -- such as weight or volume if we are selling
+# something where the weight or volume affects the shipping
+# or discount logic.
+
 $sc_cart_index_of_measured_value = $cart{"shipping"};
 $sc_cart_index_of_item_id = $cart{"product_id"};
 $sc_cart_index_of_quantity = $cart{"quantity"};
+
+# The following will generate hidden fields with
+# the contents of the cart inside of them.
 $sc_order_with_hidden_fields = "yes";
+
+# increasing numerical value (1,2,3) if its 0,
+# then it never gets calculated at this stage
+
 $sc_max_final_values_loops = 3; # hard coded to do a min of 3 anyway!
-$sc_calculate_discount_at_display_form = 1;
-$sc_calculate_discount_at_process_form = 1;
 
 if ($sc_calculate_shipping_loop eq "" ||  
     $sc_calculate_shipping_loop < 0   ||  
@@ -240,42 +297,48 @@
 
 $sc_calculate_extra_tax3_at_display_form = 3;
 $sc_calculate_extra_tax3_at_process_form = 3;
-#
 
 # This may be used in Custom Shipping Logic, can be reset there
-# to anything else if need be
+# to anything else if needs be
 @sc_order_form_shipping_related_fields = ('Ecom_ShipTo_Method');
-@sc_order_form_discount_related_fields = ();
+
 
 # Discount logic is the same as shipping logic except
 # that whatever value is calculated for the discount will
 # be subtracted rather than added to the grand total.
 
-@sc_discount_logic  = ();
- 
-# Do we use PGP Encryption -- WARNING: This is a difficult
-# option to setup. You must go into the pgp-lib.pl file
-# and edit the pgp variables in the header for your specific
-# setup.
-#
-# UPDATE: Now PGP setup is found in manager.cgi, just set 
-#         temp variable here.  [SPK 1/18/2000] 
+@sc_order_form_discount_related_fields = ('Ecom_Discount');
 
+### Not used in agora ... use the Discount manger instead in
+### manager.cgi!  
+#@sc_discount_logic = ();
+### end of unused stuff
+
+if ($sc_calculate_discount_loop eq "" ||  
+    $sc_calculate_discount_loop < 0   ||  
+    $sc_calculate_discount_loop > 3   ) { 
+  $sc_calculate_discount_loop = 3;  # set the loop value to default
+ }
+
+$sc_calculate_discount_at_display_form = $sc_calculate_discount_loop;
+$sc_calculate_discount_at_process_form = $sc_calculate_discount_loop;
+ 
 $sc_pgp_temp_file_path = "./shopping_carts";
 
 #######################################################################
 #                     Store Option Variables                          #
 #######################################################################
 $sc_repeat_fake_it = "yes"; # attempt to answer well on reload of "cart change"
+
 # For Static HTML pages, if telling them item added ok used to sneak in msg,
 # use the %%item_ordered_msg%% token instead! Can enable if needed though:
 $sc_allow_sneak_in_message = "no"; 
+
 # this is for the %%item_ordered_msg%%
 $sc_item_ordered_msg_token = "<FONT FACE=ARIAL SIZE=2 COLOR=BLUE>Thank 
 you, your selection has been added to your order.</FONT>";
-$sc_return_to_frontpage_after_empty_cart = ""; # 'yes' or '' here only!
+
 $sc_shall_i_log_errors = "yes"; 
-$sc_shall_i_log_accesses = "yes";
 $sc_shall_i_email_if_error = "no";
 $sc_shall_i_let_client_know_item_added = "yes";
 #######################################################################
@@ -300,15 +363,16 @@
 #######################################################################
 $sc_processing_order="no"; # init this
 @acceptable_file_extensions_to_display = (".html", ".htm");
-$sc_money_symbol_spaces = ' ';
 @sc_sales_tax_form_values = ("$sc_sales_tax_state");
 $sc_no_frames_button = qq!
 <INPUT TYPE = "submit" NAME = "return_to_frontpage_button" 
  VALUE = "Return to Frontpage">
 !;
 $sc_product_display_title = "Product Listing";
-$sc_product_display_footer_helper = "<tr><td colspan=3><hr></td></tr>";
-$sc_product_display_footer = qq!</TABLE></CENTER>!;
+
+$sc_product_display_footer_helper = '<tr><td colspan="3"><hr/></td></tr>';
+$sc_product_display_footer = qq!</table></div>!;
+
 #######################################################################
 #                     Various Message Variables                       #
 #######################################################################
@@ -324,52 +388,36 @@
   "cart contents. &nbsp;The current cart contents are displayed below." .
   "&nbsp; </td></tr></table></center>"; 
 
-#comes up with "manual" changes to the URL in GET method
-$messages{'chkref_02'} =  
-  "<center><table width=500><tr><td>Sorry, " .
-  "all requests involving the cart need to come " .
-  " from the site's pages directly.&nbsp; This " . 
-  "prevents accidental changes to cart contents.<br><br>" .
-  "This error may have occured if you are running Norton Internet Security and the settings on this program are not configured correctly. " .
-  "To fix this so you can add items to your shopping cart, please follow these 3 simple steps.<br>1.) Open Norton Internet Security.<br>" . 
-  "2.) Click on the Advanced Settings Tab.<br>3.) Look at the Browsing Privacy. Referer is set to block. Set this to permit and " .
-  "you should be able to add items to your shopping cart.<br><br>" . 
-  " The current cart contents are displayed below." .
-  "&nbsp; </td></tr></table></center>"; 
-
-$messages{'chkref_03'} =  
-  "Refering Site Authentication Failed!<br>\n";
-
+# used in most if not all gateways
 #see also messages ordcnf_07,08,09
 $messages{'ordcnf_01'} = 
-  "<P>&nbsp;</P>\n" . 
-  "Thank you for shopping with us.&nbsp; Your order has been \n" .
+  "Thank you for shopping with us. Your order has been \n" .
   "received and will be shipped as soon as possible.&nbsp; Please \n" .
-  "visit us again soon!<br><P>&nbsp;</P>";
+  "visit us again soon!";
 
 #example of where used is below "Thank You" for an order
-$messages{'ordcnf_02'} = 
-  "<a href=$sc_store_url2a>Return to the Store Front</a>\n" . 
-  "<P>&nbsp;</P>\n" . 
-  "<P>&nbsp;</P>";
+$messages{'ordcnf_02'} = qq~
+  <br /><br /><a href="$sc_store_url">Return to the Store Front</a>
+~;
 
 #Happens if they "submit" the order a second time accidently
-$messages{'ordcnf_03'} = 
-  "<P>&nbsp;</P>\n" . 
-  "We do not seem to have an order verification file for this \n" .
-  "shopping cart!&nbsp; Is it possible your order was already \n" .
-  "processed?  &nbsp;If you are having trouble completing your \n" .
-  "order, please contact us at <a href=\"mailto:$sc_admin_email\">\n" .
-  "$sc_admin_email</a>. <br><br>Thank you for shopping with us!\n" . 
-  "<P>&nbsp;</P>\n";
-
-$messages{'ordcnf_04'} = 
-  "Please verify the following information.&nbsp;\n" . 
-  "When you are confident that it is correct, click the \n" .
-  "'Submit Order For Processing' button below.\n";
+$messages{'ordcnf_03'} = qq~
+  We do not seem to have an order verification file for this
+  shopping cart! Is it possible your order was already
+  processed?  If you are having trouble completing your
+  order, please contact us at <a href="mailto:$sc_admin_email">
+  $sc_admin_email</a>. <br /><br />Thank you for shopping with us!
+~;
+
+$messages{'ordcnf_04'} = qq~
+  Please verify the following information. 
+  When you are confident that it is correct, click the
+  'Submit Order For Processing' button below.
+~;
   
-$messages{'ordcnf_05'} = 
-  "There was a problem processing this order:";
+$messages{'ordcnf_05'} = qq~
+  There was a problem processing this order.
+~;
 
 $messages{'ordcnf_06'} = 
   "Please verify the above information.&nbsp;\n" . 
@@ -382,18 +430,20 @@
   "do everything we can to meet your expectations. Please visit us " .
   "again soon!\n\n";
 
+# used in confirm emails and also thank you page titles, every gateway
 $messages{'ordcnf_08'} = "Thank you for your order";
   
 # Used in Offline for the confirmation table after order is processed
-$messages{'ordcnf_09'} = 
-  "<CENTER><TABLE WIDTH=500 CELLPADDING=0 CELLSPACING=0><TR><TD><br>" .
-  "Thank you for shopping with us.&nbsp; Your order has been \n" .
-  "received and will be shipped as soon as possible.&nbsp; \n" .
-  "You will receive an email confirmation shortly.  Please \n" .
-  "print this confirmation page for your records.<br>\n" .
-  "</TD></TR></TABLE></CENTER>\n";
-$messages{'ordcnf_10'} =  '<br><br>Order Confirmation:';
-eval('$messages{"ordcnf_10"} =  &get_date . $messages{"ordcnf_10"};');
+$messages{'ordcnf_09'} = qq~
+  Thank you for shopping with us. Your order has been 
+  received and will be shipped as soon as possible.
+  You will receive an email confirmation shortly.<br />
+  Please print this confirmation page for your records.
+~;
+
+$messages{'ordcnf_10'} =  '<b>Order Confirmation</b><br /><br />';
+eval('$messages{"ordcnf_10"} =  $messages{"ordcnf_10"} . &get_date; ');
+
 
 $messages{'ordprc_01'} = qq~I'm sorry, but there seems to 
 be a problem with your order.&nbsp Please
diff -ruN 4.0K-4b/library/agora_db_lib.pl 5.0.000/library/agora_db_lib.pl
--- 4.0K-4b/library/agora_db_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/agora_db_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,35 +1,24 @@
 ###########################################################
-# AGORA_DB_LIB.PL
-
-$versions{'agora_db_lib.pl'} = "20011226";
+$versions{'agora_db_lib.pl 5 user'} = "5.0.000";
 $sc_db_engine='flatfile';
 
-# Written by Steve Kneizys for AGORA.CGI
+# Written by Steve Kneizys for AgoraCart
 #
 # Some of this comes from the original WEB_STORE_DB_LIB.PL
 # (written by Gunther Birznieks  -- "Feel free to copy, 
 #  cite, reference, sample, borrow, resell or plagiarize the 
 #  contents..." :) 
 #
-# Purpose: This library contains the routines that the
-# store uses to interface with a flatfile (plain
-# ASCII text file) database file.
-##############################################################################
-#
-# The hash %db_file_defs must have something defined for each 
-# database a database implementation has defined, such as:
-#   $db_file_defs{"PRODUCT"} = '1';
-# You can use the variable for anything, in this library it 
-# holds the full path to the file, but it must be defined!
-# 
 ##############################################################################
 sub get_prod_db_category_list {
   local (%db_ele,%category_list);
+$sc_categorylist_only = "1";
   &get_prod_db_element($db{"product"},*db_ele);
   foreach $sku (keys %db_ele) {
     $category = $db_ele{$sku};
     $category_list{$category}=1;
    }
+$sc_categorylist_only = "";
   return (sort(keys %category_list));
  }
 ############################################################
@@ -38,30 +27,25 @@
   local($result,$db_raw_line,$result);
   $result = &get_prod_db_row($product_id, *db_row, *db_raw_line, "yes");
   return $result;
-
 }
-
 ############################################################
 sub get_prod_db_row {
   local($product_id, *db_row, *db_raw_line, $cacheok) = @_;
   local($db_product_id,$save_the_line,$filename);
   $db_product_id = "";
-
   if (!($sc_db_flatfile_caching_ok =~ /yes/i)) {$cacheok = "no";}
   $db_raw_line = "";#init it
+  # if read before and caching, don't read again!
   if (($cacheok =~ /yes/i) && ($db_cache{$product_id} ne "")) {
     $line = $db_cache{$product_id};
     @db_row = split(/\|/,$line);
     $db_raw_line = $line;
     return 1;
   }
-
   $filename = $db_file_defs{"PRODUCT"};
-
   open(DATAFILE, "$filename") ||
     &file_open_error("$filename",
       "Read Database",__FILE__,__LINE__);
-
   while (($line = <DATAFILE>) &&
          ($product_id ne $db_product_id)) {
     chop($line);
@@ -72,30 +56,24 @@
       $db_cache{$db_product_id}=$save_the_line;
      }
   }
-
   if ($product_id eq $db_product_id) { 
     $db_raw_line = $save_the_line;
   }
 
   close (DATAFILE);
-
-  return ($product_id eq $db_product_id);
+  	return ($product_id eq $db_product_id);
 
 } 
-
+############################################################################
 sub get_db_row {
   local($dbname, $product_id, *db_row, *db_raw_line, $cacheok) = @_;
   local($db_product_id,$save_the_line,$filename);
   $db_product_id = "";
-
-  $db_raw_line = "";
-
+  $db_raw_line = "";#init it
   $filename = $db_file_defs{$dbname};
-
   open(DATAFILE, "$filename") ||
     &file_open_error("$filename",
       "Read Database",__FILE__,__LINE__);
-
   while (($line = <DATAFILE>) &&
          ($product_id ne $db_product_id)) {
     chop($line);
@@ -106,23 +84,24 @@
   if ($product_id eq $db_product_id) { 
     $db_raw_line = $save_the_line;
   }
-
   close (DATAFILE);
-
   return ($product_id eq $db_product_id);
-
 } 
-
-
 #################################################################
 sub get_prod_db_element {
   local($element_id,*db_ele) = @_;
   &get_db_element("PRODUCT",0,$element_id,"last",*db_ele);
 } 
+
+#################################################################
+sub get_mgr_prod_db_element {
+  local($element_id,*db_ele) = @_;
+  &get_db_element("PRODUCT",0,$element_id,"mgr",*db_ele);
+} 
 #################################################################
 sub get_prod_db_keys {
   local($element_id,%db_ele);
-  $element_id = 0; #redundant, but works
+  $element_id = 0; 
   &get_db_element("PRODUCT",0,$element_id,"last",*db_ele);
   return (keys %db_ele);
 } 
@@ -130,31 +109,52 @@
 sub get_db_keys {
   local($dbname)=@_;
   local($element_id,%db_ele);
-  $element_id = 0; #redundant, but works
+  $element_id = 0; 
   &get_db_element($dbname,0,$element_id,"last",*db_ele);
   return (keys %db_ele);
-} # End of sub get_db_keys 
+} 
 #################################################################
 sub get_db_element {
   local($data_file,$id_inx,$element_id,$dups,*db_ele) = @_;
-  local($db_id,$save_the_line,@db_row,$db_raw_line,$data_file_path);
-
+  local($db_id,$db_subcat,$db_subkey,$save_the_line,@db_row,$db_raw_line,$data_file_path);
   $data_file_path = $db_file_defs{"$data_file"};
-
   open(DATAFILE, $data_file_path) ||
     &file_open_error($data_file_path, " Read Database ",__FILE__,__LINE__);
+# conditional routing added for subcategory processing.  By Mister Ed Dec 17 2004
+  if (($sc_use_database_subcats =~ /yes/i)  && ($dups =~ /last/i) && ($sc_categorylist_only ne "1")) {
 
   while (($line = <DATAFILE>)) {
     @db_row = split(/\|/,$line);
     $db_id = $db_row[$id_inx];
+    $db_subcat = $db_row[$db{$sc_subcat_index_field}];
+    $db_subkey = $db_row[$element_id];
+if ($sc_count_database_cats =~ /yes/i) {
+$db_ele2{$db_subkey}++; }
+if ($db_ele{$db_subkey} eq "") {
+      $db_ele{$db_subkey} = $db_row[$element_id];
+     } 
+if ($db_subcat =~ /::/) {
+    my @db_subcatarray = split(/::/, $db_subcat);
+foreach my $db_subcatarray (@db_subcatarray) {
+      $db_ele{$db_subkey}->{$db_subcatarray}++;
+}
+} elsif ($db_subcat ne "") {
+      $db_ele{$db_subkey}->{$db_subcat}++;
+    } 
+  }
+  } else {
+  while (($line = <DATAFILE>)) {
+    @db_row = split(/\|/,$line);
+    $db_id = $db_row[$id_inx];
+    $db_subcat = $db_row[10]; # sub categories
     if (($db_ele{$db_id} ne "") && ($dups =~ /all/i)) {
       $db_ele{$db_id} .= "|" . $db_row[$element_id];
      } else {
       $db_ele{$db_id} = $db_row[$element_id];
      }
   }
+  }
   close (DATAFILE);
-
   return;
 } 
 ############################################################ 
@@ -162,7 +162,7 @@
   local($element_id,%db_ele,$highest,$next_key,$mykey); 
   local($padlength) = $sc_prod_db_pad_length;
   $element_id = $db{"product"};
-  &get_prod_db_element($element_id,*db_ele);
+  &get_mgr_prod_db_element($element_id,*db_ele);
   $highest=0;
   foreach $mykey (%db_ele){
     if ($mykey > $highest) {
@@ -179,7 +179,7 @@
     $next_key = "0$next_key";
    }
   return $next_key;
-} 
+}
 ############################################################
 sub put_prod_db_raw_line {
   local($product_id, $db_raw_line, $cacheok) = @_;
@@ -188,22 +188,18 @@
          $long_description, $shipping_price, $userDefinedOne, 
          $userDefinedTwo, $userDefinedThree, $userDefinedFour, 
          $userDefinedFive, $options, $junk, $line, @lines);
-
 ($ProductEditSku,$junk) = split(/\|/,$db_raw_line,2);
- 
 $filename = $db_file_defs{"PRODUCT"};
 &get_file_lock("${filename}.lock");
 open(OLDFILE, "$filename") || &my_die("Can't Open $filename");
 @lines = <OLDFILE>;
 close (OLDFILE);
 open(NEWFILE,">$filename") || &my_die("Can't Open $filename");
-
 foreach $line (@lines){
   ($sku, $category, $price, $short_description, $image, 
   $long_description, $shipping_price, $userDefinedOne, 
   $userDefinedTwo, $userDefinedThree, $userDefinedFour, 
   $userDefinedFive, $options) = split(/\|/,$line);
-
   if ($sku eq $product_id) {
    print NEWFILE $db_raw_line . "\n";
    $result=1;
@@ -211,23 +207,18 @@
    print NEWFILE $line;
   }
  }
-
 close (NEWFILE);
 &release_file_lock("${filename}.lock");
-
 if ($result ne 1 ) {
   $result = &add_new_record_to_prod_db($db_raw_line);
  }
-
 if ($db_cache{$ProductEditSku} ne "") {
   $db_cache{$ProductEditSku} = "";
  }
-# if written ok and caching, don't need to read again!
 if (($cacheok =~ /yes/i) && ($result)) {
   $db_cache{$ProductEditSku} = $db_raw_line;
  }
 return $result;
-
 } 
 ############################################################
 sub put_db_raw_line {
@@ -237,19 +228,15 @@
          $long_description, $shipping_price, $userDefinedOne, 
          $userDefinedTwo, $userDefinedThree, $userDefinedFour, 
          $userDefinedFive, $options, $junk, $line, @lines);
-
 ($ProductEditSku,$junk) = split(/\|/,$db_raw_line,2);
- 
-$filename = $db_file_defs{$dbname};
+ $filename = $db_file_defs{$dbname};
 &get_file_lock("${filename}.lock");
 open(OLDFILE, "$filename") || &my_die("Can't Open $filename");
 @lines = <OLDFILE>;
 close (OLDFILE);
 open(NEWFILE,">$filename") || &my_die("Can't Open $filename");
-
 foreach $line (@lines){
   ($sku, $junk) = split(/\|/,$line,2);
-
   if ($sku eq $product_id) {
    if ($db_raw_line ne '') {print NEWFILE $db_raw_line . "\n";}
    $result=1;
@@ -257,17 +244,13 @@
    print NEWFILE $line;
   }
  }
-
 if ($result ne 1 ) {
    if ($db_raw_line ne '') {print NEWFILE $db_raw_line . "\n";}
    $result = 1;
  }
-
 close (NEWFILE);
 &release_file_lock("${filename}.lock");
-
 return $result;
-
 } 
 ############################################################
 sub del_prod_from_db {
@@ -278,55 +261,43 @@
          $long_description, $shipping_price, $userDefinedOne, 
          $userDefinedTwo, $userDefinedThree, $userDefinedFour, 
          $userDefinedFive, $options, $junk, $line, @lines);
-
 ($ProductEditSku,$junk) = split(/\|/,$db_raw_line,2);
- 
-$filename = $db_file_defs{"PRODUCT"};
+ $filename = $db_file_defs{"PRODUCT"};
 &get_file_lock("${filename}.lock");
 open(OLDFILE, "$filename") || &my_die("Can't Open $filename");
 @lines = <OLDFILE>;
 $result=0;
 close (OLDFILE);
 open(NEWFILE,">$filename") || &my_die("Can't Open $filename");
-
 foreach $line (@lines){
   ($sku, $category, $price, $short_description, $image, 
   $long_description, $shipping_price, $userDefinedOne, 
   $userDefinedTwo, $userDefinedThree, $userDefinedFour, 
   $userDefinedFive, $options) = split(/\|/,$line);
-
   if ($sku eq $product_id) {
    $result=1;
   } else {
    print NEWFILE $line;
   }
  }
-
 close (NEWFILE);
 &release_file_lock("${filename}.lock");
-
 if ($db_cache{$ProductEditSku} ne "") {
   $db_cache{$ProductEditSku} = "";
  }
-
 return $result;
-
-} 
+}
 #######################################################################
 sub add_new_record_to_prod_db {
- 
  local ($my_new_rec) = @_;
  local ($filename);
-
  $filename = $db_file_defs{"PRODUCT"};
  &get_file_lock("${filename}.lock");
  open (NEW, "+>> $filename") || &my_die("Can't Open $filename");
  print (NEW "$my_new_rec\n");
  close(NEW);
  &release_file_lock("${filename}.lock");
-
  return 1;
-
 }
 ############################################################
 sub submit_query {
@@ -341,67 +312,46 @@
   return($status,$row_count);
 }
 ############################################################
+# Submitted/Modified 10-11-2003 by Jeffrey W. Hamilton
 sub submit_a_query {
   local($dbname, $sc_db_max_rows_returned, *form_data, *sc_db_query_criteria, 
 	*database_rows) = @_;
   local($status);
   local(@fields);
   local($row_count);
-  local(@not_found_criteria);
   local($line); 
-  local($exact_match) = $form_data{'exact_match'};
-  local($case_sensitive) = $form_data{'case_sensitive'};
   $row_count = 0;
   $filename = $db_file_defs{$dbname};
-
+  local  @patch_short_criteria = &patch_short_criteria();
   open(DATAFILE, "$filename") ||
     &file_open_error("$filename",
       "Read Database",__FILE__,__LINE__);
-
-  while(($line = <DATAFILE> ))# &&
-        #($row_count < $sc_db_max_rows_returned + 1))
+  while($line = <DATAFILE>)
   {
     chop($line); 
-
     @fields = split(/\|/, $line);
-
-    $not_found = 0;
-    foreach $criteria (@sc_db_query_criteria)
+    foreach $criteria (@patch_short_criteria)
     {  
-      $not_found += &flatfile_apply_criteria(
-	$exact_match,
-	$case_sensitive,
-	*fields,
-	$criteria);
+      $not_found = &flatfile_apply_criteria(*fields, $criteria);
+	last if ($not_found);
     }
-
-    if (($not_found == 0))# && 
-        #($row_count <= $sc_db_max_rows_returned))
+    if (!$not_found)
     {
-#      push(@database_rows, join("\|", @fields));
-      push(@database_rows, $fields[0]);
-    }
-
-    if ($not_found == 0) {
-      $row_count++;
+          push(@database_rows, $fields[0]);
+	      $row_count++;
     }
   } 
-
   close (DATAFILE);
-
-if ($row_count > $sc_db_max_rows_returned) {
+  if ($row_count > $sc_db_max_rows_returned)
+  {
     $status = "max_rows_exceeded";
-} 
-
+  } 
   @database_rows = sort(@database_rows);
-
   return($status,$row_count);
-
 } 
 ############################################################
 sub flatfile_apply_criteria {
-  local($exact_match, $case_sensitive,
-      *fields, $criteria) = @_;
+  local(*fields, $criteria) = @_;
   local($c_name, $c_fields, $c_op, $c_type);
   local(@criteria_fields);
   local($not_found);
@@ -411,66 +361,49 @@
   local($db_date, $form_date);
   local($db_index);
   local(@word_list);
-
+  local($exact_match) = $form_data{'exact_match'};
+  local($case_sensitive) = $form_data{'case_sensitive'};
   ($c_name, $c_fields, $c_op, $c_type) = 
-     split(/\|/, $criteria);
-
+	split(/\|/, $criteria);
   @criteria_fields = split(/,/,$c_fields);
-
   $form_value = $form_data{$c_name};
-
   $form_value =~ s/\0/ /g; 
   $form_value =~ s/(\s+)/ /g; 
   $form_value =~ s/(^\s)//g;  
-
   if ($form_value eq "")
   {
     return 0;
   }
-
-
-  if (($c_type =~ /date/i) ||
+  if (($c_type =~ /date/i) || 
      ($c_type =~ /number/i) ||
      ($c_op ne "="))
   {
-
     $not_found = "yes";
-
     foreach $db_index (@criteria_fields)
     {
-
       $db_value = $fields[$db_index];
-
       if ($c_type =~ /date/i) 
       {
-        ($month, $day, $year) =
-          split(/\//, $db_value);
-        $month = "0" . $month
-          if (length($month) < 2);
-        $day = "0" . $day
-          if (length($day) < 2);
-        if ($year > 50 && $year < 1900) {
-          $year += 1900;
-        }
-        if ($year < 1900) {
-          $year += 2000;
-        }
+        ($month, $day, $year) = split(/\//, $db_value);
+        $month = "0" . $month if (length($month) < 2);
+        $day = "0" . $day if (length($day) < 2);
+        if ($year > 50 && $year < 100) {
+		$year += 1900;
+	  }
+        if ($year <= 50) {
+		$year += 2000;
+	  }
         $db_date = $year . $month . $day;
-
-        ($month, $day, $year) =
-          split(/\//, $form_value);
-        $month = "0" . $month
-          if (length($month) < 2);
-        $day = "0" . $day
-          if (length($day) < 2);
-        if ($year > 50 && $year < 1900) {
-          $year += 1900;
-        }
-        if ($year < 1900) {
-          $year += 2000;
-        }
+        ($month, $day, $year) = split(/\//, $form_value);
+        $month = "0" . $month if (length($month) < 2);
+        $day = "0" . $day if (length($day) < 2);
+        if ($year > 50 && $year < 100) {
+		$year += 1900;
+	  }
+        if ($year <= 50) {
+		$year += 2000;
+	  }
         $form_date = $year . $month . $day;
-
         if ($c_op eq ">") {
           return 0 if ($form_date > $db_date); }
         if ($c_op eq "<") {
@@ -481,9 +414,8 @@
           return 0 if ($form_date <= $db_date); }
         if ($c_op eq "!=") {
           return 0 if ($form_date != $db_date); }
-        if ($c_op eq "=") {
+        if (($c_op eq "=") || ($c_op eq "==")) {
           return 0 if ($form_date == $db_date); }
-
       } elsif ($c_type =~ /number/i) {
         if ($c_op eq ">") {
           return 0 if ($form_value > $db_value); }
@@ -495,11 +427,10 @@
           return 0 if ($form_value <= $db_value); }
         if ($c_op eq "!=") {
           return 0 if ($form_value != $db_value); }
-        if ($c_op eq "=") {
+        if (($c_op eq "=") || ($c_op eq "==")) {
           return 0 if ($form_value == $db_value); }
-
       } else { 
-        if ($c_op eq ">") {
+        if ($c_op eq ">") {# $c_type is a string
           return 0 if ($form_value gt $db_value); }
         if ($c_op eq "<") {
           return 0 if ($form_value lt $db_value); }
@@ -509,28 +440,23 @@
           return 0 if ($form_value le $db_value); }
         if ($c_op eq "!=") {
           return 0 if ($form_value ne $db_value); }
+        if ($c_op eq "==") {
+          return 0 if ($form_value eq $db_value); }
       }    
-    } 
+    }
     
   } else { 
-
     @word_list = split(/\s+/,$form_value);
-
-
     foreach $db_index (@criteria_fields)
     {
- 
-
       $db_value = $fields[$db_index];
       $not_found = "yes";
- 
       local($match_word) = "";
       local($x) = "";
-
       if ($case_sensitive eq "on") {
           if ($exact_match eq "on") {
               for ($x = @word_list; $x > 0; $x--) {
-            # \b matches on word boundary
+                  # \b matches on word boundary
                   $match_word = $word_list[$x - 1];
                   if ($db_value =~ /\b$match_word\b/) {
                       splice(@word_list,$x - 1, 1);
@@ -547,11 +473,11 @@
       } else {
           if ($exact_match eq "on") {
               for ($x = @word_list; $x > 0; $x--) {
-      # \b matches on word boundary
+                  # \b matches on word boundary
                   $match_word = $word_list[$x - 1];
                   if ($db_value =~ /\b$match_word\b/i) {
                       splice(@word_list,$x - 1, 1);
-                  }  
+                  } 
               } 
           } else {
               for ($x = @word_list; $x > 0; $x--) {
@@ -562,18 +488,12 @@
               } 
           } 
       }
-
-  
-
     } 
-
     if (@word_list < 1) 
     {
       $not_found = "no";
     }
-
   } 
-
   if ($not_found eq "yes")
   {
     return 1;
@@ -608,12 +528,13 @@
   local (
    $name,
    $path,
-   $fields_to_index_by_keyword,	
-   $fields_to_index_as_is,	
+   $fields_to_index_by_keyword,	# optional
+   $fields_to_index_as_is,	# optional
    @fieldnames			# optional ?
   ) = @_;
   &codehook("init_a_database_top");
   if ($db_file_defs{"$name"} ne '') {
+  # already 'opened', so we know where to init the file
     $zpath = $db_file_defs{"$name"}
    } else {
     if ($path eq '') { $ path = "$sc_data_file_dir";}
@@ -621,7 +542,6 @@
    }
   $zpath =~ /([^\xFF]*)/;
   $zpath = $1;
-#print "Content-type: text/html;\n\n$zpath<br>\n";
   open(NEWFILE,">$zpath") || &my_die("Can't Open $zpath");
   close(NEWFILE);
   return;
@@ -636,6 +556,77 @@
  return;
  }
 #######################################################################
+   # Free Contribution by Mark S. (MAS aka Algernon), an AgoraCart Pro member.
+   # 
+   # DISCUSSION: The default Agora database engine will check for every
+   # search test to every single record in your database, even if none of
+   # those tests apply to what you are currently attempting to do. The
+   # typical criteria list has 10 search types in it, so if you're clicking
+   # on 'Category' in your database of 10,000 entries the flat file
+   # criteria routine will be called 100,000 times when it only should be
+   # called 10,000 times.
+   # 
+#######################################################################
+sub patch_short_criteria {
+    local @patch_db_query_criteria;
+    local ($criteria, $c_name,$c_fields, $c_op, $c_type,$form_value ) ;
+    foreach $criteria (@sc_db_query_criteria) {
+	($c_name, $c_fields, $c_op, $c_type) = split(/\|/, $criteria);
+	@criteria_fields = split(/,/,$c_fields);
+	$form_value = $form_data{$c_name};
+	$form_value =~ s/\0/ /g; 
+	$form_value =~ s/(\s+)/ /g; 
+	$form_value =~ s/(^\s)//g;  
+	next if ($form_value eq "") ;
+	push @patch_db_query_criteria, $criteria ;
+    } 
+    return @patch_db_query_criteria ;
+}
+############################################################
+# added by Mister Ed Jan 27, 2005
+sub check_db_with_product_id_for_info {
+  local($product_id, $data_field_thingy, *db_row) = @_;
+  local($result,$db_raw_line);
+  $result = &get_prod_thingy_in_db_row($product_id, $data_field_thingy, *db_row, *db_raw_line, "yes");
+  return $result;
+}
+############################################################
+sub get_prod_thingy_in_db_row {
+  local($product_id, $data_field_thingy, *db_row, *db_raw_line, $cacheok) = @_;
+  local($db_product_id,$save_the_line,$filename,$result);
+  $db_product_id = "";
+  if (!($sc_db_flatfile_caching_ok =~ /yes/i)) {$cacheok = "no";}
+  $db_raw_line = "";#init it
+  # if read before and caching, don't read again!
+  if (($cacheok =~ /yes/i) && ($db_cache{$product_id} ne "")) {
+    $line = $db_cache{$product_id};
+    @db_row = split(/\|/,$line);
+	$result = $db_row[$data_field_thingy];
+    $db_raw_line = $line;
+    return $result;
+  }
+  $filename = $db_file_defs{"PRODUCT"};
+  open(DATAFILE, "$filename") ||
+    &file_open_error("$filename",
+      "Read Database",__FILE__,__LINE__);
+  while (($line = <DATAFILE>) &&
+         ($product_id ne $db_product_id)) {
+    chop($line);
+    @db_row = split(/\|/,$line);
+    $save_the_line = $line;
+    $db_product_id = $db_row[0];
+    if ($cacheok =~ /yes/i) {
+      $db_cache{$db_product_id}=$save_the_line;
+     }
+  }
+  if ($product_id eq $db_product_id) { 
+    $db_raw_line = $save_the_line;
+	$result = "$db_row[$data_field_thingy]";
+  }
+  close (DATAFILE);
+  return $result;
+} 
+#######################################################################
 if ($sc_db_lib_was_loaded ne "yes") {
   $sc_db_lib_was_loaded = "yes";
   &init_agora_database_library;
@@ -644,4 +635,3 @@
  }
 #############################################################################
 1;
-
diff -ruN 4.0K-4b/library/agora_html_lib.pl 5.0.000/library/agora_html_lib.pl
--- 4.0K-4b/library/agora_html_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/agora_html_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,9 +1,12 @@
 #######################################################################
-
-$versions{'agora_html_lib.pl'} = "20021020";
-
+$versions{'agora_html_lib.pl'} = "5.0.000";
+#######################################################################
+if ($sc_main_script_post_url eq '') { 
+  $sc_main_script_post_url = $sc_main_script_url;
+ }
 #######################################################################
 sub load_server_side_cookies {
+  local($temp);
   &codehook("before_server_cookie_load");
   undef(%agora); 
   undef(%agora_original_values);
@@ -11,18 +14,40 @@
   if (-e "$sc_server_cookie_path" && -r "$sc_server_cookie_path"){ 
     eval('require "$sc_server_cookie_path"'); 
    }
+&require_supporting_libraries (__FILE__, __LINE__,
+    "./admin_files/agora_userlog_lib.pl");
   if (&get_agora('LAST_VISIT_TIMESTAMP') eq '') { 
-    if ($sc_shall_i_log_accesses eq "yes") { 
+    if ($sc_shall_i_log_accesses eq "yes") {
       &log_access_to_store;
      }
+    eval q~
+     use HTTP::BrowserDetect;
+     my $browser = new HTTP::BrowserDetect($ENV{"HTTP_USER_AGENT"});
+     if ($browser->robot()) {&set_agora("BOT",1);}else{&set_agora("BOT",'');}
+     &set_agora("BROWSER",$browser->browser_string().'/'.$browser->version());
+     ~;
+     &set_agora("HTTP_USER_AGENT",$ENV{'HTTP_USER_AGENT'});
+     if (&get_agora("BROWSER") eq '') {
+       ($temp,$junk) = split(/ /,$ENV{'HTTP_USER_AGENT'},2);
+       &set_agora("BROWSER",substr($temp,0,15));
+      }
    }
   &set_agora('LAST_VISIT_TIMESTAMP',time());
+  if (&get_agora("BOT") ne '') {
+    $sc_special_page_meta_tags .= $sc_robot_meta_tags;
+   } else {
+    $sc_special_page_meta_tags .= $sc_browser_meta_tags;
+   }
   &codehook("after_server_cookie_load");
  }
 #######################################################################
 sub set_agora {
   local($inx,$val) = @_;
-  $agora{$inx} = $val;
+  if ($val eq '') {
+    delete($agora{$inx});
+   } else {
+    $agora{$inx} = $val;
+   }
   return $val;
  }
 #########################################################################
@@ -45,7 +70,7 @@
    }
  }
 #########################################################################
-sub ain_agora { 
+sub ain_agora {
   local($inx,$val) = @_;
   if ((&get_agora($inx) eq '') && ($val ne '')) {
     &set_agora($inx,$val);
@@ -56,20 +81,34 @@
  }
 #########################################################################
 sub agora_cookie_save {
-  local($inx);
+  local($inx,$temp);
+  foreach $inx (keys %form_data) {
+    $temp .= "$inx\x01$form_data{$inx}\x01";
+   }
+  &set_agora("PREVIOUS_FORM_VALUES",$temp);
   open(SERVCOOKIE,">$sc_server_cookie_path");
-  print SERVCOOKIE "# Library of Server Cookies\n";
+  print SERVCOOKIE "# Library of agora.cgi Server Cookies\n";
   foreach $inx (sort(keys %agora)) {
-    print SERVCOOKIE "\$agora{'$inx'} = &str_decode('" . 
-	&str_encode($agora{$inx}) . "');\n";
+    $temp = &str_encode($agora{$inx});
+    if ($temp =~ /\%/) {
+      print SERVCOOKIE "\$agora{'$inx'} = &str_decode('" . 
+       &str_encode($agora{$inx}) . "');\n";
+     } else {
+      print SERVCOOKIE "\$agora{'$inx'} = '" . 
+       $agora{$inx} . "';\n";
+     }
    }
   print SERVCOOKIE '{local($inx);' .
-	'foreach $inx (keys %agora) {' .
-	'$agora_original_values{$inx} = $agora{$inx};}' . "}\n";
+  'foreach $inx (keys %agora) {' .
+  '$agora_original_values{$inx} = $agora{$inx};}' . "}\n";
   print SERVCOOKIE "#\n1;\n";
   close(SERVCOOKIE);
  }
 #########################################################################
+sub get_agora_names {
+  return sort(keys %agora);
+ }
+#########################################################################
 sub str_encode { 
   local($str)=@_;
   local($mypat)='[\x00-\x1F"\x27#%/+;<>?\x7F-\xFF]';
@@ -85,7 +124,7 @@
   return $str;
  }
 #######################################################################
-sub load_file_lines_to_str {#
+sub load_file_lines_to_str {
   local ($location) = @_;
   local (@lines)=();
   open (XX_FILE, "<$location");
@@ -120,28 +159,34 @@
   return $field;
  }
 #######################################################################
-sub load_opt_file_engine { # do the actual loading of options file(s)
+sub load_opt_file_engine {
   local($field) = @_;
   local($very_first_part,$stuff_after,$arg,$newpath,$myans,$tack_on);
   local(%file_list);
-
   while ($field =~ /(%%Load_Option_File )([^%]+)(%%)/i) {
     $arg = $2;
     $arg =~ s/ //g;
-    if ($arg =~ /,/) { 
+    if ($arg =~ /,/) {
       $arg =~ s/,/%%%%Load_Option_File /g;
       $myans = "%%Load_Option_File $arg%%";
      } else {
       $newpath = "$sc_options_directory_path/$arg";
-      if ($file_list{$newpath} eq '') { 
-        $file_list{$newpath} = "1";
+      if ($file_list{$newpath} eq '') {
+        # added by Mister Ed September 14, 2006
+        # allow tokens to be processed multiple times for efficiency in
+        # larger option matrices.  By default it is not enabled.
+        if ($sc_enable_multi_load_option_files =~ /yes/i) {
+            $file_list{$newpath} = "";
+        } else {
+            $file_list{$newpath} = "1";
+        }
         $myans = &load_file_lines_to_str($newpath);
        } else {
         $myans = " (reload of option $arg attempted!) ";
        }
      }
     ($very_first_part,$myans,$stuff_after) =  
-	split(/<h3>--cut here--<\/h3>/i,$myans,3);
+  split(/<h3>--cut here--<\/h3>/i,$myans,3);
     if ($myans eq "") {
       $myans = $very_first_part;
       $tack_on = '';
@@ -153,6 +198,8 @@
      }
     $field =~ s/(%%Load_Option_File )([^%]+)(%%)/$myans/i;
     if (($tack_on ne '') && (!($field =~ /<h3>--cut here--<\/h3>/i))) {
+     # there exists the cut tags in loaded files but not source ...
+     # need to manually add them or we could be in trouble 
       $field  = '<H3>--cut here--</H3>' . $field;
       $field .= '<H3>--cut here--</H3>';
      }
@@ -169,7 +216,6 @@
  if ($sc_opt_web_strip_part_number =~ /yes/i) {
    for ($a2=0; $a2 <= $#xx; $a2++) {
      if (substr($xx[$a2],0,1) eq "#") {
-       # strip off the part number 
        ($temp,$xx[$a2]) = split(/ /,$xx[$a2],2); 
       }
     }
@@ -207,24 +253,19 @@
 sub add_csv {
  local ($what, $str) = @_;
 
- if (($what =~ /\,/) || ($what =~ /\"/)) { #need to quote it
+ if (($what =~ /\,/) || ($what =~ /\"/)) {
   $what =~ s/\"/\"\"/g;
   $what = '"' . $what . '"';
  }
-
  if ($str ne "") {
   $what = $str . "," . $what;
   }
-
  return $what;
-
 }
 #######################################################################
 sub eval_custom_logic {
-
  local ($logic,$whoami,$file,$line) = @_;
  local ($err_code, $result) = "";
-
  if ($logic ne "") {
    $result = eval($logic);
    $err_code = $@;
@@ -233,61 +274,46 @@
      $result="";
     }
   }
-
  return $result;
-
 }
 #######################################################################
 sub product_page_header {
-
 local ($page_title,$prod_message) = @_;
-
 local ($hidden_fields) = &make_hidden_fields;
 local ($my_hdr);
-$my_hdr = qq~
-<HTML>
-<HEAD>
-<TITLE>$page_title - $form_data{'product'}</TITLE>
-$sc_standard_head_info</HEAD>
-<BODY $sc_standard_body_info>
-~;
+$my_hdr = qq~$sc_doctype
+<html>
+<head>
+  <title>$page_title - $form_data{'product'}</title>
+  $sc_standard_head_info
+</head>
+<body>~;
 $my_hdr = &agorascript($my_hdr,"","sub product_page_header",__FILE,__LINE__);
-
 &codehook("product_page_header");
 print $my_hdr;
-
 &StoreHeader;
-
 if ($prod_message ne "") {
   print "$prod_message\n";
  }
 printf($sc_product_display_header, @sc_db_display_fields);
-
 }
 #######################################################################
 sub product_page_footer {
 local($keywords,$zmessage);
 $keywords = $form_data{'keywords'};
-
 $keywords =~ s/ /+/g;
-
 local($prod_message) = @_;
-
 $zmessage = qq~
 $sc_product_display_footer
-
 $prod_message~;
-
 &codehook("product_page_footer_top");
 print $zmessage;
 &StoreFooter;
-
 $zmessage=qq~
-</BODY>
-</HTML>~;
+</body>
+</html>~;
 &codehook("product_page_footer_bot");
 print $zmessage;
-
 }
 
 sub product_message {
@@ -295,24 +321,15 @@
 local($db_status, $rowCount, $nextHits) = @_;
 local($warn_message);
 local($prevHits) = $nextHits;
-
 $keywords = $form_data{'keywords'};
-$save_next= $form_data{'next'}; 
-
+$save_next= $form_data{'next'};
 $keywords =~ s/ /+/g;
-
-
 if ($db_status ne "") 
 {
-
-	if ($db_status =~ /max.*row.*exceed.*/i) 
-	{
-
-$warn_message =  
-	"<DIV ALIGN=CENTER><table width=$sc_search_nav_width " . 
-	"bgcolor=$sc_search_nav_bgcolor>";
-$warn_message .= "\n<tr>\n <td align=center><FONT $sc_search_nav_font>\n";
-
+  if ($db_status =~ /max.*row.*exceed.*/i) 
+  {
+$warn_message = qq~<div align="center"><table class="ac_seach_results">
+<tr><td class="ac_seach_results">\n~;
 if ($maxCount < $rowCount) {
   $my_last = $maxCount;
  } else {
@@ -328,7 +345,6 @@
  } else {
   $my_prevHits = $prevHits;
  }
-
 if ($my_first == $my_last) {
   $warn_message .= "Found $rowCount items, showing " .
   $my_last . ". &nbsp;&nbsp;";
@@ -336,102 +352,86 @@
   $warn_message .= "Found $rowCount items, showing " .
   ($my_first) . " to " . $my_last . ". &nbsp;&nbsp;";
  }
-
-		if($form_data{'next'} > "0")
-		{
-		$form_data{'next'}=$prevCount;
-		$href_fields = &make_href_fields;
-		$href_info = "'$sc_main_script_url?$href_fields'";
-		$warn_message .= qq!
+    if($form_data{'next'} > "0")
+    {
+    $form_data{'next'}=$prevCount;
+    $href_fields = &make_href_fields;
+    $href_info = "'$sc_main_script_url?$href_fields'";
+    $warn_message .= qq!
 <a href=$href_info>Previous $my_prevHits Matches</a>&nbsp;&nbsp;
 !;
-		}
-
-		if ($maxCount == $rowCount-1)
-		{
-			$nextHits = (@database_rows-$maxCount);
-			if ($nextHits == 1)
-			{
-			$form_data{'next'}=$maxCount;
-			$href_fields = &make_href_fields;
-			$href_info = "'$sc_main_script_url?$href_fields'";
-			$warn_message .= qq!
+    }
+    if ($maxCount == $rowCount-1)
+    {
+      $nextHits = (@database_rows-$maxCount);
+      if ($nextHits == 1)
+      {
+      $form_data{'next'}=$maxCount;
+      $href_fields = &make_href_fields;
+      $href_info = "'$sc_main_script_url?$href_fields'";
+      $warn_message .= qq!
 <a href=$href_info>Last Match</a>&nbsp;&nbsp;
 !;
-			}
-
-		}
-
-	if ($maxCount < $rowCount && $maxCount != $rowCount-1)
-	{
-
-		if ($maxCount >= $rowCount-$nextHits )
-		{
-		$lastCount = $rowCount-$maxCount;
-		$form_data{'next'}=$maxCount;
-		$href_fields = &make_href_fields;
-		$href_info = "'$sc_main_script_url?$href_fields'";
-		$warn_message .= qq!
+      }
+    }
+  if ($maxCount < $rowCount && $maxCount != $rowCount-1)
+  {
+    if ($maxCount >= $rowCount-$nextHits )
+    {
+    $lastCount = $rowCount-$maxCount;
+    $form_data{'next'}=$maxCount;
+    $href_fields = &make_href_fields;
+    $href_info = "'$sc_main_script_url?$href_fields'";
+    $warn_message .= qq!
 <a href=$href_info>Last $lastCount Matches</a>&nbsp;&nbsp;
 !;
-		}
-		else
-		{
-		$form_data{'next'}=$maxCount; 
-		$href_fields = &make_href_fields;
-		$href_info = "'$sc_main_script_url?$href_fields'";
-		$warn_message .= qq!
-<a href=$href_info>Next $nextHits Matches</a>	
+    }
+    else
+    {
+    $form_data{'next'}=$maxCount; 
+    $href_fields = &make_href_fields;
+    $href_info = "'$sc_main_script_url?$href_fields'";
+    $warn_message .= qq!
+<a href=$href_info>Next $nextHits Matches</a> 
 !;
-	}
-
-	}
-
-        $warn_message .= "</font></td></tr></table>\n";
-	$warn_message .= "</DIV>";
-
-	}
+  }
 
+  }
+        $warn_message .= "</td></tr></table>\n";
+  $warn_message .= "</div>";
+  }
 }
-
-$form_data{'next'} = $save_next;# must restore our original state!
+$form_data{'next'} = $save_next;
 return $warn_message;
-
 }
-
 #######################################################################
 sub html_search_page_footer {
-
 print qq~
-
-<CENTER>
-<INPUT TYPE = "submit" NAME = "modify_cart_button" VALUE = "View/Modify Cart">
+<div align="center">
+<input type="submit" name="modify_cart_button" value="View/Modify Cart">
 $sc_no_frames_button
-<INPUT TYPE = "submit" NAME = "order_form_button" VALUE = "Checkout Stand">
-</FORM>
-</CENTER>  
-</BODY>
-</HTML>~;
-
+<input type="submit" name="order_form_button" value="Checkout Stand">
+</form>
+</div>  
+</body>
+</html>~;
 }
 #######################################################################
 sub standard_page_header {
  local($type_of_page) = @_;
  local ($hidden_fields) = &make_hidden_fields;
  local($header);
-
- $header = qq~
-<HTML>
-<HEAD>
+ $header = qq~$sc_doctype
+<html>
+<head>
 $sc_special_page_meta_tags
-<TITLE>$type_of_page</TITLE>
-$sc_standard_head_info</HEAD>
-<BODY $sc_standard_body_info>
+  <title>$type_of_page</title>
+  $sc_standard_head_info
+</head>
+<body>
 ~;
-
  &codehook("standard_page_header");
  print $header;
-
 }
 #######################################################################
 sub modify_form_footer {
@@ -447,9 +447,7 @@
 &codehook("modify_form_footer");
 print $footer;
 &StoreFooter;
-
 }
-
 #######################################################################
 sub delete_form_footer {
 local($footer)="";
@@ -464,21 +462,17 @@
 &codehook("delete_form_footer");
 print $footer;
 &StoreFooter;
-
 }
 #######################################################################
 sub cart_footer {
 local($grand_total,$quantity) = @_;
 local($file_title,$footer)="";
-
 $file_title = "$sc_templates_dir/empty_cart_footer.inc";
 if (($quantity > 0) || (!(-f $file_title))) {
   $file_title = "$sc_templates_dir/cart_footer.inc";
  }
-
 open (CARTFOOTER, "$file_title") ||
 &file_open_error("$sc_cart_path", "cartfooter", __FILE__, __LINE__);
-
 while (<CARTFOOTER>) {
   $footer .= $_;
  }
@@ -487,7 +481,6 @@
 &codehook("cart_footer");
 print $footer;
 &StoreFooter;
-
 }
 #######################################################################
 sub script_and_substitute_footer {
@@ -496,267 +489,256 @@
  local($offlineSecureURL)="";
 
  if($sc_gateway_name eq "Offline") {
-   $offlineSecureURL =
-"</FORM>
-<FORM METHOD\=POST ACTION\=\"$sc_order_script_url\">
-<INPUT TYPE\=HIDDEN NAME\=\"cart_id\" VALUE\=\"$cart_id\">";
+   $offlineSecureURL = qq~
+</div></form>
+<div align="center">
+<form method=post action="$sc_order_script_url">
+<input type=hidden name="cart_id" value="$cart_id">
+~;
+# Added by Mister Ed August 9, 2006
+  } elsif ($sc_ssl_location_url2 ne "") {
+   $offlineSecureURL = qq~
+</div></form>
+<div align="center">
+<form method=post action="$sc_stepone_order_script_url">
+<input type=hidden name="cart_id" value="$cart_id">
+~;
   }
-
   $footer = &agorascript($footer,"pre","sub modify_form_footer",
-	__FILE__,__LINE__);
-
+  __FILE__,__LINE__);
   $footer =~ s/%%URLofImages%%/$URL_of_images_directory/g;
   $footer =~ s/%%cart_id%%/%%ZZZ%%/g;
   $footer =~ s/%%sc_order_script_url%%/$sc_order_script_url/g;
   $footer =~ s/%%StepOneURL%%/$sc_stepone_order_script_url/ig;
   $footer =~ s/%%offlineSecureURL%%/$offlineSecureURL/g;
-
+  $footer =~ s/%%ButtonSetURL%%/$sc_buttonSetURL/ig;
   while ($footer =~ /%%ZZZ%%/) {
     $cart_id_for_html = &cart_id_for_html;
     $footer =~ s/%%ZZZ%%/$cart_id_for_html/;
   }
-
   $footer = &agorascript($footer,"post","sub modify_form_footer",
-	__FILE__,__LINE__);
+  __FILE__,__LINE__);
   $footer = &agorascript($footer,"","sub modify_form_footer",
-	__FILE__,__LINE__);
-
+  __FILE__,__LINE__);
   return $footer;
-
  }
 #######################################################################
 sub bad_order_note {
-
 local($button_to_set) = @_;
 $button_to_set = "try_again" if ($button_to_set eq "");
-
+#added by Mister Ed September 9, 2006
+&codehook("bad_order_note_top");
 &standard_page_header("Error");
-
 &StoreHeader;
-
+if ($sc_bad_order_note_alt) {
 print qq!
-<CENTER>
-<TABLE WIDTH="500">
-<TR>
-<TD>
-<FONT FACE="ARIAL">
-<P>
-<BR>
-I'm sorry, it appears that you did not enter a valid numeric
-quantity (whole numbers greater than zero). Please use your 
-browser's Back button and try again. Thanks\!<BR>
-<P>
-</FONT>
-</TD>
-</TR>
-</TABLE>
-</CENTER>
+<div align="center">
+<p class="ac_error">
+$sc_bad_order_note_alt
+</p>
 !;
-
+} else {
+print qq!
+<div align="center">
+<p class="ac_error">
+  I'm sorry, it appears that you did not enter a valid numeric
+  quantity <br>(whole numbers greater than zero).<br>Please use your 
+  browser's Back button and try again. Thanks\!
+</p>
+!;
+}
 &StoreFooter;
-
+$sc_bad_order_note_alt = '';
 &call_exit;
-
 }
 #######################################################################
 sub make_hidden_fields {
 local($hidden,$db_query_row,$temp,$db_form_field);
+local($special_stuff)='';
 $cart_id_for_html = &cart_id_for_html;
-$hidden = qq!
-<INPUT TYPE = "hidden" NAME = "cart_id" VALUE = "$cart_id_for_html">
-<INPUT TYPE = "hidden" NAME = "page" VALUE = "$form_data{'page'}">!;
-
+if ($sc_running_an_SSI_store =~ /yes/i) {
+  $special_stuff.='  <input type="hidden" name="SSI" value="1">'."\n";
+  $special_stuff.='  <input type="hidden" name="crtmod" value="';
+  $special_stuff.= &make_random_chars . "\">\n";  
+ }
+$hidden = qq!$special_stuff
+  <input type="hidden" name="cart_id" value="$cart_id_for_html">
+  <input type="hidden" name="page" value="$form_data{'page'}">!;
 if ($form_data{'keywords'} ne "") 
 {
 $temp = $form_data{'keywords'};
-$temp =~ s/\0/ /g; #multi values should be sep. by blanks
-$temp =~ s/(\s+)/ /g; #de-multi-blank it
-$temp =~ s/(^\s)//g;  #remove leading blank, if there
+$temp =~ s/\0/ /g; 
+$temp =~ s/(\s+)/ /g; 
+$temp =~ s/(^\s)//g;
 $hidden .= qq!
-<INPUT TYPE = "hidden" NAME = "keywords" VALUE = "$temp">!;
+<input type="hidden" name="keywords" value="$temp">!;
 }
-
 if ($form_data{'cartlink'} ne "") 
 {
 $hidden .= qq!
-<INPUT TYPE = "hidden" NAME = "cartlink" VALUE = "$form_data{'cartlink'}">!;
+<input type="hidden" name="cartlink" value="$form_data{'cartlink'}">!;
 }
-
 if ($form_data{'next'} ne "") 
 {
 $hidden .= qq!
-<INPUT TYPE = "hidden" NAME = "next" VALUE = "$form_data{'next'}">!;
+<input type="hidden" name="next" value="$form_data{'next'}">!;
 }
-
 if ($form_data{'ppinc'} ne "") 
 {
 $hidden .= qq!
-<INPUT TYPE = "hidden" NAME = "ppinc" VALUE = "$form_data{'ppinc'}">!;
+<input type="hidden" name="ppinc" value="$form_data{'ppinc'}">!;
 }
-
 if ($form_data{'maxp'} ne "") 
 {
 $hidden .= qq!
-<INPUT TYPE = "hidden" NAME = "maxp" VALUE = "$form_data{'maxp'}">!;
+<input type="hidden" name="maxp" value="$form_data{'maxp'}">!;
 }
-
 if ($form_data{'exact_match'} ne "") 
 {
 $hidden .= qq!
-<INPUT TYPE = "hidden" NAME = "exact_match" VALUE = "$form_data{'exact_match'}">!;
+<input type="hidden" name="exact_match" value="$form_data{'exact_match'}">!;
 }
-
 if ($form_data{'case_sensitive'} ne "") 
 {
 $hidden .= qq!
-<INPUT TYPE = "hidden" NAME = "case_sensitive" VALUE = "$form_data{'case_sensitive'}">!;
+<input type="hidden" name="case_sensitive" value="$form_data{'case_sensitive'}">!;
+}
+# Added by Mister Ed June 20, 2005
+if ($form_data{'affiliate'} ne "") 
+{
+$hidden .= qq!
+<input type="hidden" name="affiliate" value="$form_data{'affiliate'}">!;
+}
+# Added by Mister Ed June 20, 2005
+if ($form_data{'member'} ne "") 
+{
+$hidden .= qq!
+<input type="hidden" name="member" value="$form_data{'member'}">!;
+}
+# Added by Mister Ed June 20, 2005
+if ($form_data{'pricing'} ne "") 
+{
+$hidden .= qq!
+<input type="hidden" name="pricing" value="$form_data{'pricing'}">!;
 }
-
 foreach $db_query_row (@sc_db_query_criteria) 
 {
 $db_form_field = (split(/\|/, $db_query_row))[0];
 if ($form_data{$db_form_field} ne "" && $db_form_field ne "keywords") 
 {
 $hidden .= qq!
-<INPUT TYPE = "hidden" NAME = "$db_form_field" VALUE = "$form_data{$db_form_field}">!;
+<input type="hidden" name="$db_form_field" value="$form_data{$db_form_field}">!;
 }
-
 }
-
 &codehook("make_hidden_fields_bot");
 return ($hidden);
-
 }
-
 #######################################################################
 sub make_href_fields {
 local($href) = "";
 local($db_query_row, $db_form_field, $temp);
-
 $cart_id_for_html = &str_encode(&cart_id_for_html);
 $href = "cart_id=$cart_id_for_html";
-
 if ($form_data{'page'} ne "")
 { 
-$href .= "&page=" . &str_encode($form_data{'page'});
+$href .= "&amp;page=" . &str_encode($form_data{'page'});
 }
-
 if ($form_data{'keywords'} ne "") 
 {
 $temp = $form_data{'keywords'};
 $temp = &str_encode($temp);
-$href .= "&keywords=$temp";
+$href .= "&amp;keywords=$temp";
 }
-
 if ($form_data{'next'} ne "") 
 {
-$href .= "&next=$form_data{'next'}";
+$href .= "&amp;next=$form_data{'next'}";
 }
-
 if ($form_data{'maxp'} ne "") 
 {
-$href .= "&maxp=$form_data{'maxp'}";
+$href .= "&amp;maxp=$form_data{'maxp'}";
 }
-
 if ($form_data{'ppinc'} ne "") 
 {
-$href .= "&ppinc=" . &str_encode($form_data{'ppinc'});
+$href .= "&amp;ppinc=" . &str_encode($form_data{'ppinc'});
 }
-
 if ($form_data{'exact_match'} ne "") 
 {
-$href .= "&exact_match=$form_data{'exact_match'}";
+$href .= "&amp;exact_match=$form_data{'exact_match'}";
 }
-
 if ($form_data{'case_sensitive'} ne "") 
 {
-$href .= "&case_sensitive=$form_data{'case_sensitive'}";
+$href .= "&amp;case_sensitive=$form_data{'case_sensitive'}";
+}
+# Added by Mister Ed June 20, 2005
+if ($form_data{'affiliate'} ne "") 
+{
+$href .= "&amp;affiliate=$form_data{'affiliate'}";
+}
+# Added by Mister Ed June 20, 2005
+if ($form_data{'member'} ne "") 
+{
+$href .= "&amp;member=$form_data{'member'}";
+}
+# Added by Mister Ed June 20, 2005
+if ($form_data{'pricing'} ne "") 
+{
+$href .= "&amp;pricing=$form_data{'pricing'}";
 }
-
 foreach $db_query_row (@sc_db_query_criteria) 
 {
 $db_form_field = (split(/\|/, $db_query_row))[0];
 if ($form_data{$db_form_field} ne "" && $db_form_field ne "keywords") 
 {
-$href .= "&$db_form_field=" . &str_encode($form_data{$db_form_field});
+$href .= "&amp;$db_form_field=" . &str_encode($form_data{$db_form_field});
 }
-
 }
-
 &codehook("make_href_fields_bot");
 return ($href);
-
 }
-
 #######################################################################
 sub PrintNoHitsBodyHTML {
-print qq~
-<HTML>
-<HEAD>
-<TITLE>Search Found No Entries</TITLE>
-$sc_standard_head_info</HEAD>
-<BODY $sc_standard_body_info>
+print qq~$sc_docytpe
+<html>
+<head>
+  <title>Search Found No Entries</title>
+  $sc_standard_head_info
+  
+  $sc_special_page_meta_tags
 
+</head>
+<body>
 ~;
-
 &StoreHeader;
 
+# edited error message and moved to managers for customization. added by Mister Ed August 15, 2006
+if ($sc_search_error_message eq "") {
+    $sc_search_error_message = qq~I'm sorry, no matches were found. Please try your search again.~;
+}
 print qq!
-
-<CENTER>  
-<TABLE WIDTH=450>
-
-<TR>
-<TD>
-&nbsp;
-</TD>
-</TR>
-
-<TR>
-<TD>
-<FONT FACE=ARIAL>
-I'm sorry, no matches were found. Please try your search again.
-</TD>
-</TR>
-
-<TR>
-<TD>
-<P>&nbsp;</P>
-<P>&nbsp;</P>
-<P>&nbsp;</P>
-<P>&nbsp;</P>
-<P>&nbsp;</P>
-</TD>
-</TR>
-
-</TABLE>
-</CENTER>
+<div align="center">
+<p class="ac_search_no_results">
+$sc_search_error_message
+  </p>
+</div>
 !;
-
 &StoreFooter;
-
 print qq!
-
-</BODY>
-</HTML>
-
+</body>
+</html>
 !;
-
 }
 #######################################################################
 sub capture_STDOUT {
  $capture_STDOUT++;
- $CAPTURE_SAVE[$capture_STDOUT] = select(); 
+ $CAPTURE_SAVE[$capture_STDOUT] = select(); #current value of STDOUT;
 
  open(MYSTDOUT,">$sc_capture_path$capture_STDOUT");
  select(MYSTDOUT);
  $CAPTURE_CURRENT[$capture_STDOUT] = MYSTDOUT;
-} 
+}
 #######################################################################
-
 sub uncapture_STDOUT {
  local($contents)="";
-
  if ($capture_STDOUT < 1) { 
    return "";
   }
@@ -771,7 +753,6 @@
  unlink("$sc_capture_path$capture_STDOUT"); 
  $capture_STDOUT = $capture_STDOUT - 1;
  return "$contents";
-
 } 
 #######################################################################
 sub agorascript {
@@ -780,7 +761,6 @@
  local ($kount,$iterations)=0;
  local ($err_code,$return_val,$ztype)="";
  local ($on_agorascript_error)="warn exit ";
- 
  if ($type ne "") {
    $ztype = "-$type";
   } else {
@@ -789,14 +769,11 @@
  $script_start_short = "agorascript$ztype";
  $script_start = "<!--agorascript$ztype";
  $script_end = "-->";
-
 $str =~ s/<!--AGSC//ig;
 $str =~ s/AGSC-->//ig;
-
 $str =~ s/<!--  agorascript/<!-- agorascript/g;
 $str =~ s/<!-- agorascript/<!--agorascript/g;
-$str =~ s/<!--agorascript$ztype\n/<!--agorascript$ztype /g;# 
-
+$str =~ s/<!--agorascript$ztype\n/<!--agorascript$ztype /g;# -->
 $part1=$str;
 while (($iterations < 25) && ($str =~ /${script_start_short} /)) {
  $iterations++;
@@ -804,7 +781,7 @@
  ($part1,$part2) = split(/${script_start} /,$str,2);
  while ($part2 ne "") {
   ($the_script,$part2) = split(/$script_end/,$part2,2);
-  $the_script =~ /([^\xFF]*)/;# should I make this ^M???
+  $the_script =~ /([^\xFF]*)/;
   $the_script = $1;
   if ($sc_use_agorascript =~ /yes/i) {
    $return_val = eval($the_script);
@@ -832,63 +809,52 @@
       &call_exit;
      }
     if ($on_agorascript_error =~ /discard/i) { 
-      $return_val = ""; 
+      $return_val = "";
      }
    }
   $part1 .= $return_val;
   $kount++;
   ($part1a,$part2) = split(/$script_start/,$part2,2);
   $part1 .= $part1a;
- } # end of inner while
+ } 
  $str = $part1;
  $str =~ s/<!--  agorascript-/<!-- agorascript-/g;
  $str =~ s/<!-- agorascript-/<!--agorascript-/g;
-} # end of outter while
-
+}
  return $part1;
-
 }
-
 #######################################################################
 sub StoreHeaderFooter {
 local ($zfile,$ztitle) = @_;
 local ($the_file,$very_first_part,$junk);
 local ($item_ordered_message) = "";
 local ($myproduct);
-
 $myproduct = $form_data{'product'};
 if ($sc_convert_product_token_underlines ne "") {
   $myproduct =~ s/\_/$sc_convert_product_token_underlines/g;
  }
-
 open (MYFILE, "$zfile");
 read(MYFILE,$the_file,204800);
 close (MYFILE);
-
 ($very_first_part,$the_file,$junk) = 
-	split(/<h3>--cut here--<\/h3>/i,$the_file,3);
+  split(/<h3>--cut here--<\/h3>/i,$the_file,3);
 if ($the_file eq "") {
   $the_file = $very_first_part;
  }
-
 if ($cart_id eq "") { print "EMPTY CART VALUE! -- $ztitle<br>\n";}
 if ($cart_id_for_html eq "") { print "EMPTY HTML CART VALUE! -- $ztitle<br>\n";}
-
 $href_fields = &make_href_fields;
 $hidden_fields = &make_hidden_fields;
 $cart_id_for_html = "%%ZZZ%%";
-
 if (($form_data{'add_to_cart_button'} ne "" )&&
     ($sc_shall_i_let_client_know_item_added =~ /yes/i)) {
   $item_ordered_message = $sc_item_ordered_msg_token;
  }
-
 $the_file = &agorascript($the_file,"pre","$ztitle",__FILE,__LINE__);
-
 $the_file =~ s/%%item_ordered_msg%%/$item_ordered_message/g;
 $the_file =~ s/%%StepOneURL%%/$sc_stepone_order_script_url/ig;
 $the_file =~ s/%%ScriptURL%%/$sc_main_script_url/ig;
-$the_file =~ s/%%ScriptPostURL%%/$sc_main_script_url/ig;
+$the_file =~ s/%%ScriptPostURL%%/$sc_main_script_post_url/ig;
 $the_file =~ s/%%gateway_username%%/$sc_gateway_username/g;
 $the_file =~ s/cart_id=%%cart_id%%/cart_id=/g;
 $the_file =~ s/cart_id=/cart_id=$cart_id_for_html/g;
@@ -908,30 +874,49 @@
 $the_file =~ s/%%exact_case%%/$form_data{'exact_case'}/g;
 $the_file =~ s/%%URLofImages%%/$URL_of_images_directory/g;
 $the_file =~ s/%%agoracgi_ver%%/$versions{'agora.cgi'}/g;
-
+$the_file =~ s/%%affiliate%%/$form_data{'affiliate'}/g;
+$the_file =~ s/%%member%%/$form_data{'member'}/g;
+$the_file =~ s/%%TemplateName%%/$sc_headerTemplateName/ig;
+$the_file =~ s/%%sc_money_symbol%%/$sc_money_symbol/ig;
+$the_file =~ s/%%ButtonSetURL%%/$sc_buttonSetURL/ig;
 while ($the_file =~ /%%ZZZ%%/) {
   $cart_id_for_html = &cart_id_for_html;
   $the_file =~ s/%%ZZZ%%/$cart_id_for_html/;
 }
-
 $the_file = &agorascript($the_file,"post","$ztitle",__FILE,__LINE__);
-
 return $the_file;
-
 }
 #######################################################################
 sub StoreHeader {
  print &GetStoreHeader;
 }
 sub GetStoreHeader {
- return &StoreHeaderFooter("$sc_store_header_file","Store Header");
+my $temp_header_thingy = "$sc_store_header_file";
+# dynamic store header by category name, if exists
+# otherwise use default.  Added by Mister Ed Jan 11, 2005
+ if (($sc_use_category_name_as_header =~ /yes/i) && ($form_data{'order_form_button.x'} eq "") && ($form_data{'dc'} eq "")) { 
+   my $myproduct = "$form_data{'product'}";
+    if (-f "$sc_templates_dir/header-$myproduct.inc") {
+       $temp_header_thingy = "$sc_templates_dir/header-$myproduct.inc";
+      }
+ } 
+ return &StoreHeaderFooter("$temp_header_thingy","Store Header");
 }
 #######################################################################
 sub StoreFooter {
  print &GetStoreFooter;
 }
 sub GetStoreFooter {
- return &StoreHeaderFooter("$sc_store_footer_file","Store Footer");
+my $temp_footer_thingy = "$sc_store_footer_file";
+# dynamic store footer by category name, if exists
+# otherwise use default.  Added by Mister Ed Jan 11, 2005
+ if (($sc_use_category_name_as_header =~ /yes/i) && ($form_data{'order_form_button.x'} eq "") && ($form_data{'order_form_button'} ne 1) && ($form_data{'dc'} eq "")&& ($form_data{'dc'} ne 1)) { 
+   my $myproduct = "$form_data{'product'}";
+    if (-f "$sc_templates_dir/footer-$myproduct.inc") { 
+       $temp_footer_thingy = "$sc_templates_dir/footer-$myproduct.inc";
+      }
+ } 
+ return &StoreHeaderFooter("$temp_footer_thingy","Store Footer");
 }
 #######################################################################
 sub SecureStoreHeader {
@@ -954,11 +939,9 @@
 
  local(@cart_fields,$temp);
  local($kount)=100;
-
  open (CART, "$sc_cart_path") ||
  &file_open_error("$sc_cart_path", "load_cart_contents", 
   __FILE__, __LINE__);
-
  while (<CART>) {
    chop;    
    $temp = $_;
@@ -968,16 +951,12 @@
  close(CART);
  $sc_cart_copy_made = "yes";
 }
-
 #######################################################################
 sub save_cart_copy {
-
  local(@cart_fields,$cart_row_number,$temp,$inx);
-
  open (CART, ">$sc_cart_path") ||
  &file_open_error("$sc_cart_path", "save_cart_contents", 
   __FILE__, __LINE__);
-
  foreach $inx (sort (keys %cart_copy)) {
    $temp = $cart_copy{$inx};
    print CART $temp,"\n";
@@ -1052,9 +1031,9 @@
         $temp = $cart_option;
         $temp =~ s/\|/\~/g;
         $options_list .= $zkey . '*' . $temp;
-        if ((0 + $c_price) == 0) { #price zero, do not display it 
+        if ((0 + $c_price) == 0) { 
           $display_option_price = "";
-         } else { # price non-zero, must format it
+         } else { 
           $display_option_price = " " . &display_price($c_price);
          }
         if ($options ne "") { $options .= "$sc_opt_sep_marker"; }
@@ -1070,62 +1049,45 @@
    }
  }
 #######################################################################
+# fixed dynamic .inc files by category
+# by Mister Ed (K-Factor Technologies, Inc) 10/16/2003
 sub create_display_fields {
 local (@database_fields) = @_;
 local ($id_index,$display_index,$category);
 local ($continue)='yes';
 &codehook("create_display_fields_top");
 if ($continue ne 'yes') {return;}
-
 @display_fields = ();
 @temp_fields = @database_fields;
 foreach $display_index (@sc_db_index_for_display) 
-
 {
-
 if ($display_index == $sc_db_index_of_price)
-
 {  
 $temp_fields[$sc_db_index_of_price] =
 &display_price($temp_fields[$sc_db_index_of_price]);
 }
-
 push(@display_fields, $temp_fields[$display_index]);
 }
-
 @item_ids = ();
-
 foreach $id_index (@sc_db_index_for_defining_item_id) 
 {
 $database_fields[$id_index] =~ s/\"/~qq~/g;
 $database_fields[$id_index] =~ s/\>/~gt~/g;
 $database_fields[$id_index] =~ s/\</~lt~/g;
-
 push(@item_ids, $database_fields[$id_index]);
-	
 }
-
 $itemID = join("\|",@item_ids);
-
-$ppinc_root_name = '';
-if ($sc_ppinc_product_db_field ne '') { 
-  $ppinc_root_name = $database_fields[$db{$sc_ppinc_product_db_field}];
- }
-if ($ppinc_root_name eq '') { 
-  $category = $database_fields[$db{'product'}];
-  if ($sc_use_category_name_as_ppinc_root =~ /yes/i){
-    if (-f "$sc_templates_dir/${category}.inc") {$ppinc_root_name = $category;}
-   } else {
-    $ppinc_root_name = $category_ppinc{$category};
-   }
- }
-if ($ppinc_root_name eq '') { 
-  $ppinc_root_name = 'productPage';
- }
+$ppinc_root_name = 'productPage';
+ if ($sc_use_category_name_as_ppinc_root eq "yes"  && $form_data{'ppinc'} ne "search" && $form_data{'ppinc'} ne "search2") { 
+    if (-f "$sc_templates_dir/$database_fields[$db{'product'}].inc") {
+       $ppinc_root_name = $database_fields[$db{'product'}];
+      }
+ } 
 &codehook("create_display_fields_bot");
 }
 #######################################################################
 sub itemID { 
+ # like %%itemID-a%% in a productPage.inc file 
  local ($my_modifier) = @_;
  local (@stuff) = @item_ids;
  if ($my_modifier ne '') {
@@ -1134,7 +1096,8 @@
  return "item-" . join("\|",@stuff);
 }
 #######################################################################
-sub prodID { 
+sub prodID {
+ # token like %%prodID-a%% in a productPage.inc file 
  local ($my_modifier) = @_;
  local (@stuff) = @item_ids;
  if ($my_modifier ne '') {
@@ -1144,6 +1107,7 @@
 }
 #######################################################################
 sub QtyBox { 
+ # like %%QtyBox-a,1%% in a productPage.inc file 
  local ($my_modifier,$qty) = @_;
  local ($my_box) = $qty_box_html;
  local ($my_pid) = &prodID($my_modifier);
@@ -1171,7 +1135,6 @@
 local ($xarg,$xarg1,$xarg2);
 local ($myans)="";
 local ($auto_opt_no)=0;
-
 if ($sc_default_qty_to_display ne '') {
   $qty = $sc_default_qty_to_display;
  }
@@ -1181,29 +1144,22 @@
  }
 $keywords = $form_data{'keywords'}; 
 $keywords =~ s/ /+/g;
-
 $href_fields = &make_href_fields;
 $hidden_fields = &make_hidden_fields;
 $cart_id_for_html = "%%ZZZ%%";
-
 $the_whole_page =~ s/%%optionFile%%/$display_fields[3]/ig;
-
 while ($the_whole_page =~ /(%%Load_Option_File )([^%]+)(%%)/i) {
   local($option_location);
   local($field) = "";
   $option_location = $2;
   $option_location =~ s/ //g;
-
   $field = &load_opt_file($option_location);
   $field = &option_prep($field,$option_location,$item_ids[0]);
   $the_whole_page =~ s/(%%Load_Option_File )([^%]+)(%%)/$field/i;
  }
-
 $the_whole_page = &agorascript($the_whole_page,"pre",
                   "$my_ppinc",__FILE__,__LINE__);
-
 &codehook("before_ppinc_token_substitution");
-
 $imageURL = $display_fields[0];
 $imageURL =~ s/%%URLofImages%%/$URL_of_images_directory/g;
 if ($qty_box_html eq '') {
@@ -1212,10 +1168,10 @@
 $the_whole_page =~ s/%%Qty_Box%%/%%QtyBox/ig;
 if ($suppress_qty_box) {
   $the_whole_page =~ s/%%QtyBox%%/&nbsp;/ig;
+  $the_whole_page =~ s/%%zeroQtyBox%%/&nbsp;/ig;
  } else {
   $the_whole_page =~ s/%%QtyBox%%/$qty_box_html/ig;
  }
-
 while ($the_whole_page =~ /(%%QtyBox-)([^%]+)(%%)/i) {
   $arg = $2;
   ($arg1,$arg2,$junk) = split(/,/,$arg . ",$qty,",3);
@@ -1226,7 +1182,10 @@
   $myans = &QtyBox($arg1,$arg2);
   $the_whole_page =~ s/(%%QtyBox-)([^%]+)(%%)/$myans/i;
 }
-
+while ($the_whole_page =~ /%%zeroQtyBox/i) {
+  $qty = "";
+  $the_whole_page =~ s/%%zeroQtyBox%%/$qty_box_html/ig;
+}
 while ($the_whole_page =~ /(%%itemID-)([^%]+)(%%)/i) {
   $arg = $2;
   ($arg1,$arg2) = split(/,/,$arg,2);
@@ -1235,7 +1194,6 @@
   $myans = &itemID($arg1);
   $the_whole_page =~ s/(%%itemID-)([^%]+)(%%)/$myans/i;
 }
-
 while ($the_whole_page =~ /(%%prodID-)([^%]+)(%%)/i) {
   $arg = $2;
   ($arg1,$arg2) = split(/,/,$arg,2);
@@ -1244,12 +1202,11 @@
   $myans = &prodID($arg1);
   $the_whole_page =~ s/(%%prodID-)([^%]+)(%%)/$myans/i;
 }
-
 $the_whole_page =~ s/%%Qty%%/$qty/ig;
 $the_whole_page =~ s/%%URLofImages%%/$URL_of_images_directory/ig;
 $the_whole_page =~ s/%%scriptURL%%/$sc_main_script_url/ig;
+$the_whole_page =~ s/%%ScriptPostURL%%/$sc_main_script_post_url/ig;
 $the_whole_page =~ s/%%StepOneURL%%/$sc_stepone_order_script_url/ig;
-$the_whole_page =~ s/%%ScriptPostURL%%/$sc_main_script_url/ig;
 $the_whole_page =~ s/%%gateway_username%%/$sc_gateway_username/ig;
 $the_whole_page =~ s/%%CartID%%/%%cart_id%%/ig;
 $the_whole_page =~ s/%%cartID%%/%%cart_id%%/ig;
@@ -1293,47 +1250,39 @@
 $the_whole_page =~ s/%%ProductID%%/%%prodID%%/ig;
 $the_whole_page =~ s/%%prodID%%/$item_ids[0]/ig;
 $the_whole_page =~ s/%%CategoryID%%/$item_ids[1]/ig;
-
+$the_whole_page =~ s/%%TemplateName%%/$sc_headerTemplateName/ig;
+$the_whole_page =~ s/%%sc_money_symbol%%/$sc_money_symbol/ig;
+$the_whole_page =~ s/%%ButtonSetURL%%/$sc_buttonSetURL/ig;
 while ($the_whole_page =~ /%%ZZZ%%/) {
   $cart_id_for_html = &cart_id_for_html;
   $the_whole_page =~ s/%%ZZZ%%/$cart_id_for_html/;
 }
-
 while ($the_whole_page =~ /%%AutoOptionNo%%/i) {
   $auto_opt_no = $auto_opt_no + 1;
   if ($auto_opt_no < 100) {$auto_opt_no = "0$auto_opt_no";} 
   if ($auto_opt_no < 10) {$auto_opt_no = "0$auto_opt_no";} 
   $the_whole_page =~ s/%%AutoOptionNo%%/$auto_opt_no/i;
 }
-
 $the_whole_page = &agorascript($the_whole_page,"autoopt",
                   "$my_ppinc",__FILE__,__LINE__);
-
 while ($the_whole_page =~ /(%%eval)([^%]+)(%%)/i) {
   $arg = $2;
   $myans = eval($arg);
   if ($@ ne ""){ $myans = "%% Eval Error on: $arg %%";}
   $the_whole_page =~ s/(%%eval)([^%]+)(%%)/$myans/i;
 }
-
 &codehook("after_ppinc_token_substitution");
-
 $the_whole_page = &agorascript($the_whole_page,"post",
                   "$my_ppinc",__FILE__,__LINE__);
-
 return $the_whole_page;
-
 }
 #######################################################################
 sub get_sc_ppinc_info {
  local ($my_ppinc,$the_whole_page,$keywords,$orig_ppinc);
  local ($used_default) = 0;
-
  if ($sc_ppinc_info ne "") { 
-  # no need to load it, already have it
    return $sc_ppinc_info;    
   }
-
  $my_ppinc = "$sc_templates_dir/$ppinc_root_name";
  if ($form_data{'ppinc'} ne "") {
    $form_data{'ppinc'} =~ /([\w-_]+)/;
@@ -1347,145 +1296,40 @@
   } else {
    $my_ppinc .= ".inc";
   }
-
  if (!(-f "$my_ppinc")) {
    $orig_ppinc = $my_ppinc;
    $my_ppinc = "$sc_templates_dir/productPage.inc";
    $used_default = 1;
   }
-
  open (PAGE, "$my_ppinc") ||
    &file_open_error("$sc_cart_path", "get ppinc -- $my_ppinc", 
      __FILE__, __LINE__);
-
  read(PAGE,$the_whole_page,102400); 
  close PAGE;
-
  ($very_first_part,$the_whole_page,$junk) = 
-	split(/<h3>--cut here--<\/h3>/i,$the_whole_page,3);
+  split(/<h3>--cut here--<\/h3>/i,$the_whole_page,3);
  if ($the_whole_page eq "") {
    $the_whole_page = $very_first_part;
   }
-
  if (($sc_debug_mode =~ /yes/i) && ($used_default == 1)) {
    $the_whole_page = "<!-- Used Default, $orig_ppinc not found. -->\n" . 
     $the_whole_page;
   }
-
  $sc_ppinc_info = $the_whole_page; 
  $last_ppinc_name = $my_ppinc;
  return $sc_ppinc_info;
-
-}
-##############################################################################
-sub std_two_across {
-local ($myans)="";
-if ($rowCount == (1+$minCount)) { #first one
-  $ags_row_item=0;
-  $ags_tot_item=0;
-  $myans .= '<tr><td colspan=3><table width="100%" border=1>'."\n";
- }
-$ags_row_item++;
-$ags_tot_item++;
-if (($rowCount == ($maxCount)) || ($rowCount == ($num_returned)))
- { # very last one, need to join these two cells, no border
-  if ($ags_row_item == 1) { # first and only one
-    $myans .= '<td width="100%" colspan=2><table width=100% border=0>'."\n";
-    $myans .= '<tr>'."\n";
-   }
- }
-if ($ags_row_item == 2) { 
-  $ags_row_item=0; 
-  $myans .= '<td width="50%"><table width=100% border=0>'."\n";
- } else { 
-  $myans .= '<tr><td width="50%"><table width=100% border=0>'."\n";
- }
-
-$myans .= qq~
-<TR WIDTH="100%"> 
-<TD ALIGN="CENTER" WIDTH="160" VALIGN="MIDDLE">
-<FONT FACE="ARIAL" SIZE="2">
-<FORM METHOD = "post" ACTION = "%%scriptURL%%">
-%%make_hidden_fields%%
-<BR>
-%%optionFile%%
-<BR>
-<P>
-<!--BEGIN SELECT QUANTITY BUTTON-->
-<TABLE>
-<TR ALIGN="CENTER">
- <TD VALIGN="MIDDLE">%%QtyBox%%</TD>
- <TD VALIGN="MIDDLE"><INPUT TYPE="IMAGE"
- NAME="add_to_cart_button" VALUE="Add To Cart"
- SRC="%%URLofImages%%/add_to_cart.gif" BORDER="0">
- </TD>
-</TR>
-</TABLE>
-<!--END SELECT QUANTITY BUTTON-->
-</TD>
-<TD ALIGN="CENTER" WIDTH="150">%%image%%</TD>
-</tr>
-~;
-
-if (($rowCount == ($maxCount)) || ($rowCount == ($num_returned)))
- { # very last one
-  if ($ags_row_item == 1) { # first and only one
-    $myans .= '</table></td>'."\n";
-    $myans .= '<td width="50%"><table width=100%>'."\n";
-   }
- }
-
-$myans .= qq~
-<tr><TD colspan=2>
-<FONT FACE="ARIAL" SIZE="2">
-<b>%%name%%</b>
-<br>
-%%description%%
-</FONT>
-</TD>
-</FORM>
-</TR>
-<TR> 
-<td>
-<FONT FACE="ARIAL" SIZE="2" color="#FF0000">%%price%%</font>
-</td>
-<td align="right">
-<A HREF="${sc_main_script_url}?dc=1&%%href_fields%%"><FONT 
-FACE=ARIAL>Check Out</FONT>
-</A>
-</TD>
-</TR>
-~;
-
-if ($ags_row_item == 1) { # first one
-  $myans .= '</table></td>'."\n";
- } else { # second one
-  $myans .= '</table></td></tr>'."\n";
- }
-if (($rowCount == ($maxCount)) || ($rowCount == ($num_returned)))
- { # very last one, need to join these two cells, no border
-  if ($ags_row_item == 1) { # first and only one
-    $myans .= '</tr></table></td>'."\n";
-   }
- }
-if (($rowCount == ($maxCount)) || ($rowCount == ($num_returned)))
- {
-  $myans .= '</table></td></tr>'."\n";
- }
-return $myans;
 }
 #############################################################################
 sub vf_get_data {
   local ($VF_file,$fname,$ID,@RECORD) = @_;
   my $field,$xans,@REC;
-  @REC = @RECORD; 
+  @REC = @RECORD; # alias
   return &vf_eval($fname);
  }
 
 sub vf_eval {
   local ($fname) = @_;
   my $xcmd,$hname;
- # need to get the field itself from the field name
   $xcmd = '$field = $' . $VF_DEF{$VF_file} . '{"' . $fname . '"}';
   eval($xcmd);
   return &vf_do_eval_work($field);
@@ -1503,7 +1347,7 @@
       $err_code = $@;
       if ($err_code ne "") {
         &update_error_log("V-field ${field}($VF_file) error: $err_code",
-		__FILE__,__LINE__);
+    __FILE__,__LINE__);
        }
      } else { 
       $ans = $RECORD[$field];
@@ -1513,4 +1357,3 @@
  }
 ############################################################################
 1; # library
-
diff -ruN 4.0K-4b/library/agora_order_lib.pl 5.0.000/library/agora_order_lib.pl
--- 4.0K-4b/library/agora_order_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/agora_order_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,13 +1,33 @@
 ############################################################
 
-$versions{'agora_order_lib.pl'} = "20021020";
+$versions{'agora_order_lib.pl'} = "5.0.000";
+# last modified by Mister Ed from K-Factor Technologies, Inc /  AgoraCart.com
+# August 17, 2006
+#
+# Copyright 2001 - Present by K-Factor Technologies, Inc and AgoraCart.com
+# All rights reserved.
 
 &require_supporting_libraries (__FILE__, __LINE__,
-   		"$sc_mail_lib_path",
-   		"$sc_ship_lib_path");
+      "$sc_mail_lib_path",
+      "$sc_ship_lib_path");
 
 &codehook("order_library_init");
-############################################################
+
+#
+# This library contains code for displaying/modifying the cart
+# as well as processing the order.  This lib is only loaded 
+# upon demand. 
+#
+
+#######################################################################
+sub options_error_message {
+# Added by Mister Ed at BytePipe.com / AgoraCart.com 2-18-2004.
+&standard_page_header("Options Error");
+&StoreHeader;
+print "$sc_templates_dir/cart_options_security_add_error.inc";
+&StoreFooter;
+}
+#######################################################################
 sub add_to_the_cart {
 local (@database_rows, @database_fields, @item_ids, @display_fields);
 local ($qty,$line,$line_no,$cart_row_qty,$cart_row_middle);
@@ -15,82 +35,61 @@
 local (%item_opt_verify,@lines,@testme);
 local ($need_bad_order_note,$wildcard_id_number) = '';
 local ($order_count)=0;
-&checkReferrer;
+my ($failed) = '';
+&checkReferrer;  
 
 if (!($sc_db_lib_was_loaded =~ /yes/i)) {
   &require_supporting_libraries (__FILE__, __LINE__, "$sc_db_lib_path"); 
  }
-
 open (CART, "+>>$sc_cart_path") || &file_open_error("$sc_cart_path", "Add to Shopping Cart", __FILE__, __LINE__);
-
 $highest_item_number = 100; 
-
 seek (CART, 0, 0); 
-
 while (<CART>) 
-
 {
-
 chomp $_;
-
 my @row = split (/\|/, $_); 
-
 my $item_number_info = pop (@row);
 ($item_number,$item_modifier) = split(/\*/,$item_number_info,2);
-
 $highest_item_number = $item_number if ($item_number > $highest_item_number);
-
 }
-
 close (CART);
-
 &update_special_variable_options('reset');
-
 @items_ordered = sort(keys (%form_data));
-
 foreach $item (@items_ordered)
 {
-
-
 if (($item =~ /^item-/i || $item =~ /^option/i) && $form_data{$item} ne "")
 {
-
-
 $item =~ s/^item-//i;
-
 if ($item =~ /^option/i)
 {
 push (@options, $item);
 }
-
-
 else
 {
-
-#	if (($form_data{"item-$item"} =~ /\D/) || ($form_data{"item-$item"} == 0))
-	$form_data{"item-$item"} =~ s/ //g; # get rid of any blanks
-	if (($form_data{"item-$item"} =~ /\D/) || ($form_data{"item-$item"} < 0))
-	{
-	if (!($sc_ignore_bad_qty_on_add)) {$need_bad_order_note = 1;}
-	}
-
-	else
-	{
-	$quantity = $form_data{"item-$item"};
-	if ($quantity > 0) {
-	  push (@items_ordered_with_options, "$quantity\|$item\|");
-	  $order_count++;
-	 }
-	}
+  $form_data{"item-$item"} =~ s/ //g; 
+  if ((($form_data{"item-$item"} =~ /\D/) && ($form_data{"item-$item"} =~ /.?/g)) || ($form_data{"item-$item"} < 0))
+  {
+  if (!($sc_ignore_bad_qty_on_add)) {$need_bad_order_note = 1;}
+  }
+  else
+  {
+  $quantity = $form_data{"item-$item"};
+  if ($quantity > 0) {
+    if ($failed) {
+      $need_bad_order_note = 1;
+    } else {
+        push (@items_ordered_with_options, "$quantity\|$item\|");
+        $order_count++;
+      }
+   }
+  }
 
 }
-
 }
-
 }
 
 if (($order_count == 0) or ($need_bad_order_note)) { 
-  $sc_shall_i_let_client_know_item_added = 'no'; 
+  $sc_shall_i_let_client_know_item_added = 'no';
   $temp = &get_agora('TRANSACTIONS');
   @temp = split(/\n/,$temp);
   $junk=pop(@temp);
@@ -105,21 +104,17 @@
    }
   return;
  }
-
 foreach $item_ordered_with_options (@items_ordered_with_options)
-
 {
 &codehook("foreach_item_ordered_top");
-
 $options = "";
 $option_subtotal = "";
 $option_grand_total = "";
 $item_grand_total = "";
-
 $item_ordered_with_options =~ s/~qq~/\"/g;
 $item_ordered_with_options =~ s/~gt~/\>/g;
 $item_ordered_with_options =~ s/~lt~/\</g;
-
+# >
 @cart_row = split (/\|/, $item_ordered_with_options);
 &codehook("foreach_item_ordered_split_cart_row");
 $web_id_number = $cart_row[$sc_cart_index_of_item_id];
@@ -138,10 +133,25 @@
 $item_option_numbers = "";
 $item_user1 = "";
 $item_user2 = "";
+
+# alt origin postal code assigns to cart user3 by Mister Ed Feb 9, 2005
+if ($sc_alt_origin_enabled =~ /yes/i) {
+my $data_field_thingy = "$sc_alt_origin_db_counter";
+$item_user3 = &check_db_with_product_id_for_info($item_id_number,$data_field_thingy,*database_fields);
+} else {
 $item_user3 = "";
+}
+# taxable or non-table. added by Mister Ed Sept 13, 2005
+if ($sc_non_taxables_enabled =~ /yes/i) {
+my $data_field_thingy = "$sc_non_taxables_db_counter";
+$item_user4 = &check_db_with_product_id_for_info($item_id_number,$data_field_thingy,*database_fields);
+} else {
+$item_user4 = "";
+}
+$item_user5 = "";
+$item_user6 = "";
 $item_agorascript = "";
 undef(%item_opt_verify);
-
 $found = &check_db_with_product_id($item_id_number,*database_fields);
 &create_display_fields(@database_fields);
 &codehook("cart_add_read_db_item");
@@ -149,117 +159,114 @@
   $field = $zzzitem;
   if ($field =~ /^%%OPTION%%/i) {
     ($empty, $option_tag, $option_location) = split (/%%/, $field);
-
     $field = &load_opt_file($option_location);
-
     $junk = &option_prep($field,$option_location,$item_id_number);
     $junk = &prep_displayProductPage($junk);
-
     $item_agorascript .= $field;
-
    }
  }
 &codehook("cart_add_read_item_agorascript");
-
 foreach $option (@options)
 {
 ($option_marker, $option_number, $option_item_number) = split (/\|/, $option);
-
 if (($option_item_number eq "$web_id_number") || 
     ($option_item_number eq "$wildcard_id_number"))
 {
-
 $field = &agorascript($item_agorascript,"add-to-cart-opt-" . $option_number,
-		"$option_location",__FILE__,__LINE__);
-
+    "$option_location",__FILE__,__LINE__);
 ($option_name,$option_price,$option_shipping)=split(/\|/,$form_data{$option});
+   if ((0 + $option_price) == 0) { #price zero, do not display it 
+     $display_option_price = "";
+    } elsif (($sc_negative_priced_options ne "yes") && ((0 + $option_price) < "0")) {
+# Added by Mister Ed at BytePipe.com / AgoraCart.com 2-18-2004.
+# if negative priced options disallowed, prevent addition to cart
+if ($item_user1 eq "") {
+$killitemthingy = "yes";
+&options_error_message;
+exit; }
+} else { 
+     # Added by Mister Ed August 9, 2006
+     # toggles display of options pricing.  now can be turned off
+     $display_option_price = " " . &display_price($option_price);
+     if ($sc_turn_off_option_price_display =~ /off/i) {
+          $display_option_price = "";
+     }
+  }
 if($option_name) {
+# Updated by Mister Ed at BytePipe.com / AgoraCart.com Feb-18-2004.  Now works and not just dead code
   if ($sc_use_verified_opt_values =~ /yes/i) { 
-    $temp = $item_opt_verify{$option . '|' . $option_name};
-    ($option_price,$option_shipping) = split(/\|/,$temp,2);
-    if ($temp ne "") {
-      $temp = $option_name . '|' . $temp;
+if ($field =~ /$option_name\|$option_price/ || $field =~ /$option_name\|$option_price\|$option_shipping/)  {
+    $temp = $form_data{$option};
+     } elsif ($item_user1 ne "") {
+    $temp = $form_data{$option};
      } else {
-      $option_name=""; # erase it, unverifiable
-     }
+$option_name=""; 
+$killitemthingy = "yes";
+$sc_unique_cart_modifier_orig = '';
+$sc_unique_cart_modifier = '';
+$option_price = '';
+&options_error_message;
+exit; 
+    }
    } else {
     $temp = $form_data{$option};
    }
   if($option_name) {
-   $temp =~ s/\|/~/g; # cannot have pipes, change to ~ char
+   $temp =~ s/\|/~/g; 
    if ($item_option_numbers eq ""){
      $item_option_numbers = "${option_number}*$temp";
     } else {
      $item_option_numbers .= $sc_opt_sep_marker . "${option_number}*$temp";
     }
-
-   if ((0 + $option_price) == 0) { 
-     $display_option_price = "";
-    } else { # price non-zero, must format it
-     $display_option_price = " " . &display_price($option_price);
-    }
    if ($options ne "") { 
      $options .= "$sc_opt_sep_marker";
     }
    $options .= "$option_name$display_option_price";
    }
 }
-
-
 &codehook("process_cart_options");
+if ($killitemthingy ne "yes") {
 $item_shipping = $item_shipping + $option_shipping;
 $unformatted_option_grand_total = $option_grand_total + $option_price;
 $option_grand_total = &format_price($unformatted_option_grand_total);
-
+} 
 }
-
 }
-
+if ($killitemthingy ne "yes") {
 $item_number = ++$highest_item_number;
-
 $unformatted_item_grand_total = $item_price + $option_grand_total;
 $item_grand_total = &format_price("$unformatted_item_grand_total");
-
 $cart_row[$cart{"shipping"}] = $item_shipping;
 $cart_row[$cart{"shipping_calc_flag"}] = "";
-
 $cart_row[$cart{"options_ids"}] = $item_option_numbers;
-
 $field = &agorascript($item_agorascript,"add-to-cart",
-		"$option_location",__FILE__,__LINE__);
-
+    "$option_location",__FILE__,__LINE__);
 &codehook("before_build_cart_row");
 $cart_row[$cart{"user1"}] = $item_user1;
 $cart_row[$cart{"user2"}] = $item_user2;
 $cart_row[$cart{"user3"}] = $item_user3;
+$cart_row[$cart{"user4"}] = $item_user4;
+$cart_row[$cart{"user5"}] = $item_user5;
+$cart_row[$cart{"user6"}] = $item_user6;
 foreach $field (@cart_row) {
   $cart_row .= "$field\|";
  }
-
 $cart_row .= "$options\|$item_grand_total";
 ($cart_row_qty,$cart_row_middle) = split(/\|/,$cart_row,2);
 $cart_row .= "\|$item_number\n";
-
-
 &codehook("foreach_item_ordered_end");
 &add_one_row_to_cart($cart_row,$cart_row_qty,$cart_row_middle);
 $cart_row = '';
-
 }
-
 &update_special_variable_options('calculate');
-
+} 
 &finish_add_to_the_cart;
-
 } 
 ############################################################
 sub add_one_row_to_cart {
-
  local ($cart_row,$cart_row_qty,$cart_row_middle) = @_;
  local(@lines,@newlines,@testme,$qty,$orig_line,$line);
-
 &codehook("before_add_cart_rows");
-
 if (-e "$sc_cart_path")
 {
 open (CART, "$sc_cart_path") || &file_open_error("$sc_cart_path", "Add to Shopping Cart", __FILE__, __LINE__);
@@ -295,7 +302,6 @@
 close (CART);
 }
 &codehook("after_add_cart_rows");
-
 }
 ############################################################
 sub middle_of_cart {
@@ -310,7 +316,7 @@
 ############################################################################
 sub display_order_form {
   local($line,$the_file,@lines,$temp);
-  local($subtotal);
+  local($subtotal,$taxable_grand_total);
   local($total_quantity);
   local($total_measured_quantity);
   local($text_of_cart);
@@ -320,122 +326,104 @@
   local($form_name)=$sc_html_order_form_path;
   local($have_terminated_form_tag) = "no";
   local($continue) = 1;
-
   &codehook("order_form_entry");
   if ($continue == 0) { return;}
-
 if ($sc_allow_ofn_choice =~ /yes/i) {
   if ($form_data{'order_form'} ne "") {
     $temp = "$sc_html_dir/forms/$form_data{'order_form'}-orderform.html";
     if (-f $temp) {
-      $temp =~ /([^\xFF]*)/; 
-      $form_name = $1;
-     }
-   }  else { # added by mister ed after K-3
-    $temp = "$sc_html_dir/forms/combo-orderform.html";
-    if (-f $temp) {
-      $temp =~ /([^\xFF]*)/; 
-      $form_name = $1;
+         $temp =~ /([^\xFF]*)/;
+         $form_name = $1;
      }
+  } else { # added by Mister Ed of BytePipe.com / AgoraCart.com Aug 2003 for multiple gateways without zOffline
+     $temp = "$sc_html_dir/forms/combo-orderform.html";
+      if (-f $temp) {
+          $temp =~ /([^\xFF]*)/; 
+          $form_name = $1;
+      }
+  }
 }
- }
-
 &codehook("order_form_pre_read");
 open (ORDERFORM, "$form_name") || &file_open_error("$form_name", 
-		"Display Order Form File Error",__FILE__,__LINE__);
-
+    "Display Order Form File Error",__FILE__,__LINE__);
 {
 local $/=undef;
 $the_file=<ORDERFORM>;
 }
 
 $the_file = &agorascript($the_file,"orderform","Order Form Prep 1",
-			 __FILE__, __LINE__);
-
+       __FILE__, __LINE__);
 &codehook("order_form_prep");
+# first, need to process the $ vars ...
 $the_file =~ s/\\/\\\\/g;
 $the_file =~ s/\@/\\\@/g;
 $the_file =~ s/\"/\\\"/g;
 $the_file =~ /([^\xFF]*)/;# untaint
 eval('$the_file = "' . $1 . '";');
-
 $the_file = &script_and_substitute($the_file,"Order Form Prep 2");
 @lines = split(/\n/,$the_file);
-
 $done=0;
 foreach $myline (@lines) {
-
 $line = $myline . "\n";
-
+if ($line =~ /<html>/i) { 
+  $line="$sc_doctype\n<html>\n"; 
+ }
+if ($line =~ /<\/head>/i) { 
+  $line="  $sc_standard_head_info\n</head>\n"; 
+ }
 if ($line =~ /<body/i) { 
-  $line="<BODY $sc_standard_body_info>\n"; 
+  $line="<body>\n"; 
  }
-
-
-if ($line =~ /<FORM/i) {
-
-#<INPUT TYPE = "hidden" NAME = "cart_id" VALUE = "$cart_id">
-
+# >
+if ($line =~ /<form/i) {
 $hidden_fields = &make_hidden_fields;
-
 if (($have_form_tag eq "yes") && ($have_terminated_form_tag eq "no")) {
-
-  print "</FORM>\n\n";
+  print "</form>\n\n";
+  
   $have_terminated_form_tag = "yes";
- } else { 
+ } else { # have the first tag
   $have_form_tag = "yes";
  }
-
 if ($sc_replace_orderform_form_tags =~ /yes/i) {
-  print qq!\n<FORM METHOD = "POST" ACTION = "$sc_order_script_url">!;
+  print qq!\n<form method="post" action="$sc_order_script_url">!;
   print $hidden_fields;
  } else {
   print "\n$line\n$hidden_fields\n";
  }
-
 $line = "";
-
-
 } 
-
 if ($line =~ /<h2>cart.*contents.*h2>/i) {
-
 if (($have_form_tag eq "yes") && ($have_terminated_form_tag eq "no")) {
-  print "</FORM>\n\n";
+  print "</form>\n\n";
   $have_terminated_form_tag = "yes";
  } 
 $have_form_tag = "yes";
-
-($subtotal, 
+($taxable_grand_total,$subtotal, 
  $total_quantity,
  $total_measured_quantity,
  $text_of_cart,
  $stevo_shipping_thing) = &display_cart_table("orderform");      
-
 $line = "";
 }
-
-if ($line =~ /\<\/body\>/i) {
+if ($line =~ /\<\/body\>/i) {# >
+  $done=1;
+ } elsif ($line =~ /\<\/html>/i) {
   $done=1;
  } else {
   &codehook("print_order_form_line");
   print $line;
  }
-
 } 
-
 if  (($sc_gateway_name eq "Offline") ||
      ($sc_use_secure_footer_for_order_form =~ /yes/i)){
   &SecureStoreFooter;
  } else {
   &StoreFooter;
  }
-
 print qq~
-</BODY>
-</HTML>
+</body>
+</html>
 ~;
-  
 } 
 ############################################################
 sub vform_check {
@@ -446,98 +434,86 @@
 ############################################################
 sub print_order_totals {
 local($continue) = 1;
-
 &codehook("print_order_totals_top");
 if ($continue == 0) { return;}
-
-print qq~
-<br>
-<TABLE $order_table_def>
-<TR>
-<TD $order_heading_def>$cart_font_style
-<B>$sc_totals_table_thdr_label</B></FONT></TD>
-</TR>
-<TR>
-<TD $order_item_def>$cart_font_style${sc_totals_table_itot_label}:</FONT></TD>
-<TD $order_item_def>$cartnum_font_style $price</FONT></TD>
-</TR>
+print qq~<div align="center">
+<table class="ac_totals_table">
+<tr>
+<th colspan="2">$sc_totals_table_thdr_label</th>
+</tr>
+<tr>
+<td>${sc_totals_table_itot_label}:</td>
+<td>$price</td>
+</tr>
 ~;
-
-if ($zfinal_shipping > 0)
+if (($zfinal_shipping > 0) && ($sc_show_shipping_label_box =~ /yes/i))
 {
-print "<TR>\n";
-print "<TD $order_item_def>$cart_font_style ",
-      $sc_ship_method_shortname,
-      $sc_totals_table_ship_label,
-      ":</FONT></TD>\n";
 $val =  &format_price($zfinal_shipping);
-print "<TD $order_item_def>$cart_font_style $val</FONT></TD>\n";
-print "</TR>\n";
+print qq~<tr>
+<td>$sc_totals_table_ship_label</td>
+<td>$val</td>
+</tr>
+~;
 }
 if ($zfinal_discount > 0)
 {
-print "<TR>\n";
-print "<TD $order_item_def>$cart_font_style ",
-      $sc_totals_table_disc_label,
-      ":</FONT></TD>\n";
 $val =  &format_price($zfinal_discount);
-print "<TD $order_item_def>$cart_font_style $val</FONT></TD>\n";
-print "</TR>\n";
+print qq~<tr>
+<td>$sc_totals_table_disc_label</td>
+<td>$val</td>
+</tr>
+~;
 }
 if ($zfinal_sales_tax > 0)
 {
-print "<TR>\n";
-print "<TD $order_item_def>$cart_font_style ",
-      $sc_totals_table_stax_label,
-      ":</FONT></TD>\n";
 $val =  &format_price($zfinal_sales_tax);
-print "<TD $order_item_def>$cart_font_style $val</FONT></TD>\n";
-print "</TR>\n";
+print qq~<tr>
+<td>$sc_totals_table_stax_label</td>
+<td>$val</td>
+</tr>
+~;
 }
 if ($zfinal_extra_tax1 > 0)
 {
-print "<TR>\n";
-print "<TD $order_item_def>$cart_font_style $sc_extra_tax1_name",
-      ":</FONT></TD>\n";
 $val =  &format_price($zfinal_extra_tax1);
-print "<TD $order_item_def>$cart_font_style $val</FONT></TD>\n";
-print "</TR>\n";
+print qq~<tr>
+<td>$sc_extra_tax1_name</td>
+<td>$val</td>
+</tr>
+~;
 }
 if ($zfinal_extra_tax2 > 0)
 {
-print "<TR>\n";
-print "<TD $order_item_def>$cart_font_style $sc_extra_tax2_name",
-      ":</FONT></TD>\n";
 $val =  &format_price($zfinal_extra_tax2);
-print "<TD $order_item_def>$cart_font_style $val</FONT></TD>\n";
-print "</TR>\n";
+print qq~<tr>
+<td>$sc_extra_tax2_name</td>
+<td>$val</td>
+</tr>
+~;
 }
 if ($zfinal_extra_tax3 > 0)
 {
-print "<TR>\n";
-print "<TD $order_item_def>$cart_font_style $sc_extra_tax3_name",
-      ":</FONT></TD>\n";
 $val =  &format_price($zfinal_extra_tax3);
-print "<TD $order_item_def>$cart_font_style $val</FONT></TD>\n";
-print "</TR>\n";
-}
-print "<TR>\n";
-#print "<TD $order_item_def>$cart_font_style &nbsp; </FONT></TD>\n";
-#print "<TD $order_item_def>${cartnum_font_style}--------</FONT></TD>\n";
-print "<TD $order_item_def colspan=2><IMG SRC=\"",
-      "picserve.cgi?secpicserve=line.gif\"",
-      " border=0 height=2 width=46></FONT></TD>\n";
-print "</TR>\n";
-print "<TR>\n";
-print "<TD $order_item_def>${cart_font_style}",
-      $sc_totals_table_gtot_label,
-      ":</FONT></TD>\n";
-print "<TD $order_item_def>$cartnum_font_style
-$grand_total</FONT></TD>\n";
-print "</TR>\n";
-print "</TABLE>\n";
+print qq~<tr>
+<td>$sc_extra_tax3_name</td>
+<td>$val</td>
+</tr>
+~;
 }
 
+print qq~<tr>
+<td colspan=2>
+  <img src=\"picserve.cgi?secpicserve=line.gif\" height="2" width="46" alt="------" />
+</td>
+</tr>
+<tr>
+<td>$sc_totals_table_gtot_label</td>
+<td>$grand_total</td>
+</tr>
+</table>
+</div>
+~;
+}
 ############################################################
 sub process_order_form {
 local($subtotal, $total_quantity,
@@ -546,86 +522,98 @@
       $required_fields_filled_in);
 local($hidden_fields) = &make_hidden_fields;
 local($continue) = 1;
-
+local($taxable_grand_total);
 &codehook("process_order_form_top");
 if ($continue == 0) { return;}
-
-print qq~
-<HTML>
-<HEAD>
-<TITLE>Step Two</TITLE>
-$sc_standard_head_info</HEAD>
-<BODY $sc_standard_body_info>
+print qq~$sc_doctype
+<html>
+<head>
+  <title>Step Two</title>
+  $sc_standard_head_info
+</head>
+<body>
 ~;
-
-($subtotal, 
+($taxable_grand_total, $subtotal, 
  $total_quantity,
  $total_measured_quantity,
  $text_of_cart,
  $stevo_shipping_thing) = 
  &display_cart_table("verify");      
-
 $required_fields_filled_in = "yes";
-
 if ($form_data{'gateway'} eq "") {
   $form_data{'gateway'} = $sc_gateway_name;
  }
-
-&codehook("set_form_required_fields");#
-
+&codehook("set_form_required_fields");
+# checks for prevent of Zero sub total orders.  Set in main settings manager
+# Added by Mister Ed (K-Factor Technologies, Inc) 10/17/2003
+if ($sc_prevent_zero_total_orders =~ /yes/i) {
+$mustbegreaterthanthis = .0001;
+if ($subtotal < $mustbegreaterthanthis) {
+$we_need_to_exit++;
+if ($we_need_to_exit = 1)
+{
+  print '<div align="center">';
+}
+print <<ENDOFTEXT;
+<p class="ac_missing_field">
+  Empty Orders not accepted!.
+</p>
+ENDOFTEXT
+}
+}
+# checks for minimum order amount.  Set in main settings manager
+# Added by Mister Ed (K-Factor Technologies, Inc) 10/17/2003
+if ($subtotal < $sc_minimum_order_amount) { 
+$we_need_to_exit++;
+if ($we_need_to_exit = 1)
+{
+  print '<div align="center">';
+}
+print <<ENDOFTEXT;
+<p class="ac_missing_field">
+  Minimum order amount is $sc_minimum_order_amount $sc_minimum_order_text.
+</p>
+ENDOFTEXT
+} 
 foreach $required_field (@sc_order_form_required_fields) {
 if ($form_data{$required_field} eq "") {
     $required_fields_filled_in = "no";
-
 $we_need_to_exit++;
-
+if ($we_need_to_exit = 1)
+{
+  print '<div align="center">';
+}
 print <<ENDOFTEXT;
-
-<CENTER>
-<HR WIDTH=500>
-<TABLE WIDTH=500>
-<TR>
-<TD>
-<FONT FACE=ARIAL COLOR=RED>
-You forgot to fill in $sc_order_form_array{$required_field}.
-</FONT>
-</TD>
-</TR>
-</TABLE>
-</CENTER>
-
+<p class="ac_missing_field">
+  You forgot to fill in $sc_order_form_array{$required_field}.
+</p>
 ENDOFTEXT
   }
-
 } 
-
 if ($we_need_to_exit > 0)
 {
-    print "<HR WIDTH=500>\n";
-    print qq~<center><FORM METHOD=POST
-ACTION="$sc_stepone_order_script_url">
-<INPUT TYPE=HIDDEN NAME="order_form_button" VALUE="1">
-$hidden_fields
-<INPUT TYPE=HIDDEN NAME="HCODE" VALUE="$sc_pass_used_to_scramble">
-<INPUT TYPE=HIDDEN NAME="gateway" VALUE="$form_data{'gateway'}"> 
-<INPUT TYPE=HIDDEN NAME="ofn" VALUE="$form_data{'gateway'}"> 
-<INPUT TYPE="IMAGE" NAME="Make Changes" VALUE="Make Changes" 
-SRC="picserve.cgi?secpicserve=make_changes.gif" BORDER=0>
-</FORM>~;
-    print "</center>\n";
+    print qq~<form method="post" action="$sc_stepone_order_script_url">
+  <p class="ac_missing_field">
+    <input type="hidden" name="order_form_button" value="1">
+    $hidden_fields
+    <input type="hidden" name="HCODE" value="$sc_pass_used_to_scramble">
+    <input type="hidden" name="gateway" value="$form_data{'gateway'}"> 
+    <input type="hidden" name="ofn" value="$form_data{'gateway'}"> 
+    <input type="image" name="Make Changes" value="Make Changes" src="picserve.cgi?secpicserve=make_changes.gif" alt="Make Changes">
+  </p>
+</form>
+</div>~;
     &SecureStoreFooter;
-
     print qq!
-    </BODY>
-    </HTML>
+    </body>
+    </html>
     !;
     &call_exit;
 }
-
 if (($sc_paid_by_ccard =~ /yes/i) && ($sc_CC_validation =~ /yes/i)) {
 
   &require_supporting_libraries (__FILE__, __LINE__,
-		"./library/credit_card_validation_lib.pl");
+    "./library/credit_card_validation_lib.pl");
 
   $CC_exp_date = $form_data{'Ecom_Payment_Card_ExpDate_Month'} . '/' .
                  $form_data{'Ecom_Payment_Card_ExpDate_Day'} . '/' .
@@ -640,104 +628,82 @@
   {
     $required_fields_filled_in = "no";
     $order_error_do_not_finish = "yes";
-print <<ENDOFTEXT;
-
-<CENTER>
-<HR WIDTH=500>
-<TABLE WIDTH=500>
-<TR>
-<TD>
-<FONT FACE=ARIAL COLOR=RED>
-$error_message</FONT>
-</TD>
-</TR>
-</TABLE>
-</CENTER>
 
+print <<ENDOFTEXT;
+<div align="center">
+<p class="ac_error">
+  $error_message
+</p>
 ENDOFTEXT
   }  
 
 }
-
   if($order_error_do_not_finish =~ /yes/i)
   {
-    print "<HR WIDTH=500>\n";
-    print qq~<center><FORM METHOD=POST
-ACTION="$sc_stepone_order_script_url">
-<INPUT TYPE=HIDDEN NAME="order_form_button" VALUE="1">
+  
+    print qq~
+    <hr>
+    <div align="center"
+    <form method="post" action="$sc_stepone_order_script_url">
+<input type="hidden" name="order_form_button" VALUE="1">
 $hidden_fields
-<INPUT TYPE=HIDDEN NAME="HCODE" VALUE="$sc_pass_used_to_scramble">
-<INPUT TYPE=HIDDEN NAME="gateway" VALUE="$form_data{'gateway'}"> 
-<INPUT TYPE=HIDDEN NAME="ofn" VALUE="$form_data{'gateway'}"> 
-<INPUT TYPE="IMAGE" NAME="Make Changes" VALUE="Make Changes" 
-SRC="picserve.cgi?secpicserve=make_changes.gif" BORDER=0>
-</FORM>~;
-    print "</center>\n";
+<input type="hidden" name="HCODE" value="$sc_pass_used_to_scramble">
+<input type="hidden" name="gateway" value="$form_data{'gateway'}"> 
+<input type="hidden" name="ofn" value="$form_data{'gateway'}"> 
+<input type="image" name="Make Changes" value="Make Changes" 
+  src="picserve.cgi?secpicserve=make_changes.gif">
+</form>
+</div>~;
+
     &SecureStoreFooter;
 
     print qq!
-    </BODY>
-    </HTML>
+    </body>
+    </html>
     !;
     &call_exit;
   }  
-
 if ($required_fields_filled_in eq "yes") {
-
   foreach $form_field (sort(keys(%sc_order_form_array))) {
     $text_of_cart .= 
       &format_text_field($sc_order_form_array{$form_field})
       . "= $form_data{$form_field}\n";
   }
   $text_of_cart .= "\n";
-
 if ($sc_use_pgp =~ /yes/i) {
     &require_supporting_libraries(__FILE__, __LINE__,
     "$sc_pgp_lib_path");
-
 $text_of_cart = &make_pgp_file($text_of_cart,
                "$sc_pgp_temp_file_path/$$.pgp");
 $text_of_cart = "\n" . $text_of_cart . "\n";
-
   }
-
 if ($form_data{'gateway'} eq "") {
-  # set default value, backwards compatable!
   $form_data{'gateway'} = $sc_gateway_name;
  }
-  
 &codehook("printSubmitPage");# used to be &printSubmitPage;
-
 } else {
-
 print <<ENDOFTEXT;
-
-<CENTER>
-<HR WIDTH=500>
-<TABLE WIDTH=500>
-<TR>
-<TD WIDTH=500>
-<FONT FACE=ARIAL>$messages{'ordprc_01'}</FONT></TD>
-</TR>
-</TABLE>
-<HR WIDTH=500>
-<CENTER>  
-
+<div align="center">
+<hr>
+<p class="ac_error">
+  $messages{'ordprc_01'}
+</p>
+<hr>
+</div>
 ENDOFTEXT
 
 } 
-
 &SecureStoreFooter;
 
 print qq!
-</BODY>
-</HTML>
+</body>
+</html>
 !;
+}
 
-} 
 ############################################################
 sub calculate_final_values {
-  local($subtotal,
+  local($taxable_grand_total,$subtotal,
         $total_quantity,
         $total_measured_quantity,
         $are_we_before_or_at_process_form) = @_;
@@ -752,9 +718,8 @@
   local($final_extra_tax2, $extra_tax2) = 0;
   local($final_extra_tax3, $extra_tax3) = 0;
   local($calc_loop) = 0;
-
 $temp_total = $subtotal;
-
+my $temp_taxable_total = $taxable_grand_total;
 $max_loops=3;
 &codehook("before_final_values_loop");
 for (1..$max_loops) {
@@ -768,90 +733,90 @@
 &codehook("begin_final_values_loop_iteration");
 if ($are_we_before_or_at_process_form =~ /before/i)
 {
-
 if ($sc_calculate_discount_at_display_form ==
     $calc_loop) {
     $discount = 
     &calculate_discount($temp_total,
     $total_quantity,
     $total_measured_quantity);
-    } # End of if discount gets calculated here
-
+    if ($sc_calculate_sales_tax_at_process_form >= $calc_loop) {
+        $temp_taxable_total -= $discount;
+    }
+    } 
 if ($sc_calculate_shipping_at_display_form ==
     $calc_loop) {
+  &codehook("calculate_final_values_calc_shipping_display_form_top");
     $shipping = &define_shipping_logic($total_measured_quantity,
                 $stevo_shipping_thing);
+    if ($sc_calculate_sales_tax_at_process_form > $calc_loop) {
+        $temp_taxable_total += $shipping;
+    }
+  &codehook("calculate_final_values_calc_shipping_display_form_bottom");
     } 
-
 if ($sc_calculate_sales_tax_at_display_form ==
     $calc_loop) {
     $sales_tax = 
-    &calculate_sales_tax($temp_total);
+    &calculate_sales_tax($temp_taxable_total);
    } 
-
 if ($sc_calculate_extra_tax1_at_display_form ==
     $calc_loop) {
     $extra_tax1 = 
-    &calculate_extra_tax1($temp_total);
+    &calculate_extra_tax1($temp_taxable_total);
    } 
-
 if ($sc_calculate_extra_tax2_at_display_form ==
     $calc_loop) {
     $extra_tax2 = 
-    &calculate_extra_tax2($temp_total);
+    &calculate_extra_tax2($temp_taxable_total);
    } 
-
 if ($sc_calculate_extra_tax3_at_display_form ==
     $calc_loop) {
     $extra_tax3 = 
-    &calculate_extra_tax3($temp_total);
+    &calculate_extra_tax3($temp_taxable_total);
    } 
-
    } else {
-
 if ($sc_calculate_discount_at_process_form ==
     $calc_loop) {
     $discount = 
     &calculate_discount($temp_total,
     $total_quantity,
     $total_measured_quantity);
+    if ($sc_calculate_sales_tax_at_process_form >= $calc_loop) {
+        $temp_taxable_total -= $discount;
+    }
     } 
-
 if ($sc_calculate_shipping_at_process_form ==
     $calc_loop) {
+  &codehook("calculate_final_values_calc_shipping_process_form_top");
     $shipping = &define_shipping_logic($total_measured_quantity,
                 $stevo_shipping_thing);
+    if ($sc_calculate_sales_tax_at_process_form > $calc_loop) {
+        $temp_taxable_total += $shipping;
+    }
+  &codehook("calculate_final_values_calc_shipping_process_form_bottom");
    } 
-
 if ($sc_calculate_sales_tax_at_process_form ==
     $calc_loop) {
-    $sales_tax = 
-    &calculate_sales_tax($temp_total);
+    $sales_tax = &calculate_sales_tax($temp_taxable_total);
    } 
-
 if ($sc_calculate_extra_tax1_at_process_form ==
     $calc_loop) {
     $extra_tax1 = 
-    &calculate_extra_tax1($temp_total);
+    &calculate_extra_tax1($temp_taxable_total);
    } 
-
 if ($sc_calculate_extra_tax2_at_process_form ==
     $calc_loop) {
     $extra_tax2 = 
-    &calculate_extra_tax2($temp_total);
+    &calculate_extra_tax2($temp_taxable_total);
    } 
-
 if ($sc_calculate_extra_tax3_at_process_form ==
     $calc_loop) {
     $extra_tax3 = 
-    &calculate_extra_tax3($temp_total);
-   } # End of extra tax3 calculations
+    &calculate_extra_tax3($temp_taxable_total);
+   } 
 
 } 
-
 if (!($total_quantity > 0)) {$shipping=0;}
 &codehook("end_final_values_loop_iteration_before_calc");
-
 $final_discount = $discount if ($discount > 0);
 $final_shipping = $shipping if ($shipping > 0);
 $final_sales_tax = $sales_tax if ($sales_tax > 0);
@@ -862,9 +827,7 @@
                + $extra_tax1 + $extra_tax2 + $extra_tax3;
 &codehook("end_final_values_loop_iteration_after_calc");
 } 
-
 $grand_total = $temp_total;
-
 if ($sc_verify_inv_no eq '') {
   open(MYFILE,"$sc_verify_order_path");
   @testlines = <MYFILE>;
@@ -872,7 +835,6 @@
   @testlines = grep(/sc_verify_inv_no/,@testlines);
   ($junk1,$sc_verify_inv_no,$junk2) = split(/\"/,@testlines[0],3);
  }
-
 if ($sc_verify_inv_no ne '') {
   $current_verify_inv_no = $sc_verify_inv_no;
  } else {
@@ -880,7 +842,7 @@
  }
 $zz_shipping_thing = $sc_shipping_thing;
 $zz_shipping_thing =~ s/\|/\" . \n  \"\|/g;
-
+&codehook("calculate_final_values_calc_save_verify_file_top");
 if (($sc_test_repeat == 0) &&
  (($form_data{'submit_order_form_button'} ne "") ||
    ($form_data{'submit_order_form_button.x'} ne ""))) {
@@ -893,7 +855,7 @@
   print MYFILE "\$sc_verify_shipping_zip = \"", 
                 (0+$form_data{'Ecom_ShipTo_Postal_PostalCode'}),"\";\n";
   print MYFILE "\$sc_verify_shipping_thing = \"",
-		$zz_shipping_thing,"\";\n";
+    $zz_shipping_thing,"\";\n";
   print MYFILE "\$sc_verify_shipto_postal_stateprov = \"", 
                 $form_data{'Ecom_ShipTo_Postal_StateProv'},"\";\n";
   print MYFILE "\$sc_verify_shipto_method = \"", 
@@ -909,13 +871,12 @@
   print MYFILE "\$sc_verify_Origin_ZIP = \"",$sc_verify_Origin_ZIP,"\";\n";
   print MYFILE "\$sc_verify_inv_no = \"",$current_verify_inv_no,"\";\n";
   print MYFILE "\$sc_verify_paid_by_ccard = \"",$sc_paid_by_ccard,"\";\n";
-
+  &codehook("calculate_final_values_calc_save_verify_file_section_one");
   $mypass = &make_random_chars;
   $mypass .= &make_random_chars;
   $mypass .= &make_random_chars;
   $mypass .= &make_random_chars;
   $sc_pass_used_to_scramble = $mypass;
-
   if ($sc_test_repeat ne 0) { 
     $form_data{'Ecom_Payment_Card_Number'} = '';
     $form_data{'Ecom_Payment_BankAcct_Number'} = '';
@@ -923,28 +884,32 @@
     $form_data{'Ecom_Payment_Bank_Name'} = '';
     $form_data{'Ecom_Payment_Orig_Card_Number'} = '';
    }
-
 if ($sc_scramble_cc_info =~ /yes/i ) {
   $save1 = $form_data{'Ecom_Payment_Card_Number'};
   $form_data{'Ecom_Payment_Card_Number'} = 
-	&scramble($save1,$mypass,0);
+  &scramble($save1,$mypass,0);
   $save2 = $form_data{'Ecom_Payment_BankAcct_Number'};
   $form_data{'Ecom_Payment_BankAcct_Number'} = 
-	&scramble($save2,$mypass,0);
+  &scramble($save2,$mypass,0);
   $save3 = $form_data{'Ecom_Payment_BankRoute_Number'};
   $form_data{'Ecom_Payment_BankRoute_Number'} = 
-	&scramble($save3,$mypass,0);
+  &scramble($save3,$mypass,0);
   $save4 = $form_data{'Ecom_Payment_Bank_Name'};
   $form_data{'Ecom_Payment_Bank_Name'} = 
-	&scramble($save4,$mypass,0);
+  &scramble($save4,$mypass,0);
   $save5 = $form_data{'Ecom_Payment_Orig_Card_Number'};
   $form_data{'Ecom_Payment_Orig_Card_Number'} = 
-	&scramble($save5,$mypass,0);
+  &scramble($save5,$mypass,0);
 }
-
+  &codehook("calculate_final_values_calc_save_verify_file_section_two");
   foreach $inx (sort(keys %form_data)) {
     $value = $form_data{$inx};
     $value =~ s/\'/\"/g;
+    # added by Mister Ed April 26, 2006
+    # to prevent massive text entries in xcomments and other fields
+    if (length($value) > $sc_max_char_length) {
+        $value = substr($value,0,$sc_max_char_length);
+    }
     print MYFILE "\$vform_$inx = '$value'\;\n";
     print MYFILE "\$vform{'$inx'} = '$value'\;\n";
     $value =~ s/\"/\&quot\;/g;
@@ -952,7 +917,6 @@
     print MYFILE "\$eform{'$inx'} = '$value'\;\n";
     $eform_data{$inx} = $value; 
    }
-
 if ($sc_scramble_cc_info =~ /yes/i ) {
   $form_data{'Ecom_Payment_Card_Number'} = $save1;
   $form_data{'Ecom_Payment_BankAcct_Number'} = $save2;
@@ -960,11 +924,11 @@
   $form_data{'Ecom_Payment_Bank_Name'} = $save4;
   $form_data{'Ecom_Payment_Orig_Card_Number'} = $save5;
 }
+&codehook("calculate_final_values_calc_save_verify_file_bottom");
 
   print MYFILE "1;\n";
   close(MYFILE);
 }
-
 &codehook("end_final_values");
 return ($final_shipping,
         $final_discount,
@@ -980,21 +944,19 @@
   local($subtotal,
         $total_quantity,
         $total_measured_quantity) = @_;
-
+&codehook("calculate_shipping_top");
   return(&calculate_general_logic(
            $subtotal,
            $total_quantity,
            $total_measured_quantity,
            *sc_shipping_logic,
            *sc_order_form_shipping_related_fields));
-
 } 
 ############################################################
 sub calculate_discount {
   local($subtotal,
         $total_quantity,
         $total_measured_quantity) = @_;
- 
   &codehook("calculate_discount_top");
   return(&calculate_general_logic(
            $subtotal,
@@ -1004,94 +966,42 @@
            *sc_order_form_discount_related_fields));
 } 
 ############################################################
+# New version of this routine is a
+# Free Contribution by Mark S. (MAS), an AgoraCart Pro member.
+# Updated/Contributed August 29 2004
+# 
+# This version will allow you to mix and match both the newer and older logic matrices for backward compatibility.
+############################################################
 sub calculate_general_logic {
-  local($subtotal,
-        $total_quantity,
-        $total_measured_quantity,
-        *general_logic,
-        *general_related_form_fields) = @_;
-
-  local($general_value);
-
-  local($x, $count);
-  local($logic);
-  local($criteria_satisfied);
-  local(@fields);
-
-  local(@related_form_values) = ();
-  
-$count = 0;
-
-foreach $x (@general_related_form_fields) {
-
-$related_form_values [$count] = $form_data{$x};
-$count++;
-
-}
-
-foreach $logic (@general_logic) {
-
-$criteria_satisfied = "yes";
-
-@fields = split(/\|/, $logic);  
-
-
-    for (1..@related_form_values) {
-      if (!(&compare_logic_values(
-            $related_form_values[$_ - 1],
-            $fields[$_ - 1]))) {
-            $criteria_satisfied = "no";
+    local($subtotal,
+    $total_quantity,
+    $total_measured_quantity,
+    *general_logic,
+    *general_related_form_fields) = @_;
+    local $numFields = scalar split /\|/, @general_logic[0] ;
+    local($general_value, $logic_statement, $form_field, $applyMe, $compareMe);
+    local(@logic_fields, @compare_values ) ;
+    foreach $logic_statement (@general_logic) {
+        @logic_fields = split(/\|/, $logic_statement) ;
+        FORMFIELD: foreach $form_field (@general_related_form_fields) {
+            @compare_values = ("#$form_data{$form_field}#", $subtotal, $total_quantity, $total_measured_quantity,0,0,0) ;
+      for (0..$numFields) {
+    next if $_ == 4 || $_ > 5 ;
+    $logicField = $logic_fields[$_] ;
+    $logicField =    "#$logic_fields[$_]#" if  $logic_fields[$_] && ! $_ ;
+    next FORMFIELD if (!(&compare_logic_values($compare_values[$_],$logicField)));
       }
+      $applyMe = $logic_fields[4] ;
+    if ($applyMe =~ /%/) {
+        $applyMe =~ s/%// ;
+        $general_value = $subtotal * $applyMe / 100 ;
+    } else {
+        $general_value = $applyMe ;
     } 
-
-    for (1..@related_form_values) {
-      shift(@fields);
-    }
-
-
-    if (!(&compare_logic_values(
-          $subtotal,
-          $fields[0]))) {
-          $criteria_satisfied = "no";
-    }
- 
-    shift (@fields);
-
-    if (!(&compare_logic_values(
-          $total_quantity,
-          $fields[0]))) {
-          $criteria_satisfied = "no";
-    }
-  
-    shift (@fields);
-
-
-    if (!(&compare_logic_values(
-          $total_measured_quantity,
-          $fields[0]))) {
-       $criteria_satisfied = "no";
-    }
-
-
-    shift (@fields);
-
-
-    if ($criteria_satisfied eq "yes") {
-
-    if ($fields[0] =~ /%/) {
-        $fields[0] =~ s/%//;
-        $general_value = $subtotal * $fields[0] / 100;
-      } else {
-        $general_value = $fields[0];
-      }
-    }
-
-    
-  } 
-
-  return(&format_price($general_value));
-
-} 
+        } 
+    } 
+    return(&format_price($general_value));
+}
 ############################################################
 sub calculate_extra_tax1 {
   local($subtotal) = @_;
@@ -1103,7 +1013,6 @@
    }
   return (&format_price($extra_tax));
 } 
-
 sub calculate_extra_tax2 {
   local($subtotal) = @_;
   local($extra_tax) = 0;
@@ -1114,7 +1023,6 @@
    }
   return (&format_price($extra_tax));
 } 
-
 sub calculate_extra_tax3 {
   local($subtotal) = @_;
   local($extra_tax) = 0;
@@ -1127,7 +1035,7 @@
 } 
 ############################################################
 sub calculate_sales_tax {
-  local($subtotal) = @_;
+  local($taxable_grand_total) = @_;
   local($sales_tax) = 0;
   local($tax_form_variable);
   local($continue)=1;
@@ -1140,48 +1048,48 @@
   if ($tax_form_variable eq "") {
     $tax_form_variable = $vform{$sc_sales_tax_form_variable};
    }
-
   if ($sc_sales_tax_form_variable ne "") {
     foreach $value (@sc_sales_tax_form_values) {
       if (($value =~ 
           /^${tax_form_variable}$/i) &&
          (${tax_form_variable} ne ""))  {
-        $sales_tax = $subtotal * $sc_sales_tax;
+        $sales_tax = $taxable_grand_total * $sc_sales_tax;
       }
     }
- 
   } else {
-    $sales_tax = $subtotal * $sc_sales_tax;
+    $sales_tax = $taxable_grand_total * $sc_sales_tax;
   }
-
   &codehook("calc_sales_tax_bot");
   return (&format_price($sales_tax));
-
 } 
 ############################################################
+# New version of this routine is a
+# Free Contribution by Mark S. (MAS), an AgoraCart Pro member.
+# Updated/Contributed August 29 2004
+############################################################
 sub compare_logic_values {
   local($input_value, $value_to_compare) = @_;
   local($lowrange, $highrange);
-
-if ($value_to_compare =~ /-/) {
-
-    ($lowrange, $highrange) = split(/-/, $value_to_compare);
-
-
+  local $rangeCount =  scalar ( ($lowrange, $highrange) = split(/-/, $value_to_compare) )   ;
+if ($value_to_compare =~ /\//) {
+  ($highrange , $lowrange) = ($lowrange, '') if $lowrange && ! $highrange && $rangeCount==1 ;
+  $epochStart = date_to_epoch($lowrange || '1/1/1970','start') ;
+  $epochEnd   =  date_to_epoch($highrange || '1/1/2020','end') ;
+  return ( (time() >= $epochStart) && (time() <= $epochEnd )) ? 1 : 0 ;
+}
+if ($rangeCount > 1) {
     if ($lowrange eq "") {
       if ($input_value <= $highrange) {
         return(1);
       } else {
         return(0);
       }
-
     } elsif ($highrange eq "") {
       if ($input_value >= $lowrange) {
         return(1);
       } else {
         return(0);
       }
-
     } else {
       if (($input_value >= $lowrange) &&
          ($input_value <= $highrange)) {
@@ -1190,7 +1098,6 @@
         return(0);
       }
     }
-
   } else {
     if (($input_value =~ /$value_to_compare/i) ||
         ($value_to_compare eq "")) {
@@ -1200,33 +1107,38 @@
     }
   }
 } 
+sub date_to_epoch {
+    use Time::Local ;
+    local ($stringDate, $part_of_day) = @_ ;
+    local @mredDate = split "/", $stringDate ;
+    return timelocal(0,0,0,$mredDate[1],$mredDate[0]-1,$mredDate[2]) 
+  if ($part_of_day =~ /start/ ) ;
+    return timelocal(59,59,23,$mredDate[1],$mredDate[0]-1,$mredDate[2]) 
+  if ($part_of_day =~ /end/ ) ;
+}
 ############################################################
 sub cart_textinfo {
  local (*cart_fields) = @_;
  local ($quantity, $product, $product_name, $options, $product_price);
  local ($inx, $result, $p_id, $title, $mydata, $display_index);
  local ($field_name, $query_result, $cart_line_id, @my_row);
-
-
- $cart_line_id 	= $cart_fields[$cart{'unique_cart_line_id'}];
- $quantity 	= $cart_fields[$cart{"quantity"}];
- $p_id 		= $cart_fields[$cart{"product_id"}];
- $product 	= $cart_fields[$cart{"product"}];
- $product_name	= $cart_fields[$cart{"name"}];
- $options 	= $cart_fields[$cart{"options"}];
- $product_price	= $cart_fields[$cart{"price"}];
-
- if (!($sc_db_lib_was_loaded =~ /yes/i)) 
+ $cart_line_id  = $cart_fields[$cart{'unique_cart_line_id'}];
+ $quantity  = $cart_fields[$cart{"quantity"}];
+ $p_id    = $cart_fields[$cart{"product_id"}];
+ $product   = $cart_fields[$cart{"product"}];
+ $product_name  = $cart_fields[$cart{"name"}];
+ $options   = $cart_fields[$cart{"options"}];
+ $product_price = $cart_fields[$cart{"price"}];
+ if (!($sc_db_lib_was_loaded =~ /yes/i)) #load the library
   {
    &require_supporting_libraries(__FILE__, __LINE__,"$sc_db_lib_path");
   }
+ #read in the database row
  $query_result = &check_db_with_product_id($p_id,*my_row);
  $result = '';
  $inx=0;
-
  $result  = "Quantity:      $quantity\nProduct:       " . $product_name .
-		' (' . &display_price($product_price) . " ea.)\n";
-            
+    ' (' . &display_price($product_price) . " ea.)\n";
  foreach $field_name (@sc_textcol_name)
   {
    $display_index = $cart{$field_name};
@@ -1234,7 +1146,7 @@
    $title = substr($title,0,14) . " ";
    if ($display_index < 0) { 
      $mydata = $my_row[(0-$display_index)];
-    } else { #normal, in the cart
+    } else { 
      $mydata = &vf_get_data("CART",$field_name,$cart_line_id,@cart_fields);
     }
    if ($sc_textcart_display_factor[$inx] =~ /yes/i) {
@@ -1249,54 +1161,149 @@
    $result .= $title . $mydata . "\n";
    $inx++;
   }
-
  $result .= "\n";
  return $result;
-
 }
 ############################################################
 sub log_order {
  local ($text_of_cart,$invoice,$customer_id) = @_;
- local ($filename);
-
+ my ($filename,$filename7,$filename6,$filename5);
+ my ($filename2, $filename3, $filename4, $overview_string, $cart_lines_for_logging,$orderLogString,$orderLogStringShort) = '';
+ local (@productlog);
+ local (@keys);
+ local (%productsSold);
+ my ($quantity,$product,$pid,$category,$price,$shipping,$optionids,$productStatus,$downladables,$altorigin,$nontaxable,$cartuser5,$cartuser6,$formattedoptions,$priceafteroptions);
  $customer_id =~ /([\w\-\=\+\/]+)\.(\w+)/;
  $customer_id = "$1.$2";
  $invoice =~ /(\w+)/;
  $invoice = "$1";
-
+ my ($day,$month,$year) = &get_month_year;
+ $filename2 = "$sc_order_log_directory_path/$year/";
+ $filename3 = "$sc_order_log_directory_path/$year/$month/";
+ $filename7 = "$sc_order_log_directory_path/$year" . "_productSalesLog.prd2";
+if (($sc_write_product_sales_logs =~ /yes/i) && (-e $filename7))  {
+             open(PRODLOG,$filename7);
+             @productlog=<PRODLOG>;
+             close(PRODLOG);
+             foreach $productlog(@productlog) {
+                 chomp($productlog);
+                 my ($productName,$qty)=split("\t",$productlog);
+                 $productsSold{$productName}=$qty;
+             }
+       }
+if (($sc_write_individual_order_logs =~ /yes/i)||($sc_write_monthly_master_order_logs =~ /yes/i)) {
+   open (CART, "$sc_cart_path")|| &file_open_error("$sc_cart_path", "display_cart_contents", __FILE__, __LINE__);
+   while (<CART>)
+   {
+       if ($cart_lines_for_logging ne "") {
+           $cart_lines_for_logging .= "::"; 
+       }
+       @cart_fields2 = split (/\|/, $_);
+        $quantity = $cart_fields2[0];
+        $pid = $cart_fields2[1];
+        $category = $cart_fields2[2];
+        $price = $cart_fields2[3];
+        $product = $cart_fields2[4];
+        $shipping = $cart_fields2[6];
+        $optionids = $cart_fields2[8];
+        $downladables = $cart_fields2[10];
+        $altorigin = $cart_fields2[11];
+        $nontaxable = $cart_fields2[12];
+        $cartuser5 = $cart_fields2[13];
+        $cartuser6 = $cart_fields2[14];
+        $formattedoptions = $cart_fields2[15];
+        $priceafteroptions = $cart_fields2[16];
+       if ($downladables ne '') {
+           $productStatus = "Downloadable";
+       } else {
+           $productStatus = "$sc_defaultProductStatus";
+       }
+       $cart_lines_for_logging .= "$quantity|$pid|$category|$price|$product|$shipping|$optionids|$downladables|$altorigin|$nontaxable|$cartuser5|$cartuser6|$formattedoptions|$priceafteroptions|$productStatus";
+       if ($sc_write_product_sales_logs =~ /yes/i) {
+             my $productNameThngy = "$product    ID $pid";
+             $productsSold{$productNameThngy} += $quantity;
+       }
+   }
+   close(CART);
+}
+   $orderLoggingHash{'cartContents'} = $cart_lines_for_logging;
+   # added by Mister Ed October 2005
+   # fax number added March 11, 2006
+   # tos Added March 18, 2006
+   # Residential & insurance added April 5, 2006
+   $orderLogString = "$year\t$month\t$day\t$orderLoggingHash{'invoiceNumber'}\t$orderLoggingHash{'customerNumber'}\t$orderLoggingHash{'orderStatus'}\t$orderLoggingHash{'shiptrackingID'}\t$orderLoggingHash{'firstName'}\t$orderLoggingHash{'lastName'}\t$orderLoggingHash{'fullName'}\t$orderLoggingHash{'companyName'}\t$orderLoggingHash{'customerPhone'}\t$orderLoggingHash{'faxNumber'}\t$orderLoggingHash{'emailAddress'}\t$orderLoggingHash{'orderFromAddress'}\t$orderLoggingHash{'customerAddress2'}\t$orderLoggingHash{'customerAddress3'}\t$orderLoggingHash{'orderFromCity'}\t$orderLoggingHash{'orderFromState'}\t$orderLoggingHash{'orderFromPostal'}\t$orderLoggingHash{'orderFromCountry'}\t$orderLoggingHash{'shipToName'}\t$orderLoggingHash{'shipToAddress'}\t$orderLoggingHash{'shipToAddress2'}\t$orderLoggingHash{'shipToAddress3'}\t$orderLoggingHash{'shipToCity'}\t$orderLoggingHash{'shipToState'}\t$orderLoggingHash{'shipToPostal'}\t$orderLoggingHash{'shipToCountry'}\t$orderLoggingHash{'shiptoResidential'}\t$orderLoggingHash{'insureShipment'}\t$orderLoggingHash{'shipMethod'}\t$orderLoggingHash{'shippingTotal'}\t$orderLoggingHash{'salesTax'}\t$orderLoggingHash{'tax1'}\t$orderLoggingHash{'tax2'}\t$orderLoggingHash{'tax3'}\t$orderLoggingHash{'discounts'}\t$orderLoggingHash{'netProfit'}\t$orderLoggingHash{'subTotal'}\t$orderLoggingHash{'orderTotal'}\t$orderLoggingHash{'affiliateTotal'}\t$orderLoggingHash{'affiliateID'}\t$orderLoggingHash{'affiliateMisc'}\t$orderLoggingHash{'user1'}\t$orderLoggingHash{'user2'}\t$orderLoggingHash{'user3'}\t$orderLoggingHash{'user4'}\t$orderLoggingHash{'user5'}\t$orderLoggingHash{'adminMessages'}\t$orderLoggingHash{'cartContents'}\t$orderLoggingHash{'GatewayUsed'}\t$orderLoggingHash{'shippingMessages'}\t$orderLoggingHash{'xcomments'}\t$orderLoggingHash{'termsOfService'}\t$orderLoggingHash{'discountCode'}\n";
+   $orderShortLogString = "$year\t$month\t$day\t$orderLoggingHash{'invoiceNumber'}\t$orderLoggingHash{'customerNumber'}\t$orderLoggingHash{'orderStatus'}\t$orderLoggingHash{'firstName'}\t$orderLoggingHash{'lastName'}\t$orderLoggingHash{'fullName'}\t$orderLoggingHash{'companyName'}\t$orderLoggingHash{'emailAddress'}\t$orderLoggingHash{'orderFromState'}\t$orderLoggingHash{'orderFromPostal'}\t$orderLoggingHash{'orderFromCountry'}\t$orderLoggingHash{'shipMethod'}\t$orderLoggingHash{'shippingTotal'}\t$orderLoggingHash{'salesTax'}\t$orderLoggingHash{'tax1'}\t$orderLoggingHash{'tax2'}\t$orderLoggingHash{'tax3'}\t$orderLoggingHash{'discounts'}\t$orderLoggingHash{'netProfit'}\t$orderLoggingHash{'subTotal'}\t$orderLoggingHash{'orderTotal'}\t$orderLoggingHash{'affiliateTotal'}\t$orderLoggingHash{'affiliateID'}\t$orderLoggingHash{'affiliateMisc'}\n";
 &codehook("log_order_top");
-
+# test for year and months as directory names for logging purposes.
+#added by Mister Ed October 2005
+   if (!(-d $filename2)) {
+       mkdir $filename2;
+   }
+   if (!(-d $filename3)) {
+       mkdir $filename3;
+   }
+#added by Mister Ed October 2005
+if ($sc_write_monthly_short_order_logs =~ /yes/i) {
+           $filename4 = "$filename3/$month$year" . "_indexOrderLog.log2";
+           &get_file_lock("$filename4.lockfile");
+           open (ORDERLOG4, ">>$filename4");
+           print ORDERLOG4 $orderShortLogString;
+           close (ORDERLOG4);
+           &release_file_lock("$filename4.lockfile");
+}
+#added by Mister Ed October 2005
+ if ($sc_write_monthly_master_order_logs =~ /yes/i) {
+           $filename5 = "$filename2/$month$year" . "_MasterOrderLog.log2";
+           &get_file_lock("$filename5.lockfile");
+           open (ORDERLOG, ">>$filename5");
+           print ORDERLOG $orderLogString;
+           close (ORDERLOG);
+           &release_file_lock("$filename5.lockfile");
+}
+if ($sc_write_individual_order_logs =~ /yes/i) {
+  ## write out individual orders.  revised by Mister Ed June 2005
+   $filename4 = "$filename3/${invoice}-${customer_id}-complete2";
+   $filename5 = "$filename3/${invoice}-${customer_id}-orderdata2";
+   &codehook("log_order_individual_inside_top");
+   &get_file_lock("$filename4.lockfile");
+   open (ORDERLOG, ">$filename4");
+   print ORDERLOG $text_of_cart;
+   close (ORDERLOG);
+   &release_file_lock("$filename4.lockfile");
+   &codehook("log_order_individual_inside_middle");
+   &get_file_lock("$filename5.lockfile");
+   open (ORDERLOG, ">$filename5");
+   print ORDERLOG $orderLogString;
+   close (ORDERLOG);
+   &release_file_lock("$filename5.lockfile");
+   &codehook("log_order_individual_inside_bottom");
+}
+&codehook("log_order_middle");
+   if ($sc_write_product_sales_logs =~ /yes/i) {
+        {@keys=sort {$productsSold{$a} <=> $productsSold{$b}} keys(%productsSold)}
+        &get_file_lock("$filename7.lockfile");
+        open(PRODLOG,">$filename7");
+        foreach $key(@keys) {
+            print PRODLOG qq~$key\t$productsSold{$key}\n~;
+        }
+        close(PRODLOG);
+        &release_file_lock("$filename7.lockfile");
+   }
 if ($sc_send_order_to_log =~ /yes/i) {
   $filename = "./log_files/$sc_order_log_name";
   &get_file_lock("$filename.lockfile");
   open (ORDERLOG, "+>>$filename");
-  print ORDERLOG "*-" x 30 . "\n";
-  print ORDERLOG $text_of_cart;
-  print ORDERLOG "-*" x 30 . "\n";
+  $overview_string = "$orderShortLogString";
+  &codehook("log_order_overview_inside_bottom");
+  print ORDERLOG $overview_string;
   close (ORDERLOG);
-
-  ## write out individual orders
-  ## open in append mode just in case order exists already
-  # $filename = $sc_order_log_directory_path ."/";
-  # $filename .= "${invoice}-${customer_id}";
-  # &get_file_lock("$filename.lockfile");
-  # open (ORDERLOG, ">>$filename");
-  # print ORDERLOG "-" x 60 . "\n";
-  # print ORDERLOG $text_of_cart;
-  # print ORDERLOG "-" x 60 . "\n";
-  # close (ORDERLOG);
-
   &release_file_lock("$filename.lockfile");
-
  }
-
 &codehook("log_order_bot");
-
 }
 ############################################################
 sub decode_verify_vars {
   local($save1,$mypass);
-
   if (($sc_test_repeat ne 0) || 
     (($form_data{'HCODE'} eq "") && ($sc_scramble_cc_info =~ /yes/i ))) {
     $vform_Ecom_Payment_BankAcct_Number = '';
@@ -1310,19 +1317,19 @@
       $mypass = $form_data{'HCODE'};
       $save1 = $vform_Ecom_Payment_Orig_Card_Number;
       $vform_Ecom_Payment_Orig_Card_Number = 
-  	&scramble($save1,$mypass,1);
+    &scramble($save1,$mypass,1);
       $save1 = $vform_Ecom_Payment_Card_Number;
       $vform_Ecom_Payment_Card_Number = 
-	&scramble($save1,$mypass,1);
+  &scramble($save1,$mypass,1);
       $save1 = $vform_Ecom_Payment_BankAcct_Number;
       $vform_Ecom_Payment_BankAcct_Number = 
-	&scramble($save1,$mypass,1);
+  &scramble($save1,$mypass,1);
       $save1 = $vform_Ecom_Payment_BankRoute_Number;
       $vform_Ecom_Payment_BankRoute_Number = 
-	&scramble($save1,$mypass,1);
+  &scramble($save1,$mypass,1);
       $save1 = $vform_Ecom_Payment_Bank_Name;
       $vform_Ecom_Payment_Bank_Name = 
-	&scramble($save1,$mypass,1);
+  &scramble($save1,$mypass,1);
      }
    }
   &codehook("done_verify_decode");
@@ -1391,47 +1398,44 @@
 }
 #################################################################
 sub display_calculations {
-local($subtotal,
+local($taxable_grand_total,$subtotal,
       $are_we_before_or_at_process_form,
       $total_measured_quantity,
       $text_of_cart) = @_;
-
 local($final_shipping,
-	$final_discount,
-	$final_sales_tax,
-	$final_extra_tax1,
-	$final_extra_tax2,
-	$final_extra_tax3,
+  $final_discount,
+  $final_sales_tax,
+  $final_extra_tax1,
+  $final_extra_tax2,
+  $final_extra_tax3,
         $grand_total);
-
 if ($sc_use_verify_values_for_display =~ /yes/i) {
-	($sc_ship_method_shortname,$junk) = 
-		split(/\(/,$sc_verify_shipto_method,2);
-	($final_shipping,
-	$final_discount,
-	$final_sales_tax,
-	$final_extra_tax1,
-	$final_extra_tax2,
-	$final_extra_tax3,
+  ($sc_ship_method_shortname,$junk) = 
+    split(/\(/,$sc_verify_shipto_method,2);
+  ($final_shipping,
+  $final_discount,
+  $final_sales_tax,
+  $final_extra_tax1,
+  $final_extra_tax2,
+  $final_extra_tax3,
         $grand_total) =
-	($sc_verify_shipping,$sc_verify_discount,
-	$sc_verify_tax,$sc_verify_etax1,
-	$sc_verify_etax2,$sc_verify_etax3,
-	$sc_verify_grand_total);
+  ($sc_verify_shipping,$sc_verify_discount,
+  $sc_verify_tax,$sc_verify_etax1,
+  $sc_verify_etax2,$sc_verify_etax3,
+  $sc_verify_grand_total);
  } else {
-	($final_shipping,
-	$final_discount,
-	$final_sales_tax,
-	$final_extra_tax1,
-	$final_extra_tax2,
-	$final_extra_tax3,
+  ($final_shipping,
+  $final_discount,
+  $final_sales_tax,
+  $final_extra_tax1,
+  $final_extra_tax2,
+  $final_extra_tax3,
         $grand_total) =
-	&calculate_final_values($subtotal,
-	$total_quantity,
-	$total_measured_quantity,
-	$are_we_before_or_at_process_form);
+  &calculate_final_values($taxable_grand_total,$subtotal,
+  $total_quantity,
+  $total_measured_quantity,
+  $are_we_before_or_at_process_form);
 }
-
 $zsubtotal = $subtotal;
 $zfinal_shipping = $final_shipping;
 $zfinal_discount = $final_discount;
@@ -1445,11 +1449,9 @@
 {
 $final_shipping = &format_price($final_shipping);
 $final_shipping = &display_price($final_shipping);
-
 $text_of_cart .= &format_text_field("Shipping:") . 
 "= $final_shipping\n\n";
 };
-
 if ($final_discount > 0)
 {
 $final_discount = &format_price($final_discount);
@@ -1459,7 +1461,6 @@
 $text_of_cart .= &format_text_field("Discount:") . 
 "= $final_discount\n\n";
 }
-
 if ($final_sales_tax > 0)
 {
 $final_sales_tax = &format_price($final_sales_tax);
@@ -1469,30 +1470,23 @@
 $text_of_cart .= &format_text_field("Sales Tax:") . 
 "= $final_sales_tax\n\n";
 }
-
 $authPrice = $grand_total;
 $grand_total = &display_price($grand_total);
-
 &print_order_totals;
-
 if ($are_we_before_or_at_process_form =~ /at/i) 
 {
 print <<ENDOFTEXT;
-</FORM>
+</form>
 ENDOFTEXT
 }
-
 $text_of_cart .= &format_text_field("Grand Total:") . 
 "= $grand_total\n\n";
-
 return ($text_of_cart);
-
 }
 ###############################################################################
 sub explode {
  local ($what,*zdata) = @_;
  local ($temp,$ans,$command);
-
  &codehook("explode_top");
  $temp = $zdata{$what};
  $temp =~ /([\w\-\=\+\/]+)/;
@@ -1526,12 +1520,8 @@
 # This program can be written MUCH more simply, but ...
 # "security through obscurity"!  Don't want to violate USA
 # export restrictions ... otherwise we'd really encrypt things.
-#
-# Usage: &scramble($the_string,$phrase,$direction);
-#
-# $direction: encode with 0 then decode with 1 (or vice versa!)
-# $phrase: passphrase to recover the answer
-#
+# Based on a "children's spy decoder ring".  An easier way to do
+# this would be to translate numbers to letters :)  
 ####################################################################
 sub scramble {
   local($what,$salt,$direction) = @_;
@@ -1541,7 +1531,6 @@
   $what = &scramble_engine(reverse($what),$salt,$direction);
   return $what;
  }
-
 sub scramble_engine {
 local ($key,$mysalt,$backout) = @_;
 local ($part1)="abcdefghijklmnopqrstuvwxyz";
@@ -1558,40 +1547,28 @@
 $the_list = $the_code;
 $the_ref = reverse($the_code);
 $ml = length($the_code);
-
 $mysalt .= "*";
 for ($x1=1; $x1 < length($mysalt); $x1++) {
   $inx = index($the_ref,substr($mysalt,$x1,1));
   if ($inx >0) {
      $part1 = substr($mysalt,$x1,1) . substr($the_ref,0,$inx);
      $part2 = substr($the_ref,$inx+1,999);
-#print $x1," ",substr($mysalt,$x1,1)," ",$inx,"\n";
-#print $the_ref,"\n";
-#print $part1,$part2,"\n";
      $the_ref = reverse($part1 . $part2);
     }
  }
-
 for ($x1=1; $x1 < $scramble_variable ;$x1++) { 
   $part1 = substr($the_ref,0,10);
   $part2 = substr($the_ref,10,25);
   $part3 = substr($the_ref,35,(length($the_ref)-35));
   $the_ref = reverse($part2 . reverse($part1) . $part3);
  }
-
-#print "code=$the_code\n";
-#print " ref=$the_ref\n";
-
 $val=0;$val2=0;$val3=0;$val4=0;
-
 $key = reverse($key);
 while ($key ne "") {  
   $inx = chop($key);
   $last_char = $this_char;
   $this_char = $inx;
-#  print "inx = $inx ",ord($inx), "\n";
   if (index($the_code,$inx) >= 0) { # found in our set
-#$val=0;$val2=0;$val3=0;$val4=0;
     $val = index($the_code,$inx) + $val;
     $val3 = index($the_ref,$inx);
     $val2 = $val3 - $val4;
@@ -1602,7 +1579,6 @@
     while ($val >= length($the_ref)) {
       $val = $val - length($the_ref);
      }
- #   print "val,val2 = $val, $val2\n";
     $ans .= substr($the_code,$val2,1);
     $ans2 .= substr($the_ref,$val,1);
    } else {
@@ -1610,7 +1586,6 @@
     $ans2 .= $inx;
    } 
  }
-#print "ans = $ans    ans2 = $ans2 \n";
  if ($backout == "1") {
    return $ans2;
   } else {
@@ -1619,17 +1594,14 @@
 }
 #######################################################################
 sub output_modify_quantity_form {
-
 &standard_page_header("Change Quantity");
 &display_cart_table("changequantity");
 &modify_form_footer;
 }
 #######################################################################
 sub modify_quantity_of_items_in_cart {
-
-&checkReferrer;
-@incoming_data = keys (%form_data);
-
+&checkReferrer;  
+ @incoming_data = keys (%form_data);
 foreach $key (@incoming_data)
 {
 if (($key =~ /[\d]/) && ($form_data{$key} =~ /\D/) && 
@@ -1637,33 +1609,26 @@
 {
 $form_data{$key}="";
 }
-
 unless ($key =~ /[\D]/ && $form_data{$key} =~ /[\D]/)
 {
-	if ($form_data{$key} ne "")
-	{
-	push (@modify_items, $key);
-	}
+  if ($form_data{$key} ne "")
+  {
+  push (@modify_items, $key);
+  }
 }
-
 }
-
 open (CART, "<$sc_cart_path") || &file_open_error("$sc_cart_path", "Modify Quantity of Items in the Cart", __FILE__, __LINE__);
-
 while (<CART>)
 {
 @database_row = split (/\|/, $_);
+my $inventory_pid = $database_row[1];
 $cart_row_number = pop (@database_row);
 push (@database_row, $cart_row_number);
 $old_quantity = shift (@database_row);
 chop $cart_row_number;
- 
 foreach $item (@modify_items)
 {
-
-if ($item eq $cart_row_number)
-{
-
+if ($item eq $cart_row_number) {
 if ($form_data{$item} =~ /\-/) {
   $form_data{$item} =~ s/\-//g;
   $form_data{$item} = 0 - $form_data{$item};
@@ -1678,45 +1643,29 @@
   $shopper_row .= "\|"; 
  } else {
   $shopper_row .= "$form_data{$item}\|";
-
   foreach $field (@database_row)
   {
   $shopper_row .= "$field\|";
   }
  }
-
 $quantity_modified = "yes";
 &codehook("item_quantity_modified");
 chop $shopper_row; 
-
 }
-
-
 }
-
 if ($quantity_modified ne "yes")
 {
 $shopper_row .= $_;
 }
-
 $quantity_modified = "";
-
 }
-
 close (CART);
-
 open (CART, ">$sc_cart_path") || &file_open_error("$sc_cart_path", "Modify Quantity of Items in the Cart", __FILE__, __LINE__);
-
 print CART "$shopper_row";
-
 close (CART);
-
 &update_special_variable_options('calculate');
-
 &codehook("modify_quantity_of_items_in_cart_bot");
-
 &finish_modify_quantity_of_items_in_cart;
-
 }
 #######################################################################
 sub finish_modify_quantity_of_items_in_cart {
@@ -1725,74 +1674,54 @@
 }
 #######################################################################
 sub output_delete_item_form {
-
 &standard_page_header("Delete Item");
 &display_cart_table("delete");
 &delete_form_footer;
-
 }
 #######################################################################
 sub delete_from_cart {
-
-&checkReferrer;
-
+&checkReferrer; 
 @incoming_data = keys (%form_data);
 foreach $key (@incoming_data)
 {
-
 unless ($key =~ /[\D]/)
 {
 if ($form_data{$key} ne "")
 {
 push (@delete_items, $key);
 }
-
 }
-
 }
-
 open (CART, "<$sc_cart_path") || &file_open_error("$sc_cart_path", "Delete Item From Cart", __FILE__, __LINE__);
-
 while (<CART>)
 {
 @database_row = split (/\|/, $_);
+my $inventory_pid = $database_row[1];
 $cart_row_number = pop (@database_row);
 $db_id_number = pop (@database_row);
 push (@database_row, $db_id_number);
 push (@database_row, $cart_row_number);
 chop $cart_row_number;
 $old_quantity = shift (@database_row);
-
 $delete_item = "";
 foreach $item (@delete_items)
 {
-
 if ($item eq $cart_row_number)
 {
 $delete_item = "yes";
 &codehook("mark_item_for_delete");
 }
-
-# End of foreach $item (@add_items)
 }
-
 if ($delete_item ne "yes")
 {
 $shopper_row .= $_;
+} 
 }
-
-# End of while (<CART>)
-}
-
 close (CART);
-
 open (CART, ">$sc_cart_path") || &file_open_error("$sc_cart_path", "Delete Item From Cart", __FILE__, __LINE__);
-
 print CART "$shopper_row";
 close (CART);
-
 &finish_delete_from_cart;
-
 }
 #######################################################################
 sub finish_delete_from_cart {
@@ -1802,78 +1731,57 @@
 #######################################################################   
 sub display_cart_contents {
 local ($my_gt,$my_tq,$tmq,$tc,$st) = "";
-
 local (@cart_fields);
 local ($field, $cart_id_number, $quantity, $display_number,
 $unformatted_subtotal, $subtotal, $unformatted_grand_total,
-$grand_total);
-
-$sc_special_page_meta_tags = "\n";
-$sc_special_page_meta_tags .= '<META HTTP-EQUIV="Cache-Control"' . 
-                              ' Content="no-cache">';
-$sc_special_page_meta_tags .= "\n";
-$sc_special_page_meta_tags .= '<META HTTP-EQUIV="Pragma"' . 
-                              ' Content="no-cache">';
+$grand_total, $taxable_grand_total);
+$sc_special_page_meta_tags = '  <meta http-equiv="Cache-Control" Content="no-cache">';
 $sc_special_page_meta_tags .= "\n";
+$sc_special_page_meta_tags .= '  <meta http-equiv="Pragma" Content="no-cache">';
+&codehook("display_cart_contents_top");
 &standard_page_header("View/Modify Cart"); 
-   
-($my_gt,$my_tq,$tmq,$tc,$st) = &display_cart_table("");
-
+($taxable_grand_total, $my_gt,$my_tq,$tmq,$tc,$st) = &display_cart_table("");
+&codehook("display_cart_contents_bottom");
 &cart_footer((0+$my_gt),(0+$my_tq));
 &call_exit;
-
 }
 #######################################################################
 sub cart_table_header {
 local ($modify_type) = @_;
-
 &codehook("cart_table_header_top");
-
 if ($modify_type ne "") {
-  $modify_type = "<TH $cart_heading_def>" . 
-               "$cart_font_style\&nbsp\;$modify_type\&nbsp\;</FONT></TH>";
+  $modify_type = "<th>$modify_type</th>";
   &codehook("display_cart_heading_modify_item");
  }
-
 if (($sc_use_secure_header_at_checkout =~ /yes/i) && 
-	(($reason_to_display_cart =~ /orderform/i) || 
-	 ($reason_to_display_cart =~ /verify/i))) {
+  (($reason_to_display_cart =~ /orderform/i) || 
+   ($reason_to_display_cart =~ /verify/i))) {
   &SecureStoreHeader;
  } else {
   &StoreHeader;
  }
-
 $hidden_fields = &make_hidden_fields;
 &codehook("cart_table_header");
-
 if ($special_message ne "") {
   print $special_message;
  }
-
-print qq~
-
-<CENTER>
-<FORM METHOD="POST" ACTION="$sc_main_script_url">
+print qq~<form method="post" action="$sc_main_script_url">
 $hidden_fields
-
-<TABLE $cart_table_def>
-<TR>
-$cart_font_style
+<div align="center">
+<table class="ac_cart_table">
+<tr>
 $modify_type
 ~;
-
 foreach $field (@sc_cart_display_fields)
 {
-$cart_heading_item = 
-"<TH $cart_heading_def>$cart_font_style&nbsp;$field&nbsp;</FONT></TH>\n";
+$cart_heading_item = "<th>$field</th>\n";
+
 &codehook("display_cart_heading_item");
 print $cart_heading_item;
 }
-
 }
 #######################################################################
 sub display_cart_table {
-
 local($reason_to_display_cart) = @_;
 local(@cart_fields);
 local($cart_id_number,$cart_line_id,$field_name);
@@ -1895,220 +1803,162 @@
 local($hidden_field_value);
 local($display_counter);
 local($product_id, @db_row);
-
+# taxable or non-table. added by Mister Ed Sept 13, 2005
+my($isTaxable);
+local($unformatted_taxable_grand_total);
+local($taxable_grand_total);
 &codehook("display_cart_top");
-
 if ($reason_to_display_cart =~ /change*quantity/i) 
 {
 &cart_table_header("New Quantity");
 } 
-
 elsif ($reason_to_display_cart =~ /delete/i) 
 {
 &cart_table_header("Delete Item");
 } 
-
 else 
 {
 &cart_table_header("");
 }
-
 if (!(-f "$sc_cart_path")) { 
   open (CART, ">$sc_cart_path") ||
        &file_open_error("$sc_cart_path", 
-			"display_cart_contents create null file", 
-			__FILE__, __LINE__);
+      "display_cart_contents create null file", 
+      __FILE__, __LINE__);
   close(CART);
  }
 open (CART, "$sc_cart_path") ||
 &file_open_error("$sc_cart_path", "display_cart_contents", __FILE__, __LINE__);
-
 while (<CART>)
 {
-
-print "<TR>";	
-
+print "</tr><tr>";
 chop;    
-
 $temp = $_;
 @cart_fields = split (/\|/, $temp);
 $cart_row_number = pop(@cart_fields);
 push (@cart_fields, $cart_row_number);
 $cart_copy{$cart_row_number} = $temp;
 &codehook("display_cart_row_read");
-
-$quantity 	= $cart_fields[$cart{"quantity"}];
-$product_id 	= $cart_fields[$cart{"product_id"}];
-
-#if (($reason_to_display_cart =~ /orderform/i) && ($sc_order_check_db =~ /yes/i)) 
-
+$quantity   = $cart_fields[$cart{"quantity"}];
+$product_id   = $cart_fields[$cart{"product_id"}];
+# taxable or non-table. added by Mister Ed Sept 13, 2005
+$isTaxable = $cart_fields[$cart{"user4"}];
 if (!($sc_db_lib_was_loaded =~ /yes/i)) {
   &require_supporting_libraries (__FILE__, __LINE__, "$sc_db_lib_path");
  }
-
 undef(@db_row);
 $found_it = &check_db_with_product_id($product_id,*db_row); 
 &codehook("display_cart_db_row_read");
-
 $item_agorascript = "";
-
 foreach $zzzitem (@db_row) {
   $field = $zzzitem;
   if ($field =~ /^%%OPTION%%/i) {
     ($empty, $option_tag, $option_location) = split (/%%/, $field);
-
     $field = &load_opt_file($option_location);
-
     $item_agorascript .= $field;
-
    }
  }
 &codehook("display_cart_item_agorascript");
 $zzfield = &agorascript($item_agorascript,"display-cart",
-		"$product_id",__FILE__,__LINE__);
- 
-#  if (($reason_to_display_cart =~ /process.*order/i)...
+    "$product_id",__FILE__,__LINE__);
 if (($reason_to_display_cart =~ /orderform/i) 
    && ($sc_order_check_db =~ /yes/i)) {
 if (!($found_it)) 
  {
-
 print qq~
-</TR>
-</TABLE>
-
-<DIV ALIGN=CENTER>
-<TABLE WIDTH=400>
-<TR>
-<TD>
-&nbsp;
-</TD>
-</TR>
-<TR>
-<TD>
-<P>
-<FONT FACE=ARIAL>
-I'm sorry, Product ID: $product_id was not found in 
-the database. Your order cannot be processed without 
-this validation. Please contact the 
-<a href=mailto:$sc_admin_email>site administrator</a>.
-</FONT>
-</TD>
-</TR>
-</TABLE>
-</DIV>
-
-</BODY>
-</HTML>~;
+</tr>
+</table>
+<div align="center">
+<p class="ac_error">
+  I'm sorry, Product ID: $product_id was not found in 
+  the database. Your order cannot be processed without 
+  this product validation. Please contact the 
+  <a href=mailto:$sc_admin_email>site administrator</a>.
+</p>
+</div>
+</body>
+</html>~;
 &call_exit;
-
  } 
-
 else 
-
  {
-
-#	if ($db_row[$sc_db_index_of_price] ne $cart_fields[$sc_cart_index_of_price]) 
-	$test_price =  &vf_get_data("PRODUCT",
-		$sc_db_price_field_name,
-		$db_row[$sc_db_index_of_product_id],
-		@db_row);
-	if ($test_price ne $cart_fields[$sc_cart_index_of_price]) 
-	{
-	print qq~
-	</TR>
-	</TABLE>
-	<DIV ALIGN=CENTER>
-	<TABLE WIDTH=500>
-	<TR>
-	<TD>
-	<P>
-	<FONT FACE=ARIAL>
-	Price for product id:$product_id did not match
-	database! Your order will NOT be processed without 
-	this validation!
-	</TD>
-	</TR>
-	</TABLE>
-	</DIV>
-	</BODY>
-	</HTML>~; 
-	&call_exit;
-	}
+  $test_price =  &vf_get_data("PRODUCT",
+    $sc_db_price_field_name,
+    $db_row[$sc_db_index_of_product_id],
+    @db_row);
+  if ($test_price ne $cart_fields[$sc_cart_index_of_price]) 
+  {
+  print qq~
+</tr>
+</table>
+<div align="center">
+<p class="ac_error">
+  Price for product id:$product_id did not match
+  database! Your order will NOT be processed without 
+  this validation!
+</p>
+</div>
+</body>
+</html>~; 
+  &call_exit;
+  }
  }
-
 }
-
 $total_quantity += $quantity;
-
 if ($reason_to_display_cart =~ /change*quantity/i) 
 {
 print qq!
-<TD $cart_item_def>
-<INPUT TYPE = "text" NAME = "$cart_row_number" SIZE ="3">
-</TD>!;
+<td>
+  <input type="text" name="$cart_row_number" size="3">
+</td>\n!;
 } 
-
 elsif ($reason_to_display_cart =~ /delete/i) 
 {
-print qq!
-<TD $cart_item_def>
-<INPUT TYPE = "checkbox" NAME = "$cart_row_number">!;
+print qq!<td>
+  <input type="checkbox" name="$cart_row_number">
+</td>\n!;
 }
-
 $display_counter = 0;
 $text_of_cart .= "\n\n";
-
 foreach $field_name (@sc_col_name)
 { 
-
  $display_index = $cart{$field_name};
  $cart_line_id = $cart_fields[$cart{'unique_cart_line_id'}];
-
 if ($display_index >= 0) {
  if ($cart_fields[$display_index] eq "")
  {
-
   $text_of_cart .= &format_text_field(
   $sc_cart_display_fields[$display_counter]) .
   "= nothing entered\n";
   $cart_fields[$display_index] = "&nbsp;";
  }       
-
  $display_me = &vf_get_data("CART",$field_name,$cart_line_id,@cart_fields);
  if ($sc_cart_display_factor[$display_counter] =~ /yes/i) {
    $display_me = $display_me * $quantity;
   }
-
  }
-
 $sc_display_special_request = 0;
 $zzfield = &agorascript($item_agorascript,"display-cart-" . $display_index,
-		"$product_id",__FILE__,__LINE__);
+    "$product_id",__FILE__,__LINE__);
 &codehook("cart_table_special_request_decision");
 if (!($sc_display_special_request == 0)) {
   &codehook("cart_table_special_request");
  }
-#elsif ($display_index == 0) {}
 elsif ($field_name eq "quantity") {
   if (($reason_to_display_cart ne "") || 
-#  if (($reason_to_display_cart =~ /change*quantity/i) || 
-#      ($reason_to_display_cart =~ /delete/i) ||
      (!($sc_qty_box_on_cart_display =~ /yes/i))) {
-    print qq!<TD $cart_item_def>$cart_font_style$display_me</FONT></TD>\n!;
+    print qq!<td>$display_me</td>\n!;
    } else {
     print qq!
-<TD $cart_item_def>
-<INPUT TYPE = "text" NAME = "$cart_row_number" VALUE = "$display_me"
-SIZE ="3">
-</TD>!;
+<td>
+  <input type="text" name="$cart_row_number" value="$display_me" size="3">
+</td>\n!;
    } 
  }
-
 elsif ($display_index == $sc_cart_index_of_price)
 {
 $price = &display_price($display_me); 
-print qq!<TD $cart_item_def>$cart_font_style$price</FONT></TD>\n!;
+print qq!<td>$price</td>\n!;
 $text_of_cart .= &format_text_field(
 $sc_cart_display_fields[$display_counter]) .
 "= $price\n";
@@ -2116,16 +1966,13 @@
 
 elsif ($display_index == $sc_cart_index_of_price_after_options)
 {
-#$lineTotal = &format_price(($quantity*$cart_fields[$display_index])+
-# ($cart_fields[0]*$cart_fields[6]));
 $lineTotal = &format_price($display_me);
 $lineTotal = &display_price($lineTotal);
-print qq!<TD $cart_item_def>$cart_font_style$lineTotal</FONT></TD>\n!;
+print qq!<td>$lineTotal</td>\n!;
 $text_of_cart .= &format_text_field(
 $sc_cart_display_fields[$display_counter]) .
 "= $lineTotal\n";
 }
-
 elsif ($display_index < 0) 
 {
 $display_me = $db_row[(0-$display_index)];
@@ -2135,8 +1982,8 @@
 if ($display_me =~ /^%%img%%/i)
 {
 ($empty, $image_tag, $image_location) = split (/%%/, $display_me);
-$display_me = '<IMG SRC="' . "$URL_of_images_directory/$image_location" . 
-              '" BORDER=0>';
+$display_me = '<img src="'."$URL_of_images_directory/$image_location" . 
+  '" alt="' . "$image_location" . '"/>';
 }
  if($display_index == "-6") {
    if ($sc_use_SBW =~ /yes/i) {
@@ -2146,121 +1993,99 @@
     }
  }
 $display_me =~ s/%%URLofImages%%/$URL_of_images_directory/g;
-print qq!<TD $cart_item_def>$cart_font_style$display_me</FONT></TD>\n!;
+print qq!<td>$display_me</td>\n!;
 }
-
 elsif ($display_index == $sc_cart_index_of_image)
 {
 $display_me = $cart_fields[$display_index];
 $display_me =~ s/%%URLofImages%%/$URL_of_images_directory/g;
-print qq!<TD $cart_item_def>$cart_font_style$display_me</FONT></TD>\n!;
+print qq!<td>$display_me</td>\n!;
 }
-
 elsif ($display_index == $sc_cart_index_of_measured_value)
 {
 if ($sc_use_SBW =~ /yes/i) { #display total pounds
   $shipping_price = $display_me; 
  } else { # display total price
-
-if ($sc_use_SBW2 =~ /yes/i) {
-  $shipping_price = $display_me;
- } else {
   $shipping_price = &display_price($display_me); 
-   }
  }
-print qq!
-<TD $cart_item_def>$cart_font_style$shipping_price</FONT></TD>\n
-!;
+print qq!<td>$shipping_price</td>\n!;
 $text_of_cart .= &format_text_field($sc_cart_display_fields[$display_counter]) .
 "= $price\n
 ";
 }
-
 else
 {
-print qq!<TD $cart_item_def>$cart_font_style$display_me</FONT></TD>\n!;
-
-	if ($display_index != 5)
-	{
-	$text_of_cart .= &format_text_field(
-	$sc_cart_display_fields[$display_counter]) .
-	"= $cart_fields[$display_index]\n";
-	}
-
+print qq!<td>$display_me</td>\n!;
+  if ($display_index != 5)
+  {
+  $text_of_cart .= &format_text_field(
+  $sc_cart_display_fields[$display_counter]) .
+  "= $cart_fields[$display_index]\n";
+  }
 }
-
 $display_counter++;
-
 }
-
-$total_measured_quantity += ($quantity*$cart_fields[6]);  
+$total_measured_quantity = $total_measured_quantity + $quantity*$cart_fields[6];  
 $shipping_total = $total_measured_quantity;
-$stevo_shipping_thing .= '|' . $quantity . '*' . $cart_fields[6] 
-	. '*' . $cart_fields[$sc_cart_index_of_price_after_options];
-
+# alt origin postal code adds postal code to stevo for shipping by Mister Ed Feb 9, 2005
+if ($sc_alt_origin_enabled =~ /yes/i) {
+        $stevo_shipping_thing .= '|' . $quantity . '*' . $cart_fields[6] 
+        . '*' . $cart_fields[$sc_cart_index_of_price_after_options] . '*' . $cart_fields[11];
+} else {
+        $stevo_shipping_thing .= '|' . $quantity . '*' . $cart_fields[6] 
+        . '*' . $cart_fields[$sc_cart_index_of_price_after_options];
+}
 $unformatted_subtotal = ($cart_fields[$sc_cart_index_of_price_after_options]);
 $subtotal = &format_price($quantity*$unformatted_subtotal);
 $unformatted_grand_total = $grand_total + $subtotal;
 $grand_total = &format_price($unformatted_grand_total);
-                
+# taxable or non-table. added by Mister Ed Sept 13, 2005
+if ($isTaxable !~ /yes/i) {
+    $unformatted_taxable_grand_total = $taxable_grand_total + $subtotal;
+    $taxable_grand_total = &format_price($unformatted_taxable_grand_total);
+}
 $price = &display_price($subtotal);
-
 $text_of_cart .= &format_text_field("Quantity") .
 "= $quantity\n";
-
 $text_of_cart .= &format_text_field("Subtotal For Item") .
 "= $price\n";
-
 }
-
 close (CART);
 $sc_shipping_thing = $shipping_total . $stevo_shipping_thing;
-
 $sc_cart_copy_made = "yes";
-
 $price = &display_price($grand_total);
-
 $shipping_total = &display_price($shipping_total);
-
-if ($reason_to_display_cart =~ /verify/i) 
-{
-print <<ENDOFTEXT;
-<INPUT TYPE=HIDDEN NAME=TOTAL VALUE=$grand_total>
-
-ENDOFTEXT
+if ($reason_to_display_cart =~ /verify/i) {
+print qq!<input type="hidden" name="total" value="$grand_total">!;
 }
-
 &cart_table_footer($price);
-
-if ($reason_to_display_cart =~ /verify/i)
-{
-&display_calculations($grand_total,"at",
+if ($reason_to_display_cart =~ /verify/i) {
+&display_calculations($taxable_grand_total,$grand_total,"at",
 $total_measured_quantity,$text_of_cart,$stevo_shipping_thing);
-}
-else
-{
-#&display_calculations($grand_total,"change/delete",
-&display_calculations($grand_total,"before",
+} else {
+&display_calculations($taxable_grand_total,$grand_total,"before",
 $total_measured_quantity,$text_of_cart,$stevo_shipping_thing);
 }
-
 $text_of_cart .= "\n\n" . &format_text_field("Subtotal:") .
 "= $price\n\n";
-
-return($grand_total, $total_quantity, $total_measured_quantity,
+return($taxable_grand_total, $grand_total, $total_quantity, $total_measured_quantity,
 $text_of_cart, $stevo_shipping_thing);
-
 }
 #######################################################################
+# empty cart footer message added.  Closing table cells added to closing
+# table tag as well by Mister Ed (K-Factor Technologies, Inc) 10/17/2003
 sub cart_table_footer {
 local($price, $shipping_total) = @_;
 local($footer);
-$footer = qq~
-</TABLE>
+if ($price = $0.00) {
+print $sc_empty_cart_footer_msg;
+}
+$footer = qq~</tr>
+</table>
+</div>
 ~;
 &codehook("cart_table_footer");
 print $footer;
-
 }
 #######################################################################
 sub generate_invoice_number {
@@ -2273,24 +2098,28 @@
  }
 #######################################################################
 sub init_shop_keep_email {
+ # put whatever at the top of the var '$email'
  local ($email)='';
  &codehook("init_shop_keep_email");
  return $email;
 }
 #######################################################################
 sub addto_shop_keep_email {
-local ($email)='';
+ # put whatever at the end of the var '$email'
+ local ($email)='';
  &codehook("addto_shop_keep_email");
  return $email;
 }
 #######################################################################
 sub init_customer_email {
+ # put whatever at the top of the var '$email'
  local ($email)='';
  &codehook("init_customer_email");
  return $email;
 }
 #######################################################################
 sub addto_customer_email {
+ # put whatever at the end of the var '$email'
  local ($email)='';
  &codehook("addto_customer_email");
  return $email;
diff -ruN 4.0K-4b/library/cgi-lib.pl 5.0.000/library/cgi-lib.pl
--- 4.0K-4b/library/cgi-lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/cgi-lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,9 +1,10 @@
 #*********************************************************************
 # MODIFIED FOR AGORA.CGI -- an open source, FREE shopping cart 
-# http://www.agoracgi.com  4/30/2000 SPK
+# http://www.agoracart.com  4/30/2000 SPK
 # Fixes a problem with MSIE 5.01
 # Also calls the sub &call_exit to perform cleanups
 #*********************************************************************
+
 # Perl Routines to Manipulate CGI input
 # cgi-lib@pobox.com
 # $Id: cgi-lib.pl,v 2.18 1999/02/23 08:16:43 brenner Exp $
@@ -13,37 +14,67 @@
 # Permission granted to use and modify this library so long as the
 # copyright above is maintained, modifications are documented, and
 # credit is given for any use of the library.
+#
+# Thanks are due to many people for reporting bugs and suggestions
 
 # For more information, see:
 #     http://cgi-lib.stanford.edu/cgi-lib/
 
 $cgi_lib'version = sprintf("%d.%02d", q$Revision: 2.18 $ =~ /(\d+)\.(\d+)/);
-$versions{'cgi-lib'}= "$cgi_lib'version with Agora MSIE Patch";
+$versions{'cgi-lib'}= "5.0.000";
 
-$cgi_lib'maxdata    = 131072;    
-$cgi_lib'writefiles =      0;   
-                                 
-$cgi_lib'filepre    = "cgi-lib"; 
-
-$cgi_lib'bufsize  =  8192;    
-$cgi_lib'maxbound =   100;    
-$cgi_lib'headerout =    0;    
+# Parameters affecting cgi-lib behavior
+# User-configurable parameters affecting file upload.
+$cgi_lib'maxdata    = 131072;    # maximum bytes to accept via POST - 2^17
+$cgi_lib'writefiles =      0;    # directory to which to write files, or
+                                 # 0 if files should not be written
+$cgi_lib'filepre    = "cgi-lib"; # Prefix of file names, in directory above
+
+# Do not change the following parameters unless you have special reasons
+$cgi_lib'bufsize  =  8192;    # default buffer size when reading multipart
+$cgi_lib'maxbound =   100;    # maximum boundary length to be encounterd
+$cgi_lib'headerout =    0;    # indicates whether the header has been printed
+
+
+# ReadParse
+# Reads in GET or POST data, converts it to unescaped text, and puts
+# key/value pairs in %in, using "\0" to separate multiple selections
+
+# Returns >0 if there was input, 0 if there was no input 
+# undef indicates some failure.
+
+# Now that cgi scripts can be put in the normal file space, it is useful
+# to combine both the form and the script in one place.  If no parameters
+# are given (i.e., ReadParse returns FALSE), then a form could be output.
+
+# If a reference to a hash is given, then the data will be stored in that
+# hash, but the data from $in and @in will become inaccessable.
+# If a variable-glob (e.g., *cgi_input) is the first parameter to ReadParse,
+# information is stored there, rather than in $in, @in, and %in.
+# Second, third, and fourth parameters fill associative arrays analagous to
+# %in with data relevant to file uploads. 
+
+# If no method is given, the script will process both command-line arguments
+# of the form: name=value and any text that is in $ENV{'QUERY_STRING'}
+# This is intended to aid debugging and may be changed in future releases
 
 sub ReadParse {
+  # Disable warnings as this code deliberately uses local and environment
+  # variables which are preset to undef (i.e., not explicitly initialized)
   local ($perlwarn);
   $perlwarn = $^W;
   $^W = 0;
 
-  local (*in) = shift if @_;    
-  local (*incfn,                
-         *inct,                 
-         *insfn) = @_;          
+  local (*in) = shift if @_;    # CGI input
+  local (*incfn,                # Client's filename (may not be provided)
+         *inct,                 # Client's content-type (may not be provided)
+         *insfn) = @_;          # Server's filename (for spooled files)
 
 # SPK added $first_type and $junk below:
   local ($len, $type, $first_type, $meth, $errflag, $cmdflag, $got, $name, $junk);
         
-  binmode(STDIN);   
-  binmode(STDOUT);  
+  binmode(STDIN);   # we need these for DOS-based systems
+  binmode(STDOUT);  # and they shouldn't hurt anything else 
   binmode(STDERR);
         
   # Get several useful env variables
@@ -77,23 +108,26 @@
     }
 
     @in = split(/[&;]/,$in); 
-    push(@in, @ARGV) if $cmdflag; 
+    push(@in, @ARGV) if $cmdflag; # add command-line parameters
 
     foreach $i (0 .. $#in) {
+      # Convert plus to space
       $in[$i] =~ s/\+/ /g;
 
       # Split into key and value.  
-      ($key, $val) = split(/=/,$in[$i],2); 
+      ($key, $val) = split(/=/,$in[$i],2); # splits on the first =.
 
+      # Convert %XX from hex numbers to alphanumeric
       $key =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge;
       $val =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge;
 
-      $in{$key} .= "\0" if (defined($in{$key})); 
+      # Associate key and value
+      $in{$key} .= "\0" if (defined($in{$key})); # \0 is the multiple separator
       $in{$key} .= $val;
     }
 
   } elsif ($ENV{'CONTENT_TYPE'} =~ m#^multipart/form-data#) {
-
+    # for efficiency, compile multipart code only if needed
 $errflag = !(eval <<'END_MULTIPART');
 
     local ($buf, $boundary, $head, @heads, $cd, $ct, $fname, $ctype, $blen);
@@ -101,6 +135,8 @@
     local ($bufsize, $maxbound, $writefiles) = 
       ($cgi_lib'bufsize, $cgi_lib'maxbound, $cgi_lib'writefiles);
 
+
+    # The following lines exist solely to eliminate spurious warning messages
     $buf = ''; 
 
     ($boundary) = $type =~ /boundary="([^"]+)"/; #";   # find boundary
@@ -122,8 +158,25 @@
       $writefiles .= "/$cgi_lib'filepre"; 
     }
 
+    # read in the data and split into parts:
+    # put headers in @in and data in %in
+    # General algorithm:
+    #   There are two dividers: the border and the '\r\n\r\n' between
+    # header and body.  Iterate between searching for these
+    #   Retain a buffer of size(bufsize+maxbound); the latter part is
+    # to ensure that dividers don't get lost by wrapping between two bufs
+    #   Look for a divider in the current batch.  If not found, then
+    # save all of bufsize, move the maxbound extra buffer to the front of
+    # the buffer, and read in a new bufsize bytes.  If a divider is found,
+    # save everything up to the divider.  Then empty the buffer of everything
+    # up to the end of the divider.  Refill buffer to bufsize+maxbound
+    #   Note slightly odd organization.  Code before BODY: really goes with
+    # code following HEAD:, but is put first to 'pre-fill' buffers.  BODY:
+    # is placed before HEAD: because we first need to discard any 'preface,'
+    # which would be analagous to a body without a preceeding head.
+
     $left = $len;
-   PART: 
+   PART: # find each part of the multi-part while reading data
     while (1) {
       die $@ if $errflag;
 
@@ -233,11 +286,13 @@
       }
       &CgiDie($errmsg);
     } else {
+      # everything's ok.
     }
   } else {
     &CgiDie("cgi-lib.pl: Unknown Content-type: $ENV{'CONTENT_TYPE'}\n");
   }
 
+  # no-ops to avoid warnings
   $insfn = $insfn;
   $incfn = $incfn;
   $inct  = $inct;
@@ -247,11 +302,19 @@
   return ($errflag ? undef :  scalar(@in)); 
 }
 
+
+# PrintHeader
+# Returns the magic line which tells WWW that we're an HTML document
+
 sub PrintHeader {
   return "Content-type: text/html\n\n";
 }
 
 
+# HtmlTop
+# Returns the <head> of a document and the beginning of the body
+# with the title and a body <h1> header as specified by the parameter
+
 sub HtmlTop
 {
   local ($title) = @_;
@@ -267,11 +330,18 @@
 }
 
 
+# HtmlBot
+# Returns the </body>, </html> codes for the bottom of every HTML page
+
 sub HtmlBot
 {
   return "</body>\n</html>\n";
 }
 
+
+# SplitParam
+# Splits a multi-valued parameter into a list of the constituent parameters
+
 sub SplitParam
 {
   local ($param) = @_;
@@ -280,15 +350,24 @@
 }
 
 
+# MethGet
+# Return true if this cgi call was using the GET request, false otherwise
+
 sub MethGet {
   return (defined $ENV{'REQUEST_METHOD'} && $ENV{'REQUEST_METHOD'} eq "GET");
 }
 
 
+# MethPost
+# Return true if this cgi call was using the POST request, false otherwise
+
 sub MethPost {
   return (defined $ENV{'REQUEST_METHOD'} && $ENV{'REQUEST_METHOD'} eq "POST");
 }
 
+
+# MyBaseUrl
+# Returns the base URL to the script (i.e., no extra path or query string)
 sub MyBaseUrl {
   local ($ret, $perlwarn);
   $perlwarn = $^W; $^W = 0;
@@ -299,6 +378,9 @@
   return $ret;
 }
 
+
+# MyFullUrl
+# Returns the full URL to the script (i.e., with extra path or query string)
 sub MyFullUrl {
   local ($ret, $perlwarn);
   $perlwarn = $^W; $^W = 0;
@@ -310,10 +392,23 @@
   return $ret;
 }
 
+
+# MyURL
+# Returns the base URL to the script (i.e., no extra path or query string)
+# This is obsolete and will be removed in later versions
 sub MyURL  {
   return &MyBaseUrl;
 }
 
+
+# CgiError
+# Prints out an error message which which containes appropriate headers,
+# markup, etcetera.
+# Parameters:
+#  If no parameters, gives a generic error message
+#  Otherwise, the first parameter will be the title and the rest will 
+#  be given as different paragraphs of the body
+
 sub CgiError {
   local (@msg) = @_;
   local ($i,$name);
@@ -335,6 +430,11 @@
   $cgi_lib'headerout++;
 }
 
+
+# CgiDie
+# Identical to CgiError, but also quits with the passed error message.
+# changed for AGORA ... uses &call_exit routine
+
 sub CgiDie {
   local (@msg) = @_;
   &CgiError (@msg);
@@ -347,6 +447,13 @@
 }
 
 
+# PrintVariables
+# Nicely formats variables.  Three calling options:
+# A non-null associative array - prints the items in that array
+# A type-glob - prints the items in the associated assoc array
+# nothing - defaults to use %in
+# Typical use: &PrintVariables()
+
 sub PrintVariables {
   local (*in) = @_ if @_ == 1;
   local (%in) = @_ if @_ > 1;
@@ -364,15 +471,19 @@
   return $output;
 }
 
+# PrintEnv
+# Nicely formats all environment variables and returns HTML string
 sub PrintEnv {
   &PrintVariables(*ENV);
 }
 
 
+# The following lines exist only to avoid warning messages
 $cgi_lib'writefiles =  $cgi_lib'writefiles;
 $cgi_lib'bufsize    =  $cgi_lib'bufsize ;
 $cgi_lib'maxbound   =  $cgi_lib'maxbound;
 $cgi_lib'version    =  $cgi_lib'version;
 $cgi_lib'filepre    =  $cgi_lib'filepre;
 
-1; 
+1; #return true 
+
diff -ruN 4.0K-4b/library/cookie-lib.pl 5.0.000/library/cookie-lib.pl
--- 4.0K-4b/library/cookie-lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/cookie-lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,7 +1,7 @@
 # Perl Routines to Manipulate Web Browser Cookies
 # kovacsp@egr.uri.edu
 # $Id: cookie-lib.txt,v 0.913 1998/11/20 19:45:36 kovacsp Exp $
-$versions{'cookie-lib.pl'} = "19981120";
+$versions{'cookie-lib.pl'} = "5.0.000";
 #
 # Copyright (c) 1998 Peter D. Kovacs  
 # Unpublished work.
@@ -19,12 +19,16 @@
 
 # For more information on cookies, go to:
 # http://search.netscape.com/newsref/std/cookie_spec.html
+#
+# Modified for agora.cgi to optionally use meta tags to set cookies
+# and return only the first cart_id cookie found, all sorts of other
+# stuff too!
+# SPK -- Feb 8, 2002
+# Updated/Modified by Mister Ed Nov 2003, Aug 2005
 
-sub get_cookie {
+sub get_all_cookie_info {
   local($chip, $val);
   foreach (split(/; /, $ENV{'HTTP_COOKIE'})) {
-    	# split cookie at each ; (cookie format is name=value; name=value; etc...)
-    	# Convert plus to space (in case of encoding (not necessary, but recommended)
     s/\+/ /g;
     	# Split into key and value.  
     ($chip, $val) = split(/=/,$_,2); # splits on the first =.
@@ -32,61 +36,94 @@
     $chip =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge;
     $val =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge;
     	# Associate key and value
-    $cookie{$chip} .= "\1" if (defined($cookie{$chip})); # \1 is the multiple separator
+    $cookie{$chip} .= "\1" if (defined($cookie{$chip})); 
     $cookie{$chip} .= $val;
   }
 }
 
-sub set_cookie {
-  # $expires must be in unix time format, if defined.  If not defined it sets the expiration to December 31, 1999.
-  # If you want no expiration date set, set $expires = -1 (this causes the cookie to be deleted when user closes
-  # his/her browser).
+sub get_cookie {
+  local($chip, $val);
+  foreach (split(/; /, $ENV{'HTTP_COOKIE'})) {
+    s/\+/ /g;
+    ($chip, $val) = split(/=/,$_,2); # splits on the first =.
+    $chip =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge;
+    $val =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge;
+    $cookie{$chip} .= "\1" if (defined($cookie{$chip})); 
+    $cookie{$chip} .= $val;
+  }
+}
 
+sub set_cookie { 
+  &set_agora_cookies;
+  print $sc_cookie_information;
+  $sc_cookie_information='';
+ }
+
+sub set_agora_cookies {
+  local($my_cookie);
   local($expires,$domain,$path,$sec) = @_;
     local(@days) = ("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
     local(@months) = ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
-  local($seconds,$min,$hour,$mday,$mon,$year,$wday) = gmtime($expires) if ($expires > 0); #get date info if expiration set.
+  local($seconds,$min,$hour,$mday,$mon,$year,$wday) = gmtime($expires) if ($expires > 0); 
   $seconds = "0" . $seconds if $seconds < 10; # formatting of date variables
   $min = "0" . $min if $min < 10; 
   $hour = "0" . $hour if $hour < 10; 
-  local(@secure) = ("","secure"); # add security to the cookie if defined.  I'm not too sure how this works.
-  if (! defined $expires) { $expires = " expires\=Fri, 31-Dec-1999 00:00:00 GMT;"; } # if expiration not set, expire at 12/31/1999
-  elsif ($expires == -1) { $expires = "" } # if expiration set to -1, then eliminate expiration of cookie.
+  local(@secure) = ("","secure"); 
+  if (! defined $expires) { $expires = " expires\=Fri, 31-Dec-1999 00:00:00 GMT;"; } 
+  elsif ($sc_cookie_days == -1) { $expires = "" } 
   else { 
     $year += 1900; 
-    $expires = "expires\=$days[$wday], $mday-$months[$mon]-$year $hour:$min:$seconds GMT; "; #form expiration from value passed to function.
+    $expires = "expires\=$days[$wday], $mday-$months[$mon]-$year $hour:$min:$seconds GMT; "; 
   }
-  if (! defined $domain) { $domain = $ENV{'SERVER_NAME'}; } #set domain of cookie.  Default is current host.
-  if (! defined $path) { $path = "/"; } #set default path = "/"
+  if (! defined $domain) { $domain = $ENV{'SERVER_NAME'}; } 
+  if (! defined $path) { $path = "/"; } 
   if (! defined $secure) { $secure = "0"; }
   local($key);
   foreach $key (keys %cookie) {
-    $cookie{$key} =~ s/ /+/g; #convert plus to space.
-    print "Set-Cookie: $key\=$cookie{$key}; $expires path\=$path; domain\=$domain; $secure[$sec]\n";
-	 			#print cookie to browser,
-				#this must be done *before*	you print any content type headers.
+    $cookie{$key} =~ s/ /+/g; 
+    $my_cookie =  "$key\=$cookie{$key}; $expires path\=$path; ";
+    $my_cookie .= "domain\=$domain; $secure[$sec]";
+    if (!($sc_use_pre_content_cookies =~ /no/i)) {
+      $sc_cookie_information .= "Set-Cookie: $my_cookie\n";
+    }
+    if ($sc_use_meta_cookies =~ /yes/i) {
+      $sc_special_page_meta_tags .= '<META HTTP-EQUIV="Set-Cookie"' . 
+                              " Content=\"$my_cookie\">\n";
+    }
   }
 }
 
 sub delete_cookie {
-  # to delete a cookie, simply pass delete_cookie the name of the cookie to delete.
-  # you may pass delete_cookie more than 1 name at a time.
   local(@to_delete) = @_;
-  local($name);
+  local($name,$my_cookie);
   foreach $name (@to_delete) {
-   undef $cookie{$name}; #undefines cookie so if you call set_cookie, it doesn't reset the cookie.
-   print "Set-Cookie: $name=deleted; expires=Thu, 01-Jan-1970 00:00:00 GMT;\n";
-   			#this also must be done before you print any content type headers.
+   undef $cookie{$name}; 
+   $my_cookie = "$name=deleted; expires=Thu, 01-Jan-1970 00:00:00 GMT;";
+   print "Set-Cookie: $my_cookie\n";
+   if ($sc_use_meta_cookies =~ /yes/i) {
+     $sc_special_page_meta_tags .= '<META HTTP-EQUIV="Set-Cookie"' . 
+                             " Content=\"$my_cookie\">\n";
+    }
   }
 }
 
 sub split_cookie {
-# split_cookie
-# Splits a multi-valued parameter into a list of the constituent parameters
-
   local ($param) = @_;
   local (@params) = split ("\1", $param);
   return (wantarray ? @params : $params[0]);
 }
+##########################################################################
+{ 
+  local($inx);
+  local($agent) = $ENV{'HTTP_USER_AGENT'};
+  if ($agent eq '') {$agent='unknown'};
+  $agent = substr($agent,0,63);
+  $agent =~ tr/A-Z/a-z/;
+  $user_agent_dotval = 0;
+  for ($inx=0; $inx < length($agent); $inx++) {
+    $user_agent_dotval=$user_agent_dotval+$inx+ord(substr($agent,$inx,1));
+   }
+  $user_agent_dotval = 'a' . $user_agent_dotval;
+}
 
 1;
diff -ruN 4.0K-4b/library/credit_card_validation_lib.pl 5.0.000/library/credit_card_validation_lib.pl
--- 4.0K-4b/library/credit_card_validation_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/credit_card_validation_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -3,7 +3,9 @@
 #
 # Date Created: 12-02-96
 # Date Last Modified: 02-07-2000 SPK
-$versions{'credit_card_validation_lib.pl'} = "20000207";
+
+$versions{'credit_card_validation_lib.pl'} = "5.0.000";
+
 #
 # Author: Doug Miles
 # E-mail: dmiles@primenet.com
@@ -27,14 +29,107 @@
 #   Also, thanks to Selena Sol and Gunther Birznieks, whose generosity inspired
 #   me to spend just a little bit more time on this library to make it usable
 #   and understandable for everyone.
+#
+# Purpose: This library contains routines to validate submitted credit card
+#          information.
+#
+# Main Procedures:
+#   validate_credit_card_information - This routine validates submitted credit
+#                                      card information.
+#
+#   validate_credit_card_name - This routine validates that the name of the
+#                               credit card is one that can be processed by this
+#                               library.  (VISA, MASTERCARD, AMERICAN EXPRESS,
+#                               DISCOVER)
+#
+#   validate_credit_card_number - This routine validates that the credit card
+#                                 number is valid.
+#
+#   validate_credit_card_expiration_date - This routine verifies that the credit
+#                                          card has not expired.
 #   (Modified by Steve Kneizys for format MM/DD/YYYY on Feb 7, 2000)
 #
 ################################################################################
+
+################################################################################
+#  
+# Subroutine: validate_credit_card_information
+#
+#   Usage:
+#     &validate_credit_card_information($credit_card_name, $credit_card_number,
+#                                       $credit_card_expiration_date)
+#
+#   Parameters:
+#     $credit_card_name = name of the credit card (VISA, MASTERCARD, AMERICAN
+#                                                  EXPRESS, DISCOVER).
+#     $credit_card_number = the 13,15, or 16 digit credit card number.
+#     $credit_card_expiration_date = the month and year that the credit card
+#                                    expires in.
+#
+#   Purpose:
+#     This routine performs the following validations on the credit card data:
+#
+#       1. Validates that $credit_card_name is one of these cards:
+#
+#          VISA
+#          MASTERCARD
+#          AMERICAN EXPRESS
+#          DISCOVER
+#
+#       2. Checks $credit_card_number to see if it is a VALID credit card
+#          number.  The first check is length of $credit_card_number for the
+#          given  $credit_card_name.  The second check is validating
+#          $credit_card_number using the Luhn Check Digit Algorithm.
+#
+#       3. Verifies that $credit_card_expiration_date is a date in the future.
+#
+#   Output:
+#     validate_credit_card_information returns the associative array %error.
+#     The key is the error code, and the value is the error message.  Possible
+#     return values are:
+#
+#       0: Credit Card Passed Validation.
+#       1: Invalid Credit Card Type.
+#       2: Invalid Credit Card Number.
+#       3: Credit Card Expired.
+#
+################################################################################
+
+# The purpose of this routine (and library) is twofold.  First, it catches
+# credit card information typographical errors.  Second, it prevents someone
+# from just "making up" credit card information (i.e. credit card number).  Just
+# because a credit card successfully passes all the checks in this routine,
+# (obviously) does NOT mean that there are funds available on the card, NOR does
+# it mean that the person who is submitting the card information is the actual
+# owner of the card.  This routine simply verifies that:
+# 1. the card is a valid type (VISA, MASTERCARD, AMERICAN EXPRESS, DISCOVER),
+# 2. the number is a possible valid credit card number, and
+# 3. the card has not expired.
+
 sub validate_credit_card_information
 {
+
+# Declare all variables local, so as not to conflict with variables in the
+# calling program.
+
   local($credit_card_name, $credit_card_number,
         $credit_card_expiration_date) = @_;
   local($invalid);
+
+# The main part of validate_credit_card_information is pretty straight forward.
+# There is a call to three separate routines which do the real validation work:
+#
+# &validate_credit_card_name
+# &validate_credit_card_number
+# &validate_credit_card_expiration_date
+#
+# The return value in each case is stored to $invalid.  If $invalid is non-zero,
+# the validation failed, and the routine is exited immediately with an error
+# code/error message combination stored in the associative array %error.  If all
+# three tests pass successfully, a return code 0 and success message are
+# returned to the calling program.
+
+  # Convert $credit_card_name to upper case for matching purposes later.
   $credit_card_name = "\U$credit_card_name\E";
 
   $invalid = &validate_credit_card_name($credit_card_name);
@@ -46,6 +141,7 @@
 Please try one of these cards: VISA, MASTERCARD, AMERICAN EXPRESS, \
 or DISCOVER.";
 
+    # Return the error code and message.
     return(%error);
 
   }
@@ -59,6 +155,7 @@
     $error{2} = "I'm sorry, $credit_card_number is not a valid number for \
 $credit_card_name. Please double check the number and try again.";
 
+    # Return the error code and message.
     return(%error);
 
   }
@@ -71,6 +168,7 @@
     $error{3} = "I'm sorry, that credit card has expired, or the date entered \
 is invalid.  Please try another card or re-enter the expiration date.";
 
+    # Return the error code and message.
     return(%error);
 
   }
@@ -80,16 +178,55 @@
   $error{0} = "Credit card $credit_card_name: $credit_card_number \
 $credit_card_expiration_date passed validation.";
 
+  # Return the success code and message.
   %error;
 
-} 
+} # END: sub validate_credit_card_information
+
+################################################################################
+#  
+# Subroutine: validate_credit_card_name
+#
+#   Usage:
+#     &validate_credit_card_name($credit_card_name)
+#
+#   Parameters:
+#     $credit_card_name = name of the credit card (VISA, MASTERCARD, AMERICAN
+#                                                  EXPRESS, DISCOVER)
+#
+#   Purpose:
+#     This routine performs the following validations on the credit card name:
+#
+#       Validates that $credit_card_name is one of these cards:
+#
+#         VISA
+#         MASTERCARD
+#         AMERICAN EXPRESS
+#         DISCOVER
+#
+#   Output:
+#     validate_credit_card_name returns $error_code.  Possible return values
+#     are:
+#
+#       0: Credit Card Number Passed Validation.
+#       1: Invalid Credit Card Number Length.
+#       2: Invalid Credit Card Number.
+#
 ################################################################################
+
+# First, @valid_credit_cards is filled with the type of cards that this library
+# can handle.  Then the submitted credit card name is compared against each
+# valid card in the array.  If a match is found, 0 is returned, indicating
+# success.  If the end of the array is reached, and no match is found, 1 is
+# returned indicating failure.
+
 sub validate_credit_card_name
 {
 
   local($credit_card_name) = @_;
   local($invalid);
 
+  # Cards that this routine will accept.
   @valid_credit_cards = ("VISA", "MASTERCARD", "AMERICAN EXPRESS", "DISCOVER");
 
   foreach $valid_credit_card (@valid_credit_cards)
@@ -104,11 +241,83 @@
 
   }
 
-  return(1); 
+  return(1); # Error 1: Credit Card Type Cannot be Processed.
 
-} 
+} # END: sub validate_credit_card_name
 
 ################################################################################
+#  
+# Subroutine: validate_credit_card_number
+#
+#   Usage:
+#     &validate_credit_card_number($credit_card_name, $credit_card_number)
+#
+#   Parameters:
+#     $credit_card_name = name of the credit card (VISA, MASTERCARD, AMERICAN
+#                                                  EXPRESS, DISCOVER)
+#     $credit_card_number = the 13,15, or 16 digit credit card number
+#
+#   Purpose:
+#     This routine performs the following validations on the credit card number:
+#
+#       1. Verifies that the length of $credit_card_number is valid for the
+#          given $credit_card_name.
+#
+#       2. Validates $credit_card_number using the Luhn Check Digit Algorithm.
+#
+#   Output:
+#     validate_credit_card_number returns $error_code.  Possible return values
+#     are:
+#
+#       0: Credit Card Number Passed Validation.
+#       1: Invalid Credit Card Number Length.
+#       2: Invalid Credit Card Number.
+#
+################################################################################
+
+# In this routine, the first step is to remove any dashes or spaces from the
+# credit card number.  If there are any non-numeric characters remaining in the
+# number, an error is returned.  The next check is validating the correct number
+# of digits for each card type. If not, return an error.
+#
+# The algorithm used to validate the card number is the Check Digit Algorithm.
+# This is the algorithm step by step:
+#
+# 1. Reverse the credit card number and split into individual digits.  The
+#    reason for this is that for an odd digit count, the digits of interest are
+#    the even ones.  For an even digit count, the digits of interest are the odd
+#    ones.  Reversing a number with an odd number of digits leaves the same
+#    digits in the even positions.  Reversing a number with an even number of
+#    digits swaps the even and odd positions.  For example:
+#
+#    123456789 (Odd digit count)   987654321 (Odd digit count reversed)
+#    OEOEOEOEO                     OEOEOEOEO
+#     \      \_____________________/      /
+#      \_________________________________/
+#                      |
+#    Notice that both 1 and 8 are in an odd and even position, respectively, in
+#    both cases.
+#
+#
+#    12345678 (Even digit count)   87654321 (Even digit count reversed)
+#    OEOEOEOE                      OEOEOEOE
+#    --------                      --------
+#     \      \____________________/      /
+#      \________________________________/
+#                      |
+#    Notice that 1 changes from an odd position to an even position, and 8
+#    changes from an even position to an odd position.
+#
+# 2. Multiply every even numbered digit by 2.  If the result is greater than 9,
+#    9 is subtracted from the product.  The original even digit is replaced with
+#    the result of these calculations.
+#
+# 3. Add all the digits together (the original odd digits and the replaced even
+#    digits)
+#
+# 4. Divide this sum by 10.  If the remainder is zero, the number is valid.
+#    Otherwise, the number is invalid.
+
 sub validate_credit_card_number
 {
 
@@ -116,6 +325,7 @@
   local($credit_card_number_length, $digit_times_two, $digit,
         @credit_card_number_digit, $validation_number);
 
+  # Remove dashes and spaces from $credit_card_number.
   $credit_card_number =~ s/-//g;
   $credit_card_number =~ s/ //g;
   $credit_card_number_length = length($credit_card_number);
@@ -124,41 +334,44 @@
   if(!($credit_card_number =~ /^[0-9]*$/))
   {
 
-    return(1); 
+    return(1); # Error 1: Invalid Characters in Credit Card Number.
  
   }
 
-   if($credit_card_name eq "VISA" &&
+  # Check for correct number of digits for each credit card type.
+  if($credit_card_name eq "VISA" &&
      ($credit_card_number_length != 13 && $credit_card_number_length != 16))
   {
 
-    return(2); 
+    return(2); # Error 2: Invalid Number of Digits for Given Credit Card.
 
   }
   elsif($credit_card_name eq "MASTERCARD" &&
         $credit_card_number_length != 16)
   {
 
-    return(2); 
+    return(2); # Error 2: Invalid Number of Digits for Given Credit Card.
 
   }
   elsif($credit_card_name eq "AMERICAN EXPRESS" &&
         $credit_card_number_length != 15)
   {
 
-    return(2); 
+    return(2); # Error 2: Invalid Number of Digits for Given Credit Card.
 
   }
   elsif($credit_card_name eq "DISCOVER" &&
         $credit_card_number_length != 16)
   {
 
-    return(2); 
+    return(2); # Error 2: Invalid Number of Digits for Given Credit Card.
 
   }
 
+  # Step 1.
   @credit_card_number_digit = split(/ */, reverse($credit_card_number));
 
+  # Step 2.
   for($digit_position = 1; $digit_position < $credit_card_number_length;
       $digit_position += 2)
   {
@@ -182,6 +395,7 @@
 
   $validation_number = 0;
 
+  # Step 3.
   foreach $digit (@credit_card_number_digit)
   {
 
@@ -189,33 +403,104 @@
 
   }
 
+  # Step 4.
   $validation_number % 10;
 
-} 
+} # END: sub validate_credit_card_number
 
 ################################################################################
+#  
+# Subroutine: validate_credit_card_expiration_date
+#
+#   Usage:
+#     &validate_credit_card_expiration_date($credit_card_expiration_date)
+#
+#   Parameters:
+#     $credit_card_expiration_date = the month and year that the credit card
+#                                    expires in
+#
+#   Purpose:
+#     This routine performs the following validations on the credit card
+#     expiration date:
+#
+#       Verifies that $credit_card_expiration_date is a date in the future.
+#
+#   Output:
+#     validate_credit_card_expiration_date returns $error_code.  Possible return
+#     values are:
+#
+#       0: Credit Card Expiration Date Passed Validation.
+#       1: Credit Card Has Expired.
+#
+################################################################################
+
 sub validate_credit_card_expiration_date
 {
 
+# The main purpose of this routine is to prevent expiration date typos.
+# Obviously, an unscrupulous user can enter any value they want for the
+# expiration date.
+
+# In this routine, the first task is the removal of any dashes, slashes, or
+# spaces from $credit_card_expiration_date.  If only one digit was used for the
+# month (i.e. "1" instead of "01"), the month is padded with a zero.  The date
+# should now be in the form MMYY.  Next, the $credit_card_expiration_date is
+# split into $expiration_month and $expiration_year.  The following check
+# handles dates > 1999.  Following this, the current system date is read and
+# checked for the > 1999 condition (obviously it is important that the system
+# date is correct).  The last step is to put the dates in CCYYMM format, and
+# compare.  If the expiration date is less than the current date, the card has
+# expired. Otherwise return an OK status.
+
   local($credit_card_expiration_date) = @_;
   local($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst);
   local($expiration_month,$expiration_day,$expiration_year,$expiration_card);
   local($my_today);
 
   # Remove dashes, slashes, and spaces from $credit_card_expiration_date.
+#  $credit_card_expiration_date =~ s/-//g;
+#  $credit_card_expiration_date =~ s/\///g;
+#  $credit_card_expiration_date =~ s/ //g;
+#  if(length($credit_card_expiration_date) < 3)
+#  {
+#    return(1); # Error 1: Invalid Date.
+#  }
+#
+#  # Add initial "0" to month if not present.
+#  if(length($credit_card_expiration_date) < 4)
+#  {
+#    $credit_card_expiration_date = "0" . $credit_card_expiration_date;
+#  }  
+#  # Get entered month and year.
+#  $expiration_year = substr($credit_card_expiration_date, -2);
+#  $expiration_month = substr($credit_card_expiration_date, -4, 2);
+#  # Assume if $expiration_year is less that 90, it is past 2000.
+#  if($expiration_year > 90)
+#  {
+#    $expiration_year = "19" . $expiration_year;
+#  }
+#  else
+#  {
+#    $expiration_year = "20" . $expiration_year;
+#  }
+
 # Modified by Steve Kneizys for format MM/DD/YYYY
 
   ($expiration_month,$expiration_day,$expiration_year) = 
          split(/\//,$credit_card_expiration_date,3);
   if ($expiration_year < 100) {
-    $expiration_year = $expiration_year + 2000; 
+    $expiration_year = $expiration_year + 2000; # works for a few years yet
    }
   if ($expiration_day < 1) {
-    $expiration_day = 31;
+    $expiration_day = 31;# works no matter what month ... assume end of month
    }
 
+  # Get current month and year.
   ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
   localtime(time);
+
+  # localtime returns posible values of 0-11.  Increment to change range to
+  # 1-12.
   $mon++;
 
   $my_today = $mday + 100*($mon + 100*(1900 + $year));
@@ -224,11 +509,11 @@
 
   if($my_today > $expiration_card)
   {
-    return(2); 
+    return(2); # Error 2: Credit Card Expired.
   }
 
-  return(0); 
+  return(0); # Card has not expired.
 
-} 
+} # END: sub validate_credit_card_expiration_date
 
-1; 
+1; # Libraries always end this way so that they return true to require
diff -ruN 4.0K-4b/library/http-lib.pl 5.0.000/library/http-lib.pl
--- 4.0K-4b/library/http-lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/http-lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -152,7 +152,7 @@
 # This script was written by Gunther Birznieks.
 # Date Created: 5-15-96
 
-$versions{'http-lib.pl'} = "19960515";
+$versions{'http-lib.pl'} = "5.0.000";
 
 #
 # Copyright:
@@ -193,10 +193,28 @@
 #
 ############################################################
 
+# Use the Sockets library for TCP/IP Communications
 use Socket;
 $http_os = "UNIX";
 
 ############################################################
+#
+# subroutine: HTTPGet
+#   Usage:
+#     $buf = &HTTPGet("/index.html", "www.eff.org", 80,
+#	"var1=value1&var2=value2&etc=etc);
+#
+#   Parameters:
+#     $url = URL To Connect To Relative to the host
+#     $hostname = HostName of WebSite to Connect To
+#     $port = port to connect to (normally 80)
+#     $in = Form Values To Mimic sending to the site
+#
+#   Output:
+#     HTML Code Output from the Web Server.
+#
+############################################################
+
 sub HTTPGet {
     local($url, $hostname, $port, $in) = @_;
     local($form_vars, $x, $socket);
@@ -205,9 +223,11 @@
 
 
     $form_vars = &FormatFormVars($in);
-
+# we need to add the ? to the front of the passed
+# form variables
     $url .= "?" . $form_vars;
 
+# The following sends the information to the HTTP Server.
     print  $socket <<__END_OF_SOCKET__;
 GET $url HTTP/1.0
 Accept: text/html
@@ -217,20 +237,42 @@
 
 __END_OF_SOCKET__
    
+# RetrieveHTTP retrieves the HTML code
     $buf = &RetrieveHTTP($socket);
     $buf;
 
-} 
+} #end of HTTPGet
 
 ############################################################
+#
+# subroutine: HTTPPost
+#   Usage:
+#     $buf = &HTTPPost("/index.html", "www.eff.org", 80,
+#	"var1=value1&var2=value2&etc=etc);
+#
+#   Parameters:
+#     $url = URL To Connect To Relative to the host
+#     $hostname = HostName of WebSite to Connect To
+#     $port = port to connect to (normally 80)
+#     $in = Form Values To Mimic sending to the site
+#
+#   Output:
+#     HTML Code Output from the Web Server.
+#
+############################################################
+
 sub HTTPPost {
     local($url, $hostname, $port, $in) = @_;
     local($form_vars, $x, $socket);
     local ($buf, $form_var_length);
     $socket = &OpenSocket($hostname, $port);
+# The following sends the information to the HTTP Server.
 
     $form_vars = &FormatFormVars($in);
 
+# We need the length of the form variables
+# that are passed to the server to pass as
+# content-length.
     $form_var_length = length($form_vars);
     print $socket <<__END_OF_SOCKET__;
 POST $url HTTP/1.0
@@ -246,24 +288,55 @@
     $buf = &RetrieveHTTP($socket);
     $buf;
 
-} 
+} #end of HTTPPost
 
 ############################################################
+#
+# subroutine: FormatFormVars
+#   Usage:
+#     $formvars = &FormatFormVars($in);
+#
+#   Parameters:
+#     $in = form variables to process
+#
+#   Output:
+#     Processed form variables.  Illegal characters
+#     are replaced with their %Hexcode equivalents.
+#     Currently the routine only handles spaces but
+#     could be expanded for more.
+#
+############################################################
+
 sub FormatFormVars {
     local ($in) = @_; 
 
     $in =~ s/ /%20/g;
 
     $in;
-} 
+} # FormatFormVars
 
 ############################################################
+#
+# subroutine: RetrieveHTTP
+#   Usage:
+#     $buf = &RetrieveHTTP($socket_handle);
+#
+#   Parameters:
+#     $socket = Handle to the socket we are communicating
+#               with
+#
+#   Output:
+#     Buffer containing the output of the HTTP Server
+#
+############################################################
 
 sub RetrieveHTTP {
     local ($socket) = @_;
     local ($buf,$x, $split_length);
 
     $buf = read_sock($socket, 6);
+# if the buffer has a status code of 200 in it,
+# then we know its safe to read in the rest of the document
 
     if ($buf =~ /200/) {
         while(<$socket>) {
@@ -271,6 +344,11 @@
         }
     }
 
+# We strip off the HTTP header by looking for 
+# two newlines or two newlines preceeded with
+# carriage returns.  Different Web Servers use
+# different delimiters sometimes.
+#
     $x = index($buf, "\r\n\r\n");
     $split_length = 4;
 
@@ -278,7 +356,8 @@
         $x = index($buf, "\n\n");
         $split_length = 2;
     }
-
+#
+# The following actually splits the header off
     if ($x > -1) {
         $buf = substr($buf,$x + $split_length);
     }
@@ -286,9 +365,23 @@
     close $socket;
 
 $buf;
-} 
+} # End of RetrieveHTTP
 
 ############################################################
+#
+# subroutine: OpenSocket
+#   Usage:
+#     $socket_handle = &OpenSocket($host, $port);
+#
+#   Parameters:
+#     $host = host name to connect to
+#     $port = port to connect to
+#
+#   Output:
+#     Handle to socket that was opened
+#
+############################################################
+
 sub OpenSocket {
     local($hostname, $port) = @_;
 
@@ -297,11 +390,35 @@
     local($AF_INET, $SOCK_STREAM, $SOCK_ADDR);
     local($PROTOCOL, $HTTP_PORT); 
 
+# The following variables are set using values defined in
+# The sockets.pm library.  If your version of perl (v4) does
+# not have the sockets library, you can substitute some 
+# default values such as 2 for AF_INIT, and 1 for SOCK_STREAM.
+# if 1 does not work for SOCK_STREAM, try using 2.
+#
+# AF_INET defines the internet class of addressing
+#
+# SOCK_STREAM is a variable telling the program to use
+# a socket connection.  This varies from using SOCK_DGRAM
+# which would send UDP datagrams using a connectionless paradigm
+# instead.
+# 
+# PROTOCOL is TCPIP (6).
+#
+# PORT Should generally be 80 for HTTP Access, some sites use
+# alternative ports such as 8080.
+#
+# SOCK_ADDR is the packeted format of the full socket address
+# including the AF_INIT value, HTTP_PORT, and IP ADDRESS in that order
+#
+
     $AF_INET = AF_INET;
     $SOCK_STREAM = SOCK_STREAM;
 
     $SOCK_ADDR = "S n a4 x8";
 
+# The following routines get the protocol information
+#
 
     $PROTOCOL = (getprotobyname('tcp'))[2];
 
@@ -309,6 +426,8 @@
     $HTTP_PORT = 80 unless ($HTTP_PORT =~ /^\d+$/);
     $PROTOCOL = 6 unless ($PROTOCOL =~ /^\d+$/);
 
+# Ip address is the Address of the host that we need to connect
+# to
     $ipaddress = (gethostbyname($hostname))[4];
 
     $fullipaddress = join (".", unpack("C4", $ipaddress));
@@ -318,45 +437,84 @@
     $packthishostip = pack($SOCK_ADDR, 
 			 $AF_INET, 0, "\0\0\0\0");
 
+# First we allocate the socket
     socket (S, $AF_INET, $SOCK_STREAM, $PROTOCOL) || 
 	&web_error( "Can't make socket:$!\n");
 
+# Then we bind the socket to the local host
     bind (S,$packthishostip) || 
 	&web_error( "Can't bind:$!\n");
+# Then we connect the socket to the remote host
     connect(S, $packconnectip) || 
 	&web_error( "Can't connect socket:$!\n");
 
+# The following selects the socket handle and turns off
+# output buffering
+#
     select(S);
     $| = 1;
     select (STDOUT);
 
 S;
-} 
+} # End of OpenSocket
 
 ############################################################
+#
+# subroutine: read_sock
+#   Usage:
+#     &read_socket(SOCKET_HANDLE, $timeout);
+#
+#   Parameters:
+#     SOCKET_HANDLE = Handle to an allocated Socket
+#     $timeout = amount of time read_sock is allowed to
+#                wait for input before timing out
+#                (measured in seconds)
+#
+#   Output:
+#     Buffer containing what was read from the socket
+# 
+############################################################
+
 sub read_sock {
     local($handle, $endtime) = @_;
     local($localbuf,$buf);
     local($rin,$rout,$nfound);
 
+# Set endtime to be time + endtime.
     $endtime += time;
 
+# Clear buffer
     $buf = "";
 
+# Clear $rin (Read Input variable)
     $rin = '';
+# Set $rin to be a vector of the socket file handle
     vec($rin, fileno($handle), 1) = 1;
 
+# nfound is 0 since we have not read anything yet
     $nfound = 0;
 
+# Loop until we time out or something was read 
 read_socket: 
 while (($endtime > time) && ($nfound <= 0)) {
+# Read 1024 bytes at a time
     $length = 1024;
+# Preallocate buffer
     $localbuf = " " x 1025;
+	# NT does not support select for polling to see if 
+	# There are characters to be received.  This is important
+	# Because we dont want to block if there is nothing
+	# being received.
     $nfound = 1;
     if ($http_os ne "NT") {
+# The following polls to see if there is anything in the input
+# buffer to read.  If there is, we will later call the sysread routine
 	$nfound = select($rout=$rin, undef, undef,.2);
 	    }
 }
+	
+# If we found something in the read socket, we should
+# get it using sysread.
     if ($nfound > 0) {
 	$length = sysread($handle, $localbuf, 1024);
 	if ($length > 0) {
@@ -364,19 +522,36 @@
 	    }
     }
 
+# Return the contents of the buffer
 $buf;
 }
 
 ############################################################
+#
+# subroutine: web_error
+#   Usage:
+#     &web_error("File xxx could not be opened");
+#
+#   Parameters:
+#     $error = Description of Web Error
+#
+#   Output:
+#     None
+# 
+############################################################
+
 sub web_error
 {
 local ($error) = @_;
 $error = "Error Occured: $error";
 print "$error<p>\n";
 
+# Die exits the program prematurely and prints an error to
+# stderr
+
 die $error;
 
-} 
+} # end of web_error
 
 1;
 
diff -ruN 4.0K-4b/library/iTransact-mgr_lib.pl 5.0.000/library/iTransact-mgr_lib.pl
--- 4.0K-4b/library/iTransact-mgr_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/iTransact-mgr_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,10 +1,14 @@
 #
 # For the Credit Card Processing Gateway iTransact
 #
-# Copyright 2001 Steve Kneizys.  All Rights Reserved.
-# June 30, 2001
+# For more signup for iTransact or to become an iTransact authorized reseller
+# Please visit iTransact.com for more details.
+#
+# Copyright K-Factor Technologies, Inc.  & AgoraScript
+# All Rights Reserved.
+# November 10, 2001 to Present
 
-$versions{'iTransact-mgr_lib.pl'} = "20010630";
+$versions{'iTransact-mgr_lib.pl'} = "5.0.000";
 &add_codehook("gateway_admin_screen","iTransact_mgr_check");
 &add_codehook("gateway_admin_settings","iTransact_settings");
 $mc_gateways .= "|iTransact";
@@ -17,13 +21,47 @@
    print (GW "\$sc_gateway_username = \"$in{'sc_gateway_username'}\";\n");
    print (GW "\$sc_order_script_url = \"$in{'order_url'}\";\n");
    print (GW "\$mername = \"$in{'mername'}\";\n");
+   print (GW "\$merchant_live_mode = \"$in{'live_mode'}\";\n");
+   print (GW "\$sc_itransact_submit = '$in{'sc_itransact_submit'}';\n");
+   print (GW "\$sc_itransact_change = '$in{'sc_itransact_change'}';\n");
+   print (GW "\$sc_itransact_verify_message = \"" . 
+         &my_escape($in{'sc_itransact_verify_message'}) . "\";\n");
+   print (GW "\$sc_itransact_order_desc = \"" . 
+         &my_escape($in{'sc_itransact_order_desc'}) . "\";\n");
+   print (GW "\$sc_display_checkout_tos = \"$in{'sc_display_checkout_tos'}\";\n");
+   $sc_tos_display_address_temp = &my_escape($in{'sc_tos_display_address'});
+   print (GW "\$sc_tos_display_address = qq'$sc_tos_display_address_temp';\n");
+   print (GW "\$sc_itransact_top_message = \"" . 
+         &my_escape($in{'sc_itransact_top_message'}) . "\";\n");
+   print (GW "\$iTransact_order_ok_final_msg_tbl = \"" . 
+         &my_escape($in{'iTransact_order_ok_final_msg_tbl'}) . "\";\n");
+   print (GW "\$iTransact_merch_message = \"" . 
+         &my_escape($in{'iTransact_merch_message'}) . "\";\n");
+   print (GW "\$iTransact_bodyback = \"" . 
+         &my_escape($in{'iTransact_bodyback'}) . "\";\n");
+   print (GW "\$iTransact_fontcolor = \"" . 
+         &my_escape($in{'iTransact_fontcolor'}) . "\";\n");
+   print (GW "\$iTransact_linkcolor = \"" . 
+         &my_escape($in{'iTransact_linkcolor'}) . "\";\n");
+   print (GW "\$iTransact_enablebodytags = \"$in{'iTransact_enablebodytags'}\";\n");
+   print (GW "\$iTransact_Logo_URL = \"$in{'iTransact_Logo_URL'}\";\n");
+   print (GW "\$iTransact_backimage_URL = \"$in{'iTransact_backimage_URL'}\";\n");
+
+  
    print (GW "\$acceptcards = \"$in{'acceptcards'}\";\n");
+if ($in{'acceptcards'} eq 1) {
+   print (GW "\$acceptvisa = \"$in{'acceptvisa'}\";\n");
+   print (GW "\$acceptmastercard = \"$in{'acceptmastercard'}\";\n");
+   print (GW "\$acceptdiscover = \"$in{'acceptdiscover'}\";\n");
+   print (GW "\$acceptamex = \"$in{'acceptamex'}\";\n");
+   print (GW "\$acceptdiners = \"$in{'acceptdiners'}\";\n");
+}
+
    print (GW "\$acceptchecks = \"$in{'acceptchecks'}\";\n");
    print (GW "\$accepteft = \"$in{'accepteft'}\";\n");
    print (GW "\$altaddr = \"$in{'altaddr'}\";\n");
    print (GW "\$email_text = \"$email_text\";\n");
-   print (GW "\$merchant_live_mode = \"$in{'live_mode'}\";\n");
-   print (GW "1\;\n");
+   print (GW "#\n1\;\n");
    close(GW);
   }
  }
@@ -36,16 +74,20 @@
 }
 ##############################################################################
 sub print_iTransact_mgr_form {
-	
+  
 ##
-## ITRANSACT
+## iTransact
 ##
 
+if ($sc_display_checkout_tos eq '') { # default it in
+  $sc_display_checkout_tos = "yes";
+ }
+
 print &$manager_page_header("iTransact Gateway","","","","");
 
 print <<ENDOFTEXT;
 <CENTER>
-<TABLE WIDTH=580>
+<TABLE width=96%>
 
 <TR>
 <TD COLSPAN=2><HR></TD>
@@ -54,15 +96,18 @@
 <TR>
 <TD COLSPAN="2">
 <FONT FACE=ARIAL>
-iTransact Settings<br>$msg<br>
-Don't forget that iTransact uses PGP signatures to validate
+<b>iTransact Settings</b><br>$msg<br>
+
+Find out more about ths gateway at: <a href="http://www.iTransact.com/">
+http://www.iTransact.com</a><br><br>
+<!--Don't forget that iTransact uses PGP signatures to validate
 every transaction.  To take full advantage of this, you should
 install PGP or RSA-enabled GPG on your server and set it up properly 
 on the PGP/GPG page.  You will need to import the
 iTransact public key as well, see the instructions at:<br><br>
 &nbsp;&nbsp;&nbsp;&nbsp;
-<a href="http://www.itransact.com/support/pgp.html">
-http://www.itransact.com/support/pgp.html</a><br>
+<a href="http://www.iTransact.com/support/pgp.html">
+http://www.iTransact.com/support/pgp.html</a><br>-->
 </FONT>
 
 </TD>
@@ -93,7 +138,7 @@
 <FONT FACE=ARIAL SIZE=2>
 <FORM METHOD="POST" ACTION="manager.cgi">
 <CENTER>
-<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
+<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0 width=96%>
 
 <TR>
 <TD COLSPAN=2><HR></TD>
@@ -110,7 +155,10 @@
 </TD>
 </TR>
 
-</TABLE><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
+</CENTER>
+</TABLE>
+
+<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0 width=96%>
 
 <TR>
 <TD COLSPAN=2><HR></TD>
@@ -143,7 +191,7 @@
 </TD>
 </TR>
 
-</TABLE><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
+</TABLE><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0>
 
 <TR>
 <TD COLSPAN=2><HR></TD>
@@ -168,7 +216,7 @@
 <TR>
 <TD>
 Are setup to accept credit cards through iTransact? 
-Select '0' for no, '1' for yes.
+Select '0' for no, '1' for yes.  (applies to card types below as well)
 </TD>
 <TD>
 <SELECT NAME="acceptcards">
@@ -180,13 +228,45 @@
 </TR>
 
 <TR>
+<TD COLSPAN=2><table>
+	<tr>
+		<td><font size=2 face =arial>Accept Visa?<br><SELECT NAME="acceptvisa">
+<OPTION>$acceptvisa</OPTION>
+<OPTION VALUE="0">0</OPTION>
+<OPTION VALUE="1">1</OPTION>
+</SELECT></font></td>
+		<td><font size=2 face =arial>Accept MasterCard?<br><SELECT NAME="acceptmastercard">
+<OPTION>$acceptmastercard</OPTION>
+<OPTION VALUE="0">0</OPTION>
+<OPTION VALUE="1">1</OPTION>
+</SELECT></font></td>
+		<td><font size=2 face =arial>Accept AMEX?<br><SELECT NAME="acceptamex">
+<OPTION>$acceptamex</OPTION>
+<OPTION VALUE="0">0</OPTION>
+<OPTION VALUE="1">1</OPTION>
+</SELECT></font></td>
+		<td><font size=2 face =arial>Accept Discover?<br><SELECT NAME="acceptdiscover">
+<OPTION>$acceptdiscover</OPTION>
+<OPTION VALUE="0">0</OPTION>
+<OPTION VALUE="1">1</OPTION>
+</SELECT></font></td>
+		<td><font size=2 face =arial>Accept Diners?<br><SELECT NAME="acceptdiners">
+<OPTION>$acceptdiners</OPTION>
+<OPTION VALUE="0">0</OPTION>
+<OPTION VALUE="1">1</OPTION>
+</SELECT></font></td>
+	</tr>
+</table></TD>
+</TR>
+
+<TR>
 <TD COLSPAN=2><HR></TD>
 </TR>
 
 <TR>
 <TD>
 Are you setup to accept checks through iTransact?
-Select '0' for no, '1' for yes.
+Select '0' for no, '1' for yes
 </TD>
 <TD>
 <SELECT NAME="acceptchecks">
@@ -238,7 +318,7 @@
 <TD COLSPAN=2><HR></TD>
 </TR>
 
-</TABLE><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
+</TABLE><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0>
 
 
 <TR>
@@ -261,6 +341,162 @@
 
 <TR>
 <TD COLSPAN=2>
+URL of 'Submit to iTransact' button:
+<br>
+<INPUT NAME="sc_itransact_submit" TYPE="TEXT" SIZE=60 
+VALUE='$sc_itransact_submit'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+URL of 'Make Changes' button:
+<br>
+<INPUT NAME="sc_itransact_change" TYPE="TEXT" SIZE=60 
+VALUE='$sc_itransact_change'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+Order Description:
+<br>
+<INPUT NAME="sc_itransact_order_desc" TYPE="TEXT" SIZE=60 
+VALUE='$sc_itransact_order_desc'><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+Message at the top of the Verify Order table:
+<br>
+<TEXTAREA NAME="sc_itransact_verify_message"
+ROWS=4 COLS=65 wrap=soft>$sc_itransact_verify_message</TEXTAREA>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><br><HR><br></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><TABLE WIDTH="100%"><TR>
+<TD>Display Terms of Service and Refund Policy checkbox and set as required?</TD>
+<TD>
+<SELECT NAME="sc_display_checkout_tos">
+<OPTION>$sc_display_checkout_tos</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT>
+</TD>
+</TR></TABLE></TD>
+</TR>
+<TR><TD COLSPAN=2><br>
+Business address and phone number (contact information) for your business.  Should be legal address for the business location for full disclosure and other privacy requirements mandated by credit card companies as well as government enitities that require such notices:<br>
+<TEXTAREA NAME="sc_tos_display_address" 
+cols="68" rows=5 
+wrap=off>$sc_tos_display_address</TEXTAREA><br>
+
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR><TD COLSPAN=2>
+Top message for Order form.  Allows you to place a message above the Payment Information area and just below the cart total boxes.  HTML formatting (for text color, font, spacing, etc) is accepted.  Leave blank if not needed:<br>
+<TEXTAREA NAME="sc_itransact_top_message" 
+cols="68" rows=8 
+wrap=off>$sc_itransact_top_message</TEXTAREA> <br><br>
+</TD>
+</TR>
+
+<TR><TD COLSPAN=2>
+Top message for confirmation page, the page just before going to the gateway.  This allows you to place a message above the Payment Information area and just below the cart total boxes.  HTML formatting (for text color, font, spacing, etc) is accepted.  Leave blank if not needed:<br>
+<TEXTAREA NAME="iTransact_order_ok_final_msg_tbl" 
+cols="68" rows=8 
+wrap=off>$iTransact_order_ok_final_msg_tbl</TEXTAREA> <br><br>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><font size=2 face =arial><br>
+Complete URL to the logo you'd like to display on your payment information page at iTransact.
+This <b>MUST</b> be a secure https URL. You can also leave this blank if you prefer.<br>
+<INPUT NAME="iTransact_Logo_URL" TYPE="TEXT" SIZE=60 VALUE="$iTransact_Logo_URL"><br>
+</font></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><font size=2 face =arial><br>
+Set and define the body tag attributes at the iTransact payment page?  Select Attributes below.  If not desired, set the enable body tags variable to "0" to disable all body tags.  Fields that you do not wish to use, leave blank or select 0.  Enter color names or RGB values (for example, enter either: red or #FF0000) for colors.
+</font></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><table>
+	<tr>
+		<td><font size=2 face =arial>Enable Body Tags?<br><SELECT NAME="iTransact_enablebodytags">
+<OPTION>$iTransact_enablebodytags</OPTION>
+<OPTION VALUE="0">0</OPTION>
+<OPTION VALUE="1">1</OPTION>
+</SELECT></font></td>
+		<td><font size=2 face =arial>Body Background Color:<br>
+<INPUT NAME="iTransact_bodyback" TYPE="TEXT" SIZE=10 VALUE="$iTransact_bodyback">
+</font></td>
+		<td><font size=2 face =arial>Font Color:<br>
+<INPUT NAME="iTransact_fontcolor" TYPE="TEXT" SIZE=10 VALUE="$iTransact_fontcolor">
+</font></td>
+		<td><font size=2 face =arial>Link Color:<br>
+<INPUT NAME="iTransact_linkcolor" TYPE="TEXT" SIZE=10 VALUE="$iTransact_linkcolor">
+</font></td>
+</table>
+<br>
+<font size=2 face =arial><br>
+Complete URL to the background image you'd like to display on your payment information page at iTransact.
+This <b>MUST</b> be a secure https URL. You can also leave this blank if you prefer.  Body Tag attributes must be enabled above to use this featured<br>
+<INPUT NAME="iTransact_backimage_URL" TYPE="TEXT" SIZE=60 VALUE="$iTransact_backimage_URL"><br>
+</font>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><font size=2 face =arial><br>
+Enter a text message to be shwon on the payment information page at iTransact.
+This mesage will be shown in the text box immediately above the submit button. Use a &lt;br> for line breaks/spacing.  You can also leave this blank if you prefer.<br>
+<TEXTAREA NAME="iTransact_merch_message" 
+cols="68" rows=8 
+wrap=off>$iTransact_merch_message</TEXTAREA><br>
+</font></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><br><br>
 <CENTER>
 <INPUT TYPE="HIDDEN" NAME="system_edit_success" VALUE="yes">
 <INPUT TYPE="HIDDEN" NAME="gateway" VALUE="iTransact">
diff -ruN 4.0K-4b/library/iTransact-order_lib.pl 5.0.000/library/iTransact-order_lib.pl
--- 4.0K-4b/library/iTransact-order_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/iTransact-order_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -2,16 +2,29 @@
 #                    Order Form Definition Variables                  #
 #######################################################################
 
-$versions{'iTransact-order_lib.pl'} = "20020312";
+$versions{'iTransact-order_lib.pl'} = "5.0.000";
+$sc_use_secure_header_at_checkout = 'yes';
+$sc_use_secure_footer_for_order_form = 'yes';
+
+# discount mods applied June 17 2005
 
-$sc_order_response_vars{"iTransact"}="authcode";
+$sc_order_response_vars{"iTransact"}="iTransact";
 $sc_use_secure_header_at_checkout = 'yes';
 &add_codehook("printSubmitPage","print_iTransact_SubmitPage");
 &add_codehook("set_form_required_fields","iTransact_fields");
 &add_codehook("gateway_response","check_for_iTransact_response");
 ###############################################################################
+sub iTransact_check_and_load {
+local($myname)="iTransact";
+if ($myname ne $sc_gateway_name) { # we are a secondary gateway, load settings
+  &require_supporting_libraries(__FILE__,__LINE__,
+     "./admin_files/$myname-user_lib.pl");
+ }
+
+}
+###############################################################################
 sub check_for_iTransact_response {
-  if ($form_data{'authcode'}) {
+  if ($form_data{'iTransact'} eq 'iTransact') {
     $cart_id = $form_data{'p4'};
     &set_sc_cart_path;
     &load_order_lib;
@@ -26,35 +39,45 @@
 
 if (!($form_data{'gateway'} eq $myname)) { return;} 
 
-%sc_order_form_array =('Ecom_BillTo_Postal_Name_First', 'First Name',
-                       'Ecom_BillTo_Postal_Name_Last', 'Last Name',
-                       'Ecom_BillTo_Postal_Street_Line1', 'Billing Address Street',
-                       'Ecom_BillTo_Postal_City', 'Billing Address City',
-                       'Ecom_BillTo_Postal_StateProv', 'Billing Address State',
-                       'Ecom_BillTo_PostalCode', 'Billing Address Zip',
-                       'Ecom_BillTo_Postal_CountryCode', 'Billing Address Country',
-                       'Ecom_ShipTo_Postal_Street_Line1', 'Shipping Address Street',
-                       'Ecom_ShipTo_Postal_City', 'Shipping Address City',
-                       'Ecom_ShipTo_Postal_StateProv', 'Shipping Address State',
-                       'Ecom_ShipTo_Postal_PostalCode', 'Shipping Address Zip',
-                       'Ecom_ShipTo_Postal_CountryCode', 'Shipping Address Country',
-                       'Ecom_BillTo_Telecom_Phone_Number', 'Phone Number',
-                       'Ecom_BillTo_Online_Email', 'Email',
-                       'Ecom_Payment_Card_Type', 'Type of Card',
-                       'Ecom_Payment_Card_Number', 'Card Number',
-                       'Ecom_Payment_Card_ExpDate_Month', 'Card Expiration Month',
-                       'Ecom_Payment_Card_ExpDate_Day', 'Card Expiration Day',
-                       'Ecom_Payment_Card_ExpDate_Year', 'Card Expiration Year');
+%sc_order_form_array =(
+	'Ecom_BillTo_Postal_Name_First', 'First Name',
+  'Ecom_BillTo_Postal_Name_Last', 'Last Name',
+  'Ecom_BillTo_Postal_Street_Line1', 'Billing Address Street',
+  'Ecom_BillTo_Postal_City', 'Billing Address City',
+  'Ecom_BillTo_Postal_StateProv', 'Billing Address State',
+  'Ecom_BillTo_PostalCode', 'Billing Address Zip',
+  'Ecom_BillTo_Postal_CountryCode', 'Billing Address Country',
+  'Ecom_ShipTo_Postal_Street_Line1', 'Shipping Address Street',
+  'Ecom_ShipTo_Postal_City', 'Shipping Address City',
+  'Ecom_ShipTo_Postal_StateProv', 'Shipping Address State',
+  'Ecom_ShipTo_Postal_PostalCode', 'Shipping Address Zip',
+  'Ecom_ShipTo_Postal_CountryCode', 'Shipping Address Country',
+  'Ecom_BillTo_Telecom_Phone_Number', 'Phone Number',
+  'Ecom_BillTo_Online_Email', 'Email',
+  'Ecom_is_Residential', 'Shipping to Residential Address',
+  'Ecom_ShipTo_Insurance', 'Insure this Shipment', # not implemented yet, for the future
+  'Ecom_tos', 'Sales-Terms of Service',
+  'Ecom_Payment_Card_Type', 'Type of Card',
+  'Ecom_Payment_Card_Number', 'Card Number',
+  'Ecom_Payment_Card_ExpDate_Month', 'Card Expiration Month',
+  'Ecom_Payment_Card_ExpDate_Day', 'Card Expiration Day',
+  'Ecom_Payment_Card_ExpDate_Year', 'Card Expiration Year');
                         
 
 @sc_order_form_required_fields = (
 	"Ecom_ShipTo_Postal_StateProv",
 	"Ecom_ShipTo_Postal_PostalCode");
 
+# lines for tos added April 5 2006 by Mister Ed
+ if ($sc_display_checkout_tos =~ /yes/i) {
+    push(@sc_order_form_required_fields,"Ecom_tos");
+ }
+
 }
 
 ###############################################################################
-sub iTransact_order_form_prep{ # load the customer info ...
+sub iTransact_order_form_prep { # load the customer info ...
+  &iTransact_check_and_load;
   if ($sc_iTransact_form_prep == 0) {
     if (-f "$sc_verify_order_path"){
       &read_verify_file;  
@@ -135,6 +158,8 @@
 local($invoice_number, $customer_number, $displayTotal);
 local($test_mode,$zemail_text);
 local($myname)="iTransact";
+local($my_change,$my_submit,$my_message,$my_desc);
+my ($tempbodytags) = '';
 
 if (!($form_data{'gateway'} eq $myname)) { return;} 
 if ($myname ne $sc_gateway_name) { # secondary gateway, load settings
@@ -147,6 +172,10 @@
 $invoice_number = $current_verify_inv_no;
 $customer_number = $cart_id;
 $customer_number =~ s/_/./g;
+$my_submit=&script_and_substitute($sc_itransact_submit);
+$my_change=&script_and_substitute($sc_itransact_change);
+$my_message=&script_and_substitute($sc_itransact_verify_message);
+$my_desc=&script_and_substitute($sc_itransact_order_desc);
 &iTransact_table_setup;
 $zemail_text = &script_and_substitute($email_text,"iTransact");
 
@@ -156,40 +185,59 @@
   $test_mode = "<INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"test_mode\">";
  }
 
-print <<ENDOFTEXT;
-
-<FORM METHOD=POST ACTION=\"$sc_order_script_url\">
 
-<INPUT TYPE=HIDDEN NAME=\"1-cost\" VALUE=\"$authPrice\">
-
-<INPUT type=\"HIDDEN\" name=\"passback\" value=\"p1\">
-<INPUT TYPE=\"HIDDEN\" NAME=\"p1\" VALUE=\"$zfinal_shipping\">
+if ($iTransact_enablebodytags eq "1"){
+$tempbodytags = qq~<input type="hidden" name="bodytags" value="$iTransact_enablebodytags">
+<INPUT type="hidden" name="background" value="$iTransact_backimage_URL">
+<INPUT type="hidden" name="bgcolor" value="$iTransact_bodyback">
+<INPUT type="hidden" name="fontcolor" value="$iTransact_fontcolor">
+<INPUT type="hidden" name="link" value="$iTransact_linkcolor">
+~;
+}
 
-<INPUT type=\"HIDDEN\" name=\"passback\" value=\"Ecom_ShipTo_Method\">
-<INPUT TYPE=\"HIDDEN\" NAME=\"Ecom_ShipTo_Method\" VALUE=\"$form_data{'Ecom_ShipTo_Method'}\">
+if ($iTransact_Logo_URL ne ""){
+$tempbodytags .= qq~
+<INPUT type="hidden" name="mastimage" value="1">
+<INPUT type="hidden" name="mast" value="$iTransact_Logo_URL">
+~;
+}
 
-<INPUT type=\"HIDDEN\" name=\"passback\" value=\"p2\">
-<INPUT TYPE=HIDDEN NAME=\"p2\" VALUE=\"$zfinal_discount\">
+print <<ENDOFTEXT;
 
-<INPUT type=\"HIDDEN\" name=\"passback\" value=\"p3\">
-<INPUT TYPE=HIDDEN NAME=\"p3\" VALUE=\"$zfinal_sales_tax\">
+<FORM METHOD=POST ACTION=\"$sc_order_script_url\" AUTOCOMPLETE = 'off'>
 
 <INPUT TYPE=\"HIDDEN\" NAME=\"vendor_id\" VALUE=\"$sc_gateway_username\">
+
+<input type=\"hidden\" name=\"formtype\" value=\"1\">
 <INPUT TYPE=\"HIDDEN\" NAME=\"home_page\" VALUE=\"$sc_store_url\">
 <INPUT TYPE=\"HIDDEN\" NAME=\"ret_addr\" VALUE=\"$sc_store_url\">
+<input type=\"hidden\" name=\"ret_mode\" value=\"post\">
 <INPUT TYPE=\"HIDDEN\" NAME=\"email_text\" VALUE=\"$zemail_text\">
 
+<INPUT TYPE=\"HIDDEN\" NAME=\"1-cost\" VALUE=\"$authPrice\">
 <INPUT TYPE=\"HIDDEN\" NAME=\"1-desc\" VALUE=\"Online Order\">
 <INPUT TYPE=\"HIDDEN\" NAME=\"1-qty\" VALUE=\"1\">
 
+$tempbodytags
+<input type="hidden" name="mertext" value="$iTransact_merch_message">
+
+<INPUT type=\"HIDDEN\" name=\"passback\" value=\"p1\">
+<INPUT TYPE=\"HIDDEN\" NAME=\"p1\" VALUE=\"$zfinal_shipping\">
+
+<INPUT type=\"HIDDEN\" name=\"passback\" value=\"p2\">
+<INPUT TYPE=HIDDEN NAME=\"p2\" VALUE=\"$zfinal_discount\">
+
+<INPUT type=\"HIDDEN\" name=\"passback\" value=\"p3\">
+<INPUT TYPE=HIDDEN NAME=\"p3\" VALUE=\"$zfinal_sales_tax\">
+
 <INPUT type=\"HIDDEN\" name=\"passback\" value=\"p4\">
 <INPUT TYPE=\"HIDDEN\" NAME=\"p4\" VALUE=\"$customer_number\">
 
 <INPUT type=\"HIDDEN\" name=\"passback\" value=\"p5\">
 <INPUT TYPE=\"HIDDEN\" NAME=\"p5\" VALUE=\"$invoice_number\">
 
-<INPUT type=\"HIDDEN\" name=\"passback\" value=\"p6\">
-<INPUT TYPE=\"HIDDEN\" NAME=\"p6\" VALUE=\"$displayTotal\">
+<INPUT type=\"HIDDEN\" name=\"passback\" value=\"iTransact\">
+<INPUT TYPE=\"HIDDEN\" NAME=\"iTransact\" VALUE=\"iTransact\">
 
 <INPUT TYPE=HIDDEN NAME=\"showaddr\" VALUE=\"1\">
 <INPUT TYPE=HIDDEN NAME=\"nonum\" VALUE=\"0\">
@@ -199,6 +247,11 @@
 <INPUT TYPE=HIDDEN NAME=\"acceptchecks\" VALUE=\"$acceptchecks\">
 <INPUT TYPE=HIDDEN NAME=\"accepteft\" VALUE=\"$accepteft\">
 <INPUT TYPE=HIDDEN NAME=\"altaddr\" VALUE=\"$altaddr\">
+<input type=hidden name="visaimage" value="$acceptvisa">
+<input type=hidden name="mcimage" value="$acceptmastercard">
+<input type=hidden name="discimage" value="$acceptdiscover">
+<INPUT type="hidden" name="ameximage" value="$acceptamex">
+<INPUT type="hidden" name="dinerimage" value="$acceptdiners">
 
 <INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"first_name\">
 <INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"last_name\">
@@ -224,44 +277,68 @@
 <INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"when\">
 <INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"xid\">
 
-<TABLE WIDTH="500" BGCOLOR="#C0FFFF" CELLPADDING="0" CELLSPACING="0">
-<TR>
-<TD>
+ENDOFTEXT
 
-<TABLE WIDTH="500" BGCOLOR="#000080" CELLPADDING="0" CELLSPACING="0">
-<TR BGCOLOR="#C0FFFF">
-<TD BGCOLOR="#C0FFFF"><FONT FACE="ARIAL" SIZE="2" COLOR="#000000">
-Please verify the following information. When you are confident 
-that it is correct, click the 'Secure Orderform' button to enter 
-your payment information, or
-<a href="${sc_stepone_order_script_url}?order_form_button.x=1">
-click here</a> to make corrections:
-</FONT></TD>
-<TD  BGCOLOR="#C0FFFF">
-</TR>
-<TR BGCOLOR="#C0FFFF">
-<td>
-Ship To $form_data{'Ecom_ShipTo_Postal_PostalCode'}
-$form_data{'Ecom_ShipTo_Postal_StateProv'}
-via $form_data{'Ecom_ShipTo_Method'}<br>
-</td>
+print <<ENDOFTEXT;
+
+<div align="center">
+
+<p class="ac_checkout_top_msg">$iTransact_order_ok_final_msg_tbl</p>
+  <p class="ac_checkout_top_msg">$my_message</p>
+
+
+<table cellpadding="0" cellspacing="0" class="ac_checkout_review">
+<tr>
+<th colspan="2" class="ac_checkout_review">Customer Information</th>
 </tr>
-<TR BGCOLOR="#C0FFFF">
-<TD>
+ENDOFTEXT
+
+if ($form_data{'Ecom_ShipTo_Method'} ne ""){
+print <<ENDOFTEXT;
+  <tr>
+    <td class="ac_checkout_review_col1">Ship via:</td>
+    <td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Method'}</td>
+  </tr>
+ENDOFTEXT
+}
+ 
+print <<ENDOFTEXT;
+  <tr>
+    <td class="ac_checkout_review_col1">State </td>
+    <td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_StateProv'}
+    &nbsp;</td>
+  </tr>
+  <tr>
+    <td class="ac_checkout_review_col1">Postal Code </td>
+    <td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_PostalCode'}
+    &nbsp; </td>
+  </tr>
+  <tr>
+    <td class="ac_checkout_review_col1">Country</td>
+    <td class="ac_checkout_review_col2">$form_data{'Ecom_ShipTo_Postal_CountryCode'}</td>
+  </tr>
+  <tr>
+    <td class="ac_checkout_review_col1">Residential Address</td>
+    <td class="ac_checkout_review_col2">$form_data{'Ecom_is_Residential'}&nbsp;</td>
+  </tr>
+</TABLE>
+ 
+<TABLE WIDTH="500" BGCOLOR="#FFFFFF" CELLPADDING="2" CELLSPACING="0" BORDER=0>
+<TR>
+<TD COLSPAN=2>
 <CENTER>
-<INPUT TYPE=SUBMIT VALUE="Secure Orderform">
+<INPUT TYPE="IMAGE" NAME="Submit" VALUE="Submit Order For Processing"
+SRC="$my_submit" border=0>
+&nbsp;&nbsp;&nbsp;&nbsp;
+<a href="agora.cgi?order_form_button.x=1&cart_id=${cart_id}">
+<IMG SRC="$my_change" BORDER=0></a>
+</FORM>
 </CENTER>
 </TD>
 </TR>
-</TABLE>
-
-</TD>
-</TR>
-</TABLE>
-
-</FORM>
+</table>
+</FONT>
 </CENTER>
-
 ENDOFTEXT
 
 }
@@ -274,6 +351,13 @@
 local($stevo_shipping_thing) = "";
 local($stevo_shipping_names) = "";
 local($ship_thing_too,$ship_instructions);
+local(%orderLoggingHash);
+
+#alt origination stuff added by Mister Ed Feb 17, 2005
+if ($sc_alt_origin_enabled =~ /yes/i) {
+	local(%zip_list);
+	local(%zip_names_list);
+}
 
 &load_verify_file;
 
@@ -317,7 +401,8 @@
       ($result =~ /iTransact/i)) {
     $verification = "Passed GNU Privacy Guard signature verification.";
    } else {
-    $verification = "Could not verify iTransact signature because:\n$result\n";
+    $verification = "$result\n";
+# Could not verify iTransact signature because:\n$result\n";
    }
  }
 
@@ -333,7 +418,7 @@
       ($result =~ /iTransact/i)) {
     $verification = "Passed PGP signature verification.";
    } else {
-#    $verification = "Could not verify iTransact signature because:\n$result\n";
+#    $verification = "\n$result\n";
    }
  }
 
@@ -343,21 +428,25 @@
   $verification .= "\nWARNING! CART ID DOES NOT MATCH EXPECTED VALUE!!\n\n";
  }
 
+# NEW CODEHOOK
+&codehook("process-order-routine-top");
+
 $orderDate = &get_date;
 
 print qq!
-<HTML>
+<html>
 $sc_special_page_meta_tags
 <HEAD>
-<TITLE>$messages{'ordcnf_08'}</TITLE>
-$sc_standard_head_info</HEAD>
-<BODY $sc_standard_body_info>
+<title>$messages{'ordcnf_08'}</title>
+$sc_secure_standard_head_info</head>
+<body>
 !;
 
-&StoreHeader;
+&SecureStoreHeader;
 
 $text_of_cart .= "Order Date:    $orderDate\n";
 $text_of_cart .= "Gateway:       iTransact\n\n";
+$orderLoggingHash{'GatewayUsed'} = "iTransact";
 
 $text_of_cart .= "  --PRODUCT INFORMATION--\n\n";
 
@@ -381,6 +470,62 @@
 }
 close(CART);
 
+# initialize hash variables in case they are empty later
+# added by jfindlay 2006 February
+
+$orderLoggingHash{'firstName'} = "";
+$orderLoggingHash{'lastName'} = "";
+$orderLoggingHash{'fullName'} = "";
+$orderLoggingHash{'orderFromAddress'} = "";
+$orderLoggingHash{'customerAddress2'} = "";
+$orderLoggingHash{'customerAddress3'} = "";
+$orderLoggingHash{'orderFromCity'} = "";
+$orderLoggingHash{'orderFromPostal'} = "";
+$orderLoggingHash{'customerPhone'} = "";
+$orderLoggingHash{'companyName'} = "";
+$orderLoggingHash{'emailAddress'} = "";
+
+$orderLoggingHash{'shipToName'} = "";
+$orderLoggingHash{'shipToAddress'} = "";
+$orderLoggingHash{'shipToAddress2'} = "";
+$orderLoggingHash{'shipToAddress3'} = "";
+$orderLoggingHash{'shipToCity'} = "";
+$orderLoggingHash{'shipToState'} = "";
+$orderLoggingHash{'shipToPostal'} = "";
+$orderLoggingHash{'shipToCountry'} = "";
+$orderLoggingHash{'shiptoResidential'} = $eform_Ecom_is_Residential;
+$orderLoggingHash{'insureShipment'} = $eform_Ecom_ShipTo_Insurance; # not implemented yet, for the future
+
+$orderLoggingHash{'invoiceNumber'} = "";
+$orderLoggingHash{'customerNumber'} = "";
+$orderLoggingHash{'orderStatus'} = "$sc_order_status_default";
+$orderLoggingHash{'user1'} = "";
+$orderLoggingHash{'user2'} = "";
+$orderLoggingHash{'user3'} = "";
+$orderLoggingHash{'user4'} = "";
+$orderLoggingHash{'user5'} = "";
+$orderLoggingHash{'itemsordered'} = "";
+$orderLoggingHash{'shiptrackingID'} = "";
+$orderLoggingHash{'shipMethod'} = "";
+$orderLoggingHash{'orderFromState'} = "";
+$orderLoggingHash{'orderFromCountry'} = "";
+$orderLoggingHash{'shippingTotal'} = "";
+$orderLoggingHash{'salesTax'} = "";
+$orderLoggingHash{'tax1'} = "";
+$orderLoggingHash{'tax2'} = "";
+$orderLoggingHash{'tax3'} = "";
+$orderLoggingHash{'discounts'} = "";
+$orderLoggingHash{'netProfit'} = "";
+$orderLoggingHash{'affiliateTotal'} = "";
+$orderLoggingHash{'affiliateID'} = "";
+$orderLoggingHash{'affiliateMisc'} = "";
+$orderLoggingHash{'subTotal'} = "";
+$orderLoggingHash{'orderTotal'} = "";
+$orderLoggingHash{'adminMessages'} = "";
+$orderLoggingHash{'shippingMessages'} = "";
+$orderLoggingHash{'xcomments'} = "";
+$orderLoggingHash{'termsOfService'} = "$vform_Ecom_tos";
+
 $sc_orderlib_use_SBW_for_ship_ins = $sc_use_SBW;
 &codehook("orderlib-ship-instructions");
 if ($sc_orderlib_use_SBW_for_ship_ins =~ /yes/i) {
@@ -388,6 +533,8 @@
    &ship_put_in_boxes($stevo_shipping_thing,$stevo_shipping_names,
    $sc_verify_Origin_ZIP,$sc_verify_boxes_max_wt); 
  }
+$orderLoggingHash{'shippingMessages'} = "$ship_instructions";
+$orderLoggingHash{'shippingMessages'} =~ s/\n/<br>/g;
 
 $text_of_confirm_email .= $messages{'ordcnf_07'};
 
@@ -395,27 +542,40 @@
 
 $text_of_cart .= "  --ORDER INFORMATION--\n\n";
 
-$text_of_cart .= "VERIFICATION:  $verification\n";
+# $text_of_cart .= "VERIFICATION:  $verification\n";
 $text_of_cart .= "CUST ID:       $itrans{'p4'}\n";
 $text_of_confirm_email .= "CUST ID:       $itrans{'p4'}\n";
+$orderLoggingHash{'customerNumber'} = "$itrans{'p4'}";
 
 $text_of_cart .= "ORDER ID:      $itrans{'p5'}\n";
 $text_of_confirm_email .= "ORDER ID:      $itrans{'p5'}\n";
+$orderLoggingHash{'invoiceNumber'} = "$itrans{'p5'}";
 
 if ($itrans{'p1'})
 {
-$text_of_cart .= "SHIPPING:      $itrans{'p1'}\n";
-$text_of_confirm_email .= "SHIPPING:      $itrans{'p1'}\n";
+$text_of_cart .= "SHIPPING:      " . &format_price($sc_verify_shipping) . "\n";
+$text_of_confirm_email .= "SHIPPING:      " . &format_price($sc_verify_shipping) . "\n";
+$orderLoggingHash{'shippingTotal'} = &format_price($sc_verify_shipping);
 }
-if ($sc_use_SBW =~ /yes/i)
-{
- $text_of_confirm_email .= "SHIP VIA:      $itrans{'Ecom_ShipTo_Method'}\n";
+
+if (($sc_use_SBW =~ /yes/i) || ($form_data{'x_Freight'} > .009)) {
+ $text_of_confirm_email .= "SHIP VIA:      $eform_Ecom_ShipTo_Method\n";
 }
 
-if ($itrans{'p2'})
-{
-$text_of_cart .= "DISCOUNT:      $itrans{'p2'}\n";
-$text_of_confirm_email .= "DISCOUNT:      $itrans{'p2'}\n";
+ $orderLoggingHash{'shipMethod'} = $eform_Ecom_ShipTo_Method;
+
+  $temp = &format_price($sc_verify_subtotal);
+  &add_text_of_both("SUBTOTAL",$temp);
+  $orderLoggingHash{'subTotal'} = &format_price($sc_verify_subtotal);
+
+if ($sc_verify_discount) {
+  $temp = &format_price($sc_verify_discount);
+  &add_text_of_both("DISCOUNT",$tempt);
+  $orderLoggingHash{'discounts'} = &format_price($sc_verify_discount);
+  # start of adjustments for discount addon
+  $text_of_cart .= "DISCOUNT CODE: $eform_Ecom_Discount\n";
+  $text_of_confirm_email .= "DISCOUNT CODE: $eform_Ecom_Discount\n";
+  # end of adjustments for discount addon
 }
 
 if ($itrans{'p3'})
@@ -429,57 +589,138 @@
 $temp = substr(substr("SALES TAX",0,13).":               ",0,15);
 $text_of_cart .= "$temp$sc_verify_tax\n";
 $text_of_confirm_email .= "$temp$sc_verify_tax\n";
+$orderLoggingHash{'salesTax'} = "$sc_verify_tax";
 }
 if ($sc_verify_etax1 > 0)
 {
 $temp = substr(substr($sc_extra_tax1_name,0,13).":               ",0,15);
 $text_of_cart .= "$temp$sc_verify_etax1\n";
 $text_of_confirm_email .= "$temp$sc_verify_etax1\n";
+$orderLoggingHash{'tax1'} = "$sc_verify_etax1";
 }
 if ($sc_verify_etax2 > 0)
 {
 $temp = substr(substr($sc_extra_tax2_name,0,13).":               ",0,15);
 $text_of_cart .= "$temp$sc_verify_etax2\n";
 $text_of_confirm_email .= "$temp$sc_verify_etax2\n";
+$orderLoggingHash{'tax2'} = "$sc_verify_etax2";
 }
 if ($sc_verify_etax3 > 0)
 {
 $temp = substr(substr($sc_extra_tax3_name,0,13).":               ",0,15);
 $text_of_cart .= "$temp$sc_verify_etax3\n";
 $text_of_confirm_email .= "$temp$sc_verify_etax3\n";
+$orderLoggingHash{'tax3'} = "$sc_verify_etax3";
 }
 
-$text_of_cart .= "TOTAL:         $itrans{'p6'}\n\n";
-$text_of_confirm_email .= "TOTAL:         $itrans{'p6'}\n\n";
+$text_of_cart .= "TOTAL:         $itrans{'total'}\n\n";
+$text_of_confirm_email .= "TOTAL:         $itrans{'total'}\n\n";
+$orderLoggingHash{'orderTotal'} = "$itrans{'total'}"; #$sc_verify_grand_total";
 
 $text_of_cart .= "AUTH CODE      $itrans{'authcode'}\n";
 $text_of_cart .= "TIME:          $itrans{'when'}\n";
 $text_of_cart .= "TRANS ID:      $itrans{'xid'}\n\n";
 $text_of_cart .= "BILLING INFORMATION --------------\n\n";
+
 $text_of_cart .= "NAME:          $itrans{'first_name'} $itrans{'last_name'}\n";
+$orderLoggingHash{'fullName'} = "$itrans{'first_name'} $itrans{'last_name'}";
+$orderLoggingHash{'firstName'} = "$itrans{'first_name'}";
+$orderLoggingHash{'lastName'} = "$itrans{'last_name'}";
+
 $text_of_cart .= "ADDRESS:       $itrans{'address'}\n";
+$orderLoggingHash{'orderFromAddress'} = "$itrans{'address'}";
+
 $text_of_cart .= "CITY:          $itrans{'city'}\n";
+$orderLoggingHash{'orderFromCity'} = "$itrans{'city'}";
+
 $text_of_cart .= "STATE:         $itrans{'state'}\n";
+$orderLoggingHash{'orderFromState'} = "$itrans{'state'}";
+
 $text_of_cart .= "ZIP:           $itrans{'zip'}\n";
+$orderLoggingHash{'orderFromPostal'} = "$itrans{'zip'}";
+
 $text_of_cart .= "COUNTRY:       $itrans{'country'}\n";
+$orderLoggingHash{'orderFromCountry'} = "$itrans{'country'}";
+
 $text_of_cart .= "PHONE:         $itrans{'phone'}\n";
+$orderLoggingHash{'customerPhone'} = "$itrans{'phone'}";
+
 $text_of_cart .= "EMAIL:         $itrans{'email'}\n\n";
+$orderLoggingHash{'emailAddress'} = "$itrans{'email'}";
+
 $text_of_cart .= "SHIPPING INFORMATION --------------\n\n";
+
+if ($itrans{'slname'} ne'') {
 $text_of_cart .= "NAME:          $itrans{'sfname'} $itrans{'slname'}\n";
+$orderLoggingHash{'shipToName'} = "$itrans{'sfname'} $itrans{'slname'}";
+} else {
+$text_of_cart .= "NAME:          $itrans{'first_name'} $itrans{'last_name'}\n";
+$orderLoggingHash{'shipToName'} = "$itrans{'first_name'} $itrans{'last_name'}";
+}
+
+if ($itrans{'saddr'} ne'') {
 $text_of_cart .= "ADDRESS:       $itrans{'saddr'}\n";
+$orderLoggingHash{'shipToAddress'} = "$itrans{'saddr'}";
+} else {
+$text_of_cart .= "ADDRESS:       $itrans{'address'}\n";
+$orderLoggingHash{'shipToAddress'} = "$itrans{'address'}";
+}
+
+if ($itrans{'scity'} ne'') {
 $text_of_cart .= "CITY:          $itrans{'scity'}\n";
+$orderLoggingHash{'shipToCity'} = "$itrans{'scity'}";
+} else {
+$text_of_cart .= "CITY:          $itrans{'city'}\n";
+$orderLoggingHash{'shipToCity'} = "$itrans{'city'}";
+}
+
+if ($itrans{'sstate'} ne'') {
 $text_of_cart .= "STATE:         $itrans{'sstate'}\n";
+$orderLoggingHash{'shipToState'} = "$itrans{'sstate'}";
+} else {
+$text_of_cart .= "CITY:          $eform_Ecom_ShipTo_Postal_StateProv\n";
+$orderLoggingHash{'shipToState'} = "$eform_Ecom_ShipTo_Postal_StateProv";
+}
+
+if ($itrans{'szip'} ne'') {
 $text_of_cart .= "ZIP:           $itrans{'szip'}\n";
+$orderLoggingHash{'shipToPostal'} = "$itrans{'szip'}";
+} else {
+$text_of_cart .= "ZIP:           $eform_Ecom_ShipTo_Postal_PostalCode\n";
+$orderLoggingHash{'shipToPostal'} = "$eform_Ecom_ShipTo_Postal_PostalCode";
+}
+
+if ($itrans{'sctry'} ne'') {
 $text_of_cart .= "COUNTRY:       $itrans{'sctry'}\n\n";
+$orderLoggingHash{'shipToCountry'} = "$itrans{'sctry'}";
+} else {
+$text_of_cart .= "COUNTRY:       $vform_Ecom_ShipTo_Postal_CountryCode\n";
+$orderLoggingHash{'shipToCountry'} = "$vform_Ecom_ShipTo_Postal_CountryCode";
+}
+
 if ($sc_use_SBW =~ /yes/i) {
   $text_of_cart .= "SHIP VIA:      $itrans{'Ecom_ShipTo_Method'}\n";
  }
+
+# NEW CODEHOOK
+&codehook("process-order-pre-ship-instructions");
+
 if ($ship_instructions ne "") {
   $text_of_cart .= "Shipping Instructions: \n$ship_instructions\n\n";
  }
 
+# NEW CODEHOOK
+&codehook("process-order-pre-xcomments");
+
 $text_of_cart .= $XCOMMENTS_ADMIN;
+$orderLoggingHash{'adminMessages'} = "$XCOMMENTS_ADMIN";
+$orderLoggingHash{'adminMessages'} =~ s/\n/<br>/g;
+$orderLoggingHash{'adminMessages'} =~ s/\t/ /g;
+$orderLoggingHash{'adminMessages'} .= "<br>AUTHORIZATION INFORMATION --------------<br>AUTH CODE:  $itrans{'authcode'}<br>TIME:  $itrans{'when'}<br>TRANS ID:  $itrans{'xid'}<br>---------------------------------------------------------------<br>";
 $text_of_confirm_email .= $XCOMMENTS;
+$orderLoggingHash{'xcomments'} = "$XCOMMENTS";
+$orderLoggingHash{'xcomments'} =~ s/\n/<br>/g;
+$orderLoggingHash{'adminMessages'} =~ s/\t/ /g;
 
 # 'Init' the emails ...
 $text_of_cart = &init_shop_keep_email . $text_of_cart;
@@ -495,8 +736,10 @@
   $text_of_cart = "\n" . $text_of_cart . "\n";
  }
 
+$sc_itransact_order_desc .= " - " . $itrans{'p5'};
+
 if ($sc_send_order_to_email =~ /yes/i) {
-  &send_mail($sc_admin_email, $sc_order_email, "Agora.cgi Order",$text_of_cart);
+  &send_mail($sc_admin_email, $sc_order_email, $sc_itransact_order_desc, $text_of_cart);
  }
 
 &log_order($text_of_cart,$itrans{'p5'},$itrans{'p4'});
@@ -506,7 +749,13 @@
            "$text_of_confirm_email");
  }
 $sc_affiliate_order_unique = $itrans{'p5'};
-$sc_affiliate_order_total = $itrans{'p6'};
+$sc_affiliate_order_total = $itrans{'total'};
+
+$sc_affiliate_image_call =~ s/AMOUNT/$sc_affiliate_order_total/g;
+$sc_affiliate_image_call =~ s/UNIQUE/$sc_affiliate_order_unique/g;
+
+# NEW CODEHOOK
+&codehook("process-order-display-thankyou-page");
   
 print <<ENDOFTEXT;
 <CENTER>
@@ -531,7 +780,7 @@
 
 # and the footer is printed
 
-&StoreFooter;
+&SecureStoreFooter;
 
 print qq!
 </BODY>
diff -ruN 4.0K-4b/library/index.html 5.0.000/library/index.html
--- 4.0K-4b/library/index.html	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -1,4 +1,4 @@
-br><br><center>forwarding to the store ....</center>
+<br><br><center>forwarding to the store ....</center>
 <script><!--
 
 setTimeout("window.location.href='../agora.cgi'",0)
diff -ruN 4.0K-4b/library/mail-lib.pl 5.0.000/library/mail-lib.pl
--- 4.0K-4b/library/mail-lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/mail-lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -5,16 +5,64 @@
 # Date Created: 2-22-96
 # Date Last Modified: 5-5-96
 
-$versions{'mail-lib.pl'} = "19960505+";
+$versions{'mail-lib.pl'} = "5.0.000";
 
 #
 #   You may copy this under the terms of the GNU General Public
 #   License or the Artistic License which is distributed with
 #   copies of Perl v5.x for UNIX.
 #
+# Purpose: Provides a set of library routines to send email
+# over the internet.  
+#
+# Main Procedures:
+#  real_send_mail - flexible way to send email
+#  send_mail - easier to use version of send_mail
+#
+# Special Notes: Script is UNIX Specific and ties into the 
+# Sendmail Program which is usually located in /usr/lib or
+# /usr/bin.
+# 
+# Also, remember to escape @ signs with a backslash (\@) 
+# for compatibility with PERL 5.
+#
+# Change the $mail_program variable to change location of your
+# sendmail program
+#
 ############################################################
+
+# $mail_program is the mail program used to send mail
+# with the full path.  
+#
+# The -t flag tells sendmail to
+# look for To:, From:, Subject: header lines in the
+# mail message to determine the addresses to send to.
+#
+# NOTE: BY DEFAULT, I AM NOT USING -n and -f flags.
+#
+# -n is not supported by QMAILs sendmail replacement.
+#
+# -f is useful for special cases and can be added as needed.
+#
+# The -n flag tells sendmail not to use the alias list
+# for the UNIX server.  We do not want outsiders using
+# the alias list of the webserver in most cases.
+#
+# The -f flag followed by an email address of your choice
+# basically tells sendmail that this email address
+# should have bounced mails forwarded. Use of this flag
+# was suggested by Ignacia Bustamante.
+#
 $flags = "-t";
 
+# The following code checks for versions of
+# sendmail and lets the user know if one of the
+# default locations does not exist.
+#
+# The code for this trick was donated by Scott Wimer
+# with some slight modification by Gunther for command
+# line flag flexibility at the end
+
 $mailer0 = '/usr/lib/sendmail';
 $mailer1 = '/usr/bin/sendmail';
 $mailer2 = '/usr/sbin/sendmail';
@@ -38,13 +86,39 @@
     exit;
 }
 
+# Add the command line flags
 $mail_program = "$mail_program $flags ";
 
 ############################################################
+#
+# subroutine: real_send_mail 
+#   Usage:
+#     &send_mail("me@myhouse.com","myhouse.com","you@yourhouse.com",
+#     "yourhouse.com", "Mysubject", "My message");
+#
+#   Parameters:
+#     $fromuser = Full Email address of sender
+#     $fromsmtp = Full Internet Address of sender's SMTP Server
+#     $touser   = Full Email address of receiver
+#     $tosmtp   = Full Internet Address of receiver's SMTP Server
+#     $subject  = Subject of message
+#     $messagebody = Body of message including newlines.
+#
+#   Output:
+#     None
+############################################################
+
 sub real_send_mail {
     local($fromuser, $fromsmtp, $touser, $tosmtp, 
       $subject, $messagebody) = @_;
 
+# First we need to start the mail program and open
+# a PIPE to the program so that anything 
+# we print to the filehandle, goes to the running
+# program.
+
+# The path manipulation is to satisfy taint mode
+
     local($old_path) = $ENV{"PATH"};
 
     $ENV{"PATH"} = "";
@@ -54,6 +128,21 @@
 
     $ENV{"PATH"} = $old_path;
 
+# Print the mail message to the Mail Program
+# using the HERE Document method
+#
+
+# Note: SOME ISPs may have a faulty
+# sendmail implementation that does
+# not recognize the From: header unless 
+# the order of these is changed from
+# To: From: Subject:
+# to 
+# Subject: To: From: 
+#
+# This was pointed out by Paul Tate.
+#
+
     print MAIL <<__END_OF_MAIL__;
 To: $touser
 From: $fromuser
@@ -65,33 +154,80 @@
 
     close (MAIL);
 
-} 
+} #end of real_send_mail
+
 ############################################################
+#
+# subroutine: send_mail 
+#   Usage:
+#     &send_mail("me@myhouse.com","you@yourhouse.com",
+#     "Mysubject", "My message");
+#
+#   Parameters:
+#     $fromuser = Full Email address of sender
+#     $touser   = Full Email address of receiver
+#     $subject  = Subject of message
+#     $messagebody = Body of message including newlines.
+# 
+#   Output:
+#     None
+#
+############################################################
+
 sub send_mail {
     local($from, $to, $subject, $messagebody) = @_;
 
     local($fromuser, $fromsmtp, $touser, $tosmtp);
 
+# This routine takes the simpler parameters of 
+# send_mail and breaks them up into the parameters
+# to be sent to real_send_mail.
+# 
     $fromuser = $from;
     $touser = $to;
 
-
+#
+# Split is used to break the address up into
+# user and hostname pairs.  The hostname is the
+# 2nd element of the split array, so we reference
+# it with a 1 (since arrays start at 0).
+#
     $fromsmtp = (split(/\@/,$from))[1];
     $tosmtp = (split(/\@/,$to))[1];
 
+# Actually call the sendmail routine with the
+# newly generated parameters
+#
     &real_send_mail($fromuser, $fromsmtp, $touser, 
            $tosmtp, $subject, $messagebody);
 
-} 
+} # End of send_mail
+
+############################################################
+#
+# subroutine: web_error
+#   Usage:
+#     &web_error("File xxx could not be opened");
+#
+#   Parameters:
+#     $error = Description of Web Error
+#
+#   Output:
+#     None
+# 
 ############################################################
+
 sub web_error {
     local ($error) = @_;
     $error = "Error Occured: $error";
     print "$error<p>\n";
 
+# Die exits the program prematurely and prints an error to
+# stderr
+
     die $error;
 
-} 
+} # end of web_error
 
 1;
 
diff -ruN 4.0K-4b/library/pgp-lib.pl 5.0.000/library/pgp-lib.pl
--- 4.0K-4b/library/pgp-lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/pgp-lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -11,7 +11,7 @@
 # Modified: 1-25-2000 SPK -- for use with GPG
 # Modified: 3-10-2000 SPK -- add update_error_log code
 
-$versions{'pgp-lib.pl'} = "20000310"; # last modification date
+$versions{'pgp-lib.pl'} = "5.0.000";
 
 #
 # Copyright Info: This library was written by Gunther Birznieks    
@@ -24,7 +24,36 @@
 #       appreciated and will be spent on further upgrades and other public
 #       domain scripts.
 #
+# Purpose: Provides a set of library routines to interface with
+#   PGP to create an encrypted buffer
+#
+# MAIN PROCEDURE:
+#  make_pgp_file - makes a pgp encrypted file and sends its
+#                  contents back to the user
+#
+# Special Notes: Script ties into the pgp executable whose
+#  location is specified in the variables below.
+#
+# *** THIS VERSION OF PGP-LIB.PL WAS MODIFIED TO WORK WITH PGP version 5
+# *** ON LINUX
+#
+# *** modified to work woth GPG or PGP by Steve Kneizys 1/19/2000
+# *** tested with PGP freeware 5.0i and GPG 1.01
+# *** NOTE: command line flags have changed over time!!!  I had
+# *** to add the +batchmode=1 +nobatchinvalidkeys=off flags for
+# *** Linux PGP 5.0i even though originally they were not there
+# *** to allow keys that did not have trusted keys 
+# 
+# VARIABLES:
+#  $pgp_path = path to PGP executable
+#  $pgp_options = command line options to the PGP program
+#  $pgp_public_key_user_id = which key to use for encrypting
+#  $pgp_config_files = path where configuration files are located 
+#  $sc_pgp_or_gpg global variable is either "GPG" or "PGP"
+#  $sc_pgp_order_email global variable determines the public key used
+#
 ############################################################
+
 $pgp_config_files = "./pgpfiles";
 $pgp_public_key_user_id = $sc_pgp_order_email;
 
@@ -37,18 +66,57 @@
  }
 
 ############################################################
+#
+# subroutine: make_pgp_file
+#   Usage:
+#     &make_pgp_file($output_text, $output_file);
+# 
+#   Parameters:
+#     $output_text = unecrypted text that you want to scramble
+#     $output_file = name of a file that you will use to
+#                    temporarily create the encryption. It
+#                    will be removed after it is created
+#                    and its contents are assigned to a buffer.
+#
+#   Output:
+#     $pgp_output = the encrypted text that was stored in
+#          the $output_file results of running PGP
+############################################################
+
 sub make_pgp_file 
 {
 
 local($output_text, $output_file) = @_;  
 local($pgp_output,$pre_pgp_output) = "";
 
+# Set the PGPPATH environment to tell
+# PGP *not* to go to the Web Server User's
+# home directory by default to look for key
+# files and public keys
+#
+
 $ENV{"PGPPATH"} = $pgp_config_files;
 
+# Generate the command that needs to be used
+# to execute PGP. This consists of the PGP 
+# executable followed by command line options
+# which is followed by the user id which you
+# want to use a public key for and then output
+# the encrypted results to an output file.
+#
+
 $pgp_command  = "$pgp_path $pgp_options ";
 $pgp_command .= "$pgp_public_key_user_id ";
 $pgp_command .= "$pgp_second_options ";
 
+# The command is opened using the special
+# file open PIPE command which EXECUTES the
+# command and then allows PERL to print to
+# it as input for the command.
+#
+# The path manipulation is to satisfy taint mode
+# 
+ 
 local($old_path) = $ENV{"PATH"};
 $ENV{"PATH"} = "";
 
@@ -61,6 +129,7 @@
  
 $ENV{"PATH"} = $old_path;
 
+# helpful for some folks
 if ($sc_pgp_change_newline eq '\r\n') {
   $output_text =~ s/\n/\r\n/g;
  }
@@ -71,6 +140,9 @@
   $output_text =~ s/\n/\r/g;
  }
 
+# The text you want to encrypt is sent to
+# the command.
+
 print PGPCOMMAND $output_text;
 
 close (PGPCOMMAND);
@@ -82,6 +154,10 @@
 close (SAVEERR) || die ("Error closing SAVEERR");
 close (SAVEOUT) || die ("Error closing SAVEOUT");
 
+# The resulting output file is opened,
+# read into $pgp_output and closed.
+#
+
 open(PGPOUTPUT, $output_file);
 
 my $insidepgp = 0;
@@ -114,12 +190,19 @@
 &update_error_log("PGP problem: $pre_pgp_output",__FILE__,__LINE__);
 }
 
+# we remove the temporary file
+
 unlink($output_file);
 
+# we return pgp output
+
 return($pgp_output);
 
+# End of make_pgp_file
 
 }
 
+# We always return TRUE from requiring
+# a library file (1;)
 
 1;
diff -ruN 4.0K-4b/library/send-mail-lib.pl 5.0.000/library/send-mail-lib.pl
--- 4.0K-4b/library/send-mail-lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/send-mail-lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,38 +1,99 @@
 ############################################################
 #                       SEND-MAIL-LIB.PL
 #
-# This script was written by Steve Kneizys for agora.cgi
-$versions{'send-mail-lib.pl'} = "200211020";
+# This script was written by Steve Kneizys for AgoraCart
+# Copyright 1999-2005 K-Factor Technologies, Inc
+# at http://www.AgoraCart.com
+
+$versions{'send-mail-lib.pl'} = "5.0.000";
+
 #
 #   You may copy this under the terms of the GNU General Public
 #   License or the Artistic License which is distributed with
 #   copies of Perl v5.x for UNIX.
 #
+# Purpose: Provides a set of library routines to send email
+# over the internet using the perl module "Mail::Sendmail".
+#
+# Main Procedure:
+#  send_mail - drop in replacement for standard routine.
+#
+# TO USE THIS LIBRARY:
+# Global variables need to be set, this can be done in the 
+# agora.setup.db file or in the free-form logic in the manager.
+# Set global variable $smtp_host if not 'localhost'.
+# Set the global variable for the mail library:
+#   $sc_mail_lib_path = "$sc_lib_dir/send-mail-lib.pl";
+#
+# Mark S. (MAS) Contribution/Revision 07/17/2004.  A pro member.
+# * Updated to conform to Sendmail 0.78. 
+# * Fixed bug that would have forced into always using
+#  'localhost' as smtp host. 
+# * Fixed hash key problems that would have caused multiple 
+#   content-types to appear in header. 
+# * Added code to allow hacks to add content type to 
+#   subject
+#----------------------------------------------------------
+# Structured and minor cosmetic changes by Mister Ed 08/2004
 ############################################################
 
 use MIME::QuotedPrint;
-use Mail::Sendmail 0.75;
+use Mail::Sendmail 0.78;
 
 ############################################################
+#
+# subroutine: send_mail 
+#   Usage: (send from me to you)
+#     &send_mail("me@myhouse.com","you@yourhouse.com",
+#     "Mysubject", "My message");
+#
+#   Parameters:
+#     $smtp_from    = Full Email address of sender
+#     $smtp_to      = Full Email address of receiver
+#     $smtp_subject = Subject of message
+#     $smtp_text    = Body of message including newlines.
+# 
+#   Output:
+#     None, unless there is an error
+#
+############################################################
+
 sub send_mail {
 local($smtp_from, $smtp_to, $smtp_subject, $smtp_text) = @_;
-local($smtp_host,%mail,$boundary,$plain);
+local(%mail,$boundary,$plain);
+local $regcaps;
+local $smtp_host = $smtp_host ? $smtp_host : 'localhost';
 
-$smtp_host = 'localhost' if (!($smtp_host));
 $boundary = "====" . time() . "====";
-%mail = (
-         SMTP => $smtp_host,
-         from => $smtp_from,
-         to => $smtp_to,
-         subject => $smtp_subject,
-         'content-type' => "multipart/alternative; boundary=\"$boundary\""
+
+# Key hashes are case sensive. Sendmail.pm needs Content-Type and Smtp
+%mail = (Smtp => $smtp_host,
+         From => $smtp_from,
+         To => $smtp_to,
+         Subject => $smtp_subject,
+         'Content-Type' => "multipart/alternative; boundary=\"$boundary\""
         );
+
 $plain = encode_qp $smtp_text;
 $boundary = '--'.$boundary;
 
+# Following sets default content type (text/plain)
+local $contentType = 'Content-Type: text/plain; charset="iso-8859-1"';
+
+# Not everyone may want this, but these lines allow
+# certain hacks to use the subject line to override default content type
+# but only if $sc_use_dynamic_email_subjects is set to yes in store manager settings.
+
+ if  ((@regcaps = ($smtp_subject =~ /Content-Type: (.+)/i )) && ($sc_use_dynamic_email_subjects eq "yes")) {
+    $contentType = $regcaps[0] ;
+    $mail{Subject} =~ s/Content-Type:.+//i ;
+}
+
+
+# create it
 $mail{body} = <<END_OF_BODY;
 $boundary
-Content-Type: text/plain; charset="iso-8859-1"
+Content-Type: $contentType
 Content-Transfer-Encoding: quoted-printable
 
 $plain
@@ -40,8 +101,7 @@
 $boundary--
 END_OF_BODY
 
-sendmail(%mail) || &send_mail_lib_error("Error: $Mail::Sendmail::error",
-	__FILE__,__LINE__);
+ sendmail(%mail) || die("Send mail failed %s -- %s",__FILE__,__LINE__) ;
 
 }
 ##########
diff -ruN 4.0K-4b/library/shipping_lib.pl 5.0.000/library/shipping_lib.pl
--- 4.0K-4b/library/shipping_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/shipping_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,11 +1,15 @@
 #!/usr/local/bin/perl
-# Simple Library  -- can use the "lynx" command line program to 
-# use as a replacement for using SOCKETS in perl with small changes.
+
+# split out ups xml into userfiles and separate shipping file
+
+# For use with AgoraCart (aka agora.cgi) only.
 #
-# Parts stolen from Business:UPS CPAN  module and included here
+# Parts taken from Business:UPS CPAN  module and included here
 # because that module if often not installed at Web hosting companies
 # 
 # written by Steve Kneizys Jan 9, 2000
+# Modified and Maintained by Mister Ed at K-Factor Technologies, Inc / AgoraCart.com
+# Copyright 2002-Present by K-Factor Technologies, Inc & AgoraScript
 #
 # Modified 1/21/2000 to use http-lib.pl as some folks do not 
 # have LWP or lynx installed at their web hosting company
@@ -20,17 +24,29 @@
 # Modified 08/17/2000 UPS Interface w LWP fixed
 # Modified 05/06/2001 UPS Interface fixed, uses 'old' code again 
 # Modified 05/11/2001 Includes 'value of items' in 'shipping thing' string
-#
+# Modifications by Mister Ed at K-Factor Technologies, Inc / AgoraCart.com
+# Modified 03/07/2003 Fixed parcel machine codes - USPS.
+# Modified 10/24/2003 Fixed multiple boxes for USPS.  Streamlined minor redundancy.
+# 	UPS: Also added fuel tax charges of 2%.  error checking to make sure international
+# 	shipping methods and Canadian are correct for method and country for UPS.
+# Modified 01/26/2005 Added UPS XML and international shipping with origins as an add-on for members only.
+#	above inspired by donated code from Leamsi Fontanez at http://www.bizmanweb.com but significantly revised
+#	DHL shipping foundations added for future expansion into this shipping method
+#	separated DHL, FedEx, and UPS XML shipping methods into separate libraries.
+#	Original UPS simple shipping cost quotes remain and used if UPS XML not enabled.
+# Modified 02/15/2005 Finished above changes and phased out lynx socket options
+# Modified 05/19/2005 Finish Core UPS XML enhancements to work with multiple boxes
+#	and multiple origins. ground work for dimensional aspects included, but needs cart contents overhaul first.
+# Modified 08/16/2005  Added custom logic option to run before or after SBW real-time routines
+#   also added $SBW_shipping_price variable incase real time needs to be deducted in the custom logic after
+#   running real-time SBW
 
-$versions{'shipping_lib.pl'} = "20021020";
-
-# Do we need sockets part of this library ?
+$versions{'shipping_lib.pl'} = "5.0.000";
 if (($sc_use_SBW =~ /yes/i) || ($sc_need_sockets =~ /yes/i)) { 
- if ($sc_use_socket eq "") { # should be set but if not ...
-   $sc_use_socket = "http-lib";   # set our preferred default
+ if ($sc_use_socket eq "") { 
+   $sc_use_socket = "http-lib";   
   }
-
- if ($sc_use_socket =~ /lwp/i) { #helpful (but not required) error check
+ if ($sc_use_socket =~ /lwp/i) { 
     $test_result = eval("use LWP::Simple; 1;");
     if ($test_result ne "1") {
       print "Content-type: text/html\n\n";
@@ -50,29 +66,18 @@
 		"./library/http-lib.pl");
     $http_lib_loaded = "yes";
   }
- if ($sc_use_socket =~ /lynx/i) {
-    $path_to_lynx_software = &get_lynx_path("1");
-  }
 }
 #********************************************************************
-
 sub agora_http_get {
  local ($site,$path,$workString) = @_;
  local ($answer,$doworkString);
-
  if ($sc_use_socket =~ /lwp/i) { # use LWP library GET
-  # By calling this way, no error generated if library is missing
-  # when the library is first loaded up or at runtime of this routine
    $doworkString = "http://$site$path\?${workString}";
    $answer = eval("use LWP::Simple; get\(\"$doworkString\"\);");
   }
- if ($sc_use_socket =~ /http-lib/i) { # use http-lib.pl library GET
+ if ($sc_use_socket =~ /http-lib/i) { 
    $answer = &HTTPGet($path,$site,80,$workString);
   }
- if ($sc_use_socket =~ /lynx/i) { # use lynx to get the answer
-   $doworkString = "http://$site$path\?${workString}";
-   $answer = &special_get($doworkString);
-  }
  return $answer;
 }
 #********************************************************************
@@ -83,18 +88,16 @@
 #
 # It is not very efficient, nor is it very smart!
 #
-
 sub ship_put_in_boxes {
- local($weight_data,$names_data, $Origin_ZIP,$max_per_box) = @_;
- local($instructions, $special_instructions, $items_in_box, $weight_of_box,
-       $new_wt_data, $inx1, $inx2, $junk, $items_this_round, $value_of_box);
- local($continue)="yes";
-
+ my($weight_data,$names_data, $Origin_ZIP,$max_per_box) = @_;
+ my($alt_origin, $instructions, $special_instructions, $items_in_box, $weight_of_box,
+       $new_wt_data, $inx1, $inx2, $zip_list, $origin_product_list, $junk, $items_this_round, $value_of_box) = "";
+ my($continue)="yes";
  $instructions="";
  $special_instructions="";
  &codehook("shippinglib-put-in-boxes-top");
  if (!($continue =~ /yes/i)) { return;}
-
+	if ($Origin_ZIP eq "") { $Origin_ZIP = "Main Location";}
  $instructions  = "Ship By Weight cost was based on the suggested ";
  $instructions .= "configuration below.  It might not be the best way!\n";
  $instructions .= "ORIGIN: $Origin_ZIP\n\n";
@@ -103,13 +106,10 @@
  $weight_of_box = 0;
  $value_of_box = 0;
  $new_wt_data = "";
-
-    ($junk,$weight_data) = split(/\|/,$weight_data,2);
-    @ship_list = split(/\|/,$weight_data);
-    ($junk,$names_data) = split(/\|/,$names_data,2);
-    @name_list = split(/\|/,$names_data);
+   my @ship_list = split(/\|/,$weight_data);
+   @name_list = split(/\|/,$names_data);
     for ($inx1=0; $inx1 <= $#ship_list; $inx1++) {
-      ($item_qty,$item_wt,$item_val,$junk) = split(/\*/,$ship_list[$inx1],4);
+      ($item_qty,$item_wt,$item_val,$alt_origin,$junk) = split(/\*/,$ship_list[$inx1],5);
       $ztitle = $name_list[$inx1];
       $items_this_round = 0;
       for ($inx2=$item_qty; $inx2 > 0; $inx2--) {
@@ -118,18 +118,21 @@
            $weight_of_box = $item_wt;
            $value_of_box = $item_val;
            $items_this_round++;
-          } else { # add to or close/start box
-            if (($weight_of_box + $item_wt) < $max_per_box) { #add
+          } else { 
+            if (($weight_of_box + $item_wt) < $max_per_box) { 
               $items_in_box++;
               $weight_of_box = $weight_of_box + $item_wt;
               $value_of_box = $value_of_box + $item_val;
               $items_this_round++;
-             } else { # close, then start a new box
+             } else { 
               if ($items_this_round > 0) {
                   $instructions .="  $items_this_round $ztitle [$item_wt]\n";
                 }
               $instructions .= " Total Weight: $weight_of_box\n\n";
-              $new_wt_data .= "|1*${weight_of_box}*${value_of_box}";
+              if ($new_wt_data ne "") {
+              	$new_wt_data .= '|';
+              }
+              $new_wt_data .= "1*${weight_of_box}*${value_of_box}*$alt_origin";
               $instructions .= "Next Box:\n";
               $items_in_box = 1;
               $weight_of_box = $item_wt;
@@ -143,708 +146,402 @@
           }
      }
     $instructions .= " Total Weight: $weight_of_box\n\n";
-    $new_wt_data .= "|1*${weight_of_box}*${value_of_box}";
-
+    if ($new_wt_data ne "") {
+    	$new_wt_data .= '|';
+    }
+    $new_wt_data .= "1*${weight_of_box}*${value_of_box}*$alt_origin";
  if ($max_per_box == 0) {
    $instructions = "Put one item in each box.";
   }
-
  $final_instructions =  $special_instructions . $instructions;
  &codehook("shippinglib-put-in-boxes-bot");
  return ($new_wt_data,$final_instructions);
 }
-
+######################################################################
 sub calc_SBW {
-  my ($method, $dest, $weight_data) = @_;
+  my ($method, $dest, $country, $shipping_total, $weight_data) = @_;
   my ($via,$junk);
-
   ($via,$junk) = split(/\ /,$method,2);
- 
-  &codehook("SBW_top");
-
-  if (($via eq "UPS") && ($sc_use_UPS =~ /yes/i)) {
+   &codehook("SBW_top");
+  if (($via =~ /UPS/i) && ($sc_use_UPS =~ /yes/i)) {
+	# modified by Mister Ed 10/24/2003
     $sc_verify_Origin_ZIP = $sc_UPS_Origin_ZIP;
-    return &calc_ups($method, $sc_verify_Origin_ZIP, $dest, $weight_data);
-   }
-
-  if (($via eq "USPS") && ($sc_use_USPS =~ /yes/i)) {
+      	return &calc_ups($method, $sc_verify_Origin_ZIP, $sc_verify_Origin_Country, $dest, $country, $shipping_total, $weight_data);
+  }
+  if (($via =~ /USPS/i) && ($sc_use_USPS =~ /yes/i)) {
     $sc_verify_Origin_ZIP = $sc_USPS_Origin_ZIP;
-    return &calc_usps($method, $sc_verify_Origin_ZIP, $dest, $weight_data);
+    return &calc_usps($method, $sc_verify_Origin_ZIP, $dest, $country, $shipping_total, $weight_data);
    }
-
-  if (($via =~ /FEDEX/i) && ($sc_use_FEDEX =~ /yes/i)) {
-    $sc_verify_Origin_ZIP = $sc_FEDEX_Origin_ZIP;
-    return &calc_fedex($method, $sc_verify_Origin_ZIP, $dest, $weight_data);
-   }
-
   &codehook("SBW_bot");
-
-# got here, this is bad, return zero value
-  return 0;
-
 }
-
+######################################################################
 sub calc_ups {
-    my ($method, $origin, $dest, $weight_data) = @_;
-    my ($err_printed) = "";
-    my ($product, $weight, $ship_cost, $total_weight, $junk,
+    my ($method, $origin, $orgincountry, $dest, $destcountry, $shipping_total, $weight_data) = @_;
+    my ($err_printed,$err,$temp_zip_thingy) = "";
+    my ($product, $alt_origin, $alt_origin_temp, $weight, $ship_cost, $junk,
         $thezone, $errmsg, $foundit,
-        $item_info, $item_wt, $item_qty, $item_cost, @ship_list);
-
-    $ship_cost = 0; # handling charge added in define_shipping_logic
-#
-# Split the order out into boxes using logic of ship_put_in_boxes
-    ($weight_data,$ship_ins) =  
-      &ship_put_in_boxes($weight_data, $weight_data, $origin, $sc_UPS_max_wt);
-    $sc_shipping_thing = $weight_data;
+        $item_info, $item_wt, $item_qty, $item_cost, $box_total_value, @ship_list, $new_weight_data);
+$sc_shipping_thing = "";
+$ship_cost = 0; # handling charge added in define_shipping_logic
+my (%zip_list);
+@ship_list = split(/\|/,$weight_data);
+if (($destcountry =~ /united states/i) || ($destcountry =~ /pr/)) {
+  $destcountry = "US";
+} elsif (($destcountry =~ /cananda/i) || ($destcountry =~ /ca/)) {
+  $destcountry = "CA";
+} elsif (($destcountry =~ /puerto rico/i) || ($destcountry =~ /pr/)) {
+  $destcountry = "PR";
+} 
+#new stuff for alt origination. use even without alt origination. Added by Mister Ed @ AgoraCart.com
+	foreach $ship_list (@ship_list) {
+      ($item_qty,$item_wt,$item_val,$alt_origin,$junk) = split(/\*/,$ship_list,5);
+		if ($alt_origin ne "") {
+			if ($zip_list{$alt_origin} eq "") {
+				$zip_list{$alt_origin} = $ship_list;
+			} else {
+				$temp_zip_thingy = "$zip_list{$alt_origin}";
+				$temp_zip_thingy .= "|" . "$ship_list";
+				$zip_list{$alt_origin} = "$temp_zip_thingy";
+			}
+		} else {
+			if ($zip_list{$origin} eq "") {
+				$zip_list{$origin} = $ship_list;
+			} else {
+				$temp_zip_thingy = "$zip_list{$origin}";
+				$temp_zip_thingy .= "|" . "$ship_list";
+				$zip_list{$origin} = "$temp_zip_thingy";
+			}
+		}
+	}
+# runs each origination. Added by Mister Ed @ AgoraCart.com
+	foreach $origin_product_list (sort (keys %zip_list)) {
+ $weight_data = $zip_list{$origin_product_list};
+    ($new_weight_data,$ship_ins) = &ship_put_in_boxes($weight_data, $weight_data, $origin_product_list, $sc_UPS_max_wt);
+    $sc_shipping_thing .= $new_weight_data;
     $sc_verify_boxes_max_wt = $sc_UPS_max_wt;
-
-#  Now setup the proper UPS PRODUCT code based on web page selection
     $product = "GNDRES"; #default
     $foundit = "no";
-
-    if ($method eq "UPS 2nd Day") {
-       $product = "2DA";
-       $foundit = "yes";
-      }
-    if ($method eq "UPS Next Day") {
-       $product = "1DA";
-       $foundit = "yes";
-      }
     if ($foundit eq "no") { #Look for code: value ="UPS xyz (PRODUCT)"
        ($junk,$stuff) = split(/\(/,$method,2);
        ($stuff,$junk) = split(/\)/,$stuff,2);
-       if ($stuff ne "") { #assume we have a valid product code
+       if ($stuff ne "") { 
           $product = $stuff;
           $foundit = "yes";
          }
       }
-# Split off the total weight calculated
-    ($total_weight,$weight_data) = split(/\|/, $weight_data, 2);
-#
-# calculate the shipping for each box  individually. 
-    @ship_list = split(/\|/,$weight_data);
+    @ship_list = split(/\|/,$new_weight_data);
     foreach $item_info (@ship_list) {
-      ($item_qty,$item_wt,$junk) = split(/\*/,$item_info,3);
+      ($item_qty,$item_wt,$box_total_value,$alt_origin,$junk) = split(/\*/,$item_info,5);
       if ($item_wt <= 1) { # set min value
         $item_wt = 1;
        }
-
-      ($item_cost,$thezone,$errmsg) = 
-        &getUPS_simple($product, $origin, $dest, $item_wt);
-      if ($errmsg ne "") {
-        #sleep(4);
-        ($item_cost,$thezone,$errmsg) = 
-          &getUPS_simple($product, $origin, $dest, $item_wt);
-       }
+	# alt origin checking by Mister Ed Feb 9, 2005
+	if (($alt_origin ne "") && ($sc_alt_origin_enabled =~ /yes/i)) {
+	      ($item_cost,$thezone,$errmsg) = &getUPS_simple($product, $alt_origin, $orgincountry, $dest, $destcountry, $item_wt);
+	} else {
+      		($item_cost,$thezone,$errmsg) = &getUPS_simple($product, $origin, $orgincountry, $dest, $destcountry, $item_wt);
+	}
       if ($errmsg ne "") {
-        #sleep(4);
-        ($item_cost,$thezone,$errmsg) = 
-          &getUPS_simple($product, $origin, $dest, $item_wt);
+      		($item_cost,$thezone,$errmsg) = &getUPS_simple($product, $origin, $orgincountry, $dest, $destcountry, $item_wt);
        }
-      if ($item_cost == 0 && $err_printed eq "") {
+if ($err_printed eq "") {
+# chect to make sure outside of USA and shipping method matches
+# added by Mister Ed Oct- 24-2003
+    if ($destcountry !~ /US/ && $destcountry !~ /united states/i && $product ne "XPR" && $product ne "XDM" && $product ne "XPD" && $product ne "STD") {
+        $err_printed = "yes";
+        $order_error_do_not_finish = "yes";
+# for Canadian destinations
+# added by Mister Ed Oct- 24-2003
+if (($destcountry =~ /CA/ || $destcountry =~ /canada/i ) && $product ne "STD") {
+        print "<br>If shipping to a Canada, Please<br>",
+		"Select a Canadian Shipping Method.<br>\n";
+      }
+# for all other destination countries outside the USA.  Make sure international shipping methods are chosen.
+# added by Mister Ed Oct- 24-2003
+if ($destcountry ne "US" && $destcountry ne "CA" && $destcountry !~ /canada/i && $destcountry !~ /united states/i&& $product ne "XPR" && $product ne "XDM" && $product ne "XPD") {
+        print "<br>If shipping to a location Outside the USA, Please<br>",
+		"Select an International Shipping Method.<br>\n";
+      }  
+} elsif ($item_cost == 0 && $err_printed eq "") {
         $err_printed = "yes";
         $order_error_do_not_finish = "yes";
         print "UPS module error: shipping cost not determined!<br>",
 		"Please use your 'Make Changes' button and correct ",
 		"<br>any fields as required and try again.<br>",
+        "Please contact the site administrator ASAP if error continues<br><br>",
 		"$errmsg<br>\n";
        }
-
-      $ship_cost = $ship_cost + $item_qty*$item_cost;
-
-     }
-
-    return $ship_cost;
 }
-
-######################################################################
-sub calc_usps {
-    my ($method, $origin, $dest, $weight_data) = @_;
-    my ($err_printed,$err) = "";
-    my ($product, $weight, $ship_cost, $total_weight, $junk,
-        $thezone, $errmsg, $foundit,
-        $item_info, $item_wt, $item_qty, $item_cost, @ship_list);
-
-    $ship_cost = 0; 
-
-  ($weight_data,$ship_ins) =  
-	&ship_put_in_boxes($weight_data, $weight_data, $origin, $sc_USPS_max_wt);
-  $sc_shipping_thing = $weight_data;
-
-  $sc_verify_boxes_max_wt = $sc_USPS_max_wt;
-
-  # Look for code: value ="USPS xyz (PRODUCT)"
-  ($junk,$stuff) = split(/\(/,$method,2);
-  ($stuff,$junk) = split(/\)/,$stuff,2);
-  if ($stuff ne "") { 
-     $product = $stuff;
-     $foundit = "yes";
-    }
-  
-    ($total_weight,$weight_data) = split(/\|/, $weight_data, 2);
-
-    @ship_list = split(/\|/,$weight_data);
-    foreach $item_info (@ship_list) {
-      ($item_qty,$item_wt,$junk) = split(/\*/,$item_info,3);
-      if ($item_wt <= 1) { # min
-        $item_wt = 1;
-       }
-
-      ($item_cost,$err) = &getUSPS_simple($product, $origin, $dest, $item_wt);
-
-      if ($item_cost == 0 && $err_printed eq "") {
-        $err_printed = "yes";
-        $order_error_do_not_finish = "yes";
-        print "USPS module error: shipping cost not determined!<br>",
-              "Please use your browser's back button and correct ",
-              "<br>any fields as required and try again.<br><br>$err<br>\n";
-       }
-
-      $ship_cost = $ship_cost + $item_qty*$item_cost;
-
+      $ship_cost += ($item_qty*$item_cost);
      }
-
-    return $ship_cost;
 }
-######################################################################
-
-sub calc_fedex {
-#Federal Express interface module
-# very very similar to UPS,USPS routines
-    my ($method, $origin, $dest, $weight_data) = @_;
-    my ($err_printed,$err) = "";
-    my ($product, $weight, $ship_cost, $total_weight, $junk,
-        $thezone, $errmsg, $foundit, $iter,
-        $item_info, $item_wt, $item_qty, $item_cost, @ship_list);
-
-    $ship_cost = 0; # handling charge added in define_shipping_logic
-#
-# Split the order out into boxes using logic of ship_put_in_boxes
-    ($weight_data,$ship_ins) =  
-      &ship_put_in_boxes($weight_data, $weight_data, $origin, $sc_FEDEX_max_wt);
-
-  $sc_shipping_thing = $weight_data;
-  $sc_verify_boxes_max_wt = $sc_FEDEX_max_wt;
-
-  # Look for product code: value ="FEDEX xyz (PRODUCT)"
-  ($junk,$stuff) = split(/\(/,$method,2);
-  ($stuff,$junk) = split(/\)/,$stuff,2);
-  if ($stuff ne "") { #assume we have a valid product code
-     $product = $stuff;
-     $foundit = "yes";
-    }
-  
-# Split off the total weight calculated
-    ($total_weight,$weight_data) = split(/\|/, $weight_data, 2);
-#
-# calculate the shipping for each box  individually. 
-    @ship_list = split(/\|/,$weight_data);
-    foreach $item_info (@ship_list) {
-      ($item_qty,$item_wt,$junk) = split(/\*/,$item_info,3);
-      if ($item_wt <= 1) { # min value
-        $item_wt = 1;
-       }
-
-       $item_cost="";
-       $iter = 0;
-       while ((!($item_cost > 0)) && ($iter < 10)) {
-         $iter++;
-         ($item_cost,$err)=&getFEDEX_simple($product,$origin,$dest,$item_wt);
-        } 
-
-      if ($item_cost == 0 && $err_printed eq "") {
-        $err_printed = "yes";
-        $order_error_do_not_finish = "yes";
-        print "FEDEX module error: shipping cost not determined!<br>",
-              "Please use your browser's back button and correct ",
-              "<br>any fields as required and try again.<br><br>$err<br>\n";
-       }
-
-      $ship_cost = $ship_cost + $item_qty*$item_cost;
-
-     }
-
+	&codehook("UPS_cost_return");
     return $ship_cost;
 }
-
-################################################################
-#can try to use this if LWP not available andhttp-lib broken ... 
-#maybe lynx is avail for UPS/USPS
-
-sub special_get {
-    local ($spk, $answer, $oldpath, $my_lynx);
-    local ($workString) = @_;
-
-    $spk = $workString;
-    $spk =~ s/\&/\\\&/g;         # need to change & to \& for the shell
-    $oldpath = $ENV{"PATH"};
-    $ENV{"PATH"} = "/bin:/usr/bin";
-    $ENV{"TERM"} = "vt100"; # fool it! 
-    $answer = `$path_to_lynx_software -dump $spk`;#have lynx dump answer
-    $ENV{"PATH"} = $oldpath;
-    $answer =~ s/\n//;          # get rid of first newline char
-    return $answer;
-}
-
-#####################################################################
-
-sub get_lynx_path {
- local($switch) = @_;
- local($lynx_program,$lynx0,$lynx1,$lynx2,$lynx3,$lynx4,$lynx5);
- 
- $lynx0 = './lynx';
- $lynx1 = '/usr/bin/lynx';
- $lynx2 = '/bin/lynx';
- $lynx3 = '/usr/local/bin/lynx';
- $lynx4 = '/usr/sbin/lynx';
- $lynx5 = '/usr/local/lynx/lynx';
-
- if ( -f $lynx0) {
-    $lynx_program = $lynx0;
- } elsif( -f $lynx1){
-    $lynx_program = $lynx1;
- } elsif( -f $lynx2){
-    $lynx_program = $lynx2;
- } elsif( -f $lynx3){
-    $lynx_program = $lynx3;
- } elsif( -f $lynx4){
-    $lynx_program = $lynx4;
- } elsif( -f $lynx5){
-    $lynx_program = $lynx5;
- } else {
-    if ($switch eq "1") {
-      print "Content-type: text/html\n\n";
-      print "I can't find lynx, shutting down...<br>";
-      print "If you find the path to lynx change it in shipping_lib.pl ";
-      &call_exit;
-     } else {
-      $lynx_program = "";
-     }
- }
-
- return $lynx_program;
-
-}
-
-#####################################################################
-
-sub getFEDEX_simple {
-  my ($product, $origin, $dest, $weight) = @_;
-  my ($pounds,$ounces,$prot,$site,$path,$junk,$answer);
-  my ($err,$resp,$resp1,@resp);
-  my ($country , $service, $length, $width, $height, $oversized, $cod);
-#  $country ||= 'US';
-    
-#Taint mode stuff ...
-  $weight=$weight + 0.9999999999; # round up!
-  $weight =~ /(\w+)/;
-  $weight = $1; 
-  $dest =~ /(\w+)/;
-  $dest = $1;
-#    $product =~ /(\w+)/;
-  $product =~ /([\w\ \,]+)/;
-  $product = $1;
-  $origin =~ /(\w+)/; 
-  $origin = $1;
-  $pounds = $weight;
-  $ounces = "0";
-   
-  $site="rate.dmz.fedex.com";
-  $path="/servlet/RateFinderServlet";
-  $workString="";
-  ($ztype,$zsubtype) = split(/\,/,$product,2);
-
-  $workString .= "jsp_name=index";
-  $workString .= "&orig_country=US";
-  $workString .= "&language=english&account=";
-  $workString .= "&portal=xx&heavy_weight=NO";
-  $workString .= "&packet_zip=&hold_packaging=";
-  $workString .= "&orig_zip=$origin&dest_zip=$dest";
-  $workString .= "&dest_country_val=U.S.A.";
-  $workString .= "&company_type=$ztype&packaging=1";
-  $workString .= "&weight=$pounds&weight_units=lbs";
-  $workString .= "&dropoff_type=1";
-  $workString .= "&submit_button=Get+Rate";
-
-  $doworkString = 'http://' . $site . $path . '?' . $workString;
-
-if ($sc_use_socket =~ /lwp/i) { # use LWP library POST
- # By calling this way, no error generated if library is missing
- # when the library is first loaded up or at runtime of this routine
-  $answer = eval("use LWP::UserAgent;  LWP_post\(\"$doworkString\"\);");
- }
-if ($sc_use_socket =~ /http-lib/i) { # use http-lib.pl library POST
-  $answer = &HTTPPost($path,$site,80,$workString);
- }
-
-#print "**workString=$workString**<br>\n";
-  $resp = $answer;
-  ($junk,$resp)=split(/class\=\'resultstable\'/,$resp,2);
-  ($resp,$junk)=split(/\<\/table\>/i,$resp,2);
-  ($junk,$resp)=split(/\>/,$resp,2);
-  while ($resp =~ /\>/) { # reponse is mixed with tags, eliminate them
-    ($part1,$resp) = split(/\</,$resp,2);
-    ($junk,$resp) = split(/\>/,$resp,2);
-    $resp = $part1 . "|" . $resp;
-   }
-  while ($resp =~ /\&/) { # eliminate things like &nbsp;
-    ($part1,$resp) = split(/\&/,$resp,2);
-    ($junk,$resp) = split(/\;/,$resp,2);
-    $resp = $part1 . "|" . $resp;
-   }
-  $resp = "|" . $resp . "|";
-  $resp =~ s/\n//g;
-  $resp =~ s/\r//g;
-  while ($resp =~ /\|\|/) { # get rid of "null" answers
-    $resp =~ s/\|\|/\|/g;
-   }
-  chomp($resp);
-# now check the subtype
-  ($junk,$resp) = split(/$zsubtype/i,$resp,2);
-  $resp = "|FedEx $zsubtype" . $resp;
-  @resp = split(/\|/,$resp);
-#  print $resp,"\n","**$resp[5]**\n";
-  return $resp[5],$err;
-}
-
-#####################################################################
-
-sub getUSPS_simple {
-  my ($product, $origin, $dest, $weight) = @_;
-
-#  if ($sc_USPS_use_API =~ /yes/i) {
-    return &getUSPS_simple_API($product, $origin, $dest, $weight);
-#   } else {
-#    return &getUSPS_simple_free($product, $origin, $dest, $weight);
-#   }  
-}
-
-#####################################################################
-sub getUSPS_simple_API {
-    my ($product, $origin, $dest, $weight) = @_;
-    my ($pounds,$ounces,$usps_prot,$usps_site,$usps_cgi,$junk,$answer);
-    my ($error,$orig_ans);
-    my ($country , $service, $length, $width, $height, $oversized, $cod);
-    $country ||= 'US';
-    
-#Taint mode stuff ...
-    $weight=$weight + 0.9999999999; # round up!
-    $weight =~ /(\w+)/;
-    $weight = $1; 
-    $dest =~ /(\w+)/;
-    $dest = $1;
-    $product =~ /(\w+)/;
-    $product = $1;
-    $origin =~ /(\w+)/; 
-    $origin = $1;
-
-    $service = $product; # variable
-    $pounds = $weight;
-    $ounces = "0";
-
-# ($pounds,$ounces) = split(/\./, $weight);
-# $ounces = ("." . $ounces)*16;
-   
-    ($usps_prot,$junk,$usps_site,$usps_cgi) = 
-       split(/\//,$sc_USPS_host_URL,4);
-    $usps_prot .= '//';
-    $usps_cgi = '/' . $usps_cgi;
-
-#   $usps_site = 'testing.shippingapis.com';
-#ShippingAPITest.dll';
-   
-    $workString .= "API=Rate&XML=<RateRequest";
-    $workString .= " USERID=\"$sc_USPS_userid\"";
-    $workString .= " PASSWORD=\"$sc_USPS_password\">";
-    $workString .= '<Package ID="0">';
-    $workString .= "<Service>$service</Service>";
-    $workString .= "<ZipOrigination>$origin</ZipOrigination>";
-    $workString .= "<ZipDestination>$dest</ZipDestination>";
-    $workString .= "<Pounds>$pounds</Pounds>";
-    $workString .= "<Ounces>$ounces</Ounces>";
-    $workString .= '<Container>None</Container>';
-    $workString .= '<Size>REGULAR</Size>';
-    $workString .= '<Machinable>False</Machinable></Package></RateRequest>';
-
- if ($product =~ /Parcel/i) {
-    $workString =~ s/False/True/;
+############################################################################
+#
+# New XML United States Postal Service (USPS) interface module by Mister Ed Feb 2005
+# sub calc_usps
+# Use with permission only with AgoraCart, AgoraCartPro, AgoraSQL, AgoraCartSQL.
+# All other uses strictly prohibited.
+# Copyright 2002-present by K-Factor Technologies, Inc
+# 
+############################################################################
+sub calc_usps {
+my ($method, $origin, $dest, $destcountry, $shipping_total, $weight_data) = @_;
+my ($product_temp_name,$err_printed,$err,$temp_zip_thingy) = "";
+my ($product, $alt_origin, $alt_origin_temp, $weight, $ship_cost, $junk, $thezone, $errmsg, $foundit,
+	$item_info, $origin_passby, $new_weight_data, $item_wt, $item_qty, $splitanswer, $item_cost, @ship_list);
+my ($pounds,$ounces,$usps_prot,$usps_site,$usps_cgi,$answer);
+my ($error,$orig_ans);
+my ($country, $length, $width, $height, $oversized, $cod);
+my (%zip_list);
+$ship_cost = 0; # handling charge added in define_shipping_logic
+($usps_prot,$junk,$usps_site,$usps_cgi) = split(/\//,$sc_USPS_host_URL,4);
+$usps_prot .= '//';
+$usps_cgi = '/' . $usps_cgi;
+if (($destcountry =~ /kingdom/i) && ($destcountry =~ /united/i)) { 
+	$destcountry = "England";
+}
+($junk,$stuff) = split(/\(/,$method,2);
+($stuff,$junk) = split(/\)/,$stuff,2);
+if ($stuff ne "") { #assume we have a valid product code
+   	$product = $stuff;
+    $product_temp_name = $stuff;
+   	$foundit = "yes";
+}
+if (($destcountry ne "") && ($destcountry !~ /united states/i) && ($destcountry !~ /puerto rico/i)) {
+	if (($product !~ /Global Express/i) && ($product !~ /Airmail/i) && ($product !~ /economy/i)) {
+       	$err_printed = "yes";
+       	$order_error_do_not_finish = "yes";
+       	print "USPS shipping error: wrong shipping type for your destination country!<br>",
+           	"Please use your browser's back button and select ",
+           	"<br>USPS Global Express options, Airmail Parcel Post, or <br>",
+           	"Economy surface Parcel Post.<br><br>$err<br>\n";
+		$ship_cost = 0;
+		return $ship_cost;
+	}
 }
-   
-    $doworkString = "$usps_prot$usps_site$usps_cgi\?${workString}";
-
-if ($sc_use_socket =~ /lwp/i) { # use LWP library POST
- # By calling this way, no error generated if library is missing
- # when the library is first loaded up or at runtime of this routine
-  $answer = eval("use LWP::UserAgent;");
-  if ($@ eq "" ) {
-    $answer = LWP_post($doworkString);
-   } else {
-    print "<br><left>$@</left><br>\n";
-    $answer = "";
-   }
- }
-if ($sc_use_socket =~ /http-lib/i) { # use http-lib.pl library GET
-  $answer = &HTTPGet($usps_cgi,$usps_site,80,$workString);
- }
-if ($sc_use_socket =~ /lynx/i) { # use lynx to get the answer
-  $answer = &special_get($doworkString);  
- }
-    $orig_ans = $answer;
-    ($junk,$answer) = split(/<Postage>/,$answer,2);
-    ($answer,$junk) = split(/<\/Postage>/,$answer,2);
-    if ($answer eq "") {
-      $error=$orig_ans;
-     }
+$dest =~ /(\w+)/;
+$dest = $1;
+$product =~ /(\w+)/;
+$product = $1;
+$sc_verify_boxes_max_wt = $sc_USPS_max_wt;
+@ship_list = split(/\|/,$weight_data);
+# new stuff for alt origination. use even without alt origination. Added by Mister Ed
+	foreach $ship_list (@ship_list) {
+      ($item_qty,$item_wt,$item_val,$alt_origin,$junk) = split(/\*/,$ship_list,5);
+		if ($alt_origin ne "") {
+			if ($zip_list{$alt_origin} eq "") {
+				$zip_list{$alt_origin} = $ship_list;
+			} else {
+				$temp_zip_thingy = "$zip_list{$alt_origin}";
+				$temp_zip_thingy .= "|" . "$ship_list";
+				$zip_list{$alt_origin} = "$temp_zip_thingy";
+			}
+		} else {
+			if ($zip_list{$origin} eq "") {
+				$zip_list{$origin} = $ship_list;
+			} else {
+				$temp_zip_thingy = "$zip_list{$origin}";
+				$temp_zip_thingy .= "|" . "$ship_list";
+				$zip_list{$origin} = "$temp_zip_thingy";
+			}
+		}
+	}
+foreach $origin_product_list (sort (keys %zip_list)) {
+	my $packageID = "0";
+	$weight_data = $zip_list{$origin_product_list};
+	if (($destcountry eq "") || ($destcountry =~ /united states/i) || ($destcountry =~ /puerto/i)) {
+    	$workString = "API=RateV2&XML=<RateV2Request "; #>
+    	$workString .= "USERID=\"$sc_USPS_userid\" ";
+    	$workString .= "PASSWORD=\"$sc_USPS_password\">";
+	} else {
+    	$workString = "API=IntlRate&XML=<IntlRateRequest ";
+    	$workString .= "USERID=\"$sc_USPS_userid\" ";
+    	$workString .= "PASSWORD=\"$sc_USPS_password\">";
+	} # >
+	($new_weight_data,$ship_ins) = &ship_put_in_boxes($weight_data, $weight_data, $origin_product_list, $sc_USPS_max_wt);
+	$sc_shipping_thing .= $new_weight_data;
+    @ship_list = split(/\|/,$new_weight_data);
+    foreach $item_info (@ship_list) {
+    	($item_qty,$item_wt,$box_total_value,$alt_origin,$junk) = split(/\*/,$item_info,5);
+    	if ($item_wt <= 1) { # min
+      		$item_wt = 1;
+    	}
+		if (($alt_origin ne "") && ($sc_alt_origin_enabled =~ /yes/i)) {
+			$origin_passby = $alt_origin;
+		} else {
+			$origin_passby = $sc_USPS_Origin_ZIP;
+		}
+		$weight = $item_wt + 0.9999999999; 
+		$weight =~ /(\w+)/;
+    	$weight = $1; 
+    	$origin_passby =~ /(\w+)/; 
+    	$origin_passby = $1;
+	    $pounds = $weight;
+	    $ounces = "0";
+		$container = ''; 
+		$containersize = 'Regular';
+		if (($service =~ /Priority/i) && ($pounds > 1) && ($sc_use_UPS_flatrate_box =~ /yes/i)) {
+				$container = 'Flat Rate Box'; 
+		}
+	if (($destcountry eq "") || ($destcountry =~ /united states/i) || ($destcountry =~ /puerto/i)) { 
+		$workString .= "<Package ID=\"$packageID\">";
+	    $workString .= "<Service>$product</Service>";
+	    $workString .= "<ZipOrigination>$origin_passby</ZipOrigination>";
+	    $workString .= "<ZipDestination>$dest</ZipDestination>";
+	    $workString .= "<Pounds>$pounds</Pounds>";
+	    $workString .= "<Ounces>$ounces</Ounces>";
+		$workString .= "<Container>$container</Container>";
+	    $workString .= "<Size>$containersize</Size>";
+	    $workString .= '<Machinable>False</Machinable></Package>';
+	} else {
+		$workString .= "<Package ID=\"$packageID\">";
+	    $workString .= "<Pounds>$pounds</Pounds>";
+	    $workString .= "<Ounces>$ounces</Ounces>";
+    	$workString .= "<MailType>Package</MailType>";
+    	$workString .= "<Country>$destcountry</Country>";
+    	$workString .= "</Package>";
+	}
+		$packageID++;
+	} 
+	if (($destcountry eq "") || ($destcountry =~ /united states/i) || ($destcountry =~ /puerto/i)) {
+		$workString .= "</RateV2Request>";
+	} else { 
+		$workString .= "</IntlRateRequest>";
+	}
+	# added by Mister Ed to fix machineable type for parcel codes
+		if ($product =~ /Parcel/ig) {
+		   $workString =~ s/False/True/;
+	}
+  	$doworkString = "$usps_prot$usps_site$usps_cgi\?${workString}";
+	if ($sc_use_socket =~ /lwp/i) { # use LWP library POST
+	$answer = eval("use LWP::UserAgent;");
+		if ($@ eq "" ) {
+    		$answer = LWP_post($doworkString);
+		} else {
+	    	print "<br><left>$@</left><br>\n";
+	    	$answer = "";
+	  	}
+	}
+	if ($sc_use_socket =~ /http-lib/i) { 
+		$answer = &HTTPGet($usps_cgi,$usps_site,80,$workString);
+	}
+	&codehook("USPS_XML_data_dump");
+   	$orig_ans = $answer;
+	if (($destcountry eq "") || ($destcountry =~ /united states/i) || ($destcountry =~ /puerto/i)) { 
+		while ($answer =~ /<Rate>/ig) {
+   			($junk,$answer) = split(/<Rate>/i,$answer,2);
+   			($splitanswer,$answer) = split(/<\/Rate>/i,$answer,2);
+			$item_cost += $splitanswer;
+		}
+	} else { 
+			while ($answer =~ /<Service/ig) {
+   				($splitanswer,$answer) = split(/<\/Service>/i,$answer,2);
+				if ($splitanswer =~ /$product_temp_name/i) {
+   					($junk,$splitanswer) = split(/<Postage>/i,$splitanswer,2);
+   					($splitanswer,$junk) = split(/<\/Postage>/i,$splitanswer,2);
+					$item_cost += $splitanswer;
+				}
+			}
+		}
+   	if ($answer eq "") {
+   		$error=$orig_ans;
+   	}
+	if ($item_cost == 0 && $err_printed eq "" && $destcountry =~ /australia/i) {
+       	$err_printed = "yes";
+       	$order_error_do_not_finish = "yes";
+       	print "USPS module error: shipping cost not determined!<br>",
+           	"Please use your browser's back button and correct ",
+           	"<br>You may need to chose a different USPS shipping method for your destination<br>",
+           	"Weight limit for Global Priority Mail is 4 lbs; Airmail is 44 lbs.<br><br>$err<br>\n";
+	}
+	if ($item_cost == 0 && $err_printed eq "") {
+       	$err_printed = "yes";
+       	$order_error_do_not_finish = "yes";
+       	print "USPS module error: shipping cost not determined!<br>",
+           	"Please use your browser's back button and correct ",
+           	"<br>any fields as required and try again.  Also, make sure your postal code is correct.<br>",
+           	"You may also need to chose a different USPS shipping method for your destination<br><br>$err<br>\n";
+	}
+	$ship_cost += $item_cost;
+	$item_cost = 0;
+} 
+	&codehook("UPS_USPS_cost_return");
+	return $ship_cost;
+}
+############################################################################
+#
+# Insurance aspects donated by Leamsi Fontanez at www.bizmanweb.com Feb 2005 
+# insurance "yes" altered by Mister Ed for ignore case on yes.
+# not used currently
+# 
+############################################################################
+# Codes for product may be found at:
+#  http://theory.uwinnipeg.ca/CPAN/data/Business-UPS/UPS.html
+#  Ex: 1DA - Next Day, 2DA 2nd Day, GNDCOM Ground Commercial
+#  GNDRES Ground Residential, XPR Worldwide Express
 
-    return ($answer,$error);
+#-- START OF CODE MODIFIED FROM UPS.pm
 
-}
-##########################################################################
-#-- START OF CODE STOLEN/MODIFIED FROM UPS.pm, heavily modified for new API
+# new lines to work string added by Mister Ed Jan 2005.  Play with it as needed.
+# may or may not work on this older quoting system
 
 sub getUPS_simple {
-    my ($product, $origin, $dest, $weight) = @_;
-    my ($country , $rate_chart, $length, $width, $height, $oversized, $cod);
-    my ($RateChart) = $sc_UPS_RateChart;
-    my ($is_residential)='0';
-    $country ||= 'US';
-
-    if (substr($product,0,3) eq 'GND') { 
-      if ($product eq 'GNDRES') {$is_residential = 1;}
-      $product = 'GND';
-     }
-    if ($RateChart eq "") { 
-      $RateChart = "Regular+Daily+Pickup";
-     }
-    $RateChart =~ s/\ /\+/g;
-    
-    $weight=$weight + 0.9999999999; 
-    $weight =~ /(\w+)/;
-    $weight = $1; 
-    $dest =~ /(\w+)/;
-    $dest = $1;
-    $product =~ /(\w+)/;
-    $product = $1;
-    $origin =~ /(\w+)/; 
-    $origin = $1;
-
-    my $ups_prot = 'http://';
-    my $ups_site = 'www.ups.com';
-    my $ups_cgi = '/using/services/rave/qcost_dss.cgi';
-
-    my $workString = "";
-    my ($spk, $answer);
-    
-    $workString .= "AppVersion=1.2&";
-    $workString .= "AcceptUPSLicenseAgreement=YES&";
-    $workString .= "ResponseType=application/x-ups-rss&";
-    $workString .= "ActionCode=3&";
-    $workString .= "ServiceLevelCode=" . $product . "&";
-#    $workString .= "RateChart=Regular+Daily+Pickup&";
-    $workString .= "RateChart=$RateChart&";
-    $workString .= "ShipperPostalCode=" . $origin . "&";
-    $workString .= "ConsigneePostalCode=" . $dest . "&";
-    $workString .= "ConsigneeCountry=US&";
-    $workString .= "PackageActualWeight=" . $weight . "&";
-    $workString .= "ResidentialInd=$is_residential&";
-    $workString .= "PackagingType=00";
-    $doworkString = "${ups_prot}${ups_site}${ups_cgi}\?${workString}";
-
-if ($sc_use_socket =~ /lwp/i) { 
-  $answer = eval("use LWP::UserAgent;  LWP_post\(\"$doworkString\"\);");
- }
-if ($sc_use_socket =~ /http-lib/i) { 
-  $answer = &HTTPPost($ups_cgi,$ups_site,80,$workString);
- }
-if ($sc_use_socket =~ /lynx/i) { 
-  $answer = &special_get($doworkString);  
- }
-
-    my @ret = split( '%', $answer );
-    
-#    if (! $ret[14]) {
-#	# Error
-#	return (undef,undef,$ret[1]);
-#    }
-#    else {
-	# Good results
-	my $total_shipping = $ret[14];
-	my $ups_zone = $ret[10];
-	return ($total_shipping,$ups_zone,"");
-#    }
-}
-
-sub getUPS_simple_old {
-    my ($product, $origin, $dest, $weight) = @_;
-    my ($country , $rate_chart, $length, $width, $height, $oversized, $cod);
+    my ($product, $origin, $orgincountry, $dest, $destcountry, $weight) = @_;
+    my ($length, $width, $height, $oversized, $cod);
     my ($RateChart) = $sc_UPS_RateChart;
-    $country ||= 'US';
-
-    if ($RateChart eq "") { 
-      $RateChart = "Regular+Daily+Pickup";
-     }
-    $RateChart =~ s/\ /\+/g;
-
-    $weight=$weight + 0.9999999999; 
-    $weight =~ /(\w+)/;
-    $weight = $1; 
-    $dest =~ /(\w+)/;
-    $dest = $1;
-    $product =~ /(\w+)/;
-    $product = $1;
-    $origin =~ /(\w+)/; 
-    $origin = $1;
-
+    my ($answer, $workString);
     my $ups_prot = 'http://';
     my $ups_site = 'www.ups.com';
     my $ups_cgi = '/using/services/rave/qcostcgi.cgi';
-
-    my $workString = "";
-    my ($spk, $answer);
-    
-    $workString .= "accept_UPS_license_agreement=yes";
-    $workString .= "&10_action=3";
-    $workString .= "&13_product=" . $product ;
-    $workString .= "&15_origPostal=" . $origin ;
-    $workString .= "&19_destPostal=" . $dest ;
-    $workString .= "&23_weight=" . $weight ;
-    $workString .= "&22_destCountry=" . $country if $country;
-    $workString .= "&25_length=" . $length if $length;
-    $workString .= "&26_width=" . $width if $width;
-    $workString .= "&27_height=" . $height if $height;
-    $workString .= "&30_cod=" . $cod if $cod;
-    $workString .= "&29_oversized=1" if $oversized;
-    $workString .= "&47_rate_chart=" . $rate_chart if $rate_chart;
-    $doworkString = "${ups_prot}${ups_site}${ups_cgi}\?${workString}";
-    
-#    my @ret = split( '%', get($workString) );
-
-if ($sc_use_socket =~ /lwp/i) { # use LWP library POST
-
-  $answer = eval("use LWP::UserAgent;  LWP_post\(\"$doworkString\"\);");
- }
-if ($sc_use_socket =~ /http-lib/i) { 
-  $answer = &HTTPPost($ups_cgi,$ups_site,80,$workString);
- }
-if ($sc_use_socket =~ /lynx/i) { 
-  $answer = &special_get($doworkString);  
- }
-
-    my @ret = split( '%', $answer );
-    
-    if (! $ret[5]) {
-	return ("","",$ret[1]);
-    }
-    else {
-	my $total_shipping = $ret[10];
-	my $ups_zone = $ret[6];
-	return ($total_shipping,$ups_zone,undef);
-    }
-}
-
-sub getUPS {
-
-    my ($product, $origin, $dest, $weight, $country , $rate_chart, $length,
-	$width, $height, $oversized, $cod) = @_;
-
-	$country ||= 'US';
-    
-    my $ups_cgi = 'http://www.ups.com/using/services/rave/qcostcgi.cgi';
     my $workString = "?";
     $workString .= "accept_UPS_license_agreement=yes&";
     $workString .= "10_action=3&";
     $workString .= "13_product=" . $product . "&";
+    $workString .= "14_origCountry=" . $orgincountry . "&";
     $workString .= "15_origPostal=" . $origin . "&";
     $workString .= "19_destPostal=" . $dest . "&";
+#    $workString .= "20_destCity=" . $destCity . "&";
     $workString .= "23_weight=" . $weight;
-    $workString .= "&22_destCountry=" . $country if $country;
+#    $workString .= "&billToUPS=" . $ if $; # default is yes. set to no if not UPS account
+    $workString .= "&22_destCountry=" . $destcountry if $destcountry;
+#    $workString .= "&customValue=" . $ if $; #customs on international shipments
+#    $workString .= "&24_value=" . $ if $; # insurance purposes
     $workString .= "&25_length=" . $length if $length;
     $workString .= "&26_width=" . $width if $width;
     $workString .= "&27_height=" . $height if $height;
-    $workString .= "&30_cod=" . $cod if $cod;
     $workString .= "&29_oversized=1" if $oversized;
-	$workString .= "&47_rate_chart=" . $rate_chart if $rate_chart;
+    $workString .= "&47_rate_chart=" . $rate_chart if $rate_chart;
     $workString .= "&30_cod=1" if $cod;
-    $workString = "${ups_cgi}${workString}";
-    
-#    my @ret = split( '%', get($workString) );
+#    $workString .= "&39_response=" if $; #set to 0 for none, 1 for basic, and 2 for signature required
+#    $workString .= "&ASD1=ADS" if $; #set to adult over 21 signature required
+	$workString .= "&48_container=00";
+    $doworkString = "${ups_prot}${ups_site}${ups_cgi}${workString}";
     
+if ($sc_use_socket =~ /lwp/i) {
+  $answer = eval("use LWP::UserAgent;  LWP_post\(\"$doworkString\"\);");
+ }
+if ($sc_use_socket =~ /http-lib/i) { 
+  $answer = &HTTPPost($ups_cgi,$ups_site,80,$workString);
+ }
+    my @ret = split( '%', $answer );
+   
     if (! $ret[5]) {
 	return (undef,undef,$ret[1]);
     }
     else {
 	my $total_shipping = $ret[10];
 	my $ups_zone = $ret[6];
-	return ($total_shipping,$ups_zone,undef);
-    }
-}
-
-#
-#	UPStrack sub added 2/27/1998
-#
-
-sub UPStrack {
-    my ($tracking_number) = shift;
-    my %retValue = ();		
-    $tracking_number || Error("No number to track in UPStrack()");
-
-#    my $raw_data = get("http://wwwapps.ups.com/tracking/tracking.cgi?tracknum=$tracking_number") || Error("Cannot get data from UPS");
-    $raw_data =~ tr/\r//d;
-
-    my @raw_data = split "\n", $raw_data;
-
-    # These are the splitting keys
-    my $scan_sep = 'Scanning Information';
-    my $notice_sep = 'Notice';
-    my $error_key = 'Unable to track';
-    my $section;
-    my @scanning;
-    for (@raw_data) {
-	s/<.*?>/ /gi;	# Remove html tags
-	s/(?:&nbsp;|[\n\t])//gi;	# Remove '&nbsp' separators
-	s/^\s+//g;
-
-	next if /^$/;
-	last if /^Top\sof\sPage/;
-
-	if (/^Tracking\sResult/) {
-	    $section = 'RESULT';
-	}
-	elsif (/^$scan_sep/) {
-	    $section = 'SCANNING';
-	}
-	elsif (/^$notice_sep/) {
-	    $section = 'NOTICE';
-	}
-	elsif (/^($error_key\s.*?)\s{4}/) {
-	    my $error = $1;
-	    $error =~ s/\s+$/ /g;
-	    $retValue{error} = $error;
-	    return %retValue;
-	}
-	elsif ($section eq 'NOTICE') {
-	    $retValue{Notice} .= $_;
-	}
-	elsif ($section eq 'RESULT') {
-	    my ($key,$value) = /(.*?):(.*)/;
-	    $value =~ s/^\s+//g;
-	    $value =~ s/\s+$//g;
-	    $retValue{$key} = $value;
-	}
-	elsif ($section eq 'SCANNING') {
-	    if (/^\d/) {
-		push @scanning, $_;
-	    }
-	    else {
-		$scanning[-1] .= " = $_";
-	    }
-	}
+# adjust for old pricing and add in fuel surcharges for next day and one time pickups
+# added by Mister Ed Oct- 24-2003
+# edited June 30, 2006 for admin control by Mister Ed
+     if ($total_shipping > 0 && $sc_ups_non_xml_adjust =~ /yes/i) {
+         $total_shipping = ($total_shipping * $sc_ups_non_xml_adjust_rate);
+     }
+	 return ($total_shipping,$ups_zone,undef);
     }
-
-    $retValue{Scanning} = join "\n", @scanning;
-
-    return %retValue;
 }
 
 sub Error {
@@ -852,30 +549,26 @@
     print STDERR "$error\n";
     exit(1);
 }
-
-#-- End of code stolen from UPS.pm
-
-# ==========================================================================
-
+############################################################################
 sub define_shipping_logic {
+ # original stevo passed here.  w/ alt origination if enabled. split off shipping total
+ # altered by Mister Ed @ AgoraCart.com Jan 2005
  local($shipping_total, $stevo_shipping_thing) = @_;
  local($orig_zip, $dest_zip, $ship_method, $mylogic);
  local($shipping_price)=0;
  local($ship_logic_run,$ship_logic_done)="no";
  local($continue)="yes";
  local($use_vform)="no";
-
+ my($SBW_shipping_price)=0;
  &codehook("shippinglib-define-shipping-logic");
  if (!($continue =~ /yes/i)) { return;}
-
  $ship_method = $form_data{'Ecom_ShipTo_Method'};
- if ($ship_method eq "") { #
+ if ($ship_method eq "") {
    $use_vform = "yes";
    $ship_method = $vform{'Ecom_ShipTo_Method'};
   }
  ($sc_ship_method_shortname,$junk) = split(/\(/,$ship_method,2);
-
- if ($sc_use_custom_shipping_logic =~ /yes/i) {
+ if (($sc_use_custom_shipping_logic =~ /yes/i) && ($sc_location_custom_shipping_logic =~ /before/i)) {
    $mylogic = "$sc_custom_shipping_logic";
    eval($mylogic);
    $err_code = $@;
@@ -888,58 +581,76 @@
      return $shipping_price;
     }
   } 
-
  if ($sc_use_SBW =~ /yes/i) {
-   $stevo_shipping_thing = "$shipping_total$stevo_shipping_thing";
+  $stevo_shipping_thing =~ s/\|//;
    $dest_zip = $form_data{'Ecom_ShipTo_Postal_PostalCode'};
-   if ($dest_zip eq "") { # try vform, perhaps there is a value there
+   $dest_country = $form_data{'Ecom_ShipTo_Postal_CountryCode'};
+   if ($dest_zip eq "") { 
      $use_vform = "yes";
      $dest_zip = $vform{'Ecom_ShipTo_Postal_PostalCode'};
     }
-   $shipping_price = $shipping_price +
-		&calc_SBW($ship_method,$dest_zip,$stevo_shipping_thing);   
+   if ($dest_country eq "") { 
+     $use_vform = "yes";
+     $dest_country = $vform{'Ecom_ShipTo_Postal_CountryCode'};
+    }
+   if ($dest_country eq "") { 
+     $use_vform = "yes";
+     $dest_country = $vform{'Ecom_BillTo_Postal_CountryCode'};
+    }
+   if ($dest_country eq "") { 
+     $dest_country = "US";
+    }
+   $SBW_shipping_price = &calc_SBW($ship_method,$dest_zip,$dest_country,$shipping_total,$stevo_shipping_thing);   
+   $shipping_price = $shipping_price + $SBW_shipping_price;   
    $ship_logic_run="yes";
   }
+ if (($sc_use_custom_shipping_logic =~ /yes/i) && ($sc_location_custom_shipping_logic =~ /after/i)) {
+   $mylogic = "$sc_custom_shipping_logic";
+   eval($mylogic);
+   $err_code = $@;
+   if ($err_code ne "") { #script died, error of some kind
+     &update_error_log("custom-shipping-logic $err_code ","","");
+    }
+   $ship_logic_run="yes";
+   if (($ship_logic_done =~ /yes/i) || ($shipping_logic_done =~ /yes/i)) 
+    { #done, may exit
+     return $shipping_price;
+    }
+  } 
 
- if (!($ship_logic_run =~ /yes/i)) {
+ if (!($ship_logic_run =~ /yes/i)) {# this is what is left 
    $shipping_price = $shipping_total;
   }
 
- if (($shipping_price > 0 ) ||
-     ($sc_add_handling_cost_if_shipping_is_zero =~ /yes/i)) {
-   $shipping_price = $shipping_price + $sc_handling_charge;
+ if (($shipping_price > 0 ) || ($sc_add_handling_cost_if_shipping_is_zero =~ /yes/i)) {
+		if ($sc_handling_charge_type =~ /percentage/i) {
+			$shipping_price = $shipping_price + ($temp_total * $sc_handling_charge);
+		} elsif ($sc_handling_charge_type =~ /flat/i) {
+			$shipping_price = $shipping_price + $sc_handling_charge;
+		} else {
+			# do nothing
+		}
   }
-
  return ($shipping_price);
-
 }
-
-# ==========================================================================
+############################################################################
 sub LWP_post {
-
 local ($ua);
 local ($stuff) = @_;
 local ($site_url,$info_to_post);
 ($site_url,$info_to_post) = split(/\?/,$stuff,2);
-
   $ua = new LWP::UserAgent;
   $ua->agent("AgentName/0.1 " . $ua->agent);
-
   my $req = new HTTP::Request POST => $site_url;
   $req->content_type('application/x-www-form-urlencoded');
   $req->content($info_to_post);
-
   my $res = $ua->request($req);
-
   if ($res->is_success) {
       return $res->content;
   } else {
       return "ERROR";
   }
 }
-
-# ==========================================================================
-
+############################################################################
 $shipping_lib_loaded_ok = "yes";
-
 1;
diff -ruN 4.0K-4b/library/smtpmail-lib.pl 5.0.000/library/smtpmail-lib.pl
--- 4.0K-4b/library/smtpmail-lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/smtpmail-lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -4,7 +4,9 @@
 # This script was written by Gunther Birznieks.
 # Date Created: 2-22-96
 # Date Last Modified: 5-5-96
-$versions{'smtpmail-lib.pl'} = "19960505";
+
+$versions{'smtpmail-lib.pl'} = "5.0.000";
+
 #
 #   You may copy this under the terms of the GNU General Public
 #   License or the Artistic License which is distributed with
@@ -17,13 +19,55 @@
 # Modified by Gunther Birznieks 3-19-96 to run on PERL 5 for Windows NT
 # as well as the Solaris system it was originally written under
 #
+# Main Procedures:
+#  real_send_mail - flexible way to send email
+#  send_mail - easier to use version of real_send_mail
+#
+# Special Notes: Script is UNIX Specific and ties into the 
+# Sendmail Program which is usually located in /usr/lib or
+# /usr/bin.
+# 
+# Also, remember to escape @ signs with a backslash (\@) 
+# for compatibility with PERL 5.
+#
+# Change the $mail_program variable to change location of your
+# sendmail program
+#
+# Set the $mail_os variable equal to NT if you are on Windows NT perl
+# Set it to UNIX for normal UNIX operations.
+#
+# If you do not have a version of PERL with the Socket.pm, you
+# can manually define $AF_INET and $SOCK_STREAM to 2 and 1 respectively.
+# On some systems, SOCK_STREAM may be 2.
+#
 # NOTE: This program does not support MX DNS records which is
 # an important part of the internet mail standard.  Use sendmail_lib.pl
 # if you can since the sendmail daemon on unix supports MX records.
 ############################################################
+
+# Use the Sockets library for TCP/IP Communications
 use Socket;
 $mail_os = "UNIX";
+
+############################################################
+#
+# subroutine: real_send_mail 
+#   Usage:
+#     &send_mail("me@myhouse.com","myhouse.com","you@yourhouse.com",
+#     "yourhouse.com", "Mysubject", "My message");
+#
+#   Parameters:
+#     $fromuser = Full Email address of sender
+#     $fromsmtp = Full Internet Address of sender's SMTP Server
+#     $touser   = Full Email address of receiver
+#     $tosmtp   = Full Internet Address of receiver's SMTP Server
+#     $subject  = Subject of message
+#     $messagebody = Body of message including newlines.
+#
+#   Output:
+#     None
 ############################################################
+
 sub real_send_mail {
     local($fromuser, $fromsmtp, $touser, $tosmtp, 
 	  $subject, $messagebody) = @_;
@@ -32,18 +76,49 @@
     local($AF_INET, $SOCK_STREAM, $SOCK_ADDR);
     local($PROTOCOL, $SMTP_PORT);
     local($buf);
+# We start off by making the message that will be sent 
+# By combining the subject with the message body text
+#
     $messagebody = "Subject: $subject\n\n" . $messagebody;
 
+# The following variables are set using values defined in
+# The sockets.pm library.  If your version of perl (v4) does
+# not have the sockets library, you can substitute some 
+# default values such as 2 for AF_INIT, and 1 for SOCK_STREAM.
+# if 1 does not work for SOCK_STREAM, try using 2.
+#
+# AF_INET defines the internet class of addressing
+#
+# SOCK_STREAM is a variable telling the program to use
+# a socket connection.  This varies from using SOCK_DGRAM
+# which would send UDP datagrams using a connectionless paradigm
+# instead.
+# 
+# PROTOCOL is TCPIP (6).
+#
+# PORT is 25 for SMTP service.
+#
+# SOCK_ADDR is the packeted format of the full socket address
+# including the AF_INIT value, SMTP_PORT, and IP ADDRESS in that order
+#
+
+
     $AF_INET = AF_INET;
     $SOCK_STREAM = SOCK_STREAM;
 
     $SOCK_ADDR = "S n a4 x8";
 
+# The following routines get the protocol information
+#
+
     $PROTOCOL = (getprotobyname('tcp'))[2];
     $SMTP_PORT = (getservbyname('smtp','tcp'))[2];
 
     $SMTP_PORT = 25 unless ($SMTP_PORT =~ /^\d+$/);
     $PROTOCOL = 6 unless ($PROTOCOL =~ /^\d+$/);
+
+# Ip address is the Address of the host that we need to connect
+# to
     $ipaddress = (gethostbyname($tosmtp))[4];
 
     $fullipaddress = join (".", unpack("C4", $ipaddress));
@@ -53,18 +128,29 @@
     $packthishostip = pack($SOCK_ADDR, 
 			 $AF_INET, 0, "\0\0\0\0");
 
+# First we allocate the socket
     socket (S, $AF_INET, $SOCK_STREAM, $PROTOCOL) || 
 	&web_error( "Can't make socket:$!\n");
 
+# Then we bind the socket to the local host
     bind (S,$packthishostip) || 
 	&web_error( "Can't bind:$!\n");
+# Then we connect the socket to the remote host
     connect(S, $packconnectip) || 
 	&web_error( "Can't connect socket:$!\n");
 
+# The following selects the socket handle and turns off
+# output buffering
+#
     select(S);
     $| = 1;
     select (STDOUT);
 
+# The following sends the information to the SMTP Server.
+
+# The first connect should give us information about the SMTP
+# server
+
     $buf = read_sock(S, 6);
 
     print S "HELO $fromsmtp\n";
@@ -89,48 +175,113 @@
 
     close S;
 
-} 
+} #end of real_send_mail
+
+############################################################
+#
+# subroutine: send_mail 
+#   Usage:
+#     &send_mail("me@myhouse.com","you@yourhouse.com",
+#     "Mysubject", "My message");
+#
+#   Parameters:
+#     $fromuser = Full Email address of sender
+#     $touser   = Full Email address of receiver
+#     $subject  = Subject of message
+#     $messagebody = Body of message including newlines.
+# 
+#   Output:
+#     None
+#
 ############################################################
+
 sub send_mail
 {
 local($from, $to, $subject, $messagebody) = @_;
 
 local($fromuser, $fromsmtp, $touser, $tosmtp);
+
+# This routine takes the simpler parameters of 
+# send_mail and breaks them up into the parameters
+# to be sent to real_send_mail.
+# 
 $fromuser = $from;
 $touser = $to;
 
+#
+# Split is used to break the address up into
+# user and hostname pairs.  The hostname is the
+# 2nd element of the split array, so we reference
+# it with a 1 (since arrays start at 0).
+#
 $fromsmtp = (split(/\@/,$from))[1];
 $tosmtp = (split(/\@/,$to))[1];
 
+# Actually call the sendmail routine with the
+# newly generated parameters
+#
 &real_send_mail($fromuser, $fromsmtp, $touser, 
            $tosmtp, $subject, $messagebody);
 
-} 
+} # End of send_mail
+
 ############################################################
+#
+# subroutine: read_sock
+#   Usage:
+#     &read_socket(SOCKET_HANDLE, $timeout);
+#
+#   Parameters:
+#     SOCKET_HANDLE = Handle to an allocated Socket
+#     $timeout = amount of time read_sock is allowed to
+#                wait for input before timing out
+#                (measured in seconds)
+#
+#   Output:
+#     Buffer containing what was read from the socket
+# 
+############################################################
+
 sub read_sock {
     local($handle, $endtime) = @_;
     local($localbuf,$buf);
     local($rin,$rout,$nfound);
 
+# Set endtime to be time + endtime.
     $endtime += time;
 
+# Clear buffer
     $buf = "";
 
+# Clear $rin (Read Input variable)
     $rin = '';
+# Set $rin to be a vector of the socket file handle
     vec($rin, fileno($handle), 1) = 1;
 
+# nfound is 0 since we have not read anything yet
     $nfound = 0;
 
+# Loop until we time out or something was read 
 read_socket: 
 while (($endtime > time) && ($nfound <= 0)) {
+# Read 1024 bytes at a time
     $length = 1024;
+# Preallocate buffer
     $localbuf = " " x 1025;
+	# NT does not support select for polling to see if 
+	# There are characters to be received.  This is important
+	# Because we dont want to block if there is nothing
+	# being received.
     $nfound = 1;
     if ($mail_os ne "NT") {
+# The following polls to see if there is anything in the input
+# buffer to read.  If there is, we will later call the sysread routine
 	$nfound = select($rout=$rin, undef, undef,.2);
 	    }
 }
-
+	
+# If we found something in the read socket, we should
+# get it using sysread.
     if ($nfound > 0) {
 	$length = sysread($handle, $localbuf, 1024);
 	if ($length > 0) {
@@ -138,18 +289,36 @@
 	    }
     }
 
+# Return the contents of the buffer
 $buf;
 }
+
 ############################################################
+#
+# subroutine: web_error
+#   Usage:
+#     &web_error("File xxx could not be opened");
+#
+#   Parameters:
+#     $error = Description of Web Error
+#
+#   Output:
+#     None
+# 
+############################################################
+
 sub web_error
 {
 local ($error) = @_;
 $error = "Error Occured: $error";
 print "$error<p>\n";
 
+# Die exits the program prematurely and prints an error to
+# stderr
+
 die $error;
 
-} 
+} # end of web_error
 
 1;
 
diff -ruN 4.0K-4b/library/zOffline-mgr_lib.pl 5.0.000/library/zOffline-mgr_lib.pl
--- 4.0K-4b/library/zOffline-mgr_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/zOffline-mgr_lib.pl	1969-12-31 18:00:00.000000000 -0600
@@ -1,221 +0,0 @@
-#
-# For the 'zOffline' Multiple Choice Processing Gateway
-#  Configured for PayPal and Offline Processing Options
-#
-# Copyright 2001-2002 K-Factor Technologies, Inc at http://www.AgoraCart.com .  All Rights Reserved.
-
-$versions{'zOffline-mgr_lib.pl'} = "20011123";
-&add_codehook("gateway_admin_screen","zOffline_mgr_check");
-&add_codehook("gateway_admin_settings","zOffline_settings");
-$mc_gateways .= "|zOffline";
-##############################################################################
-sub zOffline_settings {
-local($custom_logic);
-if ($sc_gateway_name eq "zOffline") {
-  open (GATEWAY, "> $gateway_settings") || 
-    &my_die("Can't Open $gateway_settings");
-  print (GATEWAY  "\$sc_order_script_url = \"$in{'order_url'}\";\n");
-  print (GATEWAY  "\$sc_zOffline_CC_validation = \"$in{'CC_validation'}\";\n");
-  print (GATEWAY  "\$sc_allow_pay_by_check = \"$in{'pay_by_check'}\";\n");
-  print (GATEWAY  "\$sc_allow_pay_by_PO = \"$in{'pay_by_PO'}\";\n");
-  print (GATEWAY  "\$sc_allow_pay_by_CC = \"$in{'pay_by_CC'}\";\n");
-  print (GATEWAY  "\$sc_zOffline_show_table = \"$in{'show_table'}\";\n");
-  &codehook("manager_write_gateway_settings");
-  &codehook("zOffline_mgr_write_settings");
-  print (GATEWAY  "1\;\n");
-  close(GATEWAY);
- }
-}
-##############################################################################
-sub zOffline_mgr_check {
-if ($sc_gateway_name eq "zOffline") {
-  &print_zOffline_mgr_form;
-  &call_exit;
- }
-}
-##############################################################################
-sub print_zOffline_mgr_form {
-
-##
-## zOffline PROCESSING
-##
-
-print &$manager_page_header("$sc_gateway_name Gateway","","","","");
-
-print <<ENDOFTEXT;
-<CENTER>
-<TABLE WIDTH=580>
-
-<TR>
-<TD COLSPAN=2><HR></TD>
-</TR>
-
-<TR>
-<TD WIDTH=580>
-<FONT FACE=ARIAL>
-zOffline Processing
-$msg</FONT>
-</TD>
-</TR>
-</TABLE>
-</CENTER>
-
-ENDOFTEXT
-
-if($in{'system_edit_success'} ne "")
-{
-print <<ENDOFTEXT;
-<CENTER>
-<TABLE>
-<TR>
-<TD>
-<FONT FACE=ARIAL SIZE=2 COLOR=RED>Gateway settings have been successfully updated</FONT>
-</TD>
-</TR>
-</TABLE>
-</CENTER>
-ENDOFTEXT
-}
-
-if ($sc_allow_pay_by_check eq '') { # default it in
-  $sc_allow_pay_by_check = 'yes';
- }
-if ($sc_allow_pay_by_PO eq '') { # default it in
-  $sc_allow_pay_by_PO = 'no';
- }
-#if ($sc_allow_pay_by_CC eq '') { # default it in
-#  $sc_allow_pay_by_CC = 'yes';
-# }
-if ($sc_zOffline_show_table eq '') { # default it in
-  $sc_zOffline_show_table = 'no';
- }
-if ($sc_zOffline_CC_validation eq '') { # default it in
-  $sc_zOffline_CC_validation = $sc_CC_validation;
- }
-print <<ENDOFTEXT;
-
-<FONT FACE=ARIAL SIZE=2>
-<FORM METHOD="POST" ACTION="manager.cgi">
-<CENTER>
-<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
-
-<TR>
-<TD COLSPAN=2><HR></TD>
-</TR>
-
-<TR>
-<TD COLSPAN=2><TABLE WIDTH="100%"><TR>
-<TD>Create a browser receipt after order completion?:</TD>
-<TD>
-<SELECT NAME="show_table">
-<OPTION>$sc_zOffline_show_table</OPTION>
-<OPTION>yes</OPTION>
-<OPTION>no</OPTION>
-$mc_zOffline_show_table_special_option
-</SELECT>
-</TD>
-</TR></TABLE></TD>
-</TR>
-
-<TR>
-<TD COLSPAN=2><HR></TD>
-</TR>
-
-<TR>
-<TD COLSPAN=2><TABLE WIDTH="100%"><TR>
-<TD>Allowed Payment Methods (in addtion to Credit Cards):</TD>
-<TD>
-Check:<br>
-<SELECT NAME="pay_by_check">
-<OPTION>$sc_allow_pay_by_check</OPTION>
-<OPTION>yes</OPTION>
-<OPTION>no</OPTION>
-$mc_pay_by_check_special_option
-</SELECT>
-</TD>
-<TD>Purchase Order:<BR>
-<SELECT NAME="pay_by_PO">
-<OPTION>$sc_allow_pay_by_PO</OPTION>
-<OPTION>yes</OPTION>
-<OPTION>no</OPTION>
-$mc_pay_by_PO_special_option
-</SELECT>
-</TD>
-</TR></TABLE></TD>
-</TR>
-
-
-<TR>
-<TD COLSPAN=2><HR></TD>
-</TR>
-
-<TR>
-<TD>Perform a rough validation of CC info?
-Attempts to determine if the Credit Card number is a mathematically valid
-number and has not expired. 
-(Experimental)</TD>
-<TD>
-<SELECT NAME="CC_validation">
-<OPTION>$sc_zOffline_CC_validation</OPTION>
-<OPTION>yes</OPTION>
-<OPTION>no</OPTION>
-</SELECT>
-</TD>
-</TR>
-
-<TR>
-<TD COLSPAN=2><HR></TD>
-</TR>
-
-<TR>
-<TD COLSPAN=2>
-Please enter the Secure URL to your agora.cgi store.
-</TD>
-</TR>
-
-<TR>
-<TD COLSPAN=2>
-<INPUT NAME="order_url" TYPE="TEXT" SIZE=60
-VALUE="$sc_order_script_url"><br>
-</TD>
-</TR>
-
-<TR>
-<TD COLSPAN=2><HR></TD>
-</TR>
-
-<TR>
-<TD COLSPAN=2>
-<TABLE WIDTH='100%' CELLPADDING=0 CELLSPACING=0>
-<TR>
-<TD ALIGN='LEFT' WIDTH='20%'>&nbsp;</TD>
-<TD WIDTH='60%'>
-<CENTER>
-<INPUT TYPE="HIDDEN" NAME="system_edit_success" VALUE="yes">
-<INPUT TYPE="HIDDEN" NAME="gateway" VALUE="zOffline">
-<INPUT NAME="GatewaySettings" TYPE="SUBMIT" VALUE="Submit">
-&nbsp;&nbsp;
-<INPUT TYPE="RESET" VALUE="Reset">
-</CENTER>
-</TD>
-<TD ALIGN='LEFT' WIDTH='20%'>&nbsp;</TD>
-</TR></TABLE>
-</TD>
-</TR>
-
-<TR>
-<TD COLSPAN=2>
-<HR>
-</TD>
-</TR>
-
-</TABLE>
-
-</CENTER>
-</FORM>
-ENDOFTEXT
-print &$manager_page_footer;
-	
-}
-##############################################################################
-1; #Library
diff -ruN 4.0K-4b/library/zOffline-order_lib.pl 5.0.000/library/zOffline-order_lib.pl
--- 4.0K-4b/library/zOffline-order_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/library/zOffline-order_lib.pl	1969-12-31 18:00:00.000000000 -0600
@@ -1,1123 +0,0 @@
-#######################################################################
-#                    Order Form Definition Variables                  #
-#######################################################################
-
-$versions{'zOffline-order_lib.pl'} = "20020312";
-
-$order_lib_cc_validate = "yes";
-$sc_use_secure_header_at_checkout = 'yes';
-$sc_zOffline_form_prep = 0;
-
-&add_codehook("printSubmitPage","print_zOffline_SubmitPage");
-&add_codehook("set_form_required_fields","zOffline_fields");
-&add_codehook("gateway_response","check_for_zOffline_response");
-&add_codehook("open_for_business","check_for_zOffline_submit");
-$sc_order_response_vars{"zOffline"}="process_order";
-if ($sc_loading_primary_gateway =~ /yes/i) { #Hook into things ...
-  &add_codehook("pre_header_navigation","zOffline_pre_header_processing");
- } 
-if ($zOffline_picserve eq '') {
-  $zOffline_picserve = $sc_picserve_url;
- }
-if ($zOffline_picserve eq '') {
-  $zOffline_picserve = 'picserve.cgi';
-}
-###############################################################################
-sub check_for_zOffline_submit {
-  if (&form_check('submit_order_form_button')) {
-    if ($form_data{'gateway'} eq '') {
-      $form_data{'gateway'} = $sc_gateway_name;
-     }
-    if ($form_data{'gateway'} eq 'zOffline') {    
-      &zOffline_response_prep;
-     }
-   }
- }
-###############################################################################
-sub check_for_zOffline_response {
-  if ($form_data{'process_order'}) {
-    $cart_id = $form_data{'cart_id'};
-    &set_sc_cart_path;
-    &load_order_lib;
-    &codehook("zOffline_order");
-    &process_zOffline_Order;
-    &call_exit;
-   }
- }
-###############################################################################
-sub zOffline_check_and_load {
-local($myname)="zOffline";
-#
-# if ($myname ne $sc_gateway_name) { # we are a secondary gateway, load settings
-#  &require_supporting_libraries(__FILE__,__LINE__,
-#     "./admin_files/$myname-user_lib.pl");
-# }
-if ($sc_zOffline_CC_validation ne '') {
-  $sc_CC_validation = $sc_zOffline_CC_validation;
- }
-$sc_stepone_order_script_url = $sc_order_script_url;
-}
-###############################################################################
-sub zOffline_response_prep {
-#
-&zOffline_check_and_load;
-# We default the Shipto info to Billto if left blank
-if ($form_data{'Ecom_ShipTo_Postal_PostalCode'} eq "") {
-  if ($form_data{'Ecom_BillTo_PostalCode'} ne "") {
-  $form_data{'Ecom_ShipTo_Postal_PostalCode'} = 
-       $form_data{'Ecom_BillTo_PostalCode'};
-   }
- }
-
-if ($form_data{'Ecom_ShipTo_Postal_Name_Last'} eq "") {
-  if ($form_data{'Ecom_BillTo_Postal_Name_Last'} ne "") {
-  $form_data{'Ecom_ShipTo_Postal_Name_Last'} = 
-       $form_data{'Ecom_BillTo_Postal_Name_Last'};
-   }
- }
-
-if ($form_data{'Ecom_ShipTo_Postal_Name_First'} eq "") {
-  if ($form_data{'Ecom_BillTo_Postal_Name_First'} ne "") {
-  $form_data{'Ecom_ShipTo_Postal_Name_First'} = 
-       $form_data{'Ecom_BillTo_Postal_Name_First'};
-   }
- }
-
-if ($form_data{'Ecom_ShipTo_Postal_Street_Line1'} eq "") {
-  if ($form_data{'Ecom_BillTo_Postal_Street_Line1'} ne "") {
-    $form_data{'Ecom_ShipTo_Postal_Street_Line1'} = 
-       $form_data{'Ecom_BillTo_Postal_Street_Line1'};
-    $form_data{'Ecom_ShipTo_Postal_Street_Line2'} = 
-       $form_data{'Ecom_BillTo_Postal_Street_Line2'};
-    $form_data{'Ecom_ShipTo_Postal_Street_Line3'} = 
-       $form_data{'Ecom_BillTo_Postal_Street_Line3'};
-   }
- }
-
-if ($form_data{'Ecom_ShipTo_Postal_City'} eq "") {
-  if ($form_data{'Ecom_BillTo_Postal_City'} ne "") {
-  $form_data{'Ecom_ShipTo_Postal_City'} = 
-       $form_data{'Ecom_BillTo_Postal_City'};
-   }
- }
-
-if ($form_data{'Ecom_ShipTo_Postal_StateProv'} eq "") {
-  if ($form_data{'Ecom_BillTo_Postal_StateProv'} ne "") {
-  $form_data{'Ecom_ShipTo_Postal_StateProv'} = 
-       $form_data{'Ecom_BillTo_Postal_StateProv'};
-   }
- }
-
-# Need to do this here so it gets to the verify file
-$sc_paid_by_ccard = "";
-$form_data{"Ecom_Payment_Orig_Card_Type"} = 
-		$form_data{"Ecom_Payment_Card_Type"};
-$form_data{"Ecom_Payment_Orig_Card_Number"} = 
-		$form_data{"Ecom_Payment_Card_Number"};
-if ($form_data{"Ecom_Payment_Card_Type"} ne "" ) {
-  if ((!($form_data{"Ecom_Payment_Card_Type"} =~ /check/i)) &&
-    (!($form_data{"Ecom_Payment_Card_Type"} =~ /cheque/i)) &&
-    (!($form_data{"Ecom_Payment_Card_Type"} =~ /PO/i))) {
-  # must be a Credit Card
-    $sc_paid_by_ccard = "yes";
-    $form_data{"Ecom_Payment_Pay_Type"} = 'CC'; 
-   } else {
-    $sc_paid_by_ccard = "no";
-    if (($sc_allow_pay_by_PO =~ /yes/i )  &&
-    ($form_data{"Ecom_Payment_Card_Type"} =~ /PO/i)) {
-      $form_data{"Ecom_Payment_Card_Type"} = "Purchase Order"; 
-      $form_data{"Ecom_Payment_Card_Number"} = 
-        $form_data{"Ecom_Payment_PO_Number"};
-      $form_data{"Ecom_Payment_Pay_Type"} = 'PO'; 
-    } elsif ($sc_allow_pay_by_check =~ /yes/i ) {
-      $form_data{"Ecom_Payment_Card_Type"} .= ", Bank Name is " .
-        $form_data{"Ecom_Payment_Bank_Name"};
-      $form_data{"Ecom_Payment_Card_Number"} = "R: " .
-        $form_data{"Ecom_Payment_BankRoute_Number"} . " A:" .  
-        $form_data{"Ecom_Payment_BankAcct_Number"} . " #:" .
-        $form_data{"Ecom_Payment_BankCheck_Number"};  
-      $form_data{"Ecom_Payment_Pay_Type"} = 'CHECK'; 
-     } 
-   } 
- }
-}
-###############################################################################
-sub zOffline_order_form_prep {
-  &zOffline_check_and_load;
-  if ($sc_zOffline_form_prep == 0) {
-    if (-f "$sc_verify_order_path"){
-      &read_verify_file;  
-     } else {
-      &codehook("load_customer_info");
-     }
-    $sc_zOffline_form_prep = 1;
-   }
-  return "";
- }
-###############################################################################
-sub zOffline_pre_header_processing {
-# May want to change the header for no-cache under certain circumstances
-   if (($form_data{'order_form_button.x'} ne "") ||
-       ($form_data{'submit_order_form_button'} ne "") ||
-       ($form_data{'submit_order_form_button.x'} ne "") ||
-       ($form_data{'order_form_button'} ne "")) {
-     $sc_browser_header = 
-	"Content-type: text/html\nCache-Control: no-cache\n" .
-	"Pragma: no-cache\nExpires: Wed, 4 October 2000 00:00:00 GMT\n\n";
-   }
- }
-###############################################################################
-sub zOffline_fields {
-local($myname)="zOffline";
-
-if (!($form_data{'gateway'} eq $myname)) { return;} 
-
-# This is now done much earlier for compatability with 3.2b through 4.0a
-# &zOffline_response_prep;
-
-%sc_order_form_array =('Ecom_BillTo_Postal_Name_First', 'First Name',
-		       'Ecom_BillTo_Postal_Name_Last', 'Last Name',
-		       'Ecom_BillTo_Postal_Street_Line1', 'Billing Address Street',
-		       'Ecom_BillTo_Postal_City', 'Billing Address City',
-		       'Ecom_BillTo_Postal_StateProv', 'Billing Address State',
-		       'Ecom_BillTo_PostalCode', 'Billing Address Zip',
-		       'Ecom_BillTo_Postal_CountryCode', 'Billing Address Country',
-		       'Ecom_ShipTo_Postal_Name_First', 'Ship To First Name',
-		       'Ecom_ShipTo_Postal_Name_Last', 'Ship To Last Name',
-		       'Ecom_ShipTo_Postal_Street_Line1', 'Shipping Address Street',
-		       'Ecom_ShipTo_Postal_City', 'Shipping Address City',
-		       'Ecom_ShipTo_Postal_StateProv', 'Shipping Address State',
-		       'Ecom_ShipTo_Postal_PostalCode', 'Shipping Address Zip',
-		       'Ecom_ShipTo_Postal_CountryCode', 'Shipping Address Country',
-		       'Ecom_BillTo_Telecom_Phone_Number', 'Phone Number',
-		       'Ecom_BillTo_Online_Email', 'Email',
-		       'Ecom_Payment_Card_Number', 'Card or Check Number',
-		       'Ecom_Payment_Card_ExpDate_Month', 'Card Expiration Month',
-		       'Ecom_Payment_Card_ExpDate_Day', 'Card Expiration Day',
-		       'Ecom_Payment_Card_ExpDate_Year', 'Card Expiration Year',
-		       'Ecom_Payment_Card_CVV', 'Card CVV Value');
-			
-{
-  local($mytypes)='credit card';
-  if ($sc_allow_pay_by_check =~ /yes/i ) {$mytypes .= "/check";}
-  if ($sc_allow_pay_by_PO    =~ /yes/i ) {$mytypes .= "/PO";}
-  $sc_order_form_array{'Ecom_Payment_Card_Type'} = "Payment type ($mytypes)";
- }
-
-@sc_order_form_required_fields = ("Ecom_BillTo_Postal_Name_First",
-				  "Ecom_BillTo_Postal_Name_Last",
-				  "Ecom_BillTo_Postal_Street_Line1",
-				  "Ecom_BillTo_Postal_City",
-				  "Ecom_BillTo_Postal_StateProv",
-				  "Ecom_BillTo_PostalCode",        
-				  "Ecom_BillTo_Telecom_Phone_Number",
-				  "Ecom_BillTo_Online_Email",
-				  "Ecom_Payment_Card_Type",
-				  "Ecom_Payment_Card_Number");
-
-if ($sc_paid_by_ccard =~ /yes/i) { # add these for CC entry
-   push(@sc_order_form_required_fields,"Ecom_Payment_Card_ExpDate_Month");
-   push(@sc_order_form_required_fields,"Ecom_Payment_Card_ExpDate_Year");
-   push(@sc_order_form_required_fields,"Ecom_Payment_Card_CVV");
- }
-
-}
-###############################################################################
-sub print_zOffline_SubmitPage {
-
-local($invoice_number, $customer_number);
-local($myname)="zOffline";
-local($HREF_FIELDS) = &make_hidden_fields;
-
-if (!($form_data{'gateway'} eq $myname)) { return;} 
-&zOffline_check_and_load;
-
-$invoice_number = $current_verify_inv_no;
-$sc_temp_invoice_number = $invoice_number;
-$customer_number = $cart_id;
-$customer_number =~ s/_/./g;
-
-print &get_zOffline_confirm_middle(*form_data,$invoice_number,
-  $customer_number,$zOffline_ver_tbldef,$messages{'ordcnf_04'},
-  $zOffline_ver_tbldef2,$authPrice,$time);
-
-print <<ENDOFTEXT;
-<TABLE WIDTH="500" BGCOLOR="#FFFFFF" CELLPADDING="2" CELLSPACING="0" BORDER=0>
-<TR>
-<TD WIDTH="50%">
-<CENTER><BR>
-<FORM METHOD=POST ACTION=\"$sc_order_script_url\">
-<!--Order Financial Data-->
-<INPUT TYPE=HIDDEN NAME=cart_id VALUE=\"$cart_id\">
-<INPUT TYPE=HIDDEN NAME=AMOUNT VALUE=\"$formatted_price\">
-<INPUT TYPE=HIDDEN NAME=PLAINAMOUNT VALUE=\"$authPrice\">
-<INPUT TYPE=HIDDEN NAME=SUBTOTALAMT VALUE=\"$subtotal\">
-<INPUT TYPE=HIDDEN NAME=SHIPPING VALUE=\"$zfinal_shipping\">
-<INPUT TYPE=HIDDEN NAME=DISCOUNT VALUE=\"$zfinal_discount\">
-<INPUT TYPE=HIDDEN NAME=SALESTAX VALUE=\"$zfinal_sales_tax\">
-<INPUT TYPE=HIDDEN NAME=EXTRATAX1 VALUE=\"$zfinal_extra_tax1\">
-<INPUT TYPE=HIDDEN NAME=EXTRATAX2 VALUE=\"$zfinal_extra_tax2\">
-<INPUT TYPE=HIDDEN NAME=EXTRATAX3 VALUE=\"$zfinal_extra_tax3\">
-<!--Customer/Order Data-->
-<INPUT TYPE=HIDDEN NAME=CUSTID VALUE=\"$customer_number\">
-<INPUT TYPE=HIDDEN NAME=INVOICE VALUE=\"$invoice_number\">
-<INPUT TYPE=HIDDEN NAME=DESCRIPTION VALUE=\"Online Order\">
-<!--Billing Address-->
-<INPUT TYPE=HIDDEN NAME=NAME VALUE=\"$eform_data{'Ecom_BillTo_Postal_Name_First'} $form_data{'Ecom_BillTo_Postal_Name_Last'}\">
-<INPUT TYPE=HIDDEN NAME=ADDRESS VALUE=\"$eform_data{'Ecom_BillTo_Postal_Street_Line1'}\">
-<INPUT TYPE=HIDDEN NAME=ADDRESS2 VALUE=\"$eform_data{'Ecom_BillTo_Postal_Street_Line2'}\">
-<INPUT TYPE=HIDDEN NAME=ADDRESS3 VALUE=\"$eform_data{'Ecom_BillTo_Postal_Street_Line3'}\">
-<INPUT TYPE=HIDDEN NAME=CITY VALUE=\"$eform_data{'Ecom_BillTo_Postal_City'}\">
-<INPUT TYPE=HIDDEN NAME=STATE VALUE=\"$eform_data{'Ecom_BillTo_Postal_StateProv'}\">
-<INPUT TYPE=HIDDEN NAME=ZIP VALUE=\"$eform_data{'Ecom_BillTo_PostalCode'}\">
-<INPUT TYPE=HIDDEN NAME=COUNTRY VALUE=\"$eform_data{'Ecom_BillTo_Postal_CountryCode'}\">
-<INPUT TYPE=HIDDEN NAME=PHONE VALUE=\"$eform_data{'Ecom_BillTo_Telecom_Phone_Number'}\">
-<INPUT TYPE=HIDDEN NAME=EMAIL VALUE=\"$eform_data{'Ecom_BillTo_Online_Email'}\">
-<INPUT TYPE=HIDDEN NAME=CVV VALUE=\"$eform_data{'Ecom_Payment_Card_CVV'}\">
-<!--Shipping Address-->
-<INPUT TYPE=HIDDEN NAME=HW2SHIP VALUE=\"$eform_data{'Ecom_ShipTo_Method'}\">
-<INPUT TYPE=HIDDEN NAME=SHIPNAME VALUE=\"$eform_data{'Ecom_ShipTo_Postal_Name_First'} $eform_data{'Ecom_ShipTo_Postal_Name_Last'}\">
-<INPUT TYPE=HIDDEN NAME=SHIPTOSTREET VALUE=\"$eform_data{'Ecom_ShipTo_Postal_Street_Line1'}\">
-<INPUT TYPE=HIDDEN NAME=SHIPTOSTREET2 VALUE=\"$eform_data{'Ecom_ShipTo_Postal_Street_Line2'}\">
-<INPUT TYPE=HIDDEN NAME=SHIPTOSTREET3 VALUE=\"$eform_data{'Ecom_ShipTo_Postal_Street_Line3'}\">
-<INPUT TYPE=HIDDEN NAME=SHIPTOCITY VALUE=\"$eform_data{'Ecom_ShipTo_Postal_City'}\">
-<INPUT TYPE=HIDDEN NAME=SHIPTOSTATE VALUE=\"$eform_data{'Ecom_ShipTo_Postal_StateProv'}\">
-<INPUT TYPE=HIDDEN NAME=SHIPTOZIP VALUE=\"$eform_data{'Ecom_ShipTo_Postal_PostalCode'}\">
-<INPUT TYPE=HIDDEN NAME=SHIPTOCOUNTRY VALUE=\"$eform_data{'Ecom_ShipTo_Postal_CountryCode'}\">
-<!--Billing Data-->
-<INPUT TYPE=HIDDEN NAME=HCODE VALUE=\"$sc_pass_used_to_scramble\">
-<INPUT TYPE="HIDDEN" NAME="process_order" VALUE="yes">
-<INPUT TYPE="IMAGE" NAME="Submit" VALUE="Submit Order For Processing"
-SRC="$zOffline_picserve?secpicserve=submit_order.gif" border=0>
-&nbsp;&nbsp;&nbsp;&nbsp;
-</FORM>
-</CENTER>
-</TD><TD WIDTH="50%">
-<CENTER><BR>
-<FORM METHOD=POST
-ACTION="$sc_stepone_order_script_url">
-<INPUT TYPE=HIDDEN NAME="order_form_button" VALUE="1">
-$HREF_FIELDS
-<INPUT TYPE=HIDDEN NAME="HCODE" VALUE="$sc_pass_used_to_scramble">
-<INPUT TYPE=HIDDEN NAME="gateway" VALUE="zOffline"> 
-<INPUT TYPE=HIDDEN NAME="ofn" VALUE="zOffline"> 
-<INPUT TYPE="IMAGE" NAME="Make Changes" VALUE="Make Changes" 
-SRC="$zOffline_picserve?secpicserve=make_changes.gif" BORDER=0>
-</FORM>
-</CENTER>
-</TD>
-</TR>
-</TABLE>
-
-</FONT>
-</CENTER>
-ENDOFTEXT
-}
-
-###############################################################
-sub get_zOffline_confirm_middle{
-local(*form_data,$invoice_number,$customer_number,
-$tbldef,$top_message,$tbldef2,$authPrice,$time) = @_;
-
-local($my_ShipTo_Postal_Street,$my_BillTo_Postal_Street,$formatted_price);
-local($answer)='';
-
-$my_ShipTo_Postal_Street = $form_data{'Ecom_ShipTo_Postal_Street_Line1'};
-if ($form_data{'Ecom_ShipTo_Postal_Street_Line2'} ne "") {
- $my_ShipTo_Postal_Street .= "<BR>$form_data{'Ecom_ShipTo_Postal_Street_Line2'}";
-}
-if ($form_data{'Ecom_ShipTo_Postal_Street_Line3'} ne "") {
- $my_ShipTo_Postal_Street .= "<BR>$form_data{'Ecom_ShipTo_Postal_Street_Line3'}";
-}
-
-$my_BillTo_Postal_Street = $form_data{'Ecom_BillTo_Postal_Street_Line1'};
-if ($form_data{'Ecom_BillTo_Postal_Street_Line2'} ne "") {
- $my_BillTo_Postal_Street .= "<BR>$form_data{'Ecom_BillTo_Postal_Street_Line2'}";
-}
-if ($form_data{'Ecom_BillTo_Postal_Street_Line3'} ne "") {
- $my_BillTo_Postal_Street .= "<BR>$form_data{'Ecom_BillTo_Postal_Street_Line3'}";
-}
-
-$formatted_price = &format_price($authPrice);
-
-$answer.= <<ENDOFTEXT;
-
-<TABLE $tbldef>
-
-<TR BGCOLOR="#FFFFFF">
-<TD>
-&nbsp;
-</TD>
-</TR>
-
-<TR>
-<TD>
-<FONT FACE="ARIAL" SIZE="2" COLOR="#000000">
-$top_message
-</FONT>
-</TD>
-</TR>
-</TABLE>
-
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-<CENTER>
-<TABLE $tbldef2>
-<TR>
-<TD COLSPAN=2>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-<B>Customer Information</B>
-</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=100>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-Customer Number
-</FONT>
-</TD>
-<TD WIDTH=400>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$cart_id
-</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-Order Number
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$sc_temp_invoice_number
-</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD COLSPAN=2>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-<B>Billing Address</B>
-</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-Name
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$form_data{'Ecom_BillTo_Postal_Name_First'} $form_data{'Ecom_BillTo_Postal_Name_Last'}
-&nbsp;</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-Street
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$my_BillTo_Postal_Street
-&nbsp;</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-City
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$form_data{'Ecom_BillTo_Postal_City'}
-&nbsp;</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-State
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$form_data{'Ecom_BillTo_Postal_StateProv'}
-&nbsp;</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-Zip
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$form_data{'Ecom_BillTo_PostalCode'}
-&nbsp;</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-Country
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK> 
-$form_data{'Ecom_BillTo_Postal_CountryCode'}
-&nbsp;</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-Phone
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$form_data{'Ecom_BillTo_Telecom_Phone_Number'}
-&nbsp;</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-E-Mail
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$form_data{'Ecom_BillTo_Online_Email'}
-&nbsp;</FONT>
-</TD>
-</TR>
-
-<!--Shipping Address-->
-
-<TR>
-<TD COLSPAN=2>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-<B>Shipping Information</B>
-</FONT>
-</TD>
-</TR>
-
-ENDOFTEXT
-
-if ($form_data{'Ecom_ShipTo_Method'} ne ""){
-$answer.= <<ENDOFTEXT;
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-Ship via:
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$form_data{'Ecom_ShipTo_Method'}
-&nbsp;</FONT>
-</TD>
-</TR>
-ENDOFTEXT
-}
-
-$answer.= <<ENDOFTEXT;
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-Name
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$form_data{'Ecom_ShipTo_Postal_Name_First'} $form_data{'Ecom_ShipTo_Postal_Name_Last'}
-&nbsp;</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-Street
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$my_ShipTo_Postal_Street
-&nbsp;</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-City
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$form_data{'Ecom_ShipTo_Postal_City'}
-&nbsp;</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-State
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$form_data{'Ecom_ShipTo_Postal_StateProv'}
-&nbsp;</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-Zip
-</FONT>
-</TD>
-<TD WIDTH=350>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$form_data{'Ecom_ShipTo_Postal_PostalCode'}
-&nbsp;</FONT>
-</TD>
-</TR>
-
-<TR>
-<TD WIDTH=150>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-Country
-</FONT>
-<TD>
-<FONT FACE=ARIAL SIZE=-1 COLOR=BLACK>
-$form_data{'Ecom_ShipTo_Postal_CountryCode'}
-&nbsp;</FONT>
-</TD>
-</TR>
-
-</TABLE>
-ENDOFTEXT
-
-return $answer;
-}
-###############################################################
-sub process_zOffline_Order {
-local($subtotal, $total_quantity,
-      $total_measured_quantity,
-      $text_of_cart, $weight,
-      $required_fields_filled_in, $product, $quantity, $options,
-      $text_of_confirm_email, $text_of_admin_email, $emailCCnum, $logCCnum);
-local($stevo_shipping_thing) = "";
-local($stevo_shipping_names) = "";
-local($order_ok_final_msg,$order_ok_final_msg_tbl);
-local($ship_thing_too,$ship_instructions,$TEMP,$temp,$pass); 
-
-
-# BEGIN REFERRING SITE VALIDATION
-local ($referringDomain, $acceptedDomain);
-
-$acceptedDomain = $sc_order_script_url;
-$referringDomain = $ENV{'HTTP_REFERER'};
-
-$referringDomain =~ s/\?.*//g;
-$referringDomain =~ s/http:\/\///g;
-$referringDomain =~ s/\/.*//g;
-$referringDomain =~ s/\/agora.cgi//g;
-
-$acceptedDomain =~ s/\?.*//g;
-$acceptedDomain =~ s/http:\/\///g;
-$acceptedDomain =~ s/\/.*//g;
-$acceptedDomain =~ s/\/agora.cgi//g;
-
-if ($referringDomain =~ "^w*\.")
-{
-$referringDomain =~ s/^w*\.//i;
-}
-
-if ($acceptedDomain =~ "^w*\.")
-{
-$acceptedDomain =~ s/^w*\.//i;
-}
-
-if ($referringDomain ne $acceptedDomain)
-{
-print "$acceptedDomain is the accepted referrer.<br>";
-print "$referringDomain is not a valid referrer<br>";
-print "Refering Site Authentication Failed!";
-&call_exit;   
-}
-# END REFERRING SITE VALIDATION
-
-# First, we output the header of
-# the processing of the order
-		
-$orderDate = &get_date;
-
-print qq~
-<HTML>
-$sc_special_page_meta_tags
-<HEAD>
-<TITLE>$messages{'ordcnf_08'}</TITLE>
-$sc_standard_head_info</HEAD>
-<BODY $sc_standard_body_info>
-~;
-
-$text_of_cart .= "Order Date:    $orderDate\n";
-$text_of_cart .= "Gateway:       zOffline\n\n";
-
-$text_of_cart .= "  --PRODUCT INFORMATION--\n\n";
-
-open (CART, "$sc_cart_path") ||
-&file_open_error("$sc_cart_path", "display_cart_contents", __FILE__, __LINE__);
-
-while (<CART>)
-	{
-	$cartData++;
-	@cart_fields = split (/\|/, $_);
-	$quantity = $cart_fields[0];
-	$product_price = $cart_fields[3];
-	$product = $cart_fields[4];
-	$weight = $cart_fields[6];
-	$options = $cart_fields[$cart{"options"}];
-	$options =~ s/$sc_opt_sep_marker/, /g;
-	$text_of_cart .= &cart_textinfo(*cart_fields);
-	$stevo_shipping_thing .="|$quantity\*$weight";
-	$stevo_shipping_names .="|$product\($options\)";
-        &codehook("process-cart-item");
-	}
-close(CART);
-
-# Now let's check the _VERIFY file, just to be sure ...
-if (!(-f "$sc_verify_order_path")){
-&SecureStoreHeader;
-print <<ENDOFTEXT;
-<CENTER>
-<TABLE WIDTH=500>
-<TR>
-<TD WIDTH=500>
-<FONT FACE=ARIAL>
-$messages{'ordcnf_03'}
-$messages{'ordcnf_02'}
-</FONT>
-</TD>
-</TR>
-</TABLE>
-<CENTER>  
-
-ENDOFTEXT
-
-# and the footer is printed
-
-&SecureStoreFooter;
-
-print qq!
-</BODY>
-</HTML>
-!;
-
-&call_exit;
-
- }
-
-&load_verify_file;
-
-if ($sc_zOffline_show_table =~ /yes/i) {
-  $order_ok_final_msg = $messages{'ordcnf_09'};
-  if ($order_ok_final_msg eq '') {
-   # Default so something is there, use $messages{'ordcnf_09'} though 
-   # to customize, set it in the Free Form Logic (either location.)
-    $order_ok_final_msg = $messages{'ordcnf_01'};
-    $order_ok_final_msg .= "Print this page for your records.  You will ";
-    $order_ok_final_msg .= "receive an email receipt shortly.<br>\n";
-    $order_ok_final_msg =
-	"<TABLE WIDTH=500 $cart_table_def><TR><TD>" .
-	$order_ok_final_msg .
-	"</TD></TR></TABLE>\n";
-   }
-  $special_message = $order_ok_final_msg;
-  { local(%form_data) = %vform;
-    local($sc_use_verify_values_for_display) = "yes";
-    &display_cart_table("verify");
-  }
- } else {
-  &SecureStoreHeader;
- }
-
-# All our answers are stored in the verify file now, so load them!
-if ($sc_scramble_cc_info =~ /yes/i ) {
-  $vform{'Ecom_Payment_Orig_Card_Number'} = 
-   $vform_Ecom_Payment_Orig_Card_Number;
-  $vform{'Ecom_Payment_Card_Number'} =
-   $vform_Ecom_Payment_Card_Number;
-  $vform{'Ecom_Payment_BankAcct_Number'} = 
-   $vform_Ecom_Payment_BankAcct_Number;
-  $vform{'Ecom_Payment_BankRoute_Number'} = 
-   $vform_Ecom_Payment_BankRoute_Number; 
-  $vform{'Ecom_Payment_Bank_Name'} = 
-   $vform_Ecom_Payment_Bank_Name; 
- }
-foreach $inx (keys %vform) {
-  $form_data{$inx} = $vform{$inx};
- }
-# and do special processing as required
-&zOffline_response_prep;
-
-# re-create the old-style order confirmation form variables
-$form_data{'METHOD'} = $form_data{'Ecom_Payment_Card_Type'};
-$form_data{'CARDNUM'} = $form_data{'Ecom_Payment_Card_Number'};
-$form_data{'CARDNUM'} =~ s/\ \ /\ /g; # de-over-blank it
-$form_data{'CARDNUM'} =~ s/\ \ /\ /g; # de-over-blank it
-$form_data{'EXPDATE'} = 
-"Month: $vform_Ecom_Payment_Card_ExpDate_Month " .
-"Day: $vform_Ecom_Payment_Card_ExpDate_Day " . 
-"Year: $vform_Ecom_Payment_Card_ExpDate_Year";
-$my_EXPDATE = $form_data{'EXPDATE'};
-
-if ($vform_Ecom_Payment_Pay_Type eq 'PO') {
-  $emailMETHOD = $form_data{'METHOD'};
-  $form_data{'CARDNUM'} = $vform_Ecom_Payment_PO_Number;
-  $emailCCnum = $form_data{'CARDNUM'};
-  $logCCnum = $form_data{'CARDNUM'};
- } else { # Check or CC
-  if ($sc_use_pgp =~ /yes/i) { #assume using secure access if using PGP
-    $emailMETHOD = $form_data{'METHOD'};
-    $emailCCnum = $form_data{'CARDNUM'};
-    $logCCnum = $form_data{'CARDNUM'};
-  } else {
-    $emailMETHOD = "XXXX";
-    $emailCCnum = "XXXXXXXX";
-    $emailCCnum .= substr($form_data{'CARDNUM'},8,65);
-    $logCCnum = substr($form_data{'CARDNUM'},0,8);
-    $logCCnum .= "XXXXXXXX";
-  }
-}
-
-$verify_error = "";
-
-$sc_orderlib_use_SBW_for_ship_ins = $sc_use_SBW;
-&codehook("orderlib-ship-instructions");
-if ($sc_orderlib_use_SBW_for_ship_ins =~ /yes/i)
-{
-($ship_thing_too,$ship_instructions) = 
- &ship_put_in_boxes($stevo_shipping_thing,$stevo_shipping_names,
- $sc_verify_Origin_ZIP,$sc_verify_boxes_max_wt); 
-}
-
-$test_shipping = $form_data{'SHIPPING'};
-$test_shipping =~ s/[^0-9\.]//g;
-if (!($sc_verify_shipping == $test_shipping)){
-  $verify_error .= "  Could not verify Shipping Cost" . "\n";
- }
-$test = $form_data{'DISCOUNT'};
-$test =~ s/[^0-9\.]//g;
-if (!($sc_verify_discount == $test)){
-  $verify_error .= "  Could not verify Discount Amount\n";
- }
-$test = $form_data{'SALESTAX'};
-$test =~ s/[^0-9\.]//g;
-if (!($sc_verify_tax == $test)){
-  $verify_error .= "  Could not verify Sales Tax\n";
- }
-
-$running_total = $form_data{'PLAINAMOUNT'};
-#$running_total =~ s/[^\d\.]//g;# strip off non numeric stuff
-
-if (!((0+$sc_verify_grand_total) == (0+$running_total))){
-  $verify_error .= "  Could not verify order Total Amount\n";
-  $verify_error .= "  expected: $sc_verify_grand_total\n";
-  $verify_error .= "  observed: $running_total\n";
- }
-if ($verify_error ne ""){
-  $text_of_cart .= "** NOTE: Automatic verification not possible, this order\n" .
-  "will be manually verified.  Reason automatic verification\n" . 
-  "was not possible:\n" . $verify_error . "\n";
- }
-
-$text_of_confirm_email .= $messages{'ordcnf_07'};
-$text_of_confirm_email .= $text_of_cart;
-$text_of_confirm_email .= "\n";
-$text_of_cart .= "  --ORDER INFORMATION--\n\n";
-
-$text_of_cart .= "CUSTID:        $form_data{'CUSTID'}\n";
-$text_of_admin_email .= "CUSTID:        $form_data{'CUSTID'}\n";
-
-$text_of_cart .= "INVOICE:       $form_data{'INVOICE'}\n";
-$text_of_confirm_email .= "INVOICE:       $form_data{'INVOICE'}\n";
-$sc_temp_invoice_number = $form_data{'INVOICE'};
-
-$temp = &display_price($sc_verify_subtotal);
-$text_of_cart .= "SUBTOTAL:      $temp\n";
-$text_of_confirm_email .= "SUBTOTAL:      $temp\n";
-$sc_verify_subtotal_temp3 = $temp;
-
-if ($form_data{'SHIPPING'})
-{
-$temp = &display_price($form_data{'SHIPPING'});
-$text_of_cart .= "SHIPPING:      $temp\n";
-$text_of_confirm_email .= "SHIPPING:      $temp\n";
-}
-
-if ($sc_use_SBW =~ /yes/i)
-{
- $text_of_confirm_email .= "SHIP VIA:      $form_data{'HW2SHIP'}\n";
-}
-
-if ($form_data{'DISCOUNT'})
-{
-$text_of_cart .= "DISCOUNT:      $form_data{'DISCOUNT'}\n";
-$text_of_confirm_email .= "DISCOUNT:      $form_data{'DISCOUNT'}\n";
-}
-
-if ($form_data{'SALESTAX'})
-{
-$text_of_cart .= "SALES TAX:     $form_data{'SALESTAX'}\n";
-$text_of_confirm_email .= "SALES TAX:     $form_data{'SALESTAX'}\n";
-}
-
-if ($form_data{'EXTRATAX1'})
-{
-$temp = substr(substr($sc_extra_tax1_name,0,13).":               ",0,15);
-$text_of_cart .= "$temp$form_data{'EXTRATAX1'}\n";
-$text_of_confirm_email .= "$temp$form_data{'EXTRATAX1'}\n";
-}
-
-if ($form_data{'EXTRATAX2'})
-{
-$temp = substr(substr($sc_extra_tax2_name,0,13).":               ",0,15);
-$text_of_cart .= "$temp$form_data{'EXTRATAX2'}\n";
-$text_of_confirm_email .= "$temp$form_data{'EXTRATAX2'}\n";
-}
-
-if ($form_data{'EXTRATAX3'})
-{
-$temp = substr(substr($sc_extra_tax3_name,0,13).":               ",0,15);
-$text_of_cart .= "$temp$form_data{'EXTRATAX3'}\n";
-$text_of_confirm_email .= "$temp$form_data{'EXTRATAX3'}\n";
-}
-
-$temp = &display_price($sc_verify_grand_total);
-
-$text_of_cart .= "TOTAL:         $temp\n";
-$text_of_confirm_email .= "TOTAL:         $temp\n\n";
-
-$text_of_admin_email = $text_of_cart;
-
-$text_of_cart .= "METHOD:        $form_data{'METHOD'}\n";
-$text_of_admin_email .= "METHOD:        $emailMETHOD\n";
-
-$text_of_cart .= "NUMBER:        $logCCnum\n";
-$text_of_admin_email .= "NUMBER:        $emailCCnum\n";
-
-if ($sc_verify_paid_by_ccard =~ /yes/i) {
-$text_of_cart .= "EXP:           $my_EXPDATE\n";
-$text_of_admin_email .= "EXP:           $form_data{'EXPDATE'}\n";
-}
-
-if ($form_data{'Ecom_Payment_Card_CVV'} ne "") {
-$text_of_cart .= "CVV2:           $form_data{'Ecom_Payment_Card_CVV'}\n";
-$text_of_admin_email .= "CVV2:           $form_data{'Ecom_Payment_Card_CVV'}\n";
-}
-
-$text_of_cart .= "DESCRIPTION:   $form_data{'DESCRIPTION'}\n\n";
-$text_of_admin_email .= "DESCRIPTION:   $form_data{'DESCRIPTION'}\n\n";
-
-$text_of_cart .= "BILLING INFORMATION --------------\n\n";
-$text_of_admin_email .= "BILLING INFORMATION --------------\n\n";
-
-$text_of_cart .= "NAME:          $form_data{'NAME'}\n";
-$text_of_admin_email .= "NAME:          $form_data{'NAME'}\n";
-
-$text_of_cart .= "ADDRESS:       $form_data{'ADDRESS'}\n";
-$text_of_admin_email .= "ADDRESS:       $form_data{'ADDRESS'}\n";
-
-if ($form_data{'ADDRESS2'} ne "") {
-  $text_of_cart .= "               $form_data{'ADDRESS2'}\n";
-  $text_of_admin_email .= "               $form_data{'ADDRESS2'}\n";
- }
-
-if ($form_data{'ADDRESS3'} ne "") {
-  $text_of_cart .= "               $form_data{'ADDRESS3'}\n";
-  $text_of_admin_email .= "               $form_data{'ADDRESS3'}\n";
- }
-
-$text_of_cart .= "CITY:          $form_data{'CITY'}\n";
-$text_of_admin_email .= "CITY:          $form_data{'CITY'}\n";
-
-$text_of_cart .= "STATE:         $form_data{'STATE'}\n";
-$text_of_admin_email .= "STATE:         $form_data{'STATE'}\n";
-
-$text_of_cart .= "ZIP:           $form_data{'ZIP'}\n";
-$text_of_admin_email .= "ZIP:           $form_data{'ZIP'}\n";
-
-$text_of_cart .= "COUNTRY:       $form_data{'COUNTRY'}\n";
-$text_of_admin_email .= "COUNTRY:       $form_data{'COUNTRY'}\n";
-
-$text_of_cart .= "PHONE:         $form_data{'PHONE'}\n";
-$text_of_admin_email .= "PHONE:         $form_data{'PHONE'}\n";
-
-$text_of_cart .= "EMAIL:         $form_data{'EMAIL'}\n\n";
-$text_of_admin_email .= "EMAIL:         $form_data{'EMAIL'}\n\n";
-
-$text_of_cart .= "SHIPPING INFORMATION --------------\n\n";
-$text_of_admin_email .= "SHIPPING INFORMATION --------------\n\n";
-
-$text_of_cart .= "SHIP VIA:      $form_data{'HW2SHIP'}\n";
-$text_of_admin_email .= "SHIP VIA:      $form_data{'HW2SHIP'}\n";
-
-$text_of_cart .= "NAME:          $form_data{'SHIPNAME'}\n";
-$text_of_admin_email .= "NAME:          $form_data{'SHIPNAME'}\n";
-
-$text_of_cart .= "ADDRESS:       $form_data{'SHIPTOSTREET'}\n";
-$text_of_admin_email .= "ADDRESS:       $form_data{'SHIPTOSTREET'}\n";
-
-if ($form_data{'SHIPTOSTREET2'} ne "") {
-  $text_of_cart .= "               $form_data{'SHIPTOSTREET2'}\n";
-  $text_of_admin_email .= "               $form_data{'SHIPTOSTREET2'}\n";
- }
-
-if ($form_data{'SHIPTOSTREET3'} ne "") {
-  $text_of_cart .= "               $form_data{'SHIPTOSTREET3'}\n";
-  $text_of_admin_email .= "               $form_data{'SHIPTOSTREET3'}\n";
- }
-
-$text_of_cart .= "CITY:          $form_data{'SHIPTOCITY'}\n";
-$text_of_admin_email .= "CITY:          $form_data{'SHIPTOCITY'}\n";
-
-$text_of_cart .= "STATE:         $form_data{'SHIPTOSTATE'}\n";
-$text_of_admin_email .= "STATE:         $form_data{'SHIPTOSTATE'}\n";
-
-$text_of_cart .= "ZIP:           $form_data{'SHIPTOZIP'}\n";
-$text_of_admin_email .= "ZIP:           $form_data{'SHIPTOZIP'}\n";
-
-$text_of_cart .= "COUNTRY:       $form_data{'SHIPTOCOUNTRY'}\n\n";
-$text_of_admin_email .= "COUNTRY:       $form_data{'SHIPTOCOUNTRY'}\n\n";
-
-if ($ship_instructions ne "") {
-  $text_of_cart .= "Shipping Instructions: \n$ship_instructions\n\n"; 
-  $text_of_admin_email .= "Shipping Instructions:\n$ship_instructions\n\n"; 
- } 
-
-$text_of_cart .= $XCOMMENTS;
-$text_of_admin_email .= $XCOMMENTS_ADMIN;
-$text_of_confirm_email .= $XCOMMENTS;
-
-# 'Init' the emails ...
-$temp = &init_shop_keep_email;
-$text_of_cart = $temp . $text_of_cart;
-$text_of_admin_email = $temp . $text_of_admin_email;
-$text_of_confirm_email = &init_customer_email . $text_of_confirm_email;
-
-# Add any other info ...
-$temp = &addto_shop_keep_email;
-$text_of_cart .= $temp;
-$text_of_admin_email .= $temp;
-$text_of_confirm_email .= &addto_customer_email;
-
-if ($sc_use_pgp =~ /yes/i)
-{
-&require_supporting_libraries(__FILE__, __LINE__, "$sc_pgp_lib_path");
-$text_of_cart = &make_pgp_file($text_of_cart, "$sc_pgp_temp_file_path/$$.pgp");
-$text_of_cart = "\n" . $text_of_cart . "\n";
-
-$text_of_admin_email = &make_pgp_file($text_of_admin_email, "$sc_pgp_temp_file_path/$$.pgp");
-$text_of_admin_email = "\n" . $text_of_admin_email . "\n";
-}
-
-if ($sc_send_order_to_email =~ /yes/i)
-{
-&send_mail($sc_admin_email, $sc_order_email, "Online Order",$text_of_admin_email);
-}
-
-&log_order($text_of_cart,$form_data{'INVOICE'},$form_data{'CUSTID'});
-
-if (($cartData) && ($form_data{'EMAIL'} ne ""))
-{
-&send_mail($sc_admin_email, $form_data{'EMAIL'},$messages{'ordcnf_08'},
-           "$text_of_confirm_email");
-}
-  
-if ($sc_zOffline_show_table =~ /yes/i) {
-  $order_ok_final_msg_tbl = $messages{'ordcnf_10'}; 
-  if ($order_ok_final_msg_tbl eq '') {
-   # Default so something is there, use $messages{'ordcnf_10'} though 
-   # to customize, set it in the Free Form Logic (either location.)
-    $order_ok_final_msg_tbl = &get_date . "<br><br>Order Confirmation:";
-   }
-  $temp = 
-    &get_zOffline_confirm_middle(*form_data,$invoice_number,
-    $customer_number,$zOffline_ver_tbldef,$order_ok_final_msg_tbl,
-    $zOffline_ver_tbldef2,$authPrice,$time) . "<br>\n";
- } else {
-  $temp = $messages{'ordcnf_01'};
- }
-$sc_affiliate_order_unique = $form_data{'INVOICE'};
-$sc_affiliate_order_total = $sc_verify_subtotal_temp3;
-
-print <<ENDOFTEXT;
-<CENTER>
-<TABLE WIDTH=500>
-<TR>
-<TD WIDTH=500>
-<FONT FACE=ARIAL>
-$temp
-</FONT>
-</TD>
-</TR>
-</TABLE>
-</CENTER>  
-ENDOFTEXT
-
-print <<ENDOFTEXT;
-<CENTER>
-<TABLE WIDTH=500>
-<TR>
-<TD WIDTH=500>
-<FONT FACE=ARIAL>
-$messages{'ordcnf_02'}
-<br>
-$sc_affiliate_image_call
-</FONT>
-</TD>
-</TR>
-</TABLE>
-</CENTER>  
-
-ENDOFTEXT
-
-# This empties the cart after the order is successful
-&empty_cart;
-
-# and the footer is printed
-
-&SecureStoreFooter;
-
-print qq!
-</BODY>
-</HTML>
-!;
-
-} # End of process_order_form
-
-#################################################################
-
-1; # Library
diff -ruN 4.0K-4b/log_files/access.log 5.0.000/log_files/access.log
--- 4.0K-4b/log_files/access.log	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/log_files/access.log	2006-10-31 09:40:27.000000000 -0600
@@ -1 +0,0 @@
-||||||possible bookmarks|
diff -ruN 4.0K-4b/picserve.cgi 5.0.000/picserve.cgi
--- 4.0K-4b/picserve.cgi	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/picserve.cgi	2006-10-31 09:40:27.000000000 -0600
@@ -1,13 +1,6 @@
 #!/usr/bin/perl -T
-#
-# helper program that speeds up pic serving
-# includes contents of cgi-lib.pl for increased speed
-# be sure to ste the paths correctly in the next few lines
-
-$versions{'picserve.cgi'} = "20021020";
-
+$versions{'picserve.cgi'} = "5.0.000";
 &ReadParse(*form_data);
-
 if ($form_data{'picserve'} ne "") {
   &serve_picture($form_data{'picserve'},"./html/images");
   exit;
@@ -20,25 +13,20 @@
 ########################################################################
 sub serve_picture
 {
-
  local ($qstr,$sc_path_of_images_directory) = @_;
  local ($test, $test2, $my_path_to_image);
-
  $qstr =~ /([\w\-\=\+\/\.\:]+)/;
  $qstr = "$1";
-
  $my_path_to_image = $sc_path_of_images_directory . $qstr ;
  $test = substr($my_path_to_image,0,6);
  $test2 = substr($my_path_to_image,(length($my_path_to_image)-3),3);
-
  if ($test2=~ /jpg/i || $test2 =~ /gif/i || $test2 =~ /png/i) {
+  # file is ok to display
   if ($test2=~ /jpg/i) {# .jpg is jpeg file
     $test2 = "jpeg";
    }
   if ($test=~ /http:\//i || $test =~ /https:/i) {
-#    use LWP::Simple;
-#    print "Content-type: image/$test2\n\n";
-#    print get($my_path_to_image);
+   # need to GET the info .. no implemented here in agora
    } else { 
     print "Content-type: image/$test2\n\n";
     if (!(-f $my_path_to_image)) {
@@ -61,8 +49,10 @@
 # http://www.agoracart.com  4/30/2000 SPK
 # Fixes a problem with MSIE 5.01
 #*********************************************************************
+
 # Perl Routines to Manipulate CGI input
 # cgi-lib@pobox.com
+# $Id: cgi-lib.pl,v 2.18 1999/02/23 08:16:43 brenner Exp $
 #
 # Copyright (c) 1993-1999 Steven E. Brenner  
 # Unpublished work.
@@ -70,61 +60,48 @@
 # copyright above is maintained, modifications are documented, and
 # credit is given for any use of the library.
 #
+# Thanks are due to many people for reporting bugs and suggestions
+
 # For more information, see:
 #     http://cgi-lib.stanford.edu/cgi-lib/
-
 $cgi_lib'version = sprintf("%d.%02d", q$Revision: 2.18 $ =~ /(\d+)\.(\d+)/);
 $versions{'cgi-lib'}= "$cgi_lib'version with Agora MSIE Patch";
-
-$cgi_lib'maxdata    = 131072;    
-$cgi_lib'writefiles =      0;    
-                                 
-$cgi_lib'filepre    = "cgi-lib"; 
-
-# Do not change the following parameters unless you have special reasons
-$cgi_lib'bufsize  =  8192;    
-$cgi_lib'maxbound =   100;    
-$cgi_lib'headerout =    0;    
-
+$cgi_lib'maxdata    = 131072;
+$cgi_lib'writefiles =      0;
+$cgi_lib'filepre    = "cgi-lib";
+$cgi_lib'bufsize  =  8192; 
+$cgi_lib'maxbound =   100; 
+$cgi_lib'headerout =    0;
+#####################################################################
 sub ReadParse {
-
   local ($perlwarn);
   $perlwarn = $^W;
   $^W = 0;
-
-  local (*in) = shift if @_;    # CGI input
-  local (*incfn,                # Client's filename (may not be provided)
-         *inct,                 # Client's content-type (may not be provided)
-         *insfn) = @_;          # Server's filename (for spooled files)
+  local (*in) = shift if @_; 
+  local (*incfn,
+         *inct,
+         *insfn) = @_;
 
 # SPK added $first_type and $junk below:
-  local ($len, $type, $first_type, $meth, $errflag, $cmdflag, $got, $name, $junk);
-        
-  binmode(STDIN);   # we need these for DOS-based systems
-  binmode(STDOUT);  # and they shouldn't hurt anything else 
+  local ($len, $type, $first_type, $meth, $errflag, $cmdflag, $got, $name, $junk);     
+  binmode(STDIN);
+  binmode(STDOUT);
   binmode(STDERR);
-        
-  # Get several useful env variables
   $type = $ENV{'CONTENT_TYPE'};
   $len  = $ENV{'CONTENT_LENGTH'};
   $meth = $ENV{'REQUEST_METHOD'};
-  
   if ($len > $cgi_lib'maxdata) { #'
       &CgiDie("cgi-lib.pl: Request to receive too much data: $len bytes\n");
   }
-
 # SPK look at only the first if there is a comma-delimited CONTENT-TYPE list
   ($first_type,$junk) = split(/\,/,$type,2);
-
   if (!defined $meth || $meth eq '' || $meth eq 'GET' ||
       $meth eq 'HEAD' ||
       $first_type eq 'application/x-www-form-urlencoded') {
     local ($key, $val, $i);
-        
-    # Read in text
     if (!defined $meth || $meth eq '') {
       $in = $ENV{'QUERY_STRING'};
-      $cmdflag = 1;  # also use command-line options
+      $cmdflag = 1;
     } elsif($meth eq 'GET' || $meth eq 'HEAD') {
       $in = $ENV{'QUERY_STRING'};
     } elsif ($meth eq 'POST') {
@@ -133,72 +110,55 @@
     } else {
       &CgiDie("cgi-lib.pl: Unknown request method: $meth\n");
     }
-
     @in = split(/[&;]/,$in); 
-    push(@in, @ARGV) if $cmdflag; 
-
+    push(@in, @ARGV) if $cmdflag;
     foreach $i (0 .. $#in) {
       $in[$i] =~ s/\+/ /g;
-
-      ($key, $val) = split(/=/,$in[$i],2); # splits on the first =.
-
+      ($key, $val) = split(/=/,$in[$i],2);
       $key =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge;
       $val =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge;
-
       $in{$key} .= "\0" if (defined($in{$key}));
       $in{$key} .= $val;
     }
-
   } elsif ($ENV{'CONTENT_TYPE'} =~ m#^multipart/form-data#) {
 $errflag = !(eval <<'END_MULTIPART');
-
     local ($buf, $boundary, $head, @heads, $cd, $ct, $fname, $ctype, $blen);
     local ($bpos, $lpos, $left, $amt, $fn, $ser);
     local ($bufsize, $maxbound, $writefiles) = 
       ($cgi_lib'bufsize, $cgi_lib'maxbound, $cgi_lib'writefiles);
-
-
     $buf = ''; 
-
-    ($boundary) = $type =~ /boundary="([^"]+)"/; #";   
+    ($boundary) = $type =~ /boundary="([^"]+)"/; #";
     ($boundary) = $type =~ /boundary=(\S+)/ unless $boundary;
     &CgiDie ("Boundary not provided: probably a bug in your server") 
       unless $boundary;
     $boundary =  "--" . $boundary;
     $blen = length ($boundary);
-
     if ($ENV{'REQUEST_METHOD'} ne 'POST') {
       &CgiDie("Invalid request method for  multipart/form-data: $meth\n");
     }
-
     if ($writefiles) {
       local($me);
       stat ($writefiles);
       $writefiles = "/tmp" unless  -d _ && -w _;
-      # ($me) = $0 =~ m#([^/]*)$#;
       $writefiles .= "/$cgi_lib'filepre"; 
     }
 
-    $left = $len;
+   $left = $len;
    PART: 
     while (1) {
       die $@ if $errflag;
-
       $amt = ($left > $bufsize+$maxbound-length($buf) 
               ?  $bufsize+$maxbound-length($buf): $left);
       $errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != $amt);
       die "Short Read: wanted $amt, got $got\n" if $errflag;
       $left -= $amt;
-
       $in{$name} .= "\0" if defined $in{$name}; 
       $in{$name} .= $fn if $fn;
-
       $name=~/([-\w]+)/;  # This allows $insfn{$name} to be untainted
       if (defined $1) {
         $insfn{$1} .= "\0" if defined $insfn{$1}; 
         $insfn{$1} .= $fn if $fn;
       }
- 
      BODY: 
       while (($bpos = index($buf, $boundary)) == -1) {
         if ($left == 0 && $buf eq '') {
@@ -209,19 +169,19 @@
                   "of multipart. Format of CGI input is wrong.\n");
         }
         die $@ if $errflag;
-        if ($name) {  # if no $name, then it's the prologue -- discard
+        if ($name) { 
           if ($fn) { print FILE substr($buf, 0, $bufsize); }
           else     { $in{$name} .= substr($buf, 0, $bufsize); }
         }
         $buf = substr($buf, $bufsize);
-        $amt = ($left > $bufsize ? $bufsize : $left); #$maxbound==length($buf);
+        $amt = ($left > $bufsize ? $bufsize : $left);
         $errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != $amt);
         die "Short Read: wanted $amt, got $got\n" if $errflag;
         $left -= $amt;
       }
-      if (defined $name) {  # if no $name, then it's the prologue -- discard
+      if (defined $name) { 
         if ($fn) { print FILE substr($buf, 0, $bpos-2); }
-        else     { $in {$name} .= substr($buf, 0, $bpos-2); } # kill last \r\n
+        else     { $in {$name} .= substr($buf, 0, $bpos-2); } 
       }
       close (FILE);
       last PART if substr($buf, $bpos + $blen, 2) eq "--";
@@ -231,8 +191,6 @@
       $errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != $amt);
       die "Short Read: wanted $amt, got $got\n" if $errflag;
       $left -= $amt;
-
-
       undef $head;  undef $fn;
      HEAD:
       while (($lpos = index($buf, "\r\n\r\n")) == -1) { 
@@ -257,15 +215,15 @@
       ($cd) = grep (/^\s*Content-Disposition:/i, @heads);
       ($ct) = grep (/^\s*Content-Type:/i, @heads);
 
-      ($name) = $cd =~ /\bname="([^"]+)"/i; #"; 
+      ($name) = $cd =~ /\bname="([^"]+)"/i; 
       ($name) = $cd =~ /\bname=([^\s:;]+)/i unless defined $name;  
 
-      ($fname) = $cd =~ /\bfilename="([^"]*)"/i; #"; # filename can be null-str
+      ($fname) = $cd =~ /\bfilename="([^"]*)"/i;
       ($fname) = $cd =~ /\bfilename=([^\s:;]+)/i unless defined $fname;
       $incfn{$name} .= (defined $in{$name} ? "\0" : "") . 
         (defined $fname ? $fname : "");
 
-      ($ctype) = $ct =~ /^\s*Content-type:\s*"([^"]+)"/i;  #";
+      ($ctype) = $ct =~ /^\s*Content-type:\s*"([^"]+)"/i;
       ($ctype) = $ct =~ /^\s*Content-Type:\s*([^\s:;]+)/i unless defined $ctype;
       $inct{$name} .= (defined $in{$name} ? "\0" : "") . $ctype;
 
@@ -279,7 +237,6 @@
       undef $fname;
       undef $ctype;
     }
-
 1;
 END_MULTIPART
     if ($errflag) {
@@ -295,25 +252,22 @@
   } else {
     &CgiDie("cgi-lib.pl: Unknown Content-type: $ENV{'CONTENT_TYPE'}\n");
   }
-
-  # no-ops to avoid warnings
   $insfn = $insfn;
   $incfn = $incfn;
   $inct  = $inct;
-
   $^W = $perlwarn;
-
   return ($errflag ? undef :  scalar(@in)); 
 }
 
+##################################################################
 sub PrintHeader {
   return "Content-type: text/html\n\n";
 }
 
+
 sub HtmlTop
 {
   local ($title) = @_;
-
   return <<END_OF_TEXT;
 <html>
 <head>
@@ -324,12 +278,12 @@
 END_OF_TEXT
 }
 
-
 sub HtmlBot
 {
   return "</body>\n</html>\n";
 }
 
+
 sub SplitParam
 {
   local ($param) = @_;
@@ -342,10 +296,12 @@
   return (defined $ENV{'REQUEST_METHOD'} && $ENV{'REQUEST_METHOD'} eq "GET");
 }
 
+
 sub MethPost {
   return (defined $ENV{'REQUEST_METHOD'} && $ENV{'REQUEST_METHOD'} eq "POST");
 }
 
+
 sub MyBaseUrl {
   local ($ret, $perlwarn);
   $perlwarn = $^W; $^W = 0;
@@ -356,6 +312,7 @@
   return $ret;
 }
 
+
 sub MyFullUrl {
   local ($ret, $perlwarn);
   $perlwarn = $^W; $^W = 0;
@@ -367,10 +324,12 @@
   return $ret;
 }
 
+
 sub MyURL  {
   return &MyBaseUrl;
 }
 
+
 sub CgiError {
   local (@msg) = @_;
   local ($i,$name);
@@ -392,12 +351,14 @@
   $cgi_lib'headerout++;
 }
 
+
 sub CgiDie {
   local (@msg) = @_;
   &CgiError (@msg);
   die @msg;
 }
 
+
 sub PrintVariables {
   local (*in) = @_ if @_ == 1;
   local (%in) = @_ if @_ > 1;
@@ -419,11 +380,10 @@
   &PrintVariables(*ENV);
 }
 
-
 $cgi_lib'writefiles =  $cgi_lib'writefiles;
 $cgi_lib'bufsize    =  $cgi_lib'bufsize ;
 $cgi_lib'maxbound   =  $cgi_lib'maxbound;
 $cgi_lib'version    =  $cgi_lib'version;
 $cgi_lib'filepre    =  $cgi_lib'filepre;
 
-1; 
+1;
diff -ruN 4.0K-4b/protected/DOCS/shipping.txt 5.0.000/protected/DOCS/shipping.txt
--- 4.0K-4b/protected/DOCS/shipping.txt	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/protected/DOCS/shipping.txt	2006-10-31 09:40:27.000000000 -0600
@@ -1,117 +1,117 @@
-Custom Shipping Logic now setup in Store Manager!
--------------------------------------------------
-April 30, 2000
-
-[NOTE:  The sample order forms have SBW (Ship By Weight) options in them,
-but tbe sure to take a look at the Offline Order Form even if you do not
-use it.  It tends to have the most recent and relevant examples.]
-
-For UPS shipping, see the UPS documentation.
-
-For custom shipping logic, the sky is the limit!  Whatever code you
-want to install, it is up to you, you may interface with anything
-or calculate anything.  A sample of custom shipping code that makes the
-shipping price 12% of the order (assuming no handling charge is included)
-is:
-
-  #
-  #This simulates the old logic of a percentage (12%)  of the order:
-  $shipping_price = int($subtotal*12 + 0.5) / 100;
-  #
-
-For a handling charge, you may add it above or use the handling charge in
-the Program Settings, but don't set both!
-
-For complicated code, setup a custom library and simply call the correct
-subroutine in the custom code.
-
-In version 3.0u and higher you can force the shipping module to exit
-after your code is finished by setting:
-
-  $shipping_logic_done = "yes";
-
-If this variable is set, then the handling charge and UPS code will NOT be
-run, even if these variables were set in the Program Settings.  Unless you
-have a specific reason to do this, don't!  One reason to set this varialbe
-would be if you wrote code that shipped via UPS but added a handling
-charge per box instead of per order and therefore have no need to run
-the standard UPS code.
-
-The main advantage of using the custom code interface instead of modifying
-the library is that it is easier to upgrade to the latest version of
-agora.cgi.  You can use the older 'calculate shipping' routine as weel 
-(see below.)
-
-Basics of basing shipping on Form Variable 'the old way'
---------------------------------------------------------
-
-Before the SBW feature was added, shipping was determined by a field on 
-the orderform and an array of custom logic.  
-
-First, you have to set the form variable you will be using:
-
-  @sc_order_form_shipping_related_fields = ("Ecom_ShipTo_Method");
-
-There are five fields in the shipping variable logic array, and
-the are separated by the 'pipe' character:
- shipping related field|subtotal price|quantity|measured value|what to charge
-
-Here is one example that assigns a cost based on quantities from
-1 to infinity, and sets it as a percentage of the subtotal:
-@sc_shipping_logic = (
-"usps||1-||5%", 
-"ups||1-||10%", 
-"fedex||1-||20%"); 
-
-Instead of percents, you can assign fixed amounts, say $5 to $20 for 1-10
-items, free otherwise:
-
-@sc_shipping_logic = (
-"usps||1-10||5.00", 
-"ups||1-10||10.00", 
-"fedex||1-10||20.00"); 
-
-Instead of quantity, we could base it on cost, say 0-$30 cost they
-are charged, otherwise shipping is free or usps but 1/2 cost for 
-others:
-@sc_shipping_logic = (
-"usps|0-30|||5.00", 
-"ups|0-30|||10.00", 
-"ups|30.01-|||5.00", 
-"fedex|0-30|||20.00",
-"fedex|30.01-|||10.00");
-
-To implement it, you will need to define the logic array and call the 
-subroutine in the custom shipping logic.  Here is an example:
-
-======================================================================
-# Custom Shipping Logic Example
-# Ship based on the total order.  
-# $1-$29.99 is 3.95, $30-59.99 is 4.95, etc.:
-@sc_shipping_logic = 
-  ("|1-29.99|||3.95", 
-  "|30-59.99|||4.95", 
-  "|60-89.99|||6.95", 
-  "|90-119.99|||10.95", 
-  "|120-|||0.00"); 
-$shipping_price = &calculate_shipping($temp_total, 
-                  $total_quantity, $total_measured_quantity); 
-$shipping_logic_done = "yes"; # forces exit, no handling charge added
-======================================================================
-
-Another custom example is shown below.  Instead of using fixed amounts
-based on the order subtotal, percentages based on that amount are applied:
-
-======================================================================
-# In this example Shipping Cost is based on the total order.  
-# $1-$29.99 is 10%, $30-$59.99 is 7.5%, etc. (TURN OFF UPS!)
-# Code does not force exit, so handling charge will be added!
-@sc_shipping_logic = ( "|1-29.99|||10.0%", 
-                       "|30-59.99|||7.5%", 
-                       "|60-89.99|||5.0%", 
-                       "|90-119.99|||2.5%",
-                       "|120-|||0.00"); 
-#
-$shipping_price = &calculate_shipping($temp_total, 
-                  $total_quantity, $total_measured_quantity);
-======================================================================
+Custom Shipping Logic now setup in Store Manager!
+-------------------------------------------------
+April 30, 2000
+
+[NOTE:  The sample order forms have SBW (Ship By Weight) options in them,
+but tbe sure to take a look at the Offline Order Form even if you do not
+use it.  It tends to have the most recent and relevant examples.]
+
+For UPS shipping, see the UPS documentation.
+
+For custom shipping logic, the sky is the limit!  Whatever code you
+want to install, it is up to you, you may interface with anything
+or calculate anything.  A sample of custom shipping code that makes the
+shipping price 12% of the order (assuming no handling charge is included)
+is:
+
+  #
+  #This simulates the old logic of a percentage (12%)  of the order:
+  $shipping_price = int($subtotal*12 + 0.5) / 100;
+  #
+
+For a handling charge, you may add it above or use the handling charge in
+the Program Settings, but don't set both!
+
+For complicated code, setup a custom library and simply call the correct
+subroutine in the custom code.
+
+In version 3.0u and higher you can force the shipping module to exit
+after your code is finished by setting:
+
+  $shipping_logic_done = "yes";
+
+If this variable is set, then the handling charge and UPS code will NOT be
+run, even if these variables were set in the Program Settings.  Unless you
+have a specific reason to do this, don't!  One reason to set this varialbe
+would be if you wrote code that shipped via UPS but added a handling
+charge per box instead of per order and therefore have no need to run
+the standard UPS code.
+
+The main advantage of using the custom code interface instead of modifying
+the library is that it is easier to upgrade to the latest version of
+agora.cgi.  You can use the older 'calculate shipping' routine as weel 
+(see below.)
+
+Basics of basing shipping on Form Variable 'the old way'
+--------------------------------------------------------
+
+Before the SBW feature was added, shipping was determined by a field on 
+the orderform and an array of custom logic.  
+
+First, you have to set the form variable you will be using:
+
+  @sc_order_form_shipping_related_fields = ("Ecom_ShipTo_Method");
+
+There are five fields in the shipping variable logic array, and
+the are separated by the 'pipe' character:
+ shipping related field|subtotal price|quantity|measured value|what to charge
+
+Here is one example that assigns a cost based on quantities from
+1 to infinity, and sets it as a percentage of the subtotal:
+@sc_shipping_logic = (
+"usps||1-||5%", 
+"ups||1-||10%", 
+"fedex||1-||20%"); 
+
+Instead of percents, you can assign fixed amounts, say $5 to $20 for 1-10
+items, free otherwise:
+
+@sc_shipping_logic = (
+"usps||1-10||5.00", 
+"ups||1-10||10.00", 
+"fedex||1-10||20.00"); 
+
+Instead of quantity, we could base it on cost, say 0-$30 cost they
+are charged, otherwise shipping is free or usps but 1/2 cost for 
+others:
+@sc_shipping_logic = (
+"usps|0-30|||5.00", 
+"ups|0-30|||10.00", 
+"ups|30.01-|||5.00", 
+"fedex|0-30|||20.00",
+"fedex|30.01-|||10.00");
+
+To implement it, you will need to define the logic array and call the 
+subroutine in the custom shipping logic.  Here is an example:
+
+======================================================================
+# Custom Shipping Logic Example
+# Ship based on the total order.  
+# $1-$29.99 is 3.95, $30-59.99 is 4.95, etc.:
+@sc_shipping_logic = 
+  ("|1-29.99|||3.95", 
+  "|30-59.99|||4.95", 
+  "|60-89.99|||6.95", 
+  "|90-119.99|||10.95", 
+  "|120-|||0.00"); 
+$shipping_price = &calculate_shipping($temp_total, 
+                  $total_quantity, $total_measured_quantity); 
+$shipping_logic_done = "yes"; # forces exit, no handling charge added
+======================================================================
+
+Another custom example is shown below.  Instead of using fixed amounts
+based on the order subtotal, percentages based on that amount are applied:
+
+======================================================================
+# In this example Shipping Cost is based on the total order.  
+# $1-$29.99 is 10%, $30-$59.99 is 7.5%, etc. (TURN OFF UPS!)
+# Code does not force exit, so handling charge will be added!
+@sc_shipping_logic = ( "|1-29.99|||10.0%", 
+                       "|30-59.99|||7.5%", 
+                       "|60-89.99|||5.0%", 
+                       "|90-119.99|||2.5%",
+                       "|120-|||0.00"); 
+#
+$shipping_price = &calculate_shipping($temp_total, 
+                  $total_quantity, $total_measured_quantity);
+======================================================================
diff -ruN 4.0K-4b/protected/Merchandising_Tools-ext_lib.pl 5.0.000/protected/Merchandising_Tools-ext_lib.pl
--- 4.0K-4b/protected/Merchandising_Tools-ext_lib.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/protected/Merchandising_Tools-ext_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,267 @@
+# file ./store/protected/Merchandising_Tools-ext_lib.pl
+#########################################################################
+#
+# Copyright (c) 2005 to Date K-Factor Technologies, Inc.
+# http://www.k-factor.net/  and  http://www.AgoraCart.com/
+# All Rights Reserved.
+#
+# Use with permission only with AgoraCart, AgoraCartPro, AgoraSQL, AgoraCartSQL, 
+# or AgoraSuite
+#
+# This software is a separate add-on to an ecommerce shopping cart and 
+# is the confidential and proprietary information of K-Factor Technologies, Inc.  You shall
+# not disclose such Confidential Information and shall use it only in
+# conjunction with the AgoraCart (aka agora.cgi) shopping cart.
+#
+# Requires AgoraCart version 5.0.0 or above.  Just place this file in the protected directory.
+#
+# K-Factor Technologies, Inc. MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT
+# THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESSED OR IMPLIED,
+# INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+# OR NON-INFRINGEMENT.
+#
+# K-Factor Technologies, Inc. SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY
+# LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS
+# SOFTWARE OR ITS DERIVATIVES.
+#
+# You may not give this script/add-on away or distribute it an any way without
+# written permission from K-Factor Technologies, Inc.  K-Factor Technologies, Inc.
+# reserves any and all rights to distributions, add-ons, and other works based on this
+# piece of software as well as any and all rights to profit sharing and/or to charge for
+# such works and/or derivatves.
+#
+# Hosting Companies and other software integrators are encouraged to integrate additional
+# features and add-ons in their AgoraCart offerings, but must receive written permission from from
+# K-Factor Technologies, Inc. in order to distribute this add-on.
+#
+##########################################################################
+$versions{'Merchandising_Tools-ext_lib.pl'} = "5.0.000";
+
+{
+ local ($modname) = 'merchant_tools_and_resources';
+ &register_extension($modname,"Merchandising Tools",$versions{$modname});
+   &register_menu('display_MerchantTools_screen',"display_MerchantTools_screen",
+ $modname,"Merchant Tools & Resources screen");
+   &add_item_to_manager_menu("Merchandising Tools","merchandising_tools_settings_screen=yes","merchandising_tools_settings_screen");
+   &add_merchtools_settings_choice("Merchant Tools & Resources"," Merchant Tools & Resources ",
+ "display_MerchantTools_screen");
+}
+#######################################################################################
+sub display_MerchantTools_screen
+{
+local($filename)="$mgrdir/";
+print &$manager_page_header("Merchant Tools and Resources","","","","");
+
+print <<ENDOFTEXT;
+<CENTER>
+<HR>
+</CENTER>
+
+
+<CENTER>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL size=2>Welcome to the <b>AgoraCart</b> Merchant Resources Page for your store. This page lists additional tools and resources to help you promote your store.<br/><br/></font></TD>
+</TR>
+</TABLE>
+</CENTER>
+
+<CENTER>
+<TABLE>
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD COLSPAN=4 bgcolor=#99CC99 align=center><font face="Arial, Helvetica, sans-serif" size=+2><b>Site Metrics</b></font></TD>
+</TR>
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD colspan=4>
+<font size="2" face="Arial, Helvetica, sans-serif">
+
+<a href="http://www.WebStyleStats.com" target="_new"><img src="images/webstyle.jpg" width="120" height="55" border="0" align=left> <b>Web Style Stats & Site Metrics</b></a><br>
+
+Use Web Style Stats to measure all your advertising and marketing campaigns.  Web Style Stats will help you identify exactly what is working to drive visitors to your site, which pages work best in tests, and which ones are bring your customers to your order pages. Using Web Style Stats you will be able to track campaigns, keywords, web pages, links and banners that are not effective and those that are, thereby saving time, money and hassle in finding those campaigns that work best for your site and store, while optimizing your web site's  and/or store's performance.<br><br>
+
+Web Style Stats is conducting a beta for alimited time.  During this time you can sign up for a free 7 day trial with the additional benefit of a low monthly rate of $2.99 per month for as long as your account remains valid.  Your account remains valid and still tracks your stats for up to 90 days from when your paid access has expired, which is nice and convenient for those that only need to track their performance every couple of months, at which point if you desire to login and view site performance, simply renew access for 30 days or longer.<br><br>
+
+Sign up today for your free trial and lock in your promotional price during this beta period at: <a href="http://www.WebStyleStats.com" target="_new">www.WebStyleStats.com</a>
+<br><br><br>
+</font>
+
+</TD>
+</TR>
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD COLSPAN=4 bgcolor=#99CC99 align=center><font face="Arial, Helvetica, sans-serif" size=+2><b>Online Directories</b></font></TD>
+</TR>
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD colspan=4>
+<font size="2" face="Arial, Helvetica, sans-serif">
+<a href="http://www.iMegaMall.com" target="_new"><img src="images/Imega5d.gif" width="180" height="44" border="0" align=left> <b>iMegaMall</b></a><br>
+
+Increase your search engine rankings with real link in iMegaMall.com.  iMegaMall aggressively provides very small to mid-sized advertisers the opportunity to get their name in front of targeted shoppers and visitors without having giant internet companies buying up all the premium ad spots. <br><br>
+
+iMegaMall provides businesses and information content providers with a quality presence to online consumers and offers a wide range of targeted advertising and directory listing options through its large mall-department-category infrastructure of 28 Main Departments, over 500 Shopping & Informational Categories.<br><br>
+
+Sign up today for your free listing at: <a href="http://www.iMegaMall.com/info/listing.htm" target="_new">www.iMegaMall.com/info/listing.htm</a>
+<br>
+<br><br>
+
+
+<a href="http://www.AgoraCart.com/pages/Shopping/" target="_blank"><img src="images/agoracart.jpg" width="56" height="55" border="0" align=left> <b>AgoraCart Shops</b></a><br>
+
+List your Agoracart based store in the shopping section at AgoraCart.com. Listings are free as long as your site uses and/or promotes AgoraCart.<br>
+Sign up today for your free listing at: <a href="http://www.agoracart.com/cgibin/add.cgi" target="_new">www.AgoraCart.com/cgibin/add.cgi</a>
+<br>
+</font>
+
+</TD>
+</TR>
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD COLSPAN=4 bgcolor=#99CC99 align=center><font face="Arial, Helvetica, sans-serif" size=+2><b>Search Engines</b></font></TD>
+</TR>
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD colspan=4>
+<font size="2" face="Arial, Helvetica, sans-serif">
+
+<a href="http://www.SnooperClick.com" target="_blank"><img src="images/snooperclick.jpg" width="158" height="39" border="0" align=left> <b>SnooperClick.com</b></a><br>
+Snoop, Click and Go! with the fantastic SnooperClick Search Engine.  Advertise in SnooperClick for free with a $2 trial balance, or earn extra money for every valid search you refer.  Or integrate SnooperClick's search results and enhance the content of your site by placing a little bit of code into your website's html pages and earn extra money at the same time.<br><br>
+Sign up as a advertiser or affiliate at: <a href="http://www.SnooperClick.com" target="_blank">www.SnooperClick.com</a>
+<br>
+</font>
+
+</TD>
+</TR>
+
+
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD COLSPAN=4 bgcolor=#99CC99 align=center><font face="Arial, Helvetica, sans-serif" size=+2><b>Professional Freelance Exchange</b></font></TD>
+</TR>
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD colspan=4>
+<font size="2" face="Arial, Helvetica, sans-serif">
+
+<a href="http://www.AgoraXchange.com" target="_blank"><img src="images/agoraexchange.jpg" width="160" height="42" border="0" align=left><b>AgoraXchange.com</b></a><br>
+
+AgoraXchange is a service that connects freelancers with webmasters that need custom programming, design or other custom services done for their websites. Much like an auction, programming and web design projects are posted and interested freelancers bid on them. Listing a project is free for merchants.<br><br>
+An affiliate program is also available that pays you for each person you refer that signs up and posts or bids on projects that result in winning bids ... for the life of that referral.<br><br>
+
+Sign up as a webmaster, affiliate, or a freelancer at: <a href="http://www.AgoraXchange.com" target="_blank">www.AgoraXchange.com</a>
+<br>
+</font>
+
+</TD>
+</TR>
+
+</TABLE>
+</CENTER>
+<br><br>
+ENDOFTEXT
+
+print &$manager_page_footer;
+}
+#######################################################################################
+sub display_New_Orders_screen
+{
+local($filename)="$mgrdir/";
+print &$manager_page_header("Order Management New Orders","","","","");
+
+
+
+print <<ENDOFTEXT;
+<CENTER>
+<HR>
+</CENTER>
+
+<FORM ACTION="manager.cgi" METHOD="POST">
+ENDOFTEXT
+
+if($in{'system_edit_success'} ne "")
+{
+print <<ENDOFTEXT;
+<p align="center"><br><font color="#FF0000" face="Arial"><strong>$revmsg</strong></font></p><br>
+ENDOFTEXT
+}
+
+
+    if ($form{'grabtype'} eq "main"){
+    rename ("$mainlogdir$logname" , "$mainlogdir$workinglogname") || &nolog;
+    }
+
+  @single="";
+  $counter=0;
+  $ordernum="";
+  
+
+  open(LOG, "$mainlogdir$workinglogname") || &nolog;
+  flock(LOG, 2);
+  while (<LOG>){
+    if ($_ =~ /------------------------------------------------------------/){
+      if ($ordernum ne ""){
+
+      chomp $ordernum;
+      $singlename= "$ordernum.txt";
+      $singlename =~ s/ //ig;
+      $singlename =~ s/\n//ig;
+
+##for testing:
+# print "order number $singlename written <br>";
+# print "order is:<br>";
+# foreach $line(@single){
+# print "$line<br>";
+# }
+# exit;
+##end for testing
+
+      open (SINGLE, ">$processdir$singlename");
+      print SINGLE "@single";
+      $counter ++;
+      close (SINGLE);
+
+  
+      $ordernum="";
+      @single="";
+      }
+    }else{
+      push (@single, $_);
+      if ($_ =~/INVOICE:/i){
+      $ordernum = $_;
+      $ordernum =~ s/INVOICE://i;
+      $ordernum =~ s/ //;   
+      }   
+    }
+    
+  }
+  flock (LOG, 8);
+  close (LOG);
+
+$revmsg = "$counter orders grabbed.  You may now process these orders.";
+
+
+print &$manager_page_footer;
+}
+#######################################################################################
+
+1; # Library
diff -ruN 4.0K-4b/protected/Order_Manager-ext_lib.pl 5.0.000/protected/Order_Manager-ext_lib.pl
--- 4.0K-4b/protected/Order_Manager-ext_lib.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/protected/Order_Manager-ext_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,1904 @@
+# file ./store/protected/Order_Manager-ext_lib.pl
+#########################################################################
+#
+# Created by Mister Ed 2004 - 2005
+# Copyright (c) 2004 to Date by K-Factor Technologies, Inc. and AgoraScript
+# http://www.k-factor.net/  and  http://www.AgoraCart.com/
+# All Rights Reserved.
+#
+# Use with permission only with AgoraCart, AgoraCartPro, AgoraSQL, AgoraCartSQL, 
+# or AgoraSuite
+#
+# This software is a separate add-on to an ecommerce shopping cart and 
+# is the confidential and proprietary information of K-Factor Technologies, Inc.  You shall
+# not disclose such Confidential Information and shall use it only in
+# conjunction with the AgoraCart (aka agora.cgi) shopping cart.
+#
+# Requires AgoraCart version 5.0.0 or above.  Just place this file in the protected directory.
+#
+# K-Factor Technologies, Inc. BytePipe, AgoraScript nor any of their employees and/or representatives
+# MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT
+# THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESSED OR IMPLIED,
+# INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+# OR NON-INFRINGEMENT.
+#
+# K-Factor Technologies, Inc., BytePipe, AgoraScript nor any of their employees and/or representatives
+# LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS
+# SOFTWARE OR ITS DERIVATIVES.
+#
+# You may not give this script/add-on away or distribute it an any way without
+# written permission from K-Factor Technologies, Inc.  K-Factor Technologies, Inc.
+# reserves any and all rights to distributions, add-ons, and other works based on this
+# piece of software as well as any and all rights to profit sharing and/or to charge for
+# such works and/or derivatves.
+#
+# Hosting Companies and other software integrators are encouraged to integrate additional
+# features and add-ons in their AgoraCart offerings, but must receive written permission from from
+# K-Factor Technologies, Inc. in order to distribute this add-on to AgoraCart (aka Agora.cgi).
+#
+##########################################################################
+$versions{'Order_Manager-ext_lib.pl'} = "5.0.000";
+
+# fax number added March 11, 2006 and otehr little fixes on phone nembers by Mister Ed
+
+$scm_orderdata_ext =  "-orderdata2";
+$scm_completecart_ext =  "-complete2";
+
+$scm_monthyearmasterlog_name = "_MasterOrderLog.log2";
+$scm_monthyearindexlog_name = "_indexOrderLog.log2";
+$scm_productlog_name = "_productSalesLog.prd2";
+
+{
+ local ($modname) = 'order_management';
+ &register_extension($modname,"Order Management",$versions{$modname});
+   &register_menu('display_Order_mgr_screen',"display_Order_mgr_screen",
+  $modname,"Order Management - Store Settings");
+ &add_settings_choice("Order Management Settings"," Order Management Settings ",
+  "display_Order_mgr_screen");
+ &register_menu('OrderManagementSettings',"write_Order_mgr_settings",
+  $modname,"Write Order Settings");
+
+#not done
+ &add_item_to_manager_menu("Order Management","order_management_settings_screen=yes","");
+   &register_menu('select_individual_order_screen',"select_individual_order_screen",
+  $modname,"View Individual Order");
+   &add_ordermanage_settings_choice("View Individual Order"," View / Update Individual Order ",
+  "select_individual_order_screen");
+   &register_menu('select_monthly_orders_screen',"select_monthly_orders_screen",
+  $modname,"View Orders within a Month");
+   &add_ordermanage_settings_choice("View Orders - Select by Month"," View Orders - Select by Month ",
+  "select_monthly_orders_screen");
+ &register_menu('CompileMonthlyOrdersReport',"compile_Monthly_Order_information",
+  $modname,"Create Order List for a Month");
+   &register_menu('display_productsales_report_screen',"display_productsales_report_screen",
+  $modname,"Product Sales Report - Basic");
+   &add_ordermanage_settings_choice("Product Sales Report"," Product Sales Report - Basic ",
+  "display_productsales_report_screen");
+   &register_menu('select_delete_order_screen',"select_delete_order_screen",
+  $modname,"Remove or Delete Order or log entry");
+   &add_ordermanage_settings_choice("Remove or Delete Order or log entry"," Remove Order Files / Log Entry ",
+  "select_delete_order_screen");
+}
+   &register_menu('viewertrigger',"select2_individual_order_screen",
+  $modname,"viewertrigger");
+   &register_menu('invoiceviewertrigger',"print_order_invoice",
+  $modname,"invoiceviewertrigger");
+   &register_menu('originalviewertrigger',"view_Original_order_log",
+  $modname,"originalviewertrigger");
+   &register_menu('packingviewertrigger',"print_order_packingslip",
+  $modname,"packingviewertrigger");
+   &register_menu('deleteviewertrigger',"select_delete_order_screen",
+  $modname,"deleteviewertrigger");
+ &register_menu('OpenIndividualOrder',"select_individual_order_screen",
+  $modname,"View Order builder");
+ &register_menu('UpdateIndividualOrder',"write_individual_Order_information",
+  $modname,"Write Order updates");
+   &register_menu('ViewProductSales',"display_productsales_report_screen",
+  $modname,"Product Sales Report - Basic - New Lookup");
+   &register_menu('DeleteIndividualOrder',"delete_Order_or_Order_Log",
+  $modname,"Delete Order ffiles or sales logs routines");
+################################################################################
+sub write_Order_mgr_settings {
+local($myset)="";
+
+&ReadParse;
+
+$myset .= "\$sc_order_log_name = \"$in{'name_of_the_log_file'}\";\n";
+$myset .= "\$sc_send_order_to_log = \"$in{'log_orders_yes_no'}\";\n";
+$myset .= "\$sc_write_individual_order_logs = \"$in{'sc_write_individual_order_logs'}\";\n";
+$myset .= "\$sc_write_monthly_master_order_logs = \"$in{'sc_write_monthly_master_order_logs'}\";\n";
+$myset .= "\$sc_write_monthly_short_order_logs = \"$in{'sc_write_monthly_short_order_logs'}\";\n";
+$myset .= "\$sc_write_product_sales_logs = \"$in{'sc_write_product_sales_logs'}\";\n";
+$myset .= "\$sc_defaultProductStatus = \"$in{'sc_defaultProductStatus'}\";\n";
+$myset .= "\$sc_order_status_default = \"$in{'sc_order_status_default'}\";\n";
+$myset .= "\$sc_item_Total_Weight = \"$in{'sc_item_Total_Weight'}\";\n";
+
+&update_store_settings('ORDERMANAGER',$myset);
+  &display_Order_mgr_screen;
+ }
+#######################################################################################
+sub delete_Order_or_Order_Log {
+
+&ReadParse;
+#untaint a few thingies
+ $in{'invoiceNumber'} =~ /([\w\=\+]+)/;
+ my $invoiceNum = "$1";
+ $in{'customerNumber'} =~ /([\w\-\=\+\/]+)\.(\w+)/;
+ my $cust_id = "$1.$2";
+ $in{'month'} =~ /([\w\=\+]+)/;
+ my $month = "$1";
+ $in{'year'} =~ /([\w\=\+]+)/;
+ my $year = "$1";
+
+    my ($cart_string,$cart_string_short,$orderLogString,$orderLogString2,$orderLogString3) = '';
+    my ($logfile)= "$sc_logs_dir/$sc_order_log_name";
+    my ($filename3) = "$sc_order_log_directory_path/$year/$month/$month$year";
+    my ($filename8) = "$sc_order_log_directory_path/$year/$month/$invoiceNum"."-"."$cust_id"."$scm_orderdata_ext";
+    my ($filename9) = "$sc_order_log_directory_path/$year/$month/$invoiceNum"."-"."$cust_id"."$scm_completecart_ext";
+    my ($filename10) = "$sc_order_log_directory_path/$year/$month/";
+    my ($filename11) = "$sc_order_log_directory_path/$year/$month$year";
+    my ($filename12) = "$sc_order_log_directory_path/$year/";
+
+if (($in{'deletionType'} =~ /individual/i) && ($in{'deleteIndividualData'} =~ /yes/i)) {
+    unlink("$filename8") || print "Error: could not unlink $filename8<br>";
+}
+
+if (($in{'deletionType'} =~ /individual/i) && ($in{'deleteIndividualComplete'} =~ /yes/i)) {
+    unlink("$filename9") || print "Error: could not delete $filename9<br>";
+}
+
+if (($in{'deletionType'} =~ /month/i) && ($month ne '') && ($year ne '')) {
+if (-e $filename10) {
+  opendir(LOGFILEDIR,"$filename10")|| print "Cannot open $filename10 Directory<br>";
+  my @dirfilenames = readdir(LOGFILEDIR);
+  close (LOGFILEDIR);
+  foreach $dirfilenames(@dirfilenames) {
+      if ($dirfilenames =~ /[\d]+/) {
+         my $tempfilename = "$filename10$dirfilenames";
+         $tempfilename =~ /([\w\=\+\.\-\/]+)/;
+         $tempfilename = "$1";
+         unlink("$tempfilename") || print "Error: could not delete $tempfilename<br>";
+         }
+  }
+  rmdir("$filename10");
+}
+}
+if (($in{'deletionType'} =~ /year/i) && ($year ne '')) {
+  opendir(LOGFILEDIR,"$filename12")|| print "Error: Cannot open $filename12 Directory<br>";
+  my @dirfilenames = readdir(LOGFILEDIR);
+  close (LOGFILEDIR);
+      foreach $dirfilenames(@dirfilenames) {
+      if ($dirfilenames =~ /[\w]+/) {
+             if (-d "$filename12$dirfilenames") {
+                 opendir(MONTHLOGFILES,"$filename12$dirfilenames")|| print "Error: Cannot open $filename12$dirfilenames Directory!<br>";
+                 my @permonthfilenames = readdir(MONTHLOGFILES);
+                 close (MONTHLOGFILES);
+                 foreach $permonthfilenames(@permonthfilenames) {
+                     if ($permonthfilenames =~ /[\w]+/) {
+                         my $permonthtempfilename = "$filename12$dirfilenames/$permonthfilenames";
+                         $permonthtempfilename =~ /([\w\=\+\.\-\/]+)/;
+                         $permonthtempfilename = "$1";
+                         unlink("$permonthtempfilename");
+                     }
+                 }
+                 $dirfilenames =~ /([\w\=\+\.\-\/]+)/;
+                 $dirfilenames = "$1";
+                 rmdir("$filename12$dirfilenames");
+             } else {
+         my $tempfilename = "$filename12$dirfilenames";
+         $tempfilename =~ /([\w\=\+\.\-\/]+)/;
+         $tempfilename = "$1";
+         unlink("$tempfilename") || print "Error: could not unlink $tempfilename<br>";
+             }
+      }
+      }
+
+ rmdir("$filename12");
+}
+
+if (($sc_write_monthly_short_order_logs =~ /yes/i) && ($in{'deletionType'} =~ /individual/i) && ($in{'deleteIndividualOverviewSalesLog'} =~ /yes/i)){
+           $filename4 = "$filename3$scm_monthyearindexlog_name";
+           open (ORDERLOG4, "$filename4");
+           while (<ORDERLOG4>) {
+               if (($_ =~ /$invoiceNum/) && ($_ =~ /$cust_id/)) {
+                   # dead space
+               } else {
+                   $orderLogString .= $_;
+               }
+           }
+           close (ORDERLOG4);
+&get_file_lock("$logfile.lockfile");
+           open (ORDERLOG4, ">$filename4");
+           print ORDERLOG4 $orderLogString;
+           close (ORDERLOG4);
+&release_file_lock("$logfile.lockfile");
+}
+
+ if (($sc_write_monthly_master_order_logs =~ /yes/i) && ($in{'deletionType'} =~ /individual/i) && ($in{'deleteIndividualMasterSalesLog'} =~ /yes/i)) {
+           $filename5 = "$filename11$scm_monthyearmasterlog_name";
+           open (ORDERLOG5, "$filename5");
+           while (<ORDERLOG5>) {
+               if (($_ =~ /$invoiceNum/) && ($_ =~ /$cust_id/)) {
+                   # dead space
+               } else {
+                   $orderLogString2 .= $_;
+               }
+           }
+           close (ORDERLOG5);
+&get_file_lock("$logfile.lockfile");
+           open (ORDERLOG5, ">$filename5");
+           print ORDERLOG5 $orderLogString2;
+           close (ORDERLOG5);
+&release_file_lock("$logfile.lockfile");
+}
+
+ if (($sc_send_order_to_log =~ /yes/i) && ($in{'deletionType'} =~ /individual/i) && ($in{'deleteIndividualNewOrderLog'} =~ /yes/i)) {
+           open (ORDERLOG, "$logfile");
+           while (<ORDERLOG>) {
+               if (($_ =~ /$invoiceNum/) && ($_ =~ /$cust_id/)) {
+                   # dead space
+               } else {
+                   $orderLogString3 .= $_;
+               }
+           }
+           close (ORDERLOG);
+&get_file_lock("$logfile.lockfile");
+           open (ORDERLOG, ">$logfile");
+           print ORDERLOG $orderLogString3;
+           close (ORDERLOG);
+&release_file_lock("$logfile.lockfile");
+}
+    %in = '';
+   &select_delete_order_screen;
+}
+#######################################################################################
+sub view_Original_order_log {
+my($year,$month,$inv_number,$filename,$cust_id,$stuff,$line,$new_output);
+$month = $in{'month'};
+$year = $in{'year'};
+$inv_number = $in{'invoiceNumber'};
+$cust_id = $in{'customerNumber'};
+$filename = "$sc_order_log_directory_path/$year/$month/$inv_number"."-"."$cust_id"."$scm_completecart_ext";
+
+print &$manager_page_header("Individual Order Management - Complete Original Order Log","","","","");
+
+print qq~
+<center><br>
+<a href="manager.cgi?invoiceviewertrigger=invoiceviewertrigger&invoiceNumber=$in{'invoiceNumber'}&customerNumber=$in{'customerNumber'}&year=$year&month=$month" target="_new">View Invoice</a>  |  <a href="manager.cgi?viewertrigger=viewertrigger&invoiceNumber=$in{'invoiceNumber'}&customerNumber=$in{'customerNumber'}&year=$year&month=$month">View/Update</a>  |  <a href="manager.cgi?packingviewertrigger=packingviewertrigger&invoiceNumber=$in{'invoiceNumber'}&customerNumber=$in{'customerNumber'}&year=$year&month=$month" target="_new">Packing Slip</a>
+<br><br></center>
+~;
+
+    if (-e $filename) {
+        open (ORDERLOGLOOK, "$filename");
+        while ($stuff=<ORDERLOGLOOK>) {
+            print "$stuff<br>";
+        }
+        close (ORDERLOGLOOK);
+    }
+
+print &$manager_page_footer;
+
+}
+#######################################################################################
+sub display_productsales_report_screen {
+my($year,$filename,$stuff,$item,$qty,$new_output) ='';
+$year = $in{'year'};
+$filename = "$sc_order_log_directory_path/$year"."$scm_productlog_name";
+
+    if (-e $filename) {
+        $new_output .= "<table border=0 cellpadding=3>";
+        open (PRODUCTLOGLOOK, "$filename");
+        while ($stuff=<PRODUCTLOGLOOK>) {
+            ($item,$qty) = split("\t",$stuff);
+            $new_output .= "<tr><td><font face=arial size=2>$item</font></td><td><font face=arial size=2>&nbsp;&nbsp;$qty</font></td></tr>";
+        }
+        close (PRODUCTLOGLOOK);
+        $new_output .= "</table>";
+    }
+
+print &$manager_page_header("Product Sales Log","","","","");
+
+print qq~
+<CENTER>
+<FORM METHOD="POST" ACTION="manager.cgi">
+<TABLE width=700>
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD COLSPAN=2 BGCOLOR="#99CC99" align=center><font face="Arial, Helvetica, sans-serif" size=+2><b>Indvidual Product Sales for $year</b></font></TD>
+</TR>
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD colspan=4>
+<TABLE width=700>
+<TR>
+<TD colspan=2>
+<font size="2" face="Arial, Helvetica, sans-serif">
+
+</font></TD>
+<TD colspan=2 valign=top><font size="2" face="Arial, Helvetica, sans-serif"><CENTER>
+<b>Select a Product Year to View</b>: <SELECT NAME="year">
+$scm_yearlinks
+</SELECT>
+<INPUT TYPE="HIDDEN" NAME="system_edit_success" VALUE="yes">
+<INPUT NAME="ViewProductSales" TYPE="SUBMIT" VALUE="View Products Sold Report">
+</CENTER>
+<br>
+</font>
+</TD>
+</TR></table>
+</TD>
+</TR>
+$new_output
+</TABLE></form></form>
+</CENTER>
+~;
+
+print &$manager_page_footer;
+
+}
+#######################################################################################
+sub print_order_packingslip {
+my($year,$month,$inv_number,$filename,$filename2,$cust_id,$stuff,$line,$new_output);
+
+my $cartContentsStringViewer = '';
+my (@cart_contents_rows) = '';
+my $cartrow_counter = "0";
+%cart_contents_rowsHash;
+$month = $in{'month'};
+$year = $in{'year'};
+$inv_number = $in{'invoiceNumber'};
+$cust_id = $in{'customerNumber'};
+$filename = "$sc_order_log_directory_path/$year/$month/$inv_number"."-"."$cust_id"."$scm_orderdata_ext";
+$filename2 = "./admin_files/mgrpackingslipTemplate.html";
+
+if ((($in{'invoiceNumber'} ne '') && ($in{'customerNumber'} ne '') && ($in{'year'} ne '') && ($in{'month'} ne '')) || ($in{'packingviewertrigger'} ne '')) {
+    if (-e $filename) {
+        open (ORDERLOGLOOK, "$filename");
+        $stuff=<ORDERLOGLOOK>;
+        ($in{'year'},$in{'month'},$in{'day'},$in{'invoiceNumber'},$in{'customerNumber'},$in{'orderStatus'},$in{'shiptrackingID'},$in{'firstName'},$in{'lastName'},$in{'fullName'},$in{'companyName'},$in{'customerPhone'},$in{'faxNumber'},$in{'emailAddress'},$in{'orderFromAddress'},$in{'customerAddress2'},$in{'customerAddress3'},$in{'orderFromCity'},$in{'orderFromState'},$in{'orderFromPostal'},$in{'orderFromCountry'},$in{'shipToName'},$in{'shipToAddress'},$in{'shipToAddress2'},$in{'shipToAddress3'},$in{'shipToCity'},$in{'shipToState'},$in{'shipToPostal'},$in{'shipToCountry'},$in{'shiptoResidential'},$in{'insureShipment'},$in{'shipMethod'},$in{'shippingTotal'},$in{'salesTax'},$in{'tax1'},$in{'tax2'},$in{'tax3'},$in{'discounts'},$in{'netProfit'},$in{'subTotal'},$in{'orderTotal'},$in{'affiliateTotal'},$in{'affiliateID'},$in{'affiliateMisc'},$in{'user1'},$in{'user2'},$in{'user3'},$in{'user4'},$in{'user5'},$in{'adminMessages'},$in{'cartContents'},$in{'GatewayUsed'},$in{'shippingMessages'},$in{'xcomments'},$in{'termsOfService'}) = split(/\t/,$stuff);
+        close (ORDERLOGLOOK);
+        @cart_contents_rows = split(/::/,$in{'cartContents'},$in{'GatewayUsed'});
+        foreach $cart_contents_rows(@cart_contents_rows) {
+            $cart_contents_rowsHash{$cartrow_counter} = $cart_contents_rows;
+            $cartrow_counter++;
+        }
+
+    } else {
+        $in{'system_edit_success'} = "notexist";
+    }
+
+}
+
+
+ my ($quantity,$product,$pid,$category,$price,$shipping,$optionids,$productStatus,$downladables,$altorigin,$nontaxable,$cartuser5,$cartuser6,$formattedoptions,$priceafteroptions,$product_options_sting,$isDownloadble) ="";
+        my $Key;
+        foreach $Key (sort keys(%cart_contents_rowsHash)) {
+        my @cart_fields2 = split(/\|/,$cart_contents_rowsHash{$Key});
+        $quantity = $cart_fields2[0];
+        $pid = $cart_fields2[1];
+        $category = $cart_fields2[2];
+        $product = $cart_fields2[4];
+        $shipping = $cart_fields2[5];
+        $downladables = $cart_fields2[7];
+        $altorigin = $cart_fields2[8];
+        $nontaxable = $cart_fields2[9];
+        $cartuser5 = $cart_fields2[10];
+        $cartuser6 = $cart_fields2[11];
+        $formattedoptions = $cart_fields2[12];
+        $productStatus = $cart_fields2[14];
+
+my @product_formatted_cartoptions = split(/\{/,$formattedoptions);
+
+foreach $product_formatted_cartoptions(@product_formatted_cartoptions) {
+$product_options_sting .= "$product_formatted_cartoptions &nbsp;&nbsp;&nbsp;";
+}
+
+if ($downladables ne "") {
+   $isDownloadable = "&nbsp;&nbsp;&nbsp;<font color=red>This is a Downloadable Product</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
+} else {
+   $isDownloadable = "&nbsp;&nbsp;&nbsp;<b>Product Status:</b> $productStatus&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
+}
+my $itemTotalWeight = &format_pricemgr($quantity * $shipping);
+$cartContentsStringViewer .= qq~
+<tr>
+<td colspan=8><font face=arial size=1><hr width=99%></font>
+</td></tr>
+<tr>
+<td><font face=arial size=1>$product  &nbsp;&nbsp;&nbsp; - &nbsp;&nbsp;&nbsp; $pid &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $isDownloadable
+<b>$sc_item_Total_Weight :</b> $itemTotalWeight
+<br><b>Options:</b>&nbsp;&nbsp;$product_options_sting</font></td>
+<td><font face=arial size=1>$quantity</font></td>
+<td><font face=arial size=1>&nbsp;</font></td>
+</tr>
+~;
+$product_options_sting = "";
+        }
+
+    if (($in{'fullName'} eq "") && (($in{'lastName'} ne "") && ($in{'firstName'} ne ""))) {
+        $in{'fullName'} = "$in{'firstName'} $in{'lastName'}";
+    }
+
+   open (TEMPLATE, "$filename2");
+   while ($line = <TEMPLATE>) {
+      $line =~ s/%%year%%/$in{'year'}/g;
+      $line =~ s/%%day%%/$in{'day'}/g;
+      $line =~ s/%%month%%/$in{'month'}/g;
+      $line =~ s/%%invoiceNumber%%/$in{'invoiceNumber'}/g;
+      $line =~ s/%%customerNumber%%/$in{'customerNumber'}/g;
+      $line =~ s/%%orderStatus%%/$in{'orderStatus'}/g;
+      $line =~ s/%%shiptrackingID%%/$in{'shiptrackingID'}/g;
+      $line =~ s/%%firstName%%/$in{'firstName'}/g;
+      $line =~ s/%%lastName%%/$in{'lastName'}/g;
+      $line =~ s/%%fullName%%/$in{'fullName'}/g;
+      $line =~ s/%%companyName%%/$in{'companyName'}/g;
+      $line =~ s/%%customerPhone%%/$in{'customerPhone'}/g;
+      $line =~ s/%%faxNumber%%/$in{'faxNumber'}/g;
+      $line =~ s/%%emailAddress%%/$in{'emailAddress'}/g;
+      $line =~ s/%%orderFromAddress%%/$in{'orderFromAddress'}/g;
+      $line =~ s/%%customerAddress2%%/$in{'customerAddress2'}/g;
+      $line =~ s/%%customerAddress3%%/$in{'customerAddress3'}/g;
+      $line =~ s/%%orderFromCity%%/$in{'orderFromCity'}/g;
+      $line =~ s/%%orderFromState%%/$in{'orderFromState'}/g;
+      $line =~ s/%%orderFromPostal%%/$in{'orderFromPostal'}/g;
+      $line =~ s/%%orderFromCountry%%/$in{'orderFromCountry'}/g;
+      $line =~ s/%%shipToName%%/$in{'shipToName'}/g;
+      $line =~ s/%%shipToAddress%%/$in{'shipToAddress'}/g;
+      $line =~ s/%%shipToAddress2%%/$in{'shipToAddress2'}/g;
+      $line =~ s/%%shipToAddress3%%/$in{'shipToAddress3'}/g;
+      $line =~ s/%%shipToCity%%/$in{'shipToCity'}/g;
+      $line =~ s/%%shipToState%%/$in{'shipToState'}/g;
+      $line =~ s/%%shipToPostal%%/$in{'shipToPostal'}/g;
+      $line =~ s/%%shipToCountry%%/$in{'shipToCountry'}/g;
+      $line =~ s/%%shipToResidential%%/$in{'shiptoResidential'}/g;
+      $line =~ s/%%shipToInsured%%/$in{'insureShipment'}/g;
+      $line =~ s/%%shipMethod%%/$in{'shipMethod'}/g;
+      $line =~ s/%%user1%%/$in{'user1'}/g;
+      $line =~ s/%%user2%%/$in{'user2'}/g;
+      $line =~ s/%%user3%%/$in{'user3'}/g;
+      $line =~ s/%%user4%%/$in{'user4'}/g;
+      $line =~ s/%%user5%%/$in{'user5'}/g;
+      $line =~ s/%%adminMessages%%/$in{'adminMessages'}/g;
+      $line =~ s/%%cartContents%%/$cartContentsStringViewer/g;
+      $line =~ s/%%shippingMessages%%/$in{'shippingMessages'}/g;
+      $line =~ s/%%xcomments%%/$in{'xcomments'}/g;
+      $line =~ s/%%termsOfService%%/$in{'termsOfService'}/g;
+      $new_output .= $line;
+   }
+   close (TEMPLATE);
+print "$new_output";
+
+}
+
+#######################################################################################
+sub print_order_invoice {
+my($year,$month,$inv_number,$filename,$filename2,$cust_id,$stuff,$line,$new_output);
+
+my $cartContentsStringViewer = '';
+my (@cart_contents_rows,@cart_temp_rows) = '';
+my $cartrow_counter = "0";
+%cart_contents_rowsHash;
+$month = $in{'month'};
+$year = $in{'year'};
+$inv_number = $in{'invoiceNumber'};
+$cust_id = $in{'customerNumber'};
+$filename = "$sc_order_log_directory_path/$year/$month/$inv_number"."-"."$cust_id"."$scm_orderdata_ext";
+$filename2 = "./admin_files/mgrinvoiceTemplate.html";
+
+if ((($in{'invoiceNumber'} ne '') && ($in{'customerNumber'} ne '') && ($in{'year'} ne '') && ($in{'month'} ne '')) || ($in{'invoiceviewertrigger'} ne '')) {
+    if (-e $filename) {
+        open (ORDERLOGLOOK, "$filename");
+        $stuff=<ORDERLOGLOOK>;
+        ($in{'year'},$in{'month'},$in{'day'},$in{'invoiceNumber'},$in{'customerNumber'},$in{'orderStatus'},$in{'shiptrackingID'},$in{'firstName'},$in{'lastName'},$in{'fullName'},$in{'companyName'},$in{'customerPhone'},$in{'faxNumber'},$in{'emailAddress'},$in{'orderFromAddress'},$in{'customerAddress2'},$in{'customerAddress3'},$in{'orderFromCity'},$in{'orderFromState'},$in{'orderFromPostal'},$in{'orderFromCountry'},$in{'shipToName'},$in{'shipToAddress'},$in{'shipToAddress2'},$in{'shipToAddress3'},$in{'shipToCity'},$in{'shipToState'},$in{'shipToPostal'},$in{'shipToCountry'},$in{'shiptoResidential'},$in{'insureShipment'},$in{'shipMethod'},$in{'shippingTotal'},$in{'salesTax'},$in{'tax1'},$in{'tax2'},$in{'tax3'},$in{'discounts'},$in{'netProfit'},$in{'subTotal'},$in{'orderTotal'},$in{'affiliateTotal'},$in{'affiliateID'},$in{'affiliateMisc'},$in{'user1'},$in{'user2'},$in{'user3'},$in{'user4'},$in{'user5'},$in{'adminMessages'},$in{'cartContents'},$in{'GatewayUsed'},$in{'shippingMessages'},$in{'xcomments'},$in{'termsOfService'},$in{'discountCode'}) = split(/\t/,$stuff);
+        close (ORDERLOGLOOK);
+        @cart_contents_rows = split(/::/,$in{'cartContents'},$in{'GatewayUsed'});
+        foreach $cart_contents_rows(@cart_contents_rows) {
+            $cart_contents_rowsHash{$cartrow_counter} = $cart_contents_rows;
+            $cartrow_counter++;
+        }
+        $in{'salesTax'} = &format_pricemgr($in{'salesTax'});
+        $in{'orderTotal'} = &format_pricemgr($in{'orderTotal'});
+        $in{'discounts'} = &format_pricemgr($in{'discounts'});
+        $in{'shippingTotal'} = &format_pricemgr($in{'shippingTotal'});
+        $in{'salesTax'} = &format_pricemgr($in{'salesTax'});
+        $in{'tax1'} = &format_pricemgr($in{'tax1'});
+        $in{'tax2'} = &format_pricemgr($in{'tax2'});
+        $in{'tax3'} = &format_pricemgr($in{'tax3'});
+    } else {
+        $in{'system_edit_success'} = "notexist";
+    }
+
+}
+ my ($quantity,$product,$pid,$category,$price,$shipping,$optionids,$productStatus,$downladables,$altorigin,$nontaxable,$cartuser5,$cartuser6,$formattedoptions,$priceafteroptions,$product_options_sting,$isDownloadble) ="";
+        my $Key;
+        foreach $Key (sort keys(%cart_contents_rowsHash)) {
+        my @cart_fields2 = split(/\|/,$cart_contents_rowsHash{$Key});
+        $quantity = $cart_fields2[0];
+        $pid = $cart_fields2[1];
+        $category = $cart_fields2[2];
+        $price = &format_pricemgr($cart_fields2[3]);
+        $product = $cart_fields2[4];
+        $shipping = $cart_fields2[5];
+        $optionids = $cart_fields2[6];
+        $downladables = $cart_fields2[7];
+        $altorigin = $cart_fields2[8];
+        $nontaxable = $cart_fields2[9];
+        $cartuser5 = $cart_fields2[10];
+        $cartuser6 = $cart_fields2[11];
+        $formattedoptions = $cart_fields2[12];
+        $priceafteroptions = &format_pricemgr($cart_fields2[13]);
+        $productStatus = $cart_fields2[14];
+my @product_formatted_cartoptions = split(/\{/,$formattedoptions);
+foreach $product_formatted_cartoptions(@product_formatted_cartoptions) {
+$product_options_sting .= "$product_formatted_cartoptions &nbsp;&nbsp;&nbsp;";
+}
+if ($downladables ne "") {
+   $isDownloadable = "&nbsp;&nbsp;&nbsp;<font color=red>This is a Downloadable Product</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
+} else {
+   $isDownloadable = "&nbsp;&nbsp;&nbsp;<b>Product Status:</b> $productStatus&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
+}
+my $itemTotalWeight = &format_pricemgr($quantity * $shipping);
+my $itemSubTotal = &format_pricemgr($quantity * $priceafteroptions);
+
+$cartContentsStringViewer .= qq~
+<tr>
+<td colspan=8><font face=arial size=1><hr width=99%></font>
+</td></tr>
+<tr>
+<td><font face=arial size=1>$product  &nbsp;&nbsp;&nbsp; - &nbsp;&nbsp;&nbsp; $pid &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $isDownloadable
+<b>$sc_item_Total_Weight :</b> $itemTotalWeight
+<br><b>Options:</b>&nbsp;&nbsp;$product_options_sting</font></td>
+<td><font face=arial size=1>$quantity</font></td>
+<td><font face=arial size=1>$sc_money_symbol $priceafteroptions<br><b>item Sub Total:</b> $sc_money_symbol $itemSubTotal</font></td>
+</tr>
+~;
+$product_options_sting = "";
+        }
+
+    if (($in{'fullName'} eq "") && (($in{'lastName'} ne "") && ($in{'firstName'} ne ""))) {
+        $in{'fullName'} = "$in{'firstName'} $in{'lastName'}";
+    }
+
+   open (TEMPLATE, "$filename2");
+   while ($line = <TEMPLATE>) {
+      $line =~ s/%%year%%/$in{'year'}/g;
+      $line =~ s/%%day%%/$in{'day'}/g;
+      $line =~ s/%%month%%/$in{'month'}/g;
+      $line =~ s/%%invoiceNumber%%/$in{'invoiceNumber'}/g;
+      $line =~ s/%%customerNumber%%/$in{'customerNumber'}/g;
+      $line =~ s/%%orderStatus%%/$in{'orderStatus'}/g;
+      $line =~ s/%%shiptrackingID%%/$in{'shiptrackingID'}/g;
+      $line =~ s/%%firstName%%/$in{'firstName'}/g;
+      $line =~ s/%%lastName%%/$in{'lastName'}/g;
+      $line =~ s/%%fullName%%/$in{'fullName'}/g;
+      $line =~ s/%%companyName%%/$in{'companyName'}/g;
+      $line =~ s/%%customerPhone%%/$in{'customerPhone'}/g;
+      $line =~ s/%%faxNumber%%/$in{'faxNumber'}/g;
+      $line =~ s/%%emailAddress%%/$in{'emailAddress'}/g;
+      $line =~ s/%%orderFromAddress%%/$in{'orderFromAddress'}/g;
+      $line =~ s/%%customerAddress2%%/$in{'customerAddress2'}/g;
+      $line =~ s/%%customerAddress3%%/$in{'customerAddress3'}/g;
+      $line =~ s/%%orderFromCity%%/$in{'orderFromCity'}/g;
+      $line =~ s/%%orderFromState%%/$in{'orderFromState'}/g;
+      $line =~ s/%%orderFromPostal%%/$in{'orderFromPostal'}/g;
+      $line =~ s/%%orderFromCountry%%/$in{'orderFromCountry'}/g;
+      $line =~ s/%%shipToName%%/$in{'shipToName'}/g;
+      $line =~ s/%%shipToAddress%%/$in{'shipToAddress'}/g;
+      $line =~ s/%%shipToAddress2%%/$in{'shipToAddress2'}/g;
+      $line =~ s/%%shipToAddress3%%/$in{'shipToAddress3'}/g;
+      $line =~ s/%%shipToCity%%/$in{'shipToCity'}/g;
+      $line =~ s/%%shipToState%%/$in{'shipToState'}/g;
+      $line =~ s/%%shipToPostal%%/$in{'shipToPostal'}/g;
+      $line =~ s/%%shipToCountry%%/$in{'shipToCountry'}/g;
+      $line =~ s/%%shipToResidential%%/$in{'shiptoResidential'}/g;
+      $line =~ s/%%shipToInsured%%/$in{'insureShipment'}/g;
+      $line =~ s/%%shipMethod%%/$in{'shipMethod'}/g;
+      $line =~ s/%%shippingTotal%%/$in{'shippingTotal'}/g;
+      $line =~ s/%%salesTax%%/$in{'salesTax'}/g;
+      $line =~ s/%%tax1%%/$in{'tax1'}/g;
+      $line =~ s/%%tax2%%/$in{'tax2'}/g;
+      $line =~ s/%%tax3%%/$in{'tax3'}/g;
+      $line =~ s/%%discounts%%/$in{'discounts'}/g;
+      $line =~ s/%%subTotal%%/$in{'subTotal'}/g;
+      $line =~ s/%%orderTotal%%/$in{'orderTotal'}/g;
+      $line =~ s/%%user1%%/$in{'user1'}/g;
+      $line =~ s/%%user2%%/$in{'user2'}/g;
+      $line =~ s/%%user3%%/$in{'user3'}/g;
+      $line =~ s/%%user4%%/$in{'user4'}/g;
+      $line =~ s/%%user5%%/$in{'user5'}/g;
+      $line =~ s/%%adminMessages%%/$in{'adminMessages'}/g;
+      $line =~ s/%%GatewayUsed%%/$in{'GatewayUsed'}/g;
+      $line =~ s/%%shippingMessages%%/$in{'shippingMessages'}/g;
+      $line =~ s/%%cartContents%%/$cartContentsStringViewer/g;
+      $line =~ s/%%money_symbol%%/$sc_money_symbol/g;
+      $line =~ s/%%xcomments%%/$in{'xcomments'}/g;
+      $line =~ s/%%termsOfService%%/$in{'termsOfService'}/g;
+      $line =~ s/%%discountCode%%/$in{'discountCode'}/g;
+      $new_output .= $line;
+   }
+   close (TEMPLATE);
+print "$new_output";
+
+}
+#######################################################################################
+sub write_individual_Order_information {
+
+ my ($quantity,$product,$pid,$category,$price,$shipping,$optionids,$productStatus,$downladables,$altorigin,$nontaxable,$cartuser5,$cartuser6,$formattedoptions,$priceafteroptions,$cartrow_counter);
+    &ReadParse;
+#untaint a few thingies
+ $in{'invoiceNumber'} =~ /([\w\=\+]+)/;
+ my $invoiceNum = "$1";
+ $in{'customerNumber'} =~ /([\w\-\=\+\/]+)\.(\w+)/;
+ my $cust_id = "$1.$2";
+ $in{'month'} =~ /([\w\=\+]+)/;
+ my $month = "$1";
+ $in{'year'} =~ /([\w\=\+]+)/;
+ my $year = "$1";
+    my ($cart_string,$cart_string_short,$orderLogString,$orderLogString2,$orderLogString3) = '';
+    my ($logfile)= "$sc_logs_dir/$sc_order_log_name";
+    my ($filename3) = "$sc_order_log_directory_path/$year/$month/$month$year";
+    my ($filename8) = "$sc_order_log_directory_path/$year/$month/$invoiceNum"."-"."$cust_id"."$scm_orderdata_ext";
+    my ($filename11) = "$sc_order_log_directory_path/$year/$month$year";
+
+##########################################################
+# recompile cart lines into a single string for order databases / logs
+
+ $cartrow_counter = $in{'cartrow_counter'};
+ my $cartrow_counter_temp = "0";
+ my $cartlog_string_thingy = "";
+ while ($cartrow_counter_temp <= $cartrow_counter) {
+   if (($in{"quantity$cartrow_counter_temp"} ne "") || ($in{"quantity$cartrow_counter_temp"} > "0")) {
+        $cartlog_string_thingy .= qq!$in{"quantity$cartrow_counter_temp"}|$in{"pid$cartrow_counter_temp"}|$in{"category$cartrow_counter_temp"}|$in{"price$cartrow_counter_temp"}|$in{"product$cartrow_counter_temp"}|$in{"shipping$cartrow_counter_temp"}|$in{"optionids$cartrow_counter_temp"}|$in{"downladables$cartrow_counter_temp"}|$in{"altorigin$cartrow_counter_temp"}|$in{"nontaxable$cartrow_counter_temp"}|$in{"cartuser5$cartrow_counter_temp"}|$in{"cartuser6$cartrow_counter_temp"}|$in{"formattedoptions$cartrow_counter_temp"}|$in{"priceafteroptions$cartrow_counter_temp"}|$in{"productStatus$cartrow_counter_temp"}!;
+   }
+   if ($cartrow_counter_temp < $cartrow_counter) {
+        $cartlog_string_thingy .= "::";
+   }
+   $cartrow_counter_temp++;
+}
+     $cart_string = "$in{'year'}\t$in{'month'}\t$in{'day'}\t$in{'invoiceNumber'}\t$in{'customerNumber'}\t$in{'orderStatus'}\t$in{'shiptrackingID'}\t$in{'firstName'}\t$in{'lastName'}\t$in{'fullName'}\t$in{'companyName'}\t$in{'customerPhone'}\t$in{'faxNumber'}\t$in{'emailAddress'}\t$in{'orderFromAddress'}\t$in{'customerAddress2'}\t$in{'customerAddress3'}\t$in{'orderFromCity'}\t$in{'orderFromState'}\t$in{'orderFromPostal'}\t$in{'orderFromCountry'}\t$in{'shipToName'}\t$in{'shipToAddress'}\t$in{'shipToAddress2'}\t$in{'shipToAddress3'}\t$in{'shipToCity'}\t$in{'shipToState'}\t$in{'shipToPostal'}\t$in{'shipToCountry'}\t$in{'shiptoResidential'}\t$in{'insureShipment'}\t$in{'shipMethod'}\t$in{'shippingTotal'}\t$in{'salesTax'}\t$in{'tax1'}\t$in{'tax2'}\t$in{'tax3'}\t$in{'discounts'}\t$in{'netProfit'}\t$in{'subTotal'}\t$in{'orderTotal'}\t$in{'affiliateTotal'}\t$in{'affiliateID'}\t$in{'affiliateMisc'}\t$in{'user1'}\t$in{'user2'}\t$in{'user3'}\t$in{'user4'}\t$in{'user5'}\t$in{'adminMessages'}\t$cartlog_string_thingy\t$in{'GatewayUsed'}\t$in{'shippingMessages'}\t$in{'xcomments'}\t$in{'termsOfService'}\t$in{'discountCode'}";
+     $cart_string_short = "$in{'year'}\t$in{'month'}\t$in{'day'}\t$in{'invoiceNumber'}\t$in{'customerNumber'}\t$in{'orderStatus'}\t$in{'firstName'}\t$in{'lastName'}\t$in{'fullName'}\t$in{'companyName'}\t$in{'emailAddress'}\t$in{'orderFromState'}\t$in{'orderFromPostal'}\t$in{'orderFromCountry'}\t$in{'shipMethod'}\t$in{'shippingTotal'}\t$in{'salesTax'}\t$in{'tax1'}\t$in{'tax2'}\t$in{'tax3'}\t$in{'discounts'}\t$in{'netProfit'}\t$in{'subTotal'}\t$in{'orderTotal'}\t$in{'affiliateTotal'}\t$in{'affiliateID'}\t$in{'affiliateMisc'}\n";
+
+     open (ORDERLOG, ">$filename8");
+     print ORDERLOG $cart_string;
+     close (ORDERLOG);
+if ($sc_write_monthly_short_order_logs =~ /yes/i) {
+           $filename4 = "$filename3$scm_monthyearindexlog_name";
+           open (ORDERLOG4, "$filename4");
+           while (<ORDERLOG4>) {
+               if ($_ =~ /$invoiceNum/) {
+                   $orderLogString .= $cart_string_short;
+               } else {
+                   $orderLogString .= $_;
+               }
+           }
+           close (ORDERLOG4);
+&get_file_lock("$logfile.lockfile");
+           open (ORDERLOG4, ">$filename4");
+           print ORDERLOG4 $orderLogString;
+           close (ORDERLOG4);
+&release_file_lock("$logfile.lockfile");
+}
+ if ($sc_write_monthly_master_order_logs =~ /yes/i) {
+           $filename5 = "$filename11$scm_monthyearmasterlog_name";
+           open (ORDERLOG5, "$filename5");
+           while (<ORDERLOG5>) {
+               if ($_ =~ /$invoiceNum/) {
+                   $orderLogString2 .= $cart_string;
+               } else {
+                   $orderLogString2 .= $_;
+               }
+           }
+           close (ORDERLOG5);
+&get_file_lock("$logfile.lockfile");
+           open (ORDERLOG5, ">$filename5");
+           print ORDERLOG5 $orderLogString2;
+           close (ORDERLOG5);
+&release_file_lock("$logfile.lockfile");
+}
+ if ($sc_send_order_to_log =~ /yes/i) {
+           open (ORDERLOG, "$logfile");
+           while (<ORDERLOG>) {
+               if ($_ =~ /$invoiceNum/) {
+                   $orderLogString3 .= $cart_string_short;
+               } else {
+                   $orderLogString3 .= $_;
+               }
+           }
+           close (ORDERLOG);
+&get_file_lock("$logfile.lockfile");
+           open (ORDERLOG, ">$logfile");
+           print ORDERLOG $orderLogString3;
+           close (ORDERLOG);
+&release_file_lock("$logfile.lockfile");
+}
+     &select_individual_order_screen;
+}
+#######################################################################################
+sub select_individual_order_screen {
+my($year,$month,$inv_number,$filename,$filename2,$cust_id,$stuff);
+
+&ReadParse;
+
+my $cartContentsStringViewer = '';
+$month = $in{'month'};
+$year = $in{'year'};
+$inv_number = $in{'invoiceNumber'};
+$cust_id = $in{'customerNumber'};
+$filename = "$sc_order_log_directory_path/$year/$month/$inv_number"."-"."$cust_id"."$scm_orderdata_ext";
+$filename2 = "$sc_order_log_directory_path/$year/$month/$inv_number"."-"."$cust_id"."$scm_completecart_ext";
+my (@cart_contents_rows,@cart_temp_rows) = '';
+my $cartrow_counter = "0";
+%cart_contents_rowsHash;
+
+if ((($in{'invoiceNumber'} ne '') && ($in{'customerNumber'} ne '') && ($in{'year'} ne '') && ($in{'month'} ne '')) || ($in{'viewertrigger'} ne '')) {
+    if (-e $filename) {
+        open (ORDERLOGLOOK, "$filename");
+        $stuff=<ORDERLOGLOOK>;
+        ($in{'year'},$in{'month'},$in{'day'},$in{'invoiceNumber'},$in{'customerNumber'},$in{'orderStatus'},$in{'shiptrackingID'},$in{'firstName'},$in{'lastName'},$in{'fullName'},$in{'companyName'},$in{'customerPhone'},$in{'emailAddress'},$in{'faxNumber'},$in{'orderFromAddress'},$in{'customerAddress2'},$in{'customerAddress3'},$in{'orderFromCity'},$in{'orderFromState'},$in{'orderFromPostal'},$in{'orderFromCountry'},$in{'shipToName'},$in{'shipToAddress'},$in{'shipToAddress2'},$in{'shipToAddress3'},$in{'shipToCity'},$in{'shipToState'},$in{'shipToPostal'},$in{'shipToCountry'},$in{'shiptoResidential'},$in{'insureShipment'},$in{'shipMethod'},$in{'shippingTotal'},$in{'salesTax'},$in{'tax1'},$in{'tax2'},$in{'tax3'},$in{'discounts'},$in{'netProfit'},$in{'subTotal'},$in{'orderTotal'},$in{'affiliateTotal'},$in{'affiliateID'},$in{'affiliateMisc'},$in{'user1'},$in{'user2'},$in{'user3'},$in{'user4'},$in{'user5'},$in{'adminMessages'},$in{'cartContents'},$in{'GatewayUsed'},$in{'shippingMessages'},$in{'xcomments'},$in{'termsOfService'},$in{'discountCode'}) = split(/\t/,$stuff);
+        close (ORDERLOGLOOK);
+        @cart_contents_rows = split(/::/,$in{'cartContents'},$in{'GatewayUsed'});
+        foreach $cart_contents_rows(@cart_contents_rows) {
+            $cart_contents_rowsHash{$cartrow_counter} = $cart_contents_rows;
+            $cartrow_counter++;
+        }
+    } else {
+        $in{'system_edit_success'} = "notexist";
+    }
+
+} elsif ((($in{'invoiceNumber'} eq '') && ($in{'customerNumber'} eq '') && ($in{'year'} eq '') && ($in{'month'} eq '')) || ($in{'viewertrigger'} ne '')) {
+        $in{'system_edit_success'} = "";
+} else {
+        $in{'system_edit_success'} = "notexist";
+}
+
+print &$manager_page_header("Individual Order Management","","","","");
+
+print <<ENDOFTEXT;
+<CENTER>
+<HR>
+</CENTER>
+
+<CENTER>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL size=2>Welcome to the <b>AgoraCart</b> Individual Order Viewer for your store.<br>
+ENDOFTEXT
+
+if ($versions{'Order_Management_custom'} ne "") {
+print qq~
+  If you need to locate the necessary order information, <a href="manager.cgi?display_custom_order_reports_screen=yes">Click Here</a> for the required information
+~;
+}
+
+print <<ENDOFTEXT;
+</font></TD>
+</TR>
+</TABLE>
+</CENTER>
+<br>
+ENDOFTEXT
+
+
+if ((($in{'system_edit_success'} ne "") && ($in{'system_edit_success'} ne "notexist"))||($in{'viewertrigger'} ne ""))
+{
+print <<ENDOFTEXT;
+<CENTER><br>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL SIZE=2 COLOR=RED><center>This Order ( $inv_number - $cust_id from $month $year ) has been 
+successfully found and/or updated.<br>Please scroll down to view it</center></FONT><font face=arial size=2>
+<center><a href="manager.cgi?invoiceviewertrigger=invoiceviewertrigger&invoiceNumber=$in{'invoiceNumber'}&customerNumber=$in{'customerNumber'}&year=$year&month=$month" target="_new">View Invoice</a>  |  <a href="manager.cgi?packingviewertrigger=packingviewertrigger&invoiceNumber=$in{'invoiceNumber'}&customerNumber=$in{'customerNumber'}&year=$year&month=$month" target="_new">Packing Slip</a>  |  <a href="manager.cgi?originalviewertrigger=originalviewertrigger&invoiceNumber=$in{'invoiceNumber'}&customerNumber=$in{'customerNumber'}&year=$year&month=$month" target="_new">Original Order</a><br><a href="manager.cgi?deleteviewertrigger=yes&invoiceNumber=$in{'invoiceNumber'}&customerNumber=$in{'customerNumber'}&year=$year&month=$month">Delete/Remove</a></center></font>
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+ENDOFTEXT
+} elsif ($in{'system_edit_success'} eq "notexist") {
+print <<ENDOFTEXT;
+<CENTER><br>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL SIZE=2 COLOR=RED><center>This Order cannot be found. Please input the correct order information.</center></FONT>
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+ENDOFTEXT
+}
+
+print qq~
+<CENTER>
+<FORM METHOD="POST" ACTION="manager.cgi">
+<TABLE width=700>
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD COLSPAN=4 BGCOLOR="#99CC99" align=center><font face="Arial, Helvetica, sans-serif" size=+2><b>Enter Information to View an Order</b></font></TD>
+</TR>
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD colspan=4>
+<TABLE width=700>
+<TR>
+<TD colspan=2>
+<font size="2" face="Arial, Helvetica, sans-serif">
+<b>Enter the order's Invoice number,<br>customer ID, month and year</b><br>
+~;
+
+if ($versions{'Order_Management_custom'} ne "") {
+print qq~
+  <small>* If you do not know this,<br>you cannot look up the order.<br><a href="manager.cgi?display_custom_order_reports_screen=yes">Click Here</a> for the required information</small>
+~;
+}
+
+print qq~<br><br>
+Invoice Number: <INPUT NAME="invoiceNumber" TYPE="TEXT" SIZE=15 
+MAXLENGTH="20" value="$in{'invoiceNumber'}"><br><br>
+
+Customer Number: <INPUT NAME="customerNumber" TYPE="TEXT" SIZE=15 
+MAXLENGTH="20" value="$in{'customerNumber'}">
+
+</font></TD>
+<TD colspan=2 valign=top><font size="2" face="Arial, Helvetica, sans-serif">
+<b>Select Date of Order</b><br>
+<SELECT NAME="month">
+<option>$in{'month'}</option>
+$scm_monthlinks
+</SELECT> 
+<SELECT NAME="year">
+<option>$in{'year'}</option>
+$scm_yearlinks
+</SELECT><br>
+
+
+<br><br>
+<CENTER>
+<INPUT TYPE="HIDDEN" NAME="system_edit_success" VALUE="yes">
+<INPUT NAME="OpenIndividualOrder" TYPE="SUBMIT" VALUE="Find Order">
+&nbsp;&nbsp;
+<INPUT TYPE="RESET" VALUE="Reset">
+</CENTER>
+
+</font>
+</TD>
+</TR></table>
+<br><br>
+</TD>
+</TR>
+
+</TABLE></form></form>
+</CENTER>
+~;
+
+
+
+# show order info below
+if ((($in{'system_edit_success'} ne "") && ($in{'system_edit_success'} ne "notexist"))||($in{'viewertrigger'} ne ""))
+{
+print qq~
+<CENTER>
+<FORM METHOD="POST" ACTION="manager.cgi">
+<TABLE width=700>
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD COLSPAN=4 BGCOLOR="#99CC99" align=center><font face="Arial, Helvetica, sans-serif" size=+2><b>Order Details / Data</b></font></TD>
+</TR>
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD colspan=4>
+<font size="2" face="Arial, Helvetica, sans-serif">
+<INPUT TYPE="HIDDEN" NAME="invoiceNumber" VALUE="$in{'invoiceNumber'}">
+<INPUT TYPE="HIDDEN" NAME="customerNumber" VALUE="$in{'customerNumber'}">
+<INPUT TYPE="HIDDEN" NAME="month" VALUE="$in{'month'}">
+<INPUT TYPE="HIDDEN" NAME="day" VALUE="$in{'day'}">
+<INPUT TYPE="HIDDEN" NAME="year" VALUE="$in{'year'}">
+<b>Order Date:</b> $in{'month'} $in{'day'}, $in{'year'}<br>
+<b>Invoice Number:</b> $in{'invoiceNumber'}<br>
+<b>Customer ID Number:</b> $in{'customerNumber'}<br><br>
+<table width=600 border=0>
+<tr><td align=right>Order Status: </td><td><INPUT NAME="orderStatus" TYPE="TEXT" SIZE=30 value="$in{'orderStatus'}"></td></tr>
+<tr><td align=right>Shipping/Tracking ID: </td><td><INPUT NAME="shiptrackingID" TYPE="TEXT" SIZE=30 value="$in{'shiptrackingID'}"></td></tr>
+<tr><td align=right>Agree to Sales/Terms of Service: </td><td><INPUT NAME="shiptrackingID" TYPE="TEXT" SIZE=30 value="$in{'termsOfService'}"></td></tr>
+<tr><td align=right>First Name: </td><td><INPUT NAME="firstName" TYPE="TEXT" SIZE=30 value="$in{'firstName'}"></td></tr>
+<tr><td align=right>Last Name: </td><td><INPUT NAME="lastName" TYPE="TEXT" SIZE=30 value="$in{'lastName'}"></td></tr>
+<tr><td align=right>Full Name: </td><td><INPUT NAME="fullName" TYPE="TEXT" SIZE=30 value="$in{'fullName'}"></td></tr>
+<tr><td align=right>Company Name: </td><td><INPUT NAME="companyName" TYPE="TEXT" SIZE=30 value="$in{'companyName'}"></td></tr>
+<tr><td align=right>Phone Number: </td><td><INPUT NAME="customerPhone" TYPE="TEXT" SIZE=30 value="$in{'customerPhone'}"></td></tr>
+<tr><td align=right>Fax Number: </td><td><INPUT NAME="faxNumber" TYPE="TEXT" SIZE=30 value="$in{'faxNumber'}"></td></tr>
+<tr><td align=right>email Address: </td><td><INPUT NAME="emailAddress" TYPE="TEXT" SIZE=30 value="$in{'emailAddress'}"></td></tr>
+<tr><td align=right>Billing Address: </td><td><INPUT NAME="orderFromAddress" TYPE="TEXT" SIZE=30 value="$in{'orderFromAddress'}"></td></tr>
+<tr><td align=right>Address line 2: </td><td><INPUT NAME="customerAddress2" TYPE="TEXT" SIZE=30 value="$in{'customerAddress2'}"></td></tr>
+<tr><td align=right>Address line 3: </td><td><INPUT NAME="customerAddress3" TYPE="TEXT" SIZE=30 value="$in{'customerAddress3'}"></td></tr>
+<tr><td align=right>Billing City: </td><td><INPUT NAME="orderFromCity" TYPE="TEXT" SIZE=30 value="$in{'orderFromCity'}"></td></tr>
+<tr><td align=right>Billing State/Province: </td><td><INPUT NAME="orderFromState" TYPE="TEXT" SIZE=30 value="$in{'orderFromState'}"></td></tr>
+<tr><td align=right>Billing Postal Code: </td><td><INPUT NAME="orderFromPostal" TYPE="TEXT" SIZE=30 value="$in{'orderFromPostal'}"></td></tr>
+<tr><td align=right>Billing Country: </td><td><INPUT NAME="orderFromCountry" TYPE="TEXT" SIZE=30 value="$in{'orderFromCountry'}"></td></tr>
+<tr><td align=right>Ship to Name: </td><td><INPUT NAME="shipToName" TYPE="TEXT" SIZE=30 value="$in{'shipToName'}"></td></tr>
+<tr><td align=right>Ship to Address: </td><td><INPUT NAME="shipToAddress" TYPE="TEXT" SIZE=30 value="$in{'shipToAddress'}"></td></tr>
+<tr><td align=right>Ship to Address line 2: </td><td><INPUT NAME="shipToAddress2" TYPE="TEXT" SIZE=30 value="$in{'shipToAddress2'}"></td></tr>
+<tr><td align=right>Ship to Address line 3: </td><td><INPUT NAME="shipToAddress3" TYPE="TEXT" SIZE=30 value="$in{'shipToAddress3'}"></td></tr>
+<tr><td align=right>Ship to City: </td><td><INPUT NAME="shipToCity" TYPE="TEXT" SIZE=30 value="$in{'shipToCity'}"></td></tr>
+<tr><td align=right>Ship to State: </td><td><INPUT NAME="shipToState" TYPE="TEXT" SIZE=30 value="$in{'shipToState'}"></td></tr>
+<tr><td align=right>Ship to Postal Code: </td><td><INPUT NAME="shipToPostal" TYPE="TEXT" SIZE=30 value="$in{'shipToPostal'}"></td></tr>
+<tr><td align=right>Ship to Country: </td><td><INPUT NAME="shipToCountry" TYPE="TEXT" SIZE=30 value="$in{'shipToCountry'}"></td></tr>
+<tr><td align=right>Ship to Residential Address: </td><td><INPUT NAME="shiptoResidential" TYPE="TEXT" SIZE=30 value="$in{'shiptoResidential'}"></td></tr>
+<tr><td align=right>Insure Shipment? </td><td><INPUT NAME="insureShipment" TYPE="TEXT" SIZE=30 value="$in{'insureShipment'}"></td></tr>
+<tr><td align=right>Shipping Method / Shipped by: </td><td><INPUT NAME="shipMethod" TYPE="TEXT" SIZE=40 value="$in{'shipMethod'}"></td></tr>
+<tr><td align=right>Shipping Total: </td><td><INPUT NAME="shippingTotal" TYPE="TEXT" SIZE=30 value="$in{'shippingTotal'}"></td></tr>
+<tr><td align=right>Sales Tax Collected: </td><td><INPUT NAME="salesTax" TYPE="TEXT" SIZE=30 value="$in{'salesTax'}"></td></tr>
+<tr><td align=right>Special Tax 1 Collected: </td><td><INPUT NAME="tax1" TYPE="TEXT" SIZE=30 value="$in{'tax1'}"></td></tr>
+<tr><td align=right>Special Tax 2 Collected: </td><td><INPUT NAME="tax2" TYPE="TEXT" SIZE=30 value="$in{'tax2'}"></td></tr>
+<tr><td align=right>Special Tax 3 Collected: </td><td><INPUT NAME="tax3" TYPE="TEXT" SIZE=30 value="$in{'tax3'}"></td></tr>
+<tr><td align=right>Discounts Given: </td><td><INPUT NAME="discounts" TYPE="TEXT" SIZE=30 value="$in{'discounts'}"></td></tr>
+<tr><td align=right>Discount Code: </td><td><INPUT NAME="discountCode" TYPE="TEXT" SIZE=30 value="$in{'discountCode'}"></td></tr>
+<tr><td align=right>Net Profits Generated: </td><td><INPUT NAME="netProfit" TYPE="TEXT" SIZE=30 value="$in{'netProfit'}"></td></tr>
+<tr><td align=right>Order Sub Total: </td><td><INPUT NAME="subTotal" TYPE="TEXT" SIZE=30 value="$in{'subTotal'}"></td></tr>
+<tr><td align=right>Order Grand Total: </td><td><INPUT NAME="orderTotal" TYPE="TEXT" SIZE=30 value="$in{'orderTotal'}"></td></tr>
+<tr><td align=right>Affiliate Commision: </td><td><INPUT NAME="affiliateTotal" TYPE="TEXT" SIZE=30 value="$in{'affiliateTotal'}"></td></tr>
+<tr><td align=right>Affiliate ID: </td><td><INPUT NAME="affiliateID" TYPE="TEXT" SIZE=30 value="$in{'affiliateID'}"></td></tr>
+<tr><td align=right>Affiliate Misc: </td><td><INPUT NAME="affiliateMisc" TYPE="TEXT" SIZE=30 value="$in{'affiliateMisc'}"></td></tr>
+<tr><td align=right>User 1: </td><td><INPUT NAME="user1" TYPE="TEXT" SIZE=30 value="$in{'user1'}"></td></tr>
+<tr><td align=right>User 2: </td><td><INPUT NAME="user2" TYPE="TEXT" SIZE=30 value="$in{'user2'}"></td></tr>
+<tr><td align=right>User 3: </td><td><INPUT NAME="user3" TYPE="TEXT" SIZE=30 value="$in{'user3'}"></td></tr>
+<tr><td align=right>User 4: </td><td><INPUT NAME="user4" TYPE="TEXT" SIZE=30 value="$in{'user4'}"></td></tr>
+<tr><td align=right>User 5: </td><td><INPUT NAME="user5" TYPE="TEXT" SIZE=30 value="$in{'user5'}"></td></tr>
+<tr><td align=right>Admin Notes / Messages: </td><td><textarea name="adminMessages" cols="30" rows="7">$in{'adminMessages'}</textarea></td></tr>
+<tr><td align=right>Gateway Used: </td><td><INPUT NAME="GatewayUsed" TYPE="TEXT" SIZE=30 value="$in{'GatewayUsed'}"></td></tr>
+<tr><td align=right>Shipping Messages: </td><td><textarea name="shippingMessages" cols="30" rows="7">$in{'shippingMessages'}</textarea></td></tr>
+<tr><td align=right>XCOMMENTS: </td><td><textarea name="xcomments" cols="30" rows="5">$in{'xcomments'}</textarea></td></tr>
+~;
+
+ my ($quantity,$product,$pid,$category,$price,$shipping,$optionids,$productStatus,$downladables,$altorigin,$nontaxable,$cartuser5,$cartuser6,$formattedoptions,$priceafteroptions);
+        my $Key;
+        foreach $Key (sort keys(%cart_contents_rowsHash)) {
+        my @cart_fields2 = split(/\|/,$cart_contents_rowsHash{$Key});
+        $quantity = $cart_fields2[0];
+        $pid = $cart_fields2[1];
+        $category = $cart_fields2[2];
+        $price = &format_pricemgr($cart_fields2[3]);
+        $product = $cart_fields2[4];
+        $shipping = $cart_fields2[5];
+        $optionids = $cart_fields2[6];
+        $downladables = $cart_fields2[7];
+        $altorigin = $cart_fields2[8];
+        $nontaxable = $cart_fields2[9];
+        $cartuser5 = $cart_fields2[10];
+        $cartuser6 = $cart_fields2[11];
+        $formattedoptions = $cart_fields2[12];
+        $priceafteroptions = &format_pricemgr($cart_fields2[13]);
+        $productStatus = $cart_fields2[14];
+$cartContentsStringViewer .= qq~
+<INPUT TYPE="HIDDEN" NAME="downladables$Key" VALUE="$downladables">
+<INPUT TYPE="HIDDEN" NAME="altorigin$Key" VALUE="$altorigin">
+<INPUT TYPE="HIDDEN" NAME="nontaxable$Key" VALUE="$nontaxable">
+<INPUT TYPE="HIDDEN" NAME="cartuser5$Key" VALUE="$cartuser5">
+<INPUT TYPE="HIDDEN" NAME="cartuser6$Key" VALUE="$cartuser6">
+<tr bgcolor=#c0c0c0>
+<td>Product Status</td>
+<td>Product ID</td>
+<td>Quantity</td>
+<td>Product</td>
+<td>Category</td>
+<td>Base Price</td>
+<td>Shipping</td>
+<td>Price after Options</td>
+</tr>
+<tr>
+<td><INPUT NAME="productStatus$Key" TYPE="TEXT" SIZE=15 value="$productStatus"></td>
+<td><INPUT NAME="pid$Key" TYPE="TEXT" SIZE=9 value="$pid"></td>
+<td><INPUT NAME="quantity$Key" TYPE="TEXT" SIZE=5 value="$quantity"></td>
+<td><INPUT NAME="product$Key" TYPE="TEXT" SIZE=20 value="$product"></td>
+<td><INPUT NAME="category$Key" TYPE="TEXT" SIZE=10 value="$category"></td>
+<td><INPUT NAME="price$Key" TYPE="TEXT" SIZE=9 value="$price"></td>
+<td><INPUT NAME="shipping$Key" TYPE="TEXT" SIZE=10 value="$shipping"></td>
+<td><INPUT NAME="priceafteroptions$Key" TYPE="TEXT" SIZE=9 value="$priceafteroptions"></td>
+</tr>
+<tr>
+<td colspan=8><font face=arial size=2><br>
+These portions are Options information but in cart contents form.  Each option separated by a: { character.<br>Be careful when editing this information:<br>
+Option IDs: <INPUT NAME="optionids$Key" TYPE="TEXT" SIZE=60 value="$optionids"><br>
+Formatted Options:  <INPUT NAME="formattedoptions$Key" TYPE="TEXT" SIZE=60 value="$formattedoptions"><br><br></font>
+</td></tr>
+~;
+        }
+
+print qq~
+<tr><td colspan=2><INPUT TYPE="HIDDEN" NAME="cartContents" TYPE="TEXT" SIZE=30 value="$in{'cartContents'}">
+<table>
+<TR>
+<TD COLSPAN=8 BGCOLOR="#99CC99" align=center width=100%><font face="Arial, Helvetica, sans-serif" size=+2><b>Individual items in this Order</b></font></TD>
+</TR>
+<TR>
+<TD COLSPAN=8><br><font face="Arial, Helvetica, sans-serif" size=2>If you edit any pricing, quantity, or options, make sure to reflect your adjustment in any affected field as these things will not be automagically updated without your manual intervention. Each field may contain more data than shown, if unsure, move the cursor to the left in order to scroll through each character in the box.<br><br>
+<b>Items (rows) in this Order:  $cartrow_counter</b><br><br>
+</font></TD>
+</TR>
+
+$cartContentsStringViewer<table></td></tr>
+</table>
+<br><br>
+<CENTER>
+<INPUT TYPE="HIDDEN" NAME="system_edit_success" VALUE="yes">
+<INPUT TYPE="HIDDEN" NAME="cartrow_counter" VALUE="$cartrow_counter">
+<INPUT NAME="UpdateIndividualOrder" TYPE="SUBMIT" VALUE="Update Order Data">
+&nbsp;&nbsp;
+<INPUT TYPE="RESET" VALUE="Reset">
+</CENTER>
+
+</font>
+</TD>
+</TR>
+
+</TABLE>
+</CENTER><br><br>
+~;
+}
+
+
+
+print &$manager_page_footer;
+}
+#######################################################################################
+sub select2_individual_order_screen {
+my($year,$month,$inv_number,$filename,$filename2,$cust_id,$stuff);
+
+# &ReadParse;
+
+my $cartContentsStringViewer = '';
+my (@cart_contents_rows,@cart_temp_rows) = '';
+my $cartrow_counter = "0";
+%cart_contents_rowsHash;
+$month = $in{'month'};
+$year = $in{'year'};
+$inv_number = $in{'invoiceNumber'};
+$cust_id = $in{'customerNumber'};
+$filename = "$sc_order_log_directory_path/$year/$month/$inv_number"."-"."$cust_id"."$scm_orderdata_ext";
+$filename2 = "$sc_order_log_directory_path/$year/$month/$inv_number"."-"."$cust_id"."$scm_completecart_ext";
+if ((($in{'invoiceNumber'} ne '') && ($in{'customerNumber'} ne '') && ($in{'year'} ne '') && ($in{'month'} ne '')) || ($in{'viewertrigger'} ne '')) {
+    if (-e $filename) {
+        open (ORDERLOGLOOK, "$filename");
+        $stuff=<ORDERLOGLOOK>;
+        ($in{'year'},$in{'month'},$in{'day'},$in{'invoiceNumber'},$in{'customerNumber'},$in{'orderStatus'},$in{'shiptrackingID'},$in{'firstName'},$in{'lastName'},$in{'fullName'},$in{'companyName'},$in{'customerPhone'},$in{'faxNumber'},$in{'emailAddress'},$in{'orderFromAddress'},$in{'customerAddress2'},$in{'customerAddress3'},$in{'orderFromCity'},$in{'orderFromState'},$in{'orderFromPostal'},$in{'orderFromCountry'},$in{'shipToName'},$in{'shipToAddress'},$in{'shipToAddress2'},$in{'shipToAddress3'},$in{'shipToCity'},$in{'shipToState'},$in{'shipToPostal'},$in{'shipToCountry'},$in{'shiptoResidential'},$in{'insureShipment'},$in{'shipMethod'},$in{'shippingTotal'},$in{'salesTax'},$in{'tax1'},$in{'tax2'},$in{'tax3'},$in{'discounts'},$in{'netProfit'},$in{'subTotal'},$in{'orderTotal'},$in{'affiliateTotal'},$in{'affiliateID'},$in{'affiliateMisc'},$in{'user1'},$in{'user2'},$in{'user3'},$in{'user4'},$in{'user5'},$in{'adminMessages'},$in{'cartContents'},$in{'GatewayUsed'},$in{'shippingMessages'},$in{'xcomments'},$in{'termsOfService'},$in{'discountCode'}) = split(/\t/,$stuff);
+        close (ORDERLOGLOOK);
+        @cart_contents_rows = split(/::/,$in{'cartContents'},$in{'GatewayUsed'});
+        foreach $cart_contents_rows(@cart_contents_rows) {
+            $cart_contents_rowsHash{$cartrow_counter} = $cart_contents_rows;
+            $cartrow_counter++;
+        }
+    } else {
+        $in{'system_edit_success'} = "notexist";
+    }
+
+} elsif ((($in{'invoiceNumber'} eq '') && ($in{'customerNumber'} eq '') && ($in{'year'} eq '') && ($in{'month'} eq '')) || ($in{'viewertrigger'} eq '')) {
+        $in{'system_edit_success'} = "";
+} else {
+        $in{'system_edit_success'} = "notexist";
+}
+
+print &$manager_page_header("Order Management","","","","");
+
+print <<ENDOFTEXT;
+<CENTER>
+<HR>
+</CENTER>
+
+<CENTER>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL size=2>Welcome to the <b>AgoraCart</b> Individual Order Viewer for your store.<br>
+ENDOFTEXT
+
+if ($versions{'Order_Management_custom'} ne "") {
+print qq~
+  If you need to locate the necessary order information, <a href="manager.cgi?display_custom_order_reports_screen=yes">Click Here</a> for the required information
+~;
+}
+
+print <<ENDOFTEXT;
+</font></TD>
+</TR>
+</TABLE>
+</CENTER>
+<br>
+ENDOFTEXT
+
+if ((($in{'system_edit_success'} ne "") && ($in{'system_edit_success'} ne "notexist"))||($in{'viewertrigger'} ne ""))
+{
+print <<ENDOFTEXT;
+<CENTER><br>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL SIZE=2 COLOR=RED><center>This Order ( $inv_number - $cust_id from $month $year ) has been 
+successfully found and/or updated.<br>Please scroll down to view it</center></FONT><font face=arial size=2>
+<center><a href="manager.cgi?invoiceviewertrigger=invoiceviewertrigger&invoiceNumber=$in{'invoiceNumber'}&customerNumber=$in{'customerNumber'}&year=$year&month=$month" target="_new">View Invoice</a>  |  <a href="manager.cgi?packingviewertrigger=packingviewertrigger&invoiceNumber=$in{'invoiceNumber'}&customerNumber=$in{'customerNumber'}&year=$year&month=$month" target="_new">Packing Slip</a>  |  <a href="manager.cgi?originalviewertrigger=originalviewertrigger&invoiceNumber=$in{'invoiceNumber'}&customerNumber=$in{'customerNumber'}&year=$year&month=$month" target="_new">Original Order</a>  |  <a href="manager.cgi?deleteviewertrigger=yes&invoiceNumber=$in{'invoiceNumber'}&customerNumber=$in{'customerNumber'}&year=$year&month=$month">Delete/Remove</a></center></font>
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+ENDOFTEXT
+} elsif ($in{'system_edit_success'} eq "notexist") {
+print <<ENDOFTEXT;
+<CENTER><br>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL SIZE=2 COLOR=RED><center>This Order cannot be found. Please input the correct order information.</center></FONT>
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+ENDOFTEXT
+}
+
+print qq~
+<CENTER>
+<FORM METHOD="POST" ACTION="manager.cgi">
+<TABLE width=700>
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD COLSPAN=4 BGCOLOR="#99CC99" align=center><font face="Arial, Helvetica, sans-serif" size=+2><b>Enter Information to View an Order</b></font></TD>
+</TR>
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD colspan=4>
+<TABLE width=700>
+<TR>
+<TD colspan=2>
+<font size="2" face="Arial, Helvetica, sans-serif">
+<b>Enter the order's Invoice number,<br>customer ID, month and year</b><br>
+~;
+
+if ($versions{'Order_Management_custom'} ne "") {
+print qq~
+  <small>* If you do not know this,<br>you cannot look up the order.<br><a href="manager.cgi?display_custom_order_reports_screen=yes">Click Here</a> for the required information</small>
+~;
+}
+
+print qq~<br><br>
+Invoice Number: <INPUT NAME="invoiceNumber" TYPE="TEXT" SIZE=15 
+MAXLENGTH="20" value="$inv_number"><br><br>
+Customer Number: <INPUT NAME="customerNumber" TYPE="TEXT" SIZE=15 
+MAXLENGTH="20" value="$cust_id">
+
+</font></TD>
+<TD colspan=2 valign=top><font size="2" face="Arial, Helvetica, sans-serif">
+<b>Select Date of Order</b><br>
+<SELECT NAME="month">
+<option>$in{'month'}</option>
+$scm_monthlinks
+</SELECT> 
+<SELECT NAME="year">
+<option>$in{'year'}</option>
+$scm_yearlinks
+</SELECT><br>
+
+
+<br><br>
+<CENTER>
+<INPUT TYPE="HIDDEN" NAME="system_edit_success" VALUE="yes">
+<INPUT NAME="OpenIndividualOrder" TYPE="SUBMIT" VALUE="Find Order">
+&nbsp;&nbsp;
+<INPUT TYPE="RESET" VALUE="Reset">
+</CENTER>
+
+</font>
+</TD>
+</TR></table>
+
+</TD>
+</TR>
+
+</TABLE></form></form>
+</CENTER>
+~;
+
+
+
+# show order info below
+if ((($in{'system_edit_success'} ne "") && ($in{'system_edit_success'} ne "notexist"))||($in{'viewertrigger'} ne ""))
+{
+print qq~
+<CENTER>
+<FORM METHOD="POST" ACTION="manager.cgi">
+<TABLE width=700>
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD COLSPAN=4 BGCOLOR="#99CC99" align=center><font face="Arial, Helvetica, sans-serif" size=+2><b>Order Details / Data</b></font></TD>
+</TR>
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD colspan=4>
+<font size="2" face="Arial, Helvetica, sans-serif">
+<INPUT TYPE="HIDDEN" NAME="invoiceNumber" VALUE="$in{'invoiceNumber'}">
+<INPUT TYPE="HIDDEN" NAME="customerNumber" VALUE="$in{'customerNumber'}">
+<INPUT TYPE="HIDDEN" NAME="month" VALUE="$in{'month'}">
+<INPUT TYPE="HIDDEN" NAME="day" VALUE="$in{'day'}">
+<INPUT TYPE="HIDDEN" NAME="year" VALUE="$in{'year'}">
+<b>Order Date:</b> $in{'month'} $in{'day'}, $in{'year'}<br>
+<b>Invoice Number:</b> $in{'invoiceNumber'}<br>
+<b>Customer ID Number:</b> $in{'customerNumber'}<br><br>
+<table width=600 border=0>
+<tr><td align=right>Order Status: </td><td><INPUT NAME="orderStatus" TYPE="TEXT" SIZE=30 value="$in{'orderStatus'}"></td></tr>
+<tr><td align=right>Shipping/Tracking ID: </td><td><INPUT NAME="shiptrackingID" TYPE="TEXT" SIZE=30 value="$in{'shiptrackingID'}"></td></tr>
+<tr><td align=right>Agree to Sales/Terms of Service: </td><td><INPUT NAME="shiptrackingID" TYPE="TEXT" SIZE=30 value="$in{'termsOfService'}"></td></tr>
+<tr><td align=right>First Name: </td><td><INPUT NAME="firstName" TYPE="TEXT" SIZE=30 value="$in{'firstName'}"></td></tr>
+<tr><td align=right>Last Name: </td><td><INPUT NAME="lastName" TYPE="TEXT" SIZE=30 value="$in{'lastName'}"></td></tr>
+<tr><td align=right>Full Name: </td><td><INPUT NAME="fullName" TYPE="TEXT" SIZE=30 value="$in{'fullName'}"></td></tr>
+<tr><td align=right>Company Name: </td><td><INPUT NAME="companyName" TYPE="TEXT" SIZE=30 value="$in{'companyName'}"></td></tr>
+<tr><td align=right>Phone Number: </td><td><INPUT NAME="customerPhone" TYPE="TEXT" SIZE=30 value="$in{'customerPhone'}"></td></tr>
+<tr><td align=right>Fax Number: </td><td><INPUT NAME="faxNumber" TYPE="TEXT" SIZE=30 value="$in{'faxNumber'}"></td></tr>
+<tr><td align=right>email Address: </td><td><INPUT NAME="emailAddress" TYPE="TEXT" SIZE=30 value="$in{'emailAddress'}"></td></tr>
+<tr><td align=right>Billing Address: </td><td><INPUT NAME="orderFromAddress" TYPE="TEXT" SIZE=30 value="$in{'orderFromAddress'}"></td></tr>
+<tr><td align=right>Address line 2: </td><td><INPUT NAME="customerAddress2" TYPE="TEXT" SIZE=30 value="$in{'customerAddress2'}"></td></tr>
+<tr><td align=right>Address line 3: </td><td><INPUT NAME="customerAddress3" TYPE="TEXT" SIZE=30 value="$in{'customerAddress3'}"></td></tr>
+<tr><td align=right>Billing City: </td><td><INPUT NAME="orderFromCity" TYPE="TEXT" SIZE=30 value="$in{'orderFromCity'}"></td></tr>
+<tr><td align=right>Billing State/Province: </td><td><INPUT NAME="orderFromState" TYPE="TEXT" SIZE=30 value="$in{'orderFromState'}"></td></tr>
+<tr><td align=right>Billing Postal Code: </td><td><INPUT NAME="orderFromPostal" TYPE="TEXT" SIZE=30 value="$in{'orderFromPostal'}"></td></tr>
+<tr><td align=right>Billing Country: </td><td><INPUT NAME="orderFromCountry" TYPE="TEXT" SIZE=30 value="$in{'orderFromCountry'}"></td></tr>
+<tr><td align=right>Ship to Name: </td><td><INPUT NAME="shipToName" TYPE="TEXT" SIZE=30 value="$in{'shipToName'}"></td></tr>
+<tr><td align=right>Ship to Address: </td><td><INPUT NAME="shipToAddress" TYPE="TEXT" SIZE=30 value="$in{'shipToAddress'}"></td></tr>
+<tr><td align=right>Ship to Address line 2: </td><td><INPUT NAME="shipToAddress2" TYPE="TEXT" SIZE=30 value="$in{'shipToAddress2'}"></td></tr>
+<tr><td align=right>Ship to Address line 3: </td><td><INPUT NAME="shipToAddress3" TYPE="TEXT" SIZE=30 value="$in{'shipToAddress3'}"></td></tr>
+<tr><td align=right>Ship to City: </td><td><INPUT NAME="shipToCity" TYPE="TEXT" SIZE=30 value="$in{'shipToCity'}"></td></tr>
+<tr><td align=right>Ship to State: </td><td><INPUT NAME="shipToState" TYPE="TEXT" SIZE=30 value="$in{'shipToState'}"></td></tr>
+<tr><td align=right>Ship to Postal Code: </td><td><INPUT NAME="shipToPostal" TYPE="TEXT" SIZE=30 value="$in{'shipToPostal'}"></td></tr>
+<tr><td align=right>Ship to Country: </td><td><INPUT NAME="shipToCountry" TYPE="TEXT" SIZE=30 value="$in{'shipToCountry'}"></td></tr>
+<tr><td align=right>Ship to Residential Address: </td><td><INPUT NAME="shiptoResidential" TYPE="TEXT" SIZE=30 value="$in{'shiptoResidential'}"></td></tr>
+<tr><td align=right>Insure Shipment? </td><td><INPUT NAME="insureShipment" TYPE="TEXT" SIZE=30 value="$in{'insureShipment'}"></td></tr>
+<tr><td align=right>Shipping Method / Shipped by: </td><td><INPUT NAME="shipMethod" TYPE="TEXT" SIZE=40 value="$in{'shipMethod'}"></td></tr>
+<tr><td align=right>Shipping Total: </td><td><INPUT NAME="shippingTotal" TYPE="TEXT" SIZE=30 value="$in{'shippingTotal'}"></td></tr>
+<tr><td align=right>Sales Tax Collected: </td><td><INPUT NAME="salesTax" TYPE="TEXT" SIZE=30 value="$in{'salesTax'}"></td></tr>
+<tr><td align=right>Special Tax 1 Collected: </td><td><INPUT NAME="tax1" TYPE="TEXT" SIZE=30 value="$in{'tax1'}"></td></tr>
+<tr><td align=right>Special Tax 2 Collected: </td><td><INPUT NAME="tax2" TYPE="TEXT" SIZE=30 value="$in{'tax2'}"></td></tr>
+<tr><td align=right>Special Tax 3 Collected: </td><td><INPUT NAME="tax3" TYPE="TEXT" SIZE=30 value="$in{'tax3'}"></td></tr>
+<tr><td align=right>Discounts Given: </td><td><INPUT NAME="discounts" TYPE="TEXT" SIZE=30 value="$in{'discounts'}"></td></tr>
+<tr><td align=right>Discount Code: </td><td><INPUT NAME="discountCode" TYPE="TEXT" SIZE=30 value="$in{'discountCode'}"></td></tr>
+<tr><td align=right>Net Profits Generated: </td><td><INPUT NAME="netProfit" TYPE="TEXT" SIZE=30 value="$in{'netProfit'}"></td></tr>
+<tr><td align=right>Order Sub Total: </td><td><INPUT NAME="subTotal" TYPE="TEXT" SIZE=30 value="$in{'subTotal'}"></td></tr>
+<tr><td align=right>Order Grand Total: </td><td><INPUT NAME="orderTotal" TYPE="TEXT" SIZE=30 value="$in{'orderTotal'}"></td></tr>
+<tr><td align=right>Affiliate Commision: </td><td><INPUT NAME="affiliateTotal" TYPE="TEXT" SIZE=30 value="$in{'affiliateTotal'}"></td></tr>
+<tr><td align=right>Affiliate ID: </td><td><INPUT NAME="affiliateID" TYPE="TEXT" SIZE=30 value="$in{'affiliateID'}"></td></tr>
+<tr><td align=right>Affiliate Misc: </td><td><INPUT NAME="affiliateMisc" TYPE="TEXT" SIZE=30 value="$in{'affiliateMisc'}"></td></tr>
+<tr><td align=right>User 1: </td><td><INPUT NAME="user1" TYPE="TEXT" SIZE=30 value="$in{'user1'}"></td></tr>
+<tr><td align=right>User 2: </td><td><INPUT NAME="user2" TYPE="TEXT" SIZE=30 value="$in{'user2'}"></td></tr>
+<tr><td align=right>User 3: </td><td><INPUT NAME="user3" TYPE="TEXT" SIZE=30 value="$in{'user3'}"></td></tr>
+<tr><td align=right>User 4: </td><td><INPUT NAME="user4" TYPE="TEXT" SIZE=30 value="$in{'user4'}"></td></tr>
+<tr><td align=right>User 5: </td><td><INPUT NAME="user5" TYPE="TEXT" SIZE=30 value="$in{'user5'}"></td></tr>
+<tr><td align=right>Admin Notes / Messages: </td><td><textarea name="adminMessages" cols="30" rows="7">$in{'adminMessages'}</textarea></td></tr>
+<tr><td align=right>Gateway Used: </td><td><INPUT NAME="GatewayUsed" TYPE="TEXT" SIZE=30 value="$in{'GatewayUsed'}"></td></tr>
+<tr><td align=right>Shipping Messages: </td><td><textarea name="shippingMessages" cols="30" rows="7">$in{'shippingMessages'}</textarea></td></tr>
+<tr><td align=right>XCOMMENTS: </td><td><textarea name="xcomments" cols="30" rows="7">$in{'xcomments'}</textarea></td></tr>
+~;
+
+ my ($quantity,$product,$pid,$category,$price,$shipping,$optionids,$productStatus,$downladables,$altorigin,$nontaxable,$cartuser5,$cartuser6,$formattedoptions,$priceafteroptions);
+        my $Key;
+        foreach $Key (sort keys(%cart_contents_rowsHash)) {
+        my @cart_fields2 = split(/\|/,$cart_contents_rowsHash{$Key});
+        $quantity = $cart_fields2[0];
+        $pid = $cart_fields2[1];
+        $category = $cart_fields2[2];
+        $price = &format_pricemgr($cart_fields2[3]);
+        $product = $cart_fields2[4];
+        $shipping = $cart_fields2[5];
+        $optionids = $cart_fields2[6];
+        $downladables = $cart_fields2[7];
+        $altorigin = $cart_fields2[8];
+        $nontaxable = $cart_fields2[9];
+        $cartuser5 = $cart_fields2[10];
+        $cartuser6 = $cart_fields2[11];
+        $formattedoptions = $cart_fields2[12];
+        $priceafteroptions = &format_pricemgr($cart_fields2[13]);
+        $productStatus = $cart_fields2[14];
+$cartContentsStringViewer .= qq~
+<INPUT TYPE="HIDDEN" NAME="downladables$Key" VALUE="$downladables">
+<INPUT TYPE="HIDDEN" NAME="altorigin$Key" VALUE="$altorigin">
+<INPUT TYPE="HIDDEN" NAME="nontaxable$Key" VALUE="$nontaxable">
+<INPUT TYPE="HIDDEN" NAME="cartuser5$Key" VALUE="$cartuser5">
+<INPUT TYPE="HIDDEN" NAME="cartuser6$Key" VALUE="$cartuser6">
+<tr bgcolor=#c0c0c0>
+<td>Product Status</td>
+<td>Product ID</td>
+<td>Quantity</td>
+<td>Product</td>
+<td>Category</td>
+<td>Base Price</td>
+<td>Shipping</td>
+<td>Price after Options</td>
+</tr>
+<tr>
+<td><INPUT NAME="productStatus$Key" TYPE="TEXT" SIZE=15 value="$productStatus"></td>
+<td><INPUT NAME="pid$Key" TYPE="TEXT" SIZE=9 value="$pid"></td>
+<td><INPUT NAME="quantity$Key" TYPE="TEXT" SIZE=5 value="$quantity"></td>
+<td><INPUT NAME="product$Key" TYPE="TEXT" SIZE=20 value="$product"></td>
+<td><INPUT NAME="category$Key" TYPE="TEXT" SIZE=10 value="$category"></td>
+<td><INPUT NAME="price$Key" TYPE="TEXT" SIZE=9 value="$price"></td>
+<td><INPUT NAME="shipping$Key" TYPE="TEXT" SIZE=10 value="$shipping"></td>
+<td><INPUT NAME="priceafteroptions$Key" TYPE="TEXT" SIZE=9 value="$priceafteroptions"></td>
+</tr>
+<tr>
+<td colspan=8><font face=arial size=2><br>
+These portions are Options information but in cart contents form.  Each option separated by a: { character.<br>Be careful when editing this information:<br>
+Option IDs: <INPUT NAME="optionids$Key" TYPE="TEXT" SIZE=60 value="$optionids"><br>
+Formatted Options - <small>each option separated by a: {</small> :  <INPUT NAME="formattedoptions$Key" TYPE="TEXT" SIZE=60 value="$formattedoptions"><br><br></font>
+</td></tr>
+~;
+        }
+
+print qq~
+<tr><td colspan=2 align=center><INPUT TYPE="HIDDEN" NAME="cartContents" TYPE="TEXT" SIZE=30 value="$in{'cartContents'}">
+<table>
+<TR>
+<TD COLSPAN=8 BGCOLOR="#99CC99" align=center width=100%><font face="Arial, Helvetica, sans-serif" size=+2><b>Individual items in this Order</b></font></TD>
+</TR>
+<TR>
+<TD COLSPAN=8><br><font face="Arial, Helvetica, sans-serif" size=2>If you edit any pricing, quantity, or options, make sure to reflect your adjustment in any affected field as these things will not be automagically updated without your manual intervention. Each field may contain more data than shown, if unsure, move the cursor to the left in order to scroll through each character in the box.<br><br>
+<b>Items (rows) in this Order:  $cartrow_counter</b><br><br>
+</font></TD>
+</TR>
+$cartContentsStringViewer<table></td></tr>
+</table>
+<br><br>
+<CENTER>
+<INPUT TYPE="HIDDEN" NAME="system_edit_success" VALUE="yes">
+<INPUT TYPE="HIDDEN" NAME="cartrow_counter" VALUE="$cartrow_counter">
+<INPUT NAME="UpdateIndividualOrder" TYPE="SUBMIT" VALUE="Update Order Data">
+&nbsp;&nbsp;
+<INPUT TYPE="RESET" VALUE="Reset">
+</CENTER>
+
+</font>
+</TD>
+</TR>
+
+</TABLE>
+</CENTER><br><br>
+~;
+}
+
+
+
+print &$manager_page_footer;
+}
+#######################################################################################
+sub select_delete_order_screen {
+my($year,$month,$inv_number,$filename,$filename2,$cust_id,$stuff);
+
+$scm_logdirs_loaded = "";
+&set_log_years_months;
+my $cartContentsStringViewer = '';
+$month = $in{'month'};
+$year = $in{'year'};
+$inv_number = $in{'invoiceNumber'};
+$cust_id = $in{'customerNumber'};
+
+print &$manager_page_header("Order and Sales Log Deletion","","","","");
+
+print <<ENDOFTEXT;
+<CENTER>
+<HR>
+</CENTER>
+
+<CENTER>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL size=2>Welcome to the <b>AgoraCart</b> Individual Order and Order Log Deletion area for your store.<br>This section will allow you to remove the individual order logs for an order or it's entry within any of the sales logs of your choice. This is also where you would remove an order from the new orders log.
+ENDOFTEXT
+
+if ($versions{'Order_Management_custom'} ne "") {
+print qq~
+  If you need to locate the necessary order information, <a href="manager.cgi?display_custom_order_reports_screen=yes">Click Here</a> for the required information
+~;
+}
+
+print <<ENDOFTEXT;
+</font></TD>
+</TR>
+</TABLE>
+</CENTER>
+<br>
+ENDOFTEXT
+
+if ($in{system_edit_success} eq "yes") {
+print <<ENDOFTEXT;
+<CENTER><br>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL SIZE=2 COLOR=RED><center>Your Deletion Request was Successful!</center></FONT>
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+ENDOFTEXT
+}
+
+print qq~
+<CENTER>
+<TABLE width=700>
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD COLSPAN=4 BGCOLOR="#99CC99" align=center><font face="Arial, Helvetica, sans-serif" size=+2><b>Enter an Order to Delete</b></font></TD>
+</TR>
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD colspan=4>
+<FORM METHOD="POST" ACTION="manager.cgi">
+<TABLE width=700>
+<TR>
+<TD colspan=2>
+<font size="2" face="Arial, Helvetica, sans-serif">
+<b>Enter the order's Invoice number,<br>customer ID, month and year</b>.<br>
+~;
+
+if ($versions{'Order_Management_custom'} ne "") {
+print qq~
+  <small>* If you do not know this,<br>you cannot look up the order.<br><a href="manager.cgi?display_custom_order_reports_screen=yes">Click Here</a> for the required information</small>
+~;
+}
+
+print qq~
+<br><br>
+Invoice Number: <INPUT NAME="invoiceNumber" TYPE="TEXT" SIZE=15 
+MAXLENGTH="20" value="$inv_number"><br><br>
+
+Customer Number: <INPUT NAME="customerNumber" TYPE="TEXT" SIZE=15 
+MAXLENGTH="20" value="$cust_id"><br><br>
+<input type="checkbox" name="deleteIndividualNewOrderLog" value="yes">Remove this Order from the New Orders Log<br>
+<input type="checkbox" name="deleteIndividualData" value="yes">Remove this Order's Data File<br>
+<input type="checkbox" name="deleteIndividualComplete" value="yes">Remove this Order's Old Style Order File<br>
+<input type="checkbox" name="deleteIndividualMasterSalesLog" value="yes">Remove this Order from the Master Sales log<br>
+<input type="checkbox" name="deleteIndividualOverviewSalesLog" value="yes">Remove this Order from the Overview Sales Log<br>
+</font></TD>
+<TD colspan=2 valign=top><font size="2" face="Arial, Helvetica, sans-serif">
+<b>Select Date of Order</b><br>
+<SELECT NAME="month">
+<option>$in{'month'}</option>
+$scm_monthlinks
+</SELECT> 
+<SELECT NAME="year">
+<option>$in{'year'}</option>
+$scm_yearlinks
+</SELECT><br>
+
+
+<br><br>
+<CENTER>
+<font face=arial size=2 color=red>NOTE:<br>Once you delete this order and/or it's log entry,<br>that portion is gone forever!</font><br><br>
+<INPUT TYPE="HIDDEN" NAME="deletionType" VALUE="individual">
+<INPUT TYPE="HIDDEN" NAME="system_edit_success" VALUE="yes">
+<INPUT NAME="DeleteIndividualOrder" TYPE="SUBMIT" VALUE="Delete this Order">
+</CENTER>
+
+</font>
+</TD>
+</TR></table>
+</form></form>
+</TD>
+</TR>
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD COLSPAN=4 BGCOLOR="#99CC99" align=center><font face="Arial, Helvetica, sans-serif" size=+2><b>Bulk Delete Functions</b></font></TD>
+</TR>
+<TR>
+<TD colspan=4>
+<TABLE width=700 border=1 cellpadding=9>
+<TR>
+<TD colspan=2 valign=top>
+<font size="2" face="Arial, Helvetica, sans-serif">
+This will delete a single month (the entire month) within the specified year. This only deletes the directory, not any entries in the master and/or overview sales logs<br><br>
+<FORM METHOD="POST" ACTION="manager.cgi">
+<b>Select Month to Delete. Indicate year as well</b><br>
+<SELECT NAME="month">
+<option>$in{'month'}</option>
+$scm_monthlinks
+</SELECT> 
+<SELECT NAME="year">
+<option>$in{'year'}</option>
+$scm_yearlinks
+</SELECT><br>
+<br>
+<CENTER>
+<font face=arial size=2 color=red>NOTE: Once you delete this Month,<br>it is gone forever!</font><br><br>
+<INPUT TYPE="HIDDEN" NAME="deletionType" VALUE="month">
+<INPUT TYPE="HIDDEN" NAME="system_edit_success" VALUE="yes">
+<INPUT NAME="DeleteIndividualOrder" TYPE="SUBMIT" VALUE="Delete this Order">
+</CENTER>
+</form>
+</font></TD>
+<TD colspan=2 valign=top><font size="2" face="Arial, Helvetica, sans-serif">
+This will delete an Entire Year, the directory and all months and idividual order files within it<br><br>
+<FORM METHOD="POST" ACTION="manager.cgi">
+<b>Select Year to Delete</b><br>
+<SELECT NAME="year">
+$scm_yearlinks
+</SELECT><br><br>
+<CENTER>
+<font face=arial size=2 color=red>NOTE: Once you delete this Year,<br>it and all months and orders within are gone forever!</font><br><br>
+<INPUT TYPE="HIDDEN" NAME="deletionType" VALUE="year">
+<INPUT TYPE="HIDDEN" NAME="system_edit_success" VALUE="yes">
+<INPUT NAME="DeleteIndividualOrder" TYPE="SUBMIT" VALUE="Delete this Year's Order Logs">
+</CENTER>
+</form>
+</TD>
+</TR></table>
+
+</TD>
+</TR>
+</TABLE>
+
+</CENTER><br><br><br>
+~;
+
+print &$manager_page_footer;
+}
+#######################################################################################
+sub display_Order_mgr_screen
+{
+
+if ($sc_item_Total_Weight eq "") {
+$sc_item_Total_Weight = "item Total Weight";
+}
+
+if ($sc_defaultProductStatus eq "") {
+$sc_defaultProductStatus = "in Stock";
+}
+
+print &$manager_page_header("Order Management Setups","","","","");
+
+print <<ENDOFTEXT;
+<CENTER>
+<HR>
+</CENTER>
+
+<FORM ACTION="manager.cgi" METHOD="POST">
+<CENTER>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL size=2>Welcome to the <b>AgoraCart</b>  Store Manager for Order Management.  This area allows you to select which order logs you wish to use.  If you wish to to see customized report ranges based on date ranges of orders as well as total sales and other totals for the date range, please purchase the lifetime membership found at the AgoraCart.com.  By doing som, you in turn support this Open Source Software (OSS) and help keep it going.<br><br></TD>
+</TR>
+</TABLE>
+</CENTER>
+
+ENDOFTEXT
+
+if($in{'system_edit_success'} ne "")
+{
+print <<ENDOFTEXT;
+<CENTER><br>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL SIZE=2 COLOR=RED>Your Order Management settings have been 
+successfully updated. </FONT>
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+ENDOFTEXT
+}
+
+print qq~
+<br>
+<FORM ACTION="manager.cgi" METHOD="POST">
+   <div align="center">
+   <table border="0" cellspacing="0">
+<TR>
+<TD bgcolor=#99CC99 COLSPAN=2><center><font face="Arial, Helvetica, sans-serif" size=+2><b>Order Logging & Sales Reporting Setups</b></font></center></TD>
+</TR>
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD><font face="Arial, Helvetica, sans-serif" size=2>
+<b>Do you wish to have the orders written to a New order log file?</b><br>This is an order log that stores NEW orders with most order details in a single file/log. Default is YES</font></td>
+<td><font face="Arial, Helvetica, sans-serif" size=2><SELECT NAME="log_orders_yes_no">
+<OPTION>$sc_send_order_to_log</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT></td></tr>
+<TR>
+<TD><br></TD>
+</TR>
+<tr><td><font face="Arial, Helvetica, sans-serif" size=2><b>Choose a unique name for your log file.</b><br> (ex: "mylog3218.log")</TD>
+<TD><font face="Arial, Helvetica, sans-serif" size=2>
+<INPUT NAME="name_of_the_log_file" TYPE="TEXT" VALUE="$sc_order_log_name">
+</font></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD><font face="Arial, Helvetica, sans-serif" size=2>
+<b>Do you wish to have the orders written to a individual order log files?</b><br>This is an order log that stores a single order.  You can use it with/or without the Master order log file.  Default is YES</font></td>
+<td colspan=2><font face="Arial, Helvetica, sans-serif" size=2><SELECT NAME="sc_write_individual_order_logs">
+<OPTION>$sc_write_individual_order_logs</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT></font></td></tr>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD><font face="Arial, Helvetica, sans-serif" size=2>
+<b>Do you wish to have the orders written to a monthly overview order log file?</b><br>This is an order log that stores key data on each order within for an entire month at a time.  We recommend this be set to YES if you ever want to use the custom reports manager (a members only add-on file) or other tools used for quick order lookups & reports. Default is YES</font></td>
+<td colspan=2><font face="Arial, Helvetica, sans-serif" size=2><SELECT NAME="sc_write_monthly_short_order_logs">
+<OPTION>$sc_write_monthly_short_order_logs</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT></font></td></tr>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD><font face="Arial, Helvetica, sans-serif" size=2>
+<b>Do you wish to have the orders written to a monthly master order log file?</b><br>This is an order log that stores every piece of standard data on each order within for an entire month at a time.  We recommend this be set to YES if you ever want to use the data export manager (for order management, and a members only add-on file)  for such things as exporting data for accounting purposes or other.  Individual log files contain the same information, but are not as handy if you wish to export a large number of orders to accounting and/or spreadsheet formats. NOTE: these files can be very substantial in size if you get a large number of orders, so use with care.  Default is NO</font></td>
+<td colspan=2><font face="Arial, Helvetica, sans-serif" size=2><SELECT NAME="sc_write_monthly_master_order_logs">
+<OPTION>$sc_write_monthly_master_order_logs</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT></font></td></tr>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+<TR>
+<TD><font face="Arial, Helvetica, sans-serif" size=2>
+<b>Do you wish to keep track of products solds?</b><br>This is an order log that records the number of each item in your product database. Tracking is done an an annual basis.  A nice little tool to see the year to date sales of each item you offer.  Default is YES</font></td>
+<td colspan=2><font face="Arial, Helvetica, sans-serif" size=2><SELECT NAME="sc_write_product_sales_logs">
+<OPTION>$sc_write_product_sales_logs</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT></font></td></tr>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD><font face="Arial, Helvetica, sans-serif" size=2>
+<b>Title for item shipping weight /cost?</b><br>This is a title for order management displays, invoices, and packing slips for the value found in each of your product's shipping weight/cost field within your product database.  Select a title appropriate to your useage of this field.  Example, if the field is used to indicate an item's weight, this is then totalled up for the total weight of each individual product sold (which is used store wide and cannot be used both ways, must be a weight, a cost or blank).  So, this will be the title for the output for the order management functions in regards to this product data field.</font></td>
+<td colspan=2><font face="Arial, Helvetica, sans-serif" size=2><INPUT NAME="sc_item_Total_Weight" TYPE="TEXT" SIZE=20 
+MAXLENGTH="25" VALUE="$sc_item_Total_Weight"></font></td></tr>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD><font face="Arial, Helvetica, sans-serif" size=2>
+<b>Enter Default Order Status</b><br>This is the default wording used for each order (in Progress, Completed, Shipping, On Hold, etc).</font></td>
+<td colspan=2><font face="Arial, Helvetica, sans-serif" size=2><INPUT NAME="sc_order_status_default" TYPE="TEXT" SIZE=20 
+MAXLENGTH="25" VALUE="$sc_order_status_default"></font></td></tr>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD><font face="Arial, Helvetica, sans-serif" size=2>
+<b>Enter Default Product Status</b><br>This is the default wording used for each product as it's written to the logs, unless it's downloadable (download module is a members only add-on file).</font></td>
+<td colspan=2><font face="Arial, Helvetica, sans-serif" size=2><INPUT NAME="sc_defaultProductStatus" TYPE="TEXT" SIZE=20 
+MAXLENGTH="25" VALUE="$sc_defaultProductStatus"></font></td></tr>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+   </table>
+
+   </div>
+   <p align="center">&nbsp;</p>
+   <p align="center"><font face="Arial"><INPUT TYPE="HIDDEN" NAME="system_edit_success" value="yes">
+<INPUT NAME="OrderManagementSettings" TYPE="SUBMIT" value="Submit">
+&nbsp;&nbsp;
+<INPUT TYPE="RESET" value="Reset"></font></p>
+   </form>
+~;
+
+print &$manager_page_footer;
+}
+#######################################################################################
+sub select_monthly_orders_screen
+{
+
+print &$manager_page_header("Select Orders to View by Month","","","","");
+
+print <<ENDOFTEXT;
+<CENTER>
+<HR>
+</CENTER>
+
+
+<CENTER>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL size=2>Welcome to the <b>AgoraCart</b> Monthly Order Viewer for your store.<br>Note: You must have <i>Yearly</i> and or <i>Monthly</i> order logging enabled for this to work properly.</font></TD>
+</TR>
+</TABLE>
+</CENTER>
+<br>
+ENDOFTEXT
+
+
+print qq~
+<CENTER>
+<FORM METHOD="POST" ACTION="manager.cgi">
+<TABLE>
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD COLSPAN=4 BGCOLOR="#99CC99" align=center><font face="Arial, Helvetica, sans-serif" size=+2><b>Create Your Custom Online Report</b></font></TD>
+</TR>
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD colspan=4>
+<TABLE>
+<TR>
+<TD colspan=2>
+<font size="2" face="Arial, Helvetica, sans-serif">
+<b>Select items to track in your<br>Report / View Orders</b><br><small>* not all items available by default.<br>Some require other add-ons and<br>customizations in order to initially save<br>the data, such as affiliate sales<br>and net profit totals</small><br><br>
+
+
+</font></TD>
+<TD colspan=2 valign=top><font size="2" face="Arial, Helvetica, sans-serif">
+<b>Select Month to View</b><br>
+<SELECT NAME="ordersmonthmonth">
+$scm_monthlinks
+</SELECT> 
+<SELECT NAME="ordersmonthyear">
+$scm_yearlinks
+</SELECT><br>
+<br><br><br><br><br>
+<CENTER>
+<INPUT TYPE="HIDDEN" NAME="system_edit_success" VALUE="yes">
+<INPUT NAME="CompileMonthlyOrdersReport" TYPE="SUBMIT" VALUE="View Orders for the above Month">
+&nbsp;&nbsp;
+<INPUT TYPE="RESET" VALUE="Reset">
+</CENTER>
+
+</font>
+</TD>
+</TR></table>
+
+</TD>
+</TR>
+
+</TABLE>
+</CENTER><br><br>
+~;
+
+print &$manager_page_footer;
+}
+#######################################################################################
+sub compile_Monthly_Order_information
+{
+
+my (%orderLoggingHash);
+
+&ReadParse;
+
+my $tempmonththingy = $in{'ordersmonthmonth'};
+my $tempyearthingy = $in{'ordersmonthyear'};
+
+my $filename4 = "$sc_order_log_directory_path/$tempyearthingy/$tempmonththingy/$tempmonththingy$tempyearthingy$scm_monthyearindexlog_name";
+
+print &$manager_page_header("Display Order Log for a Month","","","");
+
+print qq~<center><br><br>
+<table width=740 border=0 cellpadding=2 cellspacing=0><tr>
+<td valign=middle align=center><font face=arial size=+1><b>Orders for Overview</b></font></td>
+</tr></table>
+<table width=740 border=1 cellpadding=2 cellspacing=0><tr>
+<td valign=middle align=center bgcolor=#99CC99><font face=arial size=2><b>Order Status</b></font></td>
+<td valign=middle align=center bgcolor=#99CC99 width=85><font face=arial size=2><b>Order Date</b></font></td>
+<td valign=middle align=center bgcolor=#99CC99><font face=arial size=2><b>Invoice #</b></font></td>
+<td valign=middle align=center bgcolor=#99CC99><font face=arial size=2><b>Customer Name</b></font></td>
+<td valign=middle align=center bgcolor=#99CC99><font face=arial size=2><b>Order Total</b></font></td>
+<td bgcolor=#99CC99><font face=arial size=2>&nbsp;</font></td>
+</tr>
+~;
+
+&get_file_lock("$logfile.lockfile");
+open(LOGFILE, "$filename4") || print "<br>THE $tempmonththingy $tempyearthingy ORDER LOG DOES NOT EXIST\n<tr><td width=620 colspan=8 align=center><font face=arial size=2>Sorry, No Orders</font></td></tr>\n";
+while (<LOGFILE>) {
+# print "$_<br>";
+($year,$month,$day,$orderLoggingHash{'invoiceNumber'},$orderLoggingHash{'customerNumber'},$orderLoggingHash{'orderStatus'},$orderLoggingHash{'firstName'},$orderLoggingHash{'lastName'},$orderLoggingHash{'fullName'},$orderLoggingHash{'companyName'},$orderLoggingHash{'emailAddress'},$orderLoggingHash{'orderFromState'},$orderLoggingHash{'orderFromPostal'},$orderLoggingHash{'orderFromCountry'},$orderLoggingHash{'shipMethod'},$orderLoggingHash{'shippingTotal'},$orderLoggingHash{'salesTax'},$orderLoggingHash{'tax1'},$orderLoggingHash{'tax2'},$orderLoggingHash{'tax3'},$orderLoggingHash{'discounts'},$orderLoggingHash{'netProfit'},$orderLoggingHash{'subTotal'},$orderLoggingHash{'orderTotal'},$orderLoggingHash{'affiliateTotal'},$orderLoggingHash{'affiliateID'},$orderLoggingHash{'affiliateMisc'}) = split(/\t/,$_);
+
+$orderLoggingHash{'orderTotal'} = &format_pricemgr($orderLoggingHash{'orderTotal'});
+
+ if (($orderLoggingHash{'invoiceNumber'} eq "") && ($_ eq "")) {
+   print "<tr><td width=620 colspan=8 align=center><font face=arial size=2>Sorry, No Orders</font></td></tr>\n";
+   $sorry_thingy= "stop";
+  }
+
+
+if ($sorry_thingy ne "stop") {
+print qq~<tr>
+<td valign=middle align=center><font face=arial size=2>$orderLoggingHash{'orderStatus'}</font></td>
+<td valign=middle align=center><font face=arial size=2>$month, $day, $year</font></td>
+<td valign=middle align=center><font face=arial size=2>$orderLoggingHash{'invoiceNumber'}</font></td>
+~;
+
+if ($orderLoggingHash{'lastName'} ne "") {
+print qq~
+<td valign=middle align=center><font face=arial size=2>$orderLoggingHash{'firstName'} $orderLoggingHash{'lastName'}</font></td>
+~;
+} else {
+print qq~
+<td valign=middle align=center><font face=arial size=2>$orderLoggingHash{'fullName'}</font></td>
+~;
+}
+
+$order_filename = "$scm_order_logpath/$orderLoggingHash{'invoiceNumber'}" . "-" . "$orderLoggingHash{'customerNumber'}";
+print qq~
+<td valign=middle align=center><font face=arial size=2>$sc_money_symbol $orderLoggingHash{'orderTotal'}</font></td>
+<td valign=middle align=center><font face=arial size=2><a href="manager.cgi?invoiceviewertrigger=invoiceviewertrigger&invoiceNumber=$orderLoggingHash{'invoiceNumber'}&customerNumber=$orderLoggingHash{'customerNumber'}&year=$year&month=$month" target="_new">View Invoice</a><br><a href="manager.cgi?viewertrigger=viewertrigger&invoiceNumber=$orderLoggingHash{'invoiceNumber'}&customerNumber=$orderLoggingHash{'customerNumber'}&year=$year&month=$month">View/Update</a><br><a href="manager.cgi?packingviewertrigger=packingviewertrigger&invoiceNumber=$orderLoggingHash{'invoiceNumber'}&customerNumber=$orderLoggingHash{'customerNumber'}&year=$year&month=$month" target="_new">Packing Slip</a><br><a href="manager.cgi?originalviewertrigger=originalviewertrigger&invoiceNumber=$orderLoggingHash{'invoiceNumber'}&customerNumber=$orderLoggingHash{'customerNumber'}&year=$year&month=$month" target="_new">Original Order</a><br><a href="manager.cgi?deleteviewertrigger=yes&invoiceNumber=$orderLoggingHash{'invoiceNumber'}&customerNumber=$orderLoggingHash{'customerNumber'}&year=$year&month=$month">Delete/Remove</a><br></font></td>
+</tr>
+~;
+}
+
+ }# End of while LOGFILE
+
+close(LOGFILE);
+&release_file_lock("$logfile.lockfile");
+
+print qq~<tr>
+<td valign=middle align=center bgcolor=#99CC99><font face=arial size=2><b>Order Status</b></font></td>
+<td valign=middle align=center bgcolor=#99CC99 width=85><font face=arial size=2><b>Order Date</b></font></td>
+<td valign=middle align=center bgcolor=#99CC99><font face=arial size=2><b>Invoice #</b></font></td>
+<td valign=middle align=center bgcolor=#99CC99><font face=arial size=2><b>Customer Name</b></font></td>
+<td valign=middle align=center bgcolor=#99CC99><font face=arial size=2><b>Order Total</b></font></td>
+<td bgcolor=#99CC99><font face=arial size=2>&nbsp;</font></td>
+</tr>
+</table><br></center><br>
+~;
+print &$manager_page_footer;
+
+}
+#######################################################################################
+1; # Library
diff -ruN 4.0K-4b/protected/cart_display-ext_lib.pl 5.0.000/protected/cart_display-ext_lib.pl
--- 4.0K-4b/protected/cart_display-ext_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/protected/cart_display-ext_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,17 +1,17 @@
 # file ./store/protected/cart_display-ext_lib.pl
 
-$versions{'cart_display'} = "20021020";
+$versions{'cart_display-ext_lib.pl'} = "5.0.000";
 
 {
  local ($modname) = 'cart_display';
  &register_extension($modname,"Cart Display Settings",$versions{$modname});
- &add_settings_choice("Cart Display"," Cart Display ",
-	"change_cart_screen");
+ &add_settings_choice("Cart Display","Cart Contents - Displays/Emails",
+  "change_cart_screen");
  &register_menu('ConfigCART',"write_cart_display_settings",
-	$modname,"Write Cart Display Settings");
+  $modname,"Write Cart Display Settings");
  &register_menu('change_cart_screen',"display_cart_settings_screen",
-	$modname,"Display Cart Display Settings");
- &add_item_to_manager_menu("Cart Display","change_cart_screen=yes","");
+  $modname,"Display Cart Display Settings");
+# &add_item_to_manager_menu("Cart Display","change_cart_screen=yes","");
 }
 #######################################################################################
 sub write_cart_display_settings
@@ -194,7 +194,7 @@
 $myset = "sub init_cart_settings {\n" . $myset . "}\n";
 $myset .= 'if ($main_program_running =~ /yes/i) {' . "\n";
 $myset .= '&add_codehook("after_loading_setup_db","init_cart_settings");' 
-		. "\n";
+    . "\n";
 $myset .= '} else { ' . "\n";
 $myset .= '&init_cart_settings;' . "\n";
 $myset .= '}' . "\n";
@@ -211,14 +211,14 @@
 
 print <<ENDOFTEXT;
 <CENTER>
-<HR WIDTH=580>
+<HR>
 </CENTER>
 
 <CENTER>
 <FORM ACTION="manager.cgi" METHOD="POST">
-<TABLE WIDTH=580>
+<TABLE>
 <TR>
-<TD WIDTH=580>
+<TD>
 <FONT FACE=ARIAL>Welcome to the CART DISPLAY section of the
 <b>AgoraCart</b> System Manager. 
 This determines how AgoraCart displays a customer's cart,
@@ -280,7 +280,7 @@
 
 <FONT FACE=ARIAL SIZE=2>
 <CENTER>
-<TABLE BORDER=0 CELLPADDING=2 CELLSPACING=0 WIDTH=580>
+<TABLE BORDER=0 CELLPADDING=2 CELLSPACING=0>
 
 <TR>
 <TD COLSPAN=2><HR></TD>
diff -ruN 4.0K-4b/protected/database-ext_lib.pl 5.0.000/protected/database-ext_lib.pl
--- 4.0K-4b/protected/database-ext_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/protected/database-ext_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -9,34 +9,45 @@
 #
 # Updated to import/export databases other than PRODUCT 10/20/01
 #
+# Set manager.cgi routine names to handle these particular tasks.
+# If you are replacing this file with another database engine
+# interface, you can write your own routines, place them here, and
+# set these names such as "mySQL_db_action_update_tags" etc. so that
+# the manager will run them instead of the flatfile routines. 
+
+# These routines seem to be generalized enough that minimal changes
+# are required when the destination database is not a flatefile.
+# The import from CSV/PIPE files does a set at a time, thus limits
+# on process time for web tasks can be overcome -- it autmatically
+# reloads itself for the next group of records.  -- July 19, 2001
 
-$versions{'database'} = "20021020";
+$versions{'database-ext_lib.pl'} = "5.0.000";
 
 {
  local ($modname) = 'database';
  &register_extension($modname,"Database",$versions{$modname});
  &register_menu('UpdateTags',"STD_action_update_tags",
-	$modname,"Update Image Tags");
+  $modname,"Update Image Tags");
  &register_menu('ConvertProduct',"STD_flatfile_action_convert_product",
-	$modname,"Convert Web Store 1.02 type database");
+  $modname,"Convert Web Store 1.02 type database");
  &register_menu('data_to_CSV',"STD_action_data_to_CSV",
-	$modname,"Create CSV file of a database");
+  $modname,"Create CSV file of a database");
  &register_menu('data_to_TAB',"STD_action_data_to_CSV",
-	$modname,"Create TAB file of a database");
+  $modname,"Create TAB file of a database");
  &register_menu('data_to_PIPE',"STD_action_data_to_PIPE",
-	$modname,"Create PIPE file of a database");
+  $modname,"Create PIPE file of a database");
  &register_menu('data_from_CSV',"STD_action_data_from_CSV",
-	$modname,"Import CSV database");
+  $modname,"Import CSV database");
  &register_menu('data_from_PIPE',"STD_action_data_from_PIPE",
-	$modname,"Import PIPE database");
+  $modname,"Import PIPE database");
  &register_menu('data_from_TAB',"STD_action_data_from_TAB",
-	$modname,"Import TAB delimited datase");
+  $modname,"Import TAB delimited datase");
  &register_menu('database_screen',"STD_agora_database_screen",
-	$modname,"Database Screen");
+  $modname,"Database Screen");
  &register_menu('action_data_from_file',"STD_action_data_from_file",
-	$modname,"BASE -- required to import a file");
+  $modname,"BASE -- required to import a file");
  &register_menu('action_data_to_file',"STD_action_data_to_file",
-	$modname,"BASE -- required to export a file");
+  $modname,"BASE -- required to export a file");
 
  $datafile = "./data_files/data.file"; 
  $datafile_conv = $datafile;
@@ -45,15 +56,18 @@
  @my_items = split(/\|/, $lines[0]);
  close(OLDFILE);
  if ($#my_items ne 6 ) {
-   &add_item_to_manager_menu("Database","database_screen=yes","");
+#   &add_item_to_manager_menu("Database","database_screen=yes","");
+ &add_settings_choice("database","Database Import/Export",
+  "database_screen");
   } else {
    &add_item_to_manager_menu("Convert 1.02 DB","ConvertProduct=yes","");
   }
 
 }
-$mc_db_convert_per_pass = 500; 
-$mc_db_convert_seconds  = 10;  
+$mc_db_convert_per_pass = 500; # max records to convert per pass
+$mc_db_convert_seconds  = 10; # max time to plug away per pass
 
+# mainly for delayed initializations when file locking routines are required
 &codehook("manager_database_lib_init");
 
 #########################################################################
@@ -80,7 +94,7 @@
    open(NEWFILE,">$datafile_conv") || &my_die("Can't Open $datafile");
 
    foreach $line (@lines)
-	{
+  {
    @st = split(/\|/,$line);
 
 $image = $st[4];
@@ -102,7 +116,7 @@
     print NEWFILE $myline;
 #    print  $myline;
 
-	}
+  }
 
   close (NEWFILE);
   $conv_result .=  "Done!<br>IMG tags and PAD LENGTH were also updated.\n";
@@ -230,7 +244,7 @@
 
 close (NEWFILE);
 $conv_result .="The $db_name database converted to $conv_type format " . 
-	"in file: $datafile_conv\n";
+  "in file: $datafile_conv\n";
 
 close (OLDFILE);
 &init_convert_menu_item;
@@ -293,13 +307,13 @@
     $orig_line = $line;
     $inx++;
     if (($inx >= $first) && ($inx <= $last)
-	&& ((time()-$start_tm) < $mc_db_convert_seconds)) {
+  && ((time()-$start_tm) < $mc_db_convert_seconds)) {
       $last_pos = tell(OFILE);
       chop($line);
       $last_converted = $inx;
       &codehook("mgr_custom_conversion_logic_1");
       if ($conv_type eq "TAB") {
-	$line =~ s/\t/\|/g;
+  $line =~ s/\t/\|/g;
        }
       if ($conv_type eq "CSV") {
         $line = &conv_from_CSV($line);
@@ -323,10 +337,9 @@
          }
         &codehook("mgr_custom_conversion_logic_4");
        $st[$#db] .= ''; 
-       $myline = join('|',@st);
         &codehook("mgr_custom_conversion_logic_5");
        }
-      &put_db_raw_line($db_name,$st[0],$myline,"no");
+&put_db_raw_line($db_name,$st[0],$myline,"no");
      } else { 
       if ($in{'db_pos'} > 0) { 
         seek(OFILE,0,2);
@@ -348,6 +361,7 @@
   $zitem = $menu_items{"database_screen"};
   &$zitem;
  } else {
+  # print out a reload page ...
   $myaction = "CSV_filename=$in{'CSV_filename'}";
   $myaction .= "&CSV_update_image_tag=$in{'CSV_update_image_tag'}";
   $myaction .= "&CSV_update_padding=$in{'CSV_update_padding'}";
@@ -430,24 +444,24 @@
  }
 
 $my_db_name_list = 
-	"Name of database to import/export:\n" .
-	"<SELECT NAME='db_name'>\n" .
-	$my_db_name_list .
-	"</SELECT>\n";
+  "Name of database to import/export:\n" .
+  "<SELECT NAME='db_name'>\n" .
+  $my_db_name_list .
+  "</SELECT>\n";
 
 $my_db_name_list = "<TR>\n<TD COLSPAN='2'>\n" .
-	"$my_db_name_list" .
-	"</TD>\n</TR>\n";
+  "$my_db_name_list" .
+  "</TD>\n</TR>\n";
 
 print <<ENDOFTEXT;
 <CENTER>
-<HR WIDTH=580>
+<HR>
 </CENTER>
 
 <CENTER>
-<TABLE WIDTH=580>
+<TABLE>
 <TR>
-<TD WIDTH=580>
+<TD>
 <FONT FACE=ARIAL>Welcome to the DATABASE section of the
 <b>AgoraCart</b>
 System Manager. <br>
@@ -507,7 +521,7 @@
 <FONT FACE=ARIAL SIZE=2>
 <FORM METHOD="POST" ACTION="manager.cgi">
 <CENTER>
-<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
+<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0>
 
 <TR>
 <TD COLSPAN=2><HR></TD>
@@ -644,7 +658,38 @@
  
 }
 ############################################################
+#
+# sub conv_from_CSV
+#  Usage: $line = &conv_from_CSV($CSV_data_line);
+#
+# Modified to do strings instead of arrays by SPK
+#
+# Based on subroutine: SplitData found at www.extropia.com
+# Original info on the routine is here:
+#
+#   Usage:
+#     @output = &SplitData($data_line);
+#
+#   Input:
+#     $data_line = the CSV file line to be separated.
+#
+#   Function:
+#     This subroutine is used to split a (.CSV) comma separated
+#     values database line ($data_line). This subroutine was
+#     written to be used with a .CSV file exported from MS Excel
+#     or another Spreadsheet Program.
+#
+#   Output:
+#     Returns line data fields in a list array format (@output).
+#
+#
+#   Written By: Jeff Walters at hiker_jjw@yahoo.com
+#   Last Edit: 7/16/99
+#   Please report any problems to hiker_jjw@yahoo.com
+#
+############################################################
 sub conv_from_CSV
+#sub SplitData
 {
     local($data_line) = @_;
     local($output_line) = "";
@@ -653,100 +698,151 @@
 
     $combine_trigger = "off";
 
+#   Remove the new line or carriage return characters.
 
     $data_line =~ s/\n+$//;
     $data_line =~ s/\r+$//;
 
+#  First, we split the data by commas into the @split_data array.
 
     @split_data = split (/\,/, $data_line);
 
+#  For each data element we will check to see if the elements need to be combined.
 
     foreach $data (@split_data)
-	{
+  {
+
+  if ($data =~ /\"/ || $combine_trigger eq "on")
+    {
 
-	if ($data =~ /\"/ || $combine_trigger eq "on")
-		{
+    $temp_data = $data;
+    $temp_data =~ s/\"{2}//g;
+    # Check to see if the data begins with an even or odd number of quotes
+    if ( $temp_data =~ /^\"/ ) { $beginning_quotes = "odd" } else { $beginning_quotes = "even" }
+    # Check to see if the data ends with an even or odd number of quotes
+    if ( $temp_data =~ /\"$/ ) { $ending_quotes = "odd" } else { $ending_quotes = "even" }
+
+    $temp_data = $data;
+    $temp_data =~ s/\"//g;
+    if ($temp_data eq "") { $all_quotes = "true" } else { $all_quotes = "false" }
+
+    $data_length = length($data);
+    # print "Combine  \n";
+    # print "$beginning_quotes  $ending_quotes  $all_quotes<BR>\n";
+
+    # $data contains a comma, but we do not need to combine.
+    if ( $beginning_quotes eq "odd" && $ending_quotes eq "odd" && $all_quotes eq "false" )
+      {
+      $combine_trigger = "off";
+      $data = substr($data,1,$length-1);
+      $data =~ s/\"{2}/\"/g;
+      $output_line .= "$data|";
+      }
+    # $data is the beginning of a split field
+    elsif ( $beginning_quotes eq "odd" && $ending_quotes eq "even" && $all_quotes eq "false" )
+      {
+      $combine_trigger = "on";
+      $data = substr($data,1);
+      $data =~ s/\"{2}/\"/g;
+      $combine_data = $data;
+      }
+    # $data is a middle section of the split field
+    elsif ( $beginning_quotes eq "even" && $ending_quotes eq "even" && $all_quotes eq "false" )
+      {
+      $combine_trigger = "on";
+      $data =~ s/\"{2}/\"/g;
+      $combine_data .= ",$data";
+      }
+    # $data is the ending of the split field
+    elsif ( $beginning_quotes eq "even" && $ending_quotes eq "odd" && $all_quotes eq "false" )
+      {
+      $combine_trigger = "off";
+      $data = substr($data,0,$length-1);
+      $data =~ s/\"{2}/\"/g;
+      $combine_data .= ",$data";
+      $output_line .= "$combine_data|";
+      $combine_data = "";
+      }
+    elsif ( $beginning_quotes eq "odd" && $ending_quotes eq "odd" && $all_quotes eq "true" )
+      {
+      $data =~ s/\"//;  
+      $data =~ s/\"{2}/\"/g;
+      if ( $combine_trigger eq "off" )
+        {
+        $combine_trigger = "on";
+        $combine_data = "$data";
+        }
+      else
+        {
+        $combine_trigger = "off";
+        $combine_data .= ",$data";
+        $output_line .= "$combine_data|";
+        }
+      }
+    elsif ( $beginning_quotes eq "even" && $ending_quotes eq "even" && $all_quotes eq "true" )
+      {
+      $data =~ s/\"{2}/\"/g;
+      $combine_data .= ",$data";
+      }
+    else
+      {
+      $combine_trigger = "off";
+      $combine_data .= "ERROR";
+      }
 
-		$temp_data = $data;
-		$temp_data =~ s/\"{2}//g;
-		if ( $temp_data =~ /^\"/ ) { $beginning_quotes = "odd" } else { $beginning_quotes = "even" }
-		if ( $temp_data =~ /\"$/ ) { $ending_quotes = "odd" } else { $ending_quotes = "even" }
-
-		$temp_data = $data;
-		$temp_data =~ s/\"//g;
-		if ($temp_data eq "") { $all_quotes = "true" } else { $all_quotes = "false" }
-
-		$data_length = length($data);
-		if ( $beginning_quotes eq "odd" && $ending_quotes eq "odd" && $all_quotes eq "false" )
-			{
-			$combine_trigger = "off";
-			$data = substr($data,1,$length-1);
-			$data =~ s/\"{2}/\"/g;
-			$output_line .= "$data|";
-			}
-		elsif ( $beginning_quotes eq "odd" && $ending_quotes eq "even" && $all_quotes eq "false" )
-			{
-			$combine_trigger = "on";
-			$data = substr($data,1);
-			$data =~ s/\"{2}/\"/g;
-			$combine_data = $data;
-			}
-		elsif ( $beginning_quotes eq "even" && $ending_quotes eq "even" && $all_quotes eq "false" )
-			{
-			$combine_trigger = "on";
-			$data =~ s/\"{2}/\"/g;
-			$combine_data .= ",$data";
-			}
-		elsif ( $beginning_quotes eq "even" && $ending_quotes eq "odd" && $all_quotes eq "false" )
-			{
-			$combine_trigger = "off";
-			$data = substr($data,0,$length-1);
-			$data =~ s/\"{2}/\"/g;
-			$combine_data .= ",$data";
-			$output_line .= "$combine_data|";
-			$combine_data = "";
-			}
-		elsif ( $beginning_quotes eq "odd" && $ending_quotes eq "odd" && $all_quotes eq "true" )
-			{
-			$data =~ s/\"//;  
-			$data =~ s/\"{2}/\"/g;
-			if ( $combine_trigger eq "off" )
-				{
-				$combine_trigger = "on";
-				$combine_data = "$data";
-				}
-			else
-				{
-				$combine_trigger = "off";
-				$combine_data .= ",$data";
-				$output_line .= "$combine_data|";
-				}
-			}
-		elsif ( $beginning_quotes eq "even" && $ending_quotes eq "even" && $all_quotes eq "true" )
-			{
-			$data =~ s/\"{2}/\"/g;
-			$combine_data .= ",$data";
-			}
-		else
-			{
-			$combine_trigger = "off";
-			$combine_data .= "ERROR";
-			}
-
-		}
-	else
-		{
-		# print "Regular Push<BR>\n";
-		$output_line .= "$data|";
-		}
+    }
+  else
+    {
+    # print "Regular Push<BR>\n";
+    $output_line .= "$data|";
+    }
 
-	}
+  }
 
 chop($output_line);
 return $output_line;
 
 } 
 #######################################################################
+#                            get_file_lock                            #
+#######################################################################
+
+    # get_file_lock is a subroutine used to create a lockfile.
+    # Lockfiles are used to make sure that no more than one
+    # instance of the script can modify a file at one time.  A
+    # lock file is vital to the integrity of your data.
+    # Imagine what would happen if two or three people
+    # were using the same script to modify a shared file (like
+    # the error log) and each accessed the file at the same
+    # time.  At best, the data entered by some of the users
+    # would be lost.  Worse, the conflicting demands could
+    # possibly result in the corruption of the file.
+    #
+    # Thus, it is crucial to provide a way to monitor and
+    # control access to the file.  This is the goal of the
+    # lock file routines.  When an instance of this script
+    # tries to  access a shared file, it must first check for
+    # the existence of a lock file by using the file lock
+    # checks in get_file_lock.
+    #
+    # If get_file_lock determines that there is an existing
+    # lock file, it instructs the instance that called it to
+    # wait until the lock file disappears.  The script then
+    # waits and checks back after some time interval.  If the
+    # lock file still remains, it continues to wait until some 
+    # point at which the admin has given it permissios to just
+    # overwrite the file because some other error must have
+    # occurred.
+    #
+    # If, on the other hand, the lock file has dissappeared,
+    # the script asks get_file_lock to create a new lock file
+    # and then goes ahead and edits the file.
+    #
+    # The subroutine takes one argumnet, the name to use for
+    # the lock file and is called with the following syntax:
+    #
+    # &get_file_lock("file.name");
+
 sub get_file_lock 
 {
 
@@ -759,6 +855,13 @@
 $endtime = 55; # was 20 originally
 $endtime = time + $endtime;
 
+
+    # We set endtime to wait 20 seconds.  If the lockfile has
+    # not been removed by then, there must be some other
+    # problem with the file system.  Perhaps an instance of
+    # the script crashed and never could delete the lock file.
+    
+
 while (-e $lock_file && time < $endtime) 
 {
 sleep(1);
@@ -766,7 +869,17 @@
 
 open(LOCK_FILE, ">$lock_file") || 
     &CgiDie ("I could not open the lockfile - check your permission " .
-	     "settings ($lock_file)");
+       "settings ($lock_file)");
+
+
+    # Note: If flock is available on your system, feel free to
+    # use it.  flock is an even safer method of locking your
+    # file because it locks it at the system level.  The above
+    # routine is "pretty good" and it will server for most
+    # systems.  But if youare lucky enough to have a server 
+    # with flock routines built in, go ahead and uncomment
+    # the next line and comment the one above.
+
 
 # flock(LOCK_FILE, 2); # 2 exclusively locks the file
 
diff -ruN 4.0K-4b/protected/encryption-ext_lib.pl 5.0.000/protected/encryption-ext_lib.pl
--- 4.0K-4b/protected/encryption-ext_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/protected/encryption-ext_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,15 +1,17 @@
 # file ./store/protected/encryption-ext_lib.pl
 
-$versions{'encryption'} = "20021020";
+$versions{'encryption-ext_lib.pl'} = "5.0.000";
 
 {
- local ($modname) = 'encryption';
+ local ($modname) = 'gnupg encryption';
  &register_extension($modname,"Custom Store Logic",$versions{$modname});
- &add_item_to_manager_menu("GnuPG/PGP","change_PGP_screen=yes","");
+# &add_item_to_manager_menu("GnuPG/PGP","change_PGP_screen=yes","");
+ &add_settings_choice("gnupg editor","GnuPG/PGP Settings",
+  "change_PGP_screen");
  &register_menu('change_PGP_screen',"show_encryption_screen",
-	$modname,"Display Encryption Settings");
+  $modname,"Display Encryption Settings");
  &register_menu('ConfigPGP',"write_pgp_settings",
-	$modname,"Write Encryption Settings");
+  $modname,"Write Encryption Settings");
 }
 ###############################################################################
 sub write_pgp_settings
@@ -98,20 +100,20 @@
 
 print <<ENDOFTEXT;
 <CENTER>
-<HR WIDTH=580>
+<HR>
 </CENTER>
 
 <CENTER>
 <FORM ACTION="manager.cgi" METHOD="POST">
-<TABLE WIDTH=580>
+<TABLE>
 <TR>
-<TD WIDTH=580>
-<FONT FACE=ARIAL>Welcome to the PGP section of the <b>AgoraCart</b>
+<TD>
+<FONT FACE=ARIAL>Welcome to the GnuPG / PGP section of the <b>AgoraCart</b>
 System Manager. 
 Each value is defined and described, so you should have no problem 
 getting through this part.  Versions of PGP vary a bit, hopefully
 the command flags in pgp-lib.pl won't need to be 
-adjusted.
+adjusted. <br><br>NOTE: This is an advanced application that requires knowledge of how to install encryption on hosting accounts.  <b>This is Not Required</b> unless you are going to use encryption keys with Offline in order to store and read the entire order information by emails securely and/or in use other payment gateways such as iTransact or AgoraPay for additional security.  If you are unsure about how to set this up, leave this area as is or you can disable the operation of your cart.  For help on this subject, please consult with your hosting company and for DIY information, see the user forums for help.
 </TD>
 </TR>
 </TABLE>
@@ -140,7 +142,7 @@
 
 <FONT FACE=ARIAL SIZE=2>
 <CENTER>
-<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
+<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0>
 
 <TR>
 <TD COLSPAN=2><HR></TD>
@@ -198,7 +200,7 @@
 </TD>
 </TR>
 
-</TABLE><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
+</TABLE><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0>
 
 <TR>
 <TD COLSPAN=2>
@@ -258,7 +260,7 @@
 <TD COLSPAN=2><HR></TD>
 </TR>
 
-</TABLE><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
+</TABLE><TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0>
 
 <TR>
 <TD COLSPAN="2">
diff -ruN 4.0K-4b/protected/featured_product-ext_lib.pl 5.0.000/protected/featured_product-ext_lib.pl
--- 4.0K-4b/protected/featured_product-ext_lib.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/protected/featured_product-ext_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,224 @@
+# file ./store/protected/featured_product-ext_lib.pl
+#########################################################################
+#
+# Copyright (c) 2002 to Date K-Factor Technologies, Inc.
+# http://www.k-factor.net/  and  http://www.AgoraCart.com/
+# All Rights Reserved.
+#
+# Use with permission only with AgoraCart, AgoraCartPro, AgoraSQL, AgoraCartSQL, 
+# or AgoraSuite
+#
+# This software is a separate add-on to an ecommerce shopping cart and 
+# is the confidential and proprietary information of K-Factor Technologies, Inc.  You shall
+# not disclose such Confidential Information and shall use it only in
+# conjunction with the AgoraCart (aka agora.cgi) shopping cart.
+#
+# Requires AgoraCart version 5.0.0 or above.  Just place this file in the protected directory.
+#
+# K-Factor Technologies, Inc. BytePipe, AgoraScript nor any of their employees and/or representatives
+# MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT
+# THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESSED OR IMPLIED,
+# INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+# OR NON-INFRINGEMENT.
+#
+# K-Factor Technologies, Inc., BytePipe, AgoraScript nor any of their employees and/or representatives
+# SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY
+# LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS
+# SOFTWARE OR ITS DERIVATIVES.
+#
+# You may not give this script/add-on away or distribute it an any way without
+# written permission from K-Factor Technologies, Inc.  K-Factor Technologies, Inc.
+# reserves any and all rights to distributions, add-ons, and other works based on this
+# piece of software as well as any and all rights to profit sharing and/or to charge for
+# such works and/or derivatves.
+#
+# Hosting Companies and other software integrators are encouraged to integrate additional
+# features and add-ons in their AgoraCart offerings, but must receive written permission from from
+# K-Factor Technologies, Inc. in order to distribute this add-on to AgoraCart (aka Agora.cgi).
+#
+##########################################################################
+$versions{'featured_product-ext_lib.pl'} = "5.0.000";
+
+$mc_featuredProductPath="$mgrdir/misc/featuredproduct.pl";
+
+{
+ local ($modname) = 'featured_product';
+ &register_extension($modname,"Featured Product Manager",$versions{$modname});
+ &add_settings_choice("Featured Product Manager"," Featured Product Manager ",
+	"change_featuredproduct_screen");
+ &register_menu('FeaturedProductSettings',"write_featuredproduct_settings",
+	$modname,"Write Featured Product Settings");
+ &register_menu('change_featuredproduct_screen',"display_featuredproduct_screen",
+	$modname,"Display Featured Product Settings");
+ &add_merchtools_settings_choice("Featured Product","Featured Product",
+  "change_featuredproduct_screen");
+}
+#######################################################################################
+sub write_featuredproduct_settings {
+ my ($myset)="";
+ my $style="$in{'csstyle'}";
+
+if (($in{'OptionA1'} ne "") && ($in{'OptionA1t'} ne "") && ($in{'OptionA1n'} ne "") && 
+	  ($in{'OptionA1p'} ne "") && ($in{'OptionA1d'} ne "")) {
+$sc_featuredProduct = qq~<div align=center><a class=$style href="$sc_store_url?cart_id=%%cart_id%%&amp;p_id=$in{'OptionA1'}&amp;xm=on">
+                         <img class="template_image_no_border" src="%%URLofImages%%/$in{'OptionA1t'}" alt="featured product" /></a><br /><br />\n~;
+$sc_featuredProduct .= qq~<a class=$style href="$sc_store_url?cart_id=%%cart_id%%&amp;p_id=$in{'OptionA1'}&amp;xm=on"><b>$in{'OptionA1n'}</b></a><br />\n~;
+$p1 = $in{'OptionA1p'};
+$p2 = &format_pricemgr($p1);
+$sc_featuredProduct .= qq~$in{'OptionA1d'}<br />\n~;
+$sc_featuredProduct .= qq~<font class=ac_product_price>%%sc_money_symbol%% $p2</font></div>\n~;
+
+my $temp_SSL = $sc_ssl_location_url2;
+$temp_SSL =~ s/agora\.cgi//i;
+$sc_featuredProduct_secure = qq~<div align=center><a class=$style href="$sc_store_url?cart_id=%%cart_id%%&amp;p_id=$in{'OptionA1'}&amp;xm=on">
+     <img class="template_image_no_border" src="$temp_SSL%%URLofImages%%/$in{'OptionA1t'}" alt="featured product" /></a><br /><br />\n~;
+$sc_featuredProduct_secure .= qq~<a class=$style href="$sc_store_url?cart_id=%%cart_id%%&amp;p_id=$in{'OptionA1'}&amp;xm=on"><b>$in{'OptionA1n'}</b></a><br />\n~;
+$sc_featuredProduct_secure .= qq~$in{'OptionA1d'}<br />\n~;
+$sc_featuredProduct_secure .= qq~<font class=ac_product_price>%%sc_money_symbol%% $p2</font></div>\n~;
+}
+
+$myset .= "\$sc_featuredProduct = qq~$sc_featuredProduct~;\n";
+$myset .= "\$sc_featuredProduct_secure = qq|$sc_featuredProduct_secure|;\n";
+$myset .= "\$sc_displayFeaturedProducts = \"$in{'sc_displayFeaturedProducts'}\";\n";
+$sc_displayFeaturedProducts = $in{'sc_displayFeaturedProducts'};
+&update_store_settings('FEATUREDPRODUCT',$myset);
+
+$myset = "$in{'csstyle'}|";    # css style
+$myset .= "$in{'OptionA1'}|";  # p_id
+$myset .= "$in{'OptionA1t'}|"; # thumbnail
+$myset .= "$in{'OptionA1n'}|"; # name
+$myset .= "$in{'OptionA1p'}|"; # price
+$myset .= "$in{'OptionA1d'}|"; # description
+
+&update_featuredproduct_file_settings($mc_featuredProductPath,$myset);
+
+&display_featuredproduct_screen;
+ }
+################################################################################
+sub display_featuredproduct_screen
+{
+my ($lines);
+my ($csstyle,$OptionA1,$OptionA1t,$OptionA1n,$OptionA1p,$OptionA1d);
+print &$manager_page_header("Featured Product","","","","");
+
+open (DATA, "$mc_featuredProductPath");
+@indata = <DATA>;
+close (DATA);
+foreach $lines (@indata){
+	($csstyle,$OptionA1,$OptionA1t,$OptionA1n,$OptionA1p,$OptionA1d) = split(/\|/, $lines);
+}
+
+print <<ENDOFTEXT;
+<CENTER>
+<HR WIDTH=580>
+</CENTER>
+
+<FORM ACTION="manager.cgi" METHOD="POST">
+<CENTER>
+<TABLE WIDTH=580>
+<TR>
+<TD WIDTH=580><font face="arial,helvetica" size=2>
+Welcome to the <b>AgoraCart</b> Featured Product Manager.  This area allows you select a product from your store that will be displayed as a "Featured Product" on your store pages.  Please only include a short description and a thumbnail sized image of the product as the featured product will be displayed in the store footer.  Note: if your store design does not have the appropriate code to show this feature within the headers or footers for your store, it will not be displayed until that code is added into your store's pages/files.</font></TD>
+</TR>
+</TABLE><br><hr width=520 size=1 noshade><br>
+</CENTER>
+
+ENDOFTEXT
+
+if($in{'system_edit_success'} ne "")
+{
+print <<ENDOFTEXT;
+<CENTER><br>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL SIZE=2 COLOR=RED>Featured Product File has been successfully updated. </FONT>
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+ENDOFTEXT
+}
+
+print qq~
+<FORM ACTION="manager.cgi" METHOD="POST">
+  <div align="center"> 
+    <table width="520" border="0" cellspacing="0" cellpadding="0">
+      <tr>
+        <td><font face="arial,helvetica" size=2><div align="center"><b>SETUP VARIABLES</b><br>
+            This section should be completed with all the necessary information 
+            for your store.<br>
+            <br>
+          </div></font></td>
+      </tr>
+    </table>
+    <table width="520" border="0" cellspacing="0" cellpadding="0">
+      <tr> 
+        <td><font face="arial,helvetica" size=2><b>Style to use</b> <br>note: if you are using a standard template, enter: ac_left_links</font></td>
+        <td><font face="arial,helvetica" size=2><div align="right"> 
+            <input name="csstyle" type="text" id="csstyle" value="$csstyle" size="15">
+          </div></font></td>
+      </tr>
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+<TR>
+<TD>
+<font face="arial,helvetica" size=2><b>Display Featured Product </b></font>
+</TD><TD>
+<br>
+<SELECT NAME=sc_displayFeaturedProducts>
+<OPTION SELECTED>$sc_displayFeaturedProducts</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT>
+</TD>
+</TR>
+    </table>
+    <br>
+    <hr width="520">
+    <table width="520" border="0" cellspacing="0">
+      <center>
+        <tr> 
+          <td width="126"><font face="arial,helvetica" size=2><div align="left">Product ID
+              <input type="text" name="OptionA1" size="5" value="$OptionA1" maxlength="25">
+            </div></font></td>
+          <td width="318"><font face="arial,helvetica" size=2><div align="left">Product Name:
+              <input type="text" name="OptionA1n" size="30" value="$OptionA1n" maxlength="35">
+            </div></font></td>
+          <td width="318"><font face="arial,helvetica" size=2><div align="left">Short Description:
+              <input type="text" name="OptionA1d" size="30" value="$OptionA1d" maxlength="95">
+            </div></font></td>
+        </tr>
+        <tr> 
+          <td width="318"><br><font face="arial,helvetica" size=2><div align="left">Price:<br><small>(no currency sign)</small>
+              <input type="text" name="OptionA1p" size="10" value="$OptionA1p" maxlength="15">
+            </div></font></td>
+          <td colspan=2 width="636"><br><font face="arial,helvetica" size=2><div align="left">Thumbnail:<br><small>(image name only. must be in your images directory)</small>
+              <input type="text" name="OptionA1t" size="50" value="$OptionA1t" maxlength="125">
+            </div></font></td>
+        </tr>
+      </center>
+    </table>
+  </div><br><br>
+   <p align="center"><font face="Arial"><INPUT TYPE="HIDDEN" NAME="system_edit_success" value="yes">
+<INPUT NAME="FeaturedProductSettings" TYPE="SUBMIT" value="Submit">
+&nbsp;&nbsp;
+<INPUT TYPE="RESET" value="Reset"></font></p>
+   </form>~;
+
+print &$manager_page_footer;
+}
+
+#######################################################################################
+sub update_featuredproduct_file_settings {
+  local($item,$stuff) = @_;
+  &get_file_lock("$mc_featuredProductPath.lockfile");
+  open(BESTFILE,">$mc_featuredProductPath") || &my_die("Can't Open $mc_featuredProductPath");
+     print (BESTFILE $stuff);
+  close(BESTFILE);
+  &release_file_lock("$mc_featuredProductPath.lockfile");
+ }
+#######################################################################################
+1; # Library
diff -ruN 4.0K-4b/protected/files/8mdXTYsr.login 5.0.000/protected/files/8mdXTYsr.login
--- 4.0K-4b/protected/files/8mdXTYsr.login	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/protected/files/8mdXTYsr.login	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,7 @@
+$ok_ip="63.98.126.82"; 1;
+$mc_manager_name = 'mister.ed';
+$username = 'mister.ed';
+eval("&multi_mgr_set_privs('mister.ed');");
+#
+#MANAGER:mister.ed
+1; # Library
diff -ruN 4.0K-4b/protected/files/thisisunique_g7eq.login.pl 5.0.000/protected/files/thisisunique_g7eq.login.pl
--- 4.0K-4b/protected/files/thisisunique_g7eq.login.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/protected/files/thisisunique_g7eq.login.pl	1969-12-31 18:00:00.000000000 -0600
@@ -1 +0,0 @@
-$ok_ip="172.172.227.116"; 1;
diff -ruN 4.0K-4b/protected/freeform_logic-ext_lib.pl 5.0.000/protected/freeform_logic-ext_lib.pl
--- 4.0K-4b/protected/freeform_logic-ext_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/protected/freeform_logic-ext_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,16 +1,16 @@
 # file ./store/protected/freeform_logic-ext_lib.pl
 
-$versions{'freeform_logic'} = "20021020";
+$versions{'freeform_logic-ext_lib.pl'} = "5.0.000";
 
 {
  local ($modname) = 'freeform_logic';
  &register_extension($modname,"Custom Store Logic",$versions{$modname});
  &add_settings_choice("free form logic"," Free Form Logic ",
-	"freeform_settings_screen");
+  "freeform_settings_screen");
  &register_menu('freeform_settings_screen',"change_free_settings_screen",
-	$modname,"Display Free Form (custom) Logic");
+  $modname,"Display Free Form (custom) Logic");
  &register_menu('ChangeFreeSettings',"action_change_free_settings",
-	$modname,"Write Free Form (custom) Logic");
+  $modname,"Write Free Form (custom) Logic");
 }
 #######################################################################################
 sub action_change_free_settings {
@@ -31,11 +31,11 @@
   $myset .= "#\n";
   $myset .= "if (\$main_program_running =~ /yes/i) {\n";
   $myset .= '  &add_codehook("after_loading_setup_db","run_freeform_logic");'
-		. "\n";
+    . "\n";
   $myset .= '  &add_codehook("pre_header_navigation","run_freeform_logic");'
-		. "\n";
+    . "\n";
   $myset .= '  &add_codehook("open_for_business","run_freeform_logic_too");'
-		. "\n";
+    . "\n";
   $myset .= " }\n";
   $myset .= "\$sc_free_form_logic_done = 0; \n";
   $myset .= "sub run_freeform_logic { \n";
@@ -74,14 +74,14 @@
 
 print <<ENDOFTEXT;
 <CENTER>
-<HR WIDTH=580>
+<HR>
 </CENTER>
 
 <FORM ACTION="manager.cgi" METHOD="POST">
 <CENTER>
-<TABLE WIDTH=580>
+<TABLE>
 <TR>
-<TD WIDTH=580>
+<TD>
 <FONT FACE=ARIAL>Welcome to the <b>AgoraCart</b> System Manager
 Free Form Logic settings.  This logic is run after the 
 shopping cart loads the agora.setup.db file or at the
@@ -120,7 +120,7 @@
 
 <FONT FACE=ARIAL SIZE=2>
 <CENTER>
-<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
+<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0>
 
 <TR>
 <TD COLSPAN=2><HR></TD>
diff -ruN 4.0K-4b/protected/htacess 5.0.000/protected/htacess
--- 4.0K-4b/protected/htacess	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/protected/htacess	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,9 @@
+
+AuthType Basic
+
+AuthName "Agora Cart Admin"
+
+AuthUserFile "/home/agoracgi/.htpasswds/storepro5/protected/passwd"
+
+
+require valid-user
Binary files 4.0K-4b/protected/images/Agora-logo-white2.gif and 5.0.000/protected/images/Agora-logo-white2.gif differ
Binary files 4.0K-4b/protected/images/Imega5d.gif and 5.0.000/protected/images/Imega5d.gif differ
Binary files 4.0K-4b/protected/images/agora-cart-banner-bg2.jpg and 5.0.000/protected/images/agora-cart-banner-bg2.jpg differ
Binary files 4.0K-4b/protected/images/agora-cart-button-bg.jpg and 5.0.000/protected/images/agora-cart-button-bg.jpg differ
Binary files 4.0K-4b/protected/images/agora-cart-button.jpg and 5.0.000/protected/images/agora-cart-button.jpg differ
Binary files 4.0K-4b/protected/images/agoracart.jpg and 5.0.000/protected/images/agoracart.jpg differ
Binary files 4.0K-4b/protected/images/agoraexchange.jpg and 5.0.000/protected/images/agoraexchange.jpg differ
Binary files 4.0K-4b/protected/images/agoraxchange_125x125.gif and 5.0.000/protected/images/agoraxchange_125x125.gif differ
Binary files 4.0K-4b/protected/images/background.gif and 5.0.000/protected/images/background.gif differ
Binary files 4.0K-4b/protected/images/button-bar-bg.jpg and 5.0.000/protected/images/button-bar-bg.jpg differ
Binary files 4.0K-4b/protected/images/header.gif and 5.0.000/protected/images/header.gif differ
Binary files 4.0K-4b/protected/images/niftylogo1.png and 5.0.000/protected/images/niftylogo1.png differ
Binary files 4.0K-4b/protected/images/site4logo45highL.gif and 5.0.000/protected/images/site4logo45highL.gif differ
Binary files 4.0K-4b/protected/images/snooperclick.jpg and 5.0.000/protected/images/snooperclick.jpg differ
Binary files 4.0K-4b/protected/images/webstyle.jpg and 5.0.000/protected/images/webstyle.jpg differ
diff -ruN 4.0K-4b/protected/index.html 5.0.000/protected/index.html
--- 4.0K-4b/protected/index.html	2005-11-30 17:13:24.000000000 -0600
+++ 5.0.000/protected/index.html	2006-10-31 09:40:27.000000000 -0600
@@ -1,15 +1 @@
-<HTML>
-<HEAD>
-<TITLE> </TITLE>
-<meta http-equiv="Refresh" content="0; url=manager.cgi">
-</HEAD>
-
-
-<script language="javascript1.1">
-<!-- Hide
-location.replace ('manager.cgi');
-// end hide -->
-</script>
-
-</HTML>
-
+Restricted Area
\ No newline at end of file
diff -ruN 4.0K-4b/protected/main_settings-ext_lib.pl 5.0.000/protected/main_settings-ext_lib.pl
--- 4.0K-4b/protected/main_settings-ext_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/protected/main_settings-ext_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,6 +1,7 @@
 # file ./store/protected/main_settings-ext_lib.pl
 
-$versions{'main_settings'} = "20021020";
+$versions{'main_settings-ext_lib.pl'} = "5.0.000";
+$sc_mgrmiscmainfile = "$mgrdir/misc/mgr_miscmain.pl";
 
 {
  local ($modname) = 'main_settings';
@@ -8,20 +9,23 @@
    $mc_change_main_settings_ok = "yes";
   }
  if ($mc_change_main_settings_ok =~ /yes/i) {
-   &register_extension($modname,"Main Store Settings",$versions{$modname});
+   &register_extension($modname,"AgoraCart Store Settings",$versions{$modname});
    &register_menu('main_settings_screen',"show_main_settings_screen",
-	$modname,"Display Main Store Settings");
+  $modname,"Display Cart Settings");
    &register_menu('ChangeMainSettings',"action_input_main_settings",
-	$modname,"Write Main Store Settings");
-   &add_settings_choice("Payment Gateway"," Payment Gateway ",
-	"gateway_screen");
-   &register_menu('gateway_screen',"show_gateway_settings_screen",
-	$modname,"Display Gateway Settings");
+  $modname,"Write Cart Settings");
+   &register_menu('SelectGatewayScreen',"show_gateway_settings_screen",
+  $modname,"Select Which Gateway to Edit");
+   &register_menu('show_gateway_settings_screen',"show_gateway_settings_screen",
+  $modname,"Display Gateway Settings Screen");
+   &add_settings_choice("Payment Gateway"," Payment Gateway Settings ",
+  "select_gateway_settings_screen");
+&register_menu('select_gateway_settings_screen',"select_gateway_settings_screen",
+  $modname,"Display Which Gateway to Edit choices");
    &register_menu('GatewaySettings',"write_gateway_settings",
-	$modname,"Write Gateway Settings");
-   &add_item_to_manager_menu("Program Settings","change_settings_screen=yes",
-	"");
-   &add_item_to_manager_menu("Payment Gateway","gateway_screen=yes","");
+  $modname,"Write Gateway Settings");
+   &add_item_to_manager_menu("AgoraCart Management/Settings","change_settings_screen=yes",
+  "");
   }
 }
 #######################################################################################
@@ -53,6 +57,44 @@
 
 }
 ################################################################################
+sub select_gateway_settings_screen {
+
+&make_lists_of_various_options;
+
+print &$manager_page_header("Select Payment Gateway to Edit","","","","");
+
+print <<ENDOFTEXT;
+<CENTER>
+<HR>
+</CENTER>
+
+<FORM METHOD="POST" ACTION="manager.cgi">
+<CENTER>
+<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0>
+<TR>
+<TD colspan=2>
+<FONT FACE=ARIAL>Welcome to the <b>AgoraCart</b> Payment Processing Gateway Editor. Here you
+will select the gateway you wish to make changes to (to set the primary gateway, use the main settings manager).</TD>
+</TR>
+
+
+<TR>
+<TD colspan=2><font face=arial size=2><br><br><br>
+<b>Please select your the Payment Gateway you wish to edit:</b>
+<br>
+<SELECT NAME=gateway>
+$mylist_of_gateway_options
+</SELECT> <INPUT NAME="SelectGatewayScreen" TYPE="SUBMIT" VALUE="Submit">
+</font>
+</TD>
+</TR>
+
+
+</table></center><br><br><br></form>
+ENDOFTEXT
+print &$manager_page_footer;
+}
+################################################################################
 sub show_gateway_settings_screen {
 
 local ($msg);
@@ -64,16 +106,11 @@
   $sc_gateway_name =~ /([^\n]+)/; 
   $sc_gateway_name = $1;
  }
-
 eval("require './admin_files/$sc_gateway_name-user_lib.pl'");
 if ($@ ne "") {
   $msg= "<br><FONT COLOR=RED>GATEWAY USER LIB NOT FOUND!</FONT><br>\n";
-  $msg.= "You might consider copying the " .
-         "$sc_gateway_name example order form and " .
-        "$sc_gateway_name-user_lib.pl files from the " .
-        "html/main/examples and admin_files/examples directories " .
-        "to make things easier.<br>\n";
  }
+
  
 &codehook("gateway_admin_screen");
 
@@ -82,8 +119,12 @@
 sub action_input_main_settings{
 
 local($admin_email, $order_email, $cookieDomain, $cookiePath);
+local($temp_affiliate_call,$temp_affiliate_image_call,$temp_money_symbol,$sc_temp_affiliate_call2);
+local($temp1,$temp2,$order_email5,$order_email6);
 local($other_program_settings)="";
 local($myset)="";
+local($myset2)="";
+local($myset3)="";
 
 &ReadParse;
 
@@ -98,18 +139,12 @@
 $cookiePath =~ s/agora.cgi//g;
 chop $cookiePath; # no trailing slash
 
-$order_email3 = $in{'email_address_for_orders'}; 
-$order_email3 =~ s/\@/\\@/g;
-
-$admin_email = $in{'admin_email'};
-$admin_email =~ s/\@/\\@/g;
-$sc_temp_money_symbol = '$';
-$order_email5 = $in{'second_email_address_for_orders'};
-$order_email5 =~ s/\@/\\@/g;
-$order_email = $order_email3;
+$order_email = &my_escape($in{'email_address_for_orders'}); 
+$admin_email = &my_escape($in{'admin_email'});
+$order_email5 = &my_escape($in{'second_email_address_for_orders'});
 if ($in{'second_email_orders_yes_no'} =~ /yes/i) {
 $order_email6 = "," . $order_email5;
-$order_email = $order_email3 . $order_email6;
+$order_email = $order_email . $order_email6;
 }
 
 $myset = "";
@@ -121,31 +156,48 @@
   $myset .= "\$sc_set_0077_umask = 'no';\n";
   $myset .= "\$original_umask = umask;\n";
  }
+
+# moved to main settings by Mister Ed May 13, 2006
+$myset .= "\$sc_number_days_keep_old_carts = \"$in{'sc_number_days_keep_old_carts'}\";\n";
+
+$sc_gateway_name = "$in{'gateway_name'}";
+
 $myset .= "\$sc_allow_ofn_choice = \"$in{'sc_allow_ofn_choice'}\";\n";
 $myset .= "\$sc_gateway_name = \"$in{'gateway_name'}\";\n";
+$myset .= "\$sc_replace_orderform_form_tags = \"$in{'sc_replace_orderform_form_tags'}\";\n";
 $myset .= "\$sc_database_lib = \"$in{'database_lib'}\";\n";
 $myset .= "\$sc_prod_db_pad_length = \"$in{'sc_prod_db_pad_length'}\";\n";
-$sc_money_symbol = $in{'sc_money_symbol'};
-if ($sc_money_symbol =~ /\$/i) {
-$myset .= "\$sc_money_symbol = \'$sc_temp_money_symbol\';\n";
- } else {
-  $myset .= "\$sc_money_symbol = \'$in{'sc_money_symbol'}\';\n";
- }
-$myset .= "\$sc_money_symbol_placement = \"$in{'sc_money_symbol_placement'}\";\n";
-$myset .= "\$sc_http_affilliate_call = \'$in{'sc_http_affilliate_call'}\';\n";
-if ($in{'sc_affiliate_image_call'} ne '') {
-$temp_affiliate_image_call = "<IMG SRC=\"$sc_http_affilliate_call://" . $in{'sc_affiliate_image_call'} . "\" border=0>";
-$myset .= "\$sc_affiliate_image_call = \'$temp_affiliate_image_call\';\n";
-} else {
-$myset .= "\$sc_affiliate_image_call = \'$in{'sc_affiliate_image_call'}\';\n";
+$myset2 .= "\$mc_first_time_user_to_agora_check2 = \"1\";\n";
+$myset3 .= "\$mc_first_time_user_to_agora_check2 = \"1\";\n";
+$temp1 = &my_stripout($in{'sc_minimum_order_amount'});
+$temp2 = &my_stripout($in{'sc_minimum_order_text'});
+$myset .= "\$sc_minimum_order_amount = \"$temp1\";\n";
+$myset .= "\$sc_minimum_order_text = \"$temp2\";\n";
+$myset .= "\$sc_prevent_zero_total_orders = \"$in{'sc_prevent_zero_total_orders'}\";\n";
+$myset .= "\$sc_need_short_cart_id = \"$in{'sc_need_short_cart_id'}\";\n";
+$myset .= "\$sc_use_international_latin_characters = \"$in{'sc_use_international_latin_characters'}\";\n";
+
+$myset .= "\$sc_use_database_subcats = \"$in{'sc_use_database_subcats'}\";\n";
+$myset .= "\$sc_subcat_index_field = \"$in{'sc_subcat_index_field'}\";\n";
+$myset .= "\$sc_count_database_cats = \"$in{'sc_count_database_cats'}\";\n";
+
+
+$myset .= "\$sc_http_affiliate_call = qq!$in{'sc_http_affiliate_call'}!;\n";
+$sc_temp_affiliate_call2 = &my_escape($in{'sc_temp_affiliate_call'});
+$myset .= "\$sc_temp_affiliate_call = \"$sc_temp_affiliate_call2\";\n";
+if ($in{'sc_temp_affiliate_call'} ne "") {
+$temp_affiliate_image_call = "<IMG SRC=\"" . $in{'sc_http_affiliate_call'}."://$sc_temp_affiliate_call\" border=0>";
+$myset .= "\$sc_affiliate_image_call = qq~$temp_affiliate_image_call~;\n";
 }
 $myset .= "\$sc_send_order_to_email = \"$in{'email_orders_yes_no'}\";\n";
 $myset .= "\$sc_second_send_order_to_email = \"$in{'second_email_orders_yes_no'}\";\n";
-$myset .= "\$sc_order_log_name = \"$in{'name_of_the_log_file'}\";\n";
-$myset .= "\$sc_send_order_to_log = \"$in{'log_orders_yes_no'}\";\n";
+
+my $first_order_email = &my_escape($in{'email_address_for_orders'});
 $myset .= "\$sc_order_email = \"$order_email\";\n";
-$myset .= "\$sc_first_order_email = \"$order_email3\";\n";
+$myset .= "\$sc_first_order_email = \"$first_order_email\";\n";
 $myset .= "\$sc_second_order_email = \"$order_email5\";\n";
+$myset .= "\$sc_use_dynamic_email_subjects = \"$in{'sc_use_dynamic_email_subjects'}\";\n";
+
 $myset .= "\$sc_store_url = \"$in{'sc_store_url'}\";\n";
 $myset .= "\$sc_ssl_location_url2 = \"$in{'sc_ssl_location_url2'}\";\n";
 $myset .= "\$sc_stepone_order_script_url = \"$in{'sc_ssl_location_url2'}\";\n";
@@ -154,24 +206,39 @@
 $myset .= "\$sc_path_for_cookie = \"$cookiePath\";\n";
 $myset .= "\$sc_self_serve_images = \"$in{'sc_self_serve_images'}\";\n";
 if ($in{'sc_self_serve_images'} =~ /yes/i) {
-#  $myset .= "\$URL_of_images_directory = \"agora.cgi?picserve=\";\n";
   $myset .= "\$URL_of_images_directory = \"picserve.cgi?picserve=\";\n";
  } else {
-  $myset .= "\$URL_of_images_directory = " . 
-                   "\"$in{'URL_of_images_directory'}\";\n";
+  $myset .= "\$URL_of_images_directory = \"$in{'URL_of_images_directory'}\";\n";
 }
-$myset .= "\$sc_path_of_images_directory = " . 
-                   " \"$in{'URL_of_images_directory'}\";\n";
-$myset .= "\$sc_db_max_rows_returned = \"$in{'sc_db_max_rows_returned'}\";\n";
+$myset .= "\$sc_path_of_images_directory = \"$in{'URL_of_images_directory'}\";\n";
+$myset .= "\$sc_shall_i_log_accesses = \"$in{'sc_shall_i_log_accesses'}\";\n";
+
 $myset .= "\$sc_order_check_db = \"$in{'sc_order_check_db'}\";\n";
-$myset .= "\$sc_use_html_product_pages = \"$in{'sc_use_html_product_pages'}\";\n";
-$myset .= "\$sc_should_i_display_cart_after_purchase = \"$in{'sc_should_i_display_cart_after_purchase'}\";\n";
+# security: options must match options file for database item
+$myset .= "\$sc_negative_priced_options = \"$in{'sc_negative_priced_options'}\";\n";
+$myset .= "\$sc_use_verified_opt_values = \"$in{'sc_use_verified_opt_values'}\";\n";
+$myset .= "\$sc_disable_variable_options = \"$in{'sc_disable_variable_options'}\";\n";
+$myset .= "\$sc_turn_off_option_price_display = \"$in{'sc_turn_off_option_price_display'}\";\n";
+$myset .= "\$sc_enable_multi_load_option_files = \"$in{'sc_enable_multi_load_option_files'}\";\n";
+
+
 $myset .= "\$sc_scramble_cc_info = \"$in{'scramble_cc_info'}\";\n";
+$myset .= "\$sc_running_an_SSI_store = '$in{'running_an_SSI_store'}';\n";
+$myset .= "\$sc_use_meta_cookies = '$in{'use_meta_cookies'}';\n";
+$myset .= "\$sc_debug_mode = \"no\";\n";
+$mc_images_dir = "$in{'mc_images_dir'}";
+$myset2 .= "\$mc_images_dir = \"$in{'mc_images_dir'}\";\n";
 &codehook("other_program_settings");
 if ($other_program_settings ne "") {
   $myset .= "$other_program_settings\n";
  }
+
+$myset2 .= "\$mgr_shall_i_log_accesses = \"$in{'sc_shall_i_log_accesses'}\";\n";
+$myset3 .= "\$sc_shall_i_log_accesses = \"$in{'sc_shall_i_log_accesses'}\";\n";
+
 &update_store_settings('MAIN',$myset); # main settings
+&save_userlog_settings($myset3); # userlog settings
+&update_mainmisc_settings('$sc_mgrmiscmainfile',$myset2);
 &show_main_settings_screen;
 }
 #######################################################################################
@@ -181,15 +248,15 @@
 
 print <<ENDOFTEXT;
 <CENTER>
-<HR WIDTH=580>
+<HR>
 </CENTER>
 
 <CENTER>
-<TABLE WIDTH=580>
+<TABLE>
 <TR>
-<TD WIDTH=580>
+<TD>
 <FONT FACE=ARIAL>Welcome to the <b>AgoraCart</b> System Manager. Here you
-will set the data variables specific to your store.</TD>
+will set the main data settings/variables specific to your store.</TD>
 </TR>
 </TABLE>
 </CENTER>
@@ -202,8 +269,8 @@
 <CENTER>
 <TABLE>
 <TR>
-<TD>
-<FONT FACE=ARIAL SIZE=2 COLOR=RED>System settings have been successfully updated. Check your Gateway Settings <a href=manager.cgi?gateway_screen=yes>here</a></FONT>
+<TD><br>
+<FONT FACE=ARIAL SIZE=2 COLOR=RED>System settings have been successfully updated.  Check/Edit your Primary Gateway Settings <a href=manager.cgi?show_gateway_settings_screen=$sc_gateway_name>here</a></FONT>
 </TD>
 </TR>
 </TABLE>
@@ -239,9 +306,7 @@
 if ($sc_path_of_images_directory eq "") {
  $sc_path_of_images_directory =  $URL_of_images_directory;
 }
-if ($sc_UPS_RateChart eq "") {
-  $sc_UPS_RateChart = "Regular Daily Pickup";
- }
+
 if ($sc_allow_ofn_choice eq ""){
   $sc_allow_ofn_choice = "no";
  }
@@ -255,6 +320,12 @@
 if ($sc_debug_mode eq ""){
   $sc_debug_mode = "no";
  }
+if ($sc_running_an_SSI_store eq ""){
+  $sc_running_an_SSI_store = "no";
+ }
+if ($sc_use_meta_cookies eq ""){
+  $sc_use_meta_cookies = "no";
+ }
 if ($sc_set_0077_umask eq ""){
   $sc_set_0077_umask = "no";
  }
@@ -269,22 +340,36 @@
   $sc_scramble_cc_info = "no";
  }
 
+if ($sc_use_international_latin_characters eq ""){
+  $sc_use_international_latin_characters = "no";
+ }
+if ($sc_enable_multi_load_option_files eq ""){
+  $sc_enable_multi_load_option_files = "no";
+ }
+
 print <<ENDOFTEXT;
 
 <FONT FACE=ARIAL SIZE=2>
 <FORM METHOD="POST" ACTION="manager.cgi">
 <CENTER>
-<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
+<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0>
 
 <TR>
-<TD COLSPAN=2><HR></TD>
+<TD><br></TD>
+</TR>
+<TR>
+<TD COLSPAN=4 bgcolor=#99CC99><center><font face="Arial, Helvetica, sans-serif" size=+2><b>Payment Gateway Section</b></font></center></TD>
+</TR>
+<TR>
+<TD><br></TD>
 </TR>
 
 <TR>
-<TD colspan=1>
-Please select your Primary Payment Gateway:
+<TD colspan=2>
+<b>Please select your Primary Payment Gateway:</b>
 <br>
-<TD colspan=1>
+<small><a href="http://www.agoracart.com/agorawiki/index.php?title=What_is_a_Payment_Gateway" target="_blank">What is a Payment Gateway</a>?  &nbsp;&nbsp; <a href="http://www.agoracart.com/agorawiki/index.php?title=Payment_Gateway_Basics_%26_x-comments">Payment Gateway Basics</a></small>
+<TD colspan=2>
 <SELECT NAME=gateway_name>
 $mylist_of_gateway_options
 </SELECT>
@@ -292,226 +377,400 @@
 </TR>
 
 <TR>
-<td>Allow Multiple Gateways?  For security reasons it is a good idea
-to delete any order forms from the html/main directory for
-gateways you are not using. </td>
-<TD><SELECT NAME=sc_allow_ofn_choice>
+<td colspan=2><br><b>Allow Multiple Gateways? </b> <small>This will automatically use the <b>combo-orderform.html</b> file so that customer can choose their preferred payment type, so you will need to edit that file for your payment types (can be 2 or more gateways).  For security reasons, it is a good idea
+to delete any order forms from the "html/forms" sub-directory of your store for
+gateways you are not planning to use. </small></td>
+<TD colspan=2><SELECT NAME=sc_allow_ofn_choice>
 <OPTION SELECTED>$sc_allow_ofn_choice</OPTION>
 <OPTION>$sc_other_ofn</OPTION> 
 </SELECT></TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2><HR></TD>
+<td colspan=2><br><b>Replace Order Form Tags?</b>  <small>This handles the submit button when displaying the order form.  Select yes to run a normal store operation.  Select "no" if having problems with multiple gateways going to the wrong gateway or back to the cart .  Default is yes.  Leave this as "yes" unless it corrects multiple gateway forms submission problems.</small></td>
+<TD colspan=2><SELECT NAME=sc_replace_orderform_form_tags>
+<OPTION SELECTED>$sc_replace_orderform_form_tags</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT></TD>
 </TR>
 
 <TR>
-<TD colspan=2>
-Select your Database library and set the product database key pad length:
+<TD><br></TD>
+</TR>
+<TR>
+<TD COLSPAN=4 bgcolor=#99CC99 align=center><font face="Arial, Helvetica, sans-serif" size=+2><b>Database Section</b></font></TD>
+</TR>
+<TR>
+<TD><br></TD>
+</TR>
+
+<TR>
+<TD colspan=4>
+<b>Select your Database library and set the product database key pad length:</b>
 <br>
 Library: <SELECT NAME=database_lib>
 $mylist_of_database_libs
 </SELECT>
 &nbsp;&nbsp;&nbsp;&nbsp;
 Key Pad Length: <INPUT NAME="sc_prod_db_pad_length" TYPE="TEXT" SIZE=1 
-MAXLENGTH="1" VALUE="$sc_prod_db_pad_length">
+MAXLENGTH="2" VALUE="$sc_prod_db_pad_length">
 </TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2><HR></TD>
+<TD COLSPAN=4><HR></TD>
 </TR>
 
 <TR>
-<TD colspan=2>
-Enter your Monetary Symbol and Select the position of the Symbol:
-<br>
-Money Symbol: <INPUT NAME="sc_money_symbol" TYPE="TEXT" SIZE=1 
-MAXLENGTH="1" VALUE="$sc_money_symbol">
-&nbsp;&nbsp;&nbsp;&nbsp;
-Position of Symbol: <SELECT NAME=sc_money_symbol_placement>
-<option>$sc_money_symbol_placement</option>
-<option>front</option>
-<option>back</option>
+<TD colspan=4>
+<b>Do you wish to use Product Sub Categories? </b> <SELECT NAME=sc_use_database_subcats>
+<OPTION>$sc_use_database_subcats</OPTION>
+<OPTION>No</OPTION> 
+<OPTION>Yes</OPTION> 
+</SELECT><br><br>
+
+<b>Select Product UserField you wish to Enter Sub Category Names in: </b><small>NOTE: when entering a product into multiple sub categories, separate sub catergory names with double colons (::) in the edit/add product manager screens. If you have subcat names of "Books" and "Used Books", they would be entered as: "Books::Used Books" in the UserField of choice.  Spaces allowed in the sub-category names. Only a single level of sub- categories available at this time (will be expanded later)</small> &nbsp;
+<SELECT NAME=sc_subcat_index_field>
+<option>$sc_subcat_index_field
+<option value="">None
+<option>user2
+<option>user3
+<option>user4
+<option>user5
+$user10_thingy
+$user20_thingy
 </SELECT>
+
+<br><br>
+<b>Do you wish to use Count total products in Categories and Sub Categories? </b> <small>This will display the item counts in each category or sub category next to the title/name of the category, if using standard layouts and/or standard AgoraScript category display code.  NOTE: if you get multiples in product counts equal in proportion to the number of category lists on a page, remove the extra category lists in the headers, footers and page layouts or turn this feature off. <SELECT NAME=sc_count_database_cats>
+<OPTION>$sc_count_database_cats</OPTION>
+<OPTION>No</OPTION> 
+<OPTION>Yes</OPTION> 
+</SELECT><br><br>
 </TD>
 </TR>
+
+<TR>
+<TD><br></TD>
+</TR>
 <TR>
-<TD COLSPAN=2><HR></TD>
+<TD COLSPAN=4 bgcolor=#99CC99 align=center><font face="Arial, Helvetica, sans-serif" size=+2><b>Ordering/Checkout Controls Section</b></font></TD>
+</TR>
+<TR>
+<TD><br></TD>
 </TR>
 
 <TR>
-<TD colspan=2>
-If using an affiliate program, Enter your image call info:
-<br><small>in the form of: locationURLtoImage?ordertotal=AMOUNTHERE&unique=UNIQUEIDHERE&otherneededinfo .  edit as needed.  do not enter: &lt;IMG SRC="https:// or the "
-BORDER=0&gt; portions of the image call as those are added automatically. For the total, insert this into the AMOUNTHERE: \$sc_affiliate_order_total.  If using the net profit add-on, use this instead: \$x_aff_profit.  For the UniqueID portion, you may use this inserted into the UNIQUEIDHERE portion: \$sc_affiliate_order_unique.  add whatever else is needed by your affiliate program for the image call.</small><br>
-<SELECT NAME=sc_http_affilliate_call>
-<option>$sc_http_affilliate_call</option>
-<option>http</option>
-<option>https</option>
-</SELECT>&nbsp;&nbsp;&nbsp;
+<td colspan=2><b>Minimum order:</b>  <small>If you wish to set a minimum order amount that customers must reach to complete an order, enter it here.  Otherwise, enter 0.  Do not add currency symbols as they will be stripped out in most cases.  indicate currency in the next box.</small></td>
+<TD colspan=2><INPUT NAME="sc_minimum_order_amount" TYPE="TEXT" SIZE=10 
+MAXLENGTH="10" VALUE="$sc_minimum_order_amount"></TD>
+</TR>
+<tr>
+<td colspan=2><br><b>MInimum order Currency Type:</b>  <small>Enter the currency type for the minimum order.  Spell it out.  Example: Euro, Dollars, Pounds, US Dollars, etc.</small></td>
+<TD colspan=2><INPUT NAME="sc_minimum_order_text" TYPE="TEXT" SIZE=15 
+MAXLENGTH="20" VALUE="$sc_minimum_order_text"></TD>
+</TR>
 
-tag info: <INPUT NAME="sc_affiliate_image_call" TYPE="TEXT" SIZE=45 
-MAXLENGTH="110" VALUE="$sc_affiliate_image_call">
+<TR>
+<TD COLSPAN=4><HR></TD>
+</TR>
 
+<TR>
+<TD colspan=4>
+<b>Do you wish to display the prices of options? </b> <small>This allows you to turn off the display of prices for each option ordered on each product in the view cart contents screen as well as on the cart contents displayed at checkout.  Default is ON, even if nothing is selected in this setting.</small> <SELECT NAME=sc_turn_off_option_price_display>
+<OPTION>$sc_turn_off_option_price_display</OPTION>
+<OPTION>on</OPTION> 
+<OPTION>off</OPTION> 
+</SELECT>
 </TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2><HR></TD>
+<TD COLSPAN=4><HR></TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2>
-Please enter the full URL of your /images directory. For example:<br>
-<b>http://$ENV{'SERVER_NAME'}/cgi-bin/store/html/images</b><br>
-DO NOT include the trailing slash!!! <b>/</b>
+<TD colspan=4>
+<b>Do you wish to prevent Zero total orders? </b> <small>YES will prevent zero orders.  NO will allow you to take zero orders.</small> <SELECT NAME=sc_prevent_zero_total_orders>
+<OPTION>$sc_prevent_zero_total_orders</OPTION>
+<OPTION>No</OPTION> 
+<OPTION>Yes</OPTION> 
+</SELECT>
 </TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2>
+<TD COLSPAN=4><HR></TD>
+</TR>
+
+<TR>
+<TD colspan=4>
+<b>Do you need shorter Cart ID numbers? </b> <small>NO is default, and ensures harder to guess order ID credentials (for increased security).  If your payment gateway requires shorter number for the "order ID" passed to them, then set this to YES.</small> <SELECT NAME=sc_need_short_cart_id>
+<OPTION>$sc_need_short_cart_id</OPTION>
+<OPTION>No</OPTION> 
+<OPTION>Yes</OPTION> 
+</SELECT>
+</TD>
+</TR>
+
+
+<TR>
+<TD COLSPAN=4><HR></TD>
+</TR>
+
+<TR>
+<TD colspan=4>
+<b>Allow International/Extended Latin Characters? </b> <small>YES will allow international latin based characters, useful when selling to countries such as those in Europe.  NO will only allow ASCII or normal English characters.  Default is NO for additional security purposes.  Additional characters allowed would be:<br>                                                                .</small> <br><SELECT NAME=sc_use_international_latin_characters>
+<OPTION>$sc_use_international_latin_characters</OPTION>
+<OPTION>No</OPTION> 
+<OPTION>Yes</OPTION> 
+</SELECT>
+</TD>
+</TR>
+
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD COLSPAN=4 bgcolor=#99CC99 align=center><font face="Arial, Helvetica, sans-serif" size=+2><b>Image Serving Section</b></font></TD>
+</TR>
+<TR>
+<TD><br></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=4>
+<b>Please enter URL of your Store's images directory</b>.<br><small>For example:<br>
+<b>http://$ENV{'SERVER_NAME'}/store/html/images</b></small>  DO NOT include the trailing slash!!! <b>/</b>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=4>
 <INPUT NAME="URL_of_images_directory" TYPE="TEXT" SIZE=60 
-VALUE="$sc_path_of_images_directory"><br>
-<b>URL of the /images directory</b>
-<br>
+VALUE="$sc_path_of_images_directory"><br><br><small>
 Hint: if you desire to use the \%\%URLofImages\%\% token in both
 secure https and insecure http pages, then setup things so that
-both use the same tree to access the images.  In this case, instead
-of using the full URL just use the directory/file part, such as:<br>
-<b>/cgi-bin/store/html/images</b> or <b>html/images</b><br><br>
-If you cannot do that but the disk paths (disk locations) are
-the same, then put the absolute disk path (or relative to agora.cgi 
-path) for your server's images
-directory above (without the trailing slash) 
-and set the next option to "yes" for self-serve of the images.<br>
-Do you want to self-serve the images? <SELECT NAME=sc_self_serve_images>
+both use the same directory tree to access the images.  In this case, instead
+of using the full URL (http://www.domain-name.com/store/html/images) just use the directory/file part, such as:<br>
+<b>/store/html/images</b>(aka absolute path from your root web directory) or <b>html/images</b> (aka relative path from the agora.cgi file)<br><br>
+For faster image serving, enter the relative disk path from the location of the agora.cgi  file
+(or the absolute path to the image) for your store's images directory (without the trailing slash) 
+and set the next option to "yes" for self-serve of the images. If your images are stored outside your store directory, such as an graphics directory in your "root" directory for your website:<br><b>www.domain-name.com/graphics</b><br>and your store was located in your cgi-bin like so:<br><b>www.domain-name.com/cgi-bin/store</b><br>then you would need to go up two levels in your directory tree and then back down one.  Each level upwards is indicated by a set of: ../ , so the image location for serving your images would look like this:<br>
+<b>../../graphics</b> with no trailing slash.</small><br><br><br>
+<b>Do you want to self-serve the images?</b> &nbsp; <SELECT NAME=sc_self_serve_images>
 <OPTION>$sc_self_serve_images</OPTION>
 <OPTION>No</OPTION> 
 <OPTION>Yes</OPTION> 
-</SELECT>&nbsp; Say NO unless you have entered the server
-disk path above instead of the http:// path or have some
-other good reason to use this images serving feature.&nbsp; One reason
-would be that your server will not serve images from your cgi-bin 
-directory and for some reason you do not desire to move them. 
+</SELECT> <br><small> Say NO unless you have some good reason to use this images serving feature.&nbsp; One reason
+would be that your server will not serve images from your cgi-bin directory (or where the store is currently installed at) and for some reason you do not desire to move them outside of the store directory areas.  <b>Speed Enhancement:</b> Your store will run faster with this set to no.</small>
+</TD>
+</TR>
+<TR>
+<TD COLSPAN=4><HR></TD>
+</TR>
+<TR>
+<TD COLSPAN=2><font face="Arial, Helvetica, sans-serif" size=2>
+Because the store can have a disk or http directory path for images, and manager needs disk path, we set this variable here to point to be the disk path to the images directory. 
+</font></TD><TD  COLSPAN=2>
+&nbsp;<INPUT NAME="mc_images_dir" TYPE="TEXT" SIZE=12 
+MAXLENGTH="30" VALUE="$mc_images_dir"><br><br>
 </TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2><HR></TD>
+<TD><br></TD>
+</TR>
+<TR>
+<TD COLSPAN=4 bgcolor=#99CC99 align=center><font face="Arial, Helvetica, sans-serif" size=+2><b>Store URL Section</b></font></TD>
+</TR>
+<TR>
+<TD><br></TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2>
-Please enter the full URL of your store here. &nbsp;Note: according to 
+<TD COLSPAN=4>
+<b>Please enter the full URL of your store here.</b>  <small>Note: according to 
 browser cookie implementation rules, you must have at least two dots in 
 the name of the host for cookies to work properly for domains such as 
 .com, .org, .net, etc.<BR>
-(ex: <b>http://$ENV{'SERVER_NAME'}/cgi-bin/store/agora.cgi</b>)
+(ex: <b>http://$ENV{'SERVER_NAME'}/store/agora.cgi</b>)</small>
 </TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2>
-<INPUT NAME="sc_store_url" TYPE="TEXT" SIZE=66 
-MAXLENGTH="128" VALUE="$sc_store_url"><br><b>Store URL</b>
+<TD COLSPAN=4><br>
+<b>Store URL</b>: <INPUT NAME="sc_store_url" TYPE="TEXT" SIZE=60 
+MAXLENGTH="128" VALUE="$sc_store_url">
 </TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2><br>
-<INPUT NAME="sc_ssl_location_url2" TYPE="TEXT" SIZE=66 
-MAXLENGTH="128" VALUE="$sc_ssl_location_url2"><br><b>SSL URL</b><br><small>Leave blank if not using SSL<br>. Shared SSL hosting, enter the SSL URL in form of: https://www.SSLserverURLhere.com/pathtoStoreHere/agora.cgi.   If SSL runs under your domain name, then enter the SSL URL inthe form of:  https://www.yourDomanNameHere.com/cgi-bin/store/agora.cgi</small>
+<TD COLSPAN=4><br>
+<b>SSL URL</b>: <INPUT NAME="sc_ssl_location_url2" TYPE="TEXT" SIZE=60 
+MAXLENGTH="128" VALUE="$sc_ssl_location_url2"><br><small>Leave blank if not using SSL<br>. Shared SSL hosting, enter the SSL URL in form of: https://www.SSL-server-URL-here.com/~accountname/directory-of-store/agora.cgi.  (Make sure this URL matches what your hosting provider issued to you.)   If SSL runs under your domain name (you bought an SSL certificate), then enter the SSL URL in the form of:  https://www.yourDomanNameHere.com/directory-of-store/agora.cgi</small>
 </TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2><br><HR></TD>
+<TD><br></TD>
+</TR>
+<TR>
+<TD COLSPAN=4 bgcolor=#99CC99><center><font face="Arial, Helvetica, sans-serif" size=+2><b>Order Logging / Confirmation Emails Section</b></font></center></TD>
+</TR>
+<TR>
+<TD><br></TD>
 </TR>
 
 <TR>
-<TD>Do you wish to have orders e-mailed to you?</TD>
-<TD><SELECT NAME="email_orders_yes_no">
+<TD colspan=2><b>Do you wish to have orders e-mailed to you?</b><br><small>NOTE: some hosting services may require that the email addresses your scripts use to be on the same domain and/or server for security and anti-spamming purposes.  Basically, this means that your store and confirmation emails might need to be on the same server and/or hosting account.  If this is the case, setup a forwarding address on your hosting account / domain name to forward order confirmations to the external email address you wish to use and then enter that "forwarder" email address here.</small></TD>
+<TD colspan=2><SELECT NAME="email_orders_yes_no">
 <OPTION>$sc_send_order_to_email</OPTION>
 <OPTION>yes</OPTION>
 <OPTION>no</OPTION>
 </SELECT></TD></TR>
-<tr><td colspan=2>Email Address to use: <INPUT 
+<tr><td colspan=4>Email Address to use: <INPUT 
 NAME="email_address_for_orders" TYPE="TEXT" 
 VALUE="$sc_first_order_email" SIZE="48">
 </TD>
 </TR>
 <TR>
-<TD>Do you wish to have orders e-mailed to a second email address?<br><small>NOTE: some hosting services may requie both email addresses to be to the same domain for security and anti-spamming purposes.  If this is the case, setup a forwarding address on the same domain name to forward orders to the email address you need to use.</small></TD>
-<TD><SELECT NAME="second_email_orders_yes_no">
+<TD COLSPAN=4><BR></TD>
+</TR>
+<TR>
+<TD colspan=2><b>Do you wish to have orders e-mailed to a second email address?</b><br><small>NOTE: see note above for primary confirmation email address.</small></TD>
+<TD colspan=2><SELECT NAME="second_email_orders_yes_no">
 <OPTION>$sc_second_send_order_to_email</OPTION>
 <OPTION>yes</OPTION>
 <OPTION>no</OPTION>
 </SELECT></TD></TR>
-<tr><td colspan=2>Email Address to use: <INPUT 
+<tr><td colspan=4><b>Email Address to use:</b> <INPUT 
 NAME="second_email_address_for_orders" TYPE="TEXT" 
 VALUE="$sc_second_order_email" SIZE="48">
 </TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2><HR></TD>
+<TD COLSPAN=4><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=4>
+<b>Enter the e-mail address of your webmaster or administrator here</b><br><small>NOTE: Must be on same server and/or hosting account as store resides (same domain name or a parked domain name). If one does not exist, create a forwarded admin email address for your store in your hosting account control panel.</small>
+</TD>
+
+<TR>
+<TD COLSPAN="2">
+<INPUT NAME="admin_email" TYPE="TEXT" VALUE="$sc_admin_email" SIZE="55">
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=4><HR></TD>
 </TR>
 
 <TR>
 <TD COLSPAN=2>
-<table width="100%"><tr>
-<td>Do you wish to have the orders written to a log file?</td>
-<td><SELECT NAME="log_orders_yes_no">
-<OPTION>$sc_send_order_to_log</OPTION>
+<b>Do you wish to use dynamic email subjects?</b><br><small>Advanced Feature. Some add-ons require this to be set to YES.  Default is NO.  Test and check emails prior to going live with this feature to ensure it does what you expect.</small></td>
+<td colspan=2><SELECT NAME="sc_use_dynamic_email_subjects">
+<OPTION>$sc_use_dynamic_email_subjects</OPTION>
 <OPTION>yes</OPTION>
 <OPTION>no</OPTION>
 </SELECT></td></tr>
-<tr><td>Choose a unique name for your log file.<br> (ex: "mylog3218.log")</TD>
-<TD>
-<INPUT NAME="name_of_the_log_file" TYPE="TEXT" VALUE="$sc_order_log_name">
-</TD>
-</tr></table></td>
+
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD COLSPAN=4 bgcolor=#99CC99 align=center><font face="Arial, Helvetica, sans-serif" size=+2><b>Misc Main Settings Section</b></font></TD>
+</TR>
+<TR>
+<TD><br></TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2><HR></TD>
+<TD colspan=2><b>How long do you wish to keep pevious cart contents (and server side cookies) for non-finalized orders?</b>. <small>This is the record of what was added to the cart, as well as other info such as the cart ID, in case a payment is delayed and/or the customer wishes to come back later and resume shopping.  These files are automagically deleted once the order is completed or the time set for expiration of these customer cart files is reached.  Default is is 1 day.  If using a payment gateway that reports back pending payments at a later date/time (such as authorizations only, ACH payments, eChecks, and/or PayPal IPN), set this to a suggested time of 5 days.  Fractional days acceptable as well, such as .25 (6 hours), .5 (12hours), 1.75 (1 day and 18 hours), etc.  Warning: do not exceed 7 days if your site is very busy.</small></TD>
+<TD colspan=2>
+<INPUT NAME="sc_number_days_keep_old_carts" TYPE="TEXT" 
+VALUE="$sc_number_days_keep_old_carts" SIZE="10" maxlength="10"></TD>
 </TR>
 
 <TR>
-<TD COLSPAN="2">
-Enter the e-mail address of your webmaster or administrator here
-</TD>
+<TD COLSPAN=4><HR></TD>
+</TR>
 
 <TR>
-<TD COLSPAN="2">
-<INPUT NAME="admin_email" TYPE="TEXT" VALUE="$sc_admin_email" SIZE="55">
+<TD colspan=2><b>Do you wish to log unique accesses to your store?</b>. <small>Default is yes.  Setting to "no" will disable the menu item as well.  To see the results of this setting in the manager menus at the top of each page, reload a page after saving these settings. <b>Speed Enhancement:</b> Your store will run faster with this set to no.</small></TD>
+<TD colspan=2><SELECT NAME="sc_shall_i_log_accesses">
+<OPTION>$sc_shall_i_log_accesses</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=4><HR></TD>
+</TR>
+
+<TR>
+<TD colspan=4>
+if using an affiliate program, <b>Enter your image call info</b>:
+<br><small>in the form of: locationURLtoImage?ordertotal=AMOUNT&unique=UNIQUE&otherneededinfo .  edit as needed.  do not enter: &lt;IMG SRC="https:// or the "
+BORDER=0&gt; portions of the image call as those are added automatically. For the total, AMOUNT will be substituted by the cart with the subtotal before taxes and shipping.  If you need a different amount or total, such as from the profit tracker add-on, you will need to edit the order library file for your gateway(s) directly.  For the UNIQUE portion, the invoice number will be used by the cart automatically.  Also add whatever else is needed by your affiliate program for the image call.</small><br>
+<SELECT NAME=sc_http_affiliate_call>
+<option>$sc_http_affiliate_call</option>
+<option>http</option>
+<option>https</option>
+</SELECT>&nbsp;&nbsp;&nbsp;
+tag info: <INPUT NAME="sc_temp_affiliate_call" TYPE="TEXT" SIZE=45 
+MAXLENGTH="225" VALUE="$sc_temp_affiliate_call">
 </TD>
+</TR>
 
+<TR>
+<TD COLSPAN=4><HR></TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2><HR></TD>
+<td colspan=2><br><b>Advanced Feature Only & Beta/Experimental</b>:<br><b>Running an SSI store?</b>  If using Server Side Includes to execute 
+the store, you will need meta cookies too! &nbsp; For normal operation 
+choose NO. If not sure, leave at NO or your customers will loose their cart contents <small>... and ... your store will blow up, your house will shake to pieces, you will wake up tomorrow bald as a hippo, and the little children in your neighborhood will cry without knowing why.</small></td>
+<TD colspan=2><SELECT NAME=running_an_SSI_store>
+<OPTION>$sc_running_an_SSI_store</OPTION>
+<OPTION>yes</OPTION> 
+<OPTION>no</OPTION> 
+</SELECT></TD>
 </TR>
 
 <TR>
-<TD>How many products do you wish to display on each product page?<br>
-(May override this by setting the URL/Form variable maxp=nn)</td>
-<TD>
-<INPUT NAME="sc_db_max_rows_returned" TYPE=TEXT SIZE=4 
-  VALUE="$sc_db_max_rows_returned">
-</TD>
-</TD>
+<TD COLSPAN=4><HR></TD>
+</TR>
+
+<TR>
+<td colspan=2><b>Use meta cookies instead of pre-content header style cookies?</b>  <small>Leave at "no" unless you know how to use this feature</small></td>
+<TD colspan=2><SELECT NAME=use_meta_cookies>
+<OPTION>$sc_use_meta_cookies</OPTION>
+<OPTION>yes</OPTION> 
+<OPTION>no</OPTION> 
+</SELECT></TD>
 </TR>
 
+
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD COLSPAN=4 bgcolor=#99CC99 align=center><font face="Arial, Helvetica, sans-serif" size=+2><b>Security Section</b></font></TD>
+</TR>
 <TR>
-<TD COLSPAN=2><HR></TD>
+<TD><br></TD>
 </TR>
 
 <TR>
-<TD>Do you wish to verify orders with the database info?  Say "no" 
-if running an HTML-based store without a database or adding to the cart from non-agora.cgi parsed pages. NOTE: links to cart and database still need to come from the same domain name as AgoraCart runs from</TD>
-<TD><SELECT NAME="sc_order_check_db">
+<TD colspan=2><b>Do you wish to verify orders with the database info?</b>  <small>Say "no" 
+if running an HTML-based store without a database or adding to the cart from non-agora.cgi parsed pages. NOTE: links to cart and database still need to come from the same domain name as AgoraCart runs from</small></TD>
+<TD colspan=2><SELECT NAME="sc_order_check_db">
 <OPTION>$sc_order_check_db</OPTION>
 <OPTION>yes</OPTION>
 <OPTION>no</OPTION>
@@ -519,56 +778,78 @@
 </TR>
 
 <TR>
-<TD COLSPAN=2><HR></TD>
+<TD COLSPAN=4><HR></TD>
 </TR>
 
 <TR>
-<TD>How do you want to generate database based html product pages?  <small>Default is "maybe" which allows you to generate database product pages unless a specific ppinc page is specified.  "No" will allow you to only generate pages from the products in the database.  Say "yes" if running an HTML-based store and you are not using a database. NOTE: links to cart and database still need to come from the same domain name as AgoraCart runs from.</small></TD>
-<TD><SELECT NAME="sc_use_html_product_pages">
-<OPTION>$sc_use_html_product_pages</OPTION>
+<td colspan=2><b>Use Verified Option Values?</b>  <small>For security reasons it is a good idea to say YES here.  This will check options (pricing and names) on products ordered against the values found in the actual options file that is listed with the product in the database. If you use dynamic options (those files built via dynamically with multiple files), then set this to NO.  NOTE: this feature currently does not verify the more advanced variable options.</small></td>
+<TD colspan=2><SELECT NAME=sc_use_verified_opt_values>
+<OPTION SELECTED>$sc_use_verified_opt_values</OPTION>
 <OPTION>yes</OPTION>
-<OPTION>no</OPTION>
-<OPTION>maybe</OPTION>
+<OPTION>no</OPTION> 
+</SELECT></TD>
+</TR>
+<TR>
+<TD COLSPAN=4><BR></TD>
+</TR>
+<TR>
+<td colspan=2><b>Prevent Negative Priced Options?</b>  <small>For security reasons it is a good idea
+to say YES here. This will disallow negative priced options.  If having problems with variable option discounts, set to NO</small></td>
+<TD colspan=2><SELECT NAME=sc_negative_priced_options>
+<OPTION SELECTED>$sc_negative_priced_options</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION> 
+</SELECT></TD>
+</TR>
+<TR>
+<TD COLSPAN=4><BR></TD>
+</TR>
+<TR>
+<td colspan=2><b>Turnoff Variable Options?</b>  <small>If you are not using Variable Options, then set to YES. This will increase the speed and security of your store if disabled (set to yes).  These are different than standard options listed above that are used by most users.   Variable options allow for discount or volume pricing, per an individual product, as well as other advanced option capabilites, but requires AgoraScript/Perl coding and manual edits/customization of the individual product option files.  Default is NO, which enables the use of variable options.</small></td>
+<TD colspan=2><SELECT NAME=sc_disable_variable_options>
+<OPTION SELECTED>$sc_disable_variable_options</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION> 
 </SELECT></TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2><HR></TD>
+<TD COLSPAN=4><BR></TD>
 </TR>
 <TR>
-<TD>How do you want to the customer to view the cart contents after adding an item to the cart?  Default is "no" which takes the customer back to the database generated product page they were originally at with a thank you message generated towards the top of the page.  Say "yes" if running an HTML-based store and you DO NOT want to the customer to go to a database generated product page.</TD>
-<TD><SELECT NAME="sc_should_i_display_cart_after_purchase">
-<OPTION>$sc_should_i_display_cart_after_purchase</OPTION>
+<td colspan=2><b>Allow more than one instance of an Option File loaded per product with %%Load_Option_file%% tokens?</b> (aka nested option loading) <small>This is an Advanced Feature. Default is NO.  If you have numerous option files that share common elements, setting this to YES will allow you to load the option file more than once per product using <b>%%Load_Option_file option-file-name.html%%</b> within the already called option files.  The error indicator will look like: <b>(reload of option graphicSelect.html attempted!)</b> where the option file would be expected to be displayed.  This error means that you are trying to load the option files inside of one another. If unsure how this works, leave at NO as it is not recommended unless absolutely necessary for more complex stores.</small></td>
+<TD colspan=2><SELECT NAME=sc_enable_multi_load_option_files>
+<OPTION SELECTED>$sc_enable_multi_load_option_files</OPTION>
 <OPTION>yes</OPTION>
-<OPTION>no</OPTION>
+<OPTION>no</OPTION> 
 </SELECT></TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2><HR></TD>
+<TD COLSPAN=4><HR></TD>
 </TR>
 
 <TR>
-<td>Use 0077 umask?  For security reasons it is a good idea
+<td colspan=2><b>Use 0077 umask?</b>  <small>(NOTE: Most installs of the cart can skip this setting and leave it at NO.)  For security reasons it is a good idea
 to say yes here if the cgi scripts on your Unix host 
-run under your own id.</td>
-<TD><SELECT NAME=sc_set_0077_umask>
+run under your own id.  If you are having problems with files not deleting or being read (cart files, cart cookies, order files, etc), then set to NO.  If you setup your cart via a control panel (Cpanel) or it is based on a Linux operating system, then leave at the default of NO, as your system admin may have already set your file access  "rights" correctly.</small></td>
+<TD colspan=2><SELECT NAME=sc_set_0077_umask>
 <OPTION SELECTED>$sc_set_0077_umask</OPTION>
 <OPTION>$sc_other_0077</OPTION> 
 </SELECT></TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2><HR></TD>
+<TD COLSPAN=4><HR></TD>
 </TR>
 
 <TR>
-<td>Scramble CC Info?&nbsp; This option scrambles the CC info that
+<td colspan=2><b>Scramble CC Info?</b> <small> This option scrambles the CC info that
 is stored on disk temporarily in the VERIFY files in Offline and other
-gateways that take CC info on your server.  Set to yes unless you have
-trouble with blank CC numbers in confirmation emails and you are
-sure that the VERIFY files are safe from prying eyes.</td>
-<TD><SELECT NAME=scramble_cc_info>
+gateways that take CC info on your server.  Set to YES unless you have
+trouble with blank CC numbers in confirmation emails <b>and</b> you are
+sure that the VERIFY files are safe from prying eyes.</small></td>
+<TD colspan=2><SELECT NAME=scramble_cc_info>
 <OPTION>$sc_scramble_cc_info</OPTION>
 <OPTION>yes</OPTION> 
 <OPTION>no</OPTION> 
@@ -576,11 +857,11 @@
 </TR>
 
 <TR>
-<TD COLSPAN=2><HR></TD>
+<TD COLSPAN=4><HR></TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2>
+<TD COLSPAN=4>
 <CENTER>
 <INPUT TYPE="HIDDEN" NAME="system_edit_success" VALUE="yes">
 <INPUT NAME="ChangeMainSettings" TYPE="SUBMIT" VALUE="Submit">
@@ -591,7 +872,7 @@
 </TR>
 
 <TR>
-<TD COLSPAN=2>
+<TD COLSPAN=4>
 <HR>
 </TD>
 </TR>
@@ -604,4 +885,31 @@
 print &$manager_page_footer;
 }
 #######################################################################################
+sub update_mainmisc_settings {
+  local($item,$stuff) = @_;
+  $mainmisc_file_settings{$item} = $stuff;
+local($mainmisc_settings) = "$mgrdir/misc/mgr_miscmain.pl";
+  local($item,$zitem);
+
+  &get_file_lock("$mainmisc_settings.lockfile");
+  open(MAINFILE,">$mainmisc_settings") || &my_die("Can't Open $mainmisc_settings");
+  foreach $zitem (sort(keys %mainmisc_file_settings)) {
+    $item = $zitem;
+     print (MAINFILE $mainmisc_file_settings{$zitem});
+   }
+  close(MAINFILE);
+  &release_file_lock("$mainmisc_settings.lockfile");
+ }
+#######################################################################################
+sub save_userlog_settings {
+ local($item) = @_;
+  local($userlog_settings) = "./admin_files/agora_userlog_lib.pl";
+
+  &get_file_lock("$userlog_settings.lockfile");
+  open(LOGSETTINGS,">$userlog_settings") || &my_die("Can't Open $userlog_settings");
+    print (LOGSETTINGS $item);
+  close(LOGSETTINGS);
+  &release_file_lock("$userlog_settings.lockfile");
+ }
+#######################################################################################
 1; # Library
diff -ruN 4.0K-4b/protected/manager.cgi 5.0.000/protected/manager.cgi
--- 4.0K-4b/protected/manager.cgi	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/protected/manager.cgi	2006-10-31 09:40:27.000000000 -0600
@@ -1,85 +1,70 @@
 #!/usr/bin/perl -T
-require 5.001; 
-$ENV{'PATH'}="/bin:/usr/bin";
+$ENV{'PATH'}="/bin:/usr/bin"; 
 
-############################################################
-# Manager Program for AgoraCart                            #
 #################################################################
-# do not edit below this line 				#
+# do not edit below this line         #
 #################################################################
-
 $mgrdirname = "protected";
 $mgrdir = "./$mgrdirname";
 if ((-f "./wrap_mgr.o") && (!($ARGV[0] =~ /nowrap/i))) {
   print `./wrap_mgr.o`;
   &call_exit;
  }
-
-$versions{'manager'}="4.0K-4b Standard";
+$versions{'manager.cgi'}="5.0.000";
 $manager_program_running = "yes";
-chdir("..");
+chdir(".."); 
 &setup_manager;
-
 eval('require "./library/http-lib.pl"');
 if ($@ eq "") {
   $http_lib_ok = "yes";
  } else {
   $http_lib_ok = "no";
  }
-
 &get_required_config;
-
 &require_supporting_libraries(__FILE__,__LINE__,
   "./library/cgi-lib.pl",
-  "./library/agora.setup.db");
+  "./library/agora.setup.db",
+  "./admin_files/agora_user_lib.pl"); 
+#added by Mister Ed October 2005
+$scm_order_logpath = "./log_files/orders";
 &require_supporting_libraries(__FILE__,__LINE__,
   "$sc_db_lib_path",
   "./library/shipping_lib.pl",
   "./library/cookie-lib.pl",
   "$mgrdir/misc/mgr_pass.pl",
+  "$mgrdir/misc/mgr_miscmain.pl",
   "$mgrdir/store_admin_html.pl",
   "$mgrdir/store_admin_actions.pl");
-
 &load_store_settings;
 &load_custom("$mgrdir",'-ext_lib.pl');
 &load_custom("$mgrdir",'-ext_editor_lib.pl');
 &load_custom("./library",'-mgr_lib.pl');
 &load_custom("$mgrdir/custom",'');
-
 &setup_login_check;
-
-# Read in form data
-
-if ($mc_file_upload_ok =~ /yes/) {           
+if ($mc_file_upload_ok =~ /yes/) { 
   $cgi_lib::writefiles = "./shopping_carts"; 
  }
-
 &ReadParse(\%in, \%in_name, \%in_type, \%in_server_name);
-
+#added by Mister Ed October 2005
+&set_log_years_months;
+ ($scm_day,$scm_month,$scm_year) = &get_month_year;
 if ($mc_file_upload_ok =~ /yes/) { 
   &handle_uploaded_files;
  }
-
 if ($in{'picserve'} ne "") { 
   &serve_picture($in{'picserve'},"$mgrdir/images/");
   &call_exit;
  }
-
 print "Content-type: text/html\n\n";
-print '<meta http-equiv=P3P content=CP=NOI CUR OUR NOR">' . "\n";  
-
+print qq~<meta http-equiv="P3P" content='CP="NOI CUR OUR NOR"'>\n~;  
 &$menu_item_init;
-
 if ($in{'login'} ne "") 
  {
   &action_process_login;
  }
-
-
 if (-M "$ip_file" > ".1")
  {
   unlink ("$ip_file");
- # delete old login files
   opendir(USER_LOGINS, "$ip_file_dir"); 
   @myfiles = grep(/\.login/,readdir(USER_LOGINS)); 
   closedir (USER_LOGINS);
@@ -94,7 +79,6 @@
   &display_login;
   &call_exit;
  }
-
 if (-e "$ip_file")
 {
   eval('require "$ip_file";');
@@ -106,14 +90,11 @@
     &update_ip_ok;
    }
 } 
-
-
 else
 {
 &display_login;
 &call_exit;
 }
-
 foreach $menu_item (sort(keys %menu_items)) {
   if ($in{$menu_item} ne "") {
    $menu_to_run = $menu_items{$menu_item};
@@ -121,45 +102,37 @@
    &call_exit;
   }
  }
-
 &welcome_screen;
 &call_exit;
-
 #*********************************************************************
 sub setup_manager {
-
  $sysname = $ENV{'SERVER_NAME'};
  $mc_gateways = ""; 
  $mc_file_upload_ok = "yes"; 
  $mc_assign_final_sku_at_update = "yes"; 
  $mc_max_top_menu_items = 6;
-
  $commando_ok = "no"; 
  if (-f "$mgrdir/commando.ok") {
    $commando_ok = "yes"; 
   }
-
  $other_welcome_message = "";
- $mc_standard_body_tag = 'BGCOLOR="WHITE"';
-# $mc_standard_body_tag = 'BGCOLOR="#FFFFE0" TEXT="BLUE"';
+ $mc_standard_body_tag = '';
  $manager_page_header = "std_manager_header_code";
  $manager_page_footer = "std_manager_footer_code";
  $manager_process_login = "std_action_process_login";
  $manager_welcome_screen = "std_welcome_screen";
-
  $menu_item_init = "init_convert_menu_item";
-
  $menu_items{'welcome_screen'} = "welcome_screen";
  $menu_items{'error_log'} = "display_error_log";
  $menu_items{'clear_error_log'} = "clear_error_log";
+ $menu_items{'clear_access_log'} = "clear_access_log";
  $menu_items{'order_log'} = "display_order_log";
- $menu_items{'clear_order_log'} = "clear_order_log";
  $menu_items{'change_settings_screen'} = "change_settings_screen";
+$menu_items{'order_management_settings_screen'} = "order_management_settings_screen";
+$menu_items{'merchandising_tools_settings_screen'} = "merchandising_tools_settings_screen";
  $menu_items{'tracking_screen'} = "tracking_screen";
  $menu_items{'htaccess_screen'} = "setup_htaccess_screen";
-  
  $menu_items{'htaccessSettings'} = "action_htaccess_settings";
- 
  if ($commando_ok =~ /yes/i) {
    $menu_items{'commando'} = "action_commando";
   }
@@ -176,23 +149,39 @@
   $store_settings_link{$sortname}=$linkname;
  }
 #*********************************************************************
+sub add_merchtools_settings_choice {
+  local ($sortname,$displayname,$linkname) = @_;
+  local ($continue) = "";
+  &codehook("add-settings-choice");
+  if ($continue eq "no") { return;}
+  $sortname =~ tr/A-Z/a-z/;
+  $merchtools_settings_name{$sortname}=$displayname;
+  $merchtools_settings_link{$sortname}=$linkname;
+ }
+#*********************************************************************
+sub add_ordermanage_settings_choice {
+  local ($sortname,$displayname,$linkname) = @_;
+  local ($continue) = "";
+  &codehook("add-settings-choice");
+  if ($continue eq "no") { return;}
+  $sortname =~ tr/A-Z/a-z/;
+  $ordermanage_settings_name{$sortname}=$displayname;
+  $ordermanage_settings_link{$sortname}=$linkname;
+ }
+#*********************************************************************
 sub require_supporting_libraries
 {
-
 local ($file, $line, @require_files) = @_;
 local ($require_file);
 &request_supporting_libraries("warn exit",$file, $line, @require_files);
-}
-
+} 
 sub request_supporting_libraries
 {
-
 local ($what_to_do_on_error, $file, $line, @require_files) = @_;
 local ($require_file);
-
 foreach $require_file (@require_files)
-{
-if (-e "$require_file" && -r "$require_file")
+{ 
+if (-e "$require_file" && -r "$require_file") 
 { 
 $result = eval('require "$require_file"'); 
 if ($@ ne "") {
@@ -211,10 +200,8 @@
   }
  }
 }
-
 else
 {
-
  if($what_to_do_on_error =~ /warn/i) {
   if ($error_header_done ne "yes") {
      $error_header_done = "yes";
@@ -225,8 +212,6 @@
 path correct and that the permissions are set so that I have
 read access?  Thank you.";
   }
-
-
  if($what_to_do_on_error =~ /exit/i) {
    &call_exit;
   }
@@ -243,7 +228,8 @@
 ########################################################################
 sub handle_uploaded_files{
   $save_umask_value = umask;
-  if ($original_umask ne '') { umask $original_umask;}
+  if (($original_umask eq '') || ($save_umask_value =~ /18|63/)) { umask 0022;}
+  else { umask $original_umask;}
   codehook("mgr_upload_files_prep");
   &handle_uploaded_single_file('upfile1');
   &handle_uploaded_single_file('upfile2');
@@ -251,6 +237,10 @@
   &handle_uploaded_single_file('upfile4');
   &handle_uploaded_single_file('upfile5');
   &handle_uploaded_single_file("upfile6");
+  &handle_uploaded_single_file("upfile7");
+  &handle_uploaded_single_file("upfile8");
+  &handle_uploaded_single_file("upfile9");
+  &handle_uploaded_single_file("upfile10");
   umask $save_umask_value;
  }
 ########################################################################
@@ -258,7 +248,6 @@
 local($zname)=@_;
 local ($my_img_file,$junk)="";
 local ($file_has_contents)=0;
-
 if (-f $in{$zname}) { 
   open(IMGFILE, "$in{$zname}");
   $file_has_contents = read(IMGFILE,$junk,100);  
@@ -284,11 +273,11 @@
 sub last_part_of_filename {
   local ($name) = @_;
   local (@my_items);
-  $name =~ s/\\/\//g; # make all slashes be the / variety
+  $name =~ s/\\/\//g; 
   @my_items = split(/\//,$name);
   return $my_items[$#my_items];
 }
-#######################################################################
+######################################################################
 sub codehook{
   local($hookname)=@_;
   local($codehook,$err_code,@hooklist);
@@ -297,7 +286,7 @@
     foreach $codehook (@hooklist) {
       eval("&$codehook;");
       $err_code = $@;
-      if ($err_code ne "") { 
+      if ($err_code ne "") { #script died, error of some kind
         &update_error_log("code-hook $hookname $codehook $err_code","","");
        }
      }
@@ -321,28 +310,36 @@
   open(CONFIG,"./admin_files/agora_user_lib.pl");
   @cfglines = <CONFIG>;
   close(CONFIG);
-
   @lines = grep(/\$sc_prod_db_pad_length/,@cfglines);
-  $str = $lines[0];
+  $str = $lines[0]; 
   chomp($str);
-  $str =~ /([^\xFF]*)/;# un-taint it
+  $str =~ /([^\xFF]*)/;
   $str = $1;
   eval($str);
-
    @lines = grep(/\$sc_database_lib/,@cfglines);
-  $str = $lines[0];
+  $str = $lines[0]; 
   chomp($str);
-  $str =~ /([^\xFF]*)/;
+  $str =~ /([^\xFF]*)/; # un-taint it
   $str = $1;
   eval($str);
   if ($sc_database_lib eq "") {
     $sc_database_lib = "agora_db_lib.pl";
    }
-
   $mc_path_for_cookie = "";
   $mc_domain_name_for_cookie = "";
+  @lines = grep(/\$mc_path_for_cookie/,@cfglines);
+  $str = $lines[0];
+  chomp($str);
+  $str =~ /([^\xFF]*)/;
+  $str = $1;
+  eval($str);
+  @lines = grep(/\$mc_domain_name_for_cookie/,@cfglines);
+  $str = $lines[0];
+  chomp($str);
+  $str =~ /([^\xFF]*)/;# un-taint it
+  $str = $1;
+  eval($str);
  }
-
 #######################################################################
 sub load_custom{
 local($zdir,$ztext)=@_;
@@ -350,7 +347,6 @@
 opendir(USER_LIBS, "$zdir");
 @mylibs = sort(readdir(USER_LIBS));
 closedir (USER_LIBS);
-
 foreach $zlib (@mylibs) {
   $lib = $zlib;
   $lib =~ /([\w\-\=\+]+)(\.pl)/i;
@@ -380,9 +376,9 @@
     if ($cookie{'agoramgr'} eq '') {
       $cookie{'agoramgr'} = &make_random_chars;
       &set_cookie(-1,
-	$mc_domain_name_for_cookie,
-	$mc_path_for_cookie,
-	"");
+  $mc_domain_name_for_cookie,
+  $mc_path_for_cookie,
+  "");
       $mc_have_cookie = "no";
       $ip_file = "$ip_file_dir/$a_unique_name.pl";
      } else {
@@ -405,13 +401,10 @@
 }
 #######################################################################
 sub update_error_log {
-	
 local ($type_of_error, $file_name, $line_number) = @_;
 local ($log_entry, $email_body, $variable, @env_vars);
-
 @env_vars = sort(keys(%ENV));
 $date = &get_date;
-
 if ($sc_debug_mode eq "yes")
 {
 if ($sc_header_printed ne 1) {
@@ -420,53 +413,42 @@
    }
   print $sc_browser_header;
  }
-
 local($browser_text) = $type_of_error;
 $browser_text =~ s/\|/\<br\>\n/g;
 $browser_text =~ s/\</\&lt;/g;
 $browser_text =~ s/\>/\&gt;/g;
-
 print '<DIV ALIGN=LEFT><TABLE WIDTH=500><TR><TD>' . "\n<PRE>";
 print "ERROR:$browser_text<br>",
       "FILE: $file_name<br>",
       "LINE: $line_number<BR>\n";
 print '</PRE></TD></TR></TABLE></DIV>' . "\n";
-
 }
-
 if (($sc_shall_i_log_errors =~ /yes/i) ||
     ($sc_shall_i_log_errors eq ''))
 {
-
 $log_entry = "MGR: $type_of_error\|FILE=$file_name\|LINE=$line_number\|";
 $log_entry .= "DATE=$date\|";
 
 &get_file_lock("$sc_error_log_path.lockfile");
 open (ERROR_LOG, ">>$sc_error_log_path") || &CgiDie ("The Error Log could not be opened");
-
 foreach $variable (@env_vars)
-
 {
 $log_entry .= "$variable: $ENV{$variable}\|";
 }  
-
 $log_entry =~ s/\n/<br>/g; # do not want newlines!
 print ERROR_LOG "$log_entry\n";
 close (ERROR_LOG);  
-
 &release_file_lock("$sc_error_log_path.lockfile");
-
 }
-
 }
 ######################################################################
 sub get_date {
 local (@days, @months); 
 local ($connector) = ' at ';
 @days = ('Sunday','Monday','Tuesday','Wednesday','Thursday', 'Friday',
-	'Saturday');
+  'Saturday');
 @months = ('January','February','March','April','May','June','July',
-	   'August','September','October','November','December');
+     'August','September','October','November','December');
 return &get_date_engine;
 }
 
@@ -475,43 +457,51 @@
 local ($connector) = ' ';
 @days = ('Sun','Mon','Tue','Wed','Thu', 'Fri', 'Sat');
 @months = ('Jan','Feb','Mar','Apr','May','Jun',
-	'Jul','Aug','Sep','Oct','Nov','Dec');
+  'Jul','Aug','Sep','Oct','Nov','Dec');
 return &get_date_engine;
 }
 
 sub get_date_engine
 {
-
 local ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst,$date);
-
 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
-
 if ($hour < 10) 
-
 { 
 $hour = "0$hour"; 
 }
-
 if ($min < 10) 
-
 { 
 $min = "0$min"; 
 }
-
 if ($sec < 10) 
-
 {
 $sec = "0$sec"; 
 }
-
 $year += 1900;
 $date = "$days[$wday], $months[$mon] $mday, $year" .
-	$connector . "$hour\:$min\:$sec";
-
+  $connector . "$hour\:$min\:$sec";
 return $date;
+}
 
-}       
 
+sub get_month_year {
+local (@days, @months); 
+local ($connector) = ' at ';
+@days = ('Sunday','Monday','Tuesday','Wednesday','Thursday', 'Friday',
+  'Saturday');
+@months = ('January','February','March','April','May','June','July',
+     'August','September','October','November','December');
+return &get_monthyear_engine;
+}
+
+sub get_monthyear_engine {
+my ($sec,$min,$hour,$mday,$mon,$wday,$yday,$isdst);
+my ($month,$year);
+($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
+$year += 1900;
+$month = "$months[$mon]";
+return ($mday,$month,$year);
+}   
 #######################################################################
 sub call_exit {
   codehook("cleanup_before_exit");
diff -ruN 4.0K-4b/protected/misc/featuredproduct.pl 5.0.000/protected/misc/featuredproduct.pl
--- 4.0K-4b/protected/misc/featuredproduct.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/protected/misc/featuredproduct.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1 @@
+ac_left_links|00001|sm_0009.gif|Perl for Newbies|5.000|This is the short description.  In fact this description is really short.|
diff -ruN 4.0K-4b/protected/misc/mgr_css.pl 5.0.000/protected/misc/mgr_css.pl
--- 4.0K-4b/protected/misc/mgr_css.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/protected/misc/mgr_css.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,4 @@
+$mc_template_css_at_root = "no";
+$mc_levels_to_root = "0";
+$mc_additional_head_info = qq~~;
+$mc_css_row_count = "30";
diff -ruN 4.0K-4b/protected/misc/mgr_miscmain.pl 5.0.000/protected/misc/mgr_miscmain.pl
--- 4.0K-4b/protected/misc/mgr_miscmain.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/protected/misc/mgr_miscmain.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,2 @@
+$mc_images_dir = "./html/images";
+$mgr_shall_i_log_accesses = "yes";
diff -ruN 4.0K-4b/protected/misc/mgr_pass.pl 5.0.000/protected/misc/mgr_pass.pl
--- 4.0K-4b/protected/misc/mgr_pass.pl	2005-12-01 08:27:09.000000000 -0600
+++ 5.0.000/protected/misc/mgr_pass.pl	2006-10-31 09:45:48.000000000 -0600
@@ -1,5 +1,4 @@
-$username="[% username %]";
-$password="[% password %]";
+$username = "[% username %]";
+$password = "[% password %]";
 $mc_use_cookie_login = "yes";
-$a_unique_name="thisisunique_g7eq.login";
-$mc_images_dir = "./html/images"; # directory for image uploads
+$a_unique_name = "thisisunique_g8eq.login";
diff -ruN 4.0K-4b/protected/misc/ship_admin.pl 5.0.000/protected/misc/ship_admin.pl
--- 4.0K-4b/protected/misc/ship_admin.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/protected/misc/ship_admin.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,13 @@
+$sc_alt_origin_db_counter2 = "";
+$sc_howmanycustomshippingmethods = "4";
+$sc_uspsparcelpost = "yes";
+$sc_uspsprioritymail = "yes";
+$sc_uspsexpressmail = "yes";
+$sc_uspseconomyparcelpost = "yes";
+$sc_uspsairparcelpost = "yes";
+$sc_uspsglobexpmail = "yes";
+$sc_uspsglobexpgardoc = "yes";
+$sc_uspsglobexpgarrnd = "yes";
+$sc_custom_shipping_methodname_string = "Electronic Delivery|Local Delivery|Pickup||";
+$sc_custom_shipping_methoddescrip_string = "Electronic Delivery|Local Delivery|Pickup||";
+1;
diff -ruN 4.0K-4b/protected/misc/userfields.pl 5.0.000/protected/misc/userfields.pl
--- 4.0K-4b/protected/misc/userfields.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/protected/misc/userfields.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,4 @@
+$user2 = "User 2";
+$user3 = "User 3";
+$user4 = "User 4";
+$user5 = "User 5";
diff -ruN 4.0K-4b/protected/password_editor-ext_lib.pl 5.0.000/protected/password_editor-ext_lib.pl
--- 4.0K-4b/protected/password_editor-ext_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/protected/password_editor-ext_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,24 +1,29 @@
 # file ./store/protected/password_editor-ext_lib.pl
 #########################################################################
 #
-# Copyright (c) 2002 K-Factor Technologies, Inc.
+# Copyright (c) 2002 to Date K-Factor Technologies, Inc.
 # http://www.k-factor.net/  and  http://www.AgoraCart.com/
 # All Rights Reserved.
 #
+# Use with permission only with AgoraCart, AgoraCartPro, AgoraSQL, AgoraCartSQL, 
+# or AgoraSuite
+#
 # This software is a separate add-on to an ecommerce shopping cart and 
 # is the confidential and proprietary information of K-Factor Technologies, Inc.  You shall
 # not disclose such Confidential Information and shall use it only in
 # conjunction with the AgoraCart (aka agora.cgi) shopping cart.
 #
-# Requires AgoraCart version 4.0K or above.  Just place this file in the protected directory.
+# Requires AgoraCart version 5.0.0 or above.  Just place this file in the protected directory.
 #
-# K-Factor Technologies, Inc. MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT
+# K-Factor Technologies, Inc. BytePipe, AgoraScript nor any of their employees and/or representatives
+# MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT
 # THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESSED OR IMPLIED,
 # INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
 # OR NON-INFRINGEMENT.
 #
-# K-Factor Technologies, Inc. SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY
+# K-Factor Technologies, Inc., BytePipe, AgoraScript nor any of their employees and/or representatives
+# SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY
 # LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS
 # SOFTWARE OR ITS DERIVATIVES.
 #
@@ -29,42 +34,36 @@
 # such works and/or derivatves.
 #
 # Hosting Companies and other software integrators are encouraged to integrate additional
-# features and add-ons in their Agora offerings, but must receive written permission from from
+# features and add-ons in their AgoraCart offerings, but must receive written permission from from
 # K-Factor Technologies, Inc. in order to distribute this add-on to AgoraCart (aka Agora.cgi).
 #
 ##########################################################################
-$versions{'password_editor'} = "20030306";
+$versions{'password_editor-ext_lib.pl'} = "5.0.000";
 $sc_mgrpassfile="$mgrdir/misc/mgr_pass.pl";
-
 {
  local ($modname) = 'password_editor';
  &register_extension($modname,"Password Manager",$versions{$modname});
  &add_settings_choice("Password Settings"," Password Settings ",
-	"change_Pass_screen");
+  "change_Pass_screen");
  &register_menu('PasswordSettings',"write_Pass_settings",
-	$modname,"Write Password Settings");
+  $modname,"Write Password Settings");
  &register_menu('change_Pass_screen',"display_Pass_screen",
-	$modname,"Display Password Manager");
+  $modname,"Display Password Manager");
 }
 #######################################################################################
 sub write_Pass_settings {
 local($myset)="";
-
 &ReadParse;
-
-
 $myset .= "\$username = \"$in{'username'}\";\n";
 $myset .= "\$password = \"$in{'password'}\";\n";
 $myset .= "\$mc_use_cookie_login = \"$in{'mc_use_cookie_login'}\";\n";
 $myset .= "\$a_unique_name = \"$in{'a_unique_name'}\";\n";
-$myset .= "\$mc_images_dir = \"$in{'mc_images_dir'}\";\n";
 $username = "$in{'username'}";
 $password = "$in{'password'}";
 $mc_use_cookie_login = "$in{'mc_use_cookie_login'}";
 $a_unique_name = "$in{'a_unique_name'}";
-$mc_images_dir = "$in{'mc_images_dir'}";
-
 &update_Pass_settings('$sc_mgrpassfile',$myset);
+&log_out;
   &display_Pass_screen;
  }
 ################################################################################
@@ -72,20 +71,17 @@
 {
 local($filename)="$mgrdir/";
 print &$manager_page_header("Password Editor","","","","");
-
-
-
 print <<ENDOFTEXT;
 <CENTER>
-<HR WIDTH=580>
+<HR>
 </CENTER>
 
 <FORM ACTION="manager.cgi" METHOD="POST">
 <CENTER>
-<TABLE WIDTH=580>
+<TABLE>
 <TR>
-<TD WIDTH=580>
-<FONT FACE=ARIAL>Welcome to the <b>AgoraCart</b>  Store Manager Basic Password Editor.  This area allows you to edit the login information and passwords for your store manager files.  .htaccess protection is still handled separately.  If you wish to and more login users and also allow or turnoff certain management functions for each user, please purchase the multi-manager login add-on found in the AgoraCart.com store.</TD>
+<TD>
+<FONT FACE=ARIAL size=2>Welcome to the <b>AgoraCart</b>  Store Manager Basic Password Editor.  This area allows you to edit the login information and passwords for your store manager files.  .htaccess protection is still handled separately.  If you wish to and more login users and also allow or turnoff certain management functions for each user, please purchase the multi-manager login add-on found in the AgoraCart.com store.<br><br><center><font color=red>You will be logged out automatically when you save these settings</font></center></TD>
 </TR>
 </TABLE>
 </CENTER>
@@ -96,7 +92,7 @@
 {
 print <<ENDOFTEXT;
 <CENTER><br>
-<TABLE WIDTH=580>
+<TABLE>
 <TR>
 <TD>
 <FONT FACE=ARIAL SIZE=2 COLOR=RED>Password File has been 
@@ -112,62 +108,51 @@
 <br>
 <FORM ACTION="manager.cgi" METHOD="POST">
    <div align="center">
-   <table border="0" cellspacing="0" WIDTH=580>
+   <table border="0" cellspacing="0">
 <TR>
-<TD>
-Select a user name.  12 character max.&nbsp;&nbsp;
+<TD><font face=arial size=2>
+Select a user name.  12 characters max.&nbsp;&nbsp;</font>
 
-</TD><TD>
+</TD><TD><font face=arial size=2>
 &nbsp;<INPUT NAME="username" TYPE="TEXT" SIZE=12 
-MAXLENGTH="12" VALUE="$username"><br><br>
+MAXLENGTH="12" VALUE="$username"><br><br></font>
 </TD>
 </TR>
 <TR>
 <TD COLSPAN=2><HR></TD>
 </TR>
 <TR>
-<TD>
-Select a password.  12 character max.&nbsp;&nbsp;
-</TD><TD>
+<TD><font face=arial size=2>
+Select a password.  15 character max.&nbsp;&nbsp;</font>
+</TD><TD><font face=arial size=2>
 &nbsp;<INPUT NAME="password" TYPE="TEXT" SIZE=12 
-MAXLENGTH="12" VALUE="$password"><br><br>
+MAXLENGTH="15" VALUE="$password"><br><br></font>
 </TD>
 </TR>
 <TR>
 <TD COLSPAN=2><HR></TD>
 </TR>
 <TR>
-<TD>
-Do you wish to use manager login cookies?  Requires cookies to be allowed in browser.  Allows up to 2 store manager logins at the same exact time.&nbsp;&nbsp;
-</TD><TD>
+<TD><font face=arial size=2>
+Do you wish to use manager login cookies?  Requires cookies to be allowed in browser.  Allows up to 2 store manager logins at the same exact time.&nbsp;&nbsp;</font>
+</TD><TD><font face=arial size=2>
 &nbsp;
 <SELECT NAME=mc_use_cookie_login>
 <option>$mc_use_cookie_login
 <option>yes
 <option>no
-</SELECT><br><br>
+</SELECT><br><br></font>
 </TD>
 </TR>
 <TR>
 <TD COLSPAN=2><HR></TD>
 </TR>
 <TR>
-<TD>
-Pick a unique name with at least 8 characters even if you are using cookies for the login.  If using the cookies then the system will automatically rotate the name used and will allow multiple logins from different locations simultaneously, but the unique name is used as a backup.
-</TD><TD>
+<TD><font face=arial size=2>
+Pick a unique name with at least 8 characters even if you are using cookies for the login.  If using the cookies then the system will automatically rotate the name used and will allow multiple logins from different locations simultaneously, but the unique name is used as a backup.</font>
+</TD><TD><font face=arial size=2>
 &nbsp;<INPUT NAME="a_unique_name" TYPE="TEXT" SIZE=20 
-MAXLENGTH="20" VALUE="$a_unique_name"><br><br>
-</TD>
-</TR>
-<TR>
-<TD COLSPAN=2><HR></TD>
-</TR>
-<TR>
-<TD>
-because the store can have disk or http directory path for images and manager needs disk path we set this variable here to point to be the disk path to the images directory. 
-</TD><TD>
-&nbsp;<INPUT NAME="mc_images_dir" TYPE="TEXT" SIZE=12 
-MAXLENGTH="25" VALUE="$mc_images_dir"><br><br>
+MAXLENGTH="45" VALUE="$a_unique_name"><br><br></font>
 </TD>
 </TR>
    </table>
@@ -189,7 +174,6 @@
   $pass_file_settings{$item} = $stuff;
 local($pass_settings) = "$mgrdir/misc/mgr_pass.pl";
   local($item,$zitem);
-
   &get_file_lock("$pass_settings.lockfile");
   open(PASSFILE,">$pass_settings") || &my_die("Can't Open $pass_settings");
   foreach $zitem (sort(keys %pass_file_settings)) {
@@ -198,6 +182,8 @@
    }
   close(PASSFILE);
   &release_file_lock("$pass_settings.lockfile");
+&require_supporting_libraries(__FILE__,__LINE__,
+  "$mgrdir/misc/mgr_pass.pl");
  }
 #######################################################################################
 1; # Library
diff -ruN 4.0K-4b/protected/product_edit-ext_lib.pl 5.0.000/protected/product_edit-ext_lib.pl
--- 4.0K-4b/protected/product_edit-ext_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/protected/product_edit-ext_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,41 +1,53 @@
 # file ./store/protected/product_edit-ext_lib.pl
 
-$versions{'product_edit'} = "20010909";
+$versions{'product_edit-ext_lib.pl'} = "5.0.000";
+$sc_userfieldsfile="$mgrdir/misc/userfields.pl";
+&require_supporting_libraries(__FILE__,__LINE__,
+  "$mgrdir/misc/userfields.pl");
 
 {
  local ($modname) = 'product_edit';
  &register_extension($modname,"Product DB Edit",$versions{$modname});
  &register_menu('display_screen',"display_catalog_screen",
-	$modname,"Display Product DB Catalog");
+  $modname,"Display Product DB Catalog");
  &register_menu('add_screen',"add_product_screen",
-	$modname,"Write New Product");
+  $modname,"Write New Product");
  &register_menu('edit_screen',"edit_product_screen",
-	$modname,"Edit Product");
+  $modname,"Edit Product");
  &register_menu('skip_edit_screen',"edit_product_screen",
-	$modname,"BASE -- needed if editing products");
+  $modname,"BASE -- needed if editing products");
  &register_menu('delete_screen',"delete_product_screen",
-	$modname,"Delete Product Screen");
+  $modname,"Delete Product Screen");
  &register_menu('AddProduct',"action_add_product",
-	$modname,"Add Product Form");
+  $modname,"Add Product Form");
  &register_menu('EditProduct',"action_edit_product",
-	$modname,"Edit Product Form");
+  $modname,"Edit Product Form");
  &register_menu('SubmitEditProduct',"action_submit_edit_product",
-	$modname,"Write Edited Product");
+  $modname,"Write Edited Product");
  &register_menu('DeleteProduct',"action_delete_product",
-	$modname,"Delete a product");
+  $modname,"Delete a product");
+
+ &register_menu('rename_userfields_screen',"display_user_naming_screen",
+  $modname,"Rename DB UserFields");
+ &register_menu('SubmitEditUserfields',"action_submit_edit_userfields",
+  $modname,"Write Edited UserField Names");
+
+ &add_settings_choice("UserFields - Rename for Manager Displays","UserFields - Rename in Managers",
+  "rename_userfields_screen");
+
  &add_item_to_manager_menu("Product Add","add_screen=yes","");
  &add_item_to_manager_menu("Product Edit","edit_screen=yes","");
  &add_item_to_manager_menu("Product Delete","delete_screen=yes","");
 }
 
-
-if ($mc_max_items_per_page eq '') {
-  $mc_max_items_per_page = 25; 
+# set defaults
+if ($mc_max_items_per_page eq '') { # Used when listing items in a category
+  $mc_max_items_per_page = 100; 
  }
-if ($mc_put_edit_helper_at_top eq '') { 
+if ($mc_put_edit_helper_at_top eq '') { #edit item/show category
   $mc_put_edit_helper_at_top = 'no'; 
  }
-if ($mc_put_edit_helper_at_bot eq '') { 
+if ($mc_put_edit_helper_at_bot eq '') { #edit item/show category
   $mc_put_edit_helper_at_bot = 'yes'; 
  }
 
@@ -49,24 +61,24 @@
 print <<ENDOFTEXT;
 <CENTER>
 <TABLE WIDTH=550 BORDER=0 CELLPADDING=0 CELLSPACING=0>
-	<TR WIDTH=550>
-	<TD colspan=$maxcols>
+  <TR WIDTH=550>
+  <TD colspan=$maxcols>
         <center><FORM METHOD=POST ACTION=manager.cgi>
-	<INPUT TYPE=SUBMIT NAME=$link_to 
+  <INPUT TYPE=SUBMIT NAME=$link_to 
           VALUE=" Display All Items in All Categories">
-	<INPUT TYPE=HIDDEN NAME=category VALUE="_ALL_">
-	</FORM></center>
-	</TD>
-	</TR>
+  <INPUT TYPE=HIDDEN NAME=category VALUE="_ALL_">
+  </FORM></center>
+  </TD>
+  </TR>
 ENDOFTEXT
 
 $element_id = $db{"product"};
-&get_prod_db_element($element_id,*db_ele);
+&get_mgr_prod_db_element($element_id,*db_ele);
 
 foreach $sku (keys %db_ele) {
   $category = $db_ele{$sku};
   $category_list{$category}++;
-} 
+} # End of foreach $sku
 
 $items = 0;
 
@@ -77,15 +89,15 @@
    print "<TR WIDTH=550>\n";
   }
  print <<ENDOFTEXT;
-	<TD colspan=1>
-	<CENTER>
-	<FORM METHOD=POST ACTION=manager.cgi>
-	<INPUT TYPE=SUBMIT NAME=$link_to 
+  <TD colspan=1>
+  <CENTER>
+  <FORM METHOD=POST ACTION=manager.cgi>
+  <INPUT TYPE=SUBMIT NAME=$link_to 
          VALUE="$category ($category_list{$category})">
-	<INPUT TYPE=HIDDEN NAME=category VALUE="$category">
-	</FORM>
-	</CENTER>
-	</TD>
+  <INPUT TYPE=HIDDEN NAME=category VALUE="$category">
+  </FORM>
+  </CENTER>
+  </TD>
 ENDOFTEXT
 
  if ($items == $maxcols) {
@@ -103,8 +115,8 @@
 
 
 print <<ENDOFTEXT;
-	</TABLE>
-	</CENTER>
+  </TABLE>
+  </CENTER>
 ENDOFTEXT
 
 }
@@ -121,8 +133,9 @@
 
 ###
 
+# Get every element's product category
 $element_id = $db{"product"};
-&get_prod_db_element($element_id,*db_ele);
+&get_mgr_prod_db_element($element_id,*db_ele);
 $first = $in{'first'};
 if (($first+0) lt 1) { $first = 1;}
 $last = $first -1 +$mc_max_items_per_page;
@@ -142,32 +155,48 @@
   }
 $price = $db_row[$db{"price"}];
 $name  = $db_row[$db{"name"}];
+
+$subcats ='';
+$subcats_thingy = '';
+
+if ($sc_use_database_subcats =~/yes/i) {
+$subcats  = $db_row[$db{"$sc_subcat_index_field"}];
+$subcats =~ s/::/, /g;
+$subcats_thingy = qq~
+  <TD WIDTH=100>
+  <font face=arial size=2>$subcats</font>
+  </TD>
+~;
+}
+
 #($sku, $category, $price, $short_description, $image, 
 # $long_description, $options) = split(/\|/,$_);
 
  $items++;
  if (($items >= $first) && ($items <= $last)) {
    $table_text .= qq~
-	<TR WIDTH=550>
-	<TD WIDTH=125>
+  <TR WIDTH=550>
+  <TD WIDTH=125>
 <INPUT TYPE="SUBMIT" NAME="$link\WhichProduct" VALUE="$sku">
 </TD>
-	<TD WIDTH=100>
-	$category
-	</TD>
-	<TD WIDTH=275>
-	$name
-	</TD>
-	<TD WIDTH=75>
-	$price
-	</TD>
-	</TR>
+  <TD WIDTH=100>
+  <font face=arial size=2>$category</font>
+  </TD>
+  <TD WIDTH=275>
+  <font face=arial size=2>$name</font>
+  </TD>
+$subcats_thingy
+  <TD WIDTH=75>
+  <font face=arial size=2>$price</font>
+  </TD>
+  </TR>
    ~;
    }
  }
+# End of foreach
 }
 
-} 
+} # End of while database
 
 if ($items < $last) {$last = $items;}
 $link_info = 
@@ -178,6 +207,8 @@
   $newfirst = $first - $mc_max_items_per_page;
   $nav_info .= "<A HREF='$link_info&first=$newfirst'>Previous</A>";
   $nav_info .= "&nbsp;&nbsp;&nbsp;";
+# $link_info
+
  }
 if ($items > $last) {
   $newfirst = $last + 1;
@@ -197,6 +228,16 @@
 </CENTER>
 ENDOFTEXT
 
+$subcats_header = '';
+
+if ($sc_use_database_subcats =~/yes/i) {
+$subcats_header = qq~
+  <TD WIDTH=100>
+  <B>Sub Categories</B>
+  </TD>
+~;
+}
+
 print <<ENDOFTEXT;
 <CENTER>
 <FORM METHOD=POST ACTION=manager.cgi>
@@ -204,42 +245,47 @@
 <INPUT TYPE=HIDDEN NAME=category VALUE=$in{'category'}>
 <INPUT TYPE=HIDDEN NAME="first" VALUE="$in{'first'}">
 <TABLE WIDTH=550 BORDER=1 CELLPADDING=5 CELLSPACING=0>
-	<TR WIDTH=550>
-	<TD WIDTH=125>
-	$col_header
-	</TD>
-	<TD WIDTH=100>
-	<B>Category</B>
-	</TD>
-
-	<TD WIDTH=275>
-	<B>Description</B>
-	</TD>
-
-	<TD WIDTH=75>
-	<B>Price</B>
-	</TD>
+  <TR WIDTH=550>
+  <TD WIDTH=125>
+  $col_header
+  </TD>
+  <TD WIDTH=100>
+  <B>Category</B>
+  </TD>
+
+  <TD WIDTH=275>
+  <B>Description</B>
+  </TD>
+$subcats_header
+  <TD WIDTH=75>
+  <B>Price</B>
+  </TD>
 
-	</TR>
+  </TR>
 $table_text
 ENDOFTEXT
 
 if ($items <= 0) {
  print <<ENDOFTEXT;
-	<TR>
-	<TD colspan=5>
-        <center><FORM METHOD=POST ACTION=manager.cgi>
-	<INPUT TYPE=SUBMIT NAME=$return_link
-          VALUE=" Display List Of Categories">
-	<INPUT TYPE=HIDDEN NAME=category VALUE="">
-	</FORM></center>
-	</TD>
-	</TR>
+  <TR>
+  <TD colspan=5><font face=arial size=2>
+        <center><a href="manager.cgi?edit_screen=yes&">Click here</a> to display the categories in your catalog/database.
+  </center></font>
+  </TD>
+  </TR>
 ENDOFTEXT
  }
-
 print <<ENDOFTEXT;
-
+<CENTER>
+<TABLE WIDTH=550 BORDER=0 CELLPADDING=4 CELLSPACING=0>
+<TR WIDTH=550>
+<TD ALIGN="CENTER">
+<br>
+$nav_info
+</TD>
+</TR>
+</TABLE>
+</CENTER>
 </TABLE>
 </FORM>
 </CENTER>
@@ -313,9 +359,12 @@
 local ($form,$msg,$imgup)="";
 
 if ($mc_file_upload_ok =~ /yes/) { 
-  $imgup = "<tr><td colspan=4>Upload Image File(s): " .
-           "<input type=file name=upfile1 size=20> &nbsp;&nbsp;" . 
-           "<input type=file name=upfile2 size=20></td></tr>\n";
+  $imgup = qq~<tr><td colspan=4><FONT FACE=ARIAL SIZE=2>Upload Image File(s): 
+           <input type=file name=upfile1 size=20> &nbsp;&nbsp; 
+           <input type=file name=upfile2 size=20><br>
+            &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;<input type=file name=upfile3 size=20> &nbsp;&nbsp; 
+           <input type=file name=upfile4 size=20> &nbsp;&nbsp; 
+           <input type=file name=upfile5 size=20><br>This is for uploading images only.  Does not do any automatic field/data entry for image names.  Use .gif .jpg or .png formats</font></td></tr>\n~;
  }
 
 if($add_product_success eq "yes"){
@@ -352,40 +401,38 @@
 WIDTH="755">
   
     <tr>
-      <td colspan="1" width="30%"><font FACE="ARIAL" SIZE="2"><b>PRODUCT ID #</b> (normally do
-      not change this!)&nbsp; </font><input NAME="sku" VALUE="$new_sku" 
+      <td colspan="1" width="30%"><font FACE="ARIAL" SIZE="2"><b>PRODUCT ID #</b><br><small>(normally do
+      not change this!)</small></font><br>&nbsp;&nbsp;<input NAME="sku" VALUE="$new_sku" 
       TYPE="TEXT" SIZE="10" MAXLENGTH="10"></td>
       <td colspan="2" width="40%"><div align="left"><table border="0" cellpadding="0"
       cellspacing="0">
+               <tr>
+          <td><font FACE="ARIAL" SIZE="2"><b>Price</b><br><small>Do not enter currency symbol</small></font></td>
+          <td>&nbsp; <input NAME="price" SIZE="10" MAXLENGTH="10"
+           value="$price"></td>
+        </tr>
         <tr>
-          <td><font FACE="ARIAL" SIZE="2"><b>Price</b> - No \$ sign
-          needed</font></td>
-          <td>&nbsp; <input NAME="price" SIZE="10" MAXLENGTH="10"></td>
+          <td colspan=2><font FACE="ARIAL" SIZE="2"><hr></td>
         </tr>
         <tr>
-          <td><font FACE="ARIAL" SIZE="2"><b>Shipping Price (Std)</b> or<br>
-          <b>Shipping Wt (lbs -SBW module)</b></font></td>
-          <td>&nbsp; <input NAME="shipping_price" SIZE="10" MAXLENGTH="10"></td>
+          <td><font FACE="ARIAL" SIZE="2"><b>Shipping Price or Weight</b><br>(weight only if using SBW module)<br><small>Do not enter anything but the shipping price or weight in numerical form.<br>Leave completely blank if no price or weight needed for this product</small></font></td>
+          <td>&nbsp; <input NAME="shipping_price" SIZE="10" MAXLENGTH="10"
+           value="$shipping_price"></td>
         </tr>
       </table>
       </div></td>
-      <td width="30%"><font FACE="ARIAL" SIZE="2"><b>Option File</b> 
-        - choose from the list of files in the options directory<br>
+      <td width="30%"><font FACE="ARIAL" SIZE="2"><b>Option File</b>***<br><small>choose from the list of files in the options directory, usually html/options sub-directory of the store.</small><br>
       </font><select NAME="option_file" size="1">
-        <option>blank.html</option>
 $options_file_list
       </select> </td>
     </tr>
     <tr>
-      <td colspan=1><font FACE="ARIAL" SIZE="2"><b>Category</b> - One 
-        word only</font><br><input NAME="category" TYPE="TEXT" SIZE="25"
-        MAXLENGTH="35"></td>
-      <td colspan=2><font FACE="ARIAL" SIZE="2"><b>Product Name</b> 
-        - 3 or 4 words</font><br>
-        <input NAME="name" TYPE="TEXT" SIZE="35" MAXLENGTH="35"></td>
-      <td colspan=1><font FACE="ARIAL" SIZE="2"><b>Image File</b> -
-      name.gif/.jpg/.png</font><br>
-      <input NAME="image" TYPE="TEXT" SIZE="25" MAXLENGTH="55"></td>
+      <td colspan=1><font FACE="ARIAL" SIZE="2"><b>Category</b><br><small>spaces & dashes okay. 50 characters max.</small></font><br><input NAME="category" TYPE="TEXT" SIZE="25"
+        MAXLENGTH="50"></td>
+      <td colspan=2><font FACE="ARIAL" SIZE="2"><b>Product Name</b><br><small>4 to 8 words. 70 characters max.  No quote marks allowed</small></font><br>
+        <input NAME="name" TYPE="TEXT" SIZE="35" MAXLENGTH="70"></td>
+      <td colspan=1><font FACE="ARIAL" SIZE="2"><b>Image File</b><br><small>use format of: name.gif (or .jpg / .png).  85 max characters. Case Sensitive, names must match! Do not enter path, name only.</small></font><br>
+      <input NAME="image" TYPE="TEXT" SIZE="25" MAXLENGTH="85"></td>
     </tr>
 $imgup
     <tr> 
@@ -394,34 +441,43 @@
         <tr>
           <td><font FACE="ARIAL" 
             SIZE="2"><b>Description</b> - Enter the
-            Text &amp; HTML describing the product. </font><br>
-            <textarea NAME="description" ROWS="5" COLS="85" 
+            Text &amp; HTML describing the product.</font><br>
+            <textarea NAME="description" ROWS="10" COLS="85" 
             wrap="soft"></textarea></td>
         </tr>
       </div></table></td>
     </tr>
     <tr>
-      <td colspan="2" width="50%"><font face="ARIAL" size="2" color="RED">2nd Image: </font><input
-      NAME="userDefinedOne" SIZE="35" MAXLENGTH="128" style="font-family: Courier, monospace"></td>
-      <td colspan="2" width="50%"><font face="ARIAL" size="2" color="RED">User 2: </font><input
-      NAME="userDefinedTwo" SIZE="35" MAXLENGTH="128" style="font-family: Courier, monospace"></td>
+      <td colspan="2" width="50%"><font face="ARIAL" size="2" color="RED">*2nd Image: </font><input
+      NAME="userDefinedOne" SIZE="35" MAXLENGTH="256" style="font-family: Courier, monospace"></td>
+      <td colspan="2" width="50%"><font face="ARIAL" size="2" color="RED">$user2: </font><input
+      NAME="userDefinedTwo" SIZE="35" MAXLENGTH="256" style="font-family: Courier, monospace"></td>
     </tr>
     <tr>
-      <td colspan="2" width="50%"><font face="ARIAL" size="2" color="RED">User 3: </font><input
-      NAME="userDefinedThree" SIZE="35" MAXLENGTH="128" style="font-family: Courier, monospace"></td>
-      <td colspan="2" width="50%"><font face="ARIAL" size="2" color="RED">User 4: </font><input
-      NAME="userDefinedFour" SIZE="35" MAXLENGTH="128" 
+      <td colspan="2" width="50%"><font face="ARIAL" size="2" color="RED">$user3: </font><input
+      NAME="userDefinedThree" SIZE="35" MAXLENGTH="256" style="font-family: Courier, monospace"></td>
+      <td colspan="2" width="50%"><font face="ARIAL" size="2" color="RED">$user4: </font><input
+      NAME="userDefinedFour" SIZE="35" MAXLENGTH="256" 
       style="font-family: Courier, monospace"></td>
     </tr>
     <tr>
-      <td colspan="2" width="50%"><font face="ARIAL" size="2" color="RED">User 5: </font><input
-      NAME="userDefinedFive" SIZE="35" MAXLENGTH="128" style="font-family: Courier, monospace"></td>
+      <td colspan="2" width="50%"><font face="ARIAL" size="2" color="RED">$user5: </font><input
+      NAME="userDefinedFive" SIZE="35" MAXLENGTH="256" style="font-family: Courier, monospace"></td>
       <td colspan="2" width="50%">&nbsp;&nbsp; <input TYPE="SUBMIT" NAME="AddProduct"
       VALUE="Add Product">&nbsp;&nbsp;&nbsp; <input TYPE="RESET" VALUE="Clear Form"> </td>
     </tr>
   </table></td></tr>
-  </table>
-  </center></div>
+  </table></center></div>
+<blockquote><font face=arial size=2>
+<b>QUICK HELP & TIPS</b><br><br>
+Change userfield titles displayed in Add Product and Edit Product screens <a href=manager.cgi?rename_userfields_screen=yes>here</a>
+<br><br>For help, see the online manual regarding addition of products to your database using the online manager interface at: <a href="http://www.agoracart.com/agorawiki/index.php?title=Adding_Products_to_Your_Store_V5" target="_new">http://www.agoracart.com/agorawiki/index.php?title=Adding_Products_to_Your_Store_V5</a><br><br>
+<b>Use the least amount of text as possible in each field</b>.  Shorten names a much as possible. The shorter and/or less text you use, the faster and more efficient your store will run.<br><br>
+<b>Remember all entries are case sensitive</b> and will cause errors if even one character is wrong in case (capitals or small caps).<br><br>
+*<b>2nd image</b>: This is the image used in the cart contents displayed (view cart, checkout, etc).  Leave blank if not using images in cart contents layout (see cart layout manager).  If using this image, use <b>%%img%%</b> in front of the image name for auto-built images for the image displayed ( example: %%img%%small_imagename.jpg).  Use smaller images, no larger than approx 40-70 pixels in width and/or height, or your cart contents displays will look really terrible and skew your layouts.<br><br>
+**<b>sub categories</b>:  if using sub categories, indicate sub category name in a userfield that is open (make sure this is setup in the main store settings/setups screen).  If you need more than one sub category for the product, separate sub category names with two colons ( :: ).  Spaces are acceptable in sub category names.<br><br>
+***<b>Option Files</b> can be created in a text editor. You can also download manager add-ons for creating options at the AgoraCart.com or "members only" download sections.  You can add option files later if you desire (and after creating the option html file) using the Product Edit screens for each product.<br><br>
+<b>Import/Export Product Database</b>:  The product database is a pipe delimited text file, so you can download (as is or use the Database manager for more conversions) and edit it in a text editor, a spreadsheet, etc.  for tips on how to perform product database imports/exports, see the online manual at: <a href="http://www.agoracart.com/agorawiki/index.php?title=Database_V5" target="_new">http://www.agoracart.com/agorawiki/index.php?title=Database_V5</a></font></blockquote>
 </form>
 </body>
 </html>~;
@@ -431,10 +487,14 @@
 sub edit_item_form_new {
 local ($form,$msg,$imgup)="";
 
-if ($mc_file_upload_ok =~ /yes/) { 
-  $imgup = "<tr><td colspan=4>Upload Image File(s): " .
-           "<input type=file name=upfile1 size=20> &nbsp;&nbsp;" . 
-           "<input type=file name=upfile2 size=20></td></tr>\n";
+if ($mc_file_upload_ok =~ /yes/) { # allow images to be uploaded
+  $imgup = qq~<tr><td colspan=4>Upload Image File(s): 
+           <input type=file name=upfile1 size=20> &nbsp;&nbsp; 
+           <input type=file name=upfile2 size=20><br>
+            &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;<input type=file name=upfile3 size=20> &nbsp;&nbsp; 
+           <input type=file name=upfile4 size=20> &nbsp;&nbsp; 
+           <input type=file name=upfile5 size=20><br>
+           </td></tr>\n~;
  }
 
 $form = qq~<HTML>
@@ -450,7 +510,7 @@
      <td colspan=3 width="80%"><strong> $manager_banner_main 
 Quick Edit</strong>&nbsp;&nbsp;&nbsp;$msg</td>
 <td><INPUT TYPE=SUBMIT NAME="skip_edit_screen" 
-     VALUE="Skip This Record"><INPUT TYPE=HIDDEN NAME="first"
+     VALUE="Skip This Record - Done"><INPUT TYPE=HIDDEN NAME="first"
 VALUE="$in{'first'}"></td>
     </tr></table></td>
     </tr>
@@ -458,42 +518,39 @@
 WIDTH="755">  
     <tr>
       <td colspan="1" width="30%"><font FACE="ARIAL" SIZE="2"><b>PRODUCT
-      ID # $sku</b> (change to save as NEW record)&nbsp; </font><input 
+      ID # $sku</b><br><small>(change ID to save as NEW record)</small></font><br>&nbsp;&nbsp;<input 
       NAME="new_sku" VALUE="$sku" TYPE="TEXT" SIZE="10" MAXLENGTH="10"></td>
       <td colspan="2" width="40%"><div align="left"><table border="0" cellpadding="0"
       cellspacing="0">
         <tr>
-          <td><font FACE="ARIAL" SIZE="2"><b>Price</b> - No \$ sign
-          needed</font></td>
+          <td><font FACE="ARIAL" SIZE="2"><b>Price</b><br><small>Do not enter currency symbol</small></font></td>
           <td>&nbsp; <input NAME="price" SIZE="10" MAXLENGTH="10"
            value="$price"></td>
         </tr>
         <tr>
-          <td><font FACE="ARIAL" SIZE="2"><b>Shipping Price (Std)</b> or<br>
-          <b>Shipping Wt (lbs -SBW module)</b></font></td>
+          <td colspan=2><font FACE="ARIAL" SIZE="2"><hr></td>
+        </tr>
+        <tr>
+          <td><font FACE="ARIAL" SIZE="2"><b>Shipping Price or Weight</b><br>(weight only if using SBW module)<br><small>Do not enter anything but the shipping price or weight in numerical form.<br>Leave completely blank if no price or weight needed for this product</small></font></td>
           <td>&nbsp; <input NAME="shipping_price" SIZE="10" MAXLENGTH="10"
            value="$shipping_price"></td>
         </tr>
       </table>
       </div></td>
-      <td width="30%"><font FACE="ARIAL" SIZE="2"><b>Option File</b> - the list of files in the
-      options directory<br>
+      <td width="30%"><font FACE="ARIAL" SIZE="2"><b>Option File</b><br><small>choose from the list of files in the options directory, usually html/options sub-directory of the store</small><br>
       </font><select NAME="option_file" size="1">
         <option>$options</option>
 $options_file_list
       </select> </td>
     </tr>
     <tr>
-      <td colspan=1><font FACE="ARIAL" SIZE="2"><b>Category</b> - One 
-        word only</font><br><input NAME="category" TYPE="TEXT" SIZE="25"
-        MAXLENGTH="35" value="$category"></td>
-      <td colspan=2><font FACE="ARIAL" SIZE="2"><b>Product Name</b> 
-        - 3 or 4 words</font><br>
-        <input NAME="name" TYPE="TEXT" SIZE="35" MAXLENGTH="35"
+      <td colspan=1><font FACE="ARIAL" SIZE="2"><b>Category</b><br><small>spaces & dashes okay. 50 characters max.</small></font><br><input NAME="category" TYPE="TEXT" SIZE="25"
+        MAXLENGTH="50" value="$category"></td>
+      <td colspan=2><font FACE="ARIAL" SIZE="2"><b>Product Name</b><br><small>4 to 8 words. 70 characters max.  No quote marks allowed</small></font><br>
+        <input NAME="name" TYPE="TEXT" SIZE="35" MAXLENGTH="70"
        value="$short_description"></td>
-      <td colspan=1><font FACE="ARIAL" SIZE="2"><b>Image File</b> -
-      name.gif/.jpg/.png</font><br>
-      <input NAME="image" TYPE="TEXT" SIZE="25" MAXLENGTH="55"
+      <td colspan=1><font FACE="ARIAL" SIZE="2"><b>Image File</b><br><small>use format of: name.gif (or .jpg / .png). 85 max characters. Case Sensitive, names must match! Do not enter path, name only.</small></font><br>
+      <input NAME="image" TYPE="TEXT" SIZE="25" MAXLENGTH="85"
        value="$image"></td>
     </tr>
 $imgup
@@ -504,32 +561,32 @@
           <td><font FACE="ARIAL" 
             SIZE="2"><b>Description</b> - Enter the
             Text &amp; HTML describing the product. </font><br>
-            <textarea NAME="description" ROWS="5" COLS="85" 
+            <textarea NAME="description" ROWS="10" COLS="85" 
             wrap="soft">$long_description</textarea></td>
         </tr>
       </div></table></td>
     </tr>
     <tr>
-      <td colspan="2" width="50%"><font face="ARIAL" size="2" color="RED">2nd Image: </font><input
+      <td colspan="2" width="50%"><font face="ARIAL" size="2" color="RED">*2nd Image: </font><input
       value='$userDefinedOne' 
-      NAME="userDefinedOne" SIZE="35" MAXLENGTH="128" style="font-family: Courier, monospace"></td>
-      <td colspan="2" width="50%"><font face="ARIAL" size="2" color="RED">User 2: </font><input
+      NAME="userDefinedOne" SIZE="35" MAXLENGTH="256" style="font-family: Courier, monospace"></td>
+      <td colspan="2" width="50%"><font face="ARIAL" size="2" color="RED">$user2: </font><input
       value='$userDefinedTwo'
-      NAME="userDefinedTwo" SIZE="35" MAXLENGTH="128" style="font-family: Courier, monospace"></td>
+      NAME="userDefinedTwo" SIZE="35" MAXLENGTH="256" style="font-family: Courier, monospace"></td>
     </tr>
     <tr>
-      <td colspan="2" width="50%"><font face="ARIAL" size="2" color="RED">User 3: </font><input
+      <td colspan="2" width="50%"><font face="ARIAL" size="2" color="RED">$user3: </font><input
       value='$userDefinedThree' 
-      NAME="userDefinedThree" SIZE="35" MAXLENGTH="128" style="font-family: Courier, monospace"></td>
-      <td colspan="2" width="50%"><font face="ARIAL" size="2" color="RED">User 4: </font><input
+      NAME="userDefinedThree" SIZE="35" MAXLENGTH="256" style="font-family: Courier, monospace"></td>
+      <td colspan="2" width="50%"><font face="ARIAL" size="2" color="RED">$user4: </font><input
       value='$userDefinedFour' 
-      NAME="userDefinedFour" SIZE="35" MAXLENGTH="128" 
+      NAME="userDefinedFour" SIZE="35" MAXLENGTH="256" 
       style="font-family: Courier, monospace"></td>
     </tr>
     <tr>
-      <td colspan="2" width="50%"><font face="ARIAL" size="2" color="RED">User 5: </font><input
+      <td colspan="2" width="50%"><font face="ARIAL" size="2" color="RED">$user5: </font><input
       value='$userDefinedFive' 
-      NAME="userDefinedFive" SIZE="35" MAXLENGTH="128" style="font-family: Courier, monospace"></td>
+      NAME="userDefinedFive" SIZE="35" MAXLENGTH="256" style="font-family: Courier, monospace"></td>
       <td colspan="2" width="50%">&nbsp;&nbsp; <INPUT TYPE=SUBMIT 
       NAME="SubmitEditProduct" VALUE="Submit Edit">&nbsp;&nbsp;&nbsp;
       <input TYPE="RESET" VALUE="Undo Edit">
@@ -537,8 +594,19 @@
       <INPUT TYPE=HIDDEN NAME="ProductEditSku" VALUE="$sku"></td>
     </tr>
   </table></td></tr>
-  </table>
-  </center></div>
+  </table></center></div>
+<blockquote><font face=arial size=2>
+<b>QUICK HELP & TIPS</b><br><br>
+Change userfield titles displayed in Add Product and Edit Product screens <a href=manager.cgi?rename_userfields_screen=yes>here</a>
+<br><br>
+For help, see the online manual regarding editing/adding of products in your database using the online manager interface at: <a href="http://www.agoracart.com/agorawiki/index.php?title=Adding_Products_to_Your_Store_V5" target="_new">http://www.agoracart.com/agorawiki/index.php?title=Adding_Products_to_Your_Store_V5</a><br><br>
+<b>Use the least amount of text as possible in each field</b>.  Shorten names a much as possible. The shorter and/or less text you use, the faster and more efficient your store will run.<br><br>
+<b>Remember all entries are case sensitive</b> and will cause errors if even one character is wrong in case (capitals or small caps).<br><br>
+*<b>2nd image</b>: This is the image used in the cart contents displayed (view cart, checkout, etc).  Leave blank if not using images in cart contents layout (see cart layout manager).  If using this image, use <b>%%img%%</b> in front of the image name for auto-built images for the image displayed ( example: %%img%%small_imagename.jpg).  Use smaller images, no larger than approx 40-70 pixels in width and/or height, or your cart contents displays will look really terrible and skew your layouts.<br><br>
+**<b>sub categories</b>:  if using sub categories, indicate sub category name in a userfield that is open (make sure this is setup in the main store settings/setups screen).  If you need more than one sub category for the product, separate sub category names with two colons ( :: ).  Spaces are acceptable in sub category names.<br><br>
+***<b>Option Files</b> can be created in a text editor. You can also download manager add-ons for creating options at the AgoraCart.com or "members only" download sections.<br><br>
+<b>Import/Export Product Database</b>:  The product database is a pipe delimited text file, so you can download (as is or use the Database manager for more conversions) and edit it in a text editor, a spreadsheet, etc.  for tips on how to perform product database imports/exports, see the online manual at: <a href="http://www.agoracart.com/agorawiki/index.php?title=Database_V5" target="_new">http://www.agoracart.com/agorawiki/index.php?title=Database_V5</a>
+  </font></blockquote>
 </form>
 </body>
 </html>~;
@@ -562,10 +630,7 @@
  }
 
 if ($in{'category'} ne "") {
-  $message = "Click an 'Item # to Edit' button to make changes to" . 
-             " a product in your catalog. ";
-  $message .='&nbsp;&nbsp;<a href="manager.cgi?edit_screen=yes&">' .
-	'Click here</a> to display the categories in your catalog.';
+  $message = qq~Click a button for the ID number under the "Item # to Edit" column to make changes to an individual product listing in your catalog.<br><br><a href="manager.cgi?edit_screen=yes&">Click here</a> to display the categories in your catalog/database.~;
  } else {
   $message = "Click below to select the category to display."; 
  }
@@ -685,9 +750,9 @@
 
 if ($in{'category'} ne "") {
  &display_items_in_category("Edit",
-	"<b>Item # to Edit</b>",
-	"Edit",
-	"edit_screen");
+  "<b>Item # to Edit</b>",
+  "Edit",
+  "edit_screen");
  } else {
  &display_categories("edit_screen");
  }
@@ -727,7 +792,7 @@
 
 if ($in{'category'} ne "") {
   $message ='<a href="manager.cgi?delete_screen=yes&">' .
-	'Click here</a> to display the categories in your catalog.';
+  'Click here</a> to display the categories in your catalog.';
  } else {
   $message = "Click below to select the category to display."; 
  }
@@ -834,35 +899,32 @@
   $found_it = &check_db_with_product_id($in_sku,*db_row);
  }
 
-if ($found_it) {
+if ($found_it) { 
+  #print "sku already exists!"; 
   $add_product_status="no";
   &add_product_screen($add_product_status);
   &call_exit;
  }
 
 $formatted_description = $in{'description'};
-$formatted_description =~ s/\r/ /g;
-$formatted_description =~ s/\t/ /g;
-$formatted_description =~ s/\n/ /g;
+$formatted_description =~ s/\s+/ /g;
 
-$image = $in{'image'};
-if ($image eq "") {
-  $image = "notavailable.gif";
- }
-$formatted_image = &create_image_string($image);
+$in{'name'} =~ s/\"//g;
+$in{'name'} =~ s/\'//g;
+$in{'name'} =~ s/\`//g;
+&my_escape($in{'name'});
 
-##
 if ($in{'option_file'} ne "")
 
 {
-	if (-e "./html/options/$in{'option_file'}")
-	{
-	$formatted_option_file = "\%\%OPTION\%\%$in{'option_file'}";
-	}
-	else
-	{
-	$formatted_option_file = "\%\%OPTION\%\%blank.html";
-	}
+  if (-e "./html/options/$in{'option_file'}")
+  {
+  $formatted_option_file = "\%\%OPTION\%\%$in{'option_file'}";
+  }
+  else
+  {
+  $formatted_option_file = "\%\%OPTION\%\%blank.html";
+  }
 }
 
 else
@@ -870,9 +932,30 @@
 {
 $formatted_option_file = "\%\%OPTION\%\%blank.html";
 }
-##
 
-$in{'category'} =~ s/\ //g; 
+# NO Multiple BLANKS ALLOWED!  No tabs, newlines or carriage returns
+$in{'category'} =~ s/\s+/ /g; 
+my @arrayThing = (name,category,userDefinedOne,userDefinedTwo,userDefinedThree,userDefinedFour,userDefinedFive);
+foreach $arrayThing (@arrayThing) {
+    $in{$arrayThing} =~ s/\s+/ /g;
+    $in{$arrayThing} =~ s/\r//g;
+    $in{$arrayThing} =~ s/\t//g;
+    $in{$arrayThing} =~ s/\n//g;
+}
+
+# NO BLANKS OR WHITESPACE ALLOWED!
+my @arrayThing2 = (sku,price,shipping_price,image);
+foreach $arrayThing2 (@arrayThing2) {
+    $in{$arrayThing2} =~ s/\s//g;
+}
+
+$image = $in{'image'};
+if ($image eq "") {
+  $image = "notavailable.gif";
+ }
+$formatted_image = &create_image_string($image);
+
+
 if ($in{'category'} eq "") {
   $in{'category'} = "*Nameless*";
  }
@@ -897,7 +980,7 @@
 ################################################################################
 sub action_edit_product
 {
-	
+  
 local($sku, $category, $price, $short_description, $image, 
       $long_description, $shipping_price, $userDefinedOne, $userDefinedTwo, 
       $userDefinedThree, $userDefinedFour, $userDefinedFive, 
@@ -909,14 +992,14 @@
 ($sku, $category, $price, $short_description, $image, 
  $long_description, $shipping_price, $userDefinedOne, 
  $userDefinedTwo, $userDefinedThree, $userDefinedFour, 
- $userDefinedFive,$options) = split(/\|/,$raw_data);
+ $userDefinedFive, $options) = split(/\|/,$raw_data);
 
 chomp($options);
 
 if ($sku ne $in{'EditWhichProduct'}) {
   if ($found_it) {
     $long_description = "Error, expected sku of $in{'EditWhichProduct'}, " 
-	. "found $sku instead!";
+  . "found $sku instead!";
   }
   $sku = $in{'EditWhichProduct'};
  } 
@@ -936,36 +1019,32 @@
 ################################################################################
 sub action_submit_edit_product
 {
-### Begin
 local($sku, $category, $price, $short_description, $image, 
-	$long_description, $shipping_price, $userDefinedOne, 
-	$userDefinedTwo, $userDefinedThree, $userDefinedFour, 
-	$userDefinedFive, $options);
+  $long_description, $shipping_price, $userDefinedOne, 
+  $userDefinedTwo, $userDefinedThree, $userDefinedFour, 
+  $userDefinedFive, $options);
 local($temp);
 
 $formatted_description = $in{'description'};
-$formatted_description =~ s/\r/ /g;
-$formatted_description =~ s/\t/ /g;
-$formatted_description =~ s/\n/ /g;
+$formatted_description =~ s/\s+/ /g;
+
+$in{'name'} =~ s/\"//g;
+$in{'name'} =~ s/\'//g;
+$in{'name'} =~ s/\`//g;
+&my_escape($in{'name'});
 
-$image = $in{'image'};
-if ($image eq "") {
-  $image = "notavailable.gif";
- }
-$formatted_image = &create_image_string($image);
 
-##
 if ($in{'option_file'} ne "")
 
 {
-	if (-e "./html/options/$in{'option_file'}")
-	{
-	$formatted_option_file = "\%\%OPTION\%\%$in{'option_file'}";
-	}
-	else
-	{
-	$formatted_option_file = "\%\%OPTION\%\%blank.html";
-	}
+  if (-e "./html/options/$in{'option_file'}")
+  {
+  $formatted_option_file = "\%\%OPTION\%\%$in{'option_file'}";
+  }
+  else
+  {
+  $formatted_option_file = "\%\%OPTION\%\%blank.html";
+  }
 }
 
 else
@@ -973,9 +1052,30 @@
 {
 $formatted_option_file = "\%\%OPTION\%\%blank.html";
 }
-##
 
-$in{'category'} =~ s/\ //g; # NO BLANKS ALLOWED!
+
+# NO Multiple BLANKS ALLOWED!  No tabs, newlines or carriage returns
+$in{'category'} =~ s/\s+/ /g; 
+my @arrayThing = (name,category,userDefinedOne,userDefinedTwo,userDefinedThree,userDefinedFour,userDefinedFive);
+foreach $arrayThing (@arrayThing) {
+    $in{$arrayThing} =~ s/\s+/ /g;
+    $in{$arrayThing} =~ s/\r//g;
+    $in{$arrayThing} =~ s/\t//g;
+    $in{$arrayThing} =~ s/\n//g;
+}
+
+# NO BLANKS OR WHITESPACE ALLOWED!
+my @arrayThing2 = (new_sku,price,shipping_price,image);
+foreach $arrayThing2 (@arrayThing2) {
+    $in{$arrayThing2} =~ s/\s+//g;
+}
+
+$image = $in{'image'};
+if ($image eq "") {
+  $image = "notavailable.gif";
+ }
+$formatted_image = &create_image_string($image);
+
 if ($in{'category'} eq "") {
   $in{'category'} = "*Nameless*";
  }
@@ -992,9 +1092,9 @@
     if ($temp ne "") { #test if it is there first ...
       $found_it = &check_db_with_product_id($temp,*db_row);
       if ($found_it) { 
-	$in{'new_sku'} = &get_next_prod_key;
+  $in{'new_sku'} = &get_next_prod_key;
        } else {
-	$in{'new_sku'} = $temp;
+  $in{'new_sku'} = $temp;
        }
      } else {
       $in{'new_sku'} = &get_next_prod_key;
@@ -1041,4 +1141,120 @@
 
 }
 #########################################################################
+sub action_submit_edit_userfields {
+local($myset)="";
+
+&ReadParse;
+
+
+my $tempthingy = 2;
+while ($tempthingy <= $sc_userfields_available) {
+my $tempthingy2 = "user" . "$tempthingy";
+if ($in{$tempthingy2} ne "") {
+    $myset .= "\$$tempthingy2 = \"$in{$tempthingy2}\";\n";
+    $$tempthingy2 = $in{$tempthingy2};
+} else {
+    $myset .= "\$$tempthingy2 = \"User $tempthingy\";\n";
+}
+$tempthingy++
+}
+
+
+&update_userfield_names('$sc_userfieldsfile',$myset);
+  &display_user_naming_screen;
+ }
+################################################################################
+sub update_userfield_names {
+  local($item,$stuff) = @_;
+  $pass_file_settings{$item} = $stuff;
+local($pass_settings) = "$mgrdir/misc/userfields.pl";
+  local($item,$zitem);
+
+  &get_file_lock("$pass_settings.lockfile");
+  open(PASSFILE,">$pass_settings") || &my_die("Can't Open $pass_settings");
+  foreach $zitem (sort(keys %pass_file_settings)) {
+    $item = $zitem;
+     print (PASSFILE $pass_file_settings{$zitem});
+   }
+  close(PASSFILE);
+  &release_file_lock("$pass_settings.lockfile");
+&require_supporting_libraries(__FILE__,__LINE__,
+  "$mgrdir/misc/userfields.pl");
+ }
+#######################################################################################
+sub display_user_naming_screen {
+
+local($filename)="$mgrdir/";
+print &$manager_page_header("User Field Name Editor","","","","");
+
+
+
+print <<ENDOFTEXT;
+<CENTER>
+<HR>
+</CENTER>
+
+<FORM ACTION="manager.cgi" METHOD="POST">
+<CENTER>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL size=2>Welcome to the <b>AgoraCart</b>  Database UserField Names Editor.  This area allows you to changes the names of the database userfields as they are dsplayed in the Add Product and Edit Product screens.  This does not change the names of the user fields anywhere else.</center></TD>
+</TR>
+</TABLE>
+</CENTER>
+
+ENDOFTEXT
+
+if($in{'system_edit_success'} ne "")
+{
+print <<ENDOFTEXT;
+<CENTER><br>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL SIZE=2 COLOR=RED>UserField names have been 
+successfully updated.</FONT>
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+ENDOFTEXT
+}
+
+print qq~
+<br>
+<FORM ACTION="manager.cgi" METHOD="POST">
+   <div align="center">
+   <table border="0" cellspacing="0">
+<TR>
+<TD>
+~;
+
+my $tempthingy = 2;
+while ($tempthingy <= $sc_userfields_available) {
+my $tempthingy2 = "user" . "$tempthingy";
+print qq~
+New Name for $tempthingy2 (30 characters max): &nbsp;&nbsp;
+<INPUT NAME="$tempthingy2" TYPE="TEXT" SIZE=30 
+MAXLENGTH="30" VALUE="$$tempthingy2"><br>
+~;
+$tempthingy++
+}
+print qq~
+</TD>
+</TR>
+   </table>
+
+   </div>
+   <p align="center">&nbsp;</p>
+   <p align="center"><font face="Arial"><INPUT TYPE="HIDDEN" NAME="system_edit_success" value="yes">
+<INPUT NAME="SubmitEditUserfields" TYPE="SUBMIT" value="Submit">
+&nbsp;&nbsp;
+<INPUT TYPE="RESET" value="Reset"></font></p>
+   </form>
+~;
+print &$manager_page_footer;
+}
+#######################################################################################
 1; # Library
diff -ruN 4.0K-4b/protected/ship_settings-ext_lib.pl 5.0.000/protected/ship_settings-ext_lib.pl
--- 4.0K-4b/protected/ship_settings-ext_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/protected/ship_settings-ext_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,16 +1,53 @@
-# file ./store/protected/shipping_settings-ext_lib.pl
-
-$versions{'shipping_settings'} = "20030102";
+# file ./store/protected/ship_settings-ext_lib.pl
+#########################################################################
+#
+# Copyright (c) 2002 to Date K-Factor Technologies, Inc.
+# http://www.k-factor.net/  and  http://www.AgoraCart.com/
+# All Rights Reserved.
+#
+# Use with permission only with AgoraCart, AgoraCartPro, AgoraSQL, AgoraCartSQL, 
+# or AgoraSuite
+#
+# This software is a separate add-on to an ecommerce shopping cart and 
+# is the confidential and proprietary information of K-Factor Technologies, Inc.  You shall
+# not disclose such Confidential Information and shall use it only in
+# conjunction with the AgoraCart (aka agora.cgi) shopping cart.
+#
+# Requires AgoraCart version 5.0.0 or above.  Just place this file in the protected directory.
+#
+# K-Factor Technologies, Inc. BytePipe, AgoraScript nor any of their employees and/or representatives
+# MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT
+# THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESSED OR IMPLIED,
+# INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+# OR NON-INFRINGEMENT.
+#
+# K-Factor Technologies, Inc., BytePipe, AgoraScript nor any of their employees and/or representatives
+# SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY
+# LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS
+# SOFTWARE OR ITS DERIVATIVES.
+#
+# You may not give this script/add-on away or distribute it an any way without
+# written permission from K-Factor Technologies, Inc.  K-Factor Technologies, Inc.
+# reserves any and all rights to distributions, add-ons, and other works based on this
+# piece of software as well as any and all rights to profit sharing and/or to charge for
+# such works and/or derivatves.
+#
+##########################################################################
+
+$versions{'ship_settings-ext_lib.pl'} = "5.0.000";
+$sc_custom_shipping_methodname_string = '';
+$sc_shipadminfile="$mgrdir/misc/ship_admin.pl";
 
 {
  local ($modname) = 'shipping_settings';
  &register_extension($modname,"Shipping Library Settings",$versions{$modname});
- &add_settings_choice("shipping settings"," Shipping Settings ",
-	"shipping_settings_screen");
+ &add_settings_choice("shipping settings"," Shipping Settings & Logic ",
+  "shipping_settings_screen");
  &register_menu('shipping_settings_screen',"show_ship_settings_screen",
-	$modname,"Display Shipping Library Settings");
+  $modname,"Display Shipping Library Settings");
  &register_menu('ChangeShipSettings',"action_input_ship_settings",
-	$modname,"Write Shipping Library Settings");
+  $modname,"Write Shipping Library Settings");
 }
 #######################################################################################
 sub action_input_ship_settings
@@ -18,40 +55,162 @@
 
 local($admin_email, $order_email, $cookieDomain, $cookiePath);
 local($other_program_settings)="";
-local($myset)="";
+my ($temp_db_thingy, $ups_xml_temp_thingy, $ups_temp_thingy, $usps_temp_thingy)="";
+my ($temp_origin_country_thingy, $myset, $myset2)="";
 
 &ReadParse;
 
-$myset = "";
+if ($in{'sc_alt_origin_db_counter2'} ne "") {
+  $temp_db_thingy = $in{'sc_alt_origin_db_counter2'};
+  if ($temp_db_thingy =~ /User 20/i) {
+    $sc_alt_origin_db_counter = 26;
+  } elsif ($temp_db_thingy =~ /User 2/i) {
+    $sc_alt_origin_db_counter = 8;
+  } elsif ($temp_db_thingy =~ /User 3/i) {
+    $sc_alt_origin_db_counter = 9;
+  } elsif ($temp_db_thingy =~ /User 4/i) {
+    $sc_alt_origin_db_counter = 10;
+  } elsif ($temp_db_thingy =~ /User 5/i) {
+    $sc_alt_origin_db_counter = "11";
+  } else {
+    $sc_alt_origin_db_counter = "";
+  }
+}
 
-$myset .= "\$sc_calculate_shipping_loop = " . 
-                 "\"$in{'sc_calculate_shipping_loop'}\";\n";
+#set admin file stuff. reduces variable overhead
+$myset2 .= "\$sc_alt_origin_db_counter2 = \"$in{'sc_alt_origin_db_counter2'}\";\n";
+$myset2 .= "\$sc_howmanycustomshippingmethods = \"$in{'sc_howmanycustomshippingmethods'}\";\n";
+
+$myset .= "\$sc_ship_thingy_p_id_indicator_enabled = \"$in{'sc_ship_thingy_p_id_indicator_enabled'}\";\n";
+$myset .= "\$sc_calculate_shipping_loop = \"$in{'sc_calculate_shipping_loop'}\";\n";
 $myset .= "\$sc_handling_charge = \"$in{'sc_handling_charge'}\";\n";
+$myset .= "\$sc_handling_charge_type = \"$in{'sc_handling_charge_type'}\";\n";
 $myset .= "\$sc_add_handling_cost_if_shipping_is_zero = \"$in{'sc_add_handling_cost_if_shipping_is_zero'}\";\n";
+$myset .= "\$sc_alt_origin_enabled = \"$in{'sc_alt_origin_enabled'}\";\n";
+$myset .= "\$sc_alt_origin_db_counter = \"$sc_alt_origin_db_counter\";\n";
 $myset .= "\$sc_use_custom_shipping_logic = \"$in{'sc_use_custom_shipping_logic'}\";\n";
+$myset .= "\$sc_location_custom_shipping_logic = \"$in{'sc_location_custom_shipping_logic'}\";\n";
 $myset .= "\$sc_use_SBW2 = \"$in{'sc_use_SBW2'}\";\n";
 $sc_custom_shipping_logic = &my_escape($in{'sc_custom_shipping_logic'});
 $myset .= "\$sc_custom_shipping_logic = qq`$sc_custom_shipping_logic`;\n";
-$myset .= "#\n";
 $myset .= "\$sc_use_SBW = \"$in{'sc_use_SBW'}\";\n";
-$myset .= "\$sc_use_FEDEX = \"$in{'sc_use_FEDEX'}\";\n";
-$myset .= "\$sc_use_UPS = \"$in{'sc_use_UPS'}\";\n";
-$myset .= "\$sc_use_USPS = \"$in{'sc_use_USPS'}\";\n";
 $myset .= "\$sc_use_socket = \"$in{'sc_use_socket'}\";\n";
-$myset .= "\$sc_FEDEX_max_wt = \"$in{'sc_FEDEX_max_wt'}\";\n";
-$myset .= "\$sc_FEDEX_Origin_ZIP = \"$in{'sc_FEDEX_Origin_ZIP'}\";\n";
-$myset .= "\$sc_UPS_max_wt = \"$in{'sc_UPS_max_wt'}\";\n";
-$myset .= "\$sc_UPS_Origin_ZIP = \"$in{'sc_UPS_Origin_ZIP'}\";\n";
-$myset .= "\$sc_UPS_RateChart = \"$in{'sc_UPS_RateChart'}\";\n";
-$myset .= "\$sc_USPS_max_wt = \"$in{'sc_USPS_max_wt'}\";\n";
-$myset .= "\$sc_USPS_Origin_ZIP = \"$in{'sc_USPS_Origin_ZIP'}\";\n";
-$myset .= "\$sc_USPS_use_API = \"$in{'sc_USPS_use_API'}\";\n";
-$myset .= "\$sc_USPS_userid = \"$in{'sc_USPS_userid'}\";\n";
-$myset .= "\$sc_USPS_password = \"$in{'sc_USPS_password'}\";\n";
-$myset .= "\$sc_USPS_host_URL = \"$in{'sc_USPS_host_URL'}\";\n";
+  $myset .= "\$sc_use_UPS = \"$in{'sc_use_UPS'}\";\n";
+    $myset .= "\$sc_UPS_Origin_ZIP = \"$in{'sc_UPS_Origin_ZIP'}\";\n";
+    $myset .= "\$sc_UPS_max_wt = \"$in{'sc_UPS_max_wt'}\";\n";
+    $myset .= "\$sc_UPS_RateChart = \"$in{'sc_UPS_RateChart'}\";\n";
+    $myset .=  "\$sc_upsgroundres = \"$in{'sc_upsgroundres'}\";\n";
+    $myset .=  "\$sc_upsgroundcomm = \"$in{'sc_upsgroundcomm'}\";\n";
+    $myset .=  "\$sc_ups2da = \"$in{'sc_ups2da'}\";\n";
+    $myset .=  "\$sc_ups1da = \"$in{'sc_ups1da'}\";\n";
+    $myset .=  "\$sc_ups_non_xml_adjust = \"$in{'sc_ups_non_xml_adjust'}\";\n";
+    $myset .=  "\$sc_ups_non_xml_adjust_rate = \"$in{'sc_ups_non_xml_adjust_rate'}\";\n";
+
+$myset .= "\$sc_use_USPS = \"$in{'sc_use_USPS'}\";\n";
+  $myset .= "\$sc_USPS_max_wt = \"$in{'sc_USPS_max_wt'}\";\n";
+  $myset .= "\$sc_USPS_Origin_ZIP = \"$in{'sc_USPS_Origin_ZIP'}\";\n";
+  $myset .= "\$sc_USPS_use_API = \"$in{'sc_USPS_use_API'}\";\n";
+  $myset .= "\$sc_USPS_userid = \"$in{'sc_USPS_userid'}\";\n";
+  $myset .= "\$sc_USPS_password = \"$in{'sc_USPS_password'}\";\n";
+  $myset .= "\$sc_USPS_host_URL = \"$in{'sc_USPS_host_URL'}\";\n";
+  $myset2 .=  "\$sc_uspsparcelpost = \"$in{'sc_uspsparcelpost'}\";\n";
+  $myset2 .=  "\$sc_uspsprioritymail = \"$in{'sc_uspsprioritymail'}\";\n";
+  $myset2 .=  "\$sc_uspsexpressmail = \"$in{'sc_uspsexpressmail'}\";\n";
+  $myset2 .=  "\$sc_uspseconomyparcelpost = \"$in{'sc_uspseconomyparcelpost'}\";\n";
+  $myset2 .=  "\$sc_uspsairparcelpost = \"$in{'sc_uspsairparcelpost'}\";\n";
+  $myset2 .=  "\$sc_uspsglobexpmail = \"$in{'sc_uspsglobexpmail'}\";\n";
+  $myset2 .=  "\$sc_uspsglobexpgardoc = \"$in{'sc_uspsglobexpgardoc'}\";\n";
+  $myset2 .=  "\$sc_uspsglobexpgarrnd = \"$in{'sc_uspsglobexpgarrnd'}\";\n";
+
+
+# build shipping method stuff for cut and paste box.
+$sc_shiptomethod_4forms = "";
+$sc_shiptomethod_4forms .= "<SELECT NAME=Ecom_ShipTo_Method>";
+$sc_shiptomethod_4forms .= qq~\n<OPTION value="\$vform_Ecom_ShipTo_Method"><!--agorascript-pre~;
+$sc_shiptomethod_4forms .= qq~\n if ("\$vform_Ecom_ShipTo_Method" eq "") {~;
+$sc_shiptomethod_4forms .= qq~\n   return " Select Shipping Method ";~;
+$sc_shiptomethod_4forms .= qq~\n  } else {~;
+$sc_shiptomethod_4forms .= qq~\n   return "\$vform_Ecom_ShipTo_Method";~;
+$sc_shiptomethod_4forms .= qq~\n  }~;
+$sc_shiptomethod_4forms .= qq~\n--></OPTION>~;
+
+$sc_howmanycustomshippingmethods = $in{'sc_howmanycustomshippingmethods'};
+my $howmanycustomshippingmethod_temp = "0";
+my $myset3 = "\$sc_custom_shipping_methodname_string = \"";
+my $myset4 = "\$sc_custom_shipping_methoddescrip_string = \"";
+if ($sc_howmanycustomshippingmethods > 0) {
+  while ($howmanycustomshippingmethod_temp < $sc_howmanycustomshippingmethods) {
+    my $custom_shipping_methodname2 = "sc_custom_shipping_methodname" . "$howmanycustomshippingmethod_temp";
+    my $custom_shipping_methoddescrip2 = "sc_custom_shipping_methoddescrip" . "$howmanycustomshippingmethod_temp";
+
+    $myset3 .=  "$in{$custom_shipping_methodname2}|";
+    $myset4 .=  "$in{$custom_shipping_methoddescrip2}|";
+    if ($in{$custom_shipping_methodname2} ne "") {
+      $sc_shiptomethod_4forms .= qq~\n<OPTION VALUE="$in{$custom_shipping_methodname2}">
+      $in{$custom_shipping_methoddescrip2}</option>~;
+    }
+    $howmanycustomshippingmethod_temp++
+  }
+  $myset3 .=  "\";\n";
+  $myset4 .=  "\";\n";
+  $myset2 .=  "$myset3";
+  $myset2 .=  "$myset4";
+}
+
+if ($in{'sc_uspsparcelpost'} =~ /yes/i) {
+  $sc_shiptomethod_4forms .= qq~\n<OPTION VALUE="USPS Parcel Post (Parcel)">
+USPS Parcel Post (5-14 days)</option>~;
+}
+if ($in{'sc_uspsprioritymail'} =~ /yes/i) {
+  $sc_shiptomethod_4forms .= qq~\n<OPTION VALUE="USPS Priority Mail (Priority)">
+USPS Priority Mail (3-7 days)</option>~;
+}
+if ($in{'sc_uspsexpressmail'} =~ /yes/i) {
+  $sc_shiptomethod_4forms .= qq~\n<OPTION VALUE="USPS Express Mail (Express)">
+USPS Express Mail (1-3 days)</OPTION>~;
+}
+if ($in{'sc_uspseconomyparcelpost'} =~ /yes/i) {
+  $sc_shiptomethod_4forms .= qq~\n<OPTION VALUE="USPS (Economy \(Surface\) Parcel Post)">
+Economy (Surface) Parcel Post (4-6 weeks - international)</OPTION>~;
+}
+if ($in{'sc_uspsairparcelpost'} =~ /yes/i) {
+  $sc_shiptomethod_4forms .= qq~\n<OPTION VALUE="USPS (Airmail Parcel Post)">
+Airmail Parcel Post (4-10 days - international)</OPTION>~;
+}
+if ($in{'sc_uspsglobexpmail'} =~ /yes/i) {
+  $sc_shiptomethod_4forms .= qq~\n<OPTION VALUE="USPS (Global Express Mail)">
+Global Express Mail (3-5 days - international)</OPTION>~;
+}
+if ($in{'sc_uspsglobexpgardo'} =~ /yes/i) {
+  $sc_shiptomethod_4forms .= qq~\n<OPTION VALUE="USPS (Global Express Guaranteed Document Service)">
+Global Express Guaranteed - Document (2-3 days - international)</OPTION>~;
+}
+if ($in{'sc_uspsglobexpgarrnd'} =~ /yes/i) {
+  $sc_shiptomethod_4forms .= qq~\n<OPTION VALUE="USPS (Global Express Guaranteed Document Service)">
+Global Express Guaranteed - Non-Document (2-3 days - international)</OPTION>~;
+}
+
+if ($in{'sc_upsgroundres'} =~ /yes/i) {
+  $sc_shiptomethod_4forms .= qq~\n<OPTION VALUE="UPS Ground Residential(GNDRES)">UPS Ground Residential</OPTION>~;
+}
+if ($in{'sc_upsgroundcomm'} =~ /yes/i) {
+  $sc_shiptomethod_4forms .= qq~\n<OPTION VALUE="UPS Ground Commercial (GNDCOM)">UPS Ground Commercial</OPTION>~;
+}
+if ($in{'sc_ups2da'} =~ /yes/i) {
+  $sc_shiptomethod_4forms .= qq~\n<OPTION VALUE="UPS 2nd Day (2DA)">UPS 2nd Day</OPTION>~;
+}
+if ($in{'sc_ups1da'} =~ /yes/i) {
+  $sc_shiptomethod_4forms .= qq~\n<OPTION VALUE="UPS Next Day (1DA)">UPS Next Day</OPTION>~;
+}
+
+$sc_shiptomethod_4forms .= "\n</SELECT>";
 
 &update_store_settings('shipping',$myset); # main settings
 $myset = "";
+$myset2 .=  "\n1;\n";
+&update_Shipadmin_settings("$sc_shipadminfile",$myset2);
+&require_supporting_libraries(__FILE__,__LINE__,
+  "$mgrdir/misc/ship_admin.pl");
 &show_ship_settings_screen;
 }
 #############################################################################################
@@ -59,6 +218,9 @@
 {
 print &$manager_page_header("Shipping Settings","","","","");
 
+my $howmanycustomshippingmethod_temp = "0";
+
+#set some defaults
 if ($sc_debug_mode eq ""){
   $sc_debug_mode = "no";
  }
@@ -75,42 +237,54 @@
      $Lib_message .= "<FONT COLOR=RED>Couldn't load http-lib. " .   
                   "Choose one of the other options.</FONT><BR>";
     } 
-   $test_result = eval('&get_lynx_path("0")');
-   if ($test_result eq "") {
-     $Lib_message .= "<FONT COLOR=RED>Lynx was not found. " .     
-                  "Choose one of the other options.</FONT><BR>";
-    } 
 
 if ($sc_path_of_images_directory ne "") {
  $URL_of_images_directory = $sc_path_of_images_directory;
 }
 
+if ($sc_ship_thingy_p_id_indicator_enabled eq "") {
+ $sc_ship_thingy_p_id_indicator_enabled = "no";
+}
+
+
+if ($sc_ups_non_xml_adjust_rate eq '') {
+    $sc_ups_non_xml_adjust_rate = "1.04";
+}
+
+if ($sc_ups_non_xml_adjust eq '') {
+    $sc_ups_non_xml_adjust = "yes";
+}
+
+&require_supporting_libraries(__FILE__,__LINE__,
+  "$mgrdir/misc/ship_admin.pl");
+
 print <<ENDOFTEXT;
-<CENTER>
-<HR WIDTH=580>
-</CENTER>
 
 <CENTER>
-<TABLE WIDTH=580>
+<TABLE cellspacing=0 border=0>
+<TR>
+<TD><HR></TD>
+</TR>
 <TR>
-<TD WIDTH=580>
-<FONT FACE=ARIAL>Welcome to the <b>AgoraCart</b> System Manager
-Shipping Library settings.</TD>
+<TD bgcolor=#99CC99>
+<FONT FACE=ARIAL>Welcome to the <b>AgoraCart</b> Shipping Manager / Library settings.</TD>
+</TR>
+<TR>
+<TD bgcolor=#99CC99><HR></TD>
 </TR>
 </TABLE>
 </CENTER>
 
 ENDOFTEXT
 
-if($in{'system_edit_success'} ne "")
-{
+if ($in{'system_edit_success'} ne "") {
 print <<ENDOFTEXT;
-<CENTER>
+<br><CENTER>
 <TABLE>
 <TR>
-<TD>
+<TD><br>
 <FONT FACE=ARIAL SIZE=2 COLOR=RED>System settings have been 
-successfully updated. </FONT>
+successfully updated. </FONT><br><br>
 </TD>
 </TR>
 </TABLE>
@@ -120,26 +294,18 @@
 
 &make_lists_of_various_options;
 
-if ($sc_UPS_RateChart eq "") {
-  $sc_UPS_RateChart = "Regular Daily Pickup";
- }
-
 print <<ENDOFTEXT;
 
 <FONT FACE=ARIAL SIZE=2>
 <FORM METHOD="POST" ACTION="manager.cgi">
 <CENTER>
-<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
-
-<TR>
-<TD COLSPAN=2><HR></TD>
-</TR>
+<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0>
 
 <TR>
-<TD><b>In what loop of calculate_final_values do you wish to calculate
-the shipping?</b>&nbsp; If zero is selected, shipping will never be
-calculated.&nbsp; If 3 is selected, then the tax is based on the
-pre-shipping subtotal.&nbsp; Currently, if either 1 or 2 is selected, then
+<TD><b><b>In what loop</b> of calculate_final_values do you wish to calculate
+the shipping?</b><br>If zero is selected, shipping will never be
+calculated.<br>If 3 is selected, then the tax is based on the
+pre-shipping subtotal.<br>if either 1 or 2 is selected, then
 the tax is based on the subtotal of merchandise + shipping.
 </TD>
 
@@ -159,7 +325,7 @@
 </TR>
 
 <TR>
-<td>Handling Charge to be added to all orders.<br><small>No \$ Needed. Enter 0 if no handling charge is to be added to orders.</small></td>
+<td><b>Handling Charge to be added to all orders</b>.<br><small>No \$ Needed. Enter amount (2.75) or percentage of order (0.0635) you wish to add to orders.  Enter 0 if no handling charge is to be added to orders.</small></td>
 <TD>
 <INPUT NAME="sc_handling_charge" TYPE="TEXT" SIZE=5 MAXLENGTH="5"
 VALUE="$sc_handling_charge">
@@ -168,11 +334,27 @@
 </TR>
 
 <TR>
-<TD COLSPAN=2><HR></TD>
+<TD COLSPAN=2><br></TD>
 </TR>
 
 <TR>
-<td>Add handling Charge if shipping total is Zero?</td>
+<td><b>Handling Charge Type:</b><br><small>Flat Rate is a single charge no matter the size of order (default).  Percentage will charge a percentage of the total order as a handling fee</small></td>
+<TD>
+<SELECT NAME=sc_handling_charge_type>
+<OPTION>$sc_handling_charge_type</OPTION>
+<OPTION>Flat Rate</OPTION> 
+<OPTION>Percentage</OPTION> 
+</SELECT>
+</TD>
+</td>
+</TR>
+
+<TR>
+<TD COLSPAN=2><br></TD>
+</TR>
+
+<TR>
+<td><b>Add handling Charge if shipping total is Zero?</b></td>
 <TD>
 <SELECT NAME=sc_add_handling_cost_if_shipping_is_zero>
 <OPTION>$sc_add_handling_cost_if_shipping_is_zero</OPTION>
@@ -182,24 +364,73 @@
 </TD>
 </td>
 </TR>
+<TR>
+<TD COLSPAN=2><br></TD>
+</TR>
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+<TR>
+<TD COLSPAN="2" bgcolor=#99CC99>
+<b>Alternate Origins:</b>
+</TD>
+</TR>
+<TR>
+<TD COLSPAN=2 bgcolor=#99CC99><HR></TD>
+</TR>
+<TR>
+<td><br><b>Use Alternate Origins?</b>  Great for drop-shipped products and/or multiple shipping location shippers.  To use this, select a default origin for each shipping method default (UPS, USPS, etc), ususally where most of your products will ship from. Then in each individual product that ships from a different location, enter the origination zipcode / postal code for that particular product.  No limit to locations/origination points.  You <b>must</b> indicate (below) a user database field in the product database that you will use the postal codes in ... or it will not work!<br><i>Limitations:</i> Must be from same country and use same shipping methods... or simular methods (cannot compute multiple shipping methods without some extensive custom programming).</td>
+<TD>
+<SELECT NAME=sc_alt_origin_enabled>
+<OPTION>$sc_alt_origin_enabled</OPTION>
+<OPTION>yes</OPTION> 
+<OPTION>no</OPTION> 
+</SELECT>
+</TD>
+</td>
+</TR>
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<td><b>Which User field</b> in product database do you wish to use?</td>
+<TD>
+<SELECT NAME=sc_alt_origin_db_counter2>
+<OPTION>$sc_alt_origin_db_counter2</OPTION>
+<OPTION value="">None</OPTION>
+<OPTION>User 2</OPTION> 
+<OPTION>User 3</OPTION>
+<OPTION>User 4</OPTION>
+<OPTION>User 5</OPTION>
+$user10_thingy
+$user20_thingy
+</SELECT>
+</TD>
+</td></tr>
+
+<TR>
+<TD COLSPAN=2><br></TD>
+</TR>
 
 <TR>
 <TD COLSPAN=2><HR></TD>
 </TR>
 
 <TR>
-<TD COLSPAN="2">
+<TD COLSPAN="2" bgcolor=#99CC99>
 <b>Custom Shipping Logic:</b>
 </TD>
 </TR>
-
 <TR>
-<td>Use the custom shipping logic?  If yes, you may still use the
+<TD COLSPAN=2 bgcolor=#99CC99><HR></TD>
+</TR>
+<TR>
+<td><br><b>Use the custom shipping logic?</b>  If yes, you may still use the
 SBW module (perhaps some items are not appropriate for that 
-module and you
-desire to handle these differently.)&nbsp;  If Custom logic and SBW are 
+module and you desire to handle these differently).&nbsp;  If Custom logic and SBW are 
 both set to "no" then the "shipping" field in the database
-is the shipping price of the item.</td>
+is the shipping price of the individual items and added together for items in cart when customer checks out.</td>
 
 <TD>
 <SELECT NAME=sc_use_custom_shipping_logic>
@@ -209,9 +440,26 @@
 </SELECT>
 </TD>
 </TR>
+<TR>
+<TD COLSPAN=2 bgcolor=#99CC99><HR></TD>
+</TR>
+<TR>
+<td><br><b>When to run custom shipping logic?</b>  Select when to run custom shipping logic.  If you need to alter shipping rates after real-time rates have been provided, the select AFTER. Select BEFORE for default operations.  If using AFTER, there is a special variable to use that stores the value of realtime shipping costs that you can use in your shipping logic called \$SBW_shipping_price which allows you to alter or delete the costs of real time rates as you desire.</td>
+
+<TD>
+<SELECT NAME=sc_location_custom_shipping_logic>
+<OPTION>$sc_location_custom_shipping_logic</OPTION>
+<OPTION>before</OPTION> 
+<OPTION>after</OPTION> 
+</SELECT>
+</TD>
+</TR>
+<TR>
 
+<TD COLSPAN=2><HR></TD>
+</TR>
 <TR>
-<td>If using Custom Logic, is shipping measured by weight?  In other words, do you define total shipping price by total order weight within the custom shipping logic? If so, select yes</td>
+<td><b>If using Custom Logic, is shipping measured by weight?</b>  In other words, do you define total shipping price by total order weight within the custom shipping logic? If so, select yes</td>
 
 <TD>
 <SELECT NAME=sc_use_SBW2>
@@ -221,29 +469,123 @@
 </SELECT>
 </TD>
 </TR>
-
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
 <TR>
 <TD COLSPAN="2">
+<br> For examples of custom shipping logic, <a href="DOCS/shipping.txt" target="_new">Click Here</a>
 <TEXTAREA NAME="sc_custom_shipping_logic" 
-cols="68" rows=12 wrap=off>$sc_custom_shipping_logic</TEXTAREA> 
+cols="68" rows=12 wrap=off>$sc_custom_shipping_logic</TEXTAREA><br><br>
 </TD>
 </TR>
 
 <TR>
+<TD COLSPAN=2><br></TD>
+</TR>
+<TR>
 <TD COLSPAN=2><HR></TD>
 </TR>
-
 <TR>
-<TD COLSPAN=2>
-<b>Please enter the SBW (Ship By Weight) Shipping Module
-Information:</b><BR>
+<TD COLSPAN="2" bgcolor=#99CC99>
+<b>Custom Shipping Methods:</b>
 </TD>
 </TR>
+<TR>
+<TD COLSPAN=2 bgcolor=#99CC99><HR></TD>
+</TR>
+<TR>
+<td><br><b>How Many Custom Shipping Methods Do You Need?</b><br><small>These are shipping methods used on your order forms that are needed in addition to the Real Time shipping methods or as complete replacements.  Usually these custom methods are used in custom shipping logic for rating purposes.  Examples include: Local Delivery, Standard Delivery, Electronic Delivery, or any name you wish to use.  Select number needed, then save settings to dispaly the number of fields you need.</small></td>
+<TD>
+<SELECT NAME=sc_howmanycustomshippingmethods>
+<OPTION>$sc_howmanycustomshippingmethods</OPTION>
+<OPTION value="">None</OPTION> 
+<OPTION>1</OPTION>
+<OPTION>2</OPTION>
+<OPTION>3</OPTION>
+<OPTION>4</OPTION>
+<OPTION>5</OPTION>
+<OPTION>6</OPTION>
+<OPTION>7</OPTION>
+<OPTION>8</OPTION>
+<OPTION>9</OPTION>
+<OPTION>10</OPTION>
+<OPTION>11</OPTION>
+<OPTION>12</OPTION>
+<OPTION>13</OPTION>
+<OPTION>14</OPTION>
+<OPTION>15</OPTION>
+<OPTION>16</OPTION>
+<OPTION>17</OPTION>
+<OPTION>18</OPTION>
+<OPTION>19</OPTION>
+<OPTION>20</OPTION>
+<OPTION>21</OPTION>
+<OPTION>22</OPTION>
+<OPTION>23</OPTION>
+<OPTION>24</OPTION>
+<OPTION>25</OPTION>
+<OPTION>26</OPTION>
+<OPTION>27</OPTION>
+<OPTION>28</OPTION>
+<OPTION>29</OPTION>
+<OPTION>30</OPTION>
+</SELECT>
+</TD>
+</TR>
+<TR>
+<TD COLSPAN=2><br></TD>
+</TR>
+<TR>
+<TD COLSPAN=2> 
+ENDOFTEXT
+
+
+if ($sc_howmanycustomshippingmethods > 0) {
+while ($howmanycustomshippingmethod_temp < $sc_howmanycustomshippingmethods) {
+my ($custom_shipping_methodname2) = '';
+($custom_shipping_methodname2,$sc_custom_shipping_methodname_string) = split(/\|/,$sc_custom_shipping_methodname_string,2);
+($custom_shipping_methoddescrip2,$sc_custom_shipping_methoddescrip_string) = split(/\|/,$sc_custom_shipping_methoddescrip_string,2);
+my $custom_shipping_methodname = "sc_custom_shipping_methodname" . "$howmanycustomshippingmethod_temp";
+my $custom_shipping_methoddescrip = "sc_custom_shipping_methoddescrip" . "$howmanycustomshippingmethod_temp";
+
+print <<ENDOFTEXT;
+<small>Method Name: </small><INPUT NAME="$custom_shipping_methodname" TYPE="TEXT" SIZE=22 MAXLENGTH="35" VALUE="$custom_shipping_methodname2">
+&nbsp;&nbsp;<small>Name for Form Lists: </small><INPUT NAME="$custom_shipping_methoddescrip" TYPE="TEXT" SIZE=22 MAXLENGTH="35" VALUE="$custom_shipping_methoddescrip2"><br>
+ENDOFTEXT
+$howmanycustomshippingmethod_temp++;
+}
 
+} else {
+
+print <<ENDOFTEXT;
+</TD>
+</TR>
 <TR>
-<td>Use the SBW (Ship By Weight for FedEx/UPS/USPS) module?  If yes, then
-the "shipping" field in the database is a shipping weight (instead of 
-shipping price.)</td>
+<TD COLSPAN=2><small>No Custom Shipping Methods Available.  Please select the number needed above. If none needed, leave blank or at 0.<br></small></TD>
+</TR>
+ENDOFTEXT
+
+}
+
+print <<ENDOFTEXT;
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+
+<TR>
+<TD COLSPAN=2 bgcolor=#99CC99>
+<b>Real-Time SBW (Ship By Weight) Shipping Module Information:</b><BR>
+</TD>
+</TR>
+<TR>
+<TD COLSPAN=2  bgcolor=#99CC99><HR></TD>
+</TR>
+<TR>
+<td><br><b>Use the Live/Real-Time SBW (Ship By Weight for UPS/USPS) module?</b>  If yes, then
+the "shipping" field in the product database is a shipping weight (instead of 
+shipping price.).</td>
 <TD>
 <SELECT NAME=sc_use_SBW>
 <OPTION>$sc_use_SBW</OPTION>
@@ -252,94 +594,224 @@
 </SELECT>
 </TD>
 </TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
 <TR>
-<td colspan=2>Allow Shipments via which services:
+<td colspan=2><b>Allow Shipments via which services:</b><br><br>
 &nbsp;&nbsp;
-FedEx:<SELECT NAME=sc_use_FEDEX>
-<OPTION>$sc_use_FEDEX</OPTION>
-<OPTION>yes</OPTION> 
-<OPTION>no</OPTION> 
-</SELECT>
-&nbsp;&nbsp;&nbsp;&nbsp;
-UPS:<SELECT NAME=sc_use_UPS>
-<OPTION>$sc_use_UPS</OPTION>
-<OPTION>yes</OPTION> 
-<OPTION>no</OPTION> 
-</SELECT>
-&nbsp;&nbsp;&nbsp;&nbsp;
 USPS:<SELECT NAME=sc_use_USPS>
 <OPTION>$sc_use_USPS</OPTION>
+<OPTION>no</OPTION>
 <OPTION>yes</OPTION> 
-<OPTION>no</OPTION> 
-</SELECT><br>
-NOTE: Using the UPS interface requires that you be REGISTERED and 
-accept the LICENSE AGREEMENT.</TD>
-</TR>
+</SELECT>
+&nbsp;&nbsp;&nbsp;&nbsp;
+ENDOFTEXT
+
+  print "UPS (non-XML):<SELECT NAME=sc_use_UPS>
+  <OPTION>$sc_use_UPS</OPTION>
+  <OPTION>no</OPTION>
+  <OPTION>yes</OPTION>
+  </SELECT>";
+
+print <<ENDOFTEXT;
+</TD>
+</TR><TR><TD COLSPAN=2><HR></TD></TR>
 
 <TR>
-<td colspan=2>
-USPS API URL: <INPUT NAME="sc_USPS_host_URL" TYPE="TEXT" SIZE=60
-MAXLENGTH="75" VALUE="$sc_USPS_host_URL"><br>
-USPS API Userid: <INPUT NAME="sc_USPS_userid" TYPE="TEXT" SIZE=14
-MAXLENGTH="25" VALUE="$sc_USPS_userid">
-&nbsp;&nbsp;&nbsp;&nbsp;
-USPS API Password: <INPUT NAME="sc_USPS_password" TYPE="TEXT" SIZE=14
-MAXLENGTH="25" VALUE="$sc_USPS_password">
+<td colspan=2><b>Max weight per box</b> (lbs.)  If zero is entered, each item 
+customer selects is shipped it its own box. Max Weight per box is 150 lbs for UPS and 70 lbs for USPS<br><br>
+&nbsp;&nbsp;UPS: <INPUT NAME="sc_UPS_max_wt" TYPE="TEXT" SIZE=3 MAXLENGTH="3" VALUE="$sc_UPS_max_wt">
+&nbsp;&nbsp;&nbsp;&nbsp;USPS: <INPUT NAME="sc_USPS_max_wt" TYPE="TEXT" SIZE=3 MAXLENGTH="3"
+VALUE="$sc_USPS_max_wt">
+ENDOFTEXT
+
+print <<ENDOFTEXT;
 </TD>
 </TR>
 
-<TR> <td> $Lib_message How do you wish to connect to FedEx/UPS/USPS?  If
+<TR>
+<TD><br><b>Display Product ID number in recommended box packing order?</b><br>
+When a customer orders enough product to warrant additional boxes over the maximum weight per box as set above, you can display the product database ID number in front of the product name of each product listed per each recommended box pack order (which is very guesstimate in nature).
+</TD>
+
+<TD>
+<SELECT NAME="sc_ship_thingy_p_id_indicator_enabled">
+<OPTION>$sc_ship_thingy_p_id_indicator_enabled</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT>
+</TD>
+</TR>
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+<TR> <td> $Lib_message How do you wish to connect to UPS (non-XML) / USPS XML?  If
 perl is installed in a fairly modern way, then the LWP library should be
-present. If not, then the http-lib has been included here as a backup.  If
-for some reason perl sockets have not been setup properly, then you should
-complain to your web hosting company to get with the program!</td>
+present. If not, then the http-lib has been included here as a backup.  Note: UPS (non-XML) works only on http-lib.  USPS XML works on both.<br>
+</td>
 <TD> 
  <SELECT NAME=sc_use_socket>
  <OPTION>$sc_use_socket</OPTION> 
  <OPTION>LWP</OPTION>
  <OPTION>http-lib</OPTION> 
- <OPTION>lynx</OPTION> 
  </SELECT></TD> 
 </TR>
+ENDOFTEXT
 
+if (($sc_use_USPS =~ /yes/i)||($sc_use_USPS eq '')) {
+print <<ENDOFTEXT;
 <TR>
-<td colspan=2>Max weight per box (lbs.)  If zero is entered, each item 
-is shipped it its own box.<br>
-FedEx: <INPUT NAME="sc_FEDEX_max_wt" TYPE="TEXT" SIZE=3 MAXLENGTH="3"
-VALUE="$sc_FEDEX_max_wt">
-&nbsp;&nbsp;&nbsp;&nbsp;
-UPS: <INPUT NAME="sc_UPS_max_wt" TYPE="TEXT" SIZE=3 MAXLENGTH="3"
-VALUE="$sc_UPS_max_wt">
+<TD COLSPAN=2><HR></TD>
+</TR>
+<TR>
+<TD COLSPAN=2 bgcolor=#99CC99>
+<b>USPS - United States Postal Service</b>
+</TD>
+</TR>
+<TR>
+<TD COLSPAN=2 bgcolor=#99CC99><HR></TD>
+</TR>
+<TR>
+<td colspan=2><br>
+<small>note: using the USPS interface requires that you be registered and 
+ACCEPT the license agreement.<br>You must also call or email USPS customer support in order to get your account switched to the production server.  This software has already been tested, so you do not need to perform testing in most cases. See the USPS site for more information.  All USPS real-time shipping methods require USPS in the name of the method.<br><br>
+the production URL is currently:  http://production.shippingapis.com/ShippingAPI.dll</small><br><br>
+USPS API URL: <INPUT NAME="sc_USPS_host_URL" TYPE="TEXT" SIZE=60
+MAXLENGTH="75" VALUE="$sc_USPS_host_URL"><br>
+USPS API Userid: <INPUT NAME="sc_USPS_userid" TYPE="TEXT" SIZE=14
+MAXLENGTH="25" VALUE="$sc_USPS_userid">
 &nbsp;&nbsp;&nbsp;&nbsp;
-USPS: <INPUT NAME="sc_USPS_max_wt" TYPE="TEXT" SIZE=3 MAXLENGTH="3"
-VALUE="$sc_USPS_max_wt">
+USPS API Password: <INPUT NAME="sc_USPS_password" TYPE="TEXT" SIZE=14
+MAXLENGTH="25" VALUE="$sc_USPS_password"><br>
+USPS ORIGIN ZIP: <INPUT NAME="sc_USPS_Origin_ZIP" TYPE="TEXT" SIZE=5
+MAXLENGTH="5" VALUE="$sc_USPS_Origin_ZIP"><br><br>
+Do you offer USPS Parcel Post: <SELECT NAME="sc_uspsparcelpost">
+<OPTION>$sc_uspsparcelpost</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT><br>
+Do you offer USPS Priority Mail: <SELECT NAME="sc_uspsprioritymail">
+<OPTION>$sc_uspsprioritymail</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT><br>
+Do you offer USPS Express Mail: <SELECT NAME="sc_uspsexpressmail">
+<OPTION>$sc_uspsexpressmail</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT><br><br>
+International (Outside of US & PR) Shipping Options:<br>
+Do you offer USPS Economy (Surface) Parcel Post: <SELECT NAME="sc_uspseconomyparcelpost">
+<OPTION>$sc_uspseconomyparcelpost</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT><br>
+Do you offer USPS <OPTION VALUE="USPS (Airmail Parcel Post)">
+Airmail Parcel Post 4-10 days: <SELECT NAME="sc_uspsairparcelpost">
+<OPTION>$sc_uspsairparcelpost</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT><br>
+Do you offer USPS <OPTION VALUE="USPS (Global Express Mail)">
+Global Express Mail 3-5 days: <SELECT NAME="sc_uspsglobexpmail">
+<OPTION>$sc_uspsglobexpmail</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT><br>
+Do you offer USPS Global Express Guaranteed - Document 2-3 days: <SELECT NAME="sc_uspsglobexpgardoc">
+<OPTION>$sc_uspsglobexpgardoc</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT><br>
+Do you offer USPS Global Express Guaranteed - Non-Document 2-3 days: <SELECT NAME="sc_uspsglobexpgarrnd">
+<OPTION>$sc_uspsglobexpgarrnd</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT><br>
 </TD>
 </TR>
+ENDOFTEXT
+}
 
+if (($sc_use_UPS =~ /yes/i)||($sc_use_UPS eq '')) {
+print <<ENDOFTEXT;
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+<TR>
+<TD COLSPAN=2 bgcolor=#99CC99>
+<b>UPS - United Parcel Service</b>
+</TD>
+</TR>
 <TR>
-<td colspan=2>Origination of shipments:<br>
-FedEx ZIP: <INPUT NAME="sc_FEDEX_Origin_ZIP" TYPE="TEXT" SIZE=5
-MAXLENGTH="5" VALUE="$sc_FEDEX_Origin_ZIP">
+<TD COLSPAN=2 bgcolor=#99CC99><HR></TD>
+</TR>
+<TR>
+<td colspan=2>
 <br>
-UPS ZIP: <INPUT NAME="sc_UPS_Origin_ZIP" TYPE="TEXT" SIZE=5 MAXLENGTH="5"
-VALUE="$sc_UPS_Origin_ZIP">&nbsp;&nbsp;&nbsp;&nbsp;
-UPS Pickup: <SELECT NAME="sc_UPS_RateChart">
+ENDOFTEXT
+
+print <<ENDOFTEXT;
+<b>Note:</b> <small>this UPS module is not the most accurate version and should be used for approximations only.  please use the "members only" UPS XML version for more accurate rating services.</small><br><br>
+
+UPS ORIGIN ZIP: <INPUT NAME="sc_UPS_Origin_ZIP" TYPE="TEXT" SIZE=5 MAXLENGTH="5"
+VALUE="$sc_UPS_Origin_ZIP"><br>
+UPS Pickup Type: <SELECT NAME="sc_UPS_RateChart">
    <OPTION VALUE="$sc_UPS_RateChart">$sc_UPS_RateChart</OPTION>
    <OPTION VALUE="Regular Daily Pickup">Regular Daily Pickup
    <OPTION VALUE="On Call Air">On Call Air
    <OPTION VALUE="One Time Pickup">One Time Pickup
    <OPTION VALUE="Letter Center">Letter Center
    <OPTION VALUE="Customer Counter">Customer Counter
+</SELECT><br><br>
+
+<br><b>Select Shipping Methods that you offer:</b><br>
+
+UPS Ground Residential: <SELECT NAME=sc_upsgroundres>
+<OPTION>$sc_upsgroundres</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT><br>
+
+UPS Ground Commercial: <SELECT NAME=sc_upsgroundcomm>
+<OPTION>$sc_upsgroundcomm</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT><br>
+
+UPS 2nd Day: <SELECT NAME=sc_ups2da>
+<OPTION>$sc_ups2da</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT><br>
+
+UPS Next Day: <SELECT NAME=sc_ups1da>
+<OPTION>$sc_ups1da</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT><br>
+<br><hr><br>
+
+Adjust UPS rates up or down from the quote?<br><small>will use percentage entered below to adjust the rate of shipping up or down.  Enable if the rates differ from what you actually pay for the shipment charges. Default is yes.</small> <SELECT NAME=sc_ups_non_xml_adjust>
+<OPTION>$sc_ups_non_xml_adjust</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
 </SELECT>
-<br>
-USPS ZIP: <INPUT NAME="sc_USPS_Origin_ZIP" TYPE="TEXT" SIZE=5
-MAXLENGTH="5" VALUE="$sc_USPS_Origin_ZIP">
+Enter Percentage to adjust by:<br><small>Will be a percentage of the shipping cost.  Can be negative to deduct from the shippign cost. Max of 7 characters can be entered.</small><br> <INPUT NAME="sc_ups_non_xml_adjust_rate" TYPE="TEXT" SIZE=7 MAXLENGTH="7"
+VALUE="$sc_ups_non_xml_adjust_rate"><br><br>
+ENDOFTEXT
+}
+
+print <<ENDOFTEXT;
 </TD>
 </TR>
 
 <TR>
 <TD COLSPAN=2><HR></TD>
-</TR>
+</TR>-->
 
 <TR>
 <TD COLSPAN=2>
@@ -363,7 +835,37 @@
 </CENTER>
 </FORM>
 ENDOFTEXT
+
+print <<ENDOFTEXT;
+<CENTER>
+For your convenience, here is the shipping options pre built to place within your order forms.<br>NOTE: If no code appears, please hit the submit button when ready and the<br>code will be compiled from the realtime and custom options selected above for your use.<br><b>Cut and paste</b> the code below into your order forms for the gateways you wish to use:<br>
+<FORM>
+<TEXTAREA 
+NAME="Ecom_XCOMMENT_Special_Notes" 
+COLS="50" ROWS="10" 
+WRAP="SOFT">$sc_shiptomethod_4forms</TEXTAREA>
+</FORM>
+<CENTER>
+ENDOFTEXT
 print &$manager_page_footer;
 }
-#############################################################################################
+#######################################################################################
+sub update_Shipadmin_settings {
+  local($item,$stuff) = @_;
+  $shipadmin_file_settings{$item} = $stuff;
+local($shipadmin_settings) = "$mgrdir/misc/ship_admin.pl";
+  local($item,$zitem);
+
+  &get_file_lock("$shipadmin_settings.lockfile");
+  open(SHIPADMINFILE,">$shipadmin_settings") || &my_die("Can't Open $shipadmin_settings");
+  foreach $zitem (sort(keys %shipadmin_file_settings)) {
+    $item = $zitem;
+     print (SHIPADMINFILE $shipadmin_file_settings{$zitem});
+   }
+  close(SHIPADMINFILE);
+  &release_file_lock("$shipadmin_settings.lockfile");
+&require_supporting_libraries(__FILE__,__LINE__,
+  "$mgrdir/misc/ship_admin.pl");
+ }
+#######################################################################################
 1; #Library
diff -ruN 4.0K-4b/protected/store_admin_actions.pl 5.0.000/protected/store_admin_actions.pl
--- 4.0K-4b/protected/store_admin_actions.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/protected/store_admin_actions.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,9 +1,6 @@
 ###############################################################################
-# This file contains the action logic for the store admin program
 #
-###############################################################################
-#
-$versions{'store_admin_actions.pl'} = "20040121";
+$versions{'store_admin_actions.pl'} = "5.0.000";
 #
 ###############################################################################
 sub upcase {
@@ -28,7 +25,6 @@
  }
 ###############################################################################
 sub register_menu {
-# link the incoming POST info to a subroutine to process it
   local ($name, $action_subroutine, $module, $description) = @_;
   local ($continue) = "";
   &codehook("register-manager-menu-item");
@@ -70,11 +66,9 @@
 &display_login;
 &call_exit;
 }
-
 }
 ###############################################################################
 sub make_random_chars {
-# name says it all
  local ($part1,$part2,$valid_chars,$chars,$inx);
  $part1 = "abcdefghijklmnopqrstuvwxyz";
  $part2 = $part1;
@@ -101,23 +95,19 @@
   close(FILE);
 }
 ###############################################################################
-sub my_escape { #escape out chars used in qq stuff
-
+sub my_escape { 
  local ($logic) = @_;
-
  $logic =~ s/\\/\\\\/g;
  $logic =~ s/\$/\\\$/g;
  $logic =~ s/\@/\\\@/g;
  $logic =~ s/\"/\\\"/g;
+ $logic =~ s/\'/\\\'/g;
 $logic =~ s/\#/\\\#/g;  # Blocks response from PayPal
 $logic =~ s/\+/\\\+/g;  # Used as the space character
 $logic =~ s/\&/\\\&/g;  # Used as the new variable delimiter
 $logic =~ s/\%/\\\%/g;  # Used as the hex character delimiter
 $logic =~ s/\?/\\\?/g;  # Used as the begin variable delimiter
-
-#delete control-M (^M)
  $logic =~ s/\r//g;
-
  return $logic;
 }
 #######################################################################################
@@ -145,21 +135,14 @@
  &call_exit;
 }
 ################################################################################
-sub action_commando{ # simulate "telnet" command line executions
+sub action_commando{ 
  local($result)="";
-
- if ($in{'command'} ne "") { #perform the command
-  # Totally bogus.  Untaint everything.  Wow.  Well, they should know
-  # what they are doing, right?  I mean they have to type it in and they
-  # have to have the directory password so ...
+ if ($in{'command'} ne "") { 
    $in{'command'} =~ /([^\n]+)/;
    $zcommand = $1;
    $result = `$zcommand`;
   }
-# this is a combo edit/results screen  
-
 print &$manager_page_header("COMMANDO!","","","","");
-
 print <<ENDOFTEXT;
 <CENTER>
 <TABLE WIDTH=500 BORDER=0 CELLPADDING=2>
@@ -192,48 +175,25 @@
 </TABLE>
 ENDOFTEXT
 print &$manager_page_footer;
- 
  }
 ################################################################################
-
 sub init_convert_menu_item
 {
 local($str, @lines, @my_items);
 local($kount,$inx,$action,$display,$procname,$junk);
-
 $manager_banner_main = 
  "AgoraCart " .
- '<FONT COLOR=RED>D</FONT>' .
- '<FONT COLOR=GREEN>E</FONT>' .
- '<FONT COLOR=BLUE>L</FONT>' .
- '<FONT COLOR=GOLD>U</FONT>' .
- '<FONT COLOR=MAGENTA>X</FONT>' .
- '<FONT COLOR=SILVER>E</FONT>' .
- " Store Manager ver. $versions{'manager'}";
+ " Store Manager ver $versions{'manager.cgi'}";
 
 $manager_banner = 
-'<A HREF="http://www.adwarebanners.com/ads/ads.pl?banner=NonSSI;page=agoracart;zone=agoracart" target="_new"><IMG SRC="http://www.adwarebanners.com/ads/ads.pl?page=agoracart;zone=agoracart" WIDTH=468 HEIGHT=60 BORDER=0></A>' .
- '<FONT FACE=ARIAL><STRONG><h2>AgoraCart ' .
- '<FONT COLOR=RED>D</FONT>' .
- '<FONT COLOR=GREEN>E</FONT>' .
- '<FONT COLOR=BLUE>L</FONT>' .
- '<FONT COLOR=GOLD>U</FONT>' .
- '<FONT COLOR=MAGENTA>X</FONT>' .
- '<FONT COLOR=SILVER>E</FONT>' .
- " Store Manager ver. $versions{'manager'}</h2></STRONG></FONT>";
-
- if (-e "$mgrdir/.htaccess" ) {
+ '<div align=center><FONT FACE=ARIAL size=+2><STRONG>AgoraCart ' .
+ " Store Manager ver $versions{'manager.cgi'}</STRONG></FONT></div>";
+if (-e "$mgrdir/.htaccess" ) {
   $ht_menu = "";
- } else {
-  $ht_menu = "<FONT FACE=ARIAL SIZE=2><A HREF=manager.cgi?" .
-             "htaccess_screen=yes>" .
-             "htaccess protect the /$mgrdirname directory " .
-             'where this program is running ' .
-             "</A>&nbsp;&nbsp;</FONT><br>";
- }
-
-$str = "<CENTER><TABLE WIDTH=550 BORDER=0>\n";
-$str = "<TR WIDTH=550 BORDER=0><TD WIDTH=550 BORDER=0><CENTER>\n";
+} else {
+  $ht_menu = qq~<b><a href="manager.cgi?htaccess_screen=yes">htaccess protect the /$mgrdirname directory where this program is running</a></b><br />~;
+}
+$str = qq~<br><div class="manager_menu">\n~;
 $str .= $ht_menu;
 $kount = 0;
 foreach $inx (sort(keys %top_menu)) {
@@ -241,36 +201,30 @@
   $display = $top_menu_name{$inx};
   ($procname,$junk) = split(/\=/,$action,2);
   if ($menu_items_disabled{$procname} eq '') {
-    $str .= "<FONT FACE=ARIAL SIZE=2><A HREF=manager.cgi?$action>";
-    $str .= "$display</A>&nbsp;&nbsp;</FONT>\n";
+    $str .= qq~\n<a href="manager.cgi?$action">$display</a>&nbsp;&nbsp;~;
     $kount++;
     if ($kount == $mc_max_top_menu_items) {
       $kount = 0;
-      $str .= "<br>\n";
+      $str .= "\n<br />";
      }
    }
  }
-
- $str .= "</CENTER>\n</TD></TR></TABLE></CENTER>\n";
-
+ if (substr($str,-6) ne "<br />")
+ {
+   $str .= "\n<br />";
+ }
+ $str .= qq~\n<a href="manager.cgi?log_out=yes">Log Out</a>~;
+ $str .= "</div>"; 
 $manager_menu = $str;
-
 }
 #######################################################################################
-
 sub encryptit {
   local ($mytime, $salt, $my_ans);
   local ($pass) = @_;
-
   $mytime =  time();
   $mytime =  "$mytime";
-
-# not secure enough for an OS, but fine for
-# something run once in a while
-
   $salt = substr($mytime,length($mytime)-2,2);
   $my_ans = crypt($mytime,$salt); 
-# now get the new salt for encryption ...
   $salt = substr($my_ans,length($my_ans)-2,2);
   $my_ans = crypt($pass,$salt);
   return ($my_ans);
@@ -310,25 +264,21 @@
 close(SETTINGS);
 }
 undef(%store_settings);
-if ($everything =~ /#:#: end/i) { # new style file
+if ($everything =~ /#:#: end/i) { 
   while ($everything =~ /#:#: end/i) {
     ($junk,$everything) = split(/#:#:#: start /i,$everything,2);
-#    ($name,$everything) = split(/( settings)([^\n]+)(\n)/i,$everything,2);
     ($name,$everything) = split(/ settings/i,$everything,2);
     ($junk,$everything) = split(/\n/i,$everything,2);
     ($stuff,$everything) = split(/#:#:#: end/i,$everything,2);
     $name =~ tr/a-z/A-Z/;
     $store_settings{$name} = $stuff;
    }
- # and by default we need to set the MAIN vars
   $store_settings{'MAIN'} =~ /([^\xFF]*)/;
   $temp = $1;
   eval($temp);
   $mc_path_for_cookie = $sc_path_for_cookie . "/$mgrdirname";
- } else { #old style, everything is for the main program
+ } else { 
   &update_store_settings('MAIN',$everything);
- # also need to load in the other files that belong here now
- # old pgp user lib
   $user_settings = "./admin_files/pgp_user_lib.pl";
 {
   open(SETTINGS,"$user_settings");
@@ -366,7 +316,6 @@
 sub save_store_settings {
   local($user_settings) = "./admin_files/agora_user_lib.pl";
   local($myset,$item,$zitem);
-
   &get_file_lock("$user_settings.lockfile");
   open(SETTINGS,">$user_settings") || &my_die("Can't Open $user_settings");
   $myset  = "## This file contains the user specific variables\n";
@@ -388,25 +337,21 @@
   local($item,$stuff) = @_;
   $item =~ tr/a-z/A-Z/;
   $store_settings{$item} = $stuff;
-  &save_store_settings;# need save them all!
+  &save_store_settings;
  }
 #######################################################################################
 sub action_htaccess_settings
 {
 local ($my_message, $my_ans, $my_str, $junk, $pwd, $old_path);
-
 &ReadParse;
-
 $old_path = $ENV{"PATH"};
 $ENV{"PATH"}="/bin:/usr/bin";
 $pwd = `pwd`;
-if (length($pwd) < 4) { #sanity check ... use our name to get path
+if (length($pwd) < 4) { 
   ($pwd,$junk) = (/\/$mgrdirname/,$ENV{'SCRIPT_FILENAME'},2);
  }
 chomp($pwd);
 $my_file = $pwd . "/$mgrdirname/manager.access";
-#$ENV{"PATH"} = $old_path;
-
 $my_str = qq!#
 #Options All
 
@@ -419,38 +364,31 @@
 require valid-user
 </Limit>     
 !;
-
 $my_saveumask = umask $original_umask;
+# fix this on some servers. Mister Ed June 26, 2006
+if ($my_saveumask =~ /18|63/) {
+    umask 0022;
+}
 open (PSETTINGS, "> $mgrdir/.htaccess");
 print (PSETTINGS $my_str);
 close (PSETTINGS);
-
 $username = $in{'username'};
 $password = $in{'password'};
-
 $stuff = $username . ":" . &encryptit($password) . "   \n";
-
 open (PSETTINGS, "> $mgrdir/manager.access");
 print (PSETTINGS $stuff);
 close (PSETTINGS);
-umask $my_saveumask;
-
+ umask $my_saveumask;
 &init_convert_menu_item;
 &welcome_screen;
-
 }
-
 #######################################################################################
 sub clear_order_log
 {
 local ($logfile,$count);
-
-# set umask and file name
 require "./admin_files/agora_user_lib.pl";
-
 $logfile = "$sc_logs_dir/$sc_order_log_name";
 $count = $in{'bytes'};
-
 if ($count > 0 ) {
   &get_file_lock("$logfile.lockfile");
   open (LOGFILE, "$logfile") || print "";
@@ -463,27 +401,48 @@
   close(LOGFILE);
   &release_file_lock("$logfile.lockfile");
  }
-
 &init_convert_menu_item;
 &display_order_log;
-
 }
-
 #######################################################################################
 sub clear_error_log
 {
 local ($logfile);
-
 $logfile = "./log_files/error.log";
-
 unlink($logfile);
 open (LOGFILE, ">$logfile") || print "";
 close(LOGFILE);
-
 &init_convert_menu_item;
 &display_error_log;
-
 }
-
+#######################################################################################
+sub clear_access_log
+{
+local ($logfile);
+$logfile = "./log_files/access.log";
+unlink($logfile);
+open (ACCESSFILE, ">$logfile") || print "";
+close(ACCESSFILE);
+&init_convert_menu_item;
+&tracking_screen;
+}
 #############################################################################
+# Added by Mister Ed (K-Factor Technologies, Inc) 10/17/2003
+sub my_stripout { 
+ local ($logic) = @_;
+ $logic =~ s/\`//g;
+ $logic =~ s/\\//g;
+ $logic =~ s/\$//g;
+ $logic =~ s/\@//g;
+$logic =~ s/\%//g;  
+$logic =~ s/\n//g;
+$logic =~ s/\#/\\\#/g; 
+ $logic =~ s/\"/\\\"/g;
+ $logic =~ s/\'/\\\'/g;
+$logic =~ s/\&/\\\&/g;  
+$logic =~ s/\?/\\\?/g;
+ $logic =~ s/\r//g;
+ return $logic;
+}
+###############################################################################
 1;
diff -ruN 4.0K-4b/protected/store_admin_html.pl 5.0.000/protected/store_admin_html.pl
--- 4.0K-4b/protected/store_admin_html.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/protected/store_admin_html.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,17 +1,19 @@
 ######################################################################################
 # This file contains the HTML for the store admin screens
 ######################################################################################
-
-$versions{'store_admin_html.pl'} = "20040121";
-
-if ($mc_max_top_menu_items eq '') { # set the default
+$versions{'store_admin_html.pl'} = "5.0.000";
+&require_supporting_libraries(__FILE__,__LINE__,
+  "$mgrdir/misc/mgr_miscmain.pl");
+if ($mc_max_top_menu_items eq '') { 
   $mc_max_top_menu_items = 6;
  }
-&add_item_to_manager_menu("View Orders","order_log=yes","");
+&add_item_to_manager_menu("View New Orders","order_log=yes","");
 &add_item_to_manager_menu("Error Log","error_log=yes","");
-&add_item_to_manager_menu("Tracking","tracking_screen=yes","");
-&add_item_to_manager_menu("Log Out","log_out=yes","");
+if ($mgr_shall_i_log_accesses =~ /yes/i) {
+  &add_item_to_manager_menu("Tracking","tracking_screen=yes","");
+}
 if ($commando_ok =~ /yes/i) {
+$commando_ok = "yes";
   &add_item_to_manager_menu("Commando","commando=yes","");
  }
 ###############################################################################
@@ -29,7 +31,6 @@
 #########################################################################
 sub make_lists_of_various_options{
 local (@glist,@dblibs,@zlist,$item,$item_lc);
-
 opendir (USER_LIBS, "./library");
 @dblibs = sort(grep(/_db_lib\.pl\b/i,readdir(USER_LIBS)));
 closedir (USER_LIBS);
@@ -61,13 +62,11 @@
 }
 #########################################################################
 sub parse_image_string{
-
  local ($str) = @_;
  local ($image,$junk);
-
  ($junk,$image) = split(/\<IMG SRC=\"/i,$str,2);# keep part up to the "
  ($image,$junk) = split(/\"/,$image,2);# discard " and anything after
-
+# >
  $image =~ s/.*%%URLofImages%%\///g;
  $image =~ s/.*Html\/Images\///g;
  $image =~ s/.*html\/Images\///g;
@@ -75,27 +74,19 @@
  $image =~ s/.png.*/.png/g;
  $image =~ s/.gif.*/.gif/g;
  $image =~ s/.jpg.*/.jpg/g;
-
  return $image;
-
 }
-
 #########################################################################
 sub create_image_string{
-
  local ($str) = @_;
  local ($image,$junk);
-
  $image = $sc_image_string_template;
  $image =~ s/%%image%%/$str/ig;
-
  return $image;
-
 }
 #########################################################################
 sub PageHeader {
 print <<ENDOFTEXT;
-
 <HTML>
 <BODY BGCOLOR=WHITE>
 <CENTER>
@@ -114,26 +105,20 @@
 <B>Price</B>
 </TD>
 </TR>
-
 ENDOFTEXT
 }
-
 #######################################################################################
 sub PageFooter
 {
-
 print <<ENDOFTEXT;
-
 </TABLE>
 </CENTER>
 ENDOFTEXT
 print &$manager_page_footer;
-
 }
 #######################################################################################
 sub display_login
 {
-
   opendir (USER_LOGINS, "$ip_file_dir"); 
   @myfiles = grep(/\.login/,readdir(USER_LOGINS)); 
   closedir (USER_LOGINS);
@@ -145,30 +130,21 @@
       unlink("$my_path");
      }
    }
-
 print <<ENDOFTEXT;
-
 <HTML>
 <HEAD>
 <TITLE>Build an online store with AgoraCart</TITLE>
-
 <META NAME="description" CONTENT="FREE shopping cart software - AgoraCart"> 
 <META NAME="keywords" CONTENT="free, shopping cart, e-commerce, software, perl, 
 database, easy, secure, store, dynamic, web based, c, c++, javascript, html">
-
 </HEAD>
 <BODY BGCOLOR="WHITE">
-
 <CENTER>
-
 $manager_banner
-
 </CENTER>
-
 <FORM METHOD=POST ACTION=manager.cgi>
 <CENTER>
 <TABLE WIDTH=500 BORDER=0 CELLPADDING=2>
-
 <TR>
 <TD COLSPAN=2>
 <HR WIDTH=550>
@@ -242,15 +218,14 @@
 </CENTER>
 ENDOFTEXT
 print &$manager_page_footer;
-
 }
 ################################################################################
 sub std_manager_footer_code {
 local ($text);
 $text = <<ENDOFTEXT;
 <center>
-<small>Copyright 1999-2004 K-Factor Technologies Inc. at <a href="http://www.agoracart.com">AgoraCart.com</a><br>
-Distributed under the GPL.</small>
+<small>Copyright 1999 to Present K-Factor Technologies Inc. at <a href="http://www.agoracart.com">AgoraCart.com</a> & 
+<a href="http://www.k-factor.net">K-Factor.net</a></small>
 </center>
 ENDOFTEXT
 &codehook("manager_footer_code");
@@ -262,34 +237,336 @@
   local ($ztitle,$header_code,$body_tag,$messages,$err_msgs) = @_;
   local ($my_header);
   local ($errs) = &html_eval_settings;
-
-  $title = "Agora Manager";
+  $title = "AgoraCart Manager";
   if ($ztitle ne "") {
     $title .= " - " . $ztitle;
-   }
+  }
   if ($body_tag eq "") {
     $body_tag = $mc_standard_body_tag;
-   }
+  }
+my $imageURLthingy = "images";
+my $temp_store_url_checker = "${sc_domain_name_for_cookie}";
+if ((($sc_self_serve_images =~ /no/i) && (($temp_store_url_checker =~ /cgi/i) && ($temp_store_url_checker =~ /bin/i))) || ($sc_self_serve_images =~ /yes/i) || (($sc_self_serve_images =~ /no/i) && (($sc_store_url =~ /cgi/i) && ($sc_store_url =~ /bin/i)))) {
+  $imageURLthingy = "manager.cgi?picserve=";
+} 
 
   $my_header =  <<ENDOFTEXT;
-<HTML>
-<HEAD>
-<TITLE>$title</TITLE>
-<META NAME="description" CONTENT="FREE shopping cart software - AgoraCart"> 
-<META NAME="keywords" CONTENT="free, shopping cart, e-commerce, software, perl, 
-database, easy, secure, store, dynamic, javascript, html">
+<!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=iso-8859-1"/>
+    <title>$title</title>
 $header_code
-</HEAD>
+<style>
+body{
+  font-family: Verdana, Arial, Helvetica, sans-serif;
+  margin: 0px;
+  padding: 0px;
+}
+.top_banner{
+  text-align: center;
+  vertical-align : middle;
+}
+/*~~~ Folder Tabs Along the Top ~~~*/
+table.folders{
+  padding-left:5px;
+}
+tr.folder_tabs{
+  font-size: 10px;
+  color: #ffcc00;
+  background-image : url($imageURLthingy/agora-cart-button-bg.jpg);
+  height: 28px;
+  text-align:center;
+}
+td.first{
+  padding-left:10px;
+}
+
+/* ~~~ Top Links just below the folder tabs ~~~ */
+.top_links{
+  font-size: 11px;
+  color: #ffcc00; 
+  background-image : url($imageURLthingy/button-bar-bg.jpg);
+  padding: 0px 0px 5px 225px;
+  height: 33px;
+  text-align: center;
+}
+/* ~~~ Left Menu Links ~~~ */
+.left_menu{
+  background-color: #257B29;
+  font-size: 10px;
+  width: 175px;
+  color: #FFCC00;
+  padding: 10px 0px 20px 10px;
+  vertical-align : top;
+}
+.lm_first{
+  font-size: 11px;
+  padding-left: 2px;
+  margin: 10px 0px 0px 0px;
+  font-weight: bold;
+}
+/* ~~~ Main Body parts ~~~ */
+img{
+  border: 0px;
+}
+img.border{
+  border: 1px;
+}
+.main_body{
+  vertical-align : top;
+  padding: 10px 10px 10px 10px;
+  font-size: 9pt;
+  text-align : justify;
+}
+.main_text{
+  padding: 20px 10px 5px 10px;
+  text-align: justify;
+  vertical-align : top;
+}
+.main_text2{
+  padding: 6px 6px 6px 6px;
+  font-size: 10pt;
+  vertical-align : top;
+}
+.main_set_text{
+  font-size: 10pt;
+  margin:0px 0px 0px 0px;
+  padding:0px 0px 0px 0px;
+  width: 206px;
+}
+h1{
+  color: #257B29;
+  font-family: Arial, Helvetica, sans-serif;
+  text-align: center;
+  font-size: 28px;
+}
+h2{
+  font-size: 20px;
+  font-family: Arial, Helvetica, sans-serif;
+  color: #257B29;
+  font-weight: bold;
+  text-align: center;
+  margin: 10px 0px 2px 0px;
+  padding: 0px 0px 0px 0px;
+}
+h3{
+  color:#257b29;
+   font-size: 13px;
+   text-align: center;
+   margin: 0px 0px 0px 0px;
+}
+h4{
+  color:#000000;
+  margin: 10px 0px 0px 0px;
+}
+
+.center_links{
+  color: #257B29;
+  text-align: center;
+  font-weight : bold;
+  margin: 5px 0px 10px 0px;
+}
+.notes{
+  font-size: 8pt;
+  font-family: Arial, Helvetica, sans-serif;
+  font-style : italic;
+  margin: 0px 0px 0px 0px;
+  padding: 2px 0px 10px 0px;
+  font-weight : normal;
+}
+.news{
+  overflow: auto;
+  background-color: #99cc99;
+  vertical-align : top;
+  padding: 0px 5px 5px 5px;
+  text-align : left;
+}
+
+/* ~~~ Hyper Links ~~~ */
+a.buttons:link {
+  text-decoration: none; 
+  font-weight: normal; 
+  color: #FFCC00;
+}
+a.buttons:visited {
+  text-decoration: none; 
+  color: #FFCC00;
+}
+a.buttons:active  {
+  text-decoration: none; 
+  color: #FFCC00;
+}
+a.buttons:hover {
+  text-decoration: none; 
+  color: #257B29; 
+  background-color: #FED700;
+}
+
+a.center_links{
+  text-decoration: underline;
+  font-weight: bold;
+}
+a.links{
+  text-decoration: underline;
+  font-weight: normal;
+}
+a.links:link,.a.center_links:link {
+  color: #257B29;
+}
+a.links:visited, a.center_links:visited {
+  color: #993300;
+}
+a.links:active,a.center_links:active {
+  color: #257B29;
+}
+a.links:hover, a.center_links:hover {
+  color: #CC9900;
+}
+/* ~~~ Template Credit ~~~ */
+.design_by{
+  text-align:center;
+  padding: 10px 0px 20px 0px;
+}
+/* ~~~ Copyright ~~~ */
+.copyright{
+  font-family: Arial, sans-serif;
+  font-size:8pt;
+  color:#FFCC00;
+  background-color: #257B29;
+  text-align:center;
+  padding: 5px 0px 5px 120px;
+}
+/* ~~~ Text Alignment ~~~ */
+.center{
+  text-align: center;
+  margin: 10px 0px 0px 0px;
+}
+/* ~~~ Manager Items ~~~ */
+.manager_menu{
+  font-size: 10pt;
+  font-family: Arial, Helvetica, sans-serif;
+  text-align: center;
+}
+.manager_menu a:visited{
+  color: purple;
+}
+.manager_menu a:hover{
+  color: red;
+}
+
+</style>
+</head>
+<body $body_tag>
+<table width="100%" border="0" cellspacing="0" cellpadding="0" >
+  <tr>
+    <td>
+			<table width="100%" border="0" cellspacing="0" cellpadding="0" background="$imageURLthingy/background.gif">
+				<tr>
+					<td width="534"><img src="$imageURLthingy/header.gif" width="534" height="72" border="0"></td>
+					<td align=right background="$imageURLthingy/background.gif"/><div valign=top align=right><img src="$imageURLthingy/Agora-logo-white2.gif" width="286" height="55" border="0" alt="The Official Website of AgoraCart and Agora.cgi"><img src="$imageURLthingy/blank.gif" width="50" height="1" border="0"> </div>
+</td></tr></table>
+
+    </td>
+  </tr>
+  <tr>
+    <td>
+      <table width="100%" border="0" cellpadding="0" cellspacing="0">
+        <tr class="folder_tabs">
+           <td class="first"><a href="$sc_store_url" class="buttons" target="_blank">View Your Store</a></td>
+          <td width="33"><img src="$imageURLthingy/agora-cart-button.jpg" width="33" height="28"></td>
+          <td><a href="manager.cgi?change_settings_screen=yes" class="buttons">Your Store Settings</a></td>
+          <td width="33"><img src="$imageURLthingy/agora-cart-button.jpg" width="33" height="28"></td>
+          <td><a href="manager.cgi?order_log=yes" class="buttons">View New Orders</a></td>
+          <td width="33"><img src="$imageURLthingy/agora-cart-button.jpg" width="33" height="28"></td>
+          <td><a href="manager.cgi?order_management_settings_screen=yes" class="buttons">Order Management</a></td>
+          <td width="33"><img src="$imageURLthingy/agora-cart-button.jpg" width="33" height="28"></td>
+          <td><a href="http://www.AgoraCart.com/agorawiki/" class="buttons" target="_blank">User Manuals & Wiki</a></td>  
+          <td width="33"><img src="$imageURLthingy/agora-cart-button.jpg" width="33" height="28"></td> 
+          <td><a href="http://www.agoraguide.com/faq/" class="buttons" target="_blank">Free User Forums</a> </td>
+          <td width="33"><img src="$imageURLthingy/agora-cart-button.jpg" width="33" height="28"></td><td><a href="http://www.AgoraCart.com/proforum.htm" class="buttons" target="_blank">Pro Version Memberships</a></td>
+        </tr>
+      </table>
+    </td>
+  </tr>
+  <tr>
+    <td>
+      <table width="100%" class="top_links" border="0" cellpadding="0" cellspacing="0">
+        <tr>
+          <td>
+            <a class="buttons" href="manager.cgi?add_screen=yes">Product Add</a> &nbsp; |  &nbsp;
+            <a class="buttons" href="manager.cgi?edit_screen=yes">Product Edit</a> &nbsp; | &nbsp;
+            <a class="buttons" href="manager.cgi?delete_screen=yes">Product Delete</a>
+          </td>
+        </tr>
+      </table>
+    </td>
+  </tr>
+  <tr>
+    <td>
+      <table width="100%" border="0" cellspacing="0" cellpadding="0">
+        <tr>
+          <td class="left_menu">
+            <a class="buttons" href="#"><small>More Managers at Right<small></a> &rArr;<br/>
+            <p class="lm_first">Your Store - basics</p>
+            &gt; <a class="buttons" href="manager.cgi?order_log=yes">View New Orders</a><br />
+            &gt; <a class="buttons" href="manager.cgi?order_management_settings_screen=yes">Order Management</a><br />
+            &gt; <a class="buttons" href="manager.cgi?merchandising_tools_settings_screen=yes">Merchandising Tools</a><br />
+            &gt; <a class="buttons" href="manager.cgi?change_settings_screen=yes">Your Store Mgrs/Settings</a><br />
+            &gt; <a class="buttons" href="manager.cgi?add_screen=yes">Product Add</a><br />
+            &gt; <a class="buttons" href="manager.cgi?edit_screen=yes">Product Edit</a><br />
+            &gt; <a class="buttons" href="manager.cgi?delete_screen=yes">Product Delete</a><br />
+            &gt; <a class="buttons" href="manager.cgi?error_log=yes">Error Log</a><br />
+            &gt; <a class="buttons" href="manager.cgi?log_out=yes">Log Out</a><br />
+
+            <p class="lm_first">Get Help & Support</p>
+            &gt; <a class="buttons" href="http://www.AgoraCart.com/agorawiki/" target="_blank">User Manuals / Wiki</a><br />
+            &gt; <a class="buttons" href="http://www.agoraguide.com/faq/" target="_blank">Free User Forums</a><br />
+            &gt; <a class="buttons" href="http://www.allisonsonline.com/training/agora.cgi" target="_blank">Ralph's Site 4 Newbies</a><br />
+            &gt; <a class="buttons" href="http://www.AgoraCart.com/pages/Authorized_Solutions_Providers/" target="_blank">Certified Agora Pros</a><br />
+            &gt; <a class="buttons" href="http://www.AgoraXchange.com/" target="_blank">Hire a Freelancer</a><br />
+            &gt; <a class="buttons" href="http://www.agoracart.com/proshop/agora.cgi?product=Tech_Support" target="_blank">TechSupport</a><br />
+
+            <p class="lm_first">Pro Version Links</p>
+            &gt; <a class="buttons" href="http://www.AgoraCart.com/proforum.htm" target="_blank">Pro Member Benefits</a><br />
+            &gt; <a class="buttons" href="http://www.AgoraCart.com/proshop/agora.cgi?product=Members_Only" target="_blank">Join Today!</a><br />
+            &gt; <a class="buttons" href="http://www.AgoraCartPro.com/" target="_blank">AgoraCartPro.com</a><br />
+
+            <p class="lm_first">Downloads & Add-ons</p>
+            &gt; <a class="buttons" href="http://www.AgoraCart.org/download/" target="_blank">More Downloads</a><br />
+            &gt; <a class="buttons" href="http://www.AgoraCart.com/proshop/agora.cgi" target="_blank">The AgoraCart.com Store</a><br />
+
+            <p class="lm_first">Showcases</p>
+            &gt; <a class="buttons" href="http://www.AgoraCart.com/pages/Shopping/" target="_blank">Shop Live Stores</a><br />
+
+            <p class="lm_first">\@ AgoraCart.org</p>
+            &gt; <a class="buttons" href="http://www.AgoraCart.org/" target="_blank">AgoraCart.org</a><br />
+            &gt; <a class="buttons" href="http://www.AgoraCart.com/ancient_greek_agora" target="_blank">The Ancient Greek Agora</a><br />
+            &gt; <a class="buttons" href="http://www.AgoraCart.com/blog" target="_blank">Blog: News &amp; Updates</a><br />
+            &gt; <a class="buttons" href="http://www.AgoraCart.org/paymentgateways.htm" target="_blank">Supported Gateways</a><br /> 
+            &gt; <a class="buttons" href="http://www.AgoraCart.org/logos.htm" target="_blank">"Powered by" Logos</a><br />
+            &gt; <a class="buttons" href="http://www.AgoraCart.org/coolhacks.htm" target="_blank">Cool Hacks Contest</a><br />
+            &gt; <a class="buttons" href="http://www.AgoraCart.org/foundersclub.htm" target="_blank">Founders Club (sponsors)</a><br />
+
+            <br /><br />
+            <p class="center">
+              <a href="http://www.hotscripts.com/Detailed/11562.html" target="_blank">
+                <img src="http://images.hotscripts.com/dynamic/rating.gif?11562" /></a>
+              <br /><br />
+            </p>
+      
+            <img src="$imageURLthingy/spacer.gif" height="1" width="175px" />
+          </td>
+          <td class="main_body">
+        <table width="100%" cellpadding=0 cellspacing=0 border=0>
+        <tr>
+          <td width=100% class="main_text">
 
-<BODY $body_tag>
-<CENTER>
 $manager_banner
-</CENTER>
 $manager_menu
 $errs
 $messages
 ENDOFTEXT
-
   return $my_header;
  }
 #######################################################################################
@@ -298,16 +575,20 @@
  }
 #######################################################################################
 sub std_welcome_screen {
-
 print &$manager_page_header("Welcome!","","","","");
+my $imageURLthingy = "images";
+my $temp_store_url_checker = "${sc_domain_name_for_cookie}";
+if ((($sc_self_serve_images =~ /no/i) && (($temp_store_url_checker =~ /cgi/i) && ($temp_store_url_checker =~ /bin/i))) || ($sc_self_serve_images =~ /yes/i) || (($sc_self_serve_images =~ /no/i) && (($sc_store_url =~ /cgi/i) && ($sc_store_url =~ /bin/i)))) {
+  $imageURLthingy = "manager.cgi?picserve=";
+} 
 
 print <<ENDOFTEXT;
 <CENTER>
-<TABLE WIDTH=500 BORDER=0 CELLPADDING=2>
+<TABLE BORDER=0 CELLPADDING=2>
 
 <TR>
 <TD COLSPAN=2>
-<HR WIDTH=550>
+<HR>
 </TD>
 </TR>
 ENDOFTEXT
@@ -323,7 +604,7 @@
 <CENTER>
 <TABLE>
 <TR>
-<TD>
+<TD class=main_text2>
 <FONT FACE=ARIAL SIZE=2 COLOR=RED>$error_message</FONT>
 </TD>
 </TR>
@@ -339,48 +620,136 @@
 print <<ENDOFTEXT;
 
 <TR>
-<TD COLSPAN=2><P><strong>Welcome $username!&nbsp; Choose from 
-the options above...</strong></P>
-The home site of AgoraCart (aka Agora.cgi) is 
-<a href="http://www.agoracart.com/">www.AgoraCart.com</a>.\&nbsp;\&nbsp;
-<br>
-<br>
-<font size=+1><b>Resources:</b></font><br><br>
-<center><a href="http://www.agoracart.com/download.htm" target="_new">Online Manual</a>  | 
-<a href="http://www.agoracart.com/help/wherestuff.html" target="_new">AgoraCart File Structure, File Locations \& Permissions</a><br>
-<a href="http://www.agoracart.com/help/3rdparty.html" target="_new">Misc Reference \& Tutorials</a>  | 
-<a href="http://www.agoracart.com/paymentgateways.htm" target="_new">Payment Processing Gateways Supported</a><br>
-
-
-<a href="http://members.agoracartpro.com/" target="_new">Pro Members</a>  | 
-<a href="http://www.agoraguide.com/faq/" target="_new">Free User Forum \& FAQ</a>  | 
-<a href="http://groups.yahoo.com/group/agora2/" target="_new">Free User Forum \@ Yahoo Groups</a><br>
-<a href="http://www.agoracart.com/pages/Shopping/">Free ad - Agora users only</a>  | 
-<a href="http://www.imegamall.com/info/listing.htm">Free Listing in iMegaMall</a>  | 
-<a href="http://www.SnooperClick.com/">SnooperClick Search Engine</a><br><br>
-
-<FORM action=http://www.SnooperClick.com/smartsearch.cgi method=post>
-<B>Try SnooperClick: Enter Keyword or Phrase:</B><BR>
-<INPUT name=keywords size=30>
-<INPUT type=submit value=Search></FORM>
+<TD COLSPAN=2 class=main_text2><P><strong>$username, Welcome your AgoraCart store manager!</strong><br></P>
+<font size=+1><b>Resources:</b></font><br>
+
+<center><a href="http://www.agoracart.com/agorawiki/" target="_blank">User Manual</a>  | 
+<a href="http://www.agoracart.com/agorawiki/index.php?title=The_AgoraCart_Project:FAQ" target="_blank">FAQ</a>  | 
+<a href="http://www.agoracart.com/agorawiki/index.php?title=3rd_Party_Reference_%26_Tutorials" target="_blank">Misc Reference \& Tutorials</a>  | 
+<a href="DOCS/" target="_blank">Your Store's DOCS directory</a><br/>
+<a href="http://www.AgoraCart.com/blog" target="_blank">Blog: News & Updates</a>  | 
+<a href="http://www.agoracart.org/paymentgateways.htm" target="_blank">Payment Processing Gateways Supported</a></center><hr/>
+<font size=+1><b>Project Sponsors:</b></font><br/><center>
+<a href="http://www.NiftyPay.com" target="_new"><img src="$imageURLthingy/niftylogo1.png" width="132" height="45" border="0"></a> &nbsp; <a href="http://www.WebStyleStats.com" target="_new"><img src="$imageURLthingy/webstyle.jpg" width="120" height="55" border="0"></a> &nbsp; <a href="http://www.SnooperClick.com" target="_new"><img src="$imageURLthingy/snooperclick.jpg" width="158" height="39" border="0" ></a> &nbsp; <a href="http://www.iMegaMall.com" target="_new"><img src="$imageURLthingy/Imega5d.gif" width="180" height="44" border="0" ></a><br/>
 </center>
+ENDOFTEXT
+#read files for updates added by Mister Ed Jan 2006
+$target_file = "http://www.agoracart.com/news.txt";
+if ($mc_first_time_user_to_agora_check2 eq '') {
+    $target_file = "http://www.agoracart.com/news_new.txt";
+}
+use LWP::Simple;
+my $file = get($target_file);
+$file =~ s/\$imageURLthingy/$imageURLthingy/g;
+ @line = split(/\n/, $file);
+ print "@line";
+print <<ENDOFTEXT;
+
+<font size=+1><b>Please Donate:</b></font><br>
+Like many Open Source Projects, we rely heavily upon donations to keep our project running. If you found this program useful, please donate what you can, such as: time, money, templates, or code.  Opportunities to contribute include becoming a Pro Member/Supporter (aka Pro member or Members Only), contributing templates or perl code improvements, helping others in our user forums, or even supporting our affiliated services.  If you cannot contribute time or code, our suggested donation is \$1.00 average per month over a year. &nbsp;&nbsp; Regardless, we will greatly appreciate your support, so please donate and donate as often as you are able to.
 <br><br>
-Join the <a href="http://www.agoracartpro.com/"><b>Pro Members Group</b></a> for \$29.95 per year or \$59.95 for a lifetime
-membership.  Benefits include more professional support in pro user forums, extra add-ons such as PayPal, Verisign and eWay gateway libraries, FedEx shipping libraries, other payment gateways, additional hacks and add-ons for pro members only, discounts on custom services, and more.
-<br><br>
+<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_new">
+          				<b>Donation by PayPal:</b>&nbsp;&nbsp;
+  										<input type="hidden" name="cmd" value="_xclick"/>
+										<input type="hidden" name="business" value="webmaster\@imegamall.com"/>
+										<input type="hidden" name="item_name" value="AgoraCart Donation"/>
+											Amount of Donation:&nbsp;&nbsp;
+											<select name="amount" size=1>
+												<option>12.00</option>
+												<option>5.00</option>
+												<option>10.00</option>
+												<option>15.00</option>
+												<option>20.00</option>
+												<option>25.00</option>
+												<option>30.00</option>
+												<option>35.00</option>
+												<option>40.00</option>
+												<option>45.00</option>
+												<option>50.00</option>
+												<option>75.00</option>
+												<option>100.00</option>
+												<option>125.00</option>
+												<option>150.00</option>
+												<option>175.00</option>
+												<option>200.00</option>
+												<option>225.00</option>
+												<option>250.00</option>
+												<option>275.00</option>
+												<option>300.00</option>
+												<option>350.00</option>
+												<option>400.00</option>
+												<option>450.00</option>
+												<option>500.00</option>
+											</select>&nbsp;&nbsp;
+											<input type="hidden" name="cn" value="Special Instructions"/>
+											<input type="hidden" name="no_note" value="1"/>
+											Currency:&nbsp;&nbsp;
+											<select name="currency_code" size=1>
+												<option>USD</option>
+												<option>CAD</option>
+												<option>GBP</option>
+												<option>AUS</option>
+												<option>EUR</option>
+											</select>&nbsp;&nbsp;
+											<input type="hidden" name="return" value="http://www.agoracart.com/thanksdonation.htm"/>
+											<input type="submit" value="Pay with PayPal"/></form>
+
+          				<form method='post' action='https://secure.paymentclearing.com/cgi-bin/mas/buynow.cgi'/ target="_new">
+          					<input type='hidden' name='vendor_id' value='36895'/>
+          					<input type='hidden' name='home_page' value='http://www.agoracart.com/donation.htm'/>
+          					<input type='hidden' name='ret_addr' value='http://www.agoracart.com/thanksdonation.htm'/>
+          					<input type='hidden' name='mername' value='AgoraCart.org'/>
+          					<input type='hidden' name='acceptchecks' value='1'/>
+          					<input type='hidden' name='acceptcards' value='1'/>
+          					<input type='hidden' name='showaddr' value='1'/>
+          					<input type='hidden' name="1-qty" value="1"/>
+          					<input type='hidden' name="1-desc" value="AgoraCart Donation">
+<INPUT type="hidden" name="mastimage" value="1">
+<INPUT type="hidden" name="mast" value="https://secure.serverc.net/~agoracgi/images2/Agora-logo-white2.gif">
+          				<b>Donation by Visa/MC/Discover/eCheck: </b>&nbsp;&nbsp; Amount of Donation:&nbsp;
+<select name="1-cost" size=1>
+												<option>12.00</option>
+												<option>5.00</option>
+												<option>10.00</option>
+												<option>15.00</option>
+												<option>20.00</option>
+												<option>25.00</option>
+												<option>30.00</option>
+												<option>35.00</option>
+												<option>40.00</option>
+												<option>45.00</option>
+												<option>50.00</option>
+												<option>75.00</option>
+												<option>100.00</option>
+												<option>125.00</option>
+												<option>150.00</option>
+												<option>175.00</option>
+												<option>200.00</option>
+												<option>225.00</option>
+												<option>250.00</option>
+												<option>275.00</option>
+												<option>300.00</option>
+												<option>350.00</option>
+												<option>400.00</option>
+												<option>450.00</option>
+												<option>500.00</option>
+											</select>&nbsp;
+										<input type=hidden name="visaimage" value="1"/>
+										<input type=hidden name="mcimage" value="1"/>
+										<input type=hidden name="discimage" value="1"/>
+											<input type=submit value="Pay Securely through NiftyPay">
+									</form>
 
-Also, visit <a href="http://www.agoracartpro.com/proshop/">AgoraCart.com</a> for add-ons (free and fee based) including: a net profit tracker to keep track of net profits amounts per order for use with such things as affiliate program variables,  the popular Multi Login script for the store manager that allows you to change, add, delete manager passwords and assign rights to each manager to allow or disallow specific manager functions, and <a href="http://www.agoracart.com/dbwizz/">DBwizz database manager</a> that allows you to manage your stores database offline and then upload any changes you make to your product database.<br><br>
+<br>
 
 $other_welcome_message
 </TD>
 </TR>
-
 </TABLE>
 </CENTER>
-
-<HR WIDTH=550>
+<HR>
 <CENTER>
-<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH="550">
+<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>
 <TR>
 <TD><IMG SRC="manager.cgi?picserve=front_footer.gif" BORDER=0>
 </TD>
@@ -393,56 +762,92 @@
 }
 ################################################################################
 sub display_order_log
-
 {
-local ($stuff);
 local ($errs)='';
-local ($lines)=0;
-
+my ($lines)=0;
 local ($logfile)= "$sc_logs_dir/$sc_order_log_name";
+my ($year,$month,$day,$stuff, $order_filename, $junk2, $Location, $sorry_thingy);
+my (%orderLoggingHash);
 
 print &$manager_page_header("Display Order Log","","","");
 
+print "<center>\n";
+
+print qq~<br><br>
+<table width=740 border=0 cellpadding=2 cellspacing=0><tr>
+<td valign=middle align=center><font face=arial size=+1><b>New Orders Overview</b></font></td>
+</tr></table>
+<table width=740 border=1 cellpadding=2 cellspacing=0><tr>
+<td valign=middle align=center bgcolor=#99CC99><font face=arial size=2><b>Order Status</b></font></td>
+<td valign=middle align=center bgcolor=#99CC99 width=85><font face=arial size=2><b>Order Date</b></font></td>
+<td valign=middle align=center bgcolor=#99CC99><font face=arial size=2><b>Invoice #</b></font></td>
+<td valign=middle align=center bgcolor=#99CC99><font face=arial size=2><b>Customer Name</b></font></td>
+<td valign=middle align=center bgcolor=#99CC99><font face=arial size=2><b>Order Total</b></font></td>
+<td bgcolor=#99CC99><font face=arial size=2>&nbsp;</font></td>
+</tr>
+~;
+
 &get_file_lock("$logfile.lockfile");
+open(LOGFILE, "$logfile") || print "<tr><td width=620 colspan=8 align=center><font face=arial size=2>Sorry, Cannot Find Order Log File</font></td></tr>\n";
+while (<LOGFILE>) {
 
-{
-open(LOGFILE, "$logfile") || print "";
-local $/=undef;
-$junk=<LOGFILE>;
-close(LOGFILE);
-}
-$junk=length($junk);
+($year,$month,$day,$orderLoggingHash{'invoiceNumber'},$orderLoggingHash{'customerNumber'},$orderLoggingHash{'orderStatus'},$orderLoggingHash{'firstName'},$orderLoggingHash{'lastName'},$orderLoggingHash{'fullName'},$orderLoggingHash{'companyName'},$orderLoggingHash{'emailAddress'},$orderLoggingHash{'orderFromState'},$orderLoggingHash{'orderFromPostal'},$orderLoggingHash{'orderFromCountry'},$orderLoggingHash{'shipMethod'},$orderLoggingHash{'shippingTotal'},$orderLoggingHash{'salesTax'},$orderLoggingHash{'tax1'},$orderLoggingHash{'tax2'},$orderLoggingHash{'tax3'},$orderLoggingHash{'discounts'},$orderLoggingHash{'netProfit'},$orderLoggingHash{'subTotal'},$orderLoggingHash{'orderTotal'},$orderLoggingHash{'affiliateTotal'},$orderLoggingHash{'affiliateID'},$orderLoggingHash{'affiliateMisc'}) = split(/\t/,$_);
 
-print "<center>\n";
-print "<table width='90%' border=0 cellpadding=10>",
-      "<tr width=600><td><font face=courier>\n",
-      "<b>ORDER LOG: $logfile<br></b></td>\n",
-      "<td>&nbsp;</td>\n",
-      '<td align=right><a href="manager.cgi?clear_order_log=yes', 
-	"&bytes=$junk\">",
-      "<b>CLEAR ORDER LOG</b></a></td>\n",
-      "</tr></table>\n";
+$orderLoggingHash{'orderTotal'} = &format_pricemgr($orderLoggingHash{'orderTotal'});
 
-&display_a_file($logfile,"","Empty Order Log");
+ if (($orderLoggingHash{'invoiceNumber'} eq "") && ($_ eq "")) {
+   print "<tr><td width=620 colspan=8 align=center><font face=arial size=2>Sorry, No Orders</font></td></tr>\n";
+   $sorry_thingy= "stop";
+  }
 
-print "</center>\n";
-print &$manager_page_footer;
 
+if ($sorry_thingy ne "stop") {
+print qq~<tr>
+<td valign=middle align=center><font face=arial size=2>$orderLoggingHash{'orderStatus'}</font></td>
+<td valign=middle align=center><font face=arial size=2>$month, $day, $year</font></td>
+<td valign=middle align=center><font face=arial size=2>$orderLoggingHash{'invoiceNumber'}</font></td>
+~;
+
+if ($orderLoggingHash{'lastName'} ne "") {
+print qq~
+<td valign=middle align=center><font face=arial size=2>$orderLoggingHash{'firstName'} $orderLoggingHash{'lastName'}</font></td>
+~;
+} else {
+print qq~
+<td valign=middle align=center><font face=arial size=2>$orderLoggingHash{'fullName'}</font></td>
+~;
+}
+
+$order_filename = "$scm_order_logpath/$orderLoggingHash{'invoiceNumber'}" . "-" . "$orderLoggingHash{'customerNumber'}";
+print qq~
+<td valign=middle align=center><font face=arial size=2>$sc_money_symbol $orderLoggingHash{'orderTotal'}</font></td>
+<td valign=middle align=center><font face=arial size=2><a href="manager.cgi?invoiceviewertrigger=invoiceviewertrigger&invoiceNumber=$orderLoggingHash{'invoiceNumber'}&customerNumber=$orderLoggingHash{'customerNumber'}&year=$year&month=$month" target="_new">View Invoice</a><br><a href="manager.cgi?viewertrigger=viewertrigger&invoiceNumber=$orderLoggingHash{'invoiceNumber'}&customerNumber=$orderLoggingHash{'customerNumber'}&year=$year&month=$month">View/Update</a><br><a href="manager.cgi?packingviewertrigger=packingviewertrigger&invoiceNumber=$orderLoggingHash{'invoiceNumber'}&customerNumber=$orderLoggingHash{'customerNumber'}&year=$year&month=$month" target="_new">Packing Slip</a><br><a href="manager.cgi?originalviewertrigger=originalviewertrigger&invoiceNumber=$orderLoggingHash{'invoiceNumber'}&customerNumber=$orderLoggingHash{'customerNumber'}&year=$year&month=$month" target="_new">Original Order</a><br><a href="manager.cgi?deleteviewertrigger=yes&invoiceNumber=$orderLoggingHash{'invoiceNumber'}&customerNumber=$orderLoggingHash{'customerNumber'}&year=$year&month=$month">Delete/Remove</a><br></font></td>
+</tr>
+~;
+}
+ }
+close(LOGFILE);
 &release_file_lock("$logfile.lockfile");
+print qq~<tr>
+<td valign=middle align=center bgcolor=#99CC99><font face=arial size=2><b>Order Status</b></font></td>
+<td valign=middle align=center bgcolor=#99CC99 width=85><font face=arial size=2><b>Order Date</b></font></td>
+<td valign=middle align=center bgcolor=#99CC99><font face=arial size=2><b>Invoice #</b></font></td>
+<td valign=middle align=center bgcolor=#99CC99><font face=arial size=2><b>Customer Name</b></font></td>
+<td valign=middle align=center bgcolor=#99CC99><font face=arial size=2><b>Order Total</b></font></td>
+<td bgcolor=#99CC99><font face=arial size=2>&nbsp;</font></td>
+</tr>
+</table><br></center><br>
+~;
 
+print &$manager_page_footer;
 }
-
-#######################################################################################
+################################################################################
 sub display_error_log
-
 {
 local ($stuff);
 local ($lines)=0;
 local ($logfile)= "./log_files/error.log";
-
 print &$manager_page_header("Error Log","","","","");
-
-#print "<html><title>Error Log</title><body bgcolor=#ffffff>\n";
 print "<center>\n";
 print "<table width='90%' border=0 cellpadding=10>",
       "<tr width=600><td><font face=courier>\n",
@@ -453,74 +858,55 @@
       "</tr></table>\n";
 
 &display_a_file($logfile,"yes","Empty Error Log");
-
 print "</center>\n";
 print &$manager_page_footer;
-
 }
-
 #######################################################################################
 sub display_a_file
-
 {
 local ($logfile,$need_rules,$empty_msg)=@_;
 local ($stuff);
 local ($lines)=0;
-
 print "<table width='90%' border=1 cellpadding=10>",
       "<tr width=600><td width=600><font face=courier>\n";
-
 open(LOGFILE, "$logfile") || print "";
-
 while(<LOGFILE>){
-
  if (($lines > 0) && ($need_rules)) {
    print "<hr>\n";
   }
-
  $stuff = $_;
  $stuff =~ s/\</\&lt;/g;
  $stuff =~ s/\>/\&gt;/g;
  $stuff =~ s/\|/\<br\>/g;
-# $stuff =~ s/ /\&nbsp;/g;
-
  print "$stuff<br>\n";
  $lines++;
-
- }# End of while LOGFILE
-
+ }
 close(LOGFILE);
 
  if ($lines == 0) {
    print "$empty_msg\n";
   }
-
 print "</font></td></tr></table>\n";
-
 }
-
 #############################################################################################
 sub display_main_settings_choices {
-
-local ($maxcols) = 3;
-local ($colwidth) = int(550/$maxcols);
+my ($maxcols) = 3;
+local ($colwidth) = int(630/$maxcols);
 local (%my_list, @my_keys, $inx, $items, $link);
-
 print <<ENDOFTEXT;
 <CENTER>
-<TABLE WIDTH=550 BORDER=0 CELLPADDING=0 CELLSPACING=0>
+<TABLE WIDTH=630 BORDER=0 CELLPADDING=5 CELLSPACING=0>
 ENDOFTEXT
-
 if ($mc_change_main_settings_ok =~ /yes/i) {
 print <<ENDOFTEXT;
-	<TR WIDTH=550>
-	<TD colspan=$maxcols>
+  <TR WIDTH=630>
+  <TD colspan=$maxcols>
         <center><FORM METHOD=POST ACTION=manager.cgi>
-	<INPUT TYPE=SUBMIT NAME="main_settings_screen" 
-          VALUE="  Main AgoraCart Store Settings  ">
-	</FORM></center>
-	</TD>
-	</TR>
+  <INPUT TYPE=SUBMIT NAME="main_settings_screen" 
+          VALUE="  >>>  Primary/Core AgoraCart Settings - Set Up First! <<<  ">
+  </FORM></center>
+  </TD>
+  </TR>
 ENDOFTEXT
 }
 
@@ -530,26 +916,24 @@
   if ($menu_items_disabled{$link} eq '') {
     $items++;
     if ($items == 1) {
-      print "<TR WIDTH=550>\n";
+      print "<TR WIDTH=630>\n";
      }
     print <<ENDOFTEXT; 
-	<TD colspan=1 WIDTH=$colwidth>
-	<CENTER>
-	<FORM METHOD=POST ACTION=manager.cgi>
-	<INPUT TYPE=SUBMIT NAME=$store_settings_link{$inx} 
-         VALUE="$store_settings_name{$inx}">
-	</FORM>
-	</CENTER>
-	</TD>
-ENDOFTEXT
+  <TD colspan=1 WIDTH=$colwidth>
+
+  <FORM METHOD=POST ACTION=manager.cgi>
+  <INPUT TYPE=SUBMIT NAME=$store_settings_link{$inx} 
+         VALUE="$store_settings_name{$inx}" class=main_set_text />
+  </FORM>
 
+  </TD>
+ENDOFTEXT
     if ($items == $maxcols) {
       $items = 0;
       print "</TR>\n";
      }
    }
  }
-
  if ($items > 0) {
    while ($items < $maxcols) {
      $items++;
@@ -558,8 +942,56 @@
    $items = 0;
    print "</TR>\n";
   }
+print <<ENDOFTEXT;
 
+</TABLE>
+</CENTER>
 
+ENDOFTEXT
+}
+#############################################################################################
+sub display_ordermanagement_settings_choices {
+my ($maxcols) = 3;
+local ($colwidth) = int(630/$maxcols);
+local (%my_list, @my_keys, $inx, $items, $link);
+print <<ENDOFTEXT;
+<CENTER>
+<TABLE WIDTH=630 BORDER=0 CELLPADDING=5 CELLSPACING=0>
+ENDOFTEXT
+
+$items = 0;
+foreach $inx (sort(keys(%ordermanage_settings_name))){
+  $link = $ordermanage_settings_link{$inx}; 
+  if ($menu_items_disabled{$link} eq '') {
+    $items++;
+    if ($items == 1) {
+      print "<TR WIDTH=630>\n";
+     }
+    print <<ENDOFTEXT; 
+  <TD colspan=1 WIDTH=$colwidth>
+
+  <FORM METHOD=POST ACTION=manager.cgi>
+  <INPUT TYPE=SUBMIT NAME=$ordermanage_settings_link{$inx} 
+         VALUE="$ordermanage_settings_name{$inx}" class=main_set_text />
+  </FORM>
+
+  </TD>
+ENDOFTEXT
+
+    if ($items == $maxcols) {
+      $items = 0;
+      print "</TR>\n";
+     }
+   }
+ }
+ if ($items > 0) {
+   while ($items < $maxcols) {
+     $items++;
+     print "<TD colspan=1 WIDTH=$colwidth>&nbsp;</TD>\n";
+    }
+   $items = 0;
+   print "</TR>\n";
+  }
 print <<ENDOFTEXT;
 
 </TABLE>
@@ -568,44 +1000,89 @@
 ENDOFTEXT
 
 }
+#############################################################################################
+sub display_merchandisingtools_settings_choices {
+my ($maxcols) = 3;
+local ($colwidth) = int(630/$maxcols);
+local (%my_list, @my_keys, $inx, $items, $link);
+
+print <<ENDOFTEXT;
+<CENTER>
+<TABLE WIDTH=630 BORDER=0 CELLPADDING=5 CELLSPACING=0>
+ENDOFTEXT
 
+$items = 0;
+foreach $inx (sort(keys(%merchtools_settings_name))){
+  $link = $merchtools_settings_link{$inx}; 
+  if ($menu_items_disabled{$link} eq '') {
+    $items++;
+    if ($items == 1) {
+      print "<TR WIDTH=630>\n";
+     }
+    print <<ENDOFTEXT; 
+  <TD colspan=1 WIDTH=$colwidth>
+
+  <FORM METHOD=POST ACTION=manager.cgi>
+  <INPUT TYPE=SUBMIT NAME=$merchtools_settings_link{$inx} 
+         VALUE="$merchtools_settings_name{$inx}" class=main_set_text />
+  </FORM>
+
+  </TD>
+ENDOFTEXT
+
+    if ($items == $maxcols) {
+      $items = 0;
+      print "</TR>\n";
+     }
+   }
+ }
+
+ if ($items > 0) {
+   while ($items < $maxcols) {
+     $items++;
+     print "<TD colspan=1 WIDTH=$colwidth>&nbsp;</TD>\n";
+    }
+   $items = 0;
+   print "</TR>\n";
+  }
+print <<ENDOFTEXT;
+
+</TABLE>
+</CENTER>
+
+ENDOFTEXT
+
+}
 #############################################################################################
 sub html_eval_settings
 {
 local($errs)='';
 $errs = &eval_store_settings;
-
 if ($errs ne '') {
-  $errs = "<center><table width='85%'><tr><td>" . 
-	  "<font color=red>$errs</font></td></tr></table></center>\n";
+  $errs = qq~<div style="text-align:center; color:red;">$errs</div>\n~;
  }
-
 return $errs;
 }
 #############################################################################################
-
 sub setup_htaccess_screen
 {
 local ($the_id,$temp,$whoami);
-
 print &$manager_page_header("htaccess","","","","");
-
 $temp = $ENV{'PATH'};
 $ENV{'PATH'} = "/bin:/usr/bin";
 $the_id = `id`;
 $whoami = `whoami`;
 $ENV{'PATH'} = $temp;
-
 print <<ENDOFTEXT;
 <CENTER>
-<HR WIDTH=580>
+<HR>
 </CENTER>
 
 <CENTER>
 <FORM ACTION="manager.cgi" METHOD="POST">
-<TABLE WIDTH=580>
+<TABLE>
 <TR>
-<TD WIDTH=580>
+<TD>
 <FONT FACE=ARIAL>Welcome to the htaccess section of the
 <b>AgoraCart</b> System Manager.
 This code is here to assist you in the event that you are
@@ -651,7 +1128,7 @@
 
 <FONT FACE=ARIAL SIZE=2>
 <CENTER>
-<TABLE BORDER=0 CELLPADDING=2 CELLSPACING=0 WIDTH=580>
+<TABLE BORDER=0 CELLPADDING=2 CELLSPACING=0>
 
 <TR>
 <TD COLSPAN=2><HR></TD>
@@ -704,24 +1181,21 @@
 sub change_settings_screen
 {
 local ($the_id,$temp,$whoami);
-
 print &$manager_page_header("Change Settings","","","","");
-
 $temp = $ENV{'PATH'};
 $ENV{'PATH'} = "/bin:/usr/bin";
 $the_id = `id`;
 $whoami = `whoami`;
 $ENV{'PATH'} = $temp;
-
 print <<ENDOFTEXT;
 <CENTER>
-<HR WIDTH=580>
+<HR>
 </CENTER>
 
 <CENTER>
-<TABLE WIDTH=580>
+<TABLE>
 <TR>
-<TD WIDTH=580>
+<TD>
 <FONT FACE=ARIAL>Welcome to the System Settings section of the
 <b>AgoraCart</b> System Manager.
 </TD>
@@ -752,20 +1226,123 @@
 print <<ENDOFTEXT;
 
 <CENTER>
-<HR WIDTH=580>
+<HR>
 </CENTER>
 ENDOFTEXT
 print &$manager_page_footer;
 }
 #############################################################################################
+#added by Mister Ed October 2005
+sub order_management_settings_screen {
+local ($the_id,$temp,$whoami);
+print &$manager_page_header("Order Management Options","","","","");
+$temp = $ENV{'PATH'};
+$ENV{'PATH'} = "/bin:/usr/bin";
+$the_id = `id`;
+$whoami = `whoami`;
+$ENV{'PATH'} = $temp;
+print <<ENDOFTEXT;
+<CENTER>
+<HR>
+</CENTER>
 
-sub tracking_screen
+<CENTER>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL>Welcome to the Order Management section of the
+<b>AgoraCart</b> System Manager.
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+
+ENDOFTEXT
+
+if($in{'system_edit_success'} ne "")
 {
+print <<ENDOFTEXT;
+<CENTER>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL SIZE=2 COLOR=RED>Settings have been
+successfully updated.</FONT>
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+ENDOFTEXT
+}
 
-print &$manager_page_header("Tracking","","","","");
+&display_ordermanagement_settings_choices;
 
-$| = 1;
+print <<ENDOFTEXT;
+
+<CENTER>
+<HR>
+</CENTER>
+ENDOFTEXT
+print &$manager_page_footer;
+}
+#############################################################################################
+#added by Mister Ed October 2005
+sub merchandising_tools_settings_screen {
+local ($the_id,$temp,$whoami);
+print &$manager_page_header("Merchandising Tools Management Options","","","","");
+$temp = $ENV{'PATH'};
+$ENV{'PATH'} = "/bin:/usr/bin";
+$the_id = `id`;
+$whoami = `whoami`;
+$ENV{'PATH'} = $temp;
+print <<ENDOFTEXT;
+<CENTER>
+<HR>
+</CENTER>
+
+<CENTER>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL>Welcome to the Merchandising Tools section of the
+<b>AgoraCart</b> System Manager.
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+
+ENDOFTEXT
+
+if($in{'system_edit_success'} ne "")
+{
+print <<ENDOFTEXT;
+<CENTER>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL SIZE=2 COLOR=RED>Settings have been
+successfully updated.</FONT>
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+ENDOFTEXT
+}
+
+&display_merchandisingtools_settings_choices;
+print <<ENDOFTEXT;
 
+<CENTER>
+<HR>
+</CENTER>
+ENDOFTEXT
+print &$manager_page_footer;
+}
+#############################################################################################
+sub tracking_screen
+{
+print &$manager_page_header("Tracking","","","","");
+$| = 1;
 print <<ENDOFTEXT;
 <CENTER>
 <HR WIDTH=500>
@@ -788,7 +1365,8 @@
 <TABLE WIDTH=500>
 <TR>
 <TD>
-
+<HR WIDTH=500>
+<a href="manager.cgi?clear_access_log=yes"><b>CLEAR ACCESS LOG</b></a><br>
 <HR WIDTH=500>
 <FONT FACE=ARIAL SIZE=2>
 <h4>These are the pages that are linking to your store</h4><br>
@@ -796,87 +1374,51 @@
 ENDOFTEXT
 
 $datafile = "./log_files/access.log";
-
 open(DATABASE, "$datafile") || die "Can't Open $datafile";
-
 while(<DATABASE>)
-
-	{
-
+  {
 ($url, $shortdate, $requested_page, $visit_number, $ip_address, $browser_type, 
  $referring_page, $unix_date) = split(/\|/, $_);
-
 $referring_page = substr($referring_page, 0, 110);
 $requested_page = substr($requested_page, 0, 110);
-
 foreach ($referring_page) {
-
-	if ($requested_page ne "")
-	{
-	$referring_page_count{$referring_page}++;
-	}
+  if ($requested_page ne "")
+  {
+  $referring_page_count{$referring_page}++;
+  }
 }
-
-#####
 foreach ($requested_page) {
-
-	if ($referring_page eq "possible bookmarks"){
-
-	if ($requested_page ne "")
-	{
-	$count_bookmarked_pages{$requested_page}++;
-	}
-
-}	
-#####
+  if ($referring_page eq "possible bookmarks"){
+  if ($requested_page ne "")
+  {
+  $count_bookmarked_pages{$requested_page}++;
+  }
+} 
 foreach ($requested_page) {
-
-	if ($requested_page ne ""){
-
-	$count_first_hit_pages{$requested_page}++;
-	}
-
+  if ($requested_page ne ""){
+  $count_first_hit_pages{$requested_page}++;
+  }
 }
-#####
 foreach ($ip_address) {
-
-	if ($ip_address ne ""){
-
-	$count_ip{$ip_address}++;
-	}
-
+  if ($ip_address ne ""){
+  $count_ip{$ip_address}++;
+  }
 }
-#####
 foreach ($visit_number) {
-
-	if ($visit_number ne ""){
-
-	$count_visit{$visit_number}++;
-	}
-
+  if ($visit_number ne ""){
+  $count_visit{$visit_number}++;
+  }
 }
-#####
 foreach ($browser_type) {
-
-	if ($browser_type ne ""){
-
-	$count_browser{$browser_type}++;
-	}
-
+  if ($browser_type ne ""){
+  $count_browser{$browser_type}++;
+ }
 }
-#####
-
 }
-	}
-
+  }
 close DATABASE;
-
-###########################################
-
 foreach $referring_page (sort { $referring_page_count{$b} <=> $referring_page_count{$a} } keys %referring_page_count) {
-
 if ($referring_page_count{$referring_page} > 1)
-
 {
 print <<ENDOFTEXT;
 
@@ -884,12 +1426,7 @@
 
 ENDOFTEXT
 }
-
 }
-
-
-###########################################
-
 print <<ENDOFTEXT;
 
 <BR>
@@ -902,9 +1439,7 @@
 ENDOFTEXT
 
 foreach $requested_page (sort { $count_bookmarked_pages{$b} <=> $count_bookmarked_pages{$a} } keys %count_bookmarked_pages) {
-
 if ($count_bookmarked_pages{$requested_page} > 1)
-
 {
 print <<ENDOFTEXT;
 
@@ -912,11 +1447,7 @@
 
 ENDOFTEXT
 }
-
 }
-
-##########################################
-
 print <<ENDOFTEXT;
 
 <BR>
@@ -939,11 +1470,8 @@
 
 ENDOFTEXT
 }
-
 }
 
-##########################################
-
 print <<ENDOFTEXT;
 
 <BR>
@@ -956,9 +1484,7 @@
 ENDOFTEXT
 
 foreach $ip_address (sort { $count_ip{$b} <=> $count_ip{$a} } keys %count_ip) {
-
 if ($count_ip{$ip_address} > 1)
-
 {
 print <<ENDOFTEXT;
 
@@ -966,11 +1492,7 @@
 
 ENDOFTEXT
 }
-
 }
-
-##########################################
-
 print <<ENDOFTEXT;
 
 <BR>
@@ -983,9 +1505,7 @@
 ENDOFTEXT
 
 foreach $browser_type (sort { $count_browser{$b} <=> $count_browser{$a} } keys %count_browser) {
-
 if ($count_browser{$browser_type} > 1)
-
 {
 print <<ENDOFTEXT;
 
@@ -993,11 +1513,7 @@
 
 ENDOFTEXT
 }
-
 }
-
-#########################################
-
 print <<ENDOFTEXT;
 
 <BR>
@@ -1014,19 +1530,16 @@
 </BODY>
 
 ENDOFTEXT
-
 }
-
+########################################################################### 
+# Written by Steve Kneizys 4-JAN-2000
 ########################################################################### 
 sub make_file_option_list {
-
  local($my_path,$add_path_to_option_value) = @_;
  local($answer) = "";
-
  opendir (USER_FILES, "$my_path");
  @files = sort(grep(/\w/,readdir(USER_FILES)));
- 
- foreach $filename (@files) {
+  foreach $filename (@files) {
   if (-f "$my_path/$filename") {
     if ($add_path_to_option_value =~ /yes/i) {
       $answer .= "<option value=\"$my_path/$filename\">$filename</option>\n";
@@ -1043,31 +1556,26 @@
 }
 #############################################################################################
 # Writen by Steve Kneizys to serve images 04-FEB-2000
+# HTML usage examples:
+# <IMG SRC="xxx.cgi?picserve=/images/store.jpg" BORDER=0>
+# <IMG SRC="xxx.cgi?picserve=http://www.site.com/images/store.jpg" BORDER=0>
 #
-
+# Note: using the http:// format is less efficient
+# converted to taint-mode sub 2/5/2000
 sub serve_picture
 {
-
  local ($qstr, $sc_path_of_images_directory) = @_;
  local ($test, $test2, $my_path_to_image);
-
  $qstr =~ /([\w\-\=\+\/\.\:]+)/;
  $qstr = "$1";
-
  $my_path_to_image = $sc_path_of_images_directory . $qstr ;
-
  $test = substr($my_path_to_image,0,6);
  $test2 = substr($my_path_to_image,(length($my_path_to_image)-3),3);
-
  if ($test2 =~ /jpg/i || $test2 =~ /png/i || $test2 =~ /gif/i) {
   if ($test2 =~ /jpg/i) {
     $test2 = "jpeg";
    } 
   if ($test=~ /http:\//i || $test =~ /https:/i) { 
-   # need to GET the info
-#    use LWP::Simple;
-#    print "Content-type: image/$test2\n\n";
-#    print get($my_path_to_image);
    } else { 
     print "Content-type: image/$test2\n\n";
     open(MYPIC,$my_path_to_image);
@@ -1081,9 +1589,54 @@
  }
 }
 #######################################################################
+sub format_pricemgr
+{
+local ($unformatted_price) = @_;
+local ($formatted_price);
+$formatted_price = sprintf ("%.2f", $unformatted_price);
+return $formatted_price;
+}
+############################################################
+#added by Mister Ed October 2005
+sub set_log_years_months {
+if ($scm_logdirs_loaded ne "done") {
+opendir(LOGYEARS,"$scm_order_logpath")||die("Cannot open Orders Directory!");
+%scm_logyears = "";
+$scm_logyearsCount = "0";
+my @scm_logyearsTemp = readdir(LOGYEARS);
+close (LOGYEARS);
+foreach $scm_logyearsTemp(@scm_logyearsTemp) {
+  if (($scm_logyearsTemp =~ /(\d{4})/) && (!($scm_logyearsTemp =~ /[a-zA-Z]/))) {
+      $scm_logyears{$scm_logyearsTemp} = "$scm_logyearsCount";
+      $scm_logyearsCount++;
+  }
+}
+$scm_yearlinks = "";
+$scm_monthlinks = "";
+@yearlogkeys = sort(keys(%scm_logyears));
+foreach $yearlogkeys(@yearlogkeys) {
+if ($yearlogkeys ne ""){
+$scm_logyears{$scm_logyearsCount} = "$yearlogkeys";
+$scm_yearlinks .= "<option>$yearlogkeys</option>\n";
+}
+}
+@monthsLong = ('January','February','March','April','May','June','July',
+     'August','September','October','November','December');
+foreach $monthsLong(@monthsLong) {
+$scm_monthlinks .= "<option>$monthsLong</option>\n";
+}
+my $daysofmonth = 1;
+while ($daysofmonth < 32) {
+$scm_daylinks .= "<option>$daysofmonth</option>\n";
+$daysofmonth++;
+}
+}
+$scm_logdirs_loaded = "done";
+}
+############################################################
+# Added by Mister Ed at AgoraCart.com in 2002
 sub log_out
 {
-
 if (-e "$ip_file")
  {
   unlink ("$ip_file"); }
diff -ruN 4.0K-4b/protected/store_css_design-ext_lib.pl 5.0.000/protected/store_css_design-ext_lib.pl
--- 4.0K-4b/protected/store_css_design-ext_lib.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/protected/store_css_design-ext_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,322 @@
+# file ./store/protected/store_css_design-ext_lib.pl
+
+$versions{'store_css_design-ext_lib.pl'} = "5.0.000";
+#######################################################################################
+# Misc Variables 
+  $stylename = "agorastyles.css";
+  $templatestylename = "agoratemplate.css";
+  $mc_meta_tags_css = qq~<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">~;
+  $mc_doctype = qq~<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">~;
+#######################################################################################
+{
+ local ($modname) = 'store_css_design';
+ &register_extension($modname,"Store CSS Design Editor",$versions{$modname});
+ &add_settings_choice("store css design editor","Store Design - CSS Editor",
+  "store_design_editor_screen");
+ &register_menu('store_design_editor_screen',"change_store_design_editor_screen",
+  $modname,"Display CSS Design Settings");
+ &register_menu('ChangeStoreDesign',"action_change_design_settings",
+  $modname,"Write CSS Design Settings");
+}
+
+&require_supporting_libraries(__FILE__,__LINE__,
+  "$mgrdir/misc/mgr_css.pl");
+################################################################################
+sub set_css_file_path{
+  # Set the path to the style sheet
+  $i=1;
+  $mc_css_file_path = "";
+  while($i<=$mc_levels_to_root)
+  {
+    $mc_css_file_path .= "../";
+    $i++;
+  }
+}
+#######################################################################################
+sub action_change_design_settings {
+  my($info);
+  local($css_file_path);
+  my($myset,$myset2)="";
+
+  &ReadParse;
+
+  $mc_template_css_at_root = $in{'mc_template_css_at_root'};
+  $myset2 .= "\$mc_template_css_at_root = \"$in{'mc_template_css_at_root'}\";\n";
+
+  my $tempURLthingyForTemplates = "html/html-templates/templates/$sc_headerTemplateName/$templatestylename";
+
+  #setting the path to the css file
+  $mc_levels_to_root = "$in{'mc_levels_to_root'}";
+  $myset2 .= "\$mc_levels_to_root = \"$in{'mc_levels_to_root'}\";\n";
+  &set_css_file_path;
+
+ $myset2 .= "\$mc_css_file_path = \"$mc_css_file_path\";\n";
+
+  if ($mc_template_css_at_root =~ /yes/i) {
+      $tempURLthingyForTemplates = "$mc_css_file_path$templatestylename";
+  }
+
+  # need to place all of that into the $sc_standard_head_info variable in the correct format
+   $myset .= "\$sc_standard_head_info = qq~<link rel=\"stylesheet\" type=\"text/css\" href=\"$mc_css_file_path$stylename\" media=\"screen\">\n";
+  $myset .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"$tempURLthingyForTemplates\" media=\"screen\">\n";
+  $myset .= "$mc_meta_tags_css\n";
+  $myset .= qq!$in{'mc_additional_head_info'}\n~;\n!;
+
+if ($sc_ssl_location_url2 ne ''){
+  my $temp_SSL = $sc_ssl_location_url2;
+  $temp_SSL =~ s/agora\.cgi//i;
+  $myset .= "\$sc_secure_standard_head_info = qq!<link rel=\"stylesheet\" type=\"text/css\" href=\"$temp_SSL$stylename\" media=\"screen\">\n";
+  $myset .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"$temp_SSL$tempURLthingyForTemplates\" media=\"screen\">\n";
+  $myset .= "$mc_meta_tags_css\n";
+  $myset .= qq~$in{'mc_additional_head_info'}\n!;\n~;
+  $in{'mc_additional_head_info'} = &my_escape($in{'mc_additional_head_info'});
+  $myset2 .= "\$mc_additional_head_info = qq~$in{'mc_additional_head_info'}~;\n";
+}
+
+  #DOCTYPE
+  $myset .= "\$sc_doctype =  qq~$mc_doctype~;\n";
+  
+  #manager row count display
+  $myset2 .= "\$mc_css_row_count = \"$in{'mc_css_row_count'}\";\n";
+
+  #update the CSS file  
+  $new_css_file = "$in{'changed_css_file'}";
+  open (NEWCSSFILE,'>', "$mc_css_file_path$stylename");
+    print NEWCSSFILE $new_css_file;
+  close (NEWCSSFILE);
+
+  $new_css_file = "$in{'changed_template_css_file'}";
+  open (NEWCSSFILE,'>', "$tempURLthingyForTemplates");
+    print NEWCSSFILE $new_css_file;
+  close (NEWCSSFILE);
+  
+  
+  &update_store_settings('cssdesign',$myset); # store css settings
+  &update_CSS_MGR_settings("$mgrdir/misc/mgr_css.pl",$myset2); # mgr css settings
+  &change_store_design_editor_screen;
+ }
+
+
+################################################################################
+sub change_store_design_editor_screen
+{
+print &$manager_page_header("Store CSS Design Editor","","","","");
+
+&set_css_file_path;
+
+print <<ENDOFTEXT;
+<CENTER>
+<HR>
+</CENTER>
+
+<FORM ACTION="manager.cgi" METHOD="POST">
+<CENTER>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL>Welcome to the <b>AgoraCart</b> System Manager
+Storewide CSS Design settings.  This manager allows you to setup your 
+main store CSS (cascading style sheet) and template CSS settings as well as edit the files themselves if you'd like.  See the <a href="manager.cgi?change_store_layout_screen=yes">Store Layout Manager</a> for other misc layout items not covered here.  <small><b>NOTE: if using a template, setup the <a href="manager.cgi?change_Template_screen=yes">Store Templates - Header/Footer</a> Manager before changing any CSS settings in this manager</b></small></TD>
+</TR>
+</TABLE>
+</CENTER>
+
+ENDOFTEXT
+
+if($in{'system_edit_success'} ne "")
+{
+print <<ENDOFTEXT;
+<CENTER>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL SIZE=2 COLOR=RED>System settings have been 
+successfully updated. </FONT>
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+ENDOFTEXT
+}
+
+if ($mc_css_row_count < 4) {
+  $mc_css_row_count=4;
+ }
+if ($mc_css_row_count >200) {
+  $mc_css_row_count=200;
+ }
+
+print <<ENDOFTEXT;
+
+<FONT FACE=ARIAL SIZE=2>
+<CENTER>
+<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0>
+
+<TR>
+<TD COLSPAN=2><HR/></TD>
+</TR>
+
+<TR>
+<TD colspan="2"><br/><b>Number of levels between agora.cgi and the CSS file.</b><br/>
+By default the CSS file ($stylename) is installed in the <em>store</em> dir along 
+with the agora.cgi file. If you've moved the CSS file from this location please 
+specify the number of levels to access it. Also if the <em>store</em> dir is 
+inside of the cgi-bin you may have to move the CSS file to the root dir. To do so 
+simply adjust the levels to the CSS file below to take you outside of the cgi-bin.<br/>
+<small>Examples:<br/>
+location of agora.cgi -> http://www.domain.com/cgi-bin/store/<br/>
+location of css file ---> http://www.domain.com/<br/>
+Number of levels would be <b>2</b>.</small><br/><br/>
+<b>Number of Levels to CSS file:</b>
+<SELECT NAME="mc_levels_to_root">
+<OPTION>$mc_levels_to_root</OPTION>
+<OPTION>0</OPTION>
+<OPTION>1</OPTION>
+<OPTION>2</OPTION>
+<OPTION>3</OPTION>
+<OPTION>4</OPTION>
+<OPTION>5</OPTION>
+<OPTION>6</OPTION>
+</SELECT>
+<br><br>
+<b>Do you need to make a copy of the template CSS file in same location as the main CSS file?</b>
+<SELECT NAME="mc_template_css_at_root">
+<OPTION>$mc_template_css_at_root</OPTION>
+<OPTION>no</OPTION>
+<OPTION>yes</OPTION>
+</SELECT>
+<!--<br><br>
+Enter the entire SSL URL for the CSS file:<br><small>NOTE: use only if having problems with some gateways that don't pass client back over to store properly in SSL modes. Enter in https://secure.server.com/~accountname/store/agorastyles.css format as applies to your webhosting SSL capabilities</small><br>
+<INPUT NAME="sc_secure_css_url" TYPE="TEXT" SIZE=40 
+MAXLENGTH="70" VALUE="$sc_secure_css_url">-->
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD colspan="2"><b>Additional items to be included inside of the &lt;head&gt; section</b><br/>
+This would be where you include any <b>javascript</b> or <b>meta tags</b> you wish to show up on
+all pages thoughout the entire site. You can also enter additional style sheets, just 
+make sure there are no confliting entries between the two.
+<small>DO NOT enter the full web path, instead enter it in the form ../../. 
+If you include the hostname and try running in secure mode you might have issues 
+with getting the padlock to show up.</small><br/>
+Example: <b>&lt;script type="text/javascript" language="javascript" 
+src="../../scripts/functions.js"&gt;&lt;/script&gt;</b><br/>
+<TEXTAREA NAME="mc_additional_head_info" 
+cols="68" rows="5">$mc_additional_head_info</TEXTAREA> </TD>
+</TR>
+
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN="1" align=left>
+<b>CSS File:</b>
+</TD>
+<TD COLSPAN="1" align=right>
+Number of Rows:<br/>
+<INPUT TYPE=TEXT SIZE=5 
+NAME="mc_css_row_count"
+VALUE="$mc_css_row_count">
+</TD>
+</TR>
+
+ENDOFTEXT
+# set the path to the CSS File 
+open (CSSFile, "< $mc_css_file_path$stylename");# || die ('Could not find file') ;
+local $full_css_file;
+   while(<CSSFile>) { 
+     $full_css_file .= $_ ;
+   }
+close (CSSFile);
+print <<ENDOFTEXT;
+
+<TR>
+<TD COLSPAN="2"><br>
+Here are the current contents of the main CSS file located at: <em>$mc_css_file_path$stylename</em><br>
+Feel free to do any edits using this interface, or you may download the CSS file
+and make the changes manually.
+<TEXTAREA NAME="changed_css_file" cols="68" 
+rows="$mc_css_row_count"
+wrap=off>$full_css_file</TEXTAREA> 
+</TD>
+</TR>
+
+ENDOFTEXT
+
+  my $tempURLthingyForTemplates = "html/html-templates/templates/$sc_headerTemplateName/$templatestylename";
+
+  if (($mc_template_css_at_root =~ /yes/i) && (-e "$mc_css_file_path$templatestylename")) {
+        $tempURLthingyForTemplates = "$mc_css_file_path$templatestylename";
+  }
+open (CSSTEMPLATEFile, "< $tempURLthingyForTemplates");# || die ('Could not find file') ;
+local $full_template_css_file;
+   while(<CSSTEMPLATEFile>) { 
+     $full_template_css_file .= $_ ;
+   }
+close (CSSTEMPLATEFile);
+print <<ENDOFTEXT;
+
+<TR>
+<TD COLSPAN="2"><br>
+Here are the current contents of the template CSS file for your store header and footer located at:<br><em>$tempURLthingyForTemplates</em><br>
+Feel free to do any edits using this interface, or you may download the CSS file
+and make the changes manually.
+<TEXTAREA NAME="changed_template_css_file" cols="68" 
+rows="$mc_css_row_count"
+wrap=off>$full_template_css_file</TEXTAREA> 
+</TD>
+</TR>
+
+
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+<CENTER>
+<INPUT TYPE="HIDDEN" NAME="system_edit_success" VALUE="yes">
+<INPUT NAME="ChangeStoreDesign" TYPE="SUBMIT" VALUE="Submit">
+&nbsp;&nbsp;
+<INPUT TYPE="RESET" VALUE="Reset">
+</CENTER>
+</TD>
+</TR>
+
+<TR>
+<TD COLSPAN=2>
+<HR>
+</TD>
+</TR>
+
+</TABLE>
+
+</CENTER>
+</FORM>
+ENDOFTEXT
+print &$manager_page_footer;
+}
+################################################################################
+sub update_CSS_MGR_settings {
+  my($item,$stuff) = @_;
+  $css_file_settings{$item} = $stuff;
+local($css_settings) = "$mgrdir/misc/mgr_css.pl";
+  my($item,$zitem);
+  open(CSSFILE,">$css_settings") || &my_die("Can't Open $css_settings");
+  foreach $zitem (sort(keys %css_file_settings)) {
+    $item = $zitem;
+     print (CSSFILE $css_file_settings{$zitem});
+   }
+  close(CSSFILE);
+&require_supporting_libraries(__FILE__,__LINE__,
+  "$mgrdir/misc/mgr_css.pl");
+ }
+#######################################################################################
+1; # Library
\ No newline at end of file
diff -ruN 4.0K-4b/protected/store_layout_display-ext_lib.pl 5.0.000/protected/store_layout_display-ext_lib.pl
--- 4.0K-4b/protected/store_layout_display-ext_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/protected/store_layout_display-ext_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,7 +1,7 @@
 # file ./store/protected/store_layout_display-ext_lib.pl
 #########################################################################
 #
-# Copyright (c) 2002 K-Factor Technologies, Inc.
+# Copyright (c) 2002-Present K-Factor Technologies, Inc.
 # http://www.k-factor.net/  and  http://www.AgoraCart.com/
 # All Rights Reserved.
 #
@@ -25,81 +25,61 @@
 # written permission.
 #
 ##########################################################################
-$versions{'layout manager'} = "20021020";
+$versions{'store_layout_display-ext_lib.pl'} = "5.0.000";
 
 {
- local ($modname) = 'store_layout_display';
- &register_extension($modname,"Store Layout Settings",$versions{$modname});
- &add_settings_choice("Store Layout"," Store Layout ",
-	"change_store_layout_screen");
+ local ($modname) = 'misc_store_layout_display';
+ &register_extension($modname,"Misc Store Layout Settings",$versions{$modname});
+ &add_settings_choice("Store Design Misc Layout","Store Design - Misc Settings",
+  "change_store_layout_screen");
  &register_menu('LayoutSettings',"write_store_layout_settings",
-	$modname,"Write Store Layout Settings");
+  $modname,"Write Store Layout Settings");
  &register_menu('change_store_layout_screen',"display_store_layout_screen",
-	$modname,"Display Store Layout Settings");
- &add_item_to_manager_menu("Store Layout","change_store_layout_screen=yes","");
+  $modname,"Display Store Layout Settings");
+# &add_item_to_manager_menu("Store Layout","change_store_layout_screen=yes","");
 }
 #######################################################################################
 sub write_store_layout_settings {
-local($info);
-local($myset)="";
-local(@temp,$junk);
+my ($info,$thanks_info, $temp_page_thanks_layout2);
+my ($myset)="";
+my (@temp,$junk);
 
   &ReadParse;
 
-$myset .= "\$layout_store_page_font_color = \"$in{'layout_store_page_font_color'}\";\n";
-$myset .= "\$layout_store_page_linkfont_color = \"$in{'layout_store_page_linkfont_color'}\";\n";
-$myset .= "\$layout_store_page_vlinkfont_color = \"$in{'layout_store_page_vlinkfont_color'}\";\n";
-$myset .= "\$layout_store_page_bgcolor = \"$in{'layout_store_page_bgcolor'}\";\n";
-$myset .= "\$layout_store_page_bgimage = \"$in{'layout_store_page_bgimage'}\";\n";
-if ($in{'layout_store_page_bgimage'} ne '') {
-$temp_page_body_layout = "text=$in{'layout_store_page_font_color'} Link=$in{'layout_store_page_linkfont_color'} vlink=$in{'layout_store_page_vlinkfont_color'} BGCOLOR=\"$in{'layout_store_page_bgcolor'}\" Background=\"$in{'layout_store_page_bgimage'}\"";
-} else {
-$temp_page_body_layout = "text=$in{'layout_store_page_font_color'} Link=$in{'layout_store_page_linkfont_color'} vlink=$in{'layout_store_page_vlinkfont_color'} BGCOLOR=\"$in{'layout_store_page_bgcolor'}\"";
-}
-$myset .= "\$sc_standard_body_info = \'$temp_page_body_layout\';\n";
-$myset .= "\$layout_store_productpage_width = \"$in{'layout_store_productpage_width'}\";\n";
-$temp_page_width_layout = "qq!<CENTER><TABLE BORDER=0 WIDTH=$in{'layout_store_productpage_width'}>!";
-$myset .= "\$sc_product_display_header = $temp_page_width_layout;\n";
-$myset .= "\$layout_store_productpage_thanks_size = \"$in{'layout_store_productpage_thanks_size'}\";\n";
-$myset .= "\$layout_store_productpage_thanks_color = \"$in{'layout_store_productpage_thanks_color'}\";\n";
-$myset .= "\$layout_store_productpage_thanks_font = \"$in{'layout_store_productpage_thanks_font'}\";\n";
-$myset .= "\$layout_store_productpage_thanks_mess = \"$in{'layout_store_productpage_thanks_mess'}\";\n";
-$temp_page_thanks_layout2 = "<TR><TD COLSPAN=3><CENTER><FONT FACE=\"$in{'layout_store_font_style'}\" SIZE=$in{'layout_store_productpage_thanks_size'} COLOR=$in{'layout_store_productpage_thanks_color'}>$in{'layout_store_productpage_thanks_mess'}</FONT></CENTER></TD></TR>";
+
+$myset .= "\$sc_use_html_product_pages = \"$in{'sc_use_html_product_pages'}\";\n";
+$myset .= "\$sc_use_category_name_as_header = \"$in{'sc_use_category_name_as_header'}\";\n";
+$myset .= "\$sc_use_category_name_as_ppinc_root = \"$in{'sc_use_category_name_as_ppinc_root'}\";\n";
+
+$myset .= "\$sc_should_i_display_cart_after_purchase = \"$in{'sc_should_i_display_cart_after_purchase'}\";\n";
+$myset .= "\$sc_should_i_display_cart_after_purchase_real = \"$in{'sc_should_i_display_cart_after_purchase'}\";\n";
+$myset .= "\$sc_db_max_rows_returned = \"$in{'sc_db_max_rows_returned'}\";\n";
+$temp_money_symbol = &my_escape($in{'sc_money_symbol'});
+if ($temp_money_symbol =~ /\$/i) {
+$myset .= "\$sc_money_symbol = qq`$temp_money_symbol`;\n";
+ } else {
+  $myset .= "\$sc_money_symbol = \'$in{'sc_money_symbol'}\';\n";
+ }
+$myset .= "\$sc_money_symbol_placement = \"$in{'sc_money_symbol_placement'}\";\n";
+$myset .= "\$sc_money_symbol_spaces = \"$in{'sc_money_symbol_spaces'}\";\n";
+$thanks_info = &my_escape($in{'layout_store_productpage_thanks_mess'});
+$myset .= "\$layout_store_productpage_thanks_mess = qq~$thanks_info~;\n";
+$temp_page_thanks_layout2 = "<tr><td class=\"ac_add_message\">$in{'layout_store_productpage_thanks_mess'}</td></tr>";
+my $temp_message = &my_escape($in{'sc_search_error_message'});
+$myset .= "\$sc_search_error_message = qq~$temp_message~;\n";
 $myset .= "\$sc_item_ordered_message = \'$temp_page_thanks_layout2\';\n";
-$myset .= "\$layout_store_cart_table_border = \"$in{'layout_store_cart_table_border'}\";\n";
-$myset .= "\$layout_store_cart_table_cellpadding = \"$in{'layout_store_cart_table_cellpadding'}\";\n";
-$myset .= "\$layout_store_cart_table_cellspacing = \"$in{'layout_store_cart_table_cellspacing'}\";\n";
-$myset .= "\$layout_store_cart_table_bgcolor = \"$in{'layout_store_cart_table_bgcolor'}\";\n";
-$temp_cart_table_layout = "BORDER=$in{'layout_store_cart_table_border'} CELLPADDING=$in{'layout_store_cart_table_cellpadding'} CELLSPACING=$in{'layout_store_cart_table_cellspacing'} BGCOLOR=\"$in{'layout_store_cart_table_bgcolor'}\"";
-$myset .= "\$cart_table_def = \'$temp_cart_table_layout\';\n";
-$myset .= "\$layout_store_cart_table_header_bgcolor = \"$in{'layout_store_cart_table_header_bgcolor'}\";\n";
-$temp_cart_table_header_layout = "BGCOLOR=\"$in{'layout_store_cart_table_header_bgcolor'}\"";
-$myset .= "\$cart_heading_def = \'$temp_cart_table_header_layout\';\n";
-$myset .= "\$layout_store_order_table_border = \"$in{'layout_store_order_table_border'}\";\n";
-$myset .= "\$layout_store_order_table_cellpadding = \"$in{'layout_store_order_table_cellpadding'}\";\n";
-$myset .= "\$layout_store_order_table_cellspacing = \"$in{'layout_store_order_table_cellspacing'}\";\n";
-$myset .= "\$layout_store_order_table_bgcolor = \"$in{'layout_store_order_table_bgcolor'}\";\n";
-$temp_order_table_layout = "BORDER=$in{'layout_store_order_table_border'} CELLPADDING=$in{'layout_store_order_table_cellpadding'} CELLSPACING=$in{'layout_store_order_table_cellspacing'} BGCOLOR=\"$in{'layout_store_order_table_bgcolor'}\"";
-$myset .= "\$order_table_def = \'$temp_order_table_layout\';\n";
-$myset .= "\$layout_store_order_table_header_bgcolor = \"$in{'layout_store_order_table_header_bgcolor'}\";\n";
-$temp_order_table_header_layout = "align=center colspan=2 BGCOLOR=\"$in{'layout_store_order_table_header_bgcolor'}\"";
-$myset .= "\$order_heading_def = \'$temp_order_table_header_layout\';\n";
+$myset .= "\$sc_show_shipping_label_box = \"$in{'sc_show_shipping_label_box'}\";\n";
 $myset .= "\$sc_totals_table_ship_label = \"$in{'sc_totals_table_ship_label'}\";\n";
 $myset .= "\$sc_totals_table_disc_label = \"$in{'sc_totals_table_disc_label'}\";\n";
 $myset .= "\$sc_totals_table_stax_label = \"$in{'sc_totals_table_stax_label'}\";\n";
 $myset .= "\$sc_totals_table_gtot_label = \"$in{'sc_totals_table_gtot_label'}\";\n";
 $myset .= "\$sc_totals_table_itot_label = \"$in{'sc_totals_table_itot_label'}\";\n";
 $myset .= "\$sc_totals_table_thdr_label = \"$in{'sc_totals_table_thdr_label'}\";\n";
-$myset .= "\$layout_store_font_style = \"$in{'layout_store_font_style'}\";\n";
-$myset .= "\$layout_store_font_size = \"$in{'layout_store_font_size'}\";\n";
-$myset .= "\$layout_store_font_color = \"$in{'layout_store_font_color'}\";\n";
-$temp_cart_font_style1 = "<FONT FACE=\"$in{'layout_store_font_style'}\" SIZE=$in{'layout_store_font_size'} color=\"$in{'layout_store_font_color'}\">";
-$myset .= "\$cart_font_style = \'$temp_cart_font_style1\';\n";
-$myset .= "\$layout_store_font_style2 = \"$in{'layout_store_font_style2'}\";\n";
-$myset .= "\$layout_store_font_size2 = \"$in{'layout_store_font_size2'}\";\n";
-$myset .= "\$layout_store_font_color2 = \"$in{'layout_store_font_color2'}\";\n";
-$temp_cart_font_style2 = "<FONT FACE=\"$in{'layout_store_font_style2'}\" SIZE=$in{'layout_store_font_size2'} color=\"$in{'layout_store_font_color2'}\">";
-$myset .= "\$cartnum_font_style = \'$temp_cart_font_style2\';\n";
+$myset .= "\$sc_display_cartlinksite = \"$in{'sc_display_cartlinksite'}\";\n";
+$myset .= "\$sc_display_cartlinksite_url = \"$in{'sc_display_cartlinksite_url'}\";\n";
+$myset .= "\$sc_display_cartlinksite_name = \"$in{'sc_display_cartlinksite_name'}\";\n";
+$myset .= "\$sc_display_cartlinkhome = \"$in{'sc_display_cartlinkhome'}\";\n";
+$myset .= "\$sc_display_cartlinkhome_name = \"$in{'sc_display_cartlinkhome_name'}\";\n";
 
   &update_store_settings('layout',$myset); # layout settings
   &display_store_layout_screen;
@@ -109,17 +89,25 @@
 {
 print &$manager_page_header("Store Layout","","","","");
 
+if ($sc_show_shipping_label_box eq "") {
+    $sc_show_shipping_label_box = "yes";
+}
+
+if ($sc_search_error_message eq "") {
+    $sc_search_error_message = qq~I'm sorry, no matches were found. Please try your search again.~;
+}
+
 print <<ENDOFTEXT;
 <CENTER>
-<HR WIDTH=580>
+<HR>
 </CENTER>
 
 <FORM ACTION="manager.cgi" METHOD="POST">
 <CENTER>
-<TABLE WIDTH=580>
+<TABLE>
 <TR>
-<TD WIDTH=580>
-<FONT FACE=ARIAL>Welcome to the <b>AgoraCart</b> Store Layout Manager.  The Store Layout manager controls such things as body tag, page header, and table cell attributes as well as general font variables.</TD>
+<TD>
+<FONT FACE=ARIAL>Welcome to the <b>AgoraCart</b> Store Layout Manager.  The Store Layout manager controls misc variables like messages, cart order table titles, and controls for cartlink pages.  To change store attributes like fonts, colors, widths and more; please see the <a href="manager.cgi?store_design_editor_screen=yes">Store CSS Design Manager</a>.</TD>
 </TR>
 </TABLE>
 </CENTER>
@@ -132,7 +120,7 @@
 <CENTER>
 <TABLE>
 <TR>
-<TD>
+<TD><br>
 <FONT FACE=ARIAL SIZE=2 COLOR=RED>System settings have been 
 successfully updated. </FONT>
 </TD>
@@ -145,70 +133,47 @@
 
 print <<ENDOFTEXT;
 
-<FONT FACE=ARIAL SIZE=2><br>
+<FONT FACE=ARIAL SIZE=2>
 <CENTER>
-<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
+<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0>
 <TR>
-<TD COLSPAN=2 BGCOLOR="#E0E5FF"><center><h3><font face="Arial, Helvetica, sans-serif">Main Body Tag Attibutes</font></h3></center></TD>
+<TD><br></TD>
 </TR>
-
 <TR>
-<TD colspan=2><br><font size="2" face="Arial, Helvetica, sans-serif">
-<b>Enter Page Body Attributes:</b><br>this is the attributes of each dynamically generated page such as the background color, background image, and font color for the text and links on the pages.  Colors can be a spelled out color like: red or yellow or in standard RGB notation with the pound sign included, like: \#0000FF.  The background image must be in the same directory as the main Agora.cgi and is case sensitive (must be entered in for of: backimage.gif) ... if not using one, leave the field blank.<br><br>
-Page Font Color: <INPUT NAME="layout_store_page_font_color" TYPE="TEXT" SIZE=7 
-MAXLENGTH="10" VALUE="$layout_store_page_font_color">
-&nbsp;&nbsp;&nbsp;&nbsp;
-Link Font Color: <INPUT NAME="layout_store_page_linkfont_color" TYPE="TEXT" SIZE=7 
-MAXLENGTH="10" VALUE="$layout_store_page_linkfont_color">
-&nbsp;&nbsp;&nbsp;&nbsp;
-Visited Link Font Color: <INPUT NAME="layout_store_page_vlinkfont_color" TYPE="TEXT" SIZE=7 
-MAXLENGTH="10" VALUE="$layout_store_page_vlinkfont_color">
-<br>
-Page Background Color: <INPUT NAME="layout_store_page_bgcolor" TYPE="TEXT" SIZE=7 
-MAXLENGTH="10" VALUE="$layout_store_page_bgcolor">&nbsp;&nbsp;&nbsp;&nbsp;
-Page Background Image: <INPUT NAME="layout_store_page_bgimage" TYPE="TEXT" SIZE=20 
-MAXLENGTH="30" VALUE="$layout_store_page_bgimage">
-</font>
-</TD>
+<TD COLSPAN=4 bgcolor=#99CC99 align=center><font face="Arial, Helvetica, sans-serif" size=+2><b>Dynamic Product Viewing & Page Layout</b></font></TD>
 </TR>
-
 <TR>
-<TD COLSPAN=2><HR><br><br></TD>
+<TD><br></TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2 BGCOLOR="#E0E5FF"><center><h3><font face="Arial, Helvetica, sans-serif">Product Page Info & Table Width</font></h3></center></TD>
-</TR>
-<TR>
-<TD colspan=2><font size="2" face="Arial, Helvetica, sans-serif">
-<b>Enter the width of the table for dynamicly generated product pages:</b><br>this is the master width setting for the product pages (productPage.inc files).<br><br>
-Table Width: <INPUT NAME="layout_store_productpage_width" TYPE="TEXT" SIZE=3 
-MAXLENGTH="3" VALUE="$layout_store_productpage_width">
-</font>
-</TD>
+<TD colspan=2><b>Use Category Name for Header/Footer Includes?</b>  <small>Default is YES which allows you to create and use headers and/or footers for each individual category of products being viewed.  For example, if you have a category named PERL (as listed in product database) and you want to have a custom header (but still use the standard store footer) in that category in such a fashion that is different from the standard store header, then you would create a file called header-PERL.inc (prepend with header-, then the category name - case sensitive, and appended with the .inc which stands for "include".  Category specific footers would be similar in naming convention, but using footer prepended to name instead of header: footer-PERL.inc).  Repeat for every product category you wish to be different from the standard store header (named: store_header.inc) or the standard store footer (named: stoe_footer.inc). <br><br>These files would go into the store's "html/html-templates" sub-directory.  <b>You do not need custom headers or footers for every category name</b>, but if they are put into the store's "html/html-templates" sub-directory, then they will be automatically used the next time that any product or list of products from that category are viewed by a visitor.  You can use either a header or a footer or both as long as they match up layout wise. <b>Speed Enhancement:</b> Your store will run faster with this set to no.</small></TD>
+<TD colspan=2><SELECT NAME="sc_use_category_name_as_header">
+<OPTION>$sc_use_category_name_as_header</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT></TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2><HR></TD>
+<TD COLSPAN=4><HR></TD>
 </TR>
-
 <TR>
-<TD colspan=2><br><font size="2" face="Arial, Helvetica, sans-serif">
-<b>Enter thank you message font attributes:</b><br>the message for dynamicly generated product pages:</b><br>this is basically the thank you message or message of choice that is show after a visitor adds an item to the cart (for the product pages productPage.inc type files).  Font Face can be multiple fonts separatated by commas: Verdana,Arial,Helvetica,sans-serif.  Sizes can be standard notation: -2,-1,1,2,3,+1,+2,etc.  Colors can be a spelled out color like: red or yellow or in standard RGB notation with the pound sign included, like: \#0000FF.<br><br>
-Thank You Font Color: <INPUT NAME="layout_store_productpage_thanks_color" TYPE="TEXT" SIZE=7 
-MAXLENGTH="10" VALUE="$layout_store_productpage_thanks_color">
-&nbsp;&nbsp;&nbsp;&nbsp;
-Thank You Font Size: <INPUT NAME="layout_store_productpage_thanks_size" TYPE="TEXT" SIZE=2 
-MAXLENGTH="2" VALUE="$layout_store_productpage_thanks_size">
-</font>
-</TD>
+<TD colspan=2><b>Use Category Name as ppinc Root?</b>  <small>Default is YES which allows you to create and drop in product page layouts based on the category name of products being viewed.  For example, if you have a category named PERL (as listed in product database) and you want to layout products in that category in such a fashion that is different from the main product layout, then you would create a file called PERL.inc (must be exactly like category name as listed in product database - is case sensitive, and appended with the .inc which stands for "include)".  Repeat for every product category you wish to be different from the main product layout (main layout file is named: productPage.inc).  These files go into the store's "html/html-templates" sub-directory.  You do not have to have one of these files for every category, but if they are put into the store's "html/html-templates" sub-directory, then they will be automatically used the next time that any product or list of products from that category are viewed by a visitor.  Unless you have a good reason to set this to no, leave set at YES.</small></TD>
+<TD colspan=2><SELECT NAME="sc_use_category_name_as_ppinc_root">
+<OPTION>$sc_use_category_name_as_ppinc_root</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT></TD>
 </TR>
+
 <TR>
-<TD COLSPAN=2><HR></TD>
+<TD COLSPAN=4><HR></TD>
 </TR>
+
 <TR>
-<TD colspan=2><font size="2" face="Arial, Helvetica, sans-serif">
-<b>Enter the message for dynamicly generated product pages:</b><br>this is basically the thank you message or message of choice that is show after a visitor adds an item to the cart (for the product pages productPage.inc type files).  Special characters such as \$ and \" marks may need to be escaped using a preceeding backslash mark, like so: \\\" or \\\$<br><br>
+<TD colspan=4><font size="2" face="Arial, Helvetica, sans-serif">
+<b>Enter the thank you message for dynamicly generated product pages:</b><br>this is basically the thank you message or message of choice that is show after a visitor adds an item to the cart (for the product pages productPage.inc type files).<br><br>
 <TEXTAREA NAME="layout_store_productpage_thanks_mess" cols="68" 
 rows="2" wrap=off>$layout_store_productpage_thanks_mess</TEXTAREA>
 </font>
@@ -216,126 +181,89 @@
 </TR>
 
 <TR>
-<TD COLSPAN=2><HR><br><br></TD>
+<TD COLSPAN=4><HR></TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2 BGCOLOR="#E0E5FF"><center><h3><font face="Arial, Helvetica, sans-serif">Cart Contents Display Table Layout</font></h3></center></TD>
-</TR>
-
-<TR>
-<TD colspan=2><br><font size="2" face="Arial, Helvetica, sans-serif">
-<b>Enter Table attributes for the Cart Contents Display Table:</b><br>this is the table that lists each item added to the cart. The cart contents can be seen during "view cart" and the rest of the check out process.  Color can be a spelled out color like: red or yellow or in standard RGB notation with the pound sign included, like: \#0000FF<br><br>
-Border Width: <INPUT NAME="layout_store_cart_table_border" TYPE="TEXT" SIZE=2 
-MAXLENGTH="2" VALUE="$layout_store_cart_table_border">
-&nbsp;&nbsp;&nbsp;&nbsp;
-Cell Padding: <INPUT NAME="layout_store_cart_table_cellpadding" TYPE="TEXT" SIZE=2 
-MAXLENGTH="2" VALUE="$layout_store_cart_table_cellpadding">
-&nbsp;&nbsp;&nbsp;&nbsp;
-Cell Spacing: <INPUT NAME="layout_store_cart_table_cellspacing" TYPE="TEXT" SIZE=2 
-MAXLENGTH="2" VALUE="$layout_store_cart_table_cellspacing">
-Background Color: <INPUT NAME="layout_store_cart_table_bgcolor" TYPE="TEXT" SIZE=7 
-MAXLENGTH="10" VALUE="$layout_store_cart_table_bgcolor">
-</font>
-</TD>
+<TD colspan=2><b>How do you want to generate database based html product pages?</b>  <small>Default is "maybe" which allows you to generate database product pages unless a specific ppinc page is specified.  "No" will allow you to only generate pages from the products in the database.  Say "yes" if running an HTML-based store and you are not using a database. NOTE: links to cart and database still need to come from the same domain name as AgoraCart runs from.</small></TD>
+<TD colspan=2><SELECT NAME="sc_use_html_product_pages">
+<OPTION>$sc_use_html_product_pages</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+<OPTION>maybe</OPTION>
+</SELECT></TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2><HR></TD>
+<TD COLSPAN=4><HR></TD>
 </TR>
 
 <TR>
-<TD colspan=2><font size="2" face="Arial, Helvetica, sans-serif">
-<b>Enter header background color for the Cart Contents Display Table:</b><br>this is the header for the table that lists each item added to the cart. The cart contents can be seen during "view cart" and the rest of the check out process.  Color can be a spelled out color like: red or yellow or in standard RGB notation with the pound sign included, like: \#0000FF<br><br>
-Background Color: <INPUT NAME="layout_store_cart_table_header_bgcolor" TYPE="TEXT" SIZE=7 
-MAXLENGTH="10" VALUE="$layout_store_cart_table_header_bgcolor">
-</font>
+<TD colspan=2><b>How many products do you wish to display on each product page?</b><br>
+<small>(You may override this on individual links manually by setting the URL/Form variable maxp=nn in a URL like so: agoracgi?%%cart_id%%&maxp=27)   <b>Speed Enhancement:</b> Your store will run faster with this set to the smallest number possible.</small></td>
+<TD colspan=2>
+<INPUT NAME="sc_db_max_rows_returned" TYPE=TEXT SIZE=4 
+  VALUE="$sc_db_max_rows_returned">
 </TD>
-</TR>
-
-<TR>
-<TD COLSPAN=2><HR></TD>
-</TR>
-
-<TR>
-<TD colspan=2><font size="2" face="Arial, Helvetica, sans-serif">
-<b>Enter Font Face and Font Size used for cart contents table headers and and other cart contents table text:</b><br>Font can be multiple fonts separatated by commas: Verdana,Arial,Helvetica,sans-serif.  Sizes can be standard notation: -2,-1,1,2,3,+1,+2,etc.  Color can be a spelled out color like: red or yellow or in standard RGB notation with the pound sign included, like: \#0000FF
-<br><br>
-Face: <INPUT NAME="layout_store_font_style" TYPE="TEXT" SIZE=15 
-MAXLENGTH="40" VALUE="$layout_store_font_style">
-&nbsp;&nbsp;&nbsp;&nbsp;
-Font Size: <INPUT NAME="layout_store_font_size" TYPE="TEXT" SIZE=2 
-MAXLENGTH="2" VALUE="$layout_store_font_size">
-&nbsp;&nbsp;&nbsp;&nbsp;
-Font Color: <INPUT NAME="layout_store_font_color" TYPE="TEXT" SIZE=7 
-MAXLENGTH="10" VALUE="$layout_store_font_color">
-</font>
 </TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2><HR></TD>
+<TD COLSPAN=4><HR></TD>
 </TR>
-
 <TR>
-<TD colspan=2><font size="2" face="Arial, Helvetica, sans-serif">
-<b>Enter Font Face and Font Size used for cart contents table numbers:</b><br>Font can be multiple fonts separatated by commas: Verdana,Arial,Helvetica,sans-serif.  Sizes can be standard notation: -2,-1,1,2,3,+1,+2,etc.  Color can be a spelled out color like: red or yellow or in standard RGB notation with the pound sign included, like: \#0000FF
-<br><br>
-Face: <INPUT NAME="layout_store_font_style2" TYPE="TEXT" SIZE=15 
-MAXLENGTH="40" VALUE="$layout_store_font_style2">
-&nbsp;&nbsp;&nbsp;&nbsp;
-Font Size: <INPUT NAME="layout_store_font_size2" TYPE="TEXT" SIZE=2 
-MAXLENGTH="2" VALUE="$layout_store_font_size2">
-&nbsp;&nbsp;&nbsp;&nbsp;
-Font Color: <INPUT NAME="layout_store_font_color2" TYPE="TEXT" SIZE=7 
-MAXLENGTH="10" VALUE="$layout_store_font_color2">
-</font>
-</TD>
-</TR>
-
-<TR>
-<TD COLSPAN=2><HR><br><br></TD>
+<TD colspan=2><b>How do you want to the customer to view the cart contents after adding an item to the cart?</b>  <small>Default is "no" which takes the customer back to the database generated product page they were originally at with a thank you message generated towards the top of the page.  Say "yes" if running an HTML-based store and you DO NOT want to the customer to go to a database generated product page.</small></TD>
+<TD colspan=2><SELECT NAME="sc_should_i_display_cart_after_purchase">
+<OPTION>$sc_should_i_display_cart_after_purchase</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT></TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2 BGCOLOR="#E0E5FF"><center><h3><font face="Arial, Helvetica, sans-serif">Order Table Display Layout</font></h3></center></TD>
+<TD COLSPAN=4><HR></TD>
 </TR>
 
 <TR>
-<TD colspan=2><br><font size="2" face="Arial, Helvetica, sans-serif">
-<b>Enter Table attributes for the Order Info Display Table:</b><br>this is the table that lists such things as shipping, subtotals, discountss given and the grand total. The order table contents can be seen during "view cart" and the rest of the check out process.  Color can be a spelled out color like: red or yellow or in standard RGB notation with the pound sign included, like: \#0000FF<br><br>
-Border Width: <INPUT NAME="layout_store_order_table_border" TYPE="TEXT" SIZE=2 
-MAXLENGTH="2" VALUE="$layout_store_order_table_border">
-&nbsp;&nbsp;&nbsp;&nbsp;
-Cell Padding: <INPUT NAME="layout_store_order_table_cellpadding" TYPE="TEXT" SIZE=2 
-MAXLENGTH="2" VALUE="$layout_store_order_table_cellpadding">
+<TD colspan=3>
+<b>Enter your Monetary Symbol and Select the position of the Symbol:</b>
+<br>
+Money Symbol (\$  ): <INPUT NAME="sc_money_symbol" TYPE="TEXT" SIZE=1 
+MAXLENGTH="1" VALUE="$sc_money_symbol">
 &nbsp;&nbsp;&nbsp;&nbsp;
-Cell Spacing: <INPUT NAME="layout_store_order_table_cellspacing" TYPE="TEXT" SIZE=2 
-MAXLENGTH="2" VALUE="$layout_store_order_table_cellspacing">
-Background Color: <INPUT NAME="layout_store_order_table_bgcolor" TYPE="TEXT" SIZE=7 
-MAXLENGTH="10" VALUE="$layout_store_order_table_bgcolor">
-</font>
+Position of Symbol: <SELECT NAME=sc_money_symbol_placement>
+<option>$sc_money_symbol_placement</option>
+<option>front</option>
+<option>back</option>
+</SELECT>
+<br>
+Set space/character between money symbol and numeric values: <INPUT NAME="sc_money_symbol_spaces" TYPE="TEXT" SIZE=2
+MAXLENGTH="2" VALUE="$sc_money_symbol_spaces">
+
 </TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2><HR></TD>
+<TD><br></TD>
 </TR>
-
 <TR>
-<TD colspan=2><font size="2" face="Arial, Helvetica, sans-serif">
-<b>Enter header background color for the Order Display Table:</b><br>this is the table that lists such things as shipping, subtotals, discountss given and the grand total. The order table contents can be seen during "view cart" and the rest of the check out process.  Color can be a spelled out color like: red or yellow or in standard RGB notation with the pound sign included, like: \#0000FF<br><br>
-Background Color: <INPUT NAME="layout_store_order_table_header_bgcolor" TYPE="TEXT" SIZE=7 
-MAXLENGTH="10" VALUE="$layout_store_order_table_header_bgcolor">
-</font>
-</TD>
+<TD COLSPAN=4 bgcolor=#99CC99 align=center><font face="Arial, Helvetica, sans-serif" size=+2><b>Order Table Display Layout Section</b></font></TD>
 </TR>
 <TR>
-<TD COLSPAN=2><HR></TD>
+<TD><br></TD>
 </TR>
+
 <TR>
 <TD colspan=2><font size="2" face="Arial, Helvetica, sans-serif">
-<b>Enter header titles for the Order Display Table:</b><br>this is the table that lists such things as shipping, subtotals, discountss given and the grand total. The order table contents can be seen during "view cart" and the rest of the check out process.<br><br>
+<b>Enter header titles for the Order Display Table:</b><br>this is the table that lists such things as shipping, subtotals, discounts given and the grand total. The order table contents can be seen during "view cart" and the rest of the check out process.<br><br>
+
+Display Shipping Label/Costs at View Cart and Checkout?: 
+<SELECT NAME=sc_show_shipping_label_box>
+<option>$sc_show_shipping_label_box</option>
+<option>yes</option>
+<option>no</option>
+</SELECT><br><br>
+
 Shipping Label: <INPUT NAME="sc_totals_table_ship_label" TYPE="TEXT" SIZE=20 
 MAXLENGTH="30" VALUE="$sc_totals_table_ship_label">&nbsp;&nbsp;&nbsp;&nbsp;
 Discount Label: <INPUT NAME="sc_totals_table_disc_label" TYPE="TEXT" SIZE=20 
@@ -351,12 +279,66 @@
 </font>
 </TD>
 </TR>
+
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD COLSPAN=4 bgcolor=#99CC99 align=center><font face="Arial, Helvetica, sans-serif" size=+2><b>Static Pages: CartLinks Section</b></font></TD>
+</TR>
+<TR>
+<TD><br></TD>
+</TR>
+
+<TR>
+<TD colspan=2><br><font size="2" face="Arial, Helvetica, sans-serif">
+<b>Enter Cart Links Info:</b><br>this is where you can designate if a home page link or a main store page with link will be created when using the cartlinks auto linking options.  The URL to your Home Page should be in the form of: www.yoursite.com or www.your-site.com/pagename.html.  <b>Do not</b> add the http:// to the URL.  "Name of links" are the Names shown on the web pages that you would click on to go to the Home Page or Main Store Page<br><br>
+Do you want a link to your Home Page? <SELECT NAME=sc_display_cartlinksite>
+<OPTION SELECTED>$sc_display_cartlinksite</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT><br><br>
+
+URL to your Home Page: <INPUT NAME="sc_display_cartlinksite_url" TYPE="TEXT" SIZE=45 
+MAXLENGTH="75" VALUE="$sc_display_cartlinksite_url"><br><br>
+
+Name of link to the URL to your Home Page: <INPUT NAME="sc_display_cartlinksite_name" TYPE="TEXT" SIZE=20 
+MAXLENGTH="35" VALUE="$sc_display_cartlinksite_name"><br><br>
+
+<br><br>
+Do you want a link to your Main Store Page? <SELECT NAME=sc_display_cartlinkhome>
+<OPTION SELECTED>$sc_display_cartlinkhome</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT><br><br>
+Name of link to the URL to your Main Store Page: <INPUT NAME="sc_display_cartlinkhome_name" TYPE="TEXT" SIZE=20 
+MAXLENGTH="35" VALUE="$sc_display_cartlinkhome_name"><br><br>
+
+</font>
+</TD>
+</TR>
+<TR>
+<TD><br></TD>
+</TR>
+<TR>
+<TD COLSPAN=4 bgcolor=#99CC99 align=center><font face="Arial, Helvetica, sans-serif" size=+2><b>Misc Cart Messages</b></font></TD>
+</TR>
+<TR>
+<TD><br></TD>
+</TR>
+
+<TR>
+<TD colspan=2><br><font size="2" face="Arial, Helvetica, sans-serif">
+<b>Cart Search Error: No Results Found From Searches and/or in Product Categories</b></font><br>
+            <textarea NAME="sc_search_error_message" ROWS="5" COLS="50" 
+            wrap="soft">$sc_search_error_message</textarea><br><br>
+
 <TR>
-<TD COLSPAN=2><HR></TD>
+<TD COLSPAN=4><HR></TD>
 </TR>
 
 <TR>
-<TD COLSPAN=2>
+<TD COLSPAN=4>
 <CENTER>
 <INPUT TYPE="HIDDEN" NAME="system_edit_success" VALUE="yes">
 <INPUT NAME="LayoutSettings" TYPE="SUBMIT" VALUE="Submit">
@@ -367,7 +349,7 @@
 </TR>
 
 <TR>
-<TD COLSPAN=2>
+<TD COLSPAN=4>
 <HR>
 </TD>
 </TR>
diff -ruN 4.0K-4b/protected/tax_settings-ext_lib.pl 5.0.000/protected/tax_settings-ext_lib.pl
--- 4.0K-4b/protected/tax_settings-ext_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/protected/tax_settings-ext_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -1,16 +1,24 @@
 # file ./store/protected/tax_settings-ext_lib.pl
+#
+# Shows how to add a choice to the main settings page on the agora 3.3j
+# and higher manager.  If using on a 3.3 manager before rev j, you must
+# first add the rev 3.3j shim to the custom directory to enable the 3.3j
+# and higher 'ext' functions. These are extensions to the manager.
+# Because the software is modularized upgrades are easier compared to
+# doing a full upgrade.
+#
 
-$versions{'tax_settings'} = "20010902";
+$versions{'tax_settings-ext_lib.pl'} = "5.0.000";
 
 {
  local ($modname) = 'freeform_logic';
  &register_extension($modname,"Tax Logic",$versions{$modname});
- &add_settings_choice("tax settings"," Tax Settings ",
-	"tax_settings_screen");
+ &add_settings_choice("tax settings"," Tax Settings & Logic ",
+  "tax_settings_screen");
  &register_menu('ChangeTaxSettings',"action_input_tax_settings",
-	$modname,"Display Tax Logic");
+  $modname,"Display Tax Logic");
  &register_menu('tax_settings_screen',"show_tax_settings_screen",
-	$modname,"Write Tax Logic");
+  $modname,"Write Tax Logic");
 }
 #############################################################################################
 sub show_tax_settings_screen
@@ -52,14 +60,14 @@
 
 print <<ENDOFTEXT;
 <CENTER>
-<HR WIDTH=580>
+<HR>
 </CENTER>
 
 <CENTER>
-<TABLE WIDTH=580>
+<TABLE>
 <TR>
-<TD WIDTH=580>
-<FONT FACE=ARIAL>Welcome to the <b>AgoraCart</b> System Manager
+<TD>
+<FONT FACE=ARIAL>Welcome to the <b>Agora.cgi</b> System Manager
 Tax Settings. 
 </TD>
 </TR>
@@ -91,16 +99,16 @@
 <FONT FACE=ARIAL SIZE=2>
 <FORM METHOD="POST" ACTION="manager.cgi">
 <CENTER>
-<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=580 BORDER=0>
+<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0>
 
 <TR>
 <TD COLSPAN=2><HR></TD>
 </TR>
 
 <TR>
-<TD>Customers shipping to the state selected here 
-will be charged sales tax</TD>
-<TD>
+<TD><FONT FACE=ARIAL SIZE=2>Customers shipping to the state selected here 
+will be charged sales tax</font></TD>
+<TD><FONT FACE=ARIAL SIZE=2>
 <SELECT NAME=sales_tax_state>
 <OPTION>$sc_sales_tax_state</OPTION>
 <OPTION>None</OPTION> 
@@ -158,32 +166,8 @@
 <OPTION>WV</OPTION> 
 <OPTION>WI</OPTION> 
 <OPTION>WY</OPTION> 
-<OPTION value=""></OPTION>
-<OPTION value="">--AUSTRALIA--</OPTION>
-<OPTION value="ACT">ACT</OPTION>
-<OPTION value="NSW">NSW</OPTION>
-<OPTION value="NT">NT</OPTION>
-<OPTION value="QLD">QLD</OPTION>
-<OPTION value="SA">SA</OPTION>
-<OPTION value="TAS">TAS</OPTION>
-<OPTION value="VIC">VIC</OPTION>
-<OPTION value="WA">WA</OPTION>
-<OPTION value=""></OPTION>
-<OPTION value="">--CANADA--</OPTION>
-<OPTION value="AB">AB</OPTION>
-<OPTION value="BC">BC</OPTION>
-<OPTION value="MB">MB</OPTION>
-<OPTION value="NB">NB</OPTION>
-<OPTION value="NFLD">NFLD</OPTION>
-<OPTION value="NWT">NWT</OPTION>
-<OPTION value="NS">NS</OPTION>
-<OPTION value="ON">ON</OPTION>
-<OPTION value="PEI">PEI</OPTION>
-<OPTION value="PQ">PQ</OPTION>
-<OPTION value="SK">SK</OPTION>
-<OPTION value="YK">YK</OPTION>
 </SELECT>
-</TD>
+</font></TD>
 </TR>
 
 <TR>
@@ -191,26 +175,60 @@
 </TR>
 
 <TR>
-<TD>Enter sales tax percentage here. Enter as a decimal number. <br>
-Ex: "<b>.05</b>" for "5%", "<b>.06</b>" for "6%", etc.<br></TD>
-<TD><INPUT NAME="sales_tax" TYPE="TEXT" VALUE="$sc_sales_tax" 
-SIZE="8" ></TD>
+<TD><FONT FACE=ARIAL SIZE=2>Enter sales tax percentage here. Enter as a decimal number. <br>
+Ex: "<b>.05</b>" for "5%", "<b>.06</b>" for "6%", etc.<br></font></TD>
+<TD><FONT FACE=ARIAL SIZE=2><INPUT NAME="sales_tax" TYPE="TEXT" VALUE="$sc_sales_tax" 
+SIZE="8" ></font></TD>
+</TR>
+<TR>
+<TD COLSPAN=2><HR></TD>
 </TR>
 
 <TR>
+<td><FONT FACE=ARIAL SIZE=2><b>Enable Non-Taxable Products?</b><br>This is an all or nothing setting, no variable tax rates are available at this time.</td>
+<TD><FONT FACE=ARIAL SIZE=2>
+<SELECT NAME=sc_non_taxables_enabled>
+<OPTION>$sc_non_taxables_enabled</OPTION>
+<OPTION>yes</OPTION> 
+<OPTION>no</OPTION> 
+</SELECT>
+</font></TD>
+</td>
+</TR>
+<TR>
+<TD COLSPAN=2><BR></TD>
+</TR>
+
+<TR>
+<td><FONT FACE=ARIAL SIZE=2><b>Which User field</b> in product database do you wish to use?<br><small>Enter "yes" (without the quotes) in the datafield of your choice within each product that you wish to designate as non-taxable.</small></td>
+<TD><FONT FACE=ARIAL SIZE=2>
+<SELECT NAME=sc_non_taxables_db_counter2>
+<OPTION>$sc_non_taxables_db_counter2</OPTION>
+<OPTION value="">None</OPTION>
+<OPTION>User 2</OPTION> 
+<OPTION>User 3</OPTION>
+<OPTION>User 4</OPTION>
+<OPTION>User 5</OPTION>
+$user10_thingy
+$user20_thingy
+</SELECT>
+</font></TD>
+</td></tr>
+
+<TR>
 <TD COLSPAN=2><HR></TD>
 </TR>
 <TR>
-<TD>Show how many rows of custom tax logic below?</TD>
-<TD><INPUT NAME="mc_tax_logic_rows" TYPE="TEXT" 
-VALUE="$mc_tax_logic_rows" SIZE="5"></TD>
+<TD><FONT FACE=ARIAL SIZE=2>Show how many rows of custom tax logic below?</TD>
+<TD><FONT FACE=ARIAL SIZE=2><INPUT NAME="mc_tax_logic_rows" TYPE="TEXT" 
+VALUE="$mc_tax_logic_rows" SIZE="5"></font></TD>
 </TR>
 
 <TR>
 <TD COLSPAN=2><HR></TD>
 </TR>
 
-<TR><TD COLSPAN=2>
+<TR><TD COLSPAN=2><FONT FACE=ARIAL SIZE=2>
 Use Extra Tax 1 Logic? <SELECT NAME='use_tax1_logic'>
 <OPTION>$sc_use_tax1_logic</OPTION>
 <OPTION>yes</OPTION> 
@@ -222,9 +240,9 @@
 <TEXTAREA NAME="sc_extra_tax1_logic" 
 cols="68" rows=$mc_tax_logic_rows 
 wrap=off>$sc_extra_tax1_logic</TEXTAREA> 
-</TD></TR>
+</font></TD></TR>
 
-<TR><TD COLSPAN=2>
+<TR><TD COLSPAN=2><FONT FACE=ARIAL SIZE=2>
 Use Extra Tax 2 Logic? <SELECT NAME='use_tax2_logic'>
 <OPTION>$sc_use_tax2_logic</OPTION>
 <OPTION>yes</OPTION> 
@@ -236,9 +254,9 @@
 <TEXTAREA NAME="sc_extra_tax2_logic" 
 cols="68" rows=$mc_tax_logic_rows 
 wrap=off>$sc_extra_tax2_logic</TEXTAREA> 
-</TD></TR>
+</font></TD></TR>
 
-<TR><TD COLSPAN=2>
+<TR><TD COLSPAN=2><FONT FACE=ARIAL SIZE=2>
 Use Extra Tax 3 Logic? <SELECT NAME='use_tax3_logic'>
 <OPTION>$sc_use_tax3_logic</OPTION>
 <OPTION>yes</OPTION> 
@@ -250,7 +268,7 @@
 <TEXTAREA NAME="sc_extra_tax3_logic" 
 cols="68" rows=$mc_tax_logic_rows 
 wrap=off>$sc_extra_tax3_logic</TEXTAREA> 
-</TD></TR>
+</font></TD></TR>
 
 <TR>
 <TD COLSPAN=2><HR></TD>
@@ -286,7 +304,7 @@
 
 local($admin_email, $order_email, $cookieDomain, $cookiePath);
 local($other_program_settings)="";
-local($myset)="";
+my($myset,$temp_db_thingy)="";
 
 &ReadParse;
 
@@ -307,8 +325,29 @@
 $admin_email = $in{'admin_email'};
 $admin_email =~ s/\@/\\@/;
 
-$myset = "";
 
+if ($in{'sc_non_taxables_db_counter2'} ne "") {
+  $temp_db_thingy = $in{'sc_non_taxables_db_counter2'};
+	if ($temp_db_thingy =~ /User 20/i) {
+		$sc_non_taxables_db_counter = 26;
+	} elsif ($temp_db_thingy =~ /User 10/i) {
+		$sc_non_taxables_db_counter = 16;
+	} elsif ($temp_db_thingy =~ /User 2/i) {
+		$sc_non_taxables_db_counter = " 8";
+	} elsif ($temp_db_thingy =~ /User 3/i) {
+		$sc_non_taxables_db_counter = " 9";
+	} elsif ($temp_db_thingy =~ /User 4/i) {
+		$sc_non_taxables_db_counter = 10;
+	} elsif ($temp_db_thingy =~ /User 5/i) {
+	} else {
+		$sc_non_taxables_db_counter = "";
+	}
+}
+
+$myset = "";
+$myset .= "\$sc_non_taxables_enabled = \"$in{'sc_non_taxables_enabled'}\";\n";
+$myset .= "\$sc_non_taxables_db_counter = \"$sc_non_taxables_db_counter\";\n";
+$myset .= "\$sc_non_taxables_db_counter2 = \"$in{'sc_non_taxables_db_counter2'}\";\n";
 $myset .= "\$mc_tax_logic_rows = \"$in{'mc_tax_logic_rows'}\";\n";
 $myset .= "\$sc_sales_tax = \"$in{'sales_tax'}\";\n";
 $myset .= "\$sc_sales_tax_state = \"$in{'sales_tax_state'}\";\n";
@@ -325,7 +364,7 @@
 $sc_extra_tax3_logic = &my_escape($in{'sc_extra_tax3_logic'});
 $myset .= "\$sc_extra_tax3_logic = qq`$sc_extra_tax3_logic`;\n";
 
-&update_store_settings('tax',$myset); 
+&update_store_settings('tax',$myset); # main settings
 &show_tax_settings_screen;
 }
 #############################################################################################
diff -ruN 4.0K-4b/protected/template_manager-ext_lib.pl 5.0.000/protected/template_manager-ext_lib.pl
--- 4.0K-4b/protected/template_manager-ext_lib.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/protected/template_manager-ext_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,420 @@
+# file ./store/protected/template_manager-ext_lib.pl
+#########################################################################
+#
+# Copyright (c) 2002 to Date K-Factor Technologies, Inc.
+# http://www.k-factor.net/  and  http://www.AgoraCart.com/
+# All Rights Reserved.
+#
+# Use with permission only with AgoraCart, AgoraCartPro, AgoraSQL, AgoraCartSQL, 
+# or AgoraSuite
+#
+# This software is a separate add-on to an ecommerce shopping cart and 
+# is the confidential and proprietary information of K-Factor Technologies, Inc.  You shall
+# not disclose such Confidential Information and shall use it only in
+# conjunction with the AgoraCart (aka agora.cgi) shopping cart.
+#
+# Requires AgoraCart version 5.0.0 or above.  Just place this file in the protected directory.
+#
+# K-Factor Technologies, Inc. BytePipe, AgoraScript nor any of their employees and/or representatives
+# MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT
+# THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESSED OR IMPLIED,
+# INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+# OR NON-INFRINGEMENT.
+#
+# K-Factor Technologies, Inc., BytePipe, AgoraScript nor any of their employees and/or representatives
+# SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY
+# LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS
+# SOFTWARE OR ITS DERIVATIVES.
+#
+# You may not give this script/add-on away or distribute it an any way without
+# written permission from K-Factor Technologies, Inc.  K-Factor Technologies, Inc.
+# reserves any and all rights to distributions, add-ons, and other works based on this
+# piece of software as well as any and all rights to profit sharing and/or to charge for
+# such works and/or derivatves.
+#
+# Hosting Companies and other software integrators are encouraged to integrate additional
+# features and add-ons in their AgoraCart offerings, but must receive written permission from from
+# K-Factor Technologies, Inc. in order to distribute this add-on to AgoraCart (aka Agora.cgi).
+#
+##########################################################################
+$versions{'template_manager-ext_lib.pl'} = "5.0.000";
+
+$templates_file_dir = "html/html-templates/templates";
+$sm_templatelinks = '';
+$sm_old_templateName = '';
+$templatechange_user_settings = "./admin_files/agora_user_lib.pl";
+$sc_buttonSetURLthingy = "./html/images/buttonsets";
+
+{
+ local ($modname) = 'template_manager';
+ &register_extension($modname,"Template Manager",$versions{$modname});
+ &add_settings_choice("Store Templates Settings","Store Templates - Header/Footer",
+  "change_Template_screen");
+ &register_menu('TemplateSettings',"write_Template_settings",
+  $modname,"Write Template Settings");
+ &register_menu('StoreHeaderTemplateSettings',"write_StoreHeaderTemplate_settings",
+  $modname,"Write Store Header Template Settings");
+ &register_menu('StoreFooterTemplateSettings',"write_StoreFooterTemplate_settings",
+  $modname,"Write Store Footer Template Settings");
+ &register_menu('SecureStoreHeaderTemplateSettings',"write_SecureStoreHeaderTemplate_settings",
+  $modname,"Write Secure Header Template Settings");
+ &register_menu('SecureStoreFooterTemplateSettings',"write_SecureStoreFooterTemplate_settings",
+  $modname,"Write Secure Footer Template Settings");
+ &register_menu('change_Template_screen',"display_Template_screen",
+  $modname,"Display Template Manager");
+ &add_merchtools_settings_choice("template settings","Store Templates - Header/Footer",
+  "change_Template_screen");
+}
+#######################################################################################
+sub write_StoreHeaderTemplate_settings {
+  my $new_store_file = "$in{'changed_store_header_file'}";
+  open (NEWSTOREFILE,'>', "$sc_store_header_file");
+    print NEWSTOREFILE $new_store_file;
+  close (NEWSTOREFILE);
+&display_Template_screen;
+}
+#######################################################################################
+sub write_StoreFooterTemplate_settings {
+  my $new_store_file = "$in{'changed_store_footer_file'}";
+  open (NEWSTOREFILE,'>', "$sc_store_footer_file");
+    print NEWSTOREFILE $new_store_file;
+  close (NEWSTOREFILE);
+&display_Template_screen;
+}
+#######################################################################################
+sub write_SecureStoreHeaderTemplate_settings {
+  my $new_store_file = "$in{'changed_secure_store_header_file'}";
+  open (NEWSTOREFILE,'>', "$sc_secure_store_header_file");
+    print NEWSTOREFILE $new_store_file;
+  close (NEWSTOREFILE);
+&display_Template_screen;
+}
+#######################################################################################
+sub write_SecureStoreFooterTemplate_settings {
+  my $new_store_file = "$in{'changed_secure_store_footer_file'}";
+  open (NEWSTOREFILE,'>', "$sc_secure_store_footer_file");
+    print NEWSTOREFILE $new_store_file;
+  close (NEWSTOREFILE);
+&display_Template_screen;
+}
+#######################################################################################
+sub write_Template_settings {
+ my ($myset)="";
+
+my($item,$zitem) = '';
+
+ &ReadParse;
+
+$sm_old_templateName = $sc_headerTemplateName;
+$sc_headerTemplateName = $in{'sc_headerTemplateName'};
+
+my ($sc_headerTemplateRoot,$junk) = split (/\//, $sc_headerTemplateName);
+$myset .= "\$sc_headerTemplateName = \"$in{'sc_headerTemplateName'}\";\n";
+$myset .= "\$sc_headerTemplateRoot = \"$sc_headerTemplateRoot\";\n";
+
+$sc_buttonSetName = $in{'sc_buttonSetName'};
+$sc_buttonSetURL = "$URL_of_images_directory/buttonsets/$sc_buttonSetName";
+$myset .= "\$sc_buttonSetName = \"$in{'sc_buttonSetName'}\";\n";
+$myset .= "\$sc_buttonSetURL = \"$sc_buttonSetURL\";\n";
+$myset .= "\$sc_displayDynamicCategories = \"$in{'sc_displayDynamicCategories'}\";\n";
+$myset .= "\$sc_headerStoreTitle = \"$in{'sc_headerStoreTitle'}\";\n";
+$myset .= "\$sc_headerStoreTagLine = \"$in{'sc_headerStoreTagLine'}\";\n";
+$sc_store_header_file = "$sc_templates_dir/templates/$sc_headerTemplateRoot/store_header.html";
+$sc_store_footer_file = "$sc_templates_dir/templates/$sc_headerTemplateRoot/store_footer.html";
+$sc_secure_store_header_file = "$sc_templates_dir/templates/$sc_headerTemplateRoot/secure_store_header.html";
+$sc_secure_store_footer_file = "$sc_templates_dir/templates/$sc_headerTemplateRoot/secure_store_footer.html";
+$myset .= "\$sc_store_header_file = \"$sc_store_header_file\";\n";
+$myset .= "\$sc_store_footer_file = \"$sc_store_footer_file\";\n";
+$myset .= "\$sc_secure_store_header_file = \"$sc_secure_store_header_file\";\n";
+$myset .= "\$sc_secure_store_footer_file = \"$sc_secure_store_footer_file\";\n";
+
+if ($sc_headerTemplateName ne $sm_old_templateName) {
+  open(USERSETTINGS,"< $templatechange_user_settings") || &my_die("Can't Open $templatechange_user_settings");
+    while (<USERSETTINGS>) {
+      $store_settings{CSSDESIGN} =~ s/$sm_old_templateName/$sc_headerTemplateName/g;
+    }
+  close(USERSETTINGS);
+
+  &update_store_settings('CSSDESIGN',$store_settings{CSSDESIGN});
+  &require_supporting_libraries(__FILE__,__LINE__,"$mgrdir/misc/mgr_css.pl");
+
+  # copy original CSS file for template change to location needed, if at alternate location
+  # added by Mister Ed for 5.0.1 version fixes.
+  if ($mc_template_css_at_root =~ /yes/i) {
+      my $tempURLthingyForTemplates = "$templates_file_dir/$sc_headerTemplateName/$templatestylename";
+      my $tempURLthingyForTemplates2 = "$mc_css_file_path$templatestylename";
+      use File::Copy;
+      copy($tempURLthingyForTemplates, $tempURLthingyForTemplates2);
+  }
+}
+&update_store_settings('TEMPLATE',$myset);
+
+&display_Template_screen;
+ }
+################################################################################
+sub display_Template_screen
+{
+  local($filename)="$mgrdir/";
+  my ($zfile,$zzfile) = '';
+  my (@myfiles,@myfiles2);
+
+
+  print &$manager_page_header("Template Editor","","","","");
+
+    opendir (TEMPLATES, "$templates_file_dir"); 
+    @myfiles = readdir(TEMPLATES); 
+    closedir (TEMPLATES);
+    foreach $zfile (@myfiles){
+        if (!($zfile =~ /\./)) {
+           opendir (INTEMPLATES, "$templates_file_dir/$zfile"); 
+           @myfiles2 = readdir(INTEMPLATES); 
+           closedir (INTEMPLATES);
+           foreach $zzfile (@myfiles2){
+             if (!($zzfile =~ /\./)) {
+                $sm_templatelinks .= qq~<option value="$zfile/$zzfile">$zzfile</option>\n~;
+             }
+           }
+           @myfiles2 = ""; 
+        }
+    }
+
+    if ($sc_self_serve_images =~ /no/i) {
+         $sc_buttonSetURLthingy = "$URL_of_images_directory/buttonsets";
+    }
+    opendir (BUTTONSETS, "$sc_buttonSetURLthingy"); 
+    @myfiles = readdir(BUTTONSETS); 
+    closedir (BUTTONSETS);
+    foreach $zfile (@myfiles){
+        if (!($zfile =~ /\./)) {
+                $sm_buttonsetlinks .= qq~<option value="$zfile">$zfile</option>\n~;
+        }
+    }
+
+print <<ENDOFTEXT;
+<CENTER>
+<HR>
+</CENTER>
+<FORM ACTION="manager.cgi" METHOD="POST">
+<CENTER>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL size=2>Welcome to the <b>AgoraCart</b>  Store Manager - Default Store Header/Footer Template Manager.  This area allows you to chose a header and footer template that will be used by default in the design/look of your store (basically the default design applied store wide unless customized pages are found).  Using your own headers/footers is fairly easy, but not recommended for those without HTML editing experience. For faster setup, use a template already available and/or that will be downloadable in the near future.<br><br> <i>NOTE: You can use your own templates if you wish, but this will require you to create your own headers and footers and upload them to the store's html/html-templates/templates/Custom sub directory and then put the .css file for your custom look in the html/html-templates/templates/Custom/CustomOne sub directory of your store (one more level down).  If you wish to use custom header and/or footer files by category name (using the formats of header-CATEGORYNAME.inc and/or footer-CATEGORYNAME.inc and is auto-detected, if enabled in the "Store Design - Misc Settings" manager), then you will need to create those files separately and place them in the html/html-templates sub directory of your store.  Make sure to upload all HTML and CSS files in ASCII mode.</i></center></TD>
+</TR>
+</TABLE>
+</CENTER>
+
+ENDOFTEXT
+
+if($in{'system_edit_success'} ne "")
+{
+print <<ENDOFTEXT;
+<CENTER><br>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL SIZE=2 COLOR=RED>Template Settings have been 
+successfully updated. </FONT>
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+ENDOFTEXT
+}
+
+print qq~
+<br>
+<FORM ACTION="manager.cgi" METHOD="POST">
+   <div align="center">
+   <table border="0" cellspacing="0">
+<TR>
+<TD>
+<b>Select a Template: </b>
+</TD><TD>
+<br>
+<SELECT NAME=sc_headerTemplateName>
+<OPTION SELECTED>$sc_headerTemplateName</OPTION>
+$sm_templatelinks
+</SELECT>
+<br><br>
+</TD>
+</TR>
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+<TR>
+<TD>
+<b>Select a Button Set: </b>
+</TD><TD>
+<br>
+<SELECT NAME=sc_buttonSetName>
+<OPTION SELECTED>$sc_buttonSetName</OPTION>
+$sm_buttonsetlinks
+</SELECT>
+
+<br><br>
+</TD>
+</TR>
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+<TR>
+<TD>
+<b>Display Categories</b> (and sub categories if enabed)<b>?</b> 
+</TD><TD>
+<br>
+<SELECT NAME=sc_displayDynamicCategories>
+<OPTION SELECTED>$sc_displayDynamicCategories</OPTION>
+<OPTION>yes</OPTION>
+<OPTION>no</OPTION>
+</SELECT>
+
+<br><br>
+</TD>
+</TR>
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+<TR>
+<TD>
+<b>Store Name and Tag Line:</b><br>
+<small>This is the store name/title diplayed to your customers in the heading of the template. Do not use special metacharacters (\$,%,&,\@ etc). 45 characters max.    The shorter the better to ensure the store template does not get distorted due to the long text line. Leave blank if you do not want this line to show.</small>:
+<br>
+<INPUT TYPE=TEXT SIZE=45 maxlength=45 NAME="sc_headerStoreTitle" VALUE="$sc_headerStoreTitle">
+<br><br>
+</TD>
+</TR>
+<TR>
+<TD COLSPAN=2><HR></TD>
+</TR>
+<TR>
+<TD colspan=2>
+<b>Tag Line:</b><br>
+<small>This is located just beneath the Store title listed above. Do not use special metacharacters (\$,%,&,\@ etc).  60 characters max.  The shorter the better to ensure the store template does not get distorted due to the long text line. Leave blank if you do not want this line to show.</small>:
+<br>
+<INPUT TYPE=TEXT SIZE=45 maxlength=60 NAME="sc_headerStoreTagLine" VALUE="$sc_headerStoreTagLine">
+<br><br>
+</TD>
+</TR>
+ </table>
+   <p align="center">&nbsp;</p>
+   <p align="center"><font face="Arial"><INPUT TYPE="HIDDEN" NAME="system_edit_success" value="yes">
+<INPUT NAME="TemplateSettings" TYPE="SUBMIT" value="Update Template Settings"></font></p>
+   </form>
+~;
+
+open (STOREHEADER, "<$sc_store_header_file");# || die ('Could not find file') ;
+local $full_store_header_file;
+   while(<STOREHEADER>) { 
+     $full_store_header_file .= $_ ;
+   }
+close (STOREHEADER);
+
+print qq~
+<hr><br> 
+<FORM ACTION="manager.cgi" METHOD="POST">
+<TABLE>
+<TR>
+<TD COLSPAN="2"><b>Store Header:</b><br><font face="arial,helvetica" size=2><br>
+Here are the current contents of the main Store Header file (displayed on standard pages) located at:<br><em>$sc_store_header_file</em><br>
+Feel free to do any edits using this interface, or you may download the Store Header file via FTP and make the changes manually.<br>
+<TEXTAREA NAME="changed_store_header_file" cols="68" rows="15" wrap=off>$full_store_header_file</TEXTAREA></font>
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+   </div>
+   <p align="center">&nbsp;</p>
+   <p align="center"><font face="Arial"><INPUT TYPE="HIDDEN" NAME="system_edit_success" value="yes">
+<INPUT NAME="StoreHeaderTemplateSettings" TYPE="SUBMIT" value="Update Store Header File"></font></p>
+</form><br>
+~;
+
+open (STOREFOOTER, "<$sc_store_footer_file");# || die ('Could not find file') ;
+local $full_store_footer_file;
+   while(<STOREFOOTER>) { 
+     $full_store_footer_file .= $_ ;
+   }
+close (STOREFOOTER);
+
+print qq~
+<hr><br> 
+<FORM ACTION="manager.cgi" METHOD="POST">
+<TABLE>
+<TR>
+<TD COLSPAN="2"><b>Store Footer:</b><br><font face="arial,helvetica" size=2><br>
+Here are the current contents of the main Store Footer file  (displayed on standard pages) located at:<br><em>$sc_store_footer_file</em><br>
+Feel free to do any edits using this interface, or you may download the Store Footer file via FTP and make the changes manually.<br>
+<TEXTAREA NAME="changed_store_footer_file" cols="68" rows="15" wrap=off>$full_store_footer_file</TEXTAREA></font>
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+   </div>
+   <p align="center">&nbsp;</p>
+   <p align="center"><font face="Arial"><INPUT TYPE="HIDDEN" NAME="system_edit_success" value="yes">
+<INPUT NAME="StoreFooterTemplateSettings" TYPE="SUBMIT" value="Update Store Footer File"></font></p>
+</form><br>
+~;
+
+
+open (SECURESTOREHEADER, "<$sc_secure_store_header_file");# || die ('Could not find file') ;
+local $full_secure_store_header_file;
+   while(<SECURESTOREHEADER>) { 
+     $full_secure_store_header_file .= $_ ;
+   }
+close (SECURESTOREHEADER);
+
+print qq~
+<hr><br> 
+<FORM ACTION="manager.cgi" METHOD="POST">
+<TABLE>
+<TR>
+<TD COLSPAN="2"><b>Secure Store Header:</b><br><font face="arial,helvetica" size=2><br>
+Here are the current contents of the main Secure Store Header file  (displayed on all SSL secure checkout pages) located at:<br><em>$sc_secure_store_header_file</em><br>
+Feel free to do any edits using this interface, or you may download the Secure Store Header file via FTP and make the changes manually.<br>
+<TEXTAREA NAME="changed_secure_store_header_file" cols="68" rows="10" wrap=off>$full_secure_store_header_file</TEXTAREA></font>
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+   </div>
+   <p align="center">&nbsp;</p>
+   <p align="center"><font face="Arial"><INPUT TYPE="HIDDEN" NAME="system_edit_success" value="yes">
+<INPUT NAME="SecureStoreHeaderTemplateSettings" TYPE="SUBMIT" value="Update Secure Store Header File"></font></p>
+</form><br>
+~;
+
+open (SECURESTOREFOOTER, "<$sc_secure_store_footer_file");# || die ('Could not find file') ;
+local $full_secure_store_footer_file;
+   while(<SECURESTOREFOOTER>) { 
+     $full_secure_store_footer_file .= $_ ;
+   }
+close (SECURESTOREFOOTER);
+
+print qq~
+<hr><br> 
+<FORM ACTION="manager.cgi" METHOD="POST">
+<TABLE>
+<TR>
+<TD COLSPAN="2"><b>Secure Store Footer:</b><br><font face="arial,helvetica" size=2><br>
+Here are the current contents of the main Secure Store Footer file (displayed on all SSL secure checkout pages) located at:<br><em>$sc_secure_store_footer_file</em><br>
+Feel free to do any edits using this interface, or you may download the Secure Store Footer file via FTP and make the changes manually.<br>
+<TEXTAREA NAME="changed_secure_store_footer_file" cols="68" rows="15" wrap=off>$full_secure_store_footer_file</TEXTAREA></font>
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+   </div>
+   <p align="center">&nbsp;</p>
+   <p align="center"><font face="Arial"><INPUT TYPE="HIDDEN" NAME="system_edit_success" value="yes">
+<INPUT NAME="SecureStoreFooterTemplateSettings" TYPE="SUBMIT" value="Update Secure Store Footer File"></font></p>
+</form><br><br>
+~;
+
+
+print &$manager_page_footer;
+}
+#######################################################################################
+1; # Library
diff -ruN 4.0K-4b/protected/upgrade_manager-ext_lib.pl 5.0.000/protected/upgrade_manager-ext_lib.pl
--- 4.0K-4b/protected/upgrade_manager-ext_lib.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/protected/upgrade_manager-ext_lib.pl	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,201 @@
+# file ./store/protected/upgrade_manager-ext_lib.pl
+#
+# Show versions of files from the manager (if logged in)
+# http://.../.../manager.cgi?versions=1
+#
+# 20050829 ASY Changes:
+#   * Fixed order so that *all* versions are found and displayed, not just what
+#     has been registered
+#   * Optimized subroutine a little here and there
+#   * Added showin and showenv handlers to show %in and %ENV upon request
+#
+# 20050830 ASY Changes:
+#   * Minor reformatting and code changes
+#   * Factored out versions discovery to subroutine
+#   * Factored out table building subroutine
+
+# 20060204 Mister Ed Changes
+# add update file read routines for regular version
+# add update file read routines for pro version
+# pass credentials if pro version
+# added in links to update individual files
+# formating of layout changes
+# added table for files not used from update file, excluding order libs and order managers.
+# renamed to upgrade_manager-ext_lib.pl
+# added get_and_update_cart_file sub routine (function)
+#
+# NOTE: I'm trying to hide these subroutines (except for the registered ones) so they
+#       can't be called by accident or from outside the main subroutine. 
+
+local($modname) = "upgrade_manager-ext_lib.pl";
+$versions{'upgrade_manager-ext_lib.pl'} = "5.0.000";
+$updateErrorMessage = "";
+$mgr_upgrade_error_message = '';
+{ 
+&register_extension( $modname, "Upgrade Versions", $versions{$modname} );
+ &add_settings_choice("Upgrade Versions Manager","Upgrade AgoraCart Modules",
+	"display_module_versions");
+&register_menu("AgoraCart module manager", "Show/Update AgoraCart Module Versions", "display_module_versions");
+ &register_menu('display_module_versions',"show_manager_versions",
+  $modname,"Display Cart Module Versions");
+ &register_menu('versions',"show_manager_versions",
+	$modname,"Show Module Versions");
+ &register_menu('updateCartFile',"get_and_update_cart_file",
+	$modname,"Get and save-write updated cart file");
+################################################################################
+#added by Mister Ed Feb 2 2006
+sub get_and_update_cart_file {
+my $filename = $in{'upgradeFileName'};
+my $filename2 = "$in{'fileNameToUpgrade'}";
+my $file = "";
+my $test = "";
+$target_file = "http://www.agoracart.com/downloadupdates/$filename";
+use LWP::Simple;
+$file = get($target_file);
+$filename2 =~ /^([\/-\@\w.\-]+)$/; 
+$filename2 = $1;
+# error conditionals added by Mister Ed March 15, 2006
+if ($file ne '') {
+#create backup file.  added by Mister Ed Feb 6, 2006
+my $filename5 = $filename2;
+$filename5 =~ s/pl$/txt/;
+$filename5 =~ s/cgi$/txt/;
+my $timethingy = time;
+$filename5 =~ s/\./_v5_update_$timethingy\./;
+use File::Copy;
+copy($filename2, $filename5);
+# use system command if File::Copy not there
+# add in error check later?
+# system("cp $filename2 $filename5");
+  open(UPDATEFILE,">./$filename2") || &my_die("Can't Open $filename2");
+     print (UPDATEFILE $file);
+  close(UPDATEFILE);
+if ($filename2 =~ /cgi$/) {
+    system("chmod 755 ./$filename2");
+}
+# error messages and conditionals added by Mister Ed March 15, 2006
+  $updateErrorMessage = "SUCCESS ... file successfully updated.  DO NOT RELOAD/REFRESH THIS PAGE!";
+} elsif ($test ne '')  {
+     $updateErrorMessage = $test;
+} else {
+  $updateErrorMessage = "ERROR: The file you requested was not reachable for updates.";
+}
+&show_manager_versions;
+}
+################################################################################
+sub show_manager_versions {
+  my $in = $in{ 'showin' } && $in{ 'showin' } ne '' ? build_table_from_hash( 'Incoming Variables', \%in ) : '';
+  my $env = $in{ 'showenv' } && $in{ 'showenv' } ne '' ? build_table_from_hash( 'Environment Variables', \%ENV ) : '';
+  %versions = installed_versions();
+$versions{'Perl'} = "$]";
+  $versions = build_table_from_hash( 'Core AgoraCart Files Already Installed', \%versions );
+  print &$manager_page_header("$sc_gateway_name Gateway","","","","");
+if($in{'system_edit_success'} ne "")
+{
+print <<ENDOFTEXT;
+<CENTER><br>
+<TABLE>
+<TR>
+<TD>
+<FONT FACE=ARIAL SIZE=2 COLOR=RED>Updates Attempted:<br>$updateErrorMessage</FONT>
+</TD>
+</TR>
+</TABLE>
+</CENTER>
+ENDOFTEXT
+}
+print qq~<font size="2" face="Arial, Helvetica, sans-serif"><br/><br/>For any updgrades to currently installed files, a backup will be created in the form of filename.time in case something goes wrong as well as to ensure that each backup file is unique.* If you download a NEW file (not currently installed) ending in .cgi, you will need to chmod it to 755 after download ing it; use FTP of an online file manager to do this.<br><br><div align=center>Available gateways not listed below must be manually installed.<br/>Current payment processing gateways can be found in the download sections of AgoraCart.com or AgoraCartPro.com.<br/>For more information on available gateways, please visit the <a href="http://www.AgoraCart.com/paymentgateways.htm" target="_new">Supported Gateways Page at AgoraCart.com</a></div></font>
+~;
+  print $versions . $in . $env;
+
+ print "<font size=\"1\" face=\"Arial, Helvetica, sans-serif\"><br/><br/>* (time = number of seconds since 1970 (EPOCH) in most cases.  Backups require the Perl File::Copy module to be installed which is already installed on most servers).</font><br/><br/>";
+  print &$manager_page_footer;
+
+  &call_exit;
+}
+
+################################################################################
+
+# Expects a string to be used for a title and a reference to a hash
+# Returns a string of an html table
+
+sub build_table_from_hash {
+  my ( $title, $hash ) = @_;
+  my $temp_user_compare = "3 User";
+
+#read files for updates added by Mister Ed Jan 2006
+$target_file = "http://www.agoracart.com/upgradecart.txt";
+use LWP::Simple;
+my $file = get($target_file);
+my @line = split(/\n/, $file);
+foreach $line (@line) {
+my ($upkey,$upversion,$upfilename,$upgradeStorePath,$upgradeSourcePath) = split(/\|/, $line);
+chomp $upgradeSourcePath;
+$updatesAvailable{$upkey} = "$upversion";
+$updatesAvailableFile{$upkey} = "$upfilename";
+$updatesAvailableRealFile{$upkey} = "$upgradeStorePath";
+$updateSiteSourceFile{$upkey} = "$upgradeSourcePath";
+}
+
+  my $table  = "<br /><br /><font face=arial size=+1><b>${title}</b><br /><br /></font>\n<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
+     for my $keys (sort keys(%$hash)) {
+         if ($$hash{$keys} lt $updatesAvailable{$keys}) {
+             $table .= qq~  <tr><td><font face=arial size=2>$keys</font></td><td><font face=arial size=2>$$hash{$keys}</font></td><td><font face=arial size=2>
+<div align=center>update to: $updatesAvailable{$keys}
+<FORM ACTION="manager.cgi" METHOD="POST">
+<input type="hidden" name="upgradeFileName" value="$updatesAvailableFile{$keys}">
+<input type="hidden" name="fileNameToUpgrade" value="$updatesAvailableRealFile{$keys}">
+<input type="hidden" name="fileNameAndPath" value="$updateSiteSourceFile{$keys}">
+<INPUT TYPE="HIDDEN" NAME="system_edit_success" value="yes">
+<INPUT NAME="updateCartFile" TYPE="SUBMIT" value="Click to Update">
+</form></div>
+</font></td></tr>\n
+~;
+         } elsif ($$hash{$keys} ne '') {
+             $table .= "  <tr><td><font face=arial size=2>$keys</font></td><td><font face=arial size=2>$$hash{$keys}</font></td><td><font face=arial size=1>none available</font></td></tr>\n";
+         }
+
+     }
+     $table .= "</table><br>\n";
+
+if ($mgr_upgrade_error_message ne "yes") {
+  $table  .= "<br /><br /><font face=arial size=+1><b>Add-ons or Core Files Not Installed </b></font><font face=arial size=2><br>(excluded from list are payment gateways, templates and layout files).</font><br /><br /></font>\n<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\" width=90%>\n";
+
+     for my $keys (sort keys(%updatesAvailable)) {
+         if (($$hash{$keys} eq "") && ($updatesAvailableRealFile{$keys} !~ /-order_lib/) && ($updatesAvailableRealFile{$keys} !~ /-mgr_lib/) && ($updatesAvailable{$keys} ne '')  && ($keys !~ /$temp_user_compare/)) {
+             $table .= qq~  <tr><td width=30%><font face=arial size=2>$keys</font></td><td width=20%><font face=arial size=2>$updatesAvailable{$keys}</font></td>
+~;
+
+$table .= qq~
+<td width=25%><font face=arial size=2>
+<div align=center>Click to Install: $updatesAvailable{$keys}
+<FORM ACTION="manager.cgi" METHOD="POST">
+<input type="hidden" name="upgradeFileName" value="$updatesAvailableFile{$keys}">
+<input type="hidden" name="fileNameToUpgrade" value="$updatesAvailableRealFile{$keys}">
+<input type="hidden" name="fileNameAndPath" value="$updateSiteSourceFile{$keys}">
+<input type="hidden" name="fileMembershipRequire" value="$memberLevels{$keys}">
+<INPUT TYPE="HIDDEN" NAME="system_edit_success" value="yes">
+<INPUT NAME="updateCartFile" TYPE="SUBMIT" value="Click to Install">
+</form></div>
+</font></td></tr>
+~;
+         }
+     }
+     $table .= "</table><br><br><br>\n";
+}
+  return $table;
+}
+################################################################################
+sub installed_versions {
+  return undef unless defined wantarray;
+  my $versions = `grep -h "^\\\$versions{'.*'}\\ *=" $mgrdir/*.pl $mgrdir/*.cgi $mgrdir/custom/*.pl $mgrdir/*.ok ./*.cgi ./add_ons/*.pl ./library/*.pl 2> /dev/null`;
+  my %installed_versions;
+  for my $version ( split /\n/, $versions ) {
+    my ( $key, $val ) = $version =~ /versions{'(.*?)'}\s*=\s*"(.*?)"/;
+    $installed_versions{$key} = $val;
+  }
+  return wantarray ? %installed_versions : \%installed_versions;
+}
+################################################################################
+} 
+1; 
diff -ruN 4.0K-4b/protected/versions-ext_lib.pl 5.0.000/protected/versions-ext_lib.pl
--- 4.0K-4b/protected/versions-ext_lib.pl	2005-11-30 16:32:35.000000000 -0600
+++ 5.0.000/protected/versions-ext_lib.pl	1969-12-31 18:00:00.000000000 -0600
@@ -1,55 +0,0 @@
-# file ./store/protected/versions-ext_lib.pl
-
-$versions{'versions'} = "20021020";
-{
- local($modname) = "versions";
- &register_extension($modname,"Module Versions",$versions{$modname});
- &register_menu('versions',"show_manager_versions",
-	$modname,"Show Module Versions");
-}
-################################################################################
-sub show_manager_versions {
-  print &$manager_page_header("$sc_gateway_name Gateway","","","","");
-  print "<br><br>Info and Versions of loaded libraries:<br>\n";
-  print "<table border=1 cellpadding=2 cellspacing=2>\n";
-  foreach $junk (sort(keys(%versions)))
-   {
-    print "<tr><td>$junk </td><td>$versions{$junk}</td></tr>\n";
-   }
-  print "</table>\n";
-  $junk .= `grep -h "versions{'" ./custom/* |grep "}="`;
-  $junk .= `grep -h "versions{'" ./custom/* |grep "} ="`;
-  $junk .= `grep -h "versions{'" $mgrdir/* |grep "}="`;
-  $junk .= `grep -h "versions{'" $mgrdir/* |grep "} ="`;
-  $junk .= `grep -h "versions{'" $mgrdir/custom/* |grep "}="`;
-  $junk .= `grep -h "versions{'" $mgrdir/custom/* |grep "} ="`;
-  $junk .= `grep -h "versions{'" ./library/* |grep "}="`;
-  $junk .= `grep -h "versions{'" ./library/* |grep "} ="`;
-  $junk =~s/\n/ /g;
-  $junk =~ /([\w\-\=\+\/\;\{\}\'\ \.\"\$]+)/;
-  $junk = $1;
-
-  while ($junk ne "") {
-    $result = $lib;
-    ($junk1,$key,$junk) = split(/\'/,$junk,3);
-    ($junk1,$val,$junk) = split(/\"/,$junk,3);
-    if ($versions{$key} eq "") {
-      $versions{$key} = $val;
-     }
-    ($junk1,$junk) = split(/versions/,$junk,2);
-   }
-
-################################################################################
-    print "<br><br>Environment (shell) variables:<br>\n";
-    print "<table border=1 cellpadding=2 cellspacing=2>\n";
-    foreach $junk (sort(keys(%ENV)))
-     {
-      print "<tr><td>$junk </td><td>$ENV{$junk}</td></tr>\n";
-     }
-    print "</table>\n";
-################################################################################
-  print &$manager_page_footer;
-  &call_exit;
- }
-################################################################################
-1; 
diff -ruN 4.0K-4b/wrap_agc.c 5.0.000/wrap_agc.c
--- 4.0K-4b/wrap_agc.c	1969-12-31 18:00:00.000000000 -0600
+++ 5.0.000/wrap_agc.c	2006-10-31 09:40:27.000000000 -0600
@@ -0,0 +1,66 @@
+/*
+
+Simple wrapper program to allow people to suid to their own user id.
+Version 3.0a
+
+Directions:
+
+1) Compile this C program (use cc if you don't have gcc):
+
+     gcc -o wrap_agc.o wrap_agc.c
+
+2) Set permissions on the wrapper so it runs under your id:
+
+     chmod 555 wrap_agc.o
+     chmod a+s wrap_agc.o   (some servers this works OK)
+     chmod 4555 wrap_agc.o  (some servers this works also/instead)
+
+3) Agora.cgi 3.1+ will detect the wrapper and use it automatically if it
+   is properly placed in the same directory.
+
+*/
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include "stdio.h"
+main()
+{
+FILE *fp;
+char the_file[25] = "./agora.cgi";
+struct stat mybuf;
+
+if ( -1 ==  stat(the_file,&mybuf))
+{
+ printf("Content-type: text/html\n\n");
+ printf(" Error with stat of %s\n", the_file);
+ exit(0);
+}
+
+if(!(geteuid() == mybuf.st_uid))
+{
+ printf("Content-type: text/html\n\n");
+ printf("Owners do not match!\n");
+ exit(0);
+}
+
+if((fp=fopen(the_file,"r"))==NULL)
+{
+ printf("Content-type: text/html\n\nCannot open the file %s\n",the_file);
+ exit();
+}
+fclose(fp);
+
+/* Set the real id to the value of the effective id, may help GPG */
+
+if (setreuid(geteuid(),-1) == -1)
+{
+ printf("Content-type: text/html\n\nCannot set real UID to %d\n",
+        (int)geteuid());
+ exit();
+}
+ 
+execl(the_file,the_file,"nowrap",NULL); /* */
+
+}
+
