<!--
//************************************************************************************************************
//************************************************************************************************************
//************************************************************************************************************
//************************************************************************************************************
//************************************************************************************************************

      //*****************************************************
      //*****************************************************
      //Start- This Is For Your Shipping Charge	
	       

//var shipping = 10; // How much for shipping PER ITEM?  There MUST be a ; after the number!

var freeshipping = 2000; // When is shipping free? If never, put in a very large number. There MUST be a ; after the number!


       //end- Shipping Charge	
       //*****************************************************
	   //*****************************************************



 	  //*****************************************************
      //*****************************************************
      //Start- Simple Tax Functions
	       

var taxrate = 0.08; //Tax rate for your state, must be in decimal form (eg. 8.750 becomes 0.0875)

var taxstate = "Missouri";    //The state you collect tax in (Your home state)


       //end- Tax Functions	
       //*****************************************************
	   //*****************************************************


       //*****************************************************
	   //*****************************************************
	   //Start- This Is Your Pay Pal email address.
	   //Replace between the quotes "test" with your address.


var business = "AirScharnell1@cs.com";


      //End- Merchant Login Data
	  //*****************************************************
	  //*****************************************************

	  
	  //*****************************************************
	  //*****************************************************
      //Start- Return To A Thank You Page On Your Website
	  //Enter in a URL back to your website that your customer
	  //will press after an order (eg: a thank you page).  
	  //Replace "http://www.YOURWEBSITE.com" with your URL.
		

var returnURL = "http://www.teamseaholm.com/webstore/orderComp.asp";

  
      //End- Thank You Page
	  //*****************************************************
	  //*****************************************************
      


	  
	  //*****************************************************
	  //*****************************************************
      //Start- Table colors.  This allows you to set the table  
	  //colors and font colors displayed on vbuy.htm and 
	  //vbasket.htm.  You can change the to reflect the colors
	  //you want on your website.

      
      
 var tableheadcolor = "#D3D3D3"; //Table Header and Footer
 var tablebodycolor = "#FFFFFF"; //Body Color    
 var tablefontcolor = "#000000"; //Font Color
 
 
 
      //End- Table colors
	  //*****************************************************
	  //*****************************************************
       
//************************************************************************************************************
//************************************************************************************************************
//************************************************************************************************************
//************************************************************************************************************
//************************************************************************************************************








      
      // No need to change anything below this line.
      //*****************************************************
      






// alterError - fixes a rounding bug
function alterError(value) {
		if (value<=0.99) {
			newDollars = '0';
		} else {
			newDollars = parseInt(value);
		}
		newCents = parseInt((value+.0008 - newDollars)* 100);
		if (eval(newCents) <= 9) newCents='0'+newCents;
		newString = newDollars + '.' + newCents;
		return (newString);
	}
	
	

// buyItem - adds an item to the shopping basket
function buyItem(newItem, newPrice, newShipping, newQuantity) {
		if (newQuantity <= 0) {
			rc = alert('The quantity entered is incorrect');
		} else {
		
     var CookieName = "vShoppingCart";
     var cookieFound = false;
     var start = 0;
     var end = 0;
	 var newQuantity = 1
     var cookieString = document.cookie;
     var i = 0;
     while (i <= cookieString.length) {
       start = i;
       end = start + CookieName.length;
       if (cookieString.substring(start,end) == CookieName) {
         cookieFound = true;
        break;
       }
       i++;
     }
     if (cookieFound) {
       start = end + 1;
       end = document.cookie.indexOf(";",start);
       if (end < start)
         end = document.cookie.length;
       document.cookie.substring(start,end);
      }
	document.cookie="vShoppingCart="+document.cookie.substring(start, end)+"["+newItem+"|"+newPrice+"|"+newShipping+"|"+newQuantity+"]; expires=Friday, 31-Dec-2050 08:00:00 CST";
	window.location.href="vbasket.htm";
			}
			}
			

	
// showItems() - displays shoppingcart contents drop down select array
function showItems() {
	 var CookieName = "vShoppingCart";
     var cookieFound = false;
     var start = 0;
     var end = 0;
     var cookieString = document.cookie;
     var i = 0;
     while (i <= cookieString.length) {
       start = i;
       end = start + CookieName.length;
       if (cookieString.substring(start,end) == CookieName) {
         cookieFound = true;
        break;
       }
       i++;
     }
     if (cookieFound) {
       start = end + 1;
       end = document.cookie.indexOf(";",start);
       if (end < start)
         end = document.cookie.length;
       document.cookie.substring(start,end);
      }		
      fulllist = document.cookie.substring(start, end);
		subtotal = 0;
		howmany = 0;
document.writeln('<FORM><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><select><option> Shopping Cart Contents </OPTION>');
		itemlist = 0;
		for (var i = 0; i <= fulllist.length; i++) {
			if (fulllist.substring(i,i+1) == '[') {
				itemstart = i+1;
				thisitem = 1;
			} else if (fulllist.substring(i,i+1) == ']') {
				itemend = i;
				thequantity = fulllist.substring(itemstart, itemend);
				itemtotal = 0;
				howmany = howmany + 1;
				itemtotal = (eval(theprice*thequantity));
				temptotal = itemtotal * 100;
				subtotal = subtotal + itemtotal;
				itemlist=itemlist+1;
				document.write('<OPTION>'+thequantity+' -   '+theitem+'</OPTION>');
			} else if (fulllist.substring(i,i+1) == '|') {
				if (thisitem==1) theitem = fulllist.substring(itemstart, i);
				if (thisitem==2) theprice = fulllist.substring(itemstart, i);
				if (thisitem==3) theship = fulllist.substring(itemstart, i);
				if (thisitem==4) theoption = fulllist.substring(itemstart, i);
				thisitem++;
				itemstart=i+1
				}
				}
document.writeln('</SELECT><BR><CENTER><FONT SIZE="1" COLOR="#FFFFFF" FACE="Arial, Helvetica, sans-serif">');
document.writeln('&nbsp;'+ howmany +'&nbsp;Item(s)&nbsp;&nbsp;Sub Total: $'+ alterError(subtotal) +'</FONT></CENTER></TD></TR></TABLE></FORM>');
			    }




	

//Show vbuy.htm contents		
function showvbuy() {
     var CookieName = "vShoppingCart";
     var maxshipping = 0;
     var theship = 3;
     var cookieFound = false;
     var start = 0;
     var end = 0;
     var cookieString = document.cookie;
     var i = 0;
	 
	 document.write('<FORM METHOD="POST" ACTION="https://secure.paypal.com/cgi-bin/webscr">');
     document.write('<INPUT TYPE="hidden" NAME="cmd" VALUE="_cart">');
	 document.write('<INPUT TYPE="hidden" NAME="upload" VALUE="1">');
	 document.write('<INPUT TYPE="hidden" NAME="business" VALUE="' + business + '">');
		
     while (i <= cookieString.length) {
       start = i;
       end = start + CookieName.length;
       if (cookieString.substring(start,end) == CookieName) {
         cookieFound = true;
        break;
       }
       i++;
     }
     if (cookieFound) {
       start = end + 1;
       end = document.cookie.indexOf(";",start);
       if (end < start)
         end = document.cookie.length;
       document.cookie.substring(start,end);
     }
     var ItemsOrdered = document.cookie.substring(start,end);
		fulllist = document.cookie.substring(start, end);
		totprice = 0;
		totpricenoship = 0;
		document.writeln('<TABLE CELLSPACING=1 WIDTH=100% CELLPADDING=3 BGCOLOR="' + tablebodycolor + '">');
		document.writeln('<TR bgcolor=' + tableheadcolor + '><TD><b><font size=2 color=' + tablefontcolor + '>Item</FONT></B></TD><TD><B><FONT SIZE=2 COLOR=' + tablefontcolor + '>Quantity</FONT></B></TD><TD><B><FONT SIZE=2 COLOR=' + tablefontcolor + '>Cost Each</FONT></B></TD><TD><B><FONT SIZE=2 COLOR=' + tablefontcolor + ' >Sub Total</FONT></B></TD></TR>');
		itemlist = 0;
		for (var i = 0; i<= fulllist.length; i++) {
			if (fulllist.substring(i,i+1) == '[') {
				thisitem = 1;
				itemstart = i+1;
			} else if (fulllist.substring(i,i+1) == ']') {
				itemend = i;
				thequantity = fulllist.substring(itemstart, itemend);
				
				itemtotal = 0;
				itemtotal = (eval(theprice*thequantity));
				temptotal = itemtotal * 100;
				totprice = totprice + itemtotal;
				itemlist=itemlist+1;
				document.write('<TR><TD><font size=2>'+theitem+'</font></TD>');
				document.writeln('<TD ALIGN=LEFT><font size=2>'+thequantity+'</font></TD><TD ALIGN=LEFT><font size=2>'+theprice+'</font></TD><TD ALIGN=LEFT><font size=2>'+alterError(itemtotal)+'</font></TD></TR>');

                document.write('<INPUT TYPE="hidden" NAME="item_name_'+ itemlist +'" + " VALUE="' + theitem + '">');
				document.write('<INPUT TYPE="hidden" NAME="amount_'+ itemlist +'" + " VALUE="' + theprice + '">');
				document.write('<INPUT TYPE="hidden" NAME="quantity_'+ itemlist +'" + " VALUE="' + thequantity + '">');
				
		        //document.write('<INPUT TYPE="hidden" NAME="amount_" + i + " VALUE="' + theprice + '">');
			} else if (fulllist.substring(i,i+1) == '|') {
				if (thisitem==1) theitem = fulllist.substring(itemstart, i);
				if (thisitem==2) theprice = fulllist.substring(itemstart, i);
				if (thisitem==3) theship = fulllist.substring(itemstart, i);
				if (theship*100 > maxshipping*100){
					maxshipping = theship;

				}
				thisitem++;
				itemstart=i+1;

       }}

       totpricenoship = totprice
       shippingcharge = (maxshipping * 100)/100;
       totprice = totprice + shippingcharge;
		document.writeln('<TR><TD COLSPAN=3><FONT SIZE="2"><B>Shipping</B></FONT></TD><TD ALIGN=LEFT><FONT SIZE="2">'+alterError(shippingcharge)+'</FONT></TD></TR>');
		document.writeln('<TR><TD BGCOLOR=' + tableheadcolor + ' COLSPAN=3><FONT COLOR=' + tablefontcolor + ' SIZE="2"><B>Total To Be Charged</B></FONT></TD><TD BGCOLOR=' + tableheadcolor + ' ALIGN=LEFT><FONT COLOR=' + tablefontcolor + ' SIZE="2"><B>$'+alterError(totprice)+'</B></FONT></TD></TR>');
			
		//document.write('<INPUT TYPE="hidden" NAME="item_number" VALUE="">');
		//document.write('<INPUT TYPE="hidden" NAME="shipping_cart" VALUE="' + alterError(shippingcharge) + '">');
		
		document.write('<INPUT TYPE="hidden" NAME="return" VALUE="' + returnURL + '">');
		document.writeln('</TABLE>');
        document.writeln('<P><TABLE BORDER=0 BGCOLOR="#FFFFFF" WIDTH=100%><TR><TD COLSPAN=2><CENTER>');
        document.writeln('<P ALIGN="CENTER"><INPUT TYPE=submit NAME=submit_order value="Procede to Secure Purchase"></TD></TR></CENTER></TABLE><CENTER><BR></P>');
                
                
		document.writeln('</CENTER><FORM>');
		}
	
	
	
	
//Show vbasket.htm contents	
function showvbasket() {
	 var CookieName = "vShoppingCart";
     var cookieFound = false;
     var start = 0;
     var end = 0;
     var cookieString = document.cookie;
     var i = 0;
     while (i <= cookieString.length) {
       start = i;
       end = start + CookieName.length;
       if (cookieString.substring(start,end) == CookieName) {
         cookieFound = true;
        break;
       }
       i++;
     }
     if (cookieFound) {
       start = end + 1;
       end = document.cookie.indexOf(";",start);
       if (end < start)
         end = document.cookie.length;
       document.cookie.substring(start,end);
     }
		fulllist = document.cookie.substring(start, end);
		totprice = 0;
		document.writeln('<FORM NAME="updateform">');
		document.writeln('<TABLE CELLSPACING=1 WIDTH=100% CELLPADDING=3 BGCOLOR="' + tablebodycolor + '">');
		document.writeln('<TR bgcolor=' + tableheadcolor + '><TD><b><font size=2 color=' + tablefontcolor + '>Item</FONT></B></TD><TD><B><FONT SIZE=2 COLOR=' + tablefontcolor + '>Quantity</FONT></B></TD><TD><B><FONT SIZE=2 COLOR=' + tablefontcolor + '>Cost Each</FONT></B></TD>');
		document.writeln('<TD><B><FONT SIZE=2 COLOR=' + tablefontcolor + '>Sub Total </FONT></B><TD><B><FONT SIZE=2 COLOR=' + tablefontcolor + '>Delete Item</FONT></B></TD></TR>');
		itemlist = 0;
		for (var i = 0; i <= fulllist.length; i++) {
			if (fulllist.substring(i,i+1) == '[') {
				itemstart = i+1;
				thisitem = 1;
			} else if (fulllist.substring(i,i+1) == ']') {
				itemend = i;
				thequantity = fulllist.substring(itemstart, itemend);
				itemtotal = 0;
				itemtotal = (eval(theprice*thequantity));
				temptotal = itemtotal * 100;
				totprice = totprice + itemtotal;
				thisshipping = theship;
				itemlist=itemlist+1;
				document.write('<TR><TD><font size=2>'+theitem+'</font></TD>');
				document.write('<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME="quant'+itemlist+'" VALUE="'+thequantity+'" SIZE=5><BR><FONT SIZE=1 COLOR=' + tablefontcolor + '><A HREF="javascript:amendItem('+itemlist+',document.updateform.quant'+itemlist+'.value, thisshipping)">Update Quantity</A></FONT></TD><TD ALIGN=LEFT><font size=2>'+theprice+'</font></TD><TD ALIGN=LEFT><B><font size=2>'+alterError(itemtotal)+'</font></B></TD><TD><FONT SIZE=1><a href="javascript:removeItem('+itemlist+')"<CENTER><IMG SRC="images/delete_item.gif" BORDER=0></CENTER></A></FONT></TD></TR>');
			} else if (fulllist.substring(i,i+1) == '|') {
				if (thisitem==1) theitem = fulllist.substring(itemstart, i);
				if (thisitem==2) theprice = fulllist.substring(itemstart, i);
				if (thisitem==3) theship = fulllist.substring(itemstart, i);
				thisitem++;
				itemstart=i+1;
			}
		}
		document.writeln('<TR><TD COLSPAN=3 BGCOLOR=' + tableheadcolor + '><FONT COLOR=' + tablefontcolor + ' size=2><B>Sub Total</B></FONT></TD><TD BGCOLOR=' + tableheadcolor + ' ALIGN=LEFT><FONT COLOR=BLACK SIZE=2><B>'+alterError(totprice)+'</B></FONT></TD><TD  BGCOLOR=' + tableheadcolor + '></TD></TR>');
		document.writeln('</TABLE></FORM>');
		document.writeln('');
	}
	
	
//adjust quantity of vbasket.htm
function amendItem(itemno, newquant) {
		newItemList = null;
		itemlist = 0;
		for (var i = 0; i <= fulllist.length; i++) {
			if (fulllist.substring(i,i+1) == '[') {
				thisitem = 1;
				itemstart = i+1;
				fullstart = i+1;
			} else if (fulllist.substring(i,i+1) == ']') {
				itemend = i;
				itemlist=itemlist+1;
				if (itemlist != itemno) {
					newItemList = newItemList+'['+fulllist.substring(fullstart, itemend)+']';
				} else {
					newItemList = newItemList + '['+theitem+'|'+theprice+'|'+theship+'|'+newquant+']';					
				}
			} else if (fulllist.substring(i,i+1) == '|') {
				if (thisitem==1) theitem = fulllist.substring(itemstart, i);
				if (thisitem==2) theprice = fulllist.substring(itemstart, i);
				if (thisitem==3) theship = fulllist.substring(itemstart, i);
				thisitem++;
				itemstart=i+1;
			}
		}
	
		index = document.cookie.indexOf("vShoppingCart");
		document.cookie="vShoppingCart="+newItemList+"; expires=Friday, 31-Dec-2010 08:00:00 GMT";
		self.location = "vbasket.htm";
		}
	
	
//Remove item from vbasket.htm	
function removeItem(itemno) {
		newItemList = null;
		itemlist = 0;
		for (var i = 0; i <= fulllist.length; i++) {
			if (fulllist.substring(i,i+1) == '[') {
				itemstart = i+1;
			} else if (fulllist.substring(i,i+1) == ']') {
				itemend = i;
				theitem = fulllist.substring(itemstart, itemend);
				itemlist=itemlist+1;
				if (itemlist != itemno) {
					newItemList = newItemList+'['+fulllist.substring(itemstart, itemend)+']';
				}
			}
		}
		index = document.cookie.indexOf("vShoppingCart");
		document.cookie="vShoppingCart="+newItemList+"; expires=Friday, 31-Dec-2010 08:00:00 GMT";
		self.location = "vbasket.htm";
		}



// clearBasket() - removes all items from the basket
function clearBasket() {
		if (confirm('Are you sure you want to ERASE everything in your ShoppingCart?')) {
			index = document.cookie.indexOf("vShoppingCart");
			document.cookie="vShoppingCart=.";
			self.location = "vbasket.htm";
			
		}}


//-->

