//=====================================================================||
//               NOP Design JavaScript Shopping Cart                   ||
//                                                                     ||
// For more information on SmartSystems, or how NOPDesign can help you ||
// Please visit us on the WWW at http://www.nopdesign.com              ||
//                                                                     ||
// Javascript portions of this shopping cart software are available as ||
// freeware from NOP Design.  You must keep this comment unchanged in  ||
// your code.  For more information contact FreeCart@NopDesign.com.    ||
//                                                                     ||
// JavaScript Shop Module, V.5.0.draft   Feb 4, 2004                   ||
// Drop in replacement for V.4.4.0                                     ||
//=====================================================================||
//              CART MANAGEMENT MODULE Unmodified shipping             ||
//---------------------------------------------------------------------||
// FUNCTION:    ManageCart                                             ||
// PARAMETERS:  Null                                                   ||
// RETURNS:     Product Table Written to Document                      ||
// PURPOSE:     Draws current cart product table on HTML page          ||
//---------------------------------------------------------------------||
function ManageCart() {

   var fTotal         = 0;    //Total cost of order
	 var fprodttl       = 0; 		//Total product cost = QTY * PRICE
   var fFst           = 0;    //FST amount
   var fTax           = 0;    //Tax amount
   var fShipping      = 0;    //Shipping amount--set flatrate shipping here
   var strTotal       = "0.00";   //Total cost formatted as money
   var strFst         = "0.00";   //Total FST formatted as money
   var strTax         = "0.00";   //Total Tax formatted as money
   var strShipping    = "0.00";   //Total shipping formatted as money
   var strOutput      = "";   //String to be written to page
   var bDisplay       = true; //Whether to write string to the page (here for programmers)
	 var strProductId   = "";		//used for non-taxable item identification
       strAddInfo     =	" "; 
ReadCookie()

// ------------------- Cart Table Header -----------------------------------||
   if ( bDisplay )
	 		strOutput =
"<TABLE CELLSPACING=0 CELLPADDING=0 WIDTH=100% BORDER=0 CLASS=\"nopcart\"><TR>" +			
"<TD WIDTH=55 CLASS=\"nopheader\"><strong>"+strILabel+"</strong></TD>" +			
"<TD ALIGN=\"CENTER\" CLASS=\"nopheader\"><strong>"+strDLabel+"</strong></TD>" +			
"<TD WIDTH=30 ALIGN=\"center\" CLASS=\"nopheader\"><strong>"+strQLabel+"</strong></TD>" +			
"<TD WIDTH=55 ALIGN=\"center\" CLASS=\"nopheader\"><strong>"+strPLabel+"</strong></TD>";
if ( DisplayShippingColumn ) { strOutput += 
"<TD WIDTH=60 ALIGN=\"center\" CLASS=\"nopheader\"><strong>"+strSLabel+"</strong></TD>";
} else { strOutput += 
"<TD WIDTH=60 ALIGN=\"center\" CLASS=\"nopheader\"><strong>"+strPTLabel+"</strong></TD>";}
strOutput += "<TD  WIDTH=90 ALIGN=\"CENTER\" CLASS=\"nopheader\"><strong>"+strRLabel+"</strong></TD></TR>";

   if ( iNumberOrdered == 0 ) {
      strOutput += "<TR><TD COLSPAN=6 CLASS=\"nopentry\" ALIGN=\"center\"><BR><B>Your shopping cart is empty</B><BR><BR></TD></TR>";
   }else {

   for ( i = 1; i <= iNumberOrdered; i++ ) {
			even = (i & 1);

      fprodttl       = (parseInt(ItemQuantity[i])* parseFloat(ItemPrice[i]));
      fTotal        += (fprodttl);
      fShipping     = 3.2;//+= (parseInt(ItemQuantity[i])* parseFloat(ItemShipping[i]) );
	  if(fTotal > 20) fShipping = 0;
     if(ItemFsTx[i] == 'true') 	fFst += (fprodttl * FstRate);
     if(ItemPsTx[i] == 'true')  fTax += (parseInt(ItemQuantity[i]) * parseFloat(ItemPrice[i])) * TaxRate; 

      strTotal    = moneyFormat(fTotal);
      strFst      = moneyFormat(fFst);
      strTax      = moneyFormat(fTax);
      strShipping = moneyFormat(fShipping);
      strAddInfo  =	"";
// ------------------- Cart Table Body -----------------------------------||
			
if ( bDisplay ){
     if (even ^ 1 ) {
		strOutput += "<TR VALIGN=TOP CLASS=\"tblpadding5\"><TD CLASS=\"nopeven\">" + ItemId[i] + "</TD>";
    strOutput += "<TD CLASS=\"nopeven\">"  + ItemName[i];
         if ( ItemAddtlInfo[i]  != "" ) strAddInfo  = " - <I>" + ItemAddtlInfo[i];
				 if ( ItemAddtlInfo2[i] != "" ) strAddInfo +=  ItemAddtlInfo2[i];
				 if ( ItemAddtlInfo3[i] != "" ) strAddInfo +=  ItemAddtlInfo3[i];
				 if ( ItemUserEntry[i]  != "" ) strAddInfo +=  ItemUserEntry[i];
				 if ( ItemUserEntry2[i] != "" ) strAddInfo +=  ItemUserEntry2[i];
    strOutput += strAddInfo + "</I></TD>";

         strOutput += "<TD CLASS=\"nopeven\"><INPUT TYPE=TEXT NAME=Q SIZE=2 VALUE=\"" + ItemQuantity[i] + "\" onChange=\"this.value=ChangeQuantity("+i+",this.value);\"></TD>";
         strOutput += "<TD CLASS=\"nopeven\" align=\"right\">"+ MonetarySymbol + moneyFormat(ItemPrice[i]) + "</TD>";

// Either display Shipping Column or extended price column
         if ( DisplayShippingColumn ) {
            if ( parseFloat(ItemShipping[i]) > 0 )
               strOutput += "<TD CLASS=\"nopeven\" align=\"right\">"+ MonetarySymbol + moneyFormat(ItemShipping[i]) + "/ea</TD>";
            else
               strOutput += "<TD CLASS=\"nopeven\" ALIGN=\"center\">N/A</TD>";
         }
	else {
		strOutput += "<TD ALIGN=RIGHT CLASS=\"nopeven\" align=\"right\">"+ MonetarySymbol + moneyFormat(fprodttl) + "</TD>";
         }

    strOutput += "<TD CLASS=\"nopeven\" ALIGN=CENTER><input type=button class=\"butform\" onmousedown=\"this.className='butformy'\" onmouseup=\"this.className='butform'\" onmouseover=\"this.className='butformx'\" onmouseout=\"this.className='butform'\" value=\" "+strRButton+" \" onClick=\"RemoveFromCart("+i+")\"></TD></TR>";
      }
else {
// repeat for odd

		strOutput += "<TR VALIGN=TOP CLASS=\"tblpadding5\"><TD CLASS=\"nopentry\">" + ItemId[i] + "</TD>";
    strOutput += "<TD CLASS=\"nopentry\">"  + ItemName[i];
         if ( ItemAddtlInfo[i]  != "" ) strAddInfo  = " - <I>" + ItemAddtlInfo[i];
				 if ( ItemAddtlInfo2[i] != "" ) strAddInfo +=  ItemAddtlInfo2[i];
				 if ( ItemAddtlInfo3[i] != "" ) strAddInfo +=  ItemAddtlInfo3[i];
				 if ( ItemUserEntry[i]  != "" ) strAddInfo +=  ItemUserEntry[i];
				 if ( ItemUserEntry2[i] != "" ) strAddInfo +=  ItemUserEntry2[i];
    strOutput += strAddInfo + "</I></TD>";

         strOutput += "<TD CLASS=\"nopentry\"><INPUT TYPE=TEXT NAME=Q SIZE=2 VALUE=\"" + ItemQuantity[i] + "\" onChange=\"this.value=ChangeQuantity("+i+",this.value);\"></TD>";
         strOutput += "<TD CLASS=\"nopentry\" align=\"right\">"+ MonetarySymbol + moneyFormat(ItemPrice[i]) + "</TD>";

// Either display Shipping Column or extended price column
         if ( DisplayShippingColumn ) {
            if ( parseFloat(ItemShipping[i]) > 0 )
               strOutput += "<TD CLASS=\"nopentry\" align=\"right\">"+ MonetarySymbol + moneyFormat(ItemShipping[i]) + "/ea</TD>";
            else
               strOutput += "<TD CLASS=\"nopentry\" ALIGN=\"center\">N/A</TD>";
         }
	else {
		strOutput += "<TD ALIGN=RIGHT CLASS=\"nopentry\" align=\"right\">"+ MonetarySymbol + moneyFormat(fprodttl) + "</TD>";
         }

    strOutput += "<TD CLASS=\"nopentry\" ALIGN=CENTER><input type=button class=\"butform\" onmousedown=\"this.className='butformy'\" onmouseup=\"this.className='butform'\" onmouseover=\"this.className='butformx'\" onmouseout=\"this.className='butform'\" value=\" "+strRButton+" \" onClick=\"RemoveFromCart("+i+")\"></TD></TR>";
      }
}

// ------------------- End of Cart Table Body -----------------------------------||

      if ( AppendItemNumToOutput ) {
         strFooter = i;
      } else {
         strFooter = "";
      }
      if ( HiddenFieldsToCheckout ) {
         strOutput += "<input type=hidden name=\"" + OutputItemId        + strFooter + "\" value=\"" + ItemId[i] + "\">";
         strOutput += "<input type=hidden name=\"" + OutputItemQuantity  + strFooter + "\" value=\"" + ItemQuantity[i] + "\">";
         strOutput += "<input type=hidden name=\"" + OutputItemPrice     + strFooter + "\" value=\"" + ItemPrice[i] + "\">";
         strOutput += "<input type=hidden name=\"" + OutputItemName      + strFooter + "\" value=\"" + ItemName[i] + "\">";
         strOutput += "<input type=hidden name=\"" + OutputItemShipping  + strFooter + "\" value=\"" + ItemShipping[i] + "\">";
         strOutput += "<input type=hidden name=\"" + OutputItemAddtlInfo + strFooter + "\" value=\"" + strAddInfo + "\">";
      }

   }
}
	 // ------------------- Cart Table Footer -----------------------------------||

	 fFst += (fShipping * ShippingFSTaxRate);	// calculates FST for shipping charges
	 fTax += (fShipping * ShippingTaxRate);	 // calculates State Tax for shipping charges
			
   if ( bDisplay ) {
      strOutput += "<TR><TD align=\"right\" CLASS=\"noptotal\" COLSPAN=4><B>"+strSUB+"  &nbsp; </B></TD>";
      strOutput += "<TD CLASS=\"noptotal\" ALIGN=\"right\"><B>" + MonetarySymbol + strTotal + "</B></TD><TD CLASS=\"noptotal\"><BR></TD>";
      strOutput += "</TR>";

      if ( DisplayShippingRow ) {
         strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=4 align=\"right\"><B>"+strSHIP+"  &nbsp; </B></TD>";
         strOutput += "<TD CLASS=\"noptotal\" ALIGN=\"right\"><B>" + MonetarySymbol + strShipping + "</B></TD><TD CLASS=\"noptotal\"><BR></TD>";
         strOutput += "</TR>";
      }

// Don't display Federal Sales Tax Row if FST Rate zero
      if ( FstRate > 0 ) {
            strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=4 align=\"right\"><B>"+strFST+" &nbsp; </B></TD>";
            strOutput += "<TD CLASS=\"noptotal\" ALIGN=\"right\"><B>"+ MonetarySymbol + strFst + "</B></TD><TD CLASS=\"noptotal\"><BR></TD>";
            strOutput += "</TR>";
				}		

      if ( DisplayTaxRow || TaxByRegion ) {
         if ( TaxByRegion ) {
            strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=2 ROWSPAN=2 align=\"right\"><B>"+strTAX+" &nbsp; &nbsp;</B></TD>";
            strOutput += "<TD CLASS=\"noptotal\" COLSPAN=2><B>";
            strOutput += "<input type=radio name=\""+OutputOrderTax+"\" value=\"" + strTax + "\">";
            strOutput += TaxablePrompt + ":</B></TD><TD CLASS=\"noptotal\" ALIGN=\"right\"><B> " + MonetarySymbol + strTax + "</B></TD><TD CLASS=\"noptotal\"><BR></TD></TR>";
            strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=2><B><input type=radio name=\""+OutputOrderTax+"\" value=\"0.00\">";
            strOutput += NonTaxablePrompt + ":</B></TD><TD CLASS=\"noptotal\" ALIGN=\"right\"><B> " + MonetarySymbol + "0.00";
            strOutput += "</B></TD><TD CLASS=\"noptotal\"><BR></TD>";
            strOutput += "</TR>";
         } else {
            strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=4 align=\"right\"><B>"+strTAX+" &nbsp; </B></TD>";
            strOutput += "<TD CLASS=\"noptotal\" ALIGN=\"right\"><B>" + MonetarySymbol + strTax + "</B></TD><TD CLASS=\"noptotal\"><BR></TD>";
            strOutput += "</TR>";
         }
      }

      if ( !TaxByRegion ) {
         strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=4 align=\"right\"><B>"+strTOT+" &nbsp; </B></TD>";
         strOutput += "<TD CLASS=\"noptotal\" ALIGN=\"right\"><B>" + MonetarySymbol + moneyFormat((fTotal + fShipping + fFst + fTax)) + "</B></TD><TD CLASS=\"noptotal\"><BR></TD>";
         strOutput += "</TR>";
      }
      strOutput += "</TABLE>";

	 // ------------------- End of Cart Table  -----------------------------------||

      if ( HiddenFieldsToCheckout ) {
         strOutput += "<input type=hidden name=\""+OutputOrderSubtotal+"\" value=\""+ MonetarySymbol + strTotal + "\">";
         strOutput += "<input type=hidden name=\""+OutputOrderShipping+"\" value=\""+ MonetarySymbol + strShipping + "\">";
         strOutput += "<input type=hidden name=\""+OutputOrderFst+"\"      value=\""+ MonetarySymbol + strFst + "\">";
         strOutput += "<input type=hidden name=\""+OutputOrderTax+"\"      value=\""+ MonetarySymbol + strTax + "\">";
         strOutput += "<input type=hidden name=\""+OutputOrderTotal+"\"    value=\""+ MonetarySymbol + moneyFormat((fTotal + fShipping + fFst + fTax)) + "\">";
         strOutput += "<input type=hidden name=\"Items\" value=\""+  iNumberOrdered + "\">";
      }
   }
   g_TotalCost = (fTotal + fShipping + fFst + fTax);

   document.write(strOutput);
   document.close();
}

//---------------------------------------------------------------------||
// FUNCTION:    ValidateCart                                           ||
// PARAMETERS:  Form to validate                                       ||
// RETURNS:     true/false                                             ||
// PURPOSE:     Validates the managecart form                          ||
//---------------------------------------------------------------------||
function ValidateCart( theForm ) {
   if ( TaxByRegion ) {
      if ( !RadioChecked(eval("theForm."+OutputOrderTax)) ) {
         alert( TaxPrompt );
         return false;
      }
   }

      if ( g_TotalCost < MinimumOrder ) {
         alert( MinimumOrderPrompt );
         return false;
      }

   return true;
}

//---------------------------------------------------------------------||
// FUNCTION:    CheckoutCart                                           ||
// PARAMETERS:  Null                                                   ||
// RETURNS:     Product Table Written to Document                      ||
// PURPOSE:     Draws current cart product table on HTML page for      ||
//              checkout.                                              ||
//---------------------------------------------------------------------||
function CheckoutCart() {
   var fTotal         = 0;    //Total cost of order
	 var fprodttl       = 0; 		//Total product cost = QTY * PRICE
   var fFst           = 0;    //FST amount
   var fTax           = 0;    //Tax amount
   var fShipping      = 0;    //Shipping amount  Set Flat Rate shipping cost here
   var strTotal       = "";   //Total cost formatted as money
   var strFst         = "";   //Total FST formatted as money
   var strTax         = "";   //Total tax formatted as money
   var strShipping    = "";   //Total shipping formatted as money
   var strOutput      = "";   //String to be written to page
   var bDisplay       = true; //Whether to write string to the page (here for programmers)
   var strPP          = "";   //Payment Processor Description Field
	 var strProductId   = "";		//Used or non-taxable item identification
	     strAddInfo     = "";   // used to concatanate AdditionalInfo strings
	 
ReadCookie()

// If Tax by Region get tax from checkout.html URL string
   if ( TaxByRegion ) {
      QueryString_Parse();
      fTax = parseFloat( QueryString( OutputOrderTax ) );
      strTax = moneyFormat(fTax);
   }

// ------------------- Cart Table Header -----------------------------------||
   if ( bDisplay )
	 		strOutput = 	"<TABLE CELLSPACING=0 CELLPADDING=2 WIDTH=610 BORDER=5 CLASS=\"nopcart\"><TR><TD>" +
	"<TABLE CELLSPACING=0 CELLPADDING=0 WIDTH=100% BORDER=0 CLASS=\"nopcart\"><TR>" +			
"<TD WIDTH=55 CLASS=\"nopheader\"><strong>"+strILabel+"</strong></TD>" +			
"<TD ALIGN=\"center\" CLASS=\"nopheader\"><strong>"+strDLabel+"</strong></TD>" +			
"<TD WIDTH=30 ALIGN=\"center\" CLASS=\"nopheader\"><strong>"+strQLabel+"</strong></TD>" +			"<TD WIDTH=55 ALIGN=\"center\" CLASS=\"nopheader\"><strong>"+strPLabel+"</strong></TD>";
if ( DisplayShippingColumn ) { strOutput += 
"<TD WIDTH=60 ALIGN=\"center\" CLASS=\"nopheader\"><strong>"+strSLabel+"</strong></TD>";
} else { strOutput += 
"<TD WIDTH=60 ALIGN=\"center\" CLASS=\"nopheader\"><strong>"+strPTLabel+"</strong></TD>";}
strOutput += "</TR>";

   for ( i = 1; i <= iNumberOrdered; i++ ) {
	 		even = (i & 1);

      fprodttl   = (parseInt(ItemQuantity[i]) * parseFloat(ItemPrice[i]) );
      fTotal     += (parseInt(ItemQuantity[i]) * parseFloat(ItemPrice[i]) );
      fShipping  += (parseInt(ItemQuantity[i]) * parseFloat(ItemShipping[i]) );
     if(ItemFsTx[i] == 'true'){ 
      fFst       += ((fprodttl) * FstRate); }

if ( !TaxByRegion ) 
     if(ItemPsTx[i] == 'true'){ 
         fTax += (parseInt(ItemQuantity[i]) * parseFloat(ItemPrice[i])) * TaxRate; 
      } 
      strAddInfo  =	"";
      strTotal    = moneyFormat(fTotal);
			strFst      = moneyFormat(fFst);
      if ( !TaxByRegion ) strTax = moneyFormat(fTax);
      strShipping = moneyFormat(fShipping);

// ------------------- Cart Table Body -----------------------------------||

      if ( bDisplay ) {
			   if (even ^ 1 ) {
    strOutput += "<TR><TD CLASS=\"nopeven\">"  + ItemId[i] + "</TD>";

    strOutput += "<TD CLASS=\"nopeven\">"  + ItemName[i] + " - <I>";
         if ( ItemAddtlInfo[i]  != "" ) strAddInfo  =  ItemAddtlInfo[i];
				 if ( ItemAddtlInfo2[i] != "" ) strAddInfo +=  ItemAddtlInfo2[i];
				 if ( ItemAddtlInfo3[i] != "" ) strAddInfo +=  ItemAddtlInfo3[i];
				 if ( ItemUserEntry[i]  != "" ) strAddInfo +=  ItemUserEntry[i];
				 if ( ItemUserEntry2[i] != "" ) strAddInfo +=  ItemUserEntry2[i];
    strOutput += strAddInfo + "</I></TD>";

    strOutput += "<TD CLASS=\"nopeven\">" + ItemQuantity[i] + "</TD>";
    strOutput += "<TD CLASS=\"nopeven\" align=\"right\">"+ MonetarySymbol + moneyFormat(ItemPrice[i]) + "</TD>";

// Display either shipping or extended price in this column
         if ( DisplayShippingColumn ) {
            if ( parseFloat(ItemShipping[i]) > 0 )
    strOutput += "<TD CLASS=\"nopeven\" align=\"right\">"+ MonetarySymbol + moneyFormat(ItemShipping[i]) + "/ea</TD>";
            else
    strOutput += "<TD CLASS=\"nopeven\" ALIGN=\"center\">N/A</TD>";
         }
	else {
		strOutput += "<TD ALIGN=RIGHT CLASS=\"nopeven\" align=\"right\">"+ MonetarySymbol + moneyFormat(fprodttl) + " &nbsp; </TD>";
         }
    strOutput += "</TR>";
      
// repeat odd
} else {			
      if ( bDisplay ) {
         strOutput += "<TR><TD CLASS=\"nopentry\">"  + ItemId[i] + "</TD>";

    strOutput += "<TD CLASS=\"nopentry\">"  + ItemName[i] + " - <I>";
         if ( ItemAddtlInfo[i]  != "" ) strAddInfo  =  ItemAddtlInfo[i];
				 if ( ItemAddtlInfo2[i] != "" ) strAddInfo +=  ItemAddtlInfo2[i];
				 if ( ItemAddtlInfo3[i] != "" ) strAddInfo +=  ItemAddtlInfo3[i];
				 if ( ItemUserEntry[i]  != "" ) strAddInfo +=  ItemUserEntry[i];
				 if ( ItemUserEntry2[i] != "" ) strAddInfo +=  ItemUserEntry2[i];
    strOutput += strAddInfo + "</I></TD>";

         strOutput += "<TD CLASS=\"nopentry\">" + ItemQuantity[i] + "</TD>";
         strOutput += "<TD CLASS=\"nopentry\" align=\"right\">"+ MonetarySymbol + moneyFormat(ItemPrice[i]) + "</TD>";

         if ( DisplayShippingColumn ) {
           if ( parseFloat(ItemShipping[i]) > 0 )
               strOutput += "<TD CLASS=\"nopentry\" align=\"right\">"+ MonetarySymbol + moneyFormat(ItemShipping[i]) + "/ea</TD>";
            else
               strOutput += "<TD CLASS=\"nopentry\" ALIGN=\"center\">N/A</TD>";
         } else {
		strOutput += "<TD ALIGN=RIGHT CLASS=\"nopentry\" align=\"right\">"+ MonetarySymbol + moneyFormat(fprodttl) + " &nbsp; </TD>";
         }
         strOutput += "</TR>";
     }
  }		
}			
// calculate Tax on Shipping
	 fFst += (fShipping * ShippingFSTaxRate);	// calculates FST for shipping charges
   if ( !TaxByRegion ) {
	 fTax += (fShipping * ShippingTaxRate);	 // calculates State Tax for shipping charges
}		

// ------------------- End of Cart Table Body -----------------------------------||

      if ( AppendItemNumToOutput ) {
         strFooter = i;
      } else {
         strFooter = "";
      }
// ----------Concatanate items for PPs or format email using Mailto form action--|| 
      if ( PaymentProcessor != '' ) {
         //Process description field for payment processors instead of hidden values.
         //Format Description of product as:
         // ID, Name, Qty X
         strPP += ItemId[i] + ", " + ItemName[i];
         if ( strAddInfo != "" )
            strPP += " - " + strAddInfo;
         strPP += ", Qty. " + ItemQuantity[i] + "\n";
      } else {
//       	       strOutput += "<input type=hidden name=\""  + OutputItemId +  strFooter + '  PLU=' + ItemId[i] + strSpace + OutputItemQuantity  + '=' + ItemQuantity[i] + strSpace + ItemName[i] + strSpace + strAddInfo + strSpace + MonetarySymbol + ItemPrice[i] + "\n" + "\n" + "\">";
         strOutput += "<input type=hidden name=\"" + OutputItemId        + strFooter + "\" value=\"" + ItemId[i] + "\">";
         strOutput += "<input type=hidden name=\"" + OutputItemQuantity  + strFooter + "\" value=\"" + ItemQuantity[i] + "\">";
         strOutput += "<input type=hidden name=\"" + OutputItemPrice     + strFooter + "\" value=\"" + moneyFormat(ItemPrice[i]) + "\">";
         strOutput += "<input type=hidden name=\"" + OutputItemName      + strFooter + "\" value=\"" + ItemName[i] + "\">";
         strOutput += "<input type=hidden name=\"" + OutputItemShipping  + strFooter + "\" value=\"" + moneyFormat(ItemShipping[i]) + "\">";
         strOutput += "<input type=hidden name=\"" + OutputItemAddtlInfo + strFooter + "\" value=\"" + strAddInfo + "\">";

      } 
   }

	 // ------------------- Cart Table Footer -----------------------------------||

			
   if ( bDisplay ) {
      strOutput += "<TR><TD align=\"right\" CLASS=\"noptotal\" COLSPAN=4><B>"+strSUB+"  &nbsp; </B></TD>";
      strOutput += "<TD CLASS=\"noptotal\" ALIGN=\"right\"><B>" + MonetarySymbol + strTotal + " &nbsp; &nbsp;</B></TD>";
      strOutput += "</TR>";

      if ( DisplayShippingRow ) {
         strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=4 align=\"right\"><B>"+strSHIP+"  &nbsp; </B></TD>";
         strOutput += "<TD CLASS=\"noptotal\" ALIGN=\"right\"><B>" + MonetarySymbol + strShipping + " &nbsp; &nbsp;</B></TD>";
         strOutput += "</TR>";
      }


      if ( FstRate > 0 ) {
            strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=4 align=\"right\"><B>"+strFST+" &nbsp; &nbsp;</B></TD>";
            strOutput += "<TD CLASS=\"noptotal\" ALIGN=\"right\"><B>"+ MonetarySymbol + strFst + " &nbsp; &nbsp;</B></TD>";
            strOutput += "</TR>";
				}		

      if ( DisplayTaxRow || TaxByRegion ) {
         strOutput += "<TR><TD align=\"right\" CLASS=\"noptotal\" COLSPAN=4><B>"+strTAX+" &nbsp; &nbsp;</B></TD>";
         strOutput += "<TD CLASS=\"noptotal\" ALIGN=RIGHT><B>" + MonetarySymbol + strTax + " &nbsp; &nbsp;</B></TD>";
         strOutput += "</TR>";
      }

      strOutput += "<TR><TD align=\"right\" CLASS=\"noptotal\" COLSPAN=4><B>"+strTOT+" &nbsp; &nbsp;</B></TD>";
      strOutput += "<TD CLASS=\"noptotal\" ALIGN=RIGHT><B>" + MonetarySymbol + moneyFormat((fTotal + fShipping + fFst + fTax)) + " &nbsp; &nbsp;</B></TD>";
      strOutput += "</TR>";
      strOutput += "</TABLE> </TD></TR></TABLE>";
// -----------------------End of Cart Table --------------------------------||
      
      if ( PaymentProcessor == 'an') {
         //Process this for Authorize.net WebConnect
         strOutput += "<input type=hidden name=\"x_Version\" value=\"3.0\">";
         strOutput += "<input type=hidden name=\"x_Show_Form\" value=\"PAYMENT_FORM\">";
         strOutput += "<input type=hidden name=\"x_Description\" value=\""+ strPP + "\">";
         strOutput += "<input type=hidden name=\"x_Amount\" value=\""+ moneyFormat((fTotal + fShipping + fFst + fTax)) + "\">";
      } else if ( PaymentProcessor == 'wp') {
         //Process this for WorldPay
         strOutput += "<input type=hidden name=\"desc\" value=\""+ strPP + "\">";
         strOutput += "<input type=hidden name=\"amount\" value=\""+ moneyFormat((fTotal + fShipping + fFst + fTax)) + "\">";
      } else if ( PaymentProcessor == 'lp') {
         //Process this for LinkPoint         
         strOutput += "<input type=hidden name=\"mode\" value=\"fullpay\">";
         strOutput += "<input type=hidden name=\"chargetotal\" value=\""+ moneyFormat((fTotal + fShipping + fFst + fTax)) + "\">";
         strOutput += "<input type=hidden name=\"tax\" value=\""+ MonetarySymbol + strTax + "\">";
         strOutput += "<input type=hidden name=\"subtotal\" value=\""+ MonetarySymbol + strTotal + "\">";
         strOutput += "<input type=hidden name=\"shipping\" value=\""+ MonetarySymbol + strShipping + "\">";
         strOutput += "<input type=hidden name=\"desc\" value=\""+ strPP + "\">";
      } else {
         strOutput += "<input type=hidden name=\""+OutputOrderSubtotal+"\" value=\""+ MonetarySymbol + strTotal + "\">";
         strOutput += "<input type=hidden name=\""+OutputOrderShipping+"\" value=\""+ MonetarySymbol + strShipping + "\">";
         strOutput += "<input type=hidden name=\""+OutputOrderFst+"\"      value=\""+ MonetarySymbol + strFst + "\">";
         strOutput += "<input type=hidden name=\""+OutputOrderTax+"\"      value=\""+ MonetarySymbol + strTax + "\">";
         strOutput += "<input type=hidden name=\""+OutputOrderTotal+"\"    value=\""+ MonetarySymbol + moneyFormat((fTotal + fShipping + fFst + fTax)) + "\">";
		 strOutput += "<input type=hidden name=\"Items\" value=\"" + iNumberOrdered + "\">";  
      }
   }

   document.write(strOutput);
   document.close();
}

//=====================================================================||
//               END NOP Design SmartPost Shopping Cart                ||
//=====================================================================||


