<!--
//************************************************************************************************************
//************************************************************************************************************
//************************************************************************************************************
//************************************************************************************************************
//************************************************************************************************************

      //*****************************************************
      //*****************************************************
      //Start- This Is For Your Shipping Charge	
       

var shipping = 0.95; // How much for shipping PER ITEM?  There MUST be a ; after the number!

var freeshipping = 100; // 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.08375; //Tax rate for your state, must be in decimal form (eg. 8.750 becomes 0.0875)

<!-- var taxstate = "Oklahoma";	//The state you collect tax in (Your home state) -->


       //end- Tax Functions	
       //*****************************************************
	   //*****************************************************




       //*****************************************************
	   //*****************************************************
	   //Start- This Is Your Pay Pal email address.
	   //Replace between the quotes "brian@vShoppingCar.com" with your address.


var business = "TTPK@landsgate.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.toystoysonline.com/shopping.htm";


      //End- Thank You Page
	  //*****************************************************
	  //*****************************************************
      
	  
	  //*****************************************************
	  //*****************************************************
      //Start- This is the complete location (URL) to vbuy2.htm
	  //on your server.  Include the vbuy2.htm in the URL.
	  //Example you site URL is http://someplace.com 
	  //vbus2.htm is in the root folder the URL would be http://someplace.com/vbuy2.htm
		

var TovBuy2 = "http://www.toystoysonline.com/vbuy2.htm";


      //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 = ""; //Table Header and Footer Color
 var tablebodycolor = ""; //Body Color    
 var tablefontcolor = "#000000"; //Font Color
 
 
      //End- Table colors
	  //*****************************************************
	  //*****************************************************
       
      //*****************************************************
      //*****************************************************
      //Start- Go to vbasket.htm after product is added to shoppingcart
      // 1 is for yes. 0 is for no.


var vbasketTransaction = 0;


       //end- Go to vbasket.htm	
       //*****************************************************
	   //*****************************************************
       
       
       
//************************************************************************************************************
//************************************************************************************************************
//************************************************************************************************************
//************************************************************************************************************
//************************************************************************************************************



	// ****************************************************************** 
	// Unique Registration Number 1kU892loQQuyw1983-kk
	//
	// vShoppingCart(tm) ver 5.0-nq relay (c) 1999-2001 All rights reserved.
	// This is a licensed and copyrighted work. It is NOT 'Shareware' or
	// 'Freeware'.  This page and its software may not be copied,
	// dissassembled or reverse engineered. Use of this software
	// assumes your argeement to all license terms and condtions.
	//
	// http://www.vShoppingCart.com
	//
	// For more information contact: info@vshoppingCart.com 
	//
	// Name: vShoppingCar.js
	//
	// Everything above this line can not be removed.
	//
	//
	// NO NEED TO CHANGE ANYTHING HERE. DO NOT EDIT THIS PAGE IN A
	// WYSIWYG HTML EDITOR. USE A TEXT EDITOR. 
	//****************************************************************** 

   
      
      // 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, newQuantity) {
     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);
      }
	document.cookie="vShoppingCart="+document.cookie.substring(start, end)+"["+newItem+"|"+newPrice+"|"+newQuantity+"]; expires=Friday, 31-Dec-2010 08:00:00 GMT";
	window.location.href=document.location;
	
	if (vbasketTransaction){
	window.location.href='vbasket.htm';
	}
	
	
	}



	
// showItems() - displays shoppingcart contents in a 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('<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><FORM><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) theoption = fulllist.substring(itemstart, i);
				thisitem++;
				itemstart=i+1
				}
				}
		document.writeln('</SELECT><BR><CENTER><FONT SIZE="1" COLOR="#000000" FACE="Arial, Helvetica, sans-serif">');
		document.writeln('Sub Total: $'+ alterError(subtotal) +'</FONT></CENTER></FORM></TD></TR></TABLE>');
			    }




	

//Show vbuy.htm contents		
function showvbuy() {
     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);
     }
     var ItemsOrdered = document.cookie.substring(start,end);
		fulllist = document.cookie.substring(start, end);
		totprice = 0;
		totpricenoship = 0;
		document.writeln('<TABLE width=420 border=0>');
		document.writeln('<TR><TD valign=TOP width=180><font FACE=Helvetica SIZE=1 color=gray>ITEM<BR>DESCRIPTION</font></TD>');
		document.writeln('<TD valign=TOP width=100><font FACE=Helvetica SIZE=1 color=gray> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;QUANTITY</FONT></TD><TD valign=TOP width=70 align=RIGHT><font FACE=Helvetica SIZE=1 color=gray>ITEM<BR>COST</FONT></B></TD><TD valign=TOP width=70 align=RIGHT><B><font FACE=Helvetica SIZE=1 color=gray>SUB<BR>TOTAL</FONT></B></TD></TR>');
		itemlist = 0;
		numberofitems = 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;
				numberofitems = (numberofitems + parseInt(thequantity,10));
				document.write('<TR><TD><font FACE=Helvetica SIZE=2 color=black><b>'+theitem+'</b></font></TD>');
				document.writeln('<TD ALIGN=center><font FACE=Helvetica SIZE=2 color=black>'+thequantity+'</font></TD><TD ALIGN=RIGHT><font FACE=Helvetica SIZE=2 color=black>'+theprice+'</font></TD><TD ALIGN=RIGHT><font FACE=Helvetica SIZE=2 color=black>'+alterError(itemtotal)+'</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);
				thisitem++;
				itemstart=i+1;
       }}
	   
	   
	   if (totprice > freeshipping) shippingcharge = 0;
	   else shippingcharge = (shipping * numberofitems) + 5.95;
	   if (totprice<1) shippingcharge = 0;
	   totpricenoship = totprice
       totprice = totprice + shippingcharge;
       
              
		// Get CustID Cookie
		function getCookie(name) {
     	var cookie = " " + document.cookie;
      	var search = " " + name + "=";
     	var setStr = null;
      	var offset = 0;
     	var end = 0;
     	 if (cookie.length > 0) {
      	offset = cookie.indexOf(search);
			if (offset != -1) {
   			offset += search.length;
   			end = cookie.indexOf(";", offset)
   				if (end == -1) {
   				end = cookie.length;
					}
					setStr = unescape(cookie.substring(offset, end));
					}
					}
		return(setStr);
		}
		var ID="";
		ID = getCookie("CustID");
		// Get CustID Cookie - End
		document.writeln('<TR><TD COLSPAN=3><font FACE=Helvetica SIZE=2 color=black><i>Shipping</i></font></TD><TD ALIGN=RIGHT><font FACE=Helvetica SIZE=2 color=black><i>'+alterError(shippingcharge)+'</i></font></TD></TR>');
		document.writeln('<TR><TD COLSPAN=4 height=10>&nbsp;</TD></TR>');
		document.writeln('<TR><TD COLSPAN=3><font FACE=Helvetica SIZE=3 color=RED><B>Total To Be Charged</B></FONT></TD><TD ALIGN=RIGHT><font FACE=Helvetica SIZE=3 color=BLACK><B>$'+alterError(totprice)+'</B></FONT></TD></TR>');
		document.write('<FORM METHOD="POST" ACTION="https://www.paypal.com/cgi-bin/webscr">');
		document.write('<INPUT TYPE="hidden" NAME="cmd" VALUE="_xclick">');
		document.write('<INPUT TYPE="hidden" NAME="business" VALUE="' + business + '">');
		document.write('<INPUT TYPE="hidden" NAME="item_name" VALUE="' + fulllist + '">');
		document.write('<INPUT TYPE="hidden" name="item_number" value="' + ID + '">');
		document.write('<INPUT TYPE="hidden" NAME="amount" VALUE="' + alterError(totpricenoship) + '">');
		document.write('<INPUT TYPE="hidden" NAME="shipping" VALUE="' + alterError(shippingcharge) + '">');
		document.write('<INPUT TYPE="hidden" NAME="return" VALUE="' + returnURL + '">');
		document.writeln('<center><font size=2 face=Helvetica color=#0C4102><b>Order Id = ' + ID +'</b></font><p></center>');
		document.writeln('<TR><TD COLSPAN=4><font size=1 face=Helvetica color=#000000>I agree that I am processing the above order for purchase according to the terms of purchase that appear on this page.  I further agree that I understand that I am processing an order for adult novelty items, and that I must be 18 years or older to complete this order.</font></TD></TR>');
		document.writeln('<TR><TD COLSPAN=4 align=center>');
		document.writeln('<INPUT TYPE=IMAGE NAME=submit_order SRC="images/process-button.jpg"><P>');
		document.writeln('</td></tr></TABLE></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('<INPUT TYPE="image" src="images/emptycart-but.jpg" NAME="clear" VALUE="Clear Entire ShoppingCart" ONCLICK="clearBasket()"><P>');
		document.writeln('<TABLE width=490 border=0>');
		document.writeln('<TR><TD valign=TOP width=180><font FACE=Helvetica SIZE=1 color=gray>ITEM<BR>DESCRIPTION</font></TD><TD valign=TOP width=140><font FACE=Helvetica SIZE=1 color=gray> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;QUANTITY</FONT></TD><TD valign=TOP width=70 align=RIGHT><font FACE=Helvetica SIZE=1 color=gray>ITEM<BR>COST</FONT></B></TD>');
		document.writeln('<TD valign=TOP width=70 align=RIGHT><B><font FACE=Helvetica SIZE=1 color=gray>SUB<BR>TOTAL</FONT></B><TD valign=TOP width=70 align=CENTER><B><font FACE=Helvetica SIZE=1 color=gray>REMOVE<BR>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;
				itemlist=itemlist+1;
				document.write('<TR><TD><font FACE=Helvetica SIZE=2 color=BLACK><B>'+theitem+'</B></FONT></TD>');
				document.write('<TD ALIGN=CENTER><INPUT TYPE=TEXT NAME="quant'+itemlist+'" VALUE="'+thequantity+'" SIZE=3><BR><A HREF="javascript:amendItem('+itemlist+',document.updateform.quant'+itemlist+'.value)"><center><font FACE=Helvetica SIZE=1 color=gray>Change the quantity<br>then <font FACE=Helvetica SIZE=1 color=red>CLICK HERE</font></A></center></FONT></TD>');
				document.write('<TD ALIGN=RIGHT><font FACE=Helvetica SIZE=2 color=BLACK>'+theprice+'</FONT></TD><TD ALIGN=RIGHT><font FACE=Helvetica SIZE=2 color=BLACK><B>'+alterError(itemtotal)+'</B></FONT></TD><TD align=center><font FACE=Helvetica SIZE=1 color=gray><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);
				thisitem++;
				itemstart=i+1;
			}
		}
		document.writeln('<TR><TD COLSPAN=5 height=20>&nbsp;</TD></TR>');
		document.writeln('<TR><TD COLSPAN=3 align=right><font FACE=Helvetica SIZE=3 color=RED><B>Running Sub Total:</B></FONT></TD><TD ALIGN=RIGHT><font FACE=Helvetica SIZE=3 color=BLACK><B>$ '+alterError(totprice)+'</B></FONT></TD><TD></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+'|'+newquant+']';
				}
			} else if (fulllist.substring(i,i+1) == '|') {
				if (thisitem==1) theitem = fulllist.substring(itemstart, i);
				if (thisitem==2) theprice = 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-2012 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";
			
		}}


//-->

