The script
version 2.04.01
February 5,98

index:
1) The JavaScript that must be included in every HTML page
2) Buttons that show the cart when they are clicked
	a) Button for sizable items
	b) Button for nonsizable items
3) Buttons that do not show the cart when they are clicked
	a) Button for sizable items
	b) Button for nonsizable items
4) Button to view cart contents


------------------------------------------------------------------------------------------

<SCRIPT LANGUAGE="javascript">

// written by WebDock
// www.web-dock.com
// email : software@web-dock.com
// property of NowSelling.Com - DO NOT DISTRIBUTE
// www.web-dock.com
// license number: 
// vers 1.02.03 date 2-5-98

var expires = new Date();
   expires.setTime (expires.getTime() + 24 * 60 * 60 * 30 * 1000);
   var expiryDate = expires.toGMTString();

   
function addToCart(name,value,form,peaches) {
	var c_old = getCookie("Buy")
	value= peaches + "{" + form.q.value + "!" + value + "|" +  c_old
	form.buyme.value = value
	document.cookie = name + "=" + value + "; path= /";
   }
  

 function getCookie(name,form) {
    	var cookieFound = false;
     	var start = 0;
     	var end = 0;
	var i = 0;
    	var cookieString = document.cookie;
   	while (i <= cookieString.length) {
       		start = i;
       		end = start + name.length;
      		 if (cookieString.substring(start,end) == name) {
         			cookieFound = true;
        		 	break;
       		}
      		 i++;
     	}
  	 	

      	if (cookieFound ) {
    		start = end + 1;
               		end = document.cookie.indexOf(";",start);
  if(end == -1 || end == " " || end == ""){
       	 	end = 0;}

 		if (end < start)
         		end = document.cookie.length;
     		return document.cookie.substring(start,end);
     	}
     return "";
   }

function showMyCart(form) {
var c_old = getCookie("Buy",form)
if (c_old == "" ||  c_old == " "){
}
else{
form.buyme.value = c_old;}
}

function isANumber(number, message) {
                     answer = 1;
  if (!parseFloat(number)) {
                       //the first digit wasn't numeric
                       answer = 0;
                       alert("Please enter a numeric value for the " + message + " field.");
	
 }
else {
                       //the first digit was numeric, so check the rest
                       for (var i=0; i<number.length; i++) {
                         if ((number.charAt(i) != "0")&& (!parseFloat(number.charAt(i)))) {
                             answer = 0;
                             alert("Please enter a numeric value for the " + message + " field.");
                             break;
                         }
                       }
                     }
                     return answer;
                   }

// empty shopping cart

function emptyCart() {
 var name = "Buy";
 var value = " " ;
        document.cookie = name + "=" + value + "; path= /";
  }
</SCRIPT>

------------------------------------------------------------------------------------------
Button for sizable items:
------------------------------------------------------------------------------------------

<FORM action="/cgi-bin/shop.cmd"target = _top method="POST">

<!-- edit sizes in the  list below as needed -->
<SELECT name="peaches" >
<OPTION value="S" SELECTED >S
<OPTION value="M">M
<OPTION value="L">L
<OPTION value="XL">XL
<OPTION value="XXL">XXL
</SELECT>

<INPUT type="hidden" name="where" value="">
<INPUT type="hidden" name="spare1" value="">
<INPUT type="hidden" name="spare2" value="">

<!-- replace the next value with your products web_id -->
<INPUT type="hidden" name="product" value="15">

<INPUT type="hidden" name="buyme">
<INPUT name="q" value="1" size="3" maxlength="3"  onChange="if(this.value) {if (!(isANumber(this.value, 'quantity'))) {this.focus();}}"><INPUT type="submit" name="Buy" value="Add Item To Cart" onclick="addToCart(this.name,form.product.value,this.form,form.peaches.options[form.peaches.selectedIndex].value)"></TD></TR>
</FORM>


-----------------------------------------------------------------------------------------------
Button for non sizable items
-----------------------------------------------------------------------------------------------

<FORM action="/cgi-bin/shop.cmd"target = _top method="POST">

<INPUT type="hidden" name="peaches" value="NA"> 
<INPUT type="hidden" name="where" value="">
<INPUT type="hidden" name="spare1" value="">
<INPUT type="hidden" name="spare2" value="">

<!-- replace the next value with your products web_id -->
<INPUT type="hidden" name="product" value="1">


<INPUT type="hidden" name="buyme">
<INPUT name="q" value="1" size="3" maxlength="3"  onChange="if(this.value) {if (!(isANumber(this.value, 'quantity'))) {this.focus();}}"><INPUT type="submit" name="Buy" value="Add Item To Cart" onclick="addToCart(this.name,form.product.value,this.form,form.peaches.value)">

</FORM>





********************************************************************
buttons that don't show cart 
*********************************************************************
------------------------------------------------------------------------------------------
Button for sizable items:
------------------------------------------------------------------------------------------

<FORM method="POST">

<!-- edit sizes in the  list below as needed -->
<SELECT name="peaches" >
<OPTION value="S" SELECTED >S
<OPTION value="M">M
<OPTION value="L">L
<OPTION value="XL">XL
<OPTION value="XXL">XXL
</SELECT>

<INPUT type="hidden" name="where" value="">
<INPUT type="hidden" name="spare1" value="">
<INPUT type="hidden" name="spare2" value="">

<!-- replace the next value with your products web_id -->
<INPUT type="hidden" name="product" value="15">

<INPUT type="hidden" name="buyme">
<INPUT name="q" value="1" size="3" maxlength="3"  onChange="if(this.value) {if (!(isANumber(this.value, 'quantity'))) {this.focus();}}"><INPUT type="button" name="Buy" value="Add Item To Cart" onclick="addToCart(this.name,form.product.value,this.form,form.peaches.options[form.peaches.selectedIndex].value)"></TD></TR>
</FORM>


------------------------------------------------------------------------------------
Button for non sizable items
-----------------------------------------------------------------------------------------------

<FORM>

<INPUT type="hidden" name="peaches" value="NA"> 
<INPUT type="hidden" name="where" value="">
<INPUT type="hidden" name="spare1" value="">
<INPUT type="hidden" name="spare2" value="">

<!-- replace the next value with your products web_id -->
<INPUT type="hidden" name="product" value="1">


<INPUT type="hidden" name="buyme">
<INPUT name="q" value="1" size="3" maxlength="3"  onChange="if(this.value) {if (!(isANumber(this.value, 'quantity'))) {this.focus();}}"><INPUT type="button" name="Buy" value="Add Item To Cart" onclick="addToCart(this.name,form.product.value,this.form,form.peaches.value)">

</FORM>




--------------------------------------------------------------------------------
show cart button
--------------------------------------------------------------------------------

<FORM action="/cgi-bin/shop.cmd" method="POST">
<INPUT type="hidden" name="peaches" value="NA">
<INPUT type="hidden" name="buyme" value="{0!0|">
<INPUT type="submit" name="show" value="View Shopping Cart" onclick="showMyCart(this.form)">
</FORM>
