// ******************************************* // Redwood-r-Us // ******************************************* // ******************************************** // AddToCart - adds an item to the shoping cart // ******************************************** function AddToCart(Item, Itemnumber, Price, FreightUnit, Quantity, QtyOnHand) { Test1 = (eval(Quantity*1)); Test2 = (eval(QtyOnHand*1)); if (Quantity <= 0) {rc = alert('The quantity entered is incorrect'); return false;} if (Test1 > Test2) {Quantity = Test2}; if (Test1 > Test2) {rc = alert('There are '+QtyOnHand+' of these items remaining in stock. Please reduce your quantity or order a different item. If you would like a quote as to when we will have more of this item in stock please use the CONTACT US option on the home page.'); return false;} if (confirm('Add '+Quantity+' '+Item+' to cart (Price = '+Price+') ------------------------------------------------------------------------------------------------------------------------------------------')) { index = document.cookie.indexOf("Thecart"); countbegin = (document.cookie.indexOf("=", index) + 1); nameHeader = "" countend = document.cookie.indexOf(";", index); if (countend == -1) { countend = document.cookie.length; } if(document.cookie.indexOf("Thecart")<=0) { nameHeader = "Thecart=" } document.cookie=nameHeader+document.cookie.substring(countbegin, countend)+"["+Item+","+Itemnumber+"@"+Price+"#"+FreightUnit+"$"+Quantity+"]" + ";path=/;domain=.redwoodrus.com"; } return true; } // ***************************************************** // links - Changes color of link words // ***************************************************** function LinkWhite(input) { document.item = input; document.item.style.color = "white" } function LinkBlack(input) { document.item = input; document.item.style.color = "black" } function LinkRed(input) { document.item = input; document.item.style.color = "red" } function LinkYellow (input) { document.item = input; document.item.style.color = "Yellow" } function LinkBlue (input) { document.item = input; document.item.style.color = "Blue" } function LinkOrange (input) { document.item = input; document.item.style.color = "#ff6633" } function LinkGreen (input) { document.item = input; document.item.style.color = "Green" } function LinkPurple (input) { document.item = input; document.item.style.color = "Purple" } function Link660000 (input) { document.item = input; document.item.style.color = "#660000" } function Link33cc66 (input) { document.item = input; document.item.style.color = "#33cc66" } function Linkffad22 (input) { document.item = input; document.item.style.color = "#ffad22" } function Link993300 (input) { document.item = input; document.item.style.color = "#993300" } // ***************************************************** // Changes color of link backgrounds // ***************************************************** function LinkBGWhite(input) { document.item = input; document.item.style.background = "white" document.item.style.color = "black" } function LinkBGcccccc(input) { document.item = input; document.item.style.background = "#cccccc" document.item.style.color = "#660000" } function LinkBGebd7ce(input) { document.item = input; document.item.style.background = "#ebd7ce" document.item.style.color = "#660000" } function LinkBGBlack(input) { document.item = input; document.item.style.color = "Yellow" document.item.style.background = "Black" } // ***************************************************** // Buttons - Changes color of Buttons // ***************************************************** function ButtonWhite(input) { itemsform.item = input; itemsform.item.style.color = "white" } function ButtonBlack(input) { itemsform.item = input; itemsform.item.style.color = "black" } function ButtonBGebd7ce (input) { itemsform.item = input; itemsform.item.style.background = "#ebd7ce" } function ButtonBGcccccc (input) { itemsform.item = input; itemsform.item.style.background = "#cccccc" } // ***************************************************** // resetShoppingcart - resets to shopping cart to empty // ***************************************************** function clearcart() { index = document.cookie.indexOf("Thecart"); document.cookie="Thecart=."; } function DisplayImage(Brewery,Return,Image01Type,Image01,Image02Type,Image02,Image03Type,Image03,Image04Type,Image04,Image05Type,Image05,Image06Type,Image06,Image07Type,Image07,Image08Type,Image08) { document.writeln('
'); document.DisplayImageForm.submit(); } // ***************************************************** // Email Validation. Written by PerlScriptsJavaScripts.com // ***************************************************** function check_email(e) { ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM"; for(i=0; i < e.length ;i++){ if(ok.indexOf(e.charAt(i))<0){ return (false); } } if (document.images) { re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/; re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/; if (!e.match(re) && e.match(re_two)) { return (-1); } } } // ***************************************************** // twodecimals - outputs a number always with 2 decimals // ***************************************************** function twodecimals(value) { if (value<=0.99) {newPounds = '0';} else {newPounds = parseInt(value);} newPence = parseInt((value+.0008 - newPounds)* 100); if (eval(newPence) <= 9) newPence='0'+newPence; newString = newPounds + '.' + newPence; return (newString); }