// Web software by DavidRegier.com
function ShoppingCart(){this.msgNoCook="You have turned off Cookies! You must re-enable cookies to use our shopping cart.";this.importCart=importCart;this.exportCart=exportCart;this.setShipTaxStatus=setShipTaxStatus;this.getShipTaxStatus=getShipTaxStatus;this.quanValid=quanValid;this.showMsg=showMsg;this.removeItem=removeItem;this.changeQuan=changeQuan;this.getBaseShip=getBaseShip;this.getLeiTiLeafShippingCost=getLeiTiLeafShippingCost;this.getPlantShippingCost=getPlantShippingCost;this.getCart=getCart;this.setSub=setSub;this.delAllCookies=delAllCookies;this.initAddToCartPopUp=initAddToCartPopUp;this.initChangeQuanPopUp=initChangeQuanPopUp;this.addToCart=addToCart;this.validateArgs=validateArgs;this.writeItem=writeItem;this.getMoney=getMoney;this.itemFound=itemFound;this.reportErr=true;this.reviewData=reviewData;this.dataFile="TgmData.js";this.checkOutPage="checkout.aspx";this.viewCartPage="cart.aspx";this.Msg=new Array();this.Msg["buyIt"]="Add this item to your shopping cart";this.Msg["closeWin"]="Close this pop-up window";this.Msg["viewCart"]="Review & edit your order";this.Msg["checkout"]="Submit your order";this.addCartGUI="<form name='addCartForm' style='margin:10px 0px 0px 0px; text-align:left;' onSubmit='SC.addToCart( this ); return false;'><TABLE ALIGN='center' BORDER='0' CELLSPACING='0' CELLPADDING='0' class='fSize12 fColorGray51'><TR><TD NOWRAP ALIGN='right'><div style='margin:0px 4px 0px 0px;' class='fColorBlack'>Subtotal:</div></TD><TD NOWRAP><div style='margin:0px 2px 0px 10px;' id='cartRunSub'>$0.00</div></TD></TR><TR><TD NOWRAP ALIGN='right'><div style='margin:6px 4px 0px 0px;' class='fColorBlack'>Quantity:</div></TD><TD NOWRAP><INPUT TYPE='text' maxlength='4' name='quantity' onClick='self.status = \"Enter quantity as a number.\";' onBlur='self.status = \"\";' STYLE='width:60px; margin:6px 2px 0px 12px;' autocomplete='off'></TD></TR><TR><TD NOWRAP VALIGN=top ALIGN='right'><div style='margin:6px 4px 0px 0px;' class='fColorBlack'>Price:</div></TD><TD><div style='margin:6px 2px 0px 10px;' id='scPrice'></div></TD></TR><TR><TD NOWRAP VALIGN=top ALIGN='right'><div style='margin:6px 4px 0px 0px;' class='fColorBlack'>Item:</div></TD><TD><div style='margin:6px 2px 0px 10px;' id='scItem'></div></TD></TR><TR><TD NOWRAP VALIGN=top ALIGN='right'><div style='margin:6px 4px 0px 0px;' class='fColorBlack'>Description:</div></TD><TD><div style='margin:6px 2px 0px 10px;' id='scDescription'></div></TD></TR><TR><TD colspan=2 ALIGN='center'><INPUT TYPE='submit' value='Add to Shopping Cart' STYLE='margin:10px 0px 0px 0px;' onMouseover='self.status=this.title; return true;' onMouseout='self.status=\"\"; return true;' title='Click to add this item to your order'><div style='margin:6px 2px 0px 10px;' id='cartItem' class='scBullets'><A HREF='javascript:DW.removeWin();' onMouseOver='this.title=SC.Msg.closeWin; self.status=this.title; return true;' onMouseOut='self.status = \"\"; return true;' class='scLink'>Close</A> &#149; <A HREF='"+getURL(this.viewCartPage)+"' onMouseOver='this.title=SC.Msg.viewCart; self.status=this.title; return true;' onMouseOut='self.status = \"\"; return true;' class='scLink' onClick='return SC.getShipTaxStatus( this, event, false );'>View-Cart</A> &#149; <A HREF='"+getURL(this.checkOutPage)+"' onMouseOver='this.title=SC.Msg.checkout; self.status=this.title; return true;' onMouseOut='self.status = \"\"; return true;' class='scLink' onClick='return SC.getShipTaxStatus( this, event, false );'>Checkout</A></div></TD></TR></TABLE><INPUT TYPE='hidden' length='10' name='key'></form>";this.AddToCart=["ADD TO CART",this.addCartGUI];this.changeQuanGUI="<form name='changeQuanForm' style='margin:10px 0px 0px 0px; text-align:left;' onSubmit='SC.changeQuan( this ); return false;'><TABLE ALIGN='center' BORDER='0' CELLSPACING='0' CELLPADDING='0' class='fSize12 fColorGray51'><TR><TD NOWRAP VALIGN=top ALIGN='right'><div style='margin:6px 4px 0px 0px;' class='fColorBlack'>Item</div></TD><TD><div style='margin:6px 2px 0px 10px;' id='scItem'></div></TD></TR><TR><TD NOWRAP ALIGN='right'><div style='margin:6px 4px 0px 0px;' class='fColorBlack'>Old Quantity</div></TD><TD NOWRAP><div style='margin:6px 2px 0px 10px;' id='scOldQuan'></div></TD></TR><TR><TD NOWRAP ALIGN='right'><div style='margin:6px 4px 0px 0px;' class='fColorBlack'>New Quantity</div></TD><TD NOWRAP><INPUT TYPE='text' maxlength='4' name='quantity' onClick='self.status = \"Enter quantity as a number.\";' onBlur='self.status = \"\";' STYLE='width:60px; margin:6px 2px 0px 12px;' autocomplete='off'></TD></TR><TR><TD colspan=2 ALIGN='center'><INPUT TYPE='submit' value='Change Quantity' STYLE='margin:10px 0px 0px 0px;' onMouseover='self.status=this.title; return true;' onMouseout='self.status=\"\"; return true;' title='Click to change quantity of this item'></TD></TR></TABLE><INPUT TYPE='hidden' length='10' name='indexNum'></form>";this.ChangeQuan=["CHANGE QUANTITY",this.changeQuanGUI];this.shipTaxGUI="<form name='shipTaxForm' style='margin:6px 0px 0px 6px; text-align:left;' onSubmit='SC.setShipTaxStatus( this ); return false;'><TABLE ALIGN='center' BORDER='0' CELLSPACING='0' CELLPADDING='0' class='fSize12 fColorGray51'><TR><TD ALIGN='left'><DIV style='margin:10px 0px 0px 0px;'>1) Please send my order to:</DIV><INPUT TYPE='radio' NAME='LocationShip' style='margin:0px 0px 0px 18px;'> The U.S. Mainland or Hawaii<br><INPUT TYPE='radio' NAME='LocationShip' style='margin:0px 0px 0px 18px;'> Alaska<br><INPUT TYPE='radio' NAME='LocationShip' style='margin:0px 0px 0px 18px;'> Guam, Puerto Rico or another U.S. Territory<br><INPUT TYPE='radio' NAME='LocationShip' style='margin:0px 0px 0px 18px;'> A Foreign Country<br><DIV style='margin:10px 0px 0px 0px;'>2) I am placing this order from:</DIV><INPUT TYPE='radio' NAME='LocationTax' style='margin:0px 0px 0px 18px;'> Outside the State of Hawaii<br><INPUT TYPE='radio' NAME='LocationTax' style='margin:0px 0px 0px 18px;'> Within the State of Hawaii<br></TD></TR><TR><TD NOWRAP ALIGN='center'><DIV style='margin:6px 0px 2px 0px;' class='fSize9'><INPUT TYPE='checkbox' name='save_profile' onClick='if( checked ) self.status = \"We will store your profile & automatically apply it to future orders. Note: You can still edit your profile (if needed)\"; else self.status = \"We will NOT store your profile. We will ask for this info every time you order...\"'> Save this profile (as a cookie) & apply it to future orders</DIV><INPUT TYPE='submit' value='&nbsp;OK&nbsp;' STYLE='margin:10px 0px 0px 0px;' onMouseover='self.status=this.title; return true;' onMouseout='self.status=\"\"; return true;' title='Click to set your shipping & tax status'></TD></TR></TABLE><INPUT TYPE='hidden' length='10' name='destination'></form>";this.ShipTax=["SHIPPING & TAXES<div class='fSize8' style='font-weight:normal;'><span class=on id='shipTaxTipID'>This info must be provided to go to View-Cart or Checkout</span></div>",this.shipTaxGUI];this.shipInfo="Unless you inform us to the contrary; we will ship your order via UPS - you specify the specific service. To review or edit the specific shipping method please click \" Shipping & Taxes\" on our View-Cart page.<br><br>Upon your request, we can send your shipment via your own UPS/FedEx Account Number. In this case, your exact shipping cost payable to SPEware will be our handling fee of $"+Ship.HandlingFee+". Should you choose this, we will ask for your FedEx/UPS Account number and your preferred shipping method at checkout.<br><br><b>We do not mark-up the shipping cost</b>, however, we add a flat handling fee of $"+Ship.HandlingFee+" per order. We will not know your exact shipping cost until we pack your order. It will be subject to the delivery method, destination, weight & dimensions of your packed order, which we will determine on-line at UPS.com. Note that <b>our e-commerce software produces an estimate only, your actual cost will vary</b>. Therefore, after you submit your order, we will provide you with the exact shipping cost - which shall be subject to your approval.";this.AboutShipping=["ABOUT SHIPPING",this.shipInfo];this.aboutDiscount="This discount has been automatically determined by our e-commerce software. The price(s) showing for Cost-Ea are your discounted price(s) and the Grand-Total includes your discount.";this.AboutDiscount=["ABOUT YOUR DISCOUNT",this.aboutDiscount];function importCart(){var qStr=unescape(document.location.search.substring(1));if(qStr){var qStrRE=/^order=\d+\|.+&profile=\d\|\d\|\d{1,2}|\d\|\d&id=.+&end$/;if( qStrRE.test(qStr)){var cartData="order".getValue(qStr);var cartShipTax="profile".getValue(qStr);var exp=(qStr.charAt(qStr.length-5)=="1")?expDate365:null;var existingCart=GetCookie("cartData");if((existingCart&&confirm("You already have an existing shopping cart but are about to import a new one.\n\n1) Click OK to import the new order and overwrite your existing cart OR;\n2) Click Cancel to preserve your existing cart"))||!existingCart){SetCookie("cartData",cartData,null,"/",cookieDomain);SetCookie("cartShipTax",cartShipTax,exp,"/",cookieDomain);}}
else
alert("ERROR: Were sorry but an error occurred while trying to import a shopping cart order from the query-string portion of the URL: \""+document.location.search.substring(1)+"\"\n\nTIP: If you clicked the link from an e-mail, verify that the e-mail program did not insert hard line break(s) within the URL. If it did, you may need to manually copy & paste the \"broken\" lines into the browser's address bar.\n\nNOTE: Properly formatted URL's will always end with \"&end\"");}}
function exportCart(eMail){var cartData=GetCookie("cartData");if(cartData){var sub="Tropical Gardens of Maui Shopping Cart Order; click link to load cart";var msg="http://"+theHost+"/cart.aspx?order="+cartData+"&profile="+GetCookie("cartShipTax")+"&end";msg=msg.replaceLiteral(" ","%20");if(eMail)msg+="\n\nTO RECEPIENT: If the above web address is not \"clickable\", you will need to copy and paste it starting from \"http...\" to \"&end\" into the address field of your web browser.";}
else
var msg="Empty";if(eMail)document.location.href="mailto:?subject="+escape(sub)+"&body="+escape(msg);else
return msg;}
function getShipTaxStatus(Link,evt,userReviewing){if(navigator.cookieEnabled){var cartData=GetCookie("cartData");var cartShipTax=GetCookie("cartShipTax");var shipTaxUnknown=(cartShipTax)?false:true;if(shipTaxUnknown||userReviewing){DW.createWindow(SC.ShipTax,[1,400,0],Link,evt,6);document.shipTaxForm.destination.value=(userReviewing)?"":Link.href;if(userReviewing)document.getElementById("shipTaxTipID").className="off";if(userReviewing&&cartShipTax){var ShipTax=cartShipTax.split("|");var loc=parseInt(ShipTax[0]);var tax=parseInt(ShipTax[1]);var saveProfile=parseInt(ShipTax[2]);var Form=document.shipTaxForm;Form.LocationShip[loc].checked=true;Form.LocationTax[tax].checked=true;if(saveProfile)Form.save_profile.checked=true;}
return false;}
else
return true;}
else{alert(this.msgNoCook);return false;}}
function setShipTaxStatus(Form){var locShip=true,loc=-1;for(var i=0;i<Form.LocationShip.length;i++)if(Form.LocationShip[i].checked){loc=i;locShip=false;}
var locTax=true,tax=-1;for(var i=0;i<Form.LocationTax.length;i++)if(Form.LocationTax[i].checked){tax=i;locTax=false;}
if(locShip){alert("Please indicate your shipping destination?");Form.LocationShip[0].focus();}
else if(locTax){alert("Please indicate where you are placing this order from?");Form.LocationTax[0].focus();}
else{var exp=(Form.save_profile.checked)?expDate365:null;var saveProfile=(exp)?1:0;SetCookie("cartShipTax",loc+"|"+tax+"|"+saveProfile,exp,"/",cookieDomain);if(Form.destination.value)document.location.href=Form.destination.value;else{DW.removeWin();document.getElementById("shopping_cart").innerHTML=this.getCart(true);}}}
gCountryNum=-1;function getCart(htm){var txt=!htm;var output=(htm)?"<div id='shopping_cart' style='margin:25px 0px 0px 0px;'>":"";output+=(htm)?"<table align=center border=0 cellpadding=5 cellspacing=3 width=95% class='fSize12'>":"";var cartData=GetCookie("cartData");var newCartData="";var cartShipTax=GetCookie("cartShipTax");if(cartData&&cartShipTax){var nLeis=0;var nTiLeaves=0;var nTwoInchPots=0;var nOtherPots=0;var nNotApplicablePots=0;var ShipTax=cartShipTax.split("|");for(i in ShipTax)ShipTax[i]=parseInt(ShipTax[i]);gCountryNum=ShipTax[0];var nTaxLoc=ShipTax[1];var nSaveProfile=ShipTax[2];var Records=cartData.split("_");var nRecords=Records.length;output+=(htm)?"<tr align=center class='bkgColorForm'><th colspan=6 class='fSize14'>Your Shopping Cart</th></tr>":"";output+=(htm)?"<tr align=center class='bkgColorForm'>":"";output+=(htm)?"<th>&nbsp;</th><th>Quantity</th><th>Item</th><th>Cost Ea</th><th>Line Total</th><th>Description</th></tr>":"";var lineTotal=0;var runningTotalEligibleForDiscount=0;var runningTotalNoDiscount=0;var rowNum=0;while(rowNum<nRecords){var ThisItem=Records[rowNum].split("|");var key=ThisItem[1];var quantity=parseInt(ThisItem[0]);if(Item[key]){var price=Item[key][0];var itemName=Item[key][1].replaceLiteral("^","\"");var description=Item[key][2].replaceLiteral("^","\"");var ship=Item[key][3];var itemNotEligibleForDiscount=(Item[key][6])?true:false;switch(ship){case "pot2Inch":nTwoInchPots+=quantity;break;case "potOther":nOtherPots+=quantity;break;case "potNA":nNotApplicablePots+=quantity;break;case "tiLei":nLeis+=quantity;break;case "tiLeaf":nTiLeaves+=quantity;break;case "shipIncluded":break;default:alert("Switch/Case Error at function getCart. Unknown Ship Flag: "+ship);}
output+=(htm)?"<tr align=center class='bkgColorForm'>":"";output+=(htm)?"<td><a href='javascript:SC.removeItem("+rowNum+");' onMouseOver=\"self.status=this.title; return true;\" onMouseOut=\"self.status=''; return true;\" title='Remove this item from order' style='text-decoration:underline;'>Remove</a></td>":"";output+=(htm)?"<td><a href=javascript:'javascript:void(0);' onClick='if( window.DW ) { DW.createWindow( SC.ChangeQuan, [1,300,0], this, event, 6, [ 1, 10, -10 ] ); SC.initChangeQuanPopUp( \""+key+"\", "+quantity+", "+rowNum+" ); } return false;' onMouseOver=\"self.status=this.title; return true;\" onMouseOut=\"self.status=''; return true;\" title='Change quantity of this item' style='text-decoration:underline;'>"+quantity+"</a></td>":(output)?"\n\n"+quantity:quantity;output+=(htm)?"<td>"+itemName+"</td>":" of "+itemName;lineTotal=quantity*price;if(itemNotEligibleForDiscount){runningTotalNoDiscount+=lineTotal;if(lineTotal>Discount.floor){var dEndsWithPeriod=(description.charAt(description.length-1)==".");description+=(dEndsWithPeriod)?" ":". ";description+="Volume discount is not available on this item.";}}
else runningTotalEligibleForDiscount+=lineTotal;output+=(htm)?"<td>"+getMoney(price)+"</td>":" at "+getMoney(price)+" each";output+=(htm)?"<td>"+getMoney(lineTotal)+"</td>":" for "+getMoney(lineTotal);output+=(htm)?"<td width='35%' class='fSize10'>"+description+"</td>":"\n"+description;output+=(htm)?"</tr>":"";newCartData+=(newCartData)?"_"+Records[rowNum]:Records[rowNum];}
else
output+=(htm)?"<tr align=center class='bkgColorForm'><td> &nbsp;</td><td>-</td><td>-</td><td>-</td><td>-</td><td width='35%' class='fSize10'>ERROR: The item referenced by primary key \""+key+"\" could not be found in our data-base. This is probably because it has been discontinued. However, if you feel you have received this message in error please <nobr><A HREF='javascript:reportError( \"Tropical Gardens of Maui; Web Site Problem - Data not found\", \"Primary key \\&#34;"+key+"\\&#34; not found in \\&#34;"+this.dataFile+"\\&#34;\", 1 );'><span class='fSize10'>report this problem</span></A></nobr> to our web site administrator.</td></tr>":"";rowNum++;}
SetCookie("cartData",newCartData,null,"/",cookieDomain);var runningTotalOut=getMoney(runningTotalEligibleForDiscount+runningTotalNoDiscount);if(txt){var displayCountry="";switch(gCountryNum){case 0:displayCountry="United States (excluding Alaska)";break;case 1:displayCountry="Alaska";break;case 2:displayCountry="United States Territory";break;case 3:displayCountry="Foreign Country";break;default:alert("Switch/Case Error at getCart; gCountryNum: "+gCountryNum);}
output+="\n\nDESTINATION: "+displayCountry;}
output+=(htm)?"<TR class='bkgColorForm'><th colspan=5 align=right>Your Running Total</th><th align=center>"+runningTotalOut+"</th></tr>":"\nSUB-TOTAL: "+runningTotalOut;var shipCost=0;if(nOtherPots+nTwoInchPots>0)shipCost+=getPlantShippingCost(nTwoInchPots,nOtherPots,nNotApplicablePots,gCountryNum);if(nLeis+nTiLeaves>0)shipCost+=getLeiTiLeafShippingCost(nLeis,nTiLeaves,gCountryNum);var shipOut=getMoney(shipCost);if(runningTotalEligibleForDiscount>Discount.floor){output+=(htm)?"<TR class='bkgColorForm'><th colspan=5 align=right><span style='font-weight:normal;' class='fSize10'>(Does not apply to Leis)</span>&nbsp;&nbsp;<SPAN CLASS='bodyTextBold'>"+Discount.percent+"% Discount for orders over "+getMoney(Discount.floor)+":</SPAN></th><TH ALIGN=center><SPAN CLASS='bodyText'>&lt;"+getMoney(runningTotalEligibleForDiscount*Discount.percent/100)+"&gt;</SPAN></th></TR>":"\nDISCOUNT: <"+getMoney(runningTotalEligibleForDiscount*Discount.percent/100)+">";runningTotalEligibleForDiscount*=(1-(Discount.percent/100));}
var asterick="";var explanation="";if(nOtherPots+nTwoInchPots>0&&nLeis+nTiLeaves>0){asterick="<span class='fColorRed bold'>(a)&nbsp;</span>";explanation+=Ship.Explanation.LeisAndPlants;explanation+=(htm)?"<br><br>":"\n\n";}
if(gCountryNum==2||gCountryNum==3){asterick="<span class='fColorRed bold'>(a)&nbsp;</span>";explanation+=Ship.Explanation.Foreign;explanation+=(htm)?"<br><br>":"\n\n";}
else if(gCountryNum==1){asterick="<span class='fColorRed bold'>(a)&nbsp;</span>";explanation+=Ship.Explanation.Alaska;explanation+=(htm)?"<br><br>":"\n\n";}
output+=(htm)?"<tr class='bkgColorForm'><td colspan=5 align=right><a href=javascript:'javascript:void(0);' onClick='if( window.DW ) DW.createWindow( ABOUT_SHIPPING, [1,500,350], this, event, 6, [ 1, -250, 10 ] ); return false;' onMouseOver=\"self.status=this.title; return true;\" onMouseOut=\"self.status=''; return true;\" title='Learn more about shipping' class='qMark'>&nbsp;?&nbsp;</a>&nbsp;&nbsp;<b>"+asterick+" FedEx-Air Shipping </b></td><th align=center'>"+shipOut+"</th></tr>":"\n FEDEX SHIPPING: "+shipOut;var taxCost=(nTaxLoc>0)?(runningTotalEligibleForDiscount+runningTotalNoDiscount+shipCost)*STATE_TAX_RATE/100:0;var taxOutput=getMoney(taxCost);output+=(htm)?"<tr class='bkgColorForm'><th colspan=5 align=right><a href=javascript:'javascript:void(0);' onClick='if( window.DW ) DW.createWindow( HAWAII_TAX, [0,300,0], this, event, 6, [ 1, -150, 10 ] ); return false;' onMouseOver=\"self.status=this.title; return true;\" onMouseOut=\"self.status=''; return true;\" title='Learn more about Hawaii State Tax' class='qMark'>&nbsp;?&nbsp;</a>&nbsp;&nbsp;"+STATE_TAX_RATE+"% Hawaii State Tax </th><th align=center>"+taxOutput+"</th></tr>":"\n HAWAII TAX: "+taxOutput;var gTotalWithTax=runningTotalEligibleForDiscount+runningTotalNoDiscount+shipCost+taxCost;var gTotalOutput=getMoney(gTotalWithTax)+((shipCost=="TBD")?" + shipping":"");output+=(htm)?"<tr class='bkgColorForm'><td colspan=5 align=right>&nbsp;&nbsp;<b>Grand Total </b></td><th align=center>"+gTotalOutput+"</th></tr>":"\nGRAND TOTAL: "+gTotalOutput;if(txt)document.checkout.Grand_Total.value=gTotalOutput;}
else if(cartData)output+=(htm)?"<tr align=center class='bkgColorForm'><th>Your shopping cart will be displayed after you <a href='"+SC.viewCartPage+"' onMouseOver='self.status=\"\"; return true;' onMouseOut='self.status=\"\"; return true;' title='' onClick='return SC.getShipTaxStatus( this, event, false );'>click here</a> to declare your shipping destination and tax status. </th></tr>":"Sorry! Your shopping cart cannot be displayed because you have not declared your shipping destination & tax status. Please click the \"View Cart\" link to provide your shipping & tax info then you may submit your order.";else if(!navigator.cookieEnabled)output+=(htm)?"<tr align=center class='bkgColorForm'><th>"+SC.msgNoCook+"</th></tr>":SC.msgNoCook;else{var msgCartEmpty="Your Shopping Cart is Empty";output+=(htm)?"<tr align=center class='bkgColorForm'><th>"+msgCartEmpty+"</th></tr>":msgCartEmpty;}
output+=(htm)?"</table><br>":"";if(explanation)output+=(htm)?"<table border=0 width=90%><tr><td class='fSize11'>"+asterick+"<b>Important</b>: "+explanation.trim("<br><br>",0,1)+"<br></td></tr></table>":"\n\n"+explanation.trim("\n\n",0,1);output+=(htm)?"<div id='scConsole' class=fSize12' style='margin:8px 0px 0px 0px;'> &nbsp;<br></div><div style='margin:10px 0px 0px 0px;'><a href='javascript:history.back();' onMouseover='SC.showMsg( 1 ); return true;' onMouseout='SC.showMsg(); return true;'>Back</a>&nbsp;&#149;&nbsp;<a href='javascript:void(0);' onMouseover='SC.showMsg( 2 ); return true;' onMouseout='SC.showMsg(); return true;' onClick='return SC.getShipTaxStatus( this, event, true );'>Shipping & Taxes</a>"+((cartData)?"&nbsp;&#149;&nbsp;<a href='javascript:SC.exportCart( 1 );' onMouseover='SC.showMsg( 3 ); return true;' onMouseout='SC.showMsg(); return true;' oncontextmenu='prompt( \"ADMIN: Copy (Ctrl+C) the URL for this order:\\nTIP: Left-click link to send via e-mail\", SC.exportCart( 0 ) ); return false;'>E-mail Cart</a>":"")+"&nbsp;&#149;&nbsp;<a href='javascript:void(0);' onMouseover='if( innerHTML == PF.dText[ 0 ] ) SC.showMsg( 4 ); else SC.showMsg( 5 ); self.status=this.title; return true;' onMouseout='SC.showMsg(); self.status=\"\"; return true;' onClick='PF.setView( this, [ \"header\", \"footer\" ] ); PF.printPage( this ); return false;' oncontextmenu='PF.setView( this, [ \"header\", \"footer\" ] ); return false;' ID='prnFrLink'>Printer-Friendly</a>&nbsp;&#149;&nbsp;<a href='' onMouseover='SC.showMsg( 6 ); return true;' onMouseout='SC.showMsg(); return true;' onClick='this.href=getURL( \"checkout.aspx\" );'>Checkout</a></div>":"";output+=(htm)?"</div>":"";return output;}
function showMsg(index){if(!index)index=0;switch(index){case 1:var msg="Shortcut back to the last page you were on";break;case 2:var msg="Review & edit your shipping & tax profile";break;case 3:var msg="Send this order to a colleague, friend or yourself";break;case 4:var msg="Compact page and maximize it for your printer";break;case 5:var msg="Reformat page back to default \"web\" layout...";break;case 6:var msg="Submit your completed order on our secure-server";break;}
if(index){clearTimeout(window.cartMsgTimer);try{document.getElementById("scConsole").innerHTML=msg;} catch(e){}}
else
window.cartMsgTimer=setTimeout("try{ document.getElementById( 'scConsole' ).innerHTML = ' &nbsp;<br>'; } catch( e ) {}",500);}
function getBaseShip(gCountryNum){var baseShip=0;switch(gCountryNum){case 0:baseShip=Ship.floor;break;case 1:baseShip=Ship.floor+Ship.AlaskaSurCharge;break;case 2:baseShip=Ship.floor;break;case 3:baseShip=0;break;default:alert("Switch/Case Error at SC.getLeiTiLeafShippingCost; gCountryNum: "+gCountryNum);}
return baseShip;}
function getLeiTiLeafShippingCost(nLeis,nTiLeaves,gCountryNum){var shippingCost=getBaseShip(gCountryNum);var nItemsThatIncurShipping=nLeis+nTiLeaves;if(nItemsThatIncurShipping-nTiLeaves>2&&nLeis>5)shippingCost+=Ship.potTwoInch*(nLeis-5);if(nTiLeaves>1)shippingCost+=Ship.tiLeaf*(nTiLeaves-1);else if(nItemsThatIncurShipping==0){if(gCountryNum==1)shippingCost=Ship.AlaskaSurCharge;else shippingCost=0;}
if(gCountryNum==3)shippingCost=0;return shippingCost;}
function getPlantShippingCost(nTwoInchPots,nOtherPots,nNotApplicablePots,gCountryNum){var shippingCost=getBaseShip(gCountryNum);var nItemsThatIncurShipping=nOtherPots+nTwoInchPots;if(nItemsThatIncurShipping>0&&nNotApplicablePots>0)shippingCost-=Ship.floor;if(nItemsThatIncurShipping>2){if(nTwoInchPots==0){if(nOtherPots>2)shippingCost+=Ship.potOther*(nOtherPots-2);}
else if(nOtherPots==0){if(nTwoInchPots>5)shippingCost+=Ship.potTwoInch*(nTwoInchPots-5);}
else{if(nOtherPots>=2){shippingCost+=Ship.potOther*(nOtherPots-2);shippingCost+=nTwoInchPots*Ship.potTwoInch;}
else if(nOtherPots==1)shippingCost+=Ship.potTwoInch*(nTwoInchPots-1);}}
else if(nItemsThatIncurShipping==0){if(gCountryNum==1)shippingCost=Ship.AlaskaSurCharge;else shippingCost=0;}
if(gCountryNum==3)shippingCost=0;return shippingCost;}
function changeQuan(Form){var Quantity=Form.quantity;var rowNum=parseInt(Form.indexNum.value);var cartData=GetCookie("cartData");var cartDataNew="";var Records=cartData.split("_");for(var k=0;k<Records.length;k++){if(k==rowNum){var key=Records[k].split("|")[1];if(quanValid(Quantity,key)){var newQuan=Quantity.value;Records[k]=newQuan+"|"+key;}
else
return;}
cartDataNew+=(cartDataNew)?"_"+Records[k]:Records[k];}
SetCookie("cartData",cartDataNew,null,"/",cookieDomain);document.getElementById("shopping_cart").innerHTML=this.getCart(true);DW.removeWin();}
function removeItem(rowNum){var cartData=GetCookie("cartData");var cartDataNew="";var Records=cartData.split("_");for(var k=0;k<Records.length;k++){if(k!=rowNum)cartDataNew+=(cartDataNew)?"_"+Records[k]:Records[k];}
SetCookie("cartData",cartDataNew,null,"/",cookieDomain);document.getElementById("shopping_cart").innerHTML=this.getCart(true);}
function delAllCookies(){if(confirm("ADMIN TEST MODE; Delete cookies:\n 1) cartData: "+GetCookie("cartData")+"\n 2) cartShipTax: "+GetCookie("cartShipTax")+"\n 3) speCookie: "+GetCookie("speCookie"))){DeleteCookie("cartData","/",cookieDomain);DeleteCookie("cartShipTax","/",cookieDomain);DeleteCookie("speCookie","/",cookieDomain);}
return false;}
function setSub(showSuccess){var cartData=GetCookie("cartData");var cartShipTax=GetCookie("cartShipTax");if(cartShipTax){var ShipTax=cartShipTax.split("|");}
var runSub=0;if(cartData){var Records=cartData.split("_");for(i in Records){var ThisItem=Records[i].split("|");var quan=parseInt(ThisItem[0]);var key=ThisItem[1];var price=Item[key][0];runSub+=quan*price;}}
if(showSuccess){document.getElementById("cartRunSub").innerHTML="Calculating...";SC.runSub=runSub;setTimeout("try{ document.getElementById( 'cartRunSub' ).innerHTML = SC.getMoney( SC.runSub ); } catch( e ) {}",1000);}
else
document.getElementById("cartRunSub").innerHTML=getMoney(runSub);}
function initAddToCartPopUp(key){setSub();var charLength=40;var theItem=Item[key][1].replaceLiteral("^","\"");if(theItem.length>charLength)theItem=theItem.substring(0,charLength)+"...";document.getElementById("scItem").innerHTML=theItem;var description=Item[key][2].replaceLiteral("^","\"");if(description.length>charLength)description=description.substring(0,charLength)+"...";document.getElementById("scDescription").innerHTML=description;document.getElementById("scPrice").innerHTML=this.getMoney(Item[key][0]);document.addCartForm.key.value=key;setTimeout("document.addCartForm.quantity.focus()",(IE)?0:250);}
function initChangeQuanPopUp(key,oldQuan,indexNum){var charLength=15;var theItem=Item[key][1].replaceLiteral("^","\"");if(theItem.length>charLength)theItem=theItem.substring(0,charLength)+"...";document.getElementById("scItem").innerHTML=theItem;document.getElementById("scOldQuan").innerHTML=oldQuan;document.changeQuanForm.indexNum.value=indexNum;setTimeout("document.changeQuanForm.quantity.focus()",500);}
function quanValid(Quantity,key){if(!Quantity.value){alert("Please enter the quantity");Quantity.focus();return false;}
else if(isNaN(Quantity.value)){alert("\""+Quantity.value+"\" is not a number - please enter numbers only");Quantity.value="";Quantity.focus();return false;}
else if(parseInt(Quantity.value)<1){alert("Quantity must 1 or more");Quantity.value="";Quantity.focus();return false;}
else{var quantity=parseInt(Quantity.value);var minQuan=(typeof Item[key][4]=="number")?Item[key][4]:1;var maxQuan=(typeof Item[key][5]=="number")?Item[key][5]:-1;var itemName=Item[key][1].replaceLiteral("^","\"");if(quantity<minQuan){alert("Sorry. "+itemName+" has a minimum quantity of "+minQuan+".");Quantity.value="";Quantity.focus();return false;}
else if(maxQuan!=-1&&quantity>maxQuan){alert("Sorry, but due to limited supply, "+itemName+" has a maximum quantity of "+maxQuan+" per order.");Quantity.value="";Quantity.focus();return false;}}
return true;}
function addToCart(Form){var Quantity=Form.quantity;var key=Form.key.value;if(quanValid(Quantity,key)){if(navigator.cookieEnabled){var quantity=parseInt(Quantity.value);var theRecord=quantity+"|"+key;var cartData=GetCookie("cartData");var newRecord=(cartData)?cartData+"_"+theRecord:theRecord;SetCookie("cartData",newRecord,null,"/",cookieDomain);setSub(1);}
else
alert(this.msgNoCook);}}
function validateArgs(nPreecedingBrks,nTrailingBrks){var sub="Tropical Gardens of Maui Web Site Error; Bad Argument(s)";if(typeof nPreecedingBrks!="number")reportError(sub,"First argument (initial line breaks) passed to shopping cart method: \"SC.writeItem\", is the wrong data-type \""+typeof nPreecedingBrks+"\" it should be a number (integer).",1);else if(typeof nTrailingBrks!="number")reportError(sub,"Fourth argument (trailing line breaks) passed to shopping cart method: \"SC.writeItem\", is the wrong data-type \""+typeof nTrailingBrks+"\" it should be a number (integer).",1);}
function writeItem(nPreecedingBrks,key,nTrailingBrks){var nArgs=arguments.length;if(nArgs==3){if(this.itemFound(key)){validateArgs(nPreecedingBrks,nTrailingBrks);function getLineBreaks(nBrks){var lineBrks="";for(var i=0;i<nBrks;i++)lineBrks+="<br>";return lineBrks;}
var description=(Item[key][2])?"; "+Item[key][2].replaceLiteral("^","\""):"";var htm=getLineBreaks(nPreecedingBrks)+"<A HREF='javascript:void(0);' onMouseOver='this.title=SC.Msg.buyIt; self.status=this.title; return true;' onMouseOut='self.status = \"\"; return true;' onClick='if( window.DW ) { DW.createWindow( SC.AddToCart, [1,450,0], this, event, 6 ); SC.initAddToCartPopUp( \""+key+"\" ); } return false;' oncontextmenu='return SC.reviewData( this, event, \""+key+"\" );' class='scBuyIt'>Buy It</A>: "+Item[key][1].replaceLiteral("^","\"")+" - "+getMoney(Item[key][0])+description+getLineBreaks(nTrailingBrks);document.write(htm);}}
else
reportError("Tropical Gardens of Maui Web Site Error","Incorrect number of arguments passed to shopping cart method: \"SC.writeItem\", it should be 3, but "+nArgs+" were mistakenly passed.",1);}
function getMoney(num){if(num.toFixed)return "$"+num.toFixed(2);var newNum=""+num;var theLength=newNum.length;var theDecLoc=newNum.lastIndexOf(".");if(theDecLoc==-1){newNum=newNum+".00";return "$"+newNum;}
else{var theDollars=newNum.substring(0,theDecLoc);var theCents=newNum.substring(theDecLoc,theLength);var theCents=""+Math.round(theCents*100);if(theCents=="100"){theDollars=parseFloat(theDollars);theDollars+=1;newNum=theDollars+".00";return "$"+newNum;}
else{var newCents=(theCents.length==1)?"0"+theCents:theCents;newNum=theDollars+"."+newCents;return "$"+newNum;}}}
function itemFound(key){if(key==""){if(this.reportErr){window.reportError("Tropical Gardens of Maui; Web Site Problem - Primary Key is an empty string","All function calls to \"SC.writeItem\" must pass the item's Primary Key as a text string.",1);this.reportErr=false;}
return false;}
else if(typeof Item[key]=="undefined"){if(this.reportErr){window.reportError("Tropical Gardens of Maui; Web Site Problem - Primary Key not found in data file","The Primary Key \""+key+"\" not found in Data Base File: "+this.dataFile,1);this.reportErr=false;}
return false;}
return true;}
function reviewData(Link,evt,key){if(evt.ctrlKey){var charLength=40;var cartData=GetCookie("cartData");if(cartData&&cartData.length>charLength)cartData=cartData.substring(0,charLength)+"...";var reviewDataGUI="<TABLE ALIGN='center' BORDER='0' CELLSPACING='0' CELLPADDING='0' class='fSize11 fColorGray51'><TR><TD NOWRAP VALIGN=top ALIGN='right'>Lookup Key&nbsp;&nbsp;</TD><TD>Item."+key+"</TD></TR><TR><TD NOWRAP VALIGN=top ALIGN='right'>Price:&nbsp;&nbsp;</TD><TD>"+Item[key][0]+"</TD></TR><TR><TD NOWRAP VALIGN=top ALIGN='right'>Item&nbsp;&nbsp;</TD><TD>"+Item[key][1]+"</TD></TR><TR><TD NOWRAP VALIGN=top ALIGN='right'>Cart Description:&nbsp;&nbsp;</TD><TD>"+Item[key][2]+"</TD></TR><TR><TD NOWRAP VALIGN=top ALIGN='right'>Ship Type:&nbsp;&nbsp;</TD><TD>"+Item[key][3]+"</TD></TR><TR><TD NOWRAP VALIGN=top ALIGN='right'>Minimum Quantity:&nbsp;&nbsp;</TD><TD>"+Item[key][4]+"</TD></TR><TR><TD NOWRAP VALIGN=top ALIGN='right'>Maximum Quantity:&nbsp;&nbsp;</TD><TD>"+Item[key][5]+"</TD></TR><TR><TD VALIGN=top ALIGN='right'><A HREF='javascript:DeleteCookie( \"cartData\", \"/\", \""+cookieDomain+"\" ); DW.removeWin();' onMouseOver='self.status=this.title; return true;' onMouseOut='self.status = \"\"; return true;' class='scLink' title='Delete cartData Cookie'>cartData Cookie</A>:&nbsp;&nbsp;</TD><TD>"+cartData+"</TD></TR><TR><TD NOWRAP VALIGN=top ALIGN='right'><A HREF='javascript:DeleteCookie( \"cartShipTax\", \"/\", \""+cookieDomain+"\" ); DW.removeWin();' onMouseOver='self.status=this.title; return true;' onMouseOut='self.status = \"\"; return true;' class='scLink' title='Delete cartData Cookie'>cartShipTax Cookie</A>:&nbsp;&nbsp;</TD><TD>"+GetCookie("cartShipTax")+"</TD></TR></TABLE>";SC.ReviewData=["Administrator Review",reviewDataGUI];DW.createWindow(SC.ReviewData,[1,500,0],Link,evt,6);return false;}}}
SC=new ShoppingCart();