<!--
	       
var shipping = 10; // How much for shipping PER ITEM?  There MUST be a ; after the number!
var freeshipping = 9999999999999; // When is shipping free? If never, put in a very large number. There MUST be a ; after the number!
       
var business = "orders@israel-flowers-center.com";    
var returnURL = "default.asp";
      
var tableheadcolor = "#CCFFCC"; //Table Header and Footer
var tablebodycolor = "#FFFFFF"; //Body Color    
var tablefontcolor = "#339900"; //Font Color
 
// 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(newCode, newItem, newPrice, newQuantity) {
	if (newQuantity <= 0) {
		rc = alert('The quantity entered is incorrect');
	} else {
		if (confirm('Add '+newQuantity+' of '+newCode + ' ' +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)+"["+newCode+"|"+newItem+"|"+newPrice+"|"+newQuantity+"];";
			window.close();
			//window.location.href=document.location;
		}
	}
}




	
// 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;
		}//if
		i++;
	}//while
    if (cookieFound) {
		start = end + 1;
		end = document.cookie.indexOf(";",start);
		if (end < start)
			end = document.cookie.length;
		//document.cookie.substring(start,end);
	}//cookie not found		
	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) thecode = fulllist.substring(itemstart, i);
				if (thisitem==2) theitem = fulllist.substring(itemstart, i);
				if (thisitem==3) theprice = 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 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 CELLSPACING=1 WIDTH=100% CELLPADDING=3 class="basketTable">');
		document.writeln('<TR><TD><b>Code</B></TD><TD><B>Item</B></TD><TD><B>Quantity</B></TD><TD><B>Cost Each</B></TD><TD><B>Sub Total</B></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 bgcolor="' + tablebodycolor + '"><TD><font size=2>'+thecode+'</font></TD><TD>'+theitem+'</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_code" VALUE="' + thecode + '">');
				document.write('<INPUT TYPE="hidden" NAME="item_name' + '" VALUE="' + theitem + '">');
				document.write('<INPUT TYPE="hidden" NAME="item_quantity' + '" VALUE="' + thequantity + '">');
	            document.write('<INPUT TYPE="hidden" NAME="item_amount' + '" VALUE="' + alterError(itemtotal) + '">');
			} else 
			if (fulllist.substring(i,i+1) == '|') {
				if (thisitem==1) thecode = fulllist.substring(itemstart, i);
				if (thisitem==2) theitem = fulllist.substring(itemstart, i);
				if (thisitem==3) theprice = fulllist.substring(itemstart, i);
				thisitem++;
				itemstart=i+1;
			}
		}//for
// end	
		if (totprice >= freeshipping) shippingcharge = 0;
		else shippingcharge = shipping;
		if (totprice<1) shippingcharge = 0;
		totpricenoship = totprice
		totprice = totprice + shippingcharge;
		
		document.writeln('<TR><TD BGCOLOR=' + tablebodycolor + ' COLSPAN=4><FONT SIZE="2"><B>Shipping</B></FONT></TD><TD BGCOLOR=' + tablebodycolor + ' ALIGN=LEFT><FONT SIZE="2">$'+alterError(shippingcharge)+'</FONT></TD></TR>');
		document.writeln('<TR><TD COLSPAN=4><FONT SIZE="2"><B>Total To Be Charged</B></FONT></TD><TD ALIGN=LEFT><FONT COLOR=black SIZE="2"><B>$'+alterError(totprice)+'</B></FONT></TD></TR>');
		document.write('<INPUT TYPE="hidden" NAME="total_amount" VALUE="' + alterError(totprice) + '">');
		document.writeln('</TABLE>');
      	} //if cookie found
	else {
		document.writeln('<br><p align="center">No items to check</p>');
	}
}
	
	
	
	
//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 class="basketTable">');
		document.writeln('<TR><TD><b>Code</B></TD><TD><B>Item</B></TD><TD><B>Quantity</B></TD><TD><B>Cost Each</B></TD>');
		document.writeln('<TD><B>Sub Total</B><TD><B>Delete Item</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 bgcolor="' + tablebodycolor + '"><TD><font size=2>'+thecode+'</font></TD><TD>'+theitem+'</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)">Change This 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="assets/delete_item.gif" BORDER=0></CENTER></A></FONT></TD></TR>');
			} else 
			if (fulllist.substring(i,i+1) == '|') {
				if (thisitem==1) thecode = fulllist.substring(itemstart, i);
				if (thisitem==2) theitem = fulllist.substring(itemstart, i);
				if (thisitem==3) theprice = fulllist.substring(itemstart, i);
				thisitem++;
				itemstart=i+1;
			}
		} //for
		document.writeln('<TR><TD COLSPAN=3><B>Total</B></TD><TD></TD><TD ALIGN=LEFT><FONT COLOR=BLACK SIZE=2><B>$'+alterError(totprice)+'</B></FONT></TD><TD></TD></TR>');
		document.writeln('</TABLE></FORM>');
		document.writeln('<DIV align="center"><A href="https://www.israel-flowers-center.com/vbasket.asp?crt=buy"><IMG border="0" src="assets/checkout.gif"></A></DIV>');
	  } else //if cookie found
		{
			document.writeln('<br><p align="center">No items in cart</p>');
		}
	}
	
	
//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 + '['+thecode+'|'+theitem+'|'+theprice+'|'+newquant+']';
				}
			} else if (fulllist.substring(i,i+1) == '|') {
				if (thisitem==1) thecode = fulllist.substring(itemstart, i);
				if (thisitem==2) theitem = fulllist.substring(itemstart, i);
				if (thisitem==3) theprice = fulllist.substring(itemstart, i);
				thisitem++;
				itemstart=i+1;
			}
		}
	
		index = document.cookie.indexOf("vShoppingCart");
		document.cookie="vShoppingCart="+newItemList+";";
		self.location.reload();
		}
	
	
//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+";";
		self.location.reload();
		}



// 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.reload();
			
		}}


//-->

