diff -x .svn -aruN 5.2.004.src/add_ons/shipping-order-instructions-sort.pl 5.2.005.src/add_ons/shipping-order-instructions-sort.pl
--- 5.2.004.src/add_ons/shipping-order-instructions-sort.pl	2008-06-26 07:48:42.000000000 -0500
+++ 5.2.005.src/add_ons/shipping-order-instructions-sort.pl	2008-08-30 20:15:08.000000000 -0500
@@ -32,11 +32,14 @@
 # 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.001";
+
+$versions{'shipping-order-instructions-sort.pl'} = "5.1.001";
+
 &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 {
diff -x .svn -aruN 5.2.004.src/admin_files/agora_user_lib.pl 5.2.005.src/admin_files/agora_user_lib.pl
--- 5.2.004.src/admin_files/agora_user_lib.pl	2008-06-26 08:00:42.000000000 -0500
+++ 5.2.005.src/admin_files/agora_user_lib.pl	2008-09-29 14:20:41.000000000 -0500
@@ -217,7 +217,7 @@
 $sc_buttonSetName = "TheAgora_BluGreen";
 $sc_buttonSetURL = "html/images/buttonsets/TheAgora_BluGreen";
 $sc_displayDynamicCategories = "yes";
-$sc_headerStoreTitle = "Powered by AgoraCart version 5.2.004";
+$sc_headerStoreTitle = "Powered by AgoraCart version 5.2.005";
 $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";
@@ -294,17 +294,44 @@
 $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\"); 
+$sc_custom_shipping_logic = qq`\# In this example shipping types are used from the defaults listed in the
+\# Custom Shipping Methods section of the shipping manager setups, plus some extra samples that
+\# are commented out with the pound sign (\#) so that they are not used.
+\# Remember that the first match found is the one used.  So use catchall or general logic at the end of the array.
+\# Arrays start with the \@ symbol.
+\#
+\# general recipe for each shipping logic, which can be combined on everything but cost, is:
+\#  a|b|c|d|e
+\# a = shipping method. Can be left blank but must match the name value of the shipping types on the order form used.
+\# b = number of items. Can be blank or combined with c and d as conditions to be matched for more complex logic.
+\# c = number of items. Can be blank or combined with b and d as conditions to be matched for more complex logic.
+\# d = number of items. Can be blank or combined with b and c as conditions to be matched for more complex logic.
+\# e = cost of shipping. Can be a fixed cost (3.99) or a percentage of total cost (10.5%), but not both.
+\#
+\@sc_shipping_logic = 
+(
+    \"Electronic Delivery|1-9|||0\", \# logic definition is: if electronic delivery method|with 1 or more items|||shipping equals \$0 cost or Free
+    \"Electronic Delivery|10-|||3.00\", \# logic definition is: if electronic delivery method|with 1 or more items|||shipping equals \$2 cost
+    \"Local Delivery|1-|||100.00\",
+    \"Pickup|1-|||0\"  \# logic definition is: if pickup method|with 1 or more items|||shipping equals \$0 cost or Free
+
+\#    \"UPS|||1-9.99|0\"  \# logic definition is: if ups method|||between 1 and 10 pounds|shipping equals \$10 cost
+\#    \"UPS|||10-14.99|15\%\"  \# logic definition is: if ups method|||between 10 and 15 pounds|shipping cost is 15\% of order subtotal
+\#    \"UPS|1-9||15-19.99|20\"  \# logic definition is: if ups method|with 1 to 9 items||and between 10 and 15 pounds|shipping cost is \$20
+\#    \"UPS|10-||15-19.99|9\%\"  \# logic definition is: if ups method|with 10 or more items||and between 10 and 15 pounds|shipping cost is 9\% of order subtotal
+\#    \"UPS||199.99-|20-|0\"  \# logic definition is: if ups method||subtotal of order is \$200 or more|and weighing 20 pounds or more|shipping cost is \$0 or Free
+\#    \"||349-||0\"  \# logic definition is: any method||where subtotal of order is \$349 or more||shipping cost is \$0 or Free.
+
+);
 \#
 \$shipping_price = \&calculate_shipping(\$temp_total, 
-                  \$total_quantity, \$total_measured_quantity);`;
+                  \$total_quantity, \$total_measured_quantity);
+\#
+\# Code does not force exit, so handling charge will be added!
+\# use this to terminate shipping logic:
+\# \$ship_logic_done = \'yes\';`;
 $sc_use_SBW = "yes";
-$sc_use_socket = "http-lib";
+$sc_use_socket = "LWP";
 $sc_use_UPS = "yes";
 $sc_UPS_max_wt = "15";
 $sc_ups_unitofmeasure = "LBS";
diff -x .svn -aruN 5.2.004.src/agora.cgi 5.2.005.src/agora.cgi
--- 5.2.004.src/agora.cgi	2008-06-26 07:48:42.000000000 -0500
+++ 5.2.005.src/agora.cgi	2008-06-28 15:55:38.000000000 -0500
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -T
 
-$versions{'agora.cgi'} = "5.2.003";
+$versions{'agora.cgi'} = "5.2.005";
 
 # Version history is available at... 
 # http://www.agoracart.com/
@@ -604,6 +604,13 @@
     # $valid_extension equal to yes.  
     
 sub error_check_form_data {
+if ($form_data{'page'} =~ /\.\.\/|http:|https:|ftp:/) {
+  print "Content-type: text/html\n\n";
+  print "<br/><br/><br/><font size=+1>ERROR:</font><br/>You may not use the store to navigate";
+  print " to outside pages/sites, that is Forbidden. Sorry!\n ";
+  $form_data{'page'} ='';
+  &call_exit;
+ }
 $page = $form_data{'page'};
 $page =~ /([\w\-\=\+\/]+)\.(\w+)/;
 $page = "$1.$2";
@@ -624,13 +631,15 @@
   &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 ";
+
+if ($form_data{'cartlink'} ne "") {
+if ($form_data{'cartlink'} =~ /\.\.\/|http:|https:|ftp:/) {
+  print "Content-type: text/html\n\n";
+  print "<br/><br/><br/><font size=+1>ERROR:</font><br/>You may not use the store to navigate";
+  print " to outside pages/sites, that is Forbidden. Sorry!\n ";
+  $form_data{'cartlink'} = '';
   &call_exit;
  }
-if ($form_data{'cartlink'} ne "") {
 $cartlink = $form_data{'cartlink'};
 $cartlink =~ /([\w\-\=\+\/]+)\.(\w+)/;
 $cartlink = "$1.$2";
diff -x .svn -aruN 5.2.004.src/agorastyles.css 5.2.005.src/agorastyles.css
--- 5.2.004.src/agorastyles.css	2008-06-26 07:48:42.000000000 -0500
+++ 5.2.005.src/agorastyles.css	2008-06-28 15:55:35.000000000 -0500
@@ -4,7 +4,7 @@
   margin: 0px;
   padding: 0px;
   font-size : 10pt;
-  font-family: Arial, Helvetica, sans-serif;
+  font-family: Arial, Bitstream Vera Sans, Helvetica, sans-serif;
   min-width: 770px; 
   /* Internet Explorer doesn't accept min-width therefore we 
    use the following Dynamic Expression to set the width */
@@ -21,7 +21,7 @@
   background-color : #680098;
   padding: 0px;
   text-align: center;
-  font-family : Verdana, Arial;
+  font-family : Arial, Bitstream Vera Sans, Helvetica, sans-serif;
   color: #FFFFFF;
 }
 h1#ac_h1 {
@@ -283,7 +283,7 @@
   margin-top: 20px;
   margin-bottom: 20px;
   color: #FFFFFF;
-  font-family: Arial, Helvetica, sans-serif;
+  font-family: Arial, Bitstream Vera Sans, Helvetica, sans-serif;
   font-size : 10pt;
   text-align: center;
 }
@@ -321,7 +321,7 @@
 }
 .buysafe {
     text-align:center;
-	font-family: Geneva, Arial, Helvetica, sans-serif;
+	font-family: Arial, Bitstream Vera Sans, Helvetica, sans-serif;
     font-size: 9pt;
 	font-weight: normal;
 	color: #FF0000;
@@ -394,3 +394,10 @@
   border:0px;
   margin: 0px;
 }
+/* ~~~~~~ Download Module ~~~~~~ */
+.dnldMessage{
+  font-family: Arial, Bitstream Vera Sans, Helvetica, sans-serif;
+  font-size:10pt;
+  color:#000000;
+  padding: 0px 0px 0px 0px;
+}
\ No newline at end of file
diff -x .svn -aruN 5.2.004.src/html/forms/2checkout-orderform.html 5.2.005.src/html/forms/2checkout-orderform.html
--- 5.2.004.src/html/forms/2checkout-orderform.html	2008-06-26 07:48:43.000000000 -0500
+++ 5.2.005.src/html/forms/2checkout-orderform.html	2008-09-22 20:25:14.000000000 -0500
@@ -38,11 +38,7 @@
 <tr>
 <td class="ac_checkout_left_col">Method:</td>
 <td class="ac_checkout_right_col">
-
-
-<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER BELOW - REPLACE ENTIRE SHIPPING SELECT ELEMENT-->
-
-<select name=Ecom_ShipTo_Method>
+<select name="Ecom_ShipTo_Method">
 <option value="$vform_Ecom_ShipTo_Method"><!--agorascript-pre
  if ("$vform_Ecom_ShipTo_Method" eq "") {
    return " Select Shipping Method ";
@@ -50,52 +46,12 @@
    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 (Priority Mail International)">
-Priority Mail International (6-10 days)</option>
-<option value="USPS (Express Mail International)">
-Express Mail International (3-5 days)</option>
-<option value="USPS (Global Express Guaranteed)">
-Global Express Guaranteed (1-3 days)</option>
-<option value="UPS Ground (GND)">UPS Ground (7-10 days)</option>
-<option value="UPS Standard (STD)">UPS Standard to Canada Only (7-10 days)</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 2nd Day Air Early AM (2DM)">UPS 2nd Day Air Early AM</option>
-<option value="UPS Next Day Saver (1DP)">UPS Next Day Air Saver</option>
-<option value="UPS Next Day Air (1DA)">UPS Next Day Air</option>
-<option value="UPS Next Day Air Early AM (1DM)">UPS Next Day Air Early AM</option>
-<option value="UPS Worldwide Express (XPR)">UPS Worldwide Express (international)</option>
-<option value="UPS Worldwide Expedited (XPD)">UPS Worldwide Expedited (international)</option>
-<option value="UPS Worldwide Express Plus(XDM)">UPS Worldwide Express Plus (international)</option>
-<option value='FedEx Priority Overnight'>FedEx Priority Overnight</option>
-<option value='FedEx Standard Overnight'>FedEx Standard Overnight</option>
-<option value='FedEx First Overnight'>FedEx First Overnight</option>
-<option value='FedEx 2 Day'>FedEx 2 Day</option>
-<option value='FedEx Express Saver'>FedEx Express Saver</option>
-<option value='FedEx International Priority'>FedEx International Priority</option>
-<option value='FedEx International Economy'>FedEx International Economy</option>
-<option value='FedEx International First'>FedEx International First</option>
-<option value='FedEx 1 Day Freight'>FedEx 1 Day Freight</option>
-<option value='FedEx 2 Day Freight'>FedEx 2 Day Freight</option>
-<option value='FedEx 3 Day Freight'>FedEx 3 Day Freight</option>
-<option value='FedEx Ground'>FedEx Ground</option>
-<option value='FedEx Ground Home Delivery'>FedEx Ground Home Delivery</option>
-<option value='FedEx International Priority Freight'>FedEx International Priority Freight</option>
-<option value='FedEx International Economy Freight'>FedEx International Economy Freight</option>
-<option value='FedEx Europe First International Priority'>FedEx Europe First International Priority</option>
-</select>
-
+<!--agorascript-pre
 
-<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER ABOVE THIS - REPLACE ENTIRE SHIPPING SELECT ELEMENT-->
+ { return
+qq|$sc_shiptomethod_4forms|;
+}  -->
+</select>
 </td>
 </TR>
 <tr>
@@ -103,188 +59,10 @@
 <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>
+<!--agorascript-pre
+{ return
+qq|$sc_shiptostates_4forms|;}
+ -->
 </select>
 </td>
 </tr>
@@ -302,46 +80,23 @@
 <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)
+<!--agorascript-pre
+
+if ("$sc_shiptocountries_4forms" ne '') { return
+qq|$sc_shiptocountries_4forms|;}
+else {
+return
+qq|
+<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>
+|;
+} -->
 </SELECT>
 </td>
 </tr>
@@ -352,7 +107,7 @@
 <!--agorascript-pre
 # inspired from solutions submitted from Dan at CartSoutions.net
 if ("$sc_display_checkout_tos" =~ /yes/i) { return
-q~
+q|
 <td colspan=2 class="ac_checkout_top_col">
 Terms of Service & Our Contact Information</td>
 </tr>
@@ -364,7 +119,7 @@
 <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>
 
diff -x .svn -aruN 5.2.004.src/html/forms/AgoraPay-orderform.html 5.2.005.src/html/forms/AgoraPay-orderform.html
--- 5.2.004.src/html/forms/AgoraPay-orderform.html	2008-06-26 07:48:43.000000000 -0500
+++ 5.2.005.src/html/forms/AgoraPay-orderform.html	2008-09-22 20:25:14.000000000 -0500
@@ -42,10 +42,7 @@
 <TR>
 <TD class="ac_checkout_left_col">Shipping Method:</TD>
 <TD class="ac_checkout_right_col">
-
-<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER BELOW - REPLACE ENTIRE SHIPPING SELECT ELEMENT-->
-
-<select name=Ecom_ShipTo_Method>
+<select name="Ecom_ShipTo_Method">
 <option value="$vform_Ecom_ShipTo_Method"><!--agorascript-pre
  if ("$vform_Ecom_ShipTo_Method" eq "") {
    return " Select Shipping Method ";
@@ -53,53 +50,12 @@
    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 (Priority Mail International)">
-Priority Mail International (6-10 days)</option>
-<option value="USPS (Express Mail International)">
-Express Mail International (3-5 days)</option>
-<option value="USPS (Global Express Guaranteed)">
-Global Express Guaranteed (1-3 days)</option>
-<option value="UPS Ground (GND)">UPS Ground (7-10 days)</option>
-<option value="UPS Standard (STD)">UPS Standard to Canada Only (7-10 days)</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 2nd Day Air Early AM (2DM)">UPS 2nd Day Air Early AM</option>
-<option value="UPS Next Day Saver (1DP)">UPS Next Day Air Saver</option>
-<option value="UPS Next Day Air (1DA)">UPS Next Day Air</option>
-<option value="UPS Next Day Air Early AM (1DM)">UPS Next Day Air Early AM</option>
-<option value="UPS Worldwide Express (XPR)">UPS Worldwide Express (international)</option>
-<option value="UPS Worldwide Expedited (XPD)">UPS Worldwide Expedited (international)</option>
-<option value="UPS Worldwide Express Plus(XDM)">UPS Worldwide Express Plus (international)</option>
-<option value='FedEx Priority Overnight'>FedEx Priority Overnight</option>
-<option value='FedEx Standard Overnight'>FedEx Standard Overnight</option>
-<option value='FedEx First Overnight'>FedEx First Overnight</option>
-<option value='FedEx 2 Day'>FedEx 2 Day</option>
-<option value='FedEx Express Saver'>FedEx Express Saver</option>
-<option value='FedEx International Priority'>FedEx International Priority</option>
-<option value='FedEx International Economy'>FedEx International Economy</option>
-<option value='FedEx International First'>FedEx International First</option>
-<option value='FedEx 1 Day Freight'>FedEx 1 Day Freight</option>
-<option value='FedEx 2 Day Freight'>FedEx 2 Day Freight</option>
-<option value='FedEx 3 Day Freight'>FedEx 3 Day Freight</option>
-<option value='FedEx Ground'>FedEx Ground</option>
-<option value='FedEx Ground Home Delivery'>FedEx Ground Home Delivery</option>
-<option value='FedEx International Priority Freight'>FedEx International Priority Freight</option>
-<option value='FedEx International Economy Freight'>FedEx International Economy Freight</option>
-<option value='FedEx Europe First International Priority'>FedEx Europe First International Priority</option>
-</select>
-
-
-<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER ABOVE THIS - REPLACE ENTIRE SHIPPING SELECT ELEMENT-->
+<!--agorascript-pre
 
+ { return
+qq|$sc_shiptomethod_4forms|;
+}  -->
+</select>
 </td>
 </TR>
 
@@ -108,188 +64,10 @@
 <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>
+<!--agorascript-pre
+{ return
+qq|$sc_shiptostates_4forms|;}
+ -->
 </select>
 </td>
 </tr>
@@ -308,47 +86,23 @@
 <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)
+<!--agorascript-pre
 
+if ("$sc_shiptocountries_4forms" ne '') { return
+qq|$sc_shiptocountries_4forms|;}
+else {
+return
+qq|
+<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>
+|;
+} -->
 </SELECT>
 </td>
 </tr>
@@ -361,7 +115,7 @@
 <!--agorascript-pre
 # inspired from solutions submitted from Dan at CartSoutions.net
 if ("$sc_display_checkout_tos" =~ /yes/i) { return
-q~
+q|
 <td colspan=2 class="ac_checkout_top_col">
 Terms of Service & Our Contact Information</td>
 </tr>
@@ -373,7 +127,7 @@
 <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>
diff -x .svn -aruN 5.2.004.src/html/forms/AuthorizeNet-orderform.html 5.2.005.src/html/forms/AuthorizeNet-orderform.html
--- 5.2.004.src/html/forms/AuthorizeNet-orderform.html	2008-06-26 07:48:43.000000000 -0500
+++ 5.2.005.src/html/forms/AuthorizeNet-orderform.html	2008-09-22 20:25:15.000000000 -0500
@@ -41,11 +41,7 @@
 <tr>
 <td class="ac_checkout_left_col">Method:</td>
 <td class="ac_checkout_right_col">
-
-
-<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER BELOW - REPLACE ENTIRE SHIPPING SELECT ELEMENT-->
-
-<select name=Ecom_ShipTo_Method>
+<select name="Ecom_ShipTo_Method">
 <option value="$vform_Ecom_ShipTo_Method"><!--agorascript-pre
  if ("$vform_Ecom_ShipTo_Method" eq "") {
    return " Select Shipping Method ";
@@ -53,53 +49,12 @@
    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 (Priority Mail International)">
-Priority Mail International (6-10 days)</option>
-<option value="USPS (Express Mail International)">
-Express Mail International (3-5 days)</option>
-<option value="USPS (Global Express Guaranteed)">
-Global Express Guaranteed (1-3 days)</option>
-<option value="UPS Ground (GND)">UPS Ground (7-10 days)</option>
-<option value="UPS Standard (STD)">UPS Standard to Canada Only (7-10 days)</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 2nd Day Air Early AM (2DM)">UPS 2nd Day Air Early AM</option>
-<option value="UPS Next Day Saver (1DP)">UPS Next Day Air Saver</option>
-<option value="UPS Next Day Air (1DA)">UPS Next Day Air</option>
-<option value="UPS Next Day Air Early AM (1DM)">UPS Next Day Air Early AM</option>
-<option value="UPS Worldwide Express (XPR)">UPS Worldwide Express (international)</option>
-<option value="UPS Worldwide Expedited (XPD)">UPS Worldwide Expedited (international)</option>
-<option value="UPS Worldwide Express Plus(XDM)">UPS Worldwide Express Plus (international)</option>
-<option value='FedEx Priority Overnight'>FedEx Priority Overnight</option>
-<option value='FedEx Standard Overnight'>FedEx Standard Overnight</option>
-<option value='FedEx First Overnight'>FedEx First Overnight</option>
-<option value='FedEx 2 Day'>FedEx 2 Day</option>
-<option value='FedEx Express Saver'>FedEx Express Saver</option>
-<option value='FedEx International Priority'>FedEx International Priority</option>
-<option value='FedEx International Economy'>FedEx International Economy</option>
-<option value='FedEx International First'>FedEx International First</option>
-<option value='FedEx 1 Day Freight'>FedEx 1 Day Freight</option>
-<option value='FedEx 2 Day Freight'>FedEx 2 Day Freight</option>
-<option value='FedEx 3 Day Freight'>FedEx 3 Day Freight</option>
-<option value='FedEx Ground'>FedEx Ground</option>
-<option value='FedEx Ground Home Delivery'>FedEx Ground Home Delivery</option>
-<option value='FedEx International Priority Freight'>FedEx International Priority Freight</option>
-<option value='FedEx International Economy Freight'>FedEx International Economy Freight</option>
-<option value='FedEx Europe First International Priority'>FedEx Europe First International Priority</option>
-</select>
-
-
-<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER ABOVE THIS - REPLACE ENTIRE SHIPPING SELECT ELEMENT-->
+<!--agorascript-pre
 
+ { return
+qq|$sc_shiptomethod_4forms|;
+}  -->
+</select>
 </td>
 </TR>
 
@@ -108,188 +63,10 @@
 <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>
+<!--agorascript-pre
+{ return
+qq|$sc_shiptostates_4forms|;}
+ -->
 </select>
 </td>
 </tr>
@@ -306,47 +83,24 @@
 <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)
+<option VALUE="$vform_Ecom_ShipTo_Postal_CountryCode">$vform_Ecom_ShipTo_Postal_CountryCode
+<!--agorascript-pre
+
+if ("$sc_shiptocountries_4forms" ne '') { return
+qq|$sc_shiptocountries_4forms|;}
+else {
+return
+qq|
+<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>
+|;
+} -->
 </SELECT>
 </td>
 </tr>
@@ -357,7 +111,7 @@
 <!--agorascript-pre
 # inspired from solutions submitted from Dan at CartSoutions.net
 if ("$sc_display_checkout_tos" =~ /yes/i) { return
-q~
+q|
 <td colspan=2 class="ac_checkout_top_col">
 Terms of Service & Our Contact Information</td>
 </tr>
@@ -369,7 +123,7 @@
 <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>
 
diff -x .svn -aruN 5.2.004.src/html/forms/LinkpointConnect-orderform.html 5.2.005.src/html/forms/LinkpointConnect-orderform.html
--- 5.2.004.src/html/forms/LinkpointConnect-orderform.html	2008-06-26 07:48:43.000000000 -0500
+++ 5.2.005.src/html/forms/LinkpointConnect-orderform.html	2008-09-22 20:25:15.000000000 -0500
@@ -42,11 +42,7 @@
 
 <TD class="ac_checkout_left_col">Shipping Method:</TD>
 <TD class="ac_checkout_right_col">
-
-
-<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER BELOW - REPLACE ENTIRE SHIPPING SELECT ELEMENT-->
-
-<select name=Ecom_ShipTo_Method>
+<select name="Ecom_ShipTo_Method">
 <option value="$vform_Ecom_ShipTo_Method"><!--agorascript-pre
  if ("$vform_Ecom_ShipTo_Method" eq "") {
    return " Select Shipping Method ";
@@ -54,53 +50,12 @@
    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 (Priority Mail International)">
-Priority Mail International (6-10 days)</option>
-<option value="USPS (Express Mail International)">
-Express Mail International (3-5 days)</option>
-<option value="USPS (Global Express Guaranteed)">
-Global Express Guaranteed (1-3 days)</option>
-<option value="UPS Ground (GND)">UPS Ground (7-10 days)</option>
-<option value="UPS Standard (STD)">UPS Standard to Canada Only (7-10 days)</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 2nd Day Air Early AM (2DM)">UPS 2nd Day Air Early AM</option>
-<option value="UPS Next Day Saver (1DP)">UPS Next Day Air Saver</option>
-<option value="UPS Next Day Air (1DA)">UPS Next Day Air</option>
-<option value="UPS Next Day Air Early AM (1DM)">UPS Next Day Air Early AM</option>
-<option value="UPS Worldwide Express (XPR)">UPS Worldwide Express (international)</option>
-<option value="UPS Worldwide Expedited (XPD)">UPS Worldwide Expedited (international)</option>
-<option value="UPS Worldwide Express Plus(XDM)">UPS Worldwide Express Plus (international)</option>
-<option value='FedEx Priority Overnight'>FedEx Priority Overnight</option>
-<option value='FedEx Standard Overnight'>FedEx Standard Overnight</option>
-<option value='FedEx First Overnight'>FedEx First Overnight</option>
-<option value='FedEx 2 Day'>FedEx 2 Day</option>
-<option value='FedEx Express Saver'>FedEx Express Saver</option>
-<option value='FedEx International Priority'>FedEx International Priority</option>
-<option value='FedEx International Economy'>FedEx International Economy</option>
-<option value='FedEx International First'>FedEx International First</option>
-<option value='FedEx 1 Day Freight'>FedEx 1 Day Freight</option>
-<option value='FedEx 2 Day Freight'>FedEx 2 Day Freight</option>
-<option value='FedEx 3 Day Freight'>FedEx 3 Day Freight</option>
-<option value='FedEx Ground'>FedEx Ground</option>
-<option value='FedEx Ground Home Delivery'>FedEx Ground Home Delivery</option>
-<option value='FedEx International Priority Freight'>FedEx International Priority Freight</option>
-<option value='FedEx International Economy Freight'>FedEx International Economy Freight</option>
-<option value='FedEx Europe First International Priority'>FedEx Europe First International Priority</option>
-</select>
-
-
-<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER ABOVE THIS - REPLACE ENTIRE SHIPPING SELECT ELEMENT-->
+<!--agorascript-pre
 
+ { return
+qq|$sc_shiptomethod_4forms|;
+}  -->
+</select>
 </td>
 </TR>
 <TR>
@@ -129,188 +84,10 @@
   <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>
+<!--agorascript-pre
+{ return
+qq|$sc_shiptostates_4forms|;}
+ -->
     </select>
   </td>
 </tr>
@@ -326,46 +103,23 @@
   <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>
+<!--agorascript-pre
+
+if ("$sc_shiptocountries_4forms" ne '') { return
+qq|$sc_shiptocountries_4forms|;}
+else {
+return
+qq|
+<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>
+|;
+} -->
     </select>
   </td>
 </tr>
@@ -376,7 +130,7 @@
 <!--agorascript-pre
 # inspired from solutions submitted from Dan at CartSoutions.net
 if ("$sc_display_checkout_tos" =~ /yes/i) { return
-q~
+q|
 <td colspan=2 class="ac_checkout_top_col">
 Terms of Service & Our Contact Information</td>
 </tr>
@@ -388,7 +142,7 @@
 <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>
 
diff -x .svn -aruN 5.2.004.src/html/forms/NiftyPay-orderform.html 5.2.005.src/html/forms/NiftyPay-orderform.html
--- 5.2.004.src/html/forms/NiftyPay-orderform.html	2008-06-26 07:48:43.000000000 -0500
+++ 5.2.005.src/html/forms/NiftyPay-orderform.html	2008-09-22 20:25:16.000000000 -0500
@@ -42,11 +42,7 @@
 <TR>
 <TD class="ac_checkout_left_col">Shipping Method:</TD>
 <TD class="ac_checkout_right_col">
-
-
-<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER BELOW - REPLACE ENTIRE SHIPPING SELECT ELEMENT-->
-
-<select name=Ecom_ShipTo_Method>
+<select name="Ecom_ShipTo_Method">
 <option value="$vform_Ecom_ShipTo_Method"><!--agorascript-pre
  if ("$vform_Ecom_ShipTo_Method" eq "") {
    return " Select Shipping Method ";
@@ -54,54 +50,12 @@
    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 (Priority Mail International)">
-Priority Mail International (6-10 days)</option>
-<option value="USPS (Express Mail International)">
-Express Mail International (3-5 days)</option>
-<option value="USPS (Global Express Guaranteed)">
-Global Express Guaranteed (1-3 days)</option>
-<option value="UPS Ground (GND)">UPS Ground (7-10 days)</option>
-<option value="UPS Standard (STD)">UPS Standard to Canada Only (7-10 days)</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 2nd Day Air Early AM (2DM)">UPS 2nd Day Air Early AM</option>
-<option value="UPS Next Day Saver (1DP)">UPS Next Day Air Saver</option>
-<option value="UPS Next Day Air (1DA)">UPS Next Day Air</option>
-<option value="UPS Next Day Air Early AM (1DM)">UPS Next Day Air Early AM</option>
-<option value="UPS Worldwide Express (XPR)">UPS Worldwide Express (international)</option>
-<option value="UPS Worldwide Expedited (XPD)">UPS Worldwide Expedited (international)</option>
-<option value="UPS Worldwide Express Plus(XDM)">UPS Worldwide Express Plus (international)</option>
-<option value='FedEx Priority Overnight'>FedEx Priority Overnight</option>
-<option value='FedEx Standard Overnight'>FedEx Standard Overnight</option>
-<option value='FedEx First Overnight'>FedEx First Overnight</option>
-<option value='FedEx 2 Day'>FedEx 2 Day</option>
-<option value='FedEx Express Saver'>FedEx Express Saver</option>
-<option value='FedEx International Priority'>FedEx International Priority</option>
-<option value='FedEx International Economy'>FedEx International Economy</option>
-<option value='FedEx International First'>FedEx International First</option>
-<option value='FedEx 1 Day Freight'>FedEx 1 Day Freight</option>
-<option value='FedEx 2 Day Freight'>FedEx 2 Day Freight</option>
-<option value='FedEx 3 Day Freight'>FedEx 3 Day Freight</option>
-<option value='FedEx Ground'>FedEx Ground</option>
-<option value='FedEx Ground Home Delivery'>FedEx Ground Home Delivery</option>
-<option value='FedEx International Priority Freight'>FedEx International Priority Freight</option>
-<option value='FedEx International Economy Freight'>FedEx International Economy Freight</option>
-<option value='FedEx Europe First International Priority'>FedEx Europe First International Priority</option>
-</select>
-
-
-<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER ABOVE THIS - REPLACE ENTIRE SHIPPING SELECT ELEMENT-->
-
+<!--agorascript-pre
 
+ { return
+qq|$sc_shiptomethod_4forms|;
+}  -->
+</select>
 </td>
 </TR>
 
@@ -110,188 +64,10 @@
 <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>
+<!--agorascript-pre
+{ return
+qq|$sc_shiptostates_4forms|;}
+ -->
 </select>
 </td>
 </tr>
@@ -310,47 +86,23 @@
 <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)
+<!--agorascript-pre
 
+if ("$sc_shiptocountries_4forms" ne '') { return
+qq|$sc_shiptocountries_4forms|;}
+else {
+return
+qq|
+<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>
+|;
+} -->
 </SELECT>
 </td>
 </tr>
@@ -363,7 +115,7 @@
 <!--agorascript-pre
 # inspired from solutions submitted from Dan at CartSoutions.net
 if ("$sc_display_checkout_tos" =~ /yes/i) { return
-q~
+q|
 <td colspan=2 class="ac_checkout_top_col">
 Terms of Service & Our Contact Information</td>
 </tr>
@@ -375,7 +127,7 @@
 <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>
diff -x .svn -aruN 5.2.004.src/html/forms/Offline-orderform.html 5.2.005.src/html/forms/Offline-orderform.html
--- 5.2.004.src/html/forms/Offline-orderform.html	2008-06-26 07:48:43.000000000 -0500
+++ 5.2.005.src/html/forms/Offline-orderform.html	2008-09-22 20:25:16.000000000 -0500
@@ -64,188 +64,10 @@
   <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>
+<!--agorascript-pre
+{ return
+qq|$sc_shiptostates_4forms|;}
+ -->
     </select>
   </td>
 </tr>
@@ -264,46 +86,23 @@
   <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>
+<!--agorascript-pre
+
+if ("$sc_shiptocountries_4forms" ne '') { return
+qq|$sc_shiptocountries_4forms|;}
+else {
+return
+qq|
+<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>
+|;
+} -->
     </select>
   </td>
 </tr>
@@ -557,13 +356,14 @@
 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>
+<option> 2013</option>
+<option> 2014</option>
+<option> 2015</option>
 </select>
 </td>
 </tr>
@@ -572,7 +372,7 @@
 -->
 <!--agorascript-pre
 if ("$sc_offline_enable_cvv" =~ /yes/i) { return
-q~
+q|
 <tr>
   <td class="ac_checkout_left_col">CVV2:</td>
   <td class="ac_checkout_right_col">
@@ -580,7 +380,7 @@
     &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>
@@ -597,11 +397,7 @@
 <tr>
 <td class="ac_checkout_left_col">Method:</td>
 <td class="ac_checkout_right_col">
-
-
-<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER BELOW - REPLACE ENTIRE SHIPPING SELECT ELEMENT-->
-
-<select name=Ecom_ShipTo_Method>
+<select name="Ecom_ShipTo_Method">
 <option value="$vform_Ecom_ShipTo_Method"><!--agorascript-pre
  if ("$vform_Ecom_ShipTo_Method" eq "") {
    return " Select Shipping Method ";
@@ -609,53 +405,12 @@
    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 (Priority Mail International)">
-Priority Mail International (6-10 days)</option>
-<option value="USPS (Express Mail International)">
-Express Mail International (3-5 days)</option>
-<option value="USPS (Global Express Guaranteed)">
-Global Express Guaranteed (1-3 days)</option>
-<option value="UPS Ground (GND)">UPS Ground (7-10 days)</option>
-<option value="UPS Standard (STD)">UPS Standard to Canada Only (7-10 days)</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 2nd Day Air Early AM (2DM)">UPS 2nd Day Air Early AM</option>
-<option value="UPS Next Day Saver (1DP)">UPS Next Day Air Saver</option>
-<option value="UPS Next Day Air (1DA)">UPS Next Day Air</option>
-<option value="UPS Next Day Air Early AM (1DM)">UPS Next Day Air Early AM</option>
-<option value="UPS Worldwide Express (XPR)">UPS Worldwide Express (international)</option>
-<option value="UPS Worldwide Expedited (XPD)">UPS Worldwide Expedited (international)</option>
-<option value="UPS Worldwide Express Plus(XDM)">UPS Worldwide Express Plus (international)</option>
-<option value='FedEx Priority Overnight'>FedEx Priority Overnight</option>
-<option value='FedEx Standard Overnight'>FedEx Standard Overnight</option>
-<option value='FedEx First Overnight'>FedEx First Overnight</option>
-<option value='FedEx 2 Day'>FedEx 2 Day</option>
-<option value='FedEx Express Saver'>FedEx Express Saver</option>
-<option value='FedEx International Priority'>FedEx International Priority</option>
-<option value='FedEx International Economy'>FedEx International Economy</option>
-<option value='FedEx International First'>FedEx International First</option>
-<option value='FedEx 1 Day Freight'>FedEx 1 Day Freight</option>
-<option value='FedEx 2 Day Freight'>FedEx 2 Day Freight</option>
-<option value='FedEx 3 Day Freight'>FedEx 3 Day Freight</option>
-<option value='FedEx Ground'>FedEx Ground</option>
-<option value='FedEx Ground Home Delivery'>FedEx Ground Home Delivery</option>
-<option value='FedEx International Priority Freight'>FedEx International Priority Freight</option>
-<option value='FedEx International Economy Freight'>FedEx International Economy Freight</option>
-<option value='FedEx Europe First International Priority'>FedEx Europe First International Priority</option>
-</select>
-
-
-<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER ABOVE THIS - REPLACE ENTIRE SHIPPING SELECT ELEMENT-->
+<!--agorascript-pre
 
+ { return
+qq|$sc_shiptomethod_4forms|;
+}  -->
+</select>
 </td>
 </tr>
 
@@ -696,188 +451,10 @@
 <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>
+<!--agorascript-pre
+{ return
+qq|$sc_shiptostates_4forms|;}
+ -->
 </select>
 </td>
 </tr>
@@ -895,6 +472,13 @@
 <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>
+<!--agorascript-pre
+
+if ("$sc_shiptocountries_4forms" ne '') { return
+qq|$sc_shiptocountries_4forms|;}
+else {
+return
+qq|
 <option>United States</option>
 <option>Australia</option>
 <option>Canada</option>
@@ -903,39 +487,8 @@
 <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>
@@ -987,7 +540,7 @@
 <!--agorascript-pre
 # inspired from solutions submitted from Dan at CartSoutions.net
 if ("$sc_display_checkout_tos" =~ /yes/i) { return
-q~
+q|
 <tr>
 <td colspan="2"><hr/></td>
 </tr>
@@ -999,7 +552,7 @@
 <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>
diff -x .svn -aruN 5.2.004.src/html/forms/PayPal-orderform.html 5.2.005.src/html/forms/PayPal-orderform.html
--- 5.2.004.src/html/forms/PayPal-orderform.html	2008-06-26 07:48:43.000000000 -0500
+++ 5.2.005.src/html/forms/PayPal-orderform.html	2008-09-22 20:25:17.000000000 -0500
@@ -41,11 +41,7 @@
 <tr>
 <td class="ac_checkout_left_col">Method:</td>
 <td class="ac_checkout_right_col">
-
-
-<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER BELOW - REPLACE ENTIRE SHIPPING SELECT ELEMENT-->
-
-<select name=Ecom_ShipTo_Method>
+<select name="Ecom_ShipTo_Method">
 <option value="$vform_Ecom_ShipTo_Method"><!--agorascript-pre
  if ("$vform_Ecom_ShipTo_Method" eq "") {
    return " Select Shipping Method ";
@@ -53,54 +49,12 @@
    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 (Priority Mail International)">
-Priority Mail International (6-10 days)</option>
-<option value="USPS (Express Mail International)">
-Express Mail International (3-5 days)</option>
-<option value="USPS (Global Express Guaranteed)">
-Global Express Guaranteed (1-3 days)</option>
-<option value="UPS Ground (GND)">UPS Ground (7-10 days)</option>
-<option value="UPS Standard (STD)">UPS Standard to Canada Only (7-10 days)</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 2nd Day Air Early AM (2DM)">UPS 2nd Day Air Early AM</option>
-<option value="UPS Next Day Saver (1DP)">UPS Next Day Air Saver</option>
-<option value="UPS Next Day Air (1DA)">UPS Next Day Air</option>
-<option value="UPS Next Day Air Early AM (1DM)">UPS Next Day Air Early AM</option>
-<option value="UPS Worldwide Express (XPR)">UPS Worldwide Express (international)</option>
-<option value="UPS Worldwide Expedited (XPD)">UPS Worldwide Expedited (international)</option>
-<option value="UPS Worldwide Express Plus(XDM)">UPS Worldwide Express Plus (international)</option>
-<option value='FedEx Priority Overnight'>FedEx Priority Overnight</option>
-<option value='FedEx Standard Overnight'>FedEx Standard Overnight</option>
-<option value='FedEx First Overnight'>FedEx First Overnight</option>
-<option value='FedEx 2 Day'>FedEx 2 Day</option>
-<option value='FedEx Express Saver'>FedEx Express Saver</option>
-<option value='FedEx International Priority'>FedEx International Priority</option>
-<option value='FedEx International Economy'>FedEx International Economy</option>
-<option value='FedEx International First'>FedEx International First</option>
-<option value='FedEx 1 Day Freight'>FedEx 1 Day Freight</option>
-<option value='FedEx 2 Day Freight'>FedEx 2 Day Freight</option>
-<option value='FedEx 3 Day Freight'>FedEx 3 Day Freight</option>
-<option value='FedEx Ground'>FedEx Ground</option>
-<option value='FedEx Ground Home Delivery'>FedEx Ground Home Delivery</option>
-<option value='FedEx International Priority Freight'>FedEx International Priority Freight</option>
-<option value='FedEx International Economy Freight'>FedEx International Economy Freight</option>
-<option value='FedEx Europe First International Priority'>FedEx Europe First International Priority</option>
-</select>
-
-
-<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER ABOVE THIS - REPLACE ENTIRE SHIPPING SELECT ELEMENT-->
-
+<!--agorascript-pre
 
+ { return
+qq|$sc_shiptomethod_4forms|;
+}  -->
+</select>
 </td>
 </TR>
 
@@ -141,188 +95,10 @@
 <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>
+<!--agorascript-pre
+{ return
+qq|$sc_shiptostates_4forms|;}
+ -->
 </select>
 </td>
 </tr>
@@ -340,46 +116,23 @@
 <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)
+<!--agorascript-pre
+
+if ("$sc_shiptocountries_4forms" ne '') { return
+qq|$sc_shiptocountries_4forms|;}
+else {
+return
+qq|
+<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>
+|;
+} -->
 </SELECT>
 </td>
 </tr>
@@ -390,7 +143,7 @@
 <!--agorascript-pre
 # inspired from solutions submitted from Dan at CartSoutions.net
 if ("$sc_display_checkout_tos" =~ /yes/i) { return
-q~
+q|
 <td colspan=2 class="ac_checkout_top_col">
 Terms of Service & Our Contact Information</td>
 </tr>
@@ -402,7 +155,7 @@
 <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>
 
diff -x .svn -aruN 5.2.004.src/html/forms/PlugnPay-orderform.html 5.2.005.src/html/forms/PlugnPay-orderform.html
--- 5.2.004.src/html/forms/PlugnPay-orderform.html	2008-06-26 07:48:43.000000000 -0500
+++ 5.2.005.src/html/forms/PlugnPay-orderform.html	2008-09-22 20:25:17.000000000 -0500
@@ -39,11 +39,7 @@
 <tr>
 <td class="ac_checkout_left_col">Method:</td>
 <td class="ac_checkout_right_col">
-
-
-<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER BELOW - REPLACE ENTIRE SHIPPING SELECT ELEMENT-->
-
-<select name=Ecom_ShipTo_Method>
+<select name="Ecom_ShipTo_Method">
 <option value="$vform_Ecom_ShipTo_Method"><!--agorascript-pre
  if ("$vform_Ecom_ShipTo_Method" eq "") {
    return " Select Shipping Method ";
@@ -51,54 +47,12 @@
    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 (Priority Mail International)">
-Priority Mail International (6-10 days)</option>
-<option value="USPS (Express Mail International)">
-Express Mail International (3-5 days)</option>
-<option value="USPS (Global Express Guaranteed)">
-Global Express Guaranteed (1-3 days)</option>
-<option value="UPS Ground (GND)">UPS Ground (7-10 days)</option>
-<option value="UPS Standard (STD)">UPS Standard to Canada Only (7-10 days)</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 2nd Day Air Early AM (2DM)">UPS 2nd Day Air Early AM</option>
-<option value="UPS Next Day Saver (1DP)">UPS Next Day Air Saver</option>
-<option value="UPS Next Day Air (1DA)">UPS Next Day Air</option>
-<option value="UPS Next Day Air Early AM (1DM)">UPS Next Day Air Early AM</option>
-<option value="UPS Worldwide Express (XPR)">UPS Worldwide Express (international)</option>
-<option value="UPS Worldwide Expedited (XPD)">UPS Worldwide Expedited (international)</option>
-<option value="UPS Worldwide Express Plus(XDM)">UPS Worldwide Express Plus (international)</option>
-<option value='FedEx Priority Overnight'>FedEx Priority Overnight</option>
-<option value='FedEx Standard Overnight'>FedEx Standard Overnight</option>
-<option value='FedEx First Overnight'>FedEx First Overnight</option>
-<option value='FedEx 2 Day'>FedEx 2 Day</option>
-<option value='FedEx Express Saver'>FedEx Express Saver</option>
-<option value='FedEx International Priority'>FedEx International Priority</option>
-<option value='FedEx International Economy'>FedEx International Economy</option>
-<option value='FedEx International First'>FedEx International First</option>
-<option value='FedEx 1 Day Freight'>FedEx 1 Day Freight</option>
-<option value='FedEx 2 Day Freight'>FedEx 2 Day Freight</option>
-<option value='FedEx 3 Day Freight'>FedEx 3 Day Freight</option>
-<option value='FedEx Ground'>FedEx Ground</option>
-<option value='FedEx Ground Home Delivery'>FedEx Ground Home Delivery</option>
-<option value='FedEx International Priority Freight'>FedEx International Priority Freight</option>
-<option value='FedEx International Economy Freight'>FedEx International Economy Freight</option>
-<option value='FedEx Europe First International Priority'>FedEx Europe First International Priority</option>
-</select>
-
-
-<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER ABOVE THIS - REPLACE ENTIRE SHIPPING SELECT ELEMENT-->
-
+<!--agorascript-pre
 
+ { return
+qq|$sc_shiptomethod_4forms|;
+}  -->
+</select>
 </td>
 </TR>
 <tr>
@@ -106,188 +60,10 @@
 <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>
+<!--agorascript-pre
+{ return
+qq|$sc_shiptostates_4forms|;}
+ -->
 </select>
 </td>
 </tr>
@@ -305,46 +81,23 @@
 <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)
+<!--agorascript-pre
+
+if ("$sc_shiptocountries_4forms" ne '') { return
+qq|$sc_shiptocountries_4forms|;}
+else {
+return
+qq|
+<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>
+|;
+} -->
 </SELECT>
 </td>
 </tr>
@@ -355,7 +108,7 @@
 <!--agorascript-pre
 # inspired from solutions submitted from Dan at CartSoutions.net
 if ("$sc_display_checkout_tos" =~ /yes/i) { return
-q~
+q|
 <td colspan=2 class="ac_checkout_top_col">
 Terms of Service & Our Contact Information</td>
 </tr>
@@ -367,7 +120,7 @@
 <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>
 
diff -x .svn -aruN 5.2.004.src/html/forms/USAepay-orderform.html 5.2.005.src/html/forms/USAepay-orderform.html
--- 5.2.004.src/html/forms/USAepay-orderform.html	2008-06-26 07:48:43.000000000 -0500
+++ 5.2.005.src/html/forms/USAepay-orderform.html	2008-09-22 20:25:17.000000000 -0500
@@ -64,188 +64,10 @@
   <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>
+<!--agorascript-pre
+{ return
+qq|$sc_shiptostates_4forms|;}
+ -->
     </select>
   </td>
 </tr>
@@ -264,46 +86,23 @@
   <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>
+<!--agorascript-pre
+
+if ("$sc_shiptocountries_4forms" ne '') { return
+qq|$sc_shiptocountries_4forms|;}
+else {
+return
+qq|
+<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>
+|;
+} -->
     </select>
   </td>
 </tr>
@@ -433,7 +232,6 @@
 -->
 
 </option>
-<option value="07"> 2007</option>
 <option value="08"> 2008</option>
 <option value="09"> 2009</option>
 <option value="10"> 2010</option>
@@ -474,11 +272,7 @@
 <tr>
 <td class="ac_checkout_left_col">Method:</td>
 <td class="ac_checkout_right_col">
-
-
-<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER BELOW - REPLACE ENTIRE SHIPPING SELECT ELEMENT-->
-
-<select name=Ecom_ShipTo_Method>
+<select name="Ecom_ShipTo_Method">
 <option value="$vform_Ecom_ShipTo_Method"><!--agorascript-pre
  if ("$vform_Ecom_ShipTo_Method" eq "") {
    return " Select Shipping Method ";
@@ -486,54 +280,12 @@
    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 (Priority Mail International)">
-Priority Mail International (6-10 days)</option>
-<option value="USPS (Express Mail International)">
-Express Mail International (3-5 days)</option>
-<option value="USPS (Global Express Guaranteed)">
-Global Express Guaranteed (1-3 days)</option>
-<option value="UPS Ground (GND)">UPS Ground (7-10 days)</option>
-<option value="UPS Standard (STD)">UPS Standard to Canada Only (7-10 days)</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 2nd Day Air Early AM (2DM)">UPS 2nd Day Air Early AM</option>
-<option value="UPS Next Day Saver (1DP)">UPS Next Day Air Saver</option>
-<option value="UPS Next Day Air (1DA)">UPS Next Day Air</option>
-<option value="UPS Next Day Air Early AM (1DM)">UPS Next Day Air Early AM</option>
-<option value="UPS Worldwide Express (XPR)">UPS Worldwide Express (international)</option>
-<option value="UPS Worldwide Expedited (XPD)">UPS Worldwide Expedited (international)</option>
-<option value="UPS Worldwide Express Plus(XDM)">UPS Worldwide Express Plus (international)</option>
-<option value='FedEx Priority Overnight'>FedEx Priority Overnight</option>
-<option value='FedEx Standard Overnight'>FedEx Standard Overnight</option>
-<option value='FedEx First Overnight'>FedEx First Overnight</option>
-<option value='FedEx 2 Day'>FedEx 2 Day</option>
-<option value='FedEx Express Saver'>FedEx Express Saver</option>
-<option value='FedEx International Priority'>FedEx International Priority</option>
-<option value='FedEx International Economy'>FedEx International Economy</option>
-<option value='FedEx International First'>FedEx International First</option>
-<option value='FedEx 1 Day Freight'>FedEx 1 Day Freight</option>
-<option value='FedEx 2 Day Freight'>FedEx 2 Day Freight</option>
-<option value='FedEx 3 Day Freight'>FedEx 3 Day Freight</option>
-<option value='FedEx Ground'>FedEx Ground</option>
-<option value='FedEx Ground Home Delivery'>FedEx Ground Home Delivery</option>
-<option value='FedEx International Priority Freight'>FedEx International Priority Freight</option>
-<option value='FedEx International Economy Freight'>FedEx International Economy Freight</option>
-<option value='FedEx Europe First International Priority'>FedEx Europe First International Priority</option>
-</select>
-
-
-<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER ABOVE THIS - REPLACE ENTIRE SHIPPING SELECT ELEMENT-->
-
+<!--agorascript-pre
 
+ { return
+qq|$sc_shiptomethod_4forms|;
+}  -->
+</select>
 </td>
 </tr>
 
@@ -574,188 +326,10 @@
 <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>
+<!--agorascript-pre
+{ return
+qq|$sc_shiptostates_4forms|;}
+ -->
 </select>
 </td>
 </tr>
@@ -773,6 +347,13 @@
 <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>
+<!--agorascript-pre
+
+if ("$sc_shiptocountries_4forms" ne '') { return
+qq|$sc_shiptocountries_4forms|;}
+else {
+return
+qq|
 <option>United States</option>
 <option>Australia</option>
 <option>Canada</option>
@@ -781,39 +362,8 @@
 <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>
@@ -865,7 +415,7 @@
 <!--agorascript-pre
 # inspired from solutions submitted from Dan at CartSoutions.net
 if ("$sc_display_checkout_tos" =~ /yes/i) { return
-q~
+q|
 <tr>
 <td colspan="2"><hr/></td>
 </tr>
@@ -877,7 +427,7 @@
 <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>
diff -x .svn -aruN 5.2.004.src/html/forms/YourPayConnect-orderform.html 5.2.005.src/html/forms/YourPayConnect-orderform.html
--- 5.2.004.src/html/forms/YourPayConnect-orderform.html	2008-06-26 07:48:43.000000000 -0500
+++ 5.2.005.src/html/forms/YourPayConnect-orderform.html	2008-09-22 20:25:18.000000000 -0500
@@ -42,10 +42,7 @@
 
 <TD class="ac_checkout_left_col">Shipping Method:</TD>
 <TD class="ac_checkout_right_col">
-
-<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER BELOW - REPLACE ENTIRE SHIPPING SELECT ELEMENT-->
-
-<select name=Ecom_ShipTo_Method>
+<select name="Ecom_ShipTo_Method">
 <option value="$vform_Ecom_ShipTo_Method"><!--agorascript-pre
  if ("$vform_Ecom_ShipTo_Method" eq "") {
    return " Select Shipping Method ";
@@ -53,53 +50,12 @@
    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 (Priority Mail International)">
-Priority Mail International (6-10 days)</option>
-<option value="USPS (Express Mail International)">
-Express Mail International (3-5 days)</option>
-<option value="USPS (Global Express Guaranteed)">
-Global Express Guaranteed (1-3 days)</option>
-<option value="UPS Ground (GND)">UPS Ground (7-10 days)</option>
-<option value="UPS Standard (STD)">UPS Standard to Canada Only (7-10 days)</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 2nd Day Air Early AM (2DM)">UPS 2nd Day Air Early AM</option>
-<option value="UPS Next Day Saver (1DP)">UPS Next Day Air Saver</option>
-<option value="UPS Next Day Air (1DA)">UPS Next Day Air</option>
-<option value="UPS Next Day Air Early AM (1DM)">UPS Next Day Air Early AM</option>
-<option value="UPS Worldwide Express (XPR)">UPS Worldwide Express (international)</option>
-<option value="UPS Worldwide Expedited (XPD)">UPS Worldwide Expedited (international)</option>
-<option value="UPS Worldwide Express Plus(XDM)">UPS Worldwide Express Plus (international)</option>
-<option value='FedEx Priority Overnight'>FedEx Priority Overnight</option>
-<option value='FedEx Standard Overnight'>FedEx Standard Overnight</option>
-<option value='FedEx First Overnight'>FedEx First Overnight</option>
-<option value='FedEx 2 Day'>FedEx 2 Day</option>
-<option value='FedEx Express Saver'>FedEx Express Saver</option>
-<option value='FedEx International Priority'>FedEx International Priority</option>
-<option value='FedEx International Economy'>FedEx International Economy</option>
-<option value='FedEx International First'>FedEx International First</option>
-<option value='FedEx 1 Day Freight'>FedEx 1 Day Freight</option>
-<option value='FedEx 2 Day Freight'>FedEx 2 Day Freight</option>
-<option value='FedEx 3 Day Freight'>FedEx 3 Day Freight</option>
-<option value='FedEx Ground'>FedEx Ground</option>
-<option value='FedEx Ground Home Delivery'>FedEx Ground Home Delivery</option>
-<option value='FedEx International Priority Freight'>FedEx International Priority Freight</option>
-<option value='FedEx International Economy Freight'>FedEx International Economy Freight</option>
-<option value='FedEx Europe First International Priority'>FedEx Europe First International Priority</option>
-</select>
-
-
-<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER ABOVE THIS - REPLACE ENTIRE SHIPPING SELECT ELEMENT-->
+<!--agorascript-pre
 
+ { return
+qq|$sc_shiptomethod_4forms|;
+}  -->
+</select>
 </td>
 </TR>
 <TR>
@@ -128,188 +84,10 @@
   <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>
+<!--agorascript-pre
+{ return
+qq|$sc_shiptostates_4forms|;}
+ -->
     </select>
   </td>
 </tr>
@@ -325,46 +103,23 @@
   <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>
+<!--agorascript-pre
+
+if ("$sc_shiptocountries_4forms" ne '') { return
+qq|$sc_shiptocountries_4forms|;}
+else {
+return
+qq|
+<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>
+|;
+} -->
     </select>
   </td>
 </tr>
@@ -375,7 +130,7 @@
 <!--agorascript-pre
 # inspired from solutions submitted from Dan at CartSoutions.net
 if ("$sc_display_checkout_tos" =~ /yes/i) { return
-q~
+q|
 <td colspan=2 class="ac_checkout_top_col">
 Terms of Service & Our Contact Information</td>
 </tr>
@@ -387,7 +142,7 @@
 <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>
 
diff -x .svn -aruN 5.2.004.src/html/forms/iTransact-orderform.html 5.2.005.src/html/forms/iTransact-orderform.html
--- 5.2.004.src/html/forms/iTransact-orderform.html	2008-06-26 07:48:43.000000000 -0500
+++ 5.2.005.src/html/forms/iTransact-orderform.html	2008-09-22 20:25:15.000000000 -0500
@@ -42,11 +42,7 @@
 <TR>
 <TD class="ac_checkout_left_col">Shipping Method:</TD>
 <TD class="ac_checkout_right_col">
-
-
-<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER BELOW - REPLACE ENTIRE SHIPPING SELECT ELEMENT-->
-
-<select name=Ecom_ShipTo_Method>
+<select name="Ecom_ShipTo_Method">
 <option value="$vform_Ecom_ShipTo_Method"><!--agorascript-pre
  if ("$vform_Ecom_ShipTo_Method" eq "") {
    return " Select Shipping Method ";
@@ -54,54 +50,12 @@
    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 (Priority Mail International)">
-Priority Mail International (6-10 days)</option>
-<option value="USPS (Express Mail International)">
-Express Mail International (3-5 days)</option>
-<option value="USPS (Global Express Guaranteed)">
-Global Express Guaranteed (1-3 days)</option>
-<option value="UPS Ground (GND)">UPS Ground (7-10 days)</option>
-<option value="UPS Standard (STD)">UPS Standard to Canada Only (7-10 days)</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 2nd Day Air Early AM (2DM)">UPS 2nd Day Air Early AM</option>
-<option value="UPS Next Day Saver (1DP)">UPS Next Day Air Saver</option>
-<option value="UPS Next Day Air (1DA)">UPS Next Day Air</option>
-<option value="UPS Next Day Air Early AM (1DM)">UPS Next Day Air Early AM</option>
-<option value="UPS Worldwide Express (XPR)">UPS Worldwide Express (international)</option>
-<option value="UPS Worldwide Expedited (XPD)">UPS Worldwide Expedited (international)</option>
-<option value="UPS Worldwide Express Plus(XDM)">UPS Worldwide Express Plus (international)</option>
-<option value='FedEx Priority Overnight'>FedEx Priority Overnight</option>
-<option value='FedEx Standard Overnight'>FedEx Standard Overnight</option>
-<option value='FedEx First Overnight'>FedEx First Overnight</option>
-<option value='FedEx 2 Day'>FedEx 2 Day</option>
-<option value='FedEx Express Saver'>FedEx Express Saver</option>
-<option value='FedEx International Priority'>FedEx International Priority</option>
-<option value='FedEx International Economy'>FedEx International Economy</option>
-<option value='FedEx International First'>FedEx International First</option>
-<option value='FedEx 1 Day Freight'>FedEx 1 Day Freight</option>
-<option value='FedEx 2 Day Freight'>FedEx 2 Day Freight</option>
-<option value='FedEx 3 Day Freight'>FedEx 3 Day Freight</option>
-<option value='FedEx Ground'>FedEx Ground</option>
-<option value='FedEx Ground Home Delivery'>FedEx Ground Home Delivery</option>
-<option value='FedEx International Priority Freight'>FedEx International Priority Freight</option>
-<option value='FedEx International Economy Freight'>FedEx International Economy Freight</option>
-<option value='FedEx Europe First International Priority'>FedEx Europe First International Priority</option>
-</select>
-
-
-<!--PASTE SHIPPING METHODS FROM SHIPPING MANAGER ABOVE THIS - REPLACE ENTIRE SHIPPING SELECT ELEMENT-->
-
+<!--agorascript-pre
 
+ { return
+qq|$sc_shiptomethod_4forms|;
+}  -->
+</select>
 </td>
 </TR>
 
@@ -110,188 +64,10 @@
 <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>
+<!--agorascript-pre
+{ return
+qq|$sc_shiptostates_4forms|;}
+ -->
 </select>
 </td>
 </tr>
@@ -310,47 +86,23 @@
 <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)
+<!--agorascript-pre
 
+if ("$sc_shiptocountries_4forms" ne '') { return
+qq|$sc_shiptocountries_4forms|;}
+else {
+return
+qq|
+<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>
+|;
+} -->
 </SELECT>
 </td>
 </tr>
@@ -363,7 +115,7 @@
 <!--agorascript-pre
 # inspired from solutions submitted from Dan at CartSoutions.net
 if ("$sc_display_checkout_tos" =~ /yes/i) { return
-q~
+q|
 <td colspan=2 class="ac_checkout_top_col">
 Terms of Service & Our Contact Information</td>
 </tr>
@@ -375,7 +127,7 @@
 <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>
diff -x .svn -aruN 5.2.004.src/html/html-templates/templates/TheAgora/store_footer.html 5.2.005.src/html/html-templates/templates/TheAgora/store_footer.html
--- 5.2.004.src/html/html-templates/templates/TheAgora/store_footer.html	2008-06-26 07:48:43.000000000 -0500
+++ 5.2.005.src/html/html-templates/templates/TheAgora/store_footer.html	2008-08-31 05:40:40.000000000 -0500
@@ -15,11 +15,11 @@
 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)) {
-    my $buysafe_temp_display = '';
+    my ($buysafe_temp_display,$pre_calc_shipping_display) = '';
      if ($sc_buySafe_is_enabled =~ /yes/) {
-         $buysafe_temp_display = qq|<br><br>$sc_buysafe_merchant_seal_complete_button_string|;
+         $buysafe_temp_display = qq|<br>/<br/>$sc_buysafe_merchant_seal_complete_button_string|;
     }
-    return "<br>Items in your cart: 0 $buysafe_temp_display<br><br>"
+    return "<br/>Items in your cart: 0 $buysafe_temp_display<br/><br/>"
 }
 open (CART, "$sc_cart_path") || &file_open_error("$sc_cart_path",
  "display_cart_contents_in_header", __FILE__, __LINE__);
@@ -39,17 +39,22 @@
 close (CART);
 my $buysafe_temp_display = '';
 if ($sc_buySafe_is_enabled =~ /yes/) {
-    $buysafe_temp_display = qq|<br><br>$sc_buysafe_merchant_seal_complete_button_string <br>|;
+    $buysafe_temp_display = qq|<br/><br/>$sc_buysafe_merchant_seal_complete_button_string <br/>|;
 }
+if ($sc_pre_calc_shipping_installed =~ /Yes/) {
+    $pre_calc_shipping_display = qq|<br/><br/><form method="post" action="agora.cgi"><input type="submit" name="show_simple_option_form" value="Calculate Shipping"></form> <br/>|;
+}
+
 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">' .
+      '</font><br/><br/></td></tr><tr><td class="template_checkoutcartcontents">' .
       "<a href=\"$sc_store_url?dc=1&amp;%%href_fields%%" . 
-      '" rel="nofollow">View Cart Details</a><br>' .
+      '" rel="nofollow">View Cart Details</a><br/>' .
       '<a href="%%StepOneURL%%?order_form_button.x=1&amp;%%href_fields%%' . 
-      qq|" rel="nofollow">Check Out</a>$buysafe_temp_display</td>| .
+      qq|" rel="nofollow">Check Out</a>$pre_calc_shipping_display| .
+      qq| $buysafe_temp_display</td>| .
       "</tr></table>";
  } else {
   $result = '<table><tr><td class="template_cartcontents">' .
@@ -78,11 +83,11 @@
           </tr>
           <tr>
             <td class="template_cartcontents"><div align="left"><span class="style6"> </span>   
-<br>$sc_tenNewProducts<br><br>
+<br>$sc_tenNewProducts<br/><br/>
 </div></td>
 
           </tr>
-        </table><br>
+        </table><br/>
 ~;
 }
 # end display New Products
@@ -96,11 +101,11 @@
           </tr>
           <tr>
             <td class="template_cartcontents"><div align="left"><span class="style6"> </span>   
-<br>$sc_featuredProduct<br><br>
+<br>$sc_featuredProduct<br/><br/>
 </div></td>
 
           </tr>
-        </table><br>
+        </table><br/>
 ~;
 }
 # end display Featured Product
@@ -114,7 +119,7 @@
           </tr>
           <tr>
             <td class="template_cartcontents"><div align="left"><span class="style6"> </span>   
-<br>$sc_tenBestSellers<br><br>
+<br>$sc_tenBestSellers<br/><br/>
 </div></td>
 
           </tr>
@@ -147,7 +152,7 @@
 }
 -->
 <br />
-	Powered by <a href="http://www.AgoraCartPro.com" class="copyright_link">AgoraCart Pro</a>. Maintained by <a href="http://www.K-Factor.net" class="copyright_link">Mister Ed</a> at <a href="http://www.AgoraCart.com" class="copyright_link">AgoraCart.com</a></center>
+	Powered by <a href="http://www.AgoraCart.com/proforum.htm" class="copyright_link">AgoraCart Gold</a>. Maintained by <a href="http://www.K-Factor.net" class="copyright_link">Mister Ed</a> at <a href="http://www.AgoraCart.com" class="copyright_link">AgoraCart.com</a></center>
  	</td>
   </tr>
 </table>
diff -x .svn -aruN 5.2.004.src/html/options/per_product_discount.html 5.2.005.src/html/options/per_product_discount.html
--- 5.2.004.src/html/options/per_product_discount.html	1969-12-31 18:00:00.000000000 -0600
+++ 5.2.005.src/html/options/per_product_discount.html	2008-06-28 15:53:51.000000000 -0500
@@ -0,0 +1,55 @@
+<HTML>
+<TITLE>Variable Option - Coupon Code Disc.</TITLE><BODY>
+<PRE>
+Example of a 'variable option' that depends on the coupon code entered
+associated 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 modifier style variable options then it will match up with
+all of them when added to the cart.
+
+</PRE>
+<h3>--cut here--</h3>
+<!--agorascript-add-to-cart-opt-099 {
+# enable variable option code unconditionally
+# first thing is this option file name, next is the agorascript to run
+$item_user1 .= "per_product_discount.html,variable-option-099;";}
+-->
+<table cellspacing="0" cellpadding="1" class="opt_border">
+<tr><th class="opt_border">Enter PromoCode<br />to receive Sale Price!</th>
+</tr></table>
+
+<input  type="text" size="6" name="option|099|%%PRODUCT_ID%%"  maxlength="6" />
+
+<h3>--cut here--</h3>
+
+<!--agorascript-variable-option-099 {
+local ($qty) = $cart_row[$cart{'quantity'}];
+local ($price) = $cart_row[$cart{'price'}];
+local ($myopt) = '';undef($cart_row_options{'099'});
+if ($var_opt_action eq 'reset') {
+  $myopt = ''; #original: $myopt = 'Var099';
+ } 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 = 1; # original: $qty = 0;
+local ($xqty,$xpid,$junk);
+foreach $inx (keys(%cart_copy)) {
+  ($xqty,$xpid,$junk) = split(/\|/,$cart_copy{$inx},3);
+  if ($xpid eq $cart_row[$cart{'product_id'}]) {$qty = $qty + $xqty;}
+ }
+
+# replace DISCOUNTCODE with your code, and ajust the discount
+   if ($myopt='DISCOUNTCODE') {$myopt = '50% off each|' . ((-0.50)*$price);}
+   elsif ($myopt ne 'DISCOUNTCODE2')  {$myopt = '25% off each|' . ((-0.25)*$price);}
+   else  {$myopt = '0% off each|' . ((-0.00)*$price);}
+
+}
+if ($myopt ne '') {$cart_row_options{'099'} = $myopt;}
+} -->
+
+</body>
+</html> 
\ No newline at end of file
diff -x .svn -aruN 5.2.004.src/library/2checkout-order_lib.pl 5.2.005.src/library/2checkout-order_lib.pl
--- 5.2.004.src/library/2checkout-order_lib.pl	2008-06-26 07:48:44.000000000 -0500
+++ 5.2.005.src/library/2checkout-order_lib.pl	2008-08-30 20:13:29.000000000 -0500
@@ -2,7 +2,7 @@
 #                    Order Form Definition Variables                  #
 #######################################################################
 
-$versions{'2checkout-order_lib.pl'} = "5.0.002";
+$versions{'2checkout-order_lib.pl'} = "5.5.000";
 $sc_use_secure_header_at_checkout = 'yes';
 $sc_use_secure_footer_for_order_form = 'yes';
 
@@ -138,10 +138,13 @@
 </div>
 ENDOFTEXT
 
+# use this to change $rslt
+&codehook("checkout2_verification_table_bottom");
+
   return $rslt;
  }
 ###############################################################################
-sub anet_table_setup{
+sub checkout2_table_setup{
 #
 # To use this, put this in the x_Header_Html in the manager:
 #
@@ -199,6 +202,10 @@
  if ($result ne '') {
    $result .= "</TABLE></TD></TR></TABLE>\n";
   }
+
+# use this to change $result
+&codehook("2checkout_table_setup_bottom");
+
  $checkout2_cart_table = $result;
 }
 
@@ -231,7 +238,7 @@
 $customer_number = $cart_id;
 $customer_number =~ s/_/./g;
 
-&anet_table_setup;
+&checkout2_table_setup;
 $xx_Header_Html_Payment_Form =
   &script_and_substitute($x_Header_Html_Payment_Form,"checkout2");
 $xx_Footer_Html_Payment_Form =
@@ -252,6 +259,11 @@
 
 &codehook("checkout-SubmitPage-print");
 
+if ($sc_use_alternate_2checkout_submit_page ne "Yes") {
+############  Start of Standard submit page - Select from this line to for copy functions ############
+#### can use in custom submit page.  Custom file must be named: 2checkout_custom_processing_lib.pl
+#### Custom function (aka sub routine) to replace the code below must be named: 2checkout_custom_submit_page
+
 print <<ENDOFTEXT;
 <div align="center">
 <table width="500" cellpadding="5" cellspacing="0" border="0">
@@ -306,6 +318,14 @@
 </div>
 ENDOFTEXT
 
+############  End of Submit Page Code - Select until this line for copy functions ############
+}
+else { # uses alternate processing file in add_ons sub directory
+
+&codehook("2checkout_custom_submit_page");
+
+} # end of alternate submit page
+
 }
 ############################################################################################
 
@@ -396,6 +416,12 @@
 <BODY $sc_standard_body_info>
 !;
 
+if ($sc_use_alternate_2checkout_order_processing ne "Yes") {
+############  Start of Standard Processing Code - Select from this line to for copy functions ############
+#### can use in custom processing file.  Custom file must be named: 2checkout_custom_processing_lib.pl
+#### Place 2checkout_custom_processing_lib.pl in the library directory of your store
+#### Custom function (aka sub routine)  to replace the code below must be named: 2checkout_custom_processing_function
+
 &SecureStoreHeader; # Don't Use standard header
 
 if ($form_data{'x_response_code'} > 1) { # there is a problem ...
@@ -485,6 +511,43 @@
 $orderLoggingHash{'shippingMessages'} = "";
 $orderLoggingHash{'xcomments'} = "";
 $orderLoggingHash{'termsOfService'} = "$vform_Ecom_tos";
+$orderLoggingHash{'faxNumber'} = "";
+
+# new logging items added August 4, 2007 by Mister Ed
+$orderLoggingHash{'discountCode'} = "";
+$orderLoggingHash{'user6'} = "";
+$orderLoggingHash{'user7'} = "";
+$orderLoggingHash{'user8'} = "";
+$orderLoggingHash{'user9'} = "";
+$orderLoggingHash{'user10'} = "";
+$orderLoggingHash{'buySafe'} = "";
+$orderLoggingHash{'order_payment_type_user1'} = "";
+$orderLoggingHash{'order_payment_type_user2'} = "";
+$orderLoggingHash{'GiftCard_number'} = "";
+$orderLoggingHash{'GiftCard_amount_used'} = "";
+$orderLoggingHash{'internal_company_notes1'} = "";
+$orderLoggingHash{'internal_company_notes2'} = "";
+$orderLoggingHash{'internal_company_notes2'} = "";
+$orderLoggingHash{'customer_order_notes1'} = "";
+$orderLoggingHash{'customer_order_notes2'} = "";
+$orderLoggingHash{'customer_order_notes3'} = "";
+$orderLoggingHash{'customer_order_notes4'} = "";
+$orderLoggingHash{'customer_order_notes5'} = "";
+$orderLoggingHash{'mailinglist_subscribe'} = "";
+$orderLoggingHash{'wishlist_subscribe'} = "";
+$orderLoggingHash{'insurance_cost'} = "";
+$orderLoggingHash{'trade_in_allowance'} = "";
+$orderLoggingHash{'rma_number'} = "";
+$orderLoggingHash{'customer_contact_notes1'} = "";
+$orderLoggingHash{'customer_contact_notes2'} = "";
+$orderLoggingHash{'account_number'} = "";
+$orderLoggingHash{'sales_rep'} = "";
+$orderLoggingHash{'sales_rep_notes1'} = "";
+$orderLoggingHash{'sales_rep_notes2'} = "";
+$orderLoggingHash{'how_did_you_find_us'} = "";
+$orderLoggingHash{'suggestion_box'} = "";
+$orderLoggingHash{'preferrred_shipping_date'} = "";
+$orderLoggingHash{'ship_order_items_as_available'} = "";
 
 print $mytext;
 
@@ -722,14 +785,14 @@
    $text_of_cart = "\n" . $text_of_cart . "\n";
 }
 
-# added by Mister Ed Feb 7, 2007
+# added by Mister Ed for Pro version Feb 7, 2007
 my $temp_admin_email = "$sc_admin_email";
 if ($sc_use_customer_email_over_admin =~ /yes/i) {
    $temp_admin_email = "form_data{'x_Email'}";
 }
 
 if ($sc_send_order_to_email =~ /yes/i) {
-   &send_mail($sc_admin_email, $sc_order_email, $x_Description, $text_of_cart);
+   &send_mail($temp_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'});
@@ -778,6 +841,14 @@
 </HTML>
 !;
 
+############  End of Standard Processing Code - Select until this line for copy functions ############
+}
+else { # uses alternate processing file in add_ons sub directory
+
+ &codehook("2checkout_custom_processing_function");
+
+} # end of alternate processing
+
 } # End of process_order_form
 
 #################################################################
diff -x .svn -aruN 5.2.004.src/library/AgoraPay-order_lib.pl 5.2.005.src/library/AgoraPay-order_lib.pl
--- 5.2.004.src/library/AgoraPay-order_lib.pl	2008-06-26 07:48:44.000000000 -0500
+++ 5.2.005.src/library/AgoraPay-order_lib.pl	2008-08-30 20:13:31.000000000 -0500
@@ -2,7 +2,7 @@
 #                    Order Form Definition Variables                  #
 #######################################################################
 
-$versions{'AgoraPay-order_lib.pl'} = "5.2.001";
+$versions{'AgoraPay-order_lib.pl'} = "5.5.002";
 $sc_use_secure_header_at_checkout = 'yes';
 $sc_use_secure_footer_for_order_form = 'yes';
 
@@ -150,6 +150,10 @@
  if ($result ne '') {
    $result .= "</TABLE></TD></TR></TABLE>\n";
   }
+
+# use this to change $result
+&codehook("AgoraPay_table_setup_bottom");
+
  $AgoraPay_cart_table = $result;
 }
 
@@ -188,6 +192,10 @@
   $test_mode = "<INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"test_mode\">";
  }
 
+if ($sc_use_alternate_AgoraPay_submit_page ne "Yes") {
+############  Start of Standard submit page - Select from this line to for copy functions ############
+#### can use in custom submit page.  Custom file must be named: AgoraPay_custom_processing_lib.pl
+#### Custom function (aka sub routine) to replace the code below must be named: AgoraPay_custom_submit_page
 
 if ($AgoraPay_enablebodytags eq "1"){
 $tempbodytags = qq~<input type="hidden" name="bodytags" value="$AgoraPay_enablebodytags">
@@ -208,7 +216,7 @@
 }
 
 print <<ENDOFTEXT;
-
+</form></form>
 <FORM METHOD=POST ACTION=\"$sc_order_script_url\" AUTOCOMPLETE = 'off'>
 
 <INPUT TYPE=\"HIDDEN\" NAME=\"vendor_id\" VALUE=\"$sc_gateway_username\">
@@ -340,6 +348,14 @@
 </CENTER>
 ENDOFTEXT
 
+############  End of Submit Page Code - Select until this line for copy functions ############
+}
+else { # uses alternate processing file in add_ons sub directory
+
+&codehook("AgoraPay_custom_submit_page");
+
+} # end of alternate submit page
+
 }
 ############################################################################################
 sub process_AgoraPay_Order {
@@ -447,6 +463,13 @@
 <body>
 !;
 
+if ($sc_use_alternate_AgoraPay_order_processing ne "Yes") {
+############  Start of Standard Processing Code - Select from this line to for copy functions ############
+#### can use in custom processing file.  Custom file must be named: AgoraPay_custom_processing_lib.pl
+#### Place AgoraPay_custom_processing_lib.pl in the library directory of your store
+#### Custom function (aka sub routine)  to replace the code below must be named: AgoraPay_custom_processing_function
+
+
 &SecureStoreHeader;
 
 $text_of_cart .= "Order Date:    $orderDate\n";
@@ -530,6 +553,43 @@
 $orderLoggingHash{'shippingMessages'} = "";
 $orderLoggingHash{'xcomments'} = "";
 $orderLoggingHash{'termsOfService'} = "$vform_Ecom_tos";
+$orderLoggingHash{'faxNumber'} = "";
+
+# new logging items added August 4, 2007 by Mister Ed
+$orderLoggingHash{'discountCode'} = "";
+$orderLoggingHash{'user6'} = "";
+$orderLoggingHash{'user7'} = "";
+$orderLoggingHash{'user8'} = "";
+$orderLoggingHash{'user9'} = "";
+$orderLoggingHash{'user10'} = "";
+$orderLoggingHash{'buySafe'} = "";
+$orderLoggingHash{'order_payment_type_user1'} = "";
+$orderLoggingHash{'order_payment_type_user2'} = "";
+$orderLoggingHash{'GiftCard_number'} = "";
+$orderLoggingHash{'GiftCard_amount_used'} = "";
+$orderLoggingHash{'internal_company_notes1'} = "";
+$orderLoggingHash{'internal_company_notes2'} = "";
+$orderLoggingHash{'internal_company_notes2'} = "";
+$orderLoggingHash{'customer_order_notes1'} = "";
+$orderLoggingHash{'customer_order_notes2'} = "";
+$orderLoggingHash{'customer_order_notes3'} = "";
+$orderLoggingHash{'customer_order_notes4'} = "";
+$orderLoggingHash{'customer_order_notes5'} = "";
+$orderLoggingHash{'mailinglist_subscribe'} = "";
+$orderLoggingHash{'wishlist_subscribe'} = "";
+$orderLoggingHash{'insurance_cost'} = "";
+$orderLoggingHash{'trade_in_allowance'} = "";
+$orderLoggingHash{'rma_number'} = "";
+$orderLoggingHash{'customer_contact_notes1'} = "";
+$orderLoggingHash{'customer_contact_notes2'} = "";
+$orderLoggingHash{'account_number'} = "";
+$orderLoggingHash{'sales_rep'} = "";
+$orderLoggingHash{'sales_rep_notes1'} = "";
+$orderLoggingHash{'sales_rep_notes2'} = "";
+$orderLoggingHash{'how_did_you_find_us'} = "";
+$orderLoggingHash{'suggestion_box'} = "";
+$orderLoggingHash{'preferrred_shipping_date'} = "";
+$orderLoggingHash{'ship_order_items_as_available'} = "";
 
 $sc_orderlib_use_SBW_for_ship_ins = $sc_use_SBW;
 &codehook("orderlib-ship-instructions");
@@ -749,7 +809,7 @@
 
 $sc_agorapay_order_desc .= " - " . $itrans{'p5'};
 
-# added by Mister Ed Feb 7, 2007
+# added by Mister Ed for Pro version Feb 7, 2007
 my $temp_admin_email = "$itrans{'email'}";
 if ($sc_use_customer_email_over_admin =~ /yes/i) {
    $temp_admin_email = "$eform_Ecom_BillTo_Online_Email";
@@ -805,6 +865,14 @@
 </HTML>
 !;
 
+############  End of Standard Processing Code - Select until this line for copy functions ############
+}
+else { # uses alternate processing file in add_ons sub directory
+
+ &codehook("AgoraPay_custom_processing_function");
+
+} # end of alternate processing
+
 } # End of process_order_form
 
 #################################################################
diff -x .svn -aruN 5.2.004.src/library/AuthorizeNet-order_lib.pl 5.2.005.src/library/AuthorizeNet-order_lib.pl
--- 5.2.004.src/library/AuthorizeNet-order_lib.pl	2008-06-26 07:48:44.000000000 -0500
+++ 5.2.005.src/library/AuthorizeNet-order_lib.pl	2008-08-30 20:32:46.000000000 -0500
@@ -2,7 +2,7 @@
 #                    Order Form Definition Variables                  #
 #######################################################################
 
-$versions{'AuthorizeNet-order_lib.pl'} = "5.2.001";
+$versions{'AuthorizeNet-order_lib.pl'} = "5.5.003";
 
 $sc_use_secure_header_at_checkout = 'yes';
 $sc_use_secure_footer_for_order_form = 'yes';
@@ -152,6 +152,9 @@
 </div>
 ENDOFTEXT
 
+# use this to change $rslt
+&codehook("AuthorizeNet_verification_table_bottom");
+
   return $rslt;
  }
 ###############################################################################
@@ -213,6 +216,10 @@
  if ($result ne '') {
    $result .= "</TABLE></TD></TR></TABLE>\n";
   }
+
+# use this to change $result
+&codehook("anet_table_setup_bottom");
+
  $anet_cart_table = $result;
 }
 
@@ -221,7 +228,7 @@
 
 {
 local($invoice_number, $customer_number);
-local($test_mode,$mytable);
+local($test_mode,$authnet_sale_mode,$mytable);
 local($myname)="AuthorizeNet";
 
 if (!($form_data{'gateway'} eq $myname)) { return;} 
@@ -277,9 +284,13 @@
 $xx_Footer_Email_Receipt =
   &script_and_substitute($x_footer_email_receipt,"Anet");
 
-
 &codehook("AuthorizeNet-SubmitPage-print");
 
+if ($sc_use_alternate_NiftyPay_submit_page ne "Yes") {
+############  Start of Standard submit page - Select from this line to for copy functions ############
+#### can use in custom submit page.  Custom file must be named: NiftyPay_custom_processing_lib.pl
+#### Custom function (aka sub routine) to replace the code below must be named: NiftyPay_custom_submit_page
+
 print <<ENDOFTEXT;
 <div align="center">
 <table width="500" cellpadding="5" cellspacing="0" border="0">
@@ -328,7 +339,7 @@
 
 
 $mytable
-<p class="ac_checkout_top_msg">$messages{'ordcnf_06'}</p>
+<p class="ac_checkout_top_msg">$sc_auth_verify_message</p>
 
 <br>
 <input type="submit" value="Secure Orderform">
@@ -340,6 +351,14 @@
 </div>
 ENDOFTEXT
 
+############  End of Submit Page Code - Select until this line for copy functions ############
+}
+else { # uses alternate processing file in add_ons sub directory
+
+&codehook("AuthorizeNet_custom_submit_page");
+
+} # end of alternate submit page
+
 }
 ############################################################################################
 
@@ -432,6 +451,12 @@
 <BODY $sc_standard_body_info>
 !;
 
+if ($sc_use_alternate_NiftyPay_order_processing ne "Yes") {
+############  Start of Standard Processing Code - Select from this line to for copy functions ############
+#### can use in custom processing file.  Custom file must be named: NiftyPay_custom_processing_lib.pl
+#### Place NiftyPay_custom_processing_lib.pl in the library directory of your store
+#### Custom function (aka sub routine)  to replace the code below must be named: NiftyPay_custom_processing_function
+
 &SecureStoreHeader; # Don't Use standard header
 
 if ($form_data{'x_response_code'} > 1) { # there is a problem ...
@@ -446,6 +471,7 @@
 <FONT FACE=ARIAL>
 <P>&nbsp;</P>
 $messages{'ordcnf_05'}<br>
+$form_data{'x_response_reason_code'} <br>
 $form_data{'x_response_reason_text'} <br>
 <P>&nbsp;</P>
 $messages{'ordcnf_02'}<br>
@@ -523,6 +549,43 @@
 $orderLoggingHash{'shippingMessages'} = "";
 $orderLoggingHash{'xcomments'} = "";
 $orderLoggingHash{'termsOfService'} = "$vform_Ecom_tos";
+$orderLoggingHash{'faxNumber'} = "";
+
+# new logging items added August 4, 2007 by Mister Ed
+$orderLoggingHash{'discountCode'} = "";
+$orderLoggingHash{'user6'} = "";
+$orderLoggingHash{'user7'} = "";
+$orderLoggingHash{'user8'} = "";
+$orderLoggingHash{'user9'} = "";
+$orderLoggingHash{'user10'} = "";
+$orderLoggingHash{'buySafe'} = "";
+$orderLoggingHash{'order_payment_type_user1'} = "";
+$orderLoggingHash{'order_payment_type_user2'} = "";
+$orderLoggingHash{'GiftCard_number'} = "";
+$orderLoggingHash{'GiftCard_amount_used'} = "";
+$orderLoggingHash{'internal_company_notes1'} = "";
+$orderLoggingHash{'internal_company_notes2'} = "";
+$orderLoggingHash{'internal_company_notes2'} = "";
+$orderLoggingHash{'customer_order_notes1'} = "";
+$orderLoggingHash{'customer_order_notes2'} = "";
+$orderLoggingHash{'customer_order_notes3'} = "";
+$orderLoggingHash{'customer_order_notes4'} = "";
+$orderLoggingHash{'customer_order_notes5'} = "";
+$orderLoggingHash{'mailinglist_subscribe'} = "";
+$orderLoggingHash{'wishlist_subscribe'} = "";
+$orderLoggingHash{'insurance_cost'} = "";
+$orderLoggingHash{'trade_in_allowance'} = "";
+$orderLoggingHash{'rma_number'} = "";
+$orderLoggingHash{'customer_contact_notes1'} = "";
+$orderLoggingHash{'customer_contact_notes2'} = "";
+$orderLoggingHash{'account_number'} = "";
+$orderLoggingHash{'sales_rep'} = "";
+$orderLoggingHash{'sales_rep_notes1'} = "";
+$orderLoggingHash{'sales_rep_notes2'} = "";
+$orderLoggingHash{'how_did_you_find_us'} = "";
+$orderLoggingHash{'suggestion_box'} = "";
+$orderLoggingHash{'preferrred_shipping_date'} = "";
+$orderLoggingHash{'ship_order_items_as_available'} = "";
 
 print $mytext;
 
@@ -590,14 +653,13 @@
 $orderLoggingHash{'buySafe'} = "$temp";
 }
 
-  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);
-         if (($sc_use_SBW =~ /yes/i) || ($form_data{'x_Freight'} > .009)) {
+  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);
+          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'}) {
@@ -790,21 +852,20 @@
    $text_of_cart = "\n" . $text_of_cart . "\n";
 }
 
-# added by Mister Ed Feb 7, 2007
+# added by Mister Ed for Pro version Feb 7, 2007
 my $temp_admin_email = "$sc_admin_email";
 if ($sc_use_customer_email_over_admin =~ /yes/i) {
    $temp_admin_email = "form_data{'x_email'}";
 }
 
 if ($sc_send_order_to_email =~ /yes/i) {
-   &send_mail($sc_admin_email, $sc_order_email, "$x_description - $form_data{'x_invoice_num'}", $text_of_cart);
+   &send_mail($temp_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'});
 
 if (($cartData) && ($form_data{'x_email'} ne "")) {
-   &send_mail($sc_admin_email, $form_data{'x_email'}, $messages{'ordcnf_08'},
-           "$text_of_confirm_email");
+   &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'};
@@ -847,6 +908,14 @@
 </HTML>
 !;
 
+############  End of Standard Processing Code - Select until this line for copy functions ############
+}
+else { # uses alternate processing file in add_ons sub directory
+
+ &codehook("AuthorizeNet_custom_processing_function");
+
+} # end of alternate processing
+
 } # End of process_order_form
 
 #################################################################
diff -x .svn -aruN 5.2.004.src/library/LinkpointConnect-order_lib.pl 5.2.005.src/library/LinkpointConnect-order_lib.pl
--- 5.2.004.src/library/LinkpointConnect-order_lib.pl	2008-06-26 07:48:44.000000000 -0500
+++ 5.2.005.src/library/LinkpointConnect-order_lib.pl	2008-08-30 20:13:33.000000000 -0500
@@ -1,7 +1,7 @@
 ##############################################################################
 #                       Order Form Definition Variables                      #
 ##############################################################################
-$versions{'LinkpointConnect-order_lib.pl'} = "5.0.002";
+$versions{'LinkpointConnect-order_lib.pl'} = "5.5.000";
 $sc_use_secure_header_at_checkout = 'yes';
 $sc_use_secure_footer_for_order_form = 'yes';
 $sc_LinkpointConnect_form_prep = 0;
@@ -134,6 +134,10 @@
 	$form_data{'Ecom_ShipTo_Postal_CountryCode'} . "&nbsp;</td>\n";
   $rslt.= "</tr>\n";
   $rslt.= "</table>\n";
+
+# use this to change $rslt
+&codehook("LinkpointConnect_verification_table_bottom");
+
   return $rslt;
  }
 ###############################################################################
@@ -171,6 +175,11 @@
 
 my $temp_total_thingy = ($zsubtotal - $zfinal_discount);
 
+if ($sc_use_alternate_LinkpointConnect_submit_page ne "Yes") {
+############  Start of Standard submit page - Select from this line to for copy functions ############
+#### can use in custom submit page.  Custom file must be named: LinkpointConnect_custom_processing_lib.pl
+#### Custom function (aka sub routine) to replace the code below must be named: LinkpointConnect_custom_submit_page
+
 print <<ENDOFTEXT;
 <FORM METHOD=POST ACTION="$sc_order_script_url">
 <INPUT TYPE=HIDDEN NAME='mode' value="payplus">
@@ -258,6 +267,14 @@
 
 ENDOFTEXT
 
+############  End of Submit Page Code - Select until this line for copy functions ############
+}
+else { # uses alternate processing file in add_ons sub directory
+
+&codehook("LinkpointConnect_custom_submit_page");
+
+} # end of alternate submit page
+
 }
 ###############################################################################
 
@@ -280,7 +297,7 @@
 &codehook("process-order-routine-top");
 
 print qq!
-<Connect>
+<html>
 $sc_special_page_meta_tags
 <HEAD>
 <TITLE>$messages{'ordcnf_08'}</TITLE>
@@ -289,6 +306,12 @@
 <BODY $sc_standard_body_info>
 !;
 
+if ($sc_use_alternate_LinkpointConnect_order_processing ne "Yes") {
+############  Start of Standard Processing Code - Select from this line to for copy functions ############
+#### can use in custom processing file.  Custom file must be named: LinkpointConnect_custom_processing_lib.pl
+#### Place LinkpointConnect_custom_processing_lib.pl in the library directory of your store
+#### Custom function (aka sub routine)  to replace the code below must be named: LinkpointConnect_custom_processing_function
+
 &SecureStoreHeader;
 
 $text_of_cart .= "Order Date:    $orderDate\n";
@@ -370,7 +393,44 @@
 $orderLoggingHash{'adminMessages'} = "";
 $orderLoggingHash{'shippingMessages'} = "";
 $orderLoggingHash{'xcomments'} = "";
-$orderLoggingHash{'termsOfService'} = "$vform_Ecom_tos";
+$orderLoggingHash{'termsOfService'} = "$eform_Ecom_tos";
+$orderLoggingHash{'faxNumber'} = "";
+
+# new logging items added August 4, 2007 by Mister Ed
+$orderLoggingHash{'discountCode'} = "";
+$orderLoggingHash{'user6'} = "";
+$orderLoggingHash{'user7'} = "";
+$orderLoggingHash{'user8'} = "";
+$orderLoggingHash{'user9'} = "";
+$orderLoggingHash{'user10'} = "";
+$orderLoggingHash{'buySafe'} = "";
+$orderLoggingHash{'order_payment_type_user1'} = "";
+$orderLoggingHash{'order_payment_type_user2'} = "";
+$orderLoggingHash{'GiftCard_number'} = "";
+$orderLoggingHash{'GiftCard_amount_used'} = "";
+$orderLoggingHash{'internal_company_notes1'} = "";
+$orderLoggingHash{'internal_company_notes2'} = "";
+$orderLoggingHash{'internal_company_notes2'} = "";
+$orderLoggingHash{'customer_order_notes1'} = "";
+$orderLoggingHash{'customer_order_notes2'} = "";
+$orderLoggingHash{'customer_order_notes3'} = "";
+$orderLoggingHash{'customer_order_notes4'} = "";
+$orderLoggingHash{'customer_order_notes5'} = "";
+$orderLoggingHash{'mailinglist_subscribe'} = "";
+$orderLoggingHash{'wishlist_subscribe'} = "";
+$orderLoggingHash{'insurance_cost'} = "";
+$orderLoggingHash{'trade_in_allowance'} = "";
+$orderLoggingHash{'rma_number'} = "";
+$orderLoggingHash{'customer_contact_notes1'} = "";
+$orderLoggingHash{'customer_contact_notes2'} = "";
+$orderLoggingHash{'account_number'} = "";
+$orderLoggingHash{'sales_rep'} = "";
+$orderLoggingHash{'sales_rep_notes1'} = "";
+$orderLoggingHash{'sales_rep_notes2'} = "";
+$orderLoggingHash{'how_did_you_find_us'} = "";
+$orderLoggingHash{'suggestion_box'} = "";
+$orderLoggingHash{'preferrred_shipping_date'} = "";
+$orderLoggingHash{'ship_order_items_as_available'} = "";
 
 
 
@@ -407,13 +467,6 @@
 &add_text_of_both("SUBTOTAL",$sc_verify_subtotal);
 $sc_verify_subtotal3 = $sc_verify_subtotal;
 
-if (($sc_buySafe_is_enabled =~ /yes/) && ($sc_verify_buySafe > 0)) {
-my $temp = &format_price($sc_verify_buySafe);
-$text_of_cart .= "$sc_buySafe_bond_fee_mini_display_text       $temp\n";
-$text_of_confirm_email .= "$sc_verify_buySafe_display_text       $temp\n";
-$orderLoggingHash{'buySafe'} = "$temp";
-}
-
 if ($sc_verify_discount) {
   $temp = &format_price($sc_verify_discount);
   &add_text_of_both("DISCOUNT",$temp);
@@ -424,6 +477,13 @@
   # end of adjustments for discount addon
 }
 
+if (($sc_buySafe_is_enabled =~ /yes/) && ($sc_verify_buySafe > 0)) {
+my $temp = &format_price($sc_verify_buySafe);
+$text_of_cart .= "$sc_buySafe_bond_fee_mini_display_text       $temp\n";
+$text_of_confirm_email .= "$sc_verify_buySafe_display_text       $temp\n";
+$orderLoggingHash{'buySafe'} = "$temp";
+}
+
 if ($sc_verify_shipping){
   &add_text_of_both("SHIPPING",$sc_verify_shipping);
 $orderLoggingHash{'shippingTotal'} = &format_price($sc_verify_shipping);
@@ -611,7 +671,7 @@
 $text_of_cart = "\n" . $text_of_cart . "\n";
 }
 
-# added by Mister Ed Feb 7, 2007
+# added by Mister Ed for Pro version Feb 7, 2007
 my $temp_admin_email = "$sc_admin_email";
 if ($sc_use_customer_email_over_admin =~ /yes/i) {
    $temp_admin_email = "$form_data{'email'}";
@@ -672,6 +732,14 @@
 </Connect>
 !;
 
+############  End of Standard Processing Code - Select until this line for copy functions ############
+}
+else { # uses alternate processing file in add_ons sub directory
+
+ &codehook("LinkpointConnect_custom_processing_function");
+
+} # end of alternate processing
+
 } # End of process_LinkpointConnect_order
 
 #################################################################
diff -x .svn -aruN 5.2.004.src/library/NiftyPay-order_lib.pl 5.2.005.src/library/NiftyPay-order_lib.pl
--- 5.2.004.src/library/NiftyPay-order_lib.pl	2008-06-26 07:48:44.000000000 -0500
+++ 5.2.005.src/library/NiftyPay-order_lib.pl	2008-08-30 20:13:33.000000000 -0500
@@ -2,7 +2,7 @@
 #                    Order Form Definition Variables                  #
 #######################################################################
 
-$versions{'NiftyPay-order_lib.pl'} = "5.2.001";
+$versions{'NiftyPay-order_lib.pl'} = "5.5.003";
 $sc_use_secure_header_at_checkout = 'yes';
 $sc_use_secure_footer_for_order_form = 'yes';
 
@@ -150,9 +150,13 @@
  if ($result ne '') {
    $result .= "</TABLE></TD></TR></TABLE>\n";
   }
+
+# use this to change $result
+&codehook("NiftyPay_table_setup_bottom");
+
  $NiftyPay_cart_table = $result;
-}
 
+}
 ###############################################################################
 
 sub print_NiftyPay_SubmitPage
@@ -188,6 +192,10 @@
   $test_mode = "<INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"test_mode\">";
  }
 
+if ($sc_use_alternate_NiftyPay_submit_page ne "Yes") {
+############  Start of Standard submit page - Select from this line to for copy functions ############
+#### can use in custom submit page.  Custom file must be named: NiftyPay_custom_processing_lib.pl
+#### Custom function (aka sub routine) to replace the code below must be named: NiftyPay_custom_submit_page
 
 if ($NiftyPay_enablebodytags eq "1"){
 $tempbodytags = qq~<input type="hidden" name="bodytags" value="$NiftyPay_enablebodytags">
@@ -344,6 +352,14 @@
 </CENTER>
 ENDOFTEXT
 
+############  End of Submit Page Code - Select until this line for copy functions ############
+}
+else { # uses alternate processing file in add_ons sub directory
+
+ &codehook("NiftyPay_custom_submit_page");
+
+} # end of alternate submit page
+
 }
 ############################################################################################
 sub process_NiftyPay_Order {
@@ -451,6 +467,12 @@
 <body>
 !;
 
+if ($sc_use_alternate_NiftyPay_order_processing ne "Yes") {
+############  Start of Standard Processing Code - Select from this line to for copy functions ############
+#### can use in custom processing file.  Custom file must be named: NiftyPay_custom_processing_lib.pl
+#### Place NiftyPay_custom_processing_lib.pl in the library directory of your store
+#### Custom function (aka sub routine)  to replace the code below must be named: NiftyPay_custom_processing_function
+
 &SecureStoreHeader;
 
 $text_of_cart .= "Order Date:    $orderDate\n";
@@ -534,6 +556,43 @@
 $orderLoggingHash{'shippingMessages'} = "";
 $orderLoggingHash{'xcomments'} = "";
 $orderLoggingHash{'termsOfService'} = "$vform_Ecom_tos";
+$orderLoggingHash{'faxNumber'} = "";
+
+# new logging items added August 4, 2007 by Mister Ed
+$orderLoggingHash{'discountCode'} = "";
+$orderLoggingHash{'user6'} = "";
+$orderLoggingHash{'user7'} = "";
+$orderLoggingHash{'user8'} = "";
+$orderLoggingHash{'user9'} = "";
+$orderLoggingHash{'user10'} = "";
+$orderLoggingHash{'buySafe'} = "";
+$orderLoggingHash{'order_payment_type_user1'} = "";
+$orderLoggingHash{'order_payment_type_user2'} = "";
+$orderLoggingHash{'GiftCard_number'} = "";
+$orderLoggingHash{'GiftCard_amount_used'} = "";
+$orderLoggingHash{'internal_company_notes1'} = "";
+$orderLoggingHash{'internal_company_notes2'} = "";
+$orderLoggingHash{'internal_company_notes2'} = "";
+$orderLoggingHash{'customer_order_notes1'} = "";
+$orderLoggingHash{'customer_order_notes2'} = "";
+$orderLoggingHash{'customer_order_notes3'} = "";
+$orderLoggingHash{'customer_order_notes4'} = "";
+$orderLoggingHash{'customer_order_notes5'} = "";
+$orderLoggingHash{'mailinglist_subscribe'} = "";
+$orderLoggingHash{'wishlist_subscribe'} = "";
+$orderLoggingHash{'insurance_cost'} = "";
+$orderLoggingHash{'trade_in_allowance'} = "";
+$orderLoggingHash{'rma_number'} = "";
+$orderLoggingHash{'customer_contact_notes1'} = "";
+$orderLoggingHash{'customer_contact_notes2'} = "";
+$orderLoggingHash{'account_number'} = "";
+$orderLoggingHash{'sales_rep'} = "";
+$orderLoggingHash{'sales_rep_notes1'} = "";
+$orderLoggingHash{'sales_rep_notes2'} = "";
+$orderLoggingHash{'how_did_you_find_us'} = "";
+$orderLoggingHash{'suggestion_box'} = "";
+$orderLoggingHash{'preferrred_shipping_date'} = "";
+$orderLoggingHash{'ship_order_items_as_available'} = "";
 
 $sc_orderlib_use_SBW_for_ship_ins = $sc_use_SBW;
 &codehook("orderlib-ship-instructions");
@@ -567,7 +626,7 @@
 $orderLoggingHash{'shippingTotal'} = &format_price($sc_verify_shipping);
 }
 
-if (($sc_use_SBW =~ /yes/i) || ($form_data{'x_Freight'} > .009)) {
+if (($sc_use_SBW =~ /yes/i) || ($sc_verify_shipping > .009)) {
  $text_of_confirm_email .= "SHIP VIA:      $eform_Ecom_ShipTo_Method\n";
 }
 
@@ -752,7 +811,7 @@
 
 $sc_niftypay_order_desc .= " - " . $itrans{'p5'};
 
-# added by Mister Ed fFeb 7, 2007
+# added by Mister Ed for Pro version Feb 7, 2007
 my $temp_admin_email = "$itrans{'email'}";
 if ($sc_use_customer_email_over_admin =~ /yes/i) {
    $temp_admin_email = "$eform_Ecom_BillTo_Online_Email";
@@ -808,6 +867,14 @@
 </HTML>
 !;
 
+############  End of Standard Processing Code - Select until this line for copy functions ############
+}
+else { # uses alternate processing file in add_ons sub directory
+
+ &codehook("NiftyPay_custom_processing_function");
+
+} # end of alternate processing
+
 } # End of process_order_form
 
 #################################################################
diff -x .svn -aruN 5.2.004.src/library/Offline-order_lib.pl 5.2.005.src/library/Offline-order_lib.pl
--- 5.2.004.src/library/Offline-order_lib.pl	2008-06-26 07:48:44.000000000 -0500
+++ 5.2.005.src/library/Offline-order_lib.pl	2008-08-30 20:13:34.000000000 -0500
@@ -2,7 +2,7 @@
 #                    Order Form Definition Variables                  #
 #######################################################################
 
-$versions{'Offline-order_lib.pl'} = "5.0.002";
+$versions{'Offline-order_lib.pl'} = "5.5.000";
 
 $order_lib_cc_validate = "yes";
 $sc_use_secure_header_at_checkout = 'yes';
@@ -152,6 +152,10 @@
      } 
    } 
  }
+
+# use this codehook to check for more variables / default values or to reset others above
+&codehook("Offline_response_prep_bottom");
+
 }
 ###############################################################################
 sub Offline_order_form_prep {
@@ -268,6 +272,11 @@
   $customer_number,$offline_ver_tbldef,$top_message,
   $offline_ver_tbldef2,$authPrice,$time);
 
+if ($sc_use_alternate_Offline_submit_page ne "Yes") {
+############  Start of Standard submit page - Select from this line to for copy functions ############
+#### can use in custom submit page.  Custom file must be named: Offline_custom_processing_lib.pl
+#### Custom function (aka sub routine) to replace the code below must be named: Offline_custom_submit_page
+
 print <<ENDOFTEXT;
 <div align="center">
 <table width="500" cellpadding="5" cellspacing="0" border="0">
@@ -357,8 +366,15 @@
 </table>
 </div>
 ENDOFTEXT
+
+############  End of Submit Page Code - Select until this line for copy functions ############
 }
+else { # uses alternate processing file in add_ons sub directory
+
+ &codehook("Offline_custom_submit_page");
 
+} # end of alternate submit page
+}
 ###############################################################
 sub get_Offline_confirm_middle{
 local(*form_data,$invoice_number,$customer_number,
@@ -544,6 +560,9 @@
 </div>
 ENDOFTEXT
 
+# use this to change $answer
+&codehook("get_Offline_confirm_middle_bottom");
+
 return $answer;
 }
 ###############################################################
@@ -580,6 +599,13 @@
 <body>
 ~;
 
+
+if ($sc_use_alternate_Offline_order_processing ne "Yes") {
+############  Start of Standard Processing Code - Select from this line to for copy functions ############
+#### can use in custom processing file.  Custom file must be named: Offline_custom_processing_lib.pl
+#### Place Offline_custom_processing_lib.pl in the library directory of your store
+#### Custom function (aka sub routine)  to replace the code below must be named: Offline_custom_processing_function
+
 $text_of_cart .= "Order Date:    $orderDate\n";
 $text_of_cart .= "Gateway:       Offline\n\n";
 $orderLoggingHash{'GatewayUsed'} = "Offline";
@@ -762,7 +788,44 @@
 $orderLoggingHash{'adminMessages'} = "";
 $orderLoggingHash{'shippingMessages'} = "";
 $orderLoggingHash{'xcomments'} = "";
-$orderLoggingHash{'termsOfService'} = "";
+$orderLoggingHash{'termsOfService'} = "$vform_Ecom_tos";
+$orderLoggingHash{'faxNumber'} = "";
+
+# new logging items added August 4, 2007 by Mister Ed
+$orderLoggingHash{'discountCode'} = "";
+$orderLoggingHash{'user6'} = "";
+$orderLoggingHash{'user7'} = "";
+$orderLoggingHash{'user8'} = "";
+$orderLoggingHash{'user9'} = "";
+$orderLoggingHash{'user10'} = "";
+$orderLoggingHash{'buySafe'} = "";
+$orderLoggingHash{'order_payment_type_user1'} = "";
+$orderLoggingHash{'order_payment_type_user2'} = "";
+$orderLoggingHash{'GiftCard_number'} = "";
+$orderLoggingHash{'GiftCard_amount_used'} = "";
+$orderLoggingHash{'internal_company_notes1'} = "";
+$orderLoggingHash{'internal_company_notes2'} = "";
+$orderLoggingHash{'internal_company_notes2'} = "";
+$orderLoggingHash{'customer_order_notes1'} = "";
+$orderLoggingHash{'customer_order_notes2'} = "";
+$orderLoggingHash{'customer_order_notes3'} = "";
+$orderLoggingHash{'customer_order_notes4'} = "";
+$orderLoggingHash{'customer_order_notes5'} = "";
+$orderLoggingHash{'mailinglist_subscribe'} = "";
+$orderLoggingHash{'wishlist_subscribe'} = "";
+$orderLoggingHash{'insurance_cost'} = "";
+$orderLoggingHash{'trade_in_allowance'} = "";
+$orderLoggingHash{'rma_number'} = "";
+$orderLoggingHash{'customer_contact_notes1'} = "";
+$orderLoggingHash{'customer_contact_notes2'} = "";
+$orderLoggingHash{'account_number'} = "";
+$orderLoggingHash{'sales_rep'} = "";
+$orderLoggingHash{'sales_rep_notes1'} = "";
+$orderLoggingHash{'sales_rep_notes2'} = "";
+$orderLoggingHash{'how_did_you_find_us'} = "";
+$orderLoggingHash{'suggestion_box'} = "";
+$orderLoggingHash{'preferrred_shipping_date'} = "";
+$orderLoggingHash{'ship_order_items_as_available'} = "";
 
 $sc_orderlib_use_SBW_for_ship_ins = $sc_use_SBW;
 &codehook("orderlib-ship-instructions");
@@ -1132,7 +1195,13 @@
 </body>
 </html>
 !;
+############  End of Standard Processing Code - Select until this line for copy functions ############
+}
+else { # uses alternate processing file in add_ons sub directory
+
+ &codehook("Offline_custom_processing_function");
 
+} # end of alternate processing
 }  # End of process_order_form
 
 #################################################################
diff -x .svn -aruN 5.2.004.src/library/PayPal-order_lib.pl 5.2.005.src/library/PayPal-order_lib.pl
--- 5.2.004.src/library/PayPal-order_lib.pl	2008-06-26 07:48:44.000000000 -0500
+++ 5.2.005.src/library/PayPal-order_lib.pl	2008-08-30 20:13:34.000000000 -0500
@@ -37,7 +37,7 @@
 #                    Order Form Definition Variables                  #
 #######################################################################
 
-$versions{'PayPal-order_lib.pl'} = "5.2.001";
+$versions{'PayPal-order_lib.pl'} = "5.5.002 Pro Version";
 
 #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
@@ -72,7 +72,6 @@
            "&amount=" . &format_price($authPrice) .
            "&currency_code=$sc_currency_id" .
            "&no_shipping=1" .
-           "&bn=AgoraCart" .
            "&address_override=$sc_paypal_address_override" .
            "&first_name=$vform_Ecom_ShipTo_Postal_Name_First" .
            "&last_name=$vform_Ecom_ShipTo_Postal_Name_Last" .
@@ -81,10 +80,15 @@
            "&state=$vform_Ecom_ShipTo_Postal_StateProv" .
            "&zip=$vform_Ecom_ShipTo_Postal_PostalCode" .
            "&return=$return" .
+           "&bn=AgoraCart" .
            "%3Fppret%3D$cart_id";
     $url =~ s/\ /+/g;
     $url =~ s/\#/\%23/g;
   } 
+
+# use this to change $url
+&codehook("PayPal_URL_logic_bottom");
+
  return $url;
 
  }
@@ -253,6 +257,9 @@
 </div>
 ENDOFTEXT
 
+# use this to change $rslt
+&codehook("PayPal_verification_table_bottom");
+
   return $rslt;
  }
 ###############################################################################
@@ -309,6 +316,11 @@
  # to customize, set it in the Free Form Logic (either location.)
   $order_ok_final_msg_tbl = "<b>Order Confirmation</b><br/><br/>" . &get_date;
  }
+
+if ($sc_use_alternate_PayPal_submit_page ne "Yes") {
+############  Start of Standard submit page - Select from this line to for copy functions ############
+#### can use in custom submit page.  Custom file must be named: PayPal_custom_processing_lib.pl
+#### Custom function (aka sub routine) to replace the code below must be named: PayPal_custom_submit_page
  
 print <<ENDOFTEXT;
 
@@ -337,8 +349,17 @@
 
 ENDOFTEXT
 
+############  End of Submit Page Code - Select until this line for copy functions ############
+}
+else { # uses alternate processing file in add_ons sub directory
+
+ &codehook("PayPal_custom_submit_page");
+
+} # end of alternate submit page
+
 }
 ############################################################################################
+
 sub process_PayPal_Order {
 
 local ($mode)=@_;
@@ -367,6 +388,12 @@
   print "Location: $url\n\n";
   &call_exit;
  }
+
+if ($sc_use_alternate_PayPal_order_processing ne "Yes") {
+############  Start of Standard Confirm Page - Select from this line to for copy functions ############
+#### can use in custom processing file.  Custom file must be named: PayPal_custom_processing_lib.pl
+#### Place PayPal_custom_processing_lib.pl in the library directory of your store
+#### Custom function (aka sub routine)  to replace the code below must be named: PayPal_custom_processing_custom_page_function
   
 print qq!
 <HTML>
@@ -407,6 +434,15 @@
 </HTML>
 !;
 
+############  End of Standard Confirm Page - Select until this line for copy functions ############
+}
+else { # uses alternate processing file in add_ons sub directory
+      &require_supporting_libraries(__FILE__,__LINE__,
+     "./library/PayPal_custom_lib.pl");
+ &PayPal_custom_processing_confirm_page_function;
+
+} # end of alternate processing
+
 } # End of process_order_form
 
 #################################################################
@@ -418,6 +454,13 @@
 &load_verify_file;
 
 $orderDate = &get_date;
+
+if ($sc_use_alternate_PayPal_order_processing ne "Yes") {
+############  Start of Standard Processing Code - Select from this line to for copy functions ############
+#### can use in custom processing file.  Custom file must be named: PayPal_custom_processing_lib.pl
+#### Place PayPal_custom_processing_lib.pl in the library directory of your store
+#### Custom function (aka sub routine)  to replace the code below must be named: PayPal_custom_processing_function
+
 $text_of_cart .= "Gateway:       PayPal Standard\n\n";
 $orderLoggingHash{'GatewayUsed'} = "PayPal standard";
 
@@ -509,7 +552,44 @@
 $orderLoggingHash{'adminMessages'} = "";
 $orderLoggingHash{'shippingMessages'} = "";
 $orderLoggingHash{'xcomments'} = "";
-$orderLoggingHash{'termsOfService'} = "$eform_Ecom_tos";
+$orderLoggingHash{'termsOfService'} = "$vform_Ecom_tos";
+$orderLoggingHash{'faxNumber'} = "";
+
+# new logging items added August 4, 2007 by Mister Ed
+$orderLoggingHash{'discountCode'} = "";
+$orderLoggingHash{'user6'} = "";
+$orderLoggingHash{'user7'} = "";
+$orderLoggingHash{'user8'} = "";
+$orderLoggingHash{'user9'} = "";
+$orderLoggingHash{'user10'} = "";
+$orderLoggingHash{'buySafe'} = "";
+$orderLoggingHash{'order_payment_type_user1'} = "";
+$orderLoggingHash{'order_payment_type_user2'} = "";
+$orderLoggingHash{'GiftCard_number'} = "";
+$orderLoggingHash{'GiftCard_amount_used'} = "";
+$orderLoggingHash{'internal_company_notes1'} = "";
+$orderLoggingHash{'internal_company_notes2'} = "";
+$orderLoggingHash{'internal_company_notes2'} = "";
+$orderLoggingHash{'customer_order_notes1'} = "";
+$orderLoggingHash{'customer_order_notes2'} = "";
+$orderLoggingHash{'customer_order_notes3'} = "";
+$orderLoggingHash{'customer_order_notes4'} = "";
+$orderLoggingHash{'customer_order_notes5'} = "";
+$orderLoggingHash{'mailinglist_subscribe'} = "";
+$orderLoggingHash{'wishlist_subscribe'} = "";
+$orderLoggingHash{'insurance_cost'} = "";
+$orderLoggingHash{'trade_in_allowance'} = "";
+$orderLoggingHash{'rma_number'} = "";
+$orderLoggingHash{'customer_contact_notes1'} = "";
+$orderLoggingHash{'customer_contact_notes2'} = "";
+$orderLoggingHash{'account_number'} = "";
+$orderLoggingHash{'sales_rep'} = "";
+$orderLoggingHash{'sales_rep_notes1'} = "";
+$orderLoggingHash{'sales_rep_notes2'} = "";
+$orderLoggingHash{'how_did_you_find_us'} = "";
+$orderLoggingHash{'suggestion_box'} = "";
+$orderLoggingHash{'preferrred_shipping_date'} = "";
+$orderLoggingHash{'ship_order_items_as_available'} = "";
 
 # NEW CODEHOOK
 &codehook("process-order-pre-ship-instructions");
@@ -664,7 +744,7 @@
 # This empties the cart after the order is "successful"
 &empty_cart;
 
-# added by Mister Ed Feb 7, 2007
+# added by Mister Ed for Pro version Feb 7, 2007
 my $temp_admin_email = "$sc_admin_email";
 if ($sc_use_customer_email_over_admin =~ /yes/i) {
    $temp_admin_email = "$vform_Ecom_BillTo_Online_Email";
@@ -689,6 +769,14 @@
     &set_agora("BUYSAFE_ORDER_COMPLETED",'yes');
 }
 
+############  End of Standard Processing Code - Select until this line for copy functions ############
+}
+else { # uses alternate processing file in add_ons sub directory
+
+ &codehook("PayPal_custom_processing_function");
+
+} # end of alternate processing
+
 }
 #################################################################
 
diff -x .svn -aruN 5.2.004.src/library/PlugnPay-order_lib.pl 5.2.005.src/library/PlugnPay-order_lib.pl
--- 5.2.004.src/library/PlugnPay-order_lib.pl	2008-06-26 07:48:44.000000000 -0500
+++ 5.2.005.src/library/PlugnPay-order_lib.pl	2008-08-30 20:13:35.000000000 -0500
@@ -10,7 +10,7 @@
 # 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'} = "5.0.002";
+$versions{'PlugnPay-order_lib.pl'} = "5.5.000";
 
 $sc_order_response_vars{"PlugnPay"}="FinalStatus";
 $sc_use_secure_header_at_checkout = 'yes';
@@ -152,6 +152,9 @@
 </div>
 ENDOFTEXT
 
+# use this to change $rslt
+&codehook("PlugnPay_verification_table_bottom");
+
   return $rslt;
 }
 ###############################################################################
@@ -282,6 +285,11 @@
 
 &codehook("PlugnPay-SubmitPage-print");
 
+if ($sc_use_alternate_PlugnPay_submit_page ne "Yes") {
+############  Start of Standard submit page - Select from this line to for copy functions ############
+#### can use in custom submit page.  Custom file must be named: PlugnPay_custom_processing_lib.pl
+#### Custom function (aka sub routine) to replace the code below must be named: PlugnPay_custom_submit_page
+
 # SHOW PNP FORM FIELDS HERE
 print <<ENDOFTEXT;
 
@@ -546,6 +554,14 @@
 
 ENDOFTEXT
 
+############  End of Submit Page Code - Select until this line for copy functions ############
+}
+else { # uses alternate processing file in add_ons sub directory
+
+ &codehook("'PlugnPay_custom_submit_page");
+
+} # end of alternate submit page
+
 }
 ############################################################################################
 sub process_PlugnPay_Order {
@@ -575,6 +591,12 @@
 
 $orderDate = &get_date;
 
+if ($sc_use_alternate_PlugnPay_order_processing ne "Yes") {
+############  Start of Standard Processing Code - Select from this line to for copy functions ############
+#### can use in custom processing file.  Custom file must be named: PlugnPay_custom_processing_lib.pl
+#### Place PlugnPay_custom_processing_lib.pl in the library directory of your store
+#### Custom function (aka sub routine)  to replace the code below must be named: PlugnPay_custom_processing_function
+
 print "<HTML>\n";
 print "$sc_special_page_meta_tags";
 print "<HEAD>\n";
@@ -699,6 +721,43 @@
 $orderLoggingHash{'shippingMessages'} = "";
 $orderLoggingHash{'xcomments'} = "";
 $orderLoggingHash{'termsOfService'} = "$vform_Ecom_tos";
+$orderLoggingHash{'faxNumber'} = "";
+
+# new logging items added August 4, 2007 by Mister Ed
+$orderLoggingHash{'discountCode'} = "";
+$orderLoggingHash{'user6'} = "";
+$orderLoggingHash{'user7'} = "";
+$orderLoggingHash{'user8'} = "";
+$orderLoggingHash{'user9'} = "";
+$orderLoggingHash{'user10'} = "";
+$orderLoggingHash{'buySafe'} = "";
+$orderLoggingHash{'order_payment_type_user1'} = "";
+$orderLoggingHash{'order_payment_type_user2'} = "";
+$orderLoggingHash{'GiftCard_number'} = "";
+$orderLoggingHash{'GiftCard_amount_used'} = "";
+$orderLoggingHash{'internal_company_notes1'} = "";
+$orderLoggingHash{'internal_company_notes2'} = "";
+$orderLoggingHash{'internal_company_notes2'} = "";
+$orderLoggingHash{'customer_order_notes1'} = "";
+$orderLoggingHash{'customer_order_notes2'} = "";
+$orderLoggingHash{'customer_order_notes3'} = "";
+$orderLoggingHash{'customer_order_notes4'} = "";
+$orderLoggingHash{'customer_order_notes5'} = "";
+$orderLoggingHash{'mailinglist_subscribe'} = "";
+$orderLoggingHash{'wishlist_subscribe'} = "";
+$orderLoggingHash{'insurance_cost'} = "";
+$orderLoggingHash{'trade_in_allowance'} = "";
+$orderLoggingHash{'rma_number'} = "";
+$orderLoggingHash{'customer_contact_notes1'} = "";
+$orderLoggingHash{'customer_contact_notes2'} = "";
+$orderLoggingHash{'account_number'} = "";
+$orderLoggingHash{'sales_rep'} = "";
+$orderLoggingHash{'sales_rep_notes1'} = "";
+$orderLoggingHash{'sales_rep_notes2'} = "";
+$orderLoggingHash{'how_did_you_find_us'} = "";
+$orderLoggingHash{'suggestion_box'} = "";
+$orderLoggingHash{'preferrred_shipping_date'} = "";
+$orderLoggingHash{'ship_order_items_as_available'} = "";
 
 $sc_orderlib_use_SBW_for_ship_ins = $sc_use_SBW;
 &codehook("orderlib-ship-instructions");
@@ -924,7 +983,7 @@
 }
 
 if ($sc_send_order_to_email =~ /yes/i) {
-  &send_mail($sc_admin_email, $sc_order_email, "$sc_plugnpay_order_desc - $eform_cart_id", $text_of_cart);
+  &send_mail($temp_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{'customer_number'});
@@ -973,7 +1032,13 @@
 </BODY>
 </HTML>
 !;
+############  End of Standard Processing Code - Select until this line for copy functions ############
+}
+else { # uses alternate processing file in add_ons sub directory
+
+ &codehook("'PlugnPay_custom_processing_function");
 
+} # end of alternate processing
 } # End of process_order_form
 
 #################################################################
diff -x .svn -aruN 5.2.004.src/library/USAepay-order_lib.pl 5.2.005.src/library/USAepay-order_lib.pl
--- 5.2.004.src/library/USAepay-order_lib.pl	2008-06-26 07:48:44.000000000 -0500
+++ 5.2.005.src/library/USAepay-order_lib.pl	2008-08-30 20:13:35.000000000 -0500
@@ -2,7 +2,7 @@
 #                    Order Form Definition Variables                  #
 #######################################################################
 
-$versions{'USAepay-order_lib.pl'} = "5.0.004";
+$versions{'USAepay-order_lib.pl'} = "5.5.000";
 $sc_use_secure_header_at_checkout = 'yes';
 $sc_use_secure_footer_for_order_form = 'yes';
 
@@ -87,6 +87,9 @@
        $form_data{'Ecom_BillTo_Postal_CountryCode'};
    }
  }
+
+# use this code hooks to check for more variables / default values
+&codehook("USAepay_bill2ship_field_defaults_bottom");
 }
 ###############################################################################
 sub USAepay_fields {
@@ -215,6 +218,10 @@
  if ($result ne '') {
    $result .= "</TABLE></TD></TR></TABLE>\n";
   }
+
+# use this codehook to change $result
+&codehook("USAepay_table_setup_bottom");
+
  $USAepay_cart_table = $result;
 }
 
@@ -254,9 +261,14 @@
   $form_data{'Ecom_Payment_Card_ExpDate_Year'} = "09";
  }
 
-my $fullname = "$form_data{'Ecom_BillTo_Postal_Name_First'}" . " $form_data{'Ecom_BillTo_Postal_Name_Last'}";
+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'}";
 
+if ($sc_use_alternate_USAepay_submit_page eq "Yes") {
+############  Start of Standard submit page - Select from this line to for copy functions ############
+#### can use in custom submit page.  Custom file must be named: USAepay_custom_processing_lib.pl
+#### Custom function (aka sub routine) to replace the code below must be named: USAepay_custom_submit_page
+
 print <<ENDOFTEXT;
 
 <FORM METHOD=POST ACTION=\"$sc_order_script_url\">
@@ -436,6 +448,14 @@
 </CENTER>
 ENDOFTEXT
 
+############  End of Submit Page Code - Select until this line for copy functions ############
+}
+else { # uses alternate processing file in add_ons sub directory
+
+ &codehook("iTransact_custom_submit_page");
+
+} # end of alternate submit page
+
 }
 ############################################################################################
 sub process_USAepay_Order {
@@ -516,6 +536,12 @@
 
 $orderDate = &get_date;
 
+if ($sc_use_alternate_USAepay_order_processing ne "Yes") {
+############  Start of Standard Processing Code - Select from this line to for copy functions ############
+#### can use in custom processing file.  Custom file must be named: USAepay_custom_processing_lib.pl
+#### Place USAepay_custom_processing_lib.pl in the library directory of your store
+#### Custom function (aka sub routine)  to replace the code below must be named: USAepay_custom_processing_function
+
 print qq!
 <html>
 $sc_special_page_meta_tags
@@ -525,7 +551,6 @@
 <body>
 !;
 
-
 &SecureStoreHeader;
 
 $text_of_cart .= "Order Date:    $orderDate\n";
@@ -555,7 +580,7 @@
 close(CART);
 
 # initialize hash variables in case they are empty later
-# added by Mister Ed 2006
+# added by jfindlay 2006 February
 
 $orderLoggingHash{'firstName'} = "";
 $orderLoggingHash{'lastName'} = "";
@@ -579,6 +604,7 @@
 $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";
@@ -608,8 +634,10 @@
 $orderLoggingHash{'shippingMessages'} = "";
 $orderLoggingHash{'xcomments'} = "";
 $orderLoggingHash{'termsOfService'} = "$vform_Ecom_tos";
+$orderLoggingHash{'faxNumber'} = "";
 
 # new logging items added August 4, 2007 by Mister Ed
+$orderLoggingHash{'discountCode'} = "";
 $orderLoggingHash{'user6'} = "";
 $orderLoggingHash{'user7'} = "";
 $orderLoggingHash{'user8'} = "";
@@ -819,7 +847,7 @@
 
 $sc_USAepay_order_desc .= " - " . $sc_verify_inv_no;
 
-# added by Mister Ed Feb 7, 2007
+# added by Mister Ed for Pro version Feb 7, 2007
 my $temp_admin_email = "$sc_admin_email";
 if ($sc_use_customer_email_over_admin =~ /yes/i) {
    $temp_admin_email = "$eform_Ecom_BillTo_Online_Email";
@@ -864,7 +892,6 @@
 
 # This empties the cart after the order is successful
 &empty_cart;
-undef(%form_data);
 
 # and the footer is printed
 
@@ -874,7 +901,13 @@
 </BODY>
 </HTML>
 !;
+############  End of Standard Processing Code - Select until this line for copy functions ############
+}
+else { # uses alternate processing file in add_ons sub directory
+
+ &codehook("iTransact_custom_processing_function");
 
+} # end of alternate processing
 } # End of process_order_form
 
 #################################################################
diff -x .svn -aruN 5.2.004.src/library/YourPayConnect-order_lib.pl 5.2.005.src/library/YourPayConnect-order_lib.pl
--- 5.2.004.src/library/YourPayConnect-order_lib.pl	2008-06-26 07:48:44.000000000 -0500
+++ 5.2.005.src/library/YourPayConnect-order_lib.pl	2008-08-30 20:13:35.000000000 -0500
@@ -1,7 +1,7 @@
 ##############################################################################
 #                       Order Form Definition Variables                      #
 ##############################################################################
-$versions{'YourPayConnect-order_lib.pl'} = "5.0.002";
+$versions{'YourPayConnect-order_lib.pl'} = "5.5.000";
 $sc_use_secure_header_at_checkout = 'yes';
 $sc_use_secure_footer_for_order_form = 'yes';
 $sc_YourPayConnect_form_prep = 0;
@@ -88,7 +88,7 @@
     push(@sc_order_form_required_fields,"Ecom_tos");
  }
 
-# use this codehook to change the above arrays for required fields and such
+# use this codehook to chage the above arrays for required fields and such
 &codehook("YourPayConnect_fields_bottom");
 
 }
@@ -135,6 +135,9 @@
 	$form_data{'Ecom_ShipTo_Postal_CountryCode'} . "&nbsp;</td>\n";
   $rslt.= "</tr>\n";
   $rslt.= "</table>\n";
+
+# use this to change $rslt
+&codehook("YourPayConnect_verification_table_bottom");
   return $rslt;
  }
 ###############################################################################
@@ -172,6 +175,11 @@
 
 my $temp_total_thingy = ($zsubtotal - $zfinal_discount);
 
+if ($sc_use_alternate_YourPayConnect_submit_page ne "Yes") {
+############  Start of Standard submit page - Select from this line to for copy functions ############
+#### can use in custom submit page.  Custom file must be named: YourPayConnect_custom_processing_lib.pl
+#### Custom function (aka sub routine) to replace the code below must be named: YourPayConnect_custom_submit_page
+
 print <<ENDOFTEXT;
 
 <FORM METHOD=POST ACTION="$sc_order_script_url">
@@ -261,6 +269,13 @@
 </FORM>
 
 ENDOFTEXT
+############  End of Submit Page Code - Select until this line for copy functions ############
+}
+else { # uses alternate processing file in add_ons sub directory
+
+&codehook("YourPayConnect_custom_submit_page");
+
+} # end of alternate submit page
 
 }
 ###############################################################################
@@ -295,6 +310,12 @@
 
 &SecureStoreHeader;
 
+if ($sc_use_alternate_YourPayConnect_order_processing ne "Yes") {
+############  Start of Standard Processing Code - Select from this line to for copy functions ############
+#### can use in custom processing file.  Custom file must be named: YourPayConnect_custom_processing_lib.pl
+#### Place YourPayConnect_custom_processing_lib.pl in the library directory of your store
+#### Custom function (aka sub routine)  to replace the code below must be named: YourPayConnect_custom_processing_function
+
 $text_of_cart .= "Order Date:    $orderDate\n";
 $text_of_cart .= "Gateway:       YourPayConnect\n\n";
 $orderLoggingHash{'GatewayUsed'} = "YourPayConnect";
@@ -375,6 +396,43 @@
 $orderLoggingHash{'shippingMessages'} = "";
 $orderLoggingHash{'xcomments'} = "";
 $orderLoggingHash{'termsOfService'} = "$vform_Ecom_tos";
+$orderLoggingHash{'faxNumber'} = "";
+
+# new logging items added August 4, 2007 by Mister Ed
+$orderLoggingHash{'discountCode'} = "";
+$orderLoggingHash{'user6'} = "";
+$orderLoggingHash{'user7'} = "";
+$orderLoggingHash{'user8'} = "";
+$orderLoggingHash{'user9'} = "";
+$orderLoggingHash{'user10'} = "";
+$orderLoggingHash{'buySafe'} = "";
+$orderLoggingHash{'order_payment_type_user1'} = "";
+$orderLoggingHash{'order_payment_type_user2'} = "";
+$orderLoggingHash{'GiftCard_number'} = "";
+$orderLoggingHash{'GiftCard_amount_used'} = "";
+$orderLoggingHash{'internal_company_notes1'} = "";
+$orderLoggingHash{'internal_company_notes2'} = "";
+$orderLoggingHash{'internal_company_notes2'} = "";
+$orderLoggingHash{'customer_order_notes1'} = "";
+$orderLoggingHash{'customer_order_notes2'} = "";
+$orderLoggingHash{'customer_order_notes3'} = "";
+$orderLoggingHash{'customer_order_notes4'} = "";
+$orderLoggingHash{'customer_order_notes5'} = "";
+$orderLoggingHash{'mailinglist_subscribe'} = "";
+$orderLoggingHash{'wishlist_subscribe'} = "";
+$orderLoggingHash{'insurance_cost'} = "";
+$orderLoggingHash{'trade_in_allowance'} = "";
+$orderLoggingHash{'rma_number'} = "";
+$orderLoggingHash{'customer_contact_notes1'} = "";
+$orderLoggingHash{'customer_contact_notes2'} = "";
+$orderLoggingHash{'account_number'} = "";
+$orderLoggingHash{'sales_rep'} = "";
+$orderLoggingHash{'sales_rep_notes1'} = "";
+$orderLoggingHash{'sales_rep_notes2'} = "";
+$orderLoggingHash{'how_did_you_find_us'} = "";
+$orderLoggingHash{'suggestion_box'} = "";
+$orderLoggingHash{'preferrred_shipping_date'} = "";
+$orderLoggingHash{'ship_order_items_as_available'} = "";
 
 $sc_orderlib_use_SBW_for_ship_ins = $sc_use_SBW;
 &codehook("orderlib-ship-instructions");
@@ -617,7 +675,7 @@
 $text_of_cart = "\n" . $text_of_cart . "\n";
 }
 
-# added by Mister Ed Feb 7, 2007
+# added by Mister Ed for Pro version Feb 7, 2007
 my $temp_admin_email = "$sc_admin_email";
 if ($sc_use_customer_email_over_admin =~ /yes/i) {
    $temp_admin_email = "form_data{'email'}";
@@ -677,7 +735,13 @@
 </BODY>
 </Connect>
 !;
+############  End of Standard Processing Code - Select until this line for copy functions ############
+}
+else { # uses alternate processing file in add_ons sub directory
+
+ &codehook("YourPayConnect_custom_processing_function");
 
+} # end of alternate processing
 } # End of process_YourPayConnect_order
 
 #################################################################
diff -x .svn -aruN 5.2.004.src/library/agora.setup.db 5.2.005.src/library/agora.setup.db
--- 5.2.004.src/library/agora.setup.db	2008-06-26 07:48:44.000000000 -0500
+++ 5.2.005.src/library/agora.setup.db	2008-08-30 20:13:29.000000000 -0500
@@ -1,14 +1,22 @@
-$versions{'agora.setup.db 5 user'} = "5.2.000";
+$versions{'agora.setup.db 5 user'} = "5.5.002";
 # set this to "" to always calculate the tax
 $sc_sales_tax_form_variable = "Ecom_ShipTo_Postal_StateProv";
 $sc_userfields_available = "5";
 $sc_database_version = "5 User";
+$sc_pro_version = "yes";
 
 # added by Mister Ed April 2006.
 # limits the chracters accepted from order forms.
 # silently truncates at the max size
 $sc_max_char_length = 2400;
 
+# 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");
+# DELUXE HTML helper definitions
+# Someday some of these html modifiers may be in the manager
+
 $sc_browser_header = "Content-type: text/html\n\n";
 $sc_qty_box_on_cart_display = "yes";
 $sc_default_qty_to_display = 1; # becomes %%qty%% in html below
@@ -18,8 +26,8 @@
 $sc_product_display_header = qq~<div align=center><table class="ac_product_table">~;
 
 # add javascript or other items for header tags here
-$sc_image_string_template = '<img src="%%URLofImages%%/%%image%%" alt="%%image%%">';
-$sc_special_page_meta_tags = qq~  <!-- agora.cgi shopping cart $versions{'agora.cgi'} -->
+$sc_image_string_template = '<img src="%%URLofImages%%/%%image%%" alt="%%name%% - %%product%%">';
+$sc_special_page_meta_tags = qq~  <!-- AgoraCart Gold 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">
@@ -47,6 +55,12 @@
 $sc_process_order_lib_path = "$sc_lib_dir/$sc_gateway_name-order_lib.pl";
 $sc_cookie_lib = "$sc_lib_dir/cookie-lib.pl";
 
+# removed in version 5.0.0
+#$sc_store_header_file = "$sc_templates_dir/store_header.html";
+#$sc_store_footer_file = "$sc_templates_dir/store_footer.html";
+#$sc_secure_store_header_file = "$sc_templates_dir/secure_store_header.html";
+#$sc_secure_store_footer_file = "$sc_templates_dir/secure_store_footer.html";
+
 if ($sc_database_lib eq "") {
   $sc_database_lib="agora_db_lib.pl";
  }
@@ -81,6 +95,10 @@
 $sc_debug_mode = "no";
 $sc_debug_track_cartid = 'no';
 $sc_cookie_days = 30; # browser cookie lifetime, not cart lifetime.  set to -1 if you wish cookies to expire when browser is closed.
+
+# moved to main settings in version 5.0.0
+# $sc_number_days_keep_old_carts = 1; # cart lifetime in days
+
 $sc_allow_location_redirect = "yes"; # helpful for cookies
 $sc_test_for_store_cart_change_repeats = 1; # test for reloaded pages
 
@@ -98,7 +116,7 @@
 $sc_web_pid_sep_char = "~~"; 
 
 # special manager control variables
-$mc_allow_multiple_options = 'yes'; 
+$mc_allow_multiple_options = 'yes'; # Only for 4.0d and higher stores
 
 #######################################################################
 #                Database Definition Variables                        #
@@ -244,11 +262,14 @@
 $cart{"db_user4"}            = -10;
 $cart{"db_user5"}            = -11;
 
+###
+# new-style virtual fields, perl code, first char is *
+###
 $cart{"email_options"}  = '* $ans=&cart_email_options(&vf_eval("options"));';
 
 $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"};
@@ -296,6 +317,7 @@
 
 $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 needs be
@@ -313,6 +335,19 @@
 #@sc_discount_logic = ();
 ### end of unused stuff
 
+# The following variables tell the ordering part of the script how
+# to calculate shipping, discount, and sales tax and in what order.
+#
+# The values are numerical (1,2,3) or 0 if we do not want to process
+# anything.
+# 
+# Variables that we do not calculate at a given time are given
+# a value of ZERO (0) to show they never enter into 
+# the calculation.
+#
+# Otherwise, they are given an ORDER NUMBER 1, 2, or 3 to show
+# in what order they are calculated.
+
 if ($sc_calculate_discount_loop eq "" ||  
     $sc_calculate_discount_loop < 0   ||  
     $sc_calculate_discount_loop > 3   ) { 
@@ -322,6 +357,14 @@
 $sc_calculate_discount_at_display_form = $sc_calculate_discount_loop;
 $sc_calculate_discount_at_process_form = $sc_calculate_discount_loop;
  
+# 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_pgp_temp_file_path = "./shopping_carts";
 
 #######################################################################
diff -x .svn -aruN 5.2.004.src/library/agora_db_lib.pl 5.2.005.src/library/agora_db_lib.pl
--- 5.2.004.src/library/agora_db_lib.pl	2008-06-26 07:48:44.000000000 -0500
+++ 5.2.005.src/library/agora_db_lib.pl	2008-08-30 20:13:30.000000000 -0500
@@ -1,5 +1,7 @@
 ###########################################################
-$versions{'agora_db_lib.pl 5 user'} = "5.0.001";
+# AGORA_DB_LIB.PL
+
+$versions{'agora_db_lib.pl 5 user'} = "5.1.002";
 $sc_db_engine='flatfile';
 $shipfilename = "$sc_data_file_dir/shipping_dimensions.file";
 
@@ -10,7 +12,74 @@
 #  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.
+#
+# Special Note: If you wish to interface with a SQL database
+# such as mSQL, this is where you do it. Simply replace the
+# routines in here with routines that call the database
+# engine of your choice.  
+#
+# Some of the Main Procedures:
+#
+#  add_new_record_to_prod_db - self explanatory
+#
+#  check_db_with_product_id - The web store takes
+#    this procedure and double checks that the order
+#    within the cart matches the product description
+#    in the database.  This is a security check.
+#
+#  del_prod_from_db - self explanatory
+#
+#  get_next_prod_key - Get the next key, padded correctly 
+#    for sorting purposes 
+#
+#  get_prod_db_category_list - get list of categories
+#
+#  get_prod_db_element -  Get the numbered element 
+#    from EVERY product database record
+#
+#  get_prod_db_row - get row from product database 
+#
+#  put_prod_db_raw_line - replace a record in the product database
+#
+#  submit_query - This routine submits a query to
+#    the product database and returns the results in an array
+#    for each row returned (returns the record keys).
+#
+# Generic routines for all databases when implementing for agora.  The
+# routines above can (should?) call these routines to get the job done,
+# especially if you desire to have add-on modules function properly.
+#
+#  get_db_row - get row from a database
+#
+#  put_db_raw_line - replace/add record to a database
+#
+#  init_a_database - init a database, set indexing, etc.
+#
+#  pad_key - Pad a key to a certain length, allows 
+#    easier sorting
+#
+#  get_db_element -  Get the numbered element from EVERY record 
+#
+#  submit_a_query - This routine submits a query to
+#    a database and returns the results in an array
+#    for each row returned (returns the record keys).
+#
+# Note: this library assumes zeroth element of a record is record key, and 
+# that record's field delimiter is pipe ('key|field 1|field 2|...').
+#
+##############################################################################
+#
+# 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";
@@ -22,18 +91,61 @@
 $sc_categorylist_only = "";
   return (sort(keys %category_list));
  }
+
+
 ############################################################
+# 
+# subroutine: check_db_with_product_id
+#   Usage:
+#     $status = &check_db_with_product_id($product_id,
+#                  *db_row);
+#
+#   Parameters:  
+#     $product_id = product id in the cart to check
+#     *db_row = @db_row passed by reference to
+#        obtain the row that corresponds to the
+#        product id.
+#
+#   Output:
+#     $status = whether the product id is has been
+#        found in the database. If it has not, then
+#        we know right away that something went wrong.
+#
+#     @db_row is returned by reference to the calling
+#        sub routine. It contains the row in the DB that
+#        matches the product ID. This row can then be
+#        checked by the Web Store to see if other items such
+#        as price match the cart item.  Each element of
+#        @db_row is a field in the database.
+#
+############################################################
+
+
 sub check_db_with_product_id {
   local($product_id, *db_row) = @_;
   local($result,$db_raw_line,$result);
   $result = &get_prod_db_row($product_id, *db_row, *db_raw_line, "yes");
   return $result;
+
 }
+
 ############################################################
+#
+# get a row from product database
+#
+############################################################
+
 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 = "";
+                #
+                # First we open the data file.
+                # If the open fails. We call the
+                # file open error routine in order
+                # to log the error
+                #
+
   if (!($sc_db_flatfile_caching_ok =~ /yes/i)) {$cacheok = "no";}
   $db_raw_line = "";#init it
   # if read before and caching, don't read again!
@@ -43,10 +155,29 @@
     $db_raw_line = $line;
     return 1;
   }
+
   $filename = $db_file_defs{"PRODUCT"};
+
   open(DATAFILE, "$filename") ||
     &file_open_error("$filename",
       "Read Database",__FILE__,__LINE__);
+
+                #
+                # Each line in the data file
+                # is read into $line variable.
+                # 
+                # Then, it is split into
+                # fields which are placed in 
+                # @db_rows.
+                #
+                # If it turns out that the 
+                # product id matches the
+                # product id in the database
+                # row, the while loop will
+                # stop, and the db_row will
+                # contain the row matching
+                # the product id.
+                #
   while (($line = <DATAFILE>) &&
          ($product_id ne $db_product_id)) {
     chop($line);
@@ -57,24 +188,54 @@
       $db_cache{$db_product_id}=$save_the_line;
      }
   }
+#
+# Save result, in case we need it later
   if ($product_id eq $db_product_id) { 
     $db_raw_line = $save_the_line;
   }
 
   close (DATAFILE);
+
+# return the result of the boolean expression
   	return ($product_id eq $db_product_id);
 
-} 
+} # End of sub get_prod_db_row 
 ############################################################################
 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 = "";
+                #
+                # First we open the data file.
+                # If the open fails. We call the
+                # file open error routine in order
+                # to log the error
+                #
+
   $db_raw_line = "";#init it
+
   $filename = $db_file_defs{$dbname};
+
   open(DATAFILE, "$filename") ||
     &file_open_error("$filename",
       "Read Database",__FILE__,__LINE__);
+
+                #
+                # Each line in the data file
+                # is read into $line variable.
+                # 
+                # Then, it is split into
+                # fields which are placed in 
+                # @db_rows.
+                #
+                # If it turns out that the 
+                # product id matches the
+                # product id in the database
+                # row, the while loop will
+                # stop, and the db_row will
+                # contain the row matching
+                # the product id.
+                #
   while (($line = <DATAFILE>) &&
          ($product_id ne $db_product_id)) {
     chop($line);
@@ -82,45 +243,79 @@
     $save_the_line = $line;
     $db_product_id = $db_row[0];
   }
+#
+# Save result, in case we need it later
   if ($product_id eq $db_product_id) { 
     $db_raw_line = $save_the_line;
   }
+
   close (DATAFILE);
+
+# return the result of the boolean expression
+
   return ($product_id eq $db_product_id);
-} 
+
+} # End of sub get_db_row 
+
+
 #################################################################
+# sub get_prod_db_element(<element>,<*assoc array>);
+#
+# Get the numbered element from EVERY PRODUCT database record!
+#
+#################################################################
+
 sub get_prod_db_element {
   local($element_id,*db_ele) = @_;
   &get_db_element("PRODUCT",0,$element_id,"last",*db_ele);
-} 
+} # End of sub get_prod_db_element 
 
 #################################################################
+
 sub get_mgr_prod_db_element {
   local($element_id,*db_ele) = @_;
   &get_db_element("PRODUCT",0,$element_id,"mgr",*db_ele);
-} 
+} # End of sub get_prod_db_element 
+
 #################################################################
+
 sub get_prod_db_keys {
   local($element_id,%db_ele);
-  $element_id = 0; 
+  $element_id = 0; #redundant, but works
   &get_db_element("PRODUCT",0,$element_id,"last",*db_ele);
   return (keys %db_ele);
-} 
+} # End of sub get_prod_db_keys 
+
 #################################################################
+
 sub get_db_keys {
   local($dbname)=@_;
   local($element_id,%db_ele);
-  $element_id = 0; 
+  $element_id = 0; #redundant, but works
   &get_db_element($dbname,0,$element_id,"last",*db_ele);
   return (keys %db_ele);
-} 
+} # End of sub get_db_keys 
 #################################################################
+# sub get_db_element(<datafile>,
+#                             <ID element>,
+#                             <element to retrieve>,
+#                             <what to do with duplicates>,
+#                             <*assoc array>);
+#
+# Get the numbered element from EVERY flatfile database record!
+#
+#   <what to do with duplicates> = "last" or "all"
+#
+#################################################################
+
 sub get_db_element {
   local($data_file,$id_inx,$element_id,$dups,*db_ele) = @_;
   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")) {
 
@@ -129,11 +324,14 @@
     $db_id = $db_row[$id_inx];
     $db_subcat = $db_row[$db{$sc_subcat_index_field}];
     $db_subkey = $db_row[$element_id];
+#main category
+
 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];
      } 
+# sub categories
 if ($db_subcat =~ /::/) {
     my @db_subcatarray = split(/::/, $db_subcat);
 foreach my $db_subcatarray (@db_subcatarray) {
@@ -144,6 +342,7 @@
     } 
   }
   } else {
+#existing code
   while (($line = <DATAFILE>)) {
     @db_row = split(/\|/,$line);
     $db_id = $db_row[$id_inx];
@@ -156,12 +355,24 @@
   }
   }
   close (DATAFILE);
+
   return;
-} 
+} # End of sub get_flatfile_db_element 
+
+############################################################ 
+# sub get_next_prod_key 
+# 
+# Get the next key, padded correctly for sorting purposes 
+# This routine does NOT "reserve" this next key, two people 
+# editing simultaneously will get the same next key ... 
+# should not be a problem for most folks, this was how the 
+# original code worked as well. 
 ############################################################ 
+
 sub get_next_prod_key {
   local($element_id,%db_ele,$highest,$next_key,$mykey); 
   local($padlength) = $sc_prod_db_pad_length;
+# Doesn't matter what we ask for, we just want all the keys
   $element_id = $db{"product"};
   &get_mgr_prod_db_element($element_id,*db_ele);
   $highest=0;
@@ -172,16 +383,22 @@
    }
   $next_key = &pad_key(($highest + 1),$padlength);
   return $next_key;
-} 
+} # End of sub get_next_prod_key 
+
+############################################################
+# Pad a key to a certain length, allows easier sorting!
 ############################################################
+
 sub pad_key {
   local($next_key,$padlength) = @_;
   while(length($next_key) < $padlength) {
     $next_key = "0$next_key";
    }
   return $next_key;
-}
+} # End of sub pad_key 
+
 ############################################################
+
 sub put_prod_db_raw_line {
   local($product_id, $db_raw_line, $cacheok) = @_;
   local($result,$db_product_id,$ProductEditSku)=0;
@@ -189,18 +406,29 @@
          $long_description, $shipping_price, $userDefinedOne, 
          $userDefinedTwo, $userDefinedThree, $userDefinedFour, 
          $userDefinedFive, $options, $junk, $line, @lines);
+                #
+                # First we open the data file.
+                # If the open fails. We call the
+                # file open error routine in order
+                # to log the error
+                #
+#Note: could check to see if $product_id and $ProductEditSku match!
 ($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>;
+#print @lines;
 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;
@@ -208,20 +436,27 @@
    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;
-} 
+
+} # End of put_prod_db_raw_line 
+
 ############################################################
+
 sub put_db_raw_line {
   local($dbname,$product_id, $db_raw_line, $cacheok) = @_;
   local($result,$db_product_id,$ProductEditSku)=0;
@@ -229,15 +464,29 @@
          $long_description, $shipping_price, $userDefinedOne, 
          $userDefinedTwo, $userDefinedThree, $userDefinedFour, 
          $userDefinedFive, $options, $junk, $line, @lines);
+                #
+                # First we open the data file.
+                # If the open fails. We call the
+                # file open error routine in order
+                # to log the error
+                #
+                # if $db_raw_line is null, then delete any such line
+		# from the database and do not add if not present.
+                #
+#Note: could check to see if $product_id and $ProductEditSku match!
 ($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>;
+#print @lines;
 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;
@@ -245,15 +494,21 @@
    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;
-} 
+
+} # End of put_db_raw_line 
+
 ############################################################
+
 sub del_prod_from_db {
   local($product_id) = @_;
   local($db_raw_line, $cacheok) = @_;
@@ -262,25 +517,37 @@
          $long_description, $shipping_price, $userDefinedOne, 
          $userDefinedTwo, $userDefinedThree, $userDefinedFour, 
          $userDefinedFive, $options, $junk, $line, @lines);
+                #
+                # First we open the data file.
+                # If the open fails. We call the
+                # file open error routine in order
+                # to log the error
+                #
+#Note: could check to see if $product_id and $ProductEditSku match!
 ($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>;
+#print @lines;
 $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");
 #################### delete shipping file ##################
@@ -303,24 +570,70 @@
 close (NEWSHIPFILE);
 &release_file_lock("${shipfilename}.lock");
 #################### end delete shipping file ##################
+
 if ($db_cache{$ProductEditSku} ne "") {
   $db_cache{$ProductEditSku} = "";
  }
+
 return $result;
-}
+
+} # End of del_prod_from_db  
+
 #######################################################################
+
 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;
+
 }
+
+############################################################
+# 
+# subroutine: submit_query
+#   Usage:
+#     ($status, $row_count) = &submit_query(*db_rows);
+#
+#   Parameters:  
+#     *db_rows = an empty array is passed by reference
+#       so that it can be filled with the contents of
+#       the rows that satisfy the query.
+#
+#   Output:
+#     $status = blank is no error. It contains an 
+#       abbreviated name of the error that occured if
+#       there was a problem with the query such as
+#       "max_rows_exceeded".
+#   
+#     $row_count = amount of rows that satisfied query
+#       even if the count exceeded the maximum allowed.
+#       This row count will never actually exceed
+#       1 above the row count in the flat file version
+#       of this routine because it is inefficient to
+#       keep reading a text file if we do not 
+#       intend to present the user with the subsequent
+#       information.
+#
+#     *db_rows = an array where each row is a row that
+#       satisfied the results of the query. The rows 
+#       stop being added to this array if $sc_max_rows
+#       setup variable is exceeded.
+#
+#       Each row contains the fields in a PIPE delimited
+#       form.
+#
 ############################################################
+
+
 sub submit_query {
   local (*database_rows) = @_;
   local ($status,$rowcount);
@@ -332,8 +645,17 @@
    } 
   return($status,$row_count);
 }
+
 ############################################################
 # Submitted/Modified 10-11-2003 by Jeffrey W. Hamilton
+# comment edits by Mister Ed - K-Factor Technologies, Inc.
+# - Cleaned up code for speed and clarity
+# Returns:
+#	Value 1: "max_rows_exceeded" if more products than the 
+#              maximum rows requested is returned in the list
+#     Value 2: A list of product_id for each matching product
+#              in sorted order
+############################################################
 sub submit_a_query {
   local($dbname, $sc_db_max_rows_returned, *form_data, *sc_db_query_criteria, 
 	*database_rows) = @_;
@@ -341,73 +663,263 @@
   local(@fields);
   local($row_count);
   local($line); 
+
+                # We initialize row count to 0.
+                #
   $row_count = 0;
+ 
+                #
+                # The first thing we need to do is
+                # open the data file and then check to
+                # see if there was an error doing this.
+                #
+
   $filename = $db_file_defs{$dbname};
   local  @patch_short_criteria = &patch_short_criteria();
+
   open(DATAFILE, "$filename") ||
     &file_open_error("$filename",
       "Read Database",__FILE__,__LINE__);
+
+                #
+                # If there was no error opening it,
+                # then we read each line into $line
+                # until the file ends or the row count
+                # exceeds the maximum rows returned plus
+                # 1.
+                #        
   while($line = <DATAFILE>)
   {
-    chop($line); 
+    chop($line); # Chop off extraneous newline
+
+                # Each field is split based on the pipe
+                # delimiter.
     @fields = split(/\|/, $line);
+
+                # Then, for each criteria
+                # specified in @sc_db_query_criteria,
+                # we call a routine to apply the
+                # criteria. 
+
     foreach $criteria (@patch_short_criteria)
     {  
       $not_found = &flatfile_apply_criteria(*fields, $criteria);
 	last if ($not_found);
     }
+
+                # If not found conditional true then
+                # the row count has not exceeded
+                # the amount of rows that we
+                # promised to return,
+                # the row is pushed into the
+                # @db_rows array.
+                #
     if (!$not_found)
     {
+      # put in conditional to not return inactive items
+      # added by Mister Ed August 15, 2006
+      if ($fields[$sc_inactive_user_number] !~ /inactive/i) {
+	      # Line in database matches all criteria
           push(@database_rows, $fields[0]);
 	      $row_count++;
+      }
     }
-  } 
+  } # End of while datafile has data
+
+                # Finally, we close the datafile when
+                # we are done with it.
+
   close (DATAFILE);
+
+                # We passed database rows by reference so that
+                # no extra copying of the array is needed when
+                # we return the status.
+                #
   if ($row_count > $sc_db_max_rows_returned)
   {
     $status = "max_rows_exceeded";
   } 
+
+		# Sort them so they are in product id number order
   @database_rows = sort(@database_rows);
+
+                # Finally, we return the status and
+                # the row count.
+                #
   return($status,$row_count);
-} 
+} # End of submit_a_query
+############################################################
+# 
+# subroutine: flatfile_apply_criteria
+#  Usage:
+#      $status = &flatfile_apply_criteria(
+#	$exact_match,
+#	$case_sensitive,
+#	*fields,
+#	$criteria);
+#
+#   Parameters:
+#      $exact_match = on if the user
+#        selected to perform exact whole word matches
+#        on the database strings
+#      $case_sensitive = on if the user 
+#        selected to perform case sensitive matches
+#        on the database strings.
+#      *fields is a reference to the array of fields 
+#       in the current database row that we are
+#       searching.
+#      $criteria is the current criteria that we
+#       are applying to the database row. The criteria
+#       is gathered from the @sc_query_criteria array
+#       from the setup file.
+#
+#   Output:
+#     status indicating whether the criteria was
+#     not found or not. If it is not found, a 1
+#     is returned. If it is, then a 0 is returned.
+# 
+# Submitted/Modified 10/11/2003 by Jeffrey W. Hamilton
+# comment edits by Mister Ed - K-Factor Technologies, Inc.
+# - Cleaned up code for speed and clarity
+# - Fixed date compares to handle a wider range of dates
+# - Added exactly equal matches for strings
+# Returns: 0 if the data row matches the given criteria
+#          1 if the data row does not match the given criteria
 ############################################################
 sub flatfile_apply_criteria {
   local(*fields, $criteria) = @_;
+                # format for the $criteria line
+                # the criteria is pipe delimited and
+                # consists of the form variable name
+                # that the criteria will be matched
+                # against, the fields in the database
+                # which will be matched against,
+                # the operator to use in comparison,
+                # and finally, the data type that the
+                # operator should use in the comparison
+                # (date, number, or string comparison).
+                #
   local($c_name, $c_fields, $c_op, $c_type);
+                # array of c_fields
   local(@criteria_fields);
+                # flag for whether we found something
   local($not_found);
+                # Value for form field
   local($form_value);
+                # Value for db field
   local($db_value);
+                # Date Comparison Place holders
   local($month, $year, $day);
   local($db_date, $form_date);
+                # Place marker for current database
+                # field index we are looking at 
   local($db_index);
+                # list of words in a string for matching
   local(@word_list);
+                #
+                # exact_match and case_sensitive
+                # are special form variables
+                # which alter the behavior of 
+                # keyword searches (string data
+                # type with the = operator).
+                #
+                # Normally keyword searches are
+                # case insensitive and are not
+                # exact match searches.
+                #
   local($exact_match) = $form_data{'exact_match'};
   local($case_sensitive) = $form_data{'case_sensitive'};
+
+                # Get criteria information
   ($c_name, $c_fields, $c_op, $c_type) = 
 	split(/\|/, $criteria);
+
+                # The criteria can match more than ONE
+                # field in the database! Thus, we get the
+                # index values of the fields in each row
+                # of the database that the form variable
+                # will be compared against.
+                # 
+                # Remember, fields and lists in perl
+                # start counting at 0.
+                # 
   @criteria_fields = split(/,/,$c_fields);
+
+                # We get the value of the form.
+                # 
   $form_value = $form_data{$c_name};
+
+# agora DELUXE ... if multiple instances of the variable were on the
+# form, then readparse uses the \0 as the delimiter.  We desire them 
+# to be a single instance delimited by spaces, so we just substitute
+
   $form_value =~ s/\0/ /g; 
   $form_value =~ s/(\s+)/ /g; 
   $form_value =~ s/(^\s)//g;  
+
+                # There are three cases of comparison
+                # that will return a value.
+                # 
+                # Case 1: The form field for the criteria
+                # was not filled out, so the match is
+                # considered a success.
+                # 
+                # Remember, if the user does not 
+                # enter a keyword, we want the search
+                # to be open-ended. Only restrict the
+                # search if the user chooses to enter
+                # a search word into the appropriate 
+                # query field.
+
   if ($form_value eq "")
   {
+    # if no data is stored in form, assume it matches
     return 0;
   }
+
+                # Case 2: The data type is a
+                # number or a date. OR if
+                # the data type is a string
+                # and the operator is NOT
+                # =. So we match against the
+                # operator directly based on the
+                # data type. (A string,= match
+                # is considered a separate case
+                # below).
+                # 
+
   if (($c_type =~ /date/i) || 
      ($c_type =~ /number/i) ||
      ($c_op ne "="))
   {
+                # First, we set not_found to yes. 
+                # We assume that the data did not
+                # match. If any fields match
+                # the data submitted by the user,
+                # then, we will set not_found to no
+                # later on.
     $not_found = "yes";
+                # Go through each database field
+                # specified in @criteria_fields
+                # and compare it
     foreach $db_index (@criteria_fields)
     {
+
+                # Go through each database field
+                # specified in @criteria_fields
+                # and compare it
       $db_value = $fields[$db_index];
+
+	# Date field comparison
       if ($c_type =~ /date/i) 
       {
+	  # Clean up date in database field
         ($month, $day, $year) = split(/\//, $db_value);
         $month = "0" . $month if (length($month) < 2);
         $day = "0" . $day if (length($day) < 2);
+	  # Years between 0 and 50 are assumed to be in the
+	  # 2000's. Years between 51 and 99 are assumed to 
+	  # be in the 1900's. 
         if ($year > 50 && $year < 100) {
 		$year += 1900;
 	  }
@@ -415,6 +927,8 @@
 		$year += 2000;
 	  }
         $db_date = $year . $month . $day;
+
+	  # Clean up date given in HTML form
         ($month, $day, $year) = split(/\//, $form_value);
         $month = "0" . $month if (length($month) < 2);
         $day = "0" . $day if (length($day) < 2);
@@ -425,6 +939,10 @@
 		$year += 2000;
 	  }
         $form_date = $year . $month . $day;
+
+                # If any of the date comparisons match
+                # then a 0 is returned to let the submit_query
+                # routine know that a match was found.
         if ($c_op eq ">") {
           return 0 if ($form_date > $db_date); }
         if ($c_op eq "<") {
@@ -437,6 +955,10 @@
           return 0 if ($form_date != $db_date); }
         if (($c_op eq "=") || ($c_op eq "==")) {
           return 0 if ($form_date == $db_date); }
+                # 
+                # If the data type is a number
+                # then we perform normal number
+                # comparisons in Perl.
       } elsif ($c_type =~ /number/i) {
         if ($c_op eq ">") {
           return 0 if ($form_value > $db_value); }
@@ -450,6 +972,15 @@
           return 0 if ($form_value != $db_value); }
         if (($c_op eq "=") || ($c_op eq "==")) {
           return 0 if ($form_value == $db_value); }
+
+	# String comparisons that are not equal done on 
+	# whole fields.
+                # If the data type is a string
+                # then we take the operators and
+                # apply the corresponding Perl string
+                # operation. For example, != is ne,
+                # > is gt, etc.
+                # 
       } else { 
         if ($c_op eq ">") {# $c_type is a string
           return 0 if ($form_value gt $db_value); }
@@ -464,16 +995,67 @@
         if ($c_op eq "==") {
           return 0 if ($form_value eq $db_value); }
       }    
-    }
+    } # End of foreach $form_field
     
-  } else { 
+  } else { # End of case 2, Begin Case 3
+                # Case 3: The data type is a string and
+                #         the operator is =. This is
+                #         more complex because we need
+                #         to check whether our string
+                #         matching matches whole words
+                #         or is case sensitive.
+                # 
+                #         In otherwords, this is a more
+                #         "fuzzy" search.
+                # 
+                # arguments: $exact_match, $case_sensitive
+                #            affect the search
+                # In addition, the form_value will be split
+                # on whitespace so that white-space separated
+                # words will be searched separately.
+                # 
+                # Take the words that were entered and parse them into
+                # an array of words based on word boundary (\s+ splits on
+                # whitespace) 
+
     @word_list = split(/\s+/,$form_value);
+
+                # Again, we go through the fields in the
+                # database that are checked for this 
+                # particular criteria
+                # definition.
+
     foreach $db_index (@criteria_fields)
     {
+                # Obtain the value of the database field
+                # we are currently matching against.
+
       $db_value = $fields[$db_index];
       $not_found = "yes";
+ 
+                # $match_word is a place marker for the words
+                # we are going to be looking for in the database row
+                # $x is a place marker inside the for loops.
+
       local($match_word) = "";
       local($x) = "";
+
+                ####### START OF KEYWORD SEARCH #####
+                # 
+                # This routine is the same as the HTML
+                # Search Engine find_keywords subroutine
+                #
+                # Basically, the deal is that as the
+                # words get found, they get removed
+                # from the @word_list array.
+                # 
+                # When the array is empty, we know
+                # that all the keywords were found.
+                # 
+                # We will later celebrate this
+                # event by returning the fact that
+                # a match was found for this criteria.
+                #  
       if ($case_sensitive eq "on") {
           if ($exact_match eq "on") {
               for ($x = @word_list; $x > 0; $x--) {
@@ -481,16 +1063,16 @@
                   $match_word = $word_list[$x - 1];
                   if ($db_value =~ /\b$match_word\b/) {
                       splice(@word_list,$x - 1, 1);
-                  } 
-              } 
+                  } # End of If
+              } # End of For Loop
           } else {
               for ($x = @word_list; $x > 0; $x--) {
                   $match_word = $word_list[$x - 1];
                   if ($db_value =~ /$match_word/) {
                       splice(@word_list,$x - 1, 1);
-                  } 
-              } 
-          } 
+                  } # End of If
+              } # End of For Loop
+          } # End of ELSE
       } else {
           if ($exact_match eq "on") {
               for ($x = @word_list; $x > 0; $x--) {
@@ -498,32 +1080,55 @@
                   $match_word = $word_list[$x - 1];
                   if ($db_value =~ /\b$match_word\b/i) {
                       splice(@word_list,$x - 1, 1);
-                  } 
-              } 
+                  }  # End of If 
+              } # End of For Loop
           } else {
               for ($x = @word_list; $x > 0; $x--) {
                   $match_word = $word_list[$x - 1];
                   if ($db_value =~ /$match_word/i) {
                       splice(@word_list,$x - 1, 1);
-                  } 
-              } 
-          } 
+                  } # End of If
+              } # End of For Loop
+          } # End of ELSE
       }
-    } 
+                ####### END OF KEYWORD SEARCH #######
+
+    } # End of foreach $db_index
+
+                # If there is nothing left in the word_list
+                # we want to say that we found the word
+                # in the $db_value. Thus, $not_found is set to
+                # "no" in this case.
+
     if (@word_list < 1) 
     {
       $not_found = "no";
     }
-  } 
+
+  } # End of case 3
+
+                # If not_found is still equal to yes,
+                # we return a 1, indicating that the
+                # criteria was not satisfied
+                # 
+                # If not_found is not yes, then 
+                # we return that a successful match
+                # was found (0).
+                # 
   if ($not_found eq "yes")
   {
     return 1;
   } else {
     return 0;
   }
-} 
+} # End of flatfile_apply_criteria
+
+#######################################################################
+# Some other routines that are not used for flatfile database but 
+# may be useful or required to implement for other databases
 #######################################################################
 sub init_agora_database_library {
+ #define the product file and its location
  $db_file_defs{"PRODUCT"} = "$sc_data_file_path";
  }
 #######################################################################
@@ -540,12 +1145,15 @@
 #######################################################################
 sub open_a_database {
   local ($name,$path) = @_;
+ # database is opened on demand in flatfile routines
+ # but we need to set the db_file_defs for it!
    if ($path eq '') { $ path = "$sc_data_file_dir";}
   $db_file_defs{"$name"} = "$path/$name";
   return;
  }
 #######################################################################
 sub init_a_database {
+ # required for real database implementations
   local (
    $name,
    $path,
@@ -553,6 +1161,9 @@
    $fields_to_index_as_is,	# optional
    @fieldnames			# optional ?
   ) = @_;
+# In a real db implementation, if just the name (and perhaps path) are
+# given and the database exists, keep the current definition and only
+# erase all records currently in the database (leave indexing alone.)
   &codehook("init_a_database_top");
   if ($db_file_defs{"$name"} ne '') {
   # already 'opened', so we know where to init the file
@@ -563,19 +1174,27 @@
    }
   $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;
  }
 #######################################################################
+
 sub close_all_databases {
  # is a no-op, databases opened/closed on demand in flatfile routines
  }
+
 #######################################################################
+
 sub match_pattern_in_database {
+ # is a no-op, not currently used, but should be in here!  Especially
+ # needed for customer database lookups by phone number or email addr 
+ # returns list of keys in the @array pointed to by *keylist
  local ($db_name,$db_field,$pattern,$case_sens_bool,*keylist) = @_;
  return;
  }
+
 #######################################################################
    # Free Contribution by Mark S. (MAS aka Algernon), an AgoraCart Pro member.
    # 
@@ -593,15 +1212,19 @@
     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 ;
-    } 
+    } # foreach
+
     return @patch_db_query_criteria ;
+
 }
 ############################################################
 #
@@ -642,31 +1265,66 @@
 } 
 ############################################################
 # 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;
+
 }
+
 ############################################################
+#
+# get a row from product database version 2.  Added for alt db data
+#
+############################################################
+
 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 = "";
+                #
+                # First we open the data file.
+                # If the open fails. We call the
+                # file open error routine in order
+                # to log the error
+                #
+
   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__);
+
+                #
+                # Each line in the data file
+                # is read into $line variable.
+                # 
+                # Then, it is split into
+                # fields which are placed in 
+                # @db_rows.
+                #
+                # If it turns out that the 
+                # product id matches the
+                # product id in the database
+                # row, the while loop will
+                # stop, and the db_row will
+                # contain the row matching
+                # the product id.
+                #
   while (($line = <DATAFILE>) &&
          ($product_id ne $db_product_id)) {
     chop($line);
@@ -677,14 +1335,29 @@
       $db_cache{$db_product_id}=$save_the_line;
      }
   }
+#
+# Save result, in case we need it later
   if ($product_id eq $db_product_id) { 
     $db_raw_line = $save_the_line;
 	$result = "$db_row[$data_field_thingy]";
   }
+
   close (DATAFILE);
+
   return $result;
+
 } 
 #######################################################################
+                #
+                # $sc_db_lib_was_loaded is set to "yes"
+                # to make sure that the db library
+                # is not loaded more than once within
+                # the store script. The main 
+                # store script checks to see
+                # if this variable is set before it
+                # attempts to require this library.
+                #
+
 if ($sc_db_lib_was_loaded ne "yes") {
   $sc_db_lib_was_loaded = "yes";
   &init_agora_database_library;
@@ -693,3 +1366,4 @@
  }
 #############################################################################
 1;
+
diff -x .svn -aruN 5.2.004.src/library/agora_html_lib.pl 5.2.005.src/library/agora_html_lib.pl
--- 5.2.004.src/library/agora_html_lib.pl	2008-06-26 07:48:44.000000000 -0500
+++ 5.2.005.src/library/agora_html_lib.pl	2008-09-02 03:06:15.000000000 -0500
@@ -1,7 +1,9 @@
 #######################################################################
-$versions{'agora_html_lib.pl'} = "5.2.003";
+
+$versions{'agora_html_lib.pl'} = "5.5.008";
+
 #######################################################################
-if ($sc_main_script_post_url eq '') { 
+if ($sc_main_script_post_url eq '') { # init this, just in case
   $sc_main_script_post_url = $sc_main_script_url;
  }
 #######################################################################
@@ -12,11 +14,12 @@
   undef(%agora_original_values);
   $sc_server_cookies_loaded = '1';
   if (-e "$sc_server_cookie_path" && -r "$sc_server_cookie_path"){ 
+   # file is there, now try to require it in a not-fatal way
     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 (&get_agora('LAST_VISIT_TIMESTAMP') eq '') { # new shopping session
     if ($sc_shall_i_log_accesses eq "yes") {
       &log_access_to_store;
      }
@@ -62,6 +65,8 @@
  }
 #########################################################################
 sub chk_agora {
+ # return 1 if the cookie has not changed since loading, 
+ # null otherwise
   local($inx) = @_;
   if ($agora_original_values{$inx} eq $agora{$inx}) {
     return '1';
@@ -70,7 +75,9 @@
    }
  }
 #########################################################################
-sub ain_agora {
+sub ain_agora { # add if new to agora cookies
+ # if this item is not yet stored, and it is not null, then store it
+ # return 1 if stored, null otherwise
   local($inx,$val) = @_;
   if ((&get_agora($inx) eq '') && ($val ne '')) {
     &set_agora($inx,$val);
@@ -111,7 +118,7 @@
   return sort(keys %agora);
  }
 #########################################################################
-sub str_encode { 
+sub str_encode { # encode a string for cgi or other purposes
   local($str)=@_;
   local($mypat)='[\x00-\x1F"\x27#%/+;<>?\x7F-\xFF]';
   $str =~ s/($mypat)/sprintf("%%%02x",unpack('c',$1))/ge;
@@ -119,14 +126,14 @@
   return $str;
  }
 #######################################################################
-sub str_decode { 
+sub str_decode { # decode a string for cgi or other purposes
   local($str)=@_;
   $str =~ tr/+/ /;
   $str =~ s/%(..)/pack("c",hex($1))/ge;
   return $str;
  }
 #######################################################################
-sub load_file_lines_to_str {
+sub load_file_lines_to_str {# load a text file
   local ($location) = @_;
   local (@lines)=();
   open (XX_FILE, "<$location");
@@ -135,7 +142,7 @@
   return join("",@lines);
  }
 #######################################################################
-sub load_file_to_str {
+sub load_file_to_str {# load a file in binary mode
   local ($location) = @_;
   local ($content)='';
   open (XX_FILE, "<$location");
@@ -161,19 +168,26 @@
   return $field;
  }
 #######################################################################
-sub load_opt_file_engine {
+sub load_opt_file_engine { # do the actual loading of options file(s)
   local($field) = @_;
   local($very_first_part,$stuff_after,$arg,$newpath,$myans,$tack_on);
   local(%file_list);
+
+ # DELUXE feature ... take only the part between <h3>--cut here--</h3> 
+ # tokens, so if there are any "load option file" tokens we must
+ # perform special maint on them ... put the stuff between the cut tags
+ # where the load token is and tack the rest on at the end (so all
+ # agorascript is still there someplace.)
+
   while ($field =~ /(%%Load_Option_File )([^%]+)(%%)/i) {
     $arg = $2;
     $arg =~ s/ //g;
-    if ($arg =~ /,/) {
+    if ($arg =~ /,/) { # there is a list, break it down
       $arg =~ s/,/%%%%Load_Option_File /g;
       $myans = "%%Load_Option_File $arg%%";
      } else {
       $newpath = "$sc_options_directory_path/$arg";
-      if ($file_list{$newpath} eq '') {
+      if ($file_list{$newpath} eq '') { # prevent reloads
         # 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.
@@ -240,34 +254,67 @@
 sub add_csv {
  local ($what, $str) = @_;
 
- if (($what =~ /\,/) || ($what =~ /\"/)) {
+ if (($what =~ /\,/) || ($what =~ /\"/)) { #need to quote it
   $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 = $@;
-   if ($err_code ne "") { 
+   if ($err_code ne "") { #script died, error of some kind
      &update_error_log("$whoami $err_code ",$file,$line);
      $result="";
     }
   }
+
  return $result;
+
 }
 #######################################################################
+#                    product_page_header Subroutine                   #
+#######################################################################
+
+    # product_page_header is used to display the shared
+    # HTML header used for database-based product pages.  It
+    # takes one argument, $page_title, which will be used to
+    # fill the data between the <TITLE> and </TITLE>.
+    # Typically, this value is determined by 
+    # $sc_product_display_title in agora.setup.db.
+    # 
+    # The subroutine is called with the following syntax:
+    #
+    # &product_page_header("Desired Title");
+
+
 sub product_page_header {
+    # First, the script assigns the incoming argument to the
+    # local variable $page_title
+
 local ($page_title,$prod_message) = @_;
+
+    # Then, it assigns the text of all of the hidden fields 
+    # that may need to be passed as state information to
+    # $hidden_fields using the make_hidden_fields subroutine
+    # which will be discussed later.
+
 local ($hidden_fields) = &make_hidden_fields;
 local ($my_hdr);
+    # Next, the HTML code is sent to the browser including the
+    # page title and the hidden fields dynamically inserted.
 my $temp_product_title = $form_data{'product'};
 $temp_product_title =~ s/_/ /g;
 $my_hdr = qq~$sc_doctype
@@ -277,48 +324,129 @@
   $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;
+
+    # Next, we will grab $sc_product_display_header which is a
+    # preformatted string defined in agora_user_lib.pl (setup in the store layout manager) 
+    #  and use printf to put the entire contents of
+    # @sc_db_display_fields in place of the format tags (%s).
+    # The function of this will be to display the header
+    # categories which products will follow.
+    #
+    # Consider the following example from web_store.setup.db:
+    # $sc_product_display_header = qq!
+    #
+    #  <TABLE BORDER = "0">
+    #  <TR>
+    #  <TH>Quantity</TH>
+    #  <TH>%s</TH>
+    #  <TH>%s</TH>
+    #  </TR>
+    #  <TR>
+    #  <TD COLSPAN = "3"><HR></TD>
+    #  </TR>!;
+    #
+    # @sc_db_display_fields = ("Image (If appropriate)",
+    #                          "Description");
+    #
+    # In this case, the strings "Image (If appropriate)" and
+    # "Description" will be substituted by the printf
+    # function for the two %s's in the TABLE header defined in
+    # $sc_product_display_header.
+
 if ($prod_message ne "") {
   print "$prod_message\n";
  }
 printf($sc_product_display_header, @sc_db_display_fields);
+
 }
 #######################################################################
+#                    product_page_footer Subroutine                   #   
+#######################################################################
+
+    # product_page_footer is used to generate the HTML page
+    # footer for database-based product pages.  It takes two
+    # arguments, $db_status and $total_rows_returned and is
+    # called with the following syntax:
+    # 
+    # &product_page_footer($status,$total_row_count);
+
+
 sub product_page_footer {
+
 local($keywords,$zmessage);
 $keywords = $form_data{'keywords'};
+
 $keywords =~ s/ /+/g;
+
+    # $db_status gives us the status returned from the database
+    # search engine and $total_rows_returned gives us the
+    # actual number of rows returned.  $warn_message which
+    # is first initialized, will be used to generate a warning
+    # that the user should narrow their search in case
+    # too many rows were returned.
+
 local($prod_message) = @_;
+
 $zmessage = qq~
 $sc_product_display_footer
+
 $prod_message~;
+
 &codehook("product_page_footer_top");
 print $zmessage;
 &StoreFooter;
+
+
 $zmessage=qq~
 </body>
 </html>~;
+
 &codehook("product_page_footer_bot");
 print $zmessage;
+
 }
 
 sub product_message {
+
 local($keywords);
 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'}; # we change this value here temporarily
+
 $keywords =~ s/ /+/g;
+
+    # $db_status gives us the status returned from the database
+    # search engine and $total_rows_returned gives us the
+    # actual number of rows returned.  $warn_message which
+    # is first initialized, will be used to generate a warning
+    # that the user should narrow their search in case
+    # too many rows were returned.
+
+    # If the database returned a status, the script checks to
+    # see if it was like the string "max.*row.*exceed".  If
+    # so, it lets the user know that they need to narrow their
+    # search.
+
 if ($db_status ne "") 
 {
+
   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 {
@@ -334,6 +462,7 @@
  } else {
   $my_prevHits = $prevHits;
  }
+
 if ($my_first == $my_last) {
   $warn_message .= "Found $rowCount items, showing " .
   $my_last . ". &nbsp;&nbsp;";
@@ -341,6 +470,7 @@
   $warn_message .= "Found $rowCount items, showing " .
   ($my_first) . " to " . $my_last . ". &nbsp;&nbsp;";
  }
+
     if($form_data{'next'} > "0")
     {
     $form_data{'next'}=$prevCount;
@@ -350,6 +480,7 @@
 <a href=$href_info>Previous $my_prevHits Matches</a>&nbsp;&nbsp;
 !;
     }
+
     if ($maxCount == $rowCount-1)
     {
       $nextHits = (@database_rows-$maxCount);
@@ -362,9 +493,12 @@
 <a href=$href_info>Last Match</a>&nbsp;&nbsp;
 !;
       }
+
     }
+
   if ($maxCount < $rowCount && $maxCount != $rowCount-1)
   {
+
     if ($maxCount >= $rowCount-$nextHits )
     {
     $lastCount = $rowCount-$maxCount;
@@ -386,14 +520,53 @@
   }
 
   }
+
         $warn_message .= "</td></tr></table>\n";
   $warn_message .= "</div>";
+
+
+
+
   }
+
 }
-$form_data{'next'} = $save_next;
+
+    # Then the script displays the footer information defined
+    # with $sc_product_display_footer in agora.setup.db and
+    # adds the final basic HTML footer.  Notice that one of the
+    # submit buttons, "Return to Frontpage" is isolated into
+    # the $sc_no_frames_button variable.  This is because in
+    # the frames version, we do not want that option as it
+    # will cause an endlessly fracturing frame system.  Thus,
+    # in a frame store, you would simply set 
+    # $sc_no_frames_button to "" and nothing would print here.
+    # Otherwise, you may include that button in your footer
+    # for ease of navigation.  The variable itself is defined
+    # in agora.setup.db.  The script also will print the
+    # warning message if there is a value for it.
+
+$form_data{'next'} = $save_next;# must restore our original state!
 return $warn_message;
+
 }
+
+#######################################################################
+#                 html_search_page_footer Subroutine                  #
 #######################################################################
+
+    # html_search_page_footer is used to generate the HTML
+    # footer for HTML-based product pages when the script
+    # must perform a keyword search and generate a list of
+    # hits. It is called with no argumnets with the following
+    # syntax:
+    #
+    # &html_search_page_footer;
+    #
+    # Notice again the use of $sc_no_frames_button in place of
+    # the "Return to Frontpage" button as discussed in the
+    # last section.
+
+
 sub html_search_page_footer {
 print qq~
 <div align="center">
@@ -406,10 +579,17 @@
 </html>~;
 }
 #######################################################################
+#                    standard_page_header Subroutine                  #
+#                                                                     #
+# Syntax: &standard_page_header("TITLE");                             #
+#######################################################################
+
 sub standard_page_header {
+
  local($type_of_page) = @_;
  local ($hidden_fields) = &make_hidden_fields;
  local($header);
+
  $header = qq~$sc_doctype
 <html>
 <head>
@@ -419,10 +599,27 @@
 </head>
 <body>
 ~;
+
  &codehook("standard_page_header");
  print $header;
+
 }
 #######################################################################
+#                    modify_form_footer Subroutine                    #   
+#######################################################################
+
+    # modify_form_footer is used to generate the HTML footer
+    # code for the "modify quantity of items in the cart" form
+    # page.  It takes no arguments and is called with the
+    # following syntax:
+    #
+    # &modify_form_footer;
+    #
+    # As usual, we will admit the "Return to Frontpage" button
+    # only if we are not using frames by defining it with the
+    # $sc_no_frames_button in agora.setup.db.
+
+
 sub modify_form_footer {
 local($footer)="";
 open (MODIFYFOOTER, "$sc_templates_dir/change_quantity_footer.inc") ||
@@ -436,8 +633,25 @@
 &codehook("modify_form_footer");
 print $footer;
 &StoreFooter;
+
 }
+
+#######################################################################
+#                    delete_form_footer Subroutine                    #
 #######################################################################
+
+    # delete_form_footer is used to generate the HTML footer
+    # code for the "delete items from the cart" form
+    # page.  It takes no arguments and is called with the
+    # following syntax:
+    #
+    # &delete_form_footer;
+    #
+    # As usual, we will admit the "Return to Frontpage" button
+    # only if we are not using frames by defining it with the
+    # $sc_no_frames_button in agora.setup.db.
+
+
 sub delete_form_footer {
 local($footer)="";
 open (DELETEFOOTER, "$sc_templates_dir/delete_items_footer.inc") ||
@@ -451,17 +665,37 @@
 &codehook("delete_form_footer");
 print $footer;
 &StoreFooter;
+
 }
 #######################################################################
+#                       cart_footer Subroutine                        #
+#######################################################################
+
+    # cart_footer is used to generate the HTML footer
+    # code for the "view items in the cart" form
+    # page.  It takes no arguments and is called with the
+    # following syntax:
+    #
+    # &cart_footer;
+    #
+    # As usual, we will admit the "Return to Frontpage" button
+    # only if we are not using frames by defining it with the
+    # $sc_no_frames_button in agora.setup.db.
+
+
 sub cart_footer {
 local($grand_total,$quantity) = @_;
 local($file_title,$footer)="";
+
+# Use the empty cart footer if it is there and qty=0
 $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 .= $_;
  }
@@ -470,9 +704,13 @@
 &codehook("cart_footer");
 print $footer;
 &StoreFooter;
+
 }
 #######################################################################
+#
+#######################################################################
 sub script_and_substitute_footer {
+
  local ($footer) = @_;
  local($offlineSecureURL)="";
 
@@ -483,6 +721,7 @@
 <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~
@@ -492,32 +731,54 @@
 <input type=hidden name="cart_id" value="$cart_id">
 ~;
   }
+
   $footer = &agorascript($footer,"pre","sub modify_form_footer",
   __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 =~ s/%%ZZZ%%/$cart_id/;
   }
+
   $footer = &agorascript($footer,"post","sub modify_form_footer",
   __FILE__,__LINE__);
   $footer = &agorascript($footer,"","sub modify_form_footer",
   __FILE__,__LINE__);
+
   return $footer;
+
  }
 #######################################################################
+#                    bad_order_note Subroutine                        #
+#######################################################################
+
+    # bad_order_note generates an error message for the user
+    # in the case that they have not submitted a valid number
+    # for a quantity.  It takes no argumnets and is called
+    # with the following syntax:
+    # 
+    # &bad_order_note;
+
+
 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!
 <div align="center">
@@ -536,84 +797,119 @@
 !;
 }
 &StoreFooter;
+
 $sc_bad_order_note_alt = '';
+
 &call_exit;
+
 }
 #######################################################################
+#                    make_hidden_fields Subroutine                    #
+#######################################################################
+
+    # make_hidden_fields is used to generate the hidden fields
+    # necessary for maintaining state.  It takes no arguments
+    # and is called with the following syntax:
+    #
+    # &make_hidden_fields;
+
+
 sub make_hidden_fields {
+
 local($hidden,$db_query_row,$temp,$db_form_field);
 local($special_stuff)='';
+
 &xss_FormData_cleaner;
+
+    # $hidden is defined initially as containing the cart_id
+    # and page hidden tags which are necessry state variables
+    # on EVERY page in the cart.
+    #
+    # The script then goes through  checking to see which
+    # optional state variables it has received as incoming
+    # form data.  For each of those, it adds a hidden input
+    # tag.
+
 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!;
-if ($sc_global_bot_tracker eq '1') {
-$hidden .= qq!<input type="hidden" name="page" value="$form_data{'page'}">!;
-}
-else {
-$hidden .= qq!<input type="hidden" name="cart_id" value="$cart_id">
+
+$hidden = qq!$special_stuff
+  <input type="hidden" name="cart_id" value="$cart_id">
   <input type="hidden" name="page" value="$form_data{'page'}">!;
-}
+
+
 if ($form_data{'keywords'} ne "") 
 {
 $temp = $form_data{'keywords'};
-$temp =~ s/\0/ /g; 
-$temp =~ s/(\s+)/ /g; 
-$temp =~ s/(^\s)//g;
+$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
 $hidden .= qq!
 <input type="hidden" name="keywords" value="$temp">!;
 }
+
 if ($form_data{'cartlink'} ne "") 
 {
 $hidden .= qq!
 <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'}">!;
 }
+
 if ($form_data{'ppinc'} ne "") 
 {
 $hidden .= qq!
 <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'}">!;
 }
+
 if ($form_data{'exact_match'} ne "") 
 {
 $hidden .= qq!
 <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'}">!;
 }
+
 # 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];
@@ -622,15 +918,42 @@
 $hidden .= qq!
 <input type="hidden" name="$db_form_field" value="$form_data{$db_form_field}">!;
 }
+
 }
+
 &codehook("make_hidden_fields_bot");
 return ($hidden);
+
+# End of make_hidden_fields
 }
+
+#######################################################################
+#                     make_href_fields Subroutine                     #
 #######################################################################
+
+    # make_href_fields is used to generate the href fields
+    # necessary for maintaining state.  It takes no arguments
+    # and is called with the following syntax:
+    #
+    # &make_href_fields;
+
+
 sub make_href_fields {
+
 local($href) = "";
 local($db_query_row, $db_form_field, $temp);
+
+    # $hidden is defined initially as containing the cart_id
+    # and page hidden tags which are necessry state variables
+    # on EVERY page in the cart.
+    #
+    # The script then goes through  checking to see which
+    # optional state variables it has received as incoming
+    # form data.  For each of those, it adds a hidden input
+    # tag.
+
 &xss_FormData_cleaner;
+
 my $temp_first_amper_count = 1;
 
 if ($sc_global_bot_tracker ne "1") {
@@ -768,13 +1091,31 @@
 }
 
 }
+
 &codehook("make_href_fields_bot");
 return ($href);
+
+# End of make_href_fields
 }
+
+
+#######################################################################
+#                   PrintNoHitsBodyHTML Subroutine                    #
 #######################################################################
+
+    # PrintNoHitsBodyHTML is utilized by the HTML-based store
+    # search routines to produce an error message in case no
+    # hits were found based on the client-defined keyords
+    # It is called with no argumnets and the following syntax:
+    #
+    # &PrintNoHitsBodyHTML;
+
+
 sub PrintNoHitsBodyHTML {
-print qq~$sc_docytpe
+
+print qq~$sc_doctype
 <html>
+
 <head>
   <title>Search Found No Entries</title>
   $sc_standard_head_info
@@ -784,9 +1125,11 @@
 </head>
 <body>
 ~;
+
 &StoreHeader;
 
 # edited error message and moved to managers for customization. added by Mister Ed August 15, 2006
+# also need a default jsut in case not set in managers
 if ($sc_search_error_message eq "") {
     $sc_search_error_message = qq~I'm sorry, no matches were found. Please try your search again.~;
 }
@@ -802,8 +1145,14 @@
 </body>
 </html>
 !;
+
 }
 #######################################################################
+#                     capture_STDOUT Subroutine                       #
+#######################################################################
+  
+  # This subroutine redirects STDOUT to a file
+
 sub capture_STDOUT {
  $capture_STDOUT++;
  $CAPTURE_SAVE[$capture_STDOUT] = select(); #current value of STDOUT;
@@ -811,32 +1160,46 @@
  open(MYSTDOUT,">$sc_capture_path$capture_STDOUT");
  select(MYSTDOUT);
  $CAPTURE_CURRENT[$capture_STDOUT] = MYSTDOUT;
-}
+} #end of sub capture_STDOUT
+#######################################################################
+#                    uncapture_STDOUT Subroutine                      #
 #######################################################################
+  
+  # This subroutine un-redirects STDOUT to a file, returns that file's
+  # contents in a string.
+
 sub uncapture_STDOUT {
  local($contents)="";
- if ($capture_STDOUT < 1) { 
+
+ if ($capture_STDOUT < 1) { #not already doing it, nada to return 
    return "";
   }
- select($CAPTURE_SAVE[$capture_STDOUT]); 
+ select($CAPTURE_SAVE[$capture_STDOUT]); #previous value of STDOUT;
  close($CAPTURE_CURRENT[$capture_STDOUT]);
 {
- open(MYFILE,"$sc_capture_path$capture_STDOUT"); 
+ open(MYFILE,"$sc_capture_path$capture_STDOUT"); #now need to read it
  local $/=undef;
  $contents=<MYFILE>;
  close(MYFILE);
 }
- unlink("$sc_capture_path$capture_STDOUT"); 
+ unlink("$sc_capture_path$capture_STDOUT"); #and need to remove it
  $capture_STDOUT = $capture_STDOUT - 1;
  return "$contents";
-} 
+
+} #end of sub uncapture_STDOUT
+#######################################################################
+#                       agorascript Subroutine                        #
 #######################################################################
+  
+# This subroutine runs <!--agorascript scripts
+
 sub agorascript {
  local ($str, $type, $zhtml, $zfile, $zline) = @_;
  local ($script_start, $script_start_short, $part1, $part1a, $part2)="";
  local ($kount,$iterations)=0;
  local ($err_code,$return_val,$ztype)="";
  local ($on_agorascript_error)="warn exit ";
+ 
  if ($type ne "") {
    $ztype = "-$type";
   } else {
@@ -845,11 +1208,15 @@
  $script_start_short = "agorascript$ztype";
  $script_start = "<!--agorascript$ztype";
  $script_end = "-->";
+
+# delete any agorascript continuation markers
 $str =~ s/<!--AGSC//ig;
 $str =~ s/AGSC-->//ig;
-$str =~ s/<!--  agorascript/<!-- agorascript/g;
-$str =~ s/<!-- agorascript/<!--agorascript/g;
+
+$str =~ s/<!--  agorascript/<!-- agorascript/g;# so either works OK
+$str =~ s/<!-- agorascript/<!--agorascript/g;# so either works OK
 $str =~ s/<!--agorascript$ztype\n/<!--agorascript$ztype /g;# -->
+
 $part1=$str;
 while (($iterations < 25) && ($str =~ /${script_start_short} /)) {
  $iterations++;
@@ -857,18 +1224,24 @@
  ($part1,$part2) = split(/${script_start} /,$str,2);
  while ($part2 ne "") {
   ($the_script,$part2) = split(/$script_end/,$part2,2);
-  $the_script =~ /([^\xFF]*)/;
+# Taint mode needs to be cleared ... potential security hole here is 
+# small, as we only do this routine if we read the file in from our
+# own directory of files we create ourselves.
+# however, the eval itself will still fail if an unsafe operation
+# is attempted with a tainted variable.
+  $the_script =~ /([^\xFF]*)/;# should I make this ^M???
   $the_script = $1;
+# now run the script 
   if ($sc_use_agorascript =~ /yes/i) {
    $return_val = eval($the_script);
    $err_code = $@;
   }
-  if ($err_code ne "") { 
-    if ($on_agorascript_error =~ /warn/i) { 
+  if ($err_code ne "") { #script died, error of some kind
+    if ($on_agorascript_error =~ /warn/i) { # error log
        &update_error_log("agorascript$ztype #$iterations.$kount error" .
                          "($zhtml) $err_code ",$zfile,$zline);
       }
-    if ($on_agorascript_error =~ /screen/i) { 
+    if ($on_agorascript_error =~ /screen/i) { # error to STDOUT
        print "<CENTER><DIV ALIGN=LEFT><TABLE WIDTH=550><TR><TD><PRE>\n";
        print "AGORASCRIPT ERROR:\n";
        print "agorascript-$type instance #$kount\n";
@@ -876,7 +1249,7 @@
        print "Error: $err_code\n";
        print "</PRE></TD></TR></TABLE></DIV></CENTER>\n"; 
       }
-    if ($on_agorascript_error =~ /exit/i) { 
+    if ($on_agorascript_error =~ /exit/i) { # error log
       open(ERROR, $error_page);
       while (<ERROR>) {
         print $_;
@@ -884,49 +1257,64 @@
       close (ERROR);
       &call_exit;
      }
-    if ($on_agorascript_error =~ /discard/i) { 
-      $return_val = "";
+    if ($on_agorascript_error =~ /discard/i) { # error log
+      $return_val = ""; # discard the erroneous results
      }
    }
-  $part1 .= $return_val;
+  $part1 .= $return_val;# got here, so add the info
   $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;
-}
+ $str =~ s/<!--  agorascript-/<!-- agorascript-/g;# so either works OK
+ $str =~ s/<!-- agorascript-/<!--agorascript-/g;# so either works OK
+} # end of outter while
+
  return $part1;
+
 }
+
+#######################################################################
+#                       StoreHeaderFooter Subroutine                  #
 #######################################################################
+
+
 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);
 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";}
+
+# debug
+# if ($cart_id eq "") { print "EMPTY 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;
@@ -962,15 +1350,21 @@
 $the_file =~ s/%%TemplateName%%/$sc_headerTemplateName/ig;
 $the_file =~ s/%%sc_money_symbol%%/$sc_money_symbol/ig;
 $the_file =~ s/%%ButtonSetURL%%/$sc_buttonSetURL/ig;
+
 if ($sc_global_bot_tracker ne "1") {
 while ($the_file =~ /%%ZZZ%%/) {
   $the_file =~ s/%%ZZZ%%/$cart_id/;
 }
 }
+
 $the_file = &agorascript($the_file,"post","$ztitle",__FILE,__LINE__);
+
 return $the_file;
+
 }
 #######################################################################
+#                       StoreHeader Subroutine                        #
+#######################################################################
 sub StoreHeader {
  print &GetStoreHeader;
 }
@@ -980,35 +1374,45 @@
 # 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 ($sc_convert_product_token_underlines ne "") {
+   if ($sc_convert_product_token_underlines ne "") {
     $myproduct =~ s/\_/$sc_convert_product_token_underlines/g;
    }
     if (-f "$sc_templates_dir/header-$myproduct.inc") {
        $temp_header_thingy = "$sc_templates_dir/header-$myproduct.inc";
       }
  } 
+# end of dynamic header
+
  return &StoreHeaderFooter("$temp_header_thingy","Store Header");
 }
 #######################################################################
+#                       StoreFooter Subroutine                        #
+#######################################################################
+
 sub StoreFooter {
  print &GetStoreFooter;
 }
 sub GetStoreFooter {
+
 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 ($sc_convert_product_token_underlines ne "") {
-    $myproduct =~ s/\_/$sc_convert_product_token_underlines/g;
+   if ($sc_convert_product_token_underlines ne "") {
+     $myproduct =~ s/\_/$sc_convert_product_token_underlines/g;
    }
     if (-f "$sc_templates_dir/footer-$myproduct.inc") { 
        $temp_footer_thingy = "$sc_templates_dir/footer-$myproduct.inc";
       }
  } 
+# End of dynamic footer
+
  return &StoreHeaderFooter("$temp_footer_thingy","Store Footer");
 }
 #######################################################################
+#                    SecureStoreHeader Subroutine                     #
+#######################################################################
 sub SecureStoreHeader {
  print &GetSecureStoreHeader;
 }
@@ -1017,6 +1421,8 @@
         "Secure Store Header");
 }
 #######################################################################
+#                    SecureStoreFooter Subroutine                     #
+#######################################################################
 sub SecureStoreFooter {
  print &GetSecureStoreFooter;
 }
@@ -1025,13 +1431,17 @@
         "Secure Store Footer");
 }
 #######################################################################
+#                     load_cart_copy Subroutine                       #
+#######################################################################
 sub load_cart_copy {
 
  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 = $_;
@@ -1041,12 +1451,19 @@
  close(CART);
  $sc_cart_copy_made = "yes";
 }
+
 #######################################################################
+#                     save_cart_copy Subroutine                       #
+#######################################################################
+
 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";
@@ -1096,6 +1513,8 @@
          }
        }
      }
+  # reconstruct the options data in the cart row based on 'current' data
+  # also make adjustments to shipping and price fields
     $options_list = '';
     $options = '';
     undef(%to_do_list);
@@ -1121,9 +1540,9 @@
         $temp = $cart_option;
         $temp =~ s/\|/\~/g;
         $options_list .= $zkey . '*' . $temp;
-        if ((0 + $c_price) == 0) { 
+        if ((0 + $c_price) == 0) { #price zero, do not display it 
           $display_option_price = "";
-         } else { 
+         } else { # price non-zero, must format it
           $display_option_price = " " . &display_price($c_price);
          }
         if ($options ne "") { $options .= "$sc_opt_sep_marker"; }
@@ -1132,6 +1551,7 @@
      }
     $cart_row[$cart{'options_ids'}] = $options_list;
     $cart_row[$cart{'options'}] = $options;
+   # save the newly constructed cart row
     $cart_copy{$inx_into_cart_copy} = join('|',@cart_row);
    }
   if ($var_opt_used =~ /yes/i) {
@@ -1139,36 +1559,77 @@
    }
  }
 #######################################################################
+#                  create_display_fields Subroutine                   #
+#######################################################################
 # 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;}
+
+# create @display_fields, @item_ids, $itemID variables
+
+    # First, however, we must format the fields correctly.
+    # Initially, @display_fields is created which contains the
+    # values of every field to be displayed, including a
+    # formatted price field.
+
 @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]);
 }
+
+    # Then, the elements of the NAME field are created so that
+    # customers will be able to specify an item to purchase.
+    # We are careful to substitute double quote marks ("), and
+    # greater and less than signs (>,<) for the tags ~qq~,
+    # ~gt~, and ~lt~. The reason that this must be done is so
+    # that any double quote, greater than, or less than
+    # characters used in URL strings can be stuffed safely
+    # into the cart and passed as part of the NAME argumnet in
+    # the "add item" form.  Consider the following item name
+    # which must include an image tag.
+    #
+    # <INPUT TYPE = "text" 
+    #        NAME = "item-0010|Vowels|15.98|The letter A|~lt~IMG SRC = ~qq~Html/Images/a.jpg~qq~ ALIGN = ~qq~left~qq~~gt~"
+    #
+    # Notice that the URL must be edited. If it were not, how
+    # would the browser understand how to interpret the form
+    # tag?  The form tag uses the double quote, greater
+    # than, and less than characters in its own processing.
+
 @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);
+
+# dynamic ppinc layouts by category name
 $ppinc_root_name = 'productPage';
- if ($sc_use_category_name_as_ppinc_root eq "yes"  && $form_data{'ppinc'} ne "search" && $form_data{'ppinc'} ne "search2"  && $form_data{'ppinc'} eq "") { 
+ if ($sc_use_category_name_as_ppinc_root eq "yes"  && $form_data{'ppinc'} ne "search" && $form_data{'ppinc'} ne "search2" && $form_data{'ppinc'} eq "") { 
   my $myproduct = $database_fields[$db{'product'}];
   if ($sc_convert_product_token_underlines ne "") {
     $myproduct =~ s/\_/$sc_convert_product_token_underlines/g;
@@ -1180,7 +1641,7 @@
 &codehook("create_display_fields_bot");
 }
 #######################################################################
-sub itemID { 
+sub itemID { # used to allow an alternate %%itemID%% string using a token
  # like %%itemID-a%% in a productPage.inc file 
  local ($my_modifier) = @_;
  local (@stuff) = @item_ids;
@@ -1190,7 +1651,7 @@
  return "item-" . join("\|",@stuff);
 }
 #######################################################################
-sub prodID {
+sub prodID { # used to allow an alternate %%ProductID%% string using a 
  # token like %%prodID-a%% in a productPage.inc file 
  local ($my_modifier) = @_;
  local (@stuff) = @item_ids;
@@ -1200,7 +1661,7 @@
  return $stuff[0];
 }
 #######################################################################
-sub QtyBox { 
+sub QtyBox { # allow an alternate %%QtyBox%% string using a token
  # like %%QtyBox-a,1%% in a productPage.inc file 
  local ($my_modifier,$qty) = @_;
  local ($my_box) = $qty_box_html;
@@ -1214,10 +1675,14 @@
  return $my_box;
 }
 #######################################################################
+#                    displayProductPage Subroutine                    #
+#######################################################################
 sub displayProductPage {
  print &prep_displayProductPage(&get_sc_ppinc_info);
 }
 #######################################################################
+#                 prep_displayProductPage Subroutine                  #
+#######################################################################
 sub prep_displayProductPage {
 local ($the_whole_page) = @_;
 local ($keywords, $imageURL, $hidden_fields, $href_fields, $my_ppinc);
@@ -1229,6 +1694,8 @@
 local ($xarg,$xarg1,$xarg2);
 local ($myans)="";
 local ($auto_opt_no)=0;
+local ($inv)=""; # inventory
+
 if ($sc_default_qty_to_display ne '') {
   $qty = $sc_default_qty_to_display;
  }
@@ -1236,24 +1703,52 @@
 if ($sc_convert_product_token_underlines ne "") {
   $myproduct =~ s/\_/$sc_convert_product_token_underlines/g;
  }
-$keywords = $form_data{'keywords'}; 
+$keywords = $form_data{'keywords'}; # for href, not <FORM>, fields
 $keywords =~ s/ /+/g;
+
 $href_fields = &make_href_fields;
 $hidden_fields = &make_hidden_fields;
 $cart_id_for_html = "%%ZZZ%%";
+
+# Need to load option file first, if it has agorascript then
+# we must be able to execute it
 $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");
+
+# checks inventory levels using user defined userfield
+# added by Mister Ed @ K-Factor Technologies Jan 17, 2005
+if ($sc_db_index_for_inventory) {
+if ($database_fields[$db{$sc_db_index_for_inventory}] > 0)
+{
+$inv = "$display_fields[4]";
+    if ($sc_show_inventory_status =~ /yes/i) {
+        $inv .= "<br><font class=ac_product_available>$sc_inventory_status_text $database_fields[$db{$sc_db_index_for_inventory}]<\/font>";
+    }
+} elsif ($database_fields[$db{$sc_db_index_for_inventory}] ne "") {
+$inv = "<font class=ac_product_outofstock><br>$sc_out_of_stock_message<\/font>";
+  $the_whole_page =~ s/%%Qty_Box%%/&nbsp;/ig;
+  $the_whole_page =~ s/%%QtyBox%%/&nbsp;/ig;
+  $the_whole_page =~ s/%%zeroQtyBox%%/&nbsp;/ig;
+  $the_whole_page =~ s/(%%QtyBox-)([^%]+)(%%)/&nbsp;/ig;
+  $the_whole_page =~ s/add_to_cart.gif/blank.gif/;
+}
+} # end check inventory userfield
+
 $imageURL = $display_fields[0];
 $imageURL =~ s/%%URLofImages%%/$URL_of_images_directory/g;
 if ($qty_box_html eq '') {
@@ -1266,8 +1761,10 @@
  } else {
   $the_whole_page =~ s/%%QtyBox%%/$qty_box_html/ig;
  }
+
 while ($the_whole_page =~ /(%%QtyBox-)([^%]+)(%%)/i) {
   $arg = $2;
+ # if the qty part is not specified (or not even a comma) then use default
   ($arg1,$arg2,$junk) = split(/,/,$arg . ",$qty,",3);
   $arg1 =~ s/'//g;
   $arg1 =~ s/"//g;
@@ -1276,10 +1773,12 @@
   $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);
@@ -1288,6 +1787,7 @@
   $myans = &itemID($arg1);
   $the_whole_page =~ s/(%%itemID-)([^%]+)(%%)/$myans/i;
 }
+
 while ($the_whole_page =~ /(%%prodID-)([^%]+)(%%)/i) {
   $arg = $2;
   ($arg1,$arg2) = split(/,/,$arg,2);
@@ -1296,6 +1796,21 @@
   $myans = &prodID($arg1);
   $the_whole_page =~ s/(%%prodID-)([^%]+)(%%)/$myans/i;
 }
+
+# checks inventory levels using user defined userfield
+# added by Mister Ed @ K-Factor Technologies Jan 17, 2005
+if ($sc_db_index_for_inventory) {
+$inv = "$display_fields[4]";
+if ($database_fields[$db{$sc_db_index_for_inventory}] > 0)
+{
+    if ($sc_show_inventory_status =~ /yes/i) {
+        $inv .= "<br><font class=ac_product_available>$sc_inventory_status_text $database_fields[$db{$sc_db_index_for_inventory}]<\/font>";
+    }
+} elsif ($database_fields[$db{$sc_db_index_for_inventory}] ne "") {
+$inv .= "<br><br><font class=ac_product_outofstock>$sc_out_of_stock_message<\/font>";
+} 
+} # end check inventory userfield
+
 $the_whole_page =~ s/%%description%%/$display_fields[2]/ig;
 $the_whole_page =~ s/%%Qty%%/$qty/ig;
 $the_whole_page =~ s/%%userFieldOne%%/$display_fields[6]/ig;
@@ -1303,7 +1818,6 @@
 $the_whole_page =~ s/%%userFieldThree%%/$display_fields[8]/ig;
 $the_whole_page =~ s/%%userFieldFour%%/$display_fields[9]/ig;
 $the_whole_page =~ s/%%userFieldFive%%/$display_fields[10]/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;
@@ -1330,10 +1844,15 @@
 $the_whole_page =~ s/%%maxp%%/$form_data{'maxp'}/ig;
 $the_whole_page =~ s/%%page%%/$page/ig;
 $the_whole_page =~ s/%%cartlink%%/$cartlink/ig;
-$the_whole_page =~ s/%%product%%/$myproduct/ig;
 $the_whole_page =~ s/%%p_id%%/$form_data{'p_id'}/ig;
 $the_whole_page =~ s/%%keywords%%/$keywords/ig;
 $the_whole_page =~ s/%%next%%/$form_data{'next'}/ig;
+
+# portable next/prev token inspired by Dan - CartSolutions.net - Sept 1, 2008
+if ($sc_use_alt_next_display =~ /Yes/) {
+    $the_whole_page =~ s/%%alt_next%%/$prod_message/ig;
+}
+
 $the_whole_page =~ s/%%exact_match%%/$form_data{'exact_match'}/ig;
 $the_whole_page =~ s/%%exact_case%%/$form_data{'exact_case'}/ig;
 $the_whole_page =~ s/%%form_user1%%/$form_data{'user1'}/ig;
@@ -1343,8 +1862,12 @@
 $the_whole_page =~ s/%%form_user5%%/$form_data{'user5'}/ig;
 $the_whole_page =~ s/%%href_fields%%/$href_fields/ig;
 $the_whole_page =~ s/%%image%%/$imageURL/ig;
-$the_whole_page =~ s/%%name%%/$display_fields[1]/ig;
+# inventory update - by Mister Ed @ K-Factor Technologies, Inc.
+if ($sc_db_index_for_inventory) {
+$the_whole_page =~ s/%%price%%/$inv/ig;
+} else {
 $the_whole_page =~ s/%%price%%/$display_fields[4]/ig;
+}
 $the_whole_page =~ s/%%cost%%/$item_ids[2]/ig;
 $the_whole_page =~ s/%%shippingPrice%%/$display_fields[5]/ig;
 $the_whole_page =~ s/%%shipping%%/$display_fields[5]/ig;
@@ -1354,75 +1877,112 @@
 $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/%%URLofImages%%/$URL_of_images_directory/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;
+$the_whole_page =~ s/%%product%%/$myproduct/ig;
+$the_whole_page =~ s/%%name%%/$display_fields[1]/ig;
+$the_whole_page =~ s/%%image%%/$imageURL/ig;
+
 while ($the_whole_page =~ /%%ZZZ%%/) {
   $the_whole_page =~ s/%%ZZZ%%/$cart_id/;
 }
+
+# Do this before the evals
 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;
+
 }
 #######################################################################
+#                     get_sc_ppinc_info Subroutine                    #
+#######################################################################
 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-_]+)/;
    $name = $1;
    $test = $my_ppinc ."-" . $name . ".inc";
-   if (-f $test) {
+   if (-f $test) {# this on-the-fly change is valid, use new file
      $my_ppinc = $test;
-    } else {
+    } else {# don't break!  Just use default file
      $my_ppinc .= ".inc";
     }
   } 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); 
+
+ read(PAGE,$the_whole_page,102400); # 100K max size! Should be just a few K
  close PAGE;
+
  ($very_first_part,$the_whole_page,$junk) = 
   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; 
+
+ $sc_ppinc_info = $the_whole_page; # save for next time
  $last_ppinc_name = $my_ppinc;
  return $sc_ppinc_info;
+
 }
+
 #############################################################################
+# Virtual Fields Subroutines
+#
+# These routines are independent of any particular database interface
+#
+# $VF_HOOK{'filename'} holds the default subroutine for vitual fields
+# that do not use the standard one
+# $VF_DEF{'filename'} holds the %hash name
+# @RECORD is the set of fields for the current record
+# $ID is the id number of the current record
+
 sub vf_get_data {
   local ($VF_file,$fname,$ID,@RECORD) = @_;
   my $field,$xans,@REC;
@@ -1433,6 +1993,7 @@
 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);
@@ -1445,14 +2006,14 @@
   if ($VF_HOOK{$VF_file} ne '') {
     eval('&' . "$VF_HOOK{$VF_file};");
    } else {
-    if (substr($field,0,1) eq '*') { 
+    if (substr($field,0,1) eq '*') { # V-field
       eval(substr($field,1,9999));
       $err_code = $@;
       if ($err_code ne "") {
         &update_error_log("V-field ${field}($VF_file) error: $err_code",
     __FILE__,__LINE__);
        }
-     } else { 
+     } else { # D-field
       $ans = $RECORD[$field];
      }
    }
@@ -1460,3 +2021,4 @@
  }
 ############################################################################
 1; # library
+
diff -x .svn -aruN 5.2.004.src/library/agora_order_lib.pl 5.2.005.src/library/agora_order_lib.pl
--- 5.2.004.src/library/agora_order_lib.pl	2008-06-26 07:48:44.000000000 -0500
+++ 5.2.005.src/library/agora_order_lib.pl	2008-09-03 05:15:39.000000000 -0500
@@ -1,6 +1,6 @@
 ############################################################
 
-$versions{'agora_order_lib.pl'} = "5.2.003";
+$versions{'agora_order_lib.pl'} = "5.2.005";
 # last modified by Mister Ed from K-Factor Technologies, Inc /  AgoraCart.com
 # August 17, 2006
 #
@@ -22,9 +22,35 @@
 #######################################################################
 sub options_error_message {
 # Added by Mister Ed at BytePipe.com / AgoraCart.com 2-18-2004.
+# fixed to actually display the file, May 17, 2008 by Mister Ed
+my @the_file='';
 &standard_page_header("Options Error");
+
+open (CARTSECURITY, "$sc_templates_dir/cart_options_security_add_error.inc") || &file_open_error("$sc_templates_dir/cart_options_security_add_error.inc", "Invalid Product Option Error Page Failed to Open", __FILE__, __LINE__);
+$the_file=<CARTSECURITY>;
+close (CARTSECURITY);
+
 &StoreHeader;
-print "$sc_templates_dir/cart_options_security_add_error.inc";
+
+if (-e "$sc_templates_dir/cart_options_security_add_error.inc") {
+    open (CARTSECURITY, "$sc_templates_dir/cart_options_security_add_error.inc");
+    @the_file=<CARTSECURITY>;
+    close (CARTSECURITY);
+
+    for $the_file(@the_file) {
+        print "$the_file";
+    }
+} else {
+    print qq|\n<!--begin options add error -->\n
+<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>\n
+<!--end options add error -->\n\n
+|;
+}
+
 &StoreFooter;
 }
 #######################################################################
@@ -217,6 +243,9 @@
 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) { 
+my $option_name_temp = "$option_name";
+$option_name_temp =~ s/\(/\\(/g;
+$option_name_temp =~ s/\)/\\)/g;
 if ($field =~ /$option_name\|$option_price/ || $field =~ /$option_name\|$option_price\|$option_shipping/)  {
     $temp = $form_data{$option};
      } elsif ($item_user1 ne "") {
diff -x .svn -aruN 5.2.004.src/library/cgi-lib.pl 5.2.005.src/library/cgi-lib.pl
--- 5.2.004.src/library/cgi-lib.pl	2008-06-26 07:48:44.000000000 -0500
+++ 5.2.005.src/library/cgi-lib.pl	2008-08-30 20:13:31.000000000 -0500
@@ -21,7 +21,7 @@
 #     http://cgi-lib.stanford.edu/cgi-lib/
 
 $cgi_lib'version = sprintf("%d.%02d", q$Revision: 2.18 $ =~ /(\d+)\.(\d+)/);
-$versions{'cgi-lib'}= "5.2.001";
+$versions{'cgi-lib'}= "5.5.001 Gold Version";
 
 # Parameters affecting cgi-lib behavior
 # User-configurable parameters affecting file upload.
diff -x .svn -aruN 5.2.004.src/library/cookie-lib.pl 5.2.005.src/library/cookie-lib.pl
--- 5.2.004.src/library/cookie-lib.pl	2008-06-26 07:48:44.000000000 -0500
+++ 5.2.005.src/library/cookie-lib.pl	2008-08-30 20:13:31.000000000 -0500
@@ -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'} = "5.0.000";
+$versions{'cookie-lib.pl'} = "5.1.000";
 #
 # Copyright (c) 1998 Peter D. Kovacs  
 # Unpublished work.
@@ -29,6 +29,8 @@
 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 =.
@@ -36,7 +38,7 @@
     $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})); 
+    $cookie{$chip} .= "\1" if (defined($cookie{$chip})); # \1 is the multiple separator
     $cookie{$chip} .= $val;
   }
 }
@@ -44,48 +46,60 @@
 sub get_cookie {
   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 =.
+    	# Convert %XX from hex numbers to alphanumeric
     $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})); 
+    	# Associate key and value
+    $cookie{$chip} .= "\1" if (defined($cookie{$chip})); # \1 is the multiple separator
     $cookie{$chip} .= $val;
   }
 }
 
-sub set_cookie { 
+sub set_cookie { # For compatability with older stores
   &set_agora_cookies;
   print $sc_cookie_information;
   $sc_cookie_information='';
  }
 
 sub set_agora_cookies {
+  # $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).
+
   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); 
+  local($seconds,$min,$hour,$mday,$mon,$year,$wday) = gmtime($expires) if ($expires > 0); #get date info if expiration set.
   $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"); 
-  if (! defined $expires) { $expires = " expires\=Fri, 31-Dec-1999 00:00:00 GMT;"; } 
-  elsif ($sc_cookie_days == -1) { $expires = "" } 
+  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 ($sc_cookie_days == -1) { $expires = "" } # if expiration set to less than 1, then eliminate expiration of cookie.
   else { 
     $year += 1900; 
-    $expires = "expires\=$days[$wday], $mday-$months[$mon]-$year $hour:$min:$seconds GMT; "; 
+    $expires = "expires\=$days[$wday], $mday-$months[$mon]-$year $hour:$min:$seconds GMT; "; #form expiration from value passed to function.
   }
-  if (! defined $domain) { $domain = $ENV{'SERVER_NAME'}; } 
-  if (! defined $path) { $path = "/"; } 
+  if (! defined $domain) { $domain = $ENV{'SERVER_NAME'}; } #set domain of cookie.  Default is current host.
+  if (! defined $path) { $path = "/"; } #set default path = "/"
   if (! defined $secure) { $secure = "0"; }
   local($key);
   foreach $key (keys %cookie) {
-    $cookie{$key} =~ s/ /+/g; 
+    $cookie{$key} =~ s/ /+/g; #convert plus to space.
     $my_cookie =  "$key\=$cookie{$key}; $expires path\=$path; ";
     $my_cookie .= "domain\=$domain; $secure[$sec]";
+  # print cookie to browser,
+  # this must be done *before* you print any content type headers.
     if (!($sc_use_pre_content_cookies =~ /no/i)) {
       $sc_cookie_information .= "Set-Cookie: $my_cookie\n";
     }
+  # Meta tags go out in the page header
     if ($sc_use_meta_cookies =~ /yes/i) {
       $sc_special_page_meta_tags .= '<META HTTP-EQUIV="Set-Cookie"' . 
                               " Content=\"$my_cookie\">\n";
@@ -94,11 +108,14 @@
 }
 
 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,$my_cookie);
   foreach $name (@to_delete) {
-   undef $cookie{$name}; 
+   undef $cookie{$name}; #undefines cookie so if you call set_cookie, it doesn't reset the cookie.
    $my_cookie = "$name=deleted; expires=Thu, 01-Jan-1970 00:00:00 GMT;";
+ #this also must be done before you print any content type headers.
    print "Set-Cookie: $my_cookie\n";
    if ($sc_use_meta_cookies =~ /yes/i) {
      $sc_special_page_meta_tags .= '<META HTTP-EQUIV="Set-Cookie"' . 
@@ -108,12 +125,15 @@
 }
 
 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]);
 }
 ##########################################################################
-{ 
+{ # Initializations . . .
   local($inx);
   local($agent) = $ENV{'HTTP_USER_AGENT'};
   if ($agent eq '') {$agent='unknown'};
@@ -124,6 +144,7 @@
     $user_agent_dotval=$user_agent_dotval+$inx+ord(substr($agent,$inx,1));
    }
   $user_agent_dotval = 'a' . $user_agent_dotval;
+ #
 }
 
 1;
diff -x .svn -aruN 5.2.004.src/library/credit_card_validation_lib.pl 5.2.005.src/library/credit_card_validation_lib.pl
--- 5.2.004.src/library/credit_card_validation_lib.pl	2008-06-26 07:48:44.000000000 -0500
+++ 5.2.005.src/library/credit_card_validation_lib.pl	2008-08-30 20:13:32.000000000 -0500
@@ -4,7 +4,7 @@
 # Date Created: 12-02-96
 # Date Last Modified: 02-07-2000 SPK
 
-$versions{'credit_card_validation_lib.pl'} = "5.0.000";
+$versions{'credit_card_validation_lib.pl'} = "5.1.000";
 
 #
 # Author: Doug Miles
diff -x .svn -aruN 5.2.004.src/library/http-lib.pl 5.2.005.src/library/http-lib.pl
--- 5.2.004.src/library/http-lib.pl	2008-06-26 07:48:44.000000000 -0500
+++ 5.2.005.src/library/http-lib.pl	2008-08-30 20:13:32.000000000 -0500
@@ -152,7 +152,7 @@
 # This script was written by Gunther Birznieks.
 # Date Created: 5-15-96
 
-$versions{'http-lib.pl'} = "5.0.000";
+$versions{'http-lib.pl'} = "5.1.000";
 
 #
 # Copyright:
diff -x .svn -aruN 5.2.004.src/library/iTransact-order_lib.pl 5.2.005.src/library/iTransact-order_lib.pl
--- 5.2.004.src/library/iTransact-order_lib.pl	2008-06-26 07:48:44.000000000 -0500
+++ 5.2.005.src/library/iTransact-order_lib.pl	2008-08-30 20:13:32.000000000 -0500
@@ -2,7 +2,7 @@
 #                    Order Form Definition Variables                  #
 #######################################################################
 
-$versions{'iTransact-order_lib.pl'} = "5.2.001";
+$versions{'iTransact-order_lib.pl'} = "5.5.002";
 $sc_use_secure_header_at_checkout = 'yes';
 $sc_use_secure_footer_for_order_form = 'yes';
 
@@ -150,6 +150,10 @@
  if ($result ne '') {
    $result .= "</TABLE></TD></TR></TABLE>\n";
   }
+
+# use this to change $result
+&codehook("iTransact_table_setup_bottom");
+
  $iTransact_cart_table = $result;
 }
 
@@ -188,6 +192,11 @@
   $test_mode = "<INPUT TYPE=HIDDEN NAME=\"lookup\" VALUE=\"test_mode\">";
  }
 
+if ($sc_use_alternate_iTransact_submit_page ne "Yes") {
+############  Start of Standard submit page - Select from this line to for copy functions ############
+#### can use in custom submit page.  Custom file must be named: iTransact_custom_processing_lib.pl
+#### Custom function (aka sub routine) to replace the code below must be named: iTransact_custom_submit_page
+
 
 if ($iTransact_enablebodytags eq "1"){
 $tempbodytags = qq~<input type="hidden" name="bodytags" value="$iTransact_enablebodytags">
@@ -344,6 +353,14 @@
 </CENTER>
 ENDOFTEXT
 
+############  End of Submit Page Code - Select until this line for copy functions ############
+}
+else { # uses alternate processing file in add_ons sub directory
+
+&codehook("iTransact_custom_submit_page");
+
+} # end of alternate submit page
+
 }
 ############################################################################################
 sub process_iTransact_Order {
@@ -451,6 +468,12 @@
 <body>
 !;
 
+if ($sc_use_alternate_iTransact_order_processing ne "Yes") {
+############  Start of Standard Processing Code - Select from this line to for copy functions ############
+#### can use in custom processing file.  Custom file must be named: iTransact_custom_processing_lib.pl
+#### Place iTransact_custom_processing_lib.pl in the library directory of your store
+#### Custom function (aka sub routine)  to replace the code below must be named: iTransact_custom_processing_function
+
 &SecureStoreHeader;
 
 $text_of_cart .= "Order Date:    $orderDate\n";
@@ -534,6 +557,43 @@
 $orderLoggingHash{'shippingMessages'} = "";
 $orderLoggingHash{'xcomments'} = "";
 $orderLoggingHash{'termsOfService'} = "$vform_Ecom_tos";
+$orderLoggingHash{'faxNumber'} = "";
+
+# new logging items added August 4, 2007 by Mister Ed
+$orderLoggingHash{'discountCode'} = "";
+$orderLoggingHash{'user6'} = "";
+$orderLoggingHash{'user7'} = "";
+$orderLoggingHash{'user8'} = "";
+$orderLoggingHash{'user9'} = "";
+$orderLoggingHash{'user10'} = "";
+$orderLoggingHash{'buySafe'} = "";
+$orderLoggingHash{'order_payment_type_user1'} = "";
+$orderLoggingHash{'order_payment_type_user2'} = "";
+$orderLoggingHash{'GiftCard_number'} = "";
+$orderLoggingHash{'GiftCard_amount_used'} = "";
+$orderLoggingHash{'internal_company_notes1'} = "";
+$orderLoggingHash{'internal_company_notes2'} = "";
+$orderLoggingHash{'internal_company_notes2'} = "";
+$orderLoggingHash{'customer_order_notes1'} = "";
+$orderLoggingHash{'customer_order_notes2'} = "";
+$orderLoggingHash{'customer_order_notes3'} = "";
+$orderLoggingHash{'customer_order_notes4'} = "";
+$orderLoggingHash{'customer_order_notes5'} = "";
+$orderLoggingHash{'mailinglist_subscribe'} = "";
+$orderLoggingHash{'wishlist_subscribe'} = "";
+$orderLoggingHash{'insurance_cost'} = "";
+$orderLoggingHash{'trade_in_allowance'} = "";
+$orderLoggingHash{'rma_number'} = "";
+$orderLoggingHash{'customer_contact_notes1'} = "";
+$orderLoggingHash{'customer_contact_notes2'} = "";
+$orderLoggingHash{'account_number'} = "";
+$orderLoggingHash{'sales_rep'} = "";
+$orderLoggingHash{'sales_rep_notes1'} = "";
+$orderLoggingHash{'sales_rep_notes2'} = "";
+$orderLoggingHash{'how_did_you_find_us'} = "";
+$orderLoggingHash{'suggestion_box'} = "";
+$orderLoggingHash{'preferrred_shipping_date'} = "";
+$orderLoggingHash{'ship_order_items_as_available'} = "";
 
 $sc_orderlib_use_SBW_for_ship_ins = $sc_use_SBW;
 &codehook("orderlib-ship-instructions");
@@ -752,7 +812,7 @@
 
 $sc_itransact_order_desc .= " - " . $itrans{'p5'};
 
-# added by Mister Ed Feb 7, 2007
+# added by Mister Ed for Pro version Feb 7, 2007
 my $temp_admin_email = "$itrans{'email'}";
 if ($sc_use_customer_email_over_admin =~ /yes/i) {
    $temp_admin_email = "$eform_Ecom_BillTo_Online_Email";
@@ -808,6 +868,14 @@
 </HTML>
 !;
 
+############  End of Standard Processing Code - Select until this line for copy functions ############
+}
+else { # uses alternate processing file in add_ons sub directory
+
+&codehook("iTransact_custom_processing_function");
+
+} # end of alternate processing
+
 } # End of process_order_form
 
 #################################################################
diff -x .svn -aruN 5.2.004.src/library/mail-lib.pl 5.2.005.src/library/mail-lib.pl
--- 5.2.004.src/library/mail-lib.pl	2008-06-26 07:48:44.000000000 -0500
+++ 5.2.005.src/library/mail-lib.pl	2008-09-03 03:55:12.000000000 -0500
@@ -3,9 +3,9 @@
 #
 # This script was written by Gunther Birznieks. 
 # Date Created: 2-22-96
-# Date Last Modified: 5-5-96
+# Date Last Modified: Sept 4, 2008 by Mister Ed
 
-$versions{'mail-lib.pl'} = "5.0.000";
+$versions{'mail-lib.pl'} = "5.5.000";
 
 #
 #   You may copy this under the terms of the GNU General Public
@@ -111,6 +111,7 @@
 sub real_send_mail {
     local($fromuser, $fromsmtp, $touser, $tosmtp, 
       $subject, $messagebody) = @_;
+local $sc_replyto_email_temp = "$sc_replyto_email";
 
 # First we need to start the mail program and open
 # a PIPE to the program so that anything 
@@ -124,6 +125,15 @@
     $ENV{"PATH"} = "";
 $ENV{ENV} = "";
 
+# added by Mister Ed September 4, 2008
+if ($sc_replyto_email_temp eq '') {
+    $sc_replyto_email_temp = "$sc_admin_email";
+}
+if ($sc_email_content_type eq '') {
+    $sc_email_content_type = "text/plain";
+}
+
+
 open (MAIL, "|$mail_program") || &web_error("Could Not Open Mail Program");
 
     $ENV{"PATH"} = $old_path;
@@ -142,11 +152,17 @@
 #
 # This was pointed out by Paul Tate.
 #
+# added Reply-to, x-mailer, content type, and content transfer fields
+# by Mister Ed September 4, 2008
 
     print MAIL <<__END_OF_MAIL__;
 To: $touser
 From: $fromuser
+Reply-to: $sc_replyto_email_temp
 Subject: $subject
+X-Mailer: AgoraCart $versions{'agora.cgi'}
+Content-Type: $sc_email_content_type;
+Content-Transfer-Encoding: 7bit
 
 $messagebody
 
diff -x .svn -aruN 5.2.004.src/library/pgp-lib.pl 5.2.005.src/library/pgp-lib.pl
--- 5.2.004.src/library/pgp-lib.pl	2008-06-26 07:48:44.000000000 -0500
+++ 5.2.005.src/library/pgp-lib.pl	2008-08-30 20:13:34.000000000 -0500
@@ -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'} = "5.0.000";
+$versions{'pgp-lib.pl'} = "5.1.000";
 
 #
 # Copyright Info: This library was written by Gunther Birznieks    
diff -x .svn -aruN 5.2.004.src/library/send-mail-lib.pl 5.2.005.src/library/send-mail-lib.pl
--- 5.2.004.src/library/send-mail-lib.pl	2008-06-26 07:48:44.000000000 -0500
+++ 5.2.005.src/library/send-mail-lib.pl	2008-08-30 20:13:35.000000000 -0500
@@ -5,7 +5,7 @@
 # Copyright 1999-2005 K-Factor Technologies, Inc
 # at http://www.AgoraCart.com
 
-$versions{'send-mail-lib.pl'} = "5.0.000";
+$versions{'send-mail-lib.pl'} = "5.1.000";
 
 #
 #   You may copy this under the terms of the GNU General Public
diff -x .svn -aruN 5.2.004.src/library/shipping_lib.pl 5.2.005.src/library/shipping_lib.pl
--- 5.2.004.src/library/shipping_lib.pl	2008-06-26 07:48:44.000000000 -0500
+++ 5.2.005.src/library/shipping_lib.pl	2008-07-25 21:00:31.000000000 -0500
@@ -46,13 +46,14 @@
 #   user4 in cart fields filled with dimensional info for individual items, appended to stevo_shipping_thing for use in 
 #   shipping instructions and courtesy rate quotes from real-time providers.
 # Modified March 27, 2008 by Mister Ed  - fixed ghosting of empty boxes on items from alt locations or alt dimensions.
+# Modified July 25, 2008 by Mister Ed  - fixed USPS to print specific error if 26 or more packages in rate request.
 
-$versions{'shipping_lib.pl'} = "5.2.003";
+$versions{'shipping_lib.pl'} = "5.2.005";
 if (($sc_use_SBW =~ /yes/i) || ($sc_need_sockets =~ /yes/i)) { 
  if ($sc_use_socket eq "") { 
-   $sc_use_socket = "http-lib";   
+   $sc_use_socket = "LWP";   
   }
- if ($sc_use_socket =~ /lwp/i) { 
+ if ($sc_use_socket =~ /LWP/) { 
     $test_result = eval("use LWP::Simple; 1;");
     if ($test_result ne "1") {
       print "Content-type: text/html\n\n";
@@ -424,6 +425,17 @@
 
     @ship_list = split(/\|/,$new_weight_data);
 
+    my $temp_num_packs = $#ship_list +1;
+    if ($#ship_list > 24) {
+       	    $err_printed = "yes";
+       	    $order_error_do_not_finish = "yes";
+       	    print qq|USPS shipping error:<br>Your Order is too large for US Postal Service shipments.<br>
+You have $temp_num_packs packages in this shipment.  You must have 25 and under.<br>
+<br>Please remove some items and then recalculate shipping at checkout.<br><br>$err<br>\n|;
+		    $ship_cost = 0;
+		    return $ship_cost;
+    }
+
     foreach $item_info (@ship_list) {
         my ($length,$width,$height,$girth) = '';
     	($item_qty,$item_wt,$box_total_value,$alt_origin,$alt_stateprov,$length,$width,$height,$girth,$myBoxType,$junk) = split(/\*/,$item_info,11);
@@ -577,13 +589,13 @@
                 # debug
                 # print " SPLITANSWER = $splitanswer <br><br>";
                 # print "Looked For:  = $product <br><br><br><br>";
-				if (($splitanswer =~ /$product/i) && ($splitanswer !~ /flat rate/i) && ($splitanswer !~ /Non\-Document/i)) {
+				if (($splitanswer =~ /$product/i) && ($splitanswer !~ /flat-rate/i) && ($splitanswer !~ /Non\-Document/i)) {
    					($junk,$splitanswer) = split(/<Postage>/i,$splitanswer,2);
    					($splitanswer,$junk) = split(/<\/Postage>/i,$splitanswer,2);
                     # debug
                     # print "COST FOUND: $splitanswer <br><br><br><br>";
 					$item_cost += $splitanswer;
-				} elsif (($splitanswer =~ /$product/i) && ($product =~ /flat rate/i) && ($splitanswer =~ /flat rate/i) && ($splitanswer !~ /envelope/i)) {
+				} elsif (($splitanswer =~ /$product/i) && ($product =~ /flat rate/i) && ($splitanswer =~ /flat-rate/i) && ($splitanswer !~ /envelope/i)) {
    					($junk,$splitanswer) = split(/<Postage>/i,$splitanswer,2);
    					($splitanswer,$junk) = split(/<\/Postage>/i,$splitanswer,2);
                     # debug
diff -x .svn -aruN 5.2.004.src/protected/buySAFE-ext_lib.pl 5.2.005.src/protected/buySAFE-ext_lib.pl
--- 5.2.004.src/protected/buySAFE-ext_lib.pl	2008-06-26 07:48:44.000000000 -0500
+++ 5.2.005.src/protected/buySAFE-ext_lib.pl	2008-08-30 20:16:46.000000000 -0500
@@ -38,7 +38,7 @@
 # K-Factor Technologies, Inc. in order to distribute this add-on to AgoraCart (aka Agora.cgi).
 #
 ##########################################################################
-$versions{'buySAFE-ext_lib.pl'} = "5.2.002";
+$versions{'buySAFE-ext_lib.pl'} = "5.5.003 Gold Version";
 
 {
  local ($modname) = 'buySAFE';
@@ -120,7 +120,7 @@
 <b>
 Get Started Now!</b><br />
 Here are the simple steps to enable buySAFE in your AgoraCart store:<br />
-<blockquote><b>1.</b> visit <a href="http://www.agoracart.com/buySAFE.html" target="_blank">www.AgoraCart.com/buySAFE.html</a> to learn more about the program and apply for buySAFE.<br />
+<blockquote><b>1.</b> visit <a href="http://www.agoracart.com/buySAFE.html" target="_blank">www.AgoraCart.com/buySAFE.html</a> to learn more about the program and apply for buysafe.<br />
 <b>2.</b> from buySAFE.com, click apply now and complete the short application to become a buysafe merchant.<br />
 <b>3.</b> login to your buySAFE merchant dashboard, and complete the store setup process.<br />
 <b>4.</b> under test store, click no under is the button present? and you will see your seal authentication and store authentication data.<br />
@@ -234,8 +234,16 @@
 sub select_cancel_buysafe_bond_screen {
 
 $in{'customerNumber'} =~ /([\w\=\+\.]+)/;
+my $cust_number = "$1";
+
+$in{'invNumber'} =~ /([\w\=\+\.]+)/;
 my $inv_number = "$1";
 
+$in{'buyMonth'} =~ /([\w]+)/;
+my $buyMonth = "$1";
+$in{'buyYear'} =~ /([\w]+)/;
+my $buyYear = "$1";
+
 print &$manager_page_header("Cancel buySAFE Bond on order: $inv_number","","","","");
 
 print <<ENDOFTEXT;
@@ -245,13 +253,16 @@
 <table width="580" border="0">
 <TR>
 <TD>
-<FONT FACE=ARIAL size=2>Welcome to the <b>AgoraCart</b> buySAFE Bond Cancellation Manager.<br>This section will allow you to cancel the surety bond from buySAFE on order $inv_number.  <b>DO NOT cancel</b> surety bonds on orders where money has already changed hands from the buyer to you. This is only to be used in the event the order is cancelled prior to the customer's payment to you.
+<FONT FACE=ARIAL size=2>Welcome to the <b>AgoraCart</b> buySAFE Bond Cancellation Manager.<br>This section will allow you to cancel the surety bond from buySAFE on order $cust_number.  <b>DO NOT cancel</b> surety bonds on orders where money has already changed hands from the buyer to you. This is only to be used in the event the order is cancelled prior to the customer's payment to you.
 </font></TD>
 </TR>
 </table><br /><br />
 <font face=arial size=2 color=red><b>NOTE:</b><br>Once you cancel the surety bond on this order,<br>the cancelled bond cannot be resubmitted.</font><br /><br />
-<INPUT TYPE="hidden" NAME="customerNumber" VALUE="$inv_number">
-<INPUT NAME="CancelBuySafeBond" TYPE="SUBMIT" VALUE="Cancel buySAFE Bond for Order# $inv_number ">
+<INPUT TYPE="hidden" NAME="invNumber" VALUE="$inv_number">
+<INPUT TYPE="hidden" NAME="customerNumber" VALUE="$cust_number">
+<INPUT TYPE="hidden" NAME="buyMonth" VALUE="$buyMonth">
+<INPUT TYPE="hidden" NAME="buyYear" VALUE="$buyYear">
+<INPUT NAME="CancelBuySafeBond" TYPE="SUBMIT" VALUE="Cancel buySAFE Bond for Order# $cust_number ">
 <br /><br /><br /><br />
 </center>
 ENDOFTEXT
@@ -295,13 +306,13 @@
 });
 
   # debug
-   print "<br><br>Request:<br>" . $req->as_string;
-   print "<br><br>Sending POST to [$sc_buysafe_URL]<br>";
+  # print "<br><br>Request:<br>" . $req->as_string;
+  # print "<br><br>Sending POST to [$sc_buysafe_URL]<br>";
 
   my $res = $ua->request($req);
 
   # debug
-   print "<br><br>Response:<br>" . $res->as_string;
+  # print "<br><br>Response:<br>" . $res->as_string;
 
   return($res->content);
 }
@@ -310,15 +321,23 @@
 
 # &ReadParse;
  $in{'customerNumber'} =~ /([\w\=\+\.]+)/;
+ my $cust_number = "$1";
+ my $cust_thingy = $sc_domain_name_for_cookie . "-" . $cust_number;
+
+ $in{'invNumber'} =~ /([\w\=\+\.]+)/;
  my $inv_number = "$1";
- my $inv_thingy = $sc_domain_name_for_cookie . "-" . $inv_number;
 
-print &$manager_page_header("Cancelled buySAFE Bond on order: $inv_number","","","","");
+$in{'buyMonth'} =~ /([\w]+)/;
+my $buyMonth = "$1";
+$in{'buyYear'} =~ /([\w]+)/;
+my $buyYear = "$1";
+
+print &$manager_page_header("Cancelled buySAFE Bond on order: $cust_number","","","","");
 
  my $BodyofCancelBond .= qq{    <SetShoppingCartCancelOrder xmlns="http://ws.buysafe.com">
- <ShoppingCartCancelOrderRQ>
- <ShoppingCartId>$inv_thingy</ShoppingCartId>
- </ShoppingCartCancelOrderRQ>
+ <SetShoppingCartCancelOrderRQ>
+ <ShoppingCartId>$cust_thingy</ShoppingCartId>
+ </SetShoppingCartCancelOrderRQ>
  </SetShoppingCartCancelOrder>
 }; # end of  $BodyofCancelBond
 
@@ -331,13 +350,148 @@
             my $isSuccessful    = $xml->{'soap:Header'}->{TransactionStatus}->{isSuccessful};
             my $CancelRS_id     = $xml->{'soap:Header'}->{TransactionStatus}->{TransactionId};
 
-if($CancelRS_id eq $inv_thingy) {
+           # debug
+           # print "\$isSuccessful = $isSuccessful <br>";
+           # print "\$CancelRS_id = $CancelRS_id <br>";
+
+if ($isSuccessful eq "true") {
+#################################################
+    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/$buyYear/$buyMonth/$buyMonth$buyYear";
+    my ($filename8) = "$sc_order_log_directory_path/$buyYear/$buyMonth/$inv_number"."-"."$cust_number"."$scm_orderdata_ext";
+    my ($filename11) = "$sc_order_log_directory_path/$buyYear/$buyMonth$buyYear";
+    my $filename5 = "$filename11$scm_monthyearmasterlog_name";
+    my $filename6 = "$sc_order_log_directory_path/$buyYear/$buyMonth/$inv_number-$cust_number-orderdata2";
+    my $buyDate = &get_date;
+
+# short monthly master log
+if ($sc_write_monthly_short_order_logs =~ /yes/i) {
+           $filename4 = "$filename3$scm_monthyearindexlog_name";
+           open (ORDERLOG4, "$filename4");
+           while (<ORDERLOG4>) {
+               if ($_ =~ /$inv_number/) {
+# split it out
+        ($in{'year'},$in{'month'},$in{'day'},$in{'invoiceNumber'},$in{'customerNumber'},$in{'orderStatus'},$in{'firstName'},$in{'lastName'},$in{'fullName'},$in{'companyName'},$in{'emailAddress'},$in{'orderFromState'},$in{'orderFromPostal'},$in{'orderFromCountry'},$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{'GatewayUsed'},$in{'buySafe'}) = split(/\t/,$_);
+
+$in{'adminMessages'} .= "<br>buySAFE fees removed manually by admin: $buyDate<br>";
+$in{'orderTotal'} = &format_pricemgr($in{'orderTotal'} - $in{'buySafe'});
+$in{'buySafe'} = ""; # zero out buysafe fees
+
+     $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'}\t$in{'GatewayUsed'}\t$in{'buySafe'}\n";
+                   $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");
+}
+
+
+# master log - all details for all orders each month of each year
+ if ($sc_write_monthly_master_order_logs =~ /yes/i) {
+           open (ORDERLOG5, "$filename5");
+           while (<ORDERLOG5>) {
+               if ($_ =~ /$inv_number/) {
+        ($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'},$in{'user6'},$in{'user7'},$in{'user8'},$in{'user9'},$in{'user10'},$in{'buySafe'},$in{'order_payment_type_user1'},$in{'order_payment_type_user2'},$in{'GiftCard_number'},$in{'GiftCard_amount_used'},$in{'internal_company_notes1'},$in{'internal_company_notes2'},$in{'internal_company_notes2'},$in{'customer_order_notes1'},$in{'customer_order_notes2'},$in{'customer_order_notes3'},$in{'customer_order_notes4'},$in{'customer_order_notes5'},$in{'mailinglist_subscribe'},$in{'wishlist_subscribe'},$in{'insurance_cost'},$in{'trade_in_allowance'},$in{'rma_number'},$in{'customer_contact_notes1'},$in{'customer_contact_notes2'},$in{'account_number'},$in{'sales_rep'},$in{'sales_rep_notes1'},$in{'sales_rep_notes2'},$in{'how_did_you_find_us'},$in{'suggestion_box'},$in{'preferrred_shipping_date'},$in{'ship_order_items_as_available'}) = split(/\t/,$stuff);
+
+$in{'adminMessages'} .= "<br>buySAFE fees removed manually by admin: $buyDate<br>";
+$in{'orderTotal'} = &format_pricemgr($in{'orderTotal'} - $in{'buySafe'});
+$in{'buySafe'} = ""; # zero out buysafe fees
+
+     $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'}\t$in{'user6'}\t$in{'user7'}\t$in{'user8'}\t$in{'user9'}\t$in{'user10'}\t$in{'buySafe'}\t$in{'order_payment_type_user1'}\t$in{'order_payment_type_user2'}\t$in{'GiftCard_number'}\t$in{'GiftCard_amount_used'}\t$in{'internal_company_notes1'}\t$in{'internal_company_notes2'}\t$in{'internal_company_notes2'}\t$in{'customer_order_notes1'}\t$in{'customer_order_notes2'}\t$in{'customer_order_notes3'}\t$in{'customer_order_notes4'}\t$in{'customer_order_notes5'}\t$in{'mailinglist_subscribe'}\t$in{'wishlist_subscribe'}\t$in{'insurance_cost'}\t$in{'trade_in_allowance'}\t$in{'rma_number'}\t$in{'customer_contact_notes1'}\t$in{'customer_contact_notes2'}\t$in{'account_number'}\t$in{'sales_rep'}\t$in{'sales_rep_notes1'}\t$in{'sales_rep_notes2'}\t$in{'how_did_you_find_us'}\t$in{'suggestion_box'}\t$in{'preferrred_shipping_date'}\t$in{'ship_order_items_as_available'}";
+
+                   $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_write_individual_order_logs =~ /yes/i) {
+
+           open (ORDERLOG6, "$filename6");
+               my $stuff = <ORDERLOG6>;
+           close (ORDERLOG6);
+
+        ($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'},$in{'user6'},$in{'user7'},$in{'user8'},$in{'user9'},$in{'user10'},$in{'buySafe'},$in{'order_payment_type_user1'},$in{'order_payment_type_user2'},$in{'GiftCard_number'},$in{'GiftCard_amount_used'},$in{'internal_company_notes1'},$in{'internal_company_notes2'},$in{'internal_company_notes2'},$in{'customer_order_notes1'},$in{'customer_order_notes2'},$in{'customer_order_notes3'},$in{'customer_order_notes4'},$in{'customer_order_notes5'},$in{'mailinglist_subscribe'},$in{'wishlist_subscribe'},$in{'insurance_cost'},$in{'trade_in_allowance'},$in{'rma_number'},$in{'customer_contact_notes1'},$in{'customer_contact_notes2'},$in{'account_number'},$in{'sales_rep'},$in{'sales_rep_notes1'},$in{'sales_rep_notes2'},$in{'how_did_you_find_us'},$in{'suggestion_box'},$in{'preferrred_shipping_date'},$in{'ship_order_items_as_available'}) = split(/\t/,$stuff);
+
+$in{'adminMessages'} .= "<br>buySAFE fees removed manually by admin: $buyDate<br>";
+$in{'orderTotal'} = &format_pricemgr($in{'orderTotal'} - $in{'buySafe'});
+$in{'buySafe'} = ""; # zero out buysafe fees
+
+     $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'}\t$in{'user6'}\t$in{'user7'}\t$in{'user8'}\t$in{'user9'}\t$in{'user10'}\t$in{'buySafe'}\t$in{'order_payment_type_user1'}\t$in{'order_payment_type_user2'}\t$in{'GiftCard_number'}\t$in{'GiftCard_amount_used'}\t$in{'internal_company_notes1'}\t$in{'internal_company_notes2'}\t$in{'internal_company_notes2'}\t$in{'customer_order_notes1'}\t$in{'customer_order_notes2'}\t$in{'customer_order_notes3'}\t$in{'customer_order_notes4'}\t$in{'customer_order_notes5'}\t$in{'mailinglist_subscribe'}\t$in{'wishlist_subscribe'}\t$in{'insurance_cost'}\t$in{'trade_in_allowance'}\t$in{'rma_number'}\t$in{'customer_contact_notes1'}\t$in{'customer_contact_notes2'}\t$in{'account_number'}\t$in{'sales_rep'}\t$in{'sales_rep_notes1'}\t$in{'sales_rep_notes2'}\t$in{'how_did_you_find_us'}\t$in{'suggestion_box'}\t$in{'preferrred_shipping_date'}\t$in{'ship_order_items_as_available'}";
+
+   &get_file_lock("$filename6.lockfile");
+   open (ORDERLOG6, ">$filename6");
+   print ORDERLOG6 $cart_string;
+   close (ORDERLOG6);
+   &release_file_lock("$filename6.lockfile");
+
+}
+
+
+# overview log - new orders
+ if ($sc_send_order_to_log =~ /yes/i) {
+           open (ORDERLOG, "$logfile");
+           while (<ORDERLOG>) {
+               if ($_ =~ /$inv_number/) {
+# split it out
+        ($in{'year'},$in{'month'},$in{'day'},$in{'invoiceNumber'},$in{'customerNumber'},$in{'orderStatus'},$in{'firstName'},$in{'lastName'},$in{'fullName'},$in{'companyName'},$in{'emailAddress'},$in{'orderFromState'},$in{'orderFromPostal'},$in{'orderFromCountry'},$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{'GatewayUsed'},$in{'buySafe'}) = split(/\t/,$_);
+
+$in{'adminMessages'} .= "<br>buySAFE fees removed manually by admin: $buyDate<br>";
+$in{'orderTotal'} = &format_pricemgr($in{'orderTotal'} - $in{'buySafe'});
+$in{'buySafe'} = ""; # zero out buysafe fees
+
+     $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'}\t$in{'GatewayUsed'}\t$in{'buySafe'}\n";
+                   $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");
+}
+
+#################################################
 print <<ENDOFTEXT;
 <center>
 <table width="580">
 <tr>
-<td align="center">
-<font face="arial" size="2" color="red">The buySAFE surety bond on Order# $inv_number has been successfully cancelled <br /><br /></font>
+<td align="center"><br/>
+<font face="arial" size="+1" color="red">Success!<br/></font><font face="arial" size="2" color="red">The buySAFE surety bond on Order# $cust_number has been successfully cancelled.<br/>The Cancellation ID# is:  $CancelRS_id.  Make sure to record this number for future reference<br /><br /></font>
+</td>
+</tr>
+<tr>
+<td colspan="2"><hr width="580" /></td>
+</tr>
+</table>
+</center>
+ENDOFTEXT
+} 
+else {
+print <<ENDOFTEXT;
+<center>
+<table width="580">
+<tr>
+<td align="center"><br/>
+<font face="arial" size="+1" color="red">Failure!<br/></font><font face="arial" size="2" color="red">The buySAFE surety bond on Order# $inv_number has NOT been cancelled. It either was already cancelled or did not exist as a finalized bonded order.<br /><br /></font>
 </td>
 </tr>
 <tr>
diff -x .svn -aruN 5.2.004.src/protected/custom/customizeable_category_builder_routines.pl 5.2.005.src/protected/custom/customizeable_category_builder_routines.pl
--- 5.2.004.src/protected/custom/customizeable_category_builder_routines.pl	1969-12-31 18:00:00.000000000 -0600
+++ 5.2.005.src/protected/custom/customizeable_category_builder_routines.pl	2008-09-06 23:44:35.000000000 -0500
@@ -0,0 +1,17 @@
+# file ./store/protected/custom/customizeable_category_builder_routines.pl
+#######################################################################################
+#
+# Use this file to customize your category and sub category links that are displayed in the headers
+# or footers of the store when a customer visits your store.
+#
+# change only the values for the variables (they start with a \$) between the single quote marks (')
+# If you are not familiar with editing of programming variables, just use the defaults.
+# 
+#######################################################################################
+\$custom_sc_main_category_indent = '&bull;';
+\$custom_sc_sub_category_indent = '&nbsp;&nbsp; ';
+\$custom_sc_main_category_css_class = 'ac_left_links';
+\$custom_sc_sub_category_css_class = 'ac_left_links';
+\$custom_sc_main_category_end_html = '<br />';
+\$custom_sc_sub_category_end_html = '<br />';
+1;
\ No newline at end of file
diff -x .svn -aruN 5.2.004.src/protected/encryption-ext_lib.pl 5.2.005.src/protected/encryption-ext_lib.pl
--- 5.2.004.src/protected/encryption-ext_lib.pl	2008-06-26 07:48:45.000000000 -0500
+++ 5.2.005.src/protected/encryption-ext_lib.pl	2008-08-30 20:16:46.000000000 -0500
@@ -1,6 +1,6 @@
 # file ./store/protected/encryption-ext_lib.pl
 
-$versions{'encryption-ext_lib.pl'} = "5.0.000";
+$versions{'encryption-ext_lib.pl'} = "5.1.000";
 
 {
  local ($modname) = 'gnupg encryption';
diff -x .svn -aruN 5.2.004.src/protected/featured_product-ext_lib.pl 5.2.005.src/protected/featured_product-ext_lib.pl
--- 5.2.004.src/protected/featured_product-ext_lib.pl	2008-06-26 07:48:45.000000000 -0500
+++ 5.2.005.src/protected/featured_product-ext_lib.pl	2008-08-30 20:16:47.000000000 -0500
@@ -38,7 +38,7 @@
 # K-Factor Technologies, Inc. in order to distribute this add-on to AgoraCart (aka Agora.cgi).
 #
 ##########################################################################
-$versions{'featured_product-ext_lib.pl'} = "5.2.000";
+$versions{'featured_product-ext_lib.pl'} = "5.5.001 Gold Version";
 
 $mc_featuredProductPath="$mgrdir/misc/featuredproduct.pl";
 
diff -x .svn -aruN 5.2.004.src/protected/freeform_logic-ext_lib.pl 5.2.005.src/protected/freeform_logic-ext_lib.pl
--- 5.2.004.src/protected/freeform_logic-ext_lib.pl	2008-06-26 07:48:45.000000000 -0500
+++ 5.2.005.src/protected/freeform_logic-ext_lib.pl	2008-08-30 20:16:47.000000000 -0500
@@ -1,6 +1,6 @@
 # file ./store/protected/freeform_logic-ext_lib.pl
 
-$versions{'freeform_logic-ext_lib.pl'} = "5.0.000";
+$versions{'freeform_logic-ext_lib.pl'} = "5.1.000";
 
 {
  local ($modname) = 'freeform_logic';
diff -x .svn -aruN 5.2.004.src/protected/images/Rocketship5b210.jpg 5.2.005.src/protected/images/Rocketship5b210.jpg
--- 5.2.004.src/protected/images/Rocketship5b210.jpg	1969-12-31 18:00:00.000000000 -0600
+++ 5.2.005.src/protected/images/Rocketship5b210.jpg	2008-06-28 15:41:05.000000000 -0500
@@ -0,0 +1,41 @@
+ JFIF   d d   Ducky     <   Adobe d     		
+
+
+
+

  `                                 !1AQ"aq2BR#b3CѲcs4r$TU     !1AQaq"2B#Rbr3S   ? M>۽iJhuSȹ$U	iFKm #9\FfCnj3]qB -'j,8Md֤*BOlE\je/p`pe g'Ҋq>t./ j|t
 >ו3\Xqw	"fmZ|lh\T
+0u*BBBBBBBBBBBBBBBBBc$ƺp>	"oltrȭؤ[qmsa{#{۷[SQ?Vgvf鷏
+H|?):~ m/=q(}ZV$R{-QTS9OGy:	
&6I	 Gn:I'<9*3B4ncB[fmƝϟ_Z1B85v; c22,\/xyρܻ^3|G	V(H]B36q Um+
u'˴{4+v5%lE8UǁV)
+|XeH#n[|u#*ATBBBBBBBBBBi]Y$Cz\UYQ!Yޛ47am5Tc6[1I7}gJNݦhC pdd1%/n1G?
GFH#O;Lzu6ܷhܰ[ v'8DeGS+ڽT٭׾A ;]E1#K"reWJյx	tBIj-L"^.&>SEr\[!!nǕ_wkzg!9n"[`aƒ/iڷ	_f`di# 8 ,pM^NzʚIllΊy\>B	bKveܢ:f<Mcq8TM<]XN$08tOJ2..
+er]U7.M}?`כ~}|va3%v%Åw:.?*+rZj{}CH#%3x54:E6EE\+:6EJhͣIH /qӓr.CLT2rXcHɱE^<$t=X+"n8x"l@1_wºrYfǤ_2ZI,KoJ]/9y~vV8EY
kKRs/lnK@ TْBBBBk"xiGV`,Xg+񌄦'!6~Z gBMc"A&4&8&ǀn_?@kl>}K!unMoϝ[yj=Pv5( y5UQ|N2M}=ұK<$"gI8d$`R{k{ڼʴٶ4(.ݹMyXG4JDJk4;T
c;}A͇|0
+2/XB@8sl*UGߌόctV)-
Z\lTp9sϜ 6an?9I|'mcLu!b[W9,tk\iN×FlۛgDrq8TzFX]_&sFt[ko?RטܟN)ÒY<Qڼtݫo;?	ȡ LL=
+yd8Mz^IaǇtwwn^wn
+`e?? Î}LY<h%"eҢm^[Z(lp>dםo'@8 +5gփ"_d3j2C謊8
+:E W<^۩lsS4΁z}10#Զn[W1˗
+rpOiZ͖QPO?"P*Lb=1 ͞^[Z[gp
B` 9cFGtiqHK^>^aGSs%`>۔ 0biߢK:m?mUWmndՅxj1=)=TUh}鸴w홣#Ny{Wfڊ"=*,'Mkw-!rpI>*G"<Mm"{߆bW2:4K*ٝٳOLv(Ag6Swwm32V1&ӏ
4]OU6U}*3}OESȡЦO;j#ȏUoR;'A:ri)79VVͶʣ)4ϕjzsfoG艦T/$^a+iW/cS-f5#а0/Ӫ6Xb33LW"_)]Hy
+T ؈Wf2cpE*]L|]ƞ-4 }Ոn`dKۜp|45zmAGkyLBpXWol8G4̑Oc'IYq6ZǋKZ-S~iȖx1sYئX[W?ѱ_<
rgU3d]T%O
+M2pWv縰S{8Ue, }{5 Gƌ#bBufY$H<i617$9nNV@3(4Íc&$mӏ2"ëUif$/sk{
+3-cyI흆SGL&`Wc`.G
+[ngsxi[.Iu;Ofgxueq1'ƣvmOR^6fy˷fܰȂ{uّ$C}$mUmF`=4CG1ohg&đH5##".[db(13EE&/M]!;MO}9VUv^L#lxrS+ebe
+ȅ+)<lVPW.xmVRcO/-"	I'A`xt\^J;otݳi^sCsğn=9fM3M.+|]>[hH}UptmzSO-G;nX.Vf(	Cc[U>郯l]' o 7_~ze'g>ocwuIyUa+3ͨ6\Y*wdE@,/M
+<?#ZH:3aKj
֒xzڮxYM+ۀLeHHYE (REHWDV?Rax&nH5YQJ5sZ0qs}fvwO?nOǏK5eo0=(!zTgu:wUċ KN!GsIb4i=$c}`hNNB+Đtm]AUk<)k7 )zL<,u$g"Ug
+
+W-jUcV5t@#^'QqɯxѨX#
+g$xRYBDޝ
+eSxۿVbM68ĜAQ0k D[YWT84:ՓXl6Q{l-Vbi47KԶVc^}+JT8jӝ;b/ݱs*aO#:
+du"׵W&P6jWN4!+|bly1I
v7e4 *mZçr5{dP8uMdDǥ-&-ǟE#m3UYE$3lU2)12hDT
h?	P&>[v1?iȎmeݠm$L 4GK#`Y?*i,=oNbĆEScaKh; [VOݱt^(#
+I#Z^)a-?	*V<¼{cܪtDø8kң9@Ob)}nF@+5ڽj#ׇw61n:YH5k5Ҍ*qcʉyZK<Vf r ^kn٘(F|~hpT*')X\} i[H2EX4%M"	SgOpm }*o1Dq~VH\*v
+iؿO~IkEg<o#ӫCǎ{\ΩxXrv֬	"xurҶ~vO? ?95t@
+5J1?$۝U/	+!;mO
ΈnLb#ڣed~>N4mGq~`GBs
+/\QHQ\)+ݻh#81ŗ ƒ#e?MYC+Z≢FƺAM48p}$ɇ:ƅJԳomBȾ(⦸kLkI&c"/8-""ŁDDݼm\UOMJrØ*}@F{1d>V>JC3FcdlUL۫CTH
+Hʼv݋+l\ GQX搼eA%}Ʊ]Ծ:
+p$-\^.ΙrdG;A'p񜙣Ҧ;G?h9\T=ŭjS{V#D55
+c' G :;♆Q}:mPALξRiѮyS/Pضæ4Q%G!GH~P󔽾i5H_qʭ|^.Lذ$2ue),f;$«ʂWp+.*ќ	VHB0p
Loqښ=n>bx2NߓPf}Gpn˞'FM
+(#|#6i?r7 ntUiǻLIre2>p_'mS7-Qg#:aϔX㓢ƫ2up2DgS
+==M - 41h1t1@ļ4 `6BceoP- yc^<rpZ4RYrf^ue:t_
&kظBxƅjvHܓu)<|#;Nrpkgf#nOT~]+zv:Et.u4:ߧ{ola*ݬXnx2V\蔞U7Խ̀%Bc k-l{:']9+o2JFi^/n=rCԗrTldu*
+cJ7j	vEco-HiыKBaJJoNr$fdg_;>UFݠ;֮"tuG˔B<r,p
fe*_UHH~n`cFLUA8~Q*p7n4vV`F(nʳQsYn\bE~9Ϗ8f'\ .%&_50?GֺT1\_NNu
 S$ުVfXKeb/FO"*~d QǺFܻD \}C𙄇4}ʟ:G+]j9Y|wox8dV7[0@;d㵻RJ6)AQ͐r0??)-nb4skTFi(kRVe]B$6f O%igmq1c2FbֵtT)4~yg2UWR)&Urd9ɻ@lpSHw>!T؈f^!%%V<Edu[%mŁZڴ^|1Ipq
؍1Hu5sse& ٱpE]#QYڤQ}nC1*F<d0wϐ\]X&Y\h.TQ=*M>ՉHBe+t%&#U4TeX)f<jzJ]}nnG(D[gun`{}Ujy)Vx53f,^'RuWi׸E:on6FAyMKzeIY6\섅)RaZpcY^VS$;لRF6ɪY%*̥EI4],&eR@2m [1s5w5kJOÜa]\rI#<1I=O4(~ǑOV|0-ohcbn$m2?LL]#FK#=i&?Shi^- w!/U(OF>(o2+/9 r
AC7Ǐ4E_/#FAmL"qđq͕EʰXc4lm(T t8~jRH5vOQ& }LE0M4D:drWh&9SMkEQ@=" #mRU2(ѩTe;xa0oo!sΠc fRe0<j#
+1IcMcIf9Cg:*Yf<\4z]7VWglÿ;GriL#"iIV9N0Ha(;FB\:K'C1Y2ovlV=@p%d"`gm~UTW>I}{C%3&A
+&Ld X]Gj#'֞6jܽUd5fwXH*k
+W`I) .WӨƙ7l3zIǆ#;#zjmDa@$@})"n(((Vmk{[1&@wbm^F>I
du8e4#&u' N/<lI7R}Ue6\p@߁ Fb.j<ص_ܦv>fY + lFdfo{P.^ldRİ/S[[ƖZM{[BUr82>X}2-<*7LgLgƑ3UƺW\X3l}L1 nxU,Ͷ9>#Ä{;'
+X1V'iHX[.Z)/iT㍇ Kق@$>>}B4"M\\}-Ynn=>sS[G$|dcHbboI?jAH11zf ^𮅭*цXk4; W<NX\Q<W 3"[1<t~ɘ6lX"$I'َi6
+7*#2[swQ's鸒wM
&+_}]-94 ^noSO$i3H,Tp|j{%&og͋t1uV~-yf%Hj9`@YdhiYZUTe5m*$ t*U ( 2.}TxRUgPÏT,TJ㲷5?1CqAǧ5<'BXZ([I6Şl?'b8Hy% n/?97
r?7n<+oGݑqu"ȲƆC[PA#15J=(yx{{V_h+4*+^6&n-_	+y8cRO1+l̣qV[>:+A4V,K7 [}Vvg	Ʊ 4*fʐXGRT{R(3l$#vw~[OjyX{{I7,@}d;E$ٷl"|F&Ov 20/g"!cbfrk/!D!D!D!D!D!D!D!D!D!D!D!D!D!D!D!D!D!D&43ƲGU5H>jc6<OHkm$R	׳n>?9Ϸc7l|X8%?
+mi,ZNílfό}݌f2t`ï:G,Z#5+NTx}F<;NHei'D}Ӝu],叜Ov91/qGPt.TϏZ:&x~usQFB^+LBBBBBBBBBBO
\ No newline at end of file
diff -x .svn -aruN 5.2.004.src/protected/main_settings-ext_lib.pl 5.2.005.src/protected/main_settings-ext_lib.pl
--- 5.2.004.src/protected/main_settings-ext_lib.pl	2008-06-26 07:48:45.000000000 -0500
+++ 5.2.005.src/protected/main_settings-ext_lib.pl	2008-09-03 03:55:28.000000000 -0500
@@ -1,6 +1,6 @@
 # file ./store/protected/main_settings-ext_lib.pl
 
-$versions{'main_settings-ext_lib.pl'} = "5.2.003";
+$versions{'main_settings-ext_lib.pl'} = "5.2.006";
 #######################################################################################
 # Misc Variables
       use File::Copy;
@@ -12,7 +12,6 @@
   $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">~;
 #######################################################################################
 
 {
@@ -179,6 +178,7 @@
 
 $order_email = &my_escape($in{'email_address_for_orders'}); 
 $admin_email = &my_escape($in{'admin_email'});
+$sc_replyto_email_temp = &my_escape($in{'sc_replyto_email'});
 $order_email5 = &my_escape($in{'second_email_address_for_orders'});
 if ($in{'second_email_orders_yes_no'} =~ /yes/i) {
 $order_email6 = "," . $order_email5;
@@ -239,6 +239,19 @@
 $myset .= "\$sc_order_email = \"$order_email\";\n";
 $myset .= "\$sc_first_order_email = \"$first_order_email\";\n";
 $myset .= "\$sc_second_order_email = \"$order_email5\";\n";
+if ($in{'sc_email_content_type'}) {
+    $myset .= "\$sc_email_content_type = \"$in{'sc_email_content_type'}\";\n";
+} else {
+    $myset .= "\$sc_email_content_type = \"text/plain\";\n";
+}
+
+$myset .= "\$sc_admin_email = \"$admin_email\";\n";
+
+if ($sc_replyto_email_temp ne '') {
+    $myset .= "\$sc_replyto_email = \"$sc_replyto_email_temp\";\n";
+} else {
+    $myset .= "\$sc_replyto_email = \"$admin_email\";\n";
+}
 $myset .= "\$sc_use_customer_email_over_admin = \"$in{'sc_use_customer_email_over_admin'}\";\n";
 $myset .= "\$sc_use_dynamic_email_subjects = \"$in{'sc_use_dynamic_email_subjects'}\";\n";
 
@@ -248,7 +261,6 @@
 } 
 $myset .= "\$sc_ssl_location_url2 = \"$in{'sc_ssl_location_url2'}\";\n";
 $myset .= "\$sc_stepone_order_script_url = \"$in{'sc_ssl_location_url2'}\";\n";
-$myset .= "\$sc_admin_email = \"$admin_email\";\n";
 $myset .= "\$sc_domain_name_for_cookie = \"$cookieDomain\";\n";
 $myset .= "\$sc_path_for_cookie = \"$cookiePath\";\n";
 $myset .= "\$sc_self_serve_images = \"$in{'sc_self_serve_images'}\";\n";
@@ -356,7 +368,7 @@
 
 
   #DOCTYPE
-  $myset .= "\$sc_doctype =  qq|$mc_doctype|;\n";
+  $myset .= "\$sc_doctype =  qq|$in{'sc_doctype'}|;\n";
 
 &codehook("other_program_settings");
 if ($other_program_settings ne "") {
@@ -505,6 +517,10 @@
   $sc_scramble_cc_info = "no";
  }
 
+if ($sc_doctype eq ""){
+  $sc_doctype = qq~<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">~;
+ }
+
 if ($sc_use_international_latin_characters eq ""){
   $sc_use_international_latin_characters = "no";
  }
@@ -760,7 +776,7 @@
 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://www.$ENV{'SERVER_NAME'}/store5/agora.cgi</b>)</small>
+(ex: <b>http://www.$ENV{'SERVER_NAME'}/store52/agora.cgi</b>)</small>
 </td>
 </tr>
 
@@ -822,7 +838,22 @@
 </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 Header Settings - Misc</b></font></td>
+</tr>
+<tr>
+<td><br /></td>
+</tr>
+
+<tr>
+<td colspan="2"><b>Doc Type</b><br/><font face="Arial, Helvetica, sans-serif" size=2>
+This is the html doc type to be included on all your pages</font>
+<br/>
+Example: <b>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;</b><br/>
+<TEXTAREA name="sc_doctype" 
+cols="68" rows="2">$sc_doctype</TEXTAREA></td>
 </tr>
 
 <tr>
@@ -944,7 +975,7 @@
 </select></td></tr>
 <tr><td colspan=4>Email Address to use: <INPUT 
 NAME="email_address_for_orders" TYPE="TEXT" 
-VALUE="$sc_first_order_email" SIZE="48">
+VALUE="$sc_first_order_email" SIZE="70">
 </td>
 </tr>
 <tr>
@@ -959,7 +990,7 @@
 </select></td></tr>
 <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">
+VALUE="$sc_second_order_email" SIZE="70">
 </td>
 </tr>
 
@@ -971,9 +1002,32 @@
 <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="70">
+</td>
+</tr>
+<tr>
+<td colspan=4><hr /></td>
+</tr>
+<tr>
+<td colspan=4>
+<b>Enter the e-mail address you wish to list as to use as teh Reply To email address on emails sent to customers</b><br /><small>NOTE: if left blank, the admin address listed above will be used. Used by default (by mail-lib.pl), otherwise it is ignored unless if you switch mail libraries manually in the agora.setup.db file.</small>
+</td>
+
+<tr>
+<td colspan="2">
+<input name="sc_replyto_email" TYPE="TEXT" value="$sc_replyto_email" SIZE="55">
+</td>
+</tr>
+
+
 
 <tr>
-<td colspan=2><br /><b>Do you wish to have admin emails shown as "From" the customer?</b><br /><small>Order confirmation emails to the admin(s) will show the admin email address in the from field of an email by default. This allows you to use the customer's email address instead of the admin's email address. Applies only to emails to the admin when an order confirmation is to be emailed. Also, if you have problems recievign the emails after chaging this, you might be restricted by your server and must use an admin email address that is linked to or based on your hosting account (domain names used on your hosting account). Default is no.</small></td>
+<td colspan=4><hr /></td>
+</tr>
+<tr>
+<td colspan=2><br /><b>Do you wish to have admin emails shown as "From" the customer?</b><br /><small>Order confirmation emails to the admin(s) will show the admin email address in the from field of an email by default. This allows you to use the customer's email address instead of the admin's email address. Applies only to emails to the admin when an order confirmation is to be emailed. Also, if you have problems receiving the emails after changing this, you might be restricted by your server and must use an admin email address that is linked to or based on your hosting account (domain names used on your hosting account). Default is no.</small></td>
 <td colspan=2><br /><select name="sc_use_customer_email_over_admin">
 <option>$sc_use_customer_email_over_admin</option>
 <option>no</option>
@@ -981,12 +1035,6 @@
 </select></td></tr>
 
 <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>
 
diff -x .svn -aruN 5.2.004.src/protected/manager.cgi 5.2.005.src/protected/manager.cgi
--- 5.2.004.src/protected/manager.cgi	2008-06-26 07:48:45.000000000 -0500
+++ 5.2.005.src/protected/manager.cgi	2008-09-06 23:45:04.000000000 -0500
@@ -13,7 +13,7 @@
   print `./wrap_mgr.o`;
   &call_exit;
  }
-$versions{'manager.cgi'}="5.2.003";
+$versions{'manager.cgi'}="5.2.005";
 $manager_program_running = "yes";
 chdir(".."); 
 &setup_manager;
@@ -58,8 +58,8 @@
 \$custom_sc_sub_category_indent = '&nbsp;&nbsp; ';
 \$custom_sc_main_category_css_class = 'ac_left_links';
 \$custom_sc_sub_category_css_class = 'ac_left_links';
-\$custom_sc_main_category_end_html = '<br />';
-\$custom_sc_sub_category_end_html = '<br />';
+\$custom_sc_main_category_end_html = '<br/>';
+\$custom_sc_sub_category_end_html = '<br/>';
 1;
 |;
   open(UPDATEFILE,">$mgrdir/custom/customizeable_category_builder_routines.pl") || &my_die("Can't Open $mgrdir/custom/customizeable_category_builder_routines.pl");
diff -x .svn -aruN 5.2.004.src/protected/misc/customizeable_category_builder_routines.pl 5.2.005.src/protected/misc/customizeable_category_builder_routines.pl
--- 5.2.004.src/protected/misc/customizeable_category_builder_routines.pl	2008-06-26 07:48:45.000000000 -0500
+++ 5.2.005.src/protected/misc/customizeable_category_builder_routines.pl	1969-12-31 18:00:00.000000000 -0600
@@ -1,17 +0,0 @@
- # file ./store/protected/custom/customizeable_category_builder_routines.pl
-#######################################################################################
-#
-# Use this file to customize your category and sub category links that are displayed in the headers
-# or footers of the store when a customer visits your store.
-#
-# change only the values for the variables (they start with a $) between the single quote marks (')
-# If you are not familiar with editing of programming variables, just use the defaults.
-# 
-#######################################################################################
-$custom_sc_main_category_indent = '&bull;';
-$custom_sc_sub_category_indent = '&nbsp;&nbsp; ';
-$custom_sc_main_category_css_class = 'ac_left_links';
-$custom_sc_sub_category_css_class = 'ac_left_links';
-$custom_sc_main_category_end_html = '<br />';
-$custom_sc_sub_category_end_html = '<br />';
-1;
diff -x .svn -aruN 5.2.004.src/protected/product_edit-ext_lib.pl 5.2.005.src/protected/product_edit-ext_lib.pl
--- 5.2.004.src/protected/product_edit-ext_lib.pl	2008-06-26 07:48:45.000000000 -0500
+++ 5.2.005.src/protected/product_edit-ext_lib.pl	2008-08-29 18:43:13.000000000 -0500
@@ -1,6 +1,6 @@
 # file ./store/protected/product_edit-ext_lib.pl
 
-$versions{'product_edit-ext_lib.pl'} = "5.2.001";
+$versions{'product_edit-ext_lib.pl'} = "5.2.002";
 $sc_userfieldsfile="$mgrdir/misc/userfields.pl";
 $mc_shipfilename = "$sc_data_file_dir/shipping_dimensions.file";
 &require_supporting_libraries(__FILE__,__LINE__,
@@ -967,6 +967,9 @@
  }
 
 $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;
@@ -1089,6 +1092,9 @@
 
 
 $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;
diff -x .svn -aruN 5.2.004.src/protected/ship_settings-ext_lib.pl 5.2.005.src/protected/ship_settings-ext_lib.pl
--- 5.2.004.src/protected/ship_settings-ext_lib.pl	2008-06-26 07:48:45.000000000 -0500
+++ 5.2.005.src/protected/ship_settings-ext_lib.pl	2008-08-31 05:40:07.000000000 -0500
@@ -35,7 +35,7 @@
 #
 ##########################################################################
 
-$versions{'ship_settings-ext_lib.pl'} = "5.2.001";
+$versions{'ship_settings-ext_lib.pl'} = "5.2.003";
 $sc_custom_shipping_methodname_string = '';
 $sc_shipadminfile="$mgrdir/misc/ship_admin.pl";
 
@@ -130,14 +130,6 @@
 
 # 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";
@@ -151,7 +143,7 @@
     $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}">
+      $sc_shiptomethod_4forms .= qq~\n<OPTION value="$in{$custom_shipping_methodname2}">
       $in{$custom_shipping_methoddescrip2}</option>~;
     }
     $howmanycustomshippingmethod_temp++
@@ -188,19 +180,27 @@
 }
 
 if ($in{'sc_upsgroundres'} =~ /yes/i) {
-  $sc_shiptomethod_4forms .= qq~\n<OPTION VALUE="UPS Ground Residential(GNDRES)">UPS Ground Residential</OPTION>~;
+  $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>~;
+  $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>~;
+  $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 .= qq~\n<OPTION value="UPS Next Day (1DA)">UPS Next Day</option>~;
 }
 
-$sc_shiptomethod_4forms .= "\n</SELECT>";
+  $myset .=  "\$sc_override_shipmethods_4forms = qq~$in{'sc_override_shipmethods_4forms'}~;\n";
+  $myset .=  "\$sc_shiptostates_4forms = qq~$in{'sc_shiptostates_4forms'}~;\n";
+  $myset .=  "\$sc_shiptocountries_4forms = qq~$in{'sc_shiptocountries_4forms'}~;\n";
+
+if ($in{'sc_override_shipmethods_4forms'} eq 'No') {
+  $myset .=  "\$sc_shiptomethod_4forms = qq~$in{'sc_shiptomethod_4forms'}~;\n";
+} else {
+  $myset .=  "\$sc_shiptomethod_4forms = qq~$sc_shiptomethod_4forms~;\n";
+}
 
 &update_store_settings('shipping',$myset); # main settings
 $myset = "";
@@ -252,6 +252,256 @@
     $sc_ups_non_xml_adjust = "yes";
 }
 
+if ($sc_shiptostates_4forms eq '') {
+    $sc_shiptostates_4forms = qq|
+<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>|;
+}
+
+if ($sc_shiptocountries_4forms eq '') {
+    $sc_shiptocountries_4forms = qq|
+<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>Japan</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>|;
+}
+
+if ($sc_shiptomethod_4forms eq '') {
+    $sc_shiptomethod_4forms = qq|
+<select name=Ecom_ShipTo_Method>
+<option value="\$vform_Ecom_ShipTo_Method">\$vform_Ecom_ShipTo_Method2</option>
+<option value="Local Delivery">
+      Local Delivery</option>
+<option value="Pickup">
+      Pickup</option>
+<option value="USPS Priority Mail (Priority)">
+USPS Priority Mail (3-7 days)</option>
+<option value="USPS (Priority Mail International)">
+Priority Mail International (6-10 days)</option>
+<option value="UPS Ground (GND)">UPS Ground (7-10 days)</option>
+<option value="UPS Standard (STD)">UPS Standard to Canada Only (7-10 days)</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>
+</select>|;
+}
+
 &require_supporting_libraries(__FILE__,__LINE__,
   "$mgrdir/misc/ship_admin.pl");
 
@@ -259,16 +509,16 @@
 
 <CENTER>
 <TABLE cellspacing=0 border=0>
-<TR>
-<TD><br/><HR></TD>
-</TR>
-<TR>
-<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>
+<tr>
+<td><br/><hr></td>
+</tr>
+<tr>
+<td bgcolor=#99CC99>
+<FONT FACE=ARIAL>Welcome to the <b>AgoraCart</b> Shipping Manager / Library settings.</td>
+</tr>
+<tr>
+<td><hr></td>
+</tr>
 </TABLE><br/>
 </CENTER>
 
@@ -278,12 +528,12 @@
 print <<ENDOFTEXT;
 <br><CENTER>
 <TABLE>
-<TR>
-<TD><br>
+<tr>
+<td><br>
 <FONT FACE=ARIAL SIZE=2 COLOR=RED>System settings have been 
 successfully updated. </FONT><br><br>
-</TD>
-</TR>
+</td>
+</tr>
 </TABLE>
 </CENTER>
 ENDOFTEXT
@@ -298,98 +548,98 @@
 <CENTER>
 <TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BORDER=0>
 
-<TR>
-<TD><b><b>In what loop</b> of calculate_final_values do you wish to calculate
+<tr>
+<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>
+</td>
 
-<TD>
-<SELECT NAME="sc_calculate_shipping_loop">
-<OPTION>$sc_calculate_shipping_loop</OPTION>
-<OPTION>0</OPTION>
-<OPTION>1</OPTION>
-<OPTION>2</OPTION>
-<OPTION>3</OPTION>
-</SELECT>
-</TD>
-</TR>
-
-<TR>
-<TD COLSPAN=2><HR></TD>
-</TR>
+<td>
+<select name="sc_calculate_shipping_loop">
+<option>$sc_calculate_shipping_loop</option>
+<option>0</option>
+<option>1</option>
+<option>2</option>
+<option>3</option>
+</select>
+</td>
+</tr>
 
-<TR>
+<tr>
+<td colspan=2><hr></td>
+</tr>
+
+<tr>
 <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">
-</TD>
-</td>
-</TR>
-
-<TR>
-<TD COLSPAN=2><br></TD>
-</TR>
+<td>
+<input name="sc_handling_charge" type="TEXT" SIZE=5 MAXLENGTH="5"
+value="$sc_handling_charge">
+</td>
+</td>
+</tr>
+
+<tr>
+<td colspan=2><br></td>
+</tr>
 
-<TR>
+<tr>
 <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>
+<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>
+<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>
-<OPTION>yes</OPTION> 
-<OPTION>no</OPTION> 
-</SELECT>
-</TD>
-</td>
-</TR>
-<TR>
-<TD COLSPAN=2><br></TD>
-</TR>
-<TR>
-<TD COLSPAN=2><HR></TD>
-</TR>
-<TR>
-<TD COLSPAN="2" bgcolor=#99CC99>
+<td>
+<select name=sc_add_handling_cost_if_shipping_is_zero>
+<option>$sc_add_handling_cost_if_shipping_is_zero</option>
+<option>yes</option> 
+<option>no</option> 
+</select>
+</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>
+</tr>
+<tr>
+<td colspan=2 ><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 and an origination state/province for that particular product.  No limit to locations/origination points.<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><br></TD>
-</TR>
+<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><br></td>
+</tr>
 
 <tr>
 <td colspan=2><hr/></td>
@@ -401,7 +651,7 @@
 </td>
 </tr>
 <tr>
-<td colspan=2 bgcolor=#99CC99><hr/></td>
+<td colspan=2><hr/></td>
 </tr>
 <tr>
 <td><br><b>Enable Dimensions in Product Database?</b>  This allows you to enter individual product dimensions for items that ship in their own box or separately from other items via a real-time shipping method (USPS). If unsure, leave blank. </td>
@@ -419,131 +669,141 @@
 <td colspan=2><br></td>
 </tr>
 
-<TR>
-<TD COLSPAN=2><HR></TD>
-</TR>
+<tr>
+<td colspan=2><hr></td>
+</tr>
 
-<TR>
-<TD COLSPAN="2" bgcolor=#99CC99>
+<tr>
+<td colspan="2" bgcolor=#99CC99>
 <b>Custom Shipping Logic:</b>
-</TD>
-</TR>
-<TR>
-<TD COLSPAN=2 bgcolor=#99CC99><HR></TD>
-</TR>
-<TR>
+</td>
+</tr>
+<tr>
+<td colspan=2 ><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 
 both set to "no" then the "shipping" field in the database
 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>
-<OPTION>$sc_use_custom_shipping_logic</OPTION>
-<OPTION>yes</OPTION> 
-<OPTION>no</OPTION> 
-</SELECT>
-</TD>
-</TR>
-<TR>
-<TD COLSPAN=2 bgcolor=#99CC99><HR></TD>
-</TR>
-<TR>
+<td>
+<select name=sc_use_custom_shipping_logic>
+<option>$sc_use_custom_shipping_logic</option>
+<option>yes</option> 
+<option>no</option> 
+</select>
+</td>
+</tr>
+<tr>
+<td colspan=2 ><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>
+<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><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>
-<OPTION>$sc_use_SBW2</OPTION>
-<OPTION>yes</OPTION> 
-<OPTION>no</OPTION> 
-</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><br><br>
-</TD>
-</TR>
-
-<TR>
-<TD COLSPAN=2><br></TD>
-</TR>
-<TR>
-<TD COLSPAN=2><HR></TD>
-</TR>
-<TR>
-<TD COLSPAN="2" bgcolor=#99CC99>
+<td>
+<select name=sc_use_SBW2>
+<option>$sc_use_SBW2</option>
+<option>yes</option> 
+<option>no</option> 
+</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><br>
+<TEXTAREA name="sc_custom_shipping_logic" 
+cols="110" rows=20 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" 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> 
+</td>
+</tr>
+<tr>
+<td colspan=2 ><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 display the number of fields you need.  The actual logic is created in the section above (see the example custom logic, and consult the user forums and the <a href="http://www.agoracart.com/agorawiki/index.php?title=The_AgoraCart_Project:User_Manual" target="_blank">wiki/documentation</a> for more help).  You will also need to place the output at the bottom of this page (only after pressing the submit button) in your order forms as it's not automatically inserted/changed in the checkout/order forms.</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>
+<option>31</option>
+<option>32</option>
+<option>33</option>
+<option>34</option>
+<option>35</option>
+<option>36</option>
+<option>37</option>
+<option>38</option>
+<option>39</option>
+<option>40</option>
+</select>
+</td>
+</tr>
+<tr>
+<td colspan=2><br></td>
+</tr>
+<tr>
+<td colspan=2> 
 ENDOFTEXT
 
 
@@ -556,8 +816,8 @@
 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>
+<small>Method Name: </small><input name="$custom_shipping_methodname" type="TEXT" SIZE=22 MAXLENGTH="35" value="$custom_shipping_methodname2">
+&nbsp;&nbsp;<small>Name for Drop-down Lists: </small><input name="$custom_shipping_methoddescrip" type="TEXT" SIZE=22 MAXLENGTH="35" value="$custom_shipping_methoddescrip2"><br>
 ENDOFTEXT
 $howmanycustomshippingmethod_temp++;
 }
@@ -565,135 +825,134 @@
 } else {
 
 print <<ENDOFTEXT;
-</TD>
-</TR>
-<TR>
-<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>
+</td>
+</tr>
+<tr>
+<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><br/><HR></TD>
-</TR>
+<tr>
+<td colspan=2><br/><hr></td>
+</tr>
 
 
-<TR>
-<TD COLSPAN=2 bgcolor=#99CC99>
+<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>
+</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>
-<OPTION>yes</OPTION> 
-<OPTION>no</OPTION> 
-</SELECT>
-</TD>
-</TR>
-
-<TR>
-<TD COLSPAN=2><HR></TD>
-</TR>
+<td>
+<select name=sc_use_SBW>
+<option>$sc_use_SBW</option>
+<option>yes</option> 
+<option>no</option> 
+</select>
+</td>
+</tr>
 
-<TR>
+<tr>
+<td colspan=2><hr></td>
+</tr>
+
+<tr>
 <td colspan=2><b>Allow Shipments via which services?</b><br/><small>(selecting yes or no on a shipping method does not change shipping options on order forms)</small><br><br>
 &nbsp;&nbsp;
-USPS:<SELECT NAME=sc_use_USPS>
-<OPTION>$sc_use_USPS</OPTION>
-<OPTION>no</OPTION>
-<OPTION>yes</OPTION> 
-</SELECT>
+USPS:<select name=sc_use_USPS>
+<option>$sc_use_USPS</option>
+<option>no</option>
+<option>yes</option> 
+</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 "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>
+</td>
+</tr><tr><td colspan=2><hr></td></tr>
 
-<TR>
+<tr>
 <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">
+&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>
+</td>
+</tr>
 
-<TR>
-<TD><br><b>Display Product ID number in recommended box packing order?</b><br>
+<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>
 
-<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.  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> 
- </SELECT></TD> 
-</TR>
+<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?  The LWP library should be
+present and is the default option. If not, then the http-lib has been included here as a backup.  Note: If on a vdeck control panel based server, do not select the "http-lib" option.<br>
+</td>
+<td> 
+ <select name=sc_use_socket>
+ <option>$sc_use_socket</option> 
+ <option>LWP</option>
+ <option>http-lib</option> 
+ </select></td> 
+</tr>
 ENDOFTEXT
 
 if (($sc_use_USPS =~ /yes/i)||($sc_use_USPS eq '')) {
 print <<ENDOFTEXT;
-<TR>
-<TD COLSPAN=2><br/><HR></TD>
-</TR>
-<TR>
-<TD COLSPAN=2 bgcolor=#99CC99>
+<tr>
+<td colspan=2><br/><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>
+</tr>
+<tr>
+<td colspan=2 ><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">
+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">--><br>
-USPS ORIGIN ZIP: <INPUT NAME="sc_USPS_Origin_ZIP" TYPE="TEXT" SIZE=5
-MAXLENGTH="5" VALUE="$sc_USPS_Origin_ZIP"><br><br>
+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>
@@ -728,25 +987,25 @@
 <option>yes</option>
 <option>no</option>
 </select><br/>
-</TD>
-</TR>
+</td>
+</tr>
 ENDOFTEXT
 }
 
 if (($sc_use_UPS =~ /yes/i)||($sc_use_UPS eq '')) {
 print <<ENDOFTEXT;
-<TR>
-<TD COLSPAN=2><br/><HR></TD>
-</TR>
-<TR>
-<TD COLSPAN=2 bgcolor=#99CC99>
+<tr>
+<td colspan=2><br/><hr></td>
+</tr>
+<tr>
+<td colspan=2 bgcolor=#99CC99>
 <b>UPS - United Parcel Service</b>
-</TD>
-</TR>
-<TR>
-<TD COLSPAN=2 bgcolor=#99CC99><HR></TD>
-</TR>
-<TR>
+</td>
+</tr>
+<tr>
+<td colspan=2 ><hr/></td>
+</tr>
+<tr>
 <td colspan=2>
 <br>
 ENDOFTEXT
@@ -754,78 +1013,127 @@
 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>
+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>
+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>
-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>
+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>
+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>
+</td>
+</tr>
+<tr>
+<td colspan=2><br><hr/></td>
+</tr>
+<tr>
+<td colspan=2 bgcolor=#99CC99>
+<b>Ship To: State/Province and Country Lists for Order Froms</b>
+</td>
+</tr>
+<tr>
+<td colspan=2><hr/></td>
+</tr>
+<tr>
+<td><br/>
+<b>States/Provinces:</b><br/>
+Below are the states/provinces you allow shipments to, for use within your order forms.<br><br><b>NOTE:</b>  New order forms will use this output. If your order form does not automatically reflect any changes, your orderforms are older and you must <b>Cut and paste</b> the code below and place it into your order forms manually for the gateways you wish to use:<br>
+<textarea 
+name="sc_shiptostates_4forms" 
+cols="55" rows="15" 
+wrap="soft">$sc_shiptostates_4forms</textarea>
+</td>
+<td><br/>
+<b>Countries:</b><br/>
+Below are the countries you allow shipment to, for use in your order forms. <br><br><b>NOTE:</b>  New order forms will use this output. If your order form does not automatically reflect any changes, your orderforms are older and you must <b>Cut and paste</b> the code below and place it into your order forms manually for the gateways you wish to use:<br>
+<textarea 
+name="sc_shiptocountries_4forms" 
+cols="55" rows="15" 
+wrap="soft">$sc_shiptocountries_4forms</textarea>
+</td>
+</tr>
+<tr>
+<td colspan=2><br><hr/></td>
+</tr>
+<tr>
+<td colspan=2 bgcolor=#99CC99>
+<b>Shipping Methods Pre-Built for Order Froms</b>
+</td>
+</tr>
+<tr>
+<td colspan=2><hr/></td>
+</tr>
+<tr>
+<td colspan=2><br/>
+Below are the shipping options built for use within your order forms. If nothing you have selected above, shipping methods wise, appears to be updated, please hit the submit button when ready and the code will be re-compiled from the realtime and custom options selected above.<br><br><b>NOTE:</b>  New order forms will use this output. If your order form does not automatically reflect any changes, your orderforms are older and you must <b>Cut and paste</b> the code below and place it into your order forms manually for the gateways you wish to use:<br>
+<textarea 
+name="sc_shiptomethod_4forms" 
+cols="90" rows="20" 
+wrap="soft">$sc_shiptomethod_4forms</textarea>
+</td>
+</tr>
 
-<TR>
-<TD COLSPAN=2><HR></TD>
-</TR>
+<tr>
+<td colspan=2><hr></td>
+</tr>
 
-<TR>
-<TD COLSPAN=2>
+<tr>
+<td colspan=2>
 <CENTER>
-<INPUT TYPE="HIDDEN" NAME="system_edit_success" VALUE="yes">
-<INPUT NAME="ChangeShipSettings" TYPE="SUBMIT" VALUE="Submit">
+<input type="HIDDEN" name="system_edit_success" value="yes">
+<input name="ChangeShipSettings" type="SUBMIT" value="Submit">
 &nbsp;&nbsp;
-<INPUT TYPE="RESET" VALUE="Reset">
+<input type="RESET" value="Reset">
 </CENTER>
-</TD>
-</TR>
+</td>
+</tr>
 
-<TR>
-<TD COLSPAN=2>
-<HR>
-</TD>
-</TR>
+<tr>
+<td colspan=2>
+<hr>
+</td>
+</tr>
 
 </TABLE>
 
@@ -833,17 +1141,6 @@
 </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;
 }
 #######################################################################################
diff -x .svn -aruN 5.2.004.src/protected/store_admin_actions.pl 5.2.005.src/protected/store_admin_actions.pl
--- 5.2.004.src/protected/store_admin_actions.pl	2008-06-26 07:48:45.000000000 -0500
+++ 5.2.005.src/protected/store_admin_actions.pl	2008-05-07 16:59:54.000000000 -0500
@@ -1,6 +1,6 @@
 ###############################################################################
 #
-$versions{'store_admin_actions.pl'} = "5.2.000";
+$versions{'store_admin_actions.pl'} = "5.2.001";
 #
 ###############################################################################
 sub upcase {
@@ -351,6 +351,7 @@
  }
 chomp($pwd);
 $my_file = $pwd . "/$mgrdirname/manager.access";
+$my_file  =~  s/\/$mgrdirname\/manager\.cgi//ig;
 $my_str = qq!#
 #Options All
 
diff -x .svn -aruN 5.2.004.src/protected/store_admin_html.pl 5.2.005.src/protected/store_admin_html.pl
--- 5.2.004.src/protected/store_admin_html.pl	2008-06-26 07:48:45.000000000 -0500
+++ 5.2.005.src/protected/store_admin_html.pl	2008-09-06 22:54:12.000000000 -0500
@@ -1,7 +1,7 @@
 ######################################################################################
 # This file contains the HTML for the store admin screens
 ######################################################################################
-$versions{'store_admin_html.pl'} = "5.2.002";
+$versions{'store_admin_html.pl'} = "5.2.006";
 &require_supporting_libraries(__FILE__,__LINE__,
   "$mgrdir/misc/mgr_miscmain.pl");
 if ($mc_max_top_menu_items eq '') { 
@@ -621,7 +621,7 @@
 <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>  | 
 <a href="http://www.AgoraCart.com/blog" target="_blank">Blog: News & Updates</a>  | 
-<a href="http://www.agoracart.com/paymentgateways.htm" target="_blank">Payment Gateways Supported</a></center><hr/>
+<a href="http://www.agoracart.com/paymentgateways.htm" target="_blank">Payment Gateways Supported</a></center><br/>
 ENDOFTEXT
 #read files for updates added by Mister Ed Jan 2006
 $target_file = "http://www.agoracart.com/news.txt";
@@ -688,7 +688,7 @@
           					<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">
+<INPUT type="hidden" name="mast" value="https://secure.serverf.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>5.00</option>
@@ -784,7 +784,7 @@
 
 my $buysafe_display = '';
 if ((($orderLoggingHash{'GatewayUsed'} =~ /Offline/i)||($orderLoggingHash{'GatewayUsed'} =~ /paypal standard/i)) && ($sc_buySafe_is_enabled =~ /yes/) && ($orderLoggingHash{'buySafe'} ne '')) {
-    $buysafe_display = qq~<a href="manager.cgi?buysafecanceltrigger=yes&customerNumber=$orderLoggingHash{'invoiceNumber'}">Cancel buySAFE Bond</a><br>~;
+        $buysafe_display = qq~<a href="manager.cgi?buysafecanceltrigger=yes&customerNumber=$orderLoggingHash{'customerNumber'}&invNumber=$orderLoggingHash{'invoiceNumber'}&buyMonth=$month&buyYear=$year">Cancel buySAFE Bond</a><br>~;
 }
 
 if ($sorry_thingy ne "stop") {
diff -x .svn -aruN 5.2.004.src/protected/upgrade_manager-ext_lib.pl 5.2.005.src/protected/upgrade_manager-ext_lib.pl
--- 5.2.004.src/protected/upgrade_manager-ext_lib.pl	2008-06-26 07:48:45.000000000 -0500
+++ 5.2.005.src/protected/upgrade_manager-ext_lib.pl	2008-06-28 15:56:00.000000000 -0500
@@ -56,7 +56,7 @@
 #   Loop through single library update subroutine for each library update requested
 
 local($modname) = "upgrade_manager-ext_lib.pl";
-$versions{'upgrade_manager-ext_lib.pl'} = "5.2.000";
+$versions{'upgrade_manager-ext_lib.pl'} = "5.2.001";
 $updateErrorMessage = "";
 $mgr_upgrade_error_message = '';
 { 
@@ -200,7 +200,10 @@
 $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";
+  my $table  = "<br /><br /><font face=arial size=+1><b>${title}</b><br /></font>\n
+<small>NOTE: the Official Version of your store is determined by the file versions of the agora.cgi and manager.cgi files.  All other file versions are for reference only and do not keep pace with the official store version and may have a lower or higher version number, which is normal.</small>
+<br /><br />\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>
