<!--
//************************************************************************************************************
//************************************************************************************************************
//************************************************************************************************************
//************************************************************************************************************
//************************************************************************************************************

      //*****************************************************
      //*****************************************************
      //Start- This Is For Your Shipping Charge	
	       

var shipping = 0; // How much for shipping PER ITEM?  There MUST be a ; after the number!

var freeshipping = 5; // 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.0775; //Tax rate for your state, must be in decimal form (eg. 8.750 becomes 0.0875)

var taxstate = "Only if you want me to";	//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 = "Gateway Gems";


      //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.gatewaygems.com/";


      //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 = "#336699"; //Table Header and Footer Color
 var tablebodycolor = "#CCCCCC"; //Body Color    
 var tablefontcolor = "#FFFFFF"; //Font Color
 
 
      //End- Table colors
	  //*****************************************************
	  //*****************************************************
       
       
       
//************************************************************************************************************
//************************************************************************************************************
//************************************************************************************************************
//************************************************************************************************************
//************************************************************************************************************



	// ****************************************************************** 
	// Unique Registration Number 1kU892loQQuyw1983-kk
	//
	// vShoppingCart(tm) ver 4.03tt-nf (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) {
		if (newQuantity <= 0) {
			rc = alert('The quantity entered is incorrect');
		} else {
		if (confirm('Add Quantity '+newQuantity+' of '+newItem+' To Your Shopping Cart?')) {
     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;
			}
			}
			}


	
// 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('<FORM><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><select><option> Show 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('&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 cookieFound = false;
     var start = 0;
     var end = 0;
     var cookieString = document.cookie;
     var i = 0;
//DISABLE ANNOYING TAX POP-UP
    	 // Tax function
		var taxcharge = "0";
		var taxcheck = "0"//confirm('State Sales Tax Question: Are You A Resident Of ' + taxstate+'? Press "Ok" For Yes. Otherwise Press "Cancel" For No.');
		if (taxcheck) {
		taxcharge = "0";//taxrate;
		}
//END DISABLE 
     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 CELLPADDING=3 BGCOLOR="' + tablebodycolor + '">');
		document.writeln('<TR bgcolor=' + tableheadcolor + '><TD><b><font size=3 color=' + tablefontcolor + '>Item</FONT></B></TD>');
		document.writeln('<TD><B><FONT SIZE=3 COLOR=' + tablefontcolor + '>Quantity</FONT></B></TD><TD><B><FONT SIZE=3 COLOR=' + tablefontcolor + '>Cost Each</FONT></B></TD><TD><B><FONT SIZE=3 COLOR=' + tablefontcolor + ' >Sub 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>'+theitem+'</TD>');
				document.writeln('<TD ALIGN=RIGHT>'+thequantity+'</TD><TD ALIGN=RIGHT>'+theprice+'</TD><TD ALIGN=RIGHT>'+alterError(itemtotal)+'</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;
       }}
		// Print Tax       
		var subtax=0;
		subtax = totprice * taxcharge;
		totprice = totprice + subtax;
		document.writeln('<TR><TD COLSPAN=3><B>Tax</B> ('+taxstate+')</TD><TD ALIGN=RIGHT>'+alterError(subtax)+'</TD></TR>');
		// end
//SHIPPING CHARGE CALCULATION
         freeshipping = 50
	   if (totprice > 50) shippingcharge = 3
   	   else shippingcharge = 2;//shipping * numberofitems;
	   if (totprice<1) shippingcharge = 0;
	   totpricenoship = totprice
       totprice = totprice + shippingcharge;
//END CALCULATION
		document.writeln('<TR><TD COLSPAN=3><B>Shipping</B></TD><TD ALIGN=RIGHT>'+alterError(shippingcharge)+'</TD></TR>');
		document.writeln('<TR><TD BGCOLOR=' + tableheadcolor + ' COLSPAN=3><FONT COLOR=' + tablefontcolor + '><B>Total To Be Charged</B></FONT></TD><TD BGCOLOR=' + tableheadcolor + ' ALIGN=RIGHT><FONT COLOR=' + tablefontcolor + '><B>$'+alterError(totprice)+'</B></FONT></TD></TR>');

//BEGIN SUBMIT CART CONTENTS

		document.write('<FORM METHOD="POST" ACTION="https://www.nightowl.net/cgi-bin/formmail.p2">');

//FORMMAIL REQUIREMENTS
document.write('<INPUT TYPE="hidden" NAME="recipient" VALUE="purchase@gatewaygems.com">');
document.write('<INPUT TYPE="hidden" NAME="redirect" VALUE="https://www.nightowl.net/gatewaygems-secure/processed.shtml">');
document.write('<INPUT TYPE="hidden" NAME="sort" VALUE="alphabetic">');
document.write('<INPUT TYPE="hidden" NAME="subject" VALUE="Gateway Gems Order">');
//END FORMMAIL REQUIREMENTS

		//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="">');
		document.write('<INPUT TYPE="hidden" NAME="12_amount" VALUE="' + alterError(totpricenoship) + '">');
		document.write('<INPUT TYPE="hidden" NAME="13_shipping" VALUE="' + alterError(shippingcharge) + '">');
		//document.write('<INPUT TYPE="hidden" NAME="return" VALUE="' + returnURL + '">');
		document.writeln('</TABLE>');

//BEGIN CUSTOMER INFO

document.write('<p align="left"><font color="#000000" size="3">&nbsp;&nbsp; All orders are shipped to the address entered below, unless otherwise requested. To avoid problems with credit card processing the address on the order must match the address on your billing statement. If you wish the order to be sent to a third party, please contact us. </font></p>');

document.write('<p align="left"><font color="#000000" size="3">&nbsp;&nbsp; If you wish to use checks, Money Orders or PayPal instead of cards, select that method in the payment options below. Leave the final fields blank. When your order has been submitted you will receive a confirmation message shortly thereafter. We will follow that with a personal e-mail to you as to the status of the order, availability of items, insured mailing cost, and our address if you chose check or Money Order as your payment option. If you chose PayPal we will send a PayPal invoice.</font></p>');

document.writeln('<table border="0">');
      document.writeln('<tr><td align="right"><font size="3">Name:</font></td>');
      document.writeln('<td><font size="3"><input type="text" size="25" name="01_RealName"></font></td>');
      document.writeln('<td align="right"></td><td></td><td align="right"></td><td></td></tr>');

    document.writeln('<tr><td align="right"><font size="3">Address:</font></td>');
    document.writeln('<td><font size="3"><input type="text" size="25" name="03_Address"></font></td>');
    document.writeln('<td align="right"></td><td></td><td align="right"></td><td></td></tr>');

    document.writeln('<tr><td align="right"><font size="3">City:</font></td>');
      document.writeln('<td><font size="3"><input type="text" size="25" name="04_City"></font></td>');
      document.writeln('<td align="right"><font size="3">ST:</font></td>');
      document.writeln('<td><font size="3"><input type="text" size="4" name="05_State"></font></td>');
      document.writeln('<td align="right"><font size="3">Zip:</font></td><td><font size="3"><input type="text" size="9" name="06_Zip"></font></td></tr>');

    document.writeln('<tr><td align="right"><font size="3">Telephone:</font></td><td><font size="3"><input type="text" size="12" name="07_Telephone"><font color="#000000">&nbsp;&nbsp; Optional');
      document.writeln('but it helps</font></font></td><td align="right"></td><td colspan="3"><div align="center"></div></td></tr>');

    document.writeln('<tr align="left"><td align="right"><font size="3">E-Mail Address:</font></td>');
      document.writeln('<td><font size="3"><input type="text" size="25" name="email"></font></td>');
      document.writeln('<td align="right"></td><td></td><td align="right"></td><td></td></tr>');

    document.writeln('<tr align="left"><td align="right"><font size="3">Payment Options:</font></td>');
    document.writeln('<td><select name="08_Credit Card Type" size="1"><option selected> VISA</option><option>MASTERCARD</option><option>PayPal</option><option>Check</option><option>Money Order</option></select></td></tr>');

    document.writeln('<tr align="left"><td align="right">Card Number:</td><td><input type="text" name="09_Card #" size="20"></td></tr>');

document.writeln('<tr><td width="128"><div align="right"><p>Three digit Verify #</td><td width="449" colspan="5"><div align="left"><p><input type="text" name="10_ver#" size="4">&nbsp; REQUIRED: On back of your card just after the card number.</td></tr>');


    document.writeln('<tr align="left"><td align="right">Expiration Date:</td><td><input type="text" name="11_Expire" size="7"></td></tr>');

  document.writeln('</table>');

document.write('<p align="left"><font color="#000000" size="3">&nbsp;&nbsp; If you are ready to place your order click the "Send Order" button. Thank you for shopping at Gateway Gems. We hope your visit was enjoyable and worthwhile.</font></p>');

//END CUSTOMER INFO

//		document.writeln('<P><TABLE BORDER=0 BGCOLOR="#CCCCCC" WIDTH=500><TR><TD COLSPAN=2><CENTER>');
//		document.writeln('<INPUT TYPE=IMAGE NAME=submit_order SRC="images/x-click-but5.gif"></TD></TR></CENTER></TABLE><CENTER><BR>');
//		document.writeln('<INPUT TYPE=IMAGE NAME=submit_order SRC="images/accept1.gif" WIDTH=84 HEIGHT=38 ALIGN=BOTTOM><P>');
//		document.writeln('<INPUT TYPE="image" NAME="submit_order" SRC="images/vShoppingCart-50.gif" WIDTH=143 HEIGHT=41 ALIGN=BOTTOM>');

      document.writeln('<table border="0" width="100%" cellpadding="0"><tr><td width="100%">');
      document.writeln('<div align="center"><center><p><input type="submit" value="Send Order" name="submit_order"></p></center></div></td></tr></table>');

		document.writeln('</CENTER></FORM>');
		}
//END SUBMIT CART CONTENTS
	
	
	
	
//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 CELLPADDING=3 BGCOLOR="' + tablebodycolor + '">');
		document.writeln('<TR bgcolor=' + tableheadcolor + '><TD><b><font size=3 color=' + tablefontcolor + '>Item</FONT></B></TD><TD><B><FONT SIZE=3 COLOR=' + tablefontcolor + '>Quantity</FONT></B></TD><TD><B><FONT SIZE=3 COLOR=' + tablefontcolor + '>Cost Each</FONT></B></TD>');
		document.writeln('<TD><B><FONT SIZE=3 COLOR=' + tablefontcolor + '>Sub Total </FONT></B><TD><B><FONT SIZE=3 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;
				itemlist=itemlist+1;
				document.write('<TR><TD>'+theitem+'</TD>');
				document.write('<TD ALIGN=RIGHT><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)">Change This Quantity</A></FONT></TD>');
				document.write('<TD ALIGN=RIGHT>'+theprice+'</TD><TD ALIGN=RIGHT><B>'+alterError(itemtotal)+'</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);
				thisitem++;
				itemstart=i+1;
			}
		}
		document.writeln('<TR><TD COLSPAN=3 BGCOLOR=' + tableheadcolor + '><FONT COLOR=' + tablefontcolor + '><B>Sub Total</B></FONT></TD><TD BGCOLOR=' + tableheadcolor + ' ALIGN=RIGHT><FONT COLOR=WHITE><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+'|'+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-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";
			
		}}


//-->
