
/* Determine actual domain and adjust for some exceptions */

var adn=location.hostname;
if (adn.indexOf(".")==-1) adn="naturetables.net";
if (adn.indexOf("cox.net")!=-1) adn=adn+"/naturetables";


/* Function MakeATCB builds the PayPal Add To Cart forms input with the appropriate values */

function MakeATCB() {
   var iname, inum, iamt, qty=" ", stxt=" ", on0=" ", os0=" ", wt="0.1 "
   iname=arguments[0];
   inum=arguments[1];
   iamt=arguments[2];
   if (arguments.length>3) qty=MakeATCB.arguments[3];
   if (arguments.length>4) stxt=MakeATCB.arguments[4];
   if (stxt=="=") stxt=iname; 
   if (arguments.length>5) {on0=MakeATCB.arguments[5]; os0=MakeATCB.arguments[6]} 
   if (arguments.length>7) wt=MakeATCB.arguments[7];
   document.writeln('<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">');
   document.writeln('<input type="hidden" name="cmd" value="_cart">');
   document.writeln('<input type="hidden" name="business" value="orders@naturetables.com">');
   document.writeln('<input type="hidden" name="item_name" value="'+iname+'">');
   document.writeln('<input type="hidden" name="item_number" value="'+inum+'">');
   document.writeln('<input type="hidden" name="amount" value="'+iamt+'">');
   document.writeln('<input type="hidden" name="no_shipping" value="2">');
   if (wt!==" ")  {document.writeln('<input type="hidden" name="weight" value="'+wt+'">');
                   document.writeln('<input type="hidden" name="weight_unit" value="lbs">');};
   if (on0!==" ") {document.writeln('<input type="hidden" name="on0" value="'+on0+'">');
                   document.writeln('<input type="hidden" name="os0" value="'+os0+'">');};
   document.writeln('<input type="hidden" name="return" value="http://'+adn+'/ntthanks.htm">');
   document.writeln('<input type="hidden" name="cancel_return" value="http://'+adn+'/ntthanks1.htm">');
   document.writeln('<input type="hidden" name="image_url" value="httpS://secured.com/~f1015/s854528.gif">');
   document.writeln('<input type="hidden" name="cn" value="Comments?">');
   document.writeln('<input type="hidden" name="currency_code" value="USD">');
   if (stxt!=" ") document.writeln('<input type="image" src="ntcart.gif" border="0" align="center" name="submit" alt="Add to Cart">')
   else           document.writeln('<input type="image" src="ntcart.gif" border="0" align="right" name="submit" alt="Add to Cart">');
   if (qty!==" ") {document.writeln('Quantity');
                   document.writeln('<input type="input"  name="quantity" size="3" maxlength="3" value="1">');};
   if (stxt!=" ") document.writeln('<br><center>'+stxt+'</center>');
   document.writeln('<input type="hidden" name="add" value="1">');
   document.writeln('</form>');
}


/* Function MakeVCB builds the PayPal View Cart forms input with the appropriate values */

function MakeVCB() {
   document.writeln('<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">');
   document.writeln('<input type="hidden" name="cmd" value="_cart">');
   document.writeln('<input type="hidden" name="business" value="orders@naturetables.com">');
   document.writeln('<input type="image" src="ntcartv.gif" border="0" align="right" name="submit" alt="View Cart">');
   document.writeln('<input type="hidden" name="display" value="1">');
   document.writeln('</form>');
}


/* Function MakeBFdt builds 3 table cells in the butterflies section */

function MakeBFdt(iname, inum, iamt) {
   document.writeln('<td valign="center">'+iname+'</td>');
   document.writeln('<td valign="center" width="20%">'+inum+'&nbsp;&nbsp;  $'+iamt+'</td>');
   document.writeln('<td valign="center" align="right" width="15%">');
   MakeATCB(iname, inum, iamt, "Qty");
   document.writeln('</td>');
}

