//=====================================================================||
//               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 fWeight        = 0;    //Total weight of order
   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>"+strWLabel+"</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);
			fWeight       += (parseInt(ItemQuantity[i])* parseFloat(ItemWeight[i]) );
     if(ItemFsTx[i] == 'true') 	fFst += (fprodttl * FstRate);
     if(ItemPsTx[i] == 'true')  fTax += (parseInt(ItemQuantity[i]) * parseFloat(ItemPrice[i])) * TaxRate; 

      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] + " - <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\"><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(ItemWeight[i]) > 0 )
               strOutput += "<TD CLASS=\"nopeven\" align=\"right\">"+ MonetarySymbol + moneyFormat(ItemWeight[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] + " - <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\"><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 + "\">";
      }
   }
}
	 // ------------------- Calculate shipping by total order weight ------------||

	 // ------------------- fWeight is in lbs or Kilograms ----------------------||
	 // - between this weight and    this ,  shipping costs this ----------------||
if ( fWeight >  0.00 && fWeight <=  0.50 ){ fShipping =  1.95 }; 
if ( fWeight >  0.50 && fWeight <=  1.00 ){ fShipping =  2.95 }; 
if ( fWeight >  1.00 && fWeight <=  1.50 ){ fShipping =  4.95 }; 
if ( fWeight >  1.50 && fWeight <=  4.00 ){ fShipping =  6.95 }; 
if ( fWeight >  4.00 && fWeight <=  7.00 ){ fShipping =  13.04 }; 
if ( fWeight > 7.00 && fWeight <= 12.00 ){ fShipping =  13.04 }; 
if ( fWeight > 12.00 && fWeight <= 16.00 ){ fShipping = 13.04 }; 
if ( fWeight > 16.00 && fWeight <= 24.00 ){ fShipping = 13.04 }; 
if ( fWeight > 24.00 ){ fShipping  = 13.04; }



	 fFst += (fShipping * ShippingFSTaxRate);	// calculates FST for shipping charges
	 fTax += (fShipping * ShippingTaxRate);	 // calculates State Tax for shipping charges

      strTotal    = moneyFormat(fTotal);
      strFst      = moneyFormat(fFst);
      strTax      = moneyFormat(fTax);
      strShipping = moneyFormat(fShipping);

	 // ------------------- 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 + "</B></TD><TD CLASS=\"noptotal\"><BR></TD>";
      strOutput += "</TR>";

      strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=4 ALIGN=RIGHT><B>"+strWTOT+" &nbsp; </B></TD>"; 
      strOutput += "<TD CLASS=\"noptotal\" COLSPAN=1 ALIGN=RIGHT><B>" + fWeight + "</B></TD>"; 
      strOutput += "<TD CLASS=\"noptotal\" COLSPAN=1 ALIGN=LEFT>&nbsp;<B> "+ WeightUnits +"</B></TD></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  -----------------------------------||
   g_TotalCost = (fTotal + fShipping + fFst + fTax);
	strGtotal = moneyFormat(g_TotalCost)

      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) + "\">";
      }
   }
   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 fWeight        = 0;    //Total weight of order
   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=2 WIDTH=100% 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=50 ALIGN=\"center\" CLASS=\"nopheader\"><strong>"+strQLabel+"</strong></TD>" +			"<TD WIDTH=55 ALIGN=\"right\" CLASS=\"nopheader\"><strong>"+strPLabel+"</strong></TD>";
if ( DisplayShippingColumn ) { strOutput += 
"<TD WIDTH=60 ALIGN=\"right\" CLASS=\"nopheader\"><strong>"+strWLabel+"</strong></TD>";
} else { strOutput += 
"<TD WIDTH=80 ALIGN=\"right\" CLASS=\"nopheader\"><strong>"+strPTLabel+"&nbsp;&nbsp;</strong></TD>";}
strOutput += "</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);
			fWeight       += (parseInt(ItemQuantity[i])* parseFloat(ItemWeight[i]) );
     if(ItemFsTx[i] == 'true') 	fFst += (fprodttl * FstRate);
     if(ItemPsTx[i] == 'true')  fTax += (parseInt(ItemQuantity[i]) * parseFloat(ItemPrice[i])) * TaxRate; 

      strAddInfo  =	"";
// ------------------- Cart Table Body -----------------------------------||

      if ( bDisplay ) {
			      if ((even) ==(i/2) ) {
    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\" align=\"center\">"+ 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(ItemWeight[i]) > 0 )
    strOutput += "<TD CLASS=\"nopeven\" align=\"right\">"+ MonetarySymbol + moneyFormat(ItemWeight[i]) + "/ea</TD>";
            else
    strOutput += "<TD CLASS=\"nopeven\" ALIGN=\"right\">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\" align=\"center\">"+ ItemQuantity[i] + "</TD>";
         strOutput += "<TD CLASS=\"nopentry\" align=\"right\">"+ MonetarySymbol + moneyFormat(ItemPrice[i]) + "</TD>";

         if ( DisplayShippingColumn ) {
            if ( parseFloat(ItemWeight[i]) > 0 )
               strOutput += "<TD CLASS=\"nopentry\" align=\"right\">"+ MonetarySymbol + moneyFormat(ItemWeight[i]) + "/ea</TD>";
            else
               strOutput += "<TD CLASS=\"nopentry\" ALIGN=\"right\">N/A</TD>";
         } else {
		strOutput += "<TD ALIGN=RIGHT CLASS=\"nopentry\" align=\"right\">"+ MonetarySymbol + moneyFormat(fprodttl) + " &nbsp; </TD>";
         }
         strOutput += "</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 + "\">";
      }
   }
}
	 // ------------------- Calculate shipping by total order weight ------------||

	 // ------------------- fWeight is in lbs or Kilograms ----------------------||
	 // - between this weight and    this ,  shipping costs this ----------------||
if ( fWeight >  0.00 && fWeight <=  0.50 ){ fShipping =  1.95 }; 
if ( fWeight >  0.50 && fWeight <=  1.00 ){ fShipping =  2.95 }; 
if ( fWeight >  1.00 && fWeight <=  1.50 ){ fShipping =  4.95 }; 
if ( fWeight >  1.50 && fWeight <=  4.00 ){ fShipping =  6.95 }; 
if ( fWeight >  4.00 && fWeight <=  7.00 ){ fShipping =  13.04 }; 
if ( fWeight > 7.00 && fWeight <= 12.00 ){ fShipping =   13.04 }; 
if ( fWeight > 12.00 && fWeight <= 16.00 ){ fShipping =  13.04 }; 
if ( fWeight > 16.00 && fWeight <= 24.00 ){ fShipping =  13.04 }; 
if ( fWeight > 24.00 ){ fShipping  =  13.04; }



	 fFst += (fShipping * ShippingFSTaxRate);	// calculates FST for shipping charges
	 fTax += (fShipping * ShippingTaxRate);	 // calculates State Tax for shipping charges

      strTotal    = moneyFormat(fTotal);
      strFst      = moneyFormat(fFst);
      strTax      = moneyFormat(fTax);
      strShipping = moneyFormat(fShipping);


	 // ------------------- 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  -----------------------------------||
   g_TotalCost = (fTotal + fShipping + fFst + fTax);
	strGtotal = moneyFormat(g_TotalCost)

      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) + "\">";
      }
   }
   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;
}

//=====================================================================||
//               END NOP Design SmartPost Shopping Cart                ||
//=====================================================================||

